@viliha/vui-ui 1.1.6 → 1.1.8

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viliha/vui-ui",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Vui UI — a clean, token-driven React admin/CRM component library built on Tailwind CSS v4, shadcn-style patterns, and Radix Icons. Ships as TypeScript source (Just-in-Time), compiled by the consuming app.",
5
5
  "license": "MIT",
6
6
  "author": "Suman Bonakurthi",
@@ -279,6 +279,9 @@ interface RecordViewProps<T extends { id: RowId }> {
279
279
  /** Persist this view's filter / sort / page under this key (e.g. the route),
280
280
  * so the work survives leaving and returning via the open-tabs strip. */
281
281
  persistKey?: string;
282
+ /** Allow dragging column edges to resize them. Off by default — columns
283
+ * auto-size, and no resize handle appears on hover. */
284
+ resizableColumns?: boolean;
282
285
  }
283
286
 
284
287
  export function RecordView<T extends { id: RowId }>({
@@ -299,6 +302,7 @@ export function RecordView<T extends { id: RowId }>({
299
302
  onView,
300
303
  onEdit,
301
304
  persistKey,
305
+ resizableColumns = false,
302
306
  }: RecordViewProps<T>) {
303
307
  const { titleLeading } = React.useContext(PageChromeContext);
304
308
  // Surface the page title/icon in the app's global top bar.
@@ -408,7 +412,8 @@ export function RecordView<T extends { id: RowId }>({
408
412
  0,
409
413
  );
410
414
 
411
- const resizeHandle = (col: string, label: string) => (
415
+ const resizeHandle = (col: string, label: string) =>
416
+ !resizableColumns ? null : (
412
417
  <button
413
418
  type="button"
414
419
  aria-label={`Resize ${label} column`}
@@ -1547,23 +1552,26 @@ function RecordDetailPanel<T extends { id: RowId }>({
1547
1552
  <h3 className="border-b border-border bg-muted/40 px-3 py-2 font-semibold text-[var(--button-primary)]">
1548
1553
  {group}
1549
1554
  </h3>
1550
- <dl className="divide-y divide-border">
1555
+ {/* Two columns sized to content: the label column auto-widens to the
1556
+ longest label (never wraps), controls stay aligned. The panel width
1557
+ follows (see the slide-over `sm:w-auto`). */}
1558
+ <dl className="grid grid-cols-[max-content_minmax(12rem,1fr)] gap-x-3">
1551
1559
  {groupFields.map((f) => (
1552
1560
  // Label, icon, required mark and control share one baseline —
1553
1561
  // vertically centered. ponytail: a wrapped textarea grows down and
1554
1562
  // the label centers against it; acceptable for the single-line norm.
1555
1563
  <div
1556
1564
  key={f.key}
1557
- className="flex items-center gap-3 px-3 py-3 leading-relaxed"
1565
+ className="col-span-2 grid grid-cols-subgrid items-center border-t border-border px-3 py-3 leading-relaxed first:border-t-0"
1558
1566
  >
1559
- <dt className="flex w-28 shrink-0 items-center gap-1.5 text-muted-foreground">
1567
+ <dt className="flex items-center gap-1.5 whitespace-nowrap text-muted-foreground">
1560
1568
  {f.icon && (
1561
1569
  <f.icon className="size-3.5 text-[var(--button-primary)]" />
1562
1570
  )}
1563
1571
  {f.label}
1564
1572
  {f.required && <RequiredMark />}
1565
1573
  </dt>
1566
- <dd className="min-w-0 flex-1">
1574
+ <dd className="min-w-0">
1567
1575
  {f.render ? (
1568
1576
  <div>{f.render(draft)}</div>
1569
1577
  ) : !readOnly && f.editable ? (
@@ -1724,7 +1732,9 @@ function RecordDetailPanel<T extends { id: RowId }>({
1724
1732
  <aside
1725
1733
  aria-label={`${singular} form`}
1726
1734
  className={cn(
1727
- "fixed inset-y-0 right-0 z-[60] flex w-full flex-col border-l border-border bg-background shadow-xl sm:w-[380px] sm:max-w-[90vw]",
1735
+ // Auto-size to content: wide enough for the longest label + control on
1736
+ // one line, clamped so it never gets too narrow or wider than the viewport.
1737
+ "fixed inset-y-0 right-0 z-[60] flex w-full flex-col border-l border-border bg-background shadow-xl sm:w-auto sm:min-w-[420px] sm:max-w-[90vw]",
1728
1738
  closing ? "vui-panel-out" : "vui-panel-in",
1729
1739
  )}
1730
1740
  onAnimationEnd={(e) => {