@nadicodeai/ui 6.0.1 → 6.1.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 (63) hide show
  1. package/dist/components/action-menu.d.ts +8 -0
  2. package/dist/components/action-menu.d.ts.map +1 -0
  3. package/dist/components/action-menu.js +8 -0
  4. package/dist/components/card.d.ts +1 -1
  5. package/dist/components/card.d.ts.map +1 -1
  6. package/dist/components/card.js +5 -3
  7. package/dist/components/chart-breakdown-table.d.ts +3 -2
  8. package/dist/components/chart-breakdown-table.d.ts.map +1 -1
  9. package/dist/components/chart-breakdown-table.js +13 -9
  10. package/dist/components/chart-bullet-bar.d.ts +13 -12
  11. package/dist/components/chart-bullet-bar.d.ts.map +1 -1
  12. package/dist/components/chart-bullet-bar.js +16 -36
  13. package/dist/components/chart-kpi-stat.d.ts +26 -15
  14. package/dist/components/chart-kpi-stat.d.ts.map +1 -1
  15. package/dist/components/chart-kpi-stat.js +28 -4
  16. package/dist/components/chart-time-series-layout.d.ts +6 -0
  17. package/dist/components/chart-time-series-layout.d.ts.map +1 -0
  18. package/dist/components/chart-time-series-layout.js +6 -0
  19. package/dist/components/chart-time-series.d.ts +6 -2
  20. package/dist/components/chart-time-series.d.ts.map +1 -1
  21. package/dist/components/chart-time-series.js +27 -9
  22. package/dist/components/chart.js +1 -1
  23. package/dist/components/collection-filters.d.ts +28 -0
  24. package/dist/components/collection-filters.d.ts.map +1 -0
  25. package/dist/components/collection-filters.js +54 -0
  26. package/dist/components/collection-scope.d.ts +15 -0
  27. package/dist/components/collection-scope.d.ts.map +1 -0
  28. package/dist/components/collection-scope.js +7 -0
  29. package/dist/components/collection-toolbar.d.ts +10 -0
  30. package/dist/components/collection-toolbar.d.ts.map +1 -0
  31. package/dist/components/collection-toolbar.js +4 -0
  32. package/dist/components/settings-facts.d.ts +28 -0
  33. package/dist/components/settings-facts.d.ts.map +1 -0
  34. package/dist/components/settings-facts.js +7 -0
  35. package/dist/components/settings-section.d.ts +5 -5
  36. package/dist/components/settings-section.d.ts.map +1 -1
  37. package/dist/components/settings-section.js +6 -11
  38. package/dist/components/sidebar.d.ts +4 -1
  39. package/dist/components/sidebar.d.ts.map +1 -1
  40. package/dist/components/sidebar.js +3 -3
  41. package/dist/components/table-layouts.d.ts +22 -0
  42. package/dist/components/table-layouts.d.ts.map +1 -0
  43. package/dist/components/table-layouts.js +20 -0
  44. package/dist/components/table.d.ts +15 -2
  45. package/dist/components/table.d.ts.map +1 -1
  46. package/dist/components/table.js +8 -4
  47. package/dist/eslint/rules/jsx-class-utility.js +44 -12
  48. package/dist/eslint/rules/no-resting-settings-control.js +15 -13
  49. package/dist/eslint/rules/no-shadcn-appearance-override.js +189 -36
  50. package/dist/eslint/rules/shadcn-composition.js +48 -3
  51. package/dist/hooks/use-confirm-action.d.ts +0 -6
  52. package/dist/hooks/use-confirm-action.d.ts.map +1 -1
  53. package/dist/hooks/use-confirm-action.js +5 -12
  54. package/dist/index.d.ts +5 -0
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +5 -0
  57. package/dist/lib/use-copy-to-clipboard.d.ts +0 -41
  58. package/dist/lib/use-copy-to-clipboard.d.ts.map +1 -1
  59. package/dist/lib/use-copy-to-clipboard.js +6 -15
  60. package/docs/component-classification.md +3 -2
  61. package/docs/contract.md +79 -8
  62. package/docs/product-compositions.md +14 -11
  63. package/package.json +3 -2
@@ -0,0 +1,28 @@
1
+ import * as React from "react";
2
+ export type CollectionFilterOption = {
3
+ value: string;
4
+ label: string;
5
+ icon?: React.ReactNode;
6
+ mono?: boolean;
7
+ };
8
+ export type CollectionFilter = {
9
+ label: string;
10
+ allLabel: string;
11
+ value: string;
12
+ onValueChange: (value: string) => void;
13
+ options: readonly CollectionFilterOption[];
14
+ selectedIcon?: React.ReactNode;
15
+ };
16
+ export type CollectionFilterCopy = {
17
+ add: string;
18
+ searchFields: string;
19
+ searchValues: string;
20
+ empty: string;
21
+ back: string;
22
+ remove: string;
23
+ };
24
+ export declare function CollectionFilters({ facets, copy, }: {
25
+ facets: readonly CollectionFilter[];
26
+ copy: CollectionFilterCopy;
27
+ }): React.JSX.Element | null;
28
+ //# sourceMappingURL=collection-filters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection-filters.d.ts","sourceRoot":"","sources":["../../src/components/collection-filters.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC3C,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAgHF,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,IAAI,GACL,EAAE;IACD,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACpC,IAAI,EAAE,oBAAoB,CAAC;CAC5B,4BAiDA"}
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { ArrowLeft, ListFilter, X } from "lucide-react";
5
+ import { Button } from "./button.js";
6
+ import { ButtonGroup } from "./button-group.js";
7
+ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "./command.js";
8
+ import { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from "./popover.js";
9
+ function FilterPicker({ facets, copy, initialField, returnFocus, children, }) {
10
+ const [open, setOpen] = React.useState(false);
11
+ const [field, setField] = React.useState(initialField);
12
+ const [search, setSearch] = React.useState("");
13
+ const input = React.useRef(null);
14
+ React.useEffect(() => {
15
+ if (open)
16
+ input.current?.focus();
17
+ }, [field, open]);
18
+ const facet = facets.find((item) => item.label === field);
19
+ const changeField = (next) => {
20
+ setField(next);
21
+ setSearch("");
22
+ input.current?.focus();
23
+ };
24
+ const commit = (value) => {
25
+ if (!value)
26
+ returnFocus?.current?.focus();
27
+ facet?.onValueChange(value);
28
+ setOpen(false);
29
+ };
30
+ return (_jsxs(Popover, { open: open, onOpenChange: (next) => {
31
+ setOpen(next);
32
+ if (next)
33
+ changeField(initialField);
34
+ }, children: [_jsx(PopoverTrigger, { render: children }), _jsxs(PopoverContent, { align: "start", initialFocus: input, children: [_jsx(PopoverTitle, { className: "sr-only", children: facet?.label ?? copy.add }), facet ? (_jsxs(Button, { variant: "ghost", className: "justify-start", onClick: () => changeField(undefined), children: [_jsx(ArrowLeft, { "data-icon": "inline-start" }), copy.back] })) : null, _jsxs(Command, { label: facet ? `${copy.searchValues}: ${facet.label}` : copy.searchFields, onKeyDown: (event) => {
35
+ if (event.key === "Backspace" && !search && facet) {
36
+ event.preventDefault();
37
+ changeField(undefined);
38
+ }
39
+ }, children: [_jsx(CommandInput, { ref: input, "aria-label": facet ? `${copy.searchValues}: ${facet.label}` : copy.searchFields, placeholder: facet ? copy.searchValues : copy.searchFields, value: search, onValueChange: setSearch }), _jsxs(CommandList, { label: facet?.label ?? copy.searchFields, children: [_jsx(CommandEmpty, { children: copy.empty }), _jsx(CommandGroup, { heading: facet?.label, children: facet ? (_jsxs(_Fragment, { children: [facet.value ? (_jsx(CommandItem, { value: facet.allLabel, onSelect: () => commit(""), children: facet.allLabel })) : null, facet.options.map((option) => (_jsxs(CommandItem, { value: option.value, keywords: [option.label], "data-checked": option.value === facet.value, onSelect: () => commit(option.value), children: [option.icon, _jsx("span", { className: option.mono ? "truncate nc-type-caption-mono" : "truncate", children: option.label })] }, option.value)))] })) : (facets.map((item) => (_jsx(CommandItem, { value: item.label, onSelect: () => changeField(item.label), children: item.label }, item.label)))) })] })] }, field ?? "fields")] })] }));
40
+ }
41
+ export function CollectionFilters({ facets, copy, }) {
42
+ const addTrigger = React.useRef(null);
43
+ if (!facets.length)
44
+ return null;
45
+ return (_jsxs(_Fragment, { children: [_jsx(FilterPicker, { facets: facets, copy: copy, children: _jsxs(Button, { ref: addTrigger, variant: "outline", children: [_jsx(ListFilter, { "data-icon": "inline-start" }), copy.add] }) }), facets
46
+ .filter((facet) => facet.value)
47
+ .map((facet) => {
48
+ const selected = facet.options.find((option) => option.value === facet.value);
49
+ return (_jsxs(ButtonGroup, { "aria-label": facet.label, className: "min-w-0 max-w-full", children: [_jsx(FilterPicker, { facets: facets, copy: copy, initialField: facet.label, returnFocus: addTrigger, children: _jsxs(Button, { variant: "outline", className: "min-w-0 max-w-64", children: [facet.selectedIcon ?? selected?.icon, _jsxs("span", { className: "truncate", children: [facet.label, ":", " ", _jsx("span", { className: selected?.mono ? "nc-type-caption-mono" : undefined, children: selected?.label ?? facet.value })] })] }) }), _jsx(Button, { variant: "outline", size: "icon", "aria-label": `${copy.remove}: ${facet.label}`, onClick: () => {
50
+ facet.onValueChange("");
51
+ addTrigger.current?.focus();
52
+ }, children: _jsx(X, { "aria-hidden": "true" }) })] }, facet.label));
53
+ })] }));
54
+ }
@@ -0,0 +1,15 @@
1
+ import type { ReactNode } from "react";
2
+ export type CollectionScopeProps = {
3
+ label: string;
4
+ allLabel: string;
5
+ value: string;
6
+ options: readonly {
7
+ value: string;
8
+ label: string;
9
+ icon?: ReactNode;
10
+ }[];
11
+ onValueChange: (value: string) => void;
12
+ actions?: ReactNode;
13
+ };
14
+ export declare function CollectionScope({ label, allLabel, value, options, onValueChange, actions, }: CollectionScopeProps): import("react").JSX.Element;
15
+ //# sourceMappingURL=collection-scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection-scope.d.ts","sourceRoot":"","sources":["../../src/components/collection-scope.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAWvC,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,CAAA;KAAE,EAAE,CAAC;IACvE,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,KAAK,EACL,OAAO,EACP,aAAa,EACb,OAAO,GACR,EAAE,oBAAoB,+BAyBtB"}
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, } from "./select.js";
4
+ export function CollectionScope({ label, allLabel, value, options, onValueChange, actions, }) {
5
+ const items = [{ value: "", label: allLabel }, ...options];
6
+ return (_jsxs("div", { "data-slot": "collection-scope", className: "flex min-w-0 flex-wrap items-center justify-between gap-3 pb-4", children: [_jsxs(Select, { items: items, value: value, onValueChange: (next) => onValueChange(next ?? ""), children: [_jsx(SelectTrigger, { "aria-label": label, className: "max-w-full", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { align: "start", children: _jsx(SelectGroup, { children: items.map((option) => (_jsxs(SelectItem, { value: option.value, children: ["icon" in option ? option.icon : null, option.label] }, option.value))) }) })] }), actions ? _jsx("div", { className: "flex shrink-0 items-center gap-2", children: actions }) : null] }));
7
+ }
@@ -0,0 +1,10 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ export type CollectionToolbarProps = Omit<ComponentPropsWithoutRef<"div">, "children" | "className"> & {
3
+ label: string;
4
+ controls?: ReactNode;
5
+ search?: ReactNode;
6
+ actions?: ReactNode;
7
+ status?: ReactNode;
8
+ };
9
+ export declare function CollectionToolbar({ label, controls, search, actions, status, ...props }: CollectionToolbarProps): import("react").JSX.Element;
10
+ //# sourceMappingURL=collection-toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection-toolbar.d.ts","sourceRoot":"","sources":["../../src/components/collection-toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjE,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,wBAAwB,CAAC,KAAK,CAAC,EAC/B,UAAU,GAAG,WAAW,CACzB,GAAG;IACF,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,QAAQ,EACR,MAAM,EACN,OAAO,EACP,MAAM,EACN,GAAG,KAAK,EACT,EAAE,sBAAsB,+BAoCxB"}
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export function CollectionToolbar({ label, controls, search, actions, status, ...props }) {
3
+ return (_jsxs("div", { "data-slot": "collection-toolbar", ...props, role: "toolbar", "aria-label": label, className: "relative flex min-w-0 flex-wrap items-center gap-2 pb-4", children: [controls ? (_jsx("div", { "data-slot": "collection-toolbar-controls", className: "flex min-w-0 max-w-full flex-wrap items-center gap-2", children: controls })) : null, search ? (_jsx("div", { "data-slot": "collection-toolbar-search", className: "min-w-0 basis-full sm:flex-1 sm:basis-64", children: search })) : null, actions ? (_jsx("div", { "data-slot": "collection-toolbar-actions", className: "ml-auto flex min-w-0 flex-wrap items-center gap-2", children: actions })) : null, status ? _jsx("div", { className: "absolute right-0 bottom-0", children: status }) : null] }));
4
+ }
@@ -0,0 +1,28 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ import { type CardSurface } from "./card.js";
3
+ export type SettingsFact = {
4
+ /**
5
+ * A value long enough to be a paragraph rather than a figure — a note, a
6
+ * pasted reference. It takes the section's full measure with its label above
7
+ * it instead of sharing a row with the compact facts.
8
+ */
9
+ block?: boolean;
10
+ label: string;
11
+ value: ReactNode;
12
+ };
13
+ export type SettingsFactsSectionProps = Omit<ComponentPropsWithoutRef<"section">, "children" | "className"> & {
14
+ action?: ReactNode;
15
+ description?: string;
16
+ facts: readonly SettingsFact[];
17
+ footer?: ReactNode;
18
+ missingValueLabel: string;
19
+ /**
20
+ * Stable: the heading names this section's landmark, and it is where focus
21
+ * lands when the editor closes and its trigger is gone from the page.
22
+ */
23
+ headingId: string;
24
+ title: string;
25
+ surface?: CardSurface;
26
+ };
27
+ export declare function SettingsFactsSection({ action, description, facts, footer, missingValueLabel, headingId, title, surface, ...props }: SettingsFactsSectionProps): import("react").JSX.Element;
28
+ //# sourceMappingURL=settings-facts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-facts.d.ts","sourceRoot":"","sources":["../../src/components/settings-facts.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKjE,OAAO,EAQL,KAAK,WAAW,EACjB,MAAM,QAAQ,CAAC;AAEhB,MAAM,MAAM,YAAY,GAAG;IACzB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,wBAAwB,CAAC,SAAS,CAAC,EACnC,UAAU,GAAG,WAAW,CACzB,GAAG;IACF,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,WAAW,EACX,KAAK,EACL,MAAM,EACN,iBAAiB,EACjB,SAAS,EACT,KAAK,EACL,OAAmB,EACnB,GAAG,KAAK,EACT,EAAE,yBAAyB,+BA8C3B"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Separator } from "./separator.js";
3
+ import { cn } from "../lib/utils.js";
4
+ import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "./card.js";
5
+ export function SettingsFactsSection({ action, description, facts, footer, missingValueLabel, headingId, title, surface = "resting", ...props }) {
6
+ return (_jsxs(Card, { render: _jsx("section", {}), ...props, "aria-labelledby": headingId, surface: surface, size: "sm", className: "min-w-0", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: _jsx("h2", { id: headingId, tabIndex: -1, children: title }) }), description ? _jsx(CardDescription, { children: description }) : null, action ? _jsx(CardAction, { children: action }) : null] }), _jsx(Separator, {}), _jsx(CardContent, { children: _jsx("dl", { className: "grid min-w-0 grid-cols-1 gap-3 nc-type-body-sm sm:grid-cols-2", children: facts.map((fact) => (_jsxs(Card, { className: cn("min-w-0 gap-1 px-(--card-spacing)", fact.block && "col-span-full"), size: "sm", surface: "outlined", children: [_jsx("dt", { className: "text-xs text-muted-foreground", children: fact.label }), _jsx("dd", { className: cn("min-w-0 wrap-anywhere", fact.block && "whitespace-pre-wrap", (fact.value == null || fact.value === "") && "text-muted-foreground"), children: fact.value == null || fact.value === "" ? missingValueLabel : fact.value })] }, fact.label))) }) }), footer ? _jsx(CardFooter, { className: "flex-wrap gap-3", children: footer }) : null] }));
7
+ }
@@ -7,13 +7,11 @@ export type SettingsFieldControlProps = {
7
7
  disabled?: boolean;
8
8
  required?: boolean;
9
9
  };
10
- type SettingsFieldChildren = React.ReactNode | ((props: {
11
- controlProps: SettingsFieldControlProps;
12
- }) => React.ReactNode);
13
- declare function SettingsSection({ title, description, actions, children, className, ...props }: React.ComponentProps<"section"> & {
10
+ declare function SettingsSection({ title, description, actions, footer, children, className, ...props }: Omit<React.ComponentProps<"section">, "title"> & {
14
11
  title?: React.ReactNode;
15
12
  description?: React.ReactNode;
16
13
  actions?: React.ReactNode;
14
+ footer?: React.ReactNode;
17
15
  }): React.JSX.Element;
18
16
  declare function SettingsField({ id, label, description, error, invalid, disabled, required, children, className, contentClassName, controlClassName, ...props }: Omit<React.ComponentProps<typeof Field>, "children"> & {
19
17
  id: string;
@@ -23,7 +21,9 @@ declare function SettingsField({ id, label, description, error, invalid, disable
23
21
  invalid?: boolean;
24
22
  disabled?: boolean;
25
23
  required?: boolean;
26
- children: SettingsFieldChildren;
24
+ children: (props: {
25
+ controlProps: SettingsFieldControlProps;
26
+ }) => React.ReactNode;
27
27
  contentClassName?: string;
28
28
  controlClassName?: string;
29
29
  }): React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"settings-section.d.ts","sourceRoot":"","sources":["../../src/components/settings-section.tsx"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OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,qBAsCA;AAED,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"settings-section.d.ts","sourceRoot":"","sources":["../../src/components/settings-section.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,OAAO,EACL,KAAK,EAMN,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,iBAAS,eAAe,CAAC,EACvB,KAAK,EACL,WAAW,EACX,OAAO,EACP,MAAM,EACN,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,GAAG;IAClD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,qBA8BA;AAED,iBAAS,aAAa,CAAC,EACrB,EAAE,EACF,KAAK,EACL,WAAW,EACX,KAAK,EACL,OAAwB,EACxB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,YAAY,EAAE,yBAAyB,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC;IAClF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,qBAsCA;AAED,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC"}
@@ -1,15 +1,10 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
2
  import { cn } from "../lib/utils.js";
3
+ import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "./card.js";
4
+ import { Separator } from "./separator.js";
4
5
  import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, } from "./field.js";
5
- function renderSettingsFieldChildren(children, controlProps) {
6
- if (typeof children === "function") {
7
- return children({ controlProps });
8
- }
9
- return children;
10
- }
11
- function SettingsSection({ title, description, actions, children, className, ...props }) {
12
- return (_jsxs("section", { "data-slot": "settings-section", className: cn("grid gap-5 rounded-lg border bg-background p-5", className), ...props, children: [(title || description || actions) && (_jsxs("div", { "data-slot": "settings-section-header", className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "grid gap-1", children: [title && (_jsx("h2", { "data-slot": "settings-section-title", className: "text-base font-semibold", children: title })), description && (_jsx("p", { "data-slot": "settings-section-description", className: "text-sm text-muted-foreground", children: description }))] }), actions && _jsx("div", { "data-slot": "settings-section-actions", children: actions })] })), _jsx(FieldGroup, { "data-slot": "settings-section-fields", children: children })] }));
6
+ function SettingsSection({ title, description, actions, footer, children, className, ...props }) {
7
+ return (_jsxs(Card, { render: _jsx("section", { ...props, "data-slot": "settings-section" }), className: cn("min-w-0", className), children: [(title || description || actions) && (_jsxs(_Fragment, { children: [_jsxs(CardHeader, { children: [title && (_jsx(CardTitle, { children: _jsx("h2", { children: title }) })), description && _jsx(CardDescription, { children: description }), actions && _jsx(CardAction, { children: actions })] }), _jsx(Separator, {})] })), _jsx(CardContent, { children: _jsx(FieldGroup, { "data-slot": "settings-section-fields", children: children }) }), footer && (_jsx(CardFooter, { className: "flex-wrap justify-end gap-3 border-t border-border", children: footer }))] }));
13
8
  }
14
9
  function SettingsField({ id, label, description, error, invalid = Boolean(error), disabled, required, children, className, contentClassName, controlClassName, ...props }) {
15
10
  const descriptionId = description ? `${id}-description` : undefined;
@@ -22,6 +17,6 @@ function SettingsField({ id, label, description, error, invalid = Boolean(error)
22
17
  "aria-invalid": invalid ? true : undefined,
23
18
  "aria-describedby": describedBy || undefined,
24
19
  };
25
- return (_jsx("div", { "data-slot": "settings-field", "data-invalid": invalid ? true : undefined, className: "contents", children: _jsxs(Field, { "data-invalid": invalid ? true : undefined, "data-disabled": disabled ? true : undefined, orientation: "responsive", className: cn("items-start", className), ...props, children: [_jsxs(FieldContent, { className: contentClassName, children: [_jsx(FieldLabel, { htmlFor: id, children: label }), description && _jsx(FieldDescription, { id: descriptionId, children: description }), error && _jsx(FieldError, { id: errorId, children: error })] }), _jsx("div", { "data-slot": "settings-field-control", className: cn("flex w-full justify-start @md/field-group:w-auto @md/field-group:min-w-64 @md/field-group:justify-end", controlClassName), children: renderSettingsFieldChildren(children, controlProps) })] }) }));
20
+ return (_jsx("div", { "data-slot": "settings-field", "data-invalid": invalid ? true : undefined, className: "contents", children: _jsxs(Field, { "data-invalid": invalid ? true : undefined, "data-disabled": disabled ? true : undefined, orientation: "responsive", className: cn("items-start", className), ...props, children: [_jsxs(FieldContent, { className: contentClassName, children: [_jsx(FieldLabel, { htmlFor: id, children: label }), description && _jsx(FieldDescription, { id: descriptionId, children: description }), error && _jsx(FieldError, { id: errorId, children: error })] }), _jsx("div", { "data-slot": "settings-field-control", className: cn("flex w-full justify-start @md/field-group:w-auto @md/field-group:min-w-64 @md/field-group:justify-end", controlClassName), children: children({ controlProps }) })] }) }));
26
21
  }
27
22
  export { SettingsField, SettingsSection };
@@ -4,6 +4,7 @@ import { type VariantProps } from "class-variance-authority";
4
4
  import { Button } from "./button.js";
5
5
  import { Input } from "./input.js";
6
6
  import { Separator } from "./separator.js";
7
+ import { SheetContent } from "./sheet.js";
7
8
  import { TooltipContent } from "./tooltip.js";
8
9
  type SidebarContextProps = {
9
10
  state: "expanded" | "collapsed";
@@ -27,8 +28,10 @@ type SidebarProps = React.ComponentProps<"div"> & {
27
28
  mobileTitle?: React.ReactNode;
28
29
  mobileDescription?: React.ReactNode;
29
30
  mobileCloseLabel?: React.ReactNode;
31
+ /** The mobile sheet's standard focus destination after it closes. */
32
+ mobileFinalFocus?: React.ComponentProps<typeof SheetContent>["finalFocus"];
30
33
  };
31
- declare function Sidebar({ side, variant, collapsible, mobileTitle, mobileDescription, mobileCloseLabel, className, children, dir, ...props }: SidebarProps): React.JSX.Element;
34
+ declare function Sidebar({ side, variant, collapsible, mobileTitle, mobileDescription, mobileCloseLabel, mobileFinalFocus, className, children, dir, ...props }: SidebarProps): React.JSX.Element;
32
35
  declare function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
33
36
  declare function SidebarRail({ className, "aria-label": ariaLabel, title, ...props }: React.ComponentProps<"button">): React.JSX.Element;
34
37
  declare function SidebarInset({ className, focusTarget, ...props }: React.Com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,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,qBAyBA;AAED,iBAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAY1E;AAED,iBAAS,kBAAkB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAS9E;AAED,iBAAS,oBAAoB,CAAC,EAC5B,MAAM,EACN,IAAW,EACX,QAAgB,EAChB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,SAAS,CAAC,cAAc,CAAC,GAAG,CAAC,GAC9B,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG;IAC1B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,0EAoBF;AAED,OAAO,EACL,OAAO,EACP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,UAAU,GACX,CAAC"}
@@ -78,13 +78,13 @@ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: set
78
78
  ...style,
79
79
  }, className: cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", className), ...props, children: children }) }) }));
80
80
  }
81
- function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", mobileTitle, mobileDescription, mobileCloseLabel, className, children, dir, ...props }) {
81
+ function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", mobileTitle, mobileDescription, mobileCloseLabel, mobileFinalFocus, className, children, dir, ...props }) {
82
82
  const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
83
83
  if (collapsible === "none") {
84
84
  return (_jsx("div", { "data-slot": "sidebar", className: cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className), ...props, children: children }));
85
85
  }
86
86
  if (isMobile) {
87
- return (_jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: _jsxs(SheetContent, { closeLabel: mobileCloseLabel ?? "Close", dir: dir, "data-sidebar": "sidebar", "data-slot": "sidebar", "data-mobile": "true", className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground", style: {
87
+ return (_jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: _jsxs(SheetContent, { closeLabel: mobileCloseLabel ?? "Close", finalFocus: mobileFinalFocus, dir: dir, "data-sidebar": "sidebar", "data-slot": "sidebar", "data-mobile": "true", className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground", style: {
88
88
  "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
89
89
  }, side: side, children: [_jsxs(SheetHeader, { className: "sr-only", children: [_jsx(SheetTitle, { children: mobileTitle ?? "Sidebar" }), _jsx(SheetDescription, { children: mobileDescription ?? "Displays the mobile sidebar." })] }), _jsx("div", { className: "flex h-full w-full flex-col", children: children })] }) }));
90
90
  }
@@ -203,7 +203,7 @@ function SidebarMenuButton({ render, isActive = false, variant = "default", size
203
203
  children: tooltip,
204
204
  };
205
205
  }
206
- return (_jsxs(Tooltip, { children: [comp, _jsx(TooltipContent, { side: "right", align: "center", hidden: state !== "collapsed" || isMobile, ...tooltip })] }));
206
+ return (_jsxs(Tooltip, { disabled: state !== "collapsed" || isMobile, children: [comp, _jsx(TooltipContent, { side: "right", align: "center", ...tooltip })] }));
207
207
  }
208
208
  function SidebarMenuAction({ className, render, showOnHover = false, ...props }) {
209
209
  return useRender({
@@ -0,0 +1,22 @@
1
+ export declare const tableCompactLayouts: {
2
+ readonly standard: {
3
+ readonly column: "hidden @3xl/table:table-cell";
4
+ readonly row: "@max-3xl/table:border-b-0";
5
+ readonly details: "@3xl/table:hidden";
6
+ readonly table: "@max-3xl/table:table-auto @max-3xl/table:[&_th:not(:first-child)]:w-px @max-3xl/table:[&_th]:px-2 @max-3xl/table:[&_td]:px-2 @3xl/table:[&_th]:px-4 @3xl/table:[&_td]:px-4 @3xl/table:[&_tr:has(+[data-slot=table-detail-row]:last-child)]:border-0";
7
+ };
8
+ readonly wide: {
9
+ readonly column: "hidden @5xl/table:table-cell";
10
+ readonly row: "@max-5xl/table:border-b-0";
11
+ readonly details: "@5xl/table:hidden";
12
+ readonly table: "@max-5xl/table:table-auto @max-5xl/table:[&_th:not(:first-child)]:w-px @max-5xl/table:[&_th]:px-2 @max-5xl/table:[&_td]:px-2 @5xl/table:[&_th]:px-4 @5xl/table:[&_td]:px-4 @5xl/table:[&_tr:has(+[data-slot=table-detail-row]:last-child)]:border-0";
13
+ };
14
+ readonly spacious: {
15
+ readonly column: "hidden @6xl/table:table-cell";
16
+ readonly row: "@max-6xl/table:border-b-0";
17
+ readonly details: "@6xl/table:hidden";
18
+ readonly table: "@max-6xl/table:table-auto @max-6xl/table:[&_th:not(:first-child)]:w-px @max-6xl/table:[&_th]:px-2 @max-6xl/table:[&_td]:px-2 @6xl/table:[&_th]:px-4 @6xl/table:[&_td]:px-4 @6xl/table:[&_tr:has(+[data-slot=table-detail-row]:last-child)]:border-0";
19
+ };
20
+ };
21
+ export type TableCompactLayout = keyof typeof tableCompactLayouts;
22
+ //# sourceMappingURL=table-layouts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-layouts.d.ts","sourceRoot":"","sources":["../../src/components/table-layouts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;CAsBtB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,mBAAmB,CAAC"}
@@ -0,0 +1,20 @@
1
+ export const tableCompactLayouts = {
2
+ standard: {
3
+ column: "hidden @3xl/table:table-cell",
4
+ row: "@max-3xl/table:border-b-0",
5
+ details: "@3xl/table:hidden",
6
+ table: "@max-3xl/table:table-auto @max-3xl/table:[&_th:not(:first-child)]:w-px @max-3xl/table:[&_th]:px-2 @max-3xl/table:[&_td]:px-2 @3xl/table:[&_th]:px-4 @3xl/table:[&_td]:px-4 @3xl/table:[&_tr:has(+[data-slot=table-detail-row]:last-child)]:border-0",
7
+ },
8
+ wide: {
9
+ column: "hidden @5xl/table:table-cell",
10
+ row: "@max-5xl/table:border-b-0",
11
+ details: "@5xl/table:hidden",
12
+ table: "@max-5xl/table:table-auto @max-5xl/table:[&_th:not(:first-child)]:w-px @max-5xl/table:[&_th]:px-2 @max-5xl/table:[&_td]:px-2 @5xl/table:[&_th]:px-4 @5xl/table:[&_td]:px-4 @5xl/table:[&_tr:has(+[data-slot=table-detail-row]:last-child)]:border-0",
13
+ },
14
+ spacious: {
15
+ column: "hidden @6xl/table:table-cell",
16
+ row: "@max-6xl/table:border-b-0",
17
+ details: "@6xl/table:hidden",
18
+ table: "@max-6xl/table:table-auto @max-6xl/table:[&_th:not(:first-child)]:w-px @max-6xl/table:[&_th]:px-2 @max-6xl/table:[&_td]:px-2 @6xl/table:[&_th]:px-4 @6xl/table:[&_td]:px-4 @6xl/table:[&_tr:has(+[data-slot=table-detail-row]:last-child)]:border-0",
19
+ },
20
+ };
@@ -1,11 +1,24 @@
1
1
  import * as React from "react";
2
- declare function Table({ className, ...props }: React.ComponentProps<"table">): React.JSX.Element;
2
+ import { tableCompactLayouts, type TableCompactLayout } from "./table-layouts.js";
3
+ declare function Table({ className, compactDetails, ...props }: React.ComponentProps<"table"> & {
4
+ compactDetails?: TableCompactLayout;
5
+ }): React.JSX.Element;
3
6
  declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
4
7
  declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
5
8
  declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
6
9
  declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): React.JSX.Element;
7
10
  declare function TableHead({ className, ...props }: React.ComponentProps<"th">): React.JSX.Element;
8
11
  declare function TableCell({ className, ...props }: React.ComponentProps<"td">): React.JSX.Element;
12
+ declare function TableDetailRow({ colSpan, facts, layout, }: {
13
+ colSpan: number;
14
+ layout?: TableCompactLayout;
15
+ facts: readonly {
16
+ id: string;
17
+ label: React.ReactNode;
18
+ value: React.ReactNode;
19
+ numeric?: boolean;
20
+ }[];
21
+ }): React.JSX.Element;
9
22
  declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
10
- export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
23
+ export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, TableDetailRow, tableCompactLayouts, type TableCompactLayout, };
11
24
  //# sourceMappingURL=table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/components/table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,qBAUpE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,qBAQ1E;AAED,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,qBAQxE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,qBAW1E;AAED,iB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OAAO,CAAC,qBAW1E;AAED,iBAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAWpE;AAED,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAWrE;AAED,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAQrE;AAED,iBAAS,cAAc,CAAC,EACtB,OAAO,EACP,KAAK,EACL,MAAmB,GACpB,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,KAAK,EAAE,SAAS;QACd,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,EAAE,CAAC;CACL,qBAiCA;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,qBAQ7E;AAED,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,KAAK,kBAAkB,GACxB,CAAC"}
@@ -1,8 +1,9 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { cn } from "../lib/utils.js";
4
- function Table({ className, ...props }) {
5
- return (_jsx("div", { "data-slot": "table-container", className: "relative w-full overflow-x-auto bg-background", children: _jsx("table", { "data-slot": "table", className: cn("w-full caption-bottom bg-background text-sm", className), ...props }) }));
4
+ import { tableCompactLayouts } from "./table-layouts.js";
5
+ function Table({ className, compactDetails, ...props }) {
6
+ return (_jsx("div", { "data-slot": "table-container", className: cn("relative w-full overflow-x-auto bg-background", compactDetails && "@container/table"), children: _jsx("table", { "data-slot": "table", className: cn("w-full caption-bottom bg-background text-sm", className, compactDetails && tableCompactLayouts[compactDetails].table), ...props }) }));
6
7
  }
7
8
  function TableHeader({ className, ...props }) {
8
9
  return (_jsx("thead", { "data-slot": "table-header", className: cn("[&_tr]:h-9 [&_tr]:border-b", className), ...props }));
@@ -22,7 +23,10 @@ function TableHead({ className, ...props }) {
22
23
  function TableCell({ className, ...props }) {
23
24
  return (_jsx("td", { "data-slot": "table-cell", className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0", className), ...props }));
24
25
  }
26
+ function TableDetailRow({ colSpan, facts, layout = "standard", }) {
27
+ return (_jsx(TableRow, { "data-slot": "table-detail-row", className: tableCompactLayouts[layout].details, children: _jsx(TableCell, { colSpan: colSpan, className: "px-2 pt-0 pb-3 whitespace-normal", children: _jsx("dl", { className: cn("grid min-w-0 grid-cols-2 gap-x-4 gap-y-2", facts.length > 2 && "@lg/table:grid-cols-3"), children: facts.map((fact) => (_jsxs("div", { className: cn("min-w-0 last:odd:col-span-2", facts.length > 2 && "@lg/table:last:odd:col-span-1"), children: [_jsx("dt", { className: "text-xs text-muted-foreground", children: fact.label }), _jsx("dd", { className: cn("min-w-0", fact.numeric ? "tabular-nums wrap-normal" : "wrap-anywhere"), children: fact.value })] }, fact.id))) }) }) }));
28
+ }
25
29
  function TableCaption({ className, ...props }) {
26
30
  return (_jsx("caption", { "data-slot": "table-caption", className: cn("mt-4 text-sm text-muted-foreground", className), ...props }));
27
31
  }
28
- export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
32
+ export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, TableDetailRow, tableCompactLayouts, };
@@ -40,6 +40,18 @@ function findVariable(scope, name) {
40
40
  return undefined;
41
41
  }
42
42
 
43
+ /** Resolve renamed component imports while keeping local JSX names available. */
44
+ export function jsxComponentName(node, context) {
45
+ const name = node?.name;
46
+ if (name?.type === "JSXMemberExpression") return name.property.name;
47
+ if (name?.type !== "JSXIdentifier") return undefined;
48
+ const variable = findVariable(context.sourceCode.getScope(name), name.name);
49
+ const definition = variable?.defs.find((entry) => entry.type === "ImportBinding");
50
+ return definition?.node.type === "ImportSpecifier"
51
+ ? (definition.node.imported.name ?? definition.node.imported.value)
52
+ : name.name;
53
+ }
54
+
43
55
  /**
44
56
  * The initializer of the same-file `const` an identifier names. Undefined for
45
57
  * imports, parameters, `let`/`var`, and anything declared more than once —
@@ -72,9 +84,10 @@ function resolvedFragments(identifier, context, { objectsOnly = false } = {}) {
72
84
  if (!initializer) return [];
73
85
  if (initializer.type === "ObjectExpression") return objectStringValues(initializer);
74
86
  if (objectsOnly) return [];
75
- return initializer.type === "Literal" && typeof initializer.value === "string"
76
- ? [initializer.value]
77
- : [];
87
+ const fragments = [];
88
+ // Read the local composition, but do not resolve another binding from it.
89
+ literalFragments(initializer, fragments, { skipPropertyKeys: false, context: undefined });
90
+ return fragments;
78
91
  }
79
92
 
80
93
  /** Every string literal and template chunk in the subtree, in source order. */
@@ -89,6 +102,19 @@ function literalFragments(node, fragments, { skipPropertyKeys, context }) {
89
102
  fragments.push(node.value.cooked ?? node.value.raw);
90
103
  return;
91
104
  }
105
+ if (
106
+ node.type === "CallExpression" &&
107
+ node.callee.type === "MemberExpression" &&
108
+ !node.callee.computed &&
109
+ (node.callee.property.name === "join" ||
110
+ (node.callee.property.name === "filter" &&
111
+ node.arguments.length === 1 &&
112
+ node.arguments[0].type === "Identifier" &&
113
+ node.arguments[0].name === "Boolean"))
114
+ ) {
115
+ literalFragments(node.callee.object, fragments, { skipPropertyKeys, context });
116
+ return;
117
+ }
92
118
  // `USAGE_TONE_CLASS[kpi.tone ?? "normal"]` selects a class string, it does
93
119
  // not contain one: the names inside the lookup are keys. The hop reads the
94
120
  // table instead — any of its values can be the one selected — and the
@@ -139,32 +165,38 @@ export function nodeClassUtilities(node, context, { skipPropertyKeys = false } =
139
165
  * The class utilities written in one `className` JSX attribute. Pass `context`
140
166
  * to take the one hop; without it the reader stays literal-only.
141
167
  */
142
- export function classUtilities(attribute, context) {
143
- if (attribute?.type !== "JSXAttribute" || attribute.name.name !== "className") return [];
168
+ export function classUtilities(attribute, context, includeSlots = false) {
169
+ if (attribute?.type !== "JSXAttribute" || !isClassProperty(attribute.name.name, includeSlots))
170
+ return [];
144
171
  return utilities(attribute.value, { context });
145
172
  }
146
173
 
174
+ function isClassProperty(name, includeSlots) {
175
+ return name === "className" || (includeSlots && /ClassName$/.test(name));
176
+ }
177
+
147
178
  /** The `className` a spread object carries — its own key only, not its other values. */
148
- function spreadClassUtilities(attribute, context) {
179
+ function spreadClassUtilities(attribute, context, includeSlots) {
149
180
  if (attribute.argument.type !== "Identifier") return [];
150
181
  const initializer = constInitializer(attribute.argument, context);
151
182
  if (initializer?.type !== "ObjectExpression") return [];
183
+ const values = [];
152
184
  for (const property of initializer.properties) {
153
185
  if (property.type !== "Property" || property.computed) continue;
154
186
  const name = property.key.type === "Identifier" ? property.key.name : property.key.value;
155
- if (name !== "className" && name !== "class") continue;
187
+ if (!isClassProperty(name, includeSlots) && name !== "class") continue;
156
188
  if (property.value.type !== "Literal" || typeof property.value.value !== "string") continue;
157
- return property.value.value.split(/\s+/).filter(Boolean);
189
+ values.push(...property.value.value.split(/\s+/).filter(Boolean));
158
190
  }
159
- return [];
191
+ return values;
160
192
  }
161
193
 
162
194
  /** The class utilities written across every attribute of one element, spreads included. */
163
- export function openingElementClassUtilities(node, context) {
195
+ export function openingElementClassUtilities(node, context, includeSlots = false) {
164
196
  return node.attributes.flatMap((attribute) =>
165
197
  attribute.type === "JSXSpreadAttribute"
166
- ? spreadClassUtilities(attribute, context)
167
- : classUtilities(attribute, context),
198
+ ? spreadClassUtilities(attribute, context, includeSlots)
199
+ : classUtilities(attribute, context, includeSlots),
168
200
  );
169
201
  }
170
202