@kaio-xyz/design-system 1.1.125 → 1.1.127
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 +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +4 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -488,8 +488,8 @@ 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 _b = React.useState(false),
|
|
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 _b = React.useState(false), menuIsOpen = _b[0], setMenuIsOpen = _b[1];
|
|
493
493
|
var _c = React.useState(function () {
|
|
494
494
|
var v = defaultValue;
|
|
495
495
|
return v != null && (!Array.isArray(v) || v.length > 0);
|
|
@@ -504,13 +504,13 @@ var Select = function (_a) {
|
|
|
504
504
|
var controlledHasValue = value !== undefined
|
|
505
505
|
? (value != null && (!Array.isArray(value) || value.length > 0))
|
|
506
506
|
: uncontrolledHasValue;
|
|
507
|
-
var isFloating =
|
|
507
|
+
var isFloating = menuIsOpen || controlledHasValue;
|
|
508
508
|
var handleChange = function (newValue, actionMeta) {
|
|
509
509
|
var v = newValue;
|
|
510
510
|
setUncontrolledHasValue(v != null && (!Array.isArray(v) || v.length > 0));
|
|
511
511
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue, actionMeta);
|
|
512
512
|
};
|
|
513
|
-
return (jsxRuntime.jsx("div", { className: clsx(style$m.root, className), children: jsxRuntime.jsxs("div", { "data-test": dataTest, 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; }, Option: CustomOption, SingleValue: CustomSingleValue, DropdownIndicator: CustomDropdownIndicator, MultiValueLabel: CustomMultiValueLabel }) }, rest, { placeholder: label ? (placeholder !== null && placeholder !== void 0 ? placeholder : "") : placeholder, value: value, defaultValue: defaultValue, onChange: handleChange,
|
|
513
|
+
return (jsxRuntime.jsx("div", { className: clsx(style$m.root, className), children: jsxRuntime.jsxs("div", { "data-test": dataTest, 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; }, 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
514
|
};
|
|
515
515
|
Select.displayName = "Select";
|
|
516
516
|
|