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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LiveSearchProps } from './types';
|
|
3
|
-
declare function LiveSearch({ autoComplete, children, descText, disabled, dropContProps, id, label, onChangeText, onClickDropdown, options, placeholder, readOnly, required, searchVariant, setValue, size, isValid, value, }: LiveSearchProps): React.JSX.Element;
|
|
3
|
+
declare function LiveSearch({ autoComplete, children, descText, disabled, dropContProps, id, label, onChangeText, onChangeButton, onClickDropdown, options, placeholder, readOnly, required, searchVariant, setValue, size, isValid, value, }: LiveSearchProps): React.JSX.Element;
|
|
4
4
|
declare namespace LiveSearch {
|
|
5
5
|
var defaultProps: {
|
|
6
6
|
descText: string;
|
|
@@ -11,6 +11,7 @@ export interface LiveSearchProps extends Omit<ComponentPropsWithoutRef<'input'>,
|
|
|
11
11
|
isValid?: boolean | null;
|
|
12
12
|
label?: string;
|
|
13
13
|
onChangeText?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
14
|
+
onChangeButton?: ReactNode;
|
|
14
15
|
onClickDropdown?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
15
16
|
options?: any[];
|
|
16
17
|
placeholder?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react/*';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
|
|
3
|
+
import { LiveSearchProps } from '../../../components/Forms/LiveSearch/types';
|
|
4
|
+
declare const meta: Meta<({ children, ...props }: LiveSearchProps) => React.JSX.Element>;
|
|
4
5
|
export default meta;
|
|
5
6
|
type Story = StoryObj<typeof meta>;
|
|
6
7
|
export declare const DefaultExample: Story;
|
|
@@ -8,3 +9,4 @@ export declare const BasicExample: Story;
|
|
|
8
9
|
export declare const Description: Story;
|
|
9
10
|
export declare const Disabled: Story;
|
|
10
11
|
export declare const ObjectOptionsExample: Story;
|
|
12
|
+
export declare const onChangeButton: Story;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import React from 'react';
|
|
2
3
|
declare const meta: {
|
|
3
4
|
title: string;
|
|
4
|
-
component:
|
|
5
|
+
component: React.ForwardRefExoticComponent<import("../../components/Forms/Radio").RadioProps & React.RefAttributes<HTMLInputElement>>;
|
|
5
6
|
parameters: {
|
|
6
7
|
layout: string;
|
|
7
8
|
};
|
|
@@ -11,3 +12,4 @@ declare const meta: {
|
|
|
11
12
|
export default meta;
|
|
12
13
|
type Story = StoryObj<typeof meta>;
|
|
13
14
|
export declare const Demo: Story;
|
|
15
|
+
export declare const LiveSimulation: Story;
|
package/dist/esm/index.js
CHANGED
|
@@ -2505,8 +2505,8 @@ var Radio = forwardRef(function Radio(_a, ref) {
|
|
|
2505
2505
|
return (React.createElement("div", { className: cn$1('flex items-center', containerClassName) },
|
|
2506
2506
|
React.createElement("div", { className: cn$1('relative flex flex-shrink-0 items-center justify-center rounded-full', checkSize, backgroundClass) },
|
|
2507
2507
|
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 }),
|
|
2508
|
-
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-
|
|
2509
|
-
React.createElement("label", { htmlFor: id, className: cn$1('ml-2 leading-4', disabled ? 'text-bia-coolgrey' : 'text-bia-black', labelSize, labelClassName) }, childrenElement(label))));
|
|
2508
|
+
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) })),
|
|
2509
|
+
label && (React.createElement("label", { htmlFor: id, className: cn$1('ml-2 leading-4', disabled ? 'text-bia-coolgrey' : 'text-bia-black', labelSize, labelClassName) }, childrenElement(label)))));
|
|
2510
2510
|
});
|
|
2511
2511
|
Radio.defaultProps = {
|
|
2512
2512
|
label: '',
|
|
@@ -2613,8 +2613,8 @@ function Checkbox(_a) {
|
|
|
2613
2613
|
return (React.createElement("div", { className: "flex items-center" },
|
|
2614
2614
|
React.createElement("div", { className: "relative flex flex-shrink-0 items-center justify-center rounded-full ".concat(backgroundClass, " ").concat(checkClass) },
|
|
2615
2615
|
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)),
|
|
2616
|
-
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-
|
|
2617
|
-
React.createElement("label", { htmlFor: id, className: "ml-2 leading-4 text-primary-black ".concat(labelClass), style: { color: disabled ? '#8C8CA6' : '' } }, childrenElement(label))));
|
|
2616
|
+
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 })))),
|
|
2617
|
+
label && (React.createElement("label", { htmlFor: id, className: "ml-2 leading-4 text-primary-black ".concat(labelClass), style: { color: disabled ? '#8C8CA6' : '' } }, childrenElement(label)))));
|
|
2618
2618
|
}
|
|
2619
2619
|
Checkbox.defaultProps = {
|
|
2620
2620
|
disabled: false,
|
|
@@ -3016,6 +3016,9 @@ var useLiveSearch$1 = function (_a) {
|
|
|
3016
3016
|
setSearchTerm(getItemLabel(value));
|
|
3017
3017
|
}
|
|
3018
3018
|
}, [isOpen, value]);
|
|
3019
|
+
useEffect(function () {
|
|
3020
|
+
setSearchTerm(getItemLabel(value));
|
|
3021
|
+
}, [value]);
|
|
3019
3022
|
var handleInputChange = function (e) {
|
|
3020
3023
|
var newSearchTerm = e.target.value;
|
|
3021
3024
|
setSearchTerm(newSearchTerm);
|
|
@@ -3039,16 +3042,16 @@ var useLiveSearch$1 = function (_a) {
|
|
|
3039
3042
|
};
|
|
3040
3043
|
|
|
3041
3044
|
function LiveSearch(_a) {
|
|
3042
|
-
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 =
|
|
3045
|
+
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;
|
|
3043
3046
|
var inputRef = useRef(null);
|
|
3044
|
-
var
|
|
3047
|
+
var _o = useLiveSearch$1({
|
|
3045
3048
|
value: value,
|
|
3046
3049
|
setValue: setValue,
|
|
3047
3050
|
onChangeText: onChangeText,
|
|
3048
3051
|
dropContOnClickItem: dropContProps === null || dropContProps === void 0 ? void 0 : dropContProps.onClickItem,
|
|
3049
|
-
}), isOpen =
|
|
3050
|
-
var
|
|
3051
|
-
var
|
|
3052
|
+
}), isOpen = _o.isOpen, setIsOpen = _o.setIsOpen, searchTerm = _o.searchTerm, handleInputChange = _o.handleInputChange, handleDropdownItemClick = _o.handleDropdownItemClick;
|
|
3053
|
+
var _p = sizeConfig$7[size], iconClass = _p.iconClass, iconSize = _p.iconSize, inputClass = _p.inputClass;
|
|
3054
|
+
var _q = dropContProps || {}, dropContClassName = _q.className; _q.onClickItem; _q.anchorRef; var restDropContProps = __rest(_q, ["className", "onClickItem", "anchorRef"]);
|
|
3052
3055
|
var isSearchTermExist = searchTerm && searchTerm !== '';
|
|
3053
3056
|
var descColor = 'text-primary-cool';
|
|
3054
3057
|
var isExistValidation = isValid !== null && isValid !== undefined;
|
|
@@ -3057,7 +3060,7 @@ function LiveSearch(_a) {
|
|
|
3057
3060
|
if (!disabled && isExistValidation && !isValid)
|
|
3058
3061
|
descColor = 'text-bia-red';
|
|
3059
3062
|
var filteredOptions = filterOptions(options || [], value.label);
|
|
3060
|
-
var
|
|
3063
|
+
var _r = processRenderedChildren$1(children, searchTerm, searchVariant, handleDropdownItemClick), renderedChildren = _r.renderedChildren, hasFilteredResults = _r.hasFilteredResults;
|
|
3061
3064
|
var disabledClass = disabled ? 'cursor-not-allowed' : '';
|
|
3062
3065
|
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" },
|
|
3063
3066
|
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
@@ -3066,10 +3069,15 @@ function LiveSearch(_a) {
|
|
|
3066
3069
|
onChangeText(e);
|
|
3067
3070
|
handleInputChange(e);
|
|
3068
3071
|
}, type: "text", readOnly: readOnly, autoComplete: autoComplete }),
|
|
3069
|
-
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(iconClass)
|
|
3072
|
+
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(iconClass), style: {
|
|
3073
|
+
zIndex: (restDropContProps === null || restDropContProps === void 0 ? void 0 : restDropContProps.zIndex)
|
|
3074
|
+
? (restDropContProps === null || restDropContProps === void 0 ? void 0 : restDropContProps.zIndex) + 20
|
|
3075
|
+
: 20,
|
|
3076
|
+
} },
|
|
3070
3077
|
!isSearchTermExist && (React.createElement(TbZoom, { className: "text-primary-black", style: { fontSize: iconSize } })),
|
|
3071
|
-
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 },
|
|
3072
|
-
React.createElement(TbX, { className: "text-primary-black", style: { fontSize: iconSize } })))
|
|
3078
|
+
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 },
|
|
3079
|
+
React.createElement(TbX, { className: "text-primary-black", style: { fontSize: iconSize } }))),
|
|
3080
|
+
isSearchTermExist && onChangeButton),
|
|
3073
3081
|
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) {
|
|
3074
3082
|
var isSelected = value && value.id && option.id === value.id;
|
|
3075
3083
|
return option.custom ? (React.createElement(CustomDropdownItem, { size: size, isSelected: isSelected, className: dropContClassName, onClick: function () {
|