@lerianstudio/sindarian-ui 1.4.0-beta.8 → 2.0.0-beta.10
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/breadcrumb/index.d.ts.map +1 -1
- package/dist/components/breadcrumb/index.js +25 -1
- package/dist/components/card/account-card/index.d.ts.map +1 -1
- package/dist/components/card/account-card/index.js +5 -5
- package/dist/components/card/basic-card/index.d.ts.map +1 -1
- package/dist/components/card/basic-card/index.js +2 -2
- package/dist/components/card/entity-card/index.js +4 -4
- package/dist/components/dialog/confirmation-dialog/index.d.ts +36 -5
- package/dist/components/dialog/confirmation-dialog/index.d.ts.map +1 -1
- package/dist/components/dialog/confirmation-dialog/index.js +5 -2
- package/dist/components/entity-box/index.d.ts +18 -2
- package/dist/components/entity-box/index.d.ts.map +1 -1
- package/dist/components/entity-box/index.js +33 -5
- package/dist/components/entity-data-table/index.d.ts.map +1 -1
- package/dist/components/entity-data-table/index.js +1 -1
- package/dist/components/form/file-upload-field/index.d.ts +11 -2
- package/dist/components/form/file-upload-field/index.d.ts.map +1 -1
- package/dist/components/form/file-upload-field/index.js +8 -3
- package/dist/components/form/input-field/index.d.ts +41 -2
- package/dist/components/form/input-field/index.d.ts.map +1 -1
- package/dist/components/form/input-field/index.js +73 -15
- package/dist/components/form/password-field/index.d.ts +5 -1
- package/dist/components/form/password-field/index.d.ts.map +1 -1
- package/dist/components/form/password-field/index.js +2 -2
- package/dist/components/form/select-field/index.d.ts +9 -1
- package/dist/components/form/select-field/index.d.ts.map +1 -1
- package/dist/components/form/select-field/index.js +2 -2
- package/dist/components/page-header/index.d.ts.map +1 -1
- package/dist/components/page-header/index.js +2 -2
- package/dist/components/table/id-table-cell.d.ts +5 -1
- package/dist/components/table/id-table-cell.d.ts.map +1 -1
- package/dist/components/table/id-table-cell.js +48 -6
- package/dist/components/ui/autocomplete/index.d.ts +58 -6
- package/dist/components/ui/autocomplete/index.d.ts.map +1 -1
- package/dist/components/ui/autocomplete/index.js +96 -16
- package/dist/components/ui/badge/index.d.ts +11 -7
- package/dist/components/ui/badge/index.d.ts.map +1 -1
- package/dist/components/ui/badge/index.js +31 -9
- package/dist/components/ui/button/styles.css +31 -1
- package/dist/components/ui/calendar/index.d.ts.map +1 -1
- package/dist/components/ui/calendar/index.js +7 -1
- package/dist/components/ui/card/index.d.ts.map +1 -1
- package/dist/components/ui/card/index.js +1 -1
- package/dist/components/ui/copy-field/index.d.ts.map +1 -1
- package/dist/components/ui/copy-field/index.js +1 -1
- package/dist/components/ui/dropdown-menu/index.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu/index.js +4 -1
- package/dist/components/ui/field/index.d.ts.map +1 -1
- package/dist/components/ui/field/index.js +5 -2
- package/dist/components/ui/file-upload/index.d.ts +235 -9
- package/dist/components/ui/file-upload/index.d.ts.map +1 -1
- package/dist/components/ui/file-upload/index.js +354 -17
- package/dist/components/ui/form.d.ts +4 -0
- package/dist/components/ui/form.d.ts.map +1 -1
- package/dist/components/ui/form.js +53 -8
- package/dist/components/ui/input/styles.css +30 -2
- package/dist/components/ui/multiple-select/index.js +2 -2
- package/dist/components/ui/progress/index.d.ts +15 -1
- package/dist/components/ui/progress/index.d.ts.map +1 -1
- package/dist/components/ui/progress/index.js +25 -2
- package/dist/components/ui/sheet/index.d.ts.map +1 -1
- package/dist/components/ui/sheet/index.js +2 -2
- package/dist/components/ui/sidebar/index.d.ts +1 -0
- package/dist/components/ui/sidebar/index.d.ts.map +1 -1
- package/dist/components/ui/sidebar/index.js +1 -0
- package/dist/components/ui/sidebar/sidebar-expand-button.d.ts +1 -1
- package/dist/components/ui/sidebar/sidebar-expand-button.d.ts.map +1 -1
- package/dist/components/ui/sidebar/sidebar-expand-button.js +32 -2
- package/dist/components/ui/sidebar/sidebar-item.d.ts +1 -1
- package/dist/components/ui/sidebar/sidebar-item.d.ts.map +1 -1
- package/dist/components/ui/sidebar/sidebar-item.js +28 -4
- package/dist/components/ui/sidebar/sidebar-provider.d.ts +37 -0
- package/dist/components/ui/sidebar/sidebar-provider.d.ts.map +1 -1
- package/dist/components/ui/sidebar/sidebar-provider.js +125 -4
- package/dist/components/ui/sidebar/sidebar-root.d.ts +38 -1
- package/dist/components/ui/sidebar/sidebar-root.d.ts.map +1 -1
- package/dist/components/ui/sidebar/sidebar-root.js +100 -5
- package/dist/components/ui/sidebar/sidebar-trigger.d.ts +18 -0
- package/dist/components/ui/sidebar/sidebar-trigger.d.ts.map +1 -0
- package/dist/components/ui/sidebar/sidebar-trigger.js +30 -0
- package/dist/components/ui/toggle-group/index.d.ts +1 -1
- package/dist/components/ui/toggle-group/index.d.ts.map +1 -1
- package/dist/components/ui/toggle-group/index.js +73 -4
- package/dist/components/ui/tooltip/index.d.ts +15 -0
- package/dist/components/ui/tooltip/index.d.ts.map +1 -1
- package/dist/components/ui/tooltip/index.js +16 -1
- package/dist/domain/blotter/index.d.ts +4 -2
- package/dist/domain/blotter/index.d.ts.map +1 -1
- package/dist/domain/delinquency-aging/aging-buckets.d.ts.map +1 -1
- package/dist/domain/delinquency-aging/aging-buckets.js +8 -3
- package/dist/domain/delinquency-aging/index.d.ts.map +1 -1
- package/dist/domain/delinquency-aging/index.js +8 -3
- package/dist/domain/key-id/index.js +1 -1
- package/dist/domain/status-rail/index.js +1 -1
- package/dist/domain/threshold-gauge/index.d.ts.map +1 -1
- package/dist/domain/threshold-gauge/index.js +9 -5
- package/dist/enterprise/stat-card/index.d.ts.map +1 -1
- package/dist/enterprise/stat-card/index.js +12 -4
- package/dist/esm/components/breadcrumb/index.d.ts.map +1 -1
- package/dist/esm/components/breadcrumb/index.js +25 -1
- package/dist/esm/components/card/account-card/index.d.ts.map +1 -1
- package/dist/esm/components/card/account-card/index.js +5 -5
- package/dist/esm/components/card/basic-card/index.d.ts.map +1 -1
- package/dist/esm/components/card/basic-card/index.js +2 -2
- package/dist/esm/components/card/entity-card/index.js +4 -4
- package/dist/esm/components/dialog/confirmation-dialog/index.d.ts +36 -5
- package/dist/esm/components/dialog/confirmation-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/dialog/confirmation-dialog/index.js +5 -2
- package/dist/esm/components/entity-box/index.d.ts +18 -2
- package/dist/esm/components/entity-box/index.d.ts.map +1 -1
- package/dist/esm/components/entity-box/index.js +30 -5
- package/dist/esm/components/entity-data-table/index.d.ts.map +1 -1
- package/dist/esm/components/entity-data-table/index.js +1 -1
- package/dist/esm/components/form/file-upload-field/index.d.ts +11 -2
- package/dist/esm/components/form/file-upload-field/index.d.ts.map +1 -1
- package/dist/esm/components/form/file-upload-field/index.js +8 -3
- package/dist/esm/components/form/input-field/index.d.ts +41 -2
- package/dist/esm/components/form/input-field/index.d.ts.map +1 -1
- package/dist/esm/components/form/input-field/index.js +73 -15
- package/dist/esm/components/form/password-field/index.d.ts +5 -1
- package/dist/esm/components/form/password-field/index.d.ts.map +1 -1
- package/dist/esm/components/form/password-field/index.js +2 -2
- package/dist/esm/components/form/select-field/index.d.ts +9 -1
- package/dist/esm/components/form/select-field/index.d.ts.map +1 -1
- package/dist/esm/components/form/select-field/index.js +2 -2
- package/dist/esm/components/page-header/index.d.ts.map +1 -1
- package/dist/esm/components/page-header/index.js +2 -2
- package/dist/esm/components/table/id-table-cell.d.ts +5 -1
- package/dist/esm/components/table/id-table-cell.d.ts.map +1 -1
- package/dist/esm/components/table/id-table-cell.js +48 -3
- package/dist/esm/components/ui/autocomplete/index.d.ts +58 -6
- package/dist/esm/components/ui/autocomplete/index.d.ts.map +1 -1
- package/dist/esm/components/ui/autocomplete/index.js +96 -16
- package/dist/esm/components/ui/badge/index.d.ts +11 -7
- package/dist/esm/components/ui/badge/index.d.ts.map +1 -1
- package/dist/esm/components/ui/badge/index.js +31 -9
- package/dist/esm/components/ui/calendar/index.d.ts.map +1 -1
- package/dist/esm/components/ui/calendar/index.js +8 -2
- package/dist/esm/components/ui/card/index.d.ts.map +1 -1
- package/dist/esm/components/ui/card/index.js +1 -1
- package/dist/esm/components/ui/copy-field/index.d.ts.map +1 -1
- package/dist/esm/components/ui/copy-field/index.js +1 -1
- package/dist/esm/components/ui/dropdown-menu/index.d.ts.map +1 -1
- package/dist/esm/components/ui/dropdown-menu/index.js +4 -1
- package/dist/esm/components/ui/field/index.d.ts.map +1 -1
- package/dist/esm/components/ui/field/index.js +5 -2
- package/dist/esm/components/ui/file-upload/index.d.ts +235 -9
- package/dist/esm/components/ui/file-upload/index.d.ts.map +1 -1
- package/dist/esm/components/ui/file-upload/index.js +353 -17
- package/dist/esm/components/ui/form.d.ts +4 -0
- package/dist/esm/components/ui/form.d.ts.map +1 -1
- package/dist/esm/components/ui/form.js +53 -8
- package/dist/esm/components/ui/multiple-select/index.js +2 -2
- package/dist/esm/components/ui/progress/index.d.ts +15 -1
- package/dist/esm/components/ui/progress/index.d.ts.map +1 -1
- package/dist/esm/components/ui/progress/index.js +25 -2
- package/dist/esm/components/ui/sheet/index.d.ts.map +1 -1
- package/dist/esm/components/ui/sheet/index.js +2 -2
- package/dist/esm/components/ui/sidebar/index.d.ts +1 -0
- package/dist/esm/components/ui/sidebar/index.d.ts.map +1 -1
- package/dist/esm/components/ui/sidebar/index.js +1 -0
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.d.ts +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.d.ts.map +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.js +32 -2
- package/dist/esm/components/ui/sidebar/sidebar-item.d.ts +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-item.d.ts.map +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-item.js +28 -4
- package/dist/esm/components/ui/sidebar/sidebar-provider.d.ts +37 -0
- package/dist/esm/components/ui/sidebar/sidebar-provider.d.ts.map +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-provider.js +122 -1
- package/dist/esm/components/ui/sidebar/sidebar-root.d.ts +38 -1
- package/dist/esm/components/ui/sidebar/sidebar-root.d.ts.map +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-root.js +102 -7
- package/dist/esm/components/ui/sidebar/sidebar-trigger.d.ts +18 -0
- package/dist/esm/components/ui/sidebar/sidebar-trigger.d.ts.map +1 -0
- package/dist/esm/components/ui/sidebar/sidebar-trigger.js +26 -0
- package/dist/esm/components/ui/toggle-group/index.d.ts +1 -1
- package/dist/esm/components/ui/toggle-group/index.d.ts.map +1 -1
- package/dist/esm/components/ui/toggle-group/index.js +73 -4
- package/dist/esm/components/ui/tooltip/index.d.ts +15 -0
- package/dist/esm/components/ui/tooltip/index.d.ts.map +1 -1
- package/dist/esm/components/ui/tooltip/index.js +16 -1
- package/dist/esm/domain/blotter/index.d.ts +4 -2
- package/dist/esm/domain/blotter/index.d.ts.map +1 -1
- package/dist/esm/domain/delinquency-aging/aging-buckets.d.ts.map +1 -1
- package/dist/esm/domain/delinquency-aging/aging-buckets.js +8 -3
- package/dist/esm/domain/delinquency-aging/index.d.ts.map +1 -1
- package/dist/esm/domain/delinquency-aging/index.js +8 -3
- package/dist/esm/domain/key-id/index.js +1 -1
- package/dist/esm/domain/status-rail/index.js +1 -1
- package/dist/esm/domain/threshold-gauge/index.d.ts.map +1 -1
- package/dist/esm/domain/threshold-gauge/index.js +9 -5
- package/dist/esm/enterprise/stat-card/index.d.ts.map +1 -1
- package/dist/esm/enterprise/stat-card/index.js +12 -4
- package/dist/globals.css +101 -32
- package/package.json +5 -3
|
@@ -23,7 +23,7 @@ export function AccountBalanceCardHeader({ className, ...props }) {
|
|
|
23
23
|
return (_jsx("div", { "data-slot": "account-balance-card-header", className: cn('flex flex-col', className), ...props }));
|
|
24
24
|
}
|
|
25
25
|
export function AccountBalanceCardTitle({ className, ...props }) {
|
|
26
|
-
return (_jsx("p", { "data-slot": "account-balance-card-title", className: cn('text-
|
|
26
|
+
return (_jsx("p", { "data-slot": "account-balance-card-title", className: cn('text-foreground text-lg font-bold', className), ...props }));
|
|
27
27
|
}
|
|
28
28
|
export function AccountBalanceCardDeleteButton({ className, ...props }) {
|
|
29
29
|
return (_jsx(IconButton, { variant: "outline", size: "small", rounded: true, "data-slot": "account-balance-card-delete-button", className: cn('absolute top-3 right-3', className), ...props, children: _jsx(Trash, { className: "text-muted-foreground h-4 w-4" }) }));
|
|
@@ -35,19 +35,19 @@ export function AccountBalanceCardLoading({ className, ...props }) {
|
|
|
35
35
|
return (_jsx(Skeleton, { "data-slot": "account-balance-card-loading", className: cn('bg-muted mt-3 h-3 w-full rounded-md', className), ...props }));
|
|
36
36
|
}
|
|
37
37
|
export function AccountBalanceCardEmpty({ className, ...props }) {
|
|
38
|
-
return (_jsx("p", { "data-slot": "account-balance-card-empty", className: cn('text-
|
|
38
|
+
return (_jsx("p", { "data-slot": "account-balance-card-empty", className: cn('text-muted-foreground mt-3 text-center text-sm font-normal', className), ...props }));
|
|
39
39
|
}
|
|
40
40
|
export function AccountBalanceCardInfo({ className, assetCode, value, children: _children, ref, ...props }) {
|
|
41
|
-
return (_jsxs("div", { ref: ref, "data-slot": "account-balance-card-info", className: cn('text-
|
|
41
|
+
return (_jsxs("div", { ref: ref, "data-slot": "account-balance-card-info", className: cn('text-muted-foreground mt-3 flex flex-row items-center justify-between text-sm font-normal', className), ...props, children: [_jsx("p", { children: assetCode }), _jsx("p", { children: value })] }));
|
|
42
42
|
}
|
|
43
43
|
export function AccountBalanceCardUpdateButton({ className: _className, loading, timestamp, loadingLabel = 'Updating...', updatedInLabel = 'Updated in', updatedLabel = 'Updated', onRefresh, children: _children, ref, ...props }) {
|
|
44
44
|
const _time = useTime({ interval: 1000 * 60 });
|
|
45
45
|
const updated = React.useMemo(() => {
|
|
46
46
|
return !dayjs(timestamp).isBefore(dayjs().subtract(1, 'minute'));
|
|
47
47
|
}, [_time, timestamp]);
|
|
48
|
-
return (_jsxs("div", { className: "mb-3 flex flex-row items-center justify-end gap-2", children: [_jsxs("p", { className: "text-
|
|
48
|
+
return (_jsxs("div", { className: "mb-3 flex flex-row items-center justify-end gap-2", children: [_jsxs("p", { className: "text-muted-foreground text-xs font-medium", children: [loading && loadingLabel, !loading && !updated && updatedInLabel, !loading && updated && updatedLabel] }), !loading && updated && (_jsx(CheckCircle2, { className: "text-system-success-h1a h-4 w-4" })), (!updated || loading) && (_jsx(Button, { ref: ref, variant: "link", "data-slot": "account-balance-card-update-button", className: "h-3 p-0", onClick: onRefresh, disabled: loading, ...props, children: _jsx(RefreshCw, { className: cn('size-4', { 'motion-safe:animate-spin': loading }) }) }))] }));
|
|
49
49
|
}
|
|
50
50
|
export function AccountBalanceCardTrigger({ className, openLabel, closeLabel, children: _children, ...props }) {
|
|
51
51
|
const { open } = React.useContext(AccountBalanceCardContext);
|
|
52
|
-
return (_jsx(CollapsibleTrigger, { asChild: true, children: _jsx(Button, { variant: "link", "data-slot": "account-balance-card-trigger", className: cn('text-
|
|
52
|
+
return (_jsx(CollapsibleTrigger, { asChild: true, children: _jsx(Button, { variant: "link", "data-slot": "account-balance-card-trigger", className: cn('text-muted-foreground h-4 p-0 text-xs', className), ...props, children: !open ? openLabel : closeLabel }) }));
|
|
53
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/card/basic-card/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,wBAAgB,SAAS,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAO7B;AAED,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAO5B;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/card/basic-card/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,wBAAgB,SAAS,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAO7B;AAED,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAO5B;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAU7B;AAED,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAE7B"}
|
|
@@ -4,10 +4,10 @@ export function BasicCard({ className, ...props }) {
|
|
|
4
4
|
return (_jsx("div", { className: cn('bg-card flex flex-col rounded-lg p-6', className), ...props }));
|
|
5
5
|
}
|
|
6
6
|
export function BasicCardTitle({ className, ...props }) {
|
|
7
|
-
return (_jsx("h2", { className: cn('text-
|
|
7
|
+
return (_jsx("h2", { className: cn('text-foreground mb-4 text-sm font-medium', className), ...props }));
|
|
8
8
|
}
|
|
9
9
|
export function BasicCardContent({ className, ...props }) {
|
|
10
|
-
return (_jsx("div", { className: cn('text-
|
|
10
|
+
return (_jsx("div", { className: cn('text-muted-foreground mb-6 text-sm font-medium', className), ...props }));
|
|
11
11
|
}
|
|
12
12
|
export function BasicCardAction({ className, ...props }) {
|
|
13
13
|
return _jsx("div", { className: cn('flex flex-col', className), ...props });
|
|
@@ -30,7 +30,7 @@ export function EntityCardTitle({ className, ...props }) {
|
|
|
30
30
|
return (_jsx("h3", { "data-slot": "entity-card-title", className: cn('text-foreground text-sm font-semibold', className), ...props }));
|
|
31
31
|
}
|
|
32
32
|
export function EntityCardIcon({ className, ...props }) {
|
|
33
|
-
return (_jsx("span", { "data-slot": "entity-card-icon", className: cn('text-
|
|
33
|
+
return (_jsx("span", { "data-slot": "entity-card-icon", className: cn('text-muted-foreground size-8 [&>svg]:size-8 [&>svg]:stroke-[1.5]', className), ...props }));
|
|
34
34
|
}
|
|
35
35
|
export function EntityCardBadgeList({ className, ...props }) {
|
|
36
36
|
return (_jsx("div", { "data-slot": "entity-card-badge-list", className: cn('flex flex-wrap gap-2', className), ...props }));
|
|
@@ -42,11 +42,11 @@ export function EntityCardContent({ className, ...props }) {
|
|
|
42
42
|
return (_jsx("div", { "data-slot": "entity-card-content", className: cn('flex flex-col gap-2.5', className), ...props }));
|
|
43
43
|
}
|
|
44
44
|
export function EntityCardDescription({ className, ...props }) {
|
|
45
|
-
return (_jsx("p", { "data-slot": "entity-card-description", className: cn('text-
|
|
45
|
+
return (_jsx("p", { "data-slot": "entity-card-description", className: cn('text-muted-foreground text-xs font-medium', className), ...props }));
|
|
46
46
|
}
|
|
47
47
|
export function EntityCardList({ className, ...props }) {
|
|
48
|
-
return (_jsx("ul", { "data-slot": "entity-card-list", className: cn('text-
|
|
48
|
+
return (_jsx("ul", { "data-slot": "entity-card-list", className: cn('text-muted-foreground mx-2 list-inside list-disc space-y-1 text-xs font-medium', className), ...props }));
|
|
49
49
|
}
|
|
50
50
|
export function EntityCardFooter({ className, children, ...props }) {
|
|
51
|
-
return (_jsxs("div", { "data-slot": "entity-card-footer", className: cn('text-
|
|
51
|
+
return (_jsxs("div", { "data-slot": "entity-card-footer", className: cn('text-muted-foreground flex flex-col gap-2 text-xs font-medium', className), ...props, children: [_jsx(Separator, {}), _jsx("div", { className: "[&>svg]:text-muted-foreground flex flex-row items-center gap-2 [&>svg]:size-4 [&>svg]:stroke-[1.5]", children: children })] }));
|
|
52
52
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
type ConfirmationDialogSharedProps = {
|
|
3
3
|
open: boolean;
|
|
4
4
|
onOpenChange: (open: boolean) => void;
|
|
5
|
-
title?:
|
|
6
|
-
description?:
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
description?: React.ReactNode;
|
|
7
7
|
/** @deprecated dead prop, removed in the next major */
|
|
8
8
|
ledgerName?: string;
|
|
9
9
|
variant?: 'default' | 'warning' | 'destructive' | 'success';
|
|
10
|
-
loading?: boolean;
|
|
11
10
|
/**
|
|
12
11
|
* Awaited. While it is in flight the dialog reports a pending status, both
|
|
13
12
|
* actions are disabled and dismissal is blocked; it closes on resolve. A
|
|
@@ -17,8 +16,40 @@ export type ConfirmationDialogProps = {
|
|
|
17
16
|
onCancel?: () => void;
|
|
18
17
|
confirmLabel?: string;
|
|
19
18
|
cancelLabel?: string;
|
|
20
|
-
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* ⛔ `loading` IS THE DISCRIMINANT: driving the dialog's busy state from the
|
|
22
|
+
* outside requires `pendingLabel`, because the announcement region only mounts
|
|
23
|
+
* when that label exists and a `loading` dialog without one is silently
|
|
24
|
+
* unannounced.
|
|
25
|
+
*
|
|
26
|
+
* The rule is compile-time on purpose. `pendingLabel` had an English default
|
|
27
|
+
* until it was removed for reading "Processing" aloud over translated copy, and
|
|
28
|
+
* 73 consumer call sites pass `loading` with no label: every one of them would
|
|
29
|
+
* have lost its pending announcement on a silent bump, with nothing visible on
|
|
30
|
+
* screen to betray it.
|
|
31
|
+
*
|
|
32
|
+
* A dialog that drives its busy state from `onConfirm` alone is untouched:
|
|
33
|
+
* `pendingLabel` stays optional there, and omitting it still means the dialog
|
|
34
|
+
* announces nothing rather than announcing the wrong language.
|
|
35
|
+
*/
|
|
36
|
+
type ConfirmationDialogPendingProps = {
|
|
37
|
+
loading: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Announced to screen readers while a confirm is in flight.
|
|
40
|
+
* Caller-supplied and already localized: this string is never visible, so
|
|
41
|
+
* a default here would read English aloud over a translated dialog. The
|
|
42
|
+
* visible `confirmLabel` / `cancelLabel` keep their English defaults,
|
|
43
|
+
* because a caller sees those and overrides them.
|
|
44
|
+
*/
|
|
45
|
+
pendingLabel: string;
|
|
46
|
+
} | {
|
|
47
|
+
loading?: undefined;
|
|
48
|
+
/** As above, and optional while nothing drives the busy state from
|
|
49
|
+
* outside: omit it and an awaited `onConfirm` announces nothing. */
|
|
21
50
|
pendingLabel?: string;
|
|
22
51
|
};
|
|
52
|
+
export type ConfirmationDialogProps = ConfirmationDialogSharedProps & ConfirmationDialogPendingProps;
|
|
23
53
|
export declare function ConfirmationDialog({ open, onOpenChange, title, description, variant, loading, onConfirm, onCancel, confirmLabel, cancelLabel, pendingLabel }: ConfirmationDialogProps): React.JSX.Element;
|
|
54
|
+
export {};
|
|
24
55
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dialog/confirmation-dialog/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAuD9B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dialog/confirmation-dialog/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAuD9B,KAAK,6BAA6B,GAAG;IACnC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAA;IAC3D;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,KAAK,8BAA8B,GAC/B;IACE,OAAO,EAAE,OAAO,CAAA;IAChB;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,CAAA;CACrB,GACD;IACE,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB;yEACqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAEL,MAAM,MAAM,uBAAuB,GAAG,6BAA6B,GACjE,8BAA8B,CAAA;AAEhC,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,YAAY,EACZ,KAAY,EACZ,WAAkB,EAClB,OAAmB,EACnB,OAAO,EACP,SAAoB,EACpB,QAAmB,EACnB,YAAY,EACZ,WAAW,EACX,YAAY,EACb,EAAE,uBAAuB,qBAiGzB"}
|
|
@@ -25,7 +25,7 @@ const confirmationDialogIconVariants = cva('flex size-10 shrink-0 items-center j
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
const ConfirmationDialogIcon = ({ className, variant, ...props }) => (_jsxs("span", { className: cn(confirmationDialogIconVariants({ variant }), className), ...props, children: [variant === 'default' && _jsx(Ban, {}), variant === 'warning' && _jsx(TriangleAlert, {}), variant === 'destructive' && _jsx(Ban, {}), variant === 'success' && _jsx(CheckCircle2, {})] }));
|
|
28
|
-
export function ConfirmationDialog({ open, onOpenChange, title =
|
|
28
|
+
export function ConfirmationDialog({ open, onOpenChange, title = null, description = null, variant = 'default', loading, onConfirm = () => { }, onCancel = () => { }, confirmLabel, cancelLabel, pendingLabel }) {
|
|
29
29
|
const [pending, setPending] = React.useState(false);
|
|
30
30
|
const busy = Boolean(loading) || pending;
|
|
31
31
|
const handleConfirm = async () => {
|
|
@@ -53,5 +53,8 @@ export function ConfirmationDialog({ open, onOpenChange, title = '', description
|
|
|
53
53
|
if (busy) {
|
|
54
54
|
event.preventDefault();
|
|
55
55
|
}
|
|
56
|
-
}, children: [_jsxs(AlertDialogHeader, { className: "flex-row items-center", children: [_jsx(ConfirmationDialogIcon, { variant: variant }), _jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
56
|
+
}, children: [_jsxs(AlertDialogHeader, { className: "flex-row items-center", children: [_jsx(ConfirmationDialogIcon, { variant: variant }), _jsxs("div", { className: "flex flex-col gap-4", children: [title == null ||
|
|
57
|
+
title === false ||
|
|
58
|
+
title === true ||
|
|
59
|
+
title === '' ? (_jsx(AlertDialogTitle, { className: "sr-only", children: confirmLabel || 'Confirm' })) : (_jsx(AlertDialogTitle, { children: title })), description == null ? null : (_jsx(AlertDialogDescription, { children: description }))] })] }), pendingLabel ? (_jsx("span", { role: "status", className: "sr-only", children: busy ? pendingLabel : '' })) : null, _jsxs(AlertDialogFooter, { className: "gap-4", children: [_jsx(AlertDialogCancel, { asChild: true, variant: "secondary", children: _jsx(Button, { onClick: onCancel, disabled: busy, variant: "secondary", size: "small", children: cancelLabel ?? 'Cancel' }) }), _jsx(LoadingButton, { loading: busy, onClick: handleConfirm, variant: "primary", size: "small", "data-testid": "confirm", children: confirmLabel ?? 'Confirm' })] })] }) }));
|
|
57
60
|
}
|
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CollapsibleContentProps, CollapsibleProps, CollapsibleTriggerProps } from '@radix-ui/react-collapsible';
|
|
3
3
|
declare function EntityBox({ className, children, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
4
|
-
declare function EntityBoxCollapsible({ className, ...props }: CollapsibleProps): React.JSX.Element;
|
|
5
|
-
|
|
4
|
+
declare function EntityBoxCollapsible({ className, open, defaultOpen, onOpenChange, ...props }: CollapsibleProps): React.JSX.Element;
|
|
5
|
+
export type EntityBoxCollapsibleTriggerProps = CollapsibleTriggerProps & {
|
|
6
|
+
/** Accessible name while the box is closed. */
|
|
7
|
+
expandLabel?: string;
|
|
8
|
+
/** Accessible name while the box is open. */
|
|
9
|
+
collapseLabel?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* ⛔ THIS TRIGGER HAS NO TEXT NODE. It is a `Settings2` glyph inside a Button,
|
|
13
|
+
* so without an `aria-label` a screen reader announced "button" and nothing
|
|
14
|
+
* else (SC 4.1.2) — and this is the control that opens the filter panel on
|
|
15
|
+
* every console list page.
|
|
16
|
+
*
|
|
17
|
+
* The name describes the ACTION and Radix's `aria-expanded` carries the state,
|
|
18
|
+
* so the two halves do not repeat each other. English defaults because no
|
|
19
|
+
* consumer passes a label today; a translated console overrides both.
|
|
20
|
+
*/
|
|
21
|
+
declare function EntityBoxCollapsibleTrigger({ expandLabel, collapseLabel, 'aria-label': ariaLabel, ...props }: EntityBoxCollapsibleTriggerProps): React.JSX.Element;
|
|
6
22
|
declare function EntityBoxCollapsibleContent({ children, ...props }: CollapsibleContentProps): React.JSX.Element;
|
|
7
23
|
export interface EntityBoxHeaderProps extends React.ComponentProps<'div'> {
|
|
8
24
|
title: string;
|
|
@@ -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;
|
|
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;AAYD,iBAAS,oBAAoB,CAAC,EAC5B,SAAS,EACT,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,gBAAgB,qBAoBlB;AAED,MAAM,MAAM,gCAAgC,GAAG,uBAAuB,GAAG;IACvE,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;;;;;;;;GASG;AACH,iBAAS,2BAA2B,CAAC,EACnC,WAAsB,EACtB,aAA0B,EAC1B,YAAY,EAAE,SAAS,EACvB,GAAG,KAAK,EACT,EAAE,gCAAgC,qBAclC;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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
2
3
|
import { cn } from '../../lib/utils.js';
|
|
3
4
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip/index.js';
|
|
4
5
|
import { CircleHelp, Settings2 } from 'lucide-react';
|
|
@@ -8,17 +9,41 @@ import { Separator } from '../ui/separator/index.js';
|
|
|
8
9
|
function EntityBox({ className, children, ...props }) {
|
|
9
10
|
return (_jsx("div", { "data-slot": "entity-box", className: cn('shadow-entity-box bg-card mb-2 flex items-center justify-between rounded-lg p-6', className), ...props, children: children }));
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The open state, republished for the trigger.
|
|
14
|
+
*
|
|
15
|
+
* Radix keeps it in a context it does not export, and the trigger one element
|
|
16
|
+
* down needs it to say what activating it will DO. Mirroring it here rather
|
|
17
|
+
* than forcing every consumer to lift the state: all ten console call sites
|
|
18
|
+
* render `<EntityBoxCollapsible>` uncontrolled.
|
|
19
|
+
*/
|
|
20
|
+
const EntityBoxCollapsibleContext = React.createContext(false);
|
|
21
|
+
function EntityBoxCollapsible({ className, open, defaultOpen, onOpenChange, ...props }) {
|
|
22
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultOpen ?? false);
|
|
23
|
+
return (_jsx(EntityBoxCollapsibleContext.Provider, { value: open ?? uncontrolled, children: _jsx(Collapsible, { className: cn('shadow-entity-box bg-card mb-2 flex flex-col rounded-lg', className), open: open, defaultOpen: defaultOpen, onOpenChange: (next) => {
|
|
24
|
+
setUncontrolled(next);
|
|
25
|
+
onOpenChange?.(next);
|
|
26
|
+
}, ...props }) }));
|
|
13
27
|
}
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
/**
|
|
29
|
+
* ⛔ THIS TRIGGER HAS NO TEXT NODE. It is a `Settings2` glyph inside a Button,
|
|
30
|
+
* so without an `aria-label` a screen reader announced "button" and nothing
|
|
31
|
+
* else (SC 4.1.2) — and this is the control that opens the filter panel on
|
|
32
|
+
* every console list page.
|
|
33
|
+
*
|
|
34
|
+
* The name describes the ACTION and Radix's `aria-expanded` carries the state,
|
|
35
|
+
* so the two halves do not repeat each other. English defaults because no
|
|
36
|
+
* consumer passes a label today; a translated console overrides both.
|
|
37
|
+
*/
|
|
38
|
+
function EntityBoxCollapsibleTrigger({ expandLabel = 'Expand', collapseLabel = 'Collapse', 'aria-label': ariaLabel, ...props }) {
|
|
39
|
+
const open = React.useContext(EntityBoxCollapsibleContext);
|
|
40
|
+
return (_jsx(CollapsibleTrigger, { ...props, asChild: true, children: _jsx(Button, { variant: "secondary", className: "h-[34px] w-[34px] p-2", "aria-label": ariaLabel ?? (open ? collapseLabel : expandLabel), children: _jsx(Settings2, { size: 16, "aria-hidden": true }) }) }));
|
|
16
41
|
}
|
|
17
42
|
function EntityBoxCollapsibleContent({ children, ...props }) {
|
|
18
43
|
return (_jsxs(CollapsibleContent, { ...props, children: [_jsx(Separator, { orientation: "horizontal" }), _jsx("div", { className: "grid w-full grid-cols-3 p-6", children: children })] }));
|
|
19
44
|
}
|
|
20
45
|
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-
|
|
46
|
+
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-muted-foreground h-5 w-5" }) }), _jsx(TooltipContent, { side: "right", style: tooltipWidth
|
|
22
47
|
? { width: tooltipWidth, maxWidth: tooltipWidth }
|
|
23
48
|
: undefined, children: tooltip })] }) }))] }), subtitle && _jsx("p", { className: "text-muted-foreground text-sm", children: subtitle })] }));
|
|
24
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/entity-data-table/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,iBAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,qBAEpC;AAED,iBAAS,qBAAqB,CAAC,EAC7B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAW7B;AAED,iBAAS,yBAAyB,CAAC,EACjC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/entity-data-table/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,iBAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,qBAEpC;AAED,iBAAS,qBAAqB,CAAC,EAC7B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAW7B;AAED,iBAAS,yBAAyB,CAAC,EACjC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,qBAW3B;AAED,MAAM,MAAM,+BAA+B,GAAG,KAAK,CAAC,iBAAiB,GAAG;IACtE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,eAAe;;;;CAI3B,CAAA"}
|
|
@@ -8,7 +8,7 @@ function EntityDataTableFooter({ className, ...props }) {
|
|
|
8
8
|
return (_jsx("div", { "data-slot": "data-table-footer", className: cn('flex flex-row items-center justify-between px-6 py-3', className), ...props }));
|
|
9
9
|
}
|
|
10
10
|
function EntityDataTableFooterText({ className, ...props }) {
|
|
11
|
-
return (_jsx("p", { "data-slot": "data-table-footer-text", className: cn('text-
|
|
11
|
+
return (_jsx("p", { "data-slot": "data-table-footer-text", className: cn('text-muted-foreground text-sm leading-8 italic', className), ...props }));
|
|
12
12
|
}
|
|
13
13
|
export const EntityDataTable = {
|
|
14
14
|
Root: EntityDataTableRoot,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { Control, FieldPathByValue, FieldValues } from 'react-hook-form';
|
|
3
|
-
import { type FileUploadResult } from '../../../components/ui/file-upload/index.js';
|
|
3
|
+
import { type FileUploadError, type FileUploadLabels, type FileUploadResult } from '../../../components/ui/file-upload/index.js';
|
|
4
4
|
import { type RenderableLabel } from '../../../components/form/renderable-label.js';
|
|
5
5
|
type FileUploadFieldOwnProps<T extends FieldValues = FieldValues> = {
|
|
6
6
|
control: Control<T>;
|
|
@@ -17,6 +17,15 @@ type FileUploadFieldOwnProps<T extends FieldValues = FieldValues> = {
|
|
|
17
17
|
maxSizeBytes?: number;
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Override the picker's user-visible copy. Threaded straight to FileUpload;
|
|
22
|
+
* omitted fields keep the English defaults. Note `labels.error` governs the
|
|
23
|
+
* PICKER's own size/type/read refusal only — resolver messages still come
|
|
24
|
+
* from the schema through FormMessage.
|
|
25
|
+
*/
|
|
26
|
+
labels?: FileUploadLabels;
|
|
27
|
+
/** Observe size, type, and read failures after the form value is cleared. */
|
|
28
|
+
onError?: (error: FileUploadError) => void;
|
|
20
29
|
/** Optional escape hatch to also observe the picked File/clear alongside the form's text value. */
|
|
21
30
|
onSelect?: (result: FileUploadResult | null) => void;
|
|
22
31
|
};
|
|
@@ -47,6 +56,6 @@ export type FileUploadFieldProps<T extends FieldValues = FieldValues> = FileUplo
|
|
|
47
56
|
* rejection; on resolver failure the FormMessage announces. Both surfaces are
|
|
48
57
|
* wired.
|
|
49
58
|
*/
|
|
50
|
-
export declare const FileUploadField: <T extends FieldValues = FieldValues>({ control, name, label, description, tooltip, required, accept, maxSizeBytes, disabled, className, onSelect, "aria-label": ariaLabelProp }: FileUploadFieldProps<T>) => import("react").JSX.Element;
|
|
59
|
+
export declare const FileUploadField: <T extends FieldValues = FieldValues>({ control, name, label, description, tooltip, required, accept, maxSizeBytes, disabled, className, labels, onError, onSelect, "aria-label": ariaLabelProp }: FileUploadFieldProps<T>) => import("react").JSX.Element;
|
|
51
60
|
export {};
|
|
52
61
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/file-upload-field/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAWxE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/file-upload-field/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAWxE,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,oCAAoC,CAAA;AAE3C,KAAK,uBAAuB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI;IAClE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IACnB;;;;OAIG;IACH,IAAI,EAAE,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IAC7C,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAA;IACzB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAA;IAC1C,mGAAmG;IACnG,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,CAAA;CACrD,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAClE,uBAAuB,CAAC,CAAC,CAAC,GACxB,CACI;IAAE,KAAK,EAAE,eAAe,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAC1C,CAAA;AAEL;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,6JAelE,oBAAoB,CAAC,CAAC,CAAC,gCAoFzB,CAAA"}
|
|
@@ -19,7 +19,7 @@ import { hasRenderableLabel } from '../../../components/form/renderable-label.js
|
|
|
19
19
|
* rejection; on resolver failure the FormMessage announces. Both surfaces are
|
|
20
20
|
* wired.
|
|
21
21
|
*/
|
|
22
|
-
export const FileUploadField = ({ control, name, label, description, tooltip, required, accept, maxSizeBytes, disabled, className, onSelect, 'aria-label': ariaLabelProp }) => {
|
|
22
|
+
export const FileUploadField = ({ control, name, label, description, tooltip, required, accept, maxSizeBytes, disabled, className, labels, onError, onSelect, 'aria-label': ariaLabelProp }) => {
|
|
23
23
|
const [localValue, setLocalValue] = useState(null);
|
|
24
24
|
const showLabel = hasRenderableLabel(label);
|
|
25
25
|
// An empty or whitespace-only aria-label is worse than none: it names the
|
|
@@ -51,10 +51,15 @@ export const FileUploadField = ({ control, name, label, description, tooltip, re
|
|
|
51
51
|
// value carries nothing else to tell them apart. Fix needs a reset epoch
|
|
52
52
|
// from react-hook-form, or a form value richer than the file text.
|
|
53
53
|
const shown = localValue && field.value === localValue.text ? localValue : null;
|
|
54
|
-
return (_jsxs(FormItem, { required: required, children: [showLabel && (_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : undefined, children: label })), _jsx(FormControl, { children: _jsx(FileUpload, { ref: field.ref, name: field.name, onBlur: field.onBlur, "aria-label": ariaLabel, accept: accept, maxSizeBytes: maxSizeBytes, disabled: disabled, className: className, value: shown, onSelect: (result) => {
|
|
54
|
+
return (_jsxs(FormItem, { required: required, children: [showLabel && (_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : undefined, children: label })), _jsx(FormControl, { children: _jsx(FileUpload, { ref: field.ref, name: field.name, onBlur: field.onBlur, "aria-label": ariaLabel, labels: labels, accept: accept, maxSizeBytes: maxSizeBytes, disabled: disabled, className: className, value: shown, onSelect: (result) => {
|
|
55
55
|
setLocalValue(result);
|
|
56
56
|
field.onChange(result?.text ?? '');
|
|
57
57
|
onSelect?.(result);
|
|
58
|
-
}, onError: () =>
|
|
58
|
+
}, onError: (error) => {
|
|
59
|
+
setLocalValue(null);
|
|
60
|
+
field.onChange('');
|
|
61
|
+
onSelect?.(null);
|
|
62
|
+
onError?.(error);
|
|
63
|
+
} }) }), _jsx(FormMessage, {}), description && _jsx(FormDescription, { children: description })] }));
|
|
59
64
|
} }));
|
|
60
65
|
};
|
|
@@ -1,9 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type InputRef } from '../../../components/ui/input/index.js';
|
|
2
|
+
import { HTMLInputTypeAttribute, ReactNode, Ref } from 'react';
|
|
2
3
|
import { Control, FieldValues } from 'react-hook-form';
|
|
3
4
|
export type InputFieldProps<T extends FieldValues = FieldValues> = {
|
|
4
5
|
className?: string;
|
|
5
6
|
name: string;
|
|
6
7
|
type?: HTMLInputTypeAttribute;
|
|
8
|
+
/**
|
|
9
|
+
* Announce the field's own invalidity. Reaches the rendered control on BOTH
|
|
10
|
+
* branches, so a field with no `control` — and therefore no react-hook-form
|
|
11
|
+
* error state — can still tell a screen reader it is invalid.
|
|
12
|
+
*
|
|
13
|
+
* ORed with the form's error, never overriding it: `false` here cannot
|
|
14
|
+
* suppress a live resolver error. Nobody asked to mute a real validation
|
|
15
|
+
* failure, and on a financial console a muted one is a wrong number reaching
|
|
16
|
+
* a money path.
|
|
17
|
+
*
|
|
18
|
+
* TypeScript exempts hyphenated JSX attributes from excess-property
|
|
19
|
+
* checking, so passing this used to compile and then vanish.
|
|
20
|
+
*/
|
|
21
|
+
'aria-invalid'?: boolean;
|
|
22
|
+
/** Lower bound, forwarded to the single-line control on both branches. */
|
|
23
|
+
min?: number | string;
|
|
24
|
+
/** Upper bound, forwarded to the single-line control on both branches. */
|
|
25
|
+
max?: number | string;
|
|
26
|
+
/** Increment, forwarded to the single-line control on both branches. */
|
|
27
|
+
step?: number | string;
|
|
28
|
+
/** Character ceiling, forwarded on both branches (single-line and textarea). */
|
|
29
|
+
maxLength?: number;
|
|
30
|
+
/** Browser autofill hint. `"off"` is the one a money field usually wants. */
|
|
31
|
+
autoComplete?: React.HTMLInputAutoCompleteAttribute;
|
|
32
|
+
/** Virtual-keyboard hint, e.g. `"numeric"` or `"decimal"`. Both branches. */
|
|
33
|
+
inputMode?: React.HTMLAttributes<HTMLElement>['inputMode'];
|
|
34
|
+
/** Native validation regex. Single-line only — a textarea has no `pattern`. */
|
|
35
|
+
pattern?: string;
|
|
36
|
+
/** Focus the control on mount. React focuses the node rather than emitting an attribute. */
|
|
37
|
+
autoFocus?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Imperative handle on the rendered control: `focus()`/`blur()` on the
|
|
40
|
+
* single-line branch, the textarea node on the `textArea` branch (which
|
|
41
|
+
* satisfies the same shape). COMPOSED with react-hook-form's own ref when
|
|
42
|
+
* `control` is present, never replacing it — the form keeps the node it
|
|
43
|
+
* needs for `shouldFocusError`.
|
|
44
|
+
*/
|
|
45
|
+
ref?: Ref<InputRef>;
|
|
7
46
|
label?: ReactNode;
|
|
8
47
|
tooltip?: string;
|
|
9
48
|
labelExtra?: ReactNode;
|
|
@@ -32,5 +71,5 @@ export type InputFieldProps<T extends FieldValues = FieldValues> = {
|
|
|
32
71
|
'data-testid'?: string;
|
|
33
72
|
onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
34
73
|
};
|
|
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;
|
|
74
|
+
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, min, max, step, maxLength, autoComplete, inputMode, pattern, autoFocus, ref, "aria-invalid": ariaInvalid, ...others }: InputFieldProps<T>) => import("react").JSX.Element;
|
|
36
75
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/input-field/index.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,GAAG,EAAmB,MAAM,OAAO,CAAA;AAC/E,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;;;;;;;;;;;;OAYG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,0EAA0E;IAC1E,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,0EAA0E;IAC1E,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,KAAK,CAAC,8BAA8B,CAAA;IACnD,6EAA6E;IAC7E,SAAS,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,CAAA;IAC1D,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAA;IACnB,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;AA4CD,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,iTA6B7D,eAAe,CAAC,CAAC,CAAC,gCAyHpB,CAAA"}
|
|
@@ -2,8 +2,59 @@ 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
|
-
|
|
6
|
-
|
|
5
|
+
import { useMemo, useRef } from 'react';
|
|
6
|
+
/**
|
|
7
|
+
* Fan one node out to several refs. React hands a node to ONE ref, so a
|
|
8
|
+
* consumer ref and react-hook-form's `field.ref` cannot both be passed
|
|
9
|
+
* directly — one silently wins. Only used when the consumer actually supplied
|
|
10
|
+
* a ref, so a field without one keeps `field.ref`'s own identity and React
|
|
11
|
+
* never re-attaches it.
|
|
12
|
+
*/
|
|
13
|
+
function fanOutRef(...refs) {
|
|
14
|
+
return (node) => {
|
|
15
|
+
const cleanups = [];
|
|
16
|
+
for (const ref of refs) {
|
|
17
|
+
if (typeof ref === 'function') {
|
|
18
|
+
const cleanup = ref(node);
|
|
19
|
+
cleanups.push(typeof cleanup === 'function' ? cleanup : () => ref(null));
|
|
20
|
+
}
|
|
21
|
+
else if (ref) {
|
|
22
|
+
;
|
|
23
|
+
ref.current = node;
|
|
24
|
+
cleanups.push(() => {
|
|
25
|
+
;
|
|
26
|
+
ref.current = null;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return () => cleanups.forEach((cleanup) => cleanup());
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export const InputField = ({ className, type, label, tooltip, labelExtra, placeholder, description, startAdornment, endAdornment, required, readOnly, minHeight, maxHeight, textArea, defaultValue, value, onChange, min, max, step, maxLength, autoComplete, inputMode, pattern, autoFocus, ref, 'aria-invalid': ariaInvalid, ...others }) => {
|
|
34
|
+
// OR with the form's error, expressed through the Slot merge rather than by
|
|
35
|
+
// reading the form: FormControl already injects `aria-invalid={!!error}`, and
|
|
36
|
+
// a child prop only wins that merge when the KEY is present. So emit the key
|
|
37
|
+
// only for an explicit `true`, and let FormControl answer for every other
|
|
38
|
+
// case. `true || error` is true; `false || error` is whatever the form says,
|
|
39
|
+
// which is the whole point — an explicit `false` cannot mute a live error.
|
|
40
|
+
// With no `control` there is no error to OR against, so FormControl injects
|
|
41
|
+
// `false` and today's behaviour is unchanged.
|
|
42
|
+
const ariaInvalidProp = ariaInvalid ? { 'aria-invalid': true } : undefined;
|
|
43
|
+
const formRef = useRef(undefined);
|
|
44
|
+
const composedRef = useMemo(() => ref ? fanOutRef((node) => formRef.current?.(node), ref) : ref,
|
|
45
|
+
// `others.name` belongs here, and leaving it out is not a lint nit.
|
|
46
|
+
// react-hook-form hands a fresh `field.ref` for every name, and that ref
|
|
47
|
+
// only receives the element when React reattaches, which it does only when
|
|
48
|
+
// this callback's identity changes. Memoised on `ref` alone, one identity
|
|
49
|
+
// survived a name change, the new field never got its element, and
|
|
50
|
+
// `form.setFocus(newName)` then found nothing to focus and said nothing.
|
|
51
|
+
[ref, others.name]);
|
|
52
|
+
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, maxLength: maxLength, autoComplete: autoComplete, inputMode: inputMode, autoFocus: autoFocus, "data-testid": others['data-testid'], ...ariaInvalidProp, ...binding })) : (_jsx(Input, { className: className, type: type, placeholder: placeholder, readOnly: readOnly, startAdornment: startAdornment, endAdornment: endAdornment,
|
|
53
|
+
// Bounds belong to the single-line control only: `min`/`max`/`step`
|
|
54
|
+
// mean nothing on a textarea and would render as invalid markup.
|
|
55
|
+
min: min, max: max, step: step, maxLength: maxLength, autoComplete: autoComplete, inputMode: inputMode,
|
|
56
|
+
// Single-line only: `<textarea pattern>` is not a thing.
|
|
57
|
+
pattern: pattern, autoFocus: autoFocus, "data-testid": others['data-testid'], ...ariaInvalidProp, ...binding })) }), _jsx(FormMessage, {}), description && _jsx(FormDescription, { children: description })] }));
|
|
7
58
|
if (!others.control) {
|
|
8
59
|
return renderItem({
|
|
9
60
|
name: others.name,
|
|
@@ -11,7 +62,10 @@ export const InputField = ({ className, type, label, tooltip, labelExtra, placeh
|
|
|
11
62
|
// Controlled when the caller holds the value, uncontrolled when it only
|
|
12
63
|
// seeds one — supplying both is what React warns about.
|
|
13
64
|
...(value !== undefined ? { value } : { defaultValue }),
|
|
14
|
-
onChange: (e) => onChange?.(e)
|
|
65
|
+
onChange: (e) => onChange?.(e),
|
|
66
|
+
// Nothing else claims the node on this branch, so the consumer ref goes
|
|
67
|
+
// straight through. Without it there was no node to focus at all.
|
|
68
|
+
ref: ref
|
|
15
69
|
});
|
|
16
70
|
}
|
|
17
71
|
return (_jsx(FormField, { ...others, name: others.name,
|
|
@@ -19,16 +73,20 @@ export const InputField = ({ className, type, label, tooltip, labelExtra, placeh
|
|
|
19
73
|
// value painted on the box only makes the field LOOK filled while the
|
|
20
74
|
// form still submits nothing for that name. Controller seeds its own
|
|
21
75
|
// state from this, so `field.value` carries the seed on both branches.
|
|
22
|
-
defaultValue: defaultValue, render: ({ field }) =>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
field.
|
|
31
|
-
onChange
|
|
32
|
-
|
|
33
|
-
|
|
76
|
+
defaultValue: defaultValue, render: ({ field }) => {
|
|
77
|
+
formRef.current = field.ref;
|
|
78
|
+
return renderItem({
|
|
79
|
+
...field,
|
|
80
|
+
// Controlled from mount. react-hook-form hands `undefined` for any
|
|
81
|
+
// name the form declares no default for; React then mounts the box
|
|
82
|
+
// uncontrolled and flips it on the first keystroke, losing that
|
|
83
|
+
// character.
|
|
84
|
+
value: field.value ?? '',
|
|
85
|
+
onChange: (e) => {
|
|
86
|
+
field.onChange(e);
|
|
87
|
+
onChange?.(e);
|
|
88
|
+
},
|
|
89
|
+
ref: (ref ? composedRef : field.ref)
|
|
90
|
+
});
|
|
91
|
+
} }));
|
|
34
92
|
};
|
|
@@ -9,6 +9,10 @@ export type PasswordFieldProps<TFieldValues extends FieldValues = FieldValues, T
|
|
|
9
9
|
required?: boolean;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
'data-testid'?: string;
|
|
12
|
+
/** Accessible name of the eye button while the password is hidden. */
|
|
13
|
+
showPasswordLabel?: string;
|
|
14
|
+
/** Accessible name of the eye button while the password is showing. */
|
|
15
|
+
hidePasswordLabel?: string;
|
|
12
16
|
};
|
|
13
|
-
export declare function PasswordField<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, label, tooltip, placeholder, control, required, disabled, 'data-testid': dataTestId }: PasswordFieldProps<TFieldValues, TName>): React.JSX.Element;
|
|
17
|
+
export declare function PasswordField<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, label, tooltip, placeholder, control, required, disabled, 'data-testid': dataTestId, showPasswordLabel, hidePasswordLabel }: PasswordFieldProps<TFieldValues, TName>): React.JSX.Element;
|
|
14
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/password-field/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAajE,MAAM,MAAM,kBAAkB,CAC5B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,IAC7D;IACF,IAAI,EAAE,KAAK,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/password-field/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAajE,MAAM,MAAM,kBAAkB,CAC5B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,IAC7D;IACF,IAAI,EAAE,KAAK,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,sEAAsE;IACtE,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,uEAAuE;IACvE,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,wBAAgB,aAAa,CAC3B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EAC/D,EACA,IAAI,EACJ,KAAK,EACL,OAAO,EACP,WAAW,EACX,OAAO,EACP,QAAgB,EAChB,QAAgB,EAChB,aAAa,EAAE,UAAU,EACzB,iBAAmC,EACnC,iBAAmC,EACpC,EAAE,kBAAkB,CAAC,YAAY,EAAE,KAAK,CAAC,qBAuDzC"}
|
|
@@ -4,7 +4,7 @@ import { FormControl, FormField, FormItem, FormLabel, FormMessage, FormTooltip }
|
|
|
4
4
|
import { Input, InputAdornment } from '../../../components/ui/input/index.js';
|
|
5
5
|
import { Eye, EyeOff } from 'lucide-react';
|
|
6
6
|
import { IconButton } from '../../../components/ui/icon-button/index.js';
|
|
7
|
-
export function PasswordField({ name, label, tooltip, placeholder, control, required = false, disabled = false, 'data-testid': dataTestId }) {
|
|
7
|
+
export function PasswordField({ name, label, tooltip, placeholder, control, required = false, disabled = false, 'data-testid': dataTestId, showPasswordLabel = 'Show password', hidePasswordLabel = 'Hide password' }) {
|
|
8
8
|
const [show, setShow] = React.useState(false);
|
|
9
|
-
return (_jsx(FormField, { control: control, name: name, render: ({ field }) => (_jsxs(FormItem, { required: required, children: [_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : undefined, children: label }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: show ? 'text' : 'password', placeholder: placeholder, endAdornment: _jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { type: "button", variant: "outline", rounded: true, onClick: () => setShow(!show), children: show ? _jsx(EyeOff, {}) : _jsx(Eye, {}) }) }), disabled: disabled, className: "pr-10", "data-testid": dataTestId }) }), _jsx(FormMessage, {})] })) }));
|
|
9
|
+
return (_jsx(FormField, { control: control, name: name, render: ({ field }) => (_jsxs(FormItem, { required: required, children: [_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : undefined, children: label }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: show ? 'text' : 'password', placeholder: placeholder, endAdornment: _jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { type: "button", variant: "outline", rounded: true, "aria-label": show ? hidePasswordLabel : showPasswordLabel, onClick: () => setShow(!show), children: show ? _jsx(EyeOff, { "aria-hidden": true }) : _jsx(Eye, { "aria-hidden": true }) }) }), disabled: disabled, className: "pr-10", "data-testid": dataTestId }) }), _jsx(FormMessage, {})] })) }));
|
|
10
10
|
}
|
|
@@ -13,7 +13,15 @@ type SelectFieldSharedProps<T extends FieldValues = FieldValues> = PropsWithChil
|
|
|
13
13
|
* with `value` + `onChange`. */
|
|
14
14
|
control?: Control<T>;
|
|
15
15
|
required?: boolean;
|
|
16
|
+
/** Copy for the "nothing to pick" row. Defaults to "No options found." */
|
|
16
17
|
emptyMessage?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Placed on the field's own root box, merged with its spacing rather than
|
|
20
|
+
* replacing it. The root is the element a parent grid positions, so
|
|
21
|
+
* without this a consumer had to wrap the field in a spare div just to
|
|
22
|
+
* span a column.
|
|
23
|
+
*/
|
|
24
|
+
className?: string;
|
|
17
25
|
'data-testid'?: string;
|
|
18
26
|
};
|
|
19
27
|
/**
|
|
@@ -39,6 +47,6 @@ type SelectFieldModeProps = {
|
|
|
39
47
|
onChange?: (value: string) => void;
|
|
40
48
|
};
|
|
41
49
|
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;
|
|
50
|
+
export declare const SelectField: <T extends FieldValues = FieldValues>({ name, label, tooltip, labelExtra, required, placeholder, description, disabled, readOnly, multi, control, value, children, emptyMessage, className, onChange, ...others }: SelectFieldProps<T>) => React.JSX.Element;
|
|
43
51
|
export {};
|
|
44
52
|
//# sourceMappingURL=index.d.ts.map
|