@via-profit/ui-kit 0.2.2 → 0.2.3
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/Autocomplete/AutocompleteContainer.d.ts +5 -4
- package/Autocomplete/AutocompleteContainer.js +128 -142
- package/Autocomplete/AutocompleteItem.js +1 -1
- package/Autocomplete/context.d.ts +3 -5
- package/Autocomplete/context.js +22 -14
- package/Highlighted/index.js +10 -5
- package/Highlighted/splitTextIntoParts.d.ts +5 -0
- package/Highlighted/splitTextIntoParts.js +46 -0
- package/Menu/MenuContainer.d.ts +24 -2
- package/Menu/MenuContainer.js +193 -242
- package/Menu/MenuList.d.ts +1 -0
- package/Menu/MenuList.js +15 -16
- package/Popper/Popper.d.ts +3 -2
- package/Popper/Popper.js +9 -7
- package/Popper/PopperContainer.d.ts +0 -1
- package/Popper/PopperContainer.js +8 -3
- package/Popper/index.d.ts +1 -1
- package/Popper/index.js +1 -1
- package/Popper/usePopper.d.ts +111 -0
- package/Popper/usePopper.js +522 -0
- package/Selectbox/SelectboxButton.js +2 -27
- package/Selectbox/SelectboxMenu.d.ts +0 -2
- package/Selectbox/SelectboxMenu.js +13 -5
- package/Selectbox/index.d.ts +5 -3
- package/Selectbox/index.js +4 -4
- package/Swiper/Swiper.d.ts +0 -2
- package/Swiper/Swiper.js +1 -18
- package/package.json +1 -1
package/Selectbox/index.js
CHANGED
|
@@ -70,9 +70,8 @@ const generateGuid = () => {
|
|
|
70
70
|
].join('-');
|
|
71
71
|
};
|
|
72
72
|
const Selectbox = React.forwardRef((props, ref) => {
|
|
73
|
-
const { items, value, multiple, isOpen = false, isLoading = false, anchorPos = 'bottom-fill', fullWidth = false, children, onChange, selectedItemToString, getOptionSelected, onRequestOpen = () => undefined, onRequestClose = () => undefined, overrides, id, label, onFocus, requiredAsterisk, error, errorText, notSetLabel = 'Not set' } = props, nativeButtonProps = __rest(props, ["items", "value", "multiple", "isOpen", "isLoading", "anchorPos", "fullWidth", "children", "onChange", "selectedItemToString", "getOptionSelected", "onRequestOpen", "onRequestClose", "overrides", "id", "label", "onFocus", "requiredAsterisk", "error", "errorText", "notSetLabel"]);
|
|
73
|
+
const { items, value, multiple, isOpen = false, isLoading = false, anchorPos = 'bottom-fill', fullWidth = false, children, onChange, selectedItemToString, getOptionSelected, onRequestOpen = () => undefined, onRequestClose = () => undefined, overrides, id, label, onFocus, requiredAsterisk, error, errorText, notSetLabel = 'Not set', autoFlip = true, positionStrategy } = props, nativeButtonProps = __rest(props, ["items", "value", "multiple", "isOpen", "isLoading", "anchorPos", "fullWidth", "children", "onChange", "selectedItemToString", "getOptionSelected", "onRequestOpen", "onRequestClose", "overrides", "id", "label", "onFocus", "requiredAsterisk", "error", "errorText", "notSetLabel", "autoFlip", "positionStrategy"]);
|
|
74
74
|
const menuRef = React.useRef(null);
|
|
75
|
-
const [actualPlacement, setActualPlacement] = React.useState(anchorPos);
|
|
76
75
|
const [anchorElement, setAnchorElement] = React.useState(null);
|
|
77
76
|
const overridesMap = React.useMemo(() => (Object.assign(Object.assign({}, DEFAULT_OVERRIDES), overrides)), [overrides]);
|
|
78
77
|
const inputID = React.useMemo(() => {
|
|
@@ -136,7 +135,8 @@ const Selectbox = React.forwardRef((props, ref) => {
|
|
|
136
135
|
}, [handleMouseDown]);
|
|
137
136
|
const buttonProps = React.useMemo(() => (Object.assign({ fullWidth,
|
|
138
137
|
error,
|
|
139
|
-
isOpen,
|
|
138
|
+
isOpen,
|
|
139
|
+
anchorPos, endIcon: isLoading ? React.createElement(Spinner_1.default, null) : React.createElement(overridesMap.Icon, { isOpen: isOpen }) }, nativeButtonProps)), [fullWidth, error, isOpen, anchorPos, isLoading, overridesMap, nativeButtonProps]);
|
|
140
140
|
const labelProps = React.useMemo(() => ({
|
|
141
141
|
htmlFor: inputID,
|
|
142
142
|
error,
|
|
@@ -151,7 +151,7 @@ const Selectbox = React.forwardRef((props, ref) => {
|
|
|
151
151
|
React.createElement(overridesMap.ButtonWrapper, { fullWidth: fullWidth, error: error, isOpen: isOpen },
|
|
152
152
|
React.createElement(overridesMap.Button, Object.assign({}, buttonProps, { onClick: handleButtonClick, ref: setRefs }), renderValueAsString())),
|
|
153
153
|
React.createElement(overridesMap.ErrorText, { error: error }, errorText),
|
|
154
|
-
React.createElement(SelectboxMenu_1.default, {
|
|
154
|
+
React.createElement(SelectboxMenu_1.default, { multiple: multiple, items: items, value: value, isOpen: isOpen, anchorPos: anchorPos, positionStrategy: positionStrategy, autoFlip: autoFlip, alternativePlacements: ['bottom-fill', 'top-fill'], anchorElement: anchorElement, getOptionSelected: getOptionSelected, onChange: onChange, onRequestClose: onRequestClose, ref: menuRef }, children)));
|
|
155
155
|
});
|
|
156
156
|
Selectbox.displayName = 'Selectbox';
|
|
157
157
|
exports.default = Selectbox;
|
package/Swiper/Swiper.d.ts
CHANGED
|
@@ -30,7 +30,6 @@ export type SwiperProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>
|
|
|
30
30
|
readonly autoplay?: boolean;
|
|
31
31
|
readonly autoplayInterval?: number;
|
|
32
32
|
readonly pauseOnHover?: boolean;
|
|
33
|
-
readonly keyboardControl?: boolean;
|
|
34
33
|
readonly threshold?: number;
|
|
35
34
|
readonly resistance?: boolean;
|
|
36
35
|
readonly slidesPerView?: number;
|
|
@@ -47,7 +46,6 @@ export declare const Swiper: React.ForwardRefExoticComponent<Omit<React.HTMLAttr
|
|
|
47
46
|
readonly autoplay?: boolean | undefined;
|
|
48
47
|
readonly autoplayInterval?: number | undefined;
|
|
49
48
|
readonly pauseOnHover?: boolean | undefined;
|
|
50
|
-
readonly keyboardControl?: boolean | undefined;
|
|
51
49
|
readonly threshold?: number | undefined;
|
|
52
50
|
readonly resistance?: boolean | undefined;
|
|
53
51
|
readonly slidesPerView?: number | undefined;
|
package/Swiper/Swiper.js
CHANGED
|
@@ -48,7 +48,7 @@ const SwiperTrack_1 = __importDefault(require("./SwiperTrack"));
|
|
|
48
48
|
const SwiperSlidesRenderer_1 = __importDefault(require("./SwiperSlidesRenderer"));
|
|
49
49
|
__exportStar(require("./SwiperSlide"), exports);
|
|
50
50
|
exports.Swiper = React.forwardRef((props, ref) => {
|
|
51
|
-
const { children, dragThreshold = 240, snap = true, draggable = true, overrides, initialIndex = 0, infinite = false, onSlideChange, autoplay = false, autoplayInterval = 3000, pauseOnHover = true,
|
|
51
|
+
const { children, dragThreshold = 240, snap = true, draggable = true, overrides, initialIndex = 0, infinite = false, onSlideChange, autoplay = false, autoplayInterval = 3000, pauseOnHover = true, threshold = 20, resistance = true, slidesPerView = 1 } = props, restProps = __rest(props, ["children", "dragThreshold", "snap", "draggable", "overrides", "initialIndex", "infinite", "onSlideChange", "autoplay", "autoplayInterval", "pauseOnHover", "threshold", "resistance", "slidesPerView"]);
|
|
52
52
|
// #region Slides
|
|
53
53
|
const slides = React.useMemo(() => {
|
|
54
54
|
const childrenSlides = Array.isArray(children)
|
|
@@ -308,23 +308,6 @@ exports.Swiper = React.forwardRef((props, ref) => {
|
|
|
308
308
|
const resume = React.useCallback(() => {
|
|
309
309
|
setIsPaused(false);
|
|
310
310
|
}, []);
|
|
311
|
-
// #region Keyboard
|
|
312
|
-
React.useEffect(() => {
|
|
313
|
-
if (!keyboardControl)
|
|
314
|
-
return;
|
|
315
|
-
const handleKeyDown = (e) => {
|
|
316
|
-
if (e.key === 'ArrowLeft') {
|
|
317
|
-
e.preventDefault();
|
|
318
|
-
prev();
|
|
319
|
-
}
|
|
320
|
-
else if (e.key === 'ArrowRight') {
|
|
321
|
-
e.preventDefault();
|
|
322
|
-
next();
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
326
|
-
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
327
|
-
}, [keyboardControl, prev, next]);
|
|
328
311
|
// #region Hover
|
|
329
312
|
React.useEffect(() => {
|
|
330
313
|
if (!autoplay || !pauseOnHover)
|