@stackone/malachite 2.105.1 → 2.107.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.
@@ -1,8 +1,8 @@
1
- import { jsx as m, jsxs as S } from "react/jsx-runtime";
2
- import { useRef as $ } from "react";
3
- import { FOCUS_RING as w } from "./focusRing.js";
4
- import { rovingTabStop as I, nextRovingIndex as D } from "./rovingKeys.js";
5
- const N = {
1
+ import { jsx as m, jsxs as $ } from "react/jsx-runtime";
2
+ import { useRef as w } from "react";
3
+ import { FOCUS_RING as I } from "./focusRing.js";
4
+ import { rovingTabStop as D, nextRovingIndex as N } from "./rovingKeys.js";
5
+ const j = {
6
6
  small: {
7
7
  text: "text-[length:var(--malachite-font-size-small,13px)]",
8
8
  track: "h-[var(--malachite-control-height-small,28px)]",
@@ -18,44 +18,46 @@ const N = {
18
18
  track: "h-[var(--malachite-control-height-large,42px)]",
19
19
  item: "h-full px-4"
20
20
  }
21
- }, j = "inline-flex items-center justify-center gap-1.5 rounded-[var(--malachite-radius-10,10px)] border-0 font-medium tracking-[0.13px] whitespace-nowrap transition-colors duration-150 ease-in-out", K = ({
22
- options: l,
21
+ }, z = "inline-flex items-center justify-center gap-1.5 rounded-[var(--malachite-radius-10,10px)] border-0 font-medium tracking-[0.13px] whitespace-nowrap transition-colors duration-150 ease-in-out", _ = ({
22
+ options: r,
23
23
  value: s,
24
24
  onChange: u,
25
25
  size: g = "medium",
26
26
  fullWidth: x = !1,
27
- disabled: r = !1,
27
+ disabled: l = !1,
28
28
  "aria-label": b,
29
29
  "aria-labelledby": v,
30
- className: p = ""
30
+ "aria-describedby": p,
31
+ className: k = ""
31
32
  }) => {
32
- const o = $([]), d = N[g], k = l.findIndex((e) => e.value === s), h = l.map((e) => !e.disabled), f = I(k, h);
33
+ const o = w([]), d = j[g], y = r.findIndex((e) => e.value === s), h = r.map((e) => !e.disabled), f = D(y, h);
33
34
  return /* @__PURE__ */ m(
34
35
  "div",
35
36
  {
36
37
  role: "radiogroup",
37
38
  "aria-label": b,
38
39
  "aria-labelledby": v,
39
- "aria-disabled": r || void 0,
40
+ "aria-describedby": p,
41
+ "aria-disabled": l || void 0,
40
42
  onKeyDown: (e) => {
41
43
  var a;
42
- if (r)
44
+ if (l)
43
45
  return;
44
- const n = o.current.findIndex((c) => c === e.target), t = D(e, n >= 0 ? n : f, h);
45
- t !== void 0 && (e.preventDefault(), l[t].value !== s && u(l[t].value), (a = o.current[t]) == null || a.focus());
46
+ const n = o.current.findIndex((c) => c === e.target), t = N(e, n >= 0 ? n : f, h);
47
+ t !== void 0 && (e.preventDefault(), r[t].value !== s && u(r[t].value), (a = o.current[t]) == null || a.focus());
46
48
  },
47
49
  className: `${// One display utility, not two: `flex` and `inline-flex` are both plain
48
50
  // `display` utilities, so emitting both would resolve by stylesheet order
49
51
  // (same hazard as the background above).
50
- x ? "flex w-full" : "inline-flex"} ${d.track} items-center gap-1 p-0.5 rounded-xl bg-[var(--malachite-segmented-control-track-background)] ${r ? "opacity-50" : ""} ${p}`,
51
- children: l.map((e, n) => {
52
- const t = e.value === s, a = r || e.disabled, c = e.badge !== void 0 && e.badge !== null && e.badge !== !1;
52
+ x ? "flex w-full" : "inline-flex"} ${d.track} items-center gap-1 p-0.5 rounded-xl bg-[var(--malachite-segmented-control-track-background)] ${l ? "opacity-50" : ""} ${k}`,
53
+ children: r.map((e, n) => {
54
+ const t = e.value === s, a = l || e.disabled, c = e.badge !== void 0 && e.badge !== null && e.badge !== !1;
53
55
  let i;
54
- return t ? i = "bg-[var(--malachite-segmented-control-selected-background)] text-[var(--malachite-segmented-control-selected-foreground)]" : a ? i = "bg-transparent text-[var(--malachite-segmented-control-item-foreground)]" : i = "bg-transparent text-[var(--malachite-segmented-control-item-foreground)] hover:text-[var(--malachite-segmented-control-item-hover-foreground)] cursor-pointer", /* @__PURE__ */ S(
56
+ return t ? i = "bg-[var(--malachite-segmented-control-selected-background)] text-[var(--malachite-segmented-control-selected-foreground)]" : a ? i = "bg-transparent text-[var(--malachite-segmented-control-item-foreground)]" : i = "bg-transparent text-[var(--malachite-segmented-control-item-foreground)] hover:text-[var(--malachite-segmented-control-item-hover-foreground)] cursor-pointer", /* @__PURE__ */ $(
55
57
  "button",
56
58
  {
57
- ref: (y) => {
58
- o.current[n] = y;
59
+ ref: (S) => {
60
+ o.current[n] = S;
59
61
  },
60
62
  type: "button",
61
63
  role: "radio",
@@ -65,7 +67,7 @@ const N = {
65
67
  onClick: () => {
66
68
  !a && !t && u(e.value);
67
69
  },
68
- className: `${w} ${j} ${d.text} ${d.item} ${i} ${x ? "flex-1" : ""} ${e.disabled && !r ? "opacity-50 cursor-not-allowed" : ""}`,
70
+ className: `${I} ${z} ${d.text} ${d.item} ${i} ${x ? "flex-1" : ""} ${e.disabled && !l ? "opacity-50 cursor-not-allowed" : ""}`,
69
71
  style: {
70
72
  // Inline rather than a Tailwind shadow class: Tailwind's shadow
71
73
  // utilities compose `--tw-shadow-*` custom properties that rely on
@@ -87,7 +89,7 @@ const N = {
87
89
  );
88
90
  };
89
91
  export {
90
- K as SegmentedControl,
91
- K as default
92
+ _ as SegmentedControl,
93
+ _ as default
92
94
  };
93
95
  //# sourceMappingURL=SegmentedControl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControl.js","sources":["../../src/components/SegmentedControl.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport { FOCUS_RING } from './focusRing';\nimport { nextRovingIndex, rovingTabStop } from './rovingKeys';\n\ntype SegmentedControlSize = 'small' | 'medium' | 'large';\n\ninterface SegmentedControlOption<T extends string = string> {\n value: T;\n label: string;\n icon?: React.ReactNode;\n /**\n * Small mark after the label, e.g. a compact `Tag` naming a saving. It renders inside\n * the segment's `<button>`, so it must not be interactive — no `onClick` or `onRemove`.\n */\n badge?: React.ReactNode;\n disabled?: boolean;\n}\n\ninterface SegmentedControlProps<T extends string = string> {\n options: SegmentedControlOption<T>[];\n /** The selected option's value. A value not present in `options` renders nothing selected. */\n value: T;\n onChange: (value: T) => void;\n size?: SegmentedControlSize;\n /** Stretch the track to its container and split it into equal segments. */\n fullWidth?: boolean;\n /** Disables every segment. Individual segments can also be disabled via `options`. */\n disabled?: boolean;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n className?: string;\n}\n\n// The ladder governs a control's outer box. The height therefore sits on the track and\n// the items fill whatever the 4px inset leaves — putting it on the item instead makes a\n// `medium` segmented control 40px tall beside a 32px Dropdown.\nconst SIZE_CLASSES: Record<SegmentedControlSize, { text: string; track: string; item: string }> = {\n small: {\n text: 'text-[length:var(--malachite-font-size-small,13px)]',\n track: 'h-[var(--malachite-control-height-small,28px)]',\n item: 'h-full px-2.5',\n },\n medium: {\n text: 'text-[length:var(--malachite-font-size-small,13px)]',\n track: 'h-[var(--malachite-control-height-medium,32px)]',\n item: 'h-full px-2.5',\n },\n large: {\n text: 'text-[length:var(--malachite-font-size-15,15px)]',\n track: 'h-[var(--malachite-control-height-large,42px)]',\n item: 'h-full px-4',\n },\n};\n\n// Deliberately no `bg-*` here: each state branch below supplies exactly one\n// background-color utility. Both `bg-transparent` and an arbitrary-value `bg-` are plain\n// single-class utilities in the same `@layer utilities`, so an element carrying both\n// resolves by stylesheet order — and the arbitrary value loses, silently rendering the\n// selected thumb transparent.\nconst ITEM_BASE =\n 'inline-flex items-center justify-center gap-1.5 rounded-[var(--malachite-radius-10,10px)] border-0 font-medium tracking-[0.13px] whitespace-nowrap transition-colors duration-150 ease-in-out';\n\n/**\n * A rounded track of mutually-exclusive options — the segmented \"one of these\" control.\n *\n * Owns the track background, the selected-thumb chrome and the radiogroup semantics in\n * one place, so consumers never hand-roll a track around `PillButton` (whose `default`\n * variant tokens are tuned for standalone filter pills, not for a sunken track).\n *\n * Selection is conveyed non-visually via `role=\"radio\"` + `aria-checked`, and by a\n * foreground-colour change as well as the thumb, so it does not rest on background\n * colour alone.\n */\nconst SegmentedControl = <T extends string = string>({\n options,\n value,\n onChange,\n size = 'medium',\n fullWidth = false,\n disabled = false,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n}: SegmentedControlProps<T>) => {\n const itemRefs = useRef<(HTMLButtonElement | null)[]>([]);\n const sizeBlock = SIZE_CLASSES[size];\n\n const selectedIndex = options.findIndex((option) => option.value === value);\n const enabled = options.map((option) => !option.disabled);\n // Roving tabindex: the group is a single tab stop. When the selected option is\n // missing or disabled, the first enabled option takes the stop so the control is\n // still reachable by keyboard.\n const tabStopIndex = rovingTabStop(selectedIndex, enabled);\n\n // Arrow keys move AND select, per the WAI-ARIA radiogroup pattern, from the focused option.\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (disabled) {\n return;\n }\n const focused = itemRefs.current.findIndex((item) => item === event.target);\n const next = nextRovingIndex(event, focused >= 0 ? focused : tabStopIndex, enabled);\n if (next === undefined) {\n return;\n }\n\n // Only once we know we'll act — otherwise Home/End etc. should still scroll.\n event.preventDefault();\n if (options[next].value !== value) {\n onChange(options[next].value);\n }\n itemRefs.current[next]?.focus();\n };\n\n return (\n <div\n role=\"radiogroup\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-disabled={disabled || undefined}\n onKeyDown={handleKeyDown}\n className={`${\n // One display utility, not two: `flex` and `inline-flex` are both plain\n // `display` utilities, so emitting both would resolve by stylesheet order\n // (same hazard as the background above).\n fullWidth ? 'flex w-full' : 'inline-flex'\n } ${sizeBlock.track} items-center gap-1 p-0.5 rounded-xl bg-[var(--malachite-segmented-control-track-background)] ${\n disabled ? 'opacity-50' : ''\n } ${className}`}\n >\n {options.map((option, index) => {\n const isSelected = option.value === value;\n const isDisabled = disabled || option.disabled;\n const hasBadge =\n option.badge !== undefined && option.badge !== null && option.badge !== false;\n\n let colorClasses: string;\n if (isSelected) {\n colorClasses =\n 'bg-[var(--malachite-segmented-control-selected-background)] text-[var(--malachite-segmented-control-selected-foreground)]';\n } else if (isDisabled) {\n colorClasses =\n 'bg-transparent text-[var(--malachite-segmented-control-item-foreground)]';\n } else {\n colorClasses =\n 'bg-transparent text-[var(--malachite-segmented-control-item-foreground)] hover:text-[var(--malachite-segmented-control-item-hover-foreground)] cursor-pointer';\n }\n\n return (\n <button\n key={option.value}\n ref={(element) => {\n itemRefs.current[index] = element;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={isSelected}\n disabled={isDisabled}\n tabIndex={index === tabStopIndex ? 0 : -1}\n onClick={() => {\n // Radios don't toggle off on re-click.\n if (!isDisabled && !isSelected) {\n onChange(option.value);\n }\n }}\n className={`${FOCUS_RING} ${ITEM_BASE} ${sizeBlock.text} ${sizeBlock.item} ${colorClasses} ${\n fullWidth ? 'flex-1' : ''\n } ${option.disabled && !disabled ? 'opacity-50 cursor-not-allowed' : ''}`}\n style={{\n // Inline rather than a Tailwind shadow class: Tailwind's shadow\n // utilities compose `--tw-shadow-*` custom properties that rely on\n // document-level @property registration and silently don't paint\n // inside a shadow root (same caveat as `ring-*`).\n boxShadow: isSelected\n ? 'var(--malachite-segmented-control-selected-shadow, 0px 1px 5px 0px rgba(0, 0, 0, 0.1))'\n : undefined,\n }}\n >\n {option.icon ? (\n <span className=\"inline-flex items-center justify-center w-4 h-4 shrink-0\">\n {option.icon}\n </span>\n ) : null}\n {option.label}\n {/* The space keeps the name \"Annual Save\" rather than \"AnnualSave\";\n the flex gap already spaces the two visually. */}\n {hasBadge ? ' ' : null}\n {hasBadge ? (\n <span className=\"inline-flex items-center shrink-0\">\n {option.badge}\n </span>\n ) : null}\n </button>\n );\n })}\n </div>\n );\n};\n\nexport default SegmentedControl;\nexport { SegmentedControl };\nexport type { SegmentedControlProps, SegmentedControlOption, SegmentedControlSize };\n"],"names":["SIZE_CLASSES","ITEM_BASE","SegmentedControl","options","value","onChange","size","fullWidth","disabled","ariaLabel","ariaLabelledBy","className","itemRefs","useRef","sizeBlock","selectedIndex","option","enabled","tabStopIndex","rovingTabStop","jsx","event","focused","item","next","nextRovingIndex","_a","index","isSelected","isDisabled","hasBadge","colorClasses","j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AAAA,YAAA;AAAA,UAAA;AAAA,UAzCCA,EAAO;AAAA,QAAA;AAAA,MA4CxB,CAAC;AAAA,IAAA;AAAA,EAAA;AAGb;"}
1
+ {"version":3,"file":"SegmentedControl.js","sources":["../../src/components/SegmentedControl.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport { FOCUS_RING } from './focusRing';\nimport { nextRovingIndex, rovingTabStop } from './rovingKeys';\n\ntype SegmentedControlSize = 'small' | 'medium' | 'large';\n\ninterface SegmentedControlOption<T extends string = string> {\n value: T;\n label: string;\n icon?: React.ReactNode;\n /**\n * Small mark after the label, e.g. a compact `Tag` naming a saving. It renders inside\n * the segment's `<button>`, so it must not be interactive — no `onClick` or `onRemove`.\n */\n badge?: React.ReactNode;\n disabled?: boolean;\n}\n\ninterface SegmentedControlProps<T extends string = string> {\n options: SegmentedControlOption<T>[];\n /** The selected option's value. A value not present in `options` renders nothing selected. */\n value: T;\n onChange: (value: T) => void;\n size?: SegmentedControlSize;\n /** Stretch the track to its container and split it into equal segments. */\n fullWidth?: boolean;\n /** Disables every segment. Individual segments can also be disabled via `options`. */\n disabled?: boolean;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n className?: string;\n}\n\n// The ladder governs a control's outer box. The height therefore sits on the track and\n// the items fill whatever the 4px inset leaves — putting it on the item instead makes a\n// `medium` segmented control 40px tall beside a 32px Dropdown.\nconst SIZE_CLASSES: Record<SegmentedControlSize, { text: string; track: string; item: string }> = {\n small: {\n text: 'text-[length:var(--malachite-font-size-small,13px)]',\n track: 'h-[var(--malachite-control-height-small,28px)]',\n item: 'h-full px-2.5',\n },\n medium: {\n text: 'text-[length:var(--malachite-font-size-small,13px)]',\n track: 'h-[var(--malachite-control-height-medium,32px)]',\n item: 'h-full px-2.5',\n },\n large: {\n text: 'text-[length:var(--malachite-font-size-15,15px)]',\n track: 'h-[var(--malachite-control-height-large,42px)]',\n item: 'h-full px-4',\n },\n};\n\n// Deliberately no `bg-*` here: each state branch below supplies exactly one\n// background-color utility. Both `bg-transparent` and an arbitrary-value `bg-` are plain\n// single-class utilities in the same `@layer utilities`, so an element carrying both\n// resolves by stylesheet order — and the arbitrary value loses, silently rendering the\n// selected thumb transparent.\nconst ITEM_BASE =\n 'inline-flex items-center justify-center gap-1.5 rounded-[var(--malachite-radius-10,10px)] border-0 font-medium tracking-[0.13px] whitespace-nowrap transition-colors duration-150 ease-in-out';\n\n/**\n * A rounded track of mutually-exclusive options — the segmented \"one of these\" control.\n *\n * Owns the track background, the selected-thumb chrome and the radiogroup semantics in\n * one place, so consumers never hand-roll a track around `PillButton` (whose `default`\n * variant tokens are tuned for standalone filter pills, not for a sunken track).\n *\n * Selection is conveyed non-visually via `role=\"radio\"` + `aria-checked`, and by a\n * foreground-colour change as well as the thumb, so it does not rest on background\n * colour alone.\n */\nconst SegmentedControl = <T extends string = string>({\n options,\n value,\n onChange,\n size = 'medium',\n fullWidth = false,\n disabled = false,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n className = '',\n}: SegmentedControlProps<T>) => {\n const itemRefs = useRef<(HTMLButtonElement | null)[]>([]);\n const sizeBlock = SIZE_CLASSES[size];\n\n const selectedIndex = options.findIndex((option) => option.value === value);\n const enabled = options.map((option) => !option.disabled);\n // Roving tabindex: the group is a single tab stop. When the selected option is\n // missing or disabled, the first enabled option takes the stop so the control is\n // still reachable by keyboard.\n const tabStopIndex = rovingTabStop(selectedIndex, enabled);\n\n // Arrow keys move AND select, per the WAI-ARIA radiogroup pattern, from the focused option.\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (disabled) {\n return;\n }\n const focused = itemRefs.current.findIndex((item) => item === event.target);\n const next = nextRovingIndex(event, focused >= 0 ? focused : tabStopIndex, enabled);\n if (next === undefined) {\n return;\n }\n\n // Only once we know we'll act — otherwise Home/End etc. should still scroll.\n event.preventDefault();\n if (options[next].value !== value) {\n onChange(options[next].value);\n }\n itemRefs.current[next]?.focus();\n };\n\n return (\n <div\n role=\"radiogroup\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-disabled={disabled || undefined}\n onKeyDown={handleKeyDown}\n className={`${\n // One display utility, not two: `flex` and `inline-flex` are both plain\n // `display` utilities, so emitting both would resolve by stylesheet order\n // (same hazard as the background above).\n fullWidth ? 'flex w-full' : 'inline-flex'\n } ${sizeBlock.track} items-center gap-1 p-0.5 rounded-xl bg-[var(--malachite-segmented-control-track-background)] ${\n disabled ? 'opacity-50' : ''\n } ${className}`}\n >\n {options.map((option, index) => {\n const isSelected = option.value === value;\n const isDisabled = disabled || option.disabled;\n const hasBadge =\n option.badge !== undefined && option.badge !== null && option.badge !== false;\n\n let colorClasses: string;\n if (isSelected) {\n colorClasses =\n 'bg-[var(--malachite-segmented-control-selected-background)] text-[var(--malachite-segmented-control-selected-foreground)]';\n } else if (isDisabled) {\n colorClasses =\n 'bg-transparent text-[var(--malachite-segmented-control-item-foreground)]';\n } else {\n colorClasses =\n 'bg-transparent text-[var(--malachite-segmented-control-item-foreground)] hover:text-[var(--malachite-segmented-control-item-hover-foreground)] cursor-pointer';\n }\n\n return (\n <button\n key={option.value}\n ref={(element) => {\n itemRefs.current[index] = element;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={isSelected}\n disabled={isDisabled}\n tabIndex={index === tabStopIndex ? 0 : -1}\n onClick={() => {\n // Radios don't toggle off on re-click.\n if (!isDisabled && !isSelected) {\n onChange(option.value);\n }\n }}\n className={`${FOCUS_RING} ${ITEM_BASE} ${sizeBlock.text} ${sizeBlock.item} ${colorClasses} ${\n fullWidth ? 'flex-1' : ''\n } ${option.disabled && !disabled ? 'opacity-50 cursor-not-allowed' : ''}`}\n style={{\n // Inline rather than a Tailwind shadow class: Tailwind's shadow\n // utilities compose `--tw-shadow-*` custom properties that rely on\n // document-level @property registration and silently don't paint\n // inside a shadow root (same caveat as `ring-*`).\n boxShadow: isSelected\n ? 'var(--malachite-segmented-control-selected-shadow, 0px 1px 5px 0px rgba(0, 0, 0, 0.1))'\n : undefined,\n }}\n >\n {option.icon ? (\n <span className=\"inline-flex items-center justify-center w-4 h-4 shrink-0\">\n {option.icon}\n </span>\n ) : null}\n {option.label}\n {/* The space keeps the name \"Annual Save\" rather than \"AnnualSave\";\n the flex gap already spaces the two visually. */}\n {hasBadge ? ' ' : null}\n {hasBadge ? (\n <span className=\"inline-flex items-center shrink-0\">\n {option.badge}\n </span>\n ) : null}\n </button>\n );\n })}\n </div>\n );\n};\n\nexport default SegmentedControl;\nexport { SegmentedControl };\nexport type { SegmentedControlProps, SegmentedControlOption, SegmentedControlSize };\n"],"names":["SIZE_CLASSES","ITEM_BASE","SegmentedControl","options","value","onChange","size","fullWidth","disabled","ariaLabel","ariaLabelledBy","ariaDescribedBy","className","itemRefs","useRef","sizeBlock","selectedIndex","option","enabled","tabStopIndex","rovingTabStop","jsx","event","focused","item","next","nextRovingIndex","_a","index","isSelected","isDisabled","hasBadge","colorClasses","jsxs","element","FOCUS_RING"],"mappings":";;;;AAqCA,MAAMA,IAA4F;AAAA,EAC9F,OAAO;AAAA,IACH,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAEV,QAAQ;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAEV,OAAO;AAAA,IACH,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAEd,GAOMC,IACF,iMAaEC,IAAmB,CAA4B;AAAA,EACjD,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC,IAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,cAAcC;AAAA,EACd,mBAAmBC;AAAA,EACnB,oBAAoBC;AAAA,EACpB,WAAAC,IAAY;AAChB,MAAgC;AAC5B,QAAMC,IAAWC,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A,MAAK;AAAA,YACL,MAAK;AAAA,YACL,gBAAcL;AAAA,YACd,UAAUC;AAAA,YACV,UAAUF,MAAUT,IAAe,IAAI;AAAA,YACvC,SAAS,MAAM;AAEX,cAAI,CAACW,KAAc,CAACD,KAChBxB,EAASY,EAAO,KAAK;AAAA,YAE7B;AAAA,YACA,WAAW,GAAGkB,CAAU,IAAIlC,CAAS,IAAIc,EAAU,IAAI,IAAIA,EAAU,IAAI,IAAIiB,CAAY,IACrFzB,IAAY,WAAW,EAC3B,IAAIU,EAAO,YAAY,CAACT,IAAW,kCAAkC,EAAE;AAAA,YACvE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,cAKH,WAAWqB,IACL,2FACA;AAAA,YAAA;AAAA,YAGT,UAAA;AAAA,cAAAZ,EAAO,OACJ,gBAAAI,EAAC,QAAA,EAAK,WAAU,4DACX,UAAAJ,EAAO,MACZ,IACA;AAAA,cACHA,EAAO;AAAA,cAGPc,IAAW,MAAM;AAAA,cACjBA,IACG,gBAAAV,EAAC,QAAA,EAAK,WAAU,qCACX,UAAAJ,EAAO,OACZ,IACA;AAAA,YAAA;AAAA,UAAA;AAAA,UAzCCA,EAAO;AAAA,QAAA;AAAA,MA4CxB,CAAC;AAAA,IAAA;AAAA,EAAA;AAGb;"}
@@ -1,130 +1,139 @@
1
1
  import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
- import { useId as B, useState as W, useRef as v, useEffect as ie } from "react";
3
- import { createPortal as ne } from "react-dom";
4
- import { ShadowRootWrapper as oe } from "../ShadowRootWrapper.js";
5
- import se from "./CalloutStrip.js";
6
- import ce from "./CustomIcons/ArrowLeftIcon.js";
7
- import de from "./CustomIcons/DismissIcon.js";
8
- import N from "./Typography/EllipsisText.js";
9
- import { afterNextPaint as me } from "./afterNextPaint.js";
10
- import { useOverlayBehaviour as pe, OVERLAY_ICON_BUTTON_CLASSES as j } from "./overlayBehaviour.js";
11
- import { OVERLAY_ELEVATED_ATTR as xe, overlayIdentity as H } from "./portalOverlay.js";
12
- const x = 200, fe = "360px", U = ({
2
+ import { useId as F, useState as m, useCallback as ue, useMemo as he, useRef as y, useEffect as be } from "react";
3
+ import { createPortal as ve } from "react-dom";
4
+ import { ShadowRootWrapper as Ne } from "../ShadowRootWrapper.js";
5
+ import ge from "./CalloutStrip.js";
6
+ import we from "./CustomIcons/ArrowLeftIcon.js";
7
+ import ye from "./CustomIcons/DismissIcon.js";
8
+ import Te from "./SidePanelTabs.js";
9
+ import T from "./Typography/EllipsisText.js";
10
+ import { afterNextPaint as Se } from "./afterNextPaint.js";
11
+ import { useOverlayBehaviour as $e, OVERLAY_ICON_BUTTON_CLASSES as G } from "./overlayBehaviour.js";
12
+ import { OVERLAY_ELEVATED_ATTR as Ce, overlayIdentity as K } from "./portalOverlay.js";
13
+ import { SidePanelTabsContext as q } from "./sidePanelTabsContext.js";
14
+ const h = 200, Ie = "360px", J = ({
13
15
  bodyPadding: r,
14
- callouts: a,
16
+ callouts: t,
15
17
  calloutId: i,
16
18
  renderLink: o,
17
- children: m
19
+ stableGutter: b = !1,
20
+ scrollerRef: p,
21
+ children: s
18
22
  }) => {
19
- const c = !!(a != null && a.length);
23
+ const d = !!(t != null && t.length);
20
24
  return /* @__PURE__ */ l(
21
25
  "div",
22
26
  {
23
- className: `min-h-0 flex-1 overflow-y-auto ${r && !c ? "px-[28px]" : ""}`,
27
+ ref: p,
28
+ className: `min-h-0 flex-1 overflow-y-auto ${b ? "[scrollbar-gutter:stable]" : ""} ${r && !d ? "px-[28px]" : ""}`,
24
29
  children: [
25
- a == null ? void 0 : a.map((s, d) => /* @__PURE__ */ e(
26
- se,
30
+ t == null ? void 0 : t.map((x, f) => /* @__PURE__ */ e(
31
+ ge,
27
32
  {
28
- id: i ? `${i}-${d}` : void 0,
29
- type: s.type,
30
- message: s.message,
33
+ id: i ? `${i}-${f}` : void 0,
34
+ type: x.type,
35
+ message: x.message,
31
36
  renderLink: o
32
37
  },
33
- d
38
+ f
34
39
  )),
35
- r ? /* @__PURE__ */ e("div", { className: c ? "p-[28px]" : "py-[28px]", children: m }) : m
40
+ r ? /* @__PURE__ */ e("div", { className: d ? "p-[28px]" : "py-[28px]", children: s }) : s
36
41
  ]
37
42
  }
38
43
  );
39
- }, g = (r) => typeof r == "number" ? `${r}px` : r, ue = (r) => {
44
+ }, S = (r) => typeof r == "number" ? `${r}px` : r, Pe = (r) => {
40
45
  r.key === "Enter" && r.target instanceof HTMLInputElement && r.preventDefault();
41
- }, X = "col-start-2 row-span-3 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid", he = ({ onSubmit: r, children: a }) => r ? /* @__PURE__ */ e(
46
+ }, Q = "col-start-2 row-span-3 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid", ke = ({ onSubmit: r, children: t }) => r ? /* @__PURE__ */ e(
42
47
  "form",
43
48
  {
44
49
  noValidate: !0,
45
- className: X,
50
+ className: Q,
46
51
  onSubmit: (i) => {
47
52
  i.preventDefault(), i.stopPropagation(), r(i);
48
53
  },
49
- children: a
54
+ children: t
50
55
  }
51
- ) : /* @__PURE__ */ e("div", { className: X, children: a }), Ce = ({
56
+ ) : /* @__PURE__ */ e("div", { className: Q, children: t }), Ee = ({
52
57
  open: r,
53
- onClose: a,
58
+ onClose: t,
54
59
  title: i,
55
60
  subtitle: o,
56
- subtitlePlacement: m = "inline",
57
- titleExtra: c,
61
+ subtitlePlacement: b = "inline",
62
+ titleExtra: p,
58
63
  description: s,
59
64
  toolbar: d,
60
- headerDivider: Y = !1,
61
- icon: w,
62
- headerExtra: y,
63
- footer: f,
64
- onSubmit: $,
65
- onBack: T,
66
- maxWidth: u = 1080,
67
- "aria-label": F,
68
- "aria-labelledby": I,
69
- bodyPadding: K = !0,
70
- stacking: q = "default",
71
- callouts: h,
72
- renderLink: G,
73
- aside: t,
74
- children: J
65
+ toolbarPadding: x = "default",
66
+ headerDivider: f = !1,
67
+ icon: $,
68
+ headerExtra: C,
69
+ footer: v,
70
+ onSubmit: I,
71
+ onBack: P,
72
+ maxWidth: N = 1080,
73
+ "aria-label": Z,
74
+ "aria-labelledby": k,
75
+ bodyPadding: ee = !0,
76
+ stacking: re = "default",
77
+ callouts: g,
78
+ renderLink: le,
79
+ aside: a,
80
+ children: te
75
81
  }) => {
76
- const S = B(), E = B(), [C, k] = W(!1), [Q, _] = W(!1), p = v(null), n = v(null), P = v(null), {
77
- ref: Z,
78
- isTopmost: ee,
79
- zIndex: re,
80
- elevated: le
81
- } = pe({
82
+ const E = F(), [_, ae] = m(null), [ie, A] = m(0), R = ue(() => (A((c) => c + 1), () => A((c) => c - 1)), []), [L, ne] = m(null), oe = he(
83
+ () => ({ stripSlot: _, scroller: L, registerTabs: R }),
84
+ [_, L, R]
85
+ ), z = F(), [D, M] = m(!1), [se, O] = m(!1), u = y(null), n = y(null), V = y(null), {
86
+ ref: ce,
87
+ isTopmost: de,
88
+ zIndex: me,
89
+ elevated: pe
90
+ } = $e({
82
91
  open: r,
83
- onClose: a,
84
- elevated: q === "above-app-overlays",
85
- hostRef: P
92
+ onClose: t,
93
+ elevated: re === "above-app-overlays",
94
+ hostRef: V
86
95
  });
87
- if (ie(() => (r ? (_(!0), n.current && (clearTimeout(n.current), n.current = null), me(p, () => k(!0))) : (k(!1), n.current = setTimeout(() => {
88
- n.current = null, _(!1);
89
- }, x)), () => {
90
- p.current !== null && (cancelAnimationFrame(p.current), p.current = null), n.current && (clearTimeout(n.current), n.current = null);
91
- }), [r]), !Q)
96
+ if (be(() => (r ? (O(!0), n.current && (clearTimeout(n.current), n.current = null), Se(u, () => M(!0))) : (M(!1), n.current = setTimeout(() => {
97
+ n.current = null, O(!1);
98
+ }, h)), () => {
99
+ u.current !== null && (cancelAnimationFrame(u.current), u.current = null), n.current && (clearTimeout(n.current), n.current = null);
100
+ }), [r]), !se)
92
101
  return null;
93
- const A = h == null ? void 0 : h.filter((V) => V.message.trim()), b = `calc(${g(u)} - 2px)`, R = Y ? "border-0 border-b border-solid border-[var(--malachite-card-border)]" : "", ae = t ? /* @__PURE__ */ l(
102
+ const B = g == null ? void 0 : g.filter((c) => c.message.trim()), w = `calc(${S(N)} - 2px)`, W = f ? "border-0 border-b border-solid border-[var(--malachite-card-border)]" : "", xe = a ? /* @__PURE__ */ l(
94
103
  "aside",
95
104
  {
96
- "aria-label": t.title,
105
+ "aria-label": a.title,
97
106
  className: "col-start-1 row-span-3 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid overflow-hidden border-0 border-r border-solid border-[var(--malachite-card-border)]",
98
107
  children: [
99
108
  /* @__PURE__ */ l(
100
109
  "div",
101
110
  {
102
- className: `flex min-w-0 items-center gap-[8px] px-[20px] py-[18px] ${R}`,
111
+ className: `flex min-w-0 items-center gap-[8px] px-[20px] py-[18px] ${W}`,
103
112
  children: [
104
113
  /* @__PURE__ */ e("span", { className: "flex min-w-0 shrink-0", children: /* @__PURE__ */ e(
105
- N,
114
+ T,
106
115
  {
107
- tooltip: t.title,
116
+ tooltip: a.title,
108
117
  tooltipWhenTruncated: !0,
109
118
  tooltipPlacement: "bottom",
110
119
  className: "min-w-0 text-[length:var(--malachite-font-size-15,15px)] font-semibold",
111
- children: t.title
120
+ children: a.title
112
121
  }
113
122
  ) }),
114
- t.headerExtra ? /* @__PURE__ */ e("span", { className: "ml-auto flex shrink-0 items-center", children: t.headerExtra }) : null
123
+ a.headerExtra ? /* @__PURE__ */ e("span", { className: "ml-auto flex shrink-0 items-center", children: a.headerExtra }) : null
115
124
  ]
116
125
  }
117
126
  ),
118
- /* @__PURE__ */ e("div", { className: `flex min-h-0 flex-col ${t.footer ? "" : "row-span-2"}`, children: /* @__PURE__ */ e(U, { bodyPadding: t.bodyPadding ?? !0, children: t.children }) }),
119
- t.footer ? /* @__PURE__ */ e("div", { className: "border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]", children: t.footer }) : null
127
+ /* @__PURE__ */ e("div", { className: `flex min-h-0 flex-col ${a.footer ? "" : "row-span-2"}`, children: /* @__PURE__ */ e(J, { bodyPadding: a.bodyPadding ?? !0, children: a.children }) }),
128
+ a.footer ? /* @__PURE__ */ e("div", { className: "border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]", children: a.footer }) : null
120
129
  ]
121
130
  }
122
- ) : null, L = m === "below" && !!o, z = /* @__PURE__ */ e(
131
+ ) : null, j = b === "below" && !!o, H = /* @__PURE__ */ e(
123
132
  "span",
124
133
  {
125
- className: L ? "flex min-w-0 shrink" : "flex min-w-0 max-w-full shrink-0",
134
+ className: j ? "flex min-w-0 shrink" : "flex min-w-0 max-w-full shrink-0",
126
135
  children: /* @__PURE__ */ e(
127
- N,
136
+ T,
128
137
  {
129
138
  tooltip: i,
130
139
  tooltipWhenTruncated: !0,
@@ -134,8 +143,8 @@ const x = 200, fe = "360px", U = ({
134
143
  }
135
144
  )
136
145
  }
137
- ), D = o ? /* @__PURE__ */ e(
138
- N,
146
+ ), U = o ? /* @__PURE__ */ e(
147
+ T,
139
148
  {
140
149
  tooltip: o,
141
150
  tooltipWhenTruncated: !0,
@@ -144,106 +153,106 @@ const x = 200, fe = "360px", U = ({
144
153
  className: "min-w-0 text-[13px]",
145
154
  children: o
146
155
  }
147
- ) : null, O = c ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: c }) : null, M = y ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-baseline", children: y }) : null;
148
- return ne(
156
+ ) : null, X = p ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: p }) : null, Y = C ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-baseline", children: C }) : null;
157
+ return ve(
149
158
  // Host carries the stacking context — ShadowRootWrapper's `isolation` would
150
159
  // otherwise flatten our z-index and let sticky page elements paint over us.
151
160
  /* @__PURE__ */ e(
152
- oe,
161
+ Ne,
153
162
  {
154
- hostRef: P,
155
- hostStyle: { position: "relative", zIndex: re },
156
- hostProps: le ? { ...H("sidepanel"), [xe]: "" } : H("sidepanel"),
157
- children: /* @__PURE__ */ l("div", { className: "fixed inset-0 z-[1000]", children: [
163
+ hostRef: V,
164
+ hostStyle: { position: "relative", zIndex: me },
165
+ hostProps: pe ? { ...K("sidepanel"), [Ce]: "" } : K("sidepanel"),
166
+ children: /* @__PURE__ */ e(q.Provider, { value: null, children: /* @__PURE__ */ l("div", { className: "fixed inset-0 z-[1000]", children: [
158
167
  /* @__PURE__ */ e(
159
168
  "div",
160
169
  {
161
170
  "aria-hidden": "true",
162
- onClick: a,
163
- className: `absolute inset-0 bg-[var(--malachite-overlay-scrim)] transition-opacity duration-200 ease-in-out ${C ? "opacity-100" : "opacity-0"}`
171
+ onClick: t,
172
+ className: `absolute inset-0 bg-[var(--malachite-overlay-scrim)] transition-opacity duration-200 ease-in-out ${D ? "opacity-100" : "opacity-0"}`
164
173
  }
165
174
  ),
166
175
  /* @__PURE__ */ l(
167
176
  "div",
168
177
  {
169
- ref: Z,
178
+ ref: ce,
170
179
  role: "dialog",
171
- "aria-modal": ee ? "true" : void 0,
180
+ "aria-modal": de ? "true" : void 0,
172
181
  "aria-describedby": [
173
- ...(A ?? []).map((V, te) => `${S}-${te}`),
174
- s ? E : null
182
+ ...(B ?? []).map((c, fe) => `${E}-${fe}`),
183
+ s ? z : null
175
184
  ].filter(Boolean).join(" ") || void 0,
176
185
  tabIndex: -1,
177
- "aria-label": I ? void 0 : F ?? (typeof i == "string" ? i : void 0),
178
- "aria-labelledby": I,
186
+ "aria-label": k ? void 0 : Z ?? (typeof i == "string" ? i : void 0),
187
+ "aria-labelledby": k,
179
188
  className: "absolute top-[8px] right-[8px] bottom-[8px] grid grid-rows-[auto_minmax(0,1fr)_auto] overflow-x-auto overflow-y-hidden rounded-[20px] border border-solid border-[var(--malachite-card-border)] bg-[var(--malachite-card-background)] text-[var(--malachite-card-foreground)] outline-none [box-shadow:var(--malachite-shadow-lg)]",
180
189
  style: {
181
- width: `min(calc(100% - 16px), ${t ? `calc(2 * ${g(u)})` : g(u)})`,
190
+ width: `min(calc(100% - 16px), ${a ? `calc(2 * ${S(N)})` : S(N)})`,
182
191
  // Inline: Tailwind translate utilities silently break inside
183
192
  // shadow roots (see CLAUDE.md Shadow DOM caveats).
184
- transform: C ? "translateX(0)" : "translateX(calc(100% + 16px))",
185
- transition: `transform ${x}ms ease-in-out, width ${x}ms ease-in-out, grid-template-columns ${x}ms ease-in-out`,
193
+ transform: D ? "translateX(0)" : "translateX(calc(100% + 16px))",
194
+ transition: `transform ${h}ms ease-in-out, width ${h}ms ease-in-out, grid-template-columns ${h}ms ease-in-out`,
186
195
  // The panel's own column is the width it has without an aside: `maxWidth`
187
196
  // less the 1px border either side, so opening the aside never widens it.
188
197
  // With an aside neither column gives way, so a narrow window scrolls the
189
198
  // panel instead. Both templates share one shape so the minimums animate
190
199
  // with the width rather than overflowing mid-transition.
191
- gridTemplateColumns: t ? `minmax(${fe}, 1fr) minmax(${b}, ${b})` : `minmax(0px, 1fr) minmax(0px, ${b})`
200
+ gridTemplateColumns: a ? `minmax(${Ie}, 1fr) minmax(${w}, ${w})` : `minmax(0px, 1fr) minmax(0px, ${w})`
192
201
  },
193
202
  children: [
194
- ae,
195
- /* @__PURE__ */ l(he, { onSubmit: $, children: [
203
+ xe,
204
+ /* @__PURE__ */ l(ke, { onSubmit: I, children: [
196
205
  /* @__PURE__ */ l(
197
206
  "div",
198
207
  {
199
- className: `flex flex-col gap-[20px] px-[20px] py-[18px] ${R}`,
208
+ className: `flex flex-col gap-[20px] px-[20px] py-[18px] ${W}`,
200
209
  children: [
201
210
  /* @__PURE__ */ l("div", { className: "flex items-center gap-[12px]", children: [
202
- T ? /* @__PURE__ */ e(
211
+ P ? /* @__PURE__ */ e(
203
212
  "button",
204
213
  {
205
214
  type: "button",
206
215
  "aria-label": "Back",
207
- onClick: T,
208
- className: j,
209
- children: /* @__PURE__ */ e(ce, { size: 16 })
216
+ onClick: P,
217
+ className: G,
218
+ children: /* @__PURE__ */ e(we, { size: 16 })
210
219
  }
211
220
  ) : null,
212
- w ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: w }) : null,
213
- L ? /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-center gap-[12px]", children: [
221
+ $ ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: $ }) : null,
222
+ j ? /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-center gap-[12px]", children: [
214
223
  /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 flex-col gap-[2px]", children: [
215
224
  /* @__PURE__ */ l("div", { className: "flex min-w-0 items-baseline gap-[8px]", children: [
216
- z,
217
- O
225
+ H,
226
+ X
218
227
  ] }),
219
- D
228
+ U
220
229
  ] }),
221
- M
230
+ Y
222
231
  ] }) : /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-baseline gap-[12px]", children: [
223
232
  /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-baseline gap-[8px]", children: [
224
233
  /* @__PURE__ */ l("div", { className: "flex min-w-0 items-baseline gap-[8px]", children: [
225
- z,
226
- D
234
+ H,
235
+ U
227
236
  ] }),
228
- O
237
+ X
229
238
  ] }),
230
- M
239
+ Y
231
240
  ] }),
232
241
  /* @__PURE__ */ e(
233
242
  "button",
234
243
  {
235
244
  type: "button",
236
245
  "aria-label": "Close",
237
- onClick: a,
238
- className: j,
239
- children: /* @__PURE__ */ e(de, { size: 10 })
246
+ onClick: t,
247
+ className: G,
248
+ children: /* @__PURE__ */ e(ye, { size: 10 })
240
249
  }
241
250
  )
242
251
  ] }),
243
252
  s ? /* @__PURE__ */ e(
244
253
  "div",
245
254
  {
246
- id: E,
255
+ id: z,
247
256
  className: "text-[13px] leading-[1.6] text-[var(--malachite-text-secondary)]",
248
257
  children: s
249
258
  }
@@ -251,39 +260,49 @@ const x = 200, fe = "360px", U = ({
251
260
  ]
252
261
  }
253
262
  ),
254
- /* @__PURE__ */ l("div", { className: `flex min-h-0 flex-col ${f ? "" : "row-span-2"}`, children: [
263
+ /* @__PURE__ */ l("div", { className: `flex min-h-0 flex-col ${v ? "" : "row-span-2"}`, children: [
255
264
  d ? /* @__PURE__ */ e(
256
265
  "div",
257
266
  {
258
- className: "shrink-0 px-[16px] pt-[16px] pb-[8px]",
259
- onKeyDown: $ ? ue : void 0,
267
+ className: `shrink-0 pt-[16px] pb-[8px] ${x === "body" ? "px-[28px]" : "px-[16px]"}`,
268
+ onKeyDown: I ? Pe : void 0,
260
269
  children: d
261
270
  }
262
271
  ) : null,
263
272
  /* @__PURE__ */ e(
264
- U,
273
+ "div",
274
+ {
275
+ ref: ae,
276
+ className: "shrink-0 px-[28px] empty:hidden"
277
+ }
278
+ ),
279
+ /* @__PURE__ */ e(
280
+ J,
265
281
  {
266
- bodyPadding: K,
267
- callouts: A,
268
- calloutId: S,
269
- renderLink: G,
270
- children: J
282
+ bodyPadding: ee,
283
+ callouts: B,
284
+ calloutId: E,
285
+ renderLink: le,
286
+ stableGutter: ie > 0,
287
+ scrollerRef: ne,
288
+ children: /* @__PURE__ */ e(q.Provider, { value: oe, children: te })
271
289
  }
272
290
  )
273
291
  ] }),
274
- f ? /* @__PURE__ */ e("div", { className: "border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]", children: f }) : null
292
+ v ? /* @__PURE__ */ e("div", { className: "border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]", children: v }) : null
275
293
  ] })
276
294
  ]
277
295
  }
278
296
  )
279
- ] })
297
+ ] }) })
280
298
  }
281
299
  ),
282
300
  document.body
283
301
  );
284
302
  };
303
+ Ee.Tabs = Te;
285
304
  export {
286
- Ce as SidePanel,
287
- Ce as default
305
+ Ee as SidePanel,
306
+ Ee as default
288
307
  };
289
308
  //# sourceMappingURL=SidePanel.js.map