@fibery/ui-kit 1.40.4 → 1.41.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/CHANGELOG.md +6 -0
- package/eslint.config.mjs +16 -0
- package/package.json +8 -7
- package/src/a11y-color.test.ts +5 -24
- package/src/actions-menu/actions-menu-item.tsx +6 -9
- package/src/actions-menu/context-actions-menu.tsx +8 -3
- package/src/ai/model.tsx +0 -1
- package/src/ai/temperature.tsx +0 -1
- package/src/animated-height-container.tsx +3 -3
- package/src/antd/index.tsx +3 -0
- package/src/antd/input.tsx +0 -1
- package/src/antd/styles.ts +9 -9
- package/src/app-icon-with-fallback.tsx +5 -5
- package/src/app-icon-wrapper.tsx +2 -3
- package/src/app-icon.tsx +3 -3
- package/src/avatar.tsx +3 -3
- package/src/button/base-button.tsx +0 -1
- package/src/button/make-button-colors.ts +2 -2
- package/src/checkbox.tsx +1 -1
- package/src/collapsible-section.tsx +11 -1
- package/src/color-utils.test.ts +15 -25
- package/src/color-utils.ts +43 -8
- package/src/command-menu/index.tsx +1 -0
- package/src/context-menu/index.tsx +5 -5
- package/src/date-picker/contexts.ts +2 -2
- package/src/date-picker/date-range-picker.tsx +3 -4
- package/src/date-picker/single-date-picker.tsx +147 -119
- package/src/date-picker/types.ts +4 -3
- package/src/day-select/iso-week-day-select.tsx +2 -2
- package/src/day-select/week-day-select.tsx +2 -2
- package/src/delayed.tsx +0 -1
- package/src/design-system/alpha.test.ts +59 -0
- package/src/design-system/alpha.ts +41 -0
- package/src/design-system/animation.ts +10 -0
- package/src/design-system/colors-css.test.ts +39 -0
- package/src/design-system/colors-css.ts +25 -0
- package/src/design-system/colors-js.test.ts +232 -0
- package/src/design-system/colors-js.ts +107 -0
- package/src/design-system/colors.test.ts +74 -0
- package/src/{design-system.colors.ts → design-system/colors.ts} +133 -134
- package/src/design-system/date.ts +3 -0
- package/src/design-system/layout.ts +106 -0
- package/src/design-system/theme.test.ts +94 -0
- package/src/design-system/theme.ts +93 -0
- package/src/design-system/typography.ts +179 -0
- package/src/design-system/vars.test.ts +1679 -0
- package/src/design-system/vars.ts +52 -0
- package/src/design-system.test.ts +46 -303
- package/src/design-system.ts +25 -545
- package/src/dropdown-menu/index.tsx +5 -5
- package/src/emoji-picker/icon-emoji-picker.tsx +1 -1
- package/src/fibermoji-placeholder.tsx +3 -3
- package/src/field-container.tsx +11 -2
- package/src/file-item/file-icon.tsx +3 -3
- package/src/file-item-2.tsx +4 -10
- package/src/file-item.tsx +0 -1
- package/src/icons/ast/ChatBubble.ts +8 -0
- package/src/icons/ast/ChatFloat.ts +8 -0
- package/src/icons/ast/ChatSidebar.ts +8 -0
- package/src/icons/ast/FileOther.ts +8 -0
- package/src/icons/ast/NoBorder.ts +8 -0
- package/src/icons/ast/NoFill.ts +8 -0
- package/src/icons/ast/index.tsx +6 -0
- package/src/icons/react/ChatBubble.tsx +13 -0
- package/src/icons/react/ChatFloat.tsx +13 -0
- package/src/icons/react/ChatSidebar.tsx +13 -0
- package/src/icons/react/FileOther.tsx +13 -0
- package/src/icons/react/NoBorder.tsx +13 -0
- package/src/icons/react/NoFill.tsx +13 -0
- package/src/icons/react/index.tsx +6 -0
- package/src/icons/svg/chat-bubble.svg +4 -0
- package/src/icons/svg/chat-float.svg +4 -0
- package/src/icons/svg/chat-sidebar.svg +4 -0
- package/src/icons/svg/file-other.svg +3 -0
- package/src/icons/svg/no-border.svg +17 -0
- package/src/icons/svg/no-fill.svg +4 -0
- package/src/images-gallery/images-gallery.tsx +8 -6
- package/src/images-gallery/slide-buttons.tsx +2 -2
- package/src/is-iOS.ts +0 -1
- package/src/is-in-popup.ts +2 -1
- package/src/lists/actions-menu-row-surface.tsx +4 -4
- package/src/loading-sausage.tsx +2 -2
- package/src/media-query-utils.ts +1 -2
- package/src/mobile-keyboard-aware-popup.tsx +2 -2
- package/src/modal-menu/modal-menu-content.tsx +2 -2
- package/src/number-input/decimal.js +9 -7
- package/src/number-input/{number-inline-input-with-autosize.tsx → number-input-inline-with-autosize.tsx} +20 -41
- package/src/number-input/number-input-inline.tsx +118 -0
- package/src/number-input/{index.test.js → number-input.test.tsx} +38 -43
- package/src/number-input/number-input.tsx +63 -121
- package/src/number-input/types.ts +19 -0
- package/src/number-input/utils.ts +61 -0
- package/src/online-users.tsx +2 -2
- package/src/palette-generator.test.ts +24 -281
- package/src/palette-generator.ts +39 -45
- package/src/palettes/_.ts +72 -0
- package/src/palettes/slate-arch.colors-snapshot.test.ts +1689 -0
- package/src/palettes/slate-arch.ts +188 -0
- package/src/palettes/slate-user.colors-snapshot.test.ts +1689 -0
- package/src/palettes/slate-user.ts +187 -0
- package/src/palettes/warm-arch.colors-snapshot.test.ts +1689 -0
- package/src/palettes/warm-arch.ts +222 -0
- package/src/palettes/warm-user.colors-snapshot.test.ts +1689 -0
- package/src/palettes/warm-user.ts +222 -0
- package/src/popover/get-element-ref.ts +28 -0
- package/src/popover/index.tsx +232 -333
- package/src/popover/{mobile-popup-context.tsx → mobile-popover-context.tsx} +7 -7
- package/src/popover/mobile-popover.tsx +169 -0
- package/src/popover/modifiers.tsx +2 -2
- package/src/popover/popup-stack-context.tsx +8 -9
- package/src/root-theme-provider.test.tsx +114 -19
- package/src/scale-generator.ts +31 -22
- package/src/select/components/menu-list-virtualized.tsx +5 -3
- package/src/select/index.tsx +6 -5
- package/src/select/select.tsx +36 -38
- package/src/select/util.ts +1 -1
- package/src/static-palettes.ts +221 -11
- package/src/thematic-controls.tsx +6 -6
- package/src/thematic-scales.tsx +15 -15
- package/src/thematic-state.ts +57 -20
- package/src/thematic.tsx +36 -32
- package/src/theme-provider.test.tsx +31 -19
- package/src/theme-provider.tsx +41 -38
- package/src/theme-settings.ts +66 -11
- package/src/theme-styles.ts +53 -8
- package/src/toast/toast.tsx +1 -2
- package/src/toggle.tsx +2 -2
- package/src/tooltip.tsx +4 -3
- package/src/type-badge.tsx +4 -11
- package/src/unit/styles.ts +0 -23
- package/src/use-is-phone.tsx +7 -2
- package/src/use-on-screen-keyboard-data.tsx +2 -2
- package/src/with-data.tsx +4 -3
- package/src/workflow-progress-icon.tsx +2 -2
- package/.eslintignore +0 -3
- package/.eslintrc +0 -14
- package/src/__mocks__/createInlineTheme.js +0 -3
- package/src/__snapshots__/design-system.test.ts.snap +0 -7265
- package/src/create-inline-theme.ts +0 -67
- package/src/number-input/index.js +0 -191
- package/src/palette.ts +0 -253
package/src/select/select.tsx
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
/* eslint-disable no-use-before-define */
|
|
2
1
|
import {useComposedRefs} from "@fibery/react/src/use-composed-refs";
|
|
3
2
|
import {ForwardedRef, forwardRef, RefObject, useCallback, useMemo, useRef, useState} from "react";
|
|
4
3
|
import BaseSelect, {
|
|
5
4
|
ActionMeta,
|
|
6
5
|
components as reactSelectComponents,
|
|
6
|
+
ControlProps,
|
|
7
7
|
createFilter,
|
|
8
8
|
MenuListProps,
|
|
9
9
|
MenuProps,
|
|
10
|
-
ControlProps,
|
|
11
10
|
mergeStyles,
|
|
12
11
|
MultiValue,
|
|
13
12
|
MultiValueProps,
|
|
@@ -32,7 +31,8 @@ import {Option, OptionSlow} from "./components/option";
|
|
|
32
31
|
import {useSelectControlSettings} from "./select-control-settings-context";
|
|
33
32
|
import {makeComponentsStyles, makeNonVirtualizedStyles, makeVirtualizedStyles, makeZIndexStyles} from "./styles";
|
|
34
33
|
import {countOptions, GroupBase, ReactSelectRefContext} from "./util";
|
|
35
|
-
import
|
|
34
|
+
import compact from "lodash/compact";
|
|
35
|
+
import {composeEventHandlers} from "@fibery/react/src/compose-event-handlers";
|
|
36
36
|
|
|
37
37
|
export type {
|
|
38
38
|
ActionMeta,
|
|
@@ -72,6 +72,7 @@ export type SelectProps<T = unknown, U extends boolean = boolean, V extends Grou
|
|
|
72
72
|
isCollectionMode?: U;
|
|
73
73
|
disabled?: boolean;
|
|
74
74
|
forbidValuesClearInCollnMode?: boolean;
|
|
75
|
+
inline?: boolean;
|
|
75
76
|
};
|
|
76
77
|
|
|
77
78
|
const FAST_OPTION_USAGE_THRESHOLD = 200;
|
|
@@ -122,7 +123,7 @@ function useSelectStyles<T, U extends boolean, V extends GroupBase<T>>({
|
|
|
122
123
|
}) {
|
|
123
124
|
return useMemo(() => {
|
|
124
125
|
return combineStyles<T, U, V>(
|
|
125
|
-
|
|
126
|
+
compact([
|
|
126
127
|
makeComponentsStyles<T, U, V>(),
|
|
127
128
|
virtualized ? makeVirtualizedStyles<T, U, V>() : makeNonVirtualizedStyles<T, U, V>(),
|
|
128
129
|
zIndex ? makeZIndexStyles<T, U, V>(zIndex) : null,
|
|
@@ -141,13 +142,14 @@ export const SelectComponent = forwardRef(function Select<
|
|
|
141
142
|
components,
|
|
142
143
|
isCollectionMode,
|
|
143
144
|
menuPortalTarget,
|
|
144
|
-
onKeyDown,
|
|
145
145
|
styles,
|
|
146
146
|
virtualized = true,
|
|
147
|
+
forbidValuesClearInCollnMode,
|
|
148
|
+
inline,
|
|
147
149
|
onMenuOpen,
|
|
148
150
|
onMenuClose,
|
|
149
151
|
onChange,
|
|
150
|
-
|
|
152
|
+
onKeyDown,
|
|
151
153
|
...rest
|
|
152
154
|
}: SelectProps<T, U, V>,
|
|
153
155
|
forwardedRef: ForwardedRef<SelectInstance<T, U, V>>
|
|
@@ -166,39 +168,35 @@ export const SelectComponent = forwardRef(function Select<
|
|
|
166
168
|
onMenuClose && onMenuClose();
|
|
167
169
|
}, [onMenuClose]);
|
|
168
170
|
|
|
169
|
-
const
|
|
170
|
-
(e)
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
(e.target as HTMLInputElement).setSelectionRange(len, len);
|
|
193
|
-
}
|
|
194
|
-
break;
|
|
171
|
+
const onKeyDownComposed = composeEventHandlers(onKeyDown, (e) => {
|
|
172
|
+
switch (e.key) {
|
|
173
|
+
case "Escape":
|
|
174
|
+
// we can't rely on "menuIsOpen" prop here, as user may not pass this prop and rely on internal component behavior instead.
|
|
175
|
+
if (menuOpenState && !inline) {
|
|
176
|
+
e.stopPropagation();
|
|
177
|
+
}
|
|
178
|
+
break;
|
|
179
|
+
case "Home":
|
|
180
|
+
e.preventDefault();
|
|
181
|
+
if (e.shiftKey) {
|
|
182
|
+
(e.target as HTMLInputElement).selectionStart = 0;
|
|
183
|
+
} else {
|
|
184
|
+
(e.target as HTMLInputElement).setSelectionRange(0, 0);
|
|
185
|
+
}
|
|
186
|
+
break;
|
|
187
|
+
case "End": {
|
|
188
|
+
e.preventDefault();
|
|
189
|
+
const len = (e.target as HTMLInputElement).value.length;
|
|
190
|
+
if (e.shiftKey) {
|
|
191
|
+
(e.target as HTMLInputElement).selectionEnd = len;
|
|
192
|
+
} else {
|
|
193
|
+
(e.target as HTMLInputElement).setSelectionRange(len, len);
|
|
195
194
|
}
|
|
196
|
-
|
|
195
|
+
break;
|
|
197
196
|
}
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
);
|
|
197
|
+
default:
|
|
198
|
+
}
|
|
199
|
+
});
|
|
202
200
|
|
|
203
201
|
const selectRef = useRef<SelectInstance<T, U, V> | null>(null);
|
|
204
202
|
const composedRef = useComposedRefs(forwardedRef, selectRef);
|
|
@@ -227,7 +225,7 @@ export const SelectComponent = forwardRef(function Select<
|
|
|
227
225
|
tabSelectsValue={false}
|
|
228
226
|
components={selectComponents}
|
|
229
227
|
{...rest}
|
|
230
|
-
onKeyDown={
|
|
228
|
+
onKeyDown={onKeyDownComposed}
|
|
231
229
|
onMenuOpen={onMenuOpenWrapped}
|
|
232
230
|
onMenuClose={onMenuCloseWrapped}
|
|
233
231
|
onChange={rest.disabled ? undefined : onChange}
|
package/src/select/util.ts
CHANGED
package/src/static-palettes.ts
CHANGED
|
@@ -1,18 +1,228 @@
|
|
|
1
|
-
import {makeDefaultPalette, type ThemePalette} from "./palette-generator";
|
|
1
|
+
import {makeDefaultPalette, selectPalette, type ThemePalette} from "./palette-generator";
|
|
2
2
|
|
|
3
3
|
export interface LabPalettes {
|
|
4
4
|
make: () => ThemePalette;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export const StaticPalettes: LabPalettes[] = [
|
|
8
|
+
// warm grays (hue ~50) + orange accent (hue 15)
|
|
9
|
+
{
|
|
10
|
+
make: () => {
|
|
11
|
+
const base = selectPalette({warmLook: true, isArchitect: false});
|
|
12
|
+
return {
|
|
13
|
+
...base,
|
|
14
|
+
key: "clawd",
|
|
15
|
+
base: [
|
|
16
|
+
null,
|
|
17
|
+
"hsl(0, 0%, 100%)", // bg-000
|
|
18
|
+
"hsl(48, 33%, 97%)", // bg-100
|
|
19
|
+
"hsl(53, 29%, 95%)", // bg-200
|
|
20
|
+
"hsl(48, 25%, 92%)", // bg-300
|
|
21
|
+
"hsl(50, 21%, 89%)", // bg-400
|
|
22
|
+
"hsl(51, 17%, 85%)", // pictogram area
|
|
23
|
+
"hsl(51, 10%, 70%)",
|
|
24
|
+
"hsl(51, 6%, 57%)",
|
|
25
|
+
"hsl(51, 3%, 44%)", // text-500
|
|
26
|
+
"hsl(55, 3%, 34%)",
|
|
27
|
+
"hsl(60, 3%, 23%)", // text-200
|
|
28
|
+
"hsl(60, 3%, 8%)", // text-000
|
|
29
|
+
],
|
|
30
|
+
baseDark: [
|
|
31
|
+
null,
|
|
32
|
+
"hsl(60, 3%, 8%)", // bg-300
|
|
33
|
+
"hsl(30, 3%, 12%)", // bg-200
|
|
34
|
+
"hsl(60, 3%, 15%)", // bg-100
|
|
35
|
+
"hsl(60, 2%, 18%)", // bg-000
|
|
36
|
+
"hsl(60, 3%, 23%)", // pictogram-200
|
|
37
|
+
"hsl(48, 3%, 29%)", // pictogram-100
|
|
38
|
+
"hsl(50, 4%, 37%)",
|
|
39
|
+
"hsl(49, 4%, 47%)",
|
|
40
|
+
"hsl(48, 5%, 59%)", // text-400
|
|
41
|
+
"hsl(50, 7%, 67%)",
|
|
42
|
+
"hsl(50, 9%, 74%)", // text-200
|
|
43
|
+
"hsl(48, 33%, 97%)", // text-000
|
|
44
|
+
],
|
|
45
|
+
accent: [
|
|
46
|
+
null,
|
|
47
|
+
"hsl(15, 60%, 99%)",
|
|
48
|
+
"hsl(15, 85%, 97%)",
|
|
49
|
+
"hsl(15, 80%, 94%)",
|
|
50
|
+
"hsl(15, 75%, 91%)",
|
|
51
|
+
"hsl(15, 70%, 87%)",
|
|
52
|
+
"hsl(15, 66%, 82%)",
|
|
53
|
+
"hsl(15, 62%, 74%)",
|
|
54
|
+
"hsl(15, 60%, 67%)",
|
|
55
|
+
"hsl(15, 63%, 60%)", // accent-brand
|
|
56
|
+
"hsl(15, 57%, 53%)",
|
|
57
|
+
"hsl(15, 54%, 46%)",
|
|
58
|
+
"hsl(15, 50%, 18%)",
|
|
59
|
+
],
|
|
60
|
+
accentDark: [
|
|
61
|
+
null,
|
|
62
|
+
"hsl(16, 22%, 10%)",
|
|
63
|
+
"hsl(16, 34%, 13%)",
|
|
64
|
+
"hsl(15, 42%, 18%)",
|
|
65
|
+
"hsl(15, 46%, 22%)",
|
|
66
|
+
"hsl(15, 48%, 26%)",
|
|
67
|
+
"hsl(15, 50%, 30%)",
|
|
68
|
+
"hsl(15, 53%, 38%)",
|
|
69
|
+
"hsl(15, 56%, 48%)",
|
|
70
|
+
"hsl(15, 63%, 60%)", // accent-brand
|
|
71
|
+
"hsl(15, 65%, 66%)",
|
|
72
|
+
"hsl(15, 72%, 78%)",
|
|
73
|
+
"hsl(15, 82%, 96%)",
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
// Console theme — pure neutral blacks + teal accent (hue 158)
|
|
79
|
+
{
|
|
80
|
+
make: () => {
|
|
81
|
+
const base = selectPalette({warmLook: true, isArchitect: false});
|
|
82
|
+
return {
|
|
83
|
+
...base,
|
|
84
|
+
key: "clawd-console",
|
|
85
|
+
base: [
|
|
86
|
+
null,
|
|
87
|
+
"hsl(0, 0%, 99%)",
|
|
88
|
+
"hsl(0, 0%, 97%)",
|
|
89
|
+
"hsl(0, 0%, 95%)",
|
|
90
|
+
"hsl(0, 0%, 92%)",
|
|
91
|
+
"hsl(0, 0%, 88%)",
|
|
92
|
+
"hsl(0, 0%, 83%)",
|
|
93
|
+
"hsl(0, 0%, 75%)",
|
|
94
|
+
"hsl(0, 0%, 65%)",
|
|
95
|
+
"hsl(0, 0%, 48%)",
|
|
96
|
+
"hsl(0, 0%, 35%)",
|
|
97
|
+
"hsl(0, 0%, 23%)",
|
|
98
|
+
"hsl(0, 0%, 6%)",
|
|
99
|
+
],
|
|
100
|
+
baseDark: [
|
|
101
|
+
null,
|
|
102
|
+
"hsl(0, 0%, 6%)", // bg-000
|
|
103
|
+
"hsl(0, 0%, 10%)", // bg-100
|
|
104
|
+
"hsl(0, 0%, 14%)", // bg-200
|
|
105
|
+
"hsl(0, 0%, 17%)", // bg-300
|
|
106
|
+
"hsl(0, 0%, 19%)", // bg-400
|
|
107
|
+
"hsl(0, 0%, 23%)", // bg-500
|
|
108
|
+
"hsl(0, 0%, 33%)",
|
|
109
|
+
"hsl(0, 0%, 41%)",
|
|
110
|
+
"hsl(45, 1%, 48%)", // text-500
|
|
111
|
+
"hsl(50, 1%, 65%)", // text-400
|
|
112
|
+
"hsl(30, 1%, 72%)", // text-300
|
|
113
|
+
"hsl(60, 4%, 95%)", // text-100
|
|
114
|
+
],
|
|
115
|
+
accent: [
|
|
116
|
+
null,
|
|
117
|
+
"hsl(158, 60%, 99%)",
|
|
118
|
+
"hsl(158, 70%, 96%)",
|
|
119
|
+
"hsl(158, 66%, 92%)",
|
|
120
|
+
"hsl(158, 62%, 87%)",
|
|
121
|
+
"hsl(158, 58%, 80%)",
|
|
122
|
+
"hsl(158, 55%, 72%)",
|
|
123
|
+
"hsl(158, 58%, 60%)",
|
|
124
|
+
"hsl(158, 64%, 46%)",
|
|
125
|
+
"hsl(158, 68%, 32%)", // accent-secondary-000
|
|
126
|
+
"hsl(158, 80%, 28%)", // accent-secondary-100
|
|
127
|
+
"hsl(158, 79%, 25%)", // accent-secondary-200
|
|
128
|
+
"hsl(160, 18%, 16%)", // accent-secondary-900
|
|
129
|
+
],
|
|
130
|
+
accentDark: [
|
|
131
|
+
null,
|
|
132
|
+
"hsl(160, 18%, 8%)",
|
|
133
|
+
"hsl(158, 36%, 10%)",
|
|
134
|
+
"hsl(158, 52%, 13%)",
|
|
135
|
+
"hsl(158, 60%, 16%)",
|
|
136
|
+
"hsl(158, 66%, 19%)",
|
|
137
|
+
"hsl(158, 70%, 22%)",
|
|
138
|
+
"hsl(158, 76%, 26%)",
|
|
139
|
+
"hsl(158, 78%, 30%)",
|
|
140
|
+
"hsl(158, 68%, 32%)", // accent-secondary-000
|
|
141
|
+
"hsl(158, 60%, 42%)",
|
|
142
|
+
"hsl(158, 50%, 58%)",
|
|
143
|
+
"hsl(158, 45%, 92%)",
|
|
144
|
+
],
|
|
145
|
+
};
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
// Console theme variant — neutral blacks + orange accent (hue 18, darker than claude's hue 15)
|
|
149
|
+
{
|
|
150
|
+
make: () => {
|
|
151
|
+
const base = selectPalette({warmLook: true, isArchitect: false});
|
|
152
|
+
return {
|
|
153
|
+
...base,
|
|
154
|
+
key: "clawd-console-warm",
|
|
155
|
+
base: [
|
|
156
|
+
null,
|
|
157
|
+
"hsl(0, 0%, 99%)",
|
|
158
|
+
"hsl(0, 0%, 97%)",
|
|
159
|
+
"hsl(0, 0%, 95%)",
|
|
160
|
+
"hsl(0, 0%, 92%)",
|
|
161
|
+
"hsl(0, 0%, 88%)",
|
|
162
|
+
"hsl(0, 0%, 83%)",
|
|
163
|
+
"hsl(0, 0%, 75%)",
|
|
164
|
+
"hsl(0, 0%, 65%)",
|
|
165
|
+
"hsl(0, 0%, 48%)",
|
|
166
|
+
"hsl(0, 0%, 35%)",
|
|
167
|
+
"hsl(0, 0%, 23%)",
|
|
168
|
+
"hsl(0, 0%, 6%)",
|
|
169
|
+
],
|
|
170
|
+
baseDark: [
|
|
171
|
+
null,
|
|
172
|
+
"hsl(0, 0%, 6%)", // bg-000
|
|
173
|
+
"hsl(0, 0%, 10%)", // bg-100
|
|
174
|
+
"hsl(0, 0%, 14%)", // bg-200
|
|
175
|
+
"hsl(0, 0%, 17%)", // bg-300
|
|
176
|
+
"hsl(0, 0%, 19%)", // bg-400
|
|
177
|
+
"hsl(0, 0%, 23%)", // bg-500
|
|
178
|
+
"hsl(0, 0%, 33%)",
|
|
179
|
+
"hsl(0, 0%, 41%)",
|
|
180
|
+
"hsl(45, 1%, 48%)", // text-500
|
|
181
|
+
"hsl(50, 1%, 65%)", // text-400
|
|
182
|
+
"hsl(30, 1%, 72%)", // text-300
|
|
183
|
+
"hsl(60, 4%, 95%)", // text-100
|
|
184
|
+
],
|
|
185
|
+
accent: [
|
|
186
|
+
null,
|
|
187
|
+
"hsl(18, 55%, 99%)",
|
|
188
|
+
"hsl(18, 78%, 96%)",
|
|
189
|
+
"hsl(18, 72%, 92%)",
|
|
190
|
+
"hsl(18, 66%, 87%)",
|
|
191
|
+
"hsl(18, 60%, 81%)",
|
|
192
|
+
"hsl(18, 56%, 73%)",
|
|
193
|
+
"hsl(18, 54%, 63%)",
|
|
194
|
+
"hsl(18, 52%, 54%)",
|
|
195
|
+
"hsl(18, 50%, 48%)", // accent-main-000
|
|
196
|
+
"hsl(18, 57%, 44%)", // accent-main-100
|
|
197
|
+
"hsl(19, 58%, 40%)", // accent-main-200
|
|
198
|
+
"hsl(16, 22%, 20%)", // accent-main-900
|
|
199
|
+
],
|
|
200
|
+
accentDark: [
|
|
201
|
+
null,
|
|
202
|
+
"hsl(16, 22%, 10%)",
|
|
203
|
+
"hsl(17, 30%, 14%)",
|
|
204
|
+
"hsl(17, 36%, 18%)",
|
|
205
|
+
"hsl(17, 40%, 22%)",
|
|
206
|
+
"hsl(18, 44%, 27%)",
|
|
207
|
+
"hsl(18, 48%, 32%)",
|
|
208
|
+
"hsl(18, 50%, 38%)",
|
|
209
|
+
"hsl(18, 53%, 44%)", // accent-main-100
|
|
210
|
+
"hsl(18, 50%, 48%)", // accent-main-000
|
|
211
|
+
"hsl(18, 54%, 56%)",
|
|
212
|
+
"hsl(18, 60%, 72%)",
|
|
213
|
+
"hsl(18, 72%, 96%)",
|
|
214
|
+
],
|
|
215
|
+
};
|
|
216
|
+
},
|
|
217
|
+
},
|
|
8
218
|
{
|
|
9
219
|
make: () => {
|
|
10
220
|
const base = makeDefaultPalette();
|
|
11
221
|
return {
|
|
12
222
|
...base,
|
|
13
|
-
key: "
|
|
223
|
+
key: "oops",
|
|
14
224
|
base: [
|
|
15
|
-
|
|
225
|
+
null,
|
|
16
226
|
"#ffe6f7",
|
|
17
227
|
"#ffccef",
|
|
18
228
|
"#ffb3e7",
|
|
@@ -27,7 +237,7 @@ export const StaticPalettes: LabPalettes[] = [
|
|
|
27
237
|
"#990066",
|
|
28
238
|
],
|
|
29
239
|
baseDark: [
|
|
30
|
-
|
|
240
|
+
null,
|
|
31
241
|
"#330022",
|
|
32
242
|
"#4d0033",
|
|
33
243
|
"#660044",
|
|
@@ -42,7 +252,7 @@ export const StaticPalettes: LabPalettes[] = [
|
|
|
42
252
|
"#ffccef",
|
|
43
253
|
],
|
|
44
254
|
accent: [
|
|
45
|
-
|
|
255
|
+
null,
|
|
46
256
|
"#e6ffff",
|
|
47
257
|
"#ccffff",
|
|
48
258
|
"#b3ffff",
|
|
@@ -57,7 +267,7 @@ export const StaticPalettes: LabPalettes[] = [
|
|
|
57
267
|
"#009999",
|
|
58
268
|
],
|
|
59
269
|
accentDark: [
|
|
60
|
-
|
|
270
|
+
null,
|
|
61
271
|
"#003333",
|
|
62
272
|
"#004d4d",
|
|
63
273
|
"#006666",
|
|
@@ -79,9 +289,9 @@ export const StaticPalettes: LabPalettes[] = [
|
|
|
79
289
|
const base = makeDefaultPalette();
|
|
80
290
|
return {
|
|
81
291
|
...base,
|
|
82
|
-
key: "
|
|
292
|
+
key: "shmoops",
|
|
83
293
|
base: [
|
|
84
|
-
|
|
294
|
+
null,
|
|
85
295
|
"#e6ffe6",
|
|
86
296
|
"#ccffcc",
|
|
87
297
|
"#99FF99",
|
|
@@ -96,7 +306,7 @@ export const StaticPalettes: LabPalettes[] = [
|
|
|
96
306
|
"#005500",
|
|
97
307
|
],
|
|
98
308
|
baseDark: [
|
|
99
|
-
|
|
309
|
+
null,
|
|
100
310
|
"#003300",
|
|
101
311
|
"#004d00",
|
|
102
312
|
"#006600",
|
|
@@ -111,7 +321,7 @@ export const StaticPalettes: LabPalettes[] = [
|
|
|
111
321
|
"#ccffcc",
|
|
112
322
|
],
|
|
113
323
|
accent: [
|
|
114
|
-
|
|
324
|
+
null,
|
|
115
325
|
"#fff5e6",
|
|
116
326
|
"#ffebcc",
|
|
117
327
|
"#ffd699",
|
|
@@ -126,7 +336,7 @@ export const StaticPalettes: LabPalettes[] = [
|
|
|
126
336
|
"#663d00",
|
|
127
337
|
],
|
|
128
338
|
accentDark: [
|
|
129
|
-
|
|
339
|
+
null,
|
|
130
340
|
"#332400",
|
|
131
341
|
"#4d3600",
|
|
132
342
|
"#664800",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
2
|
import {space, themeVars} from "./design-system";
|
|
3
|
-
import type {
|
|
3
|
+
import type {ZeroBasedScale} from "./palette-generator";
|
|
4
4
|
|
|
5
5
|
export const controlRowCss = css`
|
|
6
6
|
display: flex;
|
|
@@ -38,8 +38,8 @@ export function ArrayEditor({
|
|
|
38
38
|
onChange,
|
|
39
39
|
}: {
|
|
40
40
|
label: string;
|
|
41
|
-
values:
|
|
42
|
-
onChange?: (v:
|
|
41
|
+
values: ZeroBasedScale<number>;
|
|
42
|
+
onChange?: (v: ZeroBasedScale<number>) => void;
|
|
43
43
|
}) {
|
|
44
44
|
const edit = onChange
|
|
45
45
|
? () => {
|
|
@@ -49,7 +49,7 @@ export function ArrayEditor({
|
|
|
49
49
|
try {
|
|
50
50
|
const parsed = JSON.parse(result);
|
|
51
51
|
if (Array.isArray(parsed) && parsed.length === 12) {
|
|
52
|
-
onChange(parsed as unknown as
|
|
52
|
+
onChange(parsed as unknown as ZeroBasedScale<number>);
|
|
53
53
|
} else {
|
|
54
54
|
alert("Need array with 12 values");
|
|
55
55
|
}
|
|
@@ -83,8 +83,8 @@ export function ArraySlider({
|
|
|
83
83
|
format = (v) => v.toFixed(3),
|
|
84
84
|
}: {
|
|
85
85
|
label: string;
|
|
86
|
-
values:
|
|
87
|
-
onValuesChange?: (v:
|
|
86
|
+
values: ZeroBasedScale<number>;
|
|
87
|
+
onValuesChange?: (v: ZeroBasedScale<number>) => void;
|
|
88
88
|
sliderValue: number;
|
|
89
89
|
onSliderChange: (v: number) => void;
|
|
90
90
|
min: number;
|
package/src/thematic-scales.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
2
|
import {type ColorScale} from "./palette-generator";
|
|
3
|
-
import {
|
|
3
|
+
import {toOKLCH, toRGB} from "./color-utils";
|
|
4
4
|
import {space, themeVars} from "./design-system";
|
|
5
5
|
import {SwatchWithPicker} from "./thematic-color-picker";
|
|
6
6
|
|
|
@@ -28,9 +28,7 @@ export const sectionSeparatorCss = css`
|
|
|
28
28
|
`;
|
|
29
29
|
|
|
30
30
|
function formatTooltip(name: string, color: string, index: number): string {
|
|
31
|
-
|
|
32
|
-
const oklch = produceColor(color, [], OKLCH);
|
|
33
|
-
return `${name}[${index}]\n${rgb}\n${oklch}`;
|
|
31
|
+
return `${name}[${index}]\n${toRGB(color)}\n${toOKLCH(color)}`;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
export function ScaleRow({
|
|
@@ -51,17 +49,19 @@ export function ScaleRow({
|
|
|
51
49
|
return (
|
|
52
50
|
<div className={scaleRowContainerCss}>
|
|
53
51
|
<div className={scaleCss}>
|
|
54
|
-
{scale.map((color, i) =>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
{scale.map((color, i) =>
|
|
53
|
+
color === null ? null : (
|
|
54
|
+
<SwatchWithPicker
|
|
55
|
+
key={i}
|
|
56
|
+
color={color}
|
|
57
|
+
title={formatTooltip(name, color, i)}
|
|
58
|
+
onChange={onColorChange ? (c) => onColorChange(i, c) : undefined}
|
|
59
|
+
onHighlight={onHighlight ? () => onHighlight(i) : undefined}
|
|
60
|
+
onHighlightEnd={onHighlightEnd}
|
|
61
|
+
isAltPressed={isAltPressed}
|
|
62
|
+
/>
|
|
63
|
+
)
|
|
64
|
+
)}
|
|
65
65
|
</div>
|
|
66
66
|
</div>
|
|
67
67
|
);
|