@navikt/ds-react 6.13.0 → 6.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/accordion/AccordionContext.d.ts +0 -1
- package/cjs/collapsible/Collapsible.context.d.ts +0 -1
- package/cjs/date/context/useDateInputContext.d.ts +0 -1
- package/cjs/date/datepicker/parts/HeadRow.d.ts +0 -1
- package/cjs/date/datepicker/parts/HeadRow.js +2 -3
- package/cjs/date/datepicker/parts/HeadRow.js.map +1 -1
- package/cjs/date/datepicker/parts/Row.d.ts +0 -1
- package/cjs/date/datepicker/parts/TableHead.d.ts +0 -1
- package/cjs/date/datepicker/parts/WeekNumber.d.ts +0 -1
- package/cjs/date/datepicker/types.d.ts +0 -1
- package/cjs/date/monthpicker/types.d.ts +0 -1
- package/cjs/date/utils/check-dates.js +2 -2
- package/cjs/date/utils/check-dates.js.map +1 -1
- package/cjs/date/utils/get-initial-year.js +1 -2
- package/cjs/date/utils/get-initial-year.js.map +1 -1
- package/cjs/date/utils/get-month-weeks.js +2 -3
- package/cjs/date/utils/get-month-weeks.js.map +1 -1
- package/cjs/date/utils/is-match.js +2 -3
- package/cjs/date/utils/is-match.js.map +1 -1
- package/cjs/dropdown/Menu/index.d.ts +1 -1
- package/cjs/dropdown/context.d.ts +0 -1
- package/cjs/expansion-card/context.d.ts +0 -1
- package/cjs/form/checkbox/useCheckbox.d.ts +3 -3
- package/cjs/form/combobox/Combobox.d.ts +1 -1
- package/cjs/form/combobox/Combobox.js.map +1 -1
- package/cjs/form/combobox/ComboboxProvider.js +3 -1
- package/cjs/form/combobox/ComboboxProvider.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/filtered-options-util.d.ts +1 -0
- package/cjs/form/combobox/FilteredOptions/filtered-options-util.js +6 -1
- package/cjs/form/combobox/FilteredOptions/filtered-options-util.js.map +1 -1
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +5 -5
- package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/cjs/form/combobox/Input/Input.context.d.ts +20 -7
- package/cjs/form/combobox/Input/Input.context.js +6 -12
- package/cjs/form/combobox/Input/Input.context.js.map +1 -1
- package/cjs/form/combobox/Input/Input.d.ts +1 -1
- package/cjs/form/combobox/Input/Input.js +42 -18
- package/cjs/form/combobox/Input/Input.js.map +1 -1
- package/cjs/form/combobox/Input/InputController.d.ts +1 -1
- package/cjs/form/combobox/Input/InputController.js.map +1 -1
- package/cjs/form/combobox/types.d.ts +8 -4
- package/cjs/form/fieldset/context.d.ts +0 -1
- package/cjs/form/fieldset/useFieldset.d.ts +1 -1
- package/cjs/form/file-upload/FileUpload.context.d.ts +0 -1
- package/cjs/form/file-upload/parts/dropzone/dropzone.types.d.ts +0 -1
- package/cjs/form/file-upload/parts/item/utils/format-file-size.js +1 -2
- package/cjs/form/file-upload/parts/item/utils/format-file-size.js.map +1 -1
- package/cjs/form/file-upload/useFileUpload.d.ts +1 -2
- package/cjs/form/file-upload/utils/is-accepted-file-type.js +1 -2
- package/cjs/form/file-upload/utils/is-accepted-file-type.js.map +1 -1
- package/cjs/form/file-upload/utils/is-accepted-size.js +1 -2
- package/cjs/form/file-upload/utils/is-accepted-size.js.map +1 -1
- package/cjs/form/radio/useRadio.d.ts +3 -3
- package/cjs/form/search/context.d.ts +0 -1
- package/cjs/layout/base/PrimitiveAsChildProps.d.ts +0 -1
- package/cjs/layout/grid/HGrid.js +4 -1
- package/cjs/layout/grid/HGrid.js.map +1 -1
- package/cjs/layout/stack/Stack.js +7 -2
- package/cjs/layout/stack/Stack.js.map +1 -1
- package/cjs/layout/utilities/css.js +2 -3
- package/cjs/layout/utilities/css.js.map +1 -1
- package/cjs/list/context.d.ts +0 -1
- package/cjs/list/types.d.ts +0 -1
- package/cjs/modal/ModalUtils.js +3 -3
- package/cjs/modal/ModalUtils.js.map +1 -1
- package/cjs/modal/types.d.ts +0 -1
- package/cjs/overlays/dismissablelayer/DismissableLayer.d.ts +1 -1
- package/cjs/overlays/dismissablelayer/util/dispatchCustomEvent.js +2 -2
- package/cjs/overlays/dismissablelayer/util/dispatchCustomEvent.js.map +1 -1
- package/cjs/overlays/dismissablelayer/util/useEscapeKeydown.js +1 -2
- package/cjs/overlays/dismissablelayer/util/useEscapeKeydown.js.map +1 -1
- package/cjs/overlays/dismissablelayer/util/useFocusOutside.js +1 -2
- package/cjs/overlays/dismissablelayer/util/useFocusOutside.js.map +1 -1
- package/cjs/overlays/dismissablelayer/util/usePointerDownOutside.js +1 -2
- package/cjs/overlays/dismissablelayer/util/usePointerDownOutside.js.map +1 -1
- package/cjs/overlays/floating/Floating.utils.js +2 -3
- package/cjs/overlays/floating/Floating.utils.js.map +1 -1
- package/cjs/slot/merge-props.js +1 -2
- package/cjs/slot/merge-props.js.map +1 -1
- package/cjs/stepper/context.d.ts +0 -1
- package/cjs/table/context.d.ts +0 -1
- package/cjs/tabs/Tabs.context.d.ts +1 -2
- package/cjs/tabs/parts/tab/useTab.d.ts +1 -2
- package/cjs/tabs/parts/tab/useTab.js +1 -2
- package/cjs/tabs/parts/tab/useTab.js.map +1 -1
- package/cjs/tabs/parts/tablist/useScrollButtons.d.ts +0 -1
- package/cjs/tabs/parts/tablist/useScrollButtons.js +1 -2
- package/cjs/tabs/parts/tablist/useScrollButtons.js.map +1 -1
- package/cjs/tabs/parts/tablist/useTabList.js +3 -3
- package/cjs/tabs/parts/tablist/useTabList.js.map +1 -1
- package/cjs/tabs/parts/tabpanel/useTabPanel.js +1 -2
- package/cjs/tabs/parts/tabpanel/useTabPanel.js.map +1 -1
- package/cjs/tabs/useTabs.d.ts +0 -1
- package/cjs/tabs/useTabs.js +1 -2
- package/cjs/tabs/useTabs.js.map +1 -1
- package/cjs/timeline/hooks/usePeriodContext.d.ts +0 -1
- package/cjs/timeline/hooks/useRowContext.d.ts +0 -1
- package/cjs/timeline/hooks/useTimelineContext.d.ts +0 -1
- package/cjs/timeline/period/types.d.ts +0 -1
- package/cjs/timeline/zoom/index.d.ts +1 -1
- package/cjs/toggle-group/ToggleGroup.context.d.ts +1 -2
- package/cjs/toggle-group/parts/useToggleItem.d.ts +1 -2
- package/cjs/toggle-group/parts/useToggleItem.js +3 -3
- package/cjs/toggle-group/parts/useToggleItem.js.map +1 -1
- package/cjs/toggle-group/useToggleGroup.d.ts +0 -1
- package/cjs/toggle-group/useToggleGroup.js +1 -2
- package/cjs/toggle-group/useToggleGroup.js.map +1 -1
- package/cjs/util/composeEventHandlers.d.ts +0 -1
- package/cjs/util/composeEventHandlers.js +1 -2
- package/cjs/util/composeEventHandlers.js.map +1 -1
- package/cjs/util/copy.js +1 -1
- package/cjs/util/copy.js.map +1 -1
- package/cjs/util/create-context.js +1 -2
- package/cjs/util/create-context.js.map +1 -1
- package/cjs/util/debounce.js +1 -1
- package/cjs/util/debounce.js.map +1 -1
- package/cjs/util/hooks/descendants/useDescendant.d.ts +1 -1
- package/cjs/util/hooks/descendants/useDescendant.js +1 -2
- package/cjs/util/hooks/descendants/useDescendant.js.map +1 -1
- package/cjs/util/hooks/descendants/utils.js +4 -4
- package/cjs/util/hooks/descendants/utils.js.map +1 -1
- package/cjs/util/hooks/useCallbackRef.d.ts +0 -1
- package/cjs/util/hooks/useCallbackRef.js +1 -2
- package/cjs/util/hooks/useCallbackRef.js.map +1 -1
- package/cjs/util/hooks/useControllableState.js +1 -2
- package/cjs/util/hooks/useControllableState.js.map +1 -1
- package/cjs/util/hooks/useId.js +1 -2
- package/cjs/util/hooks/useId.js.map +1 -1
- package/cjs/util/hooks/useMergeRefs.d.ts +1 -1
- package/cjs/util/hooks/useMergeRefs.js +2 -3
- package/cjs/util/hooks/useMergeRefs.js.map +1 -1
- package/cjs/util/i18n/get.js +1 -2
- package/cjs/util/i18n/get.js.map +1 -1
- package/cjs/util/i18n/i18n.context.d.ts +0 -1
- package/cjs/util/i18n/i18n.context.js +2 -2
- package/cjs/util/i18n/i18n.context.js.map +1 -1
- package/cjs/util/i18n/merge.js +1 -2
- package/cjs/util/i18n/merge.js.map +1 -1
- package/cjs/util/omit.js +1 -2
- package/cjs/util/omit.js.map +1 -1
- package/cjs/util/types/AsChild.d.ts +0 -1
- package/cjs/util/types/AsChildProps.d.ts +0 -1
- package/cjs/util/virtualfocus/Context.d.ts +43 -0
- package/cjs/util/virtualfocus/Context.js +9 -0
- package/cjs/util/virtualfocus/Context.js.map +1 -0
- package/cjs/util/virtualfocus/SlottedDivElement.d.ts +7 -0
- package/cjs/util/virtualfocus/SlottedDivElement.js +46 -0
- package/cjs/util/virtualfocus/SlottedDivElement.js.map +1 -0
- package/cjs/util/virtualfocus/VirtualFocus.d.ts +62 -0
- package/cjs/util/virtualfocus/VirtualFocus.js +90 -0
- package/cjs/util/virtualfocus/VirtualFocus.js.map +1 -0
- package/cjs/util/virtualfocus/parts/VirtualFocusAnchor.d.ts +33 -0
- package/cjs/util/virtualfocus/parts/VirtualFocusAnchor.js +80 -0
- package/cjs/util/virtualfocus/parts/VirtualFocusAnchor.js.map +1 -0
- package/cjs/util/virtualfocus/parts/VirtualFocusContent.d.ts +4 -0
- package/cjs/util/virtualfocus/parts/VirtualFocusContent.js +45 -0
- package/cjs/util/virtualfocus/parts/VirtualFocusContent.js.map +1 -0
- package/cjs/util/virtualfocus/parts/VirtualFocusItem.d.ts +18 -0
- package/cjs/util/virtualfocus/parts/VirtualFocusItem.js +64 -0
- package/cjs/util/virtualfocus/parts/VirtualFocusItem.js.map +1 -0
- package/esm/accordion/AccordionContext.d.ts +0 -1
- package/esm/collapsible/Collapsible.context.d.ts +0 -1
- package/esm/date/context/useDateInputContext.d.ts +0 -1
- package/esm/date/datepicker/parts/HeadRow.d.ts +0 -1
- package/esm/date/datepicker/parts/Row.d.ts +0 -1
- package/esm/date/datepicker/parts/TableHead.d.ts +0 -1
- package/esm/date/datepicker/parts/WeekNumber.d.ts +0 -1
- package/esm/date/datepicker/types.d.ts +0 -1
- package/esm/date/monthpicker/types.d.ts +0 -1
- package/esm/dropdown/Menu/index.d.ts +1 -1
- package/esm/dropdown/context.d.ts +0 -1
- package/esm/expansion-card/context.d.ts +0 -1
- package/esm/form/checkbox/useCheckbox.d.ts +3 -3
- package/esm/form/combobox/Combobox.d.ts +1 -1
- package/esm/form/combobox/Combobox.js.map +1 -1
- package/esm/form/combobox/ComboboxProvider.js +3 -1
- package/esm/form/combobox/ComboboxProvider.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filtered-options-util.d.ts +1 -0
- package/esm/form/combobox/FilteredOptions/filtered-options-util.js +6 -1
- package/esm/form/combobox/FilteredOptions/filtered-options-util.js.map +1 -1
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +5 -5
- package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
- package/esm/form/combobox/Input/Input.context.d.ts +20 -7
- package/esm/form/combobox/Input/Input.context.js +7 -13
- package/esm/form/combobox/Input/Input.context.js.map +1 -1
- package/esm/form/combobox/Input/Input.d.ts +1 -1
- package/esm/form/combobox/Input/Input.js +43 -19
- package/esm/form/combobox/Input/Input.js.map +1 -1
- package/esm/form/combobox/Input/InputController.d.ts +1 -1
- package/esm/form/combobox/Input/InputController.js.map +1 -1
- package/esm/form/combobox/types.d.ts +8 -4
- package/esm/form/fieldset/context.d.ts +0 -1
- package/esm/form/fieldset/useFieldset.d.ts +1 -1
- package/esm/form/file-upload/FileUpload.context.d.ts +0 -1
- package/esm/form/file-upload/parts/dropzone/dropzone.types.d.ts +0 -1
- package/esm/form/file-upload/useFileUpload.d.ts +1 -2
- package/esm/form/radio/useRadio.d.ts +3 -3
- package/esm/form/search/context.d.ts +0 -1
- package/esm/layout/base/PrimitiveAsChildProps.d.ts +0 -1
- package/esm/layout/grid/HGrid.js +4 -1
- package/esm/layout/grid/HGrid.js.map +1 -1
- package/esm/layout/stack/Stack.js +7 -2
- package/esm/layout/stack/Stack.js.map +1 -1
- package/esm/list/context.d.ts +0 -1
- package/esm/list/types.d.ts +0 -1
- package/esm/modal/types.d.ts +0 -1
- package/esm/overlays/dismissablelayer/DismissableLayer.d.ts +1 -1
- package/esm/stepper/context.d.ts +0 -1
- package/esm/table/context.d.ts +0 -1
- package/esm/tabs/Tabs.context.d.ts +1 -2
- package/esm/tabs/parts/tab/useTab.d.ts +1 -2
- package/esm/tabs/parts/tablist/useScrollButtons.d.ts +0 -1
- package/esm/tabs/parts/tablist/useTabList.js +2 -1
- package/esm/tabs/parts/tablist/useTabList.js.map +1 -1
- package/esm/tabs/useTabs.d.ts +0 -1
- package/esm/timeline/hooks/usePeriodContext.d.ts +0 -1
- package/esm/timeline/hooks/useRowContext.d.ts +0 -1
- package/esm/timeline/hooks/useTimelineContext.d.ts +0 -1
- package/esm/timeline/period/types.d.ts +0 -1
- package/esm/timeline/zoom/index.d.ts +1 -1
- package/esm/toggle-group/ToggleGroup.context.d.ts +1 -2
- package/esm/toggle-group/parts/useToggleItem.d.ts +1 -2
- package/esm/toggle-group/parts/useToggleItem.js +2 -1
- package/esm/toggle-group/parts/useToggleItem.js.map +1 -1
- package/esm/toggle-group/useToggleGroup.d.ts +0 -1
- package/esm/util/composeEventHandlers.d.ts +0 -1
- package/esm/util/hooks/descendants/useDescendant.d.ts +1 -1
- package/esm/util/hooks/useCallbackRef.d.ts +0 -1
- package/esm/util/hooks/useMergeRefs.d.ts +1 -1
- package/esm/util/i18n/i18n.context.d.ts +0 -1
- package/esm/util/types/AsChild.d.ts +0 -1
- package/esm/util/types/AsChildProps.d.ts +0 -1
- package/esm/util/virtualfocus/Context.d.ts +43 -0
- package/esm/util/virtualfocus/Context.js +5 -0
- package/esm/util/virtualfocus/Context.js.map +1 -0
- package/esm/util/virtualfocus/SlottedDivElement.d.ts +7 -0
- package/esm/util/virtualfocus/SlottedDivElement.js +20 -0
- package/esm/util/virtualfocus/SlottedDivElement.js.map +1 -0
- package/esm/util/virtualfocus/VirtualFocus.d.ts +62 -0
- package/esm/util/virtualfocus/VirtualFocus.js +63 -0
- package/esm/util/virtualfocus/VirtualFocus.js.map +1 -0
- package/esm/util/virtualfocus/parts/VirtualFocusAnchor.d.ts +33 -0
- package/esm/util/virtualfocus/parts/VirtualFocusAnchor.js +54 -0
- package/esm/util/virtualfocus/parts/VirtualFocusAnchor.js.map +1 -0
- package/esm/util/virtualfocus/parts/VirtualFocusContent.d.ts +4 -0
- package/esm/util/virtualfocus/parts/VirtualFocusContent.js +19 -0
- package/esm/util/virtualfocus/parts/VirtualFocusContent.js.map +1 -0
- package/esm/util/virtualfocus/parts/VirtualFocusItem.d.ts +18 -0
- package/esm/util/virtualfocus/parts/VirtualFocusItem.js +38 -0
- package/esm/util/virtualfocus/parts/VirtualFocusItem.js.map +1 -0
- package/package.json +3 -3
- package/src/form/combobox/Combobox.tsx +4 -1
- package/src/form/combobox/ComboboxProvider.tsx +3 -0
- package/src/form/combobox/FilteredOptions/filtered-options-util.ts +9 -1
- package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +8 -5
- package/src/form/combobox/Input/Input.context.tsx +27 -25
- package/src/form/combobox/Input/Input.tsx +56 -27
- package/src/form/combobox/Input/InputController.tsx +1 -0
- package/src/form/combobox/__tests__/combobox.test.tsx +174 -66
- package/src/form/combobox/types.ts +11 -7
- package/src/layout/grid/HGrid.tsx +4 -1
- package/src/layout/stack/Stack.tsx +6 -2
- package/src/tabs/parts/tablist/useTabList.ts +4 -1
- package/src/toggle-group/parts/useToggleItem.ts +4 -1
- package/src/util/virtualfocus/Context.tsx +27 -0
- package/src/util/virtualfocus/SlottedDivElement.tsx +17 -0
- package/src/util/virtualfocus/VirtualFocus.tsx +89 -0
- package/src/util/virtualfocus/parts/VirtualFocusAnchor.tsx +102 -0
- package/src/util/virtualfocus/parts/VirtualFocusContent.tsx +17 -0
- package/src/util/virtualfocus/parts/VirtualFocusItem.tsx +60 -0
|
@@ -16,13 +16,18 @@ import { omit } from "../../util/index.js";
|
|
|
16
16
|
import BasePrimitive, { PRIMITIVE_PROPS, } from "../base/BasePrimitive.js";
|
|
17
17
|
import { getResponsiveProps, getResponsiveValue } from "../utilities/css.js";
|
|
18
18
|
export const Stack = forwardRef((_a, ref) => {
|
|
19
|
-
var { children, className, as: Component = "div", align
|
|
20
|
-
const style = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
19
|
+
var { children, className, as: Component = "div", align, justify, wrap = true, gap, style: _style, direction = "row", asChild } = _a, rest = __rest(_a, ["children", "className", "as", "align", "justify", "wrap", "gap", "style", "direction", "asChild"]);
|
|
20
|
+
const style = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, _style), getResponsiveProps(`stack`, "gap", "spacing", gap)), getResponsiveValue(`stack`, "direction", direction)), getResponsiveValue(`stack`, "align", align)), getResponsiveValue(`stack`, "justify", justify));
|
|
21
21
|
const Comp = asChild ? Slot : Component;
|
|
22
22
|
return (React.createElement(BasePrimitive, Object.assign({}, rest),
|
|
23
23
|
React.createElement(Comp, Object.assign({}, omit(rest, PRIMITIVE_PROPS), { ref: ref, style: style, className: cl("navds-stack", className, {
|
|
24
24
|
"navds-vstack": direction === "column",
|
|
25
25
|
"navds-hstack": direction === "row",
|
|
26
|
+
"navds-stack-gap": gap,
|
|
27
|
+
"navds-stack-align": align,
|
|
28
|
+
"navds-stack-justify": justify,
|
|
29
|
+
"navds-stack-direction": direction,
|
|
30
|
+
"navds-stack-wrap": wrap,
|
|
26
31
|
}) }), children)));
|
|
27
32
|
});
|
|
28
33
|
export default Stack;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.js","sourceRoot":"","sources":["../../../src/layout/stack/Stack.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAkB,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,aAAa,EAAE,EACpB,eAAe,GAEhB,MAAM,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ACnD,CAAC;IAEF,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAExC,OAAO,CACL,oBAAC,aAAa,oBAAK,IAAI;QACrB,oBAAC,IAAI,oBACC,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,IAC/B,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE;gBACtC,cAAc,EAAE,SAAS,KAAK,QAAQ;gBACtC,cAAc,EAAE,SAAS,KAAK,KAAK;gBACnC,iBAAiB,EAAE,GAAG;gBACtB,mBAAmB,EAAE,KAAK;gBAC1B,qBAAqB,EAAE,OAAO;gBAC9B,uBAAuB,EAAE,SAAS;gBAClC,kBAAkB,EAAE,IAAI;aACzB,CAAC,KAED,QAAQ,CACJ,CACO,CACjB,CAAC;AACJ,CAAC,CACF,CAAC;AAEJ,eAAe,KAAK,CAAC"}
|
package/esm/list/context.d.ts
CHANGED
package/esm/list/types.d.ts
CHANGED
package/esm/modal/types.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export declare const DismissableDescendantsProvider: React.Provider<import("../.
|
|
|
70
70
|
}>;
|
|
71
71
|
index: number;
|
|
72
72
|
enabledIndex: number;
|
|
73
|
-
register: (instance: HTMLDivElement | null) => void;
|
|
73
|
+
register: (instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
|
|
74
74
|
};
|
|
75
75
|
declare const DismissableLayer: React.ForwardRefExoticComponent<DismissableLayerProps & React.RefAttributes<HTMLDivElement>>;
|
|
76
76
|
export { DismissableLayer, type DismissableLayerProps };
|
package/esm/stepper/context.d.ts
CHANGED
package/esm/table/context.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { TabsProps } from "./Tabs.types.js";
|
|
3
2
|
import { useTabs } from "./useTabs.js";
|
|
4
3
|
export declare const TabsDescendantsProvider: import("react").Provider<import("../util/hooks/descendants/descendant.js").DescendantsManager<HTMLButtonElement, {
|
|
@@ -17,7 +16,7 @@ export declare const TabsDescendantsProvider: import("react").Provider<import(".
|
|
|
17
16
|
}>;
|
|
18
17
|
index: number;
|
|
19
18
|
enabledIndex: number;
|
|
20
|
-
register: (instance: HTMLButtonElement | null) => void;
|
|
19
|
+
register: (instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
|
|
21
20
|
};
|
|
22
21
|
type TabsProviderProps = ReturnType<typeof useTabs> & Pick<TabsProps, "selectionFollowsFocus" | "loop" | "size" | "iconPosition" | "fill">;
|
|
23
22
|
export declare const TabsProvider: import("react").ForwardRefExoticComponent<{
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export interface UseTabProps {
|
|
3
2
|
/**
|
|
4
3
|
* If `true`, the `Tab` won't be toggleable
|
|
@@ -10,7 +9,7 @@ export interface UseTabProps {
|
|
|
10
9
|
value: string;
|
|
11
10
|
}
|
|
12
11
|
export declare function useTab<P extends UseTabProps>({ value, disabled, onFocus: _onFocus, onClick }: P, ref: React.ForwardedRef<HTMLButtonElement>): {
|
|
13
|
-
ref: (instance: HTMLButtonElement | null) => void;
|
|
12
|
+
ref: (instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
|
|
14
13
|
isSelected: boolean;
|
|
15
14
|
isFocused: boolean;
|
|
16
15
|
id: string;
|
|
@@ -44,8 +44,9 @@ export function useTabList() {
|
|
|
44
44
|
Home: firstTab,
|
|
45
45
|
End: lastTab,
|
|
46
46
|
};
|
|
47
|
+
const hasModifiers = event.shiftKey || event.ctrlKey || event.altKey || event.metaKey;
|
|
47
48
|
const action = keyMap[event.key];
|
|
48
|
-
if (action) {
|
|
49
|
+
if (action && !hasModifiers) {
|
|
49
50
|
event.preventDefault();
|
|
50
51
|
action(event);
|
|
51
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTabList.js","sourceRoot":"","sources":["../../../../src/tabs/parts/tablist/useTabList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/E;;;GAGG;AACH,MAAM,UAAU,UAAU;IACxB,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,eAAe,EAAE,GAC1D,cAAc,EAAE,CAAC;IAEnB,MAAM,WAAW,GAAG,yBAAyB,EAAE,CAAC;IAEhD;;OAEG;IACH,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,KAA0B,EAAE,EAAE;QAC7B;;;WAGG;QACH,MAAM,GAAG,GAAG,WAAW;aACpB,MAAM,EAAE;aACR,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,YAAY,CAAC,CAAC;QAE9C,MAAM,OAAO,GAAG,GAAG,EAAE;;YACnB,MAAM,IAAI,GAAG,WAAW,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAChD,IAAI,KAAI,MAAA,IAAI,CAAC,IAAI,0CAAE,KAAK,EAAE,CAAA,CAAC;QAC7B,CAAC,CAAC;QACF,MAAM,OAAO,GAAG,GAAG,EAAE;;YACnB,MAAM,IAAI,GAAG,WAAW,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CA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AC5B,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC;aAAM,IAAI,KAAK,CAAC,GAAG,KAAK,KAAK,EAAE,CAAC;YAC/B;;;eAGG;YACH,aAAa,IAAI,UAAU,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC;QACpE,CAAC;IACH,CAAC,EACD,CAAC,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,eAAe,CAAC,CAClE,CAAC;IAEF,OAAO,EAAE,SAAS,EAAE,CAAC;AACvB,CAAC"}
|
package/esm/tabs/useTabs.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ToggleGroupProps } from "./ToggleGroup.types.js";
|
|
3
2
|
import { useToggleGroup } from "./useToggleGroup.js";
|
|
4
3
|
interface ToggleContextProps {
|
|
@@ -21,7 +20,7 @@ export declare const ToggleGroupDescendantsProvider: import("react").Provider<im
|
|
|
21
20
|
}>;
|
|
22
21
|
index: number;
|
|
23
22
|
enabledIndex: number;
|
|
24
|
-
register: (instance: HTMLButtonElement | null) => void;
|
|
23
|
+
register: (instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
|
|
25
24
|
};
|
|
26
25
|
type ToggleGroupProviderProps = ReturnType<typeof useToggleGroup> & Pick<ToggleGroupProps, "size">;
|
|
27
26
|
export declare const ToggleGroupProvider: import("react").ForwardRefExoticComponent<{
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export interface UseToggleItemProps {
|
|
3
2
|
/**
|
|
4
3
|
* If `true`, the `ToggleItem` won't be toggleable
|
|
@@ -11,7 +10,7 @@ export interface UseToggleItemProps {
|
|
|
11
10
|
value: string;
|
|
12
11
|
}
|
|
13
12
|
export declare function useToggleItem<P extends UseToggleItemProps>({ value, disabled, onFocus: _onFocus, onClick, onKeyDown: _onKeyDown, }: P, ref: React.ForwardedRef<HTMLButtonElement>): {
|
|
14
|
-
ref: (instance: HTMLButtonElement | null) => void;
|
|
13
|
+
ref: (instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
|
|
15
14
|
isSelected: boolean;
|
|
16
15
|
isFocused: boolean;
|
|
17
16
|
onClick: (event: import("react").MouseEvent<Element, MouseEvent>) => void;
|
|
@@ -47,8 +47,9 @@ export function useToggleItem({ value, disabled = false, onFocus: _onFocus, onCl
|
|
|
47
47
|
Home: firstTab,
|
|
48
48
|
End: lastTab,
|
|
49
49
|
};
|
|
50
|
+
const hasModifiers = event.shiftKey || event.ctrlKey || event.altKey || event.metaKey;
|
|
50
51
|
const action = keyMap[event.key];
|
|
51
|
-
if (action) {
|
|
52
|
+
if (action && !hasModifiers) {
|
|
52
53
|
event.preventDefault();
|
|
53
54
|
action(event);
|
|
54
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToggleItem.js","sourceRoot":"","sources":["../../../src/toggle-group/parts/useToggleItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAchC,MAAM,UAAU,aAAa,CAC3B,EACE,KAAK,EACL,QAAQ,GAAG,KAAK,EAChB,OAAO,EAAE,QAAQ,EACjB,OAAO,EACP,SA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GAAG,CAAC,CAAC;QAEjC,IAAI,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;YAC5B,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC;aAAM,IAAI,KAAK,CAAC,GAAG,KAAK,KAAK,EAAE,CAAC;YAC/B;;;eAGG;YACH,aAAa,IAAI,UAAU,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC;QACpE,CAAC;IACH,CAAC,EACD,CAAC,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,CAAC,CAC5D,CAAC;IAEF,OAAO;QACL,GAAG,EAAE,SAAS,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC/B,UAAU;QACV,SAAS,EAAE,YAAY,KAAK,KAAK;QACjC,OAAO,EAAE,oBAAoB,CAC3B,OAAO,EACP,GAAG,EAAE,CAAC,aAAa,KAAK,KAAK,IAAI,gBAAgB,CAAC,KAAK,CAAC,CACzD;QACD,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC;QACvE,SAAS,EAAE,oBAAoB,CAAC,UAAU,EAAE,SAAS,CAAC;KACvD,CAAC;AACJ,CAAC"}
|
|
@@ -10,5 +10,5 @@ export declare function createDescendantContext<T extends HTMLElement = HTMLElem
|
|
|
10
10
|
descendants: DescendantsManager<T, K>;
|
|
11
11
|
index: number;
|
|
12
12
|
enabledIndex: number;
|
|
13
|
-
register: (instance: T | null) => void;
|
|
13
|
+
register: (instance: T | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
|
|
14
14
|
}];
|
|
@@ -11,5 +11,5 @@ export declare function mergeRefs<T>(refs: PossibleRef<T>[]): React.RefCallback<
|
|
|
11
11
|
* @param ...refs: React.Ref<T> | undefined
|
|
12
12
|
* @returns React.useCallback(mergeRefs(refs), refs)
|
|
13
13
|
*/
|
|
14
|
-
export declare function useMergeRefs<T>(...refs: PossibleRef<T>[]): (instance: T | null) => void;
|
|
14
|
+
export declare function useMergeRefs<T>(...refs: PossibleRef<T>[]): (instance: T | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
|
|
15
15
|
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from "react";
|
|
2
|
+
export declare const VirtualFocusDescendantsProvider: import("react").Provider<import("../hooks/descendants/descendant.js").DescendantsManager<HTMLDivElement, {
|
|
3
|
+
handleOnSelect: () => void;
|
|
4
|
+
handleOnActive: () => void;
|
|
5
|
+
}>>, useVirtualFocusDescendantsContext: <S extends boolean = true>(strict?: S) => S extends true ? import("../hooks/descendants/descendant.js").DescendantsManager<HTMLDivElement, {
|
|
6
|
+
handleOnSelect: () => void;
|
|
7
|
+
handleOnActive: () => void;
|
|
8
|
+
}> : import("../hooks/descendants/descendant.js").DescendantsManager<HTMLDivElement, {
|
|
9
|
+
handleOnSelect: () => void;
|
|
10
|
+
handleOnActive: () => void;
|
|
11
|
+
}> | undefined, useVirtualFocusDescendantInitializer: () => import("../hooks/descendants/descendant.js").DescendantsManager<HTMLDivElement, {
|
|
12
|
+
handleOnSelect: () => void;
|
|
13
|
+
handleOnActive: () => void;
|
|
14
|
+
}>, useVirtualFocusDescendant: (options?: import("../hooks/descendants/descendant.js").DescendantOptions<{
|
|
15
|
+
handleOnSelect: () => void;
|
|
16
|
+
handleOnActive: () => void;
|
|
17
|
+
}> | undefined) => {
|
|
18
|
+
descendants: import("../hooks/descendants/descendant.js").DescendantsManager<HTMLDivElement, {
|
|
19
|
+
handleOnSelect: () => void;
|
|
20
|
+
handleOnActive: () => void;
|
|
21
|
+
}>;
|
|
22
|
+
index: number;
|
|
23
|
+
enabledIndex: number;
|
|
24
|
+
register: (instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES];
|
|
25
|
+
};
|
|
26
|
+
export declare const VirtualFocusInternalContextProvider: import("react").ForwardRefExoticComponent<{
|
|
27
|
+
virtualFocusIdx: number;
|
|
28
|
+
setVirtualFocusIdx: Dispatch<SetStateAction<number>>;
|
|
29
|
+
loop: boolean;
|
|
30
|
+
uniqueId: string;
|
|
31
|
+
} & {
|
|
32
|
+
children: import("react").ReactNode;
|
|
33
|
+
} & import("react").RefAttributes<unknown>>, useVirtualFocusInternalContext: <S extends boolean = true>(strict?: S) => S extends true ? {
|
|
34
|
+
virtualFocusIdx: number;
|
|
35
|
+
setVirtualFocusIdx: Dispatch<SetStateAction<number>>;
|
|
36
|
+
loop: boolean;
|
|
37
|
+
uniqueId: string;
|
|
38
|
+
} : {
|
|
39
|
+
virtualFocusIdx: number;
|
|
40
|
+
setVirtualFocusIdx: Dispatch<SetStateAction<number>>;
|
|
41
|
+
loop: boolean;
|
|
42
|
+
uniqueId: string;
|
|
43
|
+
} | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createContext } from "../create-context.js";
|
|
2
|
+
import { createDescendantContext } from "../hooks/descendants/useDescendant.js";
|
|
3
|
+
export const [VirtualFocusDescendantsProvider, useVirtualFocusDescendantsContext, useVirtualFocusDescendantInitializer, useVirtualFocusDescendant,] = createDescendantContext();
|
|
4
|
+
export const [VirtualFocusInternalContextProvider, useVirtualFocusInternalContext,] = createContext();
|
|
5
|
+
//# sourceMappingURL=Context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../src/util/virtualfocus/Context.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAG7E,MAAM,CAAC,MAAM,CACX,+BAA+B,EAC/B,iCAAiC,EACjC,oCAAoC,EACpC,yBAAyB,EAC1B,GAAG,uBAAuB,EAMxB,CAAC;AAEJ,MAAM,CAAC,MAAM,CACX,mCAAmC,EACnC,8BAA8B,EAC/B,GAAG,aAAa,EAKb,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface SlottedDivProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare const SlottedDivElement: React.ForwardRefExoticComponent<SlottedDivProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
type SlottedDivElementRef = React.ElementRef<typeof SlottedDivElement>;
|
|
7
|
+
export { SlottedDivElement, type SlottedDivElementRef, type SlottedDivProps };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef } from "react";
|
|
13
|
+
import { Slot } from "../../slot/Slot.js";
|
|
14
|
+
const SlottedDivElement = forwardRef((_a, forwardedRef) => {
|
|
15
|
+
var { asChild } = _a, rest = __rest(_a, ["asChild"]);
|
|
16
|
+
const Comp = asChild ? Slot : "div";
|
|
17
|
+
return React.createElement(Comp, Object.assign({}, rest, { ref: forwardedRef }));
|
|
18
|
+
});
|
|
19
|
+
export { SlottedDivElement };
|
|
20
|
+
//# sourceMappingURL=SlottedDivElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlottedDivElement.js","sourceRoot":"","sources":["../../../src/util/virtualfocus/SlottedDivElement.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAMvC,MAAM,iBAAiB,GAAG,UAAU,CAClC,CAAC,EAAoB,EAAE,YAAY,EAAE,EAAE;QAAtC,EAAE,OAAO,OAAW,EAAN,IAAI,cAAlB,WAAoB,CAAF;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACpC,OAAO,oBAAC,IAAI,oBAAK,IAAI,IAAE,GAAG,EAAE,YAAY,IAAI,CAAC;AAC/C,CAAC,CACF,CAAC;AAIF,OAAO,EAAE,iBAAiB,EAAmD,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type VirtualFocusProps = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* Whether to cause focus to loop around when it hits the first or last element
|
|
6
|
+
* @default false
|
|
7
|
+
**/
|
|
8
|
+
loop?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A component that manages a virtual focus using the 'up' and 'down'
|
|
12
|
+
* arrow keys as well as selection with 'Return'.
|
|
13
|
+
*
|
|
14
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/virtualfocus)
|
|
15
|
+
* @see 🏷️ {@link AccordionProps}
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```jsx
|
|
19
|
+
* <VirtualFocus>
|
|
20
|
+
* <VirtualFocus.Anchor
|
|
21
|
+
* role="combobox"
|
|
22
|
+
* onSelect={() => {
|
|
23
|
+
* console.log("you selected the anchor");
|
|
24
|
+
* }}
|
|
25
|
+
* onActive={() => {
|
|
26
|
+
* console.log("the anchor is now virtually focused");
|
|
27
|
+
* }}
|
|
28
|
+
* >
|
|
29
|
+
* <input type="text" />
|
|
30
|
+
* </VirtualFocus.Anchor>
|
|
31
|
+
* <VirtualFocus.Content>
|
|
32
|
+
* <VirtualFocus.Item
|
|
33
|
+
* onSelect={() => {
|
|
34
|
+
* console.log("you selected the item");
|
|
35
|
+
* }}
|
|
36
|
+
* onActive={() => {
|
|
37
|
+
* console.log("the item is now virtually focused");
|
|
38
|
+
* }}
|
|
39
|
+
* >
|
|
40
|
+
* <p>item 1</p>
|
|
41
|
+
* </VirtualFocus.Item>
|
|
42
|
+
* <VirtualFocus.Item
|
|
43
|
+
* onSelect={() => {
|
|
44
|
+
* console.log("you selected the item");
|
|
45
|
+
* }}
|
|
46
|
+
* onActive={() => {
|
|
47
|
+
* console.log("the item is now virtually focused");
|
|
48
|
+
* }}
|
|
49
|
+
* >
|
|
50
|
+
* <p>item 2</p>
|
|
51
|
+
* </VirtualFocus.Item>
|
|
52
|
+
* </VirtualFocus.Content>
|
|
53
|
+
* </VirtualFocus>
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare const VirtualFocus: {
|
|
57
|
+
({ children, loop }: VirtualFocusProps): React.JSX.Element;
|
|
58
|
+
Anchor: React.ForwardRefExoticComponent<import("./parts/VirtualFocusAnchor.js").VirtualFocusAnchorProps & React.RefAttributes<HTMLInputElement>>;
|
|
59
|
+
Item: React.ForwardRefExoticComponent<import("./parts/VirtualFocusItem.js").VirtualFocusItemProps & React.RefAttributes<HTMLElement>>;
|
|
60
|
+
Content: React.ForwardRefExoticComponent<import("./parts/VirtualFocusContent.js").VirtualFocusContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
61
|
+
};
|
|
62
|
+
export default VirtualFocus;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { useId } from "../../util/hooks/index.js";
|
|
3
|
+
import { VirtualFocusDescendantsProvider, VirtualFocusInternalContextProvider, useVirtualFocusDescendantInitializer, } from "./Context.js";
|
|
4
|
+
import { VirtualFocusAnchor } from "./parts/VirtualFocusAnchor.js";
|
|
5
|
+
import { VirtualFocusContent } from "./parts/VirtualFocusContent.js";
|
|
6
|
+
import { VirtualFocusItem } from "./parts/VirtualFocusItem.js";
|
|
7
|
+
/**
|
|
8
|
+
* A component that manages a virtual focus using the 'up' and 'down'
|
|
9
|
+
* arrow keys as well as selection with 'Return'.
|
|
10
|
+
*
|
|
11
|
+
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/virtualfocus)
|
|
12
|
+
* @see 🏷️ {@link AccordionProps}
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```jsx
|
|
16
|
+
* <VirtualFocus>
|
|
17
|
+
* <VirtualFocus.Anchor
|
|
18
|
+
* role="combobox"
|
|
19
|
+
* onSelect={() => {
|
|
20
|
+
* console.log("you selected the anchor");
|
|
21
|
+
* }}
|
|
22
|
+
* onActive={() => {
|
|
23
|
+
* console.log("the anchor is now virtually focused");
|
|
24
|
+
* }}
|
|
25
|
+
* >
|
|
26
|
+
* <input type="text" />
|
|
27
|
+
* </VirtualFocus.Anchor>
|
|
28
|
+
* <VirtualFocus.Content>
|
|
29
|
+
* <VirtualFocus.Item
|
|
30
|
+
* onSelect={() => {
|
|
31
|
+
* console.log("you selected the item");
|
|
32
|
+
* }}
|
|
33
|
+
* onActive={() => {
|
|
34
|
+
* console.log("the item is now virtually focused");
|
|
35
|
+
* }}
|
|
36
|
+
* >
|
|
37
|
+
* <p>item 1</p>
|
|
38
|
+
* </VirtualFocus.Item>
|
|
39
|
+
* <VirtualFocus.Item
|
|
40
|
+
* onSelect={() => {
|
|
41
|
+
* console.log("you selected the item");
|
|
42
|
+
* }}
|
|
43
|
+
* onActive={() => {
|
|
44
|
+
* console.log("the item is now virtually focused");
|
|
45
|
+
* }}
|
|
46
|
+
* >
|
|
47
|
+
* <p>item 2</p>
|
|
48
|
+
* </VirtualFocus.Item>
|
|
49
|
+
* </VirtualFocus.Content>
|
|
50
|
+
* </VirtualFocus>
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export const VirtualFocus = ({ children, loop = false }) => {
|
|
54
|
+
const descendants = useVirtualFocusDescendantInitializer();
|
|
55
|
+
const [virtualFocusIdx, setVirtualFocusIdx] = useState(0);
|
|
56
|
+
return (React.createElement(VirtualFocusInternalContextProvider, { virtualFocusIdx: virtualFocusIdx, setVirtualFocusIdx: setVirtualFocusIdx, loop: loop, uniqueId: useId() },
|
|
57
|
+
React.createElement(VirtualFocusDescendantsProvider, { value: descendants }, children)));
|
|
58
|
+
};
|
|
59
|
+
VirtualFocus.Anchor = VirtualFocusAnchor;
|
|
60
|
+
VirtualFocus.Item = VirtualFocusItem;
|
|
61
|
+
VirtualFocus.Content = VirtualFocusContent;
|
|
62
|
+
export default VirtualFocus;
|
|
63
|
+
//# sourceMappingURL=VirtualFocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VirtualFocus.js","sourceRoot":"","sources":["../../../src/util/virtualfocus/VirtualFocus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EACL,+BAA+B,EAC/B,mCAAmC,EACnC,oCAAoC,GACrC,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAW5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,KAAK,EAAqB,EAAE,EAAE;IAC5E,MAAM,WAAW,GAAG,oCAAoC,EAAE,CAAC;IAC3D,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE1D,OAAO,CACL,oBAAC,mCAAmC,IAClC,eAAe,EAAE,eAAe,EAChC,kBAAkB,EAAE,kBAAkB,EACtC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,KAAK,EAAE;QAEjB,oBAAC,+BAA+B,IAAC,KAAK,EAAE,WAAW,IAChD,QAAQ,CACuB,CACE,CACvC,CAAC;AACJ,CAAC,CAAC;AAEF,YAAY,CAAC,MAAM,GAAG,kBAAkB,CAAC;AACzC,YAAY,CAAC,IAAI,GAAG,gBAAgB,CAAC;AACrC,YAAY,CAAC,OAAO,GAAG,mBAAmB,CAAC;AAE3C,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface VirtualFocusAnchorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "id"> {
|
|
3
|
+
/**
|
|
4
|
+
* The role of the container. This is a limited subset of roles that
|
|
5
|
+
* require manual focus management.
|
|
6
|
+
*
|
|
7
|
+
* Children that are to get focus inside this container element shall be
|
|
8
|
+
* pointed to by `aria-activedescendant`.
|
|
9
|
+
**/
|
|
10
|
+
role: "combobox" | "grid" | "listbox" | "menu" | "menubar" | "radiogroup" | "tree" | "treegrid" | "tablist";
|
|
11
|
+
/**
|
|
12
|
+
* The function that is run when the focused element
|
|
13
|
+
* is to be selected (eg. do an actual search, change route... etc)
|
|
14
|
+
*/
|
|
15
|
+
onSelect: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* The function that is run when the element gets
|
|
18
|
+
* virtual focus set to it.
|
|
19
|
+
*/
|
|
20
|
+
onActive: () => void;
|
|
21
|
+
children: React.ReactElement;
|
|
22
|
+
/**
|
|
23
|
+
* Set this to `0` if you want the Anchor itself
|
|
24
|
+
* to be focusable. Since this Anchor is hoisted & merged with
|
|
25
|
+
* its first child, you most likely want to keep this as `0`.
|
|
26
|
+
* @default 0
|
|
27
|
+
*/
|
|
28
|
+
tabIndex?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Must have a single child that is an input element.
|
|
32
|
+
*/
|
|
33
|
+
export declare const VirtualFocusAnchor: React.ForwardRefExoticComponent<VirtualFocusAnchorProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef } from "react";
|
|
13
|
+
import { Slot } from "../../../slot/Slot.js";
|
|
14
|
+
import { composeEventHandlers } from "../../composeEventHandlers.js";
|
|
15
|
+
import { useMergeRefs } from "../../hooks/index.js";
|
|
16
|
+
import { useVirtualFocusDescendant, useVirtualFocusInternalContext, } from "../Context.js";
|
|
17
|
+
/**
|
|
18
|
+
* Must have a single child that is an input element.
|
|
19
|
+
*/
|
|
20
|
+
export const VirtualFocusAnchor = forwardRef((_a, ref) => {
|
|
21
|
+
var { onSelect, onActive, children } = _a, rest = __rest(_a, ["onSelect", "onActive", "children"]);
|
|
22
|
+
const { virtualFocusIdx, setVirtualFocusIdx, loop, uniqueId } = useVirtualFocusInternalContext();
|
|
23
|
+
const { register, descendants, index } = useVirtualFocusDescendant({
|
|
24
|
+
handleOnActive: () => {
|
|
25
|
+
setVirtualFocusIdx(0);
|
|
26
|
+
onActive();
|
|
27
|
+
},
|
|
28
|
+
handleOnSelect: onSelect,
|
|
29
|
+
});
|
|
30
|
+
const mergedRefs = useMergeRefs(ref, register);
|
|
31
|
+
return (React.createElement(Slot, Object.assign({ ref: mergedRefs, tabIndex: 0 }, rest, { id: `virtualfocus-${uniqueId}-${index}`, "aria-owns": `virtualfocus-${uniqueId}-content`, "aria-controls": `virtualfocus-${uniqueId}-content`, "aria-activedescendant": `virtualfocus-${uniqueId}-${virtualFocusIdx}`, onKeyDown: composeEventHandlers(rest.onKeyDown, (event) => {
|
|
32
|
+
if (event.key === "ArrowDown") {
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
const to_focus_descendant = descendants.next(virtualFocusIdx, loop);
|
|
35
|
+
if (to_focus_descendant) {
|
|
36
|
+
to_focus_descendant.handleOnActive();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if (event.key === "ArrowUp") {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
const to_focus_descendant = descendants.prev(virtualFocusIdx, loop);
|
|
42
|
+
if (to_focus_descendant) {
|
|
43
|
+
to_focus_descendant.handleOnActive();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else if (event.key === "Enter") {
|
|
47
|
+
const curr = descendants.item(virtualFocusIdx);
|
|
48
|
+
if (curr === null || curr === void 0 ? void 0 : curr.handleOnSelect) {
|
|
49
|
+
curr.handleOnSelect();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}) }), children));
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=VirtualFocusAnchor.js.map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IAAI,eAAe,EAAE,EACpE,SAAS,EAAE,oBAAoB,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YACxD,IAAI,KAAK,CAAC,GAAG,KAAK,WAAW,EAAE,CAAC;gBAC9B,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,MAAM,mBAAmB,GAAG,WAAW,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;gBACpE,IAAI,mBAAmB,EAAE,CAAC;oBACxB,mBAAmB,CAAC,cAAc,EAAE,CAAC;gBACvC,CAAC;YACH,CAAC;iBAAM,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;gBACnC,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,MAAM,mBAAmB,GAAG,WAAW,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;gBACpE,IAAI,mBAAmB,EAAE,CAAC;oBACxB,mBAAmB,CAAC,cAAc,EAAE,CAAC;gBACvC,CAAC;YACH,CAAC;iBAAM,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;gBACjC,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;gBAC/C,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,cAAc,EAAE,CAAC;oBACzB,IAAI,CAAC,cAAc,EAAE,CAAC;gBACxB,CAAC;YACH,CAAC;QACH,CAAC,CAAC,KAED,QAAQ,CACJ,CACR,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface VirtualFocusContentProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "id"> {
|
|
3
|
+
}
|
|
4
|
+
export declare const VirtualFocusContent: React.ForwardRefExoticComponent<VirtualFocusContentProps & React.RefAttributes<HTMLDivElement>>;
|