@umbra.ui/core 0.1.0
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.
- package/dist/components/controls/Dropdown/types.d.ts +5 -0
- package/dist/components/controls/Dropdown/types.d.ts.map +1 -0
- package/dist/components/controls/Dropdown/types.js +1 -0
- package/dist/components/controls/SegmentedControl/types.d.ts +6 -0
- package/dist/components/controls/SegmentedControl/types.d.ts.map +1 -0
- package/dist/components/controls/SegmentedControl/types.js +1 -0
- package/dist/components/dialogs/Alert/types.d.ts +7 -0
- package/dist/components/dialogs/Alert/types.d.ts.map +1 -0
- package/dist/components/dialogs/Alert/types.js +1 -0
- package/dist/components/dialogs/Toast/types.d.ts +34 -0
- package/dist/components/dialogs/Toast/types.d.ts.map +1 -0
- package/dist/components/dialogs/Toast/types.js +10 -0
- package/dist/components/dialogs/Toast/useToast.d.ts +36 -0
- package/dist/components/dialogs/Toast/useToast.d.ts.map +1 -0
- package/dist/components/dialogs/Toast/useToast.js +90 -0
- package/dist/components/indicators/Tooltip/tooltip.d.ts +3 -0
- package/dist/components/indicators/Tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/tooltip.js +33 -0
- package/dist/components/indicators/Tooltip/types.d.ts +14 -0
- package/dist/components/indicators/Tooltip/types.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/types.js +1 -0
- package/dist/components/indicators/Tooltip/useTooltip.d.ts +18 -0
- package/dist/components/indicators/Tooltip/useTooltip.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/useTooltip.js +57 -0
- package/dist/components/inputs/Tags/tag-bar-styles.d.ts +14 -0
- package/dist/components/inputs/Tags/tag-bar-styles.d.ts.map +1 -0
- package/dist/components/inputs/Tags/tag-bar-styles.js +313 -0
- package/dist/components/inputs/Tags/types.d.ts +93 -0
- package/dist/components/inputs/Tags/types.d.ts.map +1 -0
- package/dist/components/inputs/Tags/types.js +216 -0
- package/dist/components/inputs/search/types.d.ts +9 -0
- package/dist/components/inputs/search/types.d.ts.map +1 -0
- package/dist/components/inputs/search/types.js +1 -0
- package/dist/components/navigation/adaptive/types.d.ts +16 -0
- package/dist/components/navigation/adaptive/types.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/types.js +1 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.d.ts +27 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.js +40 -0
- package/dist/components/navigation/adaptive/useBreakpoints.d.ts +6 -0
- package/dist/components/navigation/adaptive/useBreakpoints.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useBreakpoints.js +37 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.d.ts +93 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.js +145 -0
- package/dist/components/navigation/adaptive/useViewAnimation.d.ts +31 -0
- package/dist/components/navigation/adaptive/useViewAnimation.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useViewAnimation.js +591 -0
- package/dist/components/navigation/adaptive/useViewResize.d.ts +52 -0
- package/dist/components/navigation/adaptive/useViewResize.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useViewResize.js +146 -0
- package/dist/components/navigation/navstack/useNavigationStack.d.ts +25 -0
- package/dist/components/navigation/navstack/useNavigationStack.d.ts.map +1 -0
- package/dist/components/navigation/navstack/useNavigationStack.js +133 -0
- package/dist/components/navigation/slideover/useSlideoverController.d.ts +20 -0
- package/dist/components/navigation/slideover/useSlideoverController.d.ts.map +1 -0
- package/dist/components/navigation/slideover/useSlideoverController.js +267 -0
- package/dist/components/navigation/splitview/useSplitViewController.d.ts +20 -0
- package/dist/components/navigation/splitview/useSplitViewController.d.ts.map +1 -0
- package/dist/components/navigation/splitview/useSplitViewController.js +325 -0
- package/dist/components/navigation/tabcontroller/types.d.ts +21 -0
- package/dist/components/navigation/tabcontroller/types.d.ts.map +1 -0
- package/dist/components/navigation/tabcontroller/types.js +1 -0
- package/dist/components/navigation/tabcontroller/useTabController.d.ts +5 -0
- package/dist/components/navigation/tabcontroller/useTabController.d.ts.map +1 -0
- package/dist/components/navigation/tabcontroller/useTabController.js +10 -0
- package/dist/components/navigation/types.d.ts +8 -0
- package/dist/components/navigation/types.d.ts.map +1 -0
- package/dist/components/navigation/types.js +1 -0
- package/dist/components/pickers/CollectionPicker/types.d.ts +11 -0
- package/dist/components/pickers/CollectionPicker/types.d.ts.map +1 -0
- package/dist/components/pickers/CollectionPicker/types.js +1 -0
- package/dist/components/pickers/ColorPicker/colors.d.ts +13 -0
- package/dist/components/pickers/ColorPicker/colors.d.ts.map +1 -0
- package/dist/components/pickers/ColorPicker/colors.js +266 -0
- package/dist/components/pickers/FilePicker/types.d.ts +10 -0
- package/dist/components/pickers/FilePicker/types.d.ts.map +1 -0
- package/dist/components/pickers/FilePicker/types.js +1 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +196 -0
- package/dist/theme.d.ts +73 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +279 -0
- package/dist/themes/blank.d.ts +7 -0
- package/dist/themes/blank.d.ts.map +1 -0
- package/dist/themes/blank.js +543 -0
- package/dist/themes/crimson-dark.d.ts +4 -0
- package/dist/themes/crimson-dark.d.ts.map +1 -0
- package/dist/themes/crimson-dark.js +552 -0
- package/dist/themes/cyan-light.d.ts +4 -0
- package/dist/themes/cyan-light.d.ts.map +1 -0
- package/dist/themes/cyan-light.js +552 -0
- package/dist/themes/dark.d.ts +4 -0
- package/dist/themes/dark.d.ts.map +1 -0
- package/dist/themes/dark.js +551 -0
- package/dist/themes/gold-dark.d.ts +4 -0
- package/dist/themes/gold-dark.d.ts.map +1 -0
- package/dist/themes/gold-dark.js +552 -0
- package/dist/themes/grass-dark.d.ts +4 -0
- package/dist/themes/grass-dark.d.ts.map +1 -0
- package/dist/themes/grass-dark.js +552 -0
- package/dist/themes/indigo.d.ts +4 -0
- package/dist/themes/indigo.d.ts.map +1 -0
- package/dist/themes/indigo.js +552 -0
- package/dist/themes/light.d.ts +4 -0
- package/dist/themes/light.d.ts.map +1 -0
- package/dist/themes/light.js +551 -0
- package/dist/themes/orange-dark.d.ts +4 -0
- package/dist/themes/orange-dark.d.ts.map +1 -0
- package/dist/themes/orange-dark.js +551 -0
- package/dist/themes/orange-light.d.ts +4 -0
- package/dist/themes/orange-light.d.ts.map +1 -0
- package/dist/themes/orange-light.js +551 -0
- package/package.json +62 -0
- package/src/components/controls/Button/Button.vue +417 -0
- package/src/components/controls/Button/README.md +348 -0
- package/src/components/controls/Button/theme.css +200 -0
- package/src/components/controls/Checkbox/Checkbox.vue +164 -0
- package/src/components/controls/Checkbox/README.md +441 -0
- package/src/components/controls/Checkbox/theme.css +36 -0
- package/src/components/controls/Dropdown/Dropdown.vue +476 -0
- package/src/components/controls/Dropdown/README.md +370 -0
- package/src/components/controls/Dropdown/theme.css +50 -0
- package/src/components/controls/Dropdown/types.ts +6 -0
- package/src/components/controls/IconButton/IconButton.vue +267 -0
- package/src/components/controls/IconButton/README.md +502 -0
- package/src/components/controls/IconButton/theme.css +89 -0
- package/src/components/controls/Radio/README.md +591 -0
- package/src/components/controls/Radio/Radio.vue +89 -0
- package/src/components/controls/Radio/theme.css +14 -0
- package/src/components/controls/RangeSlider/README.md +608 -0
- package/src/components/controls/RangeSlider/RangeSlider.vue +535 -0
- package/src/components/controls/RangeSlider/theme.css +80 -0
- package/src/components/controls/SegmentedControl/README.md +587 -0
- package/src/components/controls/SegmentedControl/SegmentedControl.vue +284 -0
- package/src/components/controls/SegmentedControl/theme.css +60 -0
- package/src/components/controls/SegmentedControl/types.ts +5 -0
- package/src/components/controls/Slider/README.md +627 -0
- package/src/components/controls/Slider/Slider.vue +260 -0
- package/src/components/controls/Slider/theme.css +74 -0
- package/src/components/controls/Stepper/README.md +601 -0
- package/src/components/controls/Stepper/Stepper.vue +103 -0
- package/src/components/controls/Stepper/theme.css +53 -0
- package/src/components/controls/Switch/README.md +667 -0
- package/src/components/controls/Switch/Switch.vue +127 -0
- package/src/components/controls/Switch/theme.css +42 -0
- package/src/components/dialogs/Alert/Alert.vue +218 -0
- package/src/components/dialogs/Alert/README.md +450 -0
- package/src/components/dialogs/Alert/theme.css +44 -0
- package/src/components/dialogs/Alert/types.ts +11 -0
- package/src/components/dialogs/Toast/README.md +522 -0
- package/src/components/dialogs/Toast/Toast.vue +296 -0
- package/src/components/dialogs/Toast/ToastContainer.vue +330 -0
- package/src/components/dialogs/Toast/theme.css +44 -0
- package/src/components/dialogs/Toast/types.ts +46 -0
- package/src/components/dialogs/Toast/useToast.ts +127 -0
- package/src/components/indicators/ProgressBar/ProgressBar.vue +98 -0
- package/src/components/indicators/ProgressBar/README.md +744 -0
- package/src/components/indicators/ProgressBar/theme.css +36 -0
- package/src/components/indicators/Tooltip/README.md +723 -0
- package/src/components/indicators/Tooltip/TooltipProvider.vue +142 -0
- package/src/components/indicators/Tooltip/theme.css +18 -0
- package/src/components/indicators/Tooltip/tooltip.ts +48 -0
- package/src/components/indicators/Tooltip/types.ts +15 -0
- package/src/components/indicators/Tooltip/useTooltip.ts +71 -0
- package/src/components/inputs/AutogrowTextView/AutogrowTextView.vue +110 -0
- package/src/components/inputs/AutogrowTextView/README.md +643 -0
- package/src/components/inputs/AutogrowTextView/theme.css +28 -0
- package/src/components/inputs/InputCard/InputCard.vue +600 -0
- package/src/components/inputs/InputCard/README.md +636 -0
- package/src/components/inputs/InputEmail/InputEmail.vue +698 -0
- package/src/components/inputs/InputEmail/README.md +764 -0
- package/src/components/inputs/InputNumber/InputNumber.vue +300 -0
- package/src/components/inputs/InputNumber/README.md +749 -0
- package/src/components/inputs/InputPhone/InputPhone.vue +645 -0
- package/src/components/inputs/InputPhone/README.md +636 -0
- package/src/components/inputs/InputSecure/InputSecure.vue +646 -0
- package/src/components/inputs/InputSecure/README.md +771 -0
- package/src/components/inputs/InputText/InputText.vue +225 -0
- package/src/components/inputs/InputText/README.md +844 -0
- package/src/components/inputs/OTP/OTP.vue +349 -0
- package/src/components/inputs/OTP/README.md +736 -0
- package/src/components/inputs/OTP/theme.css +50 -0
- package/src/components/inputs/StringCapture/README.md +718 -0
- package/src/components/inputs/StringCapture/StringCapture.vue +315 -0
- package/src/components/inputs/StringCapture/theme.css +86 -0
- package/src/components/inputs/Tags/README.md +897 -0
- package/src/components/inputs/Tags/TagBar.vue +793 -0
- package/src/components/inputs/Tags/TagCreation.vue +219 -0
- package/src/components/inputs/Tags/TagPicker.vue +380 -0
- package/src/components/inputs/Tags/tag-bar-styles.ts +354 -0
- package/src/components/inputs/Tags/theme.css +121 -0
- package/src/components/inputs/Tags/types.ts +346 -0
- package/src/components/inputs/search/README.md +759 -0
- package/src/components/inputs/search/SearchBar.vue +394 -0
- package/src/components/inputs/search/SearchResults.vue +310 -0
- package/src/components/inputs/search/theme.css +187 -0
- package/src/components/inputs/search/types.ts +8 -0
- package/src/components/inputs/theme.css +102 -0
- package/src/components/menus/ActionMenu/ActionMenu.vue +383 -0
- package/src/components/menus/ActionMenu/README.md +825 -0
- package/src/components/menus/ActionMenu/theme.css +93 -0
- package/src/components/models/Popover/Popover.vue +551 -0
- package/src/components/models/Popover/README.md +885 -0
- package/src/components/models/Popover/theme.css +52 -0
- package/src/components/models/Sheet/README.md +1159 -0
- package/src/components/models/Sheet/Sheet.vue +465 -0
- package/src/components/models/Sheet/theme.css +72 -0
- package/src/components/models/Sidebar/README.md +1228 -0
- package/src/components/models/Sidebar/Sidebar.vue +480 -0
- package/src/components/models/Sidebar/theme.css +90 -0
- package/src/components/navigation/adaptive/AdaptiveLayout.vue +779 -0
- package/src/components/navigation/adaptive/AdaptiveLayoutBreadcrumbs.vue +192 -0
- package/src/components/navigation/adaptive/AdaptiveLayoutMenuButton.vue +149 -0
- package/src/components/navigation/adaptive/README.md +768 -0
- package/src/components/navigation/adaptive/types.ts +19 -0
- package/src/components/navigation/adaptive/useAdaptiveLayout.ts +89 -0
- package/src/components/navigation/adaptive/useBreakpoints.ts +41 -0
- package/src/components/navigation/adaptive/useContainerMonitor.ts +214 -0
- package/src/components/navigation/adaptive/useViewAnimation.ts +721 -0
- package/src/components/navigation/adaptive/useViewResize.ts +211 -0
- package/src/components/navigation/navstack/NavigationStack.vue +180 -0
- package/src/components/navigation/navstack/README.md +994 -0
- package/src/components/navigation/navstack/useNavigationStack.ts +164 -0
- package/src/components/navigation/slideover/README.md +1275 -0
- package/src/components/navigation/slideover/SlideoverController.vue +287 -0
- package/src/components/navigation/slideover/useSlideoverController.ts +320 -0
- package/src/components/navigation/splitview/README.md +1115 -0
- package/src/components/navigation/splitview/SplitViewController.vue +176 -0
- package/src/components/navigation/splitview/useSplitViewController.ts +388 -0
- package/src/components/navigation/tabcontroller/README.md +919 -0
- package/src/components/navigation/tabcontroller/TabController.vue +307 -0
- package/src/components/navigation/tabcontroller/TabItem.vue +57 -0
- package/src/components/navigation/tabcontroller/types.ts +24 -0
- package/src/components/navigation/tabcontroller/useTabController.ts +18 -0
- package/src/components/navigation/theme.css +91 -0
- package/src/components/navigation/types.ts +7 -0
- package/src/components/pickers/CollectionPicker/CollectionPicker.vue +398 -0
- package/src/components/pickers/CollectionPicker/README.md +1115 -0
- package/src/components/pickers/CollectionPicker/theme.css +14 -0
- package/src/components/pickers/CollectionPicker/types.ts +11 -0
- package/src/components/pickers/ColorPicker/ColorPicker.vue +376 -0
- package/src/components/pickers/ColorPicker/README.md +1439 -0
- package/src/components/pickers/ColorPicker/colors.ts +299 -0
- package/src/components/pickers/ColorPicker/theme.css +32 -0
- package/src/components/pickers/DatePicker/DatePicker.vue +660 -0
- package/src/components/pickers/DatePicker/README.md +1195 -0
- package/src/components/pickers/DatePicker/theme.css +22 -0
- package/src/components/pickers/FilePicker/FilePicker.vue +534 -0
- package/src/components/pickers/FilePicker/README.md +1542 -0
- package/src/components/pickers/FilePicker/theme.css +48 -0
- package/src/components/pickers/FilePicker/types.ts +10 -0
- package/src/components/pickers/IconPicker/IconPicker.vue +327 -0
- package/src/components/pickers/IconPicker/README.md +1161 -0
- package/src/components/pickers/IconPicker/theme.css +28 -0
- package/src/components/pickers/theme.css +82 -0
- package/src/components/views/MarkdownViewer/MarkdownViewer.vue +442 -0
- package/src/components/views/MarkdownViewer/README.md +833 -0
- package/src/components/views/MarkdownViewer/theme.css +130 -0
- package/src/index.ts +263 -0
- package/src/theme.ts +378 -0
- package/src/themes/crimson-dark.ts +556 -0
- package/src/themes/cyan-light.ts +556 -0
- package/src/themes/dark.ts +557 -0
- package/src/themes/gold-dark.ts +556 -0
- package/src/themes/grass-dark.ts +556 -0
- package/src/themes/indigo.ts +556 -0
- package/src/themes/light.ts +557 -0
- package/src/themes/orange-dark.ts +557 -0
- package/src/themes/orange-light.ts +557 -0
- package/src/vue.d.ts +45 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import "./theme.css";
|
|
2
|
+
// Base style templates for tag bar types
|
|
3
|
+
const baseStyles = {
|
|
4
|
+
default: {
|
|
5
|
+
borderRadius: "0.471rem",
|
|
6
|
+
boxShadow: "none",
|
|
7
|
+
border: "none",
|
|
8
|
+
padding: "0",
|
|
9
|
+
},
|
|
10
|
+
outline: {
|
|
11
|
+
backgroundColor: "transparent",
|
|
12
|
+
borderRadius: "0.471rem",
|
|
13
|
+
boxShadow: "none",
|
|
14
|
+
padding: "0",
|
|
15
|
+
},
|
|
16
|
+
capsule: {
|
|
17
|
+
borderRadius: "999px",
|
|
18
|
+
boxShadow: "none",
|
|
19
|
+
border: "none",
|
|
20
|
+
padding: "0",
|
|
21
|
+
},
|
|
22
|
+
capline: {
|
|
23
|
+
backgroundColor: "transparent",
|
|
24
|
+
borderRadius: "999px",
|
|
25
|
+
boxShadow: "none",
|
|
26
|
+
padding: "0",
|
|
27
|
+
},
|
|
28
|
+
plain: {
|
|
29
|
+
backgroundColor: "transparent",
|
|
30
|
+
borderRadius: "0",
|
|
31
|
+
boxShadow: "none",
|
|
32
|
+
border: "none",
|
|
33
|
+
padding: "0",
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
// Predefined color schemes
|
|
37
|
+
const colorSchemes = {
|
|
38
|
+
primary: {
|
|
39
|
+
default: { backgroundColor: "var(--tagbar-primary-default-bg)" },
|
|
40
|
+
outline: { color: "var(--tagbar-primary-outline-color)" },
|
|
41
|
+
capsule: { backgroundColor: "var(--tagbar-primary-capsule-bg)" },
|
|
42
|
+
capline: { color: "var(--tagbar-primary-capline-color)" },
|
|
43
|
+
plain: { backgroundColor: "var(--tagbar-primary-plain-bg)" },
|
|
44
|
+
},
|
|
45
|
+
secondary: {
|
|
46
|
+
default: { backgroundColor: "var(--tagbar-secondary-default-bg)" },
|
|
47
|
+
outline: { color: "var(--tagbar-secondary-outline-color)" },
|
|
48
|
+
capsule: { backgroundColor: "var(--tagbar-secondary-capsule-bg)" },
|
|
49
|
+
capline: { color: "var(--tagbar-secondary-capline-color)" },
|
|
50
|
+
plain: { backgroundColor: "var(--tagbar-secondary-plain-bg)" },
|
|
51
|
+
},
|
|
52
|
+
tertiary: {
|
|
53
|
+
default: { backgroundColor: "var(--tagbar-tertiary-default-bg)" },
|
|
54
|
+
outline: { color: "var(--tagbar-tertiary-outline-color)" },
|
|
55
|
+
capsule: { backgroundColor: "var(--tagbar-tertiary-capsule-bg)" },
|
|
56
|
+
capline: { color: "var(--tagbar-tertiary-capline-color)" },
|
|
57
|
+
plain: { backgroundColor: "var(--tagbar-tertiary-plain-bg)" },
|
|
58
|
+
},
|
|
59
|
+
quaternary: {
|
|
60
|
+
default: { backgroundColor: "var(--tagbar-quaternary-default-bg)" },
|
|
61
|
+
outline: { color: "var(--tagbar-quaternary-outline-color)" },
|
|
62
|
+
capsule: { backgroundColor: "var(--tagbar-quaternary-capsule-bg)" },
|
|
63
|
+
capline: { color: "var(--tagbar-quaternary-capline-color)" },
|
|
64
|
+
plain: { backgroundColor: "var(--tagbar-quaternary-plain-bg)" },
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
// Helper functions for color manipulation
|
|
68
|
+
const hexToRgb = (hex) => {
|
|
69
|
+
hex = hex.replace(/^#/, "");
|
|
70
|
+
if (hex.length === 3) {
|
|
71
|
+
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
72
|
+
}
|
|
73
|
+
const result = /^([a-fA-F\d]{2})([a-fA-F\d]{2})([a-fA-F\d]{2})$/i.exec(hex);
|
|
74
|
+
return result
|
|
75
|
+
? {
|
|
76
|
+
r: parseInt(result[1], 16),
|
|
77
|
+
g: parseInt(result[2], 16),
|
|
78
|
+
b: parseInt(result[3], 16),
|
|
79
|
+
}
|
|
80
|
+
: null;
|
|
81
|
+
};
|
|
82
|
+
const rgbToHsl = (r, g, b) => {
|
|
83
|
+
r /= 255;
|
|
84
|
+
g /= 255;
|
|
85
|
+
b /= 255;
|
|
86
|
+
const max = Math.max(r, g, b);
|
|
87
|
+
const min = Math.min(r, g, b);
|
|
88
|
+
let h = 0;
|
|
89
|
+
let s = 0;
|
|
90
|
+
const l = (max + min) / 2;
|
|
91
|
+
if (max !== min) {
|
|
92
|
+
const d = max - min;
|
|
93
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
94
|
+
switch (max) {
|
|
95
|
+
case r:
|
|
96
|
+
h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
97
|
+
break;
|
|
98
|
+
case g:
|
|
99
|
+
h = ((b - r) / d + 2) / 6;
|
|
100
|
+
break;
|
|
101
|
+
case b:
|
|
102
|
+
h = ((r - g) / d + 4) / 6;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { h: h * 360, s: s * 100, l: l * 100 };
|
|
107
|
+
};
|
|
108
|
+
const hslToRgb = (h, s, l) => {
|
|
109
|
+
h /= 360;
|
|
110
|
+
s /= 100;
|
|
111
|
+
l /= 100;
|
|
112
|
+
let r, g, b;
|
|
113
|
+
if (s === 0) {
|
|
114
|
+
r = g = b = l;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
const hue2rgb = (p, q, t) => {
|
|
118
|
+
if (t < 0)
|
|
119
|
+
t += 1;
|
|
120
|
+
if (t > 1)
|
|
121
|
+
t -= 1;
|
|
122
|
+
if (t < 1 / 6)
|
|
123
|
+
return p + (q - p) * 6 * t;
|
|
124
|
+
if (t < 1 / 2)
|
|
125
|
+
return q;
|
|
126
|
+
if (t < 2 / 3)
|
|
127
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
128
|
+
return p;
|
|
129
|
+
};
|
|
130
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
131
|
+
const p = 2 * l - q;
|
|
132
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
133
|
+
g = hue2rgb(p, q, h);
|
|
134
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
r: Math.round(r * 255),
|
|
138
|
+
g: Math.round(g * 255),
|
|
139
|
+
b: Math.round(b * 255),
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
// Helper function to lighten colors (for tag bar we want lighter backgrounds)
|
|
143
|
+
const lightenColor = (color, amount = 0.85) => {
|
|
144
|
+
// Handle CSS variables
|
|
145
|
+
if (color.startsWith("var(")) {
|
|
146
|
+
const match = color.match(/var\((--[^)]+)\)/);
|
|
147
|
+
if (!match)
|
|
148
|
+
return color;
|
|
149
|
+
const propertyName = match[1];
|
|
150
|
+
let computedValue = getComputedStyle(document.documentElement)
|
|
151
|
+
.getPropertyValue(propertyName)
|
|
152
|
+
.trim();
|
|
153
|
+
// Resolve nested variables
|
|
154
|
+
while (computedValue.startsWith("var(")) {
|
|
155
|
+
const nestedMatch = computedValue.match(/var\((--[^)]+)\)/);
|
|
156
|
+
if (!nestedMatch)
|
|
157
|
+
break;
|
|
158
|
+
computedValue = getComputedStyle(document.documentElement)
|
|
159
|
+
.getPropertyValue(nestedMatch[1])
|
|
160
|
+
.trim();
|
|
161
|
+
}
|
|
162
|
+
if (computedValue.startsWith("#")) {
|
|
163
|
+
color = computedValue;
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
return color; // Can't process non-hex computed values
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const rgb = hexToRgb(color);
|
|
170
|
+
if (!rgb)
|
|
171
|
+
return color;
|
|
172
|
+
const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);
|
|
173
|
+
// Lighten by increasing the lightness
|
|
174
|
+
hsl.l = Math.min(100, hsl.l + (100 - hsl.l) * amount);
|
|
175
|
+
// Reduce saturation for very light colors
|
|
176
|
+
hsl.s = Math.max(0, hsl.s * (1 - amount * 0.5));
|
|
177
|
+
const newRgb = hslToRgb(hsl.h, hsl.s, hsl.l);
|
|
178
|
+
const toHex = (n) => {
|
|
179
|
+
const hex = Math.round(n).toString(16);
|
|
180
|
+
return hex.length === 1 ? "0" + hex : hex;
|
|
181
|
+
};
|
|
182
|
+
return `#${toHex(newRgb.r)}${toHex(newRgb.g)}${toHex(newRgb.b)}`;
|
|
183
|
+
};
|
|
184
|
+
// Helper function to darken colors
|
|
185
|
+
const darkenColor = (color, amount = 0.25) => {
|
|
186
|
+
// Handle CSS variables
|
|
187
|
+
if (color.startsWith("var(")) {
|
|
188
|
+
const match = color.match(/var\((--[^)]+)\)/);
|
|
189
|
+
if (!match)
|
|
190
|
+
return color;
|
|
191
|
+
const propertyName = match[1];
|
|
192
|
+
let computedValue = getComputedStyle(document.documentElement)
|
|
193
|
+
.getPropertyValue(propertyName)
|
|
194
|
+
.trim();
|
|
195
|
+
// Resolve nested variables
|
|
196
|
+
while (computedValue.startsWith("var(")) {
|
|
197
|
+
const nestedMatch = computedValue.match(/var\((--[^)]+)\)/);
|
|
198
|
+
if (!nestedMatch)
|
|
199
|
+
break;
|
|
200
|
+
computedValue = getComputedStyle(document.documentElement)
|
|
201
|
+
.getPropertyValue(nestedMatch[1])
|
|
202
|
+
.trim();
|
|
203
|
+
}
|
|
204
|
+
if (computedValue.startsWith("#")) {
|
|
205
|
+
color = computedValue;
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
return color; // Can't process non-hex computed values
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const rgb = hexToRgb(color);
|
|
212
|
+
if (!rgb)
|
|
213
|
+
return color;
|
|
214
|
+
const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);
|
|
215
|
+
hsl.l = Math.max(0, hsl.l - hsl.l * amount);
|
|
216
|
+
hsl.s = Math.max(0, hsl.s - hsl.s * 0.1);
|
|
217
|
+
const newRgb = hslToRgb(hsl.h, hsl.s, hsl.l);
|
|
218
|
+
const toHex = (n) => {
|
|
219
|
+
const hex = Math.round(n).toString(16);
|
|
220
|
+
return hex.length === 1 ? "0" + hex : hex;
|
|
221
|
+
};
|
|
222
|
+
return `#${toHex(newRgb.r)}${toHex(newRgb.g)}${toHex(newRgb.b)}`;
|
|
223
|
+
};
|
|
224
|
+
// Check if it's a custom color
|
|
225
|
+
const isCustomColor = (barStyle) => {
|
|
226
|
+
if (!barStyle)
|
|
227
|
+
return false;
|
|
228
|
+
const predefinedStyles = ["primary", "secondary", "tertiary", "quaternary"];
|
|
229
|
+
return !predefinedStyles.includes(barStyle);
|
|
230
|
+
};
|
|
231
|
+
// Generate style for custom colors
|
|
232
|
+
const generateCustomColorStyle = (barType, customColor) => {
|
|
233
|
+
const baseStyle = baseStyles[barType] || baseStyles.default;
|
|
234
|
+
switch (barType) {
|
|
235
|
+
case "outline":
|
|
236
|
+
case "capline":
|
|
237
|
+
return {
|
|
238
|
+
...baseStyle,
|
|
239
|
+
backgroundColor: "transparent",
|
|
240
|
+
border: `1px solid ${customColor}`,
|
|
241
|
+
buttonColor: customColor,
|
|
242
|
+
textColor: customColor,
|
|
243
|
+
};
|
|
244
|
+
case "plain":
|
|
245
|
+
return {
|
|
246
|
+
...baseStyle,
|
|
247
|
+
backgroundColor: "transparent",
|
|
248
|
+
buttonColor: customColor,
|
|
249
|
+
textColor: customColor,
|
|
250
|
+
};
|
|
251
|
+
case "capsule":
|
|
252
|
+
case "default":
|
|
253
|
+
default:
|
|
254
|
+
const lightenedColor = darkenColor(customColor, 0.8);
|
|
255
|
+
return {
|
|
256
|
+
...baseStyle,
|
|
257
|
+
backgroundColor: lightenedColor,
|
|
258
|
+
buttonColor: "#eeeeee",
|
|
259
|
+
textColor: "#b4b4b4",
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
// Main function to get tag bar style
|
|
264
|
+
const getTagBarStyle = (type = "default", style = "primary") => {
|
|
265
|
+
// Handle custom colors
|
|
266
|
+
if (isCustomColor(style)) {
|
|
267
|
+
return generateCustomColorStyle(type, style);
|
|
268
|
+
}
|
|
269
|
+
// Handle predefined styles
|
|
270
|
+
const colorScheme = colorSchemes[style];
|
|
271
|
+
const baseStyle = baseStyles[type];
|
|
272
|
+
if (!colorScheme || !baseStyle) {
|
|
273
|
+
// Fallback to default
|
|
274
|
+
return getTagBarStyle("default", "primary");
|
|
275
|
+
}
|
|
276
|
+
const typeColors = colorScheme[type];
|
|
277
|
+
// Build the complete style based on type
|
|
278
|
+
if (type === "outline" || type === "capline") {
|
|
279
|
+
const color = typeColors.color;
|
|
280
|
+
return {
|
|
281
|
+
...baseStyle,
|
|
282
|
+
backgroundColor: "transparent",
|
|
283
|
+
border: `1px solid ${color}`,
|
|
284
|
+
buttonColor: color,
|
|
285
|
+
textColor: color,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
else if (type === "plain") {
|
|
289
|
+
// For plain type, use the corresponding text color variable
|
|
290
|
+
let textColor = "#eeeeee";
|
|
291
|
+
if (style === "secondary")
|
|
292
|
+
textColor = "#eeeeee";
|
|
293
|
+
else if (style === "tertiary")
|
|
294
|
+
textColor = "#b4b4b4";
|
|
295
|
+
return {
|
|
296
|
+
...baseStyle,
|
|
297
|
+
buttonColor: textColor,
|
|
298
|
+
textColor: textColor,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
// default or capsule
|
|
303
|
+
const { backgroundColor } = typeColors;
|
|
304
|
+
return {
|
|
305
|
+
...baseStyle,
|
|
306
|
+
backgroundColor,
|
|
307
|
+
buttonColor: "#FFFFFF",
|
|
308
|
+
textColor: "#FFFFFF",
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
// Export for use in your component
|
|
313
|
+
export { getTagBarStyle, isCustomColor };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export interface TagItem {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
style?: TagStyleConfig;
|
|
5
|
+
}
|
|
6
|
+
export interface TagStyleConfig {
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
color?: string;
|
|
9
|
+
border?: string;
|
|
10
|
+
borderRadius?: string;
|
|
11
|
+
padding?: string;
|
|
12
|
+
fontSize?: string;
|
|
13
|
+
fontWeight?: string;
|
|
14
|
+
boxShadow?: string;
|
|
15
|
+
hover?: {
|
|
16
|
+
backgroundColor?: string;
|
|
17
|
+
color?: string;
|
|
18
|
+
border?: string;
|
|
19
|
+
transform?: string;
|
|
20
|
+
boxShadow?: string;
|
|
21
|
+
};
|
|
22
|
+
size?: TagSize;
|
|
23
|
+
colorScheme?: ColorScheme;
|
|
24
|
+
}
|
|
25
|
+
export type TagSize = "sm" | "md" | "lg";
|
|
26
|
+
export type ColorScheme = SolidColorName | string;
|
|
27
|
+
export type SolidColorName = "gray" | "mauve" | "slate" | "sage" | "olive" | "sand" | "tomato" | "red" | "ruby" | "crimson" | "pink" | "plum" | "purple" | "violet" | "iris" | "indigo" | "blue" | "cyan" | "teal" | "jade" | "green" | "grass" | "bronze" | "gold" | "brown" | "orange" | "amber" | "yellow" | "lime" | "mint" | "sky";
|
|
28
|
+
export interface TagStyle {
|
|
29
|
+
container: {
|
|
30
|
+
backgroundColor: string;
|
|
31
|
+
color: string;
|
|
32
|
+
border: string;
|
|
33
|
+
borderRadius: string;
|
|
34
|
+
padding: string;
|
|
35
|
+
fontSize?: string;
|
|
36
|
+
fontWeight?: string;
|
|
37
|
+
boxShadow?: string;
|
|
38
|
+
};
|
|
39
|
+
hover?: {
|
|
40
|
+
backgroundColor?: string;
|
|
41
|
+
color?: string;
|
|
42
|
+
border?: string;
|
|
43
|
+
transform?: string;
|
|
44
|
+
boxShadow?: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export interface TagData {
|
|
48
|
+
query: string;
|
|
49
|
+
allTags: TagItem[];
|
|
50
|
+
selectedTags: TagItem[];
|
|
51
|
+
matchIndex: number;
|
|
52
|
+
}
|
|
53
|
+
export declare const getColorMode: () => "light" | "dark";
|
|
54
|
+
export declare const generateTagStyle: (config?: TagStyleConfig) => TagStyle;
|
|
55
|
+
export declare const createStyledTag: (id: string, title: string, styleConfig?: TagStyleConfig) => TagItem;
|
|
56
|
+
export declare const COLOR_PRESETS: {
|
|
57
|
+
readonly primary: "blue";
|
|
58
|
+
readonly success: "green";
|
|
59
|
+
readonly warning: "amber";
|
|
60
|
+
readonly danger: "red";
|
|
61
|
+
readonly info: "cyan";
|
|
62
|
+
readonly neutral: "gray";
|
|
63
|
+
};
|
|
64
|
+
export declare const TAG_STYLE_PRESETS: {
|
|
65
|
+
readonly default: {
|
|
66
|
+
readonly borderRadius: "999px";
|
|
67
|
+
readonly padding: "0.235rem 0.588rem";
|
|
68
|
+
};
|
|
69
|
+
readonly rounded: {
|
|
70
|
+
readonly borderRadius: "0.375rem";
|
|
71
|
+
readonly padding: "0.235rem 0.588rem";
|
|
72
|
+
};
|
|
73
|
+
readonly square: {
|
|
74
|
+
readonly borderRadius: "0";
|
|
75
|
+
readonly padding: "0.235rem 0.588rem";
|
|
76
|
+
};
|
|
77
|
+
readonly pill: {
|
|
78
|
+
readonly borderRadius: "999px";
|
|
79
|
+
readonly padding: "0.25rem 0.75rem";
|
|
80
|
+
};
|
|
81
|
+
readonly minimal: {
|
|
82
|
+
readonly backgroundColor: "transparent";
|
|
83
|
+
readonly border: "none";
|
|
84
|
+
readonly padding: "0.125rem 0.375rem";
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
export declare class TagTheme {
|
|
88
|
+
private defaultStyle;
|
|
89
|
+
constructor(defaultStyle?: TagStyleConfig);
|
|
90
|
+
generateStyle(overrides?: TagStyleConfig): TagStyle;
|
|
91
|
+
createTag(id: string, title: string, overrides?: TagStyleConfig): TagItem;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/Tags/types.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAGD,MAAM,WAAW,cAAc;IAE7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,KAAK,CAAC,EAAE;QACN,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAGF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,MAAM,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACzC,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,MAAM,CAAC;AAElD,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,GACN,OAAO,GACP,MAAM,GACN,QAAQ,GACR,KAAK,GACL,MAAM,GACN,SAAS,GACT,MAAM,GACN,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,MAAM,GACN,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,MAAM,GACN,MAAM,GACN,KAAK,CAAC;AAGV,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE;QACT,eAAe,EAAE,MAAM,CAAC;QACxB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,KAAK,CAAC,EAAE;QACN,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAGD,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,YAAY,EAAE,OAAO,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AAGD,eAAO,MAAM,YAAY,QAAO,OAAO,GAAG,MAWzC,CAAC;AAgIF,eAAO,MAAM,gBAAgB,GAAI,SAAQ,cAAmB,KAAG,QAsC9D,CAAC;AAGF,eAAO,MAAM,eAAe,GAC1B,IAAI,MAAM,EACV,OAAO,MAAM,EACb,cAAc,cAAc,KAC3B,OAID,CAAC;AAGH,eAAO,MAAM,aAAa;;;;;;;CAOhB,CAAC;AAGX,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;CAsBpB,CAAC;AAGX,qBAAa,QAAQ;IACnB,OAAO,CAAC,YAAY,CAAiB;gBAEzB,YAAY,GAAE,cAAmB;IAI7C,aAAa,CAAC,SAAS,CAAC,EAAE,cAAc,GAAG,QAAQ;IAKnD,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,cAAc,GAAG,OAAO;CAG1E"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import tinycolor from "tinycolor2";
|
|
2
|
+
import * as colors from "@umbra-ui/colors";
|
|
3
|
+
import { getThemeConfig } from "../../../theme";
|
|
4
|
+
// Color mode detection function that uses theme or falls back to system
|
|
5
|
+
export const getColorMode = () => {
|
|
6
|
+
const config = getThemeConfig();
|
|
7
|
+
// If a theme is provided, use its color mode
|
|
8
|
+
if (config?.customThemeColorMode) {
|
|
9
|
+
return config.customThemeColorMode;
|
|
10
|
+
}
|
|
11
|
+
// Otherwise fall back to system preference
|
|
12
|
+
return window.matchMedia?.("(prefers-color-scheme: dark)").matches
|
|
13
|
+
? "dark"
|
|
14
|
+
: "light";
|
|
15
|
+
};
|
|
16
|
+
// Size presets
|
|
17
|
+
const SIZE_PRESETS = {
|
|
18
|
+
sm: { padding: "0.125rem 0.375rem", fontSize: "0.75rem" },
|
|
19
|
+
md: { padding: "0.235rem 0.588rem", fontSize: "0.875rem" },
|
|
20
|
+
lg: { padding: "0.375rem 0.75rem", fontSize: "1rem" },
|
|
21
|
+
};
|
|
22
|
+
// Helper to get Radix colors based on color mode
|
|
23
|
+
const getRadixColor = (colorName, step, alpha = false) => {
|
|
24
|
+
const isDark = getColorMode() === "dark";
|
|
25
|
+
const colorKey = isDark ? `${colorName}Dark` : colorName;
|
|
26
|
+
const alphaKey = alpha ? "A" : "";
|
|
27
|
+
const colorScale = colors[`${colorKey}${alphaKey}`];
|
|
28
|
+
if (!colorScale) {
|
|
29
|
+
console.warn(`Color scale ${colorKey}${alphaKey} not found`);
|
|
30
|
+
return "#808080";
|
|
31
|
+
}
|
|
32
|
+
const stepKey = `${colorName}${alphaKey}${step}`;
|
|
33
|
+
return colorScale[stepKey] || "#808080";
|
|
34
|
+
};
|
|
35
|
+
// Check if a string is a valid Radix color name
|
|
36
|
+
const isRadixColor = (color) => {
|
|
37
|
+
const radixColors = [
|
|
38
|
+
"gray",
|
|
39
|
+
"mauve",
|
|
40
|
+
"slate",
|
|
41
|
+
"sage",
|
|
42
|
+
"olive",
|
|
43
|
+
"sand",
|
|
44
|
+
"tomato",
|
|
45
|
+
"red",
|
|
46
|
+
"ruby",
|
|
47
|
+
"crimson",
|
|
48
|
+
"pink",
|
|
49
|
+
"plum",
|
|
50
|
+
"purple",
|
|
51
|
+
"violet",
|
|
52
|
+
"iris",
|
|
53
|
+
"indigo",
|
|
54
|
+
"blue",
|
|
55
|
+
"cyan",
|
|
56
|
+
"teal",
|
|
57
|
+
"jade",
|
|
58
|
+
"green",
|
|
59
|
+
"grass",
|
|
60
|
+
"bronze",
|
|
61
|
+
"gold",
|
|
62
|
+
"brown",
|
|
63
|
+
"orange",
|
|
64
|
+
"amber",
|
|
65
|
+
"yellow",
|
|
66
|
+
"lime",
|
|
67
|
+
"mint",
|
|
68
|
+
"sky",
|
|
69
|
+
];
|
|
70
|
+
return radixColors.includes(color);
|
|
71
|
+
};
|
|
72
|
+
// Default style values
|
|
73
|
+
const DEFAULT_STYLE = {
|
|
74
|
+
container: {
|
|
75
|
+
backgroundColor: "var(--default-tag-background-color)",
|
|
76
|
+
color: "var(--default-tag-color)",
|
|
77
|
+
border: "1px solid var(--default-tag-border)",
|
|
78
|
+
borderRadius: "var(--default-tag-border-radius)",
|
|
79
|
+
padding: "var(--default-tag-padding)",
|
|
80
|
+
fontSize: "var(--default-tag-font-size)",
|
|
81
|
+
fontWeight: "var(--default-tag-font-weight)",
|
|
82
|
+
},
|
|
83
|
+
hover: {
|
|
84
|
+
backgroundColor: "var(--default-tag-hover-background-color)",
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
// Generate default style from color scheme
|
|
88
|
+
const generateDefaultStyleFromColor = (colorScheme) => {
|
|
89
|
+
if (isRadixColor(colorScheme)) {
|
|
90
|
+
// Use Radix color scale
|
|
91
|
+
return {
|
|
92
|
+
container: {
|
|
93
|
+
backgroundColor: getRadixColor(colorScheme, 5, true),
|
|
94
|
+
color: getRadixColor(colorScheme, 11),
|
|
95
|
+
border: `1px solid ${getRadixColor(colorScheme, 7)}`,
|
|
96
|
+
borderRadius: "0.375rem",
|
|
97
|
+
padding: SIZE_PRESETS.md.padding,
|
|
98
|
+
fontSize: SIZE_PRESETS.md.fontSize,
|
|
99
|
+
},
|
|
100
|
+
hover: {
|
|
101
|
+
backgroundColor: getRadixColor(colorScheme, 5, true),
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
// Use custom hex color
|
|
107
|
+
const baseColor = tinycolor(colorScheme);
|
|
108
|
+
const isDark = getColorMode() === "dark";
|
|
109
|
+
return {
|
|
110
|
+
container: {
|
|
111
|
+
backgroundColor: isDark
|
|
112
|
+
? baseColor.setAlpha(0.2).toRgbString()
|
|
113
|
+
: baseColor.setAlpha(0.15).toRgbString(),
|
|
114
|
+
color: isDark
|
|
115
|
+
? baseColor.lighten(20).toHexString()
|
|
116
|
+
: baseColor.darken(20).toHexString(),
|
|
117
|
+
border: `1px solid ${baseColor.setAlpha(0.3).toRgbString()}`,
|
|
118
|
+
borderRadius: "0.375rem",
|
|
119
|
+
padding: SIZE_PRESETS.md.padding,
|
|
120
|
+
fontSize: SIZE_PRESETS.md.fontSize,
|
|
121
|
+
},
|
|
122
|
+
hover: {
|
|
123
|
+
backgroundColor: isDark
|
|
124
|
+
? baseColor.setAlpha(0.3).toRgbString()
|
|
125
|
+
: baseColor.setAlpha(0.25).toRgbString(),
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
// Main style generation function - much simpler!
|
|
131
|
+
export const generateTagStyle = (config = {}) => {
|
|
132
|
+
let baseStyle = { ...DEFAULT_STYLE };
|
|
133
|
+
// If a color scheme is provided, generate default colors from it
|
|
134
|
+
if (config.colorScheme) {
|
|
135
|
+
baseStyle = generateDefaultStyleFromColor(config.colorScheme);
|
|
136
|
+
}
|
|
137
|
+
// Apply size preset if provided
|
|
138
|
+
if (config.size) {
|
|
139
|
+
const sizeConfig = SIZE_PRESETS[config.size];
|
|
140
|
+
baseStyle.container.padding = sizeConfig.padding;
|
|
141
|
+
baseStyle.container.fontSize = sizeConfig.fontSize;
|
|
142
|
+
}
|
|
143
|
+
// Direct CSS property overrides - these take precedence
|
|
144
|
+
const style = {
|
|
145
|
+
container: {
|
|
146
|
+
...baseStyle.container,
|
|
147
|
+
backgroundColor: config.backgroundColor ?? baseStyle.container.backgroundColor,
|
|
148
|
+
color: config.color ?? baseStyle.container.color,
|
|
149
|
+
border: config.border ?? baseStyle.container.border,
|
|
150
|
+
borderRadius: config.borderRadius ?? baseStyle.container.borderRadius,
|
|
151
|
+
padding: config.padding ?? baseStyle.container.padding,
|
|
152
|
+
fontSize: config.fontSize ?? baseStyle.container.fontSize,
|
|
153
|
+
fontWeight: config.fontWeight ?? baseStyle.container.fontWeight,
|
|
154
|
+
boxShadow: config.boxShadow ?? baseStyle.container.boxShadow,
|
|
155
|
+
},
|
|
156
|
+
hover: config.hover
|
|
157
|
+
? {
|
|
158
|
+
...baseStyle.hover,
|
|
159
|
+
...config.hover,
|
|
160
|
+
}
|
|
161
|
+
: baseStyle.hover,
|
|
162
|
+
};
|
|
163
|
+
return style;
|
|
164
|
+
};
|
|
165
|
+
// Helper to create tag with style
|
|
166
|
+
export const createStyledTag = (id, title, styleConfig) => ({
|
|
167
|
+
id,
|
|
168
|
+
title,
|
|
169
|
+
style: styleConfig,
|
|
170
|
+
});
|
|
171
|
+
// Preset color schemes using Radix colors
|
|
172
|
+
export const COLOR_PRESETS = {
|
|
173
|
+
primary: "blue",
|
|
174
|
+
success: "green",
|
|
175
|
+
warning: "amber",
|
|
176
|
+
danger: "red",
|
|
177
|
+
info: "cyan",
|
|
178
|
+
neutral: "gray",
|
|
179
|
+
};
|
|
180
|
+
// Example preset styles that developers can use or override
|
|
181
|
+
export const TAG_STYLE_PRESETS = {
|
|
182
|
+
default: {
|
|
183
|
+
borderRadius: "999px",
|
|
184
|
+
padding: "0.235rem 0.588rem",
|
|
185
|
+
},
|
|
186
|
+
rounded: {
|
|
187
|
+
borderRadius: "0.375rem",
|
|
188
|
+
padding: "0.235rem 0.588rem",
|
|
189
|
+
},
|
|
190
|
+
square: {
|
|
191
|
+
borderRadius: "0",
|
|
192
|
+
padding: "0.235rem 0.588rem",
|
|
193
|
+
},
|
|
194
|
+
pill: {
|
|
195
|
+
borderRadius: "999px",
|
|
196
|
+
padding: "0.25rem 0.75rem",
|
|
197
|
+
},
|
|
198
|
+
minimal: {
|
|
199
|
+
backgroundColor: "transparent",
|
|
200
|
+
border: "none",
|
|
201
|
+
padding: "0.125rem 0.375rem",
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
// Utility class for managing tag themes (simplified)
|
|
205
|
+
export class TagTheme {
|
|
206
|
+
constructor(defaultStyle = {}) {
|
|
207
|
+
this.defaultStyle = defaultStyle;
|
|
208
|
+
}
|
|
209
|
+
generateStyle(overrides) {
|
|
210
|
+
return generateTagStyle({ ...this.defaultStyle, ...overrides });
|
|
211
|
+
}
|
|
212
|
+
// Create a tag with the theme's default style
|
|
213
|
+
createTag(id, title, overrides) {
|
|
214
|
+
return createStyledTag(id, title, { ...this.defaultStyle, ...overrides });
|
|
215
|
+
}
|
|
216
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/search/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Component, markRaw } from "vue";
|
|
2
|
+
export interface View {
|
|
3
|
+
id: string;
|
|
4
|
+
component: Component | ReturnType<typeof markRaw<Component>>;
|
|
5
|
+
props?: Record<string, unknown>;
|
|
6
|
+
minWidth?: number;
|
|
7
|
+
maxWidth?: number;
|
|
8
|
+
currentWidth?: number;
|
|
9
|
+
label?: string;
|
|
10
|
+
}
|
|
11
|
+
export type ViewLayout = "splitview" | "slideover" | "navstack" | "adaptive";
|
|
12
|
+
export type ViewLocation = "leading" | "trailing" | "onscreen" | "overlay";
|
|
13
|
+
export interface InternalView extends View {
|
|
14
|
+
location: ViewLocation;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/adaptive/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEzC,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAC;AAE7E,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;AAE3E,MAAM,WAAW,YAAa,SAAQ,IAAI;IACxC,QAAQ,EAAE,YAAY,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|