@lerianstudio/sindarian-ui 1.4.0-beta.2 → 1.4.0-beta.4
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/dist/components/entity-box/index.d.ts +11 -2
- package/dist/components/entity-box/index.d.ts.map +1 -1
- package/dist/components/entity-box/index.js +3 -3
- package/dist/components/form/input-field/index.d.ts +12 -2
- package/dist/components/form/input-field/index.d.ts.map +1 -1
- package/dist/components/form/input-field/index.js +29 -5
- package/dist/components/form/select-field/index.d.ts +29 -5
- package/dist/components/form/select-field/index.d.ts.map +1 -1
- package/dist/components/form/select-field/index.js +33 -10
- package/dist/components/page-header/index.d.ts +8 -2
- package/dist/components/page-header/index.d.ts.map +1 -1
- package/dist/components/page-header/index.js +4 -4
- package/dist/components/ui/badge/index.d.ts +8 -0
- package/dist/components/ui/badge/index.d.ts.map +1 -1
- package/dist/components/ui/badge/index.js +9 -1
- package/dist/components/ui/form.d.ts +4 -4
- package/dist/components/ui/form.d.ts.map +1 -1
- package/dist/components/ui/form.js +12 -6
- package/dist/components/ui/multiple-select/index.d.ts +11 -3
- package/dist/components/ui/multiple-select/index.d.ts.map +1 -1
- package/dist/components/ui/select/index.d.ts +5 -0
- package/dist/components/ui/select/index.d.ts.map +1 -1
- package/dist/components/ui/select/index.js +24 -1
- package/dist/domain/blotter/index.d.ts +2 -2
- package/dist/domain/delinquency-aging/aging-buckets.d.ts.map +1 -1
- package/dist/domain/delinquency-aging/aging-buckets.js +1 -1
- package/dist/domain/delinquency-aging/index.d.ts.map +1 -1
- package/dist/domain/delinquency-aging/index.js +1 -1
- package/dist/domain/figure/index.d.ts +11 -9
- package/dist/domain/figure/index.d.ts.map +1 -1
- package/dist/domain/figure/index.js +8 -8
- package/dist/domain/key-id/index.d.ts +1 -1
- package/dist/domain/key-id/index.d.ts.map +1 -1
- package/dist/domain/key-id/index.js +1 -1
- package/dist/domain/section-label/index.d.ts +10 -7
- package/dist/domain/section-label/index.d.ts.map +1 -1
- package/dist/domain/status-rail/index.d.ts +1 -1
- package/dist/domain/status-rail/index.d.ts.map +1 -1
- package/dist/domain/status-rail/index.js +8 -4
- package/dist/enterprise/alert-banner/index.d.ts +5 -3
- package/dist/enterprise/alert-banner/index.d.ts.map +1 -1
- package/dist/enterprise/alert-banner/index.js +2 -2
- package/dist/enterprise/data-table/column-size.d.ts +70 -0
- package/dist/enterprise/data-table/column-size.d.ts.map +1 -0
- package/dist/enterprise/data-table/column-size.js +103 -0
- package/dist/enterprise/data-table/index.d.ts.map +1 -1
- package/dist/enterprise/data-table/index.js +22 -2
- package/dist/enterprise/date-range-picker/index.d.ts.map +1 -1
- package/dist/enterprise/date-range-picker/index.js +1 -2
- package/dist/enterprise/stat-card/index.d.ts +3 -3
- package/dist/enterprise/stat-card/index.d.ts.map +1 -1
- package/dist/enterprise/stat-card/index.js +1 -1
- package/dist/enterprise/status-badge/index.js +1 -1
- package/dist/enterprise/virtualized-table/index.d.ts +18 -2
- package/dist/enterprise/virtualized-table/index.d.ts.map +1 -1
- package/dist/enterprise/virtualized-table/index.js +31 -4
- package/dist/esm/components/entity-box/index.d.ts +11 -2
- package/dist/esm/components/entity-box/index.d.ts.map +1 -1
- package/dist/esm/components/entity-box/index.js +3 -3
- package/dist/esm/components/form/input-field/index.d.ts +12 -2
- package/dist/esm/components/form/input-field/index.d.ts.map +1 -1
- package/dist/esm/components/form/input-field/index.js +29 -5
- package/dist/esm/components/form/select-field/index.d.ts +29 -5
- package/dist/esm/components/form/select-field/index.d.ts.map +1 -1
- package/dist/esm/components/form/select-field/index.js +33 -10
- package/dist/esm/components/page-header/index.d.ts +8 -2
- package/dist/esm/components/page-header/index.d.ts.map +1 -1
- package/dist/esm/components/page-header/index.js +4 -4
- package/dist/esm/components/ui/badge/index.d.ts +8 -0
- package/dist/esm/components/ui/badge/index.d.ts.map +1 -1
- package/dist/esm/components/ui/badge/index.js +9 -1
- package/dist/esm/components/ui/form.d.ts +4 -4
- package/dist/esm/components/ui/form.d.ts.map +1 -1
- package/dist/esm/components/ui/form.js +12 -6
- package/dist/esm/components/ui/multiple-select/index.d.ts +11 -3
- package/dist/esm/components/ui/multiple-select/index.d.ts.map +1 -1
- package/dist/esm/components/ui/select/index.d.ts +5 -0
- package/dist/esm/components/ui/select/index.d.ts.map +1 -1
- package/dist/esm/components/ui/select/index.js +24 -1
- package/dist/esm/domain/blotter/index.d.ts +2 -2
- package/dist/esm/domain/delinquency-aging/aging-buckets.d.ts.map +1 -1
- package/dist/esm/domain/delinquency-aging/aging-buckets.js +1 -1
- package/dist/esm/domain/delinquency-aging/index.d.ts.map +1 -1
- package/dist/esm/domain/delinquency-aging/index.js +1 -1
- package/dist/esm/domain/figure/index.d.ts +11 -9
- package/dist/esm/domain/figure/index.d.ts.map +1 -1
- package/dist/esm/domain/figure/index.js +8 -8
- package/dist/esm/domain/key-id/index.d.ts +1 -1
- package/dist/esm/domain/key-id/index.d.ts.map +1 -1
- package/dist/esm/domain/key-id/index.js +1 -1
- package/dist/esm/domain/section-label/index.d.ts +10 -7
- package/dist/esm/domain/section-label/index.d.ts.map +1 -1
- package/dist/esm/domain/status-rail/index.d.ts +1 -1
- package/dist/esm/domain/status-rail/index.d.ts.map +1 -1
- package/dist/esm/domain/status-rail/index.js +8 -4
- package/dist/esm/enterprise/alert-banner/index.d.ts +5 -3
- package/dist/esm/enterprise/alert-banner/index.d.ts.map +1 -1
- package/dist/esm/enterprise/alert-banner/index.js +2 -2
- package/dist/esm/enterprise/data-table/column-size.d.ts +70 -0
- package/dist/esm/enterprise/data-table/column-size.d.ts.map +1 -0
- package/dist/esm/enterprise/data-table/column-size.js +97 -0
- package/dist/esm/enterprise/data-table/index.d.ts.map +1 -1
- package/dist/esm/enterprise/data-table/index.js +22 -2
- package/dist/esm/enterprise/date-range-picker/index.d.ts.map +1 -1
- package/dist/esm/enterprise/date-range-picker/index.js +1 -2
- package/dist/esm/enterprise/stat-card/index.d.ts +3 -3
- package/dist/esm/enterprise/stat-card/index.d.ts.map +1 -1
- package/dist/esm/enterprise/stat-card/index.js +1 -1
- package/dist/esm/enterprise/status-badge/index.js +1 -1
- package/dist/esm/enterprise/virtualized-table/index.d.ts +18 -2
- package/dist/esm/enterprise/virtualized-table/index.d.ts.map +1 -1
- package/dist/esm/enterprise/virtualized-table/index.js +31 -4
- package/dist/esm/lib/typography.d.ts +21 -6
- package/dist/esm/lib/typography.d.ts.map +1 -1
- package/dist/esm/lib/typography.js +20 -5
- package/dist/globals.css +51 -16
- package/dist/lib/typography.d.ts +21 -6
- package/dist/lib/typography.d.ts.map +1 -1
- package/dist/lib/typography.js +20 -5
- package/package.json +1 -1
|
@@ -34,10 +34,12 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
34
34
|
const react_1 = require("react");
|
|
35
35
|
const react_table_1 = require("@tanstack/react-table");
|
|
36
36
|
const react_virtual_1 = require("@tanstack/react-virtual");
|
|
37
|
+
const typography_1 = require("../../lib/typography");
|
|
37
38
|
const utils_1 = require("../../lib/utils");
|
|
39
|
+
const column_size_1 = require("../data-table/column-size");
|
|
38
40
|
/** Rows rendered just outside the viewport to keep fast scrolls smooth. */
|
|
39
41
|
const OVERSCAN = 8;
|
|
40
|
-
function VirtualizedTable({ columns, data, rowHeight = 40, maxHeight = 480, scrollAreaLabel = 'Scrollable table rows', className }) {
|
|
42
|
+
function VirtualizedTable({ columns, data, rowHeight = 40, maxHeight = 480, scrollAreaLabel = 'Scrollable table rows', className, headClassName }) {
|
|
41
43
|
const scrollRef = (0, react_1.useRef)(null);
|
|
42
44
|
const [isScrollable, setIsScrollable] = (0, react_1.useState)(false);
|
|
43
45
|
// A number is px; a string is used verbatim (e.g. '60vh').
|
|
@@ -45,6 +47,10 @@ function VirtualizedTable({ columns, data, rowHeight = 40, maxHeight = 480, scro
|
|
|
45
47
|
const table = (0, react_table_1.useReactTable)({
|
|
46
48
|
data,
|
|
47
49
|
columns,
|
|
50
|
+
// Keeps `columnDef.size`/`minSize`/`maxSize` meaning "declared" — see
|
|
51
|
+
// ../data-table/column-size. `getSize()` is unaffected; it falls back to
|
|
52
|
+
// the library defaults itself.
|
|
53
|
+
defaultColumn: column_size_1.UNSIZED_DEFAULT_COLUMN,
|
|
48
54
|
getCoreRowModel: (0, react_table_1.getCoreRowModel)()
|
|
49
55
|
});
|
|
50
56
|
const rows = table.getRowModel().rows;
|
|
@@ -97,11 +103,23 @@ function VirtualizedTable({ columns, data, rowHeight = 40, maxHeight = 480, scro
|
|
|
97
103
|
// its position among its siblings.
|
|
98
104
|
const firstLeaf = header.column.getLeafColumns()[0];
|
|
99
105
|
const start = leafPosition.get(firstLeaf?.id ?? header.column.id);
|
|
100
|
-
|
|
106
|
+
// A group header spans leaf columns whose body cells carry
|
|
107
|
+
// their own widths, so its size comes from those leaves, not
|
|
108
|
+
// from the group def (which declares nothing). A leaf header
|
|
109
|
+
// reads its own column, as before.
|
|
110
|
+
const size = header.subHeaders.length > 0
|
|
111
|
+
? (0, column_size_1.readDeclaredGroupSize)(header.column.getLeafColumns())
|
|
112
|
+
: (0, column_size_1.readDeclaredColumnSize)(header.column);
|
|
113
|
+
return ((0, jsx_runtime_1.jsx)("div", { role: "columnheader", "aria-colindex": (start ?? 0) + 1, "aria-colspan": header.colSpan > 1 ? header.colSpan : undefined,
|
|
114
|
+
// A declared width must not be flexed away; without one the
|
|
115
|
+
// cell keeps its colSpan share of the row, as before.
|
|
116
|
+
style: size?.width === undefined
|
|
117
|
+
? { flex: `${header.colSpan} 1 0%`, ...size }
|
|
118
|
+
: { flex: '0 0 auto', ...size },
|
|
101
119
|
// Header height is independent of rowHeight: pinning it to a
|
|
102
120
|
// small rowHeight (32) clipped the uppercase label against its
|
|
103
121
|
// own padding. Padding sizes it; min-h keeps a stable rule.
|
|
104
|
-
className:
|
|
122
|
+
className: (0, utils_1.cn)('min-h-10 px-4 py-2.5 text-left', typography_1.LABEL_VOICE_CLASS, headClassName), children: header.isPlaceholder
|
|
105
123
|
? null
|
|
106
124
|
: (0, react_table_1.flexRender)(header.column.columnDef.header, header.getContext()) }, header.id));
|
|
107
125
|
}) }, headerGroup.id))) }), (0, jsx_runtime_1.jsx)("div", { ref: scrollRef, role: "rowgroup", "data-testid": "virtualized-table-viewport", "aria-label": isScrollable ? scrollAreaLabel : undefined, tabIndex: isScrollable ? 0 : undefined, className: "focus-visible:ring-ring relative overflow-auto focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none", style: { maxHeight: viewportMaxHeight }, children: (0, jsx_runtime_1.jsx)("div", { role: "presentation", className: "relative w-full", style: { height: totalSize }, children: virtualRows.map((virtualItem) => {
|
|
@@ -109,6 +127,15 @@ function VirtualizedTable({ columns, data, rowHeight = 40, maxHeight = 480, scro
|
|
|
109
127
|
return ((0, jsx_runtime_1.jsx)("div", { role: "row", "aria-rowindex": virtualItem.index + headerRowCount + 1, "data-index": virtualItem.index, className: "border-border absolute left-0 flex w-full items-center border-b text-sm", style: {
|
|
110
128
|
height: virtualItem.size,
|
|
111
129
|
transform: `translateY(${virtualItem.start}px)`
|
|
112
|
-
}, children: row.getVisibleCells().map((cell, i) =>
|
|
130
|
+
}, children: row.getVisibleCells().map((cell, i) => {
|
|
131
|
+
const size = (0, column_size_1.readDeclaredColumnSize)(cell.column);
|
|
132
|
+
return ((0, jsx_runtime_1.jsx)("div", { role: "cell", "aria-colindex": i + 1,
|
|
133
|
+
// An inline `flex` beats the class, so a sized column
|
|
134
|
+
// stops flexing while every other column renders
|
|
135
|
+
// exactly as it did before.
|
|
136
|
+
style: size?.width === undefined
|
|
137
|
+
? size
|
|
138
|
+
: { flex: '0 0 auto', ...size }, className: "flex-1 truncate px-4", children: (0, react_table_1.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
|
|
139
|
+
}) }, row.id));
|
|
113
140
|
}) }) })] }) }));
|
|
114
141
|
}
|
|
@@ -4,13 +4,22 @@ declare function EntityBox({ className, children, ...props }: React.ComponentPro
|
|
|
4
4
|
declare function EntityBoxCollapsible({ className, ...props }: CollapsibleProps): React.JSX.Element;
|
|
5
5
|
declare function EntityBoxCollapsibleTrigger(props: CollapsibleTriggerProps): React.JSX.Element;
|
|
6
6
|
declare function EntityBoxCollapsibleContent({ children, ...props }: CollapsibleContentProps): React.JSX.Element;
|
|
7
|
-
interface EntityBoxHeaderProps extends React.ComponentProps<'div'> {
|
|
7
|
+
export interface EntityBoxHeaderProps extends React.ComponentProps<'div'> {
|
|
8
8
|
title: string;
|
|
9
9
|
subtitle?: string;
|
|
10
10
|
tooltip?: string;
|
|
11
11
|
tooltipWidth?: string | number;
|
|
12
|
+
/**
|
|
13
|
+
* Heading element used for the title. Defaults to `h2`.
|
|
14
|
+
*
|
|
15
|
+
* An EntityBox is a content box UNDER the page's own heading — the page `h1`
|
|
16
|
+
* belongs to `PageHeaderInfoTitle` — so `h1` here would give the page a
|
|
17
|
+
* second top-level heading. Raise or lower the level to match the section
|
|
18
|
+
* the box actually sits in.
|
|
19
|
+
*/
|
|
20
|
+
as?: 'h1' | 'h2' | 'h3' | 'h4';
|
|
12
21
|
}
|
|
13
|
-
declare function EntityBoxHeaderTitle({ title, subtitle, tooltip, tooltipWidth, className, ...props }: EntityBoxHeaderProps): React.JSX.Element;
|
|
22
|
+
declare function EntityBoxHeaderTitle({ title, subtitle, tooltip, tooltipWidth, className, as: Heading, ...props }: EntityBoxHeaderProps): React.JSX.Element;
|
|
14
23
|
declare function EntityBoxBanner({ className, children, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
15
24
|
declare function EntityBoxActions({ className, children, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
16
25
|
export { EntityBox, EntityBoxCollapsible, EntityBoxCollapsibleTrigger, EntityBoxCollapsibleContent, EntityBoxHeaderTitle, EntityBoxBanner, EntityBoxActions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/entity-box/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAczB,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,6BAA6B,CAAA;AAIpC,iBAAS,SAAS,CAAC,EACjB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAa7B;AAED,iBAAS,oBAAoB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,qBAUtE;AAED,iBAAS,2BAA2B,CAAC,KAAK,EAAE,uBAAuB,qBAQlE;AAED,iBAAS,2BAA2B,CAAC,EACnC,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,uBAAuB,qBAOzB;AAED,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/entity-box/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAczB,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,6BAA6B,CAAA;AAIpC,iBAAS,SAAS,CAAC,EACjB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAa7B;AAED,iBAAS,oBAAoB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,qBAUtE;AAED,iBAAS,2BAA2B,CAAC,KAAK,EAAE,uBAAuB,qBAQlE;AAED,iBAAS,2BAA2B,CAAC,EACnC,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,uBAAuB,qBAOzB;AAED,MAAM,WAAW,oBAAqB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACvE,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC9B;;;;;;;OAOG;IACH,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC/B;AAED,iBAAS,oBAAoB,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,EACT,EAAE,EAAE,OAAc,EAClB,GAAG,KAAK,EACT,EAAE,oBAAoB,qBAkCtB;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAU7B;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAa7B;AAED,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EACjB,CAAA"}
|
|
@@ -17,10 +17,10 @@ function EntityBoxCollapsibleTrigger(props) {
|
|
|
17
17
|
function EntityBoxCollapsibleContent({ children, ...props }) {
|
|
18
18
|
return (_jsxs(CollapsibleContent, { ...props, children: [_jsx(Separator, { orientation: "horizontal" }), _jsx("div", { className: "grid w-full grid-cols-3 p-6", children: children })] }));
|
|
19
19
|
}
|
|
20
|
-
function EntityBoxHeaderTitle({ title, subtitle, tooltip, tooltipWidth, className, ...props }) {
|
|
21
|
-
return (_jsxs("div", { "data-slot": "entity-box-header", className: cn('flex flex-col items-start', className), ...props, children: [_jsxs("div", { className: "flex items-center gap-[10px]", children: [_jsx(
|
|
20
|
+
function EntityBoxHeaderTitle({ title, subtitle, tooltip, tooltipWidth, className, as: Heading = 'h2', ...props }) {
|
|
21
|
+
return (_jsxs("div", { "data-slot": "entity-box-header", className: cn('flex flex-col items-start', className), ...props, children: [_jsxs("div", { className: "flex items-center gap-[10px]", children: [_jsx(Heading, { className: "text-muted-foreground text-lg font-medium", children: title }), tooltip && (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(CircleHelp, { className: "pointer text-shadcn-400 h-5 w-5" }) }), _jsx(TooltipContent, { side: "right", style: tooltipWidth
|
|
22
22
|
? { width: tooltipWidth, maxWidth: tooltipWidth }
|
|
23
|
-
: undefined, children: tooltip })] }) }))] }), subtitle && _jsx("p", { className: "text-
|
|
23
|
+
: undefined, children: tooltip })] }) }))] }), subtitle && _jsx("p", { className: "text-muted-foreground text-sm", children: subtitle })] }));
|
|
24
24
|
}
|
|
25
25
|
function EntityBoxBanner({ className, children, ...props }) {
|
|
26
26
|
return (_jsx("div", { "data-slot": "entity-box-banner", className: cn('grid grid-cols-3 p-6', className), ...props, children: children }));
|
|
@@ -11,16 +11,26 @@ export type InputFieldProps<T extends FieldValues = FieldValues> = {
|
|
|
11
11
|
description?: ReactNode;
|
|
12
12
|
startAdornment?: ReactNode;
|
|
13
13
|
endAdornment?: ReactNode;
|
|
14
|
-
control
|
|
14
|
+
/** react-hook-form control. Omit it to drive the field from plain state
|
|
15
|
+
* with `value`/`defaultValue` + `onChange`. */
|
|
16
|
+
control?: Control<T>;
|
|
17
|
+
/** Controlled value for the no-`control` path. */
|
|
18
|
+
value?: string;
|
|
15
19
|
disabled?: boolean;
|
|
16
20
|
readOnly?: boolean;
|
|
17
21
|
minHeight?: number;
|
|
18
22
|
maxHeight?: number;
|
|
19
23
|
textArea?: boolean;
|
|
20
24
|
required?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Seed value. With `control` and no form-level default for this name,
|
|
27
|
+
* react-hook-form treats the seed as a VALUE rather than a default, so
|
|
28
|
+
* `formState.isDirty` reads true after `reset()` and after retyping the
|
|
29
|
+
* seed. Prefer `useForm({ defaultValues })` when dirty tracking matters.
|
|
30
|
+
*/
|
|
21
31
|
defaultValue?: string;
|
|
22
32
|
'data-testid'?: string;
|
|
23
33
|
onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
24
34
|
};
|
|
25
|
-
export declare const InputField: <T extends FieldValues = FieldValues>({ className, type, label, tooltip, labelExtra, placeholder, description, startAdornment, endAdornment, required, readOnly, minHeight, maxHeight, textArea, defaultValue, onChange, ...others }: InputFieldProps<T>) => import("react").JSX.Element;
|
|
35
|
+
export declare const InputField: <T extends FieldValues = FieldValues>({ className, type, label, tooltip, labelExtra, placeholder, description, startAdornment, endAdornment, required, readOnly, minHeight, maxHeight, textArea, defaultValue, value, onChange, ...others }: InputFieldProps<T>) => import("react").JSX.Element;
|
|
26
36
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/input-field/index.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACzD,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/input-field/index.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACzD,OAAO,EAAE,OAAO,EAAkB,WAAW,EAAQ,MAAM,iBAAiB,CAAA;AAE5E,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI;IACjE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,sBAAsB,CAAA;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,cAAc,CAAC,EAAE,SAAS,CAAA;IAC1B,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB;oDACgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IACpB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,CACT,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,KACzD,IAAI,CAAA;CACV,CAAA;AAeD,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,uMAmB7D,eAAe,CAAC,CAAC,CAAC,gCA2EpB,CAAA"}
|
|
@@ -2,9 +2,33 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { AutosizeTextarea } from '../../../components/ui/autosize-textarea/index.js';
|
|
3
3
|
import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormTooltip } from '../../../components/ui/form.js';
|
|
4
4
|
import { Input } from '../../../components/ui/input/index.js';
|
|
5
|
-
export const InputField = ({ className, type, label, tooltip, labelExtra, placeholder, description, startAdornment, endAdornment, required, readOnly, minHeight, maxHeight, textArea, defaultValue, onChange, ...others }) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const InputField = ({ className, type, label, tooltip, labelExtra, placeholder, description, startAdornment, endAdornment, required, readOnly, minHeight, maxHeight, textArea, defaultValue, value, onChange, ...others }) => {
|
|
6
|
+
const renderItem = (binding) => (_jsxs(FormItem, { required: required, children: [label && (_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : labelExtra, children: label })), _jsx(FormControl, { children: textArea ? (_jsx(AutosizeTextarea, { className: className, placeholder: placeholder, readOnly: readOnly, minHeight: minHeight, maxHeight: maxHeight, "data-testid": others['data-testid'], ...binding })) : (_jsx(Input, { className: className, type: type, placeholder: placeholder, readOnly: readOnly, startAdornment: startAdornment, endAdornment: endAdornment, "data-testid": others['data-testid'], ...binding })) }), _jsx(FormMessage, {}), description && _jsx(FormDescription, { children: description })] }));
|
|
7
|
+
if (!others.control) {
|
|
8
|
+
return renderItem({
|
|
9
|
+
name: others.name,
|
|
10
|
+
disabled: others.disabled,
|
|
11
|
+
// Controlled when the caller holds the value, uncontrolled when it only
|
|
12
|
+
// seeds one — supplying both is what React warns about.
|
|
13
|
+
...(value !== undefined ? { value } : { defaultValue }),
|
|
14
|
+
onChange: (e) => onChange?.(e)
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return (_jsx(FormField, { ...others, name: others.name,
|
|
18
|
+
// The seed goes through react-hook-form, never straight to the DOM: a
|
|
19
|
+
// value painted on the box only makes the field LOOK filled while the
|
|
20
|
+
// form still submits nothing for that name. Controller seeds its own
|
|
21
|
+
// state from this, so `field.value` carries the seed on both branches.
|
|
22
|
+
defaultValue: defaultValue, render: ({ field }) => renderItem({
|
|
23
|
+
...field,
|
|
24
|
+
// Controlled from mount. react-hook-form hands `undefined` for any
|
|
25
|
+
// name the form declares no default for; React then mounts the box
|
|
26
|
+
// uncontrolled and flips it on the first keystroke, losing that
|
|
27
|
+
// character.
|
|
28
|
+
value: field.value ?? '',
|
|
29
|
+
onChange: (e) => {
|
|
30
|
+
field.onChange(e);
|
|
31
|
+
onChange?.(e);
|
|
32
|
+
}
|
|
33
|
+
}) }));
|
|
10
34
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { PropsWithChildren, ReactNode } from 'react';
|
|
2
2
|
import { Control, FieldValues } from 'react-hook-form';
|
|
3
|
-
|
|
3
|
+
type SelectFieldSharedProps<T extends FieldValues = FieldValues> = PropsWithChildren & {
|
|
4
4
|
name: string;
|
|
5
5
|
label?: ReactNode;
|
|
6
6
|
tooltip?: string;
|
|
@@ -9,12 +9,36 @@ export type SelectFieldProps<T extends FieldValues = FieldValues> = PropsWithChi
|
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
readOnly?: boolean;
|
|
12
|
-
control
|
|
13
|
-
|
|
12
|
+
/** react-hook-form control. Omit it to drive the field from plain state
|
|
13
|
+
* with `value` + `onChange`. */
|
|
14
|
+
control?: Control<T>;
|
|
14
15
|
required?: boolean;
|
|
15
16
|
emptyMessage?: string;
|
|
16
|
-
onChange?: (value: string | string[]) => void;
|
|
17
17
|
'data-testid'?: string;
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* `multi` is the DISCRIMINANT, not an independent flag: it selects which of the
|
|
21
|
+
* two field shapes the rest of the props must speak. Typed as a plain boolean
|
|
22
|
+
* beside `value?: string | string[]`, `multi` with `value="pix"` compiled and
|
|
23
|
+
* then rendered empty — the multi implementation only understands arrays and
|
|
24
|
+
* turned the string into `[]`, dropping the caller's selection with no error
|
|
25
|
+
* anywhere. The mismatch is unrepresentable now, and a multi consumer's
|
|
26
|
+
* `onChange` receives `string[]` without a cast at the call site.
|
|
27
|
+
*/
|
|
28
|
+
type SelectFieldModeProps = {
|
|
29
|
+
multi: true;
|
|
30
|
+
/** Controlled values for the no-`control` path. Omit to let the select
|
|
31
|
+
* keep its own state and just report changes through `onChange`. */
|
|
32
|
+
value?: string[];
|
|
33
|
+
onChange?: (value: string[]) => void;
|
|
34
|
+
} | {
|
|
35
|
+
multi?: false;
|
|
36
|
+
/** Controlled value for the no-`control` path. Omit to let the select
|
|
37
|
+
* keep its own state and just report changes through `onChange`. */
|
|
38
|
+
value?: string;
|
|
39
|
+
onChange?: (value: string) => void;
|
|
40
|
+
};
|
|
41
|
+
export type SelectFieldProps<T extends FieldValues = FieldValues> = SelectFieldSharedProps<T> & SelectFieldModeProps;
|
|
42
|
+
export declare const SelectField: <T extends FieldValues = FieldValues>({ name, label, tooltip, labelExtra, required, placeholder, description, disabled, readOnly, multi, control, value, children, emptyMessage, onChange, ...others }: SelectFieldProps<T>) => React.JSX.Element;
|
|
43
|
+
export {};
|
|
20
44
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/select-field/index.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/select-field/index.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC3D,OAAO,EACL,OAAO,EAEP,WAAW,EAEZ,MAAM,iBAAiB,CAAA;AAExB,KAAK,sBAAsB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAC7D,iBAAiB,GAAG;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;qCACiC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAEH;;;;;;;;GAQG;AACH,KAAK,oBAAoB,GACrB;IACE,KAAK,EAAE,IAAI,CAAA;IACX;yEACqE;IACrE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CACrC,GACD;IACE,KAAK,CAAC,EAAE,KAAK,CAAA;IACb;yEACqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC,CAAA;AAEL,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAC9D,sBAAsB,CAAC,CAAC,CAAC,GAAG,oBAAoB,CAAA;AAWlD,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,kKAiB9D,gBAAgB,CAAC,CAAC,CAAC,sBA6FrB,CAAA"}
|
|
@@ -3,14 +3,37 @@ import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessa
|
|
|
3
3
|
import { MultipleSelect, MultipleSelectContent, MultipleSelectTrigger, MultipleSelectValue } from '../../../components/ui/multiple-select/index.js';
|
|
4
4
|
import { Select, SelectContent, SelectEmpty, SelectTrigger, SelectValue } from '../../../components/ui/select/index.js';
|
|
5
5
|
import { cn } from '../../../lib/utils.js';
|
|
6
|
-
export const SelectField = ({ name, label, tooltip, labelExtra, required, placeholder, description, disabled, readOnly, multi, control, children, emptyMessage = 'No options found.', onChange, ...others }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
export const SelectField = ({ name, label, tooltip, labelExtra, required, placeholder, description, disabled, readOnly, multi, control, value, children, emptyMessage = 'No options found.', onChange, ...others }) => {
|
|
7
|
+
// The props union already pairs `multi` with the callback shape that branch
|
|
8
|
+
// emits, but destructuring an intersection loses that correlation — TS sees
|
|
9
|
+
// two unrelated callbacks. Both branches report through this one seam, each
|
|
10
|
+
// with the payload its own union member declared.
|
|
11
|
+
const emitChange = onChange;
|
|
12
|
+
const renderItem = (field) => {
|
|
13
|
+
return (_jsxs(FormItem, { required: required, children: [label && (_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : labelExtra, children: label })), multi ? (_jsxs(MultipleSelect, { onValueChange: (value) => {
|
|
14
|
+
field.onChange(value);
|
|
15
|
+
emitChange?.(value);
|
|
16
|
+
}, disabled: disabled, ...field, children: [_jsx(MultipleSelectTrigger, { readOnly: readOnly, children: _jsx(MultipleSelectValue, { placeholder: placeholder }) }), _jsx(MultipleSelectContent, { children: children })] })) : (_jsxs(Select, { onValueChange: (value) => {
|
|
17
|
+
field.onChange(value);
|
|
18
|
+
emitChange?.(value);
|
|
19
|
+
}, value: field.value, disabled: disabled, open: readOnly ? false : undefined, onOpenChange: readOnly ? () => { } : undefined, children: [_jsx(FormControl, { children: _jsx(SelectTrigger, { className: cn(disabled && 'bg-shadcn-100'), readOnly: readOnly, "data-testid": others['data-testid'], children: _jsx(SelectValue, { placeholder: placeholder }) }) }), _jsxs(SelectContent, { children: [_jsx(SelectEmpty, { children: emptyMessage }), children] })] })), _jsx(FormMessage, {}), description && _jsx(FormDescription, { children: description })] }));
|
|
20
|
+
};
|
|
21
|
+
if (!control) {
|
|
22
|
+
// `value` undefined leaves Radix to keep its own state, so an uncontrolled
|
|
23
|
+
// standalone select still opens and picks; `onChange` reports either way.
|
|
24
|
+
// The caller's own `onChange` is invoked by the body, so this is a no-op.
|
|
25
|
+
return renderItem({
|
|
26
|
+
name,
|
|
27
|
+
value,
|
|
28
|
+
onChange: () => { },
|
|
29
|
+
onBlur: () => { },
|
|
30
|
+
ref: () => { },
|
|
31
|
+
disabled
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return (_jsx(FormField, { name: name, control: control, ...others,
|
|
35
|
+
// An unset field falls back to the EMPTY value of its own shape: `''`
|
|
36
|
+
// for the single select, `[]` for the multi one. Falling back to `''`
|
|
37
|
+
// for both handed MultipleSelect a string it silently discarded.
|
|
38
|
+
render: ({ field }) => renderItem({ ...field, value: field.value ?? (multi ? [] : '') }) }));
|
|
16
39
|
};
|
|
@@ -16,8 +16,14 @@ export type PageHeaderInfoTitleProps = {
|
|
|
16
16
|
title: string;
|
|
17
17
|
subtitle?: string;
|
|
18
18
|
subtitleCopyToClipboard?: boolean;
|
|
19
|
-
/** Routed to the
|
|
19
|
+
/** Routed to the heading, as it always has been. */
|
|
20
20
|
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Heading level to render. Defaults to `h1`, which is correct: this IS the
|
|
23
|
+
* page heading. Set it when the block is nested under an existing `h1` (a
|
|
24
|
+
* wizard step, an embedded panel) so the document outline stays valid.
|
|
25
|
+
*/
|
|
26
|
+
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
21
27
|
/**
|
|
22
28
|
* Seam for the wrapper element's own margins. Merged AFTER the hard-coded
|
|
23
29
|
* `mb-12` so a consumer utility (e.g. `mb-0`) wins via tailwind-merge.
|
|
@@ -25,7 +31,7 @@ export type PageHeaderInfoTitleProps = {
|
|
|
25
31
|
containerClassName?: string;
|
|
26
32
|
children?: ReactNode;
|
|
27
33
|
};
|
|
28
|
-
export declare function PageHeaderInfoTitle({ title, subtitle, className, containerClassName, children }: PageHeaderInfoTitleProps): import("react").JSX.Element;
|
|
34
|
+
export declare function PageHeaderInfoTitle({ title, subtitle, className, containerClassName, children, as: Heading }: PageHeaderInfoTitleProps): import("react").JSX.Element;
|
|
29
35
|
export type PageHeaderInfoTooltipProps = {
|
|
30
36
|
subtitle: string;
|
|
31
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/page-header/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAiB,SAAS,EAAwB,MAAM,OAAO,CAAA;AAmBtE,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,+BAQ7B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,+BAc7B;AAED,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,SAAS,CAAA;IACnB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,aAAa,EACd,EAAE,eAAe,+BAmBjB;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/page-header/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAiB,SAAS,EAAwB,MAAM,OAAO,CAAA;AAmBtE,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,+BAQ7B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,+BAc7B;AAED,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,SAAS,CAAA;IACnB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,aAAa,EACd,EAAE,eAAe,+BAmBjB;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IAC5C;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,QAAQ,EACR,EAAE,EAAE,OAAc,EACnB,EAAE,wBAAwB,+BAmB1B;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACT,EAAE,0BAA0B,+BAqC5B;AAED,MAAM,MAAM,qCAAqC,GAAG;IAClD,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,wBAAgB,gCAAgC,CAAC,EAC/C,QAAQ,EACT,EAAE,qCAAqC,+BAavC;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,wBAAgB,yBAAyB,CAAC,EACxC,QAAQ,EACR,MAAM,EACN,OAAO,EACP,IAAI,EACL,EAAE,8BAA8B,+BA+ChC"}
|
|
@@ -9,7 +9,7 @@ import { useToast } from '../../hooks/use-toast.js';
|
|
|
9
9
|
import { Arrow } from '@radix-ui/react-tooltip';
|
|
10
10
|
const PageHeaderContext = createContext({ isOpen: false });
|
|
11
11
|
export function PageHeaderActionButtons({ className, ...props }) {
|
|
12
|
-
return (_jsx("div", { "data-slot": "page-header-action-buttons", className: cn('flex items-center gap-8', className), ...props }));
|
|
12
|
+
return (_jsx("div", { "data-slot": "page-header-action-buttons", className: cn('flex min-w-0 flex-wrap items-center gap-8', className), ...props }));
|
|
13
13
|
}
|
|
14
14
|
export function PageHeaderWrapper({ className, ...props }) {
|
|
15
15
|
const { isOpen } = useContext(PageHeaderContext);
|
|
@@ -19,8 +19,8 @@ export function PageHeader({ children, className, rootClassName }) {
|
|
|
19
19
|
const [isOpen, setIsOpen] = useState(false);
|
|
20
20
|
return (_jsx(PageHeaderContext.Provider, { value: { isOpen }, children: _jsx("div", { "data-slot": "page-header", className: cn('mt-12', isOpen && 'mb-12', rootClassName), children: _jsx(Collapsible, { open: isOpen, onOpenChange: setIsOpen, className: className, children: children }) }) }));
|
|
21
21
|
}
|
|
22
|
-
export function PageHeaderInfoTitle({ title, subtitle, className, containerClassName, children }) {
|
|
23
|
-
return (_jsxs("div", { "data-slot": "page-header-info-title", className: cn('mb-12 flex flex-col gap-4', containerClassName), children: [_jsx(
|
|
22
|
+
export function PageHeaderInfoTitle({ title, subtitle, className, containerClassName, children, as: Heading = 'h1' }) {
|
|
23
|
+
return (_jsxs("div", { "data-slot": "page-header-info-title", className: cn('mb-12 flex flex-col gap-4', containerClassName), children: [_jsx(Heading, { className: cn('text-foreground text-4xl font-bold', className), "data-testid": "title", children: title }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: subtitle }), children] })] }));
|
|
24
24
|
}
|
|
25
25
|
export function PageHeaderInfoTooltip({ subtitle }) {
|
|
26
26
|
const { toast } = useToast();
|
|
@@ -36,5 +36,5 @@ export function PageHeaderCollapsibleInfoTrigger({ question }) {
|
|
|
36
36
|
return (_jsx("div", { "data-slot": "page-header-collapsible-info-trigger", children: _jsx(CollapsibleTrigger, { asChild: true, children: _jsxs(Button, { variant: "link", className: "flex gap-2 pr-0", children: [_jsx("span", { className: "text-foreground text-sm font-medium", children: question }), _jsx(HelpCircle, { className: "h-4 w-4" })] }) }) }));
|
|
37
37
|
}
|
|
38
38
|
export function PageHeaderCollapsibleInfo({ question, answer, seeMore, href }) {
|
|
39
|
-
return (_jsx("div", { "data-slot": "page-header-collapsible-info", children: _jsx(CollapsibleContent, { children: _jsxs("div", { className: "flex w-full justify-between pt-6", children: [_jsxs("div", { className: "mt-12 flex grow flex-col gap-3 pr-6", children: [_jsx("
|
|
39
|
+
return (_jsx("div", { "data-slot": "page-header-collapsible-info", children: _jsx(CollapsibleContent, { children: _jsxs("div", { className: "flex w-full justify-between pt-6", children: [_jsxs("div", { className: "mt-12 flex grow flex-col gap-3 pr-6", children: [_jsx("h2", { className: "text-foreground text-xl font-bold", children: question }), _jsxs("p", { className: "text-shadcn-500 text-sm leading-relaxed font-medium", children: [answer, seeMore && href && (_jsxs(_Fragment, { children: [' ', _jsxs("a", { target: "_blank", rel: "noopener noreferrer", href: href, className: "text-shadcn-600 dark:text-shadcn-400 font-medium", children: [_jsx("span", { className: "underline underline-offset-4", children: seeMore }), _jsx(ExternalLink, { size: 16, className: "ml-1 inline align-middle" })] })] }))] })] }), _jsx(CollapsibleTrigger, { asChild: true, children: _jsx(Button, { variant: "link", className: "cursor-pointer self-start", children: _jsx(ChevronUp, { size: 24, className: "text-shadcn-500" }) }) })] }) }) }));
|
|
40
40
|
}
|
|
@@ -7,6 +7,14 @@ import { type VariantProps } from 'class-variance-authority';
|
|
|
7
7
|
* role as text over a tinted surface. Do not "fix" this into a solid
|
|
8
8
|
* `bg-credit` fill — that renders red-on-red and is invisible.
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* `gap-1` is load-bearing, not decoration: a badge holding a label AND an
|
|
12
|
+
* element child (`ID<code>ctx-123</code>`) has nothing between them otherwise —
|
|
13
|
+
* JSX drops the newline-only text node and CSS drops the whitespace-only
|
|
14
|
+
* anonymous flex item — so the screen reads `IDctx-123`. Consumers were pasting
|
|
15
|
+
* `className="gap-1"` per call site; `cn` runs tailwind-merge, so an explicit
|
|
16
|
+
* `gap-2` still wins. Single-child badges are unaffected: gap needs two items.
|
|
17
|
+
*/
|
|
10
18
|
declare const badgeVariants: (props?: ({
|
|
11
19
|
variant?: "default" | "secondary" | "outline" | "destructive" | "alert" | "success" | "active" | "inactive" | "credit" | "error" | "info" | "purple" | null | undefined;
|
|
12
20
|
size?: "default" | "sm" | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/badge/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE;;;;;;GAMG;AACH,QAAA,MAAM,aAAa;;;8EA6ClB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,GACnD,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAE5D,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,qBAUzE;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/badge/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE;;;;;;GAMG;AACH;;;;;;;GAOG;AACH,QAAA,MAAM,aAAa;;;8EA6ClB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,GACnD,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAE5D,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,qBAUzE;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -9,7 +9,15 @@ import { Slot } from '@radix-ui/react-slot';
|
|
|
9
9
|
* role as text over a tinted surface. Do not "fix" this into a solid
|
|
10
10
|
* `bg-credit` fill — that renders red-on-red and is invisible.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* `gap-1` is load-bearing, not decoration: a badge holding a label AND an
|
|
14
|
+
* element child (`ID<code>ctx-123</code>`) has nothing between them otherwise —
|
|
15
|
+
* JSX drops the newline-only text node and CSS drops the whitespace-only
|
|
16
|
+
* anonymous flex item — so the screen reads `IDctx-123`. Consumers were pasting
|
|
17
|
+
* `className="gap-1"` per call site; `cn` runs tailwind-merge, so an explicit
|
|
18
|
+
* `gap-2` still wins. Single-child badges are unaffected: gap needs two items.
|
|
19
|
+
*/
|
|
20
|
+
const badgeVariants = cva('inline-flex items-center gap-1 rounded-full border border-border px-2.5 py-0.5 text-sm font-medium transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2', {
|
|
13
21
|
variants: {
|
|
14
22
|
variant: {
|
|
15
23
|
default: 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',
|
|
@@ -5,10 +5,10 @@ import { TooltipProviderProps } from '@radix-ui/react-tooltip';
|
|
|
5
5
|
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
6
6
|
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => React.JSX.Element;
|
|
7
7
|
declare const useFormField: () => {
|
|
8
|
-
invalid
|
|
9
|
-
isDirty
|
|
10
|
-
isTouched
|
|
11
|
-
isValidating
|
|
8
|
+
invalid?: boolean | undefined;
|
|
9
|
+
isDirty?: boolean | undefined;
|
|
10
|
+
isTouched?: boolean | undefined;
|
|
11
|
+
isValidating?: boolean | undefined;
|
|
12
12
|
error?: import("react-hook-form").FieldError;
|
|
13
13
|
id: string;
|
|
14
14
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAEL,eAAe,EACf,SAAS,EACT,WAAW,EAGZ,MAAM,iBAAiB,CAAA;AAKxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAS9D,QAAA,MAAM,IAAI,4MAAe,CAAA;AAazB,QAAA,MAAM,SAAS,GACb,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EAC/D,cAEC,eAAe,CAAC,YAAY,EAAE,KAAK,CAAC,sBAMtC,CAAA;AAED,QAAA,MAAM,YAAY;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAEL,eAAe,EACf,SAAS,EACT,WAAW,EAGZ,MAAM,iBAAiB,CAAA;AAKxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAS9D,QAAA,MAAM,IAAI,4MAAe,CAAA;AAazB,QAAA,MAAM,SAAS,GACb,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EAC/D,cAEC,eAAe,CAAC,YAAY,EAAE,KAAK,CAAC,sBAMtC,CAAA;AAED,QAAA,MAAM,YAAY;;;;;;;;;;;;CAyBjB,CAAA;AAWD,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,QAAA,MAAM,QAAQ;eAHD,OAAO;wCAanB,CAAA;AAGD,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,wBAAwB,CACzD,OAAO,cAAc,CAAC,IAAI,CAC3B,GAAG;IACF,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACxB,CAAA;AAED,QAAA,MAAM,SAAS;YAHL,KAAK,CAAC,SAAS;0CA2BvB,CAAA;AAGF,eAAO,MAAM,WAAW,GAAI,yBAAyB,oBAAoB,sBASxE,CAAA;AAED,QAAA,MAAM,WAAW;;gFAmBf,CAAA;AAGF,QAAA,MAAM,eAAe,yHAcnB,CAAA;AAGF,QAAA,MAAM,WAAW,yHAuBf,CAAA;AAGF,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,eAAe,EACf,WAAW,EACX,SAAS,EACV,CAAA"}
|
|
@@ -15,11 +15,14 @@ const FormField = ({ ...props }) => {
|
|
|
15
15
|
const useFormField = () => {
|
|
16
16
|
const fieldContext = React.useContext(FormFieldContext);
|
|
17
17
|
const itemContext = React.useContext(FormItemContext);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
// `useFormContext()` is null outside a `<Form>` provider, and destructuring it
|
|
19
|
+
// threw — which is what made every Form primitive, and so every *Field built
|
|
20
|
+
// on them, unusable in a plain `useState` filter bar. Inside a provider
|
|
21
|
+
// nothing below changes; outside one, the field simply has no error state.
|
|
22
|
+
const form = useFormContext();
|
|
23
|
+
const fieldState = form && fieldContext.name
|
|
24
|
+
? form.getFieldState(fieldContext.name, form.formState)
|
|
25
|
+
: undefined;
|
|
23
26
|
const { id, required } = itemContext;
|
|
24
27
|
return {
|
|
25
28
|
id,
|
|
@@ -61,7 +64,10 @@ const FormMessage = React.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
61
64
|
if (!body) {
|
|
62
65
|
return null;
|
|
63
66
|
}
|
|
64
|
-
return (_jsx("p", { ref: ref, id: formMessageId,
|
|
67
|
+
return (_jsx("p", { ref: ref, id: formMessageId,
|
|
68
|
+
// The error TEXT token, not `text-destructive`: that is the badge/fill
|
|
69
|
+
// family and measures ~3.8:1 as ink, under AA. Validation copy is text.
|
|
70
|
+
className: cn('text-system-error-h1a text-sm font-medium', className), ...props, children: body }));
|
|
65
71
|
});
|
|
66
72
|
FormMessage.displayName = 'FormMessage';
|
|
67
73
|
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };
|
|
@@ -58,14 +58,22 @@ export declare const MultipleSelectItem: React.ForwardRefExoticComponent<Omit<{
|
|
|
58
58
|
keywords?: string[];
|
|
59
59
|
forceMount?: boolean;
|
|
60
60
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
61
|
-
|
|
61
|
+
/**
|
|
62
|
+
* cmdk's own `value`/`defaultValue`/`onValueChange` are single-string search
|
|
63
|
+
* state. Spreading them and re-declaring the multi-select versions produced an
|
|
64
|
+
* INTERSECTION (`string & string[]`, and a handler taking both `string` and
|
|
65
|
+
* `string[]`), which no caller can satisfy — the controlled shape this
|
|
66
|
+
* component exists for was uncallable. They are omitted before the multi-value
|
|
67
|
+
* versions are declared; the component consumes cmdk's search state itself.
|
|
68
|
+
*/
|
|
69
|
+
export type MultipleSelectProps = Omit<React.ComponentPropsWithoutRef<typeof CommandPrimitive>, 'value' | 'defaultValue' | 'onValueChange'> & {
|
|
62
70
|
value?: string[] | [];
|
|
63
71
|
defaultValue?: string[] | [];
|
|
64
72
|
onValueChange?: (values: string[]) => void;
|
|
65
73
|
showValue?: boolean;
|
|
66
74
|
disabled?: boolean;
|
|
67
75
|
};
|
|
68
|
-
export declare const MultipleSelect: React.ForwardRefExoticComponent<Omit<{
|
|
76
|
+
export declare const MultipleSelect: React.ForwardRefExoticComponent<Omit<Omit<{
|
|
69
77
|
children?: React.ReactNode;
|
|
70
78
|
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
71
79
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -81,7 +89,7 @@ export declare const MultipleSelect: React.ForwardRefExoticComponent<Omit<{
|
|
|
81
89
|
loop?: boolean;
|
|
82
90
|
disablePointerSelection?: boolean;
|
|
83
91
|
vimBindings?: boolean;
|
|
84
|
-
} & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
92
|
+
} & React.RefAttributes<HTMLDivElement>, "ref">, "value" | "defaultValue" | "onValueChange"> & {
|
|
85
93
|
value?: string[] | [];
|
|
86
94
|
defaultValue?: string[] | [];
|
|
87
95
|
onValueChange?: (values: string[]) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/multiple-select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAmB,MAAM,MAAM,CAAA;AAgDnE,eAAO,MAAM,qBAAqB;;;eAG0B,OAAO;wCAyFjE,CAAA;AAGF,eAAO,MAAM,mBAAmB;;;;;;;0FAiD9B,CAAA;AAGF,eAAO,MAAM,mBAAmB;;;;;;uJAiB9B,CAAA;AAGF,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAAC,wBAAwB,CACrE,OAAO,gBAAgB,CAAC,IAAI,CAC7B,GAAG;IACF,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;eAHrB,QAAQ,GAAG,QAAQ;wCA+D/B,CAAA;AAGD,eAAO,MAAM,mBAAmB;;;;;;;;;;sFAY9B,CAAA;AAGF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;sFAiC9B,CAAA;AAGD,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/multiple-select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAmB,MAAM,MAAM,CAAA;AAgDnE,eAAO,MAAM,qBAAqB;;;eAG0B,OAAO;wCAyFjE,CAAA;AAGF,eAAO,MAAM,mBAAmB;;;;;;;0FAiD9B,CAAA;AAGF,eAAO,MAAM,mBAAmB;;;;;;uJAiB9B,CAAA;AAGF,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAAC,wBAAwB,CACrE,OAAO,gBAAgB,CAAC,IAAI,CAC7B,GAAG;IACF,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;eAHrB,QAAQ,GAAG,QAAQ;wCA+D/B,CAAA;AAGD,eAAO,MAAM,mBAAmB;;;;;;;;;;sFAY9B,CAAA;AAGF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;sFAiC9B,CAAA;AAGD;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,EACvD,OAAO,GAAG,cAAc,GAAG,eAAe,CAC3C,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;IAC5B,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;YAPjB,MAAM,EAAE,GAAG,EAAE;mBACN,MAAM,EAAE,GAAG,EAAE;oBACZ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI;gBAC9B,OAAO;eACR,OAAO;wCA2HnB,CAAA"}
|
|
@@ -2,6 +2,11 @@ import * as React from 'react';
|
|
|
2
2
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
3
|
declare function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>): React.JSX.Element;
|
|
4
4
|
declare function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): React.JSX.Element;
|
|
5
|
+
/**
|
|
6
|
+
* Radix strips `className` and `style` off its `Select.Value` before rendering
|
|
7
|
+
* the span, so this slot cannot be styled directly — it is styled from the
|
|
8
|
+
* trigger instead, see VALUE_OVERFLOW_CLASS.
|
|
9
|
+
*/
|
|
5
10
|
declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): React.JSX.Element;
|
|
6
11
|
type SelectTriggerProps = React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
7
12
|
readOnly?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAKzD,iBAAS,MAAM,CAAC,EACd,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,qBAEnD;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAEpD;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAEpD;AAED,KAAK,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAC5C,OAAO,eAAe,CAAC,OAAO,CAC/B,GAAG;IACF,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAKzD,iBAAS,MAAM,CAAC,EACd,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,qBAEnD;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAEpD;AAED;;;;GAIG;AACH,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAEpD;AAED,KAAK,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAC5C,OAAO,eAAe,CAAC,OAAO,CAC/B,GAAG;IACF,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAsBD,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,kBAAkB,qBAsBpB;AAED,iBAAS,oBAAoB,CAAC,EAC5B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,cAAc,CAAC,qBAU7D;AACD,iBAAS,sBAAsB,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,gBAAgB,CAAC,qBAU/D;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,qBA0CtD;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,qBAQvC;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,qBAQpD;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,qBAgBnD;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,SAAS,CAAC,qBAQxD;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACvB,CAAA"}
|
|
@@ -10,11 +10,34 @@ function Select({ ...props }) {
|
|
|
10
10
|
function SelectGroup({ ...props }) {
|
|
11
11
|
return _jsx(SelectPrimitive.Group, { "data-slot": "select-group", ...props });
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Radix strips `className` and `style` off its `Select.Value` before rendering
|
|
15
|
+
* the span, so this slot cannot be styled directly — it is styled from the
|
|
16
|
+
* trigger instead, see VALUE_OVERFLOW_CLASS.
|
|
17
|
+
*/
|
|
13
18
|
function SelectValue({ ...props }) {
|
|
14
19
|
return _jsx(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
15
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Truncate the selected value instead of letting it wrap out of the trigger.
|
|
23
|
+
*
|
|
24
|
+
* `.select-trigger` is a fixed-height `flex w-full items-center justify-between`
|
|
25
|
+
* box, and a flex item never shrinks below its own min-content width: a long
|
|
26
|
+
* value broke to a second line and overflowed the box. `min-w-0` lets the value
|
|
27
|
+
* slot shrink, `truncate` ellipsises what no longer fits — the chevron keeps its
|
|
28
|
+
* place because the value absorbs all the shrinkage.
|
|
29
|
+
*
|
|
30
|
+
* Written as a child-scoped variant on the TRIGGER because Radix strips
|
|
31
|
+
* `className` off `Select.Value` itself; the `>` combinator holds because Radix
|
|
32
|
+
* renders that span as the trigger's direct child.
|
|
33
|
+
*
|
|
34
|
+
* Truncation hides text, so a trigger showing a long value should also carry
|
|
35
|
+
* `title` — on the trigger, never on the value slot, which Radix renders
|
|
36
|
+
* `pointer-events: none`.
|
|
37
|
+
*/
|
|
38
|
+
const VALUE_OVERFLOW_CLASS = '[&>[data-slot=select-value]]:min-w-0 [&>[data-slot=select-value]]:truncate';
|
|
16
39
|
function SelectTrigger({ className, readOnly, children, ...props }) {
|
|
17
|
-
return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": "default", className: cn('select-trigger select-read-only select-disabled', className), "aria-readonly": readOnly, "data-read-only": readOnly ? '' : undefined, ...props, children: [children, !readOnly && (_jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { className: "select-chevron" }) }))] }));
|
|
40
|
+
return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": "default", className: cn('select-trigger select-read-only select-disabled', VALUE_OVERFLOW_CLASS, className), "aria-readonly": readOnly, "data-read-only": readOnly ? '' : undefined, ...props, children: [children, !readOnly && (_jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { className: "select-chevron" }) }))] }));
|
|
18
41
|
}
|
|
19
42
|
function SelectScrollUpButton({ className, ...props }) {
|
|
20
43
|
return (_jsx(SelectPrimitive.ScrollUpButton, { "data-slot": "select-scroll-up-button", className: cn('select-scroll-button', className), ...props, children: _jsx(ChevronUp, { className: "size-4" }) }));
|