@homecode/ui 4.20.0-beta-9 → 4.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/src/components/Button/Button.styl.js +1 -1
- package/dist/esm/src/components/Input/Input.js +6 -3
- package/dist/esm/types/src/components/Input/Input.d.ts +1 -0
- package/dist/esm/types/src/components/Input/Input.types.d.ts +1 -0
- package/dist/esm/types/src/components/Select/Select.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".Button_root__SZns2{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-shadow:inset 0 0 0 2px none;box-sizing:border-box;color:inherit;cursor:pointer;display:inline-flex;justify-content:center;line-height:1em;text-decoration:none;transition:.2s ease-out;transition-property:background-color,box-shadow,opacity;-webkit-user-select:none;-moz-user-select:none;user-select:none}.Button_root__SZns2:focus,.Button_root__SZns2:hover{background-color:var(--active-color-alpha-100)}.Button_root__SZns2[disabled]{background-color:var(--accent-color-alpha-100);opacity:.4;pointer-events:none}.Button_root__SZns2:active{opacity:.7}.Button_root__SZns2.Button_loading__c4pdo{pointer-events:none}.Button_root__SZns2.Button_checked__X7f58,.Button_root__SZns2.Button_checked__X7f58:focus,.Button_root__SZns2.Button_checked__X7f58:hover{background-color:var(--accent-color)!important;box-shadow:none;color:var(--decent-color)}.Button_root__SZns2.Button_checked__X7f58:focus{box-shadow:0 0 0 2px var(--active-color)}.Button_root__SZns2.Button_checked__X7f58 path{fill:var(--decent-color)}.Button_postfix__DwG-n,.Button_prefix__czqd5{display:flex}.Button_prefix__czqd5:not(:last-child){margin-right:.5em}.Button_postfix__DwG-n:not(:first-child){margin-left:.5em}.Button_size-s__-SIY1{border-radius:4px;font-size:16px;min-height:30px;min-width:30px;padding:0 14px}.Button_size-s__-SIY1.Button_square__eYSY3{max-height:30px;width:30px}.Button_size-m__TBXc-{border-radius:6px;font-size:20px;min-height:40px;min-width:40px;padding:0 16px}.Button_size-m__TBXc-.Button_square__eYSY3{max-height:40px;width:40px}.Button_size-l__Sx37T{border-radius:8px;font-size:24px;min-height:50px;min-width:50px;padding:0 18px}.Button_size-l__Sx37T.Button_square__eYSY3{max-height:50px}.Button_square__eYSY3{justify-content:center;padding:0}.Button_round__Bxofy.Button_size-s__-SIY1{border-radius:15px}.Button_round__Bxofy.Button_size-m__TBXc-{border-radius:20px}.Button_round__Bxofy.Button_size-l__Sx37T{border-radius:25px}.Button_variant-clear__z1HZm:active,.Button_variant-clear__z1HZm:focus,.Button_variant-clear__z1HZm:hover,.Button_variant-default__vbo51:active,.Button_variant-default__vbo51:focus,.Button_variant-default__vbo51:hover,.Button_variant-outlined__shnIq:active,.Button_variant-outlined__shnIq:hover,.Button_variant-primary__zhEQI:active,.Button_variant-primary__zhEQI:hover{background-color:var(--active-color-alpha-300)}.Button_variant-text__oCx0X{background-color:transparent}.Button_variant-text__oCx0X:hover{background-color:transparent!important;color:var(--active-color)}.Button_variant-text__oCx0X:focus{background-color:transparent;color:var(--active-color)}.Button_variant-clear__z1HZm{background-color:transparent}.Button_variant-default__vbo51{background-color:var(--accent-color-alpha-100)}.Button_variant-outlined__shnIq{background-color:transparent;box-shadow:inset 0 0 0 2px var(--accent-color)}.Button_variant-outlined__shnIq:focus{background-color:var(--active-color-alpha-300);box-shadow:inset 0 0 0 2px var(--active-color)}.Button_variant-primary__zhEQI{background-color:var(--active-color);color:var(--accent-color-alpha-900)}.Button_variant-primary__zhEQI:hover{background-color:var(--active-color-alpha-800)}.Button_variant-primary__zhEQI:focus{background-color:var(--active-color);box-shadow:inset 0 0 0 2px var(--accent-color)}.Button_spinner__ttaMr{margin-left:var(--indent-s)}";
|
|
3
|
+
var css_248z = ".Button_root__SZns2{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-shadow:inset 0 0 0 2px none;box-sizing:border-box;color:inherit;cursor:pointer;display:inline-flex;justify-content:center;line-height:1em;text-decoration:none;transition:.2s ease-out;transition-property:background-color,box-shadow,opacity;-webkit-user-select:none;-moz-user-select:none;user-select:none}.Button_root__SZns2:focus,.Button_root__SZns2:hover{background-color:var(--active-color-alpha-100)}.Button_root__SZns2[disabled]{background-color:var(--accent-color-alpha-100);opacity:.4;pointer-events:none}.Button_root__SZns2:active{opacity:.7}.Button_root__SZns2.Button_loading__c4pdo{pointer-events:none}.Button_root__SZns2.Button_checked__X7f58,.Button_root__SZns2.Button_checked__X7f58:focus,.Button_root__SZns2.Button_checked__X7f58:hover{background-color:var(--accent-color)!important;box-shadow:none;color:var(--decent-color)}.Button_root__SZns2.Button_checked__X7f58:focus{box-shadow:0 0 0 2px var(--active-color)}.Button_root__SZns2.Button_checked__X7f58 path{fill:var(--decent-color)}.Button_postfix__DwG-n,.Button_prefix__czqd5{display:flex}.Button_prefix__czqd5:not(:last-child){margin-right:.5em}.Button_postfix__DwG-n:not(:first-child){margin-left:.5em}.Button_size-s__-SIY1{border-radius:4px;font-size:16px;min-height:30px;min-width:30px;padding:0 14px}.Button_size-s__-SIY1.Button_square__eYSY3{max-height:30px;width:30px}.Button_size-m__TBXc-{border-radius:6px;font-size:20px;min-height:40px;min-width:40px;padding:0 16px}.Button_size-m__TBXc-.Button_square__eYSY3{max-height:40px;width:40px}.Button_size-l__Sx37T{border-radius:8px;font-size:24px;min-height:50px;min-width:50px;padding:0 18px}.Button_size-l__Sx37T.Button_square__eYSY3{max-height:50px}.Button_square__eYSY3{justify-content:center;padding:0}.Button_round__Bxofy.Button_size-s__-SIY1{border-radius:15px}.Button_round__Bxofy.Button_size-m__TBXc-{border-radius:20px}.Button_round__Bxofy.Button_size-l__Sx37T{border-radius:25px}.Button_variant-clear__z1HZm:active,.Button_variant-clear__z1HZm:focus,.Button_variant-clear__z1HZm:hover,.Button_variant-default__vbo51:active,.Button_variant-default__vbo51:focus,.Button_variant-default__vbo51:hover,.Button_variant-outlined__shnIq:active,.Button_variant-outlined__shnIq:hover,.Button_variant-primary__zhEQI:active,.Button_variant-primary__zhEQI:hover{background-color:var(--active-color-alpha-300)}.Button_variant-text__oCx0X{background-color:transparent}.Button_variant-text__oCx0X:hover{background-color:transparent!important;color:var(--active-color)}.Button_variant-text__oCx0X:focus{background-color:transparent;color:var(--active-color)}.Button_variant-text__oCx0X[disabled]{background-color:transparent!important}.Button_variant-clear__z1HZm{background-color:transparent}.Button_variant-default__vbo51{background-color:var(--accent-color-alpha-100)}.Button_variant-outlined__shnIq{background-color:transparent;box-shadow:inset 0 0 0 2px var(--accent-color)}.Button_variant-outlined__shnIq:focus{background-color:var(--active-color-alpha-300);box-shadow:inset 0 0 0 2px var(--active-color)}.Button_variant-primary__zhEQI{background-color:var(--active-color);color:var(--accent-color-alpha-900)}.Button_variant-primary__zhEQI:hover{background-color:var(--active-color-alpha-800)}.Button_variant-primary__zhEQI:focus{background-color:var(--active-color);box-shadow:inset 0 0 0 2px var(--accent-color)}.Button_spinner__ttaMr{margin-left:var(--indent-s)}";
|
|
4
4
|
var S = {"root":"Button_root__SZns2","loading":"Button_loading__c4pdo","checked":"Button_checked__X7f58","prefix":"Button_prefix__czqd5","postfix":"Button_postfix__DwG-n","size-s":"Button_size-s__-SIY1","square":"Button_square__eYSY3","size-m":"Button_size-m__TBXc-","size-l":"Button_size-l__Sx37T","round":"Button_round__Bxofy","variant-clear":"Button_variant-clear__z1HZm","variant-default":"Button_variant-default__vbo51","variant-outlined":"Button_variant-outlined__shnIq","variant-primary":"Button_variant-primary__zhEQI","variant-text":"Button_variant-text__oCx0X","spinner":"Button_spinner__ttaMr"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -71,7 +71,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
71
71
|
ref.current = element;
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
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, className, } = props;
|
|
74
|
+
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;
|
|
75
75
|
const updateAutoComplete = () => {
|
|
76
76
|
const form = inputRef.current?.closest('form');
|
|
77
77
|
const val = form?.getAttribute('autocomplete');
|
|
@@ -302,7 +302,10 @@ const Input = forwardRef((props, ref) => {
|
|
|
302
302
|
setInputValue(value);
|
|
303
303
|
// setTextareaValue(String(value));
|
|
304
304
|
}
|
|
305
|
-
|
|
305
|
+
if (autoFocus && inputRef.current) {
|
|
306
|
+
inputRef.current.focus();
|
|
307
|
+
}
|
|
308
|
+
}, [value, autoFocus]);
|
|
306
309
|
useEffect(() => {
|
|
307
310
|
if (isTextArea)
|
|
308
311
|
setTextareaValue(String(value));
|
|
@@ -311,7 +314,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
311
314
|
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);
|
|
312
315
|
return (jsxs("div", { className: classes, title: String(value), 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 &&
|
|
313
316
|
controlProps.placeholder &&
|
|
314
|
-
!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, 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"))] }));
|
|
317
|
+
!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"))] }));
|
|
315
318
|
});
|
|
316
319
|
|
|
317
320
|
export { Input };
|
|
@@ -7,6 +7,7 @@ export declare const Input: import("react").ForwardRefExoticComponent<Omit<impor
|
|
|
7
7
|
label?: string;
|
|
8
8
|
variant?: import("../../types").Variant;
|
|
9
9
|
round?: boolean;
|
|
10
|
+
autoFocus?: boolean;
|
|
10
11
|
hideRequiredStar?: boolean;
|
|
11
12
|
forceLabelOnTop?: boolean;
|
|
12
13
|
error?: string | boolean;
|
|
@@ -11,6 +11,7 @@ export declare class Select extends Component<T.Props, T.State> {
|
|
|
11
11
|
label?: string;
|
|
12
12
|
variant?: import("../../types").Variant;
|
|
13
13
|
round?: boolean;
|
|
14
|
+
autoFocus?: boolean;
|
|
14
15
|
hideRequiredStar?: boolean;
|
|
15
16
|
forceLabelOnTop?: boolean;
|
|
16
17
|
error?: string | boolean;
|
|
@@ -20,6 +21,8 @@ export declare class Select extends Component<T.Props, T.State> {
|
|
|
20
21
|
addonLeftClassName?: string;
|
|
21
22
|
addonRight?: ReactNode;
|
|
22
23
|
addonRightClassName?: string;
|
|
24
|
+
clearPaddingLeft?: boolean;
|
|
25
|
+
clearPaddingRight?: boolean;
|
|
23
26
|
onClear?: () => void;
|
|
24
27
|
controlProps?: import("../Input/Input.types").ControlProps & import("../../types").ComponentType;
|
|
25
28
|
checkAutofill?: boolean;
|