@navikt/ds-react 6.0.0-alpha.2 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/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/parts/DateWrapper.js +2 -2
- package/cjs/date/parts/DateWrapper.js.map +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/search/Search.d.ts +2 -1
- 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 +2 -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/modal/Modal.context.d.ts +9 -0
- package/cjs/modal/Modal.context.js +10 -0
- package/cjs/modal/Modal.context.js.map +1 -0
- package/cjs/modal/Modal.js +3 -6
- package/cjs/modal/Modal.js.map +1 -1
- package/cjs/modal/ModalHeader.js +2 -6
- package/cjs/modal/ModalHeader.js.map +1 -1
- package/cjs/modal/types.d.ts +24 -3
- 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/panel/Panel.d.ts +9 -16
- package/cjs/panel/Panel.js +6 -16
- package/cjs/panel/Panel.js.map +1 -1
- package/cjs/popover/Popover.js +2 -2
- package/cjs/popover/Popover.js.map +1 -1
- package/cjs/table/types.d.ts +1 -1
- 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 +5 -9
- 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/create-context.d.ts +2 -5
- package/cjs/util/create-context.js +9 -5
- package/cjs/util/create-context.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/OverridableComponent.d.ts +1 -1
- 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 +8 -8
- package/esm/date/parts/DateWrapper.js.map +1 -1
- 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 +1 -1
- package/esm/form/error-summary/ErrorSummary.js +3 -3
- package/esm/form/error-summary/ErrorSummaryItem.d.ts +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 +4 -3
- 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 -41
- 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.context.d.ts +9 -0
- package/esm/modal/Modal.context.js +6 -0
- package/esm/modal/Modal.context.js.map +1 -0
- package/esm/modal/Modal.d.ts +4 -4
- package/esm/modal/Modal.js +14 -17
- package/esm/modal/Modal.js.map +1 -1
- package/esm/modal/ModalHeader.js +4 -8
- package/esm/modal/ModalHeader.js.map +1 -1
- 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/modal/types.d.ts +24 -3
- 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 +10 -17
- package/esm/panel/Panel.js +6 -16
- package/esm/panel/Panel.js.map +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 +6 -6
- package/esm/popover/Popover.js.map +1 -1
- 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/table/types.d.ts +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 +11 -15
- 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/create-context.d.ts +2 -5
- package/esm/util/create-context.js +10 -6
- package/esm/util/create-context.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/OverridableComponent.d.ts +1 -1
- package/esm/util/types/index.d.ts +2 -1
- package/package.json +11 -10
- package/src/accordion/accordion.stories.tsx +121 -135
- package/src/alert/alert.stories.tsx +202 -113
- package/src/button/button.stories.tsx +88 -185
- package/src/chat/Bubble.tsx +2 -23
- package/src/chat/Chat.tsx +1 -18
- package/src/chat/chat.stories.tsx +284 -216
- 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 +11 -7
- 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 +5 -3
- package/src/date/parts/DateInput.tsx +1 -1
- package/src/date/parts/DateWrapper.tsx +3 -3
- 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/dropdown/dropdown.stories.tsx +1 -1
- 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/error-summary.stories.tsx +1 -1
- package/src/form/search/Search.tsx +7 -2
- package/src/form/stories/confirmation-panel.stories.tsx +1 -1
- package/src/form/stories/textarea.stories.tsx +37 -0
- package/src/help-text/help-text.stories.tsx +2 -1
- package/src/index.ts +2 -2
- package/src/internal-header/header.stories.tsx +2 -1
- package/src/layout/bleed/Bleed.stories.tsx +15 -1
- package/src/layout/bleed/Bleed.tsx +2 -2
- package/src/layout/box/Box.stories.tsx +3 -2
- package/src/layout/sidemal-test/navno-sidemal.stories.tsx +5 -1
- package/src/layout/utilities/css.ts +3 -0
- package/src/layout/utilities/types.ts +1 -1
- package/src/link/stories/link.stories.tsx +20 -22
- package/src/link-panel/link-panel.stories.tsx +1 -1
- package/src/list/list.stories.tsx +2 -1
- package/src/loader/loader.stories.tsx +1 -1
- package/src/modal/Modal.context.ts +13 -0
- package/src/modal/Modal.test.tsx +2 -2
- package/src/modal/Modal.tsx +6 -8
- package/src/modal/ModalHeader.tsx +3 -7
- package/src/modal/modal.stories.tsx +33 -6
- package/src/modal/types.ts +21 -4
- 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/panel/Panel.tsx +9 -16
- package/src/popover/Popover.tsx +2 -2
- package/src/stepper/stepper.stories.tsx +1 -1
- package/src/table/stories/{table.stories.tsx → table-1.stories.tsx} +118 -92
- package/src/table/stories/{table-expandable.stories.tsx → table-2-expandable.stories.tsx} +10 -34
- package/src/table/stories/{table-async.stories.tsx → table-3-async.stories.tsx} +5 -3
- package/src/table/stories/tests/table.stories.tsx +4 -1
- package/src/table/types.ts +1 -1
- package/src/tabs/TabList.tsx +2 -2
- package/src/tabs/TabPanel.tsx +2 -2
- package/src/tabs/Tabs.test.tsx +109 -0
- package/src/timeline/AxisLabels.tsx +1 -1
- package/src/toggle-group/ToggleGroup.test.tsx +54 -0
- package/src/tooltip/Tooltip.tsx +7 -17
- package/src/tooltip/tooltip.stories.tsx +4 -1
- package/src/typography/stories/bodylong.stories.tsx +49 -3
- package/src/typography/stories/bodyshort.stories.tsx +50 -4
- package/src/typography/stories/detail.stories.tsx +32 -3
- package/src/typography/stories/error-message.stories.tsx +34 -3
- package/src/typography/stories/heading.stories.tsx +32 -3
- package/src/typography/stories/label.stories.tsx +38 -3
- package/src/util/Slot.tsx +4 -2
- package/src/util/TextareaAutoSize.tsx +16 -31
- package/src/util/create-context.tsx +26 -15
- package/src/util/types/AsChildProps.ts +37 -0
- package/src/util/types/OverridableComponent.ts +1 -1
- package/src/util/types/index.ts +1 -0
- package/_docs.json +0 -19787
- 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/cjs/modal/ModalContext.d.ts +0 -7
- package/cjs/modal/ModalContext.js +0 -9
- package/cjs/modal/ModalContext.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/esm/modal/ModalContext.d.ts +0 -7
- package/esm/modal/ModalContext.js +0 -3
- package/esm/modal/ModalContext.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
- package/src/modal/ModalContext.ts +0 -7
- package/src/panel/panel.stories.tsx +0 -63
- package/src/typography/stories/ingress.stories.tsx +0 -50
|
@@ -23,7 +23,7 @@ export type SearchClearEvent =
|
|
|
23
23
|
|
|
24
24
|
export interface SearchProps
|
|
25
25
|
extends Omit<FormFieldProps, "readOnly">,
|
|
26
|
-
Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onChange"> {
|
|
26
|
+
Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onChange" | "type"> {
|
|
27
27
|
children?: React.ReactNode;
|
|
28
28
|
/**
|
|
29
29
|
* Search label
|
|
@@ -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="searchbox"
|
|
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 onClose={() => null} aria-label="Modal med textarea">
|
|
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
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Meta, StoryFn, StoryObj } from "@storybook/react";
|
|
2
2
|
import React, { useEffect, useRef } from "react";
|
|
3
|
-
import { BodyLong, Heading
|
|
3
|
+
import { BodyLong, Heading } from "../typography";
|
|
4
|
+
import HelpText from "./HelpText";
|
|
4
5
|
|
|
5
6
|
const meta: Meta<typeof HelpText> = {
|
|
6
7
|
title: "ds-react/HelpText",
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
export * from "./accordion";
|
|
2
3
|
export * from "./alert";
|
|
3
4
|
export * from "./button";
|
|
@@ -8,8 +9,8 @@ export * from "./date";
|
|
|
8
9
|
export * from "./dropdown";
|
|
9
10
|
export * from "./expansion-card";
|
|
10
11
|
export * from "./form";
|
|
11
|
-
export * from "./grid";
|
|
12
12
|
export * from "./guide-panel";
|
|
13
|
+
export * from "./overlays";
|
|
13
14
|
export * from "./help-text";
|
|
14
15
|
export * from "./internal-header";
|
|
15
16
|
export * from "./link";
|
|
@@ -36,6 +37,5 @@ export * from "./layout/bleed";
|
|
|
36
37
|
export * from "./layout/box";
|
|
37
38
|
export * from "./layout/stack";
|
|
38
39
|
export * from "./layout/grid";
|
|
39
|
-
export * from "./layout/content-container";
|
|
40
40
|
export * from "./layout/responsive";
|
|
41
41
|
export * from "./layout/page";
|
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
MenuGridIcon,
|
|
7
7
|
} from "@navikt/aksel-icons";
|
|
8
8
|
import { BodyLong, BodyShort, Detail } from "@navikt/ds-react";
|
|
9
|
-
import { Dropdown
|
|
9
|
+
import { Dropdown } from "../dropdown";
|
|
10
|
+
import InternalHeader from "./InternalHeader";
|
|
10
11
|
|
|
11
12
|
export default {
|
|
12
13
|
title: "ds-react/InternalHeader",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Meta } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { Box, HStack, VStack } from "../..";
|
|
4
3
|
import { BodyLong } from "../../typography";
|
|
4
|
+
import { Box } from "../box";
|
|
5
|
+
import { HStack, VStack } from "../stack";
|
|
5
6
|
import { Bleed } from "./Bleed";
|
|
6
7
|
|
|
7
8
|
export default {
|
|
@@ -272,6 +273,19 @@ export const Full = {
|
|
|
272
273
|
</Bleed>
|
|
273
274
|
</Box>
|
|
274
275
|
</Box>
|
|
276
|
+
<Box
|
|
277
|
+
className="maxWidth"
|
|
278
|
+
background="surface-alt-1-subtle"
|
|
279
|
+
padding="10"
|
|
280
|
+
>
|
|
281
|
+
<Box background="surface-alt-2-subtle" padding="10">
|
|
282
|
+
<Bleed marginInline="full" reflectivePadding asChild>
|
|
283
|
+
<Box background="surface-success-subtle">
|
|
284
|
+
<BodyLong>full + reflectivePadding</BodyLong>
|
|
285
|
+
</Box>
|
|
286
|
+
</Bleed>
|
|
287
|
+
</Box>
|
|
288
|
+
</Box>
|
|
275
289
|
</VStack>
|
|
276
290
|
</>
|
|
277
291
|
),
|
|
@@ -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}`
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Meta } from "@storybook/react";
|
|
2
2
|
import React, { ReactNode } from "react";
|
|
3
3
|
import { ChevronRightIcon } from "@navikt/aksel-icons";
|
|
4
|
-
import { HGrid, HStack, VStack } from "../..";
|
|
5
4
|
import { BodyLong, Detail, Heading } from "../../typography";
|
|
5
|
+
import { HGrid } from "../grid";
|
|
6
|
+
import { HStack, VStack } from "../stack";
|
|
6
7
|
import { BackgroundToken, BorderRadiiToken } from "../utilities/types";
|
|
7
8
|
import { Box } from "./Box";
|
|
8
9
|
|
|
@@ -196,7 +197,7 @@ export const PaddingBreakpoints = {
|
|
|
196
197
|
render: () => (
|
|
197
198
|
<div>
|
|
198
199
|
<Box
|
|
199
|
-
padding={{ xs: "2", sm: "3", md: "4", lg: "5", xl: "6" }}
|
|
200
|
+
padding={{ xs: "2", sm: "3", md: "4", lg: "5", xl: "6", "2xl": "8" }}
|
|
200
201
|
background="surface-neutral"
|
|
201
202
|
>
|
|
202
203
|
<Box background="surface-alt-3-subtle">
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { Box
|
|
3
|
+
import { Box } from "../box";
|
|
4
|
+
import { HGrid } from "../grid";
|
|
5
|
+
import { Hide, Show } from "../responsive";
|
|
6
|
+
import { VStack } from "../stack";
|
|
4
7
|
import { Content } from "./Content";
|
|
5
8
|
import { FilterCard } from "./Filter";
|
|
6
9
|
import { Header } from "./Header";
|
|
@@ -13,6 +16,7 @@ const meta = {
|
|
|
13
16
|
title: "kitchen sink/navno-sidemal",
|
|
14
17
|
parameters: {
|
|
15
18
|
layout: "fullscreen",
|
|
19
|
+
chromatic: { disableSnapshot: true },
|
|
16
20
|
},
|
|
17
21
|
} satisfies Meta;
|
|
18
22
|
|
|
@@ -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
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PlusCircleFillIcon } from "@navikt/aksel-icons";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Link,
|
|
8
|
-
} from "../..";
|
|
3
|
+
import { Alert } from "../../alert";
|
|
4
|
+
import { ConfirmationPanel } from "../../form";
|
|
5
|
+
import { BodyLong } from "../../typography";
|
|
6
|
+
import Link from "../Link";
|
|
9
7
|
import { RandomIcon } from "./RandomIcon";
|
|
10
8
|
|
|
11
9
|
export default {
|
|
@@ -139,37 +137,37 @@ const DemoLink = () => (
|
|
|
139
137
|
|
|
140
138
|
export const Icon = () => <DemoLink />;
|
|
141
139
|
|
|
142
|
-
export const
|
|
140
|
+
export const InAlert = () => {
|
|
143
141
|
return (
|
|
144
142
|
<div className="colgap">
|
|
145
|
-
<
|
|
143
|
+
<Alert variant="info">
|
|
146
144
|
<DemoLink />
|
|
147
|
-
</
|
|
148
|
-
<
|
|
145
|
+
</Alert>
|
|
146
|
+
<Alert variant="success">
|
|
149
147
|
<DemoLink />
|
|
150
|
-
</
|
|
151
|
-
<
|
|
148
|
+
</Alert>
|
|
149
|
+
<Alert variant="warning">
|
|
152
150
|
<DemoLink />
|
|
153
|
-
</
|
|
154
|
-
<
|
|
151
|
+
</Alert>
|
|
152
|
+
<Alert variant="error">
|
|
155
153
|
<DemoLink />
|
|
156
|
-
</
|
|
154
|
+
</Alert>
|
|
157
155
|
</div>
|
|
158
156
|
);
|
|
159
157
|
};
|
|
160
158
|
|
|
161
|
-
export const
|
|
159
|
+
export const InConfirmationPanel = () => {
|
|
162
160
|
return (
|
|
163
161
|
<div className="colgap">
|
|
164
|
-
<
|
|
162
|
+
<ConfirmationPanel label="demo">
|
|
165
163
|
<DemoLink />
|
|
166
|
-
</
|
|
167
|
-
<
|
|
164
|
+
</ConfirmationPanel>
|
|
165
|
+
<ConfirmationPanel checked label="demo">
|
|
168
166
|
<DemoLink />
|
|
169
|
-
</
|
|
170
|
-
<
|
|
167
|
+
</ConfirmationPanel>
|
|
168
|
+
<ConfirmationPanel error="demo" label="demo">
|
|
171
169
|
<DemoLink />
|
|
172
|
-
</
|
|
170
|
+
</ConfirmationPanel>
|
|
173
171
|
</div>
|
|
174
172
|
);
|
|
175
173
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { createContext } from "../util/create-context";
|
|
3
|
+
|
|
4
|
+
interface ModalContextProps {
|
|
5
|
+
closeHandler?: React.MouseEventHandler<HTMLButtonElement>;
|
|
6
|
+
ref: React.RefObject<HTMLDialogElement>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const [ModalContextProvider, useModalContext] =
|
|
10
|
+
createContext<ModalContextProps>({
|
|
11
|
+
name: "ModalContext",
|
|
12
|
+
errorMessage: "<Modal.Header> must be used within a <Modal>",
|
|
13
|
+
});
|
package/src/modal/Modal.test.tsx
CHANGED
|
@@ -7,7 +7,7 @@ const Test = () => {
|
|
|
7
7
|
const [open, setOpen] = useState(true);
|
|
8
8
|
|
|
9
9
|
return (
|
|
10
|
-
<Modal open={open}>
|
|
10
|
+
<Modal open={open} onClose={() => null} aria-label="Test">
|
|
11
11
|
<Modal.Body>
|
|
12
12
|
<p>Foobar</p>
|
|
13
13
|
<Button onClick={() => setOpen(false)}>Close</Button>
|
|
@@ -40,7 +40,7 @@ describe("Modal", () => {
|
|
|
40
40
|
|
|
41
41
|
test("should toggle body class when using portal", async () => {
|
|
42
42
|
render(
|
|
43
|
-
<Modal portal open>
|
|
43
|
+
<Modal portal open onClose={() => null} aria-label="Test">
|
|
44
44
|
<Modal.Header />
|
|
45
45
|
</Modal>,
|
|
46
46
|
);
|
package/src/modal/Modal.tsx
CHANGED
|
@@ -8,8 +8,8 @@ import { Detail, Heading } from "../typography";
|
|
|
8
8
|
import { composeEventHandlers } from "../util/composeEventHandlers";
|
|
9
9
|
import { useId } from "../util/hooks";
|
|
10
10
|
import { useMergeRefs } from "../util/hooks/useMergeRefs";
|
|
11
|
+
import { ModalContextProvider, useModalContext } from "./Modal.context";
|
|
11
12
|
import ModalBody from "./ModalBody";
|
|
12
|
-
import { ModalContext } from "./ModalContext";
|
|
13
13
|
import ModalFooter from "./ModalFooter";
|
|
14
14
|
import ModalHeader from "./ModalHeader";
|
|
15
15
|
import { getCloseHandler, useBodyScrollLock } from "./ModalUtils";
|
|
@@ -98,7 +98,7 @@ export const Modal = forwardRef<HTMLDialogElement, ModalProps>(
|
|
|
98
98
|
const portalNode = useFloatingPortalNode({ root: rootElement });
|
|
99
99
|
|
|
100
100
|
const dateContext = useContext(DateContext);
|
|
101
|
-
const modalContext =
|
|
101
|
+
const modalContext = useModalContext(false);
|
|
102
102
|
if (modalContext && !dateContext) {
|
|
103
103
|
console.error("Modals should not be nested");
|
|
104
104
|
}
|
|
@@ -185,11 +185,9 @@ export const Modal = forwardRef<HTMLDialogElement, ModalProps>(
|
|
|
185
185
|
onClick={composeEventHandlers(onClick, handleModalClick)}
|
|
186
186
|
aria-labelledby={mergedAriaLabelledBy}
|
|
187
187
|
>
|
|
188
|
-
<
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
ref: modalRef,
|
|
192
|
-
}}
|
|
188
|
+
<ModalContextProvider
|
|
189
|
+
closeHandler={getCloseHandler(modalRef, header, onBeforeClose)}
|
|
190
|
+
ref={modalRef}
|
|
193
191
|
>
|
|
194
192
|
{header && (
|
|
195
193
|
<ModalHeader>
|
|
@@ -208,7 +206,7 @@ export const Modal = forwardRef<HTMLDialogElement, ModalProps>(
|
|
|
208
206
|
)}
|
|
209
207
|
|
|
210
208
|
{children}
|
|
211
|
-
</
|
|
209
|
+
</ModalContextProvider>
|
|
212
210
|
</dialog>
|
|
213
211
|
);
|
|
214
212
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
|
-
import React, { forwardRef
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
3
|
import { XMarkIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { Button } from "../button";
|
|
5
|
-
import {
|
|
5
|
+
import { useModalContext } from "./Modal.context";
|
|
6
6
|
|
|
7
7
|
export interface ModalHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
8
|
children?: React.ReactNode;
|
|
@@ -15,11 +15,7 @@ export interface ModalHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
15
15
|
|
|
16
16
|
const ModalHeader = forwardRef<HTMLDivElement, ModalHeaderProps>(
|
|
17
17
|
({ children, className, closeButton = true, ...rest }, ref) => {
|
|
18
|
-
const context =
|
|
19
|
-
if (context === null) {
|
|
20
|
-
console.error("<Modal.Header> has to be used within a <Modal>");
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
18
|
+
const context = useModalContext();
|
|
23
19
|
|
|
24
20
|
return (
|
|
25
21
|
<div {...rest} ref={ref} className={cl("navds-modal__header", className)}>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Meta, StoryFn } from "@storybook/react";
|
|
2
2
|
import React, { useRef, useState } from "react";
|
|
3
3
|
import { FileIcon } from "@navikt/aksel-icons";
|
|
4
|
-
import {
|
|
4
|
+
import { Button } from "../button";
|
|
5
5
|
import { Checkbox, CheckboxGroup } from "../form/checkbox";
|
|
6
6
|
import { VStack } from "../layout/stack";
|
|
7
|
+
import { Tooltip } from "../tooltip";
|
|
8
|
+
import { BodyLong, Heading } from "../typography";
|
|
7
9
|
import Modal from "./Modal";
|
|
8
10
|
|
|
9
11
|
const meta: Meta<typeof Modal> = {
|
|
@@ -24,6 +26,7 @@ export const WithUseRef: StoryFn = () => {
|
|
|
24
26
|
<Button onClick={() => ref.current?.showModal()}>Open Modal</Button>
|
|
25
27
|
<Modal
|
|
26
28
|
open={ref.current ? undefined : true /* initially open */}
|
|
29
|
+
onClose={() => null}
|
|
27
30
|
ref={ref}
|
|
28
31
|
header={{
|
|
29
32
|
label: "Optional label",
|
|
@@ -145,7 +148,7 @@ export const WithUseState: StoryFn = () => {
|
|
|
145
148
|
WithUseState.storyName = "With useState";
|
|
146
149
|
|
|
147
150
|
export const EmptyHeader: StoryFn = () => (
|
|
148
|
-
<Modal open>
|
|
151
|
+
<Modal open onClose={() => null} aria-label="Modal with empty header">
|
|
149
152
|
<Modal.Header />
|
|
150
153
|
<Modal.Body>
|
|
151
154
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
@@ -160,21 +163,37 @@ export const EmptyHeader: StoryFn = () => (
|
|
|
160
163
|
);
|
|
161
164
|
|
|
162
165
|
export const Small: StoryFn = () => (
|
|
163
|
-
<Modal
|
|
166
|
+
<Modal
|
|
167
|
+
open
|
|
168
|
+
onClose={() => null}
|
|
169
|
+
width="small"
|
|
170
|
+
header={{ heading: "Simple header" }}
|
|
171
|
+
>
|
|
164
172
|
<Modal.Body>Lorem ipsum dolor sit amet.</Modal.Body>
|
|
165
173
|
</Modal>
|
|
166
174
|
);
|
|
167
175
|
Small.storyName = "Size = Small";
|
|
168
176
|
|
|
169
177
|
export const MediumWithPortal: StoryFn = () => (
|
|
170
|
-
<Modal
|
|
178
|
+
<Modal
|
|
179
|
+
open
|
|
180
|
+
onClose={() => null}
|
|
181
|
+
portal
|
|
182
|
+
width="medium"
|
|
183
|
+
header={{ heading: "Simple header" }}
|
|
184
|
+
>
|
|
171
185
|
<Modal.Body>Lorem ipsum dolor sit amet.</Modal.Body>
|
|
172
186
|
</Modal>
|
|
173
187
|
);
|
|
174
188
|
MediumWithPortal.storyName = "Size = Medium (with portal)";
|
|
175
189
|
|
|
176
190
|
export const Large800: StoryFn = () => (
|
|
177
|
-
<Modal
|
|
191
|
+
<Modal
|
|
192
|
+
open
|
|
193
|
+
onClose={() => null}
|
|
194
|
+
width={800}
|
|
195
|
+
header={{ heading: "Simple header" }}
|
|
196
|
+
>
|
|
178
197
|
<Modal.Body>Lorem ipsum dolor sit amet.</Modal.Body>
|
|
179
198
|
</Modal>
|
|
180
199
|
);
|
|
@@ -188,7 +207,9 @@ export const WithTooltip: StoryFn = () => {
|
|
|
188
207
|
<Button onClick={() => ref.current?.showModal()}>Open Modal</Button>
|
|
189
208
|
<Modal
|
|
190
209
|
open={ref.current ? undefined : true /* initially open */}
|
|
210
|
+
onClose={() => null}
|
|
191
211
|
ref={ref}
|
|
212
|
+
aria-label="Tooltip test"
|
|
192
213
|
>
|
|
193
214
|
<Modal.Body>
|
|
194
215
|
<div style={{ marginBottom: "1rem" }}>
|
|
@@ -206,7 +227,12 @@ export const WithTooltip: StoryFn = () => {
|
|
|
206
227
|
};
|
|
207
228
|
|
|
208
229
|
export const WithSrOnlyElement: StoryFn = () => (
|
|
209
|
-
<Modal
|
|
230
|
+
<Modal
|
|
231
|
+
open
|
|
232
|
+
onClose={() => null}
|
|
233
|
+
width={300}
|
|
234
|
+
header={{ heading: "Simple header" }}
|
|
235
|
+
>
|
|
210
236
|
<Modal.Body>
|
|
211
237
|
<VStack gap="16">
|
|
212
238
|
<BodyLong>
|
|
@@ -255,6 +281,7 @@ export const ChromaticViewportTesting: StoryFn = () => (
|
|
|
255
281
|
<style>{`#storybook-root { padding: 0 !important }`}</style>
|
|
256
282
|
<Modal
|
|
257
283
|
open
|
|
284
|
+
onClose={() => null}
|
|
258
285
|
header={{ heading: "Chromatic Viewports Testing", label: "Test" }}
|
|
259
286
|
>
|
|
260
287
|
<Modal.Body>
|
package/src/modal/types.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
extends React.DialogHTMLAttributes<HTMLDialogElement> {
|
|
1
|
+
interface ModalPropsBase extends React.DialogHTMLAttributes<HTMLDialogElement> {
|
|
3
2
|
/**
|
|
4
3
|
* Content for the header. Alteratively you can use <Modal.Header> instead for more control,
|
|
5
4
|
* but then you have to set `aria-label` or `aria-labelledby` on the modal manually.
|
|
@@ -39,7 +38,7 @@ export interface ModalProps
|
|
|
39
38
|
* @warning Will not always be called when pressing Esc. See `onCancel` for more info.
|
|
40
39
|
* @returns Whether to close the modal
|
|
41
40
|
*/
|
|
42
|
-
onBeforeClose?: () => boolean
|
|
41
|
+
onBeforeClose?: () => boolean;
|
|
43
42
|
/**
|
|
44
43
|
* *Sometimes** called when the user presses the Esc key.
|
|
45
44
|
* @warning *Some browsers does not always trigger this event. Chrome only triggers it if you have
|
|
@@ -66,9 +65,27 @@ export interface ModalProps
|
|
|
66
65
|
*/
|
|
67
66
|
className?: string;
|
|
68
67
|
/**
|
|
69
|
-
*
|
|
68
|
+
* ID of the element that labels the modal.
|
|
70
69
|
* No need to set this manually if the `header` prop is used. A reference to `header.heading` will be created automatically.
|
|
71
70
|
* @warning If not using `header`, you should set either `aria-labelledby` or `aria-label`.
|
|
72
71
|
*/
|
|
73
72
|
"aria-labelledby"?: string;
|
|
73
|
+
/**
|
|
74
|
+
* String value that labels the modal.
|
|
75
|
+
* No need to set this if the `header` prop is used.
|
|
76
|
+
* @warning If not using `header`, you should set either `aria-labelledby` or `aria-label`.
|
|
77
|
+
*/
|
|
78
|
+
"aria-label"?: string;
|
|
74
79
|
}
|
|
80
|
+
|
|
81
|
+
// Require onClose if you use open & Require either header, aria-labelledby or aria-label
|
|
82
|
+
export type ModalProps = ModalPropsBase &
|
|
83
|
+
(
|
|
84
|
+
| { open?: never }
|
|
85
|
+
| { open: boolean | undefined; onClose: ModalPropsBase["onClose"] }
|
|
86
|
+
) &
|
|
87
|
+
(
|
|
88
|
+
| { header: ModalPropsBase["header"] }
|
|
89
|
+
| { "aria-labelledby": string; "aria-label"?: never }
|
|
90
|
+
| { "aria-labelledby"?: never; "aria-label": string }
|
|
91
|
+
);
|