klip-components 0.2.1 → 0.6.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 (43) hide show
  1. package/dist/index.d.ts +236 -7
  2. package/dist/klip-components.cjs.js +1 -37
  3. package/dist/klip-components.css +1 -1
  4. package/dist/klip-components.es.js +182 -380
  5. package/dist/klip-components.umd.js +1 -0
  6. package/package.json +4 -4
  7. package/dist/components/Button/Button.d.ts +0 -60
  8. package/dist/components/Button/Button.d.ts.map +0 -1
  9. package/dist/components/Button/index.d.ts +0 -3
  10. package/dist/components/Button/index.d.ts.map +0 -1
  11. package/dist/components/Debug/Debug.d.ts +0 -8
  12. package/dist/components/Debug/Debug.d.ts.map +0 -1
  13. package/dist/components/Debug/index.d.ts +0 -2
  14. package/dist/components/Debug/index.d.ts.map +0 -1
  15. package/dist/components/SimpleButton/SimpleButton.d.ts +0 -11
  16. package/dist/components/SimpleButton/SimpleButton.d.ts.map +0 -1
  17. package/dist/components/SimpleButton/index.d.ts +0 -2
  18. package/dist/components/SimpleButton/index.d.ts.map +0 -1
  19. package/dist/components/ThemeToggle/ThemeToggle.d.ts +0 -9
  20. package/dist/components/ThemeToggle/ThemeToggle.d.ts.map +0 -1
  21. package/dist/components/ThemeToggle/index.d.ts +0 -3
  22. package/dist/components/ThemeToggle/index.d.ts.map +0 -1
  23. package/dist/index.d.ts.map +0 -1
  24. package/dist/theme/ThemeProvider.d.ts +0 -37
  25. package/dist/theme/ThemeProvider.d.ts.map +0 -1
  26. package/dist/theme/context.d.ts +0 -17
  27. package/dist/theme/context.d.ts.map +0 -1
  28. package/dist/theme/cssGenerator.d.ts +0 -14
  29. package/dist/theme/cssGenerator.d.ts.map +0 -1
  30. package/dist/theme/defaultThemes.d.ts +0 -11
  31. package/dist/theme/defaultThemes.d.ts.map +0 -1
  32. package/dist/theme/hooks.d.ts +0 -68
  33. package/dist/theme/hooks.d.ts.map +0 -1
  34. package/dist/theme/index.d.ts +0 -9
  35. package/dist/theme/index.d.ts.map +0 -1
  36. package/dist/theme/utils.d.ts +0 -23
  37. package/dist/theme/utils.d.ts.map +0 -1
  38. package/dist/types/theme.d.ts +0 -78
  39. package/dist/types/theme.d.ts.map +0 -1
  40. package/dist/utils/cn.d.ts +0 -37
  41. package/dist/utils/cn.d.ts.map +0 -1
  42. package/dist/utils/index.d.ts +0 -2
  43. package/dist/utils/index.d.ts.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,7 +1,236 @@
1
- export * from './components/Button';
2
- export * from './components/ThemeToggle';
3
- export * from './components/Debug';
4
- export * from './components/SimpleButton';
5
- export * from './theme';
6
- export * from './utils';
7
- //# sourceMappingURL=index.d.ts.map
1
+ import { ClassValue } from 'clsx';
2
+ import { clsx } from 'clsx';
3
+ import { default as default_2 } from 'react';
4
+
5
+ /**
6
+ * A flexible and reusable Button component with multiple variants, sizes, and styling options.
7
+ * Supports all standard HTML button attributes and provides additional customization through props.
8
+ * Uses CSS classes for styling and conditionally applies classes based on props.
9
+ *
10
+ * @param {ButtonProps} props - The props for the Button component
11
+ * @param {('primary'|'secondary'|'success'|'danger')} [props.variant='primary'] - Visual style variant
12
+ * @param {('sm'|'md'|'lg')} [props.size='md'] - Button size
13
+ * @param {boolean} [props.block=false] - Whether button should be full width
14
+ * @param {string} [props.className=''] - Additional CSS classes to apply
15
+ * @param {React.ReactNode} props.children - Content to render inside the button
16
+ * @param {...React.ButtonHTMLAttributes<HTMLButtonElement>} props - All other standard button attributes
17
+ * @returns {JSX.Element} The rendered Button component
18
+ *
19
+ * @example
20
+ * // Basic primary button
21
+ * <Button>Click me</Button>
22
+ *
23
+ * @example
24
+ * // Secondary button with small size
25
+ * <Button variant="secondary" size="sm">Small Button</Button>
26
+ *
27
+ * @example
28
+ * // Full-width danger button with click handler
29
+ * <Button
30
+ * variant="danger"
31
+ * block
32
+ * onClick={() => console.log('Clicked!')}
33
+ * >
34
+ * Delete Item
35
+ * </Button>
36
+ *
37
+ * @example
38
+ * // Disabled success button with custom class
39
+ * <Button
40
+ * variant="success"
41
+ * size="lg"
42
+ * disabled
43
+ * className="my-custom-class"
44
+ * >
45
+ * Save Changes
46
+ * </Button>
47
+ */
48
+ export declare const Button: default_2.FC<ButtonProps>;
49
+
50
+ export declare interface ButtonProps extends default_2.ButtonHTMLAttributes<HTMLButtonElement> {
51
+ /** Visual style variant of the button */
52
+ variant?: ButtonVariant;
53
+ /** Size of the button */
54
+ size?: ButtonSize;
55
+ /** Icon to display at the start of the button */
56
+ startIcon?: default_2.ReactNode;
57
+ /** Icon to display at the end of the button */
58
+ endIcon?: default_2.ReactNode;
59
+ /** Content to be rendered inside the button */
60
+ children: default_2.ReactNode;
61
+ }
62
+
63
+ export declare const ButtonSelect: default_2.FC<ButtonSelectProps>;
64
+
65
+ export declare interface ButtonSelectOption {
66
+ value: string;
67
+ child: default_2.ReactNode;
68
+ }
69
+
70
+ export declare interface ButtonSelectProps {
71
+ options: ButtonSelectOption[];
72
+ value: ButtonSelectValue;
73
+ onChange: (value: ButtonSelectValue) => void;
74
+ disabled?: boolean;
75
+ multiple?: boolean;
76
+ }
77
+
78
+ export declare type ButtonSelectValue = string | string[];
79
+
80
+ declare type ButtonSize = 'sm' | 'md' | 'lg';
81
+
82
+ /**
83
+ * Props interface for the Button component.
84
+ * Extends standard HTML button attributes with additional styling options.
85
+ */
86
+ declare type ButtonVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'link' | 'outline' | 'ghost' | 'icon';
87
+
88
+ export { ClassValue }
89
+
90
+ export { clsx }
91
+
92
+ /**
93
+ * Combines and conditionally applies CSS classes using clsx, then deduplicates them.
94
+ * This function leverages clsx for conditional class handling and mergeClasses for deduplication.
95
+ * Useful for component styling where you need both conditional logic and duplicate removal.
96
+ *
97
+ * @param {...ClassValue[]} inputs - Variable number of class values (strings, objects, arrays, etc.) supported by clsx
98
+ * @returns {string} A deduplicated string of CSS classes
99
+ *
100
+ * @example
101
+ * cn('btn', { 'btn-primary': true, 'btn-disabled': false }, 'mt-4')
102
+ * // Returns: 'btn btn-primary mt-4'
103
+ *
104
+ * @example
105
+ * cn('text-base', 'text-red-500', { 'font-bold': isActive }, 'text-base')
106
+ * // Returns: 'text-base text-red-500 font-bold' (if isActive is true)
107
+ */
108
+ export declare function cn(...inputs: ClassValue[]): string;
109
+
110
+ export declare type HtmlInput = Omit<default_2.InputHTMLAttributes<HTMLInputElement>, 'prefix' | 'suffix' | 'type' | 'onChange'>;
111
+
112
+ /**
113
+ * A utility type to extract valid HTML attributes for an input element,
114
+ * while omitting props that are explicitly handled by the Toggle component.
115
+ */
116
+ declare type HtmlToggle = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'size' | 'checked' | 'onChange'>;
117
+
118
+ /**
119
+ * A versatile input component with support for variants, labels, prefixes, suffixes, and helper text.
120
+ *
121
+ * It's a controlled component that wraps a standard HTML input and extends its functionality.
122
+ * It forwards most standard input props like `placeholder`, `disabled`, and `value`. The `onChange`
123
+ * callback receives the input value directly as a string, making it easier to work with.
124
+ *
125
+ * @param {InputProps} props The props for the component.
126
+ * @returns {React.ReactElement} The rendered input component.
127
+ *
128
+ * @example
129
+ * // Example of a parent component managing the input's state.
130
+ * import { useState } from 'react';
131
+ * // Assuming you have an icon component or SVG, for example from heroicons
132
+ * // import { UserIcon } from '@heroicons/react/24/solid';
133
+ *
134
+ * const MyForm = () => {
135
+ * const [username, setUsername] = useState('');
136
+ *
137
+ * return (
138
+ * <Input
139
+ * variant="primary"
140
+ * type="text"
141
+ * label="Username"
142
+ * placeholder="Enter your username"
143
+ * value={username}
144
+ * onChange={setUsername}
145
+ * prefix={<span>@</span>}
146
+ * helperText="Your public display name."
147
+ * aria-label="Username"
148
+ * />
149
+ * );
150
+ * };
151
+ */
152
+ export declare const Input: default_2.FC<InputProps>;
153
+
154
+ export declare interface InputProps extends HtmlInput {
155
+ /** Callback function invoked when the input value changes */
156
+ onChange?: (value: string) => void;
157
+ /** Visual style variant of the input */
158
+ variant?: InputVariant;
159
+ /** Type of the input field */
160
+ type?: default_2.HTMLInputTypeAttribute;
161
+ /** Label text to be displayed above the input */
162
+ label?: string;
163
+ /** Content to be rendered before the input (can be text, icon, or any React node) */
164
+ prefix?: default_2.ReactNode;
165
+ /** Content to be rendered after the input (can be text, icon, or any React node) */
166
+ suffix?: default_2.ReactNode;
167
+ /** Helper text to be displayed below the input */
168
+ helperText?: string;
169
+ }
170
+
171
+ export declare type InputVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'ghost';
172
+
173
+ /**
174
+ * Merges multiple CSS class strings and removes duplicates while preserving order.
175
+ * Takes an array of class strings, splits them by spaces, filters out empty values,
176
+ * and returns a deduplicated string of classes.
177
+ *
178
+ * @param {...string[]} classes - Variable number of CSS class strings to merge
179
+ * @returns {string} A single string containing all unique CSS classes separated by spaces
180
+ *
181
+ * @example
182
+ * mergeClasses('btn primary', 'btn secondary', 'active')
183
+ * // Returns: 'btn primary secondary active'
184
+ *
185
+ * @example
186
+ * mergeClasses('text-red-500 font-bold', 'text-red-500 underline')
187
+ * // Returns: 'text-red-500 font-bold underline'
188
+ */
189
+ export declare function mergeClasses(...classes: string[]): string;
190
+
191
+ /**
192
+ * A customizable toggle component.
193
+ *
194
+ * It functions as a controlled component, with its state managed by the `checked`
195
+ * and `onChange` props. It supports labels, custom sizes, colors, and all
196
+ * standard input attributes like `disabled` or `aria-label`.
197
+ *
198
+ * @param {ToggleProps} props The props for the component.
199
+ * @returns {React.ReactElement} The rendered switch component.
200
+ *
201
+ * @example
202
+ * // Example of a parent component managing the switch's state.
203
+ * import { useState } from 'react';
204
+ *
205
+ * const MyComponent = () => {
206
+ * const [isEnabled, setIsEnabled] = useState(false);
207
+ *
208
+ * return (
209
+ * <Switch
210
+ * checked={isEnabled}
211
+ * onChange={setIsEnabled}
212
+ * label="Enable Feature"
213
+ * labelPosition="right"
214
+ * aria-label="Feature Toggle"
215
+ * />
216
+ * );
217
+ * };
218
+ */
219
+ export declare const Toggle: React.FC<ToggleProps>;
220
+
221
+ export declare interface ToggleProps extends HtmlToggle {
222
+ /** Color of the toggle when in the "on" state. */
223
+ color?: string;
224
+ /** The total width of the toggle. Can be any valid CSS unit (e.g., '4rem', '60px'). */
225
+ size?: string;
226
+ /** Determines if the toggle is in the "on" (true) or "off" (false) state. */
227
+ checked?: boolean;
228
+ /** Callback function that is invoked when the toggle's state changes. */
229
+ onChange?: (checked: boolean) => void;
230
+ /** Optional text label to display next to the toggle. */
231
+ label?: string;
232
+ /** Position of the label relative to the toggle. Defaults to 'right'. */
233
+ labelPosition?: 'left' | 'right' | 'top' | 'bottom';
234
+ }
235
+
236
+ export { }
@@ -1,37 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),n=require("react");function x(r){var o,s,e="";if(typeof r=="string"||typeof r=="number")e+=r;else if(typeof r=="object")if(Array.isArray(r)){var a=r.length;for(o=0;o<a;o++)r[o]&&(s=x(r[o]))&&(e&&(e+=" "),e+=s)}else for(s in r)r[s]&&(e&&(e+=" "),e+=s);return e}function $(){for(var r,o,s=0,e="",a=arguments.length;s<a;s++)(r=arguments[s])&&(o=x(r))&&(e&&(e+=" "),e+=o);return e}function w(...r){const o=r.join(" ").split(" ").filter(Boolean);return[...new Set(o)].join(" ")}function u(...r){const o=$(...r);return w(o)}const B=({variant:r="primary",size:o="md",block:s=!1,className:e="",children:a,...l})=>c.jsx("button",{className:u("btn",`btn-${r}`,o!=="md"&&`btn-${o}`,s&&"btn-block",e),...l,children:a}),f=n.createContext(void 0);function h(){const r=n.useContext(f);if(r===void 0)throw new Error("useTheme must be used within a ThemeProvider");return r}function D(){const{theme:r}=h();return{primaryColor:`var(--primary-color, ${r.colors.primary.main})`,primaryHover:`var(--primary-hover, ${r.colors.primary.hover})`,secondaryColor:`var(--secondary-color, ${r.colors.secondary.main})`,secondaryHover:`var(--secondary-hover, ${r.colors.secondary.hover})`,tertiaryColor:`var(--tertiary-color, ${r.colors.tertiary.main})`,tertiaryHover:`var(--tertiary-hover, ${r.colors.tertiary.hover})`,successColor:`var(--success-color, ${r.colors.semantic.success})`,dangerColor:`var(--danger-color, ${r.colors.semantic.danger})`,warningColor:`var(--warning-color, ${r.colors.semantic.warning})`,infoColor:`var(--info-color, ${r.colors.semantic.info})`,spacingXs:`var(--spacing-xs, ${r.spacing.xs})`,spacingSm:`var(--spacing-sm, ${r.spacing.sm})`,spacingMd:`var(--spacing-md, ${r.spacing.md})`,spacingLg:`var(--spacing-lg, ${r.spacing.lg})`,spacingXl:`var(--spacing-xl, ${r.spacing.xl})`,borderRadiusSm:`var(--border-radius-sm, ${r.borderRadius.sm})`,borderRadius:`var(--border-radius, ${r.borderRadius.base})`,borderRadiusLg:`var(--border-radius-lg, ${r.borderRadius.lg})`,fontFamily:`var(--font-family, ${r.typography.fontFamily})`,fontSizeSm:`var(--font-size-sm, ${r.typography.fontSize.sm})`,fontSizeBase:`var(--font-size-base, ${r.typography.fontSize.base})`,fontSizeLg:`var(--font-size-lg, ${r.typography.fontSize.lg})`,shadowSm:`var(--shadow-sm, ${r.shadows.sm})`,shadowMd:`var(--shadow-md, ${r.shadows.md})`,shadowLg:`var(--shadow-lg, ${r.shadows.lg})`}}function M({className:r}){const{mode:o,setMode:s,isDark:e}=h(),a=()=>{s(o==="auto"?"light":o==="light"?"dark":"auto")},l=()=>{switch(o){case"light":return"☀️ Light";case"dark":return"🌙 Dark";case"auto":return`🔄 Auto (${e?"Dark":"Light"})`;default:return"Theme"}};return c.jsx("button",{onClick:a,className:u("px-3 py-2 rounded-md text-sm font-medium transition-colors","bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600","text-gray-900 dark:text-gray-100",r),title:`Current theme: ${o}${o==="auto"?` (${e?"dark":"light"})`:""}`,children:l()})}function E({className:r}){return console.log("React version:",n.version),console.log("React object:",n),c.jsxs("div",{className:r,children:[c.jsxs("p",{children:["React Version: ",n.version]}),c.jsxs("p",{children:["React loaded: ",n?"Yes":"No"]})]})}function L({children:r,onClick:o,className:s}){return c.jsx("button",{onClick:o,className:s,style:{padding:"8px 16px",backgroundColor:"#007bff",color:"white",border:"none",borderRadius:"4px"},children:r})}const m={colors:{primary:{main:"#05445e",hover:"#033e52"},secondary:{main:"#189ab4",hover:"#0f7a9c"},tertiary:{main:"#75e6da",hover:"#5cc6c0"},semantic:{success:"#18a558",danger:"#db1f48",warning:"#e9b210",info:"#e0e9e0"}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{sm:"4px",base:"8px",lg:"12px"},typography:{fontFamily:"Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem"}},shadows:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1)"}},S={colors:{primary:{main:"#7dd3fc",hover:"#0ea5e9"},secondary:{main:"#34d399",hover:"#10b981"},tertiary:{main:"#fbbf24",hover:"#f59e0b"},semantic:{success:"#22c55e",danger:"#ef4444",warning:"#f59e0b",info:"#3b82f6"}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{sm:"4px",base:"8px",lg:"12px"},typography:{fontFamily:"Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem"}},shadows:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.15)",md:"0 4px 6px -1px rgb(0 0 0 / 0.2)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.25)"}};function g(r,o){return{colors:{primary:{...r.colors.primary,...o.colors?.primary},secondary:{...r.colors.secondary,...o.colors?.secondary},tertiary:{...r.colors.tertiary,...o.colors?.tertiary},semantic:{...r.colors.semantic,...o.colors?.semantic}},spacing:{...r.spacing,...o.spacing},borderRadius:{...r.borderRadius,...o.borderRadius},typography:{...r.typography,...o.typography,fontSize:{...r.typography.fontSize,...o.typography?.fontSize}},shadows:{...r.shadows,...o.shadows}}}function A(r,o=document.documentElement){o.style.setProperty("--primary-color",r.colors.primary.main),o.style.setProperty("--primary-hover",r.colors.primary.hover),o.style.setProperty("--secondary-color",r.colors.secondary.main),o.style.setProperty("--secondary-hover",r.colors.secondary.hover),o.style.setProperty("--tertiary-color",r.colors.tertiary.main),o.style.setProperty("--tertiary-hover",r.colors.tertiary.hover),o.style.setProperty("--success-color",r.colors.semantic.success),o.style.setProperty("--danger-color",r.colors.semantic.danger),o.style.setProperty("--warning-color",r.colors.semantic.warning),o.style.setProperty("--info-color",r.colors.semantic.info),o.style.setProperty("--spacing-xs",r.spacing.xs),o.style.setProperty("--spacing-sm",r.spacing.sm),o.style.setProperty("--spacing-md",r.spacing.md),o.style.setProperty("--spacing-lg",r.spacing.lg),o.style.setProperty("--spacing-xl",r.spacing.xl),o.style.setProperty("--border-radius-sm",r.borderRadius.sm),o.style.setProperty("--border-radius",r.borderRadius.base),o.style.setProperty("--border-radius-lg",r.borderRadius.lg),o.style.setProperty("--font-family",r.typography.fontFamily),o.style.setProperty("--font-size-sm",r.typography.fontSize.sm),o.style.setProperty("--font-size-base",r.typography.fontSize.base),o.style.setProperty("--font-size-lg",r.typography.fontSize.lg),o.style.setProperty("--shadow-sm",r.shadows.sm),o.style.setProperty("--shadow-md",r.shadows.md),o.style.setProperty("--shadow-lg",r.shadows.lg)}function V(r,o){const s=o.split(".");let e=r;for(const a of s){if(typeof e!="object"||e===null||!(a in e))return;e=e[a]}return typeof e=="string"?e:void 0}function F(r){return`--${r.replace(/\./g,"-")}`}function k(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function O(r,o=":root"){return`
2
- ${o} {
3
- /* Colors */
4
- --primary-color: ${r.colors.primary.main};
5
- --primary-hover: ${r.colors.primary.hover};
6
- --secondary-color: ${r.colors.secondary.main};
7
- --secondary-hover: ${r.colors.secondary.hover};
8
- --tertiary-color: ${r.colors.tertiary.main};
9
- --tertiary-hover: ${r.colors.tertiary.hover};
10
- --success-color: ${r.colors.semantic.success};
11
- --danger-color: ${r.colors.semantic.danger};
12
- --warning-color: ${r.colors.semantic.warning};
13
- --info-color: ${r.colors.semantic.info};
14
-
15
- /* Spacing */
16
- --spacing-xs: ${r.spacing.xs};
17
- --spacing-sm: ${r.spacing.sm};
18
- --spacing-md: ${r.spacing.md};
19
- --spacing-lg: ${r.spacing.lg};
20
- --spacing-xl: ${r.spacing.xl};
21
-
22
- /* Border Radius */
23
- --border-radius-sm: ${r.borderRadius.sm};
24
- --border-radius: ${r.borderRadius.base};
25
- --border-radius-lg: ${r.borderRadius.lg};
26
-
27
- /* Typography */
28
- --font-family: ${r.typography.fontFamily};
29
- --font-size-sm: ${r.typography.fontSize.sm};
30
- --font-size-base: ${r.typography.fontSize.base};
31
- --font-size-lg: ${r.typography.fontSize.lg};
32
-
33
- /* Shadows */
34
- --shadow-sm: ${r.shadows.sm};
35
- --shadow-md: ${r.shadows.md};
36
- --shadow-lg: ${r.shadows.lg};
37
- }`}function H({children:r,defaultMode:o="auto",theme:s,darkTheme:e=S}){const[a,l]=n.useState(o),[y,b]=n.useState(s||{}),[C,P]=n.useState(()=>k()==="dark"),v=a==="dark"||a==="auto"&&C,p=g(v?e:m,y),T=n.useCallback(t=>{l(t)},[]),z=n.useCallback(t=>{b(i=>g({...m,...i},t))},[]),R=n.useCallback(()=>{b({})},[]);n.useEffect(()=>{if(typeof window>"u")return;const t=window.matchMedia("(prefers-color-scheme: dark)"),i=d=>{P(d.matches)};return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),n.useLayoutEffect(()=>{if(Object.keys(y).length>0){const t=O(p),i=document.getElementById("klip-custom-theme");i&&i.remove();const d=document.createElement("style");d.id="klip-custom-theme",d.textContent=t,document.head.insertBefore(d,document.head.firstChild)}else{const t=document.getElementById("klip-custom-theme");t&&t.remove()}},[p,y]);const j={theme:p,mode:a,setMode:T,updateTheme:z,resetTheme:R,isDark:v};return c.jsx(f.Provider,{value:j,children:r})}exports.Button=B;exports.Debug=E;exports.SimpleButton=L;exports.ThemeContext=f;exports.ThemeProvider=H;exports.ThemeToggle=M;exports.applyThemeToDOM=A;exports.clsx=$;exports.cn=u;exports.createCSSVariable=F;exports.darkTheme=S;exports.defaultTheme=m;exports.detectColorScheme=k;exports.getThemeValue=V;exports.mergeClasses=w;exports.mergeTheme=g;exports.useTheme=h;exports.useThemeVariables=D;
1
+ "use strict";var e=Object.defineProperty,r=Object.defineProperties,t=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,l=(r,t,n)=>t in r?e(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n,i=(e,r)=>{for(var t in r||(r={}))s.call(r,t)&&l(e,t,r[t]);if(n)for(var t of n(r))a.call(r,t)&&l(e,t,r[t]);return e},c=(e,r)=>{var t={};for(var l in e)s.call(e,l)&&r.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&n)for(var l of n(e))r.indexOf(l)<0&&a.call(e,l)&&(t[l]=e[l]);return t};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),p=require("react");function u(e){var r,t,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(r=0;r<s;r++)e[r]&&(t=u(e[r]))&&(n&&(n+=" "),n+=t)}else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function d(){for(var e,r,t=0,n="",s=arguments.length;t<s;t++)(e=arguments[t])&&(r=u(e))&&(n&&(n+=" "),n+=r);return n}function f(...e){const r=e.join(" ").split(" ").filter(Boolean);return[...new Set(r)].join(" ")}function h(...e){return f(d(...e))}exports.Button=e=>{var n,s=e,{variant:a="primary",size:l="md",startIcon:p,endIcon:u,className:d="",children:f}=s,x=c(s,["variant","size","startIcon","endIcon","className","children"]);return o.jsxs("button",(n=i({className:h("rounded btn",`btn-${a}`,`btn-${l}`,d)},x),r(n,t({children:[p&&o.jsx("span",{className:"btn-icon-start",children:p}),f,u&&o.jsx("span",{className:"btn-icon-end",children:u})]}))))},exports.ButtonSelect=({options:e,value:r,onChange:t,disabled:n=!1,multiple:s=!1})=>{const a=e=>Array.isArray(r)?r.includes(e):e===r;return o.jsx("div",{className:"button-select "+(n?"disabled":""),children:e.map(({value:e,child:l})=>o.jsx("button",{className:"button-select-option "+(a(e)?"selected":""),onClick:()=>(e=>{if(n)return;if(!s)return void t(e);const a=Array.isArray(r)?r:[],l=a.includes(e)?a.filter(r=>r!==e):[...a,e];t(l)})(e),disabled:n,type:"button",children:l},e))})},exports.Input=e=>{var r=e,{variant:t="primary",type:n="text",label:s,prefix:a,suffix:l,helperText:u,className:d,onChange:f,id:x}=r,b=c(r,["variant","type","label","prefix","suffix","helperText","className","onChange","id"]);const m=p.useId(),j=x||`input-${m}`,v=h("form-field",{prefix:!!a,suffix:!!l},{[`variant-${t}`]:t},d);return o.jsxs("article",{className:"input-container",children:[s&&o.jsx("label",{htmlFor:j,className:"input-label",children:s}),o.jsxs("section",{className:"input-wrapper",children:[a&&o.jsx("article",{className:"input-addon input-prefix",children:a}),o.jsx("input",i({id:j,type:n,className:v,onChange:e=>null==f?void 0:f(e.target.value)},b)),l&&o.jsx("article",{className:"input-addon input-suffix",children:l})]}),u&&o.jsx("small",{className:"input-helper-text",children:u})]})},exports.Toggle=e=>{var r=e,{color:t="var(--color-primary)",size:n="3.75rem",checked:s=!1,onChange:a,label:l,labelPosition:p="right",className:u}=r,d=c(r,["color","size","checked","onChange","label","labelPosition","className"]);return o.jsxs("label",{className:h("switch-container",p,u),children:[o.jsxs("div",{className:"toggle-switch",style:{"--switch-size":n,"--switch-color":t},children:[o.jsx("input",i({type:"checkbox",role:"switch",checked:s,onChange:e=>null==a?void 0:a(e.target.checked)},d)),o.jsx("span",{className:"slider"})]}),l&&o.jsx("span",{className:"switch-label",children:l})]})},exports.clsx=d,exports.cn=h,exports.mergeClasses=f;