@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
@@ -1,188 +1,34 @@
1
1
  import { jsx } from "@qwik.dev/core/jsx-runtime";
2
- import { component$, useSignal, useComputed$, $, useTask$, isBrowser, isDev, sync$, Slot } from "@qwik.dev/core";
3
- import { getComputedStyle } from "@entry-ui/utilities/get-computed-style";
4
- import { getHiddenElementHeight } from "@entry-ui/utilities/get-hidden-element-height";
5
- import { addEventListenerOnce } from "@entry-ui/utilities/add-event-listener-once";
2
+ import { component$, useSignal, $, Slot } from "@qwik.dev/core";
6
3
  import { useLifecycle } from "../../../../hooks/use-lifecycle/use-lifecycle.qwik.mjs";
7
- import { mergeStyles } from "../../../../utilities/merge-styles/merge-styles.qwik.mjs";
8
4
  import { mergeRefs } from "../../../../utilities/merge-refs/merge-refs.qwik.mjs";
9
- import { warn } from "../../../../_internal/utilities/warn/warn.qwik.mjs";
10
- import { Primitive } from "../../../../_internal/components/primitive/primitive.qwik.mjs";
5
+ import { CollapsiblePanel as CollapsiblePanel$1 } from "../../../../_internal/components/collapsible-panel/collapsible-panel.qwik.mjs";
11
6
  import { useCollapsibleRootContext } from "../../contexts/collapsible-root-context/collapsible-root-context.qwik.mjs";
12
7
  const CollapsiblePanel = component$((props) => {
13
- const { as = "div", ref: _ref, id, hiddenUntilFound: _hiddenUntilFound = false, onOpenChangeComplete$, onBeforematch$, style, ...others } = props;
8
+ const { as = "div", ref: _ref, id, hiddenUntilFound = false, ...others } = props;
14
9
  const { open, setOpen$, disabled, panelId, triggerId } = useCollapsibleRootContext();
15
10
  const ref = useSignal(void 0);
16
- const hidden = useSignal(!open.value);
17
- const state = useSignal(open.value ? "open" : "closed");
18
- const height = useSignal(open.value ? "auto" : _hiddenUntilFound ? disabled.value ? "0px" : "none" : "0px");
19
- const isBeforeMatch = useSignal(false);
20
- const preventInitialAnimation = useSignal(true);
21
- const hiddenUntilFound = useComputed$(() => disabled.value ? false : _hiddenUntilFound);
22
- const mergedStyles = useComputed$(() => mergeStyles([
23
- {
24
- display: hidden.value ? hiddenUntilFound.value ? void 0 : "none !important" : void 0,
25
- transitionDuration: preventInitialAnimation.value ? "0s" : void 0,
26
- animationDuration: preventInitialAnimation.value ? "0s" : void 0,
27
- "--entry-ui-qwik-collapsible-panel-height": height.value
28
- },
29
- style
30
- ]));
31
11
  useLifecycle({
32
12
  element: ref,
33
13
  onMount$: $(() => panelId.set$(id)),
34
14
  onUnmount$: $(() => panelId.delete$())
35
15
  });
36
- useTask$(({ track }) => {
37
- const isHiddenUntilFound = track(() => hiddenUntilFound.value);
38
- const panelRef = ref.value;
39
- if (isBrowser && panelRef) {
40
- const panelHeight = open.value ? "auto" : isHiddenUntilFound ? "none" : "0px";
41
- height.value = panelHeight;
42
- panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", panelHeight);
43
- }
44
- });
45
- useTask$(({ track, cleanup }) => {
46
- const isOpen = track(() => open.value);
47
- const panelRef = ref.value;
48
- if (isBrowser && panelRef) {
49
- if (preventInitialAnimation.value && !isBeforeMatch.value) {
50
- preventInitialAnimation.value = false;
51
- panelRef.style.removeProperty("transition-duration");
52
- panelRef.style.removeProperty("animation-duration");
53
- }
54
- if (isOpen) {
55
- hidden.value = false;
56
- panelRef.removeAttribute("hidden");
57
- if (hiddenUntilFound.value) {
58
- isBeforeMatch.value = false;
59
- } else {
60
- panelRef.style.removeProperty("display");
61
- }
62
- state.value = "open";
63
- panelRef.setAttribute("data-state", "open");
64
- const { animationDuration: animationDuration2, transitionDuration: transitionDuration2 } = getComputedStyle(panelRef);
65
- const panelHeight = getHiddenElementHeight(panelRef);
66
- if (animationDuration2 === "0s" && transitionDuration2 !== "0s") {
67
- if (height.value === "none") {
68
- height.value = "0px";
69
- panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", "0px");
70
- setTimeout(() => {
71
- height.value = `${panelHeight}px`;
72
- panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", `${panelHeight}px`);
73
- }, 0);
74
- } else {
75
- height.value = `${panelHeight}px`;
76
- panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", `${panelHeight}px`);
77
- }
78
- } else {
79
- height.value = `${panelHeight}px`;
80
- panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", `${panelHeight}px`);
81
- }
82
- } else {
83
- state.value = "closed";
84
- panelRef.setAttribute("data-state", "closed");
85
- const { animationDuration: animationDuration2, transitionDuration: transitionDuration2 } = getComputedStyle(panelRef);
86
- const panelHeight = getHiddenElementHeight(panelRef);
87
- if (animationDuration2 === "0s" && transitionDuration2 !== "0s") {
88
- if (height.value === "auto") {
89
- height.value = `${panelHeight}px`;
90
- panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", `${panelHeight}px`);
91
- setTimeout(() => {
92
- height.value = "0px";
93
- panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", "0px");
94
- }, 0);
95
- } else {
96
- height.value = "0px";
97
- panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", "0px");
98
- }
99
- } else {
100
- height.value = `${panelHeight}px`;
101
- panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", `${panelHeight}px`);
102
- }
103
- }
104
- const applyFinalState = () => {
105
- if (isOpen) {
106
- height.value = "auto";
107
- panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", "auto");
108
- } else {
109
- hidden.value = true;
110
- if (hiddenUntilFound.value) {
111
- height.value = "none";
112
- panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", "none");
113
- } else {
114
- height.value = "0px";
115
- panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", "0px");
116
- }
117
- }
118
- if (onOpenChangeComplete$) {
119
- onOpenChangeComplete$(isOpen);
120
- }
121
- };
122
- const { transitionDuration, animationDuration } = getComputedStyle(panelRef);
123
- if (isDev && transitionDuration !== "0s" && animationDuration !== "0s") {
124
- warn([
125
- `Both CSS transitions and CSS animations are detected on 'Collapsible.Panel' component.`,
126
- `Using both at the same time may cause unpredictable behavior.`,
127
- `Please use only one animation method.`
128
- ]);
129
- applyFinalState();
130
- } else if (transitionDuration !== "0s") {
131
- const removeTransitionEndListener = addEventListenerOnce({
132
- target: panelRef,
133
- type: "transitionend",
134
- listener: applyFinalState
135
- });
136
- cleanup(() => {
137
- removeTransitionEndListener();
138
- });
139
- } else if (animationDuration !== "0s") {
140
- const removeAnimationEndListener = addEventListenerOnce({
141
- target: panelRef,
142
- type: "animationend",
143
- listener: applyFinalState
144
- });
145
- cleanup(() => {
146
- removeAnimationEndListener();
147
- });
148
- } else {
149
- applyFinalState();
150
- }
151
- }
152
- });
153
- const handleBeforeMatchSync$ = sync$((event) => {
154
- const entryUIQwikEvent = event;
155
- if (!entryUIQwikEvent.entryUIQwikHandlerPrevented) {
156
- event.preventDefault();
157
- }
158
- });
159
- const handleBeforeMatch$ = $((event) => {
160
- const entryUIQwikEvent = event;
161
- if (!entryUIQwikEvent.entryUIQwikHandlerPrevented) {
162
- isBeforeMatch.value = true;
163
- preventInitialAnimation.value = true;
164
- setOpen$(true);
165
- }
166
- });
167
- return /* @__PURE__ */ jsx(Primitive.div, {
16
+ return /* @__PURE__ */ jsx(CollapsiblePanel$1, {
168
17
  as,
18
+ componentName: "Collapsible.Panel",
19
+ heightVariableName: "--entry-ui-qwik-collapsible-panel-height",
20
+ open: open.value,
21
+ setOpen$,
22
+ hiddenUntilFound,
23
+ disabled: disabled.value,
169
24
  ref: mergeRefs([
170
25
  _ref,
171
26
  ref
172
27
  ]),
173
28
  id: panelId.id.value,
174
29
  role: triggerId.id.value ? "group" : void 0,
175
- hidden: hidden.value ? hiddenUntilFound.value ? "until-found" : "hidden" : void 0,
176
30
  "aria-labelledby": triggerId.id.value,
177
31
  "data-entry-ui-qwik-collapsible-panel": "",
178
- "data-state": state.value,
179
- "data-disabled": disabled.value ? "" : void 0,
180
- onBeforematch$: [
181
- onBeforematch$,
182
- handleBeforeMatchSync$,
183
- handleBeforeMatch$
184
- ],
185
- style: mergedStyles.value,
186
32
  ...others,
187
33
  children: /* @__PURE__ */ jsx(Slot, {})
188
34
  });
@@ -2,11 +2,10 @@ import { jsx } from "@qwik.dev/core/jsx-runtime";
2
2
  import { component$, useComputed$, useContextProvider, Slot } from "@qwik.dev/core";
3
3
  import { useControllable } from "../../../../hooks/use-controllable/use-controllable.qwik.mjs";
4
4
  import { useIdManager } from "../../../../_internal/hooks/use-id-manager/use-id-manager.qwik.mjs";
5
- import { mergeStyles } from "../../../../utilities/merge-styles/merge-styles.qwik.mjs";
6
5
  import { Primitive } from "../../../../_internal/components/primitive/primitive.qwik.mjs";
7
6
  import { CollapsibleRootContext } from "../../contexts/collapsible-root-context/collapsible-root-context.qwik.mjs";
8
7
  const CollapsibleRoot = component$((props) => {
9
- const { as = "div", defaultOpen, open: _open, onOpenChange$, disabled: _disabled = false, style, ...others } = props;
8
+ const { as = "div", defaultOpen, open: _open, onOpenChange$, disabled: _disabled = false, ...others } = props;
10
9
  const { state: open, setState$: setOpen$ } = useControllable({
11
10
  defaultValue: defaultOpen ?? false,
12
11
  controlledSignal: _open,
@@ -31,22 +30,6 @@ const CollapsibleRoot = component$((props) => {
31
30
  "data-entry-ui-qwik-collapsible-root": "",
32
31
  "data-state": open.value ? "open" : "closed",
33
32
  "data-disabled": disabled.value ? "" : void 0,
34
- style: mergeStyles([
35
- {
36
- // Performance optimization
37
- // The `contain: layout style;` CSS property is used here to improve rendering performance.
38
- // `contain: layout;` tells the browser that the internal layout of this component
39
- // is self-contained and does not affect the layout of elements outside of it. This prevents
40
- // costly re-calculations of the entire page layout when the collapsible panel expands or collapses,
41
- // which is especially beneficial during animations.
42
- // `contain: style;` ensures that CSS properties that can affect the rest of the page,
43
- // like counters, are isolated to this element.
44
- // Together, these properties create a performance "bubble," allowing the browser to optimize
45
- // rendering by treating the collapsible component as an independent unit.
46
- contain: "layout style"
47
- },
48
- style
49
- ]),
50
33
  ...others,
51
34
  children: /* @__PURE__ */ jsx(Slot, {})
52
35
  });
@@ -0,0 +1,11 @@
1
+ import type { CopyButtonRootContextValue } from './copy-button-root-context.types';
2
+ /**
3
+ * Provides the context for the `CopyButton.Root` component, allowing descendant
4
+ * components to access readonly signals without prop drilling.
5
+ */
6
+ export declare const CopyButtonRootContext: import("@qwik.dev/core").ContextId<CopyButtonRootContextValue>;
7
+ /**
8
+ * A hook that provides access to the `CopyButton.Root` component's internal state.
9
+ * It exposes readonly signals to interact with the component's state,
10
+ */
11
+ export declare const useCopyButtonRootContext: () => CopyButtonRootContextValue;
@@ -0,0 +1,10 @@
1
+ import { createContextId, useContext } from "@qwik.dev/core";
2
+ const CopyButtonRootContext = createContextId("entry-ui-qwik-copy-button-root-context");
3
+ const useCopyButtonRootContext = () => {
4
+ const context = useContext(CopyButtonRootContext);
5
+ return context;
6
+ };
7
+ export {
8
+ CopyButtonRootContext,
9
+ useCopyButtonRootContext
10
+ };
@@ -0,0 +1,24 @@
1
+ import type { ReadonlySignal } from '@qwik.dev/core';
2
+ /**
3
+ * The value provided by the `CopyButtonRootContext` context.
4
+ * Contains the readonly signals shared with descendant components.
5
+ */
6
+ export interface CopyButtonRootContextValue {
7
+ /**
8
+ * A readonly signal whose value indicates whether the text was successfully copied.
9
+ * It is `true` immediately after a successful copy operation and reverts to `false`
10
+ * after the specified timeout.
11
+ */
12
+ copied: ReadonlySignal<boolean>;
13
+ /**
14
+ * A readonly signal representing the current error state of the clipboard operation.
15
+ * It returns `"NOT_SUPPORTED"` if the API is unavailable, `"COPY_FAILED"` if the
16
+ * operation was rejected, or `null` if the last operation was successful.
17
+ */
18
+ error: ReadonlySignal<'NOT_SUPPORTED' | 'COPY_FAILED' | null>;
19
+ /**
20
+ * A readonly signal whose value indicates the copy button's current disabled state.
21
+ * It is `true` when the button is prevented from user interaction.
22
+ */
23
+ disabled: ReadonlySignal<boolean>;
24
+ }
@@ -0,0 +1,2 @@
1
+ export type { CopyButtonRootContextValue } from './copy-button-root-context.types';
2
+ export { CopyButtonRootContext, useCopyButtonRootContext } from './copy-button-root-context';
@@ -0,0 +1 @@
1
+ export * from './copy-button-root-context';
@@ -0,0 +1 @@
1
+ export * from './use-copy-button-root-context';
@@ -0,0 +1,2 @@
1
+ export type { UseCopyButtonRootContextReturnValue } from './use-copy-button-root-context.types';
2
+ export { useCopyButtonRootContext } from './use-copy-button-root-context';
@@ -0,0 +1,7 @@
1
+ import type { UseCopyButtonRootContextReturnValue } from './use-copy-button-root-context.types';
2
+ /**
3
+ * A hook that provides access to the `CopyButton.Root` component's internal state.
4
+ * It exposes readonly signals to interact with the copy button's state,
5
+ * allowing descendant components to react to its `copied`, `error`, or `disabled` state.
6
+ */
7
+ export declare const useCopyButtonRootContext: () => UseCopyButtonRootContextReturnValue;
@@ -0,0 +1,13 @@
1
+ import { useContext } from "@qwik.dev/core";
2
+ import { CopyButtonRootContext } from "../../contexts/copy-button-root-context/copy-button-root-context.qwik.mjs";
3
+ const useCopyButtonRootContext = () => {
4
+ const { copied, error, disabled } = useContext(CopyButtonRootContext);
5
+ return {
6
+ copied,
7
+ error,
8
+ disabled
9
+ };
10
+ };
11
+ export {
12
+ useCopyButtonRootContext
13
+ };
@@ -0,0 +1,24 @@
1
+ import type { ReadonlySignal } from '@qwik.dev/core';
2
+ /**
3
+ * The value returned by the `useCopyButtonRootContext` hook.
4
+ * Provides access to the copy button's readonly signals for descendant components.
5
+ */
6
+ export interface UseCopyButtonRootContextReturnValue {
7
+ /**
8
+ * A readonly signal whose value indicates whether the text was successfully copied.
9
+ * It is `true` immediately after a successful copy operation and reverts to `false`
10
+ * after the specified timeout.
11
+ */
12
+ copied: ReadonlySignal<boolean>;
13
+ /**
14
+ * A readonly signal representing the current error state of the clipboard operation.
15
+ * It returns `"NOT_SUPPORTED"` if the API is unavailable, `"COPY_FAILED"` if the
16
+ * operation was rejected, or `null` if the last operation was successful.
17
+ */
18
+ error: ReadonlySignal<'NOT_SUPPORTED' | 'COPY_FAILED' | null>;
19
+ /**
20
+ * A readonly signal whose value indicates the copy button's current disabled state.
21
+ * It is `true` when the button is prevented from user interaction.
22
+ */
23
+ disabled: ReadonlySignal<boolean>;
24
+ }
@@ -0,0 +1,2 @@
1
+ export * as CopyButton from './parts';
2
+ export * from './hooks';
@@ -0,0 +1,6 @@
1
+ import * as index from "./parts/index.qwik.mjs";
2
+ import { useCopyButtonRootContext } from "./hooks/use-copy-button-root-context/use-copy-button-root-context.qwik.mjs";
3
+ export {
4
+ index as CopyButton,
5
+ useCopyButtonRootContext
6
+ };
@@ -0,0 +1,9 @@
1
+ import type { CopyButtonIndicatorProps } from './copy-button-indicator.types';
2
+ /**
3
+ * An optional visual indicator that reflects the copy button's state.
4
+ * It typically displays an icon or other visual cue to show
5
+ * whether the content has been successfully copied or if an error occurred.
6
+ *
7
+ * Renders a `<span>` element.
8
+ */
9
+ export declare const CopyButtonIndicator: import("@qwik.dev/core").Component<CopyButtonIndicatorProps>;
@@ -0,0 +1,20 @@
1
+ import { jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$, Slot } from "@qwik.dev/core";
3
+ import { Indicator } from "../../../../_internal/components/indicator/indicator.qwik.mjs";
4
+ import { useCopyButtonRootContext } from "../../contexts/copy-button-root-context/copy-button-root-context.qwik.mjs";
5
+ const CopyButtonIndicator = component$((props) => {
6
+ const { as = "span", ...others } = props;
7
+ const { copied, error, disabled } = useCopyButtonRootContext();
8
+ return /* @__PURE__ */ jsx(Indicator, {
9
+ as,
10
+ "data-entry-ui-qwik-copy-button-indicator": "",
11
+ "data-copied": copied.value ? "" : void 0,
12
+ "data-error": error.value ? "" : void 0,
13
+ "data-disabled": disabled.value ? "" : void 0,
14
+ ...others,
15
+ children: /* @__PURE__ */ jsx(Slot, {})
16
+ });
17
+ });
18
+ export {
19
+ CopyButtonIndicator
20
+ };
@@ -0,0 +1,15 @@
1
+ import { PropsOf, Component } from '@qwik.dev/core';
2
+ /**
3
+ * Props for the `CopyButton.Indicator` component.
4
+ * Extends the standard HTML attributes for a `<span>` element.
5
+ */
6
+ export interface CopyButtonIndicatorProps extends PropsOf<'span'> {
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 "span"
13
+ */
14
+ as?: string | Component;
15
+ }
@@ -0,0 +1,2 @@
1
+ export type { CopyButtonIndicatorProps } from './copy-button-indicator.types';
2
+ export { CopyButtonIndicator } from './copy-button-indicator';
@@ -0,0 +1,7 @@
1
+ import type { CopyButtonRootProps } from './copy-button-root.types';
2
+ /**
3
+ * Contains the content for the copy button.
4
+ *
5
+ * Renders a `<button>` element.
6
+ */
7
+ export declare const CopyButtonRoot: import("@qwik.dev/core").Component<CopyButtonRootProps>;
@@ -0,0 +1,47 @@
1
+ import { jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$, useComputed$, $, useContextProvider, Slot } from "@qwik.dev/core";
3
+ import { useControllable } from "../../../../hooks/use-controllable/use-controllable.qwik.mjs";
4
+ import { useClipboard } from "../../../../hooks/use-clipboard/use-clipboard.qwik.mjs";
5
+ import { Primitive } from "../../../../_internal/components/primitive/primitive.qwik.mjs";
6
+ import { CopyButtonRootContext } from "../../contexts/copy-button-root-context/copy-button-root-context.qwik.mjs";
7
+ const CopyButtonRoot = component$((props) => {
8
+ const { as = "button", defaultText, text: _text, onStatusChange$, timeoutMs = 3e3, disabled: _disabled = false, onClick$, ...others } = props;
9
+ const { state: text } = useControllable({
10
+ defaultValue: defaultText ?? "",
11
+ controlledSignal: _text
12
+ });
13
+ const { copied, error, copy$ } = useClipboard({
14
+ timeoutMs,
15
+ onStatusChange$
16
+ });
17
+ const disabled = useComputed$(() => _disabled);
18
+ const handleClick$ = $(async (event) => {
19
+ const entryUIQwikEvent = event;
20
+ if (!entryUIQwikEvent.entryUIQwikHandlerPrevented && !disabled.value && !copied.value) {
21
+ await copy$(text.value);
22
+ }
23
+ });
24
+ useContextProvider(CopyButtonRootContext, {
25
+ copied,
26
+ error,
27
+ disabled
28
+ });
29
+ return /* @__PURE__ */ jsx(Primitive.button, {
30
+ as,
31
+ type: "button",
32
+ disabled: disabled.value,
33
+ "data-entry-ui-qwik-copy-button-root": "",
34
+ "data-copied": copied.value ? "" : void 0,
35
+ "data-error": error.value ? "" : void 0,
36
+ "data-disabled": disabled.value ? "" : void 0,
37
+ onClick$: [
38
+ onClick$,
39
+ handleClick$
40
+ ],
41
+ ...others,
42
+ children: /* @__PURE__ */ jsx(Slot, {})
43
+ });
44
+ });
45
+ export {
46
+ CopyButtonRoot
47
+ };
@@ -0,0 +1,52 @@
1
+ import type { PropsOf, Component, Signal, QRL } from '@qwik.dev/core';
2
+ /**
3
+ * Props for the `CopyButton.Root` component.
4
+ * Extends the standard HTML attributes for a `<button>` element.
5
+ */
6
+ export interface CopyButtonRootProps 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
+ * The text value to be copied when the component is initially rendered.
17
+ * Use when you do not need to control the text state.
18
+ *
19
+ * @default undefined
20
+ */
21
+ defaultText?: string;
22
+ /**
23
+ * The controlled text value to be copied.
24
+ *
25
+ * @default undefined
26
+ */
27
+ text?: Signal<string>;
28
+ /**
29
+ * An optional `QRL` callback function that is invoked whenever the clipboard status changes.
30
+ * It provides a detailed object reflecting whether the text was successfully copied
31
+ * or if an error occurred. This callback is also triggered when the status
32
+ * is automatically cleared after the `timeoutMs` duration has elapsed.
33
+ *
34
+ * @default undefined
35
+ */
36
+ onStatusChange$?: QRL<(details: {
37
+ copied: boolean;
38
+ error: 'NOT_SUPPORTED' | 'COPY_FAILED' | null;
39
+ }) => void>;
40
+ /**
41
+ * The duration in milliseconds before the copied state automatically resets to `false`.
42
+ *
43
+ * @default 3000
44
+ */
45
+ timeoutMs?: number;
46
+ /**
47
+ * When `true`, prevents the user from interacting with the copy button.
48
+ *
49
+ * @default false
50
+ */
51
+ disabled?: boolean;
52
+ }
@@ -0,0 +1,2 @@
1
+ export type { CopyButtonRootProps } from './copy-button-root.types';
2
+ export { CopyButtonRoot } from './copy-button-root';
@@ -0,0 +1,4 @@
1
+ export type { CopyButtonRootProps as RootProps } from './copy-button-root';
2
+ export type { CopyButtonIndicatorProps as IndicatorProps } from './copy-button-indicator';
3
+ export { CopyButtonRoot as Root } from './copy-button-root';
4
+ export { CopyButtonIndicator as Indicator } from './copy-button-indicator';
@@ -0,0 +1,6 @@
1
+ import { CopyButtonRoot } from "./copy-button-root/copy-button-root.qwik.mjs";
2
+ import { CopyButtonIndicator } from "./copy-button-indicator/copy-button-indicator.qwik.mjs";
3
+ export {
4
+ CopyButtonIndicator as Indicator,
5
+ CopyButtonRoot as Root
6
+ };
@@ -1,5 +1,8 @@
1
1
  export * from './accordion';
2
2
  export * from './alert';
3
3
  export * from './collapsible';
4
+ export * from './copy-button';
5
+ export * from './roving-focus-group';
4
6
  export * from './separator';
7
+ export * from './tabs';
5
8
  export * from './toggle';
@@ -0,0 +1,2 @@
1
+ export * from './roving-focus-group-root-context';
2
+ export * from './roving-focus-group-item-context';
@@ -0,0 +1,2 @@
1
+ export type { RovingFocusGroupItemContextValue } from './roving-focus-group-item-context.types';
2
+ export { RovingFocusGroupItemContext } from './roving-focus-group-item-context';
@@ -0,0 +1,6 @@
1
+ import type { RovingFocusGroupItemContextValue } from './roving-focus-group-item-context.types';
2
+ /**
3
+ * Provides the context for the `RovingFocusGroup.Item` component, allowing descendant
4
+ * components to access readonly signals without prop drilling.
5
+ */
6
+ export declare const RovingFocusGroupItemContext: import("@qwik.dev/core").ContextId<RovingFocusGroupItemContextValue>;
@@ -0,0 +1,5 @@
1
+ import { createContextId } from "@qwik.dev/core";
2
+ const RovingFocusGroupItemContext = createContextId("entry-ui-qwik-roving-focus-group-item-context");
3
+ export {
4
+ RovingFocusGroupItemContext
5
+ };
@@ -0,0 +1,22 @@
1
+ import type { ReadonlySignal } from '@qwik.dev/core';
2
+ /**
3
+ * The value provided by the `RovingFocusGroupItemContext` context.
4
+ * Contains the readonly signals shared with descendant components.
5
+ */
6
+ export interface RovingFocusGroupItemContextValue {
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 { RovingFocusGroupRootContextValue } from './roving-focus-group-root-context.types';
2
+ export { RovingFocusGroupRootContext, useRovingFocusGroupRootContext } from './roving-focus-group-root-context';
@@ -0,0 +1,11 @@
1
+ import type { RovingFocusGroupRootContextValue } from './roving-focus-group-root-context.types';
2
+ /**
3
+ * Provides the context for the `RovingFocusGroup.Root` component, allowing descendant
4
+ * components to access readonly signals and `QRL` functions without prop drilling.
5
+ */
6
+ export declare const RovingFocusGroupRootContext: import("@qwik.dev/core").ContextId<RovingFocusGroupRootContextValue>;
7
+ /**
8
+ * A hook that provides access to the `RovingFocusGroup.Root` component's internal state.
9
+ * It exposes readonly signals and `QRL` functions to interact with the component's state,
10
+ */
11
+ export declare const useRovingFocusGroupRootContext: () => RovingFocusGroupRootContextValue;
@@ -0,0 +1,10 @@
1
+ import { createContextId, useContext } from "@qwik.dev/core";
2
+ const RovingFocusGroupRootContext = createContextId("entry-ui-qwik-roving-focus-group-root-context");
3
+ const useRovingFocusGroupRootContext = () => {
4
+ const context = useContext(RovingFocusGroupRootContext);
5
+ return context;
6
+ };
7
+ export {
8
+ RovingFocusGroupRootContext,
9
+ useRovingFocusGroupRootContext
10
+ };