@kerfjs/ui 5.0.0-beta.53 → 5.0.0-beta.55

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 (152) hide show
  1. package/README.md +4 -2
  2. package/ai/application-ui-diagnostic-ids-v1.json +1 -0
  3. package/ai/component-catalog-v2.json +138 -5
  4. package/ai/component-catalog-v2.schema.json +2 -1
  5. package/ai/component-catalog.json +208 -16
  6. package/ai/public-api-signatures-v1.md +462 -39
  7. package/ai/skill.md +28 -20
  8. package/ai/webawesome-jsx-signatures-v1.md +1 -1
  9. package/analyzer/index.mjs +48 -0
  10. package/analyzer/loud-pairs.d.mts +49 -0
  11. package/analyzer/loud-pairs.mjs +357 -0
  12. package/dist/app-tab.d.ts +7 -5
  13. package/dist/app-tab.js +1 -1
  14. package/dist/browser/popup-menu.js +3 -0
  15. package/dist/catalog-resources.d.ts +1 -1
  16. package/dist/catalog.d.ts +10 -4
  17. package/dist/catalog.js +243 -300
  18. package/dist/catalog.js.map +1 -1
  19. package/dist/{chunk-7IUSV4XG.js → chunk-24PHKUR3.js} +2 -2
  20. package/dist/chunk-24PHKUR3.js.map +1 -0
  21. package/dist/{chunk-EKYZCRCX.js → chunk-3CGQ7ZNO.js} +54 -22
  22. package/dist/chunk-3CGQ7ZNO.js.map +1 -0
  23. package/dist/{chunk-UKKSMZYT.js → chunk-46263QLK.js} +51 -1
  24. package/dist/chunk-46263QLK.js.map +1 -0
  25. package/dist/chunk-4BIMLITI.js +92 -0
  26. package/dist/chunk-4BIMLITI.js.map +1 -0
  27. package/dist/{chunk-NDUGJ4TU.js → chunk-5NDQABWK.js} +1 -1
  28. package/dist/{chunk-NDUGJ4TU.js.map → chunk-5NDQABWK.js.map} +1 -1
  29. package/dist/{chunk-ZK5EGVFP.js → chunk-5OLVUEND.js} +12 -2
  30. package/dist/chunk-5OLVUEND.js.map +1 -0
  31. package/dist/{chunk-CMUIXJZM.js → chunk-BSKEH3UC.js} +2 -2
  32. package/dist/{chunk-CMUIXJZM.js.map → chunk-BSKEH3UC.js.map} +1 -1
  33. package/dist/chunk-EAX2GSS4.js +384 -0
  34. package/dist/chunk-EAX2GSS4.js.map +1 -0
  35. package/dist/chunk-KH6VUGHU.js +399 -0
  36. package/dist/chunk-KH6VUGHU.js.map +1 -0
  37. package/dist/{chunk-BJJKFVWW.js → chunk-LZXQVUGN.js} +2 -2
  38. package/dist/chunk-LZXQVUGN.js.map +1 -0
  39. package/dist/chunk-N7FHFNT6.js +55 -0
  40. package/dist/chunk-N7FHFNT6.js.map +1 -0
  41. package/dist/{chunk-CCMKJWLX.js → chunk-NE5JAOQS.js} +7 -7
  42. package/dist/chunk-NE5JAOQS.js.map +1 -0
  43. package/dist/chunk-PSHUSWQH.js +18 -0
  44. package/dist/chunk-PSHUSWQH.js.map +1 -0
  45. package/dist/{chunk-KPNTVB7A.js → chunk-R754MHXX.js} +3 -3
  46. package/dist/{chunk-KPNTVB7A.js.map → chunk-R754MHXX.js.map} +1 -1
  47. package/dist/{chunk-HJKRCKDR.js → chunk-RNRUVPJ3.js} +4 -2
  48. package/dist/chunk-RNRUVPJ3.js.map +1 -0
  49. package/dist/{chunk-VOCPXGQN.js → chunk-VHADGP3B.js} +9 -8
  50. package/dist/chunk-VHADGP3B.js.map +1 -0
  51. package/dist/chunk-XQV2B4IL.js +14 -0
  52. package/dist/chunk-XQV2B4IL.js.map +1 -0
  53. package/dist/collapsible-panel.d.ts +46 -15
  54. package/dist/collapsible-panel.js +42 -10
  55. package/dist/collapsible-panel.js.map +1 -1
  56. package/dist/floating-toolbar.d.ts +5 -2
  57. package/dist/floating-toolbar.js +1 -1
  58. package/dist/index.d.ts +1 -0
  59. package/dist/index.js +20 -18
  60. package/dist/list-header.js +1 -1
  61. package/dist/list-inset-text.d.ts +7 -1
  62. package/dist/list-inset-text.js +2 -1
  63. package/dist/panel-toolbar-BFQxFITu.d.ts +52 -0
  64. package/dist/popup-menu-register.d.ts +9 -0
  65. package/dist/popup-menu-register.js +30 -0
  66. package/dist/popup-menu-register.js.map +1 -0
  67. package/dist/popup-menu.d.ts +71 -0
  68. package/dist/popup-menu.js +3 -0
  69. package/dist/popup-menu.js.map +1 -0
  70. package/dist/resizable-region.d.ts +4 -1
  71. package/dist/resizable-region.js +1 -1
  72. package/dist/split-view.js +1 -1
  73. package/dist/state-banner.js +1 -1
  74. package/dist/styles/catalog/components/catalog-example.css +0 -16
  75. package/dist/styles/catalog/components/catalog-stage.css +8 -13
  76. package/dist/styles/catalog/components/catalog.css +8 -18
  77. package/dist/styles/catalog.css +0 -5
  78. package/dist/styles/collapsible-panel.css +88 -10
  79. package/dist/styles/floating-toolbar.css +11 -6
  80. package/dist/styles/popup-menu.css +12 -0
  81. package/dist/styles/resizable-region.css +81 -13
  82. package/dist/styles/state-banner.css +13 -4
  83. package/dist/styles/styles.css +1 -0
  84. package/dist/styles/tab-bar.css +31 -3
  85. package/dist/styles/toolbar-control-group.css +13 -0
  86. package/dist/styles/toolbar.css +43 -2
  87. package/dist/styles/workbench.css +503 -10
  88. package/dist/text.js +1 -1
  89. package/dist/token-search-field.d.ts +10 -1
  90. package/dist/token-search-field.js +1 -1
  91. package/dist/{types-CEsieBZi.d.ts → types-D6vzj-VT.d.ts} +15 -0
  92. package/dist/wire-catalog.d.ts +13 -1
  93. package/dist/wire-catalog.js +18 -3
  94. package/dist/wire-catalog.js.map +1 -1
  95. package/dist/wire-resizable-regions.d.ts +2 -1
  96. package/dist/wire-resizable-regions.js +2 -1
  97. package/dist/wire-sidebar.js +6 -3
  98. package/dist/wire-sidebar.js.map +1 -1
  99. package/dist/wire-tab-bars.js +1 -1
  100. package/dist/wire-token-search-fields.js +1 -1
  101. package/dist/wire-workbench.d.ts +109 -0
  102. package/dist/wire-workbench.js +6 -0
  103. package/dist/wire-workbench.js.map +1 -0
  104. package/dist/workbench.d.ts +166 -6
  105. package/dist/workbench.js +11 -104
  106. package/dist/workbench.js.map +1 -1
  107. package/docs/accessibility.md +66 -10
  108. package/docs/app-layouts.md +12 -1
  109. package/docs/catalog.md +27 -9
  110. package/docs/collapsible-panel.md +114 -1
  111. package/docs/component-contract.md +2 -2
  112. package/docs/component-selection.md +41 -23
  113. package/docs/design/templates/state-banner/danger-dark.svg +1 -1
  114. package/docs/design/templates/state-banner/danger.svg +1 -1
  115. package/docs/design/templates/state-banner/info-dark.svg +1 -1
  116. package/docs/design/templates/state-banner/info.svg +1 -1
  117. package/docs/design/templates/state-banner/success-dark.svg +1 -1
  118. package/docs/design/templates/state-banner/success.svg +1 -1
  119. package/docs/design/templates/state-banner/warning-dark.svg +1 -1
  120. package/docs/design/templates/state-banner/warning.svg +1 -1
  121. package/docs/design/templates/state-banner-dark.svg +1 -1
  122. package/docs/design/templates/state-banner.svg +1 -1
  123. package/docs/document-baseline.md +4 -0
  124. package/docs/layout.md +10 -1
  125. package/docs/recipes.md +48 -39
  126. package/docs/surface-scaffold.md +1 -1
  127. package/docs/type-contracts.md +2 -1
  128. package/docs/ui-analyzer.md +94 -19
  129. package/docs/ui-doctor.md +6 -0
  130. package/docs/ux-demo.md +7 -3
  131. package/docs/webawesome-theme.md +11 -2
  132. package/docs/workbench.md +388 -8
  133. package/llms.txt +13 -8
  134. package/package.json +17 -2
  135. package/ux-demo/recipes/app-shell.tsx +141 -223
  136. package/ux-demo/recipes/collapsible-sidebar.tsx +48 -78
  137. package/ux-demo/recipes/list-detail-dialog.tsx +150 -54
  138. package/ux-demo/recipes/mount-recipe.ts +0 -5
  139. package/ux-demo/recipes/types.ts +0 -1
  140. package/dist/chunk-7IUSV4XG.js.map +0 -1
  141. package/dist/chunk-BJJKFVWW.js.map +0 -1
  142. package/dist/chunk-CCMKJWLX.js.map +0 -1
  143. package/dist/chunk-EKYZCRCX.js.map +0 -1
  144. package/dist/chunk-HJKRCKDR.js.map +0 -1
  145. package/dist/chunk-UKKSMZYT.js.map +0 -1
  146. package/dist/chunk-VOCPXGQN.js.map +0 -1
  147. package/dist/chunk-ZK5EGVFP.js.map +0 -1
  148. package/dist/styles/catalog/components/catalog-detail.css +0 -35
  149. package/dist/styles/catalog/components/catalog-resource-footer.css +0 -37
  150. package/dist/styles/catalog/components/catalog-secondary-sections.css +0 -38
  151. package/dist/styles/catalog/components/catalog-section-list.css +0 -22
  152. package/dist/styles/catalog/components/catalog-sidebar.css +0 -82
package/dist/catalog.js CHANGED
@@ -1,49 +1,67 @@
1
- import { ToolbarControlGroup, ToolbarActionLink } from './chunk-ZIYOJFZD.js';
2
- import { Toolbar } from './chunk-MTM43SJO.js';
1
+ import { Workbench } from './chunk-EAX2GSS4.js';
2
+
3
+ import { Row } from './chunk-5I22LMCV.js';
4
+
3
5
  import { ListItem } from './chunk-GUIHMIT2.js';
4
6
  import { List } from './chunk-3NBL3OUQ.js';
7
+
5
8
  import { ToolbarText } from './chunk-TZ5IHWB2.js';
6
- import { Pane } from './chunk-7GUQYHKA.js';
9
+ import { PopupMenu } from './chunk-4BIMLITI.js';
7
10
 
8
11
 
9
- import { ListHeader } from './chunk-KPNTVB7A.js';
12
+ import { ListHeader } from './chunk-R754MHXX.js';
13
+ import { Text } from './chunk-24PHKUR3.js';
14
+ import { ListInsetText } from './chunk-5OLVUEND.js';
10
15
 
11
16
 
12
- import { filterDataAttributes } from './chunk-SRSJO5QE.js';
13
17
 
18
+ import { Toolbar } from './chunk-MTM43SJO.js';
19
+ import { ToolbarControlGroup, ToolbarActionLink } from './chunk-ZIYOJFZD.js';
20
+
21
+ import { filterDataAttributes } from './chunk-SRSJO5QE.js';
14
22
 
15
23
 
16
24
  import { LucideIcon } from './chunk-4R777DUZ.js';
17
- import { PanelLeftClose, Moon, Sun, PanelLeftOpen, Waypoints, ExternalLink } from 'lucide';
18
- import { jsxs, jsx, Fragment } from 'kerfjs/jsx-runtime';
25
+ import { Moon, Sun, Waypoints, ExternalLink } from 'lucide';
26
+ import { jsx, jsxs, Fragment } from 'kerfjs/jsx-runtime';
19
27
 
20
28
  function relatedMenuItems(related, selectAction) {
21
29
  const groups = [];
22
30
  for (const entry of related)
23
31
  if (!groups.includes(entry.group)) groups.push(entry.group);
24
- const nodes = [];
32
+ const items = [];
25
33
  groups.forEach((group, index) => {
26
- if (index > 0) nodes.push(/* @__PURE__ */ jsx("wa-divider", {}));
27
- nodes.push(/* @__PURE__ */ jsx("small", { class: "kui-catalog__related-heading", children: group }));
28
- for (const entry of related) {
34
+ if (index > 0) items.push({ kind: "divider" });
35
+ items.push({ kind: "heading", label: group });
36
+ for (const entry of related)
29
37
  if (entry.group === group)
30
- nodes.push(
31
- /* @__PURE__ */ jsx("wa-dropdown-item", { "data-action": selectAction, "data-item-id": entry.id, children: entry.name })
32
- );
33
- }
38
+ items.push({
39
+ label: entry.name,
40
+ action: selectAction,
41
+ attributes: { "data-item-id": entry.id }
42
+ });
34
43
  });
35
- return nodes;
44
+ return items;
36
45
  }
37
46
  function CatalogResourceFooter({
38
47
  name,
39
- active,
40
48
  resources,
41
49
  related,
42
50
  status,
43
51
  selectAction
44
52
  }) {
45
- return /* @__PURE__ */ jsxs("div", { class: "kui-catalog__footer", children: [
46
- status ? /* @__PURE__ */ jsx("div", { class: "kui-catalog__status", children: status }) : null,
53
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
54
+ status ? /* @__PURE__ */ jsx(
55
+ Row,
56
+ {
57
+ hAlign: "space-between",
58
+ vAlign: "baseline",
59
+ gap: "xs",
60
+ wrap: true,
61
+ textInsets: "trl",
62
+ children: status
63
+ }
64
+ ) : null,
47
65
  /* @__PURE__ */ jsx(
48
66
  Toolbar,
49
67
  {
@@ -80,20 +98,14 @@ function CatalogResourceFooter({
80
98
  menuInset: "compact",
81
99
  size: "compact",
82
100
  label: "Related entries",
83
- children: /* @__PURE__ */ jsxs(
84
- "wa-dropdown",
101
+ children: /* @__PURE__ */ jsx(
102
+ PopupMenu,
85
103
  {
104
+ text: "Components",
105
+ icon: /* @__PURE__ */ jsx(LucideIcon, { icon: Waypoints, name: "waypoints" }),
86
106
  placement: "top-end",
87
- "data-key": `kui-catalog-related-${active}`,
88
- "data-catalog-related": true,
89
- "data-morph-skip-children": true,
90
- children: [
91
- /* @__PURE__ */ jsxs("wa-button", { slot: "trigger", appearance: "plain", "with-caret": true, children: [
92
- /* @__PURE__ */ jsx(LucideIcon, { icon: Waypoints, name: "waypoints" }),
93
- /* @__PURE__ */ jsx("span", { children: "Components" })
94
- ] }),
95
- relatedMenuItems(related, selectAction)
96
- ]
107
+ items: relatedMenuItems(related, selectAction),
108
+ rootAttributes: { "data-catalog-related": "" }
97
109
  }
98
110
  )
99
111
  }
@@ -102,6 +114,99 @@ function CatalogResourceFooter({
102
114
  )
103
115
  ] });
104
116
  }
117
+ function CatalogSectionEntries({
118
+ section,
119
+ active,
120
+ selectAction
121
+ }) {
122
+ return /* @__PURE__ */ jsxs(List, { rootAttributes: { "data-catalog-section": section.category }, children: [
123
+ /* @__PURE__ */ jsx(ListHeader, { label: section.category }),
124
+ /* @__PURE__ */ jsx(List, { gap: "2xs", children: section.entries.map((entry) => /* @__PURE__ */ jsx(
125
+ ListItem,
126
+ {
127
+ action: selectAction,
128
+ itemId: entry.id,
129
+ label: entry.name,
130
+ status: entry.tags?.join(" \xB7 "),
131
+ selected: active === entry.id,
132
+ title: entry.description,
133
+ multiline: true
134
+ }
135
+ )) })
136
+ ] });
137
+ }
138
+ function CatalogSecondarySections({
139
+ group,
140
+ active,
141
+ selectAction,
142
+ toggleAction
143
+ }) {
144
+ const open = !group.collapsible || Boolean(group.expanded);
145
+ return /* @__PURE__ */ jsxs(List, { dividerSides: "t", controlInsets: "t", children: [
146
+ group.collapsible ? /* @__PURE__ */ jsx(
147
+ ListHeader,
148
+ {
149
+ label: group.label,
150
+ toggle: true,
151
+ expanded: open,
152
+ action: toggleAction
153
+ }
154
+ ) : /* @__PURE__ */ jsx(ListHeader, { label: group.label }),
155
+ open ? /* @__PURE__ */ jsx(List, { gap: "m", rootAttributes: { "data-catalog-secondary": "" }, children: group.sections.map((section) => /* @__PURE__ */ jsx(
156
+ CatalogSectionEntries,
157
+ {
158
+ section,
159
+ active,
160
+ selectAction
161
+ }
162
+ )) }) : null
163
+ ] });
164
+ }
165
+ function CatalogSectionList({
166
+ sections,
167
+ active,
168
+ selectAction
169
+ }) {
170
+ return /* @__PURE__ */ jsx(Fragment, { children: sections.map((section) => /* @__PURE__ */ jsx(
171
+ CatalogSectionEntries,
172
+ {
173
+ section,
174
+ active,
175
+ selectAction
176
+ }
177
+ )) });
178
+ }
179
+ function CatalogSidebar({
180
+ brand,
181
+ sections,
182
+ active,
183
+ secondarySections,
184
+ footer,
185
+ selectAction,
186
+ toggleSecondaryAction
187
+ }) {
188
+ return /* @__PURE__ */ jsx("nav", { "aria-label": `${brand.title} components`, children: /* @__PURE__ */ jsxs(List, { gap: "m", controlInsets: "b", children: [
189
+ brand.subtitle ? /* @__PURE__ */ jsx(ListInsetText, { sides: "rl", children: /* @__PURE__ */ jsx(Text, { variant: "span", size: "compact", tone: "quiet", children: brand.subtitle }) }) : null,
190
+ /* @__PURE__ */ jsx(
191
+ CatalogSectionList,
192
+ {
193
+ sections,
194
+ active,
195
+ selectAction
196
+ }
197
+ ),
198
+ secondarySections ? /* @__PURE__ */ jsx(
199
+ CatalogSecondarySections,
200
+ {
201
+ group: secondarySections,
202
+ active,
203
+ selectAction,
204
+ toggleAction: toggleSecondaryAction
205
+ }
206
+ ) : null,
207
+ footer
208
+ ] }) });
209
+ }
105
210
  var protectedAttributes = /* @__PURE__ */ new Set(["data-catalog-stage"]);
106
211
  function CatalogStage({
107
212
  name,
@@ -135,51 +240,82 @@ function CatalogStage({
135
240
  }
136
241
  );
137
242
  }
138
- function CatalogDetail({
139
- brandTitle,
243
+ function findEntry(sections, id) {
244
+ for (const section of sections) {
245
+ for (const entry of section.entries) if (entry.id === id) return entry;
246
+ }
247
+ return void 0;
248
+ }
249
+ function Catalog({
250
+ id = "kui-catalog",
251
+ brand,
252
+ sections,
140
253
  active,
141
- selected,
142
254
  content,
143
- collapsed,
255
+ collapsed = false,
144
256
  theme,
145
257
  headerActions,
258
+ secondarySections,
259
+ sidebarFooter,
146
260
  status,
147
261
  geometryOverlay,
148
262
  stageRootAttributes,
149
- selectAction,
150
- toggleSidebarAction,
151
- toggleThemeAction
263
+ selectAction = "catalog-select",
264
+ toggleSidebarAction = "catalog-toggle-sidebar",
265
+ toggleThemeAction = "catalog-toggle-theme",
266
+ toggleSecondaryAction = "catalog-toggle-secondary",
267
+ headerPlacement = "fixed",
268
+ footerPlacement = "fixed",
269
+ className = "",
270
+ slot
152
271
  }) {
272
+ const selected = findEntry(sections, active) ?? (secondarySections ? findEntry(secondarySections.sections, active) : void 0);
153
273
  const name = selected?.name ?? "";
154
274
  const nextTheme = theme === "dark" ? "light" : "dark";
155
- return /* @__PURE__ */ jsx("article", { class: "kui-catalog__detail", children: /* @__PURE__ */ jsx(
156
- Pane,
275
+ const catalogName = `${brand.title} catalog`;
276
+ return /* @__PURE__ */ jsx(
277
+ "main",
157
278
  {
158
- contentClassName: "kui-catalog__detail-preview",
159
- header: /* @__PURE__ */ jsxs("div", { class: "kui-catalog__header", children: [
160
- /* @__PURE__ */ jsx(
161
- Toolbar,
162
- {
279
+ class: `kui-catalog ${className}`.trim(),
280
+ "data-component": "catalog",
281
+ "data-sidebar-collapsed": String(collapsed),
282
+ "data-geometry-overlay": geometryOverlay === void 0 ? void 0 : String(geometryOverlay),
283
+ slot,
284
+ children: /* @__PURE__ */ jsx(
285
+ Workbench,
286
+ {
287
+ id,
288
+ label: catalogName,
289
+ leftRail: {
290
+ label: catalogName,
291
+ size: 288,
292
+ collapsed,
293
+ toolbar: {
294
+ label: `${catalogName} header`,
295
+ title: /* @__PURE__ */ jsxs(Fragment, { children: [
296
+ brand.logoUrl ? /* @__PURE__ */ jsx(ToolbarControlGroup, { appearance: "borderless", single: true, children: /* @__PURE__ */ jsx("img", { class: "kui-catalog__mark", src: brand.logoUrl, alt: "" }) }) : null,
297
+ /* @__PURE__ */ jsx(ToolbarText, { text: brand.title, size: "large", headingLevel: 1 })
298
+ ] }),
299
+ toggle: { action: toggleSidebarAction, name: catalogName }
300
+ },
301
+ content: /* @__PURE__ */ jsx(
302
+ CatalogSidebar,
303
+ {
304
+ brand,
305
+ sections,
306
+ active,
307
+ secondarySections,
308
+ footer: sidebarFooter,
309
+ selectAction,
310
+ toggleSecondaryAction
311
+ }
312
+ )
313
+ },
314
+ mainToolbar: {
163
315
  label: `${name} header`,
164
- dividerSides: "",
165
- leading: /* @__PURE__ */ jsxs(Fragment, { children: [
166
- collapsed ? /* @__PURE__ */ jsx(ToolbarControlGroup, { appearance: "borderless", single: true, children: /* @__PURE__ */ jsx(
167
- "button",
168
- {
169
- type: "button",
170
- "data-action": toggleSidebarAction,
171
- "aria-label": `Expand ${brandTitle} catalog`,
172
- children: /* @__PURE__ */ jsx(
173
- LucideIcon,
174
- {
175
- icon: PanelLeftOpen,
176
- name: "panel-left-open"
177
- }
178
- )
179
- }
180
- ) }) : null,
181
- /* @__PURE__ */ jsx(ToolbarText, { text: name, size: "xlarge", headingLevel: 2 })
182
- ] }),
316
+ // The entry title stays whole; actions wrap below it when narrow.
317
+ responsive: "wrap",
318
+ title: /* @__PURE__ */ jsx(ToolbarText, { text: name, size: "xlarge", headingLevel: 2 }),
183
319
  trailing: /* @__PURE__ */ jsxs(Fragment, { children: [
184
320
  headerActions,
185
321
  theme ? /* @__PURE__ */ jsx(
@@ -205,248 +341,47 @@ function CatalogDetail({
205
341
  }
206
342
  ) : null
207
343
  ] })
208
- }
209
- ),
210
- selected?.description ? /* @__PURE__ */ jsx("p", { class: "kui-catalog__description kui-content-item", children: selected.description }) : null
211
- ] }),
212
- footer: /* @__PURE__ */ jsx(
213
- CatalogResourceFooter,
214
- {
215
- name,
216
- active,
217
- resources: selected?.resources ?? [],
218
- related: selected?.related ?? [],
219
- status,
220
- selectAction
221
- }
222
- ),
223
- children: /* @__PURE__ */ jsx(
224
- CatalogStage,
225
- {
226
- name,
227
- content,
228
- geometryOverlay,
229
- rootAttributes: stageRootAttributes
230
- }
231
- )
232
- }
233
- ) });
234
- }
235
- function CatalogSecondarySections({
236
- group,
237
- active,
238
- selectAction,
239
- toggleAction
240
- }) {
241
- return /* @__PURE__ */ jsxs("section", { class: "kui-catalog__group--secondary", children: [
242
- group.collapsible ? /* @__PURE__ */ jsx(
243
- ListHeader,
244
- {
245
- label: group.label,
246
- toggle: true,
247
- expanded: Boolean(group.expanded),
248
- action: toggleAction
249
- }
250
- ) : /* @__PURE__ */ jsx(ListHeader, { label: group.label }),
251
- !group.collapsible || group.expanded ? /* @__PURE__ */ jsx("div", { class: "kui-catalog__secondary", "data-catalog-secondary": true, children: group.sections.map((section) => /* @__PURE__ */ jsxs("section", { class: "kui-catalog__secondary-group", children: [
252
- /* @__PURE__ */ jsx("h3", { class: "kui-catalog__secondary-heading", children: section.category }),
253
- /* @__PURE__ */ jsx("div", { class: "kui-catalog__secondary-items", children: /* @__PURE__ */ jsx(List, { gap: "2xs", children: section.entries.map((entry) => /* @__PURE__ */ jsx(
254
- ListItem,
255
- {
256
- action: selectAction,
257
- itemId: entry.id,
258
- label: entry.name,
259
- status: entry.tags?.join(" \xB7 "),
260
- selected: active === entry.id,
261
- title: entry.description,
262
- multiline: true
263
- }
264
- )) }) })
265
- ] })) }) : null
266
- ] });
267
- }
268
- function CatalogSectionList({
269
- sections,
270
- active,
271
- selectAction
272
- }) {
273
- return /* @__PURE__ */ jsx("div", { class: "kui-catalog__sections", children: sections.map((section) => /* @__PURE__ */ jsxs("section", { class: "kui-catalog__group", children: [
274
- /* @__PURE__ */ jsx(ListHeader, { label: section.category }),
275
- /* @__PURE__ */ jsx("div", { class: "kui-catalog__items", children: /* @__PURE__ */ jsx(List, { gap: "2xs", children: section.entries.map((entry) => /* @__PURE__ */ jsx(
276
- ListItem,
277
- {
278
- action: selectAction,
279
- itemId: entry.id,
280
- label: entry.name,
281
- status: entry.tags?.join(" \xB7 "),
282
- selected: active === entry.id,
283
- title: entry.description,
284
- multiline: true
285
- }
286
- )) }) })
287
- ] })) });
288
- }
289
- function CatalogSidebar({
290
- brand,
291
- sections,
292
- active,
293
- collapsed,
294
- secondarySections,
295
- footer,
296
- selectAction,
297
- toggleSidebarAction,
298
- toggleSecondaryAction
299
- }) {
300
- return /* @__PURE__ */ jsx(
301
- "aside",
302
- {
303
- class: "kui-catalog__sidebar",
304
- "aria-label": `${brand.title} catalog`,
305
- "data-collapsed": String(collapsed),
306
- children: /* @__PURE__ */ jsx(
307
- Pane,
308
- {
309
- header: /* @__PURE__ */ jsxs("div", { class: "kui-catalog__brand", children: [
310
- /* @__PURE__ */ jsx(
311
- Toolbar,
312
- {
313
- label: `${brand.title} catalog header`,
314
- dividerSides: "",
315
- leading: /* @__PURE__ */ jsxs(Fragment, { children: [
316
- brand.logoUrl ? /* @__PURE__ */ jsx(ToolbarControlGroup, { appearance: "borderless", single: true, children: /* @__PURE__ */ jsx(
317
- "img",
318
- {
319
- class: "kui-catalog__mark",
320
- src: brand.logoUrl,
321
- alt: ""
322
- }
323
- ) }) : null,
324
- /* @__PURE__ */ jsx(
325
- ToolbarText,
326
- {
327
- text: brand.title,
328
- size: "large",
329
- headingLevel: 1
330
- }
331
- )
332
- ] }),
333
- trailing: /* @__PURE__ */ jsx(ToolbarControlGroup, { appearance: "borderless", single: true, children: /* @__PURE__ */ jsx(
334
- "button",
335
- {
336
- type: "button",
337
- "data-action": toggleSidebarAction,
338
- "aria-label": `Collapse ${brand.title} catalog`,
339
- children: /* @__PURE__ */ jsx(LucideIcon, { icon: PanelLeftClose, name: "panel-left-close" })
340
- }
341
- ) })
342
- }
343
- ),
344
- brand.subtitle ? /* @__PURE__ */ jsx("p", { class: "kui-catalog__subtitle", children: brand.subtitle }) : null
345
- ] }),
346
- children: /* @__PURE__ */ jsxs(
347
- "nav",
344
+ },
345
+ mainFooter: /* @__PURE__ */ jsx(
346
+ CatalogResourceFooter,
348
347
  {
349
- class: "kui-catalog__navigation",
350
- "aria-label": `${brand.title} components`,
351
- children: [
352
- /* @__PURE__ */ jsx(
353
- CatalogSectionList,
354
- {
355
- sections,
356
- active,
357
- selectAction
358
- }
359
- ),
360
- secondarySections ? /* @__PURE__ */ jsx(
361
- CatalogSecondarySections,
362
- {
363
- group: secondarySections,
364
- active,
365
- selectAction,
366
- toggleAction: toggleSecondaryAction
367
- }
368
- ) : null,
369
- footer
370
- ]
348
+ name,
349
+ resources: selected?.resources ?? [],
350
+ related: selected?.related ?? [],
351
+ status,
352
+ selectAction
371
353
  }
354
+ ),
355
+ mainHeaderPlacement: headerPlacement,
356
+ mainFooterPlacement: footerPlacement,
357
+ main: (
358
+ // The description is supporting copy, so it scrolls with the
359
+ // preview rather than pinning under the toolbar.
360
+ /* @__PURE__ */ jsxs(List, { flex: true, children: [
361
+ selected?.description ? /* @__PURE__ */ jsx(
362
+ ListInsetText,
363
+ {
364
+ sides: "trbl",
365
+ rootAttributes: { "data-catalog-description": "" },
366
+ children: /* @__PURE__ */ jsx(Text, { variant: "span", children: selected.description })
367
+ }
368
+ ) : null,
369
+ /* @__PURE__ */ jsx(
370
+ CatalogStage,
371
+ {
372
+ name,
373
+ content,
374
+ geometryOverlay,
375
+ rootAttributes: stageRootAttributes
376
+ }
377
+ )
378
+ ] })
372
379
  )
373
380
  }
374
381
  )
375
382
  }
376
383
  );
377
384
  }
378
- function findEntry(sections, id) {
379
- for (const section of sections) {
380
- for (const entry of section.entries) if (entry.id === id) return entry;
381
- }
382
- return void 0;
383
- }
384
- function Catalog({
385
- brand,
386
- sections,
387
- active,
388
- content,
389
- collapsed = false,
390
- theme,
391
- headerActions,
392
- secondarySections,
393
- sidebarFooter,
394
- status,
395
- geometryOverlay,
396
- stageRootAttributes,
397
- selectAction = "catalog-select",
398
- toggleSidebarAction = "catalog-toggle-sidebar",
399
- toggleThemeAction = "catalog-toggle-theme",
400
- toggleSecondaryAction = "catalog-toggle-secondary",
401
- className = "",
402
- slot
403
- }) {
404
- const selected = findEntry(sections, active) ?? (secondarySections ? findEntry(secondarySections.sections, active) : void 0);
405
- return /* @__PURE__ */ jsxs(
406
- "main",
407
- {
408
- class: `kui-catalog ${className}`.trim(),
409
- "data-component": "catalog",
410
- "data-sidebar-collapsed": String(collapsed),
411
- "data-geometry-overlay": geometryOverlay === void 0 ? void 0 : String(geometryOverlay),
412
- slot,
413
- children: [
414
- /* @__PURE__ */ jsx(
415
- CatalogSidebar,
416
- {
417
- brand,
418
- sections,
419
- active,
420
- collapsed,
421
- secondarySections,
422
- footer: sidebarFooter,
423
- selectAction,
424
- toggleSidebarAction,
425
- toggleSecondaryAction
426
- }
427
- ),
428
- /* @__PURE__ */ jsx(
429
- CatalogDetail,
430
- {
431
- brandTitle: brand.title,
432
- active,
433
- selected,
434
- content,
435
- collapsed,
436
- theme,
437
- headerActions,
438
- status,
439
- geometryOverlay,
440
- stageRootAttributes,
441
- selectAction,
442
- toggleSidebarAction,
443
- toggleThemeAction
444
- }
445
- )
446
- ]
447
- }
448
- );
449
- }
450
385
  var protectedAttributes2 = /* @__PURE__ */ new Set([
451
386
  "data-catalog-example",
452
387
  "data-catalog-example-stack",
@@ -505,8 +440,16 @@ function CatalogExample({
505
440
  rootAttributes: { "data-catalog-example-label": "" }
506
441
  }
507
442
  ) : null,
508
- note !== void 0 ? /* @__PURE__ */ jsx("p", { class: "kui-catalog-example__note", "data-catalog-example-note": true, children: note }) : null,
509
- compactFallback !== void 0 ? /* @__PURE__ */ jsx("p", { class: "kui-catalog-example__compact-fallback", children: compactFallback }) : null,
443
+ note !== void 0 ? /* @__PURE__ */ jsx(
444
+ ListInsetText,
445
+ {
446
+ sides: "rl",
447
+ className: "kui-catalog-example__note",
448
+ rootAttributes: { "data-catalog-example-note": "" },
449
+ children: /* @__PURE__ */ jsx(Text, { variant: "span", size: "compact", tone: "quiet", children: note })
450
+ }
451
+ ) : null,
452
+ compactFallback !== void 0 ? /* @__PURE__ */ jsx(Text, { tone: "quiet", className: "kui-catalog-example__compact-fallback", children: compactFallback }) : null,
510
453
  specimen
511
454
  ]
512
455
  }