@tribepad/themis 1.0.1 → 1.0.2

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 (301) hide show
  1. package/dist/elements/Accordion/index.js +1 -335
  2. package/dist/elements/Accordion/index.js.map +1 -1
  3. package/dist/elements/Accordion/index.mjs +1 -317
  4. package/dist/elements/Accordion/index.mjs.map +1 -1
  5. package/dist/elements/AlertDialog/AlertDialog.d.ts +43 -0
  6. package/dist/elements/AlertDialog/AlertDialog.d.ts.map +1 -0
  7. package/dist/elements/AlertDialog/AlertDialog.styles.d.ts +15 -0
  8. package/dist/elements/AlertDialog/AlertDialog.styles.d.ts.map +1 -0
  9. package/dist/elements/AlertDialog/AlertDialog.types.d.ts +72 -0
  10. package/dist/elements/AlertDialog/AlertDialog.types.d.ts.map +1 -0
  11. package/dist/elements/AlertDialog/index.d.ts +25 -0
  12. package/dist/elements/AlertDialog/index.d.ts.map +1 -0
  13. package/dist/elements/AlertDialog/index.js +3 -0
  14. package/dist/elements/AlertDialog/index.js.map +1 -0
  15. package/dist/elements/AlertDialog/index.mjs +3 -0
  16. package/dist/elements/AlertDialog/index.mjs.map +1 -0
  17. package/dist/elements/Avatar/index.js +1 -468
  18. package/dist/elements/Avatar/index.js.map +1 -1
  19. package/dist/elements/Avatar/index.mjs +1 -456
  20. package/dist/elements/Avatar/index.mjs.map +1 -1
  21. package/dist/elements/Badge/index.js +1 -243
  22. package/dist/elements/Badge/index.js.map +1 -1
  23. package/dist/elements/Badge/index.mjs +1 -234
  24. package/dist/elements/Badge/index.mjs.map +1 -1
  25. package/dist/elements/Breadcrumbs/index.js +1 -821
  26. package/dist/elements/Breadcrumbs/index.js.map +1 -1
  27. package/dist/elements/Breadcrumbs/index.mjs +1 -810
  28. package/dist/elements/Breadcrumbs/index.mjs.map +1 -1
  29. package/dist/elements/Button/Button.d.ts +26 -81
  30. package/dist/elements/Button/Button.d.ts.map +1 -1
  31. package/dist/elements/Button/Button.styles.d.ts +35 -0
  32. package/dist/elements/Button/Button.styles.d.ts.map +1 -0
  33. package/dist/elements/Button/Button.types.d.ts +20 -8
  34. package/dist/elements/Button/Button.types.d.ts.map +1 -1
  35. package/dist/elements/Button/index.js +1 -288
  36. package/dist/elements/Button/index.js.map +1 -1
  37. package/dist/elements/Button/index.mjs +1 -283
  38. package/dist/elements/Button/index.mjs.map +1 -1
  39. package/dist/elements/ButtonGroup/index.js +1 -237
  40. package/dist/elements/ButtonGroup/index.js.map +1 -1
  41. package/dist/elements/ButtonGroup/index.mjs +1 -222
  42. package/dist/elements/ButtonGroup/index.mjs.map +1 -1
  43. package/dist/elements/Card/index.js +1 -579
  44. package/dist/elements/Card/index.js.map +1 -1
  45. package/dist/elements/Card/index.mjs +1 -560
  46. package/dist/elements/Card/index.mjs.map +1 -1
  47. package/dist/elements/Carousel/Carousel.d.ts +1 -11
  48. package/dist/elements/Carousel/Carousel.d.ts.map +1 -1
  49. package/dist/elements/Carousel/LazyCarousel.d.ts +1 -1
  50. package/dist/elements/Carousel/LazyCarousel.d.ts.map +1 -1
  51. package/dist/elements/Carousel/index.js +1 -789
  52. package/dist/elements/Carousel/index.js.map +1 -1
  53. package/dist/elements/Carousel/index.mjs +1 -786
  54. package/dist/elements/Carousel/index.mjs.map +1 -1
  55. package/dist/elements/Chart/ChartContext.d.ts.map +1 -1
  56. package/dist/elements/Chart/index.js +1 -1842
  57. package/dist/elements/Chart/index.js.map +1 -1
  58. package/dist/elements/Chart/index.mjs +1 -1832
  59. package/dist/elements/Chart/index.mjs.map +1 -1
  60. package/dist/elements/Checkbox/index.js +1 -316
  61. package/dist/elements/Checkbox/index.js.map +1 -1
  62. package/dist/elements/Checkbox/index.mjs +1 -306
  63. package/dist/elements/Checkbox/index.mjs.map +1 -1
  64. package/dist/elements/CheckboxGroup/index.js +1 -455
  65. package/dist/elements/CheckboxGroup/index.js.map +1 -1
  66. package/dist/elements/CheckboxGroup/index.mjs +1 -439
  67. package/dist/elements/CheckboxGroup/index.mjs.map +1 -1
  68. package/dist/elements/Combobox/Combobox.d.ts +56 -0
  69. package/dist/elements/Combobox/Combobox.d.ts.map +1 -0
  70. package/dist/elements/Combobox/Combobox.styles.d.ts +29 -0
  71. package/dist/elements/Combobox/Combobox.styles.d.ts.map +1 -0
  72. package/dist/elements/Combobox/Combobox.types.d.ts +67 -0
  73. package/dist/elements/Combobox/Combobox.types.d.ts.map +1 -0
  74. package/dist/elements/Combobox/index.d.ts +20 -0
  75. package/dist/elements/Combobox/index.d.ts.map +1 -0
  76. package/dist/elements/Combobox/index.js +3 -0
  77. package/dist/elements/Combobox/index.js.map +1 -0
  78. package/dist/elements/Combobox/index.mjs +3 -0
  79. package/dist/elements/Combobox/index.mjs.map +1 -0
  80. package/dist/elements/DatePicker/DatePicker.d.ts +1 -1
  81. package/dist/elements/DatePicker/DatePicker.d.ts.map +1 -1
  82. package/dist/elements/DatePicker/index.js +1 -903
  83. package/dist/elements/DatePicker/index.js.map +1 -1
  84. package/dist/elements/DatePicker/index.mjs +1 -853
  85. package/dist/elements/DatePicker/index.mjs.map +1 -1
  86. package/dist/elements/Dropdown/Dropdown.d.ts +7 -15
  87. package/dist/elements/Dropdown/Dropdown.d.ts.map +1 -1
  88. package/dist/elements/Dropdown/Dropdown.styles.d.ts +22 -0
  89. package/dist/elements/Dropdown/Dropdown.styles.d.ts.map +1 -0
  90. package/dist/elements/Dropdown/index.d.ts +1 -0
  91. package/dist/elements/Dropdown/index.d.ts.map +1 -1
  92. package/dist/elements/Dropdown/index.js +1 -193
  93. package/dist/elements/Dropdown/index.js.map +1 -1
  94. package/dist/elements/Dropdown/index.mjs +1 -184
  95. package/dist/elements/Dropdown/index.mjs.map +1 -1
  96. package/dist/elements/FileField/index.js +1 -1539
  97. package/dist/elements/FileField/index.js.map +1 -1
  98. package/dist/elements/FileField/index.mjs +1 -1507
  99. package/dist/elements/FileField/index.mjs.map +1 -1
  100. package/dist/elements/FormLayout/index.js +1 -170
  101. package/dist/elements/FormLayout/index.js.map +1 -1
  102. package/dist/elements/FormLayout/index.mjs +1 -167
  103. package/dist/elements/FormLayout/index.mjs.map +1 -1
  104. package/dist/elements/Modal/Modal.d.ts +9 -14
  105. package/dist/elements/Modal/Modal.d.ts.map +1 -1
  106. package/dist/elements/Modal/Modal.styles.d.ts +29 -0
  107. package/dist/elements/Modal/Modal.styles.d.ts.map +1 -0
  108. package/dist/elements/Modal/index.d.ts +1 -0
  109. package/dist/elements/Modal/index.d.ts.map +1 -1
  110. package/dist/elements/Modal/index.js +1 -232
  111. package/dist/elements/Modal/index.js.map +1 -1
  112. package/dist/elements/Modal/index.mjs +1 -220
  113. package/dist/elements/Modal/index.mjs.map +1 -1
  114. package/dist/elements/NumberField/index.js +1 -666
  115. package/dist/elements/NumberField/index.js.map +1 -1
  116. package/dist/elements/NumberField/index.mjs +1 -654
  117. package/dist/elements/NumberField/index.mjs.map +1 -1
  118. package/dist/elements/OTPInput/OTPInput.d.ts.map +1 -1
  119. package/dist/elements/OTPInput/index.js +1 -734
  120. package/dist/elements/OTPInput/index.js.map +1 -1
  121. package/dist/elements/OTPInput/index.mjs +1 -732
  122. package/dist/elements/OTPInput/index.mjs.map +1 -1
  123. package/dist/elements/Pagination/Pagination.d.ts +45 -0
  124. package/dist/elements/Pagination/Pagination.d.ts.map +1 -0
  125. package/dist/elements/Pagination/Pagination.styles.d.ts +10 -0
  126. package/dist/elements/Pagination/Pagination.styles.d.ts.map +1 -0
  127. package/dist/elements/Pagination/Pagination.types.d.ts +55 -0
  128. package/dist/elements/Pagination/Pagination.types.d.ts.map +1 -0
  129. package/dist/elements/Pagination/index.d.ts +21 -0
  130. package/dist/elements/Pagination/index.d.ts.map +1 -0
  131. package/dist/elements/Pagination/index.js +3 -0
  132. package/dist/elements/Pagination/index.js.map +1 -0
  133. package/dist/elements/Pagination/index.mjs +3 -0
  134. package/dist/elements/Pagination/index.mjs.map +1 -0
  135. package/dist/elements/Panel/index.js +1 -330
  136. package/dist/elements/Panel/index.js.map +1 -1
  137. package/dist/elements/Panel/index.mjs +1 -323
  138. package/dist/elements/Panel/index.mjs.map +1 -1
  139. package/dist/elements/PasswordField/PasswordField.d.ts +27 -0
  140. package/dist/elements/PasswordField/PasswordField.d.ts.map +1 -0
  141. package/dist/elements/PasswordField/PasswordField.styles.d.ts +32 -0
  142. package/dist/elements/PasswordField/PasswordField.styles.d.ts.map +1 -0
  143. package/dist/elements/PasswordField/PasswordField.types.d.ts +100 -0
  144. package/dist/elements/PasswordField/PasswordField.types.d.ts.map +1 -0
  145. package/dist/elements/PasswordField/index.css +2 -0
  146. package/dist/elements/PasswordField/index.css.map +1 -0
  147. package/dist/elements/PasswordField/index.d.ts +20 -0
  148. package/dist/elements/PasswordField/index.d.ts.map +1 -0
  149. package/dist/elements/PasswordField/index.js +3 -0
  150. package/dist/elements/PasswordField/index.js.map +1 -0
  151. package/dist/elements/PasswordField/index.mjs +3 -0
  152. package/dist/elements/PasswordField/index.mjs.map +1 -0
  153. package/dist/elements/Progress/index.js +1 -187
  154. package/dist/elements/Progress/index.js.map +1 -1
  155. package/dist/elements/Progress/index.mjs +1 -181
  156. package/dist/elements/Progress/index.mjs.map +1 -1
  157. package/dist/elements/RadioGroup/index.js +1 -369
  158. package/dist/elements/RadioGroup/index.js.map +1 -1
  159. package/dist/elements/RadioGroup/index.mjs +1 -359
  160. package/dist/elements/RadioGroup/index.mjs.map +1 -1
  161. package/dist/elements/Resizable/index.js +1 -1580
  162. package/dist/elements/Resizable/index.js.map +1 -1
  163. package/dist/elements/Resizable/index.mjs +1 -1566
  164. package/dist/elements/Resizable/index.mjs.map +1 -1
  165. package/dist/elements/SearchField/SearchField.d.ts +27 -0
  166. package/dist/elements/SearchField/SearchField.d.ts.map +1 -0
  167. package/dist/elements/SearchField/SearchField.styles.d.ts +32 -0
  168. package/dist/elements/SearchField/SearchField.styles.d.ts.map +1 -0
  169. package/dist/elements/SearchField/SearchField.types.d.ts +45 -0
  170. package/dist/elements/SearchField/SearchField.types.d.ts.map +1 -0
  171. package/dist/elements/SearchField/index.css +2 -0
  172. package/dist/elements/SearchField/index.css.map +1 -0
  173. package/dist/elements/SearchField/index.d.ts +21 -0
  174. package/dist/elements/SearchField/index.d.ts.map +1 -0
  175. package/dist/elements/SearchField/index.js +3 -0
  176. package/dist/elements/SearchField/index.js.map +1 -0
  177. package/dist/elements/SearchField/index.mjs +3 -0
  178. package/dist/elements/SearchField/index.mjs.map +1 -0
  179. package/dist/elements/Select/Select.d.ts +19 -48
  180. package/dist/elements/Select/Select.d.ts.map +1 -1
  181. package/dist/elements/Select/Select.styles.d.ts +55 -0
  182. package/dist/elements/Select/Select.styles.d.ts.map +1 -0
  183. package/dist/elements/Select/index.js +1 -589
  184. package/dist/elements/Select/index.js.map +1 -1
  185. package/dist/elements/Select/index.mjs +1 -582
  186. package/dist/elements/Select/index.mjs.map +1 -1
  187. package/dist/elements/Skeleton/index.js +1 -82
  188. package/dist/elements/Skeleton/index.js.map +1 -1
  189. package/dist/elements/Skeleton/index.mjs +1 -78
  190. package/dist/elements/Skeleton/index.mjs.map +1 -1
  191. package/dist/elements/Switch/index.js +1 -179
  192. package/dist/elements/Switch/index.js.map +1 -1
  193. package/dist/elements/Switch/index.mjs +1 -173
  194. package/dist/elements/Switch/index.mjs.map +1 -1
  195. package/dist/elements/Table/Table.d.ts +3 -24
  196. package/dist/elements/Table/Table.d.ts.map +1 -1
  197. package/dist/elements/Table/Table.styles.d.ts +24 -0
  198. package/dist/elements/Table/Table.styles.d.ts.map +1 -0
  199. package/dist/elements/Table/index.js +1 -595
  200. package/dist/elements/Table/index.js.map +1 -1
  201. package/dist/elements/Table/index.mjs +1 -578
  202. package/dist/elements/Table/index.mjs.map +1 -1
  203. package/dist/elements/Tabs/index.js +1 -337
  204. package/dist/elements/Tabs/index.js.map +1 -1
  205. package/dist/elements/Tabs/index.mjs +1 -320
  206. package/dist/elements/Tabs/index.mjs.map +1 -1
  207. package/dist/elements/TextField/TextField.d.ts +6 -42
  208. package/dist/elements/TextField/TextField.d.ts.map +1 -1
  209. package/dist/elements/TextField/TextField.hooks.d.ts +63 -0
  210. package/dist/elements/TextField/TextField.hooks.d.ts.map +1 -0
  211. package/dist/elements/TextField/TextField.icons.d.ts +19 -0
  212. package/dist/elements/TextField/TextField.icons.d.ts.map +1 -0
  213. package/dist/elements/TextField/TextField.styles.d.ts +37 -0
  214. package/dist/elements/TextField/TextField.styles.d.ts.map +1 -0
  215. package/dist/elements/TextField/TextField.types.d.ts +3 -0
  216. package/dist/elements/TextField/TextField.types.d.ts.map +1 -1
  217. package/dist/elements/TextField/index.css +1 -22
  218. package/dist/elements/TextField/index.css.map +1 -1
  219. package/dist/elements/TextField/index.js +1 -902
  220. package/dist/elements/TextField/index.js.map +1 -1
  221. package/dist/elements/TextField/index.mjs +1 -882
  222. package/dist/elements/TextField/index.mjs.map +1 -1
  223. package/dist/elements/TimeField/index.js +1 -254
  224. package/dist/elements/TimeField/index.js.map +1 -1
  225. package/dist/elements/TimeField/index.mjs +1 -238
  226. package/dist/elements/TimeField/index.mjs.map +1 -1
  227. package/dist/elements/Toast/Toast.d.ts +0 -22
  228. package/dist/elements/Toast/Toast.d.ts.map +1 -1
  229. package/dist/elements/Toast/index.js +1 -737
  230. package/dist/elements/Toast/index.js.map +1 -1
  231. package/dist/elements/Toast/index.mjs +1 -724
  232. package/dist/elements/Toast/index.mjs.map +1 -1
  233. package/dist/elements/Tooltip/index.js +1 -323
  234. package/dist/elements/Tooltip/index.js.map +1 -1
  235. package/dist/elements/Tooltip/index.mjs +1 -310
  236. package/dist/elements/Tooltip/index.mjs.map +1 -1
  237. package/dist/elements/index.css +1 -22
  238. package/dist/elements/index.css.map +1 -1
  239. package/dist/elements/index.d.ts +13 -1
  240. package/dist/elements/index.d.ts.map +1 -1
  241. package/dist/elements/index.js +1 -12455
  242. package/dist/elements/index.js.map +1 -1
  243. package/dist/elements/index.mjs +1 -12233
  244. package/dist/elements/index.mjs.map +1 -1
  245. package/dist/index.css +1 -22
  246. package/dist/index.css.map +1 -1
  247. package/dist/index.js +2 -12490
  248. package/dist/index.js.map +1 -1
  249. package/dist/index.mjs +2 -12262
  250. package/dist/index.mjs.map +1 -1
  251. package/dist/schemas/index.js +2 -54
  252. package/dist/schemas/index.js.map +1 -1
  253. package/dist/schemas/index.mjs +2 -48
  254. package/dist/schemas/index.mjs.map +1 -1
  255. package/dist/styles/defaults.css +151 -0
  256. package/dist/styles/index.js +1 -166
  257. package/dist/styles/index.js.map +1 -1
  258. package/dist/styles/index.mjs +1 -129
  259. package/dist/styles/index.mjs.map +1 -1
  260. package/dist/utils/index.js +1 -12
  261. package/dist/utils/index.js.map +1 -1
  262. package/dist/utils/index.mjs +1 -10
  263. package/dist/utils/index.mjs.map +1 -1
  264. package/package.json +9 -7
  265. package/src/elements/Accordion/Accordion.stories.tsx +1 -1
  266. package/src/elements/AlertDialog/AlertDialog.stories.tsx +124 -0
  267. package/src/elements/Avatar/Avatar.stories.tsx +1 -1
  268. package/src/elements/Badge/Badge.stories.tsx +1 -1
  269. package/src/elements/Breadcrumbs/Breadcrumbs.stories.tsx +1 -1
  270. package/src/elements/Button/Button.stories.tsx +1 -1
  271. package/src/elements/ButtonGroup/ButtonGroup.stories.tsx +1 -1
  272. package/src/elements/Card/Card.stories.tsx +1 -1
  273. package/src/elements/Carousel/Carousel.stories.tsx +1 -1
  274. package/src/elements/Chart/Chart.stories.tsx +1 -1
  275. package/src/elements/Checkbox/Checkbox.stories.tsx +1 -1
  276. package/src/elements/CheckboxGroup/CheckboxGroup.stories.tsx +1 -1
  277. package/src/elements/Combobox/Combobox.stories.tsx +133 -0
  278. package/src/elements/DatePicker/DatePicker.stories.tsx +1 -1
  279. package/src/elements/Dropdown/Dropdown.stories.tsx +1 -1
  280. package/src/elements/FileField/FileField.stories.tsx +1 -1
  281. package/src/elements/FileField/FileProgress.stories.tsx +1 -1
  282. package/src/elements/FormLayout/FormLayout.stories.tsx +1 -1
  283. package/src/elements/Modal/Modal.stories.tsx +1 -1
  284. package/src/elements/NumberField/NumberField.stories.tsx +1 -1
  285. package/src/elements/OTPInput/OTPInput.stories.tsx +1 -1
  286. package/src/elements/Pagination/Pagination.stories.tsx +203 -0
  287. package/src/elements/Panel/Panel.stories.tsx +1 -1
  288. package/src/elements/PasswordField/PasswordField.stories.tsx +167 -0
  289. package/src/elements/Progress/Progress.stories.tsx +1 -1
  290. package/src/elements/RadioGroup/RadioGroup.stories.tsx +1 -1
  291. package/src/elements/Resizable/Resizable.stories.tsx +1 -1
  292. package/src/elements/SearchField/SearchField.stories.tsx +146 -0
  293. package/src/elements/Select/Select.stories.tsx +1 -1
  294. package/src/elements/Skeleton/Skeleton.stories.tsx +1 -1
  295. package/src/elements/Switch/Switch.stories.tsx +1 -1
  296. package/src/elements/Table/Table.stories.tsx +1 -1
  297. package/src/elements/Tabs/Tabs.stories.tsx +1 -1
  298. package/src/elements/TextField/TextField.stories.tsx +1 -1
  299. package/src/elements/TimeField/TimeField.stories.tsx +1 -1
  300. package/src/elements/Toast/Toast.stories.tsx +1 -1
  301. package/src/elements/Tooltip/Tooltip.stories.tsx +1 -1
@@ -1,726 +1,3 @@
1
1
  "use client";
2
- import { createContext, memo, forwardRef, useId, useRef, useState, useCallback, useSyncExternalStore, useContext, useMemo } from 'react';
3
- import { useToast, useToastRegion } from 'react-aria';
4
- import { ToastQueue, useToastQueue } from 'react-stately';
5
- import { cva } from 'class-variance-authority';
6
- import { Loader2, Zap, X } from 'lucide-react';
7
- import { clsx } from 'clsx';
8
- import { twMerge } from 'tailwind-merge';
9
- import { Button as Button$1 } from 'react-aria-components';
10
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
11
- import { z } from 'zod';
12
-
13
- // src/elements/Toast/Toast.tsx
14
- function cn(...inputs) {
15
- return twMerge(clsx(inputs));
16
- }
17
- var PRESSED_STYLES = "data-[pressed]:scale-[0.97]";
18
- var HOVER_STYLES = "data-[hovered]:shadow-md";
19
- var HIGH_CONTRAST_HOVER = "hc:data-[hovered]:outline hc:data-[hovered]:outline-2 hc:data-[hovered]:outline-foreground";
20
- var HIGH_CONTRAST_PRESSED = "hc:data-[pressed]:outline hc:data-[pressed]:outline-2 hc:data-[pressed]:outline-offset-1 hc:data-[pressed]:outline-foreground";
21
- var ButtonGroupContext = createContext(null);
22
- ButtonGroupContext.displayName = "ButtonGroupContext";
23
- function useButtonGroupContext() {
24
- return useContext(ButtonGroupContext);
25
- }
26
- var ButtonGroupItemContext = createContext(null);
27
- ButtonGroupItemContext.displayName = "ButtonGroupItemContext";
28
- function useButtonGroupItemContext() {
29
- return useContext(ButtonGroupItemContext);
30
- }
31
- cva("inline-flex items-center gap-0", {
32
- variants: {
33
- orientation: {
34
- horizontal: "flex-row",
35
- vertical: "flex-col w-full"
36
- }
37
- },
38
- defaultVariants: {
39
- orientation: "horizontal"
40
- }
41
- });
42
- var buttonGroupItemVariants = cva("", {
43
- variants: {
44
- orientation: {
45
- // min-w-[44px] ensures visual layer fills touch target width (for icon buttons)
46
- horizontal: "min-w-[44px]",
47
- // flex (overrides inline-flex) + min-h-[44px] makes visual layer fill touch target,
48
- // eliminating gaps between stacked buttons in vertical orientation
49
- vertical: "flex min-h-[44px]"
50
- },
51
- position: {
52
- first: "",
53
- middle: "",
54
- last: "",
55
- only: ""
56
- // Single button - no modifications needed
57
- }
58
- },
59
- compoundVariants: [
60
- // ==========================================================================
61
- // Horizontal Orientation
62
- // ==========================================================================
63
- {
64
- orientation: "horizontal",
65
- position: "first",
66
- className: "rounded-r-none border-r-0"
67
- },
68
- {
69
- orientation: "horizontal",
70
- position: "middle",
71
- className: "rounded-none border-r-0"
72
- },
73
- {
74
- orientation: "horizontal",
75
- position: "last",
76
- className: "rounded-l-none"
77
- },
78
- // ==========================================================================
79
- // Vertical Orientation
80
- // Note: w-full is handled by Button's effectiveFullWidth for both layers
81
- // ==========================================================================
82
- {
83
- orientation: "vertical",
84
- position: "first",
85
- className: "rounded-b-none border-b-0"
86
- },
87
- {
88
- orientation: "vertical",
89
- position: "middle",
90
- className: "rounded-none border-b-0"
91
- },
92
- {
93
- orientation: "vertical",
94
- position: "last",
95
- className: "rounded-t-none"
96
- }
97
- ],
98
- defaultVariants: {
99
- orientation: "horizontal",
100
- position: "only"
101
- }
102
- });
103
- cva("bg-[var(--border)]", {
104
- variants: {
105
- orientation: {
106
- horizontal: "w-px h-6 mx-1",
107
- vertical: "h-px w-full my-1"
108
- }
109
- },
110
- defaultVariants: {
111
- orientation: "horizontal"
112
- }
113
- });
114
- var buttonOuterVariants = cva(
115
- "inline-flex justify-center min-h-[44px] min-w-[44px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",
116
- {
117
- variants: {
118
- fullWidth: {
119
- true: "w-full",
120
- false: ""
121
- },
122
- inVerticalGroup: {
123
- true: "items-stretch",
124
- false: "items-center"
125
- }
126
- },
127
- defaultVariants: {
128
- fullWidth: false,
129
- inVerticalGroup: false
130
- }
131
- }
132
- );
133
- var buttonVisualVariants = cva(
134
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 relative cursor-pointer",
135
- {
136
- variants: {
137
- variant: {
138
- default: "bg-[var(--primary-action)] text-[var(--primary-action-foreground)] shadow-md hover:bg-[var(--primary-action-hover)] data-[pressed]:bg-[var(--primary-action)]/80",
139
- destructive: "bg-[var(--destructive-background)] text-[var(--destructive-foreground)] shadow-md hover:bg-[var(--destructive-background)]/90 data-[pressed]:bg-[var(--destructive-background)]/80",
140
- outline: "border border-[var(--input-border)] bg-[var(--page-background)] hover:bg-[var(--input-border)] data-[pressed]:bg-[var(--input-border)]",
141
- secondary: "bg-[var(--secondary)] text-[var(--secondary-foreground)] shadow-md hover:bg-[var(--secondary)]/80 data-[pressed]:bg-[var(--secondary)]/70",
142
- ghost: "hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)] data-[pressed]:bg-[var(--accent)]",
143
- link: "text-[var(--text-link)] underline-offset-4 hover:underline data-[pressed]:text-[var(--text-link-hover)]"
144
- },
145
- fullWidth: {
146
- true: "w-full",
147
- false: ""
148
- },
149
- visualSize: {
150
- default: "h-10 px-4 py-2",
151
- sm: "h-9 rounded-md px-3 text-xs",
152
- lg: "h-11 rounded-md px-8",
153
- icon: "h-10 w-10",
154
- dot: "h-5 w-5 rounded-full p-0 min-h-0 min-w-0"
155
- },
156
- paywall: {
157
- true: "!bg-[var(--paywall)] !text-[var(--paywall-foreground)] !shadow-md hover:!bg-[var(--paywall)]/90 !cursor-not-allowed !border-transparent",
158
- false: ""
159
- }
160
- },
161
- defaultVariants: {
162
- variant: "default",
163
- visualSize: "default",
164
- paywall: false
165
- }
166
- }
167
- );
168
- var Button = memo(forwardRef(
169
- ({
170
- className,
171
- buttonVisualClassName,
172
- variant,
173
- size,
174
- visualSize,
175
- fullWidth,
176
- loading = false,
177
- loadingText = "Loading...",
178
- shortcut,
179
- children,
180
- isDisabled,
181
- paywall = false,
182
- paywallRedirect,
183
- paywallDescription,
184
- onPress,
185
- ...props
186
- }, ref) => {
187
- const paywallDescriptionId = useId();
188
- const groupContext = useButtonGroupContext();
189
- const itemContext = useButtonGroupItemContext();
190
- const effectiveVariant = variant ?? groupContext?.variant ?? "default";
191
- const effectiveSize = size ?? groupContext?.size;
192
- const effectiveIsDisabled = isDisabled ?? groupContext?.isDisabled ?? false;
193
- const isInVerticalGroup = groupContext?.orientation === "vertical";
194
- const effectiveFullWidth = fullWidth || isInVerticalGroup;
195
- const positionClassName = itemContext ? buttonGroupItemVariants({
196
- orientation: groupContext?.orientation ?? "horizontal",
197
- position: itemContext.position
198
- }) : "";
199
- const effectiveVisualSize = visualSize ?? effectiveSize ?? "default";
200
- if (process.env.NODE_ENV !== "production") {
201
- if ((effectiveVisualSize === "dot" || effectiveVisualSize === "icon") && !props["aria-label"] && !children) {
202
- console.warn(
203
- '[Button] visualSize="dot" or "icon" requires aria-label when no visible text is provided (WCAG 1.1.1)'
204
- );
205
- }
206
- }
207
- const handlePress = (e) => {
208
- if (paywall) {
209
- if (paywallRedirect) {
210
- window.open(paywallRedirect, "_blank", "noopener,noreferrer");
211
- }
212
- return;
213
- }
214
- onPress?.(e);
215
- };
216
- const computedIsDisabled = effectiveIsDisabled || loading || void 0;
217
- return /* @__PURE__ */ jsx(
218
- Button$1,
219
- {
220
- ref,
221
- isDisabled: computedIsDisabled,
222
- "aria-disabled": paywall ? true : void 0,
223
- "aria-describedby": paywall ? paywallDescriptionId : void 0,
224
- onPress: handlePress,
225
- className: cn(buttonOuterVariants({ fullWidth: effectiveFullWidth, inVerticalGroup: isInVerticalGroup }), className),
226
- ...props,
227
- children: (renderProps) => (
228
- /* Layer 2: Visual Button */
229
- /* @__PURE__ */ jsxs(
230
- "span",
231
- {
232
- className: cn(
233
- buttonVisualVariants({
234
- variant: effectiveVariant,
235
- visualSize: effectiveVisualSize,
236
- paywall,
237
- fullWidth: effectiveFullWidth
238
- }),
239
- // Position styling from ButtonGroup context (border-radius adjustments)
240
- positionClassName,
241
- buttonVisualClassName,
242
- // Layer 2 interaction styles (no focus - focus ring is on Layer 1)
243
- PRESSED_STYLES,
244
- HOVER_STYLES,
245
- HIGH_CONTRAST_HOVER,
246
- HIGH_CONTRAST_PRESSED
247
- ),
248
- "data-pressed": renderProps.isPressed || void 0,
249
- children: [
250
- loading && /* @__PURE__ */ jsxs(Fragment, { children: [
251
- /* @__PURE__ */ jsx(Loader2, { className: "motion-safe:animate-spin", "aria-hidden": "true" }),
252
- /* @__PURE__ */ jsx("span", { className: "sr-only", "aria-live": "polite", children: loadingText })
253
- ] }),
254
- !loading && children,
255
- paywall && /* @__PURE__ */ jsx(
256
- Zap,
257
- {
258
- "data-testid": "zap-icon",
259
- "aria-hidden": "true",
260
- className: "ml-1"
261
- }
262
- ),
263
- paywall && /* @__PURE__ */ jsxs("span", { id: paywallDescriptionId, className: "sr-only", children: [
264
- "Premium feature: ",
265
- paywallDescription || "Upgrade required to access this feature"
266
- ] }),
267
- renderProps.isFocusVisible && shortcut && /* @__PURE__ */ jsx("kbd", { className: "ml-auto hidden text-xs opacity-60 lg:inline", children: shortcut }),
268
- renderProps.isPressed && /* @__PURE__ */ jsx(
269
- "span",
270
- {
271
- className: "absolute inset-0 rounded-[inherit] bg-current opacity-10 motion-safe:animate-in motion-safe:zoom-in-95",
272
- "aria-hidden": "true"
273
- }
274
- )
275
- ]
276
- }
277
- )
278
- )
279
- }
280
- );
281
- }
282
- ));
283
- Button.displayName = "Button";
284
- var DismissReasonSchema = z.enum(["timeout", "user", "programmatic"]);
285
- var ToastVariantSchema = z.enum([
286
- "default",
287
- "primary",
288
- "destructive",
289
- "accent"
290
- ]);
291
- var ToasterPositionSchema = z.enum([
292
- "top-left",
293
- "top-center",
294
- "top-right",
295
- "bottom-left",
296
- "bottom-center",
297
- "bottom-right"
298
- ]);
299
- var ToastOptionsSchema = z.object({
300
- /**
301
- * Visual variant determining background and foreground colors
302
- * @default 'default'
303
- */
304
- variant: ToastVariantSchema.default("default"),
305
- /**
306
- * Auto-dismiss timeout in milliseconds
307
- * - Values 1-4999ms are clamped to 5000ms (WCAG 2.2 timing requirement)
308
- * - Set to 0 for persistent toasts (no auto-dismiss)
309
- * @default 5000
310
- */
311
- timeout: z.number().min(0).default(5e3),
312
- /**
313
- * Callback fired when toast is dismissed
314
- * @param key - Unique identifier of the toast
315
- * @param reason - Why the toast was dismissed ('timeout' | 'user' | 'programmatic')
316
- */
317
- onClose: z.function().optional()
318
- });
319
- var ToastProviderPropsSchema = z.object({
320
- /**
321
- * Maximum number of toasts visible at once
322
- * Additional toasts are queued and shown as others dismiss
323
- * @default 3
324
- */
325
- maxVisibleToasts: z.number().min(1).default(3)
326
- });
327
- var ToasterPropsSchema = z.object({
328
- /**
329
- * Position of the toast region on screen
330
- * @default 'bottom-right'
331
- */
332
- position: ToasterPositionSchema.default("bottom-right"),
333
- /**
334
- * Accessible label for the toast region landmark
335
- * Used by screen readers to identify the notification area
336
- * @default 'Notifications'
337
- */
338
- "aria-label": z.string().default("Notifications"),
339
- /**
340
- * Additional CSS classes for the toast region
341
- */
342
- className: z.string().optional()
343
- });
344
- var toastVariants = cva(
345
- [
346
- // Fixed width for consistent appearance
347
- "pointer-events-auto relative flex w-[356px] items-center justify-between",
348
- "space-x-4 overflow-hidden rounded-lg border p-4 pr-12 shadow-lg",
349
- // Animations with reduced-motion support
350
- "transition-all duration-300",
351
- "motion-reduce:transition-none motion-reduce:animate-none",
352
- "data-[entering]:animate-in data-[entering]:slide-in-from-left",
353
- "data-[exiting]:animate-out data-[exiting]:slide-out-to-right-full",
354
- "data-[exiting]:fade-out-80",
355
- // Touch interaction for swipe
356
- "touch-pan-y"
357
- ],
358
- {
359
- variants: {
360
- variant: {
361
- default: [
362
- "bg-[var(--content-background)]",
363
- "text-[var(--content-foreground)]",
364
- "border-[var(--border)]"
365
- ],
366
- primary: [
367
- "bg-[var(--primary)]",
368
- "text-[var(--primary-foreground)]",
369
- "border-[var(--primary)]"
370
- ],
371
- destructive: [
372
- "bg-[var(--destructive-background)]",
373
- "text-[var(--destructive-foreground)]",
374
- "border-[var(--destructive-background)]"
375
- ],
376
- accent: [
377
- "bg-[var(--accent-background)]",
378
- "text-[var(--accent-foreground)]",
379
- "border-[var(--accent-background)]"
380
- ]
381
- }
382
- },
383
- defaultVariants: {
384
- variant: "default"
385
- }
386
- }
387
- );
388
- var toasterVariants = cva(
389
- [
390
- "fixed z-50 flex flex-col gap-2 p-4",
391
- "pointer-events-none",
392
- "max-h-screen overflow-hidden"
393
- ],
394
- {
395
- variants: {
396
- position: {
397
- "top-left": "top-0 left-0 items-start",
398
- "top-center": "top-0 left-1/2 -translate-x-1/2 items-center",
399
- "top-right": "top-0 right-0 items-end",
400
- "bottom-left": "bottom-0 left-0 items-start",
401
- "bottom-center": "bottom-0 left-1/2 -translate-x-1/2 items-center",
402
- "bottom-right": "bottom-0 right-0 items-end"
403
- }
404
- },
405
- defaultVariants: {
406
- position: "bottom-right"
407
- }
408
- }
409
- );
410
- var CloseButton = memo(
411
- forwardRef(
412
- ({ variant = "default", className, onPress }, ref) => {
413
- const hoverStyles = variant === "default" ? "hover:bg-[var(--accent-background)]/20" : "hover:bg-white/20";
414
- return /* @__PURE__ */ jsx(
415
- Button,
416
- {
417
- ref,
418
- variant: "ghost",
419
- visualSize: "icon",
420
- onPress,
421
- className: cn(
422
- "absolute right-2 top-2",
423
- hoverStyles,
424
- className
425
- ),
426
- "aria-label": "Dismiss notification",
427
- children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4", "aria-hidden": "true" })
428
- }
429
- );
430
- }
431
- )
432
- );
433
- CloseButton.displayName = "CloseButton";
434
- var internalQueue = new ToastQueue({
435
- maxVisibleToasts: 3
436
- });
437
- var totalActiveToasts = 0;
438
- var toastCountListeners = /* @__PURE__ */ new Set();
439
- function incrementTotalToasts() {
440
- totalActiveToasts++;
441
- toastCountListeners.forEach((fn) => fn());
442
- }
443
- function decrementTotalToasts() {
444
- totalActiveToasts = Math.max(0, totalActiveToasts - 1);
445
- toastCountListeners.forEach((fn) => fn());
446
- }
447
- function getTotalActiveToasts() {
448
- return totalActiveToasts;
449
- }
450
- function subscribeToTotalCount(fn) {
451
- toastCountListeners.add(fn);
452
- return () => toastCountListeners.delete(fn);
453
- }
454
- var toastQueue = {
455
- /**
456
- * Add a toast to the queue
457
- */
458
- add: (content, options) => internalQueue.add(content, options),
459
- /**
460
- * Close a specific toast by key
461
- */
462
- close: (key) => {
463
- internalQueue.close(key);
464
- },
465
- /**
466
- * Close all toasts (visible and queued)
467
- */
468
- closeAll: () => {
469
- internalQueue.visibleToasts.forEach((toast2) => {
470
- internalQueue.close(toast2.key);
471
- });
472
- },
473
- /**
474
- * Pause all toast timers
475
- */
476
- pauseAll: () => {
477
- internalQueue.pauseAll();
478
- },
479
- /**
480
- * Resume all toast timers
481
- */
482
- resumeAll: () => {
483
- internalQueue.resumeAll();
484
- },
485
- /**
486
- * Get the visible toasts
487
- */
488
- get visibleToasts() {
489
- return internalQueue.visibleToasts;
490
- },
491
- /**
492
- * Subscribe to queue changes
493
- */
494
- subscribe: (fn) => internalQueue.subscribe(fn),
495
- /**
496
- * Get total active toasts (visible + queued)
497
- */
498
- get totalCount() {
499
- return totalActiveToasts;
500
- }
501
- };
502
- function getInternalQueue() {
503
- return internalQueue;
504
- }
505
- function enforceMinTimeout(timeout) {
506
- if (timeout === 0) return 0;
507
- return Math.max(timeout, 5e3);
508
- }
509
- function toast(content, options) {
510
- const validated = ToastOptionsSchema.parse(options ?? {});
511
- const timeout = enforceMinTimeout(validated.timeout);
512
- const dismissReason = "timeout";
513
- incrementTotalToasts();
514
- const key = toastQueue.add(
515
- {
516
- key: "",
517
- // Will be set by queue
518
- content,
519
- variant: validated.variant,
520
- timeout,
521
- onClose: validated.onClose
522
- },
523
- {
524
- timeout,
525
- onClose: () => {
526
- decrementTotalToasts();
527
- if (validated.onClose) {
528
- validated.onClose(
529
- key,
530
- dismissReason
531
- );
532
- }
533
- }
534
- }
535
- );
536
- return key;
537
- }
538
- var ToastItem = memo(
539
- forwardRef(({ toast: toast2, state }, forwardedRef) => {
540
- const internalRef = useRef(null);
541
- const ref = forwardedRef || internalRef;
542
- const { toastProps, contentProps } = useToast(
543
- { toast: toast2 },
544
- state,
545
- ref
546
- );
547
- const [touchStart, setTouchStart] = useState(null);
548
- const [translateX, setTranslateX] = useState(0);
549
- const SWIPE_THRESHOLD = 50;
550
- const handleTouchStart = useCallback((e) => {
551
- const touch = e.touches[0];
552
- if (touch) {
553
- setTouchStart(touch.clientX);
554
- }
555
- }, []);
556
- const handleTouchMove = useCallback(
557
- (e) => {
558
- if (touchStart === null) return;
559
- const touch = e.touches[0];
560
- if (!touch) return;
561
- const diff = touch.clientX - touchStart;
562
- if (diff > 0) {
563
- setTranslateX(diff);
564
- }
565
- },
566
- [touchStart]
567
- );
568
- const handleTouchEnd = useCallback(() => {
569
- if (translateX > SWIPE_THRESHOLD) {
570
- state.close(toast2.key);
571
- }
572
- setTranslateX(0);
573
- setTouchStart(null);
574
- }, [translateX, state, toast2.key]);
575
- const handleCloseClick = useCallback(() => {
576
- state.close(toast2.key);
577
- }, [state, toast2.key]);
578
- const { content } = toast2;
579
- const variant = content.variant ?? "default";
580
- const accessibleName = typeof content.content === "string" ? content.content : "Notification";
581
- return /* @__PURE__ */ jsxs(
582
- "div",
583
- {
584
- ...toastProps,
585
- ref,
586
- className: cn(toastVariants({ variant })),
587
- "aria-label": accessibleName,
588
- style: {
589
- transform: translateX > 0 ? `translateX(${translateX}px)` : void 0,
590
- opacity: translateX > 0 ? 1 - translateX / 200 : void 0
591
- },
592
- onTouchStart: handleTouchStart,
593
- onTouchMove: handleTouchMove,
594
- onTouchEnd: handleTouchEnd,
595
- children: [
596
- /* @__PURE__ */ jsx("div", { ...contentProps, className: "flex-1 min-w-0", children: typeof content.content === "string" ? /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: content.content }) : content.content }),
597
- /* @__PURE__ */ jsx(
598
- CloseButton,
599
- {
600
- variant,
601
- onPress: handleCloseClick
602
- }
603
- )
604
- ]
605
- }
606
- );
607
- })
608
- );
609
- ToastItem.displayName = "ToastItem";
610
- var ToastContext = createContext(null);
611
- function ToastProvider({
612
- children,
613
- maxVisibleToasts = 3
614
- }) {
615
- ToastProviderPropsSchema.parse({ maxVisibleToasts });
616
- const queue = useMemo(() => {
617
- return getInternalQueue();
618
- }, []);
619
- return /* @__PURE__ */ jsx(ToastContext.Provider, { value: queue, children });
620
- }
621
- ToastProvider.displayName = "ToastProvider";
622
- function StackedToastIndicator({ queuedCount }) {
623
- if (queuedCount <= 0) return null;
624
- const stackLayers = Math.min(queuedCount, 2);
625
- return /* @__PURE__ */ jsxs("div", { className: "relative w-[356px] pointer-events-none", "aria-hidden": "true", children: [
626
- /* @__PURE__ */ jsx(
627
- "div",
628
- {
629
- className: cn(
630
- "absolute left-1/2 -translate-x-1/2 w-[340px] h-4 rounded-lg shadow-lg",
631
- "bg-[var(--content-background)] border border-[var(--border)]",
632
- "opacity-60",
633
- "transition-all duration-200"
634
- ),
635
- style: { top: 0 }
636
- }
637
- ),
638
- stackLayers >= 2 && /* @__PURE__ */ jsx(
639
- "div",
640
- {
641
- className: cn(
642
- "absolute left-1/2 -translate-x-1/2 w-[324px] h-2 rounded-b-lg shadow-lg",
643
- "bg-[var(--content-background)] border border-t-0 border-[var(--border)]",
644
- "opacity-40",
645
- "transition-all duration-200"
646
- ),
647
- style: { top: 14 }
648
- }
649
- ),
650
- /* @__PURE__ */ jsx("div", { className: "h-4" }),
651
- /* @__PURE__ */ jsxs(
652
- "div",
653
- {
654
- className: "text-sm text-[var(--content-foreground)] opacity-70 text-center py-2 pointer-events-auto",
655
- "aria-live": "polite",
656
- children: [
657
- "+",
658
- queuedCount,
659
- " more notification",
660
- queuedCount > 1 ? "s" : ""
661
- ]
662
- }
663
- )
664
- ] });
665
- }
666
- var Toaster = memo(
667
- forwardRef((props, forwardedRef) => {
668
- const validated = ToasterPropsSchema.parse(props);
669
- const {
670
- position = "bottom-right",
671
- "aria-label": ariaLabel = "Notifications",
672
- className
673
- } = validated;
674
- const internalRef = useRef(null);
675
- const ref = forwardedRef || internalRef;
676
- const internalQueueRef = getInternalQueue();
677
- const state = useToastQueue(internalQueueRef);
678
- const totalCount = useSyncExternalStore(
679
- subscribeToTotalCount,
680
- getTotalActiveToasts,
681
- getTotalActiveToasts
682
- );
683
- const { regionProps } = useToastRegion(
684
- { "aria-label": ariaLabel },
685
- state,
686
- ref
687
- );
688
- const queuedCount = Math.max(0, totalCount - state.visibleToasts.length);
689
- const handleClearAll = useCallback(() => {
690
- state.visibleToasts.forEach((toast2) => {
691
- state.close(toast2.key);
692
- });
693
- }, [state]);
694
- if (state.visibleToasts.length === 0) {
695
- return null;
696
- }
697
- return /* @__PURE__ */ jsxs(
698
- "div",
699
- {
700
- ...regionProps,
701
- ref,
702
- className: cn(toasterVariants({ position }), className),
703
- children: [
704
- state.visibleToasts.map((toast2) => /* @__PURE__ */ jsx(ToastItem, { toast: toast2, state }, toast2.key)),
705
- /* @__PURE__ */ jsx(StackedToastIndicator, { queuedCount }),
706
- state.visibleToasts.length >= 2 && /* @__PURE__ */ jsx(
707
- Button,
708
- {
709
- variant: "secondary",
710
- visualSize: "sm",
711
- onPress: handleClearAll,
712
- "aria-label": "Clear all notifications",
713
- className: "mt-2 pointer-events-auto",
714
- children: "Clear All"
715
- }
716
- )
717
- ]
718
- }
719
- );
720
- })
721
- );
722
- Toaster.displayName = "Toaster";
723
-
724
- export { DismissReasonSchema, ToastOptionsSchema, ToastProvider, ToastProviderPropsSchema, ToastVariantSchema, Toaster, ToasterPositionSchema, ToasterPropsSchema, toast, toastQueue, toastVariants, toasterVariants };
725
- //# sourceMappingURL=index.mjs.map
2
+ import {createContext,memo,forwardRef,useId,useRef,useState,useCallback,useSyncExternalStore,useContext,useMemo}from'react';import {useToast,useToastRegion}from'react-aria';import {ToastQueue,useToastQueue}from'react-stately';import {cva}from'class-variance-authority';import {Loader2,Zap,X as X$1}from'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {Button}from'react-aria-components';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {z as z$1}from'zod';function i(...t){return twMerge(clsx(t))}var z=cva("inline-flex justify-center min-h-[44px] min-w-[44px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{fullWidth:{true:"w-full",false:""},inVerticalGroup:{true:"items-stretch",false:"items-center"}},defaultVariants:{fullWidth:false,inVerticalGroup:false}}),G=cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 relative cursor-pointer",{variants:{variant:{default:"bg-[var(--primary-action)] text-[var(--primary-action-foreground)] shadow-md hover:bg-[var(--primary-action-hover)] data-[pressed]:bg-[var(--primary-action)]/80",destructive:"bg-[var(--destructive-background)] text-[var(--destructive-foreground)] shadow-md hover:bg-[var(--destructive-background)]/90 data-[pressed]:bg-[var(--destructive-background)]/80",outline:"border border-[var(--input-border)] bg-[var(--page-background)] hover:bg-[var(--input-border)] data-[pressed]:bg-[var(--input-border)]",secondary:"bg-[var(--secondary)] text-[var(--secondary-foreground)] shadow-md hover:bg-[var(--secondary)]/80 data-[pressed]:bg-[var(--secondary)]/70",ghost:"hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)] data-[pressed]:bg-[var(--accent)]",link:"text-[var(--text-link)] underline-offset-4 hover:underline data-[pressed]:text-[var(--text-link-hover)]"},fullWidth:{true:"w-full",false:""},visualSize:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-xs",lg:"h-11 rounded-md px-8",icon:"h-10 w-10",dot:"h-5 w-5 rounded-full p-0 min-h-0 min-w-0"},paywall:{true:"!bg-[var(--paywall)] !text-[var(--paywall-foreground)] !shadow-md hover:!bg-[var(--paywall)]/90 !cursor-not-allowed !border-transparent",false:""}},defaultVariants:{variant:"default",visualSize:"default",paywall:false}});var H="data-[pressed]:scale-[0.97]";var L="data-[hovered]:shadow-md";var w="hc:data-[hovered]:outline hc:data-[hovered]:outline-2 hc:data-[hovered]:outline-foreground",I="hc:data-[pressed]:outline hc:data-[pressed]:outline-2 hc:data-[pressed]:outline-offset-1 hc:data-[pressed]:outline-foreground";var ot=createContext(null);ot.displayName="ButtonGroupContext";function at(){return useContext(ot)}var rt=createContext(null);rt.displayName="ButtonGroupItemContext";function nt(){return useContext(rt)}cva("inline-flex items-center gap-0",{variants:{orientation:{horizontal:"flex-row",vertical:"flex-col w-full"}},defaultVariants:{orientation:"horizontal"}});var st=cva("",{variants:{orientation:{horizontal:"min-w-[44px]",vertical:"flex min-h-[44px]"},position:{first:"",middle:"",last:"",only:""}},compoundVariants:[{orientation:"horizontal",position:"first",className:"rounded-r-none border-r-0"},{orientation:"horizontal",position:"middle",className:"rounded-none border-r-0"},{orientation:"horizontal",position:"last",className:"rounded-l-none"},{orientation:"vertical",position:"first",className:"rounded-b-none border-b-0"},{orientation:"vertical",position:"middle",className:"rounded-none border-b-0"},{orientation:"vertical",position:"last",className:"rounded-t-none"}],defaultVariants:{orientation:"horizontal",position:"only"}});cva("bg-[var(--border)]",{variants:{orientation:{horizontal:"w-px h-6 mx-1",vertical:"h-px w-full my-1"}},defaultVariants:{orientation:"horizontal"}});var S=memo(forwardRef(({className:t,buttonVisualClassName:e,variant:a,size:n,visualSize:u,fullWidth:c,loading:f=false,loadingText:d="Loading...",shortcut:v,children:o,isDisabled:h,paywall:s=false,paywallRedirect:x,paywallDescription:P,onPress:p,...B},m)=>{let N=useId(),T=at(),g=nt(),b=a??T?.variant??"default",k=n??T?.size,xt=h??T?.isDisabled??false,q=T?.orientation==="vertical",K=c||q,gt=g?st({orientation:T?.orientation??"horizontal",position:g.position}):"",_=u??k??"default";return process.env.NODE_ENV!=="production"&&(_==="dot"||_==="icon")&&!B["aria-label"]&&!o&&console.warn('[Button] visualSize="dot" or "icon" requires aria-label when no visible text is provided (WCAG 1.1.1)'),jsx(Button,{ref:m,isDisabled:xt||f||void 0,"aria-disabled":s?true:void 0,"aria-describedby":s?N:void 0,onPress:V=>{if(s){x&&window.open(x,"_blank","noopener,noreferrer");return}p?.(V);},className:i(z({fullWidth:K,inVerticalGroup:q}),t),...B,children:V=>jsxs("span",{className:i(G({variant:b,visualSize:_,paywall:s,fullWidth:K}),gt,e,H,L,w,I),"data-pressed":V.isPressed||void 0,children:[f&&jsxs(Fragment,{children:[jsx(Loader2,{className:"motion-safe:animate-spin","aria-hidden":"true"}),jsx("span",{className:"sr-only","aria-live":"polite",children:d})]}),!f&&o,s&&jsx(Zap,{"data-testid":"zap-icon","aria-hidden":"true",className:"ml-1"}),s&&jsxs("span",{id:N,className:"sr-only",children:["Premium feature: ",P||"Upgrade required to access this feature"]}),V.isFocusVisible&&v&&jsx("kbd",{className:"ml-auto hidden text-xs opacity-60 lg:inline",children:v}),V.isPressed&&jsx("span",{className:"absolute inset-0 rounded-[inherit] bg-current opacity-10 motion-safe:animate-in motion-safe:zoom-in-95","aria-hidden":"true"})]})})}));S.displayName="Button";var dt=cva(["pointer-events-auto relative flex w-[356px] items-center justify-between","space-x-4 overflow-hidden rounded-lg border p-4 pr-12 shadow-lg","transition-all duration-300","motion-reduce:transition-none motion-reduce:animate-none","data-[entering]:animate-in data-[entering]:slide-in-from-left","data-[exiting]:animate-out data-[exiting]:slide-out-to-right-full","data-[exiting]:fade-out-80","touch-pan-y"],{variants:{variant:{default:["bg-[var(--content-background)]","text-[var(--content-foreground)]","border-[var(--border)]"],primary:["bg-[var(--primary)]","text-[var(--primary-foreground)]","border-[var(--primary)]"],destructive:["bg-[var(--destructive-background)]","text-[var(--destructive-foreground)]","border-[var(--destructive-background)]"],accent:["bg-[var(--accent-background)]","text-[var(--accent-foreground)]","border-[var(--accent-background)]"]}},defaultVariants:{variant:"default"}}),W=cva(["fixed z-50 flex flex-col gap-2 p-4","pointer-events-none","max-h-screen overflow-hidden"],{variants:{position:{"top-left":"top-0 left-0 items-start","top-center":"top-0 left-1/2 -translate-x-1/2 items-center","top-right":"top-0 right-0 items-end","bottom-left":"bottom-0 left-0 items-start","bottom-center":"bottom-0 left-1/2 -translate-x-1/2 items-center","bottom-right":"bottom-0 right-0 items-end"}},defaultVariants:{position:"bottom-right"}}),pt=memo(forwardRef(({variant:t="default",className:e,onPress:a},n)=>jsx(S,{ref:n,variant:"ghost",visualSize:"icon",onPress:a,className:i("absolute right-2 top-2",t==="default"?"hover:bg-[var(--accent-background)]/20":"hover:bg-[var(--page-background)]/20",e),"aria-label":"Dismiss notification",children:jsx(X$1,{className:"h-4 w-4","aria-hidden":"true"})})));pt.displayName="CloseButton";var l=new ToastQueue({maxVisibleToasts:3}),R=0,D=new Set;function Ot(){R++,D.forEach(t=>t());}function _t(){R=Math.max(0,R-1),D.forEach(t=>t());}function Y(){return R}function mt(t){return D.add(t),()=>D.delete(t)}var ft={add:(t,e)=>l.add(t,e),close:t=>{l.close(t);},closeAll:()=>{l.visibleToasts.forEach(t=>{l.close(t.key);});},pauseAll:()=>{l.pauseAll();},resumeAll:()=>{l.resumeAll();},get visibleToasts(){return l.visibleToasts},subscribe:t=>l.subscribe(t),get totalCount(){return R}};function O(){return l}function zt(t){return t===0?0:Math.max(t,5e3)}function Gt(t={}){return {variant:t.variant??"default",timeout:t.timeout??5e3,onClose:t.onClose}}function Ht(t,e){let a=Gt(e),n=zt(a.timeout),u="timeout";Ot();let c=ft.add({key:"",content:t,variant:a.variant,timeout:n,onClose:a.onClose},{timeout:n,onClose:()=>{_t(),a.onClose&&a.onClose(c,u);}});return c}var X=memo(forwardRef(({toast:t,state:e},a)=>{let n=useRef(null),u=a||n,{toastProps:c,contentProps:f}=useToast({toast:t},e,u),[d,v]=useState(null),[o,h]=useState(0),s=50,x=useCallback(g=>{let b=g.touches[0];b&&v(b.clientX);},[]),P=useCallback(g=>{if(d===null)return;let b=g.touches[0];if(!b)return;let k=b.clientX-d;k>0&&h(k);},[d]),p=useCallback(()=>{o>s&&e.close(t.key),h(0),v(null);},[o,e,t.key]),B=useCallback(()=>{e.close(t.key);},[e,t.key]),{content:m}=t,N=m.variant??"default",T=typeof m.content=="string"?m.content:"Notification";return jsxs("div",{...c,ref:u,className:i(dt({variant:N})),"aria-label":T,style:{transform:o>0?`translateX(${o}px)`:void 0,opacity:o>0?1-o/200:void 0},onTouchStart:x,onTouchMove:P,onTouchEnd:p,children:[jsx("div",{...f,className:"flex-1 min-w-0",children:typeof m.content=="string"?jsx("p",{className:"text-sm font-medium",children:m.content}):m.content}),jsx(pt,{variant:N,onPress:B})]})}));X.displayName="ToastItem";var Qt=z$1.enum(["timeout","user","programmatic"]),vt=z$1.enum(["default","primary","destructive","accent"]),Tt=z$1.enum(["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"]),Mt=z$1.object({variant:vt.default("default"),timeout:z$1.number().min(0).default(5e3),onClose:z$1.function().optional()}),F=z$1.object({maxVisibleToasts:z$1.number().min(1).default(3)}),U=z$1.object({position:Tt.default("bottom-right"),"aria-label":z$1.string().default("Notifications"),className:z$1.string().optional()});var Yt=createContext(null);function bt({children:t,maxVisibleToasts:e=3}){F.parse({maxVisibleToasts:e});let a=useMemo(()=>O(),[]);return jsx(Yt.Provider,{value:a,children:t})}bt.displayName="ToastProvider";function te({queuedCount:t}){if(t<=0)return null;let e=Math.min(t,2);return jsxs("div",{className:"relative w-[356px] pointer-events-none","aria-hidden":"true",children:[jsx("div",{className:i("absolute left-1/2 -translate-x-1/2 w-[340px] h-4 rounded-lg shadow-lg","bg-[var(--content-background)] border border-[var(--border)]","opacity-60","transition-all duration-200"),style:{top:0}}),e>=2&&jsx("div",{className:i("absolute left-1/2 -translate-x-1/2 w-[324px] h-2 rounded-b-lg shadow-lg","bg-[var(--content-background)] border border-t-0 border-[var(--border)]","opacity-40","transition-all duration-200"),style:{top:14}}),jsx("div",{className:"h-4"}),jsxs("div",{className:"text-sm text-[var(--content-foreground)] opacity-70 text-center py-2 pointer-events-auto","aria-live":"polite",children:["+",t," more notification",t>1?"s":""]})]})}var ht=memo(forwardRef((t,e)=>{let a=U.parse(t),{position:n="bottom-right","aria-label":u="Notifications",className:c}=a,f=useRef(null),d=e||f,v=O(),o=useToastQueue(v),h=useSyncExternalStore(mt,Y,Y),{regionProps:s}=useToastRegion({"aria-label":u},o,d),x=Math.max(0,h-o.visibleToasts.length),P=useCallback(()=>{o.visibleToasts.forEach(p=>{o.close(p.key);});},[o]);return o.visibleToasts.length===0?null:jsxs("div",{...s,ref:d,className:i(W({position:n}),c),children:[o.visibleToasts.map(p=>jsx(X,{toast:p,state:o},p.key)),jsx(te,{queuedCount:x}),o.visibleToasts.length>=2&&jsx(S,{variant:"secondary",visualSize:"sm",onPress:P,"aria-label":"Clear all notifications",className:"mt-2 pointer-events-auto",children:"Clear All"})]})}));ht.displayName="Toaster";export{Qt as DismissReasonSchema,Mt as ToastOptionsSchema,bt as ToastProvider,F as ToastProviderPropsSchema,vt as ToastVariantSchema,ht as Toaster,Tt as ToasterPositionSchema,U as ToasterPropsSchema,Ht as toast,ft as toastQueue,dt as toastVariants,W as toasterVariants};//# sourceMappingURL=index.mjs.map
726
3
  //# sourceMappingURL=index.mjs.map