jsl-ui 10.4.3 → 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 (95) 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/core/helper.js +11 -6
  84. package/lib/grid/plugins/slick.headermenu.css +98 -98
  85. package/lib/grid.css +840 -3532
  86. package/lib/index.css.map +1 -1
  87. package/lib/index.js.map +1 -1
  88. package/lib/ui/auto.suggest.css +30 -30
  89. package/lib/ui/button.css +147 -147
  90. package/lib/ui/date-input.css +10 -10
  91. package/lib/ui/date.picker/css/tiny-date-picker.css +124 -124
  92. package/lib/ui/dialog.css +144 -144
  93. package/lib/ui/input.css +35 -35
  94. package/lib/ui/theme.css +28 -28
  95. package/package.json +1 -1
@@ -1,161 +1,161 @@
1
- import { IJSLComponent, IJSLVNode } from "jsl-render";
2
- import { TabsComponent, ITabItemOption } from "../../components/tabs/TabsComponent";
3
- import { ButtonComponent } from "../../components/button/ButtonComponent";
4
-
5
- type Content = IJSLVNode | IJSLComponent;
6
- const text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });
7
- const group = (children: Content[], className?: string): IJSLVNode => ({ tag: "div", attr: { class: className }, children });
8
- const status = (content: string): IJSLVNode => ({ tag: "p", content, attr: { class: "sample-status", role: "status" } });
9
- const action = (content: string, click: () => void) => new ButtonComponent({ content, type: "button", outlined: true, size: "small", click });
10
- const copy = (title: string, content: string) => group([text("h4", title), text("p", content)], "tabs-example-copy");
11
-
12
- const basicStatus = status("Overview is selected.");
13
- const basicNames = ["Overview", "Activity", "Settings"];
14
- const basic = new TabsComponent({
15
- ariaLabel: "Project views",
16
- tabs: [
17
- { header: "Overview", content: copy("Everything in one place", "A clear view of your project, its progress, and what needs your attention.") },
18
- { header: "Activity", content: copy("The latest updates", "Your team created a project, shared a draft, and reviewed the next release.") },
19
- { header: "Settings", content: copy("Make it your own", "Manage project preferences, access, and notifications from a single view.") }
20
- ],
21
- onSelect: index => { basicStatus.content = basicNames[index] + " is selected."; }
22
- });
23
-
24
- const preserved = new TabsComponent({
25
- ariaLabel: "Preserved project draft", preserveContent: true,
26
- tabs: [
27
- { header: "Draft", content: group([
28
- { tag: "label", content: "Project name", attr: { for: "tabs-project-draft" } },
29
- { tag: "input", attr: { id: "tabs-project-draft", class: "tabs-draft-input", type: "text", placeholder: "Type something, then switch tabs" } },
30
- text("p", "Your unfinished work stays exactly where you left it.")
31
- ], "tabs-example-copy") },
32
- { header: "Preview", content: copy("Your draft is still there", "Switch back to Draft. The input keeps its value and its DOM element.") }
33
- ]
34
- });
35
-
36
- const lazyStatus = status("No detail panels have been created yet.");
37
- let createdPanels = 0;
38
- const lazyTab = (header: string): ITabItemOption => ({
39
- header,
40
- onCreate: () => {
41
- createdPanels++;
42
- lazyStatus.content = createdPanels + (createdPanels === 1 ? " detail panel created." : " detail panels created.");
43
- return copy(header, "This content was created on the first visit. Revisit this tab and the creation count stays the same.");
44
- }
45
- });
46
- const lazy = new TabsComponent({
47
- ariaLabel: "Lazy project details", preserveContent: true,
48
- tabs: [
49
- { header: "Summary", content: copy("Ready when you are", "Details are created only when you select their tab. Try Reports or History.") },
50
- lazyTab("Reports"), lazyTab("History")
51
- ]
52
- });
53
-
54
- const documentStatus = status("Add a draft, close one, or try closing the protected tab.");
55
- let allowProtectedClose = false;
56
- let nextDocument = 2;
57
- const documents = new TabsComponent({
58
- ariaLabel: "Open documents", preserveContent: true,
59
- tabs: [
60
- { header: "Overview", content: copy("Your workspace", "Keep a few documents open while you work.") },
61
- { id: "showcase-tabs-draft-1", header: "Draft 1", canClose: true, content: copy("Draft 1", "A document that can be closed and replaced with another.") },
62
- { id: "showcase-tabs-protected", header: "Protected", canClose: true,
63
- content: copy("A little protection", "Allow this tab to close using the checkbox below, or keep it open with onClosing."),
64
- onClosing: () => {
65
- if (!allowProtectedClose) {
66
- documentStatus.content = "The protected tab is still open. Allow closing it using the checkbox.";
67
- return false;
68
- }
69
- return true;
70
- }
71
- }
72
- ],
73
- onSelect: index => { documentStatus.content = index < 0 ? "No document selected." : "Selected tab " + (index + 1) + "."; }
74
- });
75
-
76
- const disabledStatus = status("Audit is unavailable. Keyboard navigation skips it.");
77
- const disabled = new TabsComponent({
78
- ariaLabel: "Workspace sections",
79
- tabs: [
80
- { header: "Workspace", content: copy("Choose where to work", "Tabs can remain visible while an action or section is unavailable.") },
81
- { header: "Audit", enabled: false, content: copy("Audit trail", "This section is now enabled and ready to use.") },
82
- { header: "Team", content: copy("Work together", "Arrow keys move between available tabs, skipping disabled ones.") }
83
- ]
84
- });
85
-
86
- const overflow = new TabsComponent({
87
- ariaLabel: "Workspace information", maxHeight: "10rem",
88
- tabs: [
89
- { header: "Overview", content: copy("A place for every view", "When space gets tight, the header scrolls horizontally. Focused tabs stay in view.") },
90
- { header: group([text("span", "Release notes"), { tag: "span", content: "3", attr: { class: "tabs-header-badge", "aria-hidden": "true" } }], "tabs-rich-header"),
91
- ariaLabel: "Release notes, 3 updates",
92
- content: group(Array.from({ length: 8 }, (_, index) => text("p", "Release " + (index + 1) + ": improvements to everyday work and collaboration.")), "tabs-example-copy") },
93
- { header: "Deployment history", content: copy("Recent deployments", "The latest deployment completed successfully.") },
94
- { header: "Team permissions", content: copy("Who can do what", "Keep access and responsibilities clear across the workspace.") },
95
- { header: "Integrations", content: copy("Connected tools", "Connect your team's existing tools to its daily workflow.") },
96
- { header: "Audit log", content: copy("A record of changes", "Track what changed, when it changed, and who made the update.") }
97
- ]
98
- });
99
-
100
- const preview = new TabsComponent({
101
- ariaLabel: "Tabs preview", class: "tabs-hero-demo",
102
- tabs: [
103
- { header: "Preview", content: text("p", "A clear view of the task at hand.") },
104
- { header: "Details", content: text("p", "Another view, one selection away.") }
105
- ]
106
- });
107
-
108
- function card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {
109
- return { tag: "article", attr: { class: "sample-card", id, "aria-labelledby": id + "-title" }, children: [
110
- group([text("span", number, "sample-number"), { tag: "h3", content: title, attr: { id: id + "-title" } }], "card-heading"),
111
- text("p", description, "card-description"), ...children
112
- ] };
113
- }
114
-
115
- export const tabsShowcase: IJSLVNode = {
116
- tag: "section", attr: { id: "tabs", class: "component-section", "aria-labelledby": "tabs-title" }, children: [
117
- group([
118
- group([
119
- text("p", "THE ESSENTIALS / 03", "eyebrow"),
120
- { tag: "h2", content: "Tabs", attr: { id: "tabs-title", class: "section-title" } },
121
- text("p", "Related views, one clear selection. Keep the context and make room for the details.", "hero-description")
122
- ], "hero-copy"),
123
- group([text("span", "INTERACTIVE PREVIEW", "preview-caption"), preview, text("span", "Use the arrow keys to explore.", "preview-note")], "hero-preview")
124
- ], "hero"),
125
- group([text("span", "Overview", "overview-label"), text("span", "Lazy content", "overview-stat"), text("span", "Closable tabs", "overview-stat"), text("span", "Keyboard accessible", "overview-stat")], "overview-bar"),
126
- group([
127
- card("tabs-basic", "01", "One view at a time", "An understated active indicator, comfortable labels, and linked content panels.", [basic, basicStatus]),
128
- 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")]),
129
- card("tabs-lazy", "03", "Create only when needed", "Load content on its first selection, then keep the result for future visits.", [lazy, lazyStatus]),
130
- card("tabs-documents", "04", "Tabs that come and go", "Add and close documents. Use Delete on a closable tab, or its close button.", [
131
- documents,
132
- group([action("Add draft", () => {
133
- const number = nextDocument++;
134
- const index = documents.AddTab({ header: "Draft " + number, canClose: true, content: copy("Draft " + number, "A new document, ready for your next idea.") });
135
- documents.SetSelectedTab(index);
136
- documentStatus.content = "Draft " + number + " added.";
137
- })], "sample-row"),
138
- { tag: "label", attr: { class: "tabs-example-check" }, children: [
139
- { tag: "input", attr: { type: "checkbox", id: "tabs-allow-close", change: (event: Event) => { allowProtectedClose = (event.target as HTMLInputElement).checked; } } },
140
- text("span", "Allow closing the protected tab")
141
- ] }, documentStatus
142
- ]),
143
- card("tabs-disabled", "05", "Available when you need it", "Disabled tabs stay visible and are skipped by pointer and keyboard activation.", [
144
- disabled,
145
- group([
146
- action("Enable all", () => { disabled.EnableAll(); disabledStatus.content = "All sections are available."; }),
147
- action("Disable all", () => { disabled.DisableAll(); disabledStatus.content = "All sections are disabled. Current content stays visible."; })
148
- ], "sample-row"), disabledStatus
149
- ]),
150
- 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")])
151
- ], "sample-grid tabs-sample-grid"),
152
- { tag: "details", attr: { class: "usage" }, children: [
153
- text("summary", "Tabs usage & compatibility"),
154
- text("pre", 'new TabsComponent({\n tabs: [\n { id: "overview", header: "Overview", content: "Project overview" },\n { id: "reports", header: "Reports", onCreate: () => createReports(), canClose: true }\n ],\n preserveContent: true,\n onSelect: index => { /* Return false to veto user selection. */ }\n});', "sample-code"),
155
- text("p", "Existing options and AddTab, SetSelectedTab, getActiveTabIndex, GetByID, closeTabIndex, EnableAll, and DisableAll methods are preserved. SetSelectedTab selects without raising onSelect; -1 clears selection. Invalid indices are ignored."),
156
- text("p", "Arrow Left/Right, Home, and End focus and select enabled tabs. Enter and Space activate a focused tab. Delete closes a closable tab. onClosing can veto closure; closeTabIndex(index, true) also emits the resulting selection."),
157
- text("p", "onCreate runs once per tab, on its first selection. By default, inactive content is unmounted; preserveContent keeps it mounted and hidden. Closing a tab keeps the current document selected when possible, or selects the next enabled neighbor. Empty tab sets are supported."),
158
- text("p", "Tab IDs must be unique. Each tab is linked to a panel with accessible roles and selection state. Use ariaLabel on the tab set or individual items, and closeButtonLabel to translate a close control. Custom headers should contain decorative content, keeping interactive controls in the panel.")
159
- ] }
160
- ]
161
- };
1
+ import { IJSLComponent, IJSLVNode } from "jsl-render";
2
+ import { TabsComponent, ITabItemOption } from "../../components/tabs/TabsComponent";
3
+ import { ButtonComponent } from "../../components/button/ButtonComponent";
4
+
5
+ type Content = IJSLVNode | IJSLComponent;
6
+ const text = (tag: string, content: string, className?: string): IJSLVNode => ({ tag, content, attr: { class: className } });
7
+ const group = (children: Content[], className?: string): IJSLVNode => ({ tag: "div", attr: { class: className }, children });
8
+ const status = (content: string): IJSLVNode => ({ tag: "p", content, attr: { class: "sample-status", role: "status" } });
9
+ const action = (content: string, click: () => void) => new ButtonComponent({ content, type: "button", outlined: true, size: "small", click });
10
+ const copy = (title: string, content: string) => group([text("h4", title), text("p", content)], "tabs-example-copy");
11
+
12
+ const basicStatus = status("Overview is selected.");
13
+ const basicNames = ["Overview", "Activity", "Settings"];
14
+ const basic = new TabsComponent({
15
+ ariaLabel: "Project views",
16
+ tabs: [
17
+ { header: "Overview", content: copy("Everything in one place", "A clear view of your project, its progress, and what needs your attention.") },
18
+ { header: "Activity", content: copy("The latest updates", "Your team created a project, shared a draft, and reviewed the next release.") },
19
+ { header: "Settings", content: copy("Make it your own", "Manage project preferences, access, and notifications from a single view.") }
20
+ ],
21
+ onSelect: index => { basicStatus.content = basicNames[index] + " is selected."; }
22
+ });
23
+
24
+ const preserved = new TabsComponent({
25
+ ariaLabel: "Preserved project draft", preserveContent: true,
26
+ tabs: [
27
+ { header: "Draft", content: group([
28
+ { tag: "label", content: "Project name", attr: { for: "tabs-project-draft" } },
29
+ { tag: "input", attr: { id: "tabs-project-draft", class: "tabs-draft-input", type: "text", placeholder: "Type something, then switch tabs" } },
30
+ text("p", "Your unfinished work stays exactly where you left it.")
31
+ ], "tabs-example-copy") },
32
+ { header: "Preview", content: copy("Your draft is still there", "Switch back to Draft. The input keeps its value and its DOM element.") }
33
+ ]
34
+ });
35
+
36
+ const lazyStatus = status("No detail panels have been created yet.");
37
+ let createdPanels = 0;
38
+ const lazyTab = (header: string): ITabItemOption => ({
39
+ header,
40
+ onCreate: () => {
41
+ createdPanels++;
42
+ lazyStatus.content = createdPanels + (createdPanels === 1 ? " detail panel created." : " detail panels created.");
43
+ return copy(header, "This content was created on the first visit. Revisit this tab and the creation count stays the same.");
44
+ }
45
+ });
46
+ const lazy = new TabsComponent({
47
+ ariaLabel: "Lazy project details", preserveContent: true,
48
+ tabs: [
49
+ { header: "Summary", content: copy("Ready when you are", "Details are created only when you select their tab. Try Reports or History.") },
50
+ lazyTab("Reports"), lazyTab("History")
51
+ ]
52
+ });
53
+
54
+ const documentStatus = status("Add a draft, close one, or try closing the protected tab.");
55
+ let allowProtectedClose = false;
56
+ let nextDocument = 2;
57
+ const documents = new TabsComponent({
58
+ ariaLabel: "Open documents", preserveContent: true,
59
+ tabs: [
60
+ { header: "Overview", content: copy("Your workspace", "Keep a few documents open while you work.") },
61
+ { id: "showcase-tabs-draft-1", header: "Draft 1", canClose: true, content: copy("Draft 1", "A document that can be closed and replaced with another.") },
62
+ { id: "showcase-tabs-protected", header: "Protected", canClose: true,
63
+ content: copy("A little protection", "Allow this tab to close using the checkbox below, or keep it open with onClosing."),
64
+ onClosing: () => {
65
+ if (!allowProtectedClose) {
66
+ documentStatus.content = "The protected tab is still open. Allow closing it using the checkbox.";
67
+ return false;
68
+ }
69
+ return true;
70
+ }
71
+ }
72
+ ],
73
+ onSelect: index => { documentStatus.content = index < 0 ? "No document selected." : "Selected tab " + (index + 1) + "."; }
74
+ });
75
+
76
+ const disabledStatus = status("Audit is unavailable. Keyboard navigation skips it.");
77
+ const disabled = new TabsComponent({
78
+ ariaLabel: "Workspace sections",
79
+ tabs: [
80
+ { header: "Workspace", content: copy("Choose where to work", "Tabs can remain visible while an action or section is unavailable.") },
81
+ { header: "Audit", enabled: false, content: copy("Audit trail", "This section is now enabled and ready to use.") },
82
+ { header: "Team", content: copy("Work together", "Arrow keys move between available tabs, skipping disabled ones.") }
83
+ ]
84
+ });
85
+
86
+ const overflow = new TabsComponent({
87
+ ariaLabel: "Workspace information", maxHeight: "10rem",
88
+ tabs: [
89
+ { header: "Overview", content: copy("A place for every view", "When space gets tight, the header scrolls horizontally. Focused tabs stay in view.") },
90
+ { header: group([text("span", "Release notes"), { tag: "span", content: "3", attr: { class: "tabs-header-badge", "aria-hidden": "true" } }], "tabs-rich-header"),
91
+ ariaLabel: "Release notes, 3 updates",
92
+ content: group(Array.from({ length: 8 }, (_, index) => text("p", "Release " + (index + 1) + ": improvements to everyday work and collaboration.")), "tabs-example-copy") },
93
+ { header: "Deployment history", content: copy("Recent deployments", "The latest deployment completed successfully.") },
94
+ { header: "Team permissions", content: copy("Who can do what", "Keep access and responsibilities clear across the workspace.") },
95
+ { header: "Integrations", content: copy("Connected tools", "Connect your team's existing tools to its daily workflow.") },
96
+ { header: "Audit log", content: copy("A record of changes", "Track what changed, when it changed, and who made the update.") }
97
+ ]
98
+ });
99
+
100
+ const preview = new TabsComponent({
101
+ ariaLabel: "Tabs preview", class: "tabs-hero-demo",
102
+ tabs: [
103
+ { header: "Preview", content: text("p", "A clear view of the task at hand.") },
104
+ { header: "Details", content: text("p", "Another view, one selection away.") }
105
+ ]
106
+ });
107
+
108
+ function card(id: string, number: string, title: string, description: string, children: Content[]): IJSLVNode {
109
+ return { tag: "article", attr: { class: "sample-card", id, "aria-labelledby": id + "-title" }, children: [
110
+ group([text("span", number, "sample-number"), { tag: "h3", content: title, attr: { id: id + "-title" } }], "card-heading"),
111
+ text("p", description, "card-description"), ...children
112
+ ] };
113
+ }
114
+
115
+ export const tabsShowcase: IJSLVNode = {
116
+ tag: "section", attr: { id: "tabs", class: "component-section", "aria-labelledby": "tabs-title" }, children: [
117
+ group([
118
+ group([
119
+ text("p", "THE ESSENTIALS / 03", "eyebrow"),
120
+ { tag: "h2", content: "Tabs", attr: { id: "tabs-title", class: "section-title" } },
121
+ text("p", "Related views, one clear selection. Keep the context and make room for the details.", "hero-description")
122
+ ], "hero-copy"),
123
+ group([text("span", "INTERACTIVE PREVIEW", "preview-caption"), preview, text("span", "Use the arrow keys to explore.", "preview-note")], "hero-preview")
124
+ ], "hero"),
125
+ group([text("span", "Overview", "overview-label"), text("span", "Lazy content", "overview-stat"), text("span", "Closable tabs", "overview-stat"), text("span", "Keyboard accessible", "overview-stat")], "overview-bar"),
126
+ group([
127
+ card("tabs-basic", "01", "One view at a time", "An understated active indicator, comfortable labels, and linked content panels.", [basic, basicStatus]),
128
+ 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")]),
129
+ card("tabs-lazy", "03", "Create only when needed", "Load content on its first selection, then keep the result for future visits.", [lazy, lazyStatus]),
130
+ card("tabs-documents", "04", "Tabs that come and go", "Add and close documents. Use Delete on a closable tab, or its close button.", [
131
+ documents,
132
+ group([action("Add draft", () => {
133
+ const number = nextDocument++;
134
+ const index = documents.AddTab({ header: "Draft " + number, canClose: true, content: copy("Draft " + number, "A new document, ready for your next idea.") });
135
+ documents.SetSelectedTab(index);
136
+ documentStatus.content = "Draft " + number + " added.";
137
+ })], "sample-row"),
138
+ { tag: "label", attr: { class: "tabs-example-check" }, children: [
139
+ { tag: "input", attr: { type: "checkbox", id: "tabs-allow-close", change: (event: Event) => { allowProtectedClose = (event.target as HTMLInputElement).checked; } } },
140
+ text("span", "Allow closing the protected tab")
141
+ ] }, documentStatus
142
+ ]),
143
+ card("tabs-disabled", "05", "Available when you need it", "Disabled tabs stay visible and are skipped by pointer and keyboard activation.", [
144
+ disabled,
145
+ group([
146
+ action("Enable all", () => { disabled.EnableAll(); disabledStatus.content = "All sections are available."; }),
147
+ action("Disable all", () => { disabled.DisableAll(); disabledStatus.content = "All sections are disabled. Current content stays visible."; })
148
+ ], "sample-row"), disabledStatus
149
+ ]),
150
+ 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")])
151
+ ], "sample-grid tabs-sample-grid"),
152
+ { tag: "details", attr: { class: "usage" }, children: [
153
+ text("summary", "Tabs usage & compatibility"),
154
+ text("pre", 'new TabsComponent({\n tabs: [\n { id: "overview", header: "Overview", content: "Project overview" },\n { id: "reports", header: "Reports", onCreate: () => createReports(), canClose: true }\n ],\n preserveContent: true,\n onSelect: index => { /* Return false to veto user selection. */ }\n});', "sample-code"),
155
+ text("p", "Existing options and AddTab, SetSelectedTab, getActiveTabIndex, GetByID, closeTabIndex, EnableAll, and DisableAll methods are preserved. SetSelectedTab selects without raising onSelect; -1 clears selection. Invalid indices are ignored."),
156
+ text("p", "Arrow Left/Right, Home, and End focus and select enabled tabs. Enter and Space activate a focused tab. Delete closes a closable tab. onClosing can veto closure; closeTabIndex(index, true) also emits the resulting selection."),
157
+ text("p", "onCreate runs once per tab, on its first selection. By default, inactive content is unmounted; preserveContent keeps it mounted and hidden. Closing a tab keeps the current document selected when possible, or selects the next enabled neighbor. Empty tab sets are supported."),
158
+ text("p", "Tab IDs must be unique. Each tab is linked to a panel with accessible roles and selection state. Use ariaLabel on the tab set or individual items, and closeButtonLabel to translate a close control. Custom headers should contain decorative content, keeping interactive controls in the panel.")
159
+ ] }
160
+ ]
161
+ };
@@ -1,83 +1,83 @@
1
- /* Showcase-only examples of overriding the shared library palette. */
2
- :root { color-scheme: light; }
3
-
4
- :root[data-showcase-theme="ocean"] {
5
- --jsl-color-canvas: #f5f8fc;
6
- --jsl-color-surface-subtle: #f8fafd;
7
- --jsl-color-surface-hover: #edf2f9;
8
- --jsl-color-surface-selected: #e3edfc;
9
- --jsl-color-border: #c7d4e8;
10
- --jsl-color-border-subtle: #e0e7f1;
11
- --jsl-color-text: #24344a;
12
- --jsl-color-text-secondary: #4b5e78;
13
- --jsl-color-text-muted: #62748a;
14
- --jsl-color-accent: #245fc7;
15
- --jsl-color-accent-hover: #1d4fa8;
16
- --jsl-color-accent-active: #184187;
17
- --jsl-color-focus: #245fc7;
18
- --jsl-color-disabled-surface: #edf2f7;
19
- --jsl-color-disabled-text: #62748a;
20
- }
21
-
22
- :root[data-showcase-theme="forest"] {
23
- --jsl-color-canvas: #f5f8f5;
24
- --jsl-color-surface-subtle: #f9fbf8;
25
- --jsl-color-surface-hover: #eef4ed;
26
- --jsl-color-surface-selected: #dfeddf;
27
- --jsl-color-border: #c6d6c5;
28
- --jsl-color-border-subtle: #dfe8dd;
29
- --jsl-color-text: #293b2b;
30
- --jsl-color-text-secondary: #4c6250;
31
- --jsl-color-text-muted: #647667;
32
- --jsl-color-accent: #356b45;
33
- --jsl-color-accent-hover: #295436;
34
- --jsl-color-accent-active: #203f29;
35
- --jsl-color-focus: #356b45;
36
- --jsl-color-disabled-surface: #eef3ed;
37
- --jsl-color-disabled-text: #647667;
38
- }
39
-
40
- :root[data-showcase-theme="plum"] {
41
- --jsl-color-canvas: #faf6fa;
42
- --jsl-color-surface-subtle: #fcf9fc;
43
- --jsl-color-surface-hover: #f4edf5;
44
- --jsl-color-surface-selected: #efdef0;
45
- --jsl-color-border: #dac8dd;
46
- --jsl-color-border-subtle: #ebdfed;
47
- --jsl-color-text: #412b46;
48
- --jsl-color-text-secondary: #6c5271;
49
- --jsl-color-text-muted: #7b667f;
50
- --jsl-color-accent: #80458b;
51
- --jsl-color-accent-hover: #693872;
52
- --jsl-color-accent-active: #542d5c;
53
- --jsl-color-focus: #80458b;
54
- --jsl-color-disabled-surface: #f3edf4;
55
- --jsl-color-disabled-text: #7b667f;
56
- }
57
-
58
- :root[data-showcase-theme="midnight"] {
59
- --jsl-color-success: #86efac;
60
- --jsl-color-warning: #fcd34d;
61
- --jsl-color-info: #93c5fd;
62
- --jsl-color-danger: #fda4af;
63
- color-scheme: dark;
64
- --jsl-color-overlay: rgba(0, 0, 0, 0.65);
65
- --jsl-shadow-dialog: 0 24px 80px rgba(0, 0, 0, 0.55);
66
- --jsl-color-canvas: #18181b;
67
- --jsl-color-surface: #232326;
68
- --jsl-color-surface-subtle: #1e1e21;
69
- --jsl-color-surface-hover: #303035;
70
- --jsl-color-surface-selected: #3b3b43;
71
- --jsl-color-border: #62626d;
72
- --jsl-color-border-subtle: #3d3d45;
73
- --jsl-color-text: #f4f4f5;
74
- --jsl-color-text-secondary: #d4d4d8;
75
- --jsl-color-text-muted: #a1a1aa;
76
- --jsl-color-accent: #e4e4e7;
77
- --jsl-color-accent-hover: #ffffff;
78
- --jsl-color-accent-active: #a1a1aa;
79
- --jsl-color-on-accent: #18181b;
80
- --jsl-color-focus: #a1a1aa;
81
- --jsl-color-disabled-surface: #2b2b30;
82
- --jsl-color-disabled-text: #91919c;
83
- }
1
+ /* Showcase-only examples of overriding the shared library palette. */
2
+ :root { color-scheme: light; }
3
+
4
+ :root[data-showcase-theme="ocean"] {
5
+ --jsl-color-canvas: #f5f8fc;
6
+ --jsl-color-surface-subtle: #f8fafd;
7
+ --jsl-color-surface-hover: #edf2f9;
8
+ --jsl-color-surface-selected: #e3edfc;
9
+ --jsl-color-border: #c7d4e8;
10
+ --jsl-color-border-subtle: #e0e7f1;
11
+ --jsl-color-text: #24344a;
12
+ --jsl-color-text-secondary: #4b5e78;
13
+ --jsl-color-text-muted: #62748a;
14
+ --jsl-color-accent: #245fc7;
15
+ --jsl-color-accent-hover: #1d4fa8;
16
+ --jsl-color-accent-active: #184187;
17
+ --jsl-color-focus: #245fc7;
18
+ --jsl-color-disabled-surface: #edf2f7;
19
+ --jsl-color-disabled-text: #62748a;
20
+ }
21
+
22
+ :root[data-showcase-theme="forest"] {
23
+ --jsl-color-canvas: #f5f8f5;
24
+ --jsl-color-surface-subtle: #f9fbf8;
25
+ --jsl-color-surface-hover: #eef4ed;
26
+ --jsl-color-surface-selected: #dfeddf;
27
+ --jsl-color-border: #c6d6c5;
28
+ --jsl-color-border-subtle: #dfe8dd;
29
+ --jsl-color-text: #293b2b;
30
+ --jsl-color-text-secondary: #4c6250;
31
+ --jsl-color-text-muted: #647667;
32
+ --jsl-color-accent: #356b45;
33
+ --jsl-color-accent-hover: #295436;
34
+ --jsl-color-accent-active: #203f29;
35
+ --jsl-color-focus: #356b45;
36
+ --jsl-color-disabled-surface: #eef3ed;
37
+ --jsl-color-disabled-text: #647667;
38
+ }
39
+
40
+ :root[data-showcase-theme="plum"] {
41
+ --jsl-color-canvas: #faf6fa;
42
+ --jsl-color-surface-subtle: #fcf9fc;
43
+ --jsl-color-surface-hover: #f4edf5;
44
+ --jsl-color-surface-selected: #efdef0;
45
+ --jsl-color-border: #dac8dd;
46
+ --jsl-color-border-subtle: #ebdfed;
47
+ --jsl-color-text: #412b46;
48
+ --jsl-color-text-secondary: #6c5271;
49
+ --jsl-color-text-muted: #7b667f;
50
+ --jsl-color-accent: #80458b;
51
+ --jsl-color-accent-hover: #693872;
52
+ --jsl-color-accent-active: #542d5c;
53
+ --jsl-color-focus: #80458b;
54
+ --jsl-color-disabled-surface: #f3edf4;
55
+ --jsl-color-disabled-text: #7b667f;
56
+ }
57
+
58
+ :root[data-showcase-theme="midnight"] {
59
+ --jsl-color-success: #86efac;
60
+ --jsl-color-warning: #fcd34d;
61
+ --jsl-color-info: #93c5fd;
62
+ --jsl-color-danger: #fda4af;
63
+ color-scheme: dark;
64
+ --jsl-color-overlay: rgba(0, 0, 0, 0.65);
65
+ --jsl-shadow-dialog: 0 24px 80px rgba(0, 0, 0, 0.55);
66
+ --jsl-color-canvas: #18181b;
67
+ --jsl-color-surface: #232326;
68
+ --jsl-color-surface-subtle: #1e1e21;
69
+ --jsl-color-surface-hover: #303035;
70
+ --jsl-color-surface-selected: #3b3b43;
71
+ --jsl-color-border: #62626d;
72
+ --jsl-color-border-subtle: #3d3d45;
73
+ --jsl-color-text: #f4f4f5;
74
+ --jsl-color-text-secondary: #d4d4d8;
75
+ --jsl-color-text-muted: #a1a1aa;
76
+ --jsl-color-accent: #e4e4e7;
77
+ --jsl-color-accent-hover: #ffffff;
78
+ --jsl-color-accent-active: #a1a1aa;
79
+ --jsl-color-on-accent: #18181b;
80
+ --jsl-color-focus: #a1a1aa;
81
+ --jsl-color-disabled-surface: #2b2b30;
82
+ --jsl-color-disabled-text: #91919c;
83
+ }
@@ -1,56 +1,56 @@
1
- import "./themes.css";
2
- import "./nivona.css";
3
- import "./wirtshans.css";
4
-
5
- export const showcaseThemes = [
6
- { id: "default", label: "Default (neutral)" },
7
- { id: "nivona", label: "Nivona" },
8
- { id: "wirtshans", label: "Wirtshans" },
9
- { id: "ocean", label: "Ocean" },
10
- { id: "forest", label: "Forest" },
11
- { id: "plum", label: "Plum" },
12
- { id: "midnight", label: "Midnight (dark)" }
13
- ] as const;
14
-
15
- export type ShowcaseTheme = typeof showcaseThemes[number]["id"];
16
-
17
- const storageKey = "jsl-showcase-theme";
18
- const themePicker = document.getElementById("showcase-theme") as HTMLSelectElement;
19
-
20
- /** Switch the showcase palette without recreating components or resetting their state. */
21
- export function changeTheme(themeId: string): ShowcaseTheme {
22
- const theme = showcaseThemes.find(item => item.id === themeId)?.id ?? "default";
23
- if (theme === "default") {
24
- // Removing the override restores the library's actual built-in palette.
25
- document.documentElement.removeAttribute("data-showcase-theme");
26
- } else {
27
- document.documentElement.setAttribute("data-showcase-theme", theme);
28
- }
29
- themePicker.value = theme;
30
- try {
31
- localStorage.setItem(storageKey, theme);
32
- } catch {
33
- // Theme switching also works when browser storage is unavailable.
34
- }
35
- return theme;
36
- }
37
-
38
- themePicker.replaceChildren(...showcaseThemes.map(theme => {
39
- const option = document.createElement("option");
40
- option.value = theme.id;
41
- option.textContent = theme.label;
42
- return option;
43
- }));
44
- themePicker.addEventListener("change", () => changeTheme(themePicker.value));
45
-
46
- let savedTheme = "default";
47
- try {
48
- savedTheme = localStorage.getItem(storageKey) ?? "default";
49
- } catch {
50
- // Use the built-in palette when browser storage is unavailable.
51
- }
52
- // Share a particular palette with ?theme=nivona (or any registered theme id).
53
- // A valid URL choice takes precedence over the saved preference, including default.
54
- const urlTheme = new URLSearchParams(window.location.search).get("theme");
55
- const initialTheme = showcaseThemes.some(theme => theme.id === urlTheme) ? urlTheme : savedTheme;
56
- changeTheme(initialTheme);
1
+ import "./themes.css";
2
+ import "./nivona.css";
3
+ import "./wirtshans.css";
4
+
5
+ export const showcaseThemes = [
6
+ { id: "default", label: "Default (neutral)" },
7
+ { id: "nivona", label: "Nivona" },
8
+ { id: "wirtshans", label: "Wirtshans" },
9
+ { id: "ocean", label: "Ocean" },
10
+ { id: "forest", label: "Forest" },
11
+ { id: "plum", label: "Plum" },
12
+ { id: "midnight", label: "Midnight (dark)" }
13
+ ] as const;
14
+
15
+ export type ShowcaseTheme = typeof showcaseThemes[number]["id"];
16
+
17
+ const storageKey = "jsl-showcase-theme";
18
+ const themePicker = document.getElementById("showcase-theme") as HTMLSelectElement;
19
+
20
+ /** Switch the showcase palette without recreating components or resetting their state. */
21
+ export function changeTheme(themeId: string): ShowcaseTheme {
22
+ const theme = showcaseThemes.find(item => item.id === themeId)?.id ?? "default";
23
+ if (theme === "default") {
24
+ // Removing the override restores the library's actual built-in palette.
25
+ document.documentElement.removeAttribute("data-showcase-theme");
26
+ } else {
27
+ document.documentElement.setAttribute("data-showcase-theme", theme);
28
+ }
29
+ themePicker.value = theme;
30
+ try {
31
+ localStorage.setItem(storageKey, theme);
32
+ } catch {
33
+ // Theme switching also works when browser storage is unavailable.
34
+ }
35
+ return theme;
36
+ }
37
+
38
+ themePicker.replaceChildren(...showcaseThemes.map(theme => {
39
+ const option = document.createElement("option");
40
+ option.value = theme.id;
41
+ option.textContent = theme.label;
42
+ return option;
43
+ }));
44
+ themePicker.addEventListener("change", () => changeTheme(themePicker.value));
45
+
46
+ let savedTheme = "default";
47
+ try {
48
+ savedTheme = localStorage.getItem(storageKey) ?? "default";
49
+ } catch {
50
+ // Use the built-in palette when browser storage is unavailable.
51
+ }
52
+ // Share a particular palette with ?theme=nivona (or any registered theme id).
53
+ // A valid URL choice takes precedence over the saved preference, including default.
54
+ const urlTheme = new URLSearchParams(window.location.search).get("theme");
55
+ const initialTheme = showcaseThemes.some(theme => theme.id === urlTheme) ? urlTheme : savedTheme;
56
+ changeTheme(initialTheme);