@px-ui/forms 7.0.1 → 8.0.0
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/index.d.ts +13 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -110
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import { Combobox,
|
|
3
|
+
import { Combobox, DropzoneRenderProps, DropzoneState, FileUploadItem, InputGroup, Label, Select, UseFileUploadOptions, VariantProps } from "@px-ui/core";
|
|
4
4
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
5
|
import { ControllerProps, FieldPath, FieldValues } from "react-hook-form";
|
|
6
6
|
import "react-phone-input-2/lib/style.css";
|
|
@@ -250,19 +250,15 @@ declare function CurrencySelectField({
|
|
|
250
250
|
declare const CURRENCY_FLAG_CODE: Record<string, string>;
|
|
251
251
|
//#endregion
|
|
252
252
|
//#region src/components/file-upload-field.d.ts
|
|
253
|
-
interface FileUploadFieldProps extends Omit<
|
|
254
|
-
/**
|
|
255
|
-
variant?: "dropzone" | "button" | "compact";
|
|
256
|
-
/** Size of the dropzone (only applies to dropzone variant) */
|
|
253
|
+
interface FileUploadFieldProps extends Omit<UseFileUploadOptions, "initialFiles"> {
|
|
254
|
+
/** Size of the dropzone (ignored when using render prop) */
|
|
257
255
|
size?: "sm" | "default" | "lg";
|
|
258
|
-
/** Text displayed in the dropzone */
|
|
256
|
+
/** Text displayed in the dropzone (ignored when using render prop) */
|
|
259
257
|
dropzoneText?: string;
|
|
260
|
-
/** Text for the browse/upload button */
|
|
258
|
+
/** Text for the browse/upload button (ignored when using render prop) */
|
|
261
259
|
buttonText?: string;
|
|
262
260
|
/** Show file list below the dropzone */
|
|
263
261
|
showFileList?: boolean;
|
|
264
|
-
/** Show image grid instead of list for image files */
|
|
265
|
-
showImageGrid?: boolean;
|
|
266
262
|
/** Initial files (already uploaded) */
|
|
267
263
|
initialFiles?: Array<{
|
|
268
264
|
id: string;
|
|
@@ -275,10 +271,13 @@ interface FileUploadFieldProps extends Omit<FileUploadWithUploaderOptions, "init
|
|
|
275
271
|
disabled?: boolean;
|
|
276
272
|
/** Custom className */
|
|
277
273
|
className?: string;
|
|
278
|
-
/**
|
|
279
|
-
|
|
274
|
+
/**
|
|
275
|
+
* Render prop for complete dropzone customization.
|
|
276
|
+
* Receives props to spread and state for conditional styling.
|
|
277
|
+
*/
|
|
278
|
+
render?: (props: DropzoneRenderProps, state: DropzoneState) => React$1.ReactElement;
|
|
280
279
|
/** Render prop for custom file item rendering */
|
|
281
|
-
renderFileItem?: (file:
|
|
280
|
+
renderFileItem?: (file: FileUploadItem, actions: {
|
|
282
281
|
remove: () => void;
|
|
283
282
|
retry: () => void;
|
|
284
283
|
}) => React$1.ReactNode;
|
|
@@ -290,16 +289,14 @@ interface FileUploadFieldProps extends Omit<FileUploadWithUploaderOptions, "init
|
|
|
290
289
|
}) => void;
|
|
291
290
|
}
|
|
292
291
|
declare function FileUploadField({
|
|
293
|
-
variant,
|
|
294
292
|
size,
|
|
295
293
|
dropzoneText,
|
|
296
294
|
buttonText,
|
|
297
295
|
showFileList,
|
|
298
|
-
showImageGrid,
|
|
299
296
|
initialFiles,
|
|
300
297
|
disabled,
|
|
301
298
|
className,
|
|
302
|
-
|
|
299
|
+
render,
|
|
303
300
|
renderFileItem,
|
|
304
301
|
onError,
|
|
305
302
|
maxFiles,
|
|
@@ -308,7 +305,7 @@ declare function FileUploadField({
|
|
|
308
305
|
multiple,
|
|
309
306
|
onFilesChange,
|
|
310
307
|
onFilesAdded,
|
|
311
|
-
upload
|
|
308
|
+
upload: uploadConfig
|
|
312
309
|
}: FileUploadFieldProps): react_jsx_runtime0.JSX.Element;
|
|
313
310
|
declare namespace field_d_exports {
|
|
314
311
|
export { Content, Description, Error, Group, Label$1 as Label, Legend, Root, Separator$1 as Separator, Set, Title };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/components/select-field.tsx","../src/components/combobox-field.tsx","../src/components/currency-select-field.tsx","../src/constants/currency-flag-code.ts","../src/components/file-upload-field.tsx","../src/components/field.tsx","../src/components/form.tsx","../src/components/phone-input.tsx"],"sourcesContent":[],"mappings":";;;;;;;;KAGK,6EAGD,OAAA,CAAM,sBAAsB,MAAA,CAAO,KAAK,OAAO;KAE9C,0EAGD,KACF,eAAa,OAAO;UAYZ,qFAGA,YAAU,OAAO;;;;SAIlB,cAAc;EA5BlB;;;;EAGD,WAAM,CAAA,EAAA,CAAA,IAAA,EA8Ba,KA9Bb,EAAA,GA8BuB,OAAA,CAAM,SA9B7B;EAAc;AAAA;;;EAMtB,YAAA,CAAA,EAAA,CAAA,IAAA,EA8BsB,KA9BtB,EAAA,GA8BgC,OAAA,CAAM,SA9BtC;EADE;;AAAI;EAgBY,WAAA,CAAA,EAAA,MAAA;EAAO,IAAA,CAAA,EAsBlB,OAAA,CAAM,cAtBY,CAAA,OAsBU,MAAA,CAAO,OAtBjB,CAAA,CAAA,MAAA,CAAA;EAIJ,YAAA,CAAA,EAoBN,OAAA,CAAM,cApBA,CAAA,OAoBsB,MAAA,CAAO,OApB7B,CAAA,CAAA,cAAA,CAAA;EAAd;;;EAWe,mBAAA,CAAA,EAcA,OAAA,CAAM,cAdN,CAAA,OAeb,MAAA,CAAO,OAfM,CAAA,CAAA,cAAA,CAAA;EAAU,gBAAM,CAAA,EAAA,MAAA;EAOH;;;EAEpB,YAAM,CAAA,EAcN,IAdM,CAenB,OAAA,CAAM,cAfa,CAAA,OAeS,MAAA,CAAO,OAfhB,CAAA,EAAA,UAAA,GAAA,cAAA,CAAA;;;;;;;;AAwCvB;;;;;;;;;AC1FuC;;;;;AAKf,iBDqFR,WCrFQ,CAAA,QAAA,GAAA,EAAA,kBAA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;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/components/select-field.tsx","../src/components/combobox-field.tsx","../src/components/currency-select-field.tsx","../src/constants/currency-flag-code.ts","../src/components/file-upload-field.tsx","../src/components/field.tsx","../src/components/form.tsx","../src/components/phone-input.tsx"],"sourcesContent":[],"mappings":";;;;;;;;KAGK,6EAGD,OAAA,CAAM,sBAAsB,MAAA,CAAO,KAAK,OAAO;KAE9C,0EAGD,KACF,eAAa,OAAO;UAYZ,qFAGA,YAAU,OAAO;;;;SAIlB,cAAc;EA5BlB;;;;EAGD,WAAM,CAAA,EAAA,CAAA,IAAA,EA8Ba,KA9Bb,EAAA,GA8BuB,OAAA,CAAM,SA9B7B;EAAc;AAAA;;;EAMtB,YAAA,CAAA,EAAA,CAAA,IAAA,EA8BsB,KA9BtB,EAAA,GA8BgC,OAAA,CAAM,SA9BtC;EADE;;AAAI;EAgBY,WAAA,CAAA,EAAA,MAAA;EAAO,IAAA,CAAA,EAsBlB,OAAA,CAAM,cAtBY,CAAA,OAsBU,MAAA,CAAO,OAtBjB,CAAA,CAAA,MAAA,CAAA;EAIJ,YAAA,CAAA,EAoBN,OAAA,CAAM,cApBA,CAAA,OAoBsB,MAAA,CAAO,OApB7B,CAAA,CAAA,cAAA,CAAA;EAAd;;;EAWe,mBAAA,CAAA,EAcA,OAAA,CAAM,cAdN,CAAA,OAeb,MAAA,CAAO,OAfM,CAAA,CAAA,cAAA,CAAA;EAAU,gBAAM,CAAA,EAAA,MAAA;EAOH;;;EAEpB,YAAM,CAAA,EAcN,IAdM,CAenB,OAAA,CAAM,cAfa,CAAA,OAeS,MAAA,CAAO,OAfhB,CAAA,EAAA,UAAA,GAAA,cAAA,CAAA;;;;;;;;AAwCvB;;;;;;;;;AC1FuC;;;;;AAKf,iBDqFR,WCrFQ,CAAA,QAAA,GAAA,EAAA,kBAAA,OAAA,GAAA,SAAA,GAAA,KAAA,CAAA,CAAA,KAAA,EDwFf,gBCxFe,CDwFE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N9HH,EM8HiB,eN9HjB;;;UOGA,eAAA;;;;;;;;APR2B;AAKO,cOa/B,UPb+B,EAAA,CAAA;EAAA,KAAA;EAAA,QAAA;EAAA,OAAA;EAAA,KAAA;EAAA,WAAA;EAAA,QAAA;EAAA;AAAA,CAAA,EOqBzC,ePrByC,EAAA,GOqB1B,kBAAA,CAAA,GAAA,CAAA,OPrB0B"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __export } from "./chunk-BAz01cYq.js";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
|
-
import { Checkbox,
|
|
4
|
+
import { Checkbox, Combobox, FileUpload, Input, InputGroup, Label, Select, Separator, Textarea, cn, cva, useFileUpload } from "@px-ui/core";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import ReactCountryFlag from "react-country-flag";
|
|
7
7
|
import { Controller } from "react-hook-form";
|
|
@@ -393,7 +393,6 @@ const CURRENCY_FLAG_CODE = {
|
|
|
393
393
|
|
|
394
394
|
//#endregion
|
|
395
395
|
//#region src/components/currency-select-field.tsx
|
|
396
|
-
const { BaseCombobox } = Combobox;
|
|
397
396
|
function CurrencyFlag({ countryCode, className }) {
|
|
398
397
|
if (!countryCode) return /* @__PURE__ */ jsx("span", { className: cn("inline-block w-4", className) });
|
|
399
398
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -444,8 +443,6 @@ function CurrencyOptionContent({ currency }) {
|
|
|
444
443
|
* ```
|
|
445
444
|
*/
|
|
446
445
|
function CurrencySelectField({ currencies, value, onValueChange, placeholder = "Select currency", disabled, invalid, name, size, widthVariant, contentWidthVariant = "trigger", triggerClassName, isLoading, contentProps, inputRef, readOnly }) {
|
|
447
|
-
const triggerRef = React$1.useRef(null);
|
|
448
|
-
const itemToStringLabel = React$1.useCallback((currency) => `${currency.abbr} - ${currency.name}`, []);
|
|
449
446
|
return /* @__PURE__ */ jsxs(Combobox.Root, {
|
|
450
447
|
items: currencies,
|
|
451
448
|
value,
|
|
@@ -454,55 +451,39 @@ function CurrencySelectField({ currencies, value, onValueChange, placeholder = "
|
|
|
454
451
|
invalid,
|
|
455
452
|
isLoading,
|
|
456
453
|
isItemEqualToValue: (item, val) => item.id === val.id,
|
|
457
|
-
itemToStringLabel,
|
|
458
454
|
inputRef,
|
|
459
455
|
readOnly,
|
|
460
456
|
name,
|
|
461
|
-
children: [/* @__PURE__ */
|
|
462
|
-
size,
|
|
457
|
+
children: [/* @__PURE__ */ jsx(Combobox.Trigger, {
|
|
463
458
|
widthVariant,
|
|
464
|
-
disabled,
|
|
465
|
-
ref: triggerRef,
|
|
466
459
|
className: triggerClassName,
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
align: "inline-end",
|
|
480
|
-
className: "gap-0.5",
|
|
481
|
-
children: /* @__PURE__ */ jsx(BaseCombobox.Trigger, { render: (triggerProps) => /* @__PURE__ */ jsx(InputGroup.Button, {
|
|
482
|
-
size: "icon-xs",
|
|
483
|
-
"aria-label": "Open popup",
|
|
484
|
-
...triggerProps,
|
|
485
|
-
children: /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
486
|
-
}) })
|
|
487
|
-
})
|
|
488
|
-
]
|
|
489
|
-
}), /* @__PURE__ */ jsx(Combobox.Content, {
|
|
460
|
+
size,
|
|
461
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
462
|
+
className: "flex items-center gap-2",
|
|
463
|
+
children: [value && /* @__PURE__ */ jsx(CurrencyFlag, {
|
|
464
|
+
countryCode: CURRENCY_FLAG_CODE[value.abbr],
|
|
465
|
+
className: "w-fit"
|
|
466
|
+
}), /* @__PURE__ */ jsx(Combobox.Value, {
|
|
467
|
+
placeholder,
|
|
468
|
+
children: (currency) => `${currency.abbr} - ${currency.name}`
|
|
469
|
+
})]
|
|
470
|
+
})
|
|
471
|
+
}), /* @__PURE__ */ jsxs(Combobox.Content, {
|
|
490
472
|
widthVariant: contentWidthVariant,
|
|
491
473
|
empty: "No currencies found",
|
|
492
|
-
positionerProps: { anchor: triggerRef.current },
|
|
493
474
|
...contentProps,
|
|
494
|
-
children: /* @__PURE__ */ jsx(Combobox.List, { children: (currency) => /* @__PURE__ */ jsx(Combobox.Item, {
|
|
475
|
+
children: [/* @__PURE__ */ jsx(Combobox.Search, {}), /* @__PURE__ */ jsx(Combobox.List, { children: (currency) => /* @__PURE__ */ jsx(Combobox.Item, {
|
|
495
476
|
value: currency,
|
|
496
477
|
children: /* @__PURE__ */ jsx(CurrencyOptionContent, { currency })
|
|
497
|
-
}, currency.id) })
|
|
478
|
+
}, currency.id) })]
|
|
498
479
|
})]
|
|
499
480
|
});
|
|
500
481
|
}
|
|
501
482
|
|
|
502
483
|
//#endregion
|
|
503
484
|
//#region src/components/file-upload-field.tsx
|
|
504
|
-
function FileUploadField({
|
|
505
|
-
const
|
|
485
|
+
function FileUploadField({ size = "default", dropzoneText = "Paste Or Drag & Drop Files Here", buttonText = "Browse for files", showFileList = true, initialFiles = [], disabled = false, className, render, renderFileItem, onError, maxFiles, maxSize, accept, multiple = false, onFilesChange, onFilesAdded, upload: uploadConfig }) {
|
|
486
|
+
const uploadHook = useFileUpload({
|
|
506
487
|
maxFiles,
|
|
507
488
|
maxSize,
|
|
508
489
|
accept,
|
|
@@ -517,96 +498,34 @@ function FileUploadField({ variant = "dropzone", size = "default", dropzoneText
|
|
|
517
498
|
})),
|
|
518
499
|
onFilesChange,
|
|
519
500
|
onFilesAdded,
|
|
520
|
-
upload
|
|
501
|
+
upload: uploadConfig
|
|
521
502
|
});
|
|
522
|
-
const { files,
|
|
523
|
-
const { addFiles, removeFile, clearFiles, handleDragEnter, handleDragLeave, handleDragOver, handleDrop, openFileDialog, getInputProps, retryUpload } = actions;
|
|
503
|
+
const { files, errors, retryUpload, removeFile } = uploadHook;
|
|
524
504
|
React$1.useEffect(() => {
|
|
525
505
|
if (errors.length > 0 && onError) onError({
|
|
526
506
|
type: "validation",
|
|
527
507
|
message: errors[0]
|
|
528
508
|
});
|
|
529
509
|
}, [errors, onError]);
|
|
530
|
-
const rootProps = {
|
|
531
|
-
files,
|
|
532
|
-
addFiles,
|
|
533
|
-
removeFile,
|
|
534
|
-
clearFiles,
|
|
535
|
-
retryUpload,
|
|
536
|
-
openFileDialog,
|
|
537
|
-
getInputProps,
|
|
538
|
-
handleDragEnter,
|
|
539
|
-
handleDragLeave,
|
|
540
|
-
handleDragOver,
|
|
541
|
-
handleDrop,
|
|
542
|
-
isDragActive: isDragging,
|
|
543
|
-
isUploading,
|
|
544
|
-
accept,
|
|
545
|
-
multiple,
|
|
546
|
-
disabled
|
|
547
|
-
};
|
|
548
510
|
const renderDefaultFileItem = (file) => {
|
|
549
511
|
if (renderFileItem) return renderFileItem(file, {
|
|
550
512
|
remove: () => removeFile(file.id),
|
|
551
513
|
retry: () => retryUpload(file.id)
|
|
552
514
|
});
|
|
553
|
-
|
|
554
|
-
return /* @__PURE__ */ jsxs(FileUpload.Item, {
|
|
555
|
-
file,
|
|
556
|
-
children: [
|
|
557
|
-
/* @__PURE__ */ jsx(FileUpload.ItemPreview, { fallback: isImage ? void 0 : /* @__PURE__ */ jsx(FileIcon, { className: "text-ppx-neutral-10 size-5" }) }),
|
|
558
|
-
/* @__PURE__ */ jsxs("div", {
|
|
559
|
-
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
560
|
-
children: [
|
|
561
|
-
/* @__PURE__ */ jsx(FileUpload.ItemName, {}),
|
|
562
|
-
/* @__PURE__ */ jsxs("div", {
|
|
563
|
-
className: "flex items-center gap-2",
|
|
564
|
-
children: [/* @__PURE__ */ jsx(FileUpload.ItemSize, {}), file.status === "uploading" && /* @__PURE__ */ jsx(FileUpload.ItemProgress, { className: "flex-1" })]
|
|
565
|
-
}),
|
|
566
|
-
/* @__PURE__ */ jsx(FileUpload.ItemError, {})
|
|
567
|
-
]
|
|
568
|
-
}),
|
|
569
|
-
/* @__PURE__ */ jsxs("div", {
|
|
570
|
-
className: "flex shrink-0 items-center gap-1",
|
|
571
|
-
children: [
|
|
572
|
-
/* @__PURE__ */ jsx(FileUpload.ItemStatus, {}),
|
|
573
|
-
/* @__PURE__ */ jsx(FileUpload.ItemRetry, {}),
|
|
574
|
-
/* @__PURE__ */ jsx(FileUpload.ItemRemove, {})
|
|
575
|
-
]
|
|
576
|
-
})
|
|
577
|
-
]
|
|
578
|
-
}, file.id);
|
|
515
|
+
return /* @__PURE__ */ jsx(FileUpload.ListItem, { file }, file.id);
|
|
579
516
|
};
|
|
580
|
-
const renderImageGridItem = (file) => /* @__PURE__ */ jsx(FileUpload.ImageGridItem, {
|
|
581
|
-
file,
|
|
582
|
-
showStatusOverlay: true
|
|
583
|
-
}, file.id);
|
|
584
|
-
if (variant === "button" || variant === "compact") return /* @__PURE__ */ jsxs(FileUpload.Root, {
|
|
585
|
-
...rootProps,
|
|
586
|
-
className,
|
|
587
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
588
|
-
className: "flex items-center gap-3",
|
|
589
|
-
children: [/* @__PURE__ */ jsxs(FileUpload.Trigger, {
|
|
590
|
-
variant: variant === "compact" ? "outline" : "default",
|
|
591
|
-
size: variant === "compact" ? "sm" : "default",
|
|
592
|
-
showUploadingState: true,
|
|
593
|
-
children: [/* @__PURE__ */ jsx(UploadIcon, { className: "size-4" }), buttonText]
|
|
594
|
-
}), variant === "compact" && files.length > 0 && /* @__PURE__ */ jsx("span", {
|
|
595
|
-
className: "text-ppx-neutral-12 truncate text-sm",
|
|
596
|
-
children: files.length === 1 ? files[0].file.name : `${files.length} files selected`
|
|
597
|
-
})]
|
|
598
|
-
}), showFileList && files.length > 0 && variant !== "compact" && /* @__PURE__ */ jsx(FileUpload.ItemList, { children: files.map(renderDefaultFileItem) })]
|
|
599
|
-
});
|
|
600
517
|
return /* @__PURE__ */ jsxs(FileUpload.Root, {
|
|
601
|
-
|
|
518
|
+
upload: uploadHook,
|
|
519
|
+
accept,
|
|
520
|
+
multiple,
|
|
521
|
+
disabled,
|
|
602
522
|
className,
|
|
603
523
|
children: [
|
|
604
524
|
/* @__PURE__ */ jsx(FileUpload.Dropzone, {
|
|
605
525
|
size,
|
|
606
526
|
dropzoneText,
|
|
607
527
|
browseText: buttonText,
|
|
608
|
-
|
|
609
|
-
children
|
|
528
|
+
render
|
|
610
529
|
}),
|
|
611
530
|
errors.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
612
531
|
className: "text-ppx-red-5 text-sm",
|
|
@@ -617,14 +536,14 @@ function FileUploadField({ variant = "dropzone", size = "default", dropzoneText
|
|
|
617
536
|
children: [/* @__PURE__ */ jsx("span", {
|
|
618
537
|
className: "text-ppx-neutral-14 text-sm font-medium",
|
|
619
538
|
children: multiple ? `Files (${files.length})` : "Selected file"
|
|
620
|
-
}), multiple && files.length > 1 && /* @__PURE__ */ jsx(FileUpload.
|
|
539
|
+
}), multiple && files.length > 1 && /* @__PURE__ */ jsx(FileUpload.ClearAll, {
|
|
621
540
|
size: "sm",
|
|
622
541
|
className: "text-ppx-red-5 hover:text-ppx-red-6",
|
|
623
542
|
children: "Remove all"
|
|
624
543
|
})]
|
|
625
|
-
}),
|
|
544
|
+
}), /* @__PURE__ */ jsx(FileUpload.List, { children: files.map(renderDefaultFileItem) })] })
|
|
626
545
|
]
|
|
627
|
-
});
|
|
546
|
+
}, uploadHook.instanceKey);
|
|
628
547
|
}
|
|
629
548
|
|
|
630
549
|
//#endregion
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["items","CURRENCY_FLAG_CODE: Record<string, string>","React","fieldVariants: FieldVariantsType","Label","LabelPrimitive","Separator","SeperatorPrimitive","Field.Label","Field.Description","control","Field.Error","Field.Root","FormInput: FormControlFunc","FormTextarea: FormControlFunc","FormCheckbox: FormControlFunc"],"sources":["../src/components/select-field.tsx","../src/components/combobox-field.tsx","../src/constants/currency-flag-code.ts","../src/components/currency-select-field.tsx","../src/components/file-upload-field.tsx","../src/components/field.tsx","../src/components/form.tsx","../src/components/phone-input.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Select } from \"@px-ui/core\";\n\ntype AllRootProps<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n> = React.ComponentProps<typeof Select.Root<TItem, TMultiple>>;\n\ntype RootProps<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n> = Pick<\n AllRootProps<TItem, TMultiple>,\n | \"value\"\n | \"onValueChange\"\n | \"multiple\"\n | \"disabled\"\n | \"invalid\"\n | \"isItemEqualToValue\"\n | \"inputRef\"\n | \"readOnly\"\n | \"name\"\n>;\n\ninterface SelectFieldProps<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n> extends RootProps<TItem, TMultiple> {\n /**\n * Array of items to display in the select dropdown\n */\n items: ReadonlyArray<TItem>;\n /**\n * Function to render the label in the trigger for the selected item\n * If not provided and item has a 'label' property, it will be used automatically\n */\n renderLabel?: (item: TItem) => React.ReactNode;\n\n /**\n * Function to render each option in the dropdown\n * If not provided and item has a 'label' property, it will be used automatically\n */\n renderOption?: (item: TItem) => React.ReactNode;\n\n /**\n * Placeholder text when no value is selected\n */\n placeholder?: string;\n\n size?: React.ComponentProps<typeof Select.Trigger>[\"size\"];\n\n widthVariant?: React.ComponentProps<typeof Select.Trigger>[\"widthVariant\"];\n\n /**\n * Width variant for the dropdown content\n */\n contentWidthVariant?: React.ComponentProps<\n typeof Select.Content\n >[\"widthVariant\"];\n\n triggerClassName?: string;\n\n /**\n * Additional props for Select.Content\n */\n contentProps?: Omit<\n React.ComponentProps<typeof Select.Content>,\n \"children\" | \"widthVariant\"\n >;\n}\n\n/**\n * A simplified Select component for common use cases.\n * For advanced customization, use the composable Select.* components from @px-ui/core.\n *\n * @example\n * ```tsx\n * const items = [\n * { id: 1, label: 'Option 1' },\n * { id: 2, label: 'Option 2' },\n * ];\n *\n * <SelectField\n * items={items}\n * value={selected}\n * onValueChange={setSelected}\n * renderLabel={(item) => item.label}\n * renderOption={(item) => item.label}\n * />\n * ```\n */\nexport function SelectField<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n>(props: SelectFieldProps<TItem, TMultiple>) {\n const {\n items,\n value,\n onValueChange,\n renderLabel,\n renderOption,\n placeholder,\n multiple,\n disabled,\n invalid,\n name,\n isItemEqualToValue,\n size,\n widthVariant,\n contentWidthVariant,\n contentProps,\n triggerClassName,\n inputRef,\n readOnly,\n } = props;\n\n // Helper to get the key for an item\n const getItemKey = (item: TItem, index: number): string => {\n if (item && typeof item === \"object\") {\n if (\"value\" in item) {\n const val = (item as any).value;\n return typeof val === \"string\" || typeof val === \"number\"\n ? String(val)\n : index.toString();\n }\n if (\"id\" in item) {\n const id = (item as any).id;\n return typeof id === \"string\" || typeof id === \"number\"\n ? String(id)\n : index.toString();\n }\n }\n return index.toString();\n };\n\n // Helper to render item content\n const renderItemContent = (item: TItem): React.ReactNode => {\n if (renderOption) {\n return renderOption(item);\n }\n // Auto-detect label property\n if (item && typeof item === \"object\" && \"label\" in item) {\n return (item as any).label;\n }\n // Fallback to string representation\n return String(item);\n };\n\n // Helper to render selected value label\n const renderValueLabel = (item: TItem): React.ReactNode => {\n if (renderLabel) {\n return renderLabel(item);\n }\n // Use same logic as renderOption\n return renderItemContent(item);\n };\n\n return (\n <Select.Root<TItem, TMultiple>\n value={value}\n onValueChange={onValueChange}\n multiple={multiple}\n disabled={disabled}\n invalid={invalid}\n name={name}\n isItemEqualToValue={isItemEqualToValue}\n inputRef={inputRef}\n readOnly={readOnly}\n >\n <Select.Trigger\n size={size}\n widthVariant={widthVariant}\n className={triggerClassName}\n >\n <Select.Value placeholder={placeholder}>\n {(selectedValue: any) => {\n // Handle multiple selection\n if (multiple && Array.isArray(selectedValue)) {\n // For multiple, show MultiSelectedValue by default\n const labels = selectedValue.map((item: TItem) => {\n const label = renderValueLabel(item);\n return typeof label === \"string\" ? label : String(label);\n });\n return (\n <Select.MultiSelectedValue\n selectedValue={labels}\n maxItems={2}\n />\n );\n }\n\n // Single selection - show placeholder if no value\n if (selectedValue == null) {\n return placeholder || null;\n }\n\n return renderValueLabel(selectedValue as TItem);\n }}\n </Select.Value>\n </Select.Trigger>\n\n <Select.Content widthVariant={contentWidthVariant} {...contentProps}>\n <Select.List>\n {(items as any[])?.map((item, index) => {\n const key = getItemKey(item, index);\n const ItemComponent = multiple ? Select.MultiItem : Select.Item;\n\n return (\n <ItemComponent key={key} value={item}>\n {renderItemContent(item)}\n </ItemComponent>\n );\n })}\n </Select.List>\n </Select.Content>\n </Select.Root>\n );\n}\n","import * as React from \"react\";\nimport { Combobox } from \"@px-ui/core\";\n\ntype AllRootProps<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n> = React.ComponentProps<typeof Combobox.Root<TItem, TMultiple>>;\n\ntype RootProps<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n> = Pick<\n AllRootProps<TItem, TMultiple>,\n | \"items\"\n | \"loadOptions\"\n | \"value\"\n | \"onValueChange\"\n | \"multiple\"\n | \"disabled\"\n | \"invalid\"\n | \"isItemEqualToValue\"\n | \"inputRef\"\n | \"readOnly\"\n>;\n\ninterface ComboboxFieldProps<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n> extends RootProps<TItem, TMultiple> {\n /**\n * Function to render the label in the trigger for the selected item(s)\n * - For single select: receives a single item\n * - For multiple select: receives an array of items\n * If not provided and item has a 'label' property, it will be used automatically\n */\n renderLabel?: TMultiple extends true\n ? (items: TItem[]) => React.ReactNode\n : (item: TItem) => string | React.ReactNode;\n\n /**\n * Function to render each option in the dropdown\n * If not provided and item has a 'label' property, it will be used automatically\n */\n renderOption?: (item: TItem) => React.ReactNode;\n\n /**\n * Function to render each chip in ChipsTrigger (multiple selection only)\n * If not provided, renderLabel or auto-detected label will be used\n */\n renderChip?: (item: TItem) => React.ReactNode | string;\n\n /**\n * Placeholder text when no value is selected\n */\n placeholder?: string;\n\n /**\n * Show search input inside the popup instead of in trigger\n * Only applicable when not using searchable trigger\n * @default false\n */\n searchInPopup?: boolean;\n\n /**\n * Size variant for trigger\n */\n size?: React.ComponentProps<typeof Combobox.SearchableTrigger>[\"size\"];\n\n /**\n * Width variant for trigger\n */\n widthVariant?: \"enforced\" | \"full\";\n\n /**\n * Width variant for the dropdown content\n */\n contentWidthVariant?: \"trigger\" | \"fit\" | \"enforced\";\n\n /**\n * Additional className for the trigger\n */\n triggerClassName?: string;\n\n /**\n * Additional props for Combobox.Content\n */\n contentProps?: Omit<\n React.ComponentProps<typeof Combobox.Content>,\n \"children\" | \"widthVariant\" | \"empty\"\n >;\n}\n\n/**\n * A simplified Combobox component for common use cases.\n * For advanced customization, use the composable Combobox.* components from @px-ui/core.\n *\n * Features:\n * - Single and multiple selection\n * - Inline search (SearchableTrigger or ChipsTrigger)\n * - Async data loading with loadOptions\n * - Type-safe with full inference\n *\n * @example\n * // Single select with search\n * <ComboboxField\n * items={items}\n * value={selected}\n * onValueChange={setSelected}\n * placeholder=\"Select an option\"\n * />\n *\n * @example\n * // Multiple select with chips\n * <ComboboxField\n * items={items}\n * value={selected}\n * onValueChange={setSelected}\n * multiple\n * placeholder=\"Select options\"\n * />\n *\n * @example\n * // Async loading\n * <ComboboxField\n * loadOptions={loadUsers}\n * value={selected}\n * onValueChange={setSelected}\n * />\n */\nexport function ComboboxField<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n>(props: ComboboxFieldProps<TItem, TMultiple>) {\n const {\n items,\n loadOptions,\n value,\n onValueChange,\n renderLabel,\n renderOption,\n renderChip,\n placeholder,\n searchInPopup = false,\n multiple,\n disabled,\n invalid,\n isItemEqualToValue,\n size,\n widthVariant,\n contentWidthVariant = \"trigger\",\n triggerClassName,\n contentProps,\n inputRef,\n readOnly,\n } = props;\n\n // Helper to get the key for an item\n const getItemKey = (item: TItem, index: number): string => {\n if (item && typeof item === \"object\") {\n if (\"value\" in item) {\n const val = (item as any).value;\n return typeof val === \"string\" || typeof val === \"number\"\n ? String(val)\n : index.toString();\n }\n if (\"id\" in item) {\n const id = (item as any).id;\n return typeof id === \"string\" || typeof id === \"number\"\n ? String(id)\n : index.toString();\n }\n }\n return index.toString();\n };\n\n // Helper to render item content\n const renderItemContent = (item: TItem): React.ReactNode => {\n if (renderOption) {\n return renderOption(item);\n }\n // Auto-detect label property\n if (item && typeof item === \"object\" && \"label\" in item) {\n return (item as any).label;\n }\n // Fallback to string representation\n return String(item);\n };\n\n // Helper to render selected value label (single item)\n const renderSingleValueLabel = (item: TItem): React.ReactNode => {\n if (renderLabel && !multiple) {\n return (renderLabel as (item: TItem) => React.ReactNode)(item);\n }\n // Auto-detect label property\n if (item && typeof item === \"object\" && \"label\" in item) {\n return (item as any).label;\n }\n // Fallback to string representation\n return String(item);\n };\n\n // Helper to render selected value label (multiple items)\n const renderMultipleValueLabel = (items: TItem[]): React.ReactNode => {\n if (renderLabel && multiple) {\n return (renderLabel as (items: TItem[]) => React.ReactNode)(items);\n }\n // Default: show count\n return `${items.length} selected`;\n };\n\n // Helper to render chip content\n const renderChipContent = (item: TItem): React.ReactNode => {\n if (renderChip) {\n return renderChip(item);\n }\n return renderSingleValueLabel(item);\n };\n\n return (\n <Combobox.Root<TItem, TMultiple>\n items={items}\n loadOptions={loadOptions}\n value={value}\n onValueChange={onValueChange}\n multiple={multiple}\n disabled={disabled}\n invalid={invalid}\n isItemEqualToValue={isItemEqualToValue}\n // @ts-expect-error\n itemToStringLabel={multiple ? undefined : renderLabel}\n inputRef={inputRef}\n readOnly={readOnly}\n >\n {/* If searchInPopup, use regular Trigger (regardless of multiple) */}\n {searchInPopup ? (\n <Combobox.Trigger\n size={size}\n widthVariant={widthVariant}\n className={triggerClassName}\n >\n <Combobox.Value placeholder={placeholder}>\n {(selectedValue: any) => {\n if (selectedValue == null) {\n return null;\n }\n\n // Handle multiple selection\n if (multiple && Array.isArray(selectedValue)) {\n if (selectedValue.length === 0) {\n return null;\n }\n return renderMultipleValueLabel(selectedValue);\n }\n\n // Single selection\n return renderSingleValueLabel(selectedValue);\n }}\n </Combobox.Value>\n </Combobox.Trigger>\n ) : multiple ? (\n /* Multiple selection uses ChipsTrigger */\n <Combobox.ChipsTrigger\n placeholder={placeholder}\n size={size}\n widthVariant={widthVariant}\n className={triggerClassName}\n >\n {(item: TItem) => (\n <Combobox.Chip key={getItemKey(item as any, 0)}>\n {renderChipContent(item)}\n </Combobox.Chip>\n )}\n </Combobox.ChipsTrigger>\n ) : (\n /* Single selection uses SearchableTrigger */\n <Combobox.SearchableTrigger\n placeholder={placeholder}\n size={size}\n widthVariant={widthVariant}\n className={triggerClassName}\n />\n )}\n\n <Combobox.Content widthVariant={contentWidthVariant} {...contentProps}>\n {/* Search in popup when using regular Trigger */}\n {searchInPopup && <Combobox.Search placeholder={placeholder} />}\n\n <Combobox.List>\n {(item: TItem) => {\n const key = getItemKey(item, 0);\n const ItemComponent = multiple ? Combobox.MultiItem : Combobox.Item;\n\n return (\n <ItemComponent key={key} value={item}>\n {renderItemContent(item)}\n </ItemComponent>\n );\n }}\n </Combobox.List>\n </Combobox.Content>\n </Combobox.Root>\n );\n}\n","/**\n * Mapping of currency abbreviations to country codes for flag display.\n * Used internally by CurrencySelectField to display country flags.\n */\nexport const CURRENCY_FLAG_CODE: Record<string, string> = {\n USD: \"US\",\n CAD: \"CA\",\n EUR: \"EU\",\n GBP: \"GB\",\n INR: \"IN\",\n AFN: \"AF\",\n ALL: \"AL\",\n ANG: \"MY\",\n ARS: \"AR\",\n AUD: \"AU\",\n AZN: \"AZ\",\n BBD: \"BB\",\n BGN: \"BG\",\n BMD: \"BM\",\n BOB: \"BO\",\n BRL: \"BR\",\n BSD: \"BS\",\n BWP: \"BW\",\n BYN: \"BY\",\n CHF: \"CH\",\n CLP: \"CL\",\n COP: \"CO\",\n CRC: \"CR\",\n CUP: \"CU\",\n CZK: \"CZ\",\n DKK: \"DK\",\n DOP: \"DO\",\n EGP: \"EG\",\n FJD: \"FJ\",\n GGP: \"GG\",\n GHS: \"US\",\n GIP: \"GI\",\n GTQ: \"GT\",\n GYD: \"GY\",\n HKD: \"HK\",\n HNL: \"HN\",\n HRK: \"HR\",\n HUF: \"HU\",\n ILS: \"IL\",\n IMP: \"IM\",\n IRR: \"IR\",\n ISK: \"IS\",\n JEP: \"JE\",\n JMD: \"JM\",\n JPY: \"JP\",\n KHR: \"KM\",\n KPW: \"KP\",\n KRW: \"KR\",\n KYD: \"KY\",\n LAK: \"LA\",\n LBP: \"LB\",\n LKR: \"LK\",\n LRD: \"LR\",\n MKD: \"MK\",\n MNT: \"MN\",\n MXN: \"MX\",\n MYR: \"MY\",\n MZN: \"MZ\",\n NGN: \"NG\",\n NIO: \"NI\",\n NOK: \"NO\",\n NPR: \"NP\",\n NZD: \"NZ\",\n PAB: \"PA\",\n PEN: \"PE\",\n PHP: \"PH\",\n PKR: \"PK\",\n PLN: \"PL\",\n PYG: \"PY\",\n QAR: \"QA\",\n RON: \"RO\",\n RSD: \"RS\",\n RUB: \"RU\",\n SAR: \"SA\",\n SBD: \"SB\",\n SCR: \"SC\",\n SEK: \"SE\",\n SGD: \"SG\",\n SHP: \"SH\",\n SOS: \"SO\",\n SRD: \"SR\",\n SVC: \"SV\",\n THB: \"TH\",\n TRY: \"TR\",\n TVD: \"TV\",\n TWD: \"TW\",\n UAH: \"UA\",\n UYU: \"UY\",\n UZS: \"UZ\",\n VEF: \"VE\",\n VND: \"VN\",\n XCD: \"EC\",\n YEN: \"YE\",\n YER: \"YE\",\n ZAR: \"ZA\",\n ZWD: \"ZW\",\n AED: \"AE\",\n AMD: \"AD\",\n BDT: \"BD\",\n BTN: \"BT\",\n AOA: \"AO\",\n AWG: \"AW\",\n BAM: \"BA\",\n BHD: \"BH\",\n BIF: \"BI\",\n BND: \"BN\",\n BZD: \"BZ\",\n CNY: \"CN\",\n CVE: \"CV\",\n DJF: \"DJ\",\n DZD: \"DZ\",\n ETB: \"ET\",\n FKP: \"FK\",\n GEL: \"GE\",\n GMD: \"GM\",\n GNF: \"GN\",\n HTG: \"HT\",\n IDR: \"ID\",\n IQD: \"IQ\",\n JOD: \"JO\",\n KES: \"KE\",\n KGS: \"KG\",\n KMF: \"KM\",\n KWD: \"KW\",\n MWK: \"MW\",\n ZMW: \"ZM\",\n LSL: \"LS\",\n LYD: \"LY\",\n MAD: \"MA\",\n MDL: \"MD\",\n MGA: \"MG\",\n MMK: \"MM\",\n KZT: \"KZ\",\n MOP: \"MO\",\n MRU: \"MR\",\n MUR: \"MU\",\n MVR: \"MV\",\n NAD: \"NA\",\n OMR: \"OM\",\n PGK: \"PG\",\n RWF: \"RW\",\n SDG: \"SD\",\n SLL: \"SL\",\n STD: \"ST\",\n SYP: \"SY\",\n SZL: \"SZ\",\n TJS: \"TJ\",\n TMT: \"TM\",\n TND: \"TN\",\n TOP: \"TO\",\n TTD: \"TT\",\n TZS: \"TZ\",\n UGX: \"UG\",\n VES: \"VE\",\n VUV: \"VU\",\n WST: \"WS\",\n XAF: \"CF\",\n XOF: \"NG\",\n XPF: \"CF\",\n};\n\n","import * as React from \"react\";\nimport { Combobox, cn, InputGroup, ChevronDownIcon } from \"@px-ui/core\";\nimport ReactCountryFlag from \"react-country-flag\";\nimport { CURRENCY_FLAG_CODE } from \"../constants/currency-flag-code\";\nconst { BaseCombobox } = Combobox;\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/**\n * Currency type representing a currency option\n */\nexport interface Currency {\n /** Unique identifier for the currency */\n id: string;\n /** Full currency name (e.g., \"United States dollar\") */\n name: string;\n /** Currency abbreviation (e.g., \"USD\", \"EUR\") */\n abbr: string;\n /** Currency value/code used for form submission */\n value: string;\n}\n\ntype AllRootProps = React.ComponentProps<typeof Combobox.Root<Currency, false>>;\n\ntype RootProps = Pick<\n AllRootProps,\n | \"value\"\n | \"onValueChange\"\n | \"disabled\"\n | \"invalid\"\n | \"inputRef\"\n | \"readOnly\"\n | \"name\"\n>;\n\nexport interface CurrencySelectFieldProps extends RootProps {\n /**\n * Array of currency options to display\n */\n currencies: ReadonlyArray<Currency>;\n\n /**\n * Placeholder text when no currency is selected\n * @default \"Select currency\"\n */\n placeholder?: string;\n\n /**\n * Size variant for the trigger\n */\n size?: React.ComponentProps<typeof InputGroup.Root>[\"size\"];\n\n /**\n * Width variant for trigger\n */\n widthVariant?: React.ComponentProps<typeof InputGroup.Root>[\"widthVariant\"];\n\n /**\n * Width variant for the dropdown content\n */\n contentWidthVariant?: React.ComponentProps<\n typeof Combobox.Content\n >[\"widthVariant\"];\n\n /**\n * Additional className for the trigger\n */\n triggerClassName?: string;\n\n /**\n * Whether the select is loading\n */\n isLoading?: boolean;\n\n /**\n * Additional props for Combobox.Content\n */\n contentProps?: Omit<\n React.ComponentProps<typeof Combobox.Content>,\n \"children\" | \"widthVariant\" | \"empty\"\n >;\n}\n\n// ============================================================================\n// Sub-components\n// ============================================================================\n\ninterface CurrencyFlagProps {\n countryCode: string | null | undefined;\n className?: string;\n}\n\nfunction CurrencyFlag({ countryCode, className }: CurrencyFlagProps) {\n if (!countryCode) {\n return <span className={cn(\"inline-block w-4\", className)} />;\n }\n\n return (\n <div\n className={cn(\"relative -top-px flex shrink-0 items-center\", className)}\n >\n <ReactCountryFlag\n countryCode={countryCode}\n svg\n style={{\n width: \"14px\",\n height: \"14px\",\n }}\n aria-label={`Flag of ${countryCode}`}\n />\n </div>\n );\n}\n\ninterface CurrencyOptionContentProps {\n currency: Currency;\n}\n\nfunction CurrencyOptionContent({ currency }: CurrencyOptionContentProps) {\n const countryCode = CURRENCY_FLAG_CODE[currency.abbr];\n\n return (\n <div className=\"flex items-center gap-2.5\">\n <CurrencyFlag countryCode={countryCode} />\n <span>\n <span className=\"text-ppx-foreground font-medium\">{currency.abbr}</span>\n <span className=\"text-ppx-muted-foreground\"> - {currency.name}</span>\n </span>\n </div>\n );\n}\n\n// ============================================================================\n// Main Component\n// ============================================================================\n\n/**\n * A currency select component with search functionality and flag display.\n * Country flags are automatically displayed based on the currency abbreviation\n * using the built-in CURRENCY_FLAG_CODE mapping.\n *\n * @example\n * ```tsx\n * const currencies = [\n * { id: \"1\", abbr: \"USD\", name: \"United States dollar\", value: \"USD\" },\n * { id: \"2\", abbr: \"EUR\", name: \"Euro\", value: \"EUR\" },\n * { id: \"3\", abbr: \"GBP\", name: \"British Pound\", value: \"GBP\" },\n * ];\n *\n * <CurrencySelectField\n * currencies={currencies}\n * value={selectedCurrency}\n * onValueChange={setSelectedCurrency}\n * placeholder=\"Select currency\"\n * />\n * ```\n */\nexport function CurrencySelectField({\n currencies,\n value,\n onValueChange,\n placeholder = \"Select currency\",\n disabled,\n invalid,\n name,\n size,\n widthVariant,\n contentWidthVariant = \"trigger\",\n triggerClassName,\n isLoading,\n contentProps,\n inputRef,\n readOnly,\n}: CurrencySelectFieldProps) {\n const triggerRef = React.useRef<HTMLDivElement>(null);\n\n // Convert currency to string label for accessibility and input\n const itemToStringLabel = React.useCallback(\n (currency: Currency) => `${currency.abbr} - ${currency.name}`,\n [],\n );\n\n return (\n <Combobox.Root<Currency, false>\n items={currencies as Currency[]}\n value={value}\n onValueChange={onValueChange}\n disabled={disabled}\n invalid={invalid}\n isLoading={isLoading}\n isItemEqualToValue={(item, val) => item.id === val.id}\n itemToStringLabel={itemToStringLabel}\n inputRef={inputRef}\n readOnly={readOnly}\n name={name}\n >\n <InputGroup.Root\n size={size}\n widthVariant={widthVariant}\n disabled={disabled}\n ref={triggerRef}\n className={triggerClassName}\n >\n {value && (\n <InputGroup.Addon align=\"inline-start\" className=\"pl-3 pr-0\">\n <CurrencyFlag countryCode={CURRENCY_FLAG_CODE[value.abbr]} />\n </InputGroup.Addon>\n )}\n\n <BaseCombobox.Input\n render={(inputProps: React.ComponentProps<\"input\">) => (\n <InputGroup.Input\n {...inputProps}\n invalid={invalid}\n placeholder={placeholder}\n />\n )}\n />\n <InputGroup.Addon align=\"inline-end\" className=\"gap-0.5\">\n <BaseCombobox.Trigger\n render={(triggerProps: React.ComponentProps<\"button\">) => (\n <InputGroup.Button\n size=\"icon-xs\"\n aria-label=\"Open popup\"\n {...triggerProps}\n >\n <ChevronDownIcon />\n </InputGroup.Button>\n )}\n />\n </InputGroup.Addon>\n </InputGroup.Root>\n\n <Combobox.Content\n widthVariant={contentWidthVariant}\n empty=\"No currencies found\"\n positionerProps={{ anchor: triggerRef.current }}\n {...contentProps}\n >\n <Combobox.List>\n {(currency: Currency) => (\n <Combobox.Item key={currency.id} value={currency}>\n <CurrencyOptionContent currency={currency} />\n </Combobox.Item>\n )}\n </Combobox.List>\n </Combobox.Content>\n </Combobox.Root>\n );\n}\n","import * as React from \"react\";\nimport {\n FileIcon,\n UploadIcon,\n FileUpload,\n useFileUpload,\n type FileUploadWithUploaderOptions,\n type FileWithPreview,\n type FileWithUploadStatus,\n} from \"@px-ui/core\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface FileUploadFieldProps\n extends Omit<FileUploadWithUploaderOptions, \"initialFiles\"> {\n /** Variant determines the visual layout */\n variant?: \"dropzone\" | \"button\" | \"compact\";\n /** Size of the dropzone (only applies to dropzone variant) */\n size?: \"sm\" | \"default\" | \"lg\";\n /** Text displayed in the dropzone */\n dropzoneText?: string;\n /** Text for the browse/upload button */\n buttonText?: string;\n /** Show file list below the dropzone */\n showFileList?: boolean;\n /** Show image grid instead of list for image files */\n showImageGrid?: boolean;\n /** Initial files (already uploaded) */\n initialFiles?: Array<{\n id: string;\n name: string;\n size: number;\n type: string;\n url: string;\n }>;\n /** Whether the upload is disabled */\n disabled?: boolean;\n /** Custom className */\n className?: string;\n /** Custom content to render inside the dropzone */\n children?: React.ReactNode;\n /** Render prop for custom file item rendering */\n renderFileItem?: (\n file: FileWithUploadStatus,\n actions: { remove: () => void; retry: () => void },\n ) => React.ReactNode;\n /** Error handler */\n onError?: (error: { type: string; message: string; files?: File[] }) => void;\n}\n\n// ============================================================================\n// Main Component\n// ============================================================================\n\nexport function FileUploadField({\n variant = \"dropzone\",\n size = \"default\",\n dropzoneText = \"Paste Or Drag & Drop Files Here\",\n buttonText = \"Browse for files\",\n showFileList = true,\n showImageGrid = false,\n initialFiles = [],\n disabled = false,\n className,\n children,\n renderFileItem,\n onError,\n // Hook options\n maxFiles,\n maxSize,\n accept,\n multiple = false,\n onFilesChange,\n onFilesAdded,\n upload,\n}: FileUploadFieldProps) {\n const [state, actions] = useFileUpload({\n maxFiles,\n maxSize,\n accept,\n multiple,\n initialFiles: initialFiles.map((f) => ({\n ...f,\n id: f.id,\n name: f.name,\n size: f.size,\n type: f.type,\n url: f.url,\n })),\n onFilesChange: onFilesChange as (files: FileWithPreview[]) => void,\n onFilesAdded: onFilesAdded as (files: FileWithPreview[]) => void,\n upload,\n });\n\n const { files, isDragging, errors, isUploading } = state;\n const {\n addFiles,\n removeFile,\n clearFiles,\n handleDragEnter,\n handleDragLeave,\n handleDragOver,\n handleDrop,\n openFileDialog,\n getInputProps,\n retryUpload,\n } = actions;\n\n // Handle errors\n React.useEffect(() => {\n if (errors.length > 0 && onError) {\n onError({\n type: \"validation\",\n message: errors[0],\n });\n }\n }, [errors, onError]);\n\n // Common props for FileUpload.Root\n const rootProps = {\n files,\n addFiles,\n removeFile,\n clearFiles,\n retryUpload,\n openFileDialog,\n getInputProps,\n handleDragEnter,\n handleDragLeave,\n handleDragOver,\n handleDrop,\n isDragActive: isDragging,\n isUploading,\n accept,\n multiple,\n disabled,\n };\n\n // Render file item using primitives or custom render prop\n const renderDefaultFileItem = (file: FileWithUploadStatus) => {\n if (renderFileItem) {\n return renderFileItem(file, {\n remove: () => removeFile(file.id),\n retry: () => retryUpload(file.id),\n });\n }\n\n const isImage = file.file.type?.startsWith(\"image/\") ?? false;\n\n return (\n <FileUpload.Item key={file.id} file={file}>\n <FileUpload.ItemPreview\n fallback={\n isImage ? undefined : (\n <FileIcon className=\"text-ppx-neutral-10 size-5\" />\n )\n }\n />\n\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <FileUpload.ItemName />\n\n <div className=\"flex items-center gap-2\">\n <FileUpload.ItemSize />\n {file.status === \"uploading\" && (\n <FileUpload.ItemProgress className=\"flex-1\" />\n )}\n </div>\n\n <FileUpload.ItemError />\n </div>\n\n <div className=\"flex shrink-0 items-center gap-1\">\n <FileUpload.ItemStatus />\n <FileUpload.ItemRetry />\n <FileUpload.ItemRemove />\n </div>\n </FileUpload.Item>\n );\n };\n\n // Render image grid item using primitives\n const renderImageGridItem = (file: FileWithUploadStatus) => (\n <FileUpload.ImageGridItem key={file.id} file={file} showStatusOverlay />\n );\n\n // Render based on variant\n if (variant === \"button\" || variant === \"compact\") {\n return (\n <FileUpload.Root {...rootProps} className={className}>\n <div className=\"flex items-center gap-3\">\n <FileUpload.Trigger\n variant={variant === \"compact\" ? \"outline\" : \"default\"}\n size={variant === \"compact\" ? \"sm\" : \"default\"}\n showUploadingState\n >\n <UploadIcon className=\"size-4\" />\n {buttonText}\n </FileUpload.Trigger>\n\n {variant === \"compact\" && files.length > 0 && (\n <span className=\"text-ppx-neutral-12 truncate text-sm\">\n {files.length === 1\n ? files[0].file.name\n : `${files.length} files selected`}\n </span>\n )}\n </div>\n\n {/* File List */}\n {showFileList && files.length > 0 && variant !== \"compact\" && (\n <FileUpload.ItemList>\n {files.map(renderDefaultFileItem)}\n </FileUpload.ItemList>\n )}\n </FileUpload.Root>\n );\n }\n\n // Dropzone variant (default)\n return (\n <FileUpload.Root {...rootProps} className={className}>\n <FileUpload.Dropzone\n size={size}\n dropzoneText={dropzoneText}\n browseText={buttonText}\n hideDefaultContent={!!children}\n >\n {children}\n </FileUpload.Dropzone>\n\n {/* Errors */}\n {errors.length > 0 && (\n <div className=\"text-ppx-red-5 text-sm\">\n {errors.map((error, i) => (\n <p key={i}>{error}</p>\n ))}\n </div>\n )}\n\n {/* File List or Image Grid */}\n {showFileList && files.length > 0 && (\n <div>\n <div className=\"mb-2 flex items-center justify-between\">\n <span className=\"text-ppx-neutral-14 text-sm font-medium\">\n {multiple ? `Files (${files.length})` : \"Selected file\"}\n </span>\n {multiple && files.length > 1 && (\n <FileUpload.ClearButton\n size=\"sm\"\n className=\"text-ppx-red-5 hover:text-ppx-red-6\"\n >\n Remove all\n </FileUpload.ClearButton>\n )}\n </div>\n\n {showImageGrid ? (\n <FileUpload.ImageGrid>\n {files.map(renderImageGridItem)}\n </FileUpload.ImageGrid>\n ) : (\n <FileUpload.ItemList>\n {files.map(renderDefaultFileItem)}\n </FileUpload.ItemList>\n )}\n </div>\n )}\n </FileUpload.Root>\n );\n}\n\nexport type {\n FileWithUploadStatus,\n UploadConfig,\n FileUploadWithUploaderOptions,\n} from \"@px-ui/core\";\n","import { useMemo } from \"react\";\nimport {\n cn,\n cva,\n type VariantProps,\n Label as LabelPrimitive,\n Separator as SeperatorPrimitive,\n} from \"@px-ui/core\";\n\nexport function Set({ className, ...props }: React.ComponentProps<\"fieldset\">) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n \"flex flex-col gap-6\",\n \"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function Legend({\n className,\n variant = \"legend\",\n ...props\n}: React.ComponentProps<\"legend\"> & { variant?: \"legend\" | \"label\" }) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n \"mb-3 font-medium\",\n \"data-[variant=legend]:text-base\",\n \"data-[variant=label]:text-sm\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function Group({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n \"group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\ntype FieldVariantsType = (\n props?:\n | {\n orientation?: \"vertical\" | \"horizontal\" | \"responsive\";\n }\n | undefined,\n) => string;\n\nconst fieldVariants: FieldVariantsType = cva(\n \"group/field flex w-full gap-2 data-[invalid=true]:text-ppx-red-5\",\n {\n variants: {\n orientation: {\n vertical: [\"flex-col [&>*]:w-full [&>.sr-only]:w-auto\"],\n horizontal: [\n \"flex-row items-center\",\n \"[&>[data-slot=field-label]]:flex-auto\",\n \"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n ],\n responsive: [\n \"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto\",\n \"@md/field-group:[&>[data-slot=field-label]]:flex-auto\",\n \"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n ],\n },\n },\n defaultVariants: {\n orientation: \"vertical\",\n },\n },\n) as FieldVariantsType;\n\nexport function Root({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof fieldVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"field\"\n data-orientation={orientation}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n );\n}\n\nexport function Content({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\n \"group/field-content flex flex-1 flex-col gap-1.5 leading-snug\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function Label({\n className,\n ...props\n}: React.ComponentProps<typeof LabelPrimitive>) {\n return (\n <LabelPrimitive\n data-slot=\"field-label\"\n className={cn(\n \"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50\",\n \"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function Title({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn(\n \"text-ppx-sm flex w-fit items-center gap-2 font-medium leading-snug group-data-[disabled=true]/field:opacity-50\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function Description({\n className,\n ...props\n}: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n \"text-ppx-sm text-ppx-muted-foreground font-normal leading-normal group-has-[[data-orientation=horizontal]]/field:text-balance\",\n \"nth-last-2:-mt-1 last:mt-0 [[data-variant=legend]+&]:-mt-1.5\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function Separator({\n children,\n className,\n ...props\n}: React.ComponentProps<\"div\"> & {\n children?: React.ReactNode;\n}) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn(\n \"text-ppx-sm relative -my-2 h-5 group-data-[variant=outline]/field-group:-mb-2\",\n className,\n )}\n {...props}\n >\n <SeperatorPrimitive\n orientation=\"horizontal\"\n className=\"absolute inset-0 top-1/2\"\n />\n {children && (\n <span\n className=\"bg-ppx-background text-ppx-muted-foreground relative mx-auto block w-fit px-2\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n );\n}\n\nexport function Error({\n className,\n children,\n errors,\n ...props\n}: React.ComponentProps<\"div\"> & {\n errors?: Array<{ message?: string } | undefined>;\n}) {\n const content = useMemo(() => {\n if (children) {\n return children;\n }\n\n if (!errors?.length) {\n return null;\n }\n\n const uniqueErrors = [\n ...new Map(errors.map((error) => [error?.message, error])).values(),\n ];\n\n if (uniqueErrors?.length == 1) {\n return uniqueErrors[0]?.message;\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {uniqueErrors.map(\n (error, index) =>\n error?.message && <li key={index}>{error.message}</li>,\n )}\n </ul>\n );\n }, [children, errors]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n className={cn(\"text-ppx-sm text-ppx-red-5 font-normal\", className)}\n {...props}\n >\n {content}\n </div>\n );\n}\n","import {\n Controller,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from \"react-hook-form\";\nimport * as Field from \"./field\";\nimport { type ReactNode } from \"react\";\nimport { Textarea, Checkbox, Input } from \"@px-ui/core\";\n\ntype FormControlProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n TTransformedValues = TFieldValues,\n> = {\n name: TName;\n label: ReactNode;\n description?: ReactNode;\n control: ControllerProps<TFieldValues, TName, TTransformedValues>[\"control\"];\n required?: boolean;\n placeholder?: string;\n};\n\ntype FormBaseProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n TTransformedValues = TFieldValues,\n> = FormControlProps<TFieldValues, TName, TTransformedValues> & {\n horizontal?: boolean;\n controlFirst?: boolean;\n children: (\n field: Parameters<\n ControllerProps<TFieldValues, TName, TTransformedValues>[\"render\"]\n >[0][\"field\"] & {\n invalid?: boolean;\n id: string;\n },\n ) => ReactNode;\n};\n\ntype FormControlFunc<\n ExtraProps extends Record<string, unknown> = Record<never, never>,\n> = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n TTransformedValues = TFieldValues,\n>(\n props: FormControlProps<TFieldValues, TName, TTransformedValues> & ExtraProps,\n) => ReactNode;\n\nfunction FormBase<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n TTransformedValues = TFieldValues,\n>({\n children,\n control,\n label,\n name,\n required,\n description,\n controlFirst,\n horizontal,\n}: FormBaseProps<TFieldValues, TName, TTransformedValues>) {\n return (\n <Controller\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n const labelElement = (\n <Field.Label\n className={required ? \"required\" : \"\"}\n htmlFor={field.name}\n >\n {label}\n </Field.Label>\n );\n\n const descriptionElement = description ? (\n <Field.Description>{description}</Field.Description>\n ) : null;\n\n const control = children({\n ...field,\n id: field.name,\n invalid: fieldState.invalid,\n });\n\n const errorElement = fieldState.invalid && (\n <Field.Error errors={[fieldState.error]} />\n );\n\n return (\n <Field.Root orientation={horizontal ? \"horizontal\" : undefined}>\n {controlFirst ? (\n <>\n {control}\n {labelElement}\n {descriptionElement}\n {errorElement}\n </>\n ) : (\n <>\n {labelElement}\n {control}\n {descriptionElement}\n {errorElement}\n </>\n )}\n </Field.Root>\n );\n }}\n />\n );\n}\n\nexport const FormInput: FormControlFunc = ({ placeholder, ...props }) => {\n return (\n <FormBase {...props}>\n {(field) => <Input {...field} placeholder={placeholder} />}\n </FormBase>\n );\n};\n\nexport const FormTextarea: FormControlFunc = ({ placeholder, ...props }) => {\n return (\n <FormBase {...props}>\n {(field) => <Textarea {...field} placeholder={placeholder} />}\n </FormBase>\n );\n};\n\nexport const FormCheckbox: FormControlFunc = (props) => {\n return (\n <FormBase {...props} horizontal controlFirst>\n {({ onChange, value, ...field }) => (\n <Checkbox {...field} checked={value} onCheckedChange={onChange} />\n )}\n </FormBase>\n );\n};\n\n// Note: FormRadioItem is not included in the abstractions because radio buttons\n// work as a group and require a different pattern. Use the verbose Controller\n// approach with RadioGroup for radio buttons. See the stories for examples.\n","import React, { useState } from 'react';\nimport { cn } from '@px-ui/core';\nimport PhoneInputLib from 'react-phone-input-2';\nimport 'react-phone-input-2/lib/style.css';\nimport GoogleLibPhoneNumber from 'google-libphonenumber';\n\nconst phoneUtil = GoogleLibPhoneNumber.PhoneNumberUtil.getInstance();\nconst PNF = GoogleLibPhoneNumber.PhoneNumberFormat;\n\ninterface PhoneInputProps {\n value: string;\n onChange: (value: string) => void;\n country?: string;\n error?: boolean;\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n}\n\nexport const PhoneInput = ({ \n value, \n onChange, \n country = 'us', \n error,\n placeholder,\n disabled,\n className\n}: PhoneInputProps) => {\n const [isValid, setIsValid] = useState(true);\n\n const handleChange = (inputValue: string, data: any) => {\n if (!inputValue) {\n setIsValid(true);\n onChange('');\n return;\n }\n\n try {\n const parsedNumber = phoneUtil.parseAndKeepRawInput(inputValue, data.countryCode);\n const isNumberValid = phoneUtil.isValidNumberForRegion(parsedNumber, data.countryCode);\n \n setIsValid(isNumberValid);\n \n if (isNumberValid) {\n const formatted = phoneUtil.format(parsedNumber, PNF.E164);\n onChange(formatted);\n } else {\n onChange(inputValue);\n }\n } catch (e) {\n setIsValid(false);\n onChange(inputValue);\n }\n };\n\n return (\n <div className={cn(\"w-full flex flex-col gap-1\", className)}>\n <div className={`relative ${(!isValid || error) ? 'phone-input-error' : ''}`}>\n <PhoneInputLib\n country={country}\n value={value}\n onChange={handleChange}\n disabled={disabled}\n placeholder={placeholder}\n inputClass={`!w-full !h-11 !text-base !rounded-lg !border ${\n !isValid || error \n ? '!border-red-500 !bg-red-50' \n : '!border-gray-300 focus:!border-blue-500 focus:!ring-1 focus:!ring-blue-500'\n }`}\n buttonClass={`!rounded-l-lg !border-y !border-l ${\n !isValid || error ? '!border-red-500 !bg-red-50' : '!border-gray-300'\n }`}\n containerClass=\"!w-full\"\n />\n </div>\n \n {(!isValid || error) && (\n <p className=\"text-red-500 text-xs font-medium mt-1\">\n Please enter a valid phone number for this region.\n </p>\n )}\n </div>\n );\n};\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2FA,SAAgB,YAGd,OAA2C;CAC3C,MAAM,EACJ,OACA,OACA,eACA,aACA,cACA,aACA,UACA,UACA,SACA,MACA,oBACA,MACA,cACA,qBACA,cACA,kBACA,UACA,aACE;CAGJ,MAAM,cAAc,MAAa,UAA0B;AACzD,MAAI,QAAQ,OAAO,SAAS,UAAU;AACpC,OAAI,WAAW,MAAM;IACnB,MAAM,MAAO,KAAa;AAC1B,WAAO,OAAO,QAAQ,YAAY,OAAO,QAAQ,WAC7C,OAAO,IAAI,GACX,MAAM,UAAU;;AAEtB,OAAI,QAAQ,MAAM;IAChB,MAAM,KAAM,KAAa;AACzB,WAAO,OAAO,OA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C;OAEnB,UAAS,WAAW;WAEf,GAAG;AACV,cAAW,MAAM;AACjB,YAAS,WAAW;;;AAIxB,QACE,qBAAC;EAAI,WAAW,GAAG,8BAA8B,UAAU;aACzD,oBAAC;GAAI,WAAW,YAAa,CAAC,WAAW,QAAS,sBAAsB;aACtE,oBAAC;IACU;IACF;IACP,UAAU;IACA;IACG;IACb,YAAY,gDACV,CAAC,WAAW,QACR,+BACA;IAEN,aAAa,qCACX,CAAC,WAAW,QAAQ,+BAA+B;IAErD,gBAAe;KACf;IACE,GAEJ,CAAC,WAAW,UACZ,oBAAC;GAAE,WAAU;aAAwC;IAEjD;GAEF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["items","CURRENCY_FLAG_CODE: Record<string, string>","fieldVariants: FieldVariantsType","Label","LabelPrimitive","Separator","SeperatorPrimitive","Field.Label","Field.Description","control","Field.Error","Field.Root","FormInput: FormControlFunc","FormTextarea: FormControlFunc","FormCheckbox: FormControlFunc"],"sources":["../src/components/select-field.tsx","../src/components/combobox-field.tsx","../src/constants/currency-flag-code.ts","../src/components/currency-select-field.tsx","../src/components/file-upload-field.tsx","../src/components/field.tsx","../src/components/form.tsx","../src/components/phone-input.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Select } from \"@px-ui/core\";\n\ntype AllRootProps<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n> = React.ComponentProps<typeof Select.Root<TItem, TMultiple>>;\n\ntype RootProps<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n> = Pick<\n AllRootProps<TItem, TMultiple>,\n | \"value\"\n | \"onValueChange\"\n | \"multiple\"\n | \"disabled\"\n | \"invalid\"\n | \"isItemEqualToValue\"\n | \"inputRef\"\n | \"readOnly\"\n | \"name\"\n>;\n\ninterface SelectFieldProps<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n> extends RootProps<TItem, TMultiple> {\n /**\n * Array of items to display in the select dropdown\n */\n items: ReadonlyArray<TItem>;\n /**\n * Function to render the label in the trigger for the selected item\n * If not provided and item has a 'label' property, it will be used automatically\n */\n renderLabel?: (item: TItem) => React.ReactNode;\n\n /**\n * Function to render each option in the dropdown\n * If not provided and item has a 'label' property, it will be used automatically\n */\n renderOption?: (item: TItem) => React.ReactNode;\n\n /**\n * Placeholder text when no value is selected\n */\n placeholder?: string;\n\n size?: React.ComponentProps<typeof Select.Trigger>[\"size\"];\n\n widthVariant?: React.ComponentProps<typeof Select.Trigger>[\"widthVariant\"];\n\n /**\n * Width variant for the dropdown content\n */\n contentWidthVariant?: React.ComponentProps<\n typeof Select.Content\n >[\"widthVariant\"];\n\n triggerClassName?: string;\n\n /**\n * Additional props for Select.Content\n */\n contentProps?: Omit<\n React.ComponentProps<typeof Select.Content>,\n \"children\" | \"widthVariant\"\n >;\n}\n\n/**\n * A simplified Select component for common use cases.\n * For advanced customization, use the composable Select.* components from @px-ui/core.\n *\n * @example\n * ```tsx\n * const items = [\n * { id: 1, label: 'Option 1' },\n * { id: 2, label: 'Option 2' },\n * ];\n *\n * <SelectField\n * items={items}\n * value={selected}\n * onValueChange={setSelected}\n * renderLabel={(item) => item.label}\n * renderOption={(item) => item.label}\n * />\n * ```\n */\nexport function SelectField<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n>(props: SelectFieldProps<TItem, TMultiple>) {\n const {\n items,\n value,\n onValueChange,\n renderLabel,\n renderOption,\n placeholder,\n multiple,\n disabled,\n invalid,\n name,\n isItemEqualToValue,\n size,\n widthVariant,\n contentWidthVariant,\n contentProps,\n triggerClassName,\n inputRef,\n readOnly,\n } = props;\n\n // Helper to get the key for an item\n const getItemKey = (item: TItem, index: number): string => {\n if (item && typeof item === \"object\") {\n if (\"value\" in item) {\n const val = (item as any).value;\n return typeof val === \"string\" || typeof val === \"number\"\n ? String(val)\n : index.toString();\n }\n if (\"id\" in item) {\n const id = (item as any).id;\n return typeof id === \"string\" || typeof id === \"number\"\n ? String(id)\n : index.toString();\n }\n }\n return index.toString();\n };\n\n // Helper to render item content\n const renderItemContent = (item: TItem): React.ReactNode => {\n if (renderOption) {\n return renderOption(item);\n }\n // Auto-detect label property\n if (item && typeof item === \"object\" && \"label\" in item) {\n return (item as any).label;\n }\n // Fallback to string representation\n return String(item);\n };\n\n // Helper to render selected value label\n const renderValueLabel = (item: TItem): React.ReactNode => {\n if (renderLabel) {\n return renderLabel(item);\n }\n // Use same logic as renderOption\n return renderItemContent(item);\n };\n\n return (\n <Select.Root<TItem, TMultiple>\n value={value}\n onValueChange={onValueChange}\n multiple={multiple}\n disabled={disabled}\n invalid={invalid}\n name={name}\n isItemEqualToValue={isItemEqualToValue}\n inputRef={inputRef}\n readOnly={readOnly}\n >\n <Select.Trigger\n size={size}\n widthVariant={widthVariant}\n className={triggerClassName}\n >\n <Select.Value placeholder={placeholder}>\n {(selectedValue: any) => {\n // Handle multiple selection\n if (multiple && Array.isArray(selectedValue)) {\n // For multiple, show MultiSelectedValue by default\n const labels = selectedValue.map((item: TItem) => {\n const label = renderValueLabel(item);\n return typeof label === \"string\" ? label : String(label);\n });\n return (\n <Select.MultiSelectedValue\n selectedValue={labels}\n maxItems={2}\n />\n );\n }\n\n // Single selection - show placeholder if no value\n if (selectedValue == null) {\n return placeholder || null;\n }\n\n return renderValueLabel(selectedValue as TItem);\n }}\n </Select.Value>\n </Select.Trigger>\n\n <Select.Content widthVariant={contentWidthVariant} {...contentProps}>\n <Select.List>\n {(items as any[])?.map((item, index) => {\n const key = getItemKey(item, index);\n const ItemComponent = multiple ? Select.MultiItem : Select.Item;\n\n return (\n <ItemComponent key={key} value={item}>\n {renderItemContent(item)}\n </ItemComponent>\n );\n })}\n </Select.List>\n </Select.Content>\n </Select.Root>\n );\n}\n","import * as React from \"react\";\nimport { Combobox } from \"@px-ui/core\";\n\ntype AllRootProps<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n> = React.ComponentProps<typeof Combobox.Root<TItem, TMultiple>>;\n\ntype RootProps<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n> = Pick<\n AllRootProps<TItem, TMultiple>,\n | \"items\"\n | \"loadOptions\"\n | \"value\"\n | \"onValueChange\"\n | \"multiple\"\n | \"disabled\"\n | \"invalid\"\n | \"isItemEqualToValue\"\n | \"inputRef\"\n | \"readOnly\"\n>;\n\ninterface ComboboxFieldProps<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n> extends RootProps<TItem, TMultiple> {\n /**\n * Function to render the label in the trigger for the selected item(s)\n * - For single select: receives a single item\n * - For multiple select: receives an array of items\n * If not provided and item has a 'label' property, it will be used automatically\n */\n renderLabel?: TMultiple extends true\n ? (items: TItem[]) => React.ReactNode\n : (item: TItem) => string | React.ReactNode;\n\n /**\n * Function to render each option in the dropdown\n * If not provided and item has a 'label' property, it will be used automatically\n */\n renderOption?: (item: TItem) => React.ReactNode;\n\n /**\n * Function to render each chip in ChipsTrigger (multiple selection only)\n * If not provided, renderLabel or auto-detected label will be used\n */\n renderChip?: (item: TItem) => React.ReactNode | string;\n\n /**\n * Placeholder text when no value is selected\n */\n placeholder?: string;\n\n /**\n * Show search input inside the popup instead of in trigger\n * Only applicable when not using searchable trigger\n * @default false\n */\n searchInPopup?: boolean;\n\n /**\n * Size variant for trigger\n */\n size?: React.ComponentProps<typeof Combobox.SearchableTrigger>[\"size\"];\n\n /**\n * Width variant for trigger\n */\n widthVariant?: \"enforced\" | \"full\";\n\n /**\n * Width variant for the dropdown content\n */\n contentWidthVariant?: \"trigger\" | \"fit\" | \"enforced\";\n\n /**\n * Additional className for the trigger\n */\n triggerClassName?: string;\n\n /**\n * Additional props for Combobox.Content\n */\n contentProps?: Omit<\n React.ComponentProps<typeof Combobox.Content>,\n \"children\" | \"widthVariant\" | \"empty\"\n >;\n}\n\n/**\n * A simplified Combobox component for common use cases.\n * For advanced customization, use the composable Combobox.* components from @px-ui/core.\n *\n * Features:\n * - Single and multiple selection\n * - Inline search (SearchableTrigger or ChipsTrigger)\n * - Async data loading with loadOptions\n * - Type-safe with full inference\n *\n * @example\n * // Single select with search\n * <ComboboxField\n * items={items}\n * value={selected}\n * onValueChange={setSelected}\n * placeholder=\"Select an option\"\n * />\n *\n * @example\n * // Multiple select with chips\n * <ComboboxField\n * items={items}\n * value={selected}\n * onValueChange={setSelected}\n * multiple\n * placeholder=\"Select options\"\n * />\n *\n * @example\n * // Async loading\n * <ComboboxField\n * loadOptions={loadUsers}\n * value={selected}\n * onValueChange={setSelected}\n * />\n */\nexport function ComboboxField<\n TItem = any,\n TMultiple extends boolean | undefined = false,\n>(props: ComboboxFieldProps<TItem, TMultiple>) {\n const {\n items,\n loadOptions,\n value,\n onValueChange,\n renderLabel,\n renderOption,\n renderChip,\n placeholder,\n searchInPopup = false,\n multiple,\n disabled,\n invalid,\n isItemEqualToValue,\n size,\n widthVariant,\n contentWidthVariant = \"trigger\",\n triggerClassName,\n contentProps,\n inputRef,\n readOnly,\n } = props;\n\n // Helper to get the key for an item\n const getItemKey = (item: TItem, index: number): string => {\n if (item && typeof item === \"object\") {\n if (\"value\" in item) {\n const val = (item as any).value;\n return typeof val === \"string\" || typeof val === \"number\"\n ? String(val)\n : index.toString();\n }\n if (\"id\" in item) {\n const id = (item as any).id;\n return typeof id === \"string\" || typeof id === \"number\"\n ? String(id)\n : index.toString();\n }\n }\n return index.toString();\n };\n\n // Helper to render item content\n const renderItemContent = (item: TItem): React.ReactNode => {\n if (renderOption) {\n return renderOption(item);\n }\n // Auto-detect label property\n if (item && typeof item === \"object\" && \"label\" in item) {\n return (item as any).label;\n }\n // Fallback to string representation\n return String(item);\n };\n\n // Helper to render selected value label (single item)\n const renderSingleValueLabel = (item: TItem): React.ReactNode => {\n if (renderLabel && !multiple) {\n return (renderLabel as (item: TItem) => React.ReactNode)(item);\n }\n // Auto-detect label property\n if (item && typeof item === \"object\" && \"label\" in item) {\n return (item as any).label;\n }\n // Fallback to string representation\n return String(item);\n };\n\n // Helper to render selected value label (multiple items)\n const renderMultipleValueLabel = (items: TItem[]): React.ReactNode => {\n if (renderLabel && multiple) {\n return (renderLabel as (items: TItem[]) => React.ReactNode)(items);\n }\n // Default: show count\n return `${items.length} selected`;\n };\n\n // Helper to render chip content\n const renderChipContent = (item: TItem): React.ReactNode => {\n if (renderChip) {\n return renderChip(item);\n }\n return renderSingleValueLabel(item);\n };\n\n return (\n <Combobox.Root<TItem, TMultiple>\n items={items}\n loadOptions={loadOptions}\n value={value}\n onValueChange={onValueChange}\n multiple={multiple}\n disabled={disabled}\n invalid={invalid}\n isItemEqualToValue={isItemEqualToValue}\n // @ts-expect-error\n itemToStringLabel={multiple ? undefined : renderLabel}\n inputRef={inputRef}\n readOnly={readOnly}\n >\n {/* If searchInPopup, use regular Trigger (regardless of multiple) */}\n {searchInPopup ? (\n <Combobox.Trigger\n size={size}\n widthVariant={widthVariant}\n className={triggerClassName}\n >\n <Combobox.Value placeholder={placeholder}>\n {(selectedValue: any) => {\n if (selectedValue == null) {\n return null;\n }\n\n // Handle multiple selection\n if (multiple && Array.isArray(selectedValue)) {\n if (selectedValue.length === 0) {\n return null;\n }\n return renderMultipleValueLabel(selectedValue);\n }\n\n // Single selection\n return renderSingleValueLabel(selectedValue);\n }}\n </Combobox.Value>\n </Combobox.Trigger>\n ) : multiple ? (\n /* Multiple selection uses ChipsTrigger */\n <Combobox.ChipsTrigger\n placeholder={placeholder}\n size={size}\n widthVariant={widthVariant}\n className={triggerClassName}\n >\n {(item: TItem) => (\n <Combobox.Chip key={getItemKey(item as any, 0)}>\n {renderChipContent(item)}\n </Combobox.Chip>\n )}\n </Combobox.ChipsTrigger>\n ) : (\n /* Single selection uses SearchableTrigger */\n <Combobox.SearchableTrigger\n placeholder={placeholder}\n size={size}\n widthVariant={widthVariant}\n className={triggerClassName}\n />\n )}\n\n <Combobox.Content widthVariant={contentWidthVariant} {...contentProps}>\n {/* Search in popup when using regular Trigger */}\n {searchInPopup && <Combobox.Search placeholder={placeholder} />}\n\n <Combobox.List>\n {(item: TItem) => {\n const key = getItemKey(item, 0);\n const ItemComponent = multiple ? Combobox.MultiItem : Combobox.Item;\n\n return (\n <ItemComponent key={key} value={item}>\n {renderItemContent(item)}\n </ItemComponent>\n );\n }}\n </Combobox.List>\n </Combobox.Content>\n </Combobox.Root>\n );\n}\n","/**\n * Mapping of currency abbreviations to country codes for flag display.\n * Used internally by CurrencySelectField to display country flags.\n */\nexport const CURRENCY_FLAG_CODE: Record<string, string> = {\n USD: \"US\",\n CAD: \"CA\",\n EUR: \"EU\",\n GBP: \"GB\",\n INR: \"IN\",\n AFN: \"AF\",\n ALL: \"AL\",\n ANG: \"MY\",\n ARS: \"AR\",\n AUD: \"AU\",\n AZN: \"AZ\",\n BBD: \"BB\",\n BGN: \"BG\",\n BMD: \"BM\",\n BOB: \"BO\",\n BRL: \"BR\",\n BSD: \"BS\",\n BWP: \"BW\",\n BYN: \"BY\",\n CHF: \"CH\",\n CLP: \"CL\",\n COP: \"CO\",\n CRC: \"CR\",\n CUP: \"CU\",\n CZK: \"CZ\",\n DKK: \"DK\",\n DOP: \"DO\",\n EGP: \"EG\",\n FJD: \"FJ\",\n GGP: \"GG\",\n GHS: \"US\",\n GIP: \"GI\",\n GTQ: \"GT\",\n GYD: \"GY\",\n HKD: \"HK\",\n HNL: \"HN\",\n HRK: \"HR\",\n HUF: \"HU\",\n ILS: \"IL\",\n IMP: \"IM\",\n IRR: \"IR\",\n ISK: \"IS\",\n JEP: \"JE\",\n JMD: \"JM\",\n JPY: \"JP\",\n KHR: \"KM\",\n KPW: \"KP\",\n KRW: \"KR\",\n KYD: \"KY\",\n LAK: \"LA\",\n LBP: \"LB\",\n LKR: \"LK\",\n LRD: \"LR\",\n MKD: \"MK\",\n MNT: \"MN\",\n MXN: \"MX\",\n MYR: \"MY\",\n MZN: \"MZ\",\n NGN: \"NG\",\n NIO: \"NI\",\n NOK: \"NO\",\n NPR: \"NP\",\n NZD: \"NZ\",\n PAB: \"PA\",\n PEN: \"PE\",\n PHP: \"PH\",\n PKR: \"PK\",\n PLN: \"PL\",\n PYG: \"PY\",\n QAR: \"QA\",\n RON: \"RO\",\n RSD: \"RS\",\n RUB: \"RU\",\n SAR: \"SA\",\n SBD: \"SB\",\n SCR: \"SC\",\n SEK: \"SE\",\n SGD: \"SG\",\n SHP: \"SH\",\n SOS: \"SO\",\n SRD: \"SR\",\n SVC: \"SV\",\n THB: \"TH\",\n TRY: \"TR\",\n TVD: \"TV\",\n TWD: \"TW\",\n UAH: \"UA\",\n UYU: \"UY\",\n UZS: \"UZ\",\n VEF: \"VE\",\n VND: \"VN\",\n XCD: \"EC\",\n YEN: \"YE\",\n YER: \"YE\",\n ZAR: \"ZA\",\n ZWD: \"ZW\",\n AED: \"AE\",\n AMD: \"AD\",\n BDT: \"BD\",\n BTN: \"BT\",\n AOA: \"AO\",\n AWG: \"AW\",\n BAM: \"BA\",\n BHD: \"BH\",\n BIF: \"BI\",\n BND: \"BN\",\n BZD: \"BZ\",\n CNY: \"CN\",\n CVE: \"CV\",\n DJF: \"DJ\",\n DZD: \"DZ\",\n ETB: \"ET\",\n FKP: \"FK\",\n GEL: \"GE\",\n GMD: \"GM\",\n GNF: \"GN\",\n HTG: \"HT\",\n IDR: \"ID\",\n IQD: \"IQ\",\n JOD: \"JO\",\n KES: \"KE\",\n KGS: \"KG\",\n KMF: \"KM\",\n KWD: \"KW\",\n MWK: \"MW\",\n ZMW: \"ZM\",\n LSL: \"LS\",\n LYD: \"LY\",\n MAD: \"MA\",\n MDL: \"MD\",\n MGA: \"MG\",\n MMK: \"MM\",\n KZT: \"KZ\",\n MOP: \"MO\",\n MRU: \"MR\",\n MUR: \"MU\",\n MVR: \"MV\",\n NAD: \"NA\",\n OMR: \"OM\",\n PGK: \"PG\",\n RWF: \"RW\",\n SDG: \"SD\",\n SLL: \"SL\",\n STD: \"ST\",\n SYP: \"SY\",\n SZL: \"SZ\",\n TJS: \"TJ\",\n TMT: \"TM\",\n TND: \"TN\",\n TOP: \"TO\",\n TTD: \"TT\",\n TZS: \"TZ\",\n UGX: \"UG\",\n VES: \"VE\",\n VUV: \"VU\",\n WST: \"WS\",\n XAF: \"CF\",\n XOF: \"NG\",\n XPF: \"CF\",\n};\n\n","import * as React from \"react\";\nimport { Combobox, cn, InputGroup } from \"@px-ui/core\";\nimport ReactCountryFlag from \"react-country-flag\";\nimport { CURRENCY_FLAG_CODE } from \"../constants/currency-flag-code\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/**\n * Currency type representing a currency option\n */\nexport interface Currency {\n /** Unique identifier for the currency */\n id: string;\n /** Full currency name (e.g., \"United States dollar\") */\n name: string;\n /** Currency abbreviation (e.g., \"USD\", \"EUR\") */\n abbr: string;\n /** Currency value/code used for form submission */\n value: string;\n}\n\ntype AllRootProps = React.ComponentProps<typeof Combobox.Root<Currency, false>>;\n\ntype RootProps = Pick<\n AllRootProps,\n | \"value\"\n | \"onValueChange\"\n | \"disabled\"\n | \"invalid\"\n | \"inputRef\"\n | \"readOnly\"\n | \"name\"\n>;\n\nexport interface CurrencySelectFieldProps extends RootProps {\n /**\n * Array of currency options to display\n */\n currencies: ReadonlyArray<Currency>;\n\n /**\n * Placeholder text when no currency is selected\n * @default \"Select currency\"\n */\n placeholder?: string;\n\n /**\n * Size variant for the trigger\n */\n size?: React.ComponentProps<typeof InputGroup.Root>[\"size\"];\n\n /**\n * Width variant for trigger\n */\n widthVariant?: React.ComponentProps<typeof InputGroup.Root>[\"widthVariant\"];\n\n /**\n * Width variant for the dropdown content\n */\n contentWidthVariant?: React.ComponentProps<\n typeof Combobox.Content\n >[\"widthVariant\"];\n\n /**\n * Additional className for the trigger\n */\n triggerClassName?: string;\n\n /**\n * Whether the select is loading\n */\n isLoading?: boolean;\n\n /**\n * Additional props for Combobox.Content\n */\n contentProps?: Omit<\n React.ComponentProps<typeof Combobox.Content>,\n \"children\" | \"widthVariant\" | \"empty\"\n >;\n}\n\n// ============================================================================\n// Sub-components\n// ============================================================================\n\ninterface CurrencyFlagProps {\n countryCode: string | null | undefined;\n className?: string;\n}\n\nfunction CurrencyFlag({ countryCode, className }: CurrencyFlagProps) {\n if (!countryCode) {\n return <span className={cn(\"inline-block w-4\", className)} />;\n }\n\n return (\n <div\n className={cn(\"relative -top-px flex shrink-0 items-center\", className)}\n >\n <ReactCountryFlag\n countryCode={countryCode}\n svg\n style={{\n width: \"14px\",\n height: \"14px\",\n }}\n aria-label={`Flag of ${countryCode}`}\n />\n </div>\n );\n}\n\ninterface CurrencyOptionContentProps {\n currency: Currency;\n}\n\nfunction CurrencyOptionContent({ currency }: CurrencyOptionContentProps) {\n const countryCode = CURRENCY_FLAG_CODE[currency.abbr];\n\n return (\n <div className=\"flex items-center gap-2.5\">\n <CurrencyFlag countryCode={countryCode} />\n <span>\n <span className=\"text-ppx-foreground font-medium\">{currency.abbr}</span>\n <span className=\"text-ppx-muted-foreground\"> - {currency.name}</span>\n </span>\n </div>\n );\n}\n\n// ============================================================================\n// Main Component\n// ============================================================================\n\n/**\n * A currency select component with search functionality and flag display.\n * Country flags are automatically displayed based on the currency abbreviation\n * using the built-in CURRENCY_FLAG_CODE mapping.\n *\n * @example\n * ```tsx\n * const currencies = [\n * { id: \"1\", abbr: \"USD\", name: \"United States dollar\", value: \"USD\" },\n * { id: \"2\", abbr: \"EUR\", name: \"Euro\", value: \"EUR\" },\n * { id: \"3\", abbr: \"GBP\", name: \"British Pound\", value: \"GBP\" },\n * ];\n *\n * <CurrencySelectField\n * currencies={currencies}\n * value={selectedCurrency}\n * onValueChange={setSelectedCurrency}\n * placeholder=\"Select currency\"\n * />\n * ```\n */\nexport function CurrencySelectField({\n currencies,\n value,\n onValueChange,\n placeholder = \"Select currency\",\n disabled,\n invalid,\n name,\n size,\n widthVariant,\n contentWidthVariant = \"trigger\",\n triggerClassName,\n isLoading,\n contentProps,\n inputRef,\n readOnly,\n}: CurrencySelectFieldProps) {\n return (\n <Combobox.Root<Currency, false>\n items={currencies as Currency[]}\n value={value}\n onValueChange={onValueChange}\n disabled={disabled}\n invalid={invalid}\n isLoading={isLoading}\n isItemEqualToValue={(item, val) => item.id === val.id}\n inputRef={inputRef}\n readOnly={readOnly}\n name={name}\n >\n <Combobox.Trigger\n widthVariant={widthVariant}\n className={triggerClassName}\n size={size}\n >\n <div className=\"flex items-center gap-2\">\n {value && (\n <CurrencyFlag\n countryCode={CURRENCY_FLAG_CODE[value.abbr]}\n className=\"w-fit\"\n />\n )}\n <Combobox.Value placeholder={placeholder}>\n {(currency: Currency) => `${currency.abbr} - ${currency.name}`}\n </Combobox.Value>\n </div>\n </Combobox.Trigger>\n\n <Combobox.Content\n widthVariant={contentWidthVariant}\n empty=\"No currencies found\"\n {...contentProps}\n >\n <Combobox.Search />\n\n <Combobox.List>\n {(currency: Currency) => (\n <Combobox.Item key={currency.id} value={currency}>\n <CurrencyOptionContent currency={currency} />\n </Combobox.Item>\n )}\n </Combobox.List>\n </Combobox.Content>\n </Combobox.Root>\n );\n}\n","import * as React from \"react\";\nimport {\n FileUpload,\n useFileUpload,\n type UseFileUploadOptions,\n type FileUploadItem,\n type DropzoneRenderProps,\n type DropzoneState,\n} from \"@px-ui/core\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface FileUploadFieldProps\n extends Omit<UseFileUploadOptions, \"initialFiles\"> {\n /** Size of the dropzone (ignored when using render prop) */\n size?: \"sm\" | \"default\" | \"lg\";\n /** Text displayed in the dropzone (ignored when using render prop) */\n dropzoneText?: string;\n /** Text for the browse/upload button (ignored when using render prop) */\n buttonText?: string;\n /** Show file list below the dropzone */\n showFileList?: boolean;\n /** Initial files (already uploaded) */\n initialFiles?: Array<{\n id: string;\n name: string;\n size: number;\n type: string;\n url: string;\n }>;\n /** Whether the upload is disabled */\n disabled?: boolean;\n /** Custom className */\n className?: string;\n /**\n * Render prop for complete dropzone customization.\n * Receives props to spread and state for conditional styling.\n */\n render?: (\n props: DropzoneRenderProps,\n state: DropzoneState,\n ) => React.ReactElement;\n /** Render prop for custom file item rendering */\n renderFileItem?: (\n file: FileUploadItem,\n actions: { remove: () => void; retry: () => void },\n ) => React.ReactNode;\n /** Error handler */\n onError?: (error: { type: string; message: string; files?: File[] }) => void;\n}\n\n// ============================================================================\n// Main Component\n// ============================================================================\n\nexport function FileUploadField({\n size = \"default\",\n dropzoneText = \"Paste Or Drag & Drop Files Here\",\n buttonText = \"Browse for files\",\n showFileList = true,\n initialFiles = [],\n disabled = false,\n className,\n render,\n renderFileItem,\n onError,\n // Hook options\n maxFiles,\n maxSize,\n accept,\n multiple = false,\n onFilesChange,\n onFilesAdded,\n upload: uploadConfig,\n}: FileUploadFieldProps) {\n const uploadHook = useFileUpload({\n maxFiles,\n maxSize,\n accept,\n multiple,\n initialFiles: initialFiles.map((f) => ({\n ...f,\n id: f.id,\n name: f.name,\n size: f.size,\n type: f.type,\n url: f.url,\n })),\n onFilesChange,\n onFilesAdded,\n upload: uploadConfig,\n });\n\n const { files, errors, retryUpload, removeFile } = uploadHook;\n\n // Handle errors\n React.useEffect(() => {\n if (errors.length > 0 && onError) {\n onError({\n type: \"validation\",\n message: errors[0],\n });\n }\n }, [errors, onError]);\n\n // Render file item using ListItem or custom render prop\n const renderDefaultFileItem = (file: FileUploadItem) => {\n if (renderFileItem) {\n return renderFileItem(file, {\n remove: () => removeFile(file.id),\n retry: () => retryUpload(file.id),\n });\n }\n\n return <FileUpload.ListItem key={file.id} file={file} />;\n };\n\n return (\n <FileUpload.Root\n key={uploadHook.instanceKey}\n upload={uploadHook}\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n className={className}\n >\n <FileUpload.Dropzone\n size={size}\n dropzoneText={dropzoneText}\n browseText={buttonText}\n render={render}\n />\n\n {/* Errors */}\n {errors.length > 0 && (\n <div className=\"text-ppx-red-5 text-sm\">\n {errors.map((error, i) => (\n <p key={i}>{error}</p>\n ))}\n </div>\n )}\n\n {/* File List */}\n {showFileList && files.length > 0 && (\n <div>\n <div className=\"mb-2 flex items-center justify-between\">\n <span className=\"text-ppx-neutral-14 text-sm font-medium\">\n {multiple ? `Files (${files.length})` : \"Selected file\"}\n </span>\n {multiple && files.length > 1 && (\n <FileUpload.ClearAll\n size=\"sm\"\n className=\"text-ppx-red-5 hover:text-ppx-red-6\"\n >\n Remove all\n </FileUpload.ClearAll>\n )}\n </div>\n\n <FileUpload.List>\n {files.map(renderDefaultFileItem)}\n </FileUpload.List>\n </div>\n )}\n </FileUpload.Root>\n );\n}\n\nexport type {\n FileUploadItem,\n UploadConfig,\n UseFileUploadOptions as FileUploadWithUploaderOptions,\n DropzoneRenderProps,\n DropzoneState,\n} from \"@px-ui/core\";\n","import { useMemo } from \"react\";\nimport {\n cn,\n cva,\n type VariantProps,\n Label as LabelPrimitive,\n Separator as SeperatorPrimitive,\n} from \"@px-ui/core\";\n\nexport function Set({ className, ...props }: React.ComponentProps<\"fieldset\">) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n \"flex flex-col gap-6\",\n \"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function Legend({\n className,\n variant = \"legend\",\n ...props\n}: React.ComponentProps<\"legend\"> & { variant?: \"legend\" | \"label\" }) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n \"mb-3 font-medium\",\n \"data-[variant=legend]:text-base\",\n \"data-[variant=label]:text-sm\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function Group({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n \"group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\ntype FieldVariantsType = (\n props?:\n | {\n orientation?: \"vertical\" | \"horizontal\" | \"responsive\";\n }\n | undefined,\n) => string;\n\nconst fieldVariants: FieldVariantsType = cva(\n \"group/field flex w-full gap-2 data-[invalid=true]:text-ppx-red-5\",\n {\n variants: {\n orientation: {\n vertical: [\"flex-col [&>*]:w-full [&>.sr-only]:w-auto\"],\n horizontal: [\n \"flex-row items-center\",\n \"[&>[data-slot=field-label]]:flex-auto\",\n \"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n ],\n responsive: [\n \"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto\",\n \"@md/field-group:[&>[data-slot=field-label]]:flex-auto\",\n \"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n ],\n },\n },\n defaultVariants: {\n orientation: \"vertical\",\n },\n },\n) as FieldVariantsType;\n\nexport function Root({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof fieldVariants>) {\n return (\n <div\n role=\"group\"\n data-slot=\"field\"\n data-orientation={orientation}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n );\n}\n\nexport function Content({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\n \"group/field-content flex flex-1 flex-col gap-1.5 leading-snug\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function Label({\n className,\n ...props\n}: React.ComponentProps<typeof LabelPrimitive>) {\n return (\n <LabelPrimitive\n data-slot=\"field-label\"\n className={cn(\n \"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50\",\n \"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function Title({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"field-label\"\n className={cn(\n \"text-ppx-sm flex w-fit items-center gap-2 font-medium leading-snug group-data-[disabled=true]/field:opacity-50\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function Description({\n className,\n ...props\n}: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n \"text-ppx-sm text-ppx-muted-foreground font-normal leading-normal group-has-[[data-orientation=horizontal]]/field:text-balance\",\n \"nth-last-2:-mt-1 last:mt-0 [[data-variant=legend]+&]:-mt-1.5\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function Separator({\n children,\n className,\n ...props\n}: React.ComponentProps<\"div\"> & {\n children?: React.ReactNode;\n}) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn(\n \"text-ppx-sm relative -my-2 h-5 group-data-[variant=outline]/field-group:-mb-2\",\n className,\n )}\n {...props}\n >\n <SeperatorPrimitive\n orientation=\"horizontal\"\n className=\"absolute inset-0 top-1/2\"\n />\n {children && (\n <span\n className=\"bg-ppx-background text-ppx-muted-foreground relative mx-auto block w-fit px-2\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n );\n}\n\nexport function Error({\n className,\n children,\n errors,\n ...props\n}: React.ComponentProps<\"div\"> & {\n errors?: Array<{ message?: string } | undefined>;\n}) {\n const content = useMemo(() => {\n if (children) {\n return children;\n }\n\n if (!errors?.length) {\n return null;\n }\n\n const uniqueErrors = [\n ...new Map(errors.map((error) => [error?.message, error])).values(),\n ];\n\n if (uniqueErrors?.length == 1) {\n return uniqueErrors[0]?.message;\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {uniqueErrors.map(\n (error, index) =>\n error?.message && <li key={index}>{error.message}</li>,\n )}\n </ul>\n );\n }, [children, errors]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div\n role=\"alert\"\n data-slot=\"field-error\"\n className={cn(\"text-ppx-sm text-ppx-red-5 font-normal\", className)}\n {...props}\n >\n {content}\n </div>\n );\n}\n","import {\n Controller,\n type ControllerProps,\n type FieldPath,\n type FieldValues,\n} from \"react-hook-form\";\nimport * as Field from \"./field\";\nimport { type ReactNode } from \"react\";\nimport { Textarea, Checkbox, Input } from \"@px-ui/core\";\n\ntype FormControlProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n TTransformedValues = TFieldValues,\n> = {\n name: TName;\n label: ReactNode;\n description?: ReactNode;\n control: ControllerProps<TFieldValues, TName, TTransformedValues>[\"control\"];\n required?: boolean;\n placeholder?: string;\n};\n\ntype FormBaseProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n TTransformedValues = TFieldValues,\n> = FormControlProps<TFieldValues, TName, TTransformedValues> & {\n horizontal?: boolean;\n controlFirst?: boolean;\n children: (\n field: Parameters<\n ControllerProps<TFieldValues, TName, TTransformedValues>[\"render\"]\n >[0][\"field\"] & {\n invalid?: boolean;\n id: string;\n },\n ) => ReactNode;\n};\n\ntype FormControlFunc<\n ExtraProps extends Record<string, unknown> = Record<never, never>,\n> = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n TTransformedValues = TFieldValues,\n>(\n props: FormControlProps<TFieldValues, TName, TTransformedValues> & ExtraProps,\n) => ReactNode;\n\nfunction FormBase<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n TTransformedValues = TFieldValues,\n>({\n children,\n control,\n label,\n name,\n required,\n description,\n controlFirst,\n horizontal,\n}: FormBaseProps<TFieldValues, TName, TTransformedValues>) {\n return (\n <Controller\n control={control}\n name={name}\n render={({ field, fieldState }) => {\n const labelElement = (\n <Field.Label\n className={required ? \"required\" : \"\"}\n htmlFor={field.name}\n >\n {label}\n </Field.Label>\n );\n\n const descriptionElement = description ? (\n <Field.Description>{description}</Field.Description>\n ) : null;\n\n const control = children({\n ...field,\n id: field.name,\n invalid: fieldState.invalid,\n });\n\n const errorElement = fieldState.invalid && (\n <Field.Error errors={[fieldState.error]} />\n );\n\n return (\n <Field.Root orientation={horizontal ? \"horizontal\" : undefined}>\n {controlFirst ? (\n <>\n {control}\n {labelElement}\n {descriptionElement}\n {errorElement}\n </>\n ) : (\n <>\n {labelElement}\n {control}\n {descriptionElement}\n {errorElement}\n </>\n )}\n </Field.Root>\n );\n }}\n />\n );\n}\n\nexport const FormInput: FormControlFunc = ({ placeholder, ...props }) => {\n return (\n <FormBase {...props}>\n {(field) => <Input {...field} placeholder={placeholder} />}\n </FormBase>\n );\n};\n\nexport const FormTextarea: FormControlFunc = ({ placeholder, ...props }) => {\n return (\n <FormBase {...props}>\n {(field) => <Textarea {...field} placeholder={placeholder} />}\n </FormBase>\n );\n};\n\nexport const FormCheckbox: FormControlFunc = (props) => {\n return (\n <FormBase {...props} horizontal controlFirst>\n {({ onChange, value, ...field }) => (\n <Checkbox {...field} checked={value} onCheckedChange={onChange} />\n )}\n </FormBase>\n );\n};\n\n// Note: FormRadioItem is not included in the abstractions because radio buttons\n// work as a group and require a different pattern. Use the verbose Controller\n// approach with RadioGroup for radio buttons. See the stories for examples.\n","import React, { useState } from 'react';\nimport { cn } from '@px-ui/core';\nimport PhoneInputLib from 'react-phone-input-2';\nimport 'react-phone-input-2/lib/style.css';\nimport GoogleLibPhoneNumber from 'google-libphonenumber';\n\nconst phoneUtil = GoogleLibPhoneNumber.PhoneNumberUtil.getInstance();\nconst PNF = GoogleLibPhoneNumber.PhoneNumberFormat;\n\ninterface PhoneInputProps {\n value: string;\n onChange: (value: string) => void;\n country?: string;\n error?: boolean;\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n}\n\nexport const PhoneInput = ({ \n value, \n onChange, \n country = 'us', \n error,\n placeholder,\n disabled,\n className\n}: PhoneInputProps) => {\n const [isValid, setIsValid] = useState(true);\n\n const handleChange = (inputValue: string, data: any) => {\n if (!inputValue) {\n setIsValid(true);\n onChange('');\n return;\n }\n\n try {\n const parsedNumber = phoneUtil.parseAndKeepRawInput(inputValue, data.countryCode);\n const isNumberValid = phoneUtil.isValidNumberForRegion(parsedNumber, data.countryCode);\n \n setIsValid(isNumberValid);\n \n if (isNumberValid) {\n const formatted = phoneUtil.format(parsedNumber, PNF.E164);\n onChange(formatted);\n } else {\n onChange(inputValue);\n }\n } catch (e) {\n setIsValid(false);\n onChange(inputValue);\n }\n };\n\n return (\n <div className={cn(\"w-full flex flex-col gap-1\", className)}>\n <div className={`relative ${(!isValid || error) ? 'phone-input-error' : ''}`}>\n <PhoneInputLib\n country={country}\n value={value}\n onChange={handleChange}\n disabled={disabled}\n placeholder={placeholder}\n inputClass={`!w-full !h-11 !text-base !rounded-lg !border ${\n !isValid || error \n ? '!border-red-500 !bg-red-50' \n : '!border-gray-300 focus:!border-blue-500 focus:!ring-1 focus:!ring-blue-500'\n }`}\n buttonClass={`!rounded-l-lg !border-y !border-l ${\n !isValid || error ? '!border-red-500 !bg-red-50' : '!border-gray-300'\n }`}\n containerClass=\"!w-full\"\n />\n </div>\n \n {(!isValid || error) && (\n <p className=\"text-red-500 text-xs font-medium mt-1\">\n Please enter a valid phone number for this region.\n </p>\n )}\n </div>\n );\n};\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2FA,SAAgB,YAGd,OAA2C;CAC3C,MAAM,EACJ,OACA,OACA,eACA,aACA,cACA,aACA,UACA,UACA,SACA,MACA,oBACA,MACA,cACA,qBACA,cACA,kBACA,UACA,aACE;CAGJ,MAAM,cAAc,MAAa,UAA0B;AACzD,MAAI,QAAQ,OAAO,SAAS,UAAU;AACpC,OAAI,WAAW,MAAM;IACnB,MAAM,MAAO,KAAa;AAC1B,WAAO,OAAO,QAAQ,YAAY,OAAO,QAAQ,WAC7C,OAAO,IAAI,GACX,MAAM,UAAU;;AAEtB,OAAI,QAAQ,MAAM;IAChB,MAAM,KAAM,KAAa;AACzB,WAAO,OAAO,OAAO,YAAY,OAAO,OAAO,WAC3C,OAAO,GAAG,GACV,MAAM,UAAU;;;AAGxB,SAAO,MAAM,UAAU;;CAIzB,MAAM,qBAAqB,SAAiC;AAC1D,M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|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Form components built on top of px-ui-core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"react-dom": ">=19.0.0",
|
|
42
42
|
"react-hook-form": ">=7.0.0",
|
|
43
43
|
"zod": ">=3.0.0",
|
|
44
|
-
"@px-ui/core": "4.0
|
|
44
|
+
"@px-ui/core": "4.1.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@hookform/resolvers": "^5.1.1",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"vite": "npm:rolldown-vite@^7.2.5",
|
|
65
65
|
"vitest": "^4.0.9",
|
|
66
66
|
"zod": "4.0.0",
|
|
67
|
-
"@px-ui/core": "4.0
|
|
67
|
+
"@px-ui/core": "4.1.0"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"lint": "eslint src --ext .ts,.tsx",
|