@zendeskgarden/react-typography 9.0.0-next.8 → 9.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/dist/esm/elements/CodeBlock.js +20 -15
- package/dist/esm/elements/span/StartIcon.js +1 -1
- package/dist/esm/styled/StyledBlockquote.js +6 -6
- package/dist/esm/styled/StyledCode.js +42 -10
- package/dist/esm/styled/StyledCodeBlock.js +15 -9
- package/dist/esm/styled/StyledCodeBlockContainer.js +2 -5
- package/dist/esm/styled/StyledCodeBlockLine.js +58 -35
- package/dist/esm/styled/StyledCodeBlockToken.js +159 -23
- package/dist/esm/styled/StyledEllipsis.js +2 -5
- package/dist/esm/styled/StyledFont.js +35 -22
- package/dist/esm/styled/StyledIcon.js +4 -15
- package/dist/esm/styled/StyledList.js +3 -9
- package/dist/esm/styled/StyledListItem.js +3 -3
- package/dist/esm/styled/StyledParagraph.js +2 -5
- package/dist/esm/types/index.js +1 -1
- package/dist/index.cjs.js +341 -152
- package/dist/typings/elements/lists/OrderedList.d.ts +3 -1
- package/dist/typings/elements/lists/UnorderedList.d.ts +3 -1
- package/dist/typings/elements/span/Span.d.ts +3 -1
- package/dist/typings/styled/StyledCode.d.ts +3 -2
- package/dist/typings/styled/StyledCodeBlock.d.ts +1 -4
- package/dist/typings/styled/StyledCodeBlockLine.d.ts +0 -5
- package/dist/typings/styled/StyledCodeBlockToken.d.ts +1 -4
- package/dist/typings/styled/StyledIcon.d.ts +2 -3
- package/dist/typings/types/index.d.ts +5 -3
- package/dist/typings/utils/useOrderedListContext.d.ts +0 -1
- package/dist/typings/utils/useUnorderedListContext.d.ts +0 -1
- package/package.json +8 -9
- package/LICENSE.md +0 -176
package/dist/index.cjs.js
CHANGED
|
@@ -26,7 +26,7 @@ const SIZE = ['small', 'medium', 'large'];
|
|
|
26
26
|
const INHERIT_SIZE = ['inherit', ...SIZE];
|
|
27
27
|
const TYPE_ORDERED_LIST = ['decimal', 'decimal-leading-zero', 'lower-alpha', 'lower-roman', 'upper-alpha', 'upper-roman'];
|
|
28
28
|
const TYPE_UNORDERED_LIST = ['circle', 'disc', 'square'];
|
|
29
|
-
const LANGUAGES = ['
|
|
29
|
+
const LANGUAGES = ['bash', 'css', 'diff', 'graphql', 'javascript', 'json', 'jsx', 'markdown', 'markup', 'python', 'typescript', 'tsx', 'yaml'];
|
|
30
30
|
|
|
31
31
|
const COMPONENT_ID$9 = 'typography.font';
|
|
32
32
|
[...SIZE, 'extralarge', '2xlarge', '3xlarge'];
|
|
@@ -38,42 +38,55 @@ const THEME_SIZES = {
|
|
|
38
38
|
'2xlarge': 'xxl',
|
|
39
39
|
'3xlarge': 'xxxl'
|
|
40
40
|
};
|
|
41
|
-
const fontStyles =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
const fontStyles = _ref => {
|
|
42
|
+
let {
|
|
43
|
+
hue,
|
|
44
|
+
isBold,
|
|
45
|
+
isMonospace,
|
|
46
|
+
size,
|
|
47
|
+
theme
|
|
48
|
+
} = _ref;
|
|
49
|
+
const monospace = isMonospace && ['inherit', 'small', 'medium', 'large'].indexOf(size) !== -1;
|
|
50
|
+
const fontFamily = monospace && theme.fonts.mono;
|
|
51
|
+
const direction = theme.rtl ? 'rtl' : 'ltr';
|
|
45
52
|
let fontSize;
|
|
46
53
|
let fontWeight;
|
|
47
54
|
let lineHeight;
|
|
48
55
|
let color;
|
|
49
56
|
if (monospace) {
|
|
50
|
-
if (
|
|
57
|
+
if (size === 'inherit') {
|
|
51
58
|
fontSize = 'calc(1em - 1px)';
|
|
52
59
|
lineHeight = 'normal';
|
|
53
60
|
} else {
|
|
54
|
-
const themeSize = THEME_SIZES[
|
|
55
|
-
fontSize = polished.math(`${
|
|
56
|
-
lineHeight = polished.math(`${
|
|
61
|
+
const themeSize = THEME_SIZES[size];
|
|
62
|
+
fontSize = polished.math(`${theme.fontSizes[themeSize]} - 1px`);
|
|
63
|
+
lineHeight = polished.math(`${theme.lineHeights[themeSize]} - 1px`);
|
|
57
64
|
}
|
|
58
|
-
} else if (
|
|
59
|
-
const themeSize = THEME_SIZES[
|
|
60
|
-
fontSize =
|
|
61
|
-
lineHeight =
|
|
65
|
+
} else if (size !== 'inherit') {
|
|
66
|
+
const themeSize = THEME_SIZES[size];
|
|
67
|
+
fontSize = theme.fontSizes[themeSize];
|
|
68
|
+
lineHeight = theme.lineHeights[themeSize];
|
|
62
69
|
}
|
|
63
|
-
if (
|
|
64
|
-
fontWeight =
|
|
65
|
-
} else if (
|
|
66
|
-
fontWeight =
|
|
70
|
+
if (isBold === true) {
|
|
71
|
+
fontWeight = theme.fontWeights.semibold;
|
|
72
|
+
} else if (isBold === false || size !== 'inherit') {
|
|
73
|
+
fontWeight = theme.fontWeights.regular;
|
|
67
74
|
}
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
|
|
75
|
+
if (hue) {
|
|
76
|
+
const options = hue.includes('.') ? {
|
|
77
|
+
variable: hue,
|
|
78
|
+
theme
|
|
79
|
+
} : {
|
|
80
|
+
hue,
|
|
81
|
+
theme
|
|
82
|
+
};
|
|
83
|
+
color = reactTheming.getColor(options);
|
|
71
84
|
}
|
|
72
|
-
return styled.css(["line-height:", ";color:", ";font-family:", ";font-size:", ";font-weight:", ";direction:", ";"], lineHeight, color, fontFamily, fontSize, fontWeight, direction);
|
|
85
|
+
return styled.css(["transition:color 0.1s ease-in-out;line-height:", ";color:", ";font-family:", ";font-size:", ";font-weight:", ";direction:", ";"], lineHeight, color, fontFamily, fontSize, fontWeight, direction);
|
|
73
86
|
};
|
|
74
87
|
const StyledFont = styled__default.default.div.attrs({
|
|
75
88
|
'data-garden-id': COMPONENT_ID$9,
|
|
76
|
-
'data-garden-version': '9.0.0
|
|
89
|
+
'data-garden-version': '9.0.0'
|
|
77
90
|
}).withConfig({
|
|
78
91
|
displayName: "StyledFont",
|
|
79
92
|
componentId: "sc-1iildbo-0"
|
|
@@ -86,106 +99,167 @@ StyledFont.defaultProps = {
|
|
|
86
99
|
const COMPONENT_ID$8 = 'typography.blockquote';
|
|
87
100
|
const StyledBlockquote = styled__default.default.blockquote.attrs({
|
|
88
101
|
'data-garden-id': COMPONENT_ID$8,
|
|
89
|
-
'data-garden-version': '9.0.0
|
|
102
|
+
'data-garden-version': '9.0.0'
|
|
90
103
|
}).withConfig({
|
|
91
104
|
displayName: "StyledBlockquote",
|
|
92
105
|
componentId: "sc-1tt3ye0-0"
|
|
93
|
-
})(["margin:0;border-", ":", " solid;border-color:", ";padding:0;padding-", ":", "px;direction:", ";& + &,p + &{margin-top:", ";}", ";"], props => props.theme.rtl ? 'right' : 'left', props => props.theme.shadowWidths.sm, props => reactTheming.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
};
|
|
106
|
+
})(["margin:0;border-", ":", " solid;border-color:", ";padding:0;padding-", ":", "px;direction:", ";& + &,p + &{margin-top:", ";}", ";"], props => props.theme.rtl ? 'right' : 'left', props => props.theme.shadowWidths.sm, props => reactTheming.getColor({
|
|
107
|
+
theme: props.theme,
|
|
108
|
+
variable: 'border.default'
|
|
109
|
+
}), props => props.theme.rtl ? 'right' : 'left', props => props.theme.space.base * 4, props => props.theme.rtl ? 'rtl' : 'ltr', props => props.theme.lineHeights[THEME_SIZES[props.size]], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$8, props));
|
|
97
110
|
|
|
98
111
|
const COMPONENT_ID$7 = 'typography.code';
|
|
99
|
-
const colorStyles$3 =
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
112
|
+
const colorStyles$3 = _ref => {
|
|
113
|
+
let {
|
|
114
|
+
hue,
|
|
115
|
+
theme
|
|
116
|
+
} = _ref;
|
|
117
|
+
const bgColorArgs = {
|
|
118
|
+
theme,
|
|
119
|
+
light: {
|
|
120
|
+
offset: 100
|
|
121
|
+
},
|
|
122
|
+
dark: {
|
|
123
|
+
offset: -100
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const fgColorArgs = {
|
|
127
|
+
theme
|
|
128
|
+
};
|
|
129
|
+
switch (hue) {
|
|
130
|
+
case 'green':
|
|
131
|
+
bgColorArgs.variable = 'background.success';
|
|
132
|
+
fgColorArgs.variable = 'foreground.successEmphasis';
|
|
133
|
+
break;
|
|
134
|
+
case 'red':
|
|
135
|
+
bgColorArgs.variable = 'background.danger';
|
|
136
|
+
fgColorArgs.variable = 'foreground.dangerEmphasis';
|
|
137
|
+
break;
|
|
138
|
+
case 'yellow':
|
|
139
|
+
bgColorArgs.variable = 'background.warning';
|
|
140
|
+
fgColorArgs.variable = 'foreground.warningEmphasis';
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
fgColorArgs.variable = 'foreground.default';
|
|
144
|
+
bgColorArgs.variable = 'background.subtle';
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
const backgroundColor = reactTheming.getColor(bgColorArgs);
|
|
148
|
+
const foregroundColor = reactTheming.getColor(fgColorArgs);
|
|
104
149
|
return styled.css(["background-color:", ";color:", ";a &{color:inherit;}"], backgroundColor, foregroundColor);
|
|
105
150
|
};
|
|
106
151
|
const StyledCode = styled__default.default(StyledFont).attrs({
|
|
107
152
|
'data-garden-id': COMPONENT_ID$7,
|
|
108
|
-
'data-garden-version': '9.0.0
|
|
109
|
-
as: 'code'
|
|
153
|
+
'data-garden-version': '9.0.0',
|
|
154
|
+
as: 'code',
|
|
155
|
+
isMonospace: true
|
|
110
156
|
}).withConfig({
|
|
111
157
|
displayName: "StyledCode",
|
|
112
158
|
componentId: "sc-l8yvmf-0"
|
|
113
159
|
})(["border-radius:", ";padding:1.5px;", ";", ";"], props => props.theme.borderRadii.sm, props => colorStyles$3(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$7, props));
|
|
114
160
|
StyledCode.defaultProps = {
|
|
115
161
|
theme: reactTheming.DEFAULT_THEME,
|
|
116
|
-
|
|
117
|
-
hue: 'neutralHue',
|
|
162
|
+
hue: 'grey',
|
|
118
163
|
size: 'inherit'
|
|
119
164
|
};
|
|
120
165
|
|
|
121
166
|
const COMPONENT_ID$6 = 'typography.codeblock';
|
|
122
|
-
const colorStyles$2 =
|
|
123
|
-
|
|
124
|
-
|
|
167
|
+
const colorStyles$2 = _ref => {
|
|
168
|
+
let {
|
|
169
|
+
theme
|
|
170
|
+
} = _ref;
|
|
171
|
+
const backgroundColor = reactTheming.getColor({
|
|
172
|
+
theme,
|
|
173
|
+
variable: 'background.recessed'
|
|
174
|
+
});
|
|
175
|
+
const foregroundColor = reactTheming.getColor({
|
|
176
|
+
theme,
|
|
177
|
+
variable: 'foreground.default'
|
|
178
|
+
});
|
|
125
179
|
return styled.css(["background-color:", ";color:", ";"], backgroundColor, foregroundColor);
|
|
126
180
|
};
|
|
127
181
|
const StyledCodeBlock = styled__default.default.pre.attrs({
|
|
128
182
|
'data-garden-id': COMPONENT_ID$6,
|
|
129
|
-
'data-garden-version': '9.0.0
|
|
183
|
+
'data-garden-version': '9.0.0'
|
|
130
184
|
}).withConfig({
|
|
131
185
|
displayName: "StyledCodeBlock",
|
|
132
186
|
componentId: "sc-5wky57-0"
|
|
133
|
-
})(["display:table;margin:0;padding:", "px;box-sizing:border-box;width:100%;direction:ltr;white-space:pre;counter-reset:linenumber;", ";", ";"], props => props.theme.space.base * 3,
|
|
134
|
-
StyledCodeBlock.defaultProps = {
|
|
135
|
-
theme: reactTheming.DEFAULT_THEME
|
|
136
|
-
};
|
|
187
|
+
})(["display:table;margin:0;padding:", "px;box-sizing:border-box;width:100%;direction:ltr;white-space:pre;counter-reset:linenumber;", ";", ";"], props => props.theme.space.base * 3, colorStyles$2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
137
188
|
|
|
138
189
|
const COMPONENT_ID$5 = 'typography.codeblock_container';
|
|
139
190
|
const StyledCodeBlockContainer = styled__default.default.div.attrs({
|
|
140
191
|
'data-garden-id': COMPONENT_ID$5,
|
|
141
|
-
'data-garden-version': '9.0.0
|
|
192
|
+
'data-garden-version': '9.0.0'
|
|
142
193
|
}).withConfig({
|
|
143
194
|
displayName: "StyledCodeBlockContainer",
|
|
144
195
|
componentId: "sc-14zgbfw-0"
|
|
145
196
|
})(["transition:box-shadow 0.1s ease-in-out;overflow:auto;", " ", ";"], props => reactTheming.focusStyles({
|
|
146
197
|
theme: props.theme
|
|
147
198
|
}), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
148
|
-
StyledCodeBlockContainer.defaultProps = {
|
|
149
|
-
theme: reactTheming.DEFAULT_THEME
|
|
150
|
-
};
|
|
151
199
|
|
|
152
200
|
const COMPONENT_ID$4 = 'typography.codeblock_code';
|
|
153
|
-
const colorStyles$1 =
|
|
201
|
+
const colorStyles$1 = _ref => {
|
|
202
|
+
let {
|
|
203
|
+
theme,
|
|
204
|
+
diff,
|
|
205
|
+
isHighlighted
|
|
206
|
+
} = _ref;
|
|
154
207
|
let backgroundColor;
|
|
155
|
-
if (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
backgroundColor = reactTheming.
|
|
208
|
+
if (diff) {
|
|
209
|
+
const hues = {
|
|
210
|
+
hunk: 'royal',
|
|
211
|
+
add: 'lime',
|
|
212
|
+
delete: 'crimson',
|
|
213
|
+
change: 'lemon'
|
|
214
|
+
};
|
|
215
|
+
backgroundColor = reactTheming.getColor({
|
|
216
|
+
theme,
|
|
217
|
+
hue: hues[diff],
|
|
218
|
+
dark: {
|
|
219
|
+
shade: 600
|
|
220
|
+
},
|
|
221
|
+
light: {
|
|
222
|
+
shade: 400
|
|
223
|
+
},
|
|
224
|
+
transparency: theme.opacity[300]
|
|
225
|
+
});
|
|
226
|
+
} else if (isHighlighted) {
|
|
227
|
+
backgroundColor = reactTheming.getColor({
|
|
228
|
+
theme,
|
|
229
|
+
dark: {
|
|
230
|
+
hue: 'white'
|
|
231
|
+
},
|
|
232
|
+
light: {
|
|
233
|
+
hue: 'neutralHue',
|
|
234
|
+
shade: 700
|
|
235
|
+
},
|
|
236
|
+
transparency: theme.opacity[100]
|
|
237
|
+
});
|
|
175
238
|
}
|
|
176
239
|
return styled.css(["background-color:", ";"], backgroundColor);
|
|
177
240
|
};
|
|
178
|
-
const lineNumberStyles =
|
|
179
|
-
|
|
241
|
+
const lineNumberStyles = _ref2 => {
|
|
242
|
+
let {
|
|
243
|
+
theme,
|
|
244
|
+
language,
|
|
245
|
+
size
|
|
246
|
+
} = _ref2;
|
|
247
|
+
const color = reactTheming.getColor({
|
|
248
|
+
theme,
|
|
249
|
+
variable: 'foreground.subtle',
|
|
250
|
+
light: {
|
|
251
|
+
offset: -100
|
|
252
|
+
}
|
|
253
|
+
});
|
|
180
254
|
let padding;
|
|
181
|
-
if (
|
|
255
|
+
if (language && language === 'diff') {
|
|
182
256
|
padding = 0;
|
|
183
|
-
} else if (
|
|
184
|
-
padding =
|
|
185
|
-
} else if (
|
|
186
|
-
padding =
|
|
257
|
+
} else if (size === 'small') {
|
|
258
|
+
padding = theme.space.base * 4;
|
|
259
|
+
} else if (size === 'large') {
|
|
260
|
+
padding = theme.space.base * 7;
|
|
187
261
|
} else {
|
|
188
|
-
padding =
|
|
262
|
+
padding = theme.space.base * 6;
|
|
189
263
|
}
|
|
190
264
|
return `
|
|
191
265
|
&::before {
|
|
@@ -201,85 +275,205 @@ const lineNumberStyles = props => {
|
|
|
201
275
|
};
|
|
202
276
|
const StyledCodeBlockLine = styled__default.default(StyledFont).attrs({
|
|
203
277
|
'data-garden-id': COMPONENT_ID$4,
|
|
204
|
-
'data-garden-version': '9.0.0
|
|
278
|
+
'data-garden-version': '9.0.0',
|
|
205
279
|
as: 'code',
|
|
206
280
|
isMonospace: true
|
|
207
281
|
}).withConfig({
|
|
208
282
|
displayName: "StyledCodeBlockLine",
|
|
209
283
|
componentId: "sc-1goay17-0"
|
|
210
|
-
})(["display:table-row;height:", ";direction:ltr;", ";", ";&::after{display:inline-block;width:", "px;content:'';}", ";"], props => props.theme.lineHeights[THEME_SIZES[props.size]],
|
|
211
|
-
StyledCodeBlockLine.defaultProps = {
|
|
212
|
-
theme: reactTheming.DEFAULT_THEME
|
|
213
|
-
};
|
|
284
|
+
})(["display:table-row;height:", ";direction:ltr;", ";", ";&::after{display:inline-block;width:", "px;content:'';}", ";"], props => props.theme.lineHeights[THEME_SIZES[props.size]], colorStyles$1, props => props.isNumbered && lineNumberStyles(props), props => props.theme.space.base * 3, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
214
285
|
|
|
215
286
|
const COMPONENT_ID$3 = 'typography.codeblock_token';
|
|
216
|
-
const colorStyles =
|
|
217
|
-
|
|
287
|
+
const colorStyles = _ref => {
|
|
288
|
+
let {
|
|
289
|
+
theme
|
|
290
|
+
} = _ref;
|
|
218
291
|
const colors = {
|
|
219
|
-
boolean:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
292
|
+
boolean: reactTheming.getColor({
|
|
293
|
+
theme,
|
|
294
|
+
dark: {
|
|
295
|
+
hue: 'azure',
|
|
296
|
+
shade: 600
|
|
297
|
+
},
|
|
298
|
+
light: {
|
|
299
|
+
hue: 'royal',
|
|
300
|
+
shade: 700
|
|
301
|
+
}
|
|
302
|
+
}),
|
|
303
|
+
builtin: reactTheming.getColor({
|
|
304
|
+
theme,
|
|
305
|
+
hue: 'teal',
|
|
306
|
+
dark: {
|
|
307
|
+
shade: 600
|
|
308
|
+
},
|
|
309
|
+
light: {
|
|
310
|
+
shade: 700
|
|
311
|
+
}
|
|
312
|
+
}),
|
|
313
|
+
comment: reactTheming.getColor({
|
|
314
|
+
theme,
|
|
315
|
+
dark: {
|
|
316
|
+
hue: 'mint',
|
|
317
|
+
shade: 600
|
|
318
|
+
},
|
|
319
|
+
light: {
|
|
320
|
+
hue: 'lime',
|
|
321
|
+
shade: 700
|
|
322
|
+
}
|
|
323
|
+
}),
|
|
324
|
+
constant: reactTheming.getColor({
|
|
325
|
+
theme,
|
|
326
|
+
dark: {
|
|
327
|
+
hue: 'blue',
|
|
328
|
+
shade: 600
|
|
329
|
+
},
|
|
330
|
+
light: {
|
|
331
|
+
hue: 'azure',
|
|
332
|
+
shade: 700
|
|
333
|
+
}
|
|
334
|
+
}),
|
|
335
|
+
coord: reactTheming.getColor({
|
|
336
|
+
theme,
|
|
337
|
+
hue: 'blue',
|
|
338
|
+
dark: {
|
|
339
|
+
shade: 200
|
|
340
|
+
},
|
|
341
|
+
light: {
|
|
342
|
+
shade: 800
|
|
343
|
+
}
|
|
344
|
+
}),
|
|
345
|
+
deleted: reactTheming.getColor({
|
|
346
|
+
theme,
|
|
347
|
+
hue: 'red',
|
|
348
|
+
dark: {
|
|
349
|
+
shade: 200
|
|
350
|
+
},
|
|
351
|
+
light: {
|
|
352
|
+
shade: 800
|
|
353
|
+
}
|
|
354
|
+
}),
|
|
355
|
+
diff: reactTheming.getColor({
|
|
356
|
+
theme,
|
|
357
|
+
hue: 'yellow',
|
|
358
|
+
dark: {
|
|
359
|
+
shade: 200
|
|
360
|
+
},
|
|
361
|
+
light: {
|
|
362
|
+
shade: 800
|
|
363
|
+
}
|
|
364
|
+
}),
|
|
365
|
+
function: reactTheming.getColor({
|
|
366
|
+
theme,
|
|
367
|
+
dark: {
|
|
368
|
+
hue: 'yellow',
|
|
369
|
+
shade: 300
|
|
370
|
+
},
|
|
371
|
+
light: {
|
|
372
|
+
hue: 'orange',
|
|
373
|
+
shade: 700
|
|
374
|
+
}
|
|
375
|
+
}),
|
|
376
|
+
inserted: reactTheming.getColor({
|
|
377
|
+
theme,
|
|
378
|
+
hue: 'green',
|
|
379
|
+
dark: {
|
|
380
|
+
shade: 200
|
|
381
|
+
},
|
|
382
|
+
light: {
|
|
383
|
+
shade: 800
|
|
384
|
+
}
|
|
385
|
+
}),
|
|
386
|
+
keyword: reactTheming.getColor({
|
|
387
|
+
theme,
|
|
388
|
+
hue: 'fuschia',
|
|
389
|
+
dark: {
|
|
390
|
+
shade: 600
|
|
391
|
+
},
|
|
392
|
+
light: {
|
|
393
|
+
shade: 700
|
|
394
|
+
}
|
|
395
|
+
}),
|
|
396
|
+
name: reactTheming.getColor({
|
|
397
|
+
theme,
|
|
398
|
+
dark: {
|
|
399
|
+
hue: 'blue',
|
|
400
|
+
shade: 400
|
|
401
|
+
},
|
|
402
|
+
light: {
|
|
403
|
+
hue: 'crimson',
|
|
404
|
+
shade: 700
|
|
405
|
+
}
|
|
406
|
+
}),
|
|
407
|
+
number: reactTheming.getColor({
|
|
408
|
+
theme,
|
|
409
|
+
hue: 'green',
|
|
410
|
+
dark: {
|
|
411
|
+
shade: 400
|
|
412
|
+
},
|
|
413
|
+
light: {
|
|
414
|
+
shade: 700
|
|
415
|
+
}
|
|
416
|
+
}),
|
|
417
|
+
punctuation: reactTheming.getColor({
|
|
418
|
+
theme,
|
|
419
|
+
dark: {
|
|
420
|
+
hue: 'grey',
|
|
421
|
+
shade: 700
|
|
422
|
+
},
|
|
423
|
+
light: {
|
|
424
|
+
hue: 'red',
|
|
425
|
+
shade: 900
|
|
426
|
+
}
|
|
427
|
+
}),
|
|
428
|
+
regex: reactTheming.getColor({
|
|
429
|
+
theme,
|
|
430
|
+
hue: 'red',
|
|
431
|
+
shade: 600
|
|
432
|
+
}),
|
|
433
|
+
value: reactTheming.getColor({
|
|
434
|
+
theme,
|
|
435
|
+
dark: {
|
|
436
|
+
hue: 'crimson',
|
|
437
|
+
shade: 600
|
|
438
|
+
},
|
|
439
|
+
light: {
|
|
440
|
+
hue: 'red',
|
|
441
|
+
shade: 800
|
|
442
|
+
}
|
|
443
|
+
})
|
|
234
444
|
};
|
|
235
445
|
return styled.css(["&.builtin,&.class-name,&.tag:not(.punctuation):not(.attr-name):not(.attr-value):not(.script){color:", ";}&.doctype,&.prolog,&.tag.punctuation:not(.attr-value):not(.script):not(.spread){color:", ";}&.attribute.value,&.attr-value,&.atrule,&.cdata,&.string,&.url.content{color:", ";}&.constant,&.interpolation-punctuation{color:", ";}&.attr-name,&.attr-value.spread,&.environment,&.interpolation,&.parameter,&.property,&.property-access,&.variable{color:", ";}&.parameter.punctuation,&.attr-name + .attr-value.punctuation{color:inherit;}&.regex{color:", ";}&.boolean,&.bold:not(.diff),&.entity,&.important,&.tag:not(.punctuation):not(.attr-name):not(.attr-value):not(.script):not(.class-name){color:", ";}&.number,&.unit{color:", ";}&.assign-left,&.function,&.selector:not(.attribute){color:", ";}&.atrule.rule,&.keyword{color:", ";}&.blockquote,&.comment,&.shebang{color:", ";}", ".language-css &&.plain{color:", ";}", ".language-diff &&.coord{color:", ";}", ".language-diff &&.deleted{color:", ";}", ".language-diff &&.diff{color:", ";}", ".language-diff &&.inserted{color:", ";}"], colors.builtin, colors.punctuation, colors.value, colors.constant, colors.name, colors.regex, colors.boolean, colors.number, colors.function, colors.keyword, colors.comment, StyledCodeBlock, colors.value, StyledCodeBlock, colors.coord, StyledCodeBlock, colors.deleted, StyledCodeBlock, colors.diff, StyledCodeBlock, colors.inserted);
|
|
236
446
|
};
|
|
237
447
|
const StyledCodeBlockToken = styled__default.default.span.attrs({
|
|
238
448
|
'data-garden-id': COMPONENT_ID$3,
|
|
239
|
-
'data-garden-version': '9.0.0
|
|
449
|
+
'data-garden-version': '9.0.0'
|
|
240
450
|
}).withConfig({
|
|
241
451
|
displayName: "StyledCodeBlockToken",
|
|
242
452
|
componentId: "sc-1hkshdq-0"
|
|
243
|
-
})(["display:inline-block;&.bold:not(.diff){font-weight:", ";}&.coord{padding-left:0.75em;}&.italic{font-style:italic;}&.prefix{width:2em;text-align:center;}", ";", ";"], props => props.theme.fontWeights.semibold,
|
|
244
|
-
StyledCodeBlockToken.defaultProps = {
|
|
245
|
-
theme: reactTheming.DEFAULT_THEME
|
|
246
|
-
};
|
|
453
|
+
})(["display:inline-block;&.bold:not(.diff){font-weight:", ";}&.coord{padding-left:0.75em;}&.italic{font-style:italic;}&.prefix{width:2em;text-align:center;}", ";", ";"], props => props.theme.fontWeights.semibold, colorStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
247
454
|
|
|
248
455
|
const COMPONENT_ID$2 = 'typography.ellipsis';
|
|
249
456
|
const StyledEllipsis = styled__default.default.div.attrs({
|
|
250
457
|
'data-garden-id': COMPONENT_ID$2,
|
|
251
|
-
'data-garden-version': '9.0.0
|
|
458
|
+
'data-garden-version': '9.0.0'
|
|
252
459
|
}).withConfig({
|
|
253
460
|
displayName: "StyledEllipsis",
|
|
254
461
|
componentId: "sc-1u4uqmy-0"
|
|
255
462
|
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;direction:", ";", ";"], props => props.theme.rtl ? 'rtl' : 'ltr', props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
256
|
-
StyledEllipsis.defaultProps = {
|
|
257
|
-
theme: reactTheming.DEFAULT_THEME
|
|
258
|
-
};
|
|
259
463
|
|
|
260
464
|
const COMPONENT_ID$1 = 'typography.icon';
|
|
261
465
|
const sizeStyles = props => {
|
|
262
|
-
const margin = props
|
|
466
|
+
const margin = props.$isStart && `${props.theme.space.base * 2}px`;
|
|
263
467
|
const size = props.theme.iconSizes.md;
|
|
264
468
|
return styled.css(["margin-", ":", ";width:", ";height:", ";"], props.theme.rtl ? 'left' : 'right', margin, size, size);
|
|
265
469
|
};
|
|
266
|
-
const StyledIcon = styled__default.default(
|
|
267
|
-
let {
|
|
268
|
-
children,
|
|
269
|
-
isStart,
|
|
270
|
-
...props
|
|
271
|
-
} = _ref;
|
|
272
|
-
return React__default.default.cloneElement(React.Children.only(children), props);
|
|
273
|
-
}).attrs({
|
|
470
|
+
const StyledIcon = styled__default.default(reactTheming.StyledBaseIcon).attrs({
|
|
274
471
|
'data-garden-id': COMPONENT_ID$1,
|
|
275
|
-
'data-garden-version': '9.0.0
|
|
472
|
+
'data-garden-version': '9.0.0'
|
|
276
473
|
}).withConfig({
|
|
277
474
|
displayName: "StyledIcon",
|
|
278
475
|
componentId: "sc-10rfb5b-0"
|
|
279
476
|
})(["position:relative;top:-1px;vertical-align:middle;", ";", ";"], props => sizeStyles(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
280
|
-
StyledIcon.defaultProps = {
|
|
281
|
-
theme: reactTheming.DEFAULT_THEME
|
|
282
|
-
};
|
|
283
477
|
|
|
284
478
|
const listStyles = props => {
|
|
285
479
|
const rtl = props.theme.rtl;
|
|
@@ -288,30 +482,24 @@ const listStyles = props => {
|
|
|
288
482
|
const ORDERED_ID$1 = 'typography.ordered_list';
|
|
289
483
|
const StyledOrderedList = styled__default.default.ol.attrs({
|
|
290
484
|
'data-garden-id': ORDERED_ID$1,
|
|
291
|
-
'data-garden-version': '9.0.0
|
|
485
|
+
'data-garden-version': '9.0.0'
|
|
292
486
|
}).withConfig({
|
|
293
487
|
displayName: "StyledList__StyledOrderedList",
|
|
294
488
|
componentId: "sc-jdbsfi-0"
|
|
295
489
|
})(["", ";", ";"], props => listStyles(props), props => reactTheming.retrieveComponentStyles(ORDERED_ID$1, props));
|
|
296
|
-
StyledOrderedList.defaultProps = {
|
|
297
|
-
theme: reactTheming.DEFAULT_THEME
|
|
298
|
-
};
|
|
299
490
|
const UNORDERED_ID$1 = 'typography.unordered_list';
|
|
300
491
|
const StyledUnorderedList = styled__default.default.ul.attrs({
|
|
301
492
|
'data-garden-id': UNORDERED_ID$1,
|
|
302
|
-
'data-garden-version': '9.0.0
|
|
493
|
+
'data-garden-version': '9.0.0'
|
|
303
494
|
}).withConfig({
|
|
304
495
|
displayName: "StyledList__StyledUnorderedList",
|
|
305
496
|
componentId: "sc-jdbsfi-1"
|
|
306
497
|
})(["", ";", ";"], props => listStyles(props), props => reactTheming.retrieveComponentStyles(UNORDERED_ID$1, props));
|
|
307
|
-
StyledUnorderedList.defaultProps = {
|
|
308
|
-
theme: reactTheming.DEFAULT_THEME
|
|
309
|
-
};
|
|
310
498
|
|
|
311
499
|
const listItemPaddingStyles = props => {
|
|
312
500
|
const base = props.theme.space.base;
|
|
313
501
|
const paddingTop = props.space === 'large' ? `${base * 2}px` : `${base}px`;
|
|
314
|
-
return styled.css(["padding-top:", ";", " > &:first-child,", " > &:first-child{padding-top:0;}", " ", " > &:first-child,", " ", " > &:first-child,", " ", " > &:first-child,", " ", " > &:first-child{padding-top:", ";}"], paddingTop, StyledOrderedList, StyledUnorderedList, StyledOrderedList, StyledOrderedList, StyledOrderedList, StyledUnorderedList, StyledUnorderedList, StyledUnorderedList, StyledUnorderedList,
|
|
502
|
+
return styled.css(["padding-top:", ";", " > &:first-child,", " > &:first-child{padding-top:0;}", " ", " > &:first-child,", " ", " > &:first-child,", " ", " > &:first-child,", " ", " > &:first-child{padding-top:", ";}"], paddingTop, StyledOrderedList, StyledUnorderedList, StyledOrderedList, StyledOrderedList, StyledOrderedList, StyledUnorderedList, StyledUnorderedList, StyledUnorderedList, StyledUnorderedList, StyledOrderedList, paddingTop);
|
|
315
503
|
};
|
|
316
504
|
const listItemStyles = props => {
|
|
317
505
|
return styled.css(["line-height:", ";", ";"], reactTheming.getLineHeight(props.theme.lineHeights.md, props.theme.fontSizes.md), props.space !== 'small' && listItemPaddingStyles(props));
|
|
@@ -319,7 +507,7 @@ const listItemStyles = props => {
|
|
|
319
507
|
const ORDERED_ID = 'typography.ordered_list_item';
|
|
320
508
|
const StyledOrderedListItem = styled__default.default(StyledFont).attrs({
|
|
321
509
|
'data-garden-id': ORDERED_ID,
|
|
322
|
-
'data-garden-version': '9.0.0
|
|
510
|
+
'data-garden-version': '9.0.0',
|
|
323
511
|
as: 'li'
|
|
324
512
|
}).withConfig({
|
|
325
513
|
displayName: "StyledListItem__StyledOrderedListItem",
|
|
@@ -332,7 +520,7 @@ StyledOrderedListItem.defaultProps = {
|
|
|
332
520
|
const UNORDERED_ID = 'typography.unordered_list_item';
|
|
333
521
|
const StyledUnorderedListItem = styled__default.default(StyledFont).attrs({
|
|
334
522
|
'data-garden-id': UNORDERED_ID,
|
|
335
|
-
'data-garden-version': '9.0.0
|
|
523
|
+
'data-garden-version': '9.0.0',
|
|
336
524
|
as: 'li'
|
|
337
525
|
}).withConfig({
|
|
338
526
|
displayName: "StyledListItem__StyledUnorderedListItem",
|
|
@@ -346,14 +534,11 @@ StyledUnorderedListItem.defaultProps = {
|
|
|
346
534
|
const COMPONENT_ID = 'typography.paragraph';
|
|
347
535
|
const StyledParagraph = styled__default.default.p.attrs({
|
|
348
536
|
'data-garden-id': COMPONENT_ID,
|
|
349
|
-
'data-garden-version': '9.0.0
|
|
537
|
+
'data-garden-version': '9.0.0'
|
|
350
538
|
}).withConfig({
|
|
351
539
|
displayName: "StyledParagraph",
|
|
352
540
|
componentId: "sc-zkuftz-0"
|
|
353
541
|
})(["margin:0;padding:0;direction:", ";& + &,blockquote + &{margin-top:", ";}", ";"], props => props.theme.rtl ? 'rtl' : 'ltr', props => props.theme.lineHeights[THEME_SIZES[props.size]], props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
|
|
354
|
-
StyledParagraph.defaultProps = {
|
|
355
|
-
theme: reactTheming.DEFAULT_THEME
|
|
356
|
-
};
|
|
357
542
|
|
|
358
543
|
const SM = React.forwardRef((_ref, ref) => {
|
|
359
544
|
let {
|
|
@@ -516,8 +701,8 @@ const CodeBlock = React__default.default.forwardRef((_ref, ref) => {
|
|
|
516
701
|
highlightLines,
|
|
517
702
|
isLight,
|
|
518
703
|
isNumbered,
|
|
519
|
-
language,
|
|
520
|
-
size,
|
|
704
|
+
language = 'tsx',
|
|
705
|
+
size = 'medium',
|
|
521
706
|
...other
|
|
522
707
|
} = _ref;
|
|
523
708
|
const containerRef = React.useRef(null);
|
|
@@ -559,33 +744,37 @@ const CodeBlock = React__default.default.forwardRef((_ref, ref) => {
|
|
|
559
744
|
getLineProps,
|
|
560
745
|
getTokenProps
|
|
561
746
|
} = _ref2;
|
|
562
|
-
return React__default.default.createElement(
|
|
747
|
+
return React__default.default.createElement(reactTheming.ThemeProvider, {
|
|
748
|
+
theme: parentTheme => ({
|
|
749
|
+
...parentTheme,
|
|
750
|
+
colors: {
|
|
751
|
+
...parentTheme.colors,
|
|
752
|
+
base: isLight ? 'light' : 'dark'
|
|
753
|
+
}
|
|
754
|
+
})
|
|
755
|
+
}, React__default.default.createElement(StyledCodeBlock, Object.assign({
|
|
563
756
|
className: className,
|
|
564
|
-
ref: ref
|
|
565
|
-
|
|
566
|
-
|
|
757
|
+
ref: ref
|
|
758
|
+
}, other), tokens.map((line, index) =>
|
|
759
|
+
React__default.default.createElement(StyledCodeBlockLine, Object.assign({}, getLineProps({
|
|
567
760
|
line
|
|
568
761
|
}), {
|
|
569
762
|
key: index,
|
|
570
763
|
language: language,
|
|
571
|
-
isHighlighted: highlightLines
|
|
572
|
-
isLight: isLight,
|
|
764
|
+
isHighlighted: highlightLines?.includes(index + 1),
|
|
573
765
|
isNumbered: isNumbered,
|
|
574
766
|
diff: getDiff(line),
|
|
575
|
-
size: size
|
|
767
|
+
size: size,
|
|
768
|
+
style: undefined
|
|
576
769
|
}), line.map((token, tokenKey) => React__default.default.createElement(StyledCodeBlockToken, Object.assign({}, getTokenProps({
|
|
577
770
|
token
|
|
578
771
|
}), {
|
|
579
772
|
key: tokenKey,
|
|
580
|
-
|
|
581
|
-
}), token.empty ? '\n' : token.content)))));
|
|
773
|
+
style: undefined
|
|
774
|
+
}), token.empty ? '\n' : token.content))))));
|
|
582
775
|
}));
|
|
583
776
|
});
|
|
584
777
|
CodeBlock.displayName = 'CodeBlock';
|
|
585
|
-
CodeBlock.defaultProps = {
|
|
586
|
-
language: 'tsx',
|
|
587
|
-
size: 'medium'
|
|
588
|
-
};
|
|
589
778
|
|
|
590
779
|
const Ellipsis = React.forwardRef((_ref, ref) => {
|
|
591
780
|
let {
|
|
@@ -725,7 +914,7 @@ const UnorderedList = UnorderedListComponent;
|
|
|
725
914
|
UnorderedList.Item = Item;
|
|
726
915
|
|
|
727
916
|
const StartIconComponent = props => React__default.default.createElement(StyledIcon, Object.assign({
|
|
728
|
-
isStart: true
|
|
917
|
+
$isStart: true
|
|
729
918
|
}, props));
|
|
730
919
|
StartIconComponent.displayName = 'Span.StartIcon';
|
|
731
920
|
const StartIcon = StartIconComponent;
|