abrplus-ui-kit 1.0.7 → 1.0.8

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 (55) hide show
  1. package/dist/antOverrides.cjs.js +1 -127
  2. package/dist/antOverrides.es.js +70 -98
  3. package/dist/atoms.cjs.js +1 -391
  4. package/dist/atoms.es.js +252 -306
  5. package/dist/colors-BDQwGpaB.cjs +5 -0
  6. package/dist/{colors-CztsZ6e_.js → colors-BW-NR0oP.js} +30 -34
  7. package/dist/deepMerge-2zqLIrFM.cjs +1 -0
  8. package/dist/deepMerge-Dm_AZi0Z.js +14 -0
  9. package/dist/index-B1HRk2-g.cjs +1 -0
  10. package/dist/index-BCH1vT85.js +8 -0
  11. package/dist/index-BJmt8SSx.cjs +1 -0
  12. package/dist/index-BPqX2Hsu.js +75 -0
  13. package/dist/{index-B02Mlfa4.js → index-BRLLsEKX.js} +19905 -19821
  14. package/dist/index-BeP9-mrf.js +200 -0
  15. package/dist/index-Bpx-uyOR.cjs +1 -0
  16. package/dist/index-CpGdrWps.js +19 -0
  17. package/dist/index-CwKyw6uN.cjs +1 -0
  18. package/dist/index-CzPs2mPX.js +478 -0
  19. package/dist/index-QraJKad8.cjs +1 -0
  20. package/dist/index-R9oQ5kp6.js +1569 -0
  21. package/dist/index-bNh4-ggT.cjs +1 -0
  22. package/dist/index-lDQ4dr86.cjs +1 -0
  23. package/dist/index.cjs.js +1 -109
  24. package/dist/index.css +1 -1519
  25. package/dist/index.es.js +5 -5
  26. package/dist/index2.css +1 -3
  27. package/dist/molecules.cjs.js +8 -7826
  28. package/dist/molecules.es.js +4270 -6306
  29. package/dist/organisms.cjs.js +1 -940
  30. package/dist/organisms.es.js +651 -758
  31. package/dist/provider.cjs.js +1 -48
  32. package/dist/provider.es.js +29 -34
  33. package/dist/sortable.esm-BSCvBWLi.js +2943 -0
  34. package/dist/sortable.esm-CA8VbUF-.cjs +5 -0
  35. package/dist/theme.css +1 -102
  36. package/dist/types/components/atoms/icon/constants/iconNames.d.ts +1 -1
  37. package/package.json +4 -4
  38. package/dist/colors-TPZkyKI4.cjs +0 -2212
  39. package/dist/deepMerge-CG1he8ZD.js +0 -20
  40. package/dist/deepMerge-Cn27K7-s.cjs +0 -19
  41. package/dist/index-B1Z0XlNV.cjs +0 -542
  42. package/dist/index-CCvWoynu.cjs +0 -12
  43. package/dist/index-CVNEow23.js +0 -543
  44. package/dist/index-Cbtrrxcv.js +0 -90
  45. package/dist/index-CiSH4Pqy.js +0 -266
  46. package/dist/index-Crz4ws0L.js +0 -1630
  47. package/dist/index-D-q_-bu0.cjs +0 -1629
  48. package/dist/index-DLUd_0LP.js +0 -13
  49. package/dist/index-DM-zAoQS.cjs +0 -89
  50. package/dist/index-DPvG_H_Y.cjs +0 -27
  51. package/dist/index-DdzyIn4u.js +0 -28
  52. package/dist/index-DsPAgC23.cjs +0 -37937
  53. package/dist/index-PyheoujP.cjs +0 -265
  54. package/dist/sortable.esm-BPjdpL-J.cjs +0 -3872
  55. package/dist/sortable.esm-C7oRJuPU.js +0 -3873
@@ -1,940 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const sortable_esm = require("./sortable.esm-BPjdpL-J.cjs");
5
- const index = require("./index-PyheoujP.cjs");
6
- const index$1 = require("./index-DsPAgC23.cjs");
7
- const colors = require("./colors-TPZkyKI4.cjs");
8
- const antd = require("antd");
9
- const tailwindMerge = require("tailwind-merge");
10
- const reactI18next = require("react-i18next");
11
- const index$2 = require("./index-B1Z0XlNV.cjs");
12
- const React = require("react");
13
- const starkString = require("starkstring");
14
- const deepMerge = require("./deepMerge-Cn27K7-s.cjs");
15
- const reactRouterDom = require("react-router-dom");
16
- function useLocalStorageState(key, initialValue) {
17
- const initialStoredValue = localStorage.getItem(key);
18
- const initial = initialStoredValue ? JSON.parse(initialStoredValue) : initialValue;
19
- const [state, setState] = React.useState(initial);
20
- React.useEffect(() => {
21
- localStorage.setItem(key, JSON.stringify(state));
22
- }, [key, state]);
23
- return [state, setState];
24
- }
25
- const SMALL_SCREEN = 640;
26
- const MEDIUM_SCREEN = 768;
27
- const LARGE_SCREEN = 1024;
28
- const EXTRA_LARGE_SCREEN = 1280;
29
- function useObserveWindow() {
30
- const { width } = index.useWindowDimensions();
31
- const getIsWidthSmallerThan = React.useCallback(
32
- (query) => {
33
- if (typeof window === "undefined") return;
34
- return width <= query;
35
- },
36
- [width]
37
- );
38
- const getIsWidthLargerThan = React.useCallback(
39
- (query) => {
40
- if (typeof window === "undefined") return;
41
- return width > query;
42
- },
43
- [width]
44
- );
45
- const getIsWidthBetween = React.useCallback(
46
- (queries) => {
47
- if (queries[0] >= queries[1]) {
48
- throw new Error(
49
- `The second query: ${queries[1]}px must be greater than the first query: ${queries[0]}px`
50
- );
51
- }
52
- if (typeof window === "undefined") return;
53
- return width > queries[0] && width <= queries[1];
54
- },
55
- [width]
56
- );
57
- const isSmallerThenLarge = getIsWidthSmallerThan(LARGE_SCREEN);
58
- const isSmallerThanSmall = getIsWidthSmallerThan(SMALL_SCREEN);
59
- const isSmallerThanMedium = getIsWidthSmallerThan(MEDIUM_SCREEN);
60
- const isSmallerThanExtraLarge = getIsWidthLargerThan(EXTRA_LARGE_SCREEN);
61
- return {
62
- getIsWidthSmallerThan,
63
- getIsWidthLargerThan,
64
- getIsWidthBetween,
65
- isSmallerThanExtraLarge,
66
- isSmallerThanMedium,
67
- isSmallerThanSmall,
68
- isSmallerThenLarge
69
- };
70
- }
71
- const PAGINATION_SIZE = "PAGINATION_SIZE";
72
- function AvatarGroup({
73
- items = [],
74
- max = 3,
75
- avatarProps: { size } = {},
76
- onClickAvatar,
77
- hasAnimation = true,
78
- nameExtractor,
79
- renderItem,
80
- itemLogoProps,
81
- containerProps,
82
- popoverProps
83
- }) {
84
- if (items.length === 0) {
85
- return /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { children: "-" });
86
- }
87
- const getName = (item) => {
88
- return nameExtractor?.(item) ?? (item.name || "--");
89
- };
90
- return /* @__PURE__ */ jsxRuntime.jsxs(index$1.Flex, { ...containerProps, children: [
91
- items.slice(0, max).map((item, index2) => /* @__PURE__ */ jsxRuntime.jsx(
92
- index$1.Render,
93
- {
94
- when: !!renderItem,
95
- fallback: /* @__PURE__ */ jsxRuntime.jsx(
96
- sortable_esm.Logo,
97
- {
98
- style: { marginInlineStart: index2 - 12, width: size, height: size },
99
- imageSrc: item?.imageSrc,
100
- hasToolTip: true,
101
- toolTipTitle: getName(item),
102
- hasAnimation,
103
- onClick: () => onClickAvatar?.(item),
104
- ...itemLogoProps
105
- },
106
- item.id
107
- ),
108
- children: renderItem?.(item)
109
- }
110
- )),
111
- items.length > max && /* @__PURE__ */ jsxRuntime.jsx(
112
- index.Popover,
113
- {
114
- arrow: true,
115
- color: colors.colors.primary_dark_1,
116
- placement: "left",
117
- overlayInnerStyle: {
118
- backgroundColor: colors.colors.primary_dark_1,
119
- borderRadius: 4
120
- },
121
- trigger: ["hover"],
122
- content: /* @__PURE__ */ jsxRuntime.jsx(index.View, { vertical: true, children: items.slice(max).map((item) => /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { color: colors.colors.white_ff, children: getName(item) }, item.id)) }),
123
- ...popoverProps,
124
- children: /* @__PURE__ */ jsxRuntime.jsx(
125
- index$1.Flex,
126
- {
127
- align: "center",
128
- justify: "center",
129
- className: "z-50 -ms-3 h-6 w-6 rounded-full border-2 border-primary-light-3 bg-light-7",
130
- style: { width: size, height: size },
131
- ...popoverProps?.containerProps,
132
- children: `${items.length - max}+`
133
- }
134
- )
135
- }
136
- )
137
- ] });
138
- }
139
- const DrawerFooter = ({
140
- discardTitle,
141
- onDiscard,
142
- onSubmit,
143
- submitTitle,
144
- isLoading,
145
- isSubmitDisabled
146
- }) => {
147
- const { t } = reactI18next.useTranslation();
148
- return /* @__PURE__ */ jsxRuntime.jsxs(index$1.Flex, { align: "center", gap: 16, justify: "flex-end", children: [
149
- discardTitle && /* @__PURE__ */ jsxRuntime.jsx(index$2.Button.Secondary, { disabled: isLoading, onClick: onDiscard, children: discardTitle }),
150
- /* @__PURE__ */ jsxRuntime.jsx(index$2.Button.Primary, { disabled: isSubmitDisabled, isLoading, onClick: onSubmit, children: submitTitle || t("common.literal.apply") })
151
- ] });
152
- };
153
- const DrawerHeaderTitle = ({ title, closable, onClose }) => {
154
- const getTitle = () => {
155
- if (typeof title !== "string") {
156
- return title;
157
- }
158
- return /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 18, weight: "medium", color: colors.colors.primary, children: title });
159
- };
160
- return /* @__PURE__ */ jsxRuntime.jsxs(index$1.Flex, { justify: "space-between", align: "center", children: [
161
- getTitle(),
162
- closable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cursor-pointer", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Icon, { name: "Close", size: 20, color: colors.colors.primary }) })
163
- ] });
164
- };
165
- const Drawer = ({
166
- title,
167
- closable = true,
168
- transparent,
169
- submitTitle,
170
- discardTitle,
171
- onClose,
172
- onSubmit,
173
- onDiscard,
174
- classNames,
175
- styles,
176
- children,
177
- isLoading,
178
- headerHeight = 60,
179
- wrapperClassName,
180
- contentClassName,
181
- noPadding,
182
- isSubmitDisabled,
183
- footer,
184
- ...rest
185
- }) => {
186
- return /* @__PURE__ */ jsxRuntime.jsx(
187
- antd.Drawer,
188
- {
189
- onClose,
190
- styles: {
191
- ...styles,
192
- header: {
193
- minHeight: headerHeight,
194
- backgroundColor: colors.colors.light_2,
195
- borderColor: colors.colors.light_7,
196
- paddingBlock: 12,
197
- paddingInline: 24
198
- },
199
- body: {
200
- backgroundColor: transparent ? "transparent" : colors.colors.white_ff,
201
- // margin: transparent ? 0 : 24,
202
- // borderRadius: 10,
203
- padding: 0
204
- },
205
- content: {
206
- backgroundColor: colors.colors.light_2,
207
- padding: 0
208
- },
209
- footer: {
210
- minHeight: 60,
211
- paddingBlock: 12,
212
- borderColor: colors.colors.light_7,
213
- paddingInline: 24,
214
- margin: 0
215
- }
216
- },
217
- classNames: {
218
- ...classNames,
219
- body: "small-custom-scrollbar"
220
- },
221
- footer: footer || /* @__PURE__ */ jsxRuntime.jsx(
222
- DrawerFooter,
223
- {
224
- ...{ onSubmit, onDiscard, submitTitle, discardTitle, isLoading, isSubmitDisabled }
225
- }
226
- ),
227
- closable: false,
228
- title: /* @__PURE__ */ jsxRuntime.jsx(DrawerHeaderTitle, { title, closable, onClose }),
229
- ...rest,
230
- children: /* @__PURE__ */ jsxRuntime.jsx(
231
- index$1.Flex,
232
- {
233
- className: tailwindMerge.twMerge(
234
- "small-custom-scrollbar h-full flex-1 overflow-y-auto bg-light-2 p-6",
235
- wrapperClassName
236
- ),
237
- vertical: true,
238
- gap: 16,
239
- children: /* @__PURE__ */ jsxRuntime.jsx(
240
- index$1.Flex,
241
- {
242
- className: tailwindMerge.twMerge(
243
- "bg-white-ff",
244
- noPadding ? "rounded-lg" : "rounded p-6",
245
- !transparent ? "" : "bg-transparent",
246
- contentClassName
247
- ),
248
- vertical: true,
249
- children
250
- }
251
- )
252
- }
253
- )
254
- }
255
- );
256
- };
257
- const BaseModal = ({
258
- children,
259
- submitTitle,
260
- discardTitle,
261
- onSubmit,
262
- onDiscard,
263
- title,
264
- onClose,
265
- isLoadingSubmit,
266
- renderFooter,
267
- ...rest
268
- }) => {
269
- return /* @__PURE__ */ jsxRuntime.jsx(
270
- antd.ConfigProvider,
271
- {
272
- theme: {
273
- components: {
274
- Modal: {
275
- borderRadius: 4,
276
- borderRadiusOuter: 4,
277
- borderRadiusLG: 4,
278
- paddingMD: 0,
279
- paddingContentHorizontalLG: 0,
280
- margin: 0
281
- }
282
- }
283
- },
284
- children: /* @__PURE__ */ jsxRuntime.jsx(
285
- antd.Modal,
286
- {
287
- closeIcon: false,
288
- classNames: { body: "!px-6 !py-4" },
289
- footer: renderFooter !== void 0 ? renderFooter : submitTitle || discardTitle ? /* @__PURE__ */ jsxRuntime.jsxs(
290
- index$1.Flex,
291
- {
292
- justify: "end",
293
- align: "center",
294
- className: "h-[58px] rounded-b border-t border-solid border-light-7 bg-light-2 px-6",
295
- gap: 16,
296
- children: [
297
- discardTitle && /* @__PURE__ */ jsxRuntime.jsx(index$2.Button.Secondary, { onClick: onDiscard, children: discardTitle }),
298
- submitTitle && /* @__PURE__ */ jsxRuntime.jsx(index$2.Button.Primary, { isLoading: isLoadingSubmit, onClick: onSubmit, children: submitTitle })
299
- ]
300
- }
301
- ) : null,
302
- title: typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsxs(
303
- index$1.Flex,
304
- {
305
- className: "h-12 rounded-t border-b border-solid border-light-7 bg-light-2 px-6",
306
- align: "center",
307
- justify: "space-between",
308
- children: [
309
- /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 18, weight: "medium", color: colors.colors.primary_dark_1, children: title }),
310
- /* @__PURE__ */ jsxRuntime.jsx(
311
- index$1.Icon,
312
- {
313
- name: "Close",
314
- color: colors.colors.primary,
315
- onClick: onClose,
316
- className: "cursor-pointer"
317
- }
318
- )
319
- ]
320
- }
321
- ) : title,
322
- ...rest,
323
- children
324
- }
325
- )
326
- }
327
- );
328
- };
329
- const ConfirmModal = ({
330
- children,
331
- title,
332
- onSubmit,
333
- onDiscard,
334
- submitTitle,
335
- discardTitle,
336
- isLoadingSubmit,
337
- renderFooter,
338
- ...rest
339
- }) => {
340
- const footerContent = renderFooter !== void 0 ? renderFooter : (submitTitle || discardTitle) && /* @__PURE__ */ jsxRuntime.jsxs(index$1.Flex, { gap: 16, align: "center", justify: "flex-end", className: "px-6 py-4", children: [
341
- discardTitle && /* @__PURE__ */ jsxRuntime.jsx(index$2.Button.Secondary, { onClick: onDiscard, children: discardTitle }),
342
- submitTitle && /* @__PURE__ */ jsxRuntime.jsx(index$2.Button.Primary, { isLoading: isLoadingSubmit, onClick: onSubmit, children: submitTitle })
343
- ] });
344
- return /* @__PURE__ */ jsxRuntime.jsx(BaseModal, { ...rest, renderFooter: footerContent, children: /* @__PURE__ */ jsxRuntime.jsxs(index$1.Flex, { vertical: true, children: [
345
- /* @__PURE__ */ jsxRuntime.jsx(index$1.Flex, { vertical: true, className: "mb-2 border-b-[2px] border-light-7 pb-3", children: typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 20, weight: "bold", color: colors.colors.primary_dark_1, children: title }) : title }),
346
- /* @__PURE__ */ jsxRuntime.jsx(index$1.Flex, { className: "pb-10 pt-4", children: typeof children === "string" ? /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 16, weight: "normal", color: colors.colors.primary, children }) : children })
347
- ] }) });
348
- };
349
- const DeleteModal = ({
350
- children,
351
- title,
352
- onSubmit,
353
- onDiscard,
354
- submitTitle,
355
- discardTitle,
356
- isLoadingSubmit,
357
- ...rest
358
- }) => {
359
- return /* @__PURE__ */ jsxRuntime.jsx(BaseModal, { ...rest, children: /* @__PURE__ */ jsxRuntime.jsxs(index$1.Flex, { vertical: true, children: [
360
- /* @__PURE__ */ jsxRuntime.jsx(index$1.Flex, { vertical: true, className: "border-b-[2px] border-light-7 pb-3", children: typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 20, weight: "bold", color: colors.colors.primary_dark_1, children: title }) : title }),
361
- /* @__PURE__ */ jsxRuntime.jsx(index$1.Flex, { className: "pb-10 pt-4", children: typeof children === "string" ? /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 16, weight: "normal", color: colors.colors.primary, children }) : children }),
362
- /* @__PURE__ */ jsxRuntime.jsxs(index$1.Flex, { gap: 16, align: "center", justify: "flex-end", children: [
363
- /* @__PURE__ */ jsxRuntime.jsx(index$2.Button.Secondary, { onClick: onDiscard, children: discardTitle }),
364
- /* @__PURE__ */ jsxRuntime.jsx(index$2.Button.Negative, { iconName: "Delete", isLoading: isLoadingSubmit, onClick: onSubmit, children: submitTitle })
365
- ] })
366
- ] }) });
367
- };
368
- const ErrorModal = ({
369
- children,
370
- title,
371
- onSubmit,
372
- submitTitle,
373
- isLoadingSubmit,
374
- ...rest
375
- }) => {
376
- return /* @__PURE__ */ jsxRuntime.jsx(BaseModal, { ...rest, children: /* @__PURE__ */ jsxRuntime.jsxs(index$1.Flex, { vertical: true, children: [
377
- /* @__PURE__ */ jsxRuntime.jsxs(index$1.Flex, { className: "border-b-[2px] border-light-7 pb-3", align: "center", justify: "space-between", children: [
378
- typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 20, weight: "bold", color: colors.colors.primary_dark_1, children: title }) : title,
379
- /* @__PURE__ */ jsxRuntime.jsx(index$1.Icon, { name: "Alert", color: colors.colors.negative, size: 18 })
380
- ] }),
381
- /* @__PURE__ */ jsxRuntime.jsx(index$1.Flex, { className: "pb-10 pt-4", children: typeof children === "string" ? /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 16, weight: "normal", color: colors.colors.primary, children }) : children }),
382
- /* @__PURE__ */ jsxRuntime.jsx(index$1.Flex, { justify: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(index$2.Button.Primary, { isLoading: isLoadingSubmit, onClick: onSubmit, children: submitTitle }) })
383
- ] }) });
384
- };
385
- const InfoModal = ({
386
- children,
387
- title,
388
- onSubmit,
389
- onDiscard,
390
- submitTitle,
391
- discardTitle,
392
- isLoadingSubmit,
393
- error,
394
- ...rest
395
- }) => {
396
- return /* @__PURE__ */ jsxRuntime.jsx(BaseModal, { ...rest, children: /* @__PURE__ */ jsxRuntime.jsxs(index$1.Flex, { vertical: true, children: [
397
- /* @__PURE__ */ jsxRuntime.jsx(index$1.Flex, { vertical: true, className: "border-b-[2px] border-light-7 pb-3", children: typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 20, weight: "bold", color: colors.colors.primary_dark_1, children: title }) : title }),
398
- /* @__PURE__ */ jsxRuntime.jsx(index$1.Flex, { className: "pb-10 pt-4", children: typeof children === "string" ? /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 16, weight: "normal", color: colors.colors.primary, children }) : children }),
399
- /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 20, weight: "bold", color: colors.colors.negative, children: error }),
400
- /* @__PURE__ */ jsxRuntime.jsxs(index$1.Flex, { gap: 16, align: "center", justify: "flex-end", children: [
401
- /* @__PURE__ */ jsxRuntime.jsx(index$2.Button.SecondaryQuiet, { onClick: onDiscard, children: discardTitle }),
402
- /* @__PURE__ */ jsxRuntime.jsx(index$2.Button.Primary, { isLoading: isLoadingSubmit, onClick: onSubmit, children: submitTitle })
403
- ] })
404
- ] }) });
405
- };
406
- const Modal = index$2.batch({
407
- Base: BaseModal,
408
- Confirm: ConfirmModal,
409
- Error: ErrorModal,
410
- Delete: DeleteModal,
411
- Info: InfoModal
412
- });
413
- const Column = (_props) => {
414
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
415
- };
416
- const CurrencyCell = ({ value, includeCurrency, ...rest }) => {
417
- const { t } = reactI18next.useTranslation();
418
- return /* @__PURE__ */ jsxRuntime.jsxs(index$1.Text, { className: "w-full", size: 14, weight: "normal", color: colors.colors.primary, ...rest, children: [
419
- value ? starkString(value).scientificNotationToDecimal().toCurrency().toString() : "",
420
- includeCurrency && ` ${t("common.literal.rial")}`
421
- ] });
422
- };
423
- const DateCell = ({ value, ...rest }) => {
424
- return /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { className: "w-full", size: 14, weight: "normal", color: colors.colors.primary, ...rest, children: value });
425
- };
426
- const StatusCell = ({ value, activeTitle, disableTitle, ...rest }) => {
427
- const { t } = reactI18next.useTranslation();
428
- return /* @__PURE__ */ jsxRuntime.jsx(
429
- index$1.Flex,
430
- {
431
- className: tailwindMerge.twMerge(
432
- "h-[26px] items-center justify-center rounded px-4",
433
- value ? "bg-positive-light-2 bg-opacity-10" : "bg-light-6"
434
- ),
435
- ...rest,
436
- children: value ? /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 12, weight: "medium", color: colors.colors.positive, children: activeTitle || t("common.literal.active") }) : /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 12, weight: "medium", color: colors.colors.primary_light_2, children: disableTitle || t("common.literal.disable") })
437
- }
438
- );
439
- };
440
- const TableCell = ({ children }) => {
441
- if (typeof children === "string" || typeof children === "number") {
442
- return /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { className: "w-full", size: 14, weight: "normal", color: colors.colors.primary, children });
443
- }
444
- return children;
445
- };
446
- TableCell.Currency = CurrencyCell;
447
- TableCell.Date = DateCell;
448
- TableCell.StatusCell = StatusCell;
449
- const ExpandIcon = ({ expandable, expanded, onExpand }) => {
450
- const { i18n } = reactI18next.useTranslation();
451
- if (!expandable) {
452
- return null;
453
- }
454
- return /* @__PURE__ */ jsxRuntime.jsx("button", { className: "float-start h-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
455
- index$1.Icon,
456
- {
457
- onClick: onExpand,
458
- name: expanded ? "Chevron_Down" : i18n.language === "fa" ? "Chevron_Left" : "Chevron_Right"
459
- }
460
- ) });
461
- };
462
- const TableHeaderTitle = ({ title, align, style, className }) => {
463
- if (typeof title !== "string") {
464
- return title;
465
- }
466
- return /* @__PURE__ */ jsxRuntime.jsx(
467
- index$1.Flex,
468
- {
469
- style,
470
- className: tailwindMerge.twMerge(
471
- "w-full",
472
- align === "start" && "justify-start",
473
- align === "center" && "justify-center",
474
- align === "end" && "justify-end",
475
- className
476
- ),
477
- children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 14, weight: "normal", className: "whitespace-nowrap", color: colors.colors.primary, children: title })
478
- }
479
- );
480
- };
481
- const CustomizedAntTableConfig = (theme) => deepMerge.deepMerge(
482
- {
483
- components: {
484
- Table: {
485
- borderColor: colors.colors.light_7,
486
- cellPaddingBlock: 0,
487
- cellPaddingBlockMD: 0,
488
- cellPaddingBlockSM: 0,
489
- cellPaddingInline: 8,
490
- cellPaddingInlineMD: 8,
491
- cellPaddingInlineSM: 8,
492
- fixedHeaderSortActiveBg: "transparent",
493
- footerBg: colors.colors.light_2,
494
- headerBg: colors.colors.light_2,
495
- headerBorderRadius: 0,
496
- headerColor: colors.colors.primary,
497
- bodySortBg: colors.colors.white_ff,
498
- headerSortHoverBg: colors.colors.light_1,
499
- headerSortActiveBg: colors.colors.light_1,
500
- headerSplitColor: "transparent",
501
- rowExpandedBg: colors.colors.light_3,
502
- rowHoverBg: colors.colors.light_4,
503
- rowSelectedBg: colors.colors.light_7,
504
- rowSelectedHoverBg: colors.colors.light_7,
505
- selectionColumnWidth: 56
506
- /* here is your component tokens */
507
- },
508
- Pagination: {
509
- itemActiveBg: colors.colors.white_ff,
510
- itemActiveBgDisabled: colors.colors.negative,
511
- itemActiveColorDisabled: colors.colors.negative,
512
- colorPrimaryBorderHover: "red",
513
- colorInfoBorderHover: "yellow",
514
- colorWarningBorderHover: "green",
515
- itemBg: colors.colors.white_ff,
516
- itemInputBg: colors.colors.negative,
517
- itemLinkBg: colors.colors.negative,
518
- itemSize: 30,
519
- itemSizeSM: 30,
520
- miniOptionsSizeChangerTop: 40,
521
- colorPrimary: colors.colors.primary,
522
- fontFamily: "YekanBakhFaRegular"
523
- }
524
- }
525
- },
526
- theme ?? {}
527
- );
528
- const tailwindTableClasses = tailwindMerge.twMerge(
529
- "[&_th]:!border-t h-full [&_.ant-spin-nested-loading]:h-full [&_.ant-spin-container]:h-full [&_.ant-table]:h-full [&_.ant-spin-container]:flex [&_.ant-spin-container]:flex-col [&_.ant-spin-container]:justify-between [&_.ant-table-column-title]:flex-[0] [&_th]:!border-t-light-7 [&_th]:!pt-4 [&_th]:!pb-1 [&_.ant-table-selection-column]:!ps-4 [&_.ant-table-wrapper]:!p-0 [&_.ant-table-measure-row]:!h-[1px] [&_.ant-table-body]:h-full [&_.ant-table-container]:h-full"
530
- );
531
- const tableTransparentHeaderClasses = tailwindMerge.twMerge(
532
- "[&_th]:!bg-transparent h-full [&_th]:!border-t-0 [&_td]:!bg-transparent "
533
- );
534
- const rowHeightClassName = {
535
- small: "h-[40px] max-h-[40px] min-h-[40px]",
536
- middle: "h-[48px] max-h-[48px] min-h-[48px]",
537
- large: "h-[56px] max-h-[56px] min-h-[56px]"
538
- };
539
- const RowContext = React.createContext({});
540
- const DragHandle = () => {
541
- const { setActivatorNodeRef, listeners } = React.useContext(RowContext);
542
- return /* @__PURE__ */ jsxRuntime.jsx("button", { style: { cursor: "move" }, ref: setActivatorNodeRef, ...listeners, children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Icon, { name: "drag_and_drop", color: colors.colors.primary_light_2 }) });
543
- };
544
- const restrictToVerticalAxis = (_ref) => {
545
- let {
546
- transform
547
- } = _ref;
548
- return {
549
- ...transform,
550
- x: 0
551
- };
552
- };
553
- const DndSortProvider = ({
554
- children,
555
- onDragEnd,
556
- dataSource = [],
557
- rowKey
558
- }) => {
559
- const items = React.useMemo(
560
- () => dataSource.map((item) => item[rowKey]),
561
- [dataSource, rowKey]
562
- );
563
- const handleDragEnd = React.useCallback(
564
- ({ active, over }) => {
565
- if (active.id !== over?.id) {
566
- const activeIndex = dataSource.findIndex((record) => record[rowKey] === active?.id);
567
- const overIndex = dataSource.findIndex((record) => record[rowKey] === over?.id);
568
- const newSort = sortable_esm.arrayMove(dataSource, activeIndex, overIndex);
569
- onDragEnd(newSort);
570
- }
571
- },
572
- [dataSource, rowKey, onDragEnd]
573
- );
574
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable_esm.DndContext, { modifiers: [restrictToVerticalAxis], onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsxRuntime.jsx(sortable_esm.SortableContext, { items, strategy: sortable_esm.verticalListSortingStrategy, children }) }) });
575
- };
576
- const DndRow = (props) => {
577
- const {
578
- attributes,
579
- listeners,
580
- setNodeRef,
581
- setActivatorNodeRef,
582
- transform,
583
- transition,
584
- isDragging
585
- } = sortable_esm.useSortable({ id: props["data-row-key"] });
586
- const style = {
587
- ...props.style,
588
- transform: sortable_esm.CSS.Translate.toString(transform),
589
- transition,
590
- cursor: "default",
591
- ...isDragging ? { position: "relative", zIndex: 10 } : {}
592
- };
593
- const contextValue = React.useMemo(
594
- () => ({ setActivatorNodeRef, listeners }),
595
- [setActivatorNodeRef, listeners]
596
- );
597
- return /* @__PURE__ */ jsxRuntime.jsx(RowContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx("tr", { ...props, ref: setNodeRef, style, ...attributes }) });
598
- };
599
- const ItemRender = ({ page, type, current, isFa }) => {
600
- const isCurrentPage = Number(page) === current;
601
- return /* @__PURE__ */ jsxRuntime.jsx(index$1.Flex, { className: "h-[30px] items-center justify-center", children: type === "page" ? /* @__PURE__ */ jsxRuntime.jsx(
602
- index$1.Text,
603
- {
604
- weight: isCurrentPage ? "bold" : "normal",
605
- size: isCurrentPage ? 20 : 18,
606
- color: isCurrentPage ? colors.colors.primary : colors.colors.primary_dark_1,
607
- children: page
608
- }
609
- ) : type === "next" ? /* @__PURE__ */ jsxRuntime.jsx(index$1.Flex, { className: "me-4 h-[30px] w-[30px] items-center justify-center rounded border border-light-7", children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Icon, { name: isFa ? "Chevron_Right" : "Chevron_Left", color: colors.colors.primary }) }) : type === "prev" ? /* @__PURE__ */ jsxRuntime.jsx(index$1.Flex, { className: "h-[30px] w-[30px] items-center justify-center rounded border border-light-7", children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Icon, { name: isFa ? "Chevron_Left" : "Chevron_Right", color: colors.colors.primary }) }) : /* @__PURE__ */ jsxRuntime.jsx(index$1.Text, { size: 18, children: "..." }) });
610
- };
611
- const CHANGE_ORDER = "CHANGE_ORDER";
612
- const CHANGE_PAGE = "CHANGE_PAGE";
613
- const CHANGE = "CHANGE";
614
- const PAGE_SEARCH_PARAM = "page";
615
- const initialState = {
616
- order: void 0,
617
- orderBy: "",
618
- pageSize: 10,
619
- current: 1,
620
- filters: {}
621
- };
622
- function reducer(state, action) {
623
- switch (action.type) {
624
- case CHANGE_ORDER:
625
- return {
626
- ...state,
627
- orderBy: action.payload.orderBy,
628
- order: action.payload.order
629
- };
630
- case CHANGE_PAGE:
631
- return {
632
- ...state,
633
- current: action.payload.current,
634
- pageSize: action.payload.pageSize === void 0 ? state.pageSize : action.payload.pageSize
635
- };
636
- case CHANGE:
637
- return {
638
- ...state,
639
- current: action.payload.current,
640
- pageSize: action.payload.pageSize ?? state.pageSize,
641
- order: action.payload.order,
642
- orderBy: action.payload.orderBy,
643
- filters: action.payload.filters
644
- };
645
- default:
646
- return state;
647
- }
648
- }
649
- function usePagination({
650
- defaultCurrent = 1,
651
- defaultPageSize = 10,
652
- hasQueryParams = false,
653
- hideOnSinglePage,
654
- style,
655
- ...rest
656
- }) {
657
- const { isSmallerThanMedium } = useObserveWindow();
658
- const navigate = reactRouterDom.useNavigate();
659
- const [searchParams] = reactRouterDom.useSearchParams();
660
- const [localPageSize, setLocalPageSize] = useLocalStorageState(
661
- PAGINATION_SIZE,
662
- defaultPageSize
663
- );
664
- const [total, setTotal] = React.useState(0);
665
- const { i18n } = reactI18next.useTranslation();
666
- const [{ current, order, orderBy, pageSize, filters }, dispatch] = React.useReducer(
667
- reducer,
668
- {
669
- ...initialState,
670
- pageSize: localPageSize,
671
- current: hasQueryParams ? Number(searchParams.get(PAGE_SEARCH_PARAM) || String(defaultCurrent)) : defaultCurrent
672
- }
673
- );
674
- localStorage.removeItem(PAGINATION_SIZE);
675
- const onChange = React.useCallback(
676
- (pagination2, filters2, sorter) => {
677
- const sort = Array.isArray(sorter) ? sorter[0] : sorter;
678
- setLocalPageSize(pagination2.pageSize || defaultPageSize);
679
- dispatch({
680
- type: CHANGE,
681
- payload: {
682
- filters: filters2,
683
- current: pagination2.current,
684
- pageSize: pagination2.pageSize,
685
- orderBy: Array.isArray(sort?.field) ? sort?.field[0] : sort?.field,
686
- order: sort?.order
687
- }
688
- });
689
- },
690
- [defaultPageSize, setLocalPageSize]
691
- );
692
- const handleInternalPagination = (page, pageSize2) => {
693
- dispatch({ type: CHANGE_PAGE, payload: { current: page, pageSize: pageSize2 } });
694
- };
695
- const getTotal = (total2) => setTotal(total2 || defaultPageSize);
696
- React.useEffect(() => {
697
- if (hasQueryParams) {
698
- navigate({ search: `?${PAGE_SEARCH_PARAM}=${current}` }, { replace: true });
699
- }
700
- }, [current, hasQueryParams]);
701
- const pagination = {
702
- total,
703
- current,
704
- pageSize,
705
- defaultCurrent,
706
- defaultPageSize,
707
- onChange: handleInternalPagination,
708
- pageSizeOptions: ["10", "20", "30"],
709
- showSizeChanger: true,
710
- hideOnSinglePage,
711
- className: "border border-negative",
712
- style: {
713
- backgroundColor: colors.colors.white_ff,
714
- paddingInline: isSmallerThanMedium ? 4 : 24,
715
- paddingBlock: 16,
716
- margin: 0,
717
- borderTop: `1px solid ${colors.colors.light_7}`,
718
- flexDirection: "row-reverse",
719
- justifyContent: "flex-start",
720
- border: "none",
721
- ...style
722
- },
723
- showPrevNextJumpers: true,
724
- showQuickJumper: true,
725
- rootClassName: "flex items-center [&_.ant-select-dropdown]:!p-0 [&_.ant-pagination-options]:flex [&_.ant-pagination-options]:items-center [&_.ant-pagination-options]:justify-between [&_.ant-pagination-options]:flex-1",
726
- // selectComponentClass: () => SelectComponentClass({ filters, onChange, pageSize, pagination }),
727
- itemRender: (page, type) => ItemRender({ current, page, type, isFa: i18n.language === "fa" }),
728
- ...rest
729
- };
730
- return {
731
- filters,
732
- current,
733
- pageSize,
734
- pagination,
735
- order,
736
- orderBy,
737
- onChange,
738
- getTotal
739
- };
740
- }
741
- const Table = ({
742
- className,
743
- children,
744
- expandable,
745
- rowSelection,
746
- size,
747
- pagination,
748
- loading,
749
- transparentHeader,
750
- internalScroll = true,
751
- extraHeight = 100,
752
- footer,
753
- theme,
754
- dndSort,
755
- components,
756
- ...rest
757
- }) => {
758
- const [scrollY, setScrollY] = React.useState();
759
- const ref = React.useRef(null);
760
- React.useEffect(() => {
761
- if (!ref.current) {
762
- return;
763
- }
764
- setScrollY(
765
- window.innerHeight - ref.current.offsetTop - 46 - (pagination ? 65 : 0) - extraHeight
766
- );
767
- }, [pagination, theme?.components?.Table?.headerBg]);
768
- const columns = React.useMemo(() => {
769
- function getChildren(_children) {
770
- if (!_children) {
771
- return [];
772
- }
773
- if (typeof _children === "boolean" || typeof _children === "undefined" || _children === null) {
774
- return [];
775
- }
776
- if (typeof _children !== "object") {
777
- throw new Error("Table children must be Column");
778
- }
779
- if (!Array.isArray(_children)) {
780
- if (_children.type === Column) {
781
- const result = {
782
- ..._children.props,
783
- child: _children
784
- };
785
- return [result];
786
- }
787
- if (_children.type === React.Fragment) {
788
- return getChildren(_children.props?.children);
789
- }
790
- }
791
- return (_children || [])?.flatMap((child) => {
792
- return getChildren(child);
793
- });
794
- }
795
- const mappedChildren = getChildren(children);
796
- return mappedChildren;
797
- }, [children]);
798
- const Provider = ({ children: children2 }) => dndSort === void 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children2 }) : /* @__PURE__ */ jsxRuntime.jsx(
799
- DndSortProvider,
800
- {
801
- children: children2,
802
- onDragEnd: dndSort.onDragEnd,
803
- dataSource: rest.dataSource,
804
- rowKey: rest.rowKey
805
- }
806
- );
807
- return /* @__PURE__ */ jsxRuntime.jsx(antd.ConfigProvider, { theme: CustomizedAntTableConfig(theme), children: /* @__PURE__ */ jsxRuntime.jsx(Provider, { children: /* @__PURE__ */ jsxRuntime.jsxs(
808
- antd.Table,
809
- {
810
- ref,
811
- loading: {
812
- indicator: /* @__PURE__ */ jsxRuntime.jsx(index$1.Flex, { className: "items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(index$1.Loading, { isLoading: true, size: 32, thickness: 3 }) }),
813
- spinning: !!loading
814
- },
815
- scroll: internalScroll ? { y: scrollY } : void 0,
816
- className: tailwindMerge.twMerge(
817
- tailwindTableClasses,
818
- "abrplus-table-custom-scroll-bar w-full !animate-none [&_.ant-table-thead_th]:!pt-2",
819
- !!expandable && !!rowSelection && "[&_.ant-table-selection-column]:!ps-0",
820
- transparentHeader && tableTransparentHeaderClasses,
821
- className
822
- ),
823
- rowSelection,
824
- expandable: expandable ? {
825
- ...expandable,
826
- expandedRowClassName: () => "[&_.ant-table-cell]:!p-0 [&_.ant-table-row-expand-icon-cell]:!p-0 ",
827
- expandIcon: ({ expandable: expandable2, expanded, onExpand, record }) => /* @__PURE__ */ jsxRuntime.jsx(
828
- ExpandIcon,
829
- {
830
- ...{ expandable: expandable2, expanded },
831
- onExpand: (e) => onExpand?.(record, e)
832
- }
833
- )
834
- } : void 0,
835
- pagination,
836
- footer,
837
- components: dndSort ? { body: { row: DndRow } } : components,
838
- ...rest,
839
- children: [
840
- dndSort && /* @__PURE__ */ jsxRuntime.jsx(Table.Column, { align: "center", width: 80, render: () => /* @__PURE__ */ jsxRuntime.jsx(DragHandle, {}) }, "sort"),
841
- columns.map(
842
- ({
843
- render,
844
- children: children2,
845
- dataIndex,
846
- align,
847
- headerStyle,
848
- headerClassName,
849
- className: className2,
850
- filtersOptions,
851
- sortIconOptions,
852
- ...rest2
853
- }, colIndex) => /* @__PURE__ */ jsxRuntime.jsx(
854
- antd.Table.Column,
855
- {
856
- ...rest2,
857
- dataIndex: dataIndex?.toString(),
858
- className: tailwindMerge.twMerge("h-[56px] [&_.ant-table-column-title]:!flex-1", className2),
859
- title: /* @__PURE__ */ jsxRuntime.jsxs(
860
- index$1.Flex,
861
- {
862
- className: "ant-table-column-title-content items-center justify-between",
863
- flex: 1,
864
- children: [
865
- /* @__PURE__ */ jsxRuntime.jsx(
866
- TableHeaderTitle,
867
- {
868
- title: children2,
869
- align,
870
- style: headerStyle,
871
- className: headerClassName
872
- }
873
- ),
874
- filtersOptions?.renderFilter?.()
875
- ]
876
- }
877
- ),
878
- render: (value, row, index2) => /* @__PURE__ */ jsxRuntime.jsx(
879
- index$1.Flex,
880
- {
881
- className: tailwindMerge.twMerge("items-center", rowHeightClassName[size || "large"]),
882
- style: {
883
- wordWrap: "break-word",
884
- wordBreak: "break-word",
885
- paddingInlineEnd: colIndex === columns.length - 1 ? 24 : void 0
886
- },
887
- children: render ? render({ index: index2, row, value }) : /* @__PURE__ */ jsxRuntime.jsx(TableCell, { children: value })
888
- }
889
- ),
890
- showSorterTooltip: false,
891
- sortIcon: ({ sortOrder }) => {
892
- return /* @__PURE__ */ jsxRuntime.jsxs(
893
- index$1.Flex,
894
- {
895
- vertical: true,
896
- ...sortIconOptions,
897
- className: tailwindMerge.twMerge(
898
- "table-filters-sort flex-[4] ps-2",
899
- sortIconOptions?.className
900
- ),
901
- children: [
902
- /* @__PURE__ */ jsxRuntime.jsx(
903
- index$1.Icon,
904
- {
905
- size: 12,
906
- color: sortOrder === "ascend" ? colors.colors.primary : colors.colors.primary_light_3,
907
- name: "Chevron_Up",
908
- style: { marginBottom: -4 }
909
- }
910
- ),
911
- /* @__PURE__ */ jsxRuntime.jsx(
912
- index$1.Icon,
913
- {
914
- size: 12,
915
- color: sortOrder === "descend" ? colors.colors.primary : colors.colors.primary_light_3,
916
- name: "Chevron_Down"
917
- }
918
- )
919
- ]
920
- }
921
- );
922
- }
923
- },
924
- colIndex
925
- )
926
- )
927
- ]
928
- }
929
- ) }) });
930
- };
931
- Table.Cell = TableCell;
932
- Table.Column = Column;
933
- Table.Currency = TableCell.Currency;
934
- Table.Date = TableCell.Date;
935
- Table.Status = TableCell.StatusCell;
936
- Table.usePagination = usePagination;
937
- exports.AvatarGroup = AvatarGroup;
938
- exports.Drawer = Drawer;
939
- exports.Modal = Modal;
940
- exports.Table = Table;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),B=require("./sortable.esm-CA8VbUF-.cjs"),G=require("./index-lDQ4dr86.cjs"),o=require("./index-B1HRk2-g.cjs"),l=require("./colors-BDQwGpaB.cjs"),E=require("antd"),C=require("tailwind-merge"),P=require("react-i18next"),y=require("./index-BJmt8SSx.cjs"),x=require("react"),ee=require("starkstring"),re=require("./deepMerge-2zqLIrFM.cjs"),$=require("react-router-dom");function te(r,t){const n=localStorage.getItem(r),s=n?JSON.parse(n):t,[a,i]=x.useState(s);return x.useEffect(()=>{localStorage.setItem(r,JSON.stringify(a))},[r,a]),[a,i]}const oe=640,ne=768,le=1024,se=1280;function ae(){const{width:r}=G.useWindowDimensions(),t=x.useCallback(c=>{if(!(typeof window>"u"))return r<=c},[r]),n=x.useCallback(c=>{if(!(typeof window>"u"))return r>c},[r]),s=x.useCallback(c=>{if(c[0]>=c[1])throw new Error(`The second query: ${c[1]}px must be greater than the first query: ${c[0]}px`);if(!(typeof window>"u"))return r>c[0]&&r<=c[1]},[r]),a=t(le),i=t(oe),d=t(ne),g=n(se);return{getIsWidthSmallerThan:t,getIsWidthLargerThan:n,getIsWidthBetween:s,isSmallerThanExtraLarge:g,isSmallerThanMedium:d,isSmallerThanSmall:i,isSmallerThenLarge:a}}const W="PAGINATION_SIZE";function ie({items:r=[],max:t=3,avatarProps:{size:n}={},onClickAvatar:s,hasAnimation:a=!0,nameExtractor:i,renderItem:d,itemLogoProps:g,containerProps:c,popoverProps:h}){if(r.length===0)return e.jsx(o.Text,{children:"-"});const b=u=>i?.(u)??(u.name||"--");return e.jsxs(o.Flex,{...c,children:[r.slice(0,t).map((u,w)=>e.jsx(o.Render,{when:!!d,fallback:e.jsx(B.Logo,{style:{marginInlineStart:w-12,width:n,height:n},imageSrc:u?.imageSrc,hasToolTip:!0,toolTipTitle:b(u),hasAnimation:a,onClick:()=>s?.(u),...g},u.id),children:d?.(u)})),r.length>t&&e.jsx(G.Popover,{arrow:!0,color:l.colors.primary_dark_1,placement:"left",overlayInnerStyle:{backgroundColor:l.colors.primary_dark_1,borderRadius:4},trigger:["hover"],content:e.jsx(G.View,{vertical:!0,children:r.slice(t).map(u=>e.jsx(o.Text,{color:l.colors.white_ff,children:b(u)},u.id))}),...h,children:e.jsx(o.Flex,{align:"center",justify:"center",className:"z-50 -ms-3 h-6 w-6 rounded-full border-2 border-primary-light-3 bg-light-7",style:{width:n,height:n},...h?.containerProps,children:`${r.length-t}+`})})]})}const ce=({discardTitle:r,onDiscard:t,onSubmit:n,submitTitle:s,isLoading:a,isSubmitDisabled:i})=>{const{t:d}=P.useTranslation();return e.jsxs(o.Flex,{align:"center",gap:16,justify:"flex-end",children:[r&&e.jsx(y.Button.Secondary,{disabled:a,onClick:t,children:r}),e.jsx(y.Button.Primary,{disabled:i,isLoading:a,onClick:n,children:s||d("common.literal.apply")})]})},de=({title:r,closable:t,onClose:n})=>{const s=()=>typeof r!="string"?r:e.jsx(o.Text,{size:18,weight:"medium",color:l.colors.primary,children:r});return e.jsxs(o.Flex,{justify:"space-between",align:"center",children:[s(),t&&e.jsx("div",{className:"cursor-pointer",onClick:n,children:e.jsx(o.Icon,{name:"Close",size:20,color:l.colors.primary})})]})},ge=({title:r,closable:t=!0,transparent:n,submitTitle:s,discardTitle:a,onClose:i,onSubmit:d,onDiscard:g,classNames:c,styles:h,children:b,isLoading:u,headerHeight:w=60,wrapperClassName:F,contentClassName:j,noPadding:M,isSubmitDisabled:A,footer:_,...k})=>e.jsx(E.Drawer,{onClose:i,styles:{...h,header:{minHeight:w,backgroundColor:l.colors.light_2,borderColor:l.colors.light_7,paddingBlock:12,paddingInline:24},body:{backgroundColor:n?"transparent":l.colors.white_ff,padding:0},content:{backgroundColor:l.colors.light_2,padding:0},footer:{minHeight:60,paddingBlock:12,borderColor:l.colors.light_7,paddingInline:24,margin:0}},classNames:{...c,body:"small-custom-scrollbar"},footer:_||e.jsx(ce,{onSubmit:d,onDiscard:g,submitTitle:s,discardTitle:a,isLoading:u,isSubmitDisabled:A}),closable:!1,title:e.jsx(de,{title:r,closable:t,onClose:i}),...k,children:e.jsx(o.Flex,{className:C.twMerge("small-custom-scrollbar h-full flex-1 overflow-y-auto bg-light-2 p-6",F),vertical:!0,gap:16,children:e.jsx(o.Flex,{className:C.twMerge("bg-white-ff",M?"rounded-lg":"rounded p-6",n?"bg-transparent":"",j),vertical:!0,children:b})})}),H=({children:r,submitTitle:t,discardTitle:n,onSubmit:s,onDiscard:a,title:i,onClose:d,isLoadingSubmit:g,renderFooter:c,...h})=>e.jsx(E.ConfigProvider,{theme:{components:{Modal:{borderRadius:4,borderRadiusOuter:4,borderRadiusLG:4,paddingMD:0,paddingContentHorizontalLG:0,margin:0}}},children:e.jsx(E.Modal,{closeIcon:!1,classNames:{body:"!px-6 !py-4"},footer:c!==void 0?c:t||n?e.jsxs(o.Flex,{justify:"end",align:"center",className:"h-[58px] rounded-b border-t border-solid border-light-7 bg-light-2 px-6",gap:16,children:[n&&e.jsx(y.Button.Secondary,{onClick:a,children:n}),t&&e.jsx(y.Button.Primary,{isLoading:g,onClick:s,children:t})]}):null,title:typeof i=="string"?e.jsxs(o.Flex,{className:"h-12 rounded-t border-b border-solid border-light-7 bg-light-2 px-6",align:"center",justify:"space-between",children:[e.jsx(o.Text,{size:18,weight:"medium",color:l.colors.primary_dark_1,children:i}),e.jsx(o.Icon,{name:"Close",color:l.colors.primary,onClick:d,className:"cursor-pointer"})]}):i,...h,children:r})}),ue=({children:r,title:t,onSubmit:n,onDiscard:s,submitTitle:a,discardTitle:i,isLoadingSubmit:d,renderFooter:g,...c})=>{const h=g!==void 0?g:(a||i)&&e.jsxs(o.Flex,{gap:16,align:"center",justify:"flex-end",className:"px-6 py-4",children:[i&&e.jsx(y.Button.Secondary,{onClick:s,children:i}),a&&e.jsx(y.Button.Primary,{isLoading:d,onClick:n,children:a})]});return e.jsx(H,{...c,renderFooter:h,children:e.jsxs(o.Flex,{vertical:!0,children:[e.jsx(o.Flex,{vertical:!0,className:"mb-2 border-b-[2px] border-light-7 pb-3",children:typeof t=="string"?e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.primary_dark_1,children:t}):t}),e.jsx(o.Flex,{className:"pb-10 pt-4",children:typeof r=="string"?e.jsx(o.Text,{size:16,weight:"normal",color:l.colors.primary,children:r}):r})]})})},xe=({children:r,title:t,onSubmit:n,onDiscard:s,submitTitle:a,discardTitle:i,isLoadingSubmit:d,...g})=>e.jsx(H,{...g,children:e.jsxs(o.Flex,{vertical:!0,children:[e.jsx(o.Flex,{vertical:!0,className:"border-b-[2px] border-light-7 pb-3",children:typeof t=="string"?e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.primary_dark_1,children:t}):t}),e.jsx(o.Flex,{className:"pb-10 pt-4",children:typeof r=="string"?e.jsx(o.Text,{size:16,weight:"normal",color:l.colors.primary,children:r}):r}),e.jsxs(o.Flex,{gap:16,align:"center",justify:"flex-end",children:[e.jsx(y.Button.Secondary,{onClick:s,children:i}),e.jsx(y.Button.Negative,{iconName:"Delete",isLoading:d,onClick:n,children:a})]})]})}),pe=({children:r,title:t,onSubmit:n,submitTitle:s,isLoadingSubmit:a,...i})=>e.jsx(H,{...i,children:e.jsxs(o.Flex,{vertical:!0,children:[e.jsxs(o.Flex,{className:"border-b-[2px] border-light-7 pb-3",align:"center",justify:"space-between",children:[typeof t=="string"?e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.primary_dark_1,children:t}):t,e.jsx(o.Icon,{name:"Alert",color:l.colors.negative,size:18})]}),e.jsx(o.Flex,{className:"pb-10 pt-4",children:typeof r=="string"?e.jsx(o.Text,{size:16,weight:"normal",color:l.colors.primary,children:r}):r}),e.jsx(o.Flex,{justify:"flex-end",children:e.jsx(y.Button.Primary,{isLoading:a,onClick:n,children:s})})]})}),he=({children:r,title:t,onSubmit:n,onDiscard:s,submitTitle:a,discardTitle:i,isLoadingSubmit:d,error:g,...c})=>e.jsx(H,{...c,children:e.jsxs(o.Flex,{vertical:!0,children:[e.jsx(o.Flex,{vertical:!0,className:"border-b-[2px] border-light-7 pb-3",children:typeof t=="string"?e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.primary_dark_1,children:t}):t}),e.jsx(o.Flex,{className:"pb-10 pt-4",children:typeof r=="string"?e.jsx(o.Text,{size:16,weight:"normal",color:l.colors.primary,children:r}):r}),e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.negative,children:g}),e.jsxs(o.Flex,{gap:16,align:"center",justify:"flex-end",children:[e.jsx(y.Button.SecondaryQuiet,{onClick:s,children:i}),e.jsx(y.Button.Primary,{isLoading:d,onClick:n,children:a})]})]})}),me=y.batch({Base:H,Confirm:ue,Error:pe,Delete:xe,Info:he}),V=r=>e.jsx(e.Fragment,{}),fe=({value:r,includeCurrency:t,...n})=>{const{t:s}=P.useTranslation();return e.jsxs(o.Text,{className:"w-full",size:14,weight:"normal",color:l.colors.primary,...n,children:[r?ee(r).scientificNotationToDecimal().toCurrency().toString():"",t&&` ${s("common.literal.rial")}`]})},ye=({value:r,...t})=>e.jsx(o.Text,{className:"w-full",size:14,weight:"normal",color:l.colors.primary,...t,children:r}),be=({value:r,activeTitle:t,disableTitle:n,...s})=>{const{t:a}=P.useTranslation();return e.jsx(o.Flex,{className:C.twMerge("h-[26px] items-center justify-center rounded px-4",r?"bg-positive-light-2 bg-opacity-10":"bg-light-6"),...s,children:r?e.jsx(o.Text,{size:12,weight:"medium",color:l.colors.positive,children:t||a("common.literal.active")}):e.jsx(o.Text,{size:12,weight:"medium",color:l.colors.primary_light_2,children:n||a("common.literal.disable")})})},v=({children:r})=>typeof r=="string"||typeof r=="number"?e.jsx(o.Text,{className:"w-full",size:14,weight:"normal",color:l.colors.primary,children:r}):r;v.Currency=fe;v.Date=ye;v.StatusCell=be;const je=({expandable:r,expanded:t,onExpand:n})=>{const{i18n:s}=P.useTranslation();return r?e.jsx("button",{className:"float-start h-full items-center justify-center",children:e.jsx(o.Icon,{onClick:n,name:t?"Chevron_Down":s.language==="fa"?"Chevron_Left":"Chevron_Right"})}):null},we=({title:r,align:t,style:n,className:s})=>typeof r!="string"?r:e.jsx(o.Flex,{style:n,className:C.twMerge("w-full",t==="start"&&"justify-start",t==="center"&&"justify-center",t==="end"&&"justify-end",s),children:e.jsx(o.Text,{size:14,weight:"normal",className:"whitespace-nowrap",color:l.colors.primary,children:r})}),Ce=r=>re.deepMerge({components:{Table:{borderColor:l.colors.light_7,cellPaddingBlock:0,cellPaddingBlockMD:0,cellPaddingBlockSM:0,cellPaddingInline:8,cellPaddingInlineMD:8,cellPaddingInlineSM:8,fixedHeaderSortActiveBg:"transparent",footerBg:l.colors.light_2,headerBg:l.colors.light_2,headerBorderRadius:0,headerColor:l.colors.primary,bodySortBg:l.colors.white_ff,headerSortHoverBg:l.colors.light_1,headerSortActiveBg:l.colors.light_1,headerSplitColor:"transparent",rowExpandedBg:l.colors.light_3,rowHoverBg:l.colors.light_4,rowSelectedBg:l.colors.light_7,rowSelectedHoverBg:l.colors.light_7,selectionColumnWidth:56},Pagination:{itemActiveBg:l.colors.white_ff,itemActiveBgDisabled:l.colors.negative,itemActiveColorDisabled:l.colors.negative,colorPrimaryBorderHover:"red",colorInfoBorderHover:"yellow",colorWarningBorderHover:"green",itemBg:l.colors.white_ff,itemInputBg:l.colors.negative,itemLinkBg:l.colors.negative,itemSize:30,itemSizeSM:30,miniOptionsSizeChangerTop:40,colorPrimary:l.colors.primary,fontFamily:"YekanBakhFaRegular"}}},r??{}),_e=C.twMerge("[&_th]:!border-t h-full [&_.ant-spin-nested-loading]:h-full [&_.ant-spin-container]:h-full [&_.ant-table]:h-full [&_.ant-spin-container]:flex [&_.ant-spin-container]:flex-col [&_.ant-spin-container]:justify-between [&_.ant-table-column-title]:flex-[0] [&_th]:!border-t-light-7 [&_th]:!pt-4 [&_th]:!pb-1 [&_.ant-table-selection-column]:!ps-4 [&_.ant-table-wrapper]:!p-0 [&_.ant-table-measure-row]:!h-[1px] [&_.ant-table-body]:h-full [&_.ant-table-container]:h-full"),Se=C.twMerge("[&_th]:!bg-transparent h-full [&_th]:!border-t-0 [&_td]:!bg-transparent "),ve={small:"h-[40px] max-h-[40px] min-h-[40px]",middle:"h-[48px] max-h-[48px] min-h-[48px]",large:"h-[56px] max-h-[56px] min-h-[56px]"},Y=x.createContext({}),Ne=()=>{const{setActivatorNodeRef:r,listeners:t}=x.useContext(Y);return e.jsx("button",{style:{cursor:"move"},ref:r,...t,children:e.jsx(o.Icon,{name:"drag_and_drop",color:l.colors.primary_light_2})})},Te=r=>{let{transform:t}=r;return{...t,x:0}},Be=({children:r,onDragEnd:t,dataSource:n=[],rowKey:s})=>{const a=x.useMemo(()=>n.map(d=>d[s]),[n,s]),i=x.useCallback(({active:d,over:g})=>{if(d.id!==g?.id){const c=n.findIndex(u=>u[s]===d?.id),h=n.findIndex(u=>u[s]===g?.id),b=B.arrayMove(n,c,h);t(b)}},[n,s,t]);return e.jsx(e.Fragment,{children:e.jsx(B.DndContext,{modifiers:[Te],onDragEnd:i,children:e.jsx(B.SortableContext,{items:a,strategy:B.verticalListSortingStrategy,children:r})})})},ke=r=>{const{attributes:t,listeners:n,setNodeRef:s,setActivatorNodeRef:a,transform:i,transition:d,isDragging:g}=B.useSortable({id:r["data-row-key"]}),c={...r.style,transform:B.CSS.Translate.toString(i),transition:d,cursor:"default",...g?{position:"relative",zIndex:10}:{}},h=x.useMemo(()=>({setActivatorNodeRef:a,listeners:n}),[a,n]);return e.jsx(Y.Provider,{value:h,children:e.jsx("tr",{...r,ref:s,style:c,...t})})},Ie=({page:r,type:t,current:n,isFa:s})=>{const a=Number(r)===n;return e.jsx(o.Flex,{className:"h-[30px] items-center justify-center",children:t==="page"?e.jsx(o.Text,{weight:a?"bold":"normal",size:a?20:18,color:a?l.colors.primary:l.colors.primary_dark_1,children:r}):t==="next"?e.jsx(o.Flex,{className:"me-4 h-[30px] w-[30px] items-center justify-center rounded border border-light-7",children:e.jsx(o.Icon,{name:s?"Chevron_Right":"Chevron_Left",color:l.colors.primary})}):t==="prev"?e.jsx(o.Flex,{className:"h-[30px] w-[30px] items-center justify-center rounded border border-light-7",children:e.jsx(o.Icon,{name:s?"Chevron_Left":"Chevron_Right",color:l.colors.primary})}):e.jsx(o.Text,{size:18,children:"..."})})},ze="CHANGE_ORDER",U="CHANGE_PAGE",Z="CHANGE",J="page",Ee={order:void 0,orderBy:"",pageSize:10,current:1,filters:{}};function Fe(r,t){switch(t.type){case ze:return{...r,orderBy:t.payload.orderBy,order:t.payload.order};case U:return{...r,current:t.payload.current,pageSize:t.payload.pageSize===void 0?r.pageSize:t.payload.pageSize};case Z:return{...r,current:t.payload.current,pageSize:t.payload.pageSize??r.pageSize,order:t.payload.order,orderBy:t.payload.orderBy,filters:t.payload.filters};default:return r}}function Me({defaultCurrent:r=1,defaultPageSize:t=10,hasQueryParams:n=!1,hideOnSinglePage:s,style:a,...i}){const{isSmallerThanMedium:d}=ae(),g=$.useNavigate(),[c]=$.useSearchParams(),[h,b]=te(W,t),[u,w]=x.useState(0),{i18n:F}=P.useTranslation(),[{current:j,order:M,orderBy:A,pageSize:_,filters:k},L]=x.useReducer(Fe,{...Ee,pageSize:h,current:n?Number(c.get(J)||String(r)):r});localStorage.removeItem(W);const m=x.useCallback((f,T,R)=>{const z=Array.isArray(R)?R[0]:R;b(f.pageSize||t),L({type:Z,payload:{filters:T,current:f.current,pageSize:f.pageSize,orderBy:Array.isArray(z?.field)?z?.field[0]:z?.field,order:z?.order}})},[t,b]),I=(f,T)=>{L({type:U,payload:{current:f,pageSize:T}})},p=f=>w(f||t);x.useEffect(()=>{n&&g({search:`?${J}=${j}`},{replace:!0})},[j,n]);const S={total:u,current:j,pageSize:_,defaultCurrent:r,defaultPageSize:t,onChange:I,pageSizeOptions:["10","20","30"],showSizeChanger:!0,hideOnSinglePage:s,className:"border border-negative",style:{backgroundColor:l.colors.white_ff,paddingInline:d?4:24,paddingBlock:16,margin:0,borderTop:`1px solid ${l.colors.light_7}`,flexDirection:"row-reverse",justifyContent:"flex-start",border:"none",...a},showPrevNextJumpers:!0,showQuickJumper:!0,rootClassName:"flex items-center [&_.ant-select-dropdown]:!p-0 [&_.ant-pagination-options]:flex [&_.ant-pagination-options]:items-center [&_.ant-pagination-options]:justify-between [&_.ant-pagination-options]:flex-1",itemRender:(f,T)=>Ie({current:j,page:f,type:T,isFa:F.language==="fa"}),...i};return{filters:k,current:j,pageSize:_,pagination:S,order:M,orderBy:A,onChange:m,getTotal:p}}const N=({className:r,children:t,expandable:n,rowSelection:s,size:a,pagination:i,loading:d,transparentHeader:g,internalScroll:c=!0,extraHeight:h=100,footer:b,theme:u,dndSort:w,components:F,...j})=>{const[M,A]=x.useState(),_=x.useRef(null);x.useEffect(()=>{_.current&&A(window.innerHeight-_.current.offsetTop-46-(i?65:0)-h)},[i,u?.components?.Table?.headerBg]);const k=x.useMemo(()=>{function m(p){if(!p)return[];if(typeof p=="boolean"||typeof p>"u"||p===null)return[];if(typeof p!="object")throw new Error("Table children must be Column");if(!Array.isArray(p)){if(p.type===V)return[{...p.props,child:p}];if(p.type===x.Fragment)return m(p.props?.children)}return(p||[])?.flatMap(S=>m(S))}return m(t)},[t]),L=({children:m})=>w===void 0?e.jsx(e.Fragment,{children:m}):e.jsx(Be,{children:m,onDragEnd:w.onDragEnd,dataSource:j.dataSource,rowKey:j.rowKey});return e.jsx(E.ConfigProvider,{theme:Ce(u),children:e.jsx(L,{children:e.jsxs(E.Table,{ref:_,loading:{indicator:e.jsx(o.Flex,{className:"items-center justify-center",children:e.jsx(o.Loading,{isLoading:!0,size:32,thickness:3})}),spinning:!!d},scroll:c?{y:M}:void 0,className:C.twMerge(_e,"abrplus-table-custom-scroll-bar w-full !animate-none [&_.ant-table-thead_th]:!pt-2",!!n&&!!s&&"[&_.ant-table-selection-column]:!ps-0",g&&Se,r),rowSelection:s,expandable:n?{...n,expandedRowClassName:()=>"[&_.ant-table-cell]:!p-0 [&_.ant-table-row-expand-icon-cell]:!p-0 ",expandIcon:({expandable:m,expanded:I,onExpand:p,record:S})=>e.jsx(je,{expandable:m,expanded:I,onExpand:f=>p?.(S,f)})}:void 0,pagination:i,footer:b,components:w?{body:{row:ke}}:F,...j,children:[w&&e.jsx(N.Column,{align:"center",width:80,render:()=>e.jsx(Ne,{})},"sort"),k.map(({render:m,children:I,dataIndex:p,align:S,headerStyle:f,headerClassName:T,className:R,filtersOptions:z,sortIconOptions:q,...X},O)=>e.jsx(E.Table.Column,{...X,dataIndex:p?.toString(),className:C.twMerge("h-[56px] [&_.ant-table-column-title]:!flex-1",R),title:e.jsxs(o.Flex,{className:"ant-table-column-title-content items-center justify-between",flex:1,children:[e.jsx(we,{title:I,align:S,style:f,className:T}),z?.renderFilter?.()]}),render:(D,Q,K)=>e.jsx(o.Flex,{className:C.twMerge("items-center",ve[a||"large"]),style:{wordWrap:"break-word",wordBreak:"break-word",paddingInlineEnd:O===k.length-1?24:void 0},children:m?m({index:K,row:Q,value:D}):e.jsx(v,{children:D})}),showSorterTooltip:!1,sortIcon:({sortOrder:D})=>e.jsxs(o.Flex,{vertical:!0,...q,className:C.twMerge("table-filters-sort flex-[4] ps-2",q?.className),children:[e.jsx(o.Icon,{size:12,color:D==="ascend"?l.colors.primary:l.colors.primary_light_3,name:"Chevron_Up",style:{marginBottom:-4}}),e.jsx(o.Icon,{size:12,color:D==="descend"?l.colors.primary:l.colors.primary_light_3,name:"Chevron_Down"})]})},O))]})})})};N.Cell=v;N.Column=V;N.Currency=v.Currency;N.Date=v.Date;N.Status=v.StatusCell;N.usePagination=Me;exports.AvatarGroup=ie;exports.Drawer=ge;exports.Modal=me;exports.Table=N;