@pushwoosh/dumb-components 1.1.191 → 1.1.193
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/Combobox/Combobox.js +2 -0
- package/ComboboxMulti/ComboboxMulti.js +1 -0
- package/native/Input.js +2 -2
- package/native/Textarea.js +2 -2
- package/package.json +1 -1
- package/shared/dropdownField/FieldShell.js +2 -1
- package/shared/dropdownField/styles.js +1 -1
- package/shared/dropdownField/useFieldOpenEffects.d.ts +2 -1
- package/shared/dropdownField/useFieldOpenEffects.js +3 -2
package/Combobox/Combobox.js
CHANGED
|
@@ -75,6 +75,7 @@ function FreeCombobox({
|
|
|
75
75
|
open,
|
|
76
76
|
onClose,
|
|
77
77
|
autoFocus,
|
|
78
|
+
disabled,
|
|
78
79
|
inputRef
|
|
79
80
|
});
|
|
80
81
|
const dropdownItems = useMemo(() => filteredItems.map((item, idx) => {
|
|
@@ -232,6 +233,7 @@ function SelectCombobox({
|
|
|
232
233
|
open,
|
|
233
234
|
onClose,
|
|
234
235
|
autoFocus,
|
|
236
|
+
disabled,
|
|
235
237
|
inputRef
|
|
236
238
|
});
|
|
237
239
|
const dropdownItems = useMemo(() => filteredItems.map((item, idx) => {
|
package/native/Input.js
CHANGED
|
@@ -4,6 +4,6 @@ import { Color, FontSize, LineHeight, ShapeRadius, UnitSize } from '@pushwoosh/k
|
|
|
4
4
|
export const NativeInput = styled.input.withConfig({
|
|
5
5
|
displayName: "NativeInput",
|
|
6
6
|
componentId: "sc-oqkcxd-0"
|
|
7
|
-
})(["height:", ";padding:0 calc(12px - 1px);border:1px solid ", ";border-radius:", ";font-size:", ";line-height:", ";background-color:", ";&:focus{outline:none;border-color:", ";}&:disabled{background-color:", ";}&::placeholder{color:", ";}"], UnitSize.FIELD_HEIGHT, ({
|
|
7
|
+
})(["height:", ";padding:0 calc(12px - 1px);border:1px solid ", ";border-radius:", ";font-size:", ";line-height:", ";color:", ";background-color:", ";&:focus{outline:none;border-color:", ";}&:disabled{background-color:", ";}&::placeholder{color:", ";}"], UnitSize.FIELD_HEIGHT, ({
|
|
8
8
|
$isErrored
|
|
9
|
-
}) => $isErrored ? Color.DANGER : Color.FORM, ShapeRadius.CONTROL, FontSize.REGULAR, LineHeight.REGULAR, Color.CLEAR, Color.BRIGHT, Color.FROZEN, Color.PHANTOM);
|
|
9
|
+
}) => $isErrored ? Color.DANGER : Color.FORM, ShapeRadius.CONTROL, FontSize.REGULAR, LineHeight.REGULAR, Color.MAIN, Color.CLEAR, Color.BRIGHT, Color.FROZEN, Color.PHANTOM);
|
package/native/Textarea.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Color, FontSize, LineHeight, ShapeRadius } from '@pushwoosh/kit-constan
|
|
|
4
4
|
export const NativeTextarea = styled.textarea.withConfig({
|
|
5
5
|
displayName: "NativeTextarea",
|
|
6
6
|
componentId: "sc-1xe83i4-0"
|
|
7
|
-
})(["width:", ";min-width:", ";max-width:", ";min-height:56px;padding:8px 12px;border:1px solid ", ";border-radius:", ";font-size:", ";line-height:", ";background-color:", ";&:focus{outline:none;border-color:", ";}&:disabled{background-color:", ";}&::placeholder{color:", ";}"], ({
|
|
7
|
+
})(["width:", ";min-width:", ";max-width:", ";min-height:56px;padding:8px 12px;border:1px solid ", ";border-radius:", ";font-size:", ";line-height:", ";color:", ";background-color:", ";&:focus{outline:none;border-color:", ";}&:disabled{background-color:", ";}&::placeholder{color:", ";}"], ({
|
|
8
8
|
$width
|
|
9
9
|
}) => $width || '100%', ({
|
|
10
10
|
$width
|
|
@@ -12,4 +12,4 @@ export const NativeTextarea = styled.textarea.withConfig({
|
|
|
12
12
|
$width
|
|
13
13
|
}) => $width || '100%', ({
|
|
14
14
|
$isErrored
|
|
15
|
-
}) => $isErrored ? Color.DANGER : Color.FORM, ShapeRadius.CONTROL, FontSize.REGULAR, LineHeight.REGULAR, Color.CLEAR, Color.BRIGHT, Color.FROZEN, Color.PHANTOM);
|
|
15
|
+
}) => $isErrored ? Color.DANGER : Color.FORM, ShapeRadius.CONTROL, FontSize.REGULAR, LineHeight.REGULAR, Color.MAIN, Color.CLEAR, Color.BRIGHT, Color.FROZEN, Color.PHANTOM);
|
package/package.json
CHANGED
|
@@ -73,7 +73,7 @@ export function FieldShell({
|
|
|
73
73
|
"$minWidth": minWidth,
|
|
74
74
|
"$autosize": autosize,
|
|
75
75
|
"$tightLeft": tightLeft,
|
|
76
|
-
onMouseDown: onShellMouseDown,
|
|
76
|
+
onMouseDown: disabled ? undefined : onShellMouseDown,
|
|
77
77
|
onBlur: onShellBlur,
|
|
78
78
|
children: [_jsx(ShellInner, {
|
|
79
79
|
children: children
|
|
@@ -90,6 +90,7 @@ export function FieldShell({
|
|
|
90
90
|
})
|
|
91
91
|
}), showChevron && _jsx(IndicatorButton, {
|
|
92
92
|
tabIndex: -1,
|
|
93
|
+
disabled: disabled,
|
|
93
94
|
"aria-label": isOpen ? 'Close' : 'Open',
|
|
94
95
|
onMouseDown: e => {
|
|
95
96
|
e.preventDefault();
|
|
@@ -55,7 +55,7 @@ export const IndicatorButton = styled.button.attrs({
|
|
|
55
55
|
}).withConfig({
|
|
56
56
|
displayName: "IndicatorButton",
|
|
57
57
|
componentId: "sc-1pvwhhw-5"
|
|
58
|
-
})(["display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;color:", ";cursor:pointer;border-radius:", ";transition:color 0.15s ease,background-color 0.15s ease;&:hover{color:", ";background-color:", ";}"], Color.PHANTOM, ShapeRadius.CONTROL, Color.MAIN, Color.FROZEN);
|
|
58
|
+
})(["display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;color:", ";cursor:pointer;border-radius:", ";transition:color 0.15s ease,background-color 0.15s ease;&:hover{color:", ";background-color:", ";}&:disabled{cursor:default;}"], Color.PHANTOM, ShapeRadius.CONTROL, Color.MAIN, Color.FROZEN);
|
|
59
59
|
export const Dropdown = styled.div.withConfig({
|
|
60
60
|
displayName: "Dropdown",
|
|
61
61
|
componentId: "sc-1pvwhhw-6"
|
|
@@ -4,11 +4,12 @@ type Args = {
|
|
|
4
4
|
open: () => void;
|
|
5
5
|
onClose?: () => void;
|
|
6
6
|
autoFocus?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
7
8
|
inputRef: RefObject<HTMLInputElement>;
|
|
8
9
|
};
|
|
9
10
|
/**
|
|
10
11
|
* Side effects tied to a Combobox field's open state: optional autofocus on mount
|
|
11
12
|
* and firing `onClose` when the field closes.
|
|
12
13
|
*/
|
|
13
|
-
export declare function useFieldOpenEffects({ isOpen, open, onClose, autoFocus, inputRef, }: Args): void;
|
|
14
|
+
export declare function useFieldOpenEffects({ isOpen, open, onClose, autoFocus, disabled, inputRef, }: Args): void;
|
|
14
15
|
export {};
|
|
@@ -8,6 +8,7 @@ export function useFieldOpenEffects({
|
|
|
8
8
|
open,
|
|
9
9
|
onClose,
|
|
10
10
|
autoFocus,
|
|
11
|
+
disabled,
|
|
11
12
|
inputRef
|
|
12
13
|
}) {
|
|
13
14
|
const onCloseRef = useRef(onClose);
|
|
@@ -19,9 +20,9 @@ export function useFieldOpenEffects({
|
|
|
19
20
|
}, [isOpen]);
|
|
20
21
|
const didAutoFocusRef = useRef(false);
|
|
21
22
|
useEffect(() => {
|
|
22
|
-
if (!autoFocus || didAutoFocusRef.current) return;
|
|
23
|
+
if (!autoFocus || disabled || didAutoFocusRef.current) return;
|
|
23
24
|
didAutoFocusRef.current = true;
|
|
24
25
|
inputRef.current?.focus();
|
|
25
26
|
open();
|
|
26
|
-
}, [autoFocus, open, inputRef]);
|
|
27
|
+
}, [autoFocus, disabled, open, inputRef]);
|
|
27
28
|
}
|