@stackone/malachite 2.41.3 → 2.42.1

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 CHANGED
@@ -60,7 +60,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
60
60
  - **`Breadcrumbs`** — Breadcrumb trail with caret separators, an optional back button (shown only when there is more than one crumb AND the parent — the second-to-last — carries a `url` to target) and a right-aligned `actions` row. A lone crumb marked `isRoot` switches to title mode: plain emphasised text, no trail chrome, but the `actions` row still renders. Renders as a `nav`/`ol` with `aria-current="page"` on the last crumb. Pass `renderLink` to route crumbs through the app's own router instead of a plain `<a>`. Used by `PageLayout`, but standalone too. _Key props:_ `links[]` (`name`, `url`, `isRoot`), `actions[]`, `renderLink`, `className`, `style`.
61
61
  - **`ActionMenu`** — Dropdown menu of actions (kebab/overflow style). The trigger is an icon-only `Button` by default, so `size` draws exactly the square a `Button` of that size draws beside it: `xsmall` is Figma's 20px "Button Element - Square (X-Small)", `small` the 28px rung above it. Both squares are fixed rather than read off the `controlHeights` tokens, so re-theming those does not resize the trigger. A supplied `triggerIcon` is held to the tier's glyph size — 11px at `xsmall`, 16px at `small`. At 20px the `xsmall` trigger meets WCAG 2.5.8 through the *Spacing* exception rather than the 24px minimum, so keep at least 4px between adjacent triggers. `showLabel` draws `label` beside the icon instead of leaving it to the accessible name — for a menu that is the point of its corner rather than an overflow for a row that already says what it acts on — and `variant` puts the trigger on any `Button` variant, so a menu handing work to the assistant can wear the assistant ground rather than the overflow-kebab outline. An item's `icon` leads its label: every caller's names the action itself — copy, open, delete — and an icon that is part of an item's identity belongs where the eye starts rather than right-aligned, where it reads as a status column. The menu is Figma's `Dropdown Component - Options List`: a fixed sized to its widest item between a 180px floor and the 280px Figma draws, by default under the trigger's right edge, 14px below it, flipping above or clamping sideways when the viewport has no room, rounding at the library's 12px and padding wider (8px) than the menu a `Dropdown` opens. Items read in the primary text colour, or the secondary one with `tone="muted"` (e.g. a sidebar's menus); destructive ones in red; `danger: 'hover'` keeps an item in its normal colour and turns it destructive (red text on a light red ground) only on hover or keyboard focus, for an action like signing out. A ceiling rather than a flat width: taken literally it gave a menu of four short verbs 130px of air and made every kebab in an app the same width whatever it held. `minWidth` only raises it above that ceiling, so it is the one way to go past 280px, and a label too long for the box truncates rather than wrapping. _Key props:_ `ActionMenuItem[]`, `size`, `label`, `triggerIcon`, `minWidth`, `showLabel`, `variant`, `tone` (`default` | `muted`), `trigger` (your own control in place of the kebab, cloned with the menu's ref and aria state), `placement` (`bottom-end` default | `bottom-start` | `right-start` | `top-start` | `top-center`), `offset` (`small` 8px | `medium` 12px | `large` 14px; applies to every placement; without it the default `bottom-end` keeps the options menu's 14px and the others use 8px). An item's `tag` (e.g. an "Early access" `Tag`) follows its label in a lazily loaded shadow host of its own, since the menu renders into `document.body`, and joins its accessible name; `current: true` marks the item for the page the user is on (`aria-current="page"` and the selected row paint; a `danger` item keeps its red text). An item with `type: 'text'` is context rather than an action (an account's email above its actions): secondary text the arrow keys skip. Opened from the keyboard, focus lands on the first item; Up/Down/Home/End move through enabled items, Tab closes the menu and moves on as usual; Escape or a picked item returns focus to the trigger.
62
62
  - **`NavItem`** — A row in an app's side navigation. Idle rows read secondary and take the list hover; the `active` row wears the accent tint and sets `aria-current="page"` on a link. `collapsed` shrinks it to a 36px icon tile whose label becomes the accessible name and a right-hand tooltip, with any `badge` pinned to the tile's corner. `variant="subitem"` indents a child row behind a dot instead of an icon; `disclosure` makes a group header button with `aria-expanded` and a rotating chevron, and `hasActiveChild` colours its text while a child is current. Renders an `<a>` with `href`, the element passed with `asChild` (a router `Link`), or a `<button>`, and forwards its ref and extra attributes so it can be a `Popover` or `ActionMenu` trigger. _Key props:_ `label`, `icon`, `active`, `hasActiveChild`, `collapsed`, `variant` (`item` | `subitem`), `danger`, `trailing`, `badge`, `disclosure` (`expanded` | `collapsed`), `tooltip`, `accessibleLabel` (overrides the accessible name; collapsed it defaults to the tooltip text plus `badgeLabel`), `href`, `target`, `rel`, `onClick`, `asChild` + `children`, `className`, `size` (`medium` | `small`, the tighter row for lists inside a popover), `tag` (beside the label, e.g. early access), `badgeLabel` (read in place of the badge and added to the collapsed name). A passed `aria-expanded` (e.g. from a `Popover`) wins over `disclosure`, and a button row forwards a passed `aria-current`.
63
- - **`Sidebar`** — An app's left navigation shell, pinned to the viewport's left edge: 260px wide, 60px `collapsed`, on the sunken page background. Composed from `Sidebar.Header` (a 56px band for `Sidebar.Switcher`, the logo + workspace + parent trigger), `Sidebar.Body` (the part that scrolls), `Sidebar.Notices`, `Sidebar.Search`, `Sidebar.Section` (rows of `NavItem`s at the gutter), `Sidebar.Group` + `Sidebar.GroupItems` (a disclosure header and its sub-items), `Sidebar.Divider`, `Sidebar.Usage` (a `UsageCard` placed at the sidebar's gutter) and `Sidebar.Footer` holding `Sidebar.Account`. Popovers opened from it (with `padding="none"`) wrap their body in `Sidebar.Panel`, sized so the popover comes to `SIDEBAR_POPOVER_WIDTH_PX`, and build it from the `Popover` parts. `onToggleCollapse` adds the edge toggle, shown in CSS while the pointer is over the sidebar or a keyboard focus is inside it. Notices, the divider and the usage card hide while collapsed. _Key props:_ `collapsed`, `onToggleCollapse`, `expandLabel`, `collapseLabel`, `aria-label`; `Sidebar.Switcher`: `logo`, `title`, `subtitle` + button attributes; `Sidebar.Account`: `avatar` or `initials` (a small chip when there is no photo), `name`, `tooltip` (the tooltip on the collapsed rail, `name` by default; pass a node to wrap it, e.g. to keep it out of session recordings) + button attributes; `Sidebar.Usage`: the `UsageCard` props; `Sidebar.Notices`: `aria-label` (required). `useSidebarCollapsed()` reads the state from inside; `SIDEBAR_WIDTH_PX` gives the page its offset beside the sidebar.
63
+ - **`Sidebar`** — An app's left navigation shell, pinned to the viewport's left edge: 260px wide, 60px `collapsed`, on the sunken page background. Composed from `Sidebar.Header` (a 56px band for `Sidebar.Switcher`, the logo + workspace + parent trigger), `Sidebar.Body` (the part that scrolls), `Sidebar.Notices`, `Sidebar.Search`, `Sidebar.Section` (rows of `NavItem`s at the gutter), `Sidebar.Group` + `Sidebar.GroupItems` (a disclosure header and its sub-items), `Sidebar.Divider`, `Sidebar.Usage` (a `UsageCard` placed at the sidebar's gutter) and `Sidebar.Footer` holding `Sidebar.Account`. Popovers opened from it (with `padding="none"`) wrap their body in `Sidebar.Panel`, sized so the popover comes to `SIDEBAR_POPOVER_WIDTH_PX`, and build it from the `Popover` parts. `onToggleCollapse` adds the edge toggle, shown in CSS while the pointer is over the sidebar or a keyboard focus is inside it. Notices, the divider and the usage card hide while collapsed. Render it inside `<MalachiteContext layer="sidebar">`, or the page paints over the edge toggle. _Key props:_ `collapsed`, `onToggleCollapse`, `expandLabel`, `collapseLabel`, `aria-label`; `Sidebar.Switcher`: `logo`, `title`, `subtitle` + button attributes; `Sidebar.Account`: `avatar` or `initials` (a small chip when there is no photo), `name`, `tooltip` (the tooltip on the collapsed rail, `name` by default; pass a node to wrap it, e.g. to keep it out of session recordings) + button attributes; `Sidebar.Usage`: the `UsageCard` props; `Sidebar.Notices`: `aria-label` (required). `useSidebarCollapsed()` reads the state from inside; `SIDEBAR_WIDTH_PX` gives the page its offset beside the sidebar.
64
64
  - **`SearchTrigger`** — A button drawn as a filled search field, for opening a command palette or search dialog from app chrome such as a sidebar. It is not an input — typing happens in what it opens. `shortcut` draws flat `<kbd>` chips at the end (not `Keycap`, whose raised shadow reads as a second button inside a filled field), kept out of the accessible name; `iconOnly` makes a 36px icon tile matching a collapsed `NavItem`, named by `label`. _Key props:_ `label` (default `Search`), `shortcut` (`ReactNode[]`), `iconOnly`, `aria-label`, `className`, plus native button attributes (`onClick`, `aria-haspopup`, `aria-expanded`, `aria-keyshortcuts`).
65
65
  - **`FooterNav`** — Footer navigation bar of links. _Key props:_ `FooterNavLink[]`.
66
66
  - **`FooterLinks`** — Inline list of footer links (e.g. terms, privacy, support).
@@ -116,7 +116,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
116
116
 
117
117
  ## Theming & utility
118
118
 
119
- - **`MalachiteContext`** — Wraps a subtree in the shadow root + theme context. Wrap groups of components in this.
119
+ - **`MalachiteContext`** — Wraps a subtree in the shadow root + theme context. Wrap groups of components in this. _Key props:_ `className`, `fillHeight`, `layer` (`'page'` by default; `'sidebar'` lifts the host above the page for a `Sidebar`)
120
120
  - **`ThemeScope`** — Pins a subtree to a fixed theme (e.g. a dark island in a light app) via its own shadow root, since theme tokens are scoped per shadow root.
121
121
  - **`CustomIcons`** — Namespace of all built-in icons (`CustomIcons.<Name>Icon`), coloured via `currentColor`.
122
122
  - **`ShadowEscape`** — Renders children into the document (escaping the shadow root) for portals/overlays.
@@ -1,18 +1,23 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import { ShadowRootWrapper as h } from "../ShadowRootWrapper.js";
3
- const i = ({
4
- children: r,
5
- className: e = "",
6
- fillHeight: o = !1
2
+ import { ShadowRootWrapper as i } from "../ShadowRootWrapper.js";
3
+ import { SIDEBAR_Z_INDEX as p } from "./sidebarContext.js";
4
+ const s = {
5
+ page: {},
6
+ sidebar: { position: "relative", zIndex: p }
7
+ }, m = ({
8
+ children: e,
9
+ className: r = "",
10
+ fillHeight: o = !1,
11
+ layer: a = "page"
7
12
  }) => /* @__PURE__ */ t(
8
- h,
13
+ i,
9
14
  {
10
15
  fillHeight: o,
11
- hostStyle: o ? { height: "100%" } : void 0,
12
- children: /* @__PURE__ */ t("div", { className: e, style: o ? { height: "100%" } : void 0, children: r })
16
+ hostStyle: { ...s[a], ...o ? { height: "100%" } : {} },
17
+ children: /* @__PURE__ */ t("div", { className: r, style: o ? { height: "100%" } : void 0, children: e })
13
18
  }
14
19
  );
15
20
  export {
16
- i as MalachiteContext
21
+ m as MalachiteContext
17
22
  };
18
23
  //# sourceMappingURL=MalachiteContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MalachiteContext.js","sources":["../../src/components/MalachiteContext.tsx"],"sourcesContent":["import React from 'react';\nimport { ShadowRootWrapper } from '../ShadowRootWrapper';\n\ninterface MalachiteContextProps {\n children: React.ReactNode;\n className?: string;\n /**\n * Stretches the shadow host, and every plain div between it and `children`, to 100% of\n * the height available from this component's own parent. Without it, the host sizes to\n * its content: a percentage height set further down (inside `children`) has nothing\n * non-`auto` to resolve against, and a chain of plain `<div>`s does not propagate a\n * parent's height to its children on its own. Off by default: every existing consumer\n * relies on the host hugging its content, and turning this on for all of them would\n * change how much space they take up.\n */\n fillHeight?: boolean;\n}\n\n/**\n * MalachiteContext provides a Shadow DOM context with theme setup for Malachite components.\n * Use this to wrap groups of Malachite components instead of each component managing its own Shadow DOM.\n *\n * @example\n * <MalachiteContext>\n * <Button variant=\"filled\">Click me</Button>\n * <Card>\n * <CardContent>Hello world</CardContent>\n * </Card>\n * </MalachiteContext>\n */\nexport const MalachiteContext: React.FC<MalachiteContextProps> = ({\n children,\n className = '',\n fillHeight = false,\n}) => {\n return (\n <ShadowRootWrapper\n fillHeight={fillHeight}\n hostStyle={fillHeight ? { height: '100%' } : undefined}\n >\n <div className={className} style={fillHeight ? { height: '100%' } : undefined}>\n {children}\n </div>\n </ShadowRootWrapper>\n );\n};\n\nexport default MalachiteContext;\n"],"names":["MalachiteContext","children","className","fillHeight","jsx","ShadowRootWrapper"],"mappings":";;AA8BO,MAAMA,IAAoD,CAAC;AAAA,EAC9D,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,YAAAC,IAAa;AACjB,MAEQ,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACG,YAAAF;AAAA,IACA,WAAWA,IAAa,EAAE,QAAQ,WAAW;AAAA,IAE7C,UAAA,gBAAAC,EAAC,OAAA,EAAI,WAAAF,GAAsB,OAAOC,IAAa,EAAE,QAAQ,WAAW,QAC/D,UAAAF,EAAA,CACL;AAAA,EAAA;AAAA;"}
1
+ {"version":3,"file":"MalachiteContext.js","sources":["../../src/components/MalachiteContext.tsx"],"sourcesContent":["import React from 'react';\nimport { ShadowRootWrapper } from '../ShadowRootWrapper';\nimport { SIDEBAR_Z_INDEX } from './sidebarContext';\n\ntype MalachiteLayer = 'page' | 'sidebar';\n\nconst LAYER_HOST_STYLE: Record<MalachiteLayer, React.CSSProperties> = {\n page: {},\n sidebar: { position: 'relative', zIndex: SIDEBAR_Z_INDEX },\n};\n\ninterface MalachiteContextProps {\n children: React.ReactNode;\n className?: string;\n /**\n * Stretches the shadow host, and every plain div between it and `children`, to 100% of\n * the height available from this component's own parent. Without it, the host sizes to\n * its content: a percentage height set further down (inside `children`) has nothing\n * non-`auto` to resolve against, and a chain of plain `<div>`s does not propagate a\n * parent's height to its children on its own. Off by default: every existing consumer\n * relies on the host hugging its content, and turning this on for all of them would\n * change how much space they take up.\n */\n fillHeight?: boolean;\n /**\n * Where the shadow host sits in the page's stacking order. The shadow tree is isolated, so\n * a z-index inside it never reaches the page: wrap a `Sidebar` in `layer=\"sidebar\"`, or the\n * page paints over its edge toggle and anything else that overhangs it.\n */\n layer?: MalachiteLayer;\n}\n\n/**\n * MalachiteContext provides a Shadow DOM context with theme setup for Malachite components.\n * Use this to wrap groups of Malachite components instead of each component managing its own Shadow DOM.\n *\n * @example\n * <MalachiteContext>\n * <Button variant=\"filled\">Click me</Button>\n * <Card>\n * <CardContent>Hello world</CardContent>\n * </Card>\n * </MalachiteContext>\n */\nexport const MalachiteContext: React.FC<MalachiteContextProps> = ({\n children,\n className = '',\n fillHeight = false,\n layer = 'page',\n}) => {\n return (\n <ShadowRootWrapper\n fillHeight={fillHeight}\n hostStyle={{ ...LAYER_HOST_STYLE[layer], ...(fillHeight ? { height: '100%' } : {}) }}\n >\n <div className={className} style={fillHeight ? { height: '100%' } : undefined}>\n {children}\n </div>\n </ShadowRootWrapper>\n );\n};\n\nexport default MalachiteContext;\n"],"names":["LAYER_HOST_STYLE","SIDEBAR_Z_INDEX","MalachiteContext","children","className","fillHeight","layer","jsx","ShadowRootWrapper"],"mappings":";;;AAMA,MAAMA,IAAgE;AAAA,EAClE,MAAM,CAAA;AAAA,EACN,SAAS,EAAE,UAAU,YAAY,QAAQC,EAAA;AAC7C,GAmCaC,IAAoD,CAAC;AAAA,EAC9D,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,YAAAC,IAAa;AAAA,EACb,OAAAC,IAAQ;AACZ,MAEQ,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACG,YAAAH;AAAA,IACA,WAAW,EAAE,GAAGL,EAAiBM,CAAK,GAAG,GAAID,IAAa,EAAE,QAAQ,OAAA,IAAW,GAAC;AAAA,IAEhF,UAAA,gBAAAE,EAAC,OAAA,EAAI,WAAAH,GAAsB,OAAOC,IAAa,EAAE,QAAQ,WAAW,QAC/D,UAAAF,EAAA,CACL;AAAA,EAAA;AAAA;"}
@@ -1,28 +1,28 @@
1
- import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
- import { useRef as Ie, useId as ve } from "react";
1
+ import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
+ import { useRef as ve, useId as Se } from "react";
3
3
  import { Button as ye } from "./Button.js";
4
- import Se from "./CustomIcons/DismissIcon.js";
4
+ import Ae from "./CustomIcons/DismissIcon.js";
5
5
  import Ne from "./CustomIcons/PinIcon.js";
6
- import { Tag as Ae } from "./Tag.js";
6
+ import { Tag as Le } from "./Tag.js";
7
7
  import Ce from "./Tooltip.js";
8
8
  import Q from "./TruncatedTooltip.js";
9
9
  import p from "./Typography/Text.js";
10
- import { useCardStripSlot as Le } from "./cardStripSlot.js";
11
- import { FOCUS_RING_WITHIN as Oe } from "./focusRing.js";
12
- import { useAdoptedStyleSheet as De } from "./useAdoptedStyleSheet.js";
13
- const F = 240, ee = `${F}px`, te = "116px", le = "var(--malachite-radius-xxl, 14px)", O = `${le} ${le} 0 0`, b = "var(--malachite-selectable-card-muted-foreground, #7b7b7b)", Pe = "var(--malachite-text-secondary, #7b7b7b)", de = "var(--malachite-selectable-card-accent, #047b43)", ke = "var(--malachite-selectable-card-selected-tint, #e7f8f1)", Be = "var(--malachite-selectable-card-selected-border, #047b43)", ae = 0.7, Fe = "var(--malachite-selectable-card-library-selected-tint, #f1f1f1)", we = "var(--malachite-selectable-card-library-selected-border, #bbbbbb)", pe = "var(--malachite-selectable-card-pending-foreground, #96580a)", he = "var(--malachite-selectable-card-editing-tint, #f9f2e9)", se = "var(--malachite-selectable-card-selected-surface-end, #ffffff)", Ue = "var(--malachite-selectable-card-background, #f1f1f1)", Ye = "1px solid var(--malachite-selectable-card-border, #dddddd)", ze = "var(--malachite-selectable-card-hover-background, #e8e8e8)", Ge = 14, s = Ge, E = 2, fe = 116, We = 14, me = 2, Tt = s - E / 2, x = F + s * 2, T = fe + me + E, He = (l) => {
14
- const t = E / 2, a = s + t, c = s + F - t, i = t, r = We - t;
10
+ import { useCardStripSlot as Oe } from "./cardStripSlot.js";
11
+ import { FOCUS_RING_WITHIN as De } from "./focusRing.js";
12
+ import { useAdoptedStyleSheet as Pe } from "./useAdoptedStyleSheet.js";
13
+ const F = 240, ee = `${F}px`, te = "116px", ae = "var(--malachite-radius-xxl, 14px)", O = `${ae} ${ae} 0 0`, b = "var(--malachite-selectable-card-muted-foreground, #7b7b7b)", ke = "var(--malachite-text-secondary, #7b7b7b)", de = "var(--malachite-selectable-card-accent, #047b43)", Be = "var(--malachite-selectable-card-selected-tint, #e7f8f1)", Fe = "var(--malachite-selectable-card-selected-border, #047b43)", le = 0.7, we = "var(--malachite-selectable-card-library-selected-tint, #f1f1f1)", Ye = "var(--malachite-selectable-card-library-selected-border, #bbbbbb)", pe = "var(--malachite-selectable-card-pending-foreground, #96580a)", he = "var(--malachite-selectable-card-editing-tint, #f9f2e9)", se = "var(--malachite-selectable-card-selected-surface-end, #ffffff)", Ue = "var(--malachite-selectable-card-background, #f1f1f1)", Ge = "1px solid var(--malachite-selectable-card-border, #dddddd)", ze = "var(--malachite-selectable-card-hover-background, #e8e8e8)", We = 14, s = We, E = 2, me = 116, He = 14, fe = 2, It = s - E / 2, x = F + s * 2, g = me + fe + E, je = (t) => {
14
+ const a = E / 2, l = s + a, c = s + F - a, i = a, r = He - a;
15
15
  return [
16
- `M${a - s} ${l}`,
17
- `A${s} ${s} 0 0 0 ${a} ${l - s}`,
18
- `L${a} ${i + r}`,
19
- `A${r} ${r} 0 0 1 ${a + r} ${i}`,
16
+ `M${l - s} ${t}`,
17
+ `A${s} ${s} 0 0 0 ${l} ${t - s}`,
18
+ `L${l} ${i + r}`,
19
+ `A${r} ${r} 0 0 1 ${l + r} ${i}`,
20
20
  `L${c - r} ${i}`,
21
21
  `A${r} ${r} 0 0 1 ${c} ${i + r}`,
22
- `L${c} ${l - s}`,
23
- `A${s} ${s} 0 0 0 ${c + s} ${l}`
22
+ `L${c} ${t - s}`,
23
+ `A${s} ${s} 0 0 0 ${c + s} ${t}`
24
24
  ].join(" ");
25
- }, B = He(fe + me / 2), re = `${B} Z`, I = "malachite-selectable-card-outline", n = "malachite-selectable-card", je = "malachite-selectable-card-style", f = "--malachite-selectable-card-state-outline", m = "--malachite-selectable-card-state-tint", D = {
25
+ }, B = je(me + fe / 2), re = `${B} Z`, v = "malachite-selectable-card-outline", o = "malachite-selectable-card", Xe = "malachite-selectable-card-style", m = "--malachite-selectable-card-state-outline", f = "--malachite-selectable-card-state-tint", D = {
26
26
  "background-color": ze,
27
27
  "border-left-color": "transparent"
28
28
  }, P = {
@@ -32,41 +32,41 @@ const F = 240, ee = `${F}px`, te = "116px", le = "var(--malachite-radius-xxl, 14
32
32
  resting: P,
33
33
  hover: D,
34
34
  selected: {
35
- [f]: Be,
36
- [m]: ke
35
+ [m]: Fe,
36
+ [f]: Be
37
37
  }
38
38
  },
39
39
  library: {
40
40
  resting: P,
41
41
  hover: D,
42
42
  selected: {
43
- [f]: we,
44
- [m]: Fe
43
+ [m]: Ye,
44
+ [f]: we
45
45
  }
46
46
  },
47
47
  editing: {
48
48
  resting: P,
49
49
  hover: D,
50
50
  selected: {
51
- [f]: pe,
52
- [m]: he
51
+ [m]: pe,
52
+ [f]: he
53
53
  }
54
54
  }
55
- }, g = { color: Pe }, Xe = {
55
+ }, I = { color: ke }, Me = {
56
56
  profile: {
57
- resting: g,
58
- selected: { color: de, opacity: ae }
57
+ resting: I,
58
+ selected: { color: de, opacity: le }
59
59
  },
60
- library: { resting: g, selected: g },
60
+ library: { resting: I, selected: I },
61
61
  editing: {
62
- resting: g,
63
- selected: { color: pe, opacity: ae }
62
+ resting: I,
63
+ selected: { color: pe, opacity: le }
64
64
  }
65
- }, Me = { "border-left": Ye }, Ke = `
66
- .${n}[data-state='selected'] {
65
+ }, Ke = { "border-left": Ge }, Ze = `
66
+ .${o}[data-state='selected'] {
67
67
  z-index: 5;
68
68
  }
69
- .${n} > .${I} {
69
+ .${o} > .${v} {
70
70
  position: absolute;
71
71
  left: -${s}px;
72
72
  top: 0;
@@ -74,109 +74,122 @@ const F = 240, ee = `${F}px`, te = "116px", le = "var(--malachite-radius-xxl, 14
74
74
  overflow: visible;
75
75
  pointer-events: none;
76
76
  }
77
- .${n} > *:not(.${I}):not([data-selectable-card-actions]) {
77
+ .${o} > *:not(.${v}):not([data-selectable-card-actions]) {
78
78
  position: relative;
79
79
  z-index: 1;
80
80
  }
81
- .${n} > [data-selectable-card-actions] {
81
+ .${o} > [data-selectable-card-actions] {
82
82
  z-index: 2;
83
- }`, be = (l) => Object.entries(l).map(([t, a]) => ` ${t}: ${a};`).join(`
84
- `), Ze = (l, t) => t === "hover" ? `.${n}[data-variant='${l}'][data-state='resting'][data-hoverable]:hover` : `.${n}[data-variant='${l}'][data-state='${t}']`, Ve = (l, t, a) => `${Ze(l, t)} {
85
- ${be(a)}
86
- }`, qe = Object.keys(k).flatMap(
87
- (l) => Object.keys(k[l]).map(
88
- (t) => Ve(l, t, k[l][t])
83
+ }`, be = (t) => Object.entries(t).map(([a, l]) => ` ${a}: ${l};`).join(`
84
+ `), Ve = (t, a) => a === "hover" ? `.${o}[data-variant='${t}'][data-state='resting'][data-hoverable]:hover` : `.${o}[data-variant='${t}'][data-state='${a}']`, qe = (t, a, l) => `${Ve(t, a)} {
85
+ ${be(l)}
86
+ }`, Je = Object.keys(k).flatMap(
87
+ (t) => Object.keys(k[t]).map(
88
+ (a) => qe(t, a, k[t][a])
89
89
  )
90
90
  ).join(`
91
- `), Je = `.${n}[data-pinned='false'][data-state='resting'] {
91
+ `), Qe = `.${o}[data-pinned='false'][data-state='resting'] {
92
92
  ${be(
93
- Me
93
+ Ke
94
94
  )}
95
- }`, Qe = `${Je}
96
- ${qe}
97
- ${Ke}`, et = {
95
+ }`, et = `${Qe}
96
+ ${Je}
97
+ ${Ze}`, tt = {
98
98
  display: "-webkit-box",
99
99
  WebkitLineClamp: 2,
100
100
  WebkitBoxOrient: "vertical",
101
101
  overflow: "hidden",
102
102
  color: b,
103
103
  lineHeight: 1.6
104
- }, tt = { color: b, letterSpacing: "0.11px" }, w = "var(--malachite-selectable-card-pending-foreground, #96580a)", lt = { color: w }, at = { color: w, opacity: 0.7 }, st = 36, rt = 38, oe = {
105
- color: "var(--malachite-text-primary)"
106
- }, ot = "inline-flex items-center justify-center [&_svg]:size-[10px]!", nt = { color: b }, ne = "Default profile", it = 16, ct = {
104
+ }, at = { color: b, letterSpacing: "0.11px" }, w = "var(--malachite-selectable-card-pending-foreground, #96580a)", lt = { color: w }, st = { color: w, opacity: 0.7 }, rt = 36, nt = 38, ne = {
105
+ color: "var(--malachite-text-primary)",
106
+ marginLeft: -2.25
107
+ }, ot = { transform: "translateY(-1px)" }, it = "inline-flex items-center justify-center [&_svg]:size-[10px]!", ct = { color: b }, oe = "Default profile", dt = 16, Ee = {
107
108
  color: de,
108
- display: "inline-flex"
109
- }, ie = () => /* @__PURE__ */ e(Ce, { text: ne, triggerAs: "span", describesTrigger: !1, children: /* @__PURE__ */ e("span", { role: "img", "aria-label": ne, style: ct, children: /* @__PURE__ */ e(Ne, { size: it }) }) }), ce = (l) => {
110
- const t = l.filter((a) => a !== void 0);
111
- return t.length > 0 ? t.join(" ") : void 0;
112
- }, gt = ({
113
- value: l,
114
- title: t,
115
- titleIcon: a,
109
+ display: "inline-flex",
110
+ transform: "rotate(45deg)"
111
+ }, pt = {
112
+ ...Ee,
113
+ marginLeft: -3
114
+ }, ie = ({ leading: t }) => /* @__PURE__ */ e(Ce, { text: oe, triggerAs: "span", describesTrigger: !1, children: /* @__PURE__ */ e(
115
+ "span",
116
+ {
117
+ role: "img",
118
+ "aria-label": oe,
119
+ style: t ? pt : Ee,
120
+ children: /* @__PURE__ */ e(Ne, { size: dt })
121
+ }
122
+ ) }), ce = (t) => {
123
+ const a = t.filter((l) => l !== void 0);
124
+ return a.length > 0 ? a.join(" ") : void 0;
125
+ }, vt = ({
126
+ value: t,
127
+ title: a,
128
+ titleIcon: l,
116
129
  isDefault: c = !1,
117
130
  variant: i = "profile",
118
131
  eyebrow: r,
119
132
  status: _,
120
- description: v,
133
+ description: S,
121
134
  countLabel: y,
122
- actions: S,
123
- onDismiss: R,
124
- dismissLabel: U = "Dismiss",
125
- dismissDisabledReason: Y,
135
+ actions: R,
136
+ onDismiss: $,
137
+ dismissLabel: Y = "Dismiss",
138
+ dismissDisabledReason: U,
126
139
  selected: d = !1,
127
- loading: Ee = !1,
128
- loadingLabel: _e = "Loading…",
129
- loadingHint: z,
130
- disabled: $ = !1,
131
- dimmed: G = !1,
132
- onSelect: N,
133
- tabIndex: Re,
140
+ loading: _e = !1,
141
+ loadingLabel: Re = "Loading…",
142
+ loadingHint: G,
143
+ disabled: T = !1,
144
+ dimmed: z = !1,
145
+ onSelect: A,
146
+ tabIndex: $e,
134
147
  "aria-label": W,
135
148
  className: H = "",
136
149
  style: j
137
150
  }) => {
138
- const { pinned: $e } = Le(), ue = !d && !$, A = Ie(null);
139
- De(A, Qe, je);
140
- const h = `mal-selectable-card-${ve().replace(/[^a-zA-Z0-9_-]/g, "")}`, u = `${h}-outline`, X = `${h}-eyebrow`, M = `${h}-status`, C = `${h}-title`, K = `${h}-description`, Z = `${h}-count`, xe = W ? void 0 : ce([r ? X : void 0, C, _ ? M : void 0]), Te = ce([
141
- v ? K : void 0,
151
+ const { pinned: Te } = Oe(), ue = !d && !T, N = ve(null);
152
+ Pe(N, et, Xe);
153
+ const h = `mal-selectable-card-${Se().replace(/[^a-zA-Z0-9_-]/g, "")}`, u = `${h}-outline`, X = `${h}-eyebrow`, M = `${h}-status`, L = `${h}-title`, K = `${h}-description`, Z = `${h}-count`, xe = W ? void 0 : ce([r ? X : void 0, L, _ ? M : void 0]), ge = ce([
154
+ S ? K : void 0,
142
155
  y ? Z : void 0
143
156
  ]);
144
- if (Ee)
145
- return /* @__PURE__ */ o(
157
+ if (_e)
158
+ return /* @__PURE__ */ n(
146
159
  "div",
147
160
  {
148
- ref: A,
161
+ ref: N,
149
162
  role: "status",
150
163
  "aria-busy": "true",
151
164
  "aria-live": "polite",
152
165
  "data-variant": "editing",
153
166
  "data-state": "selected",
154
- className: `${n} relative flex shrink-0 flex-col items-center gap-2 px-5 text-center ${H}`.trim(),
167
+ className: `${o} relative flex shrink-0 flex-col items-center gap-2 px-5 text-center ${H}`.trim(),
155
168
  style: {
156
169
  width: ee,
157
170
  height: te,
158
171
  borderRadius: O,
159
172
  boxSizing: "border-box",
160
- paddingTop: `${st}px`,
161
- paddingBottom: `${rt}px`,
173
+ paddingTop: `${rt}px`,
174
+ paddingBottom: `${nt}px`,
162
175
  justifyContent: "center",
163
- [f]: w,
164
- [m]: he,
176
+ [m]: w,
177
+ [f]: he,
165
178
  ...j
166
179
  },
167
180
  children: [
168
- /* @__PURE__ */ o(
181
+ /* @__PURE__ */ n(
169
182
  "svg",
170
183
  {
171
- className: I,
184
+ className: v,
172
185
  width: x,
173
- height: T,
174
- viewBox: `0 0 ${x} ${T}`,
186
+ height: g,
187
+ viewBox: `0 0 ${x} ${g}`,
175
188
  fill: "none",
176
189
  "aria-hidden": "true",
177
190
  children: [
178
- /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ o("linearGradient", { id: u, x1: "0", y1: "0", x2: "0", y2: "1", children: [
179
- /* @__PURE__ */ e("stop", { offset: "0", style: { stopColor: `var(${m})` } }),
191
+ /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ n("linearGradient", { id: u, x1: "0", y1: "0", x2: "0", y2: "1", children: [
192
+ /* @__PURE__ */ e("stop", { offset: "0", style: { stopColor: `var(${f})` } }),
180
193
  /* @__PURE__ */ e("stop", { offset: "1", style: { stopColor: se } })
181
194
  ] }) }),
182
195
  /* @__PURE__ */ e(
@@ -193,27 +206,27 @@ ${Ke}`, et = {
193
206
  d: B,
194
207
  "data-malachite-shape": "",
195
208
  strokeWidth: E,
196
- style: { fill: "none", stroke: `var(${f})` }
209
+ style: { fill: "none", stroke: `var(${m})` }
197
210
  }
198
211
  )
199
212
  ]
200
213
  }
201
214
  ),
202
- /* @__PURE__ */ e(p, { size: "small", fontWeight: "semi-bold", style: lt, children: _e }),
203
- z ? /* @__PURE__ */ e(p, { size: "xsmall", fontWeight: "semi-bold", style: at, children: z }) : null
215
+ /* @__PURE__ */ e(p, { size: "small", fontWeight: "semi-bold", style: lt, children: Re }),
216
+ G ? /* @__PURE__ */ e(p, { size: "xsmall", fontWeight: "semi-bold", style: st, children: G }) : null
204
217
  ]
205
218
  }
206
219
  );
207
- const L = i === "library", V = Xe[i][d ? "selected" : "resting"], q = !!S || !!R, J = Y !== void 0, ge = S && R ? "pr-[56px]" : q ? "pr-[26px]" : "pr-1";
208
- return /* @__PURE__ */ o(
220
+ const C = i === "library", V = Me[i][d ? "selected" : "resting"], q = !!R || !!$, J = U !== void 0, Ie = R && $ ? "pr-[48px]" : q ? "pr-[18px]" : "pr-1";
221
+ return /* @__PURE__ */ n(
209
222
  "div",
210
223
  {
211
- ref: A,
224
+ ref: N,
212
225
  "data-variant": i,
213
- "data-pinned": $e ? "true" : "false",
226
+ "data-pinned": Te ? "true" : "false",
214
227
  "data-state": d ? "selected" : "resting",
215
228
  "data-hoverable": ue ? "" : void 0,
216
- className: `${n} group relative grid shrink-0 grid-rows-[1fr_auto] ${Oe} ${H}`.trim(),
229
+ className: `${o} group relative grid shrink-0 grid-rows-[1fr_auto] ${De} ${H}`.trim(),
217
230
  style: {
218
231
  width: ee,
219
232
  height: te,
@@ -222,18 +235,18 @@ ${Ke}`, et = {
222
235
  ...j
223
236
  },
224
237
  children: [
225
- d ? /* @__PURE__ */ o(
238
+ d ? /* @__PURE__ */ n(
226
239
  "svg",
227
240
  {
228
- className: I,
241
+ className: v,
229
242
  width: x,
230
- height: T,
231
- viewBox: `0 0 ${x} ${T}`,
243
+ height: g,
244
+ viewBox: `0 0 ${x} ${g}`,
232
245
  fill: "none",
233
246
  "aria-hidden": "true",
234
247
  children: [
235
- /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ o("linearGradient", { id: u, x1: "0", y1: "0", x2: "0", y2: "1", children: [
236
- /* @__PURE__ */ e("stop", { offset: "0", style: { stopColor: `var(${m})` } }),
248
+ /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ n("linearGradient", { id: u, x1: "0", y1: "0", x2: "0", y2: "1", children: [
249
+ /* @__PURE__ */ e("stop", { offset: "0", style: { stopColor: `var(${f})` } }),
237
250
  /* @__PURE__ */ e("stop", { offset: "1", style: { stopColor: se } })
238
251
  ] }) }),
239
252
  /* @__PURE__ */ e(
@@ -250,54 +263,54 @@ ${Ke}`, et = {
250
263
  d: B,
251
264
  "data-malachite-shape": "",
252
265
  strokeWidth: E,
253
- style: { fill: "none", stroke: `var(${f})` }
266
+ style: { fill: "none", stroke: `var(${m})` }
254
267
  }
255
268
  )
256
269
  ]
257
270
  }
258
271
  ) : null,
259
- /* @__PURE__ */ o(
272
+ /* @__PURE__ */ n(
260
273
  "button",
261
274
  {
262
275
  type: "button",
263
276
  role: "radio",
264
- "data-value": l,
277
+ "data-value": t,
265
278
  "aria-checked": d,
266
279
  "aria-label": W,
267
280
  "aria-labelledby": xe,
268
- "aria-describedby": Te,
269
- "aria-disabled": $ || void 0,
270
- tabIndex: Re ?? (d ? 0 : -1),
281
+ "aria-describedby": ge,
282
+ "aria-disabled": T || void 0,
283
+ tabIndex: $e ?? (d ? 0 : -1),
271
284
  onClick: () => {
272
- $ || d || N == null || N(l);
285
+ T || d || A == null || A(t);
273
286
  },
274
- className: `flex min-w-0 appearance-none flex-col border-0 bg-transparent py-0 pt-3 pr-4 pl-4 text-left outline-none ${$ ? "cursor-not-allowed" : "cursor-pointer"}`,
287
+ className: `flex min-w-0 appearance-none flex-col border-0 bg-transparent py-0 pt-3 pr-4 pl-4 text-left outline-none ${T ? "cursor-not-allowed" : "cursor-pointer"}`,
275
288
  style: { borderRadius: O },
276
289
  children: [
277
- /* @__PURE__ */ e("div", { className: `flex h-[13px] shrink-0 items-center gap-2 ${ge}`, children: /* @__PURE__ */ o("div", { className: "flex min-w-0 items-center gap-1.5", children: [
278
- L ? /* @__PURE__ */ o("span", { id: C, className: "flex min-w-0 items-center gap-1.5", children: [
279
- a ? /* @__PURE__ */ e(
290
+ /* @__PURE__ */ e("div", { className: `flex h-[13px] shrink-0 items-center gap-2 ${Ie}`, children: /* @__PURE__ */ n("div", { className: "flex min-w-0 items-center gap-1.5", children: [
291
+ C ? /* @__PURE__ */ n("span", { id: L, className: "flex min-w-0 items-center gap-1.5", children: [
292
+ l ? /* @__PURE__ */ e(
280
293
  "span",
281
294
  {
282
295
  className: "flex shrink-0 items-center",
283
- style: oe,
284
- children: a
296
+ style: ne,
297
+ children: l
285
298
  }
286
299
  ) : null,
287
- c ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: /* @__PURE__ */ e(ie, {}) }) : null,
288
- /* @__PURE__ */ e(Q, { text: t, children: /* @__PURE__ */ e(
300
+ c ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: /* @__PURE__ */ e(ie, { leading: !l }) }) : null,
301
+ /* @__PURE__ */ e(Q, { text: a, children: /* @__PURE__ */ e(
289
302
  p,
290
303
  {
291
304
  size: "small",
292
305
  fontWeight: "semi-bold",
293
- style: G ? { color: b } : void 0,
294
- children: t
306
+ style: z ? { color: b } : void 0,
307
+ children: a
295
308
  }
296
309
  ) })
297
310
  ] }) : null,
298
311
  r ? /* @__PURE__ */ e("span", { id: X, className: "flex min-w-0", children: /* @__PURE__ */ e(p, { size: "xsmall", fontWeight: "semi-bold", style: V, children: r }) }) : null,
299
312
  _ ? /* @__PURE__ */ e("span", { id: M, className: "flex min-w-0", children: /* @__PURE__ */ e(
300
- Ae,
313
+ Le,
301
314
  {
302
315
  value: _.label,
303
316
  type: _.type ?? "default",
@@ -306,64 +319,64 @@ ${Ke}`, et = {
306
319
  }
307
320
  ) }) : null
308
321
  ] }) }),
309
- /* @__PURE__ */ o(
322
+ /* @__PURE__ */ n(
310
323
  "div",
311
324
  {
312
- className: `mt-[11px] flex min-w-0 flex-1 flex-col gap-1 pt-3 ${L ? "justify-end" : "justify-between"}`,
325
+ className: `mt-[11px] flex min-w-0 flex-1 flex-col gap-1 pt-3 ${C ? "justify-end" : "justify-between"}`,
313
326
  children: [
314
- L ? null : /* @__PURE__ */ o("div", { id: C, className: "flex min-w-0 items-center gap-1.5", children: [
315
- a ? /* @__PURE__ */ e(
327
+ C ? null : /* @__PURE__ */ n("div", { id: L, className: "flex min-w-0 items-center gap-1.5", children: [
328
+ l ? /* @__PURE__ */ e(
316
329
  "span",
317
330
  {
318
331
  className: "flex shrink-0 items-center",
319
- style: oe,
320
- children: a
332
+ style: ne,
333
+ children: l
321
334
  }
322
335
  ) : null,
323
- c ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: /* @__PURE__ */ e(ie, {}) }) : null,
324
- /* @__PURE__ */ e(Q, { text: t, children: /* @__PURE__ */ e(
336
+ c ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: /* @__PURE__ */ e(ie, { leading: !l }) }) : null,
337
+ /* @__PURE__ */ e(Q, { text: a, children: /* @__PURE__ */ e(
325
338
  p,
326
339
  {
327
340
  size: "small",
328
341
  fontWeight: "semi-bold",
329
- style: G ? { color: b } : void 0,
330
- children: t
342
+ style: z ? { color: b } : void 0,
343
+ children: a
331
344
  }
332
345
  ) })
333
346
  ] }),
334
- v ? /* @__PURE__ */ e("span", { id: K, className: "block min-w-0", children: /* @__PURE__ */ e(p, { size: "xsmall", style: et, children: v }) }) : null
347
+ S ? /* @__PURE__ */ e("span", { id: K, className: "block min-w-0", children: /* @__PURE__ */ e(p, { size: "xsmall", style: tt, children: S }) }) : null
335
348
  ]
336
349
  }
337
350
  )
338
351
  ]
339
352
  }
340
353
  ),
341
- /* @__PURE__ */ e("span", { id: Z, className: "min-w-0 self-end truncate pr-4 pb-3 pl-4", children: y ? /* @__PURE__ */ e(p, { size: "xsmall", fontWeight: "semi-bold", style: tt, children: y }) : null }),
342
- q ? /* @__PURE__ */ o(
354
+ /* @__PURE__ */ e("span", { id: Z, className: "min-w-0 self-end truncate pr-4 pb-3 pl-4", children: y ? /* @__PURE__ */ e(p, { size: "xsmall", fontWeight: "semi-bold", style: at, children: y }) : null }),
355
+ q ? /* @__PURE__ */ n(
343
356
  "div",
344
357
  {
345
358
  "data-selectable-card-actions": "",
346
- className: "absolute top-3 right-4 flex h-[13px] shrink-0 items-center gap-2.5",
359
+ className: "absolute top-3 right-2 flex h-[13px] shrink-0 items-center gap-2.5",
347
360
  children: [
348
- S,
349
- R ? /* @__PURE__ */ e(
361
+ R ? /* @__PURE__ */ e("span", { className: "flex items-center gap-2.5", style: ot, children: R }) : null,
362
+ $ ? /* @__PURE__ */ e(
350
363
  ye,
351
364
  {
352
365
  type: "button",
353
366
  variant: "ghost",
354
367
  size: "xsmall",
355
368
  iconOnly: !0,
356
- "aria-label": U,
357
- tooltip: Y ?? U,
369
+ "aria-label": Y,
370
+ tooltip: U ?? Y,
358
371
  disabled: J,
359
372
  className: "shrink-0",
360
- onClick: R,
373
+ onClick: $,
361
374
  children: /* @__PURE__ */ e(
362
375
  "span",
363
376
  {
364
- className: ot,
365
- style: J ? nt : V,
366
- children: /* @__PURE__ */ e(Se, {})
377
+ className: it,
378
+ style: J ? ct : V,
379
+ children: /* @__PURE__ */ e(Ae, {})
367
380
  }
368
381
  )
369
382
  }
@@ -376,12 +389,12 @@ ${Ke}`, et = {
376
389
  );
377
390
  };
378
391
  export {
379
- Ge as CARD_FLARE_PX,
380
- Tt as CARD_FLARE_TIP_PX,
392
+ We as CARD_FLARE_PX,
393
+ It as CARD_FLARE_TIP_PX,
381
394
  F as CARD_WIDTH_PX,
382
- I as FLARE_CLASS,
383
- me as STRIP_RULE_PX,
384
- gt as SelectableCard,
385
- gt as default
395
+ v as FLARE_CLASS,
396
+ fe as STRIP_RULE_PX,
397
+ vt as SelectableCard,
398
+ vt as default
386
399
  };
387
400
  //# sourceMappingURL=SelectableCard.js.map