@designa8/vibedesign-flowtide-ds-v1-176b 0.2.2 → 0.2.3

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.
@@ -14,7 +14,9 @@ export interface CardHeaderProps
14
14
  * The header's content slot — the thing the title names. It sits directly
15
15
  * beside the title and takes the remaining width (a Rating, a stat, a
16
16
  * segmented row, etc.). It drops onto its own line at narrow widths rather
17
- * than collapsing and drawing over the actions.
17
+ * than collapsing and drawing over the actions. When omitted, the title
18
+ * column keeps the whole width up to the actions instead of leaving an
19
+ * empty middle column taking half the row.
18
20
  */
19
21
  children?: React.ReactNode;
20
22
  /** Trailing controls, pinned to the right edge after the vertical rule. */
@@ -55,6 +57,10 @@ function cx(...parts: Array<string | false | undefined>): string {
55
57
  * real row/column gap, so at narrow widths the text column and the content
56
58
  * slot each take a full line and the actions keep their own line at the right
57
59
  * edge — nothing collapses to zero width and draws over its neighbour.
60
+ *
61
+ * The middle content column is only rendered when it has something in it, so
62
+ * a header without `children` gives the whole width to the title instead of
63
+ * splitting it 50/50 with an empty column (which wrapped titles word by word).
58
64
  */
59
65
  export const CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>(
60
66
  function CardHeader(props, ref) {
@@ -71,6 +77,9 @@ export const CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>(
71
77
  ...rest
72
78
  } = props;
73
79
 
80
+ // toArray drops null / undefined / booleans, so an empty slot counts as absent.
81
+ const hasContent = React.Children.toArray(children).length > 0;
82
+
74
83
  return (
75
84
  <div
76
85
  ref={ref}
@@ -94,10 +103,13 @@ export const CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>(
94
103
  ) : null}
95
104
  </div>
96
105
 
97
- {/* Full line at narrow widths; shares the row from sm up. */}
98
- <div className="flex min-w-0 shrink-0 basis-full items-center gap-md sm:shrink sm:basis-0 sm:grow">
99
- {children}
100
- </div>
106
+ {/* Only rendered when the slot actually has content — otherwise the
107
+ empty column would grow to half the row and squeeze the title. */}
108
+ {hasContent ? (
109
+ <div className="flex min-w-0 shrink-0 basis-full items-center gap-md sm:shrink sm:basis-0 sm:grow">
110
+ {children}
111
+ </div>
112
+ ) : null}
101
113
 
102
114
  {/* Always the rightmost item on whichever line it lands. */}
103
115
  <div className="ml-auto flex shrink-0 items-start gap-md self-start">
@@ -115,6 +115,39 @@ export default function CardHeaderPreview() {
115
115
  <Rating readOnly value={3.5} showValue count={42} size="sm" />
116
116
  </CardHeader>
117
117
  </div>
118
+
119
+ {/* Narrow cards side by side. Left has no content slot, so its long title
120
+ now runs the full width up to the actions instead of wrapping word by
121
+ word beside an empty middle column. Right keeps a content slot, so the
122
+ row still splits as before. */}
123
+ <div className="grid grid-cols-1 gap-lg sm:grid-cols-2">
124
+ <div className="rounded-xl border border-hairline bg-surface shadow-card">
125
+ <CardHeader
126
+ title="Turn paid orders into a packing list"
127
+ description="No content slot — title takes the full width"
128
+ actions={
129
+ <Button variant="quiet" size="sm">
130
+ Open
131
+ </Button>
132
+ }
133
+ />
134
+ </div>
135
+
136
+ <div className="rounded-xl border border-hairline bg-surface shadow-card">
137
+ <CardHeader
138
+ title="Packing list"
139
+ description="With a content slot"
140
+ showDivider={false}
141
+ actions={
142
+ <Button variant="quiet" size="sm">
143
+ Open
144
+ </Button>
145
+ }
146
+ >
147
+ <span className="text-body-sm text-muted">Draft</span>
148
+ </CardHeader>
149
+ </div>
150
+ </div>
118
151
  </div>
119
152
  );
120
153
  }
@@ -46,7 +46,12 @@ export interface DropdownProps {
46
46
  appearance?: "button" | "field";
47
47
  /**
48
48
  * Trigger density. "md" is the default control height; "sm" is the compact
49
- * 32px trigger for filter toolbars, with 14px regular-weight text.
49
+ * trigger for filter toolbars and inspector forms — it takes the Button
50
+ * `control` height (36px), the same height as the Input atom's "sm" field, so
51
+ * a compact select lines up with a compact text field on one baseline. It
52
+ * also takes that field's inline inset (px-md), so the value text and the
53
+ * chevron sit on exactly the same left and right edges as the sm Input above
54
+ * or beside it. Its label stays 14px regular-weight with a 16px chevron.
50
55
  */
51
56
  size?: "sm" | "md";
52
57
  /**
@@ -333,7 +338,16 @@ export const Dropdown = React.forwardRef<HTMLDivElement, DropdownProps>(
333
338
 
334
339
  const fieldAppearance = appearance === "field";
335
340
  const compact = size === "sm";
336
- const triggerSize = compact ? "sm" : fieldAppearance ? "field" : "md";
341
+ /*
342
+ * The compact trigger takes the Button `field-sm` size: the control height
343
+ * (36px) so it sits on the same baseline as the Input atom's "sm" field,
344
+ * paired with that field's inline inset (px-md) instead of the roomier
345
+ * px-base of a `control` action button. A compact select under a compact
346
+ * text field therefore starts its value text and ends its chevron on the
347
+ * same edges, instead of the value sitting 4px further in. Its label keeps
348
+ * the compact label-sm type and the 16px chevron.
349
+ */
350
+ const triggerSize = compact ? "field-sm" : fieldAppearance ? "field" : "md";
337
351
 
338
352
  const panel = (
339
353
  <div
@@ -376,6 +390,10 @@ export const Dropdown = React.forwardRef<HTMLDivElement, DropdownProps>(
376
390
  fullWidth
377
391
  disabled={option.disabled}
378
392
  tabIndex={open ? 0 : -1}
393
+ /* Native tooltip for a truncated option label. */
394
+ title={
395
+ typeof option.label === "string" ? option.label : undefined
396
+ }
379
397
  onClick={() => selectOption(option)}
380
398
  onKeyDown={(event) => handleOptionKeyDown(index, event)}
381
399
  style={{
@@ -387,6 +405,14 @@ export const Dropdown = React.forwardRef<HTMLDivElement, DropdownProps>(
387
405
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue focus-visible:ring-inset",
388
406
  "disabled:cursor-not-allowed disabled:opacity-50",
389
407
  )}
408
+ /*
409
+ * The option's label slot has to span the whole row, exactly like
410
+ * the trigger's does. Without it the slot shrink-wraps its
411
+ * content, the inner row never fills the option, `truncate` has
412
+ * no bounded width, and the selected check sits against the
413
+ * label instead of the panel's right edge.
414
+ */
415
+ labelClassName="min-w-0 flex-1"
390
416
  >
391
417
  <span
392
418
  aria-hidden="true"
@@ -398,13 +424,13 @@ export const Dropdown = React.forwardRef<HTMLDivElement, DropdownProps>(
398
424
  : "group-hover:bg-surface-soft group-active:bg-surface-strong",
399
425
  )}
400
426
  />
401
- <span className="relative flex w-full items-center gap-sm">
427
+ <span className="relative flex w-full min-w-0 items-center gap-sm">
402
428
  {showLeadingBox ? (
403
429
  <span className="flex size-4 shrink-0 items-center justify-center">
404
430
  {option.leadingSlot ?? null}
405
431
  </span>
406
432
  ) : null}
407
- <span className="truncate">{option.label}</span>
433
+ <span className="min-w-0 truncate">{option.label}</span>
408
434
  {isSelected ? (
409
435
  <Icon
410
436
  name="check"
@@ -35,9 +35,18 @@ const runStatusOptions: DropdownOption[] = [
35
35
  { value: "queued", label: "Queued" },
36
36
  ];
37
37
 
38
+ /*
39
+ * `append-row` carries a long descriptive label on purpose: it exercises the
40
+ * truncation path, so the option text ends in an ellipsis inside the panel and
41
+ * the selected check keeps the right edge of the row.
42
+ */
38
43
  const stepOptions: DropdownOption[] = [
39
44
  { value: "send-email", label: "Send email" },
40
45
  { value: "append-row", label: "Append row to spreadsheet" },
46
+ {
47
+ value: "packing-sheet",
48
+ label: "When a paid order comes in, add a row to the packing sheet",
49
+ },
41
50
  { value: "post-chat", label: "Post chat message" },
42
51
  { value: "update-crm", label: "Update CRM record" },
43
52
  { value: "charge", label: "Create payment" },
@@ -46,7 +55,7 @@ const stepOptions: DropdownOption[] = [
46
55
  export default function DropdownPreview() {
47
56
  const [trigger, setTrigger] = React.useState("email");
48
57
  const [connection, setConnection] = React.useState("crm");
49
- const [step, setStep] = React.useState("append-row");
58
+ const [step, setStep] = React.useState("packing-sheet");
50
59
  const [status, setStatus] = React.useState("any");
51
60
 
52
61
  return (
@@ -65,7 +74,7 @@ export default function DropdownPreview() {
65
74
  </div>
66
75
 
67
76
  <div className="space-y-xs">
68
- <p className="text-body-sm text-body">Connection</p>
77
+ <p className="text-body-sm text-body">Connection (compact trigger)</p>
69
78
  <Dropdown
70
79
  options={connectionOptions}
71
80
  value={connection}
@@ -74,7 +83,8 @@ export default function DropdownPreview() {
74
83
  size="sm"
75
84
  />
76
85
  <p className="text-body-sm text-muted-soft">
77
- Unavailable connections stay visible but disabled.
86
+ Unavailable connections stay visible but disabled. The compact trigger
87
+ matches a compact text field in height.
78
88
  </p>
79
89
  </div>
80
90
 
@@ -87,6 +97,10 @@ export default function DropdownPreview() {
87
97
  appearance="field"
88
98
  aria-label="Workflow step"
89
99
  />
100
+ <p className="text-body-sm text-muted-soft">
101
+ A long option label truncates with an ellipsis and keeps the selected
102
+ check on the right edge.
103
+ </p>
90
104
  </div>
91
105
 
92
106
  <div className="space-y-xs">
@@ -133,6 +133,14 @@ const LABEL =
133
133
  /** The label collapses to zero width while folded, so the rail is one icon column. */
134
134
  const LABEL_HIDDEN = "w-0 overflow-hidden opacity-0 pointer-events-none";
135
135
 
136
+ /**
137
+ * A zero-width label still occupies a flex slot, so the atom's own label gap
138
+ * would keep pushing the glyph off the tile centre. Button rows therefore take
139
+ * the label out of flow entirely while folded — it stays in the accessibility
140
+ * tree, so the row keeps its name without the 1px-box shifting the glyph.
141
+ */
142
+ const LABEL_OFF_FLOW = "sr-only";
143
+
136
144
  /** Card = floating panel. Flat = flush rail: one hairline on its right edge only. */
137
145
  const SURFACE_CARD =
138
146
  "rounded-xl border border-solid border-hairline bg-surface shadow-sm";
@@ -244,9 +252,32 @@ export const SidebarDesktop = React.forwardRef<
244
252
  ? "mx-auto h-10 w-10 justify-center"
245
253
  : cx("w-full h-10 gap-md px-sm", nested && NESTED_INSET);
246
254
 
255
+ /**
256
+ * The Button atom renders `inline-flex`, which wins over the row's own `flex`
257
+ * utility, so a Button row stays inline-level and `mx-auto` is ignored while
258
+ * folded. This wrapper is block-level: it blockifies the button, so the tile
259
+ * centres on the same line as the anchor rows while folded and fills the row
260
+ * while unfolded.
261
+ */
262
+ const rowSlot = (content: React.ReactNode) => (
263
+ <div className={folded ? "flex justify-center" : "flex w-full"}>
264
+ {content}
265
+ </div>
266
+ );
267
+
247
268
  const labelClass = (extra?: string) =>
248
269
  cx(LABEL, extra, folded ? LABEL_HIDDEN : "opacity-100");
249
270
 
271
+ /**
272
+ * Label class for a Button row. The Button atom wraps its children in an
273
+ * inline-flex label span that applies a gap between them, so a zero-width
274
+ * label there still renders a gap and pushes the glyph ~half a gap left of
275
+ * the tile centre. `sr-only` takes the span out of that flow, keeping the
276
+ * accessible name while leaving the glyph exactly on centre.
277
+ */
278
+ const buttonLabelClass = (extra?: string) =>
279
+ cx(LABEL, extra, folded ? LABEL_OFF_FLOW : "opacity-100");
280
+
250
281
  /** Count pill + consumer trailing slot, pushed to the row end. Folded hides both. */
251
282
  const renderRowTrailing = (node: SidebarDesktopNode) => {
252
283
  if (folded) return null;
@@ -304,33 +335,35 @@ export const SidebarDesktop = React.forwardRef<
304
335
 
305
336
  return (
306
337
  <li key={section.id}>
307
- <Button
308
- type="button"
309
- chrome="none"
310
- aria-expanded={open}
311
- aria-controls={panelId}
312
- title={folded ? section.label : undefined}
313
- onClick={() => toggleGroup(section.id)}
314
- className={cx(ROW, rowBox(), ROW_IDLE)}
315
- >
316
- <Icon
317
- name={section.icon}
318
- size={20}
319
- strokeWidth={1.8}
320
- className={iconTone(false)}
321
- />
322
- <span className={labelClass()}>{section.label}</span>
323
- <Icon
324
- name="chevron-down"
325
- size={18}
326
- strokeWidth={2}
327
- className={cx(
328
- "ml-auto shrink-0 text-muted transition duration-200 ease-out",
329
- open && "rotate-180",
330
- folded && "hidden",
331
- )}
332
- />
333
- </Button>
338
+ {rowSlot(
339
+ <Button
340
+ type="button"
341
+ chrome="none"
342
+ aria-expanded={open}
343
+ aria-controls={panelId}
344
+ title={folded ? section.label : undefined}
345
+ onClick={() => toggleGroup(section.id)}
346
+ className={cx(ROW, rowBox(), ROW_IDLE)}
347
+ >
348
+ <Icon
349
+ name={section.icon}
350
+ size={20}
351
+ strokeWidth={1.8}
352
+ className={iconTone(false)}
353
+ />
354
+ <span className={labelClass()}>{section.label}</span>
355
+ <Icon
356
+ name="chevron-down"
357
+ size={18}
358
+ strokeWidth={2}
359
+ className={cx(
360
+ "ml-auto shrink-0 text-muted transition duration-200 ease-out",
361
+ open && "rotate-180",
362
+ folded && "hidden",
363
+ )}
364
+ />
365
+ </Button>,
366
+ )}
334
367
 
335
368
  <div
336
369
  id={panelId}
@@ -450,60 +483,64 @@ export const SidebarDesktop = React.forwardRef<
450
483
  {(hasCreate || hasStarred) && <Divider className="my-md" />}
451
484
 
452
485
  {hasCreate ? (
453
- <Button
454
- type="button"
455
- chrome="none"
456
- onClick={onCreateClick}
457
- title={folded ? createLabel : undefined}
458
- className={cx(
459
- ROW,
460
- rowBox(),
461
- "bg-accent-violet-soft text-accent-violet",
462
- "hover:brightness-[0.98] active:brightness-[0.96]",
463
- )}
464
- >
465
- <span
466
- aria-hidden="true"
467
- className="flex size-5 shrink-0 items-center justify-center rounded-full border border-current"
486
+ rowSlot(
487
+ <Button
488
+ type="button"
489
+ chrome="none"
490
+ onClick={onCreateClick}
491
+ title={folded ? createLabel : undefined}
492
+ className={cx(
493
+ ROW,
494
+ rowBox(),
495
+ "bg-accent-violet-soft text-accent-violet",
496
+ "hover:brightness-[0.98] active:brightness-[0.96]",
497
+ )}
468
498
  >
469
- <Icon name="plus" size={12} strokeWidth={2.2} />
470
- </span>
471
- <span className={labelClass()}>{createLabel}</span>
472
- </Button>
499
+ <span
500
+ aria-hidden="true"
501
+ className="flex size-5 shrink-0 items-center justify-center rounded-full border border-current"
502
+ >
503
+ <Icon name="plus" size={12} strokeWidth={2.2} />
504
+ </span>
505
+ <span className={buttonLabelClass()}>{createLabel}</span>
506
+ </Button>,
507
+ )
473
508
  ) : null}
474
509
 
475
510
  {/* Starred group: hidden entirely when there is nothing starred. */}
476
511
  {hasStarred ? (
477
512
  <div className={hasCreate ? "pt-md" : undefined}>
478
- <Button
479
- type="button"
480
- chrome="none"
481
- aria-expanded={starredOpen}
482
- aria-controls={groupPanelId("starred")}
483
- title={folded ? starredLabel : undefined}
484
- onClick={() => toggleGroup("starred")}
485
- className={cx(ROW, rowBox(), ROW_IDLE)}
486
- >
487
- <Icon
488
- name="star"
489
- size={20}
490
- strokeWidth={1.8}
491
- className={iconTone(false)}
492
- />
493
- <span className={labelClass("text-label-sm")}>
494
- {starredLabel}
495
- </span>
496
- <Icon
497
- name="chevron-down"
498
- size={18}
499
- strokeWidth={2}
500
- className={cx(
501
- "ml-auto shrink-0 text-muted transition duration-200 ease-out",
502
- starredOpen && "rotate-180",
503
- folded && "hidden",
504
- )}
505
- />
506
- </Button>
513
+ {rowSlot(
514
+ <Button
515
+ type="button"
516
+ chrome="none"
517
+ aria-expanded={starredOpen}
518
+ aria-controls={groupPanelId("starred")}
519
+ title={folded ? starredLabel : undefined}
520
+ onClick={() => toggleGroup("starred")}
521
+ className={cx(ROW, rowBox(), ROW_IDLE)}
522
+ >
523
+ <Icon
524
+ name="star"
525
+ size={20}
526
+ strokeWidth={1.8}
527
+ className={iconTone(false)}
528
+ />
529
+ <span className={buttonLabelClass("text-label-sm")}>
530
+ {starredLabel}
531
+ </span>
532
+ <Icon
533
+ name="chevron-down"
534
+ size={18}
535
+ strokeWidth={2}
536
+ className={cx(
537
+ "ml-auto shrink-0 text-muted transition duration-200 ease-out",
538
+ starredOpen && "rotate-180",
539
+ folded && "hidden",
540
+ )}
541
+ />
542
+ </Button>,
543
+ )}
507
544
 
508
545
  <div
509
546
  id={groupPanelId("starred")}
@@ -58,13 +58,13 @@ export default function SidebarDesktopPreview() {
58
58
  return (
59
59
  <div className="w-full bg-canvas p-md text-ink">
60
60
  <div className="mx-auto grid w-full max-w-3xl grid-cols-2 items-start gap-md">
61
- {/* Flat rail with the workspace switcher — the panel opens at the top
62
- of the canvas, so it never runs past the fold. */}
61
+ {/* Unfolded flat rail with the workspace switcher. The switcher panel
62
+ opens at the top of the canvas, so it never runs past the fold. */}
63
63
  <section className="space-y-sm">
64
64
  <h2 className="text-label-sm text-muted">
65
- Flat rail, flush against the page
65
+ Unfolded rail, flush against the page
66
66
  </h2>
67
- <div className="flex h-[640px] w-full overflow-hidden rounded-lg border border-solid border-hairline bg-canvas">
67
+ <div className="flex h-[420px] w-full overflow-hidden rounded-lg border border-solid border-hairline bg-canvas">
68
68
  <div className="h-full shrink-0">
69
69
  <SidebarDesktop
70
70
  brand="Workflow"
@@ -78,7 +78,9 @@ export default function SidebarDesktopPreview() {
78
78
  organizations={ORGANIZATIONS}
79
79
  organization={organization}
80
80
  onOrganizationChange={setOrganization}
81
- footer={<Account />}
81
+ folded={folded}
82
+ onFoldedChange={setFolded}
83
+ footer={<Account compact={folded} />}
82
84
  />
83
85
  </div>
84
86
  <div className="min-w-0 flex-1 p-md">
@@ -89,22 +91,28 @@ export default function SidebarDesktopPreview() {
89
91
  </div>
90
92
  </section>
91
93
 
92
- {/* Card rail: the fold control collapses it to one icon column. */}
94
+ {/* The folded rail: one icon column — expand control, plus tile, star
95
+ tile and every nav tile share a single vertical centre line. */}
93
96
  <section className="space-y-sm">
94
97
  <h2 className="text-label-sm text-muted">
95
- Card rail, fold control live
98
+ Folded rail, one centred icon column
96
99
  </h2>
97
- <div className="h-[640px] w-full">
100
+ <div className="h-[560px] w-full">
98
101
  <SidebarDesktop
99
102
  brand="Workflow"
100
- sections={SECTIONS}
103
+ sections={[
104
+ { id: "runs", label: "Runs", icon: "history", count: 8 },
105
+ { id: "triggers", label: "Triggers", icon: "zap" },
106
+ { id: "workflows", label: "Workflows", icon: "workflow" },
107
+ { id: "teammates", label: "Teammates", icon: "users" },
108
+ ]}
101
109
  activeId={activeId}
102
110
  onSelect={setActiveId}
111
+ starred={STARRED}
103
112
  createLabel="New workflow"
104
113
  onCreateClick={() => undefined}
105
- folded={folded}
106
- onFoldedChange={setFolded}
107
- footer={<Account compact={folded} />}
114
+ defaultFolded
115
+ footer={<Account compact />}
108
116
  />
109
117
  </div>
110
118
  </section>