@umbra.ui/core 0.1.18 → 0.1.19

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 (146) hide show
  1. package/dist/components/controls/Button/Button.vue +417 -0
  2. package/dist/components/controls/Button/README.md +348 -0
  3. package/dist/components/controls/Button/theme.css +200 -0
  4. package/dist/components/controls/Checkbox/Checkbox.vue +164 -0
  5. package/dist/components/controls/Checkbox/README.md +441 -0
  6. package/dist/components/controls/Checkbox/theme.css +36 -0
  7. package/dist/components/controls/Dropdown/Dropdown.vue +476 -0
  8. package/dist/components/controls/Dropdown/README.md +370 -0
  9. package/dist/components/controls/Dropdown/theme.css +50 -0
  10. package/dist/components/controls/Dropdown/types.ts +6 -0
  11. package/dist/components/controls/IconButton/IconButton.vue +267 -0
  12. package/dist/components/controls/IconButton/README.md +502 -0
  13. package/dist/components/controls/IconButton/theme.css +89 -0
  14. package/dist/components/controls/Radio/README.md +591 -0
  15. package/dist/components/controls/Radio/Radio.vue +89 -0
  16. package/dist/components/controls/Radio/theme.css +14 -0
  17. package/dist/components/controls/RangeSlider/README.md +608 -0
  18. package/dist/components/controls/RangeSlider/RangeSlider.vue +535 -0
  19. package/dist/components/controls/RangeSlider/theme.css +80 -0
  20. package/dist/components/controls/SegmentedControl/README.md +587 -0
  21. package/dist/components/controls/SegmentedControl/SegmentedControl.vue +284 -0
  22. package/dist/components/controls/SegmentedControl/theme.css +60 -0
  23. package/dist/components/controls/SegmentedControl/types.ts +5 -0
  24. package/dist/components/controls/Slider/README.md +627 -0
  25. package/dist/components/controls/Slider/Slider.vue +260 -0
  26. package/dist/components/controls/Slider/theme.css +74 -0
  27. package/dist/components/controls/Stepper/README.md +601 -0
  28. package/dist/components/controls/Stepper/Stepper.vue +103 -0
  29. package/dist/components/controls/Stepper/theme.css +53 -0
  30. package/dist/components/controls/Switch/README.md +667 -0
  31. package/dist/components/controls/Switch/Switch.vue +127 -0
  32. package/dist/components/controls/Switch/theme.css +42 -0
  33. package/dist/components/dialogs/Alert/Alert.vue +218 -0
  34. package/dist/components/dialogs/Alert/README.md +450 -0
  35. package/dist/components/dialogs/Alert/theme.css +44 -0
  36. package/dist/components/dialogs/Alert/types.ts +11 -0
  37. package/dist/components/dialogs/Toast/README.md +522 -0
  38. package/dist/components/dialogs/Toast/Toast.vue +296 -0
  39. package/dist/components/dialogs/Toast/ToastContainer.vue +330 -0
  40. package/dist/components/dialogs/Toast/theme.css +44 -0
  41. package/dist/components/dialogs/Toast/types.ts +46 -0
  42. package/dist/components/dialogs/Toast/useToast.ts +127 -0
  43. package/dist/components/indicators/ProgressBar/ProgressBar.vue +98 -0
  44. package/dist/components/indicators/ProgressBar/README.md +744 -0
  45. package/dist/components/indicators/ProgressBar/theme.css +36 -0
  46. package/dist/components/indicators/Tooltip/README.md +723 -0
  47. package/dist/components/indicators/Tooltip/TooltipProvider.vue +142 -0
  48. package/dist/components/indicators/Tooltip/theme.css +18 -0
  49. package/dist/components/indicators/Tooltip/tooltip.ts +48 -0
  50. package/dist/components/indicators/Tooltip/types.ts +15 -0
  51. package/dist/components/indicators/Tooltip/useTooltip.ts +71 -0
  52. package/dist/components/inputs/AutogrowTextView/AutogrowTextView.vue +110 -0
  53. package/dist/components/inputs/AutogrowTextView/README.md +643 -0
  54. package/dist/components/inputs/AutogrowTextView/theme.css +28 -0
  55. package/dist/components/inputs/InputCard/InputCard.vue +600 -0
  56. package/dist/components/inputs/InputCard/README.md +636 -0
  57. package/dist/components/inputs/InputEmail/InputEmail.vue +698 -0
  58. package/dist/components/inputs/InputEmail/README.md +764 -0
  59. package/dist/components/inputs/InputNumber/InputNumber.vue +300 -0
  60. package/dist/components/inputs/InputNumber/README.md +749 -0
  61. package/dist/components/inputs/InputPhone/InputPhone.vue +645 -0
  62. package/dist/components/inputs/InputPhone/README.md +636 -0
  63. package/dist/components/inputs/InputSecure/InputSecure.vue +646 -0
  64. package/dist/components/inputs/InputSecure/README.md +771 -0
  65. package/dist/components/inputs/InputText/InputText.vue +225 -0
  66. package/dist/components/inputs/InputText/README.md +844 -0
  67. package/dist/components/inputs/OTP/OTP.vue +349 -0
  68. package/dist/components/inputs/OTP/README.md +736 -0
  69. package/dist/components/inputs/OTP/theme.css +50 -0
  70. package/dist/components/inputs/StringCapture/README.md +718 -0
  71. package/dist/components/inputs/StringCapture/StringCapture.vue +315 -0
  72. package/dist/components/inputs/StringCapture/theme.css +86 -0
  73. package/dist/components/inputs/Tags/README.md +897 -0
  74. package/dist/components/inputs/Tags/TagBar.vue +793 -0
  75. package/dist/components/inputs/Tags/TagCreation.vue +219 -0
  76. package/dist/components/inputs/Tags/TagPicker.vue +380 -0
  77. package/dist/components/inputs/Tags/tag-bar-styles.ts +354 -0
  78. package/dist/components/inputs/Tags/theme.css +121 -0
  79. package/dist/components/inputs/Tags/types.ts +346 -0
  80. package/dist/components/inputs/search/README.md +759 -0
  81. package/dist/components/inputs/search/SearchBar.vue +394 -0
  82. package/dist/components/inputs/search/SearchResults.vue +310 -0
  83. package/dist/components/inputs/search/theme.css +187 -0
  84. package/dist/components/inputs/search/types.ts +8 -0
  85. package/dist/components/inputs/theme.css +102 -0
  86. package/dist/components/menus/ActionMenu/ActionMenu.vue +383 -0
  87. package/dist/components/menus/ActionMenu/README.md +825 -0
  88. package/dist/components/menus/ActionMenu/theme.css +93 -0
  89. package/dist/components/models/Popover/Popover.vue +551 -0
  90. package/dist/components/models/Popover/README.md +885 -0
  91. package/dist/components/models/Popover/theme.css +52 -0
  92. package/dist/components/models/Sheet/README.md +1159 -0
  93. package/dist/components/models/Sheet/Sheet.vue +465 -0
  94. package/dist/components/models/Sheet/theme.css +72 -0
  95. package/dist/components/models/Sidebar/README.md +1228 -0
  96. package/dist/components/models/Sidebar/Sidebar.vue +480 -0
  97. package/dist/components/models/Sidebar/theme.css +90 -0
  98. package/dist/components/navigation/adaptive/AdaptiveLayout.vue +779 -0
  99. package/dist/components/navigation/adaptive/AdaptiveLayoutBreadcrumbs.vue +192 -0
  100. package/dist/components/navigation/adaptive/AdaptiveLayoutMenuButton.vue +149 -0
  101. package/dist/components/navigation/adaptive/README.md +768 -0
  102. package/dist/components/navigation/adaptive/types.ts +19 -0
  103. package/dist/components/navigation/adaptive/useAdaptiveLayout.ts +89 -0
  104. package/dist/components/navigation/adaptive/useBreakpoints.ts +41 -0
  105. package/dist/components/navigation/adaptive/useContainerMonitor.ts +214 -0
  106. package/dist/components/navigation/adaptive/useViewAnimation.ts +721 -0
  107. package/dist/components/navigation/adaptive/useViewResize.ts +211 -0
  108. package/dist/components/navigation/navstack/NavigationStack.vue +180 -0
  109. package/dist/components/navigation/navstack/README.md +994 -0
  110. package/dist/components/navigation/navstack/useNavigationStack.ts +164 -0
  111. package/dist/components/navigation/slideover/README.md +1275 -0
  112. package/dist/components/navigation/slideover/SlideoverController.vue +287 -0
  113. package/dist/components/navigation/slideover/useSlideoverController.ts +320 -0
  114. package/dist/components/navigation/splitview/README.md +1115 -0
  115. package/dist/components/navigation/splitview/SplitViewController.vue +176 -0
  116. package/dist/components/navigation/splitview/useSplitViewController.ts +388 -0
  117. package/dist/components/navigation/tabcontroller/README.md +919 -0
  118. package/dist/components/navigation/tabcontroller/TabController.vue +307 -0
  119. package/dist/components/navigation/tabcontroller/TabItem.vue +57 -0
  120. package/dist/components/navigation/tabcontroller/types.ts +24 -0
  121. package/dist/components/navigation/tabcontroller/useTabController.ts +18 -0
  122. package/dist/components/navigation/theme.css +91 -0
  123. package/dist/components/navigation/types.ts +7 -0
  124. package/dist/components/pickers/CollectionPicker/CollectionPicker.vue +398 -0
  125. package/dist/components/pickers/CollectionPicker/README.md +1115 -0
  126. package/dist/components/pickers/CollectionPicker/theme.css +14 -0
  127. package/dist/components/pickers/CollectionPicker/types.ts +11 -0
  128. package/dist/components/pickers/ColorPicker/ColorPicker.vue +376 -0
  129. package/dist/components/pickers/ColorPicker/README.md +1439 -0
  130. package/dist/components/pickers/ColorPicker/colors.ts +299 -0
  131. package/dist/components/pickers/ColorPicker/theme.css +32 -0
  132. package/dist/components/pickers/DatePicker/DatePicker.vue +660 -0
  133. package/dist/components/pickers/DatePicker/README.md +1195 -0
  134. package/dist/components/pickers/DatePicker/theme.css +22 -0
  135. package/dist/components/pickers/FilePicker/FilePicker.vue +534 -0
  136. package/dist/components/pickers/FilePicker/README.md +1542 -0
  137. package/dist/components/pickers/FilePicker/theme.css +48 -0
  138. package/dist/components/pickers/FilePicker/types.ts +10 -0
  139. package/dist/components/pickers/IconPicker/IconPicker.vue +327 -0
  140. package/dist/components/pickers/IconPicker/README.md +1161 -0
  141. package/dist/components/pickers/IconPicker/theme.css +28 -0
  142. package/dist/components/pickers/theme.css +82 -0
  143. package/dist/components/views/MarkdownViewer/MarkdownViewer.vue +442 -0
  144. package/dist/components/views/MarkdownViewer/README.md +833 -0
  145. package/dist/components/views/MarkdownViewer/theme.css +130 -0
  146. package/package.json +3 -2
@@ -0,0 +1,346 @@
1
+ import tinycolor from "tinycolor2";
2
+ import * as colors from "@umbra.ui/colors";
3
+ import { ThemeObject } from "../../../index";
4
+ import { getThemeConfig } from "../../../theme";
5
+
6
+ // Core interfaces
7
+ export interface TagItem {
8
+ id: string;
9
+ title: string;
10
+ style?: TagStyleConfig;
11
+ }
12
+
13
+ // Simplified style configuration - direct CSS properties
14
+ export interface TagStyleConfig {
15
+ // Direct CSS properties for full control
16
+ backgroundColor?: string;
17
+ color?: string;
18
+ border?: string;
19
+ borderRadius?: string;
20
+ padding?: string;
21
+ fontSize?: string;
22
+ fontWeight?: string;
23
+ boxShadow?: string;
24
+
25
+ // Optional hover state
26
+ hover?: {
27
+ backgroundColor?: string;
28
+ color?: string;
29
+ border?: string;
30
+ transform?: string;
31
+ boxShadow?: string;
32
+ };
33
+
34
+ // Helper properties for convenience
35
+ size?: TagSize;
36
+ colorScheme?: ColorScheme; // Can still use predefined colors if desired
37
+ }
38
+
39
+ export type TagSize = "sm" | "md" | "lg";
40
+ export type ColorScheme = SolidColorName | string; // Radix color name or hex
41
+
42
+ export type SolidColorName =
43
+ | "gray"
44
+ | "mauve"
45
+ | "slate"
46
+ | "sage"
47
+ | "olive"
48
+ | "sand"
49
+ | "tomato"
50
+ | "red"
51
+ | "ruby"
52
+ | "crimson"
53
+ | "pink"
54
+ | "plum"
55
+ | "purple"
56
+ | "violet"
57
+ | "iris"
58
+ | "indigo"
59
+ | "blue"
60
+ | "cyan"
61
+ | "teal"
62
+ | "jade"
63
+ | "green"
64
+ | "grass"
65
+ | "bronze"
66
+ | "gold"
67
+ | "brown"
68
+ | "orange"
69
+ | "amber"
70
+ | "yellow"
71
+ | "lime"
72
+ | "mint"
73
+ | "sky";
74
+
75
+ // Simplified style interface that matches CSS directly
76
+ export interface TagStyle {
77
+ container: {
78
+ backgroundColor: string;
79
+ color: string;
80
+ border: string;
81
+ borderRadius: string;
82
+ padding: string;
83
+ fontSize?: string;
84
+ fontWeight?: string;
85
+ boxShadow?: string;
86
+ };
87
+ hover?: {
88
+ backgroundColor?: string;
89
+ color?: string;
90
+ border?: string;
91
+ transform?: string;
92
+ boxShadow?: string;
93
+ };
94
+ }
95
+
96
+ // Clean data interface (no callbacks)
97
+ export interface TagData {
98
+ query: string;
99
+ allTags: TagItem[];
100
+ selectedTags: TagItem[];
101
+ matchIndex: number;
102
+ }
103
+
104
+ // Color mode detection function that uses theme or falls back to system
105
+ export const getColorMode = (): "light" | "dark" => {
106
+ const config = getThemeConfig();
107
+ // If a theme is provided, use its color mode
108
+ if (config?.customThemeColorMode) {
109
+ return config.customThemeColorMode;
110
+ }
111
+
112
+ // Otherwise fall back to system preference
113
+ return window.matchMedia?.("(prefers-color-scheme: dark)").matches
114
+ ? "dark"
115
+ : "light";
116
+ };
117
+
118
+ // Size presets
119
+ const SIZE_PRESETS: Record<TagSize, { padding: string; fontSize: string }> = {
120
+ sm: { padding: "0.125rem 0.375rem", fontSize: "0.75rem" },
121
+ md: { padding: "0.235rem 0.588rem", fontSize: "0.875rem" },
122
+ lg: { padding: "0.375rem 0.75rem", fontSize: "1rem" },
123
+ };
124
+
125
+ // Helper to get Radix colors based on color mode
126
+ const getRadixColor = (
127
+ colorName: SolidColorName,
128
+ step: number,
129
+ alpha = false
130
+ ): string => {
131
+ const isDark = getColorMode() === "dark";
132
+ const colorKey = isDark ? `${colorName}Dark` : colorName;
133
+ const alphaKey = alpha ? "A" : "";
134
+ const colorScale = (colors as any)[`${colorKey}${alphaKey}`];
135
+
136
+ if (!colorScale) {
137
+ console.warn(`Color scale ${colorKey}${alphaKey} not found`);
138
+ return "#808080";
139
+ }
140
+
141
+ const stepKey = `${colorName}${alphaKey}${step}`;
142
+ return colorScale[stepKey] || "#808080";
143
+ };
144
+
145
+ // Check if a string is a valid Radix color name
146
+ const isRadixColor = (color: string): color is SolidColorName => {
147
+ const radixColors: SolidColorName[] = [
148
+ "gray",
149
+ "mauve",
150
+ "slate",
151
+ "sage",
152
+ "olive",
153
+ "sand",
154
+ "tomato",
155
+ "red",
156
+ "ruby",
157
+ "crimson",
158
+ "pink",
159
+ "plum",
160
+ "purple",
161
+ "violet",
162
+ "iris",
163
+ "indigo",
164
+ "blue",
165
+ "cyan",
166
+ "teal",
167
+ "jade",
168
+ "green",
169
+ "grass",
170
+ "bronze",
171
+ "gold",
172
+ "brown",
173
+ "orange",
174
+ "amber",
175
+ "yellow",
176
+ "lime",
177
+ "mint",
178
+ "sky",
179
+ ];
180
+ return radixColors.includes(color as SolidColorName);
181
+ };
182
+
183
+ // Default style values
184
+ const DEFAULT_STYLE: TagStyle = {
185
+ container: {
186
+ backgroundColor: "var(--default-tag-background-color)",
187
+ color: "var(--default-tag-color)",
188
+ border: "1px solid var(--default-tag-border)",
189
+ borderRadius: "var(--default-tag-border-radius)",
190
+ padding: "var(--default-tag-padding)",
191
+ fontSize: "var(--default-tag-font-size)",
192
+ fontWeight: "var(--default-tag-font-weight)",
193
+ },
194
+ hover: {
195
+ backgroundColor: "var(--default-tag-hover-background-color)",
196
+ },
197
+ };
198
+
199
+ // Generate default style from color scheme
200
+ const generateDefaultStyleFromColor = (colorScheme: string): TagStyle => {
201
+ if (isRadixColor(colorScheme)) {
202
+ // Use Radix color scale
203
+ return {
204
+ container: {
205
+ backgroundColor: getRadixColor(colorScheme, 5, true),
206
+ color: getRadixColor(colorScheme, 11),
207
+ border: `1px solid ${getRadixColor(colorScheme, 7)}`,
208
+ borderRadius: "0.375rem",
209
+ padding: SIZE_PRESETS.md.padding,
210
+ fontSize: SIZE_PRESETS.md.fontSize,
211
+ },
212
+ hover: {
213
+ backgroundColor: getRadixColor(colorScheme, 5, true),
214
+ },
215
+ };
216
+ } else {
217
+ // Use custom hex color
218
+ const baseColor = tinycolor(colorScheme);
219
+ const isDark = getColorMode() === "dark";
220
+
221
+ return {
222
+ container: {
223
+ backgroundColor: isDark
224
+ ? baseColor.setAlpha(0.2).toRgbString()
225
+ : baseColor.setAlpha(0.15).toRgbString(),
226
+ color: isDark
227
+ ? baseColor.lighten(20).toHexString()
228
+ : baseColor.darken(20).toHexString(),
229
+ border: `1px solid ${baseColor.setAlpha(0.3).toRgbString()}`,
230
+ borderRadius: "0.375rem",
231
+ padding: SIZE_PRESETS.md.padding,
232
+ fontSize: SIZE_PRESETS.md.fontSize,
233
+ },
234
+ hover: {
235
+ backgroundColor: isDark
236
+ ? baseColor.setAlpha(0.3).toRgbString()
237
+ : baseColor.setAlpha(0.25).toRgbString(),
238
+ },
239
+ };
240
+ }
241
+ };
242
+
243
+ // Main style generation function - much simpler!
244
+ export const generateTagStyle = (config: TagStyleConfig = {}): TagStyle => {
245
+ let baseStyle: TagStyle = { ...DEFAULT_STYLE };
246
+
247
+ // If a color scheme is provided, generate default colors from it
248
+ if (config.colorScheme) {
249
+ baseStyle = generateDefaultStyleFromColor(config.colorScheme);
250
+ }
251
+
252
+ // Apply size preset if provided
253
+ if (config.size) {
254
+ const sizeConfig = SIZE_PRESETS[config.size];
255
+ baseStyle.container.padding = sizeConfig.padding;
256
+ baseStyle.container.fontSize = sizeConfig.fontSize;
257
+ }
258
+
259
+ // Direct CSS property overrides - these take precedence
260
+ const style: TagStyle = {
261
+ container: {
262
+ ...baseStyle.container,
263
+ backgroundColor:
264
+ config.backgroundColor ?? baseStyle.container.backgroundColor,
265
+ color: config.color ?? baseStyle.container.color,
266
+ border: config.border ?? baseStyle.container.border,
267
+ borderRadius: config.borderRadius ?? baseStyle.container.borderRadius,
268
+ padding: config.padding ?? baseStyle.container.padding,
269
+ fontSize: config.fontSize ?? baseStyle.container.fontSize,
270
+ fontWeight: config.fontWeight ?? baseStyle.container.fontWeight,
271
+ boxShadow: config.boxShadow ?? baseStyle.container.boxShadow,
272
+ },
273
+ hover: config.hover
274
+ ? {
275
+ ...baseStyle.hover,
276
+ ...config.hover,
277
+ }
278
+ : baseStyle.hover,
279
+ };
280
+
281
+ return style;
282
+ };
283
+
284
+ // Helper to create tag with style
285
+ export const createStyledTag = (
286
+ id: string,
287
+ title: string,
288
+ styleConfig?: TagStyleConfig
289
+ ): TagItem => ({
290
+ id,
291
+ title,
292
+ style: styleConfig,
293
+ });
294
+
295
+ // Preset color schemes using Radix colors
296
+ export const COLOR_PRESETS = {
297
+ primary: "blue",
298
+ success: "green",
299
+ warning: "amber",
300
+ danger: "red",
301
+ info: "cyan",
302
+ neutral: "gray",
303
+ } as const;
304
+
305
+ // Example preset styles that developers can use or override
306
+ export const TAG_STYLE_PRESETS = {
307
+ default: {
308
+ borderRadius: "999px",
309
+ padding: "0.235rem 0.588rem",
310
+ },
311
+ rounded: {
312
+ borderRadius: "0.375rem",
313
+ padding: "0.235rem 0.588rem",
314
+ },
315
+ square: {
316
+ borderRadius: "0",
317
+ padding: "0.235rem 0.588rem",
318
+ },
319
+ pill: {
320
+ borderRadius: "999px",
321
+ padding: "0.25rem 0.75rem",
322
+ },
323
+ minimal: {
324
+ backgroundColor: "transparent",
325
+ border: "none",
326
+ padding: "0.125rem 0.375rem",
327
+ },
328
+ } as const;
329
+
330
+ // Utility class for managing tag themes (simplified)
331
+ export class TagTheme {
332
+ private defaultStyle: TagStyleConfig;
333
+
334
+ constructor(defaultStyle: TagStyleConfig = {}) {
335
+ this.defaultStyle = defaultStyle;
336
+ }
337
+
338
+ generateStyle(overrides?: TagStyleConfig): TagStyle {
339
+ return generateTagStyle({ ...this.defaultStyle, ...overrides });
340
+ }
341
+
342
+ // Create a tag with the theme's default style
343
+ createTag(id: string, title: string, overrides?: TagStyleConfig): TagItem {
344
+ return createStyledTag(id, title, { ...this.defaultStyle, ...overrides });
345
+ }
346
+ }