@lerianstudio/sindarian-ui 2.0.0-beta.24 → 2.0.0-beta.26
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/charts/chart.js +4 -231
- package/dist/charts/index.js +1 -11
- package/dist/components/breadcrumb/get-breadcrumb-paths.js +1 -18
- package/dist/components/breadcrumb/index.js +1 -37
- package/dist/components/card/account-card/index.js +1 -69
- package/dist/components/card/basic-card/index.js +1 -20
- package/dist/components/card/dashboard-card/index.js +1 -20
- package/dist/components/card/entity-card/index.js +1 -68
- package/dist/components/card/index.js +1 -20
- package/dist/components/dialog/confirmation-dialog/index.d.ts.map +1 -1
- package/dist/components/dialog/confirmation-dialog/index.js +1 -96
- package/dist/components/dialog/confirmation-dialog/use-confirm-dialog.js +1 -55
- package/dist/components/dialog/index.js +1 -19
- package/dist/components/dialog/large-dialog/index.d.ts +2 -2
- package/dist/components/dialog/large-dialog/index.d.ts.map +1 -1
- package/dist/components/dialog/large-dialog/index.js +1 -21
- package/dist/components/entity-box/index.js +1 -67
- package/dist/components/entity-data-table/index.js +1 -20
- package/dist/components/form/combo-box-field/index.js +1 -35
- package/dist/components/form/country-field/index.js +1 -11
- package/dist/components/form/date-picker-field/index.js +1 -83
- package/dist/components/form/date-range-field/index.js +1 -58
- package/dist/components/form/date-time-picker-field/index.js +1 -114
- package/dist/components/form/file-upload-field/index.js +1 -69
- package/dist/components/form/index.js +1 -31
- package/dist/components/form/input-field/index.js +1 -96
- package/dist/components/form/otp-field/index.js +1 -19
- package/dist/components/form/pagination-limit-field/index.js +1 -10
- package/dist/components/form/password-field/index.d.ts.map +1 -1
- package/dist/components/form/password-field/index.js +1 -16
- package/dist/components/form/radio-group-field/index.js +1 -36
- package/dist/components/form/renderable-label.js +1 -57
- package/dist/components/form/select-field/index.js +1 -68
- package/dist/components/form/state-field/index.js +1 -42
- package/dist/components/form/switch-field/index.js +1 -16
- package/dist/components/form/textarea-field/index.js +1 -23
- package/dist/components/page/index.js +1 -20
- package/dist/components/page-header/index.js +1 -80
- package/dist/components/pagination/index.js +1 -10
- package/dist/components/table/id-table-cell.js +1 -109
- package/dist/components/table/index.js +1 -19
- package/dist/components/table/locked-table-actions.js +1 -41
- package/dist/components/table/name-table-cell.js +1 -58
- package/dist/components/ui/accordion/index.js +1 -62
- package/dist/components/ui/alert/index.js +1 -45
- package/dist/components/ui/alert-dialog/index.js +1 -84
- package/dist/components/ui/autocomplete/index.js +1 -440
- package/dist/components/ui/autosize-textarea/index.js +1 -89
- package/dist/components/ui/avatar/index.js +1 -51
- package/dist/components/ui/badge/index.js +1 -83
- package/dist/components/ui/breadcrumb/index.js +1 -35
- package/dist/components/ui/button/index.js +1 -65
- package/dist/components/ui/button/styles.css +2 -1
- package/dist/components/ui/calendar/index.js +1 -118
- package/dist/components/ui/card/index.js +1 -32
- package/dist/components/ui/checkbox/index.js +1 -44
- package/dist/components/ui/collapsible/index.js +1 -50
- package/dist/components/ui/command/index.js +1 -95
- package/dist/components/ui/copy-field/index.js +1 -163
- package/dist/components/ui/dialog/index.d.ts +4 -1
- package/dist/components/ui/dialog/index.d.ts.map +1 -1
- package/dist/components/ui/dialog/index.js +1 -80
- package/dist/components/ui/dialog/styles.css +2 -1
- package/dist/components/ui/dropdown-menu/index.js +1 -110
- package/dist/components/ui/field/index.js +1 -82
- package/dist/components/ui/file-upload/index.js +1 -574
- package/dist/components/ui/form.js +1 -162
- package/dist/components/ui/hover-card/index.js +1 -51
- package/dist/components/ui/icon-button/index.js +1 -35
- package/dist/components/ui/input/adornment.js +1 -21
- package/dist/components/ui/input/index.js +1 -99
- package/dist/components/ui/input/styles.css +29 -12
- package/dist/components/ui/label/index.js +1 -45
- package/dist/components/ui/lerian-wordmark/index.js +1 -7
- package/dist/components/ui/loading-button/index.js +1 -9
- package/dist/components/ui/multiple-select/index.js +1 -235
- package/dist/components/ui/otp-input/index.js +1 -62
- package/dist/components/ui/paper/index.js +1 -8
- package/dist/components/ui/paper-collapsible/index.js +1 -24
- package/dist/components/ui/popover/index.js +1 -55
- package/dist/components/ui/progress/index.js +1 -66
- package/dist/components/ui/qr-code/index.js +1 -27
- package/dist/components/ui/radio-group/index.js +1 -48
- package/dist/components/ui/scroll-area/index.js +1 -49
- package/dist/components/ui/select/index.js +1 -119
- package/dist/components/ui/select/styles.css +6 -3
- package/dist/components/ui/separator/index.js +1 -43
- package/dist/components/ui/sheet/index.d.ts +7 -2
- package/dist/components/ui/sheet/index.d.ts.map +1 -1
- package/dist/components/ui/sheet/index.js +1 -136
- package/dist/components/ui/sidebar/index.js +1 -27
- package/dist/components/ui/sidebar/next-router.cjs +1 -119
- package/dist/components/ui/sidebar/sidebar-back-button.js +1 -8
- package/dist/components/ui/sidebar/sidebar-components.js +1 -23
- package/dist/components/ui/sidebar/sidebar-expand-button.js +1 -49
- package/dist/components/ui/sidebar/sidebar-item-button.js +1 -21
- package/dist/components/ui/sidebar/sidebar-item-collapsible.js +1 -52
- package/dist/components/ui/sidebar/sidebar-item-icon-button.js +1 -18
- package/dist/components/ui/sidebar/sidebar-item.js +1 -44
- package/dist/components/ui/sidebar/sidebar-provider.js +1 -201
- package/dist/components/ui/sidebar/sidebar-root.d.ts +3 -1
- package/dist/components/ui/sidebar/sidebar-root.d.ts.map +1 -1
- package/dist/components/ui/sidebar/sidebar-root.js +1 -130
- package/dist/components/ui/sidebar/sidebar-router.js +1 -126
- package/dist/components/ui/sidebar/sidebar-trigger.js +1 -57
- package/dist/components/ui/skeleton/index.js +1 -8
- package/dist/components/ui/stepper/index.js +1 -29
- package/dist/components/ui/switch/index.js +1 -43
- package/dist/components/ui/table/index.js +1 -56
- package/dist/components/ui/tabs/index.js +1 -55
- package/dist/components/ui/textarea/index.js +1 -8
- package/dist/components/ui/time-picker/index.js +1 -85
- package/dist/components/ui/toast/index.js +1 -3
- package/dist/components/ui/toast/toaster.js +1 -16
- package/dist/components/ui/toggle-group/index.js +1 -156
- package/dist/components/ui/tooltip/index.js +1 -81
- package/dist/domain/blotter/index.js +1 -20
- package/dist/domain/delinquency-aging/aging-buckets.js +1 -120
- package/dist/domain/delinquency-aging/index.js +1 -222
- package/dist/domain/figure/index.js +1 -19
- package/dist/domain/format.js +1 -137
- package/dist/domain/index.js +1 -43
- package/dist/domain/key-id/index.js +1 -174
- package/dist/domain/ledger-sheet/index.js +1 -28
- package/dist/domain/money-diff.js +1 -48
- package/dist/domain/money-math.js +1 -104
- package/dist/domain/money-text/index.js +1 -123
- package/dist/domain/section-label/index.js +1 -17
- package/dist/domain/status-rail/index.js +1 -76
- package/dist/domain/threshold-gauge/index.js +1 -161
- package/dist/enterprise/alert-banner/index.js +1 -24
- package/dist/enterprise/app-shell/index.js +1 -87
- package/dist/enterprise/cursor-pager/index.js +1 -26
- package/dist/enterprise/data-table/column-size.js +1 -103
- package/dist/enterprise/data-table/index.d.ts.map +1 -1
- package/dist/enterprise/data-table/index.js +1 -345
- package/dist/enterprise/date-range-picker/index.js +1 -115
- package/dist/enterprise/detail-panel/index.js +1 -20
- package/dist/enterprise/empty-state/index.d.ts +6 -1
- package/dist/enterprise/empty-state/index.d.ts.map +1 -1
- package/dist/enterprise/empty-state/index.js +1 -13
- package/dist/enterprise/index.js +1 -39
- package/dist/enterprise/number-input/index.js +1 -252
- package/dist/enterprise/search-input/index.js +1 -121
- package/dist/enterprise/stat-card/index.js +1 -75
- package/dist/enterprise/status-badge/index.js +1 -120
- package/dist/enterprise/use-is-mobile.js +1 -68
- package/dist/enterprise/virtualized-table/index.js +1 -141
- package/dist/esm/charts/chart.js +4 -190
- package/dist/esm/charts/index.js +1 -3
- package/dist/esm/components/breadcrumb/get-breadcrumb-paths.js +1 -12
- package/dist/esm/components/breadcrumb/index.js +1 -30
- package/dist/esm/components/card/account-card/index.js +1 -53
- package/dist/esm/components/card/basic-card/index.js +1 -14
- package/dist/esm/components/card/dashboard-card/index.js +1 -14
- package/dist/esm/components/card/entity-card/index.js +1 -52
- package/dist/esm/components/card/index.js +1 -4
- package/dist/esm/components/dialog/confirmation-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/dialog/confirmation-dialog/index.js +1 -60
- package/dist/esm/components/dialog/confirmation-dialog/use-confirm-dialog.js +1 -49
- package/dist/esm/components/dialog/index.js +1 -3
- package/dist/esm/components/dialog/large-dialog/index.d.ts +2 -2
- package/dist/esm/components/dialog/large-dialog/index.d.ts.map +1 -1
- package/dist/esm/components/dialog/large-dialog/index.js +1 -16
- package/dist/esm/components/entity-box/index.js +1 -56
- package/dist/esm/components/entity-data-table/index.js +1 -17
- package/dist/esm/components/form/combo-box-field/index.js +1 -28
- package/dist/esm/components/form/country-field/index.js +1 -7
- package/dist/esm/components/form/date-picker-field/index.js +1 -43
- package/dist/esm/components/form/date-range-field/index.js +1 -18
- package/dist/esm/components/form/date-time-picker-field/index.js +1 -74
- package/dist/esm/components/form/file-upload-field/index.js +1 -65
- package/dist/esm/components/form/index.js +1 -15
- package/dist/esm/components/form/input-field/index.js +1 -92
- package/dist/esm/components/form/otp-field/index.js +1 -15
- package/dist/esm/components/form/pagination-limit-field/index.js +1 -6
- package/dist/esm/components/form/password-field/index.d.ts.map +1 -1
- package/dist/esm/components/form/password-field/index.js +1 -10
- package/dist/esm/components/form/radio-group-field/index.js +1 -32
- package/dist/esm/components/form/renderable-label.js +1 -54
- package/dist/esm/components/form/select-field/index.js +1 -64
- package/dist/esm/components/form/state-field/index.js +1 -35
- package/dist/esm/components/form/switch-field/index.js +1 -12
- package/dist/esm/components/form/textarea-field/index.js +1 -19
- package/dist/esm/components/page/index.js +1 -15
- package/dist/esm/components/page-header/index.js +1 -71
- package/dist/esm/components/pagination/index.js +1 -6
- package/dist/esm/components/table/id-table-cell.js +1 -105
- package/dist/esm/components/table/index.js +1 -3
- package/dist/esm/components/table/locked-table-actions.js +1 -37
- package/dist/esm/components/table/name-table-cell.js +1 -54
- package/dist/esm/components/ui/accordion/index.js +1 -24
- package/dist/esm/components/ui/alert/index.js +1 -38
- package/dist/esm/components/ui/alert-dialog/index.js +1 -39
- package/dist/esm/components/ui/autocomplete/index.js +1 -392
- package/dist/esm/components/ui/autosize-textarea/index.js +1 -51
- package/dist/esm/components/ui/avatar/index.js +1 -14
- package/dist/esm/components/ui/badge/index.js +1 -79
- package/dist/esm/components/ui/breadcrumb/index.js +1 -27
- package/dist/esm/components/ui/button/index.js +1 -60
- package/dist/esm/components/ui/calendar/index.js +1 -82
- package/dist/esm/components/ui/card/index.js +1 -24
- package/dist/esm/components/ui/checkbox/index.js +1 -9
- package/dist/esm/components/ui/collapsible/index.js +1 -13
- package/dist/esm/components/ui/command/index.js +1 -51
- package/dist/esm/components/ui/copy-field/index.js +1 -127
- package/dist/esm/components/ui/dialog/index.d.ts +4 -1
- package/dist/esm/components/ui/dialog/index.d.ts.map +1 -1
- package/dist/esm/components/ui/dialog/index.js +1 -36
- package/dist/esm/components/ui/dropdown-menu/index.js +1 -60
- package/dist/esm/components/ui/field/index.js +1 -71
- package/dist/esm/components/ui/file-upload/index.js +1 -536
- package/dist/esm/components/ui/form.js +1 -118
- package/dist/esm/components/ui/hover-card/index.js +1 -14
- package/dist/esm/components/ui/icon-button/index.js +1 -31
- package/dist/esm/components/ui/input/adornment.js +1 -17
- package/dist/esm/components/ui/input/index.js +1 -60
- package/dist/esm/components/ui/label/index.js +1 -10
- package/dist/esm/components/ui/lerian-wordmark/index.js +1 -4
- package/dist/esm/components/ui/loading-button/index.js +1 -7
- package/dist/esm/components/ui/multiple-select/index.js +1 -196
- package/dist/esm/components/ui/otp-input/index.js +1 -21
- package/dist/esm/components/ui/paper/index.js +1 -5
- package/dist/esm/components/ui/paper-collapsible/index.js +1 -19
- package/dist/esm/components/ui/popover/index.js +1 -17
- package/dist/esm/components/ui/progress/index.js +1 -31
- package/dist/esm/components/ui/qr-code/index.js +1 -24
- package/dist/esm/components/ui/radio-group/index.js +1 -12
- package/dist/esm/components/ui/scroll-area/index.js +1 -13
- package/dist/esm/components/ui/select/index.js +1 -74
- package/dist/esm/components/ui/separator/index.js +1 -8
- package/dist/esm/components/ui/sheet/index.d.ts +7 -2
- package/dist/esm/components/ui/sheet/index.d.ts.map +1 -1
- package/dist/esm/components/ui/sheet/index.js +1 -92
- package/dist/esm/components/ui/sidebar/index.js +1 -11
- package/dist/esm/components/ui/sidebar/next-router.cjs +1 -119
- package/dist/esm/components/ui/sidebar/sidebar-back-button.js +1 -5
- package/dist/esm/components/ui/sidebar/sidebar-components.js +1 -15
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.js +1 -42
- package/dist/esm/components/ui/sidebar/sidebar-item-button.js +1 -18
- package/dist/esm/components/ui/sidebar/sidebar-item-collapsible.js +1 -44
- package/dist/esm/components/ui/sidebar/sidebar-item-icon-button.js +1 -14
- package/dist/esm/components/ui/sidebar/sidebar-item.js +1 -40
- package/dist/esm/components/ui/sidebar/sidebar-provider.js +1 -193
- package/dist/esm/components/ui/sidebar/sidebar-root.d.ts +3 -1
- package/dist/esm/components/ui/sidebar/sidebar-root.d.ts.map +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-root.js +1 -126
- package/dist/esm/components/ui/sidebar/sidebar-router.js +1 -89
- package/dist/esm/components/ui/sidebar/sidebar-trigger.js +1 -53
- package/dist/esm/components/ui/skeleton/index.js +1 -6
- package/dist/esm/components/ui/stepper/index.js +1 -20
- package/dist/esm/components/ui/switch/index.js +1 -8
- package/dist/esm/components/ui/table/index.js +1 -44
- package/dist/esm/components/ui/tabs/index.js +1 -17
- package/dist/esm/components/ui/textarea/index.js +1 -6
- package/dist/esm/components/ui/time-picker/index.js +1 -49
- package/dist/esm/components/ui/toast/index.js +1 -2
- package/dist/esm/components/ui/toast/toaster.js +1 -13
- package/dist/esm/components/ui/toggle-group/index.js +1 -120
- package/dist/esm/components/ui/tooltip/index.js +1 -43
- package/dist/esm/domain/blotter/index.js +1 -16
- package/dist/esm/domain/delinquency-aging/aging-buckets.js +1 -115
- package/dist/esm/domain/delinquency-aging/index.js +1 -218
- package/dist/esm/domain/figure/index.js +1 -15
- package/dist/esm/domain/format.js +1 -128
- package/dist/esm/domain/index.js +1 -19
- package/dist/esm/domain/key-id/index.js +1 -169
- package/dist/esm/domain/ledger-sheet/index.js +1 -24
- package/dist/esm/domain/money-diff.js +1 -45
- package/dist/esm/domain/money-math.js +1 -98
- package/dist/esm/domain/money-text/index.js +1 -118
- package/dist/esm/domain/section-label/index.js +1 -14
- package/dist/esm/domain/status-rail/index.js +1 -71
- package/dist/esm/domain/threshold-gauge/index.js +1 -157
- package/dist/esm/enterprise/alert-banner/index.js +1 -21
- package/dist/esm/enterprise/app-shell/index.js +1 -51
- package/dist/esm/enterprise/cursor-pager/index.js +1 -23
- package/dist/esm/enterprise/data-table/column-size.js +1 -97
- package/dist/esm/enterprise/data-table/index.d.ts.map +1 -1
- package/dist/esm/enterprise/data-table/index.js +1 -342
- package/dist/esm/enterprise/date-range-picker/index.js +1 -112
- package/dist/esm/enterprise/detail-panel/index.js +1 -17
- package/dist/esm/enterprise/empty-state/index.d.ts +6 -1
- package/dist/esm/enterprise/empty-state/index.d.ts.map +1 -1
- package/dist/esm/enterprise/empty-state/index.js +1 -10
- package/dist/esm/enterprise/index.js +1 -22
- package/dist/esm/enterprise/number-input/index.js +1 -214
- package/dist/esm/enterprise/search-input/index.js +1 -85
- package/dist/esm/enterprise/stat-card/index.js +1 -72
- package/dist/esm/enterprise/status-badge/index.js +1 -116
- package/dist/esm/enterprise/use-is-mobile.js +1 -31
- package/dist/esm/enterprise/virtualized-table/index.js +1 -138
- package/dist/esm/hooks/use-click-away.js +1 -22
- package/dist/esm/hooks/use-pagination.js +1 -38
- package/dist/esm/hooks/use-stepper.js +1 -22
- package/dist/esm/hooks/use-time.js +1 -13
- package/dist/esm/hooks/use-toast.js +1 -107
- package/dist/esm/index.js +1 -77
- package/dist/esm/lib/storage/get-storage-object.js +1 -17
- package/dist/esm/lib/storage/get-storage.js +1 -14
- package/dist/esm/lib/storage/index.js +1 -2
- package/dist/esm/lib/typography.js +1 -31
- package/dist/esm/lib/utils.js +1 -41
- package/dist/esm/theme/get-theme-script.js +1 -41
- package/dist/esm/theme/index.js +1 -4
- package/dist/esm/theme/mode-toggle.js +1 -45
- package/dist/esm/theme/theme-provider.js +1 -122
- package/dist/esm/toast/helpers.js +1 -36
- package/dist/esm/toast/index.js +1 -4
- package/dist/esm/types/metadata-type.js +1 -1
- package/dist/esm/utils/countries.cjs +1 -17
- package/dist/esm/utils/country-utils.js +1 -18
- package/dist/esm/utils/currency-codes.js +1 -181
- package/dist/globals.css +1 -0
- package/dist/hooks/use-click-away.js +1 -29
- package/dist/hooks/use-pagination.js +1 -41
- package/dist/hooks/use-stepper.js +1 -26
- package/dist/hooks/use-time.js +1 -20
- package/dist/hooks/use-toast.js +1 -111
- package/dist/index.js +1 -96
- package/dist/lib/storage/get-storage-object.js +1 -23
- package/dist/lib/storage/get-storage.js +1 -17
- package/dist/lib/storage/index.js +1 -18
- package/dist/lib/typography.js +1 -34
- package/dist/lib/utils.js +1 -45
- package/dist/theme/get-theme-script.js +1 -44
- package/dist/theme/index.js +1 -11
- package/dist/theme/mode-toggle.js +1 -48
- package/dist/theme/theme-provider.js +1 -160
- package/dist/toast/helpers.js +1 -41
- package/dist/toast/index.js +1 -10
- package/dist/tokens.css +7 -4
- package/dist/types/metadata-type.js +1 -2
- package/dist/utils/countries.cjs +1 -17
- package/dist/utils/country-utils.js +1 -25
- package/dist/utils/currency-codes.js +1 -184
- package/package.json +4 -3
|
@@ -1,53 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Collapsible } from '@radix-ui/react-collapsible';
|
|
4
|
-
import { cn } from '../../../lib/utils.js';
|
|
5
|
-
import { Card } from '../../../components/ui/card/index.js';
|
|
6
|
-
import { Button } from '../../../components/ui/button/index.js';
|
|
7
|
-
import { CheckCircle2, RefreshCw, Trash, User } from 'lucide-react';
|
|
8
|
-
import { CollapsibleContent, CollapsibleTrigger } from '../../../components/ui/collapsible/index.js';
|
|
9
|
-
import { Skeleton } from '../../../components/ui/skeleton/index.js';
|
|
10
|
-
import { useTime } from '../../../hooks/use-time.js';
|
|
11
|
-
import dayjs from 'dayjs';
|
|
12
|
-
import { IconButton } from '../../../components/ui/icon-button/index.js';
|
|
13
|
-
const AccountBalanceCardContext = React.createContext({
|
|
14
|
-
open: false
|
|
15
|
-
});
|
|
16
|
-
export function AccountBalanceCard({ className, open, onOpenChange, children, ...props }) {
|
|
17
|
-
return (_jsx(Collapsible, { open: open, onOpenChange: onOpenChange, "data-slot": "account-balance-card", className: cn('w-full', className), ...props, children: _jsx(AccountBalanceCardContext.Provider, { value: { open }, children: _jsx(Card, { className: "relative gap-2 px-5 py-4 shadow-xs", children: children }) }) }));
|
|
18
|
-
}
|
|
19
|
-
export function AccountBalanceCardIcon({ className, ...props }) {
|
|
20
|
-
return (_jsx(User, { "data-slot": "account-balance-card-icon", strokeWidth: 1, className: cn('text-foreground mb-[14px] size-8 opacity-40', className), ...props }));
|
|
21
|
-
}
|
|
22
|
-
export function AccountBalanceCardHeader({ className, ...props }) {
|
|
23
|
-
return (_jsx("div", { "data-slot": "account-balance-card-header", className: cn('flex flex-col', className), ...props }));
|
|
24
|
-
}
|
|
25
|
-
export function AccountBalanceCardTitle({ className, ...props }) {
|
|
26
|
-
return (_jsx("p", { "data-slot": "account-balance-card-title", className: cn('text-foreground text-lg font-bold', className), ...props }));
|
|
27
|
-
}
|
|
28
|
-
export function AccountBalanceCardDeleteButton({ className, ...props }) {
|
|
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" }) }));
|
|
30
|
-
}
|
|
31
|
-
export function AccountBalanceCardContent({ className, ...props }) {
|
|
32
|
-
return (_jsx(CollapsibleContent, { "data-slot": "account-balance-card-content", className: cn('motion-safe:data-[state=closed]:animate-accordion-up motion-safe:data-[state=open]:animate-accordion-down overflow-hidden', className), ...props }));
|
|
33
|
-
}
|
|
34
|
-
export function AccountBalanceCardLoading({ className, ...props }) {
|
|
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
|
-
}
|
|
37
|
-
export function AccountBalanceCardEmpty({ className, ...props }) {
|
|
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
|
-
}
|
|
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-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
|
-
}
|
|
43
|
-
export function AccountBalanceCardUpdateButton({ className: _className, loading, timestamp, loadingLabel = 'Updating...', updatedInLabel = 'Updated in', updatedLabel = 'Updated', onRefresh, children: _children, ref, ...props }) {
|
|
44
|
-
const _time = useTime({ interval: 1000 * 60 });
|
|
45
|
-
const updated = React.useMemo(() => {
|
|
46
|
-
return !dayjs(timestamp).isBefore(dayjs().subtract(1, 'minute'));
|
|
47
|
-
}, [_time, timestamp]);
|
|
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
|
-
}
|
|
50
|
-
export function AccountBalanceCardTrigger({ className, openLabel, closeLabel, children: _children, ...props }) {
|
|
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-muted-foreground h-4 p-0 text-xs', className), ...props, children: !open ? openLabel : closeLabel }) }));
|
|
53
|
-
}
|
|
1
|
+
import{jsx as a,jsxs as d}from"react/jsx-runtime";import i from"react";import{Collapsible as b}from"@radix-ui/react-collapsible";import{cn as n}from"../../../lib/utils.js";import{Card as N}from"../../../components/ui/card/index.js";import{Button as u}from"../../../components/ui/button/index.js";import{CheckCircle2 as B,RefreshCw as g,Trash as A,User as v}from"lucide-react";import{CollapsibleContent as w,CollapsibleTrigger as y}from"../../../components/ui/collapsible/index.js";import{Skeleton as j}from"../../../components/ui/skeleton/index.js";import{useTime as _}from"../../../hooks/use-time.js";import m from"dayjs";import{IconButton as k}from"../../../components/ui/icon-button/index.js";const f=i.createContext({open:false});export function AccountBalanceCard({className:t,open:e,onOpenChange:c,children:r,...o}){return a(b,{open:e,onOpenChange:c,"data-slot":"account-balance-card",className:n("w-full",t),...o,children:a(f.Provider,{value:{open:e},children:a(N,{className:"relative gap-2 px-5 py-4 shadow-xs",children:r})})})}export function AccountBalanceCardIcon({className:t,...e}){return a(v,{"data-slot":"account-balance-card-icon",strokeWidth:1,className:n("text-foreground mb-[14px] size-8 opacity-40",t),...e})}export function AccountBalanceCardHeader({className:t,...e}){return a("div",{"data-slot":"account-balance-card-header",className:n("flex flex-col",t),...e})}export function AccountBalanceCardTitle({className:t,...e}){return a("p",{"data-slot":"account-balance-card-title",className:n("text-foreground text-lg font-bold",t),...e})}export function AccountBalanceCardDeleteButton({className:t,...e}){return a(k,{variant:"outline",size:"small",rounded:true,"data-slot":"account-balance-card-delete-button",className:n("absolute top-3 right-3",t),...e,children:a(A,{className:"text-muted-foreground h-4 w-4"})})}export function AccountBalanceCardContent({className:t,...e}){return a(w,{"data-slot":"account-balance-card-content",className:n("motion-safe:data-[state=closed]:animate-accordion-up motion-safe:data-[state=open]:animate-accordion-down overflow-hidden",t),...e})}export function AccountBalanceCardLoading({className:t,...e}){return a(j,{"data-slot":"account-balance-card-loading",className:n("bg-muted mt-3 h-3 w-full rounded-md",t),...e})}export function AccountBalanceCardEmpty({className:t,...e}){return a("p",{"data-slot":"account-balance-card-empty",className:n("text-muted-foreground mt-3 text-center text-sm font-normal",t),...e})}export function AccountBalanceCardInfo({className:t,assetCode:e,value:c,children:r,ref:o,...l}){return d("div",{ref:o,"data-slot":"account-balance-card-info",className:n("text-muted-foreground mt-3 flex flex-row items-center justify-between text-sm font-normal",t),...l,children:[a("p",{children:e}),a("p",{children:c})]})}export function AccountBalanceCardUpdateButton({className:t,loading:e,timestamp:c,loadingLabel:r="Updating...",updatedInLabel:o="Updated in",updatedLabel:l="Updated",onRefresh:p,children:T,ref:x,...h}){const C=_({interval:1e3*60});const s=i.useMemo(()=>{return!m(c).isBefore(m().subtract(1,"minute"))},[C,c]);return d("div",{className:"mb-3 flex flex-row items-center justify-end gap-2",children:[d("p",{className:"text-muted-foreground text-xs font-medium",children:[e&&r,!e&&!s&&o,!e&&s&&l]}),!e&&s&&a(B,{className:"text-system-success-h1a h-4 w-4"}),(!s||e)&&a(u,{ref:x,variant:"link","data-slot":"account-balance-card-update-button",className:"h-3 p-0",onClick:p,disabled:e,...h,children:a(g,{className:n("size-4",{"motion-safe:animate-spin":e})})})]})}export function AccountBalanceCardTrigger({className:t,openLabel:e,closeLabel:c,children:r,...o}){const{open:l}=i.useContext(f);return a(y,{asChild:true,children:a(u,{variant:"link","data-slot":"account-balance-card-trigger",className:n("text-muted-foreground h-4 p-0 text-xs",t),...o,children:!l?e:c})})}
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { cn } from '../../../lib/utils.js';
|
|
3
|
-
export function BasicCard({ className, ...props }) {
|
|
4
|
-
return (_jsx("div", { className: cn('bg-card flex flex-col rounded-lg p-6', className), ...props }));
|
|
5
|
-
}
|
|
6
|
-
export function BasicCardTitle({ className, ...props }) {
|
|
7
|
-
return (_jsx("h2", { className: cn('text-foreground mb-4 text-sm font-medium', className), ...props }));
|
|
8
|
-
}
|
|
9
|
-
export function BasicCardContent({ className, ...props }) {
|
|
10
|
-
return (_jsx("div", { className: cn('text-muted-foreground mb-6 text-sm font-medium', className), ...props }));
|
|
11
|
-
}
|
|
12
|
-
export function BasicCardAction({ className, ...props }) {
|
|
13
|
-
return _jsx("div", { className: cn('flex flex-col', className), ...props });
|
|
14
|
-
}
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{cn as o}from"../../../lib/utils.js";export function BasicCard({className:t,...e}){return r("div",{className:o("bg-card flex flex-col rounded-lg p-6",t),...e})}export function BasicCardTitle({className:t,...e}){return r("h2",{className:o("text-foreground mb-4 text-sm font-medium",t),...e})}export function BasicCardContent({className:t,...e}){return r("div",{className:o("text-muted-foreground mb-6 text-sm font-medium",t),...e})}export function BasicCardAction({className:t,...e}){return r("div",{className:o("flex flex-col",t),...e})}
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { cn } from '../../../lib/utils.js';
|
|
3
|
-
export function DashboardCard({ className, ...props }) {
|
|
4
|
-
return (_jsx("div", { className: cn('bg-card relative flex flex-col rounded-lg p-6 pt-4', className), ...props }));
|
|
5
|
-
}
|
|
6
|
-
export function DashboardCardIcon({ className, ...props }) {
|
|
7
|
-
return (_jsx("div", { className: cn('text-muted-foreground absolute top-4 right-6 flex size-6 items-center justify-center [&>svg]:size-6', className), ...props }));
|
|
8
|
-
}
|
|
9
|
-
export function DashboardCardTitle({ className, ...props }) {
|
|
10
|
-
return (_jsx("h2", { className: cn('text-muted-foreground mb-4 text-sm font-medium uppercase', className), ...props }));
|
|
11
|
-
}
|
|
12
|
-
export function DashboardCardContent({ className, ...props }) {
|
|
13
|
-
return (_jsx("div", { className: cn('text-muted-foreground text-[32px] font-extrabold', className), ...props }));
|
|
14
|
-
}
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{cn as o}from"../../../lib/utils.js";export function DashboardCard({className:e,...t}){return r("div",{className:o("bg-card relative flex flex-col rounded-lg p-6 pt-4",e),...t})}export function DashboardCardIcon({className:e,...t}){return r("div",{className:o("text-muted-foreground absolute top-4 right-6 flex size-6 items-center justify-center [&>svg]:size-6",e),...t})}export function DashboardCardTitle({className:e,...t}){return r("h2",{className:o("text-muted-foreground mb-4 text-sm font-medium uppercase",e),...t})}export function DashboardCardContent({className:e,...t}){return r("div",{className:o("text-muted-foreground text-[32px] font-extrabold",e),...t})}
|
|
@@ -1,52 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Badge } from '../../../components/ui/badge/index.js';
|
|
3
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../../../components/ui/dropdown-menu/index.js';
|
|
4
|
-
import { IconButton } from '../../../components/ui/icon-button/index.js';
|
|
5
|
-
import { Progress } from '../../../components/ui/progress/index.js';
|
|
6
|
-
import { Separator } from '../../../components/ui/separator/index.js';
|
|
7
|
-
import { cn } from '../../../lib/utils.js';
|
|
8
|
-
import { EllipsisVertical } from 'lucide-react';
|
|
9
|
-
export function EntityCardGrid({ className, ...props }) {
|
|
10
|
-
return (_jsx("div", { className: cn('grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3', className), "data-slot": "entity-card-grid", ...props }));
|
|
11
|
-
}
|
|
12
|
-
export function EntityCardGridFooter({ className, ...props }) {
|
|
13
|
-
return (_jsx("div", { className: cn(
|
|
14
|
-
// Semantic tokens, not raw palette steps: `bg-white`/`border-zinc-200`
|
|
15
|
-
// have no dark counterpart, so this footer stayed a white slab under
|
|
16
|
-
// cards that followed the theme.
|
|
17
|
-
'border-border bg-card flex items-center justify-between rounded-lg border px-6 py-4', className), "data-slot": "entity-card-grid-footer", ...props }));
|
|
18
|
-
}
|
|
19
|
-
export function EntityCard({ className, value, progress = false, children, ...props }) {
|
|
20
|
-
return (_jsxs("div", { "data-slot": "entity-card-wrapper", className: "transition-shadow hover:shadow-xl", children: [_jsx("div", { "data-slot": "entity-card", className: cn('bg-card relative flex flex-col gap-4 rounded-lg px-5 py-4', { 'rounded-b-none': progress }, className), ...props, children: children }), progress && _jsx(Progress, { className: "h-1.5 rounded-t-none", value: value })] }));
|
|
21
|
-
}
|
|
22
|
-
export function EntityCardAction({ children, ...props }) {
|
|
23
|
-
return (_jsxs(DropdownMenu, { ...props, children: [_jsx(DropdownMenuTrigger, { className: "absolute top-2.5 right-2.5", children: _jsx(IconButton, { variant: "outline", size: "small", rounded: true, children: _jsx(EllipsisVertical, {}) }) }), _jsx(DropdownMenuContent, { children: children })] }));
|
|
24
|
-
}
|
|
25
|
-
export const EntityCardActionItem = DropdownMenuItem;
|
|
26
|
-
export function EntityCardHeader({ className, ...props }) {
|
|
27
|
-
return (_jsx("div", { "data-slot": "entity-card-header", className: cn('flex flex-col gap-2', className), ...props }));
|
|
28
|
-
}
|
|
29
|
-
export function EntityCardTitle({ className, ...props }) {
|
|
30
|
-
return (_jsx("h3", { "data-slot": "entity-card-title", className: cn('text-foreground text-sm font-semibold', className), ...props }));
|
|
31
|
-
}
|
|
32
|
-
export function EntityCardIcon({ className, ...props }) {
|
|
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
|
-
}
|
|
35
|
-
export function EntityCardBadgeList({ className, ...props }) {
|
|
36
|
-
return (_jsx("div", { "data-slot": "entity-card-badge-list", className: cn('flex flex-wrap gap-2', className), ...props }));
|
|
37
|
-
}
|
|
38
|
-
export function EntityCardBadge({ className, ...props }) {
|
|
39
|
-
return (_jsx(Badge, { "data-slot": "entity-card-badge", className: cn('h-5 text-xs', className), ...props }));
|
|
40
|
-
}
|
|
41
|
-
export function EntityCardContent({ className, ...props }) {
|
|
42
|
-
return (_jsx("div", { "data-slot": "entity-card-content", className: cn('flex flex-col gap-2.5', className), ...props }));
|
|
43
|
-
}
|
|
44
|
-
export function EntityCardDescription({ className, ...props }) {
|
|
45
|
-
return (_jsx("p", { "data-slot": "entity-card-description", className: cn('text-muted-foreground text-xs font-medium', className), ...props }));
|
|
46
|
-
}
|
|
47
|
-
export function EntityCardList({ className, ...props }) {
|
|
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
|
-
}
|
|
50
|
-
export function EntityCardFooter({ className, children, ...props }) {
|
|
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
|
-
}
|
|
1
|
+
import{jsx as r,jsxs as a}from"react/jsx-runtime";import{Badge as s}from"../../../components/ui/badge/index.js";import{DropdownMenu as l,DropdownMenuContent as c,DropdownMenuItem as u,DropdownMenuTrigger as m}from"../../../components/ui/dropdown-menu/index.js";import{IconButton as x}from"../../../components/ui/icon-button/index.js";import{Progress as f}from"../../../components/ui/progress/index.js";import{Separator as p}from"../../../components/ui/separator/index.js";import{cn as o}from"../../../lib/utils.js";import{EllipsisVertical as g}from"lucide-react";export function EntityCardGrid({className:t,...e}){return r("div",{className:o("grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3",t),"data-slot":"entity-card-grid",...e})}export function EntityCardGridFooter({className:t,...e}){return r("div",{className:o("border-border bg-card flex items-center justify-between rounded-lg border px-6 py-4",t),"data-slot":"entity-card-grid-footer",...e})}export function EntityCard({className:t,value:e,progress:n=false,children:d,...i}){return a("div",{"data-slot":"entity-card-wrapper",className:"transition-shadow hover:shadow-xl",children:[r("div",{"data-slot":"entity-card",className:o("bg-card relative flex flex-col gap-4 rounded-lg px-5 py-4",{"rounded-b-none":n},t),...i,children:d}),n&&r(f,{className:"h-1.5 rounded-t-none",value:e})]})}export function EntityCardAction({children:t,...e}){return a(l,{...e,children:[r(m,{className:"absolute top-2.5 right-2.5",children:r(x,{variant:"outline",size:"small",rounded:true,children:r(g,{})})}),r(c,{children:t})]})}export const EntityCardActionItem=u;export function EntityCardHeader({className:t,...e}){return r("div",{"data-slot":"entity-card-header",className:o("flex flex-col gap-2",t),...e})}export function EntityCardTitle({className:t,...e}){return r("h3",{"data-slot":"entity-card-title",className:o("text-foreground text-sm font-semibold",t),...e})}export function EntityCardIcon({className:t,...e}){return r("span",{"data-slot":"entity-card-icon",className:o("text-muted-foreground size-8 [&>svg]:size-8 [&>svg]:stroke-[1.5]",t),...e})}export function EntityCardBadgeList({className:t,...e}){return r("div",{"data-slot":"entity-card-badge-list",className:o("flex flex-wrap gap-2",t),...e})}export function EntityCardBadge({className:t,...e}){return r(s,{"data-slot":"entity-card-badge",className:o("h-5 text-xs",t),...e})}export function EntityCardContent({className:t,...e}){return r("div",{"data-slot":"entity-card-content",className:o("flex flex-col gap-2.5",t),...e})}export function EntityCardDescription({className:t,...e}){return r("p",{"data-slot":"entity-card-description",className:o("text-muted-foreground text-xs font-medium",t),...e})}export function EntityCardList({className:t,...e}){return r("ul",{"data-slot":"entity-card-list",className:o("text-muted-foreground mx-2 list-inside list-disc space-y-1 text-xs font-medium",t),...e})}export function EntityCardFooter({className:t,children:e,...n}){return a("div",{"data-slot":"entity-card-footer",className:o("text-muted-foreground flex flex-col gap-2 text-xs font-medium",t),...n,children:[r(p,{}),r("div",{className:"[&>svg]:text-muted-foreground flex flex-row items-center gap-2 [&>svg]:size-4 [&>svg]:stroke-[1.5]",children:e})]})}
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './basic-card/index.js';
|
|
3
|
-
export * from './dashboard-card/index.js';
|
|
4
|
-
export * from './entity-card/index.js';
|
|
1
|
+
export*from"./account-card/index.js";export*from"./basic-card/index.js";export*from"./dashboard-card/index.js";export*from"./entity-card/index.js";
|
|
@@ -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;
|
|
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;AA4D9B,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"}
|
|
@@ -1,60 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Button } from '../../../components/ui/button/index.js';
|
|
5
|
-
import { AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from '../../../components/ui/alert-dialog/index.js';
|
|
6
|
-
import { LoadingButton } from '../../../components/ui/loading-button/index.js';
|
|
7
|
-
import { Ban, CheckCircle2, TriangleAlert } from 'lucide-react';
|
|
8
|
-
import { cn } from '../../../lib/utils.js';
|
|
9
|
-
import { cva } from 'class-variance-authority';
|
|
10
|
-
const confirmationDialogIconVariants = cva('flex size-10 shrink-0 items-center justify-center rounded-lg [&>svg]:size-6', {
|
|
11
|
-
variants: {
|
|
12
|
-
// System tokens, not raw palette steps: a raw 50-step surface has no dark
|
|
13
|
-
// counterpart, so on the dark canvas it rendered a near-white block.
|
|
14
|
-
// `default` is deliberately neutral so `destructive` reads as a distinct,
|
|
15
|
-
// heavier warning instead of an alias of it.
|
|
16
|
-
variant: {
|
|
17
|
-
default: 'bg-muted text-foreground',
|
|
18
|
-
warning: 'bg-system-alert-surface text-system-alert-h1a',
|
|
19
|
-
destructive: 'bg-system-error-surface text-system-error-h1a',
|
|
20
|
-
success: 'bg-system-success-surface text-system-success-h1a'
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
defaultVariants: {
|
|
24
|
-
variant: 'default'
|
|
25
|
-
}
|
|
26
|
-
});
|
|
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 = null, description = null, variant = 'default', loading, onConfirm = () => { }, onCancel = () => { }, confirmLabel, cancelLabel, pendingLabel }) {
|
|
29
|
-
const [pending, setPending] = React.useState(false);
|
|
30
|
-
const busy = Boolean(loading) || pending;
|
|
31
|
-
const handleConfirm = async () => {
|
|
32
|
-
if (busy) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
setPending(true);
|
|
36
|
-
try {
|
|
37
|
-
await onConfirm();
|
|
38
|
-
onOpenChange(false);
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
// Deliberately silent: the caller owns error UX. Catching only keeps a
|
|
42
|
-
// rejection from escaping the click handler as an unhandled rejection —
|
|
43
|
-
// the dialog stays open so the caller can render the failure in place.
|
|
44
|
-
}
|
|
45
|
-
finally {
|
|
46
|
-
setPending(false);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
return (_jsx(AlertDialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(AlertDialogContent, { "data-testid": "dialog",
|
|
50
|
-
// Radix already blocks outside interaction on an alert dialog, so
|
|
51
|
-
// Escape is the only remaining way to abandon a mutation mid-flight.
|
|
52
|
-
onEscapeKeyDown: (event) => {
|
|
53
|
-
if (busy) {
|
|
54
|
-
event.preventDefault();
|
|
55
|
-
}
|
|
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' })] })] }) }));
|
|
60
|
-
}
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as x from"react";import{Button as D}from"../../../components/ui/button/index.js";import{AlertDialog as v,AlertDialogCancel as A,AlertDialogContent as N,AlertDialogDescription as j,AlertDialogFooter as k,AlertDialogHeader as w,AlertDialogTitle as m}from"../../../components/ui/alert-dialog/index.js";import{LoadingButton as b}from"../../../components/ui/loading-button/index.js";import{Ban as z,CheckCircle2 as B,CircleQuestionMark as I,TriangleAlert as T}from"lucide-react";import{cn as V}from"../../../lib/utils.js";import{cva as _}from"class-variance-authority";const E=_("flex size-10 shrink-0 items-center justify-center rounded-lg [&>svg]:size-6",{variants:{variant:{default:"bg-muted text-foreground",warning:"bg-system-alert-surface text-system-alert-h1a",destructive:"bg-system-error-surface text-system-error-h1a",success:"bg-system-success-surface text-system-success-h1a"}},defaultVariants:{variant:"default"}});const F=({className:l,variant:r,...s})=>t("span",{className:V(E({variant:r}),l),...s,children:[r==="default"&&e(I,{}),r==="warning"&&e(T,{}),r==="destructive"&&e(z,{}),r==="success"&&e(B,{})]});export function ConfirmationDialog({open:l,onOpenChange:r,title:s=null,description:n=null,variant:i="default",loading:u,onConfirm:f=()=>{},onCancel:g=()=>{},confirmLabel:o,cancelLabel:h,pendingLabel:c}){const[p,d]=x.useState(false);const a=Boolean(u)||p;const y=async()=>{if(a){return}d(true);try{await f();r(false)}catch{}finally{d(false)}};return e(v,{open:l,onOpenChange:r,children:t(N,{"data-testid":"dialog",onEscapeKeyDown:C=>{if(a){C.preventDefault()}},children:[t(w,{className:"flex-row items-center",children:[e(F,{variant:i}),t("div",{className:"flex flex-col gap-4",children:[s==null||s===false||s===true||s===""?e(m,{className:"sr-only",children:o||"Confirm"}):e(m,{children:s}),n==null?null:e(j,{children:n})]})]}),c?e("span",{role:"status",className:"sr-only",children:a?c:""}):null,t(k,{className:"gap-4",children:[e(A,{asChild:true,variant:"secondary",children:e(D,{onClick:g,disabled:a,variant:"secondary",size:"small",children:h??"Cancel"})}),e(b,{loading:a,onClick:y,variant:i==="destructive"?"destructive":"primary",size:"small","data-testid":"confirm",children:o??"Confirm"})]})]})})}
|
|
@@ -1,49 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* A custom hook that manages the state and behavior of a confirmation dialog.
|
|
4
|
-
*
|
|
5
|
-
* @template TData - The type of the data associated with the dialog.
|
|
6
|
-
*
|
|
7
|
-
* @param {UseConfirmDialog} param0 - An object containing the onConfirm callback.
|
|
8
|
-
* @param {Function} [param0.onConfirm] - A callback function that is called when the dialog is confirmed.
|
|
9
|
-
*
|
|
10
|
-
* @returns {Object} An object containing the dialog state and handlers.
|
|
11
|
-
* @returns {string} id - The current id associated with the dialog.
|
|
12
|
-
* @returns {TData | null} data - The current data associated with the dialog.
|
|
13
|
-
* @returns {Function} handleDialogOpen - A function to open the dialog with a specific id and optional data.
|
|
14
|
-
* @returns {Object} dialogProps - An object containing the dialog properties and handlers.
|
|
15
|
-
*/
|
|
16
|
-
export function useConfirmDialog({ onConfirm: onConfirmProp }) {
|
|
17
|
-
const [id, setId] = React.useState('');
|
|
18
|
-
const [data, setData] = React.useState(null);
|
|
19
|
-
const [open, setOpen] = React.useState(false);
|
|
20
|
-
const onOpenChange = (open) => setOpen(open);
|
|
21
|
-
const handleDialogOpen = (id, data) => {
|
|
22
|
-
setId(id);
|
|
23
|
-
setData(data);
|
|
24
|
-
setOpen(true);
|
|
25
|
-
};
|
|
26
|
-
const handleDialogClose = () => setOpen(false);
|
|
27
|
-
const onCancel = () => {
|
|
28
|
-
setId('');
|
|
29
|
-
setData(null);
|
|
30
|
-
setOpen(false);
|
|
31
|
-
};
|
|
32
|
-
const onConfirm = () => {
|
|
33
|
-
setId('');
|
|
34
|
-
setData(null);
|
|
35
|
-
onConfirmProp?.(id);
|
|
36
|
-
};
|
|
37
|
-
return {
|
|
38
|
-
id,
|
|
39
|
-
data,
|
|
40
|
-
handleDialogClose,
|
|
41
|
-
handleDialogOpen,
|
|
42
|
-
dialogProps: {
|
|
43
|
-
open,
|
|
44
|
-
onOpenChange,
|
|
45
|
-
onCancel,
|
|
46
|
-
onConfirm
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
1
|
+
import s from"react";export function useConfirmDialog({onConfirm:l}){const[a,e]=s.useState("");const[c,o]=s.useState(null);const[i,n]=s.useState(false);const r=t=>n(t);const u=(t,C)=>{e(t);o(C);n(true)};const f=()=>n(false);const p=()=>{e("");o(null);n(false)};const d=()=>{e("");o(null);l?.(a)};return{id:a,data:c,handleDialogClose:f,handleDialogOpen:u,dialogProps:{open:i,onOpenChange:r,onCancel:p,onConfirm:d}}}
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './confirmation-dialog/use-confirm-dialog.js';
|
|
3
|
-
export * from './large-dialog/index.js';
|
|
1
|
+
export*from"./confirmation-dialog/index.js";export*from"./confirmation-dialog/use-confirm-dialog.js";export*from"./large-dialog/index.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare function OnboardDialogContent({ className, ...props }:
|
|
1
|
+
import { DialogContent } from '../../../components/ui/dialog/index.js';
|
|
2
|
+
declare function OnboardDialogContent({ className, ...props }: React.ComponentProps<typeof DialogContent>): import("react").JSX.Element;
|
|
3
3
|
declare function OnboardDialogHeader({ className, ...props }: React.ComponentProps<'div'>): import("react").JSX.Element;
|
|
4
4
|
export type OnboardDialogTitleProps = React.ComponentProps<'div'> & {
|
|
5
5
|
upperTitle: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dialog/large-dialog/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dialog/large-dialog/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAe,MAAM,wBAAwB,CAAA;AAEnE,iBAAS,oBAAoB,CAAC,EAC5B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,+BAS5C;AAED,iBAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,+BAQ7B;AAED,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAClE,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,iBAAS,kBAAkB,CAAC,EAC1B,UAAU,EACV,KAAK,EACL,SAAS,EACT,GAAG,KAAK,EACT,EAAE,uBAAuB,+BAezB;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,+BAU7B;AAED,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAClB,CAAA"}
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { cn } from '../../../lib/utils.js';
|
|
3
|
-
import { DialogContent, DialogTitle } from '../../../components/ui/dialog/index.js';
|
|
4
|
-
function OnboardDialogContent({ className, ...props }) {
|
|
5
|
-
return (_jsx(DialogContent, { "data-slot": "onboard-dialog-content", showCloseButton: false, className: cn('[data-radix-dialog-close] w-full max-w-[640px] p-12 sm:min-w-[640px]', className), ...props }));
|
|
6
|
-
}
|
|
7
|
-
function OnboardDialogHeader({ className, ...props }) {
|
|
8
|
-
return (_jsx("div", { "data-slot": "onboard-dialog-header", className: cn('flex flex-row justify-between', className), ...props }));
|
|
9
|
-
}
|
|
10
|
-
function OnboardDialogTitle({ upperTitle, title, className, ...props }) {
|
|
11
|
-
return (_jsxs("div", { "data-slot": "onboard-dialog-title", className: cn('flex flex-col gap-8', className), ...props, children: [_jsx("p", { className: "text-muted-foreground text-base font-medium", children: upperTitle }), _jsx(DialogTitle, { className: "text-muted-foreground text-4xl font-bold", children: title })] }));
|
|
12
|
-
}
|
|
13
|
-
function OnboardDialogIcon({ className, children, ...props }) {
|
|
14
|
-
return (_jsx("div", { "data-slot": "onboard-dialog-icon", className: cn('flex items-center px-12', className), ...props, children: _jsx("div", { className: "shrink-0", children: children }) }));
|
|
15
|
-
}
|
|
16
|
-
export { OnboardDialogContent, OnboardDialogHeader, OnboardDialogTitle, OnboardDialogIcon };
|
|
1
|
+
import{jsx as a,jsxs as r}from"react/jsx-runtime";import{cn as t}from"../../../lib/utils.js";import{DialogContent as i,DialogTitle as s}from"../../../components/ui/dialog/index.js";function d({className:o,...e}){return a(i,{"data-slot":"onboard-dialog-content",showCloseButton:false,className:t("w-full max-w-[640px] p-12 sm:min-w-[640px]",o),...e})}function c({className:o,...e}){return a("div",{"data-slot":"onboard-dialog-header",className:t("flex flex-row justify-between",o),...e})}function m({upperTitle:o,title:e,className:n,...l}){return r("div",{"data-slot":"onboard-dialog-title",className:t("flex flex-col gap-8",n),...l,children:[a("p",{className:"text-muted-foreground text-base font-medium",children:o}),a(s,{className:"text-muted-foreground text-4xl font-bold",children:e})]})}function f({className:o,children:e,...n}){return a("div",{"data-slot":"onboard-dialog-icon",className:t("flex items-center px-12",o),...n,children:a("div",{className:"shrink-0",children:e})})}export{d as OnboardDialogContent,c as OnboardDialogHeader,m as OnboardDialogTitle,f as OnboardDialogIcon};
|
|
@@ -1,56 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { cn } from '../../lib/utils.js';
|
|
4
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip/index.js';
|
|
5
|
-
import { CircleHelp, Settings2 } from 'lucide-react';
|
|
6
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible/index.js';
|
|
7
|
-
import { Button } from '../ui/button/index.js';
|
|
8
|
-
import { Separator } from '../ui/separator/index.js';
|
|
9
|
-
function EntityBox({ className, children, ...props }) {
|
|
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 }));
|
|
11
|
-
}
|
|
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 }) }));
|
|
27
|
-
}
|
|
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 }) }) }));
|
|
41
|
-
}
|
|
42
|
-
function EntityBoxCollapsibleContent({ children, ...props }) {
|
|
43
|
-
return (_jsxs(CollapsibleContent, { ...props, children: [_jsx(Separator, { orientation: "horizontal" }), _jsx("div", { className: "grid w-full grid-cols-3 p-6", children: children })] }));
|
|
44
|
-
}
|
|
45
|
-
function EntityBoxHeaderTitle({ title, subtitle, tooltip, tooltipWidth, className, as: Heading = 'h2', ...props }) {
|
|
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
|
|
47
|
-
? { width: tooltipWidth, maxWidth: tooltipWidth }
|
|
48
|
-
: undefined, children: tooltip })] }) }))] }), subtitle && _jsx("p", { className: "text-muted-foreground text-sm", children: subtitle })] }));
|
|
49
|
-
}
|
|
50
|
-
function EntityBoxBanner({ className, children, ...props }) {
|
|
51
|
-
return (_jsx("div", { "data-slot": "entity-box-banner", className: cn('grid grid-cols-3 p-6', className), ...props, children: children }));
|
|
52
|
-
}
|
|
53
|
-
function EntityBoxActions({ className, children, ...props }) {
|
|
54
|
-
return (_jsx("div", { "data-slot": "entity-box-actions", className: cn('col-start-3 flex flex-row items-center justify-end gap-4', className), ...props, children: children }));
|
|
55
|
-
}
|
|
56
|
-
export { EntityBox, EntityBoxCollapsible, EntityBoxCollapsibleTrigger, EntityBoxCollapsibleContent, EntityBoxHeaderTitle, EntityBoxBanner, EntityBoxActions };
|
|
1
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import c from"react";import{cn as l}from"../../lib/utils.js";import{Tooltip as p,TooltipContent as u,TooltipProvider as f,TooltipTrigger as h}from"../ui/tooltip/index.js";import{CircleHelp as g,Settings2 as b}from"lucide-react";import{Collapsible as y,CollapsibleContent as C,CollapsibleTrigger as N}from"../ui/collapsible/index.js";import{Button as v}from"../ui/button/index.js";import{Separator as B}from"../ui/separator/index.js";function E({className:n,children:t,...r}){return e("div",{"data-slot":"entity-box",className:l("shadow-entity-box bg-card mb-2 flex items-center justify-between rounded-lg p-6",n),...r,children:t})}const x=c.createContext(false);function w({className:n,open:t,defaultOpen:r,onOpenChange:o,...i}){const[s,d]=c.useState(r??false);return e(x.Provider,{value:t??s,children:e(y,{className:l("shadow-entity-box bg-card mb-2 flex flex-col rounded-lg",n),open:t,defaultOpen:r,onOpenChange:m=>{d(m);o?.(m)},...i})})}function T({expandLabel:n="Expand",collapseLabel:t="Collapse","aria-label":r,...o}){const i=c.useContext(x);return e(N,{...o,asChild:true,children:e(v,{variant:"secondary",className:"h-[34px] w-[34px] p-2","aria-label":r??(i?t:n),children:e(b,{size:16,"aria-hidden":true})})})}function j({children:n,...t}){return a(C,{...t,children:[e(B,{orientation:"horizontal"}),e("div",{className:"grid w-full grid-cols-3 p-6",children:n})]})}function S({title:n,subtitle:t,tooltip:r,tooltipWidth:o,className:i,as:s="h2",...d}){return a("div",{"data-slot":"entity-box-header",className:l("flex flex-col items-start",i),...d,children:[a("div",{className:"flex items-center gap-[10px]",children:[e(s,{className:"text-muted-foreground text-lg font-medium",children:n}),r&&e(f,{children:a(p,{children:[e(h,{asChild:true,children:e(g,{className:"pointer text-muted-foreground h-5 w-5"})}),e(u,{side:"right",style:o?{width:o,maxWidth:o}:void 0,children:r})]})})]}),t&&e("p",{className:"text-muted-foreground text-sm",children:t})]})}function z({className:n,children:t,...r}){return e("div",{"data-slot":"entity-box-banner",className:l("grid grid-cols-3 p-6",n),...r,children:t})}function H({className:n,children:t,...r}){return e("div",{"data-slot":"entity-box-actions",className:l("col-start-3 flex flex-row items-center justify-end gap-4",n),...r,children:t})}export{E as EntityBox,w as EntityBoxCollapsible,T as EntityBoxCollapsibleTrigger,j as EntityBoxCollapsibleContent,S as EntityBoxHeaderTitle,z as EntityBoxBanner,H as EntityBoxActions};
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { cn } from '../../lib/utils.js';
|
|
3
|
-
import { Paper } from '../ui/paper/index.js';
|
|
4
|
-
function EntityDataTableRoot({ className, ...props }) {
|
|
5
|
-
return _jsx(Paper, { className: className, ...props });
|
|
6
|
-
}
|
|
7
|
-
function EntityDataTableFooter({ className, ...props }) {
|
|
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
|
-
}
|
|
10
|
-
function EntityDataTableFooterText({ className, ...props }) {
|
|
11
|
-
return (_jsx("p", { "data-slot": "data-table-footer-text", className: cn('text-muted-foreground text-sm leading-8 italic', className), ...props }));
|
|
12
|
-
}
|
|
13
|
-
export const EntityDataTable = {
|
|
14
|
-
Root: EntityDataTableRoot,
|
|
15
|
-
Footer: EntityDataTableFooter,
|
|
16
|
-
FooterText: EntityDataTableFooterText
|
|
17
|
-
};
|
|
1
|
+
import{jsx as a}from"react/jsx-runtime";import{cn as o}from"../../lib/utils.js";import{Paper as r}from"../ui/paper/index.js";function n({className:t,...e}){return a(r,{className:t,...e})}function i({className:t,...e}){return a("div",{"data-slot":"data-table-footer",className:o("flex flex-row items-center justify-between px-6 py-3",t),...e})}function l({className:t,...e}){return a("p",{"data-slot":"data-table-footer-text",className:o("text-muted-foreground text-sm leading-8 italic",t),...e})}export const EntityDataTable={Root:n,Footer:i,FooterText:l};
|
|
@@ -1,28 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { FormField, FormItem, FormLabel, FormMessage } from '../../../components/ui/form.js';
|
|
4
|
-
import { Popover, PopoverContent, PopoverTrigger } from '../../../components/ui/popover/index.js';
|
|
5
|
-
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandList } from '../../../components/ui/command/index.js';
|
|
6
|
-
import { Button } from '../../../components/ui/button/index.js';
|
|
7
|
-
import { cn } from '../../../lib/utils.js';
|
|
8
|
-
import { ChevronsUpDown } from 'lucide-react';
|
|
9
|
-
export const ComboBoxField = ({ name, label, placeholder, emptyMessage, required, children, readOnly, ...others }) => {
|
|
10
|
-
const [open, setOpen] = React.useState(false);
|
|
11
|
-
// with the value and label
|
|
12
|
-
const options = React.useMemo(() => React.Children.map(React.Children.toArray(children), (child) => React.isValidElement(child) && {
|
|
13
|
-
value: child.props.value,
|
|
14
|
-
label: child.props.children
|
|
15
|
-
}), [children]);
|
|
16
|
-
const getDisplayValue = React.useCallback((value) => {
|
|
17
|
-
return options.find((option) => option.value === value)?.label ?? null;
|
|
18
|
-
}, [options]);
|
|
19
|
-
return (_jsx(FormField, { name: name, ...others, render: ({ field }) => (_jsxs(FormItem, { required: required, children: [label && _jsx(FormLabel, { children: label }), _jsxs(Popover, { open: readOnly ? false : open, onOpenChange: readOnly ? () => { } : setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", role: "combobox", "aria-expanded": readOnly ? false : open, readOnly: readOnly, tabIndex: 0, className: cn('border-input-border bg-input hover:bg-input text-foreground h-10 w-full justify-between rounded-md border px-4 py-2 pl-6 text-left text-base font-normal focus:ring-2 focus:ring-offset-0 focus:outline-none', !field.value && 'text-muted-foreground'), children: [getDisplayValue(field.value) ?? placeholder, !readOnly && (_jsx(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" }))] }) }), _jsx(PopoverContent, { className: "w-(--radix-popover-trigger-width) p-0", children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: placeholder }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: emptyMessage }), _jsx(CommandGroup, { children: React.Children.map(React.Children.toArray(children), (child) => React.isValidElement(child)
|
|
20
|
-
? React.cloneElement(child, {
|
|
21
|
-
keywords: [child.props.children],
|
|
22
|
-
onSelect: (value) => {
|
|
23
|
-
field.onChange(field.value !== value ? value : '');
|
|
24
|
-
setOpen(false);
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
: child) })] })] }) })] }), _jsx(FormMessage, {})] })) }));
|
|
28
|
-
};
|
|
1
|
+
import{jsx as r,jsxs as a}from"react/jsx-runtime";import o from"react";import{FormField as b,FormItem as g,FormLabel as v,FormMessage as w}from"../../../components/ui/form.js";import{Popover as F,PopoverContent as j,PopoverTrigger as y}from"../../../components/ui/popover/index.js";import{Command as E,CommandEmpty as k,CommandGroup as I,CommandInput as N,CommandList as P}from"../../../components/ui/command/index.js";import{Button as V}from"../../../components/ui/button/index.js";import{cn as A}from"../../../lib/utils.js";import{ChevronsUpDown as B}from"lucide-react";export const ComboBoxField=({name:c,label:s,placeholder:l,emptyMessage:f,required:h,children:m,readOnly:t,...C})=>{const[i,p]=o.useState(false);const d=o.useMemo(()=>o.Children.map(o.Children.toArray(m),e=>o.isValidElement(e)&&{value:e.props.value,label:e.props.children}),[m]);const x=o.useCallback(e=>{return d.find(n=>n.value===e)?.label??null},[d]);return r(b,{name:c,...C,render:({field:e})=>a(g,{required:h,children:[s&&r(v,{children:s}),a(F,{open:t?false:i,onOpenChange:t?()=>{}:p,children:[r(y,{asChild:true,children:a(V,{variant:"outline",role:"combobox","aria-expanded":t?false:i,readOnly:t,tabIndex:0,className:A("border-input-border bg-input hover:bg-input text-foreground h-10 w-full justify-between rounded-md border px-4 py-2 pl-6 text-left text-base font-normal focus:ring-2 focus:ring-offset-0 focus:outline-none",!e.value&&"text-muted-foreground"),children:[x(e.value)??l,!t&&r(B,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r(j,{className:"w-(--radix-popover-trigger-width) p-0",children:a(E,{children:[r(N,{placeholder:l}),a(P,{children:[r(k,{children:f}),r(I,{children:o.Children.map(o.Children.toArray(m),n=>o.isValidElement(n)?o.cloneElement(n,{keywords:[n.props.children],onSelect:u=>{e.onChange(e.value!==u?u:"");p(false)}}):n)})]})]})})]}),r(w,{})]})})};
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CommandItem } from '../../../components/ui/command/index.js';
|
|
3
|
-
import { ComboBoxField } from '../combo-box-field/index.js';
|
|
4
|
-
import { getCountries } from '../../../utils/country-utils.js';
|
|
5
|
-
export const CountryField = ({ ...others }) => {
|
|
6
|
-
return (_jsx(ComboBoxField, { ...others, children: getCountries().map((country) => (_jsx(CommandItem, { value: country.code, children: country.name }, country.code))) }));
|
|
7
|
-
};
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import{CommandItem as r}from"../../../components/ui/command/index.js";import{ComboBoxField as i}from"../combo-box-field/index.js";import{getCountries as t}from"../../../utils/country-utils.js";export const CountryField=({...e})=>{return m(i,{...e,children:t().map(o=>m(r,{value:o.code,children:o.name},o.code))})};
|
|
@@ -1,43 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button } from '../../../components/ui/button/index.js';
|
|
4
|
-
import { Calendar } from '../../../components/ui/calendar/index.js';
|
|
5
|
-
import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormTooltip } from '../../../components/ui/form.js';
|
|
6
|
-
import { Popover, PopoverContent, PopoverTrigger } from '../../../components/ui/popover/index.js';
|
|
7
|
-
import { cn } from '../../../lib/utils.js';
|
|
8
|
-
import dayjs from 'dayjs';
|
|
9
|
-
import { CalendarIcon } from 'lucide-react';
|
|
10
|
-
import * as React from 'react';
|
|
11
|
-
import { enUS } from 'react-day-picker/locale';
|
|
12
|
-
export const DatePickerField = ({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, dateFormat = 'MMM DD, YYYY', align = 'start', valueAsString, locale = enUS, ...others }) => {
|
|
13
|
-
const [open, setOpen] = React.useState(false);
|
|
14
|
-
return (_jsx(FormField, { name: name, control: control, render: ({ field }) => {
|
|
15
|
-
const convertFieldValueToDate = (fieldValue) => {
|
|
16
|
-
if (!fieldValue)
|
|
17
|
-
return undefined;
|
|
18
|
-
if (valueAsString) {
|
|
19
|
-
const parsed = dayjs(fieldValue);
|
|
20
|
-
return parsed.isValid() ? parsed.toDate() : undefined;
|
|
21
|
-
}
|
|
22
|
-
return fieldValue;
|
|
23
|
-
};
|
|
24
|
-
const convertDateToOutputFormat = (date) => {
|
|
25
|
-
if (!date)
|
|
26
|
-
return undefined;
|
|
27
|
-
if (valueAsString) {
|
|
28
|
-
const parsed = dayjs(date);
|
|
29
|
-
return parsed.isValid() ? parsed.format('YYYY-MM-DD') : undefined;
|
|
30
|
-
}
|
|
31
|
-
return date;
|
|
32
|
-
};
|
|
33
|
-
const value = convertFieldValueToDate(field.value);
|
|
34
|
-
const handleSelect = (date) => {
|
|
35
|
-
field.onChange(convertDateToOutputFormat(date));
|
|
36
|
-
};
|
|
37
|
-
return (_jsxs(FormItem, { required: required, children: [label && (_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : labelExtra, children: label })), _jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(FormControl, { children: _jsx(Button, { variant: "outline", disabled: disabled, className: cn('bg-input hover:bg-input border-input-border text-foreground h-10 w-full justify-start rounded-md px-2.5 font-normal', readOnly && 'pointer-events-none', open && 'ring-ring ring-2 ring-offset-0'), "data-testid": others['data-testid'], icon: _jsx(CalendarIcon, { className: "size-4" }), children: value ? (_jsx("span", { className: "text-foreground flex-1 text-left font-bold", children: dayjs(value).format(dateFormat) })) : (_jsx("span", { className: "text-muted-foreground flex-1 text-left", children: placeholder })) }) }) }), _jsx(PopoverContent, { className: "w-auto p-0", align: align, children: _jsx(Calendar, { mode: "single",
|
|
38
|
-
// `required` mirrors the field's own required: a required
|
|
39
|
-
// field is not emptied by a re-click; an optional one keeps
|
|
40
|
-
// react-day-picker's clear gesture.
|
|
41
|
-
required: required, defaultMonth: value, selected: value, onSelect: handleSelect, disabled: disabled || readOnly, locale: locale }) })] }), _jsx(FormMessage, {}), description && _jsx(FormDescription, { children: description })] }));
|
|
42
|
-
} }));
|
|
43
|
-
};
|
|
1
|
+
"use client";import{jsx as e,jsxs as p}from"react/jsx-runtime";import{Button as P}from"../../../components/ui/button/index.js";import{Calendar as T}from"../../../components/ui/calendar/index.js";import{FormControl as S,FormDescription as w,FormField as I,FormItem as O,FormLabel as _,FormMessage as k,FormTooltip as q}from"../../../components/ui/form.js";import{Popover as y,PopoverContent as z,PopoverTrigger as B}from"../../../components/ui/popover/index.js";import{cn as L}from"../../../lib/utils.js";import n from"dayjs";import{CalendarIcon as R}from"lucide-react";import*as U from"react";import{enUS as V}from"react-day-picker/locale";export const DatePickerField=({name:h,label:i,tooltip:a,labelExtra:g,description:s,placeholder:x,disabled:d,readOnly:l,control:F,required:m,dateFormat:v="MMM DD, YYYY",align:D="start",valueAsString:c,locale:Y=V,...C})=>{const[f,M]=U.useState(false);return e(I,{name:h,control:F,render:({field:u})=>{const b=r=>{if(!r)return void 0;if(c){const t=n(r);return t.isValid()?t.toDate():void 0}return r};const j=r=>{if(!r)return void 0;if(c){const t=n(r);return t.isValid()?t.format("YYYY-MM-DD"):void 0}return r};const o=b(u.value);const N=r=>{u.onChange(j(r))};return p(O,{required:m,children:[i&&e(_,{extra:a?e(q,{children:a}):g,children:i}),p(y,{open:f,onOpenChange:M,children:[e(B,{asChild:true,children:e(S,{children:e(P,{variant:"outline",disabled:d,className:L("bg-input hover:bg-input border-input-border text-foreground h-10 w-full justify-start rounded-md px-2.5 font-normal",l&&"pointer-events-none",f&&"ring-ring ring-2 ring-offset-0"),"data-testid":C["data-testid"],icon:e(R,{className:"size-4"}),children:o?e("span",{className:"text-foreground flex-1 text-left font-bold",children:n(o).format(v)}):e("span",{className:"text-muted-foreground flex-1 text-left",children:x})})})}),e(z,{className:"w-auto p-0",align:D,children:e(T,{mode:"single",required:m,defaultMonth:o,selected:o,onSelect:N,disabled:d||l,locale:Y})})]}),e(k,{}),s&&e(w,{children:s})]})}})};
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button } from '../../../components/ui/button/index.js';
|
|
4
|
-
import { Calendar } from '../../../components/ui/calendar/index.js';
|
|
5
|
-
import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormTooltip } from '../../../components/ui/form.js';
|
|
6
|
-
import { Popover, PopoverContent, PopoverTrigger } from '../../../components/ui/popover/index.js';
|
|
7
|
-
import { cn } from '../../../lib/utils.js';
|
|
8
|
-
import dayjs from 'dayjs';
|
|
9
|
-
import { CalendarIcon } from 'lucide-react';
|
|
10
|
-
import * as React from 'react';
|
|
11
|
-
import { enUS } from 'react-day-picker/locale';
|
|
12
|
-
export const DateRangeField = ({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, numberOfMonths = 2, dateFormat = 'MMM DD, YYYY', align = 'start', locale = enUS, ...others }) => {
|
|
13
|
-
const [open, setOpen] = React.useState(false);
|
|
14
|
-
return (_jsx(FormField, { name: name, control: control, render: ({ field }) => {
|
|
15
|
-
const value = field.value;
|
|
16
|
-
return (_jsxs(FormItem, { required: required, children: [label && (_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : labelExtra, children: label })), _jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(FormControl, { children: _jsx(Button, { variant: "outline", disabled: disabled, className: cn('bg-input hover:bg-input border-input-border text-foreground h-10 w-full justify-start rounded-md px-2.5 font-normal', readOnly && 'pointer-events-none', open && 'ring-ring ring-2 ring-offset-0'), "data-testid": others['data-testid'], icon: _jsx(CalendarIcon, { className: "size-4" }), children: value?.from ? (_jsx("span", { className: "text-foreground flex-1 text-left font-bold", children: value.to ? (_jsxs(_Fragment, { children: [dayjs(value.from).format(dateFormat), " -", ' ', dayjs(value.to).format(dateFormat)] })) : (dayjs(value.from).format(dateFormat)) })) : (_jsx("span", { className: "text-muted-foreground flex-1 text-left", children: placeholder })) }) }) }), _jsx(PopoverContent, { className: "w-auto p-0", align: align, children: _jsx(Calendar, { mode: "range", defaultMonth: value?.from, selected: value, onSelect: field.onChange, numberOfMonths: numberOfMonths, disabled: disabled || readOnly, locale: locale }) })] }), _jsx(FormMessage, {}), description && _jsx(FormDescription, { children: description })] }));
|
|
17
|
-
} }));
|
|
18
|
-
};
|
|
1
|
+
"use client";import{jsx as e,Fragment as j,jsxs as t}from"react/jsx-runtime";import{Button as M}from"../../../components/ui/button/index.js";import{Calendar as N}from"../../../components/ui/calendar/index.js";import{FormControl as D,FormDescription as Y,FormField as P,FormItem as S,FormLabel as _,FormMessage as w,FormTooltip as I}from"../../../components/ui/form.js";import{Popover as O,PopoverContent as R,PopoverTrigger as T}from"../../../components/ui/popover/index.js";import{cn as q}from"../../../lib/utils.js";import n from"dayjs";import{CalendarIcon as y}from"lucide-react";import*as z from"react";import{enUS as B}from"react-day-picker/locale";export const DateRangeField=({name:c,label:a,tooltip:m,labelExtra:p,description:i,placeholder:u,disabled:s,readOnly:l,control:g,required:h,numberOfMonths:x=2,dateFormat:o="MMM DD, YYYY",align:F="start",locale:v=B,...b})=>{const[d,C]=z.useState(false);return e(P,{name:c,control:g,render:({field:f})=>{const r=f.value;return t(S,{required:h,children:[a&&e(_,{extra:m?e(I,{children:m}):p,children:a}),t(O,{open:d,onOpenChange:C,children:[e(T,{asChild:true,children:e(D,{children:e(M,{variant:"outline",disabled:s,className:q("bg-input hover:bg-input border-input-border text-foreground h-10 w-full justify-start rounded-md px-2.5 font-normal",l&&"pointer-events-none",d&&"ring-ring ring-2 ring-offset-0"),"data-testid":b["data-testid"],icon:e(y,{className:"size-4"}),children:r?.from?e("span",{className:"text-foreground flex-1 text-left font-bold",children:r.to?t(j,{children:[n(r.from).format(o)," -"," ",n(r.to).format(o)]}):n(r.from).format(o)}):e("span",{className:"text-muted-foreground flex-1 text-left",children:u})})})}),e(R,{className:"w-auto p-0",align:F,children:e(N,{mode:"range",defaultMonth:r?.from,selected:r,onSelect:f.onChange,numberOfMonths:x,disabled:s||l,locale:v})})]}),e(w,{}),i&&e(Y,{children:i})]})}})};
|