tintora 0.21.1 → 0.23.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/Alert/Alert.d.ts +20 -0
- package/dist/Popover/Popover.d.ts +40 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +585 -456
- package/dist/tintora.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { cloneElement as n, createContext as r, useContext as i, useEffect as a, useId as o, useLayoutEffect as s, useRef as c, useState as l } from "react";
|
|
3
3
|
//#region node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
4
4
|
function u(e) {
|
|
5
5
|
var t, n, r = "";
|
|
@@ -17,31 +17,100 @@ function d() {
|
|
|
17
17
|
return r;
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
20
|
+
//#region src/Alert/Alert.tsx
|
|
21
|
+
var f = {
|
|
22
|
+
info: /* @__PURE__ */ e("path", { d: "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20zM12 16v-4M12 8h.01" }),
|
|
23
|
+
success: /* @__PURE__ */ e("path", { d: "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20zM8 12.5l2.7 2.7L16 9.8" }),
|
|
24
|
+
warning: /* @__PURE__ */ e("path", { d: "M10.3 3.9L1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0zM12 9v4M12 17h.01" }),
|
|
25
|
+
error: /* @__PURE__ */ e("path", { d: "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20zM15 9l-6 6M9 9l6 6" })
|
|
26
|
+
}, p = ({ status: t }) => /* @__PURE__ */ e("svg", {
|
|
27
|
+
width: "22",
|
|
28
|
+
height: "22",
|
|
29
|
+
viewBox: "0 0 24 24",
|
|
30
|
+
fill: "none",
|
|
31
|
+
stroke: `var(--tintora-status-${t}-fg)`,
|
|
32
|
+
strokeWidth: "2",
|
|
33
|
+
strokeLinecap: "round",
|
|
34
|
+
strokeLinejoin: "round",
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
style: {
|
|
37
|
+
flex: "0 0 auto",
|
|
38
|
+
marginTop: 1
|
|
39
|
+
},
|
|
40
|
+
children: f[t]
|
|
41
|
+
});
|
|
42
|
+
function m({ status: n = "info", variant: r = "alert", title: i, children: a, action: o, onDismiss: s, className: c, ...l }) {
|
|
43
|
+
return /* @__PURE__ */ t("div", {
|
|
44
|
+
...l,
|
|
45
|
+
role: r === "alert" && n === "error" ? "alert" : "status",
|
|
46
|
+
className: d("tintora-alert", r === "announcement" ? "tintora-alert--announcement" : `tintora-alert--${n}`, c),
|
|
47
|
+
children: [
|
|
48
|
+
r === "alert" && /* @__PURE__ */ e(p, { status: n }),
|
|
49
|
+
/* @__PURE__ */ t("div", {
|
|
50
|
+
className: d("tintora-alert__content", r === "announcement" && "tintora-alert__content--announcement"),
|
|
51
|
+
children: [
|
|
52
|
+
i && /* @__PURE__ */ e("span", {
|
|
53
|
+
className: "tintora-alert__content__title",
|
|
54
|
+
children: i
|
|
55
|
+
}),
|
|
56
|
+
a && /* @__PURE__ */ e("span", {
|
|
57
|
+
className: "tintora-alert__content__sub-title",
|
|
58
|
+
children: a
|
|
59
|
+
}),
|
|
60
|
+
o && /* @__PURE__ */ e("button", {
|
|
61
|
+
type: "button",
|
|
62
|
+
onClick: o.onClick,
|
|
63
|
+
className: d("tintora-alert__content__action", r === "alert" && `tintora-alert__content__action--${n}`),
|
|
64
|
+
children: o.label
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
}),
|
|
68
|
+
r === "alert" && s && /* @__PURE__ */ e("button", {
|
|
69
|
+
type: "button",
|
|
70
|
+
"aria-label": "Dismiss",
|
|
71
|
+
className: "tintora-alert__close",
|
|
72
|
+
onClick: s,
|
|
73
|
+
children: /* @__PURE__ */ e("svg", {
|
|
74
|
+
width: "16",
|
|
75
|
+
height: "16",
|
|
76
|
+
viewBox: "0 0 24 24",
|
|
77
|
+
fill: "none",
|
|
78
|
+
stroke: "currentColor",
|
|
79
|
+
strokeWidth: "2",
|
|
80
|
+
strokeLinecap: "round",
|
|
81
|
+
"aria-hidden": "true",
|
|
82
|
+
children: /* @__PURE__ */ e("path", { d: "M18 6L6 18M6 6l12 12" })
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
20
89
|
//#region src/Avatar/utils.ts
|
|
21
|
-
function
|
|
90
|
+
function h(e) {
|
|
22
91
|
if (!e.length) return "";
|
|
23
92
|
let t = e.trim().split(/\s+/).map((e) => e.match(/\p{L}\p{M}*/u)?.[0]).filter((e) => !!e);
|
|
24
93
|
return `${t[0] ?? ""}${t.length > 1 ? t.at(-1) ?? "" : ""}`.toLocaleUpperCase();
|
|
25
94
|
}
|
|
26
95
|
//#endregion
|
|
27
96
|
//#region src/Avatar/Avatar.tsx
|
|
28
|
-
function
|
|
29
|
-
let [
|
|
30
|
-
return /* @__PURE__ */
|
|
97
|
+
function g({ name: t, src: n, size: r = "medium", className: i, ...a }) {
|
|
98
|
+
let [o, s] = l(), c = !!n && n !== o;
|
|
99
|
+
return /* @__PURE__ */ e("span", {
|
|
31
100
|
role: "img",
|
|
32
|
-
"aria-label":
|
|
33
|
-
...
|
|
34
|
-
className: d("tintora-avatar", `tintora-avatar--${
|
|
35
|
-
children:
|
|
36
|
-
src:
|
|
101
|
+
"aria-label": t,
|
|
102
|
+
...a,
|
|
103
|
+
className: d("tintora-avatar", `tintora-avatar--${r}`, i),
|
|
104
|
+
children: c ? /* @__PURE__ */ e("img", {
|
|
105
|
+
src: n,
|
|
37
106
|
alt: "",
|
|
38
|
-
onError: () =>
|
|
39
|
-
}) :
|
|
107
|
+
onError: () => s(n)
|
|
108
|
+
}) : h(t)
|
|
40
109
|
});
|
|
41
110
|
}
|
|
42
111
|
//#endregion
|
|
43
112
|
//#region src/Spinner/Spinner.tsx
|
|
44
|
-
var
|
|
113
|
+
var _ = {
|
|
45
114
|
small: {
|
|
46
115
|
width: 16,
|
|
47
116
|
height: 16,
|
|
@@ -58,87 +127,87 @@ var m = {
|
|
|
58
127
|
strokeWidth: 2.4
|
|
59
128
|
}
|
|
60
129
|
};
|
|
61
|
-
function
|
|
62
|
-
let { width:
|
|
63
|
-
return /* @__PURE__ */
|
|
130
|
+
function v({ size: n = "medium", color: r = "accent" }) {
|
|
131
|
+
let { width: i, height: a, strokeWidth: o } = _[n];
|
|
132
|
+
return /* @__PURE__ */ t("svg", {
|
|
64
133
|
className: "tintora-spinner",
|
|
65
|
-
width:
|
|
66
|
-
height:
|
|
134
|
+
width: i,
|
|
135
|
+
height: a,
|
|
67
136
|
viewBox: "0 0 24 24",
|
|
68
137
|
fill: "none",
|
|
69
138
|
role: "img",
|
|
70
139
|
"aria-label": "Loading",
|
|
71
|
-
children: [/* @__PURE__ */
|
|
140
|
+
children: [/* @__PURE__ */ e("circle", {
|
|
72
141
|
cx: "12",
|
|
73
142
|
cy: "12",
|
|
74
143
|
r: "9",
|
|
75
144
|
stroke: "currentColor",
|
|
76
|
-
strokeOpacity:
|
|
77
|
-
strokeWidth:
|
|
78
|
-
}), /* @__PURE__ */
|
|
145
|
+
strokeOpacity: r === "accent" ? .25 : .35,
|
|
146
|
+
strokeWidth: o
|
|
147
|
+
}), /* @__PURE__ */ e("path", {
|
|
79
148
|
d: "M21 12a9 9 0 0 0-9-9",
|
|
80
|
-
stroke:
|
|
81
|
-
strokeWidth:
|
|
149
|
+
stroke: r === "accent" ? "var(--tintora-control-fill)" : "currentColor",
|
|
150
|
+
strokeWidth: o,
|
|
82
151
|
strokeLinecap: "round"
|
|
83
152
|
})]
|
|
84
153
|
});
|
|
85
154
|
}
|
|
86
155
|
//#endregion
|
|
87
156
|
//#region src/Button/Button.tsx
|
|
88
|
-
function
|
|
89
|
-
return /* @__PURE__ */
|
|
90
|
-
type:
|
|
91
|
-
className: d("tintora-button", `tintora-button--${
|
|
92
|
-
"tintora-button--leading-icon": !!
|
|
93
|
-
"tintora-button--loading":
|
|
94
|
-
"tintora-button--trailing-icon": !!
|
|
95
|
-
},
|
|
96
|
-
disabled: u ||
|
|
97
|
-
"aria-busy":
|
|
157
|
+
function y({ children: n, className: r, variant: i, size: a = "medium", leadingIcon: o, trailingIcon: s, type: c = "button", loading: l = !1, disabled: u, ...f }) {
|
|
158
|
+
return /* @__PURE__ */ t("button", {
|
|
159
|
+
type: c,
|
|
160
|
+
className: d("tintora-button", `tintora-button--${i}`, `tintora-button--${a}`, {
|
|
161
|
+
"tintora-button--leading-icon": !!o || l,
|
|
162
|
+
"tintora-button--loading": l,
|
|
163
|
+
"tintora-button--trailing-icon": !!s
|
|
164
|
+
}, r),
|
|
165
|
+
disabled: u || l,
|
|
166
|
+
"aria-busy": l || void 0,
|
|
98
167
|
...f,
|
|
99
168
|
children: [
|
|
100
|
-
|
|
169
|
+
l && /* @__PURE__ */ e("span", {
|
|
101
170
|
className: "tintora-button__icon",
|
|
102
171
|
"aria-hidden": "true",
|
|
103
|
-
children: /* @__PURE__ */
|
|
172
|
+
children: /* @__PURE__ */ e(v, {
|
|
104
173
|
size: "small",
|
|
105
174
|
color: "current"
|
|
106
175
|
})
|
|
107
176
|
}),
|
|
108
|
-
!
|
|
177
|
+
!l && o && /* @__PURE__ */ e("span", {
|
|
109
178
|
className: "tintora-button__icon",
|
|
110
179
|
"aria-hidden": "true",
|
|
111
|
-
children:
|
|
180
|
+
children: o
|
|
112
181
|
}),
|
|
113
|
-
|
|
114
|
-
|
|
182
|
+
n,
|
|
183
|
+
s && /* @__PURE__ */ e("span", {
|
|
115
184
|
className: "tintora-button__icon",
|
|
116
185
|
"aria-hidden": "true",
|
|
117
|
-
children:
|
|
186
|
+
children: s
|
|
118
187
|
})
|
|
119
188
|
]
|
|
120
189
|
});
|
|
121
190
|
}
|
|
122
191
|
//#endregion
|
|
123
192
|
//#region src/Card/Card.tsx
|
|
124
|
-
function
|
|
125
|
-
return /* @__PURE__ */
|
|
126
|
-
...
|
|
127
|
-
className: d("tintora-card", `tintora-card--${
|
|
193
|
+
function b({ as: t = "article", variant: n = "surface", className: r, ...i }) {
|
|
194
|
+
return /* @__PURE__ */ e(t, {
|
|
195
|
+
...i,
|
|
196
|
+
className: d("tintora-card", `tintora-card--${n}`, r)
|
|
128
197
|
});
|
|
129
198
|
}
|
|
130
|
-
function
|
|
131
|
-
return /* @__PURE__ */
|
|
132
|
-
...
|
|
199
|
+
function x({ selected: t = !1, className: n, ...r }) {
|
|
200
|
+
return /* @__PURE__ */ e("button", {
|
|
201
|
+
...r,
|
|
133
202
|
type: "button",
|
|
134
|
-
"aria-pressed":
|
|
135
|
-
className: d("tintora-card", "tintora-card--surface", "tintora-card--selectable",
|
|
203
|
+
"aria-pressed": t,
|
|
204
|
+
className: d("tintora-card", "tintora-card--surface", "tintora-card--selectable", t && "tintora-card--selected", n)
|
|
136
205
|
});
|
|
137
206
|
}
|
|
138
207
|
//#endregion
|
|
139
208
|
//#region src/hooks/useCheckedState.ts
|
|
140
|
-
function
|
|
141
|
-
let [r, i] =
|
|
209
|
+
function S({ checked: e, defaultChecked: t = !1, onCheckedChange: n }) {
|
|
210
|
+
let [r, i] = l(t), a = e !== void 0;
|
|
142
211
|
return {
|
|
143
212
|
checked: a ? e : r,
|
|
144
213
|
onChange: (e) => {
|
|
@@ -148,27 +217,27 @@ function y({ checked: e, defaultChecked: t = !1, onCheckedChange: n }) {
|
|
|
148
217
|
}
|
|
149
218
|
//#endregion
|
|
150
219
|
//#region src/Checkbox/Checkbox.tsx
|
|
151
|
-
function
|
|
152
|
-
let u =
|
|
153
|
-
checked:
|
|
154
|
-
defaultChecked:
|
|
155
|
-
onCheckedChange:
|
|
220
|
+
function C({ checked: n, defaultChecked: r, onCheckedChange: i, indeterminate: a = !1, className: o, ...l }) {
|
|
221
|
+
let u = c(null), f = S({
|
|
222
|
+
checked: n,
|
|
223
|
+
defaultChecked: r,
|
|
224
|
+
onCheckedChange: i
|
|
156
225
|
});
|
|
157
|
-
return
|
|
158
|
-
u.current && (u.current.indeterminate =
|
|
159
|
-
}), /* @__PURE__ */
|
|
160
|
-
className: d("tintora-checkbox",
|
|
161
|
-
children: [/* @__PURE__ */
|
|
162
|
-
...
|
|
226
|
+
return s(() => {
|
|
227
|
+
u.current && (u.current.indeterminate = a);
|
|
228
|
+
}), /* @__PURE__ */ t("span", {
|
|
229
|
+
className: d("tintora-checkbox", o),
|
|
230
|
+
children: [/* @__PURE__ */ e("input", {
|
|
231
|
+
...l,
|
|
163
232
|
ref: u,
|
|
164
233
|
type: "checkbox",
|
|
165
234
|
className: "tintora-checkbox__input",
|
|
166
235
|
checked: f.checked,
|
|
167
236
|
onChange: f.onChange
|
|
168
|
-
}), /* @__PURE__ */
|
|
237
|
+
}), /* @__PURE__ */ t("span", {
|
|
169
238
|
className: "tintora-checkbox__box",
|
|
170
239
|
"aria-hidden": "true",
|
|
171
|
-
children: [/* @__PURE__ */
|
|
240
|
+
children: [/* @__PURE__ */ e("svg", {
|
|
172
241
|
className: "tintora-checkbox__check",
|
|
173
242
|
width: "14",
|
|
174
243
|
height: "14",
|
|
@@ -177,8 +246,8 @@ function b({ checked: e, defaultChecked: t, onCheckedChange: n, indeterminate: r
|
|
|
177
246
|
strokeWidth: "3.2",
|
|
178
247
|
strokeLinecap: "round",
|
|
179
248
|
strokeLinejoin: "round",
|
|
180
|
-
children: /* @__PURE__ */
|
|
181
|
-
}), /* @__PURE__ */
|
|
249
|
+
children: /* @__PURE__ */ e("path", { d: "M5 12.5l4.5 4.5L19 7.5" })
|
|
250
|
+
}), /* @__PURE__ */ e("svg", {
|
|
182
251
|
className: "tintora-checkbox__dash",
|
|
183
252
|
width: "14",
|
|
184
253
|
height: "14",
|
|
@@ -186,58 +255,58 @@ function b({ checked: e, defaultChecked: t, onCheckedChange: n, indeterminate: r
|
|
|
186
255
|
fill: "none",
|
|
187
256
|
strokeWidth: "3.2",
|
|
188
257
|
strokeLinecap: "round",
|
|
189
|
-
children: /* @__PURE__ */
|
|
258
|
+
children: /* @__PURE__ */ e("path", { d: "M6 12h12" })
|
|
190
259
|
})]
|
|
191
260
|
})]
|
|
192
261
|
});
|
|
193
262
|
}
|
|
194
263
|
//#endregion
|
|
195
264
|
//#region src/Chip/Chip.tsx
|
|
196
|
-
function
|
|
197
|
-
return /* @__PURE__ */
|
|
198
|
-
...
|
|
265
|
+
function w({ children: t, selected: n, className: r, "aria-pressed": i, ...a }) {
|
|
266
|
+
return /* @__PURE__ */ e("button", {
|
|
267
|
+
...a,
|
|
199
268
|
type: "button",
|
|
200
|
-
className: d("tintora-chip",
|
|
201
|
-
"aria-pressed":
|
|
202
|
-
children:
|
|
269
|
+
className: d("tintora-chip", r),
|
|
270
|
+
"aria-pressed": n ?? i,
|
|
271
|
+
children: t
|
|
203
272
|
});
|
|
204
273
|
}
|
|
205
274
|
//#endregion
|
|
206
275
|
//#region src/Dot/Dot.tsx
|
|
207
|
-
function
|
|
208
|
-
return /* @__PURE__ */
|
|
209
|
-
...
|
|
210
|
-
className: d("tintora-dot", `tintora-dot--${
|
|
211
|
-
role:
|
|
212
|
-
"aria-label":
|
|
213
|
-
"aria-hidden": !
|
|
276
|
+
function T({ variant: t = "unread", label: n, className: r, ...i }) {
|
|
277
|
+
return /* @__PURE__ */ e("span", {
|
|
278
|
+
...i,
|
|
279
|
+
className: d("tintora-dot", `tintora-dot--${t}`, r),
|
|
280
|
+
role: n ? "img" : void 0,
|
|
281
|
+
"aria-label": n,
|
|
282
|
+
"aria-hidden": !n || void 0
|
|
214
283
|
});
|
|
215
284
|
}
|
|
216
285
|
//#endregion
|
|
217
286
|
//#region src/IconButton/IconButton.tsx
|
|
218
|
-
var
|
|
287
|
+
var E = {
|
|
219
288
|
round: "secondary",
|
|
220
289
|
field: "secondary",
|
|
221
290
|
nav: "ghost"
|
|
222
291
|
};
|
|
223
|
-
function
|
|
224
|
-
let
|
|
225
|
-
return /* @__PURE__ */
|
|
226
|
-
...
|
|
227
|
-
variant:
|
|
228
|
-
"aria-current":
|
|
229
|
-
className: d("tintora-icon-button", `tintora-icon-button--${
|
|
230
|
-
...
|
|
231
|
-
children: /* @__PURE__ */
|
|
292
|
+
function D({ icon: t, variant: n = "round", size: r, selected: i, className: a, ...o }) {
|
|
293
|
+
let s = n === "round" ? r ?? "large" : void 0;
|
|
294
|
+
return /* @__PURE__ */ e(y, {
|
|
295
|
+
...o,
|
|
296
|
+
variant: E[n],
|
|
297
|
+
"aria-current": i ? "page" : void 0,
|
|
298
|
+
className: d("tintora-icon-button", `tintora-icon-button--${n}`, s && `tintora-icon-button--${s}`, a),
|
|
299
|
+
...s && { size: s },
|
|
300
|
+
children: /* @__PURE__ */ e("span", {
|
|
232
301
|
className: "tintora-icon-button__icon",
|
|
233
302
|
"aria-hidden": "true",
|
|
234
|
-
children:
|
|
303
|
+
children: t
|
|
235
304
|
})
|
|
236
305
|
});
|
|
237
306
|
}
|
|
238
307
|
//#endregion
|
|
239
308
|
//#region src/Modal/Modal.tsx
|
|
240
|
-
var
|
|
309
|
+
var O = () => /* @__PURE__ */ e("svg", {
|
|
241
310
|
width: "16",
|
|
242
311
|
height: "16",
|
|
243
312
|
viewBox: "0 0 24 24",
|
|
@@ -245,53 +314,53 @@ var T = () => /* @__PURE__ */ c("svg", {
|
|
|
245
314
|
stroke: "currentColor",
|
|
246
315
|
strokeWidth: "2",
|
|
247
316
|
strokeLinecap: "round",
|
|
248
|
-
children: /* @__PURE__ */
|
|
317
|
+
children: /* @__PURE__ */ e("path", { d: "M18 6L6 18M6 6l12 12" })
|
|
249
318
|
});
|
|
250
|
-
function
|
|
251
|
-
let b =
|
|
252
|
-
return
|
|
253
|
-
let
|
|
254
|
-
|
|
255
|
-
}, [
|
|
319
|
+
function k({ open: n, onClose: r, title: i, description: s, icon: l, status: u = "info", actions: f, size: p = "md", align: m = "start", role: h = "dialog", closeButton: g = !0, className: _, children: v, ...y }) {
|
|
320
|
+
let b = c(null), x = o(), S = o();
|
|
321
|
+
return a(() => {
|
|
322
|
+
let e = b.current;
|
|
323
|
+
e && (n && !e.open ? (e.showModal(), e.querySelector("[data-autofocus]")?.focus()) : !n && e.open && e.close());
|
|
324
|
+
}, [n]), /* @__PURE__ */ t("dialog", {
|
|
256
325
|
...y,
|
|
257
326
|
ref: b,
|
|
258
327
|
role: h,
|
|
259
328
|
"aria-labelledby": x,
|
|
260
|
-
"aria-describedby":
|
|
329
|
+
"aria-describedby": s ? S : void 0,
|
|
261
330
|
className: d("tintora-modal", `tintora-modal--${p}`, m === "center" && "tintora-modal--center", _),
|
|
262
331
|
onCancel: (e) => {
|
|
263
|
-
e.preventDefault(),
|
|
332
|
+
e.preventDefault(), r();
|
|
264
333
|
},
|
|
265
334
|
onClick: (e) => {
|
|
266
|
-
h === "dialog" && e.target === e.currentTarget &&
|
|
335
|
+
h === "dialog" && e.target === e.currentTarget && r();
|
|
267
336
|
},
|
|
268
337
|
children: [
|
|
269
|
-
|
|
338
|
+
l && /* @__PURE__ */ e("span", {
|
|
270
339
|
className: d("tintora-modal__icon", `tintora-modal__icon--${u}`),
|
|
271
340
|
"aria-hidden": "true",
|
|
272
|
-
children:
|
|
341
|
+
children: l
|
|
273
342
|
}),
|
|
274
|
-
/* @__PURE__ */
|
|
343
|
+
/* @__PURE__ */ t("div", {
|
|
275
344
|
className: "tintora-modal__text",
|
|
276
|
-
children: [/* @__PURE__ */
|
|
345
|
+
children: [/* @__PURE__ */ e("h2", {
|
|
277
346
|
id: x,
|
|
278
347
|
className: "tintora-modal__title",
|
|
279
|
-
children:
|
|
280
|
-
}),
|
|
348
|
+
children: i
|
|
349
|
+
}), s && /* @__PURE__ */ e("p", {
|
|
281
350
|
id: S,
|
|
282
351
|
className: "tintora-modal__description",
|
|
283
|
-
children:
|
|
352
|
+
children: s
|
|
284
353
|
})]
|
|
285
354
|
}),
|
|
286
|
-
g && /* @__PURE__ */
|
|
355
|
+
g && /* @__PURE__ */ e(D, {
|
|
287
356
|
className: "tintora-modal__close",
|
|
288
357
|
size: "medium",
|
|
289
358
|
"aria-label": "Close",
|
|
290
|
-
icon: /* @__PURE__ */
|
|
291
|
-
onClick:
|
|
359
|
+
icon: /* @__PURE__ */ e(O, {}),
|
|
360
|
+
onClick: r
|
|
292
361
|
}),
|
|
293
362
|
v,
|
|
294
|
-
f && /* @__PURE__ */
|
|
363
|
+
f && /* @__PURE__ */ e("div", {
|
|
295
364
|
className: "tintora-modal__actions",
|
|
296
365
|
children: f
|
|
297
366
|
})
|
|
@@ -299,32 +368,203 @@ function E({ open: e, onClose: t, title: n, description: a, icon: s, status: u =
|
|
|
299
368
|
});
|
|
300
369
|
}
|
|
301
370
|
//#endregion
|
|
371
|
+
//#region src/hooks/useLatest.ts
|
|
372
|
+
function A(e) {
|
|
373
|
+
let t = c(e);
|
|
374
|
+
return a(() => {
|
|
375
|
+
t.current = e;
|
|
376
|
+
}, [e]), t;
|
|
377
|
+
}
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/hooks/useEscapeKey.ts
|
|
380
|
+
function j(e, t) {
|
|
381
|
+
let n = A(t);
|
|
382
|
+
a(() => {
|
|
383
|
+
if (!e) return;
|
|
384
|
+
let t = (e) => {
|
|
385
|
+
e.key === "Escape" && n.current();
|
|
386
|
+
};
|
|
387
|
+
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
388
|
+
}, [e, n]);
|
|
389
|
+
}
|
|
390
|
+
//#endregion
|
|
391
|
+
//#region src/hooks/useOutsidePress.ts
|
|
392
|
+
function M(e, t, n) {
|
|
393
|
+
let r = A(n);
|
|
394
|
+
a(() => {
|
|
395
|
+
if (!e) return;
|
|
396
|
+
let n = (e) => {
|
|
397
|
+
t.current?.contains(e.target) || r.current();
|
|
398
|
+
};
|
|
399
|
+
return document.addEventListener("pointerdown", n), () => document.removeEventListener("pointerdown", n);
|
|
400
|
+
}, [
|
|
401
|
+
e,
|
|
402
|
+
t,
|
|
403
|
+
r
|
|
404
|
+
]);
|
|
405
|
+
}
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/hooks/useTopLayerPosition.ts
|
|
408
|
+
function N(e, t, n, r) {
|
|
409
|
+
let [i, a] = l(null);
|
|
410
|
+
return s(() => {
|
|
411
|
+
let r = t.current;
|
|
412
|
+
if (!e || !r) {
|
|
413
|
+
a(null);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
r.showPopover();
|
|
417
|
+
let i = () => a(n()), o = (e) => {
|
|
418
|
+
r.contains(e.target) || i();
|
|
419
|
+
};
|
|
420
|
+
return i(), window.addEventListener("scroll", o, !0), window.addEventListener("resize", i), () => {
|
|
421
|
+
window.removeEventListener("scroll", o, !0), window.removeEventListener("resize", i);
|
|
422
|
+
};
|
|
423
|
+
}, [
|
|
424
|
+
e,
|
|
425
|
+
t,
|
|
426
|
+
...r
|
|
427
|
+
]), i;
|
|
428
|
+
}
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/utils/placement.ts
|
|
431
|
+
var P = {
|
|
432
|
+
gap: 10,
|
|
433
|
+
margin: 8,
|
|
434
|
+
arrowInset: 12
|
|
435
|
+
}, F = {
|
|
436
|
+
top: "bottom",
|
|
437
|
+
bottom: "top",
|
|
438
|
+
left: "right",
|
|
439
|
+
right: "left"
|
|
440
|
+
}, I = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n));
|
|
441
|
+
function L(e, t, n, r, { gap: i, margin: a }) {
|
|
442
|
+
let o = (t) => {
|
|
443
|
+
switch (t) {
|
|
444
|
+
case "top": return e.top;
|
|
445
|
+
case "bottom": return r.height - e.bottom;
|
|
446
|
+
case "left": return e.left;
|
|
447
|
+
case "right": return r.width - e.right;
|
|
448
|
+
}
|
|
449
|
+
}, s = (n === "top" || n === "bottom" ? t.height : t.width) + i + a, c = o(n);
|
|
450
|
+
return c >= s || o(F[n]) <= c ? n : F[n];
|
|
451
|
+
}
|
|
452
|
+
function R(e, t, n, r = {
|
|
453
|
+
width: window.innerWidth,
|
|
454
|
+
height: window.innerHeight
|
|
455
|
+
}, i = {}) {
|
|
456
|
+
let a = {
|
|
457
|
+
...P,
|
|
458
|
+
...i
|
|
459
|
+
}, { gap: o, margin: s, arrowInset: c } = a, l = L(e, t, n, r, a), u = l === "top" || l === "bottom", d, f;
|
|
460
|
+
switch (l) {
|
|
461
|
+
case "top":
|
|
462
|
+
d = e.y - t.height - o, f = e.x + e.width / 2 - t.width / 2;
|
|
463
|
+
break;
|
|
464
|
+
case "bottom":
|
|
465
|
+
d = e.y + e.height + o, f = e.x + e.width / 2 - t.width / 2;
|
|
466
|
+
break;
|
|
467
|
+
case "left":
|
|
468
|
+
d = e.y + e.height / 2 - t.height / 2, f = e.x - t.width - o;
|
|
469
|
+
break;
|
|
470
|
+
case "right": d = e.y + e.height / 2 - t.height / 2, f = e.x + e.width + o;
|
|
471
|
+
}
|
|
472
|
+
u ? f = I(f, s, r.width - t.width - s) : d = I(d, s, r.height - t.height - s);
|
|
473
|
+
let p = u ? e.x + e.width / 2 - f : e.y + e.height / 2 - d, m = u ? t.width : t.height;
|
|
474
|
+
return {
|
|
475
|
+
top: d,
|
|
476
|
+
left: f,
|
|
477
|
+
placement: l,
|
|
478
|
+
arrowOffset: I(p, c, m - c)
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
//#endregion
|
|
482
|
+
//#region src/Popover/Popover.tsx
|
|
483
|
+
var z = [
|
|
484
|
+
"button:not([disabled])",
|
|
485
|
+
"[href]",
|
|
486
|
+
"input:not([disabled])",
|
|
487
|
+
"select:not([disabled])",
|
|
488
|
+
"textarea:not([disabled])",
|
|
489
|
+
"[tabindex]:not([tabindex=\"-1\"])"
|
|
490
|
+
].join(", ");
|
|
491
|
+
function B({ open: r, onOpenChange: i, trigger: l, title: u, children: f, role: p = "dialog", size: m = "md", placement: h = "bottom", className: g }) {
|
|
492
|
+
let _ = o(), v = c(null), y = c(null), b = c(!1), x = () => i(!1);
|
|
493
|
+
j(r, x), M(r, v, x);
|
|
494
|
+
let S = (e) => {
|
|
495
|
+
l.props.onClick?.(e), e.defaultPrevented || i(!r);
|
|
496
|
+
}, C = N(r, y, () => {
|
|
497
|
+
let e = y.current, t = v.current?.firstElementChild;
|
|
498
|
+
return !e || !t ? null : R(t.getBoundingClientRect(), {
|
|
499
|
+
width: e.offsetWidth,
|
|
500
|
+
height: e.offsetHeight
|
|
501
|
+
}, h, void 0, { gap: 12 });
|
|
502
|
+
}, [
|
|
503
|
+
h,
|
|
504
|
+
u,
|
|
505
|
+
f
|
|
506
|
+
]), w = C ? {
|
|
507
|
+
top: C.top,
|
|
508
|
+
left: C.left,
|
|
509
|
+
"--tintora-popover-arrow-offset": `${C.arrowOffset}px`
|
|
510
|
+
} : { visibility: "hidden" }, T = C !== null;
|
|
511
|
+
return s(() => {
|
|
512
|
+
let e = y.current;
|
|
513
|
+
r && T && e && (e.querySelector("[data-autofocus]") ?? e.querySelector(z) ?? e).focus();
|
|
514
|
+
}, [r, T]), a(() => {
|
|
515
|
+
if (b.current && !r) {
|
|
516
|
+
let e = document.activeElement;
|
|
517
|
+
(!e || e === document.body) && v.current?.querySelector("*")?.focus();
|
|
518
|
+
}
|
|
519
|
+
b.current = r;
|
|
520
|
+
}, [r]), /* @__PURE__ */ t("span", {
|
|
521
|
+
ref: v,
|
|
522
|
+
className: "tintora-popover-root",
|
|
523
|
+
children: [n(l, {
|
|
524
|
+
"aria-haspopup": "dialog",
|
|
525
|
+
"aria-expanded": r,
|
|
526
|
+
"aria-controls": r ? _ : void 0,
|
|
527
|
+
onClick: S
|
|
528
|
+
}), r && /* @__PURE__ */ e("div", {
|
|
529
|
+
id: _,
|
|
530
|
+
ref: y,
|
|
531
|
+
role: p,
|
|
532
|
+
"aria-label": u,
|
|
533
|
+
popover: "manual",
|
|
534
|
+
tabIndex: -1,
|
|
535
|
+
className: d("tintora-popover", `tintora-popover--${m}`, `tintora-popover--${C?.placement ?? h}`, g),
|
|
536
|
+
style: w,
|
|
537
|
+
children: f
|
|
538
|
+
})]
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
//#endregion
|
|
302
542
|
//#region src/ProgressBar/ProgressBar.tsx
|
|
303
|
-
function
|
|
304
|
-
let
|
|
305
|
-
return /* @__PURE__ */
|
|
306
|
-
className: d("tintora-progress-bar",
|
|
307
|
-
children: [
|
|
543
|
+
function V({ title: n, progress: r, indeterminate: i, valueLabel: a, className: s, "aria-label": c }) {
|
|
544
|
+
let l = o(), u = i ? void 0 : Math.min(100, Math.max(0, Number.isFinite(r) ? r : 0)), f = u === 100, p = a ?? (i ? "Indeterminate" : `${u}%`);
|
|
545
|
+
return /* @__PURE__ */ t("div", {
|
|
546
|
+
className: d("tintora-progress-bar", s),
|
|
547
|
+
children: [n && /* @__PURE__ */ t("div", {
|
|
308
548
|
className: "tintora-progress-bar__header",
|
|
309
|
-
children: [/* @__PURE__ */
|
|
310
|
-
id:
|
|
311
|
-
children:
|
|
312
|
-
}), /* @__PURE__ */
|
|
549
|
+
children: [/* @__PURE__ */ e("span", {
|
|
550
|
+
id: l,
|
|
551
|
+
children: n
|
|
552
|
+
}), /* @__PURE__ */ e("span", {
|
|
313
553
|
className: "tintora-progress-bar__value",
|
|
314
554
|
children: p
|
|
315
555
|
})]
|
|
316
|
-
}), /* @__PURE__ */
|
|
556
|
+
}), /* @__PURE__ */ e("div", {
|
|
317
557
|
role: "progressbar",
|
|
318
|
-
"aria-label":
|
|
319
|
-
"aria-labelledby":
|
|
320
|
-
"aria-valuemin":
|
|
321
|
-
"aria-valuemax":
|
|
558
|
+
"aria-label": c,
|
|
559
|
+
"aria-labelledby": n ? l : void 0,
|
|
560
|
+
"aria-valuemin": i ? void 0 : 0,
|
|
561
|
+
"aria-valuemax": i ? void 0 : 100,
|
|
322
562
|
"aria-valuenow": u,
|
|
323
|
-
"aria-valuetext":
|
|
563
|
+
"aria-valuetext": a,
|
|
324
564
|
className: "tintora-progress-bar__track",
|
|
325
|
-
children: /* @__PURE__ */
|
|
565
|
+
children: /* @__PURE__ */ e("div", {
|
|
326
566
|
className: d("tintora-progress-bar__fill", {
|
|
327
|
-
"tintora-progress-bar__fill--indeterminate":
|
|
567
|
+
"tintora-progress-bar__fill--indeterminate": i,
|
|
328
568
|
"tintora-progress-bar__fill--complete": f
|
|
329
569
|
}),
|
|
330
570
|
style: u === void 0 ? void 0 : { width: `${u}%` }
|
|
@@ -334,28 +574,28 @@ function D({ title: e, progress: t, indeterminate: n, valueLabel: r, className:
|
|
|
334
574
|
}
|
|
335
575
|
//#endregion
|
|
336
576
|
//#region src/Radio/RadioContext.ts
|
|
337
|
-
var
|
|
338
|
-
function
|
|
339
|
-
let e =
|
|
577
|
+
var H = r(null);
|
|
578
|
+
function U() {
|
|
579
|
+
let e = i(H);
|
|
340
580
|
if (!e) throw Error("Radio must be rendered inside a RadioGroup");
|
|
341
581
|
return e;
|
|
342
582
|
}
|
|
343
583
|
//#endregion
|
|
344
584
|
//#region src/Radio/Radio.tsx
|
|
345
|
-
function
|
|
346
|
-
let
|
|
347
|
-
return /* @__PURE__ */
|
|
348
|
-
className: d("tintora-radio",
|
|
349
|
-
children: [/* @__PURE__ */
|
|
350
|
-
...
|
|
585
|
+
function W({ value: n, className: r, disabled: i, ...a }) {
|
|
586
|
+
let o = U();
|
|
587
|
+
return /* @__PURE__ */ t("span", {
|
|
588
|
+
className: d("tintora-radio", r),
|
|
589
|
+
children: [/* @__PURE__ */ e("input", {
|
|
590
|
+
...a,
|
|
351
591
|
type: "radio",
|
|
352
592
|
className: "tintora-radio__input",
|
|
353
|
-
name:
|
|
354
|
-
value:
|
|
355
|
-
checked:
|
|
356
|
-
disabled:
|
|
357
|
-
onChange: () =>
|
|
358
|
-
}), /* @__PURE__ */
|
|
593
|
+
name: o.name,
|
|
594
|
+
value: n,
|
|
595
|
+
checked: o.value === n,
|
|
596
|
+
disabled: i || o.disabled,
|
|
597
|
+
onChange: () => o.select(n)
|
|
598
|
+
}), /* @__PURE__ */ e("span", {
|
|
359
599
|
className: "tintora-radio__circle",
|
|
360
600
|
"aria-hidden": "true"
|
|
361
601
|
})]
|
|
@@ -363,30 +603,30 @@ function A({ value: e, className: t, disabled: n, ...r }) {
|
|
|
363
603
|
}
|
|
364
604
|
//#endregion
|
|
365
605
|
//#region src/Radio/RadioGroup.tsx
|
|
366
|
-
function
|
|
367
|
-
let u =
|
|
368
|
-
return /* @__PURE__ */
|
|
606
|
+
function G({ value: t, defaultValue: n, onValueChange: r, disabled: i = !1, name: a, className: s, ...c }) {
|
|
607
|
+
let u = o(), [f, p] = l(n ?? null), m = t !== void 0, h = m ? t : f;
|
|
608
|
+
return /* @__PURE__ */ e(H.Provider, {
|
|
369
609
|
value: {
|
|
370
610
|
name: a ?? u,
|
|
371
611
|
value: h,
|
|
372
612
|
select: (e) => {
|
|
373
|
-
e !== h && (m || p(e),
|
|
613
|
+
e !== h && (m || p(e), r?.(e));
|
|
374
614
|
},
|
|
375
|
-
disabled:
|
|
615
|
+
disabled: i
|
|
376
616
|
},
|
|
377
|
-
children: /* @__PURE__ */
|
|
378
|
-
...
|
|
617
|
+
children: /* @__PURE__ */ e("div", {
|
|
618
|
+
...c,
|
|
379
619
|
role: "radiogroup",
|
|
380
|
-
className: d("tintora-radio-group",
|
|
620
|
+
className: d("tintora-radio-group", s)
|
|
381
621
|
})
|
|
382
622
|
});
|
|
383
623
|
}
|
|
384
624
|
//#endregion
|
|
385
625
|
//#region src/SearchInput/SearchInput.tsx
|
|
386
|
-
function
|
|
387
|
-
return /* @__PURE__ */
|
|
388
|
-
className: d("tintora-search-input",
|
|
389
|
-
children: [/* @__PURE__ */
|
|
626
|
+
function K({ className: n, disabled: r, ...i }) {
|
|
627
|
+
return /* @__PURE__ */ t("label", {
|
|
628
|
+
className: d("tintora-search-input", r && "tintora-search-input--disabled", n),
|
|
629
|
+
children: [/* @__PURE__ */ t("svg", {
|
|
390
630
|
className: "tintora-search-input__icon",
|
|
391
631
|
viewBox: "0 0 24 24",
|
|
392
632
|
fill: "none",
|
|
@@ -394,154 +634,107 @@ function M({ className: e, disabled: t, ...n }) {
|
|
|
394
634
|
strokeWidth: "2",
|
|
395
635
|
strokeLinecap: "round",
|
|
396
636
|
"aria-hidden": "true",
|
|
397
|
-
children: [/* @__PURE__ */
|
|
637
|
+
children: [/* @__PURE__ */ e("circle", {
|
|
398
638
|
cx: "11",
|
|
399
639
|
cy: "11",
|
|
400
640
|
r: "7"
|
|
401
|
-
}), /* @__PURE__ */
|
|
402
|
-
}), /* @__PURE__ */
|
|
403
|
-
...
|
|
641
|
+
}), /* @__PURE__ */ e("path", { d: "M20 20l-3.5-3.5" })]
|
|
642
|
+
}), /* @__PURE__ */ e("input", {
|
|
643
|
+
...i,
|
|
404
644
|
type: "search",
|
|
405
|
-
disabled:
|
|
645
|
+
disabled: r,
|
|
406
646
|
className: "tintora-search-input__input"
|
|
407
647
|
})]
|
|
408
648
|
});
|
|
409
649
|
}
|
|
410
650
|
//#endregion
|
|
411
|
-
//#region src/hooks/useLatest.ts
|
|
412
|
-
function N(e) {
|
|
413
|
-
let t = o(e);
|
|
414
|
-
return r(() => {
|
|
415
|
-
t.current = e;
|
|
416
|
-
}, [e]), t;
|
|
417
|
-
}
|
|
418
|
-
//#endregion
|
|
419
|
-
//#region src/hooks/useOutsidePress.ts
|
|
420
|
-
function P(e, t, n) {
|
|
421
|
-
let i = N(n);
|
|
422
|
-
r(() => {
|
|
423
|
-
if (!e) return;
|
|
424
|
-
let n = (e) => {
|
|
425
|
-
t.current?.contains(e.target) || i.current();
|
|
426
|
-
};
|
|
427
|
-
return document.addEventListener("pointerdown", n), () => document.removeEventListener("pointerdown", n);
|
|
428
|
-
}, [
|
|
429
|
-
e,
|
|
430
|
-
t,
|
|
431
|
-
i
|
|
432
|
-
]);
|
|
433
|
-
}
|
|
434
|
-
//#endregion
|
|
435
|
-
//#region src/hooks/useTopLayerPosition.ts
|
|
436
|
-
function F(e, t, n, r) {
|
|
437
|
-
let [i, o] = s(null);
|
|
438
|
-
return a(() => {
|
|
439
|
-
let r = t.current;
|
|
440
|
-
if (!e || !r) {
|
|
441
|
-
o(null);
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
r.showPopover();
|
|
445
|
-
let i = () => o(n()), a = (e) => {
|
|
446
|
-
r.contains(e.target) || i();
|
|
447
|
-
};
|
|
448
|
-
return i(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", i), () => {
|
|
449
|
-
window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", i);
|
|
450
|
-
};
|
|
451
|
-
}, [
|
|
452
|
-
e,
|
|
453
|
-
t,
|
|
454
|
-
...r
|
|
455
|
-
]), i;
|
|
456
|
-
}
|
|
457
|
-
//#endregion
|
|
458
651
|
//#region src/Select/SelectContext.ts
|
|
459
|
-
var
|
|
460
|
-
let e =
|
|
652
|
+
var q = r(null), J = () => {
|
|
653
|
+
let e = i(q);
|
|
461
654
|
if (!e) throw Error("SelectOption must be rendered inside a Select");
|
|
462
655
|
return e;
|
|
463
656
|
};
|
|
464
657
|
//#endregion
|
|
465
658
|
//#region src/Select/SelectOption.tsx
|
|
466
|
-
function ee({ label:
|
|
467
|
-
let { select:
|
|
468
|
-
return /* @__PURE__ */
|
|
469
|
-
id:
|
|
659
|
+
function ee({ label: t, value: n, disabled: r }) {
|
|
660
|
+
let { select: i, activate: a, optionId: o, value: s, activeValue: c } = J();
|
|
661
|
+
return /* @__PURE__ */ e("div", {
|
|
662
|
+
id: o(n),
|
|
470
663
|
role: "option",
|
|
471
|
-
"aria-selected":
|
|
472
|
-
"aria-disabled":
|
|
473
|
-
className: d("tintora-select__option",
|
|
474
|
-
onClick: () =>
|
|
475
|
-
onMouseMove: () => !
|
|
476
|
-
children:
|
|
664
|
+
"aria-selected": s === n,
|
|
665
|
+
"aria-disabled": r || void 0,
|
|
666
|
+
className: d("tintora-select__option", c === n && "tintora-select__option--active"),
|
|
667
|
+
onClick: () => i(n),
|
|
668
|
+
onMouseMove: () => !r && a(n),
|
|
669
|
+
children: t
|
|
477
670
|
});
|
|
478
671
|
}
|
|
479
672
|
//#endregion
|
|
480
673
|
//#region src/Select/Select.tsx
|
|
481
|
-
var
|
|
482
|
-
function
|
|
483
|
-
let b =
|
|
484
|
-
for (let
|
|
674
|
+
var Y = 4;
|
|
675
|
+
function X({ defaultValue: n, options: r, disabled: i, value: s, placeholder: u, onValueChange: f, name: p, className: m, onClick: h, onKeyDown: g, onKeyUp: _, "aria-label": v, ...y }) {
|
|
676
|
+
let b = o(), x = c(null), S = c(null), C = c(null), [w, T] = l(n ?? null), [E, D] = l(!1), [O, k] = l(-1), A = s !== void 0, j = A ? s : w, P = r.findIndex((e) => e.value === j), F = (e) => r[e]?.disabled !== !0, I = () => r.findIndex((e, t) => F(t)), L = (e, t) => {
|
|
677
|
+
for (let n = e + t; n >= 0 && n < r.length; n += t) if (F(n)) return n;
|
|
485
678
|
return e;
|
|
486
|
-
},
|
|
487
|
-
let e =
|
|
488
|
-
return e ===
|
|
489
|
-
},
|
|
490
|
-
k(
|
|
491
|
-
},
|
|
492
|
-
let t =
|
|
493
|
-
t < 0 || !
|
|
494
|
-
},
|
|
679
|
+
}, R = () => {
|
|
680
|
+
let e = L(r.length, -1);
|
|
681
|
+
return e === r.length ? -1 : e;
|
|
682
|
+
}, z = (e) => r.findIndex((t) => t.value === e), B = () => {
|
|
683
|
+
k(P >= 0 && F(P) ? P : I()), D(!0);
|
|
684
|
+
}, V = () => D(!1), H = (e) => {
|
|
685
|
+
let t = z(e);
|
|
686
|
+
t < 0 || !F(t) || (V(), e !== j && (A || T(e), f?.(e)));
|
|
687
|
+
}, U = (e) => {
|
|
495
688
|
if (g?.(e), e.defaultPrevented) return;
|
|
496
|
-
let { key:
|
|
497
|
-
if (
|
|
689
|
+
let { key: t } = e;
|
|
690
|
+
if (t === "Tab") return V();
|
|
498
691
|
if (!E) {
|
|
499
692
|
[
|
|
500
693
|
"Enter",
|
|
501
694
|
" ",
|
|
502
695
|
"ArrowDown",
|
|
503
696
|
"ArrowUp"
|
|
504
|
-
].includes(
|
|
697
|
+
].includes(t) && (e.preventDefault(), B());
|
|
505
698
|
return;
|
|
506
699
|
}
|
|
507
|
-
let
|
|
508
|
-
ArrowDown: () => O < 0 ?
|
|
509
|
-
ArrowUp: () => O < 0 ?
|
|
510
|
-
Home:
|
|
511
|
-
End:
|
|
700
|
+
let n = {
|
|
701
|
+
ArrowDown: () => O < 0 ? I() : L(O, 1),
|
|
702
|
+
ArrowUp: () => O < 0 ? I() : L(O, -1),
|
|
703
|
+
Home: I,
|
|
704
|
+
End: R
|
|
512
705
|
};
|
|
513
|
-
|
|
514
|
-
},
|
|
706
|
+
t in n ? (e.preventDefault(), k(n[t]())) : t === "Enter" || t === " " ? (e.preventDefault(), O >= 0 ? H(r[O].value) : V()) : t === "Escape" && (e.preventDefault(), V());
|
|
707
|
+
}, W = (e) => {
|
|
515
708
|
_?.(e), e.key === " " && e.preventDefault();
|
|
516
|
-
},
|
|
709
|
+
}, G = N(E, C, () => {
|
|
517
710
|
let e = C.current, t = S.current;
|
|
518
711
|
if (!e || !t) return null;
|
|
519
|
-
let n = t.getBoundingClientRect(), r = e.offsetHeight, i = n.bottom +
|
|
712
|
+
let n = t.getBoundingClientRect(), r = e.offsetHeight, i = n.bottom + Y + r <= window.innerHeight, a = n.top - Y - r >= 0;
|
|
520
713
|
return {
|
|
521
|
-
top: i || !a ? n.bottom +
|
|
714
|
+
top: i || !a ? n.bottom + Y : n.top - Y - r,
|
|
522
715
|
left: n.left,
|
|
523
716
|
minWidth: n.width
|
|
524
717
|
};
|
|
525
|
-
}, []),
|
|
526
|
-
h?.(e), !e.defaultPrevented && (E ?
|
|
718
|
+
}, []), K = (e) => {
|
|
719
|
+
h?.(e), !e.defaultPrevented && (E ? V() : B());
|
|
527
720
|
};
|
|
528
|
-
|
|
721
|
+
M(E, x, V), a(() => {
|
|
529
722
|
E && O >= 0 && C.current?.children.item(O)?.scrollIntoView?.({ block: "nearest" });
|
|
530
723
|
}, [E, O]);
|
|
531
|
-
let
|
|
532
|
-
return /* @__PURE__ */
|
|
724
|
+
let J = (e) => `${b}-option-${z(e)}`, X = E ? r[O]?.value ?? null : null, Z = r[P]?.label;
|
|
725
|
+
return /* @__PURE__ */ e(q.Provider, {
|
|
533
726
|
value: {
|
|
534
727
|
value: j,
|
|
535
728
|
activeValue: X,
|
|
536
|
-
select:
|
|
537
|
-
optionId:
|
|
538
|
-
activate: (e) => k(
|
|
729
|
+
select: H,
|
|
730
|
+
optionId: J,
|
|
731
|
+
activate: (e) => k(z(e))
|
|
539
732
|
},
|
|
540
|
-
children: /* @__PURE__ */
|
|
733
|
+
children: /* @__PURE__ */ t("div", {
|
|
541
734
|
ref: x,
|
|
542
735
|
className: "tintora-select",
|
|
543
736
|
children: [
|
|
544
|
-
/* @__PURE__ */
|
|
737
|
+
/* @__PURE__ */ t("button", {
|
|
545
738
|
...y,
|
|
546
739
|
ref: S,
|
|
547
740
|
type: "button",
|
|
@@ -550,16 +743,16 @@ function z({ defaultValue: e, options: t, disabled: n, value: a, placeholder: u,
|
|
|
550
743
|
"aria-haspopup": "listbox",
|
|
551
744
|
"aria-expanded": E,
|
|
552
745
|
"aria-controls": E ? b : void 0,
|
|
553
|
-
"aria-activedescendant": X === null ? void 0 :
|
|
554
|
-
disabled:
|
|
746
|
+
"aria-activedescendant": X === null ? void 0 : J(X),
|
|
747
|
+
disabled: i,
|
|
555
748
|
className: d("tintora-select__trigger", m),
|
|
556
|
-
onClick:
|
|
557
|
-
onKeyDown:
|
|
558
|
-
onKeyUp:
|
|
559
|
-
children: [/* @__PURE__ */
|
|
749
|
+
onClick: K,
|
|
750
|
+
onKeyDown: U,
|
|
751
|
+
onKeyUp: W,
|
|
752
|
+
children: [/* @__PURE__ */ e("span", {
|
|
560
753
|
className: d("tintora-select__value", Z === void 0 && "tintora-select__value--placeholder"),
|
|
561
754
|
children: Z ?? u
|
|
562
|
-
}), /* @__PURE__ */
|
|
755
|
+
}), /* @__PURE__ */ e("svg", {
|
|
563
756
|
className: "tintora-select__chevron",
|
|
564
757
|
width: "10",
|
|
565
758
|
height: "10",
|
|
@@ -570,25 +763,25 @@ function z({ defaultValue: e, options: t, disabled: n, value: a, placeholder: u,
|
|
|
570
763
|
strokeLinecap: "round",
|
|
571
764
|
strokeLinejoin: "round",
|
|
572
765
|
"aria-hidden": "true",
|
|
573
|
-
children: /* @__PURE__ */
|
|
766
|
+
children: /* @__PURE__ */ e("path", { d: "M6 9l6 6 6-6" })
|
|
574
767
|
})]
|
|
575
768
|
}),
|
|
576
|
-
E && /* @__PURE__ */
|
|
769
|
+
E && /* @__PURE__ */ e("div", {
|
|
577
770
|
ref: C,
|
|
578
771
|
id: b,
|
|
579
772
|
role: "listbox",
|
|
580
773
|
"aria-label": v,
|
|
581
774
|
popover: "manual",
|
|
582
775
|
className: "tintora-select__menu",
|
|
583
|
-
style:
|
|
776
|
+
style: G ?? {},
|
|
584
777
|
onMouseDown: (e) => e.preventDefault(),
|
|
585
|
-
children:
|
|
778
|
+
children: r.map((t) => /* @__PURE__ */ e(ee, { ...t }, t.value))
|
|
586
779
|
}),
|
|
587
|
-
p && /* @__PURE__ */
|
|
780
|
+
p && /* @__PURE__ */ e("input", {
|
|
588
781
|
type: "hidden",
|
|
589
782
|
name: p,
|
|
590
783
|
value: j ?? "",
|
|
591
|
-
disabled:
|
|
784
|
+
disabled: i
|
|
592
785
|
})
|
|
593
786
|
]
|
|
594
787
|
})
|
|
@@ -596,39 +789,39 @@ function z({ defaultValue: e, options: t, disabled: n, value: a, placeholder: u,
|
|
|
596
789
|
}
|
|
597
790
|
//#endregion
|
|
598
791
|
//#region src/Skeleton/Skeleton.tsx
|
|
599
|
-
function
|
|
600
|
-
let
|
|
601
|
-
...
|
|
602
|
-
...
|
|
792
|
+
function Z({ width: t, height: n, className: r, style: i, ...a }) {
|
|
793
|
+
let o = {
|
|
794
|
+
...t !== void 0 && { width: t },
|
|
795
|
+
...n !== void 0 && { height: n }
|
|
603
796
|
};
|
|
604
|
-
return /* @__PURE__ */
|
|
605
|
-
...
|
|
797
|
+
return /* @__PURE__ */ e("span", {
|
|
798
|
+
...a,
|
|
606
799
|
"aria-hidden": "true",
|
|
607
|
-
className: d("tintora-skeleton",
|
|
800
|
+
className: d("tintora-skeleton", r),
|
|
608
801
|
style: {
|
|
609
|
-
...
|
|
610
|
-
...
|
|
802
|
+
...o,
|
|
803
|
+
...i
|
|
611
804
|
}
|
|
612
805
|
});
|
|
613
806
|
}
|
|
614
807
|
//#endregion
|
|
615
808
|
//#region src/Switch/Switch.tsx
|
|
616
|
-
function
|
|
617
|
-
let
|
|
618
|
-
checked:
|
|
619
|
-
defaultChecked:
|
|
620
|
-
onCheckedChange:
|
|
621
|
-
});
|
|
622
|
-
return /* @__PURE__ */
|
|
623
|
-
className: d("tintora-switch",
|
|
624
|
-
children: [/* @__PURE__ */
|
|
625
|
-
...
|
|
809
|
+
function te({ checked: n, defaultChecked: r, onCheckedChange: i, className: a, ...o }) {
|
|
810
|
+
let s = S({
|
|
811
|
+
checked: n,
|
|
812
|
+
defaultChecked: r,
|
|
813
|
+
onCheckedChange: i
|
|
814
|
+
});
|
|
815
|
+
return /* @__PURE__ */ t("span", {
|
|
816
|
+
className: d("tintora-switch", a),
|
|
817
|
+
children: [/* @__PURE__ */ e("input", {
|
|
818
|
+
...o,
|
|
626
819
|
type: "checkbox",
|
|
627
820
|
role: "switch",
|
|
628
821
|
className: "tintora-switch__input",
|
|
629
|
-
checked:
|
|
630
|
-
onChange:
|
|
631
|
-
}), /* @__PURE__ */
|
|
822
|
+
checked: s.checked,
|
|
823
|
+
onChange: s.onChange
|
|
824
|
+
}), /* @__PURE__ */ e("span", {
|
|
632
825
|
className: "tintora-switch__track",
|
|
633
826
|
"aria-hidden": "true"
|
|
634
827
|
})]
|
|
@@ -636,36 +829,36 @@ function V({ checked: e, defaultChecked: t, onCheckedChange: n, className: r, ..
|
|
|
636
829
|
}
|
|
637
830
|
//#endregion
|
|
638
831
|
//#region src/Tag/Tag.tsx
|
|
639
|
-
function
|
|
640
|
-
return /* @__PURE__ */
|
|
641
|
-
...
|
|
642
|
-
className: d("tintora-tag", `tintora-tag--${
|
|
643
|
-
children:
|
|
832
|
+
function ne({ children: t, className: n, variant: r = "neutral", size: i = "medium", ...a }) {
|
|
833
|
+
return /* @__PURE__ */ e("span", {
|
|
834
|
+
...a,
|
|
835
|
+
className: d("tintora-tag", `tintora-tag--${r}`, `tintora-tag--${i}`, n),
|
|
836
|
+
children: t
|
|
644
837
|
});
|
|
645
838
|
}
|
|
646
839
|
//#endregion
|
|
647
840
|
//#region src/TextField/TextField.tsx
|
|
648
|
-
function
|
|
649
|
-
let p =
|
|
650
|
-
return /* @__PURE__ */
|
|
651
|
-
className: d("tintora-textfield",
|
|
841
|
+
function re({ label: n, hint: r, error: i, id: a, className: s, disabled: c, "aria-describedby": l, "aria-invalid": u, ...f }) {
|
|
842
|
+
let p = o(), m = a ?? p, h = `${m}-message`, g = i ?? r;
|
|
843
|
+
return /* @__PURE__ */ t("div", {
|
|
844
|
+
className: d("tintora-textfield", c && "tintora-textfield--disabled", s),
|
|
652
845
|
children: [
|
|
653
|
-
/* @__PURE__ */
|
|
846
|
+
/* @__PURE__ */ e("label", {
|
|
654
847
|
htmlFor: m,
|
|
655
848
|
className: "tintora-textfield__label",
|
|
656
|
-
children:
|
|
849
|
+
children: n
|
|
657
850
|
}),
|
|
658
|
-
/* @__PURE__ */
|
|
851
|
+
/* @__PURE__ */ e("input", {
|
|
659
852
|
...f,
|
|
660
853
|
id: m,
|
|
661
|
-
disabled:
|
|
854
|
+
disabled: c,
|
|
662
855
|
className: "tintora-textfield__input",
|
|
663
|
-
"aria-invalid":
|
|
664
|
-
"aria-describedby": d(g && h,
|
|
856
|
+
"aria-invalid": i ? !0 : u,
|
|
857
|
+
"aria-describedby": d(g && h, l) || void 0
|
|
665
858
|
}),
|
|
666
|
-
g && /* @__PURE__ */
|
|
859
|
+
g && /* @__PURE__ */ e("span", {
|
|
667
860
|
id: h,
|
|
668
|
-
className: d("tintora-textfield__hint",
|
|
861
|
+
className: d("tintora-textfield__hint", i && "tintora-textfield__hint--error"),
|
|
669
862
|
children: g
|
|
670
863
|
})
|
|
671
864
|
]
|
|
@@ -673,8 +866,8 @@ function U({ label: e, hint: t, error: n, id: r, className: a, disabled: o, "ari
|
|
|
673
866
|
}
|
|
674
867
|
//#endregion
|
|
675
868
|
//#region src/Toast/ToastIcons.tsx
|
|
676
|
-
function
|
|
677
|
-
return /* @__PURE__ */
|
|
869
|
+
function ie() {
|
|
870
|
+
return /* @__PURE__ */ e("svg", {
|
|
678
871
|
width: "20",
|
|
679
872
|
height: "20",
|
|
680
873
|
viewBox: "0 0 24 24",
|
|
@@ -685,11 +878,11 @@ function W() {
|
|
|
685
878
|
strokeLinejoin: "round",
|
|
686
879
|
"aria-hidden": "true",
|
|
687
880
|
style: { flex: "0 0 auto" },
|
|
688
|
-
children: /* @__PURE__ */
|
|
881
|
+
children: /* @__PURE__ */ e("path", { d: "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20zM8 12.5l2.7 2.7L16 9.8" })
|
|
689
882
|
});
|
|
690
883
|
}
|
|
691
|
-
function
|
|
692
|
-
return /* @__PURE__ */
|
|
884
|
+
function ae() {
|
|
885
|
+
return /* @__PURE__ */ e("svg", {
|
|
693
886
|
width: "20",
|
|
694
887
|
height: "20",
|
|
695
888
|
viewBox: "0 0 24 24",
|
|
@@ -700,11 +893,11 @@ function G() {
|
|
|
700
893
|
strokeLinejoin: "round",
|
|
701
894
|
"aria-hidden": "true",
|
|
702
895
|
style: { flex: "0 0 auto" },
|
|
703
|
-
children: /* @__PURE__ */
|
|
896
|
+
children: /* @__PURE__ */ e("path", { d: "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20zM15 9l-6 6M9 9l6 6" })
|
|
704
897
|
});
|
|
705
898
|
}
|
|
706
|
-
function
|
|
707
|
-
return /* @__PURE__ */
|
|
899
|
+
function oe() {
|
|
900
|
+
return /* @__PURE__ */ e("svg", {
|
|
708
901
|
width: "20",
|
|
709
902
|
height: "20",
|
|
710
903
|
viewBox: "0 0 24 24",
|
|
@@ -715,11 +908,11 @@ function K() {
|
|
|
715
908
|
strokeLinejoin: "round",
|
|
716
909
|
"aria-hidden": "true",
|
|
717
910
|
style: { flex: "0 0 auto" },
|
|
718
|
-
children: /* @__PURE__ */
|
|
911
|
+
children: /* @__PURE__ */ e("path", { d: "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20zM12 16v-4M12 8h.01" })
|
|
719
912
|
});
|
|
720
913
|
}
|
|
721
|
-
function
|
|
722
|
-
return /* @__PURE__ */
|
|
914
|
+
function se() {
|
|
915
|
+
return /* @__PURE__ */ e("svg", {
|
|
723
916
|
width: "20",
|
|
724
917
|
height: "20",
|
|
725
918
|
viewBox: "0 0 24 24",
|
|
@@ -730,11 +923,11 @@ function q() {
|
|
|
730
923
|
strokeLinejoin: "round",
|
|
731
924
|
"aria-hidden": "true",
|
|
732
925
|
style: { flex: "0 0 auto" },
|
|
733
|
-
children: /* @__PURE__ */
|
|
926
|
+
children: /* @__PURE__ */ e("path", { d: "M10.3 3.9L1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0zM12 9v4M12 17h.01" })
|
|
734
927
|
});
|
|
735
928
|
}
|
|
736
|
-
function
|
|
737
|
-
return /* @__PURE__ */
|
|
929
|
+
function ce() {
|
|
930
|
+
return /* @__PURE__ */ e("svg", {
|
|
738
931
|
width: "14",
|
|
739
932
|
height: "14",
|
|
740
933
|
viewBox: "0 0 24 24",
|
|
@@ -743,34 +936,34 @@ function J() {
|
|
|
743
936
|
strokeWidth: "2.2",
|
|
744
937
|
strokeLinecap: "round",
|
|
745
938
|
"aria-hidden": "true",
|
|
746
|
-
children: /* @__PURE__ */
|
|
939
|
+
children: /* @__PURE__ */ e("path", { d: "M18 6L6 18M6 6l12 12" })
|
|
747
940
|
});
|
|
748
941
|
}
|
|
749
942
|
//#endregion
|
|
750
943
|
//#region src/Toast/Toast.tsx
|
|
751
|
-
var
|
|
752
|
-
success: /* @__PURE__ */
|
|
753
|
-
error: /* @__PURE__ */
|
|
754
|
-
info: /* @__PURE__ */
|
|
755
|
-
warning: /* @__PURE__ */
|
|
944
|
+
var Q = {
|
|
945
|
+
success: /* @__PURE__ */ e(ie, {}),
|
|
946
|
+
error: /* @__PURE__ */ e(ae, {}),
|
|
947
|
+
info: /* @__PURE__ */ e(oe, {}),
|
|
948
|
+
warning: /* @__PURE__ */ e(se, {})
|
|
756
949
|
};
|
|
757
|
-
function
|
|
758
|
-
let [m, h] =
|
|
759
|
-
|
|
760
|
-
b.current =
|
|
761
|
-
}, [
|
|
762
|
-
if (
|
|
950
|
+
function le({ status: n, children: r, action: i, onDismiss: o, duration: s = 5e3, timerBar: u = !1, className: f, ...p }) {
|
|
951
|
+
let [m, h] = l(!1), [g, _] = l(!1), v = m || g, y = A(o), b = c(s);
|
|
952
|
+
a(() => {
|
|
953
|
+
b.current = s;
|
|
954
|
+
}, [s]), a(() => {
|
|
955
|
+
if (s <= 0 || v) return;
|
|
763
956
|
let e = Date.now(), t = setTimeout(() => y.current(), b.current);
|
|
764
957
|
return () => {
|
|
765
958
|
clearTimeout(t), b.current -= Date.now() - e;
|
|
766
959
|
};
|
|
767
960
|
}, [
|
|
768
|
-
|
|
961
|
+
s,
|
|
769
962
|
v,
|
|
770
963
|
y
|
|
771
964
|
]);
|
|
772
|
-
let x = u &&
|
|
773
|
-
return /* @__PURE__ */
|
|
965
|
+
let x = u && s > 0, S = { "--tintora-toast-animation-duration": `${s}ms` };
|
|
966
|
+
return /* @__PURE__ */ t("div", {
|
|
774
967
|
...p,
|
|
775
968
|
role: "status",
|
|
776
969
|
className: d("tintora-toast", x && "tintora-toast--timer", v && "tintora-toast--paused", f),
|
|
@@ -787,25 +980,25 @@ function X({ status: e, children: t, action: n, onDismiss: i, duration: a = 5e3,
|
|
|
787
980
|
p.onBlur?.(e), e.currentTarget.contains(e.relatedTarget) || _(!1);
|
|
788
981
|
},
|
|
789
982
|
children: [
|
|
790
|
-
|
|
791
|
-
/* @__PURE__ */
|
|
983
|
+
n && Q[n],
|
|
984
|
+
/* @__PURE__ */ e("span", {
|
|
792
985
|
className: "tintora-toast__message",
|
|
793
|
-
children:
|
|
986
|
+
children: r
|
|
794
987
|
}),
|
|
795
|
-
|
|
988
|
+
i && /* @__PURE__ */ e("button", {
|
|
796
989
|
type: "button",
|
|
797
990
|
className: "tintora-toast__action",
|
|
798
|
-
onClick:
|
|
799
|
-
children:
|
|
991
|
+
onClick: i.onClick,
|
|
992
|
+
children: i.label
|
|
800
993
|
}),
|
|
801
|
-
/* @__PURE__ */
|
|
994
|
+
/* @__PURE__ */ e("button", {
|
|
802
995
|
type: "button",
|
|
803
996
|
className: "tintora-toast__close",
|
|
804
997
|
"aria-label": "Dismiss",
|
|
805
|
-
onClick:
|
|
806
|
-
children: /* @__PURE__ */
|
|
998
|
+
onClick: o,
|
|
999
|
+
children: /* @__PURE__ */ e(ce, {})
|
|
807
1000
|
}),
|
|
808
|
-
x && /* @__PURE__ */
|
|
1001
|
+
x && /* @__PURE__ */ e("span", {
|
|
809
1002
|
className: "tintora-toast__progress",
|
|
810
1003
|
style: S
|
|
811
1004
|
})
|
|
@@ -814,20 +1007,20 @@ function X({ status: e, children: t, action: n, onDismiss: i, duration: a = 5e3,
|
|
|
814
1007
|
}
|
|
815
1008
|
//#endregion
|
|
816
1009
|
//#region src/Toggle/ToggleContext.ts
|
|
817
|
-
var
|
|
818
|
-
function
|
|
819
|
-
let e =
|
|
1010
|
+
var $ = r(null);
|
|
1011
|
+
function ue() {
|
|
1012
|
+
let e = i($);
|
|
820
1013
|
if (!e) throw Error("ToggleItem must be rendered inside a Toggle");
|
|
821
1014
|
return e;
|
|
822
1015
|
}
|
|
823
1016
|
//#endregion
|
|
824
1017
|
//#region src/Toggle/Toggle.tsx
|
|
825
|
-
function
|
|
826
|
-
let [p, m] =
|
|
1018
|
+
function de({ children: n, value: r, defaultValue: i, onValueChange: a, disabled: o = !1, className: u, ...f }) {
|
|
1019
|
+
let [p, m] = l(i), h = r !== void 0, g = h ? r : p, _ = n.findIndex((e) => e.props.value === g), v = c(null), [y, b] = l({
|
|
827
1020
|
x: 0,
|
|
828
1021
|
width: 0
|
|
829
1022
|
});
|
|
830
|
-
|
|
1023
|
+
s(() => {
|
|
831
1024
|
let e = v.current;
|
|
832
1025
|
if (!e) return;
|
|
833
1026
|
let t = () => {
|
|
@@ -849,20 +1042,20 @@ function ne({ children: e, value: t, defaultValue: n, onValueChange: r, disabled
|
|
|
849
1042
|
"--tintora-toggle-thumb-x": `${y.x}px`,
|
|
850
1043
|
"--tintora-toggle-thumb-width": `${y.width}px`
|
|
851
1044
|
};
|
|
852
|
-
return /* @__PURE__ */
|
|
1045
|
+
return /* @__PURE__ */ e($.Provider, {
|
|
853
1046
|
value: {
|
|
854
1047
|
value: g,
|
|
855
1048
|
select: (e) => {
|
|
856
|
-
e !== g && (h || m(e),
|
|
1049
|
+
e !== g && (h || m(e), a?.(e));
|
|
857
1050
|
},
|
|
858
|
-
disabled:
|
|
1051
|
+
disabled: o
|
|
859
1052
|
},
|
|
860
|
-
children: /* @__PURE__ */
|
|
1053
|
+
children: /* @__PURE__ */ t("div", {
|
|
861
1054
|
...f,
|
|
862
1055
|
role: "group",
|
|
863
1056
|
ref: v,
|
|
864
|
-
className: d("tintora-toggle",
|
|
865
|
-
children: [
|
|
1057
|
+
className: d("tintora-toggle", o && "tintora-toggle--disabled", u),
|
|
1058
|
+
children: [n, /* @__PURE__ */ e("span", {
|
|
866
1059
|
"aria-hidden": "true",
|
|
867
1060
|
className: "tintora-toggle__thumb",
|
|
868
1061
|
style: x
|
|
@@ -872,140 +1065,76 @@ function ne({ children: e, value: t, defaultValue: n, onValueChange: r, disabled
|
|
|
872
1065
|
}
|
|
873
1066
|
//#endregion
|
|
874
1067
|
//#region src/Toggle/ToggleItem.tsx
|
|
875
|
-
function
|
|
876
|
-
let
|
|
877
|
-
|
|
1068
|
+
function fe({ value: t, children: n, className: r, disabled: i, onClick: a, ...o }) {
|
|
1069
|
+
let s = ue(), c = (e) => {
|
|
1070
|
+
a?.(e), e.defaultPrevented || s.select(t);
|
|
878
1071
|
};
|
|
879
|
-
return /* @__PURE__ */
|
|
880
|
-
...
|
|
1072
|
+
return /* @__PURE__ */ e("button", {
|
|
1073
|
+
...o,
|
|
881
1074
|
type: "button",
|
|
882
|
-
className: d("tintora-toggle__item",
|
|
883
|
-
"aria-pressed":
|
|
884
|
-
disabled:
|
|
885
|
-
onClick:
|
|
886
|
-
children:
|
|
1075
|
+
className: d("tintora-toggle__item", r),
|
|
1076
|
+
"aria-pressed": s.value === t,
|
|
1077
|
+
disabled: i || s.disabled,
|
|
1078
|
+
onClick: c,
|
|
1079
|
+
children: n
|
|
887
1080
|
});
|
|
888
1081
|
}
|
|
889
1082
|
//#endregion
|
|
890
|
-
//#region src/utils/placement.ts
|
|
891
|
-
var ie = {
|
|
892
|
-
gap: 10,
|
|
893
|
-
margin: 8,
|
|
894
|
-
arrowInset: 12
|
|
895
|
-
}, Q = {
|
|
896
|
-
top: "bottom",
|
|
897
|
-
bottom: "top",
|
|
898
|
-
left: "right",
|
|
899
|
-
right: "left"
|
|
900
|
-
}, $ = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n));
|
|
901
|
-
function ae(e, t, n, r, { gap: i, margin: a }) {
|
|
902
|
-
let o = (t) => {
|
|
903
|
-
switch (t) {
|
|
904
|
-
case "top": return e.top;
|
|
905
|
-
case "bottom": return r.height - e.bottom;
|
|
906
|
-
case "left": return e.left;
|
|
907
|
-
case "right": return r.width - e.right;
|
|
908
|
-
}
|
|
909
|
-
}, s = (n === "top" || n === "bottom" ? t.height : t.width) + i + a, c = o(n);
|
|
910
|
-
return c >= s || o(Q[n]) <= c ? n : Q[n];
|
|
911
|
-
}
|
|
912
|
-
function oe(e, t, n, r = {
|
|
913
|
-
width: window.innerWidth,
|
|
914
|
-
height: window.innerHeight
|
|
915
|
-
}, i = {}) {
|
|
916
|
-
let a = {
|
|
917
|
-
...ie,
|
|
918
|
-
...i
|
|
919
|
-
}, { gap: o, margin: s, arrowInset: c } = a, l = ae(e, t, n, r, a), u = l === "top" || l === "bottom", d, f;
|
|
920
|
-
switch (l) {
|
|
921
|
-
case "top":
|
|
922
|
-
d = e.y - t.height - o, f = e.x + e.width / 2 - t.width / 2;
|
|
923
|
-
break;
|
|
924
|
-
case "bottom":
|
|
925
|
-
d = e.y + e.height + o, f = e.x + e.width / 2 - t.width / 2;
|
|
926
|
-
break;
|
|
927
|
-
case "left":
|
|
928
|
-
d = e.y + e.height / 2 - t.height / 2, f = e.x - t.width - o;
|
|
929
|
-
break;
|
|
930
|
-
case "right": d = e.y + e.height / 2 - t.height / 2, f = e.x + e.width + o;
|
|
931
|
-
}
|
|
932
|
-
u ? f = $(f, s, r.width - t.width - s) : d = $(d, s, r.height - t.height - s);
|
|
933
|
-
let p = u ? e.x + e.width / 2 - f : e.y + e.height / 2 - d, m = u ? t.width : t.height;
|
|
934
|
-
return {
|
|
935
|
-
top: d,
|
|
936
|
-
left: f,
|
|
937
|
-
placement: l,
|
|
938
|
-
arrowOffset: $(p, c, m - c)
|
|
939
|
-
};
|
|
940
|
-
}
|
|
941
|
-
//#endregion
|
|
942
|
-
//#region src/hooks/useEscapeKey.ts
|
|
943
|
-
function se(e, t) {
|
|
944
|
-
let n = N(t);
|
|
945
|
-
r(() => {
|
|
946
|
-
if (!e) return;
|
|
947
|
-
let t = (e) => {
|
|
948
|
-
e.key === "Escape" && n.current();
|
|
949
|
-
};
|
|
950
|
-
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
951
|
-
}, [e, n]);
|
|
952
|
-
}
|
|
953
|
-
//#endregion
|
|
954
1083
|
//#region src/Tooltip/Tooltip.tsx
|
|
955
|
-
var
|
|
956
|
-
function
|
|
957
|
-
let m =
|
|
1084
|
+
var pe = 100;
|
|
1085
|
+
function me({ title: r, content: i, shortcut: s, children: u, className: f, placement: p = "top" }) {
|
|
1086
|
+
let m = o(), [h, g] = l(!1), _ = c(null), v = c(null), y = c(void 0), b = () => {
|
|
958
1087
|
window.clearTimeout(y.current), g(!0);
|
|
959
1088
|
}, x = () => {
|
|
960
|
-
window.clearTimeout(y.current), y.current = window.setTimeout(() => g(!1),
|
|
961
|
-
}, S =
|
|
1089
|
+
window.clearTimeout(y.current), y.current = window.setTimeout(() => g(!1), pe);
|
|
1090
|
+
}, S = N(h, v, () => {
|
|
962
1091
|
let e = v.current, t = _.current?.firstElementChild;
|
|
963
|
-
return !e || !t ? null :
|
|
1092
|
+
return !e || !t ? null : R(t.getBoundingClientRect(), {
|
|
964
1093
|
width: e.offsetWidth,
|
|
965
1094
|
height: e.offsetHeight
|
|
966
1095
|
}, p);
|
|
967
1096
|
}, [
|
|
968
1097
|
p,
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1098
|
+
r,
|
|
1099
|
+
i,
|
|
1100
|
+
s
|
|
972
1101
|
]);
|
|
973
|
-
|
|
1102
|
+
j(h, () => g(!1)), a(() => () => window.clearTimeout(y.current), []);
|
|
974
1103
|
let C = S ? {
|
|
975
1104
|
top: S.top,
|
|
976
1105
|
left: S.left,
|
|
977
1106
|
"--tintora-tooltip-arrow-offset": `${S.arrowOffset}px`
|
|
978
1107
|
} : { visibility: "hidden" };
|
|
979
|
-
return /* @__PURE__ */
|
|
1108
|
+
return /* @__PURE__ */ t("span", {
|
|
980
1109
|
ref: _,
|
|
981
1110
|
className: "tintora-tooltip",
|
|
982
1111
|
onMouseEnter: b,
|
|
983
1112
|
onMouseLeave: x,
|
|
984
1113
|
onFocus: b,
|
|
985
1114
|
onBlur: x,
|
|
986
|
-
children: [
|
|
1115
|
+
children: [n(u, { "aria-describedby": d(u.props["aria-describedby"], h && m) || void 0 }), h && /* @__PURE__ */ t("div", {
|
|
987
1116
|
id: m,
|
|
988
1117
|
ref: v,
|
|
989
1118
|
role: "tooltip",
|
|
990
1119
|
popover: "manual",
|
|
991
1120
|
style: C,
|
|
992
|
-
className: d("tintora-tooltip__content", `tintora-tooltip__content--${S?.placement ?? p}`,
|
|
1121
|
+
className: d("tintora-tooltip__content", `tintora-tooltip__content--${S?.placement ?? p}`, r && "tintora-tooltip__content--rich", f),
|
|
993
1122
|
children: [
|
|
994
|
-
|
|
1123
|
+
r && /* @__PURE__ */ e("span", {
|
|
995
1124
|
className: "tintora-tooltip__title",
|
|
996
|
-
children:
|
|
1125
|
+
children: r
|
|
997
1126
|
}),
|
|
998
|
-
/* @__PURE__ */
|
|
1127
|
+
/* @__PURE__ */ e("span", {
|
|
999
1128
|
className: "tintora-tooltip__text",
|
|
1000
|
-
children:
|
|
1129
|
+
children: i
|
|
1001
1130
|
}),
|
|
1002
|
-
|
|
1131
|
+
s && /* @__PURE__ */ e("kbd", {
|
|
1003
1132
|
className: "tintora-tooltip__shortcut",
|
|
1004
|
-
children:
|
|
1133
|
+
children: s
|
|
1005
1134
|
})
|
|
1006
1135
|
]
|
|
1007
1136
|
})]
|
|
1008
1137
|
});
|
|
1009
1138
|
}
|
|
1010
1139
|
//#endregion
|
|
1011
|
-
export {
|
|
1140
|
+
export { m as Alert, g as Avatar, y as Button, b as Card, C as Checkbox, w as Chip, T as Dot, D as IconButton, k as Modal, B as Popover, V as ProgressBar, W as Radio, G as RadioGroup, K as SearchInput, X as Select, x as SelectableCard, Z as Skeleton, v as Spinner, te as Switch, ne as Tag, re as TextField, le as Toast, de as Toggle, fe as ToggleItem, me as Tooltip };
|