@navikt/ds-react 8.7.0 → 8.9.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/cjs/alert/base-alert/root/BaseAlertRoot.js +1 -2
- package/cjs/alert/base-alert/root/BaseAlertRoot.js.map +1 -1
- package/cjs/alert/info-card/index.d.ts +2 -2
- package/cjs/alert/info-card/index.js +2 -1
- package/cjs/alert/info-card/index.js.map +1 -1
- package/cjs/alert/info-card/message/InfoCardMessage.d.ts +23 -0
- package/cjs/alert/info-card/message/InfoCardMessage.js +73 -0
- package/cjs/alert/info-card/message/InfoCardMessage.js.map +1 -0
- package/cjs/alert/info-card/root/InfoCardRoot.d.ts +15 -2
- package/cjs/alert/info-card/root/InfoCardRoot.js +4 -1
- package/cjs/alert/info-card/root/InfoCardRoot.js.map +1 -1
- package/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.d.ts +12 -0
- package/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js +57 -0
- package/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js.map +1 -0
- package/cjs/data/drag-and-drop/item/DragAndDropItem.d.ts +27 -0
- package/cjs/data/drag-and-drop/item/DragAndDropItem.js +52 -0
- package/cjs/data/drag-and-drop/item/DragAndDropItem.js.map +1 -0
- package/cjs/data/drag-and-drop/root/DragAndDrop.context.d.ts +16 -0
- package/cjs/data/drag-and-drop/root/DragAndDrop.context.js +10 -0
- package/cjs/data/drag-and-drop/root/DragAndDrop.context.js.map +1 -0
- package/cjs/data/drag-and-drop/root/DragAndDropRoot.d.ts +36 -0
- package/cjs/data/drag-and-drop/root/DragAndDropRoot.js +187 -0
- package/cjs/data/drag-and-drop/root/DragAndDropRoot.js.map +1 -0
- package/cjs/data/drag-and-drop/types.d.ts +4 -0
- package/cjs/data/drag-and-drop/types.js +3 -0
- package/cjs/data/drag-and-drop/types.js.map +1 -0
- package/cjs/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.d.ts +22 -0
- package/cjs/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.js +35 -0
- package/cjs/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.js.map +1 -0
- package/cjs/data/{drag-and-drop → drag-and-drop-old}/item/DataDragAndDropItem.js +2 -7
- package/cjs/data/drag-and-drop-old/item/DataDragAndDropItem.js.map +1 -0
- package/cjs/data/drag-and-drop-old/root/DataDragAndDrop.context.js.map +1 -0
- package/cjs/data/{drag-and-drop → drag-and-drop-old}/root/DataDragAndDropRoot.d.ts +2 -2
- package/cjs/data/{drag-and-drop → drag-and-drop-old}/root/DataDragAndDropRoot.js +5 -8
- package/cjs/data/drag-and-drop-old/root/DataDragAndDropRoot.js.map +1 -0
- package/cjs/data/table/empty-state/DataTableEmptyState.d.ts +5 -0
- package/cjs/data/table/empty-state/DataTableEmptyState.js +57 -0
- package/cjs/data/table/empty-state/DataTableEmptyState.js.map +1 -0
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.d.ts +14 -0
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.js +48 -0
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.js.map +1 -0
- package/cjs/data/table/helpers/selection/getSingleSelectProps.d.ts +10 -0
- package/cjs/data/table/helpers/selection/getSingleSelectProps.js +23 -0
- package/cjs/data/table/helpers/selection/getSingleSelectProps.js.map +1 -0
- package/cjs/data/table/helpers/selection/selection.types.d.ts +42 -0
- package/cjs/data/table/helpers/selection/selection.types.js +3 -0
- package/cjs/data/table/helpers/selection/selection.types.js.map +1 -0
- package/cjs/data/table/helpers/table-focus.js +7 -1
- package/cjs/data/table/helpers/table-focus.js.map +1 -1
- package/cjs/data/table/helpers/table-keyboard.d.ts +0 -1
- package/cjs/data/table/helpers/table-keyboard.js +2 -4
- package/cjs/data/table/helpers/table-keyboard.js.map +1 -1
- package/cjs/data/table/{root → hooks}/useTableKeyboardNav.js +2 -1
- package/cjs/data/table/hooks/useTableKeyboardNav.js.map +1 -0
- package/cjs/data/table/hooks/useTableSelection.d.ts +8 -0
- package/cjs/data/table/hooks/useTableSelection.js +49 -0
- package/cjs/data/table/hooks/useTableSelection.js.map +1 -0
- package/cjs/data/table/loading-state/DataTableLoadingState.d.ts +5 -0
- package/cjs/data/table/loading-state/DataTableLoadingState.js +57 -0
- package/cjs/data/table/loading-state/DataTableLoadingState.js.map +1 -0
- package/cjs/data/table/root/DataTable.types.d.ts +13 -0
- package/cjs/data/table/root/DataTable.types.js +3 -0
- package/cjs/data/table/root/DataTable.types.js.map +1 -0
- package/cjs/data/table/root/DataTableAuto.d.ts +60 -0
- package/cjs/data/table/root/DataTableAuto.js +113 -0
- package/cjs/data/table/root/DataTableAuto.js.map +1 -0
- package/cjs/data/table/root/DataTableRoot.context.d.ts +3 -2
- package/cjs/data/table/root/DataTableRoot.context.js.map +1 -1
- package/cjs/data/table/root/DataTableRoot.d.ts +30 -3
- package/cjs/data/table/root/DataTableRoot.js +9 -3
- package/cjs/data/table/root/DataTableRoot.js.map +1 -1
- package/cjs/data/table/td/DataTableTd.d.ts +10 -0
- package/cjs/data/table/td/DataTableTd.js +4 -2
- package/cjs/data/table/td/DataTableTd.js.map +1 -1
- package/cjs/data/table/th/DataTableTh.d.ts +10 -4
- package/cjs/data/table/th/DataTableTh.js +24 -22
- package/cjs/data/table/th/DataTableTh.js.map +1 -1
- package/cjs/data/table/th/useTableColumnResize.d.ts +64 -0
- package/cjs/data/table/th/useTableColumnResize.js +144 -0
- package/cjs/data/table/th/useTableColumnResize.js.map +1 -0
- package/cjs/data/table/thead/DataTableThead.context.d.ts +4 -0
- package/cjs/data/table/thead/DataTableThead.context.js +45 -0
- package/cjs/data/table/thead/DataTableThead.context.js.map +1 -0
- package/cjs/data/table/thead/DataTableThead.js +3 -1
- package/cjs/data/table/thead/DataTableThead.js.map +1 -1
- package/cjs/data/table/tr/DataTableTr.js +4 -3
- package/cjs/data/table/tr/DataTableTr.js.map +1 -1
- package/cjs/data/token-filter/AutoSuggest.js +40 -9
- package/cjs/data/token-filter/AutoSuggest.js.map +1 -1
- package/cjs/data/token-filter/TokenFilter.d.ts +1 -0
- package/cjs/data/token-filter/TokenFilter.js +1 -0
- package/cjs/data/token-filter/TokenFilter.js.map +1 -1
- package/cjs/data/toolbar/root/DataToolbarRoot.d.ts +6 -23
- package/cjs/data/toolbar/root/DataToolbarRoot.js +42 -7
- package/cjs/data/toolbar/root/DataToolbarRoot.js.map +1 -1
- package/cjs/date/Date.Input.js +8 -9
- package/cjs/date/Date.Input.js.map +1 -1
- package/cjs/date/datepicker/hooks/useDatepicker.d.ts +12 -1
- package/cjs/date/datepicker/hooks/useDatepicker.js +4 -3
- package/cjs/date/datepicker/hooks/useDatepicker.js.map +1 -1
- package/cjs/date/monthpicker/hooks/useMonthPicker.d.ts +11 -1
- package/cjs/date/monthpicker/hooks/useMonthPicker.js +3 -2
- package/cjs/date/monthpicker/hooks/useMonthPicker.js.map +1 -1
- package/cjs/form/checkbox/CheckboxGroup.js +1 -1
- package/cjs/form/checkbox/CheckboxGroup.js.map +1 -1
- package/cjs/form/fieldset/Fieldset.d.ts +25 -5
- package/cjs/form/fieldset/Fieldset.js +19 -2
- package/cjs/form/fieldset/Fieldset.js.map +1 -1
- package/cjs/form/radio/RadioGroup.js +1 -1
- package/cjs/form/radio/RadioGroup.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/internal-header/InternalHeaderButton.d.ts +5 -0
- package/cjs/internal-header/InternalHeaderButton.js +2 -2
- package/cjs/internal-header/InternalHeaderButton.js.map +1 -1
- package/cjs/read-more/ReadMore.d.ts +10 -0
- package/cjs/read-more/ReadMore.js +4 -6
- package/cjs/read-more/ReadMore.js.map +1 -1
- package/cjs/types/index.d.ts +1 -1
- package/cjs/types/index.js +0 -15
- package/cjs/types/index.js.map +1 -1
- package/cjs/utils/components/Listbox/group/ListboxGroup.js +2 -1
- package/cjs/utils/components/Listbox/group/ListboxGroup.js.map +1 -1
- package/cjs/utils/components/Listbox/input-slot/ListboxInputSlot.js +1 -1
- package/cjs/utils/components/Listbox/input-slot/ListboxInputSlot.js.map +1 -1
- package/cjs/utils/components/Listbox/option/ListboxOption.d.ts +24 -0
- package/cjs/utils/components/Listbox/{item/ListboxItem.js → option/ListboxOption.js} +8 -8
- package/cjs/utils/components/Listbox/option/ListboxOption.js.map +1 -0
- package/cjs/utils/components/Listbox/options/ListboxOptions.d.ts +8 -0
- package/cjs/utils/components/Listbox/{list/ListboxList.js → options/ListboxOptions.js} +8 -8
- package/cjs/utils/components/Listbox/options/ListboxOptions.js.map +1 -0
- package/cjs/utils/components/Listbox/root/ListboxRoot.d.ts +6 -6
- package/cjs/utils/components/Listbox/root/ListboxRoot.js +28 -28
- package/cjs/utils/components/Listbox/root/ListboxRoot.js.map +1 -1
- package/cjs/utils/components/Listbox/root/domHelpers.d.ts +3 -3
- package/cjs/utils/components/Listbox/root/domHelpers.js +8 -8
- package/cjs/utils/components/Listbox/root/domHelpers.js.map +1 -1
- package/cjs/utils/components/floating/Floating.d.ts +1 -1
- package/cjs/utils/components/floating/Floating.js +1 -1
- package/cjs/utils/components/floating/Floating.js.map +1 -1
- package/cjs/utils/components/focus-boundary/FocusBoundary.d.ts +0 -1
- package/cjs/utils/components/focus-boundary/FocusBoundary.js +1 -1
- package/cjs/utils/components/focus-boundary/FocusBoundary.js.map +1 -1
- package/cjs/utils/components/link-anchor/LinkAnchor.js +10 -0
- package/cjs/utils/components/link-anchor/LinkAnchor.js.map +1 -1
- package/cjs/utils/helpers/className.js +1 -1
- package/cjs/utils/helpers/className.js.map +1 -1
- package/cjs/utils/helpers/focus.d.ts +3 -1
- package/cjs/utils/helpers/focus.js +2 -2
- package/cjs/utils/helpers/focus.js.map +1 -1
- package/cjs/utils/helpers/index.d.ts +9 -9
- package/cjs/utils/helpers/index.js +22 -23
- package/cjs/utils/helpers/index.js.map +1 -1
- package/cjs/utils/hooks/index.d.ts +13 -13
- package/cjs/utils/hooks/index.js +31 -28
- package/cjs/utils/hooks/index.js.map +1 -1
- package/cjs/utils/hooks/useScrollLock.js +41 -11
- package/cjs/utils/hooks/useScrollLock.js.map +1 -1
- package/esm/alert/base-alert/root/BaseAlertRoot.js +1 -2
- package/esm/alert/base-alert/root/BaseAlertRoot.js.map +1 -1
- package/esm/alert/info-card/index.d.ts +2 -2
- package/esm/alert/info-card/index.js +1 -1
- package/esm/alert/info-card/index.js.map +1 -1
- package/esm/alert/info-card/message/InfoCardMessage.d.ts +23 -0
- package/esm/alert/info-card/message/InfoCardMessage.js +37 -0
- package/esm/alert/info-card/message/InfoCardMessage.js.map +1 -0
- package/esm/alert/info-card/root/InfoCardRoot.d.ts +15 -2
- package/esm/alert/info-card/root/InfoCardRoot.js +3 -1
- package/esm/alert/info-card/root/InfoCardRoot.js.map +1 -1
- package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.d.ts +12 -0
- package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js +51 -0
- package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js.map +1 -0
- package/esm/data/drag-and-drop/item/DragAndDropItem.d.ts +27 -0
- package/esm/data/drag-and-drop/item/DragAndDropItem.js +46 -0
- package/esm/data/drag-and-drop/item/DragAndDropItem.js.map +1 -0
- package/esm/data/drag-and-drop/root/DragAndDrop.context.d.ts +16 -0
- package/esm/data/drag-and-drop/root/DragAndDrop.context.js +6 -0
- package/esm/data/drag-and-drop/root/DragAndDrop.context.js.map +1 -0
- package/esm/data/drag-and-drop/root/DragAndDropRoot.d.ts +36 -0
- package/esm/data/drag-and-drop/root/DragAndDropRoot.js +147 -0
- package/esm/data/drag-and-drop/root/DragAndDropRoot.js.map +1 -0
- package/esm/data/drag-and-drop/types.d.ts +4 -0
- package/esm/data/drag-and-drop/types.js +2 -0
- package/esm/data/drag-and-drop/types.js.map +1 -0
- package/esm/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.d.ts +22 -0
- package/esm/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.js +29 -0
- package/esm/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.js.map +1 -0
- package/esm/data/{drag-and-drop → drag-and-drop-old}/item/DataDragAndDropItem.js +2 -7
- package/esm/data/drag-and-drop-old/item/DataDragAndDropItem.js.map +1 -0
- package/esm/data/drag-and-drop-old/root/DataDragAndDrop.context.js.map +1 -0
- package/esm/data/{drag-and-drop → drag-and-drop-old}/root/DataDragAndDropRoot.d.ts +2 -2
- package/esm/data/{drag-and-drop → drag-and-drop-old}/root/DataDragAndDropRoot.js +5 -8
- package/esm/data/drag-and-drop-old/root/DataDragAndDropRoot.js.map +1 -0
- package/esm/data/table/empty-state/DataTableEmptyState.d.ts +5 -0
- package/esm/data/table/empty-state/DataTableEmptyState.js +21 -0
- package/esm/data/table/empty-state/DataTableEmptyState.js.map +1 -0
- package/esm/data/table/helpers/selection/getMultipleSelectProps.d.ts +14 -0
- package/esm/data/table/helpers/selection/getMultipleSelectProps.js +46 -0
- package/esm/data/table/helpers/selection/getMultipleSelectProps.js.map +1 -0
- package/esm/data/table/helpers/selection/getSingleSelectProps.d.ts +10 -0
- package/esm/data/table/helpers/selection/getSingleSelectProps.js +21 -0
- package/esm/data/table/helpers/selection/getSingleSelectProps.js.map +1 -0
- package/esm/data/table/helpers/selection/selection.types.d.ts +42 -0
- package/esm/data/table/helpers/selection/selection.types.js +2 -0
- package/esm/data/table/helpers/selection/selection.types.js.map +1 -0
- package/esm/data/table/helpers/table-focus.js +7 -1
- package/esm/data/table/helpers/table-focus.js.map +1 -1
- package/esm/data/table/helpers/table-keyboard.d.ts +0 -1
- package/esm/data/table/helpers/table-keyboard.js +2 -4
- package/esm/data/table/helpers/table-keyboard.js.map +1 -1
- package/esm/data/table/{root → hooks}/useTableKeyboardNav.js +2 -1
- package/esm/data/table/hooks/useTableKeyboardNav.js.map +1 -0
- package/esm/data/table/hooks/useTableSelection.d.ts +8 -0
- package/esm/data/table/hooks/useTableSelection.js +47 -0
- package/esm/data/table/hooks/useTableSelection.js.map +1 -0
- package/esm/data/table/loading-state/DataTableLoadingState.d.ts +5 -0
- package/esm/data/table/loading-state/DataTableLoadingState.js +21 -0
- package/esm/data/table/loading-state/DataTableLoadingState.js.map +1 -0
- package/esm/data/table/root/DataTable.types.d.ts +13 -0
- package/esm/data/table/root/DataTable.types.js +2 -0
- package/esm/data/table/root/DataTable.types.js.map +1 -0
- package/esm/data/table/root/DataTableAuto.d.ts +60 -0
- package/esm/data/table/root/DataTableAuto.js +77 -0
- package/esm/data/table/root/DataTableAuto.js.map +1 -0
- package/esm/data/table/root/DataTableRoot.context.d.ts +3 -2
- package/esm/data/table/root/DataTableRoot.context.js.map +1 -1
- package/esm/data/table/root/DataTableRoot.d.ts +30 -3
- package/esm/data/table/root/DataTableRoot.js +7 -3
- package/esm/data/table/root/DataTableRoot.js.map +1 -1
- package/esm/data/table/td/DataTableTd.d.ts +10 -0
- package/esm/data/table/td/DataTableTd.js +4 -2
- package/esm/data/table/td/DataTableTd.js.map +1 -1
- package/esm/data/table/th/DataTableTh.d.ts +10 -4
- package/esm/data/table/th/DataTableTh.js +25 -23
- package/esm/data/table/th/DataTableTh.js.map +1 -1
- package/esm/data/table/th/useTableColumnResize.d.ts +64 -0
- package/esm/data/table/th/useTableColumnResize.js +142 -0
- package/esm/data/table/th/useTableColumnResize.js.map +1 -0
- package/esm/data/table/thead/DataTableThead.context.d.ts +4 -0
- package/esm/data/table/thead/DataTableThead.context.js +8 -0
- package/esm/data/table/thead/DataTableThead.context.js.map +1 -0
- package/esm/data/table/thead/DataTableThead.js +3 -1
- package/esm/data/table/thead/DataTableThead.js.map +1 -1
- package/esm/data/table/tr/DataTableTr.js +4 -3
- package/esm/data/table/tr/DataTableTr.js.map +1 -1
- package/esm/data/token-filter/AutoSuggest.js +41 -10
- package/esm/data/token-filter/AutoSuggest.js.map +1 -1
- package/esm/data/token-filter/TokenFilter.d.ts +1 -0
- package/esm/data/token-filter/TokenFilter.js +1 -0
- package/esm/data/token-filter/TokenFilter.js.map +1 -1
- package/esm/data/toolbar/root/DataToolbarRoot.d.ts +6 -23
- package/esm/data/toolbar/root/DataToolbarRoot.js +9 -7
- package/esm/data/toolbar/root/DataToolbarRoot.js.map +1 -1
- package/esm/date/Date.Input.js +9 -10
- package/esm/date/Date.Input.js.map +1 -1
- package/esm/date/datepicker/hooks/useDatepicker.d.ts +12 -1
- package/esm/date/datepicker/hooks/useDatepicker.js +4 -3
- package/esm/date/datepicker/hooks/useDatepicker.js.map +1 -1
- package/esm/date/monthpicker/hooks/useMonthPicker.d.ts +11 -1
- package/esm/date/monthpicker/hooks/useMonthPicker.js +3 -2
- package/esm/date/monthpicker/hooks/useMonthPicker.js.map +1 -1
- package/esm/form/checkbox/CheckboxGroup.js +1 -1
- package/esm/form/checkbox/CheckboxGroup.js.map +1 -1
- package/esm/form/fieldset/Fieldset.d.ts +25 -5
- package/esm/form/fieldset/Fieldset.js +19 -2
- package/esm/form/fieldset/Fieldset.js.map +1 -1
- package/esm/form/radio/RadioGroup.js +1 -1
- package/esm/form/radio/RadioGroup.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js.map +1 -1
- package/esm/internal-header/InternalHeaderButton.d.ts +5 -0
- package/esm/internal-header/InternalHeaderButton.js +2 -2
- package/esm/internal-header/InternalHeaderButton.js.map +1 -1
- package/esm/read-more/ReadMore.d.ts +10 -0
- package/esm/read-more/ReadMore.js +4 -6
- package/esm/read-more/ReadMore.js.map +1 -1
- package/esm/types/index.d.ts +1 -1
- package/esm/types/index.js +1 -1
- package/esm/types/index.js.map +1 -1
- package/esm/utils/components/Listbox/group/ListboxGroup.js +2 -1
- package/esm/utils/components/Listbox/group/ListboxGroup.js.map +1 -1
- package/esm/utils/components/Listbox/input-slot/ListboxInputSlot.js +1 -1
- package/esm/utils/components/Listbox/input-slot/ListboxInputSlot.js.map +1 -1
- package/esm/utils/components/Listbox/option/ListboxOption.d.ts +24 -0
- package/esm/utils/components/Listbox/{item/ListboxItem.js → option/ListboxOption.js} +7 -7
- package/esm/utils/components/Listbox/option/ListboxOption.js.map +1 -0
- package/esm/utils/components/Listbox/options/ListboxOptions.d.ts +8 -0
- package/esm/utils/components/Listbox/{list/ListboxList.js → options/ListboxOptions.js} +8 -8
- package/esm/utils/components/Listbox/options/ListboxOptions.js.map +1 -0
- package/esm/utils/components/Listbox/root/ListboxRoot.d.ts +6 -6
- package/esm/utils/components/Listbox/root/ListboxRoot.js +29 -29
- package/esm/utils/components/Listbox/root/ListboxRoot.js.map +1 -1
- package/esm/utils/components/Listbox/root/domHelpers.d.ts +3 -3
- package/esm/utils/components/Listbox/root/domHelpers.js +7 -7
- package/esm/utils/components/Listbox/root/domHelpers.js.map +1 -1
- package/esm/utils/components/floating/Floating.d.ts +1 -1
- package/esm/utils/components/floating/Floating.js +1 -1
- package/esm/utils/components/floating/Floating.js.map +1 -1
- package/esm/utils/components/focus-boundary/FocusBoundary.d.ts +0 -1
- package/esm/utils/components/focus-boundary/FocusBoundary.js +1 -1
- package/esm/utils/components/focus-boundary/FocusBoundary.js.map +1 -1
- package/esm/utils/components/link-anchor/LinkAnchor.js +10 -0
- package/esm/utils/components/link-anchor/LinkAnchor.js.map +1 -1
- package/esm/utils/helpers/className.js +1 -1
- package/esm/utils/helpers/className.js.map +1 -1
- package/esm/utils/helpers/focus.d.ts +3 -1
- package/esm/utils/helpers/focus.js +2 -2
- package/esm/utils/helpers/focus.js.map +1 -1
- package/esm/utils/helpers/index.d.ts +9 -9
- package/esm/utils/helpers/index.js +9 -9
- package/esm/utils/helpers/index.js.map +1 -1
- package/esm/utils/hooks/index.d.ts +13 -13
- package/esm/utils/hooks/index.js +13 -13
- package/esm/utils/hooks/index.js.map +1 -1
- package/esm/utils/hooks/useScrollLock.js +41 -11
- package/esm/utils/hooks/useScrollLock.js.map +1 -1
- package/package.json +6 -6
- package/src/alert/base-alert/root/BaseAlertRoot.tsx +1 -1
- package/src/alert/info-card/index.ts +2 -0
- package/src/alert/info-card/message/InfoCardMessage.tsx +48 -0
- package/src/alert/info-card/root/InfoCardRoot.tsx +20 -1
- package/src/data/drag-and-drop/drag-handler/DragAndDropDragHandler.tsx +90 -0
- package/src/data/drag-and-drop/item/DragAndDropItem.tsx +71 -0
- package/src/data/drag-and-drop/root/DragAndDrop.context.tsx +25 -0
- package/src/data/drag-and-drop/root/DragAndDropRoot.tsx +245 -0
- package/src/data/drag-and-drop/types.ts +4 -0
- package/src/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.tsx +104 -0
- package/src/data/{drag-and-drop → drag-and-drop-old}/item/DataDragAndDropItem.tsx +6 -33
- package/src/data/{drag-and-drop → drag-and-drop-old}/root/DataDragAndDrop.context.tsx +2 -0
- package/src/data/{drag-and-drop → drag-and-drop-old}/root/DataDragAndDropRoot.tsx +6 -8
- package/src/data/table/empty-state/DataTableEmptyState.tsx +26 -0
- package/src/data/table/helpers/selection/getMultipleSelectProps.ts +70 -0
- package/src/data/table/helpers/selection/getSingleSelectProps.ts +33 -0
- package/src/data/table/helpers/selection/selection.types.ts +56 -0
- package/src/data/table/helpers/table-focus.ts +10 -1
- package/src/data/table/helpers/table-keyboard.ts +2 -6
- package/src/data/table/hooks/__tests__/useTableSelection.test.ts +327 -0
- package/src/data/table/{root → hooks}/useTableKeyboardNav.ts +2 -1
- package/src/data/table/hooks/useTableSelection.ts +78 -0
- package/src/data/table/loading-state/DataTableLoadingState.tsx +26 -0
- package/src/data/table/root/DataTable.types.ts +16 -0
- package/src/data/table/root/DataTableAuto.tsx +205 -0
- package/src/data/table/root/DataTableRoot.context.ts +3 -2
- package/src/data/table/root/DataTableRoot.tsx +46 -3
- package/src/data/table/td/DataTableTd.tsx +14 -1
- package/src/data/table/th/DataTableTh.tsx +48 -36
- package/src/data/table/th/useTableColumnResize.ts +276 -0
- package/src/data/table/thead/DataTableThead.context.ts +10 -0
- package/src/data/table/thead/DataTableThead.tsx +8 -5
- package/src/data/table/tr/DataTableTr.tsx +8 -3
- package/src/data/token-filter/AutoSuggest.tsx +76 -15
- package/src/data/token-filter/TokenFilter.tsx +1 -0
- package/src/data/toolbar/root/DataToolbarRoot.tsx +29 -32
- package/src/date/Date.Input.tsx +18 -17
- package/src/date/datepicker/hooks/useDatepicker.tsx +16 -6
- package/src/date/monthpicker/hooks/useMonthPicker.tsx +14 -5
- package/src/form/checkbox/CheckboxGroup.tsx +1 -1
- package/src/form/fieldset/Fieldset.tsx +31 -7
- package/src/form/radio/RadioGroup.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/internal-header/InternalHeaderButton.tsx +18 -9
- package/src/read-more/ReadMore.tsx +15 -16
- package/src/types/index.ts +1 -1
- package/src/utils/components/Listbox/group/ListboxGroup.tsx +9 -2
- package/src/utils/components/Listbox/input-slot/ListboxInputSlot.tsx +1 -1
- package/src/utils/components/Listbox/{item/ListboxItem.tsx → option/ListboxOption.tsx} +14 -14
- package/src/utils/components/Listbox/{list/ListboxList.tsx → options/ListboxOptions.tsx} +10 -10
- package/src/utils/components/Listbox/root/ListboxRoot.tsx +31 -31
- package/src/utils/components/Listbox/root/domHelpers.ts +8 -7
- package/src/utils/components/floating/Floating.tsx +2 -2
- package/src/utils/components/focus-boundary/FocusBoundary.tsx +1 -2
- package/src/utils/components/link-anchor/LinkAnchor.tsx +11 -0
- package/src/utils/helpers/className.ts +1 -1
- package/src/utils/helpers/focus.ts +5 -2
- package/src/utils/helpers/index.ts +9 -9
- package/src/utils/hooks/index.ts +20 -13
- package/src/utils/hooks/useScrollLock.ts +57 -13
- package/cjs/data/action-bar/root/DataActionBarRoot.d.ts +0 -27
- package/cjs/data/action-bar/root/DataActionBarRoot.js +0 -49
- package/cjs/data/action-bar/root/DataActionBarRoot.js.map +0 -1
- package/cjs/data/drag-and-drop/item/DataDragAndDropItem.js.map +0 -1
- package/cjs/data/drag-and-drop/root/DataDragAndDrop.context.js.map +0 -1
- package/cjs/data/drag-and-drop/root/DataDragAndDropRoot.js.map +0 -1
- package/cjs/data/table/root/useTableKeyboardNav.js.map +0 -1
- package/cjs/utils/components/Listbox/item/ListboxItem.d.ts +0 -24
- package/cjs/utils/components/Listbox/item/ListboxItem.js.map +0 -1
- package/cjs/utils/components/Listbox/list/ListboxList.d.ts +0 -8
- package/cjs/utils/components/Listbox/list/ListboxList.js.map +0 -1
- package/esm/data/action-bar/root/DataActionBarRoot.d.ts +0 -27
- package/esm/data/action-bar/root/DataActionBarRoot.js +0 -43
- package/esm/data/action-bar/root/DataActionBarRoot.js.map +0 -1
- package/esm/data/drag-and-drop/item/DataDragAndDropItem.js.map +0 -1
- package/esm/data/drag-and-drop/root/DataDragAndDrop.context.js.map +0 -1
- package/esm/data/drag-and-drop/root/DataDragAndDropRoot.js.map +0 -1
- package/esm/data/table/root/useTableKeyboardNav.js.map +0 -1
- package/esm/utils/components/Listbox/item/ListboxItem.d.ts +0 -24
- package/esm/utils/components/Listbox/item/ListboxItem.js.map +0 -1
- package/esm/utils/components/Listbox/list/ListboxList.d.ts +0 -8
- package/esm/utils/components/Listbox/list/ListboxList.js.map +0 -1
- package/src/data/action-bar/root/DataActionBarRoot.tsx +0 -59
- /package/cjs/data/{drag-and-drop → drag-and-drop-old}/item/DataDragAndDropItem.d.ts +0 -0
- /package/cjs/data/{drag-and-drop → drag-and-drop-old}/root/DataDragAndDrop.context.d.ts +0 -0
- /package/cjs/data/{drag-and-drop → drag-and-drop-old}/root/DataDragAndDrop.context.js +0 -0
- /package/cjs/data/table/{root → hooks}/useTableKeyboardNav.d.ts +0 -0
- /package/esm/data/{drag-and-drop → drag-and-drop-old}/item/DataDragAndDropItem.d.ts +0 -0
- /package/esm/data/{drag-and-drop → drag-and-drop-old}/root/DataDragAndDrop.context.d.ts +0 -0
- /package/esm/data/{drag-and-drop → drag-and-drop-old}/root/DataDragAndDrop.context.js +0 -0
- /package/esm/data/table/{root → hooks}/useTableKeyboardNav.d.ts +0 -0
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import React, { forwardRef, useState } from "react";
|
|
1
|
+
import React, { type JSX, forwardRef, useState } from "react";
|
|
2
2
|
import { Search } from "../../form/search";
|
|
3
3
|
import { VStack } from "../../primitives/stack";
|
|
4
|
-
import {
|
|
5
|
-
import { ListboxGroup } from "../../utils/components/Listbox/group/ListboxGroup";
|
|
6
|
-
import { ListboxItem } from "../../utils/components/Listbox/item/ListboxItem";
|
|
4
|
+
import { BodyShort, Detail } from "../../typography";
|
|
7
5
|
import Listbox from "../../utils/components/Listbox/root/ListboxRoot";
|
|
8
6
|
import { DismissableLayer } from "../../utils/components/dismissablelayer/DismissableLayer";
|
|
9
7
|
import { Floating } from "../../utils/components/floating/Floating";
|
|
@@ -22,7 +20,8 @@ interface AutoSuggestProps {
|
|
|
22
20
|
|
|
23
21
|
const AutoSuggest = forwardRef<HTMLInputElement, AutoSuggestProps>(
|
|
24
22
|
({ options, onSelect, value, onChange, open, setOpen }, ref) => {
|
|
25
|
-
const [
|
|
23
|
+
const [virtuallyFocusedOptionId, setVirtuallyFocusedOptionId] =
|
|
24
|
+
useState("");
|
|
26
25
|
|
|
27
26
|
const [inputRef, setInputRef] = useState<HTMLInputElement | null>(null);
|
|
28
27
|
|
|
@@ -49,7 +48,7 @@ const AutoSuggest = forwardRef<HTMLInputElement, AutoSuggestProps>(
|
|
|
49
48
|
|
|
50
49
|
return (
|
|
51
50
|
<Floating>
|
|
52
|
-
<Listbox
|
|
51
|
+
<Listbox setVirtuallyFocusedOptionId={setVirtuallyFocusedOptionId}>
|
|
53
52
|
<Floating.Anchor>
|
|
54
53
|
<Listbox.InputSlot>
|
|
55
54
|
<Search
|
|
@@ -64,6 +63,8 @@ const AutoSuggest = forwardRef<HTMLInputElement, AutoSuggestProps>(
|
|
|
64
63
|
setOpen(true);
|
|
65
64
|
}}
|
|
66
65
|
onFocus={() => setOpen(true)}
|
|
66
|
+
size="small"
|
|
67
|
+
autoComplete="off"
|
|
67
68
|
/* onKeyDown={(e) => {
|
|
68
69
|
if (e.key === "Enter") {
|
|
69
70
|
createToken(filterText);
|
|
@@ -76,10 +77,11 @@ const AutoSuggest = forwardRef<HTMLInputElement, AutoSuggestProps>(
|
|
|
76
77
|
<AutoSuggestPopup
|
|
77
78
|
options={options}
|
|
78
79
|
onSelect={handleSelectOption}
|
|
79
|
-
focusedValue={
|
|
80
|
-
setFocusedValue={
|
|
80
|
+
focusedValue={virtuallyFocusedOptionId}
|
|
81
|
+
setFocusedValue={setVirtuallyFocusedOptionId}
|
|
81
82
|
onClose={handleClose}
|
|
82
83
|
safeZoneAnchor={inputRef}
|
|
84
|
+
autoSuggestValue={value}
|
|
83
85
|
/>
|
|
84
86
|
)}
|
|
85
87
|
</Listbox>
|
|
@@ -95,6 +97,7 @@ type AutoSuggestPopupProps = {
|
|
|
95
97
|
setFocusedValue: (value: string) => void;
|
|
96
98
|
onClose: () => void;
|
|
97
99
|
safeZoneAnchor: HTMLInputElement | null;
|
|
100
|
+
autoSuggestValue: string;
|
|
98
101
|
};
|
|
99
102
|
|
|
100
103
|
const AutoSuggestPopup = forwardRef<HTMLDivElement, AutoSuggestPopupProps>(
|
|
@@ -106,6 +109,7 @@ const AutoSuggestPopup = forwardRef<HTMLDivElement, AutoSuggestPopupProps>(
|
|
|
106
109
|
setFocusedValue,
|
|
107
110
|
onClose,
|
|
108
111
|
safeZoneAnchor,
|
|
112
|
+
autoSuggestValue,
|
|
109
113
|
},
|
|
110
114
|
ref,
|
|
111
115
|
) => {
|
|
@@ -124,18 +128,23 @@ const AutoSuggestPopup = forwardRef<HTMLDivElement, AutoSuggestPopupProps>(
|
|
|
124
128
|
className="aksel-property-filter__popup"
|
|
125
129
|
>
|
|
126
130
|
<div className="aksel-property-filter__popup-inner">
|
|
127
|
-
<Listbox.
|
|
131
|
+
<Listbox.Options setVirtuallyFocusedOptionId={setFocusedValue}>
|
|
128
132
|
{options.map((group) => (
|
|
129
|
-
<
|
|
133
|
+
<Listbox.Group key={group.label} label={group.label}>
|
|
130
134
|
{group.options.map((item) => (
|
|
131
|
-
<
|
|
135
|
+
<Listbox.Option
|
|
132
136
|
key={item.value}
|
|
133
137
|
id={item.value}
|
|
134
138
|
onClick={() => onSelect(item)}
|
|
135
139
|
hasVirtualFocus={focusedValue === item.value}
|
|
136
140
|
>
|
|
137
141
|
<VStack gap="space-0">
|
|
138
|
-
<
|
|
142
|
+
<BodyShort as="div" size="small">
|
|
143
|
+
<HighlightText
|
|
144
|
+
text={item.label}
|
|
145
|
+
highlightText={autoSuggestValue}
|
|
146
|
+
/>
|
|
147
|
+
</BodyShort>
|
|
139
148
|
{item.description && (
|
|
140
149
|
<Detail as="div">{item.description}</Detail>
|
|
141
150
|
)}
|
|
@@ -147,11 +156,11 @@ const AutoSuggestPopup = forwardRef<HTMLDivElement, AutoSuggestPopupProps>(
|
|
|
147
156
|
))}
|
|
148
157
|
</div>
|
|
149
158
|
)} */}
|
|
150
|
-
</
|
|
159
|
+
</Listbox.Option>
|
|
151
160
|
))}
|
|
152
|
-
</
|
|
161
|
+
</Listbox.Group>
|
|
153
162
|
))}
|
|
154
|
-
</Listbox.
|
|
163
|
+
</Listbox.Options>
|
|
155
164
|
</div>
|
|
156
165
|
</Floating.Content>
|
|
157
166
|
</DismissableLayer>
|
|
@@ -159,4 +168,56 @@ const AutoSuggestPopup = forwardRef<HTMLDivElement, AutoSuggestPopupProps>(
|
|
|
159
168
|
},
|
|
160
169
|
);
|
|
161
170
|
|
|
171
|
+
function HighlightText({
|
|
172
|
+
text,
|
|
173
|
+
highlightText,
|
|
174
|
+
}: {
|
|
175
|
+
text: string;
|
|
176
|
+
highlightText: string;
|
|
177
|
+
}) {
|
|
178
|
+
if (!text || !highlightText) {
|
|
179
|
+
return <span>{text}</span>;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (text === highlightText) {
|
|
183
|
+
return <Highlight text={text} />;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const { noMatches, matches } = highlightSplit(text, highlightText);
|
|
187
|
+
|
|
188
|
+
const highlighted: (string | JSX.Element)[] = [];
|
|
189
|
+
|
|
190
|
+
noMatches.forEach((noMatch, idx) => {
|
|
191
|
+
highlighted.push(<span key={`noMatch-${idx}`}>{noMatch}</span>);
|
|
192
|
+
|
|
193
|
+
if (matches && idx < matches.length) {
|
|
194
|
+
highlighted.push(<Highlight key={`match-${idx}`} text={matches[idx]} />);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
return <span>{highlighted}</span>;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function Highlight({ text }: { text: string }) {
|
|
202
|
+
return <mark className="aksel-listbox__highlight">{text}</mark>;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function highlightSplit(text: string, highlightText: string) {
|
|
206
|
+
/* Skip loooong texts */
|
|
207
|
+
if (highlightText.length > 1000) {
|
|
208
|
+
return { noMatches: [text], matches: null };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* Case insensitive filtering */
|
|
212
|
+
const filteringPattern = highlightText.replace(
|
|
213
|
+
/[-[\]/{}()*+?.\\^$|]/g,
|
|
214
|
+
"\\$&",
|
|
215
|
+
);
|
|
216
|
+
const regexp = new RegExp(filteringPattern, "gi");
|
|
217
|
+
const noMatches = text.split(regexp);
|
|
218
|
+
const matches = text.match(regexp);
|
|
219
|
+
|
|
220
|
+
return { noMatches, matches };
|
|
221
|
+
}
|
|
222
|
+
|
|
162
223
|
export { AutoSuggest };
|
|
@@ -28,6 +28,7 @@ type TokenFilterProps = {
|
|
|
28
28
|
* TODO:
|
|
29
29
|
* - Implement onChange handler to update query state when user selects an autocomplete option.
|
|
30
30
|
* - Handle token rendering and editing (e.g., show tokens for matched properties/operators/values, allow deleting tokens).
|
|
31
|
+
* - Writing "stance" still shows status and hostname options
|
|
31
32
|
*/
|
|
32
33
|
export const TokenFilter = forwardRef<HTMLDivElement, TokenFilterProps>(
|
|
33
34
|
({ query, className, propertyDefinitions, options, onChange }, ref) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
import { cl } from "../../../utils/helpers";
|
|
3
3
|
import DataToolbarButton, {
|
|
4
4
|
DataToolbarButtonProps,
|
|
@@ -12,23 +12,15 @@ import DataToolbarToggleButton, {
|
|
|
12
12
|
} from "../toggle-button/DataToolbarToggleButton";
|
|
13
13
|
|
|
14
14
|
interface DataToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
15
|
-
children
|
|
15
|
+
children?: never;
|
|
16
|
+
renderInput?: React.ReactNode;
|
|
17
|
+
renderPreferences?: React.ReactNode;
|
|
18
|
+
renderPagination?: React.ReactNode;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
interface DataToolbarRootComponent extends React.ForwardRefExoticComponent<
|
|
19
22
|
DataToolbarProps & React.RefAttributes<HTMLDivElement>
|
|
20
23
|
> {
|
|
21
|
-
/**
|
|
22
|
-
* @see 🏷️ {@link DataToolbarSearchFieldProps}
|
|
23
|
-
* @example
|
|
24
|
-
* ```tsx
|
|
25
|
-
* <DataToolbar>
|
|
26
|
-
* <DataToolbar.SearchField />
|
|
27
|
-
* </DataToolbar>
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
SearchField: typeof DataToolbarSearchField;
|
|
31
|
-
|
|
32
24
|
/**
|
|
33
25
|
* @see 🏷️ {@link DataToolbarButtonProps}
|
|
34
26
|
* @example
|
|
@@ -39,48 +31,53 @@ interface DataToolbarRootComponent extends React.ForwardRefExoticComponent<
|
|
|
39
31
|
* ```
|
|
40
32
|
*/
|
|
41
33
|
Button: typeof DataToolbarButton;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @see 🏷️ {@link DataToolbarToggleButtonProps}
|
|
45
|
-
* @example
|
|
46
|
-
* ```tsx
|
|
47
|
-
* <DataToolbar>
|
|
48
|
-
* <DataToolbar.ToggleButton />
|
|
49
|
-
* </DataToolbar>
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
ToggleButton: typeof DataToolbarToggleButton;
|
|
53
34
|
}
|
|
54
35
|
|
|
55
|
-
const DataToolbar =
|
|
56
|
-
(
|
|
36
|
+
const DataToolbar = forwardRef<HTMLDivElement, DataToolbarProps>(
|
|
37
|
+
(
|
|
38
|
+
{ className, renderInput, renderPreferences, renderPagination, ...rest },
|
|
39
|
+
forwardedRef,
|
|
40
|
+
) => {
|
|
57
41
|
return (
|
|
58
42
|
<div
|
|
59
|
-
ref={
|
|
43
|
+
ref={forwardedRef}
|
|
60
44
|
{...rest}
|
|
61
45
|
className={cl("aksel-data-toolbar", className)}
|
|
62
46
|
role="toolbar"
|
|
63
47
|
>
|
|
64
|
-
{
|
|
48
|
+
{renderInput && (
|
|
49
|
+
<div className="aksel-data-toolbar__input">{renderInput}</div>
|
|
50
|
+
)}
|
|
51
|
+
|
|
52
|
+
<div className="aksel-data-toolbar__actions">
|
|
53
|
+
{renderPagination && (
|
|
54
|
+
<div className="aksel-data-toolbar__pagination">
|
|
55
|
+
{renderPagination}
|
|
56
|
+
</div>
|
|
57
|
+
)}
|
|
58
|
+
{renderPreferences && (
|
|
59
|
+
<div className="aksel-data-toolbar__preferences">
|
|
60
|
+
{renderPreferences}
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
65
64
|
</div>
|
|
66
65
|
);
|
|
67
66
|
},
|
|
68
67
|
) as DataToolbarRootComponent;
|
|
69
68
|
|
|
70
|
-
DataToolbar.SearchField = DataToolbarSearchField;
|
|
71
69
|
DataToolbar.Button = DataToolbarButton;
|
|
72
|
-
DataToolbar.ToggleButton = DataToolbarToggleButton;
|
|
73
70
|
|
|
74
71
|
export {
|
|
75
72
|
DataToolbar,
|
|
76
|
-
DataToolbarSearchField,
|
|
77
73
|
DataToolbarButton,
|
|
74
|
+
DataToolbarSearchField,
|
|
78
75
|
DataToolbarToggleButton,
|
|
79
76
|
};
|
|
80
77
|
export default DataToolbar;
|
|
81
78
|
export type {
|
|
79
|
+
DataToolbarButtonProps,
|
|
82
80
|
DataToolbarProps,
|
|
83
81
|
DataToolbarSearchFieldProps,
|
|
84
|
-
DataToolbarButtonProps,
|
|
85
82
|
DataToolbarToggleButtonProps,
|
|
86
83
|
};
|
package/src/date/Date.Input.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React, { InputHTMLAttributes, forwardRef
|
|
1
|
+
import React, { InputHTMLAttributes, forwardRef } from "react";
|
|
2
2
|
import { CalendarIcon } from "@navikt/aksel-icons";
|
|
3
|
+
import { Button } from "../button";
|
|
3
4
|
import { ReadOnlyIcon } from "../form/ReadOnlyIcon";
|
|
4
5
|
import { FormFieldProps, useFormField } from "../form/useFormField";
|
|
5
6
|
import { BodyShort, ErrorMessage, Label } from "../typography";
|
|
@@ -68,10 +69,10 @@ const DateInput = forwardRef<HTMLInputElement, DateInputProps>((props, ref) => {
|
|
|
68
69
|
description,
|
|
69
70
|
variant = "datepicker",
|
|
70
71
|
setAnchorRef,
|
|
72
|
+
"data-color": dataColor,
|
|
71
73
|
...rest
|
|
72
74
|
} = props;
|
|
73
75
|
|
|
74
|
-
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
75
76
|
const translate = useDateTranslationContext().translate;
|
|
76
77
|
|
|
77
78
|
const isDatepickerVariant = variant === "datepicker";
|
|
@@ -113,6 +114,7 @@ const DateInput = forwardRef<HTMLInputElement, DateInputProps>((props, ref) => {
|
|
|
113
114
|
"aksel-date__field--readonly": readOnly,
|
|
114
115
|
},
|
|
115
116
|
)}
|
|
117
|
+
data-color={dataColor}
|
|
116
118
|
>
|
|
117
119
|
<Label
|
|
118
120
|
htmlFor={inputProps.id}
|
|
@@ -142,7 +144,7 @@ const DateInput = forwardRef<HTMLInputElement, DateInputProps>((props, ref) => {
|
|
|
142
144
|
{...omit(rest, ["error", "errorId", "size"])}
|
|
143
145
|
{...inputProps}
|
|
144
146
|
autoComplete="off"
|
|
145
|
-
aria-controls={context
|
|
147
|
+
aria-controls={context.open ? context.ariaId : undefined}
|
|
146
148
|
readOnly={readOnly}
|
|
147
149
|
className={cl(
|
|
148
150
|
"aksel-date__field-input",
|
|
@@ -152,23 +154,22 @@ const DateInput = forwardRef<HTMLInputElement, DateInputProps>((props, ref) => {
|
|
|
152
154
|
)}
|
|
153
155
|
size={isDatepickerVariant ? 11 : 14}
|
|
154
156
|
/>
|
|
155
|
-
<
|
|
157
|
+
<Button
|
|
156
158
|
disabled={inputProps.disabled || readOnly}
|
|
157
|
-
tabIndex={readOnly ? -1 :
|
|
158
|
-
onClick={
|
|
159
|
-
context?.onOpen();
|
|
160
|
-
setAnchorRef?.(buttonRef.current);
|
|
161
|
-
}}
|
|
159
|
+
tabIndex={readOnly ? -1 : undefined}
|
|
160
|
+
onClick={context.onOpen}
|
|
162
161
|
type="button"
|
|
163
162
|
className="aksel-date__field-button"
|
|
164
|
-
ref={
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
163
|
+
ref={setAnchorRef}
|
|
164
|
+
icon={<CalendarIcon aria-hidden />}
|
|
165
|
+
// If we have the title on the icon, NVDA will read "close" when focusing
|
|
166
|
+
// the button after closing the popup, even if we wait a tick.
|
|
167
|
+
title={translate(
|
|
168
|
+
conditionalVariables.iconTitle[context.open ? "close" : "open"],
|
|
169
|
+
)}
|
|
170
|
+
variant="secondary"
|
|
171
|
+
size={size}
|
|
172
|
+
/>
|
|
172
173
|
</div>
|
|
173
174
|
<div
|
|
174
175
|
className="aksel-form-field__error"
|
|
@@ -90,12 +90,23 @@ interface UseDatepickerValue {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
export type DateValidationT = {
|
|
93
|
+
/**
|
|
94
|
+
* Whether there are any validation errors.
|
|
95
|
+
* - When `true`, all the other properties will be `false`.
|
|
96
|
+
* - When `false`, at least one of the other properties will be `true`.
|
|
97
|
+
*/
|
|
98
|
+
isValidDate: boolean;
|
|
99
|
+
/** Whether the date is a disabled date */
|
|
93
100
|
isDisabled: boolean;
|
|
101
|
+
/** Whether the date falls on a weekend and `disableWeekends` is true */
|
|
94
102
|
isWeekend: boolean;
|
|
103
|
+
/** Whether the input field is empty */
|
|
95
104
|
isEmpty: boolean;
|
|
105
|
+
/** Whether the entered value cannot be parsed as a date (i.e. wrong format or non-existing date) */
|
|
96
106
|
isInvalid: boolean;
|
|
97
|
-
|
|
107
|
+
/** Whether the date is before `fromDate` */
|
|
98
108
|
isBefore: boolean;
|
|
109
|
+
/** Whether the date is after `toDate` */
|
|
99
110
|
isAfter: boolean;
|
|
100
111
|
};
|
|
101
112
|
|
|
@@ -237,7 +248,9 @@ export const useDatepicker = (
|
|
|
237
248
|
|
|
238
249
|
if (day && !selected) {
|
|
239
250
|
handleOpen(false);
|
|
240
|
-
|
|
251
|
+
// We use sync:false so that when Modal is used (see Date.Dialog.tsx), it is closed before
|
|
252
|
+
// we try to focus the open button (since native modal dialogs don't allow focus outside).
|
|
253
|
+
focusElement(anchorRef, { sync: false, preventScroll: true });
|
|
241
254
|
}
|
|
242
255
|
|
|
243
256
|
if (selected) {
|
|
@@ -315,10 +328,7 @@ export const useDatepicker = (
|
|
|
315
328
|
open,
|
|
316
329
|
onClose: () => {
|
|
317
330
|
handleOpen(false);
|
|
318
|
-
|
|
319
|
-
queueMicrotask(() =>
|
|
320
|
-
focusElement(anchorRef, { sync: false, preventScroll: true }),
|
|
321
|
-
);
|
|
331
|
+
focusElement(anchorRef, { sync: false, preventScroll: true });
|
|
322
332
|
},
|
|
323
333
|
onOpenToggle: () => handleOpen(!open),
|
|
324
334
|
disabled,
|
|
@@ -74,11 +74,21 @@ interface UseMonthPickerValue {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
export type MonthValidationT = {
|
|
77
|
+
/**
|
|
78
|
+
* Whether there are any validation errors.
|
|
79
|
+
* - When `true`, all the other properties will be `false`.
|
|
80
|
+
* - When `false`, at least one of the other properties will be `true`.
|
|
81
|
+
*/
|
|
82
|
+
isValidMonth: boolean;
|
|
83
|
+
/** Whether the month is a disabled month */
|
|
77
84
|
isDisabled: boolean;
|
|
85
|
+
/** Whether the input field is empty */
|
|
78
86
|
isEmpty: boolean;
|
|
87
|
+
/** Whether the entered value cannot be parsed as a month (i.e. wrong format) */
|
|
79
88
|
isInvalid: boolean;
|
|
80
|
-
|
|
89
|
+
/** Whether the month is before `fromDate` */
|
|
81
90
|
isBefore: boolean;
|
|
91
|
+
/** Whether the month is after `toDate` */
|
|
82
92
|
isAfter: boolean;
|
|
83
93
|
};
|
|
84
94
|
|
|
@@ -311,10 +321,9 @@ export const useMonthpicker = (
|
|
|
311
321
|
onOpenToggle: () => handleOpen(!open),
|
|
312
322
|
onClose: () => {
|
|
313
323
|
handleOpen(false);
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
);
|
|
324
|
+
// We use sync:false so that when Modal is used (see Date.Dialog.tsx), it is closed before
|
|
325
|
+
// we try to focus the open button (since native modal dialogs don't allow focus outside).
|
|
326
|
+
focusElement(anchorRef, { sync: false, preventScroll: true });
|
|
318
327
|
},
|
|
319
328
|
disabled,
|
|
320
329
|
};
|
|
@@ -81,7 +81,7 @@ export const CheckboxGroup = forwardRef<
|
|
|
81
81
|
"aksel-checkbox-group",
|
|
82
82
|
`aksel-checkbox-group--${rest.size ?? fieldset?.size ?? "medium"}`,
|
|
83
83
|
)}
|
|
84
|
-
|
|
84
|
+
_fieldsSupportNativeReadOnly={false}
|
|
85
85
|
>
|
|
86
86
|
<CheckboxGroupContext.Provider
|
|
87
87
|
value={{
|
|
@@ -10,25 +10,45 @@ import { useFieldset } from "./useFieldset";
|
|
|
10
10
|
export interface FieldsetProps
|
|
11
11
|
extends FormFieldProps, FieldsetHTMLAttributes<HTMLFieldSetElement> {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Form fields in Fieldset.
|
|
14
14
|
*/
|
|
15
15
|
children: React.ReactNode;
|
|
16
16
|
/**
|
|
17
|
-
* Fieldset legend
|
|
17
|
+
* Fieldset legend.
|
|
18
18
|
*/
|
|
19
19
|
legend: React.ReactNode;
|
|
20
20
|
/**
|
|
21
|
-
* If enabled shows the legend and description for
|
|
21
|
+
* If enabled, shows the legend and description for screen readers only.
|
|
22
22
|
*/
|
|
23
23
|
hideLegend?: boolean;
|
|
24
24
|
/**
|
|
25
|
-
* Toggles error propagation to child-elements
|
|
25
|
+
* Toggles error propagation to child-elements.
|
|
26
26
|
* @default true
|
|
27
27
|
*/
|
|
28
28
|
errorPropagation?: boolean;
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
_fieldsSupportNativeReadOnly?: boolean;
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Component for grouping form fields.
|
|
37
|
+
*
|
|
38
|
+
* **NB: Only for special use cases.** Form fields should not be grouped by default,
|
|
39
|
+
* except for checkboxes and radio buttons, for which CheckboxGroup/RadioGroup should be used instead.
|
|
40
|
+
*
|
|
41
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/fieldset)
|
|
42
|
+
* @see 🏷️ {@link FieldsetProps}
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```jsx
|
|
46
|
+
* <Fieldset legend="Telefonnummer">
|
|
47
|
+
* <TextField label="Landkode" />
|
|
48
|
+
* <TextField label="Nummer" />
|
|
49
|
+
* </Fieldset>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
32
52
|
export const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(
|
|
33
53
|
(props, ref) => {
|
|
34
54
|
const legendId = useId();
|
|
@@ -51,7 +71,7 @@ export const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(
|
|
|
51
71
|
legend,
|
|
52
72
|
description,
|
|
53
73
|
hideLegend,
|
|
54
|
-
|
|
74
|
+
_fieldsSupportNativeReadOnly = true,
|
|
55
75
|
...rest
|
|
56
76
|
} = props;
|
|
57
77
|
|
|
@@ -93,7 +113,11 @@ export const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(
|
|
|
93
113
|
})}
|
|
94
114
|
>
|
|
95
115
|
{readOnly &&
|
|
96
|
-
(
|
|
116
|
+
(_fieldsSupportNativeReadOnly ? (
|
|
117
|
+
<ReadOnlyIcon />
|
|
118
|
+
) : (
|
|
119
|
+
<ReadOnlyIconWithTitle />
|
|
120
|
+
))}
|
|
97
121
|
{legend}
|
|
98
122
|
</Label>
|
|
99
123
|
{!!description && (
|
|
@@ -84,7 +84,7 @@ export const RadioGroup = forwardRef<HTMLFieldSetElement, RadioGroupProps>(
|
|
|
84
84
|
"aksel-radio-group",
|
|
85
85
|
`aksel-radio-group--${rest.size ?? fieldset?.size ?? "medium"}`,
|
|
86
86
|
)}
|
|
87
|
-
|
|
87
|
+
_fieldsSupportNativeReadOnly={false}
|
|
88
88
|
>
|
|
89
89
|
<RadioGroupContext.Provider
|
|
90
90
|
value={{
|
package/src/index.ts
CHANGED
|
@@ -7,18 +7,27 @@ export interface InternalHeaderButtonProps extends React.ButtonHTMLAttributes<HT
|
|
|
7
7
|
* Application Button
|
|
8
8
|
*/
|
|
9
9
|
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Active state for element.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
isActive?: boolean;
|
|
10
15
|
}
|
|
11
16
|
export const InternalHeaderButton: OverridableComponent<
|
|
12
17
|
InternalHeaderButtonProps,
|
|
13
18
|
HTMLButtonElement
|
|
14
|
-
> = forwardRef(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
19
|
+
> = forwardRef(
|
|
20
|
+
({ as: Component = "button", className, isActive = false, ...rest }, ref) => {
|
|
21
|
+
return (
|
|
22
|
+
<Component
|
|
23
|
+
aria-current={isActive || undefined}
|
|
24
|
+
{...rest}
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={cl("aksel-internalheader__button", className)}
|
|
27
|
+
data-active={isActive}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
);
|
|
23
32
|
|
|
24
33
|
export default InternalHeaderButton;
|
|
@@ -43,6 +43,16 @@ export interface ReadMoreProps extends React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
43
43
|
* @private
|
|
44
44
|
*/
|
|
45
45
|
"data-color"?: Exclude<AkselColor, AkselStatusColorRole>;
|
|
46
|
+
/**
|
|
47
|
+
* Changes variant of ReadMore.
|
|
48
|
+
*
|
|
49
|
+
* `moderate` is a more visually prominent variant.
|
|
50
|
+
*
|
|
51
|
+
*
|
|
52
|
+
* `ghost` is more subtle, mainly for use in forms.
|
|
53
|
+
* @default "ghost"
|
|
54
|
+
*/
|
|
55
|
+
variant?: "moderate" | "ghost";
|
|
46
56
|
}
|
|
47
57
|
|
|
48
58
|
/**
|
|
@@ -66,6 +76,7 @@ export const ReadMore = forwardRef<HTMLButtonElement, ReadMoreProps>(
|
|
|
66
76
|
onClick,
|
|
67
77
|
size = "medium",
|
|
68
78
|
onOpenChange,
|
|
79
|
+
variant = "ghost",
|
|
69
80
|
...rest
|
|
70
81
|
}: ReadMoreProps,
|
|
71
82
|
ref,
|
|
@@ -80,13 +91,9 @@ export const ReadMore = forwardRef<HTMLButtonElement, ReadMoreProps>(
|
|
|
80
91
|
|
|
81
92
|
return (
|
|
82
93
|
<div
|
|
83
|
-
className={cl(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
className,
|
|
87
|
-
{ "aksel-read-more--open": _open },
|
|
88
|
-
)}
|
|
89
|
-
data-volume="low"
|
|
94
|
+
className={cl("aksel-read-more", `aksel-read-more--${size}`, className)}
|
|
95
|
+
data-variant={variant}
|
|
96
|
+
data-state={_open ? "open" : "closed"}
|
|
90
97
|
>
|
|
91
98
|
<button
|
|
92
99
|
{...rest}
|
|
@@ -97,7 +104,6 @@ export const ReadMore = forwardRef<HTMLButtonElement, ReadMoreProps>(
|
|
|
97
104
|
})}
|
|
98
105
|
onClick={composeEventHandlers(onClick, () => _setOpen((x) => !x))}
|
|
99
106
|
aria-expanded={_open}
|
|
100
|
-
data-state={_open ? "open" : "closed"}
|
|
101
107
|
>
|
|
102
108
|
<ChevronDownIcon
|
|
103
109
|
className="aksel-read-more__expand-icon"
|
|
@@ -106,14 +112,7 @@ export const ReadMore = forwardRef<HTMLButtonElement, ReadMoreProps>(
|
|
|
106
112
|
<span>{header}</span>
|
|
107
113
|
</button>
|
|
108
114
|
|
|
109
|
-
<BodyLong
|
|
110
|
-
as="div"
|
|
111
|
-
className={cl("aksel-read-more__content", {
|
|
112
|
-
"aksel-read-more__content--closed": !_open,
|
|
113
|
-
})}
|
|
114
|
-
size={typoSize}
|
|
115
|
-
data-state={_open ? "open" : "closed"}
|
|
116
|
-
>
|
|
115
|
+
<BodyLong as="div" className="aksel-read-more__content" size={typoSize}>
|
|
117
116
|
{children}
|
|
118
117
|
</BodyLong>
|
|
119
118
|
</div>
|
package/src/types/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { AkselColor, CustomAkselColor } from "./theme";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { Label } from "../../../../typography";
|
|
2
3
|
import { useId } from "../../../../utils-external";
|
|
3
4
|
|
|
4
5
|
interface ListboxGroupProps {
|
|
@@ -15,9 +16,15 @@ function ListboxGroup({ label, children }: ListboxGroupProps) {
|
|
|
15
16
|
className="aksel-listbox__group"
|
|
16
17
|
aria-labelledby={labelId}
|
|
17
18
|
>
|
|
18
|
-
<
|
|
19
|
+
<Label
|
|
20
|
+
as="div"
|
|
21
|
+
size="small"
|
|
22
|
+
id={labelId}
|
|
23
|
+
aria-hidden
|
|
24
|
+
className="aksel-listbox__group-label"
|
|
25
|
+
>
|
|
19
26
|
{label}
|
|
20
|
-
</
|
|
27
|
+
</Label>
|
|
21
28
|
{children}
|
|
22
29
|
</div>
|
|
23
30
|
);
|