@stackone/malachite 2.105.0 → 2.106.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,83 +1,106 @@
1
- import { jsxs as l, Fragment as g, jsx as e } from "react/jsx-runtime";
2
- import v from "./CustomIcons/ForwardArrowIcon.js";
3
- import $ from "./Typography/EllipsisText.js";
4
- import m from "./Typography/Text.js";
5
- import { devWarning as N } from "./devWarning.js";
6
- import { FOCUS_RING as y } from "./focusRing.js";
7
- import { isRenderableNode as p } from "./renderableNode.js";
8
- import { safeHref as C } from "./safeHref.js";
9
- const L = {
1
+ import { jsxs as c, Fragment as C, jsx as e } from "react/jsx-runtime";
2
+ import { useId as R, useState as E } from "react";
3
+ import L from "./CustomIcons/ForwardArrowIcon.js";
4
+ import O from "./TruncatedTooltip.js";
5
+ import b from "./Typography/Text.js";
6
+ import { getFontSize as A, getTextColor as F } from "./Typography/textStyles.js";
7
+ import { ROW_HOVER as _ } from "./chromeStyles.js";
8
+ import { devWarning as z } from "./devWarning.js";
9
+ import { FOCUS_RING as W, isFocusVisible as D } from "./focusRing.js";
10
+ import { isRenderableNode as g } from "./renderableNode.js";
11
+ import { safeHref as V } from "./safeHref.js";
12
+ const j = {
10
13
  neutral: "primary",
11
14
  success: "success",
12
15
  warning: "warning",
13
16
  error: "error"
14
- }, s = "flex w-full items-center gap-[12px] rounded-[var(--malachite-radius-10,10px)] border border-solid border-[var(--malachite-card-border,rgb(232,232,232))] bg-[var(--malachite-card-background,rgb(255,255,255))] px-[12px] py-[10px] text-start text-[var(--malachite-text-primary,rgb(10,10,10))] no-underline", h = `cursor-pointer transition-colors hover:border-[var(--malachite-secondary-border-hover,rgb(186,186,186))] hover:bg-[var(--malachite-buttonlist-hover-background,rgb(245,245,245))] ${y}`, O = ({
15
- title: f,
16
- description: t,
17
- tone: x = "neutral",
18
- icon: c,
19
- trailing: d,
20
- actionLabel: u = "Open",
21
- onClick: r,
22
- href: a,
17
+ }, d = "flex w-full items-center gap-[12px] rounded-[var(--malachite-radius-10,10px)] border border-solid border-[var(--malachite-card-border,rgb(232,232,232))] bg-[var(--malachite-card-background,rgb(255,255,255))] px-[12px] py-[10px] text-start text-[var(--malachite-text-primary,rgb(10,10,10))] no-underline", v = `cursor-pointer ${_} hover:border-[var(--malachite-secondary-border-hover,rgb(186,186,186))] ${W}`, k = {
18
+ color: F("secondary"),
19
+ fontSize: A("xsmall")
20
+ }, Z = ({
21
+ title: $,
22
+ description: r,
23
+ tone: w = "neutral",
24
+ icon: m,
25
+ trailing: f,
26
+ actionLabel: N = "Open",
27
+ onClick: a,
28
+ href: n,
23
29
  className: o = ""
24
30
  }) => {
25
- const n = C(a);
26
- a && !n && N(
27
- `LinkCard.href:${a}`,
28
- `LinkCard dropped the unsafe href "${a}"; without an onClick it is a static card.`
31
+ const t = V(n);
32
+ n && !t && z(
33
+ `LinkCard.href:${n}`,
34
+ `LinkCard dropped the unsafe href "${n}"; without an onClick it is a static card.`
29
35
  );
30
- const b = !!(n || r), i = /* @__PURE__ */ l(g, { children: [
31
- p(c) && /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "flex flex-none items-center", children: c }),
32
- /* @__PURE__ */ l("span", { className: "flex min-w-0 flex-1 flex-col gap-[1px] leading-[15px]", children: [
33
- /* @__PURE__ */ e(
34
- m,
36
+ const y = !!(t || a), i = R(), p = `${i}-title`, h = `${i}-description`, x = `${i}-action`, [S, s] = E(!1), T = {
37
+ onFocus: (I) => s(D(I.currentTarget, !1)),
38
+ onPointerDown: () => s(!1),
39
+ onBlur: () => s(!1)
40
+ }, u = {
41
+ "aria-labelledby": `${p} ${x}`,
42
+ "aria-describedby": r ? h : void 0,
43
+ ...T
44
+ }, l = /* @__PURE__ */ c(C, { children: [
45
+ g(m) && /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "flex flex-none items-center", children: m }),
46
+ /* @__PURE__ */ c("span", { className: "flex min-w-0 flex-1 flex-col gap-[1px] leading-[15px]", children: [
47
+ /* @__PURE__ */ e("span", { id: p, className: "flex min-w-0 [overflow-wrap:anywhere]", children: /* @__PURE__ */ e(
48
+ b,
35
49
  {
36
50
  size: "small",
37
51
  fontWeight: "bold",
38
- color: L[x],
39
- className: "leading-[17px]",
40
- children: f
52
+ color: j[w],
53
+ className: "min-w-0 leading-[17px]",
54
+ children: $
41
55
  }
42
- ),
43
- t && /* @__PURE__ */ e(
44
- $,
56
+ ) }),
57
+ r && /* @__PURE__ */ e(
58
+ "span",
45
59
  {
46
- size: "xsmall",
47
- color: "secondary",
48
- tooltip: t,
49
- tooltipWhenTruncated: !0,
50
- inline: !0,
51
- children: t
60
+ id: h,
61
+ className: "flex min-w-0 [overflow-wrap:anywhere]",
62
+ style: k,
63
+ children: S ? r : /* @__PURE__ */ e(
64
+ O,
65
+ {
66
+ text: r,
67
+ delay: 1,
68
+ triggerAs: "span",
69
+ describesTrigger: !1,
70
+ children: r
71
+ }
72
+ )
52
73
  }
53
74
  )
54
75
  ] }),
55
- p(d) && /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "flex flex-none items-center", children: d }),
56
- b && /* @__PURE__ */ l("span", { className: "flex flex-none items-center gap-[3px] text-[var(--malachite-accent-foreground,rgb(2,122,66))]", children: [
57
- /* @__PURE__ */ e(m, { size: "xsmall", fontWeight: "semi-bold", color: "inherit", wrap: !1, children: u }),
58
- /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "flex", children: /* @__PURE__ */ e(v, { size: 12 }) })
76
+ g(f) && /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "flex flex-none items-center", children: f }),
77
+ y && /* @__PURE__ */ c("span", { className: "flex flex-none items-center gap-[3px] text-[var(--malachite-accent-foreground,rgb(2,122,66))]", children: [
78
+ /* @__PURE__ */ e("span", { id: x, className: "flex", children: /* @__PURE__ */ e(b, { size: "xsmall", fontWeight: "semi-bold", color: "inherit", wrap: !1, children: N }) }),
79
+ /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "flex", children: /* @__PURE__ */ e(L, { size: 12 }) })
59
80
  ] })
60
81
  ] });
61
- return n ? /* @__PURE__ */ e(
82
+ return t ? /* @__PURE__ */ e(
62
83
  "a",
63
84
  {
64
- href: n,
65
- onClick: r,
66
- className: `${s} ${h} ${o}`,
67
- children: i
85
+ href: t,
86
+ onClick: a,
87
+ ...u,
88
+ className: `${d} ${v} ${o}`,
89
+ children: l
68
90
  }
69
- ) : r ? /* @__PURE__ */ e(
91
+ ) : a ? /* @__PURE__ */ e(
70
92
  "button",
71
93
  {
72
94
  type: "button",
73
- onClick: r,
74
- className: `m-0 appearance-none font-[inherit] ${s} ${h} ${o}`,
75
- children: i
95
+ onClick: a,
96
+ ...u,
97
+ className: `m-0 appearance-none font-[inherit] ${d} ${v} ${o}`,
98
+ children: l
76
99
  }
77
- ) : /* @__PURE__ */ e("div", { className: `${s} ${o}`, children: i });
100
+ ) : /* @__PURE__ */ e("div", { className: `${d} ${o}`, children: l });
78
101
  };
79
102
  export {
80
- O as LinkCard,
81
- O as default
103
+ Z as LinkCard,
104
+ Z as default
82
105
  };
83
106
  //# sourceMappingURL=LinkCard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LinkCard.js","sources":["../../src/components/LinkCard.tsx"],"sourcesContent":["import type React from 'react';\nimport ForwardArrowIcon from './CustomIcons/ForwardArrowIcon';\nimport EllipsisText from './Typography/EllipsisText';\nimport Text from './Typography/Text';\nimport { devWarning } from './devWarning';\nimport { FOCUS_RING } from './focusRing';\nimport { isRenderableNode } from './renderableNode';\nimport { safeHref } from './safeHref';\n\nexport type LinkCardTone = 'neutral' | 'success' | 'warning' | 'error';\n\nexport interface LinkCardProps {\n title: string;\n /** One line under the title; truncated text shows in full on hover. */\n description?: string;\n /** Colours the title. */\n tone?: LinkCardTone;\n /**\n * Decorative, before the title. Paths are filled with `currentColor`, so colour one through\n * `color`, as `Hexagon` does; a path keeping its own `fill` needs `data-malachite-shape`.\n */\n icon?: React.ReactNode;\n /** Decorative content before the action, e.g. a level scale. Must not be interactive. */\n trailing?: React.ReactNode;\n actionLabel?: string;\n onClick?: (event: React.MouseEvent<HTMLElement>) => void;\n /** Renders a link instead of a button; unsafe schemes are dropped. */\n href?: string;\n className?: string;\n}\n\nconst TITLE_COLOR = {\n neutral: 'primary',\n success: 'success',\n warning: 'warning',\n error: 'error',\n} as const;\n\nconst CARD_CLASSES =\n 'flex w-full items-center gap-[12px] rounded-[var(--malachite-radius-10,10px)] border border-solid border-[var(--malachite-card-border,rgb(232,232,232))] bg-[var(--malachite-card-background,rgb(255,255,255))] px-[12px] py-[10px] text-start text-[var(--malachite-text-primary,rgb(10,10,10))] no-underline';\n\nconst INTERACTIVE_CLASSES = `cursor-pointer transition-colors hover:border-[var(--malachite-secondary-border-hover,rgb(186,186,186))] hover:bg-[var(--malachite-buttonlist-hover-background,rgb(245,245,245))] ${FOCUS_RING}`;\n\n/** A compact card that opens more detail elsewhere, such as another tab of a panel. */\nconst LinkCard: React.FC<LinkCardProps> = ({\n title,\n description,\n tone = 'neutral',\n icon,\n trailing,\n actionLabel = 'Open',\n onClick,\n href: rawHref,\n className = '',\n}) => {\n const href = safeHref(rawHref);\n if (rawHref && !href) {\n devWarning(\n `LinkCard.href:${rawHref}`,\n `LinkCard dropped the unsafe href \"${rawHref}\"; without an onClick it is a static card.`,\n );\n }\n const interactive = Boolean(href || onClick);\n const body = (\n <>\n {isRenderableNode(icon) && (\n <span aria-hidden=\"true\" className=\"flex flex-none items-center\">\n {icon}\n </span>\n )}\n <span className=\"flex min-w-0 flex-1 flex-col gap-[1px] leading-[15px]\">\n <Text\n size=\"small\"\n fontWeight=\"bold\"\n color={TITLE_COLOR[tone]}\n className=\"leading-[17px]\"\n >\n {title}\n </Text>\n {description && (\n <EllipsisText\n size=\"xsmall\"\n color=\"secondary\"\n tooltip={description}\n tooltipWhenTruncated\n inline\n >\n {description}\n </EllipsisText>\n )}\n </span>\n {isRenderableNode(trailing) && (\n <span aria-hidden=\"true\" className=\"flex flex-none items-center\">\n {trailing}\n </span>\n )}\n {interactive && (\n <span className=\"flex flex-none items-center gap-[3px] text-[var(--malachite-accent-foreground,rgb(2,122,66))]\">\n <Text size=\"xsmall\" fontWeight=\"semi-bold\" color=\"inherit\" wrap={false}>\n {actionLabel}\n </Text>\n <span aria-hidden=\"true\" className=\"flex\">\n <ForwardArrowIcon size={12} />\n </span>\n </span>\n )}\n </>\n );\n if (href) {\n return (\n <a\n href={href}\n onClick={onClick}\n className={`${CARD_CLASSES} ${INTERACTIVE_CLASSES} ${className}`}\n >\n {body}\n </a>\n );\n }\n if (onClick) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={`m-0 appearance-none font-[inherit] ${CARD_CLASSES} ${INTERACTIVE_CLASSES} ${className}`}\n >\n {body}\n </button>\n );\n }\n return <div className={`${CARD_CLASSES} ${className}`}>{body}</div>;\n};\n\nexport default LinkCard;\nexport { LinkCard };\n"],"names":["TITLE_COLOR","CARD_CLASSES","INTERACTIVE_CLASSES","FOCUS_RING","LinkCard","title","description","tone","icon","trailing","actionLabel","onClick","rawHref","className","href","safeHref","devWarning","interactive","body","jsxs","Fragment","isRenderableNode","jsx","Text","EllipsisText","ForwardArrowIcon"],"mappings":";;;;;;;;AA+BA,MAAMA,IAAc;AAAA,EAChB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACX,GAEMC,IACF,kTAEEC,IAAsB,qLAAqLC,CAAU,IAGrNC,IAAoC,CAAC;AAAA,EACvC,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,SAAAC;AAAA,EACA,MAAMC;AAAA,EACN,WAAAC,IAAY;AAChB,MAAM;AACF,QAAMC,IAAOC,EAASH,CAAO;AAC7B,EAAIA,KAAW,CAACE,KACZE;AAAA,IACI,iBAAiBJ,CAAO;AAAA,IACxB,qCAAqCA,CAAO;AAAA,E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IAAA;AAAA,EAAA,IAITP,IAEI,gBAAAW;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,MAAK;AAAA,MACL,SAAAX;AAAA,MACA,WAAW,sCAAsCV,CAAY,IAAIC,CAAmB,IAAIW,CAAS;AAAA,MAEhG,UAAAK;AAAA,IAAA;AAAA,EAAA,IAIN,gBAAAI,EAAC,SAAI,WAAW,GAAGrB,CAAY,IAAIY,CAAS,IAAK,UAAAK,EAAA,CAAK;AACjE;"}
1
+ {"version":3,"file":"LinkCard.js","sources":["../../src/components/LinkCard.tsx"],"sourcesContent":["import type React from 'react';\nimport { useId, useState } from 'react';\nimport ForwardArrowIcon from './CustomIcons/ForwardArrowIcon';\nimport TruncatedTooltip from './TruncatedTooltip';\nimport Text from './Typography/Text';\nimport { getFontSize, getTextColor } from './Typography/textStyles';\nimport { ROW_HOVER } from './chromeStyles';\nimport { devWarning } from './devWarning';\nimport { FOCUS_RING, isFocusVisible } from './focusRing';\nimport { isRenderableNode } from './renderableNode';\nimport { safeHref } from './safeHref';\n\nexport type LinkCardTone = 'neutral' | 'success' | 'warning' | 'error';\n\nexport interface LinkCardProps {\n title: string;\n /** One line under the title; shown in full on hover, or when a clickable card takes keyboard focus. */\n description?: string;\n /** Colours the title. */\n tone?: LinkCardTone;\n /**\n * Decorative, before the title. Paths are filled with `currentColor`, so colour one through\n * `color`, as `Hexagon` does; a path keeping its own `fill` needs `data-malachite-shape`.\n */\n icon?: React.ReactNode;\n /** Decorative content before the action, e.g. a level scale. Must not be interactive. */\n trailing?: React.ReactNode;\n actionLabel?: string;\n onClick?: (event: React.MouseEvent<HTMLElement>) => void;\n /** Renders a link instead of a button; unsafe schemes are dropped. */\n href?: string;\n className?: string;\n}\n\nconst TITLE_COLOR = {\n neutral: 'primary',\n success: 'success',\n warning: 'warning',\n error: 'error',\n} as const;\n\nconst CARD_CLASSES =\n 'flex w-full items-center gap-[12px] rounded-[var(--malachite-radius-10,10px)] border border-solid border-[var(--malachite-card-border,rgb(232,232,232))] bg-[var(--malachite-card-background,rgb(255,255,255))] px-[12px] py-[10px] text-start text-[var(--malachite-text-primary,rgb(10,10,10))] no-underline';\n\nconst INTERACTIVE_CLASSES = `cursor-pointer ${ROW_HOVER} hover:border-[var(--malachite-secondary-border-hover,rgb(186,186,186))] ${FOCUS_RING}`;\n\nconst DESCRIPTION_STYLE: React.CSSProperties = {\n color: getTextColor('secondary'),\n fontSize: getFontSize('xsmall'),\n};\n\n/** A compact card that opens more detail elsewhere, such as another tab of a panel. */\nconst LinkCard: React.FC<LinkCardProps> = ({\n title,\n description,\n tone = 'neutral',\n icon,\n trailing,\n actionLabel = 'Open',\n onClick,\n href: rawHref,\n className = '',\n}) => {\n const href = safeHref(rawHref);\n if (rawHref && !href) {\n devWarning(\n `LinkCard.href:${rawHref}`,\n `LinkCard dropped the unsafe href \"${rawHref}\"; without an onClick it is a static card.`,\n );\n }\n const interactive = Boolean(href || onClick);\n const id = useId();\n const titleId = `${id}-title`;\n const descriptionId = `${id}-description`;\n const actionId = `${id}-action`;\n const [revealed, setRevealed] = useState(false);\n const reveal = {\n onFocus: (event: React.FocusEvent<HTMLElement>) =>\n setRevealed(isFocusVisible(event.currentTarget, false)),\n onPointerDown: () => setRevealed(false),\n onBlur: () => setRevealed(false),\n };\n const labelling = {\n 'aria-labelledby': `${titleId} ${actionId}`,\n 'aria-describedby': description ? descriptionId : undefined,\n ...reveal,\n };\n const body = (\n <>\n {isRenderableNode(icon) && (\n <span aria-hidden=\"true\" className=\"flex flex-none items-center\">\n {icon}\n </span>\n )}\n <span className=\"flex min-w-0 flex-1 flex-col gap-[1px] leading-[15px]\">\n <span id={titleId} className=\"flex min-w-0 [overflow-wrap:anywhere]\">\n <Text\n size=\"small\"\n fontWeight=\"bold\"\n color={TITLE_COLOR[tone]}\n className=\"min-w-0 leading-[17px]\"\n >\n {title}\n </Text>\n </span>\n {description && (\n <span\n id={descriptionId}\n className=\"flex min-w-0 [overflow-wrap:anywhere]\"\n style={DESCRIPTION_STYLE}\n >\n {revealed ? (\n description\n ) : (\n <TruncatedTooltip\n text={description}\n delay={1}\n triggerAs=\"span\"\n describesTrigger={false}\n >\n {description}\n </TruncatedTooltip>\n )}\n </span>\n )}\n </span>\n {isRenderableNode(trailing) && (\n <span aria-hidden=\"true\" className=\"flex flex-none items-center\">\n {trailing}\n </span>\n )}\n {interactive && (\n <span className=\"flex flex-none items-center gap-[3px] text-[var(--malachite-accent-foreground,rgb(2,122,66))]\">\n <span id={actionId} className=\"flex\">\n <Text size=\"xsmall\" fontWeight=\"semi-bold\" color=\"inherit\" wrap={false}>\n {actionLabel}\n </Text>\n </span>\n <span aria-hidden=\"true\" className=\"flex\">\n <ForwardArrowIcon size={12} />\n </span>\n </span>\n )}\n </>\n );\n if (href) {\n return (\n <a\n href={href}\n onClick={onClick}\n {...labelling}\n className={`${CARD_CLASSES} ${INTERACTIVE_CLASSES} ${className}`}\n >\n {body}\n </a>\n );\n }\n if (onClick) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n {...labelling}\n className={`m-0 appearance-none font-[inherit] ${CARD_CLASSES} ${INTERACTIVE_CLASSES} ${className}`}\n >\n {body}\n </button>\n );\n }\n return <div className={`${CARD_CLASSES} ${className}`}>{body}</div>;\n};\n\nexport default LinkCard;\nexport { LinkCard };\n"],"names":["TITLE_COLOR","CARD_CLASSES","INTERACTIVE_CLASSES","ROW_HOVER","FOCUS_RING","DESCRIPTION_STYLE","getTextColor","getFontSize","LinkCard","title","description","tone","icon","trailing","actionLabel","onClick","rawHref","className","href","safeHref","devWarning","interactive","id","useId","titleId","descriptionId","actionId","revealed","setRevealed","useState","reveal","event","isFocusVisible","labelling","body","jsxs","Fragment","isRenderableNode","jsx","Text","TruncatedTooltip","ForwardArrowIcon"],"mappings":";;;;;;;;;;;AAkCA,MAAMA,IAAc;AAAA,EAChB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACX,GAEMC,IACF,kTAEEC,IAAsB,kBAA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A,MACL,SAAAvB;AAAA,MACC,GAAGkB;AAAA,MACJ,WAAW,sCAAsChC,CAAY,IAAIC,CAAmB,IAAIe,CAAS;AAAA,MAEhG,UAAAiB;AAAA,IAAA;AAAA,EAAA,IAIN,gBAAAI,EAAC,SAAI,WAAW,GAAGrC,CAAY,IAAIgB,CAAS,IAAK,UAAAiB,EAAA,CAAK;AACjE;"}
@@ -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","jsxs","element","FOCUS_RING"],"mappings":";;;;AAoCA,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,WAAAC,IAAY;AAChB,MAAgC;AAC5B,QAAMC,IAAWC,EAAqC,EAAE,GAClDC,IAAYd,EAAaM,CAAI,GAE7BS,IAAgBZ,EAAQ,UAAU,CAACa,MAAWA,EAAO,UAAUZ,CAAK,GACpEa,IAAUd,EAAQ,IAAI,CAACa,MAAW,CAACA,EAAO,QAAQ,GAIlDE,IAAeC,EAAcJ,GAAeE,CAAO;AAqBzD,SACI,gBAAAG;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,MAAK;AAAA,MACL,cAAYX;AAAA,MACZ,mBAAiBC;AAAA,MACjB,iBAAeF,KAAY;AAAA,MAC3B,WAxBc,CAACa,MAA+B;;AAClD,YAAIb;AACA;AAEJ,cAAMc,IAAUV,EAAS,QAAQ,UAAU,CAACW,MAASA,MAASF,EAAM,MAAM,GACpEG,IAAOC,EAAgBJ,GAAOC,KAAW,IAAIA,IAAUJ,GAAcD,CAAO;AAClF,QAAIO,MAA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ACA;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
+ {"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,UAAA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AIJ,gBAAAC;AAAA,UAAC;AAAA,UAAA;AAAA,YAEG,KAAK,CAACC,MAAY;AACd,cAAArB,EAAS,QAAQe,CAAK,IAAIM;AAAA,YAC9B;AAAA,YACA,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,13 +1,14 @@
1
1
  import { jsx as o, jsxs as E } from "react/jsx-runtime";
2
- import me, { useRef as D, useEffect as he } from "react";
2
+ import be, { useRef as D, useEffect as he } from "react";
3
3
  import { DisclosureArrow as ge } from "./DisclosureArrow.js";
4
4
  import { paintOnChild as xe } from "./asChild.js";
5
- import { FOCUS_RING_INSET as ee, FOCUS_RING_INSET_OVERLAY_HIDDEN as ve } from "./focusRing.js";
5
+ import { ROW_HOVER as ee } from "./chromeStyles.js";
6
+ import { FOCUS_RING_INSET as re, FOCUS_RING_INSET_OVERLAY_HIDDEN as ve } from "./focusRing.js";
6
7
  import { resolveRel as M } from "./linkRel.js";
7
8
  import { isRenderableNode as Q } from "./renderableNode.js";
8
9
  import { safeHref as Ee } from "./safeHref.js";
9
- import { FOREGROUND_RESET as we, SELECTED_TEXT_CONTEXT as Ce, SELECTED_ROW_ACCENT as Ne, SELECTED_ROW_FOREGROUND as Se, SELECTED_ROW_BACKGROUND as Z } from "./selectedRow.js";
10
- const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-background)]", Re = {
10
+ import { FOREGROUND_RESET as we, SELECTED_TEXT_CONTEXT as Ce, SELECTED_ROW_ACCENT as Ne, SELECTED_ROW_FOREGROUND as Re, SELECTED_ROW_BACKGROUND as Z } from "./selectedRow.js";
11
+ const Se = {
11
12
  none: "",
12
13
  // The 16px is ROW_INSET_PX in accordionBodyInset.ts too; Accordion's bodyIndent gives it back.
13
14
  compact: "px-[16px] py-[8px]"
@@ -38,19 +39,19 @@ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-backgro
38
39
  selection: d,
39
40
  tone: u = "default",
40
41
  inset: w = "none",
41
- className: m = "",
42
+ className: b = "",
42
43
  style: f
43
44
  } = r, c = r.asChild === !0, {
44
45
  onClick: i,
45
46
  href: y,
46
- target: S,
47
+ target: R,
47
48
  rel: I,
48
49
  trailing: P,
49
50
  revealTrailing: B,
50
51
  leading: _,
51
52
  dimmed: F,
52
- role: b
53
- } = c ? {} : r, h = Ee(y), U = c ? void 0 : r["aria-label"], j = c ? void 0 : r["aria-labelledby"], oe = c ? void 0 : r.tabIndex, G = !!(i || h), ne = e && (G || c) ? "" : s ? re : "", ie = u !== "default", le = ye[u], W = !c && Q(P), k = Re[w], ce = k ? "" : "p-0", H = [
53
+ role: p
54
+ } = c ? {} : r, h = Ee(y), U = c ? void 0 : r["aria-label"], j = c ? void 0 : r["aria-labelledby"], oe = c ? void 0 : r.tabIndex, G = !!(i || h), ne = e && (G || c) ? "" : s ? ee : "", ie = u !== "default", le = ye[u], W = !c && Q(P), k = Se[w], ce = k ? "" : "p-0", H = [
54
55
  "w-full text-left border-0",
55
56
  le,
56
57
  a ? "border-b border-solid border-[var(--malachite-card-border)]" : "",
@@ -59,14 +60,14 @@ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-backgro
59
60
  "appearance-none",
60
61
  ie ? "" : "bg-transparent",
61
62
  e ? "" : "cursor-pointer"
62
- ], V = (t) => [H, ...t, k, m].filter(Boolean).join(" "), se = d ? d !== "announce" : b !== "checkbox", de = d !== "tint", p = W && !!i && !h && !e, z = D(null), K = D(null), g = D(!1), ue = (t) => {
63
+ ], V = (t) => [H, ...t, k, b].filter(Boolean).join(" "), se = d ? d !== "announce" : p !== "checkbox", de = d !== "tint", m = W && !!i && !h && !e, z = D(null), K = D(null), g = D(!1), ue = (t) => {
63
64
  g.current = t.target !== t.currentTarget;
64
65
  }, fe = (t) => {
65
66
  g.current || (g.current = t.target !== t.currentTarget);
66
67
  };
67
68
  he(() => {
68
69
  const t = z.current;
69
- if (!p || !t)
70
+ if (!m || !t)
70
71
  return;
71
72
  const N = (v) => {
72
73
  const L = g.current;
@@ -75,34 +76,34 @@ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-backgro
75
76
  !$ || v.target !== t || L || v.detail <= 1 && !v.shiftKey && Oe(t) || (v.stopPropagation(), $.focus({ preventScroll: !0 }), $.dispatchEvent(Te(v)));
76
77
  };
77
78
  return t.addEventListener("click", N), () => t.removeEventListener("click", N);
78
- }, [p]);
79
- const be = l === !0 && se ? {
79
+ }, [m]);
80
+ const pe = l === !0 && se ? {
80
81
  backgroundImage: `linear-gradient(${Z}, ${Z})`,
81
- color: Se,
82
+ color: Re,
82
83
  ...de ? { boxShadow: `inset 2px 0 0 ${Ne}` } : {},
83
84
  ...Ce
84
85
  } : {}, O = _e[u], C = { ...O ? {
85
86
  color: O,
86
87
  "--malachite-ctx-text-primary": O
87
- } : {}, ...be, ...f }, T = b === "checkbox" && l === "mixed" ? "mixed" : b === "radio" || b === "checkbox" ? l === !0 : void 0, Y = T === void 0 && l === !0 ? !0 : void 0, q = {
88
- role: b,
88
+ } : {}, ...pe, ...f }, T = p === "checkbox" && l === "mixed" ? "mixed" : p === "radio" || p === "checkbox" ? l === !0 : void 0, Y = T === void 0 && l === !0 ? !0 : void 0, q = {
89
+ role: p,
89
90
  "aria-checked": T,
90
91
  "aria-current": Y,
91
92
  "aria-label": U,
92
93
  "aria-labelledby": j,
93
- "aria-disabled": b && e ? !0 : void 0
94
+ "aria-disabled": p && e ? !0 : void 0
94
95
  };
95
96
  if (c)
96
97
  return xe(n, V([]), C);
97
- const R = {
98
- role: b,
98
+ const S = {
99
+ role: p,
99
100
  tabIndex: oe,
100
101
  "aria-checked": T,
101
102
  "aria-current": Y,
102
103
  "aria-label": U,
103
104
  "aria-labelledby": j
104
- }, pe = Q(_), J = _ !== void 0 || F !== void 0, x = J ? /* @__PURE__ */ E("span", { className: "flex w-full min-w-0 items-center gap-[12px]", children: [
105
- pe && /* @__PURE__ */ o("span", { className: "shrink-0 flex items-center", children: _ }),
105
+ }, me = Q(_), J = _ !== void 0 || F !== void 0, x = J ? /* @__PURE__ */ E("span", { className: "flex w-full min-w-0 items-center gap-[12px]", children: [
106
+ me && /* @__PURE__ */ o("span", { className: "shrink-0 flex items-center", children: _ }),
106
107
  /* @__PURE__ */ o(
107
108
  "span",
108
109
  {
@@ -126,12 +127,12 @@ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-backgro
126
127
  "a",
127
128
  {
128
129
  href: h,
129
- target: S,
130
- rel: M(I, S),
130
+ target: R,
131
+ rel: M(I, R),
131
132
  onClick: i,
132
133
  className: `${N} no-underline text-inherit`,
133
134
  "data-malachite-row-control": "",
134
- ...R,
135
+ ...S,
135
136
  children: [
136
137
  x,
137
138
  t
@@ -146,7 +147,7 @@ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-backgro
146
147
  disabled: e,
147
148
  className: N,
148
149
  "data-malachite-row-control": "",
149
- ...R,
150
+ ...S,
150
151
  children: [
151
152
  x,
152
153
  t
@@ -159,24 +160,24 @@ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-backgro
159
160
  className: [
160
161
  H,
161
162
  "relative flex items-center",
162
- p ? "cursor-pointer" : "",
163
+ m ? "cursor-pointer" : "",
163
164
  k,
164
165
  B ? "group/row" : "",
165
- m
166
+ b
166
167
  ].filter(Boolean).join(" "),
167
168
  style: C,
168
169
  "data-malachite-row": "",
169
170
  "data-disabled": e ? "" : void 0,
170
171
  ref: z,
171
- role: p ? "presentation" : void 0,
172
- onPointerDownCapture: p ? ue : void 0,
173
- onPointerUpCapture: p ? fe : void 0,
172
+ role: m ? "presentation" : void 0,
173
+ onPointerDownCapture: m ? ue : void 0,
174
+ onPointerUpCapture: m ? fe : void 0,
174
175
  children: [
175
176
  L,
176
177
  /* @__PURE__ */ o(
177
178
  "div",
178
179
  {
179
- className: `shrink-0 flex items-center ${p ? "cursor-default" : ""} ${B ? ke : ""}`,
180
+ className: `shrink-0 flex items-center ${m ? "cursor-default" : ""} ${B ? ke : ""}`,
180
181
  "data-malachite-row-slot": "",
181
182
  children: P
182
183
  }
@@ -186,18 +187,18 @@ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-backgro
186
187
  );
187
188
  }
188
189
  const A = V(
189
- G ? [...X, ce, ee] : []
190
+ G ? [...X, ce, re] : []
190
191
  );
191
192
  return h && !e ? /* @__PURE__ */ o(
192
193
  "a",
193
194
  {
194
195
  href: h,
195
- target: S,
196
- rel: M(I, S),
196
+ target: R,
197
+ rel: M(I, R),
197
198
  onClick: i,
198
199
  className: `${A} no-underline text-inherit ${J ? "block" : ""}`,
199
200
  style: C,
200
- ...R,
201
+ ...S,
201
202
  children: x
202
203
  }
203
204
  ) : i ? /* @__PURE__ */ o(
@@ -208,11 +209,11 @@ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-backgro
208
209
  disabled: e,
209
210
  className: A,
210
211
  style: C,
211
- ...R,
212
+ ...S,
212
213
  children: x
213
214
  }
214
215
  ) : /* @__PURE__ */ o("div", { className: A, style: C, ...q, children: x });
215
- }, Le = ({ children: r, className: n = "", style: a }) => /* @__PURE__ */ o("div", { className: n, style: a, onClick: (e) => e.stopPropagation(), children: r }), ze = 39, $e = Object.assign(
216
+ }, Le = ({ children: r, className: n = "", style: a }) => /* @__PURE__ */ o("div", { className: n, style: a, onClick: (e) => e.stopPropagation(), children: r }), Ke = 39, $e = Object.assign(
216
217
  ({
217
218
  header: r,
218
219
  children: n,
@@ -223,10 +224,10 @@ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-backgro
223
224
  divider: d = !1,
224
225
  tone: u = "default",
225
226
  "aria-label": w,
226
- className: m = "",
227
+ className: b = "",
227
228
  style: f
228
229
  }) => {
229
- const c = me.useId(), i = e ? () => e(!a) : void 0;
230
+ const c = be.useId(), i = e ? () => e(!a) : void 0;
230
231
  return (
231
232
  // The hover is the header's, not the row's: the row holds the open body too, which is
232
233
  // not a target, and tinting it washes out everything in it.
@@ -236,13 +237,13 @@ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-backgro
236
237
  divider: d,
237
238
  tone: u,
238
239
  hover: !1,
239
- className: m,
240
+ className: b,
240
241
  style: f,
241
242
  children: [
242
243
  /* @__PURE__ */ E(
243
244
  "div",
244
245
  {
245
- className: `group flex items-center w-full ${re} ${i ? "cursor-pointer" : ""} ${s && a ? "sticky z-[1] bg-[var(--malachite-card-background)]" : ""}`,
246
+ className: `group flex items-center w-full ${ee} ${i ? "cursor-pointer" : ""} ${s && a ? "sticky z-[1] bg-[var(--malachite-card-background)]" : ""}`,
246
247
  style: s && a ? { top: l } : void 0,
247
248
  onClick: i,
248
249
  role: "presentation",
@@ -251,7 +252,7 @@ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-backgro
251
252
  "button",
252
253
  {
253
254
  type: "button",
254
- className: `appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${ee}`,
255
+ className: `appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${re}`,
255
256
  "aria-expanded": a,
256
257
  "aria-controls": c,
257
258
  "aria-label": w,
@@ -285,7 +286,7 @@ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-backgro
285
286
  "aria-label": d,
286
287
  "aria-labelledby": u,
287
288
  className: w = "",
288
- style: m
289
+ style: b
289
290
  }) => {
290
291
  const f = a === "clip" && !s && e === "default";
291
292
  return /* @__PURE__ */ o(
@@ -296,7 +297,7 @@ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-backgro
296
297
  ...s ? { boxShadow: Ae } : {},
297
298
  ...f ? { clipPath: "inset(0 round var(--malachite-radius-xxl, 14px))" } : {},
298
299
  ...we,
299
- ...m
300
+ ...b
300
301
  },
301
302
  role: l,
302
303
  "aria-label": d,
@@ -308,7 +309,7 @@ const re = "transition-colors hover:bg-[var(--malachite-buttonlist-hover-backgro
308
309
  ae.Row = te;
309
310
  ae.ExpandableRow = $e;
310
311
  export {
311
- ze as EXPANDABLE_ROW_LEAD_PX,
312
+ Ke as EXPANDABLE_ROW_LEAD_PX,
312
313
  ae as Surface,
313
314
  $e as SurfaceExpandableRow,
314
315
  te as SurfaceRow,