@skalfa/skalfa-component 1.0.2 → 1.0.3

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 (168) hide show
  1. package/dist/accordion/Accordion.component.d.ts +1 -1
  2. package/dist/breadcrumb/Breadcrumb.component.d.ts +1 -1
  3. package/dist/button/Button.component.d.ts +1 -1
  4. package/dist/card/AlertCard.component.d.ts +1 -1
  5. package/dist/card/Card.component.d.ts +1 -1
  6. package/dist/card/DashboardCard.component.d.ts +1 -1
  7. package/dist/card/GalleryCard.component.d.ts +1 -1
  8. package/dist/card/ProductCard.component.d.ts +1 -1
  9. package/dist/card/ProfileCard.component.d.ts +1 -1
  10. package/dist/carousel/Carousel.component.d.ts +1 -1
  11. package/dist/chip/Chip.component.d.ts +1 -1
  12. package/dist/input/Checkbox.component.d.ts +1 -1
  13. package/dist/input/Input.component.d.ts +1 -1
  14. package/dist/input/InputCheckbox.component.d.ts +1 -1
  15. package/dist/input/InputCurrency.component.d.ts +1 -1
  16. package/dist/input/InputDate.component.d.ts +1 -1
  17. package/dist/input/InputDate.component.js +4 -4
  18. package/dist/input/InputDatetime.component.d.ts +1 -1
  19. package/dist/input/InputDocument.component.d.ts +1 -1
  20. package/dist/input/InputMap.component.d.ts +1 -1
  21. package/dist/input/InputNumber.component.d.ts +1 -1
  22. package/dist/input/InputPassword.component.d.ts +1 -1
  23. package/dist/input/InputRadio.component.d.ts +1 -1
  24. package/dist/input/InputTime.component.d.ts +1 -1
  25. package/dist/input/InputValues.component.d.ts +1 -1
  26. package/dist/input/Radio.component.d.ts +1 -1
  27. package/dist/input/Select.component.d.ts +1 -1
  28. package/dist/modal/FloatingPage.component.d.ts +1 -1
  29. package/dist/modal/Modal.component.d.ts +1 -1
  30. package/dist/modal/ModalConfirm.component.d.ts +1 -1
  31. package/dist/modal/Toast.component.d.ts +1 -1
  32. package/dist/nav/Bottombar.component.d.ts +1 -1
  33. package/dist/nav/Footer.component.d.ts +1 -1
  34. package/dist/nav/Headbar.component.d.ts +4 -11
  35. package/dist/nav/Headbar.component.js +3 -23
  36. package/dist/nav/Navbar.component.d.ts +1 -1
  37. package/dist/nav/Sidebar.component.d.ts +2 -2
  38. package/dist/nav/Tabbar.component.d.ts +1 -1
  39. package/dist/nav/Wizard.component.d.ts +1 -1
  40. package/dist/supervision/FormSupervision.component.d.ts +1 -1
  41. package/dist/supervision/TableSupervision.component.d.ts +1 -1
  42. package/dist/table/ControlBar.component.d.ts +1 -1
  43. package/dist/table/FilterComponent.d.ts +2 -2
  44. package/dist/table/Pagination.component.d.ts +1 -1
  45. package/dist/table/Table.component.d.ts +1 -1
  46. package/dist/typography/TypographyArticle.component.d.ts +1 -1
  47. package/dist/typography/TypographyColumn.component.d.ts +1 -1
  48. package/dist/typography/TypographyContent.component.d.ts +1 -1
  49. package/dist/typography/TypographyTips.component.d.ts +1 -1
  50. package/dist/wrap/Image.component.d.ts +1 -1
  51. package/dist/wrap/ScrollContainer.component.d.ts +1 -1
  52. package/dist/wrap/ShortcutProvider.d.ts +1 -1
  53. package/dist/wrap/Swipe.component.d.ts +1 -1
  54. package/package.json +2 -2
  55. package/dist/src/accordion/Accordion.component.d.ts +0 -13
  56. package/dist/src/accordion/Accordion.component.js +0 -25
  57. package/dist/src/breadcrumb/Breadcrumb.component.d.ts +0 -14
  58. package/dist/src/breadcrumb/Breadcrumb.component.js +0 -21
  59. package/dist/src/button/Button.component.d.ts +0 -21
  60. package/dist/src/button/Button.component.js +0 -19
  61. package/dist/src/card/AlertCard.component.d.ts +0 -11
  62. package/dist/src/card/AlertCard.component.js +0 -9
  63. package/dist/src/card/Card.component.d.ts +0 -5
  64. package/dist/src/card/Card.component.js +0 -9
  65. package/dist/src/card/DashboardCard.component.d.ts +0 -9
  66. package/dist/src/card/DashboardCard.component.js +0 -13
  67. package/dist/src/card/GalleryCard.component.d.ts +0 -7
  68. package/dist/src/card/GalleryCard.component.js +0 -13
  69. package/dist/src/card/ProductCard.component.d.ts +0 -9
  70. package/dist/src/card/ProductCard.component.js +0 -13
  71. package/dist/src/card/ProfileCard.component.d.ts +0 -10
  72. package/dist/src/card/ProfileCard.component.js +0 -13
  73. package/dist/src/carousel/Carousel.component.d.ts +0 -13
  74. package/dist/src/carousel/Carousel.component.js +0 -37
  75. package/dist/src/chip/Chip.component.d.ts +0 -6
  76. package/dist/src/chip/Chip.component.js +0 -12
  77. package/dist/src/index.d.ts +0 -13
  78. package/dist/src/index.js +0 -29
  79. package/dist/src/input/Checkbox.component.d.ts +0 -13
  80. package/dist/src/input/Checkbox.component.js +0 -23
  81. package/dist/src/input/Input.component.d.ts +0 -23
  82. package/dist/src/input/Input.component.js +0 -134
  83. package/dist/src/input/InputCheckbox.component.d.ts +0 -27
  84. package/dist/src/input/InputCheckbox.component.js +0 -53
  85. package/dist/src/input/InputCurrency.component.d.ts +0 -21
  86. package/dist/src/input/InputCurrency.component.js +0 -30
  87. package/dist/src/input/InputDate.component.d.ts +0 -24
  88. package/dist/src/input/InputDate.component.js +0 -107
  89. package/dist/src/input/InputDatetime.component.d.ts +0 -17
  90. package/dist/src/input/InputDatetime.component.js +0 -75
  91. package/dist/src/input/InputDocument.component.d.ts +0 -22
  92. package/dist/src/input/InputDocument.component.js +0 -88
  93. package/dist/src/input/InputImage.component.d.ts +0 -23
  94. package/dist/src/input/InputImage.component.js +0 -260
  95. package/dist/src/input/InputMap.component.d.ts +0 -25
  96. package/dist/src/input/InputMap.component.js +0 -101
  97. package/dist/src/input/InputNumber.component.d.ts +0 -19
  98. package/dist/src/input/InputNumber.component.js +0 -40
  99. package/dist/src/input/InputOtp.component.d.ts +0 -14
  100. package/dist/src/input/InputOtp.component.js +0 -65
  101. package/dist/src/input/InputPassword.component.d.ts +0 -17
  102. package/dist/src/input/InputPassword.component.js +0 -59
  103. package/dist/src/input/InputRadio.component.d.ts +0 -27
  104. package/dist/src/input/InputRadio.component.js +0 -56
  105. package/dist/src/input/InputTime.component.d.ts +0 -23
  106. package/dist/src/input/InputTime.component.js +0 -73
  107. package/dist/src/input/InputValues.component.d.ts +0 -9
  108. package/dist/src/input/InputValues.component.js +0 -19
  109. package/dist/src/input/Radio.component.d.ts +0 -12
  110. package/dist/src/input/Radio.component.js +0 -22
  111. package/dist/src/input/Select.component.d.ts +0 -47
  112. package/dist/src/input/Select.component.js +0 -275
  113. package/dist/src/modal/BottomSheet.component.d.ts +0 -12
  114. package/dist/src/modal/BottomSheet.component.js +0 -161
  115. package/dist/src/modal/FloatingPage.component.d.ts +0 -12
  116. package/dist/src/modal/FloatingPage.component.js +0 -27
  117. package/dist/src/modal/Modal.component.d.ts +0 -12
  118. package/dist/src/modal/Modal.component.js +0 -27
  119. package/dist/src/modal/ModalConfirm.component.d.ts +0 -26
  120. package/dist/src/modal/ModalConfirm.component.js +0 -68
  121. package/dist/src/modal/Toast.component.d.ts +0 -11
  122. package/dist/src/modal/Toast.component.js +0 -58
  123. package/dist/src/nav/Bottombar.component.d.ts +0 -12
  124. package/dist/src/nav/Bottombar.component.js +0 -32
  125. package/dist/src/nav/Footer.component.d.ts +0 -37
  126. package/dist/src/nav/Footer.component.js +0 -49
  127. package/dist/src/nav/Headbar.component.d.ts +0 -14
  128. package/dist/src/nav/Headbar.component.js +0 -32
  129. package/dist/src/nav/Navbar.component.d.ts +0 -22
  130. package/dist/src/nav/Navbar.component.js +0 -26
  131. package/dist/src/nav/Sidebar.component.d.ts +0 -33
  132. package/dist/src/nav/Sidebar.component.js +0 -87
  133. package/dist/src/nav/Tabbar.component.d.ts +0 -13
  134. package/dist/src/nav/Tabbar.component.js +0 -17
  135. package/dist/src/nav/Wizard.component.d.ts +0 -9
  136. package/dist/src/nav/Wizard.component.js +0 -24
  137. package/dist/src/supervision/FormSupervision.component.d.ts +0 -93
  138. package/dist/src/supervision/FormSupervision.component.js +0 -168
  139. package/dist/src/supervision/TableSupervision.component.d.ts +0 -78
  140. package/dist/src/supervision/TableSupervision.component.js +0 -273
  141. package/dist/src/table/ControlBar.component.d.ts +0 -34
  142. package/dist/src/table/ControlBar.component.js +0 -205
  143. package/dist/src/table/FilterComponent.d.ts +0 -45
  144. package/dist/src/table/FilterComponent.js +0 -132
  145. package/dist/src/table/Pagination.component.d.ts +0 -8
  146. package/dist/src/table/Pagination.component.js +0 -32
  147. package/dist/src/table/Table.component.d.ts +0 -61
  148. package/dist/src/table/Table.component.js +0 -101
  149. package/dist/src/typography/TypographyArticle.component.d.ts +0 -8
  150. package/dist/src/typography/TypographyArticle.component.js +0 -7
  151. package/dist/src/typography/TypographyColumn.component.d.ts +0 -6
  152. package/dist/src/typography/TypographyColumn.component.js +0 -7
  153. package/dist/src/typography/TypographyContent.component.d.ts +0 -6
  154. package/dist/src/typography/TypographyContent.component.js +0 -7
  155. package/dist/src/typography/TypographyTips.component.d.ts +0 -6
  156. package/dist/src/typography/TypographyTips.component.js +0 -7
  157. package/dist/src/wrap/Draggable.component.d.ts +0 -34
  158. package/dist/src/wrap/Draggable.component.js +0 -214
  159. package/dist/src/wrap/Image.component.d.ts +0 -2
  160. package/dist/src/wrap/Image.component.js +0 -13
  161. package/dist/src/wrap/OutsideClick.component.d.ts +0 -6
  162. package/dist/src/wrap/OutsideClick.component.js +0 -34
  163. package/dist/src/wrap/ScrollContainer.component.d.ts +0 -10
  164. package/dist/src/wrap/ScrollContainer.component.js +0 -54
  165. package/dist/src/wrap/ShortcutProvider.d.ts +0 -1
  166. package/dist/src/wrap/ShortcutProvider.js +0 -42
  167. package/dist/src/wrap/Swipe.component.d.ts +0 -14
  168. package/dist/src/wrap/Swipe.component.js +0 -61
@@ -1,27 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { ApiType, ValidationRules } from "@utils";
3
- export type InputRadioOptionProps = {
4
- value: string | number;
5
- label: string;
6
- };
7
- export type InputRadioProps = {
8
- name: string;
9
- label?: string;
10
- tip?: string | ReactNode;
11
- vertical?: boolean;
12
- value?: string | number;
13
- disabled?: boolean;
14
- invalid?: string;
15
- options?: InputRadioOptionProps[];
16
- serverOptionControl?: ApiType;
17
- customOptions?: any;
18
- validations?: ValidationRules;
19
- onChange?: (value: string | number) => any;
20
- register?: (name: string, validations?: ValidationRules) => void;
21
- unregister?: (name: string) => void;
22
- /** Use custom class with: "label::", "tip::", "error::", "icon::", "suggest::", "suggest-item::". */
23
- className?: string;
24
- /** Use custom class with: "label::", "checked::", "error::". */
25
- classNameCheckbox?: string;
26
- };
27
- export declare function InputRadioComponent({ name, label, tip, vertical, value, disabled, invalid, options, serverOptionControl, customOptions, validations, onChange, register, unregister, className, classNameCheckbox, }: InputRadioProps): import("react").JSX.Element;
@@ -1,56 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.InputRadioComponent = InputRadioComponent;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("react");
7
- const _utils_1 = require("@utils");
8
- const _components_1 = require("@components");
9
- function InputRadioComponent({ name, label, tip, vertical, value, disabled, invalid, options, serverOptionControl, customOptions, validations, onChange, register, unregister, className = "", classNameCheckbox = "", }) {
10
- const [dataOptions, setDataOptions] = (0, react_1.useState)([]);
11
- const [loading, setLoading] = (0, react_1.useState)(false);
12
- // =========================>
13
- // ## Initial
14
- // =========================>
15
- const inputHandler = (0, _utils_1.useInputHandler)(name, value, validations, register, unregister, false);
16
- // =========================>
17
- // ## Invalid handler
18
- // =========================>
19
- const [invalidMessage] = (0, _utils_1.useValidation)(inputHandler.value, validations, invalid, inputHandler.idle);
20
- // =========================>
21
- // ## Fetch option
22
- // =========================>
23
- (0, react_1.useEffect)(() => {
24
- const fetchOptions = async () => {
25
- setLoading(true);
26
- const mutateOptions = await (0, _utils_1.api)(serverOptionControl || {});
27
- if (mutateOptions?.status == 200) {
28
- customOptions
29
- ? setDataOptions([customOptions, ...mutateOptions.data])
30
- : setDataOptions(mutateOptions.data);
31
- setLoading(false);
32
- }
33
- };
34
- if (serverOptionControl?.path || serverOptionControl?.url) {
35
- fetchOptions();
36
- }
37
- else {
38
- !options && setDataOptions([]);
39
- }
40
- }, [serverOptionControl?.path, serverOptionControl?.url]);
41
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "input-container w-full", children: [(0, jsx_runtime_1.jsxs)("label", { className: (0, _utils_1.cn)("input-label", disabled && "input-label-disabled", !!invalidMessage && "input-label-error", (0, _utils_1.pcn)(className, "label"), disabled && (0, _utils_1.pcn)(className, "label", "disabled"), !!invalidMessage && (0, _utils_1.pcn)(className, "label", "focus")), children: [label, validations && _utils_1.validation.hasRules(validations, "required") && (0, jsx_runtime_1.jsx)("span", { className: "text-danger ml-1", children: "*" })] }), tip && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-tip", disabled && "input-tip-disabled", (0, _utils_1.pcn)(className, "tip"), disabled && (0, _utils_1.pcn)(className, "tip", "disabled")), children: tip })), (0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("input input-radio-list", vertical && "input-radio-list-vertical", (0, _utils_1.pcn)(className, "input"), !!invalidMessage && "input-error", !!invalidMessage && (0, _utils_1.pcn)(className, "input", "error")), children: [loading && (vertical ? [1, 2, 3, 4, 5, 6, 7, 8, 9] : [1, 2, 3]).map((_, key) => {
42
- return (0, jsx_runtime_1.jsx)("div", { className: "w-1/3 h-6 rounded-lg" }, key);
43
- }), (options || dataOptions) &&
44
- (options || dataOptions)?.map((option, key) => {
45
- return ((0, jsx_runtime_1.jsx)(_components_1.RadioComponent, { label: option.label, name: `option[${option.value}]#${name}`, checked: inputHandler.value == option.value, disabled: disabled, className: classNameCheckbox, onChange: () => {
46
- if (inputHandler.value == option.value) {
47
- inputHandler.setValue("");
48
- onChange?.("");
49
- }
50
- else {
51
- inputHandler.setValue(option.value || "");
52
- onChange?.(option.value || "");
53
- }
54
- } }, key));
55
- })] }), invalidMessage && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-error-message", (0, _utils_1.pcn)(className, "error")), children: invalidMessage }))] }) }));
56
- }
@@ -1,23 +0,0 @@
1
- import { FC, InputHTMLAttributes, ReactNode } from "react";
2
- import { ValidationRules } from "@utils";
3
- export interface InputTimeProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange"> {
4
- label?: string;
5
- tip?: string | ReactNode;
6
- leftIcon?: any;
7
- rightIcon?: any;
8
- value?: string;
9
- invalid?: string;
10
- validations?: ValidationRules;
11
- onChange?: (value: string) => any;
12
- register?: (name: string, validations?: ValidationRules) => void;
13
- unregister?: (name: string) => void;
14
- /** Use custom class with: "label::", "tip::", "error::", "icon::". */
15
- className?: string;
16
- }
17
- export declare function InputTimeComponent({ label, tip, leftIcon, rightIcon, value, invalid, validations, register, unregister, onChange, className, ...props }: InputTimeProps): import("react").JSX.Element;
18
- interface InputTimePickerProps {
19
- onChange?: (time: string) => void;
20
- rightElement?: ReactNode;
21
- }
22
- export declare const InputTimePickerComponent: FC<InputTimePickerProps>;
23
- export {};
@@ -1,73 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.InputTimePickerComponent = void 0;
5
- exports.InputTimeComponent = InputTimeComponent;
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const react_1 = require("react");
8
- const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
9
- const _utils_1 = require("@utils");
10
- const _components_1 = require("@components");
11
- function InputTimeComponent({ label, tip, leftIcon, rightIcon, value, invalid, validations, register, unregister, onChange, className = "", ...props }) {
12
- const { isSm } = (0, _utils_1.useResponsive)();
13
- // =========================>
14
- // ## Initial
15
- // =========================>
16
- const inputHandler = (0, _utils_1.useInputHandler)(props.name, value, validations, register, unregister, false);
17
- const randomId = (0, _utils_1.useInputRandomId)();
18
- // =========================>
19
- // ## Invalid handler
20
- // =========================>
21
- const [invalidMessage] = (0, _utils_1.useValidation)(inputHandler.value, validations, invalid, inputHandler.idle);
22
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "input-container", children: [(0, jsx_runtime_1.jsxs)("label", { htmlFor: randomId, className: (0, _utils_1.cn)("input-label", props.disabled && "input-label-disabled", inputHandler.focus && "input-label-focus", !!invalidMessage && "input-label-error", (0, _utils_1.pcn)(className, "label")), children: [label, validations && _utils_1.validation.hasRules(validations, "required") && (0, jsx_runtime_1.jsx)("span", { className: "text-danger ml-1", children: "*" })] }), tip && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-tip", props.disabled && "input-tip-disabled", (0, _utils_1.pcn)(className, "tip")), children: tip })), (0, jsx_runtime_1.jsx)(_components_1.OutsideClickComponent, { onOutsideClick: !isSm ? () => inputHandler.setFocus(false) : undefined, children: (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)("input", { ...props, id: randomId, className: (0, _utils_1.cn)("input", leftIcon && "input-with-left-icon", rightIcon && "input-with-right-icon", (0, _utils_1.pcn)(className, "input"), !!invalidMessage && "input-error"), value: inputHandler.value, onChange: (e) => {
23
- inputHandler.setValue(e.target.value);
24
- inputHandler.setIdle(false);
25
- onChange?.(e.target.value);
26
- }, onFocus: (e) => {
27
- props.onFocus?.(e);
28
- inputHandler.setFocus(true);
29
- }, autoComplete: "off", inputMode: isSm ? "none" : undefined }), leftIcon && ((0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { className: (0, _utils_1.cn)("input-icon", "input-icon-left", props.disabled && "input-icon-disabled", inputHandler.focus && "input-icon-focus", (0, _utils_1.pcn)(className, "icon")), icon: leftIcon })), rightIcon && ((0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { className: (0, _utils_1.cn)("input-icon", "input-icon-right", props.disabled && "input-icon-disabled", inputHandler.focus && "input-icon-focus", (0, _utils_1.pcn)(className, "icon")), icon: rightIcon })), !isSm && inputHandler.focus && ((0, jsx_runtime_1.jsx)("div", { className: "input-time-picker-popover", children: (0, jsx_runtime_1.jsx)(exports.InputTimePickerComponent, { onChange: (time) => {
30
- inputHandler.setValue(time);
31
- onChange?.(time);
32
- } }) }))] }) }), invalidMessage && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-error-message", (0, _utils_1.pcn)(className, "error")), children: invalidMessage }))] }), isSm && ((0, jsx_runtime_1.jsx)(_components_1.BottomSheetComponent, { show: inputHandler.focus, onClose: () => inputHandler.setFocus(false), size: 380, footer: (0, jsx_runtime_1.jsx)("div", { className: "p-4", children: (0, jsx_runtime_1.jsx)(_components_1.ButtonComponent, { label: "Selesai", variant: "outline", onClick: () => inputHandler.setFocus(false), block: true }) }), children: (0, jsx_runtime_1.jsx)("div", { className: "p-4", children: (0, jsx_runtime_1.jsx)(exports.InputTimePickerComponent, { onChange: (time) => {
33
- inputHandler.setValue(time);
34
- onChange?.(time);
35
- } }) }) }))] }));
36
- }
37
- ;
38
- const InputTimePickerComponent = ({ onChange, rightElement, }) => {
39
- const [hour, setHour] = (0, react_1.useState)(0);
40
- const [minute, setMinute] = (0, react_1.useState)(0);
41
- const [second, setSecond] = (0, react_1.useState)(0);
42
- const hours = Array.from({ length: 24 }, (_, i) => String(i).padStart(2, "0"));
43
- const minutes = Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0"));
44
- const seconds = Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0"));
45
- const handleSelect = (type, val) => {
46
- if (type === "h")
47
- setHour(Number(val));
48
- if (type === "m")
49
- setMinute(Number(val));
50
- if (type === "s")
51
- setSecond(Number(val));
52
- };
53
- (0, react_1.useEffect)(() => {
54
- const formatted = `${String(hour).padStart(2, "0")}:${String(minute).padStart(2, "0")}:${String(second).padStart(2, "0")}`;
55
- onChange?.(formatted);
56
- }, [hour, minute, second]);
57
- const renderColumn = (items, type, activeValue) => ((0, jsx_runtime_1.jsx)("div", { className: "flex-1 overflow-y-auto text-center input-scroll", children: items.map((item) => {
58
- const active = Number(item) === activeValue;
59
- return ((0, jsx_runtime_1.jsx)("div", { onClick: () => handleSelect(type, item), className: (0, _utils_1.cn)("p-2 cursor-pointer rounded text-sm", active ? "bg-primary text-background font-semibold" : "hover:bg-light-primary"), children: item }, item));
60
- }) }));
61
- const timeSlots = (0, react_1.useMemo)(() => {
62
- const newTimeSlots = [];
63
- for (let i = 0; i <= 24 * 60; i += 30) {
64
- const hours = Math.floor(i / 60);
65
- const minutes = i % 60;
66
- const label = `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}`;
67
- newTimeSlots.push(label);
68
- }
69
- return newTimeSlots;
70
- }, []);
71
- return ((0, jsx_runtime_1.jsxs)("div", { className: "w-full max-h-[260] flex gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-1/3 overflow-y-auto bg-background rounded-[6px] input-scroll", children: timeSlots.map((time) => ((0, jsx_runtime_1.jsx)("div", { className: "p-2 text-sm rounded cursor-pointer hover:bg-light-primary text-center", onClick: () => onChange?.(time), children: time }, time))) }), (0, jsx_runtime_1.jsxs)("div", { className: "w-2/3 flex gap-2", children: [renderColumn(hours, "h", hour), renderColumn(minutes, "m", minute), renderColumn(seconds, "s", second)] }), rightElement && (0, jsx_runtime_1.jsx)("div", { children: rightElement })] }));
72
- };
73
- exports.InputTimePickerComponent = InputTimePickerComponent;
@@ -1,9 +0,0 @@
1
- import { CSSProperties } from 'react';
2
- export declare function InputValues({ value, className, onDelete, isFocus, onFocus, style, }: {
3
- value?: string[] | number[];
4
- className?: string;
5
- onDelete?: (val: string | number, index: string | number) => void;
6
- isFocus?: boolean;
7
- onFocus?: () => void;
8
- style?: CSSProperties;
9
- }): import("react").JSX.Element;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InputValues = InputValues;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
6
- const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
7
- const _utils_1 = require("@utils");
8
- function InputValues({ value, className, onDelete, isFocus, onFocus, style, }) {
9
- if (isFocus) {
10
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !!value?.length && ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("input-values-dropdown", className), onClick: () => onFocus?.(), children: value?.map((item, key) => {
11
- return ((0, jsx_runtime_1.jsxs)("div", { className: "input-values-item", children: [(0, jsx_runtime_1.jsx)("span", { className: "", children: item }), (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faTimes, className: "input-values-delete", onClick: () => onDelete?.(item, key) })] }, key));
12
- }) })) }));
13
- }
14
- else {
15
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("input-values-preview", className), style: style, onClick: () => onFocus?.(), children: (0, jsx_runtime_1.jsx)("div", { className: "input-values-container", children: value?.map((item, key) => {
16
- return ((0, jsx_runtime_1.jsxs)("div", { className: "input-values-item", children: [(0, jsx_runtime_1.jsx)("span", { children: item }), (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faTimes, className: "input-values-delete", onClick: () => onDelete?.(item, key) })] }, key));
17
- }) }) }) }));
18
- }
19
- }
@@ -1,12 +0,0 @@
1
- export interface RadioProps {
2
- name: string;
3
- label?: string;
4
- value?: string;
5
- disabled?: boolean;
6
- checked?: boolean;
7
- invalid?: string;
8
- onChange?: () => void;
9
- /** Use custom class with: "label::", "checked::", "error::". */
10
- className?: string;
11
- }
12
- export declare function RadioComponent({ name, label, value, disabled, checked, invalid, onChange, className, }: RadioProps): import("react").JSX.Element;
@@ -1,22 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.RadioComponent = RadioComponent;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("react");
7
- const _utils_1 = require("@utils");
8
- ;
9
- function RadioComponent({ name, label, value, disabled, checked, invalid, onChange, className = "", }) {
10
- // =========================>
11
- // ## initial
12
- // =========================>
13
- const randomId = (0, _utils_1.useInputRandomId)();
14
- const [invalidMessage, setInvalidMessage] = (0, react_1.useState)("");
15
- // =========================>
16
- // ## invalid handler
17
- // =========================>
18
- (0, react_1.useEffect)(() => {
19
- setInvalidMessage(invalid || "");
20
- }, [invalid]);
21
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "radio-container", children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", className: "hidden", id: randomId, name: name, onChange: onChange, defaultChecked: checked, value: value, disabled: disabled }), (0, jsx_runtime_1.jsxs)("label", { htmlFor: randomId, className: (0, _utils_1.cn)("radio-wrapper", disabled && "radio-wrapper-disabled"), children: [(0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("radio-input", checked && "radio-input-checked", checked && (0, _utils_1.pcn)(className, "checked"), (0, _utils_1.pcn)(className, "input")) }), (0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("radio-label", checked && "radio-label-checked", (0, _utils_1.pcn)(className, "label"), checked && (0, _utils_1.pcn)(className, "label", "checked"), disabled && (0, _utils_1.pcn)(className, "label", "disabled")), children: label })] }), invalidMessage && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-error-message", (0, _utils_1.pcn)(className, "error")), children: invalidMessage }))] }) }));
22
- }
@@ -1,47 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { ApiType, ValidationRules } from "@utils";
3
- export interface SelectOptionProps {
4
- label: string | ReactNode;
5
- value: string | number;
6
- searchable?: string[];
7
- customLabel?: ReactNode;
8
- }
9
- export interface SelectProps {
10
- name: string;
11
- label?: string;
12
- placeholder?: string;
13
- tip?: string | ReactNode;
14
- leftIcon?: any;
15
- rightIcon?: any;
16
- value?: string | number | (string | number)[];
17
- invalid?: string;
18
- disabled?: boolean;
19
- validations?: ValidationRules;
20
- multiple?: boolean;
21
- autoFocus?: boolean;
22
- clearable?: boolean;
23
- options?: SelectOptionProps[];
24
- searchable?: boolean;
25
- serverOptionControl?: ApiType & {
26
- cacheName?: string | false;
27
- };
28
- idbOptionControl?: {
29
- store: string;
30
- labelKey: string;
31
- valueKey: string;
32
- };
33
- serverSearchable?: boolean;
34
- includedOptions?: SelectOptionProps[];
35
- exceptOptions?: (string | number)[];
36
- tempOptions?: SelectOptionProps[];
37
- newOption?: SelectOptionProps;
38
- maxShowOption?: number;
39
- onChange?: (value: string | number | (string | number)[], data?: any) => any;
40
- register?: (name: string, validations?: ValidationRules) => void;
41
- unregister?: (name: string) => void;
42
- onFocus?: () => void;
43
- onBlur?: () => void;
44
- /** Use custom class with: "label::", "tip::", "error::", "icon::", "suggest::", "suggest-item::". */
45
- className?: string;
46
- }
47
- export declare function SelectComponent({ name, label, placeholder, tip, leftIcon, rightIcon, value, invalid, disabled, validations, multiple, autoFocus, clearable, options, searchable, serverOptionControl, idbOptionControl, serverSearchable, includedOptions, exceptOptions, tempOptions, newOption, maxShowOption, register, unregister, onChange, onFocus, onBlur, className, }: SelectProps): import("react").JSX.Element;
@@ -1,275 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.SelectComponent = SelectComponent;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("react");
7
- const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
8
- const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
9
- const _utils_1 = require("@utils");
10
- ;
11
- function SelectComponent({ name, label, placeholder, tip, leftIcon, rightIcon, value, invalid, disabled, validations, multiple, autoFocus, clearable, options = [], searchable, serverOptionControl, idbOptionControl, serverSearchable, includedOptions = [], exceptOptions = [], tempOptions, newOption, maxShowOption = 10, register, unregister, onChange, onFocus, onBlur, className = "", }) {
12
- const [inputShowValue, setInputShowValue] = (0, react_1.useState)("");
13
- const [keydown, setKeydown] = (0, react_1.useState)(false);
14
- const [useTemp, setUseTemp] = (0, react_1.useState)(true);
15
- const [dataOptions, setDataOptions] = (0, react_1.useState)([]);
16
- const [filteredOptions, setFilteredOptions] = (0, react_1.useState)([]);
17
- const [loadingOption, setLoadingOption] = (0, react_1.useState)(false);
18
- const [activeOption, setActiveOption] = (0, react_1.useState)(0);
19
- const [showOption, setShowOption] = (0, react_1.useState)(false);
20
- const [keyword, setKeyword] = (0, react_1.useState)("");
21
- const [keywordSearch] = (0, _utils_1.useLazySearch)(keyword);
22
- // =========================>
23
- // ## Initial
24
- // =========================>
25
- const inputHandler = (0, _utils_1.useInputHandler)(name, value, validations, register, unregister, false);
26
- const randomId = (0, _utils_1.useInputRandomId)();
27
- // =========================>
28
- // ## Invalid handler
29
- // =========================>
30
- const [invalidMessage] = (0, _utils_1.useValidation)(inputHandler.value, validations, invalid, inputHandler.idle);
31
- // =========================>
32
- // ## change value handler
33
- // =========================>
34
- (0, react_1.useEffect)(() => {
35
- if (value) {
36
- inputHandler.setValue(value);
37
- Array.isArray(dataOptions) && setInputShowValue((newOption ? [newOption, ...dataOptions] : dataOptions)?.find((option) => option.value == value)?.label || "");
38
- inputHandler.setIdle(false);
39
- }
40
- else {
41
- inputHandler.setValue("");
42
- setInputShowValue("");
43
- }
44
- }, [value, dataOptions]);
45
- // =========================>
46
- // ## options handler
47
- // =========================>
48
- (0, react_1.useEffect)(() => {
49
- options?.length && setDataOptions([...options, ...includedOptions].filter((op) => !exceptOptions?.includes(op.value)));
50
- }, [options]);
51
- const filterOption = (e) => {
52
- if (dataOptions?.length) {
53
- let newFilteredOptions = [];
54
- if (searchable && !serverSearchable) {
55
- if (e.target.value) {
56
- newFilteredOptions = dataOptions.filter((Option) => Option.label?.toLowerCase().indexOf(e.target.value.toLowerCase()) > -1).slice(0, maxShowOption);
57
- }
58
- else {
59
- newFilteredOptions = dataOptions.slice(0, maxShowOption);
60
- }
61
- }
62
- else {
63
- newFilteredOptions = dataOptions;
64
- }
65
- setActiveOption(-1);
66
- setFilteredOptions(newFilteredOptions);
67
- setShowOption(true);
68
- }
69
- };
70
- const onKeyDownOption = (e) => {
71
- if (dataOptions?.length) {
72
- if (e.keyCode === 13) {
73
- const resultValue = filteredOptions?.at(activeOption);
74
- setActiveOption(-1);
75
- setFilteredOptions([]);
76
- setShowOption(false);
77
- if (!multiple) {
78
- setInputShowValue(resultValue?.label || inputShowValue);
79
- inputHandler.setValue(resultValue?.value || inputShowValue);
80
- serverSearchable && setKeyword(resultValue?.label || keyword);
81
- }
82
- else {
83
- if (resultValue?.value) {
84
- searchable ? setInputShowValue(resultValue.label) : searchable && setInputShowValue("");
85
- serverSearchable && setKeyword(resultValue.label);
86
- const values = Array.isArray(inputHandler.value) ? Array().concat(inputHandler.value)?.filter((val) => val != resultValue?.value) : [];
87
- if (values.find((val) => val == resultValue?.value)) {
88
- inputHandler.setValue(values);
89
- }
90
- else {
91
- inputHandler.setValue([...Array().concat(values), resultValue.value]);
92
- }
93
- }
94
- }
95
- e.preventDefault();
96
- }
97
- else if (e.keyCode === 38) {
98
- if (activeOption === 0)
99
- return;
100
- setActiveOption(activeOption - 1);
101
- }
102
- else if (e.keyCode === 40) {
103
- if (activeOption + 1 >= (filteredOptions?.length || 0))
104
- return;
105
- setActiveOption(activeOption + 1);
106
- }
107
- }
108
- };
109
- const fetchOptions = async () => {
110
- setLoadingOption(true);
111
- const serverControl = {
112
- ...serverOptionControl,
113
- params: serverSearchable ? { search: keywordSearch, ...(serverOptionControl?.params || {}) } : (serverOptionControl?.params || {}),
114
- headers: { "X-Option": 1 }
115
- };
116
- const getCacheOptions = await _utils_1.cavity.get(serverOptionControl?.cacheName || `option_${serverOptionControl?.path}`);
117
- const cacheOptions = (getCacheOptions?.data || []);
118
- if (cacheOptions?.length) {
119
- setDataOptions([...cacheOptions, ...includedOptions].filter((op) => !exceptOptions?.includes(op.value)));
120
- setLoadingOption(false);
121
- }
122
- else {
123
- const mutateOptions = await (0, _utils_1.api)(serverControl || {});
124
- setDataOptions([...(mutateOptions?.data?.data || []), ...(includedOptions || [])].filter((op) => !exceptOptions?.includes(op.value)));
125
- setShowOption(true);
126
- if (serverOptionControl?.cacheName != false) {
127
- _utils_1.cavity.set({
128
- key: serverOptionControl?.cacheName || `option_${serverOptionControl?.path}`,
129
- data: mutateOptions?.data,
130
- expired: 5,
131
- });
132
- }
133
- setLoadingOption(false);
134
- }
135
- };
136
- const fetchIdbOptions = async () => {
137
- setLoadingOption(true);
138
- if (idbOptionControl?.store) {
139
- const idb = _utils_1.registry.get("idb");
140
- if (!idb) {
141
- throw new Error("IndexedDB (IDB) extension is not installed.");
142
- }
143
- const getIdbOptions = await (await idb.query(idbOptionControl?.store)).get();
144
- const rows = getIdbOptions.map((row) => {
145
- const value = row[idbOptionControl.valueKey] || row["id"];
146
- const label = row[idbOptionControl.labelKey] || row["id"];
147
- return {
148
- label,
149
- value,
150
- ...row,
151
- };
152
- });
153
- setDataOptions(rows);
154
- setLoadingOption(false);
155
- }
156
- };
157
- (0, react_1.useEffect)(() => {
158
- if (!serverSearchable) {
159
- if (serverOptionControl?.path || serverOptionControl?.url) {
160
- fetchOptions();
161
- }
162
- else if (idbOptionControl?.store) {
163
- fetchIdbOptions();
164
- }
165
- else {
166
- !options && setDataOptions([]);
167
- }
168
- }
169
- }, [serverOptionControl?.path, serverOptionControl?.url]);
170
- (0, react_1.useEffect)(() => {
171
- if (serverSearchable) {
172
- if (serverOptionControl?.path || serverOptionControl?.url) {
173
- fetchOptions();
174
- }
175
- else {
176
- !options && setDataOptions([]);
177
- }
178
- }
179
- }, [keywordSearch, serverOptionControl?.path, serverOptionControl?.url]);
180
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "input-container", children: [(0, jsx_runtime_1.jsxs)("label", { htmlFor: randomId, className: (0, _utils_1.cn)("input-label", disabled && "input-label-disabled", inputHandler.focus && "input-label-focus", invalidMessage && "input-label-error", (0, _utils_1.pcn)(className, "label"), disabled && (0, _utils_1.pcn)(className, "label", "disabled"), inputHandler.focus && (0, _utils_1.pcn)(className, "label", "focus"), invalidMessage && (0, _utils_1.pcn)(className, "label", "error")), children: [label, validations && _utils_1.validation.hasRules(validations, "required") && (0, jsx_runtime_1.jsx)("span", { className: "text-danger ml-1", children: "*" })] }), tip && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-tip", disabled && "input-tip-disabled", (0, _utils_1.pcn)(className, "tip"), disabled && (0, _utils_1.pcn)(className, "tip", "disabled")), children: tip })), (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)("input", { type: "hidden", value: !multiple ? String(inputHandler.value) : Array().concat(inputHandler.value).map((val) => String(val)), name: name }), (0, jsx_runtime_1.jsx)("input", { type: "text", readOnly: !searchable, id: randomId, placeholder: !inputHandler.value || (Array.isArray(inputHandler.value) && !inputHandler.value.length) ? placeholder : "", disabled: disabled, className: (0, _utils_1.cn)("input cursor-pointer", leftIcon && "input-with-left-icon", rightIcon && "input-with-right-icon", invalidMessage && "input-error", (0, _utils_1.pcn)(className, "input"), invalidMessage && (0, _utils_1.pcn)(className, "input", "error")), value: (useTemp && tempOptions ? tempOptions.at(0)?.label : serverSearchable ? keyword : inputShowValue), onChange: (e) => {
181
- setUseTemp(false);
182
- searchable && setInputShowValue(e.target.value);
183
- serverSearchable && setKeyword(e.target.value);
184
- inputHandler.setIdle(false);
185
- dataOptions?.length && filterOption(e);
186
- }, onFocus: (e) => {
187
- setUseTemp(false);
188
- inputHandler.setFocus(true);
189
- onFocus?.();
190
- dataOptions?.length && filterOption(e);
191
- searchable && e.target.select();
192
- }, onBlur: (e) => {
193
- setUseTemp(false);
194
- const value = e.target.value;
195
- const valueOption = dataOptions?.find((option) => option.label?.toLowerCase() == value?.toLowerCase());
196
- if (!keydown) {
197
- if (!multiple) {
198
- setTimeout(() => {
199
- if (valueOption?.value) {
200
- setInputShowValue(valueOption.label);
201
- inputHandler.setValue(valueOption.value);
202
- serverSearchable && setKeyword(valueOption.label);
203
- onChange?.(valueOption.value, valueOption);
204
- }
205
- else {
206
- setInputShowValue("");
207
- serverSearchable && setKeyword("");
208
- inputHandler.setValue("");
209
- onChange?.("");
210
- }
211
- }, 140);
212
- }
213
- else {
214
- setInputShowValue("");
215
- serverSearchable && setKeyword("");
216
- onChange?.("");
217
- }
218
- }
219
- setTimeout(() => {
220
- inputHandler.setFocus(false);
221
- }, 100);
222
- onBlur?.();
223
- }, onKeyDown: (e) => {
224
- dataOptions?.length && onKeyDownOption(e);
225
- }, autoComplete: "off", autoFocus: autoFocus }), (multiple && !searchable || (searchable && !inputHandler.focus)) && ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("select-multiple-values", leftIcon ? "select-multiple-values-left-icon" : "select-multiple-values-no-icon"), style: { maxWidth: `calc(100% - ${leftIcon ? "5.2rem" : "3.2rem"})` }, children: (0, jsx_runtime_1.jsx)("div", { className: "input-values-container", children: multiple && typeof inputHandler.value != "string" && Array().concat(inputHandler.value)?.map((item, key) => {
226
- return ((0, jsx_runtime_1.jsxs)("div", { className: "input-values-item", children: [(0, jsx_runtime_1.jsx)("span", { children: dataOptions?.find((option) => option.value == item)?.label }), (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faTimes, className: "input-values-delete", onClick: () => {
227
- const values = Array().concat(inputHandler.value);
228
- const index = values.findIndex((val) => val == item);
229
- inputHandler.setValue(values.filter((_, val) => val != index));
230
- if (!values.filter((_, val) => val != index)?.length) {
231
- setInputShowValue("");
232
- serverSearchable && setKeyword("");
233
- onChange?.("");
234
- }
235
- } })] }, key));
236
- }) }) })), leftIcon && ((0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { className: (0, _utils_1.cn)("input-icon", "input-icon-left", disabled && "input-icon-disabled", inputHandler.focus && "input-icon-focus", (0, _utils_1.pcn)(className, "icon"), disabled && (0, _utils_1.pcn)(className, "icon", "disabled"), inputHandler.focus && (0, _utils_1.pcn)(className, "icon", "focus")), icon: leftIcon })), !multiple && clearable && inputHandler.value && ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)("input-icon", "input-icon-clear", disabled && "input-icon-disabled", (0, _utils_1.pcn)(className, "icon"), disabled && (0, _utils_1.pcn)(className, "icon", "disabled")), onClick: () => {
237
- setInputShowValue("");
238
- inputHandler.setValue("");
239
- onChange?.("");
240
- }, children: (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faTimes }) })), (0, jsx_runtime_1.jsx)("label", { htmlFor: randomId, className: (0, _utils_1.cn)("input-icon", "input-icon-right", "select-icon-dropdown", disabled && "input-icon-disabled", (0, _utils_1.pcn)(className, "icon"), disabled && (0, _utils_1.pcn)(className, "icon", "disabled")), children: (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faChevronDown }) })] }), !!dataOptions?.length && showOption && !loadingOption && !!filteredOptions?.length && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("ul", { className: (0, _utils_1.cn)("input-suggest-container scroll-sm", inputHandler.focus && "input-suggest-container-active", (0, _utils_1.pcn)(className, "suggest")), children: (newOption ? [newOption, ...filteredOptions] : filteredOptions).map((option, key) => {
241
- const selected = !!((typeof inputHandler.value == "string" || typeof inputHandler.value == "number") && inputHandler.value == option.value) ||
242
- (Array.isArray(inputHandler.value) && Array().concat(inputHandler.value).find((val) => val == option.value));
243
- return ((0, jsx_runtime_1.jsxs)("li", { className: (0, _utils_1.cn)("input-suggest", (key == activeOption || selected) && "input-suggest-active", (0, _utils_1.pcn)(className, "suggest-item"), (key == activeOption || selected) && (0, _utils_1.pcn)(className, "suggest-item", "active")), onMouseDown: () => {
244
- setKeydown(true);
245
- setTimeout(() => inputHandler.setFocus(true), 110);
246
- }, onMouseUp: () => {
247
- setKeydown(false);
248
- setActiveOption(key);
249
- setFilteredOptions([]);
250
- setShowOption(false);
251
- if (!multiple) {
252
- setInputShowValue(option.label);
253
- serverSearchable && setKeyword(option.label);
254
- inputHandler.setValue(option.value);
255
- onChange?.(option.value, option);
256
- }
257
- else {
258
- const values = Array.isArray(inputHandler.value)
259
- ? Array().concat(inputHandler.value).filter((val) => val != option.value)
260
- : [];
261
- setInputShowValue("");
262
- serverSearchable && setKeyword("");
263
- if (Array.isArray(inputHandler.value) && Array().concat(inputHandler.value).find((val) => val == option.value)) {
264
- inputHandler.setValue(values);
265
- onChange?.(values);
266
- }
267
- else {
268
- inputHandler.setValue([...Array().concat(values), option.value]);
269
- onChange?.([...Array().concat(values), option.value]);
270
- }
271
- }
272
- setTimeout(() => inputHandler.setFocus(false), 120);
273
- }, children: [selected && ((0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faCheck, className: "select-suggest-check" })), option.label] }, key));
274
- }) }) })), invalidMessage && ((0, jsx_runtime_1.jsx)("small", { className: (0, _utils_1.cn)("input-error-message", (0, _utils_1.pcn)(className, "error")), children: invalidMessage }))] }) }));
275
- }
@@ -1,12 +0,0 @@
1
- import { ReactNode } from "react";
2
- export type BottomSheetProps = {
3
- show: boolean;
4
- children: ReactNode;
5
- onClose: () => void;
6
- size?: string | number;
7
- maxSize?: string | number;
8
- footer?: ReactNode;
9
- /** Use custom class with: "backdrop::", "footer::". */
10
- className?: string;
11
- };
12
- export declare const BottomSheetComponent: import("react").ComponentType<BottomSheetProps>;