@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,118 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
5
|
-
import { Controller, FormProvider, useFormContext } from 'react-hook-form';
|
|
6
|
-
import { cn } from '../../lib/utils.js';
|
|
7
|
-
import { Label } from '../../components/ui/label/index.js';
|
|
8
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './tooltip/index.js';
|
|
9
|
-
import { HelpCircle } from 'lucide-react';
|
|
10
|
-
const Form = FormProvider;
|
|
11
|
-
const FormFieldContext = React.createContext({});
|
|
12
|
-
const FormField = ({ ...props }) => {
|
|
13
|
-
return (_jsx(FormFieldContext.Provider, { value: { name: props.name }, children: _jsx(Controller, { ...props }) }));
|
|
14
|
-
};
|
|
15
|
-
const useFormField = () => {
|
|
16
|
-
const fieldContext = React.useContext(FormFieldContext);
|
|
17
|
-
const itemContext = React.useContext(FormItemContext);
|
|
18
|
-
// `useFormContext()` is null outside a `<Form>` provider, and destructuring it
|
|
19
|
-
// threw — which is what made every Form primitive, and so every *Field built
|
|
20
|
-
// on them, unusable in a plain `useState` filter bar. Inside a provider
|
|
21
|
-
// nothing below changes; outside one, the field simply has no error state.
|
|
22
|
-
const form = useFormContext();
|
|
23
|
-
const fieldState = form && fieldContext.name
|
|
24
|
-
? form.getFieldState(fieldContext.name, form.formState)
|
|
25
|
-
: undefined;
|
|
26
|
-
const { id, required, described, onDescribedChange } = itemContext;
|
|
27
|
-
return {
|
|
28
|
-
id,
|
|
29
|
-
name: fieldContext.name,
|
|
30
|
-
formItemId: `${id}-form-item`,
|
|
31
|
-
formDescriptionId: `${id}-form-item-description`,
|
|
32
|
-
formMessageId: `${id}-form-item-message`,
|
|
33
|
-
required,
|
|
34
|
-
described,
|
|
35
|
-
onDescribedChange,
|
|
36
|
-
...fieldState
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
const FormItemContext = React.createContext({});
|
|
40
|
-
/**
|
|
41
|
-
* Announce that this slot is on the page, for as long as it is.
|
|
42
|
-
*
|
|
43
|
-
* `rendered` is a parameter rather than a caller-side condition because
|
|
44
|
-
* `FormMessage` returns null when it has nothing to say, and a hook cannot sit
|
|
45
|
-
* behind that early return.
|
|
46
|
-
*/
|
|
47
|
-
function useDescribingSlot(slot, rendered) {
|
|
48
|
-
const { onDescribedChange } = React.useContext(FormItemContext);
|
|
49
|
-
React.useEffect(() => {
|
|
50
|
-
if (!rendered)
|
|
51
|
-
return;
|
|
52
|
-
onDescribedChange?.(slot, true);
|
|
53
|
-
return () => onDescribedChange?.(slot, false);
|
|
54
|
-
}, [onDescribedChange, slot, rendered]);
|
|
55
|
-
}
|
|
56
|
-
const FormItem = React.forwardRef(({ className, required, ...props }, ref) => {
|
|
57
|
-
const id = React.useId();
|
|
58
|
-
const [described, setDescribed] = React.useState({ message: false, description: false });
|
|
59
|
-
// Keeps the object identity when nothing moved, so a slot re-registering
|
|
60
|
-
// does not re-render the item for no reason.
|
|
61
|
-
const onDescribedChange = React.useCallback((slot, rendered) => setDescribed((current) => current[slot] === rendered
|
|
62
|
-
? current
|
|
63
|
-
: { ...current, [slot]: rendered }), []);
|
|
64
|
-
return (_jsx(FormItemContext.Provider, { value: { id, required, described, onDescribedChange }, children: _jsx("div", { ref: ref, className: cn('space-y-2', className), ...props }) }));
|
|
65
|
-
});
|
|
66
|
-
FormItem.displayName = 'FormItem';
|
|
67
|
-
const FormLabel = React.forwardRef(({ className, extra, children, ...props }, ref) => {
|
|
68
|
-
const { required, error, formItemId } = useFormField();
|
|
69
|
-
return (_jsxs(Label, { ref: ref, className: cn('text-muted-foreground flex justify-between text-sm font-semibold',
|
|
70
|
-
// The error TEXT token, matching FormMessage below: `--destructive`
|
|
71
|
-
// is the badge/fill family and reads 3.80:1 as ink on the dark card.
|
|
72
|
-
error && 'text-system-error-h1a', className), htmlFor: formItemId, ...props, children: [_jsxs("span", { children: [children, required ? ' *' : ''] }), extra] }));
|
|
73
|
-
});
|
|
74
|
-
FormLabel.displayName = 'FormLabel';
|
|
75
|
-
export const FormTooltip = ({ children, ...others }) => (_jsx(TooltipProvider, { ...others, children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(HelpCircle, { className: "text-container-text ml-2 h-4 w-4" }) }), _jsx(TooltipContent, { children: children })] }) }));
|
|
76
|
-
const FormControl = React.forwardRef(({ ...props }, ref) => {
|
|
77
|
-
const { error, formItemId, formDescriptionId, formMessageId, described } = useFormField();
|
|
78
|
-
// Only ids that resolve. A screen reader drops a dangling IDREF silently, so
|
|
79
|
-
// the barrier this removes is diagnostic rather than operational: a form with
|
|
80
|
-
// thirteen broken associations is a form where a real one cannot be spotted.
|
|
81
|
-
//
|
|
82
|
-
// Message first: a reader hears the error before the hint. `undefined` when
|
|
83
|
-
// both slots are empty, which drops the attribute — and, because Radix Slot
|
|
84
|
-
// OVERWRITES rather than merges, still lets the wrapped element carry its own
|
|
85
|
-
// (`ui/file-upload` merges the injected id with its own error id that way).
|
|
86
|
-
const describedBy = [
|
|
87
|
-
described?.message ? formMessageId : undefined,
|
|
88
|
-
described?.description ? formDescriptionId : undefined
|
|
89
|
-
]
|
|
90
|
-
.filter(Boolean)
|
|
91
|
-
.join(' ') || undefined;
|
|
92
|
-
return (_jsx(Slot, { ref: ref, id: formItemId, "aria-describedby": describedBy, "aria-invalid": !!error, ...props }));
|
|
93
|
-
});
|
|
94
|
-
FormControl.displayName = 'FormControl';
|
|
95
|
-
const FormDescription = React.forwardRef(({ className, ...props }, ref) => {
|
|
96
|
-
const { formDescriptionId } = useFormField();
|
|
97
|
-
useDescribingSlot('description', true);
|
|
98
|
-
return (_jsx("p", { ref: ref, id: formDescriptionId, className: cn('text-muted-foreground text-xs font-medium', className), ...props }));
|
|
99
|
-
});
|
|
100
|
-
FormDescription.displayName = 'FormDescription';
|
|
101
|
-
const FormMessage = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
102
|
-
const { error, formMessageId } = useFormField();
|
|
103
|
-
const body = error ? String(error?.message) : children;
|
|
104
|
-
// Registered on `body`, not on `error`: a message given plain children
|
|
105
|
-
// renders copy that the control has to point at too. The old expression only
|
|
106
|
-
// added the message id when react-hook-form reported an error, so a
|
|
107
|
-
// standalone message was rendered and never associated.
|
|
108
|
-
useDescribingSlot('message', Boolean(body));
|
|
109
|
-
if (!body) {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
return (_jsx("p", { ref: ref, id: formMessageId,
|
|
113
|
-
// The error TEXT token, not `text-destructive`: that is the badge/fill
|
|
114
|
-
// family and measures ~3.8:1 as ink, under AA. Validation copy is text.
|
|
115
|
-
className: cn('text-system-error-h1a text-sm font-medium', className), ...props, children: body }));
|
|
116
|
-
});
|
|
117
|
-
FormMessage.displayName = 'FormMessage';
|
|
118
|
-
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };
|
|
1
|
+
"use client";import{jsx as m,jsxs as u}from"react/jsx-runtime";import*as t from"react";import{Slot as N}from"@radix-ui/react-slot";import{Controller as v,FormProvider as w,useFormContext as S}from"react-hook-form";import{cn as f}from"../../lib/utils.js";import{Label as j}from"../../components/ui/label/index.js";import{Tooltip as R,TooltipContent as T,TooltipProvider as M,TooltipTrigger as P}from"./tooltip/index.js";import{HelpCircle as B}from"lucide-react";const L=w;const g=t.createContext({});const $=({...e})=>{return m(g.Provider,{value:{name:e.name},children:m(v,{...e})})};const c=()=>{const e=t.useContext(g);const o=t.useContext(p);const r=S();const i=r&&e.name?r.getFieldState(e.name,r.formState):void 0;const{id:s,required:d,described:n,onDescribedChange:a}=o;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,required:d,described:n,onDescribedChange:a,...i}};const p=t.createContext({});function C(e,o){const{onDescribedChange:r}=t.useContext(p);t.useEffect(()=>{if(!o)return;r?.(e,true);return()=>r?.(e,false)},[r,e,o])}const b=t.forwardRef(({className:e,required:o,...r},i)=>{const s=t.useId();const[d,n]=t.useState({message:false,description:false});const a=t.useCallback((x,F)=>n(l=>l[x]===F?l:{...l,[x]:F}),[]);return m(p.Provider,{value:{id:s,required:o,described:d,onDescribedChange:a},children:m("div",{ref:i,className:f("space-y-2",e),...r})})});b.displayName="FormItem";const h=t.forwardRef(({className:e,extra:o,children:r,...i},s)=>{const{required:d,error:n,formItemId:a}=c();return u(j,{ref:s,className:f("text-muted-foreground flex justify-between text-sm font-semibold",n&&"text-system-error-h1a",e),htmlFor:a,...i,children:[u("span",{children:[r,d?" *":""]}),o]})});h.displayName="FormLabel";export const FormTooltip=({children:e,...o})=>m(M,{...o,children:u(R,{children:[m(P,{asChild:true,children:m(B,{className:"text-container-text ml-2 h-4 w-4"})}),m(T,{children:e})]})});const I=t.forwardRef(({...e},o)=>{const{error:r,formItemId:i,formDescriptionId:s,formMessageId:d,described:n}=c();const a=[n?.message?d:void 0,n?.description?s:void 0].filter(Boolean).join(" ")||void 0;return m(N,{ref:o,id:i,"aria-describedby":a,"aria-invalid":!!r,...e})});I.displayName="FormControl";const y=t.forwardRef(({className:e,...o},r)=>{const{formDescriptionId:i}=c();C("description",true);return m("p",{ref:r,id:i,className:f("text-muted-foreground text-xs font-medium",e),...o})});y.displayName="FormDescription";const D=t.forwardRef(({className:e,children:o,...r},i)=>{const{error:s,formMessageId:d}=c();const n=s?String(s?.message):o;C("message",Boolean(n));if(!n){return null}return m("p",{ref:i,id:d,className:f("text-system-error-h1a text-sm font-medium",e),...r,children:n})});D.displayName="FormMessage";export{c as useFormField,L as Form,b as FormItem,h as FormLabel,I as FormControl,y as FormDescription,D as FormMessage,$ as FormField};
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
|
|
4
|
-
import { cn } from '../../../lib/utils.js';
|
|
5
|
-
function HoverCard({ ...props }) {
|
|
6
|
-
return _jsx(HoverCardPrimitive.Root, { "data-slot": "hover-card", ...props });
|
|
7
|
-
}
|
|
8
|
-
function HoverCardTrigger({ ...props }) {
|
|
9
|
-
return (_jsx(HoverCardPrimitive.Trigger, { "data-slot": "hover-card-trigger", ...props }));
|
|
10
|
-
}
|
|
11
|
-
function HoverCardContent({ className, align = 'center', sideOffset = 4, ...props }) {
|
|
12
|
-
return (_jsx(HoverCardPrimitive.Portal, { "data-slot": "hover-card-portal", children: _jsx(HoverCardPrimitive.Content, { "data-slot": "hover-card-content", align: align, sideOffset: sideOffset, className: cn('bg-popover text-popover-foreground motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-border z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden', className), ...props }) }));
|
|
13
|
-
}
|
|
14
|
-
export { HoverCard, HoverCardTrigger, HoverCardContent };
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import*as e from"@radix-ui/react-hover-card";import{cn as i}from"../../../lib/utils.js";function n({...t}){return o(e.Root,{"data-slot":"hover-card",...t})}function s({...t}){return o(e.Trigger,{"data-slot":"hover-card-trigger",...t})}function m({className:t,align:r="center",sideOffset:a=4,...d}){return o(e.Portal,{"data-slot":"hover-card-portal",children:o(e.Content,{"data-slot":"hover-card-content",align:r,sideOffset:a,className:i("bg-popover text-popover-foreground motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-border z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...d})})}export{n as HoverCard,s as HoverCardTrigger,m as HoverCardContent};
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
-
import { cva } from 'class-variance-authority';
|
|
4
|
-
import { buttonVariants } from '../button/index.js';
|
|
5
|
-
import { cn } from '../../../lib/utils.js';
|
|
6
|
-
export const iconButtonVariants = cva('icon-button-base icon-button-read-only icon-button-disabled', {
|
|
7
|
-
variants: {
|
|
8
|
-
rounded: {
|
|
9
|
-
true: 'icon-button-rounded',
|
|
10
|
-
false: ''
|
|
11
|
-
},
|
|
12
|
-
size: {
|
|
13
|
-
default: '',
|
|
14
|
-
small: 'icon-button-small'
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
defaultVariants: {
|
|
18
|
-
size: 'default'
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
export function IconButton({ className, variant, rounded, size, asChild, readOnly, onClick, ...props }) {
|
|
22
|
-
const Comp = asChild ? Slot : 'button';
|
|
23
|
-
const handleClick = (e) => {
|
|
24
|
-
if (readOnly) {
|
|
25
|
-
e.preventDefault();
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
onClick?.(e);
|
|
29
|
-
};
|
|
30
|
-
return (_jsx(Comp, { className: cn(buttonVariants({ variant, size }), iconButtonVariants({ rounded, size }), className), "data-read-only": readOnly, "data-slot": "button", ...props, onClick: handleClick }));
|
|
31
|
-
}
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import{Slot as d}from"@radix-ui/react-slot";import{cva as f}from"class-variance-authority";import{buttonVariants as b}from"../button/index.js";import{cn as p}from"../../../lib/utils.js";export const iconButtonVariants=f("icon-button-base icon-button-read-only icon-button-disabled",{variants:{rounded:{true:"icon-button-rounded",false:""},size:{default:"",small:"icon-button-small"}},defaultVariants:{size:"default"}});export function IconButton({className:a,variant:r,rounded:i,size:t,asChild:u,readOnly:o,onClick:e,...s}){const l=u?d:"button";const c=n=>{if(o){n.preventDefault();return}e?.(n)};return m(l,{className:p(b({variant:r,size:t}),iconButtonVariants({rounded:i,size:t}),a),"data-read-only":o,"data-slot":"button",...s,onClick:c})}
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { cn } from '../../../lib/utils.js';
|
|
3
|
-
import { cva } from 'class-variance-authority';
|
|
4
|
-
export const inputAdornmentVariants = cva('input-adornment', {
|
|
5
|
-
variants: {
|
|
6
|
-
position: {
|
|
7
|
-
start: 'input-adornment-start',
|
|
8
|
-
end: 'input-adornment-end'
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
defaultVariants: {
|
|
12
|
-
position: 'start'
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
export function InputAdornment({ className, position = 'start', ...props }) {
|
|
16
|
-
return (_jsx("span", { "data-slot": "input-adornment", className: cn(inputAdornmentVariants({ position }), className), ...props }));
|
|
17
|
-
}
|
|
1
|
+
import{jsx as a}from"react/jsx-runtime";import{cn as o}from"../../../lib/utils.js";import{cva as s}from"class-variance-authority";export const inputAdornmentVariants=s("input-adornment",{variants:{position:{start:"input-adornment-start",end:"input-adornment-end"}},defaultVariants:{position:"start"}});export function InputAdornment({className:t,position:n="start",...r}){return a("span",{"data-slot":"input-adornment",className:o(inputAdornmentVariants({position:n}),t),...r})}
|
|
@@ -1,60 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { cn } from '../../../lib/utils.js';
|
|
4
|
-
import { cva } from 'class-variance-authority';
|
|
5
|
-
const inputVariants = cva('input-base input-disabled input-read-only', {
|
|
6
|
-
variants: {
|
|
7
|
-
startAdornment: {
|
|
8
|
-
false: '',
|
|
9
|
-
true: 'input-start'
|
|
10
|
-
},
|
|
11
|
-
endAdornment: {
|
|
12
|
-
false: '',
|
|
13
|
-
true: 'input-end'
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
defaultVariants: {
|
|
17
|
-
startAdornment: false,
|
|
18
|
-
endAdornment: false
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
export function Input({ className, startAdornment, endAdornment, onFocus, onBlur, onClick, ref, ...props }) {
|
|
22
|
-
// Fallback id so a standalone Input is still labelable. Inside a form,
|
|
23
|
-
// FormControl injects its own id through `props` below and overrides this.
|
|
24
|
-
const generatedId = React.useId();
|
|
25
|
-
const [focus, setFocus] = React.useState(false);
|
|
26
|
-
const inputRef = React.useRef(null);
|
|
27
|
-
React.useImperativeHandle(ref, () => ({
|
|
28
|
-
...inputRef.current,
|
|
29
|
-
focus: () => {
|
|
30
|
-
inputRef.current?.focus();
|
|
31
|
-
setFocus(true);
|
|
32
|
-
},
|
|
33
|
-
blur: () => {
|
|
34
|
-
inputRef.current?.blur();
|
|
35
|
-
setFocus(false);
|
|
36
|
-
}
|
|
37
|
-
}), [inputRef]);
|
|
38
|
-
const handleWrapperClick = (event) => {
|
|
39
|
-
// Don't focus input if clicking on interactive elements or input adornments
|
|
40
|
-
const target = event.target;
|
|
41
|
-
const isAdornment = target.closest('[data-slot="input-adornment"]');
|
|
42
|
-
if (!isAdornment) {
|
|
43
|
-
inputRef.current?.focus();
|
|
44
|
-
}
|
|
45
|
-
onClick?.(event);
|
|
46
|
-
};
|
|
47
|
-
const handleFocus = (e) => {
|
|
48
|
-
setFocus(true);
|
|
49
|
-
onFocus?.(e);
|
|
50
|
-
};
|
|
51
|
-
const handleBlur = (e) => {
|
|
52
|
-
setFocus(false);
|
|
53
|
-
onBlur?.(e);
|
|
54
|
-
};
|
|
55
|
-
return (_jsxs("div", { "data-slot": "input-wrapper", className: cn('input-wrapper input-wrapper-focus'), "data-focus": focus, onClick: handleWrapperClick, children: [startAdornment, _jsx("input", { ref: inputRef, id: generatedId, "data-slot": "input", className: cn(inputVariants({
|
|
56
|
-
startAdornment: !!startAdornment,
|
|
57
|
-
endAdornment: !!endAdornment
|
|
58
|
-
}), className), onFocus: handleFocus, onBlur: handleBlur, ...props }), endAdornment] }));
|
|
59
|
-
}
|
|
60
|
-
export * from './adornment.js';
|
|
1
|
+
import{jsx as I,jsxs as g}from"react/jsx-runtime";import*as s from"react";import{cn as o}from"../../../lib/utils.js";import{cva as v}from"class-variance-authority";const w=v("input-base input-disabled input-read-only",{variants:{startAdornment:{false:"",true:"input-start"},endAdornment:{false:"",true:"input-end"}},defaultVariants:{startAdornment:false,endAdornment:false}});export function Input({className:u,startAdornment:r,endAdornment:a,onFocus:c,onBlur:i,onClick:l,ref:p,...d}){const f=s.useId();const[m,e]=s.useState(false);const t=s.useRef(null);s.useImperativeHandle(p,()=>({...t.current,focus:()=>{t.current?.focus();e(true)},blur:()=>{t.current?.blur();e(false)}}),[t]);const x=n=>{const h=n.target;const j=h.closest('[data-slot="input-adornment"]');if(!j){t.current?.focus()}l?.(n)};const A=n=>{e(true);c?.(n)};const b=n=>{e(false);i?.(n)};return g("div",{"data-slot":"input-wrapper",className:o("input-wrapper input-wrapper-focus"),"data-focus":m,onClick:x,children:[r,I("input",{ref:t,id:f,"data-slot":"input",className:o(w({startAdornment:!!r,endAdornment:!!a}),u),onFocus:A,onBlur:b,...d}),a]})}export*from"./adornment.js";
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
4
|
-
import { cva } from 'class-variance-authority';
|
|
5
|
-
import { cn } from '../../../lib/utils.js';
|
|
6
|
-
const labelVariants = cva('text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70');
|
|
7
|
-
function Label({ className, ...props }) {
|
|
8
|
-
return (_jsx(LabelPrimitive.Root, { "data-slot": "label", className: cn(labelVariants(), className), ...props }));
|
|
9
|
-
}
|
|
10
|
-
export { Label };
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import*as a from"@radix-ui/react-label";import{cva as r}from"class-variance-authority";import{cn as i}from"../../../lib/utils.js";const l=r("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");function s({className:e,...o}){return t(a.Root,{"data-slot":"label",className:i(l(),e),...o})}export{s as Label};
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export function LerianWordmark({ className, title = 'Lerian' }) {
|
|
3
|
-
return (_jsx("svg", { "data-slot": "lerian-wordmark", viewBox: "0 0 1090.88 280", role: "img", "aria-label": title, fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", className: className, children: _jsx("path", { fillRule: "evenodd", d: "M619.42,29.69c0,15.43-10.87,27.93-27.93,27.93s-27.93-12.51-27.93-27.93,10.86-27.93,27.92-27.93,27.93,12.51,27.93,27.93h0ZM158.64,242.4v33.54H12.13v-33.55h48.36c3.16,0,5.73-2.57,5.73-5.73V87.77c0-3.16-2.57-5.73-5.73-5.73H7.85v-34.31h98.33v188.94c0,3.16,2.57,5.73,5.73,5.73h46.74ZM168.85,179.86c0,58.52,37.29,98.33,99.47,98.33,49.15,0,79.7-30.6,86.27-67.08h-40.69c-6.29,24.54-26.97,33.91-48.61,33.91-48.85,0-53.41-45.18-53.83-55-.04-1.02.77-1.87,1.79-1.87h143.61c.76-5.26,1.13-10.42,1.13-15.44,0-32.71-20.25-91.92-95.33-91.92-57.04,0-93.8,41.26-93.81,99.07ZM314.47,158.39l-99.49.02c-1.08,0-1.94-.96-1.78-2.02,4.49-31.28,30.98-42.82,50.98-42.82,33.88,0,48.71,21.59,52.08,42.79.17,1.08-.69,2.04-1.78,2.04h0ZM867.2,83.16h0s0,0,0,0h0ZM826.87,83.16h40.33v192.83h-40.32v-24.53c0-3.09-3.92-4.41-5.79-1.95-.18.23-.35.47-.53.71h0s0,.02,0,.02h0c-.11.16-.23.32-.35.47-7.92,10.56-20.68,27.53-56.24,27.53-60.83,0-91.19-46.33-91.19-98.7,0-61.42,40.37-98.72,91.17-98.72,36.73,0,48.44,15.73,56.64,26.75l.49.66c1.86,2.49,5.81,1.18,5.81-1.93v-23.14ZM770.75,115.48c34.78,0,56.14,27.81,56.14,64.8h0c0,42-26.32,63.68-56.14,63.68-34.83,0-56.14-27.43-56.14-64.43,0-42.07,26.11-64.05,56.14-64.05ZM1063.39,101.7c14.42,14.06,21.64,36.67,21.64,67.8v106.25h-41.06v-103.99c0-43.98-22.35-56.14-45.96-56.14-31.99,0-51.6,23.22-51.6,62.92v97.21h-40.68V83.15h39.93v25.07c0,3.11,3.95,4.4,5.82,1.92,8.55-11.4,26.72-29.52,55.98-29.52,37.55,0,55.75,20.88,55.93,21.08ZM657.42,275.94v-33.54h0s-37.37,0-37.37,0c-3.16,0-5.73-2.57-5.73-5.73V83.14h-81.34v34.31h37.54c3.16,0,5.73,2.57,5.73,5.73v113.48c0,3.16-2.57,5.73-5.73,5.73h-38.14v33.55h125.03ZM499.27,119.27c0,.13-.1.23-.23.23h0s-36.31,0-36.31,0c-28.68,0-28.65,24.99-28.64,43.62,0,.46,0,.92,0,1.37v111.24c0,.13-.1.23-.23.23h-41.01c-.13,0-.23-.1-.23-.23V83.27c0-.13.1-.23.23-.23h36.49c.13,0,.23.1.23.23v24.03c0,4.05,5.24,5.65,7.49,2.28.22-.32.43-.64.65-.97,8.18-12.25,18.71-28.02,52.51-28.02h9.05v38.68Z" }) }));
|
|
4
|
-
}
|
|
1
|
+
import{jsx as c}from"react/jsx-runtime";export function LerianWordmark({className:h,title:v="Lerian"}){return c("svg",{"data-slot":"lerian-wordmark",viewBox:"0 0 1090.88 280",role:"img","aria-label":v,fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:h,children:c("path",{fillRule:"evenodd",d:"M619.42,29.69c0,15.43-10.87,27.93-27.93,27.93s-27.93-12.51-27.93-27.93,10.86-27.93,27.92-27.93,27.93,12.51,27.93,27.93h0ZM158.64,242.4v33.54H12.13v-33.55h48.36c3.16,0,5.73-2.57,5.73-5.73V87.77c0-3.16-2.57-5.73-5.73-5.73H7.85v-34.31h98.33v188.94c0,3.16,2.57,5.73,5.73,5.73h46.74ZM168.85,179.86c0,58.52,37.29,98.33,99.47,98.33,49.15,0,79.7-30.6,86.27-67.08h-40.69c-6.29,24.54-26.97,33.91-48.61,33.91-48.85,0-53.41-45.18-53.83-55-.04-1.02.77-1.87,1.79-1.87h143.61c.76-5.26,1.13-10.42,1.13-15.44,0-32.71-20.25-91.92-95.33-91.92-57.04,0-93.8,41.26-93.81,99.07ZM314.47,158.39l-99.49.02c-1.08,0-1.94-.96-1.78-2.02,4.49-31.28,30.98-42.82,50.98-42.82,33.88,0,48.71,21.59,52.08,42.79.17,1.08-.69,2.04-1.78,2.04h0ZM867.2,83.16h0s0,0,0,0h0ZM826.87,83.16h40.33v192.83h-40.32v-24.53c0-3.09-3.92-4.41-5.79-1.95-.18.23-.35.47-.53.71h0s0,.02,0,.02h0c-.11.16-.23.32-.35.47-7.92,10.56-20.68,27.53-56.24,27.53-60.83,0-91.19-46.33-91.19-98.7,0-61.42,40.37-98.72,91.17-98.72,36.73,0,48.44,15.73,56.64,26.75l.49.66c1.86,2.49,5.81,1.18,5.81-1.93v-23.14ZM770.75,115.48c34.78,0,56.14,27.81,56.14,64.8h0c0,42-26.32,63.68-56.14,63.68-34.83,0-56.14-27.43-56.14-64.43,0-42.07,26.11-64.05,56.14-64.05ZM1063.39,101.7c14.42,14.06,21.64,36.67,21.64,67.8v106.25h-41.06v-103.99c0-43.98-22.35-56.14-45.96-56.14-31.99,0-51.6,23.22-51.6,62.92v97.21h-40.68V83.15h39.93v25.07c0,3.11,3.95,4.4,5.82,1.92,8.55-11.4,26.72-29.52,55.98-29.52,37.55,0,55.75,20.88,55.93,21.08ZM657.42,275.94v-33.54h0s-37.37,0-37.37,0c-3.16,0-5.73-2.57-5.73-5.73V83.14h-81.34v34.31h37.54c3.16,0,5.73,2.57,5.73,5.73v113.48c0,3.16-2.57,5.73-5.73,5.73h-38.14v33.55h125.03ZM499.27,119.27c0,.13-.1.23-.23.23h0s-36.31,0-36.31,0c-28.68,0-28.65,24.99-28.64,43.62,0,.46,0,.92,0,1.37v111.24c0,.13-.1.23-.23.23h-41.01c-.13,0-.23-.1-.23-.23V83.27c0-.13.1-.23.23-.23h36.49c.13,0,.23.1.23.23v24.03c0,4.05,5.24,5.65,7.49,2.28.22-.32.43-.64.65-.97,8.18-12.25,18.71-28.02,52.51-28.02h9.05v38.68Z"})})}
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Button } from '../button/index.js';
|
|
3
|
-
import { Loader2 } from 'lucide-react';
|
|
4
|
-
function LoadingButton({ loading, disabled, children, ...props }) {
|
|
5
|
-
return (_jsxs(Button, { ...props, disabled: loading || disabled, children: [loading && _jsx(Loader2, { className: "mr-2 h-4 w-4 motion-safe:animate-spin" }), children] }));
|
|
6
|
-
}
|
|
7
|
-
export { LoadingButton };
|
|
1
|
+
import{jsx as m,jsxs as a}from"react/jsx-runtime";import{Button as i}from"../button/index.js";import{Loader2 as n}from"lucide-react";function e({loading:o,disabled:s,children:r,...t}){return a(i,{...t,disabled:o||s,children:[o&&m(n,{className:"mr-2 h-4 w-4 motion-safe:animate-spin"}),r]})}export{e as LoadingButton};
|
|
@@ -1,196 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
5
|
-
import { ChevronDown, X } from 'lucide-react';
|
|
6
|
-
import { Badge } from '../badge/index.js';
|
|
7
|
-
import { cn } from '../../../lib/utils.js';
|
|
8
|
-
import { Separator } from '../separator/index.js';
|
|
9
|
-
import { Command as CommandPrimitive, useCommandState } from 'cmdk';
|
|
10
|
-
import { useClickAway } from '../../../hooks/use-click-away.js';
|
|
11
|
-
const MultipleSelectContext = React.createContext({
|
|
12
|
-
value: [],
|
|
13
|
-
onValueChange: (values) => values,
|
|
14
|
-
handleChange: (value) => value,
|
|
15
|
-
handleClear: () => { },
|
|
16
|
-
setOpen: () => { },
|
|
17
|
-
setOnScrollbar: () => { },
|
|
18
|
-
options: {},
|
|
19
|
-
addOption: (option) => option,
|
|
20
|
-
inputRef: React.createRef()
|
|
21
|
-
});
|
|
22
|
-
const useMultipleSelect = () => {
|
|
23
|
-
const context = React.useContext(MultipleSelectContext);
|
|
24
|
-
if (!context) {
|
|
25
|
-
throw new Error('useMultipleSelect must be used within a MultipleSelectProvider');
|
|
26
|
-
}
|
|
27
|
-
return context;
|
|
28
|
-
};
|
|
29
|
-
export const MultipleSelectTrigger = React.forwardRef(({ className, children, readOnly }, ref) => {
|
|
30
|
-
const _ref = React.useRef(null);
|
|
31
|
-
const { open, setOpen, onScrollbar, disabled, value, inputRef, handleClear } = useMultipleSelect();
|
|
32
|
-
React.useImperativeHandle(ref, () => _ref.current);
|
|
33
|
-
useClickAway(_ref, () => {
|
|
34
|
-
// Should not close when clicking on the scrollbar
|
|
35
|
-
if (onScrollbar) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
setOpen(false);
|
|
39
|
-
inputRef.current?.blur();
|
|
40
|
-
});
|
|
41
|
-
return (_jsxs("div", { ref: _ref, className: cn('bg-background ring-offset-background placeholder:text-input-placeholder focus:ring-ring border-input-border flex flex-row rounded-md border text-sm focus:ring-2 focus:ring-offset-0 focus:outline-hidden focus-visible:outline-hidden md:text-sm [&>span]:line-clamp-1', {
|
|
42
|
-
'h-10': value.length === 0,
|
|
43
|
-
'min-h-10': value.length > 0,
|
|
44
|
-
'cursor-text': !disabled && !readOnly && value.length !== 0,
|
|
45
|
-
'bg-shadcn-100 cursor-not-allowed opacity-50': disabled
|
|
46
|
-
}, readOnly && [
|
|
47
|
-
'data-read-only:cursor-default',
|
|
48
|
-
'data-read-only:select-text',
|
|
49
|
-
'data-read-only:bg-muted',
|
|
50
|
-
'data-read-only:opacity-50',
|
|
51
|
-
'data-read-only:pointer-events-none',
|
|
52
|
-
'data-read-only:focus:outline-hidden',
|
|
53
|
-
'data-read-only:focus:ring-0'
|
|
54
|
-
], className), "data-read-only": readOnly ? '' : undefined, onClick: (e) => {
|
|
55
|
-
// Redirect focus to the input field when clicking on the container
|
|
56
|
-
if (disabled || readOnly) {
|
|
57
|
-
e.preventDefault();
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (open) {
|
|
61
|
-
inputRef?.current?.blur();
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
inputRef?.current?.focus();
|
|
65
|
-
}
|
|
66
|
-
setOpen(!open);
|
|
67
|
-
}, children: [_jsx("div", { className: "flex grow flex-wrap gap-1 px-3 py-2", children: children }), _jsxs("div", { className: "flex flex-1 items-center justify-end", children: [_jsx("button", { type: "button", className: cn((disabled || readOnly || value.length < 1) && 'hidden'), children: _jsx(X, { className: "text-muted-foreground mx-2 h-4 cursor-pointer", onClick: (event) => {
|
|
68
|
-
event.stopPropagation();
|
|
69
|
-
handleClear();
|
|
70
|
-
} }) }), _jsx(Separator, { orientation: "vertical", className: cn('flex h-full min-h-6', (disabled || readOnly || value.length < 1) && 'hidden') }), _jsx(SelectPrimitive.Icon, { children: _jsx(ChevronDown, { className: cn('mx-3 my-2 h-4 w-4 cursor-pointer opacity-50', readOnly && 'hidden') }) })] })] }));
|
|
71
|
-
});
|
|
72
|
-
MultipleSelectTrigger.displayName = 'MultipleSelectTrigger';
|
|
73
|
-
export const MultipleSelectValue = React.forwardRef(({ className, ...props }, ref) => {
|
|
74
|
-
const { value, disabled, handleChange, options, showValue, inputRef } = useMultipleSelect();
|
|
75
|
-
React.useImperativeHandle(ref, () => inputRef.current);
|
|
76
|
-
return (_jsxs(_Fragment, { children: [options &&
|
|
77
|
-
value?.map((value) => (_jsxs(Badge, { variant: "secondary", className: cn('data-disabled:bg-muted-foreground data-fixed:bg-muted-foreground data-disabled:text-muted data-fixed:text-muted data-disabled:hover:bg-muted-foreground data-fixed:hover:bg-muted-foreground'), children: [showValue ? value : options[value], _jsx("button", { type: "button", className: cn('ring-offset-background focus:ring-ring ml-1 rounded-full outline-hidden focus:ring-2 focus:ring-offset-2', disabled && 'hidden'), children: _jsx(X, { className: "text-muted-foreground hover:text-foreground h-3 w-3", onClick: (event) => {
|
|
78
|
-
event.stopPropagation();
|
|
79
|
-
handleChange(value);
|
|
80
|
-
} }) })] }, value))), _jsx(CommandPrimitive.Input, { ...props, ref: inputRef, disabled: disabled, className: cn('placeholder:text-input-placeholder bg-transparent outline-hidden focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50 disabled:placeholder:opacity-0', className) })] }));
|
|
81
|
-
});
|
|
82
|
-
MultipleSelectValue.displayName = 'MultipleSelectValue';
|
|
83
|
-
export const MultipleSelectEmpty = React.forwardRef(({ className, ...props }, forwardedRef) => {
|
|
84
|
-
const render = useCommandState((state) => state.filtered.count === 0);
|
|
85
|
-
if (!render)
|
|
86
|
-
return null;
|
|
87
|
-
return (_jsx("div", { ref: forwardedRef, className: cn('py-6 text-center text-sm', className), "cmdk-empty": "", role: "presentation", ...props }));
|
|
88
|
-
});
|
|
89
|
-
MultipleSelectEmpty.displayName = 'MultipleSelectEmpty';
|
|
90
|
-
export const MultipleSelectContent = React.forwardRef(({ className, position = 'popper', children, onMouseEnter, onMouseLeave, ...props }, ref) => {
|
|
91
|
-
const { open, addOption, setOnScrollbar } = useMultipleSelect();
|
|
92
|
-
// Since this component is not going to be rendered in the DOM until open is true,
|
|
93
|
-
// we need to register the options when the component mounts
|
|
94
|
-
// and when the children change.
|
|
95
|
-
React.useEffect(() => {
|
|
96
|
-
React.Children.forEach(React.Children.toArray(children), (child) => {
|
|
97
|
-
if (React.isValidElement(child) &&
|
|
98
|
-
child.props.value) {
|
|
99
|
-
addOption({ [child.props.value]: child.props.children });
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
}, [children]);
|
|
103
|
-
if (!open) {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
return (_jsx("div", { className: "relative", children: _jsx(CommandPrimitive.List, { ref: ref, className: cn('bg-popover text-popover-foreground motion-safe:animate-in absolute top-1 z-50 max-h-96 w-full min-w-32 overflow-x-hidden overflow-y-auto rounded-md border shadow-md outline-hidden', position === 'popper' &&
|
|
107
|
-
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1', className), ...props, onMouseEnter: (e) => {
|
|
108
|
-
onMouseEnter?.(e);
|
|
109
|
-
setOnScrollbar(true);
|
|
110
|
-
}, onMouseLeave: (e) => {
|
|
111
|
-
onMouseLeave?.(e);
|
|
112
|
-
setOnScrollbar(false);
|
|
113
|
-
}, children: _jsx(MultipleSelectGroup, { children: children }) }) }));
|
|
114
|
-
});
|
|
115
|
-
MultipleSelectContent.displayName = 'MultipleSelectContent';
|
|
116
|
-
export const MultipleSelectGroup = React.forwardRef(({ className, ...props }, ref) => (_jsx(CommandPrimitive.Group, { ref: ref, className: cn('text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium', className), ...props })));
|
|
117
|
-
MultipleSelectGroup.displayName = 'MultipleSelectGroup';
|
|
118
|
-
export const MultipleSelectItem = React.forwardRef(({ className, value, onClick: _onClick, onSelect, children, ...props }, ref) => {
|
|
119
|
-
const { handleChange } = useMultipleSelect();
|
|
120
|
-
return (_jsx(CommandPrimitive.Item, { ref: ref, value: value, keywords: typeof children === 'string' ? [children] : undefined, className: cn('data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', className), ...props, onMouseDown: (e) => {
|
|
121
|
-
e.preventDefault();
|
|
122
|
-
e.stopPropagation();
|
|
123
|
-
}, onSelect: (value) => {
|
|
124
|
-
handleChange(value);
|
|
125
|
-
onSelect?.(value);
|
|
126
|
-
}, children: children }));
|
|
127
|
-
});
|
|
128
|
-
MultipleSelectItem.displayName = 'MultipleSelectItem';
|
|
129
|
-
export const MultipleSelect = React.forwardRef(({ value, defaultValue, onValueChange, className, showValue, disabled, onKeyDown, children, onChange: _onChange, ...props }, ref) => {
|
|
130
|
-
const _ref = React.useRef(null);
|
|
131
|
-
const [open, setOpen] = React.useState(false);
|
|
132
|
-
const inputRef = React.useRef(null);
|
|
133
|
-
const [onScrollbar, setOnScrollbar] = React.useState(false);
|
|
134
|
-
const safeValue = Array.isArray(value) ? value : [];
|
|
135
|
-
const safeDefault = Array.isArray(defaultValue) ? defaultValue : [];
|
|
136
|
-
const [selected, setSelected] = React.useState(safeDefault.length > 0 ? safeDefault : safeValue);
|
|
137
|
-
const [options, addOption] = React.useReducer((prev, state) => ({
|
|
138
|
-
...prev,
|
|
139
|
-
...state
|
|
140
|
-
}), {});
|
|
141
|
-
React.useImperativeHandle(ref, () => _ref.current);
|
|
142
|
-
const handleClear = () => {
|
|
143
|
-
setSelected([]);
|
|
144
|
-
onValueChange?.([]);
|
|
145
|
-
};
|
|
146
|
-
const handleChange = React.useCallback((value) => {
|
|
147
|
-
if (!value) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
const newSelected = selected.includes(value)
|
|
151
|
-
? selected.filter((item) => item !== value)
|
|
152
|
-
: [...selected, value];
|
|
153
|
-
setSelected(newSelected);
|
|
154
|
-
onValueChange?.(newSelected);
|
|
155
|
-
}, [selected, onValueChange]);
|
|
156
|
-
const handleKeyDown = React.useCallback((e) => {
|
|
157
|
-
const input = inputRef.current;
|
|
158
|
-
if (input) {
|
|
159
|
-
if (e.key === 'Delete' || e.key === 'Backspace') {
|
|
160
|
-
if (input.value === '' && selected.length > 0) {
|
|
161
|
-
handleChange(selected[selected.length - 1]);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
// This is not a default behavior of the <input /> field
|
|
165
|
-
if (e.key === 'Escape') {
|
|
166
|
-
e.stopPropagation();
|
|
167
|
-
input.blur();
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}, [selected, handleChange]);
|
|
171
|
-
// Keeps the selected value in sync with the value prop
|
|
172
|
-
React.useEffect(() => {
|
|
173
|
-
if (Array.isArray(value)) {
|
|
174
|
-
setSelected(value);
|
|
175
|
-
}
|
|
176
|
-
}, [value]);
|
|
177
|
-
return (_jsx(MultipleSelectContext.Provider, { value: {
|
|
178
|
-
value: selected,
|
|
179
|
-
onValueChange: setSelected,
|
|
180
|
-
showValue,
|
|
181
|
-
disabled,
|
|
182
|
-
handleChange,
|
|
183
|
-
handleClear,
|
|
184
|
-
onScrollbar,
|
|
185
|
-
setOnScrollbar,
|
|
186
|
-
open,
|
|
187
|
-
setOpen,
|
|
188
|
-
options,
|
|
189
|
-
addOption,
|
|
190
|
-
inputRef
|
|
191
|
-
}, children: _jsx(CommandPrimitive, { ref: _ref, className: cn('text-foreground flex h-auto w-full flex-col overflow-visible rounded-md bg-transparent', className), "aria-disabled": disabled, ...props, onKeyDown: (e) => {
|
|
192
|
-
handleKeyDown(e);
|
|
193
|
-
onKeyDown?.(e);
|
|
194
|
-
}, children: children }) }));
|
|
195
|
-
});
|
|
196
|
-
MultipleSelect.displayName = 'MultipleSelect';
|
|
1
|
+
"use client";import{jsx as n,jsxs as w,Fragment as H}from"react/jsx-runtime";import e from"react";import*as O from"@radix-ui/react-select";import{ChevronDown as z,X as M}from"lucide-react";import{Badge as B}from"../badge/index.js";import{cn as u}from"../../../lib/utils.js";import{Separator as F}from"../separator/index.js";import{Command as b,useCommandState as K}from"cmdk";import{useClickAway as L}from"../../../hooks/use-click-away.js";const R=e.createContext({value:[],onValueChange:t=>t,handleChange:t=>t,handleClear:()=>{},setOpen:()=>{},setOnScrollbar:()=>{},options:{},addOption:t=>t,inputRef:e.createRef()});const S=()=>{const t=e.useContext(R);if(!t){throw new Error("useMultipleSelect must be used within a MultipleSelectProvider")}return t};export const MultipleSelectTrigger=e.forwardRef(({className:t,children:s,readOnly:r},c)=>{const a=e.useRef(null);const{open:p,setOpen:f,onScrollbar:m,disabled:o,value:d,inputRef:l,handleClear:y}=S();e.useImperativeHandle(c,()=>a.current);L(a,()=>{if(m){return}f(false);l.current?.blur()});return w("div",{ref:a,className:u("bg-background ring-offset-background placeholder:text-input-placeholder focus:ring-ring border-input-border flex flex-row rounded-md border text-sm focus:ring-2 focus:ring-offset-0 focus:outline-hidden focus-visible:outline-hidden md:text-sm [&>span]:line-clamp-1",{"h-10":d.length===0,"min-h-10":d.length>0,"cursor-text":!o&&!r&&d.length!==0,"bg-shadcn-100 cursor-not-allowed opacity-50":o},r&&["data-read-only:cursor-default","data-read-only:select-text","data-read-only:bg-muted","data-read-only:opacity-50","data-read-only:pointer-events-none","data-read-only:focus:outline-hidden","data-read-only:focus:ring-0"],t),"data-read-only":r?"":void 0,onClick:x=>{if(o||r){x.preventDefault();return}if(p){l?.current?.blur()}else{l?.current?.focus()}f(!p)},children:[n("div",{className:"flex grow flex-wrap gap-1 px-3 py-2",children:s}),w("div",{className:"flex flex-1 items-center justify-end",children:[n("button",{type:"button",className:u((o||r||d.length<1)&&"hidden"),children:n(M,{className:"text-muted-foreground mx-2 h-4 cursor-pointer",onClick:x=>{x.stopPropagation();y()}})}),n(F,{orientation:"vertical",className:u("flex h-full min-h-6",(o||r||d.length<1)&&"hidden")}),n(O.Icon,{children:n(z,{className:u("mx-3 my-2 h-4 w-4 cursor-pointer opacity-50",r&&"hidden")})})]})]})});MultipleSelectTrigger.displayName="MultipleSelectTrigger";export const MultipleSelectValue=e.forwardRef(({className:t,...s},r)=>{const{value:c,disabled:a,handleChange:p,options:f,showValue:m,inputRef:o}=S();e.useImperativeHandle(r,()=>o.current);return w(H,{children:[f&&c?.map(d=>w(B,{variant:"secondary",className:u("data-disabled:bg-muted-foreground data-fixed:bg-muted-foreground data-disabled:text-muted data-fixed:text-muted data-disabled:hover:bg-muted-foreground data-fixed:hover:bg-muted-foreground"),children:[m?d:f[d],n("button",{type:"button",className:u("ring-offset-background focus:ring-ring ml-1 rounded-full outline-hidden focus:ring-2 focus:ring-offset-2",a&&"hidden"),children:n(M,{className:"text-muted-foreground hover:text-foreground h-3 w-3",onClick:l=>{l.stopPropagation();p(d)}})})]},d)),n(b.Input,{...s,ref:o,disabled:a,className:u("placeholder:text-input-placeholder bg-transparent outline-hidden focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-50 disabled:placeholder:opacity-0",t)})]})});MultipleSelectValue.displayName="MultipleSelectValue";export const MultipleSelectEmpty=e.forwardRef(({className:t,...s},r)=>{const c=K(a=>a.filtered.count===0);if(!c)return null;return n("div",{ref:r,className:u("py-6 text-center text-sm",t),"cmdk-empty":"",role:"presentation",...s})});MultipleSelectEmpty.displayName="MultipleSelectEmpty";export const MultipleSelectContent=e.forwardRef(({className:t,position:s="popper",children:r,onMouseEnter:c,onMouseLeave:a,...p},f)=>{const{open:m,addOption:o,setOnScrollbar:d}=S();e.useEffect(()=>{e.Children.forEach(e.Children.toArray(r),l=>{if(e.isValidElement(l)&&l.props.value){o({[l.props.value]:l.props.children})}})},[r]);if(!m){return null}return n("div",{className:"relative",children:n(b.List,{ref:f,className:u("bg-popover text-popover-foreground motion-safe:animate-in absolute top-1 z-50 max-h-96 w-full min-w-32 overflow-x-hidden overflow-y-auto rounded-md border shadow-md outline-hidden",s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),...p,onMouseEnter:l=>{c?.(l);d(true)},onMouseLeave:l=>{a?.(l);d(false)},children:n(MultipleSelectGroup,{children:r})})})});MultipleSelectContent.displayName="MultipleSelectContent";export const MultipleSelectGroup=e.forwardRef(({className:t,...s},r)=>n(b.Group,{ref:r,className:u("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),...s}));MultipleSelectGroup.displayName="MultipleSelectGroup";export const MultipleSelectItem=e.forwardRef(({className:t,value:s,onClick:r,onSelect:c,children:a,...p},f)=>{const{handleChange:m}=S();return n(b.Item,{ref:f,value:s,keywords:typeof a==="string"?[a]:void 0,className:u("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...p,onMouseDown:o=>{o.preventDefault();o.stopPropagation()},onSelect:o=>{m(o);c?.(o)},children:a})});MultipleSelectItem.displayName="MultipleSelectItem";export const MultipleSelect=e.forwardRef(({value:t,defaultValue:s,onValueChange:r,className:c,showValue:a,disabled:p,onKeyDown:f,children:m,onChange:o,...d},l)=>{const y=e.useRef(null);const[x,_]=e.useState(false);const N=e.useRef(null);const[E,A]=e.useState(false);const D=Array.isArray(t)?t:[];const k=Array.isArray(s)?s:[];const[g,v]=e.useState(k.length>0?k:D);const[I,P]=e.useReducer((i,h)=>({...i,...h}),{});e.useImperativeHandle(l,()=>y.current);const j=()=>{v([]);r?.([])};const C=e.useCallback(i=>{if(!i){return}const h=g.includes(i)?g.filter(G=>G!==i):[...g,i];v(h);r?.(h)},[g,r]);const V=e.useCallback(i=>{const h=N.current;if(h){if(i.key==="Delete"||i.key==="Backspace"){if(h.value===""&&g.length>0){C(g[g.length-1])}}if(i.key==="Escape"){i.stopPropagation();h.blur()}}},[g,C]);e.useEffect(()=>{if(Array.isArray(t)){v(t)}},[t]);return n(R.Provider,{value:{value:g,onValueChange:v,showValue:a,disabled:p,handleChange:C,handleClear:j,onScrollbar:E,setOnScrollbar:A,open:x,setOpen:_,options:I,addOption:P,inputRef:N},children:n(b,{ref:y,className:u("text-foreground flex h-auto w-full flex-col overflow-visible rounded-md bg-transparent",c),"aria-disabled":p,...d,onKeyDown:i=>{V(i);f?.(i)},children:m})})});MultipleSelect.displayName="MultipleSelect";
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { OTPInput, OTPInputContext } from 'input-otp';
|
|
4
|
-
import { MinusIcon } from 'lucide-react';
|
|
5
|
-
import { cn } from '../../../lib/utils.js';
|
|
6
|
-
function InputOTP({ className, containerClassName, ...props }) {
|
|
7
|
-
return (_jsx(OTPInput, { "data-slot": "input-otp", containerClassName: cn('flex items-center gap-2 has-disabled:opacity-50', containerClassName), className: cn('disabled:cursor-not-allowed', className), ...props }));
|
|
8
|
-
}
|
|
9
|
-
function InputOTPGroup({ className, ...props }) {
|
|
10
|
-
return (_jsx("div", { "data-slot": "input-otp-group", className: cn('flex items-center', className), ...props }));
|
|
11
|
-
}
|
|
12
|
-
function InputOTPSlot({ index, className, ...props }) {
|
|
13
|
-
const inputOTPContext = React.useContext(OTPInputContext);
|
|
14
|
-
const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
|
|
15
|
-
return (_jsxs("div", { "data-slot": "input-otp-slot", "data-active": isActive, className: cn('border-input-border bg-background text-foreground', 'relative flex h-14 w-12 items-center justify-center border-y border-r text-2xl font-semibold shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md', 'data-[active=true]:ring-ring data-[active=true]:z-10 data-[active=true]:ring-2', className), ...props, children: [char, hasFakeCaret && (_jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: _jsx("div", { className: "motion-safe:animate-caret-blink bg-foreground h-6 w-px duration-1000" }) }))] }));
|
|
16
|
-
}
|
|
17
|
-
function InputOTPSeparator({ ...props }) {
|
|
18
|
-
return (_jsx("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: _jsx(MinusIcon, {}) }));
|
|
19
|
-
}
|
|
20
|
-
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
|
|
21
|
-
export { REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS } from 'input-otp';
|
|
1
|
+
import{jsx as e,jsxs as u}from"react/jsx-runtime";import*as l from"react";import{OTPInput as c,OTPInputContext as p}from"input-otp";import{MinusIcon as m}from"lucide-react";import{cn as o}from"../../../lib/utils.js";function f({className:t,containerClassName:r,...n}){return e(c,{"data-slot":"input-otp",containerClassName:o("flex items-center gap-2 has-disabled:opacity-50",r),className:o("disabled:cursor-not-allowed",t),...n})}function x({className:t,...r}){return e("div",{"data-slot":"input-otp-group",className:o("flex items-center",t),...r})}function b({index:t,className:r,...n}){const a=l.useContext(p);const{char:s,hasFakeCaret:i,isActive:d}=a?.slots[t]??{};return u("div",{"data-slot":"input-otp-slot","data-active":d,className:o("border-input-border bg-background text-foreground","relative flex h-14 w-12 items-center justify-center border-y border-r text-2xl font-semibold shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md","data-[active=true]:ring-ring data-[active=true]:z-10 data-[active=true]:ring-2",r),...n,children:[s,i&&e("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e("div",{className:"motion-safe:animate-caret-blink bg-foreground h-6 w-px duration-1000"})})]})}function v({...t}){return e("div",{"data-slot":"input-otp-separator",role:"separator",...t,children:e(m,{})})}export{f as InputOTP,x as InputOTPGroup,b as InputOTPSlot,v as InputOTPSeparator};export{REGEXP_ONLY_DIGITS,REGEXP_ONLY_DIGITS_AND_CHARS}from"input-otp";
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { cn } from '../../../lib/utils.js';
|
|
3
|
-
export function Paper({ className, ...others }) {
|
|
4
|
-
return (_jsx("div", { "data-slot": "paper", className: cn('bg-card rounded-lg shadow-lg', className), ...others }));
|
|
5
|
-
}
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{cn as s}from"../../../lib/utils.js";export function Paper({className:r,...a}){return o("div",{"data-slot":"paper",className:s("bg-card rounded-lg shadow-lg",r),...a})}
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { cn } from '../../../lib/utils.js';
|
|
3
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../../../components/ui/collapsible/index.js';
|
|
4
|
-
import { Paper } from '../../../components/ui/paper/index.js';
|
|
5
|
-
import { ChevronDown } from 'lucide-react';
|
|
6
|
-
import { Separator } from '../separator/index.js';
|
|
7
|
-
function PaperCollapsible({ className, children, ...props }) {
|
|
8
|
-
return (_jsx(Collapsible, { className: "group/paper-collapsible", ...props, children: _jsx(Paper, { "data-slot": "paper-collapsible", className: cn('flex flex-col', className), children: children }) }));
|
|
9
|
-
}
|
|
10
|
-
function PaperCollapsibleBanner({ className, children, ...props }) {
|
|
11
|
-
return (_jsxs("div", { "data-slot": "paper-collapsible-banner", className: cn('flex flex-row p-6', className), ...props, children: [_jsx("div", { className: "flex grow flex-col", children: children }), _jsx(PaperCollapsibleTrigger, {})] }));
|
|
12
|
-
}
|
|
13
|
-
function PaperCollapsibleTrigger({ className, children: _children, ...props }) {
|
|
14
|
-
return (_jsx(CollapsibleTrigger, { "data-slot": "paper-collapsible-trigger", className: cn('transition-all hover:underline [&[data-state=open]>svg]:rotate-180', className), ...props, children: _jsx(ChevronDown, { className: "text-foreground size-6 shrink-0 cursor-pointer transition-transform duration-200" }) }));
|
|
15
|
-
}
|
|
16
|
-
function PaperCollapsibleContent({ className, children, ...props }) {
|
|
17
|
-
return (_jsxs(CollapsibleContent, { "data-slot": "paper-collapsible-content", className: cn('motion-safe:data-[state=closed]:animate-collapsible-up motion-safe:data-[state=open]:animate-collapsible-down overflow-hidden transition-all duration-200 ease-in-out', className), ...props, children: [_jsx(Separator, {}), children] }));
|
|
18
|
-
}
|
|
19
|
-
export { PaperCollapsible, PaperCollapsibleBanner, PaperCollapsibleTrigger, PaperCollapsibleContent };
|
|
1
|
+
import{jsx as l,jsxs as t}from"react/jsx-runtime";import{cn as o}from"../../../lib/utils.js";import{Collapsible as i,CollapsibleContent as s,CollapsibleTrigger as p}from"../../../components/ui/collapsible/index.js";import{Paper as c}from"../../../components/ui/paper/index.js";import{ChevronDown as d}from"lucide-react";import{Separator as m}from"../separator/index.js";function f({className:e,children:r,...a}){return l(i,{className:"group/paper-collapsible",...a,children:l(c,{"data-slot":"paper-collapsible",className:o("flex flex-col",e),children:r})})}function u({className:e,children:r,...a}){return t("div",{"data-slot":"paper-collapsible-banner",className:o("flex flex-row p-6",e),...a,children:[l("div",{className:"flex grow flex-col",children:r}),l(n,{})]})}function n({className:e,children:r,...a}){return l(p,{"data-slot":"paper-collapsible-trigger",className:o("transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...a,children:l(d,{className:"text-foreground size-6 shrink-0 cursor-pointer transition-transform duration-200"})})}function b({className:e,children:r,...a}){return t(s,{"data-slot":"paper-collapsible-content",className:o("motion-safe:data-[state=closed]:animate-collapsible-up motion-safe:data-[state=open]:animate-collapsible-down overflow-hidden transition-all duration-200 ease-in-out",e),...a,children:[l(m,{}),r]})}export{f as PaperCollapsible,u as PaperCollapsibleBanner,n as PaperCollapsibleTrigger,b as PaperCollapsibleContent};
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
4
|
-
import { cn } from '../../../lib/utils.js';
|
|
5
|
-
function Popover({ ...props }) {
|
|
6
|
-
return _jsx(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
7
|
-
}
|
|
8
|
-
function PopoverTrigger({ ...props }) {
|
|
9
|
-
return _jsx(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
10
|
-
}
|
|
11
|
-
function PopoverContent({ className, align = 'center', sideOffset = 4, ...props }) {
|
|
12
|
-
return (_jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { "data-slot": "popover-content", align: align, sideOffset: sideOffset, className: cn('bg-popover text-popover-foreground motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-border z-50 w-72 rounded-md border p-4 shadow-md outline-hidden', className), ...props }) }));
|
|
13
|
-
}
|
|
14
|
-
function PopoverAnchor({ ...props }) {
|
|
15
|
-
return _jsx(PopoverPrimitive.Anchor, { "data-slot": "popover-anchor", ...props });
|
|
16
|
-
}
|
|
17
|
-
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import*as e from"@radix-ui/react-popover";import{cn as d}from"../../../lib/utils.js";function i({...o}){return t(e.Root,{"data-slot":"popover",...o})}function s({...o}){return t(e.Trigger,{"data-slot":"popover-trigger",...o})}function p({className:o,align:r="center",sideOffset:a=4,...n}){return t(e.Portal,{children:t(e.Content,{"data-slot":"popover-content",align:r,sideOffset:a,className:d("bg-popover text-popover-foreground motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-border z-50 w-72 rounded-md border p-4 shadow-md outline-hidden",o),...n})})}function m({...o}){return t(e.Anchor,{"data-slot":"popover-anchor",...o})}export{i as Popover,s as PopoverTrigger,p as PopoverContent,m as PopoverAnchor};
|