jsl-ui 10.1.1 → 10.2.1

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 (41) hide show
  1. package/docs/DataBinding.md +19 -0
  2. package/docs/DateTimeComponent.md +1 -0
  3. package/docs/GridComponent.md +8 -5
  4. package/docs/InputComponent.md +1 -1
  5. package/docs/README.md +1 -0
  6. package/examples/showcase/checks-and-expanders.ts +2 -17
  7. package/examples/showcase/data-binding.ts +138 -0
  8. package/examples/showcase/dates.ts +6 -16
  9. package/examples/showcase/fields.ts +14 -26
  10. package/examples/showcase/generate-sources.cjs +104 -0
  11. package/examples/showcase/grids.ts +240 -13
  12. package/examples/showcase/index.html +12 -2
  13. package/examples/showcase/selects.ts +6 -8
  14. package/examples/showcase/showcase-sources.ts +95 -0
  15. package/examples/showcase/showcase.css +23 -2
  16. package/examples/showcase/showcase.ts +28 -5
  17. package/lib/components/auto-suggest/AutoSuggestComponent.d.ts +4 -4
  18. package/lib/components/auto-suggest/AutoSuggestComponent.js +1 -1
  19. package/lib/components/checkbox/CheckBoxComponent.d.ts +2 -3
  20. package/lib/components/checkbox/CheckBoxComponent.js +7 -20
  21. package/lib/components/date/DateComponent.d.ts +4 -4
  22. package/lib/components/date/DateComponent.js +11 -27
  23. package/lib/components/date-time/DateTimeComponent.d.ts +4 -4
  24. package/lib/components/date-time/DateTimeComponent.js +21 -32
  25. package/lib/components/input/InputComponent.d.ts +1 -4
  26. package/lib/components/input/InputComponent.js +14 -32
  27. package/lib/components/number/NumberComponent.d.ts +1 -4
  28. package/lib/components/number/NumberComponent.js +11 -29
  29. package/lib/components/select/SelectComponent.d.ts +1 -3
  30. package/lib/components/select/SelectComponent.js +8 -22
  31. package/lib/components/time/TimeComponent.d.ts +4 -3
  32. package/lib/components/time/TimeComponent.js +11 -24
  33. package/lib/grid/slick-default-theme.css +10 -2
  34. package/lib/grid/slick.grid.css +3 -1
  35. package/lib/grid.css +32 -3
  36. package/lib/index.css +151 -122
  37. package/lib/index.css.map +1 -1
  38. package/lib/index.js.map +1 -1
  39. package/lib/interaction/data-binding.d.ts +27 -0
  40. package/lib/interaction/data-binding.js +72 -0
  41. package/package.json +3 -1
@@ -0,0 +1,95 @@
1
+ // Generated by generate-sources.cjs. Do not edit by hand.
2
+ export const showcaseSources: Record<string, string> = {
3
+ "hierarchy": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ButtonComponent, IButtonOptions } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst node = (tag: string, content: string, className?: string): IJSLVNode => ({\n tag, content, attr: { class: className }\n});\n\nconst group = (children: Content[], className = \"sample-row\"): IJSLVNode => ({\n tag: \"div\", attr: { class: className }, children\n});\n\nconst button = (options: IButtonOptions) => new ButtonComponent({ type: \"button\", ...options });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return {\n tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" },\n children: [\n group([node(\"span\", number, \"sample-number\"), { tag: \"h2\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n node(\"p\", description, \"card-description\"),\n ...children\n ]\n };\n}\n\nconst actionStatus = node(\"p\", \"Choose an action to try it.\", \"sample-status\");\n\nactionStatus.attr.role = \"status\";\n\nconst action = (text: string) => () => { actionStatus.content = text; };\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"hierarchy\", \"01\", \"A clear hierarchy\", \"Three treatments for primary, secondary, and quieter actions.\", [\n group([\n button({ content: \"Save changes\", click: action(\"Changes saved.\") }),\n button({ content: \"Cancel\", outlined: true, click: action(\"Action cancelled.\") }),\n button({ content: \"Learn more\", variant: \"ghost\", click: action(\"Choose solid for the main action, outline for alternatives, and ghost for quieter actions.\") })\n ]), actionStatus,\n node(\"pre\", 'new ButtonComponent({ content: \"Save changes\" })', \"sample-code\")\n ])\n);",
4
+ "icons": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ButtonComponent, IButtonOptions } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst node = (tag: string, content: string, className?: string): IJSLVNode => ({\n tag, content, attr: { class: className }\n});\n\nconst group = (children: Content[], className = \"sample-row\"): IJSLVNode => ({\n tag: \"div\", attr: { class: className }, children\n});\n\nconst button = (options: IButtonOptions) => new ButtonComponent({ type: \"button\", ...options });\n\nconst paths = {\n plus: '<path d=\"M12 5v14M5 12h14\"/>',\n arrow: '<path d=\"M5 12h14m-6-6 6 6-6 6\"/>',\n download: '<path d=\"M12 3v12m-5-5 5 5 5-5M5 16v4h14v-4\"/>',\n refresh: '<path d=\"M20 7v5h-5M4 17v-5h5M6 7a7 7 0 0 1 12-1l2 6M4 12l2 6a7 7 0 0 0 12-1\"/>',\n more: '<circle cx=\"5\" cy=\"12\" r=\"1\"/><circle cx=\"12\" cy=\"12\" r=\"1\"/><circle cx=\"19\" cy=\"12\" r=\"1\"/>',\n bookmark: '<path d=\"M6 3h12v18l-6-4-6 4z\"/>',\n check: '<path d=\"m5 12 4 4L19 6\"/>'\n};\n\nfunction icon(name: keyof typeof paths): IJSLVNode {\n const svg = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"black\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\">' + paths[name] + '</svg>';\n const url = 'url(\"data:image/svg+xml,' + encodeURIComponent(svg) + '\")';\n return { tag: \"span\", attr: { class: \"showcase-icon\", style: \"mask-image:\" + url + \";-webkit-mask-image:\" + url } };\n}\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return {\n tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" },\n children: [\n group([node(\"span\", number, \"sample-number\"), { tag: \"h2\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n node(\"p\", description, \"card-description\"),\n ...children\n ]\n };\n}\n\nconst actionStatus = node(\"p\", \"Choose an action to try it.\", \"sample-status\");\n\nactionStatus.attr.role = \"status\";\n\nconst action = (text: string) => () => { actionStatus.content = text; };\n\nconst bookmarkStatus = node(\"p\", \"Save this view for later.\", \"sample-status\");\n\nbookmarkStatus.attr.role = \"status\";\n\nconst bookmark = button({\n content: \"Save view\", icon: icon(\"bookmark\"), variant: \"outline\", toggle: true,\n onToggle: pressed => { bookmarkStatus.content = pressed ? \"View saved. Click again to remove it.\" : \"Save this view for later.\"; }\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"icons\", \"02\", \"Icons, with or without text\", \"Bring your own icons. Place them before or after the label.\", [\n group([\n button({ content: \"Create project\", icon: icon(\"plus\"), click: action(\"Project created.\") }),\n button({ content: \"Download\", icon: icon(\"download\"), outlined: true, click: action(\"Download action clicked.\") }),\n button({ content: \"Continue\", icon: icon(\"arrow\"), iconPosition: \"end\", variant: \"ghost\", click: action(\"Continue action clicked.\") })\n ]),\n group([\n button({ icon: icon(\"plus\"), ariaLabel: \"Add item\", title: \"Add item\", click: action(\"Item added.\") }),\n button({ icon: icon(\"refresh\"), ariaLabel: \"Refresh\", title: \"Refresh\", outlined: true, click: action(\"View refreshed.\") }),\n button({ icon: icon(\"more\"), ariaLabel: \"More options\", title: \"More options\", variant: \"ghost\", click: action(\"More options action clicked.\") }),\n node(\"span\", \"Icon-only buttons have accessible names.\", \"inline-note\")\n ]),\n node(\"pre\", '{ icon: myIcon, ariaLabel: \"Add item\" }', \"sample-code\")\n ])\n);",
5
+ "toggles": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ButtonComponent, IButtonOptions } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst node = (tag: string, content: string, className?: string): IJSLVNode => ({\n tag, content, attr: { class: className }\n});\n\nconst group = (children: Content[], className = \"sample-row\"): IJSLVNode => ({\n tag: \"div\", attr: { class: className }, children\n});\n\nconst button = (options: IButtonOptions) => new ButtonComponent({ type: \"button\", ...options });\n\nconst paths = {\n plus: '<path d=\"M12 5v14M5 12h14\"/>',\n arrow: '<path d=\"M5 12h14m-6-6 6 6-6 6\"/>',\n download: '<path d=\"M12 3v12m-5-5 5 5 5-5M5 16v4h14v-4\"/>',\n refresh: '<path d=\"M20 7v5h-5M4 17v-5h5M6 7a7 7 0 0 1 12-1l2 6M4 12l2 6a7 7 0 0 0 12-1\"/>',\n more: '<circle cx=\"5\" cy=\"12\" r=\"1\"/><circle cx=\"12\" cy=\"12\" r=\"1\"/><circle cx=\"19\" cy=\"12\" r=\"1\"/>',\n bookmark: '<path d=\"M6 3h12v18l-6-4-6 4z\"/>',\n check: '<path d=\"m5 12 4 4L19 6\"/>'\n};\n\nfunction icon(name: keyof typeof paths): IJSLVNode {\n const svg = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"black\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\">' + paths[name] + '</svg>';\n const url = 'url(\"data:image/svg+xml,' + encodeURIComponent(svg) + '\")';\n return { tag: \"span\", attr: { class: \"showcase-icon\", style: \"mask-image:\" + url + \";-webkit-mask-image:\" + url } };\n}\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return {\n tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" },\n children: [\n group([node(\"span\", number, \"sample-number\"), { tag: \"h2\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n node(\"p\", description, \"card-description\"),\n ...children\n ]\n };\n}\n\nconst toggleStatus = node(\"p\", \"No formatting selected.\", \"sample-status\");\n\ntoggleStatus.attr.role = \"status\";\n\nconst formatting: ButtonComponent[] = [];\n\nconst labels = [\"Bold\", \"Italic\", \"Underline\"];\n\nconst updateFormatting = () => {\n const selected = labels.filter((_, index) => formatting[index].pressed);\n toggleStatus.content = selected.length ? \"Selected: \" + selected.join(\", \") + \".\" : \"No formatting selected.\";\n};\n\nlabels.forEach((label, index) => formatting.push(button({\n content: label,\n icon: { tag: \"span\", content: label[0], attr: { class: [\"format-bold\", \"format-italic\", \"format-underline\"][index] } },\n iconOnly: true, outlined: true, title: label, toggle: true, onToggle: updateFormatting\n})));\n\nconst bookmarkStatus = node(\"p\", \"Save this view for later.\", \"sample-status\");\n\nbookmarkStatus.attr.role = \"status\";\n\nconst bookmark = button({\n content: \"Save view\", icon: icon(\"bookmark\"), variant: \"outline\", toggle: true,\n onToggle: pressed => { bookmarkStatus.content = pressed ? \"View saved. Click again to remove it.\" : \"Save this view for later.\"; }\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"toggles\", \"03\", \"Actions that stay selected\", \"Toggle buttons expose their state to assistive technology. Try a few.\", [\n { tag: \"div\", attr: { class: \"sample-row\", role: \"group\", \"aria-label\": \"Text formatting\" }, children: [\n ...formatting,\n node(\"span\", \"\", \"sample-divider\"),\n button({ content: \"Reset\", variant: \"ghost\", click: () => {\n formatting.forEach(item => { item.pressed = false; });\n updateFormatting();\n } })\n ] },\n toggleStatus,\n group([bookmark]), bookmarkStatus,\n node(\"pre\", '{ toggle: true, pressed: false, onToggle: pressed => { … } }', \"sample-code\")\n ])\n);",
6
+ "sizes": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ButtonComponent, IButtonOptions } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst node = (tag: string, content: string, className?: string): IJSLVNode => ({\n tag, content, attr: { class: className }\n});\n\nconst group = (children: Content[], className = \"sample-row\"): IJSLVNode => ({\n tag: \"div\", attr: { class: className }, children\n});\n\nconst button = (options: IButtonOptions) => new ButtonComponent({ type: \"button\", ...options });\n\nconst paths = {\n plus: '<path d=\"M12 5v14M5 12h14\"/>',\n arrow: '<path d=\"M5 12h14m-6-6 6 6-6 6\"/>',\n download: '<path d=\"M12 3v12m-5-5 5 5 5-5M5 16v4h14v-4\"/>',\n refresh: '<path d=\"M20 7v5h-5M4 17v-5h5M6 7a7 7 0 0 1 12-1l2 6M4 12l2 6a7 7 0 0 0 12-1\"/>',\n more: '<circle cx=\"5\" cy=\"12\" r=\"1\"/><circle cx=\"12\" cy=\"12\" r=\"1\"/><circle cx=\"19\" cy=\"12\" r=\"1\"/>',\n bookmark: '<path d=\"M6 3h12v18l-6-4-6 4z\"/>',\n check: '<path d=\"m5 12 4 4L19 6\"/>'\n};\n\nfunction icon(name: keyof typeof paths): IJSLVNode {\n const svg = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"black\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\">' + paths[name] + '</svg>';\n const url = 'url(\"data:image/svg+xml,' + encodeURIComponent(svg) + '\")';\n return { tag: \"span\", attr: { class: \"showcase-icon\", style: \"mask-image:\" + url + \";-webkit-mask-image:\" + url } };\n}\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return {\n tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" },\n children: [\n group([node(\"span\", number, \"sample-number\"), { tag: \"h2\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n node(\"p\", description, \"card-description\"),\n ...children\n ]\n };\n}\n\nconst bookmarkStatus = node(\"p\", \"Save this view for later.\", \"sample-status\");\n\nbookmarkStatus.attr.role = \"status\";\n\nconst bookmark = button({\n content: \"Save view\", icon: icon(\"bookmark\"), variant: \"outline\", toggle: true,\n onToggle: pressed => { bookmarkStatus.content = pressed ? \"View saved. Click again to remove it.\" : \"Save this view for later.\"; }\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"sizes\", \"04\", \"The right amount of space\", \"Compact controls for toolbars, comfortable actions for forms.\", [\n group([\n group([button({ content: \"Small\", icon: icon(\"plus\"), size: \"small\" }), node(\"span\", \"28 px\", \"size-caption\")], \"size-sample\"),\n group([button({ content: \"Medium\", icon: icon(\"plus\") }), node(\"span\", \"32 px · default\", \"size-caption\")], \"size-sample\"),\n group([button({ content: \"Large\", icon: icon(\"plus\"), size: \"large\" }), node(\"span\", \"40 px\", \"size-caption\")], \"size-sample\")\n ], \"sample-row size-row\"),\n group([\n button({ icon: icon(\"plus\"), ariaLabel: \"Small add\", title: \"Small add\", size: \"small\", outlined: true }),\n button({ icon: icon(\"plus\"), ariaLabel: \"Medium add\", title: \"Medium add\", outlined: true }),\n button({ icon: icon(\"plus\"), ariaLabel: \"Large add\", title: \"Large add\", size: \"large\", outlined: true })\n ]),\n node(\"pre\", '{ size: \"small\" | \"medium\" | \"large\" }', \"sample-code\")\n ])\n);",
7
+ "states": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ButtonComponent, IButtonOptions } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst node = (tag: string, content: string, className?: string): IJSLVNode => ({\n tag, content, attr: { class: className }\n});\n\nconst group = (children: Content[], className = \"sample-row\"): IJSLVNode => ({\n tag: \"div\", attr: { class: className }, children\n});\n\nconst button = (options: IButtonOptions) => new ButtonComponent({ type: \"button\", ...options });\n\nconst paths = {\n plus: '<path d=\"M12 5v14M5 12h14\"/>',\n arrow: '<path d=\"M5 12h14m-6-6 6 6-6 6\"/>',\n download: '<path d=\"M12 3v12m-5-5 5 5 5-5M5 16v4h14v-4\"/>',\n refresh: '<path d=\"M20 7v5h-5M4 17v-5h5M6 7a7 7 0 0 1 12-1l2 6M4 12l2 6a7 7 0 0 0 12-1\"/>',\n more: '<circle cx=\"5\" cy=\"12\" r=\"1\"/><circle cx=\"12\" cy=\"12\" r=\"1\"/><circle cx=\"19\" cy=\"12\" r=\"1\"/>',\n bookmark: '<path d=\"M6 3h12v18l-6-4-6 4z\"/>',\n check: '<path d=\"m5 12 4 4L19 6\"/>'\n};\n\nfunction icon(name: keyof typeof paths): IJSLVNode {\n const svg = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"black\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\">' + paths[name] + '</svg>';\n const url = 'url(\"data:image/svg+xml,' + encodeURIComponent(svg) + '\")';\n return { tag: \"span\", attr: { class: \"showcase-icon\", style: \"mask-image:\" + url + \";-webkit-mask-image:\" + url } };\n}\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return {\n tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" },\n children: [\n group([node(\"span\", number, \"sample-number\"), { tag: \"h2\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n node(\"p\", description, \"card-description\"),\n ...children\n ]\n };\n}\n\nconst bookmarkStatus = node(\"p\", \"Save this view for later.\", \"sample-status\");\n\nbookmarkStatus.attr.role = \"status\";\n\nconst bookmark = button({\n content: \"Save view\", icon: icon(\"bookmark\"), variant: \"outline\", toggle: true,\n onToggle: pressed => { bookmarkStatus.content = pressed ? \"View saved. Click again to remove it.\" : \"Save this view for later.\"; }\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"states\", \"05\", \"Every state considered\", \"Native disabled behavior, a visible keyboard focus ring, and pressed states.\", [\n group([\n button({ content: \"Available\" }),\n button({ content: \"Unavailable\", enabled: false }),\n button({ content: \"Unavailable\", outlined: true, enabled: false })\n ]),\n group([\n button({ content: \"Selected\", icon: icon(\"check\"), outlined: true, toggle: true, pressed: true }),\n button({ content: \"Selected\", icon: icon(\"check\"), outlined: true, toggle: true, pressed: true, enabled: false }),\n button({ icon: icon(\"plus\"), ariaLabel: \"Unavailable add\", title: \"Unavailable add\", variant: \"ghost\", enabled: false })\n ]),\n node(\"p\", \"Use Tab to explore keyboard focus. Enter and Space activate a focused button.\", \"inline-note\"),\n node(\"pre\", '{ enabled: false }', \"sample-code\")\n ])\n);",
8
+ "context": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ButtonComponent, IButtonOptions } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst node = (tag: string, content: string, className?: string): IJSLVNode => ({\n tag, content, attr: { class: className }\n});\n\nconst group = (children: Content[], className = \"sample-row\"): IJSLVNode => ({\n tag: \"div\", attr: { class: className }, children\n});\n\nconst button = (options: IButtonOptions) => new ButtonComponent({ type: \"button\", ...options });\n\nconst paths = {\n plus: '<path d=\"M12 5v14M5 12h14\"/>',\n arrow: '<path d=\"M5 12h14m-6-6 6 6-6 6\"/>',\n download: '<path d=\"M12 3v12m-5-5 5 5 5-5M5 16v4h14v-4\"/>',\n refresh: '<path d=\"M20 7v5h-5M4 17v-5h5M6 7a7 7 0 0 1 12-1l2 6M4 12l2 6a7 7 0 0 0 12-1\"/>',\n more: '<circle cx=\"5\" cy=\"12\" r=\"1\"/><circle cx=\"12\" cy=\"12\" r=\"1\"/><circle cx=\"19\" cy=\"12\" r=\"1\"/>',\n bookmark: '<path d=\"M6 3h12v18l-6-4-6 4z\"/>',\n check: '<path d=\"m5 12 4 4L19 6\"/>'\n};\n\nfunction icon(name: keyof typeof paths): IJSLVNode {\n const svg = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"black\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\">' + paths[name] + '</svg>';\n const url = 'url(\"data:image/svg+xml,' + encodeURIComponent(svg) + '\")';\n return { tag: \"span\", attr: { class: \"showcase-icon\", style: \"mask-image:\" + url + \";-webkit-mask-image:\" + url } };\n}\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return {\n tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" },\n children: [\n group([node(\"span\", number, \"sample-number\"), { tag: \"h2\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n node(\"p\", description, \"card-description\"),\n ...children\n ]\n };\n}\n\nconst bookmarkStatus = node(\"p\", \"Save this view for later.\", \"sample-status\");\n\nbookmarkStatus.attr.role = \"status\";\n\nconst bookmark = button({\n content: \"Save view\", icon: icon(\"bookmark\"), variant: \"outline\", toggle: true,\n onToggle: pressed => { bookmarkStatus.content = pressed ? \"View saved. Click again to remove it.\" : \"Save this view for later.\"; }\n});\n\nconst saveStatus = node(\"p\", \"Your changes are ready to save.\", \"context-copy\");\n\nsaveStatus.attr.role = \"status\";\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"context\", \"06\", \"At home in an application\", \"Consistent actions, whether they appear on their own or in a footer.\", [\n group([\n group([node(\"span\", \"PROJECT SETTINGS\", \"context-eyebrow\"), node(\"h3\", \"Keep everything up to date\"), saveStatus], \"context-body\"),\n group([\n button({ content: \"Discard\", outlined: true, click: () => { saveStatus.content = \"Changes discarded.\"; } }),\n button({ content: \"Save changes\", icon: icon(\"check\"), click: () => { saveStatus.content = \"All changes saved.\"; } })\n ], \"context-footer\")\n ], \"context-panel\"),\n node(\"p\", \"The same classes style component buttons, manual buttons, and links.\", \"inline-note\"),\n ...[\"\", \" jsl-button-outline\", \" jsl-button-ghost\"].map(variant => group([\n button({ content: \"View projects\", variant: variant.includes(\"outline\") ? \"outline\" : variant.includes(\"ghost\") ? \"ghost\" : \"solid\" }),\n { tag: \"button\", attr: { type: \"button\", class: \"jsl-button\" + variant }, content: \"View projects\" },\n { tag: \"a\", attr: { href: \"#grids\", class: \"jsl-button\" + variant }, content: \"View projects\" }\n ])),\n node(\"p\", \"Each row shows a ButtonComponent, a manual <button>, and an <a> link.\", \"inline-note\")\n ])\n);",
9
+ "customization": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ButtonComponent, IButtonOptions } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst node = (tag: string, content: string, className?: string): IJSLVNode => ({\n tag, content, attr: { class: className }\n});\n\nconst group = (children: Content[], className = \"sample-row\"): IJSLVNode => ({\n tag: \"div\", attr: { class: className }, children\n});\n\nconst button = (options: IButtonOptions) => new ButtonComponent({ type: \"button\", ...options });\n\nconst paths = {\n plus: '<path d=\"M12 5v14M5 12h14\"/>',\n arrow: '<path d=\"M5 12h14m-6-6 6 6-6 6\"/>',\n download: '<path d=\"M12 3v12m-5-5 5 5 5-5M5 16v4h14v-4\"/>',\n refresh: '<path d=\"M20 7v5h-5M4 17v-5h5M6 7a7 7 0 0 1 12-1l2 6M4 12l2 6a7 7 0 0 0 12-1\"/>',\n more: '<circle cx=\"5\" cy=\"12\" r=\"1\"/><circle cx=\"12\" cy=\"12\" r=\"1\"/><circle cx=\"19\" cy=\"12\" r=\"1\"/>',\n bookmark: '<path d=\"M6 3h12v18l-6-4-6 4z\"/>',\n check: '<path d=\"m5 12 4 4L19 6\"/>'\n};\n\nfunction icon(name: keyof typeof paths): IJSLVNode {\n const svg = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"black\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\">' + paths[name] + '</svg>';\n const url = 'url(\"data:image/svg+xml,' + encodeURIComponent(svg) + '\")';\n return { tag: \"span\", attr: { class: \"showcase-icon\", style: \"mask-image:\" + url + \";-webkit-mask-image:\" + url } };\n}\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return {\n tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" },\n children: [\n group([node(\"span\", number, \"sample-number\"), { tag: \"h2\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n node(\"p\", description, \"card-description\"),\n ...children\n ]\n };\n}\n\nconst bookmarkStatus = node(\"p\", \"Save this view for later.\", \"sample-status\");\n\nbookmarkStatus.attr.role = \"status\";\n\nconst bookmark = button({\n content: \"Save view\", icon: icon(\"bookmark\"), variant: \"outline\", toggle: true,\n onToggle: pressed => { bookmarkStatus.content = pressed ? \"View saved. Click again to remove it.\" : \"Save this view for later.\"; }\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"customization\", \"07\", \"Make it yours\", \"Custom content and application colors still fit the same button API.\", [\n group([\n button({ content: { tag: \"span\", children: [node(\"span\", \"Inbox\"), node(\"span\", \"8\", \"count-badge\")] }, outlined: true }),\n button({ content: \"Publish\", icon: icon(\"arrow\"), iconPosition: \"end\", class: \"brand-teal\" })\n ]),\n node(\"pre\", '.brand-teal {\\n --jsl-button-primary: #0f766e;\\n --jsl-button-on-primary: #fff;\\n --jsl-button-primary-hover: #115e59;\\n --jsl-button-primary-active: #134e4a;\\n --jsl-button-focus: #0f766e;\\n}', \"sample-code\")\n ])\n);",
10
+ "dialogs-basic": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode } from \"jsl-render\";\nimport { DialogComponent } from \"../../components/dialog/DialogComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst actions = (...children: IJSLVNode[]): IJSLVNode => ({ tag: \"div\", children });\n\nconst message = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst launch = (content: string, id: string, click: () => void) => new ButtonComponent({ content, class: id, type: \"button\", outlined: true, click });\n\nconst confirmationStatus = message(\"Choose an action inside the dialog.\");\n\nfunction showConfirmation() {\n DialogComponent.show({\n header: \"Save your changes?\",\n content: { tag: \"div\", attr: { class: \"showcase-dialog-copy\" }, children: [\n text(\"p\", \"Your workspace has been updated. Save your changes to keep everything in sync.\"),\n { tag: \"div\", attr: { class: \"dialog-summary\" }, children: [\n text(\"span\", \"Workspace\", \"dialog-summary-label\"), text(\"strong\", \"Product design\"),\n text(\"span\", \"Changes\", \"dialog-summary-label\"), text(\"span\", \"Settings and permissions\")\n ] }\n ] },\n footer: actions(DialogComponent.Cancel(), DialogComponent.Button({\n content: \"Save changes\", class: \"dlg-ok-btn\",\n onClick: () => { confirmationStatus.content = \"Changes saved.\"; }\n })),\n width: \"29rem\", showCloseButton: true\n });\n}\n\nfunction card(id: string, number: string, title: string, description: string, children: Array<IJSLVNode | ButtonComponent>): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n { tag: \"div\", attr: { class: \"card-heading\" }, children: [text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }] },\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"dialogs-basic\", \"01\", \"Focused decisions\", \"A title, a short explanation, and a clear next step.\", [launch(\"Open confirmation\", \"dialog-launch-basic\", showConfirmation), confirmationStatus])\n);",
11
+ "dialogs-form": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode } from \"jsl-render\";\nimport { DialogComponent } from \"../../components/dialog/DialogComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst actions = (...children: IJSLVNode[]): IJSLVNode => ({ tag: \"div\", children });\n\nconst message = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst launch = (content: string, id: string, click: () => void) => new ButtonComponent({ content, class: id, type: \"button\", outlined: true, click });\n\nconst formStatus = message(\"Create a project without leaving the page.\");\n\nfunction showForm() {\n const nameId = \"showcase-project-name\";\n const formId = \"showcase-project-form\";\n DialogComponent.show({\n header: \"Create a project\",\n content: { tag: \"form\", attr: { id: formId, class: \"showcase-dialog-copy\", submit: (event: Event) => event.preventDefault() }, children: [\n text(\"p\", \"Give your team a place to organize its next idea.\"),\n { tag: \"div\", attr: { class: \"dialog-form-field\" }, children: [\n { tag: \"label\", content: \"Project name\", attr: { for: nameId } },\n { tag: \"input\", attr: { id: nameId, name: \"name\", type: \"text\", required: \"required\", placeholder: \"e.g. Website refresh\", maxlength: 80 } }\n ] },\n { tag: \"div\", attr: { class: \"dialog-form-field\" }, children: [\n { tag: \"label\", content: \"Description (optional)\", attr: { for: \"showcase-project-notes\" } },\n { tag: \"textarea\", attr: { id: \"showcase-project-notes\", name: \"notes\", rows: 3, placeholder: \"What are you working on?\" } }\n ] }\n ] },\n footer: actions(DialogComponent.Cancel(), DialogComponent.Button({\n content: \"Create project\", class: \"dlg-ok-btn\", onClick: () => {\n const form = document.getElementById(formId) as HTMLFormElement;\n const name = document.getElementById(nameId) as HTMLInputElement;\n if (!form.reportValidity() || !name.value.trim()) {\n return false;\n }\n formStatus.content = 'Project \"' + name.value.trim() + '\" created.';\n }\n })),\n showCloseButton: true, autoFocus: \"#\" + nameId, OkOnEnter: true\n });\n}\n\nfunction card(id: string, number: string, title: string, description: string, children: Array<IJSLVNode | ButtonComponent>): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n { tag: \"div\", attr: { class: \"card-heading\" }, children: [text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }] },\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"dialogs-form\", \"02\", \"Collect a little more\", \"Autofocus, native validation, and Enter to confirm. Textareas keep their line breaks.\", [launch(\"Open project form\", \"dialog-launch-form\", showForm), formStatus])\n);",
12
+ "dialogs-scroll": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode } from \"jsl-render\";\nimport { DialogComponent } from \"../../components/dialog/DialogComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst actions = (...children: IJSLVNode[]): IJSLVNode => ({ tag: \"div\", children });\n\nconst launch = (content: string, id: string, click: () => void) => new ButtonComponent({ content, class: id, type: \"button\", outlined: true, click });\n\nfunction showLongContent() {\n DialogComponent.show({\n header: \"Workspace access\",\n content: { tag: \"div\", attr: { class: \"showcase-dialog-copy\" }, children: [\n text(\"p\", \"Review who can access this workspace. The actions stay in view while this list scrolls.\"),\n ...Array.from({ length: 18 }, (_, index): IJSLVNode => ({\n tag: \"div\", attr: { class: \"dialog-member\" }, children: [\n text(\"span\", (\"0\" + (index + 1)).slice(-2), \"dialog-member-avatar\"),\n { tag: \"div\", children: [text(\"strong\", \"Team member \" + (index + 1)), text(\"span\", \"member\" + (index + 1) + \"@example.com\")] },\n text(\"span\", index === 0 ? \"Owner\" : \"Member\", \"dialog-member-role\")\n ]\n }))\n ] },\n footer: actions(DialogComponent.Button({ content: \"Done\", class: \"dlg-ok-btn\" })),\n width: \"36rem\", height: \"22rem\", showCloseButton: true\n });\n}\n\nfunction card(id: string, number: string, title: string, description: string, children: Array<IJSLVNode | ButtonComponent>): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n { tag: \"div\", attr: { class: \"card-heading\" }, children: [text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }] },\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"dialogs-scroll\", \"03\", \"Room for more\", \"Long content scrolls within the dialog while the title and actions stay visible.\", [launch(\"Open long content\", \"dialog-launch-scroll\", showLongContent)])\n);",
13
+ "dialogs-resize": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode } from \"jsl-render\";\nimport { DialogComponent } from \"../../components/dialog/DialogComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst actions = (...children: IJSLVNode[]): IJSLVNode => ({ tag: \"div\", children });\n\nconst launch = (content: string, id: string, click: () => void) => new ButtonComponent({ content, class: id, type: \"button\", outlined: true, click });\n\nfunction showWorkspace(modal = true) {\n DialogComponent.show({\n header: \"Workspace details\",\n content: { tag: \"div\", attr: { class: \"showcase-dialog-copy\" }, children: [\n text(\"p\", \"Drag the title bar to move this dialog. Use the handle in the bottom-right corner to resize it.\"),\n { tag: \"div\", attr: { class: \"dialog-summary\" }, children: [\n text(\"span\", \"Workspace\", \"dialog-summary-label\"), text(\"strong\", \"Product design\"),\n text(\"span\", \"Visibility\", \"dialog-summary-label\"), text(\"span\", \"Private\"),\n text(\"span\", \"Members\", \"dialog-summary-label\"), text(\"span\", \"18 people\")\n ] },\n text(\"p\", modal ? \"The background stays still while you work.\" : \"This is a non-modal dialog. You can still use the showcase and change its theme.\", \"dialog-help\")\n ] },\n footer: actions(DialogComponent.Button({ content: \"Done\" })),\n width: \"36rem\", height: \"15rem\", showCloseButton: true,\n allowMove: true, allowResize: true, modal,\n resizeOptions: { minWidth: 280, minHeight: 240, maxWidth: 960, maxHeight: 760 }\n });\n}\n\nfunction card(id: string, number: string, title: string, description: string, children: Array<IJSLVNode | ButtonComponent>): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n { tag: \"div\", attr: { class: \"card-heading\" }, children: [text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }] },\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"dialogs-resize\", \"04\", \"Make room\", \"Move and resize a dialog, or keep the page interactive with a non-modal version.\", [\n { tag: \"div\", attr: { class: \"sample-row\" }, children: [launch(\"Move & resize\", \"dialog-launch-resize\", () => showWorkspace()), launch(\"Non-modal\", \"dialog-launch-nonmodal\", () => showWorkspace(false))] }\n ])\n);",
14
+ "dialogs-nested": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode } from \"jsl-render\";\nimport { DialogComponent } from \"../../components/dialog/DialogComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst actions = (...children: IJSLVNode[]): IJSLVNode => ({ tag: \"div\", children });\n\nconst message = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst launch = (content: string, id: string, click: () => void) => new ButtonComponent({ content, class: id, type: \"button\", outlined: true, click });\n\nconst nestedStatus = message(\"Open a second dialog from the first.\");\n\nfunction showNested() {\n DialogComponent.show({\n header: \"Manage workspace\",\n content: { tag: \"div\", attr: { class: \"showcase-dialog-copy\" }, children: [\n text(\"p\", \"Review a permission before making changes. Closing the second dialog returns you here.\"),\n new ButtonComponent({ content: \"Review permissions\", outlined: true, type: \"button\", class: \"dialog-open-nested\", click: () => {\n DialogComponent.show({\n header: \"Confirm access\",\n content: \"Allow team members to invite others to this workspace?\",\n footer: actions(DialogComponent.Cancel(), DialogComponent.Ok(() => { nestedStatus.content = \"Permission confirmed.\"; })),\n width: \"27rem\", showCloseButton: true\n });\n } })\n ] },\n footer: actions(DialogComponent.Cancel(), DialogComponent.Button({ content: \"Done\" })),\n width: \"30rem\", showCloseButton: true\n });\n}\n\nfunction card(id: string, number: string, title: string, description: string, children: Array<IJSLVNode | ButtonComponent>): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n { tag: \"div\", attr: { class: \"card-heading\" }, children: [text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }] },\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"dialogs-nested\", \"05\", \"One decision at a time\", \"Nested dialogs keep keyboard focus and Escape scoped to the active dialog.\", [launch(\"Open nested dialogs\", \"dialog-launch-nested\", showNested), nestedStatus])\n);",
15
+ "dialogs-async": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode } from \"jsl-render\";\nimport { DialogComponent } from \"../../components/dialog/DialogComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst actions = (...children: IJSLVNode[]): IJSLVNode => ({ tag: \"div\", children });\n\nconst message = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst launch = (content: string, id: string, click: () => void) => new ButtonComponent({ content, class: id, type: \"button\", outlined: true, click });\n\nconst asyncStatus = message(\"Try saving, or simulate a failed save.\");\n\nfunction showAsync() {\n const notice = message(\"Your changes are ready to save.\");\n DialogComponent.show({\n header: \"Save workspace\",\n content: { tag: \"div\", attr: { class: \"showcase-dialog-copy\" }, children: [\n text(\"p\", \"The save action waits for the result before closing. A failed save keeps the dialog open so you can try again.\"),\n { tag: \"label\", attr: { class: \"dialog-check\" }, children: [\n { tag: \"input\", attr: { id: \"showcase-failed-save\", type: \"checkbox\" } }, text(\"span\", \"Simulate a failed save\")\n ] }, notice\n ] },\n footer: actions(DialogComponent.Cancel(), DialogComponent.Button({\n content: \"Save changes\", class: \"dlg-ok-btn\", onClick: async () => {\n const fail = (document.getElementById(\"showcase-failed-save\") as HTMLInputElement).checked;\n notice.content = \"Saving changes...\";\n await new Promise(resolve => setTimeout(resolve, 750));\n if (fail) {\n notice.content = \"Could not save. Uncheck the option and try again.\";\n return false;\n }\n asyncStatus.content = \"Workspace saved successfully.\";\n }\n })),\n showCloseButton: true, closeOnOverlayClick: false\n });\n}\n\nfunction card(id: string, number: string, title: string, description: string, children: Array<IJSLVNode | ButtonComponent>): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n { tag: \"div\", attr: { class: \"card-heading\" }, children: [text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }] },\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"dialogs-async\", \"06\", \"Wait for the result\", \"Async actions prevent duplicate submissions. Return false to keep the dialog open.\", [launch(\"Try async save\", \"dialog-launch-async\", showAsync), asyncStatus])\n);",
16
+ "tabs-basic": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { TabsComponent } from \"../../components/tabs/TabsComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst copy = (title: string, content: string) => group([text(\"h4\", title), text(\"p\", content)], \"tabs-example-copy\");\n\nconst basicStatus = status(\"Overview is selected.\");\n\nconst basicNames = [\"Overview\", \"Activity\", \"Settings\"];\n\nconst basic = new TabsComponent({\n ariaLabel: \"Project views\",\n tabs: [\n { header: \"Overview\", content: copy(\"Everything in one place\", \"A clear view of your project, its progress, and what needs your attention.\") },\n { header: \"Activity\", content: copy(\"The latest updates\", \"Your team created a project, shared a draft, and reviewed the next release.\") },\n { header: \"Settings\", content: copy(\"Make it your own\", \"Manage project preferences, access, and notifications from a single view.\") }\n ],\n onSelect: index => { basicStatus.content = basicNames[index] + \" is selected.\"; }\n});\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n group([text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"tabs-basic\", \"01\", \"One view at a time\", \"An understated active indicator, comfortable labels, and linked content panels.\", [basic, basicStatus])\n);",
17
+ "tabs-preserved": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { TabsComponent } from \"../../components/tabs/TabsComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst copy = (title: string, content: string) => group([text(\"h4\", title), text(\"p\", content)], \"tabs-example-copy\");\n\nconst preserved = new TabsComponent({\n ariaLabel: \"Preserved project draft\", preserveContent: true,\n tabs: [\n { header: \"Draft\", content: group([\n { tag: \"label\", content: \"Project name\", attr: { for: \"tabs-project-draft\" } },\n { tag: \"input\", attr: { id: \"tabs-project-draft\", class: \"tabs-draft-input\", type: \"text\", placeholder: \"Type something, then switch tabs\" } },\n text(\"p\", \"Your unfinished work stays exactly where you left it.\")\n ], \"tabs-example-copy\") },\n { header: \"Preview\", content: copy(\"Your draft is still there\", \"Switch back to Draft. The input keeps its value and its DOM element.\") }\n ]\n});\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n group([text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"tabs-preserved\", \"02\", \"Keep your work\", \"Preserved panels keep draft input and component state when you switch views.\", [preserved, text(\"pre\", \"{ preserveContent: true }\", \"sample-code\")])\n);",
18
+ "tabs-lazy": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { TabsComponent, ITabItemOption } from \"../../components/tabs/TabsComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst copy = (title: string, content: string) => group([text(\"h4\", title), text(\"p\", content)], \"tabs-example-copy\");\n\nconst lazyStatus = status(\"No detail panels have been created yet.\");\n\nlet createdPanels = 0;\n\nconst lazyTab = (header: string): ITabItemOption => ({\n header,\n onCreate: () => {\n createdPanels++;\n lazyStatus.content = createdPanels + (createdPanels === 1 ? \" detail panel created.\" : \" detail panels created.\");\n return copy(header, \"This content was created on the first visit. Revisit this tab and the creation count stays the same.\");\n }\n});\n\nconst lazy = new TabsComponent({\n ariaLabel: \"Lazy project details\", preserveContent: true,\n tabs: [\n { header: \"Summary\", content: copy(\"Ready when you are\", \"Details are created only when you select their tab. Try Reports or History.\") },\n lazyTab(\"Reports\"), lazyTab(\"History\")\n ]\n});\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n group([text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"tabs-lazy\", \"03\", \"Create only when needed\", \"Load content on its first selection, then keep the result for future visits.\", [lazy, lazyStatus])\n);",
19
+ "tabs-documents": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { TabsComponent } from \"../../components/tabs/TabsComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, type: \"button\", outlined: true, size: \"small\", click });\n\nconst copy = (title: string, content: string) => group([text(\"h4\", title), text(\"p\", content)], \"tabs-example-copy\");\n\nconst documentStatus = status(\"Add a draft, close one, or try closing the protected tab.\");\n\nlet allowProtectedClose = false;\n\nlet nextDocument = 2;\n\nconst documents = new TabsComponent({\n ariaLabel: \"Open documents\", preserveContent: true,\n tabs: [\n { header: \"Overview\", content: copy(\"Your workspace\", \"Keep a few documents open while you work.\") },\n { id: \"showcase-tabs-draft-1\", header: \"Draft 1\", canClose: true, content: copy(\"Draft 1\", \"A document that can be closed and replaced with another.\") },\n { id: \"showcase-tabs-protected\", header: \"Protected\", canClose: true,\n content: copy(\"A little protection\", \"Allow this tab to close using the checkbox below, or keep it open with onClosing.\"),\n onClosing: () => {\n if (!allowProtectedClose) {\n documentStatus.content = \"The protected tab is still open. Allow closing it using the checkbox.\";\n return false;\n }\n return true;\n }\n }\n ],\n onSelect: index => { documentStatus.content = index < 0 ? \"No document selected.\" : \"Selected tab \" + (index + 1) + \".\"; }\n});\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n group([text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"tabs-documents\", \"04\", \"Tabs that come and go\", \"Add and close documents. Use Delete on a closable tab, or its close button.\", [\n documents,\n group([action(\"Add draft\", () => {\n const number = nextDocument++;\n const index = documents.AddTab({ header: \"Draft \" + number, canClose: true, content: copy(\"Draft \" + number, \"A new document, ready for your next idea.\") });\n documents.SetSelectedTab(index);\n documentStatus.content = \"Draft \" + number + \" added.\";\n })], \"sample-row\"),\n { tag: \"label\", attr: { class: \"tabs-example-check\" }, children: [\n { tag: \"input\", attr: { type: \"checkbox\", id: \"tabs-allow-close\", change: (event: Event) => { allowProtectedClose = (event.target as HTMLInputElement).checked; } } },\n text(\"span\", \"Allow closing the protected tab\")\n ] }, documentStatus\n ])\n);",
20
+ "tabs-disabled": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { TabsComponent } from \"../../components/tabs/TabsComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, type: \"button\", outlined: true, size: \"small\", click });\n\nconst copy = (title: string, content: string) => group([text(\"h4\", title), text(\"p\", content)], \"tabs-example-copy\");\n\nconst disabledStatus = status(\"Audit is unavailable. Keyboard navigation skips it.\");\n\nconst disabled = new TabsComponent({\n ariaLabel: \"Workspace sections\",\n tabs: [\n { header: \"Workspace\", content: copy(\"Choose where to work\", \"Tabs can remain visible while an action or section is unavailable.\") },\n { header: \"Audit\", enabled: false, content: copy(\"Audit trail\", \"This section is now enabled and ready to use.\") },\n { header: \"Team\", content: copy(\"Work together\", \"Arrow keys move between available tabs, skipping disabled ones.\") }\n ]\n});\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n group([text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"tabs-disabled\", \"05\", \"Available when you need it\", \"Disabled tabs stay visible and are skipped by pointer and keyboard activation.\", [\n disabled,\n group([\n action(\"Enable all\", () => { disabled.EnableAll(); disabledStatus.content = \"All sections are available.\"; }),\n action(\"Disable all\", () => { disabled.DisableAll(); disabledStatus.content = \"All sections are disabled. Current content stays visible.\"; })\n ], \"sample-row\"), disabledStatus\n ])\n);",
21
+ "tabs-overflow": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { TabsComponent } from \"../../components/tabs/TabsComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst copy = (title: string, content: string) => group([text(\"h4\", title), text(\"p\", content)], \"tabs-example-copy\");\n\nconst overflow = new TabsComponent({\n ariaLabel: \"Workspace information\", maxHeight: \"10rem\",\n tabs: [\n { header: \"Overview\", content: copy(\"A place for every view\", \"When space gets tight, the header scrolls horizontally. Focused tabs stay in view.\") },\n { header: group([text(\"span\", \"Release notes\"), { tag: \"span\", content: \"3\", attr: { class: \"tabs-header-badge\", \"aria-hidden\": \"true\" } }], \"tabs-rich-header\"),\n ariaLabel: \"Release notes, 3 updates\",\n content: group(Array.from({ length: 8 }, (_, index) => text(\"p\", \"Release \" + (index + 1) + \": improvements to everyday work and collaboration.\")), \"tabs-example-copy\") },\n { header: \"Deployment history\", content: copy(\"Recent deployments\", \"The latest deployment completed successfully.\") },\n { header: \"Team permissions\", content: copy(\"Who can do what\", \"Keep access and responsibilities clear across the workspace.\") },\n { header: \"Integrations\", content: copy(\"Connected tools\", \"Connect your team's existing tools to its daily workflow.\") },\n { header: \"Audit log\", content: copy(\"A record of changes\", \"Track what changed, when it changed, and who made the update.\") }\n ]\n});\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n group([text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"tabs-overflow\", \"06\", \"Labels with room to grow\", \"Rich headers and long lists fit a scrolling tab bar. Content height can be limited independently.\", [overflow, text(\"pre\", '{ maxHeight: \"10rem\" }', \"sample-code\")])\n);",
22
+ "slider-single": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode, JSLRender } from \"jsl-render\";\nimport { SliderComponent, ISliderValue } from \"../../components/slider/SliderComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string) => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst sliderValueText = (value: ISliderValue, suffix = \"%\") =>\n (Array.isArray(value) ? value : [value]).map(part => Math.round(part) + suffix).join(\" - \");\n\nconst sliderChange = (target: IJSLVNode, prefix = \"Current value: \", suffix = \"%\") => (value: ISliderValue) => {\n target.content = prefix + sliderValueText(value, suffix);\n JSLRender.lastCreatedRenderer?.refresh();\n};\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst sliderSingleStatus = status(\"Current value: 45%\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"slider-single\", \"01\", \"A single value\", \"Click the track, drag the handle, or use the arrow keys. Home and End reach the limits.\", [\n group([new SliderComponent({\n start: 45, range: { min: 0, max: 100 }, step: 5, tooltips: true,\n ariaLabel: \"Notification volume\", class: \"showcase-slider\",\n onChange: sliderChange(sliderSingleStatus)\n }), sliderSingleStatus], \"slider-sample slider-with-tooltip\")\n ])\n);",
23
+ "slider-range": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode, JSLRender } from \"jsl-render\";\nimport { SliderComponent, ISliderValue } from \"../../components/slider/SliderComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string) => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst sliderValueText = (value: ISliderValue, suffix = \"%\") =>\n (Array.isArray(value) ? value : [value]).map(part => Math.round(part) + suffix).join(\" - \");\n\nconst sliderChange = (target: IJSLVNode, prefix = \"Current value: \", suffix = \"%\") => (value: ISliderValue) => {\n target.content = prefix + sliderValueText(value, suffix);\n JSLRender.lastCreatedRenderer?.refresh();\n};\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst sliderRangeStatus = status(\"Selected budget: $25 - $70\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"slider-range\", \"02\", \"Ranges and formatting\", \"Connect the handles and format their tooltips while values stay numeric in callbacks.\", [\n new SliderComponent({\n start: [25, 70], range: { min: 0, max: 100 }, connect: true, step: 5,\n tooltips: [{ to: value => \"$\" + Math.round(value) }, { to: value => \"$\" + Math.round(value) }],\n ariaLabel: [\"Minimum budget\", \"Maximum budget\"], class: \"showcase-slider\",\n onChange: sliderChange(sliderRangeStatus, \"Selected budget: \", \"\")\n }), sliderRangeStatus\n ])\n);",
24
+ "slider-states": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { SliderComponent } from \"../../components/slider/SliderComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"slider-states\", \"03\", \"Different directions\", \"Vertical orientation and disabled state are available through component options.\", [\n group([new SliderComponent({\n start: 65, range: { min: 0, max: 100 }, orientation: \"vertical\", direction: \"rtl\",\n ariaLabel: \"Vertical value\", class: \"showcase-slider-vertical\"\n }), group([text(\"p\", \"Unavailable range\", \"inline-note\"), new SliderComponent({\n start: [20, 80], range: { min: 0, max: 100 }, connect: true, enabled: false,\n ariaLabel: [\"Unavailable minimum\", \"Unavailable maximum\"], class: \"showcase-slider\"\n })], \"slider-disabled-example\")\n ], \"slider-orientations\")\n ])\n);",
25
+ "date-basic": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { DateComponent } from \"../../components/date/DateComponent\";\nimport { date } from \"../../core/date\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string) => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst format = (value: Date) => value ? date.format(value) : \"No date selected\";\n\nconst day = (n: number, hours = 9, minutes = 30, seconds = 0) => new Date(2026, 9, n, hours, minutes, seconds);\n\nconst field = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"date-showcase-field\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst dateStatus = status(\"Choose a day or enter a date.\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"date-basic\", \"01\", \"A date, simply\", \"Focus the field to open the calendar. Arrow Down moves into it; Escape returns to the field.\", [\n field(\"showcase-date-basic\", \"Due date\", new DateComponent({ id: \"showcase-date-basic\", value: day(15), onChange: value => { dateStatus.content = format(value); } })),\n dateStatus,\n field(\"showcase-date-disabled\", \"Unavailable date\", new DateComponent({ id: \"showcase-date-disabled\", value: day(20), enabled: false }))\n ])\n);",
26
+ "date-custom": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { DateComponent } from \"../../components/date/DateComponent\";\nimport { date } from \"../../core/date\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string) => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst format = (value: Date) => value ? date.format(value) : \"No date selected\";\n\nconst day = (n: number, hours = 9, minutes = 30, seconds = 0) => new Date(2026, 9, n, hours, minutes, seconds);\n\nconst field = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"date-showcase-field\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst customStatus = status(\"Uses day/month/year formatting.\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"date-custom\", \"02\", \"Your format, your availability\", \"A custom formatter and parser, with October weekdays available for selection.\", [\n field(\"showcase-date-custom\", \"Appointment date (DD/MM/YYYY)\", new DateComponent({\n id: \"showcase-date-custom\", value: day(19), min: day(1), max: day(31),\n format: value => date.format(value, \"dd/mm/yy\"),\n parse: value => date.parse(value, \"dd/mm/yy\"),\n inRange: value => value.getDay() !== 0 && value.getDay() !== 6,\n onChange: value => { customStatus.content = value ? date.format(value, \"dd/mm/yy\") : \"No date selected\"; }\n })), customStatus,\n text(\"p\", \"Invalid or unavailable dates stay in the field for correction and do not raise onChange.\", \"inline-note\")\n ])\n);",
27
+ "range-basic": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { DateRangeComponent } from \"../../components/date-range/DateRangeComponent\";\nimport { date } from \"../../core/date\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string) => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst format = (value: Date) => value ? date.format(value) : \"No date selected\";\n\nconst day = (n: number, hours = 9, minutes = 30, seconds = 0) => new Date(2026, 9, n, hours, minutes, seconds);\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst rangeStatus = status(\"October 8 – October 22, 2026\");\n\nconst mainRange = new DateRangeComponent({\n min: day(1), max: day(31), minValue: day(8), maxValue: day(22), increment: \"days\",\n onChange: value => { rangeStatus.content = format(value.minValue) + \" – \" + format(value.maxValue); }\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"range-basic\", \"01\", \"Choose a window\", \"The fields and slider stay in sync. Endpoints stay ordered and within the available dates.\", [mainRange, rangeStatus])\n);",
28
+ "range-disabled": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { DateRangeComponent } from \"../../components/date-range/DateRangeComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst day = (n: number, hours = 9, minutes = 30, seconds = 0) => new Date(2026, 9, n, hours, minutes, seconds);\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"range-disabled\", \"02\", \"Fixed and unavailable\", \"Disabled inputs and handles preserve a range. A single available day is supported too.\", [\n new DateRangeComponent({ min: day(1), max: day(31), minValue: day(8), maxValue: day(22), increment: \"days\", enabled: false }),\n text(\"p\", \"One available day\", \"inline-note\"),\n new DateRangeComponent({ min: day(15), max: day(15), increment: \"days\", ariaLabel: \"Single available day\" })\n ])\n);",
29
+ "datetime-basic": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { DateTimeComponent } from \"../../components/date-time/DateTimeComponent\";\nimport { date } from \"../../core/date\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string) => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst format = (value: Date) => value ? date.format(value) : \"No date selected\";\n\nconst day = (n: number, hours = 9, minutes = 30, seconds = 0) => new Date(2026, 9, n, hours, minutes, seconds);\n\nconst field = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"date-showcase-field\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst timeStatus = status(\"Pick a date and enter a time.\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"datetime-basic\", \"01\", \"Plan a precise moment\", \"Use hours and minutes, or include seconds when the details matter.\", [\n field(\"showcase-datetime-seconds\", \"Scheduled start\", new DateTimeComponent({\n id: \"showcase-datetime-seconds\", inputMode: \"HourMinuteSecond\", value: day(15, 9, 30, 15),\n onChange: value => { timeStatus.content = value ? format(value) + \" at \" + date.formatTime(value, \"HourMinuteSecond\") : \"No complete date and time\"; }\n })), timeStatus,\n field(\"showcase-datetime-disabled\", \"Unavailable schedule\", new DateTimeComponent({ id: \"showcase-datetime-disabled\", value: day(15), enabled: false }))\n ])\n);",
30
+ "datetime-dialog": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { DateTimeComponent } from \"../../components/date-time/DateTimeComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { DialogComponent } from \"../../components/dialog/DialogComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst day = (n: number, hours = 9, minutes = 30, seconds = 0) => new Date(2026, 9, n, hours, minutes, seconds);\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: \"button\", outlined: true, size: \"small\" });\n\nconst field = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"date-showcase-field\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"datetime-dialog\", \"02\", \"Schedule in context\", \"The date picker stays within its dialog while you choose a time.\", [\n action(\"Open scheduler\", () => {\n DialogComponent.show({\n header: \"Schedule an appointment\", width: \"28rem\",\n content: group([\n text(\"p\", \"Choose a date and time. Escape closes the calendar first.\", \"card-description\"),\n field(\"showcase-dialog-date\", \"Appointment\", new DateTimeComponent({ id: \"showcase-dialog-date\", value: day(21, 14, 45) }))\n ]), footer: group([DialogComponent.Cancel(), DialogComponent.Ok()], \"sample-row\")\n });\n }), text(\"p\", \"Date and time binding modes are shown together in the Data binding section.\", \"inline-note\")\n ])\n);",
31
+ "select-single": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { SelectComponent } from \"../../components/select/SelectComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst field = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"select-showcase-field\");\n\nconst projects = [\n { value: \"website\", text: \"Website refresh\" }, { value: \"library\", text: \"Component library\" },\n { value: \"workspace\", text: \"Team workspace\" }, { value: \"mobile\", text: \"Mobile experience\" },\n { value: \"research\", text: \"Customer research\" }, { value: \"release\", text: \"Autumn release\" }\n];\n\nconst singleStatus = status(\"No project selected.\");\n\nconst single = new SelectComponent({\n id: \"select-project\", data: projects, placeholder: \"Choose a project\", ariaLabel: \"Project\",\n onChange: (value, item) => { singleStatus.content = item ? \"Selected: \" + item.text + \" (\" + value + \")\" : \"Selection cleared.\"; }\n});\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"select-single\", \"01\", \"A single choice\", \"A searchable list with a clear selection. Choose a project, then clear it to start again.\", [\n field(\"select-project\", \"Project\", single), singleStatus,\n text(\"pre\", '{ data: projects, placeholder: \"Choose a project\" }', \"sample-code\")\n ])\n);",
32
+ "select-multiple": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { SelectComponent } from \"../../components/select/SelectComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst field = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"select-showcase-field\");\n\nconst skills = [\n { value: \"design\", text: \"Design\" }, { value: \"typescript\", text: \"TypeScript\" },\n { value: \"accessibility\", text: \"Accessibility\" }, { value: \"testing\", text: \"Testing\" },\n { value: \"research\", text: \"Research\" }, { value: \"documentation\", text: \"Documentation\" }\n];\n\nconst multiStatus = status(\"2 skills selected.\");\n\nconst multi = new SelectComponent({\n id: \"select-skills\", data: skills, multiple: true, value: [\"design\", \"typescript\"],\n placeholder: \"Add skills\", ariaLabel: \"Skills\",\n onChange: (values, items) => {\n const names = (items as unknown as typeof skills).map(item => item.text);\n multiStatus.content = values.length ? values.length + \" selected: \" + names.join(\", \") : \"No skills selected.\";\n }\n});\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"select-multiple\", \"02\", \"A collection of choices\", \"Selected items become compact chips. Toggle checked options while keeping the list open.\", [\n field(\"select-skills\", \"Skills\", multi), multiStatus,\n text(\"p\", \"Enter toggles the focused option. Escape finishes and returns focus to the field.\", \"inline-note\"),\n text(\"pre\", '{ multiple: true, value: [\"design\", \"typescript\"] }', \"sample-code\")\n ])\n);",
33
+ "select-grouped": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { SelectComponent } from \"../../components/select/SelectComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { DialogComponent } from \"../../components/dialog/DialogComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst field = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"select-showcase-field\");\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: \"button\", outlined: true, size: \"small\" });\n\nconst projects = [\n { value: \"website\", text: \"Website refresh\" }, { value: \"library\", text: \"Component library\" },\n { value: \"workspace\", text: \"Team workspace\" }, { value: \"mobile\", text: \"Mobile experience\" },\n { value: \"research\", text: \"Customer research\" }, { value: \"release\", text: \"Autumn release\" }\n];\n\nconst locations = [\n { value: \"vienna\", text: \"Vienna\", region: \"Europe\" }, { value: \"berlin\", text: \"Berlin\", region: \"Europe\" },\n { value: \"copenhagen\", text: \"Copenhagen\", region: \"Europe\" }, { value: \"tokyo\", text: \"Tokyo\", region: \"Asia Pacific\" },\n { value: \"singapore\", text: \"Singapore\", region: \"Asia Pacific\" }, { value: \"sydney\", text: \"Sydney\", region: \"Asia Pacific\" },\n { value: \"new-york\", text: \"New York\", region: \"Americas\" }, { value: \"toronto\", text: \"Toronto\", region: \"Americas\" }\n];\n\nconst groupStatus = status(\"Choose one or more offices.\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"select-grouped\", \"03\", \"Options with context\", \"Group related options. Search filters the items and preserves their headings.\", [\n field(\"select-offices\", \"Offices\", new SelectComponent({\n id: \"select-offices\", data: locations, groupProperty: \"region\", multiple: true,\n ariaLabel: \"Offices\", placeholder: \"Choose offices\",\n onChange: values => { groupStatus.content = values.length ? values.length + \" offices selected.\" : \"Choose one or more offices.\"; }\n })), groupStatus,\n action(\"Try inside a dialog\", () => {\n DialogComponent.show({\n header: \"Choose a project\", width: \"28rem\",\n content: group([\n text(\"p\", \"Select a project. Escape closes the options first.\", \"card-description\"),\n field(\"select-dialog-project\", \"Project\", new SelectComponent({\n id: \"select-dialog-project\", data: projects, ariaLabel: \"Dialog project\", placeholder: \"Choose a project\"\n }))\n ]),\n footer: group([DialogComponent.Cancel(), DialogComponent.Ok()], \"sample-row\")\n });\n })\n ])\n);",
34
+ "select-custom": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { SelectComponent } from \"../../components/select/SelectComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst field = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"select-showcase-field\");\n\nconst people = [\n { value: \"maya\", text: \"Maya Chen\", initials: \"MC\", role: \"Product designer\" },\n { value: \"alex\", text: \"Alex Morgan\", initials: \"AM\", role: \"Frontend engineer\" },\n { value: \"sam\", text: \"Sam Rivera\", initials: \"SR\", role: \"Accessibility specialist\" },\n { value: \"jules\", text: \"Jules Martin\", initials: \"JM\", role: \"Product manager\" }\n];\n\nconst memberStatus = status(\"Selected Maya Chen.\");\n\nconst member = new SelectComponent({\n id: \"select-owner\", data: people, value: \"maya\",\n ariaLabel: \"Project owner\", placeholder: \"Assign an owner\", rowHeight: 56,\n matchSearch: (item, term) => (item.text + \" \" + item.role).toLowerCase().includes(term.toLowerCase()),\n onRender: args => args.isCurrent ? text(\"span\", args.data.text) : group([\n { tag: \"span\", content: args.data.initials, attr: { class: \"select-person-avatar\", \"aria-hidden\": \"true\" } },\n group([text(\"strong\", args.data.text), text(\"span\", args.data.role)], \"select-person-copy\")\n ], \"select-person\"),\n onChange: (_value, item) => { memberStatus.content = item ? \"Selected \" + item.text + \".\" : \"No owner selected.\"; }\n});\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"select-custom\", \"04\", \"More than a label\", \"Custom rows add useful details about each person.\", [\n field(\"select-owner\", \"Project owner\", member), memberStatus,\n text(\"p\", \"Search also matches each person's role.\", \"inline-note\")\n ])\n);",
35
+ "select-states": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { SelectComponent } from \"../../components/select/SelectComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst field = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"select-showcase-field\");\n\nconst projects = [\n { value: \"website\", text: \"Website refresh\" }, { value: \"library\", text: \"Component library\" },\n { value: \"workspace\", text: \"Team workspace\" }, { value: \"mobile\", text: \"Mobile experience\" },\n { value: \"research\", text: \"Customer research\" }, { value: \"release\", text: \"Autumn release\" }\n];\n\nconst skills = [\n { value: \"design\", text: \"Design\" }, { value: \"typescript\", text: \"TypeScript\" },\n { value: \"accessibility\", text: \"Accessibility\" }, { value: \"testing\", text: \"Testing\" },\n { value: \"research\", text: \"Research\" }, { value: \"documentation\", text: \"Documentation\" }\n];\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"select-states\", \"05\", \"The right level of choice\", \"Search can be omitted for short lists. Required selections and disabled controls share the same design.\", [\n field(\"select-required\", \"Default project\", new SelectComponent({\n id: \"select-required\", data: projects.slice(0, 3), value: \"library\", ariaLabel: \"Default project\",\n enableSearch: false, allowEmpty: false\n })),\n field(\"select-disabled\", \"Unavailable project\", new SelectComponent({\n id: \"select-disabled\", data: projects, value: \"website\", enabled: false, ariaLabel: \"Unavailable project\"\n })),\n field(\"select-disabled-multi\", \"Unavailable skills\", new SelectComponent({\n id: \"select-disabled-multi\", data: skills, multiple: true, value: [\"design\", \"testing\"], enabled: false, ariaLabel: \"Unavailable skills\"\n }))\n ])\n);",
36
+ "select-scale": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { SelectComponent } from \"../../components/select/SelectComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst field = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"select-showcase-field\");\n\nconst largeStatus = status(\"Search by name or jump through the list with your keyboard.\");\n\nconst large = new SelectComponent({\n id: \"select-large\", data: Array.from({ length: 10000 }, (_, i) => ({ value: i + 1, text: \"Item \" + (\"00000\" + (i + 1)).slice(-5) })),\n value: 5000, ariaLabel: \"Large list\", dropdownHeight: \"18rem\", placeholder: \"Choose an item\",\n onChange: (value, item) => { largeStatus.content = item ? \"Selected \" + item.text + \", key \" + value : \"Selection cleared.\"; }\n});\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"select-scale\", \"06\", \"Room for a long list\", \"Ten thousand options, with only the visible rows rendered. Selection stays in view when you open the list.\", [\n field(\"select-large\", \"Item\", large), largeStatus,\n text(\"p\", \"Type to search. Arrow keys move through results; Ctrl+Home and Ctrl+End jump to either end.\", \"inline-note\")\n ])\n);",
37
+ "checkbox-basic": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { CheckBoxComponent } from \"../../components/checkbox/CheckBoxComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst basicStatus = status(\"Email updates are off.\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"checkbox-basic\", \"01\", \"One clear choice\", \"Click the box or its label. Tab focuses the input; Space changes its state.\", [\n new CheckBoxComponent({ id: \"checkbox-basic-input\", label: \"Email me product updates\", onChange: checked => {\n basicStatus.content = checked ? \"Email updates are on.\" : \"Email updates are off.\";\n } }), basicStatus,\n text(\"pre\", '{ label: \"Email me product updates\", onChange: checked => { ... } }', \"sample-code\")\n ])\n);",
38
+ "checkbox-states": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { CheckBoxComponent } from \"../../components/checkbox/CheckBoxComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"checkbox-states\", \"02\", \"A little more context\", \"Supporting text explains a choice. Disabled controls keep their labels and current state.\", [\n group([\n new CheckBoxComponent({ id: \"checkbox-description\", label: \"Remember this workspace\", description: \"Open this workspace automatically the next time you sign in.\", value: true }),\n new CheckBoxComponent({ id: \"checkbox-disabled\", label: \"Managed by your administrator\", enabled: false }),\n new CheckBoxComponent({ id: \"checkbox-disabled-checked\", label: \"Security notifications\", value: true, enabled: false })\n ], \"checkbox-stack\")\n ])\n);",
39
+ "checkbox-partial": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { CheckBoxComponent } from \"../../components/checkbox/CheckBoxComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst partialStatus = status(\"1 of 3 channels selected.\");\n\nconst channels = [\"Product news\", \"Release notes\", \"Community events\"].map((label, index) => new CheckBoxComponent({\n id: \"checkbox-channel-\" + index, label, value: index === 0,\n onChange: () => syncChannels()\n}));\n\nconst allChannels = new CheckBoxComponent({\n id: \"checkbox-all\", label: \"All updates\", indeterminate: true,\n onChange: checked => { channels.forEach(channel => channel.setValue(checked)); syncChannels(); }\n});\n\nfunction syncChannels() {\n const count = channels.filter(channel => channel.getValue()).length;\n allChannels.setValue(count === channels.length);\n allChannels.indeterminate = count > 0 && count < channels.length;\n partialStatus.content = count + \" of \" + channels.length + \" channels selected.\";\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"checkbox-partial\", \"03\", \"Some, all, or none\", \"A mixed parent summarizes its children. Activating it selects or clears the whole group.\", [\n group([allChannels, group(channels, \"checkbox-child-list\")], \"checkbox-stack\"), partialStatus,\n text(\"pre\", \"checkbox.indeterminate = true;\\ncheckbox.setValue(true); // Silent checked update\", \"sample-code\")\n ])\n);",
40
+ "expander-basic": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ExpanderComponent } from \"../../components/expander/ExpanderComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst copy = (title: string, content: string) => group([text(\"h4\", title), text(\"p\", content)], \"expander-example-copy\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst basicExpanderStatus = status(\"Details are expanded.\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"expander-basic\", \"01\", \"Details on demand\", \"The whole header toggles the section. Its native button also responds to Enter and Space.\", [\n new ExpanderComponent({\n header: \"About this project\", body: copy(\"A place to get started\", \"Keep the essentials visible and tuck supporting information into a section that is easy to open.\"),\n onToggle: expanded => { basicExpanderStatus.content = expanded ? \"Details are expanded.\" : \"Details are collapsed.\"; }\n }), basicExpanderStatus\n ])\n);",
41
+ "expander-preserved": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { CheckBoxComponent } from \"../../components/checkbox/CheckBoxComponent\";\nimport { ExpanderComponent } from \"../../components/expander/ExpanderComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst preservedStatus = status(\"Collapse and reopen to keep your draft.\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"expander-preserved\", \"02\", \"Keep unfinished work\", \"Collapsing hides the body while keeping its inputs and components mounted.\", [\n new ExpanderComponent({\n header: \"Project draft\",\n body: group([\n { tag: \"label\", content: \"Project name\", attr: { for: \"expander-draft\" } },\n { tag: \"input\", attr: { id: \"expander-draft\", class: \"tabs-draft-input\", placeholder: \"Type a draft, then collapse this section\" } },\n new CheckBoxComponent({ id: \"expander-draft-checkbox\", label: \"Share with my team\" })\n ], \"expander-example-copy\"),\n onToggle: expanded => { preservedStatus.content = expanded ? \"Your draft is still here.\" : \"Draft hidden and preserved.\"; }\n }), preservedStatus\n ])\n);",
42
+ "expander-header": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ExpanderComponent } from \"../../components/expander/ExpanderComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: \"button\", outlined: true, size: \"small\" });\n\nconst copy = (title: string, content: string) => group([text(\"h4\", title), text(\"p\", content)], \"expander-example-copy\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst headerStatus = status(\"The header action has not been used.\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"expander-header\", \"03\", \"Room for a header action\", \"Use isToggleOnHeader: false to toggle only with the indicator and keep header actions independent.\", [\n new ExpanderComponent({\n isToggleOnHeader: false,\n header: group([text(\"span\", \"Team members\"), action(\"Invite\", () => { headerStatus.content = \"Invite action used. Expansion is unchanged.\"; })], \"expander-rich-header\"),\n body: copy(\"Work together\", \"Invite people to the workspace and keep everyone in the same place.\"),\n ariaLabel: \"Team members\"\n }), headerStatus\n ])\n);",
43
+ "expander-guarded": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { CheckBoxComponent } from \"../../components/checkbox/CheckBoxComponent\";\nimport { ExpanderComponent } from \"../../components/expander/ExpanderComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst copy = (title: string, content: string) => group([text(\"h4\", title), text(\"p\", content)], \"expander-example-copy\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nlet allowCollapse = false;\n\nconst guardedStatus = status(\"Closing is currently blocked.\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"expander-guarded\", \"04\", \"Keep important details open\", \"Return false from onToggle to veto a change. Allow closing with the checkbox below.\", [\n new ExpanderComponent({\n header: \"Unsaved changes\",\n body: copy(\"A draft needs your attention\", \"This section stays open until you allow it to close.\"),\n onToggle: expanding => {\n if (!expanding && !allowCollapse) { guardedStatus.content = \"Still open. Allow closing to continue.\"; return false; }\n guardedStatus.content = expanding ? \"Section opened.\" : \"Section closed.\";\n }\n }),\n group([new CheckBoxComponent({ id: \"expander-allow-close\", label: \"Allow closing\", onChange: value => { allowCollapse = value; } })], \"sample-row\"),\n guardedStatus\n ])\n);",
44
+ "expander-nested": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { CheckBoxComponent } from \"../../components/checkbox/CheckBoxComponent\";\nimport { ExpanderComponent } from \"../../components/expander/ExpanderComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst copy = (title: string, content: string) => group([text(\"h4\", title), text(\"p\", content)], \"expander-example-copy\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst nested = new ExpanderComponent({\n header: \"Workspace settings\",\n body: group([\n new ExpanderComponent({ header: \"Notifications\", expanded: false, body: group([\n new CheckBoxComponent({ label: \"Email notifications\", value: true }),\n new CheckBoxComponent({ label: \"Desktop notifications\" })\n ], \"checkbox-stack\") }),\n new ExpanderComponent({ header: \"Privacy\", expanded: false, body: copy(\"Your preferences\", \"Choose what you share and how your workspace appears to others.\") })\n ], \"expander-stack\")\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"expander-nested\", \"05\", \"One level at a time\", \"Nested sections stay independent. Opening Notifications or Privacy keeps the parent in place.\", [nested])\n);",
45
+ "expander-options": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ExpanderComponent } from \"../../components/expander/ExpanderComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst copy = (title: string, content: string) => group([text(\"h4\", title), text(\"p\", content)], \"expander-example-copy\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst customIcons = new ExpanderComponent({\n header: \"A different indicator\", body: copy(\"Make it your own\", \"Supply custom expandedIcon and collapsedIcon nodes to match your application.\"),\n expanded: false, expandedIcon: text(\"span\", \"−\", \"expander-custom-icon\"), collapsedIcon: text(\"span\", \"+\", \"expander-custom-icon\")\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"expander-options\", \"06\", \"A familiar shape, your details\", \"Custom indicators and disabled toggles use the same surface and theme.\", [\n group([\n customIcons,\n new ExpanderComponent({ header: \"Unavailable section\", body: \"This section is not available yet.\", expanded: false, enabled: false })\n ], \"expander-stack\")\n ])\n);",
46
+ "input-basic": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { InputComponent } from \"../../components/input/InputComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst sampleField = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"field-sample\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst inputStatus = status(\"Start typing to see the input event.\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"input-basic\", \"01\", \"Text as you type\", \"Input and change events keep their familiar string values. Add an external label or use a FormField.\", [\n sampleField(\"input-name\", \"Project name\", new InputComponent({\n id: \"input-name\", placeholder: \"Give your project a name\", maxLength: 40,\n onInput: value => { inputStatus.content = value ? \"Typing: \" + value : \"The field is empty.\"; },\n onChange: value => { inputStatus.content = \"Committed: \" + (value || \"empty\"); }\n })), inputStatus\n ])\n);",
47
+ "input-textarea": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { InputComponent } from \"../../components/input/InputComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst sampleField = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"field-sample\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst notesStatus = status(\"A few notes for the team.\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"input-textarea\", \"02\", \"Room for a longer thought\", \"Use the same familiar events with a multiline field.\", [\n sampleField(\"input-notes\", \"Notes\", new InputComponent({\n id: \"input-notes\", type: \"textarea\", rows: 4, value: \"A few notes for the team.\",\n onInput: value => { notesStatus.content = value.length + \" characters in the notes.\"; }\n })), notesStatus\n ])\n);",
48
+ "input-states": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { InputComponent } from \"../../components/input/InputComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst sampleField = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"field-sample\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"input-states\", \"03\", \"Useful native input types\", \"Passwords, email, read-only values, and disabled fields share the same base appearance.\", [\n sampleField(\"input-password\", \"Password\", new InputComponent({ id: \"input-password\", type: \"password\", value: \"A little privacy\" })),\n sampleField(\"input-readonly\", \"Read-only identifier\", new InputComponent({ id: \"input-readonly\", value: \"PROJ-2026-010\", readOnly: true })),\n sampleField(\"input-disabled\", \"Unavailable value\", new InputComponent({ id: \"input-disabled\", value: \"Managed by your team\", enabled: false }))\n ])\n);",
49
+ "input-unstyled": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { InputComponent } from \"../../components/input/InputComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"input-unstyled\", \"04\", \"A building block when needed\", \"Opt out of the library surface for a grid cell or a custom editor while keeping normal input behavior.\", [\n group([\n text(\"span\", \"PROJECT /\", \"inline-note\"),\n new InputComponent({ id: \"input-plain\", value: \"An inline title\", ariaLabel: \"Inline title\", unstyled: true, class: \"showcase-inline-input\" })\n ], \"unstyled-input-sample\"),\n text(\"pre\", '{ unstyled: true, class: \"my-editor\" }', \"sample-code\")\n ])\n);",
50
+ "number-basic": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { NumberComponent } from \"../../components/number/NumberComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst sampleField = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"field-sample\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst numberStatus = status(\"Commit a value with Enter or by leaving the field.\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"number-basic\", \"01\", \"A number with a format\", \"Edit a decimal, then commit it. Formatting happens on blur or Enter.\", [\n sampleField(\"number-amount\", \"Amount\", new NumberComponent({\n id: \"number-amount\", value: 1250.5, format: \"#,0.00\",\n onChange: value => { numberStatus.content = value == null ? \"Amount cleared.\" : \"Numeric value: \" + value; }\n })), numberStatus,\n sampleField(\"number-zero\", \"Whole number\", new NumberComponent({ id: \"number-zero\", value: 0, format: \"0\" }))\n ])\n);",
51
+ "number-options": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { NumberComponent } from \"../../components/number/NumberComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst sampleField = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"field-sample\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"number-options\", \"02\", \"Choose when to format\", \"Formatting and Enter commits can be disabled independently.\", [\n sampleField(\"number-live\", \"Format preserved while editing\", new NumberComponent({\n id: \"number-live\", value: 12.5, format: \"0.00\", formatOnBlur: false, commitOnEnter: false\n })),\n text(\"pre\", \"{ formatOnBlur: false, commitOnEnter: false }\", \"sample-code\")\n ])\n);",
52
+ "number-states": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { NumberComponent } from \"../../components/number/NumberComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst sampleField = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"field-sample\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"number-states\", \"03\", \"Consistent states\", \"Disabled and read-only values match the other controls. Unstyled mode remains available for embedded editors.\", [\n sampleField(\"number-disabled\", \"Unavailable amount\", new NumberComponent({ id: \"number-disabled\", value: 99, format: \"0.00\", enabled: false })),\n sampleField(\"number-readonly\", \"Calculated total\", new NumberComponent({ id: \"number-readonly\", value: 149.95, format: \"0.00\", readOnly: true })),\n text(\"pre\", '{ unstyled: true }', \"sample-code\")\n ])\n);",
53
+ "field-composition": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { InputComponent } from \"../../components/input/InputComponent\";\nimport { NumberComponent } from \"../../components/number/NumberComponent\";\nimport { SelectComponent } from \"../../components/select/SelectComponent\";\nimport { FormFieldComponent } from \"../../components/form-field/FormFieldComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst projectOptions = [{ value: \"design\", text: \"Design system\" }, { value: \"website\", text: \"Website refresh\" }, { value: \"research\", text: \"Customer research\" }];\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"field-composition\", \"01\", \"Controls that belong together\", \"Text, numbers, and selects keep their own behavior while sharing a consistent field layout.\", [\n group([\n new FormFieldComponent({ label: \"Project name\", control: new InputComponent({ id: \"field-name\", value: \"A new project\" }) }),\n new FormFieldComponent({ label: \"Budget\", control: new NumberComponent({ id: \"field-budget\", value: 1200, format: \"#,0.00\" }) }),\n new FormFieldComponent({ label: \"Team\", control: new SelectComponent({ id: \"field-team\", data: projectOptions, value: \"design\" }) })\n ], \"composed-fields\"),\n text(\"pre\", 'new FormFieldComponent({\\n label: \"Team\", control: new SelectComponent({ data })\\n});', \"sample-code\")\n ])\n);",
54
+ "field-legacy": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { FormFieldComponent } from \"../../components/form-field/FormFieldComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"field-legacy\", \"02\", \"Existing field types still work\", \"The original shorthand creates the same input components internally. Existing getValue(), setValue(), and validation calls continue to work.\", [\n new FormFieldComponent({ id: \"field-legacy-text\", label: \"User name\", type: \"text\", value: \"Alex\" }),\n new FormFieldComponent({ id: \"field-legacy-password\", label: \"Password\", type: \"password\", value: \"A private value\" }),\n text(\"pre\", 'new FormFieldComponent({ label: \"User name\", type: \"text\" });', \"sample-code\")\n ])\n);",
55
+ "field-specialized": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { DateComponent } from \"../../components/date/DateComponent\";\nimport { FormFieldComponent } from \"../../components/form-field/FormFieldComponent\";\nimport { date } from \"../../core/date\";\nimport { numeric } from \"../../core/numeric\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"field-specialized\", \"03\", \"Dates and formatted numbers\", \"Specialized controls handle their values and popups. The field adds the label and supporting text.\", [\n new FormFieldComponent({\n id: \"field-date\", label: \"Start date\", type: \"date\", value: \"15/10/2026\",\n dateOptions: { format: value => date.format(value, \"dd/mm/yy\"), parse: value => date.parse(value, \"dd/mm/yy\") }\n }),\n new FormFieldComponent({ id: \"field-number\", label: \"Estimated cost\", type: \"number\", value: numeric.format(1250.5, \"0.00\"), numberOptions: { format: \"#,0.00\" } }),\n new FormFieldComponent({ label: \"Milestone\", control: new DateComponent({ id: \"field-wrapped-date\", value: new Date(2026, 9, 21) }) })\n ])\n);",
56
+ "field-autosuggest": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { FormFieldComponent } from \"../../components/form-field/FormFieldComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst cities = [\"Vienna\", \"Berlin\", \"Copenhagen\", \"London\", \"New York\", \"Singapore\", \"Sydney\", \"Tokyo\"];\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"field-autosuggest\", \"04\", \"Suggestions while you type\", \"AutoSuggestComponent now uses the shared input styling and owns its suggestion lifecycle.\", [\n new FormFieldComponent({\n id: \"field-city\", label: \"Office city\", type: \"autosuggest\", placeholder: \"Start typing a city\",\n description: \"Try Vienna, Berlin, or Tokyo.\",\n autoSuggestOptions: { minChars: 1, delay: 0, source: (term, suggest) => suggest(cities.filter(city => city.toLowerCase().includes(term.toLowerCase()))) }\n }),\n text(\"p\", \"The original autoSuggestOptions source and callbacks remain available.\", \"inline-note\")\n ])\n);",
57
+ "field-validation": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { InputComponent } from \"../../components/input/InputComponent\";\nimport { SelectComponent } from \"../../components/select/SelectComponent\";\nimport { FormFieldComponent } from \"../../components/form-field/FormFieldComponent\";\nimport { FormComponent } from \"../../components/form-field/FormComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: \"button\", outlined: true, size: \"small\" });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst projectOptions = [{ value: \"design\", text: \"Design system\" }, { value: \"website\", text: \"Website refresh\" }, { value: \"research\", text: \"Customer research\" }];\n\nconst validationStatus = status(\"Validate the form to see messages below its controls.\");\n\nconst emailField = new FormFieldComponent({\n label: \"Email address\", required: true, description: \"Use your work email.\",\n control: new InputComponent({ id: \"field-email\", type: \"email\", placeholder: \"you@example.com\" })\n});\n\nconst projectField = new FormFieldComponent({\n label: \"Project\", required: true,\n control: new SelectComponent({ id: \"field-project\", data: projectOptions, placeholder: \"Choose a project\" })\n});\n\nconst validationForm = new FormComponent([emailField, projectField, action(\"Validate form\", () => {\n validationStatus.content = validationForm.validate() ? \"All fields are valid.\" : \"Please correct the marked fields.\";\n}), validationStatus]);\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"field-validation\", \"05\", \"Guidance near the control\", \"Required and custom validation messages appear separately from the label and are associated with the control.\", [\n validationForm\n ])\n);",
58
+ "field-layout": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { SelectComponent } from \"../../components/select/SelectComponent\";\nimport { FormFieldComponent } from \"../../components/form-field/FormFieldComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst projectOptions = [{ value: \"design\", text: \"Design system\" }, { value: \"website\", text: \"Website refresh\" }, { value: \"research\", text: \"Customer research\" }];\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"field-layout\", \"06\", \"An optional floating label\", \"Keep labels above controls by default, or place them on the outline. Disabled fields disable their wrapped native controls.\", [\n new FormFieldComponent({ id: \"field-floating\", label: \"Workspace\", labelPosition: \"floating\", value: \"Design workspace\", description: \"The label stays visible when the field is empty.\" }),\n new FormFieldComponent({ label: \"Managed project\", disabled: true, control: new SelectComponent({ id: \"field-disabled-select\", data: projectOptions, value: \"design\" }) }),\n new FormFieldComponent({ id: \"field-disabled-input\", label: \"Managed identifier\", disabled: true, value: \"PROJ-2026-010\" })\n ])\n);",
59
+ "notification-tones": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode, JSLRender } from \"jsl-render\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { Notification, NotificationComponent, INotificationOptions } from \"../../components/notification/Notification\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: \"button\", outlined: true, size: \"small\" });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst messageStatus = status(\"Notifications appear in the top-right corner.\");\n\nlet latestMessage: string;\n\nconst notify = (options: INotificationOptions) => {\n latestMessage = Notification.show({ ...options, onClose: () => {\n messageStatus.content = \"Notification dismissed.\";\n options.onClose?.();\n JSLRender.lastCreatedRenderer?.refresh();\n } });\n messageStatus.content = \"Notification shown.\";\n};\n\nconst variants: INotificationOptions[\"variant\"][] = [\"info\", \"success\", \"warning\", \"error\"];\n\nconst messages = [\"Your export is ready to download.\", \"All changes have been saved.\", \"Your session will expire soon.\", \"We couldn't save your changes. Please try again.\"];\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"notification-tones\", \"01\", \"Feedback with a purpose\", \"Color supports the message; titles and text explain what happened. Try each live notification.\", [\n group(variants.map((variant, index) => new NotificationComponent({\n title: [\"For your information\", \"All done\", \"A quick heads-up\", \"Something went wrong\"][index],\n content: messages[index], variant, closeOnClick: false, showCloseButton: false\n })), \"notification-samples\"),\n group(variants.map((variant, index) => action(\"Show \" + variant, () => notify({ content: messages[index], variant }))), \"sample-row\")\n ])\n);",
60
+ "notification-actions": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode, JSLRender } from \"jsl-render\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { Notification, INotificationOptions } from \"../../components/notification/Notification\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: \"button\", outlined: true, size: \"small\" });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst messageStatus = status(\"Notifications appear in the top-right corner.\");\n\nlet latestMessage: string;\n\nconst notify = (options: INotificationOptions) => {\n latestMessage = Notification.show({ ...options, onClose: () => {\n messageStatus.content = \"Notification dismissed.\";\n options.onClose?.();\n JSLRender.lastCreatedRenderer?.refresh();\n } });\n messageStatus.content = \"Notification shown.\";\n};\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"notification-actions\", \"02\", \"A useful next step\", \"Keep a rich message open while its controls are used, or close a simple message with a click.\", [\n group([\n action(\"Show message\", () => notify({ title: \"A new update\", content: \"Click this message or its close button to dismiss it.\" })),\n action(\"Show action\", () => {\n const id = Notification.show({\n title: \"Item archived\", closeOnClick: false, content: group([\n text(\"p\", \"You can restore the item if you change your mind.\"),\n action(\"Undo archive\", () => { Notification.clearNotification(id); messageStatus.content = \"Item restored.\"; JSLRender.lastCreatedRenderer?.refresh(); })\n ], \"notification-action-copy\")\n });\n latestMessage = id;\n }),\n action(\"Dismiss latest\", () => Notification.clearNotification(latestMessage)),\n action(\"Dismiss all\", () => Notification.clearAll())\n ], \"sample-row\"), messageStatus,\n text(\"pre\", 'const id = Notification.show({\\n title: \"Changes saved\", content: \"Your team is up to date.\",\\n variant: \"success\", closeOnClick: false\\n});\\nNotification.clearNotification(id);', \"sample-code\")\n ])\n);",
61
+ "notification-timing": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode, JSLRender } from \"jsl-render\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { Notification, INotificationOptions } from \"../../components/notification/Notification\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: \"button\", outlined: true, size: \"small\" });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst messageStatus = status(\"Notifications appear in the top-right corner.\");\n\nlet latestMessage: string;\n\nconst notify = (options: INotificationOptions) => {\n latestMessage = Notification.show({ ...options, onClose: () => {\n messageStatus.content = \"Notification dismissed.\";\n options.onClose?.();\n JSLRender.lastCreatedRenderer?.refresh();\n } });\n messageStatus.content = \"Notification shown.\";\n};\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"notification-timing\", \"03\", \"Time to read\", \"A countdown bar shows the remaining time. Both the bar and timer pause while hovered or focused. Persistent messages stay until dismissed.\", [\n group([\n action(\"Show for 3 seconds\", () => notify({ title: \"Export complete\", content: \"Hover or focus this message to pause its timer.\", timeOut: 3000, variant: \"info\" })),\n action(\"Show persistent message\", () => notify({ title: \"Review needed\", content: \"This message stays open until you dismiss it.\", closeOnClick: false, variant: \"warning\" }))\n ], \"sample-row\")\n ])\n);",
62
+ "loading-sizes": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { LoadingComponent } from \"../../components/loading/LoadingComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"loading-sizes\", \"01\", \"From inline to centre stage\", \"The original numeric constructor still sets the ring's size in rem.\", [\n group([1, 2, 3].map(size => group([new LoadingComponent(size), text(\"span\", size + \" rem\", \"size-caption\")], \"size-sample\")), \"sample-row size-row\"),\n text(\"pre\", 'new LoadingComponent(1);\\nnew LoadingComponent(3);', \"sample-code\")\n ])\n);",
63
+ "loading-labels": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { LoadingComponent } from \"../../components/loading/LoadingComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"loading-labels\", \"02\", \"Say what's happening\", \"Provide a useful label when a task takes time. Labels remain accessible when visually hidden.\", [\n group([\n new LoadingComponent({ sizeInRem: 1, label: \"Saving changes…\", showLabel: true }),\n new LoadingComponent({ sizeInRem: 1.5, label: \"Syncing files…\", showLabel: true, style: \"--jsl-loading-color:var(--jsl-color-success)\" })\n ], \"loading-label-samples\"),\n text(\"pre\", '{ sizeInRem: 1, label: \"Saving changes…\", showLabel: true }', \"sample-code\")\n ])\n);",
64
+ "loading-workflow": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode, JSLRender } from \"jsl-render\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { LoadingComponent } from \"../../components/loading/LoadingComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nclass LoadingDemo implements IJSLComponent {\n public State = { busy: false, complete: false };\n private renderer: JSLRender;\n private timer: ReturnType<typeof setTimeout>;\n public onInit(renderer: JSLRender) { this.renderer = renderer; }\n public onRemove() { clearTimeout(this.timer); }\n public render(): IJSLVNode {\n return group([\n new ButtonComponent({ content: this.State.busy ? \"Loading report…\" : \"Load report\", enabled: !this.State.busy, type: \"button\", click: () => {\n this.State.busy = true; this.State.complete = false;\n this.timer = setTimeout(() => { this.State.busy = false; this.State.complete = true; this.renderer.refresh(); }, 1800);\n } }),\n { tag: \"div\", attr: { class: \"loading-demo-panel\", \"aria-busy\": String(this.State.busy) }, children: [\n this.State.busy ? new LoadingComponent({ sizeInRem: 1.25, label: \"Fetching your report…\", showLabel: true }) :\n text(\"p\", this.State.complete ? \"Your report is ready. 24 projects, all up to date.\" : \"Load a report to try a brief loading state.\")\n ] }\n ], \"loading-demo\");\n }\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"loading-workflow\", \"03\", \"A moment between states\", \"Disable a repeated action while it runs, and mark the affected region as busy.\", [new LoadingDemo()])\n);",
65
+ "navigation-bar": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { NavigationComponent } from \"../../components/navigation/NavigationComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst navStatus = status(\"Choose a destination or an action.\");\n\nconst selected = (name: string) => () => { navStatus.content = \"Selected: \" + name + \".\"; };\n\nconst wideNavigation = new NavigationComponent({\n title: \"Workspace\", position: \"default\", alignment: \"right\", ariaLabel: \"Workspace example\",\n data: [\n { content: \"Overview\", link: \"#navigation\", click: selected(\"Overview\") },\n { content: \"Projects\", link: \"#navigation/projects\", click: selected(\"Projects\"), children: [\n { content: \"All projects\", link: \"#navigation/projects/all\", click: selected(\"All projects\") },\n { content: \"Create project\", click: selected(\"Create project\") },\n { content: \"Templates\", children: [\n { content: \"Design review\", click: selected(\"Design review\") },\n { content: \"Sprint planning\", click: selected(\"Sprint planning\") }\n ] }\n ] },\n { content: \"Resources\", children: [\n { content: \"Documentation\", link: \"https://example.com\", target: \"_blank\" },\n { content: \"What's new\", click: selected(\"What's new\") }\n ] },\n { content: \"Admin\", enabled: false, click: selected(\"Admin\") }\n ]\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"navigation-bar\", \"01\", \"A place for everything\", \"Follow a link, open a submenu, or run an action. Project links and their adjacent submenu buttons work independently.\", [\n wideNavigation, navStatus,\n text(\"p\", \"Try Tab, Enter or Space, arrow keys, and Escape. Click outside a menu to close it.\", \"inline-note\")\n ])\n);",
66
+ "navigation-compact": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { NavigationComponent } from \"../../components/navigation/NavigationComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst navStatus = status(\"Choose a destination or an action.\");\n\nconst selected = (name: string) => () => { navStatus.content = \"Selected: \" + name + \".\"; };\n\nconst compactNavigation = new NavigationComponent({ title: \"Team space\", position: \"static\", ariaLabel: \"Compact example\", data: [\n { content: \"Activity\", active: true, click: selected(\"Activity\") },\n { content: \"People\", click: selected(\"People\") },\n { content: \"Settings\", children: [\n { content: \"Profile\", click: selected(\"Profile\") },\n { content: \"Notifications\", click: selected(\"Notification settings\") }\n ] }\n] });\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"navigation-compact\", \"02\", \"Comfortable in a smaller space\", \"Navigation adapts to its container as well as the viewport. Open the menu to explore its destinations.\", [\n group([compactNavigation], \"navigation-compact-sample\"),\n text(\"pre\", '{ title: \"Team space\", position: \"static\", data }', \"sample-code\")\n ])\n);",
67
+ "navigation-markup": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { NavigationComponent } from \"../../components/navigation/NavigationComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card\" }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h3\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst navStatus = status(\"Choose a destination or an action.\");\n\nconst selected = (name: string) => () => { navStatus.content = \"Selected: \" + name + \".\"; };\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"navigation-markup\", \"03\", \"Your content, your destinations\", \"A brand and each item can contain a VNode. Native anchors preserve standard browser behavior, including opening links in another tab.\", [\n new NavigationComponent({\n title: group([text(\"span\", \"S\", \"navigation-brand-mark\"), text(\"span\", \"Studio\")], \"navigation-rich-brand\"),\n titleLink: \"#navigation\", position: \"default\", ariaLabel: \"Rich content example\",\n data: [{ content: \"Home\", link: \"#navigation\" }, { content: \"Help\", click: selected(\"Help\") }]\n })\n ])\n);",
68
+ "progress": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ProgressComponent } from \"../../components/progress/ProgressComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content=IJSLVNode|IJSLComponent;\n\nconst text=(tag:string,content:string):IJSLVNode=>({tag,content});\n\nconst group=(children:Content[],className?:string):IJSLVNode=>({tag:\"div\",attr:{class:className},children});\n\nconst button=(content:string,click:()=>void)=>new ButtonComponent({content,click,type:\"button\",outlined:true,size:\"small\"});\n\nfunction section(id:string,number:string,title:string,copy:string,children:Content[],usage:string):IJSLVNode {\n return {tag:\"section\",attr:{id,class:\"component-section\",\"aria-labelledby\":id+\"-title\"},children:[\n group([text(\"p\",\"THE ESSENTIALS / \"+number),{tag:\"h2\",content:title,attr:{id:id+\"-title\",class:\"section-title\"}},text(\"p\",copy)],\"hero-copy\"),\n group(children,\"sample-card remaining-demo\"),\n {tag:\"details\",attr:{class:\"usage\"},children:[text(\"summary\",title+\" usage & compatibility\"),text(\"p\",usage)]}\n ]};\n}\n\nconst progress=new ProgressComponent(45,{showPercent:true,ariaLabel:\"Upload progress\"});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n section(\"progress\",\"17\",\"Progress\",\"A clear measure of how far a task has come.\",[\n progress,group([button(\"Advance\",()=>progress.setProgress(Math.min(100,progress.getProgress()+10))),button(\"Reset\",()=>progress.setProgress(0))],\"sample-row\"),\n new ProgressComponent(72,{ariaLabel:\"Processing progress\"}),text(\"p\",\"A slim indicator without a percentage label.\")\n],\"The numeric constructor, color override, formatting, getProgress(), and setProgress() remain available. Displayed values are clamped to 0–100. ariaLabel names the progress bar.\")\n);",
69
+ "stack-panels": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { StackPanelComponent } from \"../../components/stack-panel/StackPanelComponent\";\nimport { SplitterComponent } from \"../../components/stack-panel/SplitterComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content=IJSLVNode|IJSLComponent;\n\nconst text=(tag:string,content:string):IJSLVNode=>({tag,content});\n\nconst group=(children:Content[],className?:string):IJSLVNode=>({tag:\"div\",attr:{class:className},children});\n\nconst panel=(title:string,copy:string)=>group([text(\"h3\",title),text(\"p\",copy)],\"layout-demo-panel\");\n\nfunction section(id:string,number:string,title:string,copy:string,children:Content[],usage:string):IJSLVNode {\n return {tag:\"section\",attr:{id,class:\"component-section\",\"aria-labelledby\":id+\"-title\"},children:[\n group([text(\"p\",\"THE ESSENTIALS / \"+number),{tag:\"h2\",content:title,attr:{id:id+\"-title\",class:\"section-title\"}},text(\"p\",copy)],\"hero-copy\"),\n group(children,\"sample-card remaining-demo\"),\n {tag:\"details\",attr:{class:\"usage\"},children:[text(\"summary\",title+\" usage & compatibility\"),text(\"p\",usage)]}\n ]};\n}\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n section(\"stack-panels\",\"18\",\"Stack panels & splitters\",\"Comfortable layouts with a small, precise resize handle.\",[\n text(\"h3\",\"Side by side\"),new StackPanelComponent([panel(\"Library\",\"Drag the handle or focus it and use the arrow keys.\"),new SplitterComponent({minSizesInPX:[90,90]}),panel(\"Workspace\",\"Shift + arrow moves faster. Home and End move to the allowed limits.\")],{sizes:[\"40%\",undefined,\"*\"],style:\"height:220px;border:1px solid var(--jsl-color-border);border-radius:.5rem;overflow:hidden\"}),\n text(\"h3\",\"One above another\"),new StackPanelComponent([panel(\"Preview\",\"Vertical layouts resize by height.\"),new SplitterComponent({minSizesInPX:[60,60]}),panel(\"Details\",\"The completion callback reports the first panel's height in this layout.\")],{orientation:\"vertical\",sizes:[\"45%\",undefined,\"*\"],style:\"height:300px;border:1px solid var(--jsl-color-border);border-radius:.5rem;overflow:hidden\"}),\n text(\"h3\",\"Responsive layout\"),new StackPanelComponent([panel(\"First\",\"Panels stack on smaller screens.\"),panel(\"Second\",\"No resize handle is needed here.\")],{responsive:true})\n],\"Existing orientation, sizes, valign, wrap, responsive, and flexForChildren options remain. Splitter preserves min/max sizes and resize callbacks, and supports mouse, touch, pen, and keyboard. Responsive horizontal panels stack below 70em; splitters hide in that layout.\")\n);",
70
+ "trees": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { TreeViewComponent } from \"../../components/tree-view/TreeViewComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content=IJSLVNode|IJSLComponent;\n\nconst text=(tag:string,content:string):IJSLVNode=>({tag,content});\n\nconst group=(children:Content[],className?:string):IJSLVNode=>({tag:\"div\",attr:{class:className},children});\n\nfunction section(id:string,number:string,title:string,copy:string,children:Content[],usage:string):IJSLVNode {\n return {tag:\"section\",attr:{id,class:\"component-section\",\"aria-labelledby\":id+\"-title\"},children:[\n group([text(\"p\",\"THE ESSENTIALS / \"+number),{tag:\"h2\",content:title,attr:{id:id+\"-title\",class:\"section-title\"}},text(\"p\",copy)],\"hero-copy\"),\n group(children,\"sample-card remaining-demo\"),\n {tag:\"details\",attr:{class:\"usage\"},children:[text(\"summary\",title+\" usage & compatibility\"),text(\"p\",usage)]}\n ]};\n}\n\nconst treeStatus=text(\"p\",\"Select a node to explore.\");\n\ntreeStatus.attr={role:\"status\"};\n\nconst makeTree=()=>({id:\"workspace\",content:\"Workspace\",children:[{id:\"projects\",content:\"Projects\",children:[{id:\"design\",content:\"Design system\"},{id:\"website\",content:\"Website refresh\"}]},{id:\"archive\",content:\"Archive\",collapsed:true,children:[{id:\"last-year\",content:\"Last year's work\"}]},{id:\"notes\",content:\"Notes\"}]});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n section(\"trees\",\"19\",\"Tree views\",\"A calm hierarchy with clear expansion and selection states.\",[\n new TreeViewComponent({data:makeTree(),ariaLabel:\"Workspace files\",onSelect:item=>{treeStatus.content=\"Selected: \"+item.id;}}),treeStatus,\n text(\"h3\",\"Custom row content\"),new TreeViewComponent({data:makeTree(),ariaLabel:\"Rich file tree\",renderItem:item=>group([text(\"span\",item.children?.length ? \"▱\" : \"·\"),text(\"span\",String(item.content))],\"tree-demo-content\")})\n],\"The data, collapsed, content, and renderItem options remain. Expansion updates collapsed on the data node. onSelect and ariaLabel are optional additions. Use arrows, Home/End, Enter, or Space; node IDs are data identifiers and do not collide across trees.\")\n);",
71
+ "overlays": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { OverlayComponent } from \"../../components/overlay/OverlayComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content=IJSLVNode|IJSLComponent;\n\nconst text=(tag:string,content:string):IJSLVNode=>({tag,content});\n\nconst group=(children:Content[],className?:string):IJSLVNode=>({tag:\"div\",attr:{class:className},children});\n\nconst button=(content:string,click:()=>void)=>new ButtonComponent({content,click,type:\"button\",outlined:true,size:\"small\"});\n\nfunction section(id:string,number:string,title:string,copy:string,children:Content[],usage:string):IJSLVNode {\n return {tag:\"section\",attr:{id,class:\"component-section\",\"aria-labelledby\":id+\"-title\"},children:[\n group([text(\"p\",\"THE ESSENTIALS / \"+number),{tag:\"h2\",content:title,attr:{id:id+\"-title\",class:\"section-title\"}},text(\"p\",copy)],\"hero-copy\"),\n group(children,\"sample-card remaining-demo\"),\n {tag:\"details\",attr:{class:\"usage\"},children:[text(\"summary\",title+\" usage & compatibility\"),text(\"p\",usage)]}\n ]};\n}\n\nconst overlayCopy=()=>group([text(\"h2\",\"Workspace settings\"),text(\"p\",\"A little room for secondary tasks, without leaving your current view.\"),new ButtonComponent({content:\"Save settings\",type:\"button\",click:()=>overlay.close()})]);\n\nlet overlay:OverlayComponent;\n\nlet allowClose=false;\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n section(\"overlays\",\"20\",\"Overlays\",\"Focused panels that slide in from the side or the top.\",[\n group([button(\"Open side panel\",()=>{overlay=OverlayComponent.show({content:overlayCopy(),ariaLabel:\"Workspace settings\",size:\"26rem\"});}),button(\"Open top panel\",()=>{overlay=OverlayComponent.show({content:overlayCopy(),direction:\"top\",size:\"20rem\",ariaLabel:\"Workspace settings\"});}),button(\"Try close guard\",()=>{allowClose=false;overlay=OverlayComponent.show({ariaLabel:\"Protected panel\",onClose:()=>allowClose,content:group([text(\"h2\",\"A protected panel\"),text(\"p\",\"Closing is blocked until you choose Allow close.\"),button(\"Allow close\",()=>{allowClose=true;overlay.close();})])});})],\"sample-row\")\n],\"show(), close(), content, direction, size, animation, dismissal flags, and callbacks remain. onClose returning false vetoes dismissal. Native modal dialogs contain keyboard focus, support nested panels, and restore focus on close. ariaLabel and closeButtonLabel provide accessible names.\")\n);",
72
+ "ribbons": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { RibbonMenuComponent } from \"../../components/ribbon-menu/RibbonMenuComponent\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content=IJSLVNode|IJSLComponent;\n\nconst text=(tag:string,content:string):IJSLVNode=>({tag,content});\n\nconst group=(children:Content[],className?:string):IJSLVNode=>({tag:\"div\",attr:{class:className},children});\n\nconst button=(content:string,click:()=>void)=>new ButtonComponent({content,click,type:\"button\",outlined:true,size:\"small\"});\n\nfunction section(id:string,number:string,title:string,copy:string,children:Content[],usage:string):IJSLVNode {\n return {tag:\"section\",attr:{id,class:\"component-section\",\"aria-labelledby\":id+\"-title\"},children:[\n group([text(\"p\",\"THE ESSENTIALS / \"+number),{tag:\"h2\",content:title,attr:{id:id+\"-title\",class:\"section-title\"}},text(\"p\",copy)],\"hero-copy\"),\n group(children,\"sample-card remaining-demo\"),\n {tag:\"details\",attr:{class:\"usage\"},children:[text(\"summary\",title+\" usage & compatibility\"),text(\"p\",usage)]}\n ]};\n}\n\nconst ribbonStatus=text(\"p\",\"Choose an action.\");\n\nribbonStatus.attr={role:\"status\"};\n\nconst ribbonAction=(content:string)=>button(content,()=>{ribbonStatus.content=content+\" selected.\";});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n section(\"ribbons\",\"21\",\"Ribbon menus\",\"Related actions grouped in a flexible, themed toolbar.\",[\n new RibbonMenuComponent([{title:\"Project\",children:[ribbonAction(\"New\"),ribbonAction(\"Open\"),ribbonAction(\"Save\")]},{title:\"Edit\",children:[ribbonAction(\"Undo\"),ribbonAction(\"Redo\")]},{title:\"View\",children:[new ButtonComponent({content:\"Details\",toggle:true,outlined:true,type:\"button\"}),new ButtonComponent({content:\"Unavailable\",enabled:false,type:\"button\"})]}]),ribbonStatus\n],\"The groups constructor and group title/children interface remain unchanged. Groups wrap with available space and use the normal ButtonComponent styles, including toggles and disabled actions.\")\n);",
73
+ "grid-basic": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode, JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { ISlickColumn } from \"../../grid/slick.core\";\nimport { TextEditor, NumericEditor, BooleanEditor } from \"../../grid/slick.editors.core\";\nimport { DateEditor } from \"../../grid/slick.editors.date\";\nimport { CheckboxFormatter, DateFormatter, NumericFormatter } from \"../../grid/slick.formatters\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nfunction columns(editable = false): ISlickColumn[] {\n return [\n { id: \"id\", name: \"ID\", width: 65, sortable: true },\n { id: \"name\", name: \"Project\", width: 250, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"team\", name: \"Team\", width: 145, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\", editor: editable ? NumericEditor : undefined },\n { id: \"date\", name: \"Start date\", width: 135, sortable: true, formatter: DateFormatter, editor: editable ? DateEditor : undefined },\n { id: \"approved\", name: \"Approved\", width: 100, headerCssClass: \"center\", formatter: CheckboxFormatter, editor: editable ? BooleanEditor : undefined }\n ];\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nconst basicTeams = [\"Design\", \"Engineering\", \"Operations\", \"Research\", \"Product\", \"Marketing\", \"Finance\", \"Support\", \"Security\", \"Customer Success\"];\n\nconst basicData = data(100).map((project, index) => ({ ...project, team: basicTeams[index % basicTeams.length] }));\n\nconst basic = new GridComponent(basicData, columns().map(column => ({ ...column, filterable: true })), {\n primaryKey: \"id\", multiColumnSort: true, numberedMultiColumnSort: true, showHeaderMenu: true\n}, \"300px\");\n\nconst edits: IJSLVNode = { tag: \"p\", content: \"Edit a project, budget, date, or approval value.\", attr: { role: \"status\", class: \"sample-status\" } };\n\nconst editable = new GridComponent(data(25), columns(true), { primaryKey: \"id\", editable: true, autoEdit: false }, \"300px\");\n\neditable.initEvents(grid => grid.onAfterEdit.subscribe((_event, args) => {\n edits.content = \"Updated \" + args.column.name + \" for project \" + args.item.id + \".\";\n // Grid events run independently of the showcase renderer.\n JSLRender.lastCreatedRenderer?.refresh();\n}));\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-basic\", \"Browse, sort & filter\", \"100 projects across 10 teams. Open a column header menu and choose Filter to select values. Click a heading to sort, then Shift-click other headings to add sort levels. Numbers show sorting priority. Select rows and resize or reorder columns.\", basic)\n);",
74
+ "grid-header-menu-icons": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { NumericFormatter } from \"../../grid/slick.formatters\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nlet projectStarred = false;\n\nconst projectHeaderButton = {\n html: \"☆\", tooltip: \"Star project column\", cssClass: \"grid-header-action\",\n handler: (event: MouseEvent) => {\n projectStarred = !projectStarred;\n projectHeaderButton.html = projectStarred ? \"★\" : \"☆\";\n projectHeaderButton.tooltip = projectStarred ? \"Unstar project column\" : \"Star project column\";\n projectHeaderButton.cssClass = \"grid-header-action\" + (projectStarred ? \" grid-header-starred\" : \"\");\n const button = event.currentTarget as HTMLElement;\n button.textContent = projectHeaderButton.html;\n button.title = projectHeaderButton.tooltip;\n button.classList.toggle(\"grid-header-starred\", projectStarred);\n }\n};\n\nconst headerActions = new GridComponent(data(12), [\n { id: \"id\", name: \"ID\", width: 65, sortable: true, filterable: true },\n { id: \"name\", name: \"Project\", width: 245, sortable: true, filterable: true, header: { buttons: [\n projectHeaderButton\n ] } },\n { id: \"team\", name: \"Team\", width: 145, sortable: true, filterable: true, header: { buttons: [\n { html: \"i\", tooltip: \"About team column\", cssClass: \"grid-header-action\", handler: () => {\n window.alert(\"The Team column shows the team responsible for each project.\");\n } }\n ] } },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, filterable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\" }\n], { primaryKey: \"id\", showHeaderMenu: true }, \"300px\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-header-menu-icons\", \"Column menus & header icons\", \"Open a column menu to sort or filter. Click the star in the Project heading to toggle it, or the Team information icon to show a message.\", headerActions)\n);",
75
+ "grid-frozen": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode, JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { ISlickColumn } from \"../../grid/slick.core\";\nimport { TextEditor, NumericEditor, BooleanEditor } from \"../../grid/slick.editors.core\";\nimport { DateEditor } from \"../../grid/slick.editors.date\";\nimport { CheckboxFormatter, DateFormatter, NumericFormatter } from \"../../grid/slick.formatters\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nfunction columns(editable = false): ISlickColumn[] {\n return [\n { id: \"id\", name: \"ID\", width: 65, sortable: true },\n { id: \"name\", name: \"Project\", width: 250, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"team\", name: \"Team\", width: 145, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\", editor: editable ? NumericEditor : undefined },\n { id: \"date\", name: \"Start date\", width: 135, sortable: true, formatter: DateFormatter, editor: editable ? DateEditor : undefined },\n { id: \"approved\", name: \"Approved\", width: 100, headerCssClass: \"center\", formatter: CheckboxFormatter, editor: editable ? BooleanEditor : undefined }\n ];\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nconst edits: IJSLVNode = { tag: \"p\", content: \"Edit a project, budget, date, or approval value.\", attr: { role: \"status\", class: \"sample-status\" } };\n\nconst editable = new GridComponent(data(25), columns(true), { primaryKey: \"id\", editable: true, autoEdit: false }, \"300px\");\n\neditable.initEvents(grid => grid.onAfterEdit.subscribe((_event, args) => {\n edits.content = \"Updated \" + args.column.name + \" for project \" + args.item.id + \".\";\n // Grid events run independently of the showcase renderer.\n JSLRender.lastCreatedRenderer?.refresh();\n}));\n\nconst frozenData = data(120).map((project, index) => ({\n ...project,\n owner: [\"Alex Morgan\", \"Sam Weber\", \"Jordan Lee\", \"Robin Taylor\"][index % 4],\n status: [\"Planning\", \"In progress\", \"In review\", \"Complete\"][index % 4],\n due: new Date(2026, 11, 1 + index % 28),\n plannedHours: 80 + index * 4,\n actualHours: 25 + index * 3,\n location: [\"Vienna\", \"London\", \"Berlin\", \"New York\"][index % 4]\n}));\n\nconst frozenColumns: ISlickColumn[] = [\n ...columns().map(column => ({ ...column, width: column.id === \"name\" ? 300 : 180 })),\n { id: \"owner\", name: \"Project owner\", width: 200, sortable: true },\n { id: \"status\", name: \"Status\", width: 180, sortable: true },\n { id: \"due\", name: \"Due date\", width: 180, sortable: true, formatter: DateFormatter },\n { id: \"plannedHours\", name: \"Planned hours\", width: 180, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\" },\n { id: \"actualHours\", name: \"Actual hours\", width: 180, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\" },\n { id: \"location\", name: \"Office\", width: 180, sortable: true }\n];\n\nconst frozen = new GridComponent(frozenData, frozenColumns, {\n primaryKey: \"id\", frozenColumn: 1\n}, \"320px\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-frozen\", \"Frozen columns\", \"12 columns and 120 projects. The ID and project stay visible while you scroll through ownership, status, dates, hours, and office details, even on wide screens.\", frozen)\n);",
76
+ "grid-large": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode, JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { ISlickColumn } from \"../../grid/slick.core\";\nimport { TextEditor, NumericEditor, BooleanEditor } from \"../../grid/slick.editors.core\";\nimport { DateEditor } from \"../../grid/slick.editors.date\";\nimport { CheckboxFormatter, DateFormatter, NumericFormatter } from \"../../grid/slick.formatters\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nfunction columns(editable = false): ISlickColumn[] {\n return [\n { id: \"id\", name: \"ID\", width: 65, sortable: true },\n { id: \"name\", name: \"Project\", width: 250, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"team\", name: \"Team\", width: 145, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\", editor: editable ? NumericEditor : undefined },\n { id: \"date\", name: \"Start date\", width: 135, sortable: true, formatter: DateFormatter, editor: editable ? DateEditor : undefined },\n { id: \"approved\", name: \"Approved\", width: 100, headerCssClass: \"center\", formatter: CheckboxFormatter, editor: editable ? BooleanEditor : undefined }\n ];\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nconst edits: IJSLVNode = { tag: \"p\", content: \"Edit a project, budget, date, or approval value.\", attr: { role: \"status\", class: \"sample-status\" } };\n\nconst editable = new GridComponent(data(25), columns(true), { primaryKey: \"id\", editable: true, autoEdit: false }, \"300px\");\n\neditable.initEvents(grid => grid.onAfterEdit.subscribe((_event, args) => {\n edits.content = \"Updated \" + args.column.name + \" for project \" + args.item.id + \".\";\n // Grid events run independently of the showcase renderer.\n JSLRender.lastCreatedRenderer?.refresh();\n}));\n\nconst large = new GridComponent(data(10000), columns(), { primaryKey: \"id\", rowHeight: 28 }, \"320px\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-large\", \"A larger dataset\", \"10,000 rows with an explicit rowHeight of 28 px. This example also checks that applications can retain the original density.\", large)\n);",
77
+ "grid-reorder": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode, JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { ISlickColumn } from \"../../grid/slick.core\";\nimport { TextEditor, NumericEditor, BooleanEditor } from \"../../grid/slick.editors.core\";\nimport { DateEditor } from \"../../grid/slick.editors.date\";\nimport { CheckboxFormatter, DateFormatter, NumericFormatter } from \"../../grid/slick.formatters\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nfunction columns(editable = false): ISlickColumn[] {\n return [\n { id: \"id\", name: \"ID\", width: 65, sortable: true },\n { id: \"name\", name: \"Project\", width: 250, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"team\", name: \"Team\", width: 145, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\", editor: editable ? NumericEditor : undefined },\n { id: \"date\", name: \"Start date\", width: 135, sortable: true, formatter: DateFormatter, editor: editable ? DateEditor : undefined },\n { id: \"approved\", name: \"Approved\", width: 100, headerCssClass: \"center\", formatter: CheckboxFormatter, editor: editable ? BooleanEditor : undefined }\n ];\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nconst edits: IJSLVNode = { tag: \"p\", content: \"Edit a project, budget, date, or approval value.\", attr: { role: \"status\", class: \"sample-status\" } };\n\nconst editable = new GridComponent(data(25), columns(true), { primaryKey: \"id\", editable: true, autoEdit: false }, \"300px\");\n\neditable.initEvents(grid => grid.onAfterEdit.subscribe((_event, args) => {\n edits.content = \"Updated \" + args.column.name + \" for project \" + args.item.id + \".\";\n // Grid events run independently of the showcase renderer.\n JSLRender.lastCreatedRenderer?.refresh();\n}));\n\nconst orderStatus: IJSLVNode = { tag: \"p\", content: \"Drag a handle to change the project order.\", attr: { role: \"status\", class: \"sample-status\" } };\n\nconst reorder = new GridComponent(data(15), [\n { id: \"_move\", name: \"\", width: 36, minWidth: 36, maxWidth: 36, resizable: false, selectable: false,\n behavior: \"selectAndMove\", cssClass: \"grid-row-handle\", toolTip: \"Drag to reorder\", formatter: () => '<span aria-hidden=\"true\">⠿</span>' },\n { id: \"priority\", name: \"Order\", width: 75, headerCssClass: \"center\", formatter: row => ({ text: String(row + 1), addClasses: [\"center\", \"tabular-nums\"] }) },\n ...columns().filter(column => column.id !== \"id\").map(column => ({ ...column, sortable: false }))\n], { primaryKey: \"id\", allowRowMove: true, enableColumnReorder: false }, \"320px\");\n\nreorder.initEvents(grid => grid.dataView.onRowsChanged.subscribe(() => {\n orderStatus.content = \"Project order: \" + grid.getData().map(item => item.id).join(\", \") + \".\";\n JSLRender.lastCreatedRenderer?.refresh();\n}));\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-reorder\", \"Arrange project priorities\", \"Drag a handle in the first column to move a project. The Order column follows its position while project IDs remain unchanged. Sorting is disabled here so it does not override the manual order.\", reorder, [orderStatus])\n);",
78
+ "grid-editable": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode, JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { ISlickColumn } from \"../../grid/slick.core\";\nimport { TextEditor, NumericEditor, BooleanEditor } from \"../../grid/slick.editors.core\";\nimport { DateEditor } from \"../../grid/slick.editors.date\";\nimport { CheckboxFormatter, DateFormatter, NumericFormatter } from \"../../grid/slick.formatters\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nfunction columns(editable = false): ISlickColumn[] {\n return [\n { id: \"id\", name: \"ID\", width: 65, sortable: true },\n { id: \"name\", name: \"Project\", width: 250, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"team\", name: \"Team\", width: 145, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\", editor: editable ? NumericEditor : undefined },\n { id: \"date\", name: \"Start date\", width: 135, sortable: true, formatter: DateFormatter, editor: editable ? DateEditor : undefined },\n { id: \"approved\", name: \"Approved\", width: 100, headerCssClass: \"center\", formatter: CheckboxFormatter, editor: editable ? BooleanEditor : undefined }\n ];\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nconst edits: IJSLVNode = { tag: \"p\", content: \"Edit a project, budget, date, or approval value.\", attr: { role: \"status\", class: \"sample-status\" } };\n\nconst editable = new GridComponent(data(25), columns(true), { primaryKey: \"id\", editable: true, autoEdit: false }, \"300px\");\n\neditable.initEvents(grid => grid.onAfterEdit.subscribe((_event, args) => {\n edits.content = \"Updated \" + args.column.name + \" for project \" + args.item.id + \".\";\n // Grid events run independently of the showcase renderer.\n JSLRender.lastCreatedRenderer?.refresh();\n}));\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-editable\", \"Edit in place\", \"Double-click an editable cell. Enter commits and Escape cancels. Editors retain their existing behavior and styling in this step.\", editable, [edits])\n);",
79
+ "grid-editors-formatters": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode, JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { ISlickColumn } from \"../../grid/slick.core\";\nimport { TextEditor, MultiLineTextEditor, NumericEditor, BooleanEditor } from \"../../grid/slick.editors.core\";\nimport { DateEditor, TimeEditor } from \"../../grid/slick.editors.date\";\nimport { AutoSuggestEditor, LookupEditor, MultiLookupEditor } from \"../../grid/slick.editors.lookup\";\nimport { CheckboxFormatter, DateFormatter, DateTimeFormatter, LookupFormatter, MultiLineTextFormatter, MultiLookupFormatter, NumericFormatter, TextFormatter, TimeFormatter, TooltipFormatter, YesNoFormatter } from \"../../grid/slick.formatters\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nfunction columns(editable = false): ISlickColumn[] {\n return [\n { id: \"id\", name: \"ID\", width: 65, sortable: true },\n { id: \"name\", name: \"Project\", width: 250, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"team\", name: \"Team\", width: 145, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\", editor: editable ? NumericEditor : undefined },\n { id: \"date\", name: \"Start date\", width: 135, sortable: true, formatter: DateFormatter, editor: editable ? DateEditor : undefined },\n { id: \"approved\", name: \"Approved\", width: 100, headerCssClass: \"center\", formatter: CheckboxFormatter, editor: editable ? BooleanEditor : undefined }\n ];\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nconst edits: IJSLVNode = { tag: \"p\", content: \"Edit a project, budget, date, or approval value.\", attr: { role: \"status\", class: \"sample-status\" } };\n\nconst editable = new GridComponent(data(25), columns(true), { primaryKey: \"id\", editable: true, autoEdit: false }, \"300px\");\n\neditable.initEvents(grid => grid.onAfterEdit.subscribe((_event, args) => {\n edits.content = \"Updated \" + args.column.name + \" for project \" + args.item.id + \".\";\n // Grid events run independently of the showcase renderer.\n JSLRender.lastCreatedRenderer?.refresh();\n}));\n\ninterface EditorSample {\n id: number;\n title: string;\n notes: string;\n amount: number;\n start: Date;\n startTime: string;\n meeting: Date;\n approved: boolean;\n completed: boolean;\n status: string;\n tags: string[];\n owner: string;\n detail: string;\n}\n\nconst editorValueList = [\n { text: \"Planning\", value: \"planning\" },\n { text: \"In progress\", value: \"in-progress\" },\n { text: \"In review\", value: \"in-review\" },\n { text: \"Complete\", value: \"complete\" }\n];\n\nconst editorSamples: EditorSample[] = Array.from({ length: 8 }, (_, index) => ({\n id: index + 1,\n title: [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\"][index % 4],\n notes: [\"Review the latest proposal\", \"Collect feedback from the team\", \"Prepare the next milestone\"][index % 3],\n amount: 1250 + index * 175.5,\n start: new Date(2026, 9, 2 + index),\n startTime: [\"09:00\", \"10:30\", \"13:15\", \"15:45\"][index % 4],\n meeting: new Date(2026, 9, 2 + index, 9 + index % 8, 30),\n approved: index % 2 === 0,\n completed: index % 3 === 0,\n status: [\"planning\", \"in-progress\", \"in-review\", \"complete\"][index % 4],\n tags: index % 2 === 0 ? [\"Design\", \"Internal\"] : [\"Customer\", \"Research\"],\n owner: [\"Alex Morgan\", \"Sam Weber\", \"Jordan Lee\", \"Robin Taylor\"][index % 4],\n detail: \"Updated by the project team. Hover this cell to see the full tooltip text.\"\n}));\n\nconst editorSampleColumns: ISlickColumn[] = [\n { id: \"title\", name: \"Text\", width: 155, formatter: TextFormatter, editor: TextEditor },\n { id: \"notes\", name: \"Multiline text\", width: 185, formatter: MultiLineTextFormatter, editor: MultiLineTextEditor },\n { id: \"amount\", name: \"Number\", width: 115, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0.00\", editor: NumericEditor },\n { id: \"start\", name: \"Date\", width: 125, formatter: DateFormatter, editor: DateEditor },\n { id: \"startTime\", name: \"Time input\", width: 115, formatter: TextFormatter, editor: TimeEditor },\n { id: \"meeting\", name: \"Time display\", width: 110, formatter: TimeFormatter },\n { id: \"meetingDateTime\", field: \"meeting\", name: \"Date & time\", width: 165, formatter: DateTimeFormatter },\n { id: \"approved\", name: \"Checkbox\", width: 100, headerCssClass: \"center\", formatter: CheckboxFormatter, editor: BooleanEditor },\n { id: \"completed\", name: \"Yes / no\", width: 95, formatter: YesNoFormatter, editor: BooleanEditor },\n { id: \"status\", name: \"Lookup\", width: 130, formatter: LookupFormatter, valueList: editorValueList, editor: LookupEditor },\n { id: \"tags\", name: \"Multi-lookup\", width: 175, formatter: MultiLookupFormatter, valueList: [\"Design\", \"Internal\", \"Customer\", \"Research\"], editor: MultiLookupEditor },\n { id: \"owner\", name: \"Autosuggest\", width: 145, formatter: LookupFormatter, valueList: [\"Alex Morgan\", \"Sam Weber\", \"Jordan Lee\", \"Robin Taylor\"], editor: AutoSuggestEditor },\n { id: \"detail\", name: \"Tooltip\", width: 230, formatter: TooltipFormatter, editor: TextEditor }\n];\n\nconst editorCatalog = new GridComponent(editorSamples, editorSampleColumns, {\n primaryKey: \"id\", editable: true, autoEdit: false, rowHeight: 38\n}, \"340px\");\n\nconst editorCatalogStatus: IJSLVNode = { tag: \"p\", content: \"Double-click a cell to edit. Enter commits; Escape cancels.\", attr: { role: \"status\", class: \"sample-status\" } };\n\neditorCatalog.initEvents(grid => grid.onAfterEdit.subscribe((_event, args) => {\n editorCatalogStatus.content = \"Updated \" + args.column.name + \" for sample \" + args.item.id + \".\";\n JSLRender.lastCreatedRenderer?.refresh();\n}));\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-editors-formatters\", \"Formatters and editors\", \"Try text, multiline, numeric, date, time, boolean, lookup, multi-lookup, and autosuggest editors. The adjacent columns demonstrate the matching display formatters; TimeFormatter displays a Date value, while TimeEditor edits a time string.\", editorCatalog, [editorCatalogStatus])\n);",
80
+ "grid-grouped": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode, JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { ISlickColumn } from \"../../grid/slick.core\";\nimport { SumAggregator } from \"../../grid/slick.dataview\";\nimport { TextEditor, NumericEditor, BooleanEditor } from \"../../grid/slick.editors.core\";\nimport { DateEditor } from \"../../grid/slick.editors.date\";\nimport { CheckboxFormatter, DateFormatter, NumericFormatter } from \"../../grid/slick.formatters\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { numeric } from \"../../core/numeric\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nfunction columns(editable = false): ISlickColumn[] {\n return [\n { id: \"id\", name: \"ID\", width: 65, sortable: true },\n { id: \"name\", name: \"Project\", width: 250, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"team\", name: \"Team\", width: 145, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\", editor: editable ? NumericEditor : undefined },\n { id: \"date\", name: \"Start date\", width: 135, sortable: true, formatter: DateFormatter, editor: editable ? DateEditor : undefined },\n { id: \"approved\", name: \"Approved\", width: 100, headerCssClass: \"center\", formatter: CheckboxFormatter, editor: editable ? BooleanEditor : undefined }\n ];\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: \"button\", outlined: true, size: \"small\" });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nconst edits: IJSLVNode = { tag: \"p\", content: \"Edit a project, budget, date, or approval value.\", attr: { role: \"status\", class: \"sample-status\" } };\n\nconst editable = new GridComponent(data(25), columns(true), { primaryKey: \"id\", editable: true, autoEdit: false }, \"300px\");\n\neditable.initEvents(grid => grid.onAfterEdit.subscribe((_event, args) => {\n edits.content = \"Updated \" + args.column.name + \" for project \" + args.item.id + \".\";\n // Grid events run independently of the showcase renderer.\n JSLRender.lastCreatedRenderer?.refresh();\n}));\n\nconst grouped = new GridComponent(data(45), columns().map(column => column.id === \"budget\" ? {\n ...column, groupTotalsFormatter: totals => ({ text: numeric.format(totals.sum.budget, \"#,0\"), addClasses: [\"right\", \"tabular-nums\"] })\n} : column.id === \"name\" ? { ...column, groupTotalsFormatter: () => \"Team total\" } : column), { primaryKey: \"id\" }, \"320px\");\n\ngrouped.initEvents(grid => grid.dataView.setGrouping({\n getter: \"team\", formatter: group => group.value + \" · \" + group.count + \" projects\",\n aggregators: [new SumAggregator(\"budget\")], displayTotalsRow: true, aggregateCollapsed: true\n}));\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-grouped\", \"Grouped projects & totals\", \"45 projects grouped by team, with a budget total for each group. Expand and collapse groups independently; totals remain visible when a group is collapsed.\", grouped, [\n { tag: \"div\", attr: { class: \"sample-row\" }, children: [\n action(\"Collapse groups\", () => { grouped.getRef().then(grid => grid.dataView.collapseAllGroups()); }),\n action(\"Expand groups\", () => { grouped.getRef().then(grid => grid.dataView.expandAllGroups()); })\n ] }\n ])\n);",
81
+ "grid-costing": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode, JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { ISlickColumn } from \"../../grid/slick.core\";\nimport { TextEditor, NumericEditor, BooleanEditor } from \"../../grid/slick.editors.core\";\nimport { DateEditor } from \"../../grid/slick.editors.date\";\nimport { CheckboxFormatter, DateFormatter, NumericFormatter } from \"../../grid/slick.formatters\";\nimport { numeric } from \"../../core/numeric\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nfunction columns(editable = false): ISlickColumn[] {\n return [\n { id: \"id\", name: \"ID\", width: 65, sortable: true },\n { id: \"name\", name: \"Project\", width: 250, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"team\", name: \"Team\", width: 145, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\", editor: editable ? NumericEditor : undefined },\n { id: \"date\", name: \"Start date\", width: 135, sortable: true, formatter: DateFormatter, editor: editable ? DateEditor : undefined },\n { id: \"approved\", name: \"Approved\", width: 100, headerCssClass: \"center\", formatter: CheckboxFormatter, editor: editable ? BooleanEditor : undefined }\n ];\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nconst edits: IJSLVNode = { tag: \"p\", content: \"Edit a project, budget, date, or approval value.\", attr: { role: \"status\", class: \"sample-status\" } };\n\nconst editable = new GridComponent(data(25), columns(true), { primaryKey: \"id\", editable: true, autoEdit: false }, \"300px\");\n\neditable.initEvents(grid => grid.onAfterEdit.subscribe((_event, args) => {\n edits.content = \"Updated \" + args.column.name + \" for project \" + args.item.id + \".\";\n // Grid events run independently of the showcase renderer.\n JSLRender.lastCreatedRenderer?.refresh();\n}));\n\nconst costingData = data(12).map((project, index) => ({\n ...project, hours: 16 + index * 4, rate: 85 + index % 3 * 15, cost: 0\n}));\n\nconst costingColumns: ISlickColumn[] = [\n { id: \"id\", name: \"ID\", width: 65, columnGroup: \"Project\" },\n { id: \"name\", name: \"Project\", width: 240, columnGroup: \"Project\", editor: TextEditor },\n { id: \"team\", name: \"Team\", width: 140, columnGroup: \"Project\" },\n { id: \"hours\", name: \"Hours\", width: 120, columnGroup: \"Costing\", headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0.00\", editor: NumericEditor },\n { id: \"rate\", name: \"Hourly rate\", width: 135, columnGroup: \"Costing\", headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0.00\", editor: NumericEditor },\n { id: \"cost\", name: \"Estimated cost\", width: 160, columnGroup: \"Costing\", headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0.00\", readonly: true, toolTip: \"Calculated: hours × hourly rate\" },\n { id: \"date\", name: \"Start date\", width: 140, columnGroup: \"Schedule\", formatter: DateFormatter }\n];\n\nconst costing = new GridComponent(costingData, costingColumns, {\n primaryKey: \"id\", editable: true, autoEdit: false, showColumnGroups: true,\n preHeaderPanelHeight: 37, createFooterRow: true, showFooterRow: true, footerRowHeight: 36,\n enableColumnReorder: false\n}, \"380px\");\n\ncosting.initEvents(grid => {\n grid.addFormula(\"cost\", item => (item.hours || 0) * (item.rate || 0), [\"hours\", \"rate\"]);\n grid.triggerAllFormulas();\n const updateTotals = () => {\n const label = grid.getFooterRowColumn(\"name\");\n if (label) { label.textContent = \"Total\"; }\n for (const field of [\"hours\", \"cost\"] as const) {\n const footer = grid.getFooterRowColumn(field);\n if (footer) {\n footer.classList.add(\"right\", \"tabular-nums\");\n footer.textContent = numeric.format(grid.getData().reduce((sum, item) => sum + item[field], 0), \"#,0.00\");\n }\n }\n };\n grid.onAfterEdit.subscribe(updateTotals);\n grid.onFooterRowCellRendered.subscribe(updateTotals);\n updateTotals();\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-costing\", \"Column groups, formulas & totals\", \"Project, Costing, and Schedule headers group related columns. Double-click Hours or Hourly rate to edit: the grid formula recalculates Estimated cost, and the footer updates the totals.\", costing, [\n { tag: \"pre\", content: 'grid.addFormula(\"cost\", item => item.hours * item.rate, [\"hours\", \"rate\"]);', attr: { class: \"sample-code\" } }\n ])\n);",
82
+ "grid-hierarchy": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { GridTree, IndentFormatter } from \"../../grid/slick.tree\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\ninterface HierarchyItem { id: number; parent?: number; name: string; owner: string; }\n\nconst hierarchyData: HierarchyItem[] = [\n { id: 1, name: \"Website refresh\", owner: \"Design\" },\n { id: 2, parent: 1, name: \"Research\", owner: \"Research\" },\n { id: 3, parent: 2, name: \"Interview customers\", owner: \"Sam\" },\n { id: 4, parent: 2, name: \"Summarize findings\", owner: \"Alex\" },\n { id: 5, parent: 1, name: \"Design new pages\", owner: \"Design\" },\n { id: 6, name: \"Mobile workspace\", owner: \"Engineering\" },\n { id: 7, parent: 6, name: \"Build prototype\", owner: \"Jordan\" },\n { id: 8, parent: 6, name: \"Review accessibility\", owner: \"Robin\" }\n];\n\nconst hierarchy = new GridComponent(hierarchyData, [\n { id: \"name\", name: \"Project / task\", width: 320, formatter: IndentFormatter },\n { id: \"owner\", name: \"Owner\", width: 160 }\n], { primaryKey: \"id\", enableColumnReorder: false }, \"320px\");\n\nhierarchy.initEvents(grid => { new GridTree(grid, { parentColumn: \"parent\" }); });\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-hierarchy\", \"Hierarchical projects & tasks\", \"Expand or collapse projects and their nested tasks. The grid uses parent IDs and an indented formatter to show the hierarchy.\", hierarchy)\n);",
83
+ "grid-cell-components": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode, JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { ComponentFormatter } from \"../../grid/slick.formatters\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { ProgressComponent } from \"../../components/progress/ProgressComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\ninterface ProgressRow { id: number; task: string; progress: number | null; }\n\nconst progressRows: ProgressRow[] = Array.from({ length: 8 }, (_, index) => ({\n id: index + 1, task: \"Process project \" + (index + 1), progress: null\n}));\n\nconst cellComponents = new GridComponent(progressRows, [\n { id: \"task\", name: \"Task\", width: 230 },\n { id: \"progress\", name: \"Progress\", width: 240, formatter: ComponentFormatter }\n], { primaryKey: \"id\", rowHeight: 48 }, \"320px\");\n\ncellComponents.initEvents(grid => {\n grid.onAppendCell.subscribe((_event, args) => {\n if (args.column.id !== \"progress\" || !args.item) return;\n const item = args.item;\n const renderer = new JSLRender(args.dom);\n if (item.progress == null) {\n renderer.render(new ButtonComponent({ content: \"Start\", type: \"button\", size: \"small\", click: () => {\n if (item.progress != null) return;\n const start = performance.now();\n item.progress = 0;\n grid.refreshDataItem(item);\n const tick = () => {\n if (!grid.getContainerNode().isConnected) return;\n item.progress = Math.min(100, Math.floor((performance.now() - start) / 50));\n grid.refreshDataItem(item);\n if (item.progress < 100) window.setTimeout(tick, 100);\n };\n window.setTimeout(tick, 100);\n } }));\n } else {\n renderer.render(new ProgressComponent(item.progress, { showPercent: true, ariaLabel: item.task + \" progress\" }));\n }\n });\n grid.refresh();\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-cell-components\", \"Components inside cells\", \"Click Start to replace the button with a progress bar. Each task progresses independently from 0 to 100% over five seconds.\", cellComponents)\n);",
84
+ "grid-selection": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode, JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { ISlickColumn } from \"../../grid/slick.core\";\nimport { IJSLGrid } from \"../../grid/slick.creator\";\nimport { CellSelectionModel } from \"../../grid/plugins/slick.cellselectionmodel\";\nimport { RowSelectionModel } from \"../../grid/plugins/slick.rowselectionmodel\";\nimport { NumericFormatter } from \"../../grid/slick.formatters\";\nimport { numeric } from \"../../core/numeric\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\ninterface SelectionRow { id: number; project: string; hours: number; rate: number; cost: number; }\n\ninterface SelectionRange { fromRow: number; toRow: number; fromCell: number; toCell: number; }\n\nconst selectionData: SelectionRow[] = Array.from({ length: 8 }, (_, index) => ({\n id: index + 1, project: \"Project \" + (index + 1), hours: 10 + index * 5,\n rate: 80 + index * 10, cost: (10 + index * 5) * (80 + index * 10)\n}));\n\nconst selectionGrid = new GridComponent(selectionData, [\n { id: \"project\", name: \"Project\", width: 180 },\n { id: \"hours\", name: \"Hours\", width: 110, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\" },\n { id: \"rate\", name: \"Rate\", width: 110, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\" },\n { id: \"cost\", name: \"Cost\", width: 120, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\" }\n], { primaryKey: \"id\", enableColumnReorder: false }, \"320px\");\n\nconst selectionSummary: IJSLVNode = { tag: \"p\", content: \"No rows selected.\", attr: { class: \"sample-status grid-selection-summary\", role: \"status\" } };\n\nlet selectionMode: \"row\" | \"cell\" = \"row\";\n\nfunction updateSelectionSummary(grid: IJSLGrid<SelectionRow>, ranges: SelectionRange[]) {\n const cells = new Map<string, { row: SelectionRow; column: ISlickColumn; value: unknown }>();\n for (const range of ranges) {\n for (let row = range.fromRow; row <= range.toRow; row++) {\n for (let cell = range.fromCell; cell <= range.toCell; cell++) {\n const item = grid.getDataItem(row), column = grid.getColumns()[cell];\n if (item && column) cells.set(row + \":\" + cell, { row: item, column, value: item[column.field || column.id] });\n }\n }\n }\n if (selectionMode === \"row\") {\n const rows = Array.from(new Map(Array.from(cells.values(), entry => [entry.row.id, entry.row])).values());\n selectionSummary.content = rows.length ? \"Selected rows: \" + rows.map(row => row.project).join(\", \") + \".\" : \"No rows selected.\";\n } else {\n const selected = Array.from(cells.values());\n const values = selected.map(entry => entry.value).filter((value): value is number => typeof value === \"number\" && Number.isFinite(value));\n const sum = values.reduce((total, value) => total + value, 0);\n selectionSummary.content = selected.length\n ? selected.length + \" cells selected - Sum: \" + numeric.format(sum, \"#,0.00\") + \" - Avg: \" + (values.length ? numeric.format(sum / values.length, \"#,0.00\") : \"—\")\n : \"No cells selected.\";\n }\n JSLRender.lastCreatedRenderer?.refresh();\n}\n\nfunction setSelectionMode(grid: IJSLGrid<SelectionRow>, mode: \"row\" | \"cell\") {\n grid.getSelectionModel().setSelectedRanges([]);\n grid.resetActiveCell();\n selectionMode = mode;\n const model = mode === \"row\" ? new RowSelectionModel() : new CellSelectionModel();\n grid.setSelectionModel(model);\n model.onSelectedRangesChanged.subscribe((_event, ranges: SelectionRange[]) => updateSelectionSummary(grid, ranges));\n updateSelectionSummary(grid, []);\n}\n\nselectionGrid.initEvents(grid => setSelectionMode(grid, selectionMode));\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-selection\", \"Row and cell selection\", \"Choose a mode, then select rows or drag across cells. Use Ctrl or Command to add selections and Shift to extend them. Cell totals include numeric values only.\", selectionGrid, [\n { tag: \"label\", attr: { class: \"grid-selection-mode\", for: \"grid-selection-mode\" }, children: [\n text(\"span\", \"Selection mode\"),\n { tag: \"select\", attr: { id: \"grid-selection-mode\", change: (event: Event) => {\n const mode = (event.target as HTMLSelectElement).value as \"row\" | \"cell\";\n selectionGrid.getRef().then(grid => setSelectionMode(grid, mode));\n } }, children: [\n { tag: \"option\", attr: { value: \"row\" }, content: \"Rows\" },\n { tag: \"option\", attr: { value: \"cell\" }, content: \"Cells\" }\n ] }\n ] }\n ], undefined, [selectionSummary])\n);",
85
+ "grid-variable-height": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { MultiLineTextFormatter, NumericFormatter } from \"../../grid/slick.formatters\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nconst variableHeightData = Array.from({ length: 60 }, (_, index) => {\n const samples = [\n { height: 40, note: \"Ready for review.\" },\n { height: 80, note: \"Collect feedback from the project team and agree on the next milestone.\" },\n { height: 120, note: \"Review the research findings with the team. Summarize the open questions and prepare recommendations for the next planning session.\" }\n ];\n const sample = samples[index % samples.length];\n return { id: index + 1, project: \"Project \" + (index + 1), note: sample.note, __height: sample.height };\n});\n\nconst variableHeight = new GridComponent(variableHeightData, [\n { id: \"id\", name: \"ID\", width: 65 },\n { id: \"project\", name: \"Project\", width: 150 },\n { id: \"note\", name: \"Update\", width: 350, formatter: MultiLineTextFormatter },\n { id: \"__height\", name: \"Height (px)\", width: 110, headerCssClass: \"right\", formatter: NumericFormatter }\n], { primaryKey: \"id\", rowHeight: 40, variableRowHeight: true }, \"320px\");\n\nconst variableHeightSource = `import \"../../ui/base.css\";\nimport { JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { MultiLineTextFormatter, NumericFormatter } from \"../../grid/slick.formatters\";\n\nconst items = Array.from({ length: 60 }, (_, index) => {\n const samples = [\n { height: 40, note: \"Ready for review.\" },\n { height: 80, note: \"Collect feedback from the project team and agree on the next milestone.\" },\n { height: 120, note: \"Review the research findings with the team. Summarize the open questions and prepare recommendations for the next planning session.\" }\n ];\n const sample = samples[index % samples.length];\n return { id: index + 1, project: \"Project \" + (index + 1), note: sample.note, __height: sample.height };\n});\n\nconst grid = new GridComponent(items, [\n { id: \"id\", name: \"ID\", width: 65 },\n { id: \"project\", name: \"Project\", width: 150 },\n { id: \"note\", name: \"Update\", width: 350, formatter: MultiLineTextFormatter },\n { id: \"__height\", name: \"Height (px)\", width: 110, headerCssClass: \"right\", formatter: NumericFormatter }\n], { primaryKey: \"id\", rowHeight: 40, variableRowHeight: true }, \"320px\");\n\n// Add <div id=\"grid\"></div> to the page.\nnew JSLRender(document.getElementById(\"grid\"), true).render(grid);`;\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-variable-height\", \"Variable row heights\", \"Scroll through 60 projects with 40, 80, and 120 px rows. Each item's __height controls its height; the Update column wraps its text. Row heights are explicit and do not automatically adjust when a column is resized.\", variableHeight, [], variableHeightSource)\n);",
86
+ "grid-grouped-variable-height": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLVNode, JSLRender } from \"jsl-render\";\nimport { GridComponent } from \"../../components/grid/GridComponent\";\nimport { ISlickColumn } from \"../../grid/slick.core\";\nimport { TextEditor, NumericEditor, BooleanEditor } from \"../../grid/slick.editors.core\";\nimport { DateEditor } from \"../../grid/slick.editors.date\";\nimport { CheckboxFormatter, DateFormatter, NumericFormatter } from \"../../grid/slick.formatters\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ninterface Project { id: number; name: string; team: string; budget: number; date: Date; approved: boolean; }\n\nfunction data(count: number): Project[] {\n const names = [\"Design system\", \"Website refresh\", \"Customer research\", \"Mobile workspace\", \"Reporting tools\"];\n return Array.from({ length: count }, (_, index) => ({\n id: index + 1, name: names[index % names.length] + \" \" + (index + 1),\n team: [\"Design\", \"Engineering\", \"Operations\"][index % 3], budget: 1500 + index * 125,\n date: new Date(2026, 9, 1 + index % 28), approved: index % 3 !== 0\n }));\n}\n\nfunction columns(editable = false): ISlickColumn[] {\n return [\n { id: \"id\", name: \"ID\", width: 65, sortable: true },\n { id: \"name\", name: \"Project\", width: 250, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"team\", name: \"Team\", width: 145, sortable: true, editor: editable ? TextEditor : undefined },\n { id: \"budget\", name: \"Budget\", width: 125, sortable: true, headerCssClass: \"right\", formatter: NumericFormatter, format: \"#,0\", editor: editable ? NumericEditor : undefined },\n { id: \"date\", name: \"Start date\", width: 135, sortable: true, formatter: DateFormatter, editor: editable ? DateEditor : undefined },\n { id: \"approved\", name: \"Approved\", width: 100, headerCssClass: \"center\", formatter: CheckboxFormatter, editor: editable ? BooleanEditor : undefined }\n ];\n}\n\nconst text = (tag: string, content: string): IJSLVNode => ({ tag, content });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: \"button\", outlined: true, size: \"small\" });\n\nfunction card<T>(id: string, title: string, description: string, grid: GridComponent<T>, extras: any[] = [], source?: string, after: IJSLVNode[] = []): IJSLVNode {\n return { tag: \"article\", attr: { id, class: \"sample-card grid-sample-card\" }, children: [\n text(\"h3\", title), { tag: \"p\", content: description, attr: { class: \"card-description\" } },\n ...extras, { tag: \"div\", attr: { class: \"grid-sample-host\" }, children: [grid] }, ...after,\n ...(source ? [{ tag: \"details\", attr: { class: \"showcase-source\" }, children: [\n text(\"summary\", \"Show code\"),\n { tag: \"pre\", attr: { class: \"sample-code showcase-source-code\" }, children: [{ tag: \"code\", content: source }] }\n ] }] : [])\n ] };\n}\n\nconst edits: IJSLVNode = { tag: \"p\", content: \"Edit a project, budget, date, or approval value.\", attr: { role: \"status\", class: \"sample-status\" } };\n\nconst editable = new GridComponent(data(25), columns(true), { primaryKey: \"id\", editable: true, autoEdit: false }, \"300px\");\n\neditable.initEvents(grid => grid.onAfterEdit.subscribe((_event, args) => {\n edits.content = \"Updated \" + args.column.name + \" for project \" + args.item.id + \".\";\n // Grid events run independently of the showcase renderer.\n JSLRender.lastCreatedRenderer?.refresh();\n}));\n\nconst groupedVariableHeight = new GridComponent(\n data(45).map(project => ({ ...project, __height: 80 })),\n columns(),\n { primaryKey: \"id\", rowHeight: 40, variableRowHeight: true },\n \"320px\"\n);\n\ngroupedVariableHeight.initEvents(grid => grid.dataView.setGrouping({\n getter: \"team\", formatter: group => group.value + \" · \" + group.count + \" projects\", aggregators: [], displayTotalsRow: false\n}));\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"grid-grouped-variable-height\", \"Grouped rows keep their default height\", \"Projects are grouped by team. Group headers use the default 40 px row height, while each project row is 80 px. Expand and collapse groups to see the heights remain in place.\", groupedVariableHeight, [\n { tag: \"div\", attr: { class: \"sample-row\" }, children: [\n action(\"Collapse groups\", () => { groupedVariableHeight.getRef().then(grid => grid.dataView.collapseAllGroups()); }),\n action(\"Expand groups\", () => { groupedVariableHeight.getRef().then(grid => grid.dataView.expandAllGroups()); })\n ] },\n { tag: \"pre\", content: 'const items = projects.map(project => ({ ...project, __height: 80 }));\\nnew GridComponent(items, columns, {\\n primaryKey: \"id\", rowHeight: 40, variableRowHeight: true\\n});', attr: { class: \"sample-code\" } }\n ])\n);",
87
+ "dropdown-actions": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode, JSLRender } from \"jsl-render\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { DropdownMenuComponent } from \"../../components/dropdown-menu/DropdownMenuComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className = \"sample-row\"): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({\n content, type: \"button\", class: \"jsl-button jsl-button-ghost\", click\n});\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n group([text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nfunction updateMessage(target: IJSLVNode, message: string): void {\n target.content = message;\n JSLRender.lastCreatedRenderer?.refresh();\n}\n\nconst previewStatus = status(\"Choose a menu action.\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"dropdown-actions\", \"01\", \"Choose an action\", \"Menu items can be buttons or links. closeOnClick closes after selection and returns focus to the trigger.\", [\n group([new DropdownMenuComponent({\n content: \"More actions\", class: \"jsl-button jsl-button-outline\", menuLabel: \"More actions\",\n closeOnClick: true, placement: \"bottom-start\", width: \"13rem\",\n children: [\n action(\"Share\", () => updateMessage(previewStatus, \"Share selected.\")),\n action(\"Copy link\", () => updateMessage(previewStatus, \"Link copied.\")),\n action(\"Delete\", () => updateMessage(previewStatus, \"Delete selected.\"))\n ]\n }), previewStatus])\n ])\n);",
88
+ "dropdown-dynamic": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode, JSLRender } from \"jsl-render\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { DropdownMenuComponent } from \"../../components/dropdown-menu/DropdownMenuComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className = \"sample-row\"): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({\n content, type: \"button\", class: \"jsl-button jsl-button-ghost\", click\n});\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n group([text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nfunction updateMessage(target: IJSLVNode, message: string): void {\n target.content = message;\n JSLRender.lastCreatedRenderer?.refresh();\n}\n\nconst dynamicStatus = status(\"Open the menu to refresh its items.\");\n\nlet openCount = 0;\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"dropdown-dynamic\", \"02\", \"Refresh items when opened\", \"Use onOpen to build a menu from current application data. Return false from the callback to veto opening.\", [\n group([new DropdownMenuComponent({\n content: \"Recent reports\", class: \"jsl-button jsl-button-outline\", menuLabel: \"Recent reports\",\n children: [], closeOnClick: true,\n onOpen: options => {\n openCount++;\n options.children = [\n action(\"Report \" + openCount, () => updateMessage(dynamicStatus, \"Report \" + openCount + \" opened.\")),\n action(\"Refresh list\", () => updateMessage(dynamicStatus, \"Report list refreshed.\"))\n ];\n }\n }), dynamicStatus])\n ])\n);",
89
+ "dropdown-placement": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode, JSLRender } from \"jsl-render\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { DropdownMenuComponent } from \"../../components/dropdown-menu/DropdownMenuComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className = \"sample-row\"): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({\n content, type: \"button\", class: \"jsl-button jsl-button-ghost\", click\n});\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id, \"aria-labelledby\": id + \"-title\" }, children: [\n group([text(\"span\", number, \"sample-number\"), { tag: \"h3\", content: title, attr: { id: id + \"-title\" } }], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nfunction updateMessage(target: IJSLVNode, message: string): void {\n target.content = message;\n JSLRender.lastCreatedRenderer?.refresh();\n}\n\nconst dynamicStatus = status(\"Open the menu to refresh its items.\");\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"dropdown-placement\", \"03\", \"Placement and disabled state\", \"The menu follows its trigger and adjusts near viewport edges. Custom trigger tags remain available for migration.\", [\n group([\n new DropdownMenuComponent({\n content: \"Top aligned\", class: \"jsl-button jsl-button-outline\", menuLabel: \"Top aligned actions\",\n placement: \"top-end\", offsetY: -4, children: [action(\"First action\", () => updateMessage(dynamicStatus, \"First action selected.\"))]\n }),\n new DropdownMenuComponent({\n content: \"Unavailable\", class: \"jsl-button jsl-button-outline\", disabled: true,\n children: [action(\"Hidden action\", () => undefined)]\n })\n ])\n ])\n);",
90
+ "binding-both-card": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { NumberComponent } from \"../../components/number/NumberComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: \"button\", outlined: true, size: \"small\" });\n\nconst field = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"binding-field\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h2\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst budgetModel = { cents: 12500 };\n\nconst budgetStatus = status(\"Model value: 12500 cents\");\n\nconst budgetInput = new NumberComponent({\n id: \"binding-both\", bindTo: budgetModel, property: \"cents\", bindMode: \"both\", format: \"0.00\",\n converter: { toUI: cents => cents / 100, toData: amount => amount == null ? null : Math.round(amount * 100) },\n onChange: () => { budgetStatus.content = \"Model value: \" + budgetModel.cents + \" cents\"; }\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"binding-both-card\", \"01\", \"Two way with a converter\", \"The control shows dollars while the model stores cents. Commits and setValue() write; changed model data refreshes the control.\", [\n field(\"binding-both\", \"Budget (dollars)\", budgetInput), budgetStatus,\n action(\"Set model to $250.00\", () => {\n budgetModel.cents = 25000;\n budgetStatus.content = \"Model value: 25000 cents\";\n }),\n text(\"pre\", 'new NumberComponent({\\n bindTo: model, property: \"cents\", bindMode: \"both\",\\n converter: {\\n toUI: cents => cents / 100,\\n toData: dollars => Math.round(dollars * 100)\\n }\\n});', \"sample-code\")\n ])\n);",
91
+ "binding-to-model-card": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { InputComponent } from \"../../components/input/InputComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst field = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"binding-field\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h2\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst createModel = { title: \"Waiting for the first commit\" };\n\nconst createStatus = status(\"Model value: Ready for review\");\n\nconst createInput = new InputComponent({\n id: \"binding-to-model\", value: \"Ready for review\", bindTo: createModel, property: \"title\", bindMode: \"toModel\",\n onChange: () => { createStatus.content = \"Model value: \" + createModel.title; }\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"binding-to-model-card\", \"02\", \"Control to model\", \"The control starts from its explicit value. On mount, that value initializes the model; later commits write back.\", [\n field(\"binding-to-model\", \"Project title\", createInput), createStatus,\n text(\"pre\", 'new InputComponent({\\n value: \"Ready for review\",\\n bindTo: model, property: \"title\",\\n bindMode: \"toModel\"\\n});', \"sample-code\")\n ])\n);",
92
+ "binding-from-model-card": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { CheckBoxComponent } from \"../../components/checkbox/CheckBoxComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: \"button\", outlined: true, size: \"small\" });\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h2\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst readModel = { subscribed: false };\n\nconst readStatus = status(\"Model value: off. Toggle the control to see that edits stay local.\");\n\nconst readCheck = new CheckBoxComponent({\n id: \"binding-from-model\", label: \"Send weekly updates\", bindTo: readModel, property: \"subscribed\", bindMode: \"fromModel\",\n onChange: value => { readStatus.content = \"Change event: \" + (value ? \"on\" : \"off\") + \"; model is still \" + (readModel.subscribed ? \"on\" : \"off\") + \".\"; }\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"binding-from-model-card\", \"03\", \"Model to control\", \"The model supplies the initial value and wins when it changes. A user change still raises onChange but does not write back.\", [\n readCheck, readStatus,\n group([action(\"Set model to on\", () => {\n readModel.subscribed = true;\n readStatus.content = \"Model value: on. The checkbox updates on render.\";\n }), action(\"Set model to off\", () => {\n readModel.subscribed = false;\n readStatus.content = \"Model value: off. The checkbox updates on render.\";\n })], \"sample-row\"),\n text(\"pre\", 'new CheckBoxComponent({\\n bindTo: model, property: \"subscribed\",\\n bindMode: \"fromModel\",\\n onChange: value => console.log(value)\\n});', \"sample-code\")\n ])\n);",
93
+ "binding-select-card": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { SelectComponent } from \"../../components/select/SelectComponent\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: \"button\", outlined: true, size: \"small\" });\n\nconst field = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"binding-field\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h2\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst projectOptions = [\n { value: \"website\", text: \"Website refresh\" },\n { value: \"library\", text: \"Component library\" },\n { value: \"research\", text: \"Customer research\" }\n];\n\nconst projectModel = { current: \"library\" };\n\nconst projectStatus = status(\"Model value: library\");\n\nconst projectSelect = new SelectComponent({\n id: \"binding-select\", data: projectOptions, bindTo: projectModel, property: \"current\", bindMode: \"both\",\n ariaLabel: \"Bound project\", placeholder: \"Choose a project\",\n onChange: value => { projectStatus.content = \"Model value: \" + (value ?? \"empty\"); }\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"binding-select-card\", \"04\", \"The same contract on Select\", \"Select stores option keys. A control change writes the key; changing the model updates the selected option on render.\", [\n field(\"binding-select\", \"Project\", projectSelect), projectStatus,\n action(\"Choose Website refresh in the model\", () => {\n projectModel.current = \"website\";\n projectStatus.content = \"Model value: website\";\n }),\n text(\"p\", \"Single selection uses a scalar key; multiple selection uses an array of keys.\", \"inline-note\")\n ])\n);",
94
+ "binding-datetime-card": "import \"../../ui/base.css\";\nimport \"./showcase.css\";\nimport { IJSLComponent, IJSLVNode } from \"jsl-render\";\nimport { ButtonComponent } from \"../../components/button/ButtonComponent\";\nimport { DateTimeComponent } from \"../../components/date-time/DateTimeComponent\";\nimport { date } from \"../../core/date\";\nimport { JSLRender as ExampleRenderer } from \"jsl-render\";\n\ntype Content = IJSLVNode | IJSLComponent;\n\nconst text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });\n\nconst group = (children: Content[], className?: string): IJSLVNode => ({ tag: \"div\", attr: { class: className }, children });\n\nconst status = (content: string): IJSLVNode => ({ tag: \"p\", content, attr: { class: \"sample-status\", role: \"status\" } });\n\nconst action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: \"button\", outlined: true, size: \"small\" });\n\nconst field = (id: string, label: string, control: Content) => group([\n { tag: \"label\", content: label, attr: { for: id } }, control\n], \"binding-field\");\n\nfunction card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {\n return { tag: \"article\", attr: { class: \"sample-card\", id }, children: [\n group([text(\"span\", number, \"sample-number\"), text(\"h2\", title)], \"card-heading\"),\n text(\"p\", description, \"card-description\"), ...children\n ] };\n}\n\nconst appointmentModel = { appointment: new Date(2026, 9, 21, 14, 45) };\n\nconst appointmentText = () => {\n const value = appointmentModel.appointment;\n return value ? \"Model value: \" + date.format(value) + \" at \" + date.formatTime(value, \"HourMinute\") : \"Model value: cleared\";\n};\n\nconst appointmentStatus = status(appointmentText());\n\nconst appointment = new DateTimeComponent({\n id: \"binding-datetime\", bindTo: appointmentModel, property: \"appointment\", bindMode: \"both\",\n onChange: () => { appointmentStatus.content = appointmentText(); }\n});\n\n// Add <div id=\"example\"></div> to the page.\nnew ExampleRenderer(document.getElementById(\"example\"), true).render(\n card(\"binding-datetime-card\", \"05\", \"Date and time share one value\", \"DateTime binds one Date across both fields. A partial entry stays local; clearing both fields writes null.\", [\n field(\"binding-datetime\", \"Appointment\", appointment), appointmentStatus,\n action(\"Move appointment to October 26\", () => {\n appointmentModel.appointment = new Date(2026, 9, 26, 11, 15);\n appointmentStatus.content = appointmentText();\n })\n ])\n);"
95
+ };