bianic-ui 2.1.0-beta.0 → 2.1.0-beta.2
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/README.md +49 -49
- package/dist/cjs/index.js +77 -46
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Forms/DatePicker/PickerCalendar/types/types.d.ts +2 -0
- package/dist/cjs/types/components/Forms/LiveSearch/Example/CustomDropdown.d.ts +1 -0
- 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/components/Forms/SelectInput/PropsInterface.d.ts +1 -0
- package/dist/cjs/types/components/Forms/SelectInput/index.d.ts +1 -1
- package/dist/cjs/types/components/Menu/MenuItem.d.ts +2 -1
- package/dist/cjs/types/stories/Form/LiveSearch/LivesearchCustomDropdownExample.stories.d.ts +1 -1
- package/dist/esm/index.js +77 -46
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Forms/DatePicker/PickerCalendar/types/types.d.ts +2 -0
- package/dist/esm/types/components/Forms/LiveSearch/Example/CustomDropdown.d.ts +1 -0
- 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/components/Forms/SelectInput/PropsInterface.d.ts +1 -0
- package/dist/esm/types/components/Forms/SelectInput/index.d.ts +1 -1
- package/dist/esm/types/components/Menu/MenuItem.d.ts +2 -1
- package/dist/esm/types/stories/Form/LiveSearch/LivesearchCustomDropdownExample.stories.d.ts +1 -1
- package/dist/index.d.ts +8 -3
- package/package.json +97 -97
- package/src/style/color.css +627 -627
- package/src/style/scrollbar.css +78 -78
- package/tailwind.config.js +543 -543
|
@@ -2,6 +2,8 @@ import { ComponentPropsWithRef } from 'react';
|
|
|
2
2
|
export interface PickerCalendarProps extends ComponentPropsWithRef<'div'> {
|
|
3
3
|
zIndex?: number | 'auto' | 'inherit';
|
|
4
4
|
anchorRef: React.RefObject<HTMLDivElement>;
|
|
5
|
+
isOpen?: boolean;
|
|
6
|
+
onClose?: () => void;
|
|
5
7
|
minDate?: string;
|
|
6
8
|
maxDate?: string;
|
|
7
9
|
selectedDate?: string | null;
|
|
@@ -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, value, }: LiveSearchProps): React.JSX.Element;
|
|
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;
|
|
4
4
|
declare namespace LiveSearch {
|
|
5
5
|
var defaultProps: {
|
|
6
6
|
descText: string;
|
|
@@ -8,6 +8,7 @@ export interface LiveSearchProps extends Omit<ComponentPropsWithoutRef<'input'>,
|
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
dropContProps?: Omit<DropdownContainerProps, 'children'>;
|
|
10
10
|
id?: string;
|
|
11
|
+
isValid?: boolean | null;
|
|
11
12
|
label?: string;
|
|
12
13
|
onChangeText?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
13
14
|
onClickDropdown?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import SelectInputProps from './PropsInterface';
|
|
3
|
-
declare function SelectInput({ descText, disabled, size, id, label, options, required, selected, setSelected, onClickDropdown, children, dropContProps: { className: dropContClassName, ...restDropContProps }, ...props }: SelectInputProps): React.JSX.Element;
|
|
3
|
+
declare function SelectInput({ descText, disabled, size, id, isValid, label, options, required, selected, setSelected, onClickDropdown, children, dropContProps: { className: dropContClassName, ...restDropContProps }, ...props }: SelectInputProps): React.JSX.Element;
|
|
4
4
|
declare namespace SelectInput {
|
|
5
5
|
var defaultProps: {
|
|
6
6
|
descText: string;
|
|
@@ -9,8 +9,9 @@ export interface MenuItemProps extends ComponentPropsWithoutRef<'div'> {
|
|
|
9
9
|
children?: React.ReactNode | undefined;
|
|
10
10
|
onClose?: () => void;
|
|
11
11
|
zIndex?: number;
|
|
12
|
+
disabled?: boolean;
|
|
12
13
|
}
|
|
13
|
-
declare function MenuItem({ className, label, onClick, caption, isChecked, onClose, children, zIndex, inheritedOnClick, ...props }: MenuItemProps): React.JSX.Element;
|
|
14
|
+
declare function MenuItem({ className, label, onClick, caption, isChecked, onClose, children, zIndex, inheritedOnClick, disabled, ...props }: MenuItemProps): React.JSX.Element;
|
|
14
15
|
declare namespace MenuItem {
|
|
15
16
|
var defaultProps: {
|
|
16
17
|
className: string;
|
|
@@ -2,7 +2,7 @@ import { StoryObj } from "@storybook/react/*";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: ({ children, ...props }: LiveSearchProps) => React.JSX.Element;
|
|
5
|
+
component: ({ children, ...props }: import("../../../components/Forms/LiveSearch/types").LiveSearchProps) => React.JSX.Element;
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: string;
|
|
8
8
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -265,24 +265,34 @@ var validUnion = function (value, union) {
|
|
|
265
265
|
return union.includes(value) ? value : union[0];
|
|
266
266
|
};
|
|
267
267
|
var useDetectOutsideClick = function (ref, initialState, ignoreRef, event) {
|
|
268
|
-
if (event === void 0) { event = '
|
|
268
|
+
if (event === void 0) { event = 'pointerdown'; }
|
|
269
269
|
var _a = useState(initialState), isActive = _a[0], setIsActive = _a[1];
|
|
270
270
|
useEffect(function () {
|
|
271
|
-
var pageClickEvent = function (
|
|
272
|
-
|
|
273
|
-
if (
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
271
|
+
var pageClickEvent = function (e) {
|
|
272
|
+
var target = e.target;
|
|
273
|
+
if (!ref || !ref.current)
|
|
274
|
+
return;
|
|
275
|
+
var path = e.composedPath
|
|
276
|
+
? e.composedPath()
|
|
277
|
+
: null;
|
|
278
|
+
if (ignoreRef && ignoreRef.current) {
|
|
279
|
+
var insideIgnore = Array.isArray(path)
|
|
280
|
+
? path.includes(ignoreRef.current)
|
|
281
|
+
: target && ignoreRef.current.contains(target);
|
|
282
|
+
if (insideIgnore)
|
|
283
|
+
return;
|
|
279
284
|
}
|
|
285
|
+
var inside = Array.isArray(path)
|
|
286
|
+
? path.includes(ref.current)
|
|
287
|
+
: target && ref.current.contains(target);
|
|
288
|
+
if (inside)
|
|
289
|
+
return;
|
|
290
|
+
setIsActive(function (prev) { return !prev; });
|
|
280
291
|
};
|
|
281
|
-
// If the item is active (ie open) then listen for clicks
|
|
282
292
|
if (isActive)
|
|
283
|
-
window.addEventListener(event, pageClickEvent);
|
|
284
|
-
return function () { return window.removeEventListener(event, pageClickEvent); };
|
|
285
|
-
}, [isActive, ref]);
|
|
293
|
+
window.addEventListener(event, pageClickEvent, true);
|
|
294
|
+
return function () { return window.removeEventListener(event, pageClickEvent, true); };
|
|
295
|
+
}, [isActive, ref, ignoreRef, event]);
|
|
286
296
|
return [isActive, setIsActive];
|
|
287
297
|
};
|
|
288
298
|
|
|
@@ -1898,9 +1908,9 @@ MenuContainerNoAnchor.defaultProps = {
|
|
|
1898
1908
|
};
|
|
1899
1909
|
|
|
1900
1910
|
function MenuItem(_a) {
|
|
1901
|
-
var _b = _a.className, className = _b === void 0 ? '' : _b, label = _a.label, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c, _d = _a.caption, caption = _d === void 0 ? undefined : _d, _e = _a.isChecked, isChecked = _e === void 0 ? undefined : _e, _f = _a.onClose, onClose = _f === void 0 ? function () { } : _f, children = _a.children, _g = _a.zIndex, zIndex = _g === void 0 ? 100 : _g, _h = _a.inheritedOnClick, inheritedOnClick = _h === void 0 ? function () { } : _h, props = __rest(_a, ["className", "label", "onClick", "caption", "isChecked", "onClose", "children", "zIndex", "inheritedOnClick"]);
|
|
1902
|
-
var
|
|
1903
|
-
var
|
|
1911
|
+
var _b = _a.className, className = _b === void 0 ? '' : _b, label = _a.label, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c, _d = _a.caption, caption = _d === void 0 ? undefined : _d, _e = _a.isChecked, isChecked = _e === void 0 ? undefined : _e, _f = _a.onClose, onClose = _f === void 0 ? function () { } : _f, children = _a.children, _g = _a.zIndex, zIndex = _g === void 0 ? 100 : _g, _h = _a.inheritedOnClick, inheritedOnClick = _h === void 0 ? function () { } : _h, _j = _a.disabled, disabled = _j === void 0 ? false : _j, props = __rest(_a, ["className", "label", "onClick", "caption", "isChecked", "onClose", "children", "zIndex", "inheritedOnClick", "disabled"]);
|
|
1912
|
+
var _k = useState(false), isHovered = _k[0], setIsHovered = _k[1];
|
|
1913
|
+
var _l = useState(false), isLeft = _l[0], setIsLeft = _l[1];
|
|
1904
1914
|
var isWithChecked = isChecked !== undefined;
|
|
1905
1915
|
var leftPadding = isWithChecked ? 'pl-[5px]' : 'pl-[10px]';
|
|
1906
1916
|
var rightPadding = caption || children ? 'pr-[5px]' : 'pr-[10px]';
|
|
@@ -1922,19 +1932,21 @@ function MenuItem(_a) {
|
|
|
1922
1932
|
? 'left-0 -translate-x-full'
|
|
1923
1933
|
: 'right-0 translate-x-full';
|
|
1924
1934
|
var currentZIndex = zIndex + 10;
|
|
1925
|
-
return (React.createElement("div", { className: "group/main relative cursor-pointer first:rounded-t-radius-sm first:pt-[6px] last:rounded-b-radius-sm last:pb-[6px]", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } },
|
|
1926
|
-
React.createElement("div", __assign({ className: "relative flex items-center py-[5px] hover:bg-bia-blue-pastel
|
|
1935
|
+
return (React.createElement("div", { className: "group/main relative cursor-pointer first:rounded-t-radius-sm first:pt-[6px] last:rounded-b-radius-sm last:pb-[6px]", onMouseEnter: function () { return !disabled && setIsHovered(true); }, onMouseLeave: function () { return !disabled && setIsHovered(false); } },
|
|
1936
|
+
React.createElement("div", __assign({ className: "relative flex items-center py-[5px] ".concat(itemClass, " ").concat(disabled ? 'cursor-not-allowed' : 'hover:bg-bia-blue-pastel'), role: "button", "aria-disabled": disabled, tabIndex: disabled ? -1 : 0, onClick: function (e) {
|
|
1937
|
+
if (disabled)
|
|
1938
|
+
return;
|
|
1927
1939
|
inheritedOnClick();
|
|
1928
1940
|
onClick(e);
|
|
1929
1941
|
}, onKeyDown: function () { }, style: {
|
|
1930
1942
|
zIndex: isHovered ? currentZIndex : currentZIndex + 15,
|
|
1931
1943
|
} }, props),
|
|
1932
1944
|
isWithChecked && (React.createElement("div", { className: "mr-[5px] aspect-square w-[14px]" }, isChecked && React.createElement(TbCheck, { className: "text-primary-black", size: 14 }))),
|
|
1933
|
-
React.createElement("span", { className: "whitespace-nowrap font-arial text-[11px] text-bia-black
|
|
1945
|
+
React.createElement("span", { className: "whitespace-nowrap font-arial text-[11px] ".concat(disabled ? 'text-bia-coolgrey-light-50' : 'text-bia-black') }, label),
|
|
1934
1946
|
React.createElement("div", { className: "ml-auto flex items-center" },
|
|
1935
1947
|
children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey" })),
|
|
1936
|
-
children === undefined && caption && (React.createElement("span", { className: "ml-[30px] whitespace-nowrap text-[11px] text-bia-coolgrey
|
|
1937
|
-
children && (React.createElement(MenuContainerNoAnchor, { open: isHovered, onClose: onClose, className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), ref: MenuContRef, zIndex: currentZIndex + 10, onClickItem: function () { return inheritedOnClick(); } }, children))));
|
|
1948
|
+
children === undefined && caption && (React.createElement("span", { className: "ml-[30px] whitespace-nowrap text-[11px] ".concat(disabled ? 'text-bia-coolgrey-light-50' : 'text-bia-coolgrey') }, caption)))),
|
|
1949
|
+
children && !disabled && (React.createElement(MenuContainerNoAnchor, { open: isHovered, onClose: onClose, className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), ref: MenuContRef, zIndex: currentZIndex + 10, onClickItem: function () { return inheritedOnClick(); } }, children))));
|
|
1938
1950
|
}
|
|
1939
1951
|
MenuItem.defaultProps = {
|
|
1940
1952
|
className: '',
|
|
@@ -2130,7 +2142,7 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
2130
2142
|
React.createElement("div", { className: "relative w-full" },
|
|
2131
2143
|
React.createElement("input", __assign({ className: "bianic-text-input bianic-fgc-target w-full rounded read-only:pointer-events-none read-only:border-bia-grey-light-50 hover:rounded-b-none focus:rounded-b-none focus-visible:outline-none disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active ".concat(extendedInputClassName), disabled: disabled, id: id, placeholder: placeholder || label, readOnly: readOnly, required: required, type: typeVariant, value: value, onChange: function (e) { return onChange(e); }, maxLength: maxLength, autoComplete: autoComplete, ref: ref }, props)),
|
|
2132
2144
|
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(actionElement ? '' : iconStyle, " ").concat(iconPosition, " ").concat(iconSizing) }, iconElement)),
|
|
2133
|
-
(descText || maxLength) && (React.createElement("div", { className: "bianic-text-input-desc flex justify-between gap-1 text-xs ".concat(descColor) },
|
|
2145
|
+
(descText || maxLength) && (React.createElement("div", { className: "bianic-text-input-desc flex justify-between gap-1 text-xs whitespace-nowrap ".concat(descColor) },
|
|
2134
2146
|
React.createElement("span", null, descText),
|
|
2135
2147
|
maxLength && (React.createElement("span", null,
|
|
2136
2148
|
remainWords,
|
|
@@ -2391,11 +2403,11 @@ DropdownContNoAnchor.defaultProps = {
|
|
|
2391
2403
|
|
|
2392
2404
|
var sizeUnion$2 = ['md', 'sm'];
|
|
2393
2405
|
function SelectInput(_a) {
|
|
2394
|
-
var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? 'md' : _c, id = _a.id, label = _a.label,
|
|
2395
|
-
var
|
|
2396
|
-
var
|
|
2406
|
+
var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? 'md' : _c, id = _a.id, _d = _a.isValid, isValid = _d === void 0 ? null : _d, label = _a.label, _e = _a.options, options = _e === void 0 ? [] : _e, _f = _a.required, required = _f === void 0 ? false : _f, selected = _a.selected, setSelected = _a.setSelected, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, children = _a.children, _h = _a.dropContProps, _j = _h === void 0 ? {} : _h, _k = _j.className, dropContClassName = _k === void 0 ? '' : _k, restDropContProps = __rest(_j, ["className"]), props = __rest(_a, ["descText", "disabled", "size", "id", "isValid", "label", "options", "required", "selected", "setSelected", "onClickDropdown", "children", "dropContProps"]);
|
|
2407
|
+
var _l = useState(false), isOpen = _l[0], setIsOpen = _l[1];
|
|
2408
|
+
var _m = useState(false), isDropUp = _m[0], setIsDropUp = _m[1];
|
|
2397
2409
|
var validatedSize = validUnion(size, sizeUnion$2);
|
|
2398
|
-
var
|
|
2410
|
+
var _o = sizeConfig$8[validatedSize], searchSize = _o.searchSize, iconSize = _o.iconSize;
|
|
2399
2411
|
var inputRef = useRef(null);
|
|
2400
2412
|
var dropdownContRef = useRef(null);
|
|
2401
2413
|
var handleOutsideClick = function (e) {
|
|
@@ -2445,12 +2457,18 @@ function SelectInput(_a) {
|
|
|
2445
2457
|
}
|
|
2446
2458
|
}, [isOpen]);
|
|
2447
2459
|
var dropdownPosition = isDropUp ? 'bottom-full' : 'top-full';
|
|
2448
|
-
|
|
2460
|
+
var descColor = 'text-primary-cool';
|
|
2461
|
+
var isExistValidation = isValid !== null && isValid !== undefined;
|
|
2462
|
+
if (!disabled && isExistValidation && isValid)
|
|
2463
|
+
descColor = 'text-bia-green';
|
|
2464
|
+
if (!disabled && isExistValidation && !isValid)
|
|
2465
|
+
descColor = 'text-bia-red';
|
|
2466
|
+
return (React.createElement("div", { className: "bianic-fgc-container bianic-text-input-container field-group flex w-full flex-col", ref: inputRef },
|
|
2449
2467
|
React.createElement("label", { htmlFor: id, className: "label pb-2 text-xs font-semibold" },
|
|
2450
2468
|
childrenElement(label),
|
|
2451
2469
|
required && React.createElement("span", { className: "p-1 text-bia-red" }, "*")),
|
|
2452
2470
|
React.createElement("div", { className: "group relative w-full" },
|
|
2453
|
-
React.createElement("input", __assign({ className: "field peer w-full
|
|
2471
|
+
React.createElement("input", __assign({ className: "bianic-fgc-target field peer w-full cursor-pointer rounded border border-bia-grey-dark-10 bg-primary-white pe-8 focus-visible:outline-none enabled:hover:rounded-b-none enabled:hover:border-b-bia-blue enabled:focus:rounded-b-none enabled:focus:border-b-bia-blue disabled:bg-bia-grey-light-80 disabled:text-bia-coolgrey ".concat(searchSize), onClick: function () { return setIsOpen(!isOpen); }, value: selectedLabel, readOnly: true, id: id, disabled: disabled }, props)),
|
|
2454
2472
|
React.createElement("div", { className: "pointer-events-none absolute inset-y-0 flex items-center pl-3 text-bia-coolgrey peer-disabled:text-bia-coolgrey-light-50 ".concat(iconSize) }, isOpen ? React.createElement(TbChevronUp, null) : React.createElement(TbChevronDown, null)),
|
|
2455
2473
|
children === undefined && isOpen && (React.createElement("div", { className: "absolute z-10 w-full rounded-b-md border border-bia-grey-dark-10 bg-primary-white shadow-lg ".concat(dropdownPosition), ref: optionsRef, onClick: onClickDropdown }, options.map(function (option) {
|
|
2456
2474
|
var isSelected = JSON.stringify(option) === JSON.stringify(selected);
|
|
@@ -2476,7 +2494,7 @@ function SelectInput(_a) {
|
|
|
2476
2494
|
}
|
|
2477
2495
|
return child;
|
|
2478
2496
|
})))),
|
|
2479
|
-
descText && (React.createElement("span", { className: "desc
|
|
2497
|
+
descText && (React.createElement("span", { className: "bianic-livesearch-desc bianic-text-input-desc whitespace-nowrap text-xs ".concat(descColor) }, descText))));
|
|
2480
2498
|
}
|
|
2481
2499
|
SelectInput.defaultProps = {
|
|
2482
2500
|
descText: '',
|
|
@@ -2709,23 +2727,28 @@ var useLiveSearch = function (_a) {
|
|
|
2709
2727
|
};
|
|
2710
2728
|
|
|
2711
2729
|
function LiveSearch(_a) {
|
|
2712
|
-
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
|
|
2730
|
+
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; _a.label; var _e = _a.onChangeText, onChangeText = _e === void 0 ? function () { } : _e, _f = _a.onClickDropdown, onClickDropdown = _f === void 0 ? function () { } : _f, options = _a.options, placeholder = _a.placeholder, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.required, required = _h === void 0 ? false : _h, _j = _a.searchVariant, searchVariant = _j === void 0 ? 'include' : _j, setValue = _a.setValue, _k = _a.size, size = _k === void 0 ? 'md' : _k, _l = _a.isValid, isValid = _l === void 0 ? null : _l, value = _a.value;
|
|
2713
2731
|
var inputRef = useRef(null);
|
|
2714
|
-
var
|
|
2732
|
+
var _m = useLiveSearch({
|
|
2715
2733
|
value: value,
|
|
2716
2734
|
setValue: setValue,
|
|
2717
2735
|
onChangeText: onChangeText,
|
|
2718
2736
|
dropContOnClickItem: dropContProps === null || dropContProps === void 0 ? void 0 : dropContProps.onClickItem,
|
|
2719
|
-
}), isOpen =
|
|
2720
|
-
var
|
|
2721
|
-
var
|
|
2737
|
+
}), isOpen = _m.isOpen, setIsOpen = _m.setIsOpen, searchTerm = _m.searchTerm, handleInputChange = _m.handleInputChange, handleDropdownItemClick = _m.handleDropdownItemClick;
|
|
2738
|
+
var _o = sizeConfig$6[size], iconClass = _o.iconClass, iconSize = _o.iconSize, inputClass = _o.inputClass;
|
|
2739
|
+
var _p = dropContProps || {}, dropContClassName = _p.className; _p.onClickItem; _p.anchorRef; var restDropContProps = __rest(_p, ["className", "onClickItem", "anchorRef"]);
|
|
2722
2740
|
var isValueExist = value && value.label !== undefined && value.label !== '';
|
|
2741
|
+
var descColor = 'text-primary-cool';
|
|
2742
|
+
var isExistValidation = isValid !== null && isValid !== undefined;
|
|
2743
|
+
if (!disabled && isExistValidation && isValid)
|
|
2744
|
+
descColor = 'text-bia-green';
|
|
2745
|
+
if (!disabled && isExistValidation && !isValid)
|
|
2746
|
+
descColor = 'text-bia-red';
|
|
2723
2747
|
var filteredOptions = filterOptions(options || [], value.label);
|
|
2724
|
-
var
|
|
2725
|
-
return (React.createElement("div", { className: "bianic-livesearch field-group group/form flex w-full flex-col gap-y-2 " },
|
|
2726
|
-
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
2748
|
+
var _q = processRenderedChildren(children, searchTerm, searchVariant, handleDropdownItemClick), renderedChildren = _q.renderedChildren, hasFilteredResults = _q.hasFilteredResults;
|
|
2749
|
+
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 " },
|
|
2727
2750
|
React.createElement("div", { className: "group relative w-full" },
|
|
2728
|
-
React.createElement("input", { className: "bianic-livesearch-input field peer w-full rounded border border-bia-grey-dark-10 bg-primary-white read-only:pointer-events-none read-only:border-bia-grey-disabled focus-visible:outline-none enabled:hover:rounded-b-none enabled:hover:border-b-bia-blue enabled:focus:rounded-b-none enabled:focus:border-b-bia-blue disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-10 disabled:text-bia-coolgrey ".concat(inputClass), onClick: function () { return setIsOpen(!isOpen); }, value: searchTerm, required: required, disabled: disabled, id: id, placeholder: placeholder, ref: inputRef, onChange: function (e) {
|
|
2751
|
+
React.createElement("input", { className: "bianic-livesearch-input bianic-fgc-target field peer w-full rounded border border-bia-grey-dark-10 bg-primary-white read-only:pointer-events-none read-only:border-bia-grey-disabled focus-visible:outline-none enabled:hover:rounded-b-none enabled:hover:border-b-bia-blue enabled:focus:rounded-b-none enabled:focus:border-b-bia-blue disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-10 disabled:text-bia-coolgrey ".concat(inputClass), onClick: function () { return setIsOpen(!isOpen); }, value: searchTerm, required: required, disabled: disabled, id: id, placeholder: placeholder, ref: inputRef, onChange: function (e) {
|
|
2729
2752
|
onChangeText(e);
|
|
2730
2753
|
handleInputChange(e);
|
|
2731
2754
|
}, type: "text", readOnly: readOnly, autoComplete: autoComplete }),
|
|
@@ -2747,7 +2770,7 @@ function LiveSearch(_a) {
|
|
|
2747
2770
|
? renderedChildren
|
|
2748
2771
|
: // If no results and searchTerm is present
|
|
2749
2772
|
searchTerm.length > 0 && (React.createElement(DropdownItem, { content: React.createElement("div", { className: "px-4 py-2 text-gray-500" }, "Tidak ada hasil ditemukan.") }))))),
|
|
2750
|
-
descText && (React.createElement("span", { className: "desc text-
|
|
2773
|
+
descText && (React.createElement("span", { className: "bianic-livesearch-desc bianic-text-input-desc whitespace-nowrap text-xs ".concat(descColor) }, descText))));
|
|
2751
2774
|
}
|
|
2752
2775
|
LiveSearch.defaultProps = {
|
|
2753
2776
|
descText: '',
|
|
@@ -3152,12 +3175,21 @@ var useCalendarLogic = function (selectedDate, minDate, maxDate) {
|
|
|
3152
3175
|
};
|
|
3153
3176
|
|
|
3154
3177
|
var PickerCalendar = function (_a) {
|
|
3155
|
-
var _b = _a.zIndex, zIndex = _b === void 0 ? 100 : _b, anchorRef = _a.anchorRef, maxDate = _a.maxDate, minDate = _a.minDate, onDateChange = _a.onDateChange; _a.ref; var _c = _a.selectedDate, selectedDate = _c === void 0 ? null : _c, props = __rest(_a, ["zIndex", "anchorRef", "maxDate", "minDate", "onDateChange", "ref", "selectedDate"]);
|
|
3178
|
+
var _b = _a.zIndex, zIndex = _b === void 0 ? 100 : _b, anchorRef = _a.anchorRef, maxDate = _a.maxDate, minDate = _a.minDate, onDateChange = _a.onDateChange; _a.ref; var _c = _a.selectedDate, selectedDate = _c === void 0 ? null : _c, _d = _a.isOpen, isOpen = _d === void 0 ? false : _d, _e = _a.onClose, onClose = _e === void 0 ? function () { } : _e, props = __rest(_a, ["zIndex", "anchorRef", "maxDate", "minDate", "onDateChange", "ref", "selectedDate", "isOpen", "onClose"]);
|
|
3156
3179
|
// Hooks & States
|
|
3157
|
-
var
|
|
3180
|
+
var _f = useCalendarLogic(selectedDate, minDate, maxDate), displayDays = _f.displayDays, handleNextDecade = _f.handleNextDecade, handleNextMonth = _f.handleNextMonth, handleNextYear = _f.handleNextYear, handlePickerMode = _f.handlePickerMode, handlePrevDecade = _f.handlePrevDecade, handlePrevMonth = _f.handlePrevMonth, handlePrevYear = _f.handlePrevYear, handleSetSelectedDate = _f.handleSetSelectedDate, isNextDisabled = _f.isNextDisabled, isPrevDisabled = _f.isPrevDisabled, maxDateValue = _f.maxDateValue, minDateValue = _f.minDateValue, pickerMode = _f.pickerMode, setViewMonthValue = _f.setViewMonthValue, setViewYearValue = _f.setViewYearValue, viewMonthValue = _f.viewMonthValue, viewYearValue = _f.viewYearValue, yearDisplayRange = _f.yearDisplayRange;
|
|
3158
3181
|
var pickerCalendarRef = useRef(null);
|
|
3182
|
+
var _g = useDetectOutsideClick(anchorRef, false, pickerCalendarRef), isPickerOpen = _g[0], setIsPickerOpen = _g[1];
|
|
3159
3183
|
var style = props.style, className = props.className, restProps = __rest(props, ["style", "className"]);
|
|
3160
3184
|
var positionStyle = usePopupPosition(anchorRef, pickerCalendarRef)[0];
|
|
3185
|
+
useEffect(function () {
|
|
3186
|
+
setIsPickerOpen(isOpen);
|
|
3187
|
+
}, [isOpen]);
|
|
3188
|
+
useEffect(function () {
|
|
3189
|
+
if (!isPickerOpen) {
|
|
3190
|
+
onClose();
|
|
3191
|
+
}
|
|
3192
|
+
}, [isPickerOpen]);
|
|
3161
3193
|
// Event Handlers
|
|
3162
3194
|
var handleDateSelect = function (date) {
|
|
3163
3195
|
handleSetSelectedDate(date, onDateChange);
|
|
@@ -3170,7 +3202,7 @@ var PickerCalendar = function (_a) {
|
|
|
3170
3202
|
setViewYearValue(year);
|
|
3171
3203
|
handlePickerMode('month');
|
|
3172
3204
|
};
|
|
3173
|
-
return createPortal(React.createElement("div", __assign({ className: "bianic-datepicker-calendar absolute flex w-[250px] flex-col gap-[15px] rounded-b-radius-sm bg-bia-white px-1.5 pb-[17px] pt-[15px] text-bia-black shadow-md ".concat(className), ref: pickerCalendarRef, style: __assign(__assign({ zIndex: zIndex }, positionStyle), style) }, restProps),
|
|
3205
|
+
return createPortal(React.createElement("div", __assign({ className: "bianic-datepicker-calendar absolute flex w-[250px] flex-col gap-[15px] rounded-b-radius-sm bg-bia-white px-1.5 pb-[17px] pt-[15px] text-bia-black shadow-md ".concat(className), ref: pickerCalendarRef, style: __assign(__assign({ zIndex: zIndex, display: isPickerOpen ? 'block' : 'none' }, positionStyle), style) }, restProps),
|
|
3174
3206
|
React.createElement("div", { className: "bianic-datepicker-calendar-controller flex w-full items-center justify-between" },
|
|
3175
3207
|
React.createElement("button", { className: "bianic-datepicker-calendar-prev-button text-bia-coolgrey disabled:text-bia-coolgrey-light-50", disabled: isPrevDisabled(), onClick: pickerMode === 'date'
|
|
3176
3208
|
? handlePrevMonth
|
|
@@ -3286,12 +3318,11 @@ function DatePicker(_a) {
|
|
|
3286
3318
|
var _b = _a.zIndexCalendar, zIndexCalendar = _b === void 0 ? 100 : _b, value = _a.value, onChange = _a.onChange, size = _a.size, disabled = _a.disabled; _a.placeholder; var label = _a.label, minDate = _a.minDate, maxDate = _a.maxDate, required = _a.required, nullDisplay = _a.nullDisplay, inputclassName = _a.inputclassName, containerClassName = _a.containerClassName;
|
|
3287
3319
|
// State and Ref
|
|
3288
3320
|
var inputRef = useRef(null);
|
|
3289
|
-
var
|
|
3290
|
-
|
|
3291
|
-
return (React.createElement("div", { className: "bianic-datepicker-container relative ".concat(containerClassName), ref: wrapperRef },
|
|
3321
|
+
var _d = useState(false), isPickerOpen = _d[0], setIsPickerOpen = _d[1];
|
|
3322
|
+
return (React.createElement("div", { className: "bianic-datepicker-container relative ".concat(containerClassName) },
|
|
3292
3323
|
React.createElement("div", { className: "bianic-datepicker-field-container" },
|
|
3293
3324
|
React.createElement(DateInputDisplay, { inputClassName: inputclassName, value: value, setValue: onChange, placeholder: "YYYY-MM-DD", nullDisplay: nullDisplay, size: size, label: label, required: required, buttonAction: function () { return setIsPickerOpen(!isPickerOpen); }, ref: inputRef, disabled: disabled })),
|
|
3294
|
-
|
|
3325
|
+
React.createElement(PickerCalendar, { zIndex: zIndexCalendar, anchorRef: inputRef, selectedDate: value, onDateChange: onChange, minDate: minDate, maxDate: maxDate, isOpen: isPickerOpen, onClose: function () { return setIsPickerOpen(false); } })));
|
|
3295
3326
|
}
|
|
3296
3327
|
|
|
3297
3328
|
var Node = function (_a) {
|