@homecode/ui 5.0.1 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -12,6 +12,7 @@ export { DatePickerInput } from './src/components/DatePickerInput/DatePickerInpu
12
12
  export { DateTime, formatDate } from './src/components/DateTime/DateTime.js';
13
13
  export { Dialogue } from './src/components/Dialogue/Dialogue.js';
14
14
  export { Draggable } from './src/components/Draggable/Draggable.js';
15
+ export { DropZone } from './src/components/DropZone/DropZone.js';
15
16
  export { Expand } from './src/components/Expand/Expand.js';
16
17
  export { Flex } from './src/components/Flex/Flex.js';
17
18
  export { Form } from './src/components/Form/Form.js';
@@ -36,6 +36,7 @@ import '../DatePickerInput/DatePickerInput.styl.js';
36
36
  import '../Dialogue/Dialogue.js';
37
37
  import '../../tools/queryParams.js';
38
38
  import '../Draggable/Draggable.styl.js';
39
+ import '../DropZone/DropZone.styl.js';
39
40
  import '../Expand/Expand.styl.js';
40
41
  import '../Flex/Flex.styl.js';
41
42
  import '../Form/Form.styl.js';
@@ -0,0 +1,112 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useState, useRef, useCallback, useEffect } from 'react';
3
+ import cn from 'classnames';
4
+ import { generateUID } from '../../tools/uid.js';
5
+ import S from './DropZone.styl.js';
6
+
7
+ function matchesAcceptPart(file, part) {
8
+ const p = part.trim().toLowerCase();
9
+ if (!p)
10
+ return false;
11
+ if (p.startsWith('.')) {
12
+ return file.name.toLowerCase().endsWith(p);
13
+ }
14
+ if (p.includes('/')) {
15
+ const t = file.type.toLowerCase();
16
+ if (p.endsWith('/*')) {
17
+ const prefix = p.slice(0, -1);
18
+ return t.startsWith(prefix);
19
+ }
20
+ return t === p;
21
+ }
22
+ return false;
23
+ }
24
+ function matchesAccept(file, accept) {
25
+ const trimmed = accept.trim();
26
+ if (!trimmed)
27
+ return true;
28
+ const parts = trimmed
29
+ .split(',')
30
+ .map(s => s.trim())
31
+ .filter(Boolean);
32
+ if (parts.length === 0)
33
+ return true;
34
+ return parts.some(part => matchesAcceptPart(file, part));
35
+ }
36
+ function DropZone(props) {
37
+ const { accept, label, error, disabled = false, ghost = false, id, className, } = props;
38
+ const [isDragging, setIsDragging] = useState(false);
39
+ const dropAreaRef = useRef(null);
40
+ const fallbackInputIdRef = useRef(generateUID());
41
+ const inputId = id ?? fallbackInputIdRef.current;
42
+ const handleDrop = useCallback((e) => {
43
+ e.preventDefault();
44
+ setIsDragging(false);
45
+ if (disabled)
46
+ return;
47
+ const list = Array.from(e.dataTransfer.files).filter(f => matchesAccept(f, accept));
48
+ if (props.multiple === true) {
49
+ if (list.length > 0) {
50
+ props.onFiles(list);
51
+ }
52
+ }
53
+ else {
54
+ const file = list[0];
55
+ if (file) {
56
+ props.onFile(file);
57
+ }
58
+ }
59
+ }, [accept, disabled, props]);
60
+ const handleFileInput = useCallback((e) => {
61
+ if (disabled)
62
+ return;
63
+ const raw = e.target.files;
64
+ if (!raw?.length)
65
+ return;
66
+ const list = Array.from(raw).filter(f => matchesAccept(f, accept));
67
+ if (props.multiple === true) {
68
+ if (list.length > 0) {
69
+ props.onFiles(list);
70
+ }
71
+ }
72
+ else {
73
+ const file = list[0];
74
+ if (file) {
75
+ props.onFile(file);
76
+ }
77
+ }
78
+ e.target.value = '';
79
+ }, [accept, disabled, props]);
80
+ useEffect(() => {
81
+ const dialog = dropAreaRef.current?.closest('[role="dialog"]');
82
+ const targetElement = dialog || document.body;
83
+ const handleGlobalDragOver = (e) => {
84
+ e.preventDefault();
85
+ setIsDragging(true);
86
+ };
87
+ const handleGlobalDragLeave = (e) => {
88
+ if (!e.relatedTarget ||
89
+ !targetElement.contains(e.relatedTarget)) {
90
+ setIsDragging(false);
91
+ }
92
+ };
93
+ const handleGlobalDrop = () => {
94
+ setIsDragging(false);
95
+ };
96
+ targetElement.addEventListener('dragover', handleGlobalDragOver);
97
+ targetElement.addEventListener('dragleave', handleGlobalDragLeave);
98
+ targetElement.addEventListener('drop', handleGlobalDrop);
99
+ return () => {
100
+ targetElement.removeEventListener('dragover', handleGlobalDragOver);
101
+ targetElement.removeEventListener('dragleave', handleGlobalDragLeave);
102
+ targetElement.removeEventListener('drop', handleGlobalDrop);
103
+ };
104
+ }, []);
105
+ const shouldShowDropArea = !ghost || isDragging;
106
+ const multiple = props.multiple === true;
107
+ return (jsxs("div", { className: cn(S.root, className), children: [shouldShowDropArea && (jsxs("div", { ref: dropAreaRef, className: cn(S.dropArea, isDragging && S.isDragging, disabled && S.disabled), onDrop: handleDrop, children: [jsx("input", { type: "file", accept: accept, multiple: multiple, onChange: handleFileInput, className: S.fileInput, id: inputId, disabled: disabled }), jsx("label", { htmlFor: inputId, className: S.label, style: {
108
+ cursor: disabled ? 'not-allowed' : 'pointer',
109
+ }, children: label })] })), error && jsx("div", { className: S.error, children: error })] }));
110
+ }
111
+
112
+ export { DropZone };
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = ".DropZone_root__gk-Ef{display:flex;flex-direction:column;gap:var(--p-2)}.DropZone_dropArea__u-8Ye{background-color:var(--accent-color-alpha-100);border:2px dashed var(--decent-color-alpha-200);border-radius:var(--p-4);cursor:pointer;padding:var(--p-4);position:relative;text-align:center;transition:all .2s ease}.DropZone_dropArea__u-8Ye label:before{border-radius:var(--p-4);content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.DropZone_dropArea__u-8Ye.DropZone_isDragging__S-aQp,.DropZone_dropArea__u-8Ye:hover:not(.DropZone_disabled__qsAf6){border:2px dashed var(--active-color-alpha-500)}.DropZone_dropArea__u-8Ye:hover:not(.DropZone_disabled__qsAf6){background-color:var(--accent-color-alpha-50)}.DropZone_dropArea__u-8Ye.DropZone_isDragging__S-aQp{align-items:center;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background-color:var(--decent-color-alpha-900)!important;display:flex;height:calc(100% - var(--p-2));justify-content:center;left:var(--p-1);position:fixed;top:var(--p-1);width:calc(100% - var(--p-2));z-index:9999}.DropZone_dropArea__u-8Ye.DropZone_disabled__qsAf6{cursor:not-allowed;opacity:.6}.DropZone_fileInput__E8DeE{display:none}.DropZone_label__u7-Pb{cursor:pointer}.DropZone_error__vSiwM{color:var(--danger-color);font-size:.875rem;padding:var(--p-1) var(--p-2)}";
4
+ var S = {"root":"DropZone_root__gk-Ef","dropArea":"DropZone_dropArea__u-8Ye","disabled":"DropZone_disabled__qsAf6","isDragging":"DropZone_isDragging__S-aQp","fileInput":"DropZone_fileInput__E8DeE","label":"DropZone_label__u7-Pb","error":"DropZone_error__vSiwM"};
5
+ styleInject(css_248z);
6
+
7
+ export { S as default };
@@ -27,7 +27,7 @@ const Input = forwardRef((props, ref) => {
27
27
  ref.current = element;
28
28
  }
29
29
  };
30
- const { type = 'text', size = 'm', variant = 'default', value, defaultValue = '', onChange, onFocus, onBlur, onClear, onInput, changeOnEnd, checkAutofill, hasClear, required, hideRequiredStar, disabled, error, label, placeholder, addonLeft, addonRight, clearPaddingLeft, clearPaddingRight, forceLabelOnTop, scrollProps, step = 1, round, autoFocus, className, } = props;
30
+ const { type = 'text', size = 'm', variant = 'default', value, defaultValue = '', onChange, onFocus, onBlur, onClear, onInput, changeOnEnd, checkAutofill, hasClear, required, hideRequiredStar, disabled, error, label, placeholder, addonLeft, addonRight, clearPaddingLeft, clearPaddingRight, forceLabelOnTop, scrollProps, step = 1, round, autoFocus, className, fitContentWidth, } = props;
31
31
  const updateAutoComplete = () => {
32
32
  const form = inputRef.current?.closest('form');
33
33
  const val = form?.getAttribute('autocomplete');
@@ -272,7 +272,7 @@ const Input = forwardRef((props, ref) => {
272
272
  setTextareaValue(String(value ?? ''));
273
273
  }, []);
274
274
  const Control = isTextArea ? 'span' : 'input';
275
- const classes = cn(S.root, isTextArea && S.isTextArea, S[`size-${size}`], S[`variant-${variant}`], isFocused && S.isFocused, error && S.hasError, hasClear && S.hasClear, disabled && S.isDisabled, round && S.round, className);
275
+ const classes = cn(S.root, isTextArea && S.isTextArea, S[`size-${size}`], S[`variant-${variant}`], isFocused && S.isFocused, error && S.hasError, hasClear && S.hasClear, disabled && S.isDisabled, round && S.round, fitContentWidth && !isTextArea && S.fitContentWidth, className);
276
276
  return (jsxs("div", { className: classes, children: [jsxs("label", { className: cn(S.main, clearPaddingLeft && S.clearPaddingLeft, clearPaddingRight && S.clearPaddingRight), children: [jsx("div", { className: S.border, suppressHydrationWarning: true, style: { clipPath: labelClipPath } }, "border"), renderAddon('left'), wrapControl(jsxs(Fragment, { children: [createElement(Control, { ...controlProps, className: cn(S.control, controlProps?.className), ref: setRef, key: "control" }), isTextArea &&
277
277
  controlProps.placeholder &&
278
278
  !controlProps.value && (jsx("span", { className: S.placeholder, spellCheck: false, children: controlProps.placeholder }))] })), isNumber && (jsxs("div", { className: S.numberArrows, children: [jsx(Button, { variant: "clear", onClick: () => onNumberWheel(1), tabIndex: -1, children: jsx(Icon, { type: "chevronUp", size: size }) }), jsx(Button, { variant: "clear", onClick: () => onNumberWheel(-1), tabIndex: -1, children: jsx(Icon, { type: "chevronDown", size: size }) })] })), jsx(Label, { className: S.label, size: size, isOnTop: isLabelOnTop, isError: Boolean(error), onClipPathChange: onLabelClipPathChange, children: label }, "label"), hasClear && !disabled && hasValue && (jsx(Button, { className: S.clearButton, variant: "clear", size: size, square: true, round: round, onClick: onClearPress, title: "", children: jsx(Icon, { className: S.clearIcon, size: size, type: "close" }) }, "clear")), renderAddon('right'), required && !hideRequiredStar && (jsx(RequiredStar, { size: size }, "required-star"))] }, "main"), !disabled && typeof error === 'string' && (jsx(AssistiveText, { variant: "danger", size: size, children: error }, "assistive-text"))] }));
@@ -1,7 +1,7 @@
1
1
  import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
2
2
 
3
- var css_248z = ".Input_root__kj4vQ{color:var(--accent-color);position:relative}.Input_root__kj4vQ.Input_isTextArea__1a6n1{max-height:10em}.Input_main__M6Qxb,.Input_root__kj4vQ{width:100%}.Input_controlWrapper__WgrZL,.Input_root__kj4vQ{max-width:100%}.Input_main__M6Qxb{border-radius:inherit;display:flex;max-width:100%;position:relative}.Input_main__M6Qxb.Input_clearPaddingRight__sGl9l{padding-right:0!important}.Input_main__M6Qxb.Input_clearPaddingLeft__LBlwM{padding-left:0!important}.Input_isTextArea__1a6n1 .Input_main__M6Qxb{height:auto;max-height:inherit!important}.Input_border__01i-B{background-color:var(--accent-color-alpha-100);border-radius:inherit;bottom:0;left:0;pointer-events:none;position:absolute;right:0;top:0;transition:.15s ease-out;transition-property:box-shadow,border-color,background-color;z-index:0}.Input_root__kj4vQ:hover .Input_border__01i-B{background-color:var(--active-color-alpha-100)}.Input_variant-clean__yjtdm .Input_border__01i-B{background-color:transparent}.Input_isFocused__9jtFN.Input_variant-clean__yjtdm .Input_border__01i-B{background-color:var(--active-color-alpha-300)}.Input_variant-default__frNbg .Input_border__01i-B{background-color:var(--accent-color-alpha-100)}.Input_isFocused__9jtFN.Input_variant-default__frNbg .Input_border__01i-B{background-color:var(--active-color-alpha-300)}.Input_variant-outlined__qKjnJ .Input_border__01i-B{background-color:transparent;box-shadow:inset 0 0 0 2px var(--accent-color)}.Input_isFocused__9jtFN.Input_variant-outlined__qKjnJ .Input_border__01i-B{background-color:var(--active-color-alpha-300);box-shadow:inset 0 0 0 2px var(--active-color)}.Input_hasError__5iS2M .Input_variant-outlined__qKjnJ .Input_border__01i-B,.Input_hasError__5iS2M:hover .Input_variant-outlined__qKjnJ .Input_border__01i-B{box-shadow:inset 0 0 0 2px var(--danger-color)}.Input_isDisabled__e7J10.Input_variant-outlined__qKjnJ .Input_border__01i-B{box-shadow:none}.Input_size-xs__b5Kx7{font-size:14px}.Input_size-xs__b5Kx7 .Input_main__M6Qxb{border-radius:4px;font-size:14px;min-height:24px;min-width:24px;padding:0 0 0 8px}.Input_round__yJr-2.Input_size-xs__b5Kx7 .Input_main__M6Qxb{border-radius:12px}.Input_size-s__-U0r-{font-size:16px}.Input_size-s__-U0r- .Input_main__M6Qxb{border-radius:4px;font-size:16px;min-height:32px;min-width:32px;padding:0 0 0 12px}.Input_round__yJr-2.Input_size-s__-U0r- .Input_main__M6Qxb{border-radius:16px}.Input_size-m__jTEMl{font-size:18px}.Input_size-m__jTEMl .Input_main__M6Qxb{border-radius:6px;font-size:18px;min-height:40px;min-width:40px;padding:0 0 0 16px}.Input_round__yJr-2.Input_size-m__jTEMl .Input_main__M6Qxb{border-radius:20px}.Input_size-l__BR-zg{font-size:22px}.Input_size-l__BR-zg .Input_main__M6Qxb{border-radius:8px;font-size:22px;min-height:48px;min-width:48px;padding:0 0 0 20px}.Input_round__yJr-2.Input_size-l__BR-zg .Input_main__M6Qxb{border-radius:24px}.Input_size-xl__o-R-1{font-size:26px}.Input_size-xl__o-R-1 .Input_main__M6Qxb{border-radius:10px;font-size:26px;min-height:56px;min-width:56px;padding:0 0 0 24px}.Input_round__yJr-2.Input_size-xl__o-R-1 .Input_main__M6Qxb{border-radius:28px}.Input_isDisabled__e7J10{color:var(--accent-color-alpha-500);opacity:.4}.Input_addonLeft__i1c70,.Input_addonRight__A9Iht,.Input_control__wZcMD{font-size:inherit;font-weight:400}.Input_labelGap__T6fAj{opacity:0;pointer-events:none;position:absolute}.Input_isTextArea__1a6n1 .Input_label__FT90l{max-height:40px}.Input_scroller__OBm8M{max-height:100%;width:100%}.Input_controlWrapper__WgrZL{flex:1}.Input_control__wZcMD{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;box-shadow:none;box-shadow:inset 0 0 0 2px none;color:inherit;display:inline-flex;filter:none;flex-grow:1;height:100%;min-width:30px;position:relative;text-overflow:ellipsis;transition:border-color .15s ease-in-out 0s;width:100%}.Input_control__wZcMD:-internal-autofill-selected,.Input_control__wZcMD:-webkit-autofill{animation-fill-mode:both;animation-name:Input_clearBg__jqI1h}.Input_size-xs__b5Kx7 .Input_control__wZcMD{padding-right:10px}.Input_size-s__-U0r- .Input_control__wZcMD{padding-right:12px}.Input_size-m__jTEMl .Input_control__wZcMD{padding-right:16px}.Input_size-l__BR-zg .Input_control__wZcMD{padding-right:20px}.Input_size-xl__o-R-1 .Input_control__wZcMD{padding-right:22px}.Input_size-xs__b5Kx7.Input_hasClear__5Y3nU .Input_control__wZcMD{padding-right:20px}.Input_size-s__-U0r-.Input_hasClear__5Y3nU .Input_control__wZcMD{padding-right:24px}.Input_size-m__jTEMl.Input_hasClear__5Y3nU .Input_control__wZcMD{padding-right:34px}.Input_size-l__BR-zg.Input_hasClear__5Y3nU .Input_control__wZcMD{padding-right:36px}.Input_size-xl__o-R-1.Input_hasClear__5Y3nU .Input_control__wZcMD{padding-right:40px}.Input_control__wZcMD::-moz-placeholder{color:var(--accent-color-alpha-500)}.Input_control__wZcMD::placeholder{color:var(--accent-color-alpha-500)}.Input_control__wZcMD::-moz-selection{background-color:var(--active-color-alpha-300)}.Input_control__wZcMD::selection{background-color:var(--active-color-alpha-300)}.Input_isTextArea__1a6n1 .Input_control__wZcMD{display:block;height:100%;min-height:100%;width:100%}.Input_isTextArea__1a6n1 .Input_control__wZcMD:hover{cursor:text}.Input_isTextArea__1a6n1 .Input_control__wZcMD:after{content:\"\";display:block}.Input_control__wZcMD[type=number]{-moz-appearance:textfield;margin-right:14px}.Input_control__wZcMD[type=number]::-webkit-inner-spin-button,.Input_control__wZcMD[type=number]::-webkit-outer-spin-button{-webkit-appearance:none}.Input_numberArrows__8jveR{display:flex;flex-direction:column;height:100%;position:absolute;right:0}.Input_numberArrows__8jveR>button{background-color:transparent!important;height:50%;max-height:none;min-height:0;min-height:auto;opacity:.5;padding-left:0;padding-right:0;transition:opacity .1s ease-out;width:50%}.Input_numberArrows__8jveR>button:hover{opacity:1}.Input_size-xs__b5Kx7 .Input_numberArrows__8jveR>button{min-width:19.2px}.Input_size-s__-U0r- .Input_numberArrows__8jveR>button{min-width:25.6px}.Input_size-m__jTEMl .Input_numberArrows__8jveR>button{min-width:32px}.Input_size-l__BR-zg .Input_numberArrows__8jveR>button{min-width:38.4px}.Input_size-xl__o-R-1 .Input_numberArrows__8jveR>button{min-width:44.8px}.Input_numberArrows__8jveR>button>svg{transform:scale(.8)}.Input_numberArrows__8jveR>button:first-child>svg{margin-bottom:-5%}.Input_numberArrows__8jveR>button:last-child>svg{margin-top:-5%}.Input_isTextArea__1a6n1 .Input_control__wZcMD,.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA{padding-left:0!important}.Input_size-xs__b5Kx7.Input_isTextArea__1a6n1 .Input_control__wZcMD,.Input_size-xs__b5Kx7.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA{padding:6px 12px 0 8px}.Input_size-xs__b5Kx7.Input_isTextArea__1a6n1 .Input_control__wZcMD:after,.Input_size-xs__b5Kx7.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA:after{height:6px}.Input_size-s__-U0r-.Input_isTextArea__1a6n1 .Input_control__wZcMD,.Input_size-s__-U0r-.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA{padding:8px 16px 0 12px}.Input_size-s__-U0r-.Input_isTextArea__1a6n1 .Input_control__wZcMD:after,.Input_size-s__-U0r-.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA:after{height:8px}.Input_size-m__jTEMl.Input_isTextArea__1a6n1 .Input_control__wZcMD,.Input_size-m__jTEMl.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA{padding:10px 20px 0 16px}.Input_size-m__jTEMl.Input_isTextArea__1a6n1 .Input_control__wZcMD:after,.Input_size-m__jTEMl.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA:after{height:10px}.Input_size-l__BR-zg.Input_isTextArea__1a6n1 .Input_control__wZcMD,.Input_size-l__BR-zg.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA{padding:12px 24px 0 20px}.Input_size-l__BR-zg.Input_isTextArea__1a6n1 .Input_control__wZcMD:after,.Input_size-l__BR-zg.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA:after{height:12px}.Input_size-xl__o-R-1.Input_isTextArea__1a6n1 .Input_control__wZcMD,.Input_size-xl__o-R-1.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA{padding:14px 28px 0 24px}.Input_size-xl__o-R-1.Input_isTextArea__1a6n1 .Input_control__wZcMD:after,.Input_size-xl__o-R-1.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA:after{height:14px}.Input_placeholder__DRYLA{display:inline-block;left:0;max-width:100%;opacity:.4;overflow:hidden;padding:inherit;pointer-events:none;position:absolute;text-overflow:ellipsis;top:0;white-space:nowrap}.Input_addonLeft__i1c70,.Input_addonRight__A9Iht{align-items:center;display:inline-flex;flex-shrink:0;min-width:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:1}.Input_addonLeft__i1c70>span,.Input_addonRight__A9Iht>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.Input_size-xs__b5Kx7 .Input_addonLeft__i1c70{margin-right:calc(var(--p-2)/2)}.Input_size-s__-U0r- .Input_addonLeft__i1c70{margin-right:calc(var(--p-3)/2)}.Input_size-m__jTEMl .Input_addonLeft__i1c70{margin-right:calc(var(--p-5)/2)}.Input_size-l__BR-zg .Input_addonLeft__i1c70{margin-right:calc(var(--p-8)/2)}.Input_size-xl__o-R-1 .Input_addonLeft__i1c70{margin-right:calc(var(--p-10)/2)}.Input_size-xs__b5Kx7 .Input_addonRight__A9Iht{margin-left:calc(var(--p-2)/2)}.Input_size-s__-U0r- .Input_addonRight__A9Iht{margin-left:calc(var(--p-3)/2)}.Input_size-m__jTEMl .Input_addonRight__A9Iht{margin-left:calc(var(--p-5)/2)}.Input_size-l__BR-zg .Input_addonRight__A9Iht{margin-left:calc(var(--p-8)/2)}.Input_size-xl__o-R-1 .Input_addonRight__A9Iht{margin-left:calc(var(--p-10)/2)}.Input_requiredStar__6MeQ4{background-color:var(--warning-color);border-radius:50%;height:8px;opacity:.8;pointer-events:none;position:absolute;width:8px}.Input_isDisabled__e7J10 .Input_requiredStar__6MeQ4{display:none}.Input_size-xs__b5Kx7 .Input_requiredStar__6MeQ4{right:3px;top:3px}.Input_size-s__-U0r- .Input_requiredStar__6MeQ4{right:4px;top:4px}.Input_size-m__jTEMl .Input_requiredStar__6MeQ4{right:6px;top:6px}.Input_size-l__BR-zg .Input_requiredStar__6MeQ4{right:8px;top:8px}.Input_size-xl__o-R-1 .Input_requiredStar__6MeQ4{right:10px;top:10px}.Input_isDisabled__e7J10{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.Input_clearButton__0E-9L{bottom:1px;height:auto;position:absolute;right:0;top:0;z-index:1}.Input_clearButton__0E-9L:hover{background-color:var(--accent-color-alpha-0)!important}.Input_clearIcon__Gi1Nc{flex-shrink:0;opacity:.3;transition:opacity .2s ease-out}.Input_clearButton__0E-9L:hover .Input_clearIcon__Gi1Nc{opacity:.8}.Input_size-xs__b5Kx7 .Input_clearIcon__Gi1Nc{height:8px;width:8px}.Input_size-s__-U0r- .Input_clearIcon__Gi1Nc{height:10px;width:10px}.Input_size-m__jTEMl .Input_clearIcon__Gi1Nc{height:12px;width:12px}.Input_size-l__BR-zg .Input_clearIcon__Gi1Nc{height:14px;width:14px}.Input_size-xl__o-R-1 .Input_clearIcon__Gi1Nc{height:16px;width:16px}";
4
- var S = {"root":"Input_root__kj4vQ","isTextArea":"Input_isTextArea__1a6n1","main":"Input_main__M6Qxb","controlWrapper":"Input_controlWrapper__WgrZL","clearPaddingRight":"Input_clearPaddingRight__sGl9l","clearPaddingLeft":"Input_clearPaddingLeft__LBlwM","border":"Input_border__01i-B","variant-clean":"Input_variant-clean__yjtdm","isFocused":"Input_isFocused__9jtFN","variant-default":"Input_variant-default__frNbg","variant-outlined":"Input_variant-outlined__qKjnJ","hasError":"Input_hasError__5iS2M","isDisabled":"Input_isDisabled__e7J10","size-xs":"Input_size-xs__b5Kx7","round":"Input_round__yJr-2","size-s":"Input_size-s__-U0r-","size-m":"Input_size-m__jTEMl","size-l":"Input_size-l__BR-zg","size-xl":"Input_size-xl__o-R-1","control":"Input_control__wZcMD","addonLeft":"Input_addonLeft__i1c70","addonRight":"Input_addonRight__A9Iht","labelGap":"Input_labelGap__T6fAj","label":"Input_label__FT90l","scroller":"Input_scroller__OBm8M","clearBg":"Input_clearBg__jqI1h","hasClear":"Input_hasClear__5Y3nU","numberArrows":"Input_numberArrows__8jveR","placeholder":"Input_placeholder__DRYLA","requiredStar":"Input_requiredStar__6MeQ4","clearButton":"Input_clearButton__0E-9L","clearIcon":"Input_clearIcon__Gi1Nc"};
3
+ var css_248z = ".Input_root__kj4vQ{color:var(--accent-color);position:relative}.Input_root__kj4vQ.Input_isTextArea__1a6n1{max-height:10em}.Input_main__M6Qxb,.Input_root__kj4vQ{width:100%}.Input_controlWrapper__WgrZL,.Input_root__kj4vQ{max-width:100%}.Input_main__M6Qxb{border-radius:inherit;display:flex;max-width:100%;position:relative}.Input_main__M6Qxb.Input_clearPaddingRight__sGl9l{padding-right:0!important}.Input_main__M6Qxb.Input_clearPaddingLeft__LBlwM{padding-left:0!important}.Input_isTextArea__1a6n1 .Input_main__M6Qxb{height:auto;max-height:inherit!important}.Input_border__01i-B{background-color:var(--accent-color-alpha-100);border-radius:inherit;bottom:0;left:0;pointer-events:none;position:absolute;right:0;top:0;transition:.15s ease-out;transition-property:box-shadow,border-color,background-color;z-index:0}.Input_root__kj4vQ:hover .Input_border__01i-B{background-color:var(--active-color-alpha-100)}.Input_variant-clean__yjtdm .Input_border__01i-B{background-color:transparent}.Input_isFocused__9jtFN.Input_variant-clean__yjtdm .Input_border__01i-B{background-color:var(--active-color-alpha-300)}.Input_variant-default__frNbg .Input_border__01i-B{background-color:var(--accent-color-alpha-100)}.Input_isFocused__9jtFN.Input_variant-default__frNbg .Input_border__01i-B{background-color:var(--active-color-alpha-300)}.Input_variant-outlined__qKjnJ .Input_border__01i-B{background-color:transparent;box-shadow:inset 0 0 0 2px var(--accent-color)}.Input_isFocused__9jtFN.Input_variant-outlined__qKjnJ .Input_border__01i-B{background-color:var(--active-color-alpha-300);box-shadow:inset 0 0 0 2px var(--active-color)}.Input_hasError__5iS2M .Input_variant-outlined__qKjnJ .Input_border__01i-B,.Input_hasError__5iS2M:hover .Input_variant-outlined__qKjnJ .Input_border__01i-B{box-shadow:inset 0 0 0 2px var(--danger-color)}.Input_isDisabled__e7J10.Input_variant-outlined__qKjnJ .Input_border__01i-B{box-shadow:none}.Input_size-xs__b5Kx7{font-size:14px}.Input_size-xs__b5Kx7 .Input_main__M6Qxb{border-radius:4px;font-size:14px;min-height:24px;min-width:24px;padding:0 0 0 8px}.Input_round__yJr-2.Input_size-xs__b5Kx7 .Input_main__M6Qxb{border-radius:12px}.Input_size-s__-U0r-{font-size:16px}.Input_size-s__-U0r- .Input_main__M6Qxb{border-radius:4px;font-size:16px;min-height:32px;min-width:32px;padding:0 0 0 12px}.Input_round__yJr-2.Input_size-s__-U0r- .Input_main__M6Qxb{border-radius:16px}.Input_size-m__jTEMl{font-size:18px}.Input_size-m__jTEMl .Input_main__M6Qxb{border-radius:6px;font-size:18px;min-height:40px;min-width:40px;padding:0 0 0 16px}.Input_round__yJr-2.Input_size-m__jTEMl .Input_main__M6Qxb{border-radius:20px}.Input_size-l__BR-zg{font-size:22px}.Input_size-l__BR-zg .Input_main__M6Qxb{border-radius:8px;font-size:22px;min-height:48px;min-width:48px;padding:0 0 0 20px}.Input_round__yJr-2.Input_size-l__BR-zg .Input_main__M6Qxb{border-radius:24px}.Input_size-xl__o-R-1{font-size:26px}.Input_size-xl__o-R-1 .Input_main__M6Qxb{border-radius:10px;font-size:26px;min-height:56px;min-width:56px;padding:0 0 0 24px}.Input_round__yJr-2.Input_size-xl__o-R-1 .Input_main__M6Qxb{border-radius:28px}.Input_isDisabled__e7J10{color:var(--accent-color-alpha-500);opacity:.4}.Input_addonLeft__i1c70,.Input_addonRight__A9Iht,.Input_control__wZcMD{font-size:inherit;font-weight:400}.Input_labelGap__T6fAj{opacity:0;pointer-events:none;position:absolute}.Input_isTextArea__1a6n1 .Input_label__FT90l{max-height:40px}.Input_scroller__OBm8M{max-height:100%;width:100%}.Input_controlWrapper__WgrZL{flex:1}.Input_control__wZcMD{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;box-shadow:none;box-shadow:inset 0 0 0 2px none;color:inherit;display:inline-flex;filter:none;flex-grow:1;height:100%;min-width:30px;position:relative;text-overflow:ellipsis;transition:border-color .15s ease-in-out 0s;width:100%}.Input_control__wZcMD:-internal-autofill-selected,.Input_control__wZcMD:-webkit-autofill{animation-fill-mode:both;animation-name:Input_clearBg__jqI1h}.Input_size-xs__b5Kx7 .Input_control__wZcMD{padding-right:10px}.Input_size-s__-U0r- .Input_control__wZcMD{padding-right:12px}.Input_size-m__jTEMl .Input_control__wZcMD{padding-right:16px}.Input_size-l__BR-zg .Input_control__wZcMD{padding-right:20px}.Input_size-xl__o-R-1 .Input_control__wZcMD{padding-right:22px}.Input_size-xs__b5Kx7.Input_hasClear__5Y3nU .Input_control__wZcMD{padding-right:20px}.Input_size-s__-U0r-.Input_hasClear__5Y3nU .Input_control__wZcMD{padding-right:24px}.Input_size-m__jTEMl.Input_hasClear__5Y3nU .Input_control__wZcMD{padding-right:34px}.Input_size-l__BR-zg.Input_hasClear__5Y3nU .Input_control__wZcMD{padding-right:36px}.Input_size-xl__o-R-1.Input_hasClear__5Y3nU .Input_control__wZcMD{padding-right:40px}.Input_control__wZcMD::-moz-placeholder{color:var(--accent-color-alpha-500)}.Input_control__wZcMD::placeholder{color:var(--accent-color-alpha-500)}.Input_control__wZcMD::-moz-selection{background-color:var(--active-color-alpha-300)}.Input_control__wZcMD::selection{background-color:var(--active-color-alpha-300)}.Input_isTextArea__1a6n1 .Input_control__wZcMD{display:block;height:100%;min-height:100%;width:100%}.Input_isTextArea__1a6n1 .Input_control__wZcMD:hover{cursor:text}.Input_isTextArea__1a6n1 .Input_control__wZcMD:after{content:\"\";display:block}.Input_control__wZcMD[type=number]{-moz-appearance:textfield;margin-right:14px}.Input_control__wZcMD[type=number]::-webkit-inner-spin-button,.Input_control__wZcMD[type=number]::-webkit-outer-spin-button{-webkit-appearance:none}.Input_numberArrows__8jveR{display:flex;flex-direction:column;height:100%;position:absolute;right:0}.Input_numberArrows__8jveR>button{background-color:transparent!important;height:50%;max-height:none;min-height:0;min-height:auto;opacity:.5;padding-left:0;padding-right:0;transition:opacity .1s ease-out;width:50%}.Input_numberArrows__8jveR>button:hover{opacity:1}.Input_size-xs__b5Kx7 .Input_numberArrows__8jveR>button{min-width:19.2px}.Input_size-s__-U0r- .Input_numberArrows__8jveR>button{min-width:25.6px}.Input_size-m__jTEMl .Input_numberArrows__8jveR>button{min-width:32px}.Input_size-l__BR-zg .Input_numberArrows__8jveR>button{min-width:38.4px}.Input_size-xl__o-R-1 .Input_numberArrows__8jveR>button{min-width:44.8px}.Input_numberArrows__8jveR>button>svg{transform:scale(.8)}.Input_numberArrows__8jveR>button:first-child>svg{margin-bottom:-5%}.Input_numberArrows__8jveR>button:last-child>svg{margin-top:-5%}.Input_isTextArea__1a6n1 .Input_control__wZcMD,.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA{padding-left:0!important}.Input_size-xs__b5Kx7.Input_isTextArea__1a6n1 .Input_control__wZcMD,.Input_size-xs__b5Kx7.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA{padding:6px 12px 0 8px}.Input_size-xs__b5Kx7.Input_isTextArea__1a6n1 .Input_control__wZcMD:after,.Input_size-xs__b5Kx7.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA:after{height:6px}.Input_size-s__-U0r-.Input_isTextArea__1a6n1 .Input_control__wZcMD,.Input_size-s__-U0r-.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA{padding:8px 16px 0 12px}.Input_size-s__-U0r-.Input_isTextArea__1a6n1 .Input_control__wZcMD:after,.Input_size-s__-U0r-.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA:after{height:8px}.Input_size-m__jTEMl.Input_isTextArea__1a6n1 .Input_control__wZcMD,.Input_size-m__jTEMl.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA{padding:10px 20px 0 16px}.Input_size-m__jTEMl.Input_isTextArea__1a6n1 .Input_control__wZcMD:after,.Input_size-m__jTEMl.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA:after{height:10px}.Input_size-l__BR-zg.Input_isTextArea__1a6n1 .Input_control__wZcMD,.Input_size-l__BR-zg.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA{padding:12px 24px 0 20px}.Input_size-l__BR-zg.Input_isTextArea__1a6n1 .Input_control__wZcMD:after,.Input_size-l__BR-zg.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA:after{height:12px}.Input_size-xl__o-R-1.Input_isTextArea__1a6n1 .Input_control__wZcMD,.Input_size-xl__o-R-1.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA{padding:14px 28px 0 24px}.Input_size-xl__o-R-1.Input_isTextArea__1a6n1 .Input_control__wZcMD:after,.Input_size-xl__o-R-1.Input_isTextArea__1a6n1 .Input_placeholder__DRYLA:after{height:14px}.Input_placeholder__DRYLA{display:inline-block;left:0;max-width:100%;opacity:.4;overflow:hidden;padding:inherit;pointer-events:none;position:absolute;text-overflow:ellipsis;top:0;white-space:nowrap}.Input_addonLeft__i1c70,.Input_addonRight__A9Iht{align-items:center;display:inline-flex;flex-shrink:0;min-width:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:1}.Input_addonLeft__i1c70>span,.Input_addonRight__A9Iht>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.Input_size-xs__b5Kx7 .Input_addonLeft__i1c70{margin-right:calc(var(--p-2)/2)}.Input_size-s__-U0r- .Input_addonLeft__i1c70{margin-right:calc(var(--p-3)/2)}.Input_size-m__jTEMl .Input_addonLeft__i1c70{margin-right:calc(var(--p-5)/2)}.Input_size-l__BR-zg .Input_addonLeft__i1c70{margin-right:calc(var(--p-8)/2)}.Input_size-xl__o-R-1 .Input_addonLeft__i1c70{margin-right:calc(var(--p-10)/2)}.Input_size-xs__b5Kx7 .Input_addonRight__A9Iht{margin-left:calc(var(--p-2)/2)}.Input_size-s__-U0r- .Input_addonRight__A9Iht{margin-left:calc(var(--p-3)/2)}.Input_size-m__jTEMl .Input_addonRight__A9Iht{margin-left:calc(var(--p-5)/2)}.Input_size-l__BR-zg .Input_addonRight__A9Iht{margin-left:calc(var(--p-8)/2)}.Input_size-xl__o-R-1 .Input_addonRight__A9Iht{margin-left:calc(var(--p-10)/2)}.Input_requiredStar__6MeQ4{background-color:var(--warning-color);border-radius:50%;height:8px;opacity:.8;pointer-events:none;position:absolute;width:8px}.Input_isDisabled__e7J10 .Input_requiredStar__6MeQ4{display:none}.Input_size-xs__b5Kx7 .Input_requiredStar__6MeQ4{right:3px;top:3px}.Input_size-s__-U0r- .Input_requiredStar__6MeQ4{right:4px;top:4px}.Input_size-m__jTEMl .Input_requiredStar__6MeQ4{right:6px;top:6px}.Input_size-l__BR-zg .Input_requiredStar__6MeQ4{right:8px;top:8px}.Input_size-xl__o-R-1 .Input_requiredStar__6MeQ4{right:10px;top:10px}.Input_isDisabled__e7J10{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.Input_clearButton__0E-9L{bottom:1px;height:auto;position:absolute;right:0;top:0;z-index:1}.Input_clearButton__0E-9L:hover{background-color:var(--accent-color-alpha-0)!important}.Input_clearIcon__Gi1Nc{flex-shrink:0;opacity:.3;transition:opacity .2s ease-out}.Input_clearButton__0E-9L:hover .Input_clearIcon__Gi1Nc{opacity:.8}.Input_size-xs__b5Kx7 .Input_clearIcon__Gi1Nc{height:8px;width:8px}.Input_size-s__-U0r- .Input_clearIcon__Gi1Nc{height:10px;width:10px}.Input_size-m__jTEMl .Input_clearIcon__Gi1Nc{height:12px;width:12px}.Input_size-l__BR-zg .Input_clearIcon__Gi1Nc{height:14px;width:14px}.Input_size-xl__o-R-1 .Input_clearIcon__Gi1Nc{height:16px;width:16px}@supports (field-sizing:content){.Input_root__kj4vQ.Input_fitContentWidth__H0MTc,.Input_root__kj4vQ.Input_fitContentWidth__H0MTc .Input_main__M6Qxb{max-width:100%;width:-moz-fit-content;width:fit-content}.Input_root__kj4vQ.Input_fitContentWidth__H0MTc .Input_controlWrapper__WgrZL{flex:0 1 auto;max-width:100%;width:-moz-fit-content;width:fit-content}.Input_root__kj4vQ.Input_fitContentWidth__H0MTc .Input_control__wZcMD{field-sizing:content;flex-grow:0;max-width:100%;width:auto}}";
4
+ var S = {"root":"Input_root__kj4vQ","isTextArea":"Input_isTextArea__1a6n1","main":"Input_main__M6Qxb","controlWrapper":"Input_controlWrapper__WgrZL","clearPaddingRight":"Input_clearPaddingRight__sGl9l","clearPaddingLeft":"Input_clearPaddingLeft__LBlwM","border":"Input_border__01i-B","variant-clean":"Input_variant-clean__yjtdm","isFocused":"Input_isFocused__9jtFN","variant-default":"Input_variant-default__frNbg","variant-outlined":"Input_variant-outlined__qKjnJ","hasError":"Input_hasError__5iS2M","isDisabled":"Input_isDisabled__e7J10","size-xs":"Input_size-xs__b5Kx7","round":"Input_round__yJr-2","size-s":"Input_size-s__-U0r-","size-m":"Input_size-m__jTEMl","size-l":"Input_size-l__BR-zg","size-xl":"Input_size-xl__o-R-1","control":"Input_control__wZcMD","addonLeft":"Input_addonLeft__i1c70","addonRight":"Input_addonRight__A9Iht","labelGap":"Input_labelGap__T6fAj","label":"Input_label__FT90l","scroller":"Input_scroller__OBm8M","clearBg":"Input_clearBg__jqI1h","hasClear":"Input_hasClear__5Y3nU","numberArrows":"Input_numberArrows__8jveR","placeholder":"Input_placeholder__DRYLA","requiredStar":"Input_requiredStar__6MeQ4","clearButton":"Input_clearButton__0E-9L","clearIcon":"Input_clearIcon__Gi1Nc","fitContentWidth":"Input_fitContentWidth__H0MTc"};
5
5
  styleInject(css_248z);
6
6
 
7
7
  export { S as default };
@@ -39,6 +39,7 @@ import 'moment';
39
39
  import '../DatePickerInput/DatePickerInput.styl.js';
40
40
  import '../Dialogue/Dialogue.js';
41
41
  import { Draggable } from '../Draggable/Draggable.js';
42
+ import '../DropZone/DropZone.styl.js';
42
43
  import '../Expand/Expand.styl.js';
43
44
  import '../Flex/Flex.styl.js';
44
45
  import '../Form/Form.styl.js';
@@ -0,0 +1,3 @@
1
+ import type * as T from './DropZone.types';
2
+ export type DropZoneProps = T.Props;
3
+ export declare function DropZone(props: T.Props): JSX.Element;
@@ -0,0 +1,18 @@
1
+ export interface DropZoneBaseProps {
2
+ accept: string;
3
+ label: string;
4
+ error?: string | null;
5
+ disabled?: boolean;
6
+ ghost?: boolean;
7
+ id?: string;
8
+ className?: string;
9
+ }
10
+ export interface DropZoneSingleProps extends DropZoneBaseProps {
11
+ multiple?: false;
12
+ onFile: (file: File) => void;
13
+ }
14
+ export interface DropZoneMultiProps extends DropZoneBaseProps {
15
+ multiple: true;
16
+ onFiles: (files: File[]) => void;
17
+ }
18
+ export type Props = DropZoneSingleProps | DropZoneMultiProps;
@@ -23,4 +23,5 @@ export declare const Input: import("react").ForwardRefExoticComponent<Omit<impor
23
23
  controlProps?: T.ControlProps & import("../../types").ComponentType;
24
24
  checkAutofill?: boolean;
25
25
  scrollProps?: Partial<import("../Scroll/Scroll.types").Props>;
26
+ fitContentWidth?: boolean;
26
27
  } & import("react").RefAttributes<HTMLInputElement>>;
@@ -26,4 +26,6 @@ export type Props = Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> & Om
26
26
  controlProps?: ControlProps & ComponentType;
27
27
  checkAutofill?: boolean;
28
28
  scrollProps?: Partial<ScrollProps>;
29
+ /** When true, width follows text via CSS `field-sizing: content` (non-textarea only). */
30
+ fitContentWidth?: boolean;
29
31
  };
@@ -12,6 +12,7 @@ export * from './DatePickerInput/DatePickerInput';
12
12
  export * from './DateTime/DateTime';
13
13
  export * from './Dialogue';
14
14
  export * from './Draggable/Draggable';
15
+ export * from './DropZone/DropZone';
15
16
  export * from './Expand/Expand';
16
17
  export * from './Flex/Flex';
17
18
  export * from './Form/Form';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homecode/ui",
3
- "version": "5.0.1",
3
+ "version": "5.1.1",
4
4
  "description": "React UI components library",
5
5
  "scripts": {
6
6
  "tests": "jest",