@devalok/shilp-sutra 0.8.4 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/dist/_chunks/avatar.js +50 -0
  2. package/dist/_chunks/button.js +95 -0
  3. package/dist/_chunks/card.js +40 -0
  4. package/dist/_chunks/checkbox.js +14 -0
  5. package/dist/_chunks/form.js +27 -0
  6. package/dist/_chunks/primitives.js +6965 -0
  7. package/dist/_chunks/sidebar.js +592 -0
  8. package/dist/_chunks/spinner.js +34 -0
  9. package/dist/_chunks/tiptap.js +15254 -0
  10. package/dist/_chunks/tooltip.js +13 -0
  11. package/dist/_chunks/tree-view.js +304 -0
  12. package/dist/_chunks/use-calendar.js +990 -0
  13. package/dist/_chunks/utils.js +15 -0
  14. package/dist/_chunks/vendor.js +5823 -0
  15. package/dist/composed/avatar-group.js +20 -20
  16. package/dist/composed/command-palette.js +1 -1
  17. package/dist/composed/confirm-dialog.js +5 -5
  18. package/dist/composed/content-card.d.ts +1 -1
  19. package/dist/composed/content-card.js +6 -6
  20. package/dist/composed/date-picker/index.js +13 -0
  21. package/dist/composed/empty-state.js +10 -10
  22. package/dist/composed/error-boundary.js +2 -2
  23. package/dist/composed/global-loading.js +4 -4
  24. package/dist/composed/index.js +45 -53
  25. package/dist/composed/loading-skeleton.js +2 -2
  26. package/dist/composed/member-picker.js +5 -5
  27. package/dist/composed/page-header.js +4 -4
  28. package/dist/composed/page-skeletons.js +1 -1
  29. package/dist/composed/priority-indicator.js +6 -6
  30. package/dist/composed/rich-text-editor.js +422 -209
  31. package/dist/composed/schedule-view.js +1 -1
  32. package/dist/composed/simple-tooltip.js +6 -6
  33. package/dist/composed/status-badge.d.ts +1 -1
  34. package/dist/composed/status-badge.js +2 -2
  35. package/dist/shell/bottom-navbar.js +1 -1
  36. package/dist/shell/notification-center.js +2 -2
  37. package/dist/shell/notification-preferences.js +32 -33
  38. package/dist/shell/sidebar.js +24 -24
  39. package/dist/shell/top-bar.js +22 -22
  40. package/dist/ui/accordion.js +17 -17
  41. package/dist/ui/alert-dialog.js +29 -29
  42. package/dist/ui/alert.d.ts +2 -2
  43. package/dist/ui/alert.js +65 -44
  44. package/dist/ui/aspect-ratio.js +1 -1
  45. package/dist/ui/autocomplete.js +11 -11
  46. package/dist/ui/avatar.d.ts +1 -1
  47. package/dist/ui/avatar.js +67 -25
  48. package/dist/ui/badge.d.ts +2 -2
  49. package/dist/ui/badge.js +115 -91
  50. package/dist/ui/banner.d.ts +1 -1
  51. package/dist/ui/banner.js +5 -5
  52. package/dist/ui/breadcrumb.js +14 -14
  53. package/dist/ui/button-group.js +30 -15
  54. package/dist/ui/button.d.ts +2 -2
  55. package/dist/ui/button.js +114 -71
  56. package/dist/ui/card.js +66 -22
  57. package/dist/ui/charts/index.js +1221 -18
  58. package/dist/ui/checkbox.js +25 -5
  59. package/dist/ui/chip.d.ts +4 -4
  60. package/dist/ui/chip.js +2 -2
  61. package/dist/ui/code.js +1 -1
  62. package/dist/ui/collapsible.js +5 -5
  63. package/dist/ui/color-input.js +11 -11
  64. package/dist/ui/combobox.js +12 -12
  65. package/dist/ui/container.js +4 -4
  66. package/dist/ui/context-menu.js +37 -37
  67. package/dist/ui/data-table-toolbar.js +18 -18
  68. package/dist/ui/data-table.js +2 -2
  69. package/dist/ui/dialog.js +33 -33
  70. package/dist/ui/dropdown-menu.js +60 -60
  71. package/dist/ui/file-upload.js +1 -1
  72. package/dist/ui/form.js +36 -15
  73. package/dist/ui/hover-card.js +7 -7
  74. package/dist/ui/icon-button.js +9 -9
  75. package/dist/ui/index.js +523 -325
  76. package/dist/ui/input-otp.d.ts +2 -2
  77. package/dist/ui/input-otp.js +14 -14
  78. package/dist/ui/input.js +56 -28
  79. package/dist/ui/label.js +18 -4
  80. package/dist/ui/lib/utils.js +4 -5
  81. package/dist/ui/link.js +9 -9
  82. package/dist/ui/menubar.js +81 -81
  83. package/dist/ui/navigation-menu.js +42 -42
  84. package/dist/ui/number-input.js +13 -13
  85. package/dist/ui/pagination.js +5 -5
  86. package/dist/ui/popover.js +9 -9
  87. package/dist/ui/progress.d.ts +1 -1
  88. package/dist/ui/progress.js +15 -15
  89. package/dist/ui/radio.js +10 -10
  90. package/dist/ui/search-input.js +5 -5
  91. package/dist/ui/segmented-control.js +91 -83
  92. package/dist/ui/select.js +52 -52
  93. package/dist/ui/separator.js +20 -5
  94. package/dist/ui/sheet.js +28 -28
  95. package/dist/ui/sidebar.js +36 -560
  96. package/dist/ui/skeleton.d.ts +1 -1
  97. package/dist/ui/skeleton.js +9 -9
  98. package/dist/ui/slider.js +11 -11
  99. package/dist/ui/spinner.js +37 -2
  100. package/dist/ui/stack.js +1 -1
  101. package/dist/ui/stat-card.js +1 -1
  102. package/dist/ui/stepper.js +15 -15
  103. package/dist/ui/switch.js +22 -3
  104. package/dist/ui/table.js +1 -1
  105. package/dist/ui/tabs.js +59 -32
  106. package/dist/ui/text.js +2 -2
  107. package/dist/ui/textarea.js +7 -7
  108. package/dist/ui/toast.d.ts +1 -1
  109. package/dist/ui/toast.js +28 -28
  110. package/dist/ui/toggle-group.js +11 -11
  111. package/dist/ui/toggle.js +9 -9
  112. package/dist/ui/tooltip.js +17 -6
  113. package/dist/ui/transitions.js +68 -58
  114. package/dist/ui/tree-view/index.js +7 -0
  115. package/dist/ui/visually-hidden.js +3 -3
  116. package/llms-full.txt +1 -1
  117. package/llms.txt +7 -0
  118. package/package.json +656 -706
  119. package/dist/_virtual/client.js +0 -5
  120. package/dist/_virtual/index.js +0 -5
  121. package/dist/_virtual/react-dom-client.development.js +0 -5
  122. package/dist/_virtual/react-dom-client.production.js +0 -5
  123. package/dist/_virtual/scheduler.development.js +0 -5
  124. package/dist/_virtual/scheduler.production.js +0 -5
  125. package/dist/composed/date-picker/calendar-grid.js +0 -194
  126. package/dist/composed/date-picker/date-picker.js +0 -124
  127. package/dist/composed/date-picker/date-range-picker.js +0 -167
  128. package/dist/composed/date-picker/date-time-picker.js +0 -193
  129. package/dist/composed/date-picker/month-picker.js +0 -53
  130. package/dist/composed/date-picker/presets.js +0 -84
  131. package/dist/composed/date-picker/time-picker.js +0 -181
  132. package/dist/composed/date-picker/use-calendar.js +0 -17
  133. package/dist/composed/date-picker/year-picker.js +0 -45
  134. package/dist/composed/extensions/emoji-suggestion.js +0 -119
  135. package/dist/composed/extensions/file-attachment.js +0 -55
  136. package/dist/composed/extensions/mention-suggestion.js +0 -79
  137. package/dist/node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.js +0 -40141
  138. package/dist/node_modules/.pnpm/@emoji-mart_react@1.1.1_emoji-mart@5.6.0_react@19.2.4/node_modules/@emoji-mart/react/dist/module.js +0 -17
  139. package/dist/node_modules/.pnpm/emoji-mart@5.6.0/node_modules/emoji-mart/dist/module.js +0 -2958
  140. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/cjs/react-dom-client.development.js +0 -17062
  141. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/cjs/react-dom-client.production.js +0 -9790
  142. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/client.js +0 -20
  143. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.development.js +0 -237
  144. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.production.js +0 -234
  145. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/index.js +0 -11
  146. package/dist/primitives/_internal/number.js +0 -6
  147. package/dist/primitives/_internal/primitive.js +0 -9
  148. package/dist/primitives/_internal/react-arrow.js +0 -13
  149. package/dist/primitives/_internal/react-collection.js +0 -48
  150. package/dist/primitives/_internal/react-compose-refs.js +0 -29
  151. package/dist/primitives/_internal/react-context.js +0 -76
  152. package/dist/primitives/_internal/react-direction.js +0 -10
  153. package/dist/primitives/_internal/react-dismissable-layer.js +0 -103
  154. package/dist/primitives/_internal/react-focus-guards.js +0 -17
  155. package/dist/primitives/_internal/react-focus-scope.js +0 -137
  156. package/dist/primitives/_internal/react-id.js +0 -14
  157. package/dist/primitives/_internal/react-popper.js +0 -137
  158. package/dist/primitives/_internal/react-portal.js +0 -16
  159. package/dist/primitives/_internal/react-presence.js +0 -71
  160. package/dist/primitives/_internal/react-primitive.js +0 -36
  161. package/dist/primitives/_internal/react-use-callback-ref.js +0 -13
  162. package/dist/primitives/_internal/react-use-controllable-state.js +0 -44
  163. package/dist/primitives/_internal/react-use-escape-keydown.js +0 -14
  164. package/dist/primitives/_internal/react-use-is-hydrated.js +0 -15
  165. package/dist/primitives/_internal/react-use-layout-effect.js +0 -6
  166. package/dist/primitives/_internal/react-use-previous.js +0 -8
  167. package/dist/primitives/_internal/react-use-size.js +0 -27
  168. package/dist/primitives/react-accordion.js +0 -239
  169. package/dist/primitives/react-alert-dialog.js +0 -127
  170. package/dist/primitives/react-aspect-ratio.js +0 -43
  171. package/dist/primitives/react-avatar.js +0 -75
  172. package/dist/primitives/react-checkbox.js +0 -251
  173. package/dist/primitives/react-collapsible.js +0 -120
  174. package/dist/primitives/react-context-menu.js +0 -240
  175. package/dist/primitives/react-dialog.js +0 -262
  176. package/dist/primitives/react-dropdown-menu.js +0 -227
  177. package/dist/primitives/react-hover-card.js +0 -187
  178. package/dist/primitives/react-label.js +0 -20
  179. package/dist/primitives/react-menu.js +0 -652
  180. package/dist/primitives/react-menubar.js +0 -355
  181. package/dist/primitives/react-navigation-menu.js +0 -607
  182. package/dist/primitives/react-popover.js +0 -243
  183. package/dist/primitives/react-progress.js +0 -84
  184. package/dist/primitives/react-radio-group.js +0 -238
  185. package/dist/primitives/react-roving-focus.js +0 -183
  186. package/dist/primitives/react-select.js +0 -862
  187. package/dist/primitives/react-separator.js +0 -24
  188. package/dist/primitives/react-slider.js +0 -437
  189. package/dist/primitives/react-slot.js +0 -70
  190. package/dist/primitives/react-switch.js +0 -132
  191. package/dist/primitives/react-tabs.js +0 -163
  192. package/dist/primitives/react-toast.js +0 -446
  193. package/dist/primitives/react-toggle-group.js +0 -137
  194. package/dist/primitives/react-toggle.js +0 -33
  195. package/dist/primitives/react-tooltip.js +0 -338
  196. package/dist/primitives/react-visually-hidden.js +0 -32
  197. package/dist/ui/charts/_internal/animation.js +0 -18
  198. package/dist/ui/charts/_internal/axes.js +0 -42
  199. package/dist/ui/charts/_internal/colors.js +0 -21
  200. package/dist/ui/charts/_internal/grid-lines.js +0 -43
  201. package/dist/ui/charts/_internal/legend.js +0 -29
  202. package/dist/ui/charts/_internal/tooltip.js +0 -39
  203. package/dist/ui/charts/_internal/types.js +0 -10
  204. package/dist/ui/charts/area-chart.js +0 -245
  205. package/dist/ui/charts/bar-chart.js +0 -153
  206. package/dist/ui/charts/chart-container.js +0 -27
  207. package/dist/ui/charts/gauge-chart.js +0 -72
  208. package/dist/ui/charts/line-chart.js +0 -163
  209. package/dist/ui/charts/pie-chart.js +0 -132
  210. package/dist/ui/charts/radar-chart.js +0 -223
  211. package/dist/ui/charts/sparkline.js +0 -124
  212. package/dist/ui/lib/motion.js +0 -32
  213. package/dist/ui/lib/use-reduced-motion.js +0 -15
  214. package/dist/ui/lib/use-ripple.js +0 -14
  215. package/dist/ui/tree-view/tree-item.js +0 -139
  216. package/dist/ui/tree-view/tree-view.js +0 -140
  217. package/dist/ui/tree-view/use-tree.js +0 -38
@@ -1,163 +0,0 @@
1
- import * as v from "react";
2
- import { composeEventHandlers as g } from "./_internal/primitive.js";
3
- import { createContextScope as x } from "./_internal/react-context.js";
4
- import { Root as E, Item as F, createRovingFocusGroupScope as C } from "./react-roving-focus.js";
5
- import { Presence as w } from "./_internal/react-presence.js";
6
- import { Primitive as b } from "./_internal/react-primitive.js";
7
- import { useDirection as D } from "./_internal/react-direction.js";
8
- import { useControllableState as V } from "./_internal/react-use-controllable-state.js";
9
- import { useId as G } from "./_internal/react-id.js";
10
- import { jsx as l } from "react/jsx-runtime";
11
- var p = "Tabs", [L] = x(p, [
12
- C
13
- ]), h = C(), [$, T] = L(p), I = v.forwardRef(
14
- (e, r) => {
15
- const {
16
- __scopeTabs: s,
17
- value: t,
18
- onValueChange: n,
19
- defaultValue: c,
20
- orientation: o = "horizontal",
21
- dir: d,
22
- activationMode: f = "automatic",
23
- ...m
24
- } = e, i = D(d), [a, u] = V({
25
- prop: t,
26
- onChange: n,
27
- defaultProp: c ?? "",
28
- caller: p
29
- });
30
- return /* @__PURE__ */ l(
31
- $,
32
- {
33
- scope: s,
34
- baseId: G(),
35
- value: a,
36
- onValueChange: u,
37
- orientation: o,
38
- dir: i,
39
- activationMode: f,
40
- children: /* @__PURE__ */ l(
41
- b.div,
42
- {
43
- dir: i,
44
- "data-orientation": o,
45
- ...m,
46
- ref: r
47
- }
48
- )
49
- }
50
- );
51
- }
52
- );
53
- I.displayName = p;
54
- var R = "TabsList", _ = v.forwardRef(
55
- (e, r) => {
56
- const { __scopeTabs: s, loop: t = !0, ...n } = e, c = T(R, s), o = h(s);
57
- return /* @__PURE__ */ l(
58
- E,
59
- {
60
- asChild: !0,
61
- ...o,
62
- orientation: c.orientation,
63
- dir: c.dir,
64
- loop: t,
65
- children: /* @__PURE__ */ l(
66
- b.div,
67
- {
68
- role: "tablist",
69
- "aria-orientation": c.orientation,
70
- ...n,
71
- ref: r
72
- }
73
- )
74
- }
75
- );
76
- }
77
- );
78
- _.displayName = R;
79
- var y = "TabsTrigger", A = v.forwardRef(
80
- (e, r) => {
81
- const { __scopeTabs: s, value: t, disabled: n = !1, ...c } = e, o = T(y, s), d = h(s), f = P(o.baseId, t), m = S(o.baseId, t), i = t === o.value;
82
- return /* @__PURE__ */ l(
83
- F,
84
- {
85
- asChild: !0,
86
- ...d,
87
- focusable: !n,
88
- active: i,
89
- children: /* @__PURE__ */ l(
90
- b.button,
91
- {
92
- type: "button",
93
- role: "tab",
94
- "aria-selected": i,
95
- "aria-controls": m,
96
- "data-state": i ? "active" : "inactive",
97
- "data-disabled": n ? "" : void 0,
98
- disabled: n,
99
- id: f,
100
- ...c,
101
- ref: r,
102
- onMouseDown: g(e.onMouseDown, (a) => {
103
- !n && a.button === 0 && a.ctrlKey === !1 ? o.onValueChange(t) : a.preventDefault();
104
- }),
105
- onKeyDown: g(e.onKeyDown, (a) => {
106
- [" ", "Enter"].includes(a.key) && o.onValueChange(t);
107
- }),
108
- onFocus: g(e.onFocus, () => {
109
- const a = o.activationMode !== "manual";
110
- !i && !n && a && o.onValueChange(t);
111
- })
112
- }
113
- )
114
- }
115
- );
116
- }
117
- );
118
- A.displayName = y;
119
- var M = "TabsContent", N = v.forwardRef(
120
- (e, r) => {
121
- const { __scopeTabs: s, value: t, forceMount: n, children: c, ...o } = e, d = T(M, s), f = P(d.baseId, t), m = S(d.baseId, t), i = t === d.value, a = v.useRef(i);
122
- return v.useEffect(() => {
123
- const u = requestAnimationFrame(() => a.current = !1);
124
- return () => cancelAnimationFrame(u);
125
- }, []), /* @__PURE__ */ l(w, { present: n || i, children: ({ present: u }) => /* @__PURE__ */ l(
126
- b.div,
127
- {
128
- "data-state": i ? "active" : "inactive",
129
- "data-orientation": d.orientation,
130
- role: "tabpanel",
131
- "aria-labelledby": f,
132
- hidden: !u,
133
- id: m,
134
- tabIndex: 0,
135
- ...o,
136
- ref: r,
137
- style: {
138
- ...e.style,
139
- animationDuration: a.current ? "0s" : void 0
140
- },
141
- children: u && c
142
- }
143
- ) });
144
- }
145
- );
146
- N.displayName = M;
147
- function P(e, r) {
148
- return `${e}-trigger-${r}`;
149
- }
150
- function S(e, r) {
151
- return `${e}-content-${r}`;
152
- }
153
- var Q = I, U = _, W = A, X = N;
154
- export {
155
- X as Content,
156
- U as List,
157
- Q as Root,
158
- I as Tabs,
159
- N as TabsContent,
160
- _ as TabsList,
161
- A as TabsTrigger,
162
- W as Trigger
163
- };
@@ -1,446 +0,0 @@
1
- import * as n from "react";
2
- import * as Pe from "react-dom";
3
- import { composeEventHandlers as R } from "./_internal/primitive.js";
4
- import { useComposedRefs as oe } from "./_internal/react-compose-refs.js";
5
- import { createCollection as Ce } from "./_internal/react-collection.js";
6
- import { createContextScope as xe } from "./_internal/react-context.js";
7
- import { Branch as he, Root as Re } from "./_internal/react-dismissable-layer.js";
8
- import { Portal as be } from "./_internal/react-portal.js";
9
- import { Presence as ge } from "./_internal/react-presence.js";
10
- import { Primitive as D, dispatchDiscreteCustomEvent as Se } from "./_internal/react-primitive.js";
11
- import { useCallbackRef as U } from "./_internal/react-use-callback-ref.js";
12
- import { useControllableState as Ie } from "./_internal/react-use-controllable-state.js";
13
- import { useLayoutEffect as Ae } from "./_internal/react-use-layout-effect.js";
14
- import { VisuallyHidden as re } from "./react-visually-hidden.js";
15
- import { jsx as l, jsxs as G, Fragment as ne } from "react/jsx-runtime";
16
- var J = "ToastProvider", [Q, Fe, _e] = Ce("Toast"), [se] = xe("Toast", [_e]), [De, X] = se(J), ae = (e) => {
17
- const {
18
- __scopeToast: o,
19
- label: r = "Notification",
20
- duration: t = 5e3,
21
- swipeDirection: c = "right",
22
- swipeThreshold: d = 50,
23
- children: p
24
- } = e, [v, T] = n.useState(null), [s, h] = n.useState(0), y = n.useRef(!1), N = n.useRef(!1);
25
- return r.trim() || console.error(
26
- `Invalid prop \`label\` supplied to \`${J}\`. Expected non-empty \`string\`.`
27
- ), /* @__PURE__ */ l(Q.Provider, { scope: o, children: /* @__PURE__ */ l(
28
- De,
29
- {
30
- scope: o,
31
- label: r,
32
- duration: t,
33
- swipeDirection: c,
34
- swipeThreshold: d,
35
- toastCount: s,
36
- viewport: v,
37
- onViewportChange: T,
38
- onToastAdd: n.useCallback(() => h((g) => g + 1), []),
39
- onToastRemove: n.useCallback(() => h((g) => g - 1), []),
40
- isFocusedToastEscapeKeyDownRef: y,
41
- isClosePausedRef: N,
42
- children: p
43
- }
44
- ) });
45
- };
46
- ae.displayName = J;
47
- var ie = "ToastViewport", Ne = ["F8"], j = "toast.viewportPause", q = "toast.viewportResume", ce = n.forwardRef(
48
- (e, o) => {
49
- const {
50
- __scopeToast: r,
51
- hotkey: t = Ne,
52
- label: c = "Notifications ({hotkey})",
53
- ...d
54
- } = e, p = X(ie, r), v = Fe(r), T = n.useRef(null), s = n.useRef(null), h = n.useRef(null), y = n.useRef(null), N = oe(o, y, p.onViewportChange), g = t.join("+").replace(/Key/g, "").replace(/Digit/g, ""), S = p.toastCount > 0;
55
- n.useEffect(() => {
56
- const i = (P) => {
57
- var m;
58
- t.length !== 0 && t.every((w) => P[w] || P.code === w) && ((m = y.current) == null || m.focus());
59
- };
60
- return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
61
- }, [t]), n.useEffect(() => {
62
- const i = T.current, P = y.current;
63
- if (S && i && P) {
64
- const f = () => {
65
- if (!p.isClosePausedRef.current) {
66
- const C = new CustomEvent(j);
67
- P.dispatchEvent(C), p.isClosePausedRef.current = !0;
68
- }
69
- }, m = () => {
70
- if (p.isClosePausedRef.current) {
71
- const C = new CustomEvent(q);
72
- P.dispatchEvent(C), p.isClosePausedRef.current = !1;
73
- }
74
- }, w = (C) => {
75
- !i.contains(C.relatedTarget) && m();
76
- }, E = () => {
77
- i.contains(document.activeElement) || m();
78
- };
79
- return i.addEventListener("focusin", f), i.addEventListener("focusout", w), i.addEventListener("pointermove", f), i.addEventListener("pointerleave", E), window.addEventListener("blur", f), window.addEventListener("focus", m), () => {
80
- i.removeEventListener("focusin", f), i.removeEventListener("focusout", w), i.removeEventListener("pointermove", f), i.removeEventListener("pointerleave", E), window.removeEventListener("blur", f), window.removeEventListener("focus", m);
81
- };
82
- }
83
- }, [S, p.isClosePausedRef]);
84
- const u = n.useCallback(
85
- ({ tabbingDirection: i }) => {
86
- const f = v().map((m) => {
87
- const w = m.ref.current, E = [w, ...Be(w)];
88
- return i === "forwards" ? E : E.reverse();
89
- });
90
- return (i === "forwards" ? f.reverse() : f).flat();
91
- },
92
- [v]
93
- );
94
- return n.useEffect(() => {
95
- const i = y.current;
96
- if (i) {
97
- const P = (f) => {
98
- var E, C, I;
99
- const m = f.altKey || f.ctrlKey || f.metaKey;
100
- if (f.key === "Tab" && !m) {
101
- const L = document.activeElement, F = f.shiftKey;
102
- if (f.target === i && F) {
103
- (E = s.current) == null || E.focus();
104
- return;
105
- }
106
- const A = u({ tabbingDirection: F ? "backwards" : "forwards" }), V = A.findIndex((a) => a === L);
107
- B(A.slice(V + 1)) ? f.preventDefault() : F ? (C = s.current) == null || C.focus() : (I = h.current) == null || I.focus();
108
- }
109
- };
110
- return i.addEventListener("keydown", P), () => i.removeEventListener("keydown", P);
111
- }
112
- }, [v, u]), /* @__PURE__ */ G(
113
- he,
114
- {
115
- ref: T,
116
- role: "region",
117
- "aria-label": c.replace("{hotkey}", g),
118
- tabIndex: -1,
119
- style: { pointerEvents: S ? void 0 : "none" },
120
- children: [
121
- S && /* @__PURE__ */ l(
122
- z,
123
- {
124
- ref: s,
125
- onFocusFromOutsideViewport: () => {
126
- const i = u({
127
- tabbingDirection: "forwards"
128
- });
129
- B(i);
130
- }
131
- }
132
- ),
133
- /* @__PURE__ */ l(Q.Slot, { scope: r, children: /* @__PURE__ */ l(D.ol, { tabIndex: -1, ...d, ref: N }) }),
134
- S && /* @__PURE__ */ l(
135
- z,
136
- {
137
- ref: h,
138
- onFocusFromOutsideViewport: () => {
139
- const i = u({
140
- tabbingDirection: "backwards"
141
- });
142
- B(i);
143
- }
144
- }
145
- )
146
- ]
147
- }
148
- );
149
- }
150
- );
151
- ce.displayName = ie;
152
- var ue = "ToastFocusProxy", z = n.forwardRef(
153
- (e, o) => {
154
- const { __scopeToast: r, onFocusFromOutsideViewport: t, ...c } = e, d = X(ue, r);
155
- return /* @__PURE__ */ l(
156
- re,
157
- {
158
- tabIndex: 0,
159
- ...c,
160
- ref: o,
161
- style: { position: "fixed" },
162
- onFocus: (p) => {
163
- var s;
164
- const v = p.relatedTarget;
165
- !((s = d.viewport) != null && s.contains(v)) && t();
166
- }
167
- }
168
- );
169
- }
170
- );
171
- z.displayName = ue;
172
- var k = "Toast", Le = "toast.swipeStart", Me = "toast.swipeMove", Oe = "toast.swipeCancel", ke = "toast.swipeEnd", le = n.forwardRef(
173
- (e, o) => {
174
- const { forceMount: r, open: t, defaultOpen: c, onOpenChange: d, ...p } = e, [v, T] = Ie({
175
- prop: t,
176
- defaultProp: c ?? !0,
177
- onChange: d,
178
- caller: k
179
- });
180
- return /* @__PURE__ */ l(ge, { present: r || v, children: /* @__PURE__ */ l(
181
- He,
182
- {
183
- open: v,
184
- ...p,
185
- ref: o,
186
- onClose: () => T(!1),
187
- onPause: U(e.onPause),
188
- onResume: U(e.onResume),
189
- onSwipeStart: R(e.onSwipeStart, (s) => {
190
- s.currentTarget.setAttribute("data-swipe", "start");
191
- }),
192
- onSwipeMove: R(e.onSwipeMove, (s) => {
193
- const { x: h, y } = s.detail.delta;
194
- s.currentTarget.setAttribute("data-swipe", "move"), s.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${h}px`), s.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${y}px`);
195
- }),
196
- onSwipeCancel: R(e.onSwipeCancel, (s) => {
197
- s.currentTarget.setAttribute("data-swipe", "cancel"), s.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), s.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), s.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"), s.currentTarget.style.removeProperty("--radix-toast-swipe-end-y");
198
- }),
199
- onSwipeEnd: R(e.onSwipeEnd, (s) => {
200
- const { x: h, y } = s.detail.delta;
201
- s.currentTarget.setAttribute("data-swipe", "end"), s.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), s.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), s.currentTarget.style.setProperty("--radix-toast-swipe-end-x", `${h}px`), s.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${y}px`), T(!1);
202
- })
203
- }
204
- ) });
205
- }
206
- );
207
- le.displayName = k;
208
- var [Ve, Ke] = se(k, {
209
- onClose() {
210
- }
211
- }), He = n.forwardRef(
212
- (e, o) => {
213
- const {
214
- __scopeToast: r,
215
- type: t = "foreground",
216
- duration: c,
217
- open: d,
218
- onClose: p,
219
- onEscapeKeyDown: v,
220
- onPause: T,
221
- onResume: s,
222
- onSwipeStart: h,
223
- onSwipeMove: y,
224
- onSwipeCancel: N,
225
- onSwipeEnd: g,
226
- ...S
227
- } = e, u = X(k, r), [i, P] = n.useState(null), f = oe(o, (a) => P(a)), m = n.useRef(null), w = n.useRef(null), E = c || u.duration, C = n.useRef(0), I = n.useRef(E), L = n.useRef(0), { onToastAdd: F, onToastRemove: Y } = u, _ = U(() => {
228
- var x;
229
- (i == null ? void 0 : i.contains(document.activeElement)) && ((x = u.viewport) == null || x.focus()), p();
230
- }), A = n.useCallback(
231
- (a) => {
232
- !a || a === 1 / 0 || (window.clearTimeout(L.current), C.current = (/* @__PURE__ */ new Date()).getTime(), L.current = window.setTimeout(_, a));
233
- },
234
- [_]
235
- );
236
- n.useEffect(() => {
237
- const a = u.viewport;
238
- if (a) {
239
- const x = () => {
240
- A(I.current), s == null || s();
241
- }, b = () => {
242
- const M = (/* @__PURE__ */ new Date()).getTime() - C.current;
243
- I.current = I.current - M, window.clearTimeout(L.current), T == null || T();
244
- };
245
- return a.addEventListener(j, b), a.addEventListener(q, x), () => {
246
- a.removeEventListener(j, b), a.removeEventListener(q, x);
247
- };
248
- }
249
- }, [u.viewport, E, T, s, A]), n.useEffect(() => {
250
- d && !u.isClosePausedRef.current && A(E);
251
- }, [d, E, u.isClosePausedRef, A]), n.useEffect(() => (F(), () => Y()), [F, Y]);
252
- const V = n.useMemo(() => i ? we(i) : null, [i]);
253
- return u.viewport ? /* @__PURE__ */ G(ne, { children: [
254
- V && /* @__PURE__ */ l(
255
- We,
256
- {
257
- __scopeToast: r,
258
- role: "status",
259
- "aria-live": t === "foreground" ? "assertive" : "polite",
260
- children: V
261
- }
262
- ),
263
- /* @__PURE__ */ l(Ve, { scope: r, onClose: _, children: Pe.createPortal(
264
- /* @__PURE__ */ l(Q.ItemSlot, { scope: r, children: /* @__PURE__ */ l(
265
- Re,
266
- {
267
- asChild: !0,
268
- onEscapeKeyDown: R(v, () => {
269
- u.isFocusedToastEscapeKeyDownRef.current || _(), u.isFocusedToastEscapeKeyDownRef.current = !1;
270
- }),
271
- children: /* @__PURE__ */ l(
272
- D.li,
273
- {
274
- tabIndex: 0,
275
- "data-state": d ? "open" : "closed",
276
- "data-swipe-direction": u.swipeDirection,
277
- ...S,
278
- ref: f,
279
- style: { userSelect: "none", touchAction: "none", ...e.style },
280
- onKeyDown: R(e.onKeyDown, (a) => {
281
- a.key === "Escape" && (v == null || v(a.nativeEvent), a.nativeEvent.defaultPrevented || (u.isFocusedToastEscapeKeyDownRef.current = !0, _()));
282
- }),
283
- onPointerDown: R(e.onPointerDown, (a) => {
284
- a.button === 0 && (m.current = { x: a.clientX, y: a.clientY });
285
- }),
286
- onPointerMove: R(e.onPointerMove, (a) => {
287
- if (!m.current) return;
288
- const x = a.clientX - m.current.x, b = a.clientY - m.current.y, M = !!w.current, O = ["left", "right"].includes(u.swipeDirection), K = ["left", "up"].includes(u.swipeDirection) ? Math.min : Math.max, Ee = O ? K(0, x) : 0, ye = O ? 0 : K(0, b), $ = a.pointerType === "touch" ? 10 : 2, H = { x: Ee, y: ye }, ee = { originalEvent: a, delta: H };
289
- M ? (w.current = H, W(Me, y, ee, {
290
- discrete: !1
291
- })) : te(H, u.swipeDirection, $) ? (w.current = H, W(Le, h, ee, {
292
- discrete: !1
293
- }), a.target.setPointerCapture(a.pointerId)) : (Math.abs(x) > $ || Math.abs(b) > $) && (m.current = null);
294
- }),
295
- onPointerUp: R(e.onPointerUp, (a) => {
296
- const x = w.current, b = a.target;
297
- if (b.hasPointerCapture(a.pointerId) && b.releasePointerCapture(a.pointerId), w.current = null, m.current = null, x) {
298
- const M = a.currentTarget, O = { originalEvent: a, delta: x };
299
- te(x, u.swipeDirection, u.swipeThreshold) ? W(ke, g, O, {
300
- discrete: !0
301
- }) : W(
302
- Oe,
303
- N,
304
- O,
305
- {
306
- discrete: !0
307
- }
308
- ), M.addEventListener("click", (K) => K.preventDefault(), {
309
- once: !0
310
- });
311
- }
312
- })
313
- }
314
- )
315
- }
316
- ) }),
317
- u.viewport
318
- ) })
319
- ] }) : null;
320
- }
321
- ), We = (e) => {
322
- const { __scopeToast: o, children: r, ...t } = e, c = X(k, o), [d, p] = n.useState(!1), [v, T] = n.useState(!1);
323
- return Ye(() => p(!0)), n.useEffect(() => {
324
- const s = window.setTimeout(() => T(!0), 1e3);
325
- return () => window.clearTimeout(s);
326
- }, []), v ? null : /* @__PURE__ */ l(be, { asChild: !0, children: /* @__PURE__ */ l(re, { ...t, children: d && /* @__PURE__ */ G(ne, { children: [
327
- c.label,
328
- " ",
329
- r
330
- ] }) }) });
331
- }, Ue = "ToastTitle", de = n.forwardRef(
332
- (e, o) => {
333
- const { __scopeToast: r, ...t } = e;
334
- return /* @__PURE__ */ l(D.div, { ...t, ref: o });
335
- }
336
- );
337
- de.displayName = Ue;
338
- var Xe = "ToastDescription", pe = n.forwardRef(
339
- (e, o) => {
340
- const { __scopeToast: r, ...t } = e;
341
- return /* @__PURE__ */ l(D.div, { ...t, ref: o });
342
- }
343
- );
344
- pe.displayName = Xe;
345
- var fe = "ToastAction", me = n.forwardRef(
346
- (e, o) => {
347
- const { altText: r, ...t } = e;
348
- return r.trim() ? /* @__PURE__ */ l(Te, { altText: r, asChild: !0, children: /* @__PURE__ */ l(Z, { ...t, ref: o }) }) : (console.error(
349
- `Invalid prop \`altText\` supplied to \`${fe}\`. Expected non-empty \`string\`.`
350
- ), null);
351
- }
352
- );
353
- me.displayName = fe;
354
- var ve = "ToastClose", Z = n.forwardRef(
355
- (e, o) => {
356
- const { __scopeToast: r, ...t } = e, c = Ke(ve, r);
357
- return /* @__PURE__ */ l(Te, { asChild: !0, children: /* @__PURE__ */ l(
358
- D.button,
359
- {
360
- type: "button",
361
- ...t,
362
- ref: o,
363
- onClick: R(e.onClick, c.onClose)
364
- }
365
- ) });
366
- }
367
- );
368
- Z.displayName = ve;
369
- var Te = n.forwardRef((e, o) => {
370
- const { __scopeToast: r, altText: t, ...c } = e;
371
- return /* @__PURE__ */ l(
372
- D.div,
373
- {
374
- "data-radix-toast-announce-exclude": "",
375
- "data-radix-toast-announce-alt": t || void 0,
376
- ...c,
377
- ref: o
378
- }
379
- );
380
- });
381
- function we(e) {
382
- const o = [];
383
- return Array.from(e.childNodes).forEach((t) => {
384
- if (t.nodeType === t.TEXT_NODE && t.textContent && o.push(t.textContent), $e(t)) {
385
- const c = t.ariaHidden || t.hidden || t.style.display === "none", d = t.dataset.radixToastAnnounceExclude === "";
386
- if (!c)
387
- if (d) {
388
- const p = t.dataset.radixToastAnnounceAlt;
389
- p && o.push(p);
390
- } else
391
- o.push(...we(t));
392
- }
393
- }), o;
394
- }
395
- function W(e, o, r, { discrete: t }) {
396
- const c = r.originalEvent.currentTarget, d = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: r });
397
- o && c.addEventListener(e, o, { once: !0 }), t ? Se(c, d) : c.dispatchEvent(d);
398
- }
399
- var te = (e, o, r = 0) => {
400
- const t = Math.abs(e.x), c = Math.abs(e.y), d = t > c;
401
- return o === "left" || o === "right" ? d && t > r : !d && c > r;
402
- };
403
- function Ye(e = () => {
404
- }) {
405
- const o = U(e);
406
- Ae(() => {
407
- let r = 0, t = 0;
408
- return r = window.requestAnimationFrame(() => t = window.requestAnimationFrame(o)), () => {
409
- window.cancelAnimationFrame(r), window.cancelAnimationFrame(t);
410
- };
411
- }, [o]);
412
- }
413
- function $e(e) {
414
- return e.nodeType === e.ELEMENT_NODE;
415
- }
416
- function Be(e) {
417
- const o = [], r = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
418
- acceptNode: (t) => {
419
- const c = t.tagName === "INPUT" && t.type === "hidden";
420
- return t.disabled || t.hidden || c ? NodeFilter.FILTER_SKIP : t.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
421
- }
422
- });
423
- for (; r.nextNode(); ) o.push(r.currentNode);
424
- return o;
425
- }
426
- function B(e) {
427
- const o = document.activeElement;
428
- return e.some((r) => r === o ? !0 : (r.focus(), document.activeElement !== o));
429
- }
430
- var at = ae, it = ce, ct = le, ut = de, lt = pe, dt = me, pt = Z;
431
- export {
432
- dt as Action,
433
- pt as Close,
434
- lt as Description,
435
- at as Provider,
436
- ct as Root,
437
- ut as Title,
438
- le as Toast,
439
- me as ToastAction,
440
- Z as ToastClose,
441
- pe as ToastDescription,
442
- ae as ToastProvider,
443
- de as ToastTitle,
444
- ce as ToastViewport,
445
- it as Viewport
446
- };