@webstrail/ui-library 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/UIProvider-C3ae0nQV.cjs +2 -0
  2. package/dist/UIProvider-C3ae0nQV.cjs.map +1 -0
  3. package/dist/UIProvider-CHECrDaZ.js +466 -0
  4. package/dist/UIProvider-CHECrDaZ.js.map +1 -0
  5. package/dist/core/config/globalConfig.d.ts +54 -0
  6. package/dist/core/config/index.d.ts +1 -0
  7. package/dist/core/index.d.ts +4 -0
  8. package/dist/core/theme/defaultTheme.d.ts +7 -0
  9. package/dist/core/theme/deriveTokens.d.ts +16 -0
  10. package/dist/core/theme/index.d.ts +2 -0
  11. package/dist/core/types/common.d.ts +32 -0
  12. package/dist/core/types/config.d.ts +70 -0
  13. package/dist/core/types/index.d.ts +3 -0
  14. package/dist/core/types/tokens.d.ts +65 -0
  15. package/dist/core/utils/styles.d.ts +19 -0
  16. package/dist/core.cjs +2 -0
  17. package/dist/core.cjs.map +1 -0
  18. package/dist/core.js +344 -0
  19. package/dist/core.js.map +1 -0
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.ts +6 -4
  23. package/dist/index.js +817 -1248
  24. package/dist/index.js.map +1 -1
  25. package/dist/react/components/Button/Button.d.ts +2 -0
  26. package/dist/react/components/Button/Button.types.d.ts +52 -0
  27. package/dist/react/components/Button/index.d.ts +2 -0
  28. package/dist/react/index.d.ts +6 -0
  29. package/dist/react.cjs +2 -0
  30. package/dist/react.cjs.map +1 -0
  31. package/dist/react.js +9 -0
  32. package/dist/react.js.map +1 -0
  33. package/dist/style.css +1 -1
  34. package/dist/web-components/button/button.element.d.ts +59 -0
  35. package/dist/web-components/button/button.styles.d.ts +1 -0
  36. package/dist/web-components/button/button.types.d.ts +21 -0
  37. package/dist/web-components/button/index.d.ts +3 -0
  38. package/dist/web-components/index.d.ts +1 -0
  39. package/dist/web-components.cjs +269 -0
  40. package/dist/web-components.cjs.map +1 -0
  41. package/dist/web-components.js +503 -0
  42. package/dist/web-components.js.map +1 -0
  43. package/package.json +19 -3
package/dist/core.js ADDED
@@ -0,0 +1,344 @@
1
+ function $(o) {
2
+ if (!o) return "medium";
3
+ switch (o) {
4
+ case "sm":
5
+ case "small":
6
+ return "small";
7
+ case "lg":
8
+ case "large":
9
+ return "large";
10
+ case "md":
11
+ case "medium":
12
+ default:
13
+ return "medium";
14
+ }
15
+ }
16
+ const R = {
17
+ primary: "#2491eb",
18
+ secondary: "#406993",
19
+ text: "#1f2937",
20
+ textSecondary: "#6b7280",
21
+ border: "#d1d5db",
22
+ background: "#ffffff",
23
+ error: "#dc2626",
24
+ success: "#16a34a",
25
+ disabled: "#9ca3af",
26
+ disabledBackground: "#f3f4f6",
27
+ disabledText: "#9ca3af",
28
+ focusRing: "rgba(36, 145, 235, 0.35)"
29
+ }, m = {
30
+ fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif',
31
+ fontSizeSmall: "12px",
32
+ fontSizeMedium: "14px",
33
+ fontSizeLarge: "16px",
34
+ fontWeightNormal: 400,
35
+ fontWeightMedium: 500,
36
+ fontWeightBold: 600
37
+ }, I = {
38
+ borderRadiusSmall: "6px",
39
+ borderRadiusMedium: "8px",
40
+ borderRadiusLarge: "12px"
41
+ }, y = {
42
+ height: "40px",
43
+ borderRadius: "8px",
44
+ fontSize: "14px",
45
+ fontWeight: 500,
46
+ backgroundColor: "#2491eb",
47
+ textColor: "#ffffff",
48
+ borderColor: "transparent",
49
+ hoverBackgroundColor: "#1d78c4",
50
+ hoverTextColor: "#ffffff",
51
+ activeBackgroundColor: "#1565a0",
52
+ disabledBackgroundColor: "#f3f4f6",
53
+ disabledTextColor: "#9ca3af",
54
+ disabledBorderColor: "#e5e7eb",
55
+ focusRingColor: "rgba(36, 145, 235, 0.35)",
56
+ padding: "0 16px",
57
+ transition: "all 0.15s ease-in-out",
58
+ outlineColor: "#2491eb",
59
+ outlineBorderColor: "#2491eb",
60
+ outlineHoverBackgroundColor: "rgba(36, 145, 235, 0.08)",
61
+ ghostColor: "#2491eb",
62
+ ghostHoverBackgroundColor: "rgba(36, 145, 235, 0.08)"
63
+ }, S = {
64
+ theme: {
65
+ primaryColor: "#2491eb",
66
+ secondaryColor: "#406993",
67
+ fontFamily: m.fontFamily,
68
+ borderRadius: "8px",
69
+ colors: R,
70
+ typography: m,
71
+ layout: I
72
+ },
73
+ components: {
74
+ button: {
75
+ variant: "primary",
76
+ size: "medium",
77
+ fullWidth: !1,
78
+ styles: y
79
+ }
80
+ }
81
+ };
82
+ function g(o, e = 0.1) {
83
+ if (!o || typeof o != "string") return "rgba(36, 145, 235, 0.1)";
84
+ const s = o.trim(), n = s.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);
85
+ if (n) {
86
+ const r = parseInt(n[1], 16), c = parseInt(n[2], 16), i = parseInt(n[3], 16);
87
+ return `rgba(${r}, ${c}, ${i}, ${e})`;
88
+ }
89
+ const t = s.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);
90
+ if (t) {
91
+ const r = parseInt(t[1] + t[1], 16), c = parseInt(t[2] + t[2], 16), i = parseInt(t[3] + t[3], 16);
92
+ return `rgba(${r}, ${c}, ${i}, ${e})`;
93
+ }
94
+ const a = Math.round(e * 100);
95
+ return `color-mix(in srgb, ${s} ${a}%, #ffffff)`;
96
+ }
97
+ function k(o, e = 0.25) {
98
+ if (!o || typeof o != "string") return "rgba(36, 145, 235, 0.25)";
99
+ const s = o.trim(), n = s.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);
100
+ if (n) {
101
+ const r = parseInt(n[1], 16), c = parseInt(n[2], 16), i = parseInt(n[3], 16);
102
+ return `rgba(${r}, ${c}, ${i}, ${e})`;
103
+ }
104
+ const t = s.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);
105
+ if (t) {
106
+ const r = parseInt(t[1] + t[1], 16), c = parseInt(t[2] + t[2], 16), i = parseInt(t[3] + t[3], 16);
107
+ return `rgba(${r}, ${c}, ${i}, ${e})`;
108
+ }
109
+ const a = Math.round(e * 100);
110
+ return `color-mix(in srgb, ${s} ${a}%, transparent)`;
111
+ }
112
+ function b(o, e = 0.12) {
113
+ if (!o || typeof o != "string") return "#1d78c4";
114
+ const s = o.trim(), n = s.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);
115
+ if (n) {
116
+ const r = Math.max(0, 1 - e), c = Math.round(parseInt(n[1], 16) * r), i = Math.round(parseInt(n[2], 16) * r), d = Math.round(parseInt(n[3], 16) * r), u = (f) => f.toString(16).padStart(2, "0");
117
+ return `#${u(c)}${u(i)}${u(d)}`;
118
+ }
119
+ const t = s.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);
120
+ if (t) {
121
+ const r = Math.max(0, 1 - e), c = Math.round(parseInt(t[1] + t[1], 16) * r), i = Math.round(parseInt(t[2] + t[2], 16) * r), d = Math.round(parseInt(t[3] + t[3], 16) * r), u = (f) => f.toString(16).padStart(2, "0");
122
+ return `#${u(c)}${u(i)}${u(d)}`;
123
+ }
124
+ const a = Math.round((1 - e) * 100);
125
+ return `color-mix(in srgb, ${s} ${a}%, #000000)`;
126
+ }
127
+ function M(o) {
128
+ const e = g(o, 0.1), s = g(o, 0.18), n = k(o, 0.25), t = b(o, 0.12), a = b(o, 0.22), r = g(o, 0.08);
129
+ return {
130
+ colors: {
131
+ primary: o,
132
+ focusRing: n
133
+ },
134
+ button: {
135
+ backgroundColor: o,
136
+ hoverBackgroundColor: t,
137
+ activeBackgroundColor: a,
138
+ focusRingColor: n,
139
+ outlineColor: o,
140
+ outlineBorderColor: o,
141
+ outlineHoverBackgroundColor: r,
142
+ ghostColor: o,
143
+ ghostHoverBackgroundColor: r
144
+ },
145
+ select: {
146
+ focusBorderColor: o,
147
+ focusRingColor: n,
148
+ optionSelectedTextColor: o,
149
+ optionCheckColor: o,
150
+ optionSelectedBackgroundColor: e,
151
+ optionSelectedHoverBackgroundColor: s
152
+ },
153
+ input: {
154
+ focusBorderColor: o,
155
+ focusRingColor: n
156
+ },
157
+ checkbox: {
158
+ checkedColor: o,
159
+ focusRingColor: n
160
+ },
161
+ textarea: {
162
+ focusBorderColor: o,
163
+ focusRingColor: n
164
+ },
165
+ radio: {
166
+ color: o,
167
+ checkedColor: o,
168
+ focusRingColor: n
169
+ },
170
+ switch: {
171
+ trackCheckedColor: o,
172
+ focusRingColor: n
173
+ }
174
+ };
175
+ }
176
+ const A = /* @__PURE__ */ new Set([
177
+ "fontWeight",
178
+ "opacity",
179
+ "zIndex",
180
+ "lineHeight",
181
+ "flex",
182
+ "flexGrow",
183
+ "flexShrink",
184
+ "order"
185
+ ]);
186
+ function W(o) {
187
+ return o.replace(/([A-Z])/g, "-$1").toLowerCase();
188
+ }
189
+ function z(o, e) {
190
+ return typeof e == "number" && !A.has(o) ? `${e}px` : String(e);
191
+ }
192
+ function p(o) {
193
+ return typeof o == "object" && o !== null && !Array.isArray(o);
194
+ }
195
+ function h(o, ...e) {
196
+ let s = { ...o };
197
+ for (const n of e) {
198
+ if (!n || !p(n))
199
+ continue;
200
+ const t = { ...s };
201
+ for (const a of Object.keys(n)) {
202
+ const r = n[a];
203
+ if (r === void 0)
204
+ continue;
205
+ const c = t[a];
206
+ p(c) && p(r) ? t[a] = h(
207
+ c,
208
+ r
209
+ ) : t[a] = r;
210
+ }
211
+ s = t;
212
+ }
213
+ return s;
214
+ }
215
+ function B(o, e) {
216
+ if (!o)
217
+ return {};
218
+ const s = {};
219
+ for (const [n, t] of Object.entries(o))
220
+ if (!(t == null || t === "") && (typeof t == "string" || typeof t == "number")) {
221
+ const a = `--${e}-${W(n)}`;
222
+ s[a] = z(n, t);
223
+ }
224
+ return s;
225
+ }
226
+ let l = JSON.parse(JSON.stringify(S));
227
+ const C = /* @__PURE__ */ new Set();
228
+ function v() {
229
+ return l;
230
+ }
231
+ function w(o) {
232
+ return C.add(o), () => {
233
+ C.delete(o);
234
+ };
235
+ }
236
+ function T(o) {
237
+ var c, i, d;
238
+ const e = ((c = o.theme) == null ? void 0 : c.primaryColor) || ((i = o.colors) == null ? void 0 : i.primary) || l.theme.primaryColor;
239
+ let s = {};
240
+ if (e) {
241
+ const u = b(e, 0.12), f = b(e, 0.22), F = k(e, 0.35), x = g(e, 0.08);
242
+ s = {
243
+ backgroundColor: e,
244
+ hoverBackgroundColor: u,
245
+ activeBackgroundColor: f,
246
+ focusRingColor: F,
247
+ outlineColor: e,
248
+ outlineBorderColor: e,
249
+ outlineHoverBackgroundColor: x,
250
+ ghostColor: e,
251
+ ghostHoverBackgroundColor: x
252
+ };
253
+ }
254
+ const n = h(
255
+ l.theme,
256
+ o.theme || {},
257
+ o.colors ? { colors: o.colors } : {},
258
+ o.typography ? { typography: o.typography } : {},
259
+ o.layout ? { layout: o.layout } : {}
260
+ ), t = {
261
+ ...((d = o.components) == null ? void 0 : d.button) || {},
262
+ ...o.button ? { styles: o.button } : {}
263
+ }, a = t.size ? $(t.size) : l.components.button.size, r = h(
264
+ y,
265
+ l.components.button.styles,
266
+ s,
267
+ t.styles || {}
268
+ );
269
+ if (l = {
270
+ theme: n,
271
+ components: {
272
+ ...l.components,
273
+ button: {
274
+ variant: t.variant ?? l.components.button.variant,
275
+ size: a,
276
+ fullWidth: t.fullWidth ?? l.components.button.fullWidth,
277
+ styles: r
278
+ }
279
+ }
280
+ }, C.forEach((u) => {
281
+ try {
282
+ u(l);
283
+ } catch (f) {
284
+ console.error("Error notifying Webstrail config listener:", f);
285
+ }
286
+ }), typeof window < "u")
287
+ try {
288
+ window.dispatchEvent(
289
+ new CustomEvent("webstrail-config-change", {
290
+ detail: l
291
+ })
292
+ );
293
+ } catch {
294
+ }
295
+ return l;
296
+ }
297
+ function H() {
298
+ l = JSON.parse(JSON.stringify(S)), C.forEach((o) => {
299
+ try {
300
+ o(l);
301
+ } catch (e) {
302
+ console.error("Error notifying Webstrail config listener:", e);
303
+ }
304
+ });
305
+ }
306
+ function E(o) {
307
+ const e = l.components.button, s = (o == null ? void 0 : o.variant) || e.variant || "primary", n = o != null && o.size ? $(o.size) : e.size || "medium", t = (o == null ? void 0 : o.fullWidth) ?? e.fullWidth ?? !1, a = h(
308
+ y,
309
+ e.styles,
310
+ (o == null ? void 0 : o.styles) || {}
311
+ ), r = {
312
+ ...B(a, "wui-button"),
313
+ ...B(a, "wb-button")
314
+ };
315
+ return {
316
+ variant: s,
317
+ size: n,
318
+ fullWidth: t,
319
+ styles: a,
320
+ cssVars: r
321
+ };
322
+ }
323
+ export {
324
+ W as camelToKebab,
325
+ T as configureWebstrail,
326
+ h as deepMerge,
327
+ y as defaultButtonStyles,
328
+ R as defaultColors,
329
+ I as defaultLayout,
330
+ S as defaultResolvedConfig,
331
+ m as defaultTypography,
332
+ M as deriveTokensFromPrimary,
333
+ b as getDarkerShade,
334
+ k as getFocusRingColor,
335
+ g as getSubtleBackgroundColor,
336
+ v as getWebstrailConfig,
337
+ $ as normalizeButtonSize,
338
+ z as normalizeDimension,
339
+ H as resetWebstrailConfig,
340
+ E as resolveEffectiveButtonConfig,
341
+ B as stylesToCssVars,
342
+ w as subscribeWebstrailConfig
343
+ };
344
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sources":["../src/core/types/common.ts","../src/core/theme/defaultTheme.ts","../src/core/theme/deriveTokens.ts","../src/core/utils/styles.ts","../src/core/config/globalConfig.ts"],"sourcesContent":["/**\n * Standard size variants supported across components.\n */\nexport type ComponentSize = 'small' | 'medium' | 'large';\n\n/**\n * Size aliases supported for developer convenience.\n */\nexport type SizeAlias = 'sm' | 'md' | 'lg';\n\n/**\n * Size type for Button (accepts standard full names or aliases).\n */\nexport type ButtonSize = ComponentSize | SizeAlias;\n\n/**\n * Standard semantic color intent variants.\n */\nexport type ComponentVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';\n\n/**\n * Variant type alias for Button.\n */\nexport type ButtonVariant = ComponentVariant;\n\n/**\n * Supported HTML button types.\n */\nexport type ButtonType = 'button' | 'submit' | 'reset';\n\n/**\n * Helper to accept string or number for dimension properties (adds 'px' if number).\n */\nexport type DimensionValue = string | number;\n\n/**\n * Normalizes size aliases ('sm' -> 'small', 'md' -> 'medium', 'lg' -> 'large').\n */\nexport function normalizeButtonSize(size?: ButtonSize | string): ComponentSize {\n if (!size) return 'medium';\n switch (size) {\n case 'sm':\n case 'small':\n return 'small';\n case 'lg':\n case 'large':\n return 'large';\n case 'md':\n case 'medium':\n default:\n return 'medium';\n }\n}\n","import type {\n ButtonStyles,\n GlobalColorTokens,\n GlobalLayoutTokens,\n GlobalTypographyTokens,\n} from '../types/tokens';\nimport type { ResolvedWebstrailConfig } from '../types/config';\n\nexport const defaultColors: GlobalColorTokens = {\n primary: '#2491eb',\n secondary: '#406993',\n text: '#1f2937',\n textSecondary: '#6b7280',\n border: '#d1d5db',\n background: '#ffffff',\n error: '#dc2626',\n success: '#16a34a',\n disabled: '#9ca3af',\n disabledBackground: '#f3f4f6',\n disabledText: '#9ca3af',\n focusRing: 'rgba(36, 145, 235, 0.35)',\n};\n\nexport const defaultTypography: GlobalTypographyTokens = {\n fontFamily:\n 'system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif',\n fontSizeSmall: '12px',\n fontSizeMedium: '14px',\n fontSizeLarge: '16px',\n fontWeightNormal: 400,\n fontWeightMedium: 500,\n fontWeightBold: 600,\n};\n\nexport const defaultLayout: GlobalLayoutTokens = {\n borderRadiusSmall: '6px',\n borderRadiusMedium: '8px',\n borderRadiusLarge: '12px',\n};\n\nexport const defaultButtonStyles: ButtonStyles = {\n height: '40px',\n borderRadius: '8px',\n fontSize: '14px',\n fontWeight: 500,\n backgroundColor: '#2491eb',\n textColor: '#ffffff',\n borderColor: 'transparent',\n hoverBackgroundColor: '#1d78c4',\n hoverTextColor: '#ffffff',\n activeBackgroundColor: '#1565a0',\n disabledBackgroundColor: '#f3f4f6',\n disabledTextColor: '#9ca3af',\n disabledBorderColor: '#e5e7eb',\n focusRingColor: 'rgba(36, 145, 235, 0.35)',\n padding: '0 16px',\n transition: 'all 0.15s ease-in-out',\n outlineColor: '#2491eb',\n outlineBorderColor: '#2491eb',\n outlineHoverBackgroundColor: 'rgba(36, 145, 235, 0.08)',\n ghostColor: '#2491eb',\n ghostHoverBackgroundColor: 'rgba(36, 145, 235, 0.08)',\n};\n\nexport const defaultResolvedConfig: ResolvedWebstrailConfig = {\n theme: {\n primaryColor: '#2491eb',\n secondaryColor: '#406993',\n fontFamily: defaultTypography.fontFamily,\n borderRadius: '8px',\n colors: defaultColors,\n typography: defaultTypography,\n layout: defaultLayout,\n },\n components: {\n button: {\n variant: 'primary',\n size: 'medium',\n fullWidth: false,\n styles: defaultButtonStyles,\n },\n },\n};\n","/**\n * Derives a subtle transparent background color (e.g., for selected options, hover chips).\n */\nexport function getSubtleBackgroundColor(color: string, opacity = 0.1): string {\n if (!color || typeof color !== 'string') return 'rgba(36, 145, 235, 0.1)';\n const trimmed = color.trim();\n const hex6 = trimmed.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);\n if (hex6) {\n const r = parseInt(hex6[1]!, 16);\n const g = parseInt(hex6[2]!, 16);\n const b = parseInt(hex6[3]!, 16);\n return `rgba(${r}, ${g}, ${b}, ${opacity})`;\n }\n const hex3 = trimmed.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);\n if (hex3) {\n const r = parseInt(hex3[1]! + hex3[1]!, 16);\n const g = parseInt(hex3[2]! + hex3[2]!, 16);\n const b = parseInt(hex3[3]! + hex3[3]!, 16);\n return `rgba(${r}, ${g}, ${b}, ${opacity})`;\n }\n const percentage = Math.round(opacity * 100);\n return `color-mix(in srgb, ${trimmed} ${percentage}%, #ffffff)`;\n}\n\n/**\n * Derives a focus ring color with alpha transparency.\n */\nexport function getFocusRingColor(color: string, opacity = 0.25): string {\n if (!color || typeof color !== 'string') return 'rgba(36, 145, 235, 0.25)';\n const trimmed = color.trim();\n const hex6 = trimmed.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);\n if (hex6) {\n const r = parseInt(hex6[1]!, 16);\n const g = parseInt(hex6[2]!, 16);\n const b = parseInt(hex6[3]!, 16);\n return `rgba(${r}, ${g}, ${b}, ${opacity})`;\n }\n const hex3 = trimmed.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);\n if (hex3) {\n const r = parseInt(hex3[1]! + hex3[1]!, 16);\n const g = parseInt(hex3[2]! + hex3[2]!, 16);\n const b = parseInt(hex3[3]! + hex3[3]!, 16);\n return `rgba(${r}, ${g}, ${b}, ${opacity})`;\n }\n const percentage = Math.round(opacity * 100);\n return `color-mix(in srgb, ${trimmed} ${percentage}%, transparent)`;\n}\n\n/**\n * Derives a darker shade of a color (e.g. for button hover and active states).\n */\nexport function getDarkerShade(color: string, amount = 0.12): string {\n if (!color || typeof color !== 'string') return '#1d78c4';\n const trimmed = color.trim();\n const hex6 = trimmed.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);\n if (hex6) {\n const factor = Math.max(0, 1 - amount);\n const r = Math.round(parseInt(hex6[1]!, 16) * factor);\n const g = Math.round(parseInt(hex6[2]!, 16) * factor);\n const b = Math.round(parseInt(hex6[3]!, 16) * factor);\n const toHex = (n: number) => n.toString(16).padStart(2, '0');\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n }\n const hex3 = trimmed.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);\n if (hex3) {\n const factor = Math.max(0, 1 - amount);\n const r = Math.round(parseInt(hex3[1]! + hex3[1]!, 16) * factor);\n const g = Math.round(parseInt(hex3[2]! + hex3[2]!, 16) * factor);\n const b = Math.round(parseInt(hex3[3]! + hex3[3]!, 16) * factor);\n const toHex = (n: number) => n.toString(16).padStart(2, '0');\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n }\n const percentage = Math.round((1 - amount) * 100);\n return `color-mix(in srgb, ${trimmed} ${percentage}%, #000000)`;\n}\n\n/**\n * Derives default component styling tokens based on a primary color.\n */\nexport function deriveTokensFromPrimary(primary: string): Record<string, unknown> {\n const selectedBg = getSubtleBackgroundColor(primary, 0.1);\n const selectedHoverBg = getSubtleBackgroundColor(primary, 0.18);\n const ring = getFocusRingColor(primary, 0.25);\n const hoverBg = getDarkerShade(primary, 0.12);\n const activeBg = getDarkerShade(primary, 0.22);\n const outlineTint = getSubtleBackgroundColor(primary, 0.08);\n\n return {\n colors: {\n primary,\n focusRing: ring,\n },\n button: {\n backgroundColor: primary,\n hoverBackgroundColor: hoverBg,\n activeBackgroundColor: activeBg,\n focusRingColor: ring,\n outlineColor: primary,\n outlineBorderColor: primary,\n outlineHoverBackgroundColor: outlineTint,\n ghostColor: primary,\n ghostHoverBackgroundColor: outlineTint,\n },\n select: {\n focusBorderColor: primary,\n focusRingColor: ring,\n optionSelectedTextColor: primary,\n optionCheckColor: primary,\n optionSelectedBackgroundColor: selectedBg,\n optionSelectedHoverBackgroundColor: selectedHoverBg,\n },\n input: {\n focusBorderColor: primary,\n focusRingColor: ring,\n },\n checkbox: {\n checkedColor: primary,\n focusRingColor: ring,\n },\n textarea: {\n focusBorderColor: primary,\n focusRingColor: ring,\n },\n radio: {\n color: primary,\n checkedColor: primary,\n focusRingColor: ring,\n },\n switch: {\n trackCheckedColor: primary,\n focusRingColor: ring,\n },\n };\n}\n","import type { DeepPartial } from '../types/config';\n\nconst UNITLESS_PROPERTIES = new Set([\n 'fontWeight',\n 'opacity',\n 'zIndex',\n 'lineHeight',\n 'flex',\n 'flexGrow',\n 'flexShrink',\n 'order',\n]);\n\n/**\n * Converts camelCase to kebab-case (e.g. borderRadius -> border-radius).\n */\nexport function camelToKebab(str: string): string {\n return str.replace(/([A-Z])/g, '-$1').toLowerCase();\n}\n\n/**\n * Normalizes dimension values (appends 'px' to numbers where appropriate).\n */\nexport function normalizeDimension(propName: string, value: string | number): string {\n if (typeof value === 'number' && !UNITLESS_PROPERTIES.has(propName)) {\n return `${value}px`;\n }\n return String(value);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Immutably deep-merges objects from left to right.\n * Undefined values in overrides are ignored to preserve defaults.\n */\nexport function deepMerge<T extends object>(\n target: T,\n ...sources: Array<DeepPartial<T> | Record<string, unknown> | undefined | null>\n): T {\n let result: Record<string, unknown> = { ...(target as Record<string, unknown>) };\n\n for (const source of sources) {\n if (!source || !isRecord(source)) {\n continue;\n }\n\n const nextResult: Record<string, unknown> = { ...result };\n\n for (const key of Object.keys(source)) {\n const sourceValue = (source as Record<string, unknown>)[key];\n\n if (sourceValue === undefined) {\n continue;\n }\n\n const existingValue = nextResult[key];\n\n if (isRecord(existingValue) && isRecord(sourceValue)) {\n nextResult[key] = deepMerge(\n existingValue as Record<string, unknown>,\n sourceValue as Record<string, unknown>\n );\n } else {\n nextResult[key] = sourceValue;\n }\n }\n\n result = nextResult;\n }\n\n return result as T;\n}\n\n/**\n * Transforms a flat semantic styles object into scoped CSS custom properties.\n * Framework-independent: returns Record<string, string>.\n */\nexport function stylesToCssVars(\n styles: Record<string, unknown> | object | undefined,\n prefix: string\n): Record<string, string> {\n if (!styles) {\n return {};\n }\n\n const vars: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(styles as Record<string, unknown>)) {\n if (value === undefined || value === null || value === '') {\n continue;\n }\n\n if (typeof value === 'string' || typeof value === 'number') {\n const varName = `--${prefix}-${camelToKebab(key)}`;\n vars[varName] = normalizeDimension(key, value);\n }\n }\n\n return vars;\n}\n","import type { ButtonSize, ButtonVariant } from '../types/common';\nimport type {\n ResolvedWebstrailConfig,\n WebstrailButtonConfig,\n WebstrailConfig,\n} from '../types/config';\nimport type { ButtonStyles } from '../types/tokens';\nimport { defaultButtonStyles, defaultResolvedConfig } from '../theme/defaultTheme';\nimport { getFocusRingColor, getDarkerShade, getSubtleBackgroundColor } from '../theme/deriveTokens';\nimport { deepMerge, stylesToCssVars } from '../utils/styles';\nimport { normalizeButtonSize } from '../types/common';\n\nlet currentConfig: ResolvedWebstrailConfig = JSON.parse(JSON.stringify(defaultResolvedConfig));\nconst listeners = new Set<(config: ResolvedWebstrailConfig) => void>();\n\n/**\n * Returns the current resolved global Webstrail configuration.\n */\nexport function getWebstrailConfig(): ResolvedWebstrailConfig {\n return currentConfig;\n}\n\n/**\n * Subscribes to global configuration changes.\n * Returns an unsubscribe callback function.\n */\nexport function subscribeWebstrailConfig(\n listener: (config: ResolvedWebstrailConfig) => void\n): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\n/**\n * Configures the global Webstrail library settings (theme, component defaults).\n * Notifies all subscribers and active components.\n *\n * @example\n * ```ts\n * configureWebstrail({\n * theme: {\n * primaryColor: '#2491eb',\n * },\n * components: {\n * button: {\n * variant: 'primary',\n * size: 'md',\n * },\n * },\n * });\n * ```\n */\nexport function configureWebstrail(userConfig: WebstrailConfig): ResolvedWebstrailConfig {\n const primaryColor =\n userConfig.theme?.primaryColor ||\n userConfig.colors?.primary ||\n currentConfig.theme.primaryColor;\n\n let derivedButtonStyles: Partial<ButtonStyles> = {};\n if (primaryColor) {\n const hoverBg = getDarkerShade(primaryColor, 0.12);\n const activeBg = getDarkerShade(primaryColor, 0.22);\n const ring = getFocusRingColor(primaryColor, 0.35);\n const outlineTint = getSubtleBackgroundColor(primaryColor, 0.08);\n\n derivedButtonStyles = {\n backgroundColor: primaryColor,\n hoverBackgroundColor: hoverBg,\n activeBackgroundColor: activeBg,\n focusRingColor: ring,\n outlineColor: primaryColor,\n outlineBorderColor: primaryColor,\n outlineHoverBackgroundColor: outlineTint,\n ghostColor: primaryColor,\n ghostHoverBackgroundColor: outlineTint,\n };\n }\n\n // Merge theme\n const mergedTheme = deepMerge(\n currentConfig.theme,\n userConfig.theme || {},\n userConfig.colors ? { colors: userConfig.colors } : {},\n userConfig.typography ? { typography: userConfig.typography } : {},\n userConfig.layout ? { layout: userConfig.layout } : {}\n );\n\n // Normalize component button config\n const rawButtonConfig: WebstrailButtonConfig = {\n ...(userConfig.components?.button || {}),\n ...(userConfig.button ? { styles: userConfig.button } : {}),\n };\n\n const buttonSize = rawButtonConfig.size\n ? normalizeButtonSize(rawButtonConfig.size)\n : currentConfig.components.button.size;\n\n const mergedButtonStyles = deepMerge(\n defaultButtonStyles,\n currentConfig.components.button.styles,\n derivedButtonStyles,\n rawButtonConfig.styles || {}\n );\n\n currentConfig = {\n theme: mergedTheme,\n components: {\n ...currentConfig.components,\n button: {\n variant: rawButtonConfig.variant ?? currentConfig.components.button.variant,\n size: buttonSize,\n fullWidth: rawButtonConfig.fullWidth ?? currentConfig.components.button.fullWidth,\n styles: mergedButtonStyles,\n },\n },\n };\n\n // Notify registered listeners\n listeners.forEach((listener) => {\n try {\n listener(currentConfig);\n } catch (e) {\n console.error('Error notifying Webstrail config listener:', e);\n }\n });\n\n // Dispatch browser DOM event if window is defined\n if (typeof window !== 'undefined') {\n try {\n window.dispatchEvent(\n new CustomEvent('webstrail-config-change', {\n detail: currentConfig,\n })\n );\n } catch {\n // Ignore if event dispatch fails in restricted environments\n }\n }\n\n return currentConfig;\n}\n\n/**\n * Resets global configuration to library defaults.\n */\nexport function resetWebstrailConfig(): void {\n currentConfig = JSON.parse(JSON.stringify(defaultResolvedConfig));\n listeners.forEach((listener) => {\n try {\n listener(currentConfig);\n } catch (e) {\n console.error('Error notifying Webstrail config listener:', e);\n }\n });\n}\n\n/**\n * Resolves effective Button properties and styles using 3-tier priority:\n * 1. Component-level properties / styles\n * 2. Global configuration\n * 3. Built-in default configuration\n */\nexport function resolveEffectiveButtonConfig(componentOverrides?: {\n variant?: ButtonVariant | string;\n size?: ButtonSize | string;\n fullWidth?: boolean;\n styles?: ButtonStyles;\n}): {\n variant: ButtonVariant;\n size: ButtonSize;\n fullWidth: boolean;\n styles: ButtonStyles;\n cssVars: Record<string, string>;\n} {\n const globalBtn = currentConfig.components.button;\n\n const variant = (componentOverrides?.variant as ButtonVariant) || globalBtn.variant || 'primary';\n const size = componentOverrides?.size\n ? normalizeButtonSize(componentOverrides.size)\n : globalBtn.size || 'medium';\n const fullWidth = componentOverrides?.fullWidth ?? globalBtn.fullWidth ?? false;\n\n const resolvedStyles = deepMerge(\n defaultButtonStyles,\n globalBtn.styles,\n componentOverrides?.styles || {}\n );\n\n const cssVars = {\n ...stylesToCssVars(resolvedStyles, 'wui-button'),\n ...stylesToCssVars(resolvedStyles, 'wb-button'),\n };\n\n return {\n variant,\n size,\n fullWidth,\n styles: resolvedStyles,\n cssVars,\n };\n}\n"],"names":["normalizeButtonSize","size","defaultColors","defaultTypography","defaultLayout","defaultButtonStyles","defaultResolvedConfig","getSubtleBackgroundColor","color","opacity","trimmed","hex6","g","b","hex3","percentage","getFocusRingColor","getDarkerShade","amount","factor","r","toHex","n","deriveTokensFromPrimary","primary","selectedBg","selectedHoverBg","ring","hoverBg","activeBg","outlineTint","UNITLESS_PROPERTIES","camelToKebab","str","normalizeDimension","propName","value","isRecord","deepMerge","target","sources","result","source","nextResult","key","sourceValue","existingValue","stylesToCssVars","styles","prefix","vars","varName","currentConfig","listeners","getWebstrailConfig","subscribeWebstrailConfig","listener","configureWebstrail","userConfig","_a","_b","_c","primaryColor","derivedButtonStyles","mergedTheme","rawButtonConfig","buttonSize","mergedButtonStyles","e","resetWebstrailConfig","resolveEffectiveButtonConfig","componentOverrides","globalBtn","variant","fullWidth","resolvedStyles","cssVars"],"mappings":"AAsCO,SAASA,EAAoBC,GAA2C;AAC7E,MAAI,CAACA,EAAM,QAAO;AAClB,UAAQA,GAAA;A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MAAM,8CAA8CA,CAAC;AAAA,IAC/D;AAAA,EACF,CAAC,GAGG,OAAO,SAAW;AACpB,QAAI;AACF,aAAO;AAAA,QACL,IAAI,YAAY,2BAA2B;AAAA,UACzC,QAAQhB;AAAA,QAAA,CACT;AAAA,MAAA;AAAA,IAEL,QAAQ;AAAA,IAER;AAGF,SAAOA;AACT;AAKO,SAASiB,IAA6B;AAC3C,EAAAjB,IAAgB,KAAK,MAAM,KAAK,UAAU9C,CAAqB,CAAC,GAChE+C,EAAU,QAAQ,CAACG,MAAa;AAC9B,QAAI;AACF,MAAAA,EAASJ,CAAa;AAAA,IACxB,SAAS,GAAG;AACV,cAAQ,MAAM,8CAA8C,CAAC;AAAA,IAC/D;AAAA,EACF,CAAC;AACH;AAQO,SAASkB,EAA6BC,GAW3C;AACA,QAAMC,IAAYpB,EAAc,WAAW,QAErCqB,KAAWF,KAAA,gBAAAA,EAAoB,YAA6BC,EAAU,WAAW,WACjFvE,IAAOsE,KAAA,QAAAA,EAAoB,OAC7BvE,EAAoBuE,EAAmB,IAAI,IAC3CC,EAAU,QAAQ,UAChBE,KAAYH,KAAA,gBAAAA,EAAoB,cAAaC,EAAU,aAAa,IAEpEG,IAAiBrC;AAAA,IACrBjC;AAAA,IACAmE,EAAU;AAAA,KACVD,KAAA,gBAAAA,EAAoB,WAAU,CAAA;AAAA,EAAC,GAG3BK,IAAU;AAAA,IACd,GAAG7B,EAAgB4B,GAAgB,YAAY;AAAA,IAC/C,GAAG5B,EAAgB4B,GAAgB,WAAW;AAAA,EAAA;AAGhD,SAAO;AAAA,IACL,SAAAF;AAAA,IACA,MAAAxE;AAAA,IACA,WAAAyE;AAAA,IACA,QAAQC;AAAA,IACR,SAAAC;AAAA,EAAA;AAEJ;"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),w=require("react"),Pe="_button_cc9s7_1",Ue="_sizeSmall_cc9s7_57",Ge="_sizeMedium_cc9s7_71",Ze="_sizeLarge_cc9s7_85",Ke="_variantPrimary_cc9s7_101",Je="_loading_cc9s7_113",Qe="_variantSecondary_cc9s7_143",Xe="_variantOutline_cc9s7_171",Ye="_variantGhost_cc9s7_227",me="_variantDanger_cc9s7_275",ye="_fullWidth_cc9s7_305",Ce="_disabled_cc9s7_315",Se="_spinner_cc9s7_349",Ne="_icon_cc9s7_369",J={button:Pe,sizeSmall:Ue,sizeMedium:Ge,sizeLarge:Ze,variantPrimary:Ke,loading:Je,variantSecondary:Qe,variantOutline:Xe,variantGhost:Ye,variantDanger:me,fullWidth:ye,disabled:Ce,spinner:Se,icon:Ne};function b(...a){const d=[];for(const c of a)if(c){if(typeof c=="string"||typeof c=="number"){const o=String(c).trim();o&&d.push(o)}else if(Array.isArray(c)){if(c.length>0){const o=b(...c);o&&d.push(o)}}else if(typeof c=="object"){for(const[o,i]of Object.entries(c))if(i){const f=o.trim();f&&d.push(f)}}}return d.join(" ")}const xe={colors:{primary:"#2491eb",secondary:"#406993",text:"#1f2937",textSecondary:"#6b7280",border:"#d1d5db",background:"#ffffff",error:"#dc2626",success:"#16a34a",disabled:"#9ca3af",disabledBackground:"#f3f4f6",disabledText:"#9ca3af",focusRing:"rgba(36, 145, 235, 0.35)"},typography:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif',fontSizeSmall:"12px",fontSizeMedium:"14px",fontSizeLarge:"16px",fontWeightNormal:400,fontWeightMedium:500,fontWeightBold:600},layout:{borderRadiusSmall:"6px",borderRadiusMedium:"8px",borderRadiusLarge:"12px"},button:{height:"40px",borderRadius:"8px",fontSize:"14px",fontWeight:500,backgroundColor:"#2491eb",textColor:"#ffffff",borderColor:"transparent",hoverBackgroundColor:"#1d78c4",hoverTextColor:"#ffffff",activeBackgroundColor:"#1565a0",disabledBackgroundColor:"#f3f4f6",disabledTextColor:"#9ca3af",disabledBorderColor:"#e5e7eb",focusRingColor:"rgba(36, 145, 235, 0.35)",padding:"0 16px",transition:"all 0.15s ease-in-out"},input:{height:"42px",borderRadius:"8px",borderColor:"#d1d5db",textColor:"#1f2937",placeholderColor:"#9ca3af",backgroundColor:"#ffffff",focusBorderColor:"#2491eb",focusRingColor:"rgba(36, 145, 235, 0.25)",errorBorderColor:"#dc2626",disabledBackgroundColor:"#f3f4f6",disabledTextColor:"#9ca3af",disabledBorderColor:"#e5e7eb",labelColor:"#374151",helperColor:"#6b7280",errorColor:"#dc2626",fontSize:"14px",padding:"0 14px",floatingLabel:!0},select:{height:"42px",borderRadius:"8px",borderColor:"#d1d5db",textColor:"#1f2937",placeholderColor:"#9ca3af",backgroundColor:"#ffffff",focusBorderColor:"#2491eb",focusRingColor:"rgba(36, 145, 235, 0.25)",errorBorderColor:"#dc2626",disabledBackgroundColor:"#f3f4f6",disabledTextColor:"#9ca3af",dropdownBackgroundColor:"#ffffff",dropdownBorderColor:"#e5e7eb",dropdownShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",optionTextColor:"#1f2937",optionHoverBackgroundColor:"#f3f4f6",optionHoverTextColor:"#1f2937",optionSelectedBackgroundColor:"#eff6ff",optionSelectedTextColor:"#2491eb",optionSelectedHoverBackgroundColor:"#dbeafe",optionCheckColor:"#2491eb",optionBorderRadius:"6px",optionPadding:"8px 12px",optionFontSize:"14px",optionFontWeight:400,optionSelectedFontWeight:500,labelColor:"#374151",errorColor:"#dc2626",fontSize:"14px",floatingLabel:!0},checkbox:{size:"18px",borderRadius:"4px",borderColor:"#d1d5db",checkedColor:"#2491eb",checkmarkColor:"#ffffff",backgroundColor:"#ffffff",focusRingColor:"rgba(36, 145, 235, 0.35)",disabledColor:"#d1d5db",disabledBackgroundColor:"#f3f4f6",labelColor:"#1f2937",fontSize:"14px"},textarea:{minHeight:"100px",borderRadius:"8px",borderColor:"#d1d5db",textColor:"#1f2937",placeholderColor:"#9ca3af",backgroundColor:"#ffffff",focusBorderColor:"#2491eb",focusRingColor:"rgba(36, 145, 235, 0.25)",errorBorderColor:"#dc2626",disabledBackgroundColor:"#f3f4f6",disabledTextColor:"#9ca3af",disabledBorderColor:"#e5e7eb",labelColor:"#374151",helperColor:"#6b7280",errorColor:"#dc2626",counterColor:"#9ca3af",fontSize:"14px",padding:"10px 14px",floatingLabel:!0},radio:{size:"18px",color:"#2491eb",checkedColor:"#2491eb",labelColor:"#1f2937",descriptionColor:"#6b7280",fontSize:"14px"},switch:{width:"40px",height:"22px",thumbSize:"16px",thumbColor:"#ffffff",trackColor:"#e2e8f0",trackCheckedColor:"#2491eb",focusRingColor:"rgba(36, 145, 235, 0.35)",borderRadius:"9999px",disabledOpacity:.5,labelColor:"#1f2937",descriptionColor:"#6b7280",fontSize:"14px"}},fe=w.createContext(xe);fe.displayName="UIContext";function Ie(){return w.useContext(fe)}function he(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function be(a,d=.1){if(!a||typeof a!="string")return"rgba(36, 145, 235, 0.1)";const c=a.trim(),o=c.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);if(o){const u=parseInt(o[1],16),h=parseInt(o[2],16),k=parseInt(o[3],16);return`rgba(${u}, ${h}, ${k}, ${d})`}const i=c.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);if(i){const u=parseInt(i[1]+i[1],16),h=parseInt(i[2]+i[2],16),k=parseInt(i[3]+i[3],16);return`rgba(${u}, ${h}, ${k}, ${d})`}const f=Math.round(d*100);return`color-mix(in srgb, ${c} ${f}%, #ffffff)`}function le(a,d=.25){if(!a||typeof a!="string")return"rgba(36, 145, 235, 0.25)";const c=a.trim(),o=c.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);if(o){const u=parseInt(o[1],16),h=parseInt(o[2],16),k=parseInt(o[3],16);return`rgba(${u}, ${h}, ${k}, ${d})`}const i=c.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);if(i){const u=parseInt(i[1]+i[1],16),h=parseInt(i[2]+i[2],16),k=parseInt(i[3]+i[3],16);return`rgba(${u}, ${h}, ${k}, ${d})`}const f=Math.round(d*100);return`color-mix(in srgb, ${c} ${f}%, transparent)`}function ge(a,d=.12){if(!a||typeof a!="string")return"#1d78c4";const c=a.trim(),o=c.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);if(o){const u=Math.max(0,1-d),h=Math.round(parseInt(o[1],16)*u),k=Math.round(parseInt(o[2],16)*u),j=Math.round(parseInt(o[3],16)*u),x=l=>l.toString(16).padStart(2,"0");return`#${x(h)}${x(k)}${x(j)}`}const i=c.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);if(i){const u=Math.max(0,1-d),h=Math.round(parseInt(i[1]+i[1],16)*u),k=Math.round(parseInt(i[2]+i[2],16)*u),j=Math.round(parseInt(i[3]+i[3],16)*u),x=l=>l.toString(16).padStart(2,"0");return`#${x(h)}${x(k)}${x(j)}`}const f=Math.round((1-d)*100);return`color-mix(in srgb, ${c} ${f}%, #000000)`}function $e(a){const d=be(a,.1),c=be(a,.18),o=le(a,.25),i=ge(a,.12),f=ge(a,.22),u=be(a,.08);return{colors:{primary:a,focusRing:o},select:{focusBorderColor:a,focusRingColor:o,optionSelectedTextColor:a,optionCheckColor:a,optionSelectedBackgroundColor:d,optionSelectedHoverBackgroundColor:c},button:{backgroundColor:a,hoverBackgroundColor:i,activeBackgroundColor:f,focusRingColor:o,outlineColor:a,outlineBorderColor:a,outlineHoverBackgroundColor:u,ghostColor:a,ghostHoverBackgroundColor:u},input:{focusBorderColor:a,focusRingColor:o},checkbox:{checkedColor:a,focusRingColor:o},textarea:{focusBorderColor:a,focusRingColor:o},radio:{color:a,checkedColor:a,focusRingColor:o},switch:{trackCheckedColor:a,focusRingColor:o}}}function pe(a,...d){let c={...a};for(const o of d){if(!o||!he(o))continue;const i={...c};for(const f of Object.keys(o)){const u=o[f];if(u===void 0)continue;const h=i[f];he(h)&&he(u)?i[f]=pe(h,u):i[f]=u}c=i}return c}function je(a,d){var o;if(!d)return{...a};const c=(o=d.colors)==null?void 0:o.primary;if(c&&typeof c=="string"){const i=$e(c);return pe(a,i,d)}return pe(a,d)}const se=new Set(["fontWeight","opacity","zIndex","lineHeight","flex","flexGrow","flexShrink","order"]);function er(a){return a.replace(/([A-Z])/g,"-$1").toLowerCase()}function rr(a,d){return typeof d=="number"&&!se.has(a)?`${d}px`:String(d)}function Be(a,d,c){return pe(a,d,c)}function ue(a,d){if(!a)return{};const c={};for(const[o,i]of Object.entries(a))if(!(i==null||i==="")&&(typeof i=="string"||typeof i=="number")){const f=`--${d}-${er(o)}`;c[f]=rr(o,i)}return c}function ie(a,d){const c=Ie(),o=xe[a],i=c[a];return w.useMemo(()=>{const f=Be(o,i,d),u=ue(f,`wui-${a}`);return{resolved:f,cssVars:u,getCombinedStyle:k=>k?{...u,...k}:u}},[a,o,i,d])}const Le=w.forwardRef(function({children:d,label:c,variant:o="primary",size:i="medium",loading:f=!1,loadingText:u,disabled:h=!1,startIcon:k,endIcon:j,fullWidth:x=!1,className:l,style:W,styles:O,type:I="button",...e},n){const{getCombinedStyle:U}=ie("button",O),_={primary:J.variantPrimary,secondary:J.variantSecondary,outline:J.variantOutline,ghost:J.variantGhost,danger:J.variantDanger}[o],p={small:J.sizeSmall,medium:J.sizeMedium,large:J.sizeLarge}[i],g=h||f,t=b("wui-button",J.button,_,p,x&&J.fullWidth,f&&J.loading,g&&J.disabled,l);return r.jsxs("button",{ref:n,type:I,className:t,style:U(W),disabled:g,"aria-busy":f||void 0,"aria-disabled":g||void 0,...e,children:[f?r.jsx("span",{className:J.spinner,"aria-hidden":"true"}):k?r.jsx("span",{className:J.icon,children:k}):null,f&&u?r.jsx("span",{children:u}):c!==void 0?r.jsx("span",{children:c}):d,!f&&j&&r.jsx("span",{className:J.icon,children:j})]})});Le.displayName="Button";const nr="_container_mdr3c_1",ir="_floatingContainer_mdr3c_8",cr="_label_mdr3c_12",or="_requiredAsterisk_mdr3c_22",ar="_outerWrapper_mdr3c_28",tr="_inputWrapper_mdr3c_35",dr="_outerIconBox_mdr3c_39",ur="_hasError_mdr3c_68",fr="_disabled_mdr3c_72",pr="_withFloatingLabel_mdr3c_93",br="_floatingLabel_mdr3c_121",_r="_floatingLabelText_mdr3c_143",hr="_withStartIcon_mdr3c_164",gr="_floated_mdr3c_168",xr="_input_mdr3c_35",vr="_floatingInput_mdr3c_219",wr="_withEndIcon_mdr3c_239",kr="_startIcon_mdr3c_243",Ir="_endIcon_mdr3c_244",lr="_helperText_mdr3c_254",$r="_errorMessage_mdr3c_260",$={container:nr,floatingContainer:ir,label:cr,requiredAsterisk:or,outerWrapper:ar,inputWrapper:tr,outerIconBox:dr,hasError:ur,disabled:fr,withFloatingLabel:pr,floatingLabel:br,floatingLabelText:_r,withStartIcon:hr,floated:gr,input:xr,floatingInput:vr,withEndIcon:wr,startIcon:kr,endIcon:Ir,helperText:lr,errorMessage:$r},ze=w.forwardRef(function({id:d,label:c,floatingLabel:o,helperText:i,errorMessage:f,required:u=!1,disabled:h=!1,readOnly:k=!1,startIcon:j,endIcon:x,startIconPlacement:l="inside",endIconPlacement:W="inside",outerStartIcon:O,outerEndIcon:I,className:e,style:n,styles:U,slotClassNames:_,slotStyles:p,"data-testid":g,onChange:t,onFocus:R,onBlur:V,...M},E){const G=w.useId(),B=d||`wui-input-${G}`,D=i?`${B}-helper`:void 0,L=f?`${B}-error`:void 0,q=w.useRef(null),{resolved:Y,getCombinedStyle:F}=ie("input",U),H=!!f,Z=o??(Y==null?void 0:Y.floatingLabel)??!0,m=M.value!==void 0,[y,s]=w.useState(M.defaultValue??""),[ee,C]=w.useState(!1),Q=m?M.value:y,re=Q!=null&&String(Q).trim().length>0,ce=ee||!!re,N=P=>{C(!0),R==null||R(P)},te=P=>{C(!1),V==null||V(P)},de=P=>{m||s(P.target.value),t==null||t(P)},oe=!!(Z&&c),ae=O??(l==="outside"?j:void 0),v=l==="outside"?void 0:j,A=I??(W==="outside"?x:void 0),K=W==="outside"?void 0:x,_e=!!(ae||A),qe=b("wui-input-container",$.container,oe&&$.floatingContainer,e),Oe=b("wui-input-wrapper",$.inputWrapper,oe&&$.withFloatingLabel,H&&$.hasError,h&&$.disabled,_==null?void 0:_.wrapper),Ve=b("wui-input-field",$.input,oe&&$.floatingInput,ce&&$.floated,!!v&&$.withStartIcon,!!K&&$.withEndIcon,_==null?void 0:_.input),De=[L,D].filter(Boolean).join(" ")||void 0,ke=r.jsxs("div",{className:Oe,style:p==null?void 0:p.wrapper,children:[Z&&c&&r.jsx("label",{htmlFor:B,className:b("wui-input-floating-label",$.floatingLabel,!!v&&$.withStartIcon,ce&&$.floated,(_==null?void 0:_.floatingLabel)||(_==null?void 0:_.label)),style:(p==null?void 0:p.floatingLabel)||(p==null?void 0:p.label),children:r.jsxs("span",{className:$.floatingLabelText,children:[c,u&&r.jsx("span",{className:$.requiredAsterisk,"aria-hidden":"true",children:"*"})]})}),v&&r.jsx("span",{className:$.startIcon,children:v}),r.jsx("input",{ref:P=>{q.current=P,typeof E=="function"?E(P):E&&(E.current=P)},id:B,disabled:h,readOnly:k,required:u,"aria-invalid":H?"true":"false","aria-describedby":De,className:Ve,style:p==null?void 0:p.input,onChange:de,onFocus:N,onBlur:te,...M}),K&&r.jsx("span",{className:$.endIcon,children:K})]}),He=_e?r.jsxs("div",{className:b("wui-input-outer-wrapper",$.outerWrapper,_==null?void 0:_.outerWrapper),style:p==null?void 0:p.outerWrapper,children:[ae&&r.jsx("div",{className:b("wui-input-outer-icon","wui-input-outer-start-icon",$.outerIconBox,h&&$.disabled,H&&$.hasError,(_==null?void 0:_.outerIconBox)||(_==null?void 0:_.outerStartIcon)),style:(p==null?void 0:p.outerIconBox)||(p==null?void 0:p.outerStartIcon),onClick:()=>{var P;return!h&&((P=q.current)==null?void 0:P.focus())},children:ae}),ke,A&&r.jsx("div",{className:b("wui-input-outer-icon","wui-input-outer-end-icon",$.outerIconBox,h&&$.disabled,H&&$.hasError,(_==null?void 0:_.outerIconBox)||(_==null?void 0:_.outerEndIcon)),style:(p==null?void 0:p.outerIconBox)||(p==null?void 0:p.outerEndIcon),onClick:()=>{var P;return!h&&((P=q.current)==null?void 0:P.focus())},children:A})]}):ke;return r.jsxs("div",{className:qe,style:F(n),"data-testid":g,children:[!Z&&c&&r.jsxs("label",{htmlFor:B,className:b("wui-input-label",$.label,_==null?void 0:_.label),style:p==null?void 0:p.label,children:[c,u&&r.jsx("span",{className:$.requiredAsterisk,"aria-hidden":"true",children:"*"})]}),He,H?r.jsx("span",{id:L,role:"alert",className:b("wui-input-error",$.errorMessage,_==null?void 0:_.errorMessage),style:p==null?void 0:p.errorMessage,children:f}):i?r.jsx("span",{id:D,className:b("wui-input-helper",$.helperText,_==null?void 0:_.helperText),style:p==null?void 0:p.helperText,children:i}):null]})});ze.displayName="Input";const jr="_container_1mwsv_1",Br="_disabled_1mwsv_27",Lr="_hiddenInput_1mwsv_37",zr="_box_1mwsv_55",Rr="_checked_1mwsv_91",Fr="_indeterminate_1mwsv_93",Ar="_icon_1mwsv_103",Tr="_label_1mwsv_123",ne={container:jr,disabled:Br,hiddenInput:Lr,box:zr,checked:Rr,indeterminate:Fr,icon:Ar,label:Tr},Re=w.forwardRef(function({label:d,checked:c,defaultChecked:o=!1,indeterminate:i=!1,disabled:f=!1,onChange:u,className:h,style:k,styles:j,slotClassNames:x,slotStyles:l,"data-testid":W,...O},I){const e=w.useRef(null);w.useImperativeHandle(I,()=>e.current);const n=c!==void 0,[U,_]=w.useState(o),p=n?c:U,{getCombinedStyle:g}=ie("checkbox",j);w.useEffect(()=>{e.current&&(e.current.indeterminate=!!i)},[i]);const t=M=>{f||(n||_(M.target.checked),u==null||u(M))},R=b("wui-checkbox-container",ne.container,f&&ne.disabled,x==null?void 0:x.container,h),V=b("wui-checkbox-box",ne.box,p&&ne.checked,i&&ne.indeterminate,x==null?void 0:x.box);return r.jsxs("label",{className:R,style:g(k),"data-testid":W,children:[r.jsx("input",{ref:e,type:"checkbox",checked:p,disabled:f,onChange:t,className:ne.hiddenInput,"aria-checked":i?"mixed":p,...O}),r.jsx("span",{className:V,style:l==null?void 0:l.box,children:i?r.jsx("svg",{className:b(ne.icon,x==null?void 0:x.icon),style:l==null?void 0:l.icon,viewBox:"0 0 24 24","aria-hidden":"true",children:r.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12",strokeWidth:"3"})}):p?r.jsx("svg",{className:b(ne.icon,x==null?void 0:x.icon),style:l==null?void 0:l.icon,viewBox:"0 0 24 24","aria-hidden":"true",children:r.jsx("polyline",{points:"20 6 9 17 4 12",strokeWidth:"3"})}):null}),d&&r.jsx("span",{className:b("wui-checkbox-label",ne.label,x==null?void 0:x.label),style:l==null?void 0:l.label,children:d})]})});Re.displayName="Checkbox";const Wr="_container_q8gl5_1",Mr="_floatingContainer_q8gl5_15",Er="_selectWrapper_q8gl5_23",qr="_withFloatingLabel_q8gl5_33",Or="_selectWrapperOpen_q8gl5_41",Vr="_label_q8gl5_49",Dr="_requiredAsterisk_q8gl5_69",Hr="_floatingLabel_q8gl5_81",Pr="_floatingLabelText_q8gl5_125",Ur="_floated_q8gl5_167",Gr="_trigger_q8gl5_199",Zr="_hasError_q8gl5_199",Kr="_disabled_q8gl5_209",Jr="_open_q8gl5_273",Qr="_value_q8gl5_315",Xr="_placeholder_q8gl5_329",Yr="_floatingPlaceholder_q8gl5_337",mr="_arrow_q8gl5_359",yr="_arrowOpen_q8gl5_379",Cr="_dropdown_q8gl5_387",Sr="_option_q8gl5_431",Nr="_optionActive_q8gl5_467",sr="_optionSelected_q8gl5_477",en="_optionDisabled_q8gl5_519",rn="_checkIcon_q8gl5_531",nn="_errorMessage_q8gl5_553",z={container:Wr,floatingContainer:Mr,selectWrapper:Er,withFloatingLabel:qr,selectWrapperOpen:Or,label:Vr,requiredAsterisk:Dr,floatingLabel:Hr,floatingLabelText:Pr,floated:Ur,trigger:Gr,hasError:Zr,disabled:Kr,open:Jr,value:Qr,placeholder:Xr,floatingPlaceholder:Yr,arrow:mr,arrowOpen:yr,dropdown:Cr,option:Sr,optionActive:Nr,optionSelected:sr,optionDisabled:en,checkIcon:rn,errorMessage:nn},Fe=w.forwardRef(function({options:d,value:c,defaultValue:o,placeholder:i="Select an option...",label:f,floatingLabel:u,errorMessage:h,disabled:k=!1,required:j=!1,onChange:x,name:l,className:W,style:O,styles:I,slotClassNames:e,slotStyles:n,"data-testid":U,id:_},p){const g=w.useId(),t=_||`wui-select-${g}`,R=`${t}-label`,V=`${t}-listbox`,M=h?`${t}-error`:void 0,E=c!==void 0,[G,B]=w.useState(o),D=E?c:G,[L,q]=w.useState(!1),[Y,F]=w.useState(!1),[H,Z]=w.useState(-1),m=w.useRef(null),y=w.useRef(null),{resolved:s,getCombinedStyle:ee}=ie("select",I),C=!!h,Q=u??(s==null?void 0:s.floatingLabel)??!0,re=!!(Q&&f),ce=L||Y||!!D,N=d.find(v=>v.value===D);w.useEffect(()=>{if(!L)return;const v=A=>{m.current&&!m.current.contains(A.target)&&q(!1)};return document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[L]);const te=v=>{var A;v.disabled||k||(E||B(v.value),x==null||x(v.value),q(!1),(A=y.current)==null||A.focus())},de=v=>{if(!k)if(v.key==="ArrowDown"||v.key==="ArrowUp"){if(v.preventDefault(),!L){q(!0),Z(0);return}const A=v.key==="ArrowDown"?1:-1;let K=H+A;K<0&&(K=d.length-1),K>=d.length&&(K=0),Z(K)}else v.key==="Enter"||v.key===" "?(v.preventDefault(),L&&H>=0&&d[H]?te(d[H]):q(A=>!A)):v.key==="Escape"&&L&&(v.preventDefault(),q(!1))},oe=b("wui-select-container",z.container,re&&z.floatingContainer,e==null?void 0:e.container,W),ae=b("wui-select-trigger",z.trigger,L&&z.open,C&&z.hasError,k&&z.disabled,e==null?void 0:e.trigger);return r.jsxs("div",{ref:v=>{m.current=v,typeof p=="function"?p(v):p&&(p.current=v)},className:oe,style:ee(O),"data-testid":U,children:[!Q&&f&&r.jsxs("label",{id:R,className:b("wui-select-label",z.label,e==null?void 0:e.label),style:n==null?void 0:n.label,onClick:()=>{var v;return!k&&((v=y.current)==null?void 0:v.focus())},children:[f,j&&r.jsx("span",{className:z.requiredAsterisk,"aria-hidden":"true",children:"*"})]}),l&&r.jsx("input",{type:"hidden",name:l,value:D||""}),r.jsxs("div",{className:b("wui-select-wrapper",z.selectWrapper,re&&z.withFloatingLabel,L&&z.selectWrapperOpen,e==null?void 0:e.wrapper),style:n==null?void 0:n.wrapper,children:[r.jsxs("button",{ref:y,id:t,type:"button",role:"combobox","aria-expanded":L,"aria-haspopup":"listbox","aria-controls":V,"aria-labelledby":f?R:void 0,"aria-invalid":C?"true":"false","aria-describedby":M,disabled:k,onClick:()=>!k&&q(v=>!v),onFocus:()=>F(!0),onBlur:()=>F(!1),onKeyDown:de,className:ae,style:n==null?void 0:n.trigger,children:[r.jsx("span",{className:b("wui-select-value",z.value,!N&&z.placeholder,re&&!N&&z.floatingPlaceholder,ce&&z.floated,N?e==null?void 0:e.value:e==null?void 0:e.placeholder),style:N?n==null?void 0:n.value:n==null?void 0:n.placeholder,children:N?N.label:i}),r.jsx("span",{className:b("wui-select-arrow",z.arrow,L&&z.arrowOpen,e==null?void 0:e.arrow),style:n==null?void 0:n.arrow,"aria-hidden":"true",children:r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:r.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),re&&r.jsx("label",{id:R,htmlFor:t,className:b("wui-select-floating-label",z.floatingLabel,ce&&z.floated,(e==null?void 0:e.floatingLabel)||(e==null?void 0:e.label)),style:(n==null?void 0:n.floatingLabel)||(n==null?void 0:n.label),onClick:()=>{var v;return!k&&((v=y.current)==null?void 0:v.focus())},children:r.jsxs("span",{className:z.floatingLabelText,children:[f,j&&r.jsx("span",{className:z.requiredAsterisk,"aria-hidden":"true",children:"*"})]})}),L&&r.jsx("ul",{id:V,role:"listbox","aria-labelledby":f?R:void 0,className:b("wui-select-dropdown",z.dropdown,e==null?void 0:e.dropdown),style:n==null?void 0:n.dropdown,children:d.map((v,A)=>{const K=v.value===D,_e=A===H;return r.jsxs("li",{role:"option","aria-selected":K,"aria-disabled":v.disabled||void 0,className:b("wui-select-option",z.option,K&&z.optionSelected,_e&&z.optionActive,v.disabled&&z.optionDisabled,e==null?void 0:e.option,K&&(e==null?void 0:e.selectedOption)),style:{...n==null?void 0:n.option,...K?n==null?void 0:n.selectedOption:void 0},onClick:()=>te(v),children:[r.jsx("span",{children:v.label}),K&&r.jsx("svg",{className:b(z.checkIcon,e==null?void 0:e.checkIcon),style:n==null?void 0:n.checkIcon,viewBox:"0 0 24 24",strokeWidth:"3","aria-hidden":"true",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})})]},v.value)})})]}),C&&r.jsx("span",{id:M,role:"alert",className:b("wui-select-error",z.errorMessage,e==null?void 0:e.errorMessage),style:n==null?void 0:n.errorMessage,children:h})]})});Fe.displayName="Select";const cn="_container_1tasa_1",on="_floatingContainer_1tasa_8",an="_label_1tasa_12",tn="_requiredAsterisk_1tasa_22",dn="_wrapper_1tasa_28",un="_withFloatingLabel_1tasa_40",fn="_hasError_1tasa_53",pn="_disabled_1tasa_62",bn="_floatingLabel_1tasa_68",_n="_floatingLabelText_1tasa_90",hn="_floated_1tasa_111",gn="_textarea_1tasa_139",xn="_floatingTextarea_1tasa_159",vn="_footer_1tasa_175",wn="_helperText_1tasa_183",kn="_errorMessage_1tasa_188",In="_counter_1tasa_194",T={container:cn,floatingContainer:on,label:an,requiredAsterisk:tn,wrapper:dn,withFloatingLabel:un,hasError:fn,disabled:pn,floatingLabel:bn,floatingLabelText:_n,floated:hn,textarea:gn,floatingTextarea:xn,footer:vn,helperText:wn,errorMessage:kn,counter:In},Ae=w.forwardRef(function({id:d,label:c,floatingLabel:o,helperText:i,errorMessage:f,required:u=!1,disabled:h=!1,readOnly:k=!1,rows:j=4,maxLength:x,showCount:l=!1,value:W,defaultValue:O,onChange:I,onFocus:e,onBlur:n,className:U,style:_,styles:p,slotClassNames:g,slotStyles:t,"data-testid":R,...V},M){const E=w.useId(),G=d||`wui-textarea-${E}`,B=i?`${G}-helper`:void 0,D=f?`${G}-error`:void 0,L=W!==void 0,[q,Y]=w.useState(O!==void 0?String(O):""),[F,H]=w.useState(!1),Z=L?String(W??""):q,m=Z!=null&&String(Z).trim().length>0,{resolved:y,getCombinedStyle:s}=ie("textarea",p),ee=!!f,C=o??(y==null?void 0:y.floatingLabel)??!0,Q=!!(C&&c),re=F||!!m,ce=A=>{L||Y(A.target.value),I==null||I(A)},N=A=>{H(!0),e==null||e(A)},te=A=>{H(!1),n==null||n(A)},de=b("wui-textarea-container",T.container,Q&&T.floatingContainer,g==null?void 0:g.container,U),oe=b("wui-textarea-wrapper",T.wrapper,Q&&T.withFloatingLabel,ee&&T.hasError,h&&T.disabled,g==null?void 0:g.wrapper),ae=b("wui-textarea-field",T.textarea,Q&&T.floatingTextarea,re&&T.floated,g==null?void 0:g.textarea),v=[D,B].filter(Boolean).join(" ")||void 0;return r.jsxs("div",{className:de,style:s(_),"data-testid":R,children:[!C&&c&&r.jsxs("label",{htmlFor:G,className:b("wui-textarea-label",T.label,g==null?void 0:g.label),style:t==null?void 0:t.label,children:[c,u&&r.jsx("span",{className:T.requiredAsterisk,"aria-hidden":"true",children:"*"})]}),r.jsxs("div",{className:oe,style:t==null?void 0:t.wrapper,children:[Q&&r.jsx("label",{htmlFor:G,className:b("wui-textarea-floating-label",T.floatingLabel,re&&T.floated,(g==null?void 0:g.floatingLabel)||(g==null?void 0:g.label)),style:(t==null?void 0:t.floatingLabel)||(t==null?void 0:t.label),children:r.jsxs("span",{className:T.floatingLabelText,children:[c,u&&r.jsx("span",{className:T.requiredAsterisk,"aria-hidden":"true",children:"*"})]})}),r.jsx("textarea",{ref:M,id:G,rows:j,maxLength:x,value:L?W:void 0,defaultValue:L?void 0:O,onChange:ce,onFocus:N,onBlur:te,disabled:h,readOnly:k,required:u,"aria-invalid":ee?"true":"false","aria-describedby":v,className:ae,style:t==null?void 0:t.textarea,...V})]}),r.jsxs("div",{className:T.footer,children:[ee?r.jsx("span",{id:D,role:"alert",className:b("wui-textarea-error",T.errorMessage,g==null?void 0:g.errorMessage),style:t==null?void 0:t.errorMessage,children:f}):i?r.jsx("span",{id:B,className:b("wui-textarea-helper",T.helperText,g==null?void 0:g.helperText),style:t==null?void 0:t.helperText,children:i}):r.jsx("span",{}),l&&r.jsx("span",{className:b("wui-textarea-counter",T.counter,g==null?void 0:g.counter),style:t==null?void 0:t.counter,"aria-live":"polite",children:x!==void 0?`${Z.length} / ${x}`:Z.length})]})]})});Ae.displayName="Textarea";const ln="_container_1ek6o_1",$n="_disabled_1ek6o_29",jn="_radio_1ek6o_39",Bn="_labelWrapper_1ek6o_71",Ln="_label_1ek6o_71",zn="_labelChecked_1ek6o_99",Rn="_description_1ek6o_109",Fn="_groupContainer_1ek6o_121",An="_groupLabel_1ek6o_135",Tn="_optionsVertical_1ek6o_149",Wn="_optionsHorizontal_1ek6o_161",Mn="_groupError_1ek6o_175",S={container:ln,disabled:$n,radio:jn,labelWrapper:Bn,label:Ln,labelChecked:zn,description:Rn,groupContainer:Fn,groupLabel:An,optionsVertical:Tn,optionsHorizontal:Wn,groupError:Mn},ve=w.createContext(null);function Te(){return w.useContext(ve)}const we=w.forwardRef(function({label:d,description:c,value:o,size:i,color:f,checked:u,defaultChecked:h=!1,disabled:k=!1,onChange:j,name:x,className:l,style:W,styles:O,slotClassNames:I,slotStyles:e,"data-testid":n,id:U,..._},p){const g=w.useRef(null);w.useImperativeHandle(p,()=>g.current);const t=Te(),R=!!t,V=x||(t==null?void 0:t.name),M=R?(t==null?void 0:t.value)!==void 0&&o!==void 0?t.value===o:u!==void 0?u:h:u!==void 0?u:void 0,[E,G]=w.useState(h),B=R?M:u!==void 0?u:E,D=k||!!(t!=null&&t.disabled),L=i??(t==null?void 0:t.size),q=f??(t==null?void 0:t.color),Y={...(t==null?void 0:t.groupStyles)||{},...O||{},...L!==void 0?{size:L}:{},...q!==void 0?{color:q}:{}},{resolved:F,getCombinedStyle:H}=ie("radio",Y),Z=q||(F==null?void 0:F.color)||(F==null?void 0:F.checkedColor),m=L!==void 0?typeof L=="number"?`${L}px`:L:(F==null?void 0:F.size)!==void 0?typeof F.size=="number"?`${F.size}px`:F.size:void 0,y=C=>{var Q;D||(!R&&u===void 0&&G(C.target.checked),t&&o!==void 0&&((Q=t.onChange)==null||Q.call(t,o)),j==null||j(C))},s=b("wui-radio-container",S.container,D&&S.disabled,I==null?void 0:I.container,l),ee=b("wui-radio-input",S.radio,(I==null?void 0:I.radio)||(I==null?void 0:I.control));return r.jsxs("label",{className:s,style:H(W),"data-testid":n,children:[r.jsx("input",{ref:g,id:U,type:"radio",name:V,value:o,checked:B,defaultChecked:R?void 0:h,disabled:D,onChange:y,className:ee,style:{...Z?{accentColor:Z}:void 0,...m?{width:m,height:m}:void 0,...(e==null?void 0:e.radio)||(e==null?void 0:e.control)},..._}),(d||c)&&r.jsxs("span",{className:b("wui-radio-label-wrapper",S.labelWrapper,I==null?void 0:I.labelWrapper),style:e==null?void 0:e.labelWrapper,children:[d&&r.jsx("span",{className:b("wui-radio-label",S.label,B&&S.labelChecked,I==null?void 0:I.label,B&&(I==null?void 0:I.labelChecked)),style:e==null?void 0:e.label,children:d}),c&&r.jsx("span",{className:b("wui-radio-description",S.description,I==null?void 0:I.description),style:e==null?void 0:e.description,children:c})]})]})});we.displayName="Radio";const We=w.forwardRef(function({name:d,value:c,defaultValue:o,onChange:i,options:f,direction:u="vertical",label:h,errorMessage:k,disabled:j=!1,size:x,color:l,children:W,styles:O,className:I,style:e,"data-testid":n},U){const _=w.useId(),p=d||`wui-radiogroup-${_}`,g=c!==void 0,[t,R]=w.useState(o),V=g?c:t,M=B=>{j||(g||R(B),i==null||i(B))},E=b("wui-radiogroup-container",S.groupContainer,I),G=u==="horizontal"?S.optionsHorizontal:S.optionsVertical;return r.jsx(ve.Provider,{value:{name:p,value:V,onChange:M,disabled:j,size:x,color:l,groupStyles:O},children:r.jsxs("div",{ref:U,role:"radiogroup","aria-label":typeof h=="string"?h:void 0,className:E,style:e,"data-testid":n,children:[h&&r.jsx("span",{className:S.groupLabel,children:h}),r.jsx("div",{className:G,children:f?f.map(B=>r.jsx(we,{value:B.value,label:B.label,description:B.description,disabled:B.disabled,size:B.size,color:B.color,styles:B.styles},B.value)):W}),k&&r.jsx("span",{role:"alert",className:S.groupError,children:k})]})})});We.displayName="RadioGroup";const En="_container_17pmz_1",qn="_disabled_17pmz_15",On="_hiddenInput_17pmz_20",Vn="_track_17pmz_30",Dn="_checked_17pmz_51",Hn="_thumb_17pmz_56",Pn="_sizeSmall_17pmz_83",Un="_sizeMedium_17pmz_90",Gn="_sizeLarge_17pmz_97",Zn="_icon_17pmz_105",Kn="_labelWrapper_17pmz_116",Jn="_label_17pmz_116",Qn="_description_17pmz_127",X={container:En,disabled:qn,hiddenInput:On,track:Vn,checked:Dn,thumb:Hn,sizeSmall:Pn,sizeMedium:Un,sizeLarge:Gn,icon:Zn,labelWrapper:Kn,label:Jn,description:Qn},Xn={small:X.sizeSmall,medium:X.sizeMedium,large:X.sizeLarge},Me=w.forwardRef(function({checked:d,defaultChecked:c=!1,onChange:o,disabled:i=!1,size:f="medium",label:u,description:h,checkedIcon:k,uncheckedIcon:j,name:x,value:l,className:W,style:O,styles:I,slotClassNames:e,slotStyles:n,"data-testid":U,id:_,...p},g){const t=w.useRef(null);w.useImperativeHandle(g,()=>t.current);const R=d!==void 0,[V,M]=w.useState(c),E=R?d:V,{getCombinedStyle:G}=ie("switch",I),B=Y=>{if(i)return;const F=Y.target.checked;R||M(F),o==null||o(F,Y)},D=b("wui-switch-container",X.container,i&&X.disabled,e==null?void 0:e.container,W),L=b("wui-switch-track",X.track,Xn[f],E&&X.checked,e==null?void 0:e.track),q=b("wui-switch-thumb",X.thumb,e==null?void 0:e.thumb);return r.jsxs("label",{className:D,style:G(O),"data-testid":U,children:[r.jsx("input",{ref:t,id:_,type:"checkbox",role:"switch",name:x,value:l,checked:E,disabled:i,onChange:B,className:X.hiddenInput,"aria-checked":E,...p}),r.jsx("span",{className:L,style:n==null?void 0:n.track,"aria-hidden":"true",children:r.jsx("span",{className:q,style:n==null?void 0:n.thumb,children:E?k&&r.jsx("span",{className:b(X.icon,e==null?void 0:e.icon),style:n==null?void 0:n.icon,children:k}):j&&r.jsx("span",{className:b(X.icon,e==null?void 0:e.icon),style:n==null?void 0:n.icon,children:j})})}),(u||h)&&r.jsxs("span",{className:b("wui-switch-label-wrapper",X.labelWrapper,e==null?void 0:e.labelWrapper),style:n==null?void 0:n.labelWrapper,children:[u&&r.jsx("span",{className:b("wui-switch-label",X.label,e==null?void 0:e.label),style:n==null?void 0:n.label,children:u}),h&&r.jsx("span",{className:b("wui-switch-description",X.description,e==null?void 0:e.description),style:n==null?void 0:n.description,children:h})]})]})});Me.displayName="Switch";const Ee=({children:a,config:d,wrapWithContainer:c=!1,className:o,style:i})=>{const f=w.useContext(fe),u=w.useMemo(()=>je(f,d),[f,d]),h=w.useMemo(()=>{if(!c)return{};const j=ue(u.colors,"wui-color"),x=ue(u.typography,"wui-typography"),l=ue(u.layout,"wui-layout");return{...j,...x,...l,...i}},[c,u,i]),k=c?r.jsx("div",{className:o?`wui-provider-root ${o}`:"wui-provider-root",style:h,children:a}):a;return r.jsx(fe.Provider,{value:u,children:k})};Ee.displayName="UIProvider";exports.Button=Le;exports.Checkbox=Re;exports.Input=ze;exports.Radio=we;exports.RadioGroup=We;exports.RadioGroupContext=ve;exports.Select=Fe;exports.Switch=Me;exports.Textarea=Ae;exports.UIContext=fe;exports.UIProvider=Ee;exports.classNames=b;exports.deepMerge=pe;exports.defaultUIConfig=xe;exports.deriveTokensFromPrimary=$e;exports.getDarkerShade=ge;exports.getFocusRingColor=le;exports.getSubtleBackgroundColor=be;exports.mergeUIConfig=je;exports.resolveComponentStyles=Be;exports.stylesToCssVars=ue;exports.useComponentStyles=ie;exports.useRadioGroup=Te;exports.useUI=Ie;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("./core.cjs"),T=require("./UIProvider-C3ae0nQV.cjs"),n=require("react/jsx-runtime"),u=require("react"),pe=require("./web-components.cjs"),qe="_container_106aw_1",Ee="_floatingContainer_106aw_15",Te="_label_106aw_23",Re="_requiredAsterisk_106aw_43",ze="_outerWrapper_106aw_55",Fe="_inputWrapper_106aw_69",Ae="_outerIconBox_106aw_77",Me="_hasError_106aw_135",Oe="_disabled_106aw_143",Ve="_withFloatingLabel_106aw_185",De="_floatingLabel_106aw_241",Ue="_floatingLabelText_106aw_285",Ge="_withStartIcon_106aw_327",Pe="_floated_106aw_335",He="_input_106aw_69",Ke="_floatingInput_106aw_437",Ze="_withEndIcon_106aw_477",Je="_startIcon_106aw_485",Qe="_endIcon_106aw_487",Xe="_helperText_106aw_507",Ye="_errorMessage_106aw_519",h={container:qe,floatingContainer:Ee,label:Te,requiredAsterisk:Re,outerWrapper:ze,inputWrapper:Fe,outerIconBox:Ae,hasError:Me,disabled:Oe,withFloatingLabel:Ve,floatingLabel:De,floatingLabelText:Ue,withStartIcon:Ge,floated:Pe,input:He,floatingInput:Ke,withEndIcon:Ze,startIcon:Je,endIcon:Qe,helperText:Xe,errorMessage:Ye};function a(...ie){const k=[];for(const p of ie)if(p){if(typeof p=="string"||typeof p=="number"){const I=String(p).trim();I&&k.push(I)}else if(Array.isArray(p)){if(p.length>0){const I=a(...p);I&&k.push(I)}}else if(typeof p=="object"){for(const[I,j]of Object.entries(p))if(j){const b=I.trim();b&&k.push(b)}}}return k.join(" ")}const be=u.forwardRef(function({id:k,label:p,floatingLabel:I,helperText:j,errorMessage:b,required:L=!1,disabled:g=!1,readOnly:q=!1,startIcon:R,endIcon:_,startIconPlacement:$="inside",endIconPlacement:O="inside",outerStartIcon:P,outerEndIcon:f,className:e,style:r,styles:X,slotClassNames:d,slotStyles:c,"data-testid":t,onChange:i,onFocus:W,onBlur:V,...F},A){const H=u.useId(),w=k||`wui-input-${H}`,D=j?`${w}-helper`:void 0,x=b?`${w}-error`:void 0,M=u.useRef(null),{resolved:m,getCombinedStyle:B}=T.useComponentStyles("input",X),U=!!b,K=I??(m==null?void 0:m.floatingLabel)??!0,y=F.value!==void 0,[l,s]=u.useState(F.defaultValue??""),[ee,S]=u.useState(!1),J=y?F.value:l,ne=J!=null&&String(J).trim().length>0,ce=ee||!!ne,C=G=>{S(!0),W==null||W(G)},oe=G=>{S(!1),V==null||V(G)},te=G=>{y||s(G.target.value),i==null||i(G)},ae=!!(K&&p),de=P??($==="outside"?R:void 0),o=$==="outside"?void 0:R,E=f??(O==="outside"?_:void 0),Z=O==="outside"?void 0:_,ue=!!(de||E),je=a("wui-input-container",h.container,ae&&h.floatingContainer,e),Le=a("wui-input-wrapper",h.inputWrapper,ae&&h.withFloatingLabel,U&&h.hasError,g&&h.disabled,d==null?void 0:d.wrapper),$e=a("wui-input-field",h.input,ae&&h.floatingInput,ce&&h.floated,!!o&&h.withStartIcon,!!Z&&h.withEndIcon,d==null?void 0:d.input),We=[x,D].filter(Boolean).join(" ")||void 0,he=n.jsxs("div",{className:Le,style:c==null?void 0:c.wrapper,children:[K&&p&&n.jsx("label",{htmlFor:w,className:a("wui-input-floating-label",h.floatingLabel,!!o&&h.withStartIcon,ce&&h.floated,(d==null?void 0:d.floatingLabel)||(d==null?void 0:d.label)),style:(c==null?void 0:c.floatingLabel)||(c==null?void 0:c.label),children:n.jsxs("span",{className:h.floatingLabelText,children:[p,L&&n.jsx("span",{className:h.requiredAsterisk,"aria-hidden":"true",children:"*"})]})}),o&&n.jsx("span",{className:h.startIcon,children:o}),n.jsx("input",{ref:G=>{M.current=G,typeof A=="function"?A(G):A&&(A.current=G)},id:w,disabled:g,readOnly:q,required:L,"aria-invalid":U?"true":"false","aria-describedby":We,className:$e,style:c==null?void 0:c.input,onChange:te,onFocus:C,onBlur:oe,...F}),Z&&n.jsx("span",{className:h.endIcon,children:Z})]}),Be=ue?n.jsxs("div",{className:a("wui-input-outer-wrapper",h.outerWrapper,d==null?void 0:d.outerWrapper),style:c==null?void 0:c.outerWrapper,children:[de&&n.jsx("div",{className:a("wui-input-outer-icon","wui-input-outer-start-icon",h.outerIconBox,g&&h.disabled,U&&h.hasError,(d==null?void 0:d.outerIconBox)||(d==null?void 0:d.outerStartIcon)),style:(c==null?void 0:c.outerIconBox)||(c==null?void 0:c.outerStartIcon),onClick:()=>{var G;return!g&&((G=M.current)==null?void 0:G.focus())},children:de}),he,E&&n.jsx("div",{className:a("wui-input-outer-icon","wui-input-outer-end-icon",h.outerIconBox,g&&h.disabled,U&&h.hasError,(d==null?void 0:d.outerIconBox)||(d==null?void 0:d.outerEndIcon)),style:(c==null?void 0:c.outerIconBox)||(c==null?void 0:c.outerEndIcon),onClick:()=>{var G;return!g&&((G=M.current)==null?void 0:G.focus())},children:E})]}):he;return n.jsxs("div",{className:je,style:B(r),"data-testid":t,children:[!K&&p&&n.jsxs("label",{htmlFor:w,className:a("wui-input-label",h.label,d==null?void 0:d.label),style:c==null?void 0:c.label,children:[p,L&&n.jsx("span",{className:h.requiredAsterisk,"aria-hidden":"true",children:"*"})]}),Be,U?n.jsx("span",{id:x,role:"alert",className:a("wui-input-error",h.errorMessage,d==null?void 0:d.errorMessage),style:c==null?void 0:c.errorMessage,children:b}):j?n.jsx("span",{id:D,className:a("wui-input-helper",h.helperText,d==null?void 0:d.helperText),style:c==null?void 0:c.helperText,children:j}):null]})});be.displayName="Input";const me="_container_1mwsv_1",ye="_disabled_1mwsv_27",le="_hiddenInput_1mwsv_37",Se="_box_1mwsv_55",Ne="_checked_1mwsv_91",Ce="_indeterminate_1mwsv_93",se="_icon_1mwsv_103",en="_label_1mwsv_123",re={container:me,disabled:ye,hiddenInput:le,box:Se,checked:Ne,indeterminate:Ce,icon:se,label:en},ge=u.forwardRef(function({label:k,checked:p,defaultChecked:I=!1,indeterminate:j=!1,disabled:b=!1,onChange:L,className:g,style:q,styles:R,slotClassNames:_,slotStyles:$,"data-testid":O,...P},f){const e=u.useRef(null);u.useImperativeHandle(f,()=>e.current);const r=p!==void 0,[X,d]=u.useState(I),c=r?p:X,{getCombinedStyle:t}=T.useComponentStyles("checkbox",R);u.useEffect(()=>{e.current&&(e.current.indeterminate=!!j)},[j]);const i=F=>{b||(r||d(F.target.checked),L==null||L(F))},W=a("wui-checkbox-container",re.container,b&&re.disabled,_==null?void 0:_.container,g),V=a("wui-checkbox-box",re.box,c&&re.checked,j&&re.indeterminate,_==null?void 0:_.box);return n.jsxs("label",{className:W,style:t(q),"data-testid":O,children:[n.jsx("input",{ref:e,type:"checkbox",checked:c,disabled:b,onChange:i,className:re.hiddenInput,"aria-checked":j?"mixed":c,...P}),n.jsx("span",{className:V,style:$==null?void 0:$.box,children:j?n.jsx("svg",{className:a(re.icon,_==null?void 0:_.icon),style:$==null?void 0:$.icon,viewBox:"0 0 24 24","aria-hidden":"true",children:n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12",strokeWidth:"3"})}):c?n.jsx("svg",{className:a(re.icon,_==null?void 0:_.icon),style:$==null?void 0:$.icon,viewBox:"0 0 24 24","aria-hidden":"true",children:n.jsx("polyline",{points:"20 6 9 17 4 12",strokeWidth:"3"})}):null}),k&&n.jsx("span",{className:a("wui-checkbox-label",re.label,_==null?void 0:_.label),style:$==null?void 0:$.label,children:k})]})});ge.displayName="Checkbox";const nn="_container_q8gl5_1",rn="_floatingContainer_q8gl5_15",cn="_selectWrapper_q8gl5_23",an="_withFloatingLabel_q8gl5_33",dn="_selectWrapperOpen_q8gl5_41",on="_label_q8gl5_49",tn="_requiredAsterisk_q8gl5_69",un="_floatingLabel_q8gl5_81",pn="_floatingLabelText_q8gl5_125",fn="_floated_q8gl5_167",_n="_trigger_q8gl5_199",hn="_hasError_q8gl5_199",bn="_disabled_q8gl5_209",gn="_open_q8gl5_273",wn="_value_q8gl5_315",xn="_placeholder_q8gl5_329",vn="_floatingPlaceholder_q8gl5_337",kn="_arrow_q8gl5_359",In="_arrowOpen_q8gl5_379",jn="_dropdown_q8gl5_387",Ln="_option_q8gl5_431",$n="_optionActive_q8gl5_467",Wn="_optionSelected_q8gl5_477",Bn="_optionDisabled_q8gl5_519",qn="_checkIcon_q8gl5_531",En="_errorMessage_q8gl5_553",v={container:nn,floatingContainer:rn,selectWrapper:cn,withFloatingLabel:an,selectWrapperOpen:dn,label:on,requiredAsterisk:tn,floatingLabel:un,floatingLabelText:pn,floated:fn,trigger:_n,hasError:hn,disabled:bn,open:gn,value:wn,placeholder:xn,floatingPlaceholder:vn,arrow:kn,arrowOpen:In,dropdown:jn,option:Ln,optionActive:$n,optionSelected:Wn,optionDisabled:Bn,checkIcon:qn,errorMessage:En},we=u.forwardRef(function({options:k,value:p,defaultValue:I,placeholder:j="Select an option...",label:b,floatingLabel:L,errorMessage:g,disabled:q=!1,required:R=!1,onChange:_,name:$,className:O,style:P,styles:f,slotClassNames:e,slotStyles:r,"data-testid":X,id:d},c){const t=u.useId(),i=d||`wui-select-${t}`,W=`${i}-label`,V=`${i}-listbox`,F=g?`${i}-error`:void 0,A=p!==void 0,[H,w]=u.useState(I),D=A?p:H,[x,M]=u.useState(!1),[m,B]=u.useState(!1),[U,K]=u.useState(-1),y=u.useRef(null),l=u.useRef(null),{resolved:s,getCombinedStyle:ee}=T.useComponentStyles("select",f),S=!!g,J=L??(s==null?void 0:s.floatingLabel)??!0,ne=!!(J&&b),ce=x||m||!!D,C=k.find(o=>o.value===D);u.useEffect(()=>{if(!x)return;const o=E=>{y.current&&!y.current.contains(E.target)&&M(!1)};return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[x]);const oe=o=>{var E;o.disabled||q||(A||w(o.value),_==null||_(o.value),M(!1),(E=l.current)==null||E.focus())},te=o=>{if(!q)if(o.key==="ArrowDown"||o.key==="ArrowUp"){if(o.preventDefault(),!x){M(!0),K(0);return}const E=o.key==="ArrowDown"?1:-1;let Z=U+E;Z<0&&(Z=k.length-1),Z>=k.length&&(Z=0),K(Z)}else o.key==="Enter"||o.key===" "?(o.preventDefault(),x&&U>=0&&k[U]?oe(k[U]):M(E=>!E)):o.key==="Escape"&&x&&(o.preventDefault(),M(!1))},ae=a("wui-select-container",v.container,ne&&v.floatingContainer,e==null?void 0:e.container,O),de=a("wui-select-trigger",v.trigger,x&&v.open,S&&v.hasError,q&&v.disabled,e==null?void 0:e.trigger);return n.jsxs("div",{ref:o=>{y.current=o,typeof c=="function"?c(o):c&&(c.current=o)},className:ae,style:ee(P),"data-testid":X,children:[!J&&b&&n.jsxs("label",{id:W,className:a("wui-select-label",v.label,e==null?void 0:e.label),style:r==null?void 0:r.label,onClick:()=>{var o;return!q&&((o=l.current)==null?void 0:o.focus())},children:[b,R&&n.jsx("span",{className:v.requiredAsterisk,"aria-hidden":"true",children:"*"})]}),$&&n.jsx("input",{type:"hidden",name:$,value:D||""}),n.jsxs("div",{className:a("wui-select-wrapper",v.selectWrapper,ne&&v.withFloatingLabel,x&&v.selectWrapperOpen,e==null?void 0:e.wrapper),style:r==null?void 0:r.wrapper,children:[n.jsxs("button",{ref:l,id:i,type:"button",role:"combobox","aria-expanded":x,"aria-haspopup":"listbox","aria-controls":V,"aria-labelledby":b?W:void 0,"aria-invalid":S?"true":"false","aria-describedby":F,disabled:q,onClick:()=>!q&&M(o=>!o),onFocus:()=>B(!0),onBlur:()=>B(!1),onKeyDown:te,className:de,style:r==null?void 0:r.trigger,children:[n.jsx("span",{className:a("wui-select-value",v.value,!C&&v.placeholder,ne&&!C&&v.floatingPlaceholder,ce&&v.floated,C?e==null?void 0:e.value:e==null?void 0:e.placeholder),style:C?r==null?void 0:r.value:r==null?void 0:r.placeholder,children:C?C.label:j}),n.jsx("span",{className:a("wui-select-arrow",v.arrow,x&&v.arrowOpen,e==null?void 0:e.arrow),style:r==null?void 0:r.arrow,"aria-hidden":"true",children:n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),ne&&n.jsx("label",{id:W,htmlFor:i,className:a("wui-select-floating-label",v.floatingLabel,ce&&v.floated,(e==null?void 0:e.floatingLabel)||(e==null?void 0:e.label)),style:(r==null?void 0:r.floatingLabel)||(r==null?void 0:r.label),onClick:()=>{var o;return!q&&((o=l.current)==null?void 0:o.focus())},children:n.jsxs("span",{className:v.floatingLabelText,children:[b,R&&n.jsx("span",{className:v.requiredAsterisk,"aria-hidden":"true",children:"*"})]})}),x&&n.jsx("ul",{id:V,role:"listbox","aria-labelledby":b?W:void 0,className:a("wui-select-dropdown",v.dropdown,e==null?void 0:e.dropdown),style:r==null?void 0:r.dropdown,children:k.map((o,E)=>{const Z=o.value===D,ue=E===U;return n.jsxs("li",{role:"option","aria-selected":Z,"aria-disabled":o.disabled||void 0,className:a("wui-select-option",v.option,Z&&v.optionSelected,ue&&v.optionActive,o.disabled&&v.optionDisabled,e==null?void 0:e.option,Z&&(e==null?void 0:e.selectedOption)),style:{...r==null?void 0:r.option,...Z?r==null?void 0:r.selectedOption:void 0},onClick:()=>oe(o),children:[n.jsx("span",{children:o.label}),Z&&n.jsx("svg",{className:a(v.checkIcon,e==null?void 0:e.checkIcon),style:r==null?void 0:r.checkIcon,viewBox:"0 0 24 24",strokeWidth:"3","aria-hidden":"true",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})]},o.value)})})]}),S&&n.jsx("span",{id:F,role:"alert",className:a("wui-select-error",v.errorMessage,e==null?void 0:e.errorMessage),style:r==null?void 0:r.errorMessage,children:g})]})});we.displayName="Select";const Tn="_container_1f8v3_1",Rn="_floatingContainer_1f8v3_15",zn="_label_1f8v3_23",Fn="_requiredAsterisk_1f8v3_43",An="_wrapper_1f8v3_55",Mn="_withFloatingLabel_1f8v3_79",On="_hasError_1f8v3_105",Vn="_disabled_1f8v3_123",Dn="_floatingLabel_1f8v3_135",Un="_floatingLabelText_1f8v3_179",Gn="_floated_1f8v3_221",Pn="_textarea_1f8v3_277",Hn="_floatingTextarea_1f8v3_317",Kn="_footer_1f8v3_349",Zn="_helperText_1f8v3_365",Jn="_errorMessage_1f8v3_375",Qn="_counter_1f8v3_387",z={container:Tn,floatingContainer:Rn,label:zn,requiredAsterisk:Fn,wrapper:An,withFloatingLabel:Mn,hasError:On,disabled:Vn,floatingLabel:Dn,floatingLabelText:Un,floated:Gn,textarea:Pn,floatingTextarea:Hn,footer:Kn,helperText:Zn,errorMessage:Jn,counter:Qn},xe=u.forwardRef(function({id:k,label:p,floatingLabel:I,helperText:j,errorMessage:b,required:L=!1,disabled:g=!1,readOnly:q=!1,rows:R=4,maxLength:_,showCount:$=!1,value:O,defaultValue:P,onChange:f,onFocus:e,onBlur:r,className:X,style:d,styles:c,slotClassNames:t,slotStyles:i,"data-testid":W,...V},F){const A=u.useId(),H=k||`wui-textarea-${A}`,w=j?`${H}-helper`:void 0,D=b?`${H}-error`:void 0,x=O!==void 0,[M,m]=u.useState(P!==void 0?String(P):""),[B,U]=u.useState(!1),K=x?String(O??""):M,y=K!=null&&String(K).trim().length>0,{resolved:l,getCombinedStyle:s}=T.useComponentStyles("textarea",c),ee=!!b,S=I??(l==null?void 0:l.floatingLabel)??!0,J=!!(S&&p),ne=B||!!y,ce=E=>{x||m(E.target.value),f==null||f(E)},C=E=>{U(!0),e==null||e(E)},oe=E=>{U(!1),r==null||r(E)},te=a("wui-textarea-container",z.container,J&&z.floatingContainer,t==null?void 0:t.container,X),ae=a("wui-textarea-wrapper",z.wrapper,J&&z.withFloatingLabel,ee&&z.hasError,g&&z.disabled,t==null?void 0:t.wrapper),de=a("wui-textarea-field",z.textarea,J&&z.floatingTextarea,ne&&z.floated,t==null?void 0:t.textarea),o=[D,w].filter(Boolean).join(" ")||void 0;return n.jsxs("div",{className:te,style:s(d),"data-testid":W,children:[!S&&p&&n.jsxs("label",{htmlFor:H,className:a("wui-textarea-label",z.label,t==null?void 0:t.label),style:i==null?void 0:i.label,children:[p,L&&n.jsx("span",{className:z.requiredAsterisk,"aria-hidden":"true",children:"*"})]}),n.jsxs("div",{className:ae,style:i==null?void 0:i.wrapper,children:[J&&n.jsx("label",{htmlFor:H,className:a("wui-textarea-floating-label",z.floatingLabel,ne&&z.floated,(t==null?void 0:t.floatingLabel)||(t==null?void 0:t.label)),style:(i==null?void 0:i.floatingLabel)||(i==null?void 0:i.label),children:n.jsxs("span",{className:z.floatingLabelText,children:[p,L&&n.jsx("span",{className:z.requiredAsterisk,"aria-hidden":"true",children:"*"})]})}),n.jsx("textarea",{ref:F,id:H,rows:R,maxLength:_,value:x?O:void 0,defaultValue:x?void 0:P,onChange:ce,onFocus:C,onBlur:oe,disabled:g,readOnly:q,required:L,"aria-invalid":ee?"true":"false","aria-describedby":o,className:de,style:i==null?void 0:i.textarea,...V})]}),n.jsxs("div",{className:z.footer,children:[ee?n.jsx("span",{id:D,role:"alert",className:a("wui-textarea-error",z.errorMessage,t==null?void 0:t.errorMessage),style:i==null?void 0:i.errorMessage,children:b}):j?n.jsx("span",{id:w,className:a("wui-textarea-helper",z.helperText,t==null?void 0:t.helperText),style:i==null?void 0:i.helperText,children:j}):n.jsx("span",{}),$&&n.jsx("span",{className:a("wui-textarea-counter",z.counter,t==null?void 0:t.counter),style:i==null?void 0:i.counter,"aria-live":"polite",children:_!==void 0?`${K.length} / ${_}`:K.length})]})]})});xe.displayName="Textarea";const Xn="_container_1ek6o_1",Yn="_disabled_1ek6o_29",mn="_radio_1ek6o_39",yn="_labelWrapper_1ek6o_71",ln="_label_1ek6o_71",Sn="_labelChecked_1ek6o_99",Nn="_description_1ek6o_109",Cn="_groupContainer_1ek6o_121",sn="_groupLabel_1ek6o_135",er="_optionsVertical_1ek6o_149",nr="_optionsHorizontal_1ek6o_161",rr="_groupError_1ek6o_175",N={container:Xn,disabled:Yn,radio:mn,labelWrapper:yn,label:ln,labelChecked:Sn,description:Nn,groupContainer:Cn,groupLabel:sn,optionsVertical:er,optionsHorizontal:nr,groupError:rr},fe=u.createContext(null);function ve(){return u.useContext(fe)}const _e=u.forwardRef(function({label:k,description:p,value:I,size:j,color:b,checked:L,defaultChecked:g=!1,disabled:q=!1,onChange:R,name:_,className:$,style:O,styles:P,slotClassNames:f,slotStyles:e,"data-testid":r,id:X,...d},c){const t=u.useRef(null);u.useImperativeHandle(c,()=>t.current);const i=ve(),W=!!i,V=_||(i==null?void 0:i.name),F=W?(i==null?void 0:i.value)!==void 0&&I!==void 0?i.value===I:L!==void 0?L:g:L!==void 0?L:void 0,[A,H]=u.useState(g),w=W?F:L!==void 0?L:A,D=q||!!(i!=null&&i.disabled),x=j??(i==null?void 0:i.size),M=b??(i==null?void 0:i.color),m={...(i==null?void 0:i.groupStyles)||{},...P||{},...x!==void 0?{size:x}:{},...M!==void 0?{color:M}:{}},{resolved:B,getCombinedStyle:U}=T.useComponentStyles("radio",m),K=M||(B==null?void 0:B.color)||(B==null?void 0:B.checkedColor),y=x!==void 0?typeof x=="number"?`${x}px`:x:(B==null?void 0:B.size)!==void 0?typeof B.size=="number"?`${B.size}px`:B.size:void 0,l=S=>{var J;D||(!W&&L===void 0&&H(S.target.checked),i&&I!==void 0&&((J=i.onChange)==null||J.call(i,I)),R==null||R(S))},s=a("wui-radio-container",N.container,D&&N.disabled,f==null?void 0:f.container,$),ee=a("wui-radio-input",N.radio,(f==null?void 0:f.radio)||(f==null?void 0:f.control));return n.jsxs("label",{className:s,style:U(O),"data-testid":r,children:[n.jsx("input",{ref:t,id:X,type:"radio",name:V,value:I,checked:w,defaultChecked:W?void 0:g,disabled:D,onChange:l,className:ee,style:{...K?{accentColor:K}:void 0,...y?{width:y,height:y}:void 0,...(e==null?void 0:e.radio)||(e==null?void 0:e.control)},...d}),(k||p)&&n.jsxs("span",{className:a("wui-radio-label-wrapper",N.labelWrapper,f==null?void 0:f.labelWrapper),style:e==null?void 0:e.labelWrapper,children:[k&&n.jsx("span",{className:a("wui-radio-label",N.label,w&&N.labelChecked,f==null?void 0:f.label,w&&(f==null?void 0:f.labelChecked)),style:e==null?void 0:e.label,children:k}),p&&n.jsx("span",{className:a("wui-radio-description",N.description,f==null?void 0:f.description),style:e==null?void 0:e.description,children:p})]})]})});_e.displayName="Radio";const ke=u.forwardRef(function({name:k,value:p,defaultValue:I,onChange:j,options:b,direction:L="vertical",label:g,errorMessage:q,disabled:R=!1,size:_,color:$,children:O,styles:P,className:f,style:e,"data-testid":r},X){const d=u.useId(),c=k||`wui-radiogroup-${d}`,t=p!==void 0,[i,W]=u.useState(I),V=t?p:i,F=w=>{R||(t||W(w),j==null||j(w))},A=a("wui-radiogroup-container",N.groupContainer,f),H=L==="horizontal"?N.optionsHorizontal:N.optionsVertical;return n.jsx(fe.Provider,{value:{name:c,value:V,onChange:F,disabled:R,size:_,color:$,groupStyles:P},children:n.jsxs("div",{ref:X,role:"radiogroup","aria-label":typeof g=="string"?g:void 0,className:A,style:e,"data-testid":r,children:[g&&n.jsx("span",{className:N.groupLabel,children:g}),n.jsx("div",{className:H,children:b?b.map(w=>n.jsx(_e,{value:w.value,label:w.label,description:w.description,disabled:w.disabled,size:w.size,color:w.color,styles:w.styles},w.value)):O}),q&&n.jsx("span",{role:"alert",className:N.groupError,children:q})]})})});ke.displayName="RadioGroup";const ir="_container_1f1un_1",cr="_disabled_1f1un_29",ar="_hiddenInput_1f1un_39",dr="_track_1f1un_59",or="_checked_1f1un_101",tr="_thumb_1f1un_111",ur="_sizeSmall_1f1un_165",pr="_sizeMedium_1f1un_179",fr="_sizeLarge_1f1un_193",_r="_icon_1f1un_209",hr="_labelWrapper_1f1un_231",br="_label_1f1un_231",gr="_description_1f1un_253",Q={container:ir,disabled:cr,hiddenInput:ar,track:dr,checked:or,thumb:tr,sizeSmall:ur,sizeMedium:pr,sizeLarge:fr,icon:_r,labelWrapper:hr,label:br,description:gr},wr={small:Q.sizeSmall,medium:Q.sizeMedium,large:Q.sizeLarge},Ie=u.forwardRef(function({checked:k,defaultChecked:p=!1,onChange:I,disabled:j=!1,size:b="medium",label:L,description:g,checkedIcon:q,uncheckedIcon:R,name:_,value:$,className:O,style:P,styles:f,slotClassNames:e,slotStyles:r,"data-testid":X,id:d,...c},t){const i=u.useRef(null);u.useImperativeHandle(t,()=>i.current);const W=k!==void 0,[V,F]=u.useState(p),A=W?k:V,{getCombinedStyle:H}=T.useComponentStyles("switch",f),w=m=>{if(j)return;const B=m.target.checked;W||F(B),I==null||I(B,m)},D=a("wui-switch-container",Q.container,j&&Q.disabled,e==null?void 0:e.container,O),x=a("wui-switch-track",Q.track,wr[b],A&&Q.checked,e==null?void 0:e.track),M=a("wui-switch-thumb",Q.thumb,e==null?void 0:e.thumb);return n.jsxs("label",{className:D,style:H(P),"data-testid":X,children:[n.jsx("input",{ref:i,id:d,type:"checkbox",role:"switch",name:_,value:$,checked:A,disabled:j,onChange:w,className:Q.hiddenInput,"aria-checked":A,...c}),n.jsx("span",{className:x,style:r==null?void 0:r.track,"aria-hidden":"true",children:n.jsx("span",{className:M,style:r==null?void 0:r.thumb,children:A?q&&n.jsx("span",{className:a(Q.icon,e==null?void 0:e.icon),style:r==null?void 0:r.icon,children:q}):R&&n.jsx("span",{className:a(Q.icon,e==null?void 0:e.icon),style:r==null?void 0:r.icon,children:R})})}),(L||g)&&n.jsxs("span",{className:a("wui-switch-label-wrapper",Q.labelWrapper,e==null?void 0:e.labelWrapper),style:r==null?void 0:r.labelWrapper,children:[L&&n.jsx("span",{className:a("wui-switch-label",Q.label,e==null?void 0:e.label),style:r==null?void 0:r.label,children:L}),g&&n.jsx("span",{className:a("wui-switch-description",Q.description,e==null?void 0:e.description),style:r==null?void 0:r.description,children:g})]})]})});Ie.displayName="Switch";exports.camelToKebab=Y.camelToKebab;exports.configureWebstrail=Y.configureWebstrail;exports.defaultButtonStyles=Y.defaultButtonStyles;exports.defaultColors=Y.defaultColors;exports.defaultLayout=Y.defaultLayout;exports.defaultResolvedConfig=Y.defaultResolvedConfig;exports.defaultTypography=Y.defaultTypography;exports.getWebstrailConfig=Y.getWebstrailConfig;exports.normalizeButtonSize=Y.normalizeButtonSize;exports.normalizeDimension=Y.normalizeDimension;exports.resetWebstrailConfig=Y.resetWebstrailConfig;exports.resolveEffectiveButtonConfig=Y.resolveEffectiveButtonConfig;exports.subscribeWebstrailConfig=Y.subscribeWebstrailConfig;exports.Button=T.Button;exports.UIContext=T.UIContext;exports.UIProvider=T.UIProvider;exports.deepMerge=T.deepMerge;exports.defaultUIConfig=T.defaultUIConfig;exports.deriveTokensFromPrimary=T.deriveTokensFromPrimary;exports.getDarkerShade=T.getDarkerShade;exports.getFocusRingColor=T.getFocusRingColor;exports.getSubtleBackgroundColor=T.getSubtleBackgroundColor;exports.mergeUIConfig=T.mergeUIConfig;exports.resolveComponentStyles=T.resolveComponentStyles;exports.stylesToCssVars=T.stylesToCssVars;exports.useComponentStyles=T.useComponentStyles;exports.useUI=T.useUI;exports.WbButton=pe.WbButton;exports.buttonStyles=pe.buttonStyles;exports.registerWbButton=pe.registerWbButton;exports.Checkbox=ge;exports.Input=be;exports.Radio=_e;exports.RadioGroup=ke;exports.RadioGroupContext=fe;exports.Select=we;exports.Switch=Ie;exports.Textarea=xe;exports.classNames=a;exports.useRadioGroup=ve;
2
2
  //# sourceMappingURL=index.cjs.map