@devalok/shilp-sutra 0.42.1 → 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 (130) hide show
  1. package/MIGRATION.md +78 -0
  2. package/dist/_chunks/chat.js +164 -163
  3. package/dist/_chunks/chat.js.map +1 -1
  4. package/dist/_chunks/mention-suggestion.js +35 -33
  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/popover.js +1 -1
  9. package/dist/_chunks/popover.js.map +1 -1
  10. package/dist/_chunks/shared.js +1 -1
  11. package/dist/_chunks/shared.js.map +1 -1
  12. package/dist/_chunks/tree-view.js +1 -1
  13. package/dist/_chunks/tree-view.js.map +1 -1
  14. package/dist/ai/command-bar.js +1 -1
  15. package/dist/ai/command-bar.js.map +1 -1
  16. package/dist/composed/bulk-action-bar.js +1 -1
  17. package/dist/composed/bulk-action-bar.js.map +1 -1
  18. package/dist/composed/command-palette.js +4 -4
  19. package/dist/composed/command-palette.js.map +1 -1
  20. package/dist/composed/content-card.d.ts +6 -0
  21. package/dist/composed/content-card.d.ts.map +1 -1
  22. package/dist/composed/content-card.js +1 -1
  23. package/dist/composed/content-card.js.map +1 -1
  24. package/dist/composed/error-boundary.js +1 -1
  25. package/dist/composed/error-boundary.js.map +1 -1
  26. package/dist/composed/extensions/emoji-suggestion.js +1 -1
  27. package/dist/composed/extensions/emoji-suggestion.js.map +1 -1
  28. package/dist/composed/extensions/file-attachment.d.ts.map +1 -1
  29. package/dist/composed/file-preview/audio-preview.d.ts.map +1 -1
  30. package/dist/composed/file-preview.d.ts.map +1 -1
  31. package/dist/composed/file-preview.js +147 -143
  32. package/dist/composed/file-preview.js.map +1 -1
  33. package/dist/composed/filter-bar.js +5 -2
  34. package/dist/composed/filter-bar.js.map +1 -1
  35. package/dist/composed/master-detail.js +1 -1
  36. package/dist/composed/master-detail.js.map +1 -1
  37. package/dist/composed/page-header.js +1 -1
  38. package/dist/composed/page-header.js.map +1 -1
  39. package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -1
  40. package/dist/composed/rich-chat-input/audio-player.d.ts.map +1 -1
  41. package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -1
  42. package/dist/composed/rich-chat-input.js +600 -591
  43. package/dist/composed/rich-chat-input.js.map +1 -1
  44. package/dist/composed/rich-text-editor.d.ts.map +1 -1
  45. package/dist/composed/rich-text-editor.js +166 -164
  46. package/dist/composed/rich-text-editor.js.map +1 -1
  47. package/dist/hooks/index.d.ts +2 -2
  48. package/dist/hooks/index.d.ts.map +1 -1
  49. package/dist/shell/notification-center.d.ts.map +1 -1
  50. package/dist/shell/notification-center.js +102 -98
  51. package/dist/shell/notification-center.js.map +1 -1
  52. package/dist/shell/sidebar.d.ts +6 -0
  53. package/dist/shell/sidebar.d.ts.map +1 -1
  54. package/dist/shell/sidebar.js +142 -118
  55. package/dist/shell/sidebar.js.map +1 -1
  56. package/dist/shell/top-bar.d.ts.map +1 -1
  57. package/dist/shell/top-bar.js +87 -84
  58. package/dist/shell/top-bar.js.map +1 -1
  59. package/dist/tokens/semantic.css +9 -2
  60. package/dist/ui/alert-dialog.js +1 -1
  61. package/dist/ui/alert-dialog.js.map +1 -1
  62. package/dist/ui/autocomplete.js +1 -1
  63. package/dist/ui/autocomplete.js.map +1 -1
  64. package/dist/ui/avatar.js +1 -1
  65. package/dist/ui/avatar.js.map +1 -1
  66. package/dist/ui/breadcrumb.js +2 -2
  67. package/dist/ui/breadcrumb.js.map +1 -1
  68. package/dist/ui/button.js.map +1 -1
  69. package/dist/ui/card.d.ts +82 -7
  70. package/dist/ui/card.d.ts.map +1 -1
  71. package/dist/ui/card.js +76 -110
  72. package/dist/ui/card.js.map +1 -1
  73. package/dist/ui/chat/message.d.ts.map +1 -1
  74. package/dist/ui/color-input.js +1 -1
  75. package/dist/ui/color-input.js.map +1 -1
  76. package/dist/ui/combobox.js +3 -3
  77. package/dist/ui/combobox.js.map +1 -1
  78. package/dist/ui/context-menu.js +2 -2
  79. package/dist/ui/context-menu.js.map +1 -1
  80. package/dist/ui/data-table-bulk-actions.js +1 -1
  81. package/dist/ui/data-table-bulk-actions.js.map +1 -1
  82. package/dist/ui/dialog.js +1 -1
  83. package/dist/ui/dialog.js.map +1 -1
  84. package/dist/ui/dropdown-menu.js +11 -5
  85. package/dist/ui/dropdown-menu.js.map +1 -1
  86. package/dist/ui/hover-card.js +1 -1
  87. package/dist/ui/hover-card.js.map +1 -1
  88. package/dist/ui/index.d.ts +3 -1
  89. package/dist/ui/index.d.ts.map +1 -1
  90. package/dist/ui/index.js +58 -56
  91. package/dist/ui/index.js.map +1 -1
  92. package/dist/ui/input-otp.js +1 -1
  93. package/dist/ui/input-otp.js.map +1 -1
  94. package/dist/ui/menubar.js +12 -6
  95. package/dist/ui/menubar.js.map +1 -1
  96. package/dist/ui/navigation-menu.js +1 -1
  97. package/dist/ui/navigation-menu.js.map +1 -1
  98. package/dist/ui/oauth-button/oauth-button.d.ts.map +1 -1
  99. package/dist/ui/select.js +6 -3
  100. package/dist/ui/select.js.map +1 -1
  101. package/dist/ui/sidebar.js +74 -74
  102. package/dist/ui/sidebar.js.map +1 -1
  103. package/dist/ui/split-button.js +1 -1
  104. package/dist/ui/split-button.js.map +1 -1
  105. package/dist/ui/stat-card.d.ts +26 -3
  106. package/dist/ui/stat-card.d.ts.map +1 -1
  107. package/dist/ui/stat-card.js +183 -150
  108. package/dist/ui/stat-card.js.map +1 -1
  109. package/dist/ui/stat-flash.d.ts +46 -0
  110. package/dist/ui/stat-flash.d.ts.map +1 -0
  111. package/dist/ui/stat-flash.js +114 -0
  112. package/dist/ui/stat-flash.js.map +1 -0
  113. package/dist/ui/tabs.d.ts.map +1 -1
  114. package/dist/ui/tabs.js +5 -2
  115. package/dist/ui/tabs.js.map +1 -1
  116. package/dist/ui/toast.js +2 -2
  117. package/dist/ui/toast.js.map +1 -1
  118. package/dist/ui/truncated-text.d.ts +37 -0
  119. package/dist/ui/truncated-text.d.ts.map +1 -0
  120. package/dist/ui/truncated-text.js +53 -0
  121. package/dist/ui/truncated-text.js.map +1 -0
  122. package/docs/components/ui/card.md +13 -4
  123. package/docs/components/ui/stat-card.md +18 -3
  124. package/docs/components/ui/stat-flash.md +44 -0
  125. package/docs/components/ui/truncated-text.md +49 -0
  126. package/llms-full.txt +125 -8
  127. package/make-kit/components/card.md +14 -4
  128. package/package.json +1 -1
  129. package/skill/SKILL.md +1 -1
  130. package/skill/references/components-full.md +125 -8
@@ -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.42.1
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,17 @@ 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
- accent: "default" | "success" | "warning" | "error" | "info" (left border color)
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
4062
+ accentStyle: "none" | "icon" | "tint" (none [default]; icon = accent chip around icon; tint = accent surface wash + accent value)
4063
+ iconFill: "soft" | "solid" (chip style when accentStyle="icon"; default soft)
4064
+ flash: "up" | "down" | "goal" | "record" | "alert" | "live" | { tone, icon } (opt-in entrance flash; requires icon)
4065
+ flashSpeed: "fast" | "normal" | "slow" (default normal)
4052
4066
  sparkline: number[] (renders mini SVG line chart)
4053
4067
  onClick: () => void (makes card clickable with hover state)
4054
4068
  href: string (makes card a link via LinkContext)
@@ -4066,7 +4080,8 @@ import { SplitButton } from '@devalok/shilp-sutra'
4066
4080
  delta={{ value: "+12%", direction: "up" }}
4067
4081
  comparisonLabel="vs last month"
4068
4082
  icon={<IconCurrencyDollar />}
4069
- accent="success"
4083
+ accentStyle="icon"
4084
+ flash="up"
4070
4085
  />
4071
4086
 
4072
4087
  <StatCard
@@ -4083,7 +4098,8 @@ import { SplitButton } from '@devalok/shilp-sutra'
4083
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.
4084
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.
4085
4100
  - **Interactive modes:** `onClick` makes the entire card a button; `href` makes it a link. Mutually exclusive — href wins if both are set.
4086
- - **Accent bar semantic:** Use `accent` to signal metric health at a glance (success for positive, warning for at-risk, error for over-target). Combine with delta.direction for layered emphasis.
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).
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`.
4087
4103
  - **Sparkline:** Pure SVG, lightweight — no chart library. For rich charts use Chart components. Minimum 2 data points.
4088
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.
4089
4105
  - **Loading state:** `loading={true}` renders the full card skeleton — use during initial data fetch.
@@ -4095,11 +4111,63 @@ import { SplitButton } from '@devalok/shilp-sutra'
4095
4111
  - `sparkline` needs at least 2 data points to render
4096
4112
 
4097
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
+
4118
+ ### v0.43.0
4119
+ - **BREAKING** Removed `accent` (colored left-rail). Use `accentStyle` (`"icon"` | `"tint"`) or rely on `delta` for trend colour.
4120
+ - **Added** `surface`, `accentStyle`, `iconFill`, `flash`, `flashSpeed`. New standalone `StatFlash` primitive. Base no longer stacks border + shadow.
4121
+
4098
4122
  ### v0.2.0
4099
4123
  - **Added** `icon` prop now accepts `React.ComponentType` (e.g., `icon={IconBolt}`) in addition to `ReactNode`
4100
4124
 
4101
4125
  ### v0.1.0
4102
4126
  - **Added** Initial release
4127
+ # StatFlash
4128
+
4129
+ - Import: @devalok/shilp-sutra/ui/stat-flash
4130
+ - Server-safe: No
4131
+ - Category: ui
4132
+
4133
+ ## Props
4134
+ icon: ReactNode | ComponentType<{ className?: string }> (REQUIRED — settled identity glyph)
4135
+ flash: "up" | "down" | "goal" | "record" | "alert" | "live" | { tone, icon } (REQUIRED — the entrance state)
4136
+ fill: "soft" | "solid" (resting chip style; default soft)
4137
+ speed: "fast" | "normal" | "slow" (coarse motion preset; default normal)
4138
+ holdMs: number (override how long the flash holds before settling)
4139
+ settleTransition: Transition (override the icon scale-in transition)
4140
+ flashTransition: Transition (override the flash enter/exit fade)
4141
+
4142
+ ## Defaults
4143
+ fill="soft", speed="normal"
4144
+
4145
+ ## Example
4146
+ ```jsx
4147
+ // Preset: green up-arrow flashes, then settles to the folder icon
4148
+ <StatFlash icon={<IconFolder />} flash="up" />
4149
+
4150
+ // Explicit tone + glyph
4151
+ <StatFlash icon={<IconActivity />} flash={{ tone: "info", icon: <IconBolt /> }} fill="solid" />
4152
+
4153
+ // Composable speed: coarse preset + fine override
4154
+ <StatFlash icon={<IconFolder />} flash="up" speed="fast" holdMs={300} />
4155
+ ```
4156
+
4157
+ ## Composability
4158
+ - **State → identity primitive:** the chip mounts showing a transient *state* (a toned glyph — up-arrow on green, check, alert…) then settles into the stable *identity* icon. Used by `StatCard`'s `flash` prop, but standalone too (list rows, badges, toasts).
4159
+ - **Tone slot:** six named presets (`up`/`down`/`goal`/`record`/`alert`/`live`) map to DS semantic tones (success/error/warning/info/accent) + a glyph. Pass `{ tone, icon }` for anything else.
4160
+ - **Composable motion:** `speed` is a coarse preset built from the DS motion tokens; `holdMs` / `settleTransition` / `flashTransition` each override one slice and fall back to the preset.
4161
+ - **Accessible by default:** honors `prefers-reduced-motion` — renders the settled identity directly, no flash. The chip is `aria-hidden` (decorative; the metric's text carries meaning).
4162
+
4163
+ ## Gotchas
4164
+ - `flash` and `icon` are both required — the flash settles *to* the icon.
4165
+ - Fine overrides win over `speed`.
4166
+ - Decorative only — never the sole carrier of meaning (it's `aria-hidden`).
4167
+
4168
+ ## Changes
4169
+ ### v0.43.0
4170
+ - **Added** Initial release. Powers `StatCard`'s `flash` prop.
4103
4171
  # StatusDot
4104
4172
 
4105
4173
  - Import: @devalok/shilp-sutra/ui/status-dot
@@ -4808,6 +4876,55 @@ export default function RootLayout({ children }) {
4808
4876
 
4809
4877
  ### v0.1.0
4810
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.
4811
4928
  # VisuallyHidden
4812
4929
 
4813
4930
  - Import: @devalok/shilp-sutra/ui/visually-hidden