flysoft-react-ui 0.1.2 → 0.1.3

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 (55) hide show
  1. package/dist/App.d.ts +4 -0
  2. package/dist/App.d.ts.map +1 -0
  3. package/dist/App.js +7 -0
  4. package/dist/components/ThemeSwitcher.d.ts +3 -0
  5. package/dist/components/ThemeSwitcher.d.ts.map +1 -0
  6. package/dist/components/ThemeSwitcher.js +12 -0
  7. package/dist/components/form-controls/Button.d.ts +11 -0
  8. package/dist/components/form-controls/Button.d.ts.map +1 -0
  9. package/dist/components/form-controls/Button.js +37 -0
  10. package/dist/components/form-controls/Input.d.ts +11 -0
  11. package/dist/components/form-controls/Input.d.ts.map +1 -0
  12. package/dist/components/form-controls/Input.js +27 -0
  13. package/dist/components/form-controls/index.d.ts +5 -0
  14. package/dist/components/form-controls/index.d.ts.map +1 -0
  15. package/dist/components/form-controls/index.js +2 -0
  16. package/dist/components/index.d.ts +4 -0
  17. package/dist/components/index.d.ts.map +1 -0
  18. package/dist/components/index.js +6 -0
  19. package/dist/components/layout/Card.d.ts +12 -0
  20. package/dist/components/layout/Card.d.ts.map +1 -0
  21. package/dist/components/layout/Card.js +15 -0
  22. package/dist/components/layout/index.d.ts +3 -0
  23. package/dist/components/layout/index.d.ts.map +1 -0
  24. package/dist/components/layout/index.js +1 -0
  25. package/dist/components/utils/Badge.d.ts +10 -0
  26. package/dist/components/utils/Badge.d.ts.map +1 -0
  27. package/dist/components/utils/Badge.js +39 -0
  28. package/dist/components/utils/index.d.ts +3 -0
  29. package/dist/components/utils/index.d.ts.map +1 -0
  30. package/dist/components/utils/index.js +1 -0
  31. package/dist/contexts/ThemeContext.d.ts +12 -0
  32. package/dist/contexts/ThemeContext.d.ts.map +1 -0
  33. package/dist/contexts/ThemeContext.js +124 -0
  34. package/dist/contexts/index.d.ts +5 -0
  35. package/dist/contexts/index.d.ts.map +1 -0
  36. package/dist/contexts/index.js +5 -0
  37. package/dist/contexts/presets.d.ts +8 -0
  38. package/dist/contexts/presets.d.ts.map +1 -0
  39. package/dist/contexts/presets.js +295 -0
  40. package/dist/contexts/types.d.ts +84 -0
  41. package/dist/contexts/types.d.ts.map +1 -0
  42. package/dist/contexts/types.js +1 -0
  43. package/dist/hooks/useThemeOverride.d.ts +26 -0
  44. package/dist/hooks/useThemeOverride.d.ts.map +1 -0
  45. package/dist/hooks/useThemeOverride.js +99 -0
  46. package/dist/index.d.ts +14 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +13 -673
  49. package/dist/main.d.ts +2 -0
  50. package/dist/main.d.ts.map +1 -0
  51. package/dist/main.js +5 -0
  52. package/dist/styles.d.ts +3 -0
  53. package/dist/styles.d.ts.map +1 -0
  54. package/dist/styles.js +4 -0
  55. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,673 +1,13 @@
1
- import { jsxs as u, jsx as f } from "react/jsx-runtime";
2
- import { createContext as L, useState as D, useEffect as $, useContext as N, useRef as S, useCallback as v } from "react";
3
- import { default as H } from "react";
4
- const k = ({
5
- variant: o = "primary",
6
- size: a = "md",
7
- icon: e,
8
- iconPosition: r = "left",
9
- loading: t = !1,
10
- children: m,
11
- className: c = "",
12
- disabled: g,
13
- ...b
14
- }) => {
15
- const p = `
16
- inline-flex items-center justify-center font-medium rounded-sm transition-colors
17
- cursor-pointer
18
- disabled:opacity-50 disabled:cursor-not-allowed
19
- font-[var(--font-default)]
20
- `, d = {
21
- primary: `
22
- bg-[var(--color-primary)] text-[var(--color-primary-contrast)]
23
- hover:bg-[var(--color-primary-dark)] focus:ring-[var(--color-primary)]
24
- `,
25
- outline: `
26
- border border-[var(--color-primary)] text-[var(--color-primary)]
27
- hover:bg-[var(--color-bg-secondary)] focus:ring-[var(--color-primary)]
28
- `,
29
- ghost: `
30
- text-[var(--color-primary)] hover:bg-[var(--color-bg-secondary)]
31
- focus:ring-[var(--color-primary)]
32
- `
33
- }, l = {
34
- sm: "px-3 py-1.5 text-sm",
35
- md: "px-4 py-2 text-base",
36
- lg: "px-6 py-3 text-lg"
37
- }, n = `${p} ${d[o]} ${l[a]} ${c}`, s = () => e ? /* @__PURE__ */ f(
38
- "i",
39
- {
40
- className: `fa ${e} ${a === "sm" ? "w-4 h-4" : a === "md" ? "w-5 h-5" : "w-6 h-6"} ${r === "right" ? "ml-2" : "mr-2"}`
41
- }
42
- ) : null;
43
- return /* @__PURE__ */ u("button", { className: n, disabled: g || t, ...b, children: [
44
- t && /* @__PURE__ */ f("i", { className: "fa fa-spinner fa-spin mr-2" }),
45
- e && r === "left" && !t && s(),
46
- m,
47
- e && r === "right" && !t && s()
48
- ] });
49
- }, M = ({
50
- label: o,
51
- error: a,
52
- icon: e,
53
- iconPosition: r = "left",
54
- size: t = "md",
55
- className: m = "",
56
- id: c,
57
- ...g
58
- }) => {
59
- const b = c || `input-${Math.random().toString(36).substr(2, 9)}`, p = `
60
- w-full border rounded-lg transition-colors focus:outline-none focus:ring-2
61
- disabled:opacity-50 disabled:cursor-not-allowed
62
- font-[var(--font-default)] text-[var(--color-text-primary)]
63
- bg-[var(--color-bg-default)]
64
- `, d = {
65
- sm: "px-3 py-1.5 text-sm",
66
- md: "px-4 py-2 text-base",
67
- lg: "px-6 py-3 text-lg"
68
- }, l = a ? "border-[var(--color-border-error)] focus:border-[var(--color-border-error)] focus:ring-[var(--color-border-error)]" : "border-[var(--color-border-default)] focus:border-[var(--color-border-focus)] focus:ring-[var(--color-border-focus)]", n = `${p} ${d[t]} ${l} ${m}`, s = t === "sm" ? "w-4 h-4" : t === "md" ? "w-5 h-5" : "w-6 h-6", i = () => e ? /* @__PURE__ */ f(
69
- "i",
70
- {
71
- className: `fa ${e} ${s} text-[var(--color-text-muted)] absolute top-1/2 transform -translate-y-1/2 ${r === "left" ? "left-3" : "right-3"}`
72
- }
73
- ) : null;
74
- return /* @__PURE__ */ u("div", { className: "w-full", children: [
75
- o && /* @__PURE__ */ f(
76
- "label",
77
- {
78
- htmlFor: b,
79
- className: "block text-sm font-medium text-[var(--color-text-primary)] mb-1 font-[var(--font-default)]",
80
- children: o
81
- }
82
- ),
83
- /* @__PURE__ */ u("div", { className: "relative", children: [
84
- e && r === "left" && i(),
85
- /* @__PURE__ */ f(
86
- "input",
87
- {
88
- id: b,
89
- className: `${n} ${e && r === "left" ? "pl-10" : ""} ${e && r === "right" ? "pr-10" : ""}`,
90
- ...g
91
- }
92
- ),
93
- e && r === "right" && i()
94
- ] }),
95
- a && /* @__PURE__ */ f("p", { className: "mt-1 text-sm text-[var(--color-danger)] font-[var(--font-default)]", children: a })
96
- ] });
97
- }, O = ({
98
- title: o,
99
- subtitle: a,
100
- children: e,
101
- className: r = "",
102
- headerActions: t,
103
- footer: m,
104
- variant: c = "default"
105
- }) => {
106
- const p = `
107
- bg-[var(--color-bg-default)] rounded-lg border
108
- font-[var(--font-default)]
109
- ${{
110
- default: "border-[var(--color-border-default)]",
111
- elevated: "border-[var(--color-border-default)] shadow-[var(--shadow-lg)]",
112
- outlined: "border-[var(--color-gray-300)]"
113
- }[c]} ${r}`;
114
- return /* @__PURE__ */ u("div", { className: p, children: [
115
- (o || a || t) && /* @__PURE__ */ f("div", { className: "px-6 py-4 border-b border-[var(--color-border-default)]", children: /* @__PURE__ */ u("div", { className: "flex items-center justify-between", children: [
116
- /* @__PURE__ */ u("div", { children: [
117
- o && /* @__PURE__ */ f("h3", { className: "text-lg font-semibold text-[var(--color-text-primary)]", children: o }),
118
- a && /* @__PURE__ */ f("p", { className: "text-sm text-[var(--color-text-secondary)] mt-1", children: a })
119
- ] }),
120
- t && /* @__PURE__ */ f("div", { className: "flex items-center space-x-2", children: t })
121
- ] }) }),
122
- /* @__PURE__ */ f("div", { className: "px-6 py-4", children: e }),
123
- m && /* @__PURE__ */ f("div", { className: "px-6 py-4 border-t border-[var(--color-border-default)] bg-[var(--color-bg-secondary)] rounded-b-lg", children: m })
124
- ] });
125
- }, F = ({
126
- children: o,
127
- variant: a = "primary",
128
- size: e = "md",
129
- rounded: r = !1,
130
- className: t = ""
131
- }) => {
132
- const m = "inline-flex items-center font-medium font-[var(--font-default)]", c = {
133
- primary: `
134
- bg-[var(--color-primary-light)] text-[var(--color-primary-dark)]
135
- hover:bg-[var(--color-primary)] hover:text-[var(--color-primary-contrast)]
136
- `,
137
- secondary: `
138
- bg-[var(--color-secondary-light)] text-[var(--color-secondary-dark)]
139
- hover:bg-[var(--color-secondary)] hover:text-[var(--color-secondary-contrast)]
140
- `,
141
- success: `
142
- bg-[var(--color-success-light)] text-[var(--color-success-dark)]
143
- hover:bg-[var(--color-success)] hover:text-[var(--color-success-contrast)]
144
- `,
145
- warning: `
146
- bg-[var(--color-warning-light)] text-[var(--color-warning-dark)]
147
- hover:bg-[var(--color-warning)] hover:text-[var(--color-warning-contrast)]
148
- `,
149
- danger: `
150
- bg-[var(--color-danger-light)] text-[var(--color-danger-dark)]
151
- hover:bg-[var(--color-danger)] hover:text-[var(--color-danger-contrast)]
152
- `,
153
- info: `
154
- bg-[var(--color-info-light)] text-[var(--color-info-dark)]
155
- hover:bg-[var(--color-info)] hover:text-[var(--color-info-contrast)]
156
- `
157
- }, g = {
158
- sm: "px-2 py-0.5 text-xs",
159
- md: "px-2.5 py-0.5 text-sm",
160
- lg: "px-3 py-1 text-base"
161
- }, b = r ? "rounded-full" : "rounded-md", p = `${m} ${c[a]} ${g[e]} ${b} ${t}`;
162
- return /* @__PURE__ */ f("span", { className: p, children: o });
163
- }, T = {
164
- name: "light",
165
- colors: {
166
- primary: "#007aff",
167
- primaryContrast: "#ffffff",
168
- primaryDark: "#0064d1",
169
- primaryLight: "#4da6ff",
170
- secondary: "#6b7280",
171
- secondaryContrast: "#ffffff",
172
- secondaryDark: "#4b5563",
173
- secondaryLight: "#9ca3af",
174
- success: "#10b981",
175
- successContrast: "#ffffff",
176
- successDark: "#059669",
177
- successLight: "#34d399",
178
- warning: "#f59e0b",
179
- warningContrast: "#ffffff",
180
- warningDark: "#d97706",
181
- warningLight: "#fbbf24",
182
- danger: "#ef4444",
183
- dangerContrast: "#ffffff",
184
- dangerDark: "#dc2626",
185
- dangerLight: "#f87171",
186
- info: "#06b6d4",
187
- infoContrast: "#ffffff",
188
- infoDark: "#0891b2",
189
- infoLight: "#22d3ee",
190
- gray50: "#f9fafb",
191
- gray100: "#f3f4f6",
192
- gray200: "#e5e7eb",
193
- gray300: "#d1d5db",
194
- gray400: "#9ca3af",
195
- gray500: "#6b7280",
196
- gray600: "#4b5563",
197
- gray700: "#374151",
198
- gray800: "#1f2937",
199
- gray900: "#111827",
200
- borderDefault: "#e5e7eb",
201
- borderFocus: "#007aff",
202
- borderError: "#ef4444",
203
- bgDefault: "#ffffff",
204
- bgSecondary: "#f9fafb",
205
- bgDisabled: "#f3f4f6",
206
- textPrimary: "#111827",
207
- textSecondary: "#374151",
208
- textMuted: "#6b7280",
209
- textDisabled: "#9ca3af"
210
- },
211
- shadows: {
212
- sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
213
- md: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
214
- lg: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)"
215
- },
216
- radius: {
217
- sm: "0.375rem",
218
- md: "0.5rem",
219
- lg: "0.75rem",
220
- full: "9999px"
221
- },
222
- spacing: {
223
- xs: "0.25rem",
224
- sm: "0.5rem",
225
- md: "1rem",
226
- lg: "1.5rem",
227
- xl: "2rem"
228
- },
229
- fonts: {
230
- default: '"Instrument Sans", sans-serif',
231
- sizeDefault: "16px",
232
- colorDefault: "#111827"
233
- }
234
- }, E = {
235
- name: "dark",
236
- colors: {
237
- primary: "#3b82f6",
238
- primaryContrast: "#ffffff",
239
- primaryDark: "#1d4ed8",
240
- primaryLight: "#60a5fa",
241
- secondary: "#9ca3af",
242
- secondaryContrast: "#ffffff",
243
- secondaryDark: "#6b7280",
244
- secondaryLight: "#d1d5db",
245
- success: "#10b981",
246
- successContrast: "#ffffff",
247
- successDark: "#059669",
248
- successLight: "#34d399",
249
- warning: "#f59e0b",
250
- warningContrast: "#ffffff",
251
- warningDark: "#d97706",
252
- warningLight: "#fbbf24",
253
- danger: "#ef4444",
254
- dangerContrast: "#ffffff",
255
- dangerDark: "#dc2626",
256
- dangerLight: "#f87171",
257
- info: "#06b6d4",
258
- infoContrast: "#ffffff",
259
- infoDark: "#0891b2",
260
- infoLight: "#22d3ee",
261
- gray50: "#111827",
262
- gray100: "#1f2937",
263
- gray200: "#374151",
264
- gray300: "#4b5563",
265
- gray400: "#6b7280",
266
- gray500: "#9ca3af",
267
- gray600: "#d1d5db",
268
- gray700: "#e5e7eb",
269
- gray800: "#f3f4f6",
270
- gray900: "#f9fafb",
271
- borderDefault: "#374151",
272
- borderFocus: "#3b82f6",
273
- borderError: "#ef4444",
274
- bgDefault: "#111827",
275
- bgSecondary: "#1f2937",
276
- bgDisabled: "#374151",
277
- textPrimary: "#f9fafb",
278
- textSecondary: "#e5e7eb",
279
- textMuted: "#9ca3af",
280
- textDisabled: "#6b7280"
281
- },
282
- shadows: {
283
- sm: "0 1px 2px 0 rgb(0 0 0 / 0.3)",
284
- md: "0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4)",
285
- lg: "0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4)"
286
- },
287
- radius: {
288
- sm: "0.375rem",
289
- md: "0.5rem",
290
- lg: "0.75rem",
291
- full: "9999px"
292
- },
293
- spacing: {
294
- xs: "0.25rem",
295
- sm: "0.5rem",
296
- md: "1rem",
297
- lg: "1.5rem",
298
- xl: "2rem"
299
- },
300
- fonts: {
301
- default: '"Instrument Sans", sans-serif',
302
- sizeDefault: "16px",
303
- colorDefault: "#f9fafb"
304
- }
305
- }, j = {
306
- name: "blue",
307
- colors: {
308
- primary: "#1e40af",
309
- primaryContrast: "#ffffff",
310
- primaryDark: "#1e3a8a",
311
- primaryLight: "#3b82f6",
312
- secondary: "#64748b",
313
- secondaryContrast: "#ffffff",
314
- secondaryDark: "#475569",
315
- secondaryLight: "#94a3b8",
316
- success: "#059669",
317
- successContrast: "#ffffff",
318
- successDark: "#047857",
319
- successLight: "#10b981",
320
- warning: "#d97706",
321
- warningContrast: "#ffffff",
322
- warningDark: "#b45309",
323
- warningLight: "#f59e0b",
324
- danger: "#dc2626",
325
- dangerContrast: "#ffffff",
326
- dangerDark: "#b91c1c",
327
- dangerLight: "#ef4444",
328
- info: "#0891b2",
329
- infoContrast: "#ffffff",
330
- infoDark: "#0e7490",
331
- infoLight: "#06b6d4",
332
- gray50: "#f8fafc",
333
- gray100: "#f1f5f9",
334
- gray200: "#e2e8f0",
335
- gray300: "#cbd5e1",
336
- gray400: "#94a3b8",
337
- gray500: "#64748b",
338
- gray600: "#475569",
339
- gray700: "#334155",
340
- gray800: "#1e293b",
341
- gray900: "#0f172a",
342
- borderDefault: "#e2e8f0",
343
- borderFocus: "#1e40af",
344
- borderError: "#dc2626",
345
- bgDefault: "#ffffff",
346
- bgSecondary: "#f8fafc",
347
- bgDisabled: "#f1f5f9",
348
- textPrimary: "#0f172a",
349
- textSecondary: "#334155",
350
- textMuted: "#64748b",
351
- textDisabled: "#94a3b8"
352
- },
353
- shadows: {
354
- sm: "0 1px 2px 0 rgb(30 64 175 / 0.05)",
355
- md: "0 4px 6px -1px rgb(30 64 175 / 0.1), 0 2px 4px -2px rgb(30 64 175 / 0.1)",
356
- lg: "0 10px 15px -3px rgb(30 64 175 / 0.1), 0 4px 6px -4px rgb(30 64 175 / 0.1)"
357
- },
358
- radius: {
359
- sm: "0.375rem",
360
- md: "0.5rem",
361
- lg: "0.75rem",
362
- full: "9999px"
363
- },
364
- spacing: {
365
- xs: "0.25rem",
366
- sm: "0.5rem",
367
- md: "1rem",
368
- lg: "1.5rem",
369
- xl: "2rem"
370
- },
371
- fonts: {
372
- default: '"Instrument Sans", sans-serif',
373
- sizeDefault: "16px",
374
- colorDefault: "#0f172a"
375
- }
376
- }, I = {
377
- name: "green",
378
- colors: {
379
- primary: "#059669",
380
- primaryContrast: "#ffffff",
381
- primaryDark: "#047857",
382
- primaryLight: "#10b981",
383
- secondary: "#6b7280",
384
- secondaryContrast: "#ffffff",
385
- secondaryDark: "#4b5563",
386
- secondaryLight: "#9ca3af",
387
- success: "#16a34a",
388
- successContrast: "#ffffff",
389
- successDark: "#15803d",
390
- successLight: "#22c55e",
391
- warning: "#d97706",
392
- warningContrast: "#ffffff",
393
- warningDark: "#b45309",
394
- warningLight: "#f59e0b",
395
- danger: "#dc2626",
396
- dangerContrast: "#ffffff",
397
- dangerDark: "#b91c1c",
398
- dangerLight: "#ef4444",
399
- info: "#0891b2",
400
- infoContrast: "#ffffff",
401
- infoDark: "#0e7490",
402
- infoLight: "#06b6d4",
403
- gray50: "#f9fafb",
404
- gray100: "#f3f4f6",
405
- gray200: "#e5e7eb",
406
- gray300: "#d1d5db",
407
- gray400: "#9ca3af",
408
- gray500: "#6b7280",
409
- gray600: "#4b5563",
410
- gray700: "#374151",
411
- gray800: "#1f2937",
412
- gray900: "#111827",
413
- borderDefault: "#e5e7eb",
414
- borderFocus: "#059669",
415
- borderError: "#dc2626",
416
- bgDefault: "#ffffff",
417
- bgSecondary: "#f9fafb",
418
- bgDisabled: "#f3f4f6",
419
- textPrimary: "#111827",
420
- textSecondary: "#374151",
421
- textMuted: "#6b7280",
422
- textDisabled: "#9ca3af"
423
- },
424
- shadows: {
425
- sm: "0 1px 2px 0 rgb(5 150 105 / 0.05)",
426
- md: "0 4px 6px -1px rgb(5 150 105 / 0.1), 0 2px 4px -2px rgb(5 150 105 / 0.1)",
427
- lg: "0 10px 15px -3px rgb(5 150 105 / 0.1), 0 4px 6px -4px rgb(5 150 105 / 0.1)"
428
- },
429
- radius: {
430
- sm: "0.375rem",
431
- md: "0.5rem",
432
- lg: "0.75rem",
433
- full: "9999px"
434
- },
435
- spacing: {
436
- xs: "0.25rem",
437
- sm: "0.5rem",
438
- md: "1rem",
439
- lg: "1.5rem",
440
- xl: "2rem"
441
- },
442
- fonts: {
443
- default: '"Instrument Sans", sans-serif',
444
- sizeDefault: "16px",
445
- colorDefault: "#111827"
446
- }
447
- }, C = T, h = {
448
- light: T,
449
- dark: E,
450
- blue: j,
451
- green: I
452
- }, w = L(void 0), Z = ({
453
- children: o,
454
- initialTheme: a = "light",
455
- storageKey: e = "flysoft-theme"
456
- }) => {
457
- const [r, t] = D(() => {
458
- if (typeof window < "u") {
459
- const n = localStorage.getItem(e);
460
- if (n) {
461
- if (h[n])
462
- return h[n];
463
- try {
464
- const s = JSON.parse(n);
465
- if (s.name && s.colors)
466
- return s;
467
- } catch {
468
- }
469
- }
470
- }
471
- return typeof a == "string" ? h[a] || C : a;
472
- }), [m, c] = D(r.name), g = (n) => {
473
- if (typeof document > "u") return;
474
- const s = document.documentElement;
475
- Object.entries(n.colors).forEach(([i, y]) => {
476
- const x = `--flysoft-${i.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
477
- s.style.setProperty(x, y);
478
- }), Object.entries(n.shadows).forEach(([i, y]) => {
479
- const x = `--flysoft-shadow-${i}`;
480
- s.style.setProperty(x, y);
481
- }), Object.entries(n.radius).forEach(([i, y]) => {
482
- const x = `--flysoft-radius-${i}`;
483
- s.style.setProperty(x, y);
484
- }), Object.entries(n.spacing).forEach(([i, y]) => {
485
- const x = `--flysoft-spacing-${i}`;
486
- s.style.setProperty(x, y);
487
- }), Object.entries(n.fonts).forEach(([i, y]) => {
488
- const x = `--flysoft-font-${i}`;
489
- s.style.setProperty(x, y);
490
- }), s.setAttribute("data-theme", n.name);
491
- }, b = (n) => {
492
- let s;
493
- typeof n == "string" ? h[n] ? s = h[n] : (console.warn(`Theme "${n}" not found, falling back to default`), s = C) : s = n, t(s), c(s.name), typeof window < "u" && localStorage.setItem(e, JSON.stringify(s)), g(s);
494
- }, p = () => {
495
- b(C);
496
- };
497
- $(() => {
498
- g(r);
499
- }, [r]);
500
- const d = r.name === "dark", l = {
501
- theme: r,
502
- setTheme: b,
503
- currentThemeName: m,
504
- availableThemes: Object.keys(h),
505
- resetToDefault: p,
506
- isDark: d
507
- };
508
- return /* @__PURE__ */ f(w.Provider, { value: l, children: o });
509
- }, P = () => {
510
- const o = N(w);
511
- if (o === void 0)
512
- throw new Error("useTheme must be used within a ThemeProvider");
513
- return o;
514
- }, R = () => N(w) !== void 0, V = (o = {}) => {
515
- const { scope: a = "global", element: e = null, prefix: r = "flysoft" } = o, t = S(/* @__PURE__ */ new Set()), m = v(
516
- (d) => {
517
- const l = a === "global" ? document.documentElement : e;
518
- if (!l) {
519
- console.warn("useThemeOverride: No target element available");
520
- return;
521
- }
522
- Object.entries(d).forEach(([n, s]) => {
523
- const i = `--${r}-${n.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
524
- l.style.setProperty(i, String(s)), t.current.add(i);
525
- });
526
- },
527
- [a, e, r]
528
- ), c = v(
529
- (d) => {
530
- const l = a === "global" ? document.documentElement : e;
531
- l && d.forEach((n) => {
532
- const s = `--${r}-${n.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
533
- t.current.has(s) && (l.style.removeProperty(s), t.current.delete(s));
534
- });
535
- },
536
- [a, e, r]
537
- ), g = v(() => {
538
- const d = a === "global" ? document.documentElement : e;
539
- d && (t.current.forEach((l) => {
540
- d.style.removeProperty(l);
541
- }), t.current.clear());
542
- }, [a, e]), b = v(
543
- (d) => {
544
- const l = a === "global" ? document.documentElement : e;
545
- if (!l) return null;
546
- const n = `--${r}-${d.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
547
- return getComputedStyle(l).getPropertyValue(n) || null;
548
- },
549
- [a, e, r]
550
- ), p = v(
551
- (d) => {
552
- const l = `--${r}-${d.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
553
- return t.current.has(l);
554
- },
555
- [r]
556
- );
557
- return $(() => () => {
558
- g();
559
- }, [g]), {
560
- applyOverride: m,
561
- revertOverride: c,
562
- revertAllOverrides: g,
563
- getCSSVariable: b,
564
- isOverrideApplied: p,
565
- appliedOverridesCount: t.current.size
566
- };
567
- }, B = (o, a = 3e3, e = {}) => {
568
- const { applyOverride: r, revertOverride: t } = V(e);
569
- return { applyTemporaryOverride: v(() => {
570
- r(o);
571
- const c = setTimeout(() => {
572
- t(Object.keys(o));
573
- }, a);
574
- return () => {
575
- clearTimeout(c), t(Object.keys(o));
576
- };
577
- }, [r, t, o, a]) };
578
- }, J = () => {
579
- const {
580
- theme: o,
581
- setTheme: a,
582
- currentThemeName: e,
583
- availableThemes: r,
584
- resetToDefault: t,
585
- isDark: m
586
- } = P();
587
- return /* @__PURE__ */ u(O, { className: "p-6 max-w-md mx-auto", children: [
588
- /* @__PURE__ */ f(
589
- "h3",
590
- {
591
- className: "text-lg font-semibold mb-4",
592
- style: { color: "var(--flysoft-text-primary)" },
593
- children: "Theme Switcher"
594
- }
595
- ),
596
- /* @__PURE__ */ u("div", { className: "space-y-3", children: [
597
- /* @__PURE__ */ f("div", { className: "flex flex-wrap gap-2", children: r.map((c) => /* @__PURE__ */ f(
598
- k,
599
- {
600
- variant: e === c ? "primary" : "ghost",
601
- size: "sm",
602
- onClick: () => a(c),
603
- children: c
604
- },
605
- c
606
- )) }),
607
- /* @__PURE__ */ f(
608
- k,
609
- {
610
- variant: "outline",
611
- size: "sm",
612
- onClick: t,
613
- className: "w-full",
614
- children: "Reset to Default"
615
- }
616
- ),
617
- /* @__PURE__ */ u(
618
- "div",
619
- {
620
- className: "text-sm space-y-2",
621
- style: { color: "var(--flysoft-text-secondary)" },
622
- children: [
623
- /* @__PURE__ */ u("p", { children: [
624
- /* @__PURE__ */ f("strong", { children: "Current Theme:" }),
625
- " ",
626
- e
627
- ] }),
628
- /* @__PURE__ */ u("p", { children: [
629
- /* @__PURE__ */ f("strong", { children: "Mode:" }),
630
- " ",
631
- m ? "Dark" : "Light"
632
- ] }),
633
- /* @__PURE__ */ u("p", { children: [
634
- /* @__PURE__ */ f("strong", { children: "Primary Color:" }),
635
- " ",
636
- o.colors.primary
637
- ] })
638
- ]
639
- }
640
- ),
641
- /* @__PURE__ */ f(
642
- "div",
643
- {
644
- className: "w-full h-8 rounded border-2",
645
- style: {
646
- backgroundColor: o.colors.primary,
647
- borderColor: o.colors.borderDefault
648
- }
649
- }
650
- )
651
- ] })
652
- ] });
653
- };
654
- export {
655
- F as Badge,
656
- k as Button,
657
- O as Card,
658
- M as Input,
659
- H as React,
660
- Z as ThemeProvider,
661
- J as ThemeSwitcher,
662
- j as blueTheme,
663
- E as darkTheme,
664
- C as defaultTheme,
665
- I as greenTheme,
666
- T as lightTheme,
667
- h as themes,
668
- B as useTemporaryOverride,
669
- P as useTheme,
670
- R as useThemeContext,
671
- V as useThemeOverride
672
- };
673
- //# sourceMappingURL=index.js.map
1
+ // Component exports
2
+ export { Button } from "./components/form-controls/Button";
3
+ export { Input } from "./components/form-controls/Input";
4
+ export { Card } from "./components/layout/Card";
5
+ export { Badge } from "./components/utils/Badge";
6
+ // Theme system exports
7
+ export * from "./contexts";
8
+ // Theme Switcher component
9
+ export { ThemeSwitcher } from "./components/ThemeSwitcher";
10
+ // Styles export
11
+ export * from "./styles";
12
+ // Re-export React for convenience
13
+ export { default as React } from "react";
package/dist/main.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":""}
package/dist/main.js ADDED
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { StrictMode } from "react";
3
+ import { createRoot } from "react-dom/client";
4
+ import App from "./App";
5
+ createRoot(document.getElementById("root")).render(_jsx(StrictMode, { children: _jsx(App, {}) }));
@@ -0,0 +1,3 @@
1
+ import "./styles.css";
2
+ export * from "./styles.css";
3
+ //# sourceMappingURL=styles.d.ts.map