@kaio-xyz/design-system 1.1.121 → 1.1.123
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 +36 -29
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +36 -29
- 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
|
@@ -324,17 +324,17 @@ var SvgArrowUpRight = function SvgArrowUpRight(props) {
|
|
|
324
324
|
})));
|
|
325
325
|
};
|
|
326
326
|
|
|
327
|
-
var style$
|
|
327
|
+
var style$v = {"root":"stack-module__root__AqSLk"};
|
|
328
328
|
|
|
329
329
|
var Stack = function (_a) {
|
|
330
330
|
var children = _a.children, _b = _a.space, space = _b === void 0 ? "s" : _b, className = _a.className, _c = _a.position, position = _c === void 0 ? "vertical" : _c, _d = _a.fullHeight, fullHeight = _d === void 0 ? false : _d, _e = _a.fullWidth, fullWidth = _e === void 0 ? false : _e, dataTest = _a.dataTest, dataAlignItems = _a.dataAlignItems, dataCapitalize = _a.dataCapitalize, dataMarginTop = _a.dataMarginTop, dataMarginBottom = _a.dataMarginBottom, dataMarginLeft = _a.dataMarginLeft, dataPaddingBottom = _a.dataPaddingBottom, _f = _a.wrap, wrap = _f === void 0 ? false : _f, as = _a.as, rest = __rest(_a, ["children", "space", "className", "position", "fullHeight", "fullWidth", "dataTest", "dataAlignItems", "dataCapitalize", "dataMarginTop", "dataMarginBottom", "dataMarginLeft", "dataPaddingBottom", "wrap", "as"]);
|
|
331
331
|
var Tag = as || "div";
|
|
332
|
-
return (jsxRuntime.jsx(Tag, __assign({ className: clsx(style$
|
|
332
|
+
return (jsxRuntime.jsx(Tag, __assign({ className: clsx(style$v.root, className), "data-space": space, "data-position": position, "data-full-width": fullWidth, "data-full-height": fullHeight, "data-test": dataTest, "data-align-items": dataAlignItems, "data-capitalize": dataCapitalize, "data-margin-top": dataMarginTop, "data-margin-bottom": dataMarginBottom, "data-margin-left": dataMarginLeft, "data-padding-bottom": dataPaddingBottom, "data-wrap": wrap }, rest, { children: children })));
|
|
333
333
|
};
|
|
334
334
|
|
|
335
335
|
var baseStyle = {"root":"badge-base-module__root__oUZlm"};
|
|
336
336
|
|
|
337
|
-
var style$
|
|
337
|
+
var style$u = {"root":"badge-module__root__rXpaz"};
|
|
338
338
|
|
|
339
339
|
var BadgeStatuses = {
|
|
340
340
|
success: "success",
|
|
@@ -356,16 +356,16 @@ var Badge = function (_a) {
|
|
|
356
356
|
default: return jsxRuntime.jsx(SvgCircleDashed, {});
|
|
357
357
|
}
|
|
358
358
|
}, [status]);
|
|
359
|
-
return (jsxRuntime.jsx("label", __assign({ className: clsx(baseStyle.root, style$
|
|
359
|
+
return (jsxRuntime.jsx("label", __assign({ className: clsx(baseStyle.root, style$u.root, className), "data-status": status, "data-full-width": fullWidth, "data-test": dataTest, "data-reverted": reverted, "data-size": size }, props, { children: jsxRuntime.jsxs(Stack, { position: "horizontal", children: [hasIcon && icon, children] }) })));
|
|
360
360
|
};
|
|
361
361
|
|
|
362
|
-
var style$
|
|
362
|
+
var style$t = {"root":"button-module__root__CDCDX"};
|
|
363
363
|
|
|
364
|
-
var style$
|
|
364
|
+
var style$s = {"root":"spinned-icon-module__root__xchkj"};
|
|
365
365
|
|
|
366
366
|
var SpinnedIcon = function (_a) {
|
|
367
367
|
var _b = _a.size, size = _b === void 0 ? 22 : _b, _c = _a.duration, duration = _c === void 0 ? 1 : _c, _d = _a.className, className = _d === void 0 ? '' : _d, _e = _a.icon, Icon = _e === void 0 ? SvgLoader : _e, rest = __rest(_a, ["size", "duration", "className", "icon"]);
|
|
368
|
-
return (jsxRuntime.jsx("div", { className: clsx(style$
|
|
368
|
+
return (jsxRuntime.jsx("div", { className: clsx(style$s.root, className), style: {
|
|
369
369
|
width: size,
|
|
370
370
|
height: size,
|
|
371
371
|
animationDuration: "".concat(duration, "s"),
|
|
@@ -379,7 +379,7 @@ var Button = React.forwardRef(function (_a, ref) {
|
|
|
379
379
|
var baseIcon = Icon && jsxRuntime.jsx(Icon, __assign({}, iconProps, { viewBox: "0 0 24 24" }));
|
|
380
380
|
var loadingIcon = isLoading && jsxRuntime.jsx(SpinnedIcon, __assign({ size: iconSize }, iconProps));
|
|
381
381
|
var iconChild = loadingIcon || baseIcon || null;
|
|
382
|
-
var classes = clsx(style$
|
|
382
|
+
var classes = clsx(style$t.root, props.className);
|
|
383
383
|
return (isAnchor(props) ? (jsxRuntime.jsx("a", __assign({ "aria-disabled": props.disabled, ref: ref }, props, { className: classes, children: props.children }))) : (jsxRuntime.jsx("button", __assign({ "aria-disabled": props.disabled, ref: ref, type: "button" }, props, { className: classes, "data-type": variant, "data-size": size, "data-full-width": fullWidth, "data-inverted": isInverted, disabled: props.disabled || isLoading, "data-is-loading": isLoading, children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [iconPosition === "left" && iconChild, isLoading ? "Loading" : props.children, iconPosition === "right" && iconChild] }) }))));
|
|
384
384
|
});
|
|
385
385
|
Button.displayName = "Button";
|
|
@@ -404,41 +404,41 @@ var useFieldAutofill = function () {
|
|
|
404
404
|
return { isAutofilled: isAutofilled, internalRef: internalRef };
|
|
405
405
|
};
|
|
406
406
|
|
|
407
|
-
var style$
|
|
407
|
+
var style$r = {"hint":"hint-module__hint__0cpje","children":"hint-module__children__GSZxg"};
|
|
408
408
|
|
|
409
409
|
var Hint = function (_a) {
|
|
410
410
|
var children = _a.children, className = _a.className, _b = _a.kind, kind = _b === void 0 ? "info" : _b, attributes = __rest(_a, ["children", "className", "kind"]);
|
|
411
|
-
return (jsxRuntime.jsxs(Stack, __assign({ space: "xs", position: "horizontal", className: clsx(style$
|
|
411
|
+
return (jsxRuntime.jsxs(Stack, __assign({ space: "xs", position: "horizontal", className: clsx(style$r.hint, className), "data-type": kind }, attributes, { children: [jsxRuntime.jsx(SvgInfo, {}), jsxRuntime.jsx("span", { className: style$r.children, children: children })] })));
|
|
412
412
|
};
|
|
413
413
|
|
|
414
|
-
var style$
|
|
414
|
+
var style$q = {"field":"text-field-module__field__iZ0TF","label":"text-field-module__label__ClJkz","container":"text-field-module__container__IKtNZ","fieldWrapper":"text-field-module__fieldWrapper__nQ7l8","textField":"text-field-module__textField__756eR","hint":"text-field-module__hint__Ad6VA"};
|
|
415
415
|
|
|
416
416
|
var TextField = React.forwardRef(function (_a, ref) {
|
|
417
417
|
var className = _a.className, disabled = _a.disabled, hint = _a.hint, id = _a.id, label = _a.label, onChange = _a.onChange, readOnly = _a.readOnly, button = _a.button, _b = _a.fullWidth, fullWidth = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? "default" : _c, _d = _a.noPadding, noPadding = _d === void 0 ? false : _d, _e = _a.floatingLabel, floatingLabel = _e === void 0 ? true : _e, value = _a.value, defaultValue = _a.defaultValue, onFocus = _a.onFocus, onBlur = _a.onBlur, _f = _a.type, type = _f === void 0 ? "text" : _f, attributes = __rest(_a, ["className", "disabled", "hint", "id", "label", "onChange", "readOnly", "button", "fullWidth", "size", "noPadding", "floatingLabel", "value", "defaultValue", "onFocus", "onBlur", "type"]);
|
|
418
418
|
var _g = useFieldAutofill(), isAutofilled = _g.isAutofilled, internalRef = _g.internalRef;
|
|
419
419
|
React.useImperativeHandle(ref, function () { return internalRef.current; });
|
|
420
|
-
return (jsxRuntime.jsx("fieldset", { "aria-disabled": disabled, disabled: disabled, className: clsx(style$
|
|
420
|
+
return (jsxRuntime.jsx("fieldset", { "aria-disabled": disabled, disabled: disabled, className: clsx(style$q.textField, className), "data-no-padding": noPadding, "data-full-width": fullWidth, children: jsxRuntime.jsx("div", { className: style$q.container, "data-has-label": !!label, "data-has-hint": !!hint, "data-has-button": !!button, "data-floating-label": floatingLabel, children: jsxRuntime.jsxs("div", { className: style$q.fieldWrapper, children: [jsxRuntime.jsx("input", __assign({}, attributes, { id: id, ref: internalRef, type: type, value: value, defaultValue: defaultValue, placeholder: " ", className: style$q.field, "data-size": size, "data-autofilled": isAutofilled, onFocus: onFocus, onBlur: onBlur, onChange: onChange, readOnly: readOnly })), label && (jsxRuntime.jsx("label", { className: style$q.label, htmlFor: id, "data-floating": floatingLabel, children: label })), button ? button : null, hint && jsxRuntime.jsx(Hint, { kind: "error", className: style$q.hint, children: hint })] }) }) }));
|
|
421
421
|
});
|
|
422
422
|
TextField.displayName = "TextField";
|
|
423
423
|
|
|
424
|
-
var style$
|
|
424
|
+
var style$p = {"container":"container-module__container__CAxQw"};
|
|
425
425
|
|
|
426
426
|
var Container = function (_a) {
|
|
427
427
|
var children = _a.children, className = _a.className, size = _a.size, noPadding = _a.noPadding, attributes = __rest(_a, ["children", "className", "size", "noPadding"]);
|
|
428
|
-
return (jsxRuntime.jsx("div", __assign({ className: clsx(style$
|
|
428
|
+
return (jsxRuntime.jsx("div", __assign({ className: clsx(style$p.container, className) }, size ? { "data-size": size } : {}, { "data-nopadding": noPadding }, attributes, { children: children })));
|
|
429
429
|
};
|
|
430
430
|
|
|
431
|
-
var style$
|
|
431
|
+
var style$o = {"field":"password-field-module__field__-sFqA","button":"password-field-module__button__FtG9V"};
|
|
432
432
|
|
|
433
433
|
var PasswordField = React.forwardRef(function (_a, ref) {
|
|
434
434
|
var disabled = _a.disabled, rest = __rest(_a, ["disabled"]);
|
|
435
435
|
var _b = React.useState(false), isPasswordVisible = _b[0], setIsPasswordVisible = _b[1];
|
|
436
|
-
var button = (jsxRuntime.jsx("button", { onClick: function () { return setIsPasswordVisible(function (prev) { return !prev; }); }, type: "button", disabled: disabled, className: style$
|
|
437
|
-
return (jsxRuntime.jsx(TextField, __assign({ disabled: disabled }, rest, { ref: ref, type: isPasswordVisible ? "text" : "password", button: button, className: style$
|
|
436
|
+
var button = (jsxRuntime.jsx("button", { onClick: function () { return setIsPasswordVisible(function (prev) { return !prev; }); }, type: "button", disabled: disabled, className: style$o.button, children: isPasswordVisible ? jsxRuntime.jsx(SvgEyeOpen, {}) : jsxRuntime.jsx(SvgEyeClosed, {}) }));
|
|
437
|
+
return (jsxRuntime.jsx(TextField, __assign({ disabled: disabled }, rest, { ref: ref, type: isPasswordVisible ? "text" : "password", button: button, className: style$o.field })));
|
|
438
438
|
});
|
|
439
439
|
PasswordField.displayName = "PasswordField";
|
|
440
440
|
|
|
441
|
-
var style$
|
|
441
|
+
var style$n = {"validator":"validate-password-field-module__validator__Do-6w"};
|
|
442
442
|
|
|
443
443
|
var rules = {
|
|
444
444
|
length: /^.{8,}$/,
|
|
@@ -463,18 +463,11 @@ var ValidatePasswordField = React.forwardRef(function (_a, ref) {
|
|
|
463
463
|
React.useEffect(function () {
|
|
464
464
|
setIsPasswordValid === null || setIsPasswordValid === void 0 ? void 0 : setIsPasswordValid(isLenghtCheckOk && isCaseCheckOk && isNumberCheckOk && isSpecialCheckOk);
|
|
465
465
|
}, [isLenghtCheckOk, isCaseCheckOk, isNumberCheckOk, isSpecialCheckOk, setIsPasswordValid]);
|
|
466
|
-
var getValidator = function (isCheckOk, label) { return (jsxRuntime.jsxs(Stack, { position: "horizontal", className: style$
|
|
466
|
+
var getValidator = function (isCheckOk, label) { return (jsxRuntime.jsxs(Stack, { position: "horizontal", className: style$n.validator, "data-is-valid": isCheckOk, children: [isCheckOk ? jsxRuntime.jsx(SvgCheck, {}) : jsxRuntime.jsx(SvgCircleDashed, {}), jsxRuntime.jsx("p", { children: label })] })); };
|
|
467
467
|
return (jsxRuntime.jsxs(Stack, { space: "m", children: [jsxRuntime.jsx(PasswordField, __assign({ onChange: onHandleChange, ref: ref }, rest)), jsxRuntime.jsxs(Stack, { children: [getValidator(isLenghtCheckOk, "At least 8 characters"), getValidator(isCaseCheckOk, "Include uppercase & lowercase letters"), getValidator(isNumberCheckOk, "Include at least one number"), getValidator(isSpecialCheckOk, "Include at least one special character (allowed: @ $ ! % * ? & _ #)")] })] }));
|
|
468
468
|
});
|
|
469
469
|
ValidatePasswordField.displayName = "ValidatePasswordField";
|
|
470
470
|
|
|
471
|
-
var style$n = {"root":"label-module__root__34bJr"};
|
|
472
|
-
|
|
473
|
-
var Label = function (_a) {
|
|
474
|
-
var id = _a.id, label = _a.label, className = _a.className, _b = _a.hasMargin, hasMargin = _b === void 0 ? true : _b, _c = _a.hasHalfMargin, hasHalfMargin = _c === void 0 ? false : _c, _d = _a.hasCursorPointer, hasCursorPointer = _d === void 0 ? false : _d;
|
|
475
|
-
return (jsxRuntime.jsx("label", { className: clsx(style$n.root, className), htmlFor: id, "data-margin-bottom": hasMargin, "data-half-margin-bottom": hasHalfMargin, "data-has-cursor-pointer": hasCursorPointer, children: label }));
|
|
476
|
-
};
|
|
477
|
-
|
|
478
471
|
var style$m = {"label":"select-module__label__EWUYF","selector":"select-module__selector__55oxp","hint":"select-module__hint__SPtu-"};
|
|
479
472
|
|
|
480
473
|
var IconAndLabel = function (_a) {
|
|
@@ -495,8 +488,22 @@ var CustomSingleValue = function (_a) {
|
|
|
495
488
|
return (jsxRuntime.jsx(ReactSelect.components.SingleValue, __assign({ data: data }, rest, { children: jsxRuntime.jsx(IconAndLabel, { icon: data.icon, children: children }) })));
|
|
496
489
|
};
|
|
497
490
|
var Select = function (_a) {
|
|
498
|
-
var id = _a.id, label = _a.label, dataTest = _a.dataTest, isDisabled = _a.isDisabled, className = _a.className, error = _a.error, customComponents = _a.components, rest = __rest(_a, ["id", "label", "dataTest", "isDisabled", "className", "error", "components"]);
|
|
499
|
-
|
|
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), isFocused = _b[0], setIsFocused = _b[1];
|
|
493
|
+
var _c = React.useState(function () {
|
|
494
|
+
var v = defaultValue;
|
|
495
|
+
return v != null && (!Array.isArray(v) || v.length > 0);
|
|
496
|
+
}), uncontrolledHasValue = _c[0], setUncontrolledHasValue = _c[1];
|
|
497
|
+
var controlledHasValue = value !== undefined
|
|
498
|
+
? (value != null && (!Array.isArray(value) || value.length > 0))
|
|
499
|
+
: uncontrolledHasValue;
|
|
500
|
+
var isFloating = isFocused || controlledHasValue;
|
|
501
|
+
var handleChange = function (newValue, actionMeta) {
|
|
502
|
+
var v = newValue;
|
|
503
|
+
setUncontrolledHasValue(v != null && (!Array.isArray(v) || v.length > 0));
|
|
504
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue, actionMeta);
|
|
505
|
+
};
|
|
506
|
+
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, onFocus: function (e) { setIsFocused(true); onFocus === null || onFocus === void 0 ? void 0 : onFocus(e); }, onBlur: function (e) { setIsFocused(false); onBlur === null || onBlur === void 0 ? void 0 : onBlur(e); }, isDisabled: isDisabled })), error && jsxRuntime.jsx(Hint, { kind: "error", className: style$m.hint, children: error })] }) }));
|
|
500
507
|
};
|
|
501
508
|
Select.displayName = "Select";
|
|
502
509
|
|
|
@@ -1152,7 +1159,7 @@ var TextArea = React.forwardRef(function (_a, ref) {
|
|
|
1152
1159
|
var className = _a.className, disabled = _a.disabled, hint = _a.hint, id = _a.id, label = _a.label, onChange = _a.onChange, readOnly = _a.readOnly, _b = _a.fullWidth, fullWidth = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? "default" : _c, _d = _a.noPadding, noPadding = _d === void 0 ? false : _d, _e = _a.floatingLabel, floatingLabel = _e === void 0 ? true : _e, value = _a.value, defaultValue = _a.defaultValue, onFocus = _a.onFocus, onBlur = _a.onBlur, _f = _a.rows, rows = _f === void 0 ? 3 : _f, attributes = __rest(_a, ["className", "disabled", "hint", "id", "label", "onChange", "readOnly", "fullWidth", "size", "noPadding", "floatingLabel", "value", "defaultValue", "onFocus", "onBlur", "rows"]);
|
|
1153
1160
|
var _g = useFieldAutofill(), isAutofilled = _g.isAutofilled, internalRef = _g.internalRef;
|
|
1154
1161
|
React.useImperativeHandle(ref, function () { return internalRef.current; });
|
|
1155
|
-
return (jsxRuntime.jsx("fieldset", { "aria-disabled": disabled, disabled: disabled, className: clsx(style$
|
|
1162
|
+
return (jsxRuntime.jsx("fieldset", { "aria-disabled": disabled, disabled: disabled, className: clsx(style$q.textField, className), "data-no-padding": noPadding, "data-full-width": fullWidth, children: jsxRuntime.jsx("div", { className: style$q.container, "data-has-label": !!label, "data-has-hint": !!hint, "data-floating-label": floatingLabel, children: jsxRuntime.jsxs("div", { className: style$q.fieldWrapper, children: [jsxRuntime.jsx("textarea", __assign({}, attributes, { id: id, ref: internalRef, value: value, defaultValue: defaultValue, placeholder: " ", className: style$q.field, "data-size": size, "data-autofilled": isAutofilled, onFocus: onFocus, onBlur: onBlur, onChange: onChange, readOnly: readOnly, rows: rows })), label && (jsxRuntime.jsx("label", { className: style$q.label, htmlFor: id, "data-floating": floatingLabel, children: label })), hint && jsxRuntime.jsx(Hint, { kind: "error", className: style$q.hint, children: hint })] }) }) }));
|
|
1156
1163
|
});
|
|
1157
1164
|
TextArea.displayName = "TextArea";
|
|
1158
1165
|
|