@datum-cloud/datum-ui 0.5.0 → 0.6.0-alpha.a37bf9a
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/README.md +79 -40
- package/dist/adapter-context-rWveHhDd.mjs +25 -0
- package/dist/autocomplete/index.mjs +1 -1
- package/dist/{autocomplete-V5-qslzS.mjs → autocomplete-CkYJueBL.mjs} +2 -2
- package/dist/autosearch/index.mjs +199 -0
- package/dist/{calendar-date-picker-DWK94_DC.mjs → calendar-date-picker-CDT-8Ha8.mjs} +2 -1
- package/dist/combobox/index.mjs +2 -0
- package/dist/combobox-B-C9lJeD.mjs +97 -0
- package/dist/components/features/autocomplete/autocomplete.d.ts +1 -1
- package/dist/components/features/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/features/autocomplete/autocomplete.types.d.ts +2 -0
- package/dist/components/features/autocomplete/autocomplete.types.d.ts.map +1 -1
- package/dist/components/features/autosearch/autosearch.d.ts +35 -0
- package/dist/components/features/autosearch/autosearch.d.ts.map +1 -0
- package/dist/components/features/autosearch/autosearch.types.d.ts +51 -0
- package/dist/components/features/autosearch/autosearch.types.d.ts.map +1 -0
- package/dist/components/features/autosearch/index.d.ts +3 -0
- package/dist/components/features/autosearch/index.d.ts.map +1 -0
- package/dist/components/features/calendar-date-picker/calendar-date-picker.d.ts +2 -1
- package/dist/components/features/calendar-date-picker/calendar-date-picker.d.ts.map +1 -1
- package/dist/components/features/combobox/combobox.d.ts +27 -0
- package/dist/components/features/combobox/combobox.d.ts.map +1 -0
- package/dist/components/features/combobox/index.d.ts +3 -0
- package/dist/components/features/combobox/index.d.ts.map +1 -0
- package/dist/components/features/combobox/types.d.ts +84 -0
- package/dist/components/features/combobox/types.d.ts.map +1 -0
- package/dist/components/features/date-time-picker/date-time-picker.d.ts +9 -0
- package/dist/components/features/date-time-picker/date-time-picker.d.ts.map +1 -0
- package/dist/components/features/date-time-picker/index.d.ts +3 -0
- package/dist/components/features/date-time-picker/index.d.ts.map +1 -0
- package/dist/components/features/date-time-picker/types.d.ts +59 -0
- package/dist/components/features/date-time-picker/types.d.ts.map +1 -0
- package/dist/components/features/date-time-picker/utils/format.d.ts +13 -0
- package/dist/components/features/date-time-picker/utils/format.d.ts.map +1 -0
- package/dist/components/features/date-time-picker/utils/index.d.ts +3 -0
- package/dist/components/features/date-time-picker/utils/index.d.ts.map +1 -0
- package/dist/components/features/date-time-picker/utils/timezone.d.ts +23 -0
- package/dist/components/features/date-time-picker/utils/timezone.d.ts.map +1 -0
- package/dist/components/features/form/adapter-context.d.ts +17 -0
- package/dist/components/features/form/adapter-context.d.ts.map +1 -0
- package/dist/components/features/form/adapter-types.d.ts +126 -0
- package/dist/components/features/form/adapter-types.d.ts.map +1 -0
- package/dist/components/features/form/adapters/conform/conform-adapter.d.ts +9 -0
- package/dist/components/features/form/adapters/conform/conform-adapter.d.ts.map +1 -0
- package/dist/components/features/form/adapters/conform/conform-provider.d.ts +22 -0
- package/dist/components/features/form/adapters/conform/conform-provider.d.ts.map +1 -0
- package/dist/components/features/form/adapters/conform/index.d.ts +3 -0
- package/dist/components/features/form/adapters/conform/index.d.ts.map +1 -0
- package/dist/components/features/form/adapters/rhf/index.d.ts +3 -0
- package/dist/components/features/form/adapters/rhf/index.d.ts.map +1 -0
- package/dist/components/features/form/adapters/rhf/rhf-adapter.d.ts +10 -0
- package/dist/components/features/form/adapters/rhf/rhf-adapter.d.ts.map +1 -0
- package/dist/components/features/form/adapters/rhf/rhf-provider.d.ts +22 -0
- package/dist/components/features/form/adapters/rhf/rhf-provider.d.ts.map +1 -0
- package/dist/components/features/form/components/form-autocomplete.d.ts.map +1 -1
- package/dist/components/features/form/components/form-autosearch.d.ts +37 -0
- package/dist/components/features/form/components/form-autosearch.d.ts.map +1 -0
- package/dist/components/features/form/components/form-checkbox.d.ts.map +1 -1
- package/dist/components/features/form/components/form-combobox.d.ts +80 -0
- package/dist/components/features/form/components/form-combobox.d.ts.map +1 -0
- package/dist/components/features/form/components/form-copy-box.d.ts +3 -0
- package/dist/components/features/form/components/form-copy-box.d.ts.map +1 -1
- package/dist/components/features/form/components/form-custom.d.ts.map +1 -1
- package/dist/components/features/form/components/form-date-picker.d.ts +40 -0
- package/dist/components/features/form/components/form-date-picker.d.ts.map +1 -0
- package/dist/components/features/form/components/form-date-time-picker.d.ts +39 -0
- package/dist/components/features/form/components/form-date-time-picker.d.ts.map +1 -0
- package/dist/components/features/form/components/form-dialog.d.ts.map +1 -1
- package/dist/components/features/form/components/form-field-array.d.ts +5 -17
- package/dist/components/features/form/components/form-field-array.d.ts.map +1 -1
- package/dist/components/features/form/components/form-field.d.ts +7 -21
- package/dist/components/features/form/components/form-field.d.ts.map +1 -1
- package/dist/components/features/form/components/form-input-group.d.ts +4 -4
- package/dist/components/features/form/components/form-input-group.d.ts.map +1 -1
- package/dist/components/features/form/components/form-input.d.ts.map +1 -1
- package/dist/components/features/form/components/form-radio-group.d.ts.map +1 -1
- package/dist/components/features/form/components/form-root.d.ts +5 -25
- package/dist/components/features/form/components/form-root.d.ts.map +1 -1
- package/dist/components/features/form/components/form-select.d.ts.map +1 -1
- package/dist/components/features/form/components/form-switch.d.ts.map +1 -1
- package/dist/components/features/form/components/form-textarea.d.ts.map +1 -1
- package/dist/components/features/form/components/form-time-picker.d.ts +21 -0
- package/dist/components/features/form/components/form-time-picker.d.ts.map +1 -0
- package/dist/components/features/form/components/form-transfer.d.ts +37 -0
- package/dist/components/features/form/components/form-transfer.d.ts.map +1 -0
- package/dist/components/features/form/components/index.d.ts +7 -1
- package/dist/components/features/form/components/index.d.ts.map +1 -1
- package/dist/components/features/form/components/stepper/form-stepper.d.ts.map +1 -1
- package/dist/components/features/form/context/form-context.d.ts +2 -2
- package/dist/components/features/form/context/form-context.d.ts.map +1 -1
- package/dist/components/features/form/hooks/index.d.ts +1 -1
- package/dist/components/features/form/hooks/index.d.ts.map +1 -1
- package/dist/components/features/form/hooks/use-field.d.ts +12 -18
- package/dist/components/features/form/hooks/use-field.d.ts.map +1 -1
- package/dist/components/features/form/hooks/use-form-state.d.ts +36 -0
- package/dist/components/features/form/hooks/use-form-state.d.ts.map +1 -0
- package/dist/components/features/form/hooks/use-watch.d.ts +9 -20
- package/dist/components/features/form/hooks/use-watch.d.ts.map +1 -1
- package/dist/components/features/form/index.d.ts +69 -45
- package/dist/components/features/form/index.d.ts.map +1 -1
- package/dist/components/features/form/stepper/index.d.ts +17 -0
- package/dist/components/features/form/stepper/index.d.ts.map +1 -0
- package/dist/components/features/form/types/index.d.ts +78 -32
- package/dist/components/features/form/types/index.d.ts.map +1 -1
- package/dist/components/features/form/utils/get-field-constraints.d.ts +33 -0
- package/dist/components/features/form/utils/get-field-constraints.d.ts.map +1 -0
- package/dist/components/features/form/utils/get-schema-defaults.d.ts +24 -0
- package/dist/components/features/form/utils/get-schema-defaults.d.ts.map +1 -0
- package/dist/components/features/form/utils/zod-helpers.d.ts +12 -0
- package/dist/components/features/form/utils/zod-helpers.d.ts.map +1 -0
- package/dist/components/features/time-picker/index.d.ts +3 -0
- package/dist/components/features/time-picker/index.d.ts.map +1 -0
- package/dist/components/features/time-picker/time-picker.d.ts +22 -0
- package/dist/components/features/time-picker/time-picker.d.ts.map +1 -0
- package/dist/components/features/time-picker/types.d.ts +31 -0
- package/dist/components/features/time-picker/types.d.ts.map +1 -0
- package/dist/components/features/transfer/components/index.d.ts +9 -0
- package/dist/components/features/transfer/components/index.d.ts.map +1 -0
- package/dist/components/features/transfer/components/transfer-group.d.ts +7 -0
- package/dist/components/features/transfer/components/transfer-group.d.ts.map +1 -0
- package/dist/components/features/transfer/components/transfer-item.d.ts +10 -0
- package/dist/components/features/transfer/components/transfer-item.d.ts.map +1 -0
- package/dist/components/features/transfer/components/transfer-panel.d.ts +18 -0
- package/dist/components/features/transfer/components/transfer-panel.d.ts.map +1 -0
- package/dist/components/features/transfer/components/transfer-search.d.ts +9 -0
- package/dist/components/features/transfer/components/transfer-search.d.ts.map +1 -0
- package/dist/components/features/transfer/hooks/use-transfer-dnd.d.ts +26 -0
- package/dist/components/features/transfer/hooks/use-transfer-dnd.d.ts.map +1 -0
- package/dist/components/features/transfer/hooks/use-transfer-state.d.ts +20 -0
- package/dist/components/features/transfer/hooks/use-transfer-state.d.ts.map +1 -0
- package/dist/components/features/transfer/index.d.ts +3 -0
- package/dist/components/features/transfer/index.d.ts.map +1 -0
- package/dist/components/features/transfer/transfer.d.ts +6 -0
- package/dist/components/features/transfer/transfer.d.ts.map +1 -0
- package/dist/components/features/transfer/types.d.ts +69 -0
- package/dist/components/features/transfer/types.d.ts.map +1 -0
- package/dist/data-table/index.mjs +1 -1
- package/dist/date-picker/index.mjs +2 -2
- package/dist/date-time-picker/index.mjs +2 -0
- package/dist/date-time-picker-BomrW07W.mjs +178 -0
- package/dist/form/adapters/conform/index.mjs +346 -0
- package/dist/form/adapters/rhf/index.mjs +282 -0
- package/dist/form/index.mjs +3 -2
- package/dist/form/stepper/index.mjs +545 -0
- package/dist/form-CxrQ92WO.mjs +1685 -0
- package/dist/form-context-Ccxm-wqL.mjs +17 -0
- package/dist/get-field-constraints-BicgDkfH.mjs +51 -0
- package/dist/grid/index.mjs +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/index.mjs +16 -15
- package/dist/input-number/index.mjs +1 -1
- package/dist/map/index.mjs +1 -1
- package/dist/{map-ClxB41Hg.mjs → map-CWIQ-eql.mjs} +1 -1
- package/dist/more-actions/index.mjs +1 -1
- package/dist/page-title/index.mjs +1 -1
- package/dist/stepper/index.mjs +1 -320
- package/dist/stepper-DvIOp0hh.mjs +321 -0
- package/dist/tag-input/index.mjs +1 -1
- package/dist/task-queue/index.mjs +1 -1
- package/dist/time-picker/index.mjs +2 -0
- package/dist/time-picker-BoF7pZZ2.mjs +43 -0
- package/dist/transfer/index.mjs +2 -0
- package/dist/transfer-B2n8pgEQ.mjs +260 -0
- package/package.json +63 -2
- package/dist/form-Co3fM4B7.mjs +0 -2114
- /package/dist/{col-q-J99UHe.mjs → col-1T0Q3SlH.mjs} +0 -0
- /package/dist/{hooks-Cb7YlxN4.mjs → hooks-D8r2M2U6.mjs} +0 -0
- /package/dist/{input-number-mDB-5M5C.mjs → input-number-a7uydAsw.mjs} +0 -0
- /package/dist/{map-leaflet-imports-CaMm_rdF.mjs → map-leaflet-imports-CRSKA79m.mjs} +0 -0
- /package/dist/{more-actions-CGagbIDT.mjs → more-actions-ILnEZq_E.mjs} +0 -0
- /package/dist/{page-title-R7QbfbWp.mjs → page-title-ChsnpBiH.mjs} +0 -0
- /package/dist/{tag-input-BVSwNcRd.mjs → tag-input-T9cUX9-G.mjs} +0 -0
- /package/dist/{task-queue-dropdown-DyM5R8KF.mjs → task-queue-dropdown-Wcbj-f0V.mjs} +0 -0
- /package/dist/{to-api-format-BnbRFYQI.mjs → to-api-format-Bh3c01gr.mjs} +0 -0
- /package/dist/{use-copy-to-clipboard-BGdTmkFV.mjs → use-copy-to-clipboard-uNeeVHC4.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-field-constraints.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/form/utils/get-field-constraints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,gBAAgB;IAE/B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAGlB,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,OAAO,CAAC,EAAE,IAAI,CAAA;IAGd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,CAAC,CAAC,OAAO,GAChB,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAcjC;AAgBD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,GAAG,gBAAgB,CAkDhF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Derive default values from a Zod schema that match what React Hook Form's
|
|
4
|
+
* `useController` will produce when fields register.
|
|
5
|
+
*
|
|
6
|
+
* This is critical for RHF's `isDirty` tracking: RHF compares current values
|
|
7
|
+
* against `_defaultValues`. Without explicit defaults, RHF uses `{}` as the
|
|
8
|
+
* baseline, so when `useController` registers fields (e.g. `username: ''`),
|
|
9
|
+
* the form is immediately considered dirty.
|
|
10
|
+
*
|
|
11
|
+
* By passing these schema-derived defaults to `useForm({ defaultValues })`,
|
|
12
|
+
* the baseline matches the registered values and `isDirty` starts as `false`.
|
|
13
|
+
*
|
|
14
|
+
* Maps Zod field types to their `useController` registration values:
|
|
15
|
+
* - string -> `''`
|
|
16
|
+
* - number -> `undefined`
|
|
17
|
+
* - boolean -> `false`
|
|
18
|
+
* - array -> `[]`
|
|
19
|
+
* - object -> `{}` (recursive)
|
|
20
|
+
* - optional/nullable wrappers -> unwrap and derive inner default
|
|
21
|
+
* - `.default()` -> use the provided default value
|
|
22
|
+
*/
|
|
23
|
+
export declare function getSchemaDefaults(schema: z.ZodType): Record<string, unknown>;
|
|
24
|
+
//# sourceMappingURL=get-schema-defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-schema-defaults.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/form/utils/get-schema-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAG5B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,CAAC,CAAC,OAAO,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYzB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Extract the shape from a ZodObject, ZodIntersection, or ZodPipe.
|
|
4
|
+
* Uses Zod v4's `def.type` discriminant.
|
|
5
|
+
*
|
|
6
|
+
* In Zod v4:
|
|
7
|
+
* - `.refine()` / `.superRefine()` on ZodObject return the same ZodObject (def.type = 'object')
|
|
8
|
+
* - `.transform()` wraps in ZodPipe (def.type = 'pipe', with def.in / def.out)
|
|
9
|
+
* - `.and()` creates ZodIntersection (def.type = 'intersection', with def.left / def.right)
|
|
10
|
+
*/
|
|
11
|
+
export declare function getObjectShape(schema: z.ZodType): Record<string, z.ZodType> | null;
|
|
12
|
+
//# sourceMappingURL=zod-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod-helpers.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/form/utils/zod-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,CAAC,CAAC,OAAO,GAChB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,IAAI,CAqBlC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/features/time-picker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TimePickerProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* TimePicker - Simple time input component
|
|
4
|
+
*
|
|
5
|
+
* Provides a native HTML time input for selecting hours and minutes.
|
|
6
|
+
* Value format: "HH:mm" (e.g., "14:30")
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <TimePicker
|
|
11
|
+
* value="14:30"
|
|
12
|
+
* onChange={(time) => console.log(time)}
|
|
13
|
+
* min="09:00"
|
|
14
|
+
* max="17:00"
|
|
15
|
+
* />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function TimePicker({ value, onChange, min, max, step, placeholder, disabled, className, id, 'aria-invalid': ariaInvalid, 'aria-describedby': ariaDescribedBy, }: TimePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare namespace TimePicker {
|
|
20
|
+
var displayName: string;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=time-picker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-picker.d.ts","sourceRoot":"","sources":["../../../../src/components/features/time-picker/time-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK9C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,EACH,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,SAAS,EACT,EAAE,EACF,cAAc,EAAE,WAAW,EAC3B,kBAAkB,EAAE,eAAe,GACpC,EAAE,eAAe,2CAwBjB;yBApCe,UAAU"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimePicker - Simple time input component
|
|
3
|
+
*
|
|
4
|
+
* Provides a native HTML time input for selecting hours and minutes.
|
|
5
|
+
* Value format: "HH:mm" (e.g., "14:30")
|
|
6
|
+
*/
|
|
7
|
+
export interface TimePickerProps {
|
|
8
|
+
/** Current time value in HH:mm format (e.g., "14:30") */
|
|
9
|
+
'value'?: string;
|
|
10
|
+
/** Called when time changes */
|
|
11
|
+
'onChange'?: (value: string) => void;
|
|
12
|
+
/** Minimum selectable time in HH:mm format */
|
|
13
|
+
'min'?: string;
|
|
14
|
+
/** Maximum selectable time in HH:mm format */
|
|
15
|
+
'max'?: string;
|
|
16
|
+
/** Step interval in minutes (default: 1) */
|
|
17
|
+
'step'?: number;
|
|
18
|
+
/** Placeholder text */
|
|
19
|
+
'placeholder'?: string;
|
|
20
|
+
/** Disable the input */
|
|
21
|
+
'disabled'?: boolean;
|
|
22
|
+
/** Additional CSS classes */
|
|
23
|
+
'className'?: string;
|
|
24
|
+
/** Input ID */
|
|
25
|
+
'id'?: string;
|
|
26
|
+
/** ARIA invalid state */
|
|
27
|
+
'aria-invalid'?: boolean;
|
|
28
|
+
/** ARIA described by */
|
|
29
|
+
'aria-describedby'?: string;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/features/time-picker/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,uBAAuB;IACvB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,wBAAwB;IACxB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yBAAyB;IACzB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,wBAAwB;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { TransferGroup } from './transfer-group';
|
|
2
|
+
export type { TransferGroupProps } from './transfer-group';
|
|
3
|
+
export { TransferItem } from './transfer-item';
|
|
4
|
+
export type { TransferItemProps } from './transfer-item';
|
|
5
|
+
export { TransferPanel } from './transfer-panel';
|
|
6
|
+
export type { TransferPanelProps } from './transfer-panel';
|
|
7
|
+
export { TransferSearch } from './transfer-search';
|
|
8
|
+
export type { TransferSearchProps } from './transfer-search';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/transfer/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer-group.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/transfer/components/transfer-group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAYtD,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface TransferItemProps {
|
|
3
|
+
itemKey: string;
|
|
4
|
+
label: string;
|
|
5
|
+
onClick: () => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
panelType: 'source' | 'target';
|
|
8
|
+
}
|
|
9
|
+
export declare const TransferItem: React.FC<TransferItemProps>;
|
|
10
|
+
//# sourceMappingURL=transfer-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer-item.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/transfer/components/transfer-item.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;CAC/B;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAyCpD,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TransferItem as TransferItemType } from '../types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export interface TransferPanelProps {
|
|
4
|
+
title: string;
|
|
5
|
+
items: TransferItemType[];
|
|
6
|
+
groups: string[];
|
|
7
|
+
searchable: boolean;
|
|
8
|
+
searchValue: string;
|
|
9
|
+
onSearchChange: (value: string) => void;
|
|
10
|
+
searchPlaceholder?: string;
|
|
11
|
+
onItemClick: (key: string) => void;
|
|
12
|
+
onSelectAll: () => void;
|
|
13
|
+
enableSelectAll: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
panelType: 'source' | 'target';
|
|
16
|
+
}
|
|
17
|
+
export declare const TransferPanel: React.FC<TransferPanelProps>;
|
|
18
|
+
//# sourceMappingURL=transfer-panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer-panel.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/transfer/components/transfer-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,gBAAgB,EAAE,CAAA;IACzB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,UAAU,EAAE,OAAO,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,eAAe,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;CAC/B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAwGtD,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface TransferSearchProps {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const TransferSearch: React.FC<TransferSearchProps>;
|
|
9
|
+
//# sourceMappingURL=transfer-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer-search.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/transfer/components/transfer-search.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA0BxD,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DragEndEvent } from '@dnd-kit/core';
|
|
2
|
+
import { DndContext, useSensors } from '@dnd-kit/core';
|
|
3
|
+
import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
4
|
+
export interface UseTransferDndProps {
|
|
5
|
+
/**
|
|
6
|
+
* Current order of items (keys)
|
|
7
|
+
*/
|
|
8
|
+
items: string[];
|
|
9
|
+
/**
|
|
10
|
+
* Called when items are reordered
|
|
11
|
+
*/
|
|
12
|
+
onReorder: (items: string[]) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Disable drag and drop
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface UseTransferDndReturn {
|
|
19
|
+
sensors: ReturnType<typeof useSensors>;
|
|
20
|
+
handleDragEnd: (event: DragEndEvent) => void;
|
|
21
|
+
DndContext: typeof DndContext;
|
|
22
|
+
SortableContext: typeof SortableContext;
|
|
23
|
+
verticalListSortingStrategy: typeof verticalListSortingStrategy;
|
|
24
|
+
}
|
|
25
|
+
export declare function useTransferDnd({ items, onReorder, disabled, }: UseTransferDndProps): UseTransferDndReturn;
|
|
26
|
+
//# sourceMappingURL=use-transfer-dnd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-transfer-dnd.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/transfer/hooks/use-transfer-dnd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EACL,UAAU,EAIV,UAAU,EACX,MAAM,eAAe,CAAA;AACtB,OAAO,EAEL,eAAe,EAEf,2BAA2B,EAC5B,MAAM,mBAAmB,CAAA;AAE1B,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAA;IAEf;;OAEG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IAEpC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA;IACtC,aAAa,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;IAC5C,UAAU,EAAE,OAAO,UAAU,CAAA;IAC7B,eAAe,EAAE,OAAO,eAAe,CAAA;IACvC,2BAA2B,EAAE,OAAO,2BAA2B,CAAA;CAChE;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,SAAS,EACT,QAAgB,GACjB,EAAE,mBAAmB,GAAG,oBAAoB,CA8B5C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TransferItem } from '../types';
|
|
2
|
+
interface UseTransferStateProps<T> {
|
|
3
|
+
items: T[];
|
|
4
|
+
value: string[];
|
|
5
|
+
itemKey: keyof T | ((item: T) => string);
|
|
6
|
+
itemLabel: keyof T | ((item: T) => string);
|
|
7
|
+
itemGroup?: keyof T | ((item: T) => string | undefined);
|
|
8
|
+
}
|
|
9
|
+
interface UseTransferStateReturn<T> {
|
|
10
|
+
sourceItems: TransferItem<T>[];
|
|
11
|
+
targetItems: TransferItem<T>[];
|
|
12
|
+
filteredSourceItems: TransferItem<T>[];
|
|
13
|
+
sourceGroups: string[];
|
|
14
|
+
targetGroups: string[];
|
|
15
|
+
sourceSearch: string;
|
|
16
|
+
setSourceSearch: (search: string) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function useTransferState<T>({ items, value, itemKey, itemLabel, itemGroup, }: UseTransferStateProps<T>): UseTransferStateReturn<T>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=use-transfer-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-transfer-state.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/transfer/hooks/use-transfer-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAG5C,UAAU,qBAAqB,CAAC,CAAC;IAC/B,KAAK,EAAE,CAAC,EAAE,CAAA;IACV,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC,CAAA;IACxC,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC,CAAA;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC,CAAA;CACxD;AAED,UAAU,sBAAsB,CAAC,CAAC;IAEhC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;IAC9B,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;IAG9B,mBAAmB,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;IAGtC,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,YAAY,EAAE,MAAM,EAAE,CAAA;IAGtB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAC1C;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,EAClC,KAAK,EACL,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,GACV,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CA6GtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/features/transfer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TransferProps } from './types';
|
|
2
|
+
export declare function Transfer<T>({ items, value, onChange, itemKey, itemLabel, itemGroup, searchable, searchPlaceholder, sourceTitle, targetTitle, enableSelectAll, disabled, className, }: TransferProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare namespace Transfer {
|
|
4
|
+
var displayName: string;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=transfer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../../../src/components/features/transfer/transfer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAM5C,wBAAgB,QAAQ,CAAC,CAAC,EAAG,EAC3B,KAAK,EACL,KAAK,EACL,QAAQ,EACR,OAAO,EACP,SAAS,EACT,SAAS,EACT,UAAiB,EACjB,iBAA+B,EAC/B,WAAyB,EACzB,WAAwB,EACxB,eAAsB,EACtB,QAAgB,EAChB,SAAS,GACV,EAAE,aAAa,CAAC,CAAC,CAAC,2CAyElB;yBAvFe,QAAQ"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export interface TransferProps<T = any> {
|
|
2
|
+
/**
|
|
3
|
+
* All available items
|
|
4
|
+
*/
|
|
5
|
+
items: T[];
|
|
6
|
+
/**
|
|
7
|
+
* Currently selected item keys
|
|
8
|
+
*/
|
|
9
|
+
value: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Called when selection changes
|
|
12
|
+
*/
|
|
13
|
+
onChange: (value: string[]) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Extract unique key from item
|
|
16
|
+
*/
|
|
17
|
+
itemKey: keyof T | ((item: T) => string);
|
|
18
|
+
/**
|
|
19
|
+
* Extract display label from item
|
|
20
|
+
*/
|
|
21
|
+
itemLabel: keyof T | ((item: T) => string);
|
|
22
|
+
/**
|
|
23
|
+
* Extract group name from item (optional)
|
|
24
|
+
*/
|
|
25
|
+
itemGroup?: keyof T | ((item: T) => string | undefined);
|
|
26
|
+
/**
|
|
27
|
+
* Enable search functionality
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
searchable?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Search input placeholder
|
|
33
|
+
*/
|
|
34
|
+
searchPlaceholder?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Source panel title
|
|
37
|
+
* @default "Available"
|
|
38
|
+
*/
|
|
39
|
+
sourceTitle?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Target panel title
|
|
42
|
+
* @default "Selected"
|
|
43
|
+
*/
|
|
44
|
+
targetTitle?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Show select-all button
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
enableSelectAll?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Disable the component
|
|
52
|
+
*/
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Additional CSS class
|
|
56
|
+
*/
|
|
57
|
+
className?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface TransferItem<T = any> {
|
|
60
|
+
key: string;
|
|
61
|
+
label: string;
|
|
62
|
+
group?: string;
|
|
63
|
+
data: T;
|
|
64
|
+
}
|
|
65
|
+
export interface TransferPanelData<T = any> {
|
|
66
|
+
items: TransferItem<T>[];
|
|
67
|
+
groups: string[];
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/features/transfer/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,GAAG;IACpC;;OAEG;IACH,KAAK,EAAE,CAAC,EAAE,CAAA;IAEV;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAA;IAEf;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IAEnC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC,CAAA;IAExC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC,CAAA;IAE1C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC,CAAA;IAEvD;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAE1B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,GAAG;IACnC,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,CAAC,CAAA;CACR;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,GAAG;IACxC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;IACxB,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB"}
|
|
@@ -10,7 +10,7 @@ import { i as PopoverTrigger, r as PopoverContent, t as Popover } from "../popov
|
|
|
10
10
|
import { i as SelectItem, l as SelectTrigger, n as SelectContent, t as Select, u as SelectValue } from "../select-CiLR_DiQ.mjs";
|
|
11
11
|
import { t as Skeleton } from "../skeleton-D1MUhAVo.mjs";
|
|
12
12
|
import { c as TableRow, i as TableCell, n as TableBody, o as TableHead, s as TableHeader, t as Table } from "../table-Cdsh-39-.mjs";
|
|
13
|
-
import { t as CalendarDatePicker } from "../calendar-date-picker-
|
|
13
|
+
import { t as CalendarDatePicker } from "../calendar-date-picker-CDT-8Ha8.mjs";
|
|
14
14
|
import { ArrowDown, ArrowUp, ArrowUpDown, Check, ChevronDown, ChevronLeft, ChevronRight, MoreHorizontal, X } from "lucide-react";
|
|
15
15
|
import { createContext, memo, use, useCallback, useContext, useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
16
16
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as CalendarDatePicker } from "../calendar-date-picker-
|
|
2
|
-
import { C as utcToLocalInputString, S as utcStringToZonedDate, _ as getBrowserTimezone, a as formatTimeRangeDisplay, b as getTimezoneOffset, c as getPresetByKey, d as TimezoneSelector, f as QuickRangesPanel, g as formatUtcForDisplay, h as formatTimezoneLabel, i as formatSingleTimeDisplay, l as getPresetByShortcut, m as createTimezoneOption, n as TimeRangePicker, o as DEFAULT_PRESETS, p as CustomRangePanel, r as formatDateForInput, s as getDefaultPreset, t as toApiTimeRange, u as getPresetRange, v as getDefaultTimezoneOptions, w as zonedDateToUtcString, x as localInputStringToUtc, y as getShortTimezoneDisplay } from "../to-api-format-
|
|
1
|
+
import { t as CalendarDatePicker } from "../calendar-date-picker-CDT-8Ha8.mjs";
|
|
2
|
+
import { C as utcToLocalInputString, S as utcStringToZonedDate, _ as getBrowserTimezone, a as formatTimeRangeDisplay, b as getTimezoneOffset, c as getPresetByKey, d as TimezoneSelector, f as QuickRangesPanel, g as formatUtcForDisplay, h as formatTimezoneLabel, i as formatSingleTimeDisplay, l as getPresetByShortcut, m as createTimezoneOption, n as TimeRangePicker, o as DEFAULT_PRESETS, p as CustomRangePanel, r as formatDateForInput, s as getDefaultPreset, t as toApiTimeRange, u as getPresetRange, v as getDefaultTimezoneOptions, w as zonedDateToUtcString, x as localInputStringToUtc, y as getShortTimezoneDisplay } from "../to-api-format-Bh3c01gr.mjs";
|
|
3
3
|
export { CustomRangePanel as AbsoluteRangePanel, CustomRangePanel, CalendarDatePicker, DEFAULT_PRESETS, QuickRangesPanel, TimeRangePicker, TimezoneSelector, createTimezoneOption, formatDateForInput, formatSingleTimeDisplay, formatTimeRangeDisplay, formatTimezoneLabel, formatUtcForDisplay, getBrowserTimezone, getDefaultPreset, getDefaultTimezoneOptions, getPresetByKey, getPresetByShortcut, getPresetRange, getShortTimezoneDisplay, getTimezoneOffset, localInputStringToUtc, toApiTimeRange, utcStringToZonedDate, utcToLocalInputString, zonedDateToUtcString };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
|
+
import { t as Button } from "./button-D3RrsMfQ.mjs";
|
|
3
|
+
import { t as Calendar$1 } from "./calendar-DEkCw7I1.mjs";
|
|
4
|
+
import { i as PopoverTrigger, r as PopoverContent, t as Popover } from "./popover-FJAcbYoH.mjs";
|
|
5
|
+
import { CalendarIcon } from "lucide-react";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { format } from "date-fns";
|
|
9
|
+
import { formatInTimeZone, fromZonedTime, toZonedTime } from "date-fns-tz";
|
|
10
|
+
//#region src/components/features/date-time-picker/utils/format.ts
|
|
11
|
+
/**
|
|
12
|
+
* Format date for display
|
|
13
|
+
*/
|
|
14
|
+
function formatDate(date) {
|
|
15
|
+
if (!date) return "";
|
|
16
|
+
return format(date, "PP");
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/components/features/date-time-picker/utils/timezone.ts
|
|
20
|
+
/**
|
|
21
|
+
* Get the browser's timezone
|
|
22
|
+
*/
|
|
23
|
+
function getBrowserTimezone() {
|
|
24
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Convert local date + time to UTC ISO string
|
|
28
|
+
* @param date - Date object (date part)
|
|
29
|
+
* @param time - Time string in HH:mm format
|
|
30
|
+
* @param timezone - IANA timezone (e.g., "America/New_York")
|
|
31
|
+
* @returns UTC ISO string
|
|
32
|
+
*/
|
|
33
|
+
function localDateTimeToUtc(date, time, timezone) {
|
|
34
|
+
try {
|
|
35
|
+
const [hours, minutes] = time.split(":").map(Number);
|
|
36
|
+
return fromZonedTime(`${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")} ${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}`, timezone).toISOString();
|
|
37
|
+
} catch {
|
|
38
|
+
const [hours = 0, minutes = 0] = time.split(":").map(Number);
|
|
39
|
+
const combined = new Date(date);
|
|
40
|
+
combined.setUTCHours(hours, minutes, 0, 0);
|
|
41
|
+
return combined.toISOString();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Convert UTC ISO string to local date + time
|
|
46
|
+
* @param utcString - UTC ISO string
|
|
47
|
+
* @param timezone - IANA timezone
|
|
48
|
+
* @returns Object with date and time (HH:mm)
|
|
49
|
+
*/
|
|
50
|
+
function utcToLocalDateTime(utcString, timezone) {
|
|
51
|
+
try {
|
|
52
|
+
const utcDate = new Date(utcString);
|
|
53
|
+
const time = formatInTimeZone(utcDate, timezone, "HH:mm");
|
|
54
|
+
return {
|
|
55
|
+
date: toZonedTime(utcDate, timezone),
|
|
56
|
+
time
|
|
57
|
+
};
|
|
58
|
+
} catch {
|
|
59
|
+
const utcDate = new Date(utcString);
|
|
60
|
+
const hours = utcDate.getUTCHours();
|
|
61
|
+
const minutes = utcDate.getUTCMinutes();
|
|
62
|
+
return {
|
|
63
|
+
date: utcDate,
|
|
64
|
+
time: `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}`
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/components/features/date-time-picker/date-time-picker.tsx
|
|
70
|
+
const DEFAULT_TIMEZONE = getBrowserTimezone();
|
|
71
|
+
function DateTimePicker({ ref, value, onChange, minDate, maxDate, disabledDates, timezone = DEFAULT_TIMEZONE, showTimezoneIndicator = false, placeholder = "Select date and time", disabled = false, className, modal = false }) {
|
|
72
|
+
const initialState = React$1.useMemo(() => {
|
|
73
|
+
if (!value) return {
|
|
74
|
+
date: void 0,
|
|
75
|
+
time: ""
|
|
76
|
+
};
|
|
77
|
+
return utcToLocalDateTime(value, timezone);
|
|
78
|
+
}, [value, timezone]);
|
|
79
|
+
const [state, setState] = React$1.useState(initialState);
|
|
80
|
+
const prevValue = React$1.useRef(value);
|
|
81
|
+
const prevTimezone = React$1.useRef(timezone);
|
|
82
|
+
React$1.useEffect(() => {
|
|
83
|
+
if (value !== prevValue.current || timezone !== prevTimezone.current) {
|
|
84
|
+
prevValue.current = value;
|
|
85
|
+
prevTimezone.current = timezone;
|
|
86
|
+
setState(() => value ? utcToLocalDateTime(value, timezone) : {
|
|
87
|
+
date: void 0,
|
|
88
|
+
time: ""
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}, [value, timezone]);
|
|
92
|
+
const handleDateChange = React$1.useCallback((newDate) => {
|
|
93
|
+
setState((prev) => ({
|
|
94
|
+
...prev,
|
|
95
|
+
date: newDate
|
|
96
|
+
}));
|
|
97
|
+
}, []);
|
|
98
|
+
const handleTimeChange = React$1.useCallback((e) => {
|
|
99
|
+
const newTime = e.target.value;
|
|
100
|
+
if (newTime && !/^\d{2}:\d{2}$/.test(newTime)) return;
|
|
101
|
+
setState((prev) => ({
|
|
102
|
+
...prev,
|
|
103
|
+
time: newTime
|
|
104
|
+
}));
|
|
105
|
+
}, []);
|
|
106
|
+
React$1.useEffect(() => {
|
|
107
|
+
if (state.date && state.time) {
|
|
108
|
+
const utcValue = localDateTimeToUtc(state.date, state.time, timezone);
|
|
109
|
+
onChange?.(utcValue);
|
|
110
|
+
}
|
|
111
|
+
}, [
|
|
112
|
+
state.date,
|
|
113
|
+
state.time,
|
|
114
|
+
timezone,
|
|
115
|
+
onChange
|
|
116
|
+
]);
|
|
117
|
+
const formatDisplayValue = () => {
|
|
118
|
+
if (!state.date) return placeholder;
|
|
119
|
+
if (state.time) return `${formatDate(state.date)} ${state.time}`;
|
|
120
|
+
return formatDate(state.date);
|
|
121
|
+
};
|
|
122
|
+
return /* @__PURE__ */ jsx("div", {
|
|
123
|
+
ref,
|
|
124
|
+
className,
|
|
125
|
+
children: /* @__PURE__ */ jsxs(Popover, {
|
|
126
|
+
modal,
|
|
127
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
128
|
+
asChild: true,
|
|
129
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
130
|
+
variant: "outline",
|
|
131
|
+
className: cn("w-full justify-start text-left font-normal", !state.date && "text-muted-foreground"),
|
|
132
|
+
disabled,
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ jsx(CalendarIcon, { className: "mr-2 h-4 w-4" }),
|
|
135
|
+
/* @__PURE__ */ jsx("span", {
|
|
136
|
+
className: "flex-1",
|
|
137
|
+
children: formatDisplayValue()
|
|
138
|
+
}),
|
|
139
|
+
showTimezoneIndicator && state.date && state.time && /* @__PURE__ */ jsx("span", {
|
|
140
|
+
className: "text-muted-foreground ml-2 text-xs",
|
|
141
|
+
children: timezone
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
})
|
|
145
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
146
|
+
className: "w-auto p-0",
|
|
147
|
+
align: "start",
|
|
148
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
149
|
+
className: "p-3",
|
|
150
|
+
children: [/* @__PURE__ */ jsx(Calendar$1, {
|
|
151
|
+
mode: "single",
|
|
152
|
+
selected: state.date,
|
|
153
|
+
onSelect: handleDateChange,
|
|
154
|
+
disabled: disabledDates,
|
|
155
|
+
fromDate: minDate,
|
|
156
|
+
toDate: maxDate
|
|
157
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
158
|
+
className: "mt-3",
|
|
159
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
160
|
+
className: "mb-1 block text-sm font-medium",
|
|
161
|
+
children: "Time"
|
|
162
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
163
|
+
type: "time",
|
|
164
|
+
"aria-label": "Select time",
|
|
165
|
+
value: state.time,
|
|
166
|
+
onChange: handleTimeChange,
|
|
167
|
+
disabled: disabled || !state.date,
|
|
168
|
+
className: cn("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1", "text-sm shadow-sm transition-colors", "placeholder:text-muted-foreground", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:cursor-not-allowed disabled:opacity-50")
|
|
169
|
+
})]
|
|
170
|
+
})]
|
|
171
|
+
})
|
|
172
|
+
})]
|
|
173
|
+
})
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
DateTimePicker.displayName = "DateTimePicker";
|
|
177
|
+
//#endregion
|
|
178
|
+
export { DateTimePicker as t };
|