bianic-ui 2.13.0-alpha.1 → 2.13.0
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/cjs/index.js +21 -13
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Forms/LiveSearch/index.d.ts +1 -1
- package/dist/cjs/types/components/Forms/LiveSearch/types/index.d.ts +1 -0
- package/dist/cjs/types/stories/Form/LiveSearch/LivesearchCustomDropdownExample.stories.d.ts +3 -1
- package/dist/cjs/types/stories/Form/Radio.stories.d.ts +3 -1
- package/dist/esm/index.js +21 -13
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Forms/LiveSearch/index.d.ts +1 -1
- package/dist/esm/types/components/Forms/LiveSearch/types/index.d.ts +1 -0
- package/dist/esm/types/stories/Form/LiveSearch/LivesearchCustomDropdownExample.stories.d.ts +3 -1
- package/dist/esm/types/stories/Form/Radio.stories.d.ts +3 -1
- package/dist/index.d.ts +2 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2507,8 +2507,8 @@ var Radio = React.forwardRef(function Radio(_a, ref) {
|
|
|
2507
2507
|
return (React.createElement("div", { className: cn$1('flex items-center', containerClassName) },
|
|
2508
2508
|
React.createElement("div", { className: cn$1('relative flex flex-shrink-0 items-center justify-center rounded-full', checkSize, backgroundClass) },
|
|
2509
2509
|
React.createElement("input", { ref: ref, id: id, type: "radio", className: cn$1('checkbox peer absolute box-content h-full w-full cursor-pointer appearance-none rounded-full border-2 border-bia-coolgrey-light-50 checked:border-bia-blue hover:border-bia-blue-hover focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-bia-blue disabled:cursor-not-allowed disabled:border-bia-coolgrey-light-50 disabled:checked:border-bia-blue-light-50', inputFocusClass, inputClassName, className), name: name, value: value, required: required, readOnly: readOnly, autoComplete: autoComplete, tabIndex: tabIndex, role: role, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, onChange: onChange, onClick: onClick, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, checked: checked, defaultChecked: defaultChecked, disabled: disabled }),
|
|
2510
|
-
React.createElement("div", { className: cn$1('check-icon z-1 group flex h-full w-full justify-center rounded-full border-2 border-primary-white text-bia-grey outline-2 outline-
|
|
2511
|
-
React.createElement("label", { htmlFor: id, className: cn$1('ml-2 leading-4', disabled ? 'text-bia-coolgrey' : 'text-bia-black', labelSize, labelClassName) }, childrenElement(label))));
|
|
2510
|
+
React.createElement("div", { className: cn$1('check-icon z-1 group flex h-full w-full justify-center rounded-full border-2 border-primary-white text-bia-grey outline-2 outline-transparent peer-checked:bg-bia-blue peer-checked:hover:border-bia-blue-hover peer-checked:hover:outline-bia-blue-hover peer-focus-visible:outline-bia-blue peer-disabled:border-transparent peer-disabled:bg-bia-grey-light-80 peer-disabled:peer-checked:border-primary-white peer-disabled:peer-checked:bg-bia-blue-disabled', peerCheckedClass) })),
|
|
2511
|
+
label && (React.createElement("label", { htmlFor: id, className: cn$1('ml-2 leading-4', disabled ? 'text-bia-coolgrey' : 'text-bia-black', labelSize, labelClassName) }, childrenElement(label)))));
|
|
2512
2512
|
});
|
|
2513
2513
|
Radio.defaultProps = {
|
|
2514
2514
|
label: '',
|
|
@@ -2615,8 +2615,8 @@ function Checkbox(_a) {
|
|
|
2615
2615
|
return (React.createElement("div", { className: "flex items-center" },
|
|
2616
2616
|
React.createElement("div", { className: "relative flex flex-shrink-0 items-center justify-center rounded-full ".concat(backgroundClass, " ").concat(checkClass) },
|
|
2617
2617
|
React.createElement("input", __assign({ id: id, type: "checkbox", className: "checkbox peer absolute box-content h-full w-full cursor-pointer appearance-none rounded-full border-2 border-bia-coolgrey-light-50 checked:border-bia-blue hover:border-bia-blue-hover focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-bia-blue focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:border-bia-coolgrey-light-50 disabled:checked:border-bia-blue-light-50", onChange: function (e) { return onChange(e); }, disabled: disabled }, props)),
|
|
2618
|
-
React.createElement("div", { className: "check-icon z-1 group flex h-full w-full items-center justify-center rounded-full text-bia-grey outline-2 outline-
|
|
2619
|
-
React.createElement("label", { htmlFor: id, className: "ml-2 leading-4 text-primary-black ".concat(labelClass), style: { color: disabled ? '#8C8CA6' : '' } }, childrenElement(label))));
|
|
2618
|
+
React.createElement("div", { className: "check-icon z-1 group flex h-full w-full items-center justify-center rounded-full text-bia-grey outline-2 outline-transparent peer-checked:border-primary-white peer-checked:bg-bia-blue peer-checked:hover:border-bia-blue-hover peer-checked:hover:outline-bia-blue-hover peer-checked:peer-hover:bg-bia-blue-hover peer-focus-visible:outline-bia-blue peer-disabled:bg-bia-grey-light-80 peer-disabled:peer-checked:bg-bia-blue-light-50 peer-disabled:peer-checked:outline-bia-blue-light-50 ".concat(peerCheckedClass) }, isValidIndeterminate ? (React.createElement(TbMinus, { className: "stroke-[3px] text-bia-grey-dark-10 peer-checked:group-[]:text-bia-white peer-hover:group-[]:text-bia-blue-hover peer-checked:peer-hover:group-[]:text-bia-white peer-disabled:group-[]:text-bia-grey-dark-10 peer-disabled:peer-checked:group-[]:text-bia-white", size: 14 })) : (React.createElement(TbCheck, { className: "stroke-[3px] text-bia-grey-dark-10 peer-checked:group-[]:text-bia-white peer-hover:group-[]:text-bia-blue-hover peer-checked:peer-hover:group-[]:text-bia-white peer-disabled:group-[]:text-bia-grey-dark-10 peer-disabled:peer-checked:group-[]:text-bia-white", size: 14 })))),
|
|
2619
|
+
label && (React.createElement("label", { htmlFor: id, className: "ml-2 leading-4 text-primary-black ".concat(labelClass), style: { color: disabled ? '#8C8CA6' : '' } }, childrenElement(label)))));
|
|
2620
2620
|
}
|
|
2621
2621
|
Checkbox.defaultProps = {
|
|
2622
2622
|
disabled: false,
|
|
@@ -3018,6 +3018,9 @@ var useLiveSearch$1 = function (_a) {
|
|
|
3018
3018
|
setSearchTerm(getItemLabel(value));
|
|
3019
3019
|
}
|
|
3020
3020
|
}, [isOpen, value]);
|
|
3021
|
+
React.useEffect(function () {
|
|
3022
|
+
setSearchTerm(getItemLabel(value));
|
|
3023
|
+
}, [value]);
|
|
3021
3024
|
var handleInputChange = function (e) {
|
|
3022
3025
|
var newSearchTerm = e.target.value;
|
|
3023
3026
|
setSearchTerm(newSearchTerm);
|
|
@@ -3041,16 +3044,16 @@ var useLiveSearch$1 = function (_a) {
|
|
|
3041
3044
|
};
|
|
3042
3045
|
|
|
3043
3046
|
function LiveSearch(_a) {
|
|
3044
|
-
var _b = _a.autoComplete, autoComplete = _b === void 0 ? 'off' : _b, _c = _a.children, children = _c === void 0 ? undefined : _c, descText = _a.descText, _d = _a.disabled, disabled = _d === void 0 ? false : _d, dropContProps = _a.dropContProps, id = _a.id, label = _a.label, _e = _a.onChangeText, onChangeText = _e === void 0 ? function () { } : _e, _f = _a.onClickDropdown, onClickDropdown =
|
|
3047
|
+
var _b = _a.autoComplete, autoComplete = _b === void 0 ? 'off' : _b, _c = _a.children, children = _c === void 0 ? undefined : _c, descText = _a.descText, _d = _a.disabled, disabled = _d === void 0 ? false : _d, dropContProps = _a.dropContProps, id = _a.id, label = _a.label, _e = _a.onChangeText, onChangeText = _e === void 0 ? function () { } : _e, _f = _a.onChangeButton, onChangeButton = _f === void 0 ? undefined : _f, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, options = _a.options, placeholder = _a.placeholder, _h = _a.readOnly, readOnly = _h === void 0 ? false : _h, _j = _a.required, required = _j === void 0 ? false : _j, _k = _a.searchVariant, searchVariant = _k === void 0 ? 'include' : _k, setValue = _a.setValue, _l = _a.size, size = _l === void 0 ? 'md' : _l, _m = _a.isValid, isValid = _m === void 0 ? null : _m, value = _a.value;
|
|
3045
3048
|
var inputRef = React.useRef(null);
|
|
3046
|
-
var
|
|
3049
|
+
var _o = useLiveSearch$1({
|
|
3047
3050
|
value: value,
|
|
3048
3051
|
setValue: setValue,
|
|
3049
3052
|
onChangeText: onChangeText,
|
|
3050
3053
|
dropContOnClickItem: dropContProps === null || dropContProps === void 0 ? void 0 : dropContProps.onClickItem,
|
|
3051
|
-
}), isOpen =
|
|
3052
|
-
var
|
|
3053
|
-
var
|
|
3054
|
+
}), isOpen = _o.isOpen, setIsOpen = _o.setIsOpen, searchTerm = _o.searchTerm, handleInputChange = _o.handleInputChange, handleDropdownItemClick = _o.handleDropdownItemClick;
|
|
3055
|
+
var _p = sizeConfig$7[size], iconClass = _p.iconClass, iconSize = _p.iconSize, inputClass = _p.inputClass;
|
|
3056
|
+
var _q = dropContProps || {}, dropContClassName = _q.className; _q.onClickItem; _q.anchorRef; var restDropContProps = __rest(_q, ["className", "onClickItem", "anchorRef"]);
|
|
3054
3057
|
var isSearchTermExist = searchTerm && searchTerm !== '';
|
|
3055
3058
|
var descColor = 'text-primary-cool';
|
|
3056
3059
|
var isExistValidation = isValid !== null && isValid !== undefined;
|
|
@@ -3059,7 +3062,7 @@ function LiveSearch(_a) {
|
|
|
3059
3062
|
if (!disabled && isExistValidation && !isValid)
|
|
3060
3063
|
descColor = 'text-bia-red';
|
|
3061
3064
|
var filteredOptions = filterOptions(options || [], value.label);
|
|
3062
|
-
var
|
|
3065
|
+
var _r = processRenderedChildren$1(children, searchTerm, searchVariant, handleDropdownItemClick), renderedChildren = _r.renderedChildren, hasFilteredResults = _r.hasFilteredResults;
|
|
3063
3066
|
var disabledClass = disabled ? 'cursor-not-allowed' : '';
|
|
3064
3067
|
return (React.createElement("div", { className: "bianic-livesearch bianic-fgc-container bianic-text-input-container field-group group/form flex w-full flex-col gap-y-2" },
|
|
3065
3068
|
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
@@ -3068,10 +3071,15 @@ function LiveSearch(_a) {
|
|
|
3068
3071
|
onChangeText(e);
|
|
3069
3072
|
handleInputChange(e);
|
|
3070
3073
|
}, type: "text", readOnly: readOnly, autoComplete: autoComplete }),
|
|
3071
|
-
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(iconClass)
|
|
3074
|
+
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(iconClass), style: {
|
|
3075
|
+
zIndex: (restDropContProps === null || restDropContProps === void 0 ? void 0 : restDropContProps.zIndex)
|
|
3076
|
+
? (restDropContProps === null || restDropContProps === void 0 ? void 0 : restDropContProps.zIndex) + 20
|
|
3077
|
+
: 20,
|
|
3078
|
+
} },
|
|
3072
3079
|
!isSearchTermExist && (React.createElement(TbZoom, { className: "text-primary-black", style: { fontSize: iconSize } })),
|
|
3073
|
-
isSearchTermExist && (React.createElement("button", { onClick: function () { return setValue({ id: null, label: '' }); }, className: "flex h-full w-full items-center disabled:cursor-not-allowed", disabled: disabled },
|
|
3074
|
-
React.createElement(TbX, { className: "text-primary-black", style: { fontSize: iconSize } })))
|
|
3080
|
+
isSearchTermExist && !onChangeButton && (React.createElement("button", { onClick: function () { return setValue({ id: null, label: '' }); }, className: "flex h-full w-full items-center disabled:cursor-not-allowed", disabled: disabled },
|
|
3081
|
+
React.createElement(TbX, { className: "text-primary-black", style: { fontSize: iconSize } }))),
|
|
3082
|
+
isSearchTermExist && onChangeButton),
|
|
3075
3083
|
children === undefined && isOpen && (React.createElement("div", { className: "border-grey-100 absolute z-10 max-h-60 w-full overflow-y-auto rounded-b-md border bg-primary-white shadow-lg", onClick: onClickDropdown }, filteredOptions.map(function (option) {
|
|
3076
3084
|
var isSelected = value && value.id && option.id === value.id;
|
|
3077
3085
|
return option.custom ? (React.createElement(CustomDropdownItem, { size: size, isSelected: isSelected, className: dropContClassName, onClick: function () {
|