@stll/ui 0.92.0 → 0.93.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.
@@ -17,7 +17,7 @@ const OUTCOME_TILE_CLASS = "bg-card text-foreground shadow-outcome-tile relative
17
17
  const OutcomeStatusBadge = ({ className, tone }) => {
18
18
  const { className: toneClass, Icon } = TONE_BADGE[tone];
19
19
  return /* @__PURE__ */ jsx("span", {
20
- className: cn("text-background ring-background motion-safe:animate-outcome-badge flex size-5 items-center justify-center rounded-full ring-2", toneClass, className),
20
+ className: cn("text-background motion-safe:animate-outcome-badge flex size-5 items-center justify-center rounded-full", toneClass, className),
21
21
  "data-slot": "outcome-badge",
22
22
  "data-tone": tone,
23
23
  children: /* @__PURE__ */ jsx(Icon, {
@@ -32,7 +32,7 @@ const StellaOutcomeTile = () => /* @__PURE__ */ jsx("span", {
32
32
  children: /* @__PURE__ */ jsx(StellaMark, { className: "size-7" })
33
33
  });
34
34
  const OutcomeGlyph = ({ tone }) => /* @__PURE__ */ jsxs("div", {
35
- className: "relative",
35
+ className: "outcome-badge-cutout relative",
36
36
  "aria-hidden": "true",
37
37
  children: [/* @__PURE__ */ jsx(StellaOutcomeTile, {}), /* @__PURE__ */ jsx(OutcomeStatusBadge, {
38
38
  className: "absolute -end-1.25 -bottom-1.25",
@@ -13,7 +13,7 @@ const PairedOutcomeGlyph = ({ counterpart, tone }) => /* @__PURE__ */ jsxs("div"
13
13
  /* @__PURE__ */ jsxs("span", {
14
14
  className: "relative flex w-16 items-center justify-center",
15
15
  children: [/* @__PURE__ */ jsx("span", {
16
- className: "bg-border motion-safe:animate-outcome-connector h-px w-full",
16
+ className: "bg-border motion-safe:animate-outcome-connector outcome-connector-cutout h-px w-full",
17
17
  "data-slot": "outcome-connector"
18
18
  }), /* @__PURE__ */ jsx(OutcomeStatusBadge, {
19
19
  className: "absolute",
@@ -53,9 +53,9 @@ const HEAD_FRAME_CLASS = "[&_img]:origin-[50%_26%] [&_img]:scale-200 [&_img]:obj
53
53
  /** A row's faces, decorative: the row's text carries the names. */
54
54
  const OutlineRowPortraits = ({ portraits }) => /* @__PURE__ */ jsx("span", {
55
55
  "aria-hidden": true,
56
- className: "me-1.5 flex shrink-0 -space-x-1.5 rtl:space-x-reverse",
56
+ className: "overlap-stack overlap-stack-1.5 me-1.5 shrink-0",
57
57
  children: portraits.slice(0, MAX_ROW_PORTRAITS).map((portrait) => /* @__PURE__ */ jsx(ReviewAuthorAvatar, {
58
- className: cn("ring-background size-6 ring-2", HEAD_FRAME_CLASS),
58
+ className: cn("size-6", HEAD_FRAME_CLASS),
59
59
  fallbackClassName: "text-[10px]",
60
60
  image: portrait.image,
61
61
  name: portrait.name
@@ -33,5 +33,5 @@ type TextareaProps = React.ComponentProps<"textarea"> & {
33
33
  */
34
34
  showCount?: boolean | undefined;
35
35
  };
36
- declare const Textarea: ({ className, id, name, disabled, value, defaultValue, size, appearance, unstyled, inline, fieldSizing, maxRows, showCount, dir, onChange, style, ...props }: TextareaProps) => React.JSX.Element;
36
+ declare const Textarea: ({ className, id, name, disabled, value, defaultValue, size, appearance, unstyled, inline, fieldSizing, maxRows, rows, showCount, dir, onChange, style, ...props }: TextareaProps) => React.JSX.Element;
37
37
  export { Textarea, type TextareaProps };
@@ -9,7 +9,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
9
9
  import { useState } from "react";
10
10
  import { Field } from "@base-ui/react/field";
11
11
  // src/components/textarea.tsx
12
- const Textarea = ({ className, id, name, disabled, value, defaultValue, size = CONTROL_SIZE.default, appearance = "default", unstyled = false, inline = false, fieldSizing = "content", maxRows, showCount = false, dir, onChange, style, ...props }) => {
12
+ const Textarea = ({ className, id, name, disabled, value, defaultValue, size = CONTROL_SIZE.default, appearance = "default", unstyled = false, inline = false, fieldSizing = "content", maxRows, rows, showCount = false, dir, onChange, style, ...props }) => {
13
13
  const controlSize = typeof size === "number" ? CONTROL_SIZE.default : size;
14
14
  const composer = appearance === "composer";
15
15
  const fieldEditorClass = inline ? cn(INLINE_FIELD_CLASS_NAME, "resize-none [--textarea-pb:0px] [--textarea-pt:0px]") : cn("w-full rounded-[inherit] px-[calc(--spacing(3)-1px)] outline-none", TEXTAREA_SIZE_CLASS_NAMES[controlSize], fieldSizing === "content" && TEXTAREA_FLOOR_CLASS_NAMES[controlSize]);
@@ -49,10 +49,12 @@ const Textarea = ({ className, id, name, disabled, value, defaultValue, size = C
49
49
  countsUncontrolled,
50
50
  trackValue
51
51
  ]);
52
- const textareaStyle = maxRows === void 0 ? style : {
53
- ...style,
54
- "--textarea-max-rows": maxRows
55
- };
52
+ const rowLimits = textareaRowLimits({
53
+ fieldSizing,
54
+ maxRows,
55
+ rows,
56
+ style
57
+ });
56
58
  return /* @__PURE__ */ jsxs("span", {
57
59
  className: cn(composer && "block w-full", !composer && inline && "relative inline-flex w-full", counted && "relative", !composer && !unstyled && !inline && "border-input bg-background text-foreground ring-ring/24 has-focus-visible:border-ring has-aria-invalid:border-destructive/36 has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 dark:bg-input/32 dark:has-aria-invalid:ring-destructive/24 relative inline-flex w-full rounded-lg border text-base shadow-xs/5 not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:ring-[3px] has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none sm:text-sm dark:not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]", className) || void 0,
58
60
  "data-appearance": appearance,
@@ -66,12 +68,13 @@ const Textarea = ({ className, id, name, disabled, value, defaultValue, size = C
66
68
  value,
67
69
  defaultValue,
68
70
  render: /* @__PURE__ */ jsx("textarea", {
69
- className: cn(editorClass, fieldSizing === "content" ? "field-sizing-content" : "field-sizing-fixed resize-none", "pt-(--textarea-pt) pb-(--textarea-pb)", counted && "[--textarea-pb:--spacing(6)]", maxRows !== void 0 && "max-h-[calc(var(--textarea-max-rows)*1lh+var(--textarea-pt)+var(--textarea-pb))] min-h-0 max-sm:min-h-0"),
71
+ className: cn(editorClass, fieldSizing === "content" ? "field-sizing-content" : "field-sizing-fixed resize-none", "pt-(--textarea-pt) pb-(--textarea-pb)", counted && "[--textarea-pb:--spacing(6)]", rowLimits.className),
70
72
  "data-slot": "textarea",
73
+ rows,
71
74
  ...props,
72
75
  onChange: handleChange,
73
76
  dir: contentDir.dir,
74
- style: textareaStyle
77
+ style: rowLimits.style
75
78
  })
76
79
  }), counted ? /* @__PURE__ */ jsxs("span", {
77
80
  className: "text-muted-foreground pointer-events-none absolute end-3 bottom-1.5 text-xs tabular-nums",
@@ -95,6 +98,38 @@ const TEXTAREA_FLOOR_CLASS_NAMES = {
95
98
  [CONTROL_SIZE.default]: "min-h-17.5 max-sm:min-h-20.5",
96
99
  [CONTROL_SIZE.lg]: "min-h-18.5 max-sm:min-h-21.5"
97
100
  };
101
+ /**
102
+ * The height limits `maxRows` sets, as classes and the variables they read.
103
+ * One line is `1lh`; the field's own block padding is added on top so the
104
+ * last allowed line is not cut. The size's floor height gives way, as
105
+ * `min-height` would otherwise win over a smaller cap. A field that grows
106
+ * with its content ignores `rows`, so an empty one would be a single line
107
+ * and a longer placeholder would spill out of it: with a cap, the floor is
108
+ * `rows` lines instead, never more than the cap.
109
+ */
110
+ function textareaRowLimits({ fieldSizing, maxRows, rows, style }) {
111
+ if (maxRows === void 0) return {
112
+ className: void 0,
113
+ style
114
+ };
115
+ const minRows = rows === void 0 || fieldSizing !== "content" ? void 0 : Math.min(rows, maxRows);
116
+ const cap = "max-h-[calc(var(--textarea-max-rows)*1lh+var(--textarea-pt)+var(--textarea-pb))]";
117
+ if (minRows === void 0) return {
118
+ className: `${cap} min-h-0 max-sm:min-h-0`,
119
+ style: {
120
+ ...style,
121
+ "--textarea-max-rows": maxRows
122
+ }
123
+ };
124
+ return {
125
+ className: `${cap} min-h-[calc(var(--textarea-min-rows)*1lh+var(--textarea-pt)+var(--textarea-pb))] max-sm:min-h-[calc(var(--textarea-min-rows)*1lh+var(--textarea-pt)+var(--textarea-pb))]`,
126
+ style: {
127
+ ...style,
128
+ "--textarea-max-rows": maxRows,
129
+ "--textarea-min-rows": minRows
130
+ }
131
+ };
132
+ }
98
133
  function textLength(value) {
99
134
  if (value === void 0) return 0;
100
135
  return String(value).length;
@@ -1508,3 +1508,85 @@
1508
1508
  color: oklch(0.85 0.11 var(--cat-hue));
1509
1509
  }
1510
1510
  }
1511
+
1512
+ /* A row of equal round items (faces, avatars, "+N") that overlap, each cut
1513
+ * out of the one before it. The cut is a mask on the earlier item where the
1514
+ * next one sits, plus a gap, so the gap shows whatever lies behind the row:
1515
+ * a ring or border painted in the page colour shows as a frame on any other
1516
+ * surface, such as a row or button on hover. The mask also clips anything an
1517
+ * item paints outside its box, so a ring marking an item goes inside it.
1518
+ * `overlap-stack-<n>` sets the overlap in spacing steps. */
1519
+ @utility overlap-stack {
1520
+ --overlap-stack-step: var(--overlap-stack-overlap, --spacing(1));
1521
+ display: flex;
1522
+ align-items: center;
1523
+
1524
+ & > :not(:first-child) {
1525
+ margin-inline-start: calc(var(--overlap-stack-step) * -1);
1526
+ }
1527
+
1528
+ /* The cut is the next item's circle (radius 50%) grown by a 2px gap. The
1529
+ * gap sits in the colour stops: browsers reject a radius mixing % and px. */
1530
+ & > :not(:last-child) {
1531
+ mask-image: radial-gradient(
1532
+ 50% 50% at calc(150% - var(--overlap-stack-step)) 50%,
1533
+ transparent calc(100% + 2px),
1534
+ black calc(100% + 2.5px)
1535
+ );
1536
+ }
1537
+
1538
+ &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) > :not(:last-child) {
1539
+ mask-image: radial-gradient(
1540
+ 50% 50% at calc(var(--overlap-stack-step) - 50%) 50%,
1541
+ transparent calc(100% + 2px),
1542
+ black calc(100% + 2.5px)
1543
+ );
1544
+ }
1545
+ }
1546
+
1547
+ /* On the outcome glyph: its tile is cut out under the status badge (20px,
1548
+ * 5px past the inline-end bottom corner) with a 2px gap, so the gap is
1549
+ * transparent on any page colour. */
1550
+ @utility outcome-badge-cutout {
1551
+ & > [data-slot="outcome-tile"] {
1552
+ mask-image: radial-gradient(
1553
+ circle at calc(100% - 5px) calc(100% - 5px),
1554
+ transparent 12px,
1555
+ black 12.5px
1556
+ );
1557
+ }
1558
+
1559
+ &:where(:dir(rtl), [dir="rtl"], [dir="rtl"] *) > [data-slot="outcome-tile"] {
1560
+ mask-image: radial-gradient(
1561
+ circle at 5px calc(100% - 5px),
1562
+ transparent 12px,
1563
+ black 12.5px
1564
+ );
1565
+ }
1566
+ }
1567
+
1568
+ /* An activity timeline line stops 4px short of its 28px marker (10px from
1569
+ * the entry's top), so the gap shows the panel behind on any surface. */
1570
+ @utility timeline-marker-cutout {
1571
+ mask-image: linear-gradient(
1572
+ to bottom,
1573
+ black 6px,
1574
+ transparent 6px 42px,
1575
+ black 42px
1576
+ );
1577
+ }
1578
+
1579
+ /* The connector between two outcome tiles stops 2px short of the 20px badge
1580
+ * centred on it, so the gap shows the page behind on any surface. */
1581
+ @utility outcome-connector-cutout {
1582
+ mask-image: linear-gradient(
1583
+ to right,
1584
+ black calc(50% - 12px),
1585
+ transparent calc(50% - 12px) calc(50% + 12px),
1586
+ black calc(50% + 12px)
1587
+ );
1588
+ }
1589
+
1590
+ @utility overlap-stack-* {
1591
+ --overlap-stack-overlap: --spacing(--value(number));
1592
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/ui",
3
- "version": "0.92.0",
3
+ "version": "0.93.1",
4
4
  "description": "Stella's design system: bidi-aware React primitives built on Base UI, the dockable inspector pane, and the Tailwind v4 theme they are styled with.",
5
5
  "keywords": [
6
6
  "base-ui",
@@ -1047,13 +1047,13 @@
1047
1047
  "@testing-library/react": "16.3.3",
1048
1048
  "@types/react": "^19.3.0",
1049
1049
  "@types/react-dom": "^19.3.0",
1050
- "bun-types": "1.4.4",
1050
+ "bun-types": "1.4.5",
1051
1051
  "fast-check": "^4.10.2",
1052
1052
  "react": "^19.3.1",
1053
1053
  "react-dom": "^19.3.1",
1054
1054
  "tailwindcss": "4.3.5",
1055
1055
  "tsdown": "0.23.7",
1056
- "tsrs": "0.23.0-ts7.1.0-beta",
1056
+ "tsrs": "7.1.0-beta.tsrs5",
1057
1057
  "vite": "8.3.8"
1058
1058
  },
1059
1059
  "peerDependencies": {