jsl-ui 10.4.4 → 10.4.5

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 (94) hide show
  1. package/docs/AutoSuggestComponent.md +17 -17
  2. package/docs/ButtonComponent.md +22 -22
  3. package/docs/CheckBoxComponent.md +12 -12
  4. package/docs/DataBinding.md +19 -19
  5. package/docs/DateComponent.md +12 -12
  6. package/docs/DateRangeComponent.md +13 -13
  7. package/docs/DateTimeComponent.md +14 -14
  8. package/docs/DialogComponent.md +15 -15
  9. package/docs/DropdownMenuComponent.md +22 -22
  10. package/docs/ExpanderComponent.md +13 -13
  11. package/docs/FormComponent.md +15 -15
  12. package/docs/FormFieldComponent.md +15 -15
  13. package/docs/GridComponent.md +39 -39
  14. package/docs/InputComponent.md +15 -15
  15. package/docs/IntervalComponent.md +13 -13
  16. package/docs/LoadingComponent.md +12 -12
  17. package/docs/NavigationComponent.md +17 -17
  18. package/docs/Notification.md +14 -14
  19. package/docs/NotificationComponent.md +13 -13
  20. package/docs/NumberComponent.md +12 -12
  21. package/docs/OverlayComponent.md +13 -13
  22. package/docs/ProgressComponent.md +12 -12
  23. package/docs/README.md +27 -27
  24. package/docs/RibbonMenuComponent.md +14 -14
  25. package/docs/SelectComponent.md +36 -36
  26. package/docs/SliderComponent.md +20 -20
  27. package/docs/SplitterComponent.md +14 -14
  28. package/docs/StackPanelComponent.md +13 -13
  29. package/docs/TabsComponent.md +16 -16
  30. package/docs/TimeComponent.md +13 -13
  31. package/docs/TreeViewComponent.md +16 -16
  32. package/examples/showcase/checks-and-expanders.ts +148 -148
  33. package/examples/showcase/cultures.ts +39 -39
  34. package/examples/showcase/data-binding.ts +138 -138
  35. package/examples/showcase/dates.ts +168 -168
  36. package/examples/showcase/dialogs.ts +184 -184
  37. package/examples/showcase/dropdown-menus.ts +99 -99
  38. package/examples/showcase/feedback-and-navigation.ts +173 -173
  39. package/examples/showcase/fields.ts +166 -166
  40. package/examples/showcase/fonts/OFL-BricolageGrotesque.txt +93 -93
  41. package/examples/showcase/fonts/OFL-Figtree.txt +93 -93
  42. package/examples/showcase/fonts/OFL-Jost.txt +93 -93
  43. package/examples/showcase/generate-sources.cjs +104 -104
  44. package/examples/showcase/grids.ts +484 -484
  45. package/examples/showcase/index.html +71 -71
  46. package/examples/showcase/layout-and-navigation.ts +46 -46
  47. package/examples/showcase/nivona.css +98 -98
  48. package/examples/showcase/package.json +10 -10
  49. package/examples/showcase/selects.ts +184 -184
  50. package/examples/showcase/showcase-sources.ts +94 -94
  51. package/examples/showcase/showcase.css +281 -281
  52. package/examples/showcase/showcase.ts +244 -244
  53. package/examples/showcase/tabs.ts +161 -161
  54. package/examples/showcase/themes.css +83 -83
  55. package/examples/showcase/themes.ts +56 -56
  56. package/examples/showcase/wirtshans.css +65 -65
  57. package/lib/components/checkbox/CheckBoxStyle.scss +73 -73
  58. package/lib/components/date-range/DateRangeStyle.scss +35 -35
  59. package/lib/components/date-time/DateTimeStyle.scss +9 -9
  60. package/lib/components/dialog/DialogComponent.d.ts +9 -2
  61. package/lib/components/dialog/DialogComponent.js +17 -51
  62. package/lib/components/dropdown-menu/DropdownMenuStyle.scss +48 -48
  63. package/lib/components/expander/ExpanderStyle.scss +61 -61
  64. package/lib/components/form-field/FormFieldStyle.scss +36 -36
  65. package/lib/components/host/RenderHost.d.ts +25 -0
  66. package/lib/components/host/RenderHost.js +63 -0
  67. package/lib/components/loading/LoadingStyle.css +18 -18
  68. package/lib/components/navigation/NavigationStyle.scss +61 -61
  69. package/lib/components/notification/Notification.scss +102 -102
  70. package/lib/components/overlay/OverlayComponent.d.ts +9 -1
  71. package/lib/components/overlay/OverlayComponent.js +22 -13
  72. package/lib/components/overlay/overlay.css +15 -15
  73. package/lib/components/progress/ProgressStyle.scss +4 -4
  74. package/lib/components/ribbon-menu/RibbonMenuStyle.scss +5 -5
  75. package/lib/components/select/SelectStyle.scss +207 -207
  76. package/lib/components/slider/SliderStyle.scss +21 -21
  77. package/lib/components/slider/nouislider.css +15 -15
  78. package/lib/components/stack-panel/SplitterStyle.scss +8 -8
  79. package/lib/components/stack-panel/StackPanelStyle.scss +10 -10
  80. package/lib/components/tabs/TabsStyle.scss +139 -139
  81. package/lib/components/time/TimeComponent.scss +3 -3
  82. package/lib/components/tree-view/TreeViewStyle.scss +14 -14
  83. package/lib/grid/plugins/slick.headermenu.css +98 -98
  84. package/lib/grid.css +841 -3514
  85. package/lib/index.css.map +1 -1
  86. package/lib/index.js.map +1 -1
  87. package/lib/ui/auto.suggest.css +30 -30
  88. package/lib/ui/button.css +147 -147
  89. package/lib/ui/date-input.css +10 -10
  90. package/lib/ui/date.picker/css/tiny-date-picker.css +124 -124
  91. package/lib/ui/dialog.css +144 -144
  92. package/lib/ui/input.css +35 -35
  93. package/lib/ui/theme.css +28 -28
  94. package/package.json +1 -1
@@ -1,174 +1,174 @@
1
- import { IJSLComponent, IJSLVNode, JSLRender } from "jsl-render";
2
- import { ButtonComponent } from "../../components/button/ButtonComponent";
3
- import { Notification, NotificationComponent, INotificationOptions } from "../../components/notification/Notification";
4
- import { LoadingComponent } from "../../components/loading/LoadingComponent";
5
- import { NavigationComponent } from "../../components/navigation/NavigationComponent";
6
-
7
- type Content = IJSLVNode | IJSLComponent;
8
- const text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });
9
- const group = (children: Content[], className?: string): IJSLVNode => ({ tag: "div", attr: { class: className }, children });
10
- const status = (content: string): IJSLVNode => ({ tag: "p", content, attr: { class: "sample-status", role: "status" } });
11
- const action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: "button", outlined: true, size: "small" });
12
- function card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {
13
- return { tag: "article", attr: { id, class: "sample-card" }, children: [
14
- group([text("span", number, "sample-number"), text("h3", title)], "card-heading"),
15
- text("p", description, "card-description"), ...children
16
- ] };
17
- }
18
- function section(id: string, number: string, title: string, description: string, preview: Content, cards: Content[], usage: Content[]): IJSLVNode {
19
- return { tag: "section", attr: { id, class: "component-section", "aria-labelledby": id + "-title" }, children: [
20
- group([
21
- group([text("p", "THE ESSENTIALS / " + number, "eyebrow"),
22
- { tag: "h2", content: title, attr: { id: id + "-title", class: "section-title" } },
23
- text("p", description, "hero-description")], "hero-copy"),
24
- group([text("span", "INTERACTIVE PREVIEW", "preview-caption"), preview], "hero-preview feedback-preview")
25
- ], "hero"),
26
- group(cards, "sample-grid feedback-sample-grid"),
27
- { tag: "details", attr: { class: "usage" }, children: [text("summary", title + " usage & compatibility"), ...usage] }
28
- ] };
29
- }
30
- const messageStatus = status("Notifications appear in the top-right corner.");
31
- let latestMessage: string;
32
- const notify = (options: INotificationOptions) => {
33
- latestMessage = Notification.show({ ...options, onClose: () => {
34
- messageStatus.content = "Notification dismissed.";
35
- options.onClose?.();
36
- JSLRender.lastCreatedRenderer?.refresh();
37
- } });
38
- messageStatus.content = "Notification shown.";
39
- };
40
- const variants: INotificationOptions["variant"][] = ["info", "success", "warning", "error"];
41
- const 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."];
42
- export const notificationShowcase = section("notifications", "14", "Notifications",
43
- "A little feedback, clearly delivered. Quiet surfaces with a distinct tone for each message.",
44
- new NotificationComponent({ title: "Changes saved", content: "Your team is up to date.", variant: "success", closeOnClick: false, showCloseButton: false }), [
45
- card("notification-tones", "01", "Feedback with a purpose", "Color supports the message; titles and text explain what happened. Try each live notification.", [
46
- group(variants.map((variant, index) => new NotificationComponent({
47
- title: ["For your information", "All done", "A quick heads-up", "Something went wrong"][index],
48
- content: messages[index], variant, closeOnClick: false, showCloseButton: false
49
- })), "notification-samples"),
50
- group(variants.map((variant, index) => action("Show " + variant, () => notify({ content: messages[index], variant }))), "sample-row")
51
- ]),
52
- 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.", [
53
- group([
54
- action("Show message", () => notify({ title: "A new update", content: "Click this message or its close button to dismiss it." })),
55
- action("Show action", () => {
56
- const id = Notification.show({
57
- title: "Item archived", closeOnClick: false, content: group([
58
- text("p", "You can restore the item if you change your mind."),
59
- action("Undo archive", () => { Notification.clearNotification(id); messageStatus.content = "Item restored."; JSLRender.lastCreatedRenderer?.refresh(); })
60
- ], "notification-action-copy")
61
- });
62
- latestMessage = id;
63
- }),
64
- action("Dismiss latest", () => Notification.clearNotification(latestMessage)),
65
- action("Dismiss all", () => Notification.clearAll())
66
- ], "sample-row"), messageStatus,
67
- 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")
68
- ]),
69
- 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.", [
70
- group([
71
- action("Show for 3 seconds", () => notify({ title: "Export complete", content: "Hover or focus this message to pause its timer.", timeOut: 3000, variant: "info" })),
72
- action("Show persistent message", () => notify({ title: "Review needed", content: "This message stays open until you dismiss it.", closeOnClick: false, variant: "warning" }))
73
- ], "sample-row")
74
- ])
75
- ], [
76
- text("p", "Notification.show(), clearNotification(), clearAll(), content, timeOut, closeOnClick, class, style, and onClick remain available. Messages still close when clicked by default. timeOut defaults to zero (persistent)."),
77
- text("p", "Add title, variant, showCloseButton, closeButtonLabel, or onClose. NotificationComponent uses the same surface inline. Informational messages use role=status; warning and error messages use role=alert. Motion follows the user's reduced-motion preference.")
78
- ]);
79
-
80
- class LoadingDemo implements IJSLComponent {
81
- public State = { busy: false, complete: false };
82
- private renderer: JSLRender;
83
- private timer: ReturnType<typeof setTimeout>;
84
- public onInit(renderer: JSLRender) { this.renderer = renderer; }
85
- public onRemove() { clearTimeout(this.timer); }
86
- public render(): IJSLVNode {
87
- return group([
88
- new ButtonComponent({ content: this.State.busy ? "Loading report…" : "Load report", enabled: !this.State.busy, type: "button", click: () => {
89
- this.State.busy = true; this.State.complete = false;
90
- this.timer = setTimeout(() => { this.State.busy = false; this.State.complete = true; this.renderer.refresh(); }, 1800);
91
- } }),
92
- { tag: "div", attr: { class: "loading-demo-panel", "aria-busy": String(this.State.busy) }, children: [
93
- this.State.busy ? new LoadingComponent({ sizeInRem: 1.25, label: "Fetching your report…", showLabel: true }) :
94
- text("p", this.State.complete ? "Your report is ready. 24 projects, all up to date." : "Load a report to try a brief loading state.")
95
- ] }
96
- ], "loading-demo");
97
- }
98
- }
99
- export const loadingShowcase = section("loading", "15", "Loading",
100
- "A small sign that work is happening. Theme-aware indicators with room for helpful context.",
101
- new LoadingComponent({ sizeInRem: 1.5, label: "Getting things ready…", showLabel: true }), [
102
- card("loading-sizes", "01", "From inline to centre stage", "The original numeric constructor still sets the ring's size in rem.", [
103
- group([1, 2, 3].map(size => group([new LoadingComponent(size), text("span", size + " rem", "size-caption")], "size-sample")), "sample-row size-row"),
104
- text("pre", 'new LoadingComponent(1);\nnew LoadingComponent(3);', "sample-code")
105
- ]),
106
- card("loading-labels", "02", "Say what's happening", "Provide a useful label when a task takes time. Labels remain accessible when visually hidden.", [
107
- group([
108
- new LoadingComponent({ sizeInRem: 1, label: "Saving changes…", showLabel: true }),
109
- new LoadingComponent({ sizeInRem: 1.5, label: "Syncing files…", showLabel: true, style: "--jsl-loading-color:var(--jsl-color-success)" })
110
- ], "loading-label-samples"),
111
- text("pre", '{ sizeInRem: 1, label: "Saving changes…", showLabel: true }', "sample-code")
112
- ]),
113
- card("loading-workflow", "03", "A moment between states", "Disable a repeated action while it runs, and mark the affected region as busy.", [new LoadingDemo()])
114
- ], [
115
- text("p", "The numeric constructor and its original 6 rem default remain available. An options object adds sizeInRem, label, showLabel, class, and style. The ring uses the current theme's accent; override --jsl-loading-color for a particular context."),
116
- text("p", "Each indicator has an accessible status label. Use aria-busy on the region being updated. Reduced-motion mode keeps the ring visible without rotating it.")
117
- ]);
118
-
119
- const navStatus = status("Choose a destination or an action.");
120
- const selected = (name: string) => () => { navStatus.content = "Selected: " + name + "."; };
121
- const wideNavigation = new NavigationComponent({
122
- title: "Workspace", position: "default", alignment: "right", ariaLabel: "Workspace example",
123
- data: [
124
- { content: "Overview", link: "#navigation", click: selected("Overview") },
125
- { content: "Projects", link: "#navigation/projects", click: selected("Projects"), children: [
126
- { content: "All projects", link: "#navigation/projects/all", click: selected("All projects") },
127
- { content: "Create project", click: selected("Create project") },
128
- { content: "Templates", children: [
129
- { content: "Design review", click: selected("Design review") },
130
- { content: "Sprint planning", click: selected("Sprint planning") }
131
- ] }
132
- ] },
133
- { content: "Resources", children: [
134
- { content: "Documentation", link: "https://example.com", target: "_blank" },
135
- { content: "What's new", click: selected("What's new") }
136
- ] },
137
- { content: "Admin", enabled: false, click: selected("Admin") }
138
- ]
139
- });
140
- const compactNavigation = new NavigationComponent({ title: "Team space", position: "static", ariaLabel: "Compact example", data: [
141
- { content: "Activity", active: true, click: selected("Activity") },
142
- { content: "People", click: selected("People") },
143
- { content: "Settings", children: [
144
- { content: "Profile", click: selected("Profile") },
145
- { content: "Notifications", click: selected("Notification settings") }
146
- ] }
147
- ] });
148
- export const navigationShowcase = section("navigation", "16", "Navigation",
149
- "A clear way through. Familiar links, purposeful actions, and menus that work at any size.",
150
- group([new NavigationComponent({ title: "Studio", position: "default", ariaLabel: "Navigation preview", data: [
151
- { content: "Projects", active: true, click: selected("Projects") },
152
- { content: "Team", click: selected("Team") }
153
- ] })], "navigation-preview"), [
154
- 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.", [
155
- wideNavigation, navStatus,
156
- text("p", "Try Tab, Enter or Space, arrow keys, and Escape. Click outside a menu to close it.", "inline-note")
157
- ]),
158
- 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.", [
159
- group([compactNavigation], "navigation-compact-sample"),
160
- text("pre", '{ title: "Team space", position: "static", data }', "sample-code")
161
- ]),
162
- 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.", [
163
- new NavigationComponent({
164
- title: group([text("span", "S", "navigation-brand-mark"), text("span", "Studio")], "navigation-rich-brand"),
165
- titleLink: "#navigation", position: "default", ariaLabel: "Rich content example",
166
- data: [{ content: "Home", link: "#navigation" }, { content: "Help", click: selected("Help") }]
167
- })
168
- ])
169
- ], [
170
- text("pre", 'new NavigationComponent({\n title: "Workspace", position: "default", alignment: "right",\n data: [\n { content: "Overview", link: "#overview" },\n { content: "Projects", children: [\n { content: "Create project", click: () => createProject() }\n ] }\n ]\n});', "sample-code"),
171
- text("p", "The existing title, titleLink, data, link, target, click, alignment, position, class, style, and id options remain. New options include ariaLabel, menuButtonLabel, activeLink, and item active, enabled, submenuLabel, and nested children."),
172
- text("p", "Navigation is rebuilt without Luxbar. Custom CSS that targets old Luxbar classes must be updated. id now identifies the header; menu and submenu IDs are derived from it (or generated uniquely). Items without links use buttons, and the title is plain text unless titleLink is provided."),
173
- text("p", "default and static participate in normal document flow. fixed (the original default) and fixed-bottom attach to the viewport. Active links follow hashchange and popstate, with path boundaries respected; activeLink or item.active can override route detection. Menus close when focus leaves, on outside interaction, on selection, or with Escape.")
1
+ import { IJSLComponent, IJSLVNode, JSLRender } from "jsl-render";
2
+ import { ButtonComponent } from "../../components/button/ButtonComponent";
3
+ import { Notification, NotificationComponent, INotificationOptions } from "../../components/notification/Notification";
4
+ import { LoadingComponent } from "../../components/loading/LoadingComponent";
5
+ import { NavigationComponent } from "../../components/navigation/NavigationComponent";
6
+
7
+ type Content = IJSLVNode | IJSLComponent;
8
+ const text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });
9
+ const group = (children: Content[], className?: string): IJSLVNode => ({ tag: "div", attr: { class: className }, children });
10
+ const status = (content: string): IJSLVNode => ({ tag: "p", content, attr: { class: "sample-status", role: "status" } });
11
+ const action = (content: string, click: () => void) => new ButtonComponent({ content, click, type: "button", outlined: true, size: "small" });
12
+ function card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {
13
+ return { tag: "article", attr: { id, class: "sample-card" }, children: [
14
+ group([text("span", number, "sample-number"), text("h3", title)], "card-heading"),
15
+ text("p", description, "card-description"), ...children
16
+ ] };
17
+ }
18
+ function section(id: string, number: string, title: string, description: string, preview: Content, cards: Content[], usage: Content[]): IJSLVNode {
19
+ return { tag: "section", attr: { id, class: "component-section", "aria-labelledby": id + "-title" }, children: [
20
+ group([
21
+ group([text("p", "THE ESSENTIALS / " + number, "eyebrow"),
22
+ { tag: "h2", content: title, attr: { id: id + "-title", class: "section-title" } },
23
+ text("p", description, "hero-description")], "hero-copy"),
24
+ group([text("span", "INTERACTIVE PREVIEW", "preview-caption"), preview], "hero-preview feedback-preview")
25
+ ], "hero"),
26
+ group(cards, "sample-grid feedback-sample-grid"),
27
+ { tag: "details", attr: { class: "usage" }, children: [text("summary", title + " usage & compatibility"), ...usage] }
28
+ ] };
29
+ }
30
+ const messageStatus = status("Notifications appear in the top-right corner.");
31
+ let latestMessage: string;
32
+ const notify = (options: INotificationOptions) => {
33
+ latestMessage = Notification.show({ ...options, onClose: () => {
34
+ messageStatus.content = "Notification dismissed.";
35
+ options.onClose?.();
36
+ JSLRender.lastCreatedRenderer?.refresh();
37
+ } });
38
+ messageStatus.content = "Notification shown.";
39
+ };
40
+ const variants: INotificationOptions["variant"][] = ["info", "success", "warning", "error"];
41
+ const 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."];
42
+ export const notificationShowcase = section("notifications", "14", "Notifications",
43
+ "A little feedback, clearly delivered. Quiet surfaces with a distinct tone for each message.",
44
+ new NotificationComponent({ title: "Changes saved", content: "Your team is up to date.", variant: "success", closeOnClick: false, showCloseButton: false }), [
45
+ card("notification-tones", "01", "Feedback with a purpose", "Color supports the message; titles and text explain what happened. Try each live notification.", [
46
+ group(variants.map((variant, index) => new NotificationComponent({
47
+ title: ["For your information", "All done", "A quick heads-up", "Something went wrong"][index],
48
+ content: messages[index], variant, closeOnClick: false, showCloseButton: false
49
+ })), "notification-samples"),
50
+ group(variants.map((variant, index) => action("Show " + variant, () => notify({ content: messages[index], variant }))), "sample-row")
51
+ ]),
52
+ 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.", [
53
+ group([
54
+ action("Show message", () => notify({ title: "A new update", content: "Click this message or its close button to dismiss it." })),
55
+ action("Show action", () => {
56
+ const id = Notification.show({
57
+ title: "Item archived", closeOnClick: false, content: group([
58
+ text("p", "You can restore the item if you change your mind."),
59
+ action("Undo archive", () => { Notification.clearNotification(id); messageStatus.content = "Item restored."; JSLRender.lastCreatedRenderer?.refresh(); })
60
+ ], "notification-action-copy")
61
+ });
62
+ latestMessage = id;
63
+ }),
64
+ action("Dismiss latest", () => Notification.clearNotification(latestMessage)),
65
+ action("Dismiss all", () => Notification.clearAll())
66
+ ], "sample-row"), messageStatus,
67
+ 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")
68
+ ]),
69
+ 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.", [
70
+ group([
71
+ action("Show for 3 seconds", () => notify({ title: "Export complete", content: "Hover or focus this message to pause its timer.", timeOut: 3000, variant: "info" })),
72
+ action("Show persistent message", () => notify({ title: "Review needed", content: "This message stays open until you dismiss it.", closeOnClick: false, variant: "warning" }))
73
+ ], "sample-row")
74
+ ])
75
+ ], [
76
+ text("p", "Notification.show(), clearNotification(), clearAll(), content, timeOut, closeOnClick, class, style, and onClick remain available. Messages still close when clicked by default. timeOut defaults to zero (persistent)."),
77
+ text("p", "Add title, variant, showCloseButton, closeButtonLabel, or onClose. NotificationComponent uses the same surface inline. Informational messages use role=status; warning and error messages use role=alert. Motion follows the user's reduced-motion preference.")
78
+ ]);
79
+
80
+ class LoadingDemo implements IJSLComponent {
81
+ public State = { busy: false, complete: false };
82
+ private renderer: JSLRender;
83
+ private timer: ReturnType<typeof setTimeout>;
84
+ public onInit(renderer: JSLRender) { this.renderer = renderer; }
85
+ public onRemove() { clearTimeout(this.timer); }
86
+ public render(): IJSLVNode {
87
+ return group([
88
+ new ButtonComponent({ content: this.State.busy ? "Loading report…" : "Load report", enabled: !this.State.busy, type: "button", click: () => {
89
+ this.State.busy = true; this.State.complete = false;
90
+ this.timer = setTimeout(() => { this.State.busy = false; this.State.complete = true; this.renderer.refresh(); }, 1800);
91
+ } }),
92
+ { tag: "div", attr: { class: "loading-demo-panel", "aria-busy": String(this.State.busy) }, children: [
93
+ this.State.busy ? new LoadingComponent({ sizeInRem: 1.25, label: "Fetching your report…", showLabel: true }) :
94
+ text("p", this.State.complete ? "Your report is ready. 24 projects, all up to date." : "Load a report to try a brief loading state.")
95
+ ] }
96
+ ], "loading-demo");
97
+ }
98
+ }
99
+ export const loadingShowcase = section("loading", "15", "Loading",
100
+ "A small sign that work is happening. Theme-aware indicators with room for helpful context.",
101
+ new LoadingComponent({ sizeInRem: 1.5, label: "Getting things ready…", showLabel: true }), [
102
+ card("loading-sizes", "01", "From inline to centre stage", "The original numeric constructor still sets the ring's size in rem.", [
103
+ group([1, 2, 3].map(size => group([new LoadingComponent(size), text("span", size + " rem", "size-caption")], "size-sample")), "sample-row size-row"),
104
+ text("pre", 'new LoadingComponent(1);\nnew LoadingComponent(3);', "sample-code")
105
+ ]),
106
+ card("loading-labels", "02", "Say what's happening", "Provide a useful label when a task takes time. Labels remain accessible when visually hidden.", [
107
+ group([
108
+ new LoadingComponent({ sizeInRem: 1, label: "Saving changes…", showLabel: true }),
109
+ new LoadingComponent({ sizeInRem: 1.5, label: "Syncing files…", showLabel: true, style: "--jsl-loading-color:var(--jsl-color-success)" })
110
+ ], "loading-label-samples"),
111
+ text("pre", '{ sizeInRem: 1, label: "Saving changes…", showLabel: true }', "sample-code")
112
+ ]),
113
+ card("loading-workflow", "03", "A moment between states", "Disable a repeated action while it runs, and mark the affected region as busy.", [new LoadingDemo()])
114
+ ], [
115
+ text("p", "The numeric constructor and its original 6 rem default remain available. An options object adds sizeInRem, label, showLabel, class, and style. The ring uses the current theme's accent; override --jsl-loading-color for a particular context."),
116
+ text("p", "Each indicator has an accessible status label. Use aria-busy on the region being updated. Reduced-motion mode keeps the ring visible without rotating it.")
117
+ ]);
118
+
119
+ const navStatus = status("Choose a destination or an action.");
120
+ const selected = (name: string) => () => { navStatus.content = "Selected: " + name + "."; };
121
+ const wideNavigation = new NavigationComponent({
122
+ title: "Workspace", position: "default", alignment: "right", ariaLabel: "Workspace example",
123
+ data: [
124
+ { content: "Overview", link: "#navigation", click: selected("Overview") },
125
+ { content: "Projects", link: "#navigation/projects", click: selected("Projects"), children: [
126
+ { content: "All projects", link: "#navigation/projects/all", click: selected("All projects") },
127
+ { content: "Create project", click: selected("Create project") },
128
+ { content: "Templates", children: [
129
+ { content: "Design review", click: selected("Design review") },
130
+ { content: "Sprint planning", click: selected("Sprint planning") }
131
+ ] }
132
+ ] },
133
+ { content: "Resources", children: [
134
+ { content: "Documentation", link: "https://example.com", target: "_blank" },
135
+ { content: "What's new", click: selected("What's new") }
136
+ ] },
137
+ { content: "Admin", enabled: false, click: selected("Admin") }
138
+ ]
139
+ });
140
+ const compactNavigation = new NavigationComponent({ title: "Team space", position: "static", ariaLabel: "Compact example", data: [
141
+ { content: "Activity", active: true, click: selected("Activity") },
142
+ { content: "People", click: selected("People") },
143
+ { content: "Settings", children: [
144
+ { content: "Profile", click: selected("Profile") },
145
+ { content: "Notifications", click: selected("Notification settings") }
146
+ ] }
147
+ ] });
148
+ export const navigationShowcase = section("navigation", "16", "Navigation",
149
+ "A clear way through. Familiar links, purposeful actions, and menus that work at any size.",
150
+ group([new NavigationComponent({ title: "Studio", position: "default", ariaLabel: "Navigation preview", data: [
151
+ { content: "Projects", active: true, click: selected("Projects") },
152
+ { content: "Team", click: selected("Team") }
153
+ ] })], "navigation-preview"), [
154
+ 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.", [
155
+ wideNavigation, navStatus,
156
+ text("p", "Try Tab, Enter or Space, arrow keys, and Escape. Click outside a menu to close it.", "inline-note")
157
+ ]),
158
+ 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.", [
159
+ group([compactNavigation], "navigation-compact-sample"),
160
+ text("pre", '{ title: "Team space", position: "static", data }', "sample-code")
161
+ ]),
162
+ 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.", [
163
+ new NavigationComponent({
164
+ title: group([text("span", "S", "navigation-brand-mark"), text("span", "Studio")], "navigation-rich-brand"),
165
+ titleLink: "#navigation", position: "default", ariaLabel: "Rich content example",
166
+ data: [{ content: "Home", link: "#navigation" }, { content: "Help", click: selected("Help") }]
167
+ })
168
+ ])
169
+ ], [
170
+ text("pre", 'new NavigationComponent({\n title: "Workspace", position: "default", alignment: "right",\n data: [\n { content: "Overview", link: "#overview" },\n { content: "Projects", children: [\n { content: "Create project", click: () => createProject() }\n ] }\n ]\n});', "sample-code"),
171
+ text("p", "The existing title, titleLink, data, link, target, click, alignment, position, class, style, and id options remain. New options include ariaLabel, menuButtonLabel, activeLink, and item active, enabled, submenuLabel, and nested children."),
172
+ text("p", "Navigation is rebuilt without Luxbar. Custom CSS that targets old Luxbar classes must be updated. id now identifies the header; menu and submenu IDs are derived from it (or generated uniquely). Items without links use buttons, and the title is plain text unless titleLink is provided."),
173
+ text("p", "default and static participate in normal document flow. fixed (the original default) and fixed-bottom attach to the viewport. Active links follow hashchange and popstate, with path boundaries respected; activeLink or item.active can override route detection. Menus close when focus leaves, on outside interaction, on selection, or with Escape.")
174
174
  ]);