@entry-ui/qwik 0.6.0 → 0.7.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 (68) hide show
  1. package/lib/_internal/components/primitive/primitive.d.ts +2 -1
  2. package/lib/_internal/components/primitive/primitive.qwik.mjs +1 -0
  3. package/lib/_internal/hooks/index.d.ts +1 -0
  4. package/lib/_internal/hooks/use-id/index.d.ts +2 -0
  5. package/lib/_internal/hooks/use-id/use-id.d.ts +21 -0
  6. package/lib/_internal/hooks/use-id/use-id.qwik.mjs +10 -0
  7. package/lib/_internal/hooks/use-id/use-id.types.d.ts +22 -0
  8. package/lib/components/accordion/contexts/accordion-item-context/accordion-item-context.d.ts +11 -0
  9. package/lib/components/accordion/contexts/accordion-item-context/accordion-item-context.qwik.mjs +10 -0
  10. package/lib/components/accordion/contexts/accordion-item-context/accordion-item-context.types.d.ts +64 -0
  11. package/lib/components/accordion/contexts/accordion-item-context/index.d.ts +2 -0
  12. package/lib/components/accordion/contexts/accordion-item-trigger-context/accordion-item-trigger-context.d.ts +6 -0
  13. package/lib/components/accordion/contexts/accordion-item-trigger-context/accordion-item-trigger-context.qwik.mjs +5 -0
  14. package/lib/components/accordion/contexts/accordion-item-trigger-context/accordion-item-trigger-context.types.d.ts +13 -0
  15. package/lib/components/accordion/contexts/accordion-item-trigger-context/index.d.ts +2 -0
  16. package/lib/components/accordion/contexts/accordion-root-context/accordion-root-context.d.ts +11 -0
  17. package/lib/components/accordion/contexts/accordion-root-context/accordion-root-context.qwik.mjs +10 -0
  18. package/lib/components/accordion/contexts/accordion-root-context/accordion-root-context.types.d.ts +34 -0
  19. package/lib/components/accordion/contexts/accordion-root-context/index.d.ts +2 -0
  20. package/lib/components/accordion/contexts/index.d.ts +3 -0
  21. package/lib/components/accordion/hooks/index.d.ts +3 -0
  22. package/lib/components/accordion/hooks/use-accordion-item-context/index.d.ts +2 -0
  23. package/lib/components/accordion/hooks/use-accordion-item-context/use-accordion-item-context.d.ts +7 -0
  24. package/lib/components/accordion/hooks/use-accordion-item-context/use-accordion-item-context.qwik.mjs +14 -0
  25. package/lib/components/accordion/hooks/use-accordion-item-context/use-accordion-item-context.types.d.ts +28 -0
  26. package/lib/components/accordion/hooks/use-accordion-item-trigger-context/index.d.ts +2 -0
  27. package/lib/components/accordion/hooks/use-accordion-item-trigger-context/use-accordion-item-trigger-context.d.ts +7 -0
  28. package/lib/components/accordion/hooks/use-accordion-item-trigger-context/use-accordion-item-trigger-context.qwik.mjs +11 -0
  29. package/lib/components/accordion/hooks/use-accordion-item-trigger-context/use-accordion-item-trigger-context.types.d.ts +13 -0
  30. package/lib/components/accordion/hooks/use-accordion-root-context/index.d.ts +2 -0
  31. package/lib/components/accordion/hooks/use-accordion-root-context/use-accordion-root-context.d.ts +8 -0
  32. package/lib/components/accordion/hooks/use-accordion-root-context/use-accordion-root-context.qwik.mjs +13 -0
  33. package/lib/components/accordion/hooks/use-accordion-root-context/use-accordion-root-context.types.d.ts +22 -0
  34. package/lib/components/accordion/index.d.ts +2 -0
  35. package/lib/components/accordion/index.qwik.mjs +10 -0
  36. package/lib/components/accordion/parts/accordion-item/accordion-item.d.ts +7 -0
  37. package/lib/components/accordion/parts/accordion-item/accordion-item.qwik.mjs +49 -0
  38. package/lib/components/accordion/parts/accordion-item/accordion-item.types.d.ts +29 -0
  39. package/lib/components/accordion/parts/accordion-item/index.d.ts +2 -0
  40. package/lib/components/accordion/parts/accordion-item-header/accordion-item-header.d.ts +11 -0
  41. package/lib/components/accordion/parts/accordion-item-header/accordion-item-header.qwik.mjs +19 -0
  42. package/lib/components/accordion/parts/accordion-item-header/accordion-item-header.types.d.ts +15 -0
  43. package/lib/components/accordion/parts/accordion-item-header/index.d.ts +2 -0
  44. package/lib/components/accordion/parts/accordion-item-indicator/accordion-item-indicator.d.ts +8 -0
  45. package/lib/components/accordion/parts/accordion-item-indicator/accordion-item-indicator.qwik.mjs +27 -0
  46. package/lib/components/accordion/parts/accordion-item-indicator/accordion-item-indicator.types.d.ts +15 -0
  47. package/lib/components/accordion/parts/accordion-item-indicator/index.d.ts +2 -0
  48. package/lib/components/accordion/parts/accordion-item-panel/accordion-item-panel.d.ts +7 -0
  49. package/lib/components/accordion/parts/accordion-item-panel/accordion-item-panel.qwik.mjs +199 -0
  50. package/lib/components/accordion/parts/accordion-item-panel/accordion-item-panel.types.d.ts +31 -0
  51. package/lib/components/accordion/parts/accordion-item-panel/index.d.ts +2 -0
  52. package/lib/components/accordion/parts/accordion-item-trigger/accordion-item-trigger.d.ts +7 -0
  53. package/lib/components/accordion/parts/accordion-item-trigger/accordion-item-trigger.qwik.mjs +52 -0
  54. package/lib/components/accordion/parts/accordion-item-trigger/accordion-item-trigger.types.d.ts +23 -0
  55. package/lib/components/accordion/parts/accordion-item-trigger/index.d.ts +2 -0
  56. package/lib/components/accordion/parts/accordion-root/accordion-root.d.ts +7 -0
  57. package/lib/components/accordion/parts/accordion-root/accordion-root.qwik.mjs +137 -0
  58. package/lib/components/accordion/parts/accordion-root/accordion-root.types.d.ts +68 -0
  59. package/lib/components/accordion/parts/accordion-root/index.d.ts +2 -0
  60. package/lib/components/accordion/parts/index.d.ts +12 -0
  61. package/lib/components/accordion/parts/index.qwik.mjs +14 -0
  62. package/lib/components/collapsible/contexts/collapsible-trigger-context/collapsible-trigger-context.types.d.ts +2 -2
  63. package/lib/components/collapsible/hooks/use-collapsible-trigger-context/use-collapsible-trigger-context.types.d.ts +2 -2
  64. package/lib/components/collapsible/parts/collapsible-panel/collapsible-panel.qwik.mjs +53 -30
  65. package/lib/components/index.d.ts +1 -0
  66. package/lib/index.qwik.mjs +16 -8
  67. package/lib/utilities/merge-refs/merge-refs.d.ts +1 -1
  68. package/package.json +6 -2
@@ -10,23 +10,18 @@ import { warn } from "../../../../_internal/utilities/warn/warn.qwik.mjs";
10
10
  import { Primitive } from "../../../../_internal/components/primitive/primitive.qwik.mjs";
11
11
  import { useCollapsibleRootContext } from "../../contexts/collapsible-root-context/collapsible-root-context.qwik.mjs";
12
12
  const CollapsiblePanel = component$((props) => {
13
- const { as = "div", ref: _ref, id, hiddenUntilFound = false, onOpenChangeComplete$, onBeforematch$, style, ...others } = props;
13
+ const { as = "div", ref: _ref, id, hiddenUntilFound: _hiddenUntilFound = false, onOpenChangeComplete$, onBeforematch$, style, ...others } = props;
14
14
  const { open, setOpen$, disabled, panelId, triggerId } = useCollapsibleRootContext();
15
15
  const ref = useSignal(void 0);
16
16
  const hidden = useSignal(!open.value);
17
17
  const state = useSignal(open.value ? "open" : "closed");
18
- const height = useSignal(open.value ? "auto" : "0px");
18
+ const height = useSignal(open.value ? "auto" : _hiddenUntilFound ? disabled.value ? "0px" : "none" : "0px");
19
+ const isBeforeMatch = useSignal(false);
19
20
  const preventInitialAnimation = useSignal(true);
21
+ const hiddenUntilFound = useComputed$(() => disabled.value ? false : _hiddenUntilFound);
20
22
  const mergedStyles = useComputed$(() => mergeStyles([
21
23
  {
22
- display: hidden.value ? hiddenUntilFound ? void 0 : "none" : void 0,
23
- contentVisibility: hidden.value ? hiddenUntilFound ? "hidden" : void 0 : void 0,
24
- // When using hidden="until-found", the panel automatically opens when a search
25
- // match occurs. However, Chromium-based browsers (like Chrome) will fail to
26
- // highlight the matched text if the element has an overflow value other than
27
- // "visible". Firefox handles this regardless of the overflow setting, but we force
28
- // visible here to ensure cross-browser consistency for the "Find-in-page" feature.
29
- overflow: hidden.value ? hiddenUntilFound ? "visible" : void 0 : void 0,
24
+ display: hidden.value ? hiddenUntilFound.value ? void 0 : "none !important" : void 0,
30
25
  transitionDuration: preventInitialAnimation.value ? "0s" : void 0,
31
26
  animationDuration: preventInitialAnimation.value ? "0s" : void 0,
32
27
  "--entry-ui-qwik-collapsible-panel-height": height.value
@@ -38,11 +33,20 @@ const CollapsiblePanel = component$((props) => {
38
33
  onMount$: $(() => panelId.set$(id)),
39
34
  onUnmount$: $(() => panelId.delete$())
40
35
  });
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
+ });
41
45
  useTask$(({ track, cleanup }) => {
42
46
  const isOpen = track(() => open.value);
43
47
  const panelRef = ref.value;
44
48
  if (isBrowser && panelRef) {
45
- if (preventInitialAnimation.value) {
49
+ if (preventInitialAnimation.value && !isBeforeMatch.value) {
46
50
  preventInitialAnimation.value = false;
47
51
  panelRef.style.removeProperty("transition-duration");
48
52
  panelRef.style.removeProperty("animation-duration");
@@ -50,17 +54,31 @@ const CollapsiblePanel = component$((props) => {
50
54
  if (isOpen) {
51
55
  hidden.value = false;
52
56
  panelRef.removeAttribute("hidden");
53
- if (hiddenUntilFound) {
54
- panelRef.style.removeProperty("content-visibility");
55
- panelRef.style.removeProperty("overflow");
57
+ if (hiddenUntilFound.value) {
58
+ isBeforeMatch.value = false;
56
59
  } else {
57
60
  panelRef.style.removeProperty("display");
58
61
  }
59
62
  state.value = "open";
60
63
  panelRef.setAttribute("data-state", "open");
64
+ const { animationDuration: animationDuration2, transitionDuration: transitionDuration2 } = getComputedStyle(panelRef);
61
65
  const panelHeight = getHiddenElementHeight(panelRef);
62
- height.value = `${panelHeight}px`;
63
- panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", `${panelHeight}px`);
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
+ }
64
82
  } else {
65
83
  state.value = "closed";
66
84
  panelRef.setAttribute("data-state", "closed");
@@ -89,8 +107,13 @@ const CollapsiblePanel = component$((props) => {
89
107
  panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", "auto");
90
108
  } else {
91
109
  hidden.value = true;
92
- height.value = "0px";
93
- panelRef.style.setProperty("--entry-ui-qwik-collapsible-panel-height", "0px");
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
+ }
94
117
  }
95
118
  if (onOpenChangeComplete$) {
96
119
  onOpenChangeComplete$(isOpen);
@@ -128,18 +151,17 @@ const CollapsiblePanel = component$((props) => {
128
151
  }
129
152
  });
130
153
  const handleBeforeMatchSync$ = sync$((event) => {
131
- event.preventDefault();
154
+ const entryUIQwikEvent = event;
155
+ if (!entryUIQwikEvent.entryUIQwikHandlerPrevented) {
156
+ event.preventDefault();
157
+ }
132
158
  });
133
- const handleBeforeMatch$ = $((_, currentTarget) => {
134
- setOpen$(true);
135
- if ("scrollIntoViewIfNeeded" in currentTarget) {
136
- currentTarget.scrollIntoViewIfNeeded(true);
137
- } else {
138
- currentTarget.scrollIntoView({
139
- behavior: "auto",
140
- block: "center",
141
- inline: "nearest"
142
- });
159
+ const handleBeforeMatch$ = $((event) => {
160
+ const entryUIQwikEvent = event;
161
+ if (!entryUIQwikEvent.entryUIQwikHandlerPrevented) {
162
+ isBeforeMatch.value = true;
163
+ preventInitialAnimation.value = true;
164
+ setOpen$(true);
143
165
  }
144
166
  });
145
167
  return /* @__PURE__ */ jsx(Primitive.div, {
@@ -149,7 +171,8 @@ const CollapsiblePanel = component$((props) => {
149
171
  ref
150
172
  ]),
151
173
  id: panelId.id.value,
152
- hidden: hidden.value ? hiddenUntilFound ? "until-found" : "hidden" : void 0,
174
+ role: triggerId.id.value ? "group" : void 0,
175
+ hidden: hidden.value ? hiddenUntilFound.value ? "until-found" : "hidden" : void 0,
153
176
  "aria-labelledby": triggerId.id.value,
154
177
  "data-entry-ui-qwik-collapsible-panel": "",
155
178
  "data-state": state.value,
@@ -1,3 +1,4 @@
1
+ export * from './accordion';
1
2
  export * from './alert';
2
3
  export * from './collapsible';
3
4
  export * from './separator';
@@ -1,9 +1,13 @@
1
- import * as index from "./components/alert/parts/index.qwik.mjs";
2
- import * as index$1 from "./components/collapsible/parts/index.qwik.mjs";
1
+ import * as index from "./components/accordion/parts/index.qwik.mjs";
2
+ import { useAccordionRootContext } from "./components/accordion/hooks/use-accordion-root-context/use-accordion-root-context.qwik.mjs";
3
+ import { useAccordionItemContext } from "./components/accordion/hooks/use-accordion-item-context/use-accordion-item-context.qwik.mjs";
4
+ import { useAccordionItemTriggerContext } from "./components/accordion/hooks/use-accordion-item-trigger-context/use-accordion-item-trigger-context.qwik.mjs";
5
+ import * as index$1 from "./components/alert/parts/index.qwik.mjs";
6
+ import * as index$2 from "./components/collapsible/parts/index.qwik.mjs";
3
7
  import { useCollapsibleRootContext } from "./components/collapsible/hooks/use-collapsible-root-context/use-collapsible-root-context.qwik.mjs";
4
8
  import { useCollapsibleTriggerContext } from "./components/collapsible/hooks/use-collapsible-trigger-context/use-collapsible-trigger-context.qwik.mjs";
5
- import * as index$2 from "./components/separator/parts/index.qwik.mjs";
6
- import * as index$3 from "./components/toggle/parts/index.qwik.mjs";
9
+ import * as index$3 from "./components/separator/parts/index.qwik.mjs";
10
+ import * as index$4 from "./components/toggle/parts/index.qwik.mjs";
7
11
  import { useToggleRootContext } from "./components/toggle/hooks/use-toggle-root-context/use-toggle-root-context.qwik.mjs";
8
12
  import { useBoolean } from "./hooks/use-boolean/use-boolean.qwik.mjs";
9
13
  import { useControllable } from "./hooks/use-controllable/use-controllable.qwik.mjs";
@@ -14,13 +18,17 @@ import { makeEventPreventable } from "./utilities/make-event-preventable/make-ev
14
18
  import { mergeRefs } from "./utilities/merge-refs/merge-refs.qwik.mjs";
15
19
  import { mergeStyles } from "./utilities/merge-styles/merge-styles.qwik.mjs";
16
20
  export {
17
- index as Alert,
18
- index$1 as Collapsible,
19
- index$2 as Separator,
20
- index$3 as Toggle,
21
+ index as Accordion,
22
+ index$1 as Alert,
23
+ index$2 as Collapsible,
24
+ index$3 as Separator,
25
+ index$4 as Toggle,
21
26
  makeEventPreventable,
22
27
  mergeRefs,
23
28
  mergeStyles,
29
+ useAccordionItemContext,
30
+ useAccordionItemTriggerContext,
31
+ useAccordionRootContext,
24
32
  useBoolean,
25
33
  useCollapsibleRootContext,
26
34
  useCollapsibleTriggerContext,
@@ -1,6 +1,6 @@
1
1
  import type { PossibleRef } from './merge-refs.types';
2
2
  /**
3
- * Combines multiple references into a single callback ref.
3
+ * Merges multiple references into a single callback ref.
4
4
  *
5
5
  * This utility function allows you to assign a single DOM element to multiple
6
6
  * reference handlers (both Qwik Signals and callback functions). It is particularly
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entry-ui/qwik",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/ZAHON/entry-ui#readme",
@@ -15,6 +15,10 @@
15
15
  "types": "./lib/index.d.ts",
16
16
  "import": "./lib/index.qwik.mjs"
17
17
  },
18
+ "./accordion": {
19
+ "types": "./lib/components/accordion/index.d.ts",
20
+ "import": "./lib/components/accordion/index.qwik.mjs"
21
+ },
18
22
  "./alert": {
19
23
  "types": "./lib/components/alert/index.d.ts",
20
24
  "import": "./lib/components/alert/index.qwik.mjs"
@@ -104,7 +108,7 @@
104
108
  "qwik": "qwik"
105
109
  },
106
110
  "dependencies": {
107
- "@entry-ui/utilities": "^0.5.0"
111
+ "@entry-ui/utilities": "^0.6.0"
108
112
  },
109
113
  "devDependencies": {
110
114
  "@entry-ui/eslint": "workspace:*",