@tachui/primitives 0.8.1-alpha → 0.8.5-alpha
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/{BasicInput-CWFHw9rL.js → BasicInput-BHfrSdoi.js} +46 -33
- package/dist/{Picker-DrZ7ibdt.js → Picker-DKphYduj.js} +243 -244
- package/dist/ScrollView-CBqSqatM.js +704 -0
- package/dist/Text-D0CYYD-Q.js +170 -0
- package/dist/controls/Button.d.ts +19 -28
- package/dist/controls/Button.d.ts.map +1 -1
- package/dist/controls/index.js +1 -1
- package/dist/display/HTML.d.ts +13 -13
- package/dist/display/Image.d.ts +8 -8
- package/dist/display/Image.d.ts.map +1 -1
- package/dist/display/ScrollView.d.ts +216 -0
- package/dist/display/ScrollView.d.ts.map +1 -0
- package/dist/display/Text.d.ts +37 -44
- package/dist/display/Text.d.ts.map +1 -1
- package/dist/display/index.d.ts +1 -0
- package/dist/display/index.d.ts.map +1 -1
- package/dist/display/index.js +20 -17
- package/dist/forms/BasicForm.d.ts +5 -1
- package/dist/forms/BasicForm.d.ts.map +1 -1
- package/dist/forms/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +66 -59
- package/dist/layout/Divider.d.ts +9 -3
- package/dist/layout/Divider.d.ts.map +1 -1
- package/dist/layout/Spacer.d.ts +8 -2
- package/dist/layout/Spacer.d.ts.map +1 -1
- package/dist/layout/Stack.d.ts +19 -69
- package/dist/layout/Stack.d.ts.map +1 -1
- package/dist/layout/index.js +267 -13
- package/dist/version.d.ts +14 -0
- package/dist/version.d.ts.map +1 -0
- package/package.json +6 -4
- package/dist/Divider-DWgDKavU.js +0 -474
- package/dist/HTML-aWcvQ0VC.js +0 -321
- package/dist/Text-DYyFBJ6i.js +0 -165
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { withModifiers as T, ComponentWithCSSClasses as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { withModifiers as T, ComponentWithCSSClasses as q, createSignal as R, useLifecycle as J, createEffect as j, isSignal as l, ColorAsset as A, h as a, text as d, ConcatenatedComponent as $, clonePropsPreservingReactivity as H, resetLifecycleState as N, createComputed as Q } from "@tachui/core";
|
|
2
|
+
import { createComponentInstance as ee } from "@tachui/core/components";
|
|
3
|
+
import { T as U } from "./Text-D0CYYD-Q.js";
|
|
4
|
+
var te = Object.defineProperty, ie = (s, e, t) => e in s ? te(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, y = (s, e, t) => ie(s, typeof e != "symbol" ? e + "" : e, t);
|
|
5
|
+
const se = {
|
|
5
6
|
colors: {
|
|
6
7
|
primary: "#007AFF",
|
|
7
8
|
secondary: "#5856D6",
|
|
@@ -30,19 +31,19 @@ const Q = {
|
|
|
30
31
|
large: { size: 18, weight: "600" }
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
|
-
class
|
|
34
|
-
constructor(e, t =
|
|
35
|
-
super(), this.props = e,
|
|
36
|
-
const [i, r] =
|
|
34
|
+
class z extends q {
|
|
35
|
+
constructor(e, t = se) {
|
|
36
|
+
super(), this.props = e, y(this, "type", "component"), y(this, "id"), y(this, "mounted", !1), y(this, "cleanup", []), y(this, "stateSignal"), y(this, "setState"), y(this, "theme"), this.id = `button-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, this.theme = t;
|
|
37
|
+
const [i, r] = R("normal");
|
|
37
38
|
this.stateSignal = i, this.setState = r, this.setupDOMEventListeners();
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
41
|
* Set up DOM event listeners for button interactions
|
|
41
42
|
*/
|
|
42
43
|
setupDOMEventListeners() {
|
|
43
|
-
|
|
44
|
+
J(this, {
|
|
44
45
|
onDOMReady: (e, t) => {
|
|
45
|
-
t instanceof HTMLButtonElement &&
|
|
46
|
+
t instanceof HTMLButtonElement && this.setupReactiveStyles(t);
|
|
46
47
|
}
|
|
47
48
|
});
|
|
48
49
|
}
|
|
@@ -50,12 +51,12 @@ class ee extends K {
|
|
|
50
51
|
* Set up reactive style updates based on state changes
|
|
51
52
|
*/
|
|
52
53
|
setupReactiveStyles(e) {
|
|
53
|
-
const t =
|
|
54
|
+
const t = j(() => {
|
|
54
55
|
this.stateSignal(), this.isEnabled(), this.isLoading();
|
|
55
|
-
const { tint: i, backgroundColor: r, foregroundColor:
|
|
56
|
-
i && l(i) ? i() : i instanceof A && i.resolve(), r && l(r) ? r() : r instanceof A && r.resolve(),
|
|
57
|
-
const
|
|
58
|
-
this.applyStylesToElement(e,
|
|
56
|
+
const { tint: i, backgroundColor: r, foregroundColor: o } = this.props;
|
|
57
|
+
i && l(i) ? i() : i instanceof A && i.resolve(), r && l(r) ? r() : r instanceof A && r.resolve(), o && l(o) ? o() : o instanceof A && o.resolve();
|
|
58
|
+
const n = this.getButtonStyles();
|
|
59
|
+
this.applyStylesToElement(e, n);
|
|
59
60
|
});
|
|
60
61
|
this.cleanup.push(() => {
|
|
61
62
|
t && typeof t.dispose == "function" && t.dispose();
|
|
@@ -66,10 +67,10 @@ class ee extends K {
|
|
|
66
67
|
*/
|
|
67
68
|
applyStylesToElement(e, t) {
|
|
68
69
|
Object.entries(t).forEach(([i, r]) => {
|
|
69
|
-
const
|
|
70
|
+
const o = this.camelToKebabCase(i);
|
|
70
71
|
if (typeof r == "string" || typeof r == "number") {
|
|
71
|
-
const
|
|
72
|
-
n === "transform" ? e.style.setProperty(
|
|
72
|
+
const n = e.style.getPropertyValue(o), c = n && n !== "" && n !== "inherit";
|
|
73
|
+
process.env.NODE_ENV === "development" && o === "font-family" && (console.log("[Button.applyButtonStyles] Font-family check:"), console.log("[Button.applyButtonStyles] property:", i, "cssProperty:", o), console.log("[Button.applyButtonStyles] currentValue:", n), console.log("[Button.applyButtonStyles] hasModifierValue:", c), console.log("[Button.applyButtonStyles] will set to:", r)), o === "transform" ? e.style.setProperty(o, String(r)) : c ? process.env.NODE_ENV === "development" && o === "font-family" && console.log("[Button.applyButtonStyles] Button SKIPPED font-family (has modifier value):", n) : (e.style.setProperty(o, String(r)), process.env.NODE_ENV === "development" && o === "font-family" && (console.log("[Button.applyButtonStyles] Button SET font-family to:", String(r)), console.log("[Button.applyButtonStyles] Element after set:", e.style.fontFamily)));
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
76
|
}
|
|
@@ -92,36 +93,6 @@ class ee extends K {
|
|
|
92
93
|
return e.resolve();
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Attach interaction event listeners to the button element
|
|
97
|
-
*/
|
|
98
|
-
attachInteractionEvents(e) {
|
|
99
|
-
const t = () => {
|
|
100
|
-
const c = this.isEnabled();
|
|
101
|
-
return typeof c == "boolean" ? c : c();
|
|
102
|
-
};
|
|
103
|
-
let i = null;
|
|
104
|
-
const r = (c) => {
|
|
105
|
-
t() && c.button === 0 && (this.setState("pressed"), i = () => {
|
|
106
|
-
this.stateSignal() === "pressed" && this.setState("normal"), i && (document.removeEventListener("mouseup", i), i = null);
|
|
107
|
-
}, document.addEventListener("mouseup", i));
|
|
108
|
-
}, n = () => {
|
|
109
|
-
t() && this.stateSignal() === "pressed" && (this.setState("normal"), i && (document.removeEventListener("mouseup", i), i = null));
|
|
110
|
-
}, o = () => {
|
|
111
|
-
t() && (this.setState("normal"), i && (document.removeEventListener("mouseup", i), i = null));
|
|
112
|
-
}, d = () => {
|
|
113
|
-
t() && this.stateSignal() !== "pressed" && this.setState("focused");
|
|
114
|
-
}, u = () => {
|
|
115
|
-
t() && this.stateSignal() === "focused" && this.setState("normal");
|
|
116
|
-
}, y = (c) => {
|
|
117
|
-
t() && (c.key === " " || c.key === "Enter") && (c.preventDefault(), this.setState("pressed"));
|
|
118
|
-
}, f = (c) => {
|
|
119
|
-
t() && (c.key === " " || c.key === "Enter") && (c.preventDefault(), this.setState("normal"), this.props.action?.());
|
|
120
|
-
};
|
|
121
|
-
e.addEventListener("mousedown", r), e.addEventListener("mouseup", n), e.addEventListener("mouseleave", o), e.addEventListener("focus", d), e.addEventListener("blur", u), e.addEventListener("keydown", y), e.addEventListener("keyup", f), this.cleanup.push(() => {
|
|
122
|
-
e.removeEventListener("mousedown", r), e.removeEventListener("mouseup", n), e.removeEventListener("mouseleave", o), e.removeEventListener("focus", d), e.removeEventListener("blur", u), e.removeEventListener("keydown", y), e.removeEventListener("keyup", f), i && (document.removeEventListener("mouseup", i), i = null);
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
96
|
/**
|
|
126
97
|
* Check if button is enabled
|
|
127
98
|
*/
|
|
@@ -144,7 +115,7 @@ class ee extends K {
|
|
|
144
115
|
fontSize: "1.2em"
|
|
145
116
|
}
|
|
146
117
|
},
|
|
147
|
-
|
|
118
|
+
d(this.props.systemImage)
|
|
148
119
|
)
|
|
149
120
|
), t.push(
|
|
150
121
|
a(
|
|
@@ -152,7 +123,7 @@ class ee extends K {
|
|
|
152
123
|
{
|
|
153
124
|
class: "button-title"
|
|
154
125
|
},
|
|
155
|
-
|
|
126
|
+
d(this.props.title || "")
|
|
156
127
|
)
|
|
157
128
|
);
|
|
158
129
|
const i = ["tachui-button"];
|
|
@@ -162,13 +133,13 @@ class ee extends K {
|
|
|
162
133
|
props: {
|
|
163
134
|
className: this.createClassString(this.props, i),
|
|
164
135
|
type: "button",
|
|
165
|
-
disabled: typeof e == "boolean" ? !e :
|
|
136
|
+
disabled: typeof e == "boolean" ? !e : !e(),
|
|
166
137
|
// Invert enabled to disabled
|
|
167
138
|
onClick: this.props.action ? () => {
|
|
168
139
|
try {
|
|
169
140
|
this.props.action?.();
|
|
170
|
-
} catch (
|
|
171
|
-
console.error("Button action error:",
|
|
141
|
+
} catch (n) {
|
|
142
|
+
console.error("Button action error:", n);
|
|
172
143
|
}
|
|
173
144
|
} : void 0,
|
|
174
145
|
// Pass through debug label for debug system
|
|
@@ -204,6 +175,13 @@ class ee extends K {
|
|
|
204
175
|
let e = this.modifiers;
|
|
205
176
|
return !e && this.modifierBuilder && (e = this.modifierBuilder.modifiers), !e && this.modifiableComponent && (e = this.modifiableComponent.modifiers), !e || !Array.isArray(e) ? !1 : e.some((i) => i.type === "typography" || i.constructor?.name === "TypographyModifier" ? i.properties && (i.properties.transform !== void 0 || i.properties.textTransform !== void 0) : !1);
|
|
206
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Check if the button has a shadow modifier applied
|
|
180
|
+
*/
|
|
181
|
+
hasShadowModifier() {
|
|
182
|
+
let e = this.modifiers;
|
|
183
|
+
return !e && this.modifierBuilder && (e = this.modifierBuilder.modifiers), !e && this.modifiableComponent && (e = this.modifiableComponent.modifiers), !e || !Array.isArray(e) ? !1 : e.some((i) => i.type === "appearance" || i.type === "shadow" || i.constructor?.name === "AppearanceModifier" || i.constructor?.name === "ShadowModifier" ? i.properties && i.properties.shadow !== void 0 : !1);
|
|
184
|
+
}
|
|
207
185
|
/**
|
|
208
186
|
* Get computed button styles based on variant, size, role, and state
|
|
209
187
|
*/
|
|
@@ -214,15 +192,15 @@ class ee extends K {
|
|
|
214
192
|
size: t,
|
|
215
193
|
role: i = "none",
|
|
216
194
|
tint: r,
|
|
217
|
-
backgroundColor:
|
|
218
|
-
foregroundColor:
|
|
219
|
-
} = this.props,
|
|
195
|
+
backgroundColor: o,
|
|
196
|
+
foregroundColor: n
|
|
197
|
+
} = this.props, c = this.stateSignal(), f = this.isLoading(), L = this.isEnabled(), b = this.hasColorModifiers(), Y = this.hasTypographyModifiers(), v = {
|
|
220
198
|
// Only set color property if no modifiers will handle it
|
|
221
199
|
// This prevents conflicts between Button styles and AppearanceModifier
|
|
222
|
-
...!
|
|
200
|
+
...!b && !n && !e && { color: "inherit" },
|
|
223
201
|
// Only set text-related properties if no typography modifiers will handle them
|
|
224
202
|
// This prevents conflicts between Button styles and TypographyModifier
|
|
225
|
-
...!
|
|
203
|
+
...!Y && {
|
|
226
204
|
fontStyle: "inherit",
|
|
227
205
|
lineHeight: "inherit",
|
|
228
206
|
textTransform: "inherit",
|
|
@@ -237,40 +215,40 @@ class ee extends K {
|
|
|
237
215
|
// Let modifiers control: fontFamily, fontSize, fontWeight, letterSpacing, textAlign
|
|
238
216
|
};
|
|
239
217
|
if (t) {
|
|
240
|
-
const
|
|
218
|
+
const C = this.theme.spacing[t] || this.theme.spacing.medium, Z = this.theme.borderRadius[t] || this.theme.borderRadius.medium, V = this.theme.typography[t] || this.theme.typography.medium, K = {
|
|
241
219
|
small: "32px",
|
|
242
220
|
medium: "40px",
|
|
243
221
|
large: "48px"
|
|
244
222
|
};
|
|
245
|
-
|
|
223
|
+
v.padding = `${C}px ${C * 2}px`, v.borderRadius = `${Z}px`, v.fontSize = `${V.size}px`, v.fontWeight = V.weight, v.minHeight = K[t];
|
|
246
224
|
}
|
|
247
|
-
let
|
|
248
|
-
const
|
|
225
|
+
let h = "transparent", m = "transparent", _ = "1px", w;
|
|
226
|
+
const X = this.resolveColorValue(r), O = this.resolveColorValue(o), E = this.resolveColorValue(n);
|
|
249
227
|
if (e) {
|
|
250
|
-
const
|
|
228
|
+
const C = X || this.theme.colors.primary;
|
|
251
229
|
switch (e) {
|
|
252
230
|
case "filled":
|
|
253
|
-
i === "destructive" ?
|
|
231
|
+
i === "destructive" ? h = this.theme.colors.destructive : i === "cancel" ? h = this.theme.colors.secondary : h = C, w = this.theme.colors.onPrimary;
|
|
254
232
|
break;
|
|
255
233
|
case "outlined":
|
|
256
|
-
|
|
234
|
+
m = i === "destructive" ? this.theme.colors.destructive : C, w = i === "destructive" ? this.theme.colors.destructive : C;
|
|
257
235
|
break;
|
|
258
236
|
case "bordered":
|
|
259
|
-
|
|
237
|
+
h = this.theme.colors.background, m = this.theme.colors.border;
|
|
260
238
|
break;
|
|
261
239
|
case "borderedProminent":
|
|
262
|
-
|
|
240
|
+
h = this.theme.colors.surface, m = this.theme.colors.primary, _ = "2px";
|
|
263
241
|
break;
|
|
264
242
|
}
|
|
265
243
|
}
|
|
266
|
-
|
|
267
|
-
let F = "1", P = "auto",
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
...
|
|
244
|
+
O && (h = O), E && (w = E);
|
|
245
|
+
let F = "1", P = "auto", B, I = "none";
|
|
246
|
+
L ? f ? (F = "0.6", P = "none") : c === "pressed" ? (h = this.darkenColor(h, 0.1), m = this.darkenColor(m, 0.1), B = "scale(0.95)") : c === "focused" && (I = "0 0 0 3px #007AFF40") : (h = this.theme.colors.disabled, m = this.theme.colors.disabled, w = this.theme.colors.disabled, F = "0.6", P = "none");
|
|
247
|
+
const p = {
|
|
248
|
+
...v
|
|
271
249
|
// Size-based styles (only if size provided)
|
|
272
250
|
};
|
|
273
|
-
return e && (
|
|
251
|
+
return e && (p.backgroundColor = h, p.borderColor = m, p.borderWidth = _, w !== void 0 && (p.color = w)), O && (p.backgroundColor = O), E && (p.color = E), p.cursor = L ? "pointer" : "not-allowed", p.opacity = F, p.pointerEvents = P, p.transform = B !== void 0 ? B : "none", this.hasShadowModifier() || (p.boxShadow = I), p.transition = "all 0.2s ease", p;
|
|
274
252
|
}
|
|
275
253
|
/**
|
|
276
254
|
* Handle button press with proper state management
|
|
@@ -301,8 +279,8 @@ class ee extends K {
|
|
|
301
279
|
darkenColor(e, t) {
|
|
302
280
|
if (e === "transparent") return e;
|
|
303
281
|
if (e.startsWith("#")) {
|
|
304
|
-
const i = e.slice(1), r = parseInt(i, 16),
|
|
305
|
-
return `#${(
|
|
282
|
+
const i = e.slice(1), r = parseInt(i, 16), o = Math.max(0, Math.floor((r >> 16) * (1 - t))), n = Math.max(0, Math.floor((r >> 8 & 255) * (1 - t))), c = Math.max(0, Math.floor((r & 255) * (1 - t)));
|
|
283
|
+
return `#${(o << 16 | n << 8 | c).toString(16).padStart(6, "0")}`;
|
|
306
284
|
}
|
|
307
285
|
return e;
|
|
308
286
|
}
|
|
@@ -314,15 +292,15 @@ class ee extends K {
|
|
|
314
292
|
*/
|
|
315
293
|
concat(e) {
|
|
316
294
|
const t = this.toSegment(), i = e.toSegment(), r = {
|
|
317
|
-
totalSegments: e instanceof
|
|
318
|
-
accessibilityRole: e instanceof
|
|
295
|
+
totalSegments: e instanceof $ ? e.segments.length + 1 : 2,
|
|
296
|
+
accessibilityRole: e instanceof $ ? this.mergeAccessibilityRoles(
|
|
319
297
|
"composite",
|
|
320
298
|
e.metadata.accessibilityRole
|
|
321
299
|
) : this.determineAccessibilityRole(e),
|
|
322
300
|
semanticStructure: "inline"
|
|
323
301
|
// Buttons are typically inline in concatenation
|
|
324
302
|
};
|
|
325
|
-
return new
|
|
303
|
+
return new $([t, i], r);
|
|
326
304
|
}
|
|
327
305
|
/**
|
|
328
306
|
* Convert this button to a segment for concatenation
|
|
@@ -370,41 +348,62 @@ class ee extends K {
|
|
|
370
348
|
mergeAccessibilityRoles(e, t) {
|
|
371
349
|
return "composite";
|
|
372
350
|
}
|
|
351
|
+
clone(e = {}) {
|
|
352
|
+
return e.deep ? this.deepClone() : this.shallowClone();
|
|
353
|
+
}
|
|
354
|
+
shallowClone() {
|
|
355
|
+
const e = H(this.props), t = new z(e, this.theme);
|
|
356
|
+
return this.syncStateToClone(t), N(t), t;
|
|
357
|
+
}
|
|
358
|
+
deepClone() {
|
|
359
|
+
const e = H(this.props, {
|
|
360
|
+
deep: !0
|
|
361
|
+
}), t = new z(e, this.theme);
|
|
362
|
+
return this.syncStateToClone(t), N(t), t;
|
|
363
|
+
}
|
|
364
|
+
syncStateToClone(e) {
|
|
365
|
+
try {
|
|
366
|
+
const t = this.stateSignal();
|
|
367
|
+
e.setState(t);
|
|
368
|
+
} catch (t) {
|
|
369
|
+
process.env.NODE_ENV !== "production" && console.warn("Failed to sync button state to clone:", t);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
373
372
|
}
|
|
374
|
-
function
|
|
373
|
+
function k(s, e, t = {}) {
|
|
375
374
|
const i = {
|
|
376
375
|
...t,
|
|
377
376
|
title: s,
|
|
378
377
|
...e && { action: e }
|
|
379
|
-
}, r =
|
|
378
|
+
}, r = ee(z, i);
|
|
380
379
|
return T(r);
|
|
381
380
|
}
|
|
382
|
-
const
|
|
381
|
+
const be = {
|
|
383
382
|
/**
|
|
384
383
|
* Filled button (primary)
|
|
385
384
|
*/
|
|
386
|
-
Filled: (s, e, t = {}) =>
|
|
385
|
+
Filled: (s, e, t = {}) => k(s, e, { ...t, variant: "filled" }),
|
|
387
386
|
/**
|
|
388
387
|
* Outlined button
|
|
389
388
|
*/
|
|
390
|
-
Outlined: (s, e, t = {}) =>
|
|
389
|
+
Outlined: (s, e, t = {}) => k(s, e, { ...t, variant: "outlined" }),
|
|
391
390
|
/**
|
|
392
391
|
* Plain button (text only)
|
|
393
392
|
*/
|
|
394
|
-
Plain: (s, e, t = {}) =>
|
|
393
|
+
Plain: (s, e, t = {}) => k(s, e, { ...t, variant: "plain" }),
|
|
395
394
|
/**
|
|
396
395
|
* Bordered button
|
|
397
396
|
*/
|
|
398
|
-
Bordered: (s, e, t = {}) =>
|
|
397
|
+
Bordered: (s, e, t = {}) => k(s, e, { ...t, variant: "bordered" }),
|
|
399
398
|
/**
|
|
400
399
|
* Destructive button
|
|
401
400
|
*/
|
|
402
|
-
Destructive: (s, e, t = {}) =>
|
|
401
|
+
Destructive: (s, e, t = {}) => k(s, e, { ...t, role: "destructive" }),
|
|
403
402
|
/**
|
|
404
403
|
* Cancel button
|
|
405
404
|
*/
|
|
406
|
-
Cancel: (s, e, t = {}) =>
|
|
407
|
-
},
|
|
405
|
+
Cancel: (s, e, t = {}) => k(s, e, { ...t, role: "cancel" })
|
|
406
|
+
}, oe = `
|
|
408
407
|
@keyframes spin {
|
|
409
408
|
from { transform: rotate(0deg); }
|
|
410
409
|
to { transform: rotate(360deg); }
|
|
@@ -412,12 +411,12 @@ const he = {
|
|
|
412
411
|
`;
|
|
413
412
|
if (typeof document < "u") {
|
|
414
413
|
const s = document.createElement("style");
|
|
415
|
-
s.textContent =
|
|
414
|
+
s.textContent = oe, document.head.appendChild(s);
|
|
416
415
|
}
|
|
417
|
-
var
|
|
418
|
-
class
|
|
416
|
+
var re = Object.defineProperty, ne = (s, e, t) => e in s ? re(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, M = (s, e, t) => ne(s, typeof e != "symbol" ? e + "" : e, t);
|
|
417
|
+
class W {
|
|
419
418
|
constructor(e) {
|
|
420
|
-
|
|
419
|
+
M(this, "type", "component"), M(this, "id"), M(this, "props"), this.props = e, this.id = `enhanced-link-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
421
420
|
}
|
|
422
421
|
resolveValue(e) {
|
|
423
422
|
return l(e) ? e() : e;
|
|
@@ -437,8 +436,8 @@ class U {
|
|
|
437
436
|
return this.resolveValue(this.props.routingMode) || "auto";
|
|
438
437
|
}
|
|
439
438
|
getRel() {
|
|
440
|
-
const e = this.resolveValue(this.props.rel), t = this.getTarget(), i = this.getDestination(),
|
|
441
|
-
return e &&
|
|
439
|
+
const e = this.resolveValue(this.props.rel), t = this.getTarget(), i = this.getDestination(), o = this.isExternalURL(i) && t === "_blank" ? "noopener noreferrer" : "";
|
|
440
|
+
return e && o ? `${e} ${o}`.trim() : e || o;
|
|
442
441
|
}
|
|
443
442
|
getDownload() {
|
|
444
443
|
return this.resolveValue(this.props.download);
|
|
@@ -470,8 +469,8 @@ class U {
|
|
|
470
469
|
if (this.props.onPress)
|
|
471
470
|
try {
|
|
472
471
|
this.props.onPress(e);
|
|
473
|
-
} catch (
|
|
474
|
-
console.error("Link onPress error:",
|
|
472
|
+
} catch (o) {
|
|
473
|
+
console.error("Link onPress error:", o);
|
|
475
474
|
}
|
|
476
475
|
const t = this.getDestination();
|
|
477
476
|
if (this.isSpecialScheme(t) || (e.preventDefault(), this.props.openURLAction && this.props.openURLAction(t) === "handled"))
|
|
@@ -480,8 +479,8 @@ class U {
|
|
|
480
479
|
try {
|
|
481
480
|
if (!await this.props.onBeforeNavigation(t))
|
|
482
481
|
return;
|
|
483
|
-
} catch (
|
|
484
|
-
throw console.error("Link onBeforeNavigation error:",
|
|
482
|
+
} catch (o) {
|
|
483
|
+
throw console.error("Link onBeforeNavigation error:", o), o;
|
|
485
484
|
}
|
|
486
485
|
const i = this.getTarget(), r = this.getRoutingMode();
|
|
487
486
|
if (this.shouldUseInternalRouting(t)) {
|
|
@@ -489,8 +488,8 @@ class U {
|
|
|
489
488
|
try {
|
|
490
489
|
if (await this.props.onInternalNavigation(t))
|
|
491
490
|
return;
|
|
492
|
-
} catch (
|
|
493
|
-
console.error("Link onInternalNavigation error:",
|
|
491
|
+
} catch (o) {
|
|
492
|
+
console.error("Link onInternalNavigation error:", o);
|
|
494
493
|
}
|
|
495
494
|
r === "spa" ? this.handleSPANavigation(t) : i === "_blank" ? window.open(t, i) : window.location.href = t;
|
|
496
495
|
} else
|
|
@@ -508,14 +507,14 @@ class U {
|
|
|
508
507
|
}
|
|
509
508
|
renderContent() {
|
|
510
509
|
if (this.props.label) {
|
|
511
|
-
const
|
|
512
|
-
return Array.isArray(
|
|
510
|
+
const o = this.props.label().render();
|
|
511
|
+
return Array.isArray(o) ? o : [o];
|
|
513
512
|
}
|
|
514
513
|
if (this.props.children)
|
|
515
514
|
return this.renderChildren();
|
|
516
515
|
let e;
|
|
517
|
-
this.props.text ? e = this.props.text : l(this.props.destination) ? e =
|
|
518
|
-
const i =
|
|
516
|
+
this.props.text ? e = this.props.text : l(this.props.destination) ? e = Q(() => this.getDestination()) : e = this.getDestination();
|
|
517
|
+
const i = U(e).render();
|
|
519
518
|
return Array.isArray(i) ? i : [i];
|
|
520
519
|
}
|
|
521
520
|
renderChildren() {
|
|
@@ -524,7 +523,7 @@ class U {
|
|
|
524
523
|
}
|
|
525
524
|
renderChild(e) {
|
|
526
525
|
if (typeof e == "string") {
|
|
527
|
-
const i =
|
|
526
|
+
const i = U(e).render();
|
|
528
527
|
return Array.isArray(i) ? i : [i];
|
|
529
528
|
} else {
|
|
530
529
|
const t = e.render();
|
|
@@ -539,14 +538,14 @@ class U {
|
|
|
539
538
|
l(this.props.destination) ? i.href = () => this.getDestination() : i.href = this.getDestination(), this.props.target && (l(this.props.target) ? i.target = () => this.getTarget() : i.target = this.getTarget());
|
|
540
539
|
const r = this.getRel();
|
|
541
540
|
r && (l(this.props.rel) || l(this.props.target) ? i.rel = () => this.getRel() : i.rel = r);
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
const
|
|
547
|
-
|
|
548
|
-
const
|
|
549
|
-
return
|
|
541
|
+
const o = this.getDownload();
|
|
542
|
+
o !== void 0 && (l(this.props.download) ? i.download = () => this.getDownload() : o === !0 ? i.download = !0 : typeof o == "string" && (i.download = o));
|
|
543
|
+
const n = this.getAccessibilityLabel();
|
|
544
|
+
n && (l(this.props.accessibilityLabel) ? i["aria-label"] = () => this.getAccessibilityLabel() : i["aria-label"] = n);
|
|
545
|
+
const c = this.getAccessibilityHint();
|
|
546
|
+
c && (l(this.props.accessibilityHint) ? i["aria-describedby"] = () => this.getAccessibilityHint() : i["aria-describedby"] = c);
|
|
547
|
+
const f = this.getAccessibilityRole();
|
|
548
|
+
return f && (l(this.props.accessibilityRole) ? i.role = () => this.getAccessibilityRole() : i.role = f), t && (i["aria-disabled"] = "true", i.tabindex = "-1"), i.onclick = (b) => this.handleClick(b), i.style = {
|
|
550
549
|
textDecoration: "none",
|
|
551
550
|
color: "inherit",
|
|
552
551
|
cursor: t ? "not-allowed" : "pointer",
|
|
@@ -560,7 +559,7 @@ class U {
|
|
|
560
559
|
accessibilityRole: "composite",
|
|
561
560
|
semanticStructure: "inline"
|
|
562
561
|
};
|
|
563
|
-
return new
|
|
562
|
+
return new $([t, i], r);
|
|
564
563
|
}
|
|
565
564
|
toSegment() {
|
|
566
565
|
return {
|
|
@@ -574,18 +573,18 @@ class U {
|
|
|
574
573
|
return !0;
|
|
575
574
|
}
|
|
576
575
|
}
|
|
577
|
-
function
|
|
576
|
+
function me(s, e) {
|
|
578
577
|
if (e !== void 0) {
|
|
579
578
|
const r = {
|
|
580
579
|
text: s,
|
|
581
580
|
destination: e
|
|
582
|
-
},
|
|
583
|
-
return T(
|
|
581
|
+
}, o = new W(r);
|
|
582
|
+
return T(o);
|
|
584
583
|
}
|
|
585
|
-
const t = s, i = new
|
|
584
|
+
const t = s, i = new W(t);
|
|
586
585
|
return T(i);
|
|
587
586
|
}
|
|
588
|
-
const
|
|
587
|
+
const S = {
|
|
589
588
|
/**
|
|
590
589
|
* Create an external link that opens in a new tab
|
|
591
590
|
*/
|
|
@@ -630,8 +629,8 @@ const x = {
|
|
|
630
629
|
*/
|
|
631
630
|
email(s, e, t, i) {
|
|
632
631
|
let r = `mailto:${s}`;
|
|
633
|
-
const
|
|
634
|
-
return e &&
|
|
632
|
+
const o = new URLSearchParams();
|
|
633
|
+
return e && o.append("subject", e), t && o.append("body", t), o.toString() && (r += `?${o.toString()}`), {
|
|
635
634
|
destination: r,
|
|
636
635
|
children: i || s,
|
|
637
636
|
accessibilityLabel: `Send email to ${s}`,
|
|
@@ -666,35 +665,35 @@ const x = {
|
|
|
666
665
|
*/
|
|
667
666
|
social: {
|
|
668
667
|
twitter(s, e) {
|
|
669
|
-
return
|
|
668
|
+
return S.external(
|
|
670
669
|
`https://twitter.com/${s}`,
|
|
671
670
|
e || `@${s}`,
|
|
672
671
|
{ accessibilityLabel: `Visit ${s} on Twitter` }
|
|
673
672
|
);
|
|
674
673
|
},
|
|
675
674
|
github(s, e) {
|
|
676
|
-
return
|
|
675
|
+
return S.external(
|
|
677
676
|
`https://github.com/${s}`,
|
|
678
677
|
e || s,
|
|
679
678
|
{ accessibilityLabel: `Visit ${s} on GitHub` }
|
|
680
679
|
);
|
|
681
680
|
},
|
|
682
681
|
linkedin(s, e) {
|
|
683
|
-
return
|
|
682
|
+
return S.external(
|
|
684
683
|
`https://linkedin.com/in/${s}`,
|
|
685
684
|
e || s,
|
|
686
685
|
{ accessibilityLabel: `Visit ${s} on LinkedIn` }
|
|
687
686
|
);
|
|
688
687
|
},
|
|
689
688
|
instagram(s, e) {
|
|
690
|
-
return
|
|
689
|
+
return S.external(
|
|
691
690
|
`https://instagram.com/${s}`,
|
|
692
691
|
e || `@${s}`,
|
|
693
692
|
{ accessibilityLabel: `Visit ${s} on Instagram` }
|
|
694
693
|
);
|
|
695
694
|
},
|
|
696
695
|
facebook(s, e) {
|
|
697
|
-
return
|
|
696
|
+
return S.external(
|
|
698
697
|
`https://facebook.com/${s}`,
|
|
699
698
|
e || s,
|
|
700
699
|
{ accessibilityLabel: `Visit ${s} on Facebook` }
|
|
@@ -706,7 +705,7 @@ const x = {
|
|
|
706
705
|
*/
|
|
707
706
|
appStore: {
|
|
708
707
|
ios(s, e) {
|
|
709
|
-
return
|
|
708
|
+
return S.external(
|
|
710
709
|
`https://apps.apple.com/app/id${s}`,
|
|
711
710
|
e || "Download from App Store",
|
|
712
711
|
{
|
|
@@ -716,7 +715,7 @@ const x = {
|
|
|
716
715
|
);
|
|
717
716
|
},
|
|
718
717
|
android(s, e) {
|
|
719
|
-
return
|
|
718
|
+
return S.external(
|
|
720
719
|
`https://play.google.com/store/apps/details?id=${s}`,
|
|
721
720
|
e || "Get it on Google Play",
|
|
722
721
|
{
|
|
@@ -733,18 +732,18 @@ const x = {
|
|
|
733
732
|
return (e) => s(e) ? "handled" : "systemAction";
|
|
734
733
|
}
|
|
735
734
|
};
|
|
736
|
-
var
|
|
737
|
-
class
|
|
735
|
+
var ae = Object.defineProperty, le = (s, e, t) => e in s ? ae(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, x = (s, e, t) => le(s, typeof e != "symbol" ? e + "" : e, t);
|
|
736
|
+
class ce {
|
|
738
737
|
constructor(e) {
|
|
739
|
-
this.props = e,
|
|
738
|
+
this.props = e, x(this, "type", "component"), x(this, "id"), x(this, "mounted", !1), x(this, "cleanup", []), x(this, "toggleElement", null), x(this, "setIsAnimating"), x(this, "handleToggle", async (i) => {
|
|
740
739
|
if (i.preventDefault(), this.isDisabled()) return;
|
|
741
740
|
const r = !this.getIsOn();
|
|
742
741
|
this.props.animated !== !1 && (this.setIsAnimating(!0), setTimeout(() => {
|
|
743
742
|
this.setIsAnimating(!1);
|
|
744
743
|
}, 200)), this.props.onToggle && this.props.onToggle(r);
|
|
745
744
|
}), this.id = `toggle-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
746
|
-
const [, t] =
|
|
747
|
-
this.setIsAnimating = t,
|
|
745
|
+
const [, t] = R(!1);
|
|
746
|
+
this.setIsAnimating = t, j(() => {
|
|
748
747
|
const i = this.getIsOn();
|
|
749
748
|
this.toggleElement && this.toggleElement.checked !== i && (this.toggleElement.checked = i);
|
|
750
749
|
});
|
|
@@ -831,10 +830,10 @@ class oe {
|
|
|
831
830
|
renderSwitch() {
|
|
832
831
|
const e = this.getIsOn(), t = this.isDisabled(), i = this.getSizeStyles(), {
|
|
833
832
|
color: r = "#007AFF",
|
|
834
|
-
offColor:
|
|
835
|
-
thumbColor:
|
|
836
|
-
animated:
|
|
837
|
-
} = this.props,
|
|
833
|
+
offColor: o = "#e2e8f0",
|
|
834
|
+
thumbColor: n = "#ffffff",
|
|
835
|
+
animated: c = !0
|
|
836
|
+
} = this.props, f = e ? r : o, L = e ? `translateX(${parseInt(i.width) - parseInt(i.thumbSize) - 2}px)` : "translateX(2px)";
|
|
838
837
|
return a(
|
|
839
838
|
"div",
|
|
840
839
|
{
|
|
@@ -845,9 +844,9 @@ class oe {
|
|
|
845
844
|
},
|
|
846
845
|
// Hidden input for form integration
|
|
847
846
|
a("input", {
|
|
848
|
-
ref: (
|
|
849
|
-
this.toggleElement =
|
|
850
|
-
|
|
847
|
+
ref: (b) => {
|
|
848
|
+
this.toggleElement = b, b && !this.mounted && (b.addEventListener("change", this.handleToggle), this.cleanup.push(() => {
|
|
849
|
+
b.removeEventListener("change", this.handleToggle);
|
|
851
850
|
}));
|
|
852
851
|
},
|
|
853
852
|
type: "checkbox",
|
|
@@ -871,12 +870,12 @@ class oe {
|
|
|
871
870
|
style: {
|
|
872
871
|
width: i.width,
|
|
873
872
|
height: i.height,
|
|
874
|
-
backgroundColor:
|
|
873
|
+
backgroundColor: f,
|
|
875
874
|
borderRadius: i.height,
|
|
876
875
|
position: "relative",
|
|
877
876
|
cursor: t ? "not-allowed" : "pointer",
|
|
878
877
|
opacity: t ? 0.5 : 1,
|
|
879
|
-
transition:
|
|
878
|
+
transition: c ? "background-color 0.2s ease" : "none",
|
|
880
879
|
border: "1px solid rgba(0,0,0,0.1)",
|
|
881
880
|
boxShadow: "inset 0 1px 2px rgba(0,0,0,0.1)"
|
|
882
881
|
},
|
|
@@ -887,12 +886,12 @@ class oe {
|
|
|
887
886
|
style: {
|
|
888
887
|
width: i.thumbSize,
|
|
889
888
|
height: i.thumbSize,
|
|
890
|
-
backgroundColor:
|
|
889
|
+
backgroundColor: n,
|
|
891
890
|
borderRadius: "50%",
|
|
892
891
|
position: "absolute",
|
|
893
892
|
top: "50%",
|
|
894
|
-
transform: `translateY(-50%) ${
|
|
895
|
-
transition:
|
|
893
|
+
transform: `translateY(-50%) ${L}`,
|
|
894
|
+
transition: c ? "transform 0.2s ease" : "none",
|
|
896
895
|
boxShadow: "0 2px 4px rgba(0,0,0,0.2)",
|
|
897
896
|
border: "1px solid rgba(0,0,0,0.1)"
|
|
898
897
|
}
|
|
@@ -915,9 +914,9 @@ class oe {
|
|
|
915
914
|
},
|
|
916
915
|
// Hidden input
|
|
917
916
|
a("input", {
|
|
918
|
-
ref: (
|
|
919
|
-
this.toggleElement =
|
|
920
|
-
|
|
917
|
+
ref: (o) => {
|
|
918
|
+
this.toggleElement = o, o && !this.mounted && (o.addEventListener("change", this.handleToggle), this.cleanup.push(() => {
|
|
919
|
+
o.removeEventListener("change", this.handleToggle);
|
|
921
920
|
}));
|
|
922
921
|
},
|
|
923
922
|
type: "checkbox",
|
|
@@ -973,20 +972,20 @@ class oe {
|
|
|
973
972
|
* Render button variant
|
|
974
973
|
*/
|
|
975
974
|
renderButton() {
|
|
976
|
-
const e = this.getIsOn(), t = this.isDisabled(), i = this.getSizeStyles(), { color: r = "#007AFF", offColor:
|
|
975
|
+
const e = this.getIsOn(), t = this.isDisabled(), i = this.getSizeStyles(), { color: r = "#007AFF", offColor: o = "#f3f4f6" } = this.props;
|
|
977
976
|
return a(
|
|
978
977
|
"button",
|
|
979
978
|
{
|
|
980
|
-
ref: (
|
|
981
|
-
|
|
982
|
-
|
|
979
|
+
ref: (n) => {
|
|
980
|
+
n && !this.mounted && (n.addEventListener("click", this.handleToggle), this.cleanup.push(() => {
|
|
981
|
+
n.removeEventListener("click", this.handleToggle);
|
|
983
982
|
}));
|
|
984
983
|
},
|
|
985
984
|
type: "button",
|
|
986
985
|
disabled: t,
|
|
987
986
|
style: {
|
|
988
987
|
padding: "8px 16px",
|
|
989
|
-
backgroundColor: e ? r :
|
|
988
|
+
backgroundColor: e ? r : o,
|
|
990
989
|
color: e ? "#ffffff" : "#374151",
|
|
991
990
|
border: `1px solid ${e ? r : "#d1d5db"}`,
|
|
992
991
|
borderRadius: "6px",
|
|
@@ -1000,7 +999,7 @@ class oe {
|
|
|
1000
999
|
"aria-pressed": e,
|
|
1001
1000
|
"aria-label": this.props.accessibilityLabel
|
|
1002
1001
|
},
|
|
1003
|
-
|
|
1002
|
+
d(e ? "ON" : "OFF")
|
|
1004
1003
|
);
|
|
1005
1004
|
}
|
|
1006
1005
|
/**
|
|
@@ -1034,7 +1033,7 @@ class oe {
|
|
|
1034
1033
|
},
|
|
1035
1034
|
onClick: this.isDisabled() ? void 0 : this.handleToggle
|
|
1036
1035
|
},
|
|
1037
|
-
...typeof e == "string" ? [
|
|
1036
|
+
...typeof e == "string" ? [d(e)] : this.renderComponentContent(e)
|
|
1038
1037
|
);
|
|
1039
1038
|
}
|
|
1040
1039
|
render() {
|
|
@@ -1042,7 +1041,7 @@ class oe {
|
|
|
1042
1041
|
labelPosition: e = "trailing",
|
|
1043
1042
|
spacing: t = 8,
|
|
1044
1043
|
accessibilityHint: i
|
|
1045
|
-
} = this.props, r = this.renderLabel(),
|
|
1044
|
+
} = this.props, r = this.renderLabel(), o = this.renderToggleControl(), n = e === "leading" && r ? [r, o] : r ? [o, r] : [o];
|
|
1046
1045
|
return a(
|
|
1047
1046
|
"div",
|
|
1048
1047
|
{
|
|
@@ -1054,7 +1053,7 @@ class oe {
|
|
|
1054
1053
|
},
|
|
1055
1054
|
"aria-describedby": i ? `${this.id}-hint` : void 0
|
|
1056
1055
|
},
|
|
1057
|
-
...
|
|
1056
|
+
...n,
|
|
1058
1057
|
...i ? [
|
|
1059
1058
|
a(
|
|
1060
1059
|
"div",
|
|
@@ -1068,75 +1067,75 @@ class oe {
|
|
|
1068
1067
|
width: "100%"
|
|
1069
1068
|
}
|
|
1070
1069
|
},
|
|
1071
|
-
|
|
1070
|
+
d(i)
|
|
1072
1071
|
)
|
|
1073
1072
|
] : []
|
|
1074
1073
|
);
|
|
1075
1074
|
}
|
|
1076
1075
|
}
|
|
1077
|
-
function
|
|
1078
|
-
const t = { ...e, isOn: s }, i = new
|
|
1076
|
+
function g(s, e = {}) {
|
|
1077
|
+
const t = { ...e, isOn: s }, i = new ce(t);
|
|
1079
1078
|
return T(i);
|
|
1080
1079
|
}
|
|
1081
|
-
function
|
|
1082
|
-
return
|
|
1080
|
+
function G(s, e, t = {}) {
|
|
1081
|
+
return g(e, { ...t, label: s });
|
|
1083
1082
|
}
|
|
1084
|
-
const
|
|
1083
|
+
const ye = {
|
|
1085
1084
|
/**
|
|
1086
1085
|
* Switch toggle (default)
|
|
1087
1086
|
*/
|
|
1088
1087
|
Switch(s, e = {}) {
|
|
1089
|
-
return
|
|
1088
|
+
return g(s, { ...e, variant: "switch" });
|
|
1090
1089
|
},
|
|
1091
1090
|
/**
|
|
1092
1091
|
* Checkbox toggle
|
|
1093
1092
|
*/
|
|
1094
1093
|
Checkbox(s, e = {}) {
|
|
1095
|
-
return
|
|
1094
|
+
return g(s, { ...e, variant: "checkbox" });
|
|
1096
1095
|
},
|
|
1097
1096
|
/**
|
|
1098
1097
|
* Button toggle
|
|
1099
1098
|
*/
|
|
1100
1099
|
Button(s, e = {}) {
|
|
1101
|
-
return
|
|
1100
|
+
return g(s, { ...e, variant: "button" });
|
|
1102
1101
|
},
|
|
1103
1102
|
/**
|
|
1104
1103
|
* Small toggle
|
|
1105
1104
|
*/
|
|
1106
1105
|
Small(s, e = {}) {
|
|
1107
|
-
return
|
|
1106
|
+
return g(s, { ...e, size: "small" });
|
|
1108
1107
|
},
|
|
1109
1108
|
/**
|
|
1110
1109
|
* Large toggle
|
|
1111
1110
|
*/
|
|
1112
1111
|
Large(s, e = {}) {
|
|
1113
|
-
return
|
|
1112
|
+
return g(s, { ...e, size: "large" });
|
|
1114
1113
|
},
|
|
1115
1114
|
/**
|
|
1116
1115
|
* Custom color toggle
|
|
1117
1116
|
*/
|
|
1118
1117
|
CustomColor(s, e, t = {}) {
|
|
1119
|
-
return
|
|
1118
|
+
return g(s, { ...t, color: e });
|
|
1120
1119
|
},
|
|
1121
1120
|
/**
|
|
1122
1121
|
* Toggle with leading label
|
|
1123
1122
|
*/
|
|
1124
1123
|
WithLeadingLabel(s, e, t = {}) {
|
|
1125
|
-
return
|
|
1124
|
+
return g(e, { ...t, label: s, labelPosition: "leading" });
|
|
1126
1125
|
},
|
|
1127
1126
|
/**
|
|
1128
1127
|
* Toggle with trailing label (default)
|
|
1129
1128
|
*/
|
|
1130
1129
|
WithTrailingLabel(s, e, t = {}) {
|
|
1131
|
-
return
|
|
1130
|
+
return g(e, { ...t, label: s, labelPosition: "trailing" });
|
|
1132
1131
|
}
|
|
1133
|
-
},
|
|
1132
|
+
}, Se = {
|
|
1134
1133
|
/**
|
|
1135
1134
|
* Create a toggle group with multiple options
|
|
1136
1135
|
*/
|
|
1137
1136
|
createGroup(s, e = {}) {
|
|
1138
1137
|
return s.map(
|
|
1139
|
-
(t) =>
|
|
1138
|
+
(t) => G(t.label, t.isOn, {
|
|
1140
1139
|
...e,
|
|
1141
1140
|
onToggle: t.onToggle
|
|
1142
1141
|
})
|
|
@@ -1148,10 +1147,10 @@ const fe = {
|
|
|
1148
1147
|
createExclusiveGroup(s, e, t, i = {}) {
|
|
1149
1148
|
const r = () => l(e) ? e() : e;
|
|
1150
1149
|
return s.map(
|
|
1151
|
-
(
|
|
1150
|
+
(o) => G(o.label, r() === o.key, {
|
|
1152
1151
|
...i,
|
|
1153
|
-
onToggle: (
|
|
1154
|
-
|
|
1152
|
+
onToggle: (n) => {
|
|
1153
|
+
n && t && t(o.key);
|
|
1155
1154
|
}
|
|
1156
1155
|
})
|
|
1157
1156
|
);
|
|
@@ -1188,22 +1187,22 @@ const fe = {
|
|
|
1188
1187
|
}
|
|
1189
1188
|
}
|
|
1190
1189
|
};
|
|
1191
|
-
var
|
|
1192
|
-
class
|
|
1190
|
+
var de = Object.defineProperty, pe = (s, e, t) => e in s ? de(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, u = (s, e, t) => pe(s, typeof e != "symbol" ? e + "" : e, t);
|
|
1191
|
+
class he {
|
|
1193
1192
|
constructor(e) {
|
|
1194
|
-
this.props = e,
|
|
1195
|
-
this.props.onSelectionChange && this.props.onSelectionChange(
|
|
1196
|
-
}),
|
|
1193
|
+
this.props = e, u(this, "type", "component"), u(this, "id"), u(this, "mounted", !1), u(this, "cleanup", []), u(this, "isOpen"), u(this, "setIsOpen"), u(this, "searchTerm"), u(this, "setSearchTerm"), u(this, "handleSelection", (n) => {
|
|
1194
|
+
this.props.onSelectionChange && this.props.onSelectionChange(n), (this.props.variant === "dropdown" || this.props.variant === "menu") && this.setIsOpen(!1), this.setSearchTerm("");
|
|
1195
|
+
}), u(this, "toggleOpen", () => {
|
|
1197
1196
|
this.isDisabled() || this.setIsOpen(!this.isOpen());
|
|
1198
1197
|
}), this.id = `picker-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
1199
|
-
const [t, i] =
|
|
1200
|
-
if (this.isOpen = t, this.setIsOpen = i, this.searchTerm = r, this.setSearchTerm =
|
|
1201
|
-
const
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1198
|
+
const [t, i] = R(!1), [r, o] = R("");
|
|
1199
|
+
if (this.isOpen = t, this.setIsOpen = i, this.searchTerm = r, this.setSearchTerm = o, typeof window < "u") {
|
|
1200
|
+
const n = (c) => {
|
|
1201
|
+
const f = document.getElementById(this.id);
|
|
1202
|
+
f && !f.contains(c.target) && this.setIsOpen(!1);
|
|
1204
1203
|
};
|
|
1205
|
-
document.addEventListener("click",
|
|
1206
|
-
document.removeEventListener("click",
|
|
1204
|
+
document.addEventListener("click", n), this.cleanup.push(() => {
|
|
1205
|
+
document.removeEventListener("click", n);
|
|
1207
1206
|
});
|
|
1208
1207
|
}
|
|
1209
1208
|
}
|
|
@@ -1316,7 +1315,7 @@ class de {
|
|
|
1316
1315
|
color: e ? "#1a1a1a" : "#6b7280"
|
|
1317
1316
|
}
|
|
1318
1317
|
},
|
|
1319
|
-
|
|
1318
|
+
d(
|
|
1320
1319
|
e?.label || this.props.placeholder || "Select an option"
|
|
1321
1320
|
)
|
|
1322
1321
|
),
|
|
@@ -1330,7 +1329,7 @@ class de {
|
|
|
1330
1329
|
transition: "transform 0.2s"
|
|
1331
1330
|
}
|
|
1332
1331
|
},
|
|
1333
|
-
|
|
1332
|
+
d("▼")
|
|
1334
1333
|
)
|
|
1335
1334
|
),
|
|
1336
1335
|
...r ? [
|
|
@@ -1365,9 +1364,9 @@ class de {
|
|
|
1365
1364
|
type: "text",
|
|
1366
1365
|
placeholder: "Search options...",
|
|
1367
1366
|
value: this.searchTerm(),
|
|
1368
|
-
onInput: (
|
|
1369
|
-
const
|
|
1370
|
-
this.setSearchTerm(
|
|
1367
|
+
onInput: (o) => {
|
|
1368
|
+
const n = o.target;
|
|
1369
|
+
this.setSearchTerm(n.value);
|
|
1371
1370
|
},
|
|
1372
1371
|
style: {
|
|
1373
1372
|
width: "100%",
|
|
@@ -1380,21 +1379,21 @@ class de {
|
|
|
1380
1379
|
)
|
|
1381
1380
|
] : [],
|
|
1382
1381
|
...t.map(
|
|
1383
|
-
(
|
|
1382
|
+
(o) => a(
|
|
1384
1383
|
"button",
|
|
1385
1384
|
{
|
|
1386
1385
|
type: "button",
|
|
1387
|
-
key: String(
|
|
1388
|
-
onClick: () => this.handleSelection(
|
|
1389
|
-
disabled:
|
|
1386
|
+
key: String(o.value),
|
|
1387
|
+
onClick: () => this.handleSelection(o.value),
|
|
1388
|
+
disabled: o.disabled,
|
|
1390
1389
|
style: {
|
|
1391
1390
|
width: "100%",
|
|
1392
1391
|
padding: "8px 12px",
|
|
1393
1392
|
textAlign: "left",
|
|
1394
|
-
backgroundColor:
|
|
1393
|
+
backgroundColor: o.value === this.getSelection() ? "#f3f4f6" : "transparent",
|
|
1395
1394
|
border: "none",
|
|
1396
|
-
cursor:
|
|
1397
|
-
opacity:
|
|
1395
|
+
cursor: o.disabled ? "not-allowed" : "pointer",
|
|
1396
|
+
opacity: o.disabled ? 0.5 : 1,
|
|
1398
1397
|
fontSize: "14px",
|
|
1399
1398
|
display: "flex",
|
|
1400
1399
|
alignItems: "center",
|
|
@@ -1404,18 +1403,18 @@ class de {
|
|
|
1404
1403
|
}
|
|
1405
1404
|
}
|
|
1406
1405
|
},
|
|
1407
|
-
...
|
|
1406
|
+
...o.icon ? [
|
|
1408
1407
|
a(
|
|
1409
1408
|
"span",
|
|
1410
1409
|
{ style: { fontSize: "16px" } },
|
|
1411
|
-
|
|
1410
|
+
d(o.icon)
|
|
1412
1411
|
)
|
|
1413
1412
|
] : [],
|
|
1414
1413
|
a(
|
|
1415
1414
|
"div",
|
|
1416
1415
|
{},
|
|
1417
|
-
a("div", {},
|
|
1418
|
-
...
|
|
1416
|
+
a("div", {}, d(o.label)),
|
|
1417
|
+
...o.description ? [
|
|
1419
1418
|
a(
|
|
1420
1419
|
"div",
|
|
1421
1420
|
{
|
|
@@ -1425,7 +1424,7 @@ class de {
|
|
|
1425
1424
|
marginTop: "2px"
|
|
1426
1425
|
}
|
|
1427
1426
|
},
|
|
1428
|
-
|
|
1427
|
+
d(o.description)
|
|
1429
1428
|
)
|
|
1430
1429
|
] : []
|
|
1431
1430
|
)
|
|
@@ -1442,7 +1441,7 @@ class de {
|
|
|
1442
1441
|
fontSize: "14px"
|
|
1443
1442
|
}
|
|
1444
1443
|
},
|
|
1445
|
-
|
|
1444
|
+
d("No options found")
|
|
1446
1445
|
)
|
|
1447
1446
|
] : []
|
|
1448
1447
|
)
|
|
@@ -1467,7 +1466,7 @@ class de {
|
|
|
1467
1466
|
"aria-label": this.props.accessibilityLabel
|
|
1468
1467
|
},
|
|
1469
1468
|
...e.map(
|
|
1470
|
-
(r,
|
|
1469
|
+
(r, o) => a(
|
|
1471
1470
|
"button",
|
|
1472
1471
|
{
|
|
1473
1472
|
type: "button",
|
|
@@ -1489,8 +1488,8 @@ class de {
|
|
|
1489
1488
|
boxShadow: r.value === t ? "0 1px 2px rgba(0, 0, 0, 0.1)" : "none",
|
|
1490
1489
|
transition: "all 0.2s",
|
|
1491
1490
|
margin: "0",
|
|
1492
|
-
...
|
|
1493
|
-
...
|
|
1491
|
+
...o === 0 && { marginRight: "1px" },
|
|
1492
|
+
...o === e.length - 1 && { marginLeft: "1px" }
|
|
1494
1493
|
}
|
|
1495
1494
|
},
|
|
1496
1495
|
...r.icon ? [
|
|
@@ -1502,10 +1501,10 @@ class de {
|
|
|
1502
1501
|
fontSize: "14px"
|
|
1503
1502
|
}
|
|
1504
1503
|
},
|
|
1505
|
-
|
|
1504
|
+
d(r.icon)
|
|
1506
1505
|
)
|
|
1507
1506
|
] : [],
|
|
1508
|
-
|
|
1507
|
+
d(r.label)
|
|
1509
1508
|
)
|
|
1510
1509
|
)
|
|
1511
1510
|
);
|
|
@@ -1520,10 +1519,10 @@ class de {
|
|
|
1520
1519
|
{
|
|
1521
1520
|
value: String(t),
|
|
1522
1521
|
onChange: (i) => {
|
|
1523
|
-
const r = i.target,
|
|
1524
|
-
(
|
|
1522
|
+
const r = i.target, o = e.find(
|
|
1523
|
+
(n) => String(n.value) === r.value
|
|
1525
1524
|
);
|
|
1526
|
-
|
|
1525
|
+
o && this.handleSelection(o.value);
|
|
1527
1526
|
},
|
|
1528
1527
|
disabled: this.isDisabled(),
|
|
1529
1528
|
style: {
|
|
@@ -1544,7 +1543,7 @@ class de {
|
|
|
1544
1543
|
value: String(i.value),
|
|
1545
1544
|
disabled: i.disabled
|
|
1546
1545
|
},
|
|
1547
|
-
|
|
1546
|
+
d(i.label)
|
|
1548
1547
|
)
|
|
1549
1548
|
)
|
|
1550
1549
|
);
|
|
@@ -1558,22 +1557,22 @@ class de {
|
|
|
1558
1557
|
"aria-label": t,
|
|
1559
1558
|
"aria-describedby": i ? `${this.id}-hint` : void 0
|
|
1560
1559
|
};
|
|
1561
|
-
let
|
|
1560
|
+
let o;
|
|
1562
1561
|
switch (e) {
|
|
1563
1562
|
case "segmented":
|
|
1564
|
-
|
|
1563
|
+
o = this.renderSegmented();
|
|
1565
1564
|
break;
|
|
1566
1565
|
case "wheel":
|
|
1567
|
-
|
|
1566
|
+
o = this.renderWheel();
|
|
1568
1567
|
break;
|
|
1569
1568
|
default:
|
|
1570
|
-
|
|
1569
|
+
o = this.renderDropdown();
|
|
1571
1570
|
break;
|
|
1572
1571
|
}
|
|
1573
1572
|
return a(
|
|
1574
1573
|
"div",
|
|
1575
1574
|
r,
|
|
1576
|
-
|
|
1575
|
+
o,
|
|
1577
1576
|
...i ? [
|
|
1578
1577
|
a(
|
|
1579
1578
|
"div",
|
|
@@ -1585,46 +1584,46 @@ class de {
|
|
|
1585
1584
|
marginTop: "4px"
|
|
1586
1585
|
}
|
|
1587
1586
|
},
|
|
1588
|
-
|
|
1587
|
+
d(i)
|
|
1589
1588
|
)
|
|
1590
1589
|
] : []
|
|
1591
1590
|
);
|
|
1592
1591
|
}
|
|
1593
1592
|
}
|
|
1594
|
-
function
|
|
1595
|
-
const i = { ...t, selection: s, options: e }, r = new
|
|
1593
|
+
function D(s, e, t = {}) {
|
|
1594
|
+
const i = { ...t, selection: s, options: e }, r = new he(i);
|
|
1596
1595
|
return T(r);
|
|
1597
1596
|
}
|
|
1598
|
-
const
|
|
1597
|
+
const xe = {
|
|
1599
1598
|
/**
|
|
1600
1599
|
* Dropdown picker (default)
|
|
1601
1600
|
*/
|
|
1602
1601
|
// biome-ignore lint/suspicious/noExplicitAny: Generic dropdown picker requires flexible type
|
|
1603
1602
|
Dropdown(s, e, t = {}) {
|
|
1604
|
-
return
|
|
1603
|
+
return D(s, e, { ...t, variant: "dropdown" });
|
|
1605
1604
|
},
|
|
1606
1605
|
/**
|
|
1607
1606
|
* Segmented picker
|
|
1608
1607
|
*/
|
|
1609
1608
|
// biome-ignore lint/suspicious/noExplicitAny: Generic segmented picker requires flexible type
|
|
1610
1609
|
Segmented(s, e, t = {}) {
|
|
1611
|
-
return
|
|
1610
|
+
return D(s, e, { ...t, variant: "segmented" });
|
|
1612
1611
|
},
|
|
1613
1612
|
/**
|
|
1614
1613
|
* Wheel picker (native select)
|
|
1615
1614
|
*/
|
|
1616
1615
|
// biome-ignore lint/suspicious/noExplicitAny: Generic wheel picker requires flexible type
|
|
1617
1616
|
Wheel(s, e, t = {}) {
|
|
1618
|
-
return
|
|
1617
|
+
return D(s, e, { ...t, variant: "wheel" });
|
|
1619
1618
|
},
|
|
1620
1619
|
/**
|
|
1621
1620
|
* Menu picker
|
|
1622
1621
|
*/
|
|
1623
1622
|
// biome-ignore lint/suspicious/noExplicitAny: Generic menu picker requires flexible type
|
|
1624
1623
|
Menu(s, e, t = {}) {
|
|
1625
|
-
return
|
|
1624
|
+
return D(s, e, { ...t, variant: "menu" });
|
|
1626
1625
|
}
|
|
1627
|
-
},
|
|
1626
|
+
}, ve = {
|
|
1628
1627
|
/**
|
|
1629
1628
|
* Create options from simple array
|
|
1630
1629
|
*/
|
|
@@ -1657,19 +1656,19 @@ const be = {
|
|
|
1657
1656
|
}
|
|
1658
1657
|
};
|
|
1659
1658
|
export {
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1659
|
+
k as B,
|
|
1660
|
+
z as E,
|
|
1661
|
+
me as L,
|
|
1662
|
+
D as P,
|
|
1663
|
+
g as T,
|
|
1664
|
+
be as a,
|
|
1665
|
+
S as b,
|
|
1666
|
+
ce as c,
|
|
1667
|
+
se as d,
|
|
1668
|
+
ye as e,
|
|
1669
|
+
Se as f,
|
|
1670
|
+
G as g,
|
|
1671
|
+
he as h,
|
|
1672
|
+
xe as i,
|
|
1673
|
+
ve as j
|
|
1675
1674
|
};
|