@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.
Files changed (100) 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/parts/copy-button-indicator/copy-button-indicator.qwik.mjs +3 -12
  17. package/lib/components/index.d.ts +2 -0
  18. package/lib/components/roving-focus-group/contexts/index.d.ts +2 -0
  19. package/lib/components/roving-focus-group/contexts/roving-focus-group-item-context/index.d.ts +2 -0
  20. package/lib/components/roving-focus-group/contexts/roving-focus-group-item-context/roving-focus-group-item-context.d.ts +6 -0
  21. package/lib/components/roving-focus-group/contexts/roving-focus-group-item-context/roving-focus-group-item-context.qwik.mjs +5 -0
  22. package/lib/components/roving-focus-group/contexts/roving-focus-group-item-context/roving-focus-group-item-context.types.d.ts +22 -0
  23. package/lib/components/roving-focus-group/contexts/roving-focus-group-root-context/index.d.ts +2 -0
  24. package/lib/components/roving-focus-group/contexts/roving-focus-group-root-context/roving-focus-group-root-context.d.ts +11 -0
  25. package/lib/components/roving-focus-group/contexts/roving-focus-group-root-context/roving-focus-group-root-context.qwik.mjs +10 -0
  26. package/lib/components/roving-focus-group/contexts/roving-focus-group-root-context/roving-focus-group-root-context.types.d.ts +37 -0
  27. package/lib/components/roving-focus-group/hooks/index.d.ts +2 -0
  28. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-item-context/index.d.ts +2 -0
  29. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-item-context/use-roving-focus-group-item-context.d.ts +7 -0
  30. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-item-context/use-roving-focus-group-item-context.qwik.mjs +13 -0
  31. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-item-context/use-roving-focus-group-item-context.types.d.ts +22 -0
  32. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-root-context/index.d.ts +2 -0
  33. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-root-context/use-roving-focus-group-root-context.d.ts +8 -0
  34. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-root-context/use-roving-focus-group-root-context.qwik.mjs +13 -0
  35. package/lib/components/roving-focus-group/hooks/use-roving-focus-group-root-context/use-roving-focus-group-root-context.types.d.ts +22 -0
  36. package/lib/components/roving-focus-group/index.d.ts +2 -0
  37. package/lib/components/roving-focus-group/index.qwik.mjs +8 -0
  38. package/lib/components/roving-focus-group/parts/index.d.ts +4 -0
  39. package/lib/components/roving-focus-group/parts/index.qwik.mjs +6 -0
  40. package/lib/components/roving-focus-group/parts/roving-focus-group-item/index.d.ts +2 -0
  41. package/lib/components/roving-focus-group/parts/roving-focus-group-item/roving-focus-group-item.d.ts +7 -0
  42. package/lib/components/roving-focus-group/parts/roving-focus-group-item/roving-focus-group-item.qwik.mjs +160 -0
  43. package/lib/components/roving-focus-group/parts/roving-focus-group-item/roving-focus-group-item.types.d.ts +29 -0
  44. package/lib/components/roving-focus-group/parts/roving-focus-group-root/index.d.ts +2 -0
  45. package/lib/components/roving-focus-group/parts/roving-focus-group-root/roving-focus-group-root.d.ts +7 -0
  46. package/lib/components/roving-focus-group/parts/roving-focus-group-root/roving-focus-group-root.qwik.mjs +49 -0
  47. package/lib/components/roving-focus-group/parts/roving-focus-group-root/roving-focus-group-root.types.d.ts +59 -0
  48. package/lib/components/tabs/contexts/index.d.ts +4 -0
  49. package/lib/components/tabs/contexts/tabs-list-context/index.d.ts +2 -0
  50. package/lib/components/tabs/contexts/tabs-list-context/tabs-list-context.d.ts +11 -0
  51. package/lib/components/tabs/contexts/tabs-list-context/tabs-list-context.qwik.mjs +10 -0
  52. package/lib/components/tabs/contexts/tabs-list-context/tabs-list-context.types.d.ts +12 -0
  53. package/lib/components/tabs/contexts/tabs-panel-context/index.d.ts +2 -0
  54. package/lib/components/tabs/contexts/tabs-panel-context/tabs-panel-context.d.ts +6 -0
  55. package/lib/components/tabs/contexts/tabs-panel-context/tabs-panel-context.qwik.mjs +5 -0
  56. package/lib/components/tabs/contexts/tabs-panel-context/tabs-panel-context.types.d.ts +12 -0
  57. package/lib/components/tabs/contexts/tabs-root-context/index.d.ts +2 -0
  58. package/lib/components/tabs/contexts/tabs-root-context/tabs-root-context.d.ts +11 -0
  59. package/lib/components/tabs/contexts/tabs-root-context/tabs-root-context.qwik.mjs +10 -0
  60. package/lib/components/tabs/contexts/tabs-root-context/tabs-root-context.types.d.ts +33 -0
  61. package/lib/components/tabs/contexts/tabs-tab-context/index.d.ts +2 -0
  62. package/lib/components/tabs/contexts/tabs-tab-context/tabs-tab-context.d.ts +6 -0
  63. package/lib/components/tabs/contexts/tabs-tab-context/tabs-tab-context.qwik.mjs +5 -0
  64. package/lib/components/tabs/contexts/tabs-tab-context/tabs-tab-context.types.d.ts +22 -0
  65. package/lib/components/tabs/hooks/index.d.ts +3 -0
  66. package/lib/components/tabs/hooks/use-tabs-panel-context/index.d.ts +2 -0
  67. package/lib/components/tabs/hooks/use-tabs-panel-context/use-tabs-panel-context.d.ts +8 -0
  68. package/lib/components/tabs/hooks/use-tabs-panel-context/use-tabs-panel-context.qwik.mjs +11 -0
  69. package/lib/components/tabs/hooks/use-tabs-panel-context/use-tabs-panel-context.types.d.ts +12 -0
  70. package/lib/components/tabs/hooks/use-tabs-root-context/index.d.ts +2 -0
  71. package/lib/components/tabs/hooks/use-tabs-root-context/use-tabs-root-context.d.ts +8 -0
  72. package/lib/components/tabs/hooks/use-tabs-root-context/use-tabs-root-context.qwik.mjs +13 -0
  73. package/lib/components/tabs/hooks/use-tabs-root-context/use-tabs-root-context.types.d.ts +22 -0
  74. package/lib/components/tabs/hooks/use-tabs-tab-context/index.d.ts +2 -0
  75. package/lib/components/tabs/hooks/use-tabs-tab-context/use-tabs-tab-context.d.ts +7 -0
  76. package/lib/components/tabs/hooks/use-tabs-tab-context/use-tabs-tab-context.qwik.mjs +13 -0
  77. package/lib/components/tabs/hooks/use-tabs-tab-context/use-tabs-tab-context.types.d.ts +22 -0
  78. package/lib/components/tabs/index.d.ts +2 -0
  79. package/lib/components/tabs/index.qwik.mjs +10 -0
  80. package/lib/components/tabs/parts/index.d.ts +8 -0
  81. package/lib/components/tabs/parts/index.qwik.mjs +10 -0
  82. package/lib/components/tabs/parts/tabs-list/index.d.ts +2 -0
  83. package/lib/components/tabs/parts/tabs-list/tabs-list.d.ts +7 -0
  84. package/lib/components/tabs/parts/tabs-list/tabs-list.qwik.mjs +37 -0
  85. package/lib/components/tabs/parts/tabs-list/tabs-list.types.d.ts +30 -0
  86. package/lib/components/tabs/parts/tabs-panel/index.d.ts +2 -0
  87. package/lib/components/tabs/parts/tabs-panel/tabs-panel.d.ts +7 -0
  88. package/lib/components/tabs/parts/tabs-panel/tabs-panel.qwik.mjs +39 -0
  89. package/lib/components/tabs/parts/tabs-panel/tabs-panel.types.d.ts +27 -0
  90. package/lib/components/tabs/parts/tabs-root/index.d.ts +2 -0
  91. package/lib/components/tabs/parts/tabs-root/tabs-root.d.ts +7 -0
  92. package/lib/components/tabs/parts/tabs-root/tabs-root.qwik.mjs +34 -0
  93. package/lib/components/tabs/parts/tabs-root/tabs-root.types.d.ts +50 -0
  94. package/lib/components/tabs/parts/tabs-tab/index.d.ts +2 -0
  95. package/lib/components/tabs/parts/tabs-tab/tabs-tab.d.ts +7 -0
  96. package/lib/components/tabs/parts/tabs-tab/tabs-tab.qwik.mjs +87 -0
  97. package/lib/components/tabs/parts/tabs-tab/tabs-tab.types.d.ts +25 -0
  98. package/lib/hooks/use-clipboard/use-clipboard.qwik.mjs +8 -2
  99. package/lib/index.qwik.mjs +18 -4
  100. package/package.json +10 -2
@@ -0,0 +1,10 @@
1
+ import * as index from "./parts/index.qwik.mjs";
2
+ import { useTabsRootContext } from "./hooks/use-tabs-root-context/use-tabs-root-context.qwik.mjs";
3
+ import { useTabsTabContext } from "./hooks/use-tabs-tab-context/use-tabs-tab-context.qwik.mjs";
4
+ import { useTabsPanelContext } from "./hooks/use-tabs-panel-context/use-tabs-panel-context.qwik.mjs";
5
+ export {
6
+ index as Tabs,
7
+ useTabsPanelContext,
8
+ useTabsRootContext,
9
+ useTabsTabContext
10
+ };
@@ -0,0 +1,8 @@
1
+ export type { TabsRootProps as RootProps } from './tabs-root';
2
+ export type { TabsListProps as ListProps } from './tabs-list';
3
+ export type { TabsTabProps as TabProps } from './tabs-tab';
4
+ export type { TabsPanelProps as PanelProps } from './tabs-panel';
5
+ export { TabsRoot as Root } from './tabs-root';
6
+ export { TabsList as List } from './tabs-list';
7
+ export { TabsTab as Tab } from './tabs-tab';
8
+ export { TabsPanel as Panel } from './tabs-panel';
@@ -0,0 +1,10 @@
1
+ import { TabsRoot } from "./tabs-root/tabs-root.qwik.mjs";
2
+ import { TabsList } from "./tabs-list/tabs-list.qwik.mjs";
3
+ import { TabsTab } from "./tabs-tab/tabs-tab.qwik.mjs";
4
+ import { TabsPanel } from "./tabs-panel/tabs-panel.qwik.mjs";
5
+ export {
6
+ TabsList as List,
7
+ TabsPanel as Panel,
8
+ TabsRoot as Root,
9
+ TabsTab as Tab
10
+ };
@@ -0,0 +1,2 @@
1
+ export type { TabsListProps } from './tabs-list.types';
2
+ export { TabsList } from './tabs-list';
@@ -0,0 +1,7 @@
1
+ import type { TabsListProps } from './tabs-list.types';
2
+ /**
3
+ * Groups the individual tab buttons.
4
+ *
5
+ * Renders a `<div>` element.
6
+ */
7
+ export declare const TabsList: import("@qwik.dev/core").Component<TabsListProps>;
@@ -0,0 +1,37 @@
1
+ import { jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$, useSignal, useComputed$, useTask$, $, useContextProvider, Slot } from "@qwik.dev/core";
3
+ import { useTabsRootContext } from "../../contexts/tabs-root-context/tabs-root-context.qwik.mjs";
4
+ import { TabsListContext } from "../../contexts/tabs-list-context/tabs-list-context.qwik.mjs";
5
+ import { RovingFocusGroupRoot } from "../../../roving-focus-group/parts/roving-focus-group-root/roving-focus-group-root.qwik.mjs";
6
+ const TabsList = component$((props) => {
7
+ const { as = "div", activationMode: _activationMode = "automatic", loopFocus = true, ...others } = props;
8
+ const { value, dir, orientation } = useTabsRootContext();
9
+ const currentTabStopId = useSignal(value.value);
10
+ const activationMode = useComputed$(() => _activationMode);
11
+ useTask$(({ track }) => {
12
+ const activeTabValue = track(() => value.value);
13
+ currentTabStopId.value = activeTabValue;
14
+ });
15
+ const handleCurrentTabStopIdChange$ = $((tabStopId) => {
16
+ currentTabStopId.value = tabStopId;
17
+ });
18
+ useContextProvider(TabsListContext, {
19
+ activationMode
20
+ });
21
+ return /* @__PURE__ */ jsx(RovingFocusGroupRoot, {
22
+ as,
23
+ currentTabStopId,
24
+ onCurrentTabStopIdChange$: handleCurrentTabStopIdChange$,
25
+ loopFocus,
26
+ dir: dir.value,
27
+ orientation: orientation.value,
28
+ role: "tablist",
29
+ "aria-orientation": orientation.value,
30
+ "data-entry-ui-qwik-tabs-list": "",
31
+ ...others,
32
+ children: /* @__PURE__ */ jsx(Slot, {})
33
+ });
34
+ });
35
+ export {
36
+ TabsList
37
+ };
@@ -0,0 +1,30 @@
1
+ import type { Component, PropsOf } from '@qwik.dev/core';
2
+ /**
3
+ * Props for the `Tabs.List` component.
4
+ * Extends the standard HTML attributes for a `div` element.
5
+ */
6
+ export interface TabsListProps extends Omit<PropsOf<'div'>, 'dir'> {
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
+ * Whether the tabs should be activated automatically on focus or manually on click.
17
+ *
18
+ * - When `"automatic"`, tabs are activated when receiving focus.
19
+ * - When `"manual"`, tabs are activated only when clicked or via keyboard selection (`Enter` or `Space`).
20
+ *
21
+ * @default "automatic"
22
+ */
23
+ activationMode?: 'automatic' | 'manual';
24
+ /**
25
+ * When `true`, keyboard navigation will loop from last tab to first, and vice versa.
26
+ *
27
+ * @default true
28
+ */
29
+ loopFocus?: boolean;
30
+ }
@@ -0,0 +1,2 @@
1
+ export type { TabsPanelProps } from './tabs-panel.types';
2
+ export { TabsPanel } from './tabs-panel';
@@ -0,0 +1,7 @@
1
+ import type { TabsPanelProps } from './tabs-panel.types';
2
+ /**
3
+ * A panel displayed when the corresponding tab is active.
4
+ *
5
+ * Renders a `<div>` element.
6
+ */
7
+ export declare const TabsPanel: import("@qwik.dev/core").Component<TabsPanelProps>;
@@ -0,0 +1,39 @@
1
+ import { jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$, useComputed$, useContextProvider, Slot } from "@qwik.dev/core";
3
+ import { mergeStyles } from "../../../../utilities/merge-styles/merge-styles.qwik.mjs";
4
+ import { Primitive } from "../../../../_internal/components/primitive/primitive.qwik.mjs";
5
+ import { useTabsRootContext } from "../../contexts/tabs-root-context/tabs-root-context.qwik.mjs";
6
+ import { TabsPanelContext } from "../../contexts/tabs-panel-context/tabs-panel-context.qwik.mjs";
7
+ const TabsPanel = component$((props) => {
8
+ const { as = "div", value, containsFocusableContent = false, style, ...others } = props;
9
+ const { value: activeTabValue, orientation, id } = useTabsRootContext();
10
+ const tabId = useComputed$(() => `entry-ui-qwik-tabs-${id}-tab-${value}`);
11
+ const panelId = useComputed$(() => `entry-ui-qwik-tabs-${id}-panel-${value}`);
12
+ const active = useComputed$(() => activeTabValue.value === value);
13
+ const mergedStyles = useComputed$(() => mergeStyles([
14
+ {
15
+ display: !active.value ? "none !important" : void 0
16
+ },
17
+ style
18
+ ]));
19
+ useContextProvider(TabsPanelContext, {
20
+ active
21
+ });
22
+ return /* @__PURE__ */ jsx(Primitive.div, {
23
+ as,
24
+ role: "tabpanel",
25
+ id: panelId.value,
26
+ hidden: !active.value,
27
+ tabIndex: !active.value ? -1 : containsFocusableContent ? void 0 : 0,
28
+ "aria-labelledby": tabId.value,
29
+ "data-entry-ui-qwik-tabs-panel": "",
30
+ "data-state": active.value ? "active" : "inactive",
31
+ "data-orientation": orientation.value,
32
+ style: mergedStyles.value,
33
+ ...others,
34
+ children: /* @__PURE__ */ jsx(Slot, {})
35
+ });
36
+ });
37
+ export {
38
+ TabsPanel
39
+ };
@@ -0,0 +1,27 @@
1
+ import type { Component, PropsOf } from '@qwik.dev/core';
2
+ /**
3
+ * Props for the `Tabs.Panel` component.
4
+ * Extends the standard HTML attributes for a `div` element.
5
+ */
6
+ export interface TabsPanelProps 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 associates the panel with a tab.
17
+ */
18
+ value: string;
19
+ /**
20
+ * When `true`, indicates the panel contains focusable elements (like inputs or links).
21
+ * This removes the panel from the tab order (`tabIndex`) to avoid redundant focus stops,
22
+ * allowing focus to move directly to the internal content.
23
+ *
24
+ * @default false
25
+ */
26
+ containsFocusableContent?: boolean;
27
+ }
@@ -0,0 +1,2 @@
1
+ export type { TabsRootProps } from './tabs-root.types';
2
+ export { TabsRoot } from './tabs-root';
@@ -0,0 +1,7 @@
1
+ import type { TabsRootProps } from './tabs-root.types';
2
+ /**
3
+ * Groups the tabs and the corresponding panels.
4
+ *
5
+ * Renders a `<div>` element.
6
+ */
7
+ export declare const TabsRoot: import("@qwik.dev/core").Component<TabsRootProps>;
@@ -0,0 +1,34 @@
1
+ import { jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$, useId, useComputed$, useContextProvider, Slot } from "@qwik.dev/core";
3
+ import { useControllable } from "../../../../hooks/use-controllable/use-controllable.qwik.mjs";
4
+ import { Primitive } from "../../../../_internal/components/primitive/primitive.qwik.mjs";
5
+ import { TabsRootContext } from "../../contexts/tabs-root-context/tabs-root-context.qwik.mjs";
6
+ const TabsRoot = component$((props) => {
7
+ const { as = "div", defaultValue, value: _value, onValueChange$, dir: _dir = "ltr", orientation: _orientation = "horizontal", ...others } = props;
8
+ const { state: value, setState$: setValue$ } = useControllable({
9
+ defaultValue: defaultValue ?? "",
10
+ controlledSignal: _value,
11
+ onChange$: onValueChange$
12
+ });
13
+ const id = useId();
14
+ const dir = useComputed$(() => _dir);
15
+ const orientation = useComputed$(() => _orientation);
16
+ useContextProvider(TabsRootContext, {
17
+ value,
18
+ setValue$,
19
+ id,
20
+ dir,
21
+ orientation
22
+ });
23
+ return /* @__PURE__ */ jsx(Primitive.div, {
24
+ as,
25
+ dir: dir.value,
26
+ "data-entry-ui-qwik-tabs-root": "",
27
+ "data-orientation": orientation.value,
28
+ ...others,
29
+ children: /* @__PURE__ */ jsx(Slot, {})
30
+ });
31
+ });
32
+ export {
33
+ TabsRoot
34
+ };
@@ -0,0 +1,50 @@
1
+ import type { Component, PropsOf, Signal, QRL } from '@qwik.dev/core';
2
+ /**
3
+ * Props for the `Tabs.Root` component.
4
+ * Extends the standard HTML attributes for a `div` element.
5
+ */
6
+ export interface TabsRootProps 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 value of the tab that should be active when initially rendered.
17
+ * Use when you do not need to control the state of the tabs.
18
+ *
19
+ * @default undefined
20
+ */
21
+ defaultValue?: string;
22
+ /**
23
+ * The controlled value of the tab to activate.
24
+ * Should be used in conjunction with `onValueChange$`.
25
+ *
26
+ * @default undefined
27
+ */
28
+ value?: Signal<string>;
29
+ /**
30
+ * A `QRL` callback function that is called when the value changes.
31
+ *
32
+ * @default undefined
33
+ */
34
+ onValueChange$?: QRL<(value: string) => void>;
35
+ /**
36
+ * The reading direction of the tabs.
37
+ * When set to `"rtl"`, keyboard navigation is reversed and visual alignment is adjusted for right-to-left languages.
38
+ *
39
+ * @default "ltr"
40
+ */
41
+ dir?: 'ltr' | 'rtl';
42
+ /**
43
+ * The orientation of the tabs.
44
+ * This value determines whether the tabs are laid out horizontally or vertically,
45
+ * and adjusts keyboard navigation (arrow keys) to match the visual orientation.
46
+ *
47
+ * @default "horizontal"
48
+ */
49
+ orientation?: 'horizontal' | 'vertical';
50
+ }
@@ -0,0 +1,2 @@
1
+ export type { TabsTabProps } from './tabs-tab.types';
2
+ export { TabsTab } from './tabs-tab';
@@ -0,0 +1,7 @@
1
+ import type { TabsTabProps } from './tabs-tab.types';
2
+ /**
3
+ * An individual interactive tab button that toggles the corresponding panel.
4
+ *
5
+ * Renders a `<button>` element.
6
+ */
7
+ export declare const TabsTab: import("@qwik.dev/core").Component<TabsTabProps>;
@@ -0,0 +1,87 @@
1
+ import { jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$, useComputed$, sync$, $, useContextProvider, Slot } from "@qwik.dev/core";
3
+ import { useTabsRootContext } from "../../contexts/tabs-root-context/tabs-root-context.qwik.mjs";
4
+ import { useTabsListContext } from "../../contexts/tabs-list-context/tabs-list-context.qwik.mjs";
5
+ import { TabsTabContext } from "../../contexts/tabs-tab-context/tabs-tab-context.qwik.mjs";
6
+ import { RovingFocusGroupItem } from "../../../roving-focus-group/parts/roving-focus-group-item/roving-focus-group-item.qwik.mjs";
7
+ const TabsTab = component$((props) => {
8
+ const { as = "button", value: _value, disabled: _disabled = false, onMouseDown$, onKeyDown$, onFocus$, ...others } = props;
9
+ const { value: activeTabValue, setValue$: setActiveTabValue$, id } = useTabsRootContext();
10
+ const { activationMode } = useTabsListContext();
11
+ const tabId = useComputed$(() => `entry-ui-qwik-tabs-${id}-tab-${_value}`);
12
+ const panelId = useComputed$(() => `entry-ui-qwik-tabs-${id}-panel-${_value}`);
13
+ const value = useComputed$(() => _value);
14
+ const active = useComputed$(() => activeTabValue.value === _value);
15
+ const disabled = useComputed$(() => _disabled);
16
+ const handleMouseDownSync$ = sync$((event, currentTarget) => {
17
+ const entryUIQwikEvent = event;
18
+ const isDisabled = currentTarget.hasAttribute("disabled") || currentTarget.hasAttribute("data-disabled");
19
+ if (entryUIQwikEvent.entryUIQwikHandlerPrevented) return;
20
+ if (isDisabled || event.button !== 0 || event.ctrlKey !== false) {
21
+ event.preventDefault();
22
+ }
23
+ });
24
+ const handleMouseDown$ = $((event) => {
25
+ const entryUIQwikEvent = event;
26
+ if (entryUIQwikEvent.entryUIQwikHandlerPrevented) return;
27
+ if (!disabled.value && event.button === 0 && event.ctrlKey === false) {
28
+ setActiveTabValue$(value.value);
29
+ }
30
+ });
31
+ const handleKeyDown$ = $((event) => {
32
+ const entryUIQwikEvent = event;
33
+ if (entryUIQwikEvent.entryUIQwikHandlerPrevented) return;
34
+ if (!disabled.value && [
35
+ " ",
36
+ "Enter"
37
+ ].includes(event.key)) {
38
+ setActiveTabValue$(value.value);
39
+ }
40
+ });
41
+ const handleFocus$ = $((event) => {
42
+ const entryUIQwikEvent = event;
43
+ if (entryUIQwikEvent.entryUIQwikHandlerPrevented) return;
44
+ if (!active.value && !disabled.value && activationMode.value === "automatic") {
45
+ setActiveTabValue$(value.value);
46
+ }
47
+ });
48
+ useContextProvider(TabsTabContext, {
49
+ value,
50
+ active,
51
+ disabled
52
+ });
53
+ return /* @__PURE__ */ jsx(RovingFocusGroupItem, {
54
+ as,
55
+ tabStopId: value.value,
56
+ focusable: !disabled.value,
57
+ id: tabId.value,
58
+ role: "tab",
59
+ disabled: disabled.value,
60
+ "aria-selected": active.value,
61
+ "aria-controls": panelId.value,
62
+ "data-entry-ui-qwik-tabs-tab": "",
63
+ "data-state": active.value ? "active" : "inactive",
64
+ "data-active": void 0,
65
+ // @ts-expect-error - The event handler element types differ, but the runtime correctly handles the `as` prop polymorphism.
66
+ onMouseDown$: [
67
+ onMouseDown$,
68
+ handleMouseDownSync$,
69
+ handleMouseDown$
70
+ ],
71
+ // @ts-expect-error - The event handler element types differ, but the runtime correctly handles the `as` prop polymorphism.
72
+ onKeyDown$: [
73
+ onKeyDown$,
74
+ handleKeyDown$
75
+ ],
76
+ // @ts-expect-error - The event handler element types differ, but the runtime correctly handles the `as` prop polymorphism.
77
+ onFocus$: [
78
+ onFocus$,
79
+ handleFocus$
80
+ ],
81
+ ...others,
82
+ children: /* @__PURE__ */ jsx(Slot, {})
83
+ });
84
+ });
85
+ export {
86
+ TabsTab
87
+ };
@@ -0,0 +1,25 @@
1
+ import type { PropsOf, Component } from '@qwik.dev/core';
2
+ /**
3
+ * Props for the `Tabs.Tab` component.
4
+ * Extends the standard HTML attributes for a `button` element.
5
+ */
6
+ export interface TabsTabProps extends PropsOf<'button'> {
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 "button"
13
+ */
14
+ as?: string | Component;
15
+ /**
16
+ * A unique value that associates the tab with a panel.
17
+ */
18
+ value: string;
19
+ /**
20
+ * When `true`, prevents the user from interacting with the tab.
21
+ *
22
+ * @default false
23
+ */
24
+ disabled?: boolean;
25
+ }
@@ -20,10 +20,13 @@ const useClipboard = (params = {}) => {
20
20
  await copyToClipboard({
21
21
  value,
22
22
  onSuccess: () => {
23
- win.clearTimeout(copyTimeout.value);
23
+ if (copyTimeout.value !== -1) {
24
+ win.clearTimeout(copyTimeout.value);
25
+ }
24
26
  copyTimeout.value = win.setTimeout(() => {
25
27
  copied.value = false;
26
28
  error$1.value = null;
29
+ copyTimeout.value = -1;
27
30
  onStatusChange$?.({
28
31
  copied: false,
29
32
  error: null
@@ -69,7 +72,10 @@ const useClipboard = (params = {}) => {
69
72
  copied.value = false;
70
73
  error$1.value = null;
71
74
  const win = document.defaultView || window;
72
- win.clearTimeout(copyTimeout.value);
75
+ if (copyTimeout.value !== -1) {
76
+ win.clearTimeout(copyTimeout.value);
77
+ copyTimeout.value = -1;
78
+ }
73
79
  onStatusChange$?.({
74
80
  copied: false,
75
81
  error: null
@@ -8,8 +8,15 @@ import { useCollapsibleRootContext } from "./components/collapsible/hooks/use-co
8
8
  import { useCollapsibleTriggerContext } from "./components/collapsible/hooks/use-collapsible-trigger-context/use-collapsible-trigger-context.qwik.mjs";
9
9
  import * as index$3 from "./components/copy-button/parts/index.qwik.mjs";
10
10
  import { useCopyButtonRootContext } from "./components/copy-button/hooks/use-copy-button-root-context/use-copy-button-root-context.qwik.mjs";
11
- import * as index$4 from "./components/separator/parts/index.qwik.mjs";
12
- import * as index$5 from "./components/toggle/parts/index.qwik.mjs";
11
+ import * as index$4 from "./components/roving-focus-group/parts/index.qwik.mjs";
12
+ import { useRovingFocusGroupRootContext } from "./components/roving-focus-group/hooks/use-roving-focus-group-root-context/use-roving-focus-group-root-context.qwik.mjs";
13
+ import { useRovingFocusGroupItemContext } from "./components/roving-focus-group/hooks/use-roving-focus-group-item-context/use-roving-focus-group-item-context.qwik.mjs";
14
+ import * as index$5 from "./components/separator/parts/index.qwik.mjs";
15
+ import * as index$6 from "./components/tabs/parts/index.qwik.mjs";
16
+ import { useTabsRootContext } from "./components/tabs/hooks/use-tabs-root-context/use-tabs-root-context.qwik.mjs";
17
+ import { useTabsTabContext } from "./components/tabs/hooks/use-tabs-tab-context/use-tabs-tab-context.qwik.mjs";
18
+ import { useTabsPanelContext } from "./components/tabs/hooks/use-tabs-panel-context/use-tabs-panel-context.qwik.mjs";
19
+ import * as index$7 from "./components/toggle/parts/index.qwik.mjs";
13
20
  import { useToggleRootContext } from "./components/toggle/hooks/use-toggle-root-context/use-toggle-root-context.qwik.mjs";
14
21
  import { useBoolean } from "./hooks/use-boolean/use-boolean.qwik.mjs";
15
22
  import { useClipboard } from "./hooks/use-clipboard/use-clipboard.qwik.mjs";
@@ -25,8 +32,10 @@ export {
25
32
  index$1 as Alert,
26
33
  index$2 as Collapsible,
27
34
  index$3 as CopyButton,
28
- index$4 as Separator,
29
- index$5 as Toggle,
35
+ index$4 as RovingFocusGroup,
36
+ index$5 as Separator,
37
+ index$6 as Tabs,
38
+ index$7 as Toggle,
30
39
  makeEventPreventable,
31
40
  mergeRefs,
32
41
  mergeStyles,
@@ -42,5 +51,10 @@ export {
42
51
  useCounter,
43
52
  useCycle,
44
53
  useLifecycle,
54
+ useRovingFocusGroupItemContext,
55
+ useRovingFocusGroupRootContext,
56
+ useTabsPanelContext,
57
+ useTabsRootContext,
58
+ useTabsTabContext,
45
59
  useToggleRootContext
46
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entry-ui/qwik",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/ZAHON/entry-ui#readme",
@@ -31,10 +31,18 @@
31
31
  "types": "./lib/components/copy-button/index.d.ts",
32
32
  "import": "./lib/components/copy-button/index.qwik.mjs"
33
33
  },
34
+ "./roving-focus-group": {
35
+ "types": "./lib/components/roving-focus-group/index.d.ts",
36
+ "import": "./lib/components/roving-focus-group/index.qwik.mjs"
37
+ },
34
38
  "./separator": {
35
39
  "types": "./lib/components/separator/index.d.ts",
36
40
  "import": "./lib/components/separator/index.qwik.mjs"
37
41
  },
42
+ "./tabs": {
43
+ "types": "./lib/components/tabs/index.d.ts",
44
+ "import": "./lib/components/tabs/index.qwik.mjs"
45
+ },
38
46
  "./toggle": {
39
47
  "types": "./lib/components/toggle/index.d.ts",
40
48
  "import": "./lib/components/toggle/index.qwik.mjs"
@@ -116,7 +124,7 @@
116
124
  "qwik": "qwik"
117
125
  },
118
126
  "dependencies": {
119
- "@entry-ui/utilities": "^0.7.0"
127
+ "@entry-ui/utilities": "^0.8.0"
120
128
  },
121
129
  "devDependencies": {
122
130
  "@entry-ui/eslint": "workspace:*",