@orfium/ictinus 4.56.1 → 4.58.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/components/Chip/Chip.js +2 -1
- package/dist/components/DatePicker/DatePicker.js +11 -13
- package/dist/components/Select/Select.d.ts +16 -6
- package/dist/components/Select/Select.js +92 -26
- package/dist/components/Select/components/MultiselectTextField/MultiselectTextField.d.ts +19 -0
- package/dist/components/Select/components/MultiselectTextField/MultiselectTextField.js +186 -0
- package/dist/components/Select/components/MultiselectTextField/MultiselectTextField.style.d.ts +55 -0
- package/dist/components/Select/components/MultiselectTextField/MultiselectTextField.style.js +149 -0
- package/dist/components/Select/components/MultiselectTextField/index.d.ts +1 -0
- package/dist/components/Select/components/MultiselectTextField/index.js +10 -0
- package/dist/components/Select/hooks/useMultiselectUtils.d.ts +21 -0
- package/dist/components/Select/hooks/useMultiselectUtils.js +99 -0
- package/dist/components/TextField/TextField.d.ts +2 -1
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/utils/PositionInScreen/PositionInScreen.d.ts +8 -1
- package/dist/components/utils/PositionInScreen/PositionInScreen.js +19 -66
- package/dist/components/utils/PositionInScreen/PositionInScreen.style.d.ts +2 -3
- package/dist/components/utils/PositionInScreen/PositionInScreen.style.js +7 -5
- package/dist/components/utils/PositionInScreen/hooks.d.ts +5 -0
- package/dist/components/utils/PositionInScreen/hooks.js +98 -0
- package/dist/utils/size-utils.d.ts +1 -0
- package/dist/utils/size-utils.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.useWrapperWidth = exports.usePositionInScreen = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = require("react");
|
|
7
|
+
|
|
8
|
+
var usePositionInScreen = function usePositionInScreen(parentRef, itemRef, offsetX, offsetY, visible) {
|
|
9
|
+
var _useState = (0, _react.useState)({
|
|
10
|
+
x: -1,
|
|
11
|
+
y: -1
|
|
12
|
+
}),
|
|
13
|
+
position = _useState[0],
|
|
14
|
+
setPosition = _useState[1];
|
|
15
|
+
|
|
16
|
+
(0, _react.useEffect)(function () {
|
|
17
|
+
var _parentRef$current, _itemRef$current, _itemRef$current$chil;
|
|
18
|
+
|
|
19
|
+
// x,y are cordinates in screen
|
|
20
|
+
// width, height are wrapper elements dimensions
|
|
21
|
+
var _ref = parentRef != null && parentRef.current ? parentRef == null ? void 0 : (_parentRef$current = parentRef.current) == null ? void 0 : _parentRef$current.getBoundingClientRect() : {
|
|
22
|
+
x: 0,
|
|
23
|
+
y: 0,
|
|
24
|
+
width: 0,
|
|
25
|
+
height: 0
|
|
26
|
+
},
|
|
27
|
+
parentX = _ref.x,
|
|
28
|
+
parentY = _ref.y,
|
|
29
|
+
parentWidth = _ref.width,
|
|
30
|
+
parentHeight = _ref.height; // width, height are the element's that's going to be positioned dimensions
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
var _ref2 = itemRef != null && itemRef.current ? itemRef == null ? void 0 : (_itemRef$current = itemRef.current) == null ? void 0 : (_itemRef$current$chil = _itemRef$current.children[0]) == null ? void 0 : _itemRef$current$chil.getBoundingClientRect() : {
|
|
34
|
+
width: 0,
|
|
35
|
+
height: 0
|
|
36
|
+
},
|
|
37
|
+
width = _ref2.width,
|
|
38
|
+
height = _ref2.height; // If the item-to-be-positioned is out of screen height
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
var itemYOutOfScreenHeight = parentY + parentHeight + height > window.innerHeight; // The element that we are positioning is absolutely positioned inside the relative
|
|
42
|
+
// container. So x,y are zero means the element will be positioned exactly on top
|
|
43
|
+
// of the parent element.
|
|
44
|
+
|
|
45
|
+
var x = 0;
|
|
46
|
+
var y = 0;
|
|
47
|
+
|
|
48
|
+
if (itemYOutOfScreenHeight) {
|
|
49
|
+
// We place the element height+offsetY (px) above the parent
|
|
50
|
+
y = y - height - offsetY;
|
|
51
|
+
|
|
52
|
+
if (parentY + y < 0) {
|
|
53
|
+
// Rare case where client height is super small. We don't exactly support this.
|
|
54
|
+
// So we render it as if it was inside the screen height
|
|
55
|
+
y = parentHeight + offsetY;
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
// We place the element offsetY (px) under the parent
|
|
59
|
+
y = parentHeight + offsetY;
|
|
60
|
+
} // If the item-to-be-positioned is out of screen width
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
var itemXOutOfScreenWidth = parentX + width > window.innerWidth;
|
|
64
|
+
|
|
65
|
+
if (itemXOutOfScreenWidth) {
|
|
66
|
+
// We place the element parentWidth-width-offsetX (px) at the left of the parent
|
|
67
|
+
x = x + parentWidth - width - offsetX;
|
|
68
|
+
} else {
|
|
69
|
+
// We place the element offset (px) at the right of the parent
|
|
70
|
+
x = offsetX;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
setPosition({
|
|
74
|
+
x: x,
|
|
75
|
+
y: y
|
|
76
|
+
});
|
|
77
|
+
}, [parentRef, itemRef, visible, offsetY, offsetX]);
|
|
78
|
+
return position;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
exports.usePositionInScreen = usePositionInScreen;
|
|
82
|
+
|
|
83
|
+
var useWrapperWidth = function useWrapperWidth(hasWrapperWidth, wrapperRef) {
|
|
84
|
+
var _useState2 = (0, _react.useState)(),
|
|
85
|
+
width = _useState2[0],
|
|
86
|
+
setWidth = _useState2[1];
|
|
87
|
+
|
|
88
|
+
(0, _react.useEffect)(function () {
|
|
89
|
+
if (hasWrapperWidth) {
|
|
90
|
+
var _wrapperRef$current, _wrapperRef$current$g;
|
|
91
|
+
|
|
92
|
+
setWidth(wrapperRef == null ? void 0 : (_wrapperRef$current = wrapperRef.current) == null ? void 0 : (_wrapperRef$current$g = _wrapperRef$current.getBoundingClientRect()) == null ? void 0 : _wrapperRef$current$g.width);
|
|
93
|
+
}
|
|
94
|
+
}, [hasWrapperWidth, wrapperRef]);
|
|
95
|
+
return [width];
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.useWrapperWidth = useWrapperWidth;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Theme } from '../theme';
|
|
2
2
|
declare type Size = 'md' | 'sm';
|
|
3
3
|
export declare const DEFAULT_SIZE: Size;
|
|
4
|
+
export declare const getTextFieldHeight: (size?: Size | undefined) => string;
|
|
4
5
|
export declare const getTextFieldSize: (hasMinWidthCompat?: boolean, size?: Size | undefined) => {
|
|
5
6
|
minWidth?: string;
|
|
6
7
|
height: string;
|
package/dist/utils/size-utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.getSpacingBySize = exports.getTextFieldSize = exports.DEFAULT_SIZE = void 0;
|
|
4
|
+
exports.getSpacingBySize = exports.getTextFieldSize = exports.getTextFieldHeight = exports.DEFAULT_SIZE = void 0;
|
|
5
5
|
|
|
6
6
|
var _polished = require("polished");
|
|
7
7
|
|
|
@@ -23,6 +23,8 @@ var getTextFieldHeight = function getTextFieldHeight(size) {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
exports.getTextFieldHeight = getTextFieldHeight;
|
|
27
|
+
|
|
26
28
|
var getTextFieldWidth = function getTextFieldWidth(size) {
|
|
27
29
|
switch (size) {
|
|
28
30
|
case 'md':
|