@expcat/tigercat-react 0.0.1

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 (382) hide show
  1. package/LICENSE +21 -0
  2. package/dist/chunk-2DOPHSZP.js +32 -0
  3. package/dist/chunk-2TS6X5RA.js +73 -0
  4. package/dist/chunk-2Y327ZU4.js +493 -0
  5. package/dist/chunk-3GD3LOII.mjs +23 -0
  6. package/dist/chunk-3OF7XPIQ.js +90 -0
  7. package/dist/chunk-3WPKVV4N.js +140 -0
  8. package/dist/chunk-3XXXM4OB.mjs +203 -0
  9. package/dist/chunk-427CM2U6.mjs +76 -0
  10. package/dist/chunk-472D2S4R.mjs +23 -0
  11. package/dist/chunk-5FRENLDC.js +194 -0
  12. package/dist/chunk-5HUYCSA4.mjs +77 -0
  13. package/dist/chunk-5QKMQRCW.js +89 -0
  14. package/dist/chunk-5ZVSFIZD.js +50 -0
  15. package/dist/chunk-6575DOCV.mjs +117 -0
  16. package/dist/chunk-672SCJWZ.mjs +88 -0
  17. package/dist/chunk-6MGEGOYJ.js +108 -0
  18. package/dist/chunk-6PUSRC6S.js +68 -0
  19. package/dist/chunk-6YDIBMCM.mjs +33 -0
  20. package/dist/chunk-72ZRDBXN.js +25 -0
  21. package/dist/chunk-77D7VQMG.js +43 -0
  22. package/dist/chunk-7CAJK2ZK.mjs +54 -0
  23. package/dist/chunk-7JQ7LURS.mjs +25 -0
  24. package/dist/chunk-7KRBDT2Z.mjs +269 -0
  25. package/dist/chunk-7O2OQKVY.mjs +10 -0
  26. package/dist/chunk-7OLWGHUR.mjs +169 -0
  27. package/dist/chunk-7P6PHSFM.js +548 -0
  28. package/dist/chunk-ADOPAXPG.mjs +301 -0
  29. package/dist/chunk-AG6GVQ5O.js +271 -0
  30. package/dist/chunk-ALP3KYYY.mjs +47 -0
  31. package/dist/chunk-AQ6DHCP6.js +53 -0
  32. package/dist/chunk-AQQRWISY.js +184 -0
  33. package/dist/chunk-C52ZCGYG.mjs +313 -0
  34. package/dist/chunk-C5EFBJBR.js +540 -0
  35. package/dist/chunk-CES6LGQ7.mjs +546 -0
  36. package/dist/chunk-CKUSQR2H.mjs +41 -0
  37. package/dist/chunk-CR4QK2AB.mjs +88 -0
  38. package/dist/chunk-CTAMMQBC.mjs +297 -0
  39. package/dist/chunk-D3I2SY7X.js +301 -0
  40. package/dist/chunk-DCRVIDMY.mjs +41 -0
  41. package/dist/chunk-DIZNY6N4.mjs +71 -0
  42. package/dist/chunk-DZJUFU55.js +300 -0
  43. package/dist/chunk-EB6EDLJZ.mjs +50 -0
  44. package/dist/chunk-EI2GHMQS.js +37 -0
  45. package/dist/chunk-ENR3RIMM.js +205 -0
  46. package/dist/chunk-EQWQXURG.js +18 -0
  47. package/dist/chunk-EUHWE7MN.js +267 -0
  48. package/dist/chunk-FAKTU64M.js +67 -0
  49. package/dist/chunk-FQ6UHRAO.js +499 -0
  50. package/dist/chunk-G6FSHN2I.mjs +111 -0
  51. package/dist/chunk-GIYBVWR4.mjs +213 -0
  52. package/dist/chunk-HDDBBZQH.js +321 -0
  53. package/dist/chunk-HQLZL3XQ.mjs +48 -0
  54. package/dist/chunk-HQXZVTP4.mjs +199 -0
  55. package/dist/chunk-HUMGEP7S.mjs +17 -0
  56. package/dist/chunk-IFY46RWU.js +25 -0
  57. package/dist/chunk-IQINYCU6.js +99 -0
  58. package/dist/chunk-IWENGARY.mjs +32 -0
  59. package/dist/chunk-IY4LEJYF.js +78 -0
  60. package/dist/chunk-JW64IJP2.js +210 -0
  61. package/dist/chunk-K7ZMB2TH.mjs +696 -0
  62. package/dist/chunk-KAEHFMTQ.mjs +537 -0
  63. package/dist/chunk-KMQOLVWP.mjs +65 -0
  64. package/dist/chunk-KUCFT2OA.js +43 -0
  65. package/dist/chunk-LADCWARG.mjs +97 -0
  66. package/dist/chunk-LAZGEMA2.mjs +176 -0
  67. package/dist/chunk-LNKI6HQ3.js +152 -0
  68. package/dist/chunk-LXA2YBAO.js +38 -0
  69. package/dist/chunk-MKWXJZ3T.js +74 -0
  70. package/dist/chunk-MQXBU5YX.mjs +87 -0
  71. package/dist/chunk-NEULKOYJ.js +48 -0
  72. package/dist/chunk-NI2WNZRT.js +38 -0
  73. package/dist/chunk-NOOPXNR4.mjs +36 -0
  74. package/dist/chunk-NSGDRTSQ.mjs +138 -0
  75. package/dist/chunk-O3EUFIOS.mjs +142 -0
  76. package/dist/chunk-OCVQ3LOT.mjs +45 -0
  77. package/dist/chunk-OFCKGWTS.js +12 -0
  78. package/dist/chunk-OQTPXPAP.mjs +10 -0
  79. package/dist/chunk-OTRGVENC.js +305 -0
  80. package/dist/chunk-P273E6XE.js +219 -0
  81. package/dist/chunk-PAD2DX5M.mjs +331 -0
  82. package/dist/chunk-PUDU34R4.mjs +106 -0
  83. package/dist/chunk-Q3DPJHNM.js +407 -0
  84. package/dist/chunk-QEAC4MIG.mjs +295 -0
  85. package/dist/chunk-QFVE7GKD.js +109 -0
  86. package/dist/chunk-QL6OBKEN.js +84 -0
  87. package/dist/chunk-QL6UEG3U.js +27 -0
  88. package/dist/chunk-QN7NIX7D.mjs +82 -0
  89. package/dist/chunk-QORSSZX4.js +144 -0
  90. package/dist/chunk-R4JSBXGG.js +12 -0
  91. package/dist/chunk-R5BQHZWB.js +698 -0
  92. package/dist/chunk-R7MS42PL.js +90 -0
  93. package/dist/chunk-RTQNWZN4.mjs +405 -0
  94. package/dist/chunk-SIVJX7VU.mjs +16 -0
  95. package/dist/chunk-SJ5RFU2O.mjs +17 -0
  96. package/dist/chunk-T4TJJMLM.mjs +34 -0
  97. package/dist/chunk-TB2UHDOZ.js +19 -0
  98. package/dist/chunk-TBIEWDY5.js +175 -0
  99. package/dist/chunk-TJFS44SH.js +48 -0
  100. package/dist/chunk-TR246HQP.mjs +69 -0
  101. package/dist/chunk-TZ26HQAW.js +85 -0
  102. package/dist/chunk-U4ZVEPYD.js +71 -0
  103. package/dist/chunk-UFAXJVMD.js +120 -0
  104. package/dist/chunk-V2HVHLBY.mjs +83 -0
  105. package/dist/chunk-VD3IK5XT.mjs +35 -0
  106. package/dist/chunk-VEGBO77D.mjs +20 -0
  107. package/dist/chunk-VJJ76I7U.js +19 -0
  108. package/dist/chunk-VO4WDK4K.js +37 -0
  109. package/dist/chunk-VSF4DF7N.js +84 -0
  110. package/dist/chunk-VVO4V4IK.js +56 -0
  111. package/dist/chunk-W7HUFFPJ.mjs +263 -0
  112. package/dist/chunk-WDAMDVLU.mjs +106 -0
  113. package/dist/chunk-WEGU7O4J.mjs +66 -0
  114. package/dist/chunk-WK5HN4OH.js +113 -0
  115. package/dist/chunk-WSCSDSV7.mjs +145 -0
  116. package/dist/chunk-WSJO2PIE.mjs +72 -0
  117. package/dist/chunk-XDKXL2BP.mjs +188 -0
  118. package/dist/chunk-XS5JP2KO.mjs +491 -0
  119. package/dist/chunk-XZDJ5FRB.js +333 -0
  120. package/dist/chunk-YE2M2HNM.js +168 -0
  121. package/dist/chunk-YYGTJKP5.js +39 -0
  122. package/dist/chunk-YYKJ63LD.mjs +497 -0
  123. package/dist/chunk-Z4Z3I74Q.mjs +166 -0
  124. package/dist/chunk-ZO4XVOHU.mjs +45 -0
  125. package/dist/chunk-ZREFCRX3.js +52 -0
  126. package/dist/components/Alert.d.mts +24 -0
  127. package/dist/components/Alert.d.ts +24 -0
  128. package/dist/components/Alert.js +10 -0
  129. package/dist/components/Alert.mjs +1 -0
  130. package/dist/components/Avatar.d.mts +12 -0
  131. package/dist/components/Avatar.d.ts +12 -0
  132. package/dist/components/Avatar.js +10 -0
  133. package/dist/components/Avatar.mjs +1 -0
  134. package/dist/components/Badge.d.mts +12 -0
  135. package/dist/components/Badge.d.ts +12 -0
  136. package/dist/components/Badge.js +10 -0
  137. package/dist/components/Badge.mjs +1 -0
  138. package/dist/components/Breadcrumb.d.mts +13 -0
  139. package/dist/components/Breadcrumb.d.ts +13 -0
  140. package/dist/components/Breadcrumb.js +14 -0
  141. package/dist/components/Breadcrumb.mjs +1 -0
  142. package/dist/components/BreadcrumbItem.d.mts +21 -0
  143. package/dist/components/BreadcrumbItem.d.ts +21 -0
  144. package/dist/components/BreadcrumbItem.js +11 -0
  145. package/dist/components/BreadcrumbItem.mjs +2 -0
  146. package/dist/components/Button.d.mts +8 -0
  147. package/dist/components/Button.d.ts +8 -0
  148. package/dist/components/Button.js +10 -0
  149. package/dist/components/Button.mjs +1 -0
  150. package/dist/components/Card.d.mts +33 -0
  151. package/dist/components/Card.d.ts +33 -0
  152. package/dist/components/Card.js +10 -0
  153. package/dist/components/Card.mjs +1 -0
  154. package/dist/components/Checkbox.d.mts +48 -0
  155. package/dist/components/Checkbox.d.ts +48 -0
  156. package/dist/components/Checkbox.js +11 -0
  157. package/dist/components/Checkbox.mjs +2 -0
  158. package/dist/components/CheckboxGroup.d.mts +39 -0
  159. package/dist/components/CheckboxGroup.d.ts +39 -0
  160. package/dist/components/CheckboxGroup.js +14 -0
  161. package/dist/components/CheckboxGroup.mjs +1 -0
  162. package/dist/components/Col.d.mts +7 -0
  163. package/dist/components/Col.d.ts +7 -0
  164. package/dist/components/Col.js +11 -0
  165. package/dist/components/Col.mjs +2 -0
  166. package/dist/components/ConfigProvider.d.mts +14 -0
  167. package/dist/components/ConfigProvider.d.ts +14 -0
  168. package/dist/components/ConfigProvider.js +14 -0
  169. package/dist/components/ConfigProvider.mjs +1 -0
  170. package/dist/components/Container.d.mts +13 -0
  171. package/dist/components/Container.d.ts +13 -0
  172. package/dist/components/Container.js +10 -0
  173. package/dist/components/Container.mjs +1 -0
  174. package/dist/components/Content.d.mts +9 -0
  175. package/dist/components/Content.d.ts +9 -0
  176. package/dist/components/Content.js +10 -0
  177. package/dist/components/Content.mjs +1 -0
  178. package/dist/components/DatePicker.d.mts +24 -0
  179. package/dist/components/DatePicker.d.ts +24 -0
  180. package/dist/components/DatePicker.js +10 -0
  181. package/dist/components/DatePicker.mjs +1 -0
  182. package/dist/components/Descriptions.d.mts +53 -0
  183. package/dist/components/Descriptions.d.ts +53 -0
  184. package/dist/components/Descriptions.js +16 -0
  185. package/dist/components/Descriptions.mjs +1 -0
  186. package/dist/components/Divider.d.mts +12 -0
  187. package/dist/components/Divider.d.ts +12 -0
  188. package/dist/components/Divider.js +10 -0
  189. package/dist/components/Divider.mjs +1 -0
  190. package/dist/components/Drawer.d.mts +19 -0
  191. package/dist/components/Drawer.d.ts +19 -0
  192. package/dist/components/Drawer.js +11 -0
  193. package/dist/components/Drawer.mjs +2 -0
  194. package/dist/components/Dropdown.d.mts +22 -0
  195. package/dist/components/Dropdown.d.ts +22 -0
  196. package/dist/components/Dropdown.js +16 -0
  197. package/dist/components/Dropdown.mjs +3 -0
  198. package/dist/components/DropdownItem.d.mts +17 -0
  199. package/dist/components/DropdownItem.d.ts +17 -0
  200. package/dist/components/DropdownItem.js +13 -0
  201. package/dist/components/DropdownItem.mjs +4 -0
  202. package/dist/components/DropdownMenu.d.mts +13 -0
  203. package/dist/components/DropdownMenu.d.ts +13 -0
  204. package/dist/components/DropdownMenu.js +10 -0
  205. package/dist/components/DropdownMenu.mjs +1 -0
  206. package/dist/components/Footer.d.mts +9 -0
  207. package/dist/components/Footer.d.ts +9 -0
  208. package/dist/components/Footer.js +10 -0
  209. package/dist/components/Footer.mjs +1 -0
  210. package/dist/components/Form.d.mts +56 -0
  211. package/dist/components/Form.d.ts +56 -0
  212. package/dist/components/Form.js +14 -0
  213. package/dist/components/Form.mjs +1 -0
  214. package/dist/components/FormItem.d.mts +16 -0
  215. package/dist/components/FormItem.d.ts +16 -0
  216. package/dist/components/FormItem.js +11 -0
  217. package/dist/components/FormItem.mjs +2 -0
  218. package/dist/components/Header.d.mts +9 -0
  219. package/dist/components/Header.d.ts +9 -0
  220. package/dist/components/Header.js +10 -0
  221. package/dist/components/Header.mjs +1 -0
  222. package/dist/components/Icon.d.mts +9 -0
  223. package/dist/components/Icon.d.ts +9 -0
  224. package/dist/components/Icon.js +10 -0
  225. package/dist/components/Icon.mjs +1 -0
  226. package/dist/components/Input.d.mts +28 -0
  227. package/dist/components/Input.d.ts +28 -0
  228. package/dist/components/Input.js +10 -0
  229. package/dist/components/Input.mjs +1 -0
  230. package/dist/components/Layout.d.mts +9 -0
  231. package/dist/components/Layout.d.ts +9 -0
  232. package/dist/components/Layout.js +10 -0
  233. package/dist/components/Layout.mjs +1 -0
  234. package/dist/components/Link.d.mts +10 -0
  235. package/dist/components/Link.d.ts +10 -0
  236. package/dist/components/Link.js +10 -0
  237. package/dist/components/Link.mjs +1 -0
  238. package/dist/components/List.d.mts +94 -0
  239. package/dist/components/List.d.ts +94 -0
  240. package/dist/components/List.js +12 -0
  241. package/dist/components/List.mjs +3 -0
  242. package/dist/components/Loading.d.mts +8 -0
  243. package/dist/components/Loading.d.ts +8 -0
  244. package/dist/components/Loading.js +10 -0
  245. package/dist/components/Loading.mjs +1 -0
  246. package/dist/components/Menu.d.mts +35 -0
  247. package/dist/components/Menu.d.ts +35 -0
  248. package/dist/components/Menu.js +14 -0
  249. package/dist/components/Menu.mjs +1 -0
  250. package/dist/components/MenuItem.d.mts +20 -0
  251. package/dist/components/MenuItem.d.ts +20 -0
  252. package/dist/components/MenuItem.js +11 -0
  253. package/dist/components/MenuItem.mjs +2 -0
  254. package/dist/components/MenuItemGroup.d.mts +16 -0
  255. package/dist/components/MenuItemGroup.d.ts +16 -0
  256. package/dist/components/MenuItemGroup.js +12 -0
  257. package/dist/components/MenuItemGroup.mjs +3 -0
  258. package/dist/components/Message.d.mts +44 -0
  259. package/dist/components/Message.d.ts +44 -0
  260. package/dist/components/Message.js +20 -0
  261. package/dist/components/Message.mjs +1 -0
  262. package/dist/components/Modal.d.mts +41 -0
  263. package/dist/components/Modal.d.ts +41 -0
  264. package/dist/components/Modal.js +11 -0
  265. package/dist/components/Modal.mjs +2 -0
  266. package/dist/components/Notification.d.mts +40 -0
  267. package/dist/components/Notification.d.ts +40 -0
  268. package/dist/components/Notification.js +20 -0
  269. package/dist/components/Notification.mjs +1 -0
  270. package/dist/components/Pagination.d.mts +11 -0
  271. package/dist/components/Pagination.d.ts +11 -0
  272. package/dist/components/Pagination.js +16 -0
  273. package/dist/components/Pagination.mjs +1 -0
  274. package/dist/components/Popconfirm.d.mts +34 -0
  275. package/dist/components/Popconfirm.d.ts +34 -0
  276. package/dist/components/Popconfirm.js +10 -0
  277. package/dist/components/Popconfirm.mjs +1 -0
  278. package/dist/components/Popover.d.mts +14 -0
  279. package/dist/components/Popover.d.ts +14 -0
  280. package/dist/components/Popover.js +10 -0
  281. package/dist/components/Popover.mjs +1 -0
  282. package/dist/components/Progress.d.mts +8 -0
  283. package/dist/components/Progress.d.ts +8 -0
  284. package/dist/components/Progress.js +10 -0
  285. package/dist/components/Progress.mjs +1 -0
  286. package/dist/components/Radio.d.mts +20 -0
  287. package/dist/components/Radio.d.ts +20 -0
  288. package/dist/components/Radio.js +11 -0
  289. package/dist/components/Radio.mjs +2 -0
  290. package/dist/components/RadioGroup.d.mts +28 -0
  291. package/dist/components/RadioGroup.d.ts +28 -0
  292. package/dist/components/RadioGroup.js +14 -0
  293. package/dist/components/RadioGroup.mjs +1 -0
  294. package/dist/components/Row.d.mts +11 -0
  295. package/dist/components/Row.d.ts +11 -0
  296. package/dist/components/Row.js +14 -0
  297. package/dist/components/Row.mjs +1 -0
  298. package/dist/components/Select.d.mts +23 -0
  299. package/dist/components/Select.d.ts +23 -0
  300. package/dist/components/Select.js +10 -0
  301. package/dist/components/Select.mjs +1 -0
  302. package/dist/components/Sidebar.d.mts +9 -0
  303. package/dist/components/Sidebar.d.ts +9 -0
  304. package/dist/components/Sidebar.js +10 -0
  305. package/dist/components/Sidebar.mjs +1 -0
  306. package/dist/components/Skeleton.d.mts +7 -0
  307. package/dist/components/Skeleton.d.ts +7 -0
  308. package/dist/components/Skeleton.js +10 -0
  309. package/dist/components/Skeleton.mjs +1 -0
  310. package/dist/components/Slider.d.mts +12 -0
  311. package/dist/components/Slider.d.ts +12 -0
  312. package/dist/components/Slider.js +10 -0
  313. package/dist/components/Slider.mjs +1 -0
  314. package/dist/components/Space.d.mts +11 -0
  315. package/dist/components/Space.d.ts +11 -0
  316. package/dist/components/Space.js +10 -0
  317. package/dist/components/Space.mjs +1 -0
  318. package/dist/components/Steps.d.mts +31 -0
  319. package/dist/components/Steps.d.ts +31 -0
  320. package/dist/components/Steps.js +14 -0
  321. package/dist/components/Steps.mjs +1 -0
  322. package/dist/components/StepsItem.d.mts +36 -0
  323. package/dist/components/StepsItem.d.ts +36 -0
  324. package/dist/components/StepsItem.js +10 -0
  325. package/dist/components/StepsItem.mjs +1 -0
  326. package/dist/components/SubMenu.d.mts +20 -0
  327. package/dist/components/SubMenu.d.ts +20 -0
  328. package/dist/components/SubMenu.js +13 -0
  329. package/dist/components/SubMenu.mjs +4 -0
  330. package/dist/components/Switch.d.mts +12 -0
  331. package/dist/components/Switch.d.ts +12 -0
  332. package/dist/components/Switch.js +10 -0
  333. package/dist/components/Switch.mjs +1 -0
  334. package/dist/components/TabPane.d.mts +42 -0
  335. package/dist/components/TabPane.d.ts +42 -0
  336. package/dist/components/TabPane.js +10 -0
  337. package/dist/components/TabPane.mjs +1 -0
  338. package/dist/components/Table.d.mts +46 -0
  339. package/dist/components/Table.d.ts +46 -0
  340. package/dist/components/Table.js +10 -0
  341. package/dist/components/Table.mjs +1 -0
  342. package/dist/components/Tabs.d.mts +43 -0
  343. package/dist/components/Tabs.d.ts +43 -0
  344. package/dist/components/Tabs.js +14 -0
  345. package/dist/components/Tabs.mjs +1 -0
  346. package/dist/components/Tag.d.mts +16 -0
  347. package/dist/components/Tag.d.ts +16 -0
  348. package/dist/components/Tag.js +10 -0
  349. package/dist/components/Tag.mjs +1 -0
  350. package/dist/components/Text.d.mts +9 -0
  351. package/dist/components/Text.d.ts +9 -0
  352. package/dist/components/Text.js +10 -0
  353. package/dist/components/Text.mjs +1 -0
  354. package/dist/components/Textarea.d.mts +13 -0
  355. package/dist/components/Textarea.d.ts +13 -0
  356. package/dist/components/Textarea.js +10 -0
  357. package/dist/components/Textarea.mjs +1 -0
  358. package/dist/components/TimePicker.d.mts +28 -0
  359. package/dist/components/TimePicker.d.ts +28 -0
  360. package/dist/components/TimePicker.js +10 -0
  361. package/dist/components/TimePicker.mjs +1 -0
  362. package/dist/components/Timeline.d.mts +47 -0
  363. package/dist/components/Timeline.d.ts +47 -0
  364. package/dist/components/Timeline.js +10 -0
  365. package/dist/components/Timeline.mjs +1 -0
  366. package/dist/components/Tooltip.d.mts +15 -0
  367. package/dist/components/Tooltip.d.ts +15 -0
  368. package/dist/components/Tooltip.js +10 -0
  369. package/dist/components/Tooltip.mjs +1 -0
  370. package/dist/components/Tree.d.mts +154 -0
  371. package/dist/components/Tree.d.ts +154 -0
  372. package/dist/components/Tree.js +16 -0
  373. package/dist/components/Tree.mjs +1 -0
  374. package/dist/components/Upload.d.mts +16 -0
  375. package/dist/components/Upload.d.ts +16 -0
  376. package/dist/components/Upload.js +11 -0
  377. package/dist/components/Upload.mjs +2 -0
  378. package/dist/index.d.mts +76 -0
  379. package/dist/index.d.ts +76 -0
  380. package/dist/index.js +359 -0
  381. package/dist/index.mjs +67 -0
  382. package/package.json +60 -0
@@ -0,0 +1,546 @@
1
+ import { useState, useRef, useEffect } from 'react';
2
+ import { parseTime, to12HourFormat, getTimePickerLabels, getTimePeriodLabels, formatTimeDisplayWithLocale, generateHours, generateMinutes, generateSeconds, getTimePickerInputClasses, getTimePickerIconButtonClasses, classNames, timePickerInputWrapperClasses, timePickerClearButtonClasses, TimePickerCloseIconPath, ClockIconPath, timePickerPanelClasses, timePickerRangeHeaderClasses, getTimePickerRangeTabButtonClasses, timePickerPanelContentClasses, timePickerColumnClasses, timePickerColumnHeaderClasses, timePickerColumnListClasses, to24HourFormat, getTimePickerOptionAriaLabel, getTimePickerItemClasses, getTimePickerPeriodButtonClasses, timePickerFooterClasses, timePickerFooterButtonClasses, timePickerBaseClasses, isTimeInRange, formatTime, getCurrentTime, icon20ViewBox } from '@expcat/tigercat-core';
3
+ import { jsxs, jsx } from 'react/jsx-runtime';
4
+
5
+ // src/components/TimePicker.tsx
6
+ var Icon = ({ path, className }) => /* @__PURE__ */ jsx(
7
+ "svg",
8
+ {
9
+ className,
10
+ xmlns: "http://www.w3.org/2000/svg",
11
+ viewBox: icon20ViewBox,
12
+ fill: "currentColor",
13
+ children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: path, clipRule: "evenodd" })
14
+ }
15
+ );
16
+ var TimePicker = (allProps) => {
17
+ const {
18
+ size = "md",
19
+ format = "24",
20
+ showSeconds = false,
21
+ hourStep = 1,
22
+ minuteStep = 1,
23
+ secondStep = 1,
24
+ disabled = false,
25
+ readonly = false,
26
+ required = false,
27
+ minTime,
28
+ maxTime,
29
+ clearable = true,
30
+ name,
31
+ id,
32
+ className,
33
+ onClear,
34
+ locale,
35
+ labels: labelsOverrides,
36
+ value,
37
+ defaultValue,
38
+ range,
39
+ ...restProps
40
+ } = allProps;
41
+ const divProps = (({ onChange: _omitOnChange, ...rest }) => rest)(restProps);
42
+ const isRangeMode = range === true;
43
+ const [isOpen, setIsOpen] = useState(false);
44
+ const [internalSingleValue, setInternalSingleValue] = useState(() => {
45
+ if (isRangeMode) return null;
46
+ const dv = defaultValue;
47
+ if (typeof dv === "string" || dv === null || dv === void 0) return dv ?? null;
48
+ return null;
49
+ });
50
+ const [internalRangeValue, setInternalRangeValue] = useState(() => {
51
+ const dv = defaultValue;
52
+ if (Array.isArray(dv)) return [dv[0] ?? null, dv[1] ?? null];
53
+ return [null, null];
54
+ });
55
+ const [activePart, setActivePart] = useState("start");
56
+ const panelRef = useRef(null);
57
+ const inputWrapperRef = useRef(null);
58
+ const inputRef = useRef(null);
59
+ const normalizeRangeValue = (input) => {
60
+ if (Array.isArray(input)) return [input[0] ?? null, input[1] ?? null];
61
+ return [null, null];
62
+ };
63
+ const isControlled = value !== void 0;
64
+ const currentSingleValue = (() => {
65
+ if (isRangeMode) return null;
66
+ const v = value;
67
+ if (isControlled && (typeof v === "string" || v === null)) return v;
68
+ return internalSingleValue;
69
+ })();
70
+ const currentRangeValue = (() => {
71
+ if (!isRangeMode) return [null, null];
72
+ if (isControlled) return normalizeRangeValue(value);
73
+ return internalRangeValue;
74
+ })();
75
+ const activeValue = isRangeMode ? currentRangeValue[activePart === "start" ? 0 : 1] : currentSingleValue;
76
+ const parsedTime = parseTime(activeValue);
77
+ const [selectedHours, setSelectedHours] = useState(parsedTime?.hours ?? 0);
78
+ const [selectedMinutes, setSelectedMinutes] = useState(parsedTime?.minutes ?? 0);
79
+ const [selectedSeconds, setSelectedSeconds] = useState(parsedTime?.seconds ?? 0);
80
+ const [selectedPeriod, setSelectedPeriod] = useState("AM");
81
+ useEffect(() => {
82
+ const parsed = parseTime(activeValue);
83
+ if (parsed) {
84
+ setSelectedHours(parsed.hours);
85
+ setSelectedMinutes(parsed.minutes);
86
+ setSelectedSeconds(parsed.seconds);
87
+ if (format === "12") {
88
+ const { period } = to12HourFormat(parsed.hours);
89
+ setSelectedPeriod(period);
90
+ }
91
+ }
92
+ }, [activeValue, format, activePart, isRangeMode]);
93
+ const labels = getTimePickerLabels(locale, labelsOverrides);
94
+ const placeholder = allProps.placeholder ?? (isRangeMode ? labels.selectTimeRange : labels.selectTime);
95
+ const periodLabels = getTimePeriodLabels(locale);
96
+ const singleDisplayValue = parsedTime ? formatTimeDisplayWithLocale(
97
+ parsedTime.hours,
98
+ parsedTime.minutes,
99
+ parsedTime.seconds,
100
+ format,
101
+ showSeconds,
102
+ locale
103
+ ) : "";
104
+ const displayValue = (() => {
105
+ if (!isRangeMode) return singleDisplayValue;
106
+ const toDisplay = (timeStr) => {
107
+ const parsed = parseTime(timeStr);
108
+ if (!parsed) return "";
109
+ return formatTimeDisplayWithLocale(
110
+ parsed.hours,
111
+ parsed.minutes,
112
+ parsed.seconds,
113
+ format,
114
+ showSeconds,
115
+ locale
116
+ );
117
+ };
118
+ const start = toDisplay(currentRangeValue[0]);
119
+ const end = toDisplay(currentRangeValue[1]);
120
+ if (!start && !end) return "";
121
+ return `${start} - ${end}`;
122
+ })();
123
+ const showClearButton = (() => {
124
+ if (!clearable || disabled || readonly) return false;
125
+ if (!isRangeMode) return currentSingleValue !== null;
126
+ return currentRangeValue[0] !== null || currentRangeValue[1] !== null;
127
+ })();
128
+ const hoursList = generateHours(hourStep, format);
129
+ const minutesList = generateMinutes(minuteStep);
130
+ const secondsList = generateSeconds(secondStep);
131
+ const togglePanel = () => {
132
+ if (!disabled && !readonly) {
133
+ if (isOpen) {
134
+ closePanel();
135
+ return;
136
+ }
137
+ setIsOpen(true);
138
+ if (parsedTime) {
139
+ setSelectedHours(parsedTime.hours);
140
+ setSelectedMinutes(parsedTime.minutes);
141
+ setSelectedSeconds(parsedTime.seconds);
142
+ if (format === "12") {
143
+ const { period } = to12HourFormat(parsedTime.hours);
144
+ setSelectedPeriod(period);
145
+ }
146
+ }
147
+ }
148
+ };
149
+ const closePanel = () => {
150
+ setIsOpen(false);
151
+ inputRef.current?.focus();
152
+ };
153
+ const focusOptionInUnit = (unit, action) => {
154
+ const panel = panelRef.current;
155
+ if (!panel) return;
156
+ const nodes = Array.from(
157
+ panel.querySelectorAll(`button[data-tiger-timepicker-unit="${unit}"]`)
158
+ ).filter((button) => !button.disabled);
159
+ if (nodes.length === 0) return;
160
+ const active = document.activeElement;
161
+ const activeIndex = active ? nodes.indexOf(active) : -1;
162
+ const selectedIndex = nodes.findIndex(
163
+ (button) => button.getAttribute("aria-selected") === "true"
164
+ );
165
+ const baseIndex = activeIndex >= 0 ? activeIndex : Math.max(0, selectedIndex);
166
+ let nextIndex = baseIndex;
167
+ if (action === "prev") nextIndex = Math.max(0, baseIndex - 1);
168
+ if (action === "next") nextIndex = Math.min(nodes.length - 1, baseIndex + 1);
169
+ if (action === "first") nextIndex = 0;
170
+ if (action === "last") nextIndex = nodes.length - 1;
171
+ nodes[nextIndex]?.focus();
172
+ };
173
+ const handlePanelKeyDown = (event) => {
174
+ if (event.key === "Escape") {
175
+ event.preventDefault();
176
+ closePanel();
177
+ return;
178
+ }
179
+ const active = document.activeElement;
180
+ const unit = active?.getAttribute("data-tiger-timepicker-unit");
181
+ if (!unit) return;
182
+ if (event.key === "ArrowUp") {
183
+ event.preventDefault();
184
+ focusOptionInUnit(unit, "prev");
185
+ return;
186
+ }
187
+ if (event.key === "ArrowDown") {
188
+ event.preventDefault();
189
+ focusOptionInUnit(unit, "next");
190
+ return;
191
+ }
192
+ if (event.key === "Home") {
193
+ event.preventDefault();
194
+ focusOptionInUnit(unit, "first");
195
+ return;
196
+ }
197
+ if (event.key === "End") {
198
+ event.preventDefault();
199
+ focusOptionInUnit(unit, "last");
200
+ return;
201
+ }
202
+ if (event.key === "Enter" || event.key === " ") {
203
+ const el = document.activeElement;
204
+ if (el && el.tagName === "BUTTON" && !el.disabled) {
205
+ event.preventDefault();
206
+ el.click();
207
+ }
208
+ }
209
+ };
210
+ const selectHour = (hour) => {
211
+ const hours24 = format === "12" ? to24HourFormat(hour, selectedPeriod) : hour;
212
+ setSelectedHours(hours24);
213
+ updateTime(hours24, selectedMinutes, selectedSeconds);
214
+ };
215
+ const selectMinute = (minute) => {
216
+ setSelectedMinutes(minute);
217
+ updateTime(selectedHours, minute, selectedSeconds);
218
+ };
219
+ const selectSecond = (second) => {
220
+ setSelectedSeconds(second);
221
+ updateTime(selectedHours, selectedMinutes, second);
222
+ };
223
+ const selectPeriod = (period) => {
224
+ setSelectedPeriod(period);
225
+ const { hours: hours12 } = to12HourFormat(selectedHours);
226
+ const hours24 = to24HourFormat(hours12, period);
227
+ setSelectedHours(hours24);
228
+ updateTime(hours24, selectedMinutes, selectedSeconds);
229
+ };
230
+ const updateTime = (hours, minutes, seconds) => {
231
+ if (!isTimeInRange(hours, minutes, minTime, maxTime)) {
232
+ return;
233
+ }
234
+ let timeString = formatTime(hours, minutes, seconds, showSeconds);
235
+ if (allProps.range !== true) {
236
+ if (!isControlled) {
237
+ setInternalSingleValue(timeString);
238
+ }
239
+ allProps.onChange?.(timeString);
240
+ return;
241
+ }
242
+ const index = activePart === "start" ? 0 : 1;
243
+ const parsedStart = parseTime(currentRangeValue[0]);
244
+ const parsedEnd = parseTime(currentRangeValue[1]);
245
+ const candidateSeconds = hours * 3600 + minutes * 60 + seconds;
246
+ const startSeconds = parsedStart ? parsedStart.hours * 3600 + parsedStart.minutes * 60 + parsedStart.seconds : null;
247
+ const endSeconds = parsedEnd ? parsedEnd.hours * 3600 + parsedEnd.minutes * 60 + parsedEnd.seconds : null;
248
+ if (activePart === "end" && parsedStart && startSeconds !== null) {
249
+ if (candidateSeconds < startSeconds) {
250
+ timeString = formatTime(
251
+ parsedStart.hours,
252
+ parsedStart.minutes,
253
+ parsedStart.seconds,
254
+ showSeconds
255
+ );
256
+ setSelectedHours(parsedStart.hours);
257
+ setSelectedMinutes(parsedStart.minutes);
258
+ setSelectedSeconds(parsedStart.seconds);
259
+ if (format === "12") {
260
+ const { period } = to12HourFormat(parsedStart.hours);
261
+ setSelectedPeriod(period);
262
+ }
263
+ }
264
+ }
265
+ const nextRange = [currentRangeValue[0], currentRangeValue[1]];
266
+ nextRange[index] = timeString;
267
+ if (activePart === "start" && endSeconds !== null && candidateSeconds > endSeconds) {
268
+ nextRange[1] = timeString;
269
+ }
270
+ if (!isControlled) {
271
+ setInternalRangeValue(nextRange);
272
+ }
273
+ allProps.onChange?.(nextRange);
274
+ if (activePart === "start" && nextRange[1] === null) {
275
+ setActivePart("end");
276
+ }
277
+ };
278
+ const clearTime = (event) => {
279
+ event.stopPropagation();
280
+ if (allProps.range !== true) {
281
+ if (!isControlled) {
282
+ setInternalSingleValue(null);
283
+ }
284
+ allProps.onChange?.(null);
285
+ onClear?.();
286
+ return;
287
+ }
288
+ const cleared = [null, null];
289
+ if (!isControlled) {
290
+ setInternalRangeValue(cleared);
291
+ }
292
+ allProps.onChange?.(cleared);
293
+ onClear?.();
294
+ };
295
+ const setNow = () => {
296
+ const now = getCurrentTime(showSeconds);
297
+ const parsed = parseTime(now);
298
+ if (parsed) {
299
+ setSelectedHours(parsed.hours);
300
+ setSelectedMinutes(parsed.minutes);
301
+ setSelectedSeconds(parsed.seconds);
302
+ if (format === "12") {
303
+ const { period } = to12HourFormat(parsed.hours);
304
+ setSelectedPeriod(period);
305
+ }
306
+ updateTime(parsed.hours, parsed.minutes, parsed.seconds);
307
+ }
308
+ };
309
+ const isHourDisabled = (hour) => {
310
+ const hours24 = format === "12" ? to24HourFormat(hour, selectedPeriod) : hour;
311
+ return !isTimeInRange(hours24, selectedMinutes, minTime, maxTime);
312
+ };
313
+ const isMinuteDisabled = (minute) => {
314
+ return !isTimeInRange(selectedHours, minute, minTime, maxTime);
315
+ };
316
+ const handleInputClick = () => {
317
+ togglePanel();
318
+ };
319
+ useEffect(() => {
320
+ const handleClickOutside = (event) => {
321
+ if (panelRef.current && inputWrapperRef.current && !panelRef.current.contains(event.target) && !inputWrapperRef.current.contains(event.target)) {
322
+ closePanel();
323
+ }
324
+ };
325
+ if (isOpen) {
326
+ document.addEventListener("click", handleClickOutside);
327
+ return () => {
328
+ document.removeEventListener("click", handleClickOutside);
329
+ };
330
+ }
331
+ }, [isOpen]);
332
+ useEffect(() => {
333
+ if (!isOpen) return;
334
+ const panel = panelRef.current;
335
+ if (!panel) return;
336
+ const focusTimer = window.setTimeout(() => {
337
+ const selectedHour = panel.querySelector(
338
+ 'button[data-tiger-timepicker-unit="hour"][aria-selected="true"]:not([disabled])'
339
+ );
340
+ if (selectedHour) {
341
+ selectedHour.focus();
342
+ return;
343
+ }
344
+ const firstHour = panel.querySelector(
345
+ 'button[data-tiger-timepicker-unit="hour"]:not([disabled])'
346
+ );
347
+ firstHour?.focus();
348
+ }, 0);
349
+ return () => window.clearTimeout(focusTimer);
350
+ }, [isOpen, activePart]);
351
+ const inputClasses = getTimePickerInputClasses(size, disabled || readonly);
352
+ const iconButtonClasses = getTimePickerIconButtonClasses(size);
353
+ return /* @__PURE__ */ jsxs("div", { className: classNames(timePickerBaseClasses, className), ...divProps, children: [
354
+ /* @__PURE__ */ jsxs("div", { ref: inputWrapperRef, className: timePickerInputWrapperClasses, children: [
355
+ /* @__PURE__ */ jsx(
356
+ "input",
357
+ {
358
+ ref: inputRef,
359
+ type: "text",
360
+ className: inputClasses,
361
+ value: displayValue,
362
+ placeholder,
363
+ disabled,
364
+ readOnly: true,
365
+ required,
366
+ name,
367
+ id,
368
+ onClick: handleInputClick,
369
+ "aria-label": placeholder || labels.selectTime
370
+ }
371
+ ),
372
+ showClearButton && /* @__PURE__ */ jsx(
373
+ "button",
374
+ {
375
+ type: "button",
376
+ className: timePickerClearButtonClasses,
377
+ onClick: clearTime,
378
+ "aria-label": labels.clear,
379
+ children: /* @__PURE__ */ jsx(Icon, { path: TimePickerCloseIconPath, className: "w-4 h-4" })
380
+ }
381
+ ),
382
+ /* @__PURE__ */ jsx(
383
+ "button",
384
+ {
385
+ type: "button",
386
+ className: iconButtonClasses,
387
+ disabled: disabled || readonly,
388
+ onClick: togglePanel,
389
+ "aria-label": labels.toggle,
390
+ children: /* @__PURE__ */ jsx(Icon, { path: ClockIconPath, className: "w-5 h-5" })
391
+ }
392
+ )
393
+ ] }),
394
+ isOpen && /* @__PURE__ */ jsxs(
395
+ "div",
396
+ {
397
+ ref: panelRef,
398
+ className: timePickerPanelClasses,
399
+ role: "dialog",
400
+ "aria-label": labels.dialog,
401
+ onKeyDown: handlePanelKeyDown,
402
+ children: [
403
+ isRangeMode && /* @__PURE__ */ jsxs("div", { className: timePickerRangeHeaderClasses, children: [
404
+ /* @__PURE__ */ jsx(
405
+ "button",
406
+ {
407
+ type: "button",
408
+ className: getTimePickerRangeTabButtonClasses(activePart === "start"),
409
+ onClick: () => setActivePart("start"),
410
+ "aria-label": labels.start,
411
+ "aria-selected": activePart === "start",
412
+ children: labels.start
413
+ }
414
+ ),
415
+ /* @__PURE__ */ jsx(
416
+ "button",
417
+ {
418
+ type: "button",
419
+ className: getTimePickerRangeTabButtonClasses(activePart === "end"),
420
+ onClick: () => setActivePart("end"),
421
+ "aria-label": labels.end,
422
+ "aria-selected": activePart === "end",
423
+ children: labels.end
424
+ }
425
+ )
426
+ ] }),
427
+ /* @__PURE__ */ jsxs("div", { className: timePickerPanelContentClasses, children: [
428
+ /* @__PURE__ */ jsxs("div", { className: timePickerColumnClasses, children: [
429
+ /* @__PURE__ */ jsx("div", { className: timePickerColumnHeaderClasses, children: labels.hour }),
430
+ /* @__PURE__ */ jsx("div", { className: timePickerColumnListClasses, children: hoursList.map((hour) => {
431
+ const displayHour = format === "12" ? hour : hour;
432
+ const hours24 = format === "12" ? to24HourFormat(hour, selectedPeriod) : hour;
433
+ const isSelected = selectedHours === hours24;
434
+ const isDisabled = isHourDisabled(hour);
435
+ return /* @__PURE__ */ jsx(
436
+ "button",
437
+ {
438
+ type: "button",
439
+ className: getTimePickerItemClasses(isSelected, isDisabled),
440
+ disabled: isDisabled,
441
+ onClick: () => selectHour(hour),
442
+ "data-tiger-timepicker-unit": "hour",
443
+ "aria-label": getTimePickerOptionAriaLabel(
444
+ displayHour,
445
+ "hour",
446
+ locale,
447
+ labelsOverrides
448
+ ),
449
+ "aria-selected": isSelected,
450
+ children: displayHour.toString().padStart(2, "0")
451
+ },
452
+ hour
453
+ );
454
+ }) })
455
+ ] }),
456
+ /* @__PURE__ */ jsxs("div", { className: timePickerColumnClasses, children: [
457
+ /* @__PURE__ */ jsx("div", { className: timePickerColumnHeaderClasses, children: labels.minute }),
458
+ /* @__PURE__ */ jsx("div", { className: timePickerColumnListClasses, children: minutesList.map((minute) => {
459
+ const isSelected = selectedMinutes === minute;
460
+ const isDisabled = isMinuteDisabled(minute);
461
+ return /* @__PURE__ */ jsx(
462
+ "button",
463
+ {
464
+ type: "button",
465
+ className: getTimePickerItemClasses(isSelected, isDisabled),
466
+ disabled: isDisabled,
467
+ onClick: () => selectMinute(minute),
468
+ "data-tiger-timepicker-unit": "minute",
469
+ "aria-label": getTimePickerOptionAriaLabel(
470
+ minute,
471
+ "minute",
472
+ locale,
473
+ labelsOverrides
474
+ ),
475
+ "aria-selected": isSelected,
476
+ children: minute.toString().padStart(2, "0")
477
+ },
478
+ minute
479
+ );
480
+ }) })
481
+ ] }),
482
+ showSeconds && /* @__PURE__ */ jsxs("div", { className: timePickerColumnClasses, children: [
483
+ /* @__PURE__ */ jsx("div", { className: timePickerColumnHeaderClasses, children: labels.second }),
484
+ /* @__PURE__ */ jsx("div", { className: timePickerColumnListClasses, children: secondsList.map((second) => {
485
+ const isSelected = selectedSeconds === second;
486
+ return /* @__PURE__ */ jsx(
487
+ "button",
488
+ {
489
+ type: "button",
490
+ className: getTimePickerItemClasses(isSelected, false),
491
+ onClick: () => selectSecond(second),
492
+ "data-tiger-timepicker-unit": "second",
493
+ "aria-label": getTimePickerOptionAriaLabel(
494
+ second,
495
+ "second",
496
+ locale,
497
+ labelsOverrides
498
+ ),
499
+ "aria-selected": isSelected,
500
+ children: second.toString().padStart(2, "0")
501
+ },
502
+ second
503
+ );
504
+ }) })
505
+ ] }),
506
+ format === "12" && /* @__PURE__ */ jsxs("div", { className: timePickerColumnClasses, children: [
507
+ /* @__PURE__ */ jsx("div", { className: timePickerColumnHeaderClasses, children: " " }),
508
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
509
+ /* @__PURE__ */ jsx(
510
+ "button",
511
+ {
512
+ type: "button",
513
+ className: getTimePickerPeriodButtonClasses(selectedPeriod === "AM"),
514
+ onClick: () => selectPeriod("AM"),
515
+ "data-tiger-timepicker-unit": "period",
516
+ "aria-label": periodLabels.am,
517
+ "aria-selected": selectedPeriod === "AM",
518
+ children: periodLabels.am
519
+ }
520
+ ),
521
+ /* @__PURE__ */ jsx(
522
+ "button",
523
+ {
524
+ type: "button",
525
+ className: getTimePickerPeriodButtonClasses(selectedPeriod === "PM"),
526
+ onClick: () => selectPeriod("PM"),
527
+ "data-tiger-timepicker-unit": "period",
528
+ "aria-label": periodLabels.pm,
529
+ "aria-selected": selectedPeriod === "PM",
530
+ children: periodLabels.pm
531
+ }
532
+ )
533
+ ] })
534
+ ] })
535
+ ] }),
536
+ /* @__PURE__ */ jsxs("div", { className: timePickerFooterClasses, children: [
537
+ /* @__PURE__ */ jsx("button", { type: "button", className: timePickerFooterButtonClasses, onClick: setNow, children: labels.now }),
538
+ /* @__PURE__ */ jsx("button", { type: "button", className: timePickerFooterButtonClasses, onClick: closePanel, children: labels.ok })
539
+ ] })
540
+ ]
541
+ }
542
+ )
543
+ ] });
544
+ };
545
+
546
+ export { TimePicker };
@@ -0,0 +1,41 @@
1
+ import { RowContext } from './chunk-T4TJJMLM.mjs';
2
+ import { useContext } from 'react';
3
+ import { getGutterStyles, getColStyleVars, getColOrderStyleVars, classNames, getSpanClasses, getOffsetClasses, getOrderClasses, getFlexClasses } from '@expcat/tigercat-core';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ var Col = ({
7
+ span = 24,
8
+ offset = 0,
9
+ order,
10
+ flex,
11
+ children,
12
+ className,
13
+ style,
14
+ ...divProps
15
+ }) => {
16
+ const { gutter } = useContext(RowContext);
17
+ const { colStyle } = getGutterStyles(gutter || 0);
18
+ const isFlexSpanMode = flex !== void 0 && span === 0;
19
+ const colStyleVars = getColStyleVars(isFlexSpanMode ? void 0 : span, offset);
20
+ const colOrderVars = getColOrderStyleVars(order);
21
+ const colFlexVar = flex === void 0 ? {} : {
22
+ "--tiger-col-flex": String(flex).replace(/_/g, " ")
23
+ };
24
+ const colClasses = classNames(
25
+ isFlexSpanMode ? "" : getSpanClasses(span),
26
+ getOffsetClasses(offset),
27
+ getOrderClasses(order),
28
+ getFlexClasses(flex),
29
+ className
30
+ );
31
+ const mergedStyle = {
32
+ ...colStyle,
33
+ ...colStyleVars,
34
+ ...colOrderVars,
35
+ ...colFlexVar,
36
+ ...style
37
+ };
38
+ return /* @__PURE__ */ jsx("div", { className: colClasses, style: mergedStyle, ...divProps, children });
39
+ };
40
+
41
+ export { Col };
@@ -0,0 +1,88 @@
1
+ import { useState } from 'react';
2
+ import { getAlertTypeClasses, defaultAlertThemeColors, classNames, alertBaseClasses, alertSizeClasses, alertIconSizeClasses, alertTitleSizeClasses, alertDescriptionSizeClasses, alertCloseButtonBaseClasses, getAlertIconPath, alertIconContainerClasses, alertContentClasses, alertCloseIconPath, icon24StrokeWidth, icon24ViewBox, icon24PathStrokeLinejoin, icon24PathStrokeLinecap } from '@expcat/tigercat-core';
3
+ import { jsxs, jsx } from 'react/jsx-runtime';
4
+
5
+ // src/components/Alert.tsx
6
+ var Icon = ({ path, className }) => /* @__PURE__ */ jsx(
7
+ "svg",
8
+ {
9
+ className,
10
+ xmlns: "http://www.w3.org/2000/svg",
11
+ fill: "none",
12
+ viewBox: icon24ViewBox,
13
+ stroke: "currentColor",
14
+ strokeWidth: icon24StrokeWidth,
15
+ children: /* @__PURE__ */ jsx(
16
+ "path",
17
+ {
18
+ strokeLinecap: icon24PathStrokeLinecap,
19
+ strokeLinejoin: icon24PathStrokeLinejoin,
20
+ d: path
21
+ }
22
+ )
23
+ }
24
+ );
25
+ var Alert = ({
26
+ type = "info",
27
+ size = "md",
28
+ title,
29
+ description,
30
+ showIcon = true,
31
+ closable = false,
32
+ closeAriaLabel = "Close alert",
33
+ className,
34
+ children,
35
+ titleSlot,
36
+ descriptionSlot,
37
+ onClose,
38
+ ...props
39
+ }) => {
40
+ const [visible, setVisible] = useState(true);
41
+ const colorScheme = getAlertTypeClasses(type, defaultAlertThemeColors);
42
+ const alertClasses = classNames(
43
+ alertBaseClasses,
44
+ alertSizeClasses[size],
45
+ colorScheme.bg,
46
+ colorScheme.border,
47
+ className
48
+ );
49
+ const iconClasses = classNames(alertIconSizeClasses[size], colorScheme.icon);
50
+ const titleClasses = classNames(alertTitleSizeClasses[size], colorScheme.title);
51
+ const descriptionClasses = classNames(alertDescriptionSizeClasses[size], colorScheme.description);
52
+ const closeButtonClasses = classNames(
53
+ alertCloseButtonBaseClasses,
54
+ colorScheme.closeButton,
55
+ colorScheme.closeButtonHover,
56
+ colorScheme.focus
57
+ );
58
+ const handleClose = (event) => {
59
+ onClose?.(event);
60
+ if (!event.defaultPrevented) {
61
+ setVisible(false);
62
+ }
63
+ };
64
+ if (!visible) {
65
+ return null;
66
+ }
67
+ const iconPath = getAlertIconPath(type);
68
+ return /* @__PURE__ */ jsxs("div", { ...props, className: alertClasses, role: "alert", children: [
69
+ showIcon && /* @__PURE__ */ jsx("div", { className: alertIconContainerClasses, children: /* @__PURE__ */ jsx(Icon, { path: iconPath, className: iconClasses }) }),
70
+ /* @__PURE__ */ jsxs("div", { className: alertContentClasses, children: [
71
+ (title || titleSlot) && /* @__PURE__ */ jsx("div", { className: titleClasses, children: titleSlot || title }),
72
+ (description || descriptionSlot) && /* @__PURE__ */ jsx("div", { className: descriptionClasses, children: descriptionSlot || description }),
73
+ !title && !description && !titleSlot && !descriptionSlot && children && /* @__PURE__ */ jsx("div", { className: titleClasses, children })
74
+ ] }),
75
+ closable && /* @__PURE__ */ jsx(
76
+ "button",
77
+ {
78
+ className: closeButtonClasses,
79
+ onClick: handleClose,
80
+ "aria-label": closeAriaLabel,
81
+ type: "button",
82
+ children: /* @__PURE__ */ jsx(Icon, { path: alertCloseIconPath, className: "h-4 w-4" })
83
+ }
84
+ )
85
+ ] });
86
+ };
87
+
88
+ export { Alert };