@pure-ds/storybook 0.4.16 → 0.4.17
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/.storybook/addons/html-preview/Panel.jsx +71 -20
- package/dist/pds-reference.json +2 -7
- package/package.json +2 -2
- package/public/assets/js/app.js +617 -10565
- package/public/assets/js/lit.js +3 -1048
- package/public/assets/js/pds.js +396 -7354
- package/public/assets/pds/components/pds-calendar.js +1 -1
- package/public/assets/pds/custom-elements.json +263 -18
- package/public/assets/pds/pds-runtime-config.json +1 -1
- package/public/assets/pds/styles/pds-components.css +83 -221
- package/public/assets/pds/styles/pds-components.css.js +166 -442
- package/public/assets/pds/styles/pds-styles.css +240 -437
- package/public/assets/pds/styles/pds-styles.css.js +479 -881
- package/public/assets/pds/styles/pds-utilities.css +151 -214
- package/public/assets/pds/styles/pds-utilities.css.js +302 -428
- package/src/js/pds-core/pds-generator.js +88 -38
- package/src/js/pds-core/pds-ontology.js +1 -1
- package/stories/components/PdsCalendar.stories.js +2 -2
- package/stories/components/PdsDrawer.stories.js +15 -15
- package/stories/components/PdsJsonform.stories.js +78 -0
- package/stories/components/PdsRichtext.stories.js +4 -17
- package/stories/components/PdsScrollrow.stories.js +224 -72
- package/stories/components/PdsSplitpanel.stories.js +63 -28
- package/stories/components/PdsTabstrip.stories.js +7 -7
- package/stories/enhancements/Accordion.stories.js +2 -2
- package/stories/enhancements/Dropdowns.stories.js +13 -10
- package/stories/enhancements/RangeSliders.stories.js +9 -9
- package/stories/enhancements/RequiredFields.stories.js +8 -8
- package/stories/enhancements/Toggles.stories.js +45 -36
- package/stories/enhancements/_enhancement-header.js +2 -2
- package/stories/foundations/Colors.stories.js +13 -13
- package/stories/foundations/HTMLDefaults.stories.js +4 -4
- package/stories/foundations/Icons.stories.js +123 -288
- package/stories/foundations/MeshGradients.stories.js +161 -250
- package/stories/foundations/SmartSurfaces.stories.js +147 -64
- package/stories/foundations/Spacing.stories.js +30 -30
- package/stories/foundations/Typography.stories.js +352 -723
- package/stories/foundations/ZIndex.stories.js +124 -141
- package/stories/layout/LayoutOverview.stories.js +343 -250
- package/stories/layout/LayoutSystem.stories.js +60 -76
- package/stories/patterns/InteractiveStates.stories.js +29 -29
- package/stories/patterns/Utilities.stories.js +17 -5
- package/stories/primitives/Alerts.stories.js +6 -6
- package/stories/primitives/Cards.stories.js +22 -11
- package/stories/primitives/Forms.stories.js +17 -8
- package/stories/primitives/Media.stories.js +23 -20
- package/stories/utilities/Backdrop.stories.js +68 -27
- package/stories/utils/PdsAsk.stories.js +1 -1
- package/public/assets/js/app.js.map +0 -7
- package/public/assets/js/lit.js.map +0 -7
- package/public/assets/js/pds.js.map +0 -7
|
@@ -2,7 +2,7 @@ import React, { useState, useCallback, useEffect, useRef } from 'react';
|
|
|
2
2
|
import { useChannel } from '@storybook/manager-api';
|
|
3
3
|
import { IconButton } from '@storybook/components';
|
|
4
4
|
import { EVENTS } from './constants.js';
|
|
5
|
-
import { styled } from '@storybook/theming';
|
|
5
|
+
import { styled, useTheme } from '@storybook/theming';
|
|
6
6
|
import { loadShiki, escapeHtml } from '../../shiki.js';
|
|
7
7
|
|
|
8
8
|
const Container = styled.div`
|
|
@@ -112,7 +112,12 @@ export const Panel = ({ active }) => {
|
|
|
112
112
|
const [source, setSource] = useState({ markup: '', jsonForms: [] });
|
|
113
113
|
const [copied, setCopied] = useState(false);
|
|
114
114
|
const [highlightedMarkup, setHighlightedMarkup] = useState('');
|
|
115
|
+
const [highlightedJsonForms, setHighlightedJsonForms] = useState([]);
|
|
115
116
|
const shikiRef = useRef(null);
|
|
117
|
+
|
|
118
|
+
// Get Storybook theme to detect light/dark mode
|
|
119
|
+
const storybookTheme = useTheme();
|
|
120
|
+
const shikiTheme = storybookTheme.base === 'dark' ? 'github-dark' : 'github-light';
|
|
116
121
|
|
|
117
122
|
// Load Shiki once on mount
|
|
118
123
|
useEffect(() => {
|
|
@@ -121,7 +126,7 @@ export const Panel = ({ active }) => {
|
|
|
121
126
|
});
|
|
122
127
|
}, []);
|
|
123
128
|
|
|
124
|
-
// Highlight markup when source changes
|
|
129
|
+
// Highlight markup when source or theme changes
|
|
125
130
|
useEffect(() => {
|
|
126
131
|
if (!source.markup) {
|
|
127
132
|
setHighlightedMarkup('');
|
|
@@ -133,7 +138,7 @@ export const Panel = ({ active }) => {
|
|
|
133
138
|
try {
|
|
134
139
|
const html = highlighter.codeToHtml(source.markup, {
|
|
135
140
|
lang: 'html',
|
|
136
|
-
theme:
|
|
141
|
+
theme: shikiTheme
|
|
137
142
|
});
|
|
138
143
|
setHighlightedMarkup(html);
|
|
139
144
|
} catch (err) {
|
|
@@ -146,7 +151,7 @@ export const Panel = ({ active }) => {
|
|
|
146
151
|
loadShiki().then(hl => {
|
|
147
152
|
if (hl && source.markup) {
|
|
148
153
|
try {
|
|
149
|
-
const html = hl.codeToHtml(source.markup, { lang: 'html', theme:
|
|
154
|
+
const html = hl.codeToHtml(source.markup, { lang: 'html', theme: shikiTheme });
|
|
150
155
|
setHighlightedMarkup(html);
|
|
151
156
|
} catch (err) {
|
|
152
157
|
// Keep fallback
|
|
@@ -154,7 +159,43 @@ export const Panel = ({ active }) => {
|
|
|
154
159
|
}
|
|
155
160
|
});
|
|
156
161
|
}
|
|
157
|
-
}, [source.markup]);
|
|
162
|
+
}, [source.markup, shikiTheme]);
|
|
163
|
+
|
|
164
|
+
// Highlight jsonForms schemas when source or theme changes
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
if (!source.jsonForms || source.jsonForms.length === 0) {
|
|
167
|
+
setHighlightedJsonForms([]);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const highlightJsonCode = async (code) => {
|
|
172
|
+
if (!code) return '';
|
|
173
|
+
const highlighter = shikiRef.current || await loadShiki();
|
|
174
|
+
if (highlighter) {
|
|
175
|
+
try {
|
|
176
|
+
return highlighter.codeToHtml(code, { lang: 'json', theme: shikiTheme });
|
|
177
|
+
} catch (err) {
|
|
178
|
+
return `<pre><code>${escapeHtml(code)}</code></pre>`;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return `<pre><code>${escapeHtml(code)}</code></pre>`;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const processJsonForms = async () => {
|
|
185
|
+
const highlighted = await Promise.all(
|
|
186
|
+
source.jsonForms.map(async (form, index) => ({
|
|
187
|
+
id: form.id ?? index,
|
|
188
|
+
label: form.label,
|
|
189
|
+
jsonSchema: await highlightJsonCode(form.jsonSchema),
|
|
190
|
+
uiSchema: await highlightJsonCode(form.uiSchema),
|
|
191
|
+
options: await highlightJsonCode(form.options)
|
|
192
|
+
}))
|
|
193
|
+
);
|
|
194
|
+
setHighlightedJsonForms(highlighted);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
processJsonForms();
|
|
198
|
+
}, [source.jsonForms, shikiTheme]);
|
|
158
199
|
|
|
159
200
|
useChannel({
|
|
160
201
|
[EVENTS.UPDATE_HTML]: (payload) => {
|
|
@@ -225,38 +266,48 @@ export const Panel = ({ active }) => {
|
|
|
225
266
|
</SectionWrapper>
|
|
226
267
|
)}
|
|
227
268
|
|
|
228
|
-
{hasJsonForms && source.jsonForms.map((
|
|
229
|
-
const key =
|
|
230
|
-
const
|
|
269
|
+
{hasJsonForms && source.jsonForms.map((sourceForm, index) => {
|
|
270
|
+
const key = sourceForm.id ?? index;
|
|
271
|
+
const highlightedForm = highlightedJsonForms[index];
|
|
272
|
+
const heading = source.jsonForms.length > 1 ? (sourceForm.label || `Form ${index + 1}`) : 'pds-jsonform';
|
|
231
273
|
|
|
232
274
|
return (
|
|
233
275
|
<SectionWrapper key={key}>
|
|
234
276
|
<SectionHeading>{heading}</SectionHeading>
|
|
235
277
|
|
|
236
|
-
{
|
|
278
|
+
{sourceForm.jsonSchema && (
|
|
237
279
|
<>
|
|
238
280
|
<Subheading>jsonSchema</Subheading>
|
|
239
|
-
<CodeBlock
|
|
240
|
-
|
|
241
|
-
|
|
281
|
+
<CodeBlock
|
|
282
|
+
$compact
|
|
283
|
+
dangerouslySetInnerHTML={{
|
|
284
|
+
__html: highlightedForm?.jsonSchema || `<pre><code>${escapeHtml(sourceForm.jsonSchema)}</code></pre>`
|
|
285
|
+
}}
|
|
286
|
+
/>
|
|
242
287
|
</>
|
|
243
288
|
)}
|
|
244
289
|
|
|
245
|
-
{
|
|
290
|
+
{sourceForm.uiSchema && (
|
|
246
291
|
<>
|
|
247
292
|
<Subheading>uiSchema</Subheading>
|
|
248
|
-
<CodeBlock
|
|
249
|
-
|
|
250
|
-
|
|
293
|
+
<CodeBlock
|
|
294
|
+
$compact
|
|
295
|
+
dangerouslySetInnerHTML={{
|
|
296
|
+
__html: highlightedForm?.uiSchema || `<pre><code>${escapeHtml(sourceForm.uiSchema)}</code></pre>`
|
|
297
|
+
}}
|
|
298
|
+
/>
|
|
251
299
|
</>
|
|
252
300
|
)}
|
|
253
301
|
|
|
254
|
-
{
|
|
302
|
+
{sourceForm.options && (
|
|
255
303
|
<>
|
|
256
304
|
<Subheading>options</Subheading>
|
|
257
|
-
<CodeBlock
|
|
258
|
-
|
|
259
|
-
|
|
305
|
+
<CodeBlock
|
|
306
|
+
$compact
|
|
307
|
+
dangerouslySetInnerHTML={{
|
|
308
|
+
__html: highlightedForm?.options || `<pre><code>${escapeHtml(sourceForm.options)}</code></pre>`
|
|
309
|
+
}}
|
|
310
|
+
/>
|
|
260
311
|
</>
|
|
261
312
|
)}
|
|
262
313
|
</SectionWrapper>
|
package/dist/pds-reference.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-01-
|
|
2
|
+
"generatedAt": "2026-01-11T20:07:09.310Z",
|
|
3
3
|
"sources": {
|
|
4
4
|
"customElements": "custom-elements.json",
|
|
5
5
|
"ontology": "src\\js\\pds-core\\pds-ontology.js",
|
|
@@ -3603,12 +3603,7 @@
|
|
|
3603
3603
|
".text-right"
|
|
3604
3604
|
],
|
|
3605
3605
|
"color": [
|
|
3606
|
-
".text-muted"
|
|
3607
|
-
".text-primary",
|
|
3608
|
-
".text-success",
|
|
3609
|
-
".text-warning",
|
|
3610
|
-
".text-danger",
|
|
3611
|
-
".text-info"
|
|
3606
|
+
".text-muted"
|
|
3612
3607
|
],
|
|
3613
3608
|
"overflow": [
|
|
3614
3609
|
".truncate"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pure-ds/storybook",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.17",
|
|
4
4
|
"description": "Storybook showcase for Pure Design System with live configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"pds:build-icons": "pds-build-icons"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@pure-ds/core": "^0.4.
|
|
40
|
+
"@pure-ds/core": "^0.4.17"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@custom-elements-manifest/analyzer": "^0.11.0",
|