@veritone-ce/design-system 2.5.17 → 2.5.19
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/cjs/Checkbox/index.js +35 -19
- package/dist/cjs/extras/Markdown/index.js +209 -35
- package/dist/cjs/extras/Markdown/styles.module.scss.js +1 -1
- package/dist/cjs/styles/createPalette.js +2 -1
- package/dist/cjs/styles/defaultTheme.js +3 -0
- package/dist/cjs/styles/defaultThemeOptions.js +6 -0
- package/dist/cjs/styles.css +1 -1
- package/dist/esm/Checkbox/index.js +35 -19
- package/dist/esm/extras/Markdown/index.js +210 -36
- package/dist/esm/extras/Markdown/styles.module.scss.js +1 -1
- package/dist/esm/styles/createPalette.js +2 -1
- package/dist/esm/styles/defaultTheme.js +3 -0
- package/dist/esm/styles/defaultThemeOptions.js +6 -0
- package/dist/esm/styles/scss/theme.generated.scss +4 -0
- package/dist/esm/styles.css +1 -1
- package/dist/types/Checkbox/index.d.ts +2 -0
- package/dist/types/extras/Markdown/index.d.ts +25 -4
- package/dist/types/styles/defaultThemeOptions.d.ts +6 -0
- package/dist/types/styles/palette.d.ts +6 -0
- package/dist/types/styles/themeOptions.d.ts +7 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import ReactMarkdown from 'react-markdown';
|
|
4
4
|
import styles from './styles.module.scss.js';
|
|
5
|
-
import { useMemo } from 'react';
|
|
5
|
+
import { createContext, useMemo, useContext } from 'react';
|
|
6
6
|
import Typography from '../../Typography/index.js';
|
|
7
7
|
import { cx } from '../../styles/cx.js';
|
|
8
8
|
import '../../styles/defaultThemeOptions.js';
|
|
@@ -14,55 +14,229 @@ import '../../styles/css-vars.js';
|
|
|
14
14
|
import '../../Box/index.js';
|
|
15
15
|
import '../../styles/styled.js';
|
|
16
16
|
|
|
17
|
+
const MarkdownContext = createContext({
|
|
18
|
+
headerIncrement: 0,
|
|
19
|
+
paragraphIncrement: 0,
|
|
20
|
+
styles: {},
|
|
21
|
+
classNames: {}
|
|
22
|
+
});
|
|
17
23
|
const h = (base, hAddend) => `h${Math.max(1, Math.min(base + hAddend, 4))}`;
|
|
18
|
-
const p = (base) => `paragraph${Math.max(1, Math.min(base, 3))}`;
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
const p = (base, pAddend) => `paragraph${Math.max(1, Math.min(base + pAddend, 3))}`;
|
|
25
|
+
const DefaultComponents = {
|
|
26
|
+
h1: function H1({ color, ref, style, className, ...props }) {
|
|
27
|
+
const {
|
|
28
|
+
headerIncrement,
|
|
29
|
+
styles: { h1: h1Style },
|
|
30
|
+
classNames: { h1: h1ClassName }
|
|
31
|
+
} = useContext(MarkdownContext);
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
Typography,
|
|
34
|
+
{
|
|
35
|
+
ref,
|
|
36
|
+
variant: h(1, headerIncrement),
|
|
37
|
+
style: {
|
|
38
|
+
...h1Style,
|
|
39
|
+
...style
|
|
40
|
+
},
|
|
41
|
+
className: cx(styles.inheritColor, h1ClassName, className),
|
|
42
|
+
...props
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
h2: function H2({ color, ref, style, className, ...props }) {
|
|
47
|
+
const {
|
|
48
|
+
headerIncrement,
|
|
49
|
+
styles: { h2: h2Style },
|
|
50
|
+
classNames: { h2: h2ClassName }
|
|
51
|
+
} = useContext(MarkdownContext);
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
53
|
+
Typography,
|
|
54
|
+
{
|
|
55
|
+
ref,
|
|
56
|
+
variant: h(2, headerIncrement),
|
|
57
|
+
style: {
|
|
58
|
+
...h2Style,
|
|
59
|
+
...style
|
|
60
|
+
},
|
|
61
|
+
className: cx(styles.inheritColor, h2ClassName, className),
|
|
62
|
+
...props
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
h3: function H3({ color, ref, style, className, ...props }) {
|
|
67
|
+
const {
|
|
68
|
+
headerIncrement,
|
|
69
|
+
styles: { h3: h3Style },
|
|
70
|
+
classNames: { h3: h3ClassName }
|
|
71
|
+
} = useContext(MarkdownContext);
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
Typography,
|
|
74
|
+
{
|
|
75
|
+
ref,
|
|
76
|
+
variant: h(3, headerIncrement),
|
|
77
|
+
style: {
|
|
78
|
+
...h3Style,
|
|
79
|
+
...style
|
|
80
|
+
},
|
|
81
|
+
className: cx(styles.inheritColor, h3ClassName, className),
|
|
82
|
+
...props
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
h4: function H4({ color, ref, style, className, ...props }) {
|
|
87
|
+
const {
|
|
88
|
+
headerIncrement,
|
|
89
|
+
styles: { h4: h4Style },
|
|
90
|
+
classNames: { h4: h4ClassName }
|
|
91
|
+
} = useContext(MarkdownContext);
|
|
92
|
+
return /* @__PURE__ */ jsx(
|
|
93
|
+
Typography,
|
|
94
|
+
{
|
|
95
|
+
ref,
|
|
96
|
+
variant: h(4, headerIncrement),
|
|
97
|
+
style: {
|
|
98
|
+
...h4Style,
|
|
99
|
+
...style
|
|
100
|
+
},
|
|
101
|
+
className: cx(styles.inheritColor, h4ClassName, className),
|
|
102
|
+
...props
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
},
|
|
106
|
+
h5: function H5({ color, ref, style, className, ...props }) {
|
|
107
|
+
const {
|
|
108
|
+
headerIncrement,
|
|
109
|
+
styles: { h5: h5Style },
|
|
110
|
+
classNames: { h5: h5ClassName }
|
|
111
|
+
} = useContext(MarkdownContext);
|
|
112
|
+
return /* @__PURE__ */ jsx(
|
|
113
|
+
Typography,
|
|
114
|
+
{
|
|
115
|
+
ref,
|
|
116
|
+
variant: h(5, headerIncrement),
|
|
117
|
+
style: {
|
|
118
|
+
...h5Style,
|
|
119
|
+
...style
|
|
120
|
+
},
|
|
121
|
+
className: cx(styles.inheritColor, h5ClassName, className),
|
|
122
|
+
...props
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
},
|
|
126
|
+
h6: function H6({ color, ref, style, className, ...props }) {
|
|
127
|
+
const {
|
|
128
|
+
headerIncrement,
|
|
129
|
+
styles: { h6: h6Style },
|
|
130
|
+
classNames: { h6: h6ClassName }
|
|
131
|
+
} = useContext(MarkdownContext);
|
|
132
|
+
return /* @__PURE__ */ jsx(
|
|
133
|
+
Typography,
|
|
134
|
+
{
|
|
135
|
+
ref,
|
|
136
|
+
variant: h(6, headerIncrement),
|
|
137
|
+
style: {
|
|
138
|
+
...h6Style,
|
|
139
|
+
...style
|
|
140
|
+
},
|
|
141
|
+
className: cx(styles.inheritColor, h6ClassName, className),
|
|
142
|
+
...props
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
},
|
|
146
|
+
p: function P({ color, ref, style, className, ...props }) {
|
|
147
|
+
const {
|
|
148
|
+
paragraphIncrement,
|
|
149
|
+
styles: { p: pStyle },
|
|
150
|
+
classNames: { p: pClassName }
|
|
151
|
+
} = useContext(MarkdownContext);
|
|
152
|
+
return /* @__PURE__ */ jsx(
|
|
153
|
+
Typography,
|
|
154
|
+
{
|
|
155
|
+
ref,
|
|
156
|
+
variant: p(1, paragraphIncrement),
|
|
157
|
+
style: {
|
|
158
|
+
...pStyle,
|
|
159
|
+
...style
|
|
160
|
+
},
|
|
161
|
+
className: cx(styles.inheritColor, pClassName, className),
|
|
162
|
+
...props
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
},
|
|
166
|
+
// table: (props) => <Table {...props} />,
|
|
167
|
+
// thead: (props) => <TableHead {...props} />,
|
|
168
|
+
// tbody: (props) => <TableBody {...props} />,
|
|
169
|
+
// tr: ({ ref, ...props }) => <TableRow ref={ref as any} {...props} />,
|
|
170
|
+
// th: ({ ref, ...props }) => (
|
|
171
|
+
// <TableCell ref={ref as any} variant={'header'} {...props} />
|
|
172
|
+
// ),
|
|
173
|
+
// td: ({ ref, ...props }) => (
|
|
174
|
+
// <TableCell ref={ref as any} variant={'data'} {...props} />
|
|
175
|
+
// ),
|
|
176
|
+
li: function Li(props) {
|
|
177
|
+
const {
|
|
178
|
+
paragraphIncrement,
|
|
179
|
+
styles: { li: liStyle },
|
|
180
|
+
classNames: { li: liClassName }
|
|
181
|
+
} = useContext(MarkdownContext);
|
|
182
|
+
return /* @__PURE__ */ jsx(
|
|
40
183
|
"li",
|
|
41
184
|
{
|
|
42
185
|
...props,
|
|
43
|
-
|
|
186
|
+
style: {
|
|
187
|
+
...liStyle,
|
|
188
|
+
...props.style
|
|
189
|
+
},
|
|
190
|
+
className: cx(
|
|
191
|
+
styles[`li_${p(1, paragraphIncrement)}`],
|
|
192
|
+
liClassName,
|
|
193
|
+
props.className
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
},
|
|
198
|
+
img: function Img(props) {
|
|
199
|
+
const {
|
|
200
|
+
styles: { li: liStyle },
|
|
201
|
+
classNames: { li: liClassName }
|
|
202
|
+
} = useContext(MarkdownContext);
|
|
203
|
+
return /* @__PURE__ */ jsx(
|
|
204
|
+
"img",
|
|
205
|
+
{
|
|
206
|
+
...props,
|
|
207
|
+
style: { ...liStyle, ...props.style },
|
|
208
|
+
className: cx(styles.img, liClassName, props.className)
|
|
44
209
|
}
|
|
45
|
-
)
|
|
46
|
-
}
|
|
210
|
+
);
|
|
211
|
+
}
|
|
47
212
|
};
|
|
48
213
|
function Markdown({
|
|
49
214
|
components,
|
|
50
|
-
|
|
51
|
-
|
|
215
|
+
headerIncrement,
|
|
216
|
+
paragraphIncrement,
|
|
217
|
+
style,
|
|
218
|
+
className,
|
|
219
|
+
styles: componentStyles,
|
|
220
|
+
classNames: componentClassNames,
|
|
52
221
|
...props
|
|
53
222
|
}) {
|
|
54
|
-
const
|
|
55
|
-
() =>
|
|
56
|
-
|
|
223
|
+
const allComponents = useMemo(
|
|
224
|
+
() => ({
|
|
225
|
+
...DefaultComponents,
|
|
226
|
+
...components
|
|
227
|
+
}),
|
|
228
|
+
[components]
|
|
57
229
|
);
|
|
58
230
|
return /* @__PURE__ */ jsx(
|
|
59
|
-
|
|
231
|
+
MarkdownContext.Provider,
|
|
60
232
|
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
233
|
+
value: {
|
|
234
|
+
headerIncrement: headerIncrement ?? 0,
|
|
235
|
+
paragraphIncrement: paragraphIncrement ?? 0,
|
|
236
|
+
styles: componentStyles ?? {},
|
|
237
|
+
classNames: componentClassNames ?? {}
|
|
64
238
|
},
|
|
65
|
-
...props
|
|
239
|
+
children: /* @__PURE__ */ jsx("div", { style, className: cx(styles.markdown, className), children: /* @__PURE__ */ jsx(ReactMarkdown, { components: allComponents, ...props }) })
|
|
66
240
|
}
|
|
67
241
|
);
|
|
68
242
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var styles = {"li_paragraph1":"vt_ce_Markdown_li_paragraph1__89e8a4f2","li_paragraph2":"vt_ce_Markdown_li_paragraph2__41a747e0","li_paragraph3":"vt_ce_Markdown_li_paragraph3__4bbed1ba"};
|
|
1
|
+
var styles = {"markdown":"vt_ce_Markdown_markdown__f723c3f8","inheritColor":"vt_ce_Markdown_inheritColor__d0ceef43","img":"vt_ce_Markdown_img__4bf1a967","li_paragraph1":"vt_ce_Markdown_li_paragraph1__89e8a4f2","li_paragraph2":"vt_ce_Markdown_li_paragraph2__41a747e0","li_paragraph3":"vt_ce_Markdown_li_paragraph3__4bbed1ba"};
|
|
2
2
|
|
|
3
3
|
export { styles as default };
|
|
@@ -108,6 +108,8 @@ $default-theme: (
|
|
|
108
108
|
"palette-table-disabled-on": (#7C848D),
|
|
109
109
|
"palette-tooltip-surface": (#7C848D),
|
|
110
110
|
"palette-tooltip-on": (#FAFAFA),
|
|
111
|
+
"palette-thumbnailCheckbox-fill-primary": (#FFFFFF),
|
|
112
|
+
"palette-thumbnailCheckbox-fill-secondary": (#2A323C),
|
|
111
113
|
"typography-metrics-familyName": (Nunito Sans 12pt),
|
|
112
114
|
"typography-metrics-fullName": (Nunito Sans 12pt Regular),
|
|
113
115
|
"typography-metrics-postscriptName": (NunitoSans12pt-Regular),
|
|
@@ -349,6 +351,8 @@ $theme-palette-table-disabled-surface: var(--vt-ce-theme-palette-table-disabled-
|
|
|
349
351
|
$theme-palette-table-disabled-on: var(--vt-ce-theme-palette-table-disabled-on, (#7C848D));
|
|
350
352
|
$theme-palette-tooltip-surface: var(--vt-ce-theme-palette-tooltip-surface, (#7C848D));
|
|
351
353
|
$theme-palette-tooltip-on: var(--vt-ce-theme-palette-tooltip-on, (#FAFAFA));
|
|
354
|
+
$theme-palette-thumbnailCheckbox-fill-primary: var(--vt-ce-theme-palette-thumbnailCheckbox-fill-primary, (#FFFFFF));
|
|
355
|
+
$theme-palette-thumbnailCheckbox-fill-secondary: var(--vt-ce-theme-palette-thumbnailCheckbox-fill-secondary, (#2A323C));
|
|
352
356
|
$theme-typography-metrics-familyName: var(--vt-ce-theme-typography-metrics-familyName, (Nunito Sans 12pt));
|
|
353
357
|
$theme-typography-metrics-fullName: var(--vt-ce-theme-typography-metrics-fullName, (Nunito Sans 12pt Regular));
|
|
354
358
|
$theme-typography-metrics-postscriptName: var(--vt-ce-theme-typography-metrics-postscriptName, (NunitoSans12pt-Regular));
|