@constructive-io/ui 0.13.0 → 0.14.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 (100) hide show
  1. package/dist/{ai-B7XNnqYL.js → ai-4JrVVL3q.js} +311 -213
  2. package/dist/ai-4JrVVL3q.js.map +1 -0
  3. package/dist/{ai-DJ-YPj8c.cjs → ai-B08ufcbD.cjs} +309 -211
  4. package/dist/ai-B08ufcbD.cjs.map +1 -0
  5. package/dist/components/ai/index.cjs +1 -1
  6. package/dist/components/ai/index.d.cts +1 -1
  7. package/dist/components/ai/index.d.ts +1 -1
  8. package/dist/components/ai/index.js +1 -1
  9. package/dist/components/autocomplete.cjs +1 -1
  10. package/dist/components/autocomplete.js +1 -1
  11. package/dist/components/badge.d.cts +4 -4
  12. package/dist/components/badge.d.ts +4 -4
  13. package/dist/components/button-group.d.cts +1 -1
  14. package/dist/components/button-group.d.ts +1 -1
  15. package/dist/components/button.cjs +3 -3
  16. package/dist/components/button.cjs.map +1 -1
  17. package/dist/components/button.d.cts +2 -2
  18. package/dist/components/button.d.ts +2 -2
  19. package/dist/components/button.js +3 -3
  20. package/dist/components/button.js.map +1 -1
  21. package/dist/components/card.d.cts +1 -1
  22. package/dist/components/card.d.ts +1 -1
  23. package/dist/components/collapsible.cjs +1 -1
  24. package/dist/components/collapsible.cjs.map +1 -1
  25. package/dist/components/collapsible.js +1 -1
  26. package/dist/components/collapsible.js.map +1 -1
  27. package/dist/components/combobox.cjs +1 -1
  28. package/dist/components/combobox.js +1 -1
  29. package/dist/components/command.cjs +8 -3
  30. package/dist/components/command.cjs.map +1 -1
  31. package/dist/components/command.d.cts +4 -1
  32. package/dist/components/command.d.ts +4 -1
  33. package/dist/components/command.js +8 -3
  34. package/dist/components/command.js.map +1 -1
  35. package/dist/components/dropdown-menu.cjs +2 -2
  36. package/dist/components/dropdown-menu.cjs.map +1 -1
  37. package/dist/components/dropdown-menu.js +2 -2
  38. package/dist/components/dropdown-menu.js.map +1 -1
  39. package/dist/components/field.d.cts +1 -1
  40. package/dist/components/field.d.ts +1 -1
  41. package/dist/components/input-otp.cjs +1 -1
  42. package/dist/components/input-otp.js +1 -1
  43. package/dist/components/multi-select.cjs +1 -1
  44. package/dist/components/multi-select.js +1 -1
  45. package/dist/components/popover.cjs +7 -0
  46. package/dist/components/popover.cjs.map +1 -1
  47. package/dist/components/popover.d.cts +7 -1
  48. package/dist/components/popover.d.ts +7 -1
  49. package/dist/components/popover.js +7 -1
  50. package/dist/components/popover.js.map +1 -1
  51. package/dist/components/select.cjs +1 -1
  52. package/dist/components/select.js +1 -1
  53. package/dist/components/sidebar.d.cts +1 -1
  54. package/dist/components/sidebar.d.ts +1 -1
  55. package/dist/components/tabs.cjs +5 -2
  56. package/dist/components/tabs.cjs.map +1 -1
  57. package/dist/components/tabs.js +5 -2
  58. package/dist/components/tabs.js.map +1 -1
  59. package/dist/components/toggle-group.cjs +1 -1
  60. package/dist/components/toggle-group.js +1 -1
  61. package/dist/components/toggle.d.cts +1 -1
  62. package/dist/components/toggle.d.ts +1 -1
  63. package/dist/components/workspace-kit/index.cjs +51 -21
  64. package/dist/components/workspace-kit/index.cjs.map +1 -1
  65. package/dist/components/workspace-kit/index.d.cts +18 -6
  66. package/dist/components/workspace-kit/index.d.ts +18 -6
  67. package/dist/components/workspace-kit/index.js +51 -21
  68. package/dist/components/workspace-kit/index.js.map +1 -1
  69. package/dist/{fluid-highlight-DxWeZ7iu.js → fluid-highlight-CNELHV8o.js} +26 -11
  70. package/dist/fluid-highlight-CNELHV8o.js.map +1 -0
  71. package/dist/{fluid-highlight-AW-OITqJ.cjs → fluid-highlight-YWFRZXsw.cjs} +30 -9
  72. package/dist/fluid-highlight-YWFRZXsw.cjs.map +1 -0
  73. package/dist/{index-z3LqQ5L5.d.ts → index-Cluc_xc5.d.ts} +23 -14
  74. package/dist/{index-CiO-3M_X.d.cts → index-DXoG0ghv.d.cts} +23 -14
  75. package/dist/index.cjs +1 -1
  76. package/dist/index.d.cts +3 -3
  77. package/dist/index.d.ts +3 -3
  78. package/dist/index.js +1 -1
  79. package/dist/{theme-DTTTlylA.d.ts → theme-CKpIa4Fj.d.cts} +42 -26
  80. package/dist/{theme-DTTTlylA.d.cts → theme-CKpIa4Fj.d.ts} +42 -26
  81. package/dist/theme-dials-config.d.cts +1 -1
  82. package/dist/theme-dials-config.d.ts +1 -1
  83. package/dist/theme-presets.d.cts +1 -1
  84. package/dist/theme-presets.d.ts +1 -1
  85. package/dist/{theme-tuning-TJ76tnxZ.d.cts → theme-tuning-CTOHSrsh.d.cts} +2 -2
  86. package/dist/{theme-tuning-DjgDvV8V.d.ts → theme-tuning-DOko6Pmy.d.ts} +2 -2
  87. package/dist/theme-tuning.d.cts +1 -1
  88. package/dist/theme-tuning.d.ts +1 -1
  89. package/dist/theme.cjs +28 -22
  90. package/dist/theme.cjs.map +1 -1
  91. package/dist/theme.d.cts +1 -1
  92. package/dist/theme.d.ts +1 -1
  93. package/dist/theme.js +28 -22
  94. package/dist/theme.js.map +1 -1
  95. package/package.json +5 -2
  96. package/src/styles/globals.css +43 -25
  97. package/dist/ai-B7XNnqYL.js.map +0 -1
  98. package/dist/ai-DJ-YPj8c.cjs.map +0 -1
  99. package/dist/fluid-highlight-AW-OITqJ.cjs.map +0 -1
  100. package/dist/fluid-highlight-DxWeZ7iu.js.map +0 -1
@@ -186,10 +186,14 @@ type SwitcherTriggerProps = {
186
186
  declare function SwitcherTrigger({ label, name, glyph, collapsed }: SwitcherTriggerProps): React$1.JSX.Element;
187
187
  //#endregion
188
188
  //#region src/components/workspace-kit/nav.d.ts
189
- /** Labels a rail control with a tooltip only while the sidebar is collapsed. */
190
- declare function RailTip({ label, collapsed, children }: {
189
+ /**
190
+ * Labels a rail control with a tooltip while the sidebar is collapsed. A `tip`
191
+ * adds a line under the label there, and is the whole tooltip when expanded.
192
+ */
193
+ declare function RailTip({ label, collapsed, tip, children }: {
191
194
  label: string;
192
195
  collapsed: boolean;
196
+ tip?: React$1.ReactNode;
193
197
  children: React$1.ReactElement;
194
198
  }): React$1.JSX.Element;
195
199
  type NavRowProps = {
@@ -202,6 +206,10 @@ type NavRowProps = {
202
206
  labelNode?: React$1.ReactNode;
203
207
  /** Quiet trailing value such as a count. */
204
208
  trailing?: React$1.ReactNode;
209
+ /** Tooltip detail, e.g. what an agent waits on. Shown expanded too; replaces the truncation title. */
210
+ tip?: React$1.ReactNode;
211
+ /** A short word under the collapsed square's glyph, e.g. "Approve". The square stretches into a capsule to hold it. */
212
+ railBadge?: React$1.ReactNode;
205
213
  /** Row tone when not active. */
206
214
  muted?: boolean;
207
215
  /** Not choosable right now, e.g. while another row loads or policy forbids it. */
@@ -222,7 +230,7 @@ type NavRowLinkProps = Omit<React$1.ComponentProps<'a'>, 'href'> & {
222
230
  * One sidebar row. Focus reads through weight and a tinted fill, never a
223
231
  * coloured dot; hover is instant because rows are clicked constantly.
224
232
  */
225
- declare function NavRow({ label, collapsed, active, leading, labelNode, trailing, muted, disabled, busy, onClick, href, renderLink }: NavRowProps): React$1.JSX.Element;
233
+ declare function NavRow({ label, collapsed, active, leading, labelNode, trailing, tip, railBadge, muted, disabled, busy, onClick, href, renderLink }: NavRowProps): React$1.JSX.Element;
226
234
  declare function NavIcon({ icon: Icon, active }: {
227
235
  icon: LucideIcon;
228
236
  active?: boolean;
@@ -283,13 +291,17 @@ declare const ICON_BUTTON_SIZE: {
283
291
  readonly md: "size-7";
284
292
  readonly lg: "size-8";
285
293
  };
286
- type TooltipIconButtonProps = Omit<React$1.ComponentProps<'button'>, 'aria-label'> & {
287
- label: string;
288
- side?: 'top' | 'right' | 'bottom' | 'left';
294
+ type IconButtonOptions = {
289
295
  variant?: keyof typeof ICON_BUTTON_VARIANT;
290
296
  size?: keyof typeof ICON_BUTTON_SIZE;
291
297
  /** Set false when neighbours sit closer than the extended hit area. */
292
298
  extendHitArea?: boolean;
299
+ /** For a menu trigger: it keeps its hover fill while the menu is open, so the menu reads as coming from it. */
300
+ menu?: boolean;
301
+ };
302
+ type TooltipIconButtonProps = Omit<React$1.ComponentProps<'button'>, 'aria-label'> & Omit<IconButtonOptions, 'menu'> & {
303
+ label: string;
304
+ side?: 'top' | 'right' | 'bottom' | 'left';
293
305
  };
294
306
  /**
295
307
  * Icon-only button with a matching tooltip and accessible name. Hover state is
@@ -100,14 +100,25 @@ const ICON_BUTTON_SIZE = {
100
100
  lg: "size-8"
101
101
  };
102
102
  /**
103
+ * The look of `TooltipIconButton`, for icon-only controls that render their own
104
+ * element, such as a menu trigger. Hover state is instant; press scales to 0.96.
105
+ */
106
+ function iconButtonClass({ variant = "ghost", size = "md", extendHitArea = true, menu = false } = {}) {
107
+ return cn("grid shrink-0 cursor-pointer place-items-center rounded-md disabled:cursor-not-allowed disabled:opacity-40", ICON_BUTTON_VARIANT[variant], ICON_BUTTON_SIZE[size], pressClass, focusRingClass, extendHitArea && "relative before:absolute before:-inset-2 before:content-[''] pointer-coarse:before:-inset-2.5", menu && "data-popup-open:bg-overlay-hover");
108
+ }
109
+ /**
103
110
  * Icon-only button with a matching tooltip and accessible name. Hover state is
104
111
  * instant; press scales to 0.96.
105
112
  */
106
- function TooltipIconButton({ label, side = "top", variant = "ghost", size = "md", extendHitArea = true, className, children, ...props }) {
113
+ function TooltipIconButton({ label, side = "top", variant, size, extendHitArea, className, children, ...props }) {
107
114
  return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsx("button", {
108
115
  type: "button",
109
116
  "aria-label": label,
110
- className: cn("grid shrink-0 cursor-pointer place-items-center rounded-md disabled:cursor-not-allowed disabled:opacity-40", ICON_BUTTON_VARIANT[variant], ICON_BUTTON_SIZE[size], pressClass, focusRingClass, extendHitArea && "relative before:absolute before:-inset-2 before:content-[''] pointer-coarse:before:-inset-2.5", className),
117
+ className: cn(iconButtonClass({
118
+ variant,
119
+ size,
120
+ extendHitArea
121
+ }), className),
111
122
  ...props,
112
123
  children
113
124
  }) }), /* @__PURE__ */ jsx(TooltipContent, {
@@ -128,8 +139,11 @@ const TONE_COLOR = {
128
139
  /**
129
140
  * Tone fills mixed from `--tone`. On a white page the fill carries the colour and the
130
141
  * border only defines the edge; dark keeps a fainter fill under a stronger border.
142
+ * The light edge is translucent so it sits on any row tint, and where relative colours
143
+ * work its chroma is capped first: a translucent edge of a tone outside sRGB (the info
144
+ * blue) otherwise renders yellow at the rounded corners.
131
145
  */
132
- const toneBadgeClass = cn("border-[color-mix(in_oklab,var(--tone)_25%,transparent)] bg-[color-mix(in_oklab,var(--tone)_14%,transparent)]", "text-[color-mix(in_oklab,var(--tone),var(--foreground)_32%)]", "dark:border-[color-mix(in_oklab,var(--tone)_35%,transparent)] dark:bg-[color-mix(in_oklab,var(--tone)_9%,transparent)]");
146
+ const toneBadgeClass = cn("[--tone-edge:color-mix(in_oklab,var(--tone)_25%,transparent)]", "supports-[color:oklch(from_red_l_c_h)]:[--tone-edge:color-mix(in_oklab,oklch(from_var(--tone)_l_min(c,0.12)_h)_25%,transparent)]", "border-(--tone-edge) bg-[color-mix(in_oklab,var(--tone)_14%,transparent)]", "text-[color-mix(in_oklab,var(--tone),var(--foreground)_32%)]", "dark:border-[color-mix(in_oklab,var(--tone)_35%,transparent)] dark:bg-[color-mix(in_oklab,var(--tone)_9%,transparent)]");
133
147
  /** Small tinted label. Clickable when `onClick` is set. */
134
148
  function ToneBadge({ tone, children, onClick, className }) {
135
149
  const color = tone === "neutral" ? null : TONE_COLOR[tone];
@@ -220,7 +234,7 @@ function ViewHeader({ icon: Icon, title, children, divider = true }) {
220
234
  function ViewFrame({ icon, title, actions, label, maxWidth = "max-w-6xl", className, children }) {
221
235
  return /* @__PURE__ */ jsxs("section", {
222
236
  "aria-label": label ?? (typeof title === "string" ? title : void 0),
223
- className: "flex min-w-0 flex-1 flex-col",
237
+ className: "flex min-h-0 min-w-0 flex-1 flex-col",
224
238
  children: [/* @__PURE__ */ jsx(ViewHeader, {
225
239
  icon,
226
240
  title,
@@ -954,29 +968,44 @@ function SwitcherTrigger({ label, name, glyph, collapsed }) {
954
968
  //#endregion
955
969
  //#region src/components/workspace-kit/nav.tsx
956
970
  const ROW = cn("relative flex h-8 cursor-pointer items-center rounded-md text-start text-sm pointer-coarse:h-10", focusRingClass);
957
- /** Full-width row with a label, or a centred square matching the rail's icon buttons. */
958
- const rowShape = (collapsed) => collapsed ? "size-8 shrink-0 justify-center pointer-coarse:size-10" : "w-full gap-2 px-2";
959
- /** Labels a rail control with a tooltip only while the sidebar is collapsed. */
960
- function RailTip({ label, collapsed, children }) {
961
- if (!collapsed) return children;
971
+ /**
972
+ * Full-width row with a label, or a centred square matching the rail's icon
973
+ * buttons. A rail badge stretches the square into a capsule: the glyph, then
974
+ * the word, filling the rail's width so the word never overhangs the fill.
975
+ */
976
+ const rowShape = (collapsed, badge = false) => collapsed ? badge ? "h-auto w-full shrink-0 flex-col justify-center gap-0.5 py-1.5" : "size-8 shrink-0 justify-center pointer-coarse:size-10" : "w-full gap-2 px-2";
977
+ /**
978
+ * Labels a rail control with a tooltip while the sidebar is collapsed. A `tip`
979
+ * adds a line under the label there, and is the whole tooltip when expanded.
980
+ */
981
+ function RailTip({ label, collapsed, tip, children }) {
982
+ if (!collapsed && !tip) return children;
962
983
  return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: children }), /* @__PURE__ */ jsx(TooltipContent, {
963
984
  side: "right",
964
- children: label
985
+ children: collapsed ? /* @__PURE__ */ jsxs(Fragment, { children: [label, tip ? /* @__PURE__ */ jsx("span", {
986
+ className: "block text-pretty text-muted-foreground",
987
+ children: tip
988
+ }) : null] }) : tip
965
989
  })] });
966
990
  }
967
991
  /**
968
992
  * One sidebar row. Focus reads through weight and a tinted fill, never a
969
993
  * coloured dot; hover is instant because rows are clicked constantly.
970
994
  */
971
- function NavRow({ label, collapsed, active, leading, labelNode, trailing, muted, disabled, busy, onClick, href, renderLink }) {
972
- const content = /* @__PURE__ */ jsxs(Fragment, { children: [leading, collapsed ? null : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
973
- title: label,
974
- className: "min-w-0 flex-1 truncate",
975
- children: /* @__PURE__ */ jsx("bdi", { children: labelNode ?? label })
976
- }), busy ? /* @__PURE__ */ jsx(Loader2, {
977
- "aria-hidden": "true",
978
- className: "size-3.5 shrink-0 text-muted-foreground motion-safe:animate-spin"
979
- }) : trailing] })] });
995
+ function NavRow({ label, collapsed, active, leading, labelNode, trailing, tip, railBadge, muted, disabled, busy, onClick, href, renderLink }) {
996
+ const badge = collapsed ? railBadge : null;
997
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
998
+ leading,
999
+ badge,
1000
+ collapsed ? null : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
1001
+ title: tip ? void 0 : label,
1002
+ className: "min-w-0 flex-1 truncate",
1003
+ children: /* @__PURE__ */ jsx("bdi", { children: labelNode ?? label })
1004
+ }), busy ? /* @__PURE__ */ jsx(Loader2, {
1005
+ "aria-hidden": "true",
1006
+ className: "size-3.5 shrink-0 text-muted-foreground motion-safe:animate-spin"
1007
+ }) : trailing] })
1008
+ ] });
980
1009
  const tone = active ? "bg-sidebar-accent font-medium text-foreground" : muted ? "text-muted-foreground" : "text-sidebar-foreground";
981
1010
  const shared = {
982
1011
  "aria-label": collapsed ? label : void 0,
@@ -993,7 +1022,7 @@ function NavRow({ label, collapsed, active, leading, labelNode, trailing, muted,
993
1022
  if (disabled) event.preventDefault();
994
1023
  else onClick?.();
995
1024
  },
996
- className: cn(ROW, rowShape(collapsed), "no-underline", disabled ? "cursor-not-allowed opacity-50" : cn("hover:bg-overlay-hover", muted && !active && "hover:text-foreground"), tone),
1025
+ className: cn(ROW, rowShape(collapsed, Boolean(badge)), "no-underline", disabled ? "cursor-not-allowed opacity-50" : cn("hover:bg-overlay-hover", muted && !active && "hover:text-foreground"), tone),
997
1026
  children: content
998
1027
  };
999
1028
  row = renderLink ? renderLink(props) : /* @__PURE__ */ jsx("a", { ...props });
@@ -1002,7 +1031,7 @@ function NavRow({ label, collapsed, active, leading, labelNode, trailing, muted,
1002
1031
  ...shared,
1003
1032
  disabled,
1004
1033
  onClick,
1005
- className: cn(ROW, rowShape(collapsed), "disabled:cursor-not-allowed disabled:opacity-50", active ? tone : cn("enabled:hover:bg-overlay-hover", tone, muted && "enabled:hover:text-foreground")),
1034
+ className: cn(ROW, rowShape(collapsed, Boolean(badge)), "disabled:cursor-not-allowed disabled:opacity-50", active ? tone : cn("enabled:hover:bg-overlay-hover", tone, muted && "enabled:hover:text-foreground")),
1006
1035
  children: content
1007
1036
  });
1008
1037
  return /* @__PURE__ */ jsx("li", {
@@ -1010,6 +1039,7 @@ function NavRow({ label, collapsed, active, leading, labelNode, trailing, muted,
1010
1039
  children: /* @__PURE__ */ jsx(RailTip, {
1011
1040
  label,
1012
1041
  collapsed,
1042
+ tip,
1013
1043
  children: row
1014
1044
  })
1015
1045
  });