@chenyqthu/tp-mobile-ui-kit 0.1.0 → 0.2.1

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 (40) hide show
  1. package/README.md +5 -5
  2. package/dist/catalog.json +1339 -71
  3. package/dist/chunks/{OmadaAppDemo-BP4a4ch_.js → OmadaAppDemo-Dwm_iU6O.js} +2050 -1239
  4. package/dist/chunks/TPPrompt-6o6zUNzO.js +3748 -0
  5. package/dist/core.js +2 -2
  6. package/dist/index.js +7 -7
  7. package/dist/omada.js +7 -7
  8. package/dist/standalone.js +341 -341
  9. package/dist/style.css +1 -1
  10. package/dist/types/core/components/TPAvatar.d.ts +7 -0
  11. package/dist/types/core/components/TPCheckbox.d.ts +11 -0
  12. package/dist/types/core/components/TPDivider.d.ts +7 -0
  13. package/dist/types/core/components/TPFixedToast.d.ts +7 -0
  14. package/dist/types/core/components/TPIconButton.d.ts +11 -0
  15. package/dist/types/core/components/TPLast7DaysPicker.d.ts +7 -0
  16. package/dist/types/core/components/TPLiquidGlass.d.ts +9 -0
  17. package/dist/types/core/components/TPLiquidGlassBackdrop.d.ts +32 -0
  18. package/dist/types/core/components/TPMonthPicker.d.ts +7 -0
  19. package/dist/types/core/components/TPPinInput.d.ts +7 -0
  20. package/dist/types/core/components/TPProgress.d.ts +7 -0
  21. package/dist/types/core/components/TPRadio.d.ts +11 -0
  22. package/dist/types/core/components/TPSkeleton.d.ts +7 -0
  23. package/dist/types/core/components/TPStepText.d.ts +7 -0
  24. package/dist/types/core/components/TPStepper.d.ts +7 -0
  25. package/dist/types/core/components/TPSwipeRow.d.ts +8 -0
  26. package/dist/types/core/components/TPTooltip.d.ts +7 -0
  27. package/dist/types/core/index.d.ts +17 -0
  28. package/dist/types/core/types.d.ts +236 -0
  29. package/dist/types/core/utils/liquidGlassEngine.d.ts +37 -0
  30. package/dist/types/omada/blocks/OmadaFirmwareUpdateBlock.d.ts +23 -0
  31. package/dist/types/omada/blocks/OmadaPortPanelBlock.d.ts +31 -0
  32. package/dist/types/omada/blocks/OmadaScheduleBlock.d.ts +33 -0
  33. package/dist/types/omada/blocks/OmadaTopologyBlock.d.ts +26 -0
  34. package/dist/types/omada/index.d.ts +4 -0
  35. package/dist/types/omada/pages/OmadaAppDemo.d.ts +1 -1
  36. package/dist/types/omada/pages/OmadaSiteSettingsPage.d.ts +4 -2
  37. package/package.json +2 -2
  38. package/skills/tp-mobile-ui-kit/SKILL.md +5 -4
  39. package/skills/tp-mobile-ui-kit/references/catalog.json +1339 -71
  40. package/dist/chunks/TPPrompt-Csg5YasJ.js +0 -2460
@@ -1,2460 +0,0 @@
1
- import { s as e, t } from "./asset-illustrations-YHXzEd7z.js";
2
- import { n, t as r } from "./asset-icons-BIenKvAh.js";
3
- import i, { createContext as a, useCallback as o, useContext as s, useEffect as c, useId as l, useMemo as u, useRef as d, useState as f } from "react";
4
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
5
- // src/core/components/TPPhoneFrame.tsx
6
- var g = {
7
- iphone16pro: {
8
- width: 393,
9
- height: 852,
10
- isIOS: !0
11
- },
12
- iphone14: {
13
- width: 375,
14
- height: 812,
15
- isIOS: !0
16
- },
17
- android: {
18
- width: 360,
19
- height: 800,
20
- isIOS: !1
21
- },
22
- compact: {
23
- width: 360,
24
- height: 720,
25
- isIOS: !1
26
- }
27
- };
28
- function _(e, t) {
29
- return e || (t === "base" ? "iphone14" : "iphone16pro");
30
- }
31
- var v = ({ device: t, width: n, height: r, screenSize: i, showFrame: a = !0, showDynamicIsland: o, showHomeIndicator: s, statusBar: c, bottomBar: l, floatingAction: u, className: d = "", style: f, children: p }) => {
32
- let v = e(), y = i ?? v.screenSize, b = _(t, y), x = g[b], S = n ?? x.width, C = r ?? x.height, w = o ?? (a && x.isIOS), T = s ?? a, E = [
33
- "tp-phone-frame",
34
- `tp-phone-frame--${b}`,
35
- a ? "tp-phone-frame--framed" : "tp-phone-frame--frameless",
36
- d
37
- ].filter(Boolean).join(" ");
38
- return /* @__PURE__ */ m("div", {
39
- className: E,
40
- "data-device": b,
41
- "data-show-frame": String(a),
42
- "data-tp-screen": y,
43
- "data-width": S,
44
- "data-height": C,
45
- style: {
46
- ...a ? void 0 : {
47
- width: `${S}px`,
48
- height: `${C}px`
49
- },
50
- ...f
51
- },
52
- children: /* @__PURE__ */ h("div", {
53
- className: "tp-phone-screen",
54
- style: {
55
- width: `${S}px`,
56
- height: `${C}px`
57
- },
58
- children: [
59
- w && /* @__PURE__ */ m("div", {
60
- className: "tp-phone-dynamic-island",
61
- "data-testid": "tp-phone-dynamic-island",
62
- "aria-hidden": "true",
63
- children: /* @__PURE__ */ m("span", { className: "tp-phone-dynamic-island-lens" })
64
- }),
65
- c != null && /* @__PURE__ */ m("div", {
66
- className: "tp-phone-statusbar",
67
- children: c
68
- }),
69
- /* @__PURE__ */ h("div", {
70
- className: "tp-phone-stage",
71
- children: [/* @__PURE__ */ m("div", {
72
- className: "tp-phone-body",
73
- children: p
74
- }), u != null && /* @__PURE__ */ m("div", {
75
- className: "tp-phone-floating-action",
76
- children: u
77
- })]
78
- }),
79
- l != null || T ? /* @__PURE__ */ h("div", {
80
- className: "tp-phone-bottom",
81
- children: [l != null && /* @__PURE__ */ m("div", {
82
- className: "tp-phone-bottombar",
83
- children: l
84
- }), T && /* @__PURE__ */ m("div", {
85
- className: "tp-phone-home-indicator",
86
- "data-testid": "tp-phone-home-indicator",
87
- "aria-hidden": "true",
88
- children: /* @__PURE__ */ m("span", { className: "tp-phone-home-indicator-pill" })
89
- })]
90
- }) : null
91
- ]
92
- })
93
- });
94
- }, y = [
95
- 4,
96
- 6,
97
- 8,
98
- 10
99
- ], b = ({ time: t = "10:51", os: n, carrier: r, signalStrength: i = 4, wifiStrength: a = 3, battery: o = 100, muted: s = !1, locationActive: c = !1, transparent: l = !1, className: u = "", style: d }) => {
100
- let f = e(), p = n ?? f.os, g = Math.max(0, Math.min(100, Math.round(o))), _ = g <= 20, v = g / 100 * 18, b = [
101
- "tp-statusbar",
102
- `tp-statusbar--${p}`,
103
- l ? "tp-statusbar--transparent" : "",
104
- u
105
- ].filter(Boolean).join(" ");
106
- return /* @__PURE__ */ h("div", {
107
- className: b,
108
- "data-os": p,
109
- "data-signal": i,
110
- "data-wifi": a,
111
- "data-battery": g,
112
- style: d,
113
- children: [/* @__PURE__ */ h("div", {
114
- className: "tp-statusbar-left",
115
- children: [
116
- /* @__PURE__ */ m("span", {
117
- className: "tp-statusbar-time",
118
- children: t
119
- }),
120
- r && /* @__PURE__ */ m("span", {
121
- className: "tp-statusbar-carrier",
122
- children: r
123
- }),
124
- c && /* @__PURE__ */ m("span", {
125
- className: "tp-statusbar-meta-icon",
126
- "aria-label": "Location active",
127
- children: /* @__PURE__ */ m("svg", {
128
- width: "11",
129
- height: "11",
130
- viewBox: "0 0 12 12",
131
- fill: "none",
132
- "aria-hidden": "true",
133
- children: /* @__PURE__ */ m("path", {
134
- d: "M10.8 1.2L1.3 5.2L5.5 6.5L6.8 10.7L10.8 1.2Z",
135
- fill: "currentColor"
136
- })
137
- })
138
- }),
139
- s && /* @__PURE__ */ m("span", {
140
- className: "tp-statusbar-meta-icon",
141
- "aria-label": "Muted",
142
- children: /* @__PURE__ */ m("svg", {
143
- width: "12",
144
- height: "12",
145
- viewBox: "0 0 14 14",
146
- fill: "none",
147
- "aria-hidden": "true",
148
- children: /* @__PURE__ */ m("path", {
149
- d: "M9.6 8.3V5.8C9.6 4.2 8.5 3 7 3C6.4 3 5.9 3.2 5.5 3.5M4.4 5.8V8.3L3.2 9.8H10.1M6 11.1C6.2 11.6 6.6 11.8 7 11.8C7.4 11.8 7.8 11.6 8 11.1M2.2 2.2L11.8 11.8",
150
- stroke: "currentColor",
151
- strokeWidth: "1.2",
152
- strokeLinecap: "round",
153
- strokeLinejoin: "round"
154
- })
155
- })
156
- })
157
- ]
158
- }), /* @__PURE__ */ h("div", {
159
- className: "tp-statusbar-right",
160
- children: [
161
- /* @__PURE__ */ m("span", {
162
- className: "tp-statusbar-signal",
163
- "aria-label": `Cellular signal ${i} of 4`,
164
- children: /* @__PURE__ */ m("svg", {
165
- width: "18",
166
- height: "12",
167
- viewBox: "0 0 18 12",
168
- fill: "none",
169
- "aria-hidden": "true",
170
- children: y.map((e, t) => {
171
- let n = t + 1, r = n <= i, a = t * 4.5, o = p === "ios" ? Math.max(2, e - 2) : e, s = p === "ios" ? 9 - o : 11 - o;
172
- return /* @__PURE__ */ h("g", {
173
- opacity: r ? 1 : .28,
174
- children: [/* @__PURE__ */ m("rect", {
175
- x: a,
176
- y: s,
177
- width: "3",
178
- height: o,
179
- rx: "1",
180
- fill: "currentColor"
181
- }), p === "ios" && /* @__PURE__ */ m("rect", {
182
- x: a,
183
- y: "10",
184
- width: "3",
185
- height: "1.6",
186
- rx: "0.8",
187
- fill: "currentColor"
188
- })]
189
- }, n);
190
- })
191
- })
192
- }),
193
- /* @__PURE__ */ m("span", {
194
- className: "tp-statusbar-wifi",
195
- "aria-label": `Wi-Fi signal ${a} of 3`,
196
- children: /* @__PURE__ */ h("svg", {
197
- width: "16",
198
- height: "12",
199
- viewBox: "0 0 16 12",
200
- fill: "none",
201
- "aria-hidden": "true",
202
- children: [
203
- /* @__PURE__ */ m("path", {
204
- d: "M1.4 3.8C5.1 0.6 10.9 0.6 14.6 3.8",
205
- stroke: "currentColor",
206
- strokeWidth: "1.5",
207
- strokeLinecap: "round",
208
- opacity: a >= 3 ? 1 : .28
209
- }),
210
- /* @__PURE__ */ m("path", {
211
- d: "M3.7 6.3C6.1 4.2 9.9 4.2 12.3 6.3",
212
- stroke: "currentColor",
213
- strokeWidth: "1.5",
214
- strokeLinecap: "round",
215
- opacity: a >= 2 ? 1 : .28
216
- }),
217
- /* @__PURE__ */ m("path", {
218
- d: "M6.1 8.8C7.2 7.8 8.8 7.8 9.9 8.8",
219
- stroke: "currentColor",
220
- strokeWidth: "1.5",
221
- strokeLinecap: "round",
222
- opacity: a >= 1 ? 1 : .28
223
- }),
224
- /* @__PURE__ */ m("circle", {
225
- cx: "8",
226
- cy: "10.7",
227
- r: "1.1",
228
- fill: "currentColor"
229
- })
230
- ]
231
- })
232
- }),
233
- /* @__PURE__ */ h("span", {
234
- className: "tp-statusbar-battery",
235
- "aria-label": `Battery ${g}%`,
236
- children: [p === "android" && /* @__PURE__ */ h("span", {
237
- className: "tp-statusbar-battery-text",
238
- children: [g, "%"]
239
- }), /* @__PURE__ */ h("svg", {
240
- width: "26",
241
- height: "12",
242
- viewBox: "0 0 26 12",
243
- fill: "none",
244
- "aria-hidden": "true",
245
- children: [
246
- /* @__PURE__ */ m("rect", {
247
- x: "0.75",
248
- y: "0.75",
249
- width: "21.5",
250
- height: "10.5",
251
- rx: "2.8",
252
- stroke: "currentColor",
253
- strokeOpacity: "0.45",
254
- strokeWidth: "1.2"
255
- }),
256
- /* @__PURE__ */ m("rect", {
257
- x: "2.2",
258
- y: "2.2",
259
- width: Math.max(0, v),
260
- height: "7.6",
261
- rx: "1.6",
262
- fill: _ ? "var(--tp-color-alert, #EE385C)" : "currentColor"
263
- }),
264
- /* @__PURE__ */ m("path", {
265
- d: "M23.5 4.2V7.8C24.3 7.5 24.8 6.8 24.8 6C24.8 5.2 24.3 4.5 23.5 4.2Z",
266
- fill: "currentColor",
267
- fillOpacity: "0.5"
268
- })
269
- ]
270
- })]
271
- })
272
- ]
273
- })]
274
- });
275
- }, x = ({ title: e, subtitle: t, variant: n = "standard", left: r, right: i, showBack: a = !1, onBack: o, titleDropdown: s = !1, onTitleClick: c, rightBadge: l, translucent: u = !1, className: d = "", style: f }) => {
276
- let g = n === "floating", _ = a || r != null, v = l != null && l !== "" && (typeof l != "number" || l > 0), y = i != null || v, b = /* @__PURE__ */ h(p, { children: [a ? /* @__PURE__ */ m("button", {
277
- type: "button",
278
- className: "tp-header-icon-btn",
279
- "aria-label": "Back",
280
- onClick: o,
281
- children: /* @__PURE__ */ m("svg", {
282
- width: "20",
283
- height: "20",
284
- viewBox: "0 0 24 24",
285
- fill: "none",
286
- "aria-hidden": "true",
287
- children: /* @__PURE__ */ m("path", {
288
- d: "M15.5 19L8.5 12L15.5 5",
289
- stroke: "currentColor",
290
- strokeWidth: "1.8",
291
- strokeLinecap: "round",
292
- strokeLinejoin: "round"
293
- })
294
- })
295
- }) : null, r] }), x = /* @__PURE__ */ h(p, { children: [e != null && /* @__PURE__ */ m("span", {
296
- className: "tp-header-title",
297
- children: e
298
- }), s && /* @__PURE__ */ m("span", {
299
- className: "tp-header-chevron",
300
- "aria-hidden": "true",
301
- children: /* @__PURE__ */ m("svg", {
302
- width: "14",
303
- height: "14",
304
- viewBox: "0 0 16 16",
305
- fill: "none",
306
- children: /* @__PURE__ */ m("path", {
307
- d: "M4 6L8 10L12 6",
308
- stroke: "currentColor",
309
- strokeWidth: "1.7",
310
- strokeLinecap: "round",
311
- strokeLinejoin: "round"
312
- })
313
- })
314
- })] }), S = [
315
- "tp-header",
316
- `tp-header--${n}`,
317
- u ? "tp-header--translucent" : "",
318
- d
319
- ].filter(Boolean).join(" ");
320
- return /* @__PURE__ */ h("header", {
321
- className: S,
322
- "data-variant": n,
323
- style: f,
324
- children: [
325
- /* @__PURE__ */ m("div", {
326
- className: "tp-header-left",
327
- children: _ ? g ? /* @__PURE__ */ m("div", {
328
- className: "tp-header-well",
329
- children: b
330
- }) : b : null
331
- }),
332
- /* @__PURE__ */ h("div", {
333
- className: "tp-header-center",
334
- children: [e != null || s ? c || s ? /* @__PURE__ */ m("button", {
335
- type: "button",
336
- className: "tp-header-title-btn",
337
- onClick: c,
338
- children: x
339
- }) : /* @__PURE__ */ m("div", {
340
- className: "tp-header-title-wrap",
341
- children: x
342
- }) : null, t != null && /* @__PURE__ */ m("div", {
343
- className: "tp-header-subtitle",
344
- children: t
345
- })]
346
- }),
347
- /* @__PURE__ */ m("div", {
348
- className: "tp-header-right",
349
- children: y ? /* @__PURE__ */ h("div", {
350
- className: "tp-header-right-slot",
351
- children: [g ? /* @__PURE__ */ m("div", {
352
- className: "tp-header-well",
353
- children: i
354
- }) : i, v && /* @__PURE__ */ m("span", {
355
- className: "tp-header-badge",
356
- children: l
357
- })]
358
- }) : null
359
- })
360
- ]
361
- });
362
- };
363
- // src/core/components/TPTabBar.tsx
364
- function S(e, t) {
365
- let i = t && e.activeIcon !== void 0 ? e.activeIcon : e.icon;
366
- return typeof i == "string" ? n(i) ? /* @__PURE__ */ m(r, {
367
- name: i,
368
- size: 22
369
- }) : /* @__PURE__ */ m("span", {
370
- className: "tp-tabbar-icon-fallback",
371
- "aria-hidden": "true",
372
- children: i
373
- }) : i;
374
- }
375
- function C(e) {
376
- return e == null || e === !1 ? null : e === !0 ? /* @__PURE__ */ m("span", {
377
- className: "tp-tabbar-badge tp-tabbar-badge--dot",
378
- "aria-label": "Notification"
379
- }) : typeof e == "number" ? e <= 0 ? null : /* @__PURE__ */ m("span", {
380
- className: "tp-tabbar-badge",
381
- children: e > 99 ? "99+" : String(e)
382
- }) : e === "" ? null : /* @__PURE__ */ m("span", {
383
- className: "tp-tabbar-badge",
384
- children: e
385
- });
386
- }
387
- var w = ({ items: e, activeKey: t, onChange: n, variant: r = "floating-pill", className: i = "", style: a }) => {
388
- let o = [
389
- "tp-tabbar",
390
- `tp-tabbar--${r}`,
391
- i
392
- ].filter(Boolean).join(" ");
393
- return /* @__PURE__ */ m("nav", {
394
- className: o,
395
- "data-variant": r,
396
- "aria-label": "Bottom Navigation",
397
- style: a,
398
- children: /* @__PURE__ */ m("div", {
399
- className: "tp-tabbar-track",
400
- role: "tablist",
401
- children: e.map((e) => {
402
- let r = e.key === t;
403
- return /* @__PURE__ */ h("button", {
404
- type: "button",
405
- role: "tab",
406
- "aria-selected": r,
407
- className: `tp-tabbar-item ${r ? "tp-tabbar-item--active" : ""}`.trim(),
408
- onClick: () => n(e.key),
409
- children: [/* @__PURE__ */ h("span", {
410
- className: "tp-tabbar-icon-wrap",
411
- children: [/* @__PURE__ */ m("span", {
412
- className: "tp-tabbar-icon",
413
- children: S(e, r)
414
- }), C(e.badge)]
415
- }), /* @__PURE__ */ m("span", {
416
- className: "tp-tabbar-label",
417
- children: e.label
418
- })]
419
- }, e.key);
420
- })
421
- })
422
- });
423
- }, T = ({ options: e, value: t, onChange: n, variant: r = "underline", fullWidth: i = !0, className: a = "", style: o }) => {
424
- let s = [
425
- "tp-segment",
426
- `tp-segment--${r}`,
427
- i ? "tp-segment--full" : "",
428
- a
429
- ].filter(Boolean).join(" ");
430
- return /* @__PURE__ */ m("div", {
431
- className: s,
432
- role: "tablist",
433
- "data-variant": r,
434
- style: o,
435
- children: e.map((e) => {
436
- let r = e.key === t, i = [
437
- "tp-segment-item",
438
- r ? "tp-segment-item--active" : "",
439
- e.disabled ? "tp-segment-item--disabled" : ""
440
- ].filter(Boolean).join(" ");
441
- return /* @__PURE__ */ h("button", {
442
- type: "button",
443
- role: "tab",
444
- "aria-selected": r,
445
- disabled: e.disabled,
446
- className: i,
447
- onClick: () => {
448
- e.disabled || n(e.key);
449
- },
450
- children: [/* @__PURE__ */ m("span", {
451
- className: "tp-segment-label",
452
- children: e.label
453
- }), e.badge !== void 0 && e.badge !== null && e.badge !== "" && /* @__PURE__ */ m("span", {
454
- className: "tp-segment-badge",
455
- children: e.badge
456
- })]
457
- }, e.key);
458
- })
459
- });
460
- }, E = ({ total: e, current: t, onChange: n, className: r = "", style: i }) => {
461
- if (e <= 0) return null;
462
- let a = ["tp-page-control", r].filter(Boolean).join(" ");
463
- return /* @__PURE__ */ m("div", {
464
- className: a,
465
- role: "navigation",
466
- "aria-label": "Page indicator",
467
- style: i,
468
- children: Array.from({ length: e }, (e, r) => {
469
- let i = r === t, a = ["tp-page-control-dot", i ? "tp-page-control-dot--active" : ""].filter(Boolean).join(" ");
470
- return n ? /* @__PURE__ */ m("button", {
471
- type: "button",
472
- className: a,
473
- "aria-label": `Page ${r + 1}`,
474
- "aria-current": i ? "page" : void 0,
475
- "data-active": String(i),
476
- onClick: () => n(r)
477
- }, r) : /* @__PURE__ */ m("span", {
478
- className: a,
479
- "data-active": String(i),
480
- "aria-current": i ? "page" : void 0
481
- }, r);
482
- })
483
- });
484
- }, D = ({ variant: e = "primary", size: t = "lg", block: n = !1, loading: r = !1, htmlType: i = "button", icon: a, disabled: o = !1, className: s = "", children: c, ...l }) => {
485
- let u = [
486
- "tp-btn",
487
- `tp-btn--${e}`,
488
- `tp-btn--${t}`,
489
- n ? "tp-btn--block" : "",
490
- r ? "tp-btn--loading" : "",
491
- s
492
- ].filter(Boolean).join(" ");
493
- return /* @__PURE__ */ h("button", {
494
- ...l,
495
- type: i,
496
- className: u,
497
- disabled: o || r,
498
- "aria-busy": r || void 0,
499
- "data-variant": e,
500
- "data-size": t,
501
- children: [r ? /* @__PURE__ */ m("span", {
502
- className: "tp-btn-spinner",
503
- "aria-hidden": "true"
504
- }) : a == null ? null : /* @__PURE__ */ m("span", {
505
- className: "tp-btn-icon",
506
- "aria-hidden": "true",
507
- children: a
508
- }), c != null && /* @__PURE__ */ m("span", {
509
- className: "tp-btn-label",
510
- children: c
511
- })]
512
- });
513
- }, O = ({ layout: e = "single", primaryText: t, onPrimaryClick: n, primaryLoading: r = !1, primaryDisabled: i = !1, secondaryText: a, onSecondaryClick: o, secondaryVariant: s = "secondary", note: c, className: l = "", style: u }) => {
514
- let d = [
515
- "tp-fixed-btn-bar",
516
- `tp-fixed-btn-bar--${e}`,
517
- l
518
- ].filter(Boolean).join(" "), f = /* @__PURE__ */ m(D, {
519
- variant: "primary",
520
- size: "lg",
521
- block: !0,
522
- loading: r,
523
- disabled: i,
524
- onClick: n,
525
- children: t
526
- }), g = a ? /* @__PURE__ */ m(D, {
527
- variant: s,
528
- size: "lg",
529
- block: !0,
530
- onClick: o,
531
- children: a
532
- }) : null;
533
- return /* @__PURE__ */ h("div", {
534
- className: d,
535
- "data-layout": e,
536
- style: u,
537
- children: [c != null && /* @__PURE__ */ m("div", {
538
- className: "tp-fixed-btn-bar-note",
539
- children: c
540
- }), /* @__PURE__ */ m("div", {
541
- className: "tp-fixed-btn-bar-actions",
542
- children: e === "dual-horizontal" ? /* @__PURE__ */ h(p, { children: [g, f] }) : /* @__PURE__ */ h(p, { children: [f, e === "dual-vertical" ? g : null] })
543
- })]
544
- });
545
- }, k = ({ checked: e, defaultChecked: t = !1, onChange: n, disabled: r = !1, loading: i = !1, ariaLabel: a, className: o = "", style: s }) => {
546
- let [c, l] = f(t), u = e !== void 0, d = u ? e : c, p = r || i, h = () => {
547
- if (p) return;
548
- let e = !d;
549
- u || l(e), n?.(e);
550
- }, g = [
551
- "tp-switch",
552
- d ? "tp-switch--checked" : "",
553
- r ? "tp-switch--disabled" : "",
554
- i ? "tp-switch--loading" : "",
555
- o
556
- ].filter(Boolean).join(" ");
557
- return /* @__PURE__ */ m("button", {
558
- type: "button",
559
- role: "switch",
560
- "aria-checked": d,
561
- "aria-label": a,
562
- "aria-busy": i || void 0,
563
- disabled: p,
564
- className: g,
565
- style: s,
566
- onClick: h,
567
- children: /* @__PURE__ */ m("span", {
568
- className: "tp-switch-thumb",
569
- "aria-hidden": "true",
570
- children: i && /* @__PURE__ */ m("span", { className: "tp-switch-spinner" })
571
- })
572
- });
573
- };
574
- // src/core/components/TPSlider.tsx
575
- function A(e, t, n) {
576
- return Number.isNaN(e) ? t : Math.min(n, Math.max(t, e));
577
- }
578
- function j(e, t, n) {
579
- return n <= t ? 0 : (A(e, t, n) - t) / (n - t) * 100;
580
- }
581
- var M = ({ value: e, defaultValue: t, min: n = 0, max: r = 100, step: i = 1, marks: a, showValue: o = !1, unit: s = "", disabled: c = !1, onChange: l, onAfterChange: u, ariaLabel: p, className: g = "", style: _ }) => {
582
- let v = e !== void 0, [y, b] = f(() => A(t ?? n, n, r)), x = A(v ? e : y, n, r), S = d(x);
583
- S.current = x;
584
- let C = j(x, n, r), w = (e, t = !1) => {
585
- let i = A(e, n, r);
586
- S.current = i, v || b(i), l?.(i), t && u?.(i);
587
- }, T = (e) => {
588
- c || w(Number(e.target.value), !1);
589
- }, E = () => {
590
- c || u?.(S.current);
591
- }, D = !!a?.some((e) => e.label !== void 0), O = [
592
- "tp-slider",
593
- c ? "tp-slider--disabled" : "",
594
- g
595
- ].filter(Boolean).join(" ");
596
- return /* @__PURE__ */ h("div", {
597
- className: O,
598
- style: _,
599
- children: [
600
- o && /* @__PURE__ */ m("div", {
601
- className: "tp-slider-header",
602
- children: /* @__PURE__ */ h("span", {
603
- className: "tp-slider-value",
604
- children: [x, s]
605
- })
606
- }),
607
- /* @__PURE__ */ h("div", {
608
- className: "tp-slider-control",
609
- children: [
610
- /* @__PURE__ */ h("div", {
611
- className: "tp-slider-track",
612
- "aria-hidden": "true",
613
- children: [/* @__PURE__ */ m("div", {
614
- className: "tp-slider-fill",
615
- style: { width: `${C}%` }
616
- }), a && a.length > 0 && /* @__PURE__ */ m("div", {
617
- className: "tp-slider-ticks",
618
- children: a.map((e) => {
619
- let t = j(e.value, n, r), i = e.value <= x;
620
- return /* @__PURE__ */ m("span", {
621
- className: `tp-slider-tick ${i ? "tp-slider-tick--active" : ""}`.trim(),
622
- style: { left: `${t}%` }
623
- }, e.value);
624
- })
625
- })]
626
- }),
627
- /* @__PURE__ */ m("div", {
628
- className: "tp-slider-thumb",
629
- style: { left: `${C}%` },
630
- "aria-hidden": "true"
631
- }),
632
- /* @__PURE__ */ m("input", {
633
- type: "range",
634
- className: "tp-slider-input",
635
- min: n,
636
- max: r,
637
- step: i,
638
- value: x,
639
- disabled: c,
640
- "aria-label": p,
641
- onChange: T,
642
- onPointerUp: E,
643
- onMouseUp: E,
644
- onTouchEnd: E,
645
- onKeyUp: E
646
- })
647
- ]
648
- }),
649
- D && a && /* @__PURE__ */ m("div", {
650
- className: "tp-slider-marks",
651
- children: a.map((e) => {
652
- if (e.label === void 0) return null;
653
- let t = j(e.value, n, r), i = e.value === x;
654
- return /* @__PURE__ */ m("div", {
655
- className: [
656
- "tp-slider-mark",
657
- t <= 2 ? "tp-slider-mark--start" : t >= 98 ? "tp-slider-mark--end" : "",
658
- i ? "tp-slider-mark--active" : ""
659
- ].filter(Boolean).join(" "),
660
- style: { left: `${t}%` },
661
- children: /* @__PURE__ */ m("button", {
662
- type: "button",
663
- className: "tp-slider-mark-btn",
664
- disabled: c,
665
- onClick: () => {
666
- c || w(e.value, !0);
667
- },
668
- children: e.label
669
- })
670
- }, e.value);
671
- })
672
- })
673
- ]
674
- });
675
- }, N = ({ title: e, extra: t, radius: n = "theme", padding: r = "none", divided: i = !1, className: a = "", style: o, children: s }) => {
676
- let c = [
677
- "tp-list-card",
678
- `tp-list-card--radius-${n}`,
679
- `tp-list-card--pad-${r}`,
680
- i ? "tp-list-card--divided" : "",
681
- a
682
- ].filter(Boolean).join(" ");
683
- return /* @__PURE__ */ h("div", {
684
- className: c,
685
- style: o,
686
- children: [(e !== void 0 || t !== void 0) && /* @__PURE__ */ h("div", {
687
- className: "tp-list-card-header",
688
- children: [/* @__PURE__ */ m("div", {
689
- className: "tp-list-card-title",
690
- children: e
691
- }), t !== void 0 && /* @__PURE__ */ m("div", {
692
- className: "tp-list-card-extra",
693
- children: t
694
- })]
695
- }), /* @__PURE__ */ m("div", {
696
- className: "tp-list-card-body",
697
- children: s
698
- })]
699
- });
700
- }, P = ({ checked: e, defaultChecked: t = !1, onChange: n, disabled: r = !1, loading: i = !1, ariaLabel: a, className: o = "", style: s, fallbackLabel: c }) => {
701
- let [l, u] = f(t), d = e !== void 0, p = d ? e : l, h = r || i, g = (e) => {
702
- if (e.stopPropagation(), h) return;
703
- let t = !p;
704
- d || u(t), n?.(t);
705
- }, _ = [
706
- "tp-switch",
707
- p ? "tp-switch--checked" : "",
708
- h ? "tp-switch--disabled" : "",
709
- i ? "tp-switch--loading" : "",
710
- o
711
- ].filter(Boolean).join(" ");
712
- return /* @__PURE__ */ m("button", {
713
- type: "button",
714
- role: "switch",
715
- "aria-checked": p,
716
- "aria-label": a ?? c ?? "Toggle",
717
- disabled: h,
718
- className: _,
719
- style: s,
720
- onClick: g,
721
- children: /* @__PURE__ */ m("span", {
722
- className: "tp-switch-thumb",
723
- children: i ? /* @__PURE__ */ m("span", {
724
- className: "tp-switch-spinner",
725
- "aria-hidden": "true"
726
- }) : null
727
- })
728
- });
729
- }, F = ({ title: e, subtitle: t, description: n, value: r, leading: i, trailing: a, badge: o, arrow: s = !1, checked: c, switchProps: l, danger: u = !1, disabled: d = !1, onClick: f, className: p = "", style: g }) => {
730
- let _ = !!f && !d, v = r != null || o != null || a != null || !!c || !!l || s, y = () => {
731
- !d && f && f();
732
- }, b = (e) => {
733
- _ && e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), f?.());
734
- }, x = [
735
- "tp-list-item",
736
- _ ? "tp-list-item--clickable" : "",
737
- u ? "tp-list-item--danger" : "",
738
- d ? "tp-list-item--disabled" : "",
739
- p
740
- ].filter(Boolean).join(" ");
741
- return /* @__PURE__ */ h("div", {
742
- className: x,
743
- style: g,
744
- role: f ? "button" : void 0,
745
- tabIndex: _ ? 0 : void 0,
746
- "aria-disabled": d || void 0,
747
- "data-checked": c === void 0 ? void 0 : String(!!c),
748
- onClick: f ? y : void 0,
749
- onKeyDown: f ? b : void 0,
750
- children: [
751
- i != null && /* @__PURE__ */ m("div", {
752
- className: "tp-list-item-leading",
753
- children: i
754
- }),
755
- /* @__PURE__ */ h("div", {
756
- className: "tp-list-item-content",
757
- children: [
758
- /* @__PURE__ */ m("div", {
759
- className: "tp-list-item-title",
760
- children: e
761
- }),
762
- t != null && /* @__PURE__ */ m("div", {
763
- className: "tp-list-item-subtitle",
764
- children: t
765
- }),
766
- n != null && /* @__PURE__ */ m("div", {
767
- className: "tp-list-item-description",
768
- children: n
769
- })
770
- ]
771
- }),
772
- v && /* @__PURE__ */ h("div", {
773
- className: "tp-list-item-trailing-group",
774
- children: [
775
- r != null && /* @__PURE__ */ m("div", {
776
- className: "tp-list-item-value",
777
- children: r
778
- }),
779
- o != null && /* @__PURE__ */ m("span", {
780
- className: "tp-list-item-badge",
781
- children: o
782
- }),
783
- a != null && /* @__PURE__ */ m("div", {
784
- className: "tp-list-item-trailing",
785
- children: a
786
- }),
787
- c && /* @__PURE__ */ m("span", {
788
- className: "tp-list-item-check",
789
- "aria-hidden": "true",
790
- children: /* @__PURE__ */ m("svg", {
791
- width: "18",
792
- height: "18",
793
- viewBox: "0 0 18 18",
794
- fill: "none",
795
- children: /* @__PURE__ */ m("path", {
796
- d: "M4 9.2L7.4 12.6L14 5.5",
797
- stroke: "currentColor",
798
- strokeWidth: "2",
799
- strokeLinecap: "round",
800
- strokeLinejoin: "round"
801
- })
802
- })
803
- }),
804
- l && /* @__PURE__ */ m(P, {
805
- ...l,
806
- disabled: d || l.disabled,
807
- fallbackLabel: typeof e == "string" ? e : void 0
808
- }),
809
- s && /* @__PURE__ */ m("span", {
810
- className: "tp-list-item-arrow",
811
- "aria-hidden": "true",
812
- children: /* @__PURE__ */ m("svg", {
813
- width: "16",
814
- height: "16",
815
- viewBox: "0 0 16 16",
816
- fill: "none",
817
- children: /* @__PURE__ */ m("path", {
818
- d: "M6 3.5L10.5 8L6 12.5",
819
- stroke: "currentColor",
820
- strokeWidth: "1.75",
821
- strokeLinecap: "round",
822
- strokeLinejoin: "round"
823
- })
824
- })
825
- })
826
- ]
827
- })
828
- ]
829
- });
830
- }, I = ({ children: e, tone: t = "focus", align: n = "center", disabled: r = !1, onClick: i, className: a = "", style: o }) => {
831
- let s = [
832
- "tp-list-button",
833
- `tp-list-button--tone-${t}`,
834
- `tp-list-button--align-${n}`,
835
- r ? "tp-list-button--disabled" : "",
836
- a
837
- ].filter(Boolean).join(" ");
838
- return /* @__PURE__ */ m("button", {
839
- type: "button",
840
- className: s,
841
- style: o,
842
- disabled: r,
843
- onClick: r ? void 0 : i,
844
- children: e
845
- });
846
- }, L = ({ title: e, count: t, action: n, className: r = "", style: i }) => {
847
- let a = ["tp-section-header", r].filter(Boolean).join(" ");
848
- return /* @__PURE__ */ h("div", {
849
- className: a,
850
- style: i,
851
- children: [/* @__PURE__ */ h("div", {
852
- className: "tp-section-header-left",
853
- children: [/* @__PURE__ */ m("span", {
854
- className: "tp-section-header-title",
855
- children: e
856
- }), t != null && /* @__PURE__ */ h("span", {
857
- className: "tp-section-header-count",
858
- children: [
859
- " (",
860
- t,
861
- ")"
862
- ]
863
- })]
864
- }), n != null && /* @__PURE__ */ m("div", {
865
- className: "tp-section-header-action",
866
- children: n
867
- })]
868
- });
869
- }, R = ({ children: e, tone: t = "default", className: n = "", style: r }) => {
870
- let i = [
871
- "tp-section-note",
872
- `tp-section-note--${t}`,
873
- n
874
- ].filter(Boolean).join(" ");
875
- return /* @__PURE__ */ m("div", {
876
- className: i,
877
- style: r,
878
- children: e
879
- });
880
- }, z = {
881
- title1: "h1",
882
- title2: "h2",
883
- title3: "h3",
884
- title4: "h4",
885
- body: "span",
886
- subhead: "span",
887
- caption: "span",
888
- footnote: "span"
889
- }, B = ({ variant: e = "body", tone: t = "primary", as: n, weight: r, className: i = "", style: a, children: o }) => {
890
- let s = n ?? z[e], c = [
891
- "tp-text",
892
- `tp-text--${e}`,
893
- `tp-text--tone-${t}`,
894
- r ? `tp-text--weight-${r}` : "",
895
- i
896
- ].filter(Boolean).join(" ");
897
- return /* @__PURE__ */ m(s, {
898
- className: c,
899
- style: a,
900
- children: o
901
- });
902
- }, V = ({ children: e, tone: t, selected: n, size: r = "md", closable: i = !1, onClose: a, onClick: o, className: s = "", style: c }) => {
903
- let l = t ?? (n ? "focus" : "neutral"), u = n === !0 ? "tp-tag--selected" : n === !1 ? "tp-tag--unselected" : "", d = [
904
- "tp-tag",
905
- `tp-tag--${r}`,
906
- `tp-tag--tone-${l}`,
907
- u,
908
- o ? "tp-tag--clickable" : "",
909
- s
910
- ].filter(Boolean).join(" ");
911
- return o && !i ? /* @__PURE__ */ m("button", {
912
- type: "button",
913
- className: d,
914
- style: c,
915
- "aria-pressed": n === void 0 ? void 0 : n,
916
- onClick: o,
917
- children: /* @__PURE__ */ m("span", { children: e })
918
- }) : /* @__PURE__ */ h("span", {
919
- className: d,
920
- style: c,
921
- role: o ? "button" : void 0,
922
- tabIndex: o ? 0 : void 0,
923
- "aria-pressed": o && n !== void 0 ? n : void 0,
924
- onClick: o,
925
- onKeyDown: o ? (e) => {
926
- e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), o());
927
- } : void 0,
928
- children: [/* @__PURE__ */ m("span", { children: e }), i ? /* @__PURE__ */ m("button", {
929
- type: "button",
930
- className: "tp-tag-close",
931
- "aria-label": "Remove tag",
932
- onClick: (e) => {
933
- e.stopPropagation(), a?.();
934
- },
935
- children: /* @__PURE__ */ m("svg", {
936
- width: "10",
937
- height: "10",
938
- viewBox: "0 0 10 10",
939
- fill: "none",
940
- "aria-hidden": "true",
941
- children: /* @__PURE__ */ m("path", {
942
- d: "M2.2 2.2L7.8 7.8M7.8 2.2L2.2 7.8",
943
- stroke: "currentColor",
944
- strokeWidth: "1.5",
945
- strokeLinecap: "round"
946
- })
947
- })
948
- }) : null]
949
- });
950
- }, H = ({ count: e, dot: t = !1, tone: n = "alert", max: r = 99, showZero: i = !1, children: a, className: o = "", style: s }) => {
951
- let c = null, l = !1;
952
- t ? l = !0 : e != null && (typeof e == "number" ? (e > 0 || e === 0 && i) && (l = !0, c = e > r ? `${r}+` : String(e)) : e !== "" && (e !== "0" || i) && (l = !0, c = e));
953
- let u = l ? /* @__PURE__ */ m("span", {
954
- className: [
955
- "tp-badge",
956
- t ? "tp-badge--dot" : "",
957
- a ? "tp-badge--floating" : "",
958
- `tp-badge--tone-${n}`,
959
- a ? "" : o
960
- ].filter(Boolean).join(" "),
961
- style: a ? void 0 : s,
962
- children: t ? null : c
963
- }) : null;
964
- return a ? /* @__PURE__ */ h("span", {
965
- className: `tp-badge-wrapper ${o}`.trim(),
966
- style: s,
967
- children: [a, u]
968
- }) : u;
969
- }, U = ({ illustration: e, theme: n, icon: r, title: i, description: a, actionText: o, onAction: s, compact: c = !1, className: l = "", style: u }) => {
970
- let d = [
971
- "tp-empty-state",
972
- c ? "tp-empty-state--compact" : "",
973
- l
974
- ].filter(Boolean).join(" ");
975
- return /* @__PURE__ */ h("div", {
976
- className: d,
977
- style: u,
978
- children: [
979
- e ? /* @__PURE__ */ m("div", {
980
- className: "tp-empty-state-media",
981
- children: /* @__PURE__ */ m(t, {
982
- name: e,
983
- theme: n,
984
- width: c ? 180 : 240
985
- })
986
- }) : r ? /* @__PURE__ */ m("div", {
987
- className: "tp-empty-state-icon",
988
- children: r
989
- }) : null,
990
- /* @__PURE__ */ m("div", {
991
- className: "tp-empty-state-title",
992
- children: i
993
- }),
994
- a != null && /* @__PURE__ */ m("div", {
995
- className: "tp-empty-state-description",
996
- children: a
997
- }),
998
- o && /* @__PURE__ */ m("button", {
999
- type: "button",
1000
- className: "tp-empty-state-action",
1001
- onClick: s,
1002
- children: o
1003
- })
1004
- ]
1005
- });
1006
- }, W = ({ label: e, value: t, defaultValue: n = "", onChange: r, clearable: i = !1, password: a = !1, multiline: o = !1, rows: s = 3, error: c, helperText: u, prefix: p, suffix: g, containerClassName: _ = "", className: v = "", style: y, id: b, type: x = "text", disabled: S = !1, readOnly: C = !1, onFocus: w, onBlur: T, ...E }) => {
1007
- let D = l(), O = b ?? `tp-input-${D}`, k = `${O}-message`, A = d(null), j = d(null), [M, N] = f(n), [P, F] = f(!1), [I, L] = f(!1), R = t !== void 0, z = R ? t : M, B = !!(c || u), V = (e) => {
1008
- R || N(e), r?.(e);
1009
- }, H = () => {
1010
- V(""), o ? j.current?.focus() : A.current?.focus();
1011
- }, U = i && z.length > 0 && !S && !C, W = a && !o, G = a ? I ? "text" : "password" : x, K = [
1012
- "tp-input-box",
1013
- o ? "tp-input-box--multiline" : "",
1014
- P ? "tp-input-box--focused" : "",
1015
- c ? "tp-input-box--error" : "",
1016
- S ? "tp-input-box--disabled" : ""
1017
- ].filter(Boolean).join(" ");
1018
- return /* @__PURE__ */ h("div", {
1019
- className: `tp-input-field ${_}`.trim(),
1020
- children: [
1021
- e != null && /* @__PURE__ */ m("label", {
1022
- htmlFor: O,
1023
- className: "tp-input-label",
1024
- children: e
1025
- }),
1026
- /* @__PURE__ */ h("div", {
1027
- className: K,
1028
- children: [
1029
- p != null && /* @__PURE__ */ m("span", {
1030
- className: "tp-input-prefix",
1031
- children: p
1032
- }),
1033
- o ? /* @__PURE__ */ m("textarea", {
1034
- ref: j,
1035
- id: O,
1036
- name: E.name,
1037
- rows: s,
1038
- placeholder: E.placeholder,
1039
- maxLength: E.maxLength,
1040
- autoFocus: E.autoFocus,
1041
- autoComplete: E.autoComplete,
1042
- required: E.required,
1043
- disabled: S,
1044
- readOnly: C,
1045
- value: z,
1046
- "aria-label": E["aria-label"],
1047
- "aria-invalid": c ? !0 : void 0,
1048
- "aria-describedby": B ? k : E["aria-describedby"],
1049
- className: `tp-input-textarea ${v}`.trim(),
1050
- style: y,
1051
- onChange: (e) => V(e.target.value),
1052
- onFocus: (e) => {
1053
- F(!0), w?.(e);
1054
- },
1055
- onBlur: (e) => {
1056
- F(!1), T?.(e);
1057
- }
1058
- }) : /* @__PURE__ */ m("input", {
1059
- ...E,
1060
- ref: A,
1061
- id: O,
1062
- type: G,
1063
- disabled: S,
1064
- readOnly: C,
1065
- value: z,
1066
- "aria-invalid": c ? !0 : void 0,
1067
- "aria-describedby": B ? k : E["aria-describedby"],
1068
- className: `tp-input-control ${v}`.trim(),
1069
- style: y,
1070
- onChange: (e) => V(e.target.value),
1071
- onFocus: (e) => {
1072
- F(!0), w?.(e);
1073
- },
1074
- onBlur: (e) => {
1075
- F(!1), T?.(e);
1076
- }
1077
- }),
1078
- U && /* @__PURE__ */ m("button", {
1079
- type: "button",
1080
- className: "tp-input-action-btn",
1081
- "aria-label": "Clear input",
1082
- onClick: H,
1083
- children: /* @__PURE__ */ h("svg", {
1084
- width: "14",
1085
- height: "14",
1086
- viewBox: "0 0 14 14",
1087
- fill: "none",
1088
- "aria-hidden": "true",
1089
- children: [/* @__PURE__ */ m("circle", {
1090
- cx: "7",
1091
- cy: "7",
1092
- r: "6",
1093
- fill: "currentColor",
1094
- fillOpacity: "0.2"
1095
- }), /* @__PURE__ */ m("path", {
1096
- d: "M4.8 4.8L9.2 9.2M9.2 4.8L4.8 9.2",
1097
- stroke: "currentColor",
1098
- strokeWidth: "1.4",
1099
- strokeLinecap: "round"
1100
- })]
1101
- })
1102
- }),
1103
- W && /* @__PURE__ */ m("button", {
1104
- type: "button",
1105
- className: "tp-input-action-btn",
1106
- "aria-label": I ? "Hide password" : "Show password",
1107
- onClick: () => L((e) => !e),
1108
- children: I ? /* @__PURE__ */ h("svg", {
1109
- width: "18",
1110
- height: "18",
1111
- viewBox: "0 0 20 20",
1112
- fill: "none",
1113
- "aria-hidden": "true",
1114
- children: [/* @__PURE__ */ m("path", {
1115
- d: "M2.5 10C4.2 6.8 6.9 5 10 5C13.1 5 15.8 6.8 17.5 10C15.8 13.2 13.1 15 10 15C6.9 15 4.2 13.2 2.5 10Z",
1116
- stroke: "currentColor",
1117
- strokeWidth: "1.5"
1118
- }), /* @__PURE__ */ m("circle", {
1119
- cx: "10",
1120
- cy: "10",
1121
- r: "2.5",
1122
- stroke: "currentColor",
1123
- strokeWidth: "1.5"
1124
- })]
1125
- }) : /* @__PURE__ */ m("svg", {
1126
- width: "18",
1127
- height: "18",
1128
- viewBox: "0 0 20 20",
1129
- fill: "none",
1130
- "aria-hidden": "true",
1131
- children: /* @__PURE__ */ m("path", {
1132
- d: "M3 3L17 17M8.3 8.4A2.5 2.5 0 0 0 11.6 11.7M5.7 6.3C4.3 7.3 3.2 8.5 2.5 10C4.2 13.2 6.9 15 10 15C11.4 15 12.7 14.6 13.8 13.9M9.5 5C9.7 5 9.8 5 10 5C13.1 5 15.8 6.8 17.5 10C16.9 11.1 16.2 12.1 15.3 12.9",
1133
- stroke: "currentColor",
1134
- strokeWidth: "1.5",
1135
- strokeLinecap: "round"
1136
- })
1137
- })
1138
- }),
1139
- g != null && /* @__PURE__ */ m("span", {
1140
- className: "tp-input-suffix",
1141
- children: g
1142
- })
1143
- ]
1144
- }),
1145
- c ? /* @__PURE__ */ m("div", {
1146
- id: k,
1147
- className: "tp-input-error",
1148
- role: "alert",
1149
- children: c
1150
- }) : u ? /* @__PURE__ */ m("div", {
1151
- id: k,
1152
- className: "tp-input-helper",
1153
- children: u
1154
- }) : null
1155
- ]
1156
- });
1157
- }, G = ({ value: e, defaultValue: t = "", placeholder: n = "Search", onChange: r, onSearch: i, onCancel: a, showCancel: o = !1, autoFocus: s = !1, className: c = "", style: l }) => {
1158
- let u = d(null), [p, g] = f(t), _ = e !== void 0, v = _ ? e : p, y = (e) => {
1159
- _ || g(e), r?.(e);
1160
- };
1161
- return /* @__PURE__ */ h("div", {
1162
- className: `tp-search-bar ${c}`.trim(),
1163
- style: l,
1164
- children: [/* @__PURE__ */ h("div", {
1165
- className: "tp-search-field",
1166
- children: [
1167
- /* @__PURE__ */ m("span", {
1168
- className: "tp-search-icon",
1169
- "aria-hidden": "true",
1170
- children: /* @__PURE__ */ h("svg", {
1171
- width: "16",
1172
- height: "16",
1173
- viewBox: "0 0 16 16",
1174
- fill: "none",
1175
- children: [/* @__PURE__ */ m("circle", {
1176
- cx: "7",
1177
- cy: "7",
1178
- r: "4.8",
1179
- stroke: "currentColor",
1180
- strokeWidth: "1.6"
1181
- }), /* @__PURE__ */ m("path", {
1182
- d: "M10.6 10.6L14 14",
1183
- stroke: "currentColor",
1184
- strokeWidth: "1.6",
1185
- strokeLinecap: "round"
1186
- })]
1187
- })
1188
- }),
1189
- /* @__PURE__ */ m("input", {
1190
- ref: u,
1191
- type: "search",
1192
- className: "tp-search-input",
1193
- value: v,
1194
- placeholder: n,
1195
- "aria-label": n,
1196
- autoFocus: s,
1197
- onChange: (e) => y(e.target.value),
1198
- onKeyDown: (e) => {
1199
- e.key === "Enter" && (e.preventDefault(), i?.(v));
1200
- }
1201
- }),
1202
- v.length > 0 && /* @__PURE__ */ m("button", {
1203
- type: "button",
1204
- className: "tp-search-clear",
1205
- "aria-label": "Clear search",
1206
- onClick: () => {
1207
- y(""), u.current?.focus();
1208
- },
1209
- children: /* @__PURE__ */ m("svg", {
1210
- width: "10",
1211
- height: "10",
1212
- viewBox: "0 0 10 10",
1213
- fill: "none",
1214
- "aria-hidden": "true",
1215
- children: /* @__PURE__ */ m("path", {
1216
- d: "M2.5 2.5L7.5 7.5M7.5 2.5L2.5 7.5",
1217
- stroke: "currentColor",
1218
- strokeWidth: "1.5",
1219
- strokeLinecap: "round"
1220
- })
1221
- })
1222
- })
1223
- ]
1224
- }), o && /* @__PURE__ */ m("button", {
1225
- type: "button",
1226
- className: "tp-search-cancel",
1227
- onClick: a,
1228
- children: "Cancel"
1229
- })]
1230
- });
1231
- }, K = ({ column: e, itemHeight: t, visibleItems: n, onChange: r }) => {
1232
- let i = d(null), a = Math.max(0, e.options.findIndex((t) => t.value === e.value)), o = Math.floor(n / 2) * t;
1233
- c(() => {
1234
- let e = i.current;
1235
- if (!e) return;
1236
- let n = a * t;
1237
- typeof e.scrollTo == "function" ? e.scrollTo({
1238
- top: n,
1239
- behavior: "smooth"
1240
- }) : e.scrollTop = n;
1241
- }, [a, t]);
1242
- let s = (t) => {
1243
- let n = Math.min(e.options.length - 1, Math.max(0, a + t)), i = e.options[n];
1244
- i && i.value !== e.value && r(e.key, i.value);
1245
- };
1246
- return /* @__PURE__ */ h("div", {
1247
- className: "tp-wheel-column-wrap",
1248
- children: [
1249
- /* @__PURE__ */ m("button", {
1250
- type: "button",
1251
- className: "tp-wheel-step tp-wheel-step--up",
1252
- "aria-label": `Previous ${e.key}`,
1253
- disabled: a <= 0,
1254
- onClick: () => s(-1),
1255
- children: /* @__PURE__ */ m("svg", {
1256
- width: "12",
1257
- height: "12",
1258
- viewBox: "0 0 12 12",
1259
- fill: "none",
1260
- "aria-hidden": "true",
1261
- children: /* @__PURE__ */ m("path", {
1262
- d: "M3 7.5L6 4.5L9 7.5",
1263
- stroke: "currentColor",
1264
- strokeWidth: "1.5",
1265
- strokeLinecap: "round",
1266
- strokeLinejoin: "round"
1267
- })
1268
- })
1269
- }),
1270
- /* @__PURE__ */ h("div", {
1271
- ref: i,
1272
- role: "listbox",
1273
- "aria-label": e.key,
1274
- tabIndex: 0,
1275
- className: "tp-wheel-column",
1276
- style: { height: n * t },
1277
- onKeyDown: (t) => {
1278
- t.key === "ArrowUp" ? (t.preventDefault(), s(-1)) : t.key === "ArrowDown" ? (t.preventDefault(), s(1)) : t.key === "Home" && e.options.length > 0 ? (t.preventDefault(), r(e.key, e.options[0].value)) : t.key === "End" && e.options.length > 0 && (t.preventDefault(), r(e.key, e.options[e.options.length - 1].value));
1279
- },
1280
- children: [
1281
- /* @__PURE__ */ m("div", {
1282
- className: "tp-wheel-spacer",
1283
- style: { height: o }
1284
- }),
1285
- e.options.map((n) => {
1286
- let i = n.value === e.value;
1287
- return /* @__PURE__ */ m("button", {
1288
- type: "button",
1289
- role: "option",
1290
- "aria-selected": i,
1291
- className: `tp-wheel-item ${i ? "tp-wheel-item--selected" : ""}`.trim(),
1292
- style: { height: t },
1293
- onClick: () => {
1294
- n.value !== e.value && r(e.key, n.value);
1295
- },
1296
- children: n.label
1297
- }, n.value);
1298
- }),
1299
- /* @__PURE__ */ m("div", {
1300
- className: "tp-wheel-spacer",
1301
- style: { height: o }
1302
- })
1303
- ]
1304
- }),
1305
- /* @__PURE__ */ m("button", {
1306
- type: "button",
1307
- className: "tp-wheel-step tp-wheel-step--down",
1308
- "aria-label": `Next ${e.key}`,
1309
- disabled: a >= e.options.length - 1,
1310
- onClick: () => s(1),
1311
- children: /* @__PURE__ */ m("svg", {
1312
- width: "12",
1313
- height: "12",
1314
- viewBox: "0 0 12 12",
1315
- fill: "none",
1316
- "aria-hidden": "true",
1317
- children: /* @__PURE__ */ m("path", {
1318
- d: "M3 4.5L6 7.5L9 4.5",
1319
- stroke: "currentColor",
1320
- strokeWidth: "1.5",
1321
- strokeLinecap: "round",
1322
- strokeLinejoin: "round"
1323
- })
1324
- })
1325
- })
1326
- ]
1327
- });
1328
- }, q = ({ columns: e, onChange: t, itemHeight: n = 40, visibleItems: r = 5, className: i = "", style: a }) => {
1329
- let o = Math.floor(r / 2) * n;
1330
- return /* @__PURE__ */ h("div", {
1331
- className: `tp-wheel-picker ${i}`.trim(),
1332
- style: {
1333
- height: r * n,
1334
- ...a
1335
- },
1336
- children: [/* @__PURE__ */ m("div", {
1337
- className: "tp-wheel-highlight",
1338
- style: {
1339
- top: o,
1340
- height: n
1341
- },
1342
- "aria-hidden": "true"
1343
- }), /* @__PURE__ */ m("div", {
1344
- className: "tp-wheel-columns",
1345
- children: e.map((e) => /* @__PURE__ */ m(K, {
1346
- column: e,
1347
- itemHeight: n,
1348
- visibleItems: r,
1349
- onChange: t
1350
- }, e.key))
1351
- })]
1352
- });
1353
- };
1354
- // src/core/components/TPDatePicker.tsx
1355
- function J(e, t) {
1356
- return new Date(e, t, 0).getDate();
1357
- }
1358
- function Y(e, t, n) {
1359
- return Math.min(n, Math.max(t, e));
1360
- }
1361
- var ee = ({ value: e, defaultValue: t, minYear: n = 1990, maxYear: r = 2040, onChange: i, onConfirm: a, onCancel: o, title: s, className: c = "", style: l }) => {
1362
- let [d, p] = f(() => t ?? new Date(2026, 0, 1)), g = e !== void 0, _ = g ? e : d, v = Y(_.getFullYear(), n, r), y = _.getMonth() + 1, b = J(v, y), x = Math.min(b, _.getDate()), S = u(() => {
1363
- let e = [];
1364
- for (let t = n; t <= r; t++) e.push({
1365
- value: String(t),
1366
- label: String(t)
1367
- });
1368
- let t = Array.from({ length: 12 }, (e, t) => {
1369
- let n = t + 1;
1370
- return {
1371
- value: String(n),
1372
- label: String(n).padStart(2, "0")
1373
- };
1374
- }), i = Array.from({ length: b }, (e, t) => {
1375
- let n = t + 1;
1376
- return {
1377
- value: String(n),
1378
- label: String(n).padStart(2, "0")
1379
- };
1380
- });
1381
- return [
1382
- {
1383
- key: "year",
1384
- options: e,
1385
- value: String(v)
1386
- },
1387
- {
1388
- key: "month",
1389
- options: t,
1390
- value: String(y)
1391
- },
1392
- {
1393
- key: "day",
1394
- options: i,
1395
- value: String(x)
1396
- }
1397
- ];
1398
- }, [
1399
- n,
1400
- r,
1401
- b,
1402
- v,
1403
- y,
1404
- x
1405
- ]), C = (e, t) => {
1406
- let a = Number(t);
1407
- if (Number.isNaN(a)) return;
1408
- let o = v, s = y, c = x;
1409
- e === "year" && (o = Y(a, n, r)), e === "month" && (s = a), e === "day" && (c = a);
1410
- let l = Math.min(c, J(o, s)), u = new Date(o, s - 1, l);
1411
- g || p(u), i?.(u);
1412
- }, w = s !== void 0 || o !== void 0 || a !== void 0;
1413
- return /* @__PURE__ */ h("div", {
1414
- className: `tp-date-picker ${c}`.trim(),
1415
- style: l,
1416
- children: [w && /* @__PURE__ */ h("div", {
1417
- className: "tp-date-picker-header",
1418
- children: [
1419
- o ? /* @__PURE__ */ m("button", {
1420
- type: "button",
1421
- className: "tp-date-picker-btn",
1422
- onClick: o,
1423
- children: "Cancel"
1424
- }) : /* @__PURE__ */ m("span", {}),
1425
- s !== void 0 && /* @__PURE__ */ m("div", {
1426
- className: "tp-date-picker-title",
1427
- children: s
1428
- }),
1429
- a ? /* @__PURE__ */ m("button", {
1430
- type: "button",
1431
- className: "tp-date-picker-btn tp-date-picker-btn--confirm",
1432
- onClick: () => a(new Date(v, y - 1, x)),
1433
- children: "Confirm"
1434
- }) : /* @__PURE__ */ m("span", {})
1435
- ]
1436
- }), /* @__PURE__ */ m(q, {
1437
- columns: S,
1438
- onChange: C
1439
- })]
1440
- });
1441
- };
1442
- // src/core/components/TPTimePicker.tsx
1443
- function X(e, t) {
1444
- let n = e.hour, r = e.period;
1445
- return t ? (r ||= n >= 12 ? "PM" : "AM", n === 0 ? n = 12 : n > 12 && (n -= 12), {
1446
- hour: Math.min(12, Math.max(1, n)),
1447
- minute: Math.min(59, Math.max(0, e.minute)),
1448
- period: r
1449
- }) : {
1450
- hour: Math.min(23, Math.max(0, n)),
1451
- minute: Math.min(59, Math.max(0, e.minute))
1452
- };
1453
- }
1454
- var te = ({ value: e, use12Hour: t = !1, minuteStep: n = 1, onChange: r, className: i = "", style: a }) => {
1455
- let [o, s] = f(() => X({
1456
- hour: 9,
1457
- minute: 0,
1458
- period: "AM"
1459
- }, t)), c = e !== void 0, l = X(c ? e : o, t), d = Math.max(1, n), p = u(() => {
1460
- let e = [];
1461
- for (let t = 0; t < 60; t += d) e.push({
1462
- value: String(t),
1463
- label: String(t).padStart(2, "0")
1464
- });
1465
- return e;
1466
- }, [d]), h = u(() => {
1467
- let e = Number(p[0]?.value ?? 0), t = Math.abs(l.minute - e);
1468
- for (let n of p) {
1469
- let r = Number(n.value), i = Math.abs(l.minute - r);
1470
- i < t && (e = r, t = i);
1471
- }
1472
- return e;
1473
- }, [l.minute, p]), g = u(() => {
1474
- let e = [{
1475
- key: "hour",
1476
- options: t ? Array.from({ length: 12 }, (e, t) => {
1477
- let n = t + 1;
1478
- return {
1479
- value: String(n),
1480
- label: String(n).padStart(2, "0")
1481
- };
1482
- }) : Array.from({ length: 24 }, (e, t) => ({
1483
- value: String(t),
1484
- label: String(t).padStart(2, "0")
1485
- })),
1486
- value: String(l.hour)
1487
- }, {
1488
- key: "minute",
1489
- options: p,
1490
- value: String(h)
1491
- }];
1492
- return t && e.push({
1493
- key: "period",
1494
- options: [{
1495
- value: "AM",
1496
- label: "AM"
1497
- }, {
1498
- value: "PM",
1499
- label: "PM"
1500
- }],
1501
- value: l.period ?? "AM"
1502
- }), e;
1503
- }, [
1504
- t,
1505
- l.hour,
1506
- l.period,
1507
- p,
1508
- h
1509
- ]);
1510
- return /* @__PURE__ */ m("div", {
1511
- className: `tp-time-picker ${i}`.trim(),
1512
- style: a,
1513
- children: /* @__PURE__ */ m(q, {
1514
- columns: g,
1515
- onChange: (e, n) => {
1516
- let i = {
1517
- hour: l.hour,
1518
- minute: h,
1519
- ...t ? { period: l.period ?? "AM" } : {}
1520
- };
1521
- e === "hour" ? i.hour = Number(n) : e === "minute" ? i.minute = Number(n) : e === "period" && (n === "AM" || n === "PM") && (i.period = n), c || s(i), r?.(i);
1522
- }
1523
- })
1524
- });
1525
- }, Z = [
1526
- {
1527
- key: "sun",
1528
- en: "S",
1529
- zh: "日",
1530
- enTitle: "Sunday",
1531
- zhTitle: "周日"
1532
- },
1533
- {
1534
- key: "mon",
1535
- en: "M",
1536
- zh: "一",
1537
- enTitle: "Monday",
1538
- zhTitle: "周一"
1539
- },
1540
- {
1541
- key: "tue",
1542
- en: "T",
1543
- zh: "二",
1544
- enTitle: "Tuesday",
1545
- zhTitle: "周二"
1546
- },
1547
- {
1548
- key: "wed",
1549
- en: "W",
1550
- zh: "三",
1551
- enTitle: "Wednesday",
1552
- zhTitle: "周三"
1553
- },
1554
- {
1555
- key: "thu",
1556
- en: "T",
1557
- zh: "四",
1558
- enTitle: "Thursday",
1559
- zhTitle: "周四"
1560
- },
1561
- {
1562
- key: "fri",
1563
- en: "F",
1564
- zh: "五",
1565
- enTitle: "Friday",
1566
- zhTitle: "周五"
1567
- },
1568
- {
1569
- key: "sat",
1570
- en: "S",
1571
- zh: "六",
1572
- enTitle: "Saturday",
1573
- zhTitle: "周六"
1574
- }
1575
- ], ne = ({ value: e, defaultValue: t = [], onChange: n, disabled: r = !1, locale: i = "en", className: a = "", style: o }) => {
1576
- let [s, c] = f(t), l = e !== void 0, u = l ? e : s, d = (e) => {
1577
- if (r) return;
1578
- let t = new Set(u);
1579
- t.has(e) ? t.delete(e) : t.add(e);
1580
- let i = Z.map((e) => e.key).filter((e) => t.has(e));
1581
- l || c(i), n?.(i);
1582
- }, p = [
1583
- "tp-day-switcher",
1584
- r ? "tp-day-switcher--disabled" : "",
1585
- a
1586
- ].filter(Boolean).join(" ");
1587
- return /* @__PURE__ */ m("div", {
1588
- className: p,
1589
- style: o,
1590
- role: "group",
1591
- "aria-label": "Days of week",
1592
- children: Z.map((e) => {
1593
- let t = u.includes(e.key), n = i === "zh" ? e.zh : e.en, a = i === "zh" ? e.zhTitle : e.enTitle;
1594
- return /* @__PURE__ */ m("button", {
1595
- type: "button",
1596
- "data-day": e.key,
1597
- title: a,
1598
- disabled: r,
1599
- "aria-pressed": t,
1600
- className: `tp-day-switcher-btn ${t ? "tp-day-switcher-btn--selected" : ""}`.trim(),
1601
- onClick: () => d(e.key),
1602
- children: n
1603
- }, e.key);
1604
- })
1605
- });
1606
- }, re = [
1607
- "1",
1608
- "2",
1609
- "3",
1610
- "4",
1611
- "5",
1612
- "6",
1613
- "7",
1614
- "8",
1615
- "9"
1616
- ], ie = [
1617
- "A",
1618
- "B",
1619
- "C",
1620
- "D",
1621
- "E",
1622
- "F"
1623
- ], ae = ({ mode: e = "numeric", onKeyPress: t, onBackspace: n, onDone: r, doneLabel: i = "Done", showDot: a = !1, showDash: o, className: s = "", style: c }) => {
1624
- let l = o ?? e === "mac-hex", u = a && l, d = u ? null : a ? "." : l ? "-" : null, f = [
1625
- "tp-keyboard",
1626
- `tp-keyboard--${e}`,
1627
- s
1628
- ].filter(Boolean).join(" ");
1629
- return /* @__PURE__ */ h("div", {
1630
- className: f,
1631
- style: c,
1632
- role: "group",
1633
- "aria-label": "Keypad",
1634
- children: [
1635
- e === "mac-hex" && /* @__PURE__ */ m("div", {
1636
- className: "tp-keyboard-hex-row",
1637
- children: ie.map((e) => /* @__PURE__ */ m("button", {
1638
- type: "button",
1639
- className: "tp-keyboard-key tp-keyboard-key--hex",
1640
- onClick: () => t?.(e),
1641
- children: e
1642
- }, e))
1643
- }),
1644
- u && /* @__PURE__ */ h("div", {
1645
- className: "tp-keyboard-aux-row",
1646
- children: [/* @__PURE__ */ m("button", {
1647
- type: "button",
1648
- className: "tp-keyboard-key tp-keyboard-key--action",
1649
- onClick: () => t?.("."),
1650
- children: "."
1651
- }), /* @__PURE__ */ m("button", {
1652
- type: "button",
1653
- className: "tp-keyboard-key tp-keyboard-key--action",
1654
- onClick: () => t?.("-"),
1655
- children: "-"
1656
- })]
1657
- }),
1658
- /* @__PURE__ */ h("div", {
1659
- className: "tp-keyboard-grid",
1660
- children: [
1661
- re.map((e) => /* @__PURE__ */ m("button", {
1662
- type: "button",
1663
- className: "tp-keyboard-key",
1664
- onClick: () => t?.(e),
1665
- children: e
1666
- }, e)),
1667
- d ? /* @__PURE__ */ m("button", {
1668
- type: "button",
1669
- className: "tp-keyboard-key tp-keyboard-key--action",
1670
- onClick: () => t?.(d),
1671
- children: d
1672
- }) : /* @__PURE__ */ m("div", {
1673
- className: "tp-keyboard-spacer",
1674
- "aria-hidden": "true"
1675
- }),
1676
- /* @__PURE__ */ m("button", {
1677
- type: "button",
1678
- className: "tp-keyboard-key",
1679
- onClick: () => t?.("0"),
1680
- children: "0"
1681
- }),
1682
- /* @__PURE__ */ m("button", {
1683
- type: "button",
1684
- className: "tp-keyboard-key tp-keyboard-key--action",
1685
- "aria-label": "Backspace",
1686
- onClick: n,
1687
- children: /* @__PURE__ */ h("svg", {
1688
- width: "22",
1689
- height: "18",
1690
- viewBox: "0 0 22 18",
1691
- fill: "none",
1692
- "aria-hidden": "true",
1693
- children: [/* @__PURE__ */ m("path", {
1694
- d: "M8.2 2H19C19.8 2 20.5 2.7 20.5 3.5V14.5C20.5 15.3 19.8 16 19 16H8.2C7.7 16 7.2 15.8 6.9 15.4L2.1 9.6C1.8 9.3 1.8 8.7 2.1 8.4L6.9 2.6C7.2 2.2 7.7 2 8.2 2Z",
1695
- stroke: "currentColor",
1696
- strokeWidth: "1.5",
1697
- strokeLinejoin: "round"
1698
- }), /* @__PURE__ */ m("path", {
1699
- d: "M11 6.3L16 11.3M16 6.3L11 11.3",
1700
- stroke: "currentColor",
1701
- strokeWidth: "1.5",
1702
- strokeLinecap: "round"
1703
- })]
1704
- })
1705
- })
1706
- ]
1707
- }),
1708
- /* @__PURE__ */ m("button", {
1709
- type: "button",
1710
- className: "tp-keyboard-key tp-keyboard-key--done",
1711
- onClick: r,
1712
- children: i
1713
- })
1714
- ]
1715
- });
1716
- }, oe = ({ open: t, title: n, message: r, actions: i, os: a, inputPlaceholder: o, defaultInputValue: s = "", onClose: u, children: d }) => {
1717
- let p = e(), g = a ?? p.os, _ = l(), v = l(), [y, b] = f(s);
1718
- if (c(() => {
1719
- t && b(s);
1720
- }, [t, s]), c(() => {
1721
- if (!t || !u) return;
1722
- let e = (e) => {
1723
- e.key === "Escape" && u();
1724
- };
1725
- return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
1726
- }, [t, u]), !t) return null;
1727
- let x = o !== void 0, S = (e) => {
1728
- x ? e.onClick?.(y) : e.onClick?.(), u?.();
1729
- }, C = g === "ios" ? i.length === 2 ? "tp-alert-actions--row" : "tp-alert-actions--col" : "";
1730
- return /* @__PURE__ */ m("div", {
1731
- className: "tp-overlay tp-alert-backdrop",
1732
- "data-tp-os": g,
1733
- onClick: () => u?.(),
1734
- children: /* @__PURE__ */ h("div", {
1735
- role: "alertdialog",
1736
- "aria-modal": "true",
1737
- "aria-labelledby": n ? _ : void 0,
1738
- "aria-describedby": r ? v : void 0,
1739
- "data-os": g,
1740
- className: `tp-alert tp-alert--${g}`,
1741
- onClick: (e) => e.stopPropagation(),
1742
- children: [/* @__PURE__ */ h("div", {
1743
- className: "tp-alert-content",
1744
- children: [
1745
- n !== void 0 && /* @__PURE__ */ m("div", {
1746
- id: _,
1747
- className: "tp-alert-title",
1748
- children: n
1749
- }),
1750
- r !== void 0 && /* @__PURE__ */ m("div", {
1751
- id: v,
1752
- className: "tp-alert-message",
1753
- children: r
1754
- }),
1755
- d !== void 0 && /* @__PURE__ */ m("div", {
1756
- className: "tp-alert-body",
1757
- children: d
1758
- }),
1759
- x && /* @__PURE__ */ m("div", {
1760
- className: "tp-alert-input-wrap",
1761
- children: /* @__PURE__ */ m("input", {
1762
- type: "text",
1763
- className: "tp-alert-input",
1764
- placeholder: o,
1765
- value: y,
1766
- onChange: (e) => b(e.target.value),
1767
- autoFocus: !0
1768
- })
1769
- })
1770
- ]
1771
- }), /* @__PURE__ */ m("div", {
1772
- className: `tp-alert-actions tp-alert-actions--${g} ${C}`.trim(),
1773
- children: i.map((e, t) => {
1774
- let n = e.role ?? "default";
1775
- return /* @__PURE__ */ m("button", {
1776
- type: "button",
1777
- "data-role": n,
1778
- className: `tp-alert-action tp-alert-action--${n}`,
1779
- onClick: () => S(e),
1780
- children: e.label
1781
- }, `${e.label}-${t}`);
1782
- })
1783
- })]
1784
- })
1785
- });
1786
- }, se = () => /* @__PURE__ */ m("svg", {
1787
- width: "18",
1788
- height: "18",
1789
- viewBox: "0 0 24 24",
1790
- fill: "none",
1791
- "aria-hidden": "true",
1792
- children: /* @__PURE__ */ m("path", {
1793
- d: "M5 12.5L9.8 17L19 7.5",
1794
- stroke: "currentColor",
1795
- strokeWidth: "2.2",
1796
- strokeLinecap: "round",
1797
- strokeLinejoin: "round"
1798
- })
1799
- }), ce = ({ open: t, title: n, message: r, options: i, cancelText: a = "Cancel", os: o, onSelect: s, onClose: u }) => {
1800
- let d = e(), f = o ?? d.os, p = l();
1801
- if (c(() => {
1802
- if (!t) return;
1803
- let e = (e) => {
1804
- e.key === "Escape" && u();
1805
- };
1806
- return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
1807
- }, [t, u]), !t) return null;
1808
- let g = i.some((e) => e.icon !== void 0 || e.description !== void 0 || e.selected !== void 0), _ = (e) => {
1809
- e.disabled || (s(e), u());
1810
- };
1811
- return /* @__PURE__ */ m("div", {
1812
- className: "tp-overlay tp-actionsheet-backdrop",
1813
- "data-tp-os": f,
1814
- onClick: u,
1815
- children: /* @__PURE__ */ h("div", {
1816
- role: "dialog",
1817
- "aria-modal": "true",
1818
- "aria-labelledby": n ? p : void 0,
1819
- "data-os": f,
1820
- className: `tp-actionsheet tp-actionsheet--${f}`,
1821
- onClick: (e) => e.stopPropagation(),
1822
- children: [/* @__PURE__ */ h("div", {
1823
- className: "tp-actionsheet-group",
1824
- children: [(n !== void 0 || r !== void 0) && /* @__PURE__ */ h("div", {
1825
- className: "tp-actionsheet-header",
1826
- children: [n !== void 0 && /* @__PURE__ */ m("div", {
1827
- id: p,
1828
- className: "tp-actionsheet-title",
1829
- children: n
1830
- }), r !== void 0 && /* @__PURE__ */ m("div", {
1831
- className: "tp-actionsheet-message",
1832
- children: r
1833
- })]
1834
- }), /* @__PURE__ */ m("div", {
1835
- className: "tp-actionsheet-options",
1836
- children: i.map((e) => {
1837
- let t = [
1838
- "tp-actionsheet-option",
1839
- g ? "tp-actionsheet-option--rich" : "",
1840
- e.destructive ? "tp-actionsheet-option--destructive" : "",
1841
- e.disabled ? "tp-actionsheet-option--disabled" : "",
1842
- e.selected ? "tp-actionsheet-option--selected" : ""
1843
- ].filter(Boolean).join(" ");
1844
- return /* @__PURE__ */ h("button", {
1845
- type: "button",
1846
- className: t,
1847
- disabled: e.disabled,
1848
- "aria-disabled": e.disabled || void 0,
1849
- onClick: () => _(e),
1850
- children: [
1851
- e.icon !== void 0 && /* @__PURE__ */ m("span", {
1852
- className: "tp-actionsheet-option-icon",
1853
- children: e.icon
1854
- }),
1855
- /* @__PURE__ */ h("span", {
1856
- className: "tp-actionsheet-option-text",
1857
- children: [/* @__PURE__ */ m("span", {
1858
- className: "tp-actionsheet-option-label",
1859
- children: e.label
1860
- }), e.description !== void 0 && /* @__PURE__ */ m("span", {
1861
- className: "tp-actionsheet-option-desc",
1862
- children: e.description
1863
- })]
1864
- }),
1865
- e.selected && /* @__PURE__ */ m("span", {
1866
- className: "tp-actionsheet-option-check",
1867
- children: /* @__PURE__ */ m(se, {})
1868
- })
1869
- ]
1870
- }, e.key);
1871
- })
1872
- })]
1873
- }), a !== "" && (f === "ios" ? /* @__PURE__ */ m("div", {
1874
- className: "tp-actionsheet-cancel-card",
1875
- children: /* @__PURE__ */ m("button", {
1876
- type: "button",
1877
- className: "tp-actionsheet-cancel",
1878
- onClick: u,
1879
- children: a
1880
- })
1881
- }) : /* @__PURE__ */ m("div", {
1882
- className: "tp-actionsheet-cancel-row",
1883
- children: /* @__PURE__ */ m("button", {
1884
- type: "button",
1885
- className: "tp-actionsheet-cancel",
1886
- onClick: u,
1887
- children: a
1888
- })
1889
- }))]
1890
- })
1891
- });
1892
- }, le = () => /* @__PURE__ */ m("svg", {
1893
- width: "14",
1894
- height: "14",
1895
- viewBox: "0 0 16 16",
1896
- fill: "none",
1897
- "aria-hidden": "true",
1898
- children: /* @__PURE__ */ m("path", {
1899
- d: "M4 4L12 12M12 4L4 12",
1900
- stroke: "currentColor",
1901
- strokeWidth: "1.8",
1902
- strokeLinecap: "round"
1903
- })
1904
- }), ue = ({ open: e, title: t, subtitle: n, onClose: r, showCloseButton: i, showGrabber: a = !0, footer: o, maxHeight: s = "85%", children: u }) => {
1905
- let d = l();
1906
- if (c(() => {
1907
- if (!e) return;
1908
- let t = (e) => {
1909
- e.key === "Escape" && r();
1910
- };
1911
- return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
1912
- }, [e, r]), !e) return null;
1913
- let f = t !== void 0 || n !== void 0, p = i ?? f, g = f || p, _ = typeof s == "number" ? `${s}px` : s;
1914
- return /* @__PURE__ */ m("div", {
1915
- className: "tp-overlay tp-bottomsheet-backdrop",
1916
- onClick: r,
1917
- children: /* @__PURE__ */ h("div", {
1918
- role: "dialog",
1919
- "aria-modal": "true",
1920
- "aria-labelledby": t ? d : void 0,
1921
- className: "tp-bottomsheet",
1922
- style: { maxHeight: _ },
1923
- onClick: (e) => e.stopPropagation(),
1924
- children: [
1925
- a && /* @__PURE__ */ m("div", {
1926
- className: "tp-bottomsheet-grabber-wrap",
1927
- "aria-hidden": "true",
1928
- children: /* @__PURE__ */ m("span", { className: "tp-bottomsheet-grabber" })
1929
- }),
1930
- g && /* @__PURE__ */ h("div", {
1931
- className: "tp-bottomsheet-header",
1932
- children: [/* @__PURE__ */ h("div", {
1933
- className: "tp-bottomsheet-heading",
1934
- children: [t !== void 0 && /* @__PURE__ */ m("div", {
1935
- id: d,
1936
- className: "tp-bottomsheet-title",
1937
- children: t
1938
- }), n !== void 0 && /* @__PURE__ */ m("div", {
1939
- className: "tp-bottomsheet-subtitle",
1940
- children: n
1941
- })]
1942
- }), p && /* @__PURE__ */ m("button", {
1943
- type: "button",
1944
- className: "tp-bottomsheet-close",
1945
- "aria-label": "Close",
1946
- onClick: r,
1947
- children: /* @__PURE__ */ m(le, {})
1948
- })]
1949
- }),
1950
- /* @__PURE__ */ m("div", {
1951
- className: "tp-bottomsheet-body",
1952
- children: u
1953
- }),
1954
- o !== void 0 && /* @__PURE__ */ m("div", {
1955
- className: "tp-bottomsheet-footer",
1956
- children: o
1957
- })
1958
- ]
1959
- })
1960
- });
1961
- }, de = () => /* @__PURE__ */ m("svg", {
1962
- width: "14",
1963
- height: "14",
1964
- viewBox: "0 0 16 16",
1965
- fill: "none",
1966
- "aria-hidden": "true",
1967
- children: /* @__PURE__ */ m("path", {
1968
- d: "M4 4L12 12M12 4L4 12",
1969
- stroke: "currentColor",
1970
- strokeWidth: "1.8",
1971
- strokeLinecap: "round"
1972
- })
1973
- }), fe = ({ open: e, placement: t = "center", title: n, closable: r = !0, maskClosable: i = !0, onClose: a, footer: o, className: s = "", style: u, children: d }) => {
1974
- let f = l();
1975
- if (c(() => {
1976
- if (!e) return;
1977
- let t = (e) => {
1978
- e.key === "Escape" && (i || r) && a();
1979
- };
1980
- return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
1981
- }, [
1982
- e,
1983
- i,
1984
- r,
1985
- a
1986
- ]), !e) return null;
1987
- let p = n !== void 0 || r;
1988
- return /* @__PURE__ */ m("div", {
1989
- className: `tp-overlay tp-popup-backdrop--${t}`,
1990
- onClick: () => {
1991
- i && a();
1992
- },
1993
- children: /* @__PURE__ */ h("div", {
1994
- role: "dialog",
1995
- "aria-modal": "true",
1996
- "aria-labelledby": n ? f : void 0,
1997
- "data-placement": t,
1998
- className: `tp-popup tp-popup--${t} ${s}`.trim(),
1999
- style: u,
2000
- onClick: (e) => e.stopPropagation(),
2001
- children: [
2002
- p && /* @__PURE__ */ h("div", {
2003
- className: "tp-popup-header",
2004
- children: [n === void 0 ? /* @__PURE__ */ m("span", {}) : /* @__PURE__ */ m("div", {
2005
- id: f,
2006
- className: "tp-popup-title",
2007
- children: n
2008
- }), r && /* @__PURE__ */ m("button", {
2009
- type: "button",
2010
- className: "tp-popup-close",
2011
- "aria-label": "Close",
2012
- onClick: a,
2013
- children: /* @__PURE__ */ m(de, {})
2014
- })]
2015
- }),
2016
- /* @__PURE__ */ m("div", {
2017
- className: "tp-popup-body",
2018
- children: d
2019
- }),
2020
- o !== void 0 && /* @__PURE__ */ m("div", {
2021
- className: "tp-popup-footer",
2022
- children: o
2023
- })
2024
- ]
2025
- })
2026
- });
2027
- }, pe = () => /* @__PURE__ */ m("svg", {
2028
- width: "16",
2029
- height: "16",
2030
- viewBox: "0 0 24 24",
2031
- fill: "none",
2032
- "aria-hidden": "true",
2033
- children: /* @__PURE__ */ m("path", {
2034
- d: "M5 12.5L9.8 17L19 7.5",
2035
- stroke: "currentColor",
2036
- strokeWidth: "2.2",
2037
- strokeLinecap: "round",
2038
- strokeLinejoin: "round"
2039
- })
2040
- }), me = ({ open: e, items: t, onSelect: n, onClose: r, align: a = "left", className: o = "", style: s }) => {
2041
- let l = d(null);
2042
- if (c(() => {
2043
- if (!e) return;
2044
- let t = !1, n = (e) => {
2045
- e.key === "Escape" && r();
2046
- }, i = (e) => {
2047
- let n = e.target;
2048
- l.current && n && !l.current.contains(n) && (t = !0, r());
2049
- }, a = (e) => {
2050
- if (t) {
2051
- t = !1;
2052
- return;
2053
- }
2054
- let n = e.target;
2055
- l.current && n && !l.current.contains(n) && r();
2056
- };
2057
- return document.addEventListener("keydown", n), document.addEventListener("mousedown", i), document.addEventListener("click", a), () => {
2058
- document.removeEventListener("keydown", n), document.removeEventListener("mousedown", i), document.removeEventListener("click", a);
2059
- };
2060
- }, [e, r]), !e) return null;
2061
- let u = (e) => {
2062
- e.disabled || (n(e), r());
2063
- };
2064
- return /* @__PURE__ */ m("div", {
2065
- ref: l,
2066
- role: "menu",
2067
- "data-align": a,
2068
- className: `tp-menu tp-menu--align-${a} ${o}`.trim(),
2069
- style: s,
2070
- onClick: (e) => e.stopPropagation(),
2071
- children: t.map((e) => {
2072
- let t = [
2073
- "tp-menu-item",
2074
- e.selected ? "tp-menu-item--selected" : "",
2075
- e.danger ? "tp-menu-item--danger" : "",
2076
- e.disabled ? "tp-menu-item--disabled" : ""
2077
- ].filter(Boolean).join(" ");
2078
- return /* @__PURE__ */ h(i.Fragment, { children: [e.dividerBefore && /* @__PURE__ */ m("div", {
2079
- className: "tp-menu-divider",
2080
- role: "separator"
2081
- }), /* @__PURE__ */ h("button", {
2082
- type: "button",
2083
- role: "menuitem",
2084
- "data-selected": e.selected ? "true" : void 0,
2085
- className: t,
2086
- disabled: e.disabled,
2087
- "aria-disabled": e.disabled || void 0,
2088
- onClick: () => u(e),
2089
- children: [
2090
- e.icon !== void 0 && /* @__PURE__ */ m("span", {
2091
- className: "tp-menu-item-icon",
2092
- children: e.icon
2093
- }),
2094
- /* @__PURE__ */ m("span", {
2095
- className: "tp-menu-item-label",
2096
- children: e.label
2097
- }),
2098
- e.selected && /* @__PURE__ */ m("span", {
2099
- className: "tp-menu-item-check",
2100
- "aria-label": "selected",
2101
- children: /* @__PURE__ */ m(pe, {})
2102
- })
2103
- ]
2104
- })] }, e.key);
2105
- })
2106
- });
2107
- }, he = ({ type: e }) => {
2108
- switch (e) {
2109
- case "info": return /* @__PURE__ */ h("svg", {
2110
- width: "18",
2111
- height: "18",
2112
- viewBox: "0 0 24 24",
2113
- fill: "none",
2114
- "aria-hidden": "true",
2115
- children: [
2116
- /* @__PURE__ */ m("circle", {
2117
- cx: "12",
2118
- cy: "12",
2119
- r: "9.5",
2120
- stroke: "currentColor",
2121
- strokeWidth: "1.6"
2122
- }),
2123
- /* @__PURE__ */ m("rect", {
2124
- x: "11.2",
2125
- y: "7.8",
2126
- width: "1.6",
2127
- height: "1.6",
2128
- rx: "0.4",
2129
- fill: "currentColor"
2130
- }),
2131
- /* @__PURE__ */ m("rect", {
2132
- x: "11.2",
2133
- y: "10.8",
2134
- width: "1.6",
2135
- height: "5.8",
2136
- rx: "0.4",
2137
- fill: "currentColor"
2138
- })
2139
- ]
2140
- });
2141
- case "success": return /* @__PURE__ */ h("svg", {
2142
- width: "18",
2143
- height: "18",
2144
- viewBox: "0 0 24 24",
2145
- fill: "none",
2146
- "aria-hidden": "true",
2147
- children: [/* @__PURE__ */ m("circle", {
2148
- cx: "12",
2149
- cy: "12",
2150
- r: "9.5",
2151
- stroke: "currentColor",
2152
- strokeWidth: "1.6"
2153
- }), /* @__PURE__ */ m("path", {
2154
- d: "M8 12.2L10.8 15L16 9.5",
2155
- stroke: "currentColor",
2156
- strokeWidth: "1.8",
2157
- strokeLinecap: "round",
2158
- strokeLinejoin: "round"
2159
- })]
2160
- });
2161
- case "warning": return /* @__PURE__ */ h("svg", {
2162
- width: "18",
2163
- height: "18",
2164
- viewBox: "0 0 24 24",
2165
- fill: "none",
2166
- "aria-hidden": "true",
2167
- children: [
2168
- /* @__PURE__ */ m("circle", {
2169
- cx: "12",
2170
- cy: "12",
2171
- r: "9.5",
2172
- stroke: "currentColor",
2173
- strokeWidth: "1.6"
2174
- }),
2175
- /* @__PURE__ */ m("rect", {
2176
- x: "11.2",
2177
- y: "7.5",
2178
- width: "1.6",
2179
- height: "5.8",
2180
- rx: "0.4",
2181
- fill: "currentColor"
2182
- }),
2183
- /* @__PURE__ */ m("rect", {
2184
- x: "11.2",
2185
- y: "14.8",
2186
- width: "1.6",
2187
- height: "1.6",
2188
- rx: "0.4",
2189
- fill: "currentColor"
2190
- })
2191
- ]
2192
- });
2193
- case "error": return /* @__PURE__ */ h("svg", {
2194
- width: "18",
2195
- height: "18",
2196
- viewBox: "0 0 24 24",
2197
- fill: "none",
2198
- "aria-hidden": "true",
2199
- children: [/* @__PURE__ */ m("circle", {
2200
- cx: "12",
2201
- cy: "12",
2202
- r: "9.5",
2203
- stroke: "currentColor",
2204
- strokeWidth: "1.6"
2205
- }), /* @__PURE__ */ m("path", {
2206
- d: "M9 9L15 15M15 9L9 15",
2207
- stroke: "currentColor",
2208
- strokeWidth: "1.8",
2209
- strokeLinecap: "round"
2210
- })]
2211
- });
2212
- case "loading": return /* @__PURE__ */ h("svg", {
2213
- width: "18",
2214
- height: "18",
2215
- viewBox: "0 0 24 24",
2216
- fill: "none",
2217
- className: "tp-toast-spinner",
2218
- "aria-hidden": "true",
2219
- children: [/* @__PURE__ */ m("circle", {
2220
- cx: "12",
2221
- cy: "12",
2222
- r: "9",
2223
- stroke: "currentColor",
2224
- strokeOpacity: "0.28",
2225
- strokeWidth: "2.2"
2226
- }), /* @__PURE__ */ m("path", {
2227
- d: "M12 3A9 9 0 0 1 21 12",
2228
- stroke: "currentColor",
2229
- strokeWidth: "2.2",
2230
- strokeLinecap: "round"
2231
- })]
2232
- });
2233
- default: return null;
2234
- }
2235
- }, Q = ({ open: e = !0, type: t = "default", message: n, duration: r, position: i = "center", onClose: a, className: o = "", style: s }) => {
2236
- let l = r ?? (t === "loading" ? 0 : 2500);
2237
- if (c(() => {
2238
- if (!e || !a || l <= 0) return;
2239
- let t = setTimeout(() => {
2240
- a();
2241
- }, l);
2242
- return () => clearTimeout(t);
2243
- }, [
2244
- e,
2245
- l,
2246
- a
2247
- ]), !e) return null;
2248
- let u = /* @__PURE__ */ m(he, { type: t });
2249
- return /* @__PURE__ */ m("div", {
2250
- className: `tp-toast-container tp-toast-container--${i}`,
2251
- children: /* @__PURE__ */ h("div", {
2252
- role: t === "error" ? "alert" : "status",
2253
- "aria-live": t === "error" ? "assertive" : "polite",
2254
- "data-type": t,
2255
- className: `tp-toast tp-toast--${t} ${o}`.trim(),
2256
- style: s,
2257
- children: [t !== "default" && /* @__PURE__ */ m("span", {
2258
- className: "tp-toast-icon",
2259
- children: u
2260
- }), /* @__PURE__ */ m("span", {
2261
- className: "tp-toast-message",
2262
- children: n
2263
- })]
2264
- })
2265
- });
2266
- }, $ = a({
2267
- show: () => {},
2268
- dismiss: () => {}
2269
- }), ge = ({ children: e }) => {
2270
- let [t, n] = f(null), r = d(null), i = o(() => {
2271
- r.current !== null && (clearTimeout(r.current), r.current = null);
2272
- }, []), a = o(() => {
2273
- i(), n((e) => e ? {
2274
- ...e,
2275
- open: !1
2276
- } : null);
2277
- }, [i]), s = o((e) => {
2278
- i();
2279
- let t = typeof e == "string" ? { message: e } : e, a = t.type ?? "default", o = t.duration ?? (a === "loading" ? 0 : 2500);
2280
- n({
2281
- ...t,
2282
- type: a,
2283
- open: !0
2284
- }), o > 0 && (r.current = setTimeout(() => {
2285
- r.current = null, n((e) => e ? {
2286
- ...e,
2287
- open: !1
2288
- } : null), t.onClose?.();
2289
- }, o));
2290
- }, [i]);
2291
- c(() => () => i(), [i]);
2292
- let l = u(() => ({
2293
- show: s,
2294
- dismiss: a
2295
- }), [s, a]);
2296
- return /* @__PURE__ */ h($.Provider, {
2297
- value: l,
2298
- children: [e, t && /* @__PURE__ */ m(Q, {
2299
- open: t.open,
2300
- type: t.type,
2301
- message: t.message,
2302
- duration: 0,
2303
- position: t.position,
2304
- className: t.className,
2305
- style: t.style
2306
- })]
2307
- });
2308
- };
2309
- function _e() {
2310
- return s($);
2311
- }
2312
- // src/core/components/TPPrompt.tsx
2313
- var ve = ({ tone: e }) => {
2314
- switch (e) {
2315
- case "warning": return /* @__PURE__ */ h("svg", {
2316
- width: "20",
2317
- height: "20",
2318
- viewBox: "0 0 24 24",
2319
- fill: "none",
2320
- "aria-hidden": "true",
2321
- children: [
2322
- /* @__PURE__ */ m("circle", {
2323
- cx: "12",
2324
- cy: "12",
2325
- r: "9.5",
2326
- stroke: "currentColor",
2327
- strokeWidth: "1.5"
2328
- }),
2329
- /* @__PURE__ */ m("rect", {
2330
- x: "11.25",
2331
- y: "7.2",
2332
- width: "1.5",
2333
- height: "6",
2334
- rx: "0.4",
2335
- fill: "currentColor"
2336
- }),
2337
- /* @__PURE__ */ m("rect", {
2338
- x: "11.25",
2339
- y: "14.8",
2340
- width: "1.5",
2341
- height: "1.6",
2342
- rx: "0.4",
2343
- fill: "currentColor"
2344
- })
2345
- ]
2346
- });
2347
- case "alert": return /* @__PURE__ */ h("svg", {
2348
- width: "20",
2349
- height: "20",
2350
- viewBox: "0 0 24 24",
2351
- fill: "none",
2352
- "aria-hidden": "true",
2353
- children: [/* @__PURE__ */ m("circle", {
2354
- cx: "12",
2355
- cy: "12",
2356
- r: "9.5",
2357
- stroke: "currentColor",
2358
- strokeWidth: "1.5"
2359
- }), /* @__PURE__ */ m("path", {
2360
- d: "M9.2 9.2L14.8 14.8M14.8 9.2L9.2 14.8",
2361
- stroke: "currentColor",
2362
- strokeWidth: "1.6",
2363
- strokeLinecap: "round"
2364
- })]
2365
- });
2366
- case "focus": return /* @__PURE__ */ h("svg", {
2367
- width: "20",
2368
- height: "20",
2369
- viewBox: "0 0 24 24",
2370
- fill: "none",
2371
- "aria-hidden": "true",
2372
- children: [/* @__PURE__ */ m("circle", {
2373
- cx: "12",
2374
- cy: "12",
2375
- r: "9.5",
2376
- stroke: "currentColor",
2377
- strokeWidth: "1.5"
2378
- }), /* @__PURE__ */ m("path", {
2379
- d: "M8.5 12.2L11 14.7L15.8 9.6",
2380
- stroke: "currentColor",
2381
- strokeWidth: "1.7",
2382
- strokeLinecap: "round",
2383
- strokeLinejoin: "round"
2384
- })]
2385
- });
2386
- default: return /* @__PURE__ */ h("svg", {
2387
- width: "20",
2388
- height: "20",
2389
- viewBox: "0 0 24 24",
2390
- fill: "none",
2391
- "aria-hidden": "true",
2392
- children: [
2393
- /* @__PURE__ */ m("circle", {
2394
- cx: "12",
2395
- cy: "12",
2396
- r: "9.5",
2397
- stroke: "currentColor",
2398
- strokeWidth: "1.4"
2399
- }),
2400
- /* @__PURE__ */ m("rect", {
2401
- x: "11.2",
2402
- y: "8",
2403
- width: "1.5",
2404
- height: "1.5",
2405
- fill: "currentColor"
2406
- }),
2407
- /* @__PURE__ */ m("path", {
2408
- d: "M11.2 11H12.7V16.5H11.2V11Z",
2409
- fill: "currentColor"
2410
- })
2411
- ]
2412
- });
2413
- }
2414
- }, ye = () => /* @__PURE__ */ m("svg", {
2415
- width: "14",
2416
- height: "14",
2417
- viewBox: "0 0 16 16",
2418
- fill: "none",
2419
- "aria-hidden": "true",
2420
- children: /* @__PURE__ */ m("path", {
2421
- d: "M3.5 3.5L12.5 12.5M12.5 3.5L3.5 12.5",
2422
- stroke: "currentColor",
2423
- strokeWidth: "1.6",
2424
- strokeLinecap: "round"
2425
- })
2426
- }), be = ({ tone: e = "info", title: t, actionLabel: n, onAction: r, closable: i, onClose: a, icon: o, className: s = "", style: c }) => {
2427
- let l = i ?? !!a;
2428
- return /* @__PURE__ */ h("div", {
2429
- role: "region",
2430
- "data-tone": e,
2431
- className: `tp-prompt tp-prompt--${e} ${s}`.trim(),
2432
- style: c,
2433
- children: [
2434
- /* @__PURE__ */ m("span", {
2435
- className: "tp-prompt-icon",
2436
- children: o === void 0 ? /* @__PURE__ */ m(ve, { tone: e }) : o
2437
- }),
2438
- /* @__PURE__ */ h("div", {
2439
- className: "tp-prompt-content",
2440
- children: [/* @__PURE__ */ m("div", {
2441
- className: "tp-prompt-title",
2442
- children: t
2443
- }), n !== void 0 && /* @__PURE__ */ m("button", {
2444
- type: "button",
2445
- className: "tp-prompt-action",
2446
- onClick: r,
2447
- children: n
2448
- })]
2449
- }),
2450
- l && /* @__PURE__ */ m("button", {
2451
- type: "button",
2452
- className: "tp-prompt-close",
2453
- "aria-label": "Dismiss",
2454
- onClick: a,
2455
- children: /* @__PURE__ */ m(ye, {})
2456
- })
2457
- ]
2458
- });
2459
- };
2460
- export { E as A, I as C, k as D, M as E, v as F, w as M, x as N, O, b as P, L as S, N as T, U as _, me as a, B as b, ce as c, ne as d, te as f, W as g, G as h, _e as i, T as j, D as k, oe as l, q as m, Q as n, fe as o, ee as p, ge as r, ue as s, be as t, ae as u, H as v, F as w, R as x, V as y };