@orfium/ictinus 4.84.1 → 4.84.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.
|
@@ -18,7 +18,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
18
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
20
|
var Filter = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
21
|
-
var _selectedItem$label;
|
|
22
21
|
var items = props.items,
|
|
23
22
|
onSelect = props.onSelect,
|
|
24
23
|
selectedItem = props.selectedItem,
|
|
@@ -59,13 +58,15 @@ var Filter = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
59
58
|
var _React$useState2 = _react["default"].useState(''),
|
|
60
59
|
searchValue = _React$useState2[0],
|
|
61
60
|
setSearchValue = _React$useState2[1];
|
|
62
|
-
var _React$useState3 = _react["default"].useState((
|
|
61
|
+
var _React$useState3 = _react["default"].useState((0, _utils.getInitialFilterLabel)(defaultValue, multi, selectedItem, selectedItems)),
|
|
63
62
|
filterLabel = _React$useState3[0],
|
|
64
63
|
setFilterLabel = _React$useState3[1];
|
|
65
64
|
_react["default"].useEffect(function () {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
/** Run this useEffect only for single Filter, multi Filter updates the label on every multi filter chip addition/deletion/clear all */
|
|
66
|
+
if (!multi) {
|
|
67
|
+
setFilterLabel((0, _utils.getInitialFilterLabel)(defaultValue, multi, selectedItem, selectedItems));
|
|
68
|
+
}
|
|
69
|
+
}, [defaultValue, filterLabel, multi, selectedItem, selectedItems]);
|
|
69
70
|
var hasSelectedValue = Boolean(selectedItem == null ? void 0 : selectedItem.value) && (selectedItem == null ? void 0 : selectedItem.value) !== defaultValue.value;
|
|
70
71
|
var iconName = isOpen ? 'triangleUp' : 'triangleDown';
|
|
71
72
|
var _useMultiFilterUtils = (0, _useMultiFilterUtils2["default"])({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsValidationError } from '../../utils/errors';
|
|
2
|
-
import { BackgroundColorProps, BaseColorProps, BorderProps, Props } from './types';
|
|
2
|
+
import { BackgroundColorProps, BaseColorProps, BorderProps, FilterOption, Props } from './types';
|
|
3
3
|
export declare const FILTER_OPTIONS_MAX_HEIGHT = 253;
|
|
4
4
|
export declare const HAS_SELECTED_VALUE_COLOR_SHADE = 50;
|
|
5
5
|
export declare const borderStyleParams: string;
|
|
@@ -16,3 +16,5 @@ export declare const errors: {
|
|
|
16
16
|
condition: ({ filterType, styleType }: Props) => boolean;
|
|
17
17
|
error: PropsValidationError;
|
|
18
18
|
}[];
|
|
19
|
+
/** This callback returns the initial label of the Filter for all combinations */
|
|
20
|
+
export declare const getInitialFilterLabel: (defaultItem: FilterOption, multi: boolean, item?: import("../Select/Select").SelectOptionValues | undefined, items?: import("../Select/Select").SelectOptionValues[] | undefined) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.transparentFocusBorderWidth = exports.getTextColor = exports.getBorder = exports.getBackgroundColor = exports.focusBorderWidth = exports.errors = exports.borderStyleParams = exports.HAS_SELECTED_VALUE_COLOR_SHADE = exports.FILTER_OPTIONS_MAX_HEIGHT = void 0;
|
|
4
|
+
exports.transparentFocusBorderWidth = exports.getTextColor = exports.getInitialFilterLabel = exports.getBorder = exports.getBackgroundColor = exports.focusBorderWidth = exports.errors = exports.borderStyleParams = exports.HAS_SELECTED_VALUE_COLOR_SHADE = exports.FILTER_OPTIONS_MAX_HEIGHT = void 0;
|
|
5
5
|
var _utils = require("../../theme/utils");
|
|
6
6
|
var _palette = require("../../theme/palette");
|
|
7
7
|
var _errors = require("../../utils/errors");
|
|
@@ -82,4 +82,21 @@ var errors = exports.errors = [{
|
|
|
82
82
|
return Boolean(filterType === 'added' && styleType === 'transparent');
|
|
83
83
|
},
|
|
84
84
|
error: new _errors.PropsValidationError('This filterType and styleType is not supported')
|
|
85
|
-
}];
|
|
85
|
+
}];
|
|
86
|
+
|
|
87
|
+
/** This callback returns the initial label of the Filter for all combinations */
|
|
88
|
+
var getInitialFilterLabel = exports.getInitialFilterLabel = function getInitialFilterLabel(defaultItem, multi, item, items) {
|
|
89
|
+
if (multi) {
|
|
90
|
+
if (items && items.length > 0) {
|
|
91
|
+
if (items.length === 1) {
|
|
92
|
+
return items[0].label;
|
|
93
|
+
} else {
|
|
94
|
+
return items[0].label + " + " + (items.length - 1) + " more";
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (item && !multi) {
|
|
99
|
+
return item.label;
|
|
100
|
+
}
|
|
101
|
+
return defaultItem.label;
|
|
102
|
+
};
|