@stackone/malachite 2.95.1 → 2.96.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 CHANGED
@@ -68,6 +68,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
68
68
  - **`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`).
69
69
  - **`FooterNav`** — Footer navigation bar of links. _Key props:_ `FooterNavLink[]`.
70
70
  - **`FooterLinks`** — Inline list of footer links (e.g. terms, privacy, support).
71
+ - **`StepList`** — A numbered, vertical list of setup steps: a marker per step joined by a line that turns solid once a step is complete, each step’s title and description, and an optional trailing action such as its button. Steps are `complete` (a tick on the accent fill), `open` (an accent ring) or `locked` (dimmed). The first open step carries `aria-current="step"`. `size="small"` is the compact list for a sidebar; `dividers` rules a line under each row for a list that fills its container. For a horizontal progress readout use `Stepper`; for a clickable step header use `StepTabs`. _Key props:_ `steps` (`key`, `title`, `description`, `status`, `action`), `size`, `dividers`, `aria-label`, `aria-labelledby`, `className`.
71
72
  - **`StepTabs`** — Header for a short, ordered flow — a two-step drawer or wizard panel. Each step is a button carrying `aria-current="step"`, not a tab: the body beneath is the step’s form, so it keeps the normal tab order instead of adopting a `tablist`’s arrow-key contract. States are current / complete (a check, still reachable so the user can go back) / upcoming. For a read-only progress readout use `Stepper`. _Key props:_ `items` (`key`, `label`, `hint`, `disabled`), `activeKey`, `completedKeys`, `onChange`, `aria-label`, `aria-labelledby`, `className`.
72
73
  - **`CommandPalette`** — Chrome for a command palette, over a headless library that keeps its own elements. `FieldRow`/`Field` take the query input, `List` the scrolling viewport (with a bottom fade for `hasMoreBelow`), `Group` + `Heading` a titled section, and `Row` one result — composing leading/label/tags/crumb/meta/status/hint so names start and statuses end on the same x down the list. `Message` covers empty and loading, `Legend` documents the scope sigils, `Footer` the key hints. Everything the library owns is taken through `asChild`, so its role, id, state and handlers are untouched.
73
74
  - **`Keycap`** — One key on a keyboard, drawn as a cap — `esc`, `⌘`, a caret, or a sigil a user types to scope a search. Renders a `<kbd>`, or a button as soon as either `onClick` or `disabled` is passed — `disabled={false}` included, since naming the prop at all is the statement that the cap is a control. `SidePanelNavFooter` is built on it.
@@ -0,0 +1,109 @@
1
+ import { jsx as a, jsxs as n } from "react/jsx-runtime";
2
+ import k from "./CustomIcons/CheckmarkIcon.js";
3
+ import p from "./Typography/Text.js";
4
+ import { isRenderableNode as b } from "./renderableNode.js";
5
+ const i = 24, x = 1, v = {
6
+ medium: { padding: { x: 28, y: 16 }, title: "medium", description: "small" },
7
+ small: { padding: { x: 20, y: 12 }, title: "small", description: "xsmall" }
8
+ }, S = {
9
+ complete: "Completed",
10
+ open: void 0,
11
+ locked: "Locked"
12
+ }, E = (t, r) => ({
13
+ insetInlineStart: t.x + i / 2 - 1,
14
+ top: t.y + i,
15
+ height: `calc(100% - ${i - (r ? x : 0)}px)`
16
+ }), c = "var(--malachite-card-border, rgb(232, 232, 232))", $ = "var(--malachite-accent-background, rgb(0, 175, 102))", N = `repeating-linear-gradient(to bottom, ${c} 0px, ${c} 4px, transparent 4px, transparent 8px)`, A = {
17
+ complete: "bg-[var(--malachite-accent-background,rgb(0,175,102))] text-white",
18
+ open: "border-[1.5px] border-solid border-[var(--malachite-accent-background,rgb(0,175,102))] bg-[var(--malachite-card-background,rgb(255,255,255))] text-[var(--malachite-accent-foreground,rgb(2,122,66))]",
19
+ locked: "border-[1.5px] border-solid border-[var(--malachite-text-dimmed,rgb(153,153,153))] bg-[var(--malachite-card-background,rgb(255,255,255))] text-[var(--malachite-text-dimmed,rgb(153,153,153))]"
20
+ }, I = (t, r) => t.key ?? `#${r}`, L = ({
21
+ steps: t,
22
+ size: r = "medium",
23
+ dividers: s = !1,
24
+ "aria-label": g,
25
+ "aria-labelledby": h,
26
+ className: u = ""
27
+ }) => {
28
+ const o = v[r], f = t.findIndex((e) => e.status === "open"), y = t.some((e) => b(e.action));
29
+ return (
30
+ // `role="list"`: Safari drops the list role from a list styled `list-none`.
31
+ /* @__PURE__ */ a(
32
+ "ol",
33
+ {
34
+ role: "list",
35
+ "aria-label": g,
36
+ "aria-labelledby": h,
37
+ className: `isolate m-0 list-none p-0 ${u}`,
38
+ children: t.map((e, l) => {
39
+ const d = e.status === "locked", m = S[e.status];
40
+ return /* @__PURE__ */ n(
41
+ "li",
42
+ {
43
+ "aria-current": l === f ? "step" : void 0,
44
+ style: {
45
+ padding: `${o.padding.y}px ${o.padding.x}px`,
46
+ borderBottom: s ? `${x}px solid ${c}` : void 0
47
+ },
48
+ className: "relative flex items-start gap-[12px]",
49
+ children: [
50
+ l < t.length - 1 && /* @__PURE__ */ a(
51
+ "span",
52
+ {
53
+ "aria-hidden": "true",
54
+ className: "absolute z-[1] w-[2px]",
55
+ style: {
56
+ ...E(o.padding, s),
57
+ background: e.status === "complete" ? $ : N
58
+ }
59
+ }
60
+ ),
61
+ /* @__PURE__ */ a(
62
+ "span",
63
+ {
64
+ "aria-hidden": "true",
65
+ className: `relative z-[2] box-border flex shrink-0 items-center justify-center rounded-full text-[length:var(--malachite-font-size-xsmall,11px)] [font-weight:600] ${A[e.status]}`,
66
+ style: { width: i, height: i },
67
+ children: e.status === "complete" ? /* @__PURE__ */ a(k, { size: 12 }) : l + 1
68
+ }
69
+ ),
70
+ /* @__PURE__ */ n("span", { className: "flex min-w-0 flex-1 flex-col gap-[2px] pt-[2px]", children: [
71
+ /* @__PURE__ */ n(
72
+ p,
73
+ {
74
+ size: o.title,
75
+ fontWeight: "semi-bold",
76
+ color: d ? "dimmed" : "primary",
77
+ children: [
78
+ e.title,
79
+ m && /* @__PURE__ */ n("span", { className: "sr-only", children: [
80
+ ", ",
81
+ m
82
+ ] })
83
+ ]
84
+ }
85
+ ),
86
+ b(e.description) && /* @__PURE__ */ a(
87
+ p,
88
+ {
89
+ size: o.description,
90
+ color: d ? "dimmed" : "secondary",
91
+ children: e.description
92
+ }
93
+ )
94
+ ] }),
95
+ y && /* @__PURE__ */ a("span", { className: "ml-[16px] flex min-w-[120px] items-center justify-end", children: e.action })
96
+ ]
97
+ },
98
+ I(e, l)
99
+ );
100
+ })
101
+ }
102
+ )
103
+ );
104
+ };
105
+ export {
106
+ L as StepList,
107
+ L as default
108
+ };
109
+ //# sourceMappingURL=StepList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StepList.js","sources":["../../src/components/StepList.tsx"],"sourcesContent":["import type React from 'react';\nimport CheckmarkIcon from './CustomIcons/CheckmarkIcon';\nimport Text from './Typography/Text';\nimport { isRenderableNode } from './renderableNode';\n\nexport type StepListStatus = 'complete' | 'open' | 'locked';\n\nexport type StepListSize = 'medium' | 'small';\n\nexport interface StepListItem {\n /** Keys the row; falls back to its position, so pass one when steps come and go. */\n key?: string;\n title: React.ReactNode;\n description?: React.ReactNode;\n /**\n * `complete` fills the marker with a tick, `open` rings it in the accent, and `locked`\n * dims the marker and the text. The first `open` step is the current one.\n */\n status: StepListStatus;\n /**\n * Right of the text, e.g. the step's button. The state is already announced after the\n * title, so a label that repeats it, such as \"Completed\", wants `aria-hidden`.\n */\n action?: React.ReactNode;\n}\n\nexport interface StepListProps {\n steps: StepListItem[];\n /** `small` is the compact list for a sidebar: tighter rows and smaller text. */\n size?: StepListSize;\n /** Rules a line under each row, for a list that fills its container edge to edge. */\n dividers?: boolean;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n /** On the list. Each connector runs to the next row's marker, so add no gap between rows. */\n className?: string;\n}\n\nconst MARKER_SIZE = 24;\nconst DIVIDER_WIDTH = 1;\n\nconst SIZES: Record<\n StepListSize,\n {\n padding: { x: number; y: number };\n title: 'medium' | 'small';\n description: 'small' | 'xsmall';\n }\n> = {\n medium: { padding: { x: 28, y: 16 }, title: 'medium', description: 'small' },\n small: { padding: { x: 20, y: 12 }, title: 'small', description: 'xsmall' },\n};\n\n// Read out after the title: the marker is hidden, and the dimmed text alone says nothing.\nconst STATUS_LABELS: Record<StepListStatus, string | undefined> = {\n complete: 'Completed',\n open: undefined,\n locked: 'Locked',\n};\n\n// From a marker's foot, through the next row's top padding and any rule, to its marker.\nconst connectorStyle = (\n padding: { x: number; y: number },\n divider: boolean,\n): React.CSSProperties => ({\n insetInlineStart: padding.x + MARKER_SIZE / 2 - 1,\n top: padding.y + MARKER_SIZE,\n height: `calc(100% - ${MARKER_SIZE - (divider ? DIVIDER_WIDTH : 0)}px)`,\n});\n\nconst BORDER = 'var(--malachite-card-border, rgb(232, 232, 232))';\nconst ACCENT = 'var(--malachite-accent-background, rgb(0, 175, 102))';\n\nconst DASHED = `repeating-linear-gradient(to bottom, ${BORDER} 0px, ${BORDER} 4px, transparent 4px, transparent 8px)`;\n\n// White on the accent fill in both themes, as Checkbox draws its tick.\nconst MARKER_CLASSES: Record<StepListStatus, string> = {\n complete: 'bg-[var(--malachite-accent-background,rgb(0,175,102))] text-white',\n open: 'border-[1.5px] border-solid border-[var(--malachite-accent-background,rgb(0,175,102))] bg-[var(--malachite-card-background,rgb(255,255,255))] text-[var(--malachite-accent-foreground,rgb(2,122,66))]',\n locked: 'border-[1.5px] border-solid border-[var(--malachite-text-dimmed,rgb(153,153,153))] bg-[var(--malachite-card-background,rgb(255,255,255))] text-[var(--malachite-text-dimmed,rgb(153,153,153))]',\n};\n\n// The position, not the title: two steps may share one. `#` keeps it off consumers' keys.\nconst keyOf = (step: StepListItem, index: number): string => step.key ?? `#${index}`;\n\n/**\n * A numbered, vertical list of setup steps: a marker per step joined by a line that turns\n * solid once a step is done, the step's title and description, and an optional action.\n */\nconst StepList: React.FC<StepListProps> = ({\n steps,\n size = 'medium',\n dividers = false,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n}) => {\n const sizing = SIZES[size];\n const current = steps.findIndex((step) => step.status === 'open');\n // Every row keeps the column once any step has an action, so the text wraps alike.\n const hasActions = steps.some((step) => isRenderableNode(step.action));\n\n return (\n // `role=\"list\"`: Safari drops the list role from a list styled `list-none`.\n <ol\n role=\"list\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={`isolate m-0 list-none p-0 ${className}`}\n >\n {steps.map((step, index) => {\n const locked = step.status === 'locked';\n const statusLabel = STATUS_LABELS[step.status];\n return (\n <li\n key={keyOf(step, index)}\n aria-current={index === current ? 'step' : undefined}\n style={{\n padding: `${sizing.padding.y}px ${sizing.padding.x}px`,\n borderBottom: dividers\n ? `${DIVIDER_WIDTH}px solid ${BORDER}`\n : undefined,\n }}\n className=\"relative flex items-start gap-[12px]\"\n >\n {index < steps.length - 1 && (\n <span\n aria-hidden=\"true\"\n className=\"absolute z-[1] w-[2px]\"\n style={{\n ...connectorStyle(sizing.padding, dividers),\n background: step.status === 'complete' ? ACCENT : DASHED,\n }}\n />\n )}\n <span\n aria-hidden=\"true\"\n className={`relative z-[2] box-border flex shrink-0 items-center justify-center rounded-full text-[length:var(--malachite-font-size-xsmall,11px)] [font-weight:600] ${MARKER_CLASSES[step.status]}`}\n style={{ width: MARKER_SIZE, height: MARKER_SIZE }}\n >\n {step.status === 'complete' ? <CheckmarkIcon size={12} /> : index + 1}\n </span>\n <span className=\"flex min-w-0 flex-1 flex-col gap-[2px] pt-[2px]\">\n <Text\n size={sizing.title}\n fontWeight=\"semi-bold\"\n color={locked ? 'dimmed' : 'primary'}\n >\n {step.title}\n {statusLabel && <span className=\"sr-only\">, {statusLabel}</span>}\n </Text>\n {isRenderableNode(step.description) && (\n <Text\n size={sizing.description}\n color={locked ? 'dimmed' : 'secondary'}\n >\n {step.description}\n </Text>\n )}\n </span>\n {hasActions && (\n <span className=\"ml-[16px] flex min-w-[120px] items-center justify-end\">\n {step.action}\n </span>\n )}\n </li>\n );\n })}\n </ol>\n );\n};\n\nexport default StepList;\nexport { StepList };\n"],"names":["MARKER_SIZE","DIVIDER_WIDTH","SIZES","STATUS_LABELS","connectorStyle","padding","divider","BORDER","ACCENT","DASHED","MARKER_CLASSES","keyOf","step","index","StepList","steps","size","dividers","ariaLabel","ariaLabelledBy","className","sizing","current","hasActions","isRenderableNode","jsx","locked","statusLabel","jsxs","CheckmarkIcon","Text"],"mappings":";;;;AAsCA,MAAMA,IAAc,IACdC,IAAgB,GAEhBC,IAOF;AAAA,EACA,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,GAAG,GAAA,GAAM,OAAO,UAAU,aAAa,QAAA;AAAA,EACnE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,GAAG,MAAM,OAAO,SAAS,aAAa,SAAA;AACrE,GAGMC,IAA4D;AAAA,EAC9D,UAAU;AAAA,EACV,MAAM;AAAA,EACN,QAAQ;AACZ,GAGMC,IAAiB,CACnBC,GACAC,OACuB;AAAA,EACvB,kBAAkBD,EAAQ,IAAIL,IAAc,IAAI;AAAA,EAChD,KAAKK,EAAQ,IAAIL;AAAA,EACjB,QAAQ,eAAeA,KAAeM,IAAUL,IAAgB,EAAE;AACtE,IAEMM,IAAS,oDACTC,IAAS,wDAETC,IAAS,wCAAwCF,CAAM,SAASA,CAAM,2CAGtEG,IAAiD;AAAA,EACnD,UAAU;AAAA,EACV,MAAM;AAAA,EACN,QAAQ;AACZ,GAGMC,IAAQ,CAACC,GAAoBC,MAA0BD,EAAK,OAAO,IAAIC,CAAK,IAM5EC,IAAoC,CAAC;AAAA,EACvC,OAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,UAAAC,IAAW;AAAA,EACX,cAAcC;AAAA,EACd,mBAAmBC;AAAA,EACnB,WAAAC,IAAY;AAChB,MAAM;AACF,QAAMC,IAASnB,EAAMc,CAAI,GACnBM,IAAUP,EAAM,UAA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C,QAAA,EAAK,WAAU,mDACZ,UAAA;AAAA,kBAAA,gBAAAA;AAAA,oBAACE;AAAA,oBAAA;AAAA,sBACG,MAAMT,EAAO;AAAA,sBACb,YAAW;AAAA,sBACX,OAAOK,IAAS,WAAW;AAAA,sBAE1B,UAAA;AAAA,wBAAAd,EAAK;AAAA,wBACLe,KAAe,gBAAAC,EAAC,QAAA,EAAK,WAAU,WAAU,UAAA;AAAA,0BAAA;AAAA,0BAAGD;AAAA,wBAAA,EAAA,CAAY;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAE5DH,EAAiBZ,EAAK,WAAW,KAC9B,gBAAAa;AAAA,oBAACK;AAAA,oBAAA;AAAA,sBACG,MAAMT,EAAO;AAAA,sBACb,OAAOK,IAAS,WAAW;AAAA,sBAE1B,UAAAd,EAAK;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACV,GAER;AAAA,gBACCW,KACG,gBAAAE,EAAC,QAAA,EAAK,WAAU,yDACX,YAAK,OAAA,CACV;AAAA,cAAA;AAAA,YAAA;AAAA,YAhDCd,EAAMC,GAAMC,CAAK;AAAA,UAAA;AAAA,QAoDlC,CAAC;AAAA,MAAA;AAAA,IAAA;AAAA;AAGb;"}
package/dist/index.d.ts CHANGED
@@ -5239,6 +5239,45 @@ export declare type StatusPillTone = 'success' | 'neutral' | 'warning' | 'error'
5239
5239
 
5240
5240
  export declare const StepCurrentIcon: React.FC<IconProps_108>;
5241
5241
 
5242
+ /**
5243
+ * A numbered, vertical list of setup steps: a marker per step joined by a line that turns
5244
+ * solid once a step is done, the step's title and description, and an optional action.
5245
+ */
5246
+ export declare const StepList: default_2.FC<StepListProps>;
5247
+
5248
+ export declare interface StepListItem {
5249
+ /** Keys the row; falls back to its position, so pass one when steps come and go. */
5250
+ key?: string;
5251
+ title: default_2.ReactNode;
5252
+ description?: default_2.ReactNode;
5253
+ /**
5254
+ * `complete` fills the marker with a tick, `open` rings it in the accent, and `locked`
5255
+ * dims the marker and the text. The first `open` step is the current one.
5256
+ */
5257
+ status: StepListStatus;
5258
+ /**
5259
+ * Right of the text, e.g. the step's button. The state is already announced after the
5260
+ * title, so a label that repeats it, such as "Completed", wants `aria-hidden`.
5261
+ */
5262
+ action?: default_2.ReactNode;
5263
+ }
5264
+
5265
+ export declare interface StepListProps {
5266
+ steps: StepListItem[];
5267
+ /** `small` is the compact list for a sidebar: tighter rows and smaller text. */
5268
+ size?: StepListSize;
5269
+ /** Rules a line under each row, for a list that fills its container edge to edge. */
5270
+ dividers?: boolean;
5271
+ 'aria-label'?: string;
5272
+ 'aria-labelledby'?: string;
5273
+ /** On the list. Each connector runs to the next row's marker, so add no gap between rows. */
5274
+ className?: string;
5275
+ }
5276
+
5277
+ export declare type StepListSize = 'medium' | 'small';
5278
+
5279
+ export declare type StepListStatus = 'complete' | 'open' | 'locked';
5280
+
5242
5281
  export declare const Stepper: default_2.FC<StepperProps | GroupedStepperProps>;
5243
5282
 
5244
5283
  declare interface StepperBaseProps {