@serendie/ui 2.1.3 → 2.2.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 (122) hide show
  1. package/dist/client.js +79 -74
  2. package/dist/components/Accordion/Accordion.d.ts +1 -1
  3. package/dist/components/Avatar/Avatar.d.ts +1 -1
  4. package/dist/components/Banner/Banner.d.ts +1 -1
  5. package/dist/components/BottomNavigation/BottomNavigationItem.d.ts +1 -1
  6. package/dist/components/Button/Button.d.ts +2 -2
  7. package/dist/components/Button/Button.js +22 -21
  8. package/dist/components/DatePicker/DatePicker.d.ts +13 -0
  9. package/dist/components/DatePicker/DatePicker.js +203 -0
  10. package/dist/components/DatePicker/index.d.ts +2 -0
  11. package/dist/components/DatePicker/index.js +6 -0
  12. package/dist/components/DatePicker/parseDate.d.ts +1 -0
  13. package/dist/components/DatePicker/styles.d.ts +1 -0
  14. package/dist/components/DatePicker/styles.js +224 -0
  15. package/dist/components/IconButton/IconButton.d.ts +3 -3
  16. package/dist/components/List/ListItem.d.ts +1 -1
  17. package/dist/components/ModalDialog/ModalDialog.d.ts +1 -1
  18. package/dist/components/NotificationBadge/NotificationBadge.d.ts +1 -1
  19. package/dist/components/Pagination/Pagination.d.ts +1 -1
  20. package/dist/components/ProgressIndicator/AnimatedArc.d.ts +6 -0
  21. package/dist/components/ProgressIndicator/AnimatedArc.js +46 -0
  22. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +11 -29
  23. package/dist/components/ProgressIndicator/ProgressIndicator.js +201 -43
  24. package/dist/components/ProgressIndicator/ProgressIndicatorIndeterminate.d.ts +10 -0
  25. package/dist/components/ProgressIndicator/ProgressIndicatorIndeterminate.js +215 -0
  26. package/dist/components/ProgressIndicator/index.d.ts +4 -1
  27. package/dist/components/ProgressIndicator/index.js +3 -2
  28. package/dist/components/ProgressIndicator/util.d.ts +1 -0
  29. package/dist/components/ProgressIndicator/util.js +13 -0
  30. package/dist/components/Search/Search.d.ts +1 -1
  31. package/dist/components/Select/Select.d.ts +1 -1
  32. package/dist/components/Switch/Switch.d.ts +1 -1
  33. package/dist/components/Tabs/Tabs.d.ts +1 -1
  34. package/dist/components/TextField/TextField.js +59 -156
  35. package/dist/components/Toast/Toast.d.ts +1 -1
  36. package/dist/components/TopAppBar/TopAppBar.d.ts +1 -1
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.js +80 -75
  39. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-content.js +15 -0
  40. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-context.js +5 -0
  41. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-control.js +13 -0
  42. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-input.js +14 -0
  43. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-label.js +13 -0
  44. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-month-select.js +13 -0
  45. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-next-trigger.js +14 -0
  46. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-positioner.js +14 -0
  47. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-prev-trigger.js +14 -0
  48. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-root.js +55 -0
  49. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-body.js +14 -0
  50. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-cell-trigger.js +19 -0
  51. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-cell.js +26 -0
  52. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-head.js +14 -0
  53. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-header.js +14 -0
  54. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-row.js +14 -0
  55. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table.js +16 -0
  56. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-trigger.js +13 -0
  57. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-view-control.js +14 -0
  58. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-view.js +23 -0
  59. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-year-select.js +13 -0
  60. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker.anatomy.js +5 -0
  61. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-context.js +10 -0
  62. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-table-cell-props-context.js +10 -0
  63. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-table-props-context.js +10 -0
  64. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-view-props-context.js +12 -0
  65. package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker.js +18 -0
  66. package/dist/node_modules/@ark-ui/react/dist/components/factory.js +11 -12
  67. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-root.js +5 -4
  68. package/dist/node_modules/@ark-ui/react/dist/utils/use-event.js +0 -1
  69. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +36 -36
  70. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +238 -235
  71. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +88 -83
  72. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +68 -67
  73. package/dist/node_modules/@internationalized/date/dist/CalendarDate.js +178 -0
  74. package/dist/node_modules/@internationalized/date/dist/DateFormatter.js +99 -0
  75. package/dist/node_modules/@internationalized/date/dist/GregorianCalendar.js +98 -0
  76. package/dist/node_modules/@internationalized/date/dist/conversion.js +135 -0
  77. package/dist/node_modules/@internationalized/date/dist/manipulation.js +205 -0
  78. package/dist/node_modules/@internationalized/date/dist/queries.js +202 -0
  79. package/dist/node_modules/@internationalized/date/dist/string.js +41 -0
  80. package/dist/node_modules/@internationalized/date/dist/utils.js +6 -0
  81. package/dist/node_modules/@internationalized/date/dist/weekStartData.js +100 -0
  82. package/dist/node_modules/@swc/helpers/esm/_check_private_redeclaration.js +7 -0
  83. package/dist/node_modules/@swc/helpers/esm/_class_private_field_init.js +7 -0
  84. package/dist/node_modules/@zag-js/anatomy/dist/index.js +15 -14
  85. package/dist/node_modules/@zag-js/aria-hidden/dist/index.js +23 -23
  86. package/dist/node_modules/@zag-js/collection/dist/index.js +102 -71
  87. package/dist/node_modules/@zag-js/combobox/dist/index.js +482 -426
  88. package/dist/node_modules/@zag-js/date-picker/dist/index.js +1826 -0
  89. package/dist/node_modules/@zag-js/date-utils/dist/index.js +366 -0
  90. package/dist/node_modules/@zag-js/dialog/dist/index.js +66 -64
  91. package/dist/node_modules/@zag-js/dismissable/dist/index.js +94 -69
  92. package/dist/node_modules/@zag-js/dom-query/dist/index.js +359 -300
  93. package/dist/node_modules/@zag-js/live-region/dist/index.js +39 -0
  94. package/dist/node_modules/@zag-js/menu/dist/index.js +357 -340
  95. package/dist/node_modules/@zag-js/popper/dist/index.js +123 -120
  96. package/dist/node_modules/@zag-js/presence/dist/index.js +17 -17
  97. package/dist/node_modules/@zag-js/radio-group/dist/index.js +118 -117
  98. package/dist/node_modules/@zag-js/react/dist/index.js +124 -121
  99. package/dist/node_modules/@zag-js/select/dist/index.js +211 -197
  100. package/dist/node_modules/@zag-js/toast/dist/index.js +73 -71
  101. package/dist/node_modules/@zag-js/tooltip/dist/index.js +31 -30
  102. package/dist/node_modules/@zag-js/utils/dist/index.js +150 -104
  103. package/dist/preset.d.ts +11 -1
  104. package/dist/recipes/index.d.ts +3 -2
  105. package/dist/recipes/index.js +5 -2
  106. package/dist/recipes/textFieldRecipe.d.ts +6 -0
  107. package/dist/recipes/textFieldRecipe.js +107 -0
  108. package/dist/styled-system/css/cva.js +43 -38
  109. package/dist/styled-system/recipes/create-recipe.js +37 -0
  110. package/dist/styled-system/recipes/text-field-recipe.js +61 -0
  111. package/dist/styles.css +1 -1
  112. package/dist/tokens/keyframes/index.d.ts +8 -0
  113. package/dist/tokens/keyframes/index.js +6 -2
  114. package/package.json +3 -3
  115. package/styled-system/recipes/create-recipe.js +82 -0
  116. package/styled-system/recipes/index.d.ts +2 -0
  117. package/styled-system/recipes/index.js +1 -0
  118. package/styled-system/recipes/text-field-recipe.d.ts +28 -0
  119. package/styled-system/recipes/text-field-recipe.js +72 -0
  120. package/styled-system/types/prop-type.d.ts +1 -1
  121. package/dist/node_modules/@zag-js/store/dist/index.js +0 -131
  122. package/dist/node_modules/proxy-compare/dist/index.js +0 -7
@@ -1,13 +1,13 @@
1
- import { raf as B, contains as h, getDocument as b, waitForElements as I, addDomEvent as D, setStyle as M, getEventTarget as g, isHTMLElement as A } from "../../dom-query/dist/index.js";
2
- import { trackInteractOutside as N } from "../../interact-outside/dist/index.js";
3
- import { isFunction as k, warn as p } from "../../utils/dist/index.js";
4
- function T(e, t) {
5
- const i = (r) => {
1
+ import { raf as B, contains as f, getDocument as k, waitForElement as A, setStyle as N, addDomEvent as T, isHTMLElement as x, getEventTarget as m } from "../../dom-query/dist/index.js";
2
+ import { trackInteractOutside as q } from "../../interact-outside/dist/index.js";
3
+ import { isFunction as v, warn as P } from "../../utils/dist/index.js";
4
+ function S(e, t) {
5
+ const n = (r) => {
6
6
  r.key === "Escape" && (r.isComposing || t == null || t(r));
7
7
  };
8
- return D(b(e), "keydown", i, { capture: !0 });
8
+ return T(k(e), "keydown", n, { capture: !0 });
9
9
  }
10
- var c = {
10
+ var E = "layer:request-dismiss", c = {
11
11
  layers: [],
12
12
  branches: [],
13
13
  count() {
@@ -24,8 +24,8 @@ var c = {
24
24
  },
25
25
  isBelowPointerBlockingLayer(e) {
26
26
  var r;
27
- const t = this.indexOf(e), i = this.topMostPointerBlockingLayer() ? this.indexOf((r = this.topMostPointerBlockingLayer()) == null ? void 0 : r.node) : -1;
28
- return t < i;
27
+ const t = this.indexOf(e), n = this.topMostPointerBlockingLayer() ? this.indexOf((r = this.topMostPointerBlockingLayer()) == null ? void 0 : r.node) : -1;
28
+ return t < n;
29
29
  },
30
30
  isTopMost(e) {
31
31
  const t = this.layers[this.count() - 1];
@@ -35,38 +35,60 @@ var c = {
35
35
  return Array.from(this.layers).slice(this.indexOf(e) + 1);
36
36
  },
37
37
  isInNestedLayer(e, t) {
38
- return this.getNestedLayers(e).some((i) => h(i.node, t));
38
+ return this.getNestedLayers(e).some((n) => f(n.node, t));
39
39
  },
40
40
  isInBranch(e) {
41
- return Array.from(this.branches).some((t) => h(t, e));
41
+ return Array.from(this.branches).some((t) => f(t, e));
42
42
  },
43
43
  add(e) {
44
- const t = this.layers.push(e);
45
- e.node.style.setProperty("--layer-index", `${t}`);
44
+ this.layers.push(e), this.syncLayerIndex();
46
45
  },
47
46
  addBranch(e) {
48
47
  this.branches.push(e);
49
48
  },
50
49
  remove(e) {
51
50
  const t = this.indexOf(e);
52
- t < 0 || (t < this.count() - 1 && this.getNestedLayers(e).forEach((r) => r.dismiss()), this.layers.splice(t, 1), e.style.removeProperty("--layer-index"));
51
+ t < 0 || (t < this.count() - 1 && this.getNestedLayers(e).forEach((r) => c.dismiss(r.node, e)), this.layers.splice(t, 1), this.syncLayerIndex());
53
52
  },
54
53
  removeBranch(e) {
55
54
  const t = this.branches.indexOf(e);
56
55
  t >= 0 && this.branches.splice(t, 1);
57
56
  },
57
+ syncLayerIndex() {
58
+ this.layers.forEach((e, t) => {
59
+ e.node.style.setProperty("--layer-index", `${t}`);
60
+ });
61
+ },
58
62
  indexOf(e) {
59
63
  return this.layers.findIndex((t) => t.node === e);
60
64
  },
61
- dismiss(e) {
62
- var t;
63
- (t = this.layers[this.indexOf(e)]) == null || t.dismiss();
65
+ dismiss(e, t) {
66
+ const n = this.indexOf(e);
67
+ if (n === -1) return;
68
+ const r = this.layers[n];
69
+ C(e, E, (a) => {
70
+ var s;
71
+ (s = r.requestDismiss) == null || s.call(r, a), a.defaultPrevented || r == null || r.dismiss();
72
+ }), _(e, E, {
73
+ originalLayer: e,
74
+ targetLayer: t,
75
+ originalIndex: n,
76
+ targetIndex: t ? this.indexOf(t) : -1
77
+ }), this.syncLayerIndex();
64
78
  },
65
79
  clear() {
66
80
  this.remove(this.layers[0].node);
67
81
  }
68
- }, m;
69
- function E() {
82
+ };
83
+ function _(e, t, n) {
84
+ const r = e.ownerDocument.defaultView || window, a = new r.CustomEvent(t, { cancelable: !0, bubbles: !0, detail: n });
85
+ return e.dispatchEvent(a);
86
+ }
87
+ function C(e, t, n) {
88
+ e.addEventListener(t, n, { once: !0 });
89
+ }
90
+ var b;
91
+ function L() {
70
92
  c.layers.forEach(({ node: e }) => {
71
93
  e.style.pointerEvents = c.isBelowPointerBlockingLayer(e) ? "none" : "auto";
72
94
  });
@@ -74,90 +96,93 @@ function E() {
74
96
  function K(e) {
75
97
  e.style.pointerEvents = "";
76
98
  }
77
- function C(e, t) {
78
- const i = b(e), r = [];
79
- if (c.hasPointerBlockingLayer() && !i.body.hasAttribute("data-inert") && (m = document.body.style.pointerEvents, queueMicrotask(() => {
80
- i.body.style.pointerEvents = "none", i.body.setAttribute("data-inert", "");
81
- })), t) {
82
- const a = I(t, (n) => {
83
- r.push(M(n, { pointerEvents: "auto" }));
84
- });
85
- r.push(a);
86
- }
87
- return () => {
99
+ function R(e, t) {
100
+ const n = k(e), r = [];
101
+ return c.hasPointerBlockingLayer() && !n.body.hasAttribute("data-inert") && (b = document.body.style.pointerEvents, queueMicrotask(() => {
102
+ n.body.style.pointerEvents = "none", n.body.setAttribute("data-inert", "");
103
+ })), t == null || t.forEach((a) => {
104
+ const [s, h] = A(
105
+ () => {
106
+ const d = a();
107
+ return x(d) ? d : null;
108
+ },
109
+ { timeout: 1e3 }
110
+ );
111
+ s.then((d) => r.push(N(d, { pointerEvents: "auto" }))), r.push(h);
112
+ }), () => {
88
113
  c.hasPointerBlockingLayer() || (queueMicrotask(() => {
89
- i.body.style.pointerEvents = m, i.body.removeAttribute("data-inert"), i.body.style.length === 0 && i.body.removeAttribute("style");
114
+ n.body.style.pointerEvents = b, n.body.removeAttribute("data-inert"), n.body.style.length === 0 && n.body.removeAttribute("style");
90
115
  }), r.forEach((a) => a()));
91
116
  };
92
117
  }
93
- function _(e, t) {
94
- const { warnOnMissingNode: i = !0 } = t;
95
- if (i && !e) {
96
- p("[@zag-js/dismissable] node is `null` or `undefined`");
118
+ function j(e, t) {
119
+ const { warnOnMissingNode: n = !0 } = t;
120
+ if (n && !e) {
121
+ P("[@zag-js/dismissable] node is `null` or `undefined`");
97
122
  return;
98
123
  }
99
124
  if (!e)
100
125
  return;
101
- const { onDismiss: r, pointerBlocking: a, exclude: n, debug: y } = t, P = { dismiss: r, node: e, pointerBlocking: a };
102
- c.add(P), E();
103
- function v(s) {
126
+ const { onDismiss: r, onRequestDismiss: a, pointerBlocking: s, exclude: h, debug: d } = t, w = { dismiss: r, node: e, pointerBlocking: s, requestDismiss: a };
127
+ c.add(w), L();
128
+ function I(i) {
104
129
  var u, l;
105
- const o = g(s.detail.originalEvent);
106
- c.isBelowPointerBlockingLayer(e) || c.isInBranch(o) || ((u = t.onPointerDownOutside) == null || u.call(t, s), (l = t.onInteractOutside) == null || l.call(t, s), !s.defaultPrevented && (y && console.log("onPointerDownOutside:", s.detail.originalEvent), r == null || r()));
130
+ const o = m(i.detail.originalEvent);
131
+ c.isBelowPointerBlockingLayer(e) || c.isInBranch(o) || ((u = t.onPointerDownOutside) == null || u.call(t, i), (l = t.onInteractOutside) == null || l.call(t, i), !i.defaultPrevented && (d && console.log("onPointerDownOutside:", i.detail.originalEvent), r == null || r()));
107
132
  }
108
- function L(s) {
133
+ function O(i) {
109
134
  var u, l;
110
- const o = g(s.detail.originalEvent);
111
- c.isInBranch(o) || ((u = t.onFocusOutside) == null || u.call(t, s), (l = t.onInteractOutside) == null || l.call(t, s), !s.defaultPrevented && (y && console.log("onFocusOutside:", s.detail.originalEvent), r == null || r()));
135
+ const o = m(i.detail.originalEvent);
136
+ c.isInBranch(o) || ((u = t.onFocusOutside) == null || u.call(t, i), (l = t.onInteractOutside) == null || l.call(t, i), !i.defaultPrevented && (d && console.log("onFocusOutside:", i.detail.originalEvent), r == null || r()));
112
137
  }
113
- function x(s) {
138
+ function p(i) {
114
139
  var o;
115
- c.isTopMost(e) && ((o = t.onEscapeKeyDown) == null || o.call(t, s), !s.defaultPrevented && r && (s.preventDefault(), r()));
140
+ c.isTopMost(e) && ((o = t.onEscapeKeyDown) == null || o.call(t, i), !i.defaultPrevented && r && (i.preventDefault(), r()));
116
141
  }
117
- function w(s) {
118
- var f;
142
+ function D(i) {
143
+ var g;
119
144
  if (!e) return !1;
120
- const o = typeof n == "function" ? n() : n, u = Array.isArray(o) ? o : [o], l = (f = t.persistentElements) == null ? void 0 : f.map((d) => d()).filter(A);
121
- return l && u.push(...l), u.some((d) => h(d, s)) || c.isInNestedLayer(e, s);
145
+ const o = typeof h == "function" ? h() : h, u = Array.isArray(o) ? o : [o], l = (g = t.persistentElements) == null ? void 0 : g.map((y) => y()).filter(x);
146
+ return l && u.push(...l), u.some((y) => f(y, i)) || c.isInNestedLayer(e, i);
122
147
  }
123
- const O = [
124
- a ? C(e, t.persistentElements) : void 0,
125
- T(e, x),
126
- N(e, { exclude: w, onFocusOutside: L, onPointerDownOutside: v, defer: t.defer })
148
+ const M = [
149
+ s ? R(e, t.persistentElements) : void 0,
150
+ S(e, p),
151
+ q(e, { exclude: D, onFocusOutside: O, onPointerDownOutside: I, defer: t.defer })
127
152
  ];
128
153
  return () => {
129
- c.remove(e), E(), K(e), O.forEach((s) => s == null ? void 0 : s());
154
+ c.remove(e), L(), K(e), M.forEach((i) => i == null ? void 0 : i());
130
155
  };
131
156
  }
132
- function S(e, t) {
133
- const { defer: i } = t, r = i ? B : (n) => n(), a = [];
157
+ function H(e, t) {
158
+ const { defer: n } = t, r = n ? B : (s) => s(), a = [];
134
159
  return a.push(
135
160
  r(() => {
136
- const n = k(e) ? e() : e;
137
- a.push(_(n, t));
161
+ const s = v(e) ? e() : e;
162
+ a.push(j(s, t));
138
163
  })
139
164
  ), () => {
140
- a.forEach((n) => n == null ? void 0 : n());
165
+ a.forEach((s) => s == null ? void 0 : s());
141
166
  };
142
167
  }
143
- function F(e, t = {}) {
144
- const { defer: i } = t, r = i ? B : (n) => n(), a = [];
168
+ function Q(e, t = {}) {
169
+ const { defer: n } = t, r = n ? B : (s) => s(), a = [];
145
170
  return a.push(
146
171
  r(() => {
147
- const n = k(e) ? e() : e;
148
- if (!n) {
149
- p("[@zag-js/dismissable] branch node is `null` or `undefined`");
172
+ const s = v(e) ? e() : e;
173
+ if (!s) {
174
+ P("[@zag-js/dismissable] branch node is `null` or `undefined`");
150
175
  return;
151
176
  }
152
- c.addBranch(n), a.push(() => {
153
- c.removeBranch(n);
177
+ c.addBranch(s), a.push(() => {
178
+ c.removeBranch(s);
154
179
  });
155
180
  })
156
181
  ), () => {
157
- a.forEach((n) => n == null ? void 0 : n());
182
+ a.forEach((s) => s == null ? void 0 : s());
158
183
  };
159
184
  }
160
185
  export {
161
- F as trackDismissableBranch,
162
- S as trackDismissableElement
186
+ Q as trackDismissableBranch,
187
+ H as trackDismissableElement
163
188
  };