@doyourjob/gravity-ui-page-constructor 5.31.145-dev.1 → 5.31.146-dev.1
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/build/cjs/components/Filters/Switcher/Switcher.css +3 -0
- package/build/cjs/components/Filters/Switcher/Switcher.js +3 -7
- package/build/esm/components/Filters/Switcher/Switcher.css +3 -0
- package/build/esm/components/Filters/Switcher/Switcher.js +3 -7
- package/package.json +1 -1
- package/widget/index.js +1 -1
|
@@ -74,6 +74,9 @@ unpredictable css rules order in build */
|
|
|
74
74
|
border-radius: var(--g-border-radius-xl);
|
|
75
75
|
background: transparent;
|
|
76
76
|
}
|
|
77
|
+
.pc-filter-switcher__element_placeholder {
|
|
78
|
+
color: var(--g-color-text-hint);
|
|
79
|
+
}
|
|
77
80
|
.pc-filter-switcher__arrow {
|
|
78
81
|
width: 16px;
|
|
79
82
|
height: 16px;
|
|
@@ -11,17 +11,13 @@ const b = (0, utils_1.block)('filter-switcher');
|
|
|
11
11
|
const ICON_SIZE = 12;
|
|
12
12
|
const CLEAR_ICON_SIZE = 11;
|
|
13
13
|
const Switcher = ({ initial, defaultLabel, list, onClick, controlRef, onKeyDown, open, renderClear, popupId, activeIndex, }) => {
|
|
14
|
-
const itemsNames = (0, react_1.useMemo)(() =>
|
|
15
|
-
|
|
16
|
-
.filter((item) => initial.includes(item.value))
|
|
17
|
-
.map((item) => item.content);
|
|
18
|
-
return items.length ? items : [defaultLabel];
|
|
19
|
-
}, [defaultLabel, initial, list]);
|
|
14
|
+
const itemsNames = (0, react_1.useMemo)(() => list.filter((item) => initial.includes(item.value)).map((item) => item.content), [initial, list]);
|
|
15
|
+
const isPlaceholder = itemsNames.length === 0;
|
|
20
16
|
const hasCounter = itemsNames.length > 1;
|
|
21
17
|
const contentElementId = (0, uikit_1.useUniqId)();
|
|
22
18
|
return (react_1.default.createElement("div", { className: b(), ref: controlRef },
|
|
23
19
|
react_1.default.createElement("button", { onClick: onClick, className: b('element', { overlay: true }), onKeyDown: onKeyDown, "aria-expanded": open, "aria-labelledby": contentElementId, "aria-activedescendant": activeIndex === undefined ? undefined : `${popupId}-item-${activeIndex}` }),
|
|
24
|
-
react_1.default.createElement("div", { id: contentElementId, className: b('element', { content: true }), "aria-hidden": true }, itemsNames === null || itemsNames === void 0 ? void 0 : itemsNames.join(', ')),
|
|
20
|
+
react_1.default.createElement("div", { id: contentElementId, className: b('element', { content: true, placeholder: isPlaceholder }), "aria-hidden": true }, isPlaceholder ? defaultLabel : itemsNames === null || itemsNames === void 0 ? void 0 : itemsNames.join(', ')),
|
|
25
21
|
renderClear &&
|
|
26
22
|
renderClear({
|
|
27
23
|
renderIcon: () => (react_1.default.createElement(uikit_1.Icon, { data: CloseIcon_1.CloseIcon, size: CLEAR_ICON_SIZE, className: b('clear') })),
|
|
@@ -74,6 +74,9 @@ unpredictable css rules order in build */
|
|
|
74
74
|
border-radius: var(--g-border-radius-xl);
|
|
75
75
|
background: transparent;
|
|
76
76
|
}
|
|
77
|
+
.pc-filter-switcher__element_placeholder {
|
|
78
|
+
color: var(--g-color-text-hint);
|
|
79
|
+
}
|
|
77
80
|
.pc-filter-switcher__arrow {
|
|
78
81
|
width: 16px;
|
|
79
82
|
height: 16px;
|
|
@@ -8,17 +8,13 @@ const b = block('filter-switcher');
|
|
|
8
8
|
const ICON_SIZE = 12;
|
|
9
9
|
const CLEAR_ICON_SIZE = 11;
|
|
10
10
|
export const Switcher = ({ initial, defaultLabel, list, onClick, controlRef, onKeyDown, open, renderClear, popupId, activeIndex, }) => {
|
|
11
|
-
const itemsNames = useMemo(() =>
|
|
12
|
-
|
|
13
|
-
.filter((item) => initial.includes(item.value))
|
|
14
|
-
.map((item) => item.content);
|
|
15
|
-
return items.length ? items : [defaultLabel];
|
|
16
|
-
}, [defaultLabel, initial, list]);
|
|
11
|
+
const itemsNames = useMemo(() => list.filter((item) => initial.includes(item.value)).map((item) => item.content), [initial, list]);
|
|
12
|
+
const isPlaceholder = itemsNames.length === 0;
|
|
17
13
|
const hasCounter = itemsNames.length > 1;
|
|
18
14
|
const contentElementId = useUniqId();
|
|
19
15
|
return (React.createElement("div", { className: b(), ref: controlRef },
|
|
20
16
|
React.createElement("button", { onClick: onClick, className: b('element', { overlay: true }), onKeyDown: onKeyDown, "aria-expanded": open, "aria-labelledby": contentElementId, "aria-activedescendant": activeIndex === undefined ? undefined : `${popupId}-item-${activeIndex}` }),
|
|
21
|
-
React.createElement("div", { id: contentElementId, className: b('element', { content: true }), "aria-hidden": true }, itemsNames === null || itemsNames === void 0 ? void 0 : itemsNames.join(', ')),
|
|
17
|
+
React.createElement("div", { id: contentElementId, className: b('element', { content: true, placeholder: isPlaceholder }), "aria-hidden": true }, isPlaceholder ? defaultLabel : itemsNames === null || itemsNames === void 0 ? void 0 : itemsNames.join(', ')),
|
|
22
18
|
renderClear &&
|
|
23
19
|
renderClear({
|
|
24
20
|
renderIcon: () => (React.createElement(Icon, { data: CloseIcon, size: CLEAR_ICON_SIZE, className: b('clear') })),
|