@navikt/ds-react 5.12.4 → 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 +7 -7
- 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/Input/Input.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 +7 -7
- 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/Input/Input.js +4 -4
- 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/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 +7 -7
- 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 +13 -13
- 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
package/src/list/ListItem.tsx
CHANGED
|
@@ -24,7 +24,7 @@ export const ListItem = forwardRef<HTMLLIElement, ListItemProps>(
|
|
|
24
24
|
|
|
25
25
|
if (listType === "ol" && icon) {
|
|
26
26
|
console.warn(
|
|
27
|
-
"<List />: Icon prop is not supported for ordered lists. Please remove the icon prop."
|
|
27
|
+
"<List />: Icon prop is not supported for ordered lists. Please remove the icon prop.",
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -66,7 +66,7 @@ export const ListItem = forwardRef<HTMLLIElement, ListItemProps>(
|
|
|
66
66
|
</BodyShort>
|
|
67
67
|
</li>
|
|
68
68
|
);
|
|
69
|
-
}
|
|
69
|
+
},
|
|
70
70
|
);
|
|
71
71
|
|
|
72
72
|
ListItem.displayName = "List.Item";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { Meta } from "@storybook/react";
|
|
2
|
+
import React from "react";
|
|
1
3
|
import {
|
|
2
4
|
BabyWrappedIcon,
|
|
3
5
|
BrailleIcon,
|
|
4
6
|
HeadHeartIcon,
|
|
5
7
|
RecycleIcon,
|
|
6
8
|
} from "@navikt/aksel-icons";
|
|
7
|
-
import { Meta } from "@storybook/react";
|
|
8
|
-
import React from "react";
|
|
9
9
|
import { List, VStack } from "..";
|
|
10
10
|
|
|
11
11
|
export default {
|
package/src/loader/Loader.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { SVGProps, forwardRef } from "react";
|
|
3
3
|
import { omit, useId } from "../util";
|
|
4
4
|
|
|
5
5
|
export interface LoaderProps extends Omit<SVGProps<SVGSVGElement>, "ref"> {
|
|
@@ -66,7 +66,7 @@ export const Loader: LoaderType = forwardRef<SVGSVGElement, LoaderProps>(
|
|
|
66
66
|
id,
|
|
67
67
|
...rest
|
|
68
68
|
},
|
|
69
|
-
ref
|
|
69
|
+
ref,
|
|
70
70
|
) => {
|
|
71
71
|
const internalId = useId();
|
|
72
72
|
|
|
@@ -81,7 +81,7 @@ export const Loader: LoaderType = forwardRef<SVGSVGElement, LoaderProps>(
|
|
|
81
81
|
`navds-loader--${variant}`,
|
|
82
82
|
{
|
|
83
83
|
"navds-loader--transparent": transparent,
|
|
84
|
-
}
|
|
84
|
+
},
|
|
85
85
|
)}
|
|
86
86
|
focusable="false"
|
|
87
87
|
viewBox="0 0 50 50"
|
|
@@ -107,7 +107,7 @@ export const Loader: LoaderType = forwardRef<SVGSVGElement, LoaderProps>(
|
|
|
107
107
|
/>
|
|
108
108
|
</svg>
|
|
109
109
|
);
|
|
110
|
-
}
|
|
110
|
+
},
|
|
111
111
|
);
|
|
112
112
|
|
|
113
113
|
export default Loader;
|
package/src/modal/Modal.test.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
1
|
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
3
|
import { Button, Modal } from "..";
|
|
4
4
|
import { BODY_CLASS } from "./ModalUtils";
|
|
5
5
|
|
|
@@ -34,7 +34,7 @@ describe("Modal", () => {
|
|
|
34
34
|
|
|
35
35
|
fireEvent.click(screen.getByText("Close"));
|
|
36
36
|
await waitFor(() =>
|
|
37
|
-
expect(document.body.classList).not.toContain(BODY_CLASS)
|
|
37
|
+
expect(document.body.classList).not.toContain(BODY_CLASS),
|
|
38
38
|
);
|
|
39
39
|
});
|
|
40
40
|
|
|
@@ -42,13 +42,13 @@ describe("Modal", () => {
|
|
|
42
42
|
render(
|
|
43
43
|
<Modal portal open>
|
|
44
44
|
<Modal.Header />
|
|
45
|
-
</Modal
|
|
45
|
+
</Modal>,
|
|
46
46
|
);
|
|
47
47
|
expect(document.body.classList).toContain(BODY_CLASS);
|
|
48
48
|
|
|
49
49
|
fireEvent.click(screen.getByRole("button"));
|
|
50
50
|
await waitFor(() =>
|
|
51
|
-
expect(document.body.classList).not.toContain(BODY_CLASS)
|
|
51
|
+
expect(document.body.classList).not.toContain(BODY_CLASS),
|
|
52
52
|
);
|
|
53
53
|
});
|
|
54
54
|
});
|
package/src/modal/Modal.tsx
CHANGED
|
@@ -92,7 +92,7 @@ export const Modal = forwardRef<HTMLDialogElement, ModalProps>(
|
|
|
92
92
|
onClick,
|
|
93
93
|
...rest
|
|
94
94
|
}: ModalProps,
|
|
95
|
-
ref
|
|
95
|
+
ref,
|
|
96
96
|
) => {
|
|
97
97
|
const modalRef = useRef<HTMLDialogElement>(null);
|
|
98
98
|
const mergedRef = useMemo(() => mergeRefs([modalRef, ref]), [ref]);
|
|
@@ -217,7 +217,7 @@ export const Modal = forwardRef<HTMLDialogElement, ModalProps>(
|
|
|
217
217
|
return null;
|
|
218
218
|
}
|
|
219
219
|
return component;
|
|
220
|
-
}
|
|
220
|
+
},
|
|
221
221
|
) as ModalComponent;
|
|
222
222
|
|
|
223
223
|
Modal.Header = ModalHeader;
|
package/src/modal/ModalBody.tsx
CHANGED
|
@@ -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 ModalBodyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
children: React.ReactNode;
|
|
@@ -8,7 +8,7 @@ export interface ModalBodyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
8
8
|
const ModalBody = forwardRef<HTMLDivElement, ModalBodyProps>(
|
|
9
9
|
({ className, ...rest }, ref) => (
|
|
10
10
|
<div {...rest} ref={ref} className={cl("navds-modal__body", className)} />
|
|
11
|
-
)
|
|
11
|
+
),
|
|
12
12
|
);
|
|
13
13
|
|
|
14
14
|
export default ModalBody;
|
|
@@ -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 ModalFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
children: React.ReactNode;
|
|
@@ -8,7 +8,7 @@ export interface ModalFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
8
8
|
const ModalFooter = forwardRef<HTMLDivElement, ModalFooterProps>(
|
|
9
9
|
({ className, ...rest }, ref) => (
|
|
10
10
|
<div {...rest} ref={ref} className={cl("navds-modal__footer", className)} />
|
|
11
|
-
)
|
|
11
|
+
),
|
|
12
12
|
);
|
|
13
13
|
|
|
14
14
|
export default ModalFooter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { forwardRef, useContext } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
2
|
+
import React, { forwardRef, useContext } from "react";
|
|
3
3
|
import { XMarkIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { Button } from "../button";
|
|
5
5
|
import { ModalContext } from "./ModalContext";
|
|
@@ -36,7 +36,7 @@ const ModalHeader = forwardRef<HTMLDivElement, ModalHeaderProps>(
|
|
|
36
36
|
{children}
|
|
37
37
|
</div>
|
|
38
38
|
);
|
|
39
|
-
}
|
|
39
|
+
},
|
|
40
40
|
);
|
|
41
41
|
|
|
42
42
|
export default ModalHeader;
|
package/src/modal/ModalUtils.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { ModalProps } from "./types";
|
|
|
4
4
|
export function getCloseHandler(
|
|
5
5
|
modalRef: React.RefObject<HTMLDialogElement>,
|
|
6
6
|
header: ModalProps["header"],
|
|
7
|
-
onBeforeClose: ModalProps["onBeforeClose"]
|
|
7
|
+
onBeforeClose: ModalProps["onBeforeClose"],
|
|
8
8
|
) {
|
|
9
9
|
if (header && header.closeButton === false) return undefined;
|
|
10
10
|
if (onBeforeClose) {
|
|
@@ -17,7 +17,7 @@ export const BODY_CLASS = "navds-modal__document-body";
|
|
|
17
17
|
|
|
18
18
|
export function useBodyScrollLock(
|
|
19
19
|
modalRef: React.RefObject<HTMLDialogElement>,
|
|
20
|
-
portalNode: HTMLElement | null
|
|
20
|
+
portalNode: HTMLElement | null,
|
|
21
21
|
) {
|
|
22
22
|
React.useEffect(() => {
|
|
23
23
|
if (!modalRef.current || !portalNode) return; // We check both to avoid running this twice when not using portal
|
|
@@ -273,7 +273,7 @@ function dialogPolyfillInfo(dialog) {
|
|
|
273
273
|
["DOMAttrModified", "DOMNodeRemoved", "DOMNodeRemovedFromDocument"].forEach(
|
|
274
274
|
function (name) {
|
|
275
275
|
dialog.addEventListener(name, delayModel);
|
|
276
|
-
}
|
|
276
|
+
},
|
|
277
277
|
);
|
|
278
278
|
}
|
|
279
279
|
// Note that the DOM is observed inside DialogManager while any dialog
|
|
@@ -288,11 +288,11 @@ function dialogPolyfillInfo(dialog) {
|
|
|
288
288
|
this.backdrop_.className = "backdrop";
|
|
289
289
|
this.backdrop_.addEventListener(
|
|
290
290
|
"mouseup",
|
|
291
|
-
this.backdropMouseEvent_.bind(this)
|
|
291
|
+
this.backdropMouseEvent_.bind(this),
|
|
292
292
|
);
|
|
293
293
|
this.backdrop_.addEventListener(
|
|
294
294
|
"mousedown",
|
|
295
|
-
this.backdropMouseEvent_.bind(this)
|
|
295
|
+
this.backdropMouseEvent_.bind(this),
|
|
296
296
|
);
|
|
297
297
|
this.backdrop_.addEventListener("click", this.backdropMouseEvent_.bind(this));
|
|
298
298
|
}
|
|
@@ -387,7 +387,7 @@ dialogPolyfillInfo.prototype = /** @type {HTMLDialogElement.prototype} */ {
|
|
|
387
387
|
e.shiftKey,
|
|
388
388
|
e.metaKey,
|
|
389
389
|
e.button,
|
|
390
|
-
e.relatedTarget
|
|
390
|
+
e.relatedTarget,
|
|
391
391
|
);
|
|
392
392
|
this.dialog_.dispatchEvent(redirectedEvent);
|
|
393
393
|
e.stopPropagation();
|
|
@@ -440,17 +440,17 @@ dialogPolyfillInfo.prototype = /** @type {HTMLDialogElement.prototype} */ {
|
|
|
440
440
|
showModal: function () {
|
|
441
441
|
if (this.dialog_.hasAttribute("open")) {
|
|
442
442
|
throw new Error(
|
|
443
|
-
"Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally."
|
|
443
|
+
"Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.",
|
|
444
444
|
);
|
|
445
445
|
}
|
|
446
446
|
if (!isConnected(this.dialog_)) {
|
|
447
447
|
throw new Error(
|
|
448
|
-
"Failed to execute 'showModal' on dialog: The element is not in a Document."
|
|
448
|
+
"Failed to execute 'showModal' on dialog: The element is not in a Document.",
|
|
449
449
|
);
|
|
450
450
|
}
|
|
451
451
|
if (!dialogPolyfill.dm.pushDialog(this)) {
|
|
452
452
|
throw new Error(
|
|
453
|
-
"Failed to execute 'showModal' on dialog: There are too many open modal dialogs."
|
|
453
|
+
"Failed to execute 'showModal' on dialog: There are too many open modal dialogs.",
|
|
454
454
|
);
|
|
455
455
|
}
|
|
456
456
|
|
|
@@ -468,7 +468,7 @@ dialogPolyfillInfo.prototype = /** @type {HTMLDialogElement.prototype} */ {
|
|
|
468
468
|
// Insert backdrop.
|
|
469
469
|
this.dialog_.parentNode.insertBefore(
|
|
470
470
|
this.backdrop_,
|
|
471
|
-
this.dialog_.nextSibling
|
|
471
|
+
this.dialog_.nextSibling,
|
|
472
472
|
);
|
|
473
473
|
|
|
474
474
|
// Focus on whatever inside the dialog.
|
|
@@ -484,7 +484,7 @@ dialogPolyfillInfo.prototype = /** @type {HTMLDialogElement.prototype} */ {
|
|
|
484
484
|
close: function (opt_returnValue) {
|
|
485
485
|
if (!this.dialog_.hasAttribute("open")) {
|
|
486
486
|
throw new Error(
|
|
487
|
-
"Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed."
|
|
487
|
+
"Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.",
|
|
488
488
|
);
|
|
489
489
|
}
|
|
490
490
|
this.setOpen(false);
|
|
@@ -576,7 +576,7 @@ dialogPolyfill.forceRegisterDialog = function (element) {
|
|
|
576
576
|
console.warn(
|
|
577
577
|
"This browser already supports <dialog>, the polyfill " +
|
|
578
578
|
"may not work correctly",
|
|
579
|
-
element
|
|
579
|
+
element,
|
|
580
580
|
);
|
|
581
581
|
}
|
|
582
582
|
if (element.localName !== "dialog") {
|
|
@@ -616,7 +616,7 @@ dialogPolyfill.DialogManager = function () {
|
|
|
616
616
|
this.forwardTab_ = undefined;
|
|
617
617
|
e.stopPropagation();
|
|
618
618
|
checkDOM([]); // sanity-check DOM
|
|
619
|
-
}.bind(this)
|
|
619
|
+
}.bind(this),
|
|
620
620
|
);
|
|
621
621
|
|
|
622
622
|
this.handleKey_ = this.handleKey_.bind(this);
|
|
@@ -663,7 +663,7 @@ dialogPolyfill.DialogManager.prototype.unblockDocument = function () {
|
|
|
663
663
|
document.documentElement.removeEventListener(
|
|
664
664
|
"focus",
|
|
665
665
|
this.handleFocus_,
|
|
666
|
-
true
|
|
666
|
+
true,
|
|
667
667
|
);
|
|
668
668
|
document.removeEventListener("keydown", this.handleKey_);
|
|
669
669
|
this.mo_ && this.mo_.disconnect();
|
|
@@ -697,7 +697,7 @@ dialogPolyfill.DialogManager.prototype.updateStacking = function () {
|
|
|
697
697
|
* @return {boolean} whether candidate is contained in top dialog
|
|
698
698
|
*/
|
|
699
699
|
dialogPolyfill.DialogManager.prototype.containedByTopDialog_ = function (
|
|
700
|
-
candidate
|
|
700
|
+
candidate,
|
|
701
701
|
) {
|
|
702
702
|
while ((candidate = findNearestDialog(candidate))) {
|
|
703
703
|
for (var i = 0, dpi; (dpi = this.pendingDialogStack[i]); ++i) {
|
|
@@ -837,7 +837,7 @@ if (needPolyfill) {
|
|
|
837
837
|
if (testForm.method !== "dialog") {
|
|
838
838
|
var methodDescriptor = Object.getOwnPropertyDescriptor(
|
|
839
839
|
HTMLFormElement.prototype,
|
|
840
|
-
"method"
|
|
840
|
+
"method",
|
|
841
841
|
);
|
|
842
842
|
if (methodDescriptor) {
|
|
843
843
|
// nb. Some older iOS and older PhantomJS fail to return the descriptor. Don't do anything
|
|
@@ -860,7 +860,7 @@ if (needPolyfill) {
|
|
|
860
860
|
Object.defineProperty(
|
|
861
861
|
HTMLFormElement.prototype,
|
|
862
862
|
"method",
|
|
863
|
-
methodDescriptor
|
|
863
|
+
methodDescriptor,
|
|
864
864
|
);
|
|
865
865
|
}
|
|
866
866
|
}
|
|
@@ -906,7 +906,7 @@ if (needPolyfill) {
|
|
|
906
906
|
|
|
907
907
|
dialogPolyfill.formSubmitter = target;
|
|
908
908
|
},
|
|
909
|
-
false
|
|
909
|
+
false,
|
|
910
910
|
);
|
|
911
911
|
|
|
912
912
|
/**
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
2
|
import React, { forwardRef } from "react";
|
|
3
|
-
|
|
4
3
|
import { ChevronLeftIcon, ChevronRightIcon } from "@navikt/aksel-icons";
|
|
5
4
|
import { BodyShort } from "../typography";
|
|
6
5
|
import PaginationItem, {
|
|
@@ -72,7 +71,7 @@ export const getSteps = ({
|
|
|
72
71
|
|
|
73
72
|
const siblingsStart = Math.max(
|
|
74
73
|
Math.min(page - siblingCount, count - boundaryCount - siblingCount * 2 - 1),
|
|
75
|
-
boundaryCount + 2
|
|
74
|
+
boundaryCount + 2,
|
|
76
75
|
);
|
|
77
76
|
const siblingsEnd = siblingsStart + siblingCount * 2;
|
|
78
77
|
|
|
@@ -122,7 +121,7 @@ export const Pagination = forwardRef<HTMLElement, PaginationProps>(
|
|
|
122
121
|
),
|
|
123
122
|
...rest
|
|
124
123
|
},
|
|
125
|
-
ref
|
|
124
|
+
ref,
|
|
126
125
|
) => {
|
|
127
126
|
if (page < 1) {
|
|
128
127
|
console.error("page cannot be less than 1");
|
|
@@ -148,7 +147,7 @@ export const Pagination = forwardRef<HTMLElement, PaginationProps>(
|
|
|
148
147
|
className={cl(
|
|
149
148
|
"navds-pagination",
|
|
150
149
|
`navds-pagination--${size}`,
|
|
151
|
-
className
|
|
150
|
+
className,
|
|
152
151
|
)}
|
|
153
152
|
>
|
|
154
153
|
<ul className="navds-pagination__list">
|
|
@@ -204,7 +203,7 @@ export const Pagination = forwardRef<HTMLElement, PaginationProps>(
|
|
|
204
203
|
</Item>
|
|
205
204
|
</li>
|
|
206
205
|
);
|
|
207
|
-
}
|
|
206
|
+
},
|
|
208
207
|
)}
|
|
209
208
|
<li>
|
|
210
209
|
<Item
|
|
@@ -239,7 +238,7 @@ export const Pagination = forwardRef<HTMLElement, PaginationProps>(
|
|
|
239
238
|
</ul>
|
|
240
239
|
</nav>
|
|
241
240
|
);
|
|
242
|
-
}
|
|
241
|
+
},
|
|
243
242
|
) as PaginationType;
|
|
244
243
|
|
|
245
244
|
Pagination.Item = PaginationItem;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
3
|
import { Button, ButtonProps } from "../button";
|
|
4
4
|
import { OverridableComponent } from "../util";
|
|
5
5
|
|
|
@@ -35,7 +35,7 @@ export const Item: PaginationItemType = forwardRef(
|
|
|
35
35
|
className,
|
|
36
36
|
...rest
|
|
37
37
|
},
|
|
38
|
-
ref
|
|
38
|
+
ref,
|
|
39
39
|
) => {
|
|
40
40
|
return (
|
|
41
41
|
<Button
|
|
@@ -52,7 +52,7 @@ export const Item: PaginationItemType = forwardRef(
|
|
|
52
52
|
{children}
|
|
53
53
|
</Button>
|
|
54
54
|
);
|
|
55
|
-
}
|
|
55
|
+
},
|
|
56
56
|
);
|
|
57
57
|
|
|
58
58
|
export default Item;
|
|
@@ -5,7 +5,7 @@ describe("getSteps", () => {
|
|
|
5
5
|
it("lists all pages when count is <= 7", () => {
|
|
6
6
|
const count = faker.datatype.number({ min: 1, max: 7 });
|
|
7
7
|
expect(getSteps({ page: 1, count })).toEqual(
|
|
8
|
-
Array.from({ length: count }, (_, i) => i + 1)
|
|
8
|
+
Array.from({ length: count }, (_, i) => i + 1),
|
|
9
9
|
);
|
|
10
10
|
});
|
|
11
11
|
|
|
@@ -16,7 +16,7 @@ describe("getSteps", () => {
|
|
|
16
16
|
getSteps({
|
|
17
17
|
page,
|
|
18
18
|
count,
|
|
19
|
-
})
|
|
19
|
+
}),
|
|
20
20
|
).toEqual([1, 2, 3, 4, 5, "ellipsis", count]);
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@ describe("getSteps", () => {
|
|
|
27
27
|
getSteps({
|
|
28
28
|
page,
|
|
29
29
|
count,
|
|
30
|
-
})
|
|
30
|
+
}),
|
|
31
31
|
).toEqual([
|
|
32
32
|
1,
|
|
33
33
|
"ellipsis",
|
|
@@ -46,7 +46,7 @@ describe("getSteps", () => {
|
|
|
46
46
|
getSteps({
|
|
47
47
|
page,
|
|
48
48
|
count,
|
|
49
|
-
})
|
|
49
|
+
}),
|
|
50
50
|
).toEqual([1, "ellipsis", page - 1, page, page + 1, "ellipsis", count]);
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -58,7 +58,7 @@ describe("getSteps", () => {
|
|
|
58
58
|
page,
|
|
59
59
|
count,
|
|
60
60
|
siblingCount: 0,
|
|
61
|
-
})
|
|
61
|
+
}),
|
|
62
62
|
).toEqual([1, "ellipsis", page, "ellipsis", count]);
|
|
63
63
|
});
|
|
64
64
|
|
|
@@ -70,7 +70,7 @@ describe("getSteps", () => {
|
|
|
70
70
|
page,
|
|
71
71
|
count,
|
|
72
72
|
siblingCount: 2,
|
|
73
|
-
})
|
|
73
|
+
}),
|
|
74
74
|
).toEqual([
|
|
75
75
|
1,
|
|
76
76
|
"ellipsis",
|
|
@@ -92,7 +92,7 @@ describe("getSteps", () => {
|
|
|
92
92
|
page,
|
|
93
93
|
count,
|
|
94
94
|
boundaryCount: 0,
|
|
95
|
-
})
|
|
95
|
+
}),
|
|
96
96
|
).toEqual(["ellipsis", page - 1, page, page + 1, "ellipsis"]);
|
|
97
97
|
});
|
|
98
98
|
|
|
@@ -104,7 +104,7 @@ describe("getSteps", () => {
|
|
|
104
104
|
page,
|
|
105
105
|
count,
|
|
106
106
|
boundaryCount: 2,
|
|
107
|
-
})
|
|
107
|
+
}),
|
|
108
108
|
).toEqual([
|
|
109
109
|
1,
|
|
110
110
|
2,
|
package/src/panel/Panel.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
3
|
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
4
|
|
|
5
5
|
export interface PanelProps extends React.HTMLAttributes<HTMLElement> {
|
|
@@ -38,7 +38,7 @@ export type PanelType = OverridableComponent<PanelProps, HTMLElement>;
|
|
|
38
38
|
export const Panel: PanelType = forwardRef(
|
|
39
39
|
(
|
|
40
40
|
{ children, className, border = false, as: Component = "div", ...rest },
|
|
41
|
-
ref
|
|
41
|
+
ref,
|
|
42
42
|
) => {
|
|
43
43
|
return (
|
|
44
44
|
<Component
|
|
@@ -51,7 +51,7 @@ export const Panel: PanelType = forwardRef(
|
|
|
51
51
|
{children}
|
|
52
52
|
</Component>
|
|
53
53
|
);
|
|
54
|
-
}
|
|
54
|
+
},
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
export default Panel;
|
|
@@ -13,7 +13,7 @@ describe("Popover", () => {
|
|
|
13
13
|
data-testid="popover-id"
|
|
14
14
|
>
|
|
15
15
|
<div />
|
|
16
|
-
</Popover
|
|
16
|
+
</Popover>,
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
expect(screen.getByTestId("popover-id")).toBeVisible();
|
|
@@ -28,7 +28,7 @@ describe("Popover", () => {
|
|
|
28
28
|
data-testid="popover-id"
|
|
29
29
|
>
|
|
30
30
|
<div />
|
|
31
|
-
</Popover
|
|
31
|
+
</Popover>,
|
|
32
32
|
);
|
|
33
33
|
|
|
34
34
|
expect(screen.getByTestId("popover-id")).not.toBeVisible();
|
|
@@ -47,7 +47,7 @@ describe("Popover", () => {
|
|
|
47
47
|
<div />
|
|
48
48
|
</Popover>
|
|
49
49
|
<a href="/#">link</a>
|
|
50
|
-
</div
|
|
50
|
+
</div>,
|
|
51
51
|
);
|
|
52
52
|
|
|
53
53
|
await act(async () => {
|
|
@@ -70,14 +70,14 @@ describe("Popover", () => {
|
|
|
70
70
|
>
|
|
71
71
|
<div />
|
|
72
72
|
</Popover>
|
|
73
|
-
</div
|
|
73
|
+
</div>,
|
|
74
74
|
);
|
|
75
75
|
|
|
76
76
|
expect(screen.getByTestId("popover-id")).toBeVisible();
|
|
77
77
|
fireEvent.keyDown(
|
|
78
78
|
// Should work anywhere
|
|
79
79
|
container,
|
|
80
|
-
{ key: "Escape" }
|
|
80
|
+
{ key: "Escape" },
|
|
81
81
|
);
|
|
82
82
|
|
|
83
83
|
expect(fn).toHaveBeenCalled();
|
|
@@ -95,7 +95,7 @@ describe("Popover", () => {
|
|
|
95
95
|
>
|
|
96
96
|
<div />
|
|
97
97
|
</Popover>
|
|
98
|
-
</div
|
|
98
|
+
</div>,
|
|
99
99
|
);
|
|
100
100
|
|
|
101
101
|
await act(async () => {
|
|
@@ -118,7 +118,7 @@ describe("Popover", () => {
|
|
|
118
118
|
>
|
|
119
119
|
<div />
|
|
120
120
|
</Popover>
|
|
121
|
-
</div
|
|
121
|
+
</div>,
|
|
122
122
|
);
|
|
123
123
|
|
|
124
124
|
expect(screen.getByTestId("popover-id")).toBeVisible();
|
package/src/popover/Popover.tsx
CHANGED
|
@@ -123,7 +123,7 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
123
123
|
flip: _flip = true,
|
|
124
124
|
...rest
|
|
125
125
|
},
|
|
126
|
-
ref
|
|
126
|
+
ref,
|
|
127
127
|
) => {
|
|
128
128
|
const arrowRef = useRef<HTMLDivElement | null>(null);
|
|
129
129
|
const isInModal = useContext(ModalContext) !== null;
|
|
@@ -165,7 +165,7 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
165
165
|
|
|
166
166
|
const floatingRef = useMemo(
|
|
167
167
|
() => mergeRefs([refs.setFloating, ref]),
|
|
168
|
-
[refs.setFloating, ref]
|
|
168
|
+
[refs.setFloating, ref],
|
|
169
169
|
);
|
|
170
170
|
|
|
171
171
|
useClientLayoutEffect(() => {
|
|
@@ -173,7 +173,7 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
173
173
|
const cleanup = autoUpdate(
|
|
174
174
|
refs.reference.current,
|
|
175
175
|
refs.floating.current,
|
|
176
|
-
update
|
|
176
|
+
update,
|
|
177
177
|
);
|
|
178
178
|
return () => cleanup();
|
|
179
179
|
}, [refs.floating, refs.reference, update, open, anchorEl]);
|
|
@@ -184,16 +184,16 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
184
184
|
(e: FocusEvent) => {
|
|
185
185
|
if (
|
|
186
186
|
e.target instanceof HTMLElement &&
|
|
187
|
-
![anchorEl, refs.floating.current].some(
|
|
188
|
-
element?.contains(e.target as Node)
|
|
187
|
+
![anchorEl, refs.floating.current].some(
|
|
188
|
+
(element) => element?.contains(e.target as Node),
|
|
189
189
|
) &&
|
|
190
190
|
!e.target.contains(refs.floating.current)
|
|
191
191
|
) {
|
|
192
192
|
open && onClose();
|
|
193
193
|
}
|
|
194
194
|
},
|
|
195
|
-
[anchorEl, refs, open, onClose]
|
|
196
|
-
)
|
|
195
|
+
[anchorEl, refs, open, onClose],
|
|
196
|
+
),
|
|
197
197
|
);
|
|
198
198
|
|
|
199
199
|
const staticSide = {
|
|
@@ -237,7 +237,7 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
|
|
|
237
237
|
)}
|
|
238
238
|
</div>
|
|
239
239
|
);
|
|
240
|
-
}
|
|
240
|
+
},
|
|
241
241
|
) as PopoverComponent;
|
|
242
242
|
|
|
243
243
|
Popover.Content = PopoverContent;
|
|
@@ -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 PopoverContentProps
|
|
5
5
|
extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -17,7 +17,7 @@ const PopoverContent: PopoverContentType = forwardRef(
|
|
|
17
17
|
ref={ref}
|
|
18
18
|
className={cl("navds-popover__content", className)}
|
|
19
19
|
/>
|
|
20
|
-
)
|
|
20
|
+
),
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
export default PopoverContent;
|