@quillsql/react 1.0.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/.eslintrc.json +19 -0
- package/.prettierrc +11 -0
- package/example/README.md +46 -0
- package/example/package-lock.json +12111 -0
- package/example/package.json +43 -0
- package/example/public/favicon.ico +0 -0
- package/example/public/index.html +43 -0
- package/example/public/logo192.png +0 -0
- package/example/public/logo512.png +0 -0
- package/example/public/manifest.json +25 -0
- package/example/public/robots.txt +3 -0
- package/example/src/App.css +38 -0
- package/example/src/App.test.tsx +9 -0
- package/example/src/App.tsx +46 -0
- package/example/src/index.css +13 -0
- package/example/src/index.tsx +19 -0
- package/example/src/logo.svg +1 -0
- package/example/src/react-app-env.d.ts +1 -0
- package/example/src/reportWebVitals.ts +15 -0
- package/example/src/setupTests.ts +5 -0
- package/example/tsconfig.json +26 -0
- package/lib/AppContext.d.ts +29 -0
- package/lib/AppContext.js +94 -0
- package/lib/AppContext.js.map +1 -0
- package/lib/BarList.d.ts +17 -0
- package/lib/BarList.js +81 -0
- package/lib/BarList.js.map +1 -0
- package/lib/Button.d.ts +26 -0
- package/lib/Button.js +151 -0
- package/lib/Button.js.map +1 -0
- package/lib/Chart.d.ts +26 -0
- package/lib/Chart.js +532 -0
- package/lib/Chart.js.map +1 -0
- package/lib/Context.d.ts +28 -0
- package/lib/Context.js +126 -0
- package/lib/Context.js.map +1 -0
- package/lib/ContextProvider.d.ts +28 -0
- package/lib/ContextProvider.js +93 -0
- package/lib/ContextProvider.js.map +1 -0
- package/lib/Dashboard.d.ts +9 -0
- package/lib/Dashboard.js +271 -0
- package/lib/Dashboard.js.map +1 -0
- package/lib/DateRangePicker/Calendar.d.ts +15 -0
- package/lib/DateRangePicker/Calendar.js +94 -0
- package/lib/DateRangePicker/Calendar.js.map +1 -0
- package/lib/DateRangePicker/DateRangePicker.d.ts +31 -0
- package/lib/DateRangePicker/DateRangePicker.js +105 -0
- package/lib/DateRangePicker/DateRangePicker.js.map +1 -0
- package/lib/DateRangePicker/DateRangePickerButton.d.ts +21 -0
- package/lib/DateRangePicker/DateRangePickerButton.js +39 -0
- package/lib/DateRangePicker/DateRangePickerButton.js.map +1 -0
- package/lib/DateRangePicker/dateRangePickerUtils.d.ts +13 -0
- package/lib/DateRangePicker/dateRangePickerUtils.js +313 -0
- package/lib/DateRangePicker/dateRangePickerUtils.js.map +1 -0
- package/lib/DateRangePicker/index.d.ts +2 -0
- package/lib/DateRangePicker/index.js +2 -0
- package/lib/DateRangePicker/index.js.map +1 -0
- package/lib/DateRangePicker.d.ts +32 -0
- package/lib/DateRangePicker.js +105 -0
- package/lib/DateRangePicker.js.map +1 -0
- package/lib/PieChart.d.ts +63 -0
- package/lib/PieChart.js +589 -0
- package/lib/PieChart.js.map +1 -0
- package/lib/QuillProvider.d.ts +13 -0
- package/lib/QuillProvider.js +19 -0
- package/lib/QuillProvider.js.map +1 -0
- package/lib/assets/ArrowDownHeadIcon.d.ts +5 -0
- package/lib/assets/ArrowDownHeadIcon.js +29 -0
- package/lib/assets/ArrowDownHeadIcon.js.map +1 -0
- package/lib/assets/ArrowDownIcon.d.ts +5 -0
- package/lib/assets/ArrowDownIcon.js +29 -0
- package/lib/assets/ArrowDownIcon.js.map +1 -0
- package/lib/assets/ArrowDownRightIcon.d.ts +5 -0
- package/lib/assets/ArrowDownRightIcon.js +29 -0
- package/lib/assets/ArrowDownRightIcon.js.map +1 -0
- package/lib/assets/ArrowLeftHeadIcon.d.ts +5 -0
- package/lib/assets/ArrowLeftHeadIcon.js +29 -0
- package/lib/assets/ArrowLeftHeadIcon.js.map +1 -0
- package/lib/assets/ArrowRightHeadIcon.d.ts +5 -0
- package/lib/assets/ArrowRightHeadIcon.js +29 -0
- package/lib/assets/ArrowRightHeadIcon.js.map +1 -0
- package/lib/assets/ArrowRightIcon.d.ts +5 -0
- package/lib/assets/ArrowRightIcon.js +29 -0
- package/lib/assets/ArrowRightIcon.js.map +1 -0
- package/lib/assets/ArrowUpHeadIcon.d.ts +5 -0
- package/lib/assets/ArrowUpHeadIcon.js +29 -0
- package/lib/assets/ArrowUpHeadIcon.js.map +1 -0
- package/lib/assets/ArrowUpIcon.d.ts +5 -0
- package/lib/assets/ArrowUpIcon.js +29 -0
- package/lib/assets/ArrowUpIcon.js.map +1 -0
- package/lib/assets/ArrowUpRightIcon.d.ts +5 -0
- package/lib/assets/ArrowUpRightIcon.js +29 -0
- package/lib/assets/ArrowUpRightIcon.js.map +1 -0
- package/lib/assets/CalendarIcon.d.ts +5 -0
- package/lib/assets/CalendarIcon.js +29 -0
- package/lib/assets/CalendarIcon.js.map +1 -0
- package/lib/assets/DoubleArrowLeftHeadIcon.d.ts +5 -0
- package/lib/assets/DoubleArrowLeftHeadIcon.js +29 -0
- package/lib/assets/DoubleArrowLeftHeadIcon.js.map +1 -0
- package/lib/assets/DoubleArrowRightHeadIcon.d.ts +5 -0
- package/lib/assets/DoubleArrowRightHeadIcon.js +29 -0
- package/lib/assets/DoubleArrowRightHeadIcon.js.map +1 -0
- package/lib/assets/ExclamationFilledIcon.d.ts +5 -0
- package/lib/assets/ExclamationFilledIcon.js +29 -0
- package/lib/assets/ExclamationFilledIcon.js.map +1 -0
- package/lib/assets/LoadingSpinner.d.ts +5 -0
- package/lib/assets/LoadingSpinner.js +29 -0
- package/lib/assets/LoadingSpinner.js.map +1 -0
- package/lib/assets/SearchIcon.d.ts +5 -0
- package/lib/assets/SearchIcon.js +29 -0
- package/lib/assets/SearchIcon.js.map +1 -0
- package/lib/assets/XCircleIcon.d.ts +5 -0
- package/lib/assets/XCircleIcon.js +29 -0
- package/lib/assets/XCircleIcon.js.map +1 -0
- package/lib/assets/index.d.ts +16 -0
- package/lib/assets/index.js +17 -0
- package/lib/assets/index.js.map +1 -0
- package/lib/components/Dropdown/Dropdown.d.ts +12 -0
- package/lib/components/Dropdown/Dropdown.js +60 -0
- package/lib/components/Dropdown/Dropdown.js.map +1 -0
- package/lib/components/Dropdown/DropdownItem.d.ts +8 -0
- package/lib/components/Dropdown/DropdownItem.js +54 -0
- package/lib/components/Dropdown/DropdownItem.js.map +1 -0
- package/lib/components/Dropdown/index.d.ts +2 -0
- package/lib/components/Dropdown/index.js +3 -0
- package/lib/components/Dropdown/index.js.map +1 -0
- package/lib/components/Modal/Dropdown/Dropdown.d.ts +12 -0
- package/lib/components/Modal/Dropdown/Dropdown.js +52 -0
- package/lib/components/Modal/Dropdown/Dropdown.js.map +1 -0
- package/lib/components/Modal/Dropdown/DropdownItem.d.ts +8 -0
- package/lib/components/Modal/Dropdown/DropdownItem.js +51 -0
- package/lib/components/Modal/Dropdown/DropdownItem.js.map +1 -0
- package/lib/components/Modal/Dropdown/index.d.ts +2 -0
- package/lib/components/Modal/Dropdown/index.js +3 -0
- package/lib/components/Modal/Dropdown/index.js.map +1 -0
- package/lib/components/Modal/Modal.d.ts +13 -0
- package/lib/components/Modal/Modal.js +71 -0
- package/lib/components/Modal/Modal.js.map +1 -0
- package/lib/components/Modal/index.d.ts +1 -0
- package/lib/components/Modal/index.js +2 -0
- package/lib/components/Modal/index.js.map +1 -0
- package/lib/components/selectUtils.d.ts +9 -0
- package/lib/components/selectUtils.js +37 -0
- package/lib/components/selectUtils.js.map +1 -0
- package/lib/contexts/BaseColorContext.d.ts +3 -0
- package/lib/contexts/BaseColorContext.js +5 -0
- package/lib/contexts/BaseColorContext.js.map +1 -0
- package/lib/contexts/HoveredValueContext.d.ts +7 -0
- package/lib/contexts/HoveredValueContext.js +6 -0
- package/lib/contexts/HoveredValueContext.js.map +1 -0
- package/lib/contexts/RootStylesContext.d.ts +3 -0
- package/lib/contexts/RootStylesContext.js +4 -0
- package/lib/contexts/RootStylesContext.js.map +1 -0
- package/lib/contexts/SelectedValueContext.d.ts +7 -0
- package/lib/contexts/SelectedValueContext.js +7 -0
- package/lib/contexts/SelectedValueContext.js.map +1 -0
- package/lib/contexts/index.d.ts +4 -0
- package/lib/contexts/index.js +5 -0
- package/lib/contexts/index.js.map +1 -0
- package/lib/hooks/index.d.ts +4 -0
- package/lib/hooks/index.js +5 -0
- package/lib/hooks/index.js.map +1 -0
- package/lib/hooks/useInternalState.d.ts +3 -0
- package/lib/hooks/useInternalState.js +15 -0
- package/lib/hooks/useInternalState.js.map +1 -0
- package/lib/hooks/useOnClickOutside.d.ts +2 -0
- package/lib/hooks/useOnClickOutside.js +19 -0
- package/lib/hooks/useOnClickOutside.js.map +1 -0
- package/lib/hooks/useOnWindowResize.d.ts +4 -0
- package/lib/hooks/useOnWindowResize.js +15 -0
- package/lib/hooks/useOnWindowResize.js.map +1 -0
- package/lib/hooks/useSelectOnKeyDown.d.ts +2 -0
- package/lib/hooks/useSelectOnKeyDown.js +64 -0
- package/lib/hooks/useSelectOnKeyDown.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/lib/lib/colorClassNames.d.ts +19 -0
- package/lib/lib/colorClassNames.js +3175 -0
- package/lib/lib/colorClassNames.js.map +1 -0
- package/lib/lib/constants.d.ts +16 -0
- package/lib/lib/constants.js +47 -0
- package/lib/lib/constants.js.map +1 -0
- package/lib/lib/font.d.ts +13 -0
- package/lib/lib/font.js +14 -0
- package/lib/lib/font.js.map +1 -0
- package/lib/lib/hexColors.d.ts +3 -0
- package/lib/lib/hexColors.js +29 -0
- package/lib/lib/hexColors.js.map +1 -0
- package/lib/lib/index.d.ts +10 -0
- package/lib/lib/index.js +11 -0
- package/lib/lib/index.js.map +1 -0
- package/lib/lib/inputTypes.d.ts +20 -0
- package/lib/lib/inputTypes.js +37 -0
- package/lib/lib/inputTypes.js.map +1 -0
- package/lib/lib/shape.d.ts +73 -0
- package/lib/lib/shape.js +74 -0
- package/lib/lib/shape.js.map +1 -0
- package/lib/lib/sizing.d.ts +46 -0
- package/lib/lib/sizing.js +43 -0
- package/lib/lib/sizing.js.map +1 -0
- package/lib/lib/spacing.d.ts +264 -0
- package/lib/lib/spacing.js +265 -0
- package/lib/lib/spacing.js.map +1 -0
- package/lib/lib/theme.d.ts +22 -0
- package/lib/lib/theme.js +46 -0
- package/lib/lib/theme.js.map +1 -0
- package/lib/lib/utils.d.ts +12 -0
- package/lib/lib/utils.js +69 -0
- package/lib/lib/utils.js.map +1 -0
- package/lib/styles.css +12019 -0
- package/package.json +48 -0
- package/postcss.config.js +6 -0
- package/src/BarList.tsx +236 -0
- package/src/Chart.tsx +934 -0
- package/src/Context.tsx +204 -0
- package/src/Dashboard.tsx +379 -0
- package/src/DateRangePicker/Calendar.tsx +425 -0
- package/src/DateRangePicker/DateRangePicker.tsx +251 -0
- package/src/DateRangePicker/DateRangePickerButton.tsx +176 -0
- package/src/DateRangePicker/dateRangePickerUtils.tsx +460 -0
- package/src/DateRangePicker/index.ts +3 -0
- package/src/PieChart.tsx +838 -0
- package/src/QuillProvider.tsx +28 -0
- package/src/assets/ArrowDownHeadIcon.tsx +11 -0
- package/src/assets/ArrowDownIcon.tsx +14 -0
- package/src/assets/ArrowDownRightIcon.tsx +14 -0
- package/src/assets/ArrowLeftHeadIcon.tsx +11 -0
- package/src/assets/ArrowRightHeadIcon.tsx +11 -0
- package/src/assets/ArrowRightIcon.tsx +14 -0
- package/src/assets/ArrowUpHeadIcon.tsx +11 -0
- package/src/assets/ArrowUpIcon.tsx +14 -0
- package/src/assets/ArrowUpRightIcon.tsx +14 -0
- package/src/assets/CalendarIcon.tsx +14 -0
- package/src/assets/DoubleArrowLeftHeadIcon.tsx +18 -0
- package/src/assets/DoubleArrowRightHeadIcon.tsx +20 -0
- package/src/assets/ExclamationFilledIcon.tsx +14 -0
- package/src/assets/LoadingSpinner.tsx +11 -0
- package/src/assets/SearchIcon.tsx +14 -0
- package/src/assets/XCircleIcon.tsx +14 -0
- package/src/assets/index.ts +16 -0
- package/src/components/Dropdown/Dropdown.tsx +179 -0
- package/src/components/Dropdown/DropdownItem.tsx +86 -0
- package/src/components/Dropdown/index.ts +2 -0
- package/src/components/Modal/Modal.tsx +113 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/selectUtils.ts +67 -0
- package/src/contexts/BaseColorContext.tsx +8 -0
- package/src/contexts/HoveredValueContext.tsx +12 -0
- package/src/contexts/RootStylesContext.tsx +5 -0
- package/src/contexts/SelectedValueContext.tsx +13 -0
- package/src/contexts/index.ts +4 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useInternalState.tsx +18 -0
- package/src/hooks/useOnClickOutside.tsx +23 -0
- package/src/hooks/useOnWindowResize.tsx +17 -0
- package/src/hooks/useSelectOnKeyDown.tsx +80 -0
- package/src/index.ts +4 -0
- package/src/lib/colorClassNames.ts +3191 -0
- package/src/lib/constants.ts +52 -0
- package/src/lib/font.ts +14 -0
- package/src/lib/hexColors.ts +28 -0
- package/src/lib/index.ts +10 -0
- package/src/lib/inputTypes.ts +62 -0
- package/src/lib/shape.ts +75 -0
- package/src/lib/sizing.ts +47 -0
- package/src/lib/spacing.ts +264 -0
- package/src/lib/theme.ts +49 -0
- package/src/lib/utils.tsx +81 -0
- package/src/styles.css +5 -0
- package/tailwind.config.js +16 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Color, DeltaType, HorizontalPosition, Size, VerticalPosition } from "./inputTypes";
|
|
2
|
+
|
|
3
|
+
export const DeltaTypes: { [key: string]: DeltaType } = {
|
|
4
|
+
Increase: "increase",
|
|
5
|
+
ModerateIncrease: "moderateIncrease",
|
|
6
|
+
Decrease: "decrease",
|
|
7
|
+
ModerateDecrease: "moderateDecrease",
|
|
8
|
+
Unchanged: "unchanged",
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const BaseColors: { [key: string]: Color } = {
|
|
12
|
+
Slate: "slate",
|
|
13
|
+
Gray: "gray",
|
|
14
|
+
Zinc: "zinc",
|
|
15
|
+
Neutral: "neutral",
|
|
16
|
+
Stone: "stone",
|
|
17
|
+
Red: "red",
|
|
18
|
+
Orange: "orange",
|
|
19
|
+
Amber: "amber",
|
|
20
|
+
Yellow: "yellow",
|
|
21
|
+
Lime: "lime",
|
|
22
|
+
Green: "green",
|
|
23
|
+
Emerald: "emerald",
|
|
24
|
+
Teal: "teal",
|
|
25
|
+
Cyan: "cyan",
|
|
26
|
+
Sky: "sky",
|
|
27
|
+
Blue: "blue",
|
|
28
|
+
Indigo: "indigo",
|
|
29
|
+
Violet: "violet",
|
|
30
|
+
Purple: "purple",
|
|
31
|
+
Fuchsia: "fuchsia",
|
|
32
|
+
Pink: "pink",
|
|
33
|
+
Rose: "rose",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Sizes: { [key: string]: Size } = {
|
|
37
|
+
XS: "xs",
|
|
38
|
+
SM: "sm",
|
|
39
|
+
MD: "md",
|
|
40
|
+
LG: "lg",
|
|
41
|
+
XL: "xl",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const HorizontalPositions: { [key: string]: HorizontalPosition } = {
|
|
45
|
+
Left: "left",
|
|
46
|
+
Right: "right",
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const VerticalPositions: { [key: string]: VerticalPosition } = {
|
|
50
|
+
Top: "top",
|
|
51
|
+
Bottom: "bottom",
|
|
52
|
+
};
|
package/src/lib/font.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseColors } from "./constants";
|
|
2
|
+
|
|
3
|
+
export const hexColors: { [color: string]: string } = {
|
|
4
|
+
[BaseColors.Slate]: "#64748b",
|
|
5
|
+
[BaseColors.Gray]: "#6b7280",
|
|
6
|
+
[BaseColors.Zinc]: "#71717a",
|
|
7
|
+
[BaseColors.Neutral]: "#737373",
|
|
8
|
+
[BaseColors.Stone]: "#78716c",
|
|
9
|
+
[BaseColors.Red]: "#ef4444",
|
|
10
|
+
[BaseColors.Orange]: "#f97316",
|
|
11
|
+
[BaseColors.Amber]: "#f59e0b",
|
|
12
|
+
[BaseColors.Yellow]: "#eab308",
|
|
13
|
+
[BaseColors.Lime]: "#84cc16",
|
|
14
|
+
[BaseColors.Green]: "#22c55e",
|
|
15
|
+
[BaseColors.Emerald]: "#10b981",
|
|
16
|
+
[BaseColors.Teal]: "#14b8a6",
|
|
17
|
+
[BaseColors.Cyan]: "#06b6d4",
|
|
18
|
+
[BaseColors.Sky]: "#0ea5e9",
|
|
19
|
+
[BaseColors.Blue]: "#3b82f6",
|
|
20
|
+
[BaseColors.Indigo]: "#6366f1",
|
|
21
|
+
[BaseColors.Violet]: "#8b5cf6",
|
|
22
|
+
[BaseColors.Purple]: "#a855f7",
|
|
23
|
+
[BaseColors.Fuchsia]: "#d946ef",
|
|
24
|
+
[BaseColors.Pink]: "#ec4899",
|
|
25
|
+
[BaseColors.Rose]: "#f43f5e",
|
|
26
|
+
[BaseColors.Black]: "#000000",
|
|
27
|
+
[BaseColors.White]: "#ffffff",
|
|
28
|
+
};
|
package/src/lib/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./hexColors";
|
|
2
|
+
export * from "./colorClassNames";
|
|
3
|
+
export * from "./inputTypes";
|
|
4
|
+
export * from "./constants";
|
|
5
|
+
export * from "./shape";
|
|
6
|
+
export * from "./sizing";
|
|
7
|
+
export * from "./spacing";
|
|
8
|
+
export * from "./font";
|
|
9
|
+
export * from "./theme";
|
|
10
|
+
export * from "./utils";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export type ValueFormatter = {
|
|
2
|
+
(value: number): string;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
const iconVariantValues = ["simple", "light", "shadow", "solid", "outlined"] as const;
|
|
6
|
+
|
|
7
|
+
export type IconVariant = (typeof iconVariantValues)[number];
|
|
8
|
+
|
|
9
|
+
export type HorizontalPosition = "left" | "right";
|
|
10
|
+
|
|
11
|
+
export type VerticalPosition = "top" | "bottom";
|
|
12
|
+
|
|
13
|
+
export type ButtonVariant = "primary" | "secondary" | "light";
|
|
14
|
+
|
|
15
|
+
const deltaTypeValues = [
|
|
16
|
+
"increase",
|
|
17
|
+
"moderateIncrease",
|
|
18
|
+
"decrease",
|
|
19
|
+
"moderateDecrease",
|
|
20
|
+
"unchanged",
|
|
21
|
+
] as const;
|
|
22
|
+
|
|
23
|
+
export type DeltaType = (typeof deltaTypeValues)[number];
|
|
24
|
+
|
|
25
|
+
const sizeValues = ["xs", "sm", "md", "lg", "xl"] as const;
|
|
26
|
+
|
|
27
|
+
export type Size = (typeof sizeValues)[number];
|
|
28
|
+
|
|
29
|
+
const colorValues = [
|
|
30
|
+
"slate",
|
|
31
|
+
"gray",
|
|
32
|
+
"zinc",
|
|
33
|
+
"neutral",
|
|
34
|
+
"stone",
|
|
35
|
+
"red",
|
|
36
|
+
"orange",
|
|
37
|
+
"amber",
|
|
38
|
+
"yellow",
|
|
39
|
+
"lime",
|
|
40
|
+
"green",
|
|
41
|
+
"emerald",
|
|
42
|
+
"teal",
|
|
43
|
+
"cyan",
|
|
44
|
+
"sky",
|
|
45
|
+
"blue",
|
|
46
|
+
"indigo",
|
|
47
|
+
"violet",
|
|
48
|
+
"purple",
|
|
49
|
+
"fuchsia",
|
|
50
|
+
"pink",
|
|
51
|
+
"rose",
|
|
52
|
+
] as const;
|
|
53
|
+
|
|
54
|
+
export type Color = (typeof colorValues)[number];
|
|
55
|
+
|
|
56
|
+
const justifyContentValues = ["start", "end", "center", "between", "around", "evenly"] as const;
|
|
57
|
+
export type JustifyContent = (typeof justifyContentValues)[number];
|
|
58
|
+
|
|
59
|
+
const alignItemsValues = ["start", "end", "center", "baseline", "stretch"] as const;
|
|
60
|
+
export type AlignItems = (typeof alignItemsValues)[number];
|
|
61
|
+
|
|
62
|
+
export type FlexDirection = "row" | "col" | "row-reverse" | "col-reverse";
|
package/src/lib/shape.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export const borderRadius = {
|
|
2
|
+
none: {
|
|
3
|
+
left: "rounded-l-none",
|
|
4
|
+
top: "rounded-t-none",
|
|
5
|
+
right: "rounded-r-none",
|
|
6
|
+
bottom: "rounded-b-none",
|
|
7
|
+
all: "rounded-none",
|
|
8
|
+
},
|
|
9
|
+
sm: {
|
|
10
|
+
left: "rounded-l",
|
|
11
|
+
top: "rounded-t",
|
|
12
|
+
right: "rounded-r",
|
|
13
|
+
bottom: "rounded-b",
|
|
14
|
+
all: "rounded",
|
|
15
|
+
},
|
|
16
|
+
md: {
|
|
17
|
+
left: "rounded-l-md",
|
|
18
|
+
top: "rounded-t-md",
|
|
19
|
+
right: "rounded-r-md",
|
|
20
|
+
bottom: "rounded-b-md",
|
|
21
|
+
all: "rounded-md",
|
|
22
|
+
},
|
|
23
|
+
lg: {
|
|
24
|
+
left: "rounded-l-lg",
|
|
25
|
+
top: "rounded-t-lg",
|
|
26
|
+
right: "rounded-r-lg",
|
|
27
|
+
bottom: "rounded-b-lg",
|
|
28
|
+
all: "rounded-lg",
|
|
29
|
+
},
|
|
30
|
+
full: {
|
|
31
|
+
left: "rounded-l-full",
|
|
32
|
+
top: "rounded-t-full",
|
|
33
|
+
right: "rounded-r-full",
|
|
34
|
+
bottom: "rounded-b-full",
|
|
35
|
+
all: "rounded-full",
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const boxShadow = {
|
|
40
|
+
none: "shadow-none",
|
|
41
|
+
sm: "shadow-sm",
|
|
42
|
+
md: "shadow",
|
|
43
|
+
lg: "shadow-lg",
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const border = {
|
|
47
|
+
none: {
|
|
48
|
+
left: "border-l-0",
|
|
49
|
+
top: "border-t-0",
|
|
50
|
+
right: "border-r-0",
|
|
51
|
+
bottom: "border-b-0",
|
|
52
|
+
all: "border-0",
|
|
53
|
+
},
|
|
54
|
+
sm: {
|
|
55
|
+
left: "border-l",
|
|
56
|
+
top: "border-t",
|
|
57
|
+
right: "border-r",
|
|
58
|
+
bottom: "border-b",
|
|
59
|
+
all: "border",
|
|
60
|
+
},
|
|
61
|
+
md: {
|
|
62
|
+
left: "border-l-2",
|
|
63
|
+
top: "border-t-2",
|
|
64
|
+
right: "border-r-2",
|
|
65
|
+
bottom: "border-b-2",
|
|
66
|
+
all: "border-2",
|
|
67
|
+
},
|
|
68
|
+
lg: {
|
|
69
|
+
left: "border-l-4",
|
|
70
|
+
top: "border-t-4",
|
|
71
|
+
right: "border-r-4",
|
|
72
|
+
bottom: "border-b-4",
|
|
73
|
+
all: "border-4",
|
|
74
|
+
},
|
|
75
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type Sizing = {
|
|
2
|
+
height: string;
|
|
3
|
+
width: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export const sizing = {
|
|
7
|
+
none: {
|
|
8
|
+
height: "h-0",
|
|
9
|
+
width: "w-0",
|
|
10
|
+
},
|
|
11
|
+
threeXs: {
|
|
12
|
+
height: "h-0.5",
|
|
13
|
+
width: "w-0.5",
|
|
14
|
+
},
|
|
15
|
+
twoXs: {
|
|
16
|
+
height: "h-1",
|
|
17
|
+
width: "w-1",
|
|
18
|
+
},
|
|
19
|
+
xs: {
|
|
20
|
+
height: "h-2",
|
|
21
|
+
width: "w-2",
|
|
22
|
+
},
|
|
23
|
+
sm: {
|
|
24
|
+
height: "h-3",
|
|
25
|
+
width: "w-3",
|
|
26
|
+
},
|
|
27
|
+
md: {
|
|
28
|
+
height: "h-4",
|
|
29
|
+
width: "w-4",
|
|
30
|
+
},
|
|
31
|
+
lg: {
|
|
32
|
+
height: "h-5",
|
|
33
|
+
width: "w-5",
|
|
34
|
+
},
|
|
35
|
+
xl: {
|
|
36
|
+
height: "h-6",
|
|
37
|
+
width: "w-6",
|
|
38
|
+
},
|
|
39
|
+
twoXl: {
|
|
40
|
+
height: "h-7",
|
|
41
|
+
width: "w-7",
|
|
42
|
+
},
|
|
43
|
+
threeXl: {
|
|
44
|
+
height: "h-9",
|
|
45
|
+
width: "w-9",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
export const spacing = {
|
|
2
|
+
none: {
|
|
3
|
+
paddingLeft: "pl-0",
|
|
4
|
+
paddingTop: "pt-0",
|
|
5
|
+
paddingRight: "pr-0",
|
|
6
|
+
paddingBottom: "pb-0",
|
|
7
|
+
paddingX: "px-0",
|
|
8
|
+
paddingY: "py-0",
|
|
9
|
+
paddingAll: "p-0",
|
|
10
|
+
marginLeft: "ml-0",
|
|
11
|
+
marginTop: "mt-0",
|
|
12
|
+
marginRight: "mr-0",
|
|
13
|
+
marginBottom: "mb-0",
|
|
14
|
+
negativeMarginLeft: "-ml-0",
|
|
15
|
+
negativeMarginRight: "-mr-0",
|
|
16
|
+
negativeMarginTop: "-mt-0",
|
|
17
|
+
negativeMarginBottom: "-mb-0",
|
|
18
|
+
left: "left-0",
|
|
19
|
+
right: "right-0",
|
|
20
|
+
top: "top-0",
|
|
21
|
+
bottom: "bottom-0",
|
|
22
|
+
spaceX: "space-x-0",
|
|
23
|
+
},
|
|
24
|
+
px: {
|
|
25
|
+
paddingLeft: "pl-px",
|
|
26
|
+
paddingTop: "pt-px",
|
|
27
|
+
paddingRight: "pr-px",
|
|
28
|
+
paddingBottom: "pb-px",
|
|
29
|
+
paddingX: "px-px",
|
|
30
|
+
paddingY: "py-px",
|
|
31
|
+
paddingAll: "p-px",
|
|
32
|
+
marginLeft: "ml-px",
|
|
33
|
+
marginTop: "mt-px",
|
|
34
|
+
marginRight: "mr-px",
|
|
35
|
+
marginBottom: "mb-px",
|
|
36
|
+
negativeMarginLeft: "-ml-px",
|
|
37
|
+
negativeMarginRight: "-mr-px",
|
|
38
|
+
negativeMarginTop: "-mt-px",
|
|
39
|
+
negativeMarginBottom: "-mb-px",
|
|
40
|
+
left: "left-px",
|
|
41
|
+
right: "right-px",
|
|
42
|
+
top: "top-px",
|
|
43
|
+
bottom: "bottom-px",
|
|
44
|
+
spaceX: "space-x-px",
|
|
45
|
+
},
|
|
46
|
+
threeXs: {
|
|
47
|
+
paddingLeft: "pl-0.5",
|
|
48
|
+
paddingTop: "pt-0.5",
|
|
49
|
+
paddingRight: "pr-0.5",
|
|
50
|
+
paddingBottom: "pb-0.5",
|
|
51
|
+
paddingX: "px-0.5",
|
|
52
|
+
paddingY: "py-0.5",
|
|
53
|
+
paddingAll: "p-0.5",
|
|
54
|
+
marginLeft: "ml-0.5",
|
|
55
|
+
marginTop: "mt-0.5",
|
|
56
|
+
marginRight: "mr-0.5",
|
|
57
|
+
marginBottom: "mb-0.5",
|
|
58
|
+
negativeMarginLeft: "-ml-0.5",
|
|
59
|
+
negativeMarginRight: "-mr-0.5",
|
|
60
|
+
negativeMarginTop: "-mt-0.5",
|
|
61
|
+
negativeMarginBottom: "-mb-0.5",
|
|
62
|
+
left: "left-0.5",
|
|
63
|
+
right: "right-0.5",
|
|
64
|
+
top: "top-0.5",
|
|
65
|
+
bottom: "bottom-0.5",
|
|
66
|
+
spaceX: "space-x-0.5",
|
|
67
|
+
},
|
|
68
|
+
twoXs: {
|
|
69
|
+
paddingLeft: "pl-1",
|
|
70
|
+
paddingTop: "pt-1",
|
|
71
|
+
paddingRight: "pr-1",
|
|
72
|
+
paddingBottom: "pb-1",
|
|
73
|
+
paddingX: "px-1",
|
|
74
|
+
paddingY: "py-1",
|
|
75
|
+
paddingAll: "p-1",
|
|
76
|
+
marginLeft: "ml-1",
|
|
77
|
+
marginTop: "mt-1",
|
|
78
|
+
marginRight: "mr-1",
|
|
79
|
+
marginBottom: "mb-1",
|
|
80
|
+
negativeMarginLeft: "-ml-1",
|
|
81
|
+
negativeMarginRight: "-mr-1",
|
|
82
|
+
left: "left-1",
|
|
83
|
+
right: "right-1",
|
|
84
|
+
top: "top-1",
|
|
85
|
+
bottom: "bottom-1",
|
|
86
|
+
spaceX: "space-x-1",
|
|
87
|
+
},
|
|
88
|
+
xs: {
|
|
89
|
+
paddingLeft: "pl-1.5",
|
|
90
|
+
paddingTop: "pt-1.5",
|
|
91
|
+
paddingRight: "pr-1.5",
|
|
92
|
+
paddingBottom: "pb-1.5",
|
|
93
|
+
paddingX: "px-1.5",
|
|
94
|
+
paddingY: "py-1.5",
|
|
95
|
+
paddingAll: "p-1.5",
|
|
96
|
+
marginLeft: "ml-1.5",
|
|
97
|
+
marginTop: "mt-1.5",
|
|
98
|
+
marginRight: "mr-1.5",
|
|
99
|
+
marginBottom: "mb-1.5",
|
|
100
|
+
negativeMarginLeft: "-ml-1.5",
|
|
101
|
+
negativeMarginRight: "-mr-1.5",
|
|
102
|
+
negativeMarginTop: "-mt-1.5",
|
|
103
|
+
negativeMarginBottom: "-mb-1.5",
|
|
104
|
+
left: "left-1.5",
|
|
105
|
+
right: "right-1.5",
|
|
106
|
+
top: "top-1.5",
|
|
107
|
+
bottom: "bottom-1.5",
|
|
108
|
+
spaceX: "space-x-1.5",
|
|
109
|
+
},
|
|
110
|
+
sm: {
|
|
111
|
+
paddingLeft: "pl-2",
|
|
112
|
+
paddingTop: "pt-2",
|
|
113
|
+
paddingRight: "pr-2",
|
|
114
|
+
paddingBottom: "pb-2",
|
|
115
|
+
paddingX: "px-2",
|
|
116
|
+
paddingY: "py-2",
|
|
117
|
+
paddingAll: "p-2",
|
|
118
|
+
marginLeft: "ml-2",
|
|
119
|
+
marginTop: "mt-2",
|
|
120
|
+
marginRight: "mr-2",
|
|
121
|
+
marginBottom: "mb-2",
|
|
122
|
+
negativeMarginLeft: "-ml-2",
|
|
123
|
+
negativeMarginRight: "-mr-2",
|
|
124
|
+
negativeMarginTop: "-mt-2",
|
|
125
|
+
negativeMarginBottom: "-mb-2",
|
|
126
|
+
left: "left-2",
|
|
127
|
+
right: "right-2",
|
|
128
|
+
top: "left-2",
|
|
129
|
+
bottom: "bottom-2",
|
|
130
|
+
spaceX: "space-x-2",
|
|
131
|
+
},
|
|
132
|
+
md: {
|
|
133
|
+
paddingLeft: "pl-2.5",
|
|
134
|
+
paddingTop: "pt-2.5",
|
|
135
|
+
paddingRight: "pr-2.5",
|
|
136
|
+
paddingBottom: "pb-2.5",
|
|
137
|
+
paddingX: "px-2.5",
|
|
138
|
+
paddingY: "py-2.5",
|
|
139
|
+
paddingAll: "p-2.5",
|
|
140
|
+
marginLeft: "ml-2.5",
|
|
141
|
+
marginTop: "mt-2.5",
|
|
142
|
+
marginRight: "mr-2.5",
|
|
143
|
+
marginBottom: "mb-2.5",
|
|
144
|
+
negativeMarginLeft: "-ml-2.5",
|
|
145
|
+
negativeMarginRight: "-mr-2.5",
|
|
146
|
+
negativeMarginTop: "-mt-2.5",
|
|
147
|
+
negativeMarginBottom: "-mb-2.5",
|
|
148
|
+
left: "left-2.5",
|
|
149
|
+
right: "right-2.5",
|
|
150
|
+
top: "top-2.5",
|
|
151
|
+
bottom: "bottom-2.5",
|
|
152
|
+
spaceX: "space-x-2.5",
|
|
153
|
+
},
|
|
154
|
+
lg: {
|
|
155
|
+
paddingLeft: "pl-3",
|
|
156
|
+
paddingTop: "pt-3",
|
|
157
|
+
paddingRight: "pr-3",
|
|
158
|
+
paddingBottom: "pb-3",
|
|
159
|
+
paddingX: "px-3",
|
|
160
|
+
paddingY: "py-3",
|
|
161
|
+
paddingAll: "p-3",
|
|
162
|
+
marginLeft: "ml-3",
|
|
163
|
+
marginTop: "mt-3",
|
|
164
|
+
marginRight: "mr-3",
|
|
165
|
+
marginBottom: "mb-3",
|
|
166
|
+
negativeMarginLeft: "-ml-3",
|
|
167
|
+
negativeMarginRight: "-mr-3",
|
|
168
|
+
negativeMarginTop: "-mt-3",
|
|
169
|
+
negativeMarginBottom: "-mb-3",
|
|
170
|
+
left: "left-3",
|
|
171
|
+
right: "right-3",
|
|
172
|
+
top: "top-3",
|
|
173
|
+
bottom: "bottom-3",
|
|
174
|
+
spaceX: "space-x-3",
|
|
175
|
+
},
|
|
176
|
+
xl: {
|
|
177
|
+
paddingLeft: "pl-3.5",
|
|
178
|
+
paddingTop: "pt-3.5",
|
|
179
|
+
paddingRight: "pr-3.5",
|
|
180
|
+
paddingBottom: "pb-3.5",
|
|
181
|
+
paddingX: "px-3.5",
|
|
182
|
+
paddingY: "py-3.5",
|
|
183
|
+
paddingAll: "p-3.5",
|
|
184
|
+
marginLeft: "ml-3.5",
|
|
185
|
+
marginTop: "mt-3.5",
|
|
186
|
+
marginRight: "mr-3.5",
|
|
187
|
+
marginBottom: "mb-3.5",
|
|
188
|
+
negativeMarginLeft: "-ml-3.5",
|
|
189
|
+
negativeMarginRight: "-mr-3.5",
|
|
190
|
+
negativeMarginTop: "-mt-3.5",
|
|
191
|
+
negativeMarginBottom: "-mb-3.5",
|
|
192
|
+
left: "left-3.5",
|
|
193
|
+
right: "right-3.5",
|
|
194
|
+
top: "top-3.5",
|
|
195
|
+
bottom: "bottom-3.5",
|
|
196
|
+
spaceX: "space-x-3.5",
|
|
197
|
+
},
|
|
198
|
+
twoXl: {
|
|
199
|
+
paddingLeft: "pl-4",
|
|
200
|
+
paddingTop: "pt-4",
|
|
201
|
+
paddingRight: "pr-4",
|
|
202
|
+
paddingBottom: "pb-4",
|
|
203
|
+
paddingX: "px-4",
|
|
204
|
+
paddingY: "py-4",
|
|
205
|
+
paddingAll: "p-4",
|
|
206
|
+
marginLeft: "ml-4",
|
|
207
|
+
marginTop: "mt-4",
|
|
208
|
+
marginRight: "mr-4",
|
|
209
|
+
marginBottom: "mb-4",
|
|
210
|
+
negativeMarginLeft: "-ml-4",
|
|
211
|
+
negativeMarginRight: "-mr-4",
|
|
212
|
+
negativeMarginTop: "-mt-4",
|
|
213
|
+
negativeMarginBottom: "-mb-4",
|
|
214
|
+
left: "left-4",
|
|
215
|
+
right: "right-4",
|
|
216
|
+
top: "top-4",
|
|
217
|
+
bottom: "bottom-4",
|
|
218
|
+
spaceX: "space-x-4",
|
|
219
|
+
},
|
|
220
|
+
threeXl: {
|
|
221
|
+
paddingLeft: "pl-6",
|
|
222
|
+
paddingTop: "pt-6",
|
|
223
|
+
paddingRight: "pr-6",
|
|
224
|
+
paddingBottom: "pb-6",
|
|
225
|
+
paddingX: "px-6",
|
|
226
|
+
paddingY: "py-6",
|
|
227
|
+
paddingAll: "p-6",
|
|
228
|
+
marginLeft: "ml-6",
|
|
229
|
+
marginTop: "mt-6",
|
|
230
|
+
marginRight: "mr-6",
|
|
231
|
+
marginBottom: "mb-6",
|
|
232
|
+
negativeMarginLeft: "-ml-6",
|
|
233
|
+
negativeMarginRight: "-mr-6",
|
|
234
|
+
negativeMarginTop: "-mt-6",
|
|
235
|
+
negativeMarginBottom: "-mb-6",
|
|
236
|
+
left: "left-6",
|
|
237
|
+
right: "right-6",
|
|
238
|
+
top: "top-6",
|
|
239
|
+
bottom: "bottom-6",
|
|
240
|
+
spaceX: "space-x-6",
|
|
241
|
+
},
|
|
242
|
+
fourXl: {
|
|
243
|
+
paddingLeft: "pl-8",
|
|
244
|
+
paddingTop: "pt-8",
|
|
245
|
+
paddingRight: "pr-8",
|
|
246
|
+
paddingBottom: "pb-8",
|
|
247
|
+
paddingX: "px-8",
|
|
248
|
+
paddingY: "py-8",
|
|
249
|
+
paddingAll: "p-8",
|
|
250
|
+
marginLeft: "ml-8",
|
|
251
|
+
marginTop: "mt-8",
|
|
252
|
+
marginRight: "mr-8",
|
|
253
|
+
marginBottom: "mb-8",
|
|
254
|
+
negativeMarginLeft: "-ml-8",
|
|
255
|
+
negativeMarginRight: "-mr-8",
|
|
256
|
+
negativeMarginTop: "-mt-8",
|
|
257
|
+
negativeMarginBottom: "-mb-8",
|
|
258
|
+
left: "left-8",
|
|
259
|
+
right: "right-8",
|
|
260
|
+
top: "top-8",
|
|
261
|
+
bottom: "bottom-8",
|
|
262
|
+
spaceX: "space-x-8",
|
|
263
|
+
},
|
|
264
|
+
};
|
package/src/lib/theme.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BaseColors } from "./constants";
|
|
2
|
+
import { Color } from "./inputTypes";
|
|
3
|
+
|
|
4
|
+
export const DEFAULT_COLOR: Color = "gray";
|
|
5
|
+
export const WHITE = "white";
|
|
6
|
+
export const TRANSPARENT = "transparent";
|
|
7
|
+
|
|
8
|
+
export const colorPalette = {
|
|
9
|
+
canvasBackground: 50,
|
|
10
|
+
lightBackground: 100,
|
|
11
|
+
background: 500,
|
|
12
|
+
darkBackground: 600,
|
|
13
|
+
darkestBackground: 800,
|
|
14
|
+
lightBorder: 200,
|
|
15
|
+
border: 500,
|
|
16
|
+
darkBorder: 700,
|
|
17
|
+
lightRing: 200,
|
|
18
|
+
ring: 300,
|
|
19
|
+
lightText: 400,
|
|
20
|
+
text: 500,
|
|
21
|
+
darkText: 700,
|
|
22
|
+
darkestText: 900,
|
|
23
|
+
icon: 500,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const themeColorRange: Color[] = [
|
|
27
|
+
BaseColors.Cyan,
|
|
28
|
+
BaseColors.Sky,
|
|
29
|
+
BaseColors.Blue,
|
|
30
|
+
BaseColors.Indigo,
|
|
31
|
+
BaseColors.Violet,
|
|
32
|
+
BaseColors.Purple,
|
|
33
|
+
BaseColors.Fuchsia,
|
|
34
|
+
BaseColors.Slate,
|
|
35
|
+
BaseColors.Gray,
|
|
36
|
+
BaseColors.Zinc,
|
|
37
|
+
BaseColors.Neutral,
|
|
38
|
+
BaseColors.Stone,
|
|
39
|
+
BaseColors.Red,
|
|
40
|
+
BaseColors.Orange,
|
|
41
|
+
BaseColors.Amber,
|
|
42
|
+
BaseColors.Yellow,
|
|
43
|
+
BaseColors.Lime,
|
|
44
|
+
BaseColors.Green,
|
|
45
|
+
BaseColors.Emerald,
|
|
46
|
+
BaseColors.Teal,
|
|
47
|
+
BaseColors.Pink,
|
|
48
|
+
BaseColors.Rose,
|
|
49
|
+
];
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { DeltaTypes } from "./constants";
|
|
2
|
+
import { Color, ValueFormatter } from "./inputTypes";
|
|
3
|
+
import { colorClassNames } from "./colorClassNames";
|
|
4
|
+
|
|
5
|
+
export const mapInputsToDeltaType = (deltaType: string, isIncreasePositive: boolean): string => {
|
|
6
|
+
if (isIncreasePositive || deltaType === DeltaTypes.Unchanged) {
|
|
7
|
+
return deltaType;
|
|
8
|
+
}
|
|
9
|
+
switch (deltaType) {
|
|
10
|
+
case DeltaTypes.Increase:
|
|
11
|
+
return DeltaTypes.Decrease;
|
|
12
|
+
case DeltaTypes.ModerateIncrease:
|
|
13
|
+
return DeltaTypes.ModerateDecrease;
|
|
14
|
+
case DeltaTypes.Decrease:
|
|
15
|
+
return DeltaTypes.Increase;
|
|
16
|
+
case DeltaTypes.ModerateDecrease:
|
|
17
|
+
return DeltaTypes.ModerateIncrease;
|
|
18
|
+
}
|
|
19
|
+
return "";
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const defaultValueFormatter: ValueFormatter = (value: number) => value.toString();
|
|
23
|
+
|
|
24
|
+
export const sumNumericArray = (arr: number[]) =>
|
|
25
|
+
arr.reduce((prefixSum, num) => prefixSum + num, 0);
|
|
26
|
+
|
|
27
|
+
export const removeValueFromArray = (value: any, array: any[]): any[] => {
|
|
28
|
+
const index = array.indexOf(value);
|
|
29
|
+
if (index > -1) {
|
|
30
|
+
array.splice(index, 1);
|
|
31
|
+
}
|
|
32
|
+
return array;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const isValueInArray = (value: any, array: any[]): boolean => {
|
|
36
|
+
for (let i = 0; i < array.length; i++) {
|
|
37
|
+
if (array[i] === value) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const stringIsNumeric = (str: string | undefined): boolean => {
|
|
45
|
+
return !isNaN(Number(str)) && str !== undefined;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const stringEndsWithNumber = (str: string): boolean => {
|
|
49
|
+
return stringIsNumeric(str.split("-").pop());
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export function mergeRefs<T = any>(
|
|
53
|
+
refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>,
|
|
54
|
+
): React.RefCallback<T> {
|
|
55
|
+
return (value) => {
|
|
56
|
+
refs.forEach((ref) => {
|
|
57
|
+
if (typeof ref === "function") {
|
|
58
|
+
ref(value);
|
|
59
|
+
} else if (ref != null) {
|
|
60
|
+
(ref as React.MutableRefObject<T | null>).current = value;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function makeClassName(componentName: string) {
|
|
67
|
+
return (className: string) => {
|
|
68
|
+
return `tremor-${componentName}-${className}`;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function getColorClassNames(
|
|
73
|
+
color: Color | "white" | "black" | "transparent",
|
|
74
|
+
shade?: number,
|
|
75
|
+
) {
|
|
76
|
+
if (colorClassNames[color] === undefined) return colorClassNames["gray"][500];
|
|
77
|
+
if (color === "white" || color === "black" || color === "transparent" || !shade) {
|
|
78
|
+
return colorClassNames[color][500];
|
|
79
|
+
}
|
|
80
|
+
return colorClassNames[color][shade];
|
|
81
|
+
}
|