@helpwave/hightide 0.1.21 → 0.1.23
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/README.md +5 -0
- package/dist/components/branding/HelpwaveBadge.js +8 -5
- package/dist/components/branding/HelpwaveBadge.js.map +1 -1
- package/dist/components/branding/HelpwaveBadge.mjs +8 -5
- package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
- package/dist/components/date/DatePicker.js +11 -1
- package/dist/components/date/DatePicker.js.map +1 -1
- package/dist/components/date/DatePicker.mjs +11 -1
- package/dist/components/date/DatePicker.mjs.map +1 -1
- package/dist/components/date/DayPicker.js.map +1 -1
- package/dist/components/date/DayPicker.mjs.map +1 -1
- package/dist/components/date/TimeDisplay.js.map +1 -1
- package/dist/components/date/TimeDisplay.mjs.map +1 -1
- package/dist/components/date/YearMonthPicker.js +1 -0
- package/dist/components/date/YearMonthPicker.js.map +1 -1
- package/dist/components/date/YearMonthPicker.mjs +1 -0
- package/dist/components/date/YearMonthPicker.mjs.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.js +2 -1
- package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
- package/dist/components/dialogs/ConfirmDialog.mjs +2 -1
- package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.d.mts +17 -7
- package/dist/components/icons-and-geometry/Avatar.d.ts +17 -7
- package/dist/components/icons-and-geometry/Avatar.js +2982 -42
- package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.mjs +3010 -40
- package/dist/components/icons-and-geometry/Avatar.mjs.map +1 -1
- package/dist/components/icons-and-geometry/Tag.js +2912 -1
- package/dist/components/icons-and-geometry/Tag.js.map +1 -1
- package/dist/components/icons-and-geometry/Tag.mjs +2931 -1
- package/dist/components/icons-and-geometry/Tag.mjs.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.d.mts +2 -1
- package/dist/components/layout-and-navigation/BreadCrumb.d.ts +2 -1
- package/dist/components/layout-and-navigation/BreadCrumb.js +15 -11
- package/dist/components/layout-and-navigation/BreadCrumb.js.map +1 -1
- package/dist/components/layout-and-navigation/BreadCrumb.mjs +15 -11
- package/dist/components/layout-and-navigation/BreadCrumb.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.js +1 -0
- package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
- package/dist/components/layout-and-navigation/Carousel.mjs +1 -0
- package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Chip.d.mts +6 -2
- package/dist/components/layout-and-navigation/Chip.d.ts +6 -2
- package/dist/components/layout-and-navigation/Chip.js +10 -4
- package/dist/components/layout-and-navigation/Chip.js.map +1 -1
- package/dist/components/layout-and-navigation/Chip.mjs +8 -3
- package/dist/components/layout-and-navigation/Chip.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.js +3 -2
- package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
- package/dist/components/layout-and-navigation/Overlay.mjs +3 -2
- package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.js +3 -2
- package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
- package/dist/components/layout-and-navigation/Pagination.mjs +3 -2
- package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.js +2 -1
- package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs +2 -1
- package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.js +1 -0
- package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
- package/dist/components/layout-and-navigation/StepperBar.mjs +1 -0
- package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
- package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
- package/dist/components/layout-and-navigation/Tile.d.mts +9 -10
- package/dist/components/layout-and-navigation/Tile.d.ts +9 -10
- package/dist/components/layout-and-navigation/Tile.js +21 -4
- package/dist/components/layout-and-navigation/Tile.js.map +1 -1
- package/dist/components/layout-and-navigation/Tile.mjs +20 -4
- package/dist/components/layout-and-navigation/Tile.mjs.map +1 -1
- package/dist/components/loading-states/ErrorComponent.js.map +1 -1
- package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.js +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs +1 -1
- package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
- package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
- package/dist/components/loading-states/LoadingButton.js +1 -0
- package/dist/components/loading-states/LoadingButton.js.map +1 -1
- package/dist/components/loading-states/LoadingButton.mjs +1 -0
- package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
- package/dist/components/modals/ConfirmModal.js +2 -1
- package/dist/components/modals/ConfirmModal.js.map +1 -1
- package/dist/components/modals/ConfirmModal.mjs +2 -1
- package/dist/components/modals/ConfirmModal.mjs.map +1 -1
- package/dist/components/modals/DiscardChangesModal.js +2 -1
- package/dist/components/modals/DiscardChangesModal.js.map +1 -1
- package/dist/components/modals/DiscardChangesModal.mjs +2 -1
- package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
- package/dist/components/modals/InputModal.js +3 -2
- package/dist/components/modals/InputModal.js.map +1 -1
- package/dist/components/modals/InputModal.mjs +3 -2
- package/dist/components/modals/InputModal.mjs.map +1 -1
- package/dist/components/modals/LanguageModal.js +26 -26
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/LanguageModal.mjs +27 -31
- package/dist/components/modals/LanguageModal.mjs.map +1 -1
- package/dist/components/modals/ThemeModal.js +32 -29
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.mjs +31 -32
- package/dist/components/modals/ThemeModal.mjs.map +1 -1
- package/dist/components/properties/CheckboxProperty.js +14 -4
- package/dist/components/properties/CheckboxProperty.js.map +1 -1
- package/dist/components/properties/CheckboxProperty.mjs +14 -4
- package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
- package/dist/components/properties/DateProperty.js +14 -4
- package/dist/components/properties/DateProperty.js.map +1 -1
- package/dist/components/properties/DateProperty.mjs +14 -4
- package/dist/components/properties/DateProperty.mjs.map +1 -1
- package/dist/components/properties/MultiSelectProperty.d.mts +0 -1
- package/dist/components/properties/MultiSelectProperty.d.ts +0 -1
- package/dist/components/properties/MultiSelectProperty.js +663 -648
- package/dist/components/properties/MultiSelectProperty.js.map +1 -1
- package/dist/components/properties/MultiSelectProperty.mjs +779 -768
- package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
- package/dist/components/properties/NumberProperty.js +14 -4
- package/dist/components/properties/NumberProperty.js.map +1 -1
- package/dist/components/properties/NumberProperty.mjs +14 -4
- package/dist/components/properties/NumberProperty.mjs.map +1 -1
- package/dist/components/properties/PropertyBase.js +13 -3
- package/dist/components/properties/PropertyBase.js.map +1 -1
- package/dist/components/properties/PropertyBase.mjs +13 -3
- package/dist/components/properties/PropertyBase.mjs.map +1 -1
- package/dist/components/properties/SelectProperty.d.mts +0 -1
- package/dist/components/properties/SelectProperty.d.ts +0 -1
- package/dist/components/properties/SelectProperty.js +39 -30
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/properties/SelectProperty.mjs +40 -35
- package/dist/components/properties/SelectProperty.mjs.map +1 -1
- package/dist/components/properties/TextProperty.js +16 -6
- package/dist/components/properties/TextProperty.js.map +1 -1
- package/dist/components/properties/TextProperty.mjs +16 -6
- package/dist/components/properties/TextProperty.mjs.map +1 -1
- package/dist/components/table/Table.js +6 -5
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs +7 -10
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/TableFilterButton.js +3 -2
- package/dist/components/table/TableFilterButton.js.map +1 -1
- package/dist/components/table/TableFilterButton.mjs +4 -7
- package/dist/components/table/TableFilterButton.mjs.map +1 -1
- package/dist/components/table/TableSortButton.js +1 -0
- package/dist/components/table/TableSortButton.js.map +1 -1
- package/dist/components/table/TableSortButton.mjs +1 -0
- package/dist/components/table/TableSortButton.mjs.map +1 -1
- package/dist/components/user-action/Button.d.mts +2 -1
- package/dist/components/user-action/Button.d.ts +2 -1
- package/dist/components/user-action/Button.js +12 -1
- package/dist/components/user-action/Button.js.map +1 -1
- package/dist/components/user-action/Button.mjs +12 -1
- package/dist/components/user-action/Button.mjs.map +1 -1
- package/dist/components/user-action/Checkbox.js +1 -1
- package/dist/components/user-action/Checkbox.js.map +1 -1
- package/dist/components/user-action/Checkbox.mjs +1 -1
- package/dist/components/user-action/Checkbox.mjs.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.js.map +1 -1
- package/dist/components/user-action/CopyToClipboardWrapper.mjs.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.js +11 -1
- package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
- package/dist/components/user-action/DateAndTimePicker.mjs +11 -1
- package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
- package/dist/components/user-action/Input.js +1 -1
- package/dist/components/user-action/Input.js.map +1 -1
- package/dist/components/user-action/Input.mjs +1 -1
- package/dist/components/user-action/Input.mjs.map +1 -1
- package/dist/components/user-action/Menu.js +2 -2
- package/dist/components/user-action/Menu.js.map +1 -1
- package/dist/components/user-action/Menu.mjs +3 -7
- package/dist/components/user-action/Menu.mjs.map +1 -1
- package/dist/components/user-action/MultiSelect.d.mts +0 -1
- package/dist/components/user-action/MultiSelect.d.ts +0 -1
- package/dist/components/user-action/MultiSelect.js +622 -616
- package/dist/components/user-action/MultiSelect.js.map +1 -1
- package/dist/components/user-action/MultiSelect.mjs +641 -639
- package/dist/components/user-action/MultiSelect.mjs.map +1 -1
- package/dist/components/user-action/ScrollPicker.js +1 -1
- package/dist/components/user-action/ScrollPicker.js.map +1 -1
- package/dist/components/user-action/ScrollPicker.mjs +1 -1
- package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
- package/dist/components/user-action/SearchBar.js +2 -1
- package/dist/components/user-action/SearchBar.js.map +1 -1
- package/dist/components/user-action/SearchBar.mjs +2 -1
- package/dist/components/user-action/SearchBar.mjs.map +1 -1
- package/dist/components/user-action/Select.d.mts +1 -4
- package/dist/components/user-action/Select.d.ts +1 -4
- package/dist/components/user-action/Select.js +25 -27
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/components/user-action/Select.mjs +26 -31
- package/dist/components/user-action/Select.mjs.map +1 -1
- package/dist/components/user-action/Textarea.js +3 -3
- package/dist/components/user-action/Textarea.js.map +1 -1
- package/dist/components/user-action/Textarea.mjs +3 -3
- package/dist/components/user-action/Textarea.mjs.map +1 -1
- package/dist/css/globals.css +431 -212
- package/dist/css/uncompiled/globals.css +5 -5
- package/dist/css/uncompiled/textstyles.css +5 -5
- package/dist/css/uncompiled/theme/colors-basic.css +13 -5
- package/dist/css/uncompiled/theme/colors-component.css +60 -49
- package/dist/css/uncompiled/theme/colors-semantic.css +76 -78
- package/dist/css/uncompiled/utitlity/shadow.css +45 -16
- package/dist/hooks/useLocalStorage.js +8 -3
- package/dist/hooks/useLocalStorage.js.map +1 -1
- package/dist/hooks/useLocalStorage.mjs +8 -3
- package/dist/hooks/useLocalStorage.mjs.map +1 -1
- package/dist/hooks/useLogOnce.d.mts +8 -0
- package/dist/hooks/useLogOnce.d.ts +8 -0
- package/dist/hooks/useLogOnce.js +53 -0
- package/dist/hooks/useLogOnce.js.map +1 -0
- package/dist/hooks/useLogOnce.mjs +29 -0
- package/dist/hooks/useLogOnce.mjs.map +1 -0
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3301 -435
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3185 -324
- package/dist/index.mjs.map +1 -1
- package/dist/localization/LanguageProvider.js +8 -3
- package/dist/localization/LanguageProvider.js.map +1 -1
- package/dist/localization/LanguageProvider.mjs +8 -3
- package/dist/localization/LanguageProvider.mjs.map +1 -1
- package/dist/localization/useTranslation.js.map +1 -1
- package/dist/localization/useTranslation.mjs.map +1 -1
- package/dist/theming/useTheme.d.mts +2 -2
- package/dist/theming/useTheme.d.ts +2 -2
- package/dist/theming/useTheme.js +26 -22
- package/dist/theming/useTheme.js.map +1 -1
- package/dist/theming/useTheme.mjs +21 -17
- package/dist/theming/useTheme.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
*:focus-visible {
|
|
116
|
-
@apply ring-
|
|
116
|
+
@apply ring-2 ring-focus;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -123,19 +123,19 @@
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
table {
|
|
126
|
-
@apply table-fixed border-separate border-spacing-0;
|
|
126
|
+
@apply table-fixed border-separate border-spacing-0 bg-table-background text-table-text;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
th {
|
|
130
|
-
@apply px-3 first:pl-6 last:pr-6 py-2.5 border-y-1 first:border-l-1 last:border-r-
|
|
130
|
+
@apply px-3 first:pl-6 last:pr-6 py-2.5 border-y-1 first:border-l-1 last:border-r-1 first:rounded-tl-lg last:rounded-tr-lg bg-table-header-background text-label font-bold;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
tbody > tr {
|
|
134
|
-
@apply hover:bg-table-row-hover-background
|
|
134
|
+
@apply hover:bg-table-row-hover-background;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
td {
|
|
138
|
-
@apply px-3 first:pl-6 last:pr-6 py-2.5 border-b-1 first:border-l-1 last:border-r-
|
|
138
|
+
@apply px-3 first:pl-6 last:pr-6 py-2.5 border-b-1 first:border-l-1 last:border-r-1 [nth-last-child(1)]:first:rounded-bl-lg [nth-last-child(1)]:last:rounded-br-lg;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
tbody > tr:last-child > td {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
.textstyle-accent {
|
|
31
|
-
@apply text-sm text-
|
|
31
|
+
@apply text-sm text-label font-bold;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
.textstyle-description {
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.textstyle-label-lg {
|
|
39
|
-
@apply text-
|
|
39
|
+
@apply text-label text-lg font-semibold;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.textstyle-label-md {
|
|
43
|
-
@apply text-
|
|
43
|
+
@apply text-label font-semibold;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
.textstyle-label-sm {
|
|
47
|
-
@apply text-sm text-
|
|
47
|
+
@apply text-sm text-label font-semibold;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
.textstyle-table-name {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
.textstyle-table-header {
|
|
55
|
-
@apply text-
|
|
55
|
+
@apply text-label font-bold;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
.textstyle-navigation-item {
|
|
@@ -4,30 +4,40 @@
|
|
|
4
4
|
* default light-theme basic colors
|
|
5
5
|
*/
|
|
6
6
|
@theme {
|
|
7
|
+
/* Basic */
|
|
7
8
|
--color-white: #FFFFFF;
|
|
8
9
|
--color-black: #000000;
|
|
9
10
|
--color-gray-25: #F8F8F8;
|
|
10
11
|
--color-gray-50: #F2F2F2;
|
|
12
|
+
--color-gray-75: #EEEEEE;
|
|
11
13
|
--color-gray-100: #E6E6E6;
|
|
14
|
+
--color-gray-150: #D8D8D8;
|
|
12
15
|
--color-gray-200: #CCCCCC;
|
|
13
16
|
--color-gray-300: #B3B3B3;
|
|
14
17
|
--color-gray-400: #999999;
|
|
15
18
|
--color-gray-500: #888888;
|
|
19
|
+
--color-gray-550: #777777;
|
|
16
20
|
--color-gray-600: #666666;
|
|
21
|
+
--color-gray-650: #555555;
|
|
17
22
|
--color-gray-700: #4D4D4D;
|
|
23
|
+
--color-gray-750: #3F3F3F;
|
|
18
24
|
--color-gray-800: #333333;
|
|
25
|
+
--color-gray-850: #222222;
|
|
19
26
|
--color-gray-900: #1A1A1A;
|
|
20
27
|
--color-gray-950: #0D0D0D;
|
|
21
28
|
|
|
29
|
+
/* Green */
|
|
22
30
|
--color-green-100: #D1EFD8;
|
|
23
31
|
--color-green-500: #69CB81;
|
|
24
32
|
--color-green-700: #53a567;
|
|
25
33
|
--color-green-900: #2C5536;
|
|
26
34
|
|
|
35
|
+
/* Orange */
|
|
27
36
|
--color-orange-100: #FBECD9;
|
|
28
37
|
--color-orange-200: #F7D8B3;
|
|
29
38
|
--color-orange-500: #EA9E40;
|
|
30
39
|
|
|
40
|
+
/* Purple */
|
|
31
41
|
--color-purple-50: #EFE6FD;
|
|
32
42
|
--color-purple-100: #CEB0FA;
|
|
33
43
|
--color-purple-200: #B892F3;
|
|
@@ -40,13 +50,16 @@
|
|
|
40
50
|
--color-purple-900: #27144A;
|
|
41
51
|
--color-purple-950: #1B0D33;
|
|
42
52
|
|
|
53
|
+
/* Blue */
|
|
43
54
|
--color-blue-50: #F6FAFF;
|
|
44
55
|
--color-blue-100: #D6E3F9;
|
|
45
56
|
--color-blue-200: #99B9EF;
|
|
46
57
|
--color-blue-500: #3272DF;
|
|
47
58
|
--color-blue-600: #285BB2;
|
|
48
59
|
--color-blue-800: #1A4080;
|
|
60
|
+
--color-blue-900: #11243E;
|
|
49
61
|
|
|
62
|
+
/* Red */
|
|
50
63
|
--color-red-50: #FFF9F9;
|
|
51
64
|
--color-red-100: #FBE0E2;
|
|
52
65
|
--color-red-200: #F7C2C5;
|
|
@@ -62,11 +75,6 @@
|
|
|
62
75
|
@layer base {
|
|
63
76
|
/* dark theme */
|
|
64
77
|
@variant dark {
|
|
65
|
-
--color-primary: var(--color-purple-400);
|
|
66
|
-
--color-positive: var(--color-green-700);
|
|
67
|
-
--color-negative: var(--color-red-700);
|
|
68
|
-
--color-negative-border-hover: var(--color-red-600);
|
|
69
78
|
|
|
70
|
-
--color-focus: var(--color-purple-500);
|
|
71
79
|
}
|
|
72
80
|
}
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
* default light-theme component colors
|
|
6
6
|
*/
|
|
7
7
|
@theme {
|
|
8
|
+
/* Icon */
|
|
9
|
+
--color-icon-primary: var(--color-text-primary);
|
|
10
|
+
--color-icon-secondary: var(--color-text-secondary);
|
|
11
|
+
--color-icon-highlight: var(--color-highlight);
|
|
12
|
+
|
|
8
13
|
/* Button Outline */
|
|
9
14
|
--color-button-outline-primary-outline: var(--color-primary);
|
|
10
15
|
--color-button-outline-primary-icon: var(--color-primary);
|
|
@@ -17,12 +22,12 @@
|
|
|
17
22
|
--color-button-solid-secondary-background: var(--color-purple-50);
|
|
18
23
|
--color-button-solid-secondary-text: var(--color-primary);
|
|
19
24
|
--color-button-solid-secondary-icon: var(--color-primary);
|
|
20
|
-
--color-button-solid-tertiary-background:
|
|
21
|
-
--color-button-solid-tertiary-icon:
|
|
22
|
-
--color-button-solid-tertiary-text:
|
|
23
|
-
--color-button-solid-neutral-background:
|
|
24
|
-
--color-button-solid-neutral-icon:
|
|
25
|
-
--color-button-solid-neutral-text:
|
|
25
|
+
--color-button-solid-tertiary-background: var(--color-gray-50);
|
|
26
|
+
--color-button-solid-tertiary-icon: var(--color-gray-500);
|
|
27
|
+
--color-button-solid-tertiary-text: var(--color-gray-500);
|
|
28
|
+
--color-button-solid-neutral-background: var(--color-gray-150);
|
|
29
|
+
--color-button-solid-neutral-icon: var(--color-text-primary);
|
|
30
|
+
--color-button-solid-neutral-text: var(--color-text-primary);
|
|
26
31
|
--color-button-solid-positive-background: var(--color-positive);
|
|
27
32
|
--color-button-solid-positive-icon: var(--color-on-positive);
|
|
28
33
|
--color-button-solid-positive-text: var(--color-on-positive);
|
|
@@ -35,8 +40,8 @@
|
|
|
35
40
|
|
|
36
41
|
/* Button Text */
|
|
37
42
|
--color-button-text-hover-background: #77777733;
|
|
38
|
-
--color-button-text-neutral-text:
|
|
39
|
-
--color-button-text-neutral-icon:
|
|
43
|
+
--color-button-text-neutral-text: var(--color-gray-800);
|
|
44
|
+
--color-button-text-neutral-icon: var(--color-gray-800);
|
|
40
45
|
--color-button-text-negative-text: var(--color-negative);
|
|
41
46
|
--color-button-text-negative-icon: var(--color-negative);
|
|
42
47
|
--color-button-text-primary-text: var(--color-primary);
|
|
@@ -46,14 +51,18 @@
|
|
|
46
51
|
--color-carousel-dot-active: var(--color-primary);
|
|
47
52
|
--color-carousel-dot-disabled: var(--color-disabled-background);
|
|
48
53
|
|
|
54
|
+
/* Input */
|
|
55
|
+
--color-input-background: var(--color-surface);
|
|
56
|
+
--color-input-text: var(--color-on-surface);
|
|
57
|
+
|
|
49
58
|
/* Menu */
|
|
50
|
-
--color-menu-background: var(--color-surface);
|
|
59
|
+
--color-menu-background: var(--color-surface-variant);
|
|
51
60
|
--color-menu-text: var(--color-on-surface);
|
|
52
61
|
--color-menu-border: var(--color-border);
|
|
53
62
|
|
|
54
|
-
/* Overlay */
|
|
55
|
-
--color-overlay-background:
|
|
56
|
-
--color-overlay-text: var(--color-
|
|
63
|
+
/* Overlay, Dialog, Modal */
|
|
64
|
+
--color-overlay-background: var(--color-surface);
|
|
65
|
+
--color-overlay-text: var(--color-on-surface);
|
|
57
66
|
--color-overlay-shadow: #00000039;
|
|
58
67
|
|
|
59
68
|
/* ProgressIndicator */
|
|
@@ -61,23 +70,27 @@
|
|
|
61
70
|
--color-progress-indicator-background: var(--color-gray-300);
|
|
62
71
|
|
|
63
72
|
/* Property */
|
|
64
|
-
--color-property-title-background:
|
|
73
|
+
--color-property-title-background: var(--color-gray-100);
|
|
65
74
|
--color-property-title-text: var(--color-text-secondary);
|
|
66
75
|
|
|
67
76
|
/* Stepper Bar */
|
|
68
77
|
--color-stepperbar-dot-active: var(--color-primary);
|
|
69
78
|
--color-stepperbar-dot-normal: var(--color-purple-100);
|
|
70
|
-
--color-stepperbar-dot-disabled: var(--color-
|
|
79
|
+
--color-stepperbar-dot-disabled: var(--color-description);
|
|
71
80
|
|
|
72
81
|
/* Table */
|
|
73
|
-
--color-
|
|
74
|
-
--color-table-
|
|
75
|
-
--color-table-
|
|
82
|
+
--color-table-background: var(--color-surface);
|
|
83
|
+
--color-table-text: var(--color-on-surface);
|
|
84
|
+
--color-table-header-background: color-mix(in srgb, var(--color-blue-500) 15%, var(--color-surface));
|
|
85
|
+
--color-table-row-hover-background: color-mix(in srgb, var(--color-purple-500) 15%, var(--color-surface));
|
|
76
86
|
|
|
77
87
|
/* Tag */
|
|
78
|
-
--color-tag-dark-background:
|
|
79
|
-
--color-tag-dark-text: var(--color-
|
|
80
|
-
--color-tag-dark-icon: var(--color-
|
|
88
|
+
--color-tag-dark-background: var(--color-gray-800);
|
|
89
|
+
--color-tag-dark-text: var(--color-gray-100);
|
|
90
|
+
--color-tag-dark-icon: var(--color-gray-100);
|
|
91
|
+
--color-tag-default-background: #50687C;
|
|
92
|
+
--color-tag-default-text: var(--color-gray-100);
|
|
93
|
+
--color-tag-default-icon: var(--color-gray-100);
|
|
81
94
|
--color-tag-green-background: #E2E9DB;
|
|
82
95
|
--color-tag-green-text: #7A977E;
|
|
83
96
|
--color-tag-green-icon: #7A977E;
|
|
@@ -97,14 +110,21 @@
|
|
|
97
110
|
/* TextImage */
|
|
98
111
|
--color-text-image-primary-background: var(--color-primary);
|
|
99
112
|
--color-text-image-primary-text: var(--color-white);
|
|
100
|
-
--color-text-image-secondary-background:
|
|
113
|
+
--color-text-image-secondary-background: var(--color-blue-500);
|
|
101
114
|
--color-text-image-secondary-text: var(--color-white);
|
|
102
|
-
--color-text-image-dark-background:
|
|
115
|
+
--color-text-image-dark-background: var(--color-blue-900);
|
|
103
116
|
--color-text-image-dark-text: var(--color-white);
|
|
104
117
|
|
|
105
118
|
/* Tooltip */
|
|
106
|
-
--color-tooltip-background:
|
|
119
|
+
--color-tooltip-background: var(--color-menu-background);
|
|
107
120
|
--color-tooltip-text: var(--color-description);
|
|
121
|
+
|
|
122
|
+
/* Other */
|
|
123
|
+
--color-border: var(--color-gray-200);
|
|
124
|
+
--color-divider: var(--color-gray-100);
|
|
125
|
+
--color-focus: var(--color-purple-400);
|
|
126
|
+
--color-outline: var(--color-gray-100);
|
|
127
|
+
--color-outline-variant: var(--color-gray-200);
|
|
108
128
|
}
|
|
109
129
|
|
|
110
130
|
/* non light-theme overrides */
|
|
@@ -112,41 +132,32 @@
|
|
|
112
132
|
/* dark theme */
|
|
113
133
|
@variant dark {
|
|
114
134
|
/* Button Solid */
|
|
115
|
-
--color-button-solid-neutral-background:
|
|
116
|
-
--color-button-solid-neutral-icon: var(--color-
|
|
117
|
-
--color-button-solid-neutral-text: var(--color-
|
|
135
|
+
--color-button-solid-neutral-background: var(--color-gray-750);
|
|
136
|
+
--color-button-solid-neutral-icon: var(--color-gray-100);
|
|
137
|
+
--color-button-solid-neutral-text: var(--color-gray-100);
|
|
118
138
|
|
|
119
139
|
/* Button Text */
|
|
120
|
-
--color-button-text-hover-background: #
|
|
121
|
-
--color-button-text-neutral-text: var(--color-
|
|
122
|
-
--color-button-text-neutral-icon: var(--color-
|
|
123
|
-
|
|
124
|
-
/* Menu */
|
|
125
|
-
--color-menu-background: #333333;
|
|
126
|
-
--color-menu-text: var(--color-text-light);
|
|
127
|
-
--color-menu-border: var(--color-border);
|
|
140
|
+
--color-button-text-hover-background: #3F3F3F33;
|
|
141
|
+
--color-button-text-neutral-text: var(--color-gray-100);
|
|
142
|
+
--color-button-text-neutral-icon: var(--color-gray-100);
|
|
128
143
|
|
|
129
144
|
/* Property */
|
|
130
|
-
--color-property-title-background:
|
|
131
|
-
--color-property-title-text: var(--color-on-surface);
|
|
145
|
+
--color-property-title-background: var(--color-gray-750);
|
|
132
146
|
|
|
133
147
|
/* ProgressIndicator */
|
|
134
148
|
--color-progress-indicator-background: var(--color-gray-700);
|
|
135
149
|
|
|
136
|
-
/* Overlay */
|
|
137
|
-
--color-overlay-
|
|
138
|
-
--color-overlay-text: var(--color-text-light);
|
|
139
|
-
--color-overlay-shadow: #00000055;
|
|
140
|
-
|
|
141
|
-
/* Table */
|
|
142
|
-
--color-tabel-header-background: #2F2F2F;
|
|
143
|
-
--color-table-row-hover-background: #2f2841;
|
|
150
|
+
/* Overlay, Dialog, Modal */
|
|
151
|
+
--color-overlay-shadow: #00000060;
|
|
144
152
|
|
|
145
153
|
/* Tag */
|
|
146
|
-
--color-tag-dark-background:
|
|
147
|
-
|
|
148
|
-
/*
|
|
149
|
-
--color-
|
|
150
|
-
--color-
|
|
154
|
+
--color-tag-dark-background: var(--color-gray-900);
|
|
155
|
+
|
|
156
|
+
/* Other */
|
|
157
|
+
--color-border: var(--color-gray-600);
|
|
158
|
+
--color-divider: var(--color-gray-700);
|
|
159
|
+
--color-focus: var(--color-purple-500);
|
|
160
|
+
--color-outline: var(--color-gray-700);
|
|
161
|
+
--color-outline-variant: var(--color-gray-600);
|
|
151
162
|
}
|
|
152
163
|
}
|
|
@@ -5,98 +5,96 @@
|
|
|
5
5
|
* default light-theme sematic colors
|
|
6
6
|
*/
|
|
7
7
|
@theme {
|
|
8
|
-
|
|
9
|
-
--color-
|
|
10
|
-
--color-
|
|
8
|
+
/* Background */
|
|
9
|
+
--color-background: var(--color-gray-75);
|
|
10
|
+
--color-on-background: var(--color-text-primary);
|
|
11
|
+
|
|
12
|
+
/* Gender */
|
|
13
|
+
--color-gender-female: var(--color-red-400);
|
|
14
|
+
--color-gender-female-outline: var(--color-red-300);
|
|
15
|
+
--color-gender-female-surface: var(--color-red-100);
|
|
16
|
+
--color-gender-female-background: var(--color-red-50);
|
|
17
|
+
|
|
18
|
+
--color-gender-male: var(--color-blue-500);
|
|
19
|
+
--color-gender-male-outline: var(--color-blue-200);
|
|
20
|
+
--color-gender-male-surface: var(--color-blue-100);
|
|
21
|
+
--color-gender-male-background: var(--color-blue-50);
|
|
22
|
+
|
|
23
|
+
--color-gender-neutral: var(--color-gray-700);
|
|
24
|
+
--color-gender-neutral-outline: var(--color-gray-300);
|
|
25
|
+
--color-gender-neutral-surface: var(--color-gray-100);
|
|
26
|
+
--color-gender-neutral-background: var(--color-gray-25);
|
|
27
|
+
|
|
28
|
+
/* States */
|
|
29
|
+
--color-warning: var(--color-orange-500);
|
|
30
|
+
--color-on-warning: var(--color-white);
|
|
11
31
|
|
|
12
|
-
--color-primary: var(--color-purple-500);
|
|
13
|
-
--color-on-primary: #FFFFFF;
|
|
14
|
-
--color-secondary: #11243E;
|
|
15
|
-
--color-on-secondary: #FFFFFF;
|
|
16
|
-
--color-warning: var(--color-yellow-500);
|
|
17
|
-
--color-on-warning: #FFFFFF;
|
|
18
32
|
--color-positive: var(--color-green-500);
|
|
19
|
-
--color-on-positive:
|
|
33
|
+
--color-on-positive: var(--color-white);
|
|
34
|
+
|
|
20
35
|
--color-negative: var(--color-red-500);
|
|
21
|
-
--color-on-negative:
|
|
36
|
+
--color-on-negative: var(--color-white);
|
|
22
37
|
--color-negative-border: var(--color-negative);
|
|
23
38
|
--color-negative-border-hover: var(--color-red-700);
|
|
24
|
-
|
|
25
|
-
--color-
|
|
26
|
-
--color-
|
|
27
|
-
--color-surface-warning: #FBECD9;
|
|
28
|
-
--color-highlight: #3272DF;
|
|
29
|
-
--color-background: #EEEEEE;
|
|
30
|
-
--color-on-background: var(--color-text-dark);
|
|
31
|
-
|
|
32
|
-
--color-female: var(--color-red-400);
|
|
33
|
-
--color-female-outline: var(--color-red-300);
|
|
34
|
-
--color-female-surface: var(--color-red-100);
|
|
35
|
-
--color-female-background: var(--color-red-50);
|
|
36
|
-
|
|
37
|
-
--color-male: var(--color-blue-400);
|
|
38
|
-
--color-male-outline: var(--color-blue-300);
|
|
39
|
-
--color-male-surface: var(--color-blue-100);
|
|
40
|
-
--color-male-background: var(--color-blue-50);
|
|
41
|
-
|
|
42
|
-
--color-neutral: #4D4D4D;
|
|
43
|
-
--color-neutral-outline: #B3B3B3;
|
|
44
|
-
--color-neutral-surface: #E6E6E6;
|
|
45
|
-
--color-neutral-background: #F8F8F8;
|
|
46
|
-
|
|
47
|
-
--color-text-primary: var(--color-text-default);
|
|
48
|
-
--color-text-secondary: #666666;
|
|
49
|
-
--color-text-tertiary: #B3B3B3;
|
|
50
|
-
--color-text-highlight: #3272DF;
|
|
51
|
-
--color-text-label: #4D4D4D;
|
|
52
|
-
--color-icon-primary: var(--color-text-primary);
|
|
53
|
-
--color-icon-secondary: var(--color-text-secondary);
|
|
54
|
-
--color-icon-highlight: var(--color-text-highlight);
|
|
55
|
-
--color-divider: #E6E6E6;
|
|
56
|
-
--color-description: #555555;
|
|
57
|
-
--color-outline: #E6E6E6;
|
|
58
|
-
--color-outline-variant: #CCCCCC;
|
|
59
|
-
|
|
60
|
-
--color-disabled-background: #E2E2E2;
|
|
61
|
-
--color-disabled-text: #888888;
|
|
39
|
+
|
|
40
|
+
--color-disabled-background: var(--color-gray-200);
|
|
41
|
+
--color-disabled-text: var(--color-gray-400);
|
|
62
42
|
--color-disabled-icon: var(--color-disabled-text);
|
|
63
|
-
--color-disabled-border:
|
|
43
|
+
--color-disabled-border: var(--color-gray-300);
|
|
64
44
|
--color-disabled-outline: var(--color-disabled-border);
|
|
65
45
|
|
|
66
|
-
|
|
46
|
+
/* Surface */
|
|
47
|
+
--color-surface: var(--color-white);
|
|
48
|
+
--color-on-surface: var(--color-text-primary);
|
|
49
|
+
--color-surface-variant: var(--color-gray-25);
|
|
50
|
+
--color-surface-warning: var(--color-orange-100);
|
|
51
|
+
|
|
52
|
+
/* Text */
|
|
53
|
+
--color-text-primary: var(--color-gray-900);
|
|
54
|
+
--color-text-secondary: var(--color-gray-600);
|
|
55
|
+
--color-text-tertiary: var(--color-gray-300);
|
|
56
|
+
--color-text-highlight: var(--color-highlight);
|
|
57
|
+
--color-description: var(--color-gray-600);
|
|
58
|
+
--color-label: var(--color-gray-700);
|
|
67
59
|
|
|
68
|
-
|
|
60
|
+
/* Other */
|
|
61
|
+
--color-primary: var(--color-purple-500);
|
|
62
|
+
--color-on-primary: var(--color-white);
|
|
63
|
+
--color-secondary: var(--color-blue-800);
|
|
64
|
+
--color-on-secondary: var(--color-white);
|
|
65
|
+
--color-highlight: var(--color-blue-500);
|
|
69
66
|
}
|
|
70
67
|
|
|
71
68
|
/* non light-theme overrides */
|
|
72
69
|
@layer base {
|
|
73
70
|
/* dark theme */
|
|
74
71
|
@variant dark {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
--color-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
--color-
|
|
81
|
-
|
|
82
|
-
--color-
|
|
83
|
-
--color-
|
|
84
|
-
|
|
85
|
-
--color-
|
|
86
|
-
|
|
87
|
-
--color-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
--color-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
--color-text-
|
|
95
|
-
--color-text-
|
|
96
|
-
--color-
|
|
97
|
-
|
|
98
|
-
--color-
|
|
99
|
-
|
|
100
|
-
|
|
72
|
+
/* Background */
|
|
73
|
+
--color-background: var(--color-gray-850);
|
|
74
|
+
--color-on-background: var(--color-text-primary);
|
|
75
|
+
|
|
76
|
+
/* States */
|
|
77
|
+
--color-positive: var(--color-green-700);
|
|
78
|
+
|
|
79
|
+
--color-negative: var(--color-red-500);
|
|
80
|
+
--color-negative-border-hover: var(--color-red-600);
|
|
81
|
+
|
|
82
|
+
--color-disabled-background: var(--color-gray-800);
|
|
83
|
+
--color-disabled-text: var(--color-gray-600);
|
|
84
|
+
--color-disabled-border: var(--color-gray-850);
|
|
85
|
+
|
|
86
|
+
/* Surface */
|
|
87
|
+
--color-surface: var(--color-gray-800);
|
|
88
|
+
--color-surface-variant: var(--color-gray-700);
|
|
89
|
+
|
|
90
|
+
/* Text */
|
|
91
|
+
--color-text-primary: var(--color-gray-100);
|
|
92
|
+
--color-text-secondary: var(--color-gray-400);
|
|
93
|
+
--color-text-tertiary: var(--color-gray-600);
|
|
94
|
+
--color-description: var(--color-gray-400);
|
|
95
|
+
--color-label: var(--color-gray-300);
|
|
96
|
+
|
|
97
|
+
/* Other */
|
|
98
|
+
--color-primary: var(--color-purple-400);
|
|
101
99
|
}
|
|
102
100
|
}
|
|
@@ -1,29 +1,58 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
|
|
3
|
+
@utility shadow-side {
|
|
4
|
+
box-shadow: var(--shadow-right, 0 0 0 transparent),
|
|
5
|
+
var(--shadow-left, 0 0 0 transparent),
|
|
6
|
+
var(--shadow-top, 0 0 0 transparent),
|
|
7
|
+
var(--shadow-bottom, 0 0 0 transparent);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@utility shadow-r-* {
|
|
11
|
+
--shadow-right: calc(--value(number) * 1px) 0 calc(--value(number) * 1px) 0 var(--tw-shadow-color, rgb(0 0 0 / 2%));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@utility shadow-l-* {
|
|
15
|
+
--shadow-left: calc(--value(number) * -1px) 0 calc(--value(number) * 1px) 0 var(--tw-shadow-color, rgb(0 0 0 / 2%));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@utility shadow-t-* {
|
|
19
|
+
--shadow-top: 0 calc(--value(number) * -1px) calc(--value(number) * 1px) 0 var(--tw-shadow-color, rgb(0 0 0 / 2%));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@utility shadow-b-* {
|
|
23
|
+
--shadow-bottom: 0 calc(--value(number) * 1px) calc(--value(number) * 1px) 0 var(--tw-shadow-color, rgb(0 0 0 / 2%));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@utility shadow-around-* {
|
|
27
|
+
--shadow-right: calc(--value(number) * 1px) 0 calc(--value(number) * 1px) 0 var(--tw-shadow-color, rgb(0 0 0 / 2%));
|
|
28
|
+
--shadow-left: calc(--value(number) * -1px) 0 calc(--value(number) * 1px) 0 var(--tw-shadow-color, rgb(0 0 0 / 2%));
|
|
29
|
+
--shadow-top: 0 calc(--value(number) * -1px) calc(--value(number) * 1px) 0 var(--tw-shadow-color, rgb(0 0 0 / 2%));
|
|
30
|
+
--shadow-bottom: 0 calc(--value(number) * 1px) calc(--value(number) * 1px) 0 var(--tw-shadow-color, rgb(0 0 0 / 2%));
|
|
31
|
+
@apply shadow-side;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@utility shadow-strong {
|
|
35
|
+
--tw-shadow-color: rgba(0, 0, 0, 0.06);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@utility shadow-hard {
|
|
39
|
+
--tw-shadow-color: rgba(0, 0, 0, 0.10);
|
|
40
|
+
}
|
|
41
|
+
|
|
1
42
|
@layer utilities {
|
|
2
43
|
.shadow-around {
|
|
3
|
-
|
|
4
|
-
0 -2px 2px 0 rgba(0, 0, 0, 0.02),
|
|
5
|
-
2px 0 2px 0 rgba(0, 0, 0, 0.02),
|
|
6
|
-
-2px 0 2px 0 rgba(0, 0, 0, 0.02);
|
|
44
|
+
@apply shadow-around-2;
|
|
7
45
|
}
|
|
8
46
|
|
|
9
47
|
.shadow-around-md {
|
|
10
|
-
|
|
11
|
-
0 -5px 5px 0 rgba(0, 0, 0, 0.02),
|
|
12
|
-
5px 0 5px 0 rgba(0, 0, 0, 0.02),
|
|
13
|
-
-5px 0 5px 0 rgba(0, 0, 0, 0.02);
|
|
48
|
+
@apply shadow-around-5;
|
|
14
49
|
}
|
|
15
50
|
|
|
16
51
|
.shadow-around-lg {
|
|
17
|
-
|
|
18
|
-
0 -10px 10px 0 rgba(0, 0, 0, 0.02),
|
|
19
|
-
10px 0 10px 0 rgba(0, 0, 0, 0.02),
|
|
20
|
-
-10px 0 10px 0 rgba(0, 0, 0, 0.02);
|
|
52
|
+
@apply shadow-around-10;
|
|
21
53
|
}
|
|
22
54
|
|
|
23
55
|
.shadow-around-xl {
|
|
24
|
-
|
|
25
|
-
0 -20px 20px 0 rgba(0, 0, 0, 0.02),
|
|
26
|
-
20px 0 20px 0 rgba(0, 0, 0, 0.02),
|
|
27
|
-
-20px 0 20px 0 rgba(0, 0, 0, 0.02);
|
|
56
|
+
@apply shadow-around-20;
|
|
28
57
|
}
|
|
29
58
|
}
|
|
@@ -53,6 +53,11 @@ var LocalStorageService = class extends StorageService {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
// src/util/resolveSetState.ts
|
|
57
|
+
function resolveSetState(action, prev) {
|
|
58
|
+
return typeof action === "function" ? action(prev) : action;
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
// src/hooks/useLocalStorage.ts
|
|
57
62
|
var useLocalStorage = (key, initValue) => {
|
|
58
63
|
const get = (0, import_react.useCallback)(() => {
|
|
@@ -64,10 +69,10 @@ var useLocalStorage = (key, initValue) => {
|
|
|
64
69
|
return value || initValue;
|
|
65
70
|
}, [initValue, key]);
|
|
66
71
|
const [storedValue, setStoredValue] = (0, import_react.useState)(get);
|
|
67
|
-
const setValue = (0, import_react.useCallback)((
|
|
68
|
-
const newValue =
|
|
72
|
+
const setValue = (0, import_react.useCallback)((action) => {
|
|
73
|
+
const newValue = resolveSetState(action, storedValue);
|
|
69
74
|
const storageService = new LocalStorageService();
|
|
70
|
-
storageService.set(key,
|
|
75
|
+
storageService.set(key, newValue);
|
|
71
76
|
setStoredValue(newValue);
|
|
72
77
|
}, [storedValue, setStoredValue, key]);
|
|
73
78
|
(0, import_react.useEffect)(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useLocalStorage.ts","../../src/util/storage.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from 'react'\nimport { useCallback, useEffect, useState } from 'react'\nimport { LocalStorageService } from '../util/storage'\n\ntype SetValue<T> = Dispatch<SetStateAction<T>>\nexport const useLocalStorage = <T>(key: string, initValue: T): [T, SetValue<T>] => {\n const get = useCallback((): T => {\n if (typeof window === 'undefined') {\n return initValue\n }\n const storageService = new LocalStorageService()\n const value = storageService.get<T>(key)\n return value || initValue\n }, [initValue, key])\n\n const [storedValue, setStoredValue] = useState<T>(get)\n\n const setValue: SetValue<T> = useCallback(
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useLocalStorage.ts","../../src/util/storage.ts","../../src/util/resolveSetState.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from 'react'\nimport { useCallback, useEffect, useState } from 'react'\nimport { LocalStorageService } from '../util/storage'\nimport { resolveSetState } from '../util/resolveSetState'\n\ntype SetValue<T> = Dispatch<SetStateAction<T>>\nexport const useLocalStorage = <T>(key: string, initValue: T): [T, SetValue<T>] => {\n const get = useCallback((): T => {\n if (typeof window === 'undefined') {\n return initValue\n }\n const storageService = new LocalStorageService()\n const value = storageService.get<T>(key)\n return value || initValue\n }, [initValue, key])\n\n const [storedValue, setStoredValue] = useState<T>(get)\n\n const setValue: SetValue<T> = useCallback(action => {\n const newValue = resolveSetState(action, storedValue)\n const storageService = new LocalStorageService()\n storageService.set(key, newValue)\n\n setStoredValue(newValue)\n }, [storedValue, setStoredValue, key])\n\n useEffect(() => {\n setStoredValue(get())\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return [storedValue, setValue]\n}","class StorageService {\n // this seems to be a bug in eslint as 'paramter-properties' is a special syntax of typescript\n\n constructor(private storage: Storage) {\n }\n\n public get<T>(key: string): T | null {\n const value = this.storage.getItem(key)\n if (value === null) {\n return null\n }\n return JSON.parse(value)\n }\n\n public set<T>(key: string, value: T) {\n this.storage.setItem(key, JSON.stringify(value))\n }\n\n public delete(key: string) {\n this.storage.removeItem(key)\n }\n\n public deleteAll() {\n this.storage.clear()\n }\n}\n\nexport class LocalStorageService extends StorageService {\n constructor() {\n super(window.localStorage)\n }\n}\n\nexport class SessionStorageService extends StorageService {\n constructor() {\n super(window.sessionStorage)\n }\n}\n","import type { SetStateAction } from 'react'\n\nexport function resolveSetState<T>(action: SetStateAction<T>, prev: T): T {\n return typeof action === 'function' ? (action as (prev: T) => T)(prev) : action\n}"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAiD;;;ACDjD,IAAM,iBAAN,MAAqB;AAAA;AAAA,EAGnB,YAAoB,SAAkB;AAAlB;AAAA,EACpB;AAAA,EAEO,IAAO,KAAuB;AACnC,UAAM,QAAQ,KAAK,QAAQ,QAAQ,GAAG;AACtC,QAAI,UAAU,MAAM;AAClB,aAAO;AAAA,IACT;AACA,WAAO,KAAK,MAAM,KAAK;AAAA,EACzB;AAAA,EAEO,IAAO,KAAa,OAAU;AACnC,SAAK,QAAQ,QAAQ,KAAK,KAAK,UAAU,KAAK,CAAC;AAAA,EACjD;AAAA,EAEO,OAAO,KAAa;AACzB,SAAK,QAAQ,WAAW,GAAG;AAAA,EAC7B;AAAA,EAEO,YAAY;AACjB,SAAK,QAAQ,MAAM;AAAA,EACrB;AACF;AAEO,IAAM,sBAAN,cAAkC,eAAe;AAAA,EACtD,cAAc;AACZ,UAAM,OAAO,YAAY;AAAA,EAC3B;AACF;;;AC7BO,SAAS,gBAAmB,QAA2B,MAAY;AACxE,SAAO,OAAO,WAAW,aAAc,OAA0B,IAAI,IAAI;AAC3E;;;AFEO,IAAM,kBAAkB,CAAI,KAAa,cAAmC;AACjF,QAAM,UAAM,0BAAY,MAAS;AAC/B,QAAI,OAAO,WAAW,aAAa;AACjC,aAAO;AAAA,IACT;AACA,UAAM,iBAAiB,IAAI,oBAAoB;AAC/C,UAAM,QAAQ,eAAe,IAAO,GAAG;AACvC,WAAO,SAAS;AAAA,EAClB,GAAG,CAAC,WAAW,GAAG,CAAC;AAEnB,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAY,GAAG;AAErD,QAAM,eAAwB,0BAAY,YAAU;AAClD,UAAM,WAAW,gBAAgB,QAAQ,WAAW;AACpD,UAAM,iBAAiB,IAAI,oBAAoB;AAC/C,mBAAe,IAAI,KAAK,QAAQ;AAEhC,mBAAe,QAAQ;AAAA,EACzB,GAAG,CAAC,aAAa,gBAAgB,GAAG,CAAC;AAErC,8BAAU,MAAM;AACd,mBAAe,IAAI,CAAC;AAAA,EACtB,GAAG,CAAC,CAAC;AAEL,SAAO,CAAC,aAAa,QAAQ;AAC/B;","names":[]}
|
|
@@ -30,6 +30,11 @@ var LocalStorageService = class extends StorageService {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
// src/util/resolveSetState.ts
|
|
34
|
+
function resolveSetState(action, prev) {
|
|
35
|
+
return typeof action === "function" ? action(prev) : action;
|
|
36
|
+
}
|
|
37
|
+
|
|
33
38
|
// src/hooks/useLocalStorage.ts
|
|
34
39
|
var useLocalStorage = (key, initValue) => {
|
|
35
40
|
const get = useCallback(() => {
|
|
@@ -41,10 +46,10 @@ var useLocalStorage = (key, initValue) => {
|
|
|
41
46
|
return value || initValue;
|
|
42
47
|
}, [initValue, key]);
|
|
43
48
|
const [storedValue, setStoredValue] = useState(get);
|
|
44
|
-
const setValue = useCallback((
|
|
45
|
-
const newValue =
|
|
49
|
+
const setValue = useCallback((action) => {
|
|
50
|
+
const newValue = resolveSetState(action, storedValue);
|
|
46
51
|
const storageService = new LocalStorageService();
|
|
47
|
-
storageService.set(key,
|
|
52
|
+
storageService.set(key, newValue);
|
|
48
53
|
setStoredValue(newValue);
|
|
49
54
|
}, [storedValue, setStoredValue, key]);
|
|
50
55
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useLocalStorage.ts","../../src/util/storage.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from 'react'\nimport { useCallback, useEffect, useState } from 'react'\nimport { LocalStorageService } from '../util/storage'\n\ntype SetValue<T> = Dispatch<SetStateAction<T>>\nexport const useLocalStorage = <T>(key: string, initValue: T): [T, SetValue<T>] => {\n const get = useCallback((): T => {\n if (typeof window === 'undefined') {\n return initValue\n }\n const storageService = new LocalStorageService()\n const value = storageService.get<T>(key)\n return value || initValue\n }, [initValue, key])\n\n const [storedValue, setStoredValue] = useState<T>(get)\n\n const setValue: SetValue<T> = useCallback(
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useLocalStorage.ts","../../src/util/storage.ts","../../src/util/resolveSetState.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from 'react'\nimport { useCallback, useEffect, useState } from 'react'\nimport { LocalStorageService } from '../util/storage'\nimport { resolveSetState } from '../util/resolveSetState'\n\ntype SetValue<T> = Dispatch<SetStateAction<T>>\nexport const useLocalStorage = <T>(key: string, initValue: T): [T, SetValue<T>] => {\n const get = useCallback((): T => {\n if (typeof window === 'undefined') {\n return initValue\n }\n const storageService = new LocalStorageService()\n const value = storageService.get<T>(key)\n return value || initValue\n }, [initValue, key])\n\n const [storedValue, setStoredValue] = useState<T>(get)\n\n const setValue: SetValue<T> = useCallback(action => {\n const newValue = resolveSetState(action, storedValue)\n const storageService = new LocalStorageService()\n storageService.set(key, newValue)\n\n setStoredValue(newValue)\n }, [storedValue, setStoredValue, key])\n\n useEffect(() => {\n setStoredValue(get())\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return [storedValue, setValue]\n}","class StorageService {\n // this seems to be a bug in eslint as 'paramter-properties' is a special syntax of typescript\n\n constructor(private storage: Storage) {\n }\n\n public get<T>(key: string): T | null {\n const value = this.storage.getItem(key)\n if (value === null) {\n return null\n }\n return JSON.parse(value)\n }\n\n public set<T>(key: string, value: T) {\n this.storage.setItem(key, JSON.stringify(value))\n }\n\n public delete(key: string) {\n this.storage.removeItem(key)\n }\n\n public deleteAll() {\n this.storage.clear()\n }\n}\n\nexport class LocalStorageService extends StorageService {\n constructor() {\n super(window.localStorage)\n }\n}\n\nexport class SessionStorageService extends StorageService {\n constructor() {\n super(window.sessionStorage)\n }\n}\n","import type { SetStateAction } from 'react'\n\nexport function resolveSetState<T>(action: SetStateAction<T>, prev: T): T {\n return typeof action === 'function' ? (action as (prev: T) => T)(prev) : action\n}"],"mappings":";AACA,SAAS,aAAa,WAAW,gBAAgB;;;ACDjD,IAAM,iBAAN,MAAqB;AAAA;AAAA,EAGnB,YAAoB,SAAkB;AAAlB;AAAA,EACpB;AAAA,EAEO,IAAO,KAAuB;AACnC,UAAM,QAAQ,KAAK,QAAQ,QAAQ,GAAG;AACtC,QAAI,UAAU,MAAM;AAClB,aAAO;AAAA,IACT;AACA,WAAO,KAAK,MAAM,KAAK;AAAA,EACzB;AAAA,EAEO,IAAO,KAAa,OAAU;AACnC,SAAK,QAAQ,QAAQ,KAAK,KAAK,UAAU,KAAK,CAAC;AAAA,EACjD;AAAA,EAEO,OAAO,KAAa;AACzB,SAAK,QAAQ,WAAW,GAAG;AAAA,EAC7B;AAAA,EAEO,YAAY;AACjB,SAAK,QAAQ,MAAM;AAAA,EACrB;AACF;AAEO,IAAM,sBAAN,cAAkC,eAAe;AAAA,EACtD,cAAc;AACZ,UAAM,OAAO,YAAY;AAAA,EAC3B;AACF;;;AC7BO,SAAS,gBAAmB,QAA2B,MAAY;AACxE,SAAO,OAAO,WAAW,aAAc,OAA0B,IAAI,IAAI;AAC3E;;;AFEO,IAAM,kBAAkB,CAAI,KAAa,cAAmC;AACjF,QAAM,MAAM,YAAY,MAAS;AAC/B,QAAI,OAAO,WAAW,aAAa;AACjC,aAAO;AAAA,IACT;AACA,UAAM,iBAAiB,IAAI,oBAAoB;AAC/C,UAAM,QAAQ,eAAe,IAAO,GAAG;AACvC,WAAO,SAAS;AAAA,EAClB,GAAG,CAAC,WAAW,GAAG,CAAC;AAEnB,QAAM,CAAC,aAAa,cAAc,IAAI,SAAY,GAAG;AAErD,QAAM,WAAwB,YAAY,YAAU;AAClD,UAAM,WAAW,gBAAgB,QAAQ,WAAW;AACpD,UAAM,iBAAiB,IAAI,oBAAoB;AAC/C,mBAAe,IAAI,KAAK,QAAQ;AAEhC,mBAAe,QAAQ;AAAA,EACzB,GAAG,CAAC,aAAa,gBAAgB,GAAG,CAAC;AAErC,YAAU,MAAM;AACd,mBAAe,IAAI,CAAC;AAAA,EACtB,GAAG,CAAC,CAAC;AAEL,SAAO,CAAC,aAAa,QAAQ;AAC/B;","names":[]}
|