@uxf/ui 10.5.2 → 10.7.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.
@@ -28,6 +28,7 @@ export interface SelectBaseProps<Value, Option> extends FormControlProps<Value |
28
28
  id?: string;
29
29
  keyExtractor?: (option: Option) => string | number;
30
30
  label: ReactNode;
31
+ onOptionsUnmount?: () => void;
31
32
  options?: Option[];
32
33
  placeholder?: string;
33
34
  renderOption?: (option: Option, isSelected: boolean) => ReactNode;
@@ -27,6 +27,7 @@ exports._SelectBase = void 0;
27
27
  const react_1 = require("@floating-ui/react");
28
28
  const classes_1 = require("@uxf/core/constants/classes");
29
29
  const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
30
+ const useOnUnmount_1 = require("@uxf/core/hooks/useOnUnmount");
30
31
  const composeRefs_1 = require("@uxf/core/utils/composeRefs");
31
32
  const cx_1 = require("@uxf/core/utils/cx");
32
33
  const use_dropdown_1 = require("@uxf/ui/hooks/use-dropdown");
@@ -34,6 +35,13 @@ const icon_1 = require("@uxf/ui/icon");
34
35
  const input_1 = require("@uxf/ui/input");
35
36
  const label_1 = require("@uxf/ui/label");
36
37
  const react_2 = __importStar(require("react"));
38
+ const Option = (props) => {
39
+ var _a, _b, _c, _d;
40
+ const optionKey = (_a = props.keyExtractor) === null || _a === void 0 ? void 0 : _a.call(props, props.option);
41
+ const HUIComponent = props.HUIComponent;
42
+ return (react_2.default.createElement(HUIComponent.Option, { className: (optionState) => (0, cx_1.cx)("uxf-dropdown__item", optionState.active && classes_1.CLASSES.IS_ACTIVE, optionState.disabled && classes_1.CLASSES.IS_DISABLED, optionState.selected && classes_1.CLASSES.IS_SELECTED), key: optionKey !== null && optionKey !== void 0 ? optionKey : props.option.id, value: props.option }, (_d = (_c = (_b = props.renderOption) === null || _b === void 0 ? void 0 : _b.call(props, props.option)) !== null && _c !== void 0 ? _c : optionKey) !== null && _d !== void 0 ? _d : props.option.label));
43
+ };
44
+ Option.displayName = "UxfUiSelectBaseOption";
37
45
  function isHUICombobox(HUIComponent) {
38
46
  return typeof HUIComponent.Input !== "undefined";
39
47
  }
@@ -53,13 +61,16 @@ const InputArrow = (props) => {
53
61
  const Options = (props) => {
54
62
  var _a, _b;
55
63
  const HUIComponent = props.HUIComponent;
64
+ (0, useOnUnmount_1.useOnUnmount)(() => {
65
+ var _a;
66
+ (_a = props.onUnmount) === null || _a === void 0 ? void 0 : _a.call(props);
67
+ });
56
68
  return (react_2.default.createElement(HUIComponent.Options, { className: (0, cx_1.cx)("uxf-dropdown uxf-select-base__options", `uxf-dropdown--size-${(_a = props.size) !== null && _a !== void 0 ? _a : "default"}`, `uxf-dropdown--variant-${(_b = props.variant) !== null && _b !== void 0 ? _b : "default"}`, props.matchWidth
57
69
  ? "uxf-select-base__options--match-width"
58
70
  : "uxf-select-base__options--not-match-width", props.placement === "bottom" && "uxf-dropdown--bottom", props.placement === "top" && "uxf-dropdown--top", props.className), ref: props.forwardRef, static: true, style: props.style }, props.options && props.options.length > 0 ? (props.options.map((option) => {
59
71
  var _a;
60
72
  const optionKey = (_a = props.keyExtractor) === null || _a === void 0 ? void 0 : _a.call(props, option);
61
- const _option = option;
62
- return (react_2.default.createElement(HUIComponent.Option, { disabled: _option.disabled, className: (optionState) => (0, cx_1.cx)("uxf-dropdown__item", optionState.active && classes_1.CLASSES.IS_ACTIVE, optionState.disabled && classes_1.CLASSES.IS_DISABLED, optionState.selected && classes_1.CLASSES.IS_SELECTED), key: optionKey !== null && optionKey !== void 0 ? optionKey : _option.id, value: option }, (optionState) => { var _a, _b; return (_b = (_a = props.renderOption) === null || _a === void 0 ? void 0 : _a.call(props, option, optionState.selected)) !== null && _b !== void 0 ? _b : option.label; }));
73
+ return (react_2.default.createElement(Option, { key: optionKey, keyExtractor: props.keyExtractor, option: option, HUIComponent: HUIComponent }));
63
74
  })) : (react_2.default.createElement("div", { className: "uxf-dropdown__empty-wrapper" }, props.emptyMessage))));
64
75
  };
65
76
  Options.displayName = "UxfUiSelectBaseOptions";
@@ -91,7 +102,7 @@ const _SelectBase = (props) => {
91
102
  react_2.default.createElement(InputArrow, { iconName: props.iconName, open: renderProps.open }))) : (react_2.default.createElement(InputArrow, { iconName: props.iconName, open: renderProps.open }))),
92
103
  props.rightAddon && react_2.default.createElement(input_1.Input.RightAddon, null, props.rightAddon)),
93
104
  renderProps.open && (react_2.default.createElement(react_1.FloatingPortal, null,
94
- react_2.default.createElement(Options, { HUIComponent: HUIComponent, className: props.dropdownClassName, emptyMessage: props.emptyMessage, forwardRef: dropdown.refs.setFloating, keyExtractor: props.keyExtractor, matchWidth: props.dropdownMatchesInputWidth, options: props.options, placement: dropdown.placement, renderOption: props.renderOption, size: props.size, style: dropdown.floatingStyles, variant: props.variant }))),
105
+ react_2.default.createElement(Options, { HUIComponent: HUIComponent, className: props.dropdownClassName, emptyMessage: props.emptyMessage, forwardRef: dropdown.refs.setFloating, keyExtractor: props.keyExtractor, matchWidth: props.dropdownMatchesInputWidth, onUnmount: props.onOptionsUnmount, options: props.options, placement: dropdown.placement, renderOption: props.renderOption, size: props.size, style: dropdown.floatingStyles, variant: props.variant }))),
95
106
  props.helperText && (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID), id: errorId }, props.helperText)))))));
96
107
  };
97
108
  exports._SelectBase = _SelectBase;
@@ -36,7 +36,7 @@ const button_1 = require("../button");
36
36
  const form_component_1 = require("../form-component");
37
37
  const icon_1 = require("../icon");
38
38
  exports.AvatarFileInput = (0, react_1.forwardRef)((props, ref) => {
39
- var _a, _b, _c, _d, _e;
39
+ var _a, _b, _c, _d, _e, _f;
40
40
  const generatedId = (0, react_1.useId)();
41
41
  const id = props.id || generatedId;
42
42
  const innerRef = (0, react_1.useRef)(null);
@@ -49,14 +49,14 @@ exports.AvatarFileInput = (0, react_1.forwardRef)((props, ref) => {
49
49
  return (react_1.default.createElement(form_component_1.FormComponent, { className: rootClassName, errorId: props.id, helperText: props.helperText, hiddenLabel: props.hiddenLabel, inputId: id, label: props.label },
50
50
  react_1.default.createElement("div", { className: "uxf-avatar-file-input__inner-wrapper" },
51
51
  react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-avatar-file-input__input", stateClassName), onClick: onSelectFile },
52
- react_1.default.createElement(_file_input_base_1._FileInputBase, { accept: props.accept, "aria-describedby": errorId, "aria-invalid": props.isInvalid, className: "uxf-avatar-file-input__input-element", form: props.form, id: id, isDisabled: props.isDisabled, isFocused: props.isFocused, isInvalid: props.isInvalid, isReadOnly: props.isReadOnly, isRequired: props.isRequired, name: props.name, onBlur: input.onBlur, onFocus: input.onFocus, onChange: props.onChange, onUploadError: props.onUploadError, onUploadFile: props.onUploadFile, ref: (0, composeRefs_1.composeRefs)(innerRef, ref), value: props.value }),
52
+ react_1.default.createElement(_file_input_base_1._FileInputBase, { accept: (_c = props.accept) !== null && _c !== void 0 ? _c : "image/*", "aria-describedby": errorId, "aria-invalid": props.isInvalid, className: "uxf-avatar-file-input__input-element", form: props.form, id: id, isDisabled: props.isDisabled, isFocused: props.isFocused, isInvalid: props.isInvalid, isReadOnly: props.isReadOnly, isRequired: props.isRequired, name: props.name, onBlur: input.onBlur, onFocus: input.onFocus, onChange: props.onChange, onUploadError: props.onUploadError, onUploadFile: props.onUploadFile, ref: (0, composeRefs_1.composeRefs)(innerRef, ref), value: props.value }),
53
53
  props.value ? (react_1.default.createElement(avatar_1.Avatar, { className: "uxf-avatar-file-input__input-avatar", src: (0, file_1.getFileUrl)(props.value) })) : (react_1.default.createElement("div", { className: "uxf-avatar-file-input__input-empty" },
54
- react_1.default.createElement(icon_1.Icon, { className: "uxf-avatar-file-input__input-empty-icon", name: (_c = props.icon) !== null && _c !== void 0 ? _c : "cloud" })))),
54
+ react_1.default.createElement(icon_1.Icon, { className: "uxf-avatar-file-input__input-empty-icon", name: (_d = props.icon) !== null && _d !== void 0 ? _d : "cloud" })))),
55
55
  react_1.default.createElement("div", { className: "uxf-avatar-file-input__controls" }, props.customControls ? (props.customControls({
56
56
  onSelectFile,
57
57
  onRemoveFile,
58
58
  })) : (react_1.default.createElement("div", { className: "uxf-avatar-file-input__controls-buttons" },
59
- react_1.default.createElement(button_1.Button, { className: "uxf-avatar-file-input__controls-button uxf-avatar-file-input__controls-button--select", disabled: props.isDisabled, onClick: onSelectFile, size: "sm", variant: "white" }, (_d = props.selectFileLabel) !== null && _d !== void 0 ? _d : "Upload image"),
60
- !!props.value && !props.isDisabled && (react_1.default.createElement(button_1.Button, { className: "uxf-avatar-file-input__controls-button uxf-avatar-file-input__controls-button--remove", color: "error", disabled: props.isDisabled, onClick: onRemoveFile, size: "sm", variant: "white" }, (_e = props.removeFileLabel) !== null && _e !== void 0 ? _e : "Remove avatar"))))))));
59
+ react_1.default.createElement(button_1.Button, { className: "uxf-avatar-file-input__controls-button uxf-avatar-file-input__controls-button--select", disabled: props.isDisabled, onClick: onSelectFile, size: "sm", variant: "white" }, (_e = props.selectFileLabel) !== null && _e !== void 0 ? _e : "Upload image"),
60
+ !!props.value && !props.isDisabled && (react_1.default.createElement(button_1.Button, { className: "uxf-avatar-file-input__controls-button uxf-avatar-file-input__controls-button--remove", color: "error", disabled: props.isDisabled, onClick: onRemoveFile, size: "sm", variant: "white" }, (_f = props.removeFileLabel) !== null && _f !== void 0 ? _f : "Remove avatar"))))))));
61
61
  });
62
62
  exports.AvatarFileInput.displayName = "UxfUiAvatarFileInput";
@@ -38,11 +38,12 @@ const Combobox = (props) => {
38
38
  const emptyMessage = query.length === 0
39
39
  ? (_b = props.noQueryMessage) !== null && _b !== void 0 ? _b : "Pro zobrazení možností začněte psát"
40
40
  : (_c = props.notFoundMessage) !== null && _c !== void 0 ? _c : "Nic nenalezeno";
41
+ const clearQuery = () => setQuery("");
41
42
  const onChange = (v) => props.onChange(v);
42
43
  const onInputChange = (event) => setQuery(event.target.value);
43
44
  const displayValue = (item) => { var _a; return (_a = item === null || item === void 0 ? void 0 : item.label) !== null && _a !== void 0 ? _a : ""; };
44
45
  const selectedOption = (_d = props.value) !== null && _d !== void 0 ? _d : null;
45
- return (react_2.default.createElement(_select_base_1._SelectBase, { HUIComponent: react_1.Combobox, className: props.className, customInputElementDisplayName: react_1.Combobox.Input.displayName, dropdownClassName: props.dropdownClassName, dropdownMatchesInputWidth: props.dropdownMatchesInputWidth, dropdownPlacement: props.dropdownPlacement, dropdownStrategy: props.dropdownStrategy, emptyMessage: emptyMessage, forwardRef: props.forwardRef, helperText: props.helperText, hiddenLabel: props.hiddenLabel, iconName: props.iconName, id: props.id, isClearable: props.isClearable, isDisabled: props.isDisabled, isFocused: props.isFocused, isInvalid: props.isInvalid, isReadOnly: props.isReadOnly, isRequired: props.isRequired, keyExtractor: props.keyExtractor, label: props.label, leftAddon: props.leftAddon, leftElement: props.leftElement, name: props.name, onBlur: props.onBlur, onChange: onChange, onFocus: props.onFocus, options: filteredData, placeholder: props.placeholder, renderOption: props.renderOption, rightAddon: props.rightAddon, rightElement: props.rightElement, size: props.size, value: selectedOption, variant: props.variant },
46
+ return (react_2.default.createElement(_select_base_1._SelectBase, { HUIComponent: react_1.Combobox, className: props.className, customInputElementDisplayName: react_1.Combobox.Input.displayName, dropdownClassName: props.dropdownClassName, dropdownMatchesInputWidth: props.dropdownMatchesInputWidth, dropdownPlacement: props.dropdownPlacement, dropdownStrategy: props.dropdownStrategy, emptyMessage: emptyMessage, forwardRef: props.forwardRef, helperText: props.helperText, hiddenLabel: props.hiddenLabel, iconName: props.iconName, id: props.id, isClearable: props.isClearable, isDisabled: props.isDisabled, isFocused: props.isFocused, isInvalid: props.isInvalid, isReadOnly: props.isReadOnly, isRequired: props.isRequired, keyExtractor: props.keyExtractor, label: props.label, leftAddon: props.leftAddon, leftElement: props.leftElement, name: props.name, onBlur: props.onBlur, onChange: onChange, onFocus: props.onFocus, onOptionsUnmount: clearQuery, options: filteredData, placeholder: props.placeholder, renderOption: props.renderOption, rightAddon: props.rightAddon, rightElement: props.rightElement, size: props.size, value: selectedOption, variant: props.variant },
46
47
  react_2.default.createElement(react_1.Combobox.Input, { autoComplete: "off", className: "uxf-input__element", displayValue: displayValue, onBlur: props.onBlur, onChange: onInputChange, placeholder: props.placeholder, type: "text" })));
47
48
  };
48
49
  exports.Combobox = Combobox;
@@ -4,11 +4,13 @@ export declare const ALLOWED_DATE_FORMAT: string[];
4
4
  export declare const DISPLAY_DATE_FORMAT = "D. M. YYYY";
5
5
  export declare const OUTPUT_DATE_FORMAT = "YYYY-MM-DD";
6
6
  export interface DatePickerInputProps extends Omit<InputWithPopoverProps<string | null>, "children" | "placeholder" | "triggerElement"> {
7
+ allowedDateFormats?: string[];
8
+ bottomContent?: ReactNode;
9
+ displayDateFormat?: string;
10
+ maxDate?: string;
11
+ minDate?: string;
7
12
  placeholder?: string;
8
13
  triggerElement?: ReactNode;
9
- minDate?: string;
10
- maxDate?: string;
11
14
  unavailableDates?: Date[];
12
- bottomContent?: ReactNode;
13
15
  }
14
16
  export declare const DatePickerInput: React.ForwardRefExoticComponent<DatePickerInputProps & React.RefAttributes<HTMLInputElement>>;
@@ -38,10 +38,10 @@ const icon_1 = require("../icon");
38
38
  exports.ALLOWED_DATE_FORMAT = ["D. M. YYYY", "DD. MM. YYYY", "D.M.YYYY", "DD.MM.YYYY"];
39
39
  exports.DISPLAY_DATE_FORMAT = "D. M. YYYY";
40
40
  exports.OUTPUT_DATE_FORMAT = "YYYY-MM-DD";
41
- function getValue(value) {
41
+ function getValue(value, format) {
42
42
  const parsedValue = (0, dayjs_1.default)(value, exports.OUTPUT_DATE_FORMAT, true);
43
43
  if (value && parsedValue.isValid()) {
44
- return parsedValue.format(exports.DISPLAY_DATE_FORMAT);
44
+ return parsedValue.format(format);
45
45
  }
46
46
  return value !== null && value !== void 0 ? value : "";
47
47
  }
@@ -60,26 +60,28 @@ function getBoundaryDate(value) {
60
60
  return undefined;
61
61
  }
62
62
  exports.DatePickerInput = (0, react_1.forwardRef)((props, ref) => {
63
- var _a, _b;
63
+ var _a, _b, _c, _d;
64
64
  const onChange = props.onChange;
65
65
  const className = (0, cx_1.cx)("uxf-date-picker-input", props.className);
66
+ const displayDateFormat = (_a = props.displayDateFormat) !== null && _a !== void 0 ? _a : exports.DISPLAY_DATE_FORMAT;
67
+ const allowedDateFormats = (_b = props.allowedDateFormats) !== null && _b !== void 0 ? _b : exports.ALLOWED_DATE_FORMAT;
66
68
  const onInputChange = (0, react_1.useCallback)((value) => {
67
- const parsedValue = (0, dayjs_1.default)(value, exports.ALLOWED_DATE_FORMAT, true);
69
+ const parsedValue = (0, dayjs_1.default)(value, allowedDateFormats, true);
68
70
  if (value !== "" && parsedValue.isValid()) {
69
71
  onChange(parsedValue.format(exports.OUTPUT_DATE_FORMAT));
70
72
  }
71
73
  else {
72
74
  onChange(value === "" ? null : value);
73
75
  }
74
- }, [onChange]);
76
+ }, [allowedDateFormats, onChange]);
75
77
  const onDatePickerChange = (0, react_1.useCallback)((value) => {
76
78
  const parsedValue = (0, dayjs_1.default)(value);
77
79
  onChange(value ? parsedValue.format(exports.OUTPUT_DATE_FORMAT) : null);
78
80
  }, [onChange]);
79
- const value = getValue(props.value);
81
+ const value = getValue(props.value, displayDateFormat);
80
82
  const selectedDate = getSelectedDate(props.value);
81
83
  const parsedMinDate = getBoundaryDate(props.minDate);
82
84
  const parsedMaxDate = getBoundaryDate(props.maxDate);
83
- return (react_1.default.createElement(_input_with_popover_1._InputWithPopover, { ...props, className: className, onChange: onInputChange, placeholder: (_a = props.placeholder) !== null && _a !== void 0 ? _a : (0, dayjs_1.default)().format(exports.DISPLAY_DATE_FORMAT), ref: ref, value: value, triggerElement: (_b = props.triggerElement) !== null && _b !== void 0 ? _b : react_1.default.createElement(icon_1.Icon, { name: "calendar", size: 20 }) }, ({ close }) => (react_1.default.createElement(date_picker_1.DatePicker, { minDate: parsedMinDate, maxDate: parsedMaxDate, closePopoverHandler: close, onChange: onDatePickerChange, preventScroll: true, selectedDate: selectedDate, unavailableDates: props.unavailableDates, bottomContent: props.bottomContent }))));
85
+ return (react_1.default.createElement(_input_with_popover_1._InputWithPopover, { ...props, className: className, onChange: onInputChange, placeholder: (_c = props.placeholder) !== null && _c !== void 0 ? _c : (0, dayjs_1.default)().format(displayDateFormat), ref: ref, value: value, triggerElement: (_d = props.triggerElement) !== null && _d !== void 0 ? _d : react_1.default.createElement(icon_1.Icon, { name: "calendar", size: 20 }) }, ({ close }) => (react_1.default.createElement(date_picker_1.DatePicker, { minDate: parsedMinDate, maxDate: parsedMaxDate, closePopoverHandler: close, onChange: onDatePickerChange, preventScroll: true, selectedDate: selectedDate, unavailableDates: props.unavailableDates, bottomContent: props.bottomContent }))));
84
86
  });
85
87
  exports.DatePickerInput.displayName = "UxfUiDatePickerInput";
@@ -41,7 +41,8 @@ function Default() {
41
41
  react_1.default.createElement(date_picker_input_1.DatePickerInput, { id: "date-test-disabled", isDisabled: true, label: "Datum disabled", name: "date-disabled", onChange: onChange, value: date }),
42
42
  react_1.default.createElement(date_picker_input_1.DatePickerInput, { id: "date-test-readonly", isReadOnly: true, label: "Datum readonly", name: "date-readonly", onChange: onChange, value: date }),
43
43
  react_1.default.createElement(date_picker_input_1.DatePickerInput, { id: "date-test-invalid", isClearable: true, isInvalid: true, label: "Datum invalid", name: "date-invalid", onChange: onChange, value: date }),
44
- react_1.default.createElement(date_picker_input_1.DatePickerInput, { id: "date-test-invalid", isClearable: true, minDate: "2023-06-06", maxDate: "2023-06-12", label: "Min/max", name: "date-invalid", onChange: onChange, placeholder: "", value: date })));
44
+ react_1.default.createElement(date_picker_input_1.DatePickerInput, { id: "date-test-invalid", isClearable: true, minDate: "2023-06-06", maxDate: "2023-06-12", label: "Min/max", name: "date-invalid", onChange: onChange, placeholder: "", value: date }),
45
+ react_1.default.createElement(date_picker_input_1.DatePickerInput, { allowedDateFormats: ["MM/DD/YYYY", "M/D/YYYY"], displayDateFormat: "MM/DD/YYYY", id: "date-custom-format", isClearable: true, label: "Datum s vlastn\u00EDm form\u00E1tem (US)", name: "date", onChange: onChange, value: date })));
45
46
  return (react_1.default.createElement(react_1.default.Fragment, null,
46
47
  react_1.default.createElement("div", { className: "light max-w-[640px] space-y-4 rounded bg-white p-8" }, testDatePickers),
47
48
  react_1.default.createElement("div", { className: "dark max-w-[640px] space-y-4 rounded bg-gray-900 p-8 text-white" }, testDatePickers)));
@@ -4,6 +4,7 @@ import { IconName } from "../icon/types";
4
4
  import { Accept, DropzoneFile } from "./types";
5
5
  export interface DropzoneInputProps extends FormControlProps<DropzoneFile[] | undefined> {
6
6
  accept?: Accept;
7
+ className?: string;
7
8
  helperText?: ReactNode;
8
9
  icon?: IconName;
9
10
  id?: string;
@@ -63,9 +63,10 @@ function fileRejectedHandler(err, dropzoneFile, onValuesChange, values, onUpload
63
63
  }
64
64
  }
65
65
  exports.DropzoneInput = (0, react_1.forwardRef)((props, ref) => {
66
- var _a;
66
+ var _a, _b;
67
67
  const refValue = (0, react_1.useRef)();
68
68
  refValue.current = props.value;
69
+ const inputRef = (0, react_1.useRef)(null);
69
70
  const handleFileDrop = async (acceptedFiles) => {
70
71
  const files = acceptedFiles.map((file) => ({
71
72
  ...fileToFileResponse(file),
@@ -77,6 +78,11 @@ exports.DropzoneInput = (0, react_1.forwardRef)((props, ref) => {
77
78
  const onChange = (values) => {
78
79
  props.onChange(values);
79
80
  refValue.current = values;
81
+ // this ensures that the input is cleared after the upload, so there is no problem with uploading the same file again
82
+ const inputNode = inputRef.current;
83
+ if (inputNode) {
84
+ inputNode.value = "";
85
+ }
80
86
  };
81
87
  for (const file of files) {
82
88
  if (!file.originalFile) {
@@ -107,19 +113,19 @@ exports.DropzoneInput = (0, react_1.forwardRef)((props, ref) => {
107
113
  const labelOnCLick = (e) => {
108
114
  e.stopPropagation();
109
115
  };
110
- return (react_1.default.createElement("div", { className: "uxf-dropzone" },
116
+ return (react_1.default.createElement("div", { className: `uxf-dropzone ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` },
111
117
  react_1.default.createElement("label", { ...getRootProps({
112
118
  className: (0, cx_1.cx)("uxf-dropzone__label", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.noClick && "cursor-auto"),
113
119
  onClick: labelOnCLick,
114
120
  }), ref: (0, composeRefs_1.composeRefs)(ref, rootRef) },
115
- react_1.default.createElement(icon_1.Icon, { className: "uxf-dropzone__label__icon", name: (_a = props.icon) !== null && _a !== void 0 ? _a : "cloud" }),
121
+ react_1.default.createElement(icon_1.Icon, { className: "uxf-dropzone__label__icon", name: (_b = props.icon) !== null && _b !== void 0 ? _b : "cloud" }),
116
122
  typeof props.label === "string" ? react_1.default.createElement("span", null, props.label) : props.label,
117
123
  react_1.default.createElement("input", { ...getInputProps({
118
124
  className: "uxf-dropzone__input",
119
125
  id: props.id,
120
126
  name: props.name,
121
127
  type: "file",
122
- }) })),
128
+ }), ref: inputRef })),
123
129
  props.helperText && (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID) }, props.helperText))));
124
130
  });
125
131
  exports.DropzoneInput.displayName = "UxfUiDropzoneInput";
@@ -2,6 +2,7 @@ import { FormControlProps } from "@uxf/ui/types";
2
2
  import { FC, ReactNode } from "react";
3
3
  import { DropzoneFile } from "./types";
4
4
  export interface DropzoneListProps extends FormControlProps<DropzoneFile[] | undefined> {
5
+ className?: string;
5
6
  errorText?: string;
6
7
  onAbortWarning?: string;
7
8
  onRemoveWarning?: string;
@@ -40,7 +40,7 @@ function formatBytes(bytes, decimals = 2) {
40
40
  return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
41
41
  }
42
42
  const DropzoneList = (props) => {
43
- var _a, _b;
43
+ var _a, _b, _c;
44
44
  const context = (0, react_1.useContext)(context_1.UiContext);
45
45
  const onRemove = (file, isUploading) => () => {
46
46
  var _a;
@@ -58,7 +58,7 @@ const DropzoneList = (props) => {
58
58
  if (((_a = props.value) === null || _a === void 0 ? void 0 : _a.length) === 0) {
59
59
  return null;
60
60
  }
61
- return (react_1.default.createElement("ul", { className: "uxf-dropzone-list" }, (_b = props.value) === null || _b === void 0 ? void 0 : _b.map((file) => {
61
+ return (react_1.default.createElement("ul", { className: `uxf-dropzone-list ${(_b = props.className) !== null && _b !== void 0 ? _b : ""}` }, (_c = props.value) === null || _c === void 0 ? void 0 : _c.map((file) => {
62
62
  var _a, _b, _c;
63
63
  const isUploading = file.id < 0 && !file.error;
64
64
  return ((_b = (_a = props.renderItem) === null || _a === void 0 ? void 0 : _a.call(props, file)) !== null && _b !== void 0 ? _b : (react_1.default.createElement("li", { className: "uxf-dropzone-list__item-wrapper", key: file.id },
@@ -52,6 +52,10 @@ function handleInputKeyDownRecursion(selectedOptions, onRemove) {
52
52
  onRemove(lastSelectedOption.id);
53
53
  }
54
54
  }
55
+ const OptionElement = (props) => {
56
+ return (react_3.default.createElement(react_2.Combobox.Option, { className: (optionState) => (0, cx_1.cx)("uxf-dropdown__item", optionState.active && props.withoutPopover && classes_1.CLASSES.IS_ACTIVE, optionState.disabled && classes_1.CLASSES.IS_DISABLED, optionState.selected && classes_1.CLASSES.IS_SELECTED), value: props.option }, (optionState) => (react_3.default.createElement(react_3.default.Fragment, null, props.withCheckboxes ? (react_3.default.createElement(checkbox_input_1.CheckboxInput, { isDisabled: optionState.disabled, isFocused: optionState.active, label: props.label, onChange: props.handleCheckboxChange, value: optionState.selected })) : (props.label)))));
57
+ };
58
+ OptionElement.displayName = "UxfUiMultiComboboxOption";
55
59
  exports._MultiComboboxBase = (0, react_3.forwardRef)((props, ref) => {
56
60
  var _a, _b, _c, _d, _e, _f, _g;
57
61
  const isAsync = !!props.loadOptions;
@@ -120,7 +124,7 @@ exports._MultiComboboxBase = (0, react_3.forwardRef)((props, ref) => {
120
124
  react_3.default.createElement(react_2.Combobox.Options, { className: (0, cx_1.cx)("uxf-dropdown", `uxf-dropdown--size-${(_a = props.size) !== null && _a !== void 0 ? _a : "default"}`, `uxf-dropdown--variant-${(_b = props.variant) !== null && _b !== void 0 ? _b : "default"}`, dropdown.placement === "bottom" && "uxf-dropdown--bottom", dropdown.placement === "top" && "uxf-dropdown--top"), ref: dropdown.refs.setFloating, static: true, style: dropdown.floatingStyles }, filteredData.length > 0 ? (filteredData.map((option) => {
121
125
  var _a, _b, _c, _d;
122
126
  const label = (_b = (_a = props.renderOption) === null || _a === void 0 ? void 0 : _a.call(props, option)) !== null && _b !== void 0 ? _b : option.label;
123
- return (react_3.default.createElement(react_2.Combobox.Option, { className: (optionState) => (0, cx_1.cx)("uxf-dropdown__item", optionState.active && withoutPopover && classes_1.CLASSES.IS_ACTIVE, optionState.disabled && classes_1.CLASSES.IS_DISABLED, optionState.selected && classes_1.CLASSES.IS_SELECTED), disabled: option.disabled, key: (_d = (_c = props.keyExtractor) === null || _c === void 0 ? void 0 : _c.call(props, option)) !== null && _d !== void 0 ? _d : option.id, value: option }, (optionState) => (react_3.default.createElement(react_3.default.Fragment, null, props.withCheckboxes ? (react_3.default.createElement(checkbox_input_1.CheckboxInput, { isDisabled: optionState.disabled, isFocused: optionState.active, label: label, onChange: handleCheckboxChange(option.id), value: optionState.selected })) : (label)))));
127
+ return (react_3.default.createElement(OptionElement, { option: option, key: (_d = (_c = props.keyExtractor) === null || _c === void 0 ? void 0 : _c.call(props, option)) !== null && _d !== void 0 ? _d : option.id, label: label, handleCheckboxChange: handleCheckboxChange(option.id), withCheckboxes: props.withCheckboxes, withoutPopover: withoutPopover }));
124
128
  })) : (react_3.default.createElement("div", { className: "uxf-dropdown__empty-wrapper" }, emptyMessage))))),
125
129
  props.helperText && withoutPopover && (react_3.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID), id: props.errorId }, props.helperText))));
126
130
  return (react_3.default.createElement(react_3.default.Fragment, null, withoutPopover ? (react_3.default.createElement(react_3.default.Fragment, null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/ui",
3
- "version": "10.5.2",
3
+ "version": "10.7.0",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public"