@sanity/ui 1.8.3 → 2.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.mjs +3 -0
- package/dist/index.d.ts +339 -415
- package/dist/index.esm.js +5374 -2489
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5375 -2487
- package/dist/index.js.map +1 -1
- package/package.json +21 -3
- package/src/components/autocomplete/autocomplete.tsx +2 -1
- package/src/components/dialog/constants.ts +4 -0
- package/src/components/dialog/dialog.tsx +89 -27
- package/src/components/dialog/styles.ts +3 -4
- package/src/components/hotkeys/hotkeys.tsx +2 -1
- package/src/components/menu/__workshop__/closableMenuButton.tsx +2 -2
- package/src/components/menu/menuButton.tsx +2 -2
- package/src/components/menu/menuDivider.ts +2 -1
- package/src/components/menu/menuGroup.tsx +24 -25
- package/src/components/menu/menuItem.tsx +31 -37
- package/src/components/skeleton/styles.ts +8 -7
- package/src/components/tab/tab.tsx +2 -1
- package/src/components/tree/style.ts +19 -20
- package/src/primitives/_selectable/style.ts +25 -23
- package/src/primitives/avatar/avatar.tsx +8 -3
- package/src/primitives/avatar/avatarCounter.tsx +5 -4
- package/src/primitives/avatar/spotColors.ts +53 -0
- package/src/primitives/avatar/styles.ts +6 -8
- package/src/primitives/avatar/types.ts +14 -0
- package/src/primitives/badge/badge.tsx +5 -3
- package/src/primitives/badge/styles.ts +7 -8
- package/src/primitives/box/__workshop__/responsive.tsx +2 -2
- package/src/primitives/button/__workshop__/sanityUploadButton.tsx +1 -2
- package/src/primitives/button/button.tsx +8 -9
- package/src/primitives/button/styles.ts +100 -17
- package/src/primitives/card/__workshop__/selected.tsx +8 -9
- package/src/primitives/card/card.tsx +43 -7
- package/src/primitives/card/styles.ts +31 -24
- package/src/primitives/card/types.ts +3 -1
- package/src/primitives/checkbox/checkbox.tsx +1 -0
- package/src/primitives/checkbox/styles.ts +53 -23
- package/src/primitives/code/code.tsx +15 -3
- package/src/primitives/code/styles.ts +51 -42
- package/src/primitives/heading/styles.ts +6 -5
- package/src/primitives/kbd/kbd.tsx +7 -6
- package/src/primitives/label/styles.ts +3 -2
- package/src/primitives/popover/popoverArrow.tsx +3 -2
- package/src/primitives/popover/popoverCard.tsx +8 -4
- package/src/primitives/radio/radio.tsx +1 -0
- package/src/primitives/radio/styles.ts +26 -13
- package/src/primitives/select/select.tsx +3 -2
- package/src/primitives/select/styles.ts +22 -24
- package/src/primitives/switch/__workshop__/props.tsx +4 -4
- package/src/primitives/switch/styles.ts +19 -12
- package/src/primitives/text/__workshop__/colored.tsx +10 -11
- package/src/primitives/text/styles.ts +10 -8
- package/src/primitives/textArea/textArea.tsx +8 -12
- package/src/primitives/textInput/textInput.tsx +15 -14
- package/src/primitives/tooltip/__workshop__/props.tsx +20 -3
- package/src/primitives/tooltip/tooltip.tsx +2 -2
- package/src/primitives/tooltip/tooltipArrow.tsx +3 -2
- package/src/primitives/types.ts +3 -2
- package/src/styles/border/borderStyle.ts +2 -1
- package/src/styles/colorVars/colorVarsStyle.ts +73 -30
- package/src/styles/focusRing/index.ts +8 -4
- package/src/styles/input/textInputStyle.ts +78 -94
- package/src/styles/margin/marginsStyle.test.ts +1 -2
- package/src/styles/padding/paddingStyle.test.ts +1 -2
- package/src/styles/radius/radiusStyle.ts +14 -4
- package/src/styles/radius/types.ts +3 -1
- package/src/styles/shadow/shadowStyle.ts +5 -5
- package/src/theme/__workshop__/color.tsx +2 -2
- package/src/theme/__workshop__/index.ts +0 -5
- package/src/theme/lib/color-fns/blend/multiply.ts +2 -2
- package/src/theme/lib/color-fns/blend/screen.ts +2 -2
- package/src/theme/lib/color-fns/convert.ts +15 -1
- package/src/theme/lib/color-fns/parse.ts +7 -3
- package/src/theme/lib/color-fns/types.ts +11 -0
- package/src/theme/lib/theme/avatar.ts +3 -0
- package/src/theme/lib/theme/color/_legacy/createColorTheme.ts +7 -0
- package/src/theme/lib/theme/color/_legacy/index.ts +1 -0
- package/src/theme/lib/theme/color/_legacy/legacyColor.ts +3997 -0
- package/src/theme/lib/theme/color/cssVariables/cardVariables.ts +88 -0
- package/src/theme/lib/theme/color/cssVariables/createCssVars.ts +31 -0
- package/src/theme/lib/theme/color/cssVariables/cssVars.test.ts +262 -0
- package/src/theme/lib/theme/color/cssVariables/index.ts +1 -0
- package/src/theme/lib/theme/color/cssVariables/tints.ts +312 -0
- package/src/theme/lib/theme/color/cssVariables/tones.ts +67 -0
- package/src/theme/lib/theme/color/cssVariables/utils.test.ts +15 -0
- package/src/theme/lib/theme/color/cssVariables/utils.ts +9 -0
- package/src/theme/lib/theme/color/index.ts +3 -12
- package/src/theme/lib/theme/color/types.ts +6 -37
- package/src/theme/lib/theme/input.ts +11 -0
- package/src/theme/lib/theme/theme.ts +7 -1
- package/src/theme/studioTheme/color.ts +6 -633
- package/src/theme/studioTheme/fonts.ts +3 -3
- package/src/theme/studioTheme/helpers.ts +15 -1
- package/src/theme/studioTheme/theme.ts +26 -6
- package/src/theme/themeColorProvider.tsx +2 -0
- package/src/theme/themeProvider.tsx +28 -8
- package/src/theme/toneContext/toneContext.ts +12 -0
- package/src/theme/toneContext/toneProvider.tsx +31 -0
- package/src/theme/toneContext/types.ts +10 -0
- package/src/theme/toneContext/useToneContext.tsx +26 -0
- package/src/theme/types.ts +10 -4
- package/src/types/index.ts +1 -0
- package/src/types/radius.ts +4 -0
- package/src/utils/elementQuery/__workshop__/customMedia.tsx +4 -3
- package/src/theme/__workshop__/canvas.tsx +0 -395
- package/src/theme/lib/theme/color/_generic/index.ts +0 -1
- package/src/theme/lib/theme/color/_generic/types.ts +0 -29
- package/src/theme/lib/theme/color/base/index.ts +0 -1
- package/src/theme/lib/theme/color/base/types.ts +0 -19
- package/src/theme/lib/theme/color/button/createButtonModes.ts +0 -20
- package/src/theme/lib/theme/color/button/createButtonTones.ts +0 -52
- package/src/theme/lib/theme/color/button/index.ts +0 -1
- package/src/theme/lib/theme/color/button/types.ts +0 -44
- package/src/theme/lib/theme/color/card/createCardStates.ts +0 -58
- package/src/theme/lib/theme/color/card/index.ts +0 -1
- package/src/theme/lib/theme/color/card/types.ts +0 -18
- package/src/theme/lib/theme/color/color.test.ts +0 -62
- package/src/theme/lib/theme/color/defaults.ts +0 -382
- package/src/theme/lib/theme/color/factory.ts +0 -138
- package/src/theme/lib/theme/color/input/createInputModes.ts +0 -84
- package/src/theme/lib/theme/color/input/index.ts +0 -1
- package/src/theme/lib/theme/color/input/types.ts +0 -27
- package/src/theme/lib/theme/color/muted/createMuted.ts +0 -56
- package/src/theme/lib/theme/color/muted/index.ts +0 -1
- package/src/theme/lib/theme/color/muted/types.ts +0 -24
- package/src/theme/lib/theme/color/selectable/createSelectableTones.ts +0 -73
- package/src/theme/lib/theme/color/selectable/index.ts +0 -1
- package/src/theme/lib/theme/color/selectable/types.ts +0 -29
- package/src/theme/lib/theme/color/solid/createSolidTones.ts +0 -56
- package/src/theme/lib/theme/color/solid/index.ts +0 -1
- package/src/theme/lib/theme/color/solid/types.ts +0 -24
- package/src/theme/lib/theme/color/spot/createSpot.ts +0 -21
- package/src/theme/lib/theme/color/spot/index.ts +0 -1
- package/src/theme/lib/theme/color/spot/types.ts +0 -28
- package/src/theme/lib/theme/color/syntax/index.ts +0 -1
- package/src/theme/lib/theme/color/syntax/types.ts +0 -41
|
@@ -1,395 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Box,
|
|
3
|
-
Card,
|
|
4
|
-
CardTone,
|
|
5
|
-
Flex,
|
|
6
|
-
Grid,
|
|
7
|
-
Stack,
|
|
8
|
-
Text,
|
|
9
|
-
ThemeColor,
|
|
10
|
-
ThemeColorButton,
|
|
11
|
-
ThemeColorButtonState,
|
|
12
|
-
ThemeColorButtonStates,
|
|
13
|
-
ThemeColorButtonTones,
|
|
14
|
-
ThemeColorMuted,
|
|
15
|
-
ThemeColorMutedTone,
|
|
16
|
-
ThemeColorProvider,
|
|
17
|
-
ThemeColorScheme,
|
|
18
|
-
ThemeColorSelectable,
|
|
19
|
-
ThemeColorSelectableStates,
|
|
20
|
-
ThemeColorSolid,
|
|
21
|
-
ThemeColorSolidTone,
|
|
22
|
-
useRootTheme,
|
|
23
|
-
} from '@sanity/ui'
|
|
24
|
-
import {useBoolean} from '@sanity/ui-workshop'
|
|
25
|
-
import {createContext, useContext} from 'react'
|
|
26
|
-
import {ThemeColorCard} from '../lib/theme'
|
|
27
|
-
|
|
28
|
-
interface Features {
|
|
29
|
-
light: boolean
|
|
30
|
-
dark: boolean
|
|
31
|
-
|
|
32
|
-
base: boolean
|
|
33
|
-
button: boolean
|
|
34
|
-
card: boolean
|
|
35
|
-
input: boolean
|
|
36
|
-
muted: boolean
|
|
37
|
-
selectable: boolean
|
|
38
|
-
solid: boolean
|
|
39
|
-
spot: boolean
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const defaultFeatures: Features = {
|
|
43
|
-
light: true,
|
|
44
|
-
dark: false,
|
|
45
|
-
|
|
46
|
-
base: false,
|
|
47
|
-
button: false,
|
|
48
|
-
card: false,
|
|
49
|
-
input: false,
|
|
50
|
-
muted: true,
|
|
51
|
-
selectable: false,
|
|
52
|
-
solid: false,
|
|
53
|
-
spot: false,
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const FeaturesContext = createContext<Features>(defaultFeatures)
|
|
57
|
-
|
|
58
|
-
function useFeatures() {
|
|
59
|
-
return useContext(FeaturesContext)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default function CanvasStory() {
|
|
63
|
-
const {theme} = useRootTheme()
|
|
64
|
-
const features: Features = {
|
|
65
|
-
...defaultFeatures,
|
|
66
|
-
light: useBoolean('Light', defaultFeatures.light, 'Props') ?? defaultFeatures.light,
|
|
67
|
-
dark: useBoolean('Dark', defaultFeatures.dark, 'Props') ?? defaultFeatures.dark,
|
|
68
|
-
base: useBoolean('Base', defaultFeatures.base, 'Props') ?? defaultFeatures.base,
|
|
69
|
-
button: useBoolean('Button', defaultFeatures.button, 'Props') ?? defaultFeatures.button,
|
|
70
|
-
card: useBoolean('Card', defaultFeatures.card, 'Props') ?? defaultFeatures.card,
|
|
71
|
-
input: useBoolean('Input', defaultFeatures.input, 'Props') ?? defaultFeatures.input,
|
|
72
|
-
muted: useBoolean('Muted', defaultFeatures.muted, 'Props') ?? defaultFeatures.muted,
|
|
73
|
-
selectable:
|
|
74
|
-
useBoolean('Selectable', defaultFeatures.selectable, 'Props') ?? defaultFeatures.selectable,
|
|
75
|
-
solid: useBoolean('Solid', defaultFeatures.solid, 'Props') ?? defaultFeatures.solid,
|
|
76
|
-
spot: useBoolean('Spot', defaultFeatures.spot, 'Props') ?? defaultFeatures.spot,
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<FeaturesContext.Provider value={features}>
|
|
81
|
-
<Flex>
|
|
82
|
-
{features.light && (
|
|
83
|
-
<ThemeColorProvider scheme="light">
|
|
84
|
-
<ColorScheme scheme={theme.color.light} />
|
|
85
|
-
</ThemeColorProvider>
|
|
86
|
-
)}
|
|
87
|
-
|
|
88
|
-
{features.dark && (
|
|
89
|
-
<ThemeColorProvider scheme="dark">
|
|
90
|
-
<ColorScheme scheme={theme.color.dark} />
|
|
91
|
-
</ThemeColorProvider>
|
|
92
|
-
)}
|
|
93
|
-
</Flex>
|
|
94
|
-
</FeaturesContext.Provider>
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function ColorScheme(props: {scheme: ThemeColorScheme}) {
|
|
99
|
-
const {scheme} = props
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
<Flex direction="column" flex={1}>
|
|
103
|
-
<Color color={scheme.default} tone="default" />
|
|
104
|
-
<Color color={scheme.transparent} tone="transparent" />
|
|
105
|
-
<Color color={scheme.primary} tone="primary" />
|
|
106
|
-
<Color color={scheme.positive} tone="positive" />
|
|
107
|
-
<Color color={scheme.caution} tone="caution" />
|
|
108
|
-
<Color color={scheme.critical} tone="critical" />
|
|
109
|
-
</Flex>
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function Color(props: {color: ThemeColor; tone: CardTone}) {
|
|
114
|
-
const {color, tone} = props
|
|
115
|
-
const features = useFeatures()
|
|
116
|
-
|
|
117
|
-
return (
|
|
118
|
-
<Card padding={[3, 4]} tone={tone}>
|
|
119
|
-
<Stack
|
|
120
|
-
space={[3, 4]}
|
|
121
|
-
// style={{outline: '1px solid #ccc'}}
|
|
122
|
-
>
|
|
123
|
-
{features.base && (
|
|
124
|
-
<Stack
|
|
125
|
-
padding={3}
|
|
126
|
-
space={2}
|
|
127
|
-
style={{
|
|
128
|
-
borderRadius: 3,
|
|
129
|
-
boxShadow: `inset 0 0 0 1px ${color.base.border}`,
|
|
130
|
-
}}
|
|
131
|
-
>
|
|
132
|
-
<Text>Text</Text>
|
|
133
|
-
<Text muted>Muted</Text>
|
|
134
|
-
<Text accent>Accent</Text>
|
|
135
|
-
<Text>
|
|
136
|
-
<a href="#">Link</a>
|
|
137
|
-
</Text>
|
|
138
|
-
<Text>
|
|
139
|
-
<code>Code</code>
|
|
140
|
-
</Text>
|
|
141
|
-
<div
|
|
142
|
-
style={{
|
|
143
|
-
height: 9,
|
|
144
|
-
background: `linear-gradient(to right, ${color.base.skeleton?.from}, ${color.base.skeleton?.to})`,
|
|
145
|
-
}}
|
|
146
|
-
/>
|
|
147
|
-
</Stack>
|
|
148
|
-
)}
|
|
149
|
-
|
|
150
|
-
{features.button && <ColorButton color={color.button} />}
|
|
151
|
-
|
|
152
|
-
{features.card && <ColorCard color={color.card} />}
|
|
153
|
-
|
|
154
|
-
{features.input && (
|
|
155
|
-
<Box padding={2} style={{backgroundColor: color.input.default.enabled.bg}}>
|
|
156
|
-
<Text style={{color: 'inherit'}}>Input</Text>
|
|
157
|
-
</Box>
|
|
158
|
-
)}
|
|
159
|
-
|
|
160
|
-
{features.muted && <ColorMuted color={color.muted} />}
|
|
161
|
-
|
|
162
|
-
{/* @todo: remove use of `muted` here */}
|
|
163
|
-
{features.selectable && <ColorSelectable color={color.selectable || color.muted} />}
|
|
164
|
-
|
|
165
|
-
{features.solid && <ColorSolid color={color.solid} />}
|
|
166
|
-
|
|
167
|
-
{features.spot && (
|
|
168
|
-
<Flex gap={1}>
|
|
169
|
-
<Box flex={1} style={{backgroundColor: color.spot.blue, width: 25, height: 25}} />
|
|
170
|
-
<Box flex={1} style={{backgroundColor: color.spot.purple, width: 25, height: 25}} />
|
|
171
|
-
<Box flex={1} style={{backgroundColor: color.spot.magenta, width: 25, height: 25}} />
|
|
172
|
-
<Box flex={1} style={{backgroundColor: color.spot.red, width: 25, height: 25}} />
|
|
173
|
-
<Box flex={1} style={{backgroundColor: color.spot.yellow, width: 25, height: 25}} />
|
|
174
|
-
<Box flex={1} style={{backgroundColor: color.spot.green, width: 25, height: 25}} />
|
|
175
|
-
<Box flex={1} style={{backgroundColor: color.spot.cyan, width: 25, height: 25}} />
|
|
176
|
-
<Box flex={1} style={{backgroundColor: color.spot.gray, width: 25, height: 25}} />
|
|
177
|
-
</Flex>
|
|
178
|
-
)}
|
|
179
|
-
</Stack>
|
|
180
|
-
</Card>
|
|
181
|
-
)
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function ColorCard(props: {color: ThemeColorCard}) {
|
|
185
|
-
const {color} = props
|
|
186
|
-
|
|
187
|
-
return (
|
|
188
|
-
<Box style={{backgroundColor: color.enabled.bg}}>
|
|
189
|
-
<ColorGenericStates color={color} />
|
|
190
|
-
</Box>
|
|
191
|
-
)
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function ColorButton(props: {color: ThemeColorButton}) {
|
|
195
|
-
const {color} = props
|
|
196
|
-
|
|
197
|
-
return (
|
|
198
|
-
<Stack space={3}>
|
|
199
|
-
<ColorButtonMode color={color.default} />
|
|
200
|
-
<ColorButtonMode color={color.ghost} />
|
|
201
|
-
<ColorButtonMode color={color.bleed} />
|
|
202
|
-
</Stack>
|
|
203
|
-
)
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
function ColorButtonMode(props: {color: ThemeColorButtonTones}) {
|
|
207
|
-
const {color} = props
|
|
208
|
-
|
|
209
|
-
return (
|
|
210
|
-
<Stack space={1}>
|
|
211
|
-
<Grid columns={5} marginBottom={1} gap={1}>
|
|
212
|
-
<Box>
|
|
213
|
-
<Text align="center" muted size={1}>
|
|
214
|
-
Enabled
|
|
215
|
-
</Text>
|
|
216
|
-
</Box>
|
|
217
|
-
<Box>
|
|
218
|
-
<Text align="center" muted size={1}>
|
|
219
|
-
Hovered
|
|
220
|
-
</Text>
|
|
221
|
-
</Box>
|
|
222
|
-
<Box>
|
|
223
|
-
<Text align="center" muted size={1}>
|
|
224
|
-
Pressed
|
|
225
|
-
</Text>
|
|
226
|
-
</Box>
|
|
227
|
-
<Box>
|
|
228
|
-
<Text align="center" muted size={1}>
|
|
229
|
-
Selected
|
|
230
|
-
</Text>
|
|
231
|
-
</Box>
|
|
232
|
-
<Box>
|
|
233
|
-
<Text align="center" muted size={1}>
|
|
234
|
-
Disabled
|
|
235
|
-
</Text>
|
|
236
|
-
</Box>
|
|
237
|
-
</Grid>
|
|
238
|
-
<ColorGenericStates color={color.default} />
|
|
239
|
-
<ColorGenericStates color={color.primary} />
|
|
240
|
-
<ColorGenericStates color={color.positive} />
|
|
241
|
-
<ColorGenericStates color={color.caution} />
|
|
242
|
-
<ColorGenericStates color={color.critical} />
|
|
243
|
-
</Stack>
|
|
244
|
-
)
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
function ColorGenericStates(props: {color: ThemeColorButtonStates}) {
|
|
248
|
-
const {color} = props
|
|
249
|
-
|
|
250
|
-
return (
|
|
251
|
-
<Grid columns={5} gap={1}>
|
|
252
|
-
<ColorGenericState color={color.enabled} />
|
|
253
|
-
<ColorGenericState color={color.hovered} />
|
|
254
|
-
<ColorGenericState color={color.pressed} />
|
|
255
|
-
<ColorGenericState color={color.selected} />
|
|
256
|
-
<ColorGenericState color={color.disabled} />
|
|
257
|
-
</Grid>
|
|
258
|
-
)
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
function ColorGenericState(props: {color: ThemeColorButtonState}) {
|
|
262
|
-
const {color} = props
|
|
263
|
-
|
|
264
|
-
return (
|
|
265
|
-
<Stack
|
|
266
|
-
padding={2}
|
|
267
|
-
space={2}
|
|
268
|
-
style={{
|
|
269
|
-
backgroundColor: color.bg,
|
|
270
|
-
color: color.fg,
|
|
271
|
-
border: `1px solid ${color.border}`,
|
|
272
|
-
borderRadius: 3,
|
|
273
|
-
}}
|
|
274
|
-
>
|
|
275
|
-
<Flex style={{border: `1px solid ${color.border}`}}>
|
|
276
|
-
<Box flex={1} padding={3} style={{backgroundColor: color.bg}}>
|
|
277
|
-
<Text align="center" size={1} style={{color: 'inherit'}}>
|
|
278
|
-
bg
|
|
279
|
-
</Text>
|
|
280
|
-
</Box>
|
|
281
|
-
<Box flex={1} padding={3} style={{backgroundColor: color.bg2}}>
|
|
282
|
-
<Text align="center" size={1} style={{color: 'inherit'}}>
|
|
283
|
-
bg2
|
|
284
|
-
</Text>
|
|
285
|
-
</Box>
|
|
286
|
-
</Flex>
|
|
287
|
-
|
|
288
|
-
<Text align="center" style={{color: 'inherit'}}>
|
|
289
|
-
Text
|
|
290
|
-
</Text>
|
|
291
|
-
<Text align="center" size={1} style={{color: color.muted.fg}}>
|
|
292
|
-
Muted
|
|
293
|
-
</Text>
|
|
294
|
-
<Text align="center" size={1} style={{color: color.link.fg}}>
|
|
295
|
-
Link
|
|
296
|
-
</Text>
|
|
297
|
-
<Text align="center" size={1} style={{color: color.accent.fg}}>
|
|
298
|
-
Accent
|
|
299
|
-
</Text>
|
|
300
|
-
<Text align="center" size={1} style={{color: color.code.fg}}>
|
|
301
|
-
<span style={{backgroundColor: color.code.bg}}>Code</span>
|
|
302
|
-
</Text>
|
|
303
|
-
<div
|
|
304
|
-
style={{
|
|
305
|
-
height: 9,
|
|
306
|
-
background: `linear-gradient(to right, ${color.skeleton?.from}, ${color.skeleton?.to})`,
|
|
307
|
-
}}
|
|
308
|
-
/>
|
|
309
|
-
</Stack>
|
|
310
|
-
)
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
function ColorMuted(props: {color: ThemeColorMuted}) {
|
|
314
|
-
const {color} = props
|
|
315
|
-
|
|
316
|
-
return (
|
|
317
|
-
<Stack space={1}>
|
|
318
|
-
<ColorMutedTone color={color.default} />
|
|
319
|
-
<ColorMutedTone color={color.primary} />
|
|
320
|
-
<ColorMutedTone color={color.positive} />
|
|
321
|
-
<ColorMutedTone color={color.caution} />
|
|
322
|
-
<ColorMutedTone color={color.critical} />
|
|
323
|
-
</Stack>
|
|
324
|
-
)
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
function ColorMutedTone(props: {color: ThemeColorMutedTone}) {
|
|
328
|
-
const {color} = props
|
|
329
|
-
|
|
330
|
-
return (
|
|
331
|
-
<Grid columns={5} gap={1}>
|
|
332
|
-
<ColorGenericState color={color.enabled} />
|
|
333
|
-
<ColorGenericState color={color.hovered} />
|
|
334
|
-
<ColorGenericState color={color.pressed} />
|
|
335
|
-
<ColorGenericState color={color.selected} />
|
|
336
|
-
<ColorGenericState color={color.disabled} />
|
|
337
|
-
</Grid>
|
|
338
|
-
)
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
function ColorSolid(props: {color: ThemeColorSolid}) {
|
|
342
|
-
const {color} = props
|
|
343
|
-
|
|
344
|
-
return (
|
|
345
|
-
<Stack space={1}>
|
|
346
|
-
<ColorSolidTone color={color.default} />
|
|
347
|
-
<ColorSolidTone color={color.primary} />
|
|
348
|
-
<ColorSolidTone color={color.positive} />
|
|
349
|
-
<ColorSolidTone color={color.caution} />
|
|
350
|
-
<ColorSolidTone color={color.critical} />
|
|
351
|
-
</Stack>
|
|
352
|
-
)
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
function ColorSolidTone(props: {color: ThemeColorSolidTone}) {
|
|
356
|
-
const {color} = props
|
|
357
|
-
|
|
358
|
-
return (
|
|
359
|
-
<Grid columns={5} gap={1}>
|
|
360
|
-
<ColorGenericState color={color.enabled} />
|
|
361
|
-
<ColorGenericState color={color.hovered} />
|
|
362
|
-
<ColorGenericState color={color.pressed} />
|
|
363
|
-
<ColorGenericState color={color.selected} />
|
|
364
|
-
<ColorGenericState color={color.disabled} />
|
|
365
|
-
</Grid>
|
|
366
|
-
)
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
function ColorSelectable(props: {color: ThemeColorSelectable}) {
|
|
370
|
-
const {color} = props
|
|
371
|
-
|
|
372
|
-
return (
|
|
373
|
-
<Stack space={1}>
|
|
374
|
-
<ColorSelectableTone color={color.default} />
|
|
375
|
-
<ColorSelectableTone color={color.primary} />
|
|
376
|
-
<ColorSelectableTone color={color.positive} />
|
|
377
|
-
<ColorSelectableTone color={color.caution} />
|
|
378
|
-
<ColorSelectableTone color={color.critical} />
|
|
379
|
-
</Stack>
|
|
380
|
-
)
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
function ColorSelectableTone(props: {color: ThemeColorSelectableStates}) {
|
|
384
|
-
const {color} = props
|
|
385
|
-
|
|
386
|
-
return (
|
|
387
|
-
<Grid columns={5} gap={1}>
|
|
388
|
-
<ColorGenericState color={color.enabled} />
|
|
389
|
-
<ColorGenericState color={color.hovered} />
|
|
390
|
-
<ColorGenericState color={color.pressed} />
|
|
391
|
-
<ColorGenericState color={color.selected} />
|
|
392
|
-
<ColorGenericState color={color.disabled} />
|
|
393
|
-
</Grid>
|
|
394
|
-
)
|
|
395
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './types'
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @public
|
|
3
|
-
*/
|
|
4
|
-
export interface ThemeColorGenericState {
|
|
5
|
-
bg: string
|
|
6
|
-
/**
|
|
7
|
-
* @beta
|
|
8
|
-
*/
|
|
9
|
-
bg2?: string
|
|
10
|
-
border: string
|
|
11
|
-
fg: string
|
|
12
|
-
muted: {
|
|
13
|
-
fg: string
|
|
14
|
-
}
|
|
15
|
-
accent: {
|
|
16
|
-
fg: string
|
|
17
|
-
}
|
|
18
|
-
link: {
|
|
19
|
-
fg: string
|
|
20
|
-
}
|
|
21
|
-
code: {
|
|
22
|
-
bg: string
|
|
23
|
-
fg: string
|
|
24
|
-
}
|
|
25
|
-
skeleton?: {
|
|
26
|
-
from: string
|
|
27
|
-
to: string
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './types'
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @public
|
|
3
|
-
*/
|
|
4
|
-
export interface ThemeColorBase {
|
|
5
|
-
bg: string
|
|
6
|
-
fg: string
|
|
7
|
-
border: string
|
|
8
|
-
focusRing: string
|
|
9
|
-
shadow: {
|
|
10
|
-
outline: string
|
|
11
|
-
umbra: string
|
|
12
|
-
penumbra: string
|
|
13
|
-
ambient: string
|
|
14
|
-
}
|
|
15
|
-
skeleton?: {
|
|
16
|
-
from: string
|
|
17
|
-
to: string
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {ThemeColorBase} from '../base'
|
|
2
|
-
import {ThemeColorBuilderOpts} from '../factory'
|
|
3
|
-
import {ThemeColorMuted} from '../muted'
|
|
4
|
-
import {ThemeColorSolid} from '../solid'
|
|
5
|
-
import {createButtonTones} from './createButtonTones'
|
|
6
|
-
import {ThemeColorButton} from './types'
|
|
7
|
-
|
|
8
|
-
export function createButtonModes(
|
|
9
|
-
opts: ThemeColorBuilderOpts,
|
|
10
|
-
base: ThemeColorBase,
|
|
11
|
-
dark: boolean,
|
|
12
|
-
solid: ThemeColorSolid,
|
|
13
|
-
muted: ThemeColorMuted,
|
|
14
|
-
): ThemeColorButton {
|
|
15
|
-
return {
|
|
16
|
-
default: createButtonTones(opts, base, dark, solid, muted, 'default'),
|
|
17
|
-
ghost: createButtonTones(opts, base, dark, solid, muted, 'ghost'),
|
|
18
|
-
bleed: createButtonTones(opts, base, dark, solid, muted, 'bleed'),
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import {ThemeColorBase} from '../base'
|
|
2
|
-
import {ThemeColorBuilderOpts} from '../factory'
|
|
3
|
-
import {ThemeColorMuted} from '../muted'
|
|
4
|
-
import {ThemeColorSolid} from '../solid'
|
|
5
|
-
import {ThemeColorButtonModeKey, ThemeColorButtonTones} from './types'
|
|
6
|
-
|
|
7
|
-
export function createButtonTones(
|
|
8
|
-
opts: ThemeColorBuilderOpts,
|
|
9
|
-
base: ThemeColorBase,
|
|
10
|
-
dark: boolean,
|
|
11
|
-
solid: ThemeColorSolid,
|
|
12
|
-
muted: ThemeColorMuted,
|
|
13
|
-
mode: ThemeColorButtonModeKey,
|
|
14
|
-
): ThemeColorButtonTones {
|
|
15
|
-
return {
|
|
16
|
-
default: opts.button({
|
|
17
|
-
base,
|
|
18
|
-
dark,
|
|
19
|
-
solid: solid.default,
|
|
20
|
-
muted: muted.default,
|
|
21
|
-
mode,
|
|
22
|
-
}),
|
|
23
|
-
primary: opts.button({
|
|
24
|
-
base,
|
|
25
|
-
dark,
|
|
26
|
-
solid: solid.primary,
|
|
27
|
-
muted: muted.primary,
|
|
28
|
-
mode,
|
|
29
|
-
}),
|
|
30
|
-
positive: opts.button({
|
|
31
|
-
base,
|
|
32
|
-
dark,
|
|
33
|
-
solid: solid.positive,
|
|
34
|
-
muted: muted.positive,
|
|
35
|
-
mode,
|
|
36
|
-
}),
|
|
37
|
-
caution: opts.button({
|
|
38
|
-
base,
|
|
39
|
-
dark,
|
|
40
|
-
solid: solid.caution,
|
|
41
|
-
muted: muted.caution,
|
|
42
|
-
mode,
|
|
43
|
-
}),
|
|
44
|
-
critical: opts.button({
|
|
45
|
-
base,
|
|
46
|
-
dark,
|
|
47
|
-
solid: solid.critical,
|
|
48
|
-
muted: muted.critical,
|
|
49
|
-
mode,
|
|
50
|
-
}),
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './types'
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import {ThemeColorGenericState} from '../_generic'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export type ThemeColorButtonModeKey = 'default' | 'ghost' | 'bleed'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Use `ThemeColorGenericState` instead.
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export type ThemeColorButtonState = ThemeColorGenericState
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export interface ThemeColorButtonStates {
|
|
18
|
-
enabled: ThemeColorButtonState
|
|
19
|
-
hovered: ThemeColorButtonState
|
|
20
|
-
pressed: ThemeColorButtonState
|
|
21
|
-
selected: ThemeColorButtonState
|
|
22
|
-
disabled: ThemeColorButtonState
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* TODO: Rename to `ThemeColorButtonMode`.
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
export interface ThemeColorButtonTones {
|
|
30
|
-
default: ThemeColorButtonStates
|
|
31
|
-
primary: ThemeColorButtonStates
|
|
32
|
-
positive: ThemeColorButtonStates
|
|
33
|
-
caution: ThemeColorButtonStates
|
|
34
|
-
critical: ThemeColorButtonStates
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @public
|
|
39
|
-
*/
|
|
40
|
-
export interface ThemeColorButton {
|
|
41
|
-
default: ThemeColorButtonTones
|
|
42
|
-
ghost: ThemeColorButtonTones
|
|
43
|
-
bleed: ThemeColorButtonTones
|
|
44
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import {ThemeColorBase} from '../base'
|
|
2
|
-
import {ThemeColorBuilderOpts} from '../factory'
|
|
3
|
-
import {ThemeColorMuted} from '../muted'
|
|
4
|
-
import {ThemeColorSolid} from '../solid'
|
|
5
|
-
import {ThemeColorName} from '../types'
|
|
6
|
-
import {ThemeColorCard} from './types'
|
|
7
|
-
|
|
8
|
-
export function createCardStates(
|
|
9
|
-
opts: ThemeColorBuilderOpts,
|
|
10
|
-
base: ThemeColorBase,
|
|
11
|
-
dark: boolean,
|
|
12
|
-
name: ThemeColorName,
|
|
13
|
-
solid: ThemeColorSolid,
|
|
14
|
-
muted: ThemeColorMuted,
|
|
15
|
-
): ThemeColorCard {
|
|
16
|
-
return {
|
|
17
|
-
enabled: opts.card({
|
|
18
|
-
base,
|
|
19
|
-
dark,
|
|
20
|
-
name,
|
|
21
|
-
state: 'enabled',
|
|
22
|
-
solid,
|
|
23
|
-
muted,
|
|
24
|
-
}),
|
|
25
|
-
disabled: opts.card({
|
|
26
|
-
base,
|
|
27
|
-
dark,
|
|
28
|
-
name,
|
|
29
|
-
state: 'disabled',
|
|
30
|
-
solid,
|
|
31
|
-
muted,
|
|
32
|
-
}),
|
|
33
|
-
hovered: opts.card({
|
|
34
|
-
base,
|
|
35
|
-
dark,
|
|
36
|
-
name,
|
|
37
|
-
state: 'hovered',
|
|
38
|
-
solid,
|
|
39
|
-
muted,
|
|
40
|
-
}),
|
|
41
|
-
pressed: opts.card({
|
|
42
|
-
base,
|
|
43
|
-
dark,
|
|
44
|
-
name,
|
|
45
|
-
state: 'pressed',
|
|
46
|
-
solid,
|
|
47
|
-
muted,
|
|
48
|
-
}),
|
|
49
|
-
selected: opts.card({
|
|
50
|
-
base,
|
|
51
|
-
dark,
|
|
52
|
-
name,
|
|
53
|
-
state: 'selected',
|
|
54
|
-
solid,
|
|
55
|
-
muted,
|
|
56
|
-
}),
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './types'
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {ThemeColorGenericState} from '../_generic'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Use `ThemeColorGenericState` instead.
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export type ThemeColorCardState = ThemeColorGenericState
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export interface ThemeColorCard {
|
|
13
|
-
enabled: ThemeColorCardState
|
|
14
|
-
hovered: ThemeColorCardState
|
|
15
|
-
pressed: ThemeColorCardState
|
|
16
|
-
selected: ThemeColorCardState
|
|
17
|
-
disabled: ThemeColorCardState
|
|
18
|
-
}
|