abrplus-ui-kit 0.2.9

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 (224) hide show
  1. package/README.md +159 -0
  2. package/dist/antOverrides.cjs.js +127 -0
  3. package/dist/antOverrides.es.js +127 -0
  4. package/dist/atoms.cjs.js +391 -0
  5. package/dist/atoms.es.js +392 -0
  6. package/dist/colors-CztsZ6e_.js +2213 -0
  7. package/dist/colors-TPZkyKI4.cjs +2212 -0
  8. package/dist/deepMerge-CG1he8ZD.js +20 -0
  9. package/dist/deepMerge-Cn27K7-s.cjs +19 -0
  10. package/dist/index-2Q5IExhU.cjs +89 -0
  11. package/dist/index-BOfdgXvN.cjs +265 -0
  12. package/dist/index-BnnlMHRY.cjs +27 -0
  13. package/dist/index-BzahloOb.js +28 -0
  14. package/dist/index-C24zbKLS.js +350 -0
  15. package/dist/index-CCvWoynu.cjs +12 -0
  16. package/dist/index-CQKRmQkW.js +543 -0
  17. package/dist/index-CW9vyiq6.cjs +349 -0
  18. package/dist/index-D8BknfUe.js +266 -0
  19. package/dist/index-DCP3xelB.cjs +1629 -0
  20. package/dist/index-DCojd1ld.js +90 -0
  21. package/dist/index-DLUd_0LP.js +13 -0
  22. package/dist/index-WgcaHHjH.js +1630 -0
  23. package/dist/index-keKfh9ZW.cjs +542 -0
  24. package/dist/index.cjs.js +109 -0
  25. package/dist/index.css +1519 -0
  26. package/dist/index.es.js +109 -0
  27. package/dist/index2.css +3 -0
  28. package/dist/molecules.cjs.js +7823 -0
  29. package/dist/molecules.es.js +7825 -0
  30. package/dist/organisms.cjs.js +940 -0
  31. package/dist/organisms.es.js +940 -0
  32. package/dist/provider.cjs.js +48 -0
  33. package/dist/provider.es.js +48 -0
  34. package/dist/sortable.esm-CwrpjqII.cjs +3872 -0
  35. package/dist/sortable.esm-DfJu5xWT.js +3873 -0
  36. package/dist/theme.css +102 -0
  37. package/dist/types/antOverrides.d.ts +2 -0
  38. package/dist/types/assets/fonts/icomoon/selection.json.d.ts +3 -0
  39. package/dist/types/atoms.d.ts +2 -0
  40. package/dist/types/components/antOverrides/alert/index.d.ts +2 -0
  41. package/dist/types/components/antOverrides/avatar/index.d.ts +15 -0
  42. package/dist/types/components/antOverrides/breadcrumb/index.d.ts +4 -0
  43. package/dist/types/components/antOverrides/dropdown/index.d.ts +4 -0
  44. package/dist/types/components/antOverrides/flex/index.d.ts +4 -0
  45. package/dist/types/components/antOverrides/image/index.d.ts +7 -0
  46. package/dist/types/components/antOverrides/index.d.ts +18 -0
  47. package/dist/types/components/antOverrides/infiniteLoader/index.d.ts +12 -0
  48. package/dist/types/components/antOverrides/loading/index.d.ts +14 -0
  49. package/dist/types/components/antOverrides/menu/index.d.ts +8 -0
  50. package/dist/types/components/antOverrides/pagination/index.d.ts +3 -0
  51. package/dist/types/components/antOverrides/progress/index.d.ts +3 -0
  52. package/dist/types/components/antOverrides/segmented/index.d.ts +4 -0
  53. package/dist/types/components/antOverrides/skeleton/index.d.ts +10 -0
  54. package/dist/types/components/antOverrides/slider/index.d.ts +5 -0
  55. package/dist/types/components/antOverrides/steps/index.d.ts +11 -0
  56. package/dist/types/components/antOverrides/switch/index.d.ts +3 -0
  57. package/dist/types/components/antOverrides/text/index.d.ts +31 -0
  58. package/dist/types/components/antOverrides/timeline/index.d.ts +4 -0
  59. package/dist/types/components/antOverrides/tooltip/index.d.ts +8 -0
  60. package/dist/types/components/antOverrides/upload/index.d.ts +7 -0
  61. package/dist/types/components/atoms/badge/index.d.ts +3 -0
  62. package/dist/types/components/atoms/behavioralAtoms/index.d.ts +2 -0
  63. package/dist/types/components/atoms/behavioralAtoms/portalContainer/index.d.ts +7 -0
  64. package/dist/types/components/atoms/behavioralAtoms/render/index.d.ts +14 -0
  65. package/dist/types/components/atoms/borderedTitle/index.d.ts +9 -0
  66. package/dist/types/components/atoms/box/index.d.ts +7 -0
  67. package/dist/types/components/atoms/breadcrumbs/index.d.ts +5 -0
  68. package/dist/types/components/atoms/card/index.d.ts +5 -0
  69. package/dist/types/components/atoms/checkbox/index.d.ts +7 -0
  70. package/dist/types/components/atoms/clickAwayListener/index.d.ts +11 -0
  71. package/dist/types/components/atoms/collapse/index.d.ts +6 -0
  72. package/dist/types/components/atoms/datePicker/index.d.ts +16 -0
  73. package/dist/types/components/atoms/empty/index.d.ts +5 -0
  74. package/dist/types/components/atoms/fallback/index.d.ts +4 -0
  75. package/dist/types/components/atoms/horizontalLine/index.d.ts +9 -0
  76. package/dist/types/components/atoms/icon/constants/iconNames.d.ts +1 -0
  77. package/dist/types/components/atoms/icon/constants/iconsContent.d.ts +808 -0
  78. package/dist/types/components/atoms/icon/iconPack/index.d.ts +2 -0
  79. package/dist/types/components/atoms/icon/index.d.ts +26 -0
  80. package/dist/types/components/atoms/index.d.ts +24 -0
  81. package/dist/types/components/atoms/navigationTabs/index.d.ts +35 -0
  82. package/dist/types/components/atoms/popover/index.d.ts +14 -0
  83. package/dist/types/components/atoms/popover/link.d.ts +6 -0
  84. package/dist/types/components/atoms/radio/index.d.ts +7 -0
  85. package/dist/types/components/atoms/rangePicker/index.d.ts +14 -0
  86. package/dist/types/components/atoms/separator/index.d.ts +5 -0
  87. package/dist/types/components/atoms/tab/index.d.ts +9 -0
  88. package/dist/types/components/atoms/tooltip/index.d.ts +7 -0
  89. package/dist/types/components/atoms/tooltip/titleTooltip.d.ts +5 -0
  90. package/dist/types/components/atoms/upload/index.d.ts +11 -0
  91. package/dist/types/components/atoms/verticalLine/index.d.ts +7 -0
  92. package/dist/types/components/atoms/view/helper.d.ts +20 -0
  93. package/dist/types/components/atoms/view/index.d.ts +26 -0
  94. package/dist/types/components/index.d.ts +4 -0
  95. package/dist/types/components/molecules/accordion/index.d.ts +20 -0
  96. package/dist/types/components/molecules/actionHeader/index.d.ts +11 -0
  97. package/dist/types/components/molecules/audioVisualizer/index.d.ts +15 -0
  98. package/dist/types/components/molecules/avatarUpload/index.d.ts +15 -0
  99. package/dist/types/components/molecules/button/action/index.d.ts +5 -0
  100. package/dist/types/components/molecules/button/icon/index.d.ts +11 -0
  101. package/dist/types/components/molecules/button/index.d.ts +18 -0
  102. package/dist/types/components/molecules/button/negative/index.d.ts +5 -0
  103. package/dist/types/components/molecules/button/primary/index.d.ts +3 -0
  104. package/dist/types/components/molecules/button/secondary/index.d.ts +3 -0
  105. package/dist/types/components/molecules/button/secondaryQuiet/index.d.ts +3 -0
  106. package/dist/types/components/molecules/button/shared.d.ts +23 -0
  107. package/dist/types/components/molecules/button/tertiary/index.d.ts +3 -0
  108. package/dist/types/components/molecules/button/text/index.d.ts +10 -0
  109. package/dist/types/components/molecules/catch/index.d.ts +9 -0
  110. package/dist/types/components/molecules/chevronIcon/index.d.ts +6 -0
  111. package/dist/types/components/molecules/copyButton/index.d.ts +8 -0
  112. package/dist/types/components/molecules/index.d.ts +24 -0
  113. package/dist/types/components/molecules/input/TextArea/index.d.ts +25 -0
  114. package/dist/types/components/molecules/input/default/index.d.ts +23 -0
  115. package/dist/types/components/molecules/input/emojiPicker/index.d.ts +21 -0
  116. package/dist/types/components/molecules/input/ghost/index.d.ts +25 -0
  117. package/dist/types/components/molecules/input/index.d.ts +19 -0
  118. package/dist/types/components/molecules/input/number/index.d.ts +28 -0
  119. package/dist/types/components/molecules/input/search/index.d.ts +7 -0
  120. package/dist/types/components/molecules/input/tag/index.d.ts +13 -0
  121. package/dist/types/components/molecules/inputDatePicker/index.d.ts +17 -0
  122. package/dist/types/components/molecules/inputErrorMessage/index.d.ts +9 -0
  123. package/dist/types/components/molecules/inputRangePicker/index.d.ts +16 -0
  124. package/dist/types/components/molecules/logo/index.d.ts +25 -0
  125. package/dist/types/components/molecules/noResult/index.d.ts +8 -0
  126. package/dist/types/components/molecules/notification/index.d.ts +13 -0
  127. package/dist/types/components/molecules/select/components/clearIcon.d.ts +2 -0
  128. package/dist/types/components/molecules/select/components/index.d.ts +5 -0
  129. package/dist/types/components/molecules/select/components/label.d.ts +6 -0
  130. package/dist/types/components/molecules/select/components/notFound.d.ts +5 -0
  131. package/dist/types/components/molecules/select/components/placeholder.d.ts +7 -0
  132. package/dist/types/components/molecules/select/components/suffix.d.ts +10 -0
  133. package/dist/types/components/molecules/select/index.d.ts +13 -0
  134. package/dist/types/components/molecules/select/multiple/index.d.ts +5 -0
  135. package/dist/types/components/molecules/select/single/index.d.ts +5 -0
  136. package/dist/types/components/molecules/select/style.d.ts +8 -0
  137. package/dist/types/components/molecules/select/treeSelect/index.d.ts +2 -0
  138. package/dist/types/components/molecules/select/types.d.ts +108 -0
  139. package/dist/types/components/molecules/sortableList/index.d.ts +19 -0
  140. package/dist/types/components/molecules/spliter/index.d.ts +8 -0
  141. package/dist/types/components/molecules/tag/index.d.ts +17 -0
  142. package/dist/types/components/molecules/tagCollectionView/index.d.ts +14 -0
  143. package/dist/types/components/molecules/tagInput/components/notFoundAddItem.d.ts +4 -0
  144. package/dist/types/components/molecules/tagInput/index.d.ts +6 -0
  145. package/dist/types/components/molecules/tagInput/style.d.ts +9 -0
  146. package/dist/types/components/molecules/tagInput/types.d.ts +66 -0
  147. package/dist/types/components/molecules/timePicker/index.d.ts +6 -0
  148. package/dist/types/components/molecules/titleBox/index.d.ts +8 -0
  149. package/dist/types/components/molecules/titleBox/status.d.ts +5 -0
  150. package/dist/types/components/molecules/titleBox/title.d.ts +7 -0
  151. package/dist/types/components/molecules/tree/index.d.ts +29 -0
  152. package/dist/types/components/molecules/tree/searchBar/index.d.ts +7 -0
  153. package/dist/types/components/molecules/verticalTabs/index.d.ts +19 -0
  154. package/dist/types/components/organisms/avatarGroup/index.d.ts +25 -0
  155. package/dist/types/components/organisms/drawer/components/footer.d.ts +3 -0
  156. package/dist/types/components/organisms/drawer/components/headerTitle.d.ts +8 -0
  157. package/dist/types/components/organisms/drawer/index.d.ts +24 -0
  158. package/dist/types/components/organisms/index.d.ts +4 -0
  159. package/dist/types/components/organisms/modal/base.d.ts +6 -0
  160. package/dist/types/components/organisms/modal/confirm.d.ts +6 -0
  161. package/dist/types/components/organisms/modal/delete.d.ts +4 -0
  162. package/dist/types/components/organisms/modal/error.d.ts +4 -0
  163. package/dist/types/components/organisms/modal/index.d.ts +14 -0
  164. package/dist/types/components/organisms/modal/info.d.ts +4 -0
  165. package/dist/types/components/organisms/modal/type.d.ts +11 -0
  166. package/dist/types/components/organisms/table/column.d.ts +20 -0
  167. package/dist/types/components/organisms/table/components/cell/currencyCell.d.ts +7 -0
  168. package/dist/types/components/organisms/table/components/cell/dateCell.d.ts +6 -0
  169. package/dist/types/components/organisms/table/components/cell/index.d.ts +10 -0
  170. package/dist/types/components/organisms/table/components/cell/status.d.ts +8 -0
  171. package/dist/types/components/organisms/table/components/expandIcon.d.ts +7 -0
  172. package/dist/types/components/organisms/table/components/headerTitle.d.ts +10 -0
  173. package/dist/types/components/organisms/table/config.d.ts +8 -0
  174. package/dist/types/components/organisms/table/dndSort/context.d.ts +6 -0
  175. package/dist/types/components/organisms/table/dndSort/dragHandle.d.ts +1 -0
  176. package/dist/types/components/organisms/table/dndSort/index.d.ts +3 -0
  177. package/dist/types/components/organisms/table/dndSort/provider.d.ts +10 -0
  178. package/dist/types/components/organisms/table/dndSort/row.d.ts +6 -0
  179. package/dist/types/components/organisms/table/index.d.ts +30 -0
  180. package/dist/types/components/organisms/table/pagination/components.d.ts +18 -0
  181. package/dist/types/components/organisms/table/pagination/usePagination.d.ts +22 -0
  182. package/dist/types/configs/constructors/AbrplusUIKit.d.ts +17 -0
  183. package/dist/types/configs/constructors/index.d.ts +1 -0
  184. package/dist/types/configs/index.d.ts +6 -0
  185. package/dist/types/configs/locales/en.d.ts +1030 -0
  186. package/dist/types/configs/locales/fa.d.ts +1031 -0
  187. package/dist/types/configs/locales/i18nextTFunction.d.ts +5 -0
  188. package/dist/types/configs/locales/index.d.ts +10 -0
  189. package/dist/types/configs/providers/AbrplusUIKitProvider.d.ts +11 -0
  190. package/dist/types/configs/providers/index.d.ts +1 -0
  191. package/dist/types/configs/tailwindcss/index.d.ts +103 -0
  192. package/dist/types/configs/theme/colors.d.ts +114 -0
  193. package/dist/types/configs/theme/index.d.ts +1 -0
  194. package/dist/types/configs/types/index.d.ts +98 -0
  195. package/dist/types/constants/chartColors.d.ts +1 -0
  196. package/dist/types/constants/datepickerColors.d.ts +2 -0
  197. package/dist/types/constants/dimantions.d.ts +12 -0
  198. package/dist/types/constants/enum.d.ts +5 -0
  199. package/dist/types/constants/index.d.ts +3 -0
  200. package/dist/types/constants/variables.d.ts +2 -0
  201. package/dist/types/hooks/index.d.ts +6 -0
  202. package/dist/types/hooks/useAntConfig.d.ts +24 -0
  203. package/dist/types/hooks/useDebounce.d.ts +1 -0
  204. package/dist/types/hooks/useInteractions.d.ts +15 -0
  205. package/dist/types/hooks/useLocalStorageState.d.ts +3 -0
  206. package/dist/types/hooks/useObserveWindow.d.ts +9 -0
  207. package/dist/types/hooks/useWindowDimensions.d.ts +16 -0
  208. package/dist/types/index.d.ts +2 -0
  209. package/dist/types/main.d.ts +3 -0
  210. package/dist/types/molecules.d.ts +2 -0
  211. package/dist/types/organisms.d.ts +2 -0
  212. package/dist/types/provider.d.ts +2 -0
  213. package/dist/types/theme.d.ts +1 -0
  214. package/dist/types/utilities/batch.d.ts +9 -0
  215. package/dist/types/utilities/createIcomoonIconSet.d.ts +9 -0
  216. package/dist/types/utilities/deepMerge.d.ts +1 -0
  217. package/dist/types/utilities/getErrorMessage.d.ts +1 -0
  218. package/dist/types/utilities/index.d.ts +7 -0
  219. package/dist/types/utilities/isPersian.d.ts +1 -0
  220. package/dist/types/utilities/mmss.d.ts +1 -0
  221. package/dist/types/utilities/testUtils/index.d.ts +3 -0
  222. package/dist/types/utilities/testUtils/withReactQuery.d.ts +2 -0
  223. package/dist/types/utilities/testUtils/withReactRouter.d.ts +2 -0
  224. package/package.json +195 -0
@@ -0,0 +1,940 @@
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-CwrpjqII.cjs");
5
+ const index = require("./index-BOfdgXvN.cjs");
6
+ const index$1 = require("./index-CW9vyiq6.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-keKfh9ZW.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;