@navikt/ds-react 6.0.0-alpha.1 → 6.0.0-alpha.7
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/_docs.json +520 -60
- package/cjs/chat/Bubble.d.ts +0 -5
- package/cjs/chat/Bubble.js +2 -2
- package/cjs/chat/Bubble.js.map +1 -1
- package/cjs/chat/Chat.d.ts +0 -10
- package/cjs/chat/Chat.js +3 -3
- package/cjs/chat/Chat.js.map +1 -1
- package/cjs/date/context/useSharedMonthContext.js +2 -6
- package/cjs/date/context/useSharedMonthContext.js.map +1 -1
- package/cjs/date/datepicker/DatePicker.js +3 -5
- package/cjs/date/datepicker/DatePicker.js.map +1 -1
- package/cjs/date/datepicker/DatePickerStandalone.js +3 -5
- package/cjs/date/datepicker/DatePickerStandalone.js.map +1 -1
- package/cjs/date/datepicker/parts/DayButton.js +2 -5
- package/cjs/date/datepicker/parts/DayButton.js.map +1 -1
- package/cjs/date/datepicker/parts/DropdownCaption.js +3 -6
- package/cjs/date/datepicker/parts/DropdownCaption.js.map +1 -1
- package/cjs/date/datepicker/parts/Row.js +2 -1
- package/cjs/date/datepicker/parts/Row.js.map +1 -1
- package/cjs/date/hooks/useDatepicker.d.ts +1 -6
- package/cjs/date/hooks/useDatepicker.js +7 -11
- package/cjs/date/hooks/useDatepicker.js.map +1 -1
- package/cjs/date/hooks/useMonthPicker.d.ts +1 -6
- package/cjs/date/hooks/useMonthPicker.js.map +1 -1
- package/cjs/date/hooks/useRangeDatepicker.js +20 -25
- package/cjs/date/hooks/useRangeDatepicker.js.map +1 -1
- package/cjs/date/monthpicker/MonthButton.js +11 -15
- package/cjs/date/monthpicker/MonthButton.js.map +1 -1
- package/cjs/date/monthpicker/MonthCaption.js +4 -7
- package/cjs/date/monthpicker/MonthCaption.js.map +1 -1
- package/cjs/date/monthpicker/MonthPicker.js +7 -1
- package/cjs/date/monthpicker/MonthPicker.js.map +1 -1
- package/cjs/date/monthpicker/MonthPickerStandalone.js +7 -1
- package/cjs/date/monthpicker/MonthPickerStandalone.js.map +1 -1
- package/cjs/date/monthpicker/MonthSelector.js +8 -11
- package/cjs/date/monthpicker/MonthSelector.js.map +1 -1
- package/cjs/date/parts/DateInput.d.ts +1 -1
- package/cjs/date/utils/check-dates.js +2 -6
- package/cjs/date/utils/check-dates.js.map +1 -1
- package/cjs/date/utils/dates-disabled.js +3 -6
- package/cjs/date/utils/dates-disabled.js.map +1 -1
- package/cjs/date/utils/format-date.d.ts +1 -0
- package/cjs/date/utils/format-date.js +2 -5
- package/cjs/date/utils/format-date.js.map +1 -1
- package/cjs/date/utils/get-dates.js +14 -21
- package/cjs/date/utils/get-dates.js.map +1 -1
- package/cjs/date/utils/get-initial-year.js +2 -5
- package/cjs/date/utils/get-initial-year.js.map +1 -1
- package/cjs/date/utils/is-match.js +14 -20
- package/cjs/date/utils/is-match.js.map +1 -1
- package/cjs/date/utils/labels.d.ts +1 -0
- package/cjs/date/utils/labels.js.map +1 -1
- package/cjs/date/utils/locale.d.ts +1 -1
- package/cjs/date/utils/locale.js +4 -9
- package/cjs/date/utils/locale.js.map +1 -1
- package/cjs/date/utils/navigation.js +21 -24
- package/cjs/date/utils/navigation.js.map +1 -1
- package/cjs/date/utils/parse-date.d.ts +1 -0
- package/cjs/date/utils/parse-date.js +8 -13
- package/cjs/date/utils/parse-date.js.map +1 -1
- package/cjs/form/Textarea.js +8 -8
- package/cjs/form/Textarea.js.map +1 -1
- package/cjs/form/combobox/Combobox.js +1 -1
- package/cjs/form/combobox/Combobox.js.map +1 -1
- package/cjs/form/combobox/ComboboxProvider.js +2 -1
- package/cjs/form/combobox/ComboboxProvider.js.map +1 -1
- package/cjs/form/combobox/ComboboxWrapper.js +1 -1
- package/cjs/form/combobox/ComboboxWrapper.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js +59 -41
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/filtered-options-util.d.ts +2 -1
- package/cjs/form/combobox/FilteredOptions/filtered-options-util.js +3 -1
- package/cjs/form/combobox/FilteredOptions/filtered-options-util.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +15 -3
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/useVirtualFocus.d.ts +2 -4
- package/cjs/form/combobox/FilteredOptions/useVirtualFocus.js +52 -32
- package/cjs/form/combobox/FilteredOptions/useVirtualFocus.js.map +1 -1
- package/cjs/form/combobox/Input/Input.js +3 -1
- package/cjs/form/combobox/Input/Input.js.map +1 -1
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +5 -2
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js +3 -1
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/cjs/form/combobox/types.d.ts +14 -0
- package/cjs/form/error-summary/ErrorSummary.d.ts +9 -3
- package/cjs/form/error-summary/ErrorSummary.js +4 -9
- package/cjs/form/error-summary/ErrorSummary.js.map +1 -1
- package/cjs/form/error-summary/ErrorSummaryItem.d.ts +1 -1
- package/cjs/form/error-summary/ErrorSummaryItem.js +2 -1
- package/cjs/form/error-summary/ErrorSummaryItem.js.map +1 -1
- package/cjs/form/search/Search.d.ts +1 -0
- package/cjs/form/search/Search.js +2 -2
- package/cjs/form/search/Search.js.map +1 -1
- package/cjs/index.d.ts +1 -2
- package/cjs/index.js +1 -3
- package/cjs/index.js.map +1 -1
- package/cjs/layout/bleed/Bleed.d.ts +2 -2
- package/cjs/layout/utilities/css.js +4 -0
- package/cjs/layout/utilities/css.js.map +1 -1
- package/cjs/layout/utilities/types.d.ts +1 -1
- package/cjs/overlays/index.d.ts +2 -0
- package/cjs/overlays/index.js +6 -0
- package/cjs/overlays/index.js.map +1 -0
- package/cjs/overlays/portal/Portal.d.ts +11 -0
- package/cjs/{grid/Grid.js → overlays/portal/Portal.js} +15 -11
- package/cjs/overlays/portal/Portal.js.map +1 -0
- package/cjs/tabs/TabList.js +2 -2
- package/cjs/tabs/TabList.js.map +1 -1
- package/cjs/tabs/TabPanel.js +2 -2
- package/cjs/tabs/TabPanel.js.map +1 -1
- package/cjs/timeline/AxisLabels.js +4 -4
- package/cjs/timeline/AxisLabels.js.map +1 -1
- package/cjs/tooltip/Tooltip.js +3 -7
- package/cjs/tooltip/Tooltip.js.map +1 -1
- package/cjs/util/Slot.js +5 -2
- package/cjs/util/Slot.js.map +1 -1
- package/cjs/util/TextareaAutoSize.js +14 -24
- package/cjs/util/TextareaAutoSize.js.map +1 -1
- package/cjs/util/types/AsChildProps.d.ts +36 -0
- package/cjs/util/types/AsChildProps.js +3 -0
- package/cjs/util/types/AsChildProps.js.map +1 -0
- package/cjs/util/types/index.d.ts +1 -0
- package/esm/accordion/Accordion.d.ts +3 -3
- package/esm/accordion/Accordion.js +4 -4
- package/esm/accordion/AccordionContent.js +2 -2
- package/esm/accordion/AccordionHeader.js +4 -4
- package/esm/accordion/AccordionItem.js +3 -3
- package/esm/accordion/index.d.ts +1 -1
- package/esm/accordion/index.js +1 -1
- package/esm/alert/Alert.js +2 -2
- package/esm/alert/index.d.ts +2 -2
- package/esm/alert/index.js +1 -1
- package/esm/button/Button.d.ts +1 -1
- package/esm/button/Button.js +6 -6
- package/esm/button/index.d.ts +2 -2
- package/esm/button/index.js +1 -1
- package/esm/chat/Bubble.d.ts +0 -5
- package/esm/chat/Bubble.js +3 -3
- package/esm/chat/Bubble.js.map +1 -1
- package/esm/chat/Chat.d.ts +1 -11
- package/esm/chat/Chat.js +5 -5
- package/esm/chat/Chat.js.map +1 -1
- package/esm/chat/index.d.ts +1 -1
- package/esm/chat/index.js +1 -1
- package/esm/chips/Chips.d.ts +3 -3
- package/esm/chips/Chips.js +2 -2
- package/esm/chips/Removable.js +1 -1
- package/esm/chips/Toggle.d.ts +1 -1
- package/esm/chips/index.d.ts +1 -1
- package/esm/chips/index.js +1 -1
- package/esm/copybutton/CopyButton.js +3 -3
- package/esm/copybutton/index.d.ts +1 -1
- package/esm/copybutton/index.js +1 -1
- package/esm/date/context/index.d.ts +2 -2
- package/esm/date/context/index.js +2 -2
- package/esm/date/context/useSharedMonthContext.d.ts +1 -1
- package/esm/date/context/useSharedMonthContext.js +2 -3
- package/esm/date/context/useSharedMonthContext.js.map +1 -1
- package/esm/date/datepicker/DatePicker.d.ts +3 -3
- package/esm/date/datepicker/DatePicker.js +15 -17
- package/esm/date/datepicker/DatePicker.js.map +1 -1
- package/esm/date/datepicker/DatePickerStandalone.d.ts +1 -1
- package/esm/date/datepicker/DatePickerStandalone.js +9 -11
- package/esm/date/datepicker/DatePickerStandalone.js.map +1 -1
- package/esm/date/datepicker/parts/Caption.js +3 -3
- package/esm/date/datepicker/parts/DayButton.js +1 -1
- package/esm/date/datepicker/parts/DayButton.js.map +1 -1
- package/esm/date/datepicker/parts/DropdownCaption.js +6 -9
- package/esm/date/datepicker/parts/DropdownCaption.js.map +1 -1
- package/esm/date/datepicker/parts/HeadRow.js +1 -1
- package/esm/date/datepicker/parts/Row.js +5 -4
- package/esm/date/datepicker/parts/Row.js.map +1 -1
- package/esm/date/datepicker/parts/WeekNumber.js +1 -1
- package/esm/date/datepicker/parts/WeekRow.js +6 -6
- package/esm/date/hooks/index.d.ts +6 -6
- package/esm/date/hooks/index.js +3 -3
- package/esm/date/hooks/useDatepicker.d.ts +3 -8
- package/esm/date/hooks/useDatepicker.js +2 -3
- package/esm/date/hooks/useDatepicker.js.map +1 -1
- package/esm/date/hooks/useMonthPicker.d.ts +3 -8
- package/esm/date/hooks/useMonthPicker.js +1 -1
- package/esm/date/hooks/useMonthPicker.js.map +1 -1
- package/esm/date/hooks/useRangeDatepicker.d.ts +3 -3
- package/esm/date/hooks/useRangeDatepicker.js +2 -4
- package/esm/date/hooks/useRangeDatepicker.js.map +1 -1
- package/esm/date/index.d.ts +7 -7
- package/esm/date/index.js +3 -3
- package/esm/date/monthpicker/MonthButton.js +3 -7
- package/esm/date/monthpicker/MonthButton.js.map +1 -1
- package/esm/date/monthpicker/MonthCaption.js +5 -8
- package/esm/date/monthpicker/MonthCaption.js.map +1 -1
- package/esm/date/monthpicker/MonthPicker.d.ts +3 -3
- package/esm/date/monthpicker/MonthPicker.js +17 -11
- package/esm/date/monthpicker/MonthPicker.js.map +1 -1
- package/esm/date/monthpicker/MonthPickerStandalone.d.ts +1 -1
- package/esm/date/monthpicker/MonthPickerStandalone.js +12 -6
- package/esm/date/monthpicker/MonthPickerStandalone.js.map +1 -1
- package/esm/date/monthpicker/MonthSelector.js +5 -8
- package/esm/date/monthpicker/MonthSelector.js.map +1 -1
- package/esm/date/monthpicker/types.d.ts +1 -1
- package/esm/date/parts/DateInput.d.ts +2 -2
- package/esm/date/parts/DateInput.js +5 -5
- package/esm/date/parts/DateWrapper.js +6 -6
- package/esm/date/utils/check-dates.js +1 -2
- package/esm/date/utils/check-dates.js.map +1 -1
- package/esm/date/utils/dates-disabled.js +1 -1
- package/esm/date/utils/dates-disabled.js.map +1 -1
- package/esm/date/utils/format-date.d.ts +1 -0
- package/esm/date/utils/format-date.js +2 -2
- package/esm/date/utils/format-date.js.map +1 -1
- package/esm/date/utils/get-dates.js +1 -5
- package/esm/date/utils/get-dates.js.map +1 -1
- package/esm/date/utils/get-initial-year.js +1 -1
- package/esm/date/utils/get-initial-year.js.map +1 -1
- package/esm/date/utils/index.d.ts +10 -10
- package/esm/date/utils/index.js +10 -10
- package/esm/date/utils/is-match.js +1 -4
- package/esm/date/utils/is-match.js.map +1 -1
- package/esm/date/utils/labels.d.ts +1 -0
- package/esm/date/utils/labels.js.map +1 -1
- package/esm/date/utils/locale.d.ts +1 -1
- package/esm/date/utils/locale.js +1 -3
- package/esm/date/utils/locale.js.map +1 -1
- package/esm/date/utils/navigation.d.ts +1 -1
- package/esm/date/utils/navigation.js +2 -2
- package/esm/date/utils/navigation.js.map +1 -1
- package/esm/date/utils/parse-date.d.ts +1 -0
- package/esm/date/utils/parse-date.js +2 -4
- package/esm/date/utils/parse-date.js.map +1 -1
- package/esm/dropdown/Dropdown.d.ts +2 -2
- package/esm/dropdown/Dropdown.js +4 -4
- package/esm/dropdown/Menu/GroupedList/GroupedItem.d.ts +1 -1
- package/esm/dropdown/Menu/GroupedList/GroupedItem.js +2 -2
- package/esm/dropdown/Menu/GroupedList/index.d.ts +3 -3
- package/esm/dropdown/Menu/GroupedList/index.js +2 -2
- package/esm/dropdown/Menu/List/Item.d.ts +1 -1
- package/esm/dropdown/Menu/List/Item.js +2 -2
- package/esm/dropdown/Menu/List/index.d.ts +2 -2
- package/esm/dropdown/Menu/List/index.js +1 -1
- package/esm/dropdown/Menu/index.d.ts +2 -2
- package/esm/dropdown/Menu/index.js +5 -5
- package/esm/dropdown/Toggle.js +2 -2
- package/esm/dropdown/index.d.ts +1 -1
- package/esm/dropdown/index.js +1 -1
- package/esm/expansion-card/ExpansionCard.d.ts +5 -5
- package/esm/expansion-card/ExpansionCard.js +5 -5
- package/esm/expansion-card/ExpansionCardContent.js +2 -2
- package/esm/expansion-card/ExpansionCardDescription.js +2 -2
- package/esm/expansion-card/ExpansionCardHeader.js +1 -1
- package/esm/expansion-card/ExpansionCardTitle.d.ts +1 -1
- package/esm/expansion-card/index.d.ts +1 -1
- package/esm/expansion-card/index.js +1 -1
- package/esm/form/ConfirmationPanel.d.ts +1 -1
- package/esm/form/ConfirmationPanel.js +4 -4
- package/esm/form/Fieldset/Fieldset.d.ts +1 -1
- package/esm/form/Fieldset/Fieldset.js +5 -5
- package/esm/form/Fieldset/index.d.ts +2 -2
- package/esm/form/Fieldset/index.js +2 -2
- package/esm/form/Fieldset/useFieldset.js +1 -1
- package/esm/form/Select.d.ts +1 -1
- package/esm/form/Select.js +4 -4
- package/esm/form/Switch.d.ts +1 -1
- package/esm/form/Switch.js +5 -5
- package/esm/form/TextField.d.ts +1 -1
- package/esm/form/TextField.js +4 -4
- package/esm/form/Textarea.d.ts +1 -1
- package/esm/form/Textarea.js +15 -15
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/TextareaCounter.d.ts +1 -1
- package/esm/form/TextareaCounter.js +2 -2
- package/esm/form/checkbox/Checkbox.d.ts +1 -1
- package/esm/form/checkbox/Checkbox.js +5 -5
- package/esm/form/checkbox/CheckboxGroup.d.ts +1 -1
- package/esm/form/checkbox/CheckboxGroup.js +1 -1
- package/esm/form/checkbox/index.d.ts +3 -3
- package/esm/form/checkbox/index.js +2 -2
- package/esm/form/checkbox/types.d.ts +1 -1
- package/esm/form/checkbox/useCheckbox.d.ts +1 -1
- package/esm/form/checkbox/useCheckbox.js +3 -3
- package/esm/form/combobox/Combobox.d.ts +1 -1
- package/esm/form/combobox/Combobox.js +12 -12
- package/esm/form/combobox/Combobox.js.map +1 -1
- package/esm/form/combobox/ComboboxProvider.d.ts +1 -1
- package/esm/form/combobox/ComboboxProvider.js +7 -6
- package/esm/form/combobox/ComboboxProvider.js.map +1 -1
- package/esm/form/combobox/ComboboxWrapper.js +1 -1
- package/esm/form/combobox/ComboboxWrapper.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js +65 -47
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filtered-options-util.d.ts +2 -1
- package/esm/form/combobox/FilteredOptions/filtered-options-util.js +3 -1
- package/esm/form/combobox/FilteredOptions/filtered-options-util.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.d.ts +2 -2
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +20 -8
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/useVirtualFocus.d.ts +2 -4
- package/esm/form/combobox/FilteredOptions/useVirtualFocus.js +52 -32
- package/esm/form/combobox/FilteredOptions/useVirtualFocus.js.map +1 -1
- package/esm/form/combobox/Input/Input.js +8 -6
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/form/combobox/Input/inputContext.d.ts +1 -1
- package/esm/form/combobox/Input/inputContext.js +2 -2
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js +3 -3
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +5 -2
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js +6 -4
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
- package/esm/form/combobox/ToggleListButton.js +1 -1
- package/esm/form/combobox/customOptionsContext.js +1 -1
- package/esm/form/combobox/index.d.ts +2 -2
- package/esm/form/combobox/index.js +1 -1
- package/esm/form/combobox/types.d.ts +15 -1
- package/esm/form/error-summary/ErrorSummary.d.ts +9 -3
- package/esm/form/error-summary/ErrorSummary.js +8 -13
- package/esm/form/error-summary/ErrorSummary.js.map +1 -1
- package/esm/form/error-summary/ErrorSummaryItem.d.ts +2 -2
- package/esm/form/error-summary/ErrorSummaryItem.js +2 -1
- package/esm/form/error-summary/ErrorSummaryItem.js.map +1 -1
- package/esm/form/error-summary/index.d.ts +2 -2
- package/esm/form/error-summary/index.js +1 -1
- package/esm/form/index.d.ts +11 -11
- package/esm/form/index.js +11 -11
- package/esm/form/radio/Radio.d.ts +1 -1
- package/esm/form/radio/Radio.js +4 -4
- package/esm/form/radio/RadioGroup.d.ts +1 -1
- package/esm/form/radio/RadioGroup.js +2 -2
- package/esm/form/radio/index.d.ts +3 -3
- package/esm/form/radio/index.js +2 -2
- package/esm/form/radio/types.d.ts +1 -1
- package/esm/form/radio/useRadio.d.ts +1 -1
- package/esm/form/radio/useRadio.js +3 -3
- package/esm/form/search/Search.d.ts +3 -2
- package/esm/form/search/Search.js +8 -8
- package/esm/form/search/Search.js.map +1 -1
- package/esm/form/search/SearchButton.d.ts +1 -1
- package/esm/form/search/SearchButton.js +3 -3
- package/esm/form/search/index.d.ts +1 -1
- package/esm/form/search/index.js +1 -1
- package/esm/form/useFormField.js +2 -2
- package/esm/guide-panel/GuidePanel.js +1 -1
- package/esm/guide-panel/Illustration.js +1 -1
- package/esm/guide-panel/index.d.ts +2 -2
- package/esm/guide-panel/index.js +2 -2
- package/esm/help-text/HelpText.d.ts +1 -1
- package/esm/help-text/HelpText.js +4 -4
- package/esm/help-text/HelpTextIcon.js +1 -1
- package/esm/help-text/index.d.ts +2 -2
- package/esm/help-text/index.js +1 -1
- package/esm/index.d.ts +40 -41
- package/esm/index.js +40 -42
- package/esm/index.js.map +1 -1
- package/esm/internal-header/InternalHeader.d.ts +5 -5
- package/esm/internal-header/InternalHeader.js +4 -4
- package/esm/internal-header/InternalHeaderButton.d.ts +1 -1
- package/esm/internal-header/InternalHeaderTitle.d.ts +1 -1
- package/esm/internal-header/InternalHeaderUser.js +1 -1
- package/esm/internal-header/InternalHeaderUserButton.d.ts +1 -1
- package/esm/internal-header/InternalHeaderUserButton.js +2 -2
- package/esm/internal-header/index.d.ts +5 -5
- package/esm/internal-header/index.js +1 -1
- package/esm/layout/bleed/Bleed.d.ts +3 -3
- package/esm/layout/bleed/Bleed.js +2 -2
- package/esm/layout/bleed/index.d.ts +1 -1
- package/esm/layout/bleed/index.js +1 -1
- package/esm/layout/box/Box.d.ts +2 -2
- package/esm/layout/box/Box.js +1 -1
- package/esm/layout/box/index.d.ts +1 -1
- package/esm/layout/box/index.js +1 -1
- package/esm/layout/grid/HGrid.d.ts +1 -1
- package/esm/layout/grid/HGrid.js +1 -1
- package/esm/layout/grid/index.d.ts +1 -1
- package/esm/layout/grid/index.js +1 -1
- package/esm/layout/page/Page.d.ts +2 -2
- package/esm/layout/page/Page.js +1 -1
- package/esm/layout/page/index.d.ts +2 -2
- package/esm/layout/page/index.js +1 -1
- package/esm/layout/page/parts/PageBlock.d.ts +1 -1
- package/esm/layout/responsive/Responsive.d.ts +1 -1
- package/esm/layout/responsive/Responsive.js +1 -1
- package/esm/layout/responsive/index.d.ts +1 -1
- package/esm/layout/responsive/index.js +1 -1
- package/esm/layout/sidemal-test/AvatarPanel.js +2 -2
- package/esm/layout/sidemal-test/Content.js +9 -9
- package/esm/layout/sidemal-test/Filter.js +4 -4
- package/esm/layout/sidemal-test/Header.js +5 -5
- package/esm/layout/sidemal-test/Intro.js +4 -4
- package/esm/layout/sidemal-test/Sidebar.js +4 -4
- package/esm/layout/sidemal-test/content-box/ContentBox.d.ts +1 -1
- package/esm/layout/sidemal-test/content-box/index.d.ts +1 -1
- package/esm/layout/sidemal-test/content-box/index.js +1 -1
- package/esm/layout/stack/HStack.d.ts +2 -2
- package/esm/layout/stack/HStack.js +1 -1
- package/esm/layout/stack/Stack.d.ts +2 -2
- package/esm/layout/stack/Stack.js +1 -1
- package/esm/layout/stack/VStack.d.ts +2 -2
- package/esm/layout/stack/VStack.js +1 -1
- package/esm/layout/stack/index.d.ts +4 -4
- package/esm/layout/stack/index.js +4 -4
- package/esm/layout/utilities/css.d.ts +1 -1
- package/esm/layout/utilities/css.js +4 -0
- package/esm/layout/utilities/css.js.map +1 -1
- package/esm/layout/utilities/types.d.ts +1 -1
- package/esm/link/Link.d.ts +1 -1
- package/esm/link/index.d.ts +2 -2
- package/esm/link/index.js +1 -1
- package/esm/link-panel/LinkPanel.d.ts +3 -3
- package/esm/link-panel/LinkPanel.js +3 -3
- package/esm/link-panel/LinkPanelDescription.js +1 -1
- package/esm/link-panel/LinkPanelTitle.d.ts +1 -1
- package/esm/link-panel/index.d.ts +2 -2
- package/esm/link-panel/index.js +1 -1
- package/esm/list/List.d.ts +2 -2
- package/esm/list/List.js +4 -4
- package/esm/list/ListItem.js +2 -2
- package/esm/list/context.d.ts +1 -1
- package/esm/list/index.d.ts +2 -2
- package/esm/list/index.js +1 -1
- package/esm/loader/Loader.js +2 -2
- package/esm/loader/index.d.ts +2 -2
- package/esm/loader/index.js +1 -1
- package/esm/modal/Modal.d.ts +4 -4
- package/esm/modal/Modal.js +12 -12
- package/esm/modal/ModalHeader.js +2 -2
- package/esm/modal/ModalUtils.d.ts +1 -1
- package/esm/modal/index.d.ts +5 -5
- package/esm/modal/index.js +1 -1
- package/esm/overlays/index.d.ts +2 -0
- package/esm/overlays/index.js +2 -0
- package/esm/overlays/index.js.map +1 -0
- package/esm/overlays/portal/Portal.d.ts +11 -0
- package/esm/overlays/portal/Portal.js +27 -0
- package/esm/overlays/portal/Portal.js.map +1 -0
- package/esm/package.json +1 -1
- package/esm/pagination/Pagination.d.ts +1 -1
- package/esm/pagination/Pagination.js +2 -2
- package/esm/pagination/PaginationItem.d.ts +2 -2
- package/esm/pagination/PaginationItem.js +1 -1
- package/esm/pagination/index.d.ts +1 -1
- package/esm/pagination/index.js +1 -1
- package/esm/panel/Panel.d.ts +1 -1
- package/esm/panel/index.d.ts +2 -2
- package/esm/panel/index.js +1 -1
- package/esm/popover/Popover.d.ts +1 -1
- package/esm/popover/Popover.js +5 -5
- package/esm/popover/index.d.ts +2 -2
- package/esm/popover/index.js +1 -1
- package/esm/provider/index.d.ts +1 -1
- package/esm/provider/index.js +1 -1
- package/esm/read-more/ReadMore.js +3 -3
- package/esm/read-more/index.d.ts +2 -2
- package/esm/read-more/index.js +1 -1
- package/esm/skeleton/index.d.ts +2 -2
- package/esm/skeleton/index.js +1 -1
- package/esm/stepper/Step.d.ts +1 -1
- package/esm/stepper/Step.js +3 -3
- package/esm/stepper/Stepper.d.ts +1 -1
- package/esm/stepper/Stepper.js +2 -2
- package/esm/stepper/index.d.ts +1 -1
- package/esm/stepper/index.js +1 -1
- package/esm/table/ColumnHeader.d.ts +1 -1
- package/esm/table/ColumnHeader.js +2 -2
- package/esm/table/DataCell.js +1 -1
- package/esm/table/ExpandableRow.d.ts +1 -1
- package/esm/table/ExpandableRow.js +6 -6
- package/esm/table/Table.d.ts +8 -8
- package/esm/table/Table.js +8 -8
- package/esm/table/context.d.ts +1 -1
- package/esm/table/index.d.ts +9 -9
- package/esm/table/index.js +1 -1
- package/esm/tabs/Tab.d.ts +1 -1
- package/esm/tabs/Tab.js +2 -2
- package/esm/tabs/TabList.js +5 -5
- package/esm/tabs/TabList.js.map +1 -1
- package/esm/tabs/TabPanel.js +2 -2
- package/esm/tabs/TabPanel.js.map +1 -1
- package/esm/tabs/Tabs.d.ts +4 -4
- package/esm/tabs/Tabs.js +4 -4
- package/esm/tabs/index.d.ts +4 -4
- package/esm/tabs/index.js +1 -1
- package/esm/tag/Tag.js +1 -1
- package/esm/tag/index.d.ts +1 -1
- package/esm/tag/index.js +1 -1
- package/esm/timeline/AxisLabels.d.ts +1 -1
- package/esm/timeline/AxisLabels.js +5 -5
- package/esm/timeline/AxisLabels.js.map +1 -1
- package/esm/timeline/Pin.d.ts +1 -1
- package/esm/timeline/Pin.js +3 -3
- package/esm/timeline/Timeline.d.ts +5 -5
- package/esm/timeline/Timeline.js +9 -9
- package/esm/timeline/TimelineRow.d.ts +1 -1
- package/esm/timeline/TimelineRow.js +5 -5
- package/esm/timeline/hooks/useRowContext.d.ts +1 -1
- package/esm/timeline/hooks/useTimelineRows.d.ts +1 -1
- package/esm/timeline/hooks/useTimelineRows.js +3 -3
- package/esm/timeline/index.d.ts +6 -6
- package/esm/timeline/index.js +1 -1
- package/esm/timeline/period/ClickablePeriod.d.ts +1 -1
- package/esm/timeline/period/ClickablePeriod.js +5 -5
- package/esm/timeline/period/NonClickablePeriod.d.ts +1 -1
- package/esm/timeline/period/NonClickablePeriod.js +1 -1
- package/esm/timeline/period/index.d.ts +1 -1
- package/esm/timeline/period/index.js +4 -4
- package/esm/timeline/utils/filter.d.ts +1 -1
- package/esm/timeline/utils/index.d.ts +1 -1
- package/esm/timeline/utils/index.js +1 -1
- package/esm/timeline/utils/sort.d.ts +1 -1
- package/esm/timeline/utils/timeline.d.ts +1 -1
- package/esm/timeline/utils/timeline.js +1 -1
- package/esm/timeline/zoom/ZoomButton.js +2 -2
- package/esm/timeline/zoom/index.d.ts +1 -1
- package/esm/timeline/zoom/index.js +1 -1
- package/esm/toggle-group/ToggleGroup.d.ts +1 -1
- package/esm/toggle-group/ToggleGroup.js +4 -4
- package/esm/toggle-group/ToggleItem.js +2 -2
- package/esm/toggle-group/index.d.ts +2 -2
- package/esm/toggle-group/index.js +1 -1
- package/esm/tooltip/Tooltip.js +9 -13
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/tooltip/index.d.ts +1 -1
- package/esm/tooltip/index.js +1 -1
- package/esm/typography/BodyLong.d.ts +2 -2
- package/esm/typography/BodyLong.js +1 -1
- package/esm/typography/BodyShort.d.ts +2 -2
- package/esm/typography/BodyShort.js +1 -1
- package/esm/typography/Detail.d.ts +2 -2
- package/esm/typography/Detail.js +1 -1
- package/esm/typography/ErrorMessage.d.ts +2 -2
- package/esm/typography/ErrorMessage.js +1 -1
- package/esm/typography/Heading.d.ts +2 -2
- package/esm/typography/Heading.js +1 -1
- package/esm/typography/Ingress.d.ts +1 -1
- package/esm/typography/Label.d.ts +2 -2
- package/esm/typography/Label.js +1 -1
- package/esm/typography/index.d.ts +7 -7
- package/esm/typography/index.js +7 -7
- package/esm/typography/util.d.ts +1 -1
- package/esm/util/Slot.js +6 -3
- package/esm/util/Slot.js.map +1 -1
- package/esm/util/TextareaAutoSize.js +17 -27
- package/esm/util/TextareaAutoSize.js.map +1 -1
- package/esm/util/hooks/descendants/descendant.js +1 -1
- package/esm/util/hooks/descendants/useDescendant.d.ts +1 -1
- package/esm/util/hooks/descendants/useDescendant.js +5 -5
- package/esm/util/hooks/index.d.ts +8 -8
- package/esm/util/hooks/index.js +8 -8
- package/esm/util/hooks/useControllableState.js +1 -1
- package/esm/util/index.d.ts +6 -6
- package/esm/util/index.js +5 -5
- package/esm/util/types/AsChildProps.d.ts +36 -0
- package/esm/util/types/AsChildProps.js +2 -0
- package/esm/util/types/AsChildProps.js.map +1 -0
- package/esm/util/types/index.d.ts +2 -1
- package/package.json +13 -12
- package/src/alert/alert.stories.tsx +202 -113
- package/src/chat/Bubble.tsx +2 -23
- package/src/chat/Chat.tsx +1 -18
- package/src/chat/chat.stories.tsx +0 -31
- package/src/date/context/useSharedMonthContext.tsx +1 -2
- package/src/date/datepicker/DatePicker.tsx +1 -3
- package/src/date/datepicker/DatePickerStandalone.tsx +1 -3
- package/src/date/datepicker/datepicker.stories.tsx +5 -5
- package/src/date/datepicker/parts/DayButton.tsx +1 -1
- package/src/date/datepicker/parts/DropdownCaption.tsx +1 -4
- package/src/date/datepicker/parts/Row.tsx +3 -2
- package/src/date/hooks/useDatepicker.tsx +2 -8
- package/src/date/hooks/useMonthPicker.tsx +1 -6
- package/src/date/hooks/useRangeDatepicker.tsx +5 -3
- package/src/date/monthpicker/MonthButton.tsx +7 -5
- package/src/date/monthpicker/MonthCaption.tsx +7 -4
- package/src/date/monthpicker/MonthPicker.tsx +10 -8
- package/src/date/monthpicker/MonthPickerStandalone.tsx +10 -8
- package/src/date/monthpicker/MonthSelector.tsx +1 -4
- package/src/date/monthpicker/monthpicker.stories.tsx +3 -2
- package/src/date/parts/DateInput.tsx +1 -1
- package/src/date/utils/__tests__/format-dates.test.ts +1 -1
- package/src/date/utils/__tests__/get-initial-year.test.ts +1 -1
- package/src/date/utils/__tests__/parse-dates.test.ts +2 -2
- package/src/date/utils/check-dates.ts +1 -2
- package/src/date/utils/dates-disabled.ts +1 -1
- package/src/date/utils/format-date.ts +1 -1
- package/src/date/utils/get-dates.ts +7 -5
- package/src/date/utils/get-initial-year.ts +1 -1
- package/src/date/utils/is-match.ts +6 -4
- package/src/date/utils/labels.ts +1 -0
- package/src/date/utils/locale.ts +1 -3
- package/src/date/utils/navigation.ts +1 -1
- package/src/date/utils/parse-date.ts +1 -3
- package/src/form/Textarea.tsx +34 -34
- package/src/form/combobox/Combobox.tsx +1 -1
- package/src/form/combobox/ComboboxProvider.tsx +2 -0
- package/src/form/combobox/ComboboxWrapper.tsx +0 -1
- package/src/form/combobox/FilteredOptions/FilteredOptions.tsx +131 -92
- package/src/form/combobox/FilteredOptions/filtered-options-util.ts +9 -2
- package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +22 -3
- package/src/form/combobox/FilteredOptions/useVirtualFocus.ts +63 -45
- package/src/form/combobox/Input/Input.tsx +3 -1
- package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +11 -1
- package/src/form/combobox/combobox.stories.tsx +36 -1
- package/src/form/combobox/combobox.test.tsx +1 -3
- package/src/form/combobox/types.ts +15 -0
- package/src/form/error-summary/ErrorSummary.tsx +15 -11
- package/src/form/error-summary/ErrorSummaryItem.tsx +10 -8
- package/src/form/error-summary/error-summary.stories.tsx +55 -1
- package/src/form/search/Search.tsx +6 -1
- package/src/form/stories/textarea.stories.tsx +37 -0
- package/src/index.ts +1 -2
- package/src/layout/bleed/Bleed.stories.tsx +13 -0
- package/src/layout/bleed/Bleed.tsx +2 -2
- package/src/layout/box/Box.stories.tsx +1 -1
- package/src/layout/sidemal-test/navno-sidemal.stories.tsx +1 -0
- package/src/layout/utilities/css.ts +3 -0
- package/src/layout/utilities/types.ts +1 -1
- package/src/overlays/index.ts +2 -0
- package/src/overlays/portal/Portal.stories.tsx +99 -0
- package/src/overlays/portal/Portal.tsx +32 -0
- package/src/tabs/TabList.tsx +2 -2
- package/src/tabs/TabPanel.tsx +2 -2
- package/src/timeline/AxisLabels.tsx +1 -1
- package/src/tooltip/Tooltip.tsx +4 -8
- package/src/util/Slot.tsx +4 -2
- package/src/util/TextareaAutoSize.tsx +16 -31
- package/src/util/types/AsChildProps.ts +37 -0
- package/src/util/types/index.ts +1 -0
- package/cjs/grid/Cell.d.ts +0 -30
- package/cjs/grid/Cell.js +0 -52
- package/cjs/grid/Cell.js.map +0 -1
- package/cjs/grid/Grid.d.ts +0 -13
- package/cjs/grid/Grid.js.map +0 -1
- package/cjs/grid/index.d.ts +0 -2
- package/cjs/grid/index.js +0 -11
- package/cjs/grid/index.js.map +0 -1
- package/cjs/layout/content-container/ContentContainer.d.ts +0 -9
- package/cjs/layout/content-container/ContentContainer.js +0 -48
- package/cjs/layout/content-container/ContentContainer.js.map +0 -1
- package/cjs/layout/content-container/index.d.ts +0 -1
- package/cjs/layout/content-container/index.js +0 -9
- package/cjs/layout/content-container/index.js.map +0 -1
- package/esm/grid/Cell.d.ts +0 -30
- package/esm/grid/Cell.js +0 -23
- package/esm/grid/Cell.js.map +0 -1
- package/esm/grid/Grid.d.ts +0 -13
- package/esm/grid/Grid.js +0 -23
- package/esm/grid/Grid.js.map +0 -1
- package/esm/grid/index.d.ts +0 -2
- package/esm/grid/index.js +0 -3
- package/esm/grid/index.js.map +0 -1
- package/esm/layout/content-container/ContentContainer.d.ts +0 -9
- package/esm/layout/content-container/ContentContainer.js +0 -19
- package/esm/layout/content-container/ContentContainer.js.map +0 -1
- package/esm/layout/content-container/index.d.ts +0 -1
- package/esm/layout/content-container/index.js +0 -2
- package/esm/layout/content-container/index.js.map +0 -1
- package/src/grid/Cell.tsx +0 -53
- package/src/grid/Grid.tsx +0 -23
- package/src/grid/grid.stories.tsx +0 -67
- package/src/grid/index.ts +0 -2
- package/src/layout/content-container/ContentContainer.tsx +0 -22
- package/src/layout/content-container/index.ts +0 -4
- package/src/layout/sidemal-test/navno-sidemal.stories.mdx +0 -29
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
|
-
import React, { HTMLAttributes, forwardRef
|
|
2
|
+
import React, { HTMLAttributes, forwardRef } from "react";
|
|
3
3
|
import { BodyShort, Heading } from "../../typography";
|
|
4
4
|
import { useId } from "../../util/hooks";
|
|
5
|
-
import ErrorSummaryItem
|
|
5
|
+
import ErrorSummaryItem from "./ErrorSummaryItem";
|
|
6
6
|
|
|
7
7
|
export interface ErrorSummaryProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
8
|
/**
|
|
@@ -17,12 +17,18 @@ export interface ErrorSummaryProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
17
17
|
/**
|
|
18
18
|
* Heading above links
|
|
19
19
|
*/
|
|
20
|
-
heading
|
|
20
|
+
heading: React.ReactNode;
|
|
21
21
|
/**
|
|
22
22
|
* Allows setting a different HTML h-tag
|
|
23
23
|
* @default "h2"
|
|
24
24
|
*/
|
|
25
25
|
headingTag?: React.ElementType<any>;
|
|
26
|
+
/**
|
|
27
|
+
* When manually setting focus to `<ErrorSummary />` use the
|
|
28
|
+
* `focusTargetRef`-prop and not ref.
|
|
29
|
+
* This directs focus to heading, improving screen reader experience
|
|
30
|
+
*/
|
|
31
|
+
focusTargetRef?: React.RefObject<HTMLElement>;
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
interface ErrorSummaryComponent
|
|
@@ -41,7 +47,7 @@ interface ErrorSummaryComponent
|
|
|
41
47
|
* </ErrorSummary.Item>
|
|
42
48
|
* ```
|
|
43
49
|
*/
|
|
44
|
-
Item:
|
|
50
|
+
Item: typeof ErrorSummaryItem;
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
/**
|
|
@@ -70,6 +76,7 @@ export const ErrorSummary = forwardRef<HTMLDivElement, ErrorSummaryProps>(
|
|
|
70
76
|
size = "medium",
|
|
71
77
|
headingTag = "h2",
|
|
72
78
|
heading,
|
|
79
|
+
focusTargetRef,
|
|
73
80
|
...rest
|
|
74
81
|
},
|
|
75
82
|
ref,
|
|
@@ -85,7 +92,7 @@ export const ErrorSummary = forwardRef<HTMLDivElement, ErrorSummaryProps>(
|
|
|
85
92
|
"navds-error-summary",
|
|
86
93
|
`navds-error-summary--${size}`,
|
|
87
94
|
)}
|
|
88
|
-
tabIndex={-1}
|
|
95
|
+
tabIndex={ref ? -1 : undefined}
|
|
89
96
|
aria-live="polite"
|
|
90
97
|
aria-relevant="all"
|
|
91
98
|
aria-labelledby={headingId}
|
|
@@ -95,16 +102,13 @@ export const ErrorSummary = forwardRef<HTMLDivElement, ErrorSummaryProps>(
|
|
|
95
102
|
as={headingTag}
|
|
96
103
|
size="small"
|
|
97
104
|
id={headingId}
|
|
105
|
+
ref={focusTargetRef}
|
|
106
|
+
tabIndex={focusTargetRef ? -1 : undefined}
|
|
98
107
|
>
|
|
99
108
|
{heading}
|
|
100
109
|
</Heading>
|
|
101
110
|
<BodyShort as="ul" size={size} className="navds-error-summary__list">
|
|
102
|
-
{
|
|
103
|
-
if (!isValidElement(child)) {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
return <li key={child.toString()}>{child}</li>;
|
|
107
|
-
})}
|
|
111
|
+
{children}
|
|
108
112
|
</BodyShort>
|
|
109
113
|
</section>
|
|
110
114
|
);
|
|
@@ -14,7 +14,7 @@ export interface ErrorSummaryItemProps
|
|
|
14
14
|
href?: string;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
type ErrorSummaryItemType = OverridableComponent<
|
|
18
18
|
ErrorSummaryItemProps,
|
|
19
19
|
HTMLAnchorElement
|
|
20
20
|
>;
|
|
@@ -22,13 +22,15 @@ export type ErrorSummaryItemType = OverridableComponent<
|
|
|
22
22
|
export const ErrorSummaryItem: ErrorSummaryItemType = forwardRef(
|
|
23
23
|
({ children, as: Component = "a", className, ...rest }, ref) => {
|
|
24
24
|
return (
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
<li>
|
|
26
|
+
<Component
|
|
27
|
+
{...rest}
|
|
28
|
+
ref={ref}
|
|
29
|
+
className={cl(className, "navds-error-summary__item", "navds-link")}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
32
|
+
</Component>
|
|
33
|
+
</li>
|
|
32
34
|
);
|
|
33
35
|
},
|
|
34
36
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Meta } from "@storybook/react";
|
|
2
|
-
import
|
|
2
|
+
import { expect, userEvent, within } from "@storybook/test";
|
|
3
|
+
import React, { useRef } from "react";
|
|
3
4
|
import { ErrorSummary } from "..";
|
|
4
5
|
|
|
5
6
|
export default {
|
|
@@ -43,3 +44,56 @@ export const Small = () => (
|
|
|
43
44
|
</ErrorSummary.Item>
|
|
44
45
|
</ErrorSummary>
|
|
45
46
|
);
|
|
47
|
+
|
|
48
|
+
export const A11yDemo = {
|
|
49
|
+
render: () => {
|
|
50
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
51
|
+
const ref = useRef<HTMLHeadingElement>(null);
|
|
52
|
+
return (
|
|
53
|
+
<div>
|
|
54
|
+
<button onClick={() => ref.current?.focus()}>
|
|
55
|
+
Fokuser Errorsummary på klikk
|
|
56
|
+
</button>
|
|
57
|
+
<ErrorSummary heading="Feiloppsummering tittel" focusTargetRef={ref}>
|
|
58
|
+
<ErrorSummary.Item href="#1">Checkbox må fylles ut</ErrorSummary.Item>
|
|
59
|
+
<ErrorSummary.Item href="#2">
|
|
60
|
+
Tekstfeltet må ha en godkjent e-mail
|
|
61
|
+
</ErrorSummary.Item>
|
|
62
|
+
</ErrorSummary>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const FocusDemo = {
|
|
69
|
+
render: () => {
|
|
70
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
71
|
+
const ref = useRef<HTMLHeadingElement>(null);
|
|
72
|
+
return (
|
|
73
|
+
<div>
|
|
74
|
+
<button onClick={() => ref.current?.focus()}>Focus summary</button>
|
|
75
|
+
<ErrorSummary heading="Feiloppsummering tittel" focusTargetRef={ref}>
|
|
76
|
+
<ErrorSummary.Item href="#1">Checkbox må fylles ut</ErrorSummary.Item>
|
|
77
|
+
<ErrorSummary.Item href="#2">
|
|
78
|
+
Tekstfeltet må ha en godkjent e-mail
|
|
79
|
+
</ErrorSummary.Item>
|
|
80
|
+
</ErrorSummary>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
play: async ({ canvasElement, step }) => {
|
|
85
|
+
const canvas = within(canvasElement);
|
|
86
|
+
|
|
87
|
+
const button = canvas.getByText("Focus summary");
|
|
88
|
+
const heading = canvas.getByText("Feiloppsummering tittel");
|
|
89
|
+
|
|
90
|
+
await step("click button", async () => {
|
|
91
|
+
await userEvent.click(button);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
expect(heading).toHaveFocus();
|
|
95
|
+
},
|
|
96
|
+
parameters: {
|
|
97
|
+
chromatic: { disableSnapshot: true },
|
|
98
|
+
},
|
|
99
|
+
};
|
|
@@ -66,6 +66,10 @@ export interface SearchProps
|
|
|
66
66
|
* Exposes the HTML size attribute
|
|
67
67
|
*/
|
|
68
68
|
htmlSize?: number | string;
|
|
69
|
+
/*
|
|
70
|
+
* Exposes role attribute
|
|
71
|
+
*/
|
|
72
|
+
role?: string
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
interface SearchComponent
|
|
@@ -114,6 +118,7 @@ export const Search = forwardRef<HTMLInputElement, SearchProps>(
|
|
|
114
118
|
onChange,
|
|
115
119
|
onSearchClick,
|
|
116
120
|
htmlSize,
|
|
121
|
+
role,
|
|
117
122
|
...rest
|
|
118
123
|
} = props;
|
|
119
124
|
|
|
@@ -205,7 +210,7 @@ export const Search = forwardRef<HTMLInputElement, SearchProps>(
|
|
|
205
210
|
value={value ?? internalValue}
|
|
206
211
|
onChange={(e) => handleChange(e.target.value)}
|
|
207
212
|
type="search"
|
|
208
|
-
role=
|
|
213
|
+
role={role ?? 'searchbox'}
|
|
209
214
|
className={cl(
|
|
210
215
|
className,
|
|
211
216
|
"navds-search__input",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Meta, StoryFn, StoryObj } from "@storybook/react";
|
|
2
|
+
import { expect, userEvent, within } from "@storybook/test";
|
|
2
3
|
import React, { useState } from "react";
|
|
3
4
|
import { Button } from "../../button";
|
|
5
|
+
import { Modal } from "../../modal";
|
|
4
6
|
import { Textarea } from "../index";
|
|
5
7
|
|
|
6
8
|
const meta: Meta<typeof Textarea> = {
|
|
@@ -124,6 +126,24 @@ export const Resize: StoryFn = () => {
|
|
|
124
126
|
return <Textarea resize label="Ipsum enim quis culpa" />;
|
|
125
127
|
};
|
|
126
128
|
|
|
129
|
+
export const OnChange: StoryFn = () => {
|
|
130
|
+
return (
|
|
131
|
+
<Textarea
|
|
132
|
+
label="Ipsum enim quis culpa"
|
|
133
|
+
onChange={console.log}
|
|
134
|
+
maxLength={50}
|
|
135
|
+
/>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
OnChange.play = async ({ canvasElement }) => {
|
|
139
|
+
const canvas = within(canvasElement);
|
|
140
|
+
const input = canvas.getByLabelText("Ipsum enim quis culpa");
|
|
141
|
+
userEvent.click(input);
|
|
142
|
+
await userEvent.type(input, "Aute fugiat ut culpa");
|
|
143
|
+
const text = canvas.getByText("30 tegn igjen");
|
|
144
|
+
expect(text).toBeVisible();
|
|
145
|
+
};
|
|
146
|
+
|
|
127
147
|
export const Controlled: StoryFn = () => {
|
|
128
148
|
const [value, setValue] = useState("");
|
|
129
149
|
return (
|
|
@@ -186,3 +206,20 @@ AutoScrollbar.argTypes = {
|
|
|
186
206
|
maxRows: { type: "number" },
|
|
187
207
|
minRows: { type: "number" },
|
|
188
208
|
};
|
|
209
|
+
|
|
210
|
+
export const ModalStrictMode: StoryFn<typeof Textarea> = () => {
|
|
211
|
+
// Story added after fixing an issue where TextareaAutoSize would reach max re-renders
|
|
212
|
+
// and set the height to 2px when used in StrictMode in a Modal that is initially open.
|
|
213
|
+
return (
|
|
214
|
+
<React.StrictMode>
|
|
215
|
+
<Modal open>
|
|
216
|
+
<Modal.Body>
|
|
217
|
+
<Textarea label="Har du noen tilbakemeldinger?" />
|
|
218
|
+
</Modal.Body>
|
|
219
|
+
</Modal>
|
|
220
|
+
</React.StrictMode>
|
|
221
|
+
);
|
|
222
|
+
};
|
|
223
|
+
ModalStrictMode.parameters = {
|
|
224
|
+
chromatic: { disable: true }, // Not reproducable in Chromatic
|
|
225
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -8,8 +8,8 @@ export * from "./date";
|
|
|
8
8
|
export * from "./dropdown";
|
|
9
9
|
export * from "./expansion-card";
|
|
10
10
|
export * from "./form";
|
|
11
|
-
export * from "./grid";
|
|
12
11
|
export * from "./guide-panel";
|
|
12
|
+
export * from "./overlays";
|
|
13
13
|
export * from "./help-text";
|
|
14
14
|
export * from "./internal-header";
|
|
15
15
|
export * from "./link";
|
|
@@ -36,6 +36,5 @@ export * from "./layout/bleed";
|
|
|
36
36
|
export * from "./layout/box";
|
|
37
37
|
export * from "./layout/stack";
|
|
38
38
|
export * from "./layout/grid";
|
|
39
|
-
export * from "./layout/content-container";
|
|
40
39
|
export * from "./layout/responsive";
|
|
41
40
|
export * from "./layout/page";
|
|
@@ -272,6 +272,19 @@ export const Full = {
|
|
|
272
272
|
</Bleed>
|
|
273
273
|
</Box>
|
|
274
274
|
</Box>
|
|
275
|
+
<Box
|
|
276
|
+
className="maxWidth"
|
|
277
|
+
background="surface-alt-1-subtle"
|
|
278
|
+
padding="10"
|
|
279
|
+
>
|
|
280
|
+
<Box background="surface-alt-2-subtle" padding="10">
|
|
281
|
+
<Bleed marginInline="full" reflectivePadding asChild>
|
|
282
|
+
<Box background="surface-success-subtle">
|
|
283
|
+
<BodyLong>full + reflectivePadding</BodyLong>
|
|
284
|
+
</Box>
|
|
285
|
+
</Bleed>
|
|
286
|
+
</Box>
|
|
287
|
+
</Box>
|
|
275
288
|
</VStack>
|
|
276
289
|
</>
|
|
277
290
|
),
|
|
@@ -13,7 +13,7 @@ export interface BleedProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
13
13
|
* @example
|
|
14
14
|
* marginInline='4'
|
|
15
15
|
* marginInline='4 5'
|
|
16
|
-
* marginInline={{xs: '0 32', sm: '3', md: '4 5', lg: '5', xl: '6'}}
|
|
16
|
+
* marginInline={{xs: '0 32', sm: '3', md: '4 5', lg: '5', xl: '6', "2xl": '12'}}
|
|
17
17
|
*/
|
|
18
18
|
marginInline?: ResponsiveProp<
|
|
19
19
|
BleedSpacingInline | `${BleedSpacingInline} ${BleedSpacingInline}`
|
|
@@ -23,7 +23,7 @@ export interface BleedProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
23
23
|
* @example
|
|
24
24
|
* marginBlock='4'
|
|
25
25
|
* marginBlock='4 5'
|
|
26
|
-
* marginBlock={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
26
|
+
* marginBlock={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6', "2xl": '12'}}
|
|
27
27
|
*/
|
|
28
28
|
marginBlock?: ResponsiveProp<
|
|
29
29
|
BleedSpacingBlock | `${BleedSpacingBlock} ${BleedSpacingBlock}`
|
|
@@ -196,7 +196,7 @@ export const PaddingBreakpoints = {
|
|
|
196
196
|
render: () => (
|
|
197
197
|
<div>
|
|
198
198
|
<Box
|
|
199
|
-
padding={{ xs: "2", sm: "3", md: "4", lg: "5", xl: "6" }}
|
|
199
|
+
padding={{ xs: "2", sm: "3", md: "4", lg: "5", xl: "6", "2xl": "8" }}
|
|
200
200
|
background="surface-neutral"
|
|
201
201
|
>
|
|
202
202
|
<Box background="surface-alt-3-subtle">
|
|
@@ -44,6 +44,9 @@ const translateTokenStringToCSS = (
|
|
|
44
44
|
if (componentProp === "margin-inline" && x === "full") {
|
|
45
45
|
const width = 100 / arr.length;
|
|
46
46
|
return `calc((100vw - ${width}%)/-2)`;
|
|
47
|
+
} else if (componentProp === "padding-inline" && x === "full") {
|
|
48
|
+
const width = 100 / arr.length;
|
|
49
|
+
return `calc((100vw - ${width}%)/2)`;
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
let output = `var(--a-${tokenSubgroup}-${x})`;
|
|
@@ -14,7 +14,7 @@ export type BorderRadiiToken =
|
|
|
14
14
|
| "0";
|
|
15
15
|
export type ShadowToken = keyof typeof shadows.a.shadow;
|
|
16
16
|
|
|
17
|
-
export type BreakpointsAlias = "xs" | "sm" | "md" | "lg" | "xl";
|
|
17
|
+
export type BreakpointsAlias = "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
18
18
|
|
|
19
19
|
export type SpacingScale = keyof (typeof Spacing)["a"]["spacing"];
|
|
20
20
|
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box } from "../../layout/box";
|
|
3
|
+
import { Provider } from "../../provider";
|
|
4
|
+
import { Portal } from "./Portal";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Utilities/Portal",
|
|
8
|
+
parameters: {
|
|
9
|
+
chromatic: { disable: true },
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const Default = () => {
|
|
14
|
+
return (
|
|
15
|
+
<Box background="surface-neutral-subtle" border>
|
|
16
|
+
<h1>In regular DOM tree</h1>
|
|
17
|
+
<p>
|
|
18
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Temporibus
|
|
19
|
+
necessitatibus quis esse nesciunt est velit voluptatibus. Distinctio eum
|
|
20
|
+
commodi tempora unde. Nulla vel tempora incidunt? Voluptatem molestias
|
|
21
|
+
impedit commodi. Tenetur!
|
|
22
|
+
</p>
|
|
23
|
+
<Portal>
|
|
24
|
+
<h1>Inside Portal to different DOM tree</h1>
|
|
25
|
+
<p>
|
|
26
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Temporibus
|
|
27
|
+
necessitatibus quis esse nesciunt est velit voluptatibus. Distinctio
|
|
28
|
+
eum commodi tempora unde. Nulla vel tempora incidunt? Voluptatem
|
|
29
|
+
molestias impedit commodi. Tenetur!
|
|
30
|
+
</p>
|
|
31
|
+
</Portal>
|
|
32
|
+
</Box>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const CustomPortalRoot = () => {
|
|
37
|
+
const [portalContainer, setPortalContainer] =
|
|
38
|
+
React.useState<HTMLDivElement | null>(null);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Box background="surface-neutral-subtle">
|
|
42
|
+
<Box background="surface-alt-1-subtle">
|
|
43
|
+
<h1>Tree A</h1>
|
|
44
|
+
<Portal rootElement={portalContainer}>
|
|
45
|
+
<p>This is mounted to Tree B, while created inside Tree A</p>
|
|
46
|
+
</Portal>
|
|
47
|
+
</Box>
|
|
48
|
+
<Box background="surface-alt-3-subtle" ref={setPortalContainer}>
|
|
49
|
+
<h1>Tree B</h1>
|
|
50
|
+
</Box>
|
|
51
|
+
</Box>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const CustomPortalRootFromProvider = () => {
|
|
56
|
+
const [portalContainer, setPortalContainer] =
|
|
57
|
+
React.useState<HTMLDivElement>();
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Provider rootElement={portalContainer}>
|
|
61
|
+
<Box background="surface-neutral-subtle">
|
|
62
|
+
<Box background="surface-alt-1-subtle">
|
|
63
|
+
<h1>Tree A</h1>
|
|
64
|
+
<Portal>
|
|
65
|
+
<p>This is mounted to Tree B, while created inside Tree A</p>
|
|
66
|
+
</Portal>
|
|
67
|
+
</Box>
|
|
68
|
+
<Box background="surface-alt-3-subtle" ref={setPortalContainer}>
|
|
69
|
+
<h1>Tree B</h1>
|
|
70
|
+
</Box>
|
|
71
|
+
</Box>
|
|
72
|
+
</Provider>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const AsChild = () => {
|
|
77
|
+
return (
|
|
78
|
+
<Box background="surface-neutral-subtle" border>
|
|
79
|
+
<h1>In regular DOM tree</h1>
|
|
80
|
+
<p>
|
|
81
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Temporibus
|
|
82
|
+
necessitatibus quis esse nesciunt est velit voluptatibus. Distinctio eum
|
|
83
|
+
commodi tempora unde. Nulla vel tempora incidunt? Voluptatem molestias
|
|
84
|
+
impedit commodi. Tenetur!
|
|
85
|
+
</p>
|
|
86
|
+
<Portal asChild>
|
|
87
|
+
<div data-this-is-the-child>
|
|
88
|
+
<h1>Inside Portal to different DOM tree</h1>
|
|
89
|
+
<p>
|
|
90
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Temporibus
|
|
91
|
+
necessitatibus quis esse nesciunt est velit voluptatibus. Distinctio
|
|
92
|
+
eum commodi tempora unde. Nulla vel tempora incidunt? Voluptatem
|
|
93
|
+
molestias impedit commodi. Tenetur!
|
|
94
|
+
</p>
|
|
95
|
+
</div>
|
|
96
|
+
</Portal>
|
|
97
|
+
</Box>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { HTMLAttributes, forwardRef } from "react";
|
|
2
|
+
import ReactDOM from "react-dom";
|
|
3
|
+
import { useProvider } from "../../provider";
|
|
4
|
+
import { Slot } from "../../util/Slot";
|
|
5
|
+
import { AsChildProps } from "../../util/types";
|
|
6
|
+
|
|
7
|
+
interface PortalBaseProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/**
|
|
9
|
+
* An optional container where the portaled content should be appended.
|
|
10
|
+
*/
|
|
11
|
+
rootElement?: HTMLElement | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type PortalProps = PortalBaseProps & AsChildProps;
|
|
15
|
+
|
|
16
|
+
export const Portal = forwardRef<HTMLDivElement, PortalProps>(
|
|
17
|
+
({ rootElement, asChild, ...rest }, ref) => {
|
|
18
|
+
const contextRoot = useProvider()?.rootElement;
|
|
19
|
+
const root = rootElement ?? contextRoot ?? globalThis?.document?.body;
|
|
20
|
+
|
|
21
|
+
const Component = asChild ? Slot : "div";
|
|
22
|
+
|
|
23
|
+
return root
|
|
24
|
+
? ReactDOM.createPortal(
|
|
25
|
+
<Component ref={ref} data-aksel-portal="" {...rest} />,
|
|
26
|
+
root,
|
|
27
|
+
)
|
|
28
|
+
: null;
|
|
29
|
+
},
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export default Portal;
|
package/src/tabs/TabList.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as RadixTabs from "@radix-ui/react-tabs";
|
|
2
2
|
import cl from "clsx";
|
|
3
3
|
import React, {
|
|
4
4
|
forwardRef,
|
|
@@ -112,7 +112,7 @@ export const TabList = forwardRef<HTMLDivElement, TabListProps>(
|
|
|
112
112
|
{showSteppers && (
|
|
113
113
|
<ScrollButton dir={-1} hidden={!displayScroll.start} />
|
|
114
114
|
)}
|
|
115
|
-
<TabsList
|
|
115
|
+
<RadixTabs.TabsList
|
|
116
116
|
{...rest}
|
|
117
117
|
ref={mergedRef}
|
|
118
118
|
onScroll={updateScrollButtonState}
|
package/src/tabs/TabPanel.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as RadixTabs from "@radix-ui/react-tabs";
|
|
2
2
|
import cl from "clsx";
|
|
3
3
|
import React, { forwardRef } from "react";
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ export interface TabPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
15
15
|
|
|
16
16
|
const TabPanel = forwardRef<HTMLDivElement, TabPanelProps>(
|
|
17
17
|
({ className, ...rest }, ref) => (
|
|
18
|
-
<TabsContent
|
|
18
|
+
<RadixTabs.TabsContent
|
|
19
19
|
{...rest}
|
|
20
20
|
ref={ref}
|
|
21
21
|
className={cl("navds-tabs__tabpanel", className)}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
startOfYear,
|
|
14
14
|
subDays,
|
|
15
15
|
} from "date-fns";
|
|
16
|
-
import nbLocale from "date-fns/locale
|
|
16
|
+
import { nb as nbLocale } from "date-fns/locale";
|
|
17
17
|
import React from "react";
|
|
18
18
|
import { Detail } from "../typography/Detail";
|
|
19
19
|
import { useTimelineContext } from "./hooks/useTimelineContext";
|
package/src/tooltip/Tooltip.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
FloatingPortal,
|
|
3
2
|
autoUpdate,
|
|
4
3
|
arrow as flArrow,
|
|
5
4
|
flip,
|
|
@@ -21,7 +20,7 @@ import React, {
|
|
|
21
20
|
useRef,
|
|
22
21
|
} from "react";
|
|
23
22
|
import { ModalContext } from "../modal/ModalContext";
|
|
24
|
-
import
|
|
23
|
+
import Portal from "../overlays/portal/Portal";
|
|
25
24
|
import { Detail } from "../typography";
|
|
26
25
|
import { useId } from "../util/hooks";
|
|
27
26
|
import { useControllableState } from "../util/hooks/useControllableState";
|
|
@@ -123,10 +122,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
123
122
|
|
|
124
123
|
const arrowRef = useRef<HTMLDivElement | null>(null);
|
|
125
124
|
const modalContext = useContext(ModalContext);
|
|
126
|
-
const
|
|
127
|
-
const rootElement = modalContext
|
|
128
|
-
? modalContext.ref.current
|
|
129
|
-
: providerRootElement;
|
|
125
|
+
const rootElement = modalContext ? modalContext.ref.current : undefined;
|
|
130
126
|
|
|
131
127
|
const {
|
|
132
128
|
x,
|
|
@@ -199,7 +195,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
199
195
|
: children?.props["aria-describedby"],
|
|
200
196
|
}),
|
|
201
197
|
)}
|
|
202
|
-
<
|
|
198
|
+
<Portal rootElement={rootElement}>
|
|
203
199
|
{_open && (
|
|
204
200
|
<div
|
|
205
201
|
{...getFloatingProps({
|
|
@@ -253,7 +249,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
253
249
|
)}
|
|
254
250
|
</div>
|
|
255
251
|
)}
|
|
256
|
-
</
|
|
252
|
+
</Portal>
|
|
257
253
|
</>
|
|
258
254
|
);
|
|
259
255
|
},
|
package/src/util/Slot.tsx
CHANGED
|
@@ -20,10 +20,12 @@ export const Slot = React.forwardRef<HTMLElement, SlotProps>(
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
if (React.Children.count(children) > 1) {
|
|
23
|
-
|
|
23
|
+
const error = new Error(
|
|
24
24
|
"Aksel: Components using 'asChild' expects to recieve a single React element child.",
|
|
25
25
|
);
|
|
26
|
-
|
|
26
|
+
error.name = "SlotError";
|
|
27
|
+
Error.captureStackTrace?.(error, Slot);
|
|
28
|
+
throw error;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
return null;
|