@entry-ui/qwik 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/lib/_internal/components/collapsible-panel/collapsible-panel.d.ts +13 -0
  2. package/lib/_internal/components/collapsible-panel/collapsible-panel.qwik.mjs +195 -0
  3. package/lib/_internal/components/collapsible-panel/collapsible-panel.types.d.ts +62 -0
  4. package/lib/_internal/components/collapsible-panel/index.d.ts +2 -0
  5. package/lib/_internal/components/index.d.ts +2 -0
  6. package/lib/_internal/components/indicator/index.d.ts +2 -0
  7. package/lib/_internal/components/indicator/indicator.d.ts +11 -0
  8. package/lib/_internal/components/indicator/indicator.qwik.mjs +27 -0
  9. package/lib/_internal/components/indicator/indicator.types.d.ts +15 -0
  10. package/lib/components/accordion/parts/accordion-item-indicator/accordion-item-indicator.qwik.mjs +4 -12
  11. package/lib/components/accordion/parts/accordion-item-panel/accordion-item-panel.qwik.mjs +10 -169
  12. package/lib/components/accordion/parts/accordion-root/accordion-root.qwik.mjs +6 -19
  13. package/lib/components/collapsible/parts/collapsible-indicator/collapsible-indicator.qwik.mjs +4 -12
  14. package/lib/components/collapsible/parts/collapsible-panel/collapsible-panel.qwik.mjs +10 -164
  15. package/lib/components/collapsible/parts/collapsible-root/collapsible-root.qwik.mjs +1 -18
  16. package/lib/components/copy-button/contexts/copy-button-root-context/copy-button-root-context.d.ts +11 -0
  17. package/lib/components/copy-button/contexts/copy-button-root-context/copy-button-root-context.qwik.mjs +10 -0
  18. package/lib/components/copy-button/contexts/copy-button-root-context/copy-button-root-context.types.d.ts +24 -0
  19. package/lib/components/copy-button/contexts/copy-button-root-context/index.d.ts +2 -0
  20. package/lib/components/copy-button/contexts/index.d.ts +1 -0
  21. package/lib/components/copy-button/hooks/index.d.ts +1 -0
  22. package/lib/components/copy-button/hooks/use-copy-button-root-context/index.d.ts +2 -0
  23. package/lib/components/copy-button/hooks/use-copy-button-root-context/use-copy-button-root-context.d.ts +7 -0
  24. package/lib/components/copy-button/hooks/use-copy-button-root-context/use-copy-button-root-context.qwik.mjs +13 -0
  25. package/lib/components/copy-button/hooks/use-copy-button-root-context/use-copy-button-root-context.types.d.ts +24 -0
  26. package/lib/components/copy-button/index.d.ts +2 -0
  27. package/lib/components/copy-button/index.qwik.mjs +6 -0
  28. package/lib/components/copy-button/parts/copy-button-indicator/copy-button-indicator.d.ts +9 -0
  29. package/lib/components/copy-button/parts/copy-button-indicator/copy-button-indicator.qwik.mjs +20 -0
  30. package/lib/components/copy-button/parts/copy-button-indicator/copy-button-indicator.types.d.ts +15 -0
  31. package/lib/components/copy-button/parts/copy-button-indicator/index.d.ts +2 -0
  32. package/lib/components/copy-button/parts/copy-button-root/copy-button-root.d.ts +7 -0
  33. package/lib/components/copy-button/parts/copy-button-root/copy-button-root.qwik.mjs +47 -0
  34. package/lib/components/copy-button/parts/copy-button-root/copy-button-root.types.d.ts +52 -0
  35. package/lib/components/copy-button/parts/copy-button-root/index.d.ts +2 -0
  36. package/lib/components/copy-button/parts/index.d.ts +4 -0
  37. package/lib/components/copy-button/parts/index.qwik.mjs +6 -0
  38. package/lib/components/index.d.ts +3 -0
  39. package/lib/components/roving-focus-group/contexts/index.d.ts +2 -0
  40. package/lib/components/roving-focus-group/contexts/roving-focus-group-item-context/index.d.ts +2 -0
  41. package/lib/components/roving-focus-group/contexts/roving-focus-group-item-context/roving-focus-group-item-context.d.ts +6 -0
  42. package/lib/components/roving-focus-group/contexts/roving-focus-group-item-context/roving-focus-group-item-context.qwik.mjs +5 -0
  43. package/lib/components/roving-focus-group/contexts/roving-focus-group-item-context/roving-focus-group-item-context.types.d.ts +22 -0
  44. package/lib/components/roving-focus-group/contexts/roving-focus-group-root-context/index.d.ts +2 -0
  45. package/lib/components/roving-focus-group/contexts/roving-focus-group-root-context/roving-focus-group-root-context.d.ts +11 -0
  46. package/lib/components/roving-focus-group/contexts/roving-focus-group-root-context/roving-focus-group-root-context.qwik.mjs +10 -0
  47. package/lib/components/roving-focus-group/contexts/roving-focus-group-root-context/roving-focus-group-root-context.types.d.ts +37 -0
  48. package/lib/components/roving-focus-group/hooks/index.d.ts +2 -0
  49. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-item-context/index.d.ts +2 -0
  50. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-item-context/use-roving-focus-group-item-context.d.ts +7 -0
  51. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-item-context/use-roving-focus-group-item-context.qwik.mjs +13 -0
  52. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-item-context/use-roving-focus-group-item-context.types.d.ts +22 -0
  53. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-root-context/index.d.ts +2 -0
  54. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-root-context/use-roving-focus-group-root-context.d.ts +8 -0
  55. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-root-context/use-roving-focus-group-root-context.qwik.mjs +13 -0
  56. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-root-context/use-roving-focus-group-root-context.types.d.ts +22 -0
  57. package/lib/components/roving-focus-group/index.d.ts +2 -0
  58. package/lib/components/roving-focus-group/index.qwik.mjs +8 -0
  59. package/lib/components/roving-focus-group/parts/index.d.ts +4 -0
  60. package/lib/components/roving-focus-group/parts/index.qwik.mjs +6 -0
  61. package/lib/components/roving-focus-group/parts/roving-focus-group-item/index.d.ts +2 -0
  62. package/lib/components/roving-focus-group/parts/roving-focus-group-item/roving-focus-group-item.d.ts +7 -0
  63. package/lib/components/roving-focus-group/parts/roving-focus-group-item/roving-focus-group-item.qwik.mjs +160 -0
  64. package/lib/components/roving-focus-group/parts/roving-focus-group-item/roving-focus-group-item.types.d.ts +29 -0
  65. package/lib/components/roving-focus-group/parts/roving-focus-group-root/index.d.ts +2 -0
  66. package/lib/components/roving-focus-group/parts/roving-focus-group-root/roving-focus-group-root.d.ts +7 -0
  67. package/lib/components/roving-focus-group/parts/roving-focus-group-root/roving-focus-group-root.qwik.mjs +49 -0
  68. package/lib/components/roving-focus-group/parts/roving-focus-group-root/roving-focus-group-root.types.d.ts +59 -0
  69. package/lib/components/tabs/contexts/index.d.ts +4 -0
  70. package/lib/components/tabs/contexts/tabs-list-context/index.d.ts +2 -0
  71. package/lib/components/tabs/contexts/tabs-list-context/tabs-list-context.d.ts +11 -0
  72. package/lib/components/tabs/contexts/tabs-list-context/tabs-list-context.qwik.mjs +10 -0
  73. package/lib/components/tabs/contexts/tabs-list-context/tabs-list-context.types.d.ts +12 -0
  74. package/lib/components/tabs/contexts/tabs-panel-context/index.d.ts +2 -0
  75. package/lib/components/tabs/contexts/tabs-panel-context/tabs-panel-context.d.ts +6 -0
  76. package/lib/components/tabs/contexts/tabs-panel-context/tabs-panel-context.qwik.mjs +5 -0
  77. package/lib/components/tabs/contexts/tabs-panel-context/tabs-panel-context.types.d.ts +12 -0
  78. package/lib/components/tabs/contexts/tabs-root-context/index.d.ts +2 -0
  79. package/lib/components/tabs/contexts/tabs-root-context/tabs-root-context.d.ts +11 -0
  80. package/lib/components/tabs/contexts/tabs-root-context/tabs-root-context.qwik.mjs +10 -0
  81. package/lib/components/tabs/contexts/tabs-root-context/tabs-root-context.types.d.ts +33 -0
  82. package/lib/components/tabs/contexts/tabs-tab-context/index.d.ts +2 -0
  83. package/lib/components/tabs/contexts/tabs-tab-context/tabs-tab-context.d.ts +6 -0
  84. package/lib/components/tabs/contexts/tabs-tab-context/tabs-tab-context.qwik.mjs +5 -0
  85. package/lib/components/tabs/contexts/tabs-tab-context/tabs-tab-context.types.d.ts +22 -0
  86. package/lib/components/tabs/hooks/index.d.ts +3 -0
  87. package/lib/components/tabs/hooks/use-tabs-panel-context/index.d.ts +2 -0
  88. package/lib/components/tabs/hooks/use-tabs-panel-context/use-tabs-panel-context.d.ts +8 -0
  89. package/lib/components/tabs/hooks/use-tabs-panel-context/use-tabs-panel-context.qwik.mjs +11 -0
  90. package/lib/components/tabs/hooks/use-tabs-panel-context/use-tabs-panel-context.types.d.ts +12 -0
  91. package/lib/components/tabs/hooks/use-tabs-root-context/index.d.ts +2 -0
  92. package/lib/components/tabs/hooks/use-tabs-root-context/use-tabs-root-context.d.ts +8 -0
  93. package/lib/components/tabs/hooks/use-tabs-root-context/use-tabs-root-context.qwik.mjs +13 -0
  94. package/lib/components/tabs/hooks/use-tabs-root-context/use-tabs-root-context.types.d.ts +22 -0
  95. package/lib/components/tabs/hooks/use-tabs-tab-context/index.d.ts +2 -0
  96. package/lib/components/tabs/hooks/use-tabs-tab-context/use-tabs-tab-context.d.ts +7 -0
  97. package/lib/components/tabs/hooks/use-tabs-tab-context/use-tabs-tab-context.qwik.mjs +13 -0
  98. package/lib/components/tabs/hooks/use-tabs-tab-context/use-tabs-tab-context.types.d.ts +22 -0
  99. package/lib/components/tabs/index.d.ts +2 -0
  100. package/lib/components/tabs/index.qwik.mjs +10 -0
  101. package/lib/components/tabs/parts/index.d.ts +8 -0
  102. package/lib/components/tabs/parts/index.qwik.mjs +10 -0
  103. package/lib/components/tabs/parts/tabs-list/index.d.ts +2 -0
  104. package/lib/components/tabs/parts/tabs-list/tabs-list.d.ts +7 -0
  105. package/lib/components/tabs/parts/tabs-list/tabs-list.qwik.mjs +37 -0
  106. package/lib/components/tabs/parts/tabs-list/tabs-list.types.d.ts +30 -0
  107. package/lib/components/tabs/parts/tabs-panel/index.d.ts +2 -0
  108. package/lib/components/tabs/parts/tabs-panel/tabs-panel.d.ts +7 -0
  109. package/lib/components/tabs/parts/tabs-panel/tabs-panel.qwik.mjs +39 -0
  110. package/lib/components/tabs/parts/tabs-panel/tabs-panel.types.d.ts +27 -0
  111. package/lib/components/tabs/parts/tabs-root/index.d.ts +2 -0
  112. package/lib/components/tabs/parts/tabs-root/tabs-root.d.ts +7 -0
  113. package/lib/components/tabs/parts/tabs-root/tabs-root.qwik.mjs +34 -0
  114. package/lib/components/tabs/parts/tabs-root/tabs-root.types.d.ts +50 -0
  115. package/lib/components/tabs/parts/tabs-tab/index.d.ts +2 -0
  116. package/lib/components/tabs/parts/tabs-tab/tabs-tab.d.ts +7 -0
  117. package/lib/components/tabs/parts/tabs-tab/tabs-tab.qwik.mjs +87 -0
  118. package/lib/components/tabs/parts/tabs-tab/tabs-tab.types.d.ts +25 -0
  119. package/lib/hooks/index.d.ts +1 -0
  120. package/lib/hooks/use-clipboard/index.d.ts +2 -0
  121. package/lib/hooks/use-clipboard/index.qwik.mjs +4 -0
  122. package/lib/hooks/use-clipboard/use-clipboard.d.ts +19 -0
  123. package/lib/hooks/use-clipboard/use-clipboard.qwik.mjs +93 -0
  124. package/lib/hooks/use-clipboard/use-clipboard.types.d.ts +58 -0
  125. package/lib/index.qwik.mjs +24 -4
  126. package/package.json +18 -2
@@ -0,0 +1,37 @@
1
+ import type { ReadonlySignal, QRL } from '@qwik.dev/core';
2
+ /**
3
+ * The value provided by the `RovingFocusGroupRootContext` context.
4
+ * Contains the readonly signals and `QRL` functions shared with descendant components.
5
+ */
6
+ export interface RovingFocusGroupRootContextValue {
7
+ /**
8
+ * A readonly signal whose value is a string representing the ID of the item that is currently active.
9
+ * This signal reflects the internal state of which item within the group holds the tab stop.
10
+ */
11
+ currentTabStopId: ReadonlySignal<string>;
12
+ /**
13
+ * A `QRL` function used to programmatically set the active tab stop.
14
+ * This function takes a string representing the ID of the item that should become focusable.
15
+ */
16
+ setCurrentTabStopId$: QRL<(tabStopId: string) => void>;
17
+ /**
18
+ * A `QRL` function that retrieves an ordered array of focusable HTML elements within the group.
19
+ * This is used to calculate the next or previous item during keyboard navigation, filtering out disabled elements.
20
+ */
21
+ getItems$: QRL<() => HTMLElement[]>;
22
+ /**
23
+ * A readonly signal indicating whether the keyboard navigation should wrap around
24
+ * when reaching the first or last item in the group.
25
+ */
26
+ loopFocus: ReadonlySignal<boolean>;
27
+ /**
28
+ * A readonly signal representing the reading direction of the group.
29
+ * This affects how horizontal arrow keys navigate through the items.
30
+ */
31
+ dir: ReadonlySignal<'ltr' | 'rtl'>;
32
+ /**
33
+ * A readonly signal specifying the allowed navigation axes.
34
+ * It determines whether the group responds to horizontal, vertical, or both sets of arrow keys.
35
+ */
36
+ orientation: ReadonlySignal<'horizontal' | 'vertical' | 'both'>;
37
+ }
@@ -0,0 +1,2 @@
1
+ export * from './use-roving-focus-group-root-context';
2
+ export * from './use-roving-focus-group-item-context';
@@ -0,0 +1,2 @@
1
+ export type { UseRovingFocusGroupItemContextReturnValue } from './use-roving-focus-group-item-context.types';
2
+ export { useRovingFocusGroupItemContext } from './use-roving-focus-group-item-context';
@@ -0,0 +1,7 @@
1
+ import type { UseRovingFocusGroupItemContextReturnValue } from './use-roving-focus-group-item-context.types';
2
+ /**
3
+ * A hook that provides access to the `RovingFocusGroup.Item` component's internal state.
4
+ * It exposes readonly signals that allow descendant components to react to the item's
5
+ * active state, its identifier, and whether it is currently focusable within the group.
6
+ */
7
+ export declare const useRovingFocusGroupItemContext: () => UseRovingFocusGroupItemContextReturnValue;
@@ -0,0 +1,13 @@
1
+ import { useContext } from "@qwik.dev/core";
2
+ import { RovingFocusGroupItemContext } from "../../contexts/roving-focus-group-item-context/roving-focus-group-item-context.qwik.mjs";
3
+ const useRovingFocusGroupItemContext = () => {
4
+ const { tabStopId, active, focusable } = useContext(RovingFocusGroupItemContext);
5
+ return {
6
+ tabStopId,
7
+ active,
8
+ focusable
9
+ };
10
+ };
11
+ export {
12
+ useRovingFocusGroupItemContext
13
+ };
@@ -0,0 +1,22 @@
1
+ import type { ReadonlySignal } from '@qwik.dev/core';
2
+ /**
3
+ * The value returned by the `useRovingFocusGroupItemContext` hook.
4
+ * Provides access to the roving focus item's readonly signals for descendant components.
5
+ */
6
+ export interface UseRovingFocusGroupItemContextReturnValue {
7
+ /**
8
+ * A readonly signal whose value is the unique identifier for the specific roving focus item.
9
+ * This ID is used to track and manage the item's active state within the group.
10
+ */
11
+ tabStopId: ReadonlySignal<string>;
12
+ /**
13
+ * A readonly signal whose value indicates whether this specific item is currently the active tab stop.
14
+ * When `true`, the item's `tabIndex` is set to `0`, allowing it to receive keyboard focus.
15
+ */
16
+ active: ReadonlySignal<boolean>;
17
+ /**
18
+ * A readonly signal specifying if the item is capable of receiving focus.
19
+ * When `false`, the item is skipped during navigation and cannot be activated by the user.
20
+ */
21
+ focusable: ReadonlySignal<boolean>;
22
+ }
@@ -0,0 +1,2 @@
1
+ export type { UseRovingFocusGroupRootContextReturnValue } from './use-roving-focus-group-root-context.types';
2
+ export { useRovingFocusGroupRootContext } from './use-roving-focus-group-root-context';
@@ -0,0 +1,8 @@
1
+ import type { UseRovingFocusGroupRootContextReturnValue } from './use-roving-focus-group-root-context.types';
2
+ /**
3
+ * A hook that provides access to the `RovingFocusGroup.Root` component's internal state.
4
+ * It exposes readonly signals and a `QRL` function to interact with the roving focus state,
5
+ * allowing descendant components to synchronize with or programmatically control
6
+ * which item currently holds the tab stop and is eligible for focus.
7
+ */
8
+ export declare const useRovingFocusGroupRootContext: () => UseRovingFocusGroupRootContextReturnValue;
@@ -0,0 +1,13 @@
1
+ import { useContext } from "@qwik.dev/core";
2
+ import { RovingFocusGroupRootContext } from "../../contexts/roving-focus-group-root-context/roving-focus-group-root-context.qwik.mjs";
3
+ const useRovingFocusGroupRootContext = () => {
4
+ const { currentTabStopId, setCurrentTabStopId$, orientation } = useContext(RovingFocusGroupRootContext);
5
+ return {
6
+ currentTabStopId,
7
+ setCurrentTabStopId$,
8
+ orientation
9
+ };
10
+ };
11
+ export {
12
+ useRovingFocusGroupRootContext
13
+ };
@@ -0,0 +1,22 @@
1
+ import type { ReadonlySignal, QRL } from '@qwik.dev/core';
2
+ /**
3
+ * The value returned by the `useRovingFocusGroupRootContext` hook.
4
+ * Provides access to the roving focus group's readonly signals and `QRL` function for descendant components.
5
+ */
6
+ export interface UseRovingFocusGroupRootContextReturnValue {
7
+ /**
8
+ * A readonly signal whose value is a string representing the ID of the item that is currently active.
9
+ * This signal reflects the internal state of which item within the group holds the tab stop.
10
+ */
11
+ currentTabStopId: ReadonlySignal<string>;
12
+ /**
13
+ * A `QRL` function used to programmatically set the active tab stop.
14
+ * This function takes a string representing the ID of the item that should become focusable.
15
+ */
16
+ setCurrentTabStopId$: QRL<(tabStopId: string) => void>;
17
+ /**
18
+ * A readonly signal specifying the allowed navigation axes.
19
+ * It determines whether the group responds to horizontal, vertical, or both sets of arrow keys.
20
+ */
21
+ orientation: ReadonlySignal<'horizontal' | 'vertical' | 'both'>;
22
+ }
@@ -0,0 +1,2 @@
1
+ export * as RovingFocusGroup from './parts';
2
+ export * from './hooks';
@@ -0,0 +1,8 @@
1
+ import * as index from "./parts/index.qwik.mjs";
2
+ import { useRovingFocusGroupRootContext } from "./hooks/use-roving-focus-group-root-context/use-roving-focus-group-root-context.qwik.mjs";
3
+ import { useRovingFocusGroupItemContext } from "./hooks/use-roving-focus-group-item-context/use-roving-focus-group-item-context.qwik.mjs";
4
+ export {
5
+ index as RovingFocusGroup,
6
+ useRovingFocusGroupItemContext,
7
+ useRovingFocusGroupRootContext
8
+ };
@@ -0,0 +1,4 @@
1
+ export type { RovingFocusGroupRootProps as RootProps } from './roving-focus-group-root';
2
+ export type { RovingFocusGroupItemProps as ItemProps } from './roving-focus-group-item';
3
+ export { RovingFocusGroupRoot as Root } from './roving-focus-group-root';
4
+ export { RovingFocusGroupItem as Item } from './roving-focus-group-item';
@@ -0,0 +1,6 @@
1
+ import { RovingFocusGroupRoot } from "./roving-focus-group-root/roving-focus-group-root.qwik.mjs";
2
+ import { RovingFocusGroupItem } from "./roving-focus-group-item/roving-focus-group-item.qwik.mjs";
3
+ export {
4
+ RovingFocusGroupItem as Item,
5
+ RovingFocusGroupRoot as Root
6
+ };
@@ -0,0 +1,2 @@
1
+ export type { RovingFocusGroupItemProps } from './roving-focus-group-item.types';
2
+ export { RovingFocusGroupItem } from './roving-focus-group-item';
@@ -0,0 +1,7 @@
1
+ import type { RovingFocusGroupItemProps } from './roving-focus-group-item.types';
2
+ /**
3
+ * An individual item within the roving focus group.
4
+ *
5
+ * Renders a `<div>` element.
6
+ */
7
+ export declare const RovingFocusGroupItem: import("@qwik.dev/core").Component<RovingFocusGroupItemProps>;
@@ -0,0 +1,160 @@
1
+ import { jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$, useComputed$, useTask$, sync$, $, useContextProvider, Slot } from "@qwik.dev/core";
3
+ import { wrapArray } from "@entry-ui/utilities/wrap-array";
4
+ import { getWindow } from "@entry-ui/utilities/get-window";
5
+ import { focusFirstElement } from "@entry-ui/utilities/focus-first-element";
6
+ import { useId } from "../../../../_internal/hooks/use-id/use-id.qwik.mjs";
7
+ import { Primitive } from "../../../../_internal/components/primitive/primitive.qwik.mjs";
8
+ import { useRovingFocusGroupRootContext } from "../../contexts/roving-focus-group-root-context/roving-focus-group-root-context.qwik.mjs";
9
+ import { RovingFocusGroupItemContext } from "../../contexts/roving-focus-group-item-context/roving-focus-group-item-context.qwik.mjs";
10
+ const RovingFocusGroupItem = component$((props) => {
11
+ const { as = "div", tabStopId: _tabStopId, focusable: _focusable = true, onMouseDown$, onFocus$, onKeyDown$, ...others } = props;
12
+ const { currentTabStopId, setCurrentTabStopId$, getItems$, loopFocus, dir, orientation } = useRovingFocusGroupRootContext();
13
+ const fallbackTabStopId = useId({
14
+ prefix: "entry-ui-qwik-roving-focus-group-item-"
15
+ });
16
+ const tabStopId = useComputed$(() => _tabStopId ?? fallbackTabStopId);
17
+ const active = useComputed$(() => currentTabStopId.value === tabStopId.value);
18
+ const focusable = useComputed$(() => _focusable);
19
+ useTask$(() => {
20
+ if (!currentTabStopId.value && focusable.value) {
21
+ setCurrentTabStopId$(tabStopId.value);
22
+ }
23
+ });
24
+ const handleMouseDownSync$ = sync$((event, currentTarget) => {
25
+ const entryUIQwikEvent = event;
26
+ const isNotFocusable = currentTarget.hasAttribute("disabled") || currentTarget.hasAttribute("data-disabled");
27
+ if (!entryUIQwikEvent.entryUIQwikHandlerPrevented && isNotFocusable) {
28
+ event.preventDefault();
29
+ }
30
+ });
31
+ const handleMouseDown$ = $((event) => {
32
+ const entryUIQwikEvent = event;
33
+ if (!entryUIQwikEvent.entryUIQwikHandlerPrevented && focusable.value) {
34
+ setCurrentTabStopId$(tabStopId.value);
35
+ }
36
+ });
37
+ const handleFocus$ = $((event) => {
38
+ const entryUIQwikEvent = event;
39
+ if (!entryUIQwikEvent.entryUIQwikHandlerPrevented && focusable.value) {
40
+ setCurrentTabStopId$(tabStopId.value);
41
+ }
42
+ });
43
+ const handleKeyDownSync$ = sync$((event, currentTarget) => {
44
+ const entryUIQwikEvent = event;
45
+ const isNotFocusable = currentTarget.hasAttribute("disabled") || currentTarget.hasAttribute("data-disabled");
46
+ if (entryUIQwikEvent.entryUIQwikHandlerPrevented) return;
47
+ if (isNotFocusable) return;
48
+ if (event.target !== currentTarget) return;
49
+ if (event.key === "Tab" && event.shiftKey) return;
50
+ const ORIENTATION_KEYS = {
51
+ horizontal: [
52
+ "ArrowLeft",
53
+ "ArrowRight"
54
+ ],
55
+ vertical: [
56
+ "ArrowUp",
57
+ "ArrowDown"
58
+ ],
59
+ both: [
60
+ "ArrowLeft",
61
+ "ArrowRight",
62
+ "ArrowUp",
63
+ "ArrowDown"
64
+ ]
65
+ };
66
+ const orientation2 = currentTarget.getAttribute("data-orientation");
67
+ if (ORIENTATION_KEYS[orientation2 ?? ""]?.includes(event.key) || [
68
+ "Home",
69
+ "End"
70
+ ].includes(event.key)) {
71
+ if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
72
+ event.preventDefault();
73
+ }
74
+ });
75
+ const handleKeyDown$ = $(async (event, currentTarget) => {
76
+ const entryUIQwikEvent = event;
77
+ if (entryUIQwikEvent.entryUIQwikHandlerPrevented) return;
78
+ if (!focusable.value) return;
79
+ if (event.target !== currentTarget) return;
80
+ if (event.key === "Tab" && event.shiftKey) return;
81
+ let key;
82
+ if (dir.value !== "rtl") {
83
+ key = event.key;
84
+ } else {
85
+ key = event.key === "ArrowLeft" ? "ArrowRight" : event.key === "ArrowRight" ? "ArrowLeft" : event.key;
86
+ }
87
+ if (orientation.value === "horizontal" && [
88
+ "ArrowUp",
89
+ "ArrowDown"
90
+ ].includes(key)) return;
91
+ if (orientation.value === "vertical" && [
92
+ "ArrowLeft",
93
+ "ArrowRight"
94
+ ].includes(key)) return;
95
+ const MAP_KEY_TO_FOCUS_INTENT = {
96
+ ArrowLeft: "prev",
97
+ ArrowUp: "prev",
98
+ ArrowRight: "next",
99
+ ArrowDown: "next",
100
+ Home: "first",
101
+ End: "last"
102
+ };
103
+ const focusIntent = MAP_KEY_TO_FOCUS_INTENT[key];
104
+ if (focusIntent !== void 0) {
105
+ if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
106
+ let items = await getItems$();
107
+ if (focusIntent === "last") {
108
+ items.reverse();
109
+ } else if (focusIntent === "prev" || focusIntent === "next") {
110
+ if (focusIntent === "prev") {
111
+ items.reverse();
112
+ }
113
+ const currentIndex = items.indexOf(currentTarget);
114
+ items = loopFocus.value ? wrapArray({
115
+ array: items,
116
+ startIndex: currentIndex + 1
117
+ }) : items.slice(currentIndex + 1);
118
+ }
119
+ const win = getWindow(currentTarget);
120
+ win.setTimeout(() => {
121
+ focusFirstElement({
122
+ candidates: items,
123
+ focusVisible: true
124
+ });
125
+ }, 0);
126
+ }
127
+ });
128
+ useContextProvider(RovingFocusGroupItemContext, {
129
+ tabStopId,
130
+ active,
131
+ focusable
132
+ });
133
+ return /* @__PURE__ */ jsx(Primitive.div, {
134
+ as,
135
+ tabIndex: active.value ? 0 : -1,
136
+ "data-entry-ui-qwik-roving-focus-group-item": "",
137
+ "data-active": active.value ? "" : void 0,
138
+ "data-disabled": !focusable.value ? "" : void 0,
139
+ "data-orientation": orientation.value,
140
+ onMouseDown$: [
141
+ onMouseDown$,
142
+ handleMouseDownSync$,
143
+ handleMouseDown$
144
+ ],
145
+ onFocus$: [
146
+ onFocus$,
147
+ handleFocus$
148
+ ],
149
+ onKeyDown$: [
150
+ onKeyDown$,
151
+ handleKeyDownSync$,
152
+ handleKeyDown$
153
+ ],
154
+ ...others,
155
+ children: /* @__PURE__ */ jsx(Slot, {})
156
+ });
157
+ });
158
+ export {
159
+ RovingFocusGroupItem
160
+ };
@@ -0,0 +1,29 @@
1
+ import type { PropsOf, Component } from '@qwik.dev/core';
2
+ /**
3
+ * Props for the `RovingFocusGroup.Item` component.
4
+ * Extends the standard HTML attributes for a `div` element.
5
+ */
6
+ export interface RovingFocusGroupItemProps extends PropsOf<'div'> {
7
+ /**
8
+ * The element or component this component should render as.
9
+ *
10
+ * @see {@link https://github.com/ZAHON/entry-ui/tree/main/packages/qwik/docs/guides/composition.md Composition} guide for more details.
11
+ *
12
+ * @default "div"
13
+ */
14
+ as?: string | Component;
15
+ /**
16
+ * A unique value that identifies this item within the roving focus group.
17
+ * If no value is provided, a unique ID will be generated automatically.
18
+ *
19
+ * @default undefined
20
+ */
21
+ tabStopId?: string;
22
+ /**
23
+ * When `false`, prevents the item from becoming active and skips it
24
+ * during keyboard navigation.
25
+ *
26
+ * @default true
27
+ */
28
+ focusable?: boolean;
29
+ }
@@ -0,0 +1,2 @@
1
+ export type { RovingFocusGroupRootProps } from './roving-focus-group-root.types';
2
+ export { RovingFocusGroupRoot } from './roving-focus-group-root';
@@ -0,0 +1,7 @@
1
+ import type { RovingFocusGroupRootProps } from './roving-focus-group-root.types';
2
+ /**
3
+ * Groups all parts of the roving focus group.
4
+ *
5
+ * Renders a `<div>` element.
6
+ */
7
+ export declare const RovingFocusGroupRoot: import("@qwik.dev/core").Component<RovingFocusGroupRootProps>;
@@ -0,0 +1,49 @@
1
+ import { jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$, useSignal, useComputed$, $, useContextProvider, Slot } from "@qwik.dev/core";
3
+ import { useControllable } from "../../../../hooks/use-controllable/use-controllable.qwik.mjs";
4
+ import { mergeRefs } from "../../../../utilities/merge-refs/merge-refs.qwik.mjs";
5
+ import { Primitive } from "../../../../_internal/components/primitive/primitive.qwik.mjs";
6
+ import { RovingFocusGroupRootContext } from "../../contexts/roving-focus-group-root-context/roving-focus-group-root-context.qwik.mjs";
7
+ const RovingFocusGroupRoot = component$((props) => {
8
+ const { as = "div", ref: _ref, defaultCurrentTabStopId, currentTabStopId: _currentTabStopId, onCurrentTabStopIdChange$, loopFocus: _loopFocus = false, dir: _dir = "ltr", orientation: _orientation = "both", ...others } = props;
9
+ const { state: currentTabStopId, setState$: setCurrentTabStopId$ } = useControllable({
10
+ defaultValue: defaultCurrentTabStopId ?? "",
11
+ controlledSignal: _currentTabStopId,
12
+ onChange$: onCurrentTabStopIdChange$
13
+ });
14
+ const ref = useSignal(void 0);
15
+ const loopFocus = useComputed$(() => _loopFocus);
16
+ const dir = useComputed$(() => _dir);
17
+ const orientation = useComputed$(() => _orientation);
18
+ const getItems$ = $(() => {
19
+ const rootRef = ref.value;
20
+ if (!rootRef) return [];
21
+ const ITEM_SELECTOR = "[data-entry-ui-qwik-roving-focus-group-item]";
22
+ const orderedNodes = Array.from(rootRef.querySelectorAll(ITEM_SELECTOR));
23
+ const items = orderedNodes.filter((item) => !(item.hasAttribute("disabled") || item.hasAttribute("data-disabled")));
24
+ return items;
25
+ });
26
+ useContextProvider(RovingFocusGroupRootContext, {
27
+ currentTabStopId,
28
+ setCurrentTabStopId$,
29
+ getItems$,
30
+ loopFocus,
31
+ dir,
32
+ orientation
33
+ });
34
+ return /* @__PURE__ */ jsx(Primitive.div, {
35
+ as,
36
+ ref: mergeRefs([
37
+ _ref,
38
+ ref
39
+ ]),
40
+ dir: dir.value,
41
+ "data-entry-ui-qwik-roving-focus-group-root": "",
42
+ "data-orientation": orientation.value,
43
+ ...others,
44
+ children: /* @__PURE__ */ jsx(Slot, {})
45
+ });
46
+ });
47
+ export {
48
+ RovingFocusGroupRoot
49
+ };
@@ -0,0 +1,59 @@
1
+ import type { Component, Signal, QRL, PropsOf } from '@qwik.dev/core';
2
+ /**
3
+ * Props for the `RovingFocusGroup.Root` component.
4
+ * Extends the standard HTML attributes for a `div` element.
5
+ */
6
+ export interface RovingFocusGroupRootProps extends PropsOf<'div'> {
7
+ /**
8
+ * The element or component this component should render as.
9
+ *
10
+ * @see {@link https://github.com/ZAHON/entry-ui/tree/main/packages/qwik/docs/guides/composition.md Composition} guide for more details.
11
+ *
12
+ * @default "div"
13
+ */
14
+ as?: string | Component;
15
+ /**
16
+ * The ID of the item that should be active when initially rendered.
17
+ * Use when you do not need to control the state of the active item.
18
+ *
19
+ * @default undefined
20
+ */
21
+ defaultCurrentTabStopId?: string;
22
+ /**
23
+ * The controlled value of the item ID to activate.
24
+ * Must be used in conjunction with `onCurrentTabStopIdChange$`.
25
+ *
26
+ * @default undefined
27
+ */
28
+ currentTabStopId?: Signal<string>;
29
+ /**
30
+ * A `QRL` callback function that is called when the active tab stop changes.
31
+ *
32
+ * @default undefined
33
+ */
34
+ onCurrentTabStopIdChange$?: QRL<(tabStopId: string) => void>;
35
+ /**
36
+ * Whether the keyboard focus should wrap around to the first or last item
37
+ * when navigating past the boundaries of the group.
38
+ *
39
+ * @default false
40
+ */
41
+ loopFocus?: boolean;
42
+ /**
43
+ * The reading direction of the group.
44
+ * When set to `"rtl"`, the behavior of the left and right arrow keys is swapped.
45
+ *
46
+ * @default "ltr"
47
+ */
48
+ dir?: 'ltr' | 'rtl';
49
+ /**
50
+ * The orientation of the group, which determines which arrow keys can be used for navigation.
51
+ *
52
+ * - `"horizontal"`: Only `ArrowLeft` and `ArrowRight` are active.
53
+ * - `"vertical"`: Only `ArrowUp` and `ArrowDown` are active.
54
+ * - `"both"`: All arrow keys are active.
55
+ *
56
+ * @default "both"
57
+ */
58
+ orientation?: 'horizontal' | 'vertical' | 'both';
59
+ }
@@ -0,0 +1,4 @@
1
+ export * from './tabs-root-context';
2
+ export * from './tabs-list-context';
3
+ export * from './tabs-tab-context';
4
+ export * from './tabs-panel-context';
@@ -0,0 +1,2 @@
1
+ export type { TabsListContextValue } from './tabs-list-context.types';
2
+ export { TabsListContext, useTabsListContext } from './tabs-list-context';
@@ -0,0 +1,11 @@
1
+ import type { TabsListContextValue } from './tabs-list-context.types';
2
+ /**
3
+ * Provides the context for the `Tabs.List` component, allowing descendant
4
+ * components to access readonly signal without prop drilling.
5
+ */
6
+ export declare const TabsListContext: import("@qwik.dev/core").ContextId<TabsListContextValue>;
7
+ /**
8
+ * A hook that provides access to the `Tabs.List` component's internal state.
9
+ * It exposes readonly signal to interact with the component's state,
10
+ */
11
+ export declare const useTabsListContext: () => TabsListContextValue;
@@ -0,0 +1,10 @@
1
+ import { createContextId, useContext } from "@qwik.dev/core";
2
+ const TabsListContext = createContextId("entry-ui-qwik-tabs-list-context");
3
+ const useTabsListContext = () => {
4
+ const context = useContext(TabsListContext);
5
+ return context;
6
+ };
7
+ export {
8
+ TabsListContext,
9
+ useTabsListContext
10
+ };
@@ -0,0 +1,12 @@
1
+ import type { ReadonlySignal } from '@qwik.dev/core';
2
+ /**
3
+ * The value provided by the `TabsListContext` context.
4
+ * Contains the readonly signal shared with descendant components.
5
+ */
6
+ export interface TabsListContextValue {
7
+ /**
8
+ * A readonly signal whose value determines whether tabs are activated
9
+ * automatically on focus or manually on click/selection.
10
+ */
11
+ activationMode: ReadonlySignal<'automatic' | 'manual'>;
12
+ }
@@ -0,0 +1,2 @@
1
+ export type { TabsPanelContextValue } from './tabs-panel-context.types';
2
+ export { TabsPanelContext } from './tabs-panel-context';
@@ -0,0 +1,6 @@
1
+ import type { TabsPanelContextValue } from './tabs-panel-context.types';
2
+ /**
3
+ * Provides the context for the `Tabs.Tab` component, allowing descendant
4
+ * components to access readonly signal without prop drilling.
5
+ */
6
+ export declare const TabsPanelContext: import("@qwik.dev/core").ContextId<TabsPanelContextValue>;
@@ -0,0 +1,5 @@
1
+ import { createContextId } from "@qwik.dev/core";
2
+ const TabsPanelContext = createContextId("entry-ui-qwik-tabs-panel-context");
3
+ export {
4
+ TabsPanelContext
5
+ };
@@ -0,0 +1,12 @@
1
+ import type { ReadonlySignal } from '@qwik.dev/core';
2
+ /**
3
+ * The value provided by the `TabsPanelContext` context.
4
+ * Contains the readonly signal shared with descendant components.
5
+ */
6
+ export interface TabsPanelContextValue {
7
+ /**
8
+ * A readonly signal whose value indicates whether the panel is currently active
9
+ * and visible to the user, based on the selection state of its associated tab.
10
+ */
11
+ active: ReadonlySignal<boolean>;
12
+ }
@@ -0,0 +1,2 @@
1
+ export type { TabsRootContextValue } from './tabs-root-context.types';
2
+ export { TabsRootContext, useTabsRootContext } from './tabs-root-context';
@@ -0,0 +1,11 @@
1
+ import type { TabsRootContextValue } from './tabs-root-context.types';
2
+ /**
3
+ * Provides the context for the `Tabs.Root` component, allowing descendant
4
+ * components to access readonly signals and `QRL` function without prop drilling.
5
+ */
6
+ export declare const TabsRootContext: import("@qwik.dev/core").ContextId<TabsRootContextValue>;
7
+ /**
8
+ * A hook that provides access to the `Tabs.Root` component's internal state.
9
+ * It exposes readonly signals and `QRL` function to interact with the component's state,
10
+ */
11
+ export declare const useTabsRootContext: () => TabsRootContextValue;
@@ -0,0 +1,10 @@
1
+ import { createContextId, useContext } from "@qwik.dev/core";
2
+ const TabsRootContext = createContextId("entry-ui-qwik-tabs-root-context");
3
+ const useTabsRootContext = () => {
4
+ const context = useContext(TabsRootContext);
5
+ return context;
6
+ };
7
+ export {
8
+ TabsRootContext,
9
+ useTabsRootContext
10
+ };
@@ -0,0 +1,33 @@
1
+ import type { ReadonlySignal, QRL } from '@qwik.dev/core';
2
+ /**
3
+ * The value provided by the `TabsRootContext` context.
4
+ * Contains the readonly signals and `QRL` function shared with descendant components.
5
+ */
6
+ export interface TabsRootContextValue {
7
+ /**
8
+ * A readonly signal whose value represents the unique identifier of the currently active tab.
9
+ * This signal reflects the internal state and determines which tab panel is currently visible.
10
+ */
11
+ value: ReadonlySignal<string>;
12
+ /**
13
+ * A `QRL` function used to programmatically set the active value of the tabs.
14
+ * This function takes a string representing the value of the tab to be activated.
15
+ */
16
+ setValue$: QRL<(value: string) => void>;
17
+ /**
18
+ * A unique identifier for the tabs.
19
+ * This ID is used to generate consistent, unique sub-identifiers for child components
20
+ * (e.g., tabs and panels) to ensure proper WAI-ARIA accessibility mapping.
21
+ */
22
+ id: string;
23
+ /**
24
+ * A readonly signal whose value represents the reading direction of the tabs.
25
+ * This value (either `"ltr"` or `"rtl"`) affects keyboard navigation and visual layout.
26
+ */
27
+ dir: ReadonlySignal<'ltr' | 'rtl'>;
28
+ /**
29
+ * A readonly signal whose value represents the orientation of the tabs.
30
+ * This value (either `"horizontal"` or `"vertical"`) determines how keyboard navigation and focus management are handled.
31
+ */
32
+ orientation: ReadonlySignal<'horizontal' | 'vertical'>;
33
+ }
@@ -0,0 +1,2 @@
1
+ export type { TabsTabContextValue } from './tabs-tab-context.types';
2
+ export { TabsTabContext } from './tabs-tab-context';