@tachui/primitives 0.8.33 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { withModifiers as A, ComponentWithCSSClasses as
|
|
2
|
-
import { createComponentInstance as
|
|
1
|
+
import { withModifiers as A, ComponentWithCSSClasses as J, createSignal as z, useLifecycle as Q, createEffect as X, isSignal as l, ColorAsset as $, h as a, text as d, ConcatenatedComponent as R, clonePropsPreservingReactivity as N, resetLifecycleState as U, createComputed as ee } from "@tachui/core";
|
|
2
|
+
import { createComponentInstance as te } from "@tachui/core/components";
|
|
3
3
|
import { T as W } from "./Text-DmpfnY1o.js";
|
|
4
|
-
var
|
|
5
|
-
const
|
|
4
|
+
var ie = Object.defineProperty, se = (s, e, t) => e in s ? ie(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, m = (s, e, t) => se(s, typeof e != "symbol" ? e + "" : e, t);
|
|
5
|
+
const ne = {
|
|
6
6
|
colors: {
|
|
7
7
|
primary: "#007AFF",
|
|
8
8
|
secondary: "#5856D6",
|
|
@@ -31,17 +31,17 @@ const se = {
|
|
|
31
31
|
large: { size: 18, weight: "600" }
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
class
|
|
35
|
-
constructor(e, t =
|
|
36
|
-
super(),
|
|
37
|
-
const [
|
|
38
|
-
this.stateSignal =
|
|
34
|
+
class F extends J {
|
|
35
|
+
constructor(e, t = ne) {
|
|
36
|
+
super(), m(this, "props", e), m(this, "type", "component"), m(this, "id"), m(this, "mounted", !1), m(this, "cleanup", []), m(this, "stateSignal"), m(this, "setState"), m(this, "theme"), this.id = `button-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, this.theme = t;
|
|
37
|
+
const [i, r] = z("normal");
|
|
38
|
+
this.stateSignal = i, this.setState = r, this.setupDOMEventListeners();
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Set up DOM event listeners for button interactions
|
|
42
42
|
*/
|
|
43
43
|
setupDOMEventListeners() {
|
|
44
|
-
|
|
44
|
+
Q(this, {
|
|
45
45
|
onDOMReady: (e, t) => {
|
|
46
46
|
t instanceof HTMLButtonElement && this.setupReactiveStyles(t);
|
|
47
47
|
}
|
|
@@ -51,12 +51,12 @@ class I extends q {
|
|
|
51
51
|
* Set up reactive style updates based on state changes
|
|
52
52
|
*/
|
|
53
53
|
setupReactiveStyles(e) {
|
|
54
|
-
const t =
|
|
54
|
+
const t = X(() => {
|
|
55
55
|
this.stateSignal(), this.isEnabled(), this.isLoading();
|
|
56
|
-
const { tint:
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
this.applyStylesToElement(e,
|
|
56
|
+
const { tint: i, backgroundColor: r, foregroundColor: n } = this.props;
|
|
57
|
+
i && l(i) ? i() : i instanceof $ && i.resolve(), r && l(r) ? r() : r instanceof $ && r.resolve(), n && l(n) ? n() : n instanceof $ && n.resolve();
|
|
58
|
+
const o = this.getButtonStyles();
|
|
59
|
+
this.applyStylesToElement(e, o);
|
|
60
60
|
});
|
|
61
61
|
this.cleanup.push(() => {
|
|
62
62
|
t && typeof t.dispose == "function" && t.dispose();
|
|
@@ -66,11 +66,11 @@ class I extends q {
|
|
|
66
66
|
* Apply computed styles to the button element, respecting modifier-applied styles
|
|
67
67
|
*/
|
|
68
68
|
applyStylesToElement(e, t) {
|
|
69
|
-
Object.entries(t).forEach(([
|
|
70
|
-
const n = this.camelToKebabCase(
|
|
71
|
-
if (typeof
|
|
72
|
-
const
|
|
73
|
-
process.env.NODE_ENV === "development" && n === "font-family" && (console.log("[Button.applyButtonStyles] Font-family check:"), console.log("[Button.applyButtonStyles] property:",
|
|
69
|
+
Object.entries(t).forEach(([i, r]) => {
|
|
70
|
+
const n = this.camelToKebabCase(i);
|
|
71
|
+
if (typeof r == "string" || typeof r == "number") {
|
|
72
|
+
const o = e.style.getPropertyValue(n), c = o && o !== "" && o !== "inherit";
|
|
73
|
+
process.env.NODE_ENV === "development" && n === "font-family" && (console.log("[Button.applyButtonStyles] Font-family check:"), console.log("[Button.applyButtonStyles] property:", i, "cssProperty:", n), console.log("[Button.applyButtonStyles] currentValue:", o), console.log("[Button.applyButtonStyles] hasModifierValue:", c), console.log("[Button.applyButtonStyles] will set to:", r)), n === "transform" ? e.style.setProperty(n, String(r)) : c ? process.env.NODE_ENV === "development" && n === "font-family" && console.log("[Button.applyButtonStyles] Button SKIPPED font-family (has modifier value):", o) : (e.style.setProperty(n, String(r)), process.env.NODE_ENV === "development" && n === "font-family" && (console.log("[Button.applyButtonStyles] Button SET font-family to:", String(r)), console.log("[Button.applyButtonStyles] Element after set:", e.style.fontFamily)));
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
}
|
|
@@ -126,20 +126,20 @@ class I extends q {
|
|
|
126
126
|
d(this.props.title || "")
|
|
127
127
|
)
|
|
128
128
|
);
|
|
129
|
-
const
|
|
129
|
+
const i = ["tachui-button"];
|
|
130
130
|
return [{
|
|
131
131
|
type: "element",
|
|
132
132
|
tag: "button",
|
|
133
133
|
props: {
|
|
134
|
-
className: this.createClassString(this.props,
|
|
134
|
+
className: this.createClassString(this.props, i),
|
|
135
135
|
type: "button",
|
|
136
136
|
disabled: typeof e == "boolean" ? !e : !e(),
|
|
137
137
|
// Invert enabled to disabled
|
|
138
138
|
onClick: this.props.action ? () => {
|
|
139
139
|
try {
|
|
140
140
|
this.props.action?.();
|
|
141
|
-
} catch (
|
|
142
|
-
console.error("Button action error:",
|
|
141
|
+
} catch (o) {
|
|
142
|
+
console.error("Button action error:", o);
|
|
143
143
|
}
|
|
144
144
|
} : void 0,
|
|
145
145
|
// Pass through debug label for debug system
|
|
@@ -166,21 +166,21 @@ class I extends q {
|
|
|
166
166
|
*/
|
|
167
167
|
hasColorModifiers() {
|
|
168
168
|
let e = this.modifiers;
|
|
169
|
-
return !e && this.modifierBuilder && (e = this.modifierBuilder.modifiers), !e && this.modifiableComponent && (e = this.modifiableComponent.modifiers), !e || !Array.isArray(e) ? !1 : e.some((t) => t.type === "appearance" || t.constructor?.name === "AppearanceModifier" ? t.properties && (t.properties.foregroundColor !== void 0 || t.properties.color !== void 0) : t.properties ? ["foregroundColor", "color", "textColor"].some((
|
|
169
|
+
return !e && this.modifierBuilder && (e = this.modifierBuilder.modifiers), !e && this.modifiableComponent && (e = this.modifiableComponent.modifiers), !e || !Array.isArray(e) ? !1 : e.some((t) => t.type === "appearance" || t.constructor?.name === "AppearanceModifier" ? t.properties && (t.properties.foregroundColor !== void 0 || t.properties.color !== void 0) : t.properties ? ["foregroundColor", "color", "textColor"].some((r) => t.properties[r] !== void 0) : !1);
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
172
|
* Check if the button has typography-related modifiers applied
|
|
173
173
|
*/
|
|
174
174
|
hasTypographyModifiers() {
|
|
175
175
|
let e = this.modifiers;
|
|
176
|
-
return !e && this.modifierBuilder && (e = this.modifierBuilder.modifiers), !e && this.modifiableComponent && (e = this.modifiableComponent.modifiers), !e || !Array.isArray(e) ? !1 : e.some((
|
|
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);
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
179
|
* Check if the button has a shadow modifier applied
|
|
180
180
|
*/
|
|
181
181
|
hasShadowModifier() {
|
|
182
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((
|
|
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
184
|
}
|
|
185
185
|
/**
|
|
186
186
|
* Get computed button styles based on variant, size, role, and state
|
|
@@ -190,17 +190,17 @@ class I extends q {
|
|
|
190
190
|
const {
|
|
191
191
|
variant: e,
|
|
192
192
|
size: t,
|
|
193
|
-
role:
|
|
194
|
-
tint:
|
|
193
|
+
role: i = "none",
|
|
194
|
+
tint: r,
|
|
195
195
|
backgroundColor: n,
|
|
196
|
-
foregroundColor:
|
|
197
|
-
} = this.props, c = this.stateSignal(),
|
|
196
|
+
foregroundColor: o
|
|
197
|
+
} = this.props, c = this.stateSignal(), h = this.isLoading(), T = this.isEnabled(), g = this.hasColorModifiers(), v = this.hasTypographyModifiers(), w = {
|
|
198
198
|
// Only set color property if no modifiers will handle it
|
|
199
199
|
// This prevents conflicts between Button styles and AppearanceModifier
|
|
200
|
-
...!
|
|
200
|
+
...!g && !o && !e && { color: "inherit" },
|
|
201
201
|
// Only set text-related properties if no typography modifiers will handle them
|
|
202
202
|
// This prevents conflicts between Button styles and TypographyModifier
|
|
203
|
-
...!
|
|
203
|
+
...!v && {
|
|
204
204
|
fontStyle: "inherit",
|
|
205
205
|
lineHeight: "inherit",
|
|
206
206
|
textTransform: "inherit",
|
|
@@ -215,40 +215,40 @@ class I extends q {
|
|
|
215
215
|
// Let modifiers control: fontFamily, fontSize, fontWeight, letterSpacing, textAlign
|
|
216
216
|
};
|
|
217
217
|
if (t) {
|
|
218
|
-
const
|
|
218
|
+
const k = this.theme.spacing[t] || this.theme.spacing.medium, K = this.theme.borderRadius[t] || this.theme.borderRadius.medium, H = this.theme.typography[t] || this.theme.typography.medium, q = {
|
|
219
219
|
small: "32px",
|
|
220
220
|
medium: "40px",
|
|
221
221
|
large: "48px"
|
|
222
222
|
};
|
|
223
|
-
|
|
223
|
+
w.padding = `${k}px ${k * 2}px`, w.borderRadius = `${K}px`, w.fontSize = `${H.size}px`, w.fontWeight = H.weight, w.minHeight = q[t];
|
|
224
224
|
}
|
|
225
|
-
let
|
|
226
|
-
const
|
|
225
|
+
let f = "transparent", S = "transparent", _ = "1px", C;
|
|
226
|
+
const Z = this.resolveColorValue(r), D = this.resolveColorValue(n), E = this.resolveColorValue(o);
|
|
227
227
|
if (e) {
|
|
228
|
-
const
|
|
228
|
+
const k = Z || this.theme.colors.primary;
|
|
229
229
|
switch (e) {
|
|
230
230
|
case "filled":
|
|
231
|
-
|
|
231
|
+
i === "destructive" ? f = this.theme.colors.destructive : i === "cancel" ? f = this.theme.colors.secondary : f = k, C = this.theme.colors.onPrimary;
|
|
232
232
|
break;
|
|
233
233
|
case "outlined":
|
|
234
|
-
|
|
234
|
+
S = i === "destructive" ? this.theme.colors.destructive : k, C = i === "destructive" ? this.theme.colors.destructive : k;
|
|
235
235
|
break;
|
|
236
236
|
case "bordered":
|
|
237
|
-
|
|
237
|
+
f = this.theme.colors.background, S = this.theme.colors.border;
|
|
238
238
|
break;
|
|
239
239
|
case "borderedProminent":
|
|
240
|
-
|
|
240
|
+
f = this.theme.colors.surface, S = this.theme.colors.primary, _ = "2px";
|
|
241
241
|
break;
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
D && (
|
|
245
|
-
let
|
|
246
|
-
T ?
|
|
244
|
+
D && (f = D), E && (C = E);
|
|
245
|
+
let P = "1", I = "auto", B, V = "none";
|
|
246
|
+
T ? h ? (P = "0.6", I = "none") : c === "pressed" ? (f = this.darkenColor(f, 0.1), S = this.darkenColor(S, 0.1), B = "scale(0.95)") : c === "focused" && (V = "0 0 0 3px #007AFF40") : (f = this.theme.colors.disabled, S = this.theme.colors.disabled, C = this.theme.colors.disabled, P = "0.6", I = "none");
|
|
247
247
|
const p = {
|
|
248
|
-
...
|
|
248
|
+
...w
|
|
249
249
|
// Size-based styles (only if size provided)
|
|
250
250
|
};
|
|
251
|
-
return e && (p.backgroundColor =
|
|
251
|
+
return e && (p.backgroundColor = f, p.borderColor = S, p.borderWidth = _, C !== void 0 && (p.color = C)), D && (p.backgroundColor = D), E && (p.color = E), p.cursor = T ? "pointer" : "not-allowed", p.opacity = P, p.pointerEvents = I, p.transform = B !== void 0 ? B : "none", this.hasShadowModifier() || (p.boxShadow = V), p.transition = "all 0.2s ease", p;
|
|
252
252
|
}
|
|
253
253
|
/**
|
|
254
254
|
* Handle button press with proper state management
|
|
@@ -279,8 +279,8 @@ class I extends q {
|
|
|
279
279
|
darkenColor(e, t) {
|
|
280
280
|
if (e === "transparent") return e;
|
|
281
281
|
if (e.startsWith("#")) {
|
|
282
|
-
const
|
|
283
|
-
return `#${(n << 16 |
|
|
282
|
+
const i = e.slice(1), r = parseInt(i, 16), n = Math.max(0, Math.floor((r >> 16) * (1 - t))), o = Math.max(0, Math.floor((r >> 8 & 255) * (1 - t))), c = Math.max(0, Math.floor((r & 255) * (1 - t)));
|
|
283
|
+
return `#${(n << 16 | o << 8 | c).toString(16).padStart(6, "0")}`;
|
|
284
284
|
}
|
|
285
285
|
return e;
|
|
286
286
|
}
|
|
@@ -291,16 +291,16 @@ class I extends q {
|
|
|
291
291
|
* Concatenate this button with another concatenatable component
|
|
292
292
|
*/
|
|
293
293
|
concat(e) {
|
|
294
|
-
const t = this.toSegment(),
|
|
295
|
-
totalSegments: e instanceof
|
|
296
|
-
accessibilityRole: e instanceof
|
|
294
|
+
const t = this.toSegment(), i = e.toSegment(), r = {
|
|
295
|
+
totalSegments: e instanceof R ? e.segments.length + 1 : 2,
|
|
296
|
+
accessibilityRole: e instanceof R ? this.mergeAccessibilityRoles(
|
|
297
297
|
"composite",
|
|
298
298
|
e.metadata.accessibilityRole
|
|
299
299
|
) : this.determineAccessibilityRole(e),
|
|
300
300
|
semanticStructure: "inline"
|
|
301
301
|
// Buttons are typically inline in concatenation
|
|
302
302
|
};
|
|
303
|
-
return new
|
|
303
|
+
return new R([t, i], r);
|
|
304
304
|
}
|
|
305
305
|
/**
|
|
306
306
|
* Convert this button to a segment for concatenation
|
|
@@ -352,13 +352,13 @@ class I extends q {
|
|
|
352
352
|
return e.deep ? this.deepClone() : this.shallowClone();
|
|
353
353
|
}
|
|
354
354
|
shallowClone() {
|
|
355
|
-
const e = N(this.props), t = new
|
|
355
|
+
const e = N(this.props), t = new F(e, this.theme);
|
|
356
356
|
return this.syncStateToClone(t), U(t), t;
|
|
357
357
|
}
|
|
358
358
|
deepClone() {
|
|
359
359
|
const e = N(this.props, {
|
|
360
360
|
deep: !0
|
|
361
|
-
}), t = new
|
|
361
|
+
}), t = new F(e, this.theme);
|
|
362
362
|
return this.syncStateToClone(t), U(t), t;
|
|
363
363
|
}
|
|
364
364
|
syncStateToClone(e) {
|
|
@@ -370,53 +370,59 @@ class I extends q {
|
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
|
-
function
|
|
374
|
-
const
|
|
373
|
+
function G(s, e, t = {}) {
|
|
374
|
+
const i = typeof e == "function" ? e : void 0, n = {
|
|
375
375
|
...e != null && typeof e != "function" ? e : t,
|
|
376
|
-
title:
|
|
377
|
-
...
|
|
378
|
-
},
|
|
379
|
-
return A(
|
|
376
|
+
title: s,
|
|
377
|
+
...i && { action: i }
|
|
378
|
+
}, o = te(F, n);
|
|
379
|
+
return A(o);
|
|
380
380
|
}
|
|
381
|
-
|
|
381
|
+
function L(s) {
|
|
382
|
+
return (t, i, r = {}) => i == null || typeof i == "function" ? G(t, i, {
|
|
383
|
+
...r,
|
|
384
|
+
...s
|
|
385
|
+
}) : G(t, { ...i, ...s });
|
|
386
|
+
}
|
|
387
|
+
const me = {
|
|
382
388
|
/**
|
|
383
389
|
* Filled button (primary)
|
|
384
390
|
*/
|
|
385
|
-
Filled: (
|
|
391
|
+
Filled: L({ variant: "filled" }),
|
|
386
392
|
/**
|
|
387
393
|
* Outlined button
|
|
388
394
|
*/
|
|
389
|
-
Outlined: (
|
|
395
|
+
Outlined: L({ variant: "outlined" }),
|
|
390
396
|
/**
|
|
391
397
|
* Plain button (text only)
|
|
392
398
|
*/
|
|
393
|
-
Plain: (
|
|
399
|
+
Plain: L({ variant: "plain" }),
|
|
394
400
|
/**
|
|
395
401
|
* Bordered button
|
|
396
402
|
*/
|
|
397
|
-
Bordered: (
|
|
403
|
+
Bordered: L({ variant: "bordered" }),
|
|
398
404
|
/**
|
|
399
405
|
* Destructive button
|
|
400
406
|
*/
|
|
401
|
-
Destructive: (
|
|
407
|
+
Destructive: L({ role: "destructive" }),
|
|
402
408
|
/**
|
|
403
409
|
* Cancel button
|
|
404
410
|
*/
|
|
405
|
-
Cancel: (
|
|
406
|
-
},
|
|
411
|
+
Cancel: L({ role: "cancel" })
|
|
412
|
+
}, re = `
|
|
407
413
|
@keyframes spin {
|
|
408
414
|
from { transform: rotate(0deg); }
|
|
409
415
|
to { transform: rotate(360deg); }
|
|
410
416
|
}
|
|
411
417
|
`;
|
|
412
418
|
if (typeof document < "u") {
|
|
413
|
-
const
|
|
414
|
-
|
|
419
|
+
const s = document.createElement("style");
|
|
420
|
+
s.textContent = re, document.head.appendChild(s);
|
|
415
421
|
}
|
|
416
|
-
var oe = Object.defineProperty,
|
|
417
|
-
class
|
|
422
|
+
var oe = Object.defineProperty, ae = (s, e, t) => e in s ? oe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, M = (s, e, t) => ae(s, typeof e != "symbol" ? e + "" : e, t);
|
|
423
|
+
class j {
|
|
418
424
|
constructor(e) {
|
|
419
|
-
|
|
425
|
+
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)}`;
|
|
420
426
|
}
|
|
421
427
|
resolveValue(e) {
|
|
422
428
|
return l(e) ? e() : e;
|
|
@@ -429,14 +435,14 @@ class G {
|
|
|
429
435
|
const e = this.resolveValue(this.props.target);
|
|
430
436
|
if (e)
|
|
431
437
|
return e;
|
|
432
|
-
const t = this.resolveValue(this.props.destination),
|
|
433
|
-
return this.isExternalURL(
|
|
438
|
+
const t = this.resolveValue(this.props.destination), i = t instanceof URL ? t.toString() : t;
|
|
439
|
+
return this.isExternalURL(i) ? "_blank" : "_self";
|
|
434
440
|
}
|
|
435
441
|
getRoutingMode() {
|
|
436
442
|
return this.resolveValue(this.props.routingMode) || "auto";
|
|
437
443
|
}
|
|
438
444
|
getRel() {
|
|
439
|
-
const e = this.resolveValue(this.props.rel), t = this.getTarget(),
|
|
445
|
+
const e = this.resolveValue(this.props.rel), t = this.getTarget(), i = this.getDestination(), n = this.isExternalURL(i) && t === "_blank" ? "noopener noreferrer" : "";
|
|
440
446
|
return e && n ? `${e} ${n}`.trim() : e || n;
|
|
441
447
|
}
|
|
442
448
|
getDownload() {
|
|
@@ -482,7 +488,7 @@ class G {
|
|
|
482
488
|
} catch (n) {
|
|
483
489
|
throw console.error("Link onBeforeNavigation error:", n), n;
|
|
484
490
|
}
|
|
485
|
-
const
|
|
491
|
+
const i = this.getTarget(), r = this.getRoutingMode();
|
|
486
492
|
if (this.shouldUseInternalRouting(t)) {
|
|
487
493
|
if (this.props.onInternalNavigation)
|
|
488
494
|
try {
|
|
@@ -491,9 +497,9 @@ class G {
|
|
|
491
497
|
} catch (n) {
|
|
492
498
|
console.error("Link onInternalNavigation error:", n);
|
|
493
499
|
}
|
|
494
|
-
|
|
500
|
+
r === "spa" ? this.handleSPANavigation(t) : i === "_blank" ? window.open(t, i) : window.location.href = t;
|
|
495
501
|
} else
|
|
496
|
-
|
|
502
|
+
i === "_blank" || i === "_top" || i === "_parent" ? window.open(t, i) : window.location.href = t;
|
|
497
503
|
}
|
|
498
504
|
handleSPANavigation(e) {
|
|
499
505
|
typeof window < "u" && window.history && window.history.pushState ? (window.history.pushState(null, "", e), window.dispatchEvent(new PopStateEvent("popstate"))) : window.location.href = e;
|
|
@@ -513,9 +519,9 @@ class G {
|
|
|
513
519
|
if (this.props.children)
|
|
514
520
|
return this.renderChildren();
|
|
515
521
|
let e;
|
|
516
|
-
this.props.text ? e = this.props.text : l(this.props.destination) ? e =
|
|
517
|
-
const
|
|
518
|
-
return Array.isArray(
|
|
522
|
+
this.props.text ? e = this.props.text : l(this.props.destination) ? e = ee(() => this.getDestination()) : e = this.getDestination();
|
|
523
|
+
const i = W(e).render();
|
|
524
|
+
return Array.isArray(i) ? i : [i];
|
|
519
525
|
}
|
|
520
526
|
renderChildren() {
|
|
521
527
|
const { children: e } = this.props;
|
|
@@ -523,43 +529,43 @@ class G {
|
|
|
523
529
|
}
|
|
524
530
|
renderChild(e) {
|
|
525
531
|
if (typeof e == "string") {
|
|
526
|
-
const
|
|
527
|
-
return Array.isArray(
|
|
532
|
+
const i = W(e).render();
|
|
533
|
+
return Array.isArray(i) ? i : [i];
|
|
528
534
|
} else {
|
|
529
535
|
const t = e.render();
|
|
530
536
|
return Array.isArray(t) ? t : [t];
|
|
531
537
|
}
|
|
532
538
|
}
|
|
533
539
|
render() {
|
|
534
|
-
const e = this.renderContent(), t = this.isDisabled(),
|
|
540
|
+
const e = this.renderContent(), t = this.isDisabled(), i = {
|
|
535
541
|
id: this.id,
|
|
536
542
|
"data-component": "enhanced-link"
|
|
537
543
|
};
|
|
538
|
-
l(this.props.destination) ?
|
|
539
|
-
const
|
|
540
|
-
|
|
544
|
+
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());
|
|
545
|
+
const r = this.getRel();
|
|
546
|
+
r && (l(this.props.rel) || l(this.props.target) ? i.rel = () => this.getRel() : i.rel = r);
|
|
541
547
|
const n = this.getDownload();
|
|
542
|
-
n !== void 0 && (l(this.props.download) ?
|
|
543
|
-
const
|
|
544
|
-
|
|
548
|
+
n !== void 0 && (l(this.props.download) ? i.download = () => this.getDownload() : n === !0 ? i.download = !0 : typeof n == "string" && (i.download = n));
|
|
549
|
+
const o = this.getAccessibilityLabel();
|
|
550
|
+
o && (l(this.props.accessibilityLabel) ? i["aria-label"] = () => this.getAccessibilityLabel() : i["aria-label"] = o);
|
|
545
551
|
const c = this.getAccessibilityHint();
|
|
546
|
-
c && (l(this.props.accessibilityHint) ?
|
|
547
|
-
const
|
|
548
|
-
return
|
|
552
|
+
c && (l(this.props.accessibilityHint) ? i["aria-describedby"] = () => this.getAccessibilityHint() : i["aria-describedby"] = c);
|
|
553
|
+
const h = this.getAccessibilityRole();
|
|
554
|
+
return h && (l(this.props.accessibilityRole) ? i.role = () => this.getAccessibilityRole() : i.role = h), t && (i["aria-disabled"] = "true", i.tabindex = "-1"), i.onclick = (g) => this.handleClick(g), i.style = {
|
|
549
555
|
textDecoration: "none",
|
|
550
556
|
color: "inherit",
|
|
551
557
|
cursor: t ? "not-allowed" : "pointer",
|
|
552
558
|
opacity: t ? 0.6 : 1
|
|
553
|
-
}, a("a",
|
|
559
|
+
}, a("a", i, ...e);
|
|
554
560
|
}
|
|
555
561
|
// Concatenation support
|
|
556
562
|
concat(e) {
|
|
557
|
-
const t = this.toSegment(),
|
|
563
|
+
const t = this.toSegment(), i = e.toSegment(), r = {
|
|
558
564
|
totalSegments: 2,
|
|
559
565
|
accessibilityRole: "composite",
|
|
560
566
|
semanticStructure: "inline"
|
|
561
567
|
};
|
|
562
|
-
return new
|
|
568
|
+
return new R([t, i], r);
|
|
563
569
|
}
|
|
564
570
|
toSegment() {
|
|
565
571
|
return {
|
|
@@ -573,24 +579,24 @@ class G {
|
|
|
573
579
|
return !0;
|
|
574
580
|
}
|
|
575
581
|
}
|
|
576
|
-
function
|
|
582
|
+
function ye(s, e) {
|
|
577
583
|
if (e !== void 0) {
|
|
578
|
-
const
|
|
579
|
-
text:
|
|
584
|
+
const r = {
|
|
585
|
+
text: s,
|
|
580
586
|
destination: e
|
|
581
|
-
}, n = new
|
|
587
|
+
}, n = new j(r);
|
|
582
588
|
return A(n);
|
|
583
589
|
}
|
|
584
|
-
const t =
|
|
585
|
-
return A(
|
|
590
|
+
const t = s, i = new j(t);
|
|
591
|
+
return A(i);
|
|
586
592
|
}
|
|
587
593
|
const x = {
|
|
588
594
|
/**
|
|
589
595
|
* Create an external link that opens in a new tab
|
|
590
596
|
*/
|
|
591
|
-
external(
|
|
597
|
+
external(s, e, t = {}) {
|
|
592
598
|
return {
|
|
593
|
-
destination:
|
|
599
|
+
destination: s,
|
|
594
600
|
children: e,
|
|
595
601
|
target: "_blank",
|
|
596
602
|
routingMode: "external",
|
|
@@ -602,9 +608,9 @@ const x = {
|
|
|
602
608
|
/**
|
|
603
609
|
* Create an internal link for same-domain navigation
|
|
604
610
|
*/
|
|
605
|
-
internal(
|
|
611
|
+
internal(s, e, t = {}) {
|
|
606
612
|
return {
|
|
607
|
-
destination:
|
|
613
|
+
destination: s,
|
|
608
614
|
children: e,
|
|
609
615
|
routingMode: "internal",
|
|
610
616
|
target: "_self",
|
|
@@ -614,9 +620,9 @@ const x = {
|
|
|
614
620
|
/**
|
|
615
621
|
* Create a SPA link using History API
|
|
616
622
|
*/
|
|
617
|
-
spa(
|
|
623
|
+
spa(s, e, t = {}) {
|
|
618
624
|
return {
|
|
619
|
-
destination:
|
|
625
|
+
destination: s,
|
|
620
626
|
children: e,
|
|
621
627
|
routingMode: "spa",
|
|
622
628
|
target: "_self",
|
|
@@ -627,33 +633,33 @@ const x = {
|
|
|
627
633
|
/**
|
|
628
634
|
* Create an email link with optional subject and body
|
|
629
635
|
*/
|
|
630
|
-
email(
|
|
631
|
-
let
|
|
636
|
+
email(s, e, t, i) {
|
|
637
|
+
let r = `mailto:${s}`;
|
|
632
638
|
const n = new URLSearchParams();
|
|
633
|
-
return e && n.append("subject", e), t && n.append("body", t), n.toString() && (
|
|
634
|
-
destination:
|
|
635
|
-
children:
|
|
636
|
-
accessibilityLabel: `Send email to ${
|
|
639
|
+
return e && n.append("subject", e), t && n.append("body", t), n.toString() && (r += `?${n.toString()}`), {
|
|
640
|
+
destination: r,
|
|
641
|
+
children: i || s,
|
|
642
|
+
accessibilityLabel: `Send email to ${s}`,
|
|
637
643
|
accessibilityHint: "Opens your email app"
|
|
638
644
|
};
|
|
639
645
|
},
|
|
640
646
|
/**
|
|
641
647
|
* Create a phone link with formatted display
|
|
642
648
|
*/
|
|
643
|
-
phone(
|
|
649
|
+
phone(s, e) {
|
|
644
650
|
return {
|
|
645
|
-
destination: `tel:${
|
|
646
|
-
children: e ||
|
|
647
|
-
accessibilityLabel: `Call ${
|
|
651
|
+
destination: `tel:${s.replace(/[^\d+]/g, "")}`,
|
|
652
|
+
children: e || s,
|
|
653
|
+
accessibilityLabel: `Call ${s}`,
|
|
648
654
|
accessibilityHint: "Opens your phone app"
|
|
649
655
|
};
|
|
650
656
|
},
|
|
651
657
|
/**
|
|
652
658
|
* Create a download link
|
|
653
659
|
*/
|
|
654
|
-
download(
|
|
660
|
+
download(s, e, t) {
|
|
655
661
|
return {
|
|
656
|
-
destination:
|
|
662
|
+
destination: s,
|
|
657
663
|
children: t || `Download ${e || "file"}`,
|
|
658
664
|
download: e || !0,
|
|
659
665
|
accessibilityLabel: `Download ${e || "file"}`,
|
|
@@ -664,39 +670,39 @@ const x = {
|
|
|
664
670
|
* Social media link utilities
|
|
665
671
|
*/
|
|
666
672
|
social: {
|
|
667
|
-
twitter(
|
|
673
|
+
twitter(s, e) {
|
|
668
674
|
return x.external(
|
|
669
|
-
`https://twitter.com/${
|
|
670
|
-
e || `@${
|
|
671
|
-
{ accessibilityLabel: `Visit ${
|
|
675
|
+
`https://twitter.com/${s}`,
|
|
676
|
+
e || `@${s}`,
|
|
677
|
+
{ accessibilityLabel: `Visit ${s} on Twitter` }
|
|
672
678
|
);
|
|
673
679
|
},
|
|
674
|
-
github(
|
|
680
|
+
github(s, e) {
|
|
675
681
|
return x.external(
|
|
676
|
-
`https://github.com/${
|
|
677
|
-
e ||
|
|
678
|
-
{ accessibilityLabel: `Visit ${
|
|
682
|
+
`https://github.com/${s}`,
|
|
683
|
+
e || s,
|
|
684
|
+
{ accessibilityLabel: `Visit ${s} on GitHub` }
|
|
679
685
|
);
|
|
680
686
|
},
|
|
681
|
-
linkedin(
|
|
687
|
+
linkedin(s, e) {
|
|
682
688
|
return x.external(
|
|
683
|
-
`https://linkedin.com/in/${
|
|
684
|
-
e ||
|
|
685
|
-
{ accessibilityLabel: `Visit ${
|
|
689
|
+
`https://linkedin.com/in/${s}`,
|
|
690
|
+
e || s,
|
|
691
|
+
{ accessibilityLabel: `Visit ${s} on LinkedIn` }
|
|
686
692
|
);
|
|
687
693
|
},
|
|
688
|
-
instagram(
|
|
694
|
+
instagram(s, e) {
|
|
689
695
|
return x.external(
|
|
690
|
-
`https://instagram.com/${
|
|
691
|
-
e || `@${
|
|
692
|
-
{ accessibilityLabel: `Visit ${
|
|
696
|
+
`https://instagram.com/${s}`,
|
|
697
|
+
e || `@${s}`,
|
|
698
|
+
{ accessibilityLabel: `Visit ${s} on Instagram` }
|
|
693
699
|
);
|
|
694
700
|
},
|
|
695
|
-
facebook(
|
|
701
|
+
facebook(s, e) {
|
|
696
702
|
return x.external(
|
|
697
|
-
`https://facebook.com/${
|
|
698
|
-
e ||
|
|
699
|
-
{ accessibilityLabel: `Visit ${
|
|
703
|
+
`https://facebook.com/${s}`,
|
|
704
|
+
e || s,
|
|
705
|
+
{ accessibilityLabel: `Visit ${s} on Facebook` }
|
|
700
706
|
);
|
|
701
707
|
}
|
|
702
708
|
},
|
|
@@ -704,9 +710,9 @@ const x = {
|
|
|
704
710
|
* App store link utilities
|
|
705
711
|
*/
|
|
706
712
|
appStore: {
|
|
707
|
-
ios(
|
|
713
|
+
ios(s, e) {
|
|
708
714
|
return x.external(
|
|
709
|
-
`https://apps.apple.com/app/id${
|
|
715
|
+
`https://apps.apple.com/app/id${s}`,
|
|
710
716
|
e || "Download from App Store",
|
|
711
717
|
{
|
|
712
718
|
accessibilityLabel: "Download from the iOS App Store",
|
|
@@ -714,9 +720,9 @@ const x = {
|
|
|
714
720
|
}
|
|
715
721
|
);
|
|
716
722
|
},
|
|
717
|
-
android(
|
|
723
|
+
android(s, e) {
|
|
718
724
|
return x.external(
|
|
719
|
-
`https://play.google.com/store/apps/details?id=${
|
|
725
|
+
`https://play.google.com/store/apps/details?id=${s}`,
|
|
720
726
|
e || "Get it on Google Play",
|
|
721
727
|
{
|
|
722
728
|
accessibilityLabel: "Download from Google Play Store",
|
|
@@ -728,24 +734,24 @@ const x = {
|
|
|
728
734
|
/**
|
|
729
735
|
* Create a custom OpenURL action
|
|
730
736
|
*/
|
|
731
|
-
openURLAction(
|
|
732
|
-
return (e) =>
|
|
737
|
+
openURLAction(s) {
|
|
738
|
+
return (e) => s(e) ? "handled" : "systemAction";
|
|
733
739
|
}
|
|
734
740
|
};
|
|
735
|
-
var
|
|
736
|
-
class
|
|
741
|
+
var le = Object.defineProperty, ce = (s, e, t) => e in s ? le(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, y = (s, e, t) => ce(s, typeof e != "symbol" ? e + "" : e, t);
|
|
742
|
+
class de {
|
|
737
743
|
constructor(e) {
|
|
738
|
-
|
|
739
|
-
if (
|
|
740
|
-
const
|
|
744
|
+
y(this, "props", e), y(this, "type", "component"), y(this, "id"), y(this, "mounted", !1), y(this, "cleanup", []), y(this, "toggleElement", null), y(this, "setIsAnimating"), y(this, "handleToggle", async (i) => {
|
|
745
|
+
if (i.preventDefault(), this.isDisabled()) return;
|
|
746
|
+
const r = !this.getIsOn();
|
|
741
747
|
this.props.animated !== !1 && (this.setIsAnimating(!0), setTimeout(() => {
|
|
742
748
|
this.setIsAnimating(!1);
|
|
743
|
-
}, 200)), this.props.onToggle && this.props.onToggle(
|
|
749
|
+
}, 200)), this.props.onToggle && this.props.onToggle(r);
|
|
744
750
|
}), this.id = `toggle-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
745
|
-
const [, t] =
|
|
746
|
-
this.setIsAnimating = t,
|
|
747
|
-
const
|
|
748
|
-
this.toggleElement && this.toggleElement.checked !==
|
|
751
|
+
const [, t] = z(!1);
|
|
752
|
+
this.setIsAnimating = t, X(() => {
|
|
753
|
+
const i = this.getIsOn();
|
|
754
|
+
this.toggleElement && this.toggleElement.checked !== i && (this.toggleElement.checked = i);
|
|
749
755
|
});
|
|
750
756
|
}
|
|
751
757
|
/**
|
|
@@ -843,12 +849,12 @@ class ce {
|
|
|
843
849
|
* Render switch variant
|
|
844
850
|
*/
|
|
845
851
|
renderSwitch() {
|
|
846
|
-
const e = this.getIsOn(), t = this.isDisabled(),
|
|
847
|
-
color:
|
|
852
|
+
const e = this.getIsOn(), t = this.isDisabled(), i = this.getSizeStyles(), {
|
|
853
|
+
color: r = "#007AFF",
|
|
848
854
|
offColor: n = "#e2e8f0",
|
|
849
|
-
thumbColor:
|
|
855
|
+
thumbColor: o = "#ffffff",
|
|
850
856
|
animated: c = !0
|
|
851
|
-
} = this.props,
|
|
857
|
+
} = this.props, h = e ? r : n, T = e ? `translateX(${parseInt(i.width) - parseInt(i.thumbSize) - 2}px)` : "translateX(2px)", g = this.getInputAccessibilityProps();
|
|
852
858
|
return a(
|
|
853
859
|
"div",
|
|
854
860
|
{
|
|
@@ -859,13 +865,13 @@ class ce {
|
|
|
859
865
|
},
|
|
860
866
|
// Hidden input for form integration
|
|
861
867
|
a("input", {
|
|
862
|
-
ref: (
|
|
863
|
-
this.toggleElement =
|
|
864
|
-
|
|
868
|
+
ref: (v) => {
|
|
869
|
+
this.toggleElement = v, v && !this.mounted && (v.addEventListener("change", this.handleToggle), this.cleanup.push(() => {
|
|
870
|
+
v.removeEventListener("change", this.handleToggle);
|
|
865
871
|
}));
|
|
866
872
|
},
|
|
867
873
|
type: "checkbox",
|
|
868
|
-
id:
|
|
874
|
+
id: g.id,
|
|
869
875
|
checked: e,
|
|
870
876
|
disabled: t,
|
|
871
877
|
style: {
|
|
@@ -876,19 +882,19 @@ class ce {
|
|
|
876
882
|
margin: 0,
|
|
877
883
|
cursor: t ? "not-allowed" : "pointer"
|
|
878
884
|
},
|
|
879
|
-
"aria-label":
|
|
880
|
-
"aria-labelledby":
|
|
881
|
-
"aria-describedby":
|
|
885
|
+
"aria-label": g["aria-label"],
|
|
886
|
+
"aria-labelledby": g["aria-labelledby"],
|
|
887
|
+
"aria-describedby": g["aria-describedby"]
|
|
882
888
|
}),
|
|
883
889
|
// Switch track
|
|
884
890
|
a(
|
|
885
891
|
"div",
|
|
886
892
|
{
|
|
887
893
|
style: {
|
|
888
|
-
width:
|
|
889
|
-
height:
|
|
890
|
-
backgroundColor:
|
|
891
|
-
borderRadius:
|
|
894
|
+
width: i.width,
|
|
895
|
+
height: i.height,
|
|
896
|
+
backgroundColor: h,
|
|
897
|
+
borderRadius: i.height,
|
|
892
898
|
position: "relative",
|
|
893
899
|
cursor: t ? "not-allowed" : "pointer",
|
|
894
900
|
opacity: t ? 0.5 : 1,
|
|
@@ -900,9 +906,9 @@ class ce {
|
|
|
900
906
|
// Switch thumb
|
|
901
907
|
a("div", {
|
|
902
908
|
style: {
|
|
903
|
-
width:
|
|
904
|
-
height:
|
|
905
|
-
backgroundColor:
|
|
909
|
+
width: i.thumbSize,
|
|
910
|
+
height: i.thumbSize,
|
|
911
|
+
backgroundColor: o,
|
|
906
912
|
borderRadius: "50%",
|
|
907
913
|
position: "absolute",
|
|
908
914
|
top: "50%",
|
|
@@ -919,7 +925,7 @@ class ce {
|
|
|
919
925
|
* Render checkbox variant
|
|
920
926
|
*/
|
|
921
927
|
renderCheckbox() {
|
|
922
|
-
const e = this.getIsOn(), t = this.isDisabled(),
|
|
928
|
+
const e = this.getIsOn(), t = this.isDisabled(), i = this.getSizeStyles(), { color: r = "#007AFF" } = this.props, n = this.getInputAccessibilityProps();
|
|
923
929
|
return a(
|
|
924
930
|
"div",
|
|
925
931
|
{
|
|
@@ -930,9 +936,9 @@ class ce {
|
|
|
930
936
|
},
|
|
931
937
|
// Hidden input
|
|
932
938
|
a("input", {
|
|
933
|
-
ref: (
|
|
934
|
-
this.toggleElement =
|
|
935
|
-
|
|
939
|
+
ref: (o) => {
|
|
940
|
+
this.toggleElement = o, o && !this.mounted && (o.addEventListener("change", this.handleToggle), this.cleanup.push(() => {
|
|
941
|
+
o.removeEventListener("change", this.handleToggle);
|
|
936
942
|
}));
|
|
937
943
|
},
|
|
938
944
|
type: "checkbox",
|
|
@@ -956,11 +962,11 @@ class ce {
|
|
|
956
962
|
"div",
|
|
957
963
|
{
|
|
958
964
|
style: {
|
|
959
|
-
width:
|
|
960
|
-
height:
|
|
961
|
-
border: `2px solid ${e ?
|
|
965
|
+
width: i.thumbSize,
|
|
966
|
+
height: i.thumbSize,
|
|
967
|
+
border: `2px solid ${e ? r : "#d1d5db"}`,
|
|
962
968
|
borderRadius: "4px",
|
|
963
|
-
backgroundColor: e ?
|
|
969
|
+
backgroundColor: e ? r : "#ffffff",
|
|
964
970
|
display: "flex",
|
|
965
971
|
alignItems: "center",
|
|
966
972
|
justifyContent: "center",
|
|
@@ -991,24 +997,24 @@ class ce {
|
|
|
991
997
|
* Render button variant
|
|
992
998
|
*/
|
|
993
999
|
renderButton() {
|
|
994
|
-
const e = this.getIsOn(), t = this.isDisabled(),
|
|
1000
|
+
const e = this.getIsOn(), t = this.isDisabled(), i = this.getSizeStyles(), { color: r = "#007AFF", offColor: n = "#f3f4f6" } = this.props;
|
|
995
1001
|
return a(
|
|
996
1002
|
"button",
|
|
997
1003
|
{
|
|
998
|
-
ref: (
|
|
999
|
-
|
|
1000
|
-
|
|
1004
|
+
ref: (o) => {
|
|
1005
|
+
o && !this.mounted && (o.addEventListener("click", this.handleToggle), this.cleanup.push(() => {
|
|
1006
|
+
o.removeEventListener("click", this.handleToggle);
|
|
1001
1007
|
}));
|
|
1002
1008
|
},
|
|
1003
1009
|
type: "button",
|
|
1004
1010
|
disabled: t,
|
|
1005
1011
|
style: {
|
|
1006
1012
|
padding: "8px 16px",
|
|
1007
|
-
backgroundColor: e ?
|
|
1013
|
+
backgroundColor: e ? r : n,
|
|
1008
1014
|
color: e ? "#ffffff" : "#374151",
|
|
1009
|
-
border: `1px solid ${e ?
|
|
1015
|
+
border: `1px solid ${e ? r : "#d1d5db"}`,
|
|
1010
1016
|
borderRadius: "6px",
|
|
1011
|
-
fontSize:
|
|
1017
|
+
fontSize: i.fontSize,
|
|
1012
1018
|
fontWeight: "500",
|
|
1013
1019
|
cursor: t ? "not-allowed" : "pointer",
|
|
1014
1020
|
opacity: t ? 0.5 : 1,
|
|
@@ -1041,13 +1047,13 @@ class ce {
|
|
|
1041
1047
|
renderLabel(e = !1) {
|
|
1042
1048
|
const t = this.resolveLabel();
|
|
1043
1049
|
if (!t) return null;
|
|
1044
|
-
const
|
|
1050
|
+
const i = this.getSizeStyles();
|
|
1045
1051
|
return a(
|
|
1046
1052
|
"span",
|
|
1047
1053
|
{
|
|
1048
1054
|
id: this.getLabelId(),
|
|
1049
1055
|
style: {
|
|
1050
|
-
fontSize:
|
|
1056
|
+
fontSize: i.fontSize,
|
|
1051
1057
|
color: this.isDisabled() ? "#9ca3af" : "#374151",
|
|
1052
1058
|
cursor: this.isDisabled() ? "not-allowed" : "pointer"
|
|
1053
1059
|
},
|
|
@@ -1060,15 +1066,15 @@ class ce {
|
|
|
1060
1066
|
const {
|
|
1061
1067
|
variant: e = "switch",
|
|
1062
1068
|
labelPosition: t = "trailing",
|
|
1063
|
-
spacing:
|
|
1064
|
-
accessibilityHint:
|
|
1065
|
-
} = this.props, n = this.renderLabel(e === "button"),
|
|
1069
|
+
spacing: i = 8,
|
|
1070
|
+
accessibilityHint: r
|
|
1071
|
+
} = this.props, n = this.renderLabel(e === "button"), o = this.renderToggleControl(), c = t === "leading" && n ? [n, o] : n ? [o, n] : [o], h = e === "button" ? a(
|
|
1066
1072
|
"div",
|
|
1067
1073
|
{
|
|
1068
1074
|
style: {
|
|
1069
1075
|
display: "flex",
|
|
1070
1076
|
alignItems: "center",
|
|
1071
|
-
gap: n ? `${
|
|
1077
|
+
gap: n ? `${i}px` : "0",
|
|
1072
1078
|
cursor: this.isDisabled() ? "not-allowed" : "pointer"
|
|
1073
1079
|
}
|
|
1074
1080
|
},
|
|
@@ -1080,7 +1086,7 @@ class ce {
|
|
|
1080
1086
|
style: {
|
|
1081
1087
|
display: "flex",
|
|
1082
1088
|
alignItems: "center",
|
|
1083
|
-
gap: n ? `${
|
|
1089
|
+
gap: n ? `${i}px` : "0",
|
|
1084
1090
|
cursor: this.isDisabled() ? "not-allowed" : "pointer"
|
|
1085
1091
|
}
|
|
1086
1092
|
},
|
|
@@ -1089,10 +1095,10 @@ class ce {
|
|
|
1089
1095
|
return a(
|
|
1090
1096
|
"div",
|
|
1091
1097
|
{
|
|
1092
|
-
"aria-describedby":
|
|
1098
|
+
"aria-describedby": r ? `${this.id}-hint` : void 0
|
|
1093
1099
|
},
|
|
1094
|
-
|
|
1095
|
-
...
|
|
1100
|
+
h,
|
|
1101
|
+
...r ? [
|
|
1096
1102
|
a(
|
|
1097
1103
|
"div",
|
|
1098
1104
|
{
|
|
@@ -1105,75 +1111,75 @@ class ce {
|
|
|
1105
1111
|
width: "100%"
|
|
1106
1112
|
}
|
|
1107
1113
|
},
|
|
1108
|
-
d(
|
|
1114
|
+
d(r)
|
|
1109
1115
|
)
|
|
1110
1116
|
] : []
|
|
1111
1117
|
);
|
|
1112
1118
|
}
|
|
1113
1119
|
}
|
|
1114
|
-
function
|
|
1115
|
-
const t = { ...e, isOn:
|
|
1116
|
-
return A(
|
|
1120
|
+
function b(s, e = {}) {
|
|
1121
|
+
const t = { ...e, isOn: s }, i = new de(t);
|
|
1122
|
+
return A(i);
|
|
1117
1123
|
}
|
|
1118
|
-
function
|
|
1119
|
-
return
|
|
1124
|
+
function Y(s, e, t = {}) {
|
|
1125
|
+
return b(e, { ...t, label: s });
|
|
1120
1126
|
}
|
|
1121
|
-
const
|
|
1127
|
+
const Se = {
|
|
1122
1128
|
/**
|
|
1123
1129
|
* Switch toggle (default)
|
|
1124
1130
|
*/
|
|
1125
|
-
Switch(
|
|
1126
|
-
return
|
|
1131
|
+
Switch(s, e = {}) {
|
|
1132
|
+
return b(s, { ...e, variant: "switch" });
|
|
1127
1133
|
},
|
|
1128
1134
|
/**
|
|
1129
1135
|
* Checkbox toggle
|
|
1130
1136
|
*/
|
|
1131
|
-
Checkbox(
|
|
1132
|
-
return
|
|
1137
|
+
Checkbox(s, e = {}) {
|
|
1138
|
+
return b(s, { ...e, variant: "checkbox" });
|
|
1133
1139
|
},
|
|
1134
1140
|
/**
|
|
1135
1141
|
* Button toggle
|
|
1136
1142
|
*/
|
|
1137
|
-
Button(
|
|
1138
|
-
return
|
|
1143
|
+
Button(s, e = {}) {
|
|
1144
|
+
return b(s, { ...e, variant: "button" });
|
|
1139
1145
|
},
|
|
1140
1146
|
/**
|
|
1141
1147
|
* Small toggle
|
|
1142
1148
|
*/
|
|
1143
|
-
Small(
|
|
1144
|
-
return
|
|
1149
|
+
Small(s, e = {}) {
|
|
1150
|
+
return b(s, { ...e, size: "small" });
|
|
1145
1151
|
},
|
|
1146
1152
|
/**
|
|
1147
1153
|
* Large toggle
|
|
1148
1154
|
*/
|
|
1149
|
-
Large(
|
|
1150
|
-
return
|
|
1155
|
+
Large(s, e = {}) {
|
|
1156
|
+
return b(s, { ...e, size: "large" });
|
|
1151
1157
|
},
|
|
1152
1158
|
/**
|
|
1153
1159
|
* Custom color toggle
|
|
1154
1160
|
*/
|
|
1155
|
-
CustomColor(
|
|
1156
|
-
return
|
|
1161
|
+
CustomColor(s, e, t = {}) {
|
|
1162
|
+
return b(s, { ...t, color: e });
|
|
1157
1163
|
},
|
|
1158
1164
|
/**
|
|
1159
1165
|
* Toggle with leading label
|
|
1160
1166
|
*/
|
|
1161
|
-
WithLeadingLabel(
|
|
1162
|
-
return
|
|
1167
|
+
WithLeadingLabel(s, e, t = {}) {
|
|
1168
|
+
return b(e, { ...t, label: s, labelPosition: "leading" });
|
|
1163
1169
|
},
|
|
1164
1170
|
/**
|
|
1165
1171
|
* Toggle with trailing label (default)
|
|
1166
1172
|
*/
|
|
1167
|
-
WithTrailingLabel(
|
|
1168
|
-
return
|
|
1173
|
+
WithTrailingLabel(s, e, t = {}) {
|
|
1174
|
+
return b(e, { ...t, label: s, labelPosition: "trailing" });
|
|
1169
1175
|
}
|
|
1170
|
-
},
|
|
1176
|
+
}, xe = {
|
|
1171
1177
|
/**
|
|
1172
1178
|
* Create a toggle group with multiple options
|
|
1173
1179
|
*/
|
|
1174
|
-
createGroup(
|
|
1175
|
-
return
|
|
1176
|
-
(t) =>
|
|
1180
|
+
createGroup(s, e = {}) {
|
|
1181
|
+
return s.map(
|
|
1182
|
+
(t) => Y(t.label, t.isOn, {
|
|
1177
1183
|
...e,
|
|
1178
1184
|
onToggle: t.onToggle
|
|
1179
1185
|
})
|
|
@@ -1182,13 +1188,13 @@ const ye = {
|
|
|
1182
1188
|
/**
|
|
1183
1189
|
* Create exclusive toggle group (radio-like behavior)
|
|
1184
1190
|
*/
|
|
1185
|
-
createExclusiveGroup(
|
|
1186
|
-
const
|
|
1187
|
-
return
|
|
1188
|
-
(n) =>
|
|
1189
|
-
...
|
|
1190
|
-
onToggle: (
|
|
1191
|
-
|
|
1191
|
+
createExclusiveGroup(s, e, t, i = {}) {
|
|
1192
|
+
const r = () => l(e) ? e() : e;
|
|
1193
|
+
return s.map(
|
|
1194
|
+
(n) => Y(n.label, r() === n.key, {
|
|
1195
|
+
...i,
|
|
1196
|
+
onToggle: (o) => {
|
|
1197
|
+
o && t && t(n.key);
|
|
1192
1198
|
}
|
|
1193
1199
|
})
|
|
1194
1200
|
);
|
|
@@ -1200,47 +1206,47 @@ const ye = {
|
|
|
1200
1206
|
/**
|
|
1201
1207
|
* Toggle all items in a group
|
|
1202
1208
|
*/
|
|
1203
|
-
toggleAll(
|
|
1204
|
-
|
|
1209
|
+
toggleAll(s, e) {
|
|
1210
|
+
s.forEach((t) => {
|
|
1205
1211
|
t.onToggle && t.onToggle(e);
|
|
1206
1212
|
});
|
|
1207
1213
|
},
|
|
1208
1214
|
/**
|
|
1209
1215
|
* Get state of all toggles in a group
|
|
1210
1216
|
*/
|
|
1211
|
-
getStates(
|
|
1212
|
-
return
|
|
1217
|
+
getStates(s) {
|
|
1218
|
+
return s.map((e) => l(e.isOn) ? e.isOn() : e.isOn);
|
|
1213
1219
|
},
|
|
1214
1220
|
/**
|
|
1215
1221
|
* Check if all toggles are on
|
|
1216
1222
|
*/
|
|
1217
|
-
allOn(
|
|
1218
|
-
return this.getStates(
|
|
1223
|
+
allOn(s) {
|
|
1224
|
+
return this.getStates(s).every((e) => e);
|
|
1219
1225
|
},
|
|
1220
1226
|
/**
|
|
1221
1227
|
* Check if any toggle is on
|
|
1222
1228
|
*/
|
|
1223
|
-
anyOn(
|
|
1224
|
-
return this.getStates(
|
|
1229
|
+
anyOn(s) {
|
|
1230
|
+
return this.getStates(s).some((e) => e);
|
|
1225
1231
|
}
|
|
1226
1232
|
}
|
|
1227
1233
|
};
|
|
1228
|
-
var
|
|
1229
|
-
class
|
|
1234
|
+
var pe = Object.defineProperty, he = (s, e, t) => e in s ? pe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, u = (s, e, t) => he(s, typeof e != "symbol" ? e + "" : e, t);
|
|
1235
|
+
class ue {
|
|
1230
1236
|
constructor(e) {
|
|
1231
|
-
|
|
1232
|
-
this.props.onSelectionChange && this.props.onSelectionChange(
|
|
1233
|
-
}),
|
|
1237
|
+
u(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", (o) => {
|
|
1238
|
+
this.props.onSelectionChange && this.props.onSelectionChange(o), (this.props.variant === "dropdown" || this.props.variant === "menu") && this.setIsOpen(!1), this.setSearchTerm("");
|
|
1239
|
+
}), u(this, "toggleOpen", () => {
|
|
1234
1240
|
this.isDisabled() || this.setIsOpen(!this.isOpen());
|
|
1235
1241
|
}), this.id = `picker-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
1236
|
-
const [t,
|
|
1237
|
-
if (this.isOpen = t, this.setIsOpen =
|
|
1238
|
-
const
|
|
1239
|
-
const
|
|
1240
|
-
|
|
1242
|
+
const [t, i] = z(!1), [r, n] = z("");
|
|
1243
|
+
if (this.isOpen = t, this.setIsOpen = i, this.searchTerm = r, this.setSearchTerm = n, typeof window < "u") {
|
|
1244
|
+
const o = (c) => {
|
|
1245
|
+
const h = document.getElementById(this.id);
|
|
1246
|
+
h && !h.contains(c.target) && this.setIsOpen(!1);
|
|
1241
1247
|
};
|
|
1242
|
-
document.addEventListener("click",
|
|
1243
|
-
document.removeEventListener("click",
|
|
1248
|
+
document.addEventListener("click", o), this.cleanup.push(() => {
|
|
1249
|
+
document.removeEventListener("click", o);
|
|
1244
1250
|
});
|
|
1245
1251
|
}
|
|
1246
1252
|
}
|
|
@@ -1264,7 +1270,7 @@ class he {
|
|
|
1264
1270
|
getFilteredOptions() {
|
|
1265
1271
|
const e = this.getOptions(), t = this.searchTerm().toLowerCase();
|
|
1266
1272
|
return !t || !this.props.searchable ? e : e.filter(
|
|
1267
|
-
(
|
|
1273
|
+
(i) => i.label.toLowerCase().includes(t) || i.description?.toLowerCase().includes(t)
|
|
1268
1274
|
);
|
|
1269
1275
|
}
|
|
1270
1276
|
/**
|
|
@@ -1279,7 +1285,7 @@ class he {
|
|
|
1279
1285
|
*/
|
|
1280
1286
|
getSelectedOption() {
|
|
1281
1287
|
const e = this.getSelection();
|
|
1282
|
-
return this.getOptions().find((
|
|
1288
|
+
return this.getOptions().find((i) => i.value === e) || null;
|
|
1283
1289
|
}
|
|
1284
1290
|
/**
|
|
1285
1291
|
* Get picker size styles
|
|
@@ -1311,7 +1317,7 @@ class he {
|
|
|
1311
1317
|
* Render dropdown variant
|
|
1312
1318
|
*/
|
|
1313
1319
|
renderDropdown() {
|
|
1314
|
-
const e = this.getSelectedOption(), t = this.getFilteredOptions(),
|
|
1320
|
+
const e = this.getSelectedOption(), t = this.getFilteredOptions(), i = this.getSizeStyles(), r = this.isOpen();
|
|
1315
1321
|
return a(
|
|
1316
1322
|
"div",
|
|
1317
1323
|
{
|
|
@@ -1330,7 +1336,7 @@ class he {
|
|
|
1330
1336
|
onClick: this.toggleOpen,
|
|
1331
1337
|
disabled: this.isDisabled(),
|
|
1332
1338
|
style: {
|
|
1333
|
-
...
|
|
1339
|
+
...i,
|
|
1334
1340
|
width: "100%",
|
|
1335
1341
|
display: "flex",
|
|
1336
1342
|
alignItems: "center",
|
|
@@ -1340,7 +1346,7 @@ class he {
|
|
|
1340
1346
|
borderRadius: "6px",
|
|
1341
1347
|
cursor: this.isDisabled() ? "not-allowed" : "pointer",
|
|
1342
1348
|
opacity: this.isDisabled() ? 0.6 : 1,
|
|
1343
|
-
...
|
|
1349
|
+
...r && {
|
|
1344
1350
|
borderColor: this.props.tint || "#007AFF",
|
|
1345
1351
|
boxShadow: `0 0 0 1px ${this.props.tint || "#007AFF"}`
|
|
1346
1352
|
}
|
|
@@ -1363,14 +1369,14 @@ class he {
|
|
|
1363
1369
|
style: {
|
|
1364
1370
|
fontSize: "12px",
|
|
1365
1371
|
color: "#6b7280",
|
|
1366
|
-
transform:
|
|
1372
|
+
transform: r ? "rotate(180deg)" : "rotate(0deg)",
|
|
1367
1373
|
transition: "transform 0.2s"
|
|
1368
1374
|
}
|
|
1369
1375
|
},
|
|
1370
1376
|
d("▼")
|
|
1371
1377
|
)
|
|
1372
1378
|
),
|
|
1373
|
-
...
|
|
1379
|
+
...r ? [
|
|
1374
1380
|
a(
|
|
1375
1381
|
"div",
|
|
1376
1382
|
{
|
|
@@ -1403,8 +1409,8 @@ class he {
|
|
|
1403
1409
|
placeholder: "Search options...",
|
|
1404
1410
|
value: this.searchTerm(),
|
|
1405
1411
|
onInput: (n) => {
|
|
1406
|
-
const
|
|
1407
|
-
this.setSearchTerm(
|
|
1412
|
+
const o = n.target;
|
|
1413
|
+
this.setSearchTerm(o.value);
|
|
1408
1414
|
},
|
|
1409
1415
|
style: {
|
|
1410
1416
|
width: "100%",
|
|
@@ -1490,7 +1496,7 @@ class he {
|
|
|
1490
1496
|
* Render segmented variant
|
|
1491
1497
|
*/
|
|
1492
1498
|
renderSegmented() {
|
|
1493
|
-
const e = this.getOptions(), t = this.getSelection(),
|
|
1499
|
+
const e = this.getOptions(), t = this.getSelection(), i = this.getSizeStyles();
|
|
1494
1500
|
return a(
|
|
1495
1501
|
"div",
|
|
1496
1502
|
{
|
|
@@ -1504,33 +1510,33 @@ class he {
|
|
|
1504
1510
|
"aria-label": this.props.accessibilityLabel
|
|
1505
1511
|
},
|
|
1506
1512
|
...e.map(
|
|
1507
|
-
(
|
|
1513
|
+
(r, n) => a(
|
|
1508
1514
|
"button",
|
|
1509
1515
|
{
|
|
1510
1516
|
type: "button",
|
|
1511
|
-
key: String(
|
|
1512
|
-
onClick: () => this.handleSelection(
|
|
1513
|
-
disabled:
|
|
1517
|
+
key: String(r.value),
|
|
1518
|
+
onClick: () => this.handleSelection(r.value),
|
|
1519
|
+
disabled: r.disabled || this.isDisabled(),
|
|
1514
1520
|
role: "radio",
|
|
1515
|
-
"aria-checked":
|
|
1521
|
+
"aria-checked": r.value === t,
|
|
1516
1522
|
style: {
|
|
1517
|
-
...
|
|
1523
|
+
...i,
|
|
1518
1524
|
flex: 1,
|
|
1519
1525
|
border: "none",
|
|
1520
1526
|
borderRadius: "6px",
|
|
1521
|
-
backgroundColor:
|
|
1522
|
-
color:
|
|
1523
|
-
fontWeight:
|
|
1524
|
-
cursor:
|
|
1525
|
-
opacity:
|
|
1526
|
-
boxShadow:
|
|
1527
|
+
backgroundColor: r.value === t ? "#ffffff" : "transparent",
|
|
1528
|
+
color: r.value === t ? "#1a1a1a" : "#6b7280",
|
|
1529
|
+
fontWeight: r.value === t ? "600" : "400",
|
|
1530
|
+
cursor: r.disabled || this.isDisabled() ? "not-allowed" : "pointer",
|
|
1531
|
+
opacity: r.disabled || this.isDisabled() ? 0.5 : 1,
|
|
1532
|
+
boxShadow: r.value === t ? "0 1px 2px rgba(0, 0, 0, 0.1)" : "none",
|
|
1527
1533
|
transition: "all 0.2s",
|
|
1528
1534
|
margin: "0",
|
|
1529
1535
|
...n === 0 && { marginRight: "1px" },
|
|
1530
1536
|
...n === e.length - 1 && { marginLeft: "1px" }
|
|
1531
1537
|
}
|
|
1532
1538
|
},
|
|
1533
|
-
...
|
|
1539
|
+
...r.icon ? [
|
|
1534
1540
|
a(
|
|
1535
1541
|
"span",
|
|
1536
1542
|
{
|
|
@@ -1539,10 +1545,10 @@ class he {
|
|
|
1539
1545
|
fontSize: "14px"
|
|
1540
1546
|
}
|
|
1541
1547
|
},
|
|
1542
|
-
d(
|
|
1548
|
+
d(r.icon)
|
|
1543
1549
|
)
|
|
1544
1550
|
] : [],
|
|
1545
|
-
d(
|
|
1551
|
+
d(r.label)
|
|
1546
1552
|
)
|
|
1547
1553
|
)
|
|
1548
1554
|
);
|
|
@@ -1556,9 +1562,9 @@ class he {
|
|
|
1556
1562
|
"select",
|
|
1557
1563
|
{
|
|
1558
1564
|
value: String(t),
|
|
1559
|
-
onChange: (
|
|
1560
|
-
const
|
|
1561
|
-
(
|
|
1565
|
+
onChange: (i) => {
|
|
1566
|
+
const r = i.target, n = e.find(
|
|
1567
|
+
(o) => String(o.value) === r.value
|
|
1562
1568
|
);
|
|
1563
1569
|
n && this.handleSelection(n.value);
|
|
1564
1570
|
},
|
|
@@ -1574,14 +1580,14 @@ class he {
|
|
|
1574
1580
|
}
|
|
1575
1581
|
},
|
|
1576
1582
|
...e.map(
|
|
1577
|
-
(
|
|
1583
|
+
(i) => a(
|
|
1578
1584
|
"option",
|
|
1579
1585
|
{
|
|
1580
|
-
key: String(
|
|
1581
|
-
value: String(
|
|
1582
|
-
disabled:
|
|
1586
|
+
key: String(i.value),
|
|
1587
|
+
value: String(i.value),
|
|
1588
|
+
disabled: i.disabled
|
|
1583
1589
|
},
|
|
1584
|
-
d(
|
|
1590
|
+
d(i.label)
|
|
1585
1591
|
)
|
|
1586
1592
|
)
|
|
1587
1593
|
);
|
|
@@ -1590,10 +1596,10 @@ class he {
|
|
|
1590
1596
|
const {
|
|
1591
1597
|
variant: e = "dropdown",
|
|
1592
1598
|
accessibilityLabel: t,
|
|
1593
|
-
accessibilityHint:
|
|
1594
|
-
} = this.props,
|
|
1599
|
+
accessibilityHint: i
|
|
1600
|
+
} = this.props, r = {
|
|
1595
1601
|
"aria-label": t,
|
|
1596
|
-
"aria-describedby":
|
|
1602
|
+
"aria-describedby": i ? `${this.id}-hint` : void 0
|
|
1597
1603
|
};
|
|
1598
1604
|
let n;
|
|
1599
1605
|
switch (e) {
|
|
@@ -1609,9 +1615,9 @@ class he {
|
|
|
1609
1615
|
}
|
|
1610
1616
|
return a(
|
|
1611
1617
|
"div",
|
|
1612
|
-
|
|
1618
|
+
r,
|
|
1613
1619
|
n,
|
|
1614
|
-
...
|
|
1620
|
+
...i ? [
|
|
1615
1621
|
a(
|
|
1616
1622
|
"div",
|
|
1617
1623
|
{
|
|
@@ -1622,51 +1628,51 @@ class he {
|
|
|
1622
1628
|
marginTop: "4px"
|
|
1623
1629
|
}
|
|
1624
1630
|
},
|
|
1625
|
-
d(
|
|
1631
|
+
d(i)
|
|
1626
1632
|
)
|
|
1627
1633
|
] : []
|
|
1628
1634
|
);
|
|
1629
1635
|
}
|
|
1630
1636
|
}
|
|
1631
|
-
function
|
|
1632
|
-
const
|
|
1633
|
-
return A(
|
|
1637
|
+
function O(s, e, t = {}) {
|
|
1638
|
+
const i = { ...t, selection: s, options: e }, r = new ue(i);
|
|
1639
|
+
return A(r);
|
|
1634
1640
|
}
|
|
1635
1641
|
const ve = {
|
|
1636
1642
|
/**
|
|
1637
1643
|
* Dropdown picker (default)
|
|
1638
1644
|
*/
|
|
1639
1645
|
// biome-ignore lint/suspicious/noExplicitAny: Generic dropdown picker requires flexible type
|
|
1640
|
-
Dropdown(
|
|
1641
|
-
return
|
|
1646
|
+
Dropdown(s, e, t = {}) {
|
|
1647
|
+
return O(s, e, { ...t, variant: "dropdown" });
|
|
1642
1648
|
},
|
|
1643
1649
|
/**
|
|
1644
1650
|
* Segmented picker
|
|
1645
1651
|
*/
|
|
1646
1652
|
// biome-ignore lint/suspicious/noExplicitAny: Generic segmented picker requires flexible type
|
|
1647
|
-
Segmented(
|
|
1648
|
-
return
|
|
1653
|
+
Segmented(s, e, t = {}) {
|
|
1654
|
+
return O(s, e, { ...t, variant: "segmented" });
|
|
1649
1655
|
},
|
|
1650
1656
|
/**
|
|
1651
1657
|
* Wheel picker (native select)
|
|
1652
1658
|
*/
|
|
1653
1659
|
// biome-ignore lint/suspicious/noExplicitAny: Generic wheel picker requires flexible type
|
|
1654
|
-
Wheel(
|
|
1655
|
-
return
|
|
1660
|
+
Wheel(s, e, t = {}) {
|
|
1661
|
+
return O(s, e, { ...t, variant: "wheel" });
|
|
1656
1662
|
},
|
|
1657
1663
|
/**
|
|
1658
1664
|
* Menu picker
|
|
1659
1665
|
*/
|
|
1660
1666
|
// biome-ignore lint/suspicious/noExplicitAny: Generic menu picker requires flexible type
|
|
1661
|
-
Menu(
|
|
1662
|
-
return
|
|
1667
|
+
Menu(s, e, t = {}) {
|
|
1668
|
+
return O(s, e, { ...t, variant: "menu" });
|
|
1663
1669
|
}
|
|
1664
|
-
},
|
|
1670
|
+
}, we = {
|
|
1665
1671
|
/**
|
|
1666
1672
|
* Create options from simple array
|
|
1667
1673
|
*/
|
|
1668
|
-
fromArray(
|
|
1669
|
-
return
|
|
1674
|
+
fromArray(s, e) {
|
|
1675
|
+
return s.map((t) => ({
|
|
1670
1676
|
value: t,
|
|
1671
1677
|
label: String(e && typeof t == "object" && t !== null ? t[e] : t)
|
|
1672
1678
|
}));
|
|
@@ -1674,8 +1680,8 @@ const ve = {
|
|
|
1674
1680
|
/**
|
|
1675
1681
|
* Create options from enum
|
|
1676
1682
|
*/
|
|
1677
|
-
fromEnum(
|
|
1678
|
-
return Object.entries(
|
|
1683
|
+
fromEnum(s) {
|
|
1684
|
+
return Object.entries(s).map(([e, t]) => ({
|
|
1679
1685
|
value: t,
|
|
1680
1686
|
label: e.replace(/([A-Z])/g, " $1").trim()
|
|
1681
1687
|
}));
|
|
@@ -1683,30 +1689,30 @@ const ve = {
|
|
|
1683
1689
|
/**
|
|
1684
1690
|
* Group options by category
|
|
1685
1691
|
*/
|
|
1686
|
-
grouped(
|
|
1687
|
-
return
|
|
1692
|
+
grouped(s) {
|
|
1693
|
+
return s.reduce(
|
|
1688
1694
|
(e, t) => {
|
|
1689
|
-
const
|
|
1690
|
-
return e[
|
|
1695
|
+
const i = t.category || "Other";
|
|
1696
|
+
return e[i] || (e[i] = []), e[i].push(t), e;
|
|
1691
1697
|
},
|
|
1692
1698
|
{}
|
|
1693
1699
|
);
|
|
1694
1700
|
}
|
|
1695
1701
|
};
|
|
1696
1702
|
export {
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1703
|
+
G as B,
|
|
1704
|
+
F as E,
|
|
1705
|
+
ye as L,
|
|
1706
|
+
O as P,
|
|
1707
|
+
b as T,
|
|
1708
|
+
me as a,
|
|
1709
|
+
ue as b,
|
|
1710
|
+
de as c,
|
|
1705
1711
|
x as d,
|
|
1706
1712
|
ve as e,
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1713
|
+
we as f,
|
|
1714
|
+
Se as g,
|
|
1715
|
+
xe as h,
|
|
1716
|
+
Y as i,
|
|
1717
|
+
ne as j
|
|
1712
1718
|
};
|