@nayhoo/ui 0.8.0 → 0.9.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 (215) hide show
  1. package/dist/{avatar.css-BKo21sUI.d.mts → avatar.css-Lh26jRUS.d.mts} +1 -3
  2. package/dist/{avatar.css-BKo21sUI.d.ts → avatar.css-Lh26jRUS.d.ts} +1 -3
  3. package/dist/{checkbox.css-BlFMNrMD.d.mts → checkbox.css-C3L6B1cb.d.mts} +1 -3
  4. package/dist/{checkbox.css-BlFMNrMD.d.ts → checkbox.css-C3L6B1cb.d.ts} +1 -3
  5. package/dist/chunk-3HAUMRRS.mjs +8 -0
  6. package/dist/chunk-3HAUMRRS.mjs.map +1 -0
  7. package/dist/chunk-3Z2HB2J6.mjs +25 -0
  8. package/dist/chunk-3Z2HB2J6.mjs.map +1 -0
  9. package/dist/chunk-67K3UKEB.mjs +7 -0
  10. package/dist/chunk-67K3UKEB.mjs.map +1 -0
  11. package/dist/chunk-GI2XNLAW.mjs +39 -0
  12. package/dist/chunk-GI2XNLAW.mjs.map +1 -0
  13. package/dist/{chunk-7MD4JYZV.mjs → chunk-JZLACTAO.mjs} +2 -4
  14. package/dist/chunk-JZLACTAO.mjs.map +1 -0
  15. package/dist/chunk-KL3725C5.mjs +13 -0
  16. package/dist/chunk-KL3725C5.mjs.map +1 -0
  17. package/dist/chunk-LKYTRD4P.mjs +14 -0
  18. package/dist/chunk-LKYTRD4P.mjs.map +1 -0
  19. package/dist/chunk-NOIOHUNH.mjs +7 -0
  20. package/dist/chunk-NOIOHUNH.mjs.map +1 -0
  21. package/dist/chunk-NU7XYEVP.mjs +43 -0
  22. package/dist/chunk-NU7XYEVP.mjs.map +1 -0
  23. package/dist/chunk-OI24WXH6.mjs +7 -0
  24. package/dist/chunk-OI24WXH6.mjs.map +1 -0
  25. package/dist/chunk-P3OUEGR4.mjs +7 -0
  26. package/dist/chunk-P3OUEGR4.mjs.map +1 -0
  27. package/dist/chunk-R6MZB2ED.mjs +1 -0
  28. package/dist/chunk-RAS2GZOT.mjs +25 -0
  29. package/dist/chunk-RAS2GZOT.mjs.map +1 -0
  30. package/dist/{chunk-YQH4Y34B.mjs → chunk-RW2UU73S.mjs} +6 -4
  31. package/dist/chunk-RW2UU73S.mjs.map +1 -0
  32. package/dist/{chunk-XALDYHCC.mjs → chunk-WPNBONR3.mjs} +3 -8
  33. package/dist/chunk-WPNBONR3.mjs.map +1 -0
  34. package/dist/chunk-X6UXW66P.mjs +39 -0
  35. package/dist/chunk-X6UXW66P.mjs.map +1 -0
  36. package/dist/component-props-BHzinuRX.d.mts +5 -0
  37. package/dist/component-props-BHzinuRX.d.ts +5 -0
  38. package/dist/components/avatar.css +20 -18
  39. package/dist/components/avatar.css.map +1 -1
  40. package/dist/components/avatar.d.mts +1 -1
  41. package/dist/components/avatar.d.ts +1 -1
  42. package/dist/components/avatar.js +19 -22
  43. package/dist/components/avatar.js.map +1 -1
  44. package/dist/components/avatar.mjs +6 -6
  45. package/dist/components/avatar.mjs.map +1 -1
  46. package/dist/components/badge.d.mts +1 -1
  47. package/dist/components/badge.d.ts +1 -1
  48. package/dist/components/box.css +2 -2
  49. package/dist/components/box.css.map +1 -1
  50. package/dist/components/box.d.mts +2 -4
  51. package/dist/components/box.d.ts +2 -4
  52. package/dist/components/box.js +2 -14
  53. package/dist/components/box.js.map +1 -1
  54. package/dist/components/box.mjs +2 -3
  55. package/dist/components/button.d.mts +2 -2
  56. package/dist/components/button.d.ts +2 -2
  57. package/dist/components/button.js.map +1 -1
  58. package/dist/components/button.mjs +6 -33
  59. package/dist/components/button.mjs.map +1 -1
  60. package/dist/components/card.css +2 -2
  61. package/dist/components/card.css.map +1 -1
  62. package/dist/components/card.d.mts +1 -1
  63. package/dist/components/card.d.ts +1 -1
  64. package/dist/components/card.js +1 -1
  65. package/dist/components/card.js.map +1 -1
  66. package/dist/components/card.mjs +2 -2
  67. package/dist/components/checkbox.css +4 -2
  68. package/dist/components/checkbox.css.map +1 -1
  69. package/dist/components/checkbox.d.mts +2 -2
  70. package/dist/components/checkbox.d.ts +2 -2
  71. package/dist/components/checkbox.js +3 -4
  72. package/dist/components/checkbox.js.map +1 -1
  73. package/dist/components/checkbox.mjs +2 -5
  74. package/dist/components/checkbox.mjs.map +1 -1
  75. package/dist/components/container.d.mts +1 -1
  76. package/dist/components/container.d.ts +1 -1
  77. package/dist/components/dropdown-menu.css +13 -13
  78. package/dist/components/dropdown-menu.css.map +1 -1
  79. package/dist/components/dropdown-menu.d.mts +6 -9
  80. package/dist/components/dropdown-menu.d.ts +6 -9
  81. package/dist/components/dropdown-menu.js +20 -37
  82. package/dist/components/dropdown-menu.js.map +1 -1
  83. package/dist/components/dropdown-menu.mjs +11 -25
  84. package/dist/components/dropdown-menu.mjs.map +1 -1
  85. package/dist/components/flex.d.mts +1 -1
  86. package/dist/components/flex.d.ts +1 -1
  87. package/dist/components/form.css +12 -10
  88. package/dist/components/form.css.map +1 -1
  89. package/dist/components/form.d.mts +3 -3
  90. package/dist/components/form.d.ts +3 -3
  91. package/dist/components/form.js +5 -7
  92. package/dist/components/form.js.map +1 -1
  93. package/dist/components/form.mjs +3 -7
  94. package/dist/components/form.mjs.map +1 -1
  95. package/dist/components/grid.d.mts +1 -1
  96. package/dist/components/grid.d.ts +1 -1
  97. package/dist/components/heading.d.mts +1 -1
  98. package/dist/components/heading.d.ts +1 -1
  99. package/dist/components/heading.mjs +4 -37
  100. package/dist/components/heading.mjs.map +1 -1
  101. package/dist/components/icon-button.d.mts +1 -1
  102. package/dist/components/icon-button.d.ts +1 -1
  103. package/dist/components/icon-button.mjs +6 -33
  104. package/dist/components/icon-button.mjs.map +1 -1
  105. package/dist/components/label.css +7 -7
  106. package/dist/components/label.css.map +1 -1
  107. package/dist/components/label.js +4 -16
  108. package/dist/components/label.js.map +1 -1
  109. package/dist/components/label.mjs +2 -7
  110. package/dist/components/label.mjs.map +1 -1
  111. package/dist/components/link.d.mts +1 -1
  112. package/dist/components/link.d.ts +1 -1
  113. package/dist/components/menu.css +13 -13
  114. package/dist/components/menu.css.map +1 -1
  115. package/dist/components/menu.d.mts +7 -10
  116. package/dist/components/menu.d.ts +7 -10
  117. package/dist/components/menu.js +20 -39
  118. package/dist/components/menu.js.map +1 -1
  119. package/dist/components/menu.mjs +11 -27
  120. package/dist/components/menu.mjs.map +1 -1
  121. package/dist/components/panel.css +2 -2
  122. package/dist/components/panel.css.map +1 -1
  123. package/dist/components/panel.d.mts +2 -4
  124. package/dist/components/panel.d.ts +2 -4
  125. package/dist/components/panel.js +2 -14
  126. package/dist/components/panel.js.map +1 -1
  127. package/dist/components/panel.mjs +3 -8
  128. package/dist/components/panel.mjs.map +1 -1
  129. package/dist/components/paragraph.d.mts +1 -1
  130. package/dist/components/paragraph.d.ts +1 -1
  131. package/dist/components/select.css +11 -11
  132. package/dist/components/select.css.map +1 -1
  133. package/dist/components/select.d.mts +4 -6
  134. package/dist/components/select.d.ts +4 -6
  135. package/dist/components/select.js +7 -17
  136. package/dist/components/select.js.map +1 -1
  137. package/dist/components/select.mjs +8 -16
  138. package/dist/components/select.mjs.map +1 -1
  139. package/dist/components/separator.css +4 -4
  140. package/dist/components/separator.css.map +1 -1
  141. package/dist/components/separator.d.mts +1 -3
  142. package/dist/components/separator.d.ts +1 -3
  143. package/dist/components/separator.js +2 -14
  144. package/dist/components/separator.js.map +1 -1
  145. package/dist/components/separator.mjs +2 -7
  146. package/dist/components/separator.mjs.map +1 -1
  147. package/dist/components/skeleton.d.mts +1 -1
  148. package/dist/components/skeleton.d.ts +1 -1
  149. package/dist/components/spinner.d.mts +1 -1
  150. package/dist/components/spinner.d.ts +1 -1
  151. package/dist/components/status.d.mts +1 -1
  152. package/dist/components/status.d.ts +1 -1
  153. package/dist/components/text-field.d.mts +1 -1
  154. package/dist/components/text-field.d.ts +1 -1
  155. package/dist/components/text.d.mts +1 -1
  156. package/dist/components/text.d.ts +1 -1
  157. package/dist/components/text.mjs +5 -19
  158. package/dist/components/text.mjs.map +1 -1
  159. package/dist/components/tooltip.css +2 -2
  160. package/dist/components/tooltip.css.map +1 -1
  161. package/dist/components/tooltip.js +15 -18
  162. package/dist/components/tooltip.js.map +1 -1
  163. package/dist/components/tooltip.mjs +2 -2
  164. package/dist/form.css-QulER1wj.d.mts +13 -0
  165. package/dist/form.css-QulER1wj.d.ts +13 -0
  166. package/dist/providers/index.css +564 -0
  167. package/dist/providers/index.css.map +1 -1
  168. package/dist/providers/index.d.mts +21 -1
  169. package/dist/providers/index.d.ts +21 -1
  170. package/dist/providers/index.js +371 -2
  171. package/dist/providers/index.js.map +1 -1
  172. package/dist/providers/index.mjs +248 -3
  173. package/dist/providers/index.mjs.map +1 -1
  174. package/dist/theme/index.css +367 -113
  175. package/dist/theme/index.css.map +1 -1
  176. package/dist/theme/index.d.mts +30 -13
  177. package/dist/theme/index.d.ts +30 -13
  178. package/dist/theme/index.js +99 -83
  179. package/dist/theme/index.js.map +1 -1
  180. package/dist/theme/index.mjs +46 -36
  181. package/dist/theme/index.mjs.map +1 -1
  182. package/package.json +2 -3
  183. package/dist/box.css-ic5Toaj1.d.mts +0 -7
  184. package/dist/box.css-ic5Toaj1.d.ts +0 -7
  185. package/dist/chunk-3RLW7QB4.mjs +0 -14
  186. package/dist/chunk-3RLW7QB4.mjs.map +0 -1
  187. package/dist/chunk-5WQXUS72.mjs +0 -11
  188. package/dist/chunk-5WQXUS72.mjs.map +0 -1
  189. package/dist/chunk-7MD4JYZV.mjs.map +0 -1
  190. package/dist/chunk-JWHPBA5J.mjs +0 -1
  191. package/dist/chunk-KQPNQST6.mjs +0 -8
  192. package/dist/chunk-KQPNQST6.mjs.map +0 -1
  193. package/dist/chunk-LWL4262W.mjs +0 -8
  194. package/dist/chunk-LWL4262W.mjs.map +0 -1
  195. package/dist/chunk-PHULHA6N.mjs +0 -12
  196. package/dist/chunk-PHULHA6N.mjs.map +0 -1
  197. package/dist/chunk-SRMXCTGE.mjs +0 -8
  198. package/dist/chunk-SRMXCTGE.mjs.map +0 -1
  199. package/dist/chunk-X2Q6GLO5.mjs +0 -8
  200. package/dist/chunk-X2Q6GLO5.mjs.map +0 -1
  201. package/dist/chunk-XALDYHCC.mjs.map +0 -1
  202. package/dist/chunk-YQH4Y34B.mjs.map +0 -1
  203. package/dist/chunk-ZJDUO7Y6.mjs +0 -8
  204. package/dist/chunk-ZJDUO7Y6.mjs.map +0 -1
  205. package/dist/component-props-CuOrXFyX.d.mts +0 -5
  206. package/dist/component-props-CuOrXFyX.d.ts +0 -5
  207. package/dist/form.css-DJxDoc1T.d.mts +0 -17
  208. package/dist/form.css-DJxDoc1T.d.ts +0 -17
  209. package/dist/menu.css-5kJKHBR_.d.mts +0 -13
  210. package/dist/menu.css-5kJKHBR_.d.ts +0 -13
  211. package/dist/panel.css-DUVSZSQ6.d.mts +0 -7
  212. package/dist/panel.css-DUVSZSQ6.d.ts +0 -7
  213. package/dist/separator.css-Hl8ZhcXR.d.mts +0 -7
  214. package/dist/separator.css-Hl8ZhcXR.d.ts +0 -7
  215. /package/dist/{chunk-JWHPBA5J.mjs.map → chunk-R6MZB2ED.mjs.map} +0 -0
@@ -1,5 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
2
3
  import react__default from 'react';
4
+ import * as ToastPrimitives from '@radix-ui/react-toast';
3
5
 
4
6
  type ThemeMode = "light" | "dark";
5
7
 
@@ -13,4 +15,22 @@ type ThemeProviderProps = {
13
15
  */
14
16
  declare const ThemeProvider: ({ children, themeMode, }: ThemeProviderProps) => react_jsx_runtime.JSX.Element;
15
17
 
16
- export { ThemeContext, ThemeProvider };
18
+ type AddToastPayload = Omit<Toast, "status">;
19
+ type ToasterContextProps = ((payload: AddToastPayload) => void) & {
20
+ error: (payload: AddToastPayload) => void;
21
+ success: (payload: AddToastPayload) => void;
22
+ };
23
+ declare const ToasterContext: react.Context<ToasterContextProps>;
24
+ declare const Toaster: ({ children, ...props }: ToastPrimitives.ToastProviderProps) => react_jsx_runtime.JSX.Element;
25
+ type Toast = {
26
+ title?: string;
27
+ description?: string;
28
+ status: "default" | "error" | "success";
29
+ action?: react.ReactNode;
30
+ } & ToastPrimitives.ToastProps;
31
+ declare const Toast: (props: ToastPrimitives.ToastProps & {
32
+ toast: Toast;
33
+ }) => react_jsx_runtime.JSX.Element;
34
+ declare const ToastAction: ({ ...props }: Omit<ToastPrimitives.ToastActionProps, "asChild">) => react_jsx_runtime.JSX.Element;
35
+
36
+ export { ThemeContext, ThemeProvider, ToastAction, Toaster, ToasterContext };
@@ -1,5 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
2
3
  import react__default from 'react';
4
+ import * as ToastPrimitives from '@radix-ui/react-toast';
3
5
 
4
6
  type ThemeMode = "light" | "dark";
5
7
 
@@ -13,4 +15,22 @@ type ThemeProviderProps = {
13
15
  */
14
16
  declare const ThemeProvider: ({ children, themeMode, }: ThemeProviderProps) => react_jsx_runtime.JSX.Element;
15
17
 
16
- export { ThemeContext, ThemeProvider };
18
+ type AddToastPayload = Omit<Toast, "status">;
19
+ type ToasterContextProps = ((payload: AddToastPayload) => void) & {
20
+ error: (payload: AddToastPayload) => void;
21
+ success: (payload: AddToastPayload) => void;
22
+ };
23
+ declare const ToasterContext: react.Context<ToasterContextProps>;
24
+ declare const Toaster: ({ children, ...props }: ToastPrimitives.ToastProviderProps) => react_jsx_runtime.JSX.Element;
25
+ type Toast = {
26
+ title?: string;
27
+ description?: string;
28
+ status: "default" | "error" | "success";
29
+ action?: react.ReactNode;
30
+ } & ToastPrimitives.ToastProps;
31
+ declare const Toast: (props: ToastPrimitives.ToastProps & {
32
+ toast: Toast;
33
+ }) => react_jsx_runtime.JSX.Element;
34
+ declare const ToastAction: ({ ...props }: Omit<ToastPrimitives.ToastActionProps, "asChild">) => react_jsx_runtime.JSX.Element;
35
+
36
+ export { ThemeContext, ThemeProvider, ToastAction, Toaster, ToasterContext };
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,13 +17,24 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/providers/index.ts
21
31
  var providers_exports = {};
22
32
  __export(providers_exports, {
23
33
  ThemeContext: () => ThemeContext,
24
- ThemeProvider: () => ThemeProvider
34
+ ThemeProvider: () => ThemeProvider,
35
+ ToastAction: () => ToastAction,
36
+ Toaster: () => Toaster,
37
+ ToasterContext: () => ToasterContext
25
38
  });
26
39
  module.exports = __toCommonJS(providers_exports);
27
40
 
@@ -56,9 +69,365 @@ var ThemeProvider = ({
56
69
  }
57
70
  ) });
58
71
  };
72
+
73
+ // src/theme/recipes/spinner.css.ts
74
+ var import_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
75
+ var spinnerRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "spinner_spinnerRecipe__15xzcy90", variantClassNames: { size: { "1": "spinner_spinnerRecipe_size_1__15xzcy91", "2": "spinner_spinnerRecipe_size_2__15xzcy92", "3": "spinner_spinnerRecipe_size_3__15xzcy93", "4": "spinner_spinnerRecipe_size_4__15xzcy94", "5": "spinner_spinnerRecipe_size_5__15xzcy95", "6": "spinner_spinnerRecipe_size_6__15xzcy96", "7": "spinner_spinnerRecipe_size_7__15xzcy97", "8": "spinner_spinnerRecipe_size_8__15xzcy98", "9": "spinner_spinnerRecipe_size_9__15xzcy99" } }, defaultVariants: { size: "3" }, compoundVariants: [] });
76
+
77
+ // src/utils/merge-classes.ts
78
+ function mergeClasses(...classes) {
79
+ return classes.filter((cls) => Boolean(cls)).join(" ");
80
+ }
81
+
82
+ // src/utils/pick.ts
83
+ function pick(obj, ...keys) {
84
+ const ret = {};
85
+ keys.forEach((key) => {
86
+ ret[key] = obj[key];
87
+ });
88
+ return ret;
89
+ }
90
+
91
+ // src/components/spinner.tsx
92
+ var import_react_slot = require("@radix-ui/react-slot");
93
+ var import_jsx_runtime2 = require("react/jsx-runtime");
94
+ var defaultElement = "div";
95
+ var Spinner = ({ asChild, ...props }) => {
96
+ const variants = pick(props, ...spinnerRecipe.variants());
97
+ const spinner = spinnerRecipe(variants);
98
+ const Comp = asChild ? import_react_slot.Slot : defaultElement;
99
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Comp, { ...props, className: mergeClasses(spinner, props.className), children: props.children });
100
+ };
101
+
102
+ // src/theme/recipes/button.css.ts
103
+ var import_createRuntimeFn2 = require("@vanilla-extract/recipes/createRuntimeFn");
104
+ var buttonRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "button_buttonRecipe__hi3ya00", variantClassNames: { fullWidth: { true: "button_buttonRecipe_fullWidth_true__hi3ya01" }, loading: { true: "button_buttonRecipe_loading_true__hi3ya02" }, size: { "1": "button_buttonRecipe_size_1__hi3ya03", "2": "button_buttonRecipe_size_2__hi3ya04", "3": "button_buttonRecipe_size_3__hi3ya05" }, shape: { square: "button_buttonRecipe_shape_square__hi3ya06", pill: "button_buttonRecipe_shape_pill__hi3ya07" }, variant: { primary: "button_buttonRecipe_variant_primary__hi3ya08", secondary: "button_buttonRecipe_variant_secondary__hi3ya09", outline: "button_buttonRecipe_variant_outline__hi3ya0a", ghost: "button_buttonRecipe_variant_ghost__hi3ya0b", error: "button_buttonRecipe_variant_error__hi3ya0c", success: "button_buttonRecipe_variant_success__hi3ya0d" } }, defaultVariants: { size: "2", variant: "primary" }, compoundVariants: [] });
105
+
106
+ // src/components/button.tsx
107
+ var import_react_slot2 = require("@radix-ui/react-slot");
108
+ var import_jsx_runtime3 = require("react/jsx-runtime");
109
+ var defaultElement2 = "button";
110
+ var Button = ({ asChild, ...props }) => {
111
+ const variants = pick(props, ...buttonRecipe.variants());
112
+ const button = buttonRecipe(variants);
113
+ const Comp = asChild ? import_react_slot2.Slot : defaultElement2;
114
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
115
+ Comp,
116
+ {
117
+ ...props,
118
+ className: mergeClasses(button, props.className),
119
+ disabled: props.disabled || Boolean(variants.loading),
120
+ children: [
121
+ props.children,
122
+ variants.loading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Spinner, { style: { position: "absolute" } })
123
+ ]
124
+ }
125
+ );
126
+ };
127
+
128
+ // src/theme/recipes/text.css.ts
129
+ var import_createRuntimeFn3 = require("@vanilla-extract/recipes/createRuntimeFn");
130
+ var textRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "text_textRecipe__1y7s4vx0", variantClassNames: { color: { primary: "text_textRecipe_color_primary__1y7s4vx1", secondary: "text_textRecipe_color_secondary__1y7s4vx2", error: "text_textRecipe_color_error__1y7s4vx3", subtle: "text_textRecipe_color_subtle__1y7s4vx4" }, size: { "1": "text_textRecipe_size_1__1y7s4vx5", "2": "text_textRecipe_size_2__1y7s4vx6", "3": "text_textRecipe_size_3__1y7s4vx7", "4": "text_textRecipe_size_4__1y7s4vx8", "5": "text_textRecipe_size_5__1y7s4vx9", "6": "text_textRecipe_size_6__1y7s4vxa", "7": "text_textRecipe_size_7__1y7s4vxb", "8": "text_textRecipe_size_8__1y7s4vxc", "9": "text_textRecipe_size_9__1y7s4vxd" }, weight: { regular: "text_textRecipe_weight_regular__1y7s4vxe", medium: "text_textRecipe_weight_medium__1y7s4vxf", bold: "text_textRecipe_weight_bold__1y7s4vxg" } }, defaultVariants: { size: "3" }, compoundVariants: [] });
131
+
132
+ // src/components/heading.tsx
133
+ var import_react_slot3 = require("@radix-ui/react-slot");
134
+ var import_jsx_runtime4 = require("react/jsx-runtime");
135
+ var textAs = {
136
+ 1: "h1",
137
+ 2: "h2",
138
+ 3: "h3",
139
+ 4: "h4",
140
+ 5: "h5",
141
+ 6: "h6"
142
+ };
143
+ var textSize = {
144
+ 1: "8",
145
+ 2: "7",
146
+ 3: "6",
147
+ 4: "5",
148
+ 5: "4",
149
+ 6: "3"
150
+ };
151
+ var Heading = ({
152
+ asChild,
153
+ color,
154
+ level = "1",
155
+ weight = "medium",
156
+ // overrides defaultVariant
157
+ ...props
158
+ }) => {
159
+ const text = textRecipe({ color, size: textSize[level], weight });
160
+ const Comp = asChild ? import_react_slot3.Slot : textAs[level];
161
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Comp, { ...props, className: mergeClasses(text, props.className), children: props.children });
162
+ };
163
+
164
+ // src/theme/recipes/icon-button.css.ts
165
+ var import_createRuntimeFn4 = require("@vanilla-extract/recipes/createRuntimeFn");
166
+ var iconButtonRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "icon-button_iconButtonRecipe__v93z8s0", variantClassNames: { loading: { true: "icon-button_iconButtonRecipe_loading_true__v93z8s1" }, size: { "1": "icon-button_iconButtonRecipe_size_1__v93z8s2", "2": "icon-button_iconButtonRecipe_size_2__v93z8s3", "3": "icon-button_iconButtonRecipe_size_3__v93z8s4", "4": "icon-button_iconButtonRecipe_size_4__v93z8s5" }, variant: { ghost: "icon-button_iconButtonRecipe_variant_ghost__v93z8s6", outline: "icon-button_iconButtonRecipe_variant_outline__v93z8s7" } }, defaultVariants: { size: "1", variant: "ghost" }, compoundVariants: [] });
167
+
168
+ // src/components/icon-button.tsx
169
+ var import_react_slot4 = require("@radix-ui/react-slot");
170
+ var import_jsx_runtime5 = require("react/jsx-runtime");
171
+ var defaultElement3 = "button";
172
+ var IconButton = ({ asChild, ...props }) => {
173
+ const variants = pick(props, ...iconButtonRecipe.variants());
174
+ const iconButton = iconButtonRecipe(variants);
175
+ const Comp = asChild ? import_react_slot4.Slot : defaultElement3;
176
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
177
+ Comp,
178
+ {
179
+ ...props,
180
+ className: mergeClasses(iconButton, props.className),
181
+ disabled: props.disabled || Boolean(variants.loading),
182
+ children: [
183
+ props.children,
184
+ variants.loading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, { style: { position: "absolute" } })
185
+ ]
186
+ }
187
+ );
188
+ };
189
+
190
+ // src/components/text.tsx
191
+ var import_react_slot5 = require("@radix-ui/react-slot");
192
+ var import_jsx_runtime6 = require("react/jsx-runtime");
193
+ var defaultElement4 = "span";
194
+ var Text = ({ asChild, ...props }) => {
195
+ const variants = pick(props, ...textRecipe.variants());
196
+ const text = textRecipe(variants);
197
+ const Comp = asChild ? import_react_slot5.Slot : defaultElement4;
198
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Comp, { ...props, className: mergeClasses(text, props.className), children: props.children });
199
+ };
200
+
201
+ // src/theme/styles/toaster.css.ts
202
+ var checkmark = "toaster_checkmark__3jyebmb";
203
+ var error = "toaster_error__3jyebmc";
204
+ var toastClose = "toaster_toastClose__3jyebm6";
205
+ var toastInner = "toaster_toastInner__3jyebm5";
206
+ var toastRoot = "toaster_toastRoot__3jyebm4";
207
+ var toastViewport = "toaster_toastViewport__3jyebm3";
208
+
209
+ // src/providers/toaster.tsx
210
+ var import_react_icons = require("@radix-ui/react-icons");
211
+ var ToastPrimitives = __toESM(require("@radix-ui/react-toast"));
212
+ var React2 = __toESM(require("react"));
213
+ var import_jsx_runtime7 = require("react/jsx-runtime");
214
+ var defaultToaster = Object.assign(() => {
215
+ }, {
216
+ success: () => {
217
+ },
218
+ error: () => {
219
+ }
220
+ });
221
+ var ToasterContext = React2.createContext(defaultToaster);
222
+ var toastElementsMapRef = React2.createRef();
223
+ var defaultToastImpl = {
224
+ toastElementsMapRef,
225
+ sortToasts: () => {
226
+ }
227
+ };
228
+ var ToastContextImpl = React2.createContext(defaultToastImpl);
229
+ var ANIMATION_OUT_DURATION = 350;
230
+ var Toaster = ({
231
+ children,
232
+ ...props
233
+ }) => {
234
+ const [toasts, setToasts] = React2.useState(/* @__PURE__ */ new Map());
235
+ const toastElementsMapRef2 = React2.useRef(
236
+ /* @__PURE__ */ new Map()
237
+ );
238
+ const viewportRef = React2.useRef(null);
239
+ const sortToasts = React2.useCallback(() => {
240
+ const toastElements = Array.from(toastElementsMapRef2.current).reverse();
241
+ const heights = [];
242
+ toastElements.forEach(([, toast], index) => {
243
+ if (!toast) return;
244
+ const height = toast.clientHeight;
245
+ heights.push(height);
246
+ const frontToastHeight = heights[0];
247
+ toast.setAttribute("data-front", `${index === 0}`);
248
+ toast.setAttribute("data-hidden", `${index > 2}`);
249
+ toast.style.setProperty("--index", `${index}`);
250
+ toast.style.setProperty("--height", `${height}px`);
251
+ toast.style.setProperty("--front-height", `${frontToastHeight}px`);
252
+ const hoverOffsetY = heights.slice(0, index).reduce((res, next) => res += next, 0);
253
+ toast.style.setProperty("--hover-offset-y", `-${hoverOffsetY}px`);
254
+ });
255
+ }, []);
256
+ const handleAddToast = React2.useCallback((toast) => {
257
+ setToasts((currentToasts) => {
258
+ const newMap = new Map(currentToasts);
259
+ newMap.set(String(Date.now()), { ...toast, open: true });
260
+ return newMap;
261
+ });
262
+ }, []);
263
+ const handleRemoveToast = React2.useCallback((key) => {
264
+ setToasts((currentToasts) => {
265
+ const newMap = new Map(currentToasts);
266
+ newMap.delete(key);
267
+ return newMap;
268
+ });
269
+ }, []);
270
+ const handleDispatchDefault = React2.useCallback(
271
+ (payload) => handleAddToast({ ...payload, status: "default" }),
272
+ [handleAddToast]
273
+ );
274
+ const handleDispatchSuccess = React2.useCallback(
275
+ (payload) => handleAddToast({ ...payload, status: "success" }),
276
+ [handleAddToast]
277
+ );
278
+ const handleDispatchError = React2.useCallback(
279
+ (payload) => handleAddToast({ ...payload, status: "error" }),
280
+ [handleAddToast]
281
+ );
282
+ React2.useEffect(() => {
283
+ const viewport = viewportRef.current;
284
+ if (viewport) {
285
+ const handleFocus = () => {
286
+ toastElementsMapRef2.current.forEach((toast) => {
287
+ toast.setAttribute("data-hovering", "true");
288
+ });
289
+ };
290
+ const handleBlur = (event) => {
291
+ if (!viewport.contains(event.target) || viewport === event.target) {
292
+ toastElementsMapRef2.current.forEach((toast) => {
293
+ toast.setAttribute("data-hovering", "false");
294
+ });
295
+ }
296
+ };
297
+ viewport.addEventListener("pointermove", handleFocus);
298
+ viewport.addEventListener("pointerleave", handleBlur);
299
+ viewport.addEventListener("focusin", handleFocus);
300
+ viewport.addEventListener("focusout", handleBlur);
301
+ return () => {
302
+ viewport.removeEventListener("pointermove", handleFocus);
303
+ viewport.removeEventListener("pointerleave", handleBlur);
304
+ viewport.removeEventListener("focusin", handleFocus);
305
+ viewport.removeEventListener("focusout", handleBlur);
306
+ };
307
+ }
308
+ }, []);
309
+ const toastApi = React2.useMemo(
310
+ () => Object.assign(handleDispatchDefault, {
311
+ success: handleDispatchSuccess,
312
+ error: handleDispatchError
313
+ }),
314
+ [handleDispatchDefault, handleDispatchSuccess, handleDispatchError]
315
+ );
316
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToasterContext.Provider, { value: toastApi, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
317
+ ToastContextImpl.Provider,
318
+ {
319
+ value: React2.useMemo(
320
+ () => ({
321
+ toastElementsMapRef: toastElementsMapRef2,
322
+ sortToasts
323
+ }),
324
+ [sortToasts]
325
+ ),
326
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(ToastPrimitives.Provider, { ...props, children: [
327
+ children,
328
+ Array.from(toasts).map(([key, toast]) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
329
+ Toast,
330
+ {
331
+ id: key,
332
+ toast,
333
+ onOpenChange: (open) => {
334
+ if (!open) {
335
+ toastElementsMapRef2.current.delete(key);
336
+ sortToasts();
337
+ if (!open) {
338
+ setTimeout(() => {
339
+ handleRemoveToast(key);
340
+ }, ANIMATION_OUT_DURATION);
341
+ }
342
+ }
343
+ }
344
+ },
345
+ key
346
+ )),
347
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
348
+ ToastPrimitives.Viewport,
349
+ {
350
+ ref: viewportRef,
351
+ className: toastViewport
352
+ }
353
+ )
354
+ ] })
355
+ }
356
+ ) });
357
+ };
358
+ var Toast = (props) => {
359
+ const { onOpenChange, toast, id, ...toastProps } = props;
360
+ const ref = React2.useRef(null);
361
+ const context = React2.useContext(ToastContextImpl);
362
+ const { sortToasts, toastElementsMapRef: toastElementsMapRef2 } = context;
363
+ const toastElementsMap = toastElementsMapRef2.current;
364
+ React2.useLayoutEffect(() => {
365
+ if (ref.current) {
366
+ toastElementsMap == null ? void 0 : toastElementsMap.set(id, ref.current);
367
+ sortToasts();
368
+ }
369
+ }, [id, sortToasts, toastElementsMap]);
370
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
371
+ ToastPrimitives.Root,
372
+ {
373
+ ...toastProps,
374
+ ref,
375
+ type: toast.type,
376
+ duration: toast.duration,
377
+ className: toastRoot,
378
+ onOpenChange,
379
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: toastInner, "data-status": toast.status, children: [
380
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToastStatusIcon, { status: toast.status }),
381
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToastPrimitives.Title, { asChild: true, style: { gridArea: "title" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Heading, { level: "6", children: toast.title }) }),
382
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
383
+ ToastPrimitives.Description,
384
+ {
385
+ asChild: true,
386
+ style: { gridArea: "description" },
387
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "subtle", size: "2", children: toast.description })
388
+ }
389
+ ),
390
+ toast.action,
391
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
392
+ ToastPrimitives.Close,
393
+ {
394
+ "aria-label": "Close",
395
+ asChild: true,
396
+ className: toastClose,
397
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconButton, { variant: "outline", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_icons.Cross2Icon, {}) })
398
+ }
399
+ )
400
+ ] })
401
+ }
402
+ );
403
+ };
404
+ var ToastStatusIcon = ({ status }) => {
405
+ return status !== "default" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: { gridArea: "icon", alignSelf: "start" }, children: [
406
+ status === "success" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CheckmarkIcon, {}),
407
+ status === "error" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ErrorIcon, {})
408
+ ] }) : null;
409
+ };
410
+ var ErrorIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { "aria-hidden": true, className: error });
411
+ var CheckmarkIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { "aria-hidden": true, className: checkmark });
412
+ var ToastAction = ({
413
+ ...props
414
+ }) => {
415
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
416
+ ToastPrimitives.Action,
417
+ {
418
+ ...props,
419
+ style: { gridArea: "action", ...props.style },
420
+ asChild: true,
421
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "1", variant: "outline", children: props.children })
422
+ }
423
+ );
424
+ };
59
425
  // Annotate the CommonJS export names for ESM import in node:
60
426
  0 && (module.exports = {
61
427
  ThemeContext,
62
- ThemeProvider
428
+ ThemeProvider,
429
+ ToastAction,
430
+ Toaster,
431
+ ToasterContext
63
432
  });
64
433
  //# sourceMappingURL=index.js.map