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.
Files changed (26) hide show
  1. package/README.md +49 -49
  2. package/dist/cjs/index.js +77 -46
  3. package/dist/cjs/lib.css +1 -1
  4. package/dist/cjs/types/components/Forms/DatePicker/PickerCalendar/types/types.d.ts +2 -0
  5. package/dist/cjs/types/components/Forms/LiveSearch/Example/CustomDropdown.d.ts +1 -0
  6. package/dist/cjs/types/components/Forms/LiveSearch/index.d.ts +1 -1
  7. package/dist/cjs/types/components/Forms/LiveSearch/types/index.d.ts +1 -0
  8. package/dist/cjs/types/components/Forms/SelectInput/PropsInterface.d.ts +1 -0
  9. package/dist/cjs/types/components/Forms/SelectInput/index.d.ts +1 -1
  10. package/dist/cjs/types/components/Menu/MenuItem.d.ts +2 -1
  11. package/dist/cjs/types/stories/Form/LiveSearch/LivesearchCustomDropdownExample.stories.d.ts +1 -1
  12. package/dist/esm/index.js +77 -46
  13. package/dist/esm/lib.css +1 -1
  14. package/dist/esm/types/components/Forms/DatePicker/PickerCalendar/types/types.d.ts +2 -0
  15. package/dist/esm/types/components/Forms/LiveSearch/Example/CustomDropdown.d.ts +1 -0
  16. package/dist/esm/types/components/Forms/LiveSearch/index.d.ts +1 -1
  17. package/dist/esm/types/components/Forms/LiveSearch/types/index.d.ts +1 -0
  18. package/dist/esm/types/components/Forms/SelectInput/PropsInterface.d.ts +1 -0
  19. package/dist/esm/types/components/Forms/SelectInput/index.d.ts +1 -1
  20. package/dist/esm/types/components/Menu/MenuItem.d.ts +2 -1
  21. package/dist/esm/types/stories/Form/LiveSearch/LivesearchCustomDropdownExample.stories.d.ts +1 -1
  22. package/dist/index.d.ts +8 -3
  23. package/package.json +97 -97
  24. package/src/style/color.css +627 -627
  25. package/src/style/scrollbar.css +78 -78
  26. package/tailwind.config.js +543 -543
package/README.md CHANGED
@@ -1,49 +1,49 @@
1
- # Bianic 2.0
2
-
3
- DLS designed by BIAENERGI
4
-
5
- ## Installation
6
-
7
- ### First Installation
8
-
9
- `npm i bianic-ui`
10
-
11
- ## Usage
12
-
13
- After Bianic-Ui succesfully installed, you can call the component using JSX tag declaration style ex: `<Alert />`. Futher documentation about component can be access [here](https://ristek.link/bianic-dev-docs)
14
-
15
- ## Support
16
-
17
- If you found any bug, please contact at [devbiaenergi@gmail.com](mailto:devbiaenergi@gmail.com)
18
-
19
- ## Contributing
20
-
21
- If you're interested in contributing to Bianic-Ui, please contact our team at [devbiaenergi@gmail.com](mailto:devbiaenergi@gmail.com)
22
-
23
- ## Change Log
24
-
25
- Coming soon
26
-
27
- ## Development Notes
28
-
29
- ### Code Convention
30
-
31
- - Always separate style with tsx
32
- - For style config always try to be object with one level
33
- - Separate config file and component file for more readable code
34
- - The variable name of style config must be describe what you styling not describe the parameters (or key)
35
- - Use .tsx only when defining component, just us .ts if no component defined on the file
36
- - Don't import simulation or any demo to index.ts
37
- - Update storybook for every change or new component
38
-
39
- ### Component attribute naming
40
-
41
- - Check on html documentation. Always try to use the exisiting html atribute name.
42
- - If there the attibute not listed on html documentation. You can make it on your own with rules :
43
- - Use "is" prefix for boolean
44
- - Use "on" prefix for event listener
45
-
46
- ### Another Notes
47
-
48
- - Please assign class `...-primary-black` when need black color. If not assigned system will use #000000 black.
49
- - Just discuss any concept you had. **Discuss first, Implement later**.
1
+ # Bianic 2.0
2
+
3
+ DLS designed by BIAENERGI
4
+
5
+ ## Installation
6
+
7
+ ### First Installation
8
+
9
+ `npm i bianic-ui`
10
+
11
+ ## Usage
12
+
13
+ After Bianic-Ui succesfully installed, you can call the component using JSX tag declaration style ex: `<Alert />`. Futher documentation about component can be access [here](https://ristek.link/bianic-dev-docs)
14
+
15
+ ## Support
16
+
17
+ If you found any bug, please contact at [devbiaenergi@gmail.com](mailto:devbiaenergi@gmail.com)
18
+
19
+ ## Contributing
20
+
21
+ If you're interested in contributing to Bianic-Ui, please contact our team at [devbiaenergi@gmail.com](mailto:devbiaenergi@gmail.com)
22
+
23
+ ## Change Log
24
+
25
+ Coming soon
26
+
27
+ ## Development Notes
28
+
29
+ ### Code Convention
30
+
31
+ - Always separate style with tsx
32
+ - For style config always try to be object with one level
33
+ - Separate config file and component file for more readable code
34
+ - The variable name of style config must be describe what you styling not describe the parameters (or key)
35
+ - Use .tsx only when defining component, just us .ts if no component defined on the file
36
+ - Don't import simulation or any demo to index.ts
37
+ - Update storybook for every change or new component
38
+
39
+ ### Component attribute naming
40
+
41
+ - Check on html documentation. Always try to use the exisiting html atribute name.
42
+ - If there the attibute not listed on html documentation. You can make it on your own with rules :
43
+ - Use "is" prefix for boolean
44
+ - Use "on" prefix for event listener
45
+
46
+ ### Another Notes
47
+
48
+ - Please assign class `...-primary-black` when need black color. If not assigned system will use #000000 black.
49
+ - Just discuss any concept you had. **Discuss first, Implement later**.
package/dist/cjs/index.js CHANGED
@@ -267,24 +267,34 @@ var validUnion = function (value, union) {
267
267
  return union.includes(value) ? value : union[0];
268
268
  };
269
269
  var useDetectOutsideClick = function (ref, initialState, ignoreRef, event) {
270
- if (event === void 0) { event = 'click'; }
270
+ if (event === void 0) { event = 'pointerdown'; }
271
271
  var _a = React.useState(initialState), isActive = _a[0], setIsActive = _a[1];
272
272
  React.useEffect(function () {
273
- var pageClickEvent = function (event) {
274
- // If the active element exists and is clicked outside of
275
- if (ignoreRef &&
276
- ignoreRef.current &&
277
- ignoreRef.current.contains(event.target)) ;
278
- else if (ref.current !== null &&
279
- !ref.current.contains(event.target)) {
280
- setIsActive(!isActive);
273
+ var pageClickEvent = function (e) {
274
+ var target = e.target;
275
+ if (!ref || !ref.current)
276
+ return;
277
+ var path = e.composedPath
278
+ ? e.composedPath()
279
+ : null;
280
+ if (ignoreRef && ignoreRef.current) {
281
+ var insideIgnore = Array.isArray(path)
282
+ ? path.includes(ignoreRef.current)
283
+ : target && ignoreRef.current.contains(target);
284
+ if (insideIgnore)
285
+ return;
281
286
  }
287
+ var inside = Array.isArray(path)
288
+ ? path.includes(ref.current)
289
+ : target && ref.current.contains(target);
290
+ if (inside)
291
+ return;
292
+ setIsActive(function (prev) { return !prev; });
282
293
  };
283
- // If the item is active (ie open) then listen for clicks
284
294
  if (isActive)
285
- window.addEventListener(event, pageClickEvent);
286
- return function () { return window.removeEventListener(event, pageClickEvent); };
287
- }, [isActive, ref]);
295
+ window.addEventListener(event, pageClickEvent, true);
296
+ return function () { return window.removeEventListener(event, pageClickEvent, true); };
297
+ }, [isActive, ref, ignoreRef, event]);
288
298
  return [isActive, setIsActive];
289
299
  };
290
300
 
@@ -1900,9 +1910,9 @@ MenuContainerNoAnchor.defaultProps = {
1900
1910
  };
1901
1911
 
1902
1912
  function MenuItem(_a) {
1903
- 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"]);
1904
- var _j = React.useState(false), isHovered = _j[0], setIsHovered = _j[1];
1905
- var _k = React.useState(false), isLeft = _k[0], setIsLeft = _k[1];
1913
+ 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"]);
1914
+ var _k = React.useState(false), isHovered = _k[0], setIsHovered = _k[1];
1915
+ var _l = React.useState(false), isLeft = _l[0], setIsLeft = _l[1];
1906
1916
  var isWithChecked = isChecked !== undefined;
1907
1917
  var leftPadding = isWithChecked ? 'pl-[5px]' : 'pl-[10px]';
1908
1918
  var rightPadding = caption || children ? 'pr-[5px]' : 'pr-[10px]';
@@ -1924,19 +1934,21 @@ function MenuItem(_a) {
1924
1934
  ? 'left-0 -translate-x-full'
1925
1935
  : 'right-0 translate-x-full';
1926
1936
  var currentZIndex = zIndex + 10;
1927
- 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); } },
1928
- React.createElement("div", __assign({ className: "relative flex items-center py-[5px] hover:bg-bia-blue-pastel ".concat(itemClass), role: "button", tabIndex: 0, onClick: function (e) {
1937
+ 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); } },
1938
+ 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) {
1939
+ if (disabled)
1940
+ return;
1929
1941
  inheritedOnClick();
1930
1942
  onClick(e);
1931
1943
  }, onKeyDown: function () { }, style: {
1932
1944
  zIndex: isHovered ? currentZIndex : currentZIndex + 15,
1933
1945
  } }, props),
1934
1946
  isWithChecked && (React.createElement("div", { className: "mr-[5px] aspect-square w-[14px]" }, isChecked && React.createElement(TbCheck, { className: "text-primary-black", size: 14 }))),
1935
- React.createElement("span", { className: "whitespace-nowrap font-arial text-[11px] text-bia-black" }, label),
1947
+ React.createElement("span", { className: "whitespace-nowrap font-arial text-[11px] ".concat(disabled ? 'text-bia-coolgrey-light-50' : 'text-bia-black') }, label),
1936
1948
  React.createElement("div", { className: "ml-auto flex items-center" },
1937
1949
  children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey" })),
1938
- children === undefined && caption && (React.createElement("span", { className: "ml-[30px] whitespace-nowrap text-[11px] text-bia-coolgrey" }, caption)))),
1939
- 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))));
1950
+ children === undefined && caption && (React.createElement("span", { className: "ml-[30px] whitespace-nowrap text-[11px] ".concat(disabled ? 'text-bia-coolgrey-light-50' : 'text-bia-coolgrey') }, caption)))),
1951
+ 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))));
1940
1952
  }
1941
1953
  MenuItem.defaultProps = {
1942
1954
  className: '',
@@ -2132,7 +2144,7 @@ var TextInput = React.forwardRef(function (_a, ref) {
2132
2144
  React.createElement("div", { className: "relative w-full" },
2133
2145
  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)),
2134
2146
  React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(actionElement ? '' : iconStyle, " ").concat(iconPosition, " ").concat(iconSizing) }, iconElement)),
2135
- (descText || maxLength) && (React.createElement("div", { className: "bianic-text-input-desc flex justify-between gap-1 text-xs ".concat(descColor) },
2147
+ (descText || maxLength) && (React.createElement("div", { className: "bianic-text-input-desc flex justify-between gap-1 text-xs whitespace-nowrap ".concat(descColor) },
2136
2148
  React.createElement("span", null, descText),
2137
2149
  maxLength && (React.createElement("span", null,
2138
2150
  remainWords,
@@ -2393,11 +2405,11 @@ DropdownContNoAnchor.defaultProps = {
2393
2405
 
2394
2406
  var sizeUnion$2 = ['md', 'sm'];
2395
2407
  function SelectInput(_a) {
2396
- 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, _d = _a.options, options = _d === void 0 ? [] : _d, _e = _a.required, required = _e === void 0 ? false : _e, selected = _a.selected, setSelected = _a.setSelected, _f = _a.onClickDropdown, onClickDropdown = _f === void 0 ? function () { } : _f, children = _a.children, _g = _a.dropContProps, _h = _g === void 0 ? {} : _g, _j = _h.className, dropContClassName = _j === void 0 ? '' : _j, restDropContProps = __rest(_h, ["className"]), props = __rest(_a, ["descText", "disabled", "size", "id", "label", "options", "required", "selected", "setSelected", "onClickDropdown", "children", "dropContProps"]);
2397
- var _k = React.useState(false), isOpen = _k[0], setIsOpen = _k[1];
2398
- var _l = React.useState(false), isDropUp = _l[0], setIsDropUp = _l[1];
2408
+ 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"]);
2409
+ var _l = React.useState(false), isOpen = _l[0], setIsOpen = _l[1];
2410
+ var _m = React.useState(false), isDropUp = _m[0], setIsDropUp = _m[1];
2399
2411
  var validatedSize = validUnion(size, sizeUnion$2);
2400
- var _m = sizeConfig$8[validatedSize], searchSize = _m.searchSize, iconSize = _m.iconSize;
2412
+ var _o = sizeConfig$8[validatedSize], searchSize = _o.searchSize, iconSize = _o.iconSize;
2401
2413
  var inputRef = React.useRef(null);
2402
2414
  var dropdownContRef = React.useRef(null);
2403
2415
  var handleOutsideClick = function (e) {
@@ -2447,12 +2459,18 @@ function SelectInput(_a) {
2447
2459
  }
2448
2460
  }, [isOpen]);
2449
2461
  var dropdownPosition = isDropUp ? 'bottom-full' : 'top-full';
2450
- return (React.createElement("div", { className: "field-group flex w-full flex-col", ref: inputRef },
2462
+ var descColor = 'text-primary-cool';
2463
+ var isExistValidation = isValid !== null && isValid !== undefined;
2464
+ if (!disabled && isExistValidation && isValid)
2465
+ descColor = 'text-bia-green';
2466
+ if (!disabled && isExistValidation && !isValid)
2467
+ descColor = 'text-bia-red';
2468
+ return (React.createElement("div", { className: "bianic-fgc-container bianic-text-input-container field-group flex w-full flex-col", ref: inputRef },
2451
2469
  React.createElement("label", { htmlFor: id, className: "label pb-2 text-xs font-semibold" },
2452
2470
  childrenElement(label),
2453
2471
  required && React.createElement("span", { className: "p-1 text-bia-red" }, "*")),
2454
2472
  React.createElement("div", { className: "group relative w-full" },
2455
- React.createElement("input", __assign({ className: "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)),
2473
+ 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)),
2456
2474
  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)),
2457
2475
  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) {
2458
2476
  var isSelected = JSON.stringify(option) === JSON.stringify(selected);
@@ -2478,7 +2496,7 @@ function SelectInput(_a) {
2478
2496
  }
2479
2497
  return child;
2480
2498
  })))),
2481
- descText && (React.createElement("span", { className: "desc mt-2 text-xs text-primary-cool" }, descText))));
2499
+ descText && (React.createElement("span", { className: "bianic-livesearch-desc bianic-text-input-desc whitespace-nowrap text-xs ".concat(descColor) }, descText))));
2482
2500
  }
2483
2501
  SelectInput.defaultProps = {
2484
2502
  descText: '',
@@ -2711,23 +2729,28 @@ var useLiveSearch = function (_a) {
2711
2729
  };
2712
2730
 
2713
2731
  function LiveSearch(_a) {
2714
- 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 = _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, value = _a.value;
2732
+ 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;
2715
2733
  var inputRef = React.useRef(null);
2716
- var _l = useLiveSearch({
2734
+ var _m = useLiveSearch({
2717
2735
  value: value,
2718
2736
  setValue: setValue,
2719
2737
  onChangeText: onChangeText,
2720
2738
  dropContOnClickItem: dropContProps === null || dropContProps === void 0 ? void 0 : dropContProps.onClickItem,
2721
- }), isOpen = _l.isOpen, setIsOpen = _l.setIsOpen, searchTerm = _l.searchTerm, handleInputChange = _l.handleInputChange, handleDropdownItemClick = _l.handleDropdownItemClick;
2722
- var _m = sizeConfig$6[size], iconClass = _m.iconClass, iconSize = _m.iconSize, inputClass = _m.inputClass;
2723
- var _o = dropContProps || {}, dropContClassName = _o.className; _o.onClickItem; _o.anchorRef; var restDropContProps = __rest(_o, ["className", "onClickItem", "anchorRef"]);
2739
+ }), isOpen = _m.isOpen, setIsOpen = _m.setIsOpen, searchTerm = _m.searchTerm, handleInputChange = _m.handleInputChange, handleDropdownItemClick = _m.handleDropdownItemClick;
2740
+ var _o = sizeConfig$6[size], iconClass = _o.iconClass, iconSize = _o.iconSize, inputClass = _o.inputClass;
2741
+ var _p = dropContProps || {}, dropContClassName = _p.className; _p.onClickItem; _p.anchorRef; var restDropContProps = __rest(_p, ["className", "onClickItem", "anchorRef"]);
2724
2742
  var isValueExist = value && value.label !== undefined && value.label !== '';
2743
+ var descColor = 'text-primary-cool';
2744
+ var isExistValidation = isValid !== null && isValid !== undefined;
2745
+ if (!disabled && isExistValidation && isValid)
2746
+ descColor = 'text-bia-green';
2747
+ if (!disabled && isExistValidation && !isValid)
2748
+ descColor = 'text-bia-red';
2725
2749
  var filteredOptions = filterOptions(options || [], value.label);
2726
- var _p = processRenderedChildren(children, searchTerm, searchVariant, handleDropdownItemClick), renderedChildren = _p.renderedChildren, hasFilteredResults = _p.hasFilteredResults;
2727
- return (React.createElement("div", { className: "bianic-livesearch field-group group/form flex w-full flex-col gap-y-2 " },
2728
- label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
2750
+ var _q = processRenderedChildren(children, searchTerm, searchVariant, handleDropdownItemClick), renderedChildren = _q.renderedChildren, hasFilteredResults = _q.hasFilteredResults;
2751
+ 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 " },
2729
2752
  React.createElement("div", { className: "group relative w-full" },
2730
- 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) {
2753
+ 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) {
2731
2754
  onChangeText(e);
2732
2755
  handleInputChange(e);
2733
2756
  }, type: "text", readOnly: readOnly, autoComplete: autoComplete }),
@@ -2749,7 +2772,7 @@ function LiveSearch(_a) {
2749
2772
  ? renderedChildren
2750
2773
  : // If no results and searchTerm is present
2751
2774
  searchTerm.length > 0 && (React.createElement(DropdownItem, { content: React.createElement("div", { className: "px-4 py-2 text-gray-500" }, "Tidak ada hasil ditemukan.") }))))),
2752
- descText && (React.createElement("span", { className: "desc text-xs text-primary-cool" }, descText))));
2775
+ descText && (React.createElement("span", { className: "bianic-livesearch-desc bianic-text-input-desc whitespace-nowrap text-xs ".concat(descColor) }, descText))));
2753
2776
  }
2754
2777
  LiveSearch.defaultProps = {
2755
2778
  descText: '',
@@ -3154,12 +3177,21 @@ var useCalendarLogic = function (selectedDate, minDate, maxDate) {
3154
3177
  };
3155
3178
 
3156
3179
  var PickerCalendar = function (_a) {
3157
- 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"]);
3180
+ 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"]);
3158
3181
  // Hooks & States
3159
- var _d = useCalendarLogic(selectedDate, minDate, maxDate), displayDays = _d.displayDays, handleNextDecade = _d.handleNextDecade, handleNextMonth = _d.handleNextMonth, handleNextYear = _d.handleNextYear, handlePickerMode = _d.handlePickerMode, handlePrevDecade = _d.handlePrevDecade, handlePrevMonth = _d.handlePrevMonth, handlePrevYear = _d.handlePrevYear, handleSetSelectedDate = _d.handleSetSelectedDate, isNextDisabled = _d.isNextDisabled, isPrevDisabled = _d.isPrevDisabled, maxDateValue = _d.maxDateValue, minDateValue = _d.minDateValue, pickerMode = _d.pickerMode, setViewMonthValue = _d.setViewMonthValue, setViewYearValue = _d.setViewYearValue, viewMonthValue = _d.viewMonthValue, viewYearValue = _d.viewYearValue, yearDisplayRange = _d.yearDisplayRange;
3182
+ 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;
3160
3183
  var pickerCalendarRef = React.useRef(null);
3184
+ var _g = useDetectOutsideClick(anchorRef, false, pickerCalendarRef), isPickerOpen = _g[0], setIsPickerOpen = _g[1];
3161
3185
  var style = props.style, className = props.className, restProps = __rest(props, ["style", "className"]);
3162
3186
  var positionStyle = usePopupPosition(anchorRef, pickerCalendarRef)[0];
3187
+ React.useEffect(function () {
3188
+ setIsPickerOpen(isOpen);
3189
+ }, [isOpen]);
3190
+ React.useEffect(function () {
3191
+ if (!isPickerOpen) {
3192
+ onClose();
3193
+ }
3194
+ }, [isPickerOpen]);
3163
3195
  // Event Handlers
3164
3196
  var handleDateSelect = function (date) {
3165
3197
  handleSetSelectedDate(date, onDateChange);
@@ -3172,7 +3204,7 @@ var PickerCalendar = function (_a) {
3172
3204
  setViewYearValue(year);
3173
3205
  handlePickerMode('month');
3174
3206
  };
3175
- return reactDom.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),
3207
+ return reactDom.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),
3176
3208
  React.createElement("div", { className: "bianic-datepicker-calendar-controller flex w-full items-center justify-between" },
3177
3209
  React.createElement("button", { className: "bianic-datepicker-calendar-prev-button text-bia-coolgrey disabled:text-bia-coolgrey-light-50", disabled: isPrevDisabled(), onClick: pickerMode === 'date'
3178
3210
  ? handlePrevMonth
@@ -3288,12 +3320,11 @@ function DatePicker(_a) {
3288
3320
  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;
3289
3321
  // State and Ref
3290
3322
  var inputRef = React.useRef(null);
3291
- var wrapperRef = React.useRef(null);
3292
- var _d = useDetectOutsideClick(wrapperRef, false), isPickerOpen = _d[0], setIsPickerOpen = _d[1];
3293
- return (React.createElement("div", { className: "bianic-datepicker-container relative ".concat(containerClassName), ref: wrapperRef },
3323
+ var _d = React.useState(false), isPickerOpen = _d[0], setIsPickerOpen = _d[1];
3324
+ return (React.createElement("div", { className: "bianic-datepicker-container relative ".concat(containerClassName) },
3294
3325
  React.createElement("div", { className: "bianic-datepicker-field-container" },
3295
3326
  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 })),
3296
- isPickerOpen && (React.createElement(PickerCalendar, { zIndex: zIndexCalendar, anchorRef: inputRef, selectedDate: value, onDateChange: onChange, minDate: minDate, maxDate: maxDate }))));
3327
+ React.createElement(PickerCalendar, { zIndex: zIndexCalendar, anchorRef: inputRef, selectedDate: value, onDateChange: onChange, minDate: minDate, maxDate: maxDate, isOpen: isPickerOpen, onClose: function () { return setIsPickerOpen(false); } })));
3297
3328
  }
3298
3329
 
3299
3330
  var Node = function (_a) {