diff --git a/@navikt/core/react/src/button/button.stories.tsx b/@navikt/core/react/src/button/button.stories.tsx index 2520c836a0..a38e01441b 100644 --- a/@navikt/core/react/src/button/button.stories.tsx +++ b/@navikt/core/react/src/button/button.stories.tsx @@ -190,3 +190,19 @@ export const ChromaticForcedColors: Story = { chromatic: { disable: false, forcedColors: "active" }, }, }; + +export const ChromaticDarksideDark: Story = { + render: Chromatic.render, + parameters: { + chromatic: { disable: false }, + }, + globals: { theme: "dark", mode: "darkside" }, +}; + +export const ChromaticDarksideLight: Story = { + render: Chromatic.render, + parameters: { + chromatic: { disable: false }, + }, + globals: { theme: "light", mode: "darkside" }, +}; diff --git a/@navikt/core/react/src/date/datepicker/DatePicker.tsx b/@navikt/core/react/src/date/datepicker/DatePicker.tsx index 2e6bf89d7b..53f2f96d0a 100644 --- a/@navikt/core/react/src/date/datepicker/DatePicker.tsx +++ b/@navikt/core/react/src/date/datepicker/DatePicker.tsx @@ -27,8 +27,8 @@ interface DatePickerComponent * ```jsx * * ``` */ diff --git a/@navikt/core/react/src/date/monthpicker/MonthPicker.tsx b/@navikt/core/react/src/date/monthpicker/MonthPicker.tsx index c58f9d48b0..649dfe205c 100644 --- a/@navikt/core/react/src/date/monthpicker/MonthPicker.tsx +++ b/@navikt/core/react/src/date/monthpicker/MonthPicker.tsx @@ -19,8 +19,8 @@ interface MonthPickerComponent * ```jsx * * ``` */ diff --git a/@navikt/core/react/src/overlays/action-menu/ActionMenu.tsx b/@navikt/core/react/src/overlays/action-menu/ActionMenu.tsx index fe99aba64e..f0af892133 100644 --- a/@navikt/core/react/src/overlays/action-menu/ActionMenu.tsx +++ b/@navikt/core/react/src/overlays/action-menu/ActionMenu.tsx @@ -274,7 +274,7 @@ const ActionMenuRoot = ({ ); }; -const ActionMenu = ActionMenuRoot as ActionMenuComponent; +export const ActionMenu = ActionMenuRoot as ActionMenuComponent; /* -------------------------------------------------------------------------- */ /* ActionMenuTrigger */ @@ -284,7 +284,10 @@ interface ActionMenuTriggerProps children: React.ReactElement; } -const ActionMenuTrigger = forwardRef( +export const ActionMenuTrigger = forwardRef< + HTMLButtonElement, + ActionMenuTriggerProps +>( ( { children, onKeyDown, style, onClick, ...rest }: ActionMenuTriggerProps, ref, @@ -330,7 +333,10 @@ interface ActionMenuContentProps children?: React.ReactNode; } -const ActionMenuContent = forwardRef( +export const ActionMenuContent = forwardRef< + HTMLDivElement, + ActionMenuContentProps +>( ( { children, @@ -382,7 +388,7 @@ interface ActionMenuLabelProps extends React.HTMLAttributes { children: React.ReactNode; } -const ActionMenuLabel = forwardRef( +export const ActionMenuLabel = forwardRef( ({ children, className, ...rest }: ActionMenuLabelProps, ref) => { return (
& ActionMenuGroupLabelingProps; -const ActionMenuGroup = forwardRef< +export const ActionMenuGroup = forwardRef< ActionMenuGroupElement, ActionMenuGroupProps >(({ children, className, label, ...rest }: ActionMenuGroupProps, ref) => { @@ -519,7 +525,7 @@ interface ActionMenuItemProps extends Omit { icon?: React.ReactNode; } -const ActionMenuItem: OverridableComponent< +export const ActionMenuItem: OverridableComponent< ActionMenuItemProps, ActionMenuItemElement > = forwardRef( @@ -577,7 +583,7 @@ interface ActionMenuCheckboxItemProps shortcut?: string; } -const ActionMenuCheckboxItem = forwardRef< +export const ActionMenuCheckboxItem = forwardRef< ActionMenuCheckboxItemElement, ActionMenuCheckboxItemProps >( @@ -687,7 +693,7 @@ type ActionMenuRadioGroupProps = ActionMenuGroupLabelingProps & children: React.ReactNode; }; -const ActionMenuRadioGroup = forwardRef< +export const ActionMenuRadioGroup = forwardRef< ActionMenuRadioGroupElement, ActionMenuRadioGroupProps >(({ children, label, ...rest }: ActionMenuRadioGroupProps, ref) => { @@ -719,7 +725,7 @@ interface ActionMenuRadioItemProps extends Omit { children: React.ReactNode; } -const ActionMenuRadioItem = forwardRef< +export const ActionMenuRadioItem = forwardRef< ActionMenuRadioItemElement, ActionMenuRadioItemProps >( @@ -810,7 +816,7 @@ type ActionMenuDividerElement = React.ElementRef; type MenuDividerProps = React.ComponentPropsWithoutRef; type ActionMenuDividerProps = Omit; -const ActionMenuDivider = forwardRef< +export const ActionMenuDivider = forwardRef< ActionMenuDividerElement, ActionMenuDividerProps >(({ className, ...rest }: ActionMenuDividerProps, ref) => { @@ -843,7 +849,7 @@ interface ActionMenuSubProps { onOpenChange?: (open: boolean) => void; } -const ActionMenuSub = (props: ActionMenuSubProps) => { +export const ActionMenuSub = (props: ActionMenuSubProps) => { const { children, open: openProp, onOpenChange, defaultOpen = false } = props; const [open = false, setOpen] = useControllableState({ @@ -871,7 +877,7 @@ interface ActionMenuSubTriggerProps icon?: React.ReactNode; } -const ActionMenuSubTrigger = forwardRef< +export const ActionMenuSubTrigger = forwardRef< ActionMenuSubTriggerElement, ActionMenuSubTriggerProps >(({ children, className, icon, ...rest }: ActionMenuSubTriggerProps, ref) => { @@ -910,7 +916,7 @@ interface ActionMenuSubContentProps children: React.ReactNode; } -const ActionMenuSubContent = forwardRef< +export const ActionMenuSubContent = forwardRef< ActionMenuSubContentElement, ActionMenuSubContentProps >( @@ -973,30 +979,18 @@ ActionMenu.Sub = ActionMenuSub; ActionMenu.SubTrigger = ActionMenuSubTrigger; ActionMenu.SubContent = ActionMenuSubContent; -export { - ActionMenu, - ActionMenuCheckboxItem, - ActionMenuContent, - ActionMenuDivider, - ActionMenuGroup, - ActionMenuItem, - ActionMenuLabel, - ActionMenuRadioGroup, - ActionMenuRadioItem, - ActionMenuSub, - ActionMenuSubContent, - ActionMenuSubTrigger, - ActionMenuTrigger, - type ActionMenuCheckboxItemProps, - type ActionMenuContentProps, - type ActionMenuDividerProps, - type ActionMenuGroupProps, - type ActionMenuLabelProps, - type ActionMenuProps, - type ActionMenuRadioGroupProps, - type ActionMenuRadioItemProps, - type ActionMenuSubContentProps, - type ActionMenuSubProps, - type ActionMenuSubTriggerProps, - type ActionMenuTriggerProps, +export type { + ActionMenuItemProps, + ActionMenuCheckboxItemProps, + ActionMenuContentProps, + ActionMenuDividerProps, + ActionMenuGroupProps, + ActionMenuLabelProps, + ActionMenuProps, + ActionMenuRadioGroupProps, + ActionMenuRadioItemProps, + ActionMenuSubContentProps, + ActionMenuSubProps, + ActionMenuSubTriggerProps, + ActionMenuTriggerProps, }; diff --git a/@navikt/core/react/src/overlays/action-menu/index.ts b/@navikt/core/react/src/overlays/action-menu/index.ts index 900fd62390..9dd738e6c3 100644 --- a/@navikt/core/react/src/overlays/action-menu/index.ts +++ b/@navikt/core/react/src/overlays/action-menu/index.ts @@ -13,6 +13,7 @@ export { ActionMenuSubContent, ActionMenuSubTrigger, ActionMenuTrigger, + type ActionMenuItemProps, type ActionMenuCheckboxItemProps, type ActionMenuContentProps, type ActionMenuGroupProps, diff --git a/aksel.nav.no/website/components/sanity-modules/code-snippet/Snippet.tsx b/aksel.nav.no/website/components/sanity-modules/code-snippet/Snippet.tsx index 6f621b9e2c..04e0c589d2 100644 --- a/aksel.nav.no/website/components/sanity-modules/code-snippet/Snippet.tsx +++ b/aksel.nav.no/website/components/sanity-modules/code-snippet/Snippet.tsx @@ -88,6 +88,7 @@ const CodeSnippet = ({ node: { code, title } }: CodeSnippetProps) => { {line.map((token, key) => ( ))} + {`\n` /* Needed for copy-pasting in some browsers */} ))} diff --git a/aksel.nav.no/website/pages/eksempler/datepicker/disabled-days.tsx b/aksel.nav.no/website/pages/eksempler/datepicker/disabled-days.tsx index af427fd928..42886a5c45 100644 --- a/aksel.nav.no/website/pages/eksempler/datepicker/disabled-days.tsx +++ b/aksel.nav.no/website/pages/eksempler/datepicker/disabled-days.tsx @@ -1,16 +1,16 @@ import { DatePicker } from "@navikt/ds-react"; import { withDsExample } from "@/web/examples/withDsExample"; -const Example = () => { - const disabledDays = [ - new Date("Oct 10 2022"), - { from: new Date("Oct 17 2022"), to: new Date("Nov 10 2022") }, - (date) => isFriday(date), - ]; +const disabledDays = [ + new Date("Oct 14 2024"), + { from: new Date("Oct 21 2024"), to: new Date("Nov 10 2024") }, + (date) => isFriday(date), +]; +const Example = () => { return ( diff --git a/aksel.nav.no/website/pages/eksempler/datepicker/dropdown.tsx b/aksel.nav.no/website/pages/eksempler/datepicker/dropdown.tsx index e509e7bbd7..761ddd3ecf 100644 --- a/aksel.nav.no/website/pages/eksempler/datepicker/dropdown.tsx +++ b/aksel.nav.no/website/pages/eksempler/datepicker/dropdown.tsx @@ -1,13 +1,15 @@ import { DatePicker } from "@navikt/ds-react"; import { withDsExample } from "@/web/examples/withDsExample"; +const year = new Date().getFullYear(); + const Example = () => { return ( ); }; diff --git a/aksel.nav.no/website/pages/eksempler/monthpicker/disabled-months.tsx b/aksel.nav.no/website/pages/eksempler/monthpicker/disabled-months.tsx index 4570669cdc..86e322bc77 100644 --- a/aksel.nav.no/website/pages/eksempler/monthpicker/disabled-months.tsx +++ b/aksel.nav.no/website/pages/eksempler/monthpicker/disabled-months.tsx @@ -1,18 +1,20 @@ import { MonthPicker } from "@navikt/ds-react"; import { withDsExample } from "@/web/examples/withDsExample"; -const Example = () => { - const disabledDays = [ - new Date("May 10 2022"), - { from: new Date("Nov 17 2022"), to: new Date("Feb 10 2023") }, - ]; +const year = new Date().getFullYear(); + +const disabledDays = [ + new Date(`May 10 ${year}`), + { from: new Date(`Nov 17 ${year}`), to: new Date(`Feb 10 ${year + 1}`) }, +]; +const Example = () => { return ( ); diff --git a/aksel.nav.no/website/pages/eksempler/monthpicker/dropdown.tsx b/aksel.nav.no/website/pages/eksempler/monthpicker/dropdown.tsx index 8fe162aecd..d874ed8433 100644 --- a/aksel.nav.no/website/pages/eksempler/monthpicker/dropdown.tsx +++ b/aksel.nav.no/website/pages/eksempler/monthpicker/dropdown.tsx @@ -1,13 +1,15 @@ import { MonthPicker } from "@navikt/ds-react"; import { withDsExample } from "@/web/examples/withDsExample"; +const year = new Date().getFullYear(); + const Example = () => { return ( ); }; diff --git a/aksel.nav.no/website/sanity/schema/objects/shared/riktekst.tsx b/aksel.nav.no/website/sanity/schema/objects/shared/riktekst.tsx index 042c0a8b5c..cf187ec088 100644 --- a/aksel.nav.no/website/sanity/schema/objects/shared/riktekst.tsx +++ b/aksel.nav.no/website/sanity/schema/objects/shared/riktekst.tsx @@ -188,7 +188,7 @@ const Riktekst = ( const templates = ["kode_eksempler", "exampletext_block"]; - const grunnleggende = ["spesial_seksjon", "attachment"]; + const grunnleggende = ["spesial_seksjon", "attachment", "props_seksjon"]; fields.push(...standard);