@devalok/shilp-sutra 0.43.0 → 0.44.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 (90) hide show
  1. package/MIGRATION.md +46 -0
  2. package/dist/_chunks/chat.js +163 -162
  3. package/dist/_chunks/chat.js.map +1 -1
  4. package/dist/_chunks/mention-suggestion.js +34 -32
  5. package/dist/_chunks/mention-suggestion.js.map +1 -1
  6. package/dist/_chunks/oauth-button.js +102 -97
  7. package/dist/_chunks/oauth-button.js.map +1 -1
  8. package/dist/_chunks/tree-view.js +1 -1
  9. package/dist/_chunks/tree-view.js.map +1 -1
  10. package/dist/ai/command-bar.js.map +1 -1
  11. package/dist/composed/command-palette.js +3 -3
  12. package/dist/composed/command-palette.js.map +1 -1
  13. package/dist/composed/content-card.d.ts +6 -0
  14. package/dist/composed/content-card.d.ts.map +1 -1
  15. package/dist/composed/content-card.js.map +1 -1
  16. package/dist/composed/extensions/file-attachment.d.ts.map +1 -1
  17. package/dist/composed/file-preview/audio-preview.d.ts.map +1 -1
  18. package/dist/composed/file-preview.d.ts.map +1 -1
  19. package/dist/composed/file-preview.js +146 -142
  20. package/dist/composed/file-preview.js.map +1 -1
  21. package/dist/composed/filter-bar.js +5 -2
  22. package/dist/composed/filter-bar.js.map +1 -1
  23. package/dist/composed/master-detail.js +1 -1
  24. package/dist/composed/master-detail.js.map +1 -1
  25. package/dist/composed/page-header.js +1 -1
  26. package/dist/composed/page-header.js.map +1 -1
  27. package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -1
  28. package/dist/composed/rich-chat-input/audio-player.d.ts.map +1 -1
  29. package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -1
  30. package/dist/composed/rich-chat-input.js +595 -586
  31. package/dist/composed/rich-chat-input.js.map +1 -1
  32. package/dist/composed/rich-text-editor.d.ts.map +1 -1
  33. package/dist/composed/rich-text-editor.js +164 -162
  34. package/dist/composed/rich-text-editor.js.map +1 -1
  35. package/dist/hooks/index.d.ts +2 -2
  36. package/dist/hooks/index.d.ts.map +1 -1
  37. package/dist/shell/notification-center.d.ts.map +1 -1
  38. package/dist/shell/notification-center.js +101 -97
  39. package/dist/shell/notification-center.js.map +1 -1
  40. package/dist/shell/sidebar.d.ts.map +1 -1
  41. package/dist/shell/sidebar.js +137 -122
  42. package/dist/shell/sidebar.js.map +1 -1
  43. package/dist/shell/top-bar.d.ts.map +1 -1
  44. package/dist/shell/top-bar.js +86 -83
  45. package/dist/shell/top-bar.js.map +1 -1
  46. package/dist/tokens/semantic.css +1 -0
  47. package/dist/ui/avatar.js +1 -1
  48. package/dist/ui/avatar.js.map +1 -1
  49. package/dist/ui/breadcrumb.js +2 -2
  50. package/dist/ui/breadcrumb.js.map +1 -1
  51. package/dist/ui/button.js.map +1 -1
  52. package/dist/ui/card.d.ts +82 -7
  53. package/dist/ui/card.d.ts.map +1 -1
  54. package/dist/ui/card.js +74 -108
  55. package/dist/ui/card.js.map +1 -1
  56. package/dist/ui/chat/message.d.ts.map +1 -1
  57. package/dist/ui/combobox.js +2 -2
  58. package/dist/ui/combobox.js.map +1 -1
  59. package/dist/ui/dropdown-menu.js +9 -3
  60. package/dist/ui/dropdown-menu.js.map +1 -1
  61. package/dist/ui/index.d.ts +2 -1
  62. package/dist/ui/index.d.ts.map +1 -1
  63. package/dist/ui/index.js +58 -57
  64. package/dist/ui/index.js.map +1 -1
  65. package/dist/ui/menubar.js +9 -3
  66. package/dist/ui/menubar.js.map +1 -1
  67. package/dist/ui/oauth-button/oauth-button.d.ts.map +1 -1
  68. package/dist/ui/select.js +5 -2
  69. package/dist/ui/select.js.map +1 -1
  70. package/dist/ui/sidebar.js +73 -73
  71. package/dist/ui/sidebar.js.map +1 -1
  72. package/dist/ui/stat-card.d.ts +8 -5
  73. package/dist/ui/stat-card.d.ts.map +1 -1
  74. package/dist/ui/stat-card.js +168 -150
  75. package/dist/ui/stat-card.js.map +1 -1
  76. package/dist/ui/tabs.d.ts.map +1 -1
  77. package/dist/ui/tabs.js +5 -2
  78. package/dist/ui/tabs.js.map +1 -1
  79. package/dist/ui/truncated-text.d.ts +37 -0
  80. package/dist/ui/truncated-text.d.ts.map +1 -0
  81. package/dist/ui/truncated-text.js +53 -0
  82. package/dist/ui/truncated-text.js.map +1 -0
  83. package/docs/components/ui/card.md +13 -4
  84. package/docs/components/ui/stat-card.md +7 -2
  85. package/docs/components/ui/truncated-text.md +49 -0
  86. package/llms-full.txt +70 -7
  87. package/make-kit/components/card.md +14 -4
  88. package/package.json +1 -1
  89. package/skill/SKILL.md +1 -1
  90. package/skill/references/components-full.md +70 -7
@@ -7,7 +7,7 @@
7
7
  > All variant values and props verified from source CVA definitions.
8
8
  >
9
9
  > Package: @devalok/shilp-sutra
10
- > Version: 0.43.0
10
+ > Version: 0.44.0
11
11
  >
12
12
  > **If you are an AI agent reading this file top-to-bottom:** the Setup
13
13
  > section below is authoritative. If any later per-component doc or a
@@ -1098,11 +1098,14 @@ See `Button` docs for the public API.
1098
1098
  color: "default" | "accent" | "error" | "success" | "warning" | "info" | "neutral" (border accent color)
1099
1099
  size: "sm" | "md" | "lg" (padding — propagated to CardHeader/CardContent/CardFooter via context)
1100
1100
  interactive: boolean (enables hover shadow lift + pointer cursor)
1101
- accent: "left" | "top" | "right" | "bottom" (render a colored accent bar on the specified edge)
1102
- accentColor: "default" | "accent" | "error" | "success" | "warning" | "info" (color of the accent bar; default maps to accent-9)
1101
+
1102
+ ### CardAction
1103
+ placement: "top-right" (default) | "top-left" | "bottom-right" | "bottom-left"
1104
+ tuck: boolean (pull a step toward the corner so an icon button's glyph aligns to the content edge)
1103
1105
 
1104
1106
  ## Compound Components
1105
1107
  Card (root)
1108
+ CardAction ← absolutely-positioned corner slot (badge, icon button, menu)
1106
1109
  CardHeader ← inherits size from Card context
1107
1110
  CardTitle
1108
1111
  CardDescription
@@ -1126,15 +1129,21 @@ See `Button` docs for the public API.
1126
1129
  ## Composability
1127
1130
  - **Size cascades through context** — Card's `size` prop sets padding on CardHeader, CardContent, and CardFooter via `CardSizeContext`. Don't set padding classes on sub-components directly; override via `className` if needed.
1128
1131
  - **Not a compound state machine** — Card, CardHeader, CardTitle, etc. are purely structural. No open/close state.
1129
- - **Accent bar is independent:** The `accent` / `accentColor` props render a decorative colored edge bar (absolutely positioned, `aria-hidden`). Works alongside `color` (which tints the border) the two can stack for layered emphasis.
1132
+ - **Corner slots via `CardAction`:** Pin a badge, icon button, or menu to any corner (`placement`), inset to match the card's content padding. `tuck` pulls an icon button so its glyph (not its padding box) aligns to the content edge. Replaces the removed `accent` decorative bar composition, not a bespoke prop. Card is `relative` to anchor it.
1133
+ - **`color` paints the border, never a stacked rail:** `color` tints the 1px edge (semantic accent/error/success/…). The DS never stacks a border + drop shadow or a colored rail on top (make-kit rule #6 — that reads as an AI tell).
1130
1134
  - **Interactive cards:** Set `interactive={true}` + `onClick` for clickable cards (entire surface becomes the button). Add `aria-label` on the Card root when there's no visible heading. For complex multi-action cards, prefer standard Card with explicit buttons inside.
1131
- - **ContentCard (composed)** is a higher-level wrapper with built-in header/footer slots and title/actions use it for list-row-style cards; use Card directly for custom layouts.
1135
+ - **ContentCard (composed) is deprecated**compose `Card` + `CardHeader`/`CardContent`/`CardAction` directly instead.
1132
1136
 
1133
1137
  ## Gotchas
1134
1138
  - Use `interactive` prop for clickable cards — adds hover lift and pointer cursor
1135
1139
  - Don't override CardHeader/CardContent/CardFooter padding via className if you want the size cascade to work — set size on Card instead
1136
1140
 
1137
1141
  ## Changes
1142
+ ### v0.44.0
1143
+ - **BREAKING** Removed `accent` / `accentColor` (the colored edge-bar / left-rail). Use `<CardAction>` for corner content, or `color` for a tinted border. The DS no longer ships a stacked rail (make-kit rule #6).
1144
+ - **Added** `<CardAction>` compound — composable corner slot (4 placements, `tuck`).
1145
+ - **Changed** Gap-model padding: the container owns vertical `py` + inter-slot `gap`; slots own only horizontal `px`. Adding/removing a slot can't unbalance the bottom edge. Card is now `relative`.
1146
+
1138
1147
  ### v0.31.0
1139
1148
  - **Added** `color` prop: semantic border color (accent, error, success, warning, info, neutral)
1140
1149
  - **Added** `size` prop: `sm | md | lg` — padding propagated to sub-components via React context
@@ -4043,12 +4052,13 @@ import { SplitButton } from '@devalok/shilp-sutra'
4043
4052
  prefix: string (before value, e.g. "$")
4044
4053
  suffix: string (after value, e.g. "users")
4045
4054
  delta: { value: string, direction: "up" | "down" | "neutral" }
4055
+ deltaPlacement: "block" | "inline" (block = below value [default]; inline = on the value's baseline)
4046
4056
  icon: ReactNode | ComponentType<{ className?: string }>
4047
4057
  loading: boolean (renders skeleton)
4048
4058
  comparisonLabel: string (shown after delta, e.g. "vs last month")
4049
4059
  secondaryLabel: string (below main value, e.g. "of $50,000 target")
4050
4060
  progress: number (0-100, renders thin progress bar below value)
4051
- surface: "raised" | "flat" (raised = ring-in-shadow, no border [default]; flat = border, no shadow)
4061
+ variant: "default" | "elevated" | "outline" | "flat" (default = ring-in-shadow, no border; elevated = stronger shadow; outline = border, no shadow; flat = filled, no edge) — delegated to Card
4052
4062
  accentStyle: "none" | "icon" | "tint" (none [default]; icon = accent chip around icon; tint = accent surface wash + accent value)
4053
4063
  iconFill: "soft" | "solid" (chip style when accentStyle="icon"; default soft)
4054
4064
  flash: "up" | "down" | "goal" | "record" | "alert" | "live" | { tone, icon } (opt-in entrance flash; requires icon)
@@ -4088,7 +4098,7 @@ import { SplitButton } from '@devalok/shilp-sutra'
4088
4098
  - **High-density metric card** — optimized for dashboards. Everything optional except `value`. Mix and match features (delta, sparkline, progress, secondary label, footer) per metric's needs.
4089
4099
  - **Router integration via href:** Internally uses `LinkContext` to resolve framework-specific Link components (Next.js, react-router). Set `href` in a LinkProvider-wrapped tree to get seamless client-side navigation without custom asChild wiring.
4090
4100
  - **Interactive modes:** `onClick` makes the entire card a button; `href` makes it a link. Mutually exclusive — href wins if both are set.
4091
- - **Accent (composable, opt-in):** `accentStyle="icon"` wraps `icon` in an accent chip (`iconFill="soft" | "solid"`); `accentStyle="tint"` applies a subtle accent surface wash + accent value. `surface` picks edge-vs-elevation. No colored rail — the DS never stacks a border + drop shadow (make-kit rule #6). Trend health reads from `delta.direction` (up=green, down=red).
4101
+ - **Accent (composable, opt-in):** `accentStyle="icon"` wraps `icon` in an accent chip (`iconFill="soft" | "solid"`); `accentStyle="tint"` applies a subtle accent surface wash + accent value. `variant` picks edge-vs-elevation. No colored rail — the DS never stacks a border + drop shadow (make-kit rule #6). Trend health reads from `delta.direction` (up=green, down=red).
4092
4102
  - **Flash motion (opt-in):** `flash` mounts a toned state glyph (`up`/`down`/`goal`/`record`/`alert`/`live`, or `{ tone, icon }`) that settles to `icon`; `flashSpeed` tunes timing. Reuses the standalone `StatFlash` primitive. Honors `prefers-reduced-motion`.
4093
4103
  - **Sparkline:** Pure SVG, lightweight — no chart library. For rich charts use Chart components. Minimum 2 data points.
4094
4104
  - **Icon auto-sizing:** Accepts `ComponentType<{ className }>` OR `ReactNode`. The component prop (e.g. `icon={IconBolt}`) is preferred — icon is rendered at a consistent size.
@@ -4101,6 +4111,10 @@ import { SplitButton } from '@devalok/shilp-sutra'
4101
4111
  - `sparkline` needs at least 2 data points to render
4102
4112
 
4103
4113
  ## Changes
4114
+ ### v0.44.0
4115
+ - **BREAKING** Renamed `surface` → `variant`, widened to a 4-way scale (`default` | `elevated` | `outline` | `flat`). StatCard now composes `<Card>`, so surface, gap-model padding, and elevation all live in one place. Migration: `surface="raised"` → `variant="default"`, `surface="flat"` → `variant="outline"`.
4116
+ - **Added** `deltaPlacement` (`"block"` [default] | `"inline"`) — inline rides the value's baseline for compact dashboards.
4117
+
4104
4118
  ### v0.43.0
4105
4119
  - **BREAKING** Removed `accent` (colored left-rail). Use `accentStyle` (`"icon"` | `"tint"`) or rely on `delta` for trend colour.
4106
4120
  - **Added** `surface`, `accentStyle`, `iconFill`, `flash`, `flashSpeed`. New standalone `StatFlash` primitive. Base no longer stacks border + shadow.
@@ -4862,6 +4876,55 @@ export default function RootLayout({ children }) {
4862
4876
 
4863
4877
  ### v0.1.0
4864
4878
  - **Added** Initial release
4879
+ # TruncatedText
4880
+
4881
+ - Import: @devalok/shilp-sutra/ui/truncated-text
4882
+ - Server-safe: No
4883
+ - Category: ui
4884
+
4885
+ ## Props
4886
+ children: string (REQUIRED — the full text; always the accessible name, even when shortened)
4887
+ mode: "end" | "clamp" | "middle" (end [default] = single-line ellipsis; clamp = multi-line; middle = keep both ends)
4888
+ lines: number (lines to show in mode="clamp"; default 2)
4889
+ as: "span" | "p" | "div" (element to render; default "span")
4890
+ tooltip: boolean (show the full text in a tooltip when — and only when — actually clipped; default true)
4891
+ title: string (override the full-text accessible name / tooltip; defaults to children)
4892
+ className: string
4893
+
4894
+ ## Defaults
4895
+ mode="end", lines=2, as="span", tooltip=true
4896
+
4897
+ ## Example
4898
+ ```jsx
4899
+ <TruncatedText>{user.name}</TruncatedText>
4900
+
4901
+ // Filenames / emails — keep the extension / domain:
4902
+ <TruncatedText mode="middle">{fileName}</TruncatedText> // report…v7.pdf
4903
+
4904
+ // Multi-line description with a 2-line clamp:
4905
+ <TruncatedText as="p" mode="clamp" lines={2}>{description}</TruncatedText>
4906
+
4907
+ // In a flex row, the shrinking item still needs min-w-0:
4908
+ <div className="flex items-center gap-ds-03">
4909
+ <Avatar … />
4910
+ <TruncatedText className="min-w-0 flex-1">{user.name}</TruncatedText>
4911
+ </div>
4912
+ ```
4913
+
4914
+ ## Composability
4915
+ - **Truncates AND recovers in one place:** `end`/`clamp` are pure CSS (full text stays in the DOM → screen-reader safe). `middle` measures the element and JS-shortens the visible string but keeps the full string as the accessible name. A tooltip appears only when `scrollWidth`/`scrollHeight` actually exceeds the box (measured via ResizeObserver) — no tooltip noise on text that fits.
4916
+ - **`mode="middle"` for identifiers:** filenames (extension), emails (domain), paths, hashes — end-ellipsis destroys the meaningful tail; middle keeps both ends. Middle is not native CSS, so it's measured + recomputed on resize.
4917
+ - **The flexbox gotcha:** `truncate` (and `middle`) do nothing on a flex/grid child unless that item has `min-w-0` (or an explicit width). TruncatedText can't set that on its parent — add `min-w-0` at the call site.
4918
+ - **Don't truncate everything:** page titles/H1, toast bodies, validation messages, and numbers must show fully (a truncated number is a wrong number). Use this for bounded list/nav/metadata text.
4919
+
4920
+ ## Gotchas
4921
+ - `children` must be a string (it's measured + used as the accessible name) — not arbitrary ReactNode.
4922
+ - In a flex row, add `min-w-0` to the TruncatedText (or its column) or nothing truncates.
4923
+ - `mode="middle"` clips to the largest middle-truncated string that fits; the last glyph may be sub-pixel-clipped by overflow-hidden — the tooltip + aria-label always carry the full string.
4924
+
4925
+ ## Changes
4926
+ ### v0.44.0
4927
+ - **Added** Initial release — end/clamp/middle truncation with overflow-aware tooltip recovery.
4865
4928
  # VisuallyHidden
4866
4929
 
4867
4930
  - Import: @devalok/shilp-sutra/ui/visually-hidden