@stackone/malachite 2.124.0 → 2.126.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,66 +1,82 @@
1
- import { jsx as e, jsxs as p } from "react/jsx-runtime";
2
- import x from "./Typography/EllipsisText.js";
1
+ import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
+ import b from "./Typography/EllipsisText.js";
3
3
  import f from "./Typography/Text.js";
4
- import { textOf as b } from "./childrenText.js";
5
- import { isRenderableNode as t } from "./renderableNode.js";
6
- const h = 0.2, v = ({
7
- label: o,
8
- className: s = "",
9
- children: l,
10
- truncate: a = !1,
11
- tooltip: r,
12
- prefix: i,
13
- suffix: n
4
+ import { textOf as h } from "./childrenText.js";
5
+ import { isRenderableNode as m } from "./renderableNode.js";
6
+ const g = {
7
+ neutral: "bg-[var(--malachite-text-dimmed,rgb(161,161,161))]",
8
+ success: "bg-[var(--malachite-text-success,rgb(2,122,66))]",
9
+ warning: "bg-[var(--malachite-text-warning,rgb(150,88,10))]",
10
+ error: "bg-[var(--malachite-text-error,rgb(237,53,54))]"
11
+ }, u = 0.2, v = ({
12
+ label: s,
13
+ tone: a,
14
+ className: t = "",
15
+ children: r,
16
+ truncate: l = !1,
17
+ tooltip: i,
18
+ prefix: n,
19
+ suffix: c
14
20
  }) => {
15
- const m = r !== void 0, d = t(r) ? r : null, c = b(l);
16
- return /* @__PURE__ */ p(
21
+ const d = i !== void 0, x = m(i) ? i : null, p = h(r);
22
+ return /* @__PURE__ */ o(
17
23
  "div",
18
24
  {
19
- className: `flex min-w-0 flex-1 basis-0 flex-col gap-[3px] border-0 border-s border-solid border-[var(--malachite-card-border,#e8e8e8)] px-[18px] first:border-s-0 ${s}`,
25
+ className: `flex min-w-0 flex-1 basis-0 flex-col gap-[3px] border-0 border-s border-solid border-[var(--malachite-card-border,#e8e8e8)] px-[18px] first:border-s-0 ${t}`,
20
26
  children: [
21
- /* @__PURE__ */ e("dt", { className: "m-0 min-w-0 break-words", children: /* @__PURE__ */ e(f, { size: "xsmall", color: "secondary", children: o }) }),
22
- /* @__PURE__ */ p("dd", { className: "m-0 flex min-w-0 items-center text-[length:var(--malachite-font-size-small,13px)] leading-[1.5] font-medium text-[var(--malachite-text-primary,#0a0a0a)] [overflow-wrap:anywhere]", children: [
23
- t(i) && /* @__PURE__ */ e("span", { className: "me-[8px] flex shrink-0 items-center", children: i }),
24
- a ? /* @__PURE__ */ e(
25
- x,
27
+ /* @__PURE__ */ o("dt", { className: `m-0 min-w-0 break-words ${a ? "flex items-start gap-[6px]" : ""}`, children: [
28
+ a && /* @__PURE__ */ e(
29
+ "span",
30
+ {
31
+ "aria-hidden": "true",
32
+ "data-tone": a,
33
+ className: `mt-[6px] h-[6px] w-[6px] shrink-0 rounded-full ${g[a]}`
34
+ }
35
+ ),
36
+ /* @__PURE__ */ e(f, { size: "xsmall", color: "secondary", className: "min-w-0", children: s })
37
+ ] }),
38
+ /* @__PURE__ */ o("dd", { className: "m-0 flex min-w-0 items-center text-[length:var(--malachite-font-size-small,13px)] leading-[1.5] font-medium text-[var(--malachite-text-primary,#0a0a0a)] [overflow-wrap:anywhere]", children: [
39
+ m(n) && /* @__PURE__ */ e("span", { className: "me-[8px] flex shrink-0 items-center", children: n }),
40
+ l ? /* @__PURE__ */ e(
41
+ b,
26
42
  {
27
43
  color: "inherit",
28
- tooltip: m ? d : c,
29
- tooltipWhenTruncated: !m,
30
- tooltipDelay: h,
31
- focusableTrigger: d !== null && !!c,
32
- children: l
44
+ tooltip: d ? x : p,
45
+ tooltipWhenTruncated: !d,
46
+ tooltipDelay: u,
47
+ focusableTrigger: x !== null && !!p,
48
+ children: r
33
49
  }
34
- ) : /* @__PURE__ */ e("span", { className: "min-w-0", children: l }),
35
- t(n) && /* @__PURE__ */ e("span", { className: "ms-[4px] flex shrink-0 items-center", children: n })
50
+ ) : /* @__PURE__ */ e("span", { className: "min-w-0", children: r }),
51
+ m(c) && /* @__PURE__ */ e("span", { className: "ms-[4px] flex shrink-0 items-center", children: c })
36
52
  ] })
37
53
  ]
38
54
  }
39
55
  );
40
- }, u = ({
41
- className: o = "",
42
- children: s,
43
- "aria-label": l,
44
- "aria-labelledby": a
56
+ }, w = ({
57
+ className: s = "",
58
+ children: a,
59
+ "aria-label": t,
60
+ "aria-labelledby": r
45
61
  }) => {
46
- const r = !!(l || a);
62
+ const l = !!(t || r);
47
63
  return (
48
64
  // A role on the dl would drop its term/definition semantics.
49
65
  /* @__PURE__ */ e(
50
66
  "div",
51
67
  {
52
- role: r ? "group" : void 0,
53
- "aria-label": r && l || void 0,
54
- "aria-labelledby": r && a || void 0,
55
- className: `w-full ${o}`,
56
- children: /* @__PURE__ */ e("dl", { className: "m-0 flex w-full rounded-[10px] bg-[var(--malachite-table-background,#f7f7f7)] py-[11px]", children: s })
68
+ role: l ? "group" : void 0,
69
+ "aria-label": l && t || void 0,
70
+ "aria-labelledby": l && r || void 0,
71
+ className: `w-full ${s}`,
72
+ children: /* @__PURE__ */ e("dl", { className: "m-0 flex w-full rounded-[10px] bg-[var(--malachite-table-background,#f7f7f7)] py-[11px]", children: a })
57
73
  }
58
74
  )
59
75
  );
60
76
  };
61
- u.Item = v;
77
+ w.Item = v;
62
78
  export {
63
- u as KeyValueStrip,
64
- u as default
79
+ w as KeyValueStrip,
80
+ w as default
65
81
  };
66
82
  //# sourceMappingURL=KeyValueStrip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"KeyValueStrip.js","sources":["../../src/components/KeyValueStrip.tsx"],"sourcesContent":["import type React from 'react';\nimport EllipsisText from './Typography/EllipsisText';\nimport Text from './Typography/Text';\nimport { textOf } from './childrenText';\nimport { isRenderableNode } from './renderableNode';\n\nexport interface KeyValueStripProps {\n className?: string;\n children: React.ReactNode;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\nexport interface KeyValueStripItemProps {\n label: React.ReactNode;\n className?: string;\n children: React.ReactNode;\n /** One line with an ellipsis. Block/flex children clip without one, so use their own truncate. */\n truncate?: boolean;\n /**\n * Needs `truncate`. By default a text value shows in full when cut off; a given tooltip always\n * shows and makes a text value a tab stop. `null` turns it off.\n */\n tooltip?: React.ReactNode;\n /** Before the value, never truncated, e.g. an icon. */\n prefix?: React.ReactNode;\n /** After the value, never truncated, e.g. a copy button. */\n suffix?: React.ReactNode;\n}\n\n// Faster than Tooltip's 1s: a strip is read by hovering along it.\nconst TOOLTIP_DELAY_S = 0.2;\n\nconst Item: React.FC<KeyValueStripItemProps> = ({\n label,\n className = '',\n children,\n truncate = false,\n tooltip,\n prefix,\n suffix,\n}) => {\n const ownTooltip = tooltip !== undefined;\n const given = isRenderableNode(tooltip) ? tooltip : null;\n const text = textOf(children);\n return (\n <div\n className={`flex min-w-0 flex-1 basis-0 flex-col gap-[3px] border-0 border-s border-solid border-[var(--malachite-card-border,#e8e8e8)] px-[18px] first:border-s-0 ${className}`}\n >\n <dt className=\"m-0 min-w-0 break-words\">\n <Text size=\"xsmall\" color=\"secondary\">\n {label}\n </Text>\n </dt>\n <dd className=\"m-0 flex min-w-0 items-center text-[length:var(--malachite-font-size-small,13px)] leading-[1.5] font-medium text-[var(--malachite-text-primary,#0a0a0a)] [overflow-wrap:anywhere]\">\n {isRenderableNode(prefix) && (\n <span className=\"me-[8px] flex shrink-0 items-center\">{prefix}</span>\n )}\n {truncate ? (\n <EllipsisText\n color=\"inherit\"\n tooltip={ownTooltip ? given : text}\n tooltipWhenTruncated={!ownTooltip}\n tooltipDelay={TOOLTIP_DELAY_S}\n focusableTrigger={given !== null && !!text}\n >\n {children}\n </EllipsisText>\n ) : (\n <span className=\"min-w-0\">{children}</span>\n )}\n {isRenderableNode(suffix) && (\n <span className=\"ms-[4px] flex shrink-0 items-center\">{suffix}</span>\n )}\n </dd>\n </div>\n );\n};\n\n/**\n * Label/value cells in one sunken band, e.g. the facts under a side panel header. Not for table\n * rows: a given tooltip mounts up front.\n */\nconst KeyValueStrip: React.FC<KeyValueStripProps> & { Item: typeof Item } = ({\n className = '',\n children,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n}) => {\n const named = !!(ariaLabel || ariaLabelledBy);\n return (\n // A role on the dl would drop its term/definition semantics.\n <div\n role={named ? 'group' : undefined}\n aria-label={named ? ariaLabel || undefined : undefined}\n aria-labelledby={named ? ariaLabelledBy || undefined : undefined}\n className={`w-full ${className}`}\n >\n <dl className=\"m-0 flex w-full rounded-[10px] bg-[var(--malachite-table-background,#f7f7f7)] py-[11px]\">\n {children}\n </dl>\n </div>\n );\n};\n\nKeyValueStrip.Item = Item;\n\nexport default KeyValueStrip;\nexport { KeyValueStrip };\n"],"names":["TOOLTIP_DELAY_S","Item","label","className","children","truncate","tooltip","prefix","suffix","ownTooltip","given","isRenderableNode","text","textOf","jsxs","jsx","Text","EllipsisText","KeyValueStrip","ariaLabel","ariaLabelledBy","named"],"mappings":";;;;;AA+BA,MAAMA,IAAkB,KAElBC,IAAyC,CAAC;AAAA,EAC5C,OAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,UAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AACJ,MAAM;AACF,QAAMC,IAAaH,MAAY,QACzBI,IAAQC,EAAiBL,CAAO,IAAIA,IAAU,MAC9CM,IAAOC,EAAOT,CAAQ;AAC5B,SACI,gBAAAU;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW,0JAA0JX,CAAS;AAAA,MAE9K,UAAA;AAAA,QAAA,gBAAAY,EAAC,MAAA,EAAG,WAAU,2BACV,UAAA,gBAAAA,EAACC,GAAA,EAAK,MAAK,UAAS,OAAM,aACrB,UAAAd,EAAA,CACL,GACJ;AAAA,QACA,gBAAAY,EAAC,MAAA,EAAG,WAAU,qLACT,UAAA;AAAA,UAAAH,EAAiBJ,CAAM,KACpB,gBAAAQ,EAAC,QAAA,EAAK,WAAU,uCAAuC,UAAAR,GAAO;AAAA,UAEjEF,IACG,gBAAAU;AAAA,YAACE;AAAA,YAAA;AAAA,cACG,OAAM;AAAA,cACN,SAASR,IAAaC,IAAQE;AAAA,cAC9B,sBAAsB,CAACH;AAAA,cACvB,cAAcT;AAAA,cACd,kBAAkBU,MAAU,QAAQ,CAAC,CAACE;AAAA,cAErC,UAAAR;AAAA,YAAA;AAAA,UAAA,IAGL,gBAAAW,EAAC,QAAA,EAAK,WAAU,WAAW,UAAAX,EAAA,CAAS;AAAA,UAEvCO,EAAiBH,CAAM,uBACnB,QAAA,EAAK,WAAU,uCAAuC,UAAAA,EAAA,CAAO;AAAA,QAAA,EAAA,CAEtE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ,GAMMU,IAAsE,CAAC;AAAA,EACzE,WAAAf,IAAY;AAAA,EACZ,UAAAC;AAAA,EACA,cAAce;AAAA,EACd,mBAAmBC;AACvB,MAAM;AACF,QAAMC,IAAQ,CAAC,EAAEF,KAAaC;AAC9B;AAAA;AAAA,IAEI,gBAAAL;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,MAAMM,IAAQ,UAAU;AAAA,QACxB,cAAYA,KAAQF,KAAa;AAAA,QACjC,mBAAiBE,KAAQD,KAAkB;AAAA,QAC3C,WAAW,UAAUjB,CAAS;AAAA,QAE9B,UAAA,gBAAAY,EAAC,MAAA,EAAG,WAAU,2FACT,UAAAX,EAAA,CACL;AAAA,MAAA;AAAA,IAAA;AAAA;AAGZ;AAEAc,EAAc,OAAOjB;"}
1
+ {"version":3,"file":"KeyValueStrip.js","sources":["../../src/components/KeyValueStrip.tsx"],"sourcesContent":["import type React from 'react';\nimport EllipsisText from './Typography/EllipsisText';\nimport Text from './Typography/Text';\nimport { textOf } from './childrenText';\nimport { isRenderableNode } from './renderableNode';\n\nexport interface KeyValueStripProps {\n className?: string;\n children: React.ReactNode;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\nexport type KeyValueStripTone = 'neutral' | 'success' | 'warning' | 'error';\n\nexport interface KeyValueStripItemProps {\n label: React.ReactNode;\n tone?: KeyValueStripTone;\n className?: string;\n children: React.ReactNode;\n /** One line with an ellipsis. Block/flex children clip without one, so use their own truncate. */\n truncate?: boolean;\n /**\n * Needs `truncate`. By default a text value shows in full when cut off; a given tooltip always\n * shows and makes a text value a tab stop. `null` turns it off.\n */\n tooltip?: React.ReactNode;\n /** Before the value, never truncated, e.g. an icon. */\n prefix?: React.ReactNode;\n /** After the value, never truncated, e.g. a copy button. */\n suffix?: React.ReactNode;\n}\n\nconst TONE_DOT: Record<KeyValueStripTone, string> = {\n neutral: 'bg-[var(--malachite-text-dimmed,rgb(161,161,161))]',\n success: 'bg-[var(--malachite-text-success,rgb(2,122,66))]',\n warning: 'bg-[var(--malachite-text-warning,rgb(150,88,10))]',\n error: 'bg-[var(--malachite-text-error,rgb(237,53,54))]',\n};\n\n// Faster than Tooltip's 1s: a strip is read by hovering along it.\nconst TOOLTIP_DELAY_S = 0.2;\n\nconst Item: React.FC<KeyValueStripItemProps> = ({\n label,\n tone,\n className = '',\n children,\n truncate = false,\n tooltip,\n prefix,\n suffix,\n}) => {\n const ownTooltip = tooltip !== undefined;\n const given = isRenderableNode(tooltip) ? tooltip : null;\n const text = textOf(children);\n return (\n <div\n className={`flex min-w-0 flex-1 basis-0 flex-col gap-[3px] border-0 border-s border-solid border-[var(--malachite-card-border,#e8e8e8)] px-[18px] first:border-s-0 ${className}`}\n >\n <dt className={`m-0 min-w-0 break-words ${tone ? 'flex items-start gap-[6px]' : ''}`}>\n {tone && (\n <span\n aria-hidden=\"true\"\n data-tone={tone}\n className={`mt-[6px] h-[6px] w-[6px] shrink-0 rounded-full ${TONE_DOT[tone]}`}\n />\n )}\n <Text size=\"xsmall\" color=\"secondary\" className=\"min-w-0\">\n {label}\n </Text>\n </dt>\n <dd className=\"m-0 flex min-w-0 items-center text-[length:var(--malachite-font-size-small,13px)] leading-[1.5] font-medium text-[var(--malachite-text-primary,#0a0a0a)] [overflow-wrap:anywhere]\">\n {isRenderableNode(prefix) && (\n <span className=\"me-[8px] flex shrink-0 items-center\">{prefix}</span>\n )}\n {truncate ? (\n <EllipsisText\n color=\"inherit\"\n tooltip={ownTooltip ? given : text}\n tooltipWhenTruncated={!ownTooltip}\n tooltipDelay={TOOLTIP_DELAY_S}\n focusableTrigger={given !== null && !!text}\n >\n {children}\n </EllipsisText>\n ) : (\n <span className=\"min-w-0\">{children}</span>\n )}\n {isRenderableNode(suffix) && (\n <span className=\"ms-[4px] flex shrink-0 items-center\">{suffix}</span>\n )}\n </dd>\n </div>\n );\n};\n\n/**\n * Label/value cells in one sunken band, e.g. the facts under a side panel header. Not for table\n * rows: a given tooltip mounts up front.\n */\nconst KeyValueStrip: React.FC<KeyValueStripProps> & { Item: typeof Item } = ({\n className = '',\n children,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n}) => {\n const named = !!(ariaLabel || ariaLabelledBy);\n return (\n // A role on the dl would drop its term/definition semantics.\n <div\n role={named ? 'group' : undefined}\n aria-label={named ? ariaLabel || undefined : undefined}\n aria-labelledby={named ? ariaLabelledBy || undefined : undefined}\n className={`w-full ${className}`}\n >\n <dl className=\"m-0 flex w-full rounded-[10px] bg-[var(--malachite-table-background,#f7f7f7)] py-[11px]\">\n {children}\n </dl>\n </div>\n );\n};\n\nKeyValueStrip.Item = Item;\n\nexport default KeyValueStrip;\nexport { KeyValueStrip };\n"],"names":["TONE_DOT","TOOLTIP_DELAY_S","Item","label","tone","className","children","truncate","tooltip","prefix","suffix","ownTooltip","given","isRenderableNode","text","textOf","jsxs","jsx","Text","EllipsisText","KeyValueStrip","ariaLabel","ariaLabelledBy","named"],"mappings":";;;;;AAiCA,MAAMA,IAA8C;AAAA,EAChD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACX,GAGMC,IAAkB,KAElBC,IAAyC,CAAC;AAAA,EAC5C,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ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Z,GAMMU,IAAsE,CAAC;AAAA,EACzE,WAAAf,IAAY;AAAA,EACZ,UAAAC;AAAA,EACA,cAAce;AAAA,EACd,mBAAmBC;AACvB,MAAM;AACF,QAAMC,IAAQ,CAAC,EAAEF,KAAaC;AAC9B;AAAA;AAAA,IAEI,gBAAAL;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,MAAMM,IAAQ,UAAU;AAAA,QACxB,cAAYA,KAAQF,KAAa;AAAA,QACjC,mBAAiBE,KAAQD,KAAkB;AAAA,QAC3C,WAAW,UAAUjB,CAAS;AAAA,QAE9B,UAAA,gBAAAY,EAAC,MAAA,EAAG,WAAU,2FACT,UAAAX,EAAA,CACL;AAAA,MAAA;AAAA,IAAA;AAAA;AAGZ;AAEAc,EAAc,OAAOlB;"}
@@ -1,14 +1,14 @@
1
- import { jsxs as p, jsx as x } from "react/jsx-runtime";
2
- import { FOCUS_RING as S } from "./focusRing.js";
3
- import { resolveRel as R } from "./linkRel.js";
4
- import { safeHref as T } from "./safeHref.js";
5
- const j = "inline-flex items-center justify-center gap-1.5 font-medium whitespace-nowrap shrink-0 transition-colors duration-150 ease-in-out", y = {
1
+ import { jsxs as c, jsx as k } from "react/jsx-runtime";
2
+ import { FOCUS_RING as g } from "./focusRing.js";
3
+ import { resolveRel as j } from "./linkRel.js";
4
+ import { safeHref as B } from "./safeHref.js";
5
+ const w = "inline-flex items-center justify-center gap-1.5 font-medium whitespace-nowrap shrink-0 transition-colors duration-150 ease-in-out", z = {
6
6
  pill: "rounded-[var(--malachite-radius-10,10px)]",
7
7
  tab: "rounded-b-[var(--malachite-radius-10,10px)] rounded-t-none"
8
- }, B = {
8
+ }, W = {
9
9
  default: "border-0",
10
10
  assistant: "border border-solid border-[var(--malachite-tag-assistant-border)]"
11
- }, $ = "bg-[var(--malachite-card-background)] text-[var(--malachite-assistant-foreground)]", w = {
11
+ }, A = "bg-[var(--malachite-card-background)] text-[var(--malachite-assistant-foreground)]", H = {
12
12
  // For a row that labels other content rather than being read on its own — a context
13
13
  // strip above a chat, say. The only size that drops below the 13px the others share.
14
14
  xsmall: {
@@ -26,7 +26,7 @@ const j = "inline-flex items-center justify-center gap-1.5 font-medium whitespac
26
26
  padding: "px-2.5",
27
27
  paddingWithIcon: "pl-1.5 pr-2"
28
28
  }
29
- }, z = "bg-[var(--malachite-pillbutton-static-background)] text-[var(--malachite-pillbutton-static-foreground)]", W = "active:opacity-60 cursor-pointer", H = {
29
+ }, P = "bg-[var(--malachite-pillbutton-static-background)] text-[var(--malachite-pillbutton-static-foreground)]", D = "active:opacity-60 cursor-pointer", F = {
30
30
  default: {
31
31
  base: "bg-[var(--malachite-pillbutton-background)] text-[var(--malachite-pillbutton-foreground)]",
32
32
  selected: "bg-[var(--malachite-pillbutton-hover-background)] text-[var(--malachite-pillbutton-hover-foreground)]",
@@ -37,53 +37,76 @@ const j = "inline-flex items-center justify-center gap-1.5 font-medium whitespac
37
37
  selected: "bg-[var(--malachite-pillbutton-inverted-hover-background)] text-[var(--malachite-pillbutton-inverted-hover-foreground)]",
38
38
  hover: "hover:bg-[var(--malachite-pillbutton-inverted-hover-background)] hover:text-[var(--malachite-pillbutton-inverted-hover-foreground)] active:bg-[var(--malachite-pillbutton-inverted-pressed-background)] active:text-[var(--malachite-pillbutton-inverted-pressed-foreground)]"
39
39
  }
40
- }, K = ({
41
- label: r = "Label",
42
- icon: l,
43
- className: k = "",
44
- selected: A = !1,
45
- disabled: m = !1,
46
- interactive: v = !0,
47
- size: C = "small",
48
- variant: L = "default",
49
- shape: I = "pill",
50
- tone: b = "default",
51
- trailingIcon: g,
52
- onClick: n,
53
- href: E,
54
- target: f,
40
+ }, Z = ({
41
+ label: a = "Label",
42
+ icon: d,
43
+ className: C = "",
44
+ selected: L = !1,
45
+ pressed: r,
46
+ disabled: u = !1,
47
+ interactive: f = !0,
48
+ size: I = "small",
49
+ variant: E = "default",
50
+ shape: N = "pill",
51
+ tone: x = "default",
52
+ trailingIcon: S,
53
+ onClick: h,
54
+ href: O,
55
+ target: $,
55
56
  rel: _
56
57
  }) => {
57
- const i = w[C], N = l ? i.paddingWithIcon : i.padding, t = H[L], o = v && !m, s = T(E), a = o && (!!n || !!s), c = a ? ` ${W}` : "";
58
+ const p = H[I], R = d ? p.paddingWithIcon : p.padding, t = F[E], m = f && !u, n = B(O), i = m && (!!h || !!n), v = i ? ` ${D}` : "", b = !n && r !== void 0, T = b ? r : L;
58
59
  let e;
59
- b === "assistant" ? e = a ? `${$}${c}` : $ : v ? A ? e = o ? `${t.selected}${c}` : t.selected : o ? e = `${t.base} ${t.hover}${c}` : e = t.base : e = z;
60
- const O = m ? "opacity-50 cursor-not-allowed pointer-events-none" : "", d = `${j} ${y[I]} ${i.text} ${N} ${B[b]} ${e} ${O} ${k}`, u = l ? /* @__PURE__ */ x("span", { className: "inline-flex items-center justify-center w-4 h-4 shrink-0 [&>img]:max-w-full [&>img]:max-h-full [&>img]:object-contain", children: l }) : null, h = g ? /* @__PURE__ */ x("span", { className: "inline-flex shrink-0 items-center justify-center", children: g }) : null;
61
- return a && s ? /* @__PURE__ */ p(
60
+ x === "assistant" ? e = i ? `${A}${v}` : A : f ? T ? e = m ? `${t.selected}${v}` : t.selected : m ? e = `${t.base} ${t.hover}${v}` : e = t.base : e = P;
61
+ const y = u ? "opacity-50 cursor-not-allowed pointer-events-none" : "", l = `${w} ${z[N]} ${p.text} ${R} ${W[x]} ${e} ${y} ${C}`, o = d ? /* @__PURE__ */ k("span", { className: "inline-flex items-center justify-center w-4 h-4 shrink-0 [&>img]:max-w-full [&>img]:max-h-full [&>img]:object-contain", children: d }) : null, s = S ? /* @__PURE__ */ k("span", { className: "inline-flex shrink-0 items-center justify-center", children: S }) : null;
62
+ return i && n ? /* @__PURE__ */ c(
62
63
  "a",
63
64
  {
64
- href: s,
65
- target: f,
66
- rel: R(_, f),
67
- className: `${S} ${d} no-underline`,
68
- onClick: n,
65
+ href: n,
66
+ target: $,
67
+ rel: j(_, $),
68
+ className: `${g} ${l} no-underline`,
69
+ onClick: h,
69
70
  children: [
70
- u,
71
- r,
72
- h
71
+ o,
72
+ a,
73
+ s
73
74
  ]
74
75
  }
75
- ) : a ? /* @__PURE__ */ p("button", { type: "button", className: `${S} ${d}`, onClick: n, children: [
76
- u,
77
- r,
78
- h
79
- ] }) : /* @__PURE__ */ p("div", { className: d, children: [
80
- u,
81
- r,
82
- h
76
+ ) : i ? /* @__PURE__ */ c(
77
+ "button",
78
+ {
79
+ type: "button",
80
+ "aria-pressed": b ? r : void 0,
81
+ className: `${g} ${l}`,
82
+ onClick: h,
83
+ children: [
84
+ o,
85
+ a,
86
+ s
87
+ ]
88
+ }
89
+ ) : b && u ? /* @__PURE__ */ c(
90
+ "button",
91
+ {
92
+ type: "button",
93
+ "aria-pressed": r,
94
+ "aria-disabled": "true",
95
+ className: `${g} ${l}`,
96
+ children: [
97
+ o,
98
+ a,
99
+ s
100
+ ]
101
+ }
102
+ ) : /* @__PURE__ */ c("div", { className: l, children: [
103
+ o,
104
+ a,
105
+ s
83
106
  ] });
84
107
  };
85
108
  export {
86
- K as PillButton,
87
- K as default
109
+ Z as PillButton,
110
+ Z as default
88
111
  };
89
112
  //# sourceMappingURL=PillButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PillButton.js","sources":["../../src/components/PillButton.tsx"],"sourcesContent":["import React from 'react';\nimport { FOCUS_RING } from './focusRing';\nimport { resolveRel } from './linkRel';\nimport { safeHref } from './safeHref';\n\ntype PillButtonSize = 'xsmall' | 'small' | 'medium';\ntype PillButtonVariant = 'default' | 'inverted';\n/**\n * `tab` squares the top corners so the pill reads as attached to whatever sits above it —\n * a row of controls hanging under an input, rather than free-floating pills.\n */\ntype PillButtonShape = 'pill' | 'tab';\n/**\n * `assistant` is the chrome for AI-authored chips (e.g. `ChangeReview.Jump`): a fixed\n * violet-on-white look with its own border, independent of `variant`/`selected`.\n */\ntype PillButtonTone = 'default' | 'assistant';\n\ninterface PillButtonProps {\n label: string;\n icon?: React.ReactNode;\n className?: string;\n selected?: boolean;\n disabled?: boolean;\n interactive?: boolean;\n size?: PillButtonSize;\n variant?: PillButtonVariant;\n shape?: PillButtonShape;\n tone?: PillButtonTone;\n /** Sits after the label — a caret on a pill that opens a menu. */\n trailingIcon?: React.ReactNode;\n onClick?: (event: React.MouseEvent<HTMLElement>) => void;\n /** Renders the pill as a real anchor, so a link pill keeps cmd-click, copy-link and the status bar. */\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n rel?: string;\n}\n\nconst BASE_CLASSES =\n 'inline-flex items-center justify-center gap-1.5 font-medium whitespace-nowrap shrink-0 transition-colors duration-150 ease-in-out';\n\nconst SHAPE_CLASSES: Record<PillButtonShape, string> = {\n pill: 'rounded-[var(--malachite-radius-10,10px)]',\n tab: 'rounded-b-[var(--malachite-radius-10,10px)] rounded-t-none',\n};\n\n// Box-sizing is border-box, so trading `border-0` for a 1px border only eats into the padding\n// box — it never grows the element past the fixed height each size already sets. Only one of these\n// ever applies per render, so there's no `border-0`/`border` class collision to referee.\nconst TONE_BORDER_CLASSES: Record<PillButtonTone, string> = {\n default: 'border-0',\n assistant: 'border border-solid border-[var(--malachite-tag-assistant-border)]',\n};\n\nconst ASSISTANT_COLORS =\n 'bg-[var(--malachite-card-background)] text-[var(--malachite-assistant-foreground)]';\n\nconst SIZE_CLASSES: Record<\n PillButtonSize,\n { text: string; padding: string; paddingWithIcon: string }\n> = {\n // For a row that labels other content rather than being read on its own — a context\n // strip above a chat, say. The only size that drops below the 13px the others share.\n xsmall: {\n text: 'text-[length:var(--malachite-font-size-xsmall,11px)] h-[22px] leading-none',\n padding: 'px-2',\n paddingWithIcon: 'pl-1 pr-1.5',\n },\n small: {\n text: 'text-[length:var(--malachite-font-size-small,13px)] h-[var(--malachite-control-height-small,28px)] leading-none',\n padding: 'px-2.5',\n paddingWithIcon: 'pl-1.5 pr-2',\n },\n medium: {\n text: 'text-[length:var(--malachite-font-size-small,13px)] h-[var(--malachite-control-height-medium,32px)] leading-none',\n padding: 'px-2.5',\n paddingWithIcon: 'pl-1.5 pr-2',\n },\n};\n\nconst STATIC_COLORS =\n 'bg-[var(--malachite-pillbutton-static-background)] text-[var(--malachite-pillbutton-static-foreground)]';\n\nconst CLICKABLE_TAIL = 'active:opacity-60 cursor-pointer';\n\nconst VARIANT_COLORS: Record<PillButtonVariant, { base: string; selected: string; hover: string }> =\n {\n default: {\n base: 'bg-[var(--malachite-pillbutton-background)] text-[var(--malachite-pillbutton-foreground)]',\n selected:\n 'bg-[var(--malachite-pillbutton-hover-background)] text-[var(--malachite-pillbutton-hover-foreground)]',\n hover: 'hover:bg-[var(--malachite-pillbutton-hover-background)] hover:text-[var(--malachite-pillbutton-hover-foreground)] active:bg-[var(--malachite-pillbutton-pressed-background)] active:text-[var(--malachite-pillbutton-pressed-foreground)]',\n },\n inverted: {\n base: 'bg-[var(--malachite-pillbutton-inverted-background)] text-[var(--malachite-pillbutton-inverted-foreground)]',\n selected:\n 'bg-[var(--malachite-pillbutton-inverted-hover-background)] text-[var(--malachite-pillbutton-inverted-hover-foreground)]',\n hover: 'hover:bg-[var(--malachite-pillbutton-inverted-hover-background)] hover:text-[var(--malachite-pillbutton-inverted-hover-foreground)] active:bg-[var(--malachite-pillbutton-inverted-pressed-background)] active:text-[var(--malachite-pillbutton-inverted-pressed-foreground)]',\n },\n };\n\nexport const PillButton: React.FC<PillButtonProps> = ({\n label = 'Label',\n icon,\n className = '',\n selected = false,\n disabled = false,\n interactive = true,\n size = 'small',\n variant = 'default',\n shape = 'pill',\n tone = 'default',\n trailingIcon,\n onClick,\n href,\n target,\n rel,\n}) => {\n const sizeBlock = SIZE_CLASSES[size];\n const padding = icon ? sizeBlock.paddingWithIcon : sizeBlock.padding;\n const variantBlock = VARIANT_COLORS[variant];\n const isInteractiveLook = interactive && !disabled;\n // A rejected href (e.g. `javascript:`) takes the button or static path, never an anchor.\n const linkHref = safeHref(href);\n const isClickable = isInteractiveLook && (!!onClick || !!linkHref);\n const clickableTail = isClickable ? ` ${CLICKABLE_TAIL}` : '';\n\n let colorClasses: string;\n if (tone === 'assistant') {\n // Assistant chips read the same in every interaction state — the click affordance is\n // the shared `active:opacity-60` from `clickableTail`, not a colour swap.\n colorClasses = isClickable ? `${ASSISTANT_COLORS}${clickableTail}` : ASSISTANT_COLORS;\n } else if (!interactive) {\n colorClasses = STATIC_COLORS;\n } else if (selected) {\n colorClasses = isInteractiveLook\n ? `${variantBlock.selected}${clickableTail}`\n : variantBlock.selected;\n } else if (isInteractiveLook) {\n colorClasses = `${variantBlock.base} ${variantBlock.hover}${clickableTail}`;\n } else {\n colorClasses = variantBlock.base;\n }\n\n const disabledClasses = disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '';\n\n const merged = `${BASE_CLASSES} ${SHAPE_CLASSES[shape]} ${sizeBlock.text} ${padding} ${TONE_BORDER_CLASSES[tone]} ${colorClasses} ${disabledClasses} ${className}`;\n\n const iconSlot = icon ? (\n <span className=\"inline-flex items-center justify-center w-4 h-4 shrink-0 [&>img]:max-w-full [&>img]:max-h-full [&>img]:object-contain\">\n {icon}\n </span>\n ) : null;\n\n const trailingSlot = trailingIcon ? (\n <span className=\"inline-flex shrink-0 items-center justify-center\">{trailingIcon}</span>\n ) : null;\n\n // An anchor cannot be disabled, so a disabled link pill falls through to the static one.\n if (isClickable && linkHref) {\n return (\n <a\n href={linkHref}\n target={target}\n rel={resolveRel(rel, target)}\n className={`${FOCUS_RING} ${merged} no-underline`}\n onClick={onClick}\n >\n {iconSlot}\n {label}\n {trailingSlot}\n </a>\n );\n }\n\n if (isClickable) {\n return (\n <button type=\"button\" className={`${FOCUS_RING} ${merged}`} onClick={onClick}>\n {iconSlot}\n {label}\n {trailingSlot}\n </button>\n );\n }\n\n return (\n <div className={merged}>\n {iconSlot}\n {label}\n {trailingSlot}\n </div>\n );\n};\n\nexport default PillButton;\n"],"names":["BASE_CLASSES","SHAPE_CLASSES","TONE_BORDER_CLASSES","ASSISTANT_COLORS","SIZE_CLASSES","STATIC_COLORS","CLICKABLE_TAIL","VARIANT_COLORS","PillButton","label","icon","className","selected","disabled","interactive","size","variant","shape","tone","trailingIcon","onClick","href","target","rel","sizeBlock","padding","variantBlock","isInteractiveLook","linkHref","safeHref","isClickable","clickableTail","colorClasses","disabledClasses","merged","iconSlot","jsx","trailingSlot","jsxs","resolveRel","FOCUS_RING"],"mappings":";;;;AAsCA,MAAMA,IACF,qIAEEC,IAAiD;AAAA,EACnD,MAAM;AAAA,EACN,KAAK;AACT,GAKMC,IAAsD;AAAA,EACxD,SAAS;AAAA,EACT,WAAW;AACf,GAEMC,IACF,sFAEEC,IAGF;AAAA;AAAA;AAAA,EAGA,QAAQ;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,IACT,iBAAiB;AAAA,EAAA;AAAA,EAErB,OAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS;AAAA,IACT,iBAAiB;AAAA,EAAA;AAAA,EAErB,QAAQ;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,IACT,iBAAiB;AAAA,EAAA;AAEzB,GAEMC,IACF,2GAEEC,IAAiB,oCAEjBC,IACF;AAAA,EACI,SAAS;AAAA,IACL,MAAM;AAAA,IACN,UACI;AAAA,IACJ,OAAO;AAAA,EAAA;AAAA,EAEX,UAAU;AAAA,IACN,MAAM;AAAA,IACN,UACI;AAAA,IACJ,OAAO;AAAA,EAAA;AAEf,GAESC,IAAwC,CAAC;AAAA,EAClD,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,UAAAC,IAAW;AAAA,EACX,aAAAC,IAAc;AAAA,EACd,MAAAC,IAAO;AAAA,EACP,SAAAC,IAAU;AAAA,EACV,OAAAC,IAAQ;AAAA,EACR,MAAAC,IAAO;AAAA,EACP,cAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,KAAAC;AACJ,MAAM;AACF,QAAMC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IAAIN,CAAM,IAAI,SAAAd,GACvD,UAAA;AAAA,IAAAe;AAAA,IACA1B;AAAA,IACA4B;AAAA,EAAA,GACL,IAKJ,gBAAAC,EAAC,OAAA,EAAI,WAAWJ,GACX,UAAA;AAAA,IAAAC;AAAA,IACA1B;AAAA,IACA4B;AAAA,EAAA,GACL;AAER;"}
1
+ {"version":3,"file":"PillButton.js","sources":["../../src/components/PillButton.tsx"],"sourcesContent":["import React from 'react';\nimport { FOCUS_RING } from './focusRing';\nimport { resolveRel } from './linkRel';\nimport { safeHref } from './safeHref';\n\ntype PillButtonSize = 'xsmall' | 'small' | 'medium';\ntype PillButtonVariant = 'default' | 'inverted';\n/**\n * `tab` squares the top corners so the pill reads as attached to whatever sits above it —\n * a row of controls hanging under an input, rather than free-floating pills.\n */\ntype PillButtonShape = 'pill' | 'tab';\n/**\n * `assistant` is the chrome for AI-authored chips (e.g. `ChangeReview.Jump`): a fixed\n * violet-on-white look with its own border, independent of `variant`/`selected`.\n */\ntype PillButtonTone = 'default' | 'assistant';\n\ninterface PillButtonBaseProps {\n label: string;\n icon?: React.ReactNode;\n className?: string;\n selected?: boolean;\n disabled?: boolean;\n interactive?: boolean;\n size?: PillButtonSize;\n variant?: PillButtonVariant;\n shape?: PillButtonShape;\n /** Sits after the label — a caret on a pill that opens a menu. */\n trailingIcon?: React.ReactNode;\n onClick?: (event: React.MouseEvent<HTMLElement>) => void;\n /** Renders the pill as a real anchor, so a link pill keeps cmd-click, copy-link and the status bar. */\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n rel?: string;\n}\n\ntype PillButtonProps = PillButtonBaseProps &\n (\n | {\n tone?: Extract<PillButtonTone, 'default'>;\n pressed?: boolean;\n }\n | { tone: Extract<PillButtonTone, 'assistant'>; pressed?: never }\n );\n\nconst BASE_CLASSES =\n 'inline-flex items-center justify-center gap-1.5 font-medium whitespace-nowrap shrink-0 transition-colors duration-150 ease-in-out';\n\nconst SHAPE_CLASSES: Record<PillButtonShape, string> = {\n pill: 'rounded-[var(--malachite-radius-10,10px)]',\n tab: 'rounded-b-[var(--malachite-radius-10,10px)] rounded-t-none',\n};\n\n// Box-sizing is border-box, so trading `border-0` for a 1px border only eats into the padding\n// box — it never grows the element past the fixed height each size already sets. Only one of these\n// ever applies per render, so there's no `border-0`/`border` class collision to referee.\nconst TONE_BORDER_CLASSES: Record<PillButtonTone, string> = {\n default: 'border-0',\n assistant: 'border border-solid border-[var(--malachite-tag-assistant-border)]',\n};\n\nconst ASSISTANT_COLORS =\n 'bg-[var(--malachite-card-background)] text-[var(--malachite-assistant-foreground)]';\n\nconst SIZE_CLASSES: Record<\n PillButtonSize,\n { text: string; padding: string; paddingWithIcon: string }\n> = {\n // For a row that labels other content rather than being read on its own — a context\n // strip above a chat, say. The only size that drops below the 13px the others share.\n xsmall: {\n text: 'text-[length:var(--malachite-font-size-xsmall,11px)] h-[22px] leading-none',\n padding: 'px-2',\n paddingWithIcon: 'pl-1 pr-1.5',\n },\n small: {\n text: 'text-[length:var(--malachite-font-size-small,13px)] h-[var(--malachite-control-height-small,28px)] leading-none',\n padding: 'px-2.5',\n paddingWithIcon: 'pl-1.5 pr-2',\n },\n medium: {\n text: 'text-[length:var(--malachite-font-size-small,13px)] h-[var(--malachite-control-height-medium,32px)] leading-none',\n padding: 'px-2.5',\n paddingWithIcon: 'pl-1.5 pr-2',\n },\n};\n\nconst STATIC_COLORS =\n 'bg-[var(--malachite-pillbutton-static-background)] text-[var(--malachite-pillbutton-static-foreground)]';\n\nconst CLICKABLE_TAIL = 'active:opacity-60 cursor-pointer';\n\nconst VARIANT_COLORS: Record<PillButtonVariant, { base: string; selected: string; hover: string }> =\n {\n default: {\n base: 'bg-[var(--malachite-pillbutton-background)] text-[var(--malachite-pillbutton-foreground)]',\n selected:\n 'bg-[var(--malachite-pillbutton-hover-background)] text-[var(--malachite-pillbutton-hover-foreground)]',\n hover: 'hover:bg-[var(--malachite-pillbutton-hover-background)] hover:text-[var(--malachite-pillbutton-hover-foreground)] active:bg-[var(--malachite-pillbutton-pressed-background)] active:text-[var(--malachite-pillbutton-pressed-foreground)]',\n },\n inverted: {\n base: 'bg-[var(--malachite-pillbutton-inverted-background)] text-[var(--malachite-pillbutton-inverted-foreground)]',\n selected:\n 'bg-[var(--malachite-pillbutton-inverted-hover-background)] text-[var(--malachite-pillbutton-inverted-hover-foreground)]',\n hover: 'hover:bg-[var(--malachite-pillbutton-inverted-hover-background)] hover:text-[var(--malachite-pillbutton-inverted-hover-foreground)] active:bg-[var(--malachite-pillbutton-inverted-pressed-background)] active:text-[var(--malachite-pillbutton-inverted-pressed-foreground)]',\n },\n };\n\nexport const PillButton: React.FC<PillButtonProps> = ({\n label = 'Label',\n icon,\n className = '',\n selected = false,\n pressed,\n disabled = false,\n interactive = true,\n size = 'small',\n variant = 'default',\n shape = 'pill',\n tone = 'default',\n trailingIcon,\n onClick,\n href,\n target,\n rel,\n}) => {\n const sizeBlock = SIZE_CLASSES[size];\n const padding = icon ? sizeBlock.paddingWithIcon : sizeBlock.padding;\n const variantBlock = VARIANT_COLORS[variant];\n const isInteractiveLook = interactive && !disabled;\n // A rejected href (e.g. `javascript:`) takes the button or static path, never an anchor.\n const linkHref = safeHref(href);\n const isClickable = isInteractiveLook && (!!onClick || !!linkHref);\n const clickableTail = isClickable ? ` ${CLICKABLE_TAIL}` : '';\n const toggle = !linkHref && pressed !== undefined;\n const isOn = toggle ? pressed : selected;\n\n let colorClasses: string;\n if (tone === 'assistant') {\n // Assistant chips read the same in every interaction state — the click affordance is\n // the shared `active:opacity-60` from `clickableTail`, not a colour swap.\n colorClasses = isClickable ? `${ASSISTANT_COLORS}${clickableTail}` : ASSISTANT_COLORS;\n } else if (!interactive) {\n colorClasses = STATIC_COLORS;\n } else if (isOn) {\n colorClasses = isInteractiveLook\n ? `${variantBlock.selected}${clickableTail}`\n : variantBlock.selected;\n } else if (isInteractiveLook) {\n colorClasses = `${variantBlock.base} ${variantBlock.hover}${clickableTail}`;\n } else {\n colorClasses = variantBlock.base;\n }\n\n const disabledClasses = disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '';\n\n const merged = `${BASE_CLASSES} ${SHAPE_CLASSES[shape]} ${sizeBlock.text} ${padding} ${TONE_BORDER_CLASSES[tone]} ${colorClasses} ${disabledClasses} ${className}`;\n\n const iconSlot = icon ? (\n <span className=\"inline-flex items-center justify-center w-4 h-4 shrink-0 [&>img]:max-w-full [&>img]:max-h-full [&>img]:object-contain\">\n {icon}\n </span>\n ) : null;\n\n const trailingSlot = trailingIcon ? (\n <span className=\"inline-flex shrink-0 items-center justify-center\">{trailingIcon}</span>\n ) : null;\n\n // An anchor cannot be disabled, so a disabled link pill falls through to the static one.\n if (isClickable && linkHref) {\n return (\n <a\n href={linkHref}\n target={target}\n rel={resolveRel(rel, target)}\n className={`${FOCUS_RING} ${merged} no-underline`}\n onClick={onClick}\n >\n {iconSlot}\n {label}\n {trailingSlot}\n </a>\n );\n }\n\n if (isClickable) {\n return (\n <button\n type=\"button\"\n aria-pressed={toggle ? pressed : undefined}\n className={`${FOCUS_RING} ${merged}`}\n onClick={onClick}\n >\n {iconSlot}\n {label}\n {trailingSlot}\n </button>\n );\n }\n\n if (toggle && disabled) {\n return (\n <button\n type=\"button\"\n aria-pressed={pressed}\n aria-disabled=\"true\"\n className={`${FOCUS_RING} ${merged}`}\n >\n {iconSlot}\n {label}\n {trailingSlot}\n </button>\n );\n }\n\n return (\n <div className={merged}>\n {iconSlot}\n {label}\n {trailingSlot}\n </div>\n );\n};\n\nexport default PillButton;\n"],"names":["BASE_CLASSES","SHAPE_CLASSES","TONE_BORDER_CLASSES","ASSISTANT_COLORS","SIZE_CLASSES","STATIC_COLORS","CLICKABLE_TAIL","VARIANT_COLORS","PillButton","label","icon","className","selected","pressed","disabled","interactive","size","variant","shape","tone","trailingIcon","onClick","href","target","rel","sizeBlock","padding","variantBlock","isInteractiveLook","linkHref","safeHref","isClickable","clickableTail","toggle","isOn","colorClasses","disabledClasses","merged","iconSlot","js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SAAAhB;AAAA,MAEC,UAAA;AAAA,QAAAiB;AAAA,QACA7B;AAAA,QACA+B;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAKTP,KAAUnB,IAEN,gBAAA2B;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,MAAK;AAAA,MACL,gBAAc5B;AAAA,MACd,iBAAc;AAAA,MACd,WAAW,GAAG8B,CAAU,IAAIN,CAAM;AAAA,MAEjC,UAAA;AAAA,QAAAC;AAAA,QACA7B;AAAA,QACA+B;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAMT,gBAAAC,EAAC,OAAA,EAAI,WAAWJ,GACX,UAAA;AAAA,IAAAC;AAAA,IACA7B;AAAA,IACA+B;AAAA,EAAA,GACL;AAER;"}
@@ -0,0 +1,79 @@
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
+ import d from "./Typography/Text.js";
3
+ const h = {
4
+ neutral: "border-[var(--malachite-text-secondary,rgb(123,123,123))]",
5
+ success: "border-[var(--malachite-text-success,rgb(2,122,66))]",
6
+ warning: "border-[var(--malachite-warning-fill,rgb(201,138,46))]",
7
+ error: "border-[var(--malachite-error-background,rgb(197,63,63))]"
8
+ }, N = {
9
+ backgroundColor: "var(--malachite-warning-fill, rgb(201, 138, 46))",
10
+ backgroundImage: "linear-gradient(90deg, var(--malachite-text-success, rgb(2, 122, 66)) 0%, var(--malachite-warning-fill, rgb(201, 138, 46)) 55%, var(--malachite-error-background, rgb(197, 63, 63)) 100%)"
11
+ }, i = (a) => Math.min(1, Math.max(0, Number.isFinite(a) ? a : 0)), s = (a) => `${i(a) * 100}%`, f = 0.25, w = (a) => i(a) < f || i(a) > 1 - f, u = ({
12
+ at: a,
13
+ shift: n,
14
+ children: o
15
+ }) => /* @__PURE__ */ e(
16
+ "span",
17
+ {
18
+ className: "absolute top-0 flex whitespace-nowrap",
19
+ style: { left: s(a), transform: `translateX(-${n})` },
20
+ children: /* @__PURE__ */ e(d, { size: "xsmall", color: "secondary", children: o })
21
+ }
22
+ ), E = ({
23
+ value: a,
24
+ label: n,
25
+ valueText: o,
26
+ threshold: r,
27
+ thresholdLabel: l,
28
+ lowLabel: m,
29
+ highLabel: x,
30
+ tone: p = "neutral",
31
+ className: g = ""
32
+ }) => {
33
+ const t = r !== void 0 && Number.isFinite(r), b = t && w(r), v = !!(m || x || t && l);
34
+ return /* @__PURE__ */ c(
35
+ "div",
36
+ {
37
+ role: "meter",
38
+ "aria-label": n,
39
+ "aria-valuemin": 0,
40
+ "aria-valuemax": 1,
41
+ "aria-valuenow": i(a),
42
+ "aria-valuetext": o,
43
+ className: `flex w-full flex-col gap-[6px] px-[7px] ${g}`,
44
+ children: [
45
+ /* @__PURE__ */ c("div", { className: "relative h-[8px] rounded-[4px]", style: N, children: [
46
+ t && /* @__PURE__ */ e(
47
+ "span",
48
+ {
49
+ "data-score-meter-threshold": "",
50
+ className: "absolute top-[-3px] -ml-[1px] h-[14px] w-[2px] bg-[var(--malachite-card-background,#fff)] [box-shadow:0_0_0_1px_var(--malachite-text-dimmed,rgb(161,161,161))]",
51
+ style: { left: s(r) }
52
+ }
53
+ ),
54
+ /* @__PURE__ */ e(
55
+ "span",
56
+ {
57
+ "data-score-meter-marker": p,
58
+ className: `absolute top-[-3px] -ml-[7px] box-border h-[14px] w-[14px] rounded-full border-[3px] border-solid bg-[var(--malachite-card-background,#fff)] ${h[p]}`,
59
+ style: { left: s(a) }
60
+ }
61
+ )
62
+ ] }),
63
+ v && /* @__PURE__ */ c("div", { "aria-hidden": "true", className: "flex flex-col gap-[2px]", children: [
64
+ /* @__PURE__ */ c("div", { className: "relative flex h-[16px] justify-between", children: [
65
+ /* @__PURE__ */ e(d, { size: "xsmall", color: "secondary", children: m }),
66
+ l && t && !b && /* @__PURE__ */ e(u, { at: r, shift: "50%", children: l }),
67
+ /* @__PURE__ */ e(d, { size: "xsmall", color: "secondary", children: x })
68
+ ] }),
69
+ l && t && b && /* @__PURE__ */ e("div", { className: "relative h-[16px]", children: /* @__PURE__ */ e(u, { at: r, shift: s(r), children: l }) })
70
+ ] })
71
+ ]
72
+ }
73
+ );
74
+ };
75
+ export {
76
+ E as ScoreMeter,
77
+ E as default
78
+ };
79
+ //# sourceMappingURL=ScoreMeter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScoreMeter.js","sources":["../../src/components/ScoreMeter.tsx"],"sourcesContent":["import type React from 'react';\nimport Text from './Typography/Text';\n\nexport type ScoreMeterTone = 'neutral' | 'success' | 'warning' | 'error';\n\nexport interface ScoreMeterProps {\n value: number;\n label: string;\n valueText?: string;\n threshold?: number;\n thresholdLabel?: string;\n lowLabel?: string;\n highLabel?: string;\n tone?: ScoreMeterTone;\n className?: string;\n}\n\nconst MARKER_RING: Record<ScoreMeterTone, string> = {\n neutral: 'border-[var(--malachite-text-secondary,rgb(123,123,123))]',\n success: 'border-[var(--malachite-text-success,rgb(2,122,66))]',\n warning: 'border-[var(--malachite-warning-fill,rgb(201,138,46))]',\n error: 'border-[var(--malachite-error-background,rgb(197,63,63))]',\n};\n\nconst TRACK_STYLE: React.CSSProperties = {\n backgroundColor: 'var(--malachite-warning-fill, rgb(201, 138, 46))',\n backgroundImage:\n 'linear-gradient(90deg, var(--malachite-text-success, rgb(2, 122, 66)) 0%, var(--malachite-warning-fill, rgb(201, 138, 46)) 55%, var(--malachite-error-background, rgb(197, 63, 63)) 100%)',\n};\n\nconst unit = (value: number): number =>\n Math.min(1, Math.max(0, Number.isFinite(value) ? value : 0));\n\nconst percent = (value: number): string => `${unit(value) * 100}%`;\n\nconst LABEL_EDGE = 0.25;\n\nconst isNearEnd = (threshold: number): boolean =>\n unit(threshold) < LABEL_EDGE || unit(threshold) > 1 - LABEL_EDGE;\n\nconst ThresholdLabel: React.FC<{ at: number; shift: string; children: React.ReactNode }> = ({\n at,\n shift,\n children,\n}) => (\n <span\n className=\"absolute top-0 flex whitespace-nowrap\"\n style={{ left: percent(at), transform: `translateX(-${shift})` }}\n >\n <Text size=\"xsmall\" color=\"secondary\">\n {children}\n </Text>\n </span>\n);\n\nexport const ScoreMeter: React.FC<ScoreMeterProps> = ({\n value,\n label,\n valueText,\n threshold,\n thresholdLabel,\n lowLabel,\n highLabel,\n tone = 'neutral',\n className = '',\n}) => {\n const hasThreshold = threshold !== undefined && Number.isFinite(threshold);\n const nearEnd = hasThreshold && isNearEnd(threshold);\n const hasLabels = Boolean(lowLabel || highLabel || (hasThreshold && thresholdLabel));\n return (\n <div\n role=\"meter\"\n aria-label={label}\n aria-valuemin={0}\n aria-valuemax={1}\n aria-valuenow={unit(value)}\n aria-valuetext={valueText}\n className={`flex w-full flex-col gap-[6px] px-[7px] ${className}`}\n >\n <div className=\"relative h-[8px] rounded-[4px]\" style={TRACK_STYLE}>\n {hasThreshold && (\n <span\n data-score-meter-threshold=\"\"\n className=\"absolute top-[-3px] -ml-[1px] h-[14px] w-[2px] bg-[var(--malachite-card-background,#fff)] [box-shadow:0_0_0_1px_var(--malachite-text-dimmed,rgb(161,161,161))]\"\n style={{ left: percent(threshold) }}\n />\n )}\n <span\n data-score-meter-marker={tone}\n className={`absolute top-[-3px] -ml-[7px] box-border h-[14px] w-[14px] rounded-full border-[3px] border-solid bg-[var(--malachite-card-background,#fff)] ${MARKER_RING[tone]}`}\n style={{ left: percent(value) }}\n />\n </div>\n {hasLabels && (\n <div aria-hidden=\"true\" className=\"flex flex-col gap-[2px]\">\n <div className=\"relative flex h-[16px] justify-between\">\n <Text size=\"xsmall\" color=\"secondary\">\n {lowLabel}\n </Text>\n {thresholdLabel && hasThreshold && !nearEnd && (\n <ThresholdLabel at={threshold} shift=\"50%\">\n {thresholdLabel}\n </ThresholdLabel>\n )}\n <Text size=\"xsmall\" color=\"secondary\">\n {highLabel}\n </Text>\n </div>\n {thresholdLabel && hasThreshold && nearEnd && (\n <div className=\"relative h-[16px]\">\n <ThresholdLabel at={threshold} shift={percent(threshold)}>\n {thresholdLabel}\n </ThresholdLabel>\n </div>\n )}\n </div>\n )}\n </div>\n );\n};\n\nexport default ScoreMeter;\n"],"names":["MARKER_RING","TRACK_STYLE","unit","value","percent","LABEL_EDGE","isNearEnd","threshold","ThresholdLabel","at","shift","children","jsx","Text","ScoreMeter","label","valueText","thresholdLabel","lowLabel","highLabel","tone","className","hasThreshold","nearEnd","hasLabels","jsxs"],"mappings":";;AAiBA,MAAMA,IAA8C;AAAA,EAChD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACX,GAEMC,IAAmC;AAAA,EACrC,iBAAiB;AAAA,EACjB,iBACI;AACR,GAEMC,IAAO,CAACC,MACV,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,OAAO,SAASA,CAAK,IAAIA,IAAQ,CAAC,CAAC,GAEzDC,IAAU,CAACD,MAA0B,GAAGD,EAAKC,CAAK,IAAI,GAAG,KAEzDE,IAAa,MAEbC,IAAY,CAACC,MACfL,EAAKK,CAAS,IAAIF,KAAcH,EAAKK,CAAS,IAAI,IAAIF,GAEpDG,IAAqF,CAAC;AAAA,EACxF,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AACJ,MACI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,WAAU;AAAA,IACV,OAAO,EAAE,MAAMR,EAAQK,CAAE,GAAG,WAAW,eAAeC,CAAK,IAAA;AAAA,IAE3D,4BAACG,GAAA,EAAK,MAAK,UAAS,OAAM,aACrB,UAAAF,EAAA,CACL;AAAA,EAAA;AACJ,GAGSG,IAAwC,CAAC;AAAA,EAClD,OAAAX;AAAA,EACA,OAAAY;AAAA,EACA,WAAAC;AAAA,EACA,WAAAT;AAAA,EACA,gBAAAU;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC,IAAY;AAChB,MAAM;AACF,QAAMC,IAAef,MAAc,UAAa,OAAO,SAASA,CAAS,GACnEgB,IAAUD,KAAgBhB,EAAUC,CAAS,GAC7CiB,IAAY,GAAQN,KA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,GAClD,aACL,EAAA,CACJ;AAAA,QAAA,EAAA,CAER;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIhB;"}
@@ -942,8 +942,8 @@ const Dt = 160, mn = (e, n) => e.length === n.length && e.every((o, f) => o ===
942
942
  );
943
943
  }
944
944
  const je = re === "fixed" || e.some((t) => t.width), xt = B && (o || W.length > 0), Qt = xt && je ? $n(e) : void 0, Ye = (t) => xt && !je ? t.minWidth : void 0, Vt = (t, i) => {
945
- const c = t.sorter, g = (O == null ? void 0 : O.key) === t.key ? O == null ? void 0 : O.direction : null, u = /* @__PURE__ */ k("div", { className: `flex items-center gap-2 ${K(t.align)}`, children: [
946
- /* @__PURE__ */ r("span", { children: t.title }),
945
+ const c = t.sorter, g = (O == null ? void 0 : O.key) === t.key ? O == null ? void 0 : O.direction : null, u = /* @__PURE__ */ k("div", { className: `flex min-w-0 items-center gap-2 ${K(t.align)}`, children: [
946
+ /* @__PURE__ */ r("span", { className: t.titleShrinks ? "min-w-0" : void 0, children: t.title }),
947
947
  t.info && /* @__PURE__ */ r(Ee, { info: t.info }),
948
948
  c && /* @__PURE__ */ k("div", { className: "flex flex-col", children: [
949
949
  /* @__PURE__ */ r(
@@ -1056,6 +1056,7 @@ const Dt = 160, mn = (e, n) => e.length === n.length && e.every((o, f) => o ===
1056
1056
  children: /* @__PURE__ */ k(
1057
1057
  "table",
1058
1058
  {
1059
+ "aria-busy": o || void 0,
1059
1060
  className: `w-full ${je ? "table-fixed" : "table-auto"} ${p ? "border-separate table-bordered" : "border-collapse"} rounded-lg overflow-hidden`,
1060
1061
  style: {
1061
1062
  borderSpacing: "0",