@navikt/ds-react 7.8.1 → 7.9.1
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/README.md +2 -2
- package/cjs/accordion/AccordionContent.js +2 -2
- package/cjs/accordion/AccordionContent.js.map +1 -1
- package/cjs/accordion/AccordionHeader.js +2 -2
- package/cjs/accordion/AccordionHeader.js.map +1 -1
- package/cjs/alert/Alert.js +2 -2
- package/cjs/alert/Alert.js.map +1 -1
- package/cjs/button/Button.js +9 -25
- package/cjs/button/Button.js.map +1 -1
- package/cjs/chips/Removable.js +2 -2
- package/cjs/chips/Removable.js.map +1 -1
- package/cjs/copybutton/CopyButton.js +2 -2
- package/cjs/copybutton/CopyButton.js.map +1 -1
- package/cjs/date/context/useDateTranslationContext.d.ts +1 -1
- package/cjs/date/datepicker/DatePicker.js +3 -3
- package/cjs/date/datepicker/DatePicker.js.map +1 -1
- package/cjs/date/datepicker/DatePickerStandalone.js +3 -3
- package/cjs/date/datepicker/DatePickerStandalone.js.map +1 -1
- package/cjs/date/datepicker/parts/WeekNumber.js +2 -2
- package/cjs/date/datepicker/parts/WeekNumber.js.map +1 -1
- package/cjs/date/hooks/useDatepicker.js +2 -2
- package/cjs/date/hooks/useDatepicker.js.map +1 -1
- package/cjs/date/hooks/useMonthPicker.js +2 -2
- package/cjs/date/hooks/useMonthPicker.js.map +1 -1
- package/cjs/date/hooks/useRangeDatepicker.js +2 -2
- package/cjs/date/hooks/useRangeDatepicker.js.map +1 -1
- package/cjs/date/monthpicker/MonthPicker.js +3 -3
- package/cjs/date/monthpicker/MonthPicker.js.map +1 -1
- package/cjs/date/monthpicker/MonthPickerStandalone.js +3 -3
- package/cjs/date/monthpicker/MonthPickerStandalone.js.map +1 -1
- package/cjs/date/parts/DateInput.js +1 -1
- package/cjs/date/parts/DateInput.js.map +1 -1
- package/cjs/date/parts/DateWrapper.d.ts +1 -1
- package/cjs/date/parts/DateWrapper.js +2 -2
- package/cjs/date/parts/DateWrapper.js.map +1 -1
- package/cjs/expansion-card/ExpansionCardHeader.js +2 -2
- package/cjs/expansion-card/ExpansionCardHeader.js.map +1 -1
- package/cjs/form/ReadOnlyIcon.js +2 -2
- package/cjs/form/ReadOnlyIcon.js.map +1 -1
- package/cjs/form/combobox/Combobox.d.ts +1 -1
- package/cjs/form/combobox/Combobox.js +1 -1
- package/cjs/form/combobox/Combobox.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/AddNewOption.js +2 -2
- package/cjs/form/combobox/FilteredOptions/AddNewOption.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/LoadingMessage.js +2 -2
- package/cjs/form/combobox/FilteredOptions/LoadingMessage.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/MaxSelectedMessage.js +2 -2
- package/cjs/form/combobox/FilteredOptions/MaxSelectedMessage.js.map +1 -1
- package/cjs/form/combobox/Input/InputController.d.ts +1 -1
- package/cjs/form/confirmation-panel/ConfirmationPanel.js +1 -1
- package/cjs/form/confirmation-panel/ConfirmationPanel.js.map +1 -1
- package/cjs/form/error-summary/ErrorSummary.js +2 -2
- package/cjs/form/error-summary/ErrorSummary.js.map +1 -1
- package/cjs/form/fieldset/Fieldset.js +1 -1
- package/cjs/form/fieldset/Fieldset.js.map +1 -1
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js +3 -3
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js.map +1 -1
- package/cjs/form/file-upload/parts/item/Item.js +2 -2
- package/cjs/form/file-upload/parts/item/Item.js.map +1 -1
- package/cjs/form/form-progress/FormProgress.js +2 -2
- package/cjs/form/form-progress/FormProgress.js.map +1 -1
- package/cjs/form/form-summary/FormSummaryEditLink.js +2 -2
- package/cjs/form/form-summary/FormSummaryEditLink.js.map +1 -1
- package/cjs/form/search/Search.js +5 -5
- package/cjs/form/search/Search.js.map +1 -1
- package/cjs/form/search/SearchButton.js +2 -2
- package/cjs/form/search/SearchButton.js.map +1 -1
- package/cjs/form/select/Select.js +1 -1
- package/cjs/form/select/Select.js.map +1 -1
- package/cjs/form/switch/Switch.js +1 -7
- package/cjs/form/switch/Switch.js.map +1 -1
- package/cjs/form/textarea/Textarea.js +1 -1
- package/cjs/form/textarea/Textarea.js.map +1 -1
- package/cjs/form/textarea/TextareaCounter.js +2 -2
- package/cjs/form/textarea/TextareaCounter.js.map +1 -1
- package/cjs/form/textfield/TextField.js +1 -1
- package/cjs/form/textfield/TextField.js.map +1 -1
- package/cjs/guide-panel/GuidePanel.js +2 -2
- package/cjs/guide-panel/GuidePanel.js.map +1 -1
- package/cjs/guide-panel/Illustration.darkside.js +2 -2
- package/cjs/guide-panel/Illustration.darkside.js.map +1 -1
- package/cjs/guide-panel/Illustration.js +2 -2
- package/cjs/guide-panel/Illustration.js.map +1 -1
- package/cjs/help-text/HelpText.js +4 -4
- package/cjs/help-text/HelpText.js.map +1 -1
- package/cjs/internal-header/InternalHeader.js +3 -3
- package/cjs/internal-header/InternalHeader.js.map +1 -1
- package/cjs/layout/base/BasePrimitive.js +2 -2
- package/cjs/layout/base/BasePrimitive.js.map +1 -1
- package/cjs/layout/bleed/Bleed.js +2 -2
- package/cjs/layout/bleed/Bleed.js.map +1 -1
- package/cjs/layout/box/Box.js +2 -2
- package/cjs/layout/box/Box.js.map +1 -1
- package/cjs/layout/grid/HGrid.js +2 -2
- package/cjs/layout/grid/HGrid.js.map +1 -1
- package/cjs/layout/page/Page.js +2 -2
- package/cjs/layout/page/Page.js.map +1 -1
- package/cjs/layout/stack/Stack.js +2 -2
- package/cjs/layout/stack/Stack.js.map +1 -1
- package/cjs/link/stories/RandomIcon.d.ts +2 -0
- package/cjs/link/stories/RandomIcon.js +39 -0
- package/cjs/link/stories/RandomIcon.js.map +1 -0
- package/cjs/loader/Loader.js +2 -2
- package/cjs/loader/Loader.js.map +1 -1
- package/cjs/modal/ModalHeader.js +2 -2
- package/cjs/modal/ModalHeader.js.map +1 -1
- package/cjs/overlays/action-menu/ActionMenu.js +2 -2
- package/cjs/overlays/action-menu/ActionMenu.js.map +1 -1
- package/cjs/pagination/Pagination.js +2 -2
- package/cjs/pagination/Pagination.js.map +1 -1
- package/cjs/pagination/PaginationItem.js +2 -2
- package/cjs/pagination/PaginationItem.js.map +1 -1
- package/cjs/popover/Popover.js +2 -2
- package/cjs/popover/Popover.js.map +1 -1
- package/cjs/portal/Portal.js +12 -0
- package/cjs/portal/Portal.js.map +1 -1
- package/cjs/progress-bar/ProgressBar.js +2 -2
- package/cjs/progress-bar/ProgressBar.js.map +1 -1
- package/cjs/provider/index.d.ts +0 -1
- package/cjs/provider/index.js +1 -4
- package/cjs/provider/index.js.map +1 -1
- package/cjs/read-more/ReadMore.js +1 -3
- package/cjs/read-more/ReadMore.js.map +1 -1
- package/cjs/table/ExpandableRow.js +2 -2
- package/cjs/table/ExpandableRow.js.map +1 -1
- package/cjs/tabs/Tabs.context.d.ts +1 -1
- package/cjs/tabs/parts/tablist/useScrollButtons.d.ts +1 -1
- package/cjs/theme/Theme.d.ts +16 -0
- package/cjs/{provider/theme/AkselTheme.js → theme/Theme.js} +17 -18
- package/cjs/theme/Theme.js.map +1 -0
- package/cjs/theme/index.d.ts +1 -0
- package/cjs/theme/index.js +7 -0
- package/cjs/theme/index.js.map +1 -0
- package/cjs/timeline/AxisLabels.js +3 -3
- package/cjs/timeline/AxisLabels.js.map +1 -1
- package/cjs/timeline/Pin.js +4 -4
- package/cjs/timeline/Pin.js.map +1 -1
- package/cjs/timeline/TimelineRow.js +2 -2
- package/cjs/timeline/TimelineRow.js.map +1 -1
- package/cjs/timeline/period/ClickablePeriod.js +4 -4
- package/cjs/timeline/period/ClickablePeriod.js.map +1 -1
- package/cjs/timeline/period/NonClickablePeriod.js +2 -2
- package/cjs/timeline/period/NonClickablePeriod.js.map +1 -1
- package/cjs/timeline/utils/period.d.ts +1 -1
- package/cjs/timeline/zoom/ZoomButton.js +2 -2
- package/cjs/timeline/zoom/ZoomButton.js.map +1 -1
- package/cjs/toggle-group/parts/ToggleItem.js +1 -1
- package/cjs/toggle-group/parts/ToggleItem.js.map +1 -1
- package/cjs/tooltip/Tooltip.js +2 -2
- package/cjs/tooltip/Tooltip.js.map +1 -1
- package/cjs/typography/ErrorMessage.d.ts +4 -0
- package/cjs/typography/ErrorMessage.js +6 -2
- package/cjs/typography/ErrorMessage.js.map +1 -1
- package/cjs/util/TextareaAutoSize.js +1 -1
- package/cjs/util/TextareaAutoSize.js.map +1 -1
- package/cjs/util/debounce.d.ts +2 -2
- package/cjs/util/debounce.js +5 -1
- package/cjs/util/debounce.js.map +1 -1
- package/cjs/util/i18n/i18n.hooks.d.ts +4 -0
- package/cjs/util/i18n/{i18n.context.js → i18n.hooks.js} +3 -7
- package/cjs/util/i18n/i18n.hooks.js.map +1 -0
- package/cjs/util/i18n/i18n.types.d.ts +4 -0
- package/cjs/util/i18n/locales/nb.d.ts +81 -4
- package/cjs/util/i18n/locales/nb.js +81 -4
- package/cjs/util/i18n/locales/nb.js.map +1 -1
- package/esm/accordion/AccordionContent.js +2 -2
- package/esm/accordion/AccordionContent.js.map +1 -1
- package/esm/accordion/AccordionHeader.js +2 -2
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/alert/Alert.js +1 -1
- package/esm/alert/Alert.js.map +1 -1
- package/esm/button/Button.js +10 -26
- package/esm/button/Button.js.map +1 -1
- package/esm/chips/Removable.js +1 -1
- package/esm/chips/Removable.js.map +1 -1
- package/esm/copybutton/CopyButton.js +1 -1
- package/esm/copybutton/CopyButton.js.map +1 -1
- package/esm/date/context/useDateTranslationContext.d.ts +1 -1
- package/esm/date/datepicker/DatePicker.js +1 -1
- package/esm/date/datepicker/DatePicker.js.map +1 -1
- package/esm/date/datepicker/DatePickerStandalone.js +1 -1
- package/esm/date/datepicker/DatePickerStandalone.js.map +1 -1
- package/esm/date/datepicker/parts/WeekNumber.js +2 -2
- package/esm/date/datepicker/parts/WeekNumber.js.map +1 -1
- package/esm/date/hooks/useDatepicker.js +1 -1
- package/esm/date/hooks/useDatepicker.js.map +1 -1
- package/esm/date/hooks/useMonthPicker.js +1 -1
- package/esm/date/hooks/useMonthPicker.js.map +1 -1
- package/esm/date/hooks/useRangeDatepicker.js +1 -1
- package/esm/date/hooks/useRangeDatepicker.js.map +1 -1
- package/esm/date/monthpicker/MonthPicker.js +1 -1
- package/esm/date/monthpicker/MonthPicker.js.map +1 -1
- package/esm/date/monthpicker/MonthPickerStandalone.js +1 -1
- package/esm/date/monthpicker/MonthPickerStandalone.js.map +1 -1
- package/esm/date/parts/DateInput.js +1 -1
- package/esm/date/parts/DateInput.js.map +1 -1
- package/esm/date/parts/DateWrapper.d.ts +1 -1
- package/esm/date/parts/DateWrapper.js +1 -1
- package/esm/date/parts/DateWrapper.js.map +1 -1
- package/esm/expansion-card/ExpansionCardHeader.js +1 -1
- package/esm/expansion-card/ExpansionCardHeader.js.map +1 -1
- package/esm/form/ReadOnlyIcon.js +1 -1
- package/esm/form/ReadOnlyIcon.js.map +1 -1
- package/esm/form/combobox/Combobox.d.ts +1 -1
- package/esm/form/combobox/Combobox.js +1 -1
- package/esm/form/combobox/Combobox.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/AddNewOption.js +1 -1
- package/esm/form/combobox/FilteredOptions/AddNewOption.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/LoadingMessage.js +1 -1
- package/esm/form/combobox/FilteredOptions/LoadingMessage.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/MaxSelectedMessage.js +1 -1
- package/esm/form/combobox/FilteredOptions/MaxSelectedMessage.js.map +1 -1
- package/esm/form/combobox/Input/InputController.d.ts +1 -1
- package/esm/form/confirmation-panel/ConfirmationPanel.js +1 -1
- package/esm/form/confirmation-panel/ConfirmationPanel.js.map +1 -1
- package/esm/form/error-summary/ErrorSummary.js +1 -1
- package/esm/form/error-summary/ErrorSummary.js.map +1 -1
- package/esm/form/fieldset/Fieldset.js +1 -1
- package/esm/form/fieldset/Fieldset.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 +1 -1
- package/esm/form/file-upload/parts/item/Item.js.map +1 -1
- package/esm/form/form-progress/FormProgress.js +1 -1
- package/esm/form/form-progress/FormProgress.js.map +1 -1
- package/esm/form/form-summary/FormSummaryEditLink.js +1 -1
- package/esm/form/form-summary/FormSummaryEditLink.js.map +1 -1
- package/esm/form/search/Search.js +4 -4
- package/esm/form/search/Search.js.map +1 -1
- package/esm/form/search/SearchButton.js +1 -1
- package/esm/form/search/SearchButton.js.map +1 -1
- package/esm/form/select/Select.js +1 -1
- package/esm/form/select/Select.js.map +1 -1
- package/esm/form/switch/Switch.js +1 -7
- package/esm/form/switch/Switch.js.map +1 -1
- package/esm/form/textarea/Textarea.js +1 -1
- package/esm/form/textarea/Textarea.js.map +1 -1
- package/esm/form/textarea/TextareaCounter.js +1 -1
- package/esm/form/textarea/TextareaCounter.js.map +1 -1
- package/esm/form/textfield/TextField.js +1 -1
- package/esm/form/textfield/TextField.js.map +1 -1
- package/esm/guide-panel/GuidePanel.js +2 -2
- package/esm/guide-panel/GuidePanel.js.map +1 -1
- package/esm/guide-panel/Illustration.darkside.js +1 -1
- package/esm/guide-panel/Illustration.darkside.js.map +1 -1
- package/esm/guide-panel/Illustration.js +1 -1
- package/esm/guide-panel/Illustration.js.map +1 -1
- package/esm/help-text/HelpText.js +3 -3
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/internal-header/InternalHeader.js +3 -3
- package/esm/internal-header/InternalHeader.js.map +1 -1
- package/esm/layout/base/BasePrimitive.js +2 -2
- package/esm/layout/base/BasePrimitive.js.map +1 -1
- package/esm/layout/bleed/Bleed.js +2 -2
- package/esm/layout/bleed/Bleed.js.map +1 -1
- package/esm/layout/box/Box.js +2 -2
- package/esm/layout/box/Box.js.map +1 -1
- package/esm/layout/grid/HGrid.js +2 -2
- package/esm/layout/grid/HGrid.js.map +1 -1
- package/esm/layout/page/Page.js +2 -2
- package/esm/layout/page/Page.js.map +1 -1
- package/esm/layout/stack/Stack.js +2 -2
- package/esm/layout/stack/Stack.js.map +1 -1
- package/esm/link/stories/RandomIcon.d.ts +2 -0
- package/esm/link/stories/RandomIcon.js +9 -0
- package/esm/link/stories/RandomIcon.js.map +1 -0
- package/esm/loader/Loader.js +1 -1
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/ModalHeader.js +1 -1
- package/esm/modal/ModalHeader.js.map +1 -1
- package/esm/overlays/action-menu/ActionMenu.js +2 -2
- package/esm/overlays/action-menu/ActionMenu.js.map +1 -1
- package/esm/pagination/Pagination.js +1 -1
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/pagination/PaginationItem.js +2 -2
- package/esm/pagination/PaginationItem.js.map +1 -1
- package/esm/popover/Popover.js +2 -2
- package/esm/popover/Popover.js.map +1 -1
- package/esm/portal/Portal.js +12 -0
- package/esm/portal/Portal.js.map +1 -1
- package/esm/progress-bar/ProgressBar.js +1 -1
- package/esm/progress-bar/ProgressBar.js.map +1 -1
- package/esm/provider/index.d.ts +0 -1
- package/esm/provider/index.js +0 -1
- package/esm/provider/index.js.map +1 -1
- package/esm/read-more/ReadMore.js +1 -3
- package/esm/read-more/ReadMore.js.map +1 -1
- package/esm/table/ExpandableRow.js +1 -1
- package/esm/table/ExpandableRow.js.map +1 -1
- package/esm/tabs/Tabs.context.d.ts +1 -1
- package/esm/tabs/parts/tablist/useScrollButtons.d.ts +1 -1
- package/esm/theme/Theme.d.ts +16 -0
- package/esm/theme/Theme.js +21 -0
- package/esm/theme/Theme.js.map +1 -0
- package/esm/theme/index.d.ts +1 -0
- package/esm/theme/index.js +3 -0
- package/esm/theme/index.js.map +1 -0
- package/esm/timeline/AxisLabels.js +1 -1
- package/esm/timeline/AxisLabels.js.map +1 -1
- package/esm/timeline/Pin.js +3 -3
- package/esm/timeline/Pin.js.map +1 -1
- package/esm/timeline/TimelineRow.js +1 -1
- package/esm/timeline/TimelineRow.js.map +1 -1
- package/esm/timeline/period/ClickablePeriod.js +3 -3
- package/esm/timeline/period/ClickablePeriod.js.map +1 -1
- package/esm/timeline/period/NonClickablePeriod.js +1 -1
- package/esm/timeline/period/NonClickablePeriod.js.map +1 -1
- package/esm/timeline/utils/period.d.ts +1 -1
- package/esm/timeline/zoom/ZoomButton.js +1 -1
- package/esm/timeline/zoom/ZoomButton.js.map +1 -1
- package/esm/toggle-group/parts/ToggleItem.js +1 -1
- package/esm/toggle-group/parts/ToggleItem.js.map +1 -1
- package/esm/tooltip/Tooltip.js +2 -2
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/typography/ErrorMessage.d.ts +4 -0
- package/esm/typography/ErrorMessage.js +6 -2
- package/esm/typography/ErrorMessage.js.map +1 -1
- package/esm/util/TextareaAutoSize.js +1 -1
- package/esm/util/TextareaAutoSize.js.map +1 -1
- package/esm/util/debounce.d.ts +2 -2
- package/esm/util/debounce.js +5 -1
- package/esm/util/debounce.js.map +1 -1
- package/esm/util/i18n/i18n.hooks.d.ts +4 -0
- package/esm/util/i18n/{i18n.context.js → i18n.hooks.js} +3 -7
- package/esm/util/i18n/{i18n.context.js.map → i18n.hooks.js.map} +1 -1
- package/esm/util/i18n/i18n.types.d.ts +4 -0
- package/esm/util/i18n/locales/nb.d.ts +81 -4
- package/esm/util/i18n/locales/nb.js +81 -4
- package/esm/util/i18n/locales/nb.js.map +1 -1
- package/package.json +17 -12
- package/src/accordion/AccordionContent.tsx +2 -2
- package/src/accordion/AccordionHeader.tsx +2 -2
- package/src/alert/Alert.tsx +1 -1
- package/src/button/Button.tsx +20 -50
- package/src/chips/Removable.tsx +1 -1
- package/src/copybutton/CopyButton.tsx +1 -1
- package/src/date/context/useDateTranslationContext.ts +1 -1
- package/src/date/datepicker/DatePicker.tsx +1 -1
- package/src/date/datepicker/DatePickerStandalone.tsx +1 -1
- package/src/date/datepicker/datepicker.test.tsx +2 -5
- package/src/date/datepicker/parts/WeekNumber.tsx +2 -2
- package/src/date/hooks/useDatepicker.tsx +1 -1
- package/src/date/hooks/useMonthPicker.tsx +1 -1
- package/src/date/hooks/useRangeDatepicker.test.tsx +5 -10
- package/src/date/hooks/useRangeDatepicker.tsx +1 -1
- package/src/date/monthpicker/MonthPicker.tsx +1 -1
- package/src/date/monthpicker/MonthPickerStandalone.tsx +1 -1
- package/src/date/parts/DateInput.tsx +5 -1
- package/src/date/parts/DateWrapper.tsx +2 -1
- package/src/expansion-card/ExpansionCardHeader.tsx +1 -1
- package/src/form/ReadOnlyIcon.tsx +1 -1
- package/src/form/combobox/Combobox.tsx +5 -1
- package/src/form/combobox/FilteredOptions/AddNewOption.tsx +1 -1
- package/src/form/combobox/FilteredOptions/LoadingMessage.tsx +1 -1
- package/src/form/combobox/FilteredOptions/MaxSelectedMessage.tsx +1 -1
- package/src/form/confirmation-panel/ConfirmationPanel.tsx +5 -1
- package/src/form/error-summary/ErrorSummary.tsx +1 -1
- package/src/form/fieldset/Fieldset.tsx +3 -1
- package/src/form/file-upload/parts/dropzone/Dropzone.tsx +2 -2
- package/src/form/file-upload/parts/item/Item.tsx +1 -1
- package/src/form/form-progress/FormProgress.tsx +1 -1
- package/src/form/form-summary/FormSummaryEditLink.tsx +1 -1
- package/src/form/search/Search.tsx +6 -4
- package/src/form/search/SearchButton.tsx +1 -1
- package/src/form/select/Select.tsx +3 -1
- package/src/form/switch/Switch.tsx +1 -10
- package/src/form/textarea/Textarea.tsx +3 -1
- package/src/form/textarea/TextareaCounter.tsx +1 -1
- package/src/form/textfield/TextField.tsx +3 -1
- package/src/guide-panel/GuidePanel.tsx +2 -2
- package/src/guide-panel/Illustration.darkside.tsx +1 -1
- package/src/guide-panel/Illustration.tsx +1 -1
- package/src/help-text/HelpText.tsx +3 -3
- package/src/internal-header/InternalHeader.tsx +4 -4
- package/src/layout/base/BasePrimitive.tsx +2 -2
- package/src/layout/bleed/Bleed.tsx +2 -2
- package/src/layout/box/Box.tsx +2 -2
- package/src/layout/grid/HGrid.tsx +2 -2
- package/src/layout/page/Page.tsx +2 -2
- package/src/layout/stack/Stack.tsx +2 -2
- package/src/loader/Loader.tsx +1 -1
- package/src/modal/ModalHeader.tsx +1 -1
- package/src/overlays/action-menu/ActionMenu.tsx +2 -2
- package/src/pagination/Pagination.tsx +1 -1
- package/src/pagination/PaginationItem.tsx +2 -2
- package/src/popover/Popover.tsx +2 -2
- package/src/portal/Portal.tsx +17 -0
- package/src/progress-bar/ProgressBar.tsx +1 -1
- package/src/provider/index.ts +0 -4
- package/src/read-more/ReadMore.tsx +1 -4
- package/src/table/ExpandableRow.tsx +1 -1
- package/src/tabs/Tabs.test.tsx +4 -12
- package/src/theme/Theme.tsx +60 -0
- package/src/theme/index.ts +2 -0
- package/src/timeline/AxisLabels.tsx +2 -1
- package/src/timeline/Pin.tsx +3 -3
- package/src/timeline/TimelineRow.tsx +1 -1
- package/src/timeline/period/ClickablePeriod.tsx +3 -3
- package/src/timeline/period/NonClickablePeriod.tsx +1 -1
- package/src/timeline/utils/period.ts +1 -1
- package/src/timeline/zoom/ZoomButton.tsx +1 -1
- package/src/toggle-group/parts/ToggleItem.tsx +1 -0
- package/src/tooltip/Tooltip.tsx +2 -2
- package/src/typography/ErrorMessage.tsx +36 -2
- package/src/util/TextareaAutoSize.tsx +15 -11
- package/src/util/debounce.ts +11 -3
- package/src/util/i18n/{i18n.context.test.tsx → i18n.hooks.test.tsx} +62 -3
- package/src/util/i18n/{i18n.context.ts → i18n.hooks.ts} +3 -19
- package/src/util/i18n/i18n.types.ts +12 -0
- package/cjs/modal/types.test-d.d.ts +0 -1
- package/cjs/modal/types.test-d.js +0 -67
- package/cjs/modal/types.test-d.js.map +0 -1
- package/cjs/provider/theme/AkselTheme.d.ts +0 -22
- package/cjs/provider/theme/AkselTheme.js.map +0 -1
- package/cjs/util/i18n/i18n.context.d.ts +0 -9
- package/cjs/util/i18n/i18n.context.js.map +0 -1
- package/esm/modal/types.test-d.d.ts +0 -1
- package/esm/modal/types.test-d.js +0 -65
- package/esm/modal/types.test-d.js.map +0 -1
- package/esm/provider/theme/AkselTheme.d.ts +0 -22
- package/esm/provider/theme/AkselTheme.js +0 -22
- package/esm/provider/theme/AkselTheme.js.map +0 -1
- package/esm/util/i18n/i18n.context.d.ts +0 -9
- package/src/provider/theme/AkselTheme.tsx +0 -70
|
@@ -5,7 +5,8 @@ import { Modal } from "../../modal";
|
|
|
5
5
|
import { useModalContext } from "../../modal/Modal.context";
|
|
6
6
|
import { Popover } from "../../popover";
|
|
7
7
|
import { useMedia } from "../../util/hooks";
|
|
8
|
-
import {
|
|
8
|
+
import { useI18n } from "../../util/i18n/i18n.hooks";
|
|
9
|
+
import { TFunction } from "../../util/i18n/i18n.types";
|
|
9
10
|
import { getGlobalTranslations } from "../utils";
|
|
10
11
|
|
|
11
12
|
const variantToLabel = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef, useContext } from "react";
|
|
3
3
|
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
4
|
-
import { useI18n } from "../util/i18n/i18n.
|
|
4
|
+
import { useI18n } from "../util/i18n/i18n.hooks";
|
|
5
5
|
import { ExpansionCardContext } from "./context";
|
|
6
6
|
|
|
7
7
|
export interface ExpansionCardHeaderProps
|
|
@@ -71,7 +71,11 @@ export const Combobox = forwardRef<
|
|
|
71
71
|
aria-relevant="additions removals"
|
|
72
72
|
aria-live="polite"
|
|
73
73
|
>
|
|
74
|
-
{showErrorMsg &&
|
|
74
|
+
{showErrorMsg && (
|
|
75
|
+
<ErrorMessage size={size} showIcon>
|
|
76
|
+
{error}
|
|
77
|
+
</ErrorMessage>
|
|
78
|
+
)}
|
|
75
79
|
</div>
|
|
76
80
|
</ComboboxWrapper>
|
|
77
81
|
);
|
|
@@ -2,7 +2,7 @@ import cl from "clsx";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { PlusIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { BodyShort, Label } from "../../../typography";
|
|
5
|
-
import { useI18n } from "../../../util/i18n/i18n.
|
|
5
|
+
import { useI18n } from "../../../util/i18n/i18n.hooks";
|
|
6
6
|
import { useInputContext } from "../Input/Input.context";
|
|
7
7
|
import { useSelectedOptionsContext } from "../SelectedOptions/selectedOptionsContext";
|
|
8
8
|
import { isInList, toComboboxOption } from "../combobox-utils";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Loader } from "../../../loader";
|
|
3
|
-
import { useI18n } from "../../../util/i18n/i18n.
|
|
3
|
+
import { useI18n } from "../../../util/i18n/i18n.hooks";
|
|
4
4
|
import { useInputContext } from "../Input/Input.context";
|
|
5
5
|
import filteredOptionsUtil from "./filtered-options-util";
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { useI18n } from "../../../util/i18n/i18n.
|
|
2
|
+
import { useI18n } from "../../../util/i18n/i18n.hooks";
|
|
3
3
|
import { useInputContext } from "../Input/Input.context";
|
|
4
4
|
import { useSelectedOptionsContext } from "../SelectedOptions/selectedOptionsContext";
|
|
5
5
|
import filteredOptionsUtil from "./filtered-options-util";
|
|
@@ -91,7 +91,11 @@ export const ConfirmationPanel = forwardRef<
|
|
|
91
91
|
</Checkbox>
|
|
92
92
|
</div>
|
|
93
93
|
<div className="navds-form-field__error" id={errorId} role="alert">
|
|
94
|
-
{showErrorMsg &&
|
|
94
|
+
{showErrorMsg && (
|
|
95
|
+
<ErrorMessage size={size} showIcon>
|
|
96
|
+
{props.error}
|
|
97
|
+
</ErrorMessage>
|
|
98
|
+
)}
|
|
95
99
|
</div>
|
|
96
100
|
</div>
|
|
97
101
|
);
|
|
@@ -3,7 +3,7 @@ import React, { HTMLAttributes, forwardRef, useRef } from "react";
|
|
|
3
3
|
import { BodyShort, Heading } from "../../typography";
|
|
4
4
|
import { composeEventHandlers } from "../../util/composeEventHandlers";
|
|
5
5
|
import { useMergeRefs } from "../../util/hooks";
|
|
6
|
-
import { useI18n } from "../../util/i18n/i18n.
|
|
6
|
+
import { useI18n } from "../../util/i18n/i18n.hooks";
|
|
7
7
|
import ErrorSummaryItem from "./ErrorSummaryItem";
|
|
8
8
|
|
|
9
9
|
export interface ErrorSummaryProps
|
|
@@ -113,7 +113,9 @@ export const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(
|
|
|
113
113
|
className="navds-fieldset__error"
|
|
114
114
|
>
|
|
115
115
|
{showErrorMsg && (
|
|
116
|
-
<ErrorMessage size={size}>
|
|
116
|
+
<ErrorMessage size={size} showIcon>
|
|
117
|
+
{props.error}
|
|
118
|
+
</ErrorMessage>
|
|
117
119
|
)}
|
|
118
120
|
</div>
|
|
119
121
|
</fieldset>
|
|
@@ -5,7 +5,7 @@ import { Button } from "../../../../button";
|
|
|
5
5
|
import { BodyShort, ErrorMessage, Label } from "../../../../typography";
|
|
6
6
|
import { composeEventHandlers } from "../../../../util/composeEventHandlers";
|
|
7
7
|
import { useId } from "../../../../util/hooks";
|
|
8
|
-
import { useI18n } from "../../../../util/i18n/i18n.
|
|
8
|
+
import { useI18n } from "../../../../util/i18n/i18n.hooks";
|
|
9
9
|
import { omit } from "../../../../util/omit";
|
|
10
10
|
import { useFormField } from "../../../useFormField";
|
|
11
11
|
import { useFileUploadTranslation } from "../../FileUpload.context";
|
|
@@ -177,7 +177,7 @@ const Dropzone = forwardRef<HTMLInputElement, FileUploadDropzoneProps>(
|
|
|
177
177
|
aria-relevant="additions removals"
|
|
178
178
|
aria-live="polite"
|
|
179
179
|
>
|
|
180
|
-
{showErrorMsg && <ErrorMessage>{error}</ErrorMessage>}
|
|
180
|
+
{showErrorMsg && <ErrorMessage showIcon>{error}</ErrorMessage>}
|
|
181
181
|
</div>
|
|
182
182
|
</div>
|
|
183
183
|
);
|
|
@@ -3,7 +3,7 @@ import React, { MouseEvent, forwardRef } from "react";
|
|
|
3
3
|
import { ExclamationmarkTriangleIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { BodyShort } from "../../../../typography";
|
|
5
5
|
import { OverridableComponent } from "../../../../util";
|
|
6
|
-
import { useI18n } from "../../../../util/i18n/i18n.
|
|
6
|
+
import { useI18n } from "../../../../util/i18n/i18n.hooks";
|
|
7
7
|
import { ComponentTranslation } from "../../../../util/i18n/i18n.types";
|
|
8
8
|
import { useFileUploadTranslation } from "../../FileUpload.context";
|
|
9
9
|
import { FileItem } from "./Item.types";
|
|
@@ -6,7 +6,7 @@ import { HStack } from "../../layout/stack";
|
|
|
6
6
|
import { ProgressBar } from "../../progress-bar";
|
|
7
7
|
import { Stepper, StepperStepProps } from "../../stepper";
|
|
8
8
|
import { BodyShort } from "../../typography";
|
|
9
|
-
import { useI18n } from "../../util/i18n/i18n.
|
|
9
|
+
import { useI18n } from "../../util/i18n/i18n.hooks";
|
|
10
10
|
import { ComponentTranslation } from "../../util/i18n/i18n.types";
|
|
11
11
|
|
|
12
12
|
export interface FormProgressProps
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
3
|
import { Link } from "../../link";
|
|
4
|
-
import { useI18n } from "../../util/i18n/i18n.
|
|
4
|
+
import { useI18n } from "../../util/i18n/i18n.hooks";
|
|
5
5
|
import { OverridableComponent } from "../../util/types";
|
|
6
6
|
|
|
7
7
|
export interface FormSummaryEditProps
|
|
@@ -7,11 +7,11 @@ import React, {
|
|
|
7
7
|
} from "react";
|
|
8
8
|
import { MagnifyingGlassIcon, XMarkIcon } from "@navikt/aksel-icons";
|
|
9
9
|
import { Button } from "../../button";
|
|
10
|
-
import {
|
|
10
|
+
import { useThemeInternal } from "../../theme/Theme";
|
|
11
11
|
import { BodyShort, ErrorMessage, Label } from "../../typography";
|
|
12
12
|
import { omit } from "../../util";
|
|
13
13
|
import { useMergeRefs } from "../../util/hooks/useMergeRefs";
|
|
14
|
-
import { useI18n } from "../../util/i18n/i18n.
|
|
14
|
+
import { useI18n } from "../../util/i18n/i18n.hooks";
|
|
15
15
|
import { FormFieldProps, useFormField } from "../useFormField";
|
|
16
16
|
import SearchButton, { SearchButtonType } from "./SearchButton";
|
|
17
17
|
import { SearchContext } from "./context";
|
|
@@ -125,7 +125,7 @@ export const Search = forwardRef<HTMLInputElement, SearchProps>(
|
|
|
125
125
|
...rest
|
|
126
126
|
} = props;
|
|
127
127
|
|
|
128
|
-
const themeContext =
|
|
128
|
+
const themeContext = useThemeInternal(false);
|
|
129
129
|
|
|
130
130
|
const searchRef = useRef<HTMLInputElement | null>(null);
|
|
131
131
|
const mergedRef = useMergeRefs(searchRef, ref);
|
|
@@ -263,7 +263,9 @@ export const Search = forwardRef<HTMLInputElement, SearchProps>(
|
|
|
263
263
|
aria-live="polite"
|
|
264
264
|
>
|
|
265
265
|
{showErrorMsg && (
|
|
266
|
-
<ErrorMessage size={size}>
|
|
266
|
+
<ErrorMessage size={size} showIcon>
|
|
267
|
+
{props.error}
|
|
268
|
+
</ErrorMessage>
|
|
267
269
|
)}
|
|
268
270
|
</div>
|
|
269
271
|
</div>
|
|
@@ -3,7 +3,7 @@ import React, { forwardRef, useContext } from "react";
|
|
|
3
3
|
import { MagnifyingGlassIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { Button, ButtonProps } from "../../button";
|
|
5
5
|
import { composeEventHandlers } from "../../util/composeEventHandlers";
|
|
6
|
-
import { useI18n } from "../../util/i18n/i18n.
|
|
6
|
+
import { useI18n } from "../../util/i18n/i18n.hooks";
|
|
7
7
|
import { SearchContext } from "./context";
|
|
8
8
|
|
|
9
9
|
export interface SearchButtonProps
|
|
@@ -151,7 +151,9 @@ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|
|
151
151
|
aria-live="polite"
|
|
152
152
|
>
|
|
153
153
|
{showErrorMsg && (
|
|
154
|
-
<ErrorMessage size={size}>
|
|
154
|
+
<ErrorMessage size={size} showIcon>
|
|
155
|
+
{props.error}
|
|
156
|
+
</ErrorMessage>
|
|
155
157
|
)}
|
|
156
158
|
</div>
|
|
157
159
|
</div>
|
|
@@ -6,7 +6,6 @@ import React, {
|
|
|
6
6
|
useState,
|
|
7
7
|
} from "react";
|
|
8
8
|
import { Loader } from "../../loader";
|
|
9
|
-
import { UNSAFE_useAkselTheme } from "../../provider";
|
|
10
9
|
import { BodyShort } from "../../typography";
|
|
11
10
|
import { omit } from "../../util";
|
|
12
11
|
import { ReadOnlyIconWithTitle } from "../ReadOnlyIcon";
|
|
@@ -69,8 +68,6 @@ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
|
|
|
69
68
|
defaultChecked ?? checkedProp ?? false,
|
|
70
69
|
);
|
|
71
70
|
|
|
72
|
-
const themeContext = UNSAFE_useAkselTheme(false);
|
|
73
|
-
|
|
74
71
|
useEffect(() => {
|
|
75
72
|
checkedProp !== undefined && setChecked(checkedProp);
|
|
76
73
|
}, [checkedProp]);
|
|
@@ -121,13 +118,7 @@ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
|
|
|
121
118
|
<Loader
|
|
122
119
|
size="xsmall"
|
|
123
120
|
aria-live="polite"
|
|
124
|
-
variant={
|
|
125
|
-
checked
|
|
126
|
-
? "interaction"
|
|
127
|
-
: themeContext
|
|
128
|
-
? "inverted"
|
|
129
|
-
: "neutral"
|
|
130
|
-
}
|
|
121
|
+
variant={checked ? "interaction" : "inverted"}
|
|
131
122
|
/>
|
|
132
123
|
) : (
|
|
133
124
|
<svg
|
|
@@ -193,7 +193,9 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
193
193
|
aria-live="polite"
|
|
194
194
|
>
|
|
195
195
|
{showErrorMsg && (
|
|
196
|
-
<ErrorMessage size={size}>
|
|
196
|
+
<ErrorMessage size={size} showIcon>
|
|
197
|
+
{props.error}
|
|
198
|
+
</ErrorMessage>
|
|
197
199
|
)}
|
|
198
200
|
</div>
|
|
199
201
|
</div>
|
|
@@ -2,7 +2,7 @@ import cl from "clsx";
|
|
|
2
2
|
import React, { useEffect, useState } from "react";
|
|
3
3
|
import { BodyShort } from "../../typography";
|
|
4
4
|
import debounce from "../../util/debounce";
|
|
5
|
-
import { useI18n } from "../../util/i18n/i18n.
|
|
5
|
+
import { useI18n } from "../../util/i18n/i18n.hooks";
|
|
6
6
|
import type { TextareaProps } from "./Textarea";
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
@@ -127,7 +127,9 @@ export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
127
127
|
aria-live="polite"
|
|
128
128
|
>
|
|
129
129
|
{showErrorMsg && (
|
|
130
|
-
<ErrorMessage size={size}>
|
|
130
|
+
<ErrorMessage size={size} showIcon>
|
|
131
|
+
{props.error}
|
|
132
|
+
</ErrorMessage>
|
|
131
133
|
)}
|
|
132
134
|
</div>
|
|
133
135
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { HTMLAttributes, forwardRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { useThemeInternal } from "../theme/Theme";
|
|
4
4
|
import { DefaultIllustration } from "./Illustration";
|
|
5
5
|
import { DarksideGudiepanelIllustration } from "./Illustration.darkside";
|
|
6
6
|
|
|
@@ -37,7 +37,7 @@ export interface GuidePanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
37
37
|
*/
|
|
38
38
|
export const GuidePanel = forwardRef<HTMLDivElement, GuidePanelProps>(
|
|
39
39
|
({ children, className, illustration, poster, ...rest }, ref) => {
|
|
40
|
-
const themeContext =
|
|
40
|
+
const themeContext = useThemeInternal(false);
|
|
41
41
|
|
|
42
42
|
return (
|
|
43
43
|
<div
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef, useRef, useState } from "react";
|
|
3
3
|
import { Popover, PopoverProps } from "../popover";
|
|
4
|
-
import {
|
|
4
|
+
import { useThemeInternal } from "../theme/Theme";
|
|
5
5
|
import { composeEventHandlers } from "../util/composeEventHandlers";
|
|
6
6
|
import { useMergeRefs } from "../util/hooks/useMergeRefs";
|
|
7
|
-
import { useI18n } from "../util/i18n/i18n.
|
|
7
|
+
import { useI18n } from "../util/i18n/i18n.hooks";
|
|
8
8
|
import { HelpTextIcon } from "./HelpTextIcon";
|
|
9
9
|
|
|
10
10
|
export interface HelpTextProps
|
|
@@ -52,7 +52,7 @@ export const HelpText = forwardRef<HTMLButtonElement, HelpTextProps>(
|
|
|
52
52
|
const buttonRef = useRef<HTMLButtonElement | null>(null);
|
|
53
53
|
const mergedRef = useMergeRefs(buttonRef, ref);
|
|
54
54
|
const [open, setOpen] = useState(false);
|
|
55
|
-
const themeContext =
|
|
55
|
+
const themeContext = useThemeInternal(false);
|
|
56
56
|
const translate = useI18n("HelpText");
|
|
57
57
|
|
|
58
58
|
const titleWithFallback = title || translate("title");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { HTMLAttributes, forwardRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { Theme, useThemeInternal } from "../theme/Theme";
|
|
4
4
|
import { OverridableComponent } from "../util/types";
|
|
5
5
|
import InternalHeaderButton, {
|
|
6
6
|
InternalHeaderButtonProps,
|
|
@@ -78,20 +78,20 @@ interface InternalHeaderComponent
|
|
|
78
78
|
* ```
|
|
79
79
|
*/
|
|
80
80
|
export const InternalHeader = forwardRef(({ className, ...rest }, ref) => {
|
|
81
|
-
const themeContext =
|
|
81
|
+
const themeContext = useThemeInternal(false);
|
|
82
82
|
|
|
83
83
|
/*
|
|
84
84
|
* Component is always in "dark" mode, so we manually override global theme.
|
|
85
85
|
*/
|
|
86
86
|
if (themeContext) {
|
|
87
87
|
return (
|
|
88
|
-
<
|
|
88
|
+
<Theme theme="dark" asChild>
|
|
89
89
|
<header
|
|
90
90
|
{...rest}
|
|
91
91
|
ref={ref}
|
|
92
92
|
className={cl("navds-internalheader", className)}
|
|
93
93
|
/>
|
|
94
|
-
</
|
|
94
|
+
</Theme>
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { UNSAFE_useAkselTheme } from "../../provider";
|
|
4
3
|
import { Slot } from "../../slot/Slot";
|
|
4
|
+
import { useThemeInternal } from "../../theme/Theme";
|
|
5
5
|
import { getResponsiveProps, getResponsiveValue } from "../utilities/css";
|
|
6
6
|
import { ResponsiveProp, SpacingScale } from "../utilities/types";
|
|
7
7
|
|
|
@@ -252,7 +252,7 @@ export const BasePrimitive = ({
|
|
|
252
252
|
flexShrink,
|
|
253
253
|
gridColumn,
|
|
254
254
|
}: BasePrimitiveProps) => {
|
|
255
|
-
const themeContext =
|
|
255
|
+
const themeContext = useThemeInternal(false);
|
|
256
256
|
const prefix = themeContext ? "ax" : "a";
|
|
257
257
|
|
|
258
258
|
const style: React.CSSProperties = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { UNSAFE_useAkselTheme } from "../../provider";
|
|
4
3
|
import { Slot } from "../../slot/Slot";
|
|
4
|
+
import { useThemeInternal } from "../../theme/Theme";
|
|
5
5
|
import { getResponsiveProps } from "../utilities/css";
|
|
6
6
|
import { ResponsiveProp, SpacingScale } from "../utilities/types";
|
|
7
7
|
|
|
@@ -81,7 +81,7 @@ export const Bleed = forwardRef<HTMLDivElement, BleedProps>(
|
|
|
81
81
|
},
|
|
82
82
|
ref,
|
|
83
83
|
) => {
|
|
84
|
-
const themeContext =
|
|
84
|
+
const themeContext = useThemeInternal(false);
|
|
85
85
|
const prefix = themeContext ? "ax" : "a";
|
|
86
86
|
|
|
87
87
|
let style: React.CSSProperties = {
|
package/src/layout/box/Box.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
3
|
import { type BorderRadiusKeys } from "@navikt/ds-tokens/types";
|
|
4
|
-
import { UNSAFE_useAkselTheme } from "../../provider";
|
|
5
4
|
import { Slot } from "../../slot/Slot";
|
|
5
|
+
import { useThemeInternal } from "../../theme/Theme";
|
|
6
6
|
import { omit } from "../../util";
|
|
7
7
|
import { OverridableComponent } from "../../util/types";
|
|
8
8
|
import BasePrimitive, {
|
|
@@ -109,7 +109,7 @@ export const BoxComponent: OverridableComponent<BoxProps, HTMLDivElement> =
|
|
|
109
109
|
},
|
|
110
110
|
ref,
|
|
111
111
|
) => {
|
|
112
|
-
const themeContext =
|
|
112
|
+
const themeContext = useThemeInternal(false);
|
|
113
113
|
|
|
114
114
|
if (
|
|
115
115
|
process.env.NODE_ENV !== "production" &&
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { UNSAFE_useAkselTheme } from "../../provider";
|
|
4
3
|
import { Slot } from "../../slot/Slot";
|
|
4
|
+
import { useThemeInternal } from "../../theme/Theme";
|
|
5
5
|
import { OverridableComponent, omit } from "../../util";
|
|
6
6
|
import BasePrimitive, {
|
|
7
7
|
PRIMITIVE_PROPS,
|
|
@@ -78,7 +78,7 @@ export const HGrid: OverridableComponent<HGridProps, HTMLDivElement> =
|
|
|
78
78
|
},
|
|
79
79
|
ref,
|
|
80
80
|
) => {
|
|
81
|
-
const themeContext =
|
|
81
|
+
const themeContext = useThemeInternal(false);
|
|
82
82
|
const prefix = themeContext ? "ax" : "a";
|
|
83
83
|
|
|
84
84
|
const styles: React.CSSProperties = {
|
package/src/layout/page/Page.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { useThemeInternal } from "../../theme/Theme";
|
|
4
4
|
import { OverridableComponent } from "../../util";
|
|
5
5
|
import { BackgroundColorToken } from "../utilities/types";
|
|
6
6
|
import { PageBlock } from "./parts/PageBlock";
|
|
@@ -54,7 +54,7 @@ export const PageComponent: OverridableComponent<PageProps, HTMLElement> =
|
|
|
54
54
|
},
|
|
55
55
|
ref,
|
|
56
56
|
) => {
|
|
57
|
-
const themeContext =
|
|
57
|
+
const themeContext = useThemeInternal(false);
|
|
58
58
|
|
|
59
59
|
if (process.env.NODE_ENV !== "production" && themeContext && background) {
|
|
60
60
|
console.warn(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { HTMLAttributes, forwardRef } from "react";
|
|
3
|
-
import { UNSAFE_useAkselTheme } from "../../provider";
|
|
4
3
|
import { Slot } from "../../slot/Slot";
|
|
4
|
+
import { useThemeInternal } from "../../theme/Theme";
|
|
5
5
|
import { omit } from "../../util";
|
|
6
6
|
import { OverridableComponent } from "../../util/types";
|
|
7
7
|
import BasePrimitive, {
|
|
@@ -84,7 +84,7 @@ export const Stack: OverridableComponent<StackProps, HTMLDivElement> =
|
|
|
84
84
|
},
|
|
85
85
|
ref,
|
|
86
86
|
) => {
|
|
87
|
-
const themeContext =
|
|
87
|
+
const themeContext = useThemeInternal(false);
|
|
88
88
|
const prefix = themeContext ? "ax" : "a";
|
|
89
89
|
|
|
90
90
|
const style: React.CSSProperties = {
|
package/src/loader/Loader.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import cl from "clsx";
|
|
|
2
2
|
import React, { SVGProps, forwardRef } from "react";
|
|
3
3
|
import { omit } from "../util";
|
|
4
4
|
import { useId } from "../util/hooks";
|
|
5
|
-
import { useI18n } from "../util/i18n/i18n.
|
|
5
|
+
import { useI18n } from "../util/i18n/i18n.hooks";
|
|
6
6
|
|
|
7
7
|
export interface LoaderProps extends Omit<SVGProps<SVGSVGElement>, "ref"> {
|
|
8
8
|
/**
|
|
@@ -2,7 +2,7 @@ import cl from "clsx";
|
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
3
|
import { XMarkIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { Button } from "../button";
|
|
5
|
-
import { useI18n } from "../util/i18n/i18n.
|
|
5
|
+
import { useI18n } from "../util/i18n/i18n.hooks";
|
|
6
6
|
import { useModalContext } from "./Modal.context";
|
|
7
7
|
|
|
8
8
|
export interface ModalHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -2,8 +2,8 @@ import cl from "clsx";
|
|
|
2
2
|
import React, { forwardRef, useRef } from "react";
|
|
3
3
|
import { ChevronRightIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { useModalContext } from "../../modal/Modal.context";
|
|
5
|
-
import { UNSAFE_useAkselTheme } from "../../provider";
|
|
6
5
|
import { Slot } from "../../slot/Slot";
|
|
6
|
+
import { useThemeInternal } from "../../theme/Theme";
|
|
7
7
|
import { OverridableComponent, useId } from "../../util";
|
|
8
8
|
import { composeEventHandlers } from "../../util/composeEventHandlers";
|
|
9
9
|
import { createContext } from "../../util/create-context";
|
|
@@ -736,7 +736,7 @@ export const ActionMenuRadioItem = forwardRef<
|
|
|
736
736
|
{ children, className, onSelect, ...rest }: ActionMenuRadioItemProps,
|
|
737
737
|
ref,
|
|
738
738
|
) => {
|
|
739
|
-
const themeContext =
|
|
739
|
+
const themeContext = useThemeInternal(false);
|
|
740
740
|
|
|
741
741
|
return (
|
|
742
742
|
<Menu.RadioItem
|
|
@@ -3,7 +3,7 @@ import React, { forwardRef } from "react";
|
|
|
3
3
|
import { ChevronLeftIcon, ChevronRightIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { BodyShort, Heading } from "../typography";
|
|
5
5
|
import { useId } from "../util";
|
|
6
|
-
import { useI18n } from "../util/i18n/i18n.
|
|
6
|
+
import { useI18n } from "../util/i18n/i18n.hooks";
|
|
7
7
|
import PaginationItem, {
|
|
8
8
|
PaginationItemProps,
|
|
9
9
|
PaginationItemType,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
3
|
import { Button, ButtonProps } from "../button";
|
|
4
|
-
import {
|
|
4
|
+
import { useThemeInternal } from "../theme/Theme";
|
|
5
5
|
import { OverridableComponent } from "../util/types";
|
|
6
6
|
|
|
7
7
|
export interface PaginationItemProps extends ButtonProps {
|
|
@@ -40,7 +40,7 @@ export const Item: PaginationItemType = forwardRef(
|
|
|
40
40
|
},
|
|
41
41
|
ref,
|
|
42
42
|
) => {
|
|
43
|
-
const themeContext =
|
|
43
|
+
const themeContext = useThemeInternal(false);
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
46
|
<Button
|
package/src/popover/Popover.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import React, { HTMLAttributes, forwardRef, useContext, useRef } from "react";
|
|
|
11
11
|
import { DateInputContext } from "../date/context";
|
|
12
12
|
import { useModalContext } from "../modal/Modal.context";
|
|
13
13
|
import { DismissableLayer } from "../overlays/dismissablelayer/DismissableLayer";
|
|
14
|
-
import {
|
|
14
|
+
import { useThemeInternal } from "../theme/Theme";
|
|
15
15
|
import { useClientLayoutEffect } from "../util/hooks";
|
|
16
16
|
import { useMergeRefs } from "../util/hooks/useMergeRefs";
|
|
17
17
|
import PopoverContent, { PopoverContentType } from "./PopoverContent";
|
|
@@ -125,7 +125,7 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
125
125
|
const chosenStrategy = userStrategy ?? (isInModal ? "fixed" : "absolute");
|
|
126
126
|
const chosenFlip = isInDatepicker ? false : _flip;
|
|
127
127
|
|
|
128
|
-
const themeContext =
|
|
128
|
+
const themeContext = useThemeInternal(false);
|
|
129
129
|
|
|
130
130
|
const {
|
|
131
131
|
update,
|
package/src/portal/Portal.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import React, { HTMLAttributes, forwardRef } from "react";
|
|
|
2
2
|
import ReactDOM from "react-dom";
|
|
3
3
|
import { useProvider } from "../provider/Provider";
|
|
4
4
|
import { Slot } from "../slot/Slot";
|
|
5
|
+
import { Theme, useThemeInternal } from "../theme/Theme";
|
|
5
6
|
import { AsChildProps } from "../util/types";
|
|
6
7
|
|
|
7
8
|
interface PortalBaseProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -15,11 +16,27 @@ export type PortalProps = PortalBaseProps & AsChildProps;
|
|
|
15
16
|
|
|
16
17
|
export const Portal = forwardRef<HTMLDivElement, PortalProps>(
|
|
17
18
|
({ rootElement, asChild, ...rest }, ref) => {
|
|
19
|
+
const themeContext = useThemeInternal(false);
|
|
18
20
|
const contextRoot = useProvider()?.rootElement;
|
|
19
21
|
const root = rootElement ?? contextRoot ?? globalThis?.document?.body;
|
|
20
22
|
|
|
21
23
|
const Component = asChild ? Slot : "div";
|
|
22
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Portal can be mounted outside of theme-classNames.
|
|
27
|
+
* If a theme is present, we want to make sure that theme cascades to portaled element.
|
|
28
|
+
*/
|
|
29
|
+
if (themeContext) {
|
|
30
|
+
return root
|
|
31
|
+
? ReactDOM.createPortal(
|
|
32
|
+
<Theme theme={themeContext.theme} asChild hasBackground={false}>
|
|
33
|
+
<Component ref={ref} data-aksel-portal="" {...rest} />
|
|
34
|
+
</Theme>,
|
|
35
|
+
root,
|
|
36
|
+
)
|
|
37
|
+
: null;
|
|
38
|
+
}
|
|
39
|
+
|
|
23
40
|
return root
|
|
24
41
|
? ReactDOM.createPortal(
|
|
25
42
|
<Component ref={ref} data-aksel-portal="" {...rest} />,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { HTMLAttributes, forwardRef, useEffect, useRef } from "react";
|
|
3
|
-
import { useI18n } from "../util/i18n/i18n.
|
|
3
|
+
import { useI18n } from "../util/i18n/i18n.hooks";
|
|
4
4
|
|
|
5
5
|
interface ProgressBarPropsBase
|
|
6
6
|
extends Omit<HTMLAttributes<HTMLDivElement>, "role"> {
|