@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
@@ -2,15 +2,15 @@ import { contains as q, MAX_Z_INDEX as X, raf as N, dataAttr as D, addDomEvent a
2
2
  import { createAnatomy as Q } from "../../anatomy/dist/index.js";
3
3
  import { createMachine as K, createGuards as Y } from "../../core/dist/index.js";
4
4
  import { trackDismissableBranch as Z } from "../../dismissable/dist/index.js";
5
- import { compact as J, runIfFn as C, uuid as _, setRafTimeout as w, ensureProps as z } from "../../utils/dist/index.js";
6
- var tt = Q("toast").parts(
5
+ import { compact as J, warn as z, runIfFn as C, uuid as _, setRafTimeout as w, ensureProps as tt } from "../../utils/dist/index.js";
6
+ var et = Q("toast").parts(
7
7
  "group",
8
8
  "root",
9
9
  "title",
10
10
  "description",
11
11
  "actionTrigger",
12
12
  "closeTrigger"
13
- ), O = tt.build(), et = (t) => `toast-group:${t}`, H = (t, e) => t.getById(`toast-group:${e}`), W = (t) => `toast:${t.id}`, U = (t) => t.getById(W(t)), V = (t) => `toast:${t.id}:title`, G = (t) => `toast:${t.id}:description`, st = (t) => `toast${t.id}:close`, $ = {
13
+ ), O = et.build(), st = (t) => `toast-group:${t}`, H = (t, e) => t.getById(`toast-group:${e}`), W = (t) => `toast:${t.id}`, U = (t) => t.getById(W(t)), V = (t) => `toast:${t.id}:title`, G = (t) => `toast:${t.id}:description`, it = (t) => `toast${t.id}:close`, $ = {
14
14
  info: 5e3,
15
15
  error: 5e3,
16
16
  success: 2e3,
@@ -20,10 +20,10 @@ var tt = Q("toast").parts(
20
20
  function A(t, e) {
21
21
  return t ?? $[e] ?? $.DEFAULT;
22
22
  }
23
- var it = (t) => typeof t == "string" ? { left: t, right: t, bottom: t, top: t } : t;
24
- function nt(t, e) {
23
+ var nt = (t) => typeof t == "string" ? { left: t, right: t, bottom: t, top: t } : t;
24
+ function rt(t, e) {
25
25
  var b;
26
- const { prop: i, computed: s, context: r } = t, { offsets: a, gap: c } = i("store").attrs, l = r.get("heights"), d = it(a), m = i("dir") === "rtl", u = e.replace("-start", m ? "-right" : "-left").replace("-end", m ? "-left" : "-right"), p = u.includes("right"), v = u.includes("left"), f = {
26
+ const { prop: i, computed: s, context: r } = t, { offsets: a, gap: c } = i("store").attrs, l = r.get("heights"), d = nt(a), m = i("dir") === "rtl", u = e.replace("-start", m ? "-right" : "-left").replace("-end", m ? "-left" : "-right"), p = u.includes("right"), E = u.includes("left"), f = {
27
27
  position: "fixed",
28
28
  pointerEvents: s("count") > 0 ? void 0 : "none",
29
29
  display: "flex",
@@ -33,26 +33,26 @@ function nt(t, e) {
33
33
  zIndex: X
34
34
  };
35
35
  let h = "center";
36
- if (p && (h = "flex-end"), v && (h = "flex-start"), f.alignItems = h, u.includes("top")) {
37
- const E = d.top;
38
- f.top = `max(env(safe-area-inset-top, 0px), ${E})`;
36
+ if (p && (h = "flex-end"), E && (h = "flex-start"), f.alignItems = h, u.includes("top")) {
37
+ const T = d.top;
38
+ f.top = `max(env(safe-area-inset-top, 0px), ${T})`;
39
39
  }
40
40
  if (u.includes("bottom")) {
41
- const E = d.bottom;
42
- f.bottom = `max(env(safe-area-inset-bottom, 0px), ${E})`;
41
+ const T = d.bottom;
42
+ f.bottom = `max(env(safe-area-inset-bottom, 0px), ${T})`;
43
43
  }
44
44
  if (!u.includes("left")) {
45
- const E = d.right;
46
- f.insetInlineEnd = `calc(env(safe-area-inset-right, 0px) + ${E})`;
45
+ const T = d.right;
46
+ f.insetInlineEnd = `calc(env(safe-area-inset-right, 0px) + ${T})`;
47
47
  }
48
48
  if (!u.includes("right")) {
49
- const E = d.left;
50
- f.insetInlineStart = `calc(env(safe-area-inset-left, 0px) + ${E})`;
49
+ const T = d.left;
50
+ f.insetInlineStart = `calc(env(safe-area-inset-left, 0px) + ${T})`;
51
51
  }
52
52
  return f;
53
53
  }
54
- function rt(t, e) {
55
- const { prop: i, context: s, computed: r } = t, a = i("parent"), c = a.computed("placement"), { gap: l } = a.prop("store").attrs, [d] = c.split("-"), m = s.get("mounted"), u = s.get("remainingTime"), p = r("height"), v = r("frontmost"), f = !v, h = !i("stacked"), b = i("stacked"), S = i("type") === "loading" ? Number.MAX_SAFE_INTEGER : u, F = r("heightIndex") * l + r("heightBefore"), R = {
54
+ function ot(t, e) {
55
+ const { prop: i, context: s, computed: r } = t, a = i("parent"), c = a.computed("placement"), { gap: l } = a.prop("store").attrs, [d] = c.split("-"), m = s.get("mounted"), u = s.get("remainingTime"), p = r("height"), E = r("frontmost"), f = !E, h = !i("stacked"), b = i("stacked"), S = i("type") === "loading" ? Number.MAX_SAFE_INTEGER : u, F = r("heightIndex") * l + r("heightBefore"), R = {
56
56
  position: "absolute",
57
57
  pointerEvents: "auto",
58
58
  "--opacity": "0",
@@ -94,11 +94,11 @@ function rt(t, e) {
94
94
  "--y": "calc(var(--sign) * 40%)"
95
95
  })), f && b && !e && g({
96
96
  "--y": "calc(var(--lift) * var(--offset) + var(--lift) * -100%)"
97
- }), v && !e && g({
97
+ }), E && !e && g({
98
98
  "--y": "calc(var(--lift) * -100%)"
99
99
  }), R;
100
100
  }
101
- function ot(t, e) {
101
+ function at(t, e) {
102
102
  const { computed: i } = t, s = {
103
103
  position: "absolute",
104
104
  inset: "0",
@@ -109,7 +109,7 @@ function ot(t, e) {
109
109
  height: "calc(var(--initial-height) + 80%)"
110
110
  }), s;
111
111
  }
112
- function at() {
112
+ function ct() {
113
113
  return {
114
114
  position: "absolute",
115
115
  left: "0",
@@ -118,7 +118,7 @@ function at() {
118
118
  width: "100%"
119
119
  };
120
120
  }
121
- function ct(t, e) {
121
+ function lt(t, e) {
122
122
  const { context: i, prop: s, send: r, refs: a, computed: c } = t;
123
123
  return {
124
124
  getCount() {
@@ -128,19 +128,19 @@ function ct(t, e) {
128
128
  return i.get("toasts");
129
129
  },
130
130
  getGroupProps(l = {}) {
131
- const { label: d = "Notifications" } = l, { hotkey: m } = s("store").attrs, u = m.join("+").replace(/Key/g, "").replace(/Digit/g, ""), p = c("placement"), [v, f = "center"] = p.split("-");
131
+ const { label: d = "Notifications" } = l, { hotkey: m } = s("store").attrs, u = m.join("+").replace(/Key/g, "").replace(/Digit/g, ""), p = c("placement"), [E, f = "center"] = p.split("-");
132
132
  return e.element({
133
133
  ...O.group.attrs,
134
134
  dir: s("dir"),
135
135
  tabIndex: -1,
136
136
  "aria-label": `${p} ${d} ${u}`,
137
- id: et(p),
137
+ id: st(p),
138
138
  "data-placement": p,
139
- "data-side": v,
139
+ "data-side": E,
140
140
  "data-align": f,
141
141
  "aria-live": "polite",
142
142
  role: "region",
143
- style: nt(t, p),
143
+ style: rt(t, p),
144
144
  onMouseMove() {
145
145
  r({ type: "REGION.POINTER_ENTER", placement: p });
146
146
  },
@@ -160,7 +160,7 @@ function ct(t, e) {
160
160
  }
161
161
  };
162
162
  }
163
- var lt = K({
163
+ var ut = K({
164
164
  props({ props: t }) {
165
165
  return {
166
166
  dir: "ltr",
@@ -363,13 +363,13 @@ var lt = K({
363
363
  }
364
364
  }
365
365
  });
366
- function Dt(t, e) {
367
- const { state: i, send: s, prop: r, scope: a, context: c, computed: l } = t, d = i.hasTag("visible"), m = i.hasTag("paused"), u = c.get("mounted"), p = l("frontmost"), v = r("parent").computed("placement"), f = r("type"), h = r("stacked"), b = r("title"), E = r("description"), S = r("action"), [F, R = "center"] = v.split("-");
366
+ function Ot(t, e) {
367
+ const { state: i, send: s, prop: r, scope: a, context: c, computed: l } = t, d = i.hasTag("visible"), m = i.hasTag("paused"), u = c.get("mounted"), p = l("frontmost"), E = r("parent").computed("placement"), f = r("type"), h = r("stacked"), b = r("title"), T = r("description"), S = r("action"), [F, R = "center"] = E.split("-");
368
368
  return {
369
369
  type: f,
370
370
  title: b,
371
- description: E,
372
- placement: v,
371
+ description: T,
372
+ placement: E,
373
373
  visible: d,
374
374
  paused: m,
375
375
  closable: !!r("closable"),
@@ -389,7 +389,7 @@ function Dt(t, e) {
389
389
  id: W(a),
390
390
  "data-state": d ? "open" : "closed",
391
391
  "data-type": f,
392
- "data-placement": v,
392
+ "data-placement": E,
393
393
  "data-align": R,
394
394
  "data-side": F,
395
395
  "data-mounted": D(u),
@@ -400,10 +400,10 @@ function Dt(t, e) {
400
400
  "data-overlap": D(!h),
401
401
  role: "status",
402
402
  "aria-atomic": "true",
403
- "aria-describedby": E ? G(a) : void 0,
403
+ "aria-describedby": T ? G(a) : void 0,
404
404
  "aria-labelledby": b ? V(a) : void 0,
405
405
  tabIndex: 0,
406
- style: rt(t, d),
406
+ style: ot(t, d),
407
407
  onKeyDown(g) {
408
408
  g.defaultPrevented || g.key == "Escape" && (s({ type: "DISMISS", src: "keyboard" }), g.preventDefault());
409
409
  }
@@ -413,14 +413,14 @@ function Dt(t, e) {
413
413
  getGhostBeforeProps() {
414
414
  return e.element({
415
415
  "data-ghost": "before",
416
- style: ot(t, d)
416
+ style: at(t, d)
417
417
  });
418
418
  },
419
419
  /* Needed to avoid setting hover to false when in between toasts */
420
420
  getGhostAfterProps() {
421
421
  return e.element({
422
422
  "data-ghost": "after",
423
- style: at()
423
+ style: ct()
424
424
  });
425
425
  },
426
426
  getTitleProps() {
@@ -447,7 +447,7 @@ function Dt(t, e) {
447
447
  },
448
448
  getCloseTriggerProps() {
449
449
  return e.button({
450
- id: st(a),
450
+ id: it(a),
451
451
  ...O.closeTrigger.attrs,
452
452
  type: "button",
453
453
  "aria-label": "Dismiss notification",
@@ -458,9 +458,9 @@ function Dt(t, e) {
458
458
  }
459
459
  };
460
460
  }
461
- var { not: ut } = Y(), Ot = K({
461
+ var { not: dt } = Y(), Rt = K({
462
462
  props({ props: t }) {
463
- return z(t, ["id", "type", "parent", "removeDelay"], "toast"), {
463
+ return tt(t, ["id", "type", "parent", "removeDelay"], "toast"), {
464
464
  closable: !0,
465
465
  ...t,
466
466
  duration: A(t.duration, t.type)
@@ -548,7 +548,7 @@ var { not: ut } = Y(), Ot = K({
548
548
  tags: ["visible", "paused"],
549
549
  on: {
550
550
  RESUME: {
551
- guard: ut("isLoadingType"),
551
+ guard: dt("isLoadingType"),
552
552
  target: "visible",
553
553
  actions: ["setCloseTimer"]
554
554
  },
@@ -679,9 +679,9 @@ function B(t, e) {
679
679
  const { id: i, height: s } = e;
680
680
  t.context.set("heights", (r) => r.find((c) => c.id === i) ? r.map((c) => c.id === i ? { ...c, height: s } : c) : [{ id: i, height: s }, ...r]);
681
681
  }
682
- var dt = (t, e) => ({ ...e, ...J(t) });
683
- function Rt(t) {
684
- const e = dt(t, {
682
+ var gt = (t, e) => ({ ...e, ...J(t) });
683
+ function kt(t) {
684
+ const e = gt(t, {
685
685
  placement: "bottom",
686
686
  overlap: !1,
687
687
  max: 24,
@@ -707,8 +707,8 @@ function Rt(t) {
707
707
  n && (l(n), s.unshift(n));
708
708
  }
709
709
  }, u = (n) => {
710
- const o = n.id ?? `toast:${_()}`, I = s.find((y) => y.id === o);
711
- return r.has(o) && r.delete(o), I ? s = s.map((y) => y.id === o ? l({ ...y, ...n, id: o }) : y) : d({
710
+ const o = n.id ?? `toast:${_()}`, I = s.find((v) => v.id === o);
711
+ return r.has(o) && r.delete(o), I ? s = s.map((v) => v.id === o ? l({ ...v, ...n, id: o }) : v) : d({
712
712
  id: o,
713
713
  duration: e.duration,
714
714
  removeDelay: e.removeDelay,
@@ -737,37 +737,39 @@ function Rt(t) {
737
737
  getVisibleToasts: () => s.filter((n) => !r.has(n.id)),
738
738
  getCount: () => s.length,
739
739
  promise: (n, o, I = {}) => {
740
- if (!o) return;
741
- let y;
742
- o.loading !== void 0 && (y = u({
740
+ if (!o || !o.loading) {
741
+ z("[zag-js > toast] toaster.promise() requires at least a 'loading' option to be specified");
742
+ return;
743
+ }
744
+ const v = u({
743
745
  ...I,
744
746
  ...o.loading,
745
747
  promise: n,
746
748
  type: "loading"
747
- }));
748
- let M = y !== void 0, P;
749
- const j = C(n).then(async (T) => {
750
- if (P = ["resolve", T], gt(T) && !T.ok) {
749
+ });
750
+ let M = !0, P;
751
+ const j = C(n).then(async (y) => {
752
+ if (P = ["resolve", y], pt(y) && !y.ok) {
751
753
  M = !1;
752
- const x = C(o.error, `HTTP Error! status: ${T.status}`);
753
- u({ ...I, ...x, id: y, type: "error" });
754
+ const x = C(o.error, `HTTP Error! status: ${y.status}`);
755
+ u({ ...I, ...x, id: v, type: "error" });
754
756
  } else if (o.success !== void 0) {
755
757
  M = !1;
756
- const x = C(o.success, T);
757
- u({ ...I, ...x, id: y, type: "success" });
758
+ const x = C(o.success, y);
759
+ u({ ...I, ...x, id: v, type: "success" });
758
760
  }
759
- }).catch(async (T) => {
760
- if (P = ["reject", T], o.error !== void 0) {
761
+ }).catch(async (y) => {
762
+ if (P = ["reject", y], o.error !== void 0) {
761
763
  M = !1;
762
- const x = C(o.error, T);
763
- u({ ...I, ...x, id: y, type: "error" });
764
+ const x = C(o.error, y);
765
+ u({ ...I, ...x, id: v, type: "error" });
764
766
  }
765
767
  }).finally(() => {
766
- var T;
767
- M && (p(y), y = void 0), (T = o.finally) == null || T.call(o);
768
+ var y;
769
+ M && p(v), (y = o.finally) == null || y.call(o);
768
770
  });
769
- return { id: y, unwrap: () => new Promise(
770
- (T, x) => j.then(() => P[0] === "reject" ? x(P[1]) : T(P[1])).catch(x)
771
+ return { id: v, unwrap: () => new Promise(
772
+ (y, x) => j.then(() => P[0] === "reject" ? x(P[1]) : y(P[1])).catch(x)
771
773
  ) };
772
774
  },
773
775
  pause: (n) => {
@@ -786,14 +788,14 @@ function Rt(t) {
786
788
  }
787
789
  };
788
790
  }
789
- var gt = (t) => t && typeof t == "object" && "ok" in t && typeof t.ok == "boolean" && "status" in t && typeof t.status == "number", kt = {
790
- connect: ct,
791
- machine: lt
791
+ var pt = (t) => t && typeof t == "object" && "ok" in t && typeof t.ok == "boolean" && "status" in t && typeof t.status == "number", Pt = {
792
+ connect: lt,
793
+ machine: ut
792
794
  };
793
795
  export {
794
- tt as anatomy,
795
- Dt as connect,
796
- Rt as createStore,
797
- kt as group,
798
- Ot as machine
796
+ et as anatomy,
797
+ Ot as connect,
798
+ kt as createStore,
799
+ Pt as group,
800
+ Rt as machine
799
801
  };
@@ -1,14 +1,14 @@
1
- import { createAnatomy as M } from "../../anatomy/dist/index.js";
2
- import { addDomEvent as u, getOverflowAncestors as D, dataAttr as E, isLeftClick as I, isComposingEvent as V } from "../../dom-query/dist/index.js";
3
- import { trackFocusVisible as T, isFocusVisible as S } from "../../focus-visible/dist/index.js";
1
+ import { createAnatomy as D } from "../../anatomy/dist/index.js";
2
+ import { addDomEvent as u, getOverflowAncestors as M, dataAttr as E, isLeftClick as I, isComposingEvent as V } from "../../dom-query/dist/index.js";
3
+ import { trackFocusVisible as S, isFocusVisible as T } from "../../focus-visible/dist/index.js";
4
4
  import { getPlacement as k, getPlacementStyles as F } from "../../popper/dist/index.js";
5
- import { subscribe as A, proxy as G } from "../../store/dist/index.js";
6
- import { createMachine as K, createGuards as L } from "../../core/dist/index.js";
7
- import { createProps as $ } from "../../types/dist/index.js";
8
- var q = M("tooltip").parts("trigger", "arrow", "arrowTip", "positioner", "content"), d = q.build(), b = (e) => {
5
+ import { createStore as A } from "../../utils/dist/index.js";
6
+ import { createMachine as G, createGuards as K } from "../../core/dist/index.js";
7
+ import { createProps as L } from "../../types/dist/index.js";
8
+ var $ = D("tooltip").parts("trigger", "arrow", "arrowTip", "positioner", "content"), d = $.build(), b = (e) => {
9
9
  var t;
10
10
  return ((t = e.ids) == null ? void 0 : t.trigger) ?? `tooltip:${e.id}:trigger`;
11
- }, x = (e) => {
11
+ }, q = (e) => {
12
12
  var t;
13
13
  return ((t = e.ids) == null ? void 0 : t.content) ?? `tooltip:${e.id}:content`;
14
14
  }, B = (e) => {
@@ -17,9 +17,9 @@ var q = M("tooltip").parts("trigger", "arrow", "arrowTip", "positioner", "conten
17
17
  }, w = (e) => {
18
18
  var t;
19
19
  return ((t = e.ids) == null ? void 0 : t.positioner) ?? `tooltip:${e.id}:popper`;
20
- }, v = (e) => e.getById(b(e)), m = (e) => e.getById(w(e)), l = G({ id: null });
21
- function X(e, t) {
22
- const { state: o, context: s, send: r, scope: a, prop: n, event: O } = e, f = n("id"), P = !!n("aria-label"), p = o.matches("open", "closing"), h = b(a), y = x(a), c = n("disabled"), g = F({
20
+ }, v = (e) => e.getById(b(e)), m = (e) => e.getById(w(e)), l = A({ id: null });
21
+ function W(e, t) {
22
+ const { state: o, context: s, send: r, scope: a, prop: n, event: O } = e, f = n("id"), P = !!n("aria-label"), p = o.matches("open", "closing"), h = b(a), y = q(a), c = n("disabled"), g = F({
23
23
  ...n("positioning"),
24
24
  placement: s.get("currentPlacement")
25
25
  });
@@ -44,14 +44,14 @@ function X(e, t) {
44
44
  },
45
45
  onFocus(i) {
46
46
  queueMicrotask(() => {
47
- i.defaultPrevented || c || O.src !== "trigger.pointerdown" && S() && r({ type: "open", src: "trigger.focus" });
47
+ i.defaultPrevented || c || O.src !== "trigger.pointerdown" && T() && r({ type: "open", src: "trigger.focus" });
48
48
  });
49
49
  },
50
50
  onBlur(i) {
51
- i.defaultPrevented || c || f === l.id && r({ type: "close", src: "trigger.blur" });
51
+ i.defaultPrevented || c || f === l.get("id") && r({ type: "close", src: "trigger.blur" });
52
52
  },
53
53
  onPointerDown(i) {
54
- i.defaultPrevented || c || I(i) && n("closeOnPointerDown") && f === l.id && r({ type: "close", src: "trigger.pointerdown" });
54
+ i.defaultPrevented || c || I(i) && n("closeOnPointerDown") && f === l.get("id") && r({ type: "close", src: "trigger.pointerdown" });
55
55
  },
56
56
  onPointerMove(i) {
57
57
  i.defaultPrevented || c || i.pointerType !== "touch" && r({ type: "pointer.move" });
@@ -109,20 +109,21 @@ function X(e, t) {
109
109
  }
110
110
  };
111
111
  }
112
- var { and: N, not: C } = L(), Y = K({
112
+ var { and: x, not: C } = K(), X = G({
113
113
  initialState: ({ prop: e }) => e("open") || e("defaultOpen") ? "open" : "closed",
114
114
  props({ props: e }) {
115
+ const t = e.closeOnClick ?? !0, o = e.closeOnPointerDown ?? t;
115
116
  return {
116
117
  id: "x",
117
118
  openDelay: 1e3,
118
119
  closeDelay: 500,
119
- closeOnPointerDown: !0,
120
120
  closeOnEscape: !0,
121
121
  interactive: !1,
122
122
  closeOnScroll: !0,
123
- closeOnClick: !0,
124
123
  disabled: !1,
125
124
  ...e,
125
+ closeOnPointerDown: o,
126
+ closeOnClick: t,
126
127
  positioning: {
127
128
  placement: "bottom",
128
129
  ...e.positioning
@@ -163,7 +164,7 @@ var { and: N, not: C } = L(), Y = K({
163
164
  },
164
165
  "pointer.move": [
165
166
  {
166
- guard: N("noVisibleTooltip", C("hasPointerMoveOpened")),
167
+ guard: x("noVisibleTooltip", C("hasPointerMoveOpened")),
167
168
  target: "opening"
168
169
  },
169
170
  {
@@ -321,18 +322,18 @@ var { and: N, not: C } = L(), Y = K({
321
322
  },
322
323
  implementations: {
323
324
  guards: {
324
- noVisibleTooltip: () => l.id === null,
325
- isVisible: ({ prop: e }) => e("id") === l.id,
325
+ noVisibleTooltip: () => l.get("id") === null,
326
+ isVisible: ({ prop: e }) => e("id") === l.get("id"),
326
327
  isInteractive: ({ prop: e }) => !!e("interactive"),
327
328
  hasPointerMoveOpened: ({ context: e }) => e.get("hasPointerMoveOpened"),
328
329
  isOpenControlled: ({ prop: e }) => e("open") !== void 0
329
330
  },
330
331
  actions: {
331
332
  setGlobalId: ({ prop: e }) => {
332
- l.id = e("id");
333
+ l.set("id", e("id"));
333
334
  },
334
335
  clearGlobalId: ({ prop: e }) => {
335
- e("id") === l.id && (l.id = null);
336
+ e("id") === l.get("id") && l.set("id", null);
336
337
  },
337
338
  invokeOnOpen: ({ prop: e }) => {
338
339
  var t;
@@ -376,7 +377,7 @@ var { and: N, not: C } = L(), Y = K({
376
377
  effects: {
377
378
  trackFocusVisible: ({ scope: e }) => {
378
379
  var t;
379
- return T({ root: (t = e.getRootNode) == null ? void 0 : t.call(e) });
380
+ return S({ root: (t = e.getRootNode) == null ? void 0 : t.call(e) });
380
381
  },
381
382
  trackPositioning: ({ context: e, prop: t, scope: o }) => {
382
383
  e.get("currentPlacement") || e.set("currentPlacement", t("positioning").placement);
@@ -397,7 +398,7 @@ var { and: N, not: C } = L(), Y = K({
397
398
  if (!t("closeOnScroll")) return;
398
399
  const s = v(o);
399
400
  if (!s) return;
400
- const a = D(s).map((n) => u(n, "scroll", () => {
401
+ const a = M(s).map((n) => u(n, "scroll", () => {
401
402
  e({ type: "close", src: "scroll" });
402
403
  }, {
403
404
  passive: !0,
@@ -410,8 +411,8 @@ var { and: N, not: C } = L(), Y = K({
410
411
  trackStore: ({ prop: e, send: t }) => {
411
412
  let o;
412
413
  return queueMicrotask(() => {
413
- o = A(l, () => {
414
- l.id !== e("id") && t({ type: "close", src: "id.change" });
414
+ o = l.subscribe(() => {
415
+ l.get("id") !== e("id") && t({ type: "close", src: "id.change" });
415
416
  });
416
417
  }), () => o == null ? void 0 : o();
417
418
  },
@@ -433,7 +434,7 @@ var { and: N, not: C } = L(), Y = K({
433
434
  }
434
435
  }
435
436
  });
436
- $()([
437
+ L()([
437
438
  "aria-label",
438
439
  "closeDelay",
439
440
  "closeOnEscape",
@@ -453,7 +454,7 @@ $()([
453
454
  "positioning"
454
455
  ]);
455
456
  export {
456
- q as anatomy,
457
- X as connect,
458
- Y as machine
457
+ $ as anatomy,
458
+ W as connect,
459
+ X as machine
459
460
  };