@zayne-labs/ui-react 0.10.9 → 0.10.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/{cn-s-D7vHW1.js → cn-DdD3uYxA.js} +1 -1
- package/dist/esm/{cn-s-D7vHW1.js.map → cn-DdD3uYxA.js.map} +1 -1
- package/dist/esm/common/await/index.d.ts +46 -4
- package/dist/esm/common/await/index.js +86 -4
- package/dist/esm/common/await/index.js.map +1 -0
- package/dist/esm/common/error-boundary/index.d.ts +1 -1
- package/dist/esm/common/for/index.d.ts +23 -2
- package/dist/esm/common/for/index.js +1 -1
- package/dist/esm/common/presence/index.js +1 -1
- package/dist/esm/common/show/index.d.ts +32 -2
- package/dist/esm/common/slot/index.d.ts +16 -2
- package/dist/esm/common/suspense-with-boundary/index.d.ts +2 -2
- package/dist/esm/common/suspense-with-boundary/index.js +20 -3
- package/dist/esm/common/suspense-with-boundary/index.js.map +1 -0
- package/dist/esm/common/switch/index.d.ts +28 -2
- package/dist/esm/common/switch/index.js +37 -2
- package/dist/esm/common/switch/index.js.map +1 -0
- package/dist/esm/common/teleport/index.d.ts +14 -2
- package/dist/esm/common/teleport/index.js +31 -2
- package/dist/esm/common/teleport/index.js.map +1 -0
- package/dist/esm/{for-DK5rEY_m.js → for-BYsFEk3R.js} +1 -1
- package/dist/esm/{for-DK5rEY_m.js.map → for-BYsFEk3R.js.map} +1 -1
- package/dist/esm/{index-C0L6V4Zq.d.ts → index-BwhRxsrZ.d.ts} +3 -3
- package/dist/esm/{index-lw5txqar.d.ts → index-C_2Onnhl.d.ts} +4 -4
- package/dist/esm/{presence-CL5_GHQH.js → presence-CAQElNtY.js} +1 -1
- package/dist/esm/{presence-CL5_GHQH.js.map → presence-CAQElNtY.js.map} +1 -1
- package/dist/esm/ui/card/index.d.ts +20 -2
- package/dist/esm/ui/card/index.js +94 -4
- package/dist/esm/ui/card/index.js.map +1 -0
- package/dist/esm/ui/carousel/index.d.ts +95 -2
- package/dist/esm/ui/carousel/index.js +285 -13
- package/dist/esm/ui/carousel/index.js.map +1 -0
- package/dist/esm/ui/drag-scroll/index.d.ts +23 -2
- package/dist/esm/ui/drag-scroll/index.js +114 -3
- package/dist/esm/ui/drag-scroll/index.js.map +1 -0
- package/dist/esm/ui/drop-zone/index.d.ts +346 -2
- package/dist/esm/ui/drop-zone/index.js +1026 -14
- package/dist/esm/ui/drop-zone/index.js.map +1 -0
- package/dist/esm/ui/form/index.d.ts +227 -2
- package/dist/esm/ui/form/index.js +573 -5
- package/dist/esm/ui/form/index.js.map +1 -0
- package/package.json +6 -8
- package/dist/esm/await-DDgVzpvI.js +0 -87
- package/dist/esm/await-DDgVzpvI.js.map +0 -1
- package/dist/esm/card-DDLJVCwL.js +0 -95
- package/dist/esm/card-DDLJVCwL.js.map +0 -1
- package/dist/esm/carousel-B051PAAX.js +0 -285
- package/dist/esm/carousel-B051PAAX.js.map +0 -1
- package/dist/esm/common/index.d.ts +0 -9
- package/dist/esm/common/index.js +0 -11
- package/dist/esm/common-PS3X58Pj.js +0 -0
- package/dist/esm/drag-scroll-Bb1SG4On.js +0 -115
- package/dist/esm/drag-scroll-Bb1SG4On.js.map +0 -1
- package/dist/esm/drop-zone-FkkbzZ3j.js +0 -1019
- package/dist/esm/drop-zone-FkkbzZ3j.js.map +0 -1
- package/dist/esm/form-DyGy9LnA.js +0 -574
- package/dist/esm/form-DyGy9LnA.js.map +0 -1
- package/dist/esm/index-BJUTFSec.d.ts +0 -227
- package/dist/esm/index-BeCCgTjL.d.ts +0 -16
- package/dist/esm/index-BsGxDKlt.d.ts +0 -32
- package/dist/esm/index-C1GPFYKG.d.ts +0 -23
- package/dist/esm/index-CZjeBSoQ.d.ts +0 -14
- package/dist/esm/index-CffEFE66.d.ts +0 -28
- package/dist/esm/index-DFHOx2Pf.d.ts +0 -23
- package/dist/esm/index-DXwAMkn0.d.ts +0 -46
- package/dist/esm/index-RpfwCCWX.d.ts +0 -345
- package/dist/esm/index-bD-GMufy.d.ts +0 -20
- package/dist/esm/index-ipYGGqwN.d.ts +0 -95
- package/dist/esm/suspense-with-boundary-D-1NYDV4.js +0 -21
- package/dist/esm/suspense-with-boundary-D-1NYDV4.js.map +0 -1
- package/dist/esm/switch-Ch22z21e.js +0 -38
- package/dist/esm/switch-Ch22z21e.js.map +0 -1
- package/dist/esm/teleport-C8TzRm4M.js +0 -32
- package/dist/esm/teleport-C8TzRm4M.js.map +0 -1
- package/dist/esm/ui/index.d.ts +0 -6
- package/dist/esm/ui/index.js +0 -18
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
import { InferProps, PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
|
|
2
|
-
import * as _zayne_labs_toolkit_type_helpers0 from "@zayne-labs/toolkit-type-helpers";
|
|
3
|
-
import { Awaitable, SelectorFn } from "@zayne-labs/toolkit-type-helpers";
|
|
4
|
-
import * as react1 from "react";
|
|
5
|
-
import "@zayne-labs/toolkit-react";
|
|
6
|
-
import * as react_jsx_runtime10 from "react/jsx-runtime";
|
|
7
|
-
import * as _zayne_labs_toolkit_core1 from "@zayne-labs/toolkit-core";
|
|
8
|
-
import { FileMeta, FileOrFileMeta, FileValidationErrorContextEach, FileValidationHooksAsync, FileValidationSettingsAsync } from "@zayne-labs/toolkit-core";
|
|
9
|
-
|
|
10
|
-
//#region src/components/ui/drop-zone/utils.d.ts
|
|
11
|
-
|
|
12
|
-
declare class DropZoneError extends Error {
|
|
13
|
-
readonly dropZoneErrorSymbol: symbol;
|
|
14
|
-
file?: FileValidationErrorContextEach["file"];
|
|
15
|
-
name: "DropZoneError";
|
|
16
|
-
constructor(ctx: Pick<FileValidationErrorContextEach, "message"> & {
|
|
17
|
-
file?: FileValidationErrorContextEach["file"];
|
|
18
|
-
});
|
|
19
|
-
static isError(error: unknown): error is DropZoneError;
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/components/ui/drop-zone/types.d.ts
|
|
23
|
-
type FileErrorContext = Omit<FileValidationErrorContextEach, "code"> & {
|
|
24
|
-
code: "upload-error" | FileValidationErrorContextEach["code"];
|
|
25
|
-
};
|
|
26
|
-
interface FileState {
|
|
27
|
-
/**
|
|
28
|
-
* Validation errors for the file
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
error?: FileErrorContext;
|
|
32
|
-
/**
|
|
33
|
-
* File object or file metadata
|
|
34
|
-
*/
|
|
35
|
-
file: FileOrFileMeta;
|
|
36
|
-
/**
|
|
37
|
-
* Unique ID for the file
|
|
38
|
-
*/
|
|
39
|
-
id: string;
|
|
40
|
-
/**
|
|
41
|
-
* Preview URL for the file
|
|
42
|
-
* - Will be undefined if `disallowPreviewForNonImageFiles` is set to `true` and the file is not an image
|
|
43
|
-
* - Can also be undefined if `URL.createObjectURL` fails
|
|
44
|
-
*/
|
|
45
|
-
preview: string | undefined;
|
|
46
|
-
/**
|
|
47
|
-
* Progress of the file upload
|
|
48
|
-
*/
|
|
49
|
-
progress: number;
|
|
50
|
-
/**
|
|
51
|
-
* Status of the file upload
|
|
52
|
-
*/
|
|
53
|
-
status: "error" | "idle" | "success" | "uploading";
|
|
54
|
-
}
|
|
55
|
-
type FileStateOrIDProp = {
|
|
56
|
-
fileStateOrID: FileOrFileMeta | FileState | FileState["id"];
|
|
57
|
-
};
|
|
58
|
-
type RecordForDataAttr = Record<`data-${string}`, unknown>;
|
|
59
|
-
interface PartProps {
|
|
60
|
-
container: {
|
|
61
|
-
input: PartProps["container"]["output"];
|
|
62
|
-
output: InferProps<HTMLElement> & RecordForDataAttr;
|
|
63
|
-
};
|
|
64
|
-
fileItem: {
|
|
65
|
-
input: PartProps["fileItem"]["output"];
|
|
66
|
-
output: InferProps<"li"> & RecordForDataAttr;
|
|
67
|
-
};
|
|
68
|
-
fileItemClear: {
|
|
69
|
-
input: PartProps["fileItemClear"]["output"];
|
|
70
|
-
output: InferProps<"button"> & RecordForDataAttr;
|
|
71
|
-
};
|
|
72
|
-
fileItemDelete: {
|
|
73
|
-
input: Partial<FileStateOrIDProp> & PartProps["fileItemDelete"]["output"];
|
|
74
|
-
output: InferProps<"button"> & RecordForDataAttr;
|
|
75
|
-
};
|
|
76
|
-
fileItemMetadata: {
|
|
77
|
-
input: PartProps["fileItemMetadata"]["output"];
|
|
78
|
-
output: InferProps<"div"> & RecordForDataAttr;
|
|
79
|
-
};
|
|
80
|
-
fileItemPreview: {
|
|
81
|
-
input: PartProps["fileItemPreview"]["output"];
|
|
82
|
-
output: InferProps<"span"> & RecordForDataAttr;
|
|
83
|
-
};
|
|
84
|
-
fileItemProgress: {
|
|
85
|
-
input: PartProps["fileItemProgress"]["output"] & {
|
|
86
|
-
variant?: "circular" | "fill" | "linear";
|
|
87
|
-
};
|
|
88
|
-
output: InferProps<"span"> & RecordForDataAttr;
|
|
89
|
-
};
|
|
90
|
-
fileList: {
|
|
91
|
-
input: PartProps["fileList"]["output"] & {
|
|
92
|
-
orientation?: "horizontal" | "vertical";
|
|
93
|
-
};
|
|
94
|
-
output: InferProps<"ul"> & RecordForDataAttr;
|
|
95
|
-
};
|
|
96
|
-
input: {
|
|
97
|
-
input: PartProps["input"]["output"];
|
|
98
|
-
output: InferProps<"input"> & RecordForDataAttr;
|
|
99
|
-
};
|
|
100
|
-
trigger: {
|
|
101
|
-
input: PartProps["trigger"]["output"];
|
|
102
|
-
output: InferProps<"button"> & RecordForDataAttr;
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
type DropZonePropGetters = { [Key in keyof PartProps as `get${Capitalize<Key>}Props`]: (props: PartProps[Key]["input"]) => PartProps[Key]["output"] };
|
|
106
|
-
type PartInputProps = { [Key in keyof PartProps]: PartProps[Key]["input"] };
|
|
107
|
-
type DropZoneState = {
|
|
108
|
-
/**
|
|
109
|
-
* List of validation errors
|
|
110
|
-
*/
|
|
111
|
-
errors: FileErrorContext[];
|
|
112
|
-
/**
|
|
113
|
-
* List of files with their preview URLs and unique IDs
|
|
114
|
-
*/
|
|
115
|
-
fileStateArray: FileState[];
|
|
116
|
-
/**
|
|
117
|
-
* Whether or not a file is currently being dragged over the drop zone
|
|
118
|
-
*/
|
|
119
|
-
isDraggingOver: boolean;
|
|
120
|
-
/**
|
|
121
|
-
* Whether or not any of the files are invalid
|
|
122
|
-
*/
|
|
123
|
-
isInvalid: boolean;
|
|
124
|
-
};
|
|
125
|
-
type DropZoneActions = {
|
|
126
|
-
actions: {
|
|
127
|
-
addFiles: (files: FileList | FileOrFileMeta[] | null) => Awaitable<void>;
|
|
128
|
-
clearErrors: () => void;
|
|
129
|
-
clearFiles: () => void;
|
|
130
|
-
clearObjectURLs: () => void;
|
|
131
|
-
handleChange: (event: React.ChangeEvent<HTMLInputElement>) => Awaitable<void>;
|
|
132
|
-
handleDragEnter: (event: React.DragEvent<HTMLElement>) => void;
|
|
133
|
-
handleDragLeave: (event: React.DragEvent<HTMLElement>) => void;
|
|
134
|
-
handleDragOver: (event: React.DragEvent<HTMLElement>) => void;
|
|
135
|
-
handleDrop: (event: React.DragEvent<HTMLElement>) => Awaitable<void>;
|
|
136
|
-
handleFileUpload: (ctx: {
|
|
137
|
-
newFileStateArray: DropZoneState["fileStateArray"];
|
|
138
|
-
}) => Awaitable<void>;
|
|
139
|
-
handleKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
|
|
140
|
-
handlePaste: (event: React.ClipboardEvent<HTMLElement>) => Awaitable<void>;
|
|
141
|
-
openFilePicker: () => void;
|
|
142
|
-
removeFile: (ctx: FileStateOrIDProp) => void;
|
|
143
|
-
updateFileState: (ctx: FileStateOrIDProp & Partial<Omit<FileState, "file" | "id" | "preview">>) => void;
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
interface UseDropZoneResult extends Pick<Required<UseDropZoneProps>, "disabled" | "disableInternalStateSubscription"> {
|
|
147
|
-
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
148
|
-
propGetters: DropZonePropGetters;
|
|
149
|
-
storeApi: ReturnType<typeof createDropZoneStore>;
|
|
150
|
-
useDropZoneStore: typeof useDropZoneStoreContext;
|
|
151
|
-
}
|
|
152
|
-
interface UseDropZoneProps extends FileValidationSettingsAsync {
|
|
153
|
-
/**
|
|
154
|
-
* Whether or not the drop zone is disabled
|
|
155
|
-
*/
|
|
156
|
-
disabled?: boolean;
|
|
157
|
-
/**
|
|
158
|
-
* Whether to disable the internal state subscription such as drag over state etc for setting things like data attributes
|
|
159
|
-
* - This is useful if you want to subscribe to the state yourself
|
|
160
|
-
* @default false
|
|
161
|
-
*/
|
|
162
|
-
disableInternalStateSubscription?: boolean;
|
|
163
|
-
/**
|
|
164
|
-
* Whether to disallow preview for non-image files
|
|
165
|
-
* @default true
|
|
166
|
-
*/
|
|
167
|
-
disablePreviewForNonImageFiles?: boolean;
|
|
168
|
-
/**
|
|
169
|
-
* Extra props to pass to various parts of the dropzone
|
|
170
|
-
*/
|
|
171
|
-
extraProps?: PartProps;
|
|
172
|
-
/**
|
|
173
|
-
* Initial files to populate the drop zone
|
|
174
|
-
*/
|
|
175
|
-
initialFiles?: FileMeta | FileMeta[] | null;
|
|
176
|
-
/**
|
|
177
|
-
* Whether to allow multiple files to be uploaded
|
|
178
|
-
*/
|
|
179
|
-
multiple?: boolean;
|
|
180
|
-
/**
|
|
181
|
-
* Callback function to be called when internal files state changes
|
|
182
|
-
*/
|
|
183
|
-
onFilesChange?: (context: Pick<DropZoneState, "fileStateArray">) => void;
|
|
184
|
-
/**
|
|
185
|
-
* Callback function to be called when new files are uploaded
|
|
186
|
-
*/
|
|
187
|
-
onUpload?: (context: Pick<DropZoneState, "fileStateArray"> & {
|
|
188
|
-
onError: (ctx: FileStateOrIDProp & {
|
|
189
|
-
error: DropZoneError;
|
|
190
|
-
}) => void;
|
|
191
|
-
onProgress: (ctx: FileStateOrIDProp & {
|
|
192
|
-
progress: number;
|
|
193
|
-
}) => void;
|
|
194
|
-
onSuccess: (ctx: FileStateOrIDProp) => void;
|
|
195
|
-
}) => Awaitable<void>;
|
|
196
|
-
/**
|
|
197
|
-
* Callback function to be called on each file validation error as they occur
|
|
198
|
-
*/
|
|
199
|
-
onValidationError?: FileValidationHooksAsync["onErrorEach"];
|
|
200
|
-
/**
|
|
201
|
-
* Callback function to be called once after all files have been successfully validated
|
|
202
|
-
*/
|
|
203
|
-
onValidationSuccess?: FileValidationHooksAsync["onSuccessBatch"];
|
|
204
|
-
/**
|
|
205
|
-
* Whether clicking the drop zone area will open the default file picker or not
|
|
206
|
-
*
|
|
207
|
-
* @default true
|
|
208
|
-
*/
|
|
209
|
-
shouldOpenFilePickerOnAreaClick?: boolean;
|
|
210
|
-
/**
|
|
211
|
-
* Custom validation function.
|
|
212
|
-
*
|
|
213
|
-
* If the function returns false, the file will be rejected
|
|
214
|
-
*
|
|
215
|
-
*/
|
|
216
|
-
validator?: FileValidationSettingsAsync["validator"];
|
|
217
|
-
}
|
|
218
|
-
//#endregion
|
|
219
|
-
//#region src/components/ui/drop-zone/drop-zone-store.d.ts
|
|
220
|
-
type DropZoneStore = DropZoneActions & DropZoneState;
|
|
221
|
-
type RequiredUseDropZoneProps = { [Key in keyof Required<UseDropZoneProps>]: UseDropZoneProps[Key] | undefined };
|
|
222
|
-
type InitStoreValues = Omit<RequiredUseDropZoneProps, "disabled" | "disableInternalStateSubscription" | "extraProps" | "shouldOpenFilePickerOnAreaClick"> & {
|
|
223
|
-
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
224
|
-
};
|
|
225
|
-
declare const createDropZoneStore: (initStoreValues: InitStoreValues) => _zayne_labs_toolkit_core1.StoreApi<DropZoneStore>;
|
|
226
|
-
//#endregion
|
|
227
|
-
//#region src/components/ui/drop-zone/drop-zone-context.d.ts
|
|
228
|
-
declare const DropZoneStoreContextProvider: (props: {
|
|
229
|
-
children: React.ReactNode;
|
|
230
|
-
store: _zayne_labs_toolkit_core1.StoreApi<DropZoneStore>;
|
|
231
|
-
}) => react1.FunctionComponentElement<react1.ProviderProps<_zayne_labs_toolkit_core1.StoreApi<DropZoneStore>>>, useDropZoneStoreContext: <TResult = DropZoneStore>(selector?: _zayne_labs_toolkit_type_helpers0.SelectorFn<DropZoneStore, TResult> | undefined) => TResult;
|
|
232
|
-
type FileItemContextType = {
|
|
233
|
-
fileState: FileState;
|
|
234
|
-
};
|
|
235
|
-
//#endregion
|
|
236
|
-
//#region src/components/ui/drop-zone/drop-zone.d.ts
|
|
237
|
-
type DropZoneRootProps = UseDropZoneProps & {
|
|
238
|
-
children: react1.ReactNode;
|
|
239
|
-
};
|
|
240
|
-
declare function DropZoneRoot(props: DropZoneRootProps): react_jsx_runtime10.JSX.Element;
|
|
241
|
-
type DropZoneContextProps<TSlice> = {
|
|
242
|
-
children: react1.ReactNode | ((context: TSlice) => react1.ReactNode);
|
|
243
|
-
selector?: SelectorFn<DropZoneStore, TSlice>;
|
|
244
|
-
};
|
|
245
|
-
declare function DropZoneContext<TSlice = DropZoneStore>(props: DropZoneContextProps<TSlice>): react1.ReactNode;
|
|
246
|
-
type DropZoneContainerProps = PartInputProps["container"] & {
|
|
247
|
-
asChild?: boolean;
|
|
248
|
-
};
|
|
249
|
-
declare function DropZoneContainer<TElement extends react1.ElementType = "div">(props: PolymorphicPropsStrict<TElement, DropZoneContainerProps>): react_jsx_runtime10.JSX.Element;
|
|
250
|
-
type DropZoneInputProps = PartInputProps["input"] & {
|
|
251
|
-
asChild?: boolean;
|
|
252
|
-
};
|
|
253
|
-
declare function DropZoneInput(props: DropZoneInputProps): react_jsx_runtime10.JSX.Element;
|
|
254
|
-
type DropZoneAreaProps<TSlice> = {
|
|
255
|
-
children: react1.ReactNode | ((context: TSlice) => react1.ReactNode);
|
|
256
|
-
classNames?: Partial<Record<Extract<keyof PartInputProps, "container" | "input">, string>>;
|
|
257
|
-
extraProps?: Pick<PartInputProps, "container" | "input">;
|
|
258
|
-
selector?: SelectorFn<DropZoneStore, TSlice>;
|
|
259
|
-
};
|
|
260
|
-
declare function DropZoneArea<TSlice = DropZoneStore>(props: DropZoneAreaProps<TSlice>): react_jsx_runtime10.JSX.Element;
|
|
261
|
-
type DropZoneTriggerProps = PartInputProps["trigger"] & {
|
|
262
|
-
asChild?: boolean;
|
|
263
|
-
};
|
|
264
|
-
declare function DropZoneTrigger(props: DropZoneTriggerProps): react_jsx_runtime10.JSX.Element;
|
|
265
|
-
type ListPerItemContext = Pick<DropZoneStore, "actions"> & {
|
|
266
|
-
array: DropZoneStore["fileStateArray"];
|
|
267
|
-
fileState: DropZoneStore["fileStateArray"][number];
|
|
268
|
-
index: number;
|
|
269
|
-
};
|
|
270
|
-
type FileListPerItemVariant = {
|
|
271
|
-
children: react1.ReactNode | ((context: ListPerItemContext) => react1.ReactNode);
|
|
272
|
-
renderMode?: "per-item";
|
|
273
|
-
};
|
|
274
|
-
type ListManualListContext = Pick<DropZoneStore, "actions" | "fileStateArray">;
|
|
275
|
-
type FileListManualListVariant = {
|
|
276
|
-
children: react1.ReactNode | ((context: ListManualListContext) => react1.ReactNode);
|
|
277
|
-
renderMode: "manual-list";
|
|
278
|
-
};
|
|
279
|
-
type DropZoneFileListProps = Omit<PartInputProps["fileList"], "children"> & {
|
|
280
|
-
asChild?: boolean;
|
|
281
|
-
forceMount?: boolean;
|
|
282
|
-
} & (FileListManualListVariant | FileListPerItemVariant);
|
|
283
|
-
declare function DropZoneFileList<TElement extends react1.ElementType = "ul">(props: PolymorphicPropsStrict<TElement, DropZoneFileListProps>): react_jsx_runtime10.JSX.Element;
|
|
284
|
-
type DropZoneFileItemProps = FileItemContextType & PartInputProps["fileItem"] & {
|
|
285
|
-
asChild?: boolean;
|
|
286
|
-
};
|
|
287
|
-
declare function DropZoneFileItem<TElement extends react1.ElementType = "li">(props: PolymorphicPropsStrict<TElement, DropZoneFileItemProps>): react_jsx_runtime10.JSX.Element;
|
|
288
|
-
type DropZoneFileItemDeleteProps = PartInputProps["fileItemDelete"] & {
|
|
289
|
-
asChild?: boolean;
|
|
290
|
-
};
|
|
291
|
-
declare function DropZoneFileItemDelete(props: DropZoneFileItemDeleteProps): react_jsx_runtime10.JSX.Element;
|
|
292
|
-
type DropZoneFileItemProgressProps = PartInputProps["fileItemProgress"] & {
|
|
293
|
-
asChild?: boolean;
|
|
294
|
-
forceMount?: boolean;
|
|
295
|
-
size?: number;
|
|
296
|
-
};
|
|
297
|
-
declare function DropZoneFileItemProgress<TElement extends react1.ElementType = "span">(props: PolymorphicPropsStrict<TElement, DropZoneFileItemProgressProps>): react_jsx_runtime10.JSX.Element | null;
|
|
298
|
-
type RenderPreviewDetails = {
|
|
299
|
-
className?: string;
|
|
300
|
-
node?: react1.ReactNode;
|
|
301
|
-
};
|
|
302
|
-
type RenderPropContext = Pick<FileItemContextType, "fileState"> & {
|
|
303
|
-
fileExtension: string;
|
|
304
|
-
fileType: string;
|
|
305
|
-
};
|
|
306
|
-
type RenderPreview = (context: RenderPropContext) => {
|
|
307
|
-
archive?: RenderPreviewDetails;
|
|
308
|
-
audio?: RenderPreviewDetails;
|
|
309
|
-
code?: RenderPreviewDetails;
|
|
310
|
-
default?: RenderPreviewDetails;
|
|
311
|
-
executable?: RenderPreviewDetails;
|
|
312
|
-
image?: RenderPreviewDetails;
|
|
313
|
-
text?: RenderPreviewDetails;
|
|
314
|
-
video?: RenderPreviewDetails;
|
|
315
|
-
};
|
|
316
|
-
type DropZoneFileItemPreviewProps = Omit<PartInputProps["fileItemPreview"], "children"> & Partial<Pick<FileItemContextType, "fileState">> & {
|
|
317
|
-
asChild?: boolean;
|
|
318
|
-
children?: react1.ReactNode | ((context: RenderPropContext) => react1.ReactNode);
|
|
319
|
-
renderPreview?: boolean | RenderPreview;
|
|
320
|
-
};
|
|
321
|
-
declare function DropZoneFileItemPreview<TElement extends react1.ElementType>(props: PolymorphicPropsStrict<TElement, DropZoneFileItemPreviewProps>): react_jsx_runtime10.JSX.Element | null;
|
|
322
|
-
type DropZoneFileItemMetadataProps = Omit<PartInputProps["fileItemMetadata"], "children"> & Partial<Pick<FileItemContextType, "fileState">> & {
|
|
323
|
-
asChild?: boolean;
|
|
324
|
-
children?: react1.ReactNode | ((context: Pick<FileItemContextType, "fileState">) => react1.ReactNode);
|
|
325
|
-
classNames?: {
|
|
326
|
-
name?: string;
|
|
327
|
-
size?: string;
|
|
328
|
-
};
|
|
329
|
-
size?: "default" | "sm";
|
|
330
|
-
};
|
|
331
|
-
declare function DropZoneFileItemMetadata(props: DropZoneFileItemMetadataProps): react_jsx_runtime10.JSX.Element | null;
|
|
332
|
-
type DropZoneFileClearProps = PartInputProps["fileItemClear"] & {
|
|
333
|
-
asChild?: boolean;
|
|
334
|
-
forceMount?: boolean;
|
|
335
|
-
};
|
|
336
|
-
declare function DropZoneFileClear(props: DropZoneFileClearProps): react_jsx_runtime10.JSX.Element | null;
|
|
337
|
-
declare namespace drop_zone_parts_d_exports {
|
|
338
|
-
export { DropZoneArea as Area, DropZoneContainer as Container, DropZoneContext as Context, DropZoneFileClear as FileClear, DropZoneFileItem as FileItem, DropZoneFileItemDelete as FileItemDelete, DropZoneFileItemMetadata as FileItemMetadata, DropZoneFileItemPreview as FileItemPreview, DropZoneFileItemProgress as FileItemProgress, DropZoneFileList as FileList, DropZoneInput as Input, DropZoneRoot as Root, DropZoneTrigger as Trigger };
|
|
339
|
-
}
|
|
340
|
-
//#endregion
|
|
341
|
-
//#region src/components/ui/drop-zone/use-drop-zone.d.ts
|
|
342
|
-
declare const useDropZone: (props?: UseDropZoneProps) => UseDropZoneResult;
|
|
343
|
-
//#endregion
|
|
344
|
-
export { DropZoneArea, DropZoneContainer, DropZoneContext, DropZoneError, DropZoneFileClear, DropZoneFileItem, DropZoneFileItemDelete, DropZoneFileItemMetadata, DropZoneFileItemPreview, DropZoneFileItemProgress, DropZoneFileList, DropZoneInput, DropZoneRoot, DropZoneTrigger, drop_zone_parts_d_exports, useDropZone, useDropZoneStoreContext };
|
|
345
|
-
//# sourceMappingURL=index-RpfwCCWX.d.ts.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PolymorphicProps } from "@zayne-labs/toolkit-react/utils";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
-
|
|
5
|
-
//#region src/components/ui/card/card.d.ts
|
|
6
|
-
declare function CardRoot<TElement extends React.ElementType = "article">(props: PolymorphicProps<TElement>): react_jsx_runtime0.JSX.Element;
|
|
7
|
-
declare function CardHeader<TElement extends React.ElementType = "header">(props: PolymorphicProps<TElement>): react_jsx_runtime0.JSX.Element;
|
|
8
|
-
declare function CardTitle<TElement extends React.ElementType = "h3">(props: PolymorphicProps<TElement>): react_jsx_runtime0.JSX.Element;
|
|
9
|
-
declare function CardDescription<TElement extends React.ElementType = "p">(props: PolymorphicProps<TElement>): react_jsx_runtime0.JSX.Element;
|
|
10
|
-
declare function CardContent<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime0.JSX.Element;
|
|
11
|
-
declare function CardAction<TElement extends React.ElementType = "div">(props: PolymorphicProps<TElement>): react_jsx_runtime0.JSX.Element;
|
|
12
|
-
declare function CardFooter<TElement extends React.ElementType = "footer">(props: PolymorphicProps<TElement, {
|
|
13
|
-
asChild?: boolean;
|
|
14
|
-
}>): react_jsx_runtime0.JSX.Element;
|
|
15
|
-
declare namespace card_parts_d_exports {
|
|
16
|
-
export { CardAction as Action, CardContent as Content, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title };
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
|
-
export { CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle, card_parts_d_exports };
|
|
20
|
-
//# sourceMappingURL=index-bD-GMufy.d.ts.map
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { PolymorphicPropsStrict } from "@zayne-labs/toolkit-react/utils";
|
|
2
|
-
import { UnionDiscriminator } from "@zayne-labs/toolkit-type-helpers";
|
|
3
|
-
import * as React$1 from "react";
|
|
4
|
-
import * as react_jsx_runtime40 from "react/jsx-runtime";
|
|
5
|
-
import { StoreApi } from "@zayne-labs/toolkit-core";
|
|
6
|
-
|
|
7
|
-
//#region src/components/ui/carousel/types.d.ts
|
|
8
|
-
type ImagesType = Array<Record<string, string>> | string[];
|
|
9
|
-
type CarouselStore<TImages extends ImagesType = any> = {
|
|
10
|
-
actions: {
|
|
11
|
-
goToNextSlide: () => void;
|
|
12
|
-
goToPreviousSlide: () => void;
|
|
13
|
-
goToSlide: (newValue: number) => void;
|
|
14
|
-
};
|
|
15
|
-
currentSlide: number;
|
|
16
|
-
images: TImages;
|
|
17
|
-
maxSlide: number;
|
|
18
|
-
};
|
|
19
|
-
type CarouselStoreApi<TImages extends ImagesType = ImagesType> = StoreApi<CarouselStore<TImages>>;
|
|
20
|
-
type CarouselRootProps<TImages extends ImagesType = ImagesType> = {
|
|
21
|
-
autoSlideInterval?: number;
|
|
22
|
-
children: React.ReactNode;
|
|
23
|
-
classNames?: {
|
|
24
|
-
base?: string;
|
|
25
|
-
scrollContainer?: string;
|
|
26
|
-
};
|
|
27
|
-
hasAutoSlide?: boolean;
|
|
28
|
-
images: CarouselStore<TImages>["images"];
|
|
29
|
-
onSlideBtnClick?: () => void;
|
|
30
|
-
shouldPauseOnHover?: boolean;
|
|
31
|
-
};
|
|
32
|
-
type CarouselButtonsProps = {
|
|
33
|
-
classNames?: {
|
|
34
|
-
base?: string;
|
|
35
|
-
defaultIcon?: string;
|
|
36
|
-
iconContainer?: string;
|
|
37
|
-
};
|
|
38
|
-
icon?: React.ReactElement;
|
|
39
|
-
variant: "next" | "prev";
|
|
40
|
-
};
|
|
41
|
-
type CarouselControlProps = {
|
|
42
|
-
classNames?: {
|
|
43
|
-
base?: string;
|
|
44
|
-
defaultIcon?: string;
|
|
45
|
-
iconContainer?: string;
|
|
46
|
-
};
|
|
47
|
-
icon?: UnionDiscriminator<[{
|
|
48
|
-
icon?: React.ReactElement;
|
|
49
|
-
iconType: "nextIcon" | "prevIcon";
|
|
50
|
-
}, {
|
|
51
|
-
next?: React.ReactElement;
|
|
52
|
-
prev?: React.ReactElement;
|
|
53
|
-
}]>;
|
|
54
|
-
};
|
|
55
|
-
type CarouselIndicatorProps = {
|
|
56
|
-
classNames?: {
|
|
57
|
-
base?: string;
|
|
58
|
-
button?: string;
|
|
59
|
-
isActive?: string;
|
|
60
|
-
};
|
|
61
|
-
currentIndex: number;
|
|
62
|
-
};
|
|
63
|
-
type RenderPropFn<TArrayItem> = (context: {
|
|
64
|
-
array: NoInfer<TArrayItem[]>;
|
|
65
|
-
image: NoInfer<TArrayItem>;
|
|
66
|
-
index: number;
|
|
67
|
-
}) => React.ReactNode;
|
|
68
|
-
type BaseWrapperProps<TArrayItem> = {
|
|
69
|
-
children: React.ReactNode | RenderPropFn<TArrayItem>;
|
|
70
|
-
each?: TArrayItem[];
|
|
71
|
-
};
|
|
72
|
-
type CarouselWrapperProps<TArrayItem> = BaseWrapperProps<TArrayItem> & {
|
|
73
|
-
className?: string;
|
|
74
|
-
};
|
|
75
|
-
type OtherCarouselProps = {
|
|
76
|
-
children?: React.ReactNode;
|
|
77
|
-
className?: string;
|
|
78
|
-
style?: React.CSSProperties;
|
|
79
|
-
};
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/components/ui/carousel/carousel.d.ts
|
|
82
|
-
declare function CarouselRoot<TImages extends ImagesType, TElement extends React$1.ElementType = "div">(props: PolymorphicPropsStrict<TElement, CarouselRootProps<TImages>>): react_jsx_runtime40.JSX.Element;
|
|
83
|
-
declare function CarouselButton(props: CarouselButtonsProps): react_jsx_runtime40.JSX.Element;
|
|
84
|
-
declare function CarouselControls(props: CarouselControlProps): react_jsx_runtime40.JSX.Element;
|
|
85
|
-
declare function CarouselItemList<TArrayItem>(props: CarouselWrapperProps<TArrayItem>): react_jsx_runtime40.JSX.Element;
|
|
86
|
-
declare function CarouselItem(props: OtherCarouselProps): react_jsx_runtime40.JSX.Element;
|
|
87
|
-
declare function CarouselCaption<TElement extends React$1.ElementType = "div">(props: PolymorphicPropsStrict<TElement, OtherCarouselProps>): react_jsx_runtime40.JSX.Element;
|
|
88
|
-
declare function CarouselIndicatorList<TArrayItem>(props: CarouselWrapperProps<TArrayItem>): react_jsx_runtime40.JSX.Element;
|
|
89
|
-
declare function CarouselIndicator(props: CarouselIndicatorProps): react_jsx_runtime40.JSX.Element;
|
|
90
|
-
declare namespace carousel_parts_d_exports {
|
|
91
|
-
export { CarouselButton as Button, CarouselCaption as Caption, CarouselControls as Controls, CarouselIndicator as Indicator, CarouselIndicatorList as IndicatorGroup, CarouselItem as Item, CarouselItemList as ItemGroup, CarouselRoot as Root };
|
|
92
|
-
}
|
|
93
|
-
//#endregion
|
|
94
|
-
export { CarouselButton, CarouselButtonsProps, CarouselCaption, CarouselControlProps, CarouselControls, CarouselIndicator, CarouselIndicatorList, CarouselIndicatorProps, CarouselItem, CarouselItemList, CarouselRoot, CarouselRootProps, CarouselStore, CarouselStoreApi, CarouselWrapperProps, ImagesType, OtherCarouselProps, carousel_parts_d_exports };
|
|
95
|
-
//# sourceMappingURL=index-ipYGGqwN.d.ts.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ErrorBoundary } from "./error-boundary-y9Samt_s.js";
|
|
2
|
-
import { Suspense } from "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
5
|
-
//#region src/components/common/suspense-with-boundary/suspense-with-boundary.tsx
|
|
6
|
-
function SuspenseWithBoundary(props) {
|
|
7
|
-
const { children, errorFallback, fallback } = props;
|
|
8
|
-
const errorBoundaryProps = Boolean(errorFallback) && { fallback: errorFallback };
|
|
9
|
-
const suspenseProps = Boolean(fallback) && { fallback };
|
|
10
|
-
return /* @__PURE__ */ jsx(ErrorBoundary, {
|
|
11
|
-
...errorBoundaryProps,
|
|
12
|
-
children: /* @__PURE__ */ jsx(Suspense, {
|
|
13
|
-
...suspenseProps,
|
|
14
|
-
children
|
|
15
|
-
})
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { SuspenseWithBoundary };
|
|
21
|
-
//# sourceMappingURL=suspense-with-boundary-D-1NYDV4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suspense-with-boundary-D-1NYDV4.js","names":[],"sources":["../../src/components/common/suspense-with-boundary/suspense-with-boundary.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Suspense } from \"react\";\nimport { ErrorBoundary, type ErrorBoundaryProps } from \"../error-boundary\";\n\nexport type SuspenseWithBoundaryProps = {\n\tchildren: React.ReactNode;\n\terrorFallback?: ErrorBoundaryProps[\"fallback\"];\n\tfallback?: React.ReactNode;\n};\n\nexport function SuspenseWithBoundary(props: SuspenseWithBoundaryProps) {\n\tconst { children, errorFallback, fallback } = props;\n\n\tconst errorBoundaryProps = Boolean(errorFallback) && { fallback: errorFallback };\n\tconst suspenseProps = Boolean(fallback) && { fallback };\n\n\treturn (\n\t\t<ErrorBoundary {...errorBoundaryProps}>\n\t\t\t<Suspense {...suspenseProps}>{children}</Suspense>\n\t\t</ErrorBoundary>\n\t);\n}\n"],"mappings":";;;;;AAUA,SAAgB,qBAAqB,OAAkC;CACtE,MAAM,EAAE,UAAU,eAAe,aAAa;CAE9C,MAAM,qBAAqB,QAAQ,cAAc,IAAI,EAAE,UAAU,eAAe;CAChF,MAAM,gBAAgB,QAAQ,SAAS,IAAI,EAAE,UAAU;AAEvD,QACC,oBAAC;EAAc,GAAI;YAClB,oBAAC;GAAS,GAAI;GAAgB;IAAoB;GACnC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { __export } from "./chunk-CTAAG5j7.js";
|
|
2
|
-
import { getRegularChildren, getSingleSlot } from "@zayne-labs/toolkit-react/utils";
|
|
3
|
-
import { isFunction } from "@zayne-labs/toolkit-type-helpers";
|
|
4
|
-
import "react";
|
|
5
|
-
|
|
6
|
-
//#region src/components/common/switch/switch.tsx
|
|
7
|
-
const defaultValueSymbol = Symbol("default-value");
|
|
8
|
-
function SwitchRoot(props) {
|
|
9
|
-
const { children, value = defaultValueSymbol } = props;
|
|
10
|
-
const defaultCase = getSingleSlot(children, SwitchDefault, {
|
|
11
|
-
errorMessage: "Only one <Switch.Default> component is allowed",
|
|
12
|
-
throwOnMultipleSlotMatch: true
|
|
13
|
-
});
|
|
14
|
-
return getRegularChildren(children, SwitchDefault).find((child) => {
|
|
15
|
-
if (value === defaultValueSymbol) return Boolean(child.props.when);
|
|
16
|
-
return child.props.when === value;
|
|
17
|
-
}) ?? defaultCase;
|
|
18
|
-
}
|
|
19
|
-
function SwitchMatch(props) {
|
|
20
|
-
const { children, when } = props;
|
|
21
|
-
return isFunction(children) ? children(when) : children;
|
|
22
|
-
}
|
|
23
|
-
function SwitchDefault({ children }) {
|
|
24
|
-
return children;
|
|
25
|
-
}
|
|
26
|
-
SwitchDefault.slotSymbol = Symbol("switch-default");
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/components/common/switch/switch-parts.ts
|
|
30
|
-
var switch_parts_exports = __export({
|
|
31
|
-
Default: () => SwitchDefault,
|
|
32
|
-
Match: () => SwitchMatch,
|
|
33
|
-
Root: () => SwitchRoot
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
//#endregion
|
|
37
|
-
export { SwitchDefault, SwitchMatch, SwitchRoot, switch_parts_exports };
|
|
38
|
-
//# sourceMappingURL=switch-Ch22z21e.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"switch-Ch22z21e.js","names":[],"sources":["../../src/components/common/switch/switch.tsx","../../src/components/common/switch/switch-parts.ts"],"sourcesContent":["\"use client\";\n\nimport { getRegularChildren, getSingleSlot } from \"@zayne-labs/toolkit-react/utils\";\nimport { isFunction } from \"@zayne-labs/toolkit-type-helpers\";\nimport * as React from \"react\";\n\ntype ValidSwitchComponentType = React.ReactElement<SwitchMatchProps<unknown>>;\n\ntype SwitchProps = {\n\tchildren: ValidSwitchComponentType | ValidSwitchComponentType[];\n\tvalue?: unknown;\n};\n\nconst defaultValueSymbol = Symbol(\"default-value\");\n\nexport function SwitchRoot(props: SwitchProps) {\n\tconst { children, value = defaultValueSymbol } = props;\n\n\tconst defaultCase = getSingleSlot(children, SwitchDefault, {\n\t\terrorMessage: \"Only one <Switch.Default> component is allowed\",\n\t\tthrowOnMultipleSlotMatch: true,\n\t});\n\n\tconst childrenCasesArray = getRegularChildren(children, SwitchDefault) as ValidSwitchComponentType[];\n\n\tconst matchedCase = childrenCasesArray.find((child) => {\n\t\t// == If value is defaultValueSymbol, match the cases in order like switch(true)\n\t\tif (value === defaultValueSymbol) {\n\t\t\treturn Boolean(child.props.when);\n\t\t}\n\n\t\t// == Otherwise, match the cases like switch(value)\n\t\treturn child.props.when === value;\n\t});\n\n\treturn matchedCase ?? defaultCase;\n}\n\ntype SwitchMatchProps<TWhen> = {\n\tchildren: React.ReactNode | ((value: TWhen) => React.ReactNode);\n\twhen: false | TWhen | null | undefined;\n};\n\nexport function SwitchMatch<TWhen>(props: SwitchMatchProps<TWhen>) {\n\tconst { children, when } = props;\n\n\tconst resolvedChildren = isFunction(children) ? children(when as TWhen) : children;\n\n\treturn resolvedChildren;\n}\n\nexport function SwitchDefault({ children }: { children: React.ReactNode }) {\n\treturn children;\n}\nSwitchDefault.slotSymbol = Symbol(\"switch-default\");\n","export { SwitchDefault as Default, SwitchMatch as Match, SwitchRoot as Root } from \"./switch\";\n"],"mappings":";;;;;;AAaA,MAAM,qBAAqB,OAAO,gBAAgB;AAElD,SAAgB,WAAW,OAAoB;CAC9C,MAAM,EAAE,UAAU,QAAQ,uBAAuB;CAEjD,MAAM,cAAc,cAAc,UAAU,eAAe;EAC1D,cAAc;EACd,0BAA0B;EAC1B,CAAC;AAcF,QAZ2B,mBAAmB,UAAU,cAAc,CAE/B,MAAM,UAAU;AAEtD,MAAI,UAAU,mBACb,QAAO,QAAQ,MAAM,MAAM,KAAK;AAIjC,SAAO,MAAM,MAAM,SAAS;GAC3B,IAEoB;;AAQvB,SAAgB,YAAmB,OAAgC;CAClE,MAAM,EAAE,UAAU,SAAS;AAI3B,QAFyB,WAAW,SAAS,GAAG,SAAS,KAAc,GAAG;;AAK3E,SAAgB,cAAc,EAAE,YAA2C;AAC1E,QAAO;;AAER,cAAc,aAAa,OAAO,iBAAiB"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { isString } from "@zayne-labs/toolkit-type-helpers";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
4
|
-
|
|
5
|
-
//#region src/components/common/teleport/teleport.tsx
|
|
6
|
-
function Teleport(props) {
|
|
7
|
-
const { children, insertPosition, to } = props;
|
|
8
|
-
const [portalContainer, setPortalContainer] = useState(null);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (!to) return;
|
|
11
|
-
if (insertPosition) return;
|
|
12
|
-
const destination = isString(to) ? document.querySelector(to) : to;
|
|
13
|
-
destination && setPortalContainer(destination);
|
|
14
|
-
}, [to, insertPosition]);
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
if (!to) return;
|
|
17
|
-
if (!insertPosition) return;
|
|
18
|
-
const destination = isString(to) ? document.querySelector(to) : to;
|
|
19
|
-
const tempWrapper = document.createElement("div");
|
|
20
|
-
tempWrapper.style.display = "contents";
|
|
21
|
-
destination?.insertAdjacentElement(insertPosition, tempWrapper);
|
|
22
|
-
setPortalContainer(tempWrapper);
|
|
23
|
-
return () => {
|
|
24
|
-
tempWrapper.remove();
|
|
25
|
-
};
|
|
26
|
-
}, [to, insertPosition]);
|
|
27
|
-
return portalContainer && createPortal(children, portalContainer);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
export { Teleport };
|
|
32
|
-
//# sourceMappingURL=teleport-C8TzRm4M.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"teleport-C8TzRm4M.js","names":[],"sources":["../../src/components/common/teleport/teleport.tsx"],"sourcesContent":["\"use client\";\n\nimport { type AnyString, isString } from \"@zayne-labs/toolkit-type-helpers\";\nimport * as React from \"react\";\nimport { useEffect, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\ntype ValidHtmlTags = keyof HTMLElementTagNameMap;\n\ntype PortalProps = {\n\tchildren: React.ReactNode;\n\tinsertPosition?: InsertPosition;\n\tto: AnyString | HTMLElement | ValidHtmlTags | null;\n};\n\nfunction Teleport(props: PortalProps) {\n\tconst { children, insertPosition, to } = props;\n\n\tconst [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);\n\n\t/* eslint-disable react-hooks-extra/no-direct-set-state-in-use-effect -- Allow */\n\n\tuseEffect(() => {\n\t\tif (!to) return;\n\n\t\tif (insertPosition) return;\n\n\t\tconst destination = isString(to) ? document.querySelector<HTMLElement>(to) : to;\n\n\t\tdestination && setPortalContainer(destination);\n\t}, [to, insertPosition]);\n\n\tuseEffect(() => {\n\t\tif (!to) return;\n\n\t\tif (!insertPosition) return;\n\n\t\tconst destination = isString(to) ? document.querySelector<HTMLElement>(to) : to;\n\n\t\tconst tempWrapper = document.createElement(\"div\");\n\t\ttempWrapper.style.display = \"contents\";\n\n\t\tdestination?.insertAdjacentElement(insertPosition, tempWrapper);\n\n\t\tsetPortalContainer(tempWrapper);\n\n\t\treturn () => {\n\t\t\ttempWrapper.remove();\n\t\t};\n\t}, [to, insertPosition]);\n\n\t/* eslint-enable react-hooks-extra/no-direct-set-state-in-use-effect -- Allow */\n\n\treturn portalContainer && createPortal(children, portalContainer);\n}\n\nexport { Teleport };\n"],"mappings":";;;;;AAeA,SAAS,SAAS,OAAoB;CACrC,MAAM,EAAE,UAAU,gBAAgB,OAAO;CAEzC,MAAM,CAAC,iBAAiB,sBAAsB,SAA6B,KAAK;AAIhF,iBAAgB;AACf,MAAI,CAAC,GAAI;AAET,MAAI,eAAgB;EAEpB,MAAM,cAAc,SAAS,GAAG,GAAG,SAAS,cAA2B,GAAG,GAAG;AAE7E,iBAAe,mBAAmB,YAAY;IAC5C,CAAC,IAAI,eAAe,CAAC;AAExB,iBAAgB;AACf,MAAI,CAAC,GAAI;AAET,MAAI,CAAC,eAAgB;EAErB,MAAM,cAAc,SAAS,GAAG,GAAG,SAAS,cAA2B,GAAG,GAAG;EAE7E,MAAM,cAAc,SAAS,cAAc,MAAM;AACjD,cAAY,MAAM,UAAU;AAE5B,eAAa,sBAAsB,gBAAgB,YAAY;AAE/D,qBAAmB,YAAY;AAE/B,eAAa;AACZ,eAAY,QAAQ;;IAEnB,CAAC,IAAI,eAAe,CAAC;AAIxB,QAAO,mBAAmB,aAAa,UAAU,gBAAgB"}
|
package/dist/esm/ui/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { card_parts_d_exports } from "../index-bD-GMufy.js";
|
|
2
|
-
import { carousel_parts_d_exports } from "../index-ipYGGqwN.js";
|
|
3
|
-
import { useDragScroll } from "../index-C1GPFYKG.js";
|
|
4
|
-
import { drop_zone_parts_d_exports, useDropZone } from "../index-RpfwCCWX.js";
|
|
5
|
-
import { form_parts_d_exports } from "../index-BJUTFSec.js";
|
|
6
|
-
export { card_parts_d_exports as Card, carousel_parts_d_exports as Carousel, drop_zone_parts_d_exports as DropZone, form_parts_d_exports as Form, useDragScroll, useDropZone };
|
package/dist/esm/ui/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import "../error-boundary-y9Samt_s.js";
|
|
2
|
-
import "../slot-WVWfOlr3.js";
|
|
3
|
-
import "../await-DDgVzpvI.js";
|
|
4
|
-
import "../for-DK5rEY_m.js";
|
|
5
|
-
import "../show-N1ZXBhoA.js";
|
|
6
|
-
import "../suspense-with-boundary-D-1NYDV4.js";
|
|
7
|
-
import "../switch-Ch22z21e.js";
|
|
8
|
-
import "../teleport-C8TzRm4M.js";
|
|
9
|
-
import "../common-PS3X58Pj.js";
|
|
10
|
-
import "../cn-s-D7vHW1.js";
|
|
11
|
-
import { card_parts_exports } from "../card-DDLJVCwL.js";
|
|
12
|
-
import { carousel_parts_exports } from "../carousel-B051PAAX.js";
|
|
13
|
-
import { useDragScroll } from "../drag-scroll-Bb1SG4On.js";
|
|
14
|
-
import "../presence-CL5_GHQH.js";
|
|
15
|
-
import { drop_zone_parts_exports, useDropZone } from "../drop-zone-FkkbzZ3j.js";
|
|
16
|
-
import { form_parts_exports } from "../form-DyGy9LnA.js";
|
|
17
|
-
|
|
18
|
-
export { card_parts_exports as Card, carousel_parts_exports as Carousel, drop_zone_parts_exports as DropZone, form_parts_exports as Form, useDragScroll, useDropZone };
|