jsl-ui 9.29.0 → 10.0.0

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 (164) hide show
  1. package/docs/AutoSuggestComponent.md +17 -0
  2. package/docs/ButtonComponent.md +14 -0
  3. package/docs/CheckBoxComponent.md +12 -0
  4. package/docs/DateComponent.md +12 -0
  5. package/docs/DateRangeComponent.md +13 -0
  6. package/docs/DateTimeComponent.md +13 -0
  7. package/docs/DialogComponent.md +15 -0
  8. package/docs/ExpanderComponent.md +13 -0
  9. package/docs/FormComponent.md +15 -0
  10. package/docs/FormFieldComponent.md +15 -0
  11. package/docs/GridComponent.md +19 -0
  12. package/docs/InputComponent.md +15 -0
  13. package/docs/IntervalComponent.md +13 -0
  14. package/docs/LoadingComponent.md +12 -0
  15. package/docs/NavigationComponent.md +17 -0
  16. package/docs/Notification.md +14 -0
  17. package/docs/NotificationComponent.md +13 -0
  18. package/docs/NumberComponent.md +12 -0
  19. package/docs/OverlayComponent.md +12 -0
  20. package/docs/ProgressComponent.md +12 -0
  21. package/docs/README.md +24 -0
  22. package/docs/RibbonMenuComponent.md +14 -0
  23. package/docs/SelectComponent.md +15 -0
  24. package/docs/SplitterComponent.md +14 -0
  25. package/docs/StackPanelComponent.md +13 -0
  26. package/docs/TabsComponent.md +16 -0
  27. package/docs/TimeComponent.md +13 -0
  28. package/docs/TreeViewComponent.md +16 -0
  29. package/examples/showcase/checks-and-expanders.ts +163 -0
  30. package/examples/showcase/cultures.ts +39 -0
  31. package/examples/showcase/dates.ts +182 -0
  32. package/examples/showcase/dialogs.ts +184 -0
  33. package/examples/showcase/feedback-and-navigation.ts +174 -0
  34. package/examples/showcase/fields.ts +178 -0
  35. package/examples/showcase/fonts/Jost-Variable.ttf +0 -0
  36. package/examples/showcase/fonts/OFL-Jost.txt +93 -0
  37. package/examples/showcase/grids.ts +150 -0
  38. package/examples/showcase/index.html +60 -0
  39. package/examples/showcase/layout-and-navigation.ts +47 -0
  40. package/examples/showcase/nivona.css +98 -0
  41. package/examples/showcase/selects.ts +158 -0
  42. package/examples/showcase/showcase.css +231 -0
  43. package/examples/showcase/showcase.ts +214 -0
  44. package/examples/showcase/tabs.ts +161 -0
  45. package/examples/showcase/themes.css +83 -0
  46. package/examples/showcase/themes.ts +54 -0
  47. package/lib/components/IntervalComponent.d.ts +5 -0
  48. package/lib/components/IntervalComponent.js +29 -13
  49. package/lib/components/auto-suggest/AutoSuggestComponent.d.ts +11 -9
  50. package/lib/components/auto-suggest/AutoSuggestComponent.js +25 -38
  51. package/lib/components/button/ButtonComponent.d.ts +30 -1
  52. package/lib/components/button/ButtonComponent.js +85 -4
  53. package/lib/components/checkbox/CheckBoxComponent.d.ts +11 -1
  54. package/lib/components/checkbox/CheckBoxComponent.js +66 -56
  55. package/lib/components/checkbox/CheckBoxStyle.scss +72 -85
  56. package/lib/components/date/DateComponent.d.ts +10 -0
  57. package/lib/components/date/DateComponent.js +92 -44
  58. package/lib/components/date-range/DateRangeComponent.d.ts +14 -3
  59. package/lib/components/date-range/DateRangeComponent.js +96 -86
  60. package/lib/components/date-range/DateRangeStyle.scss +35 -11
  61. package/lib/components/date-time/DateTimeComponent.d.ts +8 -0
  62. package/lib/components/date-time/DateTimeComponent.js +64 -23
  63. package/lib/components/date-time/DateTimeStyle.scss +10 -7
  64. package/lib/components/dialog/DialogComponent.d.ts +21 -7
  65. package/lib/components/dialog/DialogComponent.js +179 -122
  66. package/lib/components/expander/ExpanderComponent.d.ts +15 -1
  67. package/lib/components/expander/ExpanderComponent.js +85 -64
  68. package/lib/components/expander/ExpanderStyle.scss +61 -47
  69. package/lib/components/form-field/FormFieldComponent.d.ts +45 -15
  70. package/lib/components/form-field/FormFieldComponent.js +249 -96
  71. package/lib/components/form-field/FormFieldStyle.scss +36 -87
  72. package/lib/components/form-field/create-control.d.ts +7 -0
  73. package/lib/components/form-field/create-control.js +48 -0
  74. package/lib/components/input/InputComponent.d.ts +18 -1
  75. package/lib/components/input/InputComponent.js +68 -93
  76. package/lib/components/loading/LoadingComponent.d.ts +9 -2
  77. package/lib/components/loading/LoadingComponent.js +13 -12
  78. package/lib/components/loading/LoadingStyle.css +19 -29
  79. package/lib/components/navigation/NavigationComponent.d.ts +34 -10
  80. package/lib/components/navigation/NavigationComponent.js +261 -33
  81. package/lib/components/navigation/NavigationStyle.scss +62 -226
  82. package/lib/components/notification/Notification.d.ts +37 -4
  83. package/lib/components/notification/Notification.js +160 -41
  84. package/lib/components/notification/Notification.scss +103 -19
  85. package/lib/components/number/NumberComponent.d.ts +16 -2
  86. package/lib/components/number/NumberComponent.js +54 -53
  87. package/lib/components/overlay/OverlayComponent.d.ts +13 -7
  88. package/lib/components/overlay/OverlayComponent.js +46 -114
  89. package/lib/components/overlay/overlay.css +18 -57
  90. package/lib/components/progress/ProgressComponent.d.ts +1 -0
  91. package/lib/components/progress/ProgressComponent.js +6 -6
  92. package/lib/components/progress/ProgressStyle.scss +5 -15
  93. package/lib/components/ribbon-menu/RibbonMenuComponent.js +2 -2
  94. package/lib/components/ribbon-menu/RibbonMenuStyle.scss +6 -76
  95. package/lib/components/select/SelectComponent.d.ts +33 -3
  96. package/lib/components/select/SelectComponent.js +312 -278
  97. package/lib/components/select/SelectDDAreaComponent.d.ts +13 -7
  98. package/lib/components/select/SelectDDAreaComponent.js +215 -256
  99. package/lib/components/select/SelectStyle.scss +204 -186
  100. package/lib/components/slider/nouislider.css +40 -54
  101. package/lib/components/stack-panel/SplitterComponent.d.ts +19 -3
  102. package/lib/components/stack-panel/SplitterComponent.js +94 -111
  103. package/lib/components/stack-panel/SplitterStyle.scss +9 -45
  104. package/lib/components/stack-panel/StackPanelComponent.js +3 -3
  105. package/lib/components/stack-panel/StackPanelStyle.scss +10 -52
  106. package/lib/components/tabs/TabsComponent.d.ts +17 -1
  107. package/lib/components/tabs/TabsComponent.js +247 -123
  108. package/lib/components/tabs/TabsStyle.scss +138 -75
  109. package/lib/components/time/TimeComponent.d.ts +5 -0
  110. package/lib/components/time/TimeComponent.js +61 -69
  111. package/lib/components/time/TimeComponent.scss +4 -4
  112. package/lib/components/tree-view/TreeViewComponent.d.ts +10 -4
  113. package/lib/components/tree-view/TreeViewComponent.js +65 -32
  114. package/lib/components/tree-view/TreeViewStyle.scss +12 -96
  115. package/lib/core/jq.js +11 -8
  116. package/lib/grid/slick-default-theme.css +107 -31
  117. package/lib/grid/slick.creator.js +23 -5
  118. package/lib/grid/slick.formatters.js +4 -3
  119. package/lib/grid/slick.grid.css +38 -26
  120. package/lib/grid/slick.grid.d.ts +1 -0
  121. package/lib/grid/slick.grid.js +2 -3
  122. package/lib/grid.css +3413 -454
  123. package/lib/index.css +2500 -1031
  124. package/lib/index.css.map +1 -1
  125. package/lib/index.d.ts +1 -0
  126. package/lib/index.js +1 -1
  127. package/lib/index.js.map +1 -1
  128. package/lib/interaction/moveable.d.ts +1 -0
  129. package/lib/interaction/moveable.js +8 -0
  130. package/lib/interaction/resizable.d.ts +1 -0
  131. package/lib/interaction/resizable.js +9 -0
  132. package/lib/ui/auto.suggest.css +31 -14
  133. package/lib/ui/auto.suggest.d.ts +1 -0
  134. package/lib/ui/auto.suggest.js +88 -18
  135. package/lib/ui/base.css +2 -48
  136. package/lib/ui/button.css +134 -0
  137. package/lib/ui/date-input.css +11 -0
  138. package/lib/ui/date.picker/css/tiny-date-picker.css +124 -325
  139. package/lib/ui/date.picker/date-picker-options.js +4 -3
  140. package/lib/ui/date.picker/lib/date-manip.js +9 -0
  141. package/lib/ui/date.picker/mode/base-mode.d.ts +2 -1
  142. package/lib/ui/date.picker/mode/base-mode.js +112 -22
  143. package/lib/ui/date.picker/mode/dropdown-mode.d.ts +2 -4
  144. package/lib/ui/date.picker/mode/dropdown-mode.js +29 -42
  145. package/lib/ui/date.picker/mode/index.d.ts +2 -1
  146. package/lib/ui/date.picker/mode/modal-mode.d.ts +2 -1
  147. package/lib/ui/date.picker/mode/modal-mode.js +4 -2
  148. package/lib/ui/date.picker/mode/permanent-mode.d.ts +2 -1
  149. package/lib/ui/date.picker/views/day-picker.js +24 -15
  150. package/lib/ui/date.picker/views/month-picker.js +1 -1
  151. package/lib/ui/date.picker/views/year-picker.js +3 -2
  152. package/lib/ui/date.picker.d.ts +2 -1
  153. package/lib/ui/dialog.css +144 -108
  154. package/lib/ui/dialog.d.ts +19 -1
  155. package/lib/ui/dialog.js +178 -60
  156. package/lib/ui/input.css +35 -0
  157. package/lib/ui/number.input.js +50 -37
  158. package/lib/ui/theme.css +28 -0
  159. package/package.json +12 -8
  160. package/lib/components/drop-down/DropDownComponent.d.ts +0 -27
  161. package/lib/components/drop-down/DropDownComponent.js +0 -60
  162. package/lib/components/expander/OldExpanderStyle.scss +0 -37
  163. package/lib/ui/drop.down.d.ts +0 -52
  164. package/lib/ui/drop.down.js +0 -2112
@@ -1,47 +1,275 @@
1
1
  import "./NavigationStyle.scss";
2
+ import { helper } from "../../core/helper";
3
+ /** Responsive navigation using native links and disclosure buttons. */
2
4
  export class NavigationComponent {
3
5
  constructor(options) {
4
- this.options = { position: "fixed", id: "luxbar-checkbox", alignment: "left", ...options };
5
- }
6
- isEqual(node) {
7
- return this.__proto__ === node.__proto__;
6
+ this.State = { id: helper.newDomGuid(), mobileOpen: false, openPath: "" };
7
+ this.options = { position: "fixed", alignment: "left", ...options };
8
8
  }
9
+ isEqual(node) { return Object.getPrototypeOf(this) === Object.getPrototypeOf(node); }
10
+ onInit(renderer) { this.State.renderer = renderer; }
9
11
  render() {
10
- var _a, _b;
12
+ var _a, _b, _c, _d;
13
+ this.State.owner = this;
14
+ const id = (_a = this.options.id) !== null && _a !== void 0 ? _a : this.State.id;
15
+ const active = this.activePath();
11
16
  return {
12
- tag: "header",
13
- attr: { style: this.options.style, class: "nav-comp " + ((_a = this.options.class) !== null && _a !== void 0 ? _a : "") },
14
- children: [
15
- { tag: "div", attr: { class: "luxbar luxbar-" + this.options.position },
16
- children: [
17
- { tag: "input", attr: { type: "checkbox", class: "luxbar-checkbox", id: this.options.id } },
18
- { tag: "div", attr: { class: "luxbar-menu luxbar-menu-" + this.options.alignment + " luxbar-menu-light" },
19
- children: [{ tag: "ul", attr: { class: "luxbar-navigation" }, children: [
20
- { tag: "li", attr: { class: "luxbar-header" }, children: [
21
- { tag: "a", attr: { href: (_b = this.options.titleLink) !== null && _b !== void 0 ? _b : "#", class: "luxbar-brand" }, children: [this.toNode(this.options.title)] },
22
- { tag: "label", attr: { class: "luxbar-hamburger luxbar-hamburger-spin", for: this.options.id },
23
- children: [{ tag: "span" }] },
24
- ] },
25
- ...this.options.data.map((x) => this.itemToNode(x))
26
- ] }] }
27
- ] }
28
- ]
17
+ tag: "header", attr: {
18
+ class: "nav-comp jsl-navigation jsl-navigation--" + this.options.position + " " + ((_b = this.options.class) !== null && _b !== void 0 ? _b : ""),
19
+ style: this.options.style, id: this.options.id,
20
+ keydown: (event) => { this.keydown(event); return false; }
21
+ }, children: [{ tag: "nav", attr: {
22
+ class: "jsl-nav-bar jsl-nav-bar--" + this.options.alignment + (this.State.mobileOpen ? " is-open" : ""),
23
+ "aria-label": (_c = this.options.ariaLabel) !== null && _c !== void 0 ? _c : "Main navigation"
24
+ }, children: [
25
+ { tag: this.options.titleLink ? "a" : "span", attr: {
26
+ class: "jsl-nav-brand", href: this.options.titleLink,
27
+ click: () => { this.close(); return false; }
28
+ }, children: [this.node(this.options.title)] },
29
+ { tag: "button", attr: {
30
+ id: id + "-toggle", type: "button", class: "jsl-nav-toggle",
31
+ "aria-label": (_d = this.options.menuButtonLabel) !== null && _d !== void 0 ? _d : "Navigation menu",
32
+ "aria-expanded": String(this.State.mobileOpen), "aria-controls": id + "-items",
33
+ click: () => {
34
+ this.State.mobileOpen = !this.State.mobileOpen;
35
+ this.State.openPath = "";
36
+ this.refresh();
37
+ return false;
38
+ }
39
+ }, children: [{ tag: "span", attr: { class: "jsl-nav-menu-icon", "aria-hidden": "true" } }] },
40
+ { tag: "ul", attr: { id: id + "-items", class: "jsl-nav-items" },
41
+ children: this.options.data.map((item, index) => this.item(item, String(index), id, active)) }
42
+ ] }]
29
43
  };
30
44
  }
31
- itemToNode(x) {
32
- var _a, _b, _c;
33
- return { tag: "li", attr: { class: "luxbar-item" + (((_a = x.children) === null || _a === void 0 ? void 0 : _a.length) > 0 ? " dropdown" : "") + (this.isActive(x.link) ? " active" : "") }, children: [
34
- { tag: "a", attr: { href: (_b = x.link) !== null && _b !== void 0 ? _b : "#", target: x.target, click: x.click }, children: [this.toNode(x.content)] },
35
- (((_c = x.children) === null || _c === void 0 ? void 0 : _c.length) > 0 ? { tag: "ul", children: x.children.map((c) => this.itemToNode(c)) } : undefined)
45
+ onCreate(node) {
46
+ const state = this.State;
47
+ state.dom = node.dom;
48
+ const outside = (event) => {
49
+ var _a, _b;
50
+ if (!((_a = state.dom) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
51
+ (_b = state.owner) === null || _b === void 0 ? void 0 : _b.close(true);
52
+ }
53
+ };
54
+ const focusout = (event) => {
55
+ var _a, _b;
56
+ if (event.relatedTarget && !((_a = state.dom) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget))) {
57
+ (_b = state.owner) === null || _b === void 0 ? void 0 : _b.close();
58
+ }
59
+ };
60
+ const route = () => { var _a, _b; (_a = state.owner) === null || _a === void 0 ? void 0 : _a.close(true); (_b = state.owner) === null || _b === void 0 ? void 0 : _b.refresh(); };
61
+ let compact = this.isCompact();
62
+ const resize = () => {
63
+ var _a, _b;
64
+ const next = (_a = state.owner) === null || _a === void 0 ? void 0 : _a.isCompact();
65
+ if (next !== compact) {
66
+ compact = next;
67
+ const focused = document.activeElement;
68
+ (_b = state.owner) === null || _b === void 0 ? void 0 : _b.close();
69
+ requestAnimationFrame(() => {
70
+ var _a, _b;
71
+ if (((_a = state.dom) === null || _a === void 0 ? void 0 : _a.contains(focused)) && !focused.getClientRects().length) {
72
+ (_b = state.dom.querySelector(next ? ".jsl-nav-toggle" : ".jsl-nav-link:not(:disabled):not([aria-disabled=true])")) === null || _b === void 0 ? void 0 : _b.focus();
73
+ }
74
+ });
75
+ }
76
+ };
77
+ const observer = typeof ResizeObserver === "undefined" ? undefined : new ResizeObserver(resize);
78
+ observer === null || observer === void 0 ? void 0 : observer.observe(state.dom);
79
+ document.addEventListener("pointerdown", outside);
80
+ state.dom.addEventListener("focusout", focusout);
81
+ window.addEventListener("hashchange", route);
82
+ window.addEventListener("popstate", route);
83
+ window.addEventListener("resize", resize);
84
+ state.cleanup = () => {
85
+ var _a;
86
+ document.removeEventListener("pointerdown", outside);
87
+ (_a = state.dom) === null || _a === void 0 ? void 0 : _a.removeEventListener("focusout", focusout);
88
+ window.removeEventListener("hashchange", route);
89
+ window.removeEventListener("popstate", route);
90
+ window.removeEventListener("resize", resize);
91
+ observer === null || observer === void 0 ? void 0 : observer.disconnect();
92
+ };
93
+ }
94
+ onRemove() {
95
+ var _a, _b;
96
+ (_b = (_a = this.State).cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
97
+ this.State.dom = undefined;
98
+ this.State.renderer = undefined;
99
+ this.State.owner = undefined;
100
+ }
101
+ item(item, path, id, active) {
102
+ var _a, _b;
103
+ const hasChildren = !!((_a = item.children) === null || _a === void 0 ? void 0 : _a.length);
104
+ const open = this.State.openPath === path || this.State.openPath.startsWith(path + "-");
105
+ const disabled = item.enabled === false;
106
+ const disclosureOnly = hasChildren && !item.link && !item.click;
107
+ const disclosure = () => {
108
+ this.State.openPath = open ? path.includes("-") ? path.slice(0, path.lastIndexOf("-")) : "" : path;
109
+ this.refresh();
110
+ };
111
+ const submenuAttrs = {
112
+ "aria-expanded": String(open), "aria-controls": id + "-list-" + path,
113
+ "data-nav-disclosure": path
114
+ };
115
+ return { tag: "li", attr: {
116
+ class: "jsl-nav-item" + (active === path || active.startsWith(path + "-") ? " is-active" : ""),
117
+ "data-nav-path": path
118
+ }, children: [
119
+ { tag: "div", attr: { class: "jsl-nav-row" }, children: [
120
+ { tag: item.link ? "a" : "button", attr: {
121
+ class: "jsl-nav-link", type: item.link ? undefined : "button",
122
+ href: disabled ? undefined : item.link, target: item.target,
123
+ rel: item.target === "_blank" ? "noopener noreferrer" : undefined,
124
+ disabled: disabled && !item.link ? "disabled" : undefined,
125
+ "aria-disabled": disabled ? "true" : undefined,
126
+ tabindex: disabled ? "-1" : undefined,
127
+ "aria-current": !disabled && active === path && !disclosureOnly ? "page" : undefined,
128
+ ...(disclosureOnly ? submenuAttrs : {}),
129
+ click: (event) => {
130
+ var _a;
131
+ if (disabled) {
132
+ event.preventDefault();
133
+ return false;
134
+ }
135
+ if (disclosureOnly) {
136
+ disclosure();
137
+ }
138
+ else {
139
+ try {
140
+ (_a = item.click) === null || _a === void 0 ? void 0 : _a.call(item, event);
141
+ }
142
+ finally {
143
+ this.close(true);
144
+ this.refresh();
145
+ }
146
+ }
147
+ return false;
148
+ }
149
+ }, children: [this.node(item.content), ...(disclosureOnly ? [this.chevron()] : [])] },
150
+ ...(hasChildren && !disclosureOnly ? [{ tag: "button", attr: {
151
+ type: "button", class: "jsl-nav-submenu-toggle", ...submenuAttrs,
152
+ disabled: disabled ? "disabled" : undefined,
153
+ "aria-label": (_b = item.submenuLabel) !== null && _b !== void 0 ? _b : (typeof item.content === "string" ? item.content + " submenu" : "Open submenu"),
154
+ click: () => { if (!disabled) {
155
+ disclosure();
156
+ } return false; }
157
+ }, children: [this.chevron()] }] : [])
158
+ ] },
159
+ ...(hasChildren ? [{ tag: "ul", attr: {
160
+ id: id + "-list-" + path, class: "jsl-nav-submenu", hidden: open ? undefined : "hidden"
161
+ }, children: item.children.map((child, index) => this.item(child, path + "-" + index, id, active)) }] : [])
36
162
  ] };
37
163
  }
38
- isActive(link) {
39
- return location.hash.startsWith(link);
164
+ keydown(event) {
165
+ var _a, _b, _c, _d, _e;
166
+ const target = event.target;
167
+ const control = target.closest("[data-nav-disclosure]");
168
+ const list = target.closest(".jsl-nav-submenu");
169
+ if (event.key === "Escape") {
170
+ if (this.State.openPath) {
171
+ const path = (_a = list === null || list === void 0 ? void 0 : list.parentElement.dataset.navPath) !== null && _a !== void 0 ? _a : this.State.openPath;
172
+ (_b = this.disclosure(path)) === null || _b === void 0 ? void 0 : _b.focus();
173
+ this.State.openPath = path.includes("-") ? path.slice(0, path.lastIndexOf("-")) : "";
174
+ this.refresh();
175
+ }
176
+ else if (this.State.mobileOpen) {
177
+ this.close(true);
178
+ }
179
+ else {
180
+ return;
181
+ }
182
+ }
183
+ else if (control && !control.hasAttribute("disabled") && ["ArrowDown", "ArrowUp", "ArrowRight"].indexOf(event.key) >= 0) {
184
+ this.State.openPath = control.dataset.navDisclosure;
185
+ this.refresh();
186
+ const submenu = (_c = control.closest("li")) === null || _c === void 0 ? void 0 : _c.querySelector(".jsl-nav-submenu");
187
+ requestAnimationFrame(() => {
188
+ var _a;
189
+ const controls = this.rowControls(submenu);
190
+ (_a = controls[event.key === "ArrowUp" ? controls.length - 1 : 0]) === null || _a === void 0 ? void 0 : _a.focus();
191
+ });
192
+ }
193
+ else if (list && ["ArrowDown", "ArrowUp", "Home", "End"].indexOf(event.key) >= 0) {
194
+ const controls = this.rowControls(list);
195
+ const index = controls.indexOf(target.closest("a,button"));
196
+ const next = event.key === "Home" ? 0 : event.key === "End" ? controls.length - 1 :
197
+ (index + (event.key === "ArrowDown" ? 1 : -1) + controls.length) % controls.length;
198
+ (_d = controls[next]) === null || _d === void 0 ? void 0 : _d.focus();
199
+ }
200
+ else if (list && event.key === "ArrowLeft") {
201
+ const path = list.parentElement.dataset.navPath;
202
+ (_e = this.disclosure(path)) === null || _e === void 0 ? void 0 : _e.focus();
203
+ this.State.openPath = path.includes("-") ? path.slice(0, path.lastIndexOf("-")) : "";
204
+ this.refresh();
205
+ }
206
+ else {
207
+ return;
208
+ }
209
+ event.preventDefault();
210
+ event.stopPropagation();
40
211
  }
41
- toNode(content) {
42
- if (typeof content === "string") {
43
- return { tag: "span", content };
212
+ rowControls(list) {
213
+ if (!list) {
214
+ return [];
44
215
  }
45
- return content;
216
+ return Array.from(list.querySelectorAll(":scope > li > .jsl-nav-row > a,:scope > li > .jsl-nav-row > button"))
217
+ .filter(element => !element.hasAttribute("disabled") && element.getAttribute("aria-disabled") !== "true");
218
+ }
219
+ disclosure(path) { var _a; return (_a = this.State.dom) === null || _a === void 0 ? void 0 : _a.querySelector('[data-nav-disclosure="' + path + '"]'); }
220
+ isCompact() {
221
+ var _a;
222
+ const toggle = (_a = this.State.dom) === null || _a === void 0 ? void 0 : _a.querySelector(".jsl-nav-toggle");
223
+ return !!toggle && getComputedStyle(toggle).display !== "none";
224
+ }
225
+ close(restoreFocus = false) {
226
+ var _a, _b, _c, _d;
227
+ if (!this.State.mobileOpen && !this.State.openPath) {
228
+ return;
229
+ }
230
+ if (restoreFocus && ((_a = this.State.dom) === null || _a === void 0 ? void 0 : _a.contains(document.activeElement))) {
231
+ if (this.isCompact() && this.State.mobileOpen) {
232
+ (_b = this.State.dom.querySelector(".jsl-nav-toggle")) === null || _b === void 0 ? void 0 : _b.focus();
233
+ }
234
+ else if ((_c = document.activeElement) === null || _c === void 0 ? void 0 : _c.closest(".jsl-nav-submenu")) {
235
+ (_d = this.disclosure(this.State.openPath.split("-")[0])) === null || _d === void 0 ? void 0 : _d.focus();
236
+ }
237
+ }
238
+ this.State.mobileOpen = false;
239
+ this.State.openPath = "";
240
+ this.refresh();
241
+ }
242
+ activePath() {
243
+ let best = "", score = -1;
244
+ const visit = (items, prefix = "") => items.forEach((item, index) => {
245
+ var _a, _b, _c, _d;
246
+ const path = prefix + index;
247
+ if (item.enabled === false) {
248
+ return;
249
+ }
250
+ const current = (_a = this.options.activeLink) !== null && _a !== void 0 ? _a : location.href;
251
+ let matches = false;
252
+ if (item.link) {
253
+ try {
254
+ const url = new URL(item.link, location.href), actual = new URL(current, location.href);
255
+ matches = url.origin === actual.origin && url.pathname === actual.pathname && url.search === actual.search &&
256
+ (url.hash ? actual.hash === url.hash || actual.hash.startsWith(url.hash + "/") : !actual.hash);
257
+ }
258
+ catch ( /* Invalid URLs are rendered but never selected. */_e) { /* Invalid URLs are rendered but never selected. */ }
259
+ }
260
+ const weight = item.active ? Number.MAX_SAFE_INTEGER : (_c = (_b = item.link) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
261
+ if (((_d = item.active) !== null && _d !== void 0 ? _d : matches) && weight > score) {
262
+ best = path;
263
+ score = weight;
264
+ }
265
+ if (item.children) {
266
+ visit(item.children, path + "-");
267
+ }
268
+ });
269
+ visit(this.options.data);
270
+ return best;
46
271
  }
272
+ refresh() { var _a; (_a = this.State.renderer) === null || _a === void 0 ? void 0 : _a.refresh(); }
273
+ node(content) { return typeof content === "string" ? { tag: "span", content } : content; }
274
+ chevron() { return { tag: "span", attr: { class: "jsl-nav-chevron", "aria-hidden": "true" } }; }
47
275
  }
@@ -1,226 +1,62 @@
1
- .nav-comp {
2
-
3
- line-height: 1.9rem;
4
-
5
- .dropdown ul {
6
- border-bottom-left-radius: 6px;
7
- border-bottom-right-radius: 6px;
8
- }
9
-
10
- .luxbar-default {
11
- width: 100%;
12
- position: relative;
13
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
14
- z-index: 1010; }
15
-
16
- .luxbar-static {
17
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
18
- width: 100%;
19
- position: absolute;
20
- top: 0;
21
- left: 0;
22
- z-index: 1010; }
23
- .luxbar-static .luxbar-checkbox:checked ~ .luxbar-menu {
24
- position: absolute; }
25
-
26
- .luxbar-fixed {
27
- width: 100%;
28
- position: fixed;
29
- top: 0;
30
- left: 0;
31
- z-index: 1010;
32
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); }
33
-
34
- .luxbar-fixed-bottom {
35
- width: 100%;
36
- position: fixed;
37
- bottom: 0;
38
- left: 0;
39
- z-index: 1010;
40
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); }
41
-
42
- .luxbar-hamburger span, .luxbar-hamburger span::before, .luxbar-hamburger span::after {
43
- display: block;
44
- height: 2px;
45
- width: 26px;
46
- transition: 0.6s ease; }
47
-
48
- .luxbar-checkbox:checked ~ .luxbar-menu li .luxbar-hamburger span {
49
- background-color: transparent; }
50
- .luxbar-checkbox:checked ~ .luxbar-menu li .luxbar-hamburger span::before, .luxbar-checkbox:checked ~ .luxbar-menu li .luxbar-hamburger span::after {
51
- margin-top: 0; }
52
-
53
- .luxbar-header {
54
- display: flex;
55
- flex-direction: row;
56
- justify-content: space-between;
57
- align-items: center;
58
- height: 58px; }
59
-
60
- .luxbar-menu-left .luxbar-navigation,
61
- .luxbar-menu-left .luxbar-header {
62
- justify-content: flex-start; }
63
-
64
- .luxbar-menu-right .luxbar-hamburger {
65
- margin-left: auto; }
66
-
67
- .luxbar-brand {
68
- font-size: 1.6em;
69
- padding: 18px 24px 18px 24px; }
70
-
71
- .luxbar-menu {
72
- min-height: 58px;
73
- transition: 0.6s ease;
74
- width: 100%; }
75
-
76
- .luxbar-navigation {
77
- display: flex;
78
- flex-direction: column;
79
- list-style: none;
80
- padding-left: 0;
81
- margin: 0; }
82
-
83
- .luxbar-menu a,
84
- .luxbar-item a {
85
- text-decoration: none;
86
- color: inherit;
87
- cursor: pointer; }
88
-
89
- .luxbar-item {
90
- height: 58px; }
91
- .luxbar-item a {
92
- padding: 18px 24px 18px 24px;
93
- display: block; }
94
-
95
- .luxbar-hamburger {
96
- padding: 18px 24px 18px 24px;
97
- position: absolute;
98
- right: 0;
99
- cursor: pointer; }
100
- .luxbar-hamburger span::before, .luxbar-hamburger span::after {
101
- content: '';
102
- position: absolute; }
103
- .luxbar-hamburger span::before {
104
- margin-top: -8px; }
105
- .luxbar-hamburger span::after {
106
- margin-top: 8px; }
107
-
108
- .luxbar-checkbox {
109
- display: none; }
110
- .luxbar-checkbox:not(:checked) ~ .luxbar-menu {
111
- overflow: hidden;
112
- height: 58px; }
113
- .luxbar-checkbox:checked ~ .luxbar-menu {
114
- transition: height 0.6s ease;
115
- height: 100vh;
116
- overflow: auto; }
117
-
118
- .dropdown {
119
- position: relative;
120
- height: auto;
121
- min-height: 58px;
122
- }
123
-
124
- .dropdown:hover > ul {
125
- position: relative;
126
- display: block;
127
- min-width: 100%; }
128
- .dropdown > a::after {
129
- position: absolute;
130
- content: '';
131
- right: 10px;
132
- top: 25px;
133
- border-width: 5px 5px 0;
134
- border-color: transparent;
135
- border-style: solid; }
136
- .dropdown > ul {
137
- display: block;
138
- overflow-x: hidden;
139
- list-style: none;
140
- padding: 0; }
141
- .dropdown > ul .luxbar-item {
142
- min-width: 100%;
143
- height: 29px;
144
- padding: 5px 10px 5px 40px; }
145
- .dropdown > ul .luxbar-item a {
146
- min-height: 29px;
147
- line-height: 29px;
148
- padding: 0; }
149
-
150
- @media screen and (min-width: 768px) {
151
- .luxbar-navigation {
152
- flex-flow: row;
153
- justify-content: flex-end; }
154
-
155
- .luxbar-hamburger {
156
- display: none; }
157
-
158
- .luxbar-checkbox:not(:checked) ~ .luxbar-menu {
159
- overflow: visible; }
160
- .luxbar-checkbox:checked ~ .luxbar-menu {
161
- height: 58px; }
162
-
163
- .luxbar-menu .luxbar-item {
164
- border-top: 0; }
165
-
166
- .luxbar-menu-right .luxbar-header {
167
- margin-right: auto; }
168
-
169
- .dropdown {
170
- height: 58px; }
171
- .dropdown:hover > ul {
172
- position: absolute;
173
- left: 0;
174
- top: 58px;
175
- padding: 0; }
176
- .dropdown > ul {
177
- display: none; }
178
- .dropdown > ul .luxbar-item {
179
- padding: 5px 10px; }
180
- .dropdown > ul .luxbar-item a {
181
- white-space: nowrap; } }
182
- .luxbar-checkbox:checked + .luxbar-menu .luxbar-hamburger-doublespin span::before {
183
- transform: rotate(225deg); }
184
- .luxbar-checkbox:checked + .luxbar-menu .luxbar-hamburger-doublespin span::after {
185
- transform: rotate(-225deg); }
186
- .luxbar-checkbox:checked + .luxbar-menu .luxbar-hamburger-spin span::before {
187
- transform: rotate(45deg); }
188
- .luxbar-checkbox:checked + .luxbar-menu .luxbar-hamburger-spin span::after {
189
- transform: rotate(-45deg); }
190
-
191
- .luxbar-menu-dark,
192
- .luxbar-menu-dark .dropdown ul {
193
- background-color: #212121;
194
- color: #fff; }
195
-
196
- .luxbar-menu-dark .active,
197
- .luxbar-menu-dark .luxbar-item:hover {
198
- background-color: #424242; }
199
- .luxbar-menu-dark .luxbar-hamburger span,
200
- .luxbar-menu-dark .luxbar-hamburger span::before,
201
- .luxbar-menu-dark .luxbar-hamburger span::after {
202
- background-color: #fff; }
203
-
204
- .luxbar-menu-light {
205
- background-color: #e0e0e0;
206
- color: #212121;
207
- }
208
-
209
- .luxbar-menu-light .dropdown ul {
210
- background-color: #ffffff;
211
- color: #212121;
212
- // border: 1px solid #e0e0e0;
213
- box-shadow: 0px 4px 3px 0px rgba(0,0,0,0.36);
214
- li:not(:last-child) {
215
- border-bottom: 1px solid #e0e0e0;
216
- }
217
- }
218
-
219
- .luxbar-menu-light .active,
220
- .luxbar-menu-light .luxbar-item:hover {
221
- background-color: #bdbdbd; }
222
- .luxbar-menu-light .luxbar-hamburger span,
223
- .luxbar-menu-light .luxbar-hamburger span::before,
224
- .luxbar-menu-light .luxbar-hamburger span::after {
225
- background-color: #212121; }
226
- }
1
+ @import "../../ui/theme.css";
2
+
3
+ .jsl-navigation {
4
+ position: relative; width: 100%; color: var(--jsl-color-text); background: var(--jsl-color-surface);
5
+ border-block: 1px solid var(--jsl-color-border-subtle); box-sizing: border-box; font: inherit; font-size: .875rem; line-height: 1.4;
6
+ *, *::before, *::after { box-sizing: border-box; }
7
+ &--fixed, &--fixed-bottom { position: fixed; inset-inline: 0; z-index: 1010; box-shadow: 0 2px 8px #0000000a; }
8
+ &--fixed { top: 0; }
9
+ &--fixed-bottom { bottom: 0; }
10
+ [hidden] { display: none !important; }
11
+ button, a { -webkit-tap-highlight-color: transparent; }
12
+ button { font: inherit; }
13
+ button:focus-visible, a:focus-visible { outline: 2px solid var(--jsl-color-focus); outline-offset: 2px; z-index: 1; }
14
+ }
15
+ .jsl-nav-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; padding: .625rem 1rem; min-height: 3.5rem; container-type: inline-size; }
16
+ .jsl-nav-brand { display: flex; align-items: center; gap: .5rem; color: inherit; text-decoration: none; font-weight: 650; font-size: 1rem; min-width: 0; overflow-wrap: anywhere; }
17
+ .jsl-nav-items, .jsl-nav-submenu { list-style: none; padding: 0; margin: 0; }
18
+ .jsl-nav-items { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; min-width: 0; }
19
+ .jsl-nav-bar--right > .jsl-nav-items { margin-inline-start: auto; }
20
+ .jsl-nav-item { position: relative; min-width: 0; }
21
+ .jsl-nav-row { display: flex; align-items: stretch; border-radius: .375rem; }
22
+ .jsl-nav-link, .jsl-nav-submenu-toggle, .jsl-nav-toggle {
23
+ border: 0; background: transparent; color: var(--jsl-color-text-secondary); cursor: pointer; text-decoration: none;
24
+ display: inline-flex; align-items: center; justify-content: center; gap: .625rem; padding: .5rem .75rem;
25
+ border-radius: .375rem; min-height: 2.25rem; line-height: 1.4;
26
+ }
27
+ .jsl-nav-link { flex: 1; justify-content: flex-start; text-align: start; min-width: 0; overflow-wrap: anywhere; }
28
+ .jsl-nav-link > img, .jsl-nav-brand img { max-height: 1.5rem; width: auto; }
29
+ .jsl-nav-submenu-toggle { padding-inline: .5rem; }
30
+ .jsl-nav-link:hover, .jsl-nav-submenu-toggle:hover, .jsl-nav-toggle:hover { background: var(--jsl-color-surface-hover); color: var(--jsl-color-text); }
31
+ .jsl-nav-item.is-active > .jsl-nav-row { background: var(--jsl-color-surface-selected); }
32
+ .jsl-nav-item.is-active > .jsl-nav-row > .jsl-nav-link { color: var(--jsl-color-text); font-weight: 600; }
33
+ .jsl-navigation :disabled, .jsl-navigation [aria-disabled=true] { color: var(--jsl-color-disabled-text); cursor: default; opacity: .6; background: transparent; }
34
+ .jsl-nav-chevron { width: .4rem; height: .4rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-.1rem) rotate(45deg); flex-shrink: 0; margin: .125rem; }
35
+ [aria-expanded=true] > .jsl-nav-chevron { transform: translateY(.1rem) rotate(225deg); }
36
+ .jsl-nav-submenu {
37
+ position: absolute; top: calc(100% + .375rem); inset-inline-end: 0; z-index: 1020; min-width: 12rem; width: max-content;
38
+ max-width: min(22rem, calc(100vw - 2rem)); padding: .375rem; background: var(--jsl-color-surface);
39
+ border: 1px solid var(--jsl-color-border-subtle); border-radius: .625rem; box-shadow: 0 8px 24px #0000001a;
40
+ max-height: min(28rem, 65dvh); overflow: auto;
41
+ }
42
+ // Nested disclosures remain inside the popup to avoid off-screen flyouts.
43
+ .jsl-nav-submenu .jsl-nav-submenu { position: static; width: auto; min-width: 0; max-height: none; border: 0; border-inline-start: 1px solid var(--jsl-color-border); border-radius: 0; box-shadow: none; margin: .25rem .5rem .375rem .75rem; padding: 0 0 0 .5rem; }
44
+ .jsl-navigation--fixed-bottom > .jsl-nav-bar > .jsl-nav-items > li > .jsl-nav-submenu { top: auto; bottom: calc(100% + .375rem); }
45
+ .jsl-nav-toggle { display: none; margin-inline-start: auto; width: 2.25rem; padding: .5rem; }
46
+ .jsl-nav-menu-icon, .jsl-nav-menu-icon::before, .jsl-nav-menu-icon::after { width: 1rem; height: 1.5px; background: currentColor; position: relative; display: block; }
47
+ .jsl-nav-menu-icon::before, .jsl-nav-menu-icon::after { content: ""; position: absolute; left: 0; top: -.3125rem; }
48
+ .jsl-nav-menu-icon::after { top: .3125rem; }
49
+ .is-open > .jsl-nav-toggle .jsl-nav-menu-icon { background: transparent; }
50
+ .is-open > .jsl-nav-toggle .jsl-nav-menu-icon::before { top: 0; transform: rotate(45deg); }
51
+ .is-open > .jsl-nav-toggle .jsl-nav-menu-icon::after { top: 0; transform: rotate(-45deg); }
52
+
53
+ @mixin compact-navigation {
54
+ .jsl-nav-toggle { display: inline-flex; }
55
+ .jsl-nav-brand { max-width: calc(100% - 4rem); }
56
+ .jsl-nav-items { display: none; width: 100%; margin-inline-start: 0; padding-top: .5rem; border-top: 1px solid var(--jsl-color-border-subtle); max-height: 65dvh; overflow: auto; }
57
+ .is-open > .jsl-nav-items { display: block; }
58
+ .jsl-nav-item + .jsl-nav-item { margin-top: .125rem; }
59
+ .jsl-nav-items .jsl-nav-submenu { position: static; width: auto; min-width: 0; max-width: none; max-height: none; border: 0; border-inline-start: 1px solid var(--jsl-color-border); border-radius: 0; box-shadow: none; margin: .25rem .5rem .375rem .75rem; padding: 0 0 0 .5rem; }
60
+ }
61
+ @container (max-width: 40rem) { @include compact-navigation; }
62
+ @media (max-width: 767px) { @include compact-navigation; }
@@ -1,5 +1,5 @@
1
1
  import "./Notification.scss";
2
- import { IJSLVNode, IJSLComponent } from "jsl-render";
2
+ import { IJSLVNode, IJSLComponent, JSLRender } from "jsl-render";
3
3
  export interface INotificationOptions {
4
4
  content: string | IJSLVNode | IJSLComponent;
5
5
  closeOnClick?: boolean;
@@ -7,13 +7,46 @@ export interface INotificationOptions {
7
7
  class?: string;
8
8
  style?: string;
9
9
  onClick?: () => void;
10
+ title?: string;
11
+ variant?: "default" | "info" | "success" | "warning" | "error";
12
+ showCloseButton?: boolean;
13
+ closeButtonLabel?: string;
14
+ onClose?: () => void;
15
+ }
16
+ /** The same surface can be rendered inline or hosted by Notification.show(). */
17
+ export declare class NotificationComponent implements IJSLComponent {
18
+ private options;
19
+ State: {
20
+ closed: boolean;
21
+ };
22
+ readonly id: string;
23
+ onInteractionChange?: (paused: boolean) => void;
24
+ private renderer;
25
+ private interactions;
26
+ private dom?;
27
+ private progressAnimation?;
28
+ private countdown?;
29
+ constructor(options: INotificationOptions);
30
+ onInit(renderer: JSLRender): void;
31
+ onCreate(node: IJSLVNode): void;
32
+ onRemove(): void;
33
+ /** The notification host keeps the visual countdown synchronized with dismissal. */
34
+ setCountdown(remaining: number, paused: boolean): void;
35
+ private updateProgress;
36
+ render(): IJSLVNode;
37
+ dismiss(): void;
38
+ private activate;
39
+ private pause;
10
40
  }
11
41
  export declare class Notification {
12
- static show(options: INotificationOptions): string;
13
- static clearNotification(id: string): void;
14
- static clearAll(): void;
15
42
  private static container;
16
43
  private static containerVNode;
17
44
  private static renderer;
45
+ private static entries;
46
+ static show(options: INotificationOptions): string;
47
+ static clearNotification(id: string): void;
48
+ static clearAll(): void;
49
+ private static schedule;
50
+ private static remove;
18
51
  private static createContainer;
19
52
  }