@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
package/src/date/index.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
export { type DateInputProps } from "./DateInput";
|
|
2
2
|
export {
|
|
3
|
-
type DatePickerProps,
|
|
4
3
|
default as DatePicker,
|
|
4
|
+
type DatePickerProps,
|
|
5
5
|
} from "./datepicker/DatePicker";
|
|
6
6
|
export { type DatePickerStandaloneProps } from "./datepicker/DatePickerStandalone";
|
|
7
|
-
export { type MonthPickerStandaloneProps } from "./monthpicker/MonthPickerStandalone";
|
|
8
7
|
export {
|
|
9
8
|
useDatepicker,
|
|
10
9
|
useMonthpicker,
|
|
11
10
|
useRangeDatepicker,
|
|
12
|
-
type RangeValidationT,
|
|
13
11
|
type DateValidationT,
|
|
14
12
|
type MonthValidationT,
|
|
13
|
+
type RangeValidationT,
|
|
15
14
|
} from "./hooks";
|
|
16
|
-
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from "./monthpicker/MonthPicker";
|
|
15
|
+
export { default as MonthPicker } from "./monthpicker/MonthPicker";
|
|
16
|
+
export { type MonthPickerStandaloneProps } from "./monthpicker/MonthPickerStandalone";
|
|
17
|
+
export { type MonthPickerProps } from "./monthpicker/types";
|
|
@@ -4,10 +4,11 @@ import startOfMonth from "date-fns/startOfMonth";
|
|
|
4
4
|
import startOfYear from "date-fns/startOfYear";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { useDayPicker } from "react-day-picker";
|
|
7
|
-
import { Button, Select } from "../..";
|
|
8
7
|
import { useSharedMonthContext } from "../context";
|
|
9
8
|
import { labelNextYear, labelPrevYear } from "../utils";
|
|
10
9
|
import { isAfter, isBefore } from "date-fns";
|
|
10
|
+
import { Button } from "../../button";
|
|
11
|
+
import { Select } from "../../form/Select";
|
|
11
12
|
|
|
12
13
|
export const MonthCaption = () => {
|
|
13
14
|
const {
|
|
@@ -1,97 +1,15 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef, useRef, useState } from "react";
|
|
3
3
|
import { RootProvider } from "react-day-picker";
|
|
4
|
-
import { Popover
|
|
5
|
-
import {
|
|
4
|
+
import { Popover } from "../../popover";
|
|
5
|
+
import { useId } from "../../util";
|
|
6
|
+
import { MonthPickerInput } from "../DateInput";
|
|
6
7
|
import { DateContext, SharedMonthProvider } from "../context";
|
|
7
|
-
import { getLocaleFromString
|
|
8
|
+
import { getLocaleFromString } from "../utils";
|
|
8
9
|
import MonthCaption from "./MonthCaption";
|
|
9
|
-
import MonthPickerStandalone
|
|
10
|
-
MonthPickerStandaloneType,
|
|
11
|
-
} from "./MonthPickerStandalone";
|
|
10
|
+
import MonthPickerStandalone from "./MonthPickerStandalone";
|
|
12
11
|
import MonthSelector from "./MonthSelector";
|
|
13
|
-
|
|
14
|
-
export interface MonthPickerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
15
|
-
/**
|
|
16
|
-
* Element monthpicker anchors to. Use <MonthPicker.Input /> for built-in toggle,
|
|
17
|
-
* or make your own with the open/onClose props
|
|
18
|
-
*/
|
|
19
|
-
children?: React.ReactNode;
|
|
20
|
-
/**
|
|
21
|
-
* Classname for datepicker in popover
|
|
22
|
-
*/
|
|
23
|
-
className?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Classname for wrapper
|
|
26
|
-
*/
|
|
27
|
-
wrapperClassName?: string;
|
|
28
|
-
/**
|
|
29
|
-
* The earliest month to start navigation.
|
|
30
|
-
*/
|
|
31
|
-
fromDate?: Date;
|
|
32
|
-
/**
|
|
33
|
-
* The latest day to end navigation.
|
|
34
|
-
*/
|
|
35
|
-
toDate?: Date;
|
|
36
|
-
/**
|
|
37
|
-
* Changes monthpicker locale
|
|
38
|
-
* @default "nb" (norsk bokmål)
|
|
39
|
-
*/
|
|
40
|
-
locale?: "nb" | "nn" | "en";
|
|
41
|
-
/**
|
|
42
|
-
* Display dropdown for choosing year. Needs `fromDate` + `toDate` to work.
|
|
43
|
-
* @default false
|
|
44
|
-
*/
|
|
45
|
-
dropdownCaption?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Apply the disabled modifier to the matching months. Uses a subset of React Day Picker Matcher type. https://react-day-picker.js.org/api/types/Matcher
|
|
48
|
-
*/
|
|
49
|
-
disabled?: Matcher[];
|
|
50
|
-
/**
|
|
51
|
-
* Controlled selected-month
|
|
52
|
-
*/
|
|
53
|
-
selected?: Date;
|
|
54
|
-
/**
|
|
55
|
-
* Default selected month.
|
|
56
|
-
*/
|
|
57
|
-
defaultSelected?: Date;
|
|
58
|
-
/**
|
|
59
|
-
* Open state for user-controlled state. Component controlled by default
|
|
60
|
-
*/
|
|
61
|
-
open?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* onClose callback for user-controlled state
|
|
64
|
-
*/
|
|
65
|
-
onClose?: () => void;
|
|
66
|
-
/**
|
|
67
|
-
* onOpenToggle callback for user-controlled-state. Only called if `<MonthPicker.Input />` is used
|
|
68
|
-
*/
|
|
69
|
-
onOpenToggle?: () => void;
|
|
70
|
-
/**
|
|
71
|
-
* Callback for user-controlled state
|
|
72
|
-
*/
|
|
73
|
-
onMonthSelect?: (month?: Date) => void;
|
|
74
|
-
/**
|
|
75
|
-
* Used to set visible year programmatically. Component controlled by default
|
|
76
|
-
*/
|
|
77
|
-
year?: Date;
|
|
78
|
-
/**
|
|
79
|
-
* Event fired when the user navigates between years.
|
|
80
|
-
*/
|
|
81
|
-
onYearChange?: (y?: Date) => void;
|
|
82
|
-
/**
|
|
83
|
-
* Avoid using if possible!
|
|
84
|
-
* Changes what CSS position property to use
|
|
85
|
-
* You want to use "fixed" if parent wrapper has position relative, but you want popover to escape
|
|
86
|
-
* @default "absolute"
|
|
87
|
-
*/
|
|
88
|
-
strategy?: "absolute" | "fixed";
|
|
89
|
-
/**
|
|
90
|
-
* Bubbles Escape keydown-event up trough DOM-tree. This is set to false by default to prevent closing components like Modal on Escape
|
|
91
|
-
* @default false
|
|
92
|
-
*/
|
|
93
|
-
bubbleEscape?: boolean;
|
|
94
|
-
}
|
|
12
|
+
import { MonthPickerProps } from "./types";
|
|
95
13
|
|
|
96
14
|
interface MonthPickerComponent
|
|
97
15
|
extends React.ForwardRefExoticComponent<MonthPickerProps> {
|
|
@@ -105,14 +23,12 @@ interface MonthPickerComponent
|
|
|
105
23
|
* />
|
|
106
24
|
* ```
|
|
107
25
|
*/
|
|
108
|
-
Standalone:
|
|
26
|
+
Standalone: typeof MonthPickerStandalone;
|
|
109
27
|
/**
|
|
110
28
|
* Custom TextField for MonthPicker
|
|
111
29
|
* @see 🏷️ {@link DateInputProps}
|
|
112
30
|
*/
|
|
113
|
-
Input:
|
|
114
|
-
DateInputProps & React.RefAttributes<HTMLInputElement>
|
|
115
|
-
>;
|
|
31
|
+
Input: typeof MonthPickerInput;
|
|
116
32
|
}
|
|
117
33
|
|
|
118
34
|
/**
|
|
@@ -211,6 +127,7 @@ export const MonthPicker = forwardRef<HTMLDivElement, MonthPickerProps>(
|
|
|
211
127
|
className="navds-date navds-date__popover"
|
|
212
128
|
strategy={strategy}
|
|
213
129
|
bubbleEscape={bubbleEscape}
|
|
130
|
+
flip={false}
|
|
214
131
|
>
|
|
215
132
|
<RootProvider
|
|
216
133
|
locale={getLocaleFromString(locale)}
|
|
@@ -4,8 +4,8 @@ import { RootProvider } from "react-day-picker";
|
|
|
4
4
|
import { SharedMonthProvider } from "../context";
|
|
5
5
|
import { getLocaleFromString } from "../utils";
|
|
6
6
|
import MonthCaption from "./MonthCaption";
|
|
7
|
-
import { MonthPickerProps } from "./MonthPicker";
|
|
8
7
|
import MonthSelector from "./MonthSelector";
|
|
8
|
+
import { MonthPickerProps } from "./types";
|
|
9
9
|
|
|
10
10
|
export interface MonthPickerStandaloneProps
|
|
11
11
|
extends Omit<
|
|
@@ -3,7 +3,7 @@ import setMonth from "date-fns/setMonth";
|
|
|
3
3
|
import setYear from "date-fns/setYear";
|
|
4
4
|
import startOfMonth from "date-fns/startOfMonth";
|
|
5
5
|
import React, { useState } from "react";
|
|
6
|
-
import { BodyShort } from "
|
|
6
|
+
import { BodyShort } from "../../typography";
|
|
7
7
|
import { useSharedMonthContext } from "../context";
|
|
8
8
|
import { isMatch } from "../utils";
|
|
9
9
|
import MonthButton from "./MonthButton";
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Matcher } from "../utils";
|
|
2
|
+
|
|
3
|
+
export interface MonthPickerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Element monthpicker anchors to. Use <MonthPicker.Input /> for built-in toggle,
|
|
6
|
+
* or make your own with the open/onClose props
|
|
7
|
+
*/
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Classname for datepicker in popover
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Classname for wrapper
|
|
15
|
+
*/
|
|
16
|
+
wrapperClassName?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The earliest month to start navigation.
|
|
19
|
+
*/
|
|
20
|
+
fromDate?: Date;
|
|
21
|
+
/**
|
|
22
|
+
* The latest day to end navigation.
|
|
23
|
+
*/
|
|
24
|
+
toDate?: Date;
|
|
25
|
+
/**
|
|
26
|
+
* Changes monthpicker locale
|
|
27
|
+
* @default "nb" (norsk bokmål)
|
|
28
|
+
*/
|
|
29
|
+
locale?: "nb" | "nn" | "en";
|
|
30
|
+
/**
|
|
31
|
+
* Display dropdown for choosing year. Needs `fromDate` + `toDate` to work.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
dropdownCaption?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Apply the disabled modifier to the matching months. Uses a subset of React Day Picker Matcher type. https://react-day-picker.js.org/api/types/Matcher
|
|
37
|
+
*/
|
|
38
|
+
disabled?: Matcher[];
|
|
39
|
+
/**
|
|
40
|
+
* Controlled selected-month
|
|
41
|
+
*/
|
|
42
|
+
selected?: Date;
|
|
43
|
+
/**
|
|
44
|
+
* Default selected month.
|
|
45
|
+
*/
|
|
46
|
+
defaultSelected?: Date;
|
|
47
|
+
/**
|
|
48
|
+
* Open state for user-controlled state. Component controlled by default
|
|
49
|
+
*/
|
|
50
|
+
open?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* onClose callback for user-controlled state
|
|
53
|
+
*/
|
|
54
|
+
onClose?: () => void;
|
|
55
|
+
/**
|
|
56
|
+
* onOpenToggle callback for user-controlled-state. Only called if `<MonthPicker.Input />` is used
|
|
57
|
+
*/
|
|
58
|
+
onOpenToggle?: () => void;
|
|
59
|
+
/**
|
|
60
|
+
* Callback for user-controlled state
|
|
61
|
+
*/
|
|
62
|
+
onMonthSelect?: (month?: Date) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Used to set visible year programmatically. Component controlled by default
|
|
65
|
+
*/
|
|
66
|
+
year?: Date;
|
|
67
|
+
/**
|
|
68
|
+
* Event fired when the user navigates between years.
|
|
69
|
+
*/
|
|
70
|
+
onYearChange?: (y?: Date) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Avoid using if possible!
|
|
73
|
+
* Changes what CSS position property to use
|
|
74
|
+
* You want to use "fixed" if parent wrapper has position relative, but you want popover to escape
|
|
75
|
+
* @default "absolute"
|
|
76
|
+
*/
|
|
77
|
+
strategy?: "absolute" | "fixed";
|
|
78
|
+
/**
|
|
79
|
+
* Bubbles Escape keydown-event up trough DOM-tree. This is set to false by default to prevent closing components like Modal on Escape
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
bubbleEscape?: boolean;
|
|
83
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import Toggle, { ToggleProps } from "./Toggle";
|
|
1
|
+
import React, { useState } from "react";
|
|
3
2
|
import Menu, { MenuType } from "./Menu";
|
|
3
|
+
import Toggle, { ToggleProps } from "./Toggle";
|
|
4
|
+
import { DropdownContext } from "./context";
|
|
4
5
|
|
|
5
6
|
export interface DropdownProps {
|
|
6
7
|
children: React.ReactNode;
|
|
@@ -36,16 +37,6 @@ export interface DropdownType extends React.FC<DropdownProps> {
|
|
|
36
37
|
Menu: MenuType;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
export interface DropdownContextType {
|
|
40
|
-
readonly isOpen: boolean;
|
|
41
|
-
handleToggle: (v: boolean) => void;
|
|
42
|
-
readonly anchorEl: Element | null;
|
|
43
|
-
setAnchorEl: React.Dispatch<React.SetStateAction<Element | null>>;
|
|
44
|
-
onSelect: (element: React.MouseEvent) => void;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const DropdownContext = createContext<DropdownContextType | null>(null);
|
|
48
|
-
|
|
49
40
|
/**
|
|
50
41
|
* A component that displays a dropdown menu when the user clicks on its toggle button.
|
|
51
42
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { OverridableComponent } from "../../../util/OverridableComponent";
|
|
2
1
|
import cl from "clsx";
|
|
3
2
|
import React, { forwardRef, useContext } from "react";
|
|
4
|
-
import {
|
|
3
|
+
import { OverridableComponent } from "../../../util";
|
|
4
|
+
import { DropdownContext } from "../../context";
|
|
5
5
|
|
|
6
6
|
export interface GroupedItemProps
|
|
7
7
|
extends React.ButtonHTMLAttributes<HTMLElement> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../../../util
|
|
3
|
+
import { OverridableComponent } from "../../../util";
|
|
4
4
|
import GroupedHeading, { GroupedHeadingProps } from "./GroupedHeading";
|
|
5
5
|
import GroupedItem, { GroupedItemProps } from "./GroupedItem";
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { forwardRef, useContext } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import React, { forwardRef, useContext } from "react";
|
|
3
|
+
import { OverridableComponent } from "../../../util";
|
|
4
|
+
import { DropdownContext } from "../../context";
|
|
5
5
|
|
|
6
6
|
export interface ListItemProps extends React.ButtonHTMLAttributes<HTMLElement> {
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
import { OverridableComponent } from "../../../util
|
|
3
|
+
import { OverridableComponent } from "../../../util";
|
|
4
4
|
import ListItem, { ListItemProps } from "./Item";
|
|
5
5
|
|
|
6
6
|
export interface ListProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef, useContext } from "react";
|
|
3
3
|
import { Popover } from "../../popover";
|
|
4
|
-
import { DropdownContext } from "../
|
|
4
|
+
import { DropdownContext } from "../context";
|
|
5
5
|
import Divider from "./Divider";
|
|
6
6
|
import GroupedList, { GroupedListType } from "./GroupedList";
|
|
7
7
|
import List, { ListType } from "./List";
|
package/src/dropdown/Toggle.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { forwardRef, useContext } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
3
|
-
import {
|
|
2
|
+
import React, { forwardRef, useContext } from "react";
|
|
3
|
+
import { DropdownContext } from "./context";
|
|
4
4
|
|
|
5
5
|
export interface ToggleProps
|
|
6
6
|
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
|
|
3
|
+
export interface DropdownContextType {
|
|
4
|
+
readonly isOpen: boolean;
|
|
5
|
+
handleToggle: (v: boolean) => void;
|
|
6
|
+
readonly anchorEl: Element | null;
|
|
7
|
+
setAnchorEl: React.Dispatch<React.SetStateAction<Element | null>>;
|
|
8
|
+
onSelect: (element: React.MouseEvent) => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const DropdownContext = createContext<DropdownContextType | null>(null);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
|
-
import React, {
|
|
3
|
-
import { OverridableComponent } from "../util
|
|
2
|
+
import React, { forwardRef, useRef, useState } from "react";
|
|
3
|
+
import { OverridableComponent } from "../util";
|
|
4
4
|
import ExpansionCardContent, {
|
|
5
5
|
ExpansionCardContentProps,
|
|
6
6
|
} from "./ExpansionCardContent";
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
ExpansionCardTitle,
|
|
16
16
|
ExpansionCardTitleProps,
|
|
17
17
|
} from "./ExpansionCardTitle";
|
|
18
|
+
import { ExpansionCardContext } from "./context";
|
|
18
19
|
|
|
19
20
|
interface ExpansionCardComponent
|
|
20
21
|
extends React.ForwardRefExoticComponent<
|
|
@@ -82,18 +83,6 @@ type ExpansionCardConditionalProps =
|
|
|
82
83
|
"aria-labelledby": string;
|
|
83
84
|
};
|
|
84
85
|
|
|
85
|
-
export type ExpansionCardContextProps = {
|
|
86
|
-
open: boolean;
|
|
87
|
-
toggleOpen: () => void;
|
|
88
|
-
size: "medium" | "small";
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export const ExpansionCardContext = createContext<ExpansionCardContextProps>({
|
|
92
|
-
open: false,
|
|
93
|
-
toggleOpen: () => {},
|
|
94
|
-
size: "medium",
|
|
95
|
-
});
|
|
96
|
-
|
|
97
86
|
export type ExpansionCardProps = ExpansionCardCommonProps &
|
|
98
87
|
ExpansionCardConditionalProps;
|
|
99
88
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef, useContext } from "react";
|
|
3
|
-
import { BodyLong } from "../typography
|
|
4
|
-
import { ExpansionCardContext } from "./
|
|
3
|
+
import { BodyLong } from "../typography";
|
|
4
|
+
import { ExpansionCardContext } from "./context";
|
|
5
5
|
|
|
6
6
|
export interface ExpansionCardContentProps
|
|
7
7
|
extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { forwardRef, useContext } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import React, { forwardRef, useContext } from "react";
|
|
3
|
+
import { BodyLong } from "../typography";
|
|
4
|
+
import { ExpansionCardContext } from "./context";
|
|
5
5
|
|
|
6
6
|
export interface ExpansionCardDescriptionProps
|
|
7
7
|
extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
1
2
|
import cl from "clsx";
|
|
2
3
|
import React, { forwardRef, useContext } from "react";
|
|
3
|
-
import { ExpansionCardContext } from "./
|
|
4
|
-
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
4
|
+
import { ExpansionCardContext } from "./context";
|
|
5
5
|
|
|
6
6
|
export interface ExpansionCardHeaderProps
|
|
7
7
|
extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
3
|
-
import {
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
|
+
import { OverridableComponent } from "../util";
|
|
4
4
|
|
|
5
5
|
export interface ExpansionCardTitleProps
|
|
6
6
|
extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
|
|
3
|
+
export type ExpansionCardContextProps = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
toggleOpen: () => void;
|
|
6
|
+
size: "medium" | "small";
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const ExpansionCardContext = createContext<ExpansionCardContextProps>({
|
|
10
|
+
open: false,
|
|
11
|
+
toggleOpen: () => {},
|
|
12
|
+
size: "medium",
|
|
13
|
+
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
3
|
-
import
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
|
+
import { BodyLong, ErrorMessage } from "../typography";
|
|
4
|
+
import { useId } from "../util";
|
|
5
|
+
import { Checkbox, CheckboxProps } from "./checkbox";
|
|
4
6
|
import { useFormField } from "./useFormField";
|
|
5
7
|
|
|
6
8
|
export interface ConfirmationPanelProps
|
|
@@ -1,36 +1,11 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { FieldsetHTMLAttributes, forwardRef, useContext } from "react";
|
|
3
|
-
import { BodyShort, ErrorMessage, Label
|
|
3
|
+
import { BodyShort, ErrorMessage, Label } from "../../typography";
|
|
4
|
+
import { omit } from "../../util";
|
|
5
|
+
import { ReadOnlyIcon } from "../ReadOnlyIcon";
|
|
4
6
|
import { FormFieldProps } from "../useFormField";
|
|
7
|
+
import { FieldsetContext } from "./context";
|
|
5
8
|
import { useFieldset } from "./useFieldset";
|
|
6
|
-
import { ReadOnlyIcon } from "../ReadOnlyIcon";
|
|
7
|
-
|
|
8
|
-
export type FieldsetContextProps = {
|
|
9
|
-
/**
|
|
10
|
-
* Error message applied to element,
|
|
11
|
-
*/
|
|
12
|
-
error?: React.ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
* Overrides internal errorId
|
|
15
|
-
*/
|
|
16
|
-
errorId: string;
|
|
17
|
-
/**
|
|
18
|
-
* Changes paddings, margins and font-sizes
|
|
19
|
-
*/
|
|
20
|
-
size: "medium" | "small";
|
|
21
|
-
/**
|
|
22
|
-
* Sets fieldset and all form-children to disabled
|
|
23
|
-
*/
|
|
24
|
-
disabled: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Read only-state
|
|
27
|
-
*/
|
|
28
|
-
readOnly?: boolean;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const FieldsetContext = React.createContext<FieldsetContextProps | null>(
|
|
32
|
-
null
|
|
33
|
-
);
|
|
34
9
|
|
|
35
10
|
export interface FieldsetProps
|
|
36
11
|
extends FormFieldProps,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
|
|
3
|
+
export type FieldsetContextProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Error message applied to element,
|
|
6
|
+
*/
|
|
7
|
+
error?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Overrides internal errorId
|
|
10
|
+
*/
|
|
11
|
+
errorId: string;
|
|
12
|
+
/**
|
|
13
|
+
* Changes paddings, margins and font-sizes
|
|
14
|
+
*/
|
|
15
|
+
size: "medium" | "small";
|
|
16
|
+
/**
|
|
17
|
+
* Sets fieldset and all form-children to disabled
|
|
18
|
+
*/
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Read only-state
|
|
22
|
+
*/
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const FieldsetContext = createContext<FieldsetContextProps | null>(null);
|
package/src/form/Select.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
1
2
|
import cl from "clsx";
|
|
2
3
|
import React, { forwardRef, SelectHTMLAttributes } from "react";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import { BodyShort, ErrorMessage, Label, omit } from "..";
|
|
6
|
-
import { FormFieldProps, useFormField } from "./useFormField";
|
|
4
|
+
import { BodyShort, ErrorMessage, Label } from "../typography";
|
|
5
|
+
import { omit } from "../util";
|
|
7
6
|
import { ReadOnlyIcon } from "./ReadOnlyIcon";
|
|
7
|
+
import { FormFieldProps, useFormField } from "./useFormField";
|
|
8
8
|
|
|
9
9
|
export interface SelectProps
|
|
10
10
|
extends FormFieldProps,
|
package/src/form/Switch.tsx
CHANGED
|
@@ -5,9 +5,11 @@ import React, {
|
|
|
5
5
|
useEffect,
|
|
6
6
|
useState,
|
|
7
7
|
} from "react";
|
|
8
|
-
import { BodyShort, Loader, omit } from "..";
|
|
9
8
|
import { FormFieldProps, useFormField } from "./useFormField";
|
|
10
9
|
import { ReadOnlyIcon } from "./ReadOnlyIcon";
|
|
10
|
+
import { Loader } from "../loader";
|
|
11
|
+
import { BodyShort } from "../typography";
|
|
12
|
+
import { omit } from "../util";
|
|
11
13
|
|
|
12
14
|
const SelectedIcon = () => (
|
|
13
15
|
<svg
|
package/src/form/TextField.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef, InputHTMLAttributes } from "react";
|
|
3
|
-
import { BodyShort, ErrorMessage, Label
|
|
3
|
+
import { BodyShort, ErrorMessage, Label } from "../typography";
|
|
4
|
+
import { omit } from "../util";
|
|
4
5
|
import { ReadOnlyIcon } from "./ReadOnlyIcon";
|
|
5
6
|
import { FormFieldProps, useFormField } from "./useFormField";
|
|
6
7
|
|
package/src/form/Textarea.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef, useState } from "react";
|
|
3
|
-
import { BodyShort, ErrorMessage, Label
|
|
3
|
+
import { BodyShort, ErrorMessage, Label } from "../typography";
|
|
4
4
|
import TextareaAutosize from "../util/TextareaAutoSize";
|
|
5
5
|
import { FormFieldProps, useFormField } from "./useFormField";
|
|
6
6
|
import { ReadOnlyIcon } from "./ReadOnlyIcon";
|
|
7
|
+
import { omit, useId } from "../util";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* TODO: Mulighet for lokalisering av sr-only/counter text
|