@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
package/src/popover/Popover.tsx
CHANGED
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
Placement,
|
|
4
4
|
Side,
|
|
5
5
|
autoUpdate,
|
|
6
|
-
arrow as flArrow,
|
|
7
6
|
offset as flOffset,
|
|
8
7
|
flip,
|
|
9
8
|
shift,
|
|
10
9
|
useFloating,
|
|
11
10
|
} from "@floating-ui/react";
|
|
12
|
-
import React, { HTMLAttributes, forwardRef
|
|
11
|
+
import React, { HTMLAttributes, forwardRef } from "react";
|
|
13
12
|
import { useModalContext } from "../modal/Modal.context";
|
|
14
13
|
import { DismissableLayer } from "../overlays/dismissablelayer/DismissableLayer";
|
|
15
|
-
import { useRenameCSS
|
|
14
|
+
import { useRenameCSS } from "../theme/Theme";
|
|
15
|
+
import { omit } from "../util";
|
|
16
16
|
import { useClientLayoutEffect } from "../util/hooks";
|
|
17
17
|
import { useMergeRefs } from "../util/hooks/useMergeRefs";
|
|
18
18
|
import PopoverContent, { PopoverContentType } from "./PopoverContent";
|
|
@@ -54,13 +54,12 @@ export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
54
54
|
| "left-start"
|
|
55
55
|
| "left-end";
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
58
|
-
* @default true
|
|
57
|
+
* @deprecated No longer has any effect.
|
|
59
58
|
*/
|
|
60
59
|
arrow?: boolean;
|
|
61
60
|
/**
|
|
62
61
|
* Distance from anchor to popover
|
|
63
|
-
* @default
|
|
62
|
+
* @default 8
|
|
64
63
|
*/
|
|
65
64
|
offset?: number;
|
|
66
65
|
/**
|
|
@@ -109,43 +108,38 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
109
108
|
className,
|
|
110
109
|
children,
|
|
111
110
|
anchorEl,
|
|
112
|
-
arrow = true,
|
|
113
111
|
open,
|
|
114
112
|
onClose,
|
|
115
113
|
placement = "top",
|
|
116
114
|
offset,
|
|
117
115
|
strategy: userStrategy,
|
|
118
116
|
flip: _flip = true,
|
|
119
|
-
...
|
|
117
|
+
...restProps
|
|
120
118
|
},
|
|
121
119
|
ref,
|
|
122
120
|
) => {
|
|
123
121
|
const { cn } = useRenameCSS();
|
|
124
|
-
|
|
122
|
+
|
|
125
123
|
const isInModal = useModalContext(false) !== undefined;
|
|
126
124
|
const chosenStrategy = userStrategy ?? (isInModal ? "fixed" : "absolute");
|
|
127
125
|
|
|
128
|
-
const themeContext = useThemeInternal();
|
|
129
|
-
|
|
130
126
|
const {
|
|
131
127
|
update,
|
|
132
128
|
refs,
|
|
133
129
|
placement: flPlacement,
|
|
134
|
-
middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },
|
|
135
130
|
floatingStyles,
|
|
136
131
|
} = useFloating({
|
|
137
132
|
strategy: chosenStrategy,
|
|
138
133
|
placement,
|
|
139
134
|
open,
|
|
140
135
|
middleware: [
|
|
141
|
-
flOffset(offset ??
|
|
136
|
+
flOffset(offset ?? 8),
|
|
142
137
|
_flip &&
|
|
143
138
|
flip({
|
|
144
139
|
padding: 5,
|
|
145
140
|
fallbackPlacements: getOppositePlacement(placement),
|
|
146
141
|
}),
|
|
147
142
|
shift({ padding: 12 }),
|
|
148
|
-
flArrow({ element: arrowRef, padding: 8 }),
|
|
149
143
|
],
|
|
150
144
|
});
|
|
151
145
|
|
|
@@ -165,13 +159,6 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
165
159
|
return () => cleanup();
|
|
166
160
|
}, [refs.floating, refs.reference, update, open, anchorEl]);
|
|
167
161
|
|
|
168
|
-
const staticSide = {
|
|
169
|
-
top: "bottom",
|
|
170
|
-
right: "left",
|
|
171
|
-
bottom: "top",
|
|
172
|
-
left: "right",
|
|
173
|
-
}[flPlacement.split("-")[0]];
|
|
174
|
-
|
|
175
162
|
return (
|
|
176
163
|
<DismissableLayer
|
|
177
164
|
asChild
|
|
@@ -183,29 +170,15 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
183
170
|
>
|
|
184
171
|
<div
|
|
185
172
|
ref={floatingRef}
|
|
186
|
-
{...
|
|
173
|
+
{...omit(restProps, ["arrow"])}
|
|
187
174
|
className={cn("navds-popover", className, {
|
|
188
175
|
"navds-popover--hidden": !open || !anchorEl,
|
|
189
176
|
})}
|
|
190
|
-
style={{ ...
|
|
177
|
+
style={{ ...restProps.style, ...floatingStyles }}
|
|
191
178
|
data-placement={flPlacement}
|
|
192
179
|
aria-hidden={!open || !anchorEl}
|
|
193
180
|
>
|
|
194
181
|
{children}
|
|
195
|
-
{/* Hide arrow in new design, prop will be removed in breaking change update */}
|
|
196
|
-
{arrow && !themeContext?.isDarkside && (
|
|
197
|
-
<div
|
|
198
|
-
ref={(node) => {
|
|
199
|
-
arrowRef.current = node;
|
|
200
|
-
}}
|
|
201
|
-
style={{
|
|
202
|
-
...(arrowX != null ? { left: arrowX } : {}),
|
|
203
|
-
...(arrowY != null ? { top: arrowY } : {}),
|
|
204
|
-
...(staticSide ? { [staticSide]: "-0.5rem" } : {}),
|
|
205
|
-
}}
|
|
206
|
-
className={cn("navds-popover__arrow")}
|
|
207
|
-
/>
|
|
208
|
-
)}
|
|
209
182
|
</div>
|
|
210
183
|
</DismissableLayer>
|
|
211
184
|
);
|
package/src/portal/Portal.tsx
CHANGED
|
@@ -92,20 +92,16 @@ const PortalDiv = forwardRef<HTMLDivElement, PortalDivProps>(
|
|
|
92
92
|
(props: PortalDivProps, forwardedRef) => {
|
|
93
93
|
const themeContext = useThemeInternal();
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return <div ref={forwardedRef} {...props} />;
|
|
95
|
+
return (
|
|
96
|
+
<Theme
|
|
97
|
+
theme={themeContext?.theme}
|
|
98
|
+
asChild
|
|
99
|
+
hasBackground={false}
|
|
100
|
+
data-color={themeContext?.color}
|
|
101
|
+
>
|
|
102
|
+
<div ref={forwardedRef} {...props} />
|
|
103
|
+
</Theme>
|
|
104
|
+
);
|
|
109
105
|
},
|
|
110
106
|
);
|
|
111
107
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { HTMLAttributes, forwardRef, useEffect } from "react";
|
|
2
2
|
import { useRenameCSS } from "../theme/Theme";
|
|
3
|
+
import type { AkselColor } from "../types";
|
|
3
4
|
import { useTimeout } from "../util/hooks/useTimeout";
|
|
4
5
|
import { useValueAsRef } from "../util/hooks/useValueAsRef";
|
|
5
6
|
import { useI18n } from "../util/i18n/i18n.hooks";
|
|
@@ -45,6 +46,12 @@ interface ProgressBarPropsBase
|
|
|
45
46
|
* Not needed if `aria-labelledby` is used.
|
|
46
47
|
*/
|
|
47
48
|
"aria-label"?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Overrides inherited color.
|
|
51
|
+
* @see 🏷️ {@link AkselColor}
|
|
52
|
+
* @see [📝 Documentation](https://aksel.nav.no/grunnleggende/styling/farger-tokens)
|
|
53
|
+
*/
|
|
54
|
+
"data-color"?: AkselColor;
|
|
48
55
|
}
|
|
49
56
|
|
|
50
57
|
export type ProgressBarProps = ProgressBarPropsBase &
|
|
@@ -142,11 +149,11 @@ export const ProgressBar = forwardRef<HTMLDivElement, ProgressBarProps>(
|
|
|
142
149
|
simulated?.seconds !== undefined,
|
|
143
150
|
})}
|
|
144
151
|
style={{
|
|
145
|
-
"--
|
|
152
|
+
"--__axc-progress-bar-simulated":
|
|
146
153
|
simulated?.seconds !== undefined
|
|
147
154
|
? `${simulated?.seconds}s`
|
|
148
155
|
: undefined,
|
|
149
|
-
"--
|
|
156
|
+
"--__axc-progress-bar-translate": `-${translateX}%`,
|
|
150
157
|
}}
|
|
151
158
|
/>
|
|
152
159
|
</div>
|
package/src/react-css.d.ts
CHANGED
|
@@ -2,9 +2,6 @@ import "react";
|
|
|
2
2
|
|
|
3
3
|
declare module "react" {
|
|
4
4
|
interface CSSProperties {
|
|
5
|
-
[key: `--ac-${string}`]: string | number | undefined;
|
|
6
|
-
[key: `--__ac-${string}`]: string | number | undefined;
|
|
7
|
-
[key: `--axc-${string}`]: string | number | undefined;
|
|
8
5
|
[key: `--__axc-${string}`]: string | number | undefined;
|
|
9
6
|
}
|
|
10
7
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
3
|
+
import type { AkselStatusColorRole } from "@navikt/ds-tokens/types";
|
|
3
4
|
import { useRenameCSS } from "../theme/Theme";
|
|
5
|
+
import type { AkselColor } from "../types";
|
|
4
6
|
import { BodyLong } from "../typography";
|
|
5
7
|
import { composeEventHandlers } from "../util/composeEventHandlers";
|
|
6
8
|
import { useControllableState } from "../util/hooks/useControllableState";
|
|
@@ -34,6 +36,15 @@ export interface ReadMoreProps
|
|
|
34
36
|
* @default "medium"
|
|
35
37
|
*/
|
|
36
38
|
size?: "large" | "medium" | "small";
|
|
39
|
+
/**
|
|
40
|
+
* Overrides inherited color.
|
|
41
|
+
*
|
|
42
|
+
* We recommend only using `accent`. We have disallowed status-colors.
|
|
43
|
+
* @see 🏷️ {@link AkselColor}
|
|
44
|
+
* @see [📝 Documentation](https://aksel.nav.no/grunnleggende/styling/farger-tokens)
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
"data-color"?: Exclude<AkselColor, AkselStatusColorRole>;
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
/**
|
package/src/stepper/Stepper.tsx
CHANGED
|
@@ -90,11 +90,7 @@ export const Stepper: StepperComponent = forwardRef<
|
|
|
90
90
|
<ol
|
|
91
91
|
{...rest}
|
|
92
92
|
ref={ref}
|
|
93
|
-
className={cn(
|
|
94
|
-
"navds-stepper",
|
|
95
|
-
orientation === "horizontal" ? "navds-stepper--horizontal" : "",
|
|
96
|
-
className,
|
|
97
|
-
)}
|
|
93
|
+
className={cn("navds-stepper", className)}
|
|
98
94
|
data-orientation={orientation}
|
|
99
95
|
>
|
|
100
96
|
{React.Children.map(children, (step, index) => {
|
|
@@ -105,12 +101,8 @@ export const Stepper: StepperComponent = forwardRef<
|
|
|
105
101
|
|
|
106
102
|
return (
|
|
107
103
|
<li
|
|
108
|
-
className={cn("navds-stepper__item"
|
|
109
|
-
|
|
110
|
-
"navds-stepper__item--behind": activeStep > index,
|
|
111
|
-
"navds-stepper__item--completed": stepProps.completed,
|
|
112
|
-
"navds-stepper__item--non-interactive": !isInteractive,
|
|
113
|
-
})}
|
|
104
|
+
className={cn("navds-stepper__item")}
|
|
105
|
+
data-interactive={isInteractive}
|
|
114
106
|
data-color={isInteractive ? undefined : "neutral"}
|
|
115
107
|
key={index + (children?.toString?.() ?? "")}
|
|
116
108
|
>
|
package/src/tag/Tag.tsx
CHANGED
|
@@ -3,44 +3,41 @@ import { useRenameCSS } from "../theme/Theme";
|
|
|
3
3
|
import { AkselColor } from "../types";
|
|
4
4
|
import { BodyShort } from "../typography";
|
|
5
5
|
|
|
6
|
+
type legacyVariants =
|
|
7
|
+
| "warning"
|
|
8
|
+
| "warning-filled"
|
|
9
|
+
| "warning-moderate"
|
|
10
|
+
| "error"
|
|
11
|
+
| "error-filled"
|
|
12
|
+
| "error-moderate"
|
|
13
|
+
| "info"
|
|
14
|
+
| "info-filled"
|
|
15
|
+
| "info-moderate"
|
|
16
|
+
| "success"
|
|
17
|
+
| "success-filled"
|
|
18
|
+
| "success-moderate"
|
|
19
|
+
| "neutral"
|
|
20
|
+
| "neutral-filled"
|
|
21
|
+
| "neutral-moderate"
|
|
22
|
+
| "alt1"
|
|
23
|
+
| "alt1-filled"
|
|
24
|
+
| "alt1-moderate"
|
|
25
|
+
| "alt2"
|
|
26
|
+
| "alt2-filled"
|
|
27
|
+
| "alt2-moderate"
|
|
28
|
+
| "alt3"
|
|
29
|
+
| "alt3-filled"
|
|
30
|
+
| "alt3-moderate";
|
|
31
|
+
|
|
32
|
+
type HiddenVariant = legacyVariants & { __brand?: never };
|
|
33
|
+
|
|
6
34
|
export interface TagProps extends HTMLAttributes<HTMLSpanElement> {
|
|
7
35
|
children: React.ReactNode;
|
|
8
36
|
/**
|
|
9
37
|
* Changes visual profile of tag
|
|
38
|
+
* @default "outline"
|
|
10
39
|
*/
|
|
11
|
-
variant
|
|
12
|
-
| "warning"
|
|
13
|
-
| "warning-filled"
|
|
14
|
-
| "warning-moderate"
|
|
15
|
-
| "error"
|
|
16
|
-
| "error-filled"
|
|
17
|
-
| "error-moderate"
|
|
18
|
-
| "info"
|
|
19
|
-
| "info-filled"
|
|
20
|
-
| "info-moderate"
|
|
21
|
-
| "success"
|
|
22
|
-
| "success-filled"
|
|
23
|
-
| "success-moderate"
|
|
24
|
-
| "neutral"
|
|
25
|
-
| "neutral-filled"
|
|
26
|
-
| "neutral-moderate"
|
|
27
|
-
| "alt1"
|
|
28
|
-
| "alt1-filled"
|
|
29
|
-
| "alt1-moderate"
|
|
30
|
-
| "alt2"
|
|
31
|
-
| "alt2-filled"
|
|
32
|
-
| "alt2-moderate"
|
|
33
|
-
| "alt3"
|
|
34
|
-
| "alt3-filled"
|
|
35
|
-
| "alt3-moderate";
|
|
36
|
-
|
|
37
|
-
/* Temp hide these until naming is resolved */
|
|
38
|
-
// | "meta-purple"
|
|
39
|
-
// | "meta-purple-filled"
|
|
40
|
-
// | "meta-purple-moderate"
|
|
41
|
-
// | "meta-lime"
|
|
42
|
-
// | "meta-lime-filled"
|
|
43
|
-
// | "meta-lime-moderate";
|
|
40
|
+
variant?: "outline" | "moderate" | "strong" | HiddenVariant;
|
|
44
41
|
/**
|
|
45
42
|
* @default "medium"
|
|
46
43
|
*/
|
|
@@ -49,6 +46,11 @@ export interface TagProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
49
46
|
* Tag Icon
|
|
50
47
|
*/
|
|
51
48
|
icon?: React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Tag color
|
|
51
|
+
* @default "neutral"
|
|
52
|
+
*/
|
|
53
|
+
"data-color"?: AkselColor;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
/**
|
|
@@ -67,7 +69,7 @@ export const Tag = forwardRef<HTMLSpanElement, TagProps>(
|
|
|
67
69
|
{
|
|
68
70
|
children,
|
|
69
71
|
className,
|
|
70
|
-
variant,
|
|
72
|
+
variant = "outline",
|
|
71
73
|
size = "medium",
|
|
72
74
|
icon,
|
|
73
75
|
"data-color": color,
|
|
@@ -79,20 +81,22 @@ export const Tag = forwardRef<HTMLSpanElement, TagProps>(
|
|
|
79
81
|
const filledVariant = variant?.endsWith("-filled") && "strong";
|
|
80
82
|
const moderateVariant = variant?.endsWith("-moderate") && "moderate";
|
|
81
83
|
|
|
84
|
+
const updatedVariant =
|
|
85
|
+
variant === "moderate" || variant === "strong" || variant === "outline";
|
|
86
|
+
|
|
82
87
|
return (
|
|
83
88
|
<BodyShort
|
|
84
89
|
data-color={color ?? variantToColor(variant)}
|
|
85
|
-
data-variant={
|
|
90
|
+
data-variant={
|
|
91
|
+
updatedVariant
|
|
92
|
+
? variant
|
|
93
|
+
: filledVariant || moderateVariant || "outline"
|
|
94
|
+
}
|
|
86
95
|
{...rest}
|
|
87
96
|
ref={ref}
|
|
88
97
|
as="span"
|
|
89
98
|
size={size === "medium" ? "medium" : "small"}
|
|
90
|
-
className={cn(
|
|
91
|
-
"navds-tag",
|
|
92
|
-
className,
|
|
93
|
-
`navds-tag--${variant}`,
|
|
94
|
-
`navds-tag--${size}`,
|
|
95
|
-
)}
|
|
99
|
+
className={cn("navds-tag", className, `navds-tag--${size}`)}
|
|
96
100
|
>
|
|
97
101
|
{icon && <span className={cn("navds-tag__icon--left")}>{icon}</span>}
|
|
98
102
|
{children}
|
package/src/theme/Theme.tsx
CHANGED
|
@@ -15,12 +15,6 @@ type RenameCSSContext = {
|
|
|
15
15
|
cn: (...inputs: Parameters<typeof cl>) => ReturnType<typeof cl>;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const { Provider: RenameCSSProvider, useContext: useRenameCSS } =
|
|
19
|
-
createStrictContext<RenameCSSContext>({
|
|
20
|
-
name: "RenameCSS",
|
|
21
|
-
defaultValue: { cn: cl },
|
|
22
|
-
});
|
|
23
|
-
|
|
24
18
|
export const compositeClassFunction = (
|
|
25
19
|
...inputs: Parameters<typeof cl>
|
|
26
20
|
): string => {
|
|
@@ -33,6 +27,12 @@ export const compositeClassFunction = (
|
|
|
33
27
|
return classes.trim();
|
|
34
28
|
};
|
|
35
29
|
|
|
30
|
+
const { Provider: RenameCSSProvider, useContext: useRenameCSS } =
|
|
31
|
+
createStrictContext<RenameCSSContext>({
|
|
32
|
+
name: "RenameCSS",
|
|
33
|
+
defaultValue: { cn: compositeClassFunction },
|
|
34
|
+
});
|
|
35
|
+
|
|
36
36
|
const RenameCSS = ({ children }: { children: React.ReactNode }) => {
|
|
37
37
|
return (
|
|
38
38
|
<RenameCSSProvider cn={compositeClassFunction}>
|
|
@@ -48,16 +48,15 @@ const DEFAULT_COLOR: AkselColor = "accent";
|
|
|
48
48
|
|
|
49
49
|
type ThemeContext = {
|
|
50
50
|
/**
|
|
51
|
-
* Color theme
|
|
52
|
-
* @default Inherits parent theme, or "light" if root
|
|
51
|
+
* Color theme.
|
|
52
|
+
* @default Inherits parent theme, or "light" if root.
|
|
53
53
|
*/
|
|
54
54
|
theme?: "light" | "dark";
|
|
55
55
|
color?: AkselColor;
|
|
56
56
|
/**
|
|
57
|
-
* Indicates if Theme-component is
|
|
58
|
-
* @default false
|
|
57
|
+
* Indicates if Theme-component is on root-level or not.
|
|
59
58
|
*/
|
|
60
|
-
|
|
59
|
+
isRoot: boolean;
|
|
61
60
|
};
|
|
62
61
|
|
|
63
62
|
const { Provider: ThemeProvider, useContext: useThemeInternal } =
|
|
@@ -65,21 +64,22 @@ const { Provider: ThemeProvider, useContext: useThemeInternal } =
|
|
|
65
64
|
name: "ThemeProvider",
|
|
66
65
|
defaultValue: {
|
|
67
66
|
color: DEFAULT_COLOR,
|
|
68
|
-
|
|
67
|
+
isRoot: true,
|
|
69
68
|
},
|
|
70
69
|
});
|
|
71
70
|
|
|
72
71
|
export type ThemeProps = {
|
|
73
72
|
className?: string;
|
|
74
73
|
/**
|
|
75
|
-
*
|
|
74
|
+
* Whether to apply the default background.
|
|
75
|
+
* @default `true` if this is the root instance and `theme` is defined, otherwise `false`.
|
|
76
76
|
*/
|
|
77
77
|
hasBackground?: boolean;
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
79
|
+
* Changes default 'base'-color for application.
|
|
80
80
|
*/
|
|
81
81
|
"data-color"?: AkselColor;
|
|
82
|
-
} & Omit<ThemeContext, "color" | "
|
|
82
|
+
} & Omit<ThemeContext, "color" | "isRoot"> &
|
|
83
83
|
AsChildProps;
|
|
84
84
|
|
|
85
85
|
const Theme = forwardRef<HTMLDivElement, ThemeProps>(
|
|
@@ -91,11 +91,11 @@ const Theme = forwardRef<HTMLDivElement, ThemeProps>(
|
|
|
91
91
|
className,
|
|
92
92
|
asChild = false,
|
|
93
93
|
theme = context?.theme,
|
|
94
|
-
hasBackground: hasBackgroundProp
|
|
94
|
+
hasBackground: hasBackgroundProp,
|
|
95
95
|
"data-color": color = context?.color,
|
|
96
96
|
} = props;
|
|
97
97
|
|
|
98
|
-
const isRoot =
|
|
98
|
+
const isRoot = context?.isRoot;
|
|
99
99
|
|
|
100
100
|
const hasBackground =
|
|
101
101
|
hasBackgroundProp ?? (isRoot && props.theme !== undefined);
|
|
@@ -103,13 +103,13 @@ const Theme = forwardRef<HTMLDivElement, ThemeProps>(
|
|
|
103
103
|
const SlotElement = asChild ? Slot : "div";
|
|
104
104
|
|
|
105
105
|
return (
|
|
106
|
-
<ThemeProvider theme={theme} color={color}
|
|
106
|
+
<ThemeProvider theme={theme} color={color} isRoot={false}>
|
|
107
107
|
<RenameCSS>
|
|
108
108
|
<SlotElement
|
|
109
109
|
ref={ref}
|
|
110
110
|
className={cl("aksel-theme", className, theme)}
|
|
111
111
|
data-background={hasBackground}
|
|
112
|
-
data-color={color ??
|
|
112
|
+
data-color={color ?? DEFAULT_COLOR}
|
|
113
113
|
>
|
|
114
114
|
{children}
|
|
115
115
|
</SlotElement>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
|
+
import type { AkselColor } from "../../types";
|
|
2
3
|
import { usePeriodContext } from "../hooks/usePeriodContext";
|
|
3
4
|
import { useRowContext } from "../hooks/useRowContext";
|
|
4
5
|
import type { TimelineComponentTypes } from "../utils/types.internal";
|
|
@@ -24,6 +25,13 @@ export interface TimelinePeriodProps
|
|
|
24
25
|
* @default "neutral"
|
|
25
26
|
*/
|
|
26
27
|
status?: "success" | "warning" | "danger" | "info" | "neutral";
|
|
28
|
+
/**
|
|
29
|
+
* Overrides color set by status.
|
|
30
|
+
*
|
|
31
|
+
* @see 🏷️ {@link AkselColor}
|
|
32
|
+
* @see [📝 Documentation](https://aksel.nav.no/grunnleggende/styling/farger-tokens)
|
|
33
|
+
*/
|
|
34
|
+
"data-color"?: AkselColor;
|
|
27
35
|
/**
|
|
28
36
|
* Status label for screen-readers
|
|
29
37
|
* e.g "Sykemeldt", "foreldrepermisjon"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
|
-
import { useRenameCSS
|
|
2
|
+
import { useRenameCSS } from "../theme/Theme";
|
|
3
3
|
import { AkselColor } from "../types";
|
|
4
4
|
import { Label } from "../typography";
|
|
5
5
|
import { useId } from "../util";
|
|
@@ -55,7 +55,6 @@ export const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(
|
|
|
55
55
|
ref,
|
|
56
56
|
) => {
|
|
57
57
|
const { cn } = useRenameCSS();
|
|
58
|
-
const themeContext = useThemeInternal();
|
|
59
58
|
const descendants = useToggleGroupDescendants();
|
|
60
59
|
|
|
61
60
|
const toggleGroupContext = useToggleGroup({
|
|
@@ -82,14 +81,6 @@ export const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(
|
|
|
82
81
|
console.error("ToggleGroup needs either a value or defaultValue");
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
let localVariant: ToggleGroupProps["variant"] | undefined;
|
|
86
|
-
|
|
87
|
-
if (themeContext?.isDarkside) {
|
|
88
|
-
localVariant = variant;
|
|
89
|
-
} else {
|
|
90
|
-
localVariant = variant ?? "action";
|
|
91
|
-
}
|
|
92
|
-
|
|
93
84
|
return (
|
|
94
85
|
<ToggleGroupDescendantsProvider value={descendants}>
|
|
95
86
|
<ToggleGroupProvider {...context}>
|
|
@@ -97,7 +88,7 @@ export const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(
|
|
|
97
88
|
className={cn("navds-toggle-group__wrapper", className, {
|
|
98
89
|
"navds-toggle-group__wrapper--fill": fill,
|
|
99
90
|
})}
|
|
100
|
-
data-color={color ?? variantToColor(
|
|
91
|
+
data-color={color ?? variantToColor(variant)}
|
|
101
92
|
>
|
|
102
93
|
{label && (
|
|
103
94
|
<Label
|
|
@@ -116,7 +107,6 @@ export const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(
|
|
|
116
107
|
className={cn(
|
|
117
108
|
"navds-toggle-group",
|
|
118
109
|
`navds-toggle-group--${size}`,
|
|
119
|
-
{ [`navds-toggle-group--${localVariant}`]: localVariant },
|
|
120
110
|
)}
|
|
121
111
|
role="radiogroup"
|
|
122
112
|
>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
|
+
import type { AkselStatusColorRole } from "@navikt/ds-tokens/types";
|
|
3
|
+
import type { AkselColor } from "../types";
|
|
2
4
|
|
|
3
5
|
export interface ToggleGroupProps
|
|
4
6
|
extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "dir"> {
|
|
@@ -28,10 +30,17 @@ export interface ToggleGroupProps
|
|
|
28
30
|
*/
|
|
29
31
|
label?: React.ReactNode;
|
|
30
32
|
/**
|
|
31
|
-
*
|
|
32
|
-
* @default "action"
|
|
33
|
+
* @deprecated Use `data-color` prop instead.
|
|
33
34
|
*/
|
|
34
35
|
variant?: "action" | "neutral";
|
|
36
|
+
/**
|
|
37
|
+
* Overrides inherited color.
|
|
38
|
+
*
|
|
39
|
+
* We recommend only using `accent` and `neutral`. We have disallowed status-colors.
|
|
40
|
+
* @see 🏷️ {@link AkselColor}
|
|
41
|
+
* @see [📝 Documentation](https://aksel.nav.no/grunnleggende/styling/farger-tokens)
|
|
42
|
+
*/
|
|
43
|
+
"data-color"?: Exclude<AkselColor, AkselStatusColorRole>;
|
|
35
44
|
/**
|
|
36
45
|
* Stretch each button to fill avaliable space in container.
|
|
37
46
|
* @default false
|
package/src/types/theme.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import { useRenameCSS } from "../theme/Theme";
|
|
3
|
+
import type { AkselColor } from "../types";
|
|
3
4
|
import { OverridableComponent } from "../util/types";
|
|
4
5
|
import { TypoProps } from "./types";
|
|
5
6
|
import { typoClassNames } from "./util";
|
|
@@ -16,6 +17,14 @@ export interface BodyLongProps
|
|
|
16
17
|
* Text.
|
|
17
18
|
*/
|
|
18
19
|
children: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Overrides inherited color.
|
|
22
|
+
* @default "neutral"
|
|
23
|
+
*
|
|
24
|
+
* @see 🏷️ {@link AkselColor}
|
|
25
|
+
* @see [📝 Documentation](https://aksel.nav.no/grunnleggende/styling/farger-tokens)
|
|
26
|
+
*/
|
|
27
|
+
"data-color"?: AkselColor;
|
|
19
28
|
}
|
|
20
29
|
|
|
21
30
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import { useRenameCSS } from "../theme/Theme";
|
|
3
|
+
import type { AkselColor } from "../types";
|
|
3
4
|
import { OverridableComponent } from "../util/types";
|
|
4
5
|
import { TypoProps } from "./types";
|
|
5
6
|
import { typoClassNames } from "./util";
|
|
@@ -16,6 +17,14 @@ export interface BodyShortProps
|
|
|
16
17
|
* Paragraph text.
|
|
17
18
|
*/
|
|
18
19
|
children: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Overrides inherited color.
|
|
22
|
+
* @default "neutral"
|
|
23
|
+
*
|
|
24
|
+
* @see 🏷️ {@link AkselColor}
|
|
25
|
+
* @see [📝 Documentation](https://aksel.nav.no/grunnleggende/styling/farger-tokens)
|
|
26
|
+
*/
|
|
27
|
+
"data-color"?: AkselColor;
|
|
19
28
|
}
|
|
20
29
|
|
|
21
30
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import { useRenameCSS } from "../theme/Theme";
|
|
3
|
+
import type { AkselColor } from "../types";
|
|
3
4
|
import { OverridableComponent } from "../util/types";
|
|
4
5
|
import { TypoProps } from "./types";
|
|
5
6
|
import { typoClassNames } from "./util";
|
|
@@ -19,6 +20,14 @@ export interface DetailProps
|
|
|
19
20
|
* ALL CAPS.
|
|
20
21
|
*/
|
|
21
22
|
uppercase?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Overrides inherited color.
|
|
25
|
+
* @default "neutral"
|
|
26
|
+
*
|
|
27
|
+
* @see 🏷️ {@link AkselColor}
|
|
28
|
+
* @see [📝 Documentation](https://aksel.nav.no/grunnleggende/styling/farger-tokens)
|
|
29
|
+
*/
|
|
30
|
+
"data-color"?: AkselColor;
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import { useRenameCSS } from "../theme/Theme";
|
|
3
|
+
import type { AkselColor } from "../types";
|
|
3
4
|
import { OverridableComponent } from "../util/types";
|
|
4
5
|
import { TypoProps } from "./types";
|
|
5
6
|
import { typoClassNames } from "./util";
|
|
@@ -20,6 +21,14 @@ export interface HeadingProps
|
|
|
20
21
|
* Heading text.
|
|
21
22
|
*/
|
|
22
23
|
children: React.ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Overrides inherited color.
|
|
26
|
+
* @default "neutral"
|
|
27
|
+
*
|
|
28
|
+
* @see 🏷️ {@link AkselColor}
|
|
29
|
+
* @see [📝 Documentation](https://aksel.nav.no/grunnleggende/styling/farger-tokens)
|
|
30
|
+
*/
|
|
31
|
+
"data-color"?: AkselColor;
|
|
23
32
|
}
|
|
24
33
|
|
|
25
34
|
/**
|