@navikt/ds-react 7.40.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/accordion/Accordion.d.ts +15 -7
- package/cjs/accordion/Accordion.js +4 -4
- package/cjs/accordion/Accordion.js.map +1 -1
- package/cjs/accordion/AccordionContent.js +3 -2
- package/cjs/accordion/AccordionContent.js.map +1 -1
- package/cjs/accordion/AccordionContext.d.ts +1 -2
- package/cjs/accordion/AccordionContext.js +0 -1
- package/cjs/accordion/AccordionContext.js.map +1 -1
- package/cjs/accordion/AccordionHeader.js +2 -9
- package/cjs/accordion/AccordionHeader.js.map +1 -1
- package/cjs/accordion/AccordionItem.js +0 -1
- package/cjs/accordion/AccordionItem.js.map +1 -1
- package/cjs/alert/base-alert/root/BaseAlertRoot.d.ts +3 -1
- package/cjs/alert/base-alert/root/BaseAlertRoot.js.map +1 -1
- package/cjs/alert/global-alert/root/GlobalAlertRoot.d.ts +4 -0
- package/cjs/alert/global-alert/root/GlobalAlertRoot.js.map +1 -1
- package/cjs/alert/local-alert/root/LocalAlertRoot.d.ts +4 -0
- package/cjs/alert/local-alert/root/LocalAlertRoot.js.map +1 -1
- package/cjs/button/Button.d.ts +14 -1
- package/cjs/button/Button.js +1 -1
- package/cjs/button/Button.js.map +1 -1
- package/cjs/chat/Chat.d.ts +11 -3
- package/cjs/chat/Chat.js.map +1 -1
- package/cjs/chips/Chips.d.ts +17 -17
- package/cjs/chips/Chips.js +17 -17
- package/cjs/chips/Removable.d.ts +8 -2
- package/cjs/chips/Removable.js +1 -11
- package/cjs/chips/Removable.js.map +1 -1
- package/cjs/chips/Toggle.d.ts +8 -2
- package/cjs/chips/Toggle.js +2 -11
- package/cjs/chips/Toggle.js.map +1 -1
- package/cjs/collapsible/Collapsible.d.ts +1 -1
- package/cjs/collapsible/Collapsible.js +1 -1
- package/cjs/copybutton/CopyButton.d.ts +13 -2
- package/cjs/copybutton/CopyButton.js +12 -27
- package/cjs/copybutton/CopyButton.js.map +1 -1
- package/cjs/date/Date.Dialog.js +1 -1
- package/cjs/date/Date.Dialog.js.map +1 -1
- package/cjs/dropdown/Menu/index.js +1 -1
- package/cjs/dropdown/Menu/index.js.map +1 -1
- package/cjs/expansion-card/ExpansionCard.d.ts +7 -0
- package/cjs/expansion-card/ExpansionCard.js +0 -1
- package/cjs/expansion-card/ExpansionCard.js.map +1 -1
- package/cjs/expansion-card/ExpansionCardHeader.js +1 -1
- package/cjs/expansion-card/ExpansionCardHeader.js.map +1 -1
- package/cjs/form/checkbox/Checkbox.js +32 -73
- package/cjs/form/checkbox/Checkbox.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js +2 -4
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.js +1 -1
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.js.map +1 -1
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js +2 -2
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js.map +1 -1
- package/cjs/form/file-upload/parts/item/Item.js +5 -20
- package/cjs/form/file-upload/parts/item/Item.js.map +1 -1
- package/cjs/form/file-upload/parts/item/ItemActionField.d.ts +13 -0
- package/cjs/form/file-upload/parts/item/ItemActionField.js +39 -0
- package/cjs/form/file-upload/parts/item/ItemActionField.js.map +1 -0
- package/cjs/form/file-upload/parts/item/{ItemName.d.ts → ItemHeader.d.ts} +2 -2
- package/cjs/form/file-upload/parts/item/ItemHeader.js +46 -0
- package/cjs/form/file-upload/parts/item/ItemHeader.js.map +1 -0
- package/cjs/form/file-upload/parts/item/ItemIcon.d.ts +1 -3
- package/cjs/form/file-upload/parts/item/ItemIcon.js +1 -10
- package/cjs/form/file-upload/parts/item/ItemIcon.js.map +1 -1
- package/cjs/form/form-summary/FormSummaryAnswer.js +2 -1
- package/cjs/form/form-summary/FormSummaryAnswer.js.map +1 -1
- package/cjs/form/form-summary/FormSummaryAnswers.js +5 -2
- package/cjs/form/form-summary/FormSummaryAnswers.js.map +1 -1
- package/cjs/form/form-summary/FormSummaryFooter.js +1 -1
- package/cjs/form/form-summary/FormSummaryFooter.js.map +1 -1
- package/cjs/form/radio/Radio.js +5 -18
- package/cjs/form/radio/Radio.js.map +1 -1
- package/cjs/form/search/Search.d.ts +6 -0
- package/cjs/form/search/Search.js +1 -4
- package/cjs/form/search/Search.js.map +1 -1
- package/cjs/guide-panel/GuidePanel.js +5 -10
- package/cjs/guide-panel/GuidePanel.js.map +1 -1
- package/cjs/guide-panel/Illustration.d.ts +1 -1
- package/cjs/guide-panel/Illustration.js +20 -15
- package/cjs/guide-panel/Illustration.js.map +1 -1
- package/cjs/help-text/HelpText.d.ts +10 -0
- package/cjs/help-text/HelpText.js +1 -2
- package/cjs/help-text/HelpText.js.map +1 -1
- package/cjs/help-text/HelpTextIcon.js +1 -3
- package/cjs/help-text/HelpTextIcon.js.map +1 -1
- package/cjs/inline-message/root/InlineMessage.d.ts +4 -0
- package/cjs/inline-message/root/InlineMessage.js.map +1 -1
- package/cjs/internal-header/InternalHeader.js +2 -6
- package/cjs/internal-header/InternalHeader.js.map +1 -1
- package/cjs/layout/base/BasePrimitive.d.ts +11 -11
- package/cjs/layout/base/BasePrimitive.js +1 -3
- package/cjs/layout/base/BasePrimitive.js.map +1 -1
- package/cjs/layout/bleed/Bleed.d.ts +7 -7
- package/cjs/layout/bleed/Bleed.js +3 -5
- package/cjs/layout/bleed/Bleed.js.map +1 -1
- package/cjs/layout/box/Box.d.ts +22 -12
- package/cjs/layout/box/Box.darkside.d.ts +16 -14
- package/cjs/layout/box/Box.darkside.js +11 -7
- package/cjs/layout/box/Box.darkside.js.map +1 -1
- package/cjs/layout/box/Box.js +14 -32
- package/cjs/layout/box/Box.js.map +1 -1
- package/cjs/layout/grid/HGrid.d.ts +4 -4
- package/cjs/layout/grid/HGrid.js +4 -6
- package/cjs/layout/grid/HGrid.js.map +1 -1
- package/cjs/layout/page/Page.d.ts +4 -8
- package/cjs/layout/page/Page.js +3 -9
- package/cjs/layout/page/Page.js.map +1 -1
- package/cjs/layout/stack/Stack.d.ts +1 -1
- package/cjs/layout/stack/Stack.js +1 -3
- package/cjs/layout/stack/Stack.js.map +1 -1
- package/cjs/layout/utilities/css.d.ts +2 -2
- package/cjs/layout/utilities/css.js +13 -53
- package/cjs/layout/utilities/css.js.map +1 -1
- package/cjs/layout/utilities/types.d.ts +3 -7
- package/cjs/link/Link.d.ts +11 -2
- package/cjs/link/Link.js +1 -14
- package/cjs/link/Link.js.map +1 -1
- package/cjs/link-card/LinkCard.d.ts +9 -0
- package/cjs/link-card/LinkCard.js.map +1 -1
- package/cjs/list/List.js +1 -21
- package/cjs/list/List.js.map +1 -1
- package/cjs/list/List.types.d.ts +2 -14
- package/cjs/loader/Loader.d.ts +4 -1
- package/cjs/loader/Loader.js.map +1 -1
- package/cjs/modal/Modal.js +0 -5
- package/cjs/modal/Modal.js.map +1 -1
- package/cjs/modal/ModalUtils.d.ts +1 -3
- package/cjs/modal/ModalUtils.js +1 -38
- package/cjs/modal/ModalUtils.js.map +1 -1
- package/cjs/overlays/action-menu/ActionMenu.js +14 -24
- package/cjs/overlays/action-menu/ActionMenu.js.map +1 -1
- package/cjs/overlays/floating/Floating.js +5 -5
- package/cjs/overlays/floating/Floating.js.map +1 -1
- package/cjs/pagination/Pagination.d.ts +12 -5
- package/cjs/pagination/Pagination.js +3 -10
- package/cjs/pagination/Pagination.js.map +1 -1
- package/cjs/pagination/PaginationItem.js +1 -2
- package/cjs/pagination/PaginationItem.js.map +1 -1
- package/cjs/panel/Panel.d.ts +2 -2
- package/cjs/panel/Panel.js +2 -2
- package/cjs/popover/Popover.d.ts +2 -3
- package/cjs/popover/Popover.js +6 -18
- package/cjs/popover/Popover.js.map +1 -1
- package/cjs/portal/Portal.js +2 -5
- package/cjs/portal/Portal.js.map +1 -1
- package/cjs/progress-bar/ProgressBar.d.ts +7 -0
- package/cjs/progress-bar/ProgressBar.js +2 -2
- package/cjs/progress-bar/ProgressBar.js.map +1 -1
- package/cjs/read-more/ReadMore.d.ts +11 -0
- package/cjs/read-more/ReadMore.js.map +1 -1
- package/cjs/stepper/Stepper.js +2 -7
- package/cjs/stepper/Stepper.js.map +1 -1
- package/cjs/tag/Tag.d.ts +12 -1
- package/cjs/tag/Tag.js +5 -2
- package/cjs/tag/Tag.js.map +1 -1
- package/cjs/theme/Theme.d.ts +9 -9
- package/cjs/theme/Theme.js +10 -10
- package/cjs/theme/Theme.js.map +1 -1
- package/cjs/timeline/period/index.d.ts +8 -0
- package/cjs/timeline/period/index.js.map +1 -1
- package/cjs/toggle-group/ToggleGroup.js +2 -10
- package/cjs/toggle-group/ToggleGroup.js.map +1 -1
- package/cjs/toggle-group/ToggleGroup.types.d.ts +11 -2
- package/cjs/typography/BodyLong.d.ts +9 -0
- package/cjs/typography/BodyLong.js.map +1 -1
- package/cjs/typography/BodyShort.d.ts +9 -0
- package/cjs/typography/BodyShort.js.map +1 -1
- package/cjs/typography/Detail.d.ts +9 -0
- package/cjs/typography/Detail.js.map +1 -1
- package/cjs/typography/Heading.d.ts +9 -0
- package/cjs/typography/Heading.js.map +1 -1
- package/cjs/typography/Label.d.ts +9 -0
- package/cjs/typography/Label.js.map +1 -1
- package/cjs/typography/types.d.ts +1 -1
- package/cjs/util/TextareaAutoSize.js +1 -3
- package/cjs/util/TextareaAutoSize.js.map +1 -1
- package/esm/accordion/Accordion.d.ts +15 -7
- package/esm/accordion/Accordion.js +4 -4
- package/esm/accordion/Accordion.js.map +1 -1
- package/esm/accordion/AccordionContent.js +3 -2
- package/esm/accordion/AccordionContent.js.map +1 -1
- package/esm/accordion/AccordionContext.d.ts +1 -2
- package/esm/accordion/AccordionContext.js +0 -1
- package/esm/accordion/AccordionContext.js.map +1 -1
- package/esm/accordion/AccordionHeader.js +3 -10
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/accordion/AccordionItem.js +0 -1
- package/esm/accordion/AccordionItem.js.map +1 -1
- package/esm/alert/base-alert/root/BaseAlertRoot.d.ts +3 -1
- package/esm/alert/base-alert/root/BaseAlertRoot.js.map +1 -1
- package/esm/alert/global-alert/root/GlobalAlertRoot.d.ts +4 -0
- package/esm/alert/global-alert/root/GlobalAlertRoot.js.map +1 -1
- package/esm/alert/local-alert/root/LocalAlertRoot.d.ts +4 -0
- package/esm/alert/local-alert/root/LocalAlertRoot.js.map +1 -1
- package/esm/button/Button.d.ts +14 -1
- package/esm/button/Button.js +1 -1
- package/esm/button/Button.js.map +1 -1
- package/esm/chat/Chat.d.ts +11 -3
- package/esm/chat/Chat.js.map +1 -1
- package/esm/chips/Chips.d.ts +17 -17
- package/esm/chips/Chips.js +17 -17
- package/esm/chips/Removable.d.ts +8 -2
- package/esm/chips/Removable.js +2 -12
- package/esm/chips/Removable.js.map +1 -1
- package/esm/chips/Toggle.d.ts +8 -2
- package/esm/chips/Toggle.js +3 -12
- package/esm/chips/Toggle.js.map +1 -1
- package/esm/collapsible/Collapsible.d.ts +1 -1
- package/esm/collapsible/Collapsible.js +1 -1
- package/esm/copybutton/CopyButton.d.ts +13 -2
- package/esm/copybutton/CopyButton.js +13 -28
- package/esm/copybutton/CopyButton.js.map +1 -1
- package/esm/date/Date.Dialog.js +1 -1
- package/esm/date/Date.Dialog.js.map +1 -1
- package/esm/dropdown/Menu/index.js +1 -1
- package/esm/dropdown/Menu/index.js.map +1 -1
- package/esm/expansion-card/ExpansionCard.d.ts +7 -0
- package/esm/expansion-card/ExpansionCard.js +0 -1
- package/esm/expansion-card/ExpansionCard.js.map +1 -1
- package/esm/expansion-card/ExpansionCardHeader.js +1 -1
- package/esm/expansion-card/ExpansionCardHeader.js.map +1 -1
- package/esm/form/checkbox/Checkbox.js +33 -74
- package/esm/form/checkbox/Checkbox.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js +3 -5
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js +1 -1
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js.map +1 -1
- package/esm/form/file-upload/parts/dropzone/Dropzone.js +2 -2
- package/esm/form/file-upload/parts/dropzone/Dropzone.js.map +1 -1
- package/esm/form/file-upload/parts/item/Item.js +6 -18
- package/esm/form/file-upload/parts/item/Item.js.map +1 -1
- package/esm/form/file-upload/parts/item/ItemActionField.d.ts +13 -0
- package/esm/form/file-upload/parts/item/ItemActionField.js +34 -0
- package/esm/form/file-upload/parts/item/ItemActionField.js.map +1 -0
- package/esm/form/file-upload/parts/item/{ItemName.d.ts → ItemHeader.d.ts} +2 -2
- package/esm/form/file-upload/parts/item/ItemHeader.js +40 -0
- package/esm/form/file-upload/parts/item/ItemHeader.js.map +1 -0
- package/esm/form/file-upload/parts/item/ItemIcon.d.ts +1 -3
- package/esm/form/file-upload/parts/item/ItemIcon.js +2 -11
- package/esm/form/file-upload/parts/item/ItemIcon.js.map +1 -1
- package/esm/form/form-summary/FormSummaryAnswer.js +3 -2
- package/esm/form/form-summary/FormSummaryAnswer.js.map +1 -1
- package/esm/form/form-summary/FormSummaryAnswers.js +5 -2
- package/esm/form/form-summary/FormSummaryAnswers.js.map +1 -1
- package/esm/form/form-summary/FormSummaryFooter.js +1 -1
- package/esm/form/form-summary/FormSummaryFooter.js.map +1 -1
- package/esm/form/radio/Radio.js +6 -19
- package/esm/form/radio/Radio.js.map +1 -1
- package/esm/form/search/Search.d.ts +6 -0
- package/esm/form/search/Search.js +2 -5
- package/esm/form/search/Search.js.map +1 -1
- package/esm/guide-panel/GuidePanel.js +6 -11
- package/esm/guide-panel/GuidePanel.js.map +1 -1
- package/esm/guide-panel/Illustration.d.ts +1 -1
- package/esm/guide-panel/Illustration.js +18 -13
- package/esm/guide-panel/Illustration.js.map +1 -1
- package/esm/help-text/HelpText.d.ts +10 -0
- package/esm/help-text/HelpText.js +2 -3
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/help-text/HelpTextIcon.js +1 -3
- package/esm/help-text/HelpTextIcon.js.map +1 -1
- package/esm/inline-message/root/InlineMessage.d.ts +4 -0
- package/esm/inline-message/root/InlineMessage.js.map +1 -1
- package/esm/internal-header/InternalHeader.js +3 -7
- package/esm/internal-header/InternalHeader.js.map +1 -1
- package/esm/layout/base/BasePrimitive.d.ts +11 -11
- package/esm/layout/base/BasePrimitive.js +2 -4
- package/esm/layout/base/BasePrimitive.js.map +1 -1
- package/esm/layout/bleed/Bleed.d.ts +7 -7
- package/esm/layout/bleed/Bleed.js +4 -6
- package/esm/layout/bleed/Bleed.js.map +1 -1
- package/esm/layout/box/Box.d.ts +22 -12
- package/esm/layout/box/Box.darkside.d.ts +16 -14
- package/esm/layout/box/Box.darkside.js +11 -7
- package/esm/layout/box/Box.darkside.js.map +1 -1
- package/esm/layout/box/Box.js +15 -33
- package/esm/layout/box/Box.js.map +1 -1
- package/esm/layout/grid/HGrid.d.ts +4 -4
- package/esm/layout/grid/HGrid.js +5 -7
- package/esm/layout/grid/HGrid.js.map +1 -1
- package/esm/layout/page/Page.d.ts +4 -8
- package/esm/layout/page/Page.js +4 -10
- package/esm/layout/page/Page.js.map +1 -1
- package/esm/layout/stack/Stack.d.ts +1 -1
- package/esm/layout/stack/Stack.js +2 -4
- package/esm/layout/stack/Stack.js.map +1 -1
- package/esm/layout/utilities/css.d.ts +2 -2
- package/esm/layout/utilities/css.js +13 -53
- package/esm/layout/utilities/css.js.map +1 -1
- package/esm/layout/utilities/types.d.ts +3 -7
- package/esm/link/Link.d.ts +11 -2
- package/esm/link/Link.js +2 -15
- package/esm/link/Link.js.map +1 -1
- package/esm/link-card/LinkCard.d.ts +9 -0
- package/esm/link-card/LinkCard.js.map +1 -1
- package/esm/list/List.js +3 -23
- package/esm/list/List.js.map +1 -1
- package/esm/list/List.types.d.ts +2 -14
- package/esm/loader/Loader.d.ts +4 -1
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/Modal.js +1 -6
- package/esm/modal/Modal.js.map +1 -1
- package/esm/modal/ModalUtils.d.ts +1 -3
- package/esm/modal/ModalUtils.js +1 -37
- package/esm/modal/ModalUtils.js.map +1 -1
- package/esm/overlays/action-menu/ActionMenu.js +15 -25
- package/esm/overlays/action-menu/ActionMenu.js.map +1 -1
- package/esm/overlays/floating/Floating.js +5 -5
- package/esm/overlays/floating/Floating.js.map +1 -1
- package/esm/pagination/Pagination.d.ts +12 -5
- package/esm/pagination/Pagination.js +3 -10
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/pagination/PaginationItem.js +2 -3
- package/esm/pagination/PaginationItem.js.map +1 -1
- package/esm/panel/Panel.d.ts +2 -2
- package/esm/panel/Panel.js +2 -2
- package/esm/popover/Popover.d.ts +2 -3
- package/esm/popover/Popover.js +9 -21
- package/esm/popover/Popover.js.map +1 -1
- package/esm/portal/Portal.js +2 -5
- package/esm/portal/Portal.js.map +1 -1
- package/esm/progress-bar/ProgressBar.d.ts +7 -0
- package/esm/progress-bar/ProgressBar.js +2 -2
- package/esm/progress-bar/ProgressBar.js.map +1 -1
- package/esm/read-more/ReadMore.d.ts +11 -0
- package/esm/read-more/ReadMore.js.map +1 -1
- package/esm/stepper/Stepper.js +2 -7
- package/esm/stepper/Stepper.js.map +1 -1
- package/esm/tag/Tag.d.ts +12 -1
- package/esm/tag/Tag.js +5 -2
- package/esm/tag/Tag.js.map +1 -1
- package/esm/theme/Theme.d.ts +9 -9
- package/esm/theme/Theme.js +9 -9
- package/esm/theme/Theme.js.map +1 -1
- package/esm/timeline/period/index.d.ts +8 -0
- package/esm/timeline/period/index.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.js +3 -11
- package/esm/toggle-group/ToggleGroup.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.types.d.ts +11 -2
- package/esm/types/theme.d.ts +1 -1
- package/esm/typography/BodyLong.d.ts +9 -0
- package/esm/typography/BodyLong.js.map +1 -1
- package/esm/typography/BodyShort.d.ts +9 -0
- package/esm/typography/BodyShort.js.map +1 -1
- package/esm/typography/Detail.d.ts +9 -0
- package/esm/typography/Detail.js.map +1 -1
- package/esm/typography/Heading.d.ts +9 -0
- package/esm/typography/Heading.js.map +1 -1
- package/esm/typography/Label.d.ts +9 -0
- package/esm/typography/Label.js.map +1 -1
- package/esm/typography/types.d.ts +1 -1
- package/esm/util/TextareaAutoSize.js +1 -3
- package/esm/util/TextareaAutoSize.js.map +1 -1
- package/package.json +3 -3
- package/src/accordion/Accordion.tsx +19 -18
- package/src/accordion/AccordionContent.tsx +3 -6
- package/src/accordion/AccordionContext.tsx +1 -3
- package/src/accordion/AccordionHeader.tsx +5 -11
- package/src/accordion/AccordionItem.tsx +0 -1
- package/src/alert/base-alert/root/BaseAlertRoot.tsx +3 -1
- package/src/alert/global-alert/root/GlobalAlertRoot.tsx +4 -0
- package/src/alert/local-alert/root/LocalAlertRoot.tsx +4 -0
- package/src/button/Button.tsx +23 -20
- package/src/chat/Chat.tsx +10 -3
- package/src/chips/Chips.tsx +17 -17
- package/src/chips/Removable.tsx +9 -16
- package/src/chips/Toggle.tsx +10 -14
- package/src/collapsible/Collapsible.tsx +1 -1
- package/src/copybutton/CopyButton.tsx +51 -88
- package/src/date/Date.Dialog.tsx +0 -1
- package/src/dropdown/Menu/index.tsx +0 -1
- package/src/expansion-card/ExpansionCard.tsx +7 -1
- package/src/expansion-card/ExpansionCardHeader.tsx +1 -3
- package/src/form/checkbox/Checkbox.tsx +66 -155
- package/src/form/combobox/FilteredOptions/FilteredOptions.tsx +3 -6
- package/src/form/combobox/SelectedOptions/SelectedOptions.tsx +1 -6
- package/src/form/file-upload/parts/dropzone/Dropzone.tsx +2 -0
- package/src/form/file-upload/parts/item/Item.tsx +11 -35
- package/src/form/file-upload/parts/item/ItemActionField.tsx +89 -0
- package/src/form/file-upload/parts/item/ItemHeader.tsx +81 -0
- package/src/form/file-upload/parts/item/ItemIcon.tsx +1 -22
- package/src/form/form-summary/FormSummaryAnswer.tsx +3 -1
- package/src/form/form-summary/FormSummaryAnswers.tsx +12 -16
- package/src/form/form-summary/FormSummaryFooter.tsx +0 -1
- package/src/form/radio/Radio.tsx +25 -64
- package/src/form/search/Search.tsx +8 -14
- package/src/guide-panel/GuidePanel.tsx +32 -45
- package/src/guide-panel/Illustration.tsx +75 -66
- package/src/help-text/HelpText.tsx +11 -4
- package/src/help-text/HelpTextIcon.tsx +1 -5
- package/src/inline-message/root/InlineMessage.tsx +4 -0
- package/src/internal-header/InternalHeader.tsx +8 -20
- package/src/layout/base/BasePrimitive.tsx +37 -39
- package/src/layout/bleed/Bleed.tsx +12 -22
- package/src/layout/box/Box.darkside.tsx +22 -22
- package/src/layout/box/Box.tsx +44 -60
- package/src/layout/grid/HGrid.tsx +8 -10
- package/src/layout/page/Page.tsx +7 -30
- package/src/layout/stack/Stack.tsx +6 -8
- package/src/layout/utilities/css.ts +14 -71
- package/src/layout/utilities/types.ts +2 -15
- package/src/link/Link.tsx +12 -19
- package/src/link-card/LinkCard.tsx +9 -0
- package/src/list/List.tsx +2 -57
- package/src/list/List.types.ts +2 -14
- package/src/loader/Loader.tsx +4 -1
- package/src/modal/Modal.tsx +0 -7
- package/src/modal/ModalUtils.ts +1 -47
- package/src/overlays/action-menu/ActionMenu.tsx +30 -71
- package/src/overlays/floating/Floating.tsx +5 -5
- package/src/pagination/Pagination.tsx +15 -11
- package/src/pagination/PaginationItem.tsx +3 -4
- package/src/panel/Panel.tsx +2 -2
- package/src/popover/Popover.tsx +10 -37
- package/src/portal/Portal.tsx +10 -14
- package/src/progress-bar/ProgressBar.tsx +9 -2
- package/src/react-css.d.ts +0 -3
- package/src/read-more/ReadMore.tsx +11 -0
- package/src/stepper/Stepper.tsx +3 -11
- package/src/tag/Tag.tsx +45 -41
- package/src/theme/Theme.tsx +19 -19
- package/src/timeline/period/index.tsx +8 -0
- package/src/toggle-group/ToggleGroup.tsx +2 -12
- package/src/toggle-group/ToggleGroup.types.ts +11 -2
- package/src/types/theme.d.ts +1 -1
- package/src/typography/BodyLong.tsx +9 -0
- package/src/typography/BodyShort.tsx +9 -0
- package/src/typography/Detail.tsx +9 -0
- package/src/typography/Heading.tsx +9 -0
- package/src/typography/Label.tsx +9 -0
- package/src/typography/types.ts +1 -1
- package/src/util/TextareaAutoSize.tsx +0 -3
- package/cjs/form/file-upload/parts/item/ItemName.js +0 -32
- package/cjs/form/file-upload/parts/item/ItemName.js.map +0 -1
- package/cjs/guide-panel/Illustration.darkside.d.ts +0 -2
- package/cjs/guide-panel/Illustration.darkside.js +0 -30
- package/cjs/guide-panel/Illustration.darkside.js.map +0 -1
- package/esm/form/file-upload/parts/item/ItemName.js +0 -27
- package/esm/form/file-upload/parts/item/ItemName.js.map +0 -1
- package/esm/guide-panel/Illustration.darkside.d.ts +0 -2
- package/esm/guide-panel/Illustration.darkside.js +0 -23
- package/esm/guide-panel/Illustration.darkside.js.map +0 -1
- package/src/form/file-upload/parts/item/ItemName.tsx +0 -58
- package/src/guide-panel/Illustration.darkside.tsx +0 -91
|
@@ -2,6 +2,7 @@ import React, { forwardRef } from "react";
|
|
|
2
2
|
import type {
|
|
3
3
|
AkselColoredBorderToken,
|
|
4
4
|
AkselColoredStatelessBackgroundToken,
|
|
5
|
+
AkselDynamicStatelessBackgroundToken,
|
|
5
6
|
AkselRootBackgroundToken,
|
|
6
7
|
AkselRootBorderToken,
|
|
7
8
|
AkselShadowToken,
|
|
@@ -25,27 +26,30 @@ import {
|
|
|
25
26
|
export type BoxNewProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
26
27
|
/**
|
|
27
28
|
* CSS `background-color` property.
|
|
28
|
-
* Accepts a [background
|
|
29
|
-
* @see {@link
|
|
29
|
+
* Accepts a [background color token](https://aksel.nav.no/grunnleggende/styling/design-tokens#backgroundColor).
|
|
30
|
+
* @see {@link AkselRootBackgroundToken}, {@link AkselColoredStatelessBackgroundToken} and {@link AkselDynamicStatelessBackgroundToken}
|
|
30
31
|
*/
|
|
31
|
-
background?:
|
|
32
|
+
background?:
|
|
33
|
+
| AkselRootBackgroundToken
|
|
34
|
+
| AkselColoredStatelessBackgroundToken
|
|
35
|
+
| AkselDynamicStatelessBackgroundToken;
|
|
32
36
|
/**
|
|
33
37
|
* CSS `border-color` property.
|
|
34
|
-
* Accepts a [border color token](https://aksel.nav.no/grunnleggende/styling/design-tokens#
|
|
35
|
-
* @see {@link
|
|
38
|
+
* Accepts a [border color token](https://aksel.nav.no/grunnleggende/styling/design-tokens#borderColor).
|
|
39
|
+
* @see {@link AkselColoredBorderToken}
|
|
36
40
|
*/
|
|
37
41
|
borderColor?:
|
|
38
42
|
| Exclude<AkselRootBorderToken, "focus">
|
|
39
43
|
| AkselColoredBorderToken;
|
|
40
44
|
/**
|
|
41
45
|
* CSS `border-radius` property.
|
|
42
|
-
* Accepts a [radius token](https://aksel.nav.no/grunnleggende/styling/design-tokens#
|
|
46
|
+
* Accepts a [radius token](https://aksel.nav.no/grunnleggende/styling/design-tokens#radius)
|
|
43
47
|
* or an object of radius tokens for different breakpoints.
|
|
44
48
|
* @example
|
|
45
49
|
* borderRadius='full'
|
|
46
50
|
* borderRadius='0 full 12 2'
|
|
47
51
|
* borderRadius={{xs: '2 12', sm: '0', md: '12', lg: 'full'}}
|
|
48
|
-
* @see {@link
|
|
52
|
+
* @see {@link BorderRadiusScale}
|
|
49
53
|
*/
|
|
50
54
|
borderRadius?: ResponsiveProp<
|
|
51
55
|
SpaceDelimitedAttribute<BorderRadiusScale | "0">
|
|
@@ -67,29 +71,31 @@ export type BoxNewProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
67
71
|
PrimitiveAsChildProps;
|
|
68
72
|
|
|
69
73
|
/**
|
|
70
|
-
*
|
|
71
74
|
* Foundational Layout-primitive for generic encapsulation & styling.
|
|
75
|
+
* @deprecated Deprecated in v8. Use `Box` from '@navikt/ds-react/Box' instead (with same props).
|
|
76
|
+
*
|
|
77
|
+
* **Run `npx @navikt/aksel@latest codemod v8-box-new` to migrate.**
|
|
72
78
|
*
|
|
73
79
|
* @see [📝 Documentation](https://aksel.nav.no/komponenter/primitives/box)
|
|
74
80
|
* @see 🏷️ {@link BoxProps}
|
|
75
81
|
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
|
76
82
|
*
|
|
77
83
|
* @example
|
|
78
|
-
* <Box padding="
|
|
84
|
+
* <Box padding="space-16">
|
|
79
85
|
* <BodyShort>Hei</BodyShort>
|
|
80
86
|
* </Box>
|
|
81
87
|
*
|
|
82
88
|
* @example
|
|
83
|
-
* <Box padding={{xs: '
|
|
89
|
+
* <Box padding={{xs: 'space-8', sm: 'space-12', md: 'space-16', lg: 'space-20', xl: 'space-24'}}>
|
|
84
90
|
* <BodyShort>Hei</BodyShort>
|
|
85
91
|
* </Box>
|
|
86
92
|
*
|
|
87
93
|
* @example
|
|
88
|
-
* <VStack gap="
|
|
89
|
-
* <Box padding="
|
|
94
|
+
* <VStack gap="space-32">
|
|
95
|
+
* <Box padding="space-16">
|
|
90
96
|
* <BodyShort>Hei</BodyShort>
|
|
91
97
|
* </Box>
|
|
92
|
-
* <Box padding="
|
|
98
|
+
* <Box padding="space-16">
|
|
93
99
|
* <BodyShort>Hei</BodyShort>
|
|
94
100
|
* </Box>
|
|
95
101
|
* </VStack>
|
|
@@ -128,15 +134,9 @@ export const BoxNew: OverridableComponent<BoxNewProps, HTMLDivElement> =
|
|
|
128
134
|
.map((x) => `${x}px`)
|
|
129
135
|
.join(" ")
|
|
130
136
|
: undefined,
|
|
131
|
-
...getResponsiveProps(
|
|
132
|
-
"
|
|
133
|
-
|
|
134
|
-
"radius",
|
|
135
|
-
"radius",
|
|
136
|
-
borderRadius,
|
|
137
|
-
false,
|
|
138
|
-
["0"],
|
|
139
|
-
),
|
|
137
|
+
...getResponsiveProps("box", "radius", "radius", borderRadius, false, [
|
|
138
|
+
"0",
|
|
139
|
+
]),
|
|
140
140
|
};
|
|
141
141
|
|
|
142
142
|
const Comp = asChild ? Slot : Component;
|
package/src/layout/box/Box.tsx
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
|
+
import type {
|
|
3
|
+
AkselColoredBorderToken,
|
|
4
|
+
AkselColoredStatelessBackgroundToken,
|
|
5
|
+
AkselDynamicStatelessBackgroundToken,
|
|
6
|
+
AkselRootBackgroundToken,
|
|
7
|
+
AkselRootBorderToken,
|
|
8
|
+
AkselShadowToken,
|
|
9
|
+
} from "@navikt/ds-tokens/types";
|
|
2
10
|
import { Slot } from "../../slot/Slot";
|
|
3
|
-
import { useRenameCSS
|
|
11
|
+
import { useRenameCSS } from "../../theme/Theme";
|
|
4
12
|
import { omit } from "../../util";
|
|
5
13
|
import { OverridableComponent } from "../../util/types";
|
|
6
14
|
import BasePrimitive, {
|
|
@@ -10,35 +18,39 @@ import BasePrimitive, {
|
|
|
10
18
|
import { PrimitiveAsChildProps } from "../base/PrimitiveAsChildProps";
|
|
11
19
|
import { getResponsiveProps } from "../utilities/css";
|
|
12
20
|
import {
|
|
13
|
-
BackgroundColorToken,
|
|
14
|
-
BorderColorToken,
|
|
15
21
|
BorderRadiusScale,
|
|
16
22
|
ResponsiveProp,
|
|
17
|
-
ShadowToken,
|
|
18
23
|
SpaceDelimitedAttribute,
|
|
19
|
-
SurfaceColorToken,
|
|
20
24
|
} from "../utilities/types";
|
|
21
25
|
import BoxNew from "./Box.darkside";
|
|
22
26
|
|
|
23
27
|
export type BoxProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
24
28
|
/**
|
|
25
29
|
* CSS `background-color` property.
|
|
26
|
-
* Accepts a [background
|
|
30
|
+
* Accepts a [background color token](https://aksel.nav.no/grunnleggende/styling/design-tokens#backgroundColor).
|
|
31
|
+
* @see {@link AkselRootBackgroundToken}, {@link AkselColoredStatelessBackgroundToken} and {@link AkselDynamicStatelessBackgroundToken}
|
|
27
32
|
*/
|
|
28
|
-
background?:
|
|
33
|
+
background?:
|
|
34
|
+
| AkselRootBackgroundToken
|
|
35
|
+
| AkselColoredStatelessBackgroundToken
|
|
36
|
+
| AkselDynamicStatelessBackgroundToken;
|
|
29
37
|
/**
|
|
30
38
|
* CSS `border-color` property.
|
|
31
|
-
* Accepts a [border color token](https://aksel.nav.no/grunnleggende/styling/design-tokens#
|
|
39
|
+
* Accepts a [border color token](https://aksel.nav.no/grunnleggende/styling/design-tokens#borderColor).
|
|
40
|
+
* @see {@link AkselColoredBorderToken}
|
|
32
41
|
*/
|
|
33
|
-
borderColor?:
|
|
42
|
+
borderColor?:
|
|
43
|
+
| Exclude<AkselRootBorderToken, "focus">
|
|
44
|
+
| AkselColoredBorderToken;
|
|
34
45
|
/**
|
|
35
46
|
* CSS `border-radius` property.
|
|
36
|
-
* Accepts a [radius token](https://aksel.nav.no/grunnleggende/styling/design-tokens#
|
|
47
|
+
* Accepts a [radius token](https://aksel.nav.no/grunnleggende/styling/design-tokens#radius)
|
|
37
48
|
* or an object of radius tokens for different breakpoints.
|
|
38
49
|
* @example
|
|
39
50
|
* borderRadius='full'
|
|
40
51
|
* borderRadius='0 full 12 2'
|
|
41
52
|
* borderRadius={{xs: '2 12', sm: '0', md: '12', lg: 'full'}}
|
|
53
|
+
* @see {@link BorderRadiusScale}
|
|
42
54
|
*/
|
|
43
55
|
borderRadius?: ResponsiveProp<
|
|
44
56
|
SpaceDelimitedAttribute<BorderRadiusScale | "0">
|
|
@@ -53,13 +65,19 @@ export type BoxProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
53
65
|
/** Shadow on box. Accepts a shadow token.
|
|
54
66
|
* @example
|
|
55
67
|
* shadow='small'
|
|
68
|
+
* @see {@link ShadowKeys}
|
|
56
69
|
*/
|
|
57
|
-
shadow?:
|
|
70
|
+
shadow?: AkselShadowToken;
|
|
58
71
|
} & PrimitiveProps &
|
|
59
72
|
PrimitiveAsChildProps;
|
|
60
73
|
|
|
61
74
|
interface BoxComponentType
|
|
62
75
|
extends OverridableComponent<BoxProps, HTMLDivElement> {
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Deprecated in v8. Use `Box` from '@navikt/ds-react/Box' instead (with same props).
|
|
78
|
+
*
|
|
79
|
+
* **Run `npx @navikt/aksel@latest codemod v8-box-new`> to migrate.**
|
|
80
|
+
*/
|
|
63
81
|
New: typeof BoxNew;
|
|
64
82
|
}
|
|
65
83
|
|
|
@@ -71,21 +89,21 @@ interface BoxComponentType
|
|
|
71
89
|
* @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
|
|
72
90
|
*
|
|
73
91
|
* @example
|
|
74
|
-
* <Box padding="
|
|
92
|
+
* <Box padding="space-16">
|
|
75
93
|
* <BodyShort>Hei</BodyShort>
|
|
76
94
|
* </Box>
|
|
77
95
|
*
|
|
78
96
|
* @example
|
|
79
|
-
* <Box padding={{xs: '
|
|
97
|
+
* <Box padding={{xs: 'space-8', sm: 'space-12', md: 'space-16', lg: 'space-20', xl: 'space-24'}}>
|
|
80
98
|
* <BodyShort>Hei</BodyShort>
|
|
81
99
|
* </Box>
|
|
82
100
|
*
|
|
83
101
|
* @example
|
|
84
|
-
* <VStack gap="
|
|
85
|
-
* <Box padding="
|
|
102
|
+
* <VStack gap="space-32">
|
|
103
|
+
* <Box padding="space-16">
|
|
86
104
|
* <BodyShort>Hei</BodyShort>
|
|
87
105
|
* </Box>
|
|
88
|
-
* <Box padding="
|
|
106
|
+
* <Box padding="space-16">
|
|
89
107
|
* <BodyShort>Hei</BodyShort>
|
|
90
108
|
* </Box>
|
|
91
109
|
* </VStack>
|
|
@@ -108,57 +126,25 @@ export const BoxComponent: OverridableComponent<BoxProps, HTMLDivElement> =
|
|
|
108
126
|
}: BoxProps & { as?: React.ElementType },
|
|
109
127
|
ref,
|
|
110
128
|
) => {
|
|
111
|
-
const themeContext = useThemeInternal();
|
|
112
129
|
const { cn } = useRenameCSS();
|
|
113
|
-
|
|
114
|
-
if (
|
|
115
|
-
process.env.NODE_ENV !== "production" &&
|
|
116
|
-
themeContext?.isDarkside &&
|
|
117
|
-
(background || borderColor || shadow)
|
|
118
|
-
) {
|
|
119
|
-
let errorText = ``;
|
|
120
|
-
if (background) {
|
|
121
|
-
errorText += `\n- background: "${background}"`;
|
|
122
|
-
}
|
|
123
|
-
if (borderColor) {
|
|
124
|
-
errorText += `\n- borderColor: "${borderColor}"`;
|
|
125
|
-
}
|
|
126
|
-
if (shadow) {
|
|
127
|
-
errorText += `\n- shadow: "${shadow}"`;
|
|
128
|
-
}
|
|
129
|
-
throw new Error(
|
|
130
|
-
`<Box /> with properties 'background', 'borderColor' or 'shadow' cannot be used with Aksel <Theme /> (darkmode-support). \nTo continue using these properties, migrate to '<Box.New>' (BoxNew for RSC)\nUpdate these props:${errorText}`,
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const prefix = themeContext?.isDarkside ? "ax" : "a";
|
|
135
|
-
|
|
136
130
|
const style: React.CSSProperties = {
|
|
137
131
|
..._style,
|
|
138
|
-
|
|
139
|
-
? `var(--
|
|
140
|
-
: undefined,
|
|
141
|
-
[`--__${prefix}c-box-shadow`]: shadow
|
|
142
|
-
? `var(--a-shadow-${shadow})`
|
|
132
|
+
"--__axc-box-background": background
|
|
133
|
+
? `var(--ax-bg-${background})`
|
|
143
134
|
: undefined,
|
|
144
|
-
|
|
145
|
-
|
|
135
|
+
"--__axc-box-shadow": shadow ? `var(--ax-shadow-${shadow})` : undefined,
|
|
136
|
+
"--__axc-box-border-color": borderColor
|
|
137
|
+
? `var(--ax-border-${borderColor})`
|
|
146
138
|
: undefined,
|
|
147
|
-
|
|
139
|
+
"--__axc-box-border-width": borderWidth
|
|
148
140
|
? borderWidth
|
|
149
141
|
.split(" ")
|
|
150
142
|
.map((x) => `${x}px`)
|
|
151
143
|
.join(" ")
|
|
152
144
|
: undefined,
|
|
153
|
-
...getResponsiveProps(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
"radius",
|
|
157
|
-
"radius",
|
|
158
|
-
borderRadius,
|
|
159
|
-
false,
|
|
160
|
-
["0"],
|
|
161
|
-
),
|
|
145
|
+
...getResponsiveProps("box", "radius", "radius", borderRadius, false, [
|
|
146
|
+
"0",
|
|
147
|
+
]),
|
|
162
148
|
};
|
|
163
149
|
|
|
164
150
|
const Comp = asChild ? Slot : Component;
|
|
@@ -173,9 +159,7 @@ export const BoxComponent: OverridableComponent<BoxProps, HTMLDivElement> =
|
|
|
173
159
|
"navds-box-bg": background,
|
|
174
160
|
"navds-box-border-color": borderColor,
|
|
175
161
|
"navds-box-border-width": borderWidth,
|
|
176
|
-
"navds-box-
|
|
177
|
-
borderRadius && !themeContext?.isDarkside,
|
|
178
|
-
"navds-box-radius": borderRadius && themeContext?.isDarkside,
|
|
162
|
+
"navds-box-radius": borderRadius,
|
|
179
163
|
"navds-box-shadow": shadow,
|
|
180
164
|
})}
|
|
181
165
|
>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import { Slot } from "../../slot/Slot";
|
|
3
|
-
import { useRenameCSS
|
|
3
|
+
import { useRenameCSS } from "../../theme/Theme";
|
|
4
4
|
import { OverridableComponent, omit } from "../../util";
|
|
5
5
|
import BasePrimitive, {
|
|
6
6
|
PRIMITIVE_PROPS,
|
|
@@ -22,7 +22,7 @@ export type HGridProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
22
22
|
columns?: ResponsiveProp<number | string>;
|
|
23
23
|
/**
|
|
24
24
|
* Spacing between columns.
|
|
25
|
-
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#
|
|
25
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#space)
|
|
26
26
|
* or an object of spacing tokens for different breakpoints.
|
|
27
27
|
* @example
|
|
28
28
|
* gap="space-20"
|
|
@@ -43,19 +43,19 @@ export type HGridProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
43
43
|
* @see 🏷️ {@link HGridProps}
|
|
44
44
|
*
|
|
45
45
|
* @example
|
|
46
|
-
* <HGrid gap="
|
|
46
|
+
* <HGrid gap="space-24" columns={3}>
|
|
47
47
|
* <div />
|
|
48
48
|
* <div />
|
|
49
49
|
* <div />
|
|
50
50
|
* </HGrid>
|
|
51
51
|
* @example
|
|
52
|
-
* <HGrid gap={{xs: "
|
|
52
|
+
* <HGrid gap={{xs: "space-8", md: "space-24"}} columns={3}>
|
|
53
53
|
* <div />
|
|
54
54
|
* <div />
|
|
55
55
|
* <div />
|
|
56
56
|
* </HGrid>
|
|
57
57
|
* @example
|
|
58
|
-
* <HGrid gap="
|
|
58
|
+
* <HGrid gap="space-24" columns={{ sm: 1, md: 1, lg: "1fr auto", xl: "1fr auto"}}>
|
|
59
59
|
* <div />
|
|
60
60
|
* <div />
|
|
61
61
|
* <div />
|
|
@@ -77,15 +77,13 @@ export const HGrid: OverridableComponent<HGridProps, HTMLDivElement> =
|
|
|
77
77
|
},
|
|
78
78
|
ref,
|
|
79
79
|
) => {
|
|
80
|
-
const themeContext = useThemeInternal();
|
|
81
|
-
const prefix = themeContext?.isDarkside ? "ax" : "a";
|
|
82
80
|
const { cn } = useRenameCSS();
|
|
83
81
|
|
|
84
82
|
const styles: React.CSSProperties = {
|
|
85
83
|
...style,
|
|
86
|
-
|
|
87
|
-
...getResponsiveProps(
|
|
88
|
-
...getResponsiveValue(
|
|
84
|
+
"--__axc-hgrid-align": align,
|
|
85
|
+
...getResponsiveProps(`hgrid`, "gap", "space", gap),
|
|
86
|
+
...getResponsiveValue(`hgrid`, "columns", formatGrid(columns)),
|
|
89
87
|
};
|
|
90
88
|
|
|
91
89
|
const Comp = asChild ? Slot : Component;
|
package/src/layout/page/Page.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
|
-
import { useRenameCSS
|
|
3
|
-
import { OverridableComponent } from "../../util";
|
|
4
|
-
import { BackgroundColorToken } from "../utilities/types";
|
|
2
|
+
import { useRenameCSS } from "../../theme/Theme";
|
|
3
|
+
import { OverridableComponent, omit } from "../../util";
|
|
5
4
|
import { PageBlock } from "./parts/PageBlock";
|
|
6
5
|
|
|
7
6
|
export interface PageProps extends React.HTMLAttributes<HTMLElement> {
|
|
@@ -10,13 +9,6 @@ export interface PageProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
10
9
|
* @default "div"
|
|
11
10
|
*/
|
|
12
11
|
as?: "div" | "body";
|
|
13
|
-
/**
|
|
14
|
-
* Background color.
|
|
15
|
-
* Accepts a [background color token](https://aksel.nav.no/grunnleggende/styling/design-tokens#753d1cf4d1d6).
|
|
16
|
-
* @default "bg-default"
|
|
17
|
-
* @deprecated Use `<Box asChild background="...">` wrapped around `<Page>`.
|
|
18
|
-
*/
|
|
19
|
-
background?: BackgroundColorToken;
|
|
20
12
|
/**
|
|
21
13
|
* Allows better positioning of footer
|
|
22
14
|
*/
|
|
@@ -30,6 +22,10 @@ export interface PageProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
30
22
|
* @default "end"
|
|
31
23
|
*/
|
|
32
24
|
contentBlockPadding?: "end" | "none";
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Deprecated in v8 and no longer has any effect. Use `<Box asChild background="...">` wrapped around `<Page>`.
|
|
27
|
+
*/
|
|
28
|
+
background?: string;
|
|
33
29
|
}
|
|
34
30
|
|
|
35
31
|
interface PageComponentType
|
|
@@ -43,42 +39,23 @@ export const PageComponent: OverridableComponent<PageProps, HTMLElement> =
|
|
|
43
39
|
{
|
|
44
40
|
as: Component = "div",
|
|
45
41
|
className,
|
|
46
|
-
style: _style,
|
|
47
42
|
footer,
|
|
48
43
|
children,
|
|
49
44
|
footerPosition,
|
|
50
|
-
background,
|
|
51
45
|
contentBlockPadding = "end",
|
|
52
46
|
...rest
|
|
53
47
|
},
|
|
54
48
|
ref,
|
|
55
49
|
) => {
|
|
56
|
-
const themeContext = useThemeInternal();
|
|
57
50
|
const { cn } = useRenameCSS();
|
|
58
51
|
|
|
59
|
-
if (
|
|
60
|
-
process.env.NODE_ENV !== "production" &&
|
|
61
|
-
themeContext?.isDarkside &&
|
|
62
|
-
background
|
|
63
|
-
) {
|
|
64
|
-
console.warn(
|
|
65
|
-
`Prop \`background\` is deprecated and cannot be used with theme-support. Instead wrap component with \`<Box asChild background>\``,
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const style: React.CSSProperties = {
|
|
70
|
-
..._style,
|
|
71
|
-
"--__ac-page-background": `var(--a-${background ?? "bg-default"})`,
|
|
72
|
-
};
|
|
73
|
-
|
|
74
52
|
const belowFold = footerPosition === "belowFold";
|
|
75
53
|
|
|
76
54
|
return (
|
|
77
55
|
<Component
|
|
78
|
-
{...rest}
|
|
56
|
+
{...omit(rest, ["background"])}
|
|
79
57
|
className={cn("navds-page", className)}
|
|
80
58
|
ref={ref}
|
|
81
|
-
style={style}
|
|
82
59
|
>
|
|
83
60
|
<div
|
|
84
61
|
className={cn({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { HTMLAttributes, forwardRef } from "react";
|
|
2
2
|
import { Slot } from "../../slot/Slot";
|
|
3
|
-
import { useRenameCSS
|
|
3
|
+
import { useRenameCSS } from "../../theme/Theme";
|
|
4
4
|
import { omit } from "../../util";
|
|
5
5
|
import { OverridableComponent } from "../../util/types";
|
|
6
6
|
import BasePrimitive, {
|
|
@@ -42,7 +42,7 @@ export type StackProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
42
42
|
wrap?: boolean;
|
|
43
43
|
/**
|
|
44
44
|
* CSS `gap` property.
|
|
45
|
-
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#
|
|
45
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#space)
|
|
46
46
|
* or an object of spacing tokens for different breakpoints.
|
|
47
47
|
*
|
|
48
48
|
* @example
|
|
@@ -83,16 +83,14 @@ export const Stack: OverridableComponent<StackProps, HTMLDivElement> =
|
|
|
83
83
|
},
|
|
84
84
|
ref,
|
|
85
85
|
) => {
|
|
86
|
-
const themeContext = useThemeInternal();
|
|
87
|
-
const prefix = themeContext?.isDarkside ? "ax" : "a";
|
|
88
86
|
const { cn } = useRenameCSS();
|
|
89
87
|
|
|
90
88
|
const style: React.CSSProperties = {
|
|
91
89
|
..._style,
|
|
92
|
-
...getResponsiveProps(
|
|
93
|
-
...getResponsiveValue(
|
|
94
|
-
...getResponsiveValue(
|
|
95
|
-
...getResponsiveValue(
|
|
90
|
+
...getResponsiveProps(`stack`, "gap", "space", gap),
|
|
91
|
+
...getResponsiveValue(`stack`, "direction", direction),
|
|
92
|
+
...getResponsiveValue(`stack`, "align", align),
|
|
93
|
+
...getResponsiveValue(`stack`, "justify", justify),
|
|
96
94
|
};
|
|
97
95
|
|
|
98
96
|
const Comp = asChild ? Slot : Component;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AkselBorderRadiusToken,
|
|
3
|
-
AkselLegacyBorderRadiusToken,
|
|
4
|
-
AkselLegacySpacingToken,
|
|
5
|
-
AkselSpaceToken,
|
|
6
|
-
} from "@navikt/ds-tokens/types";
|
|
7
1
|
import { ResponsiveProp } from "./types";
|
|
8
2
|
|
|
3
|
+
const TOKEN_PREFIX = "ax";
|
|
4
|
+
|
|
9
5
|
export function getResponsiveValue<T = string>(
|
|
10
|
-
prefix: string,
|
|
11
6
|
componentName: string,
|
|
12
7
|
componentProp: string,
|
|
13
8
|
responsiveProp?: ResponsiveProp<T>,
|
|
@@ -18,66 +13,25 @@ export function getResponsiveValue<T = string>(
|
|
|
18
13
|
|
|
19
14
|
if (typeof responsiveProp === "string") {
|
|
20
15
|
return {
|
|
21
|
-
[`--__${
|
|
16
|
+
[`--__${TOKEN_PREFIX}c-${componentName}-${componentProp}-xs`]:
|
|
17
|
+
responsiveProp,
|
|
22
18
|
};
|
|
23
19
|
}
|
|
24
20
|
|
|
25
21
|
return Object.fromEntries(
|
|
26
22
|
Object.entries(responsiveProp).map(([breakpointAlias, responsiveValue]) => [
|
|
27
|
-
`--__${
|
|
23
|
+
`--__${TOKEN_PREFIX}c-${componentName}-${componentProp}-${breakpointAlias}`,
|
|
28
24
|
responsiveValue,
|
|
29
25
|
]),
|
|
30
26
|
);
|
|
31
27
|
}
|
|
32
28
|
|
|
33
|
-
/**
|
|
34
|
-
* Temporary lookup for mapping legacy spacing tokens to new space tokens.
|
|
35
|
-
*/
|
|
36
|
-
const legacySpacingTokenLookup: Record<
|
|
37
|
-
`--ax-spacing-${AkselLegacySpacingToken}`,
|
|
38
|
-
`--ax-${AkselSpaceToken}`
|
|
39
|
-
> = {
|
|
40
|
-
"--ax-spacing-32": "--ax-space-128",
|
|
41
|
-
"--ax-spacing-24": "--ax-space-96",
|
|
42
|
-
"--ax-spacing-20": "--ax-space-80",
|
|
43
|
-
"--ax-spacing-18": "--ax-space-72",
|
|
44
|
-
"--ax-spacing-16": "--ax-space-64",
|
|
45
|
-
"--ax-spacing-14": "--ax-space-56",
|
|
46
|
-
"--ax-spacing-12": "--ax-space-48",
|
|
47
|
-
"--ax-spacing-11": "--ax-space-44",
|
|
48
|
-
"--ax-spacing-10": "--ax-space-40",
|
|
49
|
-
"--ax-spacing-9": "--ax-space-36",
|
|
50
|
-
"--ax-spacing-8": "--ax-space-32",
|
|
51
|
-
"--ax-spacing-7": "--ax-space-28",
|
|
52
|
-
"--ax-spacing-6": "--ax-space-24",
|
|
53
|
-
"--ax-spacing-5": "--ax-space-20",
|
|
54
|
-
"--ax-spacing-4": "--ax-space-16",
|
|
55
|
-
"--ax-spacing-3": "--ax-space-12",
|
|
56
|
-
"--ax-spacing-2": "--ax-space-8",
|
|
57
|
-
"--ax-spacing-1-alt": "--ax-space-6",
|
|
58
|
-
"--ax-spacing-1": "--ax-space-4",
|
|
59
|
-
"--ax-spacing-05": "--ax-space-2",
|
|
60
|
-
"--ax-spacing-0": "--ax-space-0",
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const legacyBorderRadiusNameTokenLookup: Record<
|
|
64
|
-
`${AkselLegacyBorderRadiusToken}`,
|
|
65
|
-
`${AkselBorderRadiusToken}`
|
|
66
|
-
> = {
|
|
67
|
-
full: "full",
|
|
68
|
-
xlarge: "12",
|
|
69
|
-
large: "8",
|
|
70
|
-
medium: "4",
|
|
71
|
-
small: "2",
|
|
72
|
-
};
|
|
73
|
-
|
|
74
29
|
const translateTokenStringToCSS = (
|
|
75
30
|
specialLayout: string,
|
|
76
31
|
tokenString: string,
|
|
77
|
-
tokenSubgroup: "
|
|
32
|
+
tokenSubgroup: "space" | "radius",
|
|
78
33
|
tokenExceptions: string[],
|
|
79
34
|
invert: boolean,
|
|
80
|
-
prefix: string,
|
|
81
35
|
) => {
|
|
82
36
|
return tokenString
|
|
83
37
|
.split(" ")
|
|
@@ -94,22 +48,14 @@ const translateTokenStringToCSS = (
|
|
|
94
48
|
}
|
|
95
49
|
|
|
96
50
|
// Handle exceptions and space tokens
|
|
97
|
-
let output = `var(--${
|
|
51
|
+
let output = `var(--${TOKEN_PREFIX}-${tokenSubgroup}-${propValue})`;
|
|
98
52
|
|
|
99
53
|
if (tokenExceptions.includes(propValue)) {
|
|
100
|
-
output = propValue
|
|
101
|
-
} else if (tokenSubgroup === "
|
|
102
|
-
|
|
103
|
-
output = `var(--${prefix}-${propValue})`;
|
|
104
|
-
} else if (tokenSubgroup === "spacing") {
|
|
105
|
-
/* Translate old "spacing" tokens to new "space" tokens */
|
|
106
|
-
const spacingTokenName = `--${prefix}-spacing-${propValue}`;
|
|
107
|
-
output = `var(${
|
|
108
|
-
legacySpacingTokenLookup[spacingTokenName] ?? spacingTokenName
|
|
109
|
-
})`;
|
|
54
|
+
output = propValue;
|
|
55
|
+
} else if (tokenSubgroup === "space") {
|
|
56
|
+
output = `var(--${TOKEN_PREFIX}-${propValue})`;
|
|
110
57
|
} else if (tokenSubgroup === "radius") {
|
|
111
|
-
|
|
112
|
-
output = `var(--${prefix}-radius-${name})`;
|
|
58
|
+
output = `var(--${TOKEN_PREFIX}-radius-${propValue})`;
|
|
113
59
|
}
|
|
114
60
|
|
|
115
61
|
// Handle inversion for negative values
|
|
@@ -123,10 +69,9 @@ const translateTokenStringToCSS = (
|
|
|
123
69
|
};
|
|
124
70
|
|
|
125
71
|
export function getResponsiveProps<T extends string>(
|
|
126
|
-
prefix: string,
|
|
127
72
|
componentName: string,
|
|
128
73
|
componentProp: string,
|
|
129
|
-
tokenSubgroup: "
|
|
74
|
+
tokenSubgroup: "space" | "radius",
|
|
130
75
|
responsiveProp?: ResponsiveProp<T>,
|
|
131
76
|
invert = false,
|
|
132
77
|
tokenExceptions: string[] = [],
|
|
@@ -137,14 +82,13 @@ export function getResponsiveProps<T extends string>(
|
|
|
137
82
|
|
|
138
83
|
if (typeof responsiveProp === "string") {
|
|
139
84
|
return {
|
|
140
|
-
[`--__${
|
|
85
|
+
[`--__${TOKEN_PREFIX}c-${componentName}-${componentProp}-xs`]:
|
|
141
86
|
translateTokenStringToCSS(
|
|
142
87
|
componentProp,
|
|
143
88
|
responsiveProp,
|
|
144
89
|
tokenSubgroup,
|
|
145
90
|
tokenExceptions,
|
|
146
91
|
invert,
|
|
147
|
-
prefix,
|
|
148
92
|
),
|
|
149
93
|
};
|
|
150
94
|
}
|
|
@@ -152,14 +96,13 @@ export function getResponsiveProps<T extends string>(
|
|
|
152
96
|
const styleProps = {};
|
|
153
97
|
Object.entries(responsiveProp).forEach(([breakpointAlias, aliasOrScale]) => {
|
|
154
98
|
styleProps[
|
|
155
|
-
`--__${
|
|
99
|
+
`--__${TOKEN_PREFIX}c-${componentName}-${componentProp}-${breakpointAlias}`
|
|
156
100
|
] = translateTokenStringToCSS(
|
|
157
101
|
componentProp,
|
|
158
102
|
aliasOrScale,
|
|
159
103
|
tokenSubgroup,
|
|
160
104
|
tokenExceptions,
|
|
161
105
|
invert,
|
|
162
|
-
prefix,
|
|
163
106
|
);
|
|
164
107
|
});
|
|
165
108
|
return styleProps;
|
|
@@ -1,29 +1,16 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
AkselBorderRadiusToken,
|
|
3
3
|
AkselBreakpointToken,
|
|
4
|
-
AkselLegacyBackgroundColorToken,
|
|
5
|
-
AkselLegacyBorderColorToken,
|
|
6
|
-
AkselLegacyBorderRadiusToken,
|
|
7
|
-
AkselLegacyShadowToken,
|
|
8
|
-
AkselLegacySpacingToken,
|
|
9
|
-
AkselLegacySurfaceColorToken,
|
|
10
4
|
AkselSpaceToken,
|
|
11
5
|
} from "@navikt/ds-tokens/types";
|
|
12
6
|
|
|
13
|
-
export type BackgroundColorToken = AkselLegacyBackgroundColorToken;
|
|
14
|
-
export type SurfaceColorToken = AkselLegacySurfaceColorToken;
|
|
15
|
-
export type BorderColorToken = AkselLegacyBorderColorToken;
|
|
16
|
-
export type ShadowToken = AkselLegacyShadowToken;
|
|
17
|
-
|
|
18
7
|
export type BreakpointsAlias = Extract<
|
|
19
8
|
AkselBreakpointToken,
|
|
20
9
|
"xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
21
10
|
>;
|
|
22
11
|
|
|
23
|
-
export type SpacingScale =
|
|
24
|
-
export type BorderRadiusScale =
|
|
25
|
-
| AkselLegacyBorderRadiusToken
|
|
26
|
-
| AkselBorderRadiusToken;
|
|
12
|
+
export type SpacingScale = AkselSpaceToken;
|
|
13
|
+
export type BorderRadiusScale = AkselBorderRadiusToken;
|
|
27
14
|
|
|
28
15
|
export type SpaceDelimitedAttribute<T extends string> =
|
|
29
16
|
| T
|