@serendie/ui 2.0.0 → 2.1.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 (118) hide show
  1. package/dist/components/CheckBox/CheckBox.js +36 -35
  2. package/dist/components/ChoiceBox/ChoiceBox.js +41 -41
  3. package/dist/components/DataTable/DataTableComponent.d.ts +3 -20
  4. package/dist/components/DataTable/DataTableComponent.js +38 -36
  5. package/dist/components/DataTable/table/HeaderCheckbox.js +29 -19
  6. package/dist/components/Search/Search.d.ts +3 -1
  7. package/dist/components/Search/Search.js +34 -33
  8. package/dist/components/Select/Select.d.ts +2 -1
  9. package/dist/components/Select/Select.js +47 -41
  10. package/dist/components/Tooltip/Tooltip.d.ts +14 -0
  11. package/dist/components/Tooltip/Tooltip.js +70 -0
  12. package/dist/components/Tooltip/index.d.ts +1 -0
  13. package/dist/components/Tooltip/index.js +4 -0
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.js +12 -10
  16. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-content.js +4 -6
  17. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-indicator.js +4 -6
  18. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-trigger.js +10 -12
  19. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item.js +16 -16
  20. package/dist/node_modules/@ark-ui/react/dist/components/accordion/use-accordion.js +13 -20
  21. package/dist/node_modules/@ark-ui/react/dist/components/avatar/avatar-root.js +1 -5
  22. package/dist/node_modules/@ark-ui/react/dist/components/avatar/use-avatar.js +14 -18
  23. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-hidden-input.js +4 -6
  24. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/use-checkbox.js +22 -28
  25. package/dist/node_modules/@ark-ui/react/dist/components/collapsible/collapsible-content.js +7 -9
  26. package/dist/node_modules/@ark-ui/react/dist/components/collapsible/use-collapsible.js +14 -21
  27. package/dist/node_modules/@ark-ui/react/dist/components/collection/list-collection.js +5 -0
  28. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-content.js +9 -8
  29. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-item-group.js +4 -6
  30. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-positioner.js +4 -6
  31. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-root.js +17 -18
  32. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-trigger.js +10 -9
  33. package/dist/node_modules/@ark-ui/react/dist/components/combobox/use-combobox-item-context.js +5 -7
  34. package/dist/node_modules/@ark-ui/react/dist/components/combobox/use-combobox.js +21 -45
  35. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-backdrop.js +10 -9
  36. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-close-trigger.js +4 -6
  37. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-content.js +6 -5
  38. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-description.js +4 -6
  39. package/dist/node_modules/@ark-ui/react/dist/components/dialog/use-dialog.js +13 -22
  40. package/dist/node_modules/@ark-ui/react/dist/components/factory.js +26 -24
  41. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-content.js +9 -8
  42. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-item-group.js +1 -3
  43. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-item.js +15 -13
  44. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-root.js +13 -14
  45. package/dist/node_modules/@ark-ui/react/dist/components/menu/use-menu-option-item-props-context.js +10 -0
  46. package/dist/node_modules/@ark-ui/react/dist/components/menu/use-menu.js +14 -21
  47. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-ellipsis.js +4 -6
  48. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-next-trigger.js +4 -6
  49. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-prev-trigger.js +4 -6
  50. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-root.js +5 -4
  51. package/dist/node_modules/@ark-ui/react/dist/components/pagination/use-pagination.js +13 -19
  52. package/dist/node_modules/@ark-ui/react/dist/components/portal/portal.js +25 -16
  53. package/dist/node_modules/@ark-ui/react/dist/components/presence/split-presence-props.js +3 -2
  54. package/dist/node_modules/@ark-ui/react/dist/components/presence/use-presence.js +18 -18
  55. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-control.js +4 -6
  56. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-text.js +4 -6
  57. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item.js +1 -5
  58. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/use-radio-group.js +14 -22
  59. package/dist/node_modules/@ark-ui/react/dist/components/select/select-content.js +9 -8
  60. package/dist/node_modules/@ark-ui/react/dist/components/select/select-root.js +11 -12
  61. package/dist/node_modules/@ark-ui/react/dist/components/select/use-select.js +20 -47
  62. package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-hidden-input.js +4 -6
  63. package/dist/node_modules/@ark-ui/react/dist/components/switch/use-switch.js +20 -26
  64. package/dist/node_modules/@ark-ui/react/dist/components/tabs/tabs-root.js +9 -8
  65. package/dist/node_modules/@ark-ui/react/dist/components/tabs/use-tabs.js +14 -21
  66. package/dist/node_modules/@ark-ui/react/dist/components/toast/create-toaster.js +3 -7
  67. package/dist/node_modules/@ark-ui/react/dist/components/toast/toaster.js +28 -15
  68. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-arrow-tip.js +13 -0
  69. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-arrow.js +13 -0
  70. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-content.js +15 -0
  71. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-positioner.js +14 -0
  72. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-root.js +14 -0
  73. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-trigger.js +13 -0
  74. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/use-tooltip-context.js +10 -0
  75. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/use-tooltip.js +17 -0
  76. package/dist/node_modules/@ark-ui/react/dist/utils/compose-refs.js +13 -7
  77. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +92 -90
  78. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +230 -216
  79. package/dist/node_modules/@zag-js/accordion/dist/index.js +210 -227
  80. package/dist/node_modules/@zag-js/aria-hidden/dist/index.js +49 -12
  81. package/dist/node_modules/@zag-js/avatar/dist/index.js +119 -134
  82. package/dist/node_modules/@zag-js/checkbox/dist/index.js +196 -197
  83. package/dist/node_modules/@zag-js/collapsible/dist/index.js +250 -198
  84. package/dist/node_modules/@zag-js/collection/dist/index.js +172 -179
  85. package/dist/node_modules/@zag-js/combobox/dist/index.js +1176 -1082
  86. package/dist/node_modules/@zag-js/core/dist/index.js +77 -496
  87. package/dist/node_modules/@zag-js/dialog/dist/index.js +243 -270
  88. package/dist/node_modules/@zag-js/dismissable/dist/index.js +62 -60
  89. package/dist/node_modules/@zag-js/dom-query/dist/index.js +465 -253
  90. package/dist/node_modules/@zag-js/focus-trap/dist/index.js +307 -0
  91. package/dist/node_modules/@zag-js/focus-visible/dist/index.js +48 -47
  92. package/dist/node_modules/@zag-js/interact-outside/dist/index.js +112 -80
  93. package/dist/node_modules/@zag-js/menu/dist/index.js +998 -884
  94. package/dist/node_modules/@zag-js/pagination/dist/index.js +207 -213
  95. package/dist/node_modules/@zag-js/popper/dist/index.js +130 -129
  96. package/dist/node_modules/@zag-js/presence/dist/index.js +139 -122
  97. package/dist/node_modules/@zag-js/radio-group/dist/index.js +297 -302
  98. package/dist/node_modules/@zag-js/react/dist/index.js +255 -103
  99. package/dist/node_modules/@zag-js/remove-scroll/dist/index.js +18 -31
  100. package/dist/node_modules/@zag-js/select/dist/index.js +889 -885
  101. package/dist/node_modules/@zag-js/store/dist/index.js +98 -137
  102. package/dist/node_modules/@zag-js/switch/dist/index.js +199 -191
  103. package/dist/node_modules/@zag-js/tabs/dist/index.js +383 -386
  104. package/dist/node_modules/@zag-js/toast/dist/index.js +646 -633
  105. package/dist/node_modules/@zag-js/tooltip/dist/index.js +459 -0
  106. package/dist/node_modules/@zag-js/types/dist/index.js +6 -6
  107. package/dist/node_modules/@zag-js/utils/dist/index.js +112 -99
  108. package/dist/node_modules/proxy-compare/dist/index.js +4 -106
  109. package/dist/styles.css +1 -1
  110. package/package.json +5 -5
  111. package/dist/node_modules/@ark-ui/react/dist/utils/use-is-server.js +0 -10
  112. package/dist/node_modules/@zag-js/dom-event/dist/index.js +0 -130
  113. package/dist/node_modules/@zag-js/element-rect/dist/index.js +0 -32
  114. package/dist/node_modules/@zag-js/form-utils/dist/index.js +0 -51
  115. package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -52
  116. package/dist/node_modules/focus-trap/dist/focus-trap.esm.js +0 -431
  117. package/dist/node_modules/klona/full/index.js +0 -21
  118. package/dist/node_modules/tabbable/dist/index.esm.js +0 -202
@@ -1,290 +1,274 @@
1
- import { createAnatomy as R } from "../../anatomy/dist/index.js";
2
- import { getEventKey as y } from "../../dom-event/dist/index.js";
3
- import { createScope as G, isSafari as O, dataAttr as s, prevById as C, nextById as h, queryAll as S } from "../../dom-query/dist/index.js";
4
- import { compact as x, createSplitProps as P, last as F, first as w, warn as L, add as A, remove as N, isEqual as p } from "../../utils/dist/index.js";
5
- import { createMachine as $, guards as B } from "../../core/dist/index.js";
6
- import { createProps as v } from "../../types/dist/index.js";
7
- var U = R("accordion").parts("root", "item", "itemTrigger", "itemContent", "itemIndicator"), g = U.build(), i = G({
8
- getRootId: (e) => {
9
- var o;
10
- return ((o = e.ids) == null ? void 0 : o.root) ?? `accordion:${e.id}`;
11
- },
12
- getItemId: (e, o) => {
13
- var t, a;
14
- return ((a = (t = e.ids) == null ? void 0 : t.item) == null ? void 0 : a.call(t, o)) ?? `accordion:${e.id}:item:${o}`;
15
- },
16
- getItemContentId: (e, o) => {
17
- var t, a;
18
- return ((a = (t = e.ids) == null ? void 0 : t.itemContent) == null ? void 0 : a.call(t, o)) ?? `accordion:${e.id}:content:${o}`;
19
- },
20
- getItemTriggerId: (e, o) => {
21
- var t, a;
22
- return ((a = (t = e.ids) == null ? void 0 : t.itemTrigger) == null ? void 0 : a.call(t, o)) ?? `accordion:${e.id}:trigger:${o}`;
23
- },
24
- getRootEl: (e) => i.getById(e, i.getRootId(e)),
25
- getTriggerEls: (e) => {
26
- const t = `[aria-controls][data-ownedby='${CSS.escape(i.getRootId(e))}']:not([disabled])`;
27
- return S(i.getRootEl(e), t);
28
- },
29
- getFirstTriggerEl: (e) => w(i.getTriggerEls(e)),
30
- getLastTriggerEl: (e) => F(i.getTriggerEls(e)),
31
- getNextTriggerEl: (e, o) => h(i.getTriggerEls(e), i.getItemTriggerId(e, o)),
32
- getPrevTriggerEl: (e, o) => C(i.getTriggerEls(e), i.getItemTriggerId(e, o))
33
- });
34
- function J(e, o, t) {
35
- const a = e.context.focusedValue, d = e.context.value, I = e.context.multiple;
36
- function E(n) {
37
- let r = n;
38
- I && r.length > 1 && (r = [r[0]]), o({ type: "VALUE.SET", value: r });
1
+ import { createAnatomy as C } from "../../anatomy/dist/index.js";
2
+ import { getEventKey as h, isSafari as S, dataAttr as u, prevById as F, nextById as P, queryAll as w } from "../../dom-query/dist/index.js";
3
+ import { warn as x, last as L, first as A, add as $, remove as B } from "../../utils/dist/index.js";
4
+ import { createMachine as N, createGuards as U } from "../../core/dist/index.js";
5
+ import { createProps as y } from "../../types/dist/index.js";
6
+ var H = C("accordion").parts("root", "item", "itemTrigger", "itemContent", "itemIndicator"), g = H.build(), v = (e) => {
7
+ var t;
8
+ return ((t = e.ids) == null ? void 0 : t.root) ?? `accordion:${e.id}`;
9
+ }, K = (e, t) => {
10
+ var a, o;
11
+ return ((o = (a = e.ids) == null ? void 0 : a.item) == null ? void 0 : o.call(a, t)) ?? `accordion:${e.id}:item:${t}`;
12
+ }, b = (e, t) => {
13
+ var a, o;
14
+ return ((o = (a = e.ids) == null ? void 0 : a.itemContent) == null ? void 0 : o.call(a, t)) ?? `accordion:${e.id}:content:${t}`;
15
+ }, m = (e, t) => {
16
+ var a, o;
17
+ return ((o = (a = e.ids) == null ? void 0 : a.itemTrigger) == null ? void 0 : o.call(a, t)) ?? `accordion:${e.id}:trigger:${t}`;
18
+ }, k = (e) => e.getById(v(e)), p = (e) => {
19
+ const a = `[aria-controls][data-ownedby='${CSS.escape(v(e))}']:not([disabled])`;
20
+ return w(k(e), a);
21
+ }, D = (e) => A(p(e)), X = (e) => L(p(e)), z = (e, t) => P(p(e), m(e, t)), M = (e, t) => F(p(e), m(e, t));
22
+ function _(e, t) {
23
+ const { send: a, context: o, prop: n, scope: l, computed: f } = e, T = o.get("focusedValue"), I = o.get("value"), E = n("multiple");
24
+ function R(i) {
25
+ let r = i;
26
+ !E && r.length > 1 && (r = [r[0]]), a({ type: "VALUE.SET", value: r });
39
27
  }
40
- function c(n) {
28
+ function c(i) {
41
29
  return {
42
- expanded: d.includes(n.value),
43
- focused: a === n.value,
44
- disabled: !!(n.disabled ?? e.context.disabled)
30
+ expanded: I.includes(i.value),
31
+ focused: T === i.value,
32
+ disabled: !!(i.disabled ?? n("disabled"))
45
33
  };
46
34
  }
47
35
  return {
48
- focusedValue: a,
49
- value: d,
50
- setValue: E,
36
+ focusedValue: T,
37
+ value: I,
38
+ setValue: R,
51
39
  getItemState: c,
52
40
  getRootProps() {
53
41
  return t.element({
54
42
  ...g.root.attrs,
55
- dir: e.context.dir,
56
- id: i.getRootId(e.context),
57
- "data-orientation": e.context.orientation
43
+ dir: n("dir"),
44
+ id: v(l),
45
+ "data-orientation": n("orientation")
58
46
  });
59
47
  },
60
- getItemProps(n) {
61
- const r = c(n);
48
+ getItemProps(i) {
49
+ const r = c(i);
62
50
  return t.element({
63
51
  ...g.item.attrs,
64
- dir: e.context.dir,
65
- id: i.getItemId(e.context, n.value),
52
+ dir: n("dir"),
53
+ id: K(l, i.value),
66
54
  "data-state": r.expanded ? "open" : "closed",
67
- "data-focus": s(r.focused),
68
- "data-disabled": s(r.disabled),
69
- "data-orientation": e.context.orientation
55
+ "data-focus": u(r.focused),
56
+ "data-disabled": u(r.disabled),
57
+ "data-orientation": n("orientation")
70
58
  });
71
59
  },
72
- getItemContentProps(n) {
73
- const r = c(n);
60
+ getItemContentProps(i) {
61
+ const r = c(i);
74
62
  return t.element({
75
63
  ...g.itemContent.attrs,
76
- dir: e.context.dir,
64
+ dir: n("dir"),
77
65
  role: "region",
78
- id: i.getItemContentId(e.context, n.value),
79
- "aria-labelledby": i.getItemTriggerId(e.context, n.value),
66
+ id: b(l, i.value),
67
+ "aria-labelledby": m(l, i.value),
80
68
  hidden: !r.expanded,
81
69
  "data-state": r.expanded ? "open" : "closed",
82
- "data-disabled": s(r.disabled),
83
- "data-focus": s(r.focused),
84
- "data-orientation": e.context.orientation
70
+ "data-disabled": u(r.disabled),
71
+ "data-focus": u(r.focused),
72
+ "data-orientation": n("orientation")
85
73
  });
86
74
  },
87
- getItemIndicatorProps(n) {
88
- const r = c(n);
75
+ getItemIndicatorProps(i) {
76
+ const r = c(i);
89
77
  return t.element({
90
78
  ...g.itemIndicator.attrs,
91
- dir: e.context.dir,
79
+ dir: n("dir"),
92
80
  "aria-hidden": !0,
93
81
  "data-state": r.expanded ? "open" : "closed",
94
- "data-disabled": s(r.disabled),
95
- "data-focus": s(r.focused),
96
- "data-orientation": e.context.orientation
82
+ "data-disabled": u(r.disabled),
83
+ "data-focus": u(r.focused),
84
+ "data-orientation": n("orientation")
97
85
  });
98
86
  },
99
- getItemTriggerProps(n) {
100
- const { value: r } = n, l = c(n);
87
+ getItemTriggerProps(i) {
88
+ const { value: r } = i, d = c(i);
101
89
  return t.button({
102
90
  ...g.itemTrigger.attrs,
103
91
  type: "button",
104
- dir: e.context.dir,
105
- id: i.getItemTriggerId(e.context, r),
106
- "aria-controls": i.getItemContentId(e.context, r),
107
- "aria-expanded": l.expanded,
108
- disabled: l.disabled,
109
- "data-orientation": e.context.orientation,
110
- "aria-disabled": l.disabled,
111
- "data-state": l.expanded ? "open" : "closed",
112
- "data-ownedby": i.getRootId(e.context),
92
+ dir: n("dir"),
93
+ id: m(l, r),
94
+ "aria-controls": b(l, r),
95
+ "aria-expanded": d.expanded,
96
+ disabled: d.disabled,
97
+ "data-orientation": n("orientation"),
98
+ "aria-disabled": d.disabled,
99
+ "data-state": d.expanded ? "open" : "closed",
100
+ "data-ownedby": v(l),
113
101
  onFocus() {
114
- l.disabled || o({ type: "TRIGGER.FOCUS", value: r });
102
+ d.disabled || a({ type: "TRIGGER.FOCUS", value: r });
115
103
  },
116
104
  onBlur() {
117
- l.disabled || o("TRIGGER.BLUR");
105
+ d.disabled || a({ type: "TRIGGER.BLUR" });
118
106
  },
119
- onClick(u) {
120
- l.disabled || (O() && u.currentTarget.focus(), o({ type: "TRIGGER.CLICK", value: r }));
107
+ onClick(s) {
108
+ d.disabled || (S() && s.currentTarget.focus(), a({ type: "TRIGGER.CLICK", value: r }));
121
109
  },
122
- onKeyDown(u) {
123
- if (u.defaultPrevented || l.disabled) return;
124
- const V = {
110
+ onKeyDown(s) {
111
+ if (s.defaultPrevented || d.disabled) return;
112
+ const G = {
125
113
  ArrowDown() {
126
- e.context.isHorizontal || o({ type: "GOTO.NEXT", value: r });
114
+ f("isHorizontal") || a({ type: "GOTO.NEXT", value: r });
127
115
  },
128
116
  ArrowUp() {
129
- e.context.isHorizontal || o({ type: "GOTO.PREV", value: r });
117
+ f("isHorizontal") || a({ type: "GOTO.PREV", value: r });
130
118
  },
131
119
  ArrowRight() {
132
- e.context.isHorizontal && o({ type: "GOTO.NEXT", value: r });
120
+ f("isHorizontal") && a({ type: "GOTO.NEXT", value: r });
133
121
  },
134
122
  ArrowLeft() {
135
- e.context.isHorizontal && o({ type: "GOTO.PREV", value: r });
123
+ f("isHorizontal") && a({ type: "GOTO.PREV", value: r });
136
124
  },
137
125
  Home() {
138
- o({ type: "GOTO.FIRST", value: r });
126
+ a({ type: "GOTO.FIRST", value: r });
139
127
  },
140
128
  End() {
141
- o({ type: "GOTO.LAST", value: r });
129
+ a({ type: "GOTO.LAST", value: r });
142
130
  }
143
- }, b = y(u, {
144
- dir: e.context.dir,
145
- orientation: e.context.orientation
146
- }), m = V[b];
147
- m && (m(u), u.preventDefault());
131
+ }, O = h(s, {
132
+ dir: n("dir"),
133
+ orientation: n("orientation")
134
+ }), V = G[O];
135
+ V && (V(s), s.preventDefault());
148
136
  }
149
137
  });
150
138
  }
151
139
  };
152
140
  }
153
- var { and: H, not: k } = B;
154
- function Q(e) {
155
- const o = x(e);
156
- return $(
157
- {
158
- id: "accordion",
159
- initial: "idle",
160
- context: {
161
- focusedValue: null,
162
- value: [],
163
- collapsible: !1,
164
- multiple: !1,
165
- orientation: "vertical",
166
- ...o
167
- },
168
- watch: {
169
- value: "coarseValue",
170
- multiple: "coarseValue"
171
- },
172
- created: "coarseValue",
173
- computed: {
174
- isHorizontal: (t) => t.orientation === "horizontal"
175
- },
176
- on: {
177
- "VALUE.SET": {
178
- actions: ["setValue"]
141
+ var { and: q, not: j } = U(), ee = N({
142
+ props({ props: e }) {
143
+ return {
144
+ collapsible: !1,
145
+ multiple: !1,
146
+ orientation: "vertical",
147
+ defaultValue: [],
148
+ ...e
149
+ };
150
+ },
151
+ initialState() {
152
+ return "idle";
153
+ },
154
+ context({ prop: e, bindable: t }) {
155
+ return {
156
+ focusedValue: t(() => ({
157
+ defaultValue: null,
158
+ sync: !0,
159
+ onChange(a) {
160
+ var o;
161
+ (o = e("onFocusChange")) == null || o({ value: a });
179
162
  }
180
- },
181
- states: {
182
- idle: {
183
- on: {
184
- "TRIGGER.FOCUS": {
185
- target: "focused",
186
- actions: "setFocusedValue"
187
- }
188
- }
189
- },
190
- focused: {
191
- on: {
192
- "GOTO.NEXT": {
193
- actions: "focusNextTrigger"
194
- },
195
- "GOTO.PREV": {
196
- actions: "focusPrevTrigger"
197
- },
198
- "TRIGGER.CLICK": [
199
- {
200
- guard: H("isExpanded", "canToggle"),
201
- actions: ["collapse"]
202
- },
203
- {
204
- guard: k("isExpanded"),
205
- actions: ["expand"]
206
- }
207
- ],
208
- "GOTO.FIRST": {
209
- actions: "focusFirstTrigger"
210
- },
211
- "GOTO.LAST": {
212
- actions: "focusLastTrigger"
213
- },
214
- "TRIGGER.BLUR": {
215
- target: "idle",
216
- actions: "clearFocusedValue"
217
- }
218
- }
163
+ })),
164
+ value: t(() => ({
165
+ defaultValue: e("defaultValue"),
166
+ value: e("value"),
167
+ onChange(a) {
168
+ var o;
169
+ (o = e("onValueChange")) == null || o({ value: a });
170
+ }
171
+ }))
172
+ };
173
+ },
174
+ computed: {
175
+ isHorizontal: ({ prop: e }) => e("orientation") === "horizontal"
176
+ },
177
+ on: {
178
+ "VALUE.SET": {
179
+ actions: ["setValue"]
180
+ }
181
+ },
182
+ states: {
183
+ idle: {
184
+ on: {
185
+ "TRIGGER.FOCUS": {
186
+ target: "focused",
187
+ actions: ["setFocusedValue"]
219
188
  }
220
189
  }
221
190
  },
222
- {
223
- guards: {
224
- canToggle: (t) => !!t.collapsible || !!t.multiple,
225
- isExpanded: (t, a) => t.value.includes(a.value)
226
- },
227
- actions: {
228
- collapse(t, a) {
229
- const d = t.multiple ? N(t.value, a.value) : [];
230
- f.value(t, t.multiple ? d : []);
231
- },
232
- expand(t, a) {
233
- const d = t.multiple ? A(t.value, a.value) : [a.value];
234
- f.value(t, d);
235
- },
236
- focusFirstTrigger(t) {
237
- var a;
238
- (a = i.getFirstTriggerEl(t)) == null || a.focus();
239
- },
240
- focusLastTrigger(t) {
241
- var a;
242
- (a = i.getLastTriggerEl(t)) == null || a.focus();
243
- },
244
- focusNextTrigger(t) {
245
- if (!t.focusedValue) return;
246
- const a = i.getNextTriggerEl(t, t.focusedValue);
247
- a == null || a.focus();
248
- },
249
- focusPrevTrigger(t) {
250
- if (!t.focusedValue) return;
251
- const a = i.getPrevTriggerEl(t, t.focusedValue);
252
- a == null || a.focus();
191
+ focused: {
192
+ on: {
193
+ "GOTO.NEXT": {
194
+ actions: ["focusNextTrigger"]
253
195
  },
254
- setFocusedValue(t, a) {
255
- f.focusedValue(t, a.value);
196
+ "GOTO.PREV": {
197
+ actions: ["focusPrevTrigger"]
256
198
  },
257
- clearFocusedValue(t) {
258
- f.focusedValue(t, null);
199
+ "TRIGGER.CLICK": [
200
+ {
201
+ guard: q("isExpanded", "canToggle"),
202
+ actions: ["collapse"]
203
+ },
204
+ {
205
+ guard: j("isExpanded"),
206
+ actions: ["expand"]
207
+ }
208
+ ],
209
+ "GOTO.FIRST": {
210
+ actions: ["focusFirstTrigger"]
259
211
  },
260
- setValue(t, a) {
261
- f.value(t, a.value);
212
+ "GOTO.LAST": {
213
+ actions: ["focusLastTrigger"]
262
214
  },
263
- coarseValue(t) {
264
- !t.multiple && t.value.length > 1 && (L("The value of accordion should be a single value when multiple is false."), t.value = [t.value[0]]);
215
+ "TRIGGER.BLUR": {
216
+ target: "idle",
217
+ actions: ["clearFocusedValue"]
265
218
  }
266
219
  }
267
220
  }
268
- );
269
- }
270
- var T = {
271
- change(e) {
272
- var o;
273
- (o = e.onValueChange) == null || o.call(e, { value: Array.from(e.value) });
274
- },
275
- focusChange(e) {
276
- var o;
277
- (o = e.onFocusChange) == null || o.call(e, { value: e.focusedValue });
278
- }
279
- }, f = {
280
- value(e, o) {
281
- p(e.value, o) || (e.value = o, T.change(e));
282
221
  },
283
- focusedValue(e, o) {
284
- p(e.focusedValue, o) || (e.focusedValue = o, T.focusChange(e));
222
+ implementations: {
223
+ guards: {
224
+ canToggle: ({ prop: e }) => !!e("collapsible") || !!e("multiple"),
225
+ isExpanded: ({ context: e, event: t }) => e.get("value").includes(t.value)
226
+ },
227
+ actions: {
228
+ collapse({ context: e, prop: t, event: a }) {
229
+ const o = t("multiple") ? B(e.get("value"), a.value) : [];
230
+ e.set("value", o);
231
+ },
232
+ expand({ context: e, prop: t, event: a }) {
233
+ const o = t("multiple") ? $(e.get("value"), a.value) : [a.value];
234
+ e.set("value", o);
235
+ },
236
+ focusFirstTrigger({ scope: e }) {
237
+ var t;
238
+ (t = D(e)) == null || t.focus();
239
+ },
240
+ focusLastTrigger({ scope: e }) {
241
+ var t;
242
+ (t = X(e)) == null || t.focus();
243
+ },
244
+ focusNextTrigger({ context: e, scope: t }) {
245
+ const a = e.get("focusedValue");
246
+ if (!a) return;
247
+ const o = z(t, a);
248
+ o == null || o.focus();
249
+ },
250
+ focusPrevTrigger({ context: e, scope: t }) {
251
+ const a = e.get("focusedValue");
252
+ if (!a) return;
253
+ const o = M(t, a);
254
+ o == null || o.focus();
255
+ },
256
+ setFocusedValue({ context: e, event: t }) {
257
+ e.set("focusedValue", t.value);
258
+ },
259
+ clearFocusedValue({ context: e }) {
260
+ e.set("focusedValue", null);
261
+ },
262
+ setValue({ context: e, event: t }) {
263
+ e.set("value", t.value);
264
+ },
265
+ coarseValue({ context: e, prop: t }) {
266
+ !t("multiple") && e.get("value").length > 1 && (x("The value of accordion should be a single value when multiple is false."), e.set("value", [e.get("value")[0]]));
267
+ }
268
+ }
285
269
  }
286
- };
287
- v()([
270
+ });
271
+ y()([
288
272
  "collapsible",
289
273
  "dir",
290
274
  "disabled",
@@ -295,13 +279,12 @@ v()([
295
279
  "onFocusChange",
296
280
  "onValueChange",
297
281
  "orientation",
298
- "value"
282
+ "value",
283
+ "defaultValue"
299
284
  ]);
300
- var K = v()(["value", "disabled"]), W = P(K);
285
+ y()(["value", "disabled"]);
301
286
  export {
302
- U as anatomy,
303
- J as connect,
304
- K as itemProps,
305
- Q as machine,
306
- W as splitItemProps
287
+ H as anatomy,
288
+ _ as connect,
289
+ ee as machine
307
290
  };
@@ -1,19 +1,56 @@
1
- import { hideOthers as s } from "../../../aria-hidden/dist/es2015/index.js";
2
- var i = (t) => {
3
- const o = requestAnimationFrame(() => t());
4
- return () => cancelAnimationFrame(o);
1
+ var i = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), p = {}, m = 0, b = (t) => t && (t.host || b(t.parentNode)), M = (t, n) => n.map((a) => {
2
+ if (t.contains(a)) return a;
3
+ const s = b(a);
4
+ return s && t.contains(s) ? s : (console.error("[zag-js > ariaHidden] target", a, "in not contained inside", t, ". Doing nothing"), null);
5
+ }).filter((a) => !!a), W = (t) => t.localName === "next-route-announcer" || t.localName === "script" || t.hasAttribute("aria-live") ? !0 : t.matches("[data-live-announcer]"), g = (t, n) => {
6
+ const { parentNode: a, markerName: s, controlAttribute: o } = n, c = M(a, Array.isArray(t) ? t : [t]);
7
+ p[s] || (p[s] = /* @__PURE__ */ new WeakMap());
8
+ const u = p[s], v = [], f = /* @__PURE__ */ new Set(), N = new Set(c), A = (e) => {
9
+ !e || f.has(e) || (f.add(e), A(e.parentNode));
10
+ };
11
+ c.forEach(A);
12
+ const d = (e) => {
13
+ !e || N.has(e) || Array.prototype.forEach.call(e.children, (r) => {
14
+ if (f.has(r))
15
+ d(r);
16
+ else
17
+ try {
18
+ if (W(r)) return;
19
+ const k = r.getAttribute(o) === "true", w = (i.get(r) || 0) + 1, y = (u.get(r) || 0) + 1;
20
+ i.set(r, w), u.set(r, y), v.push(r), w === 1 && k && h.set(r, !0), y === 1 && r.setAttribute(s, ""), k || r.setAttribute(o, "true");
21
+ } catch (l) {
22
+ console.error("[zag-js > ariaHidden] cannot operate on ", r, l);
23
+ }
24
+ });
25
+ };
26
+ return d(a), f.clear(), m++, () => {
27
+ v.forEach((e) => {
28
+ const r = i.get(e) - 1, l = u.get(e) - 1;
29
+ i.set(e, r), u.set(e, l), r || (h.has(e) || e.removeAttribute(o), h.delete(e)), l || e.removeAttribute(s);
30
+ }), m--, m || (i = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), p = {});
31
+ };
32
+ }, H = (t) => (Array.isArray(t) ? t[0] : t).ownerDocument.body, E = (t, n = H(t), a = "data-aria-hidden") => {
33
+ if (n)
34
+ return g(t, {
35
+ parentNode: n,
36
+ markerName: a,
37
+ controlAttribute: "aria-hidden"
38
+ });
39
+ }, V = (t) => {
40
+ const n = requestAnimationFrame(() => t());
41
+ return () => cancelAnimationFrame(n);
5
42
  };
6
- function m(t, o = {}) {
7
- const { defer: n = !0 } = o, a = n ? i : (e) => e(), r = [];
8
- return r.push(
9
- a(() => {
10
- const c = (typeof t == "function" ? t() : t).filter(Boolean);
11
- r.push(s(c));
43
+ function S(t, n = {}) {
44
+ const { defer: a = !0 } = n, s = a ? V : (c) => c(), o = [];
45
+ return o.push(
46
+ s(() => {
47
+ const u = (typeof t == "function" ? t() : t).filter(Boolean);
48
+ u.length !== 0 && o.push(E(u));
12
49
  })
13
50
  ), () => {
14
- r.forEach((e) => e == null ? void 0 : e());
51
+ o.forEach((c) => c == null ? void 0 : c());
15
52
  };
16
53
  }
17
54
  export {
18
- m as ariaHidden
55
+ S as ariaHidden
19
56
  };