master-components-react-ts 1.0.13 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +8 -0
  2. package/dist/_virtual/customParseFormat.js +4 -0
  3. package/dist/_virtual/jsx-runtime.js +4 -0
  4. package/dist/_virtual/react-jsx-runtime.production.js +4 -0
  5. package/dist/assets/Icons/IconArrowUp.js +13 -0
  6. package/dist/assets/Icons/IconCalendar.js +32 -0
  7. package/dist/assets/Icons/IconCheck.js +15 -0
  8. package/dist/assets/Icons/IconCheckCircle.js +16 -0
  9. package/dist/assets/Icons/IconCheckmark.js +15 -0
  10. package/dist/assets/Icons/IconCircularLoading.js +36 -0
  11. package/dist/assets/Icons/IconClose.js +31 -0
  12. package/dist/assets/Icons/IconCloseBackground.js +15 -0
  13. package/dist/assets/Icons/IconCloseCircle.js +15 -0
  14. package/dist/assets/Icons/IconExclamation.js +15 -0
  15. package/dist/assets/Icons/IconLeft.js +13 -0
  16. package/dist/assets/Icons/IconMinus.js +7 -0
  17. package/dist/assets/Icons/IconRadioChecked.js +19 -0
  18. package/dist/assets/Icons/IconRadioCheckedDisabled.js +19 -0
  19. package/dist/assets/Icons/IconRadioUnchecked.js +16 -0
  20. package/dist/assets/Icons/IconRadioUncheckedDisabled.js +16 -0
  21. package/dist/assets/Icons/IconRight.js +13 -0
  22. package/dist/assets/Icons/IconSave.js +16 -0
  23. package/dist/assets/Icons/IconSearch.js +26 -0
  24. package/dist/assets/Icons/IconTrash.js +16 -0
  25. package/dist/assets/Inter_24pt-Medium-C1cYvkz2.woff2 +0 -0
  26. package/dist/assets/Inter_24pt-Regular-C7SEt4-L.woff2 +0 -0
  27. package/dist/assets/Inter_24pt-SemiBold-DIQUEucn.woff2 +0 -0
  28. package/dist/components/ActionDropdown/ActionDropdown.js +74 -0
  29. package/dist/components/ActionDropdown/ActionDropdown.module.scss.js +29 -0
  30. package/dist/components/Checkbox/Checkbox.js +54 -0
  31. package/dist/components/Checkbox/Checkbox.module.scss.js +26 -0
  32. package/dist/components/DatePicker/Calendar.js +437 -0
  33. package/dist/components/DatePicker/Calendar.module.scss.js +83 -0
  34. package/dist/components/DatePicker/DatePicker.js +211 -0
  35. package/dist/components/DatePicker/Datepicker.module.scss.js +17 -0
  36. package/dist/components/Dropdown/Dropdown.js +336 -0
  37. package/dist/components/Dropdown/Dropdown.module.scss.js +74 -0
  38. package/dist/components/FormInput/FormInput.js +144 -0
  39. package/dist/components/FormInput/FormInput.module.scss.js +62 -0
  40. package/dist/components/MainButton/MainButton.js +72 -0
  41. package/dist/components/MainButton/MainButton.module.scss.js +56 -0
  42. package/dist/components/NotificationToast/NotificationContext.js +57 -0
  43. package/dist/components/NotificationToast/NotificationToast.js +66 -0
  44. package/dist/components/NotificationToast/NotificationToast.module.scss.js +59 -0
  45. package/dist/components/NotificationToast/createNotificationToast.js +10 -0
  46. package/dist/components/Popup/Popup.js +116 -0
  47. package/dist/components/Popup/Popup.module.scss.js +41 -0
  48. package/dist/components/Radio/Radio.js +46 -0
  49. package/dist/components/Radio/Radio.module.scss.js +8 -0
  50. package/dist/components/Skeleton/Skeleton.js +8 -0
  51. package/dist/components/Skeleton/Skeleton.module.scss.js +20 -0
  52. package/dist/components/Textarea/Textarea.js +149 -0
  53. package/dist/components/Textarea/Textarea.module.scss.js +41 -0
  54. package/dist/components/TimePicker/TimePicker.js +172 -0
  55. package/dist/components/TimePicker/TimePicker.module.scss.js +50 -0
  56. package/dist/components/Toggle/Toggle.d.ts +1 -1
  57. package/dist/components/Toggle/Toggle.js +20 -0
  58. package/dist/components/Toggle/Toggle.module.scss.js +29 -0
  59. package/dist/components/Tooltip/Tooltip.js +153 -0
  60. package/dist/components/Tooltip/Tooltip.module.scss.js +35 -0
  61. package/dist/context/NamespaceContext.js +7 -0
  62. package/dist/index.js +2253 -0
  63. package/dist/node_modules/dayjs/plugin/customParseFormat.js +129 -0
  64. package/dist/node_modules/react/cjs/react-jsx-runtime.production.js +35 -0
  65. package/dist/node_modules/react/jsx-runtime.js +10 -0
  66. package/dist/utils/Helpers.js +15 -0
  67. package/package.json +9 -8
  68. package/dist/master-components-react-ts.es.js +0 -3140
  69. /package/dist/components/Toggle/{Textarea.types.d.ts → Toggle.types.d.ts} +0 -0
@@ -0,0 +1,211 @@
1
+ import { j as jsxRuntimeExports } from "../../node_modules/react/jsx-runtime.js";
2
+ import { useState, useRef, useEffect } from "react";
3
+ import dayjs from "dayjs";
4
+ import style from "./Datepicker.module.scss.js";
5
+ import Calendar from "./Calendar.js";
6
+ import { IconCalendar } from "../../assets/Icons/IconCalendar.js";
7
+ import customParseFormat from "../../node_modules/dayjs/plugin/customParseFormat.js";
8
+ import { useNamespace } from "../../context/NamespaceContext.js";
9
+ import FormInput from "../FormInput/FormInput.js";
10
+ import { IconCloseCircle } from "../../assets/Icons/IconCloseCircle.js";
11
+ dayjs.extend(customParseFormat);
12
+ const DatePicker = ({
13
+ defaultValue,
14
+ valueFormat = "DD-MM-YYYY",
15
+ onChange,
16
+ onBlur,
17
+ onFocus,
18
+ customYears,
19
+ fixedDropdown = true,
20
+ disabledDatesFrom,
21
+ disabledDatesTill,
22
+ disabledDatesRange,
23
+ datepickerStyle,
24
+ datepickerLabelStyle,
25
+ requiredStyle,
26
+ datepickerHelperTextStyle,
27
+ selectedStyle,
28
+ endDateStyle,
29
+ startDateStyle,
30
+ inRangeStyle,
31
+ otherMonthStyle,
32
+ todayStyle,
33
+ weekDayStyle,
34
+ quickPickStyle,
35
+ monthStyle,
36
+ quickPick,
37
+ mode = "single",
38
+ pickerType = "single",
39
+ disabled = false,
40
+ ...rest
41
+ }) => {
42
+ const namespace = useNamespace();
43
+ const [IsFocused, setIsFocused] = useState(false);
44
+ const [Value, setValue] = useState("");
45
+ const DefaultValue = useRef({ state: false, value: "" });
46
+ const CalendarRef = useRef(null);
47
+ const [CurrentMonth, setCurrentMonth] = useState(() => {
48
+ const thisYear = dayjs().year().toString();
49
+ if (customYears?.length) {
50
+ return customYears.includes(thisYear) ? dayjs() : dayjs(`${Math.min(...customYears.map(Number))}-01-01`);
51
+ }
52
+ return dayjs();
53
+ });
54
+ useEffect(() => {
55
+ const thisYear = dayjs().year().toString();
56
+ if (customYears?.length) {
57
+ setCurrentMonth(customYears.includes(thisYear) ? dayjs() : dayjs(`${Math.min(...customYears.map(Number))}-01-01`));
58
+ }
59
+ }, [customYears]);
60
+ const [SelectedDate, setSelectedDate] = useState("");
61
+ const [RangeSelection, setRangeSelection] = useState({
62
+ start: null,
63
+ end: null
64
+ });
65
+ const ComponentRef = useRef(null);
66
+ const Change = (value, singleQuickPick, withDefault) => {
67
+ let dateValue = "";
68
+ let objValue = { start: "", end: "" };
69
+ if (mode === "single" || typeof value === "string") {
70
+ dateValue = value;
71
+ setValue(dateValue);
72
+ }
73
+ if (mode !== "single" || typeof value !== "string") {
74
+ dateValue = `${dayjs(value?.start ?? "").format(valueFormat)} / ${value?.end ? dayjs(value?.end).format(valueFormat) : ""}`;
75
+ objValue.start = dayjs(value?.start ?? "").format(valueFormat);
76
+ objValue.end = value?.end ? dayjs(value?.end).format(valueFormat) : "";
77
+ setValue(dateValue);
78
+ }
79
+ if (value?.end) {
80
+ setIsFocused(false);
81
+ }
82
+ if (onChange && typeof onChange === "function" && !withDefault) {
83
+ onChange(objValue.start !== "" ? objValue : dateValue);
84
+ DefaultValue.current.value = objValue.start !== "" ? objValue : dateValue;
85
+ }
86
+ };
87
+ const Clear = (e) => {
88
+ e.stopPropagation();
89
+ setSelectedDate("");
90
+ DefaultValue.current.value = "";
91
+ setValue("");
92
+ setRangeSelection({
93
+ start: null,
94
+ end: null
95
+ });
96
+ if (onChange && typeof onChange === "function") {
97
+ onChange("");
98
+ }
99
+ };
100
+ const ClickHandler = (event) => {
101
+ if (!ComponentRef.current) return;
102
+ if (event.composedPath().includes(ComponentRef.current)) return;
103
+ setIsFocused(false);
104
+ };
105
+ const ScrollHandler = (event) => {
106
+ if (!ComponentRef.current || !CalendarRef.current) return;
107
+ if (event.composedPath().includes(ComponentRef.current) || event.composedPath().includes(CalendarRef.current)) return;
108
+ setIsFocused(false);
109
+ };
110
+ const CalculatePos = () => {
111
+ if (!ComponentRef.current || !CalendarRef.current) return;
112
+ const componentEl = ComponentRef.current;
113
+ const calendarEl = CalendarRef.current;
114
+ if (!calendarEl || !componentEl) return;
115
+ const componentRect = componentEl.getBoundingClientRect();
116
+ const windowHeight = window.innerHeight;
117
+ const windowWidth = window.innerWidth;
118
+ calendarEl.style.position = "fixed";
119
+ if (componentRect.bottom + calendarEl.offsetHeight > windowHeight) {
120
+ calendarEl.style.top = `${window.scrollY + componentRect.top - calendarEl.offsetHeight - 8}px`;
121
+ calendarEl.style.bottom = "unset";
122
+ } else {
123
+ calendarEl.style.top = `${window.scrollY + componentRect.bottom + 8}px`;
124
+ calendarEl.style.bottom = "unset";
125
+ }
126
+ if (componentRect.right + componentRect.width > windowWidth - 120) {
127
+ calendarEl.style.left = `${window.scrollX + componentRect.left + componentRect.width - calendarEl.offsetWidth}px`;
128
+ } else {
129
+ calendarEl.style.left = `${window.scrollX + componentRect.left}px`;
130
+ }
131
+ };
132
+ useEffect(() => {
133
+ if (defaultValue && DefaultValue.current.value === "") {
134
+ let value = Array.isArray(defaultValue) ? {
135
+ start: dayjs(defaultValue[0], valueFormat),
136
+ end: defaultValue.length > 1 ? dayjs(defaultValue[1], valueFormat) : ""
137
+ } : dayjs(defaultValue, valueFormat).format(valueFormat);
138
+ DefaultValue.current.value = defaultValue;
139
+ DefaultValue.current.state = true;
140
+ if (value) {
141
+ Change(value, false, true);
142
+ }
143
+ }
144
+ }, []);
145
+ useEffect(() => {
146
+ if (IsFocused) {
147
+ CalculatePos();
148
+ }
149
+ }, [CalendarRef, IsFocused]);
150
+ useEffect(() => {
151
+ document.addEventListener("click", ClickHandler);
152
+ document.addEventListener("wheel", ScrollHandler);
153
+ return () => {
154
+ document.removeEventListener("click", ClickHandler);
155
+ document.removeEventListener("wheel", ScrollHandler);
156
+ };
157
+ }, []);
158
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${namespace === "namespaceHr" ? style.namespaceHr : ""} ${style.datepickerContainer}`, children: [
159
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: ComponentRef, className: style.datepickerInputWrapper, onClick: () => (setIsFocused((state) => !state), CalculatePos()), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
160
+ FormInput,
161
+ {
162
+ ...rest,
163
+ customFocus: IsFocused,
164
+ withActive: false,
165
+ value: Value,
166
+ toggleFocus: true,
167
+ formInputStyle: { cursor: "pointer" },
168
+ leftSlot: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: style.datepickerLeftIcon, children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconCalendar, {}) }),
169
+ rightSlot: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${style.datepickerRightIcon}`, onClick: Clear, children: Value && /* @__PURE__ */ jsxRuntimeExports.jsx(IconCloseCircle, {}) }),
170
+ readOnly: true
171
+ }
172
+ ) }),
173
+ IsFocused && /* @__PURE__ */ jsxRuntimeExports.jsx(
174
+ Calendar,
175
+ {
176
+ namespace,
177
+ defaultValue: DefaultValue.current,
178
+ CalendarRef,
179
+ disabledDatesFrom,
180
+ disabledDatesTill,
181
+ disabledDatesRange,
182
+ valueFormat,
183
+ onChange: (value) => Change(value, false, false),
184
+ customYears,
185
+ CurrentMonth,
186
+ setCurrentMonth,
187
+ SelectedDate,
188
+ setSelectedDate,
189
+ IsFocused,
190
+ setIsFocused,
191
+ quickPick,
192
+ mode,
193
+ RangeSelection,
194
+ setRangeSelection,
195
+ pickerType,
196
+ selectedStyle,
197
+ endDateStyle,
198
+ startDateStyle,
199
+ inRangeStyle,
200
+ otherMonthStyle,
201
+ todayStyle,
202
+ weekDayStyle,
203
+ quickPickStyle,
204
+ monthStyle
205
+ }
206
+ )
207
+ ] });
208
+ };
209
+ export {
210
+ DatePicker as default
211
+ };
@@ -0,0 +1,17 @@
1
+ const datepickerContainer = "Datepicker-module__datepickerContainer";
2
+ const datepickerInputWrapper = "Datepicker-module__datepickerInputWrapper";
3
+ const datepickerLeftIcon = "Datepicker-module__datepickerLeftIcon";
4
+ const datepickerRightIcon = "Datepicker-module__datepickerRightIcon";
5
+ const style = {
6
+ datepickerContainer,
7
+ datepickerInputWrapper,
8
+ datepickerLeftIcon,
9
+ datepickerRightIcon
10
+ };
11
+ export {
12
+ datepickerContainer,
13
+ datepickerInputWrapper,
14
+ datepickerLeftIcon,
15
+ datepickerRightIcon,
16
+ style as default
17
+ };
@@ -0,0 +1,336 @@
1
+ import { j as jsxRuntimeExports } from "../../node_modules/react/jsx-runtime.js";
2
+ import { useState, useRef, useEffect } from "react";
3
+ import style from "./Dropdown.module.scss.js";
4
+ import FormInput from "../FormInput/FormInput.js";
5
+ import Checkbox from "../Checkbox/Checkbox.js";
6
+ import { _filterUnique } from "../../utils/Helpers.js";
7
+ import { IconClose } from "../../assets/Icons/IconClose.js";
8
+ import { IconArrowUp } from "../../assets/Icons/IconArrowUp.js";
9
+ import { IconCloseCircle } from "../../assets/Icons/IconCloseCircle.js";
10
+ const Dropdown = ({
11
+ data,
12
+ withFilter = true,
13
+ withClose = true,
14
+ disableAll = false,
15
+ withMultiselect = false,
16
+ selectedOptionID,
17
+ withInput = false,
18
+ dropdownType = "country",
19
+ onSelect,
20
+ onFocus,
21
+ onBlur,
22
+ onValueChange,
23
+ customInputSlot,
24
+ dropdownWrapperStyle,
25
+ dropdownInputWrapperStyle,
26
+ dropdownInputSlotStyle,
27
+ dropdownInputSlotItemStyle,
28
+ dropdownInputSlotItemLabelStyle,
29
+ dropdownInputSlotItemCloseStyle,
30
+ dropdownInputSlotItemMoreStyle,
31
+ dropdownItemStyle,
32
+ dropdownItemLabelStyle,
33
+ itemCheckboxStyle,
34
+ dropdownItemLabelTextStyle,
35
+ dropdownListStyle,
36
+ ...rest
37
+ }) => {
38
+ const [Flag, setFlag] = useState(false);
39
+ const [InputValue, setInputValue] = useState("");
40
+ const [SelectAllKey, setSelectAllKey] = useState(false);
41
+ const [ClickedSelectAll, setClickedSelectAll] = useState(false);
42
+ const [IsFocused, setIsFocused] = useState(false);
43
+ const DropdownRef = useRef(null);
44
+ const ComponentRef = useRef(null);
45
+ const ListRef = useRef(null);
46
+ const ListItemRef = useRef(null);
47
+ const [Data, setData] = useState([]);
48
+ const SelectedData = useRef([]);
49
+ const SelectedDataLength = useRef(0);
50
+ const [SearchValue, setSearchValue] = useState("");
51
+ const [SingleSelectValue, setSingleSelectValue] = useState(null);
52
+ const getFlagIconUrl = (code) => {
53
+ return `https://flagsapi.com/${code}/flat/64.png`;
54
+ };
55
+ const SelectItem = (object) => {
56
+ object.selected = !object.selected;
57
+ if (!withMultiselect) {
58
+ onSelect?.(object);
59
+ return;
60
+ }
61
+ SelectedData.current = [...SelectedData.current, ...Data.filter((el) => el.selected == true), ...Data.filter((el) => el.id === object.id)];
62
+ SelectedData.current = _filterUnique(SelectedData.current, "id").filter((el) => el.selected).filter((el) => el.id !== "SELECT_ALL");
63
+ if (object.id === "SELECT_ALL") {
64
+ setSelectAllKey(object.selected);
65
+ setClickedSelectAll(true);
66
+ } else {
67
+ setSelectAllKey(false);
68
+ onSelect?.(SelectedData.current);
69
+ setClickedSelectAll(false);
70
+ }
71
+ setFlag((state) => !state);
72
+ };
73
+ const SingleSelect = (object) => {
74
+ setSingleSelectValue(object);
75
+ onSelect?.(object);
76
+ setIsFocused(false);
77
+ };
78
+ const Focus = () => {
79
+ onFocus?.();
80
+ };
81
+ const CalculatePos = () => {
82
+ const componentEl = ComponentRef.current;
83
+ const dropdownEl = DropdownRef.current;
84
+ if (!dropdownEl || !componentEl) return;
85
+ const componentRect = componentEl.getBoundingClientRect();
86
+ const windowHeight = window.innerHeight;
87
+ dropdownEl.style.position = "fixed";
88
+ dropdownEl.style.width = componentRect.width + "px";
89
+ dropdownEl.style.left = `${componentRect.left + window.pageXOffset}px`;
90
+ if (componentRect.bottom + dropdownEl.offsetHeight > windowHeight) {
91
+ dropdownEl.style.top = `${window.scrollY + componentRect.top - dropdownEl.offsetHeight + 18}px`;
92
+ dropdownEl.style.bottom = "unset";
93
+ } else {
94
+ dropdownEl.style.top = `${window.scrollY + componentRect.bottom + 8}px`;
95
+ dropdownEl.style.bottom = "unset";
96
+ }
97
+ };
98
+ useEffect(() => {
99
+ CalculatePos();
100
+ }, [DropdownRef, IsFocused]);
101
+ useEffect(() => {
102
+ SelectedData.current = data.filter((el) => el.selected);
103
+ if (!withMultiselect) {
104
+ setData(data);
105
+ return;
106
+ }
107
+ const hasSelected = data.some((el) => "selected" in el);
108
+ const firstItem = { id: "SELECT_ALL", label: "Select All", selected: SelectAllKey };
109
+ if (hasSelected) {
110
+ setData([firstItem, ...data]);
111
+ } else {
112
+ data.forEach((el) => {
113
+ el.selected = false;
114
+ });
115
+ setData([firstItem, ...data]);
116
+ }
117
+ }, [JSON.stringify(data)]);
118
+ useEffect(() => {
119
+ if (!withMultiselect) return;
120
+ if (!data.every((el) => el.selected)) {
121
+ setSelectAllKey(false);
122
+ }
123
+ }, [SelectedData.current.length]);
124
+ useEffect(() => {
125
+ if (!withMultiselect && selectedOptionID) {
126
+ setSingleSelectValue(data.find((el) => el.id === selectedOptionID));
127
+ }
128
+ }, [selectedOptionID]);
129
+ useEffect(() => {
130
+ if (!withMultiselect) return;
131
+ if (Data.length > 0 && ClickedSelectAll) {
132
+ const updated = Data.map((el) => {
133
+ if (el.id === "SELECT_ALL") return { ...el, selected: SelectAllKey };
134
+ if (el.disabled) return el;
135
+ return { ...el, selected: SelectAllKey };
136
+ });
137
+ setData(updated);
138
+ data.forEach((el) => {
139
+ if (el.id === "SELECT_ALL") {
140
+ el.selected = SelectAllKey;
141
+ } else if (!el.disabled) {
142
+ el.selected = SelectAllKey;
143
+ }
144
+ });
145
+ SelectedData.current = updated.filter((el) => el.selected && el.id !== "SELECT_ALL");
146
+ onSelect?.(SelectedData.current);
147
+ }
148
+ }, [Flag]);
149
+ useEffect(() => {
150
+ const ClickHandler = (event) => {
151
+ if (!ComponentRef.current) return;
152
+ if (event.composedPath().includes(ComponentRef.current)) return;
153
+ setIsFocused(false);
154
+ };
155
+ const ScrollHandler = (event) => {
156
+ if (!ComponentRef.current || !ListRef.current) return;
157
+ if (ListRef.current.contains(event.target)) return;
158
+ setIsFocused(false);
159
+ };
160
+ document.addEventListener("click", ClickHandler);
161
+ document.addEventListener("wheel", ScrollHandler);
162
+ return () => {
163
+ document.removeEventListener("click", ClickHandler);
164
+ document.removeEventListener("wheel", ScrollHandler);
165
+ };
166
+ }, []);
167
+ useEffect(() => {
168
+ if (!withMultiselect) return;
169
+ const calculateSelectedLength = () => {
170
+ const rect = ComponentRef.current?.getBoundingClientRect();
171
+ if (!rect) return;
172
+ const width = rect.width;
173
+ if (width <= 150) SelectedDataLength.current = 0;
174
+ else if (width <= 250) SelectedDataLength.current = 1;
175
+ else if (width <= 350) SelectedDataLength.current = 2;
176
+ else if (width <= 450) SelectedDataLength.current = 3;
177
+ else SelectedDataLength.current = 4;
178
+ };
179
+ calculateSelectedLength();
180
+ window.addEventListener("resize", calculateSelectedLength);
181
+ return () => window.removeEventListener("resize", calculateSelectedLength);
182
+ }, []);
183
+ const isInitialRender = useRef(true);
184
+ useEffect(() => {
185
+ if (isInitialRender.current) {
186
+ isInitialRender.current = false;
187
+ return;
188
+ }
189
+ if (!IsFocused) {
190
+ onBlur?.();
191
+ }
192
+ }, [IsFocused]);
193
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${style.dropdownWrapper}`, style: dropdownWrapperStyle ?? {}, children: [
194
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
195
+ "div",
196
+ {
197
+ ref: ComponentRef,
198
+ className: style.dropdownInputWrapper,
199
+ style: dropdownInputWrapperStyle ?? {},
200
+ onClick: () => (setIsFocused((state) => !state), CalculatePos()),
201
+ onFocus: Focus,
202
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
203
+ FormInput,
204
+ {
205
+ ...rest,
206
+ onFocusChange: (value) => setIsFocused(value),
207
+ customFocus: IsFocused,
208
+ withActive: false,
209
+ value: withInput ? InputValue : SingleSelectValue?.label ?? "",
210
+ onChange: (value) => {
211
+ setInputValue(value);
212
+ onValueChange?.(value);
213
+ },
214
+ toggleFocus: true,
215
+ formInputStyle: { cursor: withInput ? "text" : "pointer" },
216
+ leftSlot: withInput && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: style.dropdownInputSlot, children: [
217
+ dropdownType === "currency" ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: SingleSelectValue?.label }) : /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: getFlagIconUrl(SingleSelectValue?.code), alt: "flag" }),
218
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${style.dropdownRightIconArrow} ${IsFocused ? style.focused : ""}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconArrowUp, {}) })
219
+ ] }),
220
+ rightSlot: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${style.dropdownRightIcon} ${IsFocused ? style.focused : ""}`, children: [
221
+ (withInput ? InputValue : !withMultiselect && SingleSelectValue) && /* @__PURE__ */ jsxRuntimeExports.jsx(
222
+ "div",
223
+ {
224
+ onClick: (e) => {
225
+ e.stopPropagation();
226
+ if (withInput) {
227
+ setInputValue("");
228
+ setIsFocused(false);
229
+ } else {
230
+ setSingleSelectValue(null);
231
+ }
232
+ },
233
+ className: style.dropdownRightIconClose,
234
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconCloseCircle, {})
235
+ }
236
+ ),
237
+ !withInput && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: style.dropdownRightIconArrow, children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconArrowUp, {}) })
238
+ ] }),
239
+ readOnly: !withInput,
240
+ forDropdown: true,
241
+ inputSlotStyle: { width: "100%" },
242
+ inputSlot: withMultiselect && SelectedData.current.length > 0 ? customInputSlot || /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: style.dropdownInputSlot, style: dropdownInputSlotStyle ?? {}, children: [
243
+ SelectedData.current.slice(0, SelectedDataLength.current).map((el, index) => {
244
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
245
+ "li",
246
+ {
247
+ ref: ListItemRef,
248
+ className: style.dropdownInputSlotItem,
249
+ style: dropdownInputSlotItemStyle ?? {},
250
+ onClick: (e) => e.stopPropagation(),
251
+ children: [
252
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { title: el.label, className: style.dropdownInputSlotItemLabel, style: dropdownInputSlotItemLabelStyle ?? {}, children: el.customLabel ? el.customLabel(el) : el.label }),
253
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
254
+ "div",
255
+ {
256
+ style: dropdownInputSlotItemCloseStyle ?? {},
257
+ className: style.dropdownInputSlotItemClose,
258
+ onClick: (e) => {
259
+ e.stopPropagation();
260
+ SelectItem(el);
261
+ },
262
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconClose, { width: "16", height: "16", viewBox: "0 0 16 16", stroke: "#95969C" })
263
+ }
264
+ )
265
+ ]
266
+ },
267
+ index
268
+ );
269
+ }),
270
+ SelectedData.current.length > SelectedDataLength.current && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { className: `${style.dropdownInputSlotItem} ${style.dropdownInputSlotItemMore}`, style: dropdownInputSlotItemMoreStyle ?? {}, children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: style.dropdownInputSlotItemLabel, style: dropdownInputSlotItemLabelStyle ?? {}, children: `+${SelectedData.current.length - SelectedDataLength.current}` }) })
271
+ ] }) : null
272
+ }
273
+ )
274
+ }
275
+ ),
276
+ data && data.length > 0 && IsFocused && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: DropdownRef, onClick: (e) => e.stopPropagation(), className: style.dropdownListContainer, children: [
277
+ withFilter && /* @__PURE__ */ jsxRuntimeExports.jsx(
278
+ FormInput,
279
+ {
280
+ placeholder: "Search",
281
+ searchComponent: true,
282
+ withFocus: false,
283
+ withActive: false,
284
+ value: SearchValue,
285
+ onChange: (value) => setSearchValue(value)
286
+ }
287
+ ),
288
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { onClick: (e) => e.stopPropagation(), className: style.dropdownList, ref: ListRef, style: dropdownListStyle ?? {}, children: Data.filter((item) => item?.label?.toLowerCase().includes(SearchValue.toLowerCase())).map((item, index) => {
289
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
290
+ "li",
291
+ {
292
+ style: { ...dropdownItemStyle, cursor: !withMultiselect && item?.disabled ? "not-allowed" : "pointer" },
293
+ className: `${style.dropdownItem} ${!withMultiselect && SingleSelectValue?.id === item.id ? style.selected : ""} ${!item?.label || item.label === void 0 || disableAll || item?.disabled ? style.disabled : ""} ${!withMultiselect && !item?.disabled ? style.hovered : ""}`,
294
+ onClick: (e) => {
295
+ e.stopPropagation();
296
+ if (!withMultiselect && !item?.disabled) {
297
+ SingleSelect(item);
298
+ }
299
+ },
300
+ children: [
301
+ withMultiselect && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: style.itemCheckbox, style: itemCheckboxStyle ?? {}, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
302
+ Checkbox,
303
+ {
304
+ multipleChecked: item.id === "SELECT_ALL",
305
+ disabled: disableAll || item?.disabled,
306
+ checked: item?.selected,
307
+ change: () => SelectItem(item)
308
+ }
309
+ ) }),
310
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: style.dropdownItemLabel, style: dropdownItemLabelStyle ?? {}, children: [
311
+ withInput ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: style.dropdownItemLabelInput, children: [
312
+ /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: getFlagIconUrl(item.code), style: { width: "1.375rem", height: "1.375rem", objectFit: "contain" }, alt: item.name }),
313
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { title: item.name, className: style.countryName, children: item.name || item.label }),
314
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: style.countryDialCode, children: dropdownType === "country" ? item.dialCode : item?.label })
315
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
316
+ "p",
317
+ {
318
+ title: typeof item.label === "string" ? item.label : "",
319
+ className: `${item.id === "SELECT_ALL" ? style.selectAll : ""}`,
320
+ style: dropdownItemLabelTextStyle ?? {},
321
+ children: item.customLabel ? item.customLabel() : item.label
322
+ }
323
+ ),
324
+ withMultiselect && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: item.id === "SELECT_ALL" ? `${Data.filter((el) => el.id !== "SELECT_ALL" && el.selected).length}/${data.length}` : "" })
325
+ ] })
326
+ ]
327
+ },
328
+ index
329
+ );
330
+ }) }, Data.length)
331
+ ] })
332
+ ] });
333
+ };
334
+ export {
335
+ Dropdown as default
336
+ };
@@ -0,0 +1,74 @@
1
+ const dropdownWrapper = "Dropdown-module__dropdownWrapper";
2
+ const dropdownInputWrapper = "Dropdown-module__dropdownInputWrapper";
3
+ const dropdownInputSlot = "Dropdown-module__dropdownInputSlot";
4
+ const dropdownRightIconArrow = "Dropdown-module__dropdownRightIconArrow";
5
+ const focused = "Dropdown-module__focused";
6
+ const dropdownInputSlotItem = "Dropdown-module__dropdownInputSlotItem";
7
+ const dropdownInputSlotItemLabel = "Dropdown-module__dropdownInputSlotItemLabel";
8
+ const dropdownInputSlotItemClose = "Dropdown-module__dropdownInputSlotItemClose";
9
+ const dropdownInputSlotItemMore = "Dropdown-module__dropdownInputSlotItemMore";
10
+ const dropdownRightIcon = "Dropdown-module__dropdownRightIcon";
11
+ const dropdownRightIconClose = "Dropdown-module__dropdownRightIconClose";
12
+ const dropdownListContainer = "Dropdown-module__dropdownListContainer";
13
+ const dropdownList = "Dropdown-module__dropdownList";
14
+ const dropdownItem = "Dropdown-module__dropdownItem";
15
+ const selected = "Dropdown-module__selected";
16
+ const dropdownItemLabel = "Dropdown-module__dropdownItemLabel";
17
+ const hovered = "Dropdown-module__hovered";
18
+ const disabled = "Dropdown-module__disabled";
19
+ const itemCheckbox = "Dropdown-module__itemCheckbox";
20
+ const dropdownItemLabelInput = "Dropdown-module__dropdownItemLabelInput";
21
+ const countryName = "Dropdown-module__countryName";
22
+ const countryDialCode = "Dropdown-module__countryDialCode";
23
+ const selectAll = "Dropdown-module__selectAll";
24
+ const style = {
25
+ dropdownWrapper,
26
+ dropdownInputWrapper,
27
+ dropdownInputSlot,
28
+ dropdownRightIconArrow,
29
+ focused,
30
+ dropdownInputSlotItem,
31
+ dropdownInputSlotItemLabel,
32
+ dropdownInputSlotItemClose,
33
+ dropdownInputSlotItemMore,
34
+ dropdownRightIcon,
35
+ dropdownRightIconClose,
36
+ dropdownListContainer,
37
+ dropdownList,
38
+ dropdownItem,
39
+ selected,
40
+ dropdownItemLabel,
41
+ hovered,
42
+ disabled,
43
+ itemCheckbox,
44
+ dropdownItemLabelInput,
45
+ countryName,
46
+ countryDialCode,
47
+ selectAll
48
+ };
49
+ export {
50
+ countryDialCode,
51
+ countryName,
52
+ style as default,
53
+ disabled,
54
+ dropdownInputSlot,
55
+ dropdownInputSlotItem,
56
+ dropdownInputSlotItemClose,
57
+ dropdownInputSlotItemLabel,
58
+ dropdownInputSlotItemMore,
59
+ dropdownInputWrapper,
60
+ dropdownItem,
61
+ dropdownItemLabel,
62
+ dropdownItemLabelInput,
63
+ dropdownList,
64
+ dropdownListContainer,
65
+ dropdownRightIcon,
66
+ dropdownRightIconArrow,
67
+ dropdownRightIconClose,
68
+ dropdownWrapper,
69
+ focused,
70
+ hovered,
71
+ itemCheckbox,
72
+ selectAll,
73
+ selected
74
+ };