@pure-ds/storybook 0.4.15 → 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.
Files changed (59) hide show
  1. package/.storybook/addons/html-preview/Panel.jsx +75 -23
  2. package/.storybook/addons/html-preview/preview.js +27 -1
  3. package/.storybook/docs.css +7 -0
  4. package/.storybook/htmlPreview.css +6 -6
  5. package/.storybook/htmlPreview.js +27 -1
  6. package/.storybook/manager-head.html +13 -0
  7. package/.storybook/preview-head.html +5 -0
  8. package/.storybook/preview.js +1 -1
  9. package/dist/pds-reference.json +2 -7
  10. package/package.json +2 -2
  11. package/public/assets/js/app.js +617 -10565
  12. package/public/assets/js/lit.js +3 -1048
  13. package/public/assets/js/pds.js +396 -7354
  14. package/public/assets/pds/components/pds-calendar.js +1 -1
  15. package/public/assets/pds/custom-elements.json +263 -18
  16. package/public/assets/pds/pds-runtime-config.json +1 -1
  17. package/public/assets/pds/styles/pds-components.css +83 -221
  18. package/public/assets/pds/styles/pds-components.css.js +166 -442
  19. package/public/assets/pds/styles/pds-styles.css +240 -437
  20. package/public/assets/pds/styles/pds-styles.css.js +479 -881
  21. package/public/assets/pds/styles/pds-utilities.css +151 -214
  22. package/public/assets/pds/styles/pds-utilities.css.js +302 -428
  23. package/src/js/pds-configurator/pds-demo.js +11 -1
  24. package/src/js/pds-core/pds-generator.js +88 -38
  25. package/src/js/pds-core/pds-ontology.js +1 -1
  26. package/stories/components/PdsCalendar.stories.js +2 -2
  27. package/stories/components/PdsDrawer.stories.js +15 -15
  28. package/stories/components/PdsJsonform.stories.js +78 -0
  29. package/stories/components/PdsRichtext.stories.js +4 -17
  30. package/stories/components/PdsScrollrow.stories.js +224 -72
  31. package/stories/components/PdsSplitpanel.stories.js +63 -28
  32. package/stories/components/PdsTabstrip.stories.js +7 -7
  33. package/stories/enhancements/Accordion.stories.js +2 -2
  34. package/stories/enhancements/Dropdowns.stories.js +13 -10
  35. package/stories/enhancements/RangeSliders.stories.js +9 -9
  36. package/stories/enhancements/RequiredFields.stories.js +8 -8
  37. package/stories/enhancements/Toggles.stories.js +45 -36
  38. package/stories/enhancements/_enhancement-header.js +2 -2
  39. package/stories/foundations/Colors.stories.js +13 -13
  40. package/stories/foundations/HTMLDefaults.stories.js +4 -4
  41. package/stories/foundations/Icons.stories.js +123 -288
  42. package/stories/foundations/MeshGradients.stories.js +161 -250
  43. package/stories/foundations/SmartSurfaces.stories.js +147 -64
  44. package/stories/foundations/Spacing.stories.js +30 -30
  45. package/stories/foundations/Typography.stories.js +352 -723
  46. package/stories/foundations/ZIndex.stories.js +124 -141
  47. package/stories/layout/LayoutOverview.stories.js +343 -250
  48. package/stories/layout/LayoutSystem.stories.js +60 -76
  49. package/stories/patterns/InteractiveStates.stories.js +29 -29
  50. package/stories/patterns/Utilities.stories.js +17 -5
  51. package/stories/primitives/Alerts.stories.js +6 -6
  52. package/stories/primitives/Cards.stories.js +22 -11
  53. package/stories/primitives/Forms.stories.js +17 -8
  54. package/stories/primitives/Media.stories.js +23 -20
  55. package/stories/utilities/Backdrop.stories.js +68 -27
  56. package/stories/utils/PdsAsk.stories.js +1 -1
  57. package/public/assets/js/app.js.map +0 -7
  58. package/public/assets/js/lit.js.map +0 -7
  59. 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`
@@ -16,9 +16,9 @@ const CodeBlock = styled.pre`
16
16
  margin: 0;
17
17
  padding: 16px;
18
18
  padding-bottom: ${props => (props.$compact ? '24px' : '60px')}; /* Space for fixed button */
19
- font-family: ${props => props.theme.typography.fonts.mono};
20
- font-size: 13px;
21
- line-height: 1.6;
19
+ font-family: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
20
+ font-size: 13.6px;
21
+ line-height: 24px;
22
22
  color: ${props => props.theme.color.defaultText};
23
23
  background: transparent;
24
24
  tab-size: 2;
@@ -32,6 +32,7 @@ const CodeBlock = styled.pre`
32
32
 
33
33
  .shiki code {
34
34
  background: transparent;
35
+ font-family: inherit !important;
35
36
  }
36
37
  `;
37
38
 
@@ -111,7 +112,12 @@ export const Panel = ({ active }) => {
111
112
  const [source, setSource] = useState({ markup: '', jsonForms: [] });
112
113
  const [copied, setCopied] = useState(false);
113
114
  const [highlightedMarkup, setHighlightedMarkup] = useState('');
115
+ const [highlightedJsonForms, setHighlightedJsonForms] = useState([]);
114
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';
115
121
 
116
122
  // Load Shiki once on mount
117
123
  useEffect(() => {
@@ -120,7 +126,7 @@ export const Panel = ({ active }) => {
120
126
  });
121
127
  }, []);
122
128
 
123
- // Highlight markup when source changes
129
+ // Highlight markup when source or theme changes
124
130
  useEffect(() => {
125
131
  if (!source.markup) {
126
132
  setHighlightedMarkup('');
@@ -132,7 +138,7 @@ export const Panel = ({ active }) => {
132
138
  try {
133
139
  const html = highlighter.codeToHtml(source.markup, {
134
140
  lang: 'html',
135
- theme: 'github-dark'
141
+ theme: shikiTheme
136
142
  });
137
143
  setHighlightedMarkup(html);
138
144
  } catch (err) {
@@ -145,7 +151,7 @@ export const Panel = ({ active }) => {
145
151
  loadShiki().then(hl => {
146
152
  if (hl && source.markup) {
147
153
  try {
148
- const html = hl.codeToHtml(source.markup, { lang: 'html', theme: 'github-dark' });
154
+ const html = hl.codeToHtml(source.markup, { lang: 'html', theme: shikiTheme });
149
155
  setHighlightedMarkup(html);
150
156
  } catch (err) {
151
157
  // Keep fallback
@@ -153,7 +159,43 @@ export const Panel = ({ active }) => {
153
159
  }
154
160
  });
155
161
  }
156
- }, [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]);
157
199
 
158
200
  useChannel({
159
201
  [EVENTS.UPDATE_HTML]: (payload) => {
@@ -224,38 +266,48 @@ export const Panel = ({ active }) => {
224
266
  </SectionWrapper>
225
267
  )}
226
268
 
227
- {hasJsonForms && source.jsonForms.map((form, index) => {
228
- const key = form.id ?? index;
229
- const heading = source.jsonForms.length > 1 ? (form.label || `Form ${index + 1}`) : 'pds-jsonform';
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';
230
273
 
231
274
  return (
232
275
  <SectionWrapper key={key}>
233
276
  <SectionHeading>{heading}</SectionHeading>
234
277
 
235
- {form.jsonSchema && (
278
+ {sourceForm.jsonSchema && (
236
279
  <>
237
280
  <Subheading>jsonSchema</Subheading>
238
- <CodeBlock $compact>
239
- <code>{form.jsonSchema}</code>
240
- </CodeBlock>
281
+ <CodeBlock
282
+ $compact
283
+ dangerouslySetInnerHTML={{
284
+ __html: highlightedForm?.jsonSchema || `<pre><code>${escapeHtml(sourceForm.jsonSchema)}</code></pre>`
285
+ }}
286
+ />
241
287
  </>
242
288
  )}
243
289
 
244
- {form.uiSchema && (
290
+ {sourceForm.uiSchema && (
245
291
  <>
246
292
  <Subheading>uiSchema</Subheading>
247
- <CodeBlock $compact>
248
- <code>{form.uiSchema}</code>
249
- </CodeBlock>
293
+ <CodeBlock
294
+ $compact
295
+ dangerouslySetInnerHTML={{
296
+ __html: highlightedForm?.uiSchema || `<pre><code>${escapeHtml(sourceForm.uiSchema)}</code></pre>`
297
+ }}
298
+ />
250
299
  </>
251
300
  )}
252
301
 
253
- {form.options && (
302
+ {sourceForm.options && (
254
303
  <>
255
304
  <Subheading>options</Subheading>
256
- <CodeBlock $compact>
257
- <code>{form.options}</code>
258
- </CodeBlock>
305
+ <CodeBlock
306
+ $compact
307
+ dangerouslySetInnerHTML={{
308
+ __html: highlightedForm?.options || `<pre><code>${escapeHtml(sourceForm.options)}</code></pre>`
309
+ }}
310
+ />
259
311
  </>
260
312
  )}
261
313
  </SectionWrapper>
@@ -59,6 +59,29 @@ function extractHTML(element) {
59
59
  return clone.innerHTML || '';
60
60
  }
61
61
 
62
+ /**
63
+ * Strip Lit template comments from rendered HTML
64
+ * Removes markers like <!--?lit$641514976$-->, <!---->, etc.
65
+ */
66
+ function stripLitComments(html) {
67
+ if (!html) return '';
68
+
69
+ // Remove Lit binding markers: <!--?lit$...$-->
70
+ html = html.replace(/<!--\?lit\$[^$]+\$-->/g, '');
71
+
72
+ // Remove empty Lit comments: <!---->
73
+ html = html.replace(/<!---->/g, '');
74
+
75
+ // Remove Lit template marker comments: <!--lit-part...-->
76
+ html = html.replace(/<!--lit-part[^>]*-->/g, '');
77
+ html = html.replace(/<!--\/lit-part-->/g, '');
78
+
79
+ // Clean up any resulting multiple whitespace/newlines
80
+ html = html.replace(/\n\s*\n\s*\n/g, '\n\n');
81
+
82
+ return html;
83
+ }
84
+
62
85
  /**
63
86
  * Transform Lit template result to HTML string
64
87
  */
@@ -72,7 +95,10 @@ async function litToHTML(templateResult) {
72
95
 
73
96
  await new Promise(resolve => setTimeout(resolve, 50));
74
97
 
75
- return formatHTML(temp.innerHTML);
98
+ // Strip Lit comments before formatting
99
+ const cleanedHTML = stripLitComments(temp.innerHTML);
100
+
101
+ return formatHTML(cleanedHTML);
76
102
  }
77
103
 
78
104
  function serializeForDisplay(value) {
@@ -1,5 +1,12 @@
1
1
  /* Custom Docs page styling - hide all examples, show only description */
2
2
 
3
+ /* Override Storybook's default mono font for code panels */
4
+ pre, code, .docblock-source pre, .docblock-source code {
5
+ font-family: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
6
+ font-size: 13.6px;
7
+ line-height: 24px;
8
+ }
9
+
3
10
  /* Hide ALL story previews and interactive elements in Docs */
4
11
  .docs-story,
5
12
  .sbdocs-preview,
@@ -39,13 +39,13 @@
39
39
  padding: var(--spacing-4, 1rem);
40
40
  border-radius: var(--radius-md, 4px);
41
41
  overflow-x: auto;
42
- font-size: 0.875rem;
43
- line-height: 1.6;
42
+ font-size: 13.6px;
43
+ line-height: 24px;
44
44
  tab-size: 2;
45
45
  }
46
46
 
47
47
  .html-source-content pre code {
48
- font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
48
+ font-family: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
49
49
  }
50
50
 
51
51
  /* Fallback pre styling (before Shiki loads) */
@@ -54,9 +54,9 @@
54
54
  padding: var(--spacing-4, 1rem);
55
55
  border-radius: var(--radius-md, 4px);
56
56
  overflow-x: auto;
57
- font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
58
- font-size: 0.875rem;
59
- line-height: 1.6;
57
+ font-family: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
58
+ font-size: 13.6px;
59
+ line-height: 24px;
60
60
  tab-size: 2;
61
61
  background: var(--color-surface-raised, #282c34);
62
62
  color: var(--color-text-primary, #abb2bf);
@@ -67,6 +67,29 @@ export function extractHTML(element) {
67
67
  return clone.innerHTML || '';
68
68
  }
69
69
 
70
+ /**
71
+ * Strip Lit template comments from rendered HTML
72
+ * Removes markers like <!--?lit$641514976$-->, <!---->, etc.
73
+ */
74
+ export function stripLitComments(html) {
75
+ if (!html) return '';
76
+
77
+ // Remove Lit binding markers: <!--?lit$...$-->
78
+ html = html.replace(/<!--\?lit\$[^$]+\$-->/g, '');
79
+
80
+ // Remove empty Lit comments: <!---->
81
+ html = html.replace(/<!---->/g, '');
82
+
83
+ // Remove Lit template marker comments: <!--lit-part...-->
84
+ html = html.replace(/<!--lit-part[^>]*-->/g, '');
85
+ html = html.replace(/<!--\/lit-part-->/g, '');
86
+
87
+ // Clean up any resulting multiple whitespace/newlines
88
+ html = html.replace(/\n\s*\n\s*\n/g, '\n\n');
89
+
90
+ return html;
91
+ }
92
+
70
93
  /**
71
94
  * Transform Lit template result to HTML string
72
95
  */
@@ -81,7 +104,10 @@ export async function litToHTML(templateResult) {
81
104
  // Wait for any custom elements to upgrade
82
105
  await new Promise(resolve => setTimeout(resolve, 50));
83
106
 
84
- return formatHTML(temp.innerHTML);
107
+ // Strip Lit comments before formatting
108
+ const cleanedHTML = stripLitComments(temp.innerHTML);
109
+
110
+ return formatHTML(cleanedHTML);
85
111
  }
86
112
 
87
113
  /**
@@ -0,0 +1,13 @@
1
+ <!-- Source Code Pro font for code panel readability (like React.dev) -->
2
+ <link rel="preconnect" href="https://fonts.googleapis.com">
3
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
4
+ <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;500;600&display=swap" rel="stylesheet">
5
+
6
+ <!-- Override Storybook's default monospace font in the manager frame -->
7
+ <style>
8
+ pre, code, .docblock-source pre, .docblock-source code {
9
+ font-family: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
10
+ font-size: 13.6px;
11
+ line-height: 24px;
12
+ }
13
+ </style>
@@ -1,5 +1,10 @@
1
1
  <!-- PDS runs in LIVE mode - styles are generated dynamically by Generator.applyStyles() -->
2
2
 
3
+ <!-- Source Code Pro font for code readability (like React.dev) -->
4
+ <link rel="preconnect" href="https://fonts.googleapis.com">
5
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
6
+ <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;500;600&display=swap" rel="stylesheet">
7
+
3
8
  <!-- Import map for pds-jsonform and other components that use #pds/lit -->
4
9
  <script type="importmap">
5
10
  {
@@ -1304,7 +1304,7 @@ const preview = {
1304
1304
  ]
1305
1305
  },
1306
1306
  docs: {
1307
- page: DocsPage
1307
+ page: DocsPage,
1308
1308
  },
1309
1309
  options: {
1310
1310
  storySort: {
@@ -1,5 +1,5 @@
1
1
  {
2
- "generatedAt": "2026-01-09T09:26:50.541Z",
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.15",
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.15"
40
+ "@pure-ds/core": "^0.4.17"
41
41
  },
42
42
  "dependencies": {
43
43
  "@custom-elements-manifest/analyzer": "^0.11.0",