@stll/ui 0.68.0 → 0.71.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.
Files changed (65) hide show
  1. package/dist/calendar/day-calendar.d.ts +22 -6
  2. package/dist/calendar/day-calendar.js +97 -26
  3. package/dist/calendar/resource-calendar.js +7 -9
  4. package/dist/calendar/topic-colors.d.ts +3 -0
  5. package/dist/calendar/topic-colors.js +19 -0
  6. package/dist/components/button.d.ts +13 -1
  7. package/dist/components/button.js +18 -9
  8. package/dist/components/composer-tokens.d.ts +6 -2
  9. package/dist/components/composer-tokens.js +6 -2
  10. package/dist/components/composer.d.ts +13 -0
  11. package/dist/components/composer.js +19 -3
  12. package/dist/components/court-filter.js +4 -4
  13. package/dist/components/date-picker-popover.js +11 -4
  14. package/dist/components/document-identity-badge.js +15 -4
  15. package/dist/components/file-input.js +3 -2
  16. package/dist/components/horizontal-scroller.d.ts +6 -0
  17. package/dist/components/horizontal-scroller.js +59 -33
  18. package/dist/components/identity-text.js +5 -2
  19. package/dist/components/input-group.js +3 -2
  20. package/dist/components/landing.js +6 -5
  21. package/dist/components/list.d.ts +11 -5
  22. package/dist/components/list.js +28 -9
  23. package/dist/components/loader.js +4 -2
  24. package/dist/components/outline-rail.js +6 -4
  25. package/dist/components/run-state-mark.d.ts +8 -0
  26. package/dist/components/run-state-mark.js +30 -0
  27. package/dist/components/run-state-mark.native.d.ts +9 -0
  28. package/dist/components/run-state-mark.native.js +98 -0
  29. package/dist/components/run-state-mark.shared.d.ts +53 -0
  30. package/dist/components/run-state-mark.shared.js +45 -0
  31. package/dist/components/split-button.d.ts +6 -1
  32. package/dist/components/split-button.js +8 -3
  33. package/dist/components/status-mark.js +6 -6
  34. package/dist/components/status-mark.shared.d.ts +12 -0
  35. package/dist/components/status-mark.shared.js +14 -0
  36. package/dist/components/table.d.ts +1 -1
  37. package/dist/components/table.js +13 -7
  38. package/dist/components/text.native.d.ts +3 -1
  39. package/dist/components/text.native.js +4 -2
  40. package/dist/components/truncated-text.d.ts +14 -3
  41. package/dist/components/truncated-text.js +21 -5
  42. package/dist/components/view-toolbar.d.ts +11 -3
  43. package/dist/components/view-toolbar.js +16 -5
  44. package/dist/icons.d.ts +2 -2
  45. package/dist/icons.js +1 -1
  46. package/dist/index.d.ts +2 -2
  47. package/dist/index.js +2 -2
  48. package/dist/inspector/chrome.d.ts +3 -3
  49. package/dist/inspector/chrome.js +28 -17
  50. package/dist/kanban/column-band-header.js +3 -2
  51. package/dist/kanban/column-header.js +3 -2
  52. package/dist/kanban/sticky-lane.js +3 -2
  53. package/dist/lib/file-size.d.ts +16 -0
  54. package/dist/lib/file-size.js +30 -0
  55. package/dist/lib/matter-colors.js +2 -5
  56. package/dist/lib/stable-hash.d.ts +2 -0
  57. package/dist/lib/stable-hash.js +8 -0
  58. package/dist/review/review-comment-card.js +7 -6
  59. package/dist/review/review-decision-actions.d.ts +8 -1
  60. package/dist/review/review-decision-actions.js +13 -4
  61. package/dist/review/review-out-of-date-notice.d.ts +7 -1
  62. package/dist/review/review-out-of-date-notice.js +4 -1
  63. package/dist/styles/inline-rename.css +9 -0
  64. package/dist/styles/theme.css +24 -0
  65. package/package.json +15 -3
@@ -1,3 +1,4 @@
1
+ import { TruncatedText } from "../components/truncated-text.js";
1
2
  import { cn } from "../lib/utils.js";
2
3
  import "./layout-tokens.js";
3
4
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -20,8 +21,8 @@ const KanbanColumnHeader = ({ swatch, title, meta, calculation, dragHandle, acti
20
21
  children: /* @__PURE__ */ jsxs("div", {
21
22
  className: "sticky start-0 z-10 flex w-fit max-w-full items-center gap-2 bg-inherit",
22
23
  "data-kanban-column-title": "",
23
- children: [swatch, /* @__PURE__ */ jsxs("span", {
24
- className: "flex min-w-0 flex-1 items-center gap-1.5 truncate text-sm font-medium",
24
+ children: [swatch, /* @__PURE__ */ jsxs(TruncatedText, {
25
+ className: "flex flex-1 items-center gap-1.5 text-sm font-medium",
25
26
  children: [title, meta !== void 0 && /* @__PURE__ */ jsx("span", {
26
27
  className: "text-muted-foreground text-xs",
27
28
  children: meta
@@ -1,3 +1,4 @@
1
+ import { TruncatedText } from "../components/truncated-text.js";
1
2
  import { cn } from "../lib/utils.js";
2
3
  import { jsx, jsxs } from "react/jsx-runtime";
3
4
  // src/kanban/sticky-lane.tsx
@@ -58,8 +59,8 @@ const resolveKanbanCardStickyTop = ({ pinnedAbove, rowOffset }) => {
58
59
  const KanbanCollapsedBandCaption = ({ className, label, meta }) => /* @__PURE__ */ jsxs("div", {
59
60
  className: cn("text-muted-foreground sticky flex w-full flex-col items-center gap-2 self-start py-2 text-xs", KANBAN_STICKY_TOP_CLASS, className),
60
61
  "data-kanban-collapsed-band-caption": "",
61
- children: [/* @__PURE__ */ jsx("span", {
62
- className: "max-h-40 truncate font-semibold [writing-mode:vertical-rl]",
62
+ children: [/* @__PURE__ */ jsx(TruncatedText, {
63
+ className: "max-h-40 font-semibold [writing-mode:vertical-rl]",
63
64
  children: label
64
65
  }), /* @__PURE__ */ jsx("span", {
65
66
  className: "tabular-nums",
@@ -0,0 +1,16 @@
1
+ export declare const getFileSizeDisplay: (sizeBytes: number) => {
2
+ unit: string;
3
+ value: number;
4
+ };
5
+ /** Formats a number in the reader's locale, as `use-intl`'s formatter does. */
6
+ type NumberFormatter = {
7
+ readonly number: (value: number, options: {
8
+ maximumFractionDigits: number;
9
+ style: "unit";
10
+ unit: string;
11
+ unitDisplay: "short";
12
+ }) => string;
13
+ };
14
+ /** A file size in the reader's locale, at most one decimal ("1.2 MB"). */
15
+ export declare const formatFileSize: (sizeBytes: number, format: NumberFormatter) => string;
16
+ export {};
@@ -0,0 +1,30 @@
1
+ // src/lib/file-size.ts
2
+ const getFileSizeDisplay = (sizeBytes) => {
3
+ if (sizeBytes < 1e3) return {
4
+ unit: "byte",
5
+ value: sizeBytes
6
+ };
7
+ if (sizeBytes < 1e6) return {
8
+ unit: "kilobyte",
9
+ value: sizeBytes / 1e3
10
+ };
11
+ if (sizeBytes < 1e9) return {
12
+ unit: "megabyte",
13
+ value: sizeBytes / 1e6
14
+ };
15
+ return {
16
+ unit: "gigabyte",
17
+ value: sizeBytes / 1e9
18
+ };
19
+ };
20
+ /** A file size in the reader's locale, at most one decimal ("1.2 MB"). */
21
+ const formatFileSize = (sizeBytes, format) => {
22
+ const size = getFileSizeDisplay(sizeBytes);
23
+ return format.number(size.value, {
24
+ maximumFractionDigits: 1,
25
+ style: "unit",
26
+ unit: size.unit,
27
+ unitDisplay: "short"
28
+ });
29
+ };
30
+ export { formatFileSize, getFileSizeDisplay };
@@ -1,3 +1,4 @@
1
+ import { stableHash } from "./stable-hash.js";
1
2
  // src/lib/matter-colors.ts
2
3
  const DEFAULT_MATTER_SWATCH = "--option-blue";
3
4
  const MATTER_SWATCHES = [
@@ -10,11 +11,7 @@ const MATTER_SWATCHES = [
10
11
  "--option-orange",
11
12
  "--option-teal"
12
13
  ];
13
- const getMatterSwatch = (id) => {
14
- let hash = 0;
15
- for (let i = 0; i < id.length; i++) hash = Math.imul(hash, 31) + (id.codePointAt(i) ?? 0);
16
- return MATTER_SWATCHES[Math.abs(hash) % MATTER_SWATCHES.length] ?? DEFAULT_MATTER_SWATCH;
17
- };
14
+ const getMatterSwatch = (id) => MATTER_SWATCHES[stableHash(id) % MATTER_SWATCHES.length] ?? DEFAULT_MATTER_SWATCH;
18
15
  const getMatterColor = (id) => `var(${getMatterSwatch(id)})`;
19
16
  const hexColorPattern = /^#?[0-9A-Fa-f]{6}$/u;
20
17
  const toPickerColor = (color) => {
@@ -0,0 +1,2 @@
1
+ /** A stable, non-negative hash of a key, so one key always picks one swatch. */
2
+ export declare const stableHash: (key: string) => number;
@@ -0,0 +1,8 @@
1
+ // src/lib/stable-hash.ts
2
+ /** A stable, non-negative hash of a key, so one key always picks one swatch. */
3
+ const stableHash = (key) => {
4
+ let hash = 0;
5
+ for (let i = 0; i < key.length; i++) hash = Math.imul(hash, 31) + (key.codePointAt(i) ?? 0);
6
+ return Math.abs(hash);
7
+ };
8
+ export { stableHash };
@@ -1,5 +1,6 @@
1
1
  import { BidiText } from "../components/bidi-text.js";
2
2
  import { Button } from "../components/button.js";
3
+ import { TruncatedText } from "../components/truncated-text.js";
3
4
  import { CheckIcon, RotateCcwIcon, Trash2Icon } from "../icons.js";
4
5
  import { cn } from "../lib/utils.js";
5
6
  import { ReviewAuthorAvatar } from "./review-author-avatar.js";
@@ -23,9 +24,9 @@ const ReviewCommentCard = ({ author, timestamp, formattedTime, body, anchorText,
23
24
  children: [
24
25
  /* @__PURE__ */ jsxs("p", {
25
26
  className: "text-muted-foreground text-2xs flex min-w-0 items-baseline gap-1.5",
26
- children: [/* @__PURE__ */ jsx(BidiText, {
27
- as: "span",
28
- className: "text-foreground-strong-muted truncate font-medium",
27
+ children: [/* @__PURE__ */ jsx(TruncatedText, {
28
+ className: "text-foreground-strong-muted font-medium",
29
+ render: /* @__PURE__ */ jsx(BidiText, { as: "span" }),
29
30
  children: author.name
30
31
  }), /* @__PURE__ */ jsx("time", {
31
32
  className: "shrink-0 tabular-nums",
@@ -38,9 +39,9 @@ const ReviewCommentCard = ({ author, timestamp, formattedTime, body, anchorText,
38
39
  className: "text-foreground text-xs wrap-anywhere",
39
40
  children: body
40
41
  }),
41
- anchorText === void 0 || anchorText === "" ? null : /* @__PURE__ */ jsx(BidiText, {
42
- as: "p",
43
- className: "text-muted-foreground text-2xs mt-0.5 truncate italic",
42
+ anchorText === void 0 || anchorText === "" ? null : /* @__PURE__ */ jsx(TruncatedText, {
43
+ className: "text-muted-foreground text-2xs mt-0.5 italic",
44
+ render: /* @__PURE__ */ jsx(BidiText, { as: "p" }),
44
45
  children: anchorText
45
46
  }),
46
47
  isStale && staleLabel !== void 0 ? /* @__PURE__ */ jsx("p", {
@@ -7,6 +7,12 @@ import { ReactNode } from "react";
7
7
  */
8
8
  export type ReviewDecisionState = "pending" | "accepted" | "rejected" | "dismissed" | "applying";
9
9
  export type ReviewDecisionSize = "xs" | "sm";
10
+ /**
11
+ * How loudly the pair speaks. `primary` fills Accept, for a surface with one
12
+ * item under review; `quiet` keeps both outlined and ghosted, for a list of
13
+ * items whose one accent is a batch action such as "Accept all".
14
+ */
15
+ export type ReviewDecisionEmphasis = "primary" | "quiet";
10
16
  type ReviewDecisionActionsProps = {
11
17
  state: ReviewDecisionState;
12
18
  onAccept?: (() => void) | undefined;
@@ -14,6 +20,7 @@ type ReviewDecisionActionsProps = {
14
20
  onRevert?: (() => void) | undefined;
15
21
  onReopen?: (() => void) | undefined;
16
22
  size?: ReviewDecisionSize;
23
+ emphasis?: ReviewDecisionEmphasis;
17
24
  /** Labels are supplied by the host: this package carries no catalogs. */
18
25
  acceptLabel?: ReactNode;
19
26
  rejectLabel?: ReactNode;
@@ -26,5 +33,5 @@ type ReviewDecisionActionsProps = {
26
33
  className?: string;
27
34
  };
28
35
  /** Accept / reject / revert / reopen, in one shape, for every review surface. */
29
- export declare const ReviewDecisionActions: ({ state, onAccept, onReject, onRevert, onReopen, size, acceptLabel, rejectLabel, revertLabel, reopenLabel, acceptTooltip, rejectTooltip, disabled, className }: ReviewDecisionActionsProps) => import("react").JSX.Element | null;
36
+ export declare const ReviewDecisionActions: ({ state, onAccept, onReject, onRevert, onReopen, size, emphasis, acceptLabel, rejectLabel, revertLabel, reopenLabel, acceptTooltip, rejectTooltip, disabled, className }: ReviewDecisionActionsProps) => import("react").JSX.Element | null;
30
37
  export {};
@@ -4,12 +4,21 @@ import { cn } from "../lib/utils.js";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  import { panic } from "better-result";
6
6
  // src/review/review-decision-actions.tsx
7
+ const ACCEPT_VARIANT = {
8
+ primary: "default",
9
+ quiet: "outline"
10
+ };
11
+ const REJECT_VARIANT = {
12
+ primary: "outline",
13
+ quiet: "ghost"
14
+ };
7
15
  /** Accept / reject / revert / reopen, in one shape, for every review surface. */
8
- const ReviewDecisionActions = ({ state, onAccept, onReject, onRevert, onReopen, size = "sm", acceptLabel, rejectLabel, revertLabel, reopenLabel, acceptTooltip, rejectTooltip, disabled = false, className }) => {
16
+ const ReviewDecisionActions = ({ state, onAccept, onReject, onRevert, onReopen, size = "sm", emphasis = "primary", acceptLabel, rejectLabel, revertLabel, reopenLabel, acceptTooltip, rejectTooltip, disabled = false, className }) => {
9
17
  const controls = renderControls({
10
18
  acceptLabel,
11
19
  acceptTooltip,
12
20
  disabled,
21
+ emphasis,
13
22
  onAccept,
14
23
  onReject,
15
24
  onReopen,
@@ -28,7 +37,7 @@ const ReviewDecisionActions = ({ state, onAccept, onReject, onRevert, onReopen,
28
37
  children: controls
29
38
  });
30
39
  };
31
- const renderControls = ({ acceptLabel, acceptTooltip, disabled, onAccept, onReject, onReopen, onRevert, rejectLabel, rejectTooltip, reopenLabel, revertLabel, size, state }) => {
40
+ const renderControls = ({ acceptLabel, acceptTooltip, disabled, emphasis, onAccept, onReject, onReopen, onRevert, rejectLabel, rejectTooltip, reopenLabel, revertLabel, size, state }) => {
32
41
  switch (state) {
33
42
  case "pending":
34
43
  case "applying": {
@@ -38,14 +47,14 @@ const renderControls = ({ acceptLabel, acceptTooltip, disabled, onAccept, onReje
38
47
  onClick: onAccept,
39
48
  size,
40
49
  tooltip: acceptTooltip,
41
- variant: "default",
50
+ variant: ACCEPT_VARIANT[emphasis],
42
51
  children: [/* @__PURE__ */ jsx(CheckIcon, {}), acceptLabel]
43
52
  }), onReject === void 0 ? null : /* @__PURE__ */ jsxs(Button, {
44
53
  disabled: inert,
45
54
  onClick: onReject,
46
55
  size,
47
56
  tooltip: rejectTooltip,
48
- variant: "outline",
57
+ variant: REJECT_VARIANT[emphasis],
49
58
  children: [/* @__PURE__ */ jsx(XIcon, {}), rejectLabel]
50
59
  })] });
51
60
  }
@@ -14,6 +14,12 @@ type ReviewOutOfDateNoticeProps = {
14
14
  reasons: readonly ReviewOutOfDateReason[];
15
15
  actionLabel?: ReactNode;
16
16
  onAction?: (() => void) | undefined;
17
+ /** The action is running: its button shows it and takes no second press. */
18
+ actionPending?: boolean;
19
+ /** The action is not available now. */
20
+ actionDisabled?: boolean;
21
+ /** Why the action is not available now, shown on hover over it. */
22
+ actionDisabledReason?: ReactNode;
17
23
  tone?: ReviewOutOfDateTone;
18
24
  className?: string;
19
25
  };
@@ -22,5 +28,5 @@ type ReviewOutOfDateNoticeProps = {
22
28
  * together: they are different reasons to run again, and a reviewer working
23
29
  * through findings should see each one rather than the first.
24
30
  */
25
- export declare const ReviewOutOfDateNotice: ({ reasons, actionLabel, onAction, tone, className }: ReviewOutOfDateNoticeProps) => import("react").JSX.Element | null;
31
+ export declare const ReviewOutOfDateNotice: ({ reasons, actionLabel, onAction, actionPending, actionDisabled, actionDisabledReason, tone, className }: ReviewOutOfDateNoticeProps) => import("react").JSX.Element | null;
26
32
  export {};
@@ -7,7 +7,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
7
7
  * together: they are different reasons to run again, and a reviewer working
8
8
  * through findings should see each one rather than the first.
9
9
  */
10
- const ReviewOutOfDateNotice = ({ reasons, actionLabel, onAction, tone = "warning", className }) => {
10
+ const ReviewOutOfDateNotice = ({ reasons, actionLabel, onAction, actionPending = false, actionDisabled = false, actionDisabledReason, tone = "warning", className }) => {
11
11
  if (reasons.length === 0) return null;
12
12
  return /* @__PURE__ */ jsxs("div", {
13
13
  className: cn("mb-2 rounded-lg border px-3 py-2", TONE_CLASS[tone], className),
@@ -17,8 +17,11 @@ const ReviewOutOfDateNotice = ({ reasons, actionLabel, onAction, tone = "warning
17
17
  children: reasons.map((reason) => /* @__PURE__ */ jsx("li", { children: reason.label }, reason.id))
18
18
  }), onAction === void 0 ? null : /* @__PURE__ */ jsx(Button, {
19
19
  className: "mt-2",
20
+ disabled: actionDisabled,
21
+ loading: actionPending,
20
22
  onClick: onAction,
21
23
  size: "xs",
24
+ tooltip: actionDisabled ? actionDisabledReason : void 0,
22
25
  variant: "outline",
23
26
  children: actionLabel
24
27
  })]
@@ -20,7 +20,12 @@
20
20
  line-height: inherit;
21
21
  }
22
22
 
23
+ /* The field's 10ch floor lives here as a fixed length: a parent sizing its
24
+ row from its content ignores a percentage floor and lays the field out
25
+ wider than it measured, so the overflow came out of the siblings (a
26
+ breadcrumb's matter name shrank to nothing beside its number). */
23
27
  [data-slot="inline-rename-mirror"] {
28
+ min-inline-size: 10ch;
24
29
  visibility: hidden;
25
30
  white-space: pre;
26
31
  overflow: hidden;
@@ -49,6 +54,10 @@
49
54
  position: static;
50
55
  field-sizing: content;
51
56
  inline-size: auto;
57
+ /* The mirror reserves the floor; the input hugs its text so opening a
58
+ short title does not widen or move it. */
59
+ min-inline-size: 0;
60
+ justify-self: start;
52
61
  }
53
62
  }
54
63
 
@@ -659,6 +659,30 @@
659
659
  --option-empty: color-mix(in oklch, #4c566a 60%, #d8dee9);
660
660
  }
661
661
 
662
+ /* ---- Topic swatches ----
663
+ * Time no matter claimed yet, grouped by what it was spent on (a document, a
664
+ * window, an app). A fixed low chroma, a fraction of the default matter
665
+ * swatches', and no matter edge where they are drawn, so a topic never reads
666
+ * as a matter; the hues only tell neighbouring topics apart. Lightness is set
667
+ * per colour scheme so the tint mixed from it stays readable under text. */
668
+ :root {
669
+ --topic-sand: oklch(0.68 0.05 80);
670
+ --topic-sage: oklch(0.68 0.05 150);
671
+ --topic-mist: oklch(0.68 0.05 220);
672
+ --topic-heather: oklch(0.68 0.05 320);
673
+ --topic-clay: oklch(0.68 0.05 40);
674
+ --topic-slate: oklch(0.68 0.05 265);
675
+ }
676
+
677
+ .dark {
678
+ --topic-sand: oklch(0.7 0.05 80);
679
+ --topic-sage: oklch(0.7 0.05 150);
680
+ --topic-mist: oklch(0.7 0.05 220);
681
+ --topic-heather: oklch(0.7 0.05 320);
682
+ --topic-clay: oklch(0.7 0.05 40);
683
+ --topic-slate: oklch(0.7 0.05 265);
684
+ }
685
+
662
686
  /* ---- Derived backgrounds and foregrounds: light ---- */
663
687
  :root {
664
688
  --option-red-bg: color-mix(in srgb, var(--option-red) 12%, var(--background));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/ui",
3
- "version": "0.68.0",
3
+ "version": "0.71.0",
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",
@@ -230,6 +230,10 @@
230
230
  "types": "./dist/components/frame.d.ts",
231
231
  "import": "./dist/components/frame.js"
232
232
  },
233
+ "./file-size": {
234
+ "types": "./dist/lib/file-size.d.ts",
235
+ "import": "./dist/lib/file-size.js"
236
+ },
233
237
  "./hex-color-picker": {
234
238
  "types": "./dist/components/hex-color-picker.d.ts",
235
239
  "import": "./dist/components/hex-color-picker.js"
@@ -406,6 +410,14 @@
406
410
  "types": "./dist/review/text-mark.d.ts",
407
411
  "import": "./dist/review/text-mark.js"
408
412
  },
413
+ "./run-state-mark": {
414
+ "react-native": {
415
+ "types": "./dist/components/run-state-mark.native.d.ts",
416
+ "import": "./dist/components/run-state-mark.native.js"
417
+ },
418
+ "types": "./dist/components/run-state-mark.d.ts",
419
+ "import": "./dist/components/run-state-mark.js"
420
+ },
409
421
  "./scroll-area": {
410
422
  "types": "./dist/components/scroll-area.d.ts",
411
423
  "import": "./dist/components/scroll-area.js"
@@ -909,8 +921,8 @@
909
921
  "test:browser": "playwright test --config playwright.config.ts",
910
922
  "pack:check": "cd ../.. && bun scripts/check-published-exports.ts packages/ui",
911
923
  "typecheck": "bun check --no-pretty --all --project=tsconfig.json",
912
- "lint": "cd ../.. && bun --bun oxlint -c oxlint.config.ts --report-unused-disable-directives-severity=error --type-aware --type-check packages/ui",
913
- "lint:fix": "cd ../.. && bun --bun oxlint -c oxlint.config.ts --type-aware --fix packages/ui",
924
+ "lint": "cd ../.. && bun scripts/lint.ts packages/ui",
925
+ "lint:fix": "cd ../.. && bun scripts/lint.ts --fix packages/ui",
914
926
  "prepack": "bun run build"
915
927
  },
916
928
  "dependencies": {