@stackone/malachite 2.123.1 → 2.125.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.
- package/COMPONENTS.md +9 -7
- package/dist/components/ActionMenu.js +4 -3
- package/dist/components/ActionMenu.js.map +1 -1
- package/dist/components/Card.js +85 -75
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Flex.js +10 -8
- package/dist/components/Flex.js.map +1 -1
- package/dist/components/FrameHeader.js +26 -19
- package/dist/components/FrameHeader.js.map +1 -1
- package/dist/components/HexagonScale.js +25 -10
- package/dist/components/HexagonScale.js.map +1 -1
- package/dist/components/KeyValueStrip.js +57 -41
- package/dist/components/KeyValueStrip.js.map +1 -1
- package/dist/components/PageLayout/index.js +8 -7
- package/dist/components/PageLayout/index.js.map +1 -1
- package/dist/components/PageLayout/pageColumns.js +23 -0
- package/dist/components/PageLayout/pageColumns.js.map +1 -0
- package/dist/components/PillButton.js +68 -45
- package/dist/components/PillButton.js.map +1 -1
- package/dist/components/ScoreMeter.js +79 -0
- package/dist/components/ScoreMeter.js.map +1 -0
- package/dist/components/Table/Table.js +491 -472
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Timeline.js +88 -77
- package/dist/components/Timeline.js.map +1 -1
- package/dist/components/ToastProvider.js +32 -42
- package/dist/components/ToastProvider.js.map +1 -1
- package/dist/components/Typography/PathText.js +48 -55
- package/dist/components/Typography/PathText.js.map +1 -1
- package/dist/components/VisuallyHidden.js +8 -0
- package/dist/components/VisuallyHidden.js.map +1 -0
- package/dist/components/actionMenuStyles.js +33 -42
- package/dist/components/actionMenuStyles.js.map +1 -1
- package/dist/components/flexTypes.js +1 -1
- package/dist/components/flexTypes.js.map +1 -1
- package/dist/components/visuallyHiddenStyle.js +16 -0
- package/dist/components/visuallyHiddenStyle.js.map +1 -0
- package/dist/index.d.ts +63 -2
- package/dist/index.js +396 -392
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css.js +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { FOCUS_RING as
|
|
3
|
-
import { resolveRel as
|
|
4
|
-
import { safeHref as
|
|
5
|
-
const
|
|
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
|
-
},
|
|
8
|
+
}, W = {
|
|
9
9
|
default: "border-0",
|
|
10
10
|
assistant: "border border-solid border-[var(--malachite-tag-assistant-border)]"
|
|
11
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
41
|
-
label:
|
|
42
|
-
icon:
|
|
43
|
-
className:
|
|
44
|
-
selected:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
|
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
|
-
|
|
60
|
-
const
|
|
61
|
-
return
|
|
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:
|
|
65
|
-
target:
|
|
66
|
-
rel:
|
|
67
|
-
className: `${
|
|
68
|
-
onClick:
|
|
65
|
+
href: n,
|
|
66
|
+
target: $,
|
|
67
|
+
rel: j(_, $),
|
|
68
|
+
className: `${g} ${l} no-underline`,
|
|
69
|
+
onClick: h,
|
|
69
70
|
children: [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
o,
|
|
72
|
+
a,
|
|
73
|
+
s
|
|
73
74
|
]
|
|
74
75
|
}
|
|
75
|
-
) :
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
87
|
-
|
|
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,iBA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AIA,EAAa,KAAK,GAAGK,CAAa,KAEzEC,IAAeN,EAAa,OAR5BM,IAAe3B;AAWnB,QAAM4B,IAAkBpB,IAAW,sDAAsD,IAEnFqB,IAAS,GAAGlC,CAAY,IAAIC,EAAcgB,CAAK,CAAC,IAAIO,EAAU,IAAI,IAAIC,CAAO,IAAIvB,EAAoBgB,CAAI,CAAC,IAAIc,CAAY,IAAIC,CAAe,IAAItB,CAAS,IAE1JwB,IAAWzB,IACb,gBAAA0B,EAAC,UAAK,WAAU,yHACX,aACL,IACA,MAEEC,IAAelB,IACjB,gBAAAiB,EAAC,UAAK,WAAU,oDAAoD,aAAa,IACjF;AAGJ,SAAIN,KAAeF,IAEX,gBAAAU;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,MAAMV;AAAA,MACN,QAAAN;AAAA,MACA,KAAKiB,EAAWhB,GAAKD,CAAM;AAAA,MAC3B,WAAW,GAAGkB,CAAU,IAAIN,CAAM;AAAA,MAClC,SAAAd;AAAA,MAEC,UAAA;AAAA,QAAAe;AAAA,QACA1B;AAAA,QACA4B;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAKTP,IAEI,gBAAAQ,EAAC,UAAA,EAAO,MAAK,UAAS,WAAW,GAAGE,CAAU,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","jsx","trailingSlot","jsxs","resolveRel","FOCUS_RING"],"mappings":";;;;AA8CA,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,iBAA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AAA,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,WAAA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