@webstrail/ui-library 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +524 -3
  3. package/dist/components/Button/Button.d.ts +2 -0
  4. package/dist/components/Button/Button.types.d.ts +45 -0
  5. package/dist/components/Button/index.d.ts +2 -0
  6. package/dist/components/Checkbox/Checkbox.d.ts +2 -0
  7. package/dist/components/Checkbox/Checkbox.types.d.ts +38 -0
  8. package/dist/components/Checkbox/index.d.ts +2 -0
  9. package/dist/components/Input/Input.d.ts +2 -0
  10. package/dist/components/Input/Input.types.d.ts +87 -0
  11. package/dist/components/Input/index.d.ts +2 -0
  12. package/dist/components/Radio/Radio.d.ts +2 -0
  13. package/dist/components/Radio/Radio.types.d.ts +119 -0
  14. package/dist/components/Radio/RadioGroup.d.ts +2 -0
  15. package/dist/components/Radio/RadioGroupContext.d.ts +13 -0
  16. package/dist/components/Radio/index.d.ts +4 -0
  17. package/dist/components/Select/Select.d.ts +2 -0
  18. package/dist/components/Select/Select.types.d.ts +100 -0
  19. package/dist/components/Select/index.d.ts +2 -0
  20. package/dist/components/Switch/Switch.d.ts +2 -0
  21. package/dist/components/Switch/Switch.types.d.ts +82 -0
  22. package/dist/components/Switch/index.d.ts +2 -0
  23. package/dist/components/Textarea/Textarea.d.ts +2 -0
  24. package/dist/components/Textarea/Textarea.types.d.ts +61 -0
  25. package/dist/components/Textarea/index.d.ts +2 -0
  26. package/dist/components/index.d.ts +14 -0
  27. package/dist/config/config.types.d.ts +232 -0
  28. package/dist/config/defaultConfig.d.ts +2 -0
  29. package/dist/config/mergeConfig.d.ts +28 -0
  30. package/dist/context/UIContext.d.ts +6 -0
  31. package/dist/context/index.d.ts +1 -0
  32. package/dist/hooks/index.d.ts +3 -0
  33. package/dist/hooks/useComponentStyles.d.ts +26 -0
  34. package/dist/hooks/useUI.d.ts +6 -0
  35. package/dist/index.cjs +2 -0
  36. package/dist/index.cjs.map +1 -0
  37. package/dist/index.d.ts +25 -0
  38. package/dist/index.js +1577 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/providers/UIProvider.d.ts +20 -0
  41. package/dist/providers/index.d.ts +2 -0
  42. package/dist/style.css +1 -0
  43. package/dist/types/common.d.ts +41 -0
  44. package/dist/types/index.d.ts +1 -0
  45. package/dist/utils/classNames.d.ts +11 -0
  46. package/dist/utils/resolveStyles.d.ts +28 -0
  47. package/package.json +104 -6
@@ -0,0 +1,232 @@
1
+ import { DimensionValue } from '../types/common';
2
+ /**
3
+ * Deep partial utility allowing partial overrides of nested configuration objects.
4
+ */
5
+ export type DeepPartial<T> = {
6
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
7
+ };
8
+ /**
9
+ * Central design tokens for colors.
10
+ */
11
+ export interface GlobalColorTokens {
12
+ primary: string;
13
+ secondary: string;
14
+ text: string;
15
+ textSecondary: string;
16
+ border: string;
17
+ background: string;
18
+ error: string;
19
+ success: string;
20
+ disabled: string;
21
+ disabledBackground: string;
22
+ disabledText: string;
23
+ focusRing: string;
24
+ }
25
+ /**
26
+ * Central typography design tokens.
27
+ */
28
+ export interface GlobalTypographyTokens {
29
+ fontFamily: string;
30
+ fontSizeSmall: string;
31
+ fontSizeMedium: string;
32
+ fontSizeLarge: string;
33
+ fontWeightNormal: number | string;
34
+ fontWeightMedium: number | string;
35
+ fontWeightBold: number | string;
36
+ }
37
+ /**
38
+ * Global spacing and radius tokens.
39
+ */
40
+ export interface GlobalLayoutTokens {
41
+ borderRadiusSmall: DimensionValue;
42
+ borderRadiusMedium: DimensionValue;
43
+ borderRadiusLarge: DimensionValue;
44
+ }
45
+ /**
46
+ * Semantic style configuration for Button component.
47
+ */
48
+ export interface ButtonStyles {
49
+ height?: DimensionValue;
50
+ borderRadius?: DimensionValue;
51
+ fontSize?: DimensionValue;
52
+ fontWeight?: number | string;
53
+ backgroundColor?: string;
54
+ textColor?: string;
55
+ borderColor?: string;
56
+ hoverBackgroundColor?: string;
57
+ hoverTextColor?: string;
58
+ activeBackgroundColor?: string;
59
+ disabledBackgroundColor?: string;
60
+ disabledTextColor?: string;
61
+ disabledBorderColor?: string;
62
+ focusRingColor?: string;
63
+ focusShadow?: string;
64
+ padding?: string;
65
+ transition?: string;
66
+ outlineColor?: string;
67
+ outlineBorderColor?: string;
68
+ outlineHoverBackgroundColor?: string;
69
+ ghostColor?: string;
70
+ ghostHoverBackgroundColor?: string;
71
+ }
72
+ /**
73
+ * Semantic style configuration for Input component.
74
+ */
75
+ export interface InputStyles {
76
+ height?: DimensionValue;
77
+ borderRadius?: DimensionValue;
78
+ borderColor?: string;
79
+ textColor?: string;
80
+ placeholderColor?: string;
81
+ backgroundColor?: string;
82
+ focusBorderColor?: string;
83
+ focusRingColor?: string;
84
+ focusShadow?: string;
85
+ errorBorderColor?: string;
86
+ disabledBackgroundColor?: string;
87
+ disabledTextColor?: string;
88
+ disabledBorderColor?: string;
89
+ labelColor?: string;
90
+ helperColor?: string;
91
+ errorColor?: string;
92
+ fontSize?: DimensionValue;
93
+ padding?: string;
94
+ floatingLabel?: boolean;
95
+ iconColor?: string;
96
+ outerIconBorderColor?: string;
97
+ outerIconBackgroundColor?: string;
98
+ }
99
+ /**
100
+ * Semantic style configuration for Select component.
101
+ */
102
+ export interface SelectStyles {
103
+ height?: DimensionValue;
104
+ borderRadius?: DimensionValue;
105
+ borderColor?: string;
106
+ textColor?: string;
107
+ placeholderColor?: string;
108
+ backgroundColor?: string;
109
+ focusBorderColor?: string;
110
+ focusRingColor?: string;
111
+ focusShadow?: string;
112
+ errorBorderColor?: string;
113
+ disabledBackgroundColor?: string;
114
+ disabledTextColor?: string;
115
+ dropdownBackgroundColor?: string;
116
+ dropdownBorderColor?: string;
117
+ dropdownShadow?: string;
118
+ optionTextColor?: string;
119
+ optionHoverBackgroundColor?: string;
120
+ optionHoverTextColor?: string;
121
+ optionSelectedBackgroundColor?: string;
122
+ optionSelectedTextColor?: string;
123
+ optionSelectedHoverBackgroundColor?: string;
124
+ optionCheckColor?: string;
125
+ optionBorderRadius?: DimensionValue;
126
+ optionPadding?: string;
127
+ optionFontSize?: DimensionValue;
128
+ optionFontWeight?: number | string;
129
+ optionSelectedFontWeight?: number | string;
130
+ labelColor?: string;
131
+ errorColor?: string;
132
+ fontSize?: DimensionValue;
133
+ floatingLabel?: boolean;
134
+ iconColor?: string;
135
+ outerIconBorderColor?: string;
136
+ outerIconBackgroundColor?: string;
137
+ }
138
+ /**
139
+ * Semantic style configuration for Checkbox component.
140
+ */
141
+ export interface CheckboxStyles {
142
+ size?: DimensionValue;
143
+ borderRadius?: DimensionValue;
144
+ borderColor?: string;
145
+ checkedColor?: string;
146
+ checkmarkColor?: string;
147
+ backgroundColor?: string;
148
+ focusRingColor?: string;
149
+ focusShadow?: string;
150
+ disabledColor?: string;
151
+ disabledBackgroundColor?: string;
152
+ labelColor?: string;
153
+ fontSize?: DimensionValue;
154
+ }
155
+ /**
156
+ * Semantic style configuration for Textarea component.
157
+ */
158
+ export interface TextareaStyles {
159
+ minHeight?: DimensionValue;
160
+ borderRadius?: DimensionValue;
161
+ borderColor?: string;
162
+ textColor?: string;
163
+ placeholderColor?: string;
164
+ backgroundColor?: string;
165
+ focusBorderColor?: string;
166
+ focusRingColor?: string;
167
+ focusShadow?: string;
168
+ errorBorderColor?: string;
169
+ disabledBackgroundColor?: string;
170
+ disabledTextColor?: string;
171
+ disabledBorderColor?: string;
172
+ labelColor?: string;
173
+ helperColor?: string;
174
+ errorColor?: string;
175
+ counterColor?: string;
176
+ fontSize?: DimensionValue;
177
+ padding?: string;
178
+ floatingLabel?: boolean;
179
+ iconColor?: string;
180
+ outerIconBorderColor?: string;
181
+ outerIconBackgroundColor?: string;
182
+ }
183
+ /**
184
+ * Semantic style configuration for Radio component.
185
+ */
186
+ export interface RadioStyles {
187
+ size?: DimensionValue;
188
+ color?: string;
189
+ checkedColor?: string;
190
+ labelColor?: string;
191
+ labelCheckedColor?: string;
192
+ descriptionColor?: string;
193
+ fontSize?: DimensionValue;
194
+ }
195
+ /**
196
+ * Semantic style configuration for Switch component.
197
+ */
198
+ export interface SwitchStyles {
199
+ width?: DimensionValue;
200
+ height?: DimensionValue;
201
+ thumbSize?: DimensionValue;
202
+ thumbColor?: string;
203
+ thumbCheckedColor?: string;
204
+ trackColor?: string;
205
+ trackCheckedColor?: string;
206
+ focusRingColor?: string;
207
+ focusShadow?: string;
208
+ borderRadius?: DimensionValue;
209
+ disabledOpacity?: string | number;
210
+ labelColor?: string;
211
+ descriptionColor?: string;
212
+ fontSize?: DimensionValue;
213
+ }
214
+ /**
215
+ * Complete, resolved UI Theme Configuration structure.
216
+ */
217
+ export interface UIConfig {
218
+ colors: GlobalColorTokens;
219
+ typography: GlobalTypographyTokens;
220
+ layout: GlobalLayoutTokens;
221
+ button: ButtonStyles;
222
+ input: InputStyles;
223
+ select: SelectStyles;
224
+ checkbox: CheckboxStyles;
225
+ textarea: TextareaStyles;
226
+ radio: RadioStyles;
227
+ switch: SwitchStyles;
228
+ }
229
+ /**
230
+ * Consumer-facing partial configuration accepted by UIProvider.
231
+ */
232
+ export type UserUIConfig = DeepPartial<UIConfig>;
@@ -0,0 +1,2 @@
1
+ import { UIConfig } from './config.types';
2
+ export declare const defaultUIConfig: UIConfig;
@@ -0,0 +1,28 @@
1
+ import { DeepPartial, UIConfig, UserUIConfig } from './config.types';
2
+ /**
3
+ * Derives a subtle transparent background color (e.g., for selected options, hover chips).
4
+ */
5
+ export declare function getSubtleBackgroundColor(color: string, opacity?: number): string;
6
+ /**
7
+ * Derives a focus ring color with alpha transparency.
8
+ */
9
+ export declare function getFocusRingColor(color: string, opacity?: number): string;
10
+ /**
11
+ * Derives a darker shade of a color (e.g. for button hover and active states).
12
+ */
13
+ export declare function getDarkerShade(color: string, amount?: number): string;
14
+ /**
15
+ * Derives default component styling tokens based on a primary color.
16
+ */
17
+ export declare function deriveTokensFromPrimary(primary: string): Record<string, unknown>;
18
+ /**
19
+ * Immutably deep-merges objects from left to right.
20
+ * Only defined properties from sources override earlier properties.
21
+ * Undefined values in overrides are ignored to preserve defaults.
22
+ */
23
+ export declare function deepMerge<T extends object>(target: T, ...sources: Array<DeepPartial<T> | Record<string, unknown> | undefined | null>): T;
24
+ /**
25
+ * Merges user-provided UI configuration with a base configuration.
26
+ * Always returns a fresh object without mutating inputs.
27
+ */
28
+ export declare function mergeUIConfig(base: UIConfig, userConfig?: UserUIConfig): UIConfig;
@@ -0,0 +1,6 @@
1
+ import { UIConfig } from '../config/config.types';
2
+ /**
3
+ * React Context providing the UI library configuration.
4
+ * Defaults to defaultUIConfig when no UIProvider is present in the tree.
5
+ */
6
+ export declare const UIContext: import('react').Context<UIConfig>;
@@ -0,0 +1 @@
1
+ export { UIContext } from './UIContext';
@@ -0,0 +1,3 @@
1
+ export { useUI } from './useUI';
2
+ export { useComponentStyles } from './useComponentStyles';
3
+ export type { UseComponentStylesResult } from './useComponentStyles';
@@ -0,0 +1,26 @@
1
+ import { CSSProperties } from 'react';
2
+ import { DeepPartial, UIConfig } from '../config/config.types';
3
+ export interface UseComponentStylesResult<T> {
4
+ /**
5
+ * Fully resolved semantic styles combining defaults, provider config, and component props.
6
+ */
7
+ resolved: T;
8
+ /**
9
+ * Scoped CSS custom properties derived from the resolved semantic styles.
10
+ */
11
+ cssVars: CSSProperties;
12
+ /**
13
+ * Helper that merges generated CSS variables with consumer-provided inline style.
14
+ * Consumer inline styles always take direct element precedence.
15
+ */
16
+ getCombinedStyle: (consumerStyle?: CSSProperties) => CSSProperties;
17
+ }
18
+ /**
19
+ * Reusable hook to resolve component-level styling with strict priority:
20
+ * 1. component-level styles prop
21
+ * 2. global UIProvider configuration
22
+ * 3. built-in library default configuration
23
+ *
24
+ * Automatically generates scoped CSS custom properties with prefix `wui-{componentKey}`.
25
+ */
26
+ export declare function useComponentStyles<K extends 'button' | 'input' | 'select' | 'checkbox' | 'textarea' | 'radio' | 'switch'>(componentKey: K, componentStyles?: DeepPartial<UIConfig[K]> | null): UseComponentStylesResult<UIConfig[K]>;
@@ -0,0 +1,6 @@
1
+ import { UIConfig } from '../config/config.types';
2
+ /**
3
+ * Hook to access the current UI library configuration from the nearest UIProvider.
4
+ * Falls back to defaultUIConfig when called outside of a UIProvider.
5
+ */
6
+ export declare function useUI(): UIConfig;
package/dist/index.cjs ADDED
@@ -0,0 +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;
2
+ //# sourceMappingURL=index.cjs.map