@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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
2
1
|
import cl from "clsx";
|
|
3
2
|
import React, { forwardRef, useContext } from "react";
|
|
3
|
+
import { ChevronDownIcon } from "@navikt/aksel-icons";
|
|
4
4
|
import { Heading } from "../typography";
|
|
5
5
|
import { AccordionContext } from "./AccordionContext";
|
|
6
6
|
import { AccordionItemContext } from "./AccordionItem";
|
|
@@ -20,7 +20,7 @@ const AccordionHeader = forwardRef<HTMLButtonElement, AccordionHeaderProps>(
|
|
|
20
20
|
|
|
21
21
|
if (itemContext === null) {
|
|
22
22
|
console.error(
|
|
23
|
-
"<Accordion.Header> has to be used within an <Accordion.Item>, which in turn must be within an <Accordion>"
|
|
23
|
+
"<Accordion.Header> has to be used within an <Accordion.Item>, which in turn must be within an <Accordion>",
|
|
24
24
|
);
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
@@ -53,7 +53,7 @@ const AccordionHeader = forwardRef<HTMLButtonElement, AccordionHeaderProps>(
|
|
|
53
53
|
</Heading>
|
|
54
54
|
</button>
|
|
55
55
|
);
|
|
56
|
-
}
|
|
56
|
+
},
|
|
57
57
|
);
|
|
58
58
|
|
|
59
59
|
export default AccordionHeader;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
|
-
import React, {
|
|
3
|
-
createContext,
|
|
4
|
-
forwardRef,
|
|
5
|
-
useContext,
|
|
6
|
-
useRef,
|
|
7
|
-
useState,
|
|
8
|
-
} from "react";
|
|
9
|
-
import { AccordionContext } from "./AccordionContext";
|
|
2
|
+
import React, { createContext, forwardRef, useContext, useRef } from "react";
|
|
10
3
|
import { omit } from "../util";
|
|
4
|
+
import { useControllableState } from "../util/hooks/useControllableState";
|
|
5
|
+
import { AccordionContext } from "./AccordionContext";
|
|
11
6
|
|
|
12
7
|
export interface AccordionItemProps
|
|
13
8
|
extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -26,6 +21,10 @@ export interface AccordionItemProps
|
|
|
26
21
|
* @default false
|
|
27
22
|
*/
|
|
28
23
|
defaultOpen?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Callback for current open-state
|
|
26
|
+
*/
|
|
27
|
+
onOpenChange?: (open: boolean) => void;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
export interface AccordionItemContextProps {
|
|
@@ -37,20 +36,21 @@ export const AccordionItemContext =
|
|
|
37
36
|
createContext<AccordionItemContextProps | null>(null);
|
|
38
37
|
|
|
39
38
|
const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(
|
|
40
|
-
(
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
(
|
|
40
|
+
{ children, className, open, defaultOpen = false, onOpenChange, ...rest },
|
|
41
|
+
ref
|
|
42
|
+
) => {
|
|
43
|
+
const [_open, _setOpen] = useControllableState({
|
|
44
|
+
defaultValue: defaultOpen,
|
|
45
|
+
value: open,
|
|
46
|
+
onChange: onOpenChange,
|
|
47
|
+
});
|
|
43
48
|
|
|
44
|
-
const
|
|
49
|
+
const context = useContext(AccordionContext);
|
|
45
50
|
const shouldAnimate = useRef<boolean>(!(Boolean(open) || defaultOpen));
|
|
51
|
+
|
|
46
52
|
const handleOpen = () => {
|
|
47
|
-
|
|
48
|
-
const newOpen = !_open;
|
|
49
|
-
_setOpen(newOpen);
|
|
50
|
-
setInternalOpen(newOpen);
|
|
51
|
-
} else {
|
|
52
|
-
setInternalOpen(!open);
|
|
53
|
-
}
|
|
53
|
+
_setOpen((x) => !x);
|
|
54
54
|
shouldAnimate.current = true;
|
|
55
55
|
};
|
|
56
56
|
|
|
@@ -61,7 +61,7 @@ const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(
|
|
|
61
61
|
return (
|
|
62
62
|
<div
|
|
63
63
|
className={cl("navds-accordion__item", className, {
|
|
64
|
-
"navds-accordion__item--open":
|
|
64
|
+
"navds-accordion__item--open": _open,
|
|
65
65
|
"navds-accordion__item--neutral": context?.variant === "neutral",
|
|
66
66
|
"navds-accordion__item--no-animation": !shouldAnimate.current,
|
|
67
67
|
})}
|
|
@@ -70,7 +70,7 @@ const AccordionItem = forwardRef<HTMLDivElement, AccordionItemProps>(
|
|
|
70
70
|
>
|
|
71
71
|
<AccordionItemContext.Provider
|
|
72
72
|
value={{
|
|
73
|
-
open:
|
|
73
|
+
open: _open,
|
|
74
74
|
toggleOpen: handleOpen,
|
|
75
75
|
}}
|
|
76
76
|
>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
+
import { Accordion, AccordionProps } from ".";
|
|
3
|
+
import { Table } from "..";
|
|
2
4
|
import AccordionContent from "./AccordionContent";
|
|
3
5
|
import AccordionHeader from "./AccordionHeader";
|
|
4
6
|
import AccordionItem from "./AccordionItem";
|
|
5
|
-
import { Accordion, AccordionProps } from ".";
|
|
6
|
-
import { Table } from "..";
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
title: "ds-react/Accordion",
|
|
@@ -78,7 +78,10 @@ const Item = (props) => {
|
|
|
78
78
|
|
|
79
79
|
if (props.defaultOpen) {
|
|
80
80
|
return (
|
|
81
|
-
<Accordion.Item
|
|
81
|
+
<Accordion.Item
|
|
82
|
+
defaultOpen={props.defaultOpen}
|
|
83
|
+
onOpenChange={console.log}
|
|
84
|
+
>
|
|
82
85
|
<Accordion.Header>Accordion header text</Accordion.Header>
|
|
83
86
|
<SmallContent />
|
|
84
87
|
</Accordion.Item>
|
|
@@ -86,14 +89,14 @@ const Item = (props) => {
|
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
return props.controlled ? (
|
|
89
|
-
<Accordion.Item open={open}>
|
|
92
|
+
<Accordion.Item open={open} onOpenChange={console.log}>
|
|
90
93
|
<Accordion.Header onClick={() => setOpen(!open)}>
|
|
91
94
|
Accordion header text
|
|
92
95
|
</Accordion.Header>
|
|
93
96
|
<Content />
|
|
94
97
|
</Accordion.Item>
|
|
95
98
|
) : (
|
|
96
|
-
<Accordion.Item>
|
|
99
|
+
<Accordion.Item onOpenChange={console.log}>
|
|
97
100
|
<Accordion.Header>Accordion header text</Accordion.Header>
|
|
98
101
|
<Content />
|
|
99
102
|
</Accordion.Item>
|
package/src/alert/Alert.tsx
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import cl from "clsx";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
1
3
|
import {
|
|
2
|
-
InformationSquareFillIcon,
|
|
3
4
|
CheckmarkCircleFillIcon,
|
|
4
5
|
ExclamationmarkTriangleFillIcon,
|
|
5
|
-
|
|
6
|
+
InformationSquareFillIcon,
|
|
6
7
|
XMarkIcon,
|
|
8
|
+
XMarkOctagonFillIcon,
|
|
7
9
|
} from "@navikt/aksel-icons";
|
|
8
|
-
import cl from "clsx";
|
|
9
|
-
import React, { forwardRef } from "react";
|
|
10
|
-
import { BodyLong } from "../typography";
|
|
11
10
|
import { Button } from "../button";
|
|
11
|
+
import { BodyLong } from "../typography";
|
|
12
12
|
|
|
13
13
|
export interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
14
14
|
/**
|
|
@@ -88,7 +88,7 @@ export const Alert = forwardRef<HTMLDivElement, AlertProps>(
|
|
|
88
88
|
onClose,
|
|
89
89
|
...rest
|
|
90
90
|
},
|
|
91
|
-
ref
|
|
91
|
+
ref,
|
|
92
92
|
) => {
|
|
93
93
|
return (
|
|
94
94
|
<div
|
|
@@ -103,7 +103,7 @@ export const Alert = forwardRef<HTMLDivElement, AlertProps>(
|
|
|
103
103
|
"navds-alert--full-width": fullWidth,
|
|
104
104
|
"navds-alert--inline": inline,
|
|
105
105
|
"navds-alert--close-button": closeButton,
|
|
106
|
-
}
|
|
106
|
+
},
|
|
107
107
|
)}
|
|
108
108
|
>
|
|
109
109
|
<Icon variant={variant} className="navds-alert__icon" />
|
|
@@ -124,7 +124,7 @@ export const Alert = forwardRef<HTMLDivElement, AlertProps>(
|
|
|
124
124
|
)}
|
|
125
125
|
</div>
|
|
126
126
|
);
|
|
127
|
-
}
|
|
127
|
+
},
|
|
128
128
|
);
|
|
129
129
|
|
|
130
130
|
export default Alert;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { expect } from "@storybook/jest";
|
|
1
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
2
4
|
import React from "react";
|
|
3
5
|
import { Alert, AlertProps } from ".";
|
|
4
6
|
import { BodyLong, Heading as DsHeading, Link } from "..";
|
|
5
|
-
import { within, userEvent } from "@storybook/testing-library";
|
|
6
|
-
import { expect } from "@storybook/jest";
|
|
7
7
|
|
|
8
8
|
const meta: Meta<typeof Alert> = {
|
|
9
9
|
title: "ds-react/Alert",
|
|
@@ -55,7 +55,7 @@ export const Small: Story = {
|
|
|
55
55
|
closeButton={props.closeButton}
|
|
56
56
|
>
|
|
57
57
|
{new Array(i + 1).fill(
|
|
58
|
-
"Id elit esse enim reprehenderit enim nisi veniam nostrud."
|
|
58
|
+
"Id elit esse enim reprehenderit enim nisi veniam nostrud.",
|
|
59
59
|
)}
|
|
60
60
|
</Alert>
|
|
61
61
|
))}
|
|
@@ -74,14 +74,14 @@ export const FullWidth = () => {
|
|
|
74
74
|
{variants.map((variant, i) => (
|
|
75
75
|
<Alert key={variant} variant={variant} fullWidth>
|
|
76
76
|
{new Array(i + 1).fill(
|
|
77
|
-
"Id elit esse enim reprehenderit enim nisi veniam nostrud."
|
|
77
|
+
"Id elit esse enim reprehenderit enim nisi veniam nostrud.",
|
|
78
78
|
)}
|
|
79
79
|
</Alert>
|
|
80
80
|
))}
|
|
81
81
|
{variants.map((variant, i) => (
|
|
82
82
|
<Alert key={variant} variant={variant} fullWidth size="small">
|
|
83
83
|
{new Array(i + 1).fill(
|
|
84
|
-
"Id elit esse enim reprehenderit enim nisi veniam nostrud."
|
|
84
|
+
"Id elit esse enim reprehenderit enim nisi veniam nostrud.",
|
|
85
85
|
)}
|
|
86
86
|
</Alert>
|
|
87
87
|
))}
|
|
@@ -95,14 +95,14 @@ export const Inline = () => {
|
|
|
95
95
|
{variants.map((variant, i) => (
|
|
96
96
|
<Alert key={variant} variant={variant} inline>
|
|
97
97
|
{new Array(i + 1).fill(
|
|
98
|
-
"Id elit esse enim reprehenderit enim nisi veniam nostrud."
|
|
98
|
+
"Id elit esse enim reprehenderit enim nisi veniam nostrud.",
|
|
99
99
|
)}
|
|
100
100
|
</Alert>
|
|
101
101
|
))}
|
|
102
102
|
{variants.map((variant, i) => (
|
|
103
103
|
<Alert key={variant} variant={variant} inline size="small">
|
|
104
104
|
{new Array(i + 1).fill(
|
|
105
|
-
"Id elit esse enim reprehenderit enim nisi veniam nostrud."
|
|
105
|
+
"Id elit esse enim reprehenderit enim nisi veniam nostrud.",
|
|
106
106
|
)}
|
|
107
107
|
</Alert>
|
|
108
108
|
))}
|
package/src/button/Button.tsx
CHANGED
|
@@ -79,7 +79,7 @@ export const Button: OverridableComponent<ButtonProps, HTMLButtonElement> =
|
|
|
79
79
|
iconPosition = "left",
|
|
80
80
|
...rest
|
|
81
81
|
},
|
|
82
|
-
ref
|
|
82
|
+
ref,
|
|
83
83
|
) => {
|
|
84
84
|
const buttonRef = useRef<HTMLButtonElement | null>(null);
|
|
85
85
|
const [widthOverride, setWidthOverride] = useState<number>();
|
|
@@ -90,7 +90,7 @@ export const Button: OverridableComponent<ButtonProps, HTMLButtonElement> =
|
|
|
90
90
|
if (loading) {
|
|
91
91
|
const requestID = window.requestAnimationFrame(() => {
|
|
92
92
|
setWidthOverride(
|
|
93
|
-
buttonRef?.current?.getBoundingClientRect()?.width
|
|
93
|
+
buttonRef?.current?.getBoundingClientRect()?.width,
|
|
94
94
|
);
|
|
95
95
|
});
|
|
96
96
|
return () => {
|
|
@@ -128,7 +128,7 @@ export const Button: OverridableComponent<ButtonProps, HTMLButtonElement> =
|
|
|
128
128
|
"navds-button--loading": widthOverride,
|
|
129
129
|
"navds-button--icon-only": !!icon && !children,
|
|
130
130
|
"navds-button--disabled": disabled ?? widthOverride,
|
|
131
|
-
}
|
|
131
|
+
},
|
|
132
132
|
)}
|
|
133
133
|
style={{
|
|
134
134
|
...style,
|
|
@@ -155,7 +155,7 @@ export const Button: OverridableComponent<ButtonProps, HTMLButtonElement> =
|
|
|
155
155
|
)}
|
|
156
156
|
</Component>
|
|
157
157
|
);
|
|
158
|
-
}
|
|
158
|
+
},
|
|
159
159
|
);
|
|
160
160
|
|
|
161
161
|
export default Button;
|
package/src/chat/Bubble.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { forwardRef, HTMLAttributes } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
2
|
+
import React, { HTMLAttributes, forwardRef } from "react";
|
|
3
3
|
import { Detail } from "../typography";
|
|
4
4
|
|
|
5
5
|
export interface BubbleProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -37,7 +37,7 @@ const Bubble = forwardRef<HTMLDivElement, BubbleProps>(
|
|
|
37
37
|
toptextPosition,
|
|
38
38
|
...rest
|
|
39
39
|
},
|
|
40
|
-
ref
|
|
40
|
+
ref,
|
|
41
41
|
) => {
|
|
42
42
|
return (
|
|
43
43
|
<div
|
|
@@ -50,7 +50,7 @@ const Bubble = forwardRef<HTMLDivElement, BubbleProps>(
|
|
|
50
50
|
<h3
|
|
51
51
|
className={cl(
|
|
52
52
|
`navds-chat__top-text`,
|
|
53
|
-
toptextPosition && `navds-chat__top-text--${toptextPosition}
|
|
53
|
+
toptextPosition && `navds-chat__top-text--${toptextPosition}`,
|
|
54
54
|
)}
|
|
55
55
|
>
|
|
56
56
|
{name && <Detail as="span">{name}</Detail>}
|
|
@@ -65,7 +65,7 @@ const Bubble = forwardRef<HTMLDivElement, BubbleProps>(
|
|
|
65
65
|
{children}
|
|
66
66
|
</div>
|
|
67
67
|
);
|
|
68
|
-
}
|
|
68
|
+
},
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
export default Bubble;
|
package/src/chat/Chat.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { forwardRef, HTMLAttributes } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
3
|
-
import
|
|
2
|
+
import React, { HTMLAttributes, forwardRef } from "react";
|
|
4
3
|
import { BodyLong } from "../typography";
|
|
4
|
+
import Bubble from "./Bubble";
|
|
5
5
|
|
|
6
6
|
export const POSITIONS = ["left", "right"] as const;
|
|
7
7
|
export const SIZES = ["medium", "small"] as const;
|
|
@@ -99,7 +99,7 @@ export const Chat = forwardRef<HTMLDivElement, ChatProps>(
|
|
|
99
99
|
size = "medium",
|
|
100
100
|
...rest
|
|
101
101
|
}: ChatProps,
|
|
102
|
-
ref
|
|
102
|
+
ref,
|
|
103
103
|
) => (
|
|
104
104
|
<div
|
|
105
105
|
ref={ref}
|
|
@@ -109,7 +109,7 @@ export const Chat = forwardRef<HTMLDivElement, ChatProps>(
|
|
|
109
109
|
`navds-chat--${position}`,
|
|
110
110
|
`navds-chat--top-text-${toptextPosition ?? position}`,
|
|
111
111
|
`navds-chat--${size}`,
|
|
112
|
-
`navds-chat--${variant}
|
|
112
|
+
`navds-chat--${variant}`,
|
|
113
113
|
)}
|
|
114
114
|
{...rest}
|
|
115
115
|
>
|
|
@@ -139,7 +139,7 @@ export const Chat = forwardRef<HTMLDivElement, ChatProps>(
|
|
|
139
139
|
})}
|
|
140
140
|
</ol>
|
|
141
141
|
</div>
|
|
142
|
-
)
|
|
142
|
+
),
|
|
143
143
|
) as ChatComponent;
|
|
144
144
|
|
|
145
145
|
Chat.Bubble = Bubble;
|
package/src/chips/Chips.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
|
-
import React, {
|
|
3
|
-
import ToggleChips, { ToggleChipsProps } from "./Toggle";
|
|
4
|
-
import RemovableChips, { RemovableChipsProps } from "./Removable";
|
|
2
|
+
import React, { HTMLAttributes, forwardRef } from "react";
|
|
5
3
|
import { OverridableComponent } from "../util";
|
|
4
|
+
import RemovableChips, { RemovableChipsProps } from "./Removable";
|
|
5
|
+
import ToggleChips, { ToggleChipsProps } from "./Toggle";
|
|
6
6
|
|
|
7
7
|
export interface ChipsProps extends HTMLAttributes<HTMLUListElement> {
|
|
8
8
|
children: React.ReactNode;
|
|
@@ -74,7 +74,7 @@ export const Chips: ChipsComponent = forwardRef<HTMLUListElement, ChipsProps>(
|
|
|
74
74
|
})}
|
|
75
75
|
</ul>
|
|
76
76
|
);
|
|
77
|
-
}
|
|
77
|
+
},
|
|
78
78
|
) as ChipsComponent;
|
|
79
79
|
|
|
80
80
|
Chips.Toggle = ToggleChips;
|
package/src/chips/Removable.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { XMarkIcon } from "@navikt/aksel-icons";
|
|
2
1
|
import cl from "clsx";
|
|
3
2
|
import React, { forwardRef } from "react";
|
|
3
|
+
import { XMarkIcon } from "@navikt/aksel-icons";
|
|
4
4
|
|
|
5
5
|
export interface RemovableChipsProps
|
|
6
6
|
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
@@ -35,7 +35,7 @@ export const RemovableChips = forwardRef<
|
|
|
35
35
|
type = "button",
|
|
36
36
|
...rest
|
|
37
37
|
},
|
|
38
|
-
ref
|
|
38
|
+
ref,
|
|
39
39
|
) => {
|
|
40
40
|
return (
|
|
41
41
|
<button
|
|
@@ -45,7 +45,7 @@ export const RemovableChips = forwardRef<
|
|
|
45
45
|
className={cl(
|
|
46
46
|
"navds-chips__chip navds-chips__removable navds-chips--icon-right",
|
|
47
47
|
className,
|
|
48
|
-
`navds-chips__removable--${variant}
|
|
48
|
+
`navds-chips__removable--${variant}`,
|
|
49
49
|
)}
|
|
50
50
|
aria-label={`${children} ${removeLabel}`}
|
|
51
51
|
onClick={(e) => {
|
|
@@ -59,7 +59,7 @@ export const RemovableChips = forwardRef<
|
|
|
59
59
|
</span>
|
|
60
60
|
</button>
|
|
61
61
|
);
|
|
62
|
-
}
|
|
62
|
+
},
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
export default RemovableChips;
|
package/src/chips/Toggle.tsx
CHANGED
|
@@ -35,7 +35,7 @@ export const ToggleChips: OverridableComponent<
|
|
|
35
35
|
as: Component = "button",
|
|
36
36
|
...rest
|
|
37
37
|
},
|
|
38
|
-
ref
|
|
38
|
+
ref,
|
|
39
39
|
) => {
|
|
40
40
|
return (
|
|
41
41
|
<Component
|
|
@@ -45,7 +45,7 @@ export const ToggleChips: OverridableComponent<
|
|
|
45
45
|
"navds-chips__chip navds-chips__toggle",
|
|
46
46
|
className,
|
|
47
47
|
`navds-chips__toggle--${variant}`,
|
|
48
|
-
{ "navds-chips__toggle--with-checkmark": checkmark }
|
|
48
|
+
{ "navds-chips__toggle--with-checkmark": checkmark },
|
|
49
49
|
)}
|
|
50
50
|
aria-pressed={selected}
|
|
51
51
|
>
|
|
@@ -81,7 +81,7 @@ export const ToggleChips: OverridableComponent<
|
|
|
81
81
|
<span className="navds-chips__chip-text">{children}</span>
|
|
82
82
|
</Component>
|
|
83
83
|
);
|
|
84
|
-
}
|
|
84
|
+
},
|
|
85
85
|
);
|
|
86
86
|
|
|
87
87
|
export default ToggleChips;
|
|
@@ -25,7 +25,7 @@ export const Default = (props) => {
|
|
|
25
25
|
setSelected(
|
|
26
26
|
selected.includes(c)
|
|
27
27
|
? selected.filter((x) => x !== c)
|
|
28
|
-
: [...selected, c]
|
|
28
|
+
: [...selected, c],
|
|
29
29
|
)
|
|
30
30
|
}
|
|
31
31
|
>
|
|
@@ -72,7 +72,7 @@ export const Toggle = ({ size }) => {
|
|
|
72
72
|
setSelected(
|
|
73
73
|
selected.includes(y)
|
|
74
74
|
? selected.filter((x) => x !== y)
|
|
75
|
-
: [...selected, y]
|
|
75
|
+
: [...selected, y],
|
|
76
76
|
)
|
|
77
77
|
}
|
|
78
78
|
key={y}
|
|
@@ -90,7 +90,7 @@ export const Toggle = ({ size }) => {
|
|
|
90
90
|
setSelected(
|
|
91
91
|
selected.includes(y)
|
|
92
92
|
? selected.filter((x) => x !== y)
|
|
93
|
-
: [...selected, y]
|
|
93
|
+
: [...selected, y],
|
|
94
94
|
)
|
|
95
95
|
}
|
|
96
96
|
key={y}
|
|
@@ -178,7 +178,7 @@ export const Regular = () => {
|
|
|
178
178
|
setSelected(
|
|
179
179
|
selected.includes(y)
|
|
180
180
|
? selected.filter((x) => x !== y)
|
|
181
|
-
: [...selected, y]
|
|
181
|
+
: [...selected, y],
|
|
182
182
|
)
|
|
183
183
|
}
|
|
184
184
|
key={y}
|
|
@@ -208,7 +208,7 @@ export const Small = () => {
|
|
|
208
208
|
setSelected(
|
|
209
209
|
selected.includes(y)
|
|
210
210
|
? selected.filter((x) => x !== y)
|
|
211
|
-
: [...selected, y]
|
|
211
|
+
: [...selected, y],
|
|
212
212
|
)
|
|
213
213
|
}
|
|
214
214
|
key={y}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CheckmarkIcon, FilesIcon } from "@navikt/aksel-icons";
|
|
2
1
|
import cl from "clsx";
|
|
3
2
|
import React, {
|
|
4
3
|
ButtonHTMLAttributes,
|
|
@@ -7,8 +6,9 @@ import React, {
|
|
|
7
6
|
useRef,
|
|
8
7
|
useState,
|
|
9
8
|
} from "react";
|
|
10
|
-
import
|
|
9
|
+
import { CheckmarkIcon, FilesIcon } from "@navikt/aksel-icons";
|
|
11
10
|
import { Label } from "../typography";
|
|
11
|
+
import copy from "../util/copy";
|
|
12
12
|
|
|
13
13
|
export interface CopyButtonProps
|
|
14
14
|
extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
@@ -99,7 +99,7 @@ export const CopyButton = forwardRef<HTMLButtonElement, CopyButtonProps>(
|
|
|
99
99
|
iconPosition = "left",
|
|
100
100
|
...rest
|
|
101
101
|
},
|
|
102
|
-
ref
|
|
102
|
+
ref,
|
|
103
103
|
) => {
|
|
104
104
|
const [active, setActive] = useState(false);
|
|
105
105
|
const timeoutRef = useRef<number>();
|
|
@@ -111,7 +111,7 @@ export const CopyButton = forwardRef<HTMLButtonElement, CopyButtonProps>(
|
|
|
111
111
|
}, []);
|
|
112
112
|
|
|
113
113
|
const handleClick = (
|
|
114
|
-
event: React.MouseEvent<HTMLButtonElement, MouseEvent
|
|
114
|
+
event: React.MouseEvent<HTMLButtonElement, MouseEvent>,
|
|
115
115
|
) => {
|
|
116
116
|
timeoutRef.current && clearTimeout(timeoutRef.current);
|
|
117
117
|
copy(copyText);
|
|
@@ -158,7 +158,7 @@ export const CopyButton = forwardRef<HTMLButtonElement, CopyButtonProps>(
|
|
|
158
158
|
"navds-copybutton--icon-only": !text,
|
|
159
159
|
"navds-copybutton--icon-right": iconPosition === "right",
|
|
160
160
|
"navds-copybutton--active": active,
|
|
161
|
-
}
|
|
161
|
+
},
|
|
162
162
|
)}
|
|
163
163
|
onClick={handleClick}
|
|
164
164
|
>
|
|
@@ -186,7 +186,7 @@ export const CopyButton = forwardRef<HTMLButtonElement, CopyButtonProps>(
|
|
|
186
186
|
</span>
|
|
187
187
|
</button>
|
|
188
188
|
);
|
|
189
|
-
}
|
|
189
|
+
},
|
|
190
190
|
);
|
|
191
191
|
|
|
192
192
|
export default CopyButton;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { userEvent, within } from "@storybook/testing-library";
|
|
3
1
|
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
3
|
+
import React from "react";
|
|
4
4
|
import { LinkIcon, ThumbUpIcon } from "@navikt/aksel-icons";
|
|
5
|
-
import { Tooltip } from "../tooltip";
|
|
6
5
|
import { CopyButton } from ".";
|
|
6
|
+
import { Tooltip } from "../tooltip";
|
|
7
7
|
|
|
8
8
|
const meta: Meta<typeof CopyButton> = {
|
|
9
9
|
title: "ds-react/CopyButton",
|
|
@@ -2,7 +2,7 @@ import setYear from "date-fns/setYear";
|
|
|
2
2
|
import startOfMonth from "date-fns/startOfMonth";
|
|
3
3
|
import React, { createContext, useContext, useState } from "react";
|
|
4
4
|
import { useDayPicker } from "react-day-picker";
|
|
5
|
-
import {
|
|
5
|
+
import { Matcher, getInitialYear } from "../utils";
|
|
6
6
|
|
|
7
7
|
export type SharedMonthContextType = {
|
|
8
8
|
hasDropdown: boolean;
|
|
@@ -82,7 +82,7 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
|
82
82
|
onWeekNumberClick,
|
|
83
83
|
...rest
|
|
84
84
|
},
|
|
85
|
-
ref
|
|
85
|
+
ref,
|
|
86
86
|
) => {
|
|
87
87
|
const ariaId = useId(id);
|
|
88
88
|
const [open, setOpen] = useState(_open ?? false);
|
|
@@ -181,7 +181,7 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
|
181
181
|
</div>
|
|
182
182
|
</DateContext.Provider>
|
|
183
183
|
);
|
|
184
|
-
}
|
|
184
|
+
},
|
|
185
185
|
) as DatePickerComponent;
|
|
186
186
|
|
|
187
187
|
DatePicker.Standalone = DatePickerStandalone;
|
|
@@ -62,7 +62,7 @@ export const DatePickerStandalone: DatePickerStandaloneType = forwardRef<
|
|
|
62
62
|
onWeekNumberClick,
|
|
63
63
|
...rest
|
|
64
64
|
},
|
|
65
|
-
ref
|
|
65
|
+
ref,
|
|
66
66
|
) => {
|
|
67
67
|
const [selectedDates, setSelectedDates] = React.useState<
|
|
68
68
|
Date | Date[] | DateRange | undefined
|
|
@@ -122,7 +122,7 @@ export const DatePickerStandalone: DatePickerStandaloneType = forwardRef<
|
|
|
122
122
|
/>
|
|
123
123
|
</div>
|
|
124
124
|
);
|
|
125
|
-
}
|
|
125
|
+
},
|
|
126
126
|
);
|
|
127
127
|
|
|
128
128
|
export default DatePickerStandalone;
|
|
@@ -58,8 +58,8 @@ export const Default: StoryObj<DefaultStoryProps> = {
|
|
|
58
58
|
{...(props.mode === "single"
|
|
59
59
|
? singleCtx.datepickerProps
|
|
60
60
|
: props.mode === "range"
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
? rangeCtx.datepickerProps
|
|
62
|
+
: {})}
|
|
63
63
|
{...newProps}
|
|
64
64
|
locale={props.locale}
|
|
65
65
|
disableWeekends={props.disableWeekends}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { ArrowLeftIcon, ArrowRightIcon } from "@navikt/aksel-icons";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { CaptionProps, useDayPicker, useNavigation } from "react-day-picker";
|
|
4
|
-
|
|
5
|
-
import WeekRow from "./WeekRow";
|
|
3
|
+
import { ArrowLeftIcon, ArrowRightIcon } from "@navikt/aksel-icons";
|
|
6
4
|
import { Button } from "../../../button";
|
|
7
5
|
import { Label } from "../../../typography";
|
|
6
|
+
import WeekRow from "./WeekRow";
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* https://github.com/gpbl/react-day-picker/tree/main/src/components/Caption
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ArrowLeftIcon, ArrowRightIcon } from "@navikt/aksel-icons";
|
|
2
1
|
import { max, min } from "date-fns";
|
|
3
2
|
import setMonth from "date-fns/setMonth";
|
|
4
3
|
import setYear from "date-fns/setYear";
|
|
5
4
|
import startOfMonth from "date-fns/startOfMonth";
|
|
6
5
|
import React from "react";
|
|
7
6
|
import { CaptionProps, useDayPicker, useNavigation } from "react-day-picker";
|
|
7
|
+
import { ArrowLeftIcon, ArrowRightIcon } from "@navikt/aksel-icons";
|
|
8
8
|
import { Button } from "../../../button";
|
|
9
9
|
import { Select } from "../../../form/Select";
|
|
10
10
|
import { getMonths, getYears } from "../../utils/get-dates";
|
|
@@ -32,7 +32,7 @@ export const DropdownCaption = ({ displayMonth, id }: CaptionProps) => {
|
|
|
32
32
|
const handleYearChange: React.ChangeEventHandler<HTMLSelectElement> = (e) => {
|
|
33
33
|
const newMonth = setYear(
|
|
34
34
|
startOfMonth(displayMonth),
|
|
35
|
-
Number(e.target.value)
|
|
35
|
+
Number(e.target.value),
|
|
36
36
|
);
|
|
37
37
|
goToMonth(startOfMonth(min([max([newMonth, fromDate]), toDate])));
|
|
38
38
|
};
|