@okshaun/components 4.1.5 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/icon-metadata.json +134 -0
- package/dist/index.js +16208 -10749
- package/dist/index.js.map +1 -1
- package/dist/panda.buildinfo.json +754 -530
- package/dist/{preset-jXQwQ5KL.js → preset-B6fsdoKY.js} +2338 -317
- package/dist/preset-B6fsdoKY.js.map +1 -0
- package/dist/preset.js +1 -1
- package/dist/specs/keyframes.json +66 -0
- package/dist/specs/recipes.json +394 -26
- package/dist/specs/tokens.json +15 -0
- package/dist/sprite.svg +1 -1
- package/dist/sprite.symbol.html +248 -2
- package/dist/styles.css +3971 -789
- package/dist/svgs/barcode-reader-off.svg +1 -0
- package/dist/svgs/circle-dashed.svg +1 -0
- package/dist/svgs/drawer-left-hide.svg +1 -0
- package/dist/svgs/drawer-left-show.svg +1 -0
- package/dist/svgs/drawer-right-hide.svg +1 -0
- package/dist/svgs/drawer-right-show.svg +1 -0
- package/dist/svgs/not-equal.svg +1 -0
- package/dist/svgs/square-dashed.svg +1 -0
- package/dist/types/index.d.ts +2989 -115
- package/package.json +9 -12
- package/src/recipes/alert.ts +80 -0
- package/src/recipes/autocomplete.ts +2 -2
- package/src/recipes/avatar.ts +13 -6
- package/src/recipes/button.ts +41 -30
- package/src/recipes/checkbox.ts +3 -0
- package/src/recipes/chip.ts +16 -0
- package/src/recipes/code.ts +40 -23
- package/src/recipes/codeBlock.ts +277 -0
- package/src/recipes/drawer.ts +150 -0
- package/src/recipes/filterField.ts +138 -0
- package/src/recipes/filterMenu.ts +71 -0
- package/src/recipes/filterToken.ts +189 -0
- package/src/recipes/inlineNote.ts +49 -0
- package/src/recipes/keyFact.ts +111 -0
- package/src/recipes/listItem.ts +25 -0
- package/src/recipes/menu.ts +41 -2
- package/src/recipes/pageBanner.ts +110 -0
- package/src/recipes/peekBar.ts +35 -0
- package/src/recipes/popover.ts +206 -0
- package/src/recipes/printPreview.ts +101 -0
- package/src/recipes/recipes-regular.ts +1 -1
- package/src/recipes/recipes-slot.ts +14 -0
- package/src/recipes/segmentedFields.ts +11 -5
- package/src/recipes/select.ts +204 -63
- package/src/recipes/spinner.ts +1 -1
- package/src/recipes/tabs.ts +161 -0
- package/src/recipes/tag.ts +13 -2
- package/src/recipes/timeMenus.ts +1 -1
- package/src/recipes/toast.ts +116 -0
- package/src/recipes/toggle.ts +3 -3
- package/src/styles/primitives/fontSizes.ts +1 -0
- package/src/styles/primitives/radii.ts +2 -0
- package/src/styles/utilities/keyframes.ts +38 -0
- package/src/utils/compoundComponent.ts +29 -0
- package/dist/preset-jXQwQ5KL.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okshaun/components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "okshaun design system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"@fontsource-variable/piazzolla": "^5.1.1",
|
|
60
60
|
"@fontsource/ibm-plex-mono": "^5.1.0",
|
|
61
61
|
"@fontsource/ibm-plex-sans": "^5.1.0",
|
|
62
|
+
"@tanstack/react-form": "^1.0.0",
|
|
62
63
|
"react": "^19.0.0",
|
|
63
|
-
"react-dom": "^19.0.0"
|
|
64
|
-
"@tanstack/react-form": "^1.0.0"
|
|
64
|
+
"react-dom": "^19.0.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"@fontsource-variable/piazzolla": {
|
|
@@ -86,14 +86,11 @@
|
|
|
86
86
|
"@fontsource/ibm-plex-mono": "^5.2.7",
|
|
87
87
|
"@fontsource/ibm-plex-sans": "^5.2.8",
|
|
88
88
|
"@pandacss/dev": "^1.8.0",
|
|
89
|
-
"@storybook/addon-a11y": "^
|
|
90
|
-
"@storybook/addon-
|
|
91
|
-
"@storybook/addon-
|
|
92
|
-
"@storybook/
|
|
93
|
-
"@storybook/
|
|
94
|
-
"@storybook/react": "^8.6.17",
|
|
95
|
-
"@storybook/react-vite": "^8.6.17",
|
|
96
|
-
"@storybook/test": "^8.6.17",
|
|
89
|
+
"@storybook/addon-a11y": "^10.6.0",
|
|
90
|
+
"@storybook/addon-docs": "^10.6.0",
|
|
91
|
+
"@storybook/addon-themes": "^10.6.0",
|
|
92
|
+
"@storybook/react": "^10.6.0",
|
|
93
|
+
"@storybook/react-vite": "^10.6.0",
|
|
97
94
|
"@tanstack/react-form": "^1.33.5",
|
|
98
95
|
"@types/node": "^22.15.30",
|
|
99
96
|
"@types/react": "19.0.8",
|
|
@@ -105,7 +102,7 @@
|
|
|
105
102
|
"postcss": "^8.5.1",
|
|
106
103
|
"react-doctor": "^0.0.29",
|
|
107
104
|
"simple-git-hooks": "^2.13.1",
|
|
108
|
-
"storybook": "^
|
|
105
|
+
"storybook": "^10.6.0",
|
|
109
106
|
"svg-sprite": "^2.0.4",
|
|
110
107
|
"svgo": "^3.0.2",
|
|
111
108
|
"typescript": "^5.7.3",
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { defineSlotRecipe } from '@pandacss/dev';
|
|
2
|
+
|
|
3
|
+
import { globalBaseStyles } from '~/styles/utilities';
|
|
4
|
+
|
|
5
|
+
const alertBase = {
|
|
6
|
+
root: {
|
|
7
|
+
...globalBaseStyles,
|
|
8
|
+
display: 'flex',
|
|
9
|
+
alignItems: 'flex-start',
|
|
10
|
+
gap: '8',
|
|
11
|
+
w: 'full',
|
|
12
|
+
p: '12',
|
|
13
|
+
borderRadius: '4',
|
|
14
|
+
border: 'default',
|
|
15
|
+
},
|
|
16
|
+
icon: {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
flex: 'none',
|
|
20
|
+
minH: '20',
|
|
21
|
+
},
|
|
22
|
+
content: {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
gap: '4',
|
|
26
|
+
flex: '1',
|
|
27
|
+
minW: '0',
|
|
28
|
+
},
|
|
29
|
+
title: {
|
|
30
|
+
maxW: 'full',
|
|
31
|
+
},
|
|
32
|
+
message: {
|
|
33
|
+
maxW: 'full',
|
|
34
|
+
},
|
|
35
|
+
actions: {
|
|
36
|
+
display: 'flex',
|
|
37
|
+
flexWrap: 'wrap',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
gap: '8',
|
|
40
|
+
mt: '4',
|
|
41
|
+
},
|
|
42
|
+
dismiss: {
|
|
43
|
+
flex: 'none',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const alertVariants = {
|
|
48
|
+
/**
|
|
49
|
+
* Semantic tone. Drives surface and border tokens; the component maps the
|
|
50
|
+
* same tone to text/icon color tokens and to the tone icon.
|
|
51
|
+
*/
|
|
52
|
+
tone: {
|
|
53
|
+
info: {
|
|
54
|
+
root: { bg: 'bg.info', border: 'info' },
|
|
55
|
+
},
|
|
56
|
+
success: {
|
|
57
|
+
root: { bg: 'bg.success', border: 'success' },
|
|
58
|
+
},
|
|
59
|
+
warning: {
|
|
60
|
+
root: { bg: 'bg.warning', border: 'warning' },
|
|
61
|
+
},
|
|
62
|
+
danger: {
|
|
63
|
+
root: { bg: 'bg.danger', border: 'danger' },
|
|
64
|
+
},
|
|
65
|
+
neutral: {
|
|
66
|
+
root: { bg: 'bg.neutral', border: 'default' },
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const alertRecipe = defineSlotRecipe({
|
|
72
|
+
className: 'alert',
|
|
73
|
+
jsx: ['Alert'],
|
|
74
|
+
slots: ['root', 'icon', 'content', 'title', 'message', 'actions', 'dismiss'],
|
|
75
|
+
base: alertBase,
|
|
76
|
+
variants: alertVariants,
|
|
77
|
+
defaultVariants: {
|
|
78
|
+
tone: 'info',
|
|
79
|
+
},
|
|
80
|
+
});
|
|
@@ -157,9 +157,9 @@ const autocompleteBase = {
|
|
|
157
157
|
},
|
|
158
158
|
listbox: {
|
|
159
159
|
...globalBaseStyles,
|
|
160
|
-
width: '
|
|
160
|
+
width: 'fit',
|
|
161
161
|
maxHeight: '192',
|
|
162
|
-
|
|
162
|
+
overflow: 'auto',
|
|
163
163
|
bg: 'surface',
|
|
164
164
|
borderRadius: '4',
|
|
165
165
|
boxShadow: 'overlay',
|
package/src/recipes/avatar.ts
CHANGED
|
@@ -4,12 +4,6 @@ export const avatarRecipe = defineSlotRecipe({
|
|
|
4
4
|
className: 'avatar',
|
|
5
5
|
jsx: ['Avatar'],
|
|
6
6
|
slots: ['root', 'image', 'fallback', 'presence', 'status'],
|
|
7
|
-
staticCss: [
|
|
8
|
-
{
|
|
9
|
-
size: ['xs', 'sm', 'md', 'lg', 'xl', '2xl'],
|
|
10
|
-
shape: ['circle', 'square', 'hexagon'],
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
7
|
base: {
|
|
14
8
|
root: {
|
|
15
9
|
display: 'inline-flex',
|
|
@@ -197,6 +191,19 @@ export const avatarRecipe = defineSlotRecipe({
|
|
|
197
191
|
},
|
|
198
192
|
},
|
|
199
193
|
},
|
|
194
|
+
stacked: {
|
|
195
|
+
true: {
|
|
196
|
+
root: {
|
|
197
|
+
outlineWidth: '2',
|
|
198
|
+
outlineStyle: 'solid',
|
|
199
|
+
outlineColor: 'surface',
|
|
200
|
+
outlineOffset: '-2',
|
|
201
|
+
'&:not(:first-child)': {
|
|
202
|
+
ml: '-4',
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
200
207
|
},
|
|
201
208
|
defaultVariants: {
|
|
202
209
|
size: 'md',
|
package/src/recipes/button.ts
CHANGED
|
@@ -2,6 +2,14 @@ import { defineSlotRecipe } from '@pandacss/dev';
|
|
|
2
2
|
|
|
3
3
|
import { globalBaseStyles } from '~/styles/utilities';
|
|
4
4
|
|
|
5
|
+
// A button with a `disabledReason` takes pointer events so its tooltip can
|
|
6
|
+
// open on hover. These selectors keep hover and press styles off it.
|
|
7
|
+
const enabled = ":not([aria-disabled='true'])";
|
|
8
|
+
const hoverEnabled = `&:is(:hover, [data-hover=true])${enabled}`;
|
|
9
|
+
const activeEnabled = `&:is(:active, [data-active=true])${enabled}`;
|
|
10
|
+
const groupHoverEnabled = `.group:is(:hover, [data-hover=true])${enabled} &`;
|
|
11
|
+
const groupActiveEnabled = `.group:is(:active, [data-active=true])${enabled} &`;
|
|
12
|
+
|
|
5
13
|
// Ported from the Cetec design system: slots, the custom-property sizing
|
|
6
14
|
// mechanism, the size variant and the style-variant set. The recipe's
|
|
7
15
|
// before/after variants are internal, computed from Button's props, so the
|
|
@@ -85,10 +93,10 @@ const buttonVariants = {
|
|
|
85
93
|
container: {
|
|
86
94
|
bg: 'bg.neutral',
|
|
87
95
|
borderColor: 'transparent',
|
|
88
|
-
|
|
96
|
+
[hoverEnabled]: {
|
|
89
97
|
bg: 'bg.neutral.hovered',
|
|
90
98
|
},
|
|
91
|
-
|
|
99
|
+
[activeEnabled]: {
|
|
92
100
|
bg: 'bg.neutral.pressed',
|
|
93
101
|
},
|
|
94
102
|
},
|
|
@@ -98,18 +106,18 @@ const buttonVariants = {
|
|
|
98
106
|
slot: {
|
|
99
107
|
fill: 'icon.decorative',
|
|
100
108
|
mixBlendMode: { base: 'multiply', _dark: 'screen' },
|
|
101
|
-
|
|
102
|
-
|
|
109
|
+
[groupHoverEnabled]: { fill: 'current' },
|
|
110
|
+
[groupActiveEnabled]: { fill: 'current' },
|
|
103
111
|
},
|
|
104
112
|
},
|
|
105
113
|
primary: {
|
|
106
114
|
container: {
|
|
107
115
|
bg: 'bg.neutral.boldest',
|
|
108
116
|
borderColor: 'transparent',
|
|
109
|
-
|
|
117
|
+
[hoverEnabled]: {
|
|
110
118
|
bg: 'bg.neutral.bold.hovered',
|
|
111
119
|
},
|
|
112
|
-
|
|
120
|
+
[activeEnabled]: {
|
|
113
121
|
bg: 'bg.neutral.bold.pressed',
|
|
114
122
|
},
|
|
115
123
|
},
|
|
@@ -119,8 +127,8 @@ const buttonVariants = {
|
|
|
119
127
|
slot: {
|
|
120
128
|
fill: 'icon.decorative.inverse',
|
|
121
129
|
mixBlendMode: { base: 'screen', _dark: 'multiply' },
|
|
122
|
-
|
|
123
|
-
|
|
130
|
+
[groupHoverEnabled]: { fill: 'icon.decorative.inverse.hovered' },
|
|
131
|
+
[groupActiveEnabled]: { fill: 'icon.decorative.inverse.hovered' },
|
|
124
132
|
_groupDisabled: {
|
|
125
133
|
fill: 'icon.decorative.inverse',
|
|
126
134
|
},
|
|
@@ -130,10 +138,10 @@ const buttonVariants = {
|
|
|
130
138
|
container: {
|
|
131
139
|
bg: 'bg.neutral.subtle',
|
|
132
140
|
borderColor: 'border',
|
|
133
|
-
|
|
141
|
+
[hoverEnabled]: {
|
|
134
142
|
bg: 'bg.neutral.subtle.hovered',
|
|
135
143
|
},
|
|
136
|
-
|
|
144
|
+
[activeEnabled]: {
|
|
137
145
|
bg: 'bg.neutral.subtle.pressed',
|
|
138
146
|
},
|
|
139
147
|
},
|
|
@@ -143,18 +151,18 @@ const buttonVariants = {
|
|
|
143
151
|
slot: {
|
|
144
152
|
fill: 'icon.decorative',
|
|
145
153
|
mixBlendMode: { base: 'multiply', _dark: 'screen' },
|
|
146
|
-
|
|
147
|
-
|
|
154
|
+
[groupHoverEnabled]: { fill: 'current' },
|
|
155
|
+
[groupActiveEnabled]: { fill: 'current' },
|
|
148
156
|
},
|
|
149
157
|
},
|
|
150
158
|
ghost: {
|
|
151
159
|
container: {
|
|
152
160
|
bg: 'bg.neutral.subtle',
|
|
153
161
|
borderColor: 'transparent',
|
|
154
|
-
|
|
162
|
+
[hoverEnabled]: {
|
|
155
163
|
bg: 'bg.neutral.subtle.hovered',
|
|
156
164
|
},
|
|
157
|
-
|
|
165
|
+
[activeEnabled]: {
|
|
158
166
|
bg: 'bg.neutral.subtle.pressed',
|
|
159
167
|
},
|
|
160
168
|
},
|
|
@@ -164,31 +172,34 @@ const buttonVariants = {
|
|
|
164
172
|
slot: {
|
|
165
173
|
fill: 'icon.decorative',
|
|
166
174
|
mixBlendMode: { base: 'multiply', _dark: 'screen' },
|
|
167
|
-
|
|
168
|
-
|
|
175
|
+
[groupHoverEnabled]: { fill: 'current' },
|
|
176
|
+
[groupActiveEnabled]: { fill: 'current' },
|
|
169
177
|
},
|
|
170
178
|
},
|
|
171
179
|
danger: {
|
|
172
180
|
container: {
|
|
173
181
|
bg: 'red.50',
|
|
174
182
|
borderColor: 'transparent',
|
|
175
|
-
|
|
183
|
+
[hoverEnabled]: {
|
|
176
184
|
bg: 'red.40',
|
|
177
185
|
},
|
|
178
|
-
|
|
186
|
+
[activeEnabled]: {
|
|
179
187
|
bg: 'red.60',
|
|
180
188
|
},
|
|
181
189
|
},
|
|
182
190
|
mainContent: {
|
|
183
191
|
color: 'neutral.0',
|
|
184
192
|
},
|
|
193
|
+
// The red background and white label are the same in both themes, so
|
|
194
|
+
// the icon is too. The inverse icon tokens turn dark in dark mode, and
|
|
195
|
+
// a dark icon screened on red does not show.
|
|
185
196
|
slot: {
|
|
186
|
-
fill: '
|
|
197
|
+
fill: 'neutral.30',
|
|
187
198
|
mixBlendMode: 'screen',
|
|
188
|
-
|
|
189
|
-
|
|
199
|
+
[groupHoverEnabled]: { fill: 'neutral.0' },
|
|
200
|
+
[groupActiveEnabled]: { fill: 'neutral.0' },
|
|
190
201
|
_groupDisabled: {
|
|
191
|
-
fill: '
|
|
202
|
+
fill: 'neutral.30',
|
|
192
203
|
},
|
|
193
204
|
},
|
|
194
205
|
},
|
|
@@ -196,11 +207,11 @@ const buttonVariants = {
|
|
|
196
207
|
container: {
|
|
197
208
|
bg: 'bg.selected',
|
|
198
209
|
borderColor: 'transparent',
|
|
199
|
-
|
|
210
|
+
[hoverEnabled]: {
|
|
200
211
|
bg: 'bg.selected.hovered',
|
|
201
212
|
color: 'text.selected',
|
|
202
213
|
},
|
|
203
|
-
|
|
214
|
+
[activeEnabled]: {
|
|
204
215
|
bg: 'bg.selected.pressed',
|
|
205
216
|
color: 'text.selected',
|
|
206
217
|
},
|
|
@@ -211,8 +222,8 @@ const buttonVariants = {
|
|
|
211
222
|
slot: {
|
|
212
223
|
fill: 'icon.selected',
|
|
213
224
|
mixBlendMode: { base: 'multiply', _dark: 'screen' },
|
|
214
|
-
|
|
215
|
-
|
|
225
|
+
[groupHoverEnabled]: { fill: 'icon.selected' },
|
|
226
|
+
[groupActiveEnabled]: { fill: 'icon.selected' },
|
|
216
227
|
_groupDisabled: {
|
|
217
228
|
fill: 'icon.selected',
|
|
218
229
|
},
|
|
@@ -222,10 +233,10 @@ const buttonVariants = {
|
|
|
222
233
|
container: {
|
|
223
234
|
bg: 'bg.selected.bold',
|
|
224
235
|
borderColor: 'transparent',
|
|
225
|
-
|
|
236
|
+
[hoverEnabled]: {
|
|
226
237
|
bg: 'bg.selected.bold.hovered',
|
|
227
238
|
},
|
|
228
|
-
|
|
239
|
+
[activeEnabled]: {
|
|
229
240
|
bg: 'bg.selected.bold.pressed',
|
|
230
241
|
},
|
|
231
242
|
},
|
|
@@ -235,8 +246,8 @@ const buttonVariants = {
|
|
|
235
246
|
slot: {
|
|
236
247
|
fill: 'icon.decorative.inverse',
|
|
237
248
|
mixBlendMode: { base: 'screen', _dark: 'multiply' },
|
|
238
|
-
|
|
239
|
-
|
|
249
|
+
[groupHoverEnabled]: { fill: 'icon.decorative.inverse.hovered' },
|
|
250
|
+
[groupActiveEnabled]: { fill: 'icon.decorative.inverse.hovered' },
|
|
240
251
|
_groupDisabled: {
|
|
241
252
|
fill: 'icon.decorative.inverse',
|
|
242
253
|
},
|
package/src/recipes/checkbox.ts
CHANGED
|
@@ -68,6 +68,8 @@ export const checkboxRecipe = defineSlotRecipe({
|
|
|
68
68
|
width: '24',
|
|
69
69
|
height: '24',
|
|
70
70
|
zIndex: '3',
|
|
71
|
+
// The icons sit above the input, so clicks must pass through to it.
|
|
72
|
+
pointerEvents: 'none',
|
|
71
73
|
"&:is([name='checkbox'])": {
|
|
72
74
|
fill: 'icon.subtlest',
|
|
73
75
|
zIndex: '3',
|
|
@@ -81,6 +83,7 @@ export const checkboxRecipe = defineSlotRecipe({
|
|
|
81
83
|
height: '24',
|
|
82
84
|
fill: 'surface',
|
|
83
85
|
zIndex: 'base',
|
|
86
|
+
pointerEvents: 'none',
|
|
84
87
|
},
|
|
85
88
|
},
|
|
86
89
|
});
|
package/src/recipes/chip.ts
CHANGED
|
@@ -54,6 +54,19 @@ const buttonStyles = {
|
|
|
54
54
|
fill: 'icon.decorative.inverse.hovered',
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
|
+
// Deviation from Cetec: the body carries data-selected itself, and :has()
|
|
58
|
+
// only matches descendants. Without these rules, icons in a selected chip
|
|
59
|
+
// keep the unselected fill on the dark background.
|
|
60
|
+
'&[data-selected=true]': {
|
|
61
|
+
_icon: {
|
|
62
|
+
fill: 'icon.decorative.inverse',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
'&[data-selected=true]:is(:hover, [data-hover], :active, [data-active])': {
|
|
66
|
+
_icon: {
|
|
67
|
+
fill: 'icon.decorative.inverse.hovered',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
57
70
|
};
|
|
58
71
|
|
|
59
72
|
export const chipRecipe = defineSlotRecipe({
|
|
@@ -134,6 +147,9 @@ export const chipRecipe = defineSlotRecipe({
|
|
|
134
147
|
outlineStyle: 'solid',
|
|
135
148
|
outlineColor: 'transparent',
|
|
136
149
|
outlineOffset: 'calc(token(sizes.2) * -1)',
|
|
150
|
+
_focusVisible: {
|
|
151
|
+
outlineColor: 'border.focused',
|
|
152
|
+
},
|
|
137
153
|
'button&': {
|
|
138
154
|
...buttonStyles,
|
|
139
155
|
},
|
package/src/recipes/code.ts
CHANGED
|
@@ -1,35 +1,52 @@
|
|
|
1
1
|
import { defineRecipe } from '@pandacss/dev';
|
|
2
2
|
|
|
3
|
+
import { globalBaseStyles } from '~/styles/utilities';
|
|
4
|
+
|
|
3
5
|
const codeBase = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
fontSize: '
|
|
6
|
+
...globalBaseStyles,
|
|
7
|
+
display: 'inline',
|
|
8
|
+
fontFamily: 'mono',
|
|
9
|
+
// Relative to the surrounding text, so inline code keeps the same optical
|
|
10
|
+
// size in a heading, a paragraph, or a table cell.
|
|
11
|
+
fontSize: 'smaller',
|
|
12
|
+
lineHeight: 'inherit',
|
|
13
|
+
color: 'text',
|
|
14
|
+
px: '4',
|
|
15
|
+
rounded: '4',
|
|
16
|
+
boxDecorationBreak: 'clone',
|
|
17
|
+
// Long identifiers, part numbers, and tokens wrap instead of overflowing
|
|
18
|
+
// their container.
|
|
19
|
+
overflowWrap: 'anywhere',
|
|
20
|
+
whiteSpace: 'normal',
|
|
10
21
|
};
|
|
11
22
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
const codeVariants = {
|
|
24
|
+
variant: {
|
|
25
|
+
/** Tinted background. The default for code inside running text. */
|
|
26
|
+
subtle: {
|
|
27
|
+
bg: 'bg.neutral',
|
|
28
|
+
},
|
|
29
|
+
/** Border only. Use where a tint would compete with a selected row. */
|
|
30
|
+
outline: {
|
|
31
|
+
borderWidth: '1',
|
|
32
|
+
borderStyle: 'solid',
|
|
33
|
+
borderColor: 'border',
|
|
34
|
+
bg: 'transparent',
|
|
35
|
+
},
|
|
36
|
+
/** Monospace font only. Use for values in dense tables and lists. */
|
|
37
|
+
plain: {
|
|
38
|
+
px: '0',
|
|
39
|
+
bg: 'transparent',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
23
42
|
};
|
|
24
43
|
|
|
25
44
|
export const codeRecipe = defineRecipe({
|
|
26
45
|
className: 'code',
|
|
27
46
|
jsx: ['Code'],
|
|
28
47
|
base: codeBase,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
jsx: ['Pre'],
|
|
34
|
-
base: preBase,
|
|
48
|
+
variants: codeVariants,
|
|
49
|
+
defaultVariants: {
|
|
50
|
+
variant: 'subtle',
|
|
51
|
+
},
|
|
35
52
|
});
|