@smwb/ui-solid 2.0.0 → 2.1.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 (207) hide show
  1. package/README.md +115 -0
  2. package/dist/assets/styles/less/components/appBar/appBar.entry.css +1 -1
  3. package/dist/assets/styles/less/components/avatar/avatar.entry.css +1 -1
  4. package/dist/assets/styles/less/components/breadcrumbs/breadcrumbs.entry.css +1 -1
  5. package/dist/assets/styles/less/components/button/button.entry.css +1 -1
  6. package/dist/assets/styles/less/components/buttonGroup/buttonGroup.entry.css +1 -1
  7. package/dist/assets/styles/less/components/dagView/dagView.entry.css +1 -1
  8. package/dist/assets/styles/less/components/meter/meter.entry.css +1 -1
  9. package/dist/assets/styles/less/components/screenDivider/screenDivider.entry.css +1 -1
  10. package/dist/assets/styles/less/components/sheet/sheet.entry.css +1 -1
  11. package/dist/assets/styles/less/components/statusDot/statusDot.entry.css +1 -1
  12. package/dist/assets/styles/less/components/tabGroups/tabGroups.entry.css +1 -1
  13. package/dist/assets/styles/less/components/tabs/tab/tab.entry.css +1 -1
  14. package/dist/assets/styles/less/components/toggle/toggle.entry.css +1 -1
  15. package/dist/assets/styles/less/components/treeView/treeView.entry.css +1 -1
  16. package/dist/assets/styles/less/tokens.entry.css +1 -1
  17. package/dist/components/dataDisplay/avatar/avatar.d.ts +5 -2
  18. package/dist/components/dataDisplay/avatar/avatar.js +9 -9
  19. package/dist/components/dataDisplay/avatar/avatar.js.map +1 -1
  20. package/dist/components/dataDisplay/chart/chart.d.ts +16 -8
  21. package/dist/components/dataDisplay/chart/chartFull.d.ts +14 -0
  22. package/dist/components/dataDisplay/chart/core.d.ts +19 -0
  23. package/dist/components/dataDisplay/chart/index.d.ts +1 -1
  24. package/dist/components/dataDisplay/dagView/dagView.d.ts +4 -0
  25. package/dist/components/dataDisplay/dagView/dagView.js +124 -123
  26. package/dist/components/dataDisplay/dagView/dagView.js.map +1 -1
  27. package/dist/components/dataDisplay/dagView/index.d.ts +1 -1
  28. package/dist/components/dataDisplay/meter/index.d.ts +1 -1
  29. package/dist/components/dataDisplay/meter/meter.d.ts +14 -0
  30. package/dist/components/dataDisplay/meter/meter.js +32 -30
  31. package/dist/components/dataDisplay/meter/meter.js.map +1 -1
  32. package/dist/components/dataDisplay/statusDot/index.d.ts +1 -1
  33. package/dist/components/dataDisplay/statusDot/statusDot.d.ts +10 -1
  34. package/dist/components/dataDisplay/statusDot/statusDot.js +20 -11
  35. package/dist/components/dataDisplay/statusDot/statusDot.js.map +1 -1
  36. package/dist/components/dataDisplay/treeView/treeView.d.ts +18 -2
  37. package/dist/components/dataDisplay/treeView/treeView.js +140 -121
  38. package/dist/components/dataDisplay/treeView/treeView.js.map +1 -1
  39. package/dist/components/inputs/button/button.d.ts +7 -0
  40. package/dist/components/inputs/button/button.js +57 -51
  41. package/dist/components/inputs/button/button.js.map +1 -1
  42. package/dist/components/inputs/toggle/toggle.d.ts +6 -0
  43. package/dist/components/inputs/toggle/toggle.js +23 -23
  44. package/dist/components/inputs/toggle/toggle.js.map +1 -1
  45. package/dist/components/layout/appLayout/appLayout.d.ts +6 -1
  46. package/dist/components/layout/appLayout/appLayout.js +49 -42
  47. package/dist/components/layout/appLayout/appLayout.js.map +1 -1
  48. package/dist/components/layout/screenDivider/screenDivider.d.ts +12 -0
  49. package/dist/components/layout/screenDivider/screenDivider.js +87 -46
  50. package/dist/components/layout/screenDivider/screenDivider.js.map +1 -1
  51. package/dist/components/layout/sheet/sheet.d.ts +11 -0
  52. package/dist/components/layout/sheet/sheet.js +122 -102
  53. package/dist/components/layout/sheet/sheet.js.map +1 -1
  54. package/dist/components/layout/tabGroups/index.d.ts +1 -1
  55. package/dist/components/layout/tabGroups/tabGroups.d.ts +44 -1
  56. package/dist/components/layout/tabGroups/tabGroups.js +500 -460
  57. package/dist/components/layout/tabGroups/tabGroups.js.map +1 -1
  58. package/dist/components/layout/tabGroups/tabGroupsFocus.d.ts +16 -0
  59. package/dist/components/layout/tabGroups/tabGroupsFocus.js +102 -70
  60. package/dist/components/layout/tabGroups/tabGroupsFocus.js.map +1 -1
  61. package/dist/components/navigation/appBar/appBar.d.ts +12 -0
  62. package/dist/components/navigation/appBar/appBar.js.map +1 -1
  63. package/dist/components/navigation/breadcrumbs/breadcrumbs.d.ts +9 -0
  64. package/dist/components/navigation/breadcrumbs/breadcrumbs.js +47 -31
  65. package/dist/components/navigation/breadcrumbs/breadcrumbs.js.map +1 -1
  66. package/dist/components/navigation/tabs/tab/tab.js +71 -68
  67. package/dist/components/navigation/tabs/tab/tab.js.map +1 -1
  68. package/dist/components/navigation/tabs/tabs.d.ts +11 -0
  69. package/dist/components/navigation/tabs/tabs.js +19 -16
  70. package/dist/components/navigation/tabs/tabs.js.map +1 -1
  71. package/dist/components/navigation/tabs/tabsContext.d.ts +2 -0
  72. package/dist/components/navigation/tabs/tabsContext.js.map +1 -1
  73. package/dist/headless/components/dataDisplay/avatar/avatar.js +9 -9
  74. package/dist/headless/components/dataDisplay/avatar/avatar.js.map +1 -1
  75. package/dist/headless/components/dataDisplay/dagView/dagView.js +133 -132
  76. package/dist/headless/components/dataDisplay/dagView/dagView.js.map +1 -1
  77. package/dist/headless/components/dataDisplay/meter/meter.js +32 -30
  78. package/dist/headless/components/dataDisplay/meter/meter.js.map +1 -1
  79. package/dist/headless/components/dataDisplay/statusDot/statusDot.js +19 -10
  80. package/dist/headless/components/dataDisplay/statusDot/statusDot.js.map +1 -1
  81. package/dist/headless/components/dataDisplay/treeView/treeView.js +139 -120
  82. package/dist/headless/components/dataDisplay/treeView/treeView.js.map +1 -1
  83. package/dist/headless/components/inputs/button/button.js +57 -51
  84. package/dist/headless/components/inputs/button/button.js.map +1 -1
  85. package/dist/headless/components/inputs/toggle/toggle.js +23 -23
  86. package/dist/headless/components/inputs/toggle/toggle.js.map +1 -1
  87. package/dist/headless/components/layout/appLayout/appLayout.js +52 -45
  88. package/dist/headless/components/layout/appLayout/appLayout.js.map +1 -1
  89. package/dist/headless/components/layout/screenDivider/screenDivider.js +88 -47
  90. package/dist/headless/components/layout/screenDivider/screenDivider.js.map +1 -1
  91. package/dist/headless/components/layout/sheet/sheet.js +124 -104
  92. package/dist/headless/components/layout/sheet/sheet.js.map +1 -1
  93. package/dist/headless/components/layout/tabGroups/tabGroups.js +500 -460
  94. package/dist/headless/components/layout/tabGroups/tabGroups.js.map +1 -1
  95. package/dist/headless/components/layout/tabGroups/tabGroupsFocus.js +102 -70
  96. package/dist/headless/components/layout/tabGroups/tabGroupsFocus.js.map +1 -1
  97. package/dist/headless/components/navigation/appBar/appBar.js.map +1 -1
  98. package/dist/headless/components/navigation/breadcrumbs/breadcrumbs.js +46 -30
  99. package/dist/headless/components/navigation/breadcrumbs/breadcrumbs.js.map +1 -1
  100. package/dist/headless/components/navigation/tabs/tab/tab.js +70 -67
  101. package/dist/headless/components/navigation/tabs/tab/tab.js.map +1 -1
  102. package/dist/headless/components/navigation/tabs/tabs.js +19 -16
  103. package/dist/headless/components/navigation/tabs/tabs.js.map +1 -1
  104. package/dist/headless/components/navigation/tabs/tabsContext.js.map +1 -1
  105. package/dist/headless/primitives/publishHeaderOffset.js +19 -0
  106. package/dist/headless/primitives/publishHeaderOffset.js.map +1 -0
  107. package/dist/headless/source/components/dataDisplay/avatar/avatar.jsx +1 -0
  108. package/dist/headless/source/components/dataDisplay/avatar/avatar.jsx.map +1 -1
  109. package/dist/headless/source/components/dataDisplay/chart/chart.jsx +14 -12
  110. package/dist/headless/source/components/dataDisplay/chart/chart.jsx.map +1 -1
  111. package/dist/headless/source/components/dataDisplay/chart/chartFull.js +12 -0
  112. package/dist/headless/source/components/dataDisplay/chart/chartFull.js.map +7 -0
  113. package/dist/headless/source/components/dataDisplay/chart/core.js +11 -0
  114. package/dist/headless/source/components/dataDisplay/chart/core.js.map +7 -0
  115. package/dist/headless/source/components/dataDisplay/chart/index.js +1 -1
  116. package/dist/headless/source/components/dataDisplay/chart/index.js.map +1 -1
  117. package/dist/headless/source/components/dataDisplay/dagView/dagView.jsx +2 -1
  118. package/dist/headless/source/components/dataDisplay/dagView/dagView.jsx.map +1 -1
  119. package/dist/headless/source/components/dataDisplay/dagView/index.js.map +2 -2
  120. package/dist/headless/source/components/dataDisplay/meter/index.js.map +1 -1
  121. package/dist/headless/source/components/dataDisplay/meter/meter.jsx +14 -2
  122. package/dist/headless/source/components/dataDisplay/meter/meter.jsx.map +1 -1
  123. package/dist/headless/source/components/dataDisplay/statusDot/index.js.map +1 -1
  124. package/dist/headless/source/components/dataDisplay/statusDot/statusDot.jsx +13 -1
  125. package/dist/headless/source/components/dataDisplay/statusDot/statusDot.jsx.map +1 -1
  126. package/dist/headless/source/components/dataDisplay/treeView/treeView.jsx +16 -3
  127. package/dist/headless/source/components/dataDisplay/treeView/treeView.jsx.map +1 -1
  128. package/dist/headless/source/components/inputs/button/button.jsx +26 -1
  129. package/dist/headless/source/components/inputs/button/button.jsx.map +1 -1
  130. package/dist/headless/source/components/inputs/toggle/toggle.jsx +9 -2
  131. package/dist/headless/source/components/inputs/toggle/toggle.jsx.map +1 -1
  132. package/dist/headless/source/components/layout/appLayout/appLayout.jsx +14 -2
  133. package/dist/headless/source/components/layout/appLayout/appLayout.jsx.map +1 -1
  134. package/dist/headless/source/components/layout/screenDivider/screenDivider.jsx +102 -18
  135. package/dist/headless/source/components/layout/screenDivider/screenDivider.jsx.map +1 -1
  136. package/dist/headless/source/components/layout/sheet/sheet.jsx +14 -1
  137. package/dist/headless/source/components/layout/sheet/sheet.jsx.map +1 -1
  138. package/dist/headless/source/components/layout/tabGroups/index.js.map +1 -1
  139. package/dist/headless/source/components/layout/tabGroups/tabGroups.jsx +55 -1
  140. package/dist/headless/source/components/layout/tabGroups/tabGroups.jsx.map +1 -1
  141. package/dist/headless/source/components/layout/tabGroups/tabGroupsFocus.js +42 -0
  142. package/dist/headless/source/components/layout/tabGroups/tabGroupsFocus.js.map +2 -2
  143. package/dist/headless/source/components/navigation/appBar/appBar.jsx.map +1 -1
  144. package/dist/headless/source/components/navigation/breadcrumbs/breadcrumbs.jsx +39 -4
  145. package/dist/headless/source/components/navigation/breadcrumbs/breadcrumbs.jsx.map +1 -1
  146. package/dist/headless/source/components/navigation/tabs/tab/tab.jsx +7 -1
  147. package/dist/headless/source/components/navigation/tabs/tab/tab.jsx.map +1 -1
  148. package/dist/headless/source/components/navigation/tabs/tabs.jsx +5 -1
  149. package/dist/headless/source/components/navigation/tabs/tabs.jsx.map +1 -1
  150. package/dist/headless/source/components/navigation/tabs/tabsContext.js.map +2 -2
  151. package/dist/headless/source/index.js +8 -1
  152. package/dist/headless/source/index.js.map +2 -2
  153. package/dist/headless/source/primitives/publishHeaderOffset.js +34 -0
  154. package/dist/headless/source/primitives/publishHeaderOffset.js.map +7 -0
  155. package/dist/index.d.ts +5 -5
  156. package/dist/primitives/publishHeaderOffset.d.ts +7 -0
  157. package/dist/primitives/publishHeaderOffset.js +19 -0
  158. package/dist/primitives/publishHeaderOffset.js.map +1 -0
  159. package/dist/source/components/dataDisplay/avatar/avatar.jsx +1 -0
  160. package/dist/source/components/dataDisplay/avatar/avatar.jsx.map +1 -1
  161. package/dist/source/components/dataDisplay/chart/chart.jsx +14 -12
  162. package/dist/source/components/dataDisplay/chart/chart.jsx.map +1 -1
  163. package/dist/source/components/dataDisplay/chart/chartFull.js +12 -0
  164. package/dist/source/components/dataDisplay/chart/chartFull.js.map +7 -0
  165. package/dist/source/components/dataDisplay/chart/core.js +11 -0
  166. package/dist/source/components/dataDisplay/chart/core.js.map +7 -0
  167. package/dist/source/components/dataDisplay/chart/index.js +1 -1
  168. package/dist/source/components/dataDisplay/chart/index.js.map +1 -1
  169. package/dist/source/components/dataDisplay/dagView/dagView.jsx +2 -1
  170. package/dist/source/components/dataDisplay/dagView/dagView.jsx.map +1 -1
  171. package/dist/source/components/dataDisplay/dagView/index.js.map +2 -2
  172. package/dist/source/components/dataDisplay/meter/index.js.map +1 -1
  173. package/dist/source/components/dataDisplay/meter/meter.jsx +14 -2
  174. package/dist/source/components/dataDisplay/meter/meter.jsx.map +1 -1
  175. package/dist/source/components/dataDisplay/statusDot/index.js.map +1 -1
  176. package/dist/source/components/dataDisplay/statusDot/statusDot.jsx +13 -1
  177. package/dist/source/components/dataDisplay/statusDot/statusDot.jsx.map +1 -1
  178. package/dist/source/components/dataDisplay/treeView/treeView.jsx +16 -3
  179. package/dist/source/components/dataDisplay/treeView/treeView.jsx.map +1 -1
  180. package/dist/source/components/inputs/button/button.jsx +26 -1
  181. package/dist/source/components/inputs/button/button.jsx.map +1 -1
  182. package/dist/source/components/inputs/toggle/toggle.jsx +9 -2
  183. package/dist/source/components/inputs/toggle/toggle.jsx.map +1 -1
  184. package/dist/source/components/layout/appLayout/appLayout.jsx +14 -2
  185. package/dist/source/components/layout/appLayout/appLayout.jsx.map +1 -1
  186. package/dist/source/components/layout/screenDivider/screenDivider.jsx +102 -18
  187. package/dist/source/components/layout/screenDivider/screenDivider.jsx.map +1 -1
  188. package/dist/source/components/layout/sheet/sheet.jsx +14 -1
  189. package/dist/source/components/layout/sheet/sheet.jsx.map +1 -1
  190. package/dist/source/components/layout/tabGroups/index.js.map +1 -1
  191. package/dist/source/components/layout/tabGroups/tabGroups.jsx +55 -1
  192. package/dist/source/components/layout/tabGroups/tabGroups.jsx.map +1 -1
  193. package/dist/source/components/layout/tabGroups/tabGroupsFocus.js +42 -0
  194. package/dist/source/components/layout/tabGroups/tabGroupsFocus.js.map +2 -2
  195. package/dist/source/components/navigation/appBar/appBar.jsx.map +1 -1
  196. package/dist/source/components/navigation/breadcrumbs/breadcrumbs.jsx +39 -4
  197. package/dist/source/components/navigation/breadcrumbs/breadcrumbs.jsx.map +1 -1
  198. package/dist/source/components/navigation/tabs/tab/tab.jsx +7 -1
  199. package/dist/source/components/navigation/tabs/tab/tab.jsx.map +1 -1
  200. package/dist/source/components/navigation/tabs/tabs.jsx +5 -1
  201. package/dist/source/components/navigation/tabs/tabs.jsx.map +1 -1
  202. package/dist/source/components/navigation/tabs/tabsContext.js.map +2 -2
  203. package/dist/source/index.js +8 -1
  204. package/dist/source/index.js.map +2 -2
  205. package/dist/source/primitives/publishHeaderOffset.js +34 -0
  206. package/dist/source/primitives/publishHeaderOffset.js.map +7 -0
  207. package/package.json +9 -3
@@ -1,15 +1,15 @@
1
- import { createComponent as i, insert as n, effect as A, setAttribute as P, className as z, template as c, Dynamic as H, mergeProps as U, use as R, memo as k, delegateEvents as J } from "solid-js/web";
2
- import { createSignal as Q, mergeProps as V, splitProps as X, children as _, Show as u } from "solid-js";
3
- import T from "clsx";
4
- import { useTabsContext as Y } from "../tabsContext.js";
1
+ import { createComponent as i, insert as n, effect as v, setAttribute as _, className as H, template as c, Dynamic as U, mergeProps as J, use as P, memo as D, delegateEvents as Q } from "solid-js/web";
2
+ import { createSignal as V, mergeProps as X, splitProps as Y, children as C, Show as u } from "solid-js";
3
+ import R from "clsx";
4
+ import { useTabsContext as Z } from "../tabsContext.js";
5
5
  import { mergeRefs as B } from "../../../../primitives/mergeRefs.js";
6
6
  import { callHandler as p } from "../../../../primitives/callHandler.js";
7
- import { Icon as Z } from "../../../base/icon/icon.js";
8
- import { Ripple as ee } from "../../../base/ripple/ripple.js";
9
- var te = /* @__PURE__ */ c("<span class=smwb-tab__icon aria-hidden=true>"), oe = /* @__PURE__ */ c("<span class=smwb-tab__text-label>"), ae = /* @__PURE__ */ c("<span class=smwb-tab__content>"), re = /* @__PURE__ */ c("<span class=smwb-tab__actions>"), le = /* @__PURE__ */ c("<button type=button class=smwb-tab__close tabindex=-1>"), ne = /* @__PURE__ */ c("<div>");
10
- const ie = (r) => r.button !== 0 || r.ctrlKey || r.metaKey || r.shiftKey || r.altKey, se = (r) => r.ctrlKey || r.metaKey || r.altKey || r.shiftKey, ce = 'button:not(:disabled), a[href], [role="button"]:not([aria-disabled="true"]), [tabindex]', de = '[role^="menuitem"]:not([aria-disabled="true"])', be = (r) => {
11
- for (const l of r.getAttribute("aria-controls")?.split(/\s+/) ?? []) {
12
- const f = l ? r.ownerDocument.getElementById(l)?.querySelector(de) : null;
7
+ import { Icon as ee } from "../../../base/icon/icon.js";
8
+ import { Ripple as te } from "../../../base/ripple/ripple.js";
9
+ var oe = /* @__PURE__ */ c("<span class=smwb-tab__icon aria-hidden=true>"), re = /* @__PURE__ */ c("<span class=smwb-tab__text-label>"), ae = /* @__PURE__ */ c("<span class=smwb-tab__content>"), le = /* @__PURE__ */ c("<span class=smwb-tab__actions>"), ne = /* @__PURE__ */ c("<button type=button class=smwb-tab__close tabindex=-1>"), ie = /* @__PURE__ */ c("<div>");
10
+ const se = (a) => a.button !== 0 || a.ctrlKey || a.metaKey || a.shiftKey || a.altKey, ce = (a) => a.ctrlKey || a.metaKey || a.altKey || a.shiftKey, de = 'button:not(:disabled), a[href], [role="button"]:not([aria-disabled="true"]), [tabindex]', be = '[role^="menuitem"]:not([aria-disabled="true"])', ue = (a) => {
11
+ for (const l of a.getAttribute("aria-controls")?.split(/\s+/) ?? []) {
12
+ const f = l ? a.ownerDocument.getElementById(l)?.querySelector(be) : null;
13
13
  if (f) {
14
14
  f.focus({
15
15
  preventScroll: !0
@@ -18,12 +18,12 @@ const ie = (r) => r.button !== 0 || r.ctrlKey || r.metaKey || r.shiftKey || r.al
18
18
  }
19
19
  }
20
20
  };
21
- function ke(r) {
22
- const l = Y(), [f, I] = Q(), E = V({
21
+ function ve(a) {
22
+ const l = Z(), [f, I] = V(), E = X({
23
23
  isActive: !1,
24
24
  stacked: !1,
25
25
  closeLabel: "Close tab"
26
- }, r), [t, q] = X(E, [
26
+ }, a), [t, q] = Y(E, [
27
27
  "class",
28
28
  "label",
29
29
  "isActive",
@@ -53,40 +53,43 @@ function ke(r) {
53
53
  "onMouseDown"
54
54
  ]), s = l ? l.registerTab(f, {
55
55
  id: () => t.id,
56
- disabled: () => !!t.disabled || r["aria-disabled"] === !0 || r["aria-disabled"] === "true",
56
+ disabled: () => !!t.disabled || a["aria-disabled"] === !0 || a["aria-disabled"] === "true",
57
57
  closable: () => !!t.closable,
58
58
  requestClose: (e) => d(e, "key")
59
- }) : () => -1, v = _(() => t.icon), D = _(() => t.label), F = {
59
+ }) : () => -1, S = C(() => t.icon), h = C(() => t.label), F = () => {
60
+ const e = h();
61
+ return l?.fit?.() && a.title === void 0 && typeof e == "string" && e !== "" ? e : void 0;
62
+ }, L = {
60
63
  close: (e) => d(e, "actions")
61
- }, h = _(() => {
64
+ }, y = C(() => {
62
65
  const e = t.actions;
63
- return typeof e == "function" ? e(F) : e;
64
- }), y = () => h.toArray().length > 0;
65
- let C, w;
66
- const m = () => l ? l.value() === s() : t.isActive, g = () => t.tag ?? (t.href !== void 0 ? "a" : "button"), S = () => !!t.disabled && g() !== "button", L = (e) => {
67
- if (S()) {
66
+ return typeof e == "function" ? e(L) : e;
67
+ }), w = () => y.toArray().length > 0;
68
+ let $, k;
69
+ const m = () => l ? l.value() === s() : t.isActive, g = () => t.tag ?? (t.href !== void 0 ? "a" : "button"), x = () => !!t.disabled && g() !== "button", N = (e) => {
70
+ if (x()) {
68
71
  e.preventDefault();
69
72
  return;
70
73
  }
71
- p(t.onClick, e), !(t.href !== void 0 && ie(e)) && l?.onChange(e, s());
74
+ p(t.onClick, e), !(t.href !== void 0 && se(e)) && l?.onChange(e, s());
72
75
  }, d = (e, o) => {
73
76
  l?.closing(s(), o), t.onClose?.(e, o);
74
- }, N = (e) => {
77
+ }, G = (e) => {
75
78
  if (p(t.onKeyDown, e), !(t.disabled || e.defaultPrevented || e.target !== e.currentTarget)) {
76
79
  if (g() !== "button" && e.key === " ")
77
80
  e.preventDefault(), e.currentTarget.click();
78
- else if (t.closable && (e.key === "Delete" || e.key === "Backspace") && !se(e))
81
+ else if (t.closable && (e.key === "Delete" || e.key === "Backspace") && !ce(e))
79
82
  e.preventDefault(), d(e, "key");
80
- else if (y() && (e.key === "ContextMenu" || e.key === "F10" && e.shiftKey)) {
81
- const o = w?.querySelector(ce);
82
- o && (e.preventDefault(), o.focus(), o.getAttribute("aria-expanded") !== "true" && o.click(), be(o));
83
+ else if (w() && (e.key === "ContextMenu" || e.key === "F10" && e.shiftKey)) {
84
+ const o = k?.querySelector(de);
85
+ o && (e.preventDefault(), o.focus(), o.getAttribute("aria-expanded") !== "true" && o.click(), ue(o));
83
86
  }
84
87
  }
85
- }, G = (e) => {
86
- p(t.onPointerDown, e), C?.onRipple(e);
87
88
  }, O = (e) => {
89
+ p(t.onPointerDown, e), $?.onRipple(e);
90
+ }, W = (e) => {
88
91
  p(t.onMouseDown, e), e.button === 1 && t.closable && !t.disabled && (e.preventDefault(), d(e, "middleClick"));
89
- }, W = () => l ? l.tabStop(s()) : t.tabStop ?? m(), j = () => [r["aria-keyshortcuts"], !t.disabled && t.closable ? "Delete Backspace" : void 0, !t.disabled && y() ? "Shift+F10 ContextMenu" : void 0, !t.disabled && t.closable ? "Meta+W Control+W" : void 0, t.disabled ? void 0 : "Meta+Shift+[ Control+Shift+[ Meta+Shift+] Control+Shift+]"].filter(Boolean).join(" ") || void 0, $ = () => t.closable !== void 0 || h() !== void 0, K = () => l?.reorderable() && !t.disabled && r["aria-disabled"] !== !0 && r["aria-disabled"] !== "true" ? !0 : void 0, M = () => i(H, U({
92
+ }, j = () => l ? l.tabStop(s()) : t.tabStop ?? m(), z = () => [a["aria-keyshortcuts"], !t.disabled && t.closable ? "Delete Backspace" : void 0, !t.disabled && w() ? "Shift+F10 ContextMenu" : void 0, !t.disabled && t.closable ? "Meta+W Control+W" : void 0, t.disabled ? void 0 : "Meta+Shift+[ Control+Shift+[ Meta+Shift+] Control+Shift+]"].filter(Boolean).join(" ") || void 0, K = () => t.closable !== void 0 || y() !== void 0, M = () => l?.reorderable() && !t.disabled && a["aria-disabled"] !== !0 && a["aria-disabled"] !== "true" ? !0 : void 0, A = () => i(U, J({
90
93
  get component() {
91
94
  return g();
92
95
  }
@@ -96,7 +99,7 @@ function ke(r) {
96
99
  typeof o == "function" && o(e);
97
100
  },
98
101
  get class() {
99
- return T("smwb-tab", t.class, {
102
+ return R("smwb-tab", t.class, {
100
103
  "smwb-tab--active": m(),
101
104
  "smwb-tab--stacked": t.stacked,
102
105
  "smwb-tab--disabled": t.disabled
@@ -109,15 +112,15 @@ function ke(r) {
109
112
  return t["aria-controls"] ?? (l?.hasPanels() ? l.panelId(s()) : void 0);
110
113
  },
111
114
  get href() {
112
- return k(() => !!S())() ? void 0 : t.href;
115
+ return D(() => !!x())() ? void 0 : t.href;
113
116
  },
114
117
  get draggable() {
115
- return k(() => !!$())() ? void 0 : K();
118
+ return D(() => !!K())() ? void 0 : M();
116
119
  },
117
- onClick: L,
118
- onKeyDown: N,
119
- onPointerDown: G,
120
- onMouseDown: O,
120
+ onClick: N,
121
+ onKeyDown: G,
122
+ onPointerDown: O,
123
+ onMouseDown: W,
121
124
  role: "tab",
122
125
  get "aria-selected"() {
123
126
  return m();
@@ -126,36 +129,36 @@ function ke(r) {
126
129
  return t.disabled || void 0;
127
130
  },
128
131
  get "aria-keyshortcuts"() {
129
- return j();
132
+ return z();
130
133
  },
131
134
  get tabindex() {
132
- return W() ? 0 : -1;
135
+ return j() ? 0 : -1;
133
136
  },
134
137
  get disabled() {
135
- return k(() => g() === "button")() ? t.disabled : void 0;
138
+ return D(() => g() === "button")() ? t.disabled : void 0;
136
139
  },
137
140
  get children() {
138
141
  return [(() => {
139
142
  var e = ae(), o = B(t.contentRef);
140
- return typeof o == "function" && R(o, e), n(e, i(u, {
143
+ return typeof o == "function" && P(o, e), n(e, i(u, {
141
144
  get when() {
142
- return v();
145
+ return S();
143
146
  },
144
147
  get children() {
145
- var a = te();
146
- return n(a, v), a;
148
+ var r = oe();
149
+ return n(r, S), r;
147
150
  }
148
151
  }), null), n(e, i(u, {
149
152
  get when() {
150
- return D();
153
+ return h();
151
154
  },
152
155
  get children() {
153
- var a = oe();
154
- return n(a, D), a;
156
+ var r = re();
157
+ return n(r, h), v(() => _(r, "title", F())), r;
155
158
  }
156
159
  }), null), e;
157
- })(), i(ee, {
158
- actionRef: (e) => C = e,
160
+ })(), i(te, {
161
+ actionRef: (e) => $ = e,
159
162
  classes: {
160
163
  child: "tab__ripple-child"
161
164
  }
@@ -164,44 +167,44 @@ function ke(r) {
164
167
  }));
165
168
  return i(u, {
166
169
  get when() {
167
- return $();
170
+ return K();
168
171
  },
169
172
  get fallback() {
170
- return M();
173
+ return A();
171
174
  },
172
175
  get children() {
173
- var e = ne();
174
- return n(e, M, null), n(e, i(u, {
176
+ var e = ie();
177
+ return n(e, A, null), n(e, i(u, {
175
178
  get when() {
176
- return y();
179
+ return w();
177
180
  },
178
181
  get children() {
179
- var o = re(), a = w;
180
- return typeof a == "function" ? R(a, o) : w = o, n(o, h), o;
182
+ var o = le(), r = k;
183
+ return typeof r == "function" ? P(r, o) : k = o, n(o, y), o;
181
184
  }
182
185
  }), null), n(e, i(u, {
183
186
  get when() {
184
187
  return t.closable;
185
188
  },
186
189
  get children() {
187
- var o = le();
188
- return o.$$click = (a) => d(a, "button"), o.$$mousedown = (a) => a.preventDefault(), n(o, i(Z, {
190
+ var o = ne();
191
+ return o.$$click = (r) => d(r, "button"), o.$$mousedown = (r) => r.preventDefault(), n(o, i(ee, {
189
192
  name: "close",
190
193
  size: 16
191
- })), A((a) => {
192
- var b = t.closeLabel, x = !!t.disabled;
193
- return b !== a.e && P(o, "aria-label", a.e = b), x !== a.t && (o.disabled = a.t = x), a;
194
+ })), v((r) => {
195
+ var b = t.closeLabel, T = !!t.disabled;
196
+ return b !== r.e && _(o, "aria-label", r.e = b), T !== r.t && (o.disabled = r.t = T), r;
194
197
  }, {
195
198
  e: void 0,
196
199
  t: void 0
197
200
  }), o;
198
201
  }
199
- }), null), A((o) => {
200
- var a = T("smwb-tab-item", {
202
+ }), null), v((o) => {
203
+ var r = R("smwb-tab-item", {
201
204
  "smwb-tab-item--active": m(),
202
205
  "smwb-tab-item--disabled": t.disabled
203
- }), b = K();
204
- return a !== o.e && z(e, o.e = a), b !== o.t && P(e, "draggable", o.t = b), o;
206
+ }), b = M();
207
+ return r !== o.e && H(e, o.e = r), b !== o.t && _(e, "draggable", o.t = b), o;
205
208
  }, {
206
209
  e: void 0,
207
210
  t: void 0
@@ -209,8 +212,8 @@ function ke(r) {
209
212
  }
210
213
  });
211
214
  }
212
- J(["mousedown", "click"]);
215
+ Q(["mousedown", "click"]);
213
216
  export {
214
- ke as Tab
217
+ ve as Tab
215
218
  };
216
219
  //# sourceMappingURL=tab.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tab.js","sources":["../../../../../../src/components/navigation/tabs/tab/tab.tsx"],"sourcesContent":["import { type JSX, type ParentProps, Show, children, createSignal, mergeProps, splitProps } from \"solid-js\";\nimport { Dynamic } from \"solid-js/web\";\nimport cn from \"clsx\";\nimport { Ripple, type RippleActionsRef } from \"../../../base/ripple\";\nimport { Icon } from \"../../../base/icon\";\nimport { useTabsContext, type TabCloseReason } from \"../tabsContext\";\nimport { mergeRefs, type Ref } from \"../../../../primitives/mergeRefs\";\nimport { callHandler } from \"../../../../primitives/callHandler\";\n\nexport type { TabCloseReason };\n\n/** What a function given as `actions` receives. */\nexport interface TabActionsApi {\n /**\n * Ask for the tab to close, as its close button does: `onClose` is called with this event and the\n * reason \"actions\", and `Tabs` moves focus on to the neighbour once the tab goes, even though focus\n * is in a menu drawn outside the row. Call it from the item that closes the tab (\"Terminate\"), with\n * that item's event. It works on a tab that is not `closable`.\n */\n close: (event: Event) => void;\n}\n\n// `onClose` is the close button's, not the element's `close` event handler.\nexport interface TabProps extends Omit<JSX.HTMLAttributes<HTMLButtonElement | HTMLAnchorElement>, \"onClose\"> {\n label?: JSX.Element;\n isActive?: boolean;\n /**\n * Whether the tab is the one in the page's Tab order (`tabindex` 0, the others -1). `Tabs` sets\n * it: the focused tab while focus is in the row, the selected one otherwise. On its own a tab\n * is the stop while `isActive`.\n */\n tabStop?: boolean;\n contentRef?: Ref<HTMLSpanElement>;\n /**\n * A decorative status marker drawn left of the label (a running/done/failed icon). Its\n * wrapper renders `aria-hidden=\"true\"`, so the tab's accessible name stays the label\n * alone: the icon is not announced on top of it. To have the status read out, put it\n * in the `label` itself.\n */\n icon?: JSX.Element;\n stacked?: boolean;\n /** The element to render. A tab with an `href` is an `a` unless you say otherwise. */\n tag?: string;\n /**\n * Navigation mode: where the tab goes. The tab is then a real link (`<a href role=\"tab\">`, with\n * no `target`: a tab never opens another window), so it opens in place and middle click, copy\n * link and the like work. A router takes over the plain click in `onClick` with\n * `event.preventDefault()`; `Tabs` still calls `onChange` for it. A modified or non-primary click\n * (Ctrl, Meta, Shift or Alt held, or a button other than the main one) is the browser's, as\n * \"open in a new tab\": the router must let it through, and `Tabs` does not call `onChange`.\n * The one exception is a middle press on a `closable` tab: it closes the tab instead, as in an\n * editor, and its default is prevented so nothing opens.\n */\n href?: string;\n disabled?: boolean;\n /**\n * Draw a close button after the tab, and let Delete or Backspace on the focused tab close it too\n * (Backspace because a Mac has no Delete key); the tab lists them in `aria-keyshortcuts`. A\n * middle click on the tab closes it as well (`reason` \"middleClick\"): the browser's own\n * middle-click action (autoscroll, opening a link tab in a new window) is suppressed, and the\n * click never selects. The tab does not close itself: `onClose` asks for it and the owner\n * removes the `Tab`. The button is a sibling of the tab, not inside its `role=\"tab\"`, so the\n * tab's accessible name is its label alone.\n * It is out of the Tab order (`tabindex` -1), so the row keeps one tab stop, and a press on it takes\n * no focus and never selects the tab. When the tab that has focus closes, `Tabs` moves focus to the\n * tab that takes its place (the previous one if it was last), skipping disabled tabs. A disabled tab\n * has a disabled button.\n *\n * The button stays in the accessibility tree, named by `closeLabel`: it is how a screen reader user\n * who cannot press Delete, as on a touch screen, closes the tab. It sits in the tab list beside its\n * tab, though, and ARIA 1.2 lets a `tablist` own only `tab`s: a linter that applies that strictly\n * (axe `aria-required-children`) can flag the button, and whatever `actions` holds.\n *\n * To switch it off on a tab, pass `false` rather than leaving it out: a tab given `closable` or\n * `actions` is wrapped in an item with them, a tab given neither is not, and moving between the two\n * recreates the tab and drops its focus.\n */\n closable?: boolean;\n /**\n * Asks for the tab to close, and receives what asked for it: the close button's click (`reason`\n * \"button\"), the key press of Delete or Backspace on the tab (`reason` \"key\", its default is\n * prevented), the middle press on the tab (`reason` \"middleClick\", its default is prevented too),\n * or the event passed to `close` by the tab's `actions` (`reason` \"actions\"). The owner removes\n * the `Tab`.\n */\n onClose?: (event: Event, reason: TabCloseReason) => void;\n /** Accessible label of the close button. English by default; set it to localise, or to name the tab (\"Close Terminal 1\"). */\n closeLabel?: string;\n /**\n * Content after the tab, before the close button: a trigger with a `Menu` (\"Rename\", \"Terminate\"),\n * or any control. Give a function to get `{ close }` (see `TabActionsApi`); it is called once.\n * Like the close button the content is a sibling of the tab, so it is not part of the tab's name;\n * the tab's own `ref`, `class` and handlers stay on the `role=\"tab\"` element. It stays in the\n * accessibility tree as written, inside the tab list (see `closable`).\n *\n * The row has one tab stop, so give the trigger `tabindex={-1}`. Shift+F10 or the Menu key on the\n * focused tab, which the tab lists in `aria-keyshortcuts`, focuses the first control in `actions`\n * and clicks it, unless that control says `aria-expanded=\"true\"` (it is already open). If the\n * control names its popup in `aria-controls`, the first enabled `menuitem` in that element then\n * takes focus, as the WAI-ARIA menu button pattern asks: ArrowDown moves on, Enter chooses, and\n * Escape hands focus back to the trigger. Without `aria-controls` focus stays on the trigger.\n *\n * The row clips what overflows it: draw the menu in a `Portal`, anchored to the trigger and with\n * the `id` the trigger names. A choice that removes the tab (\"Terminate\") should call `close` with\n * its event, so that `onClose` removes the tab and `Tabs` moves focus on to the neighbour; a tab\n * removed some other way leaves focus on the page.\n */\n actions?: JSX.Element | ((api: TabActionsApi) => JSX.Element);\n ref?: Ref<HTMLButtonElement | HTMLAnchorElement>;\n}\n\n/** A click that asks the browser for something else than \"go here\": a new tab, a new window, a download. */\nconst isModifiedClick = (event: MouseEvent): boolean =>\n event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey;\n\nconst hasModifier = (event: KeyboardEvent): boolean => event.ctrlKey || event.metaKey || event.altKey || event.shiftKey;\n\n/** What the Menu key and Shift+F10 stand for: the actions' trigger. */\nconst ACTIONS_TRIGGER = 'button:not(:disabled), a[href], [role=\"button\"]:not([aria-disabled=\"true\"]), [tabindex]';\n\n/** The item of an opened menu that takes focus first. */\nconst FIRST_MENU_ITEM = '[role^=\"menuitem\"]:not([aria-disabled=\"true\"])';\n\n/** Focus the first item of the popup `trigger` names in `aria-controls`, if it is there. */\nconst focusPopupOf = (trigger: HTMLElement): void => {\n for (const id of trigger.getAttribute(\"aria-controls\")?.split(/\\s+/) ?? []) {\n const item = id ? trigger.ownerDocument.getElementById(id)?.querySelector<HTMLElement>(FIRST_MENU_ITEM) : null;\n if (item) {\n // The menu may not be placed yet: a scroll to it would jump to the corner it starts in.\n item.focus({ preventScroll: true });\n return;\n }\n }\n};\n\nexport function Tab(props: ParentProps<TabProps>): JSX.Element {\n const ctx = useTabsContext();\n const [root, setRoot] = createSignal<HTMLButtonElement | HTMLAnchorElement>();\n const merged = mergeProps({ isActive: false, stacked: false, closeLabel: \"Close tab\" }, props);\n const [local, rest] = splitProps(merged, [\n \"class\",\n \"label\",\n \"isActive\",\n \"contentRef\",\n \"icon\",\n \"stacked\",\n \"tag\",\n \"href\",\n \"tabStop\",\n \"disabled\",\n // `Tabs` owns this: it is the item that drags, not the tab. The caller's value\n // is dropped, as in the React `Tab`.\n \"draggable\",\n \"closable\",\n \"onClose\",\n \"closeLabel\",\n \"actions\",\n \"id\",\n \"aria-controls\",\n // A tab opens in place: a caller's target is dropped, not passed on.\n \"target\" as keyof TabProps,\n \"onClick\",\n \"onKeyDown\",\n \"ref\",\n // The tab sets this on its root too; its own handler calls the caller's first.\n \"onPointerDown\",\n \"onMouseDown\",\n ]);\n\n // The tab's position in the tab list: it follows the tab when tabs around it\n // are added, removed or reordered.\n const index = ctx\n ? ctx.registerTab(root, {\n id: () => local.id,\n disabled: () =>\n Boolean(local.disabled) || props[\"aria-disabled\"] === true || props[\"aria-disabled\"] === \"true\",\n closable: () => Boolean(local.closable),\n requestClose: (event) => close(event, \"key\"),\n })\n : () => -1;\n\n // Read the icon and the label once: markup passed as a prop is created anew on\n // every read, and during hydration the copy made for the <Show> test has no\n // server DOM node to adopt (\"Unable to find DOM nodes for hydration key\").\n const icon = children(() => local.icon);\n const label = children(() => local.label);\n // The actions are drawn whenever they are given, so reading them here, once, is safe. A function\n // is the tab's to call, with its api: `children` would call it with nothing.\n const actionsApi: TabActionsApi = { close: (event) => close(event, \"actions\") };\n const actions = children(() => {\n const given = local.actions;\n return typeof given === \"function\" ? (given as (api: TabActionsApi) => JSX.Element)(actionsApi) : given;\n });\n const hasActions = (): boolean => actions.toArray().length > 0;\n\n let rippleActions: RippleActionsRef | undefined;\n let actionsEl: HTMLSpanElement | undefined;\n\n const active = (): boolean => (ctx ? ctx.value() === index() : local.isActive);\n\n const tag = (): string => local.tag ?? (local.href !== undefined ? \"a\" : \"button\");\n // Anything but a button is not disabled by the attribute: its clicks are swallowed here.\n const inert = (): boolean => Boolean(local.disabled) && tag() !== \"button\";\n\n const onClick: JSX.EventHandler<HTMLButtonElement | HTMLAnchorElement, MouseEvent> = (event) => {\n if (inert()) {\n event.preventDefault();\n return;\n }\n // Inside Tabs too the caller's onClick runs first, then the tab list picks the tab.\n callHandler(local.onClick, event);\n // A link tab opens elsewhere on a modified click: the browser's, not a selection here.\n if (local.href !== undefined && isModifiedClick(event)) return;\n ctx?.onChange(event, index());\n };\n\n const close = (event: Event, reason: TabCloseReason): void => {\n // The row notes which tab is closing before the owner removes it.\n ctx?.closing(index(), reason);\n local.onClose?.(event, reason);\n };\n\n // A button clicks on Enter and Space by itself, a link on Enter only: Space does it here.\n const onKeyDown: JSX.EventHandler<HTMLButtonElement | HTMLAnchorElement, KeyboardEvent> = (event) => {\n callHandler(local.onKeyDown, event);\n if (local.disabled || event.defaultPrevented || event.target !== event.currentTarget) return;\n if (tag() !== \"button\" && event.key === \" \") {\n event.preventDefault();\n event.currentTarget.click();\n } else if (local.closable && (event.key === \"Delete\" || event.key === \"Backspace\") && !hasModifier(event)) {\n event.preventDefault();\n close(event, \"key\");\n } else if (hasActions() && (event.key === \"ContextMenu\" || (event.key === \"F10\" && event.shiftKey))) {\n // The Menu key, or Shift+F10: the keyboard's right click. The trigger takes focus first, so\n // the menu it opens hands focus back to it on Escape.\n const trigger = actionsEl?.querySelector<HTMLElement>(ACTIONS_TRIGGER);\n if (trigger) {\n event.preventDefault();\n trigger.focus();\n // The keys mean \"open\": a menu that already is open is not toggled shut.\n if (trigger.getAttribute(\"aria-expanded\") !== \"true\") {\n trigger.click();\n }\n focusPopupOf(trigger);\n }\n }\n };\n\n const onPointerDown: JSX.EventHandler<HTMLButtonElement | HTMLAnchorElement, PointerEvent> = (event) => {\n callHandler(local.onPointerDown, event);\n rippleActions?.onRipple(event);\n };\n\n // Middle click on a closable tab closes it, IDE-style: the browser's own middle-click\n // action (autoscroll, opening a link tab in a new window) is suppressed and the tab is\n // never selected. A middle click on a tab that is not closable is the browser's, untouched.\n const onMouseDown: JSX.EventHandler<HTMLButtonElement | HTMLAnchorElement, MouseEvent> = (event) => {\n callHandler(local.onMouseDown, event);\n if (event.button === 1 && local.closable && !local.disabled) {\n event.preventDefault();\n close(event, \"middleClick\");\n }\n };\n\n // Inside Tabs the row decides, whatever the caller passed.\n const tabStop = (): boolean => (ctx ? ctx.tabStop(index()) : (local.tabStop ?? active()));\n\n // What the tab answers to, for assistive technology; the caller's own list is kept.\n // The chords are best-effort: browsers reserve Mod+W and Mod+Shift+[/] in a page of\n // their own tabs, and they bite only in an embedded webview.\n const keyshortcuts = (): string | undefined =>\n [\n props[\"aria-keyshortcuts\"],\n !local.disabled && local.closable ? \"Delete Backspace\" : undefined,\n !local.disabled && hasActions() ? \"Shift+F10 ContextMenu\" : undefined,\n !local.disabled && local.closable ? \"Meta+W Control+W\" : undefined,\n !local.disabled ? \"Meta+Shift+[ Control+Shift+[ Meta+Shift+] Control+Shift+]\" : undefined,\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n // A tab given neither `closable` nor `actions` is the bare element, as it always was.\n const wrapped = (): boolean => local.closable !== undefined || actions() !== undefined;\n\n // Only a reorderable row makes its items draggable, and a disabled tab never — the same\n // contract as the registration's `disabled`. Rendered on the item (the wrapper, or the\n // bare tab when there is none), so `draggable` is in the server markup, as in React.\n const draggable = (): boolean | undefined =>\n ctx?.reorderable() && !local.disabled && props[\"aria-disabled\"] !== true && props[\"aria-disabled\"] !== \"true\"\n ? true\n : undefined;\n\n const renderTab = (): JSX.Element => (\n <Dynamic\n component={tag()}\n {...rest}\n ref={mergeRefs(local.ref, setRoot)}\n class={cn(\"smwb-tab\", local.class, {\n \"smwb-tab--active\": active(),\n \"smwb-tab--stacked\": local.stacked,\n \"smwb-tab--disabled\": local.disabled,\n })}\n id={local.id ?? ctx?.tabId(index())}\n aria-controls={local[\"aria-controls\"] ?? (ctx?.hasPanels() ? ctx.panelId(index()) : undefined)}\n // A disabled link has no href, so it is no link to follow or to focus.\n href={inert() ? undefined : local.href}\n draggable={wrapped() ? undefined : draggable()}\n onClick={onClick}\n onKeyDown={onKeyDown}\n onPointerDown={onPointerDown}\n onMouseDown={onMouseDown}\n // The role, the selection and the roving tabindex belong to the tab list:\n // they win over the caller's. A tab that is not disabled keeps the\n // caller's aria-disabled.\n role=\"tab\"\n aria-selected={active()}\n aria-disabled={local.disabled || undefined}\n aria-keyshortcuts={keyshortcuts()}\n tabindex={tabStop() ? 0 : -1}\n disabled={tag() === \"button\" ? local.disabled : undefined}\n >\n <span class=\"smwb-tab__content\" ref={mergeRefs(local.contentRef)}>\n <Show when={icon()}>\n <span class=\"smwb-tab__icon\" aria-hidden=\"true\">\n {icon()}\n </span>\n </Show>\n <Show when={label()}>\n <span class=\"smwb-tab__text-label\">{label()}</span>\n </Show>\n </span>\n <Ripple actionRef={(api) => (rippleActions = api)} classes={{ child: \"tab__ripple-child\" }} />\n </Dynamic>\n );\n\n return (\n <Show when={wrapped()} fallback={renderTab()}>\n <div\n class={cn(\"smwb-tab-item\", {\n \"smwb-tab-item--active\": active(),\n \"smwb-tab-item--disabled\": local.disabled,\n })}\n draggable={draggable()}\n >\n {renderTab()}\n <Show when={hasActions()}>\n <span class=\"smwb-tab__actions\" ref={actionsEl}>\n {actions()}\n </span>\n </Show>\n <Show when={local.closable}>\n <button\n type=\"button\"\n class=\"smwb-tab__close\"\n // Out of the Tab order, so the row keeps its one tab stop; Delete on the tab closes it.\n tabindex={-1}\n aria-label={local.closeLabel}\n disabled={Boolean(local.disabled)}\n // A press does not take focus from where it is: from the tab being closed, or the page.\n onMouseDown={(event) => event.preventDefault()}\n onClick={(event) => close(event, \"button\")}\n >\n <Icon name=\"close\" size={16} />\n </button>\n </Show>\n </div>\n </Show>\n );\n}\n\nexport default Tab;\n"],"names":["isModifiedClick","event","button","ctrlKey","metaKey","shiftKey","altKey","hasModifier","ACTIONS_TRIGGER","FIRST_MENU_ITEM","focusPopupOf","trigger","id","getAttribute","split","item","ownerDocument","getElementById","querySelector","focus","preventScroll","Tab","props","ctx","useTabsContext","root","setRoot","createSignal","merged","mergeProps","isActive","stacked","closeLabel","local","rest","splitProps","index","registerTab","disabled","Boolean","closable","requestClose","close","icon","children","label","actionsApi","actions","given","hasActions","toArray","length","rippleActions","actionsEl","active","value","tag","href","undefined","inert","onClick","preventDefault","callHandler","onChange","reason","closing","onClose","onKeyDown","defaultPrevented","target","currentTarget","key","click","onPointerDown","onRipple","onMouseDown","tabStop","keyshortcuts","filter","join","wrapped","draggable","reorderable","renderTab","_$createComponent","Dynamic","_$mergeProps","component","ref","r$","_ref$","mergeRefs","cn","class","tabId","hasPanels","panelId","_$memo","role","tabindex","_el$","_tmpl$3","_ref$2","contentRef","_$use","_$insert","Show","when","_el$2","_tmpl$","_el$3","_tmpl$2","Ripple","actionRef","api","classes","child","fallback","_el$4","_tmpl$6","_el$5","_tmpl$4","_ref$3","_el$6","_tmpl$5","$$click","$$mousedown","Icon","name","size","_$effect","_p$","_v$","_v$2","e","_$setAttribute","t","_v$3","_v$4","_$className","_$delegateEvents"],"mappings":";;;;;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AAAAA,UAAAA,CAAA,GAAAiE;AAAAA,QAAA;AAAA,MAAA,CAAA,GAAA,IAAA,GAAAO,EAAAC,CAAAA,MAAA;AAAA,YAAAM,IAnB9B7C,EAAG,iBAAiB;AAAA,UACzB,yBAAyBtC,EAAAA;AAAAA,UACzB,2BAA2BrB,EAAMK;AAAAA,QAAAA,CAClC,GAACoG,IACSzD,EAAAA;AAAWwD,eAAAA,MAAAN,EAAAG,KAAAK,EAAArB,GAAAa,EAAAG,IAAAG,CAAA,GAAAC,MAAAP,EAAAK,KAAAD,EAAAjB,GAAA,aAAAa,EAAAK,IAAAE,CAAA,GAAAP;AAAAA,MAAA,GAAA;AAAA,QAAAG,GAAA5E;AAAAA,QAAA8E,GAAA9E;AAAAA,MAAAA,CAAA,GAAA4D;AAAAA,IAAA;AAAA,EAAA,CAAA;AA0B9B;AAEmBsB,EAAA,CAAA,aAAA,OAAA,CAAA;"}
1
+ {"version":3,"file":"tab.js","sources":["../../../../../../src/components/navigation/tabs/tab/tab.tsx"],"sourcesContent":["import { type JSX, type ParentProps, Show, children, createSignal, mergeProps, splitProps } from \"solid-js\";\nimport { Dynamic } from \"solid-js/web\";\nimport cn from \"clsx\";\nimport { Ripple, type RippleActionsRef } from \"../../../base/ripple\";\nimport { Icon } from \"../../../base/icon\";\nimport { useTabsContext, type TabCloseReason } from \"../tabsContext\";\nimport { mergeRefs, type Ref } from \"../../../../primitives/mergeRefs\";\nimport { callHandler } from \"../../../../primitives/callHandler\";\n\nexport type { TabCloseReason };\n\n/** What a function given as `actions` receives. */\nexport interface TabActionsApi {\n /**\n * Ask for the tab to close, as its close button does: `onClose` is called with this event and the\n * reason \"actions\", and `Tabs` moves focus on to the neighbour once the tab goes, even though focus\n * is in a menu drawn outside the row. Call it from the item that closes the tab (\"Terminate\"), with\n * that item's event. It works on a tab that is not `closable`.\n */\n close: (event: Event) => void;\n}\n\n// `onClose` is the close button's, not the element's `close` event handler.\nexport interface TabProps extends Omit<JSX.HTMLAttributes<HTMLButtonElement | HTMLAnchorElement>, \"onClose\"> {\n label?: JSX.Element;\n isActive?: boolean;\n /**\n * Whether the tab is the one in the page's Tab order (`tabindex` 0, the others -1). `Tabs` sets\n * it: the focused tab while focus is in the row, the selected one otherwise. On its own a tab\n * is the stop while `isActive`.\n */\n tabStop?: boolean;\n contentRef?: Ref<HTMLSpanElement>;\n /**\n * A decorative status marker drawn left of the label (a running/done/failed icon). Its\n * wrapper renders `aria-hidden=\"true\"`, so the tab's accessible name stays the label\n * alone: the icon is not announced on top of it. To have the status read out, put it\n * in the `label` itself.\n */\n icon?: JSX.Element;\n stacked?: boolean;\n /** The element to render. A tab with an `href` is an `a` unless you say otherwise. */\n tag?: string;\n /**\n * Navigation mode: where the tab goes. The tab is then a real link (`<a href role=\"tab\">`, with\n * no `target`: a tab never opens another window), so it opens in place and middle click, copy\n * link and the like work. A router takes over the plain click in `onClick` with\n * `event.preventDefault()`; `Tabs` still calls `onChange` for it. A modified or non-primary click\n * (Ctrl, Meta, Shift or Alt held, or a button other than the main one) is the browser's, as\n * \"open in a new tab\": the router must let it through, and `Tabs` does not call `onChange`.\n * The one exception is a middle press on a `closable` tab: it closes the tab instead, as in an\n * editor, and its default is prevented so nothing opens.\n */\n href?: string;\n disabled?: boolean;\n /**\n * Draw a close button after the tab, and let Delete or Backspace on the focused tab close it too\n * (Backspace because a Mac has no Delete key); the tab lists them in `aria-keyshortcuts`. A\n * middle click on the tab closes it as well (`reason` \"middleClick\"): the browser's own\n * middle-click action (autoscroll, opening a link tab in a new window) is suppressed, and the\n * click never selects. The tab does not close itself: `onClose` asks for it and the owner\n * removes the `Tab`. The button is a sibling of the tab, not inside its `role=\"tab\"`, so the\n * tab's accessible name is its label alone.\n * It is out of the Tab order (`tabindex` -1), so the row keeps one tab stop, and a press on it takes\n * no focus and never selects the tab. When the tab that has focus closes, `Tabs` moves focus to the\n * tab that takes its place (the previous one if it was last), skipping disabled tabs. A disabled tab\n * has a disabled button.\n *\n * The button stays in the accessibility tree, named by `closeLabel`: it is how a screen reader user\n * who cannot press Delete, as on a touch screen, closes the tab. It sits in the tab list beside its\n * tab, though, and ARIA 1.2 lets a `tablist` own only `tab`s: a linter that applies that strictly\n * (axe `aria-required-children`) can flag the button, and whatever `actions` holds.\n *\n * To switch it off on a tab, pass `false` rather than leaving it out: a tab given `closable` or\n * `actions` is wrapped in an item with them, a tab given neither is not, and moving between the two\n * recreates the tab and drops its focus.\n */\n closable?: boolean;\n /**\n * Asks for the tab to close, and receives what asked for it: the close button's click (`reason`\n * \"button\"), the key press of Delete or Backspace on the tab (`reason` \"key\", its default is\n * prevented), the middle press on the tab (`reason` \"middleClick\", its default is prevented too),\n * or the event passed to `close` by the tab's `actions` (`reason` \"actions\"). The owner removes\n * the `Tab`.\n */\n onClose?: (event: Event, reason: TabCloseReason) => void;\n /** Accessible label of the close button. English by default; set it to localise, or to name the tab (\"Close Terminal 1\"). */\n closeLabel?: string;\n /**\n * Content after the tab, before the close button: a trigger with a `Menu` (\"Rename\", \"Terminate\"),\n * or any control. Give a function to get `{ close }` (see `TabActionsApi`); it is called once.\n * Like the close button the content is a sibling of the tab, so it is not part of the tab's name;\n * the tab's own `ref`, `class` and handlers stay on the `role=\"tab\"` element. It stays in the\n * accessibility tree as written, inside the tab list (see `closable`).\n *\n * The row has one tab stop, so give the trigger `tabindex={-1}`. Shift+F10 or the Menu key on the\n * focused tab, which the tab lists in `aria-keyshortcuts`, focuses the first control in `actions`\n * and clicks it, unless that control says `aria-expanded=\"true\"` (it is already open). If the\n * control names its popup in `aria-controls`, the first enabled `menuitem` in that element then\n * takes focus, as the WAI-ARIA menu button pattern asks: ArrowDown moves on, Enter chooses, and\n * Escape hands focus back to the trigger. Without `aria-controls` focus stays on the trigger.\n *\n * The row clips what overflows it: draw the menu in a `Portal`, anchored to the trigger and with\n * the `id` the trigger names. A choice that removes the tab (\"Terminate\") should call `close` with\n * its event, so that `onClose` removes the tab and `Tabs` moves focus on to the neighbour; a tab\n * removed some other way leaves focus on the page.\n */\n actions?: JSX.Element | ((api: TabActionsApi) => JSX.Element);\n ref?: Ref<HTMLButtonElement | HTMLAnchorElement>;\n}\n\n/** A click that asks the browser for something else than \"go here\": a new tab, a new window, a download. */\nconst isModifiedClick = (event: MouseEvent): boolean =>\n event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey;\n\nconst hasModifier = (event: KeyboardEvent): boolean => event.ctrlKey || event.metaKey || event.altKey || event.shiftKey;\n\n/** What the Menu key and Shift+F10 stand for: the actions' trigger. */\nconst ACTIONS_TRIGGER = 'button:not(:disabled), a[href], [role=\"button\"]:not([aria-disabled=\"true\"]), [tabindex]';\n\n/** The item of an opened menu that takes focus first. */\nconst FIRST_MENU_ITEM = '[role^=\"menuitem\"]:not([aria-disabled=\"true\"])';\n\n/** Focus the first item of the popup `trigger` names in `aria-controls`, if it is there. */\nconst focusPopupOf = (trigger: HTMLElement): void => {\n for (const id of trigger.getAttribute(\"aria-controls\")?.split(/\\s+/) ?? []) {\n const item = id ? trigger.ownerDocument.getElementById(id)?.querySelector<HTMLElement>(FIRST_MENU_ITEM) : null;\n if (item) {\n // The menu may not be placed yet: a scroll to it would jump to the corner it starts in.\n item.focus({ preventScroll: true });\n return;\n }\n }\n};\n\nexport function Tab(props: ParentProps<TabProps>): JSX.Element {\n const ctx = useTabsContext();\n const [root, setRoot] = createSignal<HTMLButtonElement | HTMLAnchorElement>();\n const merged = mergeProps({ isActive: false, stacked: false, closeLabel: \"Close tab\" }, props);\n const [local, rest] = splitProps(merged, [\n \"class\",\n \"label\",\n \"isActive\",\n \"contentRef\",\n \"icon\",\n \"stacked\",\n \"tag\",\n \"href\",\n \"tabStop\",\n \"disabled\",\n // `Tabs` owns this: it is the item that drags, not the tab. The caller's value\n // is dropped, as in the React `Tab`.\n \"draggable\",\n \"closable\",\n \"onClose\",\n \"closeLabel\",\n \"actions\",\n \"id\",\n \"aria-controls\",\n // A tab opens in place: a caller's target is dropped, not passed on.\n \"target\" as keyof TabProps,\n \"onClick\",\n \"onKeyDown\",\n \"ref\",\n // The tab sets this on its root too; its own handler calls the caller's first.\n \"onPointerDown\",\n \"onMouseDown\",\n ]);\n\n // The tab's position in the tab list: it follows the tab when tabs around it\n // are added, removed or reordered.\n const index = ctx\n ? ctx.registerTab(root, {\n id: () => local.id,\n disabled: () =>\n Boolean(local.disabled) || props[\"aria-disabled\"] === true || props[\"aria-disabled\"] === \"true\",\n closable: () => Boolean(local.closable),\n requestClose: (event) => close(event, \"key\"),\n })\n : () => -1;\n\n // Read the icon and the label once: markup passed as a prop is created anew on\n // every read, and during hydration the copy made for the <Show> test has no\n // server DOM node to adopt (\"Unable to find DOM nodes for hydration key\").\n const icon = children(() => local.icon);\n const label = children(() => local.label);\n // A content-width row cuts a long label with an ellipsis, so a string label is its own title there\n // and the full text shows on hover. It sits on the label, not on the tab: a title on the tab is\n // read as its description, next to a name that says the same. A title the caller gave the tab is\n // the tooltip instead, and the label does not shadow it; a label that is not a string has no text\n // to give.\n const fitTitle = (): string | undefined => {\n const text = label();\n return ctx?.fit?.() && props.title === undefined && typeof text === \"string\" && text !== \"\" ? text : undefined;\n };\n // The actions are drawn whenever they are given, so reading them here, once, is safe. A function\n // is the tab's to call, with its api: `children` would call it with nothing.\n const actionsApi: TabActionsApi = { close: (event) => close(event, \"actions\") };\n const actions = children(() => {\n const given = local.actions;\n return typeof given === \"function\" ? (given as (api: TabActionsApi) => JSX.Element)(actionsApi) : given;\n });\n const hasActions = (): boolean => actions.toArray().length > 0;\n\n let rippleActions: RippleActionsRef | undefined;\n let actionsEl: HTMLSpanElement | undefined;\n\n const active = (): boolean => (ctx ? ctx.value() === index() : local.isActive);\n\n const tag = (): string => local.tag ?? (local.href !== undefined ? \"a\" : \"button\");\n // Anything but a button is not disabled by the attribute: its clicks are swallowed here.\n const inert = (): boolean => Boolean(local.disabled) && tag() !== \"button\";\n\n const onClick: JSX.EventHandler<HTMLButtonElement | HTMLAnchorElement, MouseEvent> = (event) => {\n if (inert()) {\n event.preventDefault();\n return;\n }\n // Inside Tabs too the caller's onClick runs first, then the tab list picks the tab.\n callHandler(local.onClick, event);\n // A link tab opens elsewhere on a modified click: the browser's, not a selection here.\n if (local.href !== undefined && isModifiedClick(event)) return;\n ctx?.onChange(event, index());\n };\n\n const close = (event: Event, reason: TabCloseReason): void => {\n // The row notes which tab is closing before the owner removes it.\n ctx?.closing(index(), reason);\n local.onClose?.(event, reason);\n };\n\n // A button clicks on Enter and Space by itself, a link on Enter only: Space does it here.\n const onKeyDown: JSX.EventHandler<HTMLButtonElement | HTMLAnchorElement, KeyboardEvent> = (event) => {\n callHandler(local.onKeyDown, event);\n if (local.disabled || event.defaultPrevented || event.target !== event.currentTarget) return;\n if (tag() !== \"button\" && event.key === \" \") {\n event.preventDefault();\n event.currentTarget.click();\n } else if (local.closable && (event.key === \"Delete\" || event.key === \"Backspace\") && !hasModifier(event)) {\n event.preventDefault();\n close(event, \"key\");\n } else if (hasActions() && (event.key === \"ContextMenu\" || (event.key === \"F10\" && event.shiftKey))) {\n // The Menu key, or Shift+F10: the keyboard's right click. The trigger takes focus first, so\n // the menu it opens hands focus back to it on Escape.\n const trigger = actionsEl?.querySelector<HTMLElement>(ACTIONS_TRIGGER);\n if (trigger) {\n event.preventDefault();\n trigger.focus();\n // The keys mean \"open\": a menu that already is open is not toggled shut.\n if (trigger.getAttribute(\"aria-expanded\") !== \"true\") {\n trigger.click();\n }\n focusPopupOf(trigger);\n }\n }\n };\n\n const onPointerDown: JSX.EventHandler<HTMLButtonElement | HTMLAnchorElement, PointerEvent> = (event) => {\n callHandler(local.onPointerDown, event);\n rippleActions?.onRipple(event);\n };\n\n // Middle click on a closable tab closes it, IDE-style: the browser's own middle-click\n // action (autoscroll, opening a link tab in a new window) is suppressed and the tab is\n // never selected. A middle click on a tab that is not closable is the browser's, untouched.\n const onMouseDown: JSX.EventHandler<HTMLButtonElement | HTMLAnchorElement, MouseEvent> = (event) => {\n callHandler(local.onMouseDown, event);\n if (event.button === 1 && local.closable && !local.disabled) {\n event.preventDefault();\n close(event, \"middleClick\");\n }\n };\n\n // Inside Tabs the row decides, whatever the caller passed.\n const tabStop = (): boolean => (ctx ? ctx.tabStop(index()) : (local.tabStop ?? active()));\n\n // What the tab answers to, for assistive technology; the caller's own list is kept.\n // The chords are best-effort: browsers reserve Mod+W and Mod+Shift+[/] in a page of\n // their own tabs, and they bite only in an embedded webview.\n const keyshortcuts = (): string | undefined =>\n [\n props[\"aria-keyshortcuts\"],\n !local.disabled && local.closable ? \"Delete Backspace\" : undefined,\n !local.disabled && hasActions() ? \"Shift+F10 ContextMenu\" : undefined,\n !local.disabled && local.closable ? \"Meta+W Control+W\" : undefined,\n !local.disabled ? \"Meta+Shift+[ Control+Shift+[ Meta+Shift+] Control+Shift+]\" : undefined,\n ]\n .filter(Boolean)\n .join(\" \") || undefined;\n\n // A tab given neither `closable` nor `actions` is the bare element, as it always was.\n const wrapped = (): boolean => local.closable !== undefined || actions() !== undefined;\n\n // Only a reorderable row makes its items draggable, and a disabled tab never — the same\n // contract as the registration's `disabled`. Rendered on the item (the wrapper, or the\n // bare tab when there is none), so `draggable` is in the server markup, as in React.\n const draggable = (): boolean | undefined =>\n ctx?.reorderable() && !local.disabled && props[\"aria-disabled\"] !== true && props[\"aria-disabled\"] !== \"true\"\n ? true\n : undefined;\n\n const renderTab = (): JSX.Element => (\n <Dynamic\n component={tag()}\n {...rest}\n ref={mergeRefs(local.ref, setRoot)}\n class={cn(\"smwb-tab\", local.class, {\n \"smwb-tab--active\": active(),\n \"smwb-tab--stacked\": local.stacked,\n \"smwb-tab--disabled\": local.disabled,\n })}\n id={local.id ?? ctx?.tabId(index())}\n aria-controls={local[\"aria-controls\"] ?? (ctx?.hasPanels() ? ctx.panelId(index()) : undefined)}\n // A disabled link has no href, so it is no link to follow or to focus.\n href={inert() ? undefined : local.href}\n draggable={wrapped() ? undefined : draggable()}\n onClick={onClick}\n onKeyDown={onKeyDown}\n onPointerDown={onPointerDown}\n onMouseDown={onMouseDown}\n // The role, the selection and the roving tabindex belong to the tab list:\n // they win over the caller's. A tab that is not disabled keeps the\n // caller's aria-disabled.\n role=\"tab\"\n aria-selected={active()}\n aria-disabled={local.disabled || undefined}\n aria-keyshortcuts={keyshortcuts()}\n tabindex={tabStop() ? 0 : -1}\n disabled={tag() === \"button\" ? local.disabled : undefined}\n >\n <span class=\"smwb-tab__content\" ref={mergeRefs(local.contentRef)}>\n <Show when={icon()}>\n <span class=\"smwb-tab__icon\" aria-hidden=\"true\">\n {icon()}\n </span>\n </Show>\n <Show when={label()}>\n <span class=\"smwb-tab__text-label\" title={fitTitle()}>\n {label()}\n </span>\n </Show>\n </span>\n <Ripple actionRef={(api) => (rippleActions = api)} classes={{ child: \"tab__ripple-child\" }} />\n </Dynamic>\n );\n\n return (\n <Show when={wrapped()} fallback={renderTab()}>\n <div\n class={cn(\"smwb-tab-item\", {\n \"smwb-tab-item--active\": active(),\n \"smwb-tab-item--disabled\": local.disabled,\n })}\n draggable={draggable()}\n >\n {renderTab()}\n <Show when={hasActions()}>\n <span class=\"smwb-tab__actions\" ref={actionsEl}>\n {actions()}\n </span>\n </Show>\n <Show when={local.closable}>\n <button\n type=\"button\"\n class=\"smwb-tab__close\"\n // Out of the Tab order, so the row keeps its one tab stop; Delete on the tab closes it.\n tabindex={-1}\n aria-label={local.closeLabel}\n disabled={Boolean(local.disabled)}\n // A press does not take focus from where it is: from the tab being closed, or the page.\n onMouseDown={(event) => event.preventDefault()}\n onClick={(event) => close(event, \"button\")}\n >\n <Icon name=\"close\" size={16} />\n </button>\n </Show>\n </div>\n </Show>\n );\n}\n\nexport default Tab;\n"],"names":["isModifiedClick","event","button","ctrlKey","metaKey","shiftKey","altKey","hasModifier","ACTIONS_TRIGGER","FIRST_MENU_ITEM","focusPopupOf","trigger","id","getAttribute","split","item","ownerDocument","getElementById","querySelector","focus","preventScroll","Tab","props","ctx","useTabsContext","root","setRoot","createSignal","merged","mergeProps","isActive","stacked","closeLabel","local","rest","splitProps","index","registerTab","disabled","Boolean","closable","requestClose","close","icon","children","label","fitTitle","text","fit","title","undefined","actionsApi","actions","given","hasActions","toArray","length","rippleActions","actionsEl","active","value","tag","href","inert","onClick","preventDefault","callHandler","onChange","reason","closing","onClose","onKeyDown","defaultPrevented","target","currentTarget","key","click","onPointerDown","onRipple","onMouseDown","tabStop","keyshortcuts","filter","join","wrapped","draggable","reorderable","renderTab","_$createComponent","Dynamic","_$mergeProps","component","ref","r$","_ref$","mergeRefs","cn","class","tabId","hasPanels","panelId","_$memo","role","tabindex","_el$","_tmpl$3","_ref$2","contentRef","_$use","_$insert","Show","when","_el$2","_tmpl$","_el$3","_tmpl$2","_$effect","_$setAttribute","Ripple","actionRef","api","classes","child","fallback","_el$4","_tmpl$6","_el$5","_tmpl$4","_ref$3","_el$6","_tmpl$5","$$click","$$mousedown","Icon","name","size","_p$","_v$","_v$2","e","t","_v$3","_v$4","_$className","_$delegateEvents"],"mappings":";;;;;;;;;AAgHA,MAAMA,KAAkBA,CAACC,MACvBA,EAAMC,WAAW,KAAKD,EAAME,WAAWF,EAAMG,WAAWH,EAAMI,YAAYJ,EAAMK,QAE5EC,KAAcA,CAACN,MAAkCA,EAAME,WAAWF,EAAMG,WAAWH,EAAMK,UAAUL,EAAMI,UAGzGG,KAAkB,2FAGlBC,KAAkB,kDAGlBC,KAAeA,CAACC,MAA+B;AACnD,aAAWC,KAAMD,EAAQE,aAAa,eAAe,GAAGC,MAAM,KAAK,KAAK,IAAI;AAC1E,UAAMC,IAAOH,IAAKD,EAAQK,cAAcC,eAAeL,CAAE,GAAGM,cAA2BT,EAAe,IAAI;AAC1G,QAAIM,GAAM;AAERA,MAAAA,EAAKI,MAAM;AAAA,QAAEC,eAAe;AAAA,MAAA,CAAM;AAClC;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAASC,GAAIC,GAA2C;AAC7D,QAAMC,IAAMC,EAAAA,GACN,CAACC,GAAMC,CAAO,IAAIC,EAAAA,GAClBC,IAASC,EAAW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GAAAzF;AAAAA,QAAA0F,GAAA1F;AAAAA,MAAAA,CAAA,GAAA0E;AAAAA,IAAA;AAAA,EAAA,CAAA;AA0B9B;AAEmBoB,EAAA,CAAA,aAAA,OAAA,CAAA;"}
@@ -1,5 +1,5 @@
1
1
  import { createComponent as u, use as R, spread as et, mergeProps as tt, insert as h, effect as T, setAttribute as C, setStyleProperty as pe, style as nt, memo as ye, template as L, isServer as rt, delegateEvents as ot } from "solid-js/web";
2
- import { mergeProps as st, splitProps as lt, createUniqueId as at, createSignal as f, onMount as Ie, createEffect as K, on as j, onCleanup as J, Show as O, For as it, createMemo as Le, children as xe, createComputed as Ce } from "solid-js";
2
+ import { mergeProps as st, splitProps as lt, createUniqueId as at, createSignal as b, onMount as Ie, createEffect as K, on as j, onCleanup as J, Show as O, For as it, createMemo as Le, children as xe, createComputed as Ce } from "solid-js";
3
3
  import ct from "clsx";
4
4
  import { debounce as dt } from "../../../utils/debounce.js";
5
5
  import { animate as ut } from "../../../utils/animate.js";
@@ -28,15 +28,16 @@ function Ft(w) {
28
28
  scrollButtons: !1,
29
29
  overflowMenu: !1,
30
30
  dense: !1,
31
+ fit: !1,
31
32
  orientation: "horizontal",
32
33
  scrollBackAriaLabel: "Scroll tabs back",
33
34
  scrollForwardAriaLabel: "Scroll tabs forward",
34
35
  overflowMenuAriaLabel: "More tabs"
35
- }, w), [l, Me] = lt(p, ["class", "children", "onChange", "value", "indicatorContent", "scrollable", "scrollButtons", "onReorder", "overflowMenu", "overflowMenuAriaLabel", "dense", "orientation", "panels", "id", "scrollBackAriaLabel", "scrollForwardAriaLabel", "aria-label", "ref"]), Ee = at(), Z = () => l.id ?? Ee, [M, ee] = f([]), Se = (e) => M().find((r) => r.index() === e)?.id() ?? `${Z()}-tab-${e}`, $e = (e) => `${Z()}-panel-${e}`, [Ae, De] = f(), [Re, Te] = f(!1), [te, B] = f(null), [Oe, Be] = f(!1), [_, ne] = f({
36
+ }, w), [l, Me] = lt(p, ["class", "children", "onChange", "value", "indicatorContent", "scrollable", "scrollButtons", "onReorder", "overflowMenu", "overflowMenuAriaLabel", "dense", "fit", "orientation", "panels", "id", "scrollBackAriaLabel", "scrollForwardAriaLabel", "aria-label", "ref"]), Ee = at(), Z = () => l.id ?? Ee, [M, ee] = b([]), Se = (e) => M().find((r) => r.index() === e)?.id() ?? `${Z()}-tab-${e}`, $e = (e) => `${Z()}-panel-${e}`, [Ae, De] = b(), [Re, Te] = b(!1), [te, B] = b(null), [Oe, Be] = b(!1), [_, ne] = b({
36
37
  root: {}
37
- }), [W, re] = f(!1), [F, oe] = f(!1), [se, le] = f([]), [ae, q] = f(!1);
38
- let ie, c, b, v = null;
39
- const [E, Pe] = f();
38
+ }), [W, re] = b(!1), [F, oe] = b(!1), [se, le] = b([]), [ae, q] = b(!1);
39
+ let ie, c, f, v = null;
40
+ const [E, Pe] = b();
40
41
  let ke = 0;
41
42
  const ze = () => {
42
43
  let e;
@@ -50,8 +51,8 @@ function Ft(w) {
50
51
  };
51
52
  }
52
53
  let r = null, t = null;
53
- if (c && b && b.children.length > 0) {
54
- const s = b.children[l.value];
54
+ if (c && f && f.children.length > 0) {
55
+ const s = f.children[l.value];
55
56
  r = s ? s.getBoundingClientRect() : null, l.indicatorContent && (t = s?.querySelector(".smwb-tab__content")?.getBoundingClientRect() ?? null);
56
57
  }
57
58
  return {
@@ -90,7 +91,7 @@ function Ft(w) {
90
91
  }
91
92
  const e = c.scrollWidth - c.clientWidth;
92
93
  re(c.scrollLeft > 1), oe(c.scrollLeft < e - 1);
93
- const r = l.overflowMenu ? bt(b ? Array.from(b.children).map((t) => {
94
+ const r = l.overflowMenu ? bt(f ? Array.from(f.children).map((t) => {
94
95
  const s = t;
95
96
  return {
96
97
  offsetLeft: s.offsetLeft,
@@ -105,8 +106,8 @@ function Ft(w) {
105
106
  }, de = (e) => {
106
107
  c && N(c.scrollLeft + e * c.clientWidth * Ct);
107
108
  }, ue = (e) => {
108
- if (!c || !b) return;
109
- const r = b.children[e];
109
+ if (!c || !f) return;
110
+ const r = f.children[e];
110
111
  if (!r) return;
111
112
  const t = c.getBoundingClientRect(), s = r.getBoundingClientRect();
112
113
  s.left < t.left ? N(c.scrollLeft + (s.left - t.left) - _e) : s.right > t.right && N(c.scrollLeft + (s.right - t.right) + _e);
@@ -123,13 +124,13 @@ function Ft(w) {
123
124
  passive: !0
124
125
  });
125
126
  let t;
126
- typeof ResizeObserver < "u" && b && (t = new ResizeObserver(e), c && t.observe(c), Array.from(b.children).forEach((s) => t?.observe(s))), S(), J(() => {
127
+ typeof ResizeObserver < "u" && f && (t = new ResizeObserver(e), c && t.observe(c), Array.from(f.children).forEach((s) => t?.observe(s))), S(), J(() => {
127
128
  e.cancel(), r?.removeEventListener("resize", e), c?.removeEventListener("scroll", S), t?.disconnect();
128
129
  });
129
130
  }), K(() => {
130
131
  _(), Ke();
131
132
  });
132
- const g = () => Array.from(b?.querySelectorAll('[role="tab"]') ?? []), y = (e) => e.closest(".smwb-tab-item") ?? e, I = (e) => e ? g().findIndex((r) => y(r).contains(e)) : -1, $ = (e) => !e || e.getAttribute("aria-disabled") === "true" || e.disabled === !0, We = () => {
133
+ const g = () => Array.from(f?.querySelectorAll('[role="tab"]') ?? []), y = (e) => e.closest(".smwb-tab-item") ?? e, I = (e) => e ? g().findIndex((r) => y(r).contains(e)) : -1, $ = (e) => !e || e.getAttribute("aria-disabled") === "true" || e.disabled === !0, We = () => {
133
134
  const e = E()?.length, r = e === void 0 || l.value >= 0 && l.value < e ? l.value : 0, t = M();
134
135
  if (!t.some((n) => n.index() === r && n.disabled())) return r;
135
136
  const s = t.filter((n) => !n.disabled()).map((n) => n.index()).filter((n) => n >= 0);
@@ -144,7 +145,7 @@ function Ft(w) {
144
145
  isDisabled: (e) => $(g()[e])
145
146
  });
146
147
  let x = null, P = null, A = null;
147
- const V = (e) => e instanceof Element ? y(e) : null, be = () => {
148
+ const V = (e) => e instanceof Element && e !== f ? y(e) : null, be = () => {
148
149
  P?.classList.remove("smwb-tab-item--dragging"), A?.classList.remove("smwb-tab-item--drop-target"), P = null, A = null;
149
150
  }, qe = (e) => {
150
151
  if (!l.onReorder) return;
@@ -198,7 +199,7 @@ function Ft(w) {
198
199
  }
199
200
  };
200
201
  K(j(E, () => {
201
- const e = b?.ownerDocument, r = v;
202
+ const e = f?.ownerDocument, r = v;
202
203
  if (e && r && !r.item.isConnected && (v = null, !e.activeElement || e.activeElement === e.body)) {
203
204
  const s = g(), n = Math.min(r.index, s.length - 1), o = [...s.keys()].filter((i) => !$(s[i])), a = o.find((i) => i >= n) ?? o[o.length - 1];
204
205
  if (a !== void 0) {
@@ -221,6 +222,7 @@ function Ft(w) {
221
222
  }));
222
223
  }, je = {
223
224
  value: () => l.value,
225
+ fit: () => l.fit,
224
226
  tabStop: (e) => fe() === e,
225
227
  tabId: Se,
226
228
  panelId: $e,
@@ -269,6 +271,7 @@ function Ft(w) {
269
271
  get class() {
270
272
  return ct("smwb-tabs", {
271
273
  "smwb-tabs--dense": l.dense,
274
+ "smwb-tabs--fit": l.fit,
272
275
  "smwb-tabs--overflow-start": W(),
273
276
  "smwb-tabs--overflow-end": F()
274
277
  }, l.class);
@@ -290,7 +293,7 @@ function Ft(w) {
290
293
  t: void 0
291
294
  }), n;
292
295
  }
293
- }), r), R((n) => c = n, r), t.addEventListener("dragend", He), t.addEventListener("drop", Ve), t.addEventListener("dragover", Ne), t.addEventListener("dragstart", qe), t.$$focusout = Ue, t.$$focusin = Ge, t.$$keydown = Xe, R((n) => b = n, t), h(t, u(Mt, {
296
+ }), r), R((n) => c = n, r), t.addEventListener("dragend", He), t.addEventListener("drop", Ve), t.addEventListener("dragover", Ne), t.addEventListener("dragstart", qe), t.$$focusout = Ue, t.$$focusin = Ge, t.$$keydown = Xe, R((n) => f = n, t), h(t, u(Mt, {
294
297
  onItems: Pe,
295
298
  get children() {
296
299
  return l.children;
@@ -359,7 +362,7 @@ function Ft(w) {
359
362
  return se();
360
363
  },
361
364
  children: (n) => {
362
- const o = () => g()[n], a = o(), [i, D] = f(H(a)), [X, Ye] = f(!!k(a)), Ze = Le(() => {
365
+ const o = () => g()[n], a = o(), [i, D] = b(H(a)), [X, Ye] = b(!!k(a)), Ze = Le(() => {
363
366
  const d = M().find((m) => m.index() === n);
364
367
  return d ? d.disabled() : $(o());
365
368
  });