@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,354 @@
|
|
|
1
|
+
import "./theme.css";
|
|
2
|
+
|
|
3
|
+
interface TagBarStyle {
|
|
4
|
+
backgroundColor: string;
|
|
5
|
+
border: string;
|
|
6
|
+
borderRadius: string;
|
|
7
|
+
boxShadow: string;
|
|
8
|
+
padding: string;
|
|
9
|
+
buttonColor: string;
|
|
10
|
+
textColor: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Base style templates for tag bar types
|
|
14
|
+
const baseStyles = {
|
|
15
|
+
default: {
|
|
16
|
+
borderRadius: "0.471rem",
|
|
17
|
+
boxShadow: "none",
|
|
18
|
+
border: "none",
|
|
19
|
+
padding: "0",
|
|
20
|
+
},
|
|
21
|
+
outline: {
|
|
22
|
+
backgroundColor: "transparent",
|
|
23
|
+
borderRadius: "0.471rem",
|
|
24
|
+
boxShadow: "none",
|
|
25
|
+
padding: "0",
|
|
26
|
+
},
|
|
27
|
+
capsule: {
|
|
28
|
+
borderRadius: "999px",
|
|
29
|
+
boxShadow: "none",
|
|
30
|
+
border: "none",
|
|
31
|
+
padding: "0",
|
|
32
|
+
},
|
|
33
|
+
capline: {
|
|
34
|
+
backgroundColor: "transparent",
|
|
35
|
+
borderRadius: "999px",
|
|
36
|
+
boxShadow: "none",
|
|
37
|
+
padding: "0",
|
|
38
|
+
},
|
|
39
|
+
plain: {
|
|
40
|
+
backgroundColor: "transparent",
|
|
41
|
+
borderRadius: "0",
|
|
42
|
+
boxShadow: "none",
|
|
43
|
+
border: "none",
|
|
44
|
+
padding: "0",
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Predefined color schemes
|
|
49
|
+
const colorSchemes = {
|
|
50
|
+
primary: {
|
|
51
|
+
default: { backgroundColor: "var(--tagbar-primary-default-bg)" },
|
|
52
|
+
outline: { color: "var(--tagbar-primary-outline-color)" },
|
|
53
|
+
capsule: { backgroundColor: "var(--tagbar-primary-capsule-bg)" },
|
|
54
|
+
capline: { color: "var(--tagbar-primary-capline-color)" },
|
|
55
|
+
plain: { backgroundColor: "var(--tagbar-primary-plain-bg)" },
|
|
56
|
+
},
|
|
57
|
+
secondary: {
|
|
58
|
+
default: { backgroundColor: "var(--tagbar-secondary-default-bg)" },
|
|
59
|
+
outline: { color: "var(--tagbar-secondary-outline-color)" },
|
|
60
|
+
capsule: { backgroundColor: "var(--tagbar-secondary-capsule-bg)" },
|
|
61
|
+
capline: { color: "var(--tagbar-secondary-capline-color)" },
|
|
62
|
+
plain: { backgroundColor: "var(--tagbar-secondary-plain-bg)" },
|
|
63
|
+
},
|
|
64
|
+
tertiary: {
|
|
65
|
+
default: { backgroundColor: "var(--tagbar-tertiary-default-bg)" },
|
|
66
|
+
outline: { color: "var(--tagbar-tertiary-outline-color)" },
|
|
67
|
+
capsule: { backgroundColor: "var(--tagbar-tertiary-capsule-bg)" },
|
|
68
|
+
capline: { color: "var(--tagbar-tertiary-capline-color)" },
|
|
69
|
+
plain: { backgroundColor: "var(--tagbar-tertiary-plain-bg)" },
|
|
70
|
+
},
|
|
71
|
+
quaternary: {
|
|
72
|
+
default: { backgroundColor: "var(--tagbar-quaternary-default-bg)" },
|
|
73
|
+
outline: { color: "var(--tagbar-quaternary-outline-color)" },
|
|
74
|
+
capsule: { backgroundColor: "var(--tagbar-quaternary-capsule-bg)" },
|
|
75
|
+
capline: { color: "var(--tagbar-quaternary-capline-color)" },
|
|
76
|
+
plain: { backgroundColor: "var(--tagbar-quaternary-plain-bg)" },
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// Helper functions for color manipulation
|
|
81
|
+
const hexToRgb = (hex: string): { r: number; g: number; b: number } | null => {
|
|
82
|
+
hex = hex.replace(/^#/, "");
|
|
83
|
+
if (hex.length === 3) {
|
|
84
|
+
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
85
|
+
}
|
|
86
|
+
const result = /^([a-fA-F\d]{2})([a-fA-F\d]{2})([a-fA-F\d]{2})$/i.exec(hex);
|
|
87
|
+
return result
|
|
88
|
+
? {
|
|
89
|
+
r: parseInt(result[1], 16),
|
|
90
|
+
g: parseInt(result[2], 16),
|
|
91
|
+
b: parseInt(result[3], 16),
|
|
92
|
+
}
|
|
93
|
+
: null;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const rgbToHsl = (
|
|
97
|
+
r: number,
|
|
98
|
+
g: number,
|
|
99
|
+
b: number
|
|
100
|
+
): { h: number; s: number; l: number } => {
|
|
101
|
+
r /= 255;
|
|
102
|
+
g /= 255;
|
|
103
|
+
b /= 255;
|
|
104
|
+
const max = Math.max(r, g, b);
|
|
105
|
+
const min = Math.min(r, g, b);
|
|
106
|
+
let h = 0;
|
|
107
|
+
let s = 0;
|
|
108
|
+
const l = (max + min) / 2;
|
|
109
|
+
|
|
110
|
+
if (max !== min) {
|
|
111
|
+
const d = max - min;
|
|
112
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
113
|
+
switch (max) {
|
|
114
|
+
case r:
|
|
115
|
+
h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
116
|
+
break;
|
|
117
|
+
case g:
|
|
118
|
+
h = ((b - r) / d + 2) / 6;
|
|
119
|
+
break;
|
|
120
|
+
case b:
|
|
121
|
+
h = ((r - g) / d + 4) / 6;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return { h: h * 360, s: s * 100, l: l * 100 };
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const hslToRgb = (
|
|
129
|
+
h: number,
|
|
130
|
+
s: number,
|
|
131
|
+
l: number
|
|
132
|
+
): { r: number; g: number; b: number } => {
|
|
133
|
+
h /= 360;
|
|
134
|
+
s /= 100;
|
|
135
|
+
l /= 100;
|
|
136
|
+
let r, g, b;
|
|
137
|
+
|
|
138
|
+
if (s === 0) {
|
|
139
|
+
r = g = b = l;
|
|
140
|
+
} else {
|
|
141
|
+
const hue2rgb = (p: number, q: number, t: number): number => {
|
|
142
|
+
if (t < 0) t += 1;
|
|
143
|
+
if (t > 1) t -= 1;
|
|
144
|
+
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
145
|
+
if (t < 1 / 2) return q;
|
|
146
|
+
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
147
|
+
return p;
|
|
148
|
+
};
|
|
149
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
150
|
+
const p = 2 * l - q;
|
|
151
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
152
|
+
g = hue2rgb(p, q, h);
|
|
153
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
r: Math.round(r * 255),
|
|
157
|
+
g: Math.round(g * 255),
|
|
158
|
+
b: Math.round(b * 255),
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// Helper function to lighten colors (for tag bar we want lighter backgrounds)
|
|
163
|
+
const lightenColor = (color: string, amount: number = 0.85): string => {
|
|
164
|
+
// Handle CSS variables
|
|
165
|
+
if (color.startsWith("var(")) {
|
|
166
|
+
const match = color.match(/var\((--[^)]+)\)/);
|
|
167
|
+
if (!match) return color;
|
|
168
|
+
|
|
169
|
+
const propertyName = match[1];
|
|
170
|
+
let computedValue = getComputedStyle(document.documentElement)
|
|
171
|
+
.getPropertyValue(propertyName)
|
|
172
|
+
.trim();
|
|
173
|
+
|
|
174
|
+
// Resolve nested variables
|
|
175
|
+
while (computedValue.startsWith("var(")) {
|
|
176
|
+
const nestedMatch = computedValue.match(/var\((--[^)]+)\)/);
|
|
177
|
+
if (!nestedMatch) break;
|
|
178
|
+
computedValue = getComputedStyle(document.documentElement)
|
|
179
|
+
.getPropertyValue(nestedMatch[1])
|
|
180
|
+
.trim();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (computedValue.startsWith("#")) {
|
|
184
|
+
color = computedValue;
|
|
185
|
+
} else {
|
|
186
|
+
return color; // Can't process non-hex computed values
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const rgb = hexToRgb(color);
|
|
191
|
+
if (!rgb) return color;
|
|
192
|
+
|
|
193
|
+
const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);
|
|
194
|
+
// Lighten by increasing the lightness
|
|
195
|
+
hsl.l = Math.min(100, hsl.l + (100 - hsl.l) * amount);
|
|
196
|
+
// Reduce saturation for very light colors
|
|
197
|
+
hsl.s = Math.max(0, hsl.s * (1 - amount * 0.5));
|
|
198
|
+
|
|
199
|
+
const newRgb = hslToRgb(hsl.h, hsl.s, hsl.l);
|
|
200
|
+
const toHex = (n: number): string => {
|
|
201
|
+
const hex = Math.round(n).toString(16);
|
|
202
|
+
return hex.length === 1 ? "0" + hex : hex;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
return `#${toHex(newRgb.r)}${toHex(newRgb.g)}${toHex(newRgb.b)}`;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// Helper function to darken colors
|
|
209
|
+
const darkenColor = (color: string, amount: number = 0.25): string => {
|
|
210
|
+
// Handle CSS variables
|
|
211
|
+
if (color.startsWith("var(")) {
|
|
212
|
+
const match = color.match(/var\((--[^)]+)\)/);
|
|
213
|
+
if (!match) return color;
|
|
214
|
+
|
|
215
|
+
const propertyName = match[1];
|
|
216
|
+
let computedValue = getComputedStyle(document.documentElement)
|
|
217
|
+
.getPropertyValue(propertyName)
|
|
218
|
+
.trim();
|
|
219
|
+
|
|
220
|
+
// Resolve nested variables
|
|
221
|
+
while (computedValue.startsWith("var(")) {
|
|
222
|
+
const nestedMatch = computedValue.match(/var\((--[^)]+)\)/);
|
|
223
|
+
if (!nestedMatch) break;
|
|
224
|
+
computedValue = getComputedStyle(document.documentElement)
|
|
225
|
+
.getPropertyValue(nestedMatch[1])
|
|
226
|
+
.trim();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (computedValue.startsWith("#")) {
|
|
230
|
+
color = computedValue;
|
|
231
|
+
} else {
|
|
232
|
+
return color; // Can't process non-hex computed values
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const rgb = hexToRgb(color);
|
|
237
|
+
if (!rgb) return color;
|
|
238
|
+
|
|
239
|
+
const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);
|
|
240
|
+
hsl.l = Math.max(0, hsl.l - hsl.l * amount);
|
|
241
|
+
hsl.s = Math.max(0, hsl.s - hsl.s * 0.1);
|
|
242
|
+
|
|
243
|
+
const newRgb = hslToRgb(hsl.h, hsl.s, hsl.l);
|
|
244
|
+
const toHex = (n: number): string => {
|
|
245
|
+
const hex = Math.round(n).toString(16);
|
|
246
|
+
return hex.length === 1 ? "0" + hex : hex;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
return `#${toHex(newRgb.r)}${toHex(newRgb.g)}${toHex(newRgb.b)}`;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
// Check if it's a custom color
|
|
253
|
+
const isCustomColor = (barStyle: string | undefined): boolean => {
|
|
254
|
+
if (!barStyle) return false;
|
|
255
|
+
const predefinedStyles = ["primary", "secondary", "tertiary", "quaternary"];
|
|
256
|
+
return !predefinedStyles.includes(barStyle);
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
// Generate style for custom colors
|
|
260
|
+
const generateCustomColorStyle = (
|
|
261
|
+
barType: string,
|
|
262
|
+
customColor: string
|
|
263
|
+
): TagBarStyle => {
|
|
264
|
+
const baseStyle =
|
|
265
|
+
baseStyles[barType as keyof typeof baseStyles] || baseStyles.default;
|
|
266
|
+
|
|
267
|
+
switch (barType) {
|
|
268
|
+
case "outline":
|
|
269
|
+
case "capline":
|
|
270
|
+
return {
|
|
271
|
+
...baseStyle,
|
|
272
|
+
backgroundColor: "transparent",
|
|
273
|
+
border: `1px solid ${customColor}`,
|
|
274
|
+
buttonColor: customColor,
|
|
275
|
+
textColor: customColor,
|
|
276
|
+
} as TagBarStyle;
|
|
277
|
+
|
|
278
|
+
case "plain":
|
|
279
|
+
return {
|
|
280
|
+
...baseStyle,
|
|
281
|
+
backgroundColor: "transparent",
|
|
282
|
+
buttonColor: customColor,
|
|
283
|
+
textColor: customColor,
|
|
284
|
+
} as TagBarStyle;
|
|
285
|
+
|
|
286
|
+
case "capsule":
|
|
287
|
+
case "default":
|
|
288
|
+
default:
|
|
289
|
+
const lightenedColor = darkenColor(customColor, 0.8);
|
|
290
|
+
return {
|
|
291
|
+
...baseStyle,
|
|
292
|
+
backgroundColor: lightenedColor,
|
|
293
|
+
buttonColor: "#eeeeee",
|
|
294
|
+
textColor: "#b4b4b4",
|
|
295
|
+
} as TagBarStyle;
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// Main function to get tag bar style
|
|
300
|
+
const getTagBarStyle = (
|
|
301
|
+
type: string = "default",
|
|
302
|
+
style: string = "primary"
|
|
303
|
+
): TagBarStyle => {
|
|
304
|
+
// Handle custom colors
|
|
305
|
+
if (isCustomColor(style)) {
|
|
306
|
+
return generateCustomColorStyle(type, style);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// Handle predefined styles
|
|
310
|
+
const colorScheme = colorSchemes[style as keyof typeof colorSchemes];
|
|
311
|
+
const baseStyle = baseStyles[type as keyof typeof baseStyles];
|
|
312
|
+
|
|
313
|
+
if (!colorScheme || !baseStyle) {
|
|
314
|
+
// Fallback to default
|
|
315
|
+
return getTagBarStyle("default", "primary");
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const typeColors = colorScheme[type as keyof typeof colorScheme];
|
|
319
|
+
|
|
320
|
+
// Build the complete style based on type
|
|
321
|
+
if (type === "outline" || type === "capline") {
|
|
322
|
+
const color = (typeColors as any).color;
|
|
323
|
+
return {
|
|
324
|
+
...baseStyle,
|
|
325
|
+
backgroundColor: "transparent",
|
|
326
|
+
border: `1px solid ${color}`,
|
|
327
|
+
buttonColor: color,
|
|
328
|
+
textColor: color,
|
|
329
|
+
} as TagBarStyle;
|
|
330
|
+
} else if (type === "plain") {
|
|
331
|
+
// For plain type, use the corresponding text color variable
|
|
332
|
+
let textColor = "#eeeeee";
|
|
333
|
+
if (style === "secondary") textColor = "#eeeeee";
|
|
334
|
+
else if (style === "tertiary") textColor = "#b4b4b4";
|
|
335
|
+
|
|
336
|
+
return {
|
|
337
|
+
...baseStyle,
|
|
338
|
+
buttonColor: textColor,
|
|
339
|
+
textColor: textColor,
|
|
340
|
+
} as TagBarStyle;
|
|
341
|
+
} else {
|
|
342
|
+
// default or capsule
|
|
343
|
+
const { backgroundColor } = typeColors as any;
|
|
344
|
+
return {
|
|
345
|
+
...baseStyle,
|
|
346
|
+
backgroundColor,
|
|
347
|
+
buttonColor: "#FFFFFF",
|
|
348
|
+
textColor: "#FFFFFF",
|
|
349
|
+
} as TagBarStyle;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
// Export for use in your component
|
|
354
|
+
export { getTagBarStyle, isCustomColor, type TagBarStyle };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* Light theme using simplified variables */
|
|
2
|
+
:root {
|
|
3
|
+
/* TagBar colors */
|
|
4
|
+
--tagbar-bg: #ffffff; /* gray1 - light background */
|
|
5
|
+
--tagbar-text: #646464; /* white - text color */
|
|
6
|
+
--tagbar-border: 1px solid #d9d9d9; /* gray1 - field background */
|
|
7
|
+
--tagbar-field-bg: #e8e8e8; /* gray1 - field background */
|
|
8
|
+
--tagbar-field-text: #1f2937; /* gray8 - field text */
|
|
9
|
+
--tagbar-list-border: rgba(0, 0, 0, 0.1); /* blackA6 - list border */
|
|
10
|
+
|
|
11
|
+
/* Search overlay */
|
|
12
|
+
--search-overlay-bg: rgba(0, 0, 0, 0.1); /* Overlay background */
|
|
13
|
+
|
|
14
|
+
/* TagPicker colors */
|
|
15
|
+
--tagpicker-container-bg: #ffffff; /* white - container background */
|
|
16
|
+
--tagpicker-container-shadow: rgba(0, 0, 0, 0.1); /* blackA6 - shadow */
|
|
17
|
+
--tagpicker-container-inset-shadow: rgba(
|
|
18
|
+
255,
|
|
19
|
+
255,
|
|
20
|
+
255,
|
|
21
|
+
0.8
|
|
22
|
+
); /* whiteA8 - inset shadow */
|
|
23
|
+
|
|
24
|
+
/* TagPicker subheader colors */
|
|
25
|
+
--tagpicker-subheader-bg: #f9fafb; /* gray0 - subheader background */
|
|
26
|
+
--tagpicker-subheader-border: rgba(
|
|
27
|
+
0,
|
|
28
|
+
0,
|
|
29
|
+
0,
|
|
30
|
+
0.1
|
|
31
|
+
); /* blackA6 - subheader border */
|
|
32
|
+
--tagpicker-subheader-text: #374151; /* gray7 - subheader text */
|
|
33
|
+
--tagpicker-subheader-label: #6b7280; /* gray5 - subheader label */
|
|
34
|
+
|
|
35
|
+
/* TagPicker tag colors */
|
|
36
|
+
--tagpicker-tag-bg: #ffffff; /* white - tag background */
|
|
37
|
+
--tagpicker-tag-hover-bg: #f3f4f6; /* gray1 - tag hover background */
|
|
38
|
+
--tagpicker-tag-selected-bg: rgba(
|
|
39
|
+
0,
|
|
40
|
+
0,
|
|
41
|
+
0,
|
|
42
|
+
0.05
|
|
43
|
+
); /* blackA6 - tag selected background */
|
|
44
|
+
--tagpicker-tag-border: rgba(0, 0, 0, 0.1); /* blackA6 - tag border */
|
|
45
|
+
--tagpicker-tag-text: #1f2937; /* gray8 - tag text */
|
|
46
|
+
|
|
47
|
+
/* TagPicker empty state colors */
|
|
48
|
+
--tagpicker-empty-text: #6b7280; /* gray5 - empty text */
|
|
49
|
+
|
|
50
|
+
/* TagPicker create tag colors */
|
|
51
|
+
--tagpicker-create-bg: #f3f4f6; /* gray1 - create background */
|
|
52
|
+
--tagpicker-create-hover-bg: rgba(
|
|
53
|
+
0,
|
|
54
|
+
0,
|
|
55
|
+
0,
|
|
56
|
+
0.05
|
|
57
|
+
); /* blackA6 - create hover background */
|
|
58
|
+
--tagpicker-create-selected-bg: rgba(
|
|
59
|
+
0,
|
|
60
|
+
0,
|
|
61
|
+
0,
|
|
62
|
+
0.1
|
|
63
|
+
); /* blackA8 - create selected background */
|
|
64
|
+
--tagpicker-create-border: rgba(0, 0, 0, 0.1); /* blackA6 - create border */
|
|
65
|
+
--tagpicker-create-text: #374151; /* gray7 - create text */
|
|
66
|
+
--tagpicker-create-error-text: #dc2626; /* red6 - create error text */
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Dark theme */
|
|
70
|
+
.dark,
|
|
71
|
+
.dark-theme {
|
|
72
|
+
/* TagBar colors */
|
|
73
|
+
--tagbar-bg: #484848; /* Dark background */
|
|
74
|
+
--tagbar-text: #ffffff; /* White text */
|
|
75
|
+
--tagbar-border: 1px solid #606060;
|
|
76
|
+
--tagbar-field-bg: #606060; /* Dark field background */
|
|
77
|
+
--tagbar-field-text: #eeeeee; /* Light field text */
|
|
78
|
+
--tagbar-list-border: rgba(255, 255, 255, 0.15); /* Light border */
|
|
79
|
+
|
|
80
|
+
/* Search overlay */
|
|
81
|
+
--search-overlay-bg: rgba(0, 0, 0, 0.3); /* Darker overlay for dark mode */
|
|
82
|
+
|
|
83
|
+
/* TagPicker colors */
|
|
84
|
+
--tagpicker-container-bg: #484848; /* Dark container background */
|
|
85
|
+
--tagpicker-container-shadow: rgba(0, 0, 0, 0.21); /* Darker shadow */
|
|
86
|
+
--tagpicker-container-inset-shadow: rgba(
|
|
87
|
+
255,
|
|
88
|
+
255,
|
|
89
|
+
255,
|
|
90
|
+
0.1
|
|
91
|
+
); /* Light inset shadow */
|
|
92
|
+
|
|
93
|
+
/* TagPicker subheader colors */
|
|
94
|
+
--tagpicker-subheader-bg: #5a5a5a; /* Dark subheader background */
|
|
95
|
+
--tagpicker-subheader-border: rgba(0, 0, 0, 0.25); /* Dark border */
|
|
96
|
+
--tagpicker-subheader-text: #eeeeee; /* Light text */
|
|
97
|
+
--tagpicker-subheader-label: #b4b4b4; /* Muted label */
|
|
98
|
+
|
|
99
|
+
/* TagPicker tag colors */
|
|
100
|
+
--tagpicker-tag-bg: #484848; /* Dark tag background */
|
|
101
|
+
--tagpicker-tag-hover-bg: #5a5a5a; /* Dark tag hover */
|
|
102
|
+
--tagpicker-tag-selected-bg: rgba(255, 255, 255, 0.15); /* Light selected */
|
|
103
|
+
--tagpicker-tag-border: rgba(255, 255, 255, 0.15); /* Light border */
|
|
104
|
+
--tagpicker-tag-text: #eeeeee; /* Light text */
|
|
105
|
+
|
|
106
|
+
/* TagPicker empty state colors */
|
|
107
|
+
--tagpicker-empty-text: #b4b4b4; /* Muted empty text */
|
|
108
|
+
|
|
109
|
+
/* TagPicker create tag colors */
|
|
110
|
+
--tagpicker-create-bg: #5a5a5a; /* Dark create background */
|
|
111
|
+
--tagpicker-create-hover-bg: rgba(255, 255, 255, 0.12); /* Light hover */
|
|
112
|
+
--tagpicker-create-selected-bg: rgba(
|
|
113
|
+
255,
|
|
114
|
+
255,
|
|
115
|
+
255,
|
|
116
|
+
0.15
|
|
117
|
+
); /* Light selected */
|
|
118
|
+
--tagpicker-create-border: rgba(0, 0, 0, 0.25); /* Dark border */
|
|
119
|
+
--tagpicker-create-text: #eeeeee; /* Light text */
|
|
120
|
+
--tagpicker-create-error-text: #e5484d; /* Red error text */
|
|
121
|
+
}
|