@homecode/ui 4.20.0-beta-1 → 4.20.0-beta-2
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/Autocomplete/Autocomplete.js +3 -10
- package/dist/esm/src/components/Select/Select2.js +3 -2
- package/dist/esm/src/components/Shimmer/Shimmer.js +1 -1
- package/dist/esm/src/components/Shimmer/Shimmer.styl.js +2 -2
- package/dist/esm/types/src/components/Menu/Menu.types.d.ts +2 -1
- package/dist/esm/types/src/components/Select/Select.types.d.ts +1 -0
- package/dist/esm/types/src/components/Shimmer/Shimmer.d.ts +2 -1
- package/package.json +1 -1
|
@@ -62,7 +62,6 @@ function Autocomplete(props) {
|
|
|
62
62
|
const [searchValue, setSearchValue] = useState(value);
|
|
63
63
|
const [options, setOptions] = useState([]);
|
|
64
64
|
const [isLoading, setIsLoading] = useState(false);
|
|
65
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
66
65
|
const currentRequest = useRef('');
|
|
67
66
|
// @ts-ignore
|
|
68
67
|
const inputRef = useRef(null);
|
|
@@ -124,17 +123,11 @@ function Autocomplete(props) {
|
|
|
124
123
|
const optionsList = useMemo(() => {
|
|
125
124
|
if (!options.length)
|
|
126
125
|
return null;
|
|
127
|
-
return (jsx(Menu, { className: S.options, size: size, children: options.map((option, index) => (jsx(Menu.Item, { focused: focusedIndex === index, className: S.option, onClick: () => handleSelect(option.label), onMouseEnter: () => setFocusedIndex(index), children: option.label }, option.id))) }));
|
|
126
|
+
return (jsx(Menu, { className: S.options, size: size, offset: { y: { before: 20, after: 20 } }, children: options.map((option, index) => (jsx(Menu.Item, { focused: focusedIndex === index, className: S.option, onClick: () => handleSelect(option.label), onMouseEnter: () => setFocusedIndex(index), children: option.label }, option.id))) }));
|
|
128
127
|
}, [options, focusedIndex]);
|
|
129
|
-
return (jsx(Popup, { className: classes, isOpen: isOpen, focusControl: true, size: size, ...popupProps, trigger: jsxs("div", { className: inputWrapperClassName, children: [jsx(Input, { ref: inputRef,
|
|
128
|
+
return (jsx(Popup, { className: classes, isOpen: isOpen, focusControl: true, size: size, direction: "bottom", ...popupProps, trigger: jsxs("div", { className: inputWrapperClassName, children: [jsx(Input, { ref: inputRef,
|
|
130
129
|
// @ts-ignore
|
|
131
|
-
size: size, ...inputProps, value: searchValue, onChange: handleInputChange, className: inputProps.className,
|
|
132
|
-
setIsFocused(true);
|
|
133
|
-
inputProps.onFocus?.(e);
|
|
134
|
-
}, onBlur: e => {
|
|
135
|
-
setIsFocused(false);
|
|
136
|
-
inputProps.onBlur?.(e);
|
|
137
|
-
} }), isLoading && jsx(Shimmer, { className: S.shimmer, size: size })] }), content: optionsList, contentProps: {
|
|
130
|
+
size: size, ...inputProps, value: searchValue, onChange: handleInputChange, className: inputProps.className }), isLoading && (jsx(Shimmer, { className: S.shimmer, size: size, round: inputProps?.round }))] }), content: optionsList, contentProps: {
|
|
138
131
|
className: S.popupContent,
|
|
139
132
|
} }));
|
|
140
133
|
}
|
|
@@ -17,7 +17,7 @@ import useEvent from '../../hooks/useEvent.js';
|
|
|
17
17
|
import S from './Select.styl.js';
|
|
18
18
|
|
|
19
19
|
function Select2(props) {
|
|
20
|
-
const { className, value, onChange, onSearchChange, inputProps, popupProps, size = 'm', optionClassName, additionalOptions = [], options, variant, label, error, blur, disabled, trigger, required, hideRequiredStar, isSearchable, presets = [], selectAllButton, clearButton, showSelectedCount, disableLabel, } = props;
|
|
20
|
+
const { className, value, onChange, onSearchChange, inputProps, popupProps, size = 'm', round, optionClassName, additionalOptions = [], options, variant, label, error, blur, disabled, trigger, required, hideRequiredStar, isSearchable, presets = [], selectAllButton, clearButton, showSelectedCount, disableLabel, } = props;
|
|
21
21
|
const isMultiple$1 = isMultiple(value);
|
|
22
22
|
const closeOnSelect = props.closeOnSelect ?? !isMultiple$1;
|
|
23
23
|
const contentRef = useRef(null);
|
|
@@ -46,9 +46,10 @@ function Select2(props) {
|
|
|
46
46
|
const triggerProps = useMemo(() => ({
|
|
47
47
|
label,
|
|
48
48
|
size,
|
|
49
|
+
round,
|
|
49
50
|
variant,
|
|
50
51
|
...props.triggerProps,
|
|
51
|
-
}), [props.triggerProps, label, size, variant]);
|
|
52
|
+
}), [props.triggerProps, label, size, round, variant]);
|
|
52
53
|
// Simplified isSelected check
|
|
53
54
|
const isSelected = (id) =>
|
|
54
55
|
// @ts-ignore
|
|
@@ -2,6 +2,6 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import S from './Shimmer.styl.js';
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
|
|
5
|
-
const Shimmer = ({ className, size = 'm' }) => (jsx("div", { className: cn(S.root, className, S[`size-${size}`]), children: jsx("div", { className: S.inner }) }));
|
|
5
|
+
const Shimmer = ({ className, size = 'm', round = false, }) => (jsx("div", { className: cn(S.root, className, S[`size-${size}`], round && S.round), children: jsx("div", { className: S.inner }) }));
|
|
6
6
|
|
|
7
7
|
export { Shimmer };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".Shimmer_root__XaY5r{height:100%;left:0;overflow:hidden;pointer-events:none;position:absolute;top:0;width:100%}.Shimmer_inner__zssMV{animation:Shimmer_shimmer__hGfzF 1.5s linear infinite;background:linear-gradient(90deg,transparent,hsla(0,0%,100%,.2) 50%,transparent);inset:0;position:absolute}.Shimmer_size-s__EYKhC{border-radius:4px}.Shimmer_size-m__AYziL{border-radius:6px}.Shimmer_size-l__GqE0a{border-radius:8px}@keyframes Shimmer_shimmer__hGfzF{0%{transform:translateX(-100%)}20%{transform:translateX(100%)}to{transform:translateX(100%)}}";
|
|
4
|
-
var S = {"root":"Shimmer_root__XaY5r","inner":"Shimmer_inner__zssMV","shimmer":"Shimmer_shimmer__hGfzF","size-s":"Shimmer_size-s__EYKhC","size-m":"Shimmer_size-m__AYziL","size-l":"Shimmer_size-l__GqE0a"};
|
|
3
|
+
var css_248z = ".Shimmer_root__XaY5r{height:100%;left:0;overflow:hidden;pointer-events:none;position:absolute;top:0;width:100%}.Shimmer_inner__zssMV{animation:Shimmer_shimmer__hGfzF 1.5s linear infinite;background:linear-gradient(90deg,transparent,hsla(0,0%,100%,.2) 50%,transparent);inset:0;position:absolute}.Shimmer_size-s__EYKhC{border-radius:4px}.Shimmer_round__rwhjn.Shimmer_size-s__EYKhC{border-radius:15px}.Shimmer_size-m__AYziL{border-radius:6px}.Shimmer_round__rwhjn.Shimmer_size-m__AYziL{border-radius:20px}.Shimmer_size-l__GqE0a{border-radius:8px}.Shimmer_round__rwhjn.Shimmer_size-l__GqE0a{border-radius:25px}@keyframes Shimmer_shimmer__hGfzF{0%{transform:translateX(-100%)}20%{transform:translateX(100%)}to{transform:translateX(100%)}}";
|
|
4
|
+
var S = {"root":"Shimmer_root__XaY5r","inner":"Shimmer_inner__zssMV","shimmer":"Shimmer_shimmer__hGfzF","size-s":"Shimmer_size-s__EYKhC","round":"Shimmer_round__rwhjn","size-m":"Shimmer_size-m__AYziL","size-l":"Shimmer_size-l__GqE0a"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { Size } from 'uilib/types';
|
|
3
|
-
|
|
3
|
+
import { Props as ScrollProps } from 'uilib/components/Scroll/Scroll.types';
|
|
4
|
+
export interface MenuProps extends ScrollProps {
|
|
4
5
|
children: ReactNode;
|
|
5
6
|
className?: string;
|
|
6
7
|
size?: Size;
|
|
@@ -53,6 +53,7 @@ export type Props = FormControl<Value> & InheritedInputProps & {
|
|
|
53
53
|
onClose?: () => void;
|
|
54
54
|
isSearchable?: boolean;
|
|
55
55
|
inputProps?: Omit<InputProps, 'value' | 'onChange' | 'onFocus' | 'onBlur' | 'size'>;
|
|
56
|
+
round?: boolean;
|
|
56
57
|
trigger?: ReactNode;
|
|
57
58
|
triggerProps?: any;
|
|
58
59
|
popupProps?: SelectPopupProps;
|
|
@@ -2,5 +2,6 @@ import { Size } from 'uilib/types';
|
|
|
2
2
|
export type ShimmerProps = {
|
|
3
3
|
className?: string;
|
|
4
4
|
size?: Size;
|
|
5
|
+
round?: boolean;
|
|
5
6
|
};
|
|
6
|
-
export declare const Shimmer: ({ className, size }: ShimmerProps) => JSX.Element;
|
|
7
|
+
export declare const Shimmer: ({ className, size, round, }: ShimmerProps) => JSX.Element;
|