@dgshahr/ui-kit 0.0.70 → 0.0.72

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.
@@ -1,23 +1,14 @@
1
1
  "use client";
2
- import { jsx as s, jsxs as I, Fragment as S } from "react/jsx-runtime";
3
- import { c as n } from "../../clsx-OuTLNxxd.js";
4
- import { useRef as U, useEffect as $, memo as W, useState as T, useMemo as L, useCallback as R } from "react";
5
- import { A as q } from "../../ArrowDown2-CMeKw_vj.js";
6
- import G from "../Checkbox/index.js";
7
- import z from "../Input/index.js";
8
- import J from "../../Drawer/index.js";
2
+ import { jsx as r, jsxs as y, Fragment as I } from "react/jsx-runtime";
3
+ import { c as l } from "../../clsx-OuTLNxxd.js";
4
+ import { memo as q, createContext as G, useContext as J, useState as O, useRef as H, useMemo as W, useCallback as R, useEffect as M } from "react";
5
+ import Q from "../Checkbox/index.js";
6
+ import X from "../../Button/index.js";
7
+ import U from "../Input/index.js";
8
+ import Y from "../../Drawer/index.js";
9
+ import { A as Z } from "../../ArrowDown2-CMeKw_vj.js";
9
10
  import '../../assets/styles.css';/* empty css */
10
- const K = (r) => {
11
- const e = U(null);
12
- return $(() => {
13
- const i = (o) => {
14
- e.current && !e.current.contains(o.target) && r();
15
- };
16
- return document.addEventListener("click", i, !0), () => {
17
- document.removeEventListener("click", i, !0);
18
- };
19
- }, [e, r]), e;
20
- }, Q = (r) => /* @__PURE__ */ s(
11
+ const tt = (s) => /* @__PURE__ */ r(
21
12
  "svg",
22
13
  {
23
14
  xmlns: "http://www.w3.org/2000/svg",
@@ -25,8 +16,8 @@ const K = (r) => {
25
16
  height: "1em",
26
17
  fill: "none",
27
18
  viewBox: "0 0 24 24",
28
- ...r,
29
- children: /* @__PURE__ */ s(
19
+ ...s,
20
+ children: /* @__PURE__ */ r(
30
21
  "path",
31
22
  {
32
23
  stroke: "currentColor",
@@ -38,260 +29,310 @@ const K = (r) => {
38
29
  )
39
30
  }
40
31
  );
41
- function X({
42
- label: r,
32
+ function et(s, e = 100) {
33
+ if (!s) return;
34
+ const t = document.createElement("input");
35
+ t.style.position = "absolute", t.style.top = `${s.offsetTop + 7}px`, t.style.left = `${s.offsetLeft}px`, t.style.height = "0px", t.style.opacity = "0px", document.body.appendChild(t), t.focus(), setTimeout(() => {
36
+ s.focus(), s.click(), document.body.removeChild(t);
37
+ }, e);
38
+ }
39
+ function it({
40
+ label: s,
43
41
  isMultiple: e,
44
- isActive: i,
42
+ isActive: t,
45
43
  disabled: o
46
44
  }) {
47
- return e ? /* @__PURE__ */ s(
48
- G,
45
+ return e ? /* @__PURE__ */ r(
46
+ Q,
49
47
  {
50
- checked: i,
51
- label: r,
48
+ checked: t,
49
+ label: s,
52
50
  readOnly: !0,
53
51
  disabled: o
54
52
  }
55
- ) : r;
53
+ ) : s;
56
54
  }
57
- const Y = (r) => {
58
- const { option: e, onClick: i, value: o, mode: g, optionCellClassName: p, optionCell: l } = r;
59
- function k() {
55
+ const st = (s) => {
56
+ const { option: e, onClick: t, value: o, mode: n, optionCellClassName: g, optionCell: a } = s;
57
+ function u() {
60
58
  return Array.isArray(o) ? o.includes(e.value) : e.value === o;
61
59
  }
62
- return /* @__PURE__ */ s(
60
+ return /* @__PURE__ */ r(
63
61
  "button",
64
62
  {
65
- onClick: i,
66
- className: n(
63
+ onClick: t,
64
+ className: l(
67
65
  "dgs-ui-kit-w-full dgs-ui-kit-text-start dgs-ui-kit-px-3 disabled:dgs-ui-kit-cursor-not-allowed dgs-ui-kit-py-3 dgs-ui-kit-font-p1-regular disabled:dgs-ui-kit-bg-gray-50 dgs-ui-kit-transition",
68
- k() ? "dgs-ui-kit-bg-primary-50 dgs-ui-kit-text-primary-500" : "dgs-ui-kit-text-gray-700 disabled:dgs-ui-kit-text-gray-400",
69
- p
66
+ u() ? "dgs-ui-kit-bg-primary-50 dgs-ui-kit-text-primary-500" : "dgs-ui-kit-text-gray-700 disabled:dgs-ui-kit-text-gray-400",
67
+ g
70
68
  ),
71
69
  disabled: e.disabled,
72
- children: l ? l(e, k()) : X({
70
+ children: a ? a(e, u()) : it({
73
71
  label: e.label,
74
- isMultiple: g === "multiple",
75
- isActive: k(),
72
+ isMultiple: n === "multiple",
73
+ isActive: u(),
76
74
  disabled: e.disabled ?? !1
77
75
  })
78
76
  }
79
77
  );
80
- }, _ = W(Y), Z = 20, B = (r) => {
78
+ }, _ = q(st), F = G({
79
+ toggleWrapperVisibility: () => {
80
+ }
81
+ }), rt = () => J(F), nt = 20, ot = (s) => {
81
82
  const {
82
83
  options: e,
83
- mode: i = "single",
84
+ mode: t = "single",
84
85
  afterOptions: o,
85
- beforOptions: g,
86
- onChange: p,
87
- searchable: l = !0,
88
- setIsShowOptions: k,
89
- separateSelectedOptions: f = !0,
90
- optionsTitle: d = "عنوان‌ها",
91
- value: c,
92
- optionCellClassName: v
93
- } = r, [a, m] = T(""), [w, y] = T(0), h = U(null), x = n(
86
+ beforOptions: n,
87
+ onChange: g,
88
+ searchable: a = !0,
89
+ separateSelectedOptions: u = !0,
90
+ optionsTitle: v = "عنوان‌ها",
91
+ value: m,
92
+ optionCellClassName: f,
93
+ emptyContent: h = "نتیجه‌ای یافت نشد !",
94
+ showClearButtonOnEmpty: C = !0
95
+ } = s, [k, c] = O(""), [b, w] = O(0), p = H(null), { toggleWrapperVisibility: T } = rt(), $ = l(
94
96
  "dgs-ui-kit-border-t dgs-ui-kit-border-solid dgs-ui-kit-border-gray-100",
95
- (!l && !g || i === "multiple" && f) && "first-of-type:dgs-ui-kit-border-t-0",
97
+ (!a && !n || t === "multiple" && u) && "first-of-type:dgs-ui-kit-border-t-0",
96
98
  !!o && "last-of-type:dgs-ui-kit-border-b"
97
99
  );
98
- let C;
99
- const b = l;
100
- typeof l == "boolean" ? C = l : C = Object.keys(l).length > 0;
101
- const O = L(() => a ? e?.filter((t) => t.label.includes(a)) : e, [a, e]), M = L(() => i === "multiple" && f ? e?.filter((t) => c.includes(t.value)) ?? [] : [], [e, c]), F = L(() => {
102
- let t = O;
103
- i === "multiple" && f && (t = t?.filter((A) => !c.includes(A.value)));
104
- const u = Math.min(w + Z, t?.length ?? 0);
105
- return t?.slice(w, u);
106
- }, [O, w, c]), N = h?.current?.children[0]?.clientHeight ?? 50, V = (O?.length ?? 0) * N, E = R(() => {
107
- const t = h?.current?.parentElement;
108
- if (!t) return;
109
- const u = t.scrollTop, A = h.current.offsetTop, D = Math.floor((u - A) / N);
110
- y(D >= 0 ? D : 0);
100
+ let x;
101
+ const E = a;
102
+ typeof a == "boolean" ? x = a : x = Object.keys(a).length > 0;
103
+ const S = W(() => k ? e?.filter((i) => i.label.includes(k)) : e, [k, e]), A = W(() => t === "multiple" && u ? e?.filter((i) => m.includes(i.value)) ?? [] : [], [e, m]), j = W(() => {
104
+ let i = S;
105
+ t === "multiple" && u && (i = i?.filter((P) => !m.includes(P.value)));
106
+ const d = Math.min(b + nt, i?.length ?? 0);
107
+ return i?.slice(b, d);
108
+ }, [S, b, m]), N = p?.current?.children[0]?.clientHeight ?? 50, K = (S?.length ?? 0) * N, L = R(() => {
109
+ const i = p?.current?.parentElement;
110
+ if (!i) return;
111
+ const d = i.scrollTop, P = p.current.offsetTop, D = Math.floor((d - P) / N);
112
+ w(D >= 0 ? D : 0);
111
113
  }, [N]);
112
- $(() => {
113
- const t = h.current?.parentElement;
114
- if (t)
115
- return t.addEventListener("scroll", E), () => t.removeEventListener("scroll", E);
116
- }, [E]);
117
- const j = R(
118
- (t) => {
119
- if (typeof p == "function")
120
- if (i === "multiple") {
121
- const u = [...c ?? []];
122
- u.includes(t) ? u.splice(u.indexOf(t), 1) : u.push(t), p(u);
114
+ M(() => {
115
+ const i = p.current?.parentElement;
116
+ if (i)
117
+ return i.addEventListener("scroll", L), () => i.removeEventListener("scroll", L);
118
+ }, [L]), M(() => {
119
+ x && et(document.getElementById("search-input"), 400);
120
+ }, []);
121
+ const B = R(
122
+ (i) => {
123
+ if (typeof g == "function")
124
+ if (t === "multiple") {
125
+ const d = [...m ?? []];
126
+ d.includes(i) ? d.splice(d.indexOf(i), 1) : d.push(i), g(d);
123
127
  } else
124
- p(t), k(!1);
128
+ g(i), T();
125
129
  },
126
- [c]
130
+ [m]
127
131
  );
128
- return /* @__PURE__ */ I(S, { children: [
129
- C && /* @__PURE__ */ s(
130
- z,
132
+ return /* @__PURE__ */ y(I, { children: [
133
+ x && /* @__PURE__ */ r(
134
+ U,
131
135
  {
132
- wrapperClassName: n(
136
+ id: "search-input",
137
+ wrapperClassName: l(
133
138
  "dgs-ui-kit-sticky dgs-ui-kit-top-0 dgs-ui-kit-pt-3 dgs-ui-kit-right-0 dgs-ui-kit-bg-white dgs-ui-kit-z-10 dgs-ui-kit-px-3",
134
- g ? "dgs-ui-kit-pb-2" : "dgs-ui-kit-pb-3",
135
- b?.wrapperClassName
139
+ n ? "dgs-ui-kit-pb-2" : "dgs-ui-kit-pb-3",
140
+ E?.wrapperClassName
136
141
  ),
137
- placeholder: b?.placeholder ?? "جستجوی عنوان",
138
- onChange: (t) => m(t.currentTarget.value),
139
- rightIcon: b?.rightIcon ?? /* @__PURE__ */ s(
140
- Q,
142
+ placeholder: E?.placeholder ?? "جستجوی عنوان",
143
+ value: k,
144
+ onChange: (i) => c(i.currentTarget.value),
145
+ rightIcon: E?.rightIcon ?? /* @__PURE__ */ r(
146
+ tt,
141
147
  {
142
148
  width: 20,
143
149
  height: 20
144
150
  }
145
151
  ),
146
- autoFocus: !0,
147
- ...typeof l == "object" ? l : {}
152
+ ...typeof a == "object" ? a : {}
148
153
  }
149
154
  ),
150
- g,
151
- i === "multiple" && f && M.length > 0 && /* @__PURE__ */ I(S, { children: [
152
- /* @__PURE__ */ s("p", { className: "dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2", children: `${d}‌ی انتخاب شده` }),
153
- M.map((t) => /* @__PURE__ */ s(
155
+ n,
156
+ t === "multiple" && u && A.length > 0 && /* @__PURE__ */ y(I, { children: [
157
+ /* @__PURE__ */ r("p", { className: "dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2", children: `${v}‌ی انتخاب شده` }),
158
+ A.map((i) => /* @__PURE__ */ r(
154
159
  _,
155
160
  {
156
- onClick: () => j(t.value),
157
- option: t,
158
- optionCellClassName: n(x, v),
159
- ...r
161
+ onClick: () => B(i.value),
162
+ option: i,
163
+ optionCellClassName: l($, f),
164
+ ...s
160
165
  },
161
- t.value
166
+ i.value
162
167
  ))
163
168
  ] }),
164
- /* @__PURE__ */ I(S, { children: [
165
- i === "multiple" && f && /* @__PURE__ */ s("p", { className: "dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2", children: d }),
166
- /* @__PURE__ */ s(
169
+ /* @__PURE__ */ y(I, { children: [
170
+ t === "multiple" && u && /* @__PURE__ */ r("p", { className: "dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2", children: v }),
171
+ /* @__PURE__ */ r(
167
172
  "div",
168
173
  {
169
- ref: h,
174
+ ref: p,
170
175
  className: "dgs-ui-kit-relative",
171
- style: { height: V },
172
- children: F?.map((t, u) => /* @__PURE__ */ s(
176
+ style: { height: K },
177
+ children: j?.map((i, d) => /* @__PURE__ */ r(
173
178
  "div",
174
179
  {
175
- className: n("dgs-ui-kit-absolute dgs-ui-kit-w-full", x),
176
- style: { top: `${(w + u) * N}px` },
177
- children: /* @__PURE__ */ s(
180
+ className: l("dgs-ui-kit-absolute dgs-ui-kit-w-full", $),
181
+ style: { top: `${(b + d) * N}px` },
182
+ children: /* @__PURE__ */ r(
178
183
  _,
179
184
  {
180
- onClick: () => j(t.value),
181
- option: t,
182
- ...r
185
+ onClick: () => B(i.value),
186
+ option: i,
187
+ ...s
183
188
  }
184
189
  )
185
190
  },
186
- t.value
191
+ i.value
187
192
  ))
188
193
  }
189
- )
194
+ ),
195
+ !j?.length && !A.length && /* @__PURE__ */ y("div", { className: "dgs-ui-kit-text-center dgs-ui-kit-flex dgs-ui-kit-flex-col dgs-ui-kit-items-center dgs-ui-kit-mt-2", children: [
196
+ /* @__PURE__ */ r("p", { className: "dgs-ui-kit-text-gray-500 dgs-ui-kit-font-p3-medium", children: h }),
197
+ C && /* @__PURE__ */ r(
198
+ X,
199
+ {
200
+ className: "dgs-ui-kit-mt-1",
201
+ variant: "text",
202
+ size: "small",
203
+ onClick: () => c(""),
204
+ children: "پاک کردن"
205
+ }
206
+ )
207
+ ] })
190
208
  ] }),
191
209
  o
192
210
  ] });
193
- }, H = "dgs-ui-kit-duration-300", P = 400;
194
- function tt(r, e) {
195
- return Array.isArray(r) ? e.filter((i) => r.includes(i.value)).map((i) => i.label).join(", ") : e.find((i) => i.value === r)?.label ?? "";
196
- }
197
- const at = (r) => {
211
+ }, lt = (s) => {
212
+ const e = H(null);
213
+ return M(() => {
214
+ const t = (o) => {
215
+ e.current && !e.current.contains(o.target) && s();
216
+ };
217
+ return document.addEventListener("click", t, !0), () => {
218
+ document.removeEventListener("click", t, !0);
219
+ };
220
+ }, [e, s]), e;
221
+ }, V = "dgs-ui-kit-duration-300", z = 400, at = (s) => {
198
222
  const {
199
- options: e,
200
- optionsContainer: i = "popover",
201
- className: o,
223
+ dropdownType: e = "popover",
224
+ disabled: t,
225
+ isLoading: o,
226
+ wrapperClassName: n,
202
227
  customInput: g,
203
- inputProps: p,
204
- drawerProps: l,
205
- popoverClassName: k,
206
- value: f,
207
- isLoading: d,
208
- searchable: c = !0,
209
- disabled: v = d
210
- } = r, [a, m] = T(!1), [w, y] = T(!1), h = K(() => {
211
- i === "popover" && a && (m(!1), setTimeout(() => {
212
- y(!1);
213
- }, P));
228
+ children: a,
229
+ drawerProps: u,
230
+ inputProps: v,
231
+ popoverClassName: m
232
+ } = s, [f, h] = O(!1), [C, k] = O(!1);
233
+ let c;
234
+ const b = lt(() => {
235
+ e === "popover" && f && (h(!1), c && clearTimeout(c), c = setTimeout(() => {
236
+ k(!1);
237
+ }, z));
214
238
  });
215
- function x() {
216
- if (v || d) return;
217
- !a ? (y(!0), setTimeout(() => {
218
- m(!0);
219
- }, 0)) : (m(!1), setTimeout(() => {
220
- y(!1);
221
- }, P));
239
+ function w() {
240
+ if (t || o) return;
241
+ const T = !C;
242
+ c && clearTimeout(c), T ? (k(!0), c = setTimeout(() => {
243
+ h(!0);
244
+ }, 0)) : (h(!1), c = setTimeout(() => {
245
+ k(!1);
246
+ }, z));
222
247
  }
223
- const C = {
224
- ...r,
225
- setIsShowOptions: m
226
- }, b = n({
227
- "!dgs-ui-kit-cursor-not-allowed": v,
228
- "!dgs-ui-kit-cursor-wait": d,
229
- "!dgs-ui-kit-cursor-pointer": !d && !v
248
+ const p = l({
249
+ "!dgs-ui-kit-cursor-not-allowed": t,
250
+ "!dgs-ui-kit-cursor-wait": o,
251
+ "!dgs-ui-kit-cursor-pointer": !o && !t
230
252
  });
231
- return /* @__PURE__ */ I(
253
+ return /* @__PURE__ */ y(
232
254
  "div",
233
255
  {
234
- ref: h,
235
- className: n("dgs-ui-kit-relative", o),
256
+ ref: b,
257
+ className: l("dgs-ui-kit-relative", n),
236
258
  children: [
237
- /* @__PURE__ */ s(
259
+ /* @__PURE__ */ r(
238
260
  "button",
239
261
  {
240
- className: n("dgs-ui-kit-w-full", b),
241
- onClick: x,
242
- children: g ? g(a) : /* @__PURE__ */ s(
243
- z,
262
+ className: l("dgs-ui-kit-w-full", p),
263
+ onClick: w,
264
+ children: g ? g(f) : /* @__PURE__ */ r(
265
+ U,
244
266
  {
245
- leftIcon: d ? /* @__PURE__ */ s("div", { className: "dot-flashing dgs-ui-kit-mr-2" }) : /* @__PURE__ */ s(
246
- q,
267
+ leftIcon: o ? /* @__PURE__ */ r("div", { className: "dot-flashing dgs-ui-kit-mr-2" }) : /* @__PURE__ */ r(
268
+ Z,
247
269
  {
248
270
  width: 20,
249
271
  height: 20,
250
- className: n("dgs-ui-kit-transition", H, {
251
- "dgs-ui-kit-rotate-180": a
272
+ className: l("dgs-ui-kit-transition", V, {
273
+ "dgs-ui-kit-rotate-180": f
252
274
  })
253
275
  }
254
276
  ),
255
- containerClassName: n(b, {
256
- "dgs-ui-kit-items-baseline": d
277
+ containerClassName: l(p, {
278
+ "dgs-ui-kit-items-baseline": o
257
279
  }),
258
- className: n("dgs-ui-kit-caret-transparent", b),
259
- value: tt(f, e),
260
- disabled: v,
261
- ...p
280
+ className: l("dgs-ui-kit-caret-transparent", p),
281
+ disabled: t,
282
+ ...v
262
283
  }
263
284
  )
264
285
  }
265
286
  ),
266
- w && /* @__PURE__ */ s(S, { children: i === "popover" ? /* @__PURE__ */ s(
267
- "div",
287
+ /* @__PURE__ */ r(
288
+ F.Provider,
268
289
  {
269
- className: n(
270
- "dgs-ui-kit-absolute dgs-ui-kit-min-w-[300px] dgs-ui-kit-bottom-0 dgs-ui-kit-right-0 dgs-ui-kit-translate-y-[calc(100%+8px)] dgs-ui-kit-overflow-y-auto dgs-ui-kit-overflow-x-hidden dgs-ui-kit-shadow-lg dgs-ui-kit-w-full dgs-ui-kit-max-h-[360px] dgs-ui-kit-transition-all dgs-ui-kit-bg-white dgs-ui-kit-z-50 dgs-ui-kit-rounded-lg dgs-ui-kit-border dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200 dgs-ui-kit-pb-3",
271
- H,
272
- a ? "dgs-ui-kit-opacity-100" : "dgs-ui-kit-opacity-0 dgs-ui-kit-max-h-0 dgs-ui-kit-overflow-y-hidden",
273
- { "dgs-ui-kit-pt-3": !c },
274
- k
275
- ),
276
- children: /* @__PURE__ */ s(B, { ...C })
277
- }
278
- ) : /* @__PURE__ */ s(
279
- J,
280
- {
281
- open: a,
282
- onClose: () => m(!1),
283
- containerClassName: n(
284
- "!dgs-ui-kit-pb-3 !dgs-ui-kit-px-0",
285
- c ? "!dgs-ui-kit-pt-0" : "!dgs-ui-kit-pt-3"
286
- ),
287
- ...l,
288
- children: /* @__PURE__ */ s(B, { ...C })
290
+ value: {
291
+ toggleWrapperVisibility: w
292
+ },
293
+ children: C && /* @__PURE__ */ r(I, { children: e === "popover" ? /* @__PURE__ */ r(
294
+ "div",
295
+ {
296
+ className: l(
297
+ "dgs-ui-kit-absolute dgs-ui-kit-min-w-[300px] dgs-ui-kit-bottom-0 dgs-ui-kit-right-0 dgs-ui-kit-translate-y-[calc(100%+8px)] dgs-ui-kit-overflow-y-auto dgs-ui-kit-overflow-x-hidden dgs-ui-kit-shadow-lg dgs-ui-kit-w-full dgs-ui-kit-max-h-[360px] dgs-ui-kit-transition-all dgs-ui-kit-bg-white dgs-ui-kit-z-50 dgs-ui-kit-rounded-lg dgs-ui-kit-border dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200 dgs-ui-kit-pb-3",
298
+ V,
299
+ f ? "dgs-ui-kit-opacity-100" : "dgs-ui-kit-opacity-0 dgs-ui-kit-max-h-0 dgs-ui-kit-overflow-y-hidden",
300
+ m
301
+ ),
302
+ children: a
303
+ }
304
+ ) : /* @__PURE__ */ r(
305
+ Y,
306
+ {
307
+ ...u,
308
+ open: f,
309
+ onClose: () => h(!1),
310
+ containerClassName: l(
311
+ "!dgs-ui-kit-pb-3 !dgs-ui-kit-px-0",
312
+ u?.containerClassName
313
+ ),
314
+ children: a
315
+ }
316
+ ) })
289
317
  }
290
- ) })
318
+ )
291
319
  ]
292
320
  }
293
321
  );
294
322
  };
323
+ function ut(s, e) {
324
+ return Array.isArray(s) ? e.filter((t) => s.includes(t.value)).map((t) => t.label).join(", ") : e.find((t) => t.value === s)?.label ?? "";
325
+ }
326
+ const yt = (s) => {
327
+ const { searchable: e = !0, value: t, options: o } = s, n = { ...s };
328
+ return n.dropdownType === "popover" && !e && (n.popoverClassName = l("dgs-ui-kit-pt-3", n.popoverClassName)), n.dropdownType === "drawer" && (n.drawerProps = {
329
+ ...n.drawerProps,
330
+ containerClassName: l(
331
+ e ? "!dgs-ui-kit-pt-0" : "!dgs-ui-kit-pt-3",
332
+ n.drawerProps?.containerClassName
333
+ )
334
+ }), n.customInput || (n.inputProps = { ...n.inputProps, value: ut(t, o) }), /* @__PURE__ */ r(at, { ...n, children: /* @__PURE__ */ r(ot, { ...s }) });
335
+ };
295
336
  export {
296
- at as default
337
+ yt as default
297
338
  };
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- import { DrawerProps } from '../../Drawer';
3
2
  import { InputProps } from '../Input';
3
+ import { PickerWrapperProps } from '../Wrappers/PickerWrapper/type';
4
4
  export type Option<T> = {
5
5
  value: T;
6
6
  label: string;
@@ -10,13 +10,12 @@ type SelectPropsBase<T> = {
10
10
  options: Option<T>[];
11
11
  optionsContainer?: 'drawer' | 'popover';
12
12
  searchable?: boolean | Omit<InputProps, 'onChange'>;
13
- isLoading?: boolean;
14
- disabled?: boolean;
15
13
  optionCell?: (option: Option<T>, isActive: boolean) => ReactNode;
16
14
  optionCellClassName?: string;
17
- className?: string;
18
15
  beforOptions?: ReactNode;
19
16
  afterOptions?: ReactNode;
17
+ emptyContent?: ReactNode;
18
+ showClearButtonOnEmpty?: boolean;
20
19
  };
21
20
  export type SelectWithSingleMode<T> = {
22
21
  mode?: 'single';
@@ -32,24 +31,6 @@ export type SelectWithMultipleMode<T> = {
32
31
  optionsTitle?: string;
33
32
  separateSelectedOptions?: boolean;
34
33
  };
35
- type SelectWithCustomInput = {
36
- customInput?: (isShowOptions: boolean) => ReactNode;
37
- inputProps?: never;
38
- };
39
- type SelectWithoutCustomInput = {
40
- inputProps?: Omit<InputProps, 'leftIcon'>;
41
- customInput?: never;
42
- };
43
- type SelectWithDrawerContainer = {
44
- optionsContainer: 'drawer';
45
- drawerProps?: Omit<DrawerProps, 'children' | 'onClose' | 'open'>;
46
- popoverClassName?: never;
47
- };
48
- type SelectWithPopoverContainer = {
49
- optionsContainer?: 'popover';
50
- popoverClassName?: string;
51
- drawerProps?: never;
52
- };
53
- export type SelectProps<T> = SelectPropsBase<T> & (SelectWithSingleMode<T> | SelectWithMultipleMode<T>) & (SelectWithoutCustomInput | SelectWithCustomInput) & (SelectWithDrawerContainer | SelectWithPopoverContainer);
34
+ export type SelectProps<T> = SelectPropsBase<T> & Omit<PickerWrapperProps, 'children'> & (SelectWithSingleMode<T> | SelectWithMultipleMode<T>);
54
35
  export {};
55
36
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Select/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI;IACtB,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AACF,KAAK,eAAe,CAAC,CAAC,IAAI;IACxB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,gBAAgB,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACpD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,KAAK,SAAS,CAAC;IACjE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI;IACpC,IAA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AAE,KAAK,CAAC;IACrB,uBAAuB,CAAC,EAAE,KAAK,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI;IACtC,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,GAC7C,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,GACpC,CAAC,oBAAoB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import { PickerWrapperProps } from './type';
3
+ declare const PickerWrapper: FC<PickerWrapperProps>;
4
+ export default PickerWrapper;
5
+ //# sourceMappingURL=PickerWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PickerWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/Wrappers/PickerWrapper/PickerWrapper.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAY,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAK1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAGjD,OAAO,kBAAkB,CAAC;AAM1B,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA4HzC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,7 @@
1
+ interface IPickerWrapperContext {
2
+ toggleWrapperVisibility: () => void;
3
+ }
4
+ export declare const pickerWrapperContext: import('react').Context<IPickerWrapperContext>;
5
+ export declare const usePickerWrapper: () => IPickerWrapperContext;
6
+ export {};
7
+ //# sourceMappingURL=contexts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/Wrappers/PickerWrapper/contexts.ts"],"names":[],"mappings":"AAEA,UAAU,qBAAqB;IAC7B,uBAAuB,EAAE,MAAM,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,oBAAoB,gDAE/B,CAAC;AAEH,eAAO,MAAM,gBAAgB,6BAAyC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { ReactNode } from 'react';
2
+ import { DrawerProps } from '../../../Drawer';
3
+ import { InputProps } from '../../Input';
4
+ interface PickerWrapperPropsBase {
5
+ isLoading?: boolean;
6
+ disabled?: boolean;
7
+ wrapperClassName?: string;
8
+ children: ReactNode;
9
+ }
10
+ interface PickerWrapperWithCustomInput {
11
+ customInput?: (isOpen: boolean) => ReactNode;
12
+ inputProps?: never;
13
+ }
14
+ interface PickerWrapperWithoutCustomInput {
15
+ inputProps?: Omit<InputProps, 'leftIcon'>;
16
+ customInput?: never;
17
+ }
18
+ interface PickerWrapperWithDrawerContainer {
19
+ dropdownType: 'drawer';
20
+ drawerProps?: Omit<DrawerProps, 'children' | 'onClose' | 'open'>;
21
+ popoverClassName?: never;
22
+ }
23
+ interface PickerWrapperWithPopoverContainer {
24
+ dropdownType?: 'popover';
25
+ popoverClassName?: string;
26
+ drawerProps?: never;
27
+ }
28
+ export type PickerWrapperProps = PickerWrapperPropsBase & (PickerWrapperWithCustomInput | PickerWrapperWithoutCustomInput) & (PickerWrapperWithDrawerContainer | PickerWrapperWithPopoverContainer);
29
+ export {};
30
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/Wrappers/PickerWrapper/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,UAAU,sBAAsB;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,UAAU,4BAA4B;IACpC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,SAAS,CAAC;IAC7C,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB;AAED,UAAU,+BAA+B;IACvC,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC1C,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB;AAED,UAAU,gCAAgC;IACxC,YAAY,EAAE,QAAQ,CAAC;IACvB,WAAW,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC,CAAC;IACjE,gBAAgB,CAAC,EAAE,KAAK,CAAC;CAC1B;AAED,UAAU,iCAAiC;IACzC,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB;AAED,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,GACrD,CAAC,4BAA4B,GAAG,+BAA+B,CAAC,GAChE,CAAC,gCAAgC,GAAG,iCAAiC,CAAC,CAAC"}