@entry-ui/qwik 0.8.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.
- package/lib/_internal/components/collapsible-panel/collapsible-panel.d.ts +13 -0
- package/lib/_internal/components/collapsible-panel/collapsible-panel.qwik.mjs +195 -0
- package/lib/_internal/components/collapsible-panel/collapsible-panel.types.d.ts +62 -0
- package/lib/_internal/components/collapsible-panel/index.d.ts +2 -0
- package/lib/_internal/components/index.d.ts +2 -0
- package/lib/_internal/components/indicator/index.d.ts +2 -0
- package/lib/_internal/components/indicator/indicator.d.ts +11 -0
- package/lib/_internal/components/indicator/indicator.qwik.mjs +27 -0
- package/lib/_internal/components/indicator/indicator.types.d.ts +15 -0
- package/lib/components/accordion/parts/accordion-item-indicator/accordion-item-indicator.qwik.mjs +4 -12
- package/lib/components/accordion/parts/accordion-item-panel/accordion-item-panel.qwik.mjs +10 -169
- package/lib/components/accordion/parts/accordion-root/accordion-root.qwik.mjs +6 -19
- package/lib/components/collapsible/parts/collapsible-indicator/collapsible-indicator.qwik.mjs +4 -12
- package/lib/components/collapsible/parts/collapsible-panel/collapsible-panel.qwik.mjs +10 -164
- package/lib/components/collapsible/parts/collapsible-root/collapsible-root.qwik.mjs +1 -18
- package/lib/components/copy-button/parts/copy-button-indicator/copy-button-indicator.qwik.mjs +3 -12
- package/lib/components/index.d.ts +2 -0
- package/lib/components/roving-focus-group/contexts/index.d.ts +2 -0
- package/lib/components/roving-focus-group/contexts/roving-focus-group-item-context/index.d.ts +2 -0
- package/lib/components/roving-focus-group/contexts/roving-focus-group-item-context/roving-focus-group-item-context.d.ts +6 -0
- package/lib/components/roving-focus-group/contexts/roving-focus-group-item-context/roving-focus-group-item-context.qwik.mjs +5 -0
- package/lib/components/roving-focus-group/contexts/roving-focus-group-item-context/roving-focus-group-item-context.types.d.ts +22 -0
- package/lib/components/roving-focus-group/contexts/roving-focus-group-root-context/index.d.ts +2 -0
- package/lib/components/roving-focus-group/contexts/roving-focus-group-root-context/roving-focus-group-root-context.d.ts +11 -0
- package/lib/components/roving-focus-group/contexts/roving-focus-group-root-context/roving-focus-group-root-context.qwik.mjs +10 -0
- package/lib/components/roving-focus-group/contexts/roving-focus-group-root-context/roving-focus-group-root-context.types.d.ts +37 -0
- package/lib/components/roving-focus-group/hooks/index.d.ts +2 -0
- package/lib/components/roving-focus-group/hooks/use-roving-focus-group-item-context/index.d.ts +2 -0
- package/lib/components/roving-focus-group/hooks/use-roving-focus-group-item-context/use-roving-focus-group-item-context.d.ts +7 -0
- package/lib/components/roving-focus-group/hooks/use-roving-focus-group-item-context/use-roving-focus-group-item-context.qwik.mjs +13 -0
- package/lib/components/roving-focus-group/hooks/use-roving-focus-group-item-context/use-roving-focus-group-item-context.types.d.ts +22 -0
- package/lib/components/roving-focus-group/hooks/use-roving-focus-group-root-context/index.d.ts +2 -0
- package/lib/components/roving-focus-group/hooks/use-roving-focus-group-root-context/use-roving-focus-group-root-context.d.ts +8 -0
- package/lib/components/roving-focus-group/hooks/use-roving-focus-group-root-context/use-roving-focus-group-root-context.qwik.mjs +13 -0
- package/lib/components/roving-focus-group/hooks/use-roving-focus-group-root-context/use-roving-focus-group-root-context.types.d.ts +22 -0
- package/lib/components/roving-focus-group/index.d.ts +2 -0
- package/lib/components/roving-focus-group/index.qwik.mjs +8 -0
- package/lib/components/roving-focus-group/parts/index.d.ts +4 -0
- package/lib/components/roving-focus-group/parts/index.qwik.mjs +6 -0
- package/lib/components/roving-focus-group/parts/roving-focus-group-item/index.d.ts +2 -0
- package/lib/components/roving-focus-group/parts/roving-focus-group-item/roving-focus-group-item.d.ts +7 -0
- package/lib/components/roving-focus-group/parts/roving-focus-group-item/roving-focus-group-item.qwik.mjs +160 -0
- package/lib/components/roving-focus-group/parts/roving-focus-group-item/roving-focus-group-item.types.d.ts +29 -0
- package/lib/components/roving-focus-group/parts/roving-focus-group-root/index.d.ts +2 -0
- package/lib/components/roving-focus-group/parts/roving-focus-group-root/roving-focus-group-root.d.ts +7 -0
- package/lib/components/roving-focus-group/parts/roving-focus-group-root/roving-focus-group-root.qwik.mjs +49 -0
- package/lib/components/roving-focus-group/parts/roving-focus-group-root/roving-focus-group-root.types.d.ts +59 -0
- package/lib/components/tabs/contexts/index.d.ts +4 -0
- package/lib/components/tabs/contexts/tabs-list-context/index.d.ts +2 -0
- package/lib/components/tabs/contexts/tabs-list-context/tabs-list-context.d.ts +11 -0
- package/lib/components/tabs/contexts/tabs-list-context/tabs-list-context.qwik.mjs +10 -0
- package/lib/components/tabs/contexts/tabs-list-context/tabs-list-context.types.d.ts +12 -0
- package/lib/components/tabs/contexts/tabs-panel-context/index.d.ts +2 -0
- package/lib/components/tabs/contexts/tabs-panel-context/tabs-panel-context.d.ts +6 -0
- package/lib/components/tabs/contexts/tabs-panel-context/tabs-panel-context.qwik.mjs +5 -0
- package/lib/components/tabs/contexts/tabs-panel-context/tabs-panel-context.types.d.ts +12 -0
- package/lib/components/tabs/contexts/tabs-root-context/index.d.ts +2 -0
- package/lib/components/tabs/contexts/tabs-root-context/tabs-root-context.d.ts +11 -0
- package/lib/components/tabs/contexts/tabs-root-context/tabs-root-context.qwik.mjs +10 -0
- package/lib/components/tabs/contexts/tabs-root-context/tabs-root-context.types.d.ts +33 -0
- package/lib/components/tabs/contexts/tabs-tab-context/index.d.ts +2 -0
- package/lib/components/tabs/contexts/tabs-tab-context/tabs-tab-context.d.ts +6 -0
- package/lib/components/tabs/contexts/tabs-tab-context/tabs-tab-context.qwik.mjs +5 -0
- package/lib/components/tabs/contexts/tabs-tab-context/tabs-tab-context.types.d.ts +22 -0
- package/lib/components/tabs/hooks/index.d.ts +3 -0
- package/lib/components/tabs/hooks/use-tabs-panel-context/index.d.ts +2 -0
- package/lib/components/tabs/hooks/use-tabs-panel-context/use-tabs-panel-context.d.ts +8 -0
- package/lib/components/tabs/hooks/use-tabs-panel-context/use-tabs-panel-context.qwik.mjs +11 -0
- package/lib/components/tabs/hooks/use-tabs-panel-context/use-tabs-panel-context.types.d.ts +12 -0
- package/lib/components/tabs/hooks/use-tabs-root-context/index.d.ts +2 -0
- package/lib/components/tabs/hooks/use-tabs-root-context/use-tabs-root-context.d.ts +8 -0
- package/lib/components/tabs/hooks/use-tabs-root-context/use-tabs-root-context.qwik.mjs +13 -0
- package/lib/components/tabs/hooks/use-tabs-root-context/use-tabs-root-context.types.d.ts +22 -0
- package/lib/components/tabs/hooks/use-tabs-tab-context/index.d.ts +2 -0
- package/lib/components/tabs/hooks/use-tabs-tab-context/use-tabs-tab-context.d.ts +7 -0
- package/lib/components/tabs/hooks/use-tabs-tab-context/use-tabs-tab-context.qwik.mjs +13 -0
- package/lib/components/tabs/hooks/use-tabs-tab-context/use-tabs-tab-context.types.d.ts +22 -0
- package/lib/components/tabs/index.d.ts +2 -0
- package/lib/components/tabs/index.qwik.mjs +10 -0
- package/lib/components/tabs/parts/index.d.ts +8 -0
- package/lib/components/tabs/parts/index.qwik.mjs +10 -0
- package/lib/components/tabs/parts/tabs-list/index.d.ts +2 -0
- package/lib/components/tabs/parts/tabs-list/tabs-list.d.ts +7 -0
- package/lib/components/tabs/parts/tabs-list/tabs-list.qwik.mjs +37 -0
- package/lib/components/tabs/parts/tabs-list/tabs-list.types.d.ts +30 -0
- package/lib/components/tabs/parts/tabs-panel/index.d.ts +2 -0
- package/lib/components/tabs/parts/tabs-panel/tabs-panel.d.ts +7 -0
- package/lib/components/tabs/parts/tabs-panel/tabs-panel.qwik.mjs +39 -0
- package/lib/components/tabs/parts/tabs-panel/tabs-panel.types.d.ts +27 -0
- package/lib/components/tabs/parts/tabs-root/index.d.ts +2 -0
- package/lib/components/tabs/parts/tabs-root/tabs-root.d.ts +7 -0
- package/lib/components/tabs/parts/tabs-root/tabs-root.qwik.mjs +34 -0
- package/lib/components/tabs/parts/tabs-root/tabs-root.types.d.ts +50 -0
- package/lib/components/tabs/parts/tabs-tab/index.d.ts +2 -0
- package/lib/components/tabs/parts/tabs-tab/tabs-tab.d.ts +7 -0
- package/lib/components/tabs/parts/tabs-tab/tabs-tab.qwik.mjs +87 -0
- package/lib/components/tabs/parts/tabs-tab/tabs-tab.types.d.ts +25 -0
- package/lib/hooks/use-clipboard/use-clipboard.qwik.mjs +8 -2
- package/lib/index.qwik.mjs +18 -4
- package/package.json +10 -2
|
@@ -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
|
+
}
|
package/lib/components/roving-focus-group/parts/roving-focus-group-root/roving-focus-group-root.d.ts
ADDED
|
@@ -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,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,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,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,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,6 @@
|
|
|
1
|
+
import type { TabsTabContextValue } from './tabs-tab-context.types';
|
|
2
|
+
/**
|
|
3
|
+
* Provides the context for the `Tabs.Tab` component, allowing descendant
|
|
4
|
+
* components to access readonly signals without prop drilling.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TabsTabContext: import("@qwik.dev/core").ContextId<TabsTabContextValue>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReadonlySignal } from '@qwik.dev/core';
|
|
2
|
+
/**
|
|
3
|
+
* The value provided by the `TabsTabContext` context.
|
|
4
|
+
* Contains the readonly signals shared with descendant components.
|
|
5
|
+
*/
|
|
6
|
+
export interface TabsTabContextValue {
|
|
7
|
+
/**
|
|
8
|
+
* A readonly signal containing the unique value associated with the tab.
|
|
9
|
+
* This value connects the tab to its corresponding panel.
|
|
10
|
+
*/
|
|
11
|
+
value: ReadonlySignal<string>;
|
|
12
|
+
/**
|
|
13
|
+
* A readonly signal whose value indicates whether the tab is currently active,
|
|
14
|
+
* meaning its associated panel is being displayed.
|
|
15
|
+
*/
|
|
16
|
+
active: ReadonlySignal<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* A readonly signal that indicates whether the tab is disabled.
|
|
19
|
+
* Its value is `true` if the tab is disabled, preventing user interaction.
|
|
20
|
+
*/
|
|
21
|
+
disabled: ReadonlySignal<boolean>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UseTabsPanelContextReturnValue } from './use-tabs-panel-context.types';
|
|
2
|
+
/**
|
|
3
|
+
* A hook that provides access to the `Tabs.Panel` component's internal state.
|
|
4
|
+
* It exposes a readonly signal that allows descendant components to react to
|
|
5
|
+
* the panel's activation state, synchronizing their behavior or styles based
|
|
6
|
+
* on whether the panel is currently visible.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useTabsPanelContext: () => UseTabsPanelContextReturnValue;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext } from "@qwik.dev/core";
|
|
2
|
+
import { TabsPanelContext } from "../../contexts/tabs-panel-context/tabs-panel-context.qwik.mjs";
|
|
3
|
+
const useTabsPanelContext = () => {
|
|
4
|
+
const { active } = useContext(TabsPanelContext);
|
|
5
|
+
return {
|
|
6
|
+
active
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
useTabsPanelContext
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReadonlySignal } from '@qwik.dev/core';
|
|
2
|
+
/**
|
|
3
|
+
* The value returned by the `useTabsPanelContext` hook.
|
|
4
|
+
* Provides access to the specific tab panel's readonly signal for descendant components.
|
|
5
|
+
*/
|
|
6
|
+
export interface UseTabsPanelContextReturnValue {
|
|
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,8 @@
|
|
|
1
|
+
import type { UseTabsRootContextReturnValue } from './use-tabs-root-context.types';
|
|
2
|
+
/**
|
|
3
|
+
* A hook that provides access to the `Tabs.Root` component's internal state.
|
|
4
|
+
* It exposes readonly signals and a `QRL` function to interact with the tabs state,
|
|
5
|
+
* allowing descendant components to synchronize with or programmatically control
|
|
6
|
+
* which tab is currently active, while respecting the defined orientation.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useTabsRootContext: () => UseTabsRootContextReturnValue;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext } from "@qwik.dev/core";
|
|
2
|
+
import { TabsRootContext } from "../../contexts/tabs-root-context/tabs-root-context.qwik.mjs";
|
|
3
|
+
const useTabsRootContext = () => {
|
|
4
|
+
const { value, setValue$, orientation } = useContext(TabsRootContext);
|
|
5
|
+
return {
|
|
6
|
+
value,
|
|
7
|
+
setValue$,
|
|
8
|
+
orientation
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
useTabsRootContext
|
|
13
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReadonlySignal, QRL } from '@qwik.dev/core';
|
|
2
|
+
/**
|
|
3
|
+
* The value returned by the `useTabsRootContext` hook.
|
|
4
|
+
* Provides access to the tabs readonly signals and `QRL` function for descendant components.
|
|
5
|
+
*/
|
|
6
|
+
export interface UseTabsRootContextReturnValue {
|
|
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 readonly signal whose value represents the orientation of the tabs.
|
|
19
|
+
* This value (either `"horizontal"` or `"vertical"`) determines how keyboard navigation and focus management are handled.
|
|
20
|
+
*/
|
|
21
|
+
orientation: ReadonlySignal<'horizontal' | 'vertical'>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UseTabsTabContextReturnValue } from './use-tabs-tab-context.types';
|
|
2
|
+
/**
|
|
3
|
+
* A hook that provides access to the `Tabs.Tab` component's internal state.
|
|
4
|
+
* It exposes readonly signals that allow descendant components to react to the tab's
|
|
5
|
+
* unique value, its current activation state, and its disabled status.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useTabsTabContext: () => UseTabsTabContextReturnValue;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext } from "@qwik.dev/core";
|
|
2
|
+
import { TabsTabContext } from "../../contexts/tabs-tab-context/tabs-tab-context.qwik.mjs";
|
|
3
|
+
const useTabsTabContext = () => {
|
|
4
|
+
const { value, active, disabled } = useContext(TabsTabContext);
|
|
5
|
+
return {
|
|
6
|
+
value,
|
|
7
|
+
active,
|
|
8
|
+
disabled
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
useTabsTabContext
|
|
13
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReadonlySignal } from '@qwik.dev/core';
|
|
2
|
+
/**
|
|
3
|
+
* The value returned by the `useTabsTabContext` hook.
|
|
4
|
+
* Provides access to the specific tab's readonly signals for descendant components.
|
|
5
|
+
*/
|
|
6
|
+
export interface UseTabsTabContextReturnValue {
|
|
7
|
+
/**
|
|
8
|
+
* A readonly signal containing the unique value associated with the tab.
|
|
9
|
+
* This value connects the tab to its corresponding panel.
|
|
10
|
+
*/
|
|
11
|
+
value: ReadonlySignal<string>;
|
|
12
|
+
/**
|
|
13
|
+
* A readonly signal whose value indicates whether the tab is currently active,
|
|
14
|
+
* meaning its associated panel is being displayed.
|
|
15
|
+
*/
|
|
16
|
+
active: ReadonlySignal<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* A readonly signal that indicates whether the tab is disabled.
|
|
19
|
+
* Its value is `true` if the tab is disabled, preventing user interaction.
|
|
20
|
+
*/
|
|
21
|
+
disabled: ReadonlySignal<boolean>;
|
|
22
|
+
}
|