@kaio-xyz/design-system 1.1.126 → 1.1.128
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/index.cjs.js +9 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +9 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -488,8 +488,13 @@ var CustomSingleValue = function (_a) {
|
|
|
488
488
|
return (jsxRuntime.jsx(ReactSelect.components.SingleValue, __assign({ data: data }, rest, { children: jsxRuntime.jsx(IconAndLabel, { icon: data.icon, children: children }) })));
|
|
489
489
|
};
|
|
490
490
|
var Select = function (_a) {
|
|
491
|
-
var id = _a.id, label = _a.label, dataTest = _a.dataTest, isDisabled = _a.isDisabled, className = _a.className, error = _a.error, customComponents = _a.components, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, value = _a.value, defaultValue = _a.defaultValue, placeholder = _a.placeholder, rest = __rest(_a, ["id", "label", "dataTest", "isDisabled", "className", "error", "components", "onChange", "onFocus", "onBlur", "value", "defaultValue", "placeholder"]);
|
|
492
|
-
var
|
|
491
|
+
var id = _a.id, label = _a.label, dataTest = _a.dataTest, isDisabled = _a.isDisabled, className = _a.className, error = _a.error, customComponents = _a.components, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, onMenuOpen = _a.onMenuOpen, onMenuClose = _a.onMenuClose, value = _a.value, defaultValue = _a.defaultValue, placeholder = _a.placeholder, rest = __rest(_a, ["id", "label", "dataTest", "isDisabled", "className", "error", "components", "onChange", "onFocus", "onBlur", "onMenuOpen", "onMenuClose", "value", "defaultValue", "placeholder"]);
|
|
492
|
+
var DataTestInput = React.useMemo(function () {
|
|
493
|
+
var Input = function (props) { return (jsxRuntime.jsx(ReactSelect.components.Input, __assign({}, props, { "data-test": dataTest }))); };
|
|
494
|
+
Input.displayName = 'DataTestInput';
|
|
495
|
+
return Input;
|
|
496
|
+
}, [dataTest]);
|
|
497
|
+
var _b = React.useState(false), menuIsOpen = _b[0], setMenuIsOpen = _b[1];
|
|
493
498
|
var _c = React.useState(function () {
|
|
494
499
|
var v = defaultValue;
|
|
495
500
|
return v != null && (!Array.isArray(v) || v.length > 0);
|
|
@@ -504,13 +509,13 @@ var Select = function (_a) {
|
|
|
504
509
|
var controlledHasValue = value !== undefined
|
|
505
510
|
? (value != null && (!Array.isArray(value) || value.length > 0))
|
|
506
511
|
: uncontrolledHasValue;
|
|
507
|
-
var isFloating =
|
|
512
|
+
var isFloating = menuIsOpen || controlledHasValue;
|
|
508
513
|
var handleChange = function (newValue, actionMeta) {
|
|
509
514
|
var v = newValue;
|
|
510
515
|
setUncontrolledHasValue(v != null && (!Array.isArray(v) || v.length > 0));
|
|
511
516
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue, actionMeta);
|
|
512
517
|
};
|
|
513
|
-
return (jsxRuntime.jsx("div", { className: clsx(style$m.root, className), children: jsxRuntime.jsxs("div", {
|
|
518
|
+
return (jsxRuntime.jsx("div", { className: clsx(style$m.root, className), children: jsxRuntime.jsxs("div", { className: style$m.selector, "data-error": !!error, "data-has-floating-label": !!label, "data-floating-active": isFloating, children: [label && (jsxRuntime.jsx("label", { className: style$m.label, htmlFor: id, "data-floating": isFloating, children: label })), jsxRuntime.jsx(ReactSelect, __assign({ inputId: id, classNamePrefix: "select", components: __assign(__assign({}, customComponents), { IndicatorSeparator: function () { return null; }, Input: DataTestInput, Option: CustomOption, SingleValue: CustomSingleValue, DropdownIndicator: CustomDropdownIndicator, MultiValueLabel: CustomMultiValueLabel }) }, rest, { placeholder: label ? (placeholder !== null && placeholder !== void 0 ? placeholder : "") : placeholder, value: value, defaultValue: defaultValue, onChange: handleChange, onMenuOpen: function () { setMenuIsOpen(true); onMenuOpen === null || onMenuOpen === void 0 ? void 0 : onMenuOpen(); }, onMenuClose: function () { setMenuIsOpen(false); onMenuClose === null || onMenuClose === void 0 ? void 0 : onMenuClose(); }, onFocus: function (e) { onFocus === null || onFocus === void 0 ? void 0 : onFocus(e); }, onBlur: function (e) { onBlur === null || onBlur === void 0 ? void 0 : onBlur(e); }, isDisabled: isDisabled })), error && jsxRuntime.jsx(Hint, { kind: "error", className: style$m.hint, children: error })] }) }));
|
|
514
519
|
};
|
|
515
520
|
Select.displayName = "Select";
|
|
516
521
|
|