@navikt/ds-react 8.6.0 → 8.8.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/DataDragAndDropDragHandler.d.ts +21 -0
- package/cjs/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.js +24 -0
- package/cjs/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.js.map +1 -0
- package/cjs/data/drag-and-drop/item/DataDragAndDropItem.d.ts +27 -0
- package/cjs/data/drag-and-drop/item/DataDragAndDropItem.js +41 -0
- package/cjs/data/drag-and-drop/item/DataDragAndDropItem.js.map +1 -0
- package/cjs/data/drag-and-drop/root/DataDragAndDrop.context.d.ts +8 -0
- package/cjs/data/drag-and-drop/root/DataDragAndDrop.context.js +10 -0
- package/cjs/data/drag-and-drop/root/DataDragAndDrop.context.js.map +1 -0
- package/cjs/data/drag-and-drop/root/DataDragAndDropRoot.d.ts +34 -0
- package/cjs/data/drag-and-drop/root/DataDragAndDropRoot.js +61 -0
- package/cjs/data/drag-and-drop/root/DataDragAndDropRoot.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-old/item/DataDragAndDropItem.d.ts +27 -0
- package/cjs/data/drag-and-drop-old/item/DataDragAndDropItem.js +86 -0
- package/cjs/data/drag-and-drop-old/item/DataDragAndDropItem.js.map +1 -0
- package/cjs/data/drag-and-drop-old/root/DataDragAndDrop.context.d.ts +5 -0
- package/cjs/data/drag-and-drop-old/root/DataDragAndDrop.context.js +6 -0
- package/cjs/data/drag-and-drop-old/root/DataDragAndDrop.context.js.map +1 -0
- package/cjs/data/drag-and-drop-old/root/DataDragAndDropRoot.d.ts +24 -0
- package/cjs/data/drag-and-drop-old/root/DataDragAndDropRoot.js +108 -0
- 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/table-focus.js +7 -1
- package/cjs/data/table/helpers/table-focus.js.map +1 -1
- package/cjs/data/table/helpers/table-keyboard.js +1 -1
- package/cjs/data/table/helpers/table-keyboard.js.map +1 -1
- 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 +99 -0
- package/cjs/data/table/root/DataTableAuto.js.map +1 -0
- package/cjs/data/table/root/DataTableRoot.context.d.ts +9 -0
- package/cjs/data/table/root/DataTableRoot.context.js +11 -0
- package/cjs/data/table/root/DataTableRoot.context.js.map +1 -0
- package/cjs/data/table/root/DataTableRoot.d.ts +30 -3
- package/cjs/data/table/root/DataTableRoot.js +12 -4
- package/cjs/data/table/root/DataTableRoot.js.map +1 -1
- package/cjs/data/table/root/useTableKeyboardNav.js +1 -0
- package/cjs/data/table/root/useTableKeyboardNav.js.map +1 -1
- package/cjs/data/table/root/useTableSelection.d.ts +55 -0
- package/cjs/data/table/root/useTableSelection.js +79 -0
- package/cjs/data/table/root/useTableSelection.js.map +1 -0
- 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 +27 -5
- package/cjs/data/table/th/DataTableTh.js +49 -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 +10 -2
- package/cjs/data/table/tr/DataTableTr.js.map +1 -1
- package/cjs/data/token-filter/AutoSuggest.d.ts +6 -2
- package/cjs/data/token-filter/AutoSuggest.js +44 -11
- package/cjs/data/token-filter/AutoSuggest.js.map +1 -1
- package/cjs/data/token-filter/TokenFilter.d.ts +5 -5
- package/cjs/data/token-filter/TokenFilter.js +105 -42
- package/cjs/data/token-filter/TokenFilter.js.map +1 -1
- package/cjs/data/token-filter/TokenFilter.types.d.ts +51 -33
- package/cjs/data/token-filter/helpers/generate-autocomplete-options.d.ts +2 -3
- package/cjs/data/token-filter/helpers/generate-autocomplete-options.js +11 -15
- package/cjs/data/token-filter/helpers/generate-autocomplete-options.js.map +1 -1
- package/cjs/data/token-filter/helpers/operators.d.ts +6 -6
- package/cjs/data/token-filter/helpers/operators.js +3 -4
- package/cjs/data/token-filter/helpers/operators.js.map +1 -1
- package/cjs/data/token-filter/helpers/parse-query-text.d.ts +2 -20
- package/cjs/data/token-filter/helpers/parse-query-text.js +1 -1
- package/cjs/data/token-filter/helpers/parse-query-text.js.map +1 -1
- package/cjs/data/token-filter/helpers/query-builder.d.ts +2 -2
- package/cjs/data/token-filter/helpers/query-builder.js.map +1 -1
- package/cjs/date/Date.Dialog.d.ts +5 -1
- package/cjs/date/Date.Dialog.js +6 -2
- package/cjs/date/Date.Dialog.js.map +1 -1
- package/cjs/date/Date.Input.js +1 -1
- package/cjs/date/Date.Input.js.map +1 -1
- package/cjs/date/datepicker/DatePicker.js +3 -2
- package/cjs/date/datepicker/DatePicker.js.map +1 -1
- package/cjs/date/datepicker/hooks/useDatepicker.d.ts +12 -1
- package/cjs/date/datepicker/hooks/useDatepicker.js +5 -2
- package/cjs/date/datepicker/hooks/useDatepicker.js.map +1 -1
- package/cjs/date/datepicker/hooks/useRangeDatepicker.js +3 -1
- package/cjs/date/datepicker/hooks/useRangeDatepicker.js.map +1 -1
- package/cjs/date/datepicker/parts/DatePicker.Months.d.ts +2 -1
- package/cjs/date/datepicker/parts/DatePicker.Months.js +3 -3
- package/cjs/date/datepicker/parts/DatePicker.Months.js.map +1 -1
- package/cjs/date/datepicker/parts/DatePicker.RDP.d.ts +5 -1
- package/cjs/date/datepicker/parts/DatePicker.RDP.js +2 -2
- package/cjs/date/datepicker/parts/DatePicker.RDP.js.map +1 -1
- package/cjs/date/monthpicker/MonthPicker.js +3 -2
- package/cjs/date/monthpicker/MonthPicker.js.map +1 -1
- package/cjs/date/monthpicker/hooks/useMonthPicker.d.ts +11 -1
- package/cjs/date/monthpicker/hooks/useMonthPicker.js +3 -1
- package/cjs/date/monthpicker/hooks/useMonthPicker.js.map +1 -1
- package/cjs/date/monthpicker/parts/MonthPicker.Caption.d.ts +4 -1
- package/cjs/date/monthpicker/parts/MonthPicker.Caption.js +3 -2
- package/cjs/date/monthpicker/parts/MonthPicker.Caption.js.map +1 -1
- package/cjs/dropdown/Toggle.js +5 -12
- package/cjs/dropdown/Toggle.js.map +1 -1
- package/cjs/form/checkbox/CheckboxGroup.js +1 -1
- package/cjs/form/checkbox/CheckboxGroup.js.map +1 -1
- package/cjs/form/combobox/Input/Input.js +1 -1
- package/cjs/form/combobox/Input/Input.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/inline-message/root/InlineMessage.js +2 -2
- package/cjs/inline-message/root/InlineMessage.js.map +1 -1
- package/cjs/provider/Provider.d.ts +2 -2
- 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/tooltip/Tooltip.js +1 -3
- package/cjs/tooltip/Tooltip.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/HighlightText/HighlightText.d.ts +8 -0
- package/cjs/utils/components/HighlightText/HighlightText.js +27 -0
- package/cjs/utils/components/HighlightText/HighlightText.js.map +1 -0
- package/cjs/utils/components/Listbox/group/ListboxGroup.d.ts +7 -0
- package/cjs/utils/components/Listbox/group/ListboxGroup.js +15 -0
- package/cjs/utils/components/Listbox/group/ListboxGroup.js.map +1 -0
- package/cjs/utils/components/Listbox/input-slot/ListboxInputSlot.d.ts +7 -0
- package/cjs/utils/components/Listbox/input-slot/ListboxInputSlot.js +15 -0
- package/cjs/utils/components/Listbox/input-slot/ListboxInputSlot.js.map +1 -0
- package/cjs/utils/components/Listbox/option/ListboxOption.d.ts +24 -0
- package/cjs/utils/components/Listbox/option/ListboxOption.js +33 -0
- 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/options/ListboxOptions.js +32 -0
- package/cjs/utils/components/Listbox/options/ListboxOptions.js.map +1 -0
- package/cjs/utils/components/Listbox/root/ListboxRoot.d.ts +20 -0
- package/cjs/utils/components/Listbox/root/ListboxRoot.js +84 -0
- package/cjs/utils/components/Listbox/root/ListboxRoot.js.map +1 -0
- package/cjs/utils/components/Listbox/root/domHelpers.d.ts +3 -0
- package/cjs/utils/components/Listbox/root/domHelpers.js +53 -0
- package/cjs/utils/components/Listbox/root/domHelpers.js.map +1 -0
- 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 +9 -64
- 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 +16 -0
- package/cjs/utils/helpers/focus.js +63 -0
- package/cjs/utils/helpers/focus.js.map +1 -0
- 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/useDeferredValue.d.ts +1 -0
- package/cjs/utils/hooks/useDeferredValue.js +14 -0
- package/cjs/utils/hooks/useDeferredValue.js.map +1 -0
- 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/DataDragAndDropDragHandler.d.ts +21 -0
- package/esm/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.js +18 -0
- package/esm/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.js.map +1 -0
- package/esm/data/drag-and-drop/item/DataDragAndDropItem.d.ts +27 -0
- package/esm/data/drag-and-drop/item/DataDragAndDropItem.js +35 -0
- package/esm/data/drag-and-drop/item/DataDragAndDropItem.js.map +1 -0
- package/esm/data/drag-and-drop/root/DataDragAndDrop.context.d.ts +8 -0
- package/esm/data/drag-and-drop/root/DataDragAndDrop.context.js +6 -0
- package/esm/data/drag-and-drop/root/DataDragAndDrop.context.js.map +1 -0
- package/esm/data/drag-and-drop/root/DataDragAndDropRoot.d.ts +34 -0
- package/esm/data/drag-and-drop/root/DataDragAndDropRoot.js +21 -0
- package/esm/data/drag-and-drop/root/DataDragAndDropRoot.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-old/item/DataDragAndDropItem.d.ts +27 -0
- package/esm/data/drag-and-drop-old/item/DataDragAndDropItem.js +50 -0
- package/esm/data/drag-and-drop-old/item/DataDragAndDropItem.js.map +1 -0
- package/esm/data/drag-and-drop-old/root/DataDragAndDrop.context.d.ts +5 -0
- package/esm/data/drag-and-drop-old/root/DataDragAndDrop.context.js +3 -0
- package/esm/data/drag-and-drop-old/root/DataDragAndDrop.context.js.map +1 -0
- package/esm/data/drag-and-drop-old/root/DataDragAndDropRoot.d.ts +24 -0
- package/esm/data/drag-and-drop-old/root/DataDragAndDropRoot.js +68 -0
- 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/table-focus.js +7 -1
- package/esm/data/table/helpers/table-focus.js.map +1 -1
- package/esm/data/table/helpers/table-keyboard.js +1 -1
- package/esm/data/table/helpers/table-keyboard.js.map +1 -1
- 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 +63 -0
- package/esm/data/table/root/DataTableAuto.js.map +1 -0
- package/esm/data/table/root/DataTableRoot.context.d.ts +9 -0
- package/esm/data/table/root/DataTableRoot.context.js +7 -0
- package/esm/data/table/root/DataTableRoot.context.js.map +1 -0
- package/esm/data/table/root/DataTableRoot.d.ts +30 -3
- package/esm/data/table/root/DataTableRoot.js +10 -4
- package/esm/data/table/root/DataTableRoot.js.map +1 -1
- package/esm/data/table/root/useTableKeyboardNav.js +1 -0
- package/esm/data/table/root/useTableKeyboardNav.js.map +1 -1
- package/esm/data/table/root/useTableSelection.d.ts +55 -0
- package/esm/data/table/root/useTableSelection.js +77 -0
- package/esm/data/table/root/useTableSelection.js.map +1 -0
- 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 +27 -5
- package/esm/data/table/th/DataTableTh.js +51 -24
- 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 +10 -2
- package/esm/data/table/tr/DataTableTr.js.map +1 -1
- package/esm/data/token-filter/AutoSuggest.d.ts +6 -2
- package/esm/data/token-filter/AutoSuggest.js +43 -13
- package/esm/data/token-filter/AutoSuggest.js.map +1 -1
- package/esm/data/token-filter/TokenFilter.d.ts +5 -5
- package/esm/data/token-filter/TokenFilter.js +105 -42
- package/esm/data/token-filter/TokenFilter.js.map +1 -1
- package/esm/data/token-filter/TokenFilter.types.d.ts +51 -33
- package/esm/data/token-filter/helpers/generate-autocomplete-options.d.ts +2 -3
- package/esm/data/token-filter/helpers/generate-autocomplete-options.js +11 -15
- package/esm/data/token-filter/helpers/generate-autocomplete-options.js.map +1 -1
- package/esm/data/token-filter/helpers/operators.d.ts +6 -6
- package/esm/data/token-filter/helpers/operators.js +3 -4
- package/esm/data/token-filter/helpers/operators.js.map +1 -1
- package/esm/data/token-filter/helpers/parse-query-text.d.ts +2 -20
- package/esm/data/token-filter/helpers/parse-query-text.js +1 -1
- package/esm/data/token-filter/helpers/parse-query-text.js.map +1 -1
- package/esm/data/token-filter/helpers/query-builder.d.ts +2 -2
- package/esm/data/token-filter/helpers/query-builder.js.map +1 -1
- package/esm/date/Date.Dialog.d.ts +5 -1
- package/esm/date/Date.Dialog.js +6 -2
- package/esm/date/Date.Dialog.js.map +1 -1
- package/esm/date/Date.Input.js +1 -1
- package/esm/date/Date.Input.js.map +1 -1
- package/esm/date/datepicker/DatePicker.js +3 -2
- package/esm/date/datepicker/DatePicker.js.map +1 -1
- package/esm/date/datepicker/hooks/useDatepicker.d.ts +12 -1
- package/esm/date/datepicker/hooks/useDatepicker.js +5 -2
- package/esm/date/datepicker/hooks/useDatepicker.js.map +1 -1
- package/esm/date/datepicker/hooks/useRangeDatepicker.js +3 -1
- package/esm/date/datepicker/hooks/useRangeDatepicker.js.map +1 -1
- package/esm/date/datepicker/parts/DatePicker.Months.d.ts +2 -1
- package/esm/date/datepicker/parts/DatePicker.Months.js +3 -3
- package/esm/date/datepicker/parts/DatePicker.Months.js.map +1 -1
- package/esm/date/datepicker/parts/DatePicker.RDP.d.ts +5 -1
- package/esm/date/datepicker/parts/DatePicker.RDP.js +2 -2
- package/esm/date/datepicker/parts/DatePicker.RDP.js.map +1 -1
- package/esm/date/monthpicker/MonthPicker.js +3 -2
- package/esm/date/monthpicker/MonthPicker.js.map +1 -1
- package/esm/date/monthpicker/hooks/useMonthPicker.d.ts +11 -1
- package/esm/date/monthpicker/hooks/useMonthPicker.js +3 -1
- package/esm/date/monthpicker/hooks/useMonthPicker.js.map +1 -1
- package/esm/date/monthpicker/parts/MonthPicker.Caption.d.ts +4 -1
- package/esm/date/monthpicker/parts/MonthPicker.Caption.js +3 -2
- package/esm/date/monthpicker/parts/MonthPicker.Caption.js.map +1 -1
- package/esm/dropdown/Toggle.js +5 -12
- package/esm/dropdown/Toggle.js.map +1 -1
- package/esm/form/checkbox/CheckboxGroup.js +1 -1
- package/esm/form/checkbox/CheckboxGroup.js.map +1 -1
- package/esm/form/combobox/Input/Input.js +1 -1
- package/esm/form/combobox/Input/Input.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/inline-message/root/InlineMessage.js +3 -3
- package/esm/inline-message/root/InlineMessage.js.map +1 -1
- package/esm/provider/Provider.d.ts +2 -2
- 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/tooltip/Tooltip.js +1 -3
- package/esm/tooltip/Tooltip.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/HighlightText/HighlightText.d.ts +8 -0
- package/esm/utils/components/HighlightText/HighlightText.js +21 -0
- package/esm/utils/components/HighlightText/HighlightText.js.map +1 -0
- package/esm/utils/components/Listbox/group/ListboxGroup.d.ts +7 -0
- package/esm/utils/components/Listbox/group/ListboxGroup.js +10 -0
- package/esm/utils/components/Listbox/group/ListboxGroup.js.map +1 -0
- package/esm/utils/components/Listbox/input-slot/ListboxInputSlot.d.ts +7 -0
- package/esm/utils/components/Listbox/input-slot/ListboxInputSlot.js +9 -0
- package/esm/utils/components/Listbox/input-slot/ListboxInputSlot.js.map +1 -0
- package/esm/utils/components/Listbox/option/ListboxOption.d.ts +24 -0
- package/esm/utils/components/Listbox/option/ListboxOption.js +27 -0
- 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/options/ListboxOptions.js +27 -0
- package/esm/utils/components/Listbox/options/ListboxOptions.js.map +1 -0
- package/esm/utils/components/Listbox/root/ListboxRoot.d.ts +20 -0
- package/esm/utils/components/Listbox/root/ListboxRoot.js +79 -0
- package/esm/utils/components/Listbox/root/ListboxRoot.js.map +1 -0
- package/esm/utils/components/Listbox/root/domHelpers.d.ts +3 -0
- package/esm/utils/components/Listbox/root/domHelpers.js +50 -0
- package/esm/utils/components/Listbox/root/domHelpers.js.map +1 -0
- 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 +9 -64
- 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 +16 -0
- package/esm/utils/helpers/focus.js +60 -0
- package/esm/utils/helpers/focus.js.map +1 -0
- 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/useDeferredValue.d.ts +1 -0
- package/esm/utils/hooks/useDeferredValue.js +7 -0
- package/esm/utils/hooks/useDeferredValue.js.map +1 -0
- package/esm/utils/hooks/useScrollLock.js +41 -11
- package/esm/utils/hooks/useScrollLock.js.map +1 -1
- package/package.json +9 -9
- 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/DataDragAndDropDragHandler.tsx +63 -0
- package/src/data/drag-and-drop/item/DataDragAndDropItem.tsx +54 -0
- package/src/data/drag-and-drop/root/DataDragAndDrop.context.tsx +14 -0
- package/src/data/drag-and-drop/root/DataDragAndDropRoot.tsx +54 -0
- package/src/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.tsx +104 -0
- package/src/data/drag-and-drop-old/item/DataDragAndDropItem.tsx +74 -0
- package/src/data/drag-and-drop-old/root/DataDragAndDrop.context.tsx +11 -0
- package/src/data/drag-and-drop-old/root/DataDragAndDropRoot.tsx +96 -0
- package/src/data/table/empty-state/DataTableEmptyState.tsx +26 -0
- package/src/data/table/helpers/table-focus.ts +10 -1
- package/src/data/table/helpers/table-keyboard.ts +1 -1
- 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 +182 -0
- package/src/data/table/root/DataTableRoot.context.ts +14 -0
- package/src/data/table/root/DataTableRoot.tsx +60 -14
- package/src/data/table/root/useTableKeyboardNav.ts +1 -0
- package/src/data/table/root/useTableSelection.ts +126 -0
- package/src/data/table/td/DataTableTd.tsx +14 -1
- package/src/data/table/th/DataTableTh.tsx +133 -65
- 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 +18 -2
- package/src/data/token-filter/AutoSuggest.tsx +141 -29
- package/src/data/token-filter/TokenFilter.tsx +174 -79
- package/src/data/token-filter/TokenFilter.types.ts +70 -42
- package/src/data/token-filter/helpers/generate-autocomplete-options.test.ts +97 -97
- package/src/data/token-filter/helpers/generate-autocomplete-options.ts +31 -38
- package/src/data/token-filter/helpers/operators.test.ts +29 -29
- package/src/data/token-filter/helpers/operators.ts +16 -16
- package/src/data/token-filter/helpers/parse-query-text.test.ts +37 -35
- package/src/data/token-filter/helpers/parse-query-text.ts +7 -26
- package/src/data/token-filter/helpers/query-builder.ts +2 -2
- package/src/date/Date.Dialog.tsx +15 -0
- package/src/date/Date.Input.tsx +1 -1
- package/src/date/datepicker/DatePicker.tsx +3 -0
- package/src/date/datepicker/hooks/useDatepicker.tsx +19 -3
- package/src/date/datepicker/hooks/useRangeDatepicker.tsx +5 -1
- package/src/date/datepicker/parts/DatePicker.Months.tsx +9 -1
- package/src/date/datepicker/parts/DatePicker.RDP.tsx +7 -1
- package/src/date/monthpicker/MonthPicker.tsx +3 -1
- package/src/date/monthpicker/hooks/useMonthPicker.tsx +16 -2
- package/src/date/monthpicker/parts/MonthPicker.Caption.tsx +20 -2
- package/src/dropdown/Toggle.tsx +6 -12
- package/src/form/checkbox/CheckboxGroup.tsx +1 -1
- package/src/form/combobox/Input/Input.tsx +2 -2
- package/src/form/fieldset/Fieldset.tsx +31 -7
- package/src/form/radio/RadioGroup.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/inline-message/root/InlineMessage.tsx +5 -5
- package/src/provider/Provider.tsx +2 -2
- package/src/read-more/ReadMore.tsx +15 -16
- package/src/tooltip/Tooltip.tsx +1 -3
- package/src/types/index.ts +1 -1
- package/src/utils/components/HighlightText/HighlightText.tsx +34 -0
- package/src/utils/components/Listbox/group/ListboxGroup.tsx +26 -0
- package/src/utils/components/Listbox/input-slot/ListboxInputSlot.tsx +22 -0
- package/src/utils/components/Listbox/option/ListboxOption.tsx +57 -0
- package/src/utils/components/Listbox/options/ListboxOptions.tsx +38 -0
- package/src/utils/components/Listbox/root/ListboxRoot.tsx +104 -0
- package/src/utils/components/Listbox/root/domHelpers.ts +60 -0
- package/src/utils/components/floating/Floating.tsx +2 -2
- package/src/utils/components/focus-boundary/FocusBoundary.tsx +9 -80
- package/src/utils/components/link-anchor/LinkAnchor.tsx +11 -0
- package/src/utils/helpers/className.ts +1 -1
- package/src/utils/helpers/focus.ts +78 -0
- package/src/utils/helpers/index.ts +9 -9
- package/src/utils/hooks/index.ts +20 -13
- package/src/utils/hooks/useDeferredValue.ts +12 -0
- package/src/utils/hooks/useScrollLock.ts +57 -13
- package/cjs/data/table/th/DataTableThSortHandle.d.ts +0 -6
- package/cjs/data/table/th/DataTableThSortHandle.js +0 -82
- package/cjs/data/table/th/DataTableThSortHandle.js.map +0 -1
- package/esm/data/table/th/DataTableThSortHandle.d.ts +0 -6
- package/esm/data/table/th/DataTableThSortHandle.js +0 -47
- package/esm/data/table/th/DataTableThSortHandle.js.map +0 -1
- package/src/data/table/th/DataTableThSortHandle.tsx +0 -67
package/src/date/Date.Dialog.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { Modal } from "../modal";
|
|
|
5
5
|
import { useModalContext } from "../modal/Modal.context";
|
|
6
6
|
import { Popover } from "../popover";
|
|
7
7
|
import { cl } from "../utils/helpers";
|
|
8
|
+
import { focusElement } from "../utils/helpers/focus";
|
|
8
9
|
import { useMedia } from "../utils/hooks";
|
|
9
10
|
import { useI18n } from "../utils/i18n/i18n.hooks";
|
|
10
11
|
import type { TFunction } from "../utils/i18n/i18n.types";
|
|
@@ -30,6 +31,10 @@ type DateWrapperProps = {
|
|
|
30
31
|
id?: string;
|
|
31
32
|
strategy?: "absolute" | "fixed";
|
|
32
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* Id for the label of the popup, used for aria-labelledby
|
|
36
|
+
*/
|
|
37
|
+
popupLabelId?: string;
|
|
33
38
|
};
|
|
34
39
|
|
|
35
40
|
const DateDialog = ({
|
|
@@ -41,6 +46,7 @@ const DateDialog = ({
|
|
|
41
46
|
translate,
|
|
42
47
|
variant,
|
|
43
48
|
popoverProps,
|
|
49
|
+
popupLabelId,
|
|
44
50
|
}: DateWrapperProps) => {
|
|
45
51
|
const translateGlobal = useI18n("global", getGlobalTranslations(locale));
|
|
46
52
|
|
|
@@ -68,6 +74,10 @@ const DateDialog = ({
|
|
|
68
74
|
"aksel-date": variant === "month",
|
|
69
75
|
})}
|
|
70
76
|
{...popoverProps}
|
|
77
|
+
ref={focusPopoverOnOpen}
|
|
78
|
+
tabIndex={-1}
|
|
79
|
+
role="dialog"
|
|
80
|
+
aria-labelledby={popupLabelId}
|
|
71
81
|
>
|
|
72
82
|
{children}
|
|
73
83
|
</Popover>
|
|
@@ -104,4 +114,9 @@ const DateDialog = ({
|
|
|
104
114
|
</Modal>
|
|
105
115
|
);
|
|
106
116
|
};
|
|
117
|
+
|
|
118
|
+
function focusPopoverOnOpen(element: HTMLDivElement | null) {
|
|
119
|
+
focusElement(element, { preventScroll: true, sync: false });
|
|
120
|
+
}
|
|
121
|
+
|
|
107
122
|
export { DateDialog };
|
package/src/date/Date.Input.tsx
CHANGED
|
@@ -154,7 +154,7 @@ const DateInput = forwardRef<HTMLInputElement, DateInputProps>((props, ref) => {
|
|
|
154
154
|
/>
|
|
155
155
|
<button
|
|
156
156
|
disabled={inputProps.disabled || readOnly}
|
|
157
|
-
tabIndex={readOnly ? -1 :
|
|
157
|
+
tabIndex={readOnly ? -1 : undefined}
|
|
158
158
|
onClick={() => {
|
|
159
159
|
context?.onOpen();
|
|
160
160
|
setAnchorRef?.(buttonRef.current);
|
|
@@ -95,6 +95,7 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
|
95
95
|
);
|
|
96
96
|
|
|
97
97
|
const ariaId = useId(id);
|
|
98
|
+
const popupLabelId = useId();
|
|
98
99
|
|
|
99
100
|
const [open, setOpen] = useControllableState({
|
|
100
101
|
defaultValue: false,
|
|
@@ -161,6 +162,7 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
|
161
162
|
id: ariaId,
|
|
162
163
|
strategy,
|
|
163
164
|
}}
|
|
165
|
+
popupLabelId={popupLabelId}
|
|
164
166
|
>
|
|
165
167
|
<ReactDayPicker
|
|
166
168
|
{...rest}
|
|
@@ -168,6 +170,7 @@ export const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
|
|
|
168
170
|
handleSelect={setValue}
|
|
169
171
|
selected={value as any}
|
|
170
172
|
mode={mode as any}
|
|
173
|
+
popupLabelId={popupLabelId}
|
|
171
174
|
/>
|
|
172
175
|
</DateDialog>
|
|
173
176
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { differenceInCalendarDays, isWeekend } from "date-fns";
|
|
2
2
|
import React, { useCallback, useState } from "react";
|
|
3
3
|
import { DayEventHandler, dateMatchModifiers } from "react-day-picker";
|
|
4
|
+
import { focusElement } from "../../../utils/helpers/focus";
|
|
4
5
|
import { useDateLocale } from "../../../utils/i18n/i18n.hooks";
|
|
5
6
|
import { DateInputProps } from "../../Date.Input";
|
|
6
7
|
import { getLocaleFromString } from "../../Date.locale";
|
|
@@ -89,12 +90,23 @@ interface UseDatepickerValue {
|
|
|
89
90
|
}
|
|
90
91
|
|
|
91
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 */
|
|
92
100
|
isDisabled: boolean;
|
|
101
|
+
/** Whether the date falls on a weekend and `disableWeekends` is true */
|
|
93
102
|
isWeekend: boolean;
|
|
103
|
+
/** Whether the input field is empty */
|
|
94
104
|
isEmpty: boolean;
|
|
105
|
+
/** Whether the entered value cannot be parsed as a date (i.e. wrong format or non-existing date) */
|
|
95
106
|
isInvalid: boolean;
|
|
96
|
-
|
|
107
|
+
/** Whether the date is before `fromDate` */
|
|
97
108
|
isBefore: boolean;
|
|
109
|
+
/** Whether the date is after `toDate` */
|
|
98
110
|
isAfter: boolean;
|
|
99
111
|
};
|
|
100
112
|
|
|
@@ -160,8 +172,9 @@ export const useDatepicker = (
|
|
|
160
172
|
const handleOpen = useCallback(
|
|
161
173
|
(newOpen: boolean) => {
|
|
162
174
|
setOpen(newOpen);
|
|
163
|
-
newOpen
|
|
175
|
+
if (newOpen) {
|
|
164
176
|
setMonth(selectedDay ?? defaultSelected ?? defaultMonth ?? today);
|
|
177
|
+
}
|
|
165
178
|
},
|
|
166
179
|
[defaultMonth, defaultSelected, selectedDay, today],
|
|
167
180
|
);
|
|
@@ -313,7 +326,10 @@ export const useDatepicker = (
|
|
|
313
326
|
open,
|
|
314
327
|
onClose: () => {
|
|
315
328
|
handleOpen(false);
|
|
316
|
-
|
|
329
|
+
/* Delay focus to allow "open"-button to update title before focus */
|
|
330
|
+
queueMicrotask(() =>
|
|
331
|
+
focusElement(anchorRef, { sync: false, preventScroll: true }),
|
|
332
|
+
);
|
|
317
333
|
},
|
|
318
334
|
onOpenToggle: () => handleOpen(!open),
|
|
319
335
|
disabled,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { differenceInCalendarDays, isSameDay, isWeekend } from "date-fns";
|
|
2
2
|
import React, { useState } from "react";
|
|
3
3
|
import { dateMatchModifiers } from "react-day-picker";
|
|
4
|
+
import { focusElement } from "../../../utils/helpers/focus";
|
|
4
5
|
import { useDateLocale } from "../../../utils/i18n/i18n.hooks";
|
|
5
6
|
import { DateInputProps } from "../../Date.Input";
|
|
6
7
|
import { getLocaleFromString } from "../../Date.locale";
|
|
@@ -539,7 +540,10 @@ export const useRangeDatepicker = (
|
|
|
539
540
|
onOpenToggle: () => setOpen((x) => !x),
|
|
540
541
|
onClose: () => {
|
|
541
542
|
setOpen(false);
|
|
542
|
-
|
|
543
|
+
/* Delay focus to allow "open"-button to update title before focus */
|
|
544
|
+
queueMicrotask(() =>
|
|
545
|
+
focusElement(anchorRef, { sync: false, preventScroll: true }),
|
|
546
|
+
);
|
|
543
547
|
},
|
|
544
548
|
disabled,
|
|
545
549
|
disableWeekends,
|
|
@@ -28,12 +28,14 @@ const DatePickerMonths = ({
|
|
|
28
28
|
calendarMonth,
|
|
29
29
|
locale,
|
|
30
30
|
onWeekNumberClick,
|
|
31
|
+
popupLabelId,
|
|
31
32
|
...rest
|
|
32
33
|
}: {
|
|
33
34
|
calendarMonth: CalendarMonth;
|
|
34
35
|
displayIndex: number;
|
|
35
36
|
locale: Locale;
|
|
36
37
|
onWeekNumberClick: MultipleMode["onWeekNumberClick"];
|
|
38
|
+
popupLabelId?: string;
|
|
37
39
|
} & React.HTMLAttributes<HTMLDivElement>) => {
|
|
38
40
|
const { dayPickerProps, goToMonth, previousMonth, nextMonth } =
|
|
39
41
|
useDayPicker();
|
|
@@ -80,7 +82,12 @@ const DatePickerMonths = ({
|
|
|
80
82
|
<div {...omit(rest, ["displayIndex"])}>
|
|
81
83
|
<div className="aksel-date__caption">
|
|
82
84
|
{captionLayout?.startsWith("dropdown") && (
|
|
83
|
-
<span
|
|
85
|
+
<span
|
|
86
|
+
aria-live="polite"
|
|
87
|
+
aria-atomic="true"
|
|
88
|
+
className="aksel-sr-only"
|
|
89
|
+
id={popupLabelId}
|
|
90
|
+
>
|
|
84
91
|
{format(calendarMonth.date, "LLLL y", { locale })}
|
|
85
92
|
</span>
|
|
86
93
|
)}
|
|
@@ -129,6 +136,7 @@ const DatePickerMonths = ({
|
|
|
129
136
|
aria-live="polite"
|
|
130
137
|
role="status"
|
|
131
138
|
className="aksel-date__caption-label"
|
|
139
|
+
id={popupLabelId}
|
|
132
140
|
>
|
|
133
141
|
{format(calendarMonth.date, "LLLL y", { locale })}
|
|
134
142
|
</BodyShort>
|
|
@@ -44,6 +44,10 @@ type ReactDayPickerProps = DatePickerDefaultProps &
|
|
|
44
44
|
* Update selected date
|
|
45
45
|
*/
|
|
46
46
|
handleSelect: (newSelected: any) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Id for the label of the popup, used for aria-labelledby
|
|
49
|
+
*/
|
|
50
|
+
popupLabelId?: string;
|
|
47
51
|
};
|
|
48
52
|
|
|
49
53
|
const ReactDayPicker = ({
|
|
@@ -61,6 +65,7 @@ const ReactDayPicker = ({
|
|
|
61
65
|
mode: _mode,
|
|
62
66
|
handleSelect,
|
|
63
67
|
locale: _locale,
|
|
68
|
+
popupLabelId,
|
|
64
69
|
...rest
|
|
65
70
|
}: ReactDayPickerProps) => {
|
|
66
71
|
const langProviderLocale = useDateLocale();
|
|
@@ -130,9 +135,10 @@ const ReactDayPicker = ({
|
|
|
130
135
|
onWeekNumberClick={
|
|
131
136
|
mode === "multiple" ? onWeekNumberClick : undefined
|
|
132
137
|
}
|
|
138
|
+
popupLabelId={popupLabelId}
|
|
133
139
|
/>
|
|
134
140
|
),
|
|
135
|
-
[locale, mode, onWeekNumberClick],
|
|
141
|
+
[locale, mode, onWeekNumberClick, popupLabelId],
|
|
136
142
|
),
|
|
137
143
|
Day: useCallback(
|
|
138
144
|
(props) => (
|
|
@@ -97,6 +97,7 @@ export const MonthPicker = forwardRef<HTMLDivElement, MonthPickerProps>(
|
|
|
97
97
|
);
|
|
98
98
|
const langProviderLocale = useDateLocale();
|
|
99
99
|
const ariaId = useId(id);
|
|
100
|
+
const popupLabelId = useId();
|
|
100
101
|
|
|
101
102
|
const [open, setOpen] = useControllableState({
|
|
102
103
|
defaultValue: false,
|
|
@@ -163,9 +164,10 @@ export const MonthPicker = forwardRef<HTMLDivElement, MonthPickerProps>(
|
|
|
163
164
|
id: ariaId,
|
|
164
165
|
strategy,
|
|
165
166
|
}}
|
|
167
|
+
popupLabelId={popupLabelId}
|
|
166
168
|
>
|
|
167
169
|
<div className={cl("rdp-month", className)}>
|
|
168
|
-
<MonthPickerCaption />
|
|
170
|
+
<MonthPickerCaption popupLabelId={popupLabelId} />
|
|
169
171
|
<MonthPickerTable />
|
|
170
172
|
</div>
|
|
171
173
|
</DateDialog>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useState } from "react";
|
|
2
2
|
import { dateMatchModifiers } from "react-day-picker";
|
|
3
|
+
import { focusElement } from "../../../utils/helpers/focus";
|
|
3
4
|
import { useDateLocale } from "../../../utils/i18n/i18n.hooks";
|
|
4
5
|
import { DateInputProps } from "../../Date.Input";
|
|
5
6
|
import { getLocaleFromString } from "../../Date.locale";
|
|
@@ -73,11 +74,21 @@ interface UseMonthPickerValue {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
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 */
|
|
76
84
|
isDisabled: boolean;
|
|
85
|
+
/** Whether the input field is empty */
|
|
77
86
|
isEmpty: boolean;
|
|
87
|
+
/** Whether the entered value cannot be parsed as a month (i.e. wrong format) */
|
|
78
88
|
isInvalid: boolean;
|
|
79
|
-
|
|
89
|
+
/** Whether the month is before `fromDate` */
|
|
80
90
|
isBefore: boolean;
|
|
91
|
+
/** Whether the month is after `toDate` */
|
|
81
92
|
isAfter: boolean;
|
|
82
93
|
};
|
|
83
94
|
|
|
@@ -310,7 +321,10 @@ export const useMonthpicker = (
|
|
|
310
321
|
onOpenToggle: () => handleOpen(!open),
|
|
311
322
|
onClose: () => {
|
|
312
323
|
handleOpen(false);
|
|
313
|
-
|
|
324
|
+
/* Delay focus to allow "open"-button to update title before focus */
|
|
325
|
+
queueMicrotask(() =>
|
|
326
|
+
focusElement(anchorRef, { sync: false, preventScroll: true }),
|
|
327
|
+
);
|
|
314
328
|
},
|
|
315
329
|
disabled,
|
|
316
330
|
};
|
|
@@ -13,7 +13,11 @@ import { Select } from "../../../form/select";
|
|
|
13
13
|
import { useDateTranslationContext } from "../../Date.locale";
|
|
14
14
|
import { useMonthPickerContext } from "../MonthPicker.context";
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
type MonthPickerCaptionProps = {
|
|
17
|
+
popupLabelId?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const MonthPickerCaption = ({ popupLabelId }: MonthPickerCaptionProps) => {
|
|
17
21
|
const { fromDate, toDate, locale, year, onYearChange, caption } =
|
|
18
22
|
useMonthPickerContext();
|
|
19
23
|
|
|
@@ -58,6 +62,16 @@ const MonthPickerCaption = () => {
|
|
|
58
62
|
|
|
59
63
|
return (
|
|
60
64
|
<div className="aksel-date__caption">
|
|
65
|
+
{caption === "dropdown" && (
|
|
66
|
+
<span
|
|
67
|
+
aria-live="polite"
|
|
68
|
+
aria-atomic="true"
|
|
69
|
+
className="aksel-sr-only"
|
|
70
|
+
id={popupLabelId}
|
|
71
|
+
>
|
|
72
|
+
{year.getFullYear()}
|
|
73
|
+
</span>
|
|
74
|
+
)}
|
|
61
75
|
<Button
|
|
62
76
|
className="aksel-date__caption-button"
|
|
63
77
|
disabled={disablePreviousYear()}
|
|
@@ -82,7 +96,11 @@ const MonthPickerCaption = () => {
|
|
|
82
96
|
))}
|
|
83
97
|
</Select>
|
|
84
98
|
) : (
|
|
85
|
-
<span
|
|
99
|
+
<span
|
|
100
|
+
className="aksel-date__year-label"
|
|
101
|
+
aria-live="polite"
|
|
102
|
+
id={popupLabelId}
|
|
103
|
+
>
|
|
86
104
|
{year.getFullYear()}
|
|
87
105
|
</span>
|
|
88
106
|
)}
|
package/src/dropdown/Toggle.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef, useContext } from "react";
|
|
2
2
|
import { cl, composeEventHandlers } from "../utils/helpers";
|
|
3
|
+
import { useMergeRefs } from "../utils/hooks";
|
|
3
4
|
import { DropdownContext } from "./context";
|
|
4
5
|
|
|
5
6
|
export interface DropdownToggleProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
@@ -15,30 +16,23 @@ export const DropdownToggle = forwardRef<
|
|
|
15
16
|
>(({ className, onClick, ...rest }, ref) => {
|
|
16
17
|
const context = useContext(DropdownContext);
|
|
17
18
|
|
|
19
|
+
const mergedRef = useMergeRefs(context?.setAnchorEl, ref);
|
|
20
|
+
|
|
18
21
|
if (!context) {
|
|
19
22
|
console.warn("Dropdown.Toggle has to be wrapped in <Dropdown />");
|
|
20
23
|
return null;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
const {
|
|
26
|
+
const { handleToggle, isOpen } = context;
|
|
24
27
|
|
|
25
|
-
const handleClick = (
|
|
26
|
-
setAnchorEl(e.currentTarget);
|
|
28
|
+
const handleClick = () => {
|
|
27
29
|
handleToggle(!isOpen);
|
|
28
30
|
};
|
|
29
31
|
|
|
30
32
|
return (
|
|
31
33
|
<button
|
|
32
34
|
{...rest}
|
|
33
|
-
ref={
|
|
34
|
-
setAnchorEl(el);
|
|
35
|
-
|
|
36
|
-
if (typeof ref === "function") {
|
|
37
|
-
ref(el);
|
|
38
|
-
} else if (ref != null) {
|
|
39
|
-
ref.current = el;
|
|
40
|
-
}
|
|
41
|
-
}}
|
|
35
|
+
ref={mergedRef}
|
|
42
36
|
onClick={composeEventHandlers(onClick, handleClick)}
|
|
43
37
|
aria-expanded={isOpen}
|
|
44
38
|
className={cl("aksel-dropdown__toggle", className)}
|
|
@@ -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={{
|
|
@@ -255,8 +255,8 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
255
255
|
);
|
|
256
256
|
|
|
257
257
|
const onChangeHandler = useCallback(
|
|
258
|
-
(event: React.
|
|
259
|
-
const newValue = event.
|
|
258
|
+
(event: React.InputEvent<HTMLInputElement>) => {
|
|
259
|
+
const newValue = event.currentTarget.value;
|
|
260
260
|
if (newValue && newValue !== "") {
|
|
261
261
|
toggleIsListOpen(true);
|
|
262
262
|
} else if (filteredOptions.length === 0) {
|
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import { useThemeInternal } from "../../theme/Theme";
|
|
3
|
-
import {
|
|
3
|
+
import { BodyLong } from "../../typography";
|
|
4
4
|
import { type OverridableComponent, useId } from "../../utils-external";
|
|
5
5
|
import { cl } from "../../utils/helpers";
|
|
6
6
|
import { useI18n } from "../../utils/i18n/i18n.hooks";
|
|
@@ -64,7 +64,7 @@ export const InlineMessage: OverridableComponent<
|
|
|
64
64
|
const contentId = useId();
|
|
65
65
|
|
|
66
66
|
return (
|
|
67
|
-
<
|
|
67
|
+
<BodyLong
|
|
68
68
|
ref={forwardedRef}
|
|
69
69
|
className={cl("aksel-inline-message", className)}
|
|
70
70
|
data-color={status === "error" ? "danger" : status}
|
|
@@ -75,9 +75,9 @@ export const InlineMessage: OverridableComponent<
|
|
|
75
75
|
>
|
|
76
76
|
<InlineMessageIcon status={status} />
|
|
77
77
|
{status && (
|
|
78
|
-
<
|
|
78
|
+
<BodyLong id={statusId} aria-hidden visuallyHidden>
|
|
79
79
|
{`${translate(status)}: `}
|
|
80
|
-
</
|
|
80
|
+
</BodyLong>
|
|
81
81
|
)}
|
|
82
82
|
{/** biome-ignore lint/a11y/useAriaPropsSupportedByRole: Testing shows that this works. */}
|
|
83
83
|
<span
|
|
@@ -87,7 +87,7 @@ export const InlineMessage: OverridableComponent<
|
|
|
87
87
|
>
|
|
88
88
|
{children}
|
|
89
89
|
</span>
|
|
90
|
-
</
|
|
90
|
+
</BodyLong>
|
|
91
91
|
);
|
|
92
92
|
},
|
|
93
93
|
);
|
|
@@ -3,7 +3,7 @@ import { PartialTranslations, Translations } from "../utils/i18n/i18n.types";
|
|
|
3
3
|
import nb from "../utils/i18n/locales/nb";
|
|
4
4
|
|
|
5
5
|
type ProviderContextType = {
|
|
6
|
-
rootElement?: HTMLElement;
|
|
6
|
+
rootElement?: HTMLElement | null;
|
|
7
7
|
locale: Translations;
|
|
8
8
|
translations?: PartialTranslations | PartialTranslations[];
|
|
9
9
|
};
|
|
@@ -17,7 +17,7 @@ export type ProviderProps = {
|
|
|
17
17
|
/**
|
|
18
18
|
* Global root-element to attach portals to. Used by Tooltip, Modal (optionally) and ActionMenu.
|
|
19
19
|
*/
|
|
20
|
-
rootElement?: HTMLElement;
|
|
20
|
+
rootElement?: HTMLElement | null;
|
|
21
21
|
} & (
|
|
22
22
|
| {
|
|
23
23
|
/**
|
|
@@ -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/tooltip/Tooltip.tsx
CHANGED
|
@@ -237,9 +237,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
|
|
|
237
237
|
<TooltipShortcuts shortcuts={keys} />
|
|
238
238
|
{_arrow && (
|
|
239
239
|
<div
|
|
240
|
-
ref={
|
|
241
|
-
arrowRef.current = node;
|
|
242
|
-
}}
|
|
240
|
+
ref={arrowRef}
|
|
243
241
|
className="aksel-tooltip__arrow"
|
|
244
242
|
style={{
|
|
245
243
|
left: arrowX != null ? `${arrowX}px` : "",
|
package/src/types/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { AkselColor, CustomAkselColor } from "./theme";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
// Før vi ev. eksponerer denne, vurder følgende:
|
|
4
|
+
// - Bør man kunne slå av aria-label? (Ev. kan vi kun sette på aria-label hvis process.env.NODE_ENV === "test")
|
|
5
|
+
// - Navngivning. Bør ikke bruke kun Highlight fordi det er allerede noe som heter det i JS.
|
|
6
|
+
|
|
7
|
+
interface HighlightTextProps {
|
|
8
|
+
/** Text to be highlighted */
|
|
9
|
+
text: string;
|
|
10
|
+
children: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const HighlightText = ({ text, children }: HighlightTextProps) => {
|
|
14
|
+
const textIndex = children
|
|
15
|
+
.toLocaleLowerCase()
|
|
16
|
+
.indexOf(text.toLocaleLowerCase());
|
|
17
|
+
if (textIndex === -1) {
|
|
18
|
+
return children;
|
|
19
|
+
}
|
|
20
|
+
const start = children.substring(0, textIndex);
|
|
21
|
+
const match = children.substring(textIndex, textIndex + text.length);
|
|
22
|
+
const end = children.substring(textIndex + text.length);
|
|
23
|
+
return (
|
|
24
|
+
// aria-label is used to fix testing-library wrongly evaluating the accessible name of the option when highlighting text
|
|
25
|
+
// biome-ignore lint/a11y/useAriaPropsSupportedByRole: Doesn't matter if it doesn't work in the browser
|
|
26
|
+
<span aria-label={children}>
|
|
27
|
+
{start}
|
|
28
|
+
{match && <mark>{match}</mark>}
|
|
29
|
+
{end}
|
|
30
|
+
</span>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { HighlightText };
|