@navikt/ds-react 5.12.5 → 5.14.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 +285 -138
- package/cjs/accordion/Accordion.js +2 -2
- package/cjs/accordion/AccordionHeader.js +3 -5
- package/cjs/accordion/AccordionItem.js +11 -14
- package/cjs/alert/Alert.js +2 -2
- package/cjs/button/Button.js +11 -12
- 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 +4 -7
- package/cjs/copybutton/CopyButton.js +6 -7
- package/cjs/date/datepicker/DatePicker.js +4 -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/datepicker/parts/WeekRow.js +2 -2
- package/cjs/date/monthpicker/MonthCaption.js +1 -1
- package/cjs/date/monthpicker/MonthPicker.js +4 -3
- package/cjs/date/parts/DateInput.js +1 -1
- package/cjs/date/parts/DateWrapper.js +2 -2
- 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/dropdown/Menu/GroupedList/GroupedItem.js +3 -6
- package/cjs/dropdown/Menu/List/Item.js +3 -6
- package/cjs/dropdown/Toggle.js +6 -5
- package/cjs/expansion-card/ExpansionCardHeader.js +1 -1
- package/cjs/form/ConfirmationPanel.js +2 -2
- package/cjs/form/ReadOnlyIcon.js +1 -1
- package/cjs/form/Select.js +1 -1
- package/cjs/form/Textarea.js +2 -1
- package/cjs/form/checkbox/Checkbox.js +3 -2
- package/cjs/form/combobox/Combobox.js +7 -7
- package/cjs/form/combobox/ComboboxProvider.js +2 -2
- package/cjs/form/combobox/FilteredOptions/FilteredOptions.js +4 -4
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +5 -6
- package/cjs/form/combobox/Input/inputContext.js +2 -2
- package/cjs/form/combobox/SelectedOptions/SelectedOptions.js +1 -1
- package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js +2 -5
- package/cjs/form/error-summary/ErrorSummary.js +3 -3
- package/cjs/form/error-summary/ErrorSummaryItem.js +1 -1
- package/cjs/form/radio/Radio.js +3 -2
- package/cjs/form/radio/RadioGroup.js +2 -2
- package/cjs/form/search/Search.js +3 -2
- package/cjs/form/search/SearchButton.js +3 -5
- package/cjs/form/useFormField.js +2 -2
- package/cjs/grid/Cell.js +1 -1
- package/cjs/grid/Grid.js +1 -1
- package/cjs/guide-panel/GuidePanel.js +1 -1
- package/cjs/guide-panel/Illustration.js +2 -2
- package/cjs/help-text/HelpText.js +5 -7
- package/cjs/help-text/HelpTextIcon.js +2 -2
- 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/list/List.js +2 -2
- package/cjs/loader/Loader.js +2 -1
- package/cjs/modal/Modal.js +21 -18
- 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/Popover.js +6 -5
- package/cjs/popover/PopoverContent.js +1 -1
- package/cjs/read-more/ReadMore.js +12 -12
- package/cjs/skeleton/Skeleton.js +1 -1
- package/cjs/stepper/Step.js +6 -6
- package/cjs/table/Body.js +1 -1
- package/cjs/table/ColumnHeader.js +1 -1
- package/cjs/table/DataCell.js +3 -3
- package/cjs/table/ExpandableRow.js +23 -22
- package/cjs/table/Header.js +1 -1
- package/cjs/table/HeaderCell.js +2 -1
- package/cjs/table/Row.js +1 -1
- package/cjs/tabs/TabList.js +3 -2
- package/cjs/tabs/Tabs.js +1 -1
- package/cjs/tag/Tag.js +5 -3
- package/cjs/timeline/AxisLabels.js +1 -1
- package/cjs/timeline/Pin.js +2 -2
- package/cjs/timeline/TimelineRow.js +2 -2
- package/cjs/timeline/hooks/useTimelineRows.js +5 -3
- package/cjs/timeline/period/ClickablePeriod.js +2 -2
- package/cjs/timeline/utils/timeline.js +1 -1
- package/cjs/timeline/zoom/ZoomButton.js +1 -1
- package/cjs/toggle-group/ToggleGroup.js +3 -3
- package/cjs/tooltip/Tooltip.js +18 -12
- package/cjs/typography/BodyLong.js +1 -1
- package/cjs/typography/ErrorMessage.js +1 -1
- package/cjs/typography/Ingress.js +1 -1
- package/cjs/util/Slot.js +2 -5
- package/cjs/util/TextareaAutoSize.js +7 -5
- package/cjs/util/composeEventHandlers.js +17 -0
- package/cjs/util/hooks/index.js +19 -0
- package/cjs/util/hooks/package.json +6 -0
- package/cjs/util/hooks/useCallbackRef.js +18 -0
- package/cjs/util/hooks/useClientLayoutEffect.js +7 -0
- package/cjs/util/hooks/useControllableState.js +25 -0
- package/cjs/util/hooks/useMergeRefs.js +37 -0
- package/cjs/util/{usePrevious.js → hooks/usePrevious.js} +2 -1
- package/cjs/util/index.js +7 -7
- package/cjs/util/types/index.js +2 -0
- package/cjs/util/types/package.json +6 -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 +3 -5
- 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/button/Button.d.ts +1 -1
- package/esm/button/Button.js +12 -13
- package/esm/button/Button.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 +4 -7
- package/esm/chips/Removable.js.map +1 -1
- package/esm/chips/Toggle.d.ts +1 -1
- package/esm/copybutton/CopyButton.js +6 -7
- package/esm/copybutton/CopyButton.js.map +1 -1
- package/esm/date/context/useSharedMonthContext.js.map +1 -1
- package/esm/date/datepicker/DatePicker.js +5 -3
- package/esm/date/datepicker/DatePicker.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/datepicker/parts/WeekRow.js +1 -1
- package/esm/date/datepicker/parts/WeekRow.js.map +1 -1
- package/esm/date/monthpicker/MonthCaption.js +1 -1
- package/esm/date/monthpicker/MonthCaption.js.map +1 -1
- package/esm/date/monthpicker/MonthPicker.js +4 -3
- package/esm/date/monthpicker/MonthPicker.js.map +1 -1
- package/esm/date/parts/DateInput.js +1 -1
- package/esm/date/parts/DateInput.js.map +1 -1
- package/esm/date/parts/DateWrapper.js +1 -1
- package/esm/date/parts/DateWrapper.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/dropdown/Menu/GroupedList/GroupedItem.d.ts +1 -1
- package/esm/dropdown/Menu/GroupedList/GroupedItem.js +3 -6
- package/esm/dropdown/Menu/GroupedList/GroupedItem.js.map +1 -1
- package/esm/dropdown/Menu/GroupedList/index.d.ts +1 -1
- package/esm/dropdown/Menu/List/Item.d.ts +1 -1
- package/esm/dropdown/Menu/List/Item.js +3 -6
- package/esm/dropdown/Menu/List/Item.js.map +1 -1
- package/esm/dropdown/Menu/List/index.d.ts +1 -1
- package/esm/dropdown/Toggle.js +6 -5
- package/esm/dropdown/Toggle.js.map +1 -1
- package/esm/expansion-card/ExpansionCard.d.ts +1 -1
- package/esm/expansion-card/ExpansionCardHeader.js +1 -1
- package/esm/expansion-card/ExpansionCardHeader.js.map +1 -1
- package/esm/expansion-card/ExpansionCardTitle.d.ts +1 -1
- package/esm/form/ConfirmationPanel.js +1 -1
- package/esm/form/ConfirmationPanel.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/Textarea.js +2 -1
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/checkbox/Checkbox.js +2 -1
- package/esm/form/checkbox/Checkbox.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 +8 -8
- 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 +3 -4
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/esm/form/combobox/Input/inputContext.js +1 -1
- package/esm/form/combobox/Input/inputContext.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/SelectedOptions/selectedOptionsContext.js +1 -1
- package/esm/form/combobox/SelectedOptions/selectedOptionsContext.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.d.ts +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/Radio.js +2 -1
- package/esm/form/radio/Radio.js.map +1 -1
- package/esm/form/radio/RadioGroup.js +1 -1
- package/esm/form/radio/RadioGroup.js.map +1 -1
- package/esm/form/radio/useRadio.d.ts +1 -1
- package/esm/form/search/Search.js +5 -4
- package/esm/form/search/Search.js.map +1 -1
- package/esm/form/search/SearchButton.js +3 -5
- package/esm/form/search/SearchButton.js.map +1 -1
- package/esm/form/useFormField.js +1 -1
- package/esm/form/useFormField.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/guide-panel/Illustration.js +1 -1
- package/esm/guide-panel/Illustration.js.map +1 -1
- package/esm/help-text/HelpText.d.ts +0 -5
- package/esm/help-text/HelpText.js +6 -8
- package/esm/help-text/HelpText.js.map +1 -1
- package/esm/help-text/HelpTextIcon.js +1 -1
- package/esm/internal-header/InternalHeader.d.ts +1 -1
- package/esm/internal-header/InternalHeader.js.map +1 -1
- package/esm/internal-header/InternalHeaderButton.d.ts +1 -1
- package/esm/internal-header/InternalHeaderButton.js +1 -1
- package/esm/internal-header/InternalHeaderButton.js.map +1 -1
- package/esm/internal-header/InternalHeaderTitle.d.ts +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.d.ts +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 +2 -2
- 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 +7 -6
- 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.d.ts +1 -1
- package/esm/layout/stack/HStack.js.map +1 -1
- package/esm/layout/stack/Stack.d.ts +1 -1
- package/esm/layout/stack/Stack.js.map +1 -1
- package/esm/layout/stack/VStack.d.ts +1 -1
- package/esm/layout/stack/VStack.js.map +1 -1
- package/esm/layout/utilities/types.d.ts +2 -2
- package/esm/link/Link.d.ts +1 -1
- 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.d.ts +1 -1
- package/esm/link-panel/LinkPanelTitle.js +1 -1
- package/esm/link-panel/LinkPanelTitle.js.map +1 -1
- package/esm/list/List.js +1 -1
- package/esm/loader/Loader.js +2 -1
- package/esm/loader/Loader.js.map +1 -1
- package/esm/modal/Modal.js +21 -18
- package/esm/modal/Modal.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/modal/types.d.ts +1 -1
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/pagination/PaginationItem.d.ts +1 -1
- package/esm/pagination/PaginationItem.js +1 -1
- package/esm/pagination/PaginationItem.js.map +1 -1
- package/esm/panel/Panel.d.ts +1 -1
- package/esm/panel/Panel.js +1 -1
- package/esm/panel/Panel.js.map +1 -1
- package/esm/popover/Popover.d.ts +1 -1
- package/esm/popover/Popover.js +4 -3
- 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 -13
- 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/stepper/Step.d.ts +1 -1
- package/esm/stepper/Step.js +6 -6
- package/esm/stepper/Step.js.map +1 -1
- package/esm/table/AnimateHeight.js.map +1 -0
- 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.d.ts +4 -0
- package/esm/table/DataCell.js +3 -3
- package/esm/table/DataCell.js.map +1 -1
- package/esm/table/ExpandableRow.js +23 -22
- 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/HeaderCell.d.ts +4 -0
- package/esm/table/HeaderCell.js +2 -1
- package/esm/table/HeaderCell.js.map +1 -1
- package/esm/table/Row.js +1 -1
- package/esm/table/Row.js.map +1 -1
- package/esm/tabs/Tab.d.ts +1 -1
- package/esm/tabs/TabList.js +4 -3
- package/esm/tabs/TabList.js.map +1 -1
- package/esm/tabs/Tabs.d.ts +1 -1
- package/esm/tabs/Tabs.js +1 -1
- package/esm/tabs/Tabs.js.map +1 -1
- package/esm/tag/Tag.d.ts +4 -0
- package/esm/tag/Tag.js +5 -3
- 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/Pin.js +3 -3
- package/esm/timeline/Pin.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/period/ClickablePeriod.js +3 -3
- package/esm/timeline/period/ClickablePeriod.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 +2 -2
- package/esm/toggle-group/ToggleGroup.js.map +1 -1
- package/esm/tooltip/Tooltip.d.ts +4 -0
- package/esm/tooltip/Tooltip.js +18 -12
- package/esm/tooltip/Tooltip.js.map +1 -1
- package/esm/typography/BodyLong.d.ts +1 -1
- package/esm/typography/BodyLong.js +1 -1
- package/esm/typography/BodyLong.js.map +1 -1
- package/esm/typography/BodyShort.d.ts +1 -1
- package/esm/typography/Detail.d.ts +1 -1
- package/esm/typography/ErrorMessage.d.ts +1 -1
- package/esm/typography/ErrorMessage.js +1 -1
- package/esm/typography/ErrorMessage.js.map +1 -1
- package/esm/typography/Heading.d.ts +1 -1
- package/esm/typography/Ingress.d.ts +1 -1
- package/esm/typography/Ingress.js +1 -1
- package/esm/typography/Ingress.js.map +1 -1
- package/esm/typography/Label.d.ts +1 -1
- package/esm/util/Slot.js +1 -1
- package/esm/util/Slot.js.map +1 -1
- package/esm/util/TextareaAutoSize.js +5 -3
- package/esm/util/TextareaAutoSize.js.map +1 -1
- package/esm/util/composeEventHandlers.d.ts +8 -0
- package/esm/util/composeEventHandlers.js +14 -0
- package/esm/util/composeEventHandlers.js.map +1 -0
- package/esm/util/hooks/index.d.ts +8 -0
- package/esm/util/hooks/index.js +9 -0
- package/esm/util/hooks/index.js.map +1 -0
- 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/useClientLayoutEffect.js +5 -0
- package/esm/util/hooks/useClientLayoutEffect.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/{useEventListener.d.ts → hooks/useEventListener.d.ts} +1 -1
- package/esm/util/hooks/useEventListener.js.map +1 -0
- package/esm/util/hooks/useId.js.map +1 -0
- package/esm/util/hooks/useMedia.js.map +1 -0
- package/esm/util/hooks/useMergeRefs.d.ts +15 -0
- package/esm/util/hooks/useMergeRefs.js +30 -0
- package/esm/util/hooks/useMergeRefs.js.map +1 -0
- package/esm/util/hooks/usePrevious.d.ts +1 -0
- package/esm/util/{usePrevious.js → hooks/usePrevious.js} +1 -2
- package/esm/util/hooks/usePrevious.js.map +1 -0
- package/esm/util/index.d.ts +4 -5
- package/esm/util/index.js +3 -5
- package/esm/util/index.js.map +1 -1
- package/esm/util/types/OverridableComponent.js.map +1 -0
- package/esm/util/types/index.d.ts +1 -0
- package/esm/util/types/index.js +2 -0
- package/esm/util/types/index.js.map +1 -0
- package/package.json +3 -3
- package/src/accordion/Accordion.tsx +5 -5
- package/src/accordion/AccordionContent.tsx +3 -3
- package/src/accordion/AccordionHeader.tsx +5 -7
- package/src/accordion/AccordionItem.tsx +22 -22
- package/src/accordion/accordion.stories.tsx +8 -5
- package/src/alert/Alert.tsx +8 -8
- package/src/alert/alert.stories.tsx +6 -7
- package/src/button/Button.tsx +18 -23
- 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 +7 -8
- package/src/chips/Toggle.tsx +4 -4
- package/src/chips/chips.stories.tsx +5 -5
- package/src/copybutton/CopyButton.tsx +9 -10
- package/src/copybutton/copy-button.stories.tsx +3 -3
- package/src/date/context/useSharedMonthContext.tsx +1 -1
- package/src/date/datepicker/DatePicker.tsx +7 -5
- 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/datepicker/parts/WeekRow.tsx +1 -1
- 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 +7 -6
- 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/parts/DateWrapper.tsx +1 -1
- 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 +23 -23
- package/src/dropdown/Menu/GroupedList/index.tsx +2 -2
- package/src/dropdown/Menu/List/Item.tsx +23 -23
- package/src/dropdown/Menu/List/index.tsx +1 -1
- package/src/dropdown/Menu/index.tsx +1 -1
- package/src/dropdown/Toggle.tsx +10 -6
- package/src/dropdown/dropdown.stories.tsx +1 -1
- package/src/expansion-card/ExpansionCard.tsx +4 -4
- 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 +3 -3
- package/src/expansion-card/expansion-card.stories.tsx +1 -1
- package/src/form/ConfirmationPanel.test.tsx +1 -1
- package/src/form/ConfirmationPanel.tsx +3 -3
- 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 +6 -5
- package/src/form/checkbox/Checkbox.test.tsx +8 -8
- package/src/form/checkbox/Checkbox.tsx +5 -4
- package/src/form/checkbox/CheckboxGroup.tsx +4 -4
- package/src/form/checkbox/useCheckbox.ts +3 -3
- package/src/form/combobox/Combobox.tsx +9 -12
- 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 +17 -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 +7 -7
- package/src/form/combobox/SelectedOptions/SelectedOptions.tsx +1 -1
- package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +10 -10
- package/src/form/combobox/ToggleListButton.tsx +1 -2
- package/src/form/combobox/combobox.stories.tsx +17 -18
- 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 +3 -3
- 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 +3 -2
- package/src/form/radio/RadioGroup.tsx +4 -4
- package/src/form/radio/useRadio.ts +1 -1
- package/src/form/search/Search.tsx +9 -9
- package/src/form/search/SearchButton.tsx +4 -6
- 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 +4 -4
- 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/Illustration.tsx +1 -1
- package/src/guide-panel/guidepanel.stories.tsx +1 -1
- package/src/help-text/HelpText.tsx +9 -27
- package/src/help-text/HelpTextIcon.tsx +1 -1
- package/src/help-text/help-text.stories.tsx +58 -68
- package/src/internal-header/InternalHeader.tsx +2 -2
- package/src/internal-header/InternalHeaderButton.tsx +2 -2
- package/src/internal-header/InternalHeaderTitle.tsx +2 -2
- package/src/internal-header/InternalHeaderUser.tsx +1 -1
- package/src/internal-header/InternalHeaderUserButton.tsx +2 -2
- 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 +8 -8
- 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 +9 -8
- 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 +2 -2
- package/src/layout/stack/Stack.tsx +4 -4
- package/src/layout/stack/VStack.tsx +2 -2
- 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 +3 -3
- package/src/link/{link.stories.tsx → stories/link.stories.tsx} +3 -3
- package/src/link-panel/LinkPanel.tsx +6 -7
- package/src/link-panel/LinkPanelDescription.tsx +1 -1
- package/src/link-panel/LinkPanelTitle.tsx +3 -3
- package/src/list/List.tsx +3 -3
- package/src/list/ListItem.tsx +2 -2
- package/src/list/list.stories.tsx +2 -2
- package/src/loader/Loader.tsx +6 -5
- package/src/loader/loader.stories.tsx +1 -0
- package/src/modal/Modal.test.tsx +4 -4
- package/src/modal/Modal.tsx +32 -32
- 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/modal/types.ts +1 -1
- package/src/pagination/Pagination.tsx +5 -6
- package/src/pagination/PaginationItem.tsx +4 -4
- package/src/pagination/steps.test.ts +8 -8
- package/src/panel/Panel.tsx +4 -4
- package/src/panel/panel.stories.tsx +2 -1
- package/src/popover/Popover.test.tsx +7 -7
- package/src/popover/Popover.tsx +11 -14
- package/src/popover/PopoverContent.tsx +2 -2
- package/src/provider/Provider.tsx +1 -1
- package/src/read-more/ReadMore.tsx +20 -16
- package/src/read-more/readmore.stories.tsx +4 -0
- package/src/skeleton/Skeleton.tsx +4 -4
- package/src/stepper/Step.tsx +10 -7
- package/src/stepper/Stepper.tsx +3 -3
- package/src/{util → table}/AnimateHeight.tsx +1 -1
- package/src/table/Body.tsx +1 -1
- package/src/table/ColumnHeader.tsx +2 -2
- package/src/table/DataCell.tsx +8 -3
- package/src/table/ExpandableRow.tsx +30 -23
- package/src/table/Header.tsx +1 -1
- package/src/table/HeaderCell.tsx +7 -2
- 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 +44 -30
- package/src/table/stories/tests/table.stories.tsx +2 -3
- package/src/tabs/Tab.tsx +4 -4
- package/src/tabs/TabList.tsx +8 -6
- package/src/tabs/TabPanel.tsx +1 -1
- package/src/tabs/Tabs.stories.tsx +1 -1
- package/src/tabs/Tabs.tsx +5 -5
- package/src/tag/Tag.tsx +12 -5
- package/src/tag/tag.stories.tsx +28 -2
- package/src/timeline/AxisLabels.tsx +9 -9
- package/src/timeline/Pin.tsx +4 -7
- 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 +6 -9
- 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 +6 -6
- 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 +31 -33
- package/src/tooltip/tooltip.stories.tsx +1 -1
- package/src/typography/BodyLong.tsx +5 -5
- package/src/typography/BodyShort.tsx +4 -4
- package/src/typography/Detail.tsx +4 -4
- package/src/typography/ErrorMessage.tsx +4 -4
- package/src/typography/Heading.tsx +4 -4
- package/src/typography/Ingress.tsx +2 -2
- package/src/typography/Label.tsx +4 -4
- package/src/typography/stories/bodylong.stories.tsx +1 -2
- package/src/typography/stories/bodyshort.stories.tsx +1 -2
- package/src/typography/stories/detail.stories.tsx +1 -2
- package/src/typography/stories/error-message.stories.tsx +1 -2
- package/src/typography/stories/heading.stories.tsx +1 -3
- package/src/typography/stories/ingress.stories.tsx +1 -2
- package/src/typography/stories/label.stories.tsx +1 -2
- package/src/util/Slot.tsx +4 -4
- package/src/util/TextareaAutoSize.tsx +11 -7
- package/src/util/__tests__/Slot.test.tsx +11 -11
- package/src/util/__tests__/useMedia.test.tsx +1 -1
- package/src/util/composeEventHandlers.ts +19 -0
- package/src/util/hooks/index.ts +8 -0
- package/src/util/hooks/useCallbackRef.ts +20 -0
- package/src/util/hooks/useClientLayoutEffect.ts +5 -0
- package/src/util/hooks/useControllableState.ts +40 -0
- package/src/util/{useEventListener.ts → hooks/useEventListener.ts} +1 -1
- package/src/util/{useMedia.ts → hooks/useMedia.ts} +1 -1
- package/src/util/hooks/useMergeRefs.ts +32 -0
- package/src/util/{usePrevious.ts → hooks/usePrevious.ts} +1 -4
- package/src/util/index.ts +4 -5
- package/src/util/omit.ts +1 -1
- package/src/util/{OverridableComponent.ts → types/OverridableComponent.ts} +1 -1
- package/src/util/types/index.ts +1 -0
- package/cjs/util/RandomIcon.js +0 -38
- package/cjs/util/mergeRefs.js +0 -16
- package/cjs/util/useClientLayoutEffect.js +0 -10
- package/esm/util/AnimateHeight.js.map +0 -1
- package/esm/util/OverridableComponent.js.map +0 -1
- package/esm/util/RandomIcon.d.ts +0 -2
- package/esm/util/RandomIcon.js +0 -9
- package/esm/util/RandomIcon.js.map +0 -1
- package/esm/util/mergeRefs.d.ts +0 -2
- package/esm/util/mergeRefs.js +0 -14
- package/esm/util/mergeRefs.js.map +0 -1
- package/esm/util/useClientLayoutEffect.js +0 -8
- package/esm/util/useClientLayoutEffect.js.map +0 -1
- package/esm/util/useEventListener.js.map +0 -1
- package/esm/util/useId.js.map +0 -1
- package/esm/util/useMedia.js.map +0 -1
- package/esm/util/usePrevious.d.ts +0 -2
- package/esm/util/usePrevious.js.map +0 -1
- package/src/util/mergeRefs.tsx +0 -15
- package/src/util/useClientLayoutEffect.ts +0 -11
- package/cjs/{util → table}/AnimateHeight.js +0 -0
- package/cjs/util/{useEventListener.js → hooks/useEventListener.js} +0 -0
- package/cjs/util/{useId.js → hooks/useId.js} +0 -0
- package/cjs/util/{useMedia.js → hooks/useMedia.js} +0 -0
- package/cjs/util/{OverridableComponent.js → types/OverridableComponent.js} +0 -0
- package/esm/{util → table}/AnimateHeight.d.ts +0 -0
- package/esm/{util → table}/AnimateHeight.js +0 -0
- package/esm/util/{useClientLayoutEffect.d.ts → hooks/useClientLayoutEffect.d.ts} +0 -0
- package/esm/util/{useEventListener.js → hooks/useEventListener.js} +0 -0
- package/esm/util/{useId.d.ts → hooks/useId.d.ts} +0 -0
- package/esm/util/{useId.js → hooks/useId.js} +0 -0
- package/esm/util/{useMedia.d.ts → hooks/useMedia.d.ts} +0 -0
- package/esm/util/{useMedia.js → hooks/useMedia.js} +0 -0
- package/esm/util/{OverridableComponent.d.ts → types/OverridableComponent.d.ts} +0 -0
- package/esm/util/{OverridableComponent.js → types/OverridableComponent.js} +0 -0
- package/src/{util → link/stories}/RandomIcon.tsx +1 -1
- /package/src/util/{useId.ts → hooks/useId.ts} +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Detail } from "../typography/Detail";
|
|
2
1
|
import {
|
|
3
2
|
addDays,
|
|
4
3
|
addMonths,
|
|
@@ -16,6 +15,7 @@ import {
|
|
|
16
15
|
} from "date-fns";
|
|
17
16
|
import nbLocale from "date-fns/locale/nb";
|
|
18
17
|
import React from "react";
|
|
18
|
+
import { Detail } from "../typography/Detail";
|
|
19
19
|
import { useTimelineContext } from "./hooks/useTimelineContext";
|
|
20
20
|
import { isVisible } from "./utils";
|
|
21
21
|
import { horizontalPositionAndWidth } from "./utils/calc";
|
|
@@ -26,7 +26,7 @@ export const dayLabels = (
|
|
|
26
26
|
end: Date,
|
|
27
27
|
totalDays: number,
|
|
28
28
|
direction: "left" | "right",
|
|
29
|
-
template: string = "dd.MM"
|
|
29
|
+
template: string = "dd.MM",
|
|
30
30
|
): AxisLabel[] => {
|
|
31
31
|
const increment = Math.ceil(totalDays / 10);
|
|
32
32
|
const lastDay = startOfDay(end);
|
|
@@ -39,7 +39,7 @@ export const dayLabels = (
|
|
|
39
39
|
day,
|
|
40
40
|
addDays(day, 1),
|
|
41
41
|
start,
|
|
42
|
-
end
|
|
42
|
+
end,
|
|
43
43
|
);
|
|
44
44
|
return {
|
|
45
45
|
direction,
|
|
@@ -56,7 +56,7 @@ export const monthLabels = (
|
|
|
56
56
|
start: Date,
|
|
57
57
|
end: Date,
|
|
58
58
|
direction: "left" | "right",
|
|
59
|
-
template: string = "MMM yy"
|
|
59
|
+
template: string = "MMM yy",
|
|
60
60
|
): AxisLabel[] => {
|
|
61
61
|
const startMonth = startOfMonth(start);
|
|
62
62
|
const endMonth = endOfMonth(end);
|
|
@@ -67,7 +67,7 @@ export const monthLabels = (
|
|
|
67
67
|
month,
|
|
68
68
|
addMonths(month, 1),
|
|
69
69
|
start,
|
|
70
|
-
end
|
|
70
|
+
end,
|
|
71
71
|
);
|
|
72
72
|
return {
|
|
73
73
|
direction,
|
|
@@ -83,7 +83,7 @@ export const yearLabels = (
|
|
|
83
83
|
start: Date,
|
|
84
84
|
end: Date,
|
|
85
85
|
direction: "left" | "right",
|
|
86
|
-
template: string = "yyyy"
|
|
86
|
+
template: string = "yyyy",
|
|
87
87
|
): AxisLabel[] => {
|
|
88
88
|
const firstYear = startOfYear(start);
|
|
89
89
|
const lastYear = endOfYear(end);
|
|
@@ -94,7 +94,7 @@ export const yearLabels = (
|
|
|
94
94
|
year,
|
|
95
95
|
addYears(year, 1),
|
|
96
96
|
start,
|
|
97
|
-
end
|
|
97
|
+
end,
|
|
98
98
|
);
|
|
99
99
|
return {
|
|
100
100
|
direction,
|
|
@@ -110,7 +110,7 @@ const axisLabels = (
|
|
|
110
110
|
start: Date,
|
|
111
111
|
end: Date,
|
|
112
112
|
direction: "left" | "right",
|
|
113
|
-
templates?: AxisLabelTemplates
|
|
113
|
+
templates?: AxisLabelTemplates,
|
|
114
114
|
): AxisLabel[] => {
|
|
115
115
|
const totalDays = differenceInDays(end, start);
|
|
116
116
|
if (totalDays < 40) {
|
|
@@ -129,7 +129,7 @@ export const AxisLabels = ({
|
|
|
129
129
|
}) => {
|
|
130
130
|
const { endDate, startDate, direction } = useTimelineContext();
|
|
131
131
|
const labels = axisLabels(startDate, endDate, direction, templates).filter(
|
|
132
|
-
isVisible
|
|
132
|
+
isVisible,
|
|
133
133
|
);
|
|
134
134
|
|
|
135
135
|
return (
|
package/src/timeline/Pin.tsx
CHANGED
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
useRole,
|
|
15
15
|
} from "@floating-ui/react";
|
|
16
16
|
import { format } from "date-fns";
|
|
17
|
-
import React, { forwardRef,
|
|
18
|
-
import {
|
|
17
|
+
import React, { forwardRef, useRef, useState } from "react";
|
|
18
|
+
import { useMergeRefs } from "../util/hooks/useMergeRefs";
|
|
19
19
|
import { useTimelineContext } from "./hooks/useTimelineContext";
|
|
20
20
|
import { position } from "./utils/calc";
|
|
21
21
|
import { TimelineComponentTypes } from "./utils/types.internal";
|
|
@@ -81,10 +81,7 @@ export const Pin = forwardRef<HTMLButtonElement, TimelinePinProps>(
|
|
|
81
81
|
role,
|
|
82
82
|
]);
|
|
83
83
|
|
|
84
|
-
const mergedRef =
|
|
85
|
-
() => mergeRefs([refs.setReference, ref]),
|
|
86
|
-
[ref, refs.setReference]
|
|
87
|
-
);
|
|
84
|
+
const mergedRef = useMergeRefs(refs.setReference, ref);
|
|
88
85
|
|
|
89
86
|
const staticSide = {
|
|
90
87
|
top: "bottom",
|
|
@@ -148,7 +145,7 @@ export const Pin = forwardRef<HTMLButtonElement, TimelinePinProps>(
|
|
|
148
145
|
)}
|
|
149
146
|
</>
|
|
150
147
|
);
|
|
151
|
-
}
|
|
148
|
+
},
|
|
152
149
|
) as PinType;
|
|
153
150
|
|
|
154
151
|
Pin.componentType = "pin";
|
|
@@ -89,7 +89,7 @@ export const Timeline = forwardRef<HTMLDivElement, TimelineProps>(
|
|
|
89
89
|
axisLabelTemplates,
|
|
90
90
|
...rest
|
|
91
91
|
},
|
|
92
|
-
ref
|
|
92
|
+
ref,
|
|
93
93
|
) => {
|
|
94
94
|
const isMultipleRows = Array.isArray(children);
|
|
95
95
|
|
|
@@ -101,7 +101,7 @@ export const Timeline = forwardRef<HTMLDivElement, TimelineProps>(
|
|
|
101
101
|
children = [children];
|
|
102
102
|
}
|
|
103
103
|
const rowChildren = React.Children.toArray(children).filter(
|
|
104
|
-
(c: any) => c?.type?.componentType === "row"
|
|
104
|
+
(c: any) => c?.type?.componentType === "row",
|
|
105
105
|
);
|
|
106
106
|
|
|
107
107
|
const pins = React.Children.toArray(children)
|
|
@@ -109,7 +109,7 @@ export const Timeline = forwardRef<HTMLDivElement, TimelineProps>(
|
|
|
109
109
|
.map((x) => () => x);
|
|
110
110
|
|
|
111
111
|
const zoomComponent = React.Children.toArray(children).find(
|
|
112
|
-
(c: any) => c?.type?.componentType === "zoom"
|
|
112
|
+
(c: any) => c?.type?.componentType === "zoom",
|
|
113
113
|
);
|
|
114
114
|
|
|
115
115
|
const rowsRaw = useMemo(() => {
|
|
@@ -127,7 +127,7 @@ export const Timeline = forwardRef<HTMLDivElement, TimelineProps>(
|
|
|
127
127
|
const [start, setStart] = useState(initialStartDate);
|
|
128
128
|
const [activeRow, setActiveRow] = useState<number | null>(null);
|
|
129
129
|
const [endInclusive, setEndInclusive] = useState(
|
|
130
|
-
endOfDay(useLatestDate({ endDate, rows }))
|
|
130
|
+
endOfDay(useLatestDate({ endDate, rows })),
|
|
131
131
|
);
|
|
132
132
|
|
|
133
133
|
const initialEndDate = endOfDay(useLatestDate({ endDate, rows }));
|
|
@@ -135,14 +135,14 @@ export const Timeline = forwardRef<HTMLDivElement, TimelineProps>(
|
|
|
135
135
|
rowsRaw,
|
|
136
136
|
startDate ?? start,
|
|
137
137
|
endDate ?? endInclusive,
|
|
138
|
-
direction
|
|
138
|
+
direction,
|
|
139
139
|
);
|
|
140
140
|
|
|
141
141
|
const handleZoomChange = (zoomStart: Date) => {
|
|
142
142
|
if (startDate || endDate) {
|
|
143
143
|
if (process.env.NODE_ENV !== "production") {
|
|
144
144
|
console.warn(
|
|
145
|
-
"Zooming is not supported when startDate or endDate is set"
|
|
145
|
+
"Zooming is not supported when startDate or endDate is set",
|
|
146
146
|
);
|
|
147
147
|
}
|
|
148
148
|
return;
|
|
@@ -242,7 +242,7 @@ export const Timeline = forwardRef<HTMLDivElement, TimelineProps>(
|
|
|
242
242
|
</div>
|
|
243
243
|
</TimelineContext.Provider>
|
|
244
244
|
);
|
|
245
|
-
}
|
|
245
|
+
},
|
|
246
246
|
) as TimelineComponent;
|
|
247
247
|
|
|
248
248
|
Timeline.Row = TimelineRow;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import cl from "clsx";
|
|
2
2
|
import { format } from "date-fns";
|
|
3
3
|
import React, { forwardRef } from "react";
|
|
4
|
+
import { BodyShort } from "../typography/BodyShort";
|
|
4
5
|
import { PeriodContext } from "./hooks/usePeriodContext";
|
|
5
6
|
import { useRowContext } from "./hooks/useRowContext";
|
|
6
7
|
import { useTimelineContext } from "./hooks/useTimelineContext";
|
|
@@ -9,7 +10,6 @@ import {
|
|
|
9
10
|
PositionedPeriod,
|
|
10
11
|
TimelineComponentTypes,
|
|
11
12
|
} from "./utils/types.internal";
|
|
12
|
-
import cl from "clsx";
|
|
13
13
|
|
|
14
14
|
export interface TimelineRowProps
|
|
15
15
|
extends React.HTMLAttributes<HTMLOListElement> {
|
|
@@ -49,7 +49,7 @@ export const TimelineRow = forwardRef<HTMLOListElement, TimelineRowProps>(
|
|
|
49
49
|
}, {} as PositionedPeriod);
|
|
50
50
|
|
|
51
51
|
const firstFocusable = periods.find(
|
|
52
|
-
(p) => !!p.children || !!p.onSelectPeriod
|
|
52
|
+
(p) => !!p.children || !!p.onSelectPeriod,
|
|
53
53
|
);
|
|
54
54
|
|
|
55
55
|
return (
|
|
@@ -80,7 +80,7 @@ export const TimelineRow = forwardRef<HTMLOListElement, TimelineRowProps>(
|
|
|
80
80
|
? "Ingen perioder"
|
|
81
81
|
: `${format(earliest.start, "dd.MM.yyyy")} til ${format(
|
|
82
82
|
latest.end,
|
|
83
|
-
"dd.MM.yyyy"
|
|
83
|
+
"dd.MM.yyyy",
|
|
84
84
|
)}`
|
|
85
85
|
}
|
|
86
86
|
className={cl("navds-timeline__row-periods", className)}
|
|
@@ -116,7 +116,7 @@ export const TimelineRow = forwardRef<HTMLOListElement, TimelineRowProps>(
|
|
|
116
116
|
</div>
|
|
117
117
|
</>
|
|
118
118
|
);
|
|
119
|
-
}
|
|
119
|
+
},
|
|
120
120
|
) as TimelineRowType;
|
|
121
121
|
|
|
122
122
|
TimelineRow.componentType = "row";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
|
|
3
1
|
import { addDays, endOfDay, isAfter, startOfDay, subDays } from "date-fns";
|
|
4
|
-
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { horizontalPositionAndWidth } from "../utils/calc";
|
|
4
|
+
import { invisiblePeriods, withinADay } from "../utils/filter";
|
|
5
5
|
import { lastPeriod } from "../utils/sort";
|
|
6
6
|
import { Period } from "../utils/types.external";
|
|
7
7
|
import {
|
|
@@ -9,9 +9,6 @@ import {
|
|
|
9
9
|
PositionedPeriod,
|
|
10
10
|
} from "../utils/types.internal";
|
|
11
11
|
|
|
12
|
-
import { horizontalPositionAndWidth } from "../utils/calc";
|
|
13
|
-
import { invisiblePeriods, withinADay } from "../utils/filter";
|
|
14
|
-
|
|
15
12
|
const spatialPeriod = (
|
|
16
13
|
period: Period,
|
|
17
14
|
timelineStart: Date,
|
|
@@ -19,7 +16,7 @@ const spatialPeriod = (
|
|
|
19
16
|
direction: "left" | "right" = "left",
|
|
20
17
|
i: number,
|
|
21
18
|
periods: PositionedPeriod[],
|
|
22
|
-
rowIndex: number
|
|
19
|
+
rowIndex: number,
|
|
23
20
|
): PositionedPeriod => {
|
|
24
21
|
const start = period.start;
|
|
25
22
|
const endInclusive = period.end;
|
|
@@ -30,10 +27,12 @@ const spatialPeriod = (
|
|
|
30
27
|
const { horizontalPosition, width } = horizontalPositionAndWidth(
|
|
31
28
|
startOfDay(start),
|
|
32
29
|
endOfDay(
|
|
33
|
-
rightOverlap
|
|
30
|
+
rightOverlap
|
|
31
|
+
? startOfDay(subDays(periods[i + 1].start, 1))
|
|
32
|
+
: endInclusive,
|
|
34
33
|
),
|
|
35
34
|
timelineStart,
|
|
36
|
-
timelineEndInclusive
|
|
35
|
+
timelineEndInclusive,
|
|
37
36
|
);
|
|
38
37
|
|
|
39
38
|
return {
|
|
@@ -56,7 +55,7 @@ const spatialPeriod = (
|
|
|
56
55
|
const adjustedEdges = (
|
|
57
56
|
period: PositionedPeriod,
|
|
58
57
|
i: number,
|
|
59
|
-
allPeriods: PositionedPeriod[]
|
|
58
|
+
allPeriods: PositionedPeriod[],
|
|
60
59
|
): PositionedPeriod => {
|
|
61
60
|
const left =
|
|
62
61
|
i > 0 && withinADay(period.start, allPeriods[i - 1].endInclusive);
|
|
@@ -67,10 +66,10 @@ const adjustedEdges = (
|
|
|
67
66
|
return left && right
|
|
68
67
|
? { ...period, cropped: "both" }
|
|
69
68
|
: left
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
? { ...period, cropped: "left" }
|
|
70
|
+
: right
|
|
71
|
+
? { ...period, cropped: "right" }
|
|
72
|
+
: period;
|
|
74
73
|
};
|
|
75
74
|
|
|
76
75
|
const trimmedPeriods = (period: PositionedPeriod) => {
|
|
@@ -97,7 +96,7 @@ export const useTimelineRows = (
|
|
|
97
96
|
rows: any,
|
|
98
97
|
startDate: Date,
|
|
99
98
|
endDate: Date,
|
|
100
|
-
direction: "left" | "right"
|
|
99
|
+
direction: "left" | "right",
|
|
101
100
|
): InternalSimpleTimeline[] =>
|
|
102
101
|
useMemo(
|
|
103
102
|
() =>
|
|
@@ -112,7 +111,7 @@ export const useTimelineRows = (
|
|
|
112
111
|
direction,
|
|
113
112
|
i,
|
|
114
113
|
periods.periods,
|
|
115
|
-
rowIndex
|
|
114
|
+
rowIndex,
|
|
116
115
|
),
|
|
117
116
|
restProps: period?.restProps,
|
|
118
117
|
ref: period?.ref,
|
|
@@ -132,7 +131,7 @@ export const useTimelineRows = (
|
|
|
132
131
|
ref: periods?.ref,
|
|
133
132
|
};
|
|
134
133
|
}),
|
|
135
|
-
[rows, startDate, endDate, direction]
|
|
134
|
+
[rows, startDate, endDate, direction],
|
|
136
135
|
);
|
|
137
136
|
|
|
138
137
|
const earliestDate = (earliest: Date, period: Period) =>
|
|
@@ -144,7 +143,7 @@ const earliestFomDate = (rader: Period[][]) =>
|
|
|
144
143
|
export const useEarliestDate = ({ startDate, rows }: any) =>
|
|
145
144
|
useMemo(
|
|
146
145
|
() => (startDate ? startDate : earliestFomDate(rows)),
|
|
147
|
-
[startDate, rows]
|
|
146
|
+
[startDate, rows],
|
|
148
147
|
);
|
|
149
148
|
|
|
150
149
|
const latestDate = (latest: Date, period: Period) =>
|
|
@@ -156,5 +155,5 @@ const latestTomDate = (rows: Period[][]) =>
|
|
|
156
155
|
export const useLatestDate = ({ endDate, rows }: any) =>
|
|
157
156
|
useMemo(
|
|
158
157
|
() => (endDate ? endDate : addDays(latestTomDate(rows), 1)),
|
|
159
|
-
[endDate, rows]
|
|
158
|
+
[endDate, rows],
|
|
160
159
|
);
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
useRole,
|
|
15
15
|
} from "@floating-ui/react";
|
|
16
16
|
import cl from "clsx";
|
|
17
|
-
import React, {
|
|
18
|
-
import {
|
|
17
|
+
import React, { useRef, useState } from "react";
|
|
18
|
+
import { useMergeRefs } from "../../util/hooks/useMergeRefs";
|
|
19
19
|
import { usePeriodContext } from "../hooks/usePeriodContext";
|
|
20
20
|
import { useRowContext } from "../hooks/useRowContext";
|
|
21
21
|
import { useTimelineContext } from "../hooks/useTimelineContext";
|
|
@@ -24,7 +24,7 @@ import { PeriodProps } from "./types";
|
|
|
24
24
|
|
|
25
25
|
interface TimelineClickablePeriodProps extends PeriodProps {
|
|
26
26
|
onSelectPeriod?: (
|
|
27
|
-
e: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element
|
|
27
|
+
e: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element>,
|
|
28
28
|
) => void;
|
|
29
29
|
isActive?: boolean;
|
|
30
30
|
periodRef: React.ForwardedRef<HTMLButtonElement>;
|
|
@@ -89,10 +89,7 @@ const ClickablePeriod = React.memo(
|
|
|
89
89
|
role,
|
|
90
90
|
]);
|
|
91
91
|
|
|
92
|
-
const mergedRef =
|
|
93
|
-
() => mergeRefs([refs.setReference, periodRef]),
|
|
94
|
-
[periodRef, refs.setReference]
|
|
95
|
-
);
|
|
92
|
+
const mergedRef = useMergeRefs(refs.setReference, periodRef);
|
|
96
93
|
|
|
97
94
|
const staticSide = {
|
|
98
95
|
top: "bottom",
|
|
@@ -117,7 +114,7 @@ const ClickablePeriod = React.memo(
|
|
|
117
114
|
restProps?.className,
|
|
118
115
|
{
|
|
119
116
|
"navds-timeline__period--selected": isActive,
|
|
120
|
-
}
|
|
117
|
+
},
|
|
121
118
|
)}
|
|
122
119
|
aria-expanded={children ? open : undefined}
|
|
123
120
|
aria-current={isActive || undefined}
|
|
@@ -179,7 +176,7 @@ const ClickablePeriod = React.memo(
|
|
|
179
176
|
)}
|
|
180
177
|
</>
|
|
181
178
|
);
|
|
182
|
-
}
|
|
179
|
+
},
|
|
183
180
|
);
|
|
184
181
|
|
|
185
182
|
export default ClickablePeriod;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CheckmarkCircleFillIcon } from "@navikt/aksel-icons";
|
|
2
1
|
import { Meta } from "@storybook/react";
|
|
3
2
|
import * as React from "react";
|
|
4
|
-
import Timeline from "./Timeline";
|
|
5
3
|
import { useState } from "react";
|
|
4
|
+
import { CheckmarkCircleFillIcon } from "@navikt/aksel-icons";
|
|
5
|
+
import Timeline from "./Timeline";
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
title: "ds-react/Timeline",
|
|
@@ -9,12 +9,12 @@ export const horizontalPositionAndWidth = (
|
|
|
9
9
|
start: Date,
|
|
10
10
|
endInclusive: Date,
|
|
11
11
|
timelineStart: Date,
|
|
12
|
-
timelineEndInclusive: Date
|
|
12
|
+
timelineEndInclusive: Date,
|
|
13
13
|
) => {
|
|
14
14
|
const horizontalPosition = position(
|
|
15
15
|
start,
|
|
16
16
|
timelineStart,
|
|
17
|
-
timelineEndInclusive
|
|
17
|
+
timelineEndInclusive,
|
|
18
18
|
);
|
|
19
19
|
const width =
|
|
20
20
|
position(endInclusive, timelineStart, timelineEndInclusive) -
|
|
@@ -12,13 +12,13 @@ export const isVisible = ({ horizontalPosition }: Positioned): boolean =>
|
|
|
12
12
|
|
|
13
13
|
export const getFirstDate = (periods: any) => {
|
|
14
14
|
return periods.sort(
|
|
15
|
-
(a: PeriodProps, b: PeriodProps) => a.start.getTime() - b.start.getTime()
|
|
15
|
+
(a: PeriodProps, b: PeriodProps) => a.start.getTime() - b.start.getTime(),
|
|
16
16
|
)[0].start;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export const getLastDate = (periods: any) => {
|
|
20
20
|
return periods.sort(
|
|
21
|
-
(a: PeriodProps, b: PeriodProps) => a.end.getTime() - b.end.getTime()
|
|
21
|
+
(a: PeriodProps, b: PeriodProps) => a.end.getTime() - b.end.getTime(),
|
|
22
22
|
)[periods.length - 1].end;
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -4,7 +4,7 @@ import { format } from "date-fns";
|
|
|
4
4
|
export const getConditionalClasses = (
|
|
5
5
|
cropped: string,
|
|
6
6
|
direction: string,
|
|
7
|
-
status: string
|
|
7
|
+
status: string,
|
|
8
8
|
) => {
|
|
9
9
|
return cl(`navds-timeline__period navds-timeline__period--${status}`, {
|
|
10
10
|
"navds-timeline__period--connected-both": cropped === "both",
|
|
@@ -38,7 +38,7 @@ export const ariaLabel = (
|
|
|
38
38
|
startDate: Date,
|
|
39
39
|
endDate: Date,
|
|
40
40
|
status: string,
|
|
41
|
-
statusLabel?: string
|
|
41
|
+
statusLabel?: string,
|
|
42
42
|
): string => {
|
|
43
43
|
const start = format(startDate, "dd.MM.yyyy");
|
|
44
44
|
const end = format(endDate, "dd.MM.yyyy");
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Detail } from "../../typography/Detail";
|
|
2
1
|
import {
|
|
3
2
|
addMonths,
|
|
4
3
|
addYears,
|
|
@@ -8,6 +7,7 @@ import {
|
|
|
8
7
|
subYears,
|
|
9
8
|
} from "date-fns";
|
|
10
9
|
import React, { forwardRef } from "react";
|
|
10
|
+
import { Detail } from "../../typography/Detail";
|
|
11
11
|
import { useTimelineContext } from "../hooks/useTimelineContext";
|
|
12
12
|
|
|
13
13
|
export interface TimelineZoomButtonProps {
|
|
@@ -61,7 +61,7 @@ export const ZoomButton: ZoomButtonType = forwardRef(
|
|
|
61
61
|
!currentZoom
|
|
62
62
|
? `Zoom tidslinjen ${format(
|
|
63
63
|
startOfRange,
|
|
64
|
-
"dd.MM.yyyy"
|
|
64
|
+
"dd.MM.yyyy",
|
|
65
65
|
)} til ${format(endDate, "dd.MM.yyyy")}`
|
|
66
66
|
: "Tilbakestill til initiell tidsperspektiv"
|
|
67
67
|
}
|
|
@@ -77,7 +77,7 @@ export const ZoomButton: ZoomButtonType = forwardRef(
|
|
|
77
77
|
</button>
|
|
78
78
|
</Detail>
|
|
79
79
|
);
|
|
80
|
-
}
|
|
80
|
+
},
|
|
81
81
|
);
|
|
82
82
|
|
|
83
83
|
export default ZoomButton;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { Meta } from "@storybook/react";
|
|
2
|
+
import React, { useState } from "react";
|
|
1
3
|
import {
|
|
2
4
|
EnvelopeClosedIcon,
|
|
3
5
|
EnvelopeOpenIcon,
|
|
4
6
|
InboxUpIcon,
|
|
5
7
|
} from "@navikt/aksel-icons";
|
|
6
|
-
import { Meta } from "@storybook/react";
|
|
7
|
-
import React, { useState } from "react";
|
|
8
8
|
import { ToggleGroup } from "../index";
|
|
9
9
|
|
|
10
10
|
const meta: Meta<typeof ToggleGroup> = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as RadixToggleGroup from "@radix-ui/react-toggle-group";
|
|
2
2
|
import cl from "clsx";
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { HTMLAttributes, forwardRef, useState } from "react";
|
|
4
4
|
import { Label } from "../typography";
|
|
5
|
-
import { useId } from "../util";
|
|
6
|
-
import { ToggleGroupContext } from "./context";
|
|
5
|
+
import { useId } from "../util/hooks";
|
|
7
6
|
import ToggleItem, { ToggleItemProps } from "./ToggleItem";
|
|
7
|
+
import { ToggleGroupContext } from "./context";
|
|
8
8
|
|
|
9
9
|
export interface ToggleGroupProps
|
|
10
10
|
extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "dir"> {
|
|
@@ -81,7 +81,7 @@ export const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(
|
|
|
81
81
|
variant = "action",
|
|
82
82
|
...rest
|
|
83
83
|
},
|
|
84
|
-
ref
|
|
84
|
+
ref,
|
|
85
85
|
) => {
|
|
86
86
|
const [groupValue, setGroupValue] = useState(defaultValue);
|
|
87
87
|
const labelId = useId();
|
|
@@ -131,7 +131,7 @@ export const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(
|
|
|
131
131
|
className={cl(
|
|
132
132
|
"navds-toggle-group",
|
|
133
133
|
`navds-toggle-group--${size}`,
|
|
134
|
-
`navds-toggle-group--${variant}
|
|
134
|
+
`navds-toggle-group--${variant}`,
|
|
135
135
|
)}
|
|
136
136
|
{...(describeBy && { "aria-describedby": describeBy })}
|
|
137
137
|
role="radiogroup"
|
|
@@ -142,7 +142,7 @@ export const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(
|
|
|
142
142
|
</div>
|
|
143
143
|
</ToggleGroupContext.Provider>
|
|
144
144
|
);
|
|
145
|
-
}
|
|
145
|
+
},
|
|
146
146
|
) as ToggleGroupComponent;
|
|
147
147
|
|
|
148
148
|
ToggleGroup.Item = ToggleItem;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { act, fireEvent, screen } from "@testing-library/react";
|
|
2
|
+
import userEvent from "@testing-library/user-event";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import {
|
|
4
5
|
focusVisible,
|
|
5
|
-
simulatePointerDown,
|
|
6
6
|
renderWithStyles as render,
|
|
7
|
+
simulatePointerDown,
|
|
7
8
|
} from "../../tests/utils";
|
|
8
|
-
import userEvent from "@testing-library/user-event";
|
|
9
9
|
import Tooltip from "./Tooltip";
|
|
10
10
|
|
|
11
11
|
describe("Tooltip", () => {
|
|
@@ -15,7 +15,7 @@ describe("Tooltip", () => {
|
|
|
15
15
|
<button id="testChild" type="submit">
|
|
16
16
|
Hello World
|
|
17
17
|
</button>
|
|
18
|
-
</Tooltip
|
|
18
|
+
</Tooltip>,
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
expect(screen.getByRole("tooltip")).toBeVisible();
|
|
@@ -27,7 +27,7 @@ describe("Tooltip", () => {
|
|
|
27
27
|
<button id="testChild" type="submit">
|
|
28
28
|
Hello World
|
|
29
29
|
</button>
|
|
30
|
-
</Tooltip
|
|
30
|
+
</Tooltip>,
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
expect(screen.getByRole("tooltip")).toBeVisible();
|
|
@@ -39,7 +39,7 @@ describe("Tooltip", () => {
|
|
|
39
39
|
<button id="testChild" type="submit">
|
|
40
40
|
Hello World
|
|
41
41
|
</button>
|
|
42
|
-
</Tooltip
|
|
42
|
+
</Tooltip>,
|
|
43
43
|
);
|
|
44
44
|
simulatePointerDown();
|
|
45
45
|
|
|
@@ -53,7 +53,7 @@ describe("Tooltip", () => {
|
|
|
53
53
|
<button id="testChild" type="submit">
|
|
54
54
|
Hello World
|
|
55
55
|
</button>
|
|
56
|
-
</Tooltip
|
|
56
|
+
</Tooltip>,
|
|
57
57
|
);
|
|
58
58
|
simulatePointerDown();
|
|
59
59
|
|
|
@@ -72,7 +72,7 @@ describe("Tooltip", () => {
|
|
|
72
72
|
<button id="testChild" type="submit">
|
|
73
73
|
Hello World
|
|
74
74
|
</button>
|
|
75
|
-
</Tooltip
|
|
75
|
+
</Tooltip>,
|
|
76
76
|
);
|
|
77
77
|
|
|
78
78
|
await act(async () => {
|
|
@@ -94,7 +94,7 @@ describe("Tooltip", () => {
|
|
|
94
94
|
</button>
|
|
95
95
|
</Tooltip>
|
|
96
96
|
<a href="/#">link</a>
|
|
97
|
-
</div
|
|
97
|
+
</div>,
|
|
98
98
|
);
|
|
99
99
|
|
|
100
100
|
simulatePointerDown(screen.getByRole("button"));
|
|
@@ -116,7 +116,7 @@ describe("Tooltip", () => {
|
|
|
116
116
|
Hello World
|
|
117
117
|
</button>
|
|
118
118
|
</Tooltip>
|
|
119
|
-
</div
|
|
119
|
+
</div>,
|
|
120
120
|
);
|
|
121
121
|
|
|
122
122
|
simulatePointerDown(screen.getByRole("button"));
|
|
@@ -137,7 +137,7 @@ describe("Tooltip", () => {
|
|
|
137
137
|
</button>
|
|
138
138
|
</Tooltip>
|
|
139
139
|
<a href="/#">link</a>
|
|
140
|
-
</div
|
|
140
|
+
</div>,
|
|
141
141
|
);
|
|
142
142
|
|
|
143
143
|
simulatePointerDown(screen.getByRole("button"));
|