@navikt/ds-react 5.6.4 → 5.7.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/_docs.json +297 -257
- package/cjs/accordion/AccordionContent.js +2 -2
- package/cjs/accordion/AccordionHeader.js +2 -2
- package/cjs/alert/Alert.js +2 -2
- package/cjs/button/Button.js +6 -5
- package/cjs/copybutton/CopyButton.js +8 -7
- package/cjs/date/DateInput.js +6 -5
- package/cjs/date/datepicker/DatePicker.js +6 -5
- package/cjs/date/datepicker/DatePickerStandalone.js +6 -6
- package/cjs/date/datepicker/parts/Caption.js +5 -4
- package/cjs/date/datepicker/parts/DropdownCaption.js +7 -6
- package/cjs/date/datepicker/parts/WeekRow.js +1 -1
- package/cjs/date/datepicker/types.js +2 -0
- package/cjs/date/monthpicker/MonthCaption.js +5 -4
- package/cjs/date/monthpicker/MonthPicker.js +4 -3
- package/cjs/date/monthpicker/MonthSelector.js +2 -2
- package/cjs/date/monthpicker/types.js +2 -0
- package/cjs/date/utils/parse-date.js +7 -7
- package/cjs/dropdown/Dropdown.js +4 -4
- package/cjs/dropdown/Menu/GroupedList/GroupedItem.js +2 -2
- package/cjs/dropdown/Menu/List/Item.js +3 -3
- package/cjs/dropdown/Menu/index.js +2 -2
- package/cjs/dropdown/Toggle.js +3 -3
- package/cjs/dropdown/context.js +5 -0
- package/cjs/expansion-card/ExpansionCard.js +3 -7
- package/cjs/expansion-card/ExpansionCardContent.js +4 -4
- package/cjs/expansion-card/ExpansionCardDescription.js +5 -5
- package/cjs/expansion-card/ExpansionCardHeader.js +3 -3
- package/cjs/expansion-card/ExpansionCardTitle.js +1 -1
- package/cjs/expansion-card/context.js +9 -0
- package/cjs/form/ConfirmationPanel.js +8 -6
- package/cjs/form/Fieldset/Fieldset.js +11 -10
- package/cjs/form/Fieldset/context.js +5 -0
- package/cjs/form/Fieldset/index.js +2 -1
- package/cjs/form/Select.js +8 -7
- package/cjs/form/Switch.js +7 -5
- package/cjs/form/TextField.js +6 -5
- package/cjs/form/Textarea.js +8 -7
- package/cjs/form/checkbox/Checkbox.js +1 -1
- package/cjs/form/checkbox/CheckboxGroup.js +4 -4
- package/cjs/form/checkbox/types.js +2 -0
- package/cjs/form/checkbox/useCheckbox.js +2 -2
- package/cjs/form/combobox/Combobox.js +6 -5
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js +6 -5
- package/cjs/form/combobox/Input/Input.js +2 -2
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.js +3 -3
- package/cjs/form/error-summary/ErrorSummary.js +3 -3
- package/cjs/form/radio/RadioGroup.js +6 -6
- package/cjs/form/radio/types.js +2 -0
- package/cjs/form/radio/useRadio.js +2 -2
- package/cjs/form/search/Search.js +10 -9
- package/cjs/form/search/SearchButton.js +5 -5
- package/cjs/form/search/context.js +5 -0
- package/cjs/form/useFormField.js +5 -5
- package/cjs/guide-panel/Illustration.js +2 -2
- package/cjs/help-text/HelpText.js +5 -4
- package/cjs/link-panel/LinkPanel.js +2 -2
- package/cjs/link-panel/LinkPanelDescription.js +2 -2
- package/cjs/list/List.js +4 -8
- package/cjs/list/ListItem.js +2 -2
- package/cjs/list/context.js +9 -0
- package/cjs/list/types.js +2 -0
- package/cjs/loader/Loader.js +4 -4
- package/cjs/modal/Modal.js +24 -22
- package/cjs/modal/types.js +2 -0
- package/cjs/pagination/Pagination.js +5 -5
- package/cjs/pagination/PaginationItem.js +2 -2
- package/cjs/popover/Popover.js +4 -5
- package/cjs/stepper/Step.js +5 -5
- package/cjs/stepper/Stepper.js +4 -4
- package/cjs/stepper/context.js +5 -0
- package/cjs/table/ColumnHeader.js +3 -3
- package/cjs/table/DataCell.js +2 -2
- package/cjs/table/ExpandableRow.js +2 -2
- package/cjs/table/Table.js +7 -7
- package/cjs/table/context.js +5 -0
- package/cjs/table/types.js +2 -0
- package/cjs/tabs/Tab.js +4 -4
- package/cjs/tabs/TabList.js +5 -5
- package/cjs/tabs/Tabs.js +3 -3
- package/cjs/tabs/context.js +5 -0
- package/cjs/tag/Tag.js +2 -2
- package/cjs/timeline/period/NonClickablePeriod.js +1 -1
- package/cjs/timeline/period/types.js +2 -0
- package/cjs/toggle-group/ToggleGroup.js +7 -6
- package/cjs/toggle-group/ToggleItem.js +4 -4
- package/cjs/toggle-group/context.js +5 -0
- package/cjs/tooltip/Tooltip.js +4 -3
- package/cjs/util/TextareaAutoSize.js +4 -4
- package/cjs/util/index.js +7 -38
- package/cjs/util/omit.js +7 -0
- package/cjs/util/useClientLayoutEffect.js +10 -0
- package/cjs/util/useEventListener.js +17 -0
- package/esm/accordion/AccordionContent.js +1 -1
- package/esm/accordion/AccordionContent.js.map +1 -1
- package/esm/accordion/AccordionHeader.js +1 -1
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/alert/Alert.js +1 -1
- package/esm/alert/Alert.js.map +1 -1
- package/esm/button/Button.d.ts +1 -1
- package/esm/button/Button.js +4 -3
- package/esm/button/Button.js.map +1 -1
- package/esm/chips/Chips.d.ts +1 -1
- package/esm/chips/Toggle.d.ts +1 -1
- package/esm/copybutton/CopyButton.d.ts +7 -7
- package/esm/copybutton/CopyButton.js +7 -6
- package/esm/copybutton/CopyButton.js.map +1 -1
- package/esm/date/DateInput.js +2 -1
- package/esm/date/DateInput.js.map +1 -1
- package/esm/date/datepicker/DatePicker.d.ts +5 -105
- package/esm/date/datepicker/DatePicker.js +4 -3
- package/esm/date/datepicker/DatePicker.js.map +1 -1
- package/esm/date/datepicker/DatePickerStandalone.d.ts +1 -1
- package/esm/date/datepicker/DatePickerStandalone.js +5 -5
- package/esm/date/datepicker/DatePickerStandalone.js.map +1 -1
- package/esm/date/datepicker/parts/Caption.js +2 -1
- package/esm/date/datepicker/parts/Caption.js.map +1 -1
- package/esm/date/datepicker/parts/DropdownCaption.js +3 -2
- package/esm/date/datepicker/parts/DropdownCaption.js.map +1 -1
- package/esm/date/datepicker/parts/WeekRow.js +1 -1
- package/esm/date/datepicker/parts/WeekRow.js.map +1 -1
- package/esm/date/datepicker/types.d.ts +102 -0
- package/esm/date/datepicker/types.js +2 -0
- package/esm/date/datepicker/types.js.map +1 -0
- package/esm/date/hooks/useMonthPicker.d.ts +1 -1
- package/esm/date/index.d.ts +4 -3
- package/esm/date/index.js +1 -1
- package/esm/date/index.js.map +1 -1
- package/esm/date/monthpicker/MonthCaption.js +2 -1
- package/esm/date/monthpicker/MonthCaption.js.map +1 -1
- package/esm/date/monthpicker/MonthPicker.d.ts +5 -86
- package/esm/date/monthpicker/MonthPicker.js +3 -2
- package/esm/date/monthpicker/MonthPicker.js.map +1 -1
- package/esm/date/monthpicker/MonthPickerStandalone.d.ts +1 -1
- package/esm/date/monthpicker/MonthPickerStandalone.js.map +1 -1
- package/esm/date/monthpicker/MonthSelector.js +1 -1
- package/esm/date/monthpicker/MonthSelector.js.map +1 -1
- package/esm/date/monthpicker/types.d.ts +83 -0
- package/esm/date/monthpicker/types.js +2 -0
- package/esm/date/monthpicker/types.js.map +1 -0
- package/esm/date/utils/parse-date.js +1 -1
- package/esm/date/utils/parse-date.js.map +1 -1
- package/esm/dropdown/Dropdown.d.ts +1 -9
- package/esm/dropdown/Dropdown.js +3 -3
- package/esm/dropdown/Dropdown.js.map +1 -1
- package/esm/dropdown/Menu/GroupedList/GroupedItem.d.ts +1 -1
- package/esm/dropdown/Menu/GroupedList/GroupedItem.js +1 -1
- package/esm/dropdown/Menu/GroupedList/GroupedItem.js.map +1 -1
- package/esm/dropdown/Menu/GroupedList/index.d.ts +1 -1
- package/esm/dropdown/Menu/List/Item.d.ts +1 -1
- package/esm/dropdown/Menu/List/Item.js +2 -2
- package/esm/dropdown/Menu/List/Item.js.map +1 -1
- package/esm/dropdown/Menu/List/index.d.ts +1 -1
- package/esm/dropdown/Menu/index.js +1 -1
- package/esm/dropdown/Menu/index.js.map +1 -1
- package/esm/dropdown/Toggle.js +2 -2
- package/esm/dropdown/Toggle.js.map +1 -1
- package/esm/dropdown/context.d.ts +9 -0
- package/esm/dropdown/context.js +3 -0
- package/esm/dropdown/context.js.map +1 -0
- package/esm/expansion-card/ExpansionCard.d.ts +1 -7
- package/esm/expansion-card/ExpansionCard.js +2 -6
- package/esm/expansion-card/ExpansionCard.js.map +1 -1
- package/esm/expansion-card/ExpansionCardContent.js +2 -2
- package/esm/expansion-card/ExpansionCardContent.js.map +1 -1
- package/esm/expansion-card/ExpansionCardDescription.js +3 -3
- package/esm/expansion-card/ExpansionCardDescription.js.map +1 -1
- package/esm/expansion-card/ExpansionCardHeader.js +2 -2
- package/esm/expansion-card/ExpansionCardHeader.js.map +1 -1
- package/esm/expansion-card/ExpansionCardTitle.d.ts +1 -1
- package/esm/expansion-card/ExpansionCardTitle.js +1 -1
- package/esm/expansion-card/ExpansionCardTitle.js.map +1 -1
- package/esm/expansion-card/context.d.ts +7 -0
- package/esm/expansion-card/context.js +7 -0
- package/esm/expansion-card/context.js.map +1 -0
- package/esm/form/ConfirmationPanel.d.ts +1 -1
- package/esm/form/ConfirmationPanel.js +4 -2
- package/esm/form/ConfirmationPanel.js.map +1 -1
- package/esm/form/Fieldset/Fieldset.d.ts +0 -23
- package/esm/form/Fieldset/Fieldset.js +4 -3
- package/esm/form/Fieldset/Fieldset.js.map +1 -1
- package/esm/form/Fieldset/context.d.ts +24 -0
- package/esm/form/Fieldset/context.js +3 -0
- package/esm/form/Fieldset/context.js.map +1 -0
- package/esm/form/Fieldset/index.d.ts +2 -1
- package/esm/form/Fieldset/index.js +2 -1
- package/esm/form/Fieldset/index.js.map +1 -1
- package/esm/form/Select.js +4 -3
- package/esm/form/Select.js.map +1 -1
- package/esm/form/Switch.js +3 -1
- package/esm/form/Switch.js.map +1 -1
- package/esm/form/TextField.js +2 -1
- package/esm/form/TextField.js.map +1 -1
- package/esm/form/Textarea.js +2 -1
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/checkbox/Checkbox.d.ts +2 -34
- package/esm/form/checkbox/Checkbox.js +1 -1
- package/esm/form/checkbox/Checkbox.js.map +1 -1
- package/esm/form/checkbox/CheckboxGroup.d.ts +1 -1
- package/esm/form/checkbox/CheckboxGroup.js +2 -2
- package/esm/form/checkbox/CheckboxGroup.js.map +1 -1
- package/esm/form/checkbox/index.d.ts +2 -1
- package/esm/form/checkbox/index.js.map +1 -1
- package/esm/form/checkbox/types.d.ts +34 -0
- package/esm/form/checkbox/types.js +2 -0
- package/esm/form/checkbox/types.js.map +1 -0
- package/esm/form/checkbox/useCheckbox.d.ts +1 -1
- package/esm/form/checkbox/useCheckbox.js +1 -1
- package/esm/form/checkbox/useCheckbox.js.map +1 -1
- package/esm/form/combobox/Combobox.d.ts +1 -1
- package/esm/form/combobox/Combobox.js +2 -1
- package/esm/form/combobox/Combobox.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js +2 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/esm/form/combobox/Input/Input.js +1 -1
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js +1 -1
- package/esm/form/combobox/SelectedOptions/SelectedOptions.js.map +1 -1
- package/esm/form/error-summary/ErrorSummary.js +1 -1
- package/esm/form/error-summary/ErrorSummary.js.map +1 -1
- package/esm/form/error-summary/ErrorSummaryItem.d.ts +1 -1
- package/esm/form/radio/Radio.d.ts +2 -16
- package/esm/form/radio/Radio.js.map +1 -1
- package/esm/form/radio/RadioGroup.d.ts +1 -1
- package/esm/form/radio/RadioGroup.js +3 -3
- package/esm/form/radio/RadioGroup.js.map +1 -1
- package/esm/form/radio/index.d.ts +2 -1
- package/esm/form/radio/index.js.map +1 -1
- package/esm/form/radio/types.d.ts +16 -0
- package/esm/form/radio/types.js +2 -0
- package/esm/form/radio/types.js.map +1 -0
- package/esm/form/radio/useRadio.d.ts +1 -1
- package/esm/form/radio/useRadio.js +1 -1
- package/esm/form/radio/useRadio.js.map +1 -1
- package/esm/form/search/Search.d.ts +0 -7
- package/esm/form/search/Search.js +4 -3
- 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/SearchButton.js.map +1 -1
- package/esm/form/search/context.d.ts +8 -0
- package/esm/form/search/context.js +3 -0
- package/esm/form/search/context.js.map +1 -0
- package/esm/form/useFormField.js +3 -3
- package/esm/form/useFormField.js.map +1 -1
- package/esm/guide-panel/Illustration.js +1 -1
- package/esm/guide-panel/Illustration.js.map +1 -1
- package/esm/help-text/HelpText.d.ts +1 -1
- package/esm/help-text/HelpText.js +2 -1
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/link-panel/LinkPanel.d.ts +1 -1
- package/esm/link-panel/LinkPanel.js +1 -1
- package/esm/link-panel/LinkPanel.js.map +1 -1
- package/esm/link-panel/LinkPanelDescription.js +1 -1
- package/esm/link-panel/LinkPanelDescription.js.map +1 -1
- package/esm/list/List.d.ts +4 -35
- package/esm/list/List.js +2 -6
- package/esm/list/List.js.map +1 -1
- package/esm/list/ListItem.js +1 -1
- package/esm/list/ListItem.js.map +1 -1
- package/esm/list/context.d.ts +9 -0
- package/esm/list/context.js +7 -0
- package/esm/list/context.js.map +1 -0
- package/esm/list/index.d.ts +1 -1
- package/esm/list/types.d.ts +27 -0
- package/esm/list/types.js +2 -0
- package/esm/list/types.js.map +1 -0
- package/esm/loader/Loader.js +2 -2
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/Modal.d.ts +2 -64
- package/esm/modal/Modal.js +8 -6
- package/esm/modal/Modal.js.map +1 -1
- package/esm/modal/ModalUtils.d.ts +1 -1
- package/esm/modal/index.d.ts +3 -2
- package/esm/modal/index.js.map +1 -1
- package/esm/modal/types.d.ts +64 -0
- package/esm/modal/types.js +2 -0
- package/esm/modal/types.js.map +1 -0
- package/esm/pagination/Pagination.js +1 -1
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/pagination/PaginationItem.d.ts +2 -1
- package/esm/pagination/PaginationItem.js +1 -1
- package/esm/pagination/PaginationItem.js.map +1 -1
- package/esm/popover/Popover.d.ts +5 -0
- package/esm/popover/Popover.js +5 -6
- package/esm/popover/Popover.js.map +1 -1
- package/esm/stepper/Step.d.ts +1 -1
- package/esm/stepper/Step.js +2 -2
- package/esm/stepper/Step.js.map +1 -1
- package/esm/stepper/Stepper.d.ts +2 -11
- package/esm/stepper/Stepper.js +2 -2
- package/esm/stepper/Stepper.js.map +1 -1
- package/esm/stepper/context.d.ts +10 -0
- package/esm/stepper/context.js +3 -0
- package/esm/stepper/context.js.map +1 -0
- package/esm/table/ColumnHeader.js +2 -2
- package/esm/table/ColumnHeader.js.map +1 -1
- package/esm/table/DataCell.js +1 -1
- package/esm/table/DataCell.js.map +1 -1
- package/esm/table/ExpandableRow.js +1 -1
- package/esm/table/ExpandableRow.js.map +1 -1
- package/esm/table/Table.d.ts +15 -23
- package/esm/table/Table.js +5 -5
- package/esm/table/Table.js.map +1 -1
- package/esm/table/context.d.ts +7 -0
- package/esm/table/context.js +3 -0
- package/esm/table/context.js.map +1 -0
- package/esm/table/index.d.ts +2 -1
- package/esm/table/index.js.map +1 -1
- package/esm/table/types.d.ts +4 -0
- package/esm/table/types.js +2 -0
- package/esm/table/types.js.map +1 -0
- package/esm/tabs/Tab.d.ts +1 -1
- package/esm/tabs/Tab.js +2 -2
- package/esm/tabs/Tab.js.map +1 -1
- package/esm/tabs/TabList.js +2 -2
- package/esm/tabs/TabList.js.map +1 -1
- package/esm/tabs/Tabs.d.ts +0 -6
- package/esm/tabs/Tabs.js +2 -2
- package/esm/tabs/Tabs.js.map +1 -1
- package/esm/tabs/context.d.ts +8 -0
- package/esm/tabs/context.js +3 -0
- package/esm/tabs/context.js.map +1 -0
- package/esm/tabs/index.d.ts +1 -1
- package/esm/tabs/index.js.map +1 -1
- package/esm/tag/Tag.js +1 -1
- package/esm/tag/Tag.js.map +1 -1
- package/esm/timeline/period/ClickablePeriod.d.ts +1 -1
- package/esm/timeline/period/NonClickablePeriod.d.ts +1 -1
- package/esm/timeline/period/NonClickablePeriod.js +1 -1
- package/esm/timeline/period/NonClickablePeriod.js.map +1 -1
- package/esm/timeline/period/index.d.ts +0 -13
- package/esm/timeline/period/index.js.map +1 -1
- package/esm/timeline/period/types.d.ts +14 -0
- package/esm/timeline/period/types.js +2 -0
- package/esm/timeline/period/types.js.map +1 -0
- package/esm/toggle-group/ToggleGroup.d.ts +0 -4
- package/esm/toggle-group/ToggleGroup.js +4 -3
- package/esm/toggle-group/ToggleGroup.js.map +1 -1
- package/esm/toggle-group/ToggleItem.js +3 -3
- package/esm/toggle-group/ToggleItem.js.map +1 -1
- package/esm/toggle-group/context.d.ts +6 -0
- package/esm/toggle-group/context.js +3 -0
- package/esm/toggle-group/context.js.map +1 -0
- package/esm/tooltip/Tooltip.js +2 -1
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/util/TextareaAutoSize.js +1 -1
- package/esm/util/TextareaAutoSize.js.map +1 -1
- package/esm/util/index.d.ts +5 -11
- package/esm/util/index.js +5 -33
- package/esm/util/index.js.map +1 -1
- package/esm/util/omit.d.ts +1 -0
- package/esm/util/omit.js +4 -0
- package/esm/util/omit.js.map +1 -0
- package/esm/util/useClientLayoutEffect.d.ts +2 -0
- package/esm/util/useClientLayoutEffect.js +8 -0
- package/esm/util/useClientLayoutEffect.js.map +1 -0
- package/esm/util/useEventListener.d.ts +5 -0
- package/esm/util/useEventListener.js +14 -0
- package/esm/util/useEventListener.js.map +1 -0
- package/package.json +3 -3
- package/src/accordion/AccordionContent.tsx +1 -1
- package/src/accordion/AccordionHeader.tsx +1 -1
- package/src/alert/Alert.tsx +1 -1
- package/src/button/Button.tsx +9 -3
- package/src/chips/Chips.tsx +1 -1
- package/src/chips/Toggle.tsx +1 -1
- package/src/copybutton/CopyButton.tsx +28 -29
- package/src/copybutton/copy-button.stories.tsx +24 -22
- package/src/date/DateInput.tsx +2 -1
- package/src/date/datepicker/DatePicker.tsx +9 -124
- package/src/date/datepicker/DatePickerStandalone.tsx +9 -9
- package/src/date/datepicker/parts/Caption.tsx +3 -1
- package/src/date/datepicker/parts/DropdownCaption.tsx +3 -2
- package/src/date/datepicker/parts/WeekRow.tsx +1 -1
- package/src/date/datepicker/types.ts +109 -0
- package/src/date/hooks/useMonthPicker.tsx +1 -1
- package/src/date/index.ts +5 -7
- package/src/date/monthpicker/MonthCaption.tsx +2 -1
- package/src/date/monthpicker/MonthPicker.tsx +9 -92
- package/src/date/monthpicker/MonthPickerStandalone.tsx +1 -1
- package/src/date/monthpicker/MonthSelector.tsx +1 -1
- package/src/date/monthpicker/types.ts +83 -0
- package/src/date/utils/parse-date.ts +1 -1
- package/src/dropdown/Dropdown.tsx +3 -12
- package/src/dropdown/Menu/GroupedList/GroupedItem.tsx +2 -2
- package/src/dropdown/Menu/GroupedList/index.tsx +1 -1
- package/src/dropdown/Menu/List/Item.tsx +3 -3
- package/src/dropdown/Menu/List/index.tsx +1 -1
- package/src/dropdown/Menu/index.tsx +1 -1
- package/src/dropdown/Toggle.tsx +2 -2
- package/src/dropdown/context.ts +11 -0
- package/src/expansion-card/ExpansionCard.tsx +3 -14
- package/src/expansion-card/ExpansionCardContent.tsx +2 -2
- package/src/expansion-card/ExpansionCardDescription.tsx +3 -3
- package/src/expansion-card/ExpansionCardHeader.tsx +2 -2
- package/src/expansion-card/ExpansionCardTitle.tsx +2 -2
- package/src/expansion-card/context.ts +13 -0
- package/src/form/ConfirmationPanel.tsx +4 -2
- package/src/form/Fieldset/Fieldset.tsx +4 -29
- package/src/form/Fieldset/context.ts +26 -0
- package/src/form/Fieldset/index.ts +2 -5
- package/src/form/Select.tsx +4 -4
- package/src/form/Switch.tsx +3 -1
- package/src/form/TextField.tsx +2 -1
- package/src/form/Textarea.tsx +2 -1
- package/src/form/checkbox/Checkbox.tsx +3 -38
- package/src/form/checkbox/CheckboxGroup.tsx +2 -2
- package/src/form/checkbox/index.ts +2 -1
- package/src/form/checkbox/types.ts +37 -0
- package/src/form/checkbox/useCheckbox.ts +2 -1
- package/src/form/combobox/Combobox.tsx +2 -1
- package/src/form/combobox/FilteredOptions/FilteredOptions.tsx +2 -1
- package/src/form/combobox/Input/Input.tsx +1 -1
- package/src/form/combobox/SelectedOptions/SelectedOptions.tsx +1 -1
- package/src/form/error-summary/ErrorSummary.tsx +1 -1
- package/src/form/error-summary/ErrorSummaryItem.tsx +1 -1
- package/src/form/radio/Radio.tsx +2 -19
- package/src/form/radio/RadioGroup.tsx +3 -3
- package/src/form/radio/index.ts +2 -1
- package/src/form/radio/types.ts +19 -0
- package/src/form/radio/useRadio.ts +2 -2
- package/src/form/search/Search.tsx +5 -14
- package/src/form/search/SearchButton.tsx +3 -3
- package/src/form/search/context.ts +10 -0
- package/src/form/useFormField.ts +3 -3
- package/src/guide-panel/Illustration.tsx +1 -1
- package/src/help-text/HelpText.tsx +2 -1
- package/src/link-panel/LinkPanel.tsx +2 -1
- package/src/link-panel/LinkPanelDescription.tsx +1 -1
- package/src/list/List.tsx +8 -45
- package/src/list/ListItem.tsx +1 -1
- package/src/list/context.ts +14 -0
- package/src/list/index.ts +1 -1
- package/src/list/types.ts +26 -0
- package/src/loader/Loader.tsx +2 -2
- package/src/modal/Modal.tsx +9 -71
- package/src/modal/ModalUtils.ts +1 -1
- package/src/modal/index.ts +3 -2
- package/src/modal/types.ts +64 -0
- package/src/pagination/Pagination.tsx +1 -1
- package/src/pagination/PaginationItem.tsx +2 -1
- package/src/popover/Popover.tsx +10 -5
- package/src/stepper/Step.tsx +3 -2
- package/src/stepper/Stepper.tsx +3 -13
- package/src/stepper/context.ts +11 -0
- package/src/table/ColumnHeader.tsx +3 -3
- package/src/table/DataCell.tsx +1 -1
- package/src/table/ExpandableRow.tsx +1 -1
- package/src/table/Table.tsx +17 -27
- package/src/table/context.ts +9 -0
- package/src/table/index.ts +2 -1
- package/src/table/types.ts +4 -0
- package/src/tabs/Tab.tsx +3 -2
- package/src/tabs/TabList.tsx +2 -2
- package/src/tabs/Tabs.tsx +2 -9
- package/src/tabs/context.ts +9 -0
- package/src/tabs/index.ts +1 -1
- package/src/tag/Tag.tsx +1 -1
- package/src/timeline/period/ClickablePeriod.tsx +1 -1
- package/src/timeline/period/NonClickablePeriod.tsx +2 -2
- package/src/timeline/period/index.tsx +0 -14
- package/src/timeline/period/types.ts +13 -0
- package/src/timeline/utils/filter.ts +1 -1
- package/src/toggle-group/ToggleGroup.tsx +4 -15
- package/src/toggle-group/ToggleItem.tsx +3 -3
- package/src/toggle-group/context.ts +9 -0
- package/src/tooltip/Tooltip.tsx +2 -1
- package/src/util/TextareaAutoSize.tsx +1 -1
- package/src/util/index.ts +5 -70
- package/src/util/omit.ts +10 -0
- package/src/util/useClientLayoutEffect.ts +11 -0
- package/src/util/useEventListener.ts +32 -0
|
@@ -1,45 +1,10 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
|
-
import React, { forwardRef
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
3
|
import { BodyShort } from "../../typography";
|
|
4
4
|
import { omit } from "../../util";
|
|
5
|
-
import { FormFieldProps } from "../useFormField";
|
|
6
|
-
import useCheckbox from "./useCheckbox";
|
|
7
5
|
import { ReadOnlyIcon } from "../ReadOnlyIcon";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
extends FormFieldProps,
|
|
11
|
-
Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "value"> {
|
|
12
|
-
/**
|
|
13
|
-
* Adds error indication on checkbox
|
|
14
|
-
* @default false
|
|
15
|
-
*/
|
|
16
|
-
error?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Id for error resulting in checkbox having error
|
|
19
|
-
*/
|
|
20
|
-
errorId?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Checkbox label
|
|
23
|
-
*/
|
|
24
|
-
children: React.ReactNode;
|
|
25
|
-
/**
|
|
26
|
-
* Hides label and makes it viewable for screen-readers only.
|
|
27
|
-
*/
|
|
28
|
-
hideLabel?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* The value of the HTML element.
|
|
31
|
-
*/
|
|
32
|
-
value?: any;
|
|
33
|
-
/**
|
|
34
|
-
* Specify whether the Checkbox is in an indeterminate state
|
|
35
|
-
* @default false
|
|
36
|
-
*/
|
|
37
|
-
indeterminate?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Adds a description to extend labling of Checkbox
|
|
40
|
-
*/
|
|
41
|
-
description?: string;
|
|
42
|
-
}
|
|
6
|
+
import { CheckboxProps } from "./types";
|
|
7
|
+
import useCheckbox from "./useCheckbox";
|
|
43
8
|
|
|
44
9
|
export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
45
10
|
(props, ref) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { createContext, forwardRef, useContext, useState } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
3
|
-
import {
|
|
2
|
+
import React, { createContext, forwardRef, useContext, useState } from "react";
|
|
3
|
+
import { Fieldset, FieldsetContext, FieldsetProps } from "../Fieldset";
|
|
4
4
|
|
|
5
5
|
export interface CheckboxGroupState {
|
|
6
6
|
readonly defaultValue?: readonly any[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from "react";
|
|
2
|
+
import { FormFieldProps } from "../useFormField";
|
|
3
|
+
|
|
4
|
+
export interface CheckboxProps
|
|
5
|
+
extends FormFieldProps,
|
|
6
|
+
Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "value"> {
|
|
7
|
+
/**
|
|
8
|
+
* Adds error indication on checkbox
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
error?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Id for error resulting in checkbox having error
|
|
14
|
+
*/
|
|
15
|
+
errorId?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Checkbox label
|
|
18
|
+
*/
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Hides label and makes it viewable for screen-readers only.
|
|
22
|
+
*/
|
|
23
|
+
hideLabel?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The value of the HTML element.
|
|
26
|
+
*/
|
|
27
|
+
value?: any;
|
|
28
|
+
/**
|
|
29
|
+
* Specify whether the Checkbox is in an indeterminate state
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
indeterminate?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Adds a description to extend labling of Checkbox
|
|
35
|
+
*/
|
|
36
|
+
description?: string;
|
|
37
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { omit } from "../../util";
|
|
3
3
|
import { useFormField } from "../useFormField";
|
|
4
4
|
import { CheckboxGroupContext } from "./CheckboxGroup";
|
|
5
|
+
import { CheckboxProps } from "./types";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Handles props for Checkboxes in context with Fieldset and CheckboxGroup
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef, useMemo, useRef } from "react";
|
|
3
|
-
import { BodyShort, ErrorMessage, Label, mergeRefs } from "../..";
|
|
4
3
|
import ClearButton from "./ClearButton";
|
|
5
4
|
import FilteredOptions from "./FilteredOptions/FilteredOptions";
|
|
6
5
|
import { useFilteredOptionsContext } from "./FilteredOptions/filteredOptionsContext";
|
|
@@ -11,6 +10,8 @@ import { useSelectedOptionsContext } from "./SelectedOptions/selectedOptionsCont
|
|
|
11
10
|
import ComboboxWrapper from "./ComboboxWrapper";
|
|
12
11
|
import { useInputContext } from "./Input/inputContext";
|
|
13
12
|
import Input from "./Input/Input";
|
|
13
|
+
import { mergeRefs } from "../../util";
|
|
14
|
+
import { BodyShort, ErrorMessage, Label } from "../../typography";
|
|
14
15
|
|
|
15
16
|
export const Combobox = forwardRef<
|
|
16
17
|
HTMLInputElement,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import cl from "clsx";
|
|
3
|
-
import { BodyShort, Label, Loader } from "../../..";
|
|
4
3
|
import { CheckmarkIcon, PlusIcon } from "@navikt/aksel-icons";
|
|
5
4
|
import { useFilteredOptionsContext } from "./filteredOptionsContext";
|
|
6
5
|
import { useSelectedOptionsContext } from "../SelectedOptions/selectedOptionsContext";
|
|
7
6
|
import { useInputContext } from "../Input/inputContext";
|
|
7
|
+
import { Loader } from "../../../loader";
|
|
8
|
+
import { BodyShort, Label } from "../../../typography";
|
|
8
9
|
|
|
9
10
|
const FilteredOptions = () => {
|
|
10
11
|
const {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef, HTMLAttributes } from "react";
|
|
2
2
|
import cl from "clsx";
|
|
3
|
-
import { Heading, BodyShort } from "
|
|
3
|
+
import { Heading, BodyShort } from "../../typography";
|
|
4
4
|
import ErrorSummaryItem, { ErrorSummaryItemType } from "./ErrorSummaryItem";
|
|
5
5
|
import { useId } from "../../util";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import cl from "clsx";
|
|
3
|
-
import { OverridableComponent } from "
|
|
3
|
+
import { OverridableComponent } from "../../util";
|
|
4
4
|
|
|
5
5
|
export interface ErrorSummaryItemProps
|
|
6
6
|
extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
package/src/form/radio/Radio.tsx
CHANGED
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
|
-
import React, { forwardRef
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
3
|
import { BodyShort } from "../../typography";
|
|
4
4
|
import { omit } from "../../util";
|
|
5
|
-
import {
|
|
5
|
+
import { RadioProps } from "./types";
|
|
6
6
|
import { useRadio } from "./useRadio";
|
|
7
7
|
|
|
8
|
-
export interface RadioProps
|
|
9
|
-
extends Omit<FormFieldProps, "error" | "errorId" | "readOnly">,
|
|
10
|
-
Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "value"> {
|
|
11
|
-
/**
|
|
12
|
-
* Radio label
|
|
13
|
-
*/
|
|
14
|
-
children: React.ReactNode;
|
|
15
|
-
/**
|
|
16
|
-
* The value of the HTML element
|
|
17
|
-
*/
|
|
18
|
-
value: any;
|
|
19
|
-
/**
|
|
20
|
-
* Adds a description to extend labling of Radio
|
|
21
|
-
*/
|
|
22
|
-
description?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
8
|
export const Radio = forwardRef<HTMLInputElement, RadioProps>((props, ref) => {
|
|
26
9
|
const { inputProps, size, hasError, readOnly } = useRadio(props);
|
|
27
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { forwardRef, useContext } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
3
|
-
import {
|
|
4
|
-
import { useId } from "
|
|
2
|
+
import React, { forwardRef, useContext } from "react";
|
|
3
|
+
import { useId } from "../../util";
|
|
4
|
+
import { Fieldset, FieldsetContext, FieldsetProps } from "../Fieldset";
|
|
5
5
|
|
|
6
6
|
export interface RadioGroupContextProps {
|
|
7
7
|
name: string;
|
package/src/form/radio/index.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from "react";
|
|
2
|
+
import { FormFieldProps } from "../useFormField";
|
|
3
|
+
|
|
4
|
+
export interface RadioProps
|
|
5
|
+
extends Omit<FormFieldProps, "error" | "errorId" | "readOnly">,
|
|
6
|
+
Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "value"> {
|
|
7
|
+
/**
|
|
8
|
+
* Radio label
|
|
9
|
+
*/
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* The value of the HTML element
|
|
13
|
+
*/
|
|
14
|
+
value: any;
|
|
15
|
+
/**
|
|
16
|
+
* Adds a description to extend labling of Radio
|
|
17
|
+
*/
|
|
18
|
+
description?: string;
|
|
19
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
+
import { omit } from "../../util";
|
|
2
3
|
import { useFormField } from "../useFormField";
|
|
3
|
-
import { RadioProps } from "./Radio";
|
|
4
4
|
import { RadioGroupContext } from "./RadioGroup";
|
|
5
|
-
import {
|
|
5
|
+
import { RadioProps } from "./types";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Handles props for Radios in context with Fieldset and RadioGroup
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MagnifyingGlassIcon, XMarkIcon } from "@navikt/aksel-icons";
|
|
2
2
|
import cl from "clsx";
|
|
3
3
|
import React, {
|
|
4
|
-
forwardRef,
|
|
5
4
|
InputHTMLAttributes,
|
|
5
|
+
forwardRef,
|
|
6
6
|
useCallback,
|
|
7
7
|
useMemo,
|
|
8
8
|
useRef,
|
|
9
9
|
useState,
|
|
10
10
|
} from "react";
|
|
11
|
-
import { BodyShort, ErrorMessage, Label
|
|
11
|
+
import { BodyShort, ErrorMessage, Label } from "../../typography";
|
|
12
|
+
import { mergeRefs, omit } from "../../util";
|
|
12
13
|
import { FormFieldProps, useFormField } from "../useFormField";
|
|
13
14
|
import SearchButton, { SearchButtonType } from "./SearchButton";
|
|
15
|
+
import { SearchContext } from "./context";
|
|
14
16
|
|
|
15
17
|
export type SearchClearEvent =
|
|
16
18
|
| {
|
|
@@ -73,17 +75,6 @@ interface SearchComponent
|
|
|
73
75
|
Button: SearchButtonType;
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
export interface SearchContextProps {
|
|
77
|
-
disabled?: boolean;
|
|
78
|
-
size: "medium" | "small";
|
|
79
|
-
variant: "primary" | "secondary" | "simple";
|
|
80
|
-
handleClick: () => void;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export const SearchContext = React.createContext<SearchContextProps | null>(
|
|
84
|
-
null
|
|
85
|
-
);
|
|
86
|
-
|
|
87
78
|
/**
|
|
88
79
|
* A component that displays a search input field.
|
|
89
80
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { MagnifyingGlassIcon } from "@navikt/aksel-icons";
|
|
1
2
|
import cl from "clsx";
|
|
2
3
|
import React, { forwardRef, useContext } from "react";
|
|
3
|
-
import { Button, ButtonProps } from "
|
|
4
|
-
import { SearchContext } from "./
|
|
5
|
-
import { MagnifyingGlassIcon } from "@navikt/aksel-icons";
|
|
4
|
+
import { Button, ButtonProps } from "../../button";
|
|
5
|
+
import { SearchContext } from "./context";
|
|
6
6
|
|
|
7
7
|
export interface SearchButtonProps
|
|
8
8
|
extends Omit<ButtonProps, "size" | "children" | "variant"> {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
|
|
3
|
+
export interface SearchContextProps {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
size: "medium" | "small";
|
|
6
|
+
variant: "primary" | "secondary" | "simple";
|
|
7
|
+
handleClick: () => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const SearchContext = createContext<SearchContextProps | null>(null);
|
package/src/form/useFormField.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { useContext } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
3
|
-
import {
|
|
4
|
-
import { useId } from "../
|
|
2
|
+
import React, { useContext } from "react";
|
|
3
|
+
import { useId } from "../util";
|
|
4
|
+
import { FieldsetContext } from "./Fieldset/context";
|
|
5
5
|
|
|
6
6
|
export interface FormFieldProps {
|
|
7
7
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { Popover, PopoverProps
|
|
3
|
+
import { Popover, PopoverProps } from "../popover";
|
|
4
|
+
import { mergeRefs } from "../util";
|
|
4
5
|
import { HelpTextIcon } from "./HelpTextIcon";
|
|
5
6
|
|
|
6
7
|
export interface HelpTextProps
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
|
-
import { Panel, OverridableComponent } from "..";
|
|
3
2
|
|
|
4
3
|
import cl from "clsx";
|
|
5
4
|
import { LinkPanelTitle, LinkPanelTitleProps } from "./LinkPanelTitle";
|
|
@@ -8,6 +7,8 @@ import {
|
|
|
8
7
|
LinkPanelDescriptionProps,
|
|
9
8
|
} from "./LinkPanelDescription";
|
|
10
9
|
import { ChevronRightIcon } from "@navikt/aksel-icons";
|
|
10
|
+
import { OverridableComponent } from "../util";
|
|
11
|
+
import { Panel } from "../panel";
|
|
11
12
|
|
|
12
13
|
export interface LinkPanelProps
|
|
13
14
|
extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
package/src/list/List.tsx
CHANGED
|
@@ -1,58 +1,21 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { forwardRef, useContext } from "react";
|
|
3
3
|
import { BodyShort, Heading } from "../typography";
|
|
4
4
|
import { useId } from "../util/useId";
|
|
5
|
-
import { ListItem
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
/**
|
|
10
|
-
* HTML list element to render
|
|
11
|
-
* @default "ul"
|
|
12
|
-
*/
|
|
13
|
-
as?: "ul" | "ol";
|
|
14
|
-
/**
|
|
15
|
-
* List heading title
|
|
16
|
-
*/
|
|
17
|
-
title?: string;
|
|
18
|
-
/**
|
|
19
|
-
* List heading description
|
|
20
|
-
*/
|
|
21
|
-
description?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Allows setting a different HTML h-tag
|
|
24
|
-
* @default "h3"
|
|
25
|
-
*/
|
|
26
|
-
headingTag?: React.ElementType<any>;
|
|
27
|
-
/**
|
|
28
|
-
* Changes padding, height and font-size
|
|
29
|
-
* @default medium
|
|
30
|
-
*/
|
|
31
|
-
size?: "medium" | "small";
|
|
32
|
-
}
|
|
5
|
+
import { ListItem } from "./ListItem";
|
|
6
|
+
import { ListContext } from "./context";
|
|
7
|
+
import { ListProps } from "./types";
|
|
33
8
|
|
|
34
9
|
export interface ListComponent
|
|
35
|
-
extends React.ForwardRefExoticComponent<
|
|
10
|
+
extends React.ForwardRefExoticComponent<
|
|
11
|
+
ListProps & React.RefAttributes<HTMLDivElement>
|
|
12
|
+
> {
|
|
36
13
|
/**
|
|
37
14
|
* @see 🏷️ {@link ListItemProps}
|
|
38
15
|
*/
|
|
39
|
-
Item:
|
|
40
|
-
ListItemProps & React.RefAttributes<HTMLLIElement>
|
|
41
|
-
>;
|
|
16
|
+
Item: typeof ListItem;
|
|
42
17
|
}
|
|
43
18
|
|
|
44
|
-
interface ListContextProps {
|
|
45
|
-
listType: ListProps["as"];
|
|
46
|
-
isNested: boolean | null;
|
|
47
|
-
size: ListProps["size"];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export const ListContext = createContext<ListContextProps>({
|
|
51
|
-
listType: "ul",
|
|
52
|
-
isNested: null,
|
|
53
|
-
size: "medium",
|
|
54
|
-
});
|
|
55
|
-
|
|
56
19
|
export const List = forwardRef<HTMLDivElement, ListProps>(
|
|
57
20
|
(
|
|
58
21
|
{
|
package/src/list/ListItem.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef, useContext } from "react";
|
|
3
3
|
import { BodyShort, Label } from "../typography";
|
|
4
|
-
import { ListContext } from "./
|
|
4
|
+
import { ListContext } from "./context";
|
|
5
5
|
|
|
6
6
|
export interface ListItemProps extends React.HTMLAttributes<HTMLLIElement> {
|
|
7
7
|
/**
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
import { ListProps } from "./types";
|
|
3
|
+
|
|
4
|
+
interface ListContextProps {
|
|
5
|
+
listType: ListProps["as"];
|
|
6
|
+
isNested: boolean | null;
|
|
7
|
+
size: ListProps["size"];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const ListContext = createContext<ListContextProps>({
|
|
11
|
+
listType: "ul",
|
|
12
|
+
isNested: null,
|
|
13
|
+
size: "medium",
|
|
14
|
+
});
|
package/src/list/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as List } from "./List";
|
|
2
|
-
export type { ListProps } from "./
|
|
2
|
+
export type { ListProps } from "./types";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface ListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
/**
|
|
4
|
+
* HTML list element to render
|
|
5
|
+
* @default "ul"
|
|
6
|
+
*/
|
|
7
|
+
as?: "ul" | "ol";
|
|
8
|
+
/**
|
|
9
|
+
* List heading title
|
|
10
|
+
*/
|
|
11
|
+
title?: string;
|
|
12
|
+
/**
|
|
13
|
+
* List heading description
|
|
14
|
+
*/
|
|
15
|
+
description?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Allows setting a different HTML h-tag
|
|
18
|
+
* @default "h3"
|
|
19
|
+
*/
|
|
20
|
+
headingTag?: React.ElementType<any>;
|
|
21
|
+
/**
|
|
22
|
+
* Changes padding, height and font-size
|
|
23
|
+
* @default medium
|
|
24
|
+
*/
|
|
25
|
+
size?: "medium" | "small";
|
|
26
|
+
}
|
package/src/loader/Loader.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { forwardRef, SVGProps } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
3
|
-
import {
|
|
2
|
+
import React, { forwardRef, SVGProps } from "react";
|
|
3
|
+
import { omit, useId } from "../util";
|
|
4
4
|
|
|
5
5
|
export interface LoaderProps extends SVGProps<SVGSVGElement> {
|
|
6
6
|
/**
|
package/src/modal/Modal.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useFloatingPortalNode } from "@floating-ui/react";
|
|
2
|
+
import cl from "clsx";
|
|
1
3
|
import React, {
|
|
2
4
|
forwardRef,
|
|
3
5
|
useContext,
|
|
@@ -6,80 +8,16 @@ import React, {
|
|
|
6
8
|
useRef,
|
|
7
9
|
} from "react";
|
|
8
10
|
import { createPortal } from "react-dom";
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { Detail, Heading, mergeRefs, useId, useProvider } from "..";
|
|
11
|
+
import { useProvider } from "../provider";
|
|
12
|
+
import { Detail, Heading } from "../typography";
|
|
13
|
+
import { mergeRefs, useId } from "../util";
|
|
13
14
|
import ModalBody from "./ModalBody";
|
|
14
|
-
import
|
|
15
|
+
import { ModalContext } from "./ModalContext";
|
|
15
16
|
import ModalFooter from "./ModalFooter";
|
|
17
|
+
import ModalHeader from "./ModalHeader";
|
|
16
18
|
import { getCloseHandler, useBodyScrollLock } from "./ModalUtils";
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
export interface ModalProps
|
|
20
|
-
extends React.DialogHTMLAttributes<HTMLDialogElement> {
|
|
21
|
-
/**
|
|
22
|
-
* Content for the header. Alteratively you can use <Modal.Header> instead for more control,
|
|
23
|
-
* but then you have to set `aria-label` or `aria-labelledby` on the modal manually.
|
|
24
|
-
*/
|
|
25
|
-
header?: {
|
|
26
|
-
label?: string;
|
|
27
|
-
icon?: React.ReactNode;
|
|
28
|
-
heading: string;
|
|
29
|
-
/**
|
|
30
|
-
* Heading size
|
|
31
|
-
* @default "medium"
|
|
32
|
-
* */
|
|
33
|
-
size?: "medium" | "small";
|
|
34
|
-
/**
|
|
35
|
-
* Removes close-button (X) when false
|
|
36
|
-
* @default true
|
|
37
|
-
*/
|
|
38
|
-
closeButton?: boolean;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Modal content
|
|
42
|
-
*/
|
|
43
|
-
children: React.ReactNode;
|
|
44
|
-
/**
|
|
45
|
-
* Whether the modal should be visible or not.
|
|
46
|
-
* Remember to use the `onClose` callback to keep your local state in sync.
|
|
47
|
-
* You can also use `ref.current.openModal()` and `ref.current.close()`.
|
|
48
|
-
*/
|
|
49
|
-
open?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Called when the modal has been closed
|
|
52
|
-
*/
|
|
53
|
-
onClose?: React.ReactEventHandler<HTMLDialogElement>;
|
|
54
|
-
/**
|
|
55
|
-
* Called when the user wants to close the modal (clicked the close button or pressed Esc).
|
|
56
|
-
* @returns Whether to close the modal
|
|
57
|
-
*/
|
|
58
|
-
onBeforeClose?: () => boolean | void;
|
|
59
|
-
/**
|
|
60
|
-
* Called when the user presses the Esc key, unless `onBeforeClose()` returns `false`.
|
|
61
|
-
*/
|
|
62
|
-
onCancel?: React.ReactEventHandler<HTMLDialogElement>;
|
|
63
|
-
/**
|
|
64
|
-
* @default fit-content (up to 700px)
|
|
65
|
-
* */
|
|
66
|
-
width?: "medium" | "small" | number | `${number}${string}`;
|
|
67
|
-
/**
|
|
68
|
-
* Lets you render the modal into a different part of the DOM.
|
|
69
|
-
* Will use `rootElement` from `Provider` if defined, otherwise `document.body`.
|
|
70
|
-
*/
|
|
71
|
-
portal?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* User defined classname for modal
|
|
74
|
-
*/
|
|
75
|
-
className?: string;
|
|
76
|
-
/**
|
|
77
|
-
* Sets aria-labelledby on modal.
|
|
78
|
-
* No need to set this manually if the `header` prop is used. A reference to `header.heading` will be created automatically.
|
|
79
|
-
* @warning If not using `header`, you should set either `aria-labelledby` or `aria-label`.
|
|
80
|
-
*/
|
|
81
|
-
"aria-labelledby"?: string;
|
|
82
|
-
}
|
|
19
|
+
import dialogPolyfill, { needPolyfill } from "./dialog-polyfill";
|
|
20
|
+
import { ModalProps } from "./types";
|
|
83
21
|
|
|
84
22
|
interface ModalComponent
|
|
85
23
|
extends React.ForwardRefExoticComponent<
|
package/src/modal/ModalUtils.ts
CHANGED
package/src/modal/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { default as Modal
|
|
2
|
-
export { type ModalHeaderProps } from "./ModalHeader";
|
|
1
|
+
export { default as Modal } from "./Modal";
|
|
3
2
|
export { type ModalBodyProps } from "./ModalBody";
|
|
4
3
|
export { type ModalFooterProps } from "./ModalFooter";
|
|
4
|
+
export { type ModalHeaderProps } from "./ModalHeader";
|
|
5
|
+
export { type ModalProps } from "./types";
|