oolib 2.82.2 → 2.83.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/Container/index.styled.js +3 -8
- package/dist/components/Dropdowns/DropdownMulti/index.js +1 -1
- package/dist/components/Dropdowns/DropdownSingle/index.js +1 -1
- package/dist/components/Dropdowns/utils/getValue.d.ts +4 -2
- package/dist/components/Dropdowns/utils/getValue.js +7 -5
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +1 -0
- package/dist/utils/customHooks/useContainerQuery.d.ts +3 -1
- package/dist/utils/customHooks/useContainerQuery.js +27 -17
- package/package.json +1 -1
|
@@ -30,13 +30,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
exports.StyledContainer = void 0;
|
|
31
31
|
var styled_components_1 = __importStar(require("styled-components"));
|
|
32
32
|
var mixins_1 = require("../../themes/mixins");
|
|
33
|
-
exports.StyledContainer = styled_components_1.default.div(
|
|
33
|
+
exports.StyledContainer = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: 0 2rem;\n\n ", "\n"], ["\n padding: 0 2rem;\n\n ", "\n"])), function (_a) {
|
|
34
34
|
var containerQuery = _a.containerQuery;
|
|
35
|
-
|
|
36
|
-
return (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), containerQuery("sm", (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["padding: 0 6rem;"], ["padding: 0 6rem;"])))));
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
return (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", " {\n padding: 0 6rem;\n }\n "], ["\n ", " {\n padding: 0 6rem;\n }\n "])), (0, mixins_1.mediaQuery)("sm"));
|
|
40
|
-
}
|
|
35
|
+
return containerQuery ? containerQuery('sm')(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 0 6rem\n "], ["\n padding: 0 6rem\n "]))) : (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", " {\n padding: 0 2rem;\n }\n "], ["\n ", " {\n padding: 0 2rem;\n }\n "])), (0, mixins_1.mediaQuery)("sm"));
|
|
41
36
|
});
|
|
42
|
-
var templateObject_1, templateObject_2, templateObject_3
|
|
37
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -66,7 +66,7 @@ function DropdownMulti(_a) {
|
|
|
66
66
|
S = _a.S, disabled = _a.disabled, broadcastShowOptions = _a.broadcastShowOptions;
|
|
67
67
|
var theme = (0, styled_components_1.useTheme)();
|
|
68
68
|
var props = arguments[0];
|
|
69
|
-
var value = (0, getValue_1.getValue_MULTI)({ valueProp: valueProp, optionsFn: optionsFn, options: optionsProp, theme: theme });
|
|
69
|
+
var value = (0, getValue_1.getValue_MULTI)({ valueProp: valueProp, optionsFn: optionsFn, options: optionsProp, theme: theme, saveValueAsString: saveValueAsString });
|
|
70
70
|
//1 INIT REFS
|
|
71
71
|
var _b = (0, useCreateDropdownRefs_1.useCreateDropdownRefs)(), selectRef = _b.selectRef, dropdownRef = _b.dropdownRef;
|
|
72
72
|
//2 INIT SHOW OPTIONS STATE
|
|
@@ -75,7 +75,7 @@ function DropdownSingle(_a) {
|
|
|
75
75
|
;
|
|
76
76
|
var theme = (0, styled_components_1.useTheme)();
|
|
77
77
|
var props = arguments[0];
|
|
78
|
-
var value = (0, getValue_1.getValue_SINGLE)({ valueProp: valueProp, optionsFn: optionsFn, options: optionsProp, theme: theme });
|
|
78
|
+
var value = (0, getValue_1.getValue_SINGLE)({ valueProp: valueProp, optionsFn: optionsFn, options: optionsProp, theme: theme, saveValueAsString: saveValueAsString });
|
|
79
79
|
//1 INIT REFS
|
|
80
80
|
var _b = (0, useCreateDropdownRefs_1.useCreateDropdownRefs)(), selectRef = _b.selectRef, dropdownRef = _b.dropdownRef;
|
|
81
81
|
//2 INIT SHOW OPTIONS STATE
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
export function getValue_SINGLE({ valueProp, optionsFn, options, theme }: {
|
|
1
|
+
export function getValue_SINGLE({ valueProp, optionsFn, options, theme, saveValueAsString }: {
|
|
2
2
|
valueProp: any;
|
|
3
3
|
optionsFn: any;
|
|
4
4
|
options: any;
|
|
5
5
|
theme: any;
|
|
6
|
+
saveValueAsString: any;
|
|
6
7
|
}): any;
|
|
7
|
-
export function getValue_MULTI({ valueProp, optionsFn, options, theme }: {
|
|
8
|
+
export function getValue_MULTI({ valueProp, optionsFn, options, theme, saveValueAsString }: {
|
|
8
9
|
valueProp: any;
|
|
9
10
|
optionsFn: any;
|
|
10
11
|
options: any;
|
|
11
12
|
theme: any;
|
|
13
|
+
saveValueAsString: any;
|
|
12
14
|
}): any;
|
|
@@ -9,18 +9,20 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.getValue_MULTI = exports.getValue_SINGLE = void 0;
|
|
11
11
|
var getAllOptionsFns_1 = require("./getAllOptionsFns");
|
|
12
|
+
// Note: - saveValueAsString can be misleading here, because the value could be a string, integer, boolean values
|
|
13
|
+
// maybe we can rename to saveValueOnly, or some better name
|
|
12
14
|
var getValue_SINGLE = function (_a) {
|
|
13
15
|
var _b;
|
|
14
|
-
var valueProp = _a.valueProp, optionsFn = _a.optionsFn, options = _a.options, theme = _a.theme;
|
|
15
|
-
return
|
|
16
|
+
var valueProp = _a.valueProp, optionsFn = _a.optionsFn, options = _a.options, theme = _a.theme, saveValueAsString = _a.saveValueAsString;
|
|
17
|
+
return saveValueAsString
|
|
16
18
|
? (optionsFn ? (_b = (0, getAllOptionsFns_1.getAllOptionsFns)(theme))[optionsFn.fn].apply(_b, (optionsFn.args || [])) : options).find(function (d) { return d.value === valueProp; })
|
|
17
19
|
: valueProp;
|
|
18
20
|
};
|
|
19
21
|
exports.getValue_SINGLE = getValue_SINGLE;
|
|
20
22
|
var getValue_MULTI = function (_a) {
|
|
21
|
-
var valueProp = _a.valueProp, optionsFn = _a.optionsFn, options = _a.options, theme = _a.theme;
|
|
22
|
-
return
|
|
23
|
-
? valueProp.map(function (vProp) {
|
|
23
|
+
var valueProp = _a.valueProp, optionsFn = _a.optionsFn, options = _a.options, theme = _a.theme, saveValueAsString = _a.saveValueAsString;
|
|
24
|
+
return saveValueAsString
|
|
25
|
+
? valueProp === null || valueProp === void 0 ? void 0 : valueProp.map(function (vProp) {
|
|
24
26
|
var _a;
|
|
25
27
|
return (optionsFn ? (_a = (0, getAllOptionsFns_1.getAllOptionsFns)(theme))[optionsFn.fn].apply(_a, (optionsFn.args || [])) : options).find(function (d) { return d.value === vProp; });
|
|
26
28
|
})
|
package/dist/icons/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export namespace icons {
|
|
|
3
3
|
export { PencilLine };
|
|
4
4
|
export { Plus };
|
|
5
5
|
export { Lightbulb };
|
|
6
|
+
export { Tag };
|
|
6
7
|
export { UploadSimple };
|
|
7
8
|
export { CaretLeft };
|
|
8
9
|
export { CaretRight };
|
|
@@ -161,6 +162,7 @@ import { PencilSimple } from "phosphor-react";
|
|
|
161
162
|
import { PencilLine } from "phosphor-react";
|
|
162
163
|
import { Plus } from "phosphor-react";
|
|
163
164
|
import { Lightbulb } from "phosphor-react";
|
|
165
|
+
import { Tag } from "phosphor-react";
|
|
164
166
|
import { UploadSimple } from "phosphor-react";
|
|
165
167
|
import { CaretLeft } from "phosphor-react";
|
|
166
168
|
import { CaretRight } from "phosphor-react";
|
package/dist/icons/index.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.icons = {
|
|
|
8
8
|
PencilLine: phosphor_react_1.PencilLine,
|
|
9
9
|
Plus: phosphor_react_1.Plus,
|
|
10
10
|
Lightbulb: phosphor_react_1.Lightbulb,
|
|
11
|
+
Tag: phosphor_react_1.Tag,
|
|
11
12
|
UploadSimple: phosphor_react_1.UploadSimple,
|
|
12
13
|
CaretLeft: phosphor_react_1.CaretLeft,
|
|
13
14
|
CaretRight: phosphor_react_1.CaretRight,
|
|
@@ -1,33 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useContainerQuery = void 0;
|
|
7
|
-
var resize_observer_1 = __importDefault(require("@react-hook/resize-observer"));
|
|
8
4
|
var mixins_1 = require("../../themes/mixins");
|
|
9
5
|
var react_1 = require("react");
|
|
10
6
|
var useContainerQuery = function (options) {
|
|
11
7
|
if (options === void 0) { options = {}; }
|
|
12
8
|
var enabled = options.enabled;
|
|
13
9
|
var ref = (0, react_1.useRef)(null);
|
|
14
|
-
var _a = (0, react_1.useState)(
|
|
15
|
-
(0,
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
var _a = (0, react_1.useState)({ width: 0, height: 0 }), containerSize = _a[0], setContainerSize = _a[1];
|
|
11
|
+
(0, react_1.useEffect)(function () {
|
|
12
|
+
var resizeObserver = new ResizeObserver(function (entries) {
|
|
13
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
14
|
+
var entry = entries_1[_i];
|
|
15
|
+
var _a = entry.contentBoxSize[0], inlineSize = _a.inlineSize, blockSize = _a.blockSize;
|
|
16
|
+
setContainerSize({ width: inlineSize, height: blockSize });
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
if (ref.current) {
|
|
20
|
+
resizeObserver.observe(ref.current);
|
|
21
|
+
}
|
|
22
|
+
return function () {
|
|
23
|
+
if (ref.current) {
|
|
24
|
+
resizeObserver.unobserve(ref.current);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}, [ref]);
|
|
19
28
|
//if container queries are written for multiple breakpoints
|
|
20
29
|
//then they must be written in the order of small to big.
|
|
21
30
|
//so for example, the 'sm' query should be written before the 'md'
|
|
22
31
|
//query and so on. Else bugs will happen.
|
|
23
|
-
var containerQuery = function (
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return ({
|
|
32
|
+
var containerQuery = function (point) { return function (styles) {
|
|
33
|
+
var breakpointWidth = (0, mixins_1.getBreakPoint)(point);
|
|
34
|
+
return containerSize.width >= breakpointWidth ? styles : '';
|
|
35
|
+
}; };
|
|
36
|
+
return {
|
|
29
37
|
ref: enabled ? ref : undefined,
|
|
30
|
-
containerQuery: enabled ? containerQuery : undefined
|
|
31
|
-
|
|
38
|
+
containerQuery: enabled ? containerQuery : undefined,
|
|
39
|
+
containerWidth: containerSize.width,
|
|
40
|
+
containerHeight: containerSize.height
|
|
41
|
+
};
|
|
32
42
|
};
|
|
33
43
|
exports.useContainerQuery = useContainerQuery;
|