tw-react-components 0.0.134 → 0.0.136

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/index.cjs.js CHANGED
@@ -772,7 +772,7 @@ const Label = ({ children, className, description, required, hasErrors, htmlFor,
772
772
  return !children ? null : (jsxRuntime.jsxs("label", { className: cn('flex items-center gap-1 font-medium', {
773
773
  'text-slate-700 dark:text-slate-100': !hasErrors,
774
774
  'text-red-600 dark:text-red-500': hasErrors,
775
- }, className), htmlFor: htmlFor, children: [jsxRuntime.jsxs("span", { children: [children, " ", required && jsxRuntime.jsx("span", { className: "text-red-600", children: "*" })] }), description && (jsxRuntime.jsx(Tooltip, { content: jsxRuntime.jsx("div", { className: "max-w-xs", children: description }), placement: "right", children: jsxRuntime.jsx(lucideReact.HelpCircle, { className: "h-5 w-5" }) }))] }));
775
+ }, className), htmlFor: htmlFor, children: [children, description && (jsxRuntime.jsx(Tooltip, { content: jsxRuntime.jsx("div", { className: "max-w-xs", children: description }), placement: "top", asChild: true, children: jsxRuntime.jsx(lucideReact.HelpCircle, { className: "h-4 w-4" }) })), required && jsxRuntime.jsx("span", { className: "text-red-600", children: "*" })] }));
776
776
  };
777
777
 
778
778
  const inputClasses = {
@@ -864,7 +864,12 @@ const CheckboxInput = react.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInpu
864
864
 
865
865
  const EmailInput = react.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "email" }, props, { suffixIcon: lucideReact.AtSignIcon, ref: ref }))));
866
866
 
867
- const NumberInput = react.forwardRef((props, ref) => (jsxRuntime.jsx(BasicInput, Object.assign({ type: "number" }, props, { ref: ref }))));
867
+ const NumberInput = react.forwardRef((_a, ref) => {
868
+ var { unit } = _a, props = __rest(_a, ["unit"]);
869
+ return (jsxRuntime.jsx(BasicInput, Object.assign({ type: "number" }, props, { suffixIcon: unit
870
+ ? ({ className }) => (jsxRuntime.jsx("div", { className: cn(className, 'flex w-min items-center'), onClick: props.onSuffixIconClick, children: unit }))
871
+ : props.suffixIcon, ref: ref })));
872
+ });
868
873
 
869
874
  const PasswordInput = react.forwardRef((props, ref) => {
870
875
  const [type, setType] = react.useState('password');
@@ -1119,7 +1124,7 @@ const DateTimeInput = react.forwardRef((_a, ref) => {
1119
1124
  setIsOpen(false);
1120
1125
  }
1121
1126
  };
1122
- return (jsxRuntime.jsxs("div", { className: cn('relative w-full', className), ref: ref, children: [jsxRuntime.jsx(BasicInput, Object.assign({}, props, { type: "text", readOnly: true, value: displayDate !== null && displayDate !== void 0 ? displayDate : '', hasErrors: hasErrors, onClick: handleOnClick, onKeyUp: handleOnKeyUp, clearable: clearable && !!displayDate, onClear: clearDate, suffixIcon: (type === null || type === void 0 ? void 0 : type.includes('date')) ? lucideReact.CalendarIcon : lucideReact.ClockIcon })), isOpen && (jsxRuntime.jsxs("div", { className: "absolute z-20 mt-2 flex origin-top-left flex-col rounded-md border bg-white shadow duration-200 dark:border-slate-700 dark:bg-slate-900 dark:text-white", tabIndex: 0, onBlur: handleOnBlur, ref: calendarRef, children: [(type === null || type === void 0 ? void 0 : type.includes('date')) && (jsxRuntime.jsx(DateSelector, { date: date, value: value, minDate: minDate, maxDate: maxDate, locale: displayLocale, calendarView: calendarView, setCalendarView: setCalendarView, setNewDate: setNewDate })), calendarView === 'days' && (jsxRuntime.jsxs("div", { className: "flex select-none items-center justify-end gap-2 px-3 py-2", children: [(type === null || type === void 0 ? void 0 : type.includes('time')) && (jsxRuntime.jsx(TimeSelector, { date: date, step: step, minDate: minDate, maxDate: maxDate, setNewDate: setNewDate })), jsxRuntime.jsx("div", { className: "cursor-pointer rounded-lg border border-transparent p-1 text-sm font-bold uppercase text-blue-600 transition duration-100 ease-in-out hover:bg-slate-100 dark:text-blue-500 dark:hover:bg-slate-700", onClick: () => setIsOpen(false), children: "OK" })] }))] }))] }));
1127
+ return (jsxRuntime.jsxs("div", { className: cn('relative w-full', className), ref: ref, children: [jsxRuntime.jsx(BasicInput, Object.assign({}, props, { type: "text", readOnly: true, value: displayDate !== null && displayDate !== void 0 ? displayDate : '', hasErrors: hasErrors, onClick: handleOnClick, onKeyUp: handleOnKeyUp, clearable: clearable && !!displayDate, onClear: clearDate, suffixIcon: (type === null || type === void 0 ? void 0 : type.includes('date')) ? lucideReact.CalendarIcon : lucideReact.ClockIcon, onSuffixIconClick: handleOnClick })), isOpen && (jsxRuntime.jsxs("div", { className: "absolute z-20 mt-2 flex origin-top-left flex-col rounded-md border bg-white shadow duration-200 dark:border-slate-700 dark:bg-slate-900 dark:text-white", tabIndex: 0, onBlur: handleOnBlur, ref: calendarRef, children: [(type === null || type === void 0 ? void 0 : type.includes('date')) && (jsxRuntime.jsx(DateSelector, { date: date, value: value, minDate: minDate, maxDate: maxDate, locale: displayLocale, calendarView: calendarView, setCalendarView: setCalendarView, setNewDate: setNewDate })), calendarView === 'days' && (jsxRuntime.jsxs("div", { className: "flex select-none items-center justify-end gap-2 px-3 py-2", children: [(type === null || type === void 0 ? void 0 : type.includes('time')) && (jsxRuntime.jsx(TimeSelector, { date: date, step: step, minDate: minDate, maxDate: maxDate, setNewDate: setNewDate })), jsxRuntime.jsx("div", { className: "cursor-pointer rounded-lg border border-transparent p-1 text-sm font-bold uppercase text-blue-600 transition duration-100 ease-in-out hover:bg-slate-100 dark:text-blue-500 dark:hover:bg-slate-700", onClick: () => setIsOpen(false), children: "OK" })] }))] }))] }));
1123
1128
  });
1124
1129
 
1125
1130
  const ListContent = react.forwardRef((_a, ref) => {
@@ -1300,16 +1305,31 @@ const SelectInput = react.forwardRef((_a, ref) => {
1300
1305
  handleOnSelect(option.id);
1301
1306
  }, children: jsxRuntime.jsx("span", { children: renderItem(option, !!selectedMap[option.id]) }) }));
1302
1307
  }, [ItemComponent, handleOnSelect, multiple, renderItem, selectedMap]);
1303
- return (jsxRuntime.jsxs(DropdownMenu, { open: open, onOpenChange: setOpen, children: [jsxRuntime.jsx(DropdownMenu.Trigger, { className: cn('w-full', className), children: jsxRuntime.jsx(TextInput, Object.assign({ className: "[&>div>*]:cursor-pointer", inputClassName: "text-left" }, props, { value: text !== null && text !== void 0 ? text : '', clearable: clearable && !!selectedItems.length, onClear: handleOnClear, suffixIcon: lucideReact.ChevronDownIcon, ref: ref, readOnly: true })) }), jsxRuntime.jsxs(DropdownMenu.Content, { className: "flex max-h-80 w-[calc(var(--radix-popper-anchor-width))] flex-col overflow-hidden", children: [search && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TextInput, { value: searchValue, placeholder: "Search...", size: props.size, onChange: handleOnSearchValueChange, clearable: !!searchValue.length, onClear: clearSearchValue }), jsxRuntime.jsx(DropdownMenu.Separator, { className: "w-full" })] })), filteredItems.length === 0 &&
1308
+ return (jsxRuntime.jsxs(DropdownMenu, { open: open, onOpenChange: setOpen, children: [jsxRuntime.jsx(DropdownMenu.Trigger, { className: cn('w-full', className), children: jsxRuntime.jsx(TextInput, Object.assign({ className: "[&>div>*]:cursor-pointer", inputClassName: "text-left" }, props, { value: text !== null && text !== void 0 ? text : '', clearable: clearable && !!selectedItems.length, onClear: handleOnClear, suffixIcon: lucideReact.ChevronDownIcon, onSuffixIconClick: () => setOpen((open) => !open), ref: ref, readOnly: true })) }), jsxRuntime.jsxs(DropdownMenu.Content, { className: "flex max-h-80 w-[calc(var(--radix-popper-anchor-width))] flex-col overflow-hidden", children: [search && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TextInput, { value: searchValue, placeholder: "Search...", size: props.size, onChange: handleOnSearchValueChange, clearable: !!searchValue.length, onClear: clearSearchValue }), jsxRuntime.jsx(DropdownMenu.Separator, { className: "w-full" })] })), filteredItems.length === 0 &&
1304
1309
  (allowAddition && searchValue ? (jsxRuntime.jsxs("button", { className: "rounded bg-slate-100 text-center hover:bg-slate-200 dark:bg-slate-900/30 dark:hover:bg-slate-700/30", onClick: handleOnAddItemClicked, children: ["Add '", searchValue, "'"] })) : (jsxRuntime.jsx("div", { className: "text-center text-slate-500", children: "No items." }))), jsxRuntime.jsx(GroupComponent, { className: "flex flex-col gap-1 overflow-auto", value: !multiple && selectedItems.length ? String(selectedItems[0].id) : undefined, children: filteredItems.map((item, index) => item.group ? (jsxRuntime.jsxs(Flex, { className: "gap-1", direction: "column", fullWidth: true, children: [jsxRuntime.jsx(DropdownMenu.Label, { className: "sticky top-0 z-[51] w-full rounded-md border bg-white py-1 dark:bg-slate-900", children: item.label }), item.items.map((subItem) => (jsxRuntime.jsx(RenderOption, Object.assign({}, subItem), subItem.id))), index < filteredItems.length - 1 && (jsxRuntime.jsx("div", { className: "mb-1 h-px w-full bg-slate-200 dark:bg-slate-700" }))] }, item.id)) : (jsxRuntime.jsx(RenderOption, Object.assign({}, item), item.id))) })] })] }));
1305
1310
  });
1306
1311
 
1307
- const FormGroup = ({ className, label, children }) => (jsxRuntime.jsxs(Flex, { className: cn('relative !gap-4 rounded-lg border p-4 dark:border-slate-300', className), direction: "column", fullWidth: true, children: [jsxRuntime.jsx("div", { className: "absolute right-0 top-0 rounded-bl-lg rounded-tr-lg bg-slate-500 px-2 py-1 font-medium text-white dark:bg-slate-900 dark:text-white", children: label }), children] }));
1312
+ const FileInput = react.forwardRef((_a, ref) => {
1313
+ var { className, value, onChange, onFileChange, accept } = _a, props = __rest(_a, ["className", "value", "onChange", "onFileChange", "accept"]);
1314
+ const fileInputRef = react.useRef(null);
1315
+ const handleFileChange = (_a) => __awaiter(void 0, [_a], void 0, function* ({ target: { files } }) {
1316
+ console.log(files);
1317
+ if (files && files.length > 0) {
1318
+ const file = files[0];
1319
+ console.log(file, file.name, onChange, onFileChange);
1320
+ onChange === null || onChange === void 0 ? void 0 : onChange(file.name);
1321
+ onFileChange === null || onFileChange === void 0 ? void 0 : onFileChange(file);
1322
+ }
1323
+ });
1324
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TextInput, Object.assign({ className: cn('[&>div>*]:cursor-pointer', className), inputClassName: "text-left" }, props, { value: value !== null && value !== void 0 ? value : '', onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, suffixIcon: lucideReact.CloudUploadIcon, onSuffixIconClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, ref: ref, readOnly: true })), jsxRuntime.jsx("input", { ref: (ref) => (fileInputRef.current = ref), type: "file", hidden: true, accept: accept, onChange: handleFileChange })] }));
1325
+ });
1326
+
1327
+ const FormGroup = ({ className, label, children }) => (jsxRuntime.jsxs(Flex, { className: cn('relative !gap-4 rounded-lg border p-4 dark:border-slate-700', className), direction: "column", fullWidth: true, children: [jsxRuntime.jsx("div", { className: "absolute right-0 top-0 rounded-bl-lg rounded-tr-lg bg-slate-500 px-2 py-1 font-medium text-white dark:bg-slate-900 dark:text-white", children: label }), children] }));
1308
1328
 
1309
1329
  function withForm(Component) {
1310
1330
  return react.forwardRef((props, ref) => {
1311
1331
  const _a = props, { name, pattern, validate } = _a, restProps = __rest(_a, ["name", "pattern", "validate"]);
1312
- const { control } = reactHookForm.useFormContext();
1332
+ const { control, formState } = reactHookForm.useFormContext();
1313
1333
  return (jsxRuntime.jsx(reactHookForm.Controller, { name: name, control: control, rules: {
1314
1334
  required: restProps.required,
1315
1335
  min: restProps.min,
@@ -1320,7 +1340,8 @@ function withForm(Component) {
1320
1340
  validate,
1321
1341
  }, render: ({ field, fieldState }) => {
1322
1342
  var _a, _b;
1323
- return (jsxRuntime.jsx(Component, Object.assign({}, restProps, field, { value: (_a = field.value) !== null && _a !== void 0 ? _a : '', disabled: (_b = field.disabled) !== null && _b !== void 0 ? _b : restProps.disabled, hasErrors: fieldState.error, ref: mergeRefs([ref, field.ref]) })));
1343
+ return (jsxRuntime.jsx(Component, Object.assign({}, restProps, field, { value: (_a = field.value) !== null && _a !== void 0 ? _a : '', disabled: ((_b = field.disabled) !== null && _b !== void 0 ? _b : restProps.disabled) ||
1344
+ formState.isSubmitting, hasErrors: fieldState.error, ref: mergeRefs([ref, field.ref]) })));
1324
1345
  } }));
1325
1346
  });
1326
1347
  }
@@ -1333,6 +1354,7 @@ const FormInputs = {
1333
1354
  Checkbox: withForm(CheckboxInput),
1334
1355
  DateTime: withForm(DateTimeInput),
1335
1356
  Select: withForm(SelectInput),
1357
+ File: withForm(FileInput),
1336
1358
  };
1337
1359
 
1338
1360
  const HintRoot = react.forwardRef(({ children }, ref) => (jsxRuntime.jsx(Block, { className: "relative", ref: ref, children: children })));
@@ -1530,7 +1552,7 @@ function DataTable({ className, columns, rows, sorting, pagination, actions = []
1530
1552
  : undefined, children: [column.header, sorting &&
1531
1553
  !column.noSorting &&
1532
1554
  (((_b = sorting.sorting) === null || _b === void 0 ? void 0 : _b.field) !== column.field ? (jsxRuntime.jsx(lucideReact.ArrowUpDownIcon, { className: "absolute top-1/2 float-right ml-1 hidden h-4 w-4 -translate-y-1/2 group-hover:inline-block" })) : ((_c = sorting.sorting) === null || _c === void 0 ? void 0 : _c.direction) === 'asc' ? (jsxRuntime.jsx(lucideReact.SortAscIcon, { className: "absolute top-1/2 float-right ml-1 inline-block h-4 w-4 -translate-y-1/2" })) : (jsxRuntime.jsx(lucideReact.SortDescIcon, { className: "absolute top-1/2 float-right ml-1 inline-block h-4 w-4 -translate-y-1/2" })))] }, columnIndex));
1533
- }), actions.length > 0 && jsxRuntime.jsx(Table.HeadCell, { align: "center", children: "Actions" })] }) }), jsxRuntime.jsxs(Table.Body, { className: "relative", children: [isLoading && (jsxRuntime.jsx(Table.Row, { children: jsxRuntime.jsx(Table.Cell, { className: cn('z-10 h-full w-full p-0', {
1555
+ }), actions.filter((action) => !action.hide).length > 0 && (jsxRuntime.jsx(Table.HeadCell, { align: "center", children: "Actions" }))] }) }), jsxRuntime.jsxs(Table.Body, { className: "relative", children: [isLoading && (jsxRuntime.jsx(Table.Row, { children: jsxRuntime.jsx(Table.Cell, { className: cn('z-10 h-full w-full p-0', {
1534
1556
  absolute: rows.length,
1535
1557
  }), colSpan: columnsLength, children: jsxRuntime.jsx(Spinner, { className: "bg-white/50 py-4 dark:bg-slate-700/50" }) }) })), !isLoading && !rows.length && (jsxRuntime.jsx(Table.Row, { children: jsxRuntime.jsx(Table.Cell, { colSpan: columnsLength, children: jsxRuntime.jsx(Flex, { className: "text-slate-500", justify: "center", children: noDataMessage !== null && noDataMessage !== void 0 ? noDataMessage : 'No data' }) }) })), rows.map((item, rowIndex) => [
1536
1558
  jsxRuntime.jsxs(Table.Row, { className: cn({
@@ -1538,7 +1560,7 @@ function DataTable({ className, columns, rows, sorting, pagination, actions = []
1538
1560
  }, rowClassName === null || rowClassName === void 0 ? void 0 : rowClassName(item, rowIndex)), onClick: handleRowClicked(item, rowIndex), children: [rowExtraContent && (jsxRuntime.jsx(Table.Cell, { className: "w-min", align: "center", children: jsxRuntime.jsx(ExpandButton, { folded: !expandedRows[rowExtraContent.idGetter(item)], foldComponent: lucideReact.MinusIcon, unfoldComponent: lucideReact.PlusIcon, onClick: handleExpandRow(rowExtraContent.idGetter(item)) }) })), _columns.map((column, columnIndex) => {
1539
1561
  var _a, _b, _c;
1540
1562
  return (jsxRuntime.jsx(Table.Cell, { className: column.className, align: (_a = column.align) !== null && _a !== void 0 ? _a : 'left', children: (_c = (_b = column.render) === null || _b === void 0 ? void 0 : _b.call(column, item, rowIndex)) !== null && _c !== void 0 ? _c : defaultRender(item, column.field) }, columnIndex));
1541
- }), actions.length > 0 && (jsxRuntime.jsx(Table.Cell, { className: "py-3", children: jsxRuntime.jsx(Flex, { align: "center", justify: "center", children: actions
1563
+ }), actions.filter((action) => !action.hide).length > 0 && (jsxRuntime.jsx(Table.Cell, { className: "py-3", children: jsxRuntime.jsx(Flex, { align: "center", justify: "center", children: actions
1542
1564
  .filter((action) => { var _a; return typeof action.hide === 'boolean' ? !action.hide : !((_a = action.hide) === null || _a === void 0 ? void 0 : _a.call(action, item)); })
1543
1565
  .map((action, actionIndex) => {
1544
1566
  var _a;
@@ -1824,6 +1846,7 @@ exports.DateTimeInput = DateTimeInput;
1824
1846
  exports.Dialog = Dialog;
1825
1847
  exports.DropdownMenu = DropdownMenu;
1826
1848
  exports.EmailInput = EmailInput;
1849
+ exports.FileInput = FileInput;
1827
1850
  exports.Flex = Flex;
1828
1851
  exports.FormDialog = FormDialog;
1829
1852
  exports.FormGroup = FormGroup;
package/index.esm.js CHANGED
@@ -4,7 +4,7 @@ import { clsx } from 'clsx';
4
4
  import { twMerge } from 'tailwind-merge';
5
5
  import dayjs from 'dayjs';
6
6
  import advancedFormat from 'dayjs/plugin/advancedFormat';
7
- import { HelpCircle, XIcon, AtSignIcon, EyeIcon, EyeOffIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronDownIcon, CalendarIcon, ClockIcon, CheckIcon, CircleIcon, ChevronsLeftIcon, ChevronsRightIcon, ChevronsDownUpIcon, ChevronsUpDownIcon, ArrowUpDownIcon, SortAscIcon, SortDescIcon, MinusIcon, PlusIcon, MenuIcon, MoonIcon, SunIcon } from 'lucide-react';
7
+ import { HelpCircle, XIcon, AtSignIcon, EyeIcon, EyeOffIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronDownIcon, CalendarIcon, ClockIcon, CheckIcon, CircleIcon, CloudUploadIcon, ChevronsLeftIcon, ChevronsRightIcon, ChevronsDownUpIcon, ChevronsUpDownIcon, ArrowUpDownIcon, SortAscIcon, SortDescIcon, MinusIcon, PlusIcon, MenuIcon, MoonIcon, SunIcon } from 'lucide-react';
8
8
  import localeData from 'dayjs/plugin/localeData';
9
9
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
10
10
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
@@ -745,7 +745,7 @@ const Label = ({ children, className, description, required, hasErrors, htmlFor,
745
745
  return !children ? null : (jsxs("label", { className: cn('flex items-center gap-1 font-medium', {
746
746
  'text-slate-700 dark:text-slate-100': !hasErrors,
747
747
  'text-red-600 dark:text-red-500': hasErrors,
748
- }, className), htmlFor: htmlFor, children: [jsxs("span", { children: [children, " ", required && jsx("span", { className: "text-red-600", children: "*" })] }), description && (jsx(Tooltip, { content: jsx("div", { className: "max-w-xs", children: description }), placement: "right", children: jsx(HelpCircle, { className: "h-5 w-5" }) }))] }));
748
+ }, className), htmlFor: htmlFor, children: [children, description && (jsx(Tooltip, { content: jsx("div", { className: "max-w-xs", children: description }), placement: "top", asChild: true, children: jsx(HelpCircle, { className: "h-4 w-4" }) })), required && jsx("span", { className: "text-red-600", children: "*" })] }));
749
749
  };
750
750
 
751
751
  const inputClasses = {
@@ -837,7 +837,12 @@ const CheckboxInput = forwardRef((props, ref) => (jsx(BasicInput, Object.assign(
837
837
 
838
838
  const EmailInput = forwardRef((props, ref) => (jsx(BasicInput, Object.assign({ type: "email" }, props, { suffixIcon: AtSignIcon, ref: ref }))));
839
839
 
840
- const NumberInput = forwardRef((props, ref) => (jsx(BasicInput, Object.assign({ type: "number" }, props, { ref: ref }))));
840
+ const NumberInput = forwardRef((_a, ref) => {
841
+ var { unit } = _a, props = __rest(_a, ["unit"]);
842
+ return (jsx(BasicInput, Object.assign({ type: "number" }, props, { suffixIcon: unit
843
+ ? ({ className }) => (jsx("div", { className: cn(className, 'flex w-min items-center'), onClick: props.onSuffixIconClick, children: unit }))
844
+ : props.suffixIcon, ref: ref })));
845
+ });
841
846
 
842
847
  const PasswordInput = forwardRef((props, ref) => {
843
848
  const [type, setType] = useState('password');
@@ -1092,7 +1097,7 @@ const DateTimeInput = forwardRef((_a, ref) => {
1092
1097
  setIsOpen(false);
1093
1098
  }
1094
1099
  };
1095
- return (jsxs("div", { className: cn('relative w-full', className), ref: ref, children: [jsx(BasicInput, Object.assign({}, props, { type: "text", readOnly: true, value: displayDate !== null && displayDate !== void 0 ? displayDate : '', hasErrors: hasErrors, onClick: handleOnClick, onKeyUp: handleOnKeyUp, clearable: clearable && !!displayDate, onClear: clearDate, suffixIcon: (type === null || type === void 0 ? void 0 : type.includes('date')) ? CalendarIcon : ClockIcon })), isOpen && (jsxs("div", { className: "absolute z-20 mt-2 flex origin-top-left flex-col rounded-md border bg-white shadow duration-200 dark:border-slate-700 dark:bg-slate-900 dark:text-white", tabIndex: 0, onBlur: handleOnBlur, ref: calendarRef, children: [(type === null || type === void 0 ? void 0 : type.includes('date')) && (jsx(DateSelector, { date: date, value: value, minDate: minDate, maxDate: maxDate, locale: displayLocale, calendarView: calendarView, setCalendarView: setCalendarView, setNewDate: setNewDate })), calendarView === 'days' && (jsxs("div", { className: "flex select-none items-center justify-end gap-2 px-3 py-2", children: [(type === null || type === void 0 ? void 0 : type.includes('time')) && (jsx(TimeSelector, { date: date, step: step, minDate: minDate, maxDate: maxDate, setNewDate: setNewDate })), jsx("div", { className: "cursor-pointer rounded-lg border border-transparent p-1 text-sm font-bold uppercase text-blue-600 transition duration-100 ease-in-out hover:bg-slate-100 dark:text-blue-500 dark:hover:bg-slate-700", onClick: () => setIsOpen(false), children: "OK" })] }))] }))] }));
1100
+ return (jsxs("div", { className: cn('relative w-full', className), ref: ref, children: [jsx(BasicInput, Object.assign({}, props, { type: "text", readOnly: true, value: displayDate !== null && displayDate !== void 0 ? displayDate : '', hasErrors: hasErrors, onClick: handleOnClick, onKeyUp: handleOnKeyUp, clearable: clearable && !!displayDate, onClear: clearDate, suffixIcon: (type === null || type === void 0 ? void 0 : type.includes('date')) ? CalendarIcon : ClockIcon, onSuffixIconClick: handleOnClick })), isOpen && (jsxs("div", { className: "absolute z-20 mt-2 flex origin-top-left flex-col rounded-md border bg-white shadow duration-200 dark:border-slate-700 dark:bg-slate-900 dark:text-white", tabIndex: 0, onBlur: handleOnBlur, ref: calendarRef, children: [(type === null || type === void 0 ? void 0 : type.includes('date')) && (jsx(DateSelector, { date: date, value: value, minDate: minDate, maxDate: maxDate, locale: displayLocale, calendarView: calendarView, setCalendarView: setCalendarView, setNewDate: setNewDate })), calendarView === 'days' && (jsxs("div", { className: "flex select-none items-center justify-end gap-2 px-3 py-2", children: [(type === null || type === void 0 ? void 0 : type.includes('time')) && (jsx(TimeSelector, { date: date, step: step, minDate: minDate, maxDate: maxDate, setNewDate: setNewDate })), jsx("div", { className: "cursor-pointer rounded-lg border border-transparent p-1 text-sm font-bold uppercase text-blue-600 transition duration-100 ease-in-out hover:bg-slate-100 dark:text-blue-500 dark:hover:bg-slate-700", onClick: () => setIsOpen(false), children: "OK" })] }))] }))] }));
1096
1101
  });
1097
1102
 
1098
1103
  const ListContent = forwardRef((_a, ref) => {
@@ -1273,16 +1278,31 @@ const SelectInput = forwardRef((_a, ref) => {
1273
1278
  handleOnSelect(option.id);
1274
1279
  }, children: jsx("span", { children: renderItem(option, !!selectedMap[option.id]) }) }));
1275
1280
  }, [ItemComponent, handleOnSelect, multiple, renderItem, selectedMap]);
1276
- return (jsxs(DropdownMenu, { open: open, onOpenChange: setOpen, children: [jsx(DropdownMenu.Trigger, { className: cn('w-full', className), children: jsx(TextInput, Object.assign({ className: "[&>div>*]:cursor-pointer", inputClassName: "text-left" }, props, { value: text !== null && text !== void 0 ? text : '', clearable: clearable && !!selectedItems.length, onClear: handleOnClear, suffixIcon: ChevronDownIcon, ref: ref, readOnly: true })) }), jsxs(DropdownMenu.Content, { className: "flex max-h-80 w-[calc(var(--radix-popper-anchor-width))] flex-col overflow-hidden", children: [search && (jsxs(Fragment, { children: [jsx(TextInput, { value: searchValue, placeholder: "Search...", size: props.size, onChange: handleOnSearchValueChange, clearable: !!searchValue.length, onClear: clearSearchValue }), jsx(DropdownMenu.Separator, { className: "w-full" })] })), filteredItems.length === 0 &&
1281
+ return (jsxs(DropdownMenu, { open: open, onOpenChange: setOpen, children: [jsx(DropdownMenu.Trigger, { className: cn('w-full', className), children: jsx(TextInput, Object.assign({ className: "[&>div>*]:cursor-pointer", inputClassName: "text-left" }, props, { value: text !== null && text !== void 0 ? text : '', clearable: clearable && !!selectedItems.length, onClear: handleOnClear, suffixIcon: ChevronDownIcon, onSuffixIconClick: () => setOpen((open) => !open), ref: ref, readOnly: true })) }), jsxs(DropdownMenu.Content, { className: "flex max-h-80 w-[calc(var(--radix-popper-anchor-width))] flex-col overflow-hidden", children: [search && (jsxs(Fragment, { children: [jsx(TextInput, { value: searchValue, placeholder: "Search...", size: props.size, onChange: handleOnSearchValueChange, clearable: !!searchValue.length, onClear: clearSearchValue }), jsx(DropdownMenu.Separator, { className: "w-full" })] })), filteredItems.length === 0 &&
1277
1282
  (allowAddition && searchValue ? (jsxs("button", { className: "rounded bg-slate-100 text-center hover:bg-slate-200 dark:bg-slate-900/30 dark:hover:bg-slate-700/30", onClick: handleOnAddItemClicked, children: ["Add '", searchValue, "'"] })) : (jsx("div", { className: "text-center text-slate-500", children: "No items." }))), jsx(GroupComponent, { className: "flex flex-col gap-1 overflow-auto", value: !multiple && selectedItems.length ? String(selectedItems[0].id) : undefined, children: filteredItems.map((item, index) => item.group ? (jsxs(Flex, { className: "gap-1", direction: "column", fullWidth: true, children: [jsx(DropdownMenu.Label, { className: "sticky top-0 z-[51] w-full rounded-md border bg-white py-1 dark:bg-slate-900", children: item.label }), item.items.map((subItem) => (jsx(RenderOption, Object.assign({}, subItem), subItem.id))), index < filteredItems.length - 1 && (jsx("div", { className: "mb-1 h-px w-full bg-slate-200 dark:bg-slate-700" }))] }, item.id)) : (jsx(RenderOption, Object.assign({}, item), item.id))) })] })] }));
1278
1283
  });
1279
1284
 
1280
- const FormGroup = ({ className, label, children }) => (jsxs(Flex, { className: cn('relative !gap-4 rounded-lg border p-4 dark:border-slate-300', className), direction: "column", fullWidth: true, children: [jsx("div", { className: "absolute right-0 top-0 rounded-bl-lg rounded-tr-lg bg-slate-500 px-2 py-1 font-medium text-white dark:bg-slate-900 dark:text-white", children: label }), children] }));
1285
+ const FileInput = forwardRef((_a, ref) => {
1286
+ var { className, value, onChange, onFileChange, accept } = _a, props = __rest(_a, ["className", "value", "onChange", "onFileChange", "accept"]);
1287
+ const fileInputRef = useRef(null);
1288
+ const handleFileChange = (_a) => __awaiter(void 0, [_a], void 0, function* ({ target: { files } }) {
1289
+ console.log(files);
1290
+ if (files && files.length > 0) {
1291
+ const file = files[0];
1292
+ console.log(file, file.name, onChange, onFileChange);
1293
+ onChange === null || onChange === void 0 ? void 0 : onChange(file.name);
1294
+ onFileChange === null || onFileChange === void 0 ? void 0 : onFileChange(file);
1295
+ }
1296
+ });
1297
+ return (jsxs(Fragment, { children: [jsx(TextInput, Object.assign({ className: cn('[&>div>*]:cursor-pointer', className), inputClassName: "text-left" }, props, { value: value !== null && value !== void 0 ? value : '', onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, suffixIcon: CloudUploadIcon, onSuffixIconClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); }, ref: ref, readOnly: true })), jsx("input", { ref: (ref) => (fileInputRef.current = ref), type: "file", hidden: true, accept: accept, onChange: handleFileChange })] }));
1298
+ });
1299
+
1300
+ const FormGroup = ({ className, label, children }) => (jsxs(Flex, { className: cn('relative !gap-4 rounded-lg border p-4 dark:border-slate-700', className), direction: "column", fullWidth: true, children: [jsx("div", { className: "absolute right-0 top-0 rounded-bl-lg rounded-tr-lg bg-slate-500 px-2 py-1 font-medium text-white dark:bg-slate-900 dark:text-white", children: label }), children] }));
1281
1301
 
1282
1302
  function withForm(Component) {
1283
1303
  return forwardRef((props, ref) => {
1284
1304
  const _a = props, { name, pattern, validate } = _a, restProps = __rest(_a, ["name", "pattern", "validate"]);
1285
- const { control } = useFormContext();
1305
+ const { control, formState } = useFormContext();
1286
1306
  return (jsx(Controller, { name: name, control: control, rules: {
1287
1307
  required: restProps.required,
1288
1308
  min: restProps.min,
@@ -1293,7 +1313,8 @@ function withForm(Component) {
1293
1313
  validate,
1294
1314
  }, render: ({ field, fieldState }) => {
1295
1315
  var _a, _b;
1296
- return (jsx(Component, Object.assign({}, restProps, field, { value: (_a = field.value) !== null && _a !== void 0 ? _a : '', disabled: (_b = field.disabled) !== null && _b !== void 0 ? _b : restProps.disabled, hasErrors: fieldState.error, ref: mergeRefs([ref, field.ref]) })));
1316
+ return (jsx(Component, Object.assign({}, restProps, field, { value: (_a = field.value) !== null && _a !== void 0 ? _a : '', disabled: ((_b = field.disabled) !== null && _b !== void 0 ? _b : restProps.disabled) ||
1317
+ formState.isSubmitting, hasErrors: fieldState.error, ref: mergeRefs([ref, field.ref]) })));
1297
1318
  } }));
1298
1319
  });
1299
1320
  }
@@ -1306,6 +1327,7 @@ const FormInputs = {
1306
1327
  Checkbox: withForm(CheckboxInput),
1307
1328
  DateTime: withForm(DateTimeInput),
1308
1329
  Select: withForm(SelectInput),
1330
+ File: withForm(FileInput),
1309
1331
  };
1310
1332
 
1311
1333
  const HintRoot = forwardRef(({ children }, ref) => (jsx(Block, { className: "relative", ref: ref, children: children })));
@@ -1503,7 +1525,7 @@ function DataTable({ className, columns, rows, sorting, pagination, actions = []
1503
1525
  : undefined, children: [column.header, sorting &&
1504
1526
  !column.noSorting &&
1505
1527
  (((_b = sorting.sorting) === null || _b === void 0 ? void 0 : _b.field) !== column.field ? (jsx(ArrowUpDownIcon, { className: "absolute top-1/2 float-right ml-1 hidden h-4 w-4 -translate-y-1/2 group-hover:inline-block" })) : ((_c = sorting.sorting) === null || _c === void 0 ? void 0 : _c.direction) === 'asc' ? (jsx(SortAscIcon, { className: "absolute top-1/2 float-right ml-1 inline-block h-4 w-4 -translate-y-1/2" })) : (jsx(SortDescIcon, { className: "absolute top-1/2 float-right ml-1 inline-block h-4 w-4 -translate-y-1/2" })))] }, columnIndex));
1506
- }), actions.length > 0 && jsx(Table.HeadCell, { align: "center", children: "Actions" })] }) }), jsxs(Table.Body, { className: "relative", children: [isLoading && (jsx(Table.Row, { children: jsx(Table.Cell, { className: cn('z-10 h-full w-full p-0', {
1528
+ }), actions.filter((action) => !action.hide).length > 0 && (jsx(Table.HeadCell, { align: "center", children: "Actions" }))] }) }), jsxs(Table.Body, { className: "relative", children: [isLoading && (jsx(Table.Row, { children: jsx(Table.Cell, { className: cn('z-10 h-full w-full p-0', {
1507
1529
  absolute: rows.length,
1508
1530
  }), colSpan: columnsLength, children: jsx(Spinner, { className: "bg-white/50 py-4 dark:bg-slate-700/50" }) }) })), !isLoading && !rows.length && (jsx(Table.Row, { children: jsx(Table.Cell, { colSpan: columnsLength, children: jsx(Flex, { className: "text-slate-500", justify: "center", children: noDataMessage !== null && noDataMessage !== void 0 ? noDataMessage : 'No data' }) }) })), rows.map((item, rowIndex) => [
1509
1531
  jsxs(Table.Row, { className: cn({
@@ -1511,7 +1533,7 @@ function DataTable({ className, columns, rows, sorting, pagination, actions = []
1511
1533
  }, rowClassName === null || rowClassName === void 0 ? void 0 : rowClassName(item, rowIndex)), onClick: handleRowClicked(item, rowIndex), children: [rowExtraContent && (jsx(Table.Cell, { className: "w-min", align: "center", children: jsx(ExpandButton, { folded: !expandedRows[rowExtraContent.idGetter(item)], foldComponent: MinusIcon, unfoldComponent: PlusIcon, onClick: handleExpandRow(rowExtraContent.idGetter(item)) }) })), _columns.map((column, columnIndex) => {
1512
1534
  var _a, _b, _c;
1513
1535
  return (jsx(Table.Cell, { className: column.className, align: (_a = column.align) !== null && _a !== void 0 ? _a : 'left', children: (_c = (_b = column.render) === null || _b === void 0 ? void 0 : _b.call(column, item, rowIndex)) !== null && _c !== void 0 ? _c : defaultRender(item, column.field) }, columnIndex));
1514
- }), actions.length > 0 && (jsx(Table.Cell, { className: "py-3", children: jsx(Flex, { align: "center", justify: "center", children: actions
1536
+ }), actions.filter((action) => !action.hide).length > 0 && (jsx(Table.Cell, { className: "py-3", children: jsx(Flex, { align: "center", justify: "center", children: actions
1515
1537
  .filter((action) => { var _a; return typeof action.hide === 'boolean' ? !action.hide : !((_a = action.hide) === null || _a === void 0 ? void 0 : _a.call(action, item)); })
1516
1538
  .map((action, actionIndex) => {
1517
1539
  var _a;
@@ -1784,4 +1806,4 @@ const ThemeSwitcher = ({ className }) => {
1784
1806
  } }));
1785
1807
  };
1786
1808
 
1787
- export { Badge, BasicInput, BasicInputExtension, Block, Button, Card, CheckboxInput, ConfirmDialog, DataTable, DateTimeInput, Dialog, DropdownMenu, EmailInput, Flex, FormDialog, FormGroup, FormInputs, Hint, Label, Layout, LayoutContext, LayoutContextProvider, List, ListSorter, ListSorterDialog, Navbar, NumberInput, Pagination, PasswordInput, PdfViewerDialog, Popover, SIDEBAR_KEY, SelectInput, Sidebar, Spinner, Switch, THEME_KEY, Table, Tabs, TextInput, TextareaInput, ThemeSwitcher, Tooltip, cn, compareDates, generalComparator, getDisplayDate, isEmpty, mergeRefs, resolveTargetObject, useDays, useLayoutContext, useLongPress, useMonths, useOnSwipe, useOutsideClick, usePagination };
1809
+ export { Badge, BasicInput, BasicInputExtension, Block, Button, Card, CheckboxInput, ConfirmDialog, DataTable, DateTimeInput, Dialog, DropdownMenu, EmailInput, FileInput, Flex, FormDialog, FormGroup, FormInputs, Hint, Label, Layout, LayoutContext, LayoutContextProvider, List, ListSorter, ListSorterDialog, Navbar, NumberInput, Pagination, PasswordInput, PdfViewerDialog, Popover, SIDEBAR_KEY, SelectInput, Sidebar, Spinner, Switch, THEME_KEY, Table, Tabs, TextInput, TextareaInput, ThemeSwitcher, Tooltip, cn, compareDates, generalComparator, getDisplayDate, isEmpty, mergeRefs, resolveTargetObject, useDays, useLayoutContext, useLongPress, useMonths, useOnSwipe, useOutsideClick, usePagination };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tw-react-components",
3
3
  "description": "A set of React components build with TailwindCSS to make a nice dashboard.",
4
- "version": "0.0.134",
4
+ "version": "0.0.136",
5
5
  "license": "MIT",
6
6
  "homepage": "https://bacali95.github.io/tw-react-components",
7
7
  "author": {
@@ -3,8 +3,8 @@ export type View = 'days' | 'months' | 'years';
3
3
  type DateSelectorProps = {
4
4
  date: Date;
5
5
  value?: string | Date | null;
6
- minDate?: Date;
7
- maxDate?: Date;
6
+ minDate?: Date | null;
7
+ maxDate?: Date | null;
8
8
  locale?: string;
9
9
  calendarView: View;
10
10
  setCalendarView: (view: View) => void;
@@ -4,8 +4,8 @@ type DaysViewProps = {
4
4
  value?: string | Date | null;
5
5
  month: number;
6
6
  year: number;
7
- minDate?: Date;
8
- maxDate?: Date;
7
+ minDate?: Date | null;
8
+ maxDate?: Date | null;
9
9
  locale?: string;
10
10
  setNewDate: (date: Date) => void;
11
11
  };
@@ -3,8 +3,8 @@ type MonthsViewProps = {
3
3
  date: Date;
4
4
  value?: string | Date | null;
5
5
  year: number;
6
- minDate?: Date;
7
- maxDate?: Date;
6
+ minDate?: Date | null;
7
+ maxDate?: Date | null;
8
8
  locale?: string;
9
9
  selectMonth: (month: number) => () => void;
10
10
  };
@@ -2,8 +2,8 @@ import { FC } from 'react';
2
2
  type TimeSelectorProps = {
3
3
  date: Date;
4
4
  step?: number;
5
- minDate?: Date;
6
- maxDate?: Date;
5
+ minDate?: Date | null;
6
+ maxDate?: Date | null;
7
7
  setNewDate: (date: Date) => void;
8
8
  };
9
9
  export declare const TimeSelector: FC<TimeSelectorProps>;
@@ -3,8 +3,8 @@ type YearsViewProps = {
3
3
  date: Date;
4
4
  value?: string | Date | null;
5
5
  years: number[];
6
- minDate?: Date;
7
- maxDate?: Date;
6
+ minDate?: Date | null;
7
+ maxDate?: Date | null;
8
8
  selectYear: (month: number) => () => void;
9
9
  };
10
10
  export declare const YearsView: FC<YearsViewProps>;
@@ -6,8 +6,8 @@ export type DateTimeInputProps = {
6
6
  hasErrors?: boolean;
7
7
  clearable?: boolean;
8
8
  step?: number;
9
- minDate?: Date;
10
- maxDate?: Date;
9
+ minDate?: Date | null;
10
+ maxDate?: Date | null;
11
11
  displayFormat?: string;
12
12
  displayLocale?: string;
13
13
  onChange?: (date?: Date | null) => void;
@@ -18,8 +18,8 @@ export declare const DateTimeInput: import("react").ForwardRefExoticComponent<{
18
18
  hasErrors?: boolean;
19
19
  clearable?: boolean;
20
20
  step?: number;
21
- minDate?: Date;
22
- maxDate?: Date;
21
+ minDate?: Date | null;
22
+ maxDate?: Date | null;
23
23
  displayFormat?: string;
24
24
  displayLocale?: string;
25
25
  onChange?: (date?: Date | null) => void;
@@ -0,0 +1,11 @@
1
+ import { BasicInputProps } from '../primitive';
2
+ export type FileInputProps = {
3
+ value?: string | null;
4
+ onChange?: (item?: string) => void;
5
+ onFileChange?: (file?: File) => void;
6
+ } & Pick<BasicInputProps<'text'>, 'className' | 'inputClassName' | 'extensionClassName' | 'name' | 'label' | 'placeholder' | 'description' | 'size' | 'accept' | 'required' | 'hasErrors' | 'disabled'>;
7
+ export declare const FileInput: import("react").ForwardRefExoticComponent<{
8
+ value?: string | null;
9
+ onChange?: (item?: string) => void;
10
+ onFileChange?: (file?: File) => void;
11
+ } & Pick<BasicInputProps<"text">, "size" | "label" | "accept" | "disabled" | "name" | "placeholder" | "required" | "className" | "inputClassName" | "extensionClassName" | "description" | "hasErrors"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,2 +1,3 @@
1
1
  export * from './date-time';
2
2
  export * from './select';
3
+ export * from './file';
@@ -30,7 +30,7 @@ export type SelectInputProps<T = any> = {
30
30
  multiple: true;
31
31
  value: T[];
32
32
  onChange?: (item?: T[]) => void;
33
- }) & Pick<BasicInputProps<'text'>, 'className' | 'inputClassName' | 'extensionClassName' | 'name' | 'label' | 'size' | 'placeholder' | 'required' | 'hasErrors' | 'disabled' | 'readOnly'>;
33
+ }) & Pick<BasicInputProps<'text'>, 'className' | 'inputClassName' | 'extensionClassName' | 'name' | 'label' | 'description' | 'size' | 'placeholder' | 'required' | 'hasErrors' | 'disabled' | 'readOnly'>;
34
34
  export declare const SelectInput: (<T>(props: SelectInputProps<T> & {
35
35
  ref?: ForwardedRef<HTMLDivElement>;
36
36
  }) => JSX.Element) & {
@@ -1,4 +1,3 @@
1
- import { LucideIcon } from 'lucide-react';
2
1
  import { ComponentProps, FC, MouseEvent, PropsWithChildren, ReactNode } from 'react';
3
2
  import { Size } from '../../../types';
4
3
  export type InputType = ComponentProps<'input'>['type'] | 'textarea';
@@ -11,7 +10,7 @@ export type BasicInputProps<Type extends InputType> = {
11
10
  size?: Size;
12
11
  hasErrors?: boolean;
13
12
  clearable?: boolean;
14
- suffixIcon?: LucideIcon;
13
+ suffixIcon?: FC<ComponentProps<'svg'>>;
15
14
  onClear?: () => void;
16
15
  onSuffixIconClick?: (event: MouseEvent<HTMLDivElement>) => void;
17
16
  } & Omit<Type extends 'textarea' ? ComponentProps<'textarea'> : ComponentProps<'input'>, 'id' | 'ref' | 'size'>;
@@ -24,7 +23,7 @@ export declare const BasicInput: import("react").ForwardRefExoticComponent<{
24
23
  size?: Size;
25
24
  hasErrors?: boolean;
26
25
  clearable?: boolean;
27
- suffixIcon?: LucideIcon;
26
+ suffixIcon?: FC<ComponentProps<"svg">>;
28
27
  onClear?: () => void;
29
28
  onSuffixIconClick?: (event: MouseEvent<HTMLDivElement>) => void;
30
29
  } & Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> | import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "id" | "ref" | "size"> & import("react").RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
@@ -1,3 +1,8 @@
1
+ import { ReactNode } from 'react';
1
2
  import { BasicInputProps } from './BasicInput';
2
- export type NumberInputProps = Omit<BasicInputProps<'number'>, 'type'>;
3
- export declare const NumberInput: import("react").ForwardRefExoticComponent<NumberInputProps & import("react").RefAttributes<HTMLInputElement>>;
3
+ export type NumberInputProps = Omit<BasicInputProps<'number'>, 'type'> & {
4
+ unit?: ReactNode;
5
+ };
6
+ export declare const NumberInput: import("react").ForwardRefExoticComponent<Omit<BasicInputProps<"number">, "type"> & {
7
+ unit?: ReactNode;
8
+ } & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,6 +1,6 @@
1
1
  import { ForwardRefExoticComponent } from 'react';
2
2
  import { ControllerRenderProps, Validate } from 'react-hook-form';
3
- import { DateTimeInputProps, DateTimeInputType, SelectInputProps, SelectInputType } from './custom';
3
+ import { DateTimeInputProps, DateTimeInputType, FileInputProps, SelectInputProps, SelectInputType } from './custom';
4
4
  import { BasicInputProps, CheckboxInputProps, EmailInputProps, InputType, NumberInputProps, PasswordInputProps, TextInputProps, TextareaInputProps } from './primitive';
5
5
  export type WithFormProps<Type extends InputType | SelectInputType, Props = Type extends DateTimeInputType ? DateTimeInputProps : Type extends SelectInputType ? SelectInputProps : Omit<BasicInputProps<Type>, 'type'>> = {
6
6
  name: string;
@@ -48,4 +48,9 @@ export declare const FormInputs: {
48
48
  pattern?: RegExp;
49
49
  validate?: Validate<any, any> | undefined;
50
50
  } & Omit<SelectInputProps, "pattern" | "ref" | "name" | "value" | "onChange" | "onBlur"> & import("react").RefAttributes<HTMLInputElement>>;
51
+ File: ForwardRefExoticComponent<{
52
+ name: string;
53
+ pattern?: RegExp;
54
+ validate?: Validate<string, any> | undefined;
55
+ } & Omit<FileInputProps, "pattern" | "ref" | "name" | "value" | "onChange" | "onBlur"> & import("react").RefAttributes<HTMLInputElement>>;
51
56
  };