@navikt/ds-react 5.12.5 → 5.13.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 +79 -3
- package/cjs/accordion/Accordion.js +2 -2
- package/cjs/accordion/AccordionHeader.js +1 -1
- package/cjs/accordion/AccordionItem.js +11 -14
- package/cjs/alert/Alert.js +2 -2
- package/cjs/chat/Bubble.js +1 -1
- package/cjs/chat/Chat.js +2 -2
- package/cjs/chips/Chips.js +1 -1
- package/cjs/chips/Removable.js +1 -1
- package/cjs/copybutton/CopyButton.js +2 -2
- package/cjs/date/datepicker/parts/Caption.js +2 -2
- package/cjs/date/datepicker/parts/DropdownCaption.js +1 -1
- package/cjs/date/datepicker/parts/HeadRow.js +1 -1
- package/cjs/date/datepicker/parts/Row.js +2 -2
- package/cjs/date/monthpicker/MonthCaption.js +1 -1
- package/cjs/date/parts/DateInput.js +1 -1
- package/cjs/date/utils/check-dates.js +1 -1
- package/cjs/date/utils/is-match.js +2 -2
- package/cjs/date/utils/parse-date.js +1 -1
- package/cjs/dropdown/Dropdown.js +10 -12
- package/cjs/dropdown/Menu/Divider.js +1 -1
- package/cjs/dropdown/Menu/GroupedList/GroupedHeading.js +1 -1
- package/cjs/expansion-card/ExpansionCardHeader.js +1 -1
- package/cjs/form/ReadOnlyIcon.js +1 -1
- package/cjs/form/Select.js +1 -1
- package/cjs/form/combobox/Combobox.js +6 -6
- package/cjs/form/combobox/ComboboxProvider.js +2 -2
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js +4 -4
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +4 -4
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.js +1 -1
- package/cjs/form/error-summary/ErrorSummary.js +2 -2
- package/cjs/form/error-summary/ErrorSummaryItem.js +1 -1
- package/cjs/form/search/Search.js +1 -1
- package/cjs/form/search/SearchButton.js +1 -1
- package/cjs/grid/Cell.js +1 -1
- package/cjs/grid/Grid.js +1 -1
- package/cjs/guide-panel/GuidePanel.js +1 -1
- package/cjs/internal-header/InternalHeaderButton.js +1 -1
- package/cjs/internal-header/InternalHeaderTitle.js +1 -1
- package/cjs/internal-header/InternalHeaderUser.js +1 -1
- package/cjs/internal-header/InternalHeaderUserButton.js +1 -1
- package/cjs/layout/bleed/Bleed.js +1 -1
- package/cjs/layout/content-container/ContentContainer.js +1 -1
- package/cjs/layout/grid/HGrid.js +1 -1
- package/cjs/layout/page/parts/PageBlock.js +1 -1
- package/cjs/layout/sidemal-test/AvatarPanel.js +1 -1
- package/cjs/layout/sidemal-test/Content.js +3 -3
- package/cjs/layout/sidemal-test/Filter.js +1 -1
- package/cjs/layout/sidemal-test/Intro.js +1 -1
- package/cjs/link-panel/LinkPanel.js +3 -3
- package/cjs/link-panel/LinkPanelDescription.js +1 -1
- package/cjs/link-panel/LinkPanelTitle.js +1 -1
- package/cjs/modal/ModalBody.js +1 -1
- package/cjs/modal/ModalFooter.js +1 -1
- package/cjs/modal/ModalHeader.js +1 -1
- package/cjs/pagination/PaginationItem.js +1 -1
- package/cjs/panel/Panel.js +1 -1
- package/cjs/popover/PopoverContent.js +1 -1
- package/cjs/read-more/ReadMore.js +12 -10
- package/cjs/skeleton/Skeleton.js +1 -1
- package/cjs/table/Body.js +1 -1
- package/cjs/table/ColumnHeader.js +1 -1
- package/cjs/table/DataCell.js +1 -1
- package/cjs/table/ExpandableRow.js +14 -13
- package/cjs/table/Header.js +1 -1
- package/cjs/table/Row.js +1 -1
- package/cjs/tabs/TabList.js +1 -1
- package/cjs/tabs/Tabs.js +1 -1
- package/cjs/tag/Tag.js +1 -1
- package/cjs/timeline/AxisLabels.js +1 -1
- package/cjs/timeline/TimelineRow.js +2 -2
- package/cjs/timeline/hooks/useTimelineRows.js +5 -3
- package/cjs/timeline/utils/timeline.js +1 -1
- package/cjs/timeline/zoom/ZoomButton.js +1 -1
- package/cjs/toggle-group/ToggleGroup.js +1 -1
- package/cjs/tooltip/Tooltip.js +12 -7
- package/cjs/typography/BodyLong.js +1 -1
- package/cjs/typography/ErrorMessage.js +1 -1
- package/cjs/typography/Ingress.js +1 -1
- package/cjs/util/RandomIcon.js +1 -1
- package/cjs/util/hooks/useCallbackRef.js +18 -0
- package/cjs/util/hooks/useControllableState.js +25 -0
- package/esm/accordion/Accordion.d.ts +1 -1
- package/esm/accordion/Accordion.js +2 -2
- package/esm/accordion/Accordion.js.map +1 -1
- package/esm/accordion/AccordionHeader.js +1 -1
- package/esm/accordion/AccordionHeader.js.map +1 -1
- package/esm/accordion/AccordionItem.d.ts +4 -0
- package/esm/accordion/AccordionItem.js +12 -15
- package/esm/accordion/AccordionItem.js.map +1 -1
- package/esm/alert/Alert.js +2 -2
- package/esm/alert/Alert.js.map +1 -1
- package/esm/chat/Bubble.js +1 -1
- package/esm/chat/Bubble.js.map +1 -1
- package/esm/chat/Chat.js +2 -2
- package/esm/chat/Chat.js.map +1 -1
- package/esm/chips/Chips.d.ts +2 -2
- package/esm/chips/Chips.js +1 -1
- package/esm/chips/Chips.js.map +1 -1
- package/esm/chips/Removable.js +1 -1
- package/esm/chips/Removable.js.map +1 -1
- package/esm/copybutton/CopyButton.js +2 -2
- package/esm/copybutton/CopyButton.js.map +1 -1
- package/esm/date/context/useSharedMonthContext.js.map +1 -1
- package/esm/date/datepicker/parts/Caption.js +2 -2
- package/esm/date/datepicker/parts/Caption.js.map +1 -1
- package/esm/date/datepicker/parts/DropdownCaption.js +1 -1
- package/esm/date/datepicker/parts/DropdownCaption.js.map +1 -1
- package/esm/date/datepicker/parts/HeadRow.js +1 -1
- package/esm/date/datepicker/parts/HeadRow.js.map +1 -1
- package/esm/date/datepicker/parts/Row.js +3 -3
- package/esm/date/datepicker/parts/Row.js.map +1 -1
- package/esm/date/monthpicker/MonthCaption.js +1 -1
- package/esm/date/monthpicker/MonthCaption.js.map +1 -1
- package/esm/date/parts/DateInput.js +1 -1
- package/esm/date/parts/DateInput.js.map +1 -1
- package/esm/date/utils/check-dates.js +1 -1
- package/esm/date/utils/check-dates.js.map +1 -1
- package/esm/date/utils/get-month-weeks.js.map +1 -1
- package/esm/date/utils/is-match.js +2 -2
- package/esm/date/utils/is-match.js.map +1 -1
- package/esm/date/utils/navigation.js.map +1 -1
- 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 +4 -0
- package/esm/dropdown/Dropdown.js +10 -12
- package/esm/dropdown/Dropdown.js.map +1 -1
- package/esm/dropdown/Menu/Divider.js +1 -1
- package/esm/dropdown/Menu/Divider.js.map +1 -1
- package/esm/dropdown/Menu/GroupedList/GroupedHeading.js +1 -1
- package/esm/dropdown/Menu/GroupedList/GroupedHeading.js.map +1 -1
- package/esm/expansion-card/ExpansionCardHeader.js +1 -1
- package/esm/expansion-card/ExpansionCardHeader.js.map +1 -1
- package/esm/form/Fieldset/useFieldset.d.ts +1 -1
- package/esm/form/ReadOnlyIcon.js +1 -1
- package/esm/form/ReadOnlyIcon.js.map +1 -1
- package/esm/form/Select.js +1 -1
- package/esm/form/Select.js.map +1 -1
- package/esm/form/Switch.js.map +1 -1
- package/esm/form/TextField.js.map +1 -1
- package/esm/form/checkbox/useCheckbox.d.ts +1 -1
- package/esm/form/combobox/Combobox.d.ts +1 -1
- package/esm/form/combobox/Combobox.js +6 -6
- package/esm/form/combobox/Combobox.js.map +1 -1
- package/esm/form/combobox/ComboboxProvider.js +2 -2
- package/esm/form/combobox/ComboboxProvider.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js +4 -4
- package/esm/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.d.ts +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +4 -4
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.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/combobox/ToggleListButton.js +1 -1
- package/esm/form/combobox/ToggleListButton.js.map +1 -1
- package/esm/form/combobox/customOptionsContext.js +1 -1
- package/esm/form/combobox/customOptionsContext.js.map +1 -1
- package/esm/form/error-summary/ErrorSummary.js +3 -3
- package/esm/form/error-summary/ErrorSummary.js.map +1 -1
- package/esm/form/error-summary/ErrorSummaryItem.js +1 -1
- package/esm/form/error-summary/ErrorSummaryItem.js.map +1 -1
- package/esm/form/radio/useRadio.d.ts +1 -1
- package/esm/form/search/Search.js +1 -1
- package/esm/form/search/Search.js.map +1 -1
- package/esm/form/search/SearchButton.js +1 -1
- package/esm/form/search/SearchButton.js.map +1 -1
- package/esm/grid/Cell.js +1 -1
- package/esm/grid/Cell.js.map +1 -1
- package/esm/grid/Grid.js +1 -1
- package/esm/grid/Grid.js.map +1 -1
- package/esm/guide-panel/GuidePanel.js +1 -1
- package/esm/guide-panel/GuidePanel.js.map +1 -1
- package/esm/internal-header/InternalHeader.js.map +1 -1
- package/esm/internal-header/InternalHeaderButton.js +1 -1
- package/esm/internal-header/InternalHeaderButton.js.map +1 -1
- package/esm/internal-header/InternalHeaderTitle.js +1 -1
- package/esm/internal-header/InternalHeaderTitle.js.map +1 -1
- package/esm/internal-header/InternalHeaderUser.js +1 -1
- package/esm/internal-header/InternalHeaderUser.js.map +1 -1
- package/esm/internal-header/InternalHeaderUserButton.js +1 -1
- package/esm/internal-header/InternalHeaderUserButton.js.map +1 -1
- package/esm/layout/bleed/Bleed.js +1 -1
- package/esm/layout/bleed/Bleed.js.map +1 -1
- package/esm/layout/box/Box.d.ts +1 -1
- package/esm/layout/content-container/ContentContainer.js +1 -1
- package/esm/layout/content-container/ContentContainer.js.map +1 -1
- package/esm/layout/grid/HGrid.js +1 -1
- package/esm/layout/grid/HGrid.js.map +1 -1
- package/esm/layout/page/Page.d.ts +2 -2
- package/esm/layout/page/Page.js.map +1 -1
- package/esm/layout/page/parts/PageBlock.d.ts +6 -5
- package/esm/layout/page/parts/PageBlock.js +1 -1
- package/esm/layout/page/parts/PageBlock.js.map +1 -1
- package/esm/layout/responsive/Responsive.js.map +1 -1
- package/esm/layout/sidemal-test/AvatarPanel.js +1 -1
- package/esm/layout/sidemal-test/AvatarPanel.js.map +1 -1
- package/esm/layout/sidemal-test/Content.js +4 -4
- package/esm/layout/sidemal-test/Content.js.map +1 -1
- package/esm/layout/sidemal-test/Filter.js +1 -1
- package/esm/layout/sidemal-test/Filter.js.map +1 -1
- package/esm/layout/sidemal-test/Header.js +1 -1
- package/esm/layout/sidemal-test/Header.js.map +1 -1
- package/esm/layout/sidemal-test/Intro.js +2 -2
- package/esm/layout/sidemal-test/Intro.js.map +1 -1
- package/esm/layout/sidemal-test/content-box/ContentBox.js.map +1 -1
- package/esm/layout/stack/HStack.js.map +1 -1
- package/esm/layout/stack/Stack.js.map +1 -1
- package/esm/layout/stack/VStack.js.map +1 -1
- package/esm/layout/utilities/types.d.ts +2 -2
- package/esm/link-panel/LinkPanel.d.ts +2 -2
- package/esm/link-panel/LinkPanel.js +3 -3
- 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/link-panel/LinkPanelTitle.js +1 -1
- package/esm/link-panel/LinkPanelTitle.js.map +1 -1
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/ModalBody.js +1 -1
- package/esm/modal/ModalBody.js.map +1 -1
- package/esm/modal/ModalFooter.js +1 -1
- package/esm/modal/ModalFooter.js.map +1 -1
- package/esm/modal/ModalHeader.js +1 -1
- package/esm/modal/ModalHeader.js.map +1 -1
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/pagination/PaginationItem.js +1 -1
- package/esm/pagination/PaginationItem.js.map +1 -1
- package/esm/panel/Panel.js +1 -1
- package/esm/panel/Panel.js.map +1 -1
- package/esm/popover/Popover.js.map +1 -1
- package/esm/popover/PopoverContent.js +1 -1
- package/esm/popover/PopoverContent.js.map +1 -1
- package/esm/read-more/ReadMore.d.ts +4 -0
- package/esm/read-more/ReadMore.js +13 -11
- package/esm/read-more/ReadMore.js.map +1 -1
- package/esm/skeleton/Skeleton.js +1 -1
- package/esm/skeleton/Skeleton.js.map +1 -1
- package/esm/table/Body.js +1 -1
- package/esm/table/Body.js.map +1 -1
- package/esm/table/ColumnHeader.js +1 -1
- 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 +15 -14
- package/esm/table/ExpandableRow.js.map +1 -1
- package/esm/table/Header.js +1 -1
- package/esm/table/Header.js.map +1 -1
- package/esm/table/Row.js +1 -1
- package/esm/table/Row.js.map +1 -1
- package/esm/tabs/TabList.js +1 -1
- package/esm/tabs/TabList.js.map +1 -1
- package/esm/tabs/Tabs.js +1 -1
- package/esm/tabs/Tabs.js.map +1 -1
- package/esm/tag/Tag.js +1 -1
- package/esm/tag/Tag.js.map +1 -1
- package/esm/timeline/AxisLabels.js +1 -1
- package/esm/timeline/AxisLabels.js.map +1 -1
- package/esm/timeline/TimelineRow.js +2 -2
- package/esm/timeline/TimelineRow.js.map +1 -1
- package/esm/timeline/hooks/useTimelineRows.js +5 -3
- package/esm/timeline/hooks/useTimelineRows.js.map +1 -1
- package/esm/timeline/utils/timeline.js +1 -1
- package/esm/timeline/utils/timeline.js.map +1 -1
- package/esm/timeline/zoom/ZoomButton.js +1 -1
- package/esm/timeline/zoom/ZoomButton.js.map +1 -1
- package/esm/toggle-group/ToggleGroup.js +1 -1
- package/esm/toggle-group/ToggleGroup.js.map +1 -1
- package/esm/tooltip/Tooltip.d.ts +4 -0
- package/esm/tooltip/Tooltip.js +13 -8
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/typography/BodyLong.js +1 -1
- package/esm/typography/BodyLong.js.map +1 -1
- package/esm/typography/ErrorMessage.js +1 -1
- package/esm/typography/ErrorMessage.js.map +1 -1
- package/esm/typography/Ingress.js +1 -1
- package/esm/typography/Ingress.js.map +1 -1
- package/esm/util/RandomIcon.js +1 -1
- package/esm/util/RandomIcon.js.map +1 -1
- package/esm/util/hooks/useCallbackRef.d.ts +7 -0
- package/esm/util/hooks/useCallbackRef.js +15 -0
- package/esm/util/hooks/useCallbackRef.js.map +1 -0
- package/esm/util/hooks/useControllableState.d.ts +9 -0
- package/esm/util/hooks/useControllableState.js +22 -0
- package/esm/util/hooks/useControllableState.js.map +1 -0
- package/esm/util/mergeRefs.js.map +1 -1
- package/package.json +3 -3
- package/src/accordion/Accordion.tsx +5 -5
- package/src/accordion/AccordionContent.tsx +3 -3
- package/src/accordion/AccordionHeader.tsx +3 -3
- package/src/accordion/AccordionItem.tsx +21 -21
- package/src/accordion/accordion.stories.tsx +8 -5
- package/src/alert/Alert.tsx +8 -8
- package/src/alert/alert.stories.tsx +7 -7
- package/src/button/Button.tsx +4 -4
- package/src/button/button.stories.tsx +1 -1
- package/src/chat/Bubble.tsx +4 -4
- package/src/chat/Chat.tsx +5 -5
- package/src/chat/chat.stories.tsx +1 -1
- package/src/chips/Chips.tsx +4 -4
- package/src/chips/Removable.tsx +4 -4
- package/src/chips/Toggle.tsx +3 -3
- package/src/chips/chips.stories.tsx +5 -5
- package/src/copybutton/CopyButton.tsx +6 -6
- package/src/copybutton/copy-button.stories.tsx +3 -3
- package/src/date/context/useSharedMonthContext.tsx +1 -1
- package/src/date/datepicker/DatePicker.tsx +2 -2
- package/src/date/datepicker/DatePickerStandalone.tsx +2 -2
- package/src/date/datepicker/datepicker.stories.tsx +2 -2
- package/src/date/datepicker/parts/Caption.tsx +2 -3
- package/src/date/datepicker/parts/DropdownCaption.tsx +2 -2
- package/src/date/datepicker/parts/HeadRow.tsx +1 -1
- package/src/date/datepicker/parts/Row.tsx +3 -3
- package/src/date/hooks/useDatepicker.tsx +7 -7
- package/src/date/hooks/useMonthPicker.tsx +7 -7
- package/src/date/hooks/useRangeDatepicker.test.tsx +2 -2
- package/src/date/hooks/useRangeDatepicker.tsx +28 -28
- package/src/date/monthpicker/MonthButton.tsx +1 -1
- package/src/date/monthpicker/MonthCaption.tsx +1 -1
- package/src/date/monthpicker/MonthPicker.tsx +3 -3
- package/src/date/monthpicker/MonthPickerStandalone.tsx +3 -3
- package/src/date/monthpicker/MonthSelector.tsx +1 -1
- package/src/date/parts/DateInput.tsx +6 -6
- package/src/date/utils/__tests__/check-dates.test.ts +3 -3
- package/src/date/utils/__tests__/format-dates.test.ts +7 -7
- package/src/date/utils/__tests__/get-initial-year.test.ts +14 -14
- package/src/date/utils/__tests__/get-month-weeks.test.ts +0 -1
- package/src/date/utils/__tests__/is-match.test.ts +4 -4
- package/src/date/utils/__tests__/parse-dates.test.ts +2 -2
- package/src/date/utils/check-dates.ts +2 -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 +1 -1
- package/src/date/utils/get-month-weeks.ts +6 -6
- package/src/date/utils/is-match.ts +2 -3
- package/src/date/utils/labels.ts +1 -1
- package/src/date/utils/navigation.ts +18 -18
- package/src/date/utils/parse-date.ts +8 -8
- package/src/dropdown/Dropdown.tsx +14 -11
- package/src/dropdown/Menu/Divider.tsx +1 -1
- package/src/dropdown/Menu/GroupedList/GroupedHeading.tsx +2 -2
- package/src/dropdown/Menu/GroupedList/GroupedItem.tsx +1 -1
- package/src/dropdown/Menu/GroupedList/index.tsx +1 -1
- package/src/dropdown/Menu/List/Item.tsx +1 -1
- package/src/dropdown/Menu/index.tsx +1 -1
- package/src/dropdown/dropdown.stories.tsx +1 -1
- package/src/expansion-card/ExpansionCard.tsx +3 -3
- package/src/expansion-card/ExpansionCardContent.tsx +1 -1
- package/src/expansion-card/ExpansionCardDescription.tsx +1 -1
- package/src/expansion-card/ExpansionCardHeader.tsx +2 -2
- package/src/expansion-card/ExpansionCardTitle.tsx +2 -2
- package/src/expansion-card/expansion-card.stories.tsx +1 -1
- package/src/form/ConfirmationPanel.test.tsx +1 -1
- package/src/form/ConfirmationPanel.tsx +2 -2
- package/src/form/Fieldset/Fieldset.tsx +2 -2
- package/src/form/ReadOnlyIcon.tsx +1 -1
- package/src/form/Select.tsx +6 -6
- package/src/form/Switch.tsx +4 -4
- package/src/form/TextField.tsx +4 -4
- package/src/form/Textarea.tsx +4 -4
- package/src/form/checkbox/Checkbox.test.tsx +8 -8
- package/src/form/checkbox/Checkbox.tsx +3 -3
- package/src/form/checkbox/CheckboxGroup.tsx +4 -4
- package/src/form/checkbox/useCheckbox.ts +3 -3
- package/src/form/combobox/Combobox.tsx +8 -8
- package/src/form/combobox/ComboboxProvider.tsx +3 -3
- package/src/form/combobox/ComboboxWrapper.tsx +1 -1
- package/src/form/combobox/FilteredOptions/FilteredOptions.tsx +6 -6
- package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +18 -18
- package/src/form/combobox/FilteredOptions/useVirtualFocus.ts +5 -5
- package/src/form/combobox/Input/Input.tsx +6 -6
- package/src/form/combobox/Input/inputContext.tsx +6 -6
- package/src/form/combobox/SelectedOptions/SelectedOptions.tsx +1 -1
- package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +9 -9
- package/src/form/combobox/ToggleListButton.tsx +1 -2
- package/src/form/combobox/combobox.stories.tsx +8 -8
- package/src/form/combobox/combobox.test.tsx +14 -12
- package/src/form/combobox/customOptionsContext.tsx +6 -6
- package/src/form/combobox/types.ts +2 -2
- package/src/form/error-summary/ErrorSummary.tsx +6 -6
- package/src/form/error-summary/ErrorSummaryItem.tsx +2 -2
- package/src/form/error-summary/error-summary.stories.tsx +2 -1
- package/src/form/radio/Radio.test.tsx +1 -1
- package/src/form/radio/Radio.tsx +1 -1
- package/src/form/radio/RadioGroup.tsx +3 -3
- package/src/form/radio/useRadio.ts +1 -1
- package/src/form/search/Search.tsx +6 -6
- package/src/form/search/SearchButton.tsx +2 -2
- package/src/form/search/search.stories.tsx +1 -1
- package/src/form/stories/fieldset.stories.tsx +3 -2
- package/src/form/stories/select.stories.tsx +2 -1
- package/src/form/stories/text-field.stories.tsx +2 -1
- package/src/form/useFormField.ts +3 -3
- package/src/grid/Cell.tsx +3 -3
- package/src/grid/Grid.tsx +2 -2
- package/src/grid/grid.stories.tsx +1 -1
- package/src/guide-panel/GuidePanel.tsx +2 -2
- package/src/guide-panel/guidepanel.stories.tsx +1 -1
- package/src/help-text/HelpText.tsx +2 -2
- package/src/internal-header/InternalHeader.tsx +1 -1
- package/src/internal-header/InternalHeaderButton.tsx +1 -1
- package/src/internal-header/InternalHeaderTitle.tsx +1 -1
- package/src/internal-header/InternalHeaderUser.tsx +1 -1
- package/src/internal-header/InternalHeaderUserButton.tsx +1 -1
- package/src/internal-header/header.stories.tsx +3 -3
- package/src/layout/bleed/Bleed.tsx +7 -7
- package/src/layout/box/Box.stories.tsx +4 -4
- package/src/layout/box/Box.tsx +7 -7
- package/src/layout/content-container/ContentContainer.tsx +1 -1
- package/src/layout/grid/HGrid.tsx +4 -4
- package/src/layout/page/Page.stories.tsx +1 -1
- package/src/layout/page/Page.tsx +4 -4
- package/src/layout/page/parts/PageBlock.tsx +8 -7
- package/src/layout/responsive/Responsive.tsx +6 -6
- package/src/layout/responsive/hide.stories.tsx +1 -1
- package/src/layout/responsive/show.stories.tsx +1 -1
- package/src/layout/sidemal-test/AvatarPanel.tsx +1 -1
- package/src/layout/sidemal-test/Content.tsx +4 -4
- package/src/layout/sidemal-test/Filter.tsx +1 -1
- package/src/layout/sidemal-test/Header.tsx +1 -1
- package/src/layout/sidemal-test/Intro.tsx +2 -2
- package/src/layout/sidemal-test/content-box/ContentBox.tsx +6 -6
- package/src/layout/sidemal-test/navno-sidemal.stories.tsx +1 -1
- package/src/layout/stack/HStack.tsx +1 -1
- package/src/layout/stack/Stack.tsx +3 -3
- package/src/layout/stack/VStack.tsx +1 -1
- package/src/layout/stack/stack.stories.tsx +2 -2
- package/src/layout/utilities/css.ts +6 -6
- package/src/layout/utilities/types.ts +2 -2
- package/src/link/Link.tsx +2 -2
- package/src/link/link.stories.tsx +1 -1
- package/src/link-panel/LinkPanel.tsx +6 -7
- package/src/link-panel/LinkPanelDescription.tsx +1 -1
- package/src/link-panel/LinkPanelTitle.tsx +2 -2
- package/src/list/List.tsx +2 -2
- package/src/list/ListItem.tsx +2 -2
- package/src/list/list.stories.tsx +2 -2
- package/src/loader/Loader.tsx +4 -4
- package/src/loader/loader.stories.tsx +1 -0
- package/src/modal/Modal.test.tsx +4 -4
- package/src/modal/Modal.tsx +2 -2
- package/src/modal/ModalBody.tsx +2 -2
- package/src/modal/ModalFooter.tsx +2 -2
- package/src/modal/ModalHeader.tsx +2 -2
- package/src/modal/ModalUtils.ts +2 -2
- package/src/modal/dialog-polyfill.ts +16 -16
- package/src/pagination/Pagination.tsx +5 -6
- package/src/pagination/PaginationItem.tsx +3 -3
- package/src/pagination/steps.test.ts +8 -8
- package/src/panel/Panel.tsx +3 -3
- package/src/panel/panel.stories.tsx +2 -1
- package/src/popover/Popover.test.tsx +7 -7
- package/src/popover/Popover.tsx +8 -8
- package/src/popover/PopoverContent.tsx +2 -2
- package/src/provider/Provider.tsx +1 -1
- package/src/read-more/ReadMore.tsx +19 -13
- package/src/read-more/readmore.stories.tsx +4 -0
- package/src/skeleton/Skeleton.tsx +4 -4
- package/src/stepper/Step.tsx +2 -2
- package/src/stepper/Stepper.tsx +3 -3
- package/src/table/Body.tsx +1 -1
- package/src/table/ColumnHeader.tsx +2 -2
- package/src/table/DataCell.tsx +2 -2
- package/src/table/ExpandableRow.tsx +19 -17
- package/src/table/Header.tsx +1 -1
- package/src/table/HeaderCell.tsx +1 -1
- package/src/table/Row.tsx +2 -2
- package/src/table/Table.tsx +2 -2
- package/src/table/stories/table-async.stories.tsx +4 -4
- package/src/table/stories/table.stories.tsx +1 -1
- package/src/tabs/Tab.tsx +3 -3
- package/src/tabs/TabList.tsx +4 -4
- package/src/tabs/TabPanel.tsx +1 -1
- package/src/tabs/Tabs.stories.tsx +1 -1
- package/src/tabs/Tabs.tsx +4 -4
- package/src/tag/Tag.tsx +3 -3
- package/src/tag/tag.stories.tsx +1 -1
- package/src/timeline/AxisLabels.tsx +9 -9
- package/src/timeline/Pin.tsx +2 -2
- package/src/timeline/Timeline.tsx +7 -7
- package/src/timeline/TimelineRow.tsx +5 -5
- package/src/timeline/hooks/useTimelineContext.tsx +1 -1
- package/src/timeline/hooks/useTimelineRows.ts +18 -19
- package/src/timeline/period/ClickablePeriod.tsx +4 -4
- package/src/timeline/period/NonClickablePeriod.tsx +1 -1
- package/src/timeline/period/index.tsx +1 -1
- package/src/timeline/timeline.stories.tsx +2 -2
- package/src/timeline/utils/calc.ts +2 -2
- package/src/timeline/utils/filter.ts +2 -2
- package/src/timeline/utils/period.ts +2 -2
- package/src/timeline/utils/timeline.ts +1 -1
- package/src/timeline/zoom/ZoomButton.tsx +3 -3
- package/src/timeline/zoom/index.tsx +1 -1
- package/src/toggle-group/ToggleGroup.stories.tsx +2 -2
- package/src/toggle-group/ToggleGroup.tsx +5 -5
- package/src/toggle-group/ToggleItem.tsx +1 -1
- package/src/toggle-group/context.ts +1 -1
- package/src/tooltip/Tooltip.test.tsx +10 -10
- package/src/tooltip/Tooltip.tsx +20 -11
- package/src/tooltip/tooltip.stories.tsx +1 -1
- package/src/typography/BodyLong.tsx +4 -4
- package/src/typography/BodyShort.tsx +3 -3
- package/src/typography/Detail.tsx +3 -3
- package/src/typography/ErrorMessage.tsx +3 -3
- package/src/typography/Heading.tsx +3 -3
- package/src/typography/Ingress.tsx +1 -1
- package/src/typography/Label.tsx +3 -3
- package/src/typography/stories/heading.stories.tsx +1 -2
- package/src/util/AnimateHeight.tsx +1 -1
- package/src/util/OverridableComponent.ts +1 -1
- package/src/util/RandomIcon.tsx +1 -1
- package/src/util/Slot.tsx +3 -3
- package/src/util/TextareaAutoSize.tsx +4 -4
- package/src/util/__tests__/Slot.test.tsx +11 -11
- package/src/util/hooks/useCallbackRef.ts +20 -0
- package/src/util/hooks/useControllableState.ts +40 -0
- package/src/util/mergeRefs.tsx +2 -1
- package/src/util/omit.ts +1 -1
- package/src/util/useEventListener.ts +1 -1
- package/src/util/useMedia.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import setYear from "date-fns/setYear";
|
|
2
|
-
import {
|
|
2
|
+
import { Matcher, isMatch } from "./is-match";
|
|
3
3
|
|
|
4
4
|
export const nextEnabled = (
|
|
5
5
|
months,
|
|
@@ -10,7 +10,7 @@ export const nextEnabled = (
|
|
|
10
10
|
yearState: Date,
|
|
11
11
|
dropdownCaption: boolean,
|
|
12
12
|
fromDate?: Date,
|
|
13
|
-
toDate?: Date
|
|
13
|
+
toDate?: Date,
|
|
14
14
|
): Date => {
|
|
15
15
|
const currentIndex = currentMonth.getMonth();
|
|
16
16
|
|
|
@@ -20,7 +20,7 @@ export const nextEnabled = (
|
|
|
20
20
|
months,
|
|
21
21
|
yearState,
|
|
22
22
|
disabled,
|
|
23
|
-
"home"
|
|
23
|
+
"home",
|
|
24
24
|
);
|
|
25
25
|
if (nextDate) {
|
|
26
26
|
return nextDate;
|
|
@@ -32,7 +32,7 @@ export const nextEnabled = (
|
|
|
32
32
|
months,
|
|
33
33
|
yearState,
|
|
34
34
|
disabled,
|
|
35
|
-
"end"
|
|
35
|
+
"end",
|
|
36
36
|
);
|
|
37
37
|
if (nextDate) {
|
|
38
38
|
return nextDate;
|
|
@@ -64,7 +64,7 @@ export const nextEnabled = (
|
|
|
64
64
|
false,
|
|
65
65
|
dropdownCaption,
|
|
66
66
|
fromDate,
|
|
67
|
-
toDate
|
|
67
|
+
toDate,
|
|
68
68
|
);
|
|
69
69
|
if (nextMonth) {
|
|
70
70
|
return setYear(months[nextMonth.index], nextMonth.year);
|
|
@@ -80,7 +80,7 @@ export const nextEnabled = (
|
|
|
80
80
|
false,
|
|
81
81
|
dropdownCaption,
|
|
82
82
|
fromDate,
|
|
83
|
-
toDate
|
|
83
|
+
toDate,
|
|
84
84
|
);
|
|
85
85
|
if (prevMonth) {
|
|
86
86
|
return setYear(months[prevMonth.index], prevMonth.year);
|
|
@@ -91,7 +91,7 @@ export const nextEnabled = (
|
|
|
91
91
|
months[currentIndex + 4] &&
|
|
92
92
|
!isMatch(
|
|
93
93
|
setYear(months[currentIndex + 4], yearState.getFullYear()),
|
|
94
|
-
disabled
|
|
94
|
+
disabled,
|
|
95
95
|
)
|
|
96
96
|
) {
|
|
97
97
|
return setYear(months[currentIndex + 4], yearState.getFullYear());
|
|
@@ -106,7 +106,7 @@ export const nextEnabled = (
|
|
|
106
106
|
true,
|
|
107
107
|
dropdownCaption,
|
|
108
108
|
fromDate,
|
|
109
|
-
toDate
|
|
109
|
+
toDate,
|
|
110
110
|
);
|
|
111
111
|
|
|
112
112
|
if (
|
|
@@ -122,7 +122,7 @@ export const nextEnabled = (
|
|
|
122
122
|
months[currentIndex - 4] &&
|
|
123
123
|
!isMatch(
|
|
124
124
|
setYear(months[currentIndex - 4], Number(yearState.getFullYear())),
|
|
125
|
-
disabled
|
|
125
|
+
disabled,
|
|
126
126
|
)
|
|
127
127
|
)
|
|
128
128
|
return setYear(months[currentIndex - 4], Number(yearState.getFullYear()));
|
|
@@ -135,7 +135,7 @@ export const nextEnabled = (
|
|
|
135
135
|
true,
|
|
136
136
|
dropdownCaption,
|
|
137
137
|
fromDate,
|
|
138
|
-
toDate
|
|
138
|
+
toDate,
|
|
139
139
|
);
|
|
140
140
|
if (fallbackPrev)
|
|
141
141
|
return setYear(months[fallbackPrev.index], fallbackPrev.year);
|
|
@@ -152,7 +152,7 @@ const loopBack = (
|
|
|
152
152
|
rowCheck: boolean,
|
|
153
153
|
dropdownCaption: boolean,
|
|
154
154
|
fromDate?: Date,
|
|
155
|
-
toDate?: Date
|
|
155
|
+
toDate?: Date,
|
|
156
156
|
): { index: number; year: number } | undefined => {
|
|
157
157
|
let currentYear = setYear(yearState, Number(yearState.getFullYear()));
|
|
158
158
|
for (let i = currentIndex; i >= -1; i--) {
|
|
@@ -162,7 +162,7 @@ const loopBack = (
|
|
|
162
162
|
dropdownCaption,
|
|
163
163
|
setYear(currentYear, Number(currentYear.getFullYear() - 1)),
|
|
164
164
|
fromDate,
|
|
165
|
-
toDate
|
|
165
|
+
toDate,
|
|
166
166
|
)
|
|
167
167
|
)
|
|
168
168
|
return;
|
|
@@ -173,7 +173,7 @@ const loopBack = (
|
|
|
173
173
|
const month = months[i];
|
|
174
174
|
const isDisabled = !isMatch(
|
|
175
175
|
setYear(month, Number(currentYear.getFullYear())),
|
|
176
|
-
disabled
|
|
176
|
+
disabled,
|
|
177
177
|
);
|
|
178
178
|
if (rowCheck) {
|
|
179
179
|
if (isDisabled && getRow(i) !== getRow(currentIndex)) {
|
|
@@ -196,7 +196,7 @@ const loopForward = (
|
|
|
196
196
|
rowCheck: boolean,
|
|
197
197
|
dropdownCaption: boolean,
|
|
198
198
|
fromDate?: Date,
|
|
199
|
-
toDate?: Date
|
|
199
|
+
toDate?: Date,
|
|
200
200
|
): { index: number; year: number } | undefined => {
|
|
201
201
|
let currentYear = setYear(yearState, Number(yearState.getFullYear()));
|
|
202
202
|
for (let i = currentIndex + 1; i < months.length + 1; i++) {
|
|
@@ -206,7 +206,7 @@ const loopForward = (
|
|
|
206
206
|
dropdownCaption,
|
|
207
207
|
setYear(currentYear, Number(currentYear.getFullYear() + 1)),
|
|
208
208
|
fromDate,
|
|
209
|
-
toDate
|
|
209
|
+
toDate,
|
|
210
210
|
)
|
|
211
211
|
)
|
|
212
212
|
return;
|
|
@@ -217,7 +217,7 @@ const loopForward = (
|
|
|
217
217
|
const month = months[i];
|
|
218
218
|
const isDisabled = !isMatch(
|
|
219
219
|
setYear(month, Number(currentYear.getFullYear())),
|
|
220
|
-
disabled
|
|
220
|
+
disabled,
|
|
221
221
|
);
|
|
222
222
|
if (rowCheck) {
|
|
223
223
|
if (isDisabled && getRow(i) !== getRow(currentIndex)) {
|
|
@@ -241,7 +241,7 @@ const isOutOfRange = (
|
|
|
241
241
|
dropdownCaption: boolean,
|
|
242
242
|
year: Date,
|
|
243
243
|
fromDate?: Date,
|
|
244
|
-
toDate?: Date
|
|
244
|
+
toDate?: Date,
|
|
245
245
|
): boolean => {
|
|
246
246
|
if (
|
|
247
247
|
dropdownCaption &&
|
|
@@ -261,7 +261,7 @@ const nextOnRow = (
|
|
|
261
261
|
months,
|
|
262
262
|
yearState: Date,
|
|
263
263
|
disabled: Matcher[],
|
|
264
|
-
mode: "home" | "end"
|
|
264
|
+
mode: "home" | "end",
|
|
265
265
|
) => {
|
|
266
266
|
const row = getRow(currentIndex);
|
|
267
267
|
let monthsOfRow;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import parse from "date-fns/parse";
|
|
2
1
|
import isBefore from "date-fns/isBefore";
|
|
2
|
+
import parse from "date-fns/parse";
|
|
3
3
|
import sub from "date-fns/sub";
|
|
4
4
|
import { isValidDate } from "./check-dates";
|
|
5
5
|
|
|
@@ -29,7 +29,7 @@ export const parseDate = (
|
|
|
29
29
|
today: Date,
|
|
30
30
|
locale: Locale,
|
|
31
31
|
type: "date" | "month",
|
|
32
|
-
allowTwoDigitYear: boolean
|
|
32
|
+
allowTwoDigitYear: boolean,
|
|
33
33
|
): Date => {
|
|
34
34
|
let parsed;
|
|
35
35
|
const ALLOWED_FORMATS =
|
|
@@ -93,20 +93,20 @@ function assignCenturyToDate(
|
|
|
93
93
|
dateStr: string,
|
|
94
94
|
format: string,
|
|
95
95
|
today: Date,
|
|
96
|
-
locale: Locale
|
|
96
|
+
locale: Locale,
|
|
97
97
|
) {
|
|
98
98
|
const date20Century = parse(
|
|
99
99
|
appendCenturyToTwoYearDigitDateString(dateStr, "19"),
|
|
100
100
|
format.replace("yy", "yyyy"),
|
|
101
101
|
today,
|
|
102
|
-
{ locale }
|
|
102
|
+
{ locale },
|
|
103
103
|
);
|
|
104
104
|
|
|
105
105
|
const date21Century = parse(
|
|
106
106
|
appendCenturyToTwoYearDigitDateString(dateStr, "20"),
|
|
107
107
|
format.replace("yy", "yyyy"),
|
|
108
108
|
today,
|
|
109
|
-
{ locale }
|
|
109
|
+
{ locale },
|
|
110
110
|
);
|
|
111
111
|
|
|
112
112
|
if (isValidDate(date20Century) && isValidDate(date21Century)) {
|
|
@@ -114,7 +114,7 @@ function assignCenturyToDate(
|
|
|
114
114
|
date20Century,
|
|
115
115
|
sub(new Date(), {
|
|
116
116
|
years: 80,
|
|
117
|
-
})
|
|
117
|
+
}),
|
|
118
118
|
)
|
|
119
119
|
? date21Century
|
|
120
120
|
: date20Century;
|
|
@@ -125,11 +125,11 @@ function assignCenturyToDate(
|
|
|
125
125
|
|
|
126
126
|
function appendCenturyToTwoYearDigitDateString(
|
|
127
127
|
dateString: string,
|
|
128
|
-
century: "19" | "20"
|
|
128
|
+
century: "19" | "20",
|
|
129
129
|
) {
|
|
130
130
|
const twoDigitYear = dateString.slice(-2);
|
|
131
131
|
return `${dateString.slice(
|
|
132
132
|
0,
|
|
133
|
-
dateString.length - 2
|
|
133
|
+
dateString.length - 2,
|
|
134
134
|
)}${century}${twoDigitYear}`;
|
|
135
135
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
+
import { useControllableState } from "../util/hooks/useControllableState";
|
|
2
3
|
import Menu, { MenuType } from "./Menu";
|
|
3
4
|
import Toggle, { ToggleProps } from "./Toggle";
|
|
4
5
|
import { DropdownContext } from "./context";
|
|
@@ -22,6 +23,10 @@ export interface DropdownProps {
|
|
|
22
23
|
* Controlled state of the dropdown. When set, you will need to handle onClose and onSelect manually.
|
|
23
24
|
*/
|
|
24
25
|
open?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Change handler for open
|
|
28
|
+
*/
|
|
29
|
+
onOpenChange?: (open: boolean) => void;
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
export interface DropdownType extends React.FC<DropdownProps> {
|
|
@@ -74,28 +79,26 @@ export const Dropdown = (({
|
|
|
74
79
|
closeOnSelect = true,
|
|
75
80
|
defaultOpen = false,
|
|
76
81
|
open,
|
|
82
|
+
onOpenChange,
|
|
77
83
|
}) => {
|
|
78
|
-
const [isOpen, setIsOpen] = useState<boolean>(defaultOpen);
|
|
79
84
|
const [anchorEl, setAnchorEl] = useState<Element | null>(null);
|
|
80
85
|
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
+
const [_open, _setOpen] = useControllableState({
|
|
87
|
+
defaultValue: defaultOpen,
|
|
88
|
+
value: open,
|
|
89
|
+
onChange: onOpenChange,
|
|
90
|
+
});
|
|
86
91
|
|
|
87
92
|
return (
|
|
88
93
|
<DropdownContext.Provider
|
|
89
94
|
value={{
|
|
90
|
-
isOpen:
|
|
91
|
-
handleToggle,
|
|
95
|
+
isOpen: _open,
|
|
96
|
+
handleToggle: _setOpen,
|
|
92
97
|
anchorEl,
|
|
93
98
|
setAnchorEl,
|
|
94
99
|
onSelect: (event) => {
|
|
95
100
|
onSelect?.(event);
|
|
96
|
-
|
|
97
|
-
open === undefined && setIsOpen(false);
|
|
98
|
-
}
|
|
101
|
+
closeOnSelect && _setOpen(false);
|
|
99
102
|
},
|
|
100
103
|
}}
|
|
101
104
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
3
|
|
|
4
4
|
export interface GroupedHeadingProps
|
|
5
5
|
extends React.HTMLAttributes<HTMLDetailsElement> {
|
|
@@ -20,7 +20,7 @@ export const GroupedHeading = forwardRef<
|
|
|
20
20
|
"navds-dropdown__list-heading",
|
|
21
21
|
"navds-heading",
|
|
22
22
|
"navds-heading--xsmall",
|
|
23
|
-
className
|
|
23
|
+
className,
|
|
24
24
|
)}
|
|
25
25
|
/>
|
|
26
26
|
));
|
|
@@ -114,7 +114,7 @@ export const ExpansionCard = forwardRef<HTMLDivElement, ExpansionCardProps>(
|
|
|
114
114
|
size = "medium",
|
|
115
115
|
...rest
|
|
116
116
|
},
|
|
117
|
-
ref
|
|
117
|
+
ref,
|
|
118
118
|
) => {
|
|
119
119
|
const [_open, _setOpen] = useState(defaultOpen);
|
|
120
120
|
|
|
@@ -144,13 +144,13 @@ export const ExpansionCard = forwardRef<HTMLDivElement, ExpansionCardProps>(
|
|
|
144
144
|
{
|
|
145
145
|
"navds-expansioncard--open": open ?? _open,
|
|
146
146
|
"navds-expansioncard--no-animation": !shouldFade.current,
|
|
147
|
-
}
|
|
147
|
+
},
|
|
148
148
|
)}
|
|
149
149
|
ref={ref}
|
|
150
150
|
/>
|
|
151
151
|
</ExpansionCardContext.Provider>
|
|
152
152
|
);
|
|
153
|
-
}
|
|
153
|
+
},
|
|
154
154
|
) as ExpansionCardComponent;
|
|
155
155
|
|
|
156
156
|
ExpansionCard.Header = ExpansionCardHeader;
|
|
@@ -16,7 +16,7 @@ const ExpansionCardContent = forwardRef<
|
|
|
16
16
|
|
|
17
17
|
if (panelContext === null) {
|
|
18
18
|
console.error(
|
|
19
|
-
"<ExpansionCard.Content> has to be used within an <ExpansionCard>"
|
|
19
|
+
"<ExpansionCard.Content> has to be used within an <ExpansionCard>",
|
|
20
20
|
);
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
@@ -16,7 +16,7 @@ export const ExpansionCardDescription = forwardRef<
|
|
|
16
16
|
|
|
17
17
|
if (panelContext === null) {
|
|
18
18
|
console.error(
|
|
19
|
-
"<ExpansionCard.Description> has to be used within an <ExpansionCard>"
|
|
19
|
+
"<ExpansionCard.Description> has to be used within an <ExpansionCard>",
|
|
20
20
|
);
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
2
1
|
import cl from "clsx";
|
|
3
2
|
import React, { forwardRef, useContext } from "react";
|
|
3
|
+
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { ExpansionCardContext } from "./context";
|
|
5
5
|
|
|
6
6
|
export interface ExpansionCardHeaderProps
|
|
@@ -16,7 +16,7 @@ const ExpansionCardHeader = forwardRef<
|
|
|
16
16
|
|
|
17
17
|
if (panelContext === null) {
|
|
18
18
|
console.error(
|
|
19
|
-
"<ExpansionCard.Header> has to be used within an <ExpansionCard>"
|
|
19
|
+
"<ExpansionCard.Header> has to be used within an <ExpansionCard>",
|
|
20
20
|
);
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PlantIcon } from "@navikt/aksel-icons";
|
|
2
1
|
import { Meta, StoryFn } from "@storybook/react";
|
|
3
2
|
import React, { useState } from "react";
|
|
3
|
+
import { PlantIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { ExpansionCard, ExpansionCardProps } from ".";
|
|
5
5
|
import { BodyLong } from "../typography";
|
|
6
6
|
|
|
@@ -52,7 +52,7 @@ export const ConfirmationPanel = forwardRef<
|
|
|
52
52
|
>(({ className, children, label, ...props }, ref) => {
|
|
53
53
|
const { errorId, showErrorMsg, hasError, size, inputProps } = useFormField(
|
|
54
54
|
props,
|
|
55
|
-
"confirmation-panel"
|
|
55
|
+
"confirmation-panel",
|
|
56
56
|
);
|
|
57
57
|
|
|
58
58
|
const id = useId();
|
|
@@ -82,7 +82,7 @@ export const ConfirmationPanel = forwardRef<
|
|
|
82
82
|
{...inputProps}
|
|
83
83
|
aria-describedby={cl(
|
|
84
84
|
inputProps["aria-describedby"],
|
|
85
|
-
children && `confirmation-panel-${id}
|
|
85
|
+
children && `confirmation-panel-${id}`,
|
|
86
86
|
)}
|
|
87
87
|
error={hasError}
|
|
88
88
|
size={size}
|
|
@@ -79,7 +79,7 @@ export const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(
|
|
|
79
79
|
{
|
|
80
80
|
"navds-fieldset--error": hasError,
|
|
81
81
|
"navds-fieldset--readonly": readOnly,
|
|
82
|
-
}
|
|
82
|
+
},
|
|
83
83
|
)}
|
|
84
84
|
>
|
|
85
85
|
<Label
|
|
@@ -118,7 +118,7 @@ export const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(
|
|
|
118
118
|
</fieldset>
|
|
119
119
|
</FieldsetContext.Provider>
|
|
120
120
|
);
|
|
121
|
-
}
|
|
121
|
+
},
|
|
122
122
|
);
|
|
123
123
|
|
|
124
124
|
export default Fieldset;
|
package/src/form/Select.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
2
1
|
import cl from "clsx";
|
|
3
|
-
import React, {
|
|
2
|
+
import React, { SelectHTMLAttributes, forwardRef } from "react";
|
|
3
|
+
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { BodyShort, ErrorMessage, Label } from "../typography";
|
|
5
5
|
import { omit } from "../util";
|
|
6
6
|
import { ReadOnlyIcon } from "./ReadOnlyIcon";
|
|
@@ -83,7 +83,7 @@ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|
|
83
83
|
if (
|
|
84
84
|
readOnly &&
|
|
85
85
|
["ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft", " "].includes(
|
|
86
|
-
evt.key
|
|
86
|
+
evt.key,
|
|
87
87
|
)
|
|
88
88
|
) {
|
|
89
89
|
evt.preventDefault();
|
|
@@ -102,7 +102,7 @@ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|
|
102
102
|
"navds-form-field--readonly": readOnly,
|
|
103
103
|
"navds-select--error": hasError,
|
|
104
104
|
"navds-select--readonly": readOnly,
|
|
105
|
-
}
|
|
105
|
+
},
|
|
106
106
|
)}
|
|
107
107
|
>
|
|
108
108
|
<Label
|
|
@@ -136,7 +136,7 @@ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|
|
136
136
|
className={cl(
|
|
137
137
|
"navds-select__input",
|
|
138
138
|
"navds-body-short",
|
|
139
|
-
`navds-body-short--${size ?? "medium"}
|
|
139
|
+
`navds-body-short--${size ?? "medium"}`,
|
|
140
140
|
)}
|
|
141
141
|
size={htmlSize}
|
|
142
142
|
>
|
|
@@ -156,7 +156,7 @@ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|
|
156
156
|
</div>
|
|
157
157
|
</div>
|
|
158
158
|
);
|
|
159
|
-
}
|
|
159
|
+
},
|
|
160
160
|
);
|
|
161
161
|
|
|
162
162
|
export default Select;
|
package/src/form/Switch.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, {
|
|
3
|
-
forwardRef,
|
|
4
3
|
InputHTMLAttributes,
|
|
4
|
+
forwardRef,
|
|
5
5
|
useEffect,
|
|
6
6
|
useState,
|
|
7
7
|
} from "react";
|
|
@@ -86,7 +86,7 @@ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
|
|
|
86
86
|
} = props;
|
|
87
87
|
|
|
88
88
|
const [checked, setChecked] = useState(
|
|
89
|
-
defaultChecked ?? checkedProp ?? false
|
|
89
|
+
defaultChecked ?? checkedProp ?? false,
|
|
90
90
|
);
|
|
91
91
|
|
|
92
92
|
useEffect(() => {
|
|
@@ -104,7 +104,7 @@ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
|
|
|
104
104
|
"navds-switch--loading": loading,
|
|
105
105
|
"navds-switch--disabled": inputProps.disabled ?? loading,
|
|
106
106
|
"navds-switch--readonly": readOnly,
|
|
107
|
-
}
|
|
107
|
+
},
|
|
108
108
|
)}
|
|
109
109
|
>
|
|
110
110
|
<input
|
|
@@ -168,7 +168,7 @@ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
|
|
|
168
168
|
</label>
|
|
169
169
|
</div>
|
|
170
170
|
);
|
|
171
|
-
}
|
|
171
|
+
},
|
|
172
172
|
);
|
|
173
173
|
|
|
174
174
|
export default Switch;
|
package/src/form/TextField.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { InputHTMLAttributes, forwardRef } from "react";
|
|
3
3
|
import { BodyShort, ErrorMessage, Label } from "../typography";
|
|
4
4
|
import { omit } from "../util";
|
|
5
5
|
import { ReadOnlyIcon } from "./ReadOnlyIcon";
|
|
@@ -81,7 +81,7 @@ export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
81
81
|
"navds-form-field--disabled": !!inputProps.disabled,
|
|
82
82
|
"navds-form-field--readonly": readOnly,
|
|
83
83
|
"navds-text-field--readonly": readOnly,
|
|
84
|
-
}
|
|
84
|
+
},
|
|
85
85
|
)}
|
|
86
86
|
>
|
|
87
87
|
<Label
|
|
@@ -116,7 +116,7 @@ export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
116
116
|
className={cl(
|
|
117
117
|
"navds-text-field__input",
|
|
118
118
|
"navds-body-short",
|
|
119
|
-
`navds-body-short--${size ?? "medium"}
|
|
119
|
+
`navds-body-short--${size ?? "medium"}`,
|
|
120
120
|
)}
|
|
121
121
|
size={htmlSize}
|
|
122
122
|
/>
|
|
@@ -132,7 +132,7 @@ export const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
132
132
|
</div>
|
|
133
133
|
</div>
|
|
134
134
|
);
|
|
135
|
-
}
|
|
135
|
+
},
|
|
136
136
|
);
|
|
137
137
|
|
|
138
138
|
export default TextField;
|
package/src/form/Textarea.tsx
CHANGED
|
@@ -102,7 +102,7 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
102
102
|
const hasMaxLength = maxLength !== undefined && maxLength > 0;
|
|
103
103
|
|
|
104
104
|
const [controlledValue, setControlledValue] = useState<string>(
|
|
105
|
-
props?.defaultValue ?? ""
|
|
105
|
+
props?.defaultValue ?? "",
|
|
106
106
|
);
|
|
107
107
|
|
|
108
108
|
const getMinRows = () => {
|
|
@@ -131,7 +131,7 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
131
131
|
"navds-textarea--autoscrollbar": UNSAFE_autoScrollbar,
|
|
132
132
|
[`navds-textarea--resize-${resize === true ? "both" : resize}`]:
|
|
133
133
|
resize,
|
|
134
|
-
}
|
|
134
|
+
},
|
|
135
135
|
)}
|
|
136
136
|
>
|
|
137
137
|
<Label
|
|
@@ -172,7 +172,7 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
172
172
|
className={cl(
|
|
173
173
|
"navds-textarea__input",
|
|
174
174
|
"navds-body-short",
|
|
175
|
-
`navds-body-short--${size ?? "medium"}
|
|
175
|
+
`navds-body-short--${size ?? "medium"}`,
|
|
176
176
|
)}
|
|
177
177
|
{...(describedBy ? { "aria-describedby": describedBy } : {})}
|
|
178
178
|
/>
|
|
@@ -202,7 +202,7 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
202
202
|
</div>
|
|
203
203
|
</div>
|
|
204
204
|
);
|
|
205
|
-
}
|
|
205
|
+
},
|
|
206
206
|
);
|
|
207
207
|
|
|
208
208
|
export default Textarea;
|