@expcat/tigercat-react 1.3.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/dist/{chunk-3SV6J7I5.mjs → chunk-2L7QEOFD.mjs} +34 -25
  2. package/dist/{chunk-FNJDBFKM.mjs → chunk-2LYV6NBJ.mjs} +6 -1
  3. package/dist/{chunk-EEWHWEYO.js → chunk-2RBHQBSG.js} +2 -2
  4. package/dist/{chunk-Y5RQN5BO.mjs → chunk-376X7SDZ.mjs} +2 -2
  5. package/dist/{chunk-UXUYCWQC.js → chunk-3EDASNTG.js} +5 -5
  6. package/dist/{chunk-NPTXXUXF.mjs → chunk-3RBRWBUG.mjs} +9 -7
  7. package/dist/{chunk-PUZDW7NR.js → chunk-4AMSYFYC.js} +134 -20
  8. package/dist/{chunk-IG75YSX3.mjs → chunk-4MONGWU5.mjs} +4 -6
  9. package/dist/{chunk-3CJFNG54.mjs → chunk-56CTXEJS.mjs} +1 -1
  10. package/dist/{chunk-TMON4MPO.js → chunk-5ALMTE35.js} +9 -7
  11. package/dist/{chunk-MSHCPJIJ.mjs → chunk-6BOSSZM3.mjs} +8 -9
  12. package/dist/{chunk-SIY6FDKJ.js → chunk-7CHTTM6D.js} +339 -314
  13. package/dist/{chunk-RF2BA2N6.js → chunk-7PXALKLM.js} +4 -4
  14. package/dist/{chunk-DLKUDB2R.js → chunk-AF2AEZKM.js} +15 -3
  15. package/dist/{chunk-FB34UWF7.mjs → chunk-AVLIUHOS.mjs} +101 -40
  16. package/dist/{chunk-TSJYAEFZ.js → chunk-B63GEB2Y.js} +358 -305
  17. package/dist/{chunk-CFPKK5WW.js → chunk-BA6TJQZL.js} +12 -12
  18. package/dist/{chunk-LMTUM3J3.js → chunk-BEM7XG2L.js} +2 -4
  19. package/dist/{chunk-MB6U72CI.js → chunk-BEZO5IE4.js} +2 -2
  20. package/dist/{chunk-5OHVTGHS.mjs → chunk-BN4ZKCAI.mjs} +368 -315
  21. package/dist/{chunk-UHFHOTNI.js → chunk-BRA3PO53.js} +6 -7
  22. package/dist/{chunk-M7HBWFQO.js → chunk-BROIZ266.js} +11 -1
  23. package/dist/{chunk-SDZOVRVR.mjs → chunk-CAQPYJFA.mjs} +350 -325
  24. package/dist/{chunk-BFAZZUD6.js → chunk-CC5GFX6F.js} +5 -22
  25. package/dist/{chunk-LQT6ZGME.mjs → chunk-CME2IFUT.mjs} +15 -3
  26. package/dist/{chunk-KQ5I7PRM.js → chunk-CNNEUJR2.js} +28 -14
  27. package/dist/{chunk-EF5ZTNHX.js → chunk-D5MQBUP2.js} +16 -4
  28. package/dist/{chunk-RQXY2MGX.mjs → chunk-D7UR526A.mjs} +231 -184
  29. package/dist/{chunk-CBYJXDW4.js → chunk-DBMC6FPU.js} +16 -4
  30. package/dist/{chunk-WQ4FOHOU.mjs → chunk-DEIVWO2D.mjs} +3 -5
  31. package/dist/{chunk-7QZ4XT2P.mjs → chunk-DVEK5SO6.mjs} +3 -8
  32. package/dist/{chunk-TC6JLEGZ.js → chunk-EJKOUI26.js} +24 -7
  33. package/dist/{chunk-4GITZKAH.mjs → chunk-EPJ6W4VI.mjs} +14 -2
  34. package/dist/{chunk-KYP7U6FK.js → chunk-FZHBVHQ6.js} +34 -25
  35. package/dist/{chunk-WVVXZKNI.js → chunk-GDPU5MYA.js} +3 -8
  36. package/dist/{chunk-2GQCFTD7.mjs → chunk-H4MPPCTB.mjs} +23 -4
  37. package/dist/{chunk-YOAYDEWW.mjs → chunk-HHMYERHY.mjs} +3 -20
  38. package/dist/{chunk-LRPPXU74.mjs → chunk-I7FEGKX2.mjs} +19 -5
  39. package/dist/{chunk-F6IXIH6B.mjs → chunk-IZGXDHPB.mjs} +24 -5
  40. package/dist/{chunk-GQFVVAEF.js → chunk-J6OZWT3P.js} +5 -5
  41. package/dist/{chunk-IGAMV6ML.mjs → chunk-KDXKF6B2.mjs} +1 -1
  42. package/dist/{chunk-A42OLED6.mjs → chunk-KED5S2WG.mjs} +13 -2
  43. package/dist/{chunk-BJQIYELW.mjs → chunk-KGMVRIYC.mjs} +5 -5
  44. package/dist/{chunk-6GYT3EZD.mjs → chunk-KXT2TP6A.mjs} +3 -4
  45. package/dist/{chunk-BBLVRLXT.js → chunk-KYNWNTGO.js} +230 -146
  46. package/dist/{chunk-M73NMNZX.js → chunk-L24PPXLV.js} +17 -5
  47. package/dist/chunk-L3WPA2RP.js +25 -0
  48. package/dist/{chunk-V4JIZN3E.mjs → chunk-L6KSO66F.mjs} +4 -12
  49. package/dist/{chunk-4LX5UGPQ.js → chunk-LJRCEB7F.js} +168 -121
  50. package/dist/{chunk-F7H4ALKN.js → chunk-LZG24TDB.js} +8 -9
  51. package/dist/{chunk-ZYJTHGQW.js → chunk-M3FVPPMM.js} +9 -13
  52. package/dist/{chunk-GN3TSQWW.mjs → chunk-M6YXUNOU.mjs} +2 -2
  53. package/dist/{chunk-I373B74W.js → chunk-MC26ORSN.js} +102 -41
  54. package/dist/{chunk-5HFHHFQS.mjs → chunk-MTIGGMHG.mjs} +17 -5
  55. package/dist/{chunk-DKT2EYVM.mjs → chunk-MV2JQ6XQ.mjs} +3 -6
  56. package/dist/{chunk-HR5GBE3P.js → chunk-NDGA3N6H.js} +19 -7
  57. package/dist/{chunk-BO6QGXMN.mjs → chunk-NEZ445D4.mjs} +9 -9
  58. package/dist/{chunk-4U5HSR2H.js → chunk-NVI2P7VH.js} +3 -4
  59. package/dist/{chunk-NVEIVIAW.mjs → chunk-OFRKYQOZ.mjs} +133 -19
  60. package/dist/{chunk-AW5M3EL4.js → chunk-OS6M3IZF.js} +62 -12
  61. package/dist/{chunk-3ZNZLGQO.mjs → chunk-OXQOKKTP.mjs} +6 -7
  62. package/dist/{chunk-NMEVQPOD.js → chunk-PHAJXRGE.js} +2 -4
  63. package/dist/{chunk-WG3YS2QV.js → chunk-PT5T5F4H.js} +13 -2
  64. package/dist/{chunk-WNLUUD5N.mjs → chunk-QIL24WZD.mjs} +8 -12
  65. package/dist/{chunk-ZFMMAYSX.js → chunk-QLATA4UB.js} +4 -6
  66. package/dist/{chunk-KIYNHQGW.mjs → chunk-RVLV63SI.mjs} +41 -20
  67. package/dist/{chunk-3QPCQH62.mjs → chunk-RYNLPRUM.mjs} +1 -1
  68. package/dist/{chunk-6GIJ7NFV.mjs → chunk-SDZKL3IB.mjs} +3 -5
  69. package/dist/{chunk-G5USITWF.js → chunk-SH4BZYXO.js} +27 -8
  70. package/dist/{chunk-L5AMVEQL.mjs → chunk-SLEXEH7R.mjs} +60 -10
  71. package/dist/{chunk-JLRRXRZO.js → chunk-SQONS5PH.js} +4 -7
  72. package/dist/chunk-SQTOVSDU.mjs +692 -0
  73. package/dist/{chunk-3ZQMHXRY.js → chunk-TEYL5X56.js} +39 -18
  74. package/dist/{chunk-KGSDDVRC.mjs → chunk-TNTOSFGN.mjs} +4 -4
  75. package/dist/{chunk-CY5GRTAX.js → chunk-UAM3RQY4.js} +24 -5
  76. package/dist/{chunk-XRNKHQTL.js → chunk-UEAXYZSE.js} +3 -2
  77. package/dist/{chunk-7ISEWLA3.js → chunk-UKQMF3JV.js} +21 -6
  78. package/dist/{chunk-ITVLIR7T.mjs → chunk-ULWT6W6M.mjs} +13 -20
  79. package/dist/{chunk-M5GSLKUX.mjs → chunk-VAIWWELW.mjs} +15 -3
  80. package/dist/{chunk-4SO4LANY.js → chunk-VC26SAXB.js} +340 -274
  81. package/dist/{chunk-SKMZTW3K.js → chunk-WCTNQYXO.js} +16 -23
  82. package/dist/{chunk-KXNWY2Q7.mjs → chunk-WFWEMXO7.mjs} +241 -157
  83. package/dist/chunk-WHYHLUXG.mjs +25 -0
  84. package/dist/{chunk-ONTRGV5T.js → chunk-WZUADPYB.js} +6 -14
  85. package/dist/{chunk-N4PP3ENO.js → chunk-XTQUPDRI.js} +2 -2
  86. package/dist/{chunk-XATXFVKR.mjs → chunk-Y7K27DVV.mjs} +4 -3
  87. package/dist/{chunk-WI4N5DD3.mjs → chunk-YH57D4AV.mjs} +16 -4
  88. package/dist/{chunk-3MRP3XYI.js → chunk-YRVAF2ID.js} +7 -2
  89. package/dist/{chunk-5XE5VBDS.mjs → chunk-YSGM22AH.mjs} +11 -1
  90. package/dist/{chunk-6TR7JB6C.js → chunk-ZDNQGS4O.js} +4 -4
  91. package/dist/{chunk-CHBUNQIJ.mjs → chunk-ZQSMJS2Q.mjs} +23 -6
  92. package/dist/{chunk-QQFLRNI3.mjs → chunk-ZRZB3C5J.mjs} +18 -3
  93. package/dist/components/ActivityFeed.js +4 -3
  94. package/dist/components/ActivityFeed.mjs +3 -2
  95. package/dist/components/Cascader.d.mts +3 -1
  96. package/dist/components/Cascader.d.ts +3 -1
  97. package/dist/components/Cascader.js +3 -2
  98. package/dist/components/Cascader.mjs +2 -1
  99. package/dist/components/ChatWindow.js +5 -5
  100. package/dist/components/ChatWindow.mjs +4 -4
  101. package/dist/components/Checkbox.js +4 -4
  102. package/dist/components/Checkbox.mjs +3 -3
  103. package/dist/components/CheckboxGroup.js +3 -3
  104. package/dist/components/CheckboxGroup.mjs +2 -2
  105. package/dist/components/CommentThread.js +4 -4
  106. package/dist/components/CommentThread.mjs +3 -3
  107. package/dist/components/CropUpload.js +4 -4
  108. package/dist/components/CropUpload.mjs +3 -3
  109. package/dist/components/DataTableWithToolbar.d.mts +2 -2
  110. package/dist/components/DataTableWithToolbar.d.ts +2 -2
  111. package/dist/components/DataTableWithToolbar.js +11 -11
  112. package/dist/components/DataTableWithToolbar.mjs +10 -10
  113. package/dist/components/DatePicker.d.mts +1 -0
  114. package/dist/components/DatePicker.d.ts +1 -0
  115. package/dist/components/DatePicker.js +3 -2
  116. package/dist/components/DatePicker.mjs +2 -1
  117. package/dist/components/Drawer.js +3 -3
  118. package/dist/components/Drawer.mjs +2 -2
  119. package/dist/components/FileManager.d.mts +2 -1
  120. package/dist/components/FileManager.d.ts +2 -1
  121. package/dist/components/FileManager.js +3 -2
  122. package/dist/components/FileManager.mjs +2 -1
  123. package/dist/components/Form.js +3 -2
  124. package/dist/components/Form.mjs +2 -1
  125. package/dist/components/FormItem.js +4 -3
  126. package/dist/components/FormItem.mjs +3 -2
  127. package/dist/components/FormWizard.js +4 -4
  128. package/dist/components/FormWizard.mjs +3 -3
  129. package/dist/components/Image.js +4 -4
  130. package/dist/components/Image.mjs +3 -3
  131. package/dist/components/ImageGroup.js +3 -3
  132. package/dist/components/ImageGroup.mjs +2 -2
  133. package/dist/components/ImagePreview.js +2 -2
  134. package/dist/components/ImagePreview.mjs +1 -1
  135. package/dist/components/ImageViewer.d.mts +1 -1
  136. package/dist/components/ImageViewer.d.ts +1 -1
  137. package/dist/components/ImageViewer.js +2 -2
  138. package/dist/components/ImageViewer.mjs +1 -1
  139. package/dist/components/InfiniteScroll.d.mts +2 -0
  140. package/dist/components/InfiniteScroll.d.ts +2 -0
  141. package/dist/components/InfiniteScroll.js +3 -2
  142. package/dist/components/InfiniteScroll.mjs +2 -1
  143. package/dist/components/Input.js +3 -2
  144. package/dist/components/Input.mjs +2 -1
  145. package/dist/components/InputNumber.js +3 -2
  146. package/dist/components/InputNumber.mjs +2 -1
  147. package/dist/components/List.d.mts +6 -2
  148. package/dist/components/List.d.ts +6 -2
  149. package/dist/components/List.js +3 -2
  150. package/dist/components/List.mjs +2 -1
  151. package/dist/components/Loading.js +3 -2
  152. package/dist/components/Loading.mjs +2 -1
  153. package/dist/components/MarkdownEditor.js +3 -3
  154. package/dist/components/MarkdownEditor.mjs +2 -2
  155. package/dist/components/Mentions.js +2 -2
  156. package/dist/components/Mentions.mjs +1 -1
  157. package/dist/components/Menu.d.mts +8 -80
  158. package/dist/components/Menu.d.ts +8 -80
  159. package/dist/components/Menu.js +2 -2
  160. package/dist/components/Menu.mjs +1 -1
  161. package/dist/components/MenuItem.d.mts +6 -2
  162. package/dist/components/MenuItem.d.ts +6 -2
  163. package/dist/components/MenuItem.js +2 -2
  164. package/dist/components/MenuItem.mjs +1 -1
  165. package/dist/components/MenuItemGroup.d.mts +6 -2
  166. package/dist/components/MenuItemGroup.d.ts +6 -2
  167. package/dist/components/MenuItemGroup.js +2 -2
  168. package/dist/components/MenuItemGroup.mjs +1 -1
  169. package/dist/components/Message.js +2 -2
  170. package/dist/components/Message.mjs +1 -1
  171. package/dist/components/Modal.js +3 -3
  172. package/dist/components/Modal.mjs +2 -2
  173. package/dist/components/Notification.js +2 -2
  174. package/dist/components/Notification.mjs +1 -1
  175. package/dist/components/NotificationCenter.js +5 -4
  176. package/dist/components/NotificationCenter.mjs +4 -3
  177. package/dist/components/NumberKeyboard.js +3 -2
  178. package/dist/components/NumberKeyboard.mjs +2 -1
  179. package/dist/components/Radio.js +4 -4
  180. package/dist/components/Radio.mjs +3 -3
  181. package/dist/components/RadioGroup.js +3 -3
  182. package/dist/components/RadioGroup.mjs +2 -2
  183. package/dist/components/RichTextEditor.js +3 -3
  184. package/dist/components/RichTextEditor.mjs +2 -2
  185. package/dist/components/Select.d.mts +3 -1
  186. package/dist/components/Select.d.ts +3 -1
  187. package/dist/components/Select.js +3 -2
  188. package/dist/components/Select.mjs +2 -1
  189. package/dist/components/Signature.d.mts +1 -0
  190. package/dist/components/Signature.d.ts +1 -0
  191. package/dist/components/Signature.js +3 -2
  192. package/dist/components/Signature.mjs +2 -1
  193. package/dist/components/Spotlight.js +4 -2
  194. package/dist/components/Spotlight.mjs +3 -1
  195. package/dist/components/Steps.js +2 -2
  196. package/dist/components/Steps.mjs +1 -1
  197. package/dist/components/StepsItem.js +2 -2
  198. package/dist/components/StepsItem.mjs +1 -1
  199. package/dist/components/SubMenu.d.mts +6 -2
  200. package/dist/components/SubMenu.d.ts +6 -2
  201. package/dist/components/SubMenu.js +2 -2
  202. package/dist/components/SubMenu.mjs +1 -1
  203. package/dist/components/Table.d.mts +2 -2
  204. package/dist/components/Table.d.ts +2 -2
  205. package/dist/components/Table.js +9 -9
  206. package/dist/components/Table.mjs +8 -8
  207. package/dist/components/Textarea.js +3 -3
  208. package/dist/components/Textarea.mjs +2 -2
  209. package/dist/components/TimePicker.d.mts +1 -0
  210. package/dist/components/TimePicker.d.ts +1 -0
  211. package/dist/components/TimePicker.js +4 -2
  212. package/dist/components/TimePicker.mjs +3 -1
  213. package/dist/components/Tour.js +3 -2
  214. package/dist/components/Tour.mjs +2 -1
  215. package/dist/components/Transfer.d.mts +3 -1
  216. package/dist/components/Transfer.d.ts +3 -1
  217. package/dist/components/Transfer.js +3 -2
  218. package/dist/components/Transfer.mjs +2 -1
  219. package/dist/components/Tree.d.mts +3 -1
  220. package/dist/components/Tree.d.ts +3 -1
  221. package/dist/components/Tree.js +3 -2
  222. package/dist/components/Tree.mjs +2 -1
  223. package/dist/components/TreeSelect.d.mts +3 -1
  224. package/dist/components/TreeSelect.d.ts +3 -1
  225. package/dist/components/TreeSelect.js +3 -2
  226. package/dist/components/TreeSelect.mjs +2 -1
  227. package/dist/components/Upload.js +3 -2
  228. package/dist/components/Upload.mjs +2 -1
  229. package/dist/components/VirtualTable.d.mts +3 -2
  230. package/dist/components/VirtualTable.d.ts +3 -2
  231. package/dist/components/VirtualTable.js +3 -2
  232. package/dist/components/VirtualTable.mjs +2 -1
  233. package/dist/index.d.mts +33 -7
  234. package/dist/index.d.ts +33 -7
  235. package/dist/index.js +54 -54
  236. package/dist/index.mjs +53 -53
  237. package/dist/{types-CHmCMNEM.d.ts → types-0oVwMXtR.d.mts} +1 -1
  238. package/dist/{types-CHmCMNEM.d.mts → types-0oVwMXtR.d.ts} +1 -1
  239. package/dist/types-DaC4a0Ny.d.mts +80 -0
  240. package/dist/types-DaC4a0Ny.d.ts +80 -0
  241. package/package.json +2 -2
  242. package/dist/chunk-UKGQ7256.js +0 -12
  243. package/dist/chunk-UQMPEMY7.mjs +0 -12
  244. package/dist/chunk-VNVGSPBI.mjs +0 -626
  245. package/dist/{chunk-OZD75CLT.js → chunk-ANBNSUSR.js} +3 -3
  246. package/dist/{chunk-I2AUOICV.mjs → chunk-M3MOSUZO.mjs} +3 -3
  247. package/dist/{chunk-UMZ3PMUJ.js → chunk-SXHCMZ6U.js} +2 -2
  248. package/dist/{chunk-BWDQZSAB.mjs → chunk-WTSG7QXK.mjs} +3 -3
@@ -1,11 +1,16 @@
1
1
  import {
2
2
  VirtualList
3
3
  } from "./chunk-7DUHHRAU.mjs";
4
+ import {
5
+ useTigerConfig
6
+ } from "./chunk-QAIBQHIO.mjs";
4
7
 
5
8
  // src/components/List.tsx
6
9
  import React, { useMemo, useState } from "react";
7
10
  import {
8
11
  classNames,
12
+ resolveLocaleText,
13
+ mergeTigerLocale,
9
14
  getListClasses,
10
15
  getListItemClasses,
11
16
  getListHeaderFooterClasses,
@@ -54,7 +59,8 @@ var List = ({
54
59
  size = "md",
55
60
  bordered = "divided",
56
61
  loading = false,
57
- emptyText = "No data",
62
+ emptyText,
63
+ locale,
58
64
  split = true,
59
65
  itemLayout = "horizontal",
60
66
  header,
@@ -75,6 +81,11 @@ var List = ({
75
81
  onReorder,
76
82
  ...divProps
77
83
  }) => {
84
+ const config = useTigerConfig();
85
+ const mergedLocale = useMemo(
86
+ () => mergeTigerLocale(config.locale, locale),
87
+ [config.locale, locale]
88
+ );
78
89
  const [currentPage, setCurrentPage] = useState(
79
90
  pagination && typeof pagination === "object" ? pagination.current || 1 : 1
80
91
  );
@@ -232,7 +243,7 @@ var List = ({
232
243
  return null;
233
244
  }
234
245
  if (paginatedData.length === 0) {
235
- return /* @__PURE__ */ jsx("div", { className: listEmptyStateClasses, role: "status", "aria-live": "polite", children: emptyText });
246
+ return /* @__PURE__ */ jsx("div", { className: listEmptyStateClasses, role: "status", "aria-live": "polite", children: resolveLocaleText("No data", emptyText, mergedLocale?.common?.emptyText) });
236
247
  }
237
248
  const items = paginatedData.map((item, index) => renderListItem(item, index));
238
249
  if (grid) {
@@ -53,7 +53,7 @@ var ImageViewer = ({
53
53
  className,
54
54
  onOpenChange,
55
55
  onClose,
56
- onIndexChange
56
+ onCurrentIndexChange
57
57
  }) => {
58
58
  const [index, setIndex] = useState(currentIndex);
59
59
  const [transform, setTransform] = useState(createDefaultTransform);
@@ -75,14 +75,14 @@ var ImageViewer = ({
75
75
  const newIndex = (index - 1 + images.length) % images.length;
76
76
  setIndex(newIndex);
77
77
  resetTransform();
78
- onIndexChange?.(newIndex);
79
- }, [index, images.length, onIndexChange, resetTransform]);
78
+ onCurrentIndexChange?.(newIndex);
79
+ }, [index, images.length, onCurrentIndexChange, resetTransform]);
80
80
  const handleNext = useCallback(() => {
81
81
  const newIndex = (index + 1) % images.length;
82
82
  setIndex(newIndex);
83
83
  resetTransform();
84
- onIndexChange?.(newIndex);
85
- }, [index, images.length, onIndexChange, resetTransform]);
84
+ onCurrentIndexChange?.(newIndex);
85
+ }, [index, images.length, onCurrentIndexChange, resetTransform]);
86
86
  useEffect(() => {
87
87
  if (!open) return;
88
88
  const handler = (e) => {
@@ -1,10 +1,10 @@
1
1
  import {
2
+ renderBodyPortal,
2
3
  useEscapeKey
3
4
  } from "./chunk-SEWNVIHH.mjs";
4
5
 
5
6
  // src/components/ImagePreview.tsx
6
7
  import { useState, useRef, useEffect, useMemo, useCallback } from "react";
7
- import { createPortal } from "react-dom";
8
8
  import {
9
9
  classNames,
10
10
  imagePreviewMaskClasses,
@@ -223,7 +223,7 @@ var ImagePreview = ({
223
223
  );
224
224
  if (!isOpen || !images.length) return null;
225
225
  const currentSrc = images[index] || images[0];
226
- return createPortal(
226
+ return renderBodyPortal(
227
227
  /* @__PURE__ */ jsxs(
228
228
  "div",
229
229
  {
@@ -341,8 +341,7 @@ var ImagePreview = ({
341
341
  ] })
342
342
  ]
343
343
  }
344
- ),
345
- document.body
344
+ )
346
345
  );
347
346
  };
348
347
 
@@ -1,13 +1,16 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/components/Select.tsx
2
- var _react = require('react');
3
-
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
4
2
 
3
+ var _chunkTDODFBBOjs = require('./chunk-TDODFBBO.js');
5
4
 
5
+ // src/components/Select.tsx
6
6
 
7
7
 
8
8
 
9
9
 
10
+ var _tigercatcore = require('@expcat/tigercat-core');
10
11
 
12
+ // src/components/Select/state.ts
13
+ var _react = require('react');
11
14
 
12
15
 
13
16
 
@@ -22,10 +25,31 @@ var _react = require('react');
22
25
 
23
26
 
24
27
 
25
- var _tigercatcore = require('@expcat/tigercat-core');
26
- var _jsxruntime = require('react/jsx-runtime');
27
- var isMultipleSelect = (props) => props.multiple === true;
28
- var Select = (props) => {
28
+ var SELECT_KEYS = /* @__PURE__ */ new Set([
29
+ "options",
30
+ "size",
31
+ "disabled",
32
+ "placeholder",
33
+ "searchable",
34
+ "clearable",
35
+ "noOptionsText",
36
+ "noDataText",
37
+ "maxTagCount",
38
+ "virtual",
39
+ "remote",
40
+ "searchDebounce",
41
+ "creatable",
42
+ "createOptionText",
43
+ "listHeight",
44
+ "onSearch",
45
+ "onCreate",
46
+ "className",
47
+ "value",
48
+ "onChange",
49
+ "multiple",
50
+ "locale"
51
+ ]);
52
+ function useSelectState(props) {
29
53
  const {
30
54
  options = [],
31
55
  size = "md",
@@ -33,8 +57,8 @@ var Select = (props) => {
33
57
  placeholder = "Select an option",
34
58
  searchable = false,
35
59
  clearable = true,
36
- noOptionsText = "No options found",
37
- noDataText = "No options available",
60
+ noOptionsText,
61
+ noDataText,
38
62
  maxTagCount,
39
63
  remote = false,
40
64
  searchDebounce = 0,
@@ -45,32 +69,15 @@ var Select = (props) => {
45
69
  className,
46
70
  value,
47
71
  onChange,
48
- multiple
72
+ multiple,
73
+ locale
49
74
  } = props;
50
75
  const isMultiple = multiple === true;
51
- const SELECT_KEYS = /* @__PURE__ */ new Set([
52
- "options",
53
- "size",
54
- "disabled",
55
- "placeholder",
56
- "searchable",
57
- "clearable",
58
- "noOptionsText",
59
- "noDataText",
60
- "maxTagCount",
61
- "virtual",
62
- "remote",
63
- "searchDebounce",
64
- "creatable",
65
- "createOptionText",
66
- "listHeight",
67
- "onSearch",
68
- "onCreate",
69
- "className",
70
- "value",
71
- "onChange",
72
- "multiple"
73
- ]);
76
+ const config = _chunkTDODFBBOjs.useTigerConfig.call(void 0, );
77
+ const mergedLocale = _react.useMemo.call(void 0,
78
+ () => _tigercatcore.mergeTigerLocale.call(void 0, config.locale, locale),
79
+ [config.locale, locale]
80
+ );
74
81
  const divProps = {};
75
82
  for (const [k, v] of Object.entries(props)) {
76
83
  if (!SELECT_KEYS.has(k)) divProps[k] = v;
@@ -402,158 +409,235 @@ var Select = (props) => {
402
409
  document.removeEventListener("click", handleClickOutside);
403
410
  };
404
411
  }, [isOpen]);
405
- const triggerClasses = _tigercatcore.getSelectTriggerClasses.call(void 0, size, disabled, isOpen);
406
- const renderOption = (option, index, displayLabel = option.label) => {
407
- const optionSelected = isSelected(option);
408
- const optionActive = index === activeIndex;
409
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
410
- "div",
411
- {
412
- id: getOptionId(index),
413
- "data-option-index": index,
414
- role: "option",
415
- "aria-selected": optionSelected,
416
- "aria-disabled": option.disabled ? true : void 0,
417
- tabIndex: optionActive ? 0 : -1,
418
- className: _tigercatcore.getSelectOptionClasses.call(void 0, optionSelected, !!option.disabled, size),
419
- onMouseEnter: () => {
420
- if (!option.disabled) {
421
- setActiveIndex(index);
422
- }
423
- },
424
- onClick: () => selectOption(option),
425
- children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center justify-between w-full", children: [
426
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: displayLabel }),
427
- optionSelected && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
428
- "svg",
429
- {
430
- className: "w-5 h-5 text-[var(--tiger-select-check-icon,var(--tiger-primary,#2563eb))]",
431
- xmlns: "http://www.w3.org/2000/svg",
432
- viewBox: _tigercatcore.icon20ViewBox,
433
- fill: "currentColor",
434
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { fillRule: "evenodd", d: _tigercatcore.checkSolidIcon20PathD, clipRule: "evenodd" })
435
- }
436
- )
437
- ] })
438
- },
439
- option.value
440
- );
412
+ return {
413
+ listboxId,
414
+ getOptionId,
415
+ isOpen,
416
+ searchQuery,
417
+ activeIndex,
418
+ setActiveIndex,
419
+ dropdownRef,
420
+ triggerRef,
421
+ searchInputRef,
422
+ isMultiple,
423
+ size,
424
+ disabled,
425
+ placeholder,
426
+ searchable,
427
+ clearable,
428
+ noDataText: _tigercatcore.resolveLocaleText.call(void 0,
429
+ "No options available",
430
+ noDataText,
431
+ _optionalChain([mergedLocale, 'optionalAccess', _38 => _38.common, 'optionalAccess', _39 => _39.emptyText])
432
+ ),
433
+ noOptionsText: _tigercatcore.resolveLocaleText.call(void 0,
434
+ "No options found",
435
+ noOptionsText,
436
+ _optionalChain([mergedLocale, 'optionalAccess', _40 => _40.common, 'optionalAccess', _41 => _41.emptyText])
437
+ ),
438
+ createOptionText,
439
+ className,
440
+ divProps,
441
+ searchPlaceholder: _tigercatcore.resolveLocaleText.call(void 0, "Search...", _optionalChain([mergedLocale, 'optionalAccess', _42 => _42.common, 'optionalAccess', _43 => _43.searchPlaceholder])),
442
+ filteredOptions,
443
+ flatSelectableOptions,
444
+ creatableOption,
445
+ hasOptions: filteredOptions.length > 0,
446
+ optionsLength: options.length,
447
+ displayText,
448
+ showClearButton,
449
+ containerClasses: _tigercatcore.classNames.call(void 0, _tigercatcore.selectBaseClasses, className),
450
+ triggerClasses: _tigercatcore.getSelectTriggerClasses.call(void 0, size, disabled, isOpen),
451
+ isSelected,
452
+ selectOption,
453
+ clearSelection,
454
+ toggleDropdown,
455
+ handleSearchInput,
456
+ handleTriggerKeyDown,
457
+ handleDropdownKeyDown,
458
+ handleSearchKeyDown
441
459
  };
442
- const hasOptions = filteredOptions.length > 0;
443
- const renderOptions = () => {
444
- if (!hasOptions && !creatableOption) {
445
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.selectEmptyStateClasses, children: options.length === 0 ? noDataText : noOptionsText });
446
- }
447
- let optionIndex = -1;
448
- const optionNodes = filteredOptions.map((item) => {
449
- if (_tigercatcore.isOptionGroup.call(void 0, item)) {
450
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
451
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.selectGroupLabelClasses, children: item.label }),
452
- item.options.map((option) => {
453
- optionIndex += 1;
454
- return renderOption(option, optionIndex);
455
- })
456
- ] }, item.label);
457
- }
458
- optionIndex += 1;
459
- return renderOption(item, optionIndex);
460
- });
461
- if (creatableOption) {
462
- optionIndex += 1;
463
- optionNodes.push(
464
- renderOption(
465
- creatableOption,
466
- optionIndex,
467
- _tigercatcore.getCreateSelectOptionLabel.call(void 0, creatableOption, createOptionText)
468
- )
469
- );
460
+ }
461
+
462
+ // src/components/Select/render-option.tsx
463
+
464
+
465
+
466
+
467
+
468
+
469
+
470
+
471
+ // src/components/Select/icons.tsx
472
+
473
+
474
+
475
+
476
+
477
+
478
+ var _jsxruntime = require('react/jsx-runtime');
479
+ var SelectIcon = ({ path, className }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
480
+ "svg",
481
+ {
482
+ className,
483
+ xmlns: "http://www.w3.org/2000/svg",
484
+ viewBox: _tigercatcore.icon20ViewBox,
485
+ fill: "currentColor",
486
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { fillRule: "evenodd", d: path, clipRule: "evenodd" })
487
+ }
488
+ );
489
+ var SelectCheckIcon = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
490
+ SelectIcon,
491
+ {
492
+ path: _tigercatcore.checkSolidIcon20PathD,
493
+ className: "w-5 h-5 text-[var(--tiger-select-check-icon,var(--tiger-primary,#2563eb))]"
494
+ }
495
+ );
496
+ var SelectClearIcon = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
497
+ SelectIcon,
498
+ {
499
+ path: _tigercatcore.closeSolidIcon20PathD,
500
+ className: "w-4 h-4 text-[var(--tiger-select-icon,var(--tiger-text-muted,#9ca3af))] hover:text-[var(--tiger-select-icon-hover,var(--tiger-text-muted,#6b7280))]"
501
+ }
502
+ );
503
+ var SelectChevronIcon = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
504
+ SelectIcon,
505
+ {
506
+ path: _tigercatcore.chevronDownSolidIcon20PathD,
507
+ className: "w-5 h-5 text-[var(--tiger-select-icon,var(--tiger-text-muted,#9ca3af))] transition-transform"
508
+ }
509
+ );
510
+
511
+ // src/components/Select/render-option.tsx
512
+
513
+ function renderOption(ctx, option, index, displayLabel = option.label) {
514
+ const optionSelected = ctx.isSelected(option);
515
+ const optionActive = index === ctx.activeIndex;
516
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
517
+ "div",
518
+ {
519
+ id: ctx.getOptionId(index),
520
+ "data-option-index": index,
521
+ role: "option",
522
+ "aria-selected": optionSelected,
523
+ "aria-disabled": option.disabled ? true : void 0,
524
+ tabIndex: optionActive ? 0 : -1,
525
+ className: _tigercatcore.getSelectOptionClasses.call(void 0, optionSelected, !!option.disabled, ctx.size),
526
+ onMouseEnter: () => {
527
+ if (!option.disabled) {
528
+ ctx.setActiveIndex(index);
529
+ }
530
+ },
531
+ onClick: () => ctx.selectOption(option),
532
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center justify-between w-full", children: [
533
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: displayLabel }),
534
+ optionSelected && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectCheckIcon, {})
535
+ ] })
536
+ },
537
+ option.value
538
+ );
539
+ }
540
+ function renderOptions(ctx) {
541
+ if (!ctx.hasOptions && !ctx.creatableOption) {
542
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.selectEmptyStateClasses, children: ctx.optionsLength === 0 ? ctx.noDataText : ctx.noOptionsText });
543
+ }
544
+ let optionIndex = -1;
545
+ const optionNodes = ctx.filteredOptions.map((item) => {
546
+ if (_tigercatcore.isOptionGroup.call(void 0, item)) {
547
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
548
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.selectGroupLabelClasses, children: item.label }),
549
+ item.options.map((option) => {
550
+ optionIndex += 1;
551
+ return renderOption(ctx, option, optionIndex);
552
+ })
553
+ ] }, item.label);
470
554
  }
471
- return optionNodes;
472
- };
473
- const containerClasses = _tigercatcore.classNames.call(void 0, _tigercatcore.selectBaseClasses, className);
474
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...divProps, className: containerClasses, children: [
555
+ optionIndex += 1;
556
+ return renderOption(ctx, item, optionIndex);
557
+ });
558
+ if (ctx.creatableOption) {
559
+ optionIndex += 1;
560
+ optionNodes.push(
561
+ renderOption(
562
+ ctx,
563
+ ctx.creatableOption,
564
+ optionIndex,
565
+ _tigercatcore.getCreateSelectOptionLabel.call(void 0, ctx.creatableOption, ctx.createOptionText)
566
+ )
567
+ );
568
+ }
569
+ return optionNodes;
570
+ }
571
+
572
+ // src/components/Select.tsx
573
+
574
+ var Select = (props) => {
575
+ const ctx = useSelectState(props);
576
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...ctx.divProps, className: ctx.containerClasses, children: [
475
577
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
476
578
  "button",
477
579
  {
478
- ref: triggerRef,
580
+ ref: ctx.triggerRef,
479
581
  type: "button",
480
- className: triggerClasses,
481
- disabled,
482
- onClick: toggleDropdown,
483
- onKeyDown: handleTriggerKeyDown,
582
+ className: ctx.triggerClasses,
583
+ disabled: ctx.disabled,
584
+ onClick: ctx.toggleDropdown,
585
+ onKeyDown: ctx.handleTriggerKeyDown,
484
586
  "aria-haspopup": "listbox",
485
- "aria-expanded": isOpen,
486
- "aria-controls": listboxId,
487
- "aria-activedescendant": isOpen && activeIndex >= 0 ? getOptionId(activeIndex) : void 0,
488
- "data-state": isOpen ? "open" : "closed",
587
+ "aria-expanded": ctx.isOpen,
588
+ "aria-controls": ctx.listboxId,
589
+ "aria-activedescendant": ctx.isOpen && ctx.activeIndex >= 0 ? ctx.getOptionId(ctx.activeIndex) : void 0,
590
+ "data-state": ctx.isOpen ? "open" : "closed",
489
591
  children: [
490
592
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
491
593
  "span",
492
594
  {
493
595
  className: _tigercatcore.classNames.call(void 0,
494
596
  "flex-1 text-left truncate",
495
- displayText === placeholder && "text-[var(--tiger-select-placeholder,var(--tiger-text-muted,#9ca3af))]"
597
+ ctx.displayText === ctx.placeholder && "text-[var(--tiger-select-placeholder,var(--tiger-text-muted,#9ca3af))]"
496
598
  ),
497
- children: displayText
599
+ children: ctx.displayText
498
600
  }
499
601
  ),
500
602
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center gap-1", children: [
501
- showClearButton && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
603
+ ctx.showClearButton && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
502
604
  "span",
503
605
  {
504
606
  className: "inline-flex",
505
607
  "data-tiger-select-clear": true,
506
608
  "aria-label": "Clear selection",
507
- onClick: clearSelection,
508
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
509
- "svg",
510
- {
511
- className: "w-4 h-4 text-[var(--tiger-select-icon,var(--tiger-text-muted,#9ca3af))] hover:text-[var(--tiger-select-icon-hover,var(--tiger-text-muted,#6b7280))]",
512
- xmlns: "http://www.w3.org/2000/svg",
513
- viewBox: _tigercatcore.icon20ViewBox,
514
- fill: "currentColor",
515
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { fillRule: "evenodd", d: _tigercatcore.closeSolidIcon20PathD, clipRule: "evenodd" })
516
- }
517
- )
609
+ onClick: ctx.clearSelection,
610
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectClearIcon, {})
518
611
  }
519
612
  ),
520
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: _tigercatcore.classNames.call(void 0, "inline-flex", isOpen && "rotate-180"), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
521
- "svg",
522
- {
523
- className: "w-5 h-5 text-[var(--tiger-select-icon,var(--tiger-text-muted,#9ca3af))] transition-transform",
524
- xmlns: "http://www.w3.org/2000/svg",
525
- viewBox: _tigercatcore.icon20ViewBox,
526
- fill: "currentColor",
527
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { fillRule: "evenodd", d: _tigercatcore.chevronDownSolidIcon20PathD, clipRule: "evenodd" })
528
- }
529
- ) })
613
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: _tigercatcore.classNames.call(void 0, "inline-flex", ctx.isOpen && "rotate-180"), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectChevronIcon, {}) })
530
614
  ] })
531
615
  ]
532
616
  }
533
617
  ),
534
- isOpen && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
618
+ ctx.isOpen && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
535
619
  "div",
536
620
  {
537
- ref: dropdownRef,
621
+ ref: ctx.dropdownRef,
538
622
  className: _tigercatcore.selectDropdownBaseClasses,
539
623
  role: "listbox",
540
- id: listboxId,
541
- "aria-multiselectable": isMultipleSelect(props) ? true : void 0,
542
- onKeyDown: handleDropdownKeyDown,
624
+ id: ctx.listboxId,
625
+ "aria-multiselectable": ctx.isMultiple ? true : void 0,
626
+ onKeyDown: ctx.handleDropdownKeyDown,
543
627
  children: [
544
- searchable && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
628
+ ctx.searchable && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
545
629
  "input",
546
630
  {
547
- ref: searchInputRef,
631
+ ref: ctx.searchInputRef,
548
632
  type: "text",
549
633
  className: _tigercatcore.selectSearchInputClasses,
550
- placeholder: "Search...",
551
- value: searchQuery,
552
- onChange: handleSearchInput,
553
- onKeyDown: handleSearchKeyDown
634
+ placeholder: ctx.searchPlaceholder,
635
+ value: ctx.searchQuery,
636
+ onChange: ctx.handleSearchInput,
637
+ onKeyDown: ctx.handleSearchKeyDown
554
638
  }
555
639
  ),
556
- renderOptions()
640
+ renderOptions(ctx)
557
641
  ]
558
642
  }
559
643
  )
@@ -1,4 +1,8 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/components/InfiniteScroll.tsx
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkTDODFBBOjs = require('./chunk-TDODFBBO.js');
4
+
5
+ // src/components/InfiniteScroll.tsx
2
6
  var _react = require('react');
3
7
 
4
8
 
@@ -8,24 +12,32 @@ var _react = require('react');
8
12
 
9
13
 
10
14
 
15
+
16
+
11
17
  var _tigercatcore = require('@expcat/tigercat-core');
12
18
  var _jsxruntime = require('react/jsx-runtime');
13
19
  var InfiniteScroll = ({
14
20
  hasMore = true,
15
21
  loading = false,
16
22
  threshold = 100,
17
- loadingText = "Loading...",
18
- endText = "No more data",
23
+ loadingText,
24
+ endText,
19
25
  direction = "vertical",
20
26
  inverse = false,
21
27
  disabled = false,
22
28
  className,
29
+ locale,
23
30
  children,
24
31
  loader,
25
32
  end,
26
33
  onLoadMore,
27
34
  ...rest
28
35
  }) => {
36
+ const config = _chunkTDODFBBOjs.useTigerConfig.call(void 0, );
37
+ const mergedLocale = _react.useMemo.call(void 0,
38
+ () => _tigercatcore.mergeTigerLocale.call(void 0, config.locale, locale),
39
+ [config.locale, locale]
40
+ );
29
41
  const containerRef = _react.useRef.call(void 0, null);
30
42
  const sentinelRef = _react.useRef.call(void 0, null);
31
43
  const containerClasses = _react.useMemo.call(void 0,
@@ -74,8 +86,8 @@ var InfiniteScroll = ({
74
86
  style: { height: 0, overflow: "hidden" }
75
87
  }
76
88
  ) : null;
77
- const loaderEl = loading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.infiniteScrollLoaderClasses, role: "status", "aria-live": "polite", children: _nullishCoalesce(loader, () => ( loadingText)) }) : null;
78
- const endEl = !hasMore && !loading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.infiniteScrollEndClasses, children: _nullishCoalesce(end, () => ( endText)) }) : null;
89
+ const loaderEl = loading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.infiniteScrollLoaderClasses, role: "status", "aria-live": "polite", children: _nullishCoalesce(loader, () => ( _tigercatcore.resolveLocaleText.call(void 0, "Loading...", loadingText, _optionalChain([mergedLocale, 'optionalAccess', _5 => _5.common, 'optionalAccess', _6 => _6.loadingText])))) }) : null;
90
+ const endEl = !hasMore && !loading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.infiniteScrollEndClasses, children: _nullishCoalesce(end, () => ( _tigercatcore.resolveLocaleText.call(void 0, "No more data", endText, _optionalChain([mergedLocale, 'optionalAccess', _7 => _7.common, 'optionalAccess', _8 => _8.noMoreText])))) }) : null;
79
91
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: containerRef, className: _tigercatcore.classNames.call(void 0, containerClasses), ...rest, children: inverse ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
80
92
  sentinelEl,
81
93
  loaderEl,
@@ -0,0 +1,25 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/hooks/useControlledState.ts
2
+ var _react = require('react');
3
+ function useControlledState(controlledValue, defaultValue, onChange) {
4
+ const [internalValue, setInternalValue] = _react.useState.call(void 0, defaultValue);
5
+ const isControlled = controlledValue !== void 0;
6
+ const value = isControlled ? controlledValue : internalValue;
7
+ const valueRef = _react.useRef.call(void 0, value);
8
+ valueRef.current = value;
9
+ const isControlledRef = _react.useRef.call(void 0, isControlled);
10
+ isControlledRef.current = isControlled;
11
+ const onChangeRef = _react.useRef.call(void 0, onChange);
12
+ onChangeRef.current = onChange;
13
+ const setValue = _react.useCallback.call(void 0, (next, ...args) => {
14
+ const resolved = typeof next === "function" ? next(valueRef.current) : next;
15
+ if (!isControlledRef.current) {
16
+ setInternalValue(resolved);
17
+ }
18
+ _optionalChain([onChangeRef, 'access', _ => _.current, 'optionalCall', _2 => _2(resolved, ...args)]);
19
+ }, []);
20
+ return [value, setValue];
21
+ }
22
+
23
+
24
+
25
+ exports.useControlledState = useControlledState;