@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.
- package/dist/client.js +79 -74
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Avatar/Avatar.d.ts +1 -1
- package/dist/components/Banner/Banner.d.ts +1 -1
- package/dist/components/BottomNavigation/BottomNavigationItem.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Button/Button.js +22 -21
- package/dist/components/DatePicker/DatePicker.d.ts +13 -0
- package/dist/components/DatePicker/DatePicker.js +203 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/index.js +6 -0
- package/dist/components/DatePicker/parseDate.d.ts +1 -0
- package/dist/components/DatePicker/styles.d.ts +1 -0
- package/dist/components/DatePicker/styles.js +224 -0
- package/dist/components/IconButton/IconButton.d.ts +3 -3
- package/dist/components/List/ListItem.d.ts +1 -1
- package/dist/components/ModalDialog/ModalDialog.d.ts +1 -1
- package/dist/components/NotificationBadge/NotificationBadge.d.ts +1 -1
- package/dist/components/Pagination/Pagination.d.ts +1 -1
- package/dist/components/ProgressIndicator/AnimatedArc.d.ts +6 -0
- package/dist/components/ProgressIndicator/AnimatedArc.js +46 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +11 -29
- package/dist/components/ProgressIndicator/ProgressIndicator.js +201 -43
- package/dist/components/ProgressIndicator/ProgressIndicatorIndeterminate.d.ts +10 -0
- package/dist/components/ProgressIndicator/ProgressIndicatorIndeterminate.js +215 -0
- package/dist/components/ProgressIndicator/index.d.ts +4 -1
- package/dist/components/ProgressIndicator/index.js +3 -2
- package/dist/components/ProgressIndicator/util.d.ts +1 -0
- package/dist/components/ProgressIndicator/util.js +13 -0
- package/dist/components/Search/Search.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Switch/Switch.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +1 -1
- package/dist/components/TextField/TextField.js +59 -156
- package/dist/components/Toast/Toast.d.ts +1 -1
- package/dist/components/TopAppBar/TopAppBar.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +80 -75
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-content.js +15 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-context.js +5 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-control.js +13 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-input.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-label.js +13 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-month-select.js +13 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-next-trigger.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-positioner.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-prev-trigger.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-root.js +55 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-body.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-cell-trigger.js +19 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-cell.js +26 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-head.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-header.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-row.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table.js +16 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-trigger.js +13 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-view-control.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-view.js +23 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-year-select.js +13 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker.anatomy.js +5 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-context.js +10 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-table-cell-props-context.js +10 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-table-props-context.js +10 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-view-props-context.js +12 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker.js +18 -0
- package/dist/node_modules/@ark-ui/react/dist/components/factory.js +11 -12
- package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-root.js +5 -4
- package/dist/node_modules/@ark-ui/react/dist/utils/use-event.js +0 -1
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +36 -36
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +238 -235
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +88 -83
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +68 -67
- package/dist/node_modules/@internationalized/date/dist/CalendarDate.js +178 -0
- package/dist/node_modules/@internationalized/date/dist/DateFormatter.js +99 -0
- package/dist/node_modules/@internationalized/date/dist/GregorianCalendar.js +98 -0
- package/dist/node_modules/@internationalized/date/dist/conversion.js +135 -0
- package/dist/node_modules/@internationalized/date/dist/manipulation.js +205 -0
- package/dist/node_modules/@internationalized/date/dist/queries.js +202 -0
- package/dist/node_modules/@internationalized/date/dist/string.js +41 -0
- package/dist/node_modules/@internationalized/date/dist/utils.js +6 -0
- package/dist/node_modules/@internationalized/date/dist/weekStartData.js +100 -0
- package/dist/node_modules/@swc/helpers/esm/_check_private_redeclaration.js +7 -0
- package/dist/node_modules/@swc/helpers/esm/_class_private_field_init.js +7 -0
- package/dist/node_modules/@zag-js/anatomy/dist/index.js +15 -14
- package/dist/node_modules/@zag-js/aria-hidden/dist/index.js +23 -23
- package/dist/node_modules/@zag-js/collection/dist/index.js +102 -71
- package/dist/node_modules/@zag-js/combobox/dist/index.js +482 -426
- package/dist/node_modules/@zag-js/date-picker/dist/index.js +1826 -0
- package/dist/node_modules/@zag-js/date-utils/dist/index.js +366 -0
- package/dist/node_modules/@zag-js/dialog/dist/index.js +66 -64
- package/dist/node_modules/@zag-js/dismissable/dist/index.js +94 -69
- package/dist/node_modules/@zag-js/dom-query/dist/index.js +359 -300
- package/dist/node_modules/@zag-js/live-region/dist/index.js +39 -0
- package/dist/node_modules/@zag-js/menu/dist/index.js +357 -340
- package/dist/node_modules/@zag-js/popper/dist/index.js +123 -120
- package/dist/node_modules/@zag-js/presence/dist/index.js +17 -17
- package/dist/node_modules/@zag-js/radio-group/dist/index.js +118 -117
- package/dist/node_modules/@zag-js/react/dist/index.js +124 -121
- package/dist/node_modules/@zag-js/select/dist/index.js +211 -197
- package/dist/node_modules/@zag-js/toast/dist/index.js +73 -71
- package/dist/node_modules/@zag-js/tooltip/dist/index.js +31 -30
- package/dist/node_modules/@zag-js/utils/dist/index.js +150 -104
- package/dist/preset.d.ts +11 -1
- package/dist/recipes/index.d.ts +3 -2
- package/dist/recipes/index.js +5 -2
- package/dist/recipes/textFieldRecipe.d.ts +6 -0
- package/dist/recipes/textFieldRecipe.js +107 -0
- package/dist/styled-system/css/cva.js +43 -38
- package/dist/styled-system/recipes/create-recipe.js +37 -0
- package/dist/styled-system/recipes/text-field-recipe.js +61 -0
- package/dist/styles.css +1 -1
- package/dist/tokens/keyframes/index.d.ts +8 -0
- package/dist/tokens/keyframes/index.js +6 -2
- package/package.json +3 -3
- package/styled-system/recipes/create-recipe.js +82 -0
- package/styled-system/recipes/index.d.ts +2 -0
- package/styled-system/recipes/index.js +1 -0
- package/styled-system/recipes/text-field-recipe.d.ts +28 -0
- package/styled-system/recipes/text-field-recipe.js +72 -0
- package/styled-system/types/prop-type.d.ts +1 -1
- package/dist/node_modules/@zag-js/store/dist/index.js +0 -131
- 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
|
|
6
|
-
var
|
|
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 =
|
|
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
|
|
24
|
-
function
|
|
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 =
|
|
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"),
|
|
37
|
-
const
|
|
38
|
-
f.top = `max(env(safe-area-inset-top, 0px), ${
|
|
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
|
|
42
|
-
f.bottom = `max(env(safe-area-inset-bottom, 0px), ${
|
|
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
|
|
46
|
-
f.insetInlineEnd = `calc(env(safe-area-inset-right, 0px) + ${
|
|
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
|
|
50
|
-
f.insetInlineStart = `calc(env(safe-area-inset-left, 0px) + ${
|
|
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
|
|
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"),
|
|
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
|
-
}),
|
|
97
|
+
}), E && !e && g({
|
|
98
98
|
"--y": "calc(var(--lift) * -100%)"
|
|
99
99
|
}), R;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
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
|
|
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
|
|
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"), [
|
|
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:
|
|
137
|
+
id: st(p),
|
|
138
138
|
"data-placement": p,
|
|
139
|
-
"data-side":
|
|
139
|
+
"data-side": E,
|
|
140
140
|
"data-align": f,
|
|
141
141
|
"aria-live": "polite",
|
|
142
142
|
role: "region",
|
|
143
|
-
style:
|
|
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
|
|
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
|
|
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"),
|
|
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:
|
|
372
|
-
placement:
|
|
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":
|
|
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":
|
|
403
|
+
"aria-describedby": T ? G(a) : void 0,
|
|
404
404
|
"aria-labelledby": b ? V(a) : void 0,
|
|
405
405
|
tabIndex: 0,
|
|
406
|
-
style:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
461
|
+
var { not: dt } = Y(), Rt = K({
|
|
462
462
|
props({ props: t }) {
|
|
463
|
-
return
|
|
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:
|
|
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
|
|
683
|
-
function
|
|
684
|
-
const e =
|
|
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((
|
|
711
|
-
return r.has(o) && r.delete(o), I ? s = s.map((
|
|
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)
|
|
741
|
-
|
|
742
|
-
|
|
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 =
|
|
749
|
-
const j = C(n).then(async (
|
|
750
|
-
if (P = ["resolve",
|
|
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: ${
|
|
753
|
-
u({ ...I, ...x, id:
|
|
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,
|
|
757
|
-
u({ ...I, ...x, id:
|
|
758
|
+
const x = C(o.success, y);
|
|
759
|
+
u({ ...I, ...x, id: v, type: "success" });
|
|
758
760
|
}
|
|
759
|
-
}).catch(async (
|
|
760
|
-
if (P = ["reject",
|
|
761
|
+
}).catch(async (y) => {
|
|
762
|
+
if (P = ["reject", y], o.error !== void 0) {
|
|
761
763
|
M = !1;
|
|
762
|
-
const x = C(o.error,
|
|
763
|
-
u({ ...I, ...x, id:
|
|
764
|
+
const x = C(o.error, y);
|
|
765
|
+
u({ ...I, ...x, id: v, type: "error" });
|
|
764
766
|
}
|
|
765
767
|
}).finally(() => {
|
|
766
|
-
var
|
|
767
|
-
M &&
|
|
768
|
+
var y;
|
|
769
|
+
M && p(v), (y = o.finally) == null || y.call(o);
|
|
768
770
|
});
|
|
769
|
-
return { id:
|
|
770
|
-
(
|
|
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
|
|
790
|
-
connect:
|
|
791
|
-
machine:
|
|
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
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
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
|
|
2
|
-
import { addDomEvent as u, getOverflowAncestors as
|
|
3
|
-
import { trackFocusVisible as
|
|
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 {
|
|
6
|
-
import { createMachine as
|
|
7
|
-
import { createProps as
|
|
8
|
-
var
|
|
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
|
-
},
|
|
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 =
|
|
21
|
-
function
|
|
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 =
|
|
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" &&
|
|
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:
|
|
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:
|
|
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
|
|
333
|
+
l.set("id", e("id"));
|
|
333
334
|
},
|
|
334
335
|
clearGlobalId: ({ prop: e }) => {
|
|
335
|
-
e("id") === l.id &&
|
|
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
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
457
|
-
|
|
458
|
-
|
|
457
|
+
$ as anatomy,
|
|
458
|
+
W as connect,
|
|
459
|
+
X as machine
|
|
459
460
|
};
|