@luxfi/ui 5.5.3 → 5.6.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 (244) hide show
  1. package/dist/accordion.cjs +213 -0
  2. package/dist/accordion.js +186 -0
  3. package/dist/alert.cjs +553 -0
  4. package/dist/alert.js +531 -0
  5. package/dist/avatar.cjs +149 -0
  6. package/dist/avatar.js +125 -0
  7. package/dist/badge.cjs +611 -0
  8. package/dist/badge.js +589 -0
  9. package/dist/button.cjs +689 -0
  10. package/dist/button.js +664 -0
  11. package/dist/checkbox.cjs +265 -0
  12. package/dist/checkbox.js +241 -0
  13. package/dist/close-button.cjs +73 -0
  14. package/dist/close-button.js +51 -0
  15. package/dist/collapsible.cjs +702 -0
  16. package/dist/collapsible.js +679 -0
  17. package/dist/color-mode.cjs +96 -0
  18. package/dist/color-mode.js +72 -0
  19. package/dist/dialog.cjs +279 -0
  20. package/dist/dialog.js +246 -0
  21. package/dist/drawer.cjs +207 -0
  22. package/dist/drawer.js +175 -0
  23. package/dist/empty-state.cjs +93 -0
  24. package/dist/empty-state.js +71 -0
  25. package/dist/field.cjs +183 -0
  26. package/dist/field.js +160 -0
  27. package/dist/heading.cjs +46 -0
  28. package/dist/heading.js +40 -0
  29. package/dist/icon-button.cjs +491 -0
  30. package/dist/icon-button.js +470 -0
  31. package/dist/image.cjs +572 -0
  32. package/dist/image.js +551 -0
  33. package/dist/index.cjs +5779 -0
  34. package/dist/index.js +5619 -0
  35. package/dist/input-group.cjs +155 -0
  36. package/dist/input-group.js +133 -0
  37. package/dist/input.cjs +65 -0
  38. package/dist/input.js +59 -0
  39. package/dist/link.cjs +630 -0
  40. package/dist/link.js +606 -0
  41. package/dist/menu.cjs +305 -0
  42. package/dist/menu.js +269 -0
  43. package/dist/pin-input.cjs +182 -0
  44. package/dist/pin-input.js +160 -0
  45. package/dist/popover.cjs +327 -0
  46. package/dist/popover.js +294 -0
  47. package/dist/progress-circle.cjs +152 -0
  48. package/dist/progress-circle.js +128 -0
  49. package/dist/progress.cjs +117 -0
  50. package/dist/progress.js +94 -0
  51. package/dist/provider.cjs +62 -0
  52. package/dist/provider.js +40 -0
  53. package/dist/radio.cjs +177 -0
  54. package/dist/radio.js +153 -0
  55. package/dist/rating.cjs +80 -0
  56. package/dist/rating.js +58 -0
  57. package/dist/select.cjs +791 -0
  58. package/dist/select.js +757 -0
  59. package/dist/separator.cjs +57 -0
  60. package/dist/separator.js +51 -0
  61. package/dist/skeleton.cjs +370 -0
  62. package/dist/skeleton.js +346 -0
  63. package/dist/slider.cjs +138 -0
  64. package/dist/slider.js +115 -0
  65. package/dist/switch.cjs +163 -0
  66. package/dist/switch.js +140 -0
  67. package/dist/table.cjs +1044 -0
  68. package/dist/table.js +1013 -0
  69. package/dist/tabs.cjs +240 -0
  70. package/dist/tabs.js +213 -0
  71. package/dist/tag.cjs +651 -0
  72. package/dist/tag.js +628 -0
  73. package/dist/textarea.cjs +65 -0
  74. package/dist/textarea.js +59 -0
  75. package/dist/toaster.cjs +99 -0
  76. package/dist/toaster.js +96 -0
  77. package/dist/tooltip.cjs +171 -0
  78. package/dist/tooltip.js +148 -0
  79. package/dist/utils.cjs +11 -0
  80. package/dist/utils.js +9 -0
  81. package/package.json +270 -65
  82. package/src/accordion.tsx +285 -0
  83. package/src/alert.tsx +221 -0
  84. package/src/avatar.tsx +174 -0
  85. package/src/badge.tsx +158 -0
  86. package/src/button.tsx +411 -0
  87. package/src/checkbox.tsx +307 -0
  88. package/src/close-button.tsx +51 -0
  89. package/src/collapsible.tsx +126 -0
  90. package/src/color-mode.tsx +125 -0
  91. package/src/dialog.tsx +356 -0
  92. package/src/drawer.tsx +186 -0
  93. package/src/empty-state.tsx +97 -0
  94. package/src/field.tsx +202 -0
  95. package/src/heading.tsx +55 -0
  96. package/src/icon-button.tsx +192 -0
  97. package/src/image.tsx +280 -0
  98. package/src/index.ts +192 -0
  99. package/src/input-group.tsx +159 -0
  100. package/src/input.tsx +60 -0
  101. package/src/link.tsx +326 -0
  102. package/src/menu.tsx +471 -0
  103. package/src/pin-input.tsx +187 -0
  104. package/src/popover.tsx +400 -0
  105. package/src/progress-circle.tsx +180 -0
  106. package/src/progress.tsx +109 -0
  107. package/src/provider.tsx +12 -0
  108. package/src/radio.tsx +175 -0
  109. package/src/rating.tsx +79 -0
  110. package/src/select.tsx +696 -0
  111. package/src/separator.tsx +59 -0
  112. package/src/skeleton.tsx +302 -0
  113. package/src/slider.tsx +152 -0
  114. package/src/switch.tsx +158 -0
  115. package/src/table.tsx +621 -0
  116. package/src/tabs.tsx +354 -0
  117. package/src/tag.tsx +159 -0
  118. package/src/textarea.tsx +60 -0
  119. package/src/toaster.tsx +117 -0
  120. package/src/tokens.css +438 -0
  121. package/src/tooltip.tsx +184 -0
  122. package/src/utils/cn.ts +7 -0
  123. package/src/utils.ts +6 -0
  124. package/tokens.css +438 -0
  125. package/commerce/ui/conf.ts +0 -13
  126. package/commerce/ui/context.tsx +0 -123
  127. package/commerce/ui/store.ts +0 -295
  128. package/components/access-code-input.tsx +0 -71
  129. package/components/analytics.tsx +0 -23
  130. package/components/auth/auth-listener.tsx +0 -29
  131. package/components/auth/auth-token/clear-auth-token.tsx +0 -12
  132. package/components/auth/auth-token/set-auth-token.tsx +0 -16
  133. package/components/auth/common-auth-domains.ts +0 -17
  134. package/components/auth/login-panel.tsx +0 -111
  135. package/components/auth/mobile-login-button.tsx +0 -107
  136. package/components/auth/signup-panel.tsx +0 -113
  137. package/components/back-button.tsx +0 -49
  138. package/components/chat-widget.tsx +0 -85
  139. package/components/commerce/bag-button.tsx +0 -98
  140. package/components/commerce/buy-button.tsx +0 -34
  141. package/components/commerce/checkout-button.tsx +0 -129
  142. package/components/commerce/checkout-panel/cart-accordian.tsx +0 -66
  143. package/components/commerce/checkout-panel/checkout-panel-props.ts +0 -10
  144. package/components/commerce/checkout-panel/desktop-bag-carousel.tsx +0 -36
  145. package/components/commerce/checkout-panel/desktop-cp.tsx +0 -83
  146. package/components/commerce/checkout-panel/index.tsx +0 -126
  147. package/components/commerce/checkout-panel/mobile-cp.tsx +0 -67
  148. package/components/commerce/checkout-panel/policy-links.tsx +0 -29
  149. package/components/commerce/checkout-panel/steps-indicator.tsx +0 -39
  150. package/components/commerce/checkout-panel/thank-you.tsx +0 -18
  151. package/components/commerce/desktop-bag-popup.tsx +0 -78
  152. package/components/commerce/drawer/index.tsx +0 -88
  153. package/components/commerce/drawer/micro.tsx +0 -145
  154. package/components/commerce/drawer/shell.tsx +0 -85
  155. package/components/contact-dialog/contact-form.tsx +0 -116
  156. package/components/contact-dialog/disclaimer.tsx +0 -13
  157. package/components/contact-dialog/index.tsx +0 -64
  158. package/components/copyright.tsx +0 -21
  159. package/components/drawer-margin.tsx +0 -28
  160. package/components/footer.tsx +0 -78
  161. package/components/header/desktop-nav-menu.tsx +0 -204
  162. package/components/header/desktop.tsx +0 -65
  163. package/components/header/index.tsx +0 -50
  164. package/components/header/mobile-bag-drawer.tsx +0 -51
  165. package/components/header/mobile-menu-toggle-button.tsx +0 -35
  166. package/components/header/mobile-nav-menu-ai.tsx +0 -51
  167. package/components/header/mobile-nav-menu-item.tsx +0 -47
  168. package/components/header/mobile-nav-menu.tsx +0 -102
  169. package/components/header/mobile.tsx +0 -170
  170. package/components/header/theme-toggle.tsx +0 -26
  171. package/components/icons/avatar.tsx +0 -11
  172. package/components/icons/bag-icon.tsx +0 -10
  173. package/components/icons/index.ts +0 -6
  174. package/components/icons/left-arrow.tsx +0 -11
  175. package/components/icons/lux-logo.tsx +0 -10
  176. package/components/icons/right-arrow.tsx +0 -10
  177. package/components/icons/social-icon.tsx +0 -35
  178. package/components/icons/social-svg.css +0 -3
  179. package/components/index.ts +0 -26
  180. package/components/logo.tsx +0 -92
  181. package/components/main.tsx +0 -27
  182. package/components/mini-chart/index.tsx +0 -8
  183. package/components/mini-chart/mini-chart-props.ts +0 -44
  184. package/components/mini-chart/mini-chart.tsx +0 -85
  185. package/components/mini-chart/wrapper.tsx +0 -23
  186. package/components/not-found/index.tsx +0 -28
  187. package/components/not-found/not-found-content.mdx +0 -5
  188. package/components/tooltip.tsx +0 -31
  189. package/environment.d.ts +0 -6
  190. package/next/analytics/fpixel.ts +0 -16
  191. package/next/analytics/google-analytics.ts +0 -14
  192. package/next/analytics/index.ts +0 -3
  193. package/next/analytics/pixel-analytics.tsx +0 -55
  194. package/next/font/get-app-router-font-classes.ts +0 -17
  195. package/next/font/load-and-return-lux-next-fonts-on-import.ts +0 -68
  196. package/next/font/local/Druk-Wide-Bold.ttf +0 -0
  197. package/next/font/local/Druk-Wide-Medium.ttf +0 -0
  198. package/next/font/local/InterVariable-Italic.ttf +0 -0
  199. package/next/font/local/InterVariable-Italic.woff2 +0 -0
  200. package/next/font/local/InterVariable.ttf +0 -0
  201. package/next/font/local/InterVariable.woff2 +0 -0
  202. package/next/font/next-font-desc.ts +0 -28
  203. package/next/font/pages-router-font-vars.tsx +0 -18
  204. package/next/head-metadata/from-next/metadata-types.ts +0 -158
  205. package/next/head-metadata/from-next/opengraph-types.ts +0 -267
  206. package/next/head-metadata/from-next/twitter-types.ts +0 -92
  207. package/next/head-metadata/index.tsx +0 -208
  208. package/next/index.ts +0 -2
  209. package/next/middleware/determine-device-mw.ts +0 -29
  210. package/root-layout/WHY_THIS_IS_SEPARATE.txt +0 -2
  211. package/root-layout/index.tsx +0 -112
  212. package/site-def/footer/community.tsx +0 -61
  213. package/site-def/footer/company.ts +0 -37
  214. package/site-def/footer/ecosystem.ts +0 -37
  215. package/site-def/footer/index.tsx +0 -26
  216. package/site-def/footer/legal.ts +0 -28
  217. package/site-def/footer/network.ts +0 -45
  218. package/site-def/footer/svg/warpcast-logo.svg +0 -12
  219. package/site-def/index.ts +0 -4
  220. package/site-def/main-nav.tsx +0 -460
  221. package/style/cart-animation.css +0 -29
  222. package/style/checkout-animation.css +0 -23
  223. package/style/drawer-handle-overrides.css +0 -160
  224. package/style/fonts/COPY_TO_PUBLIC_FOR_NON_NEXT.txt +0 -0
  225. package/style/fonts/Druk-Wide-Bold.ttf +0 -0
  226. package/style/fonts/Druk-Wide-Medium.ttf +0 -0
  227. package/style/fonts/InterVariable-Italic.ttf +0 -0
  228. package/style/fonts/InterVariable-Italic.woff2 +0 -0
  229. package/style/fonts/InterVariable.ttf +0 -0
  230. package/style/fonts/InterVariable.woff2 +0 -0
  231. package/style/lux-colors.css +0 -85
  232. package/style/lux-fonts.css +0 -30
  233. package/style/lux-global-non-next.css +0 -52
  234. package/style/lux-global.css +0 -51
  235. package/tailwind/fontFamily.tailwind.lux.ts +0 -18
  236. package/tailwind/index.ts +0 -2
  237. package/tailwind/lux-tw-fonts.ts +0 -40
  238. package/tailwind/tailwind.config.lux-preset.ts +0 -10
  239. package/tsconfig.json +0 -15
  240. package/types/chatbot-config.ts +0 -7
  241. package/types/chatbot-suggested-question.ts +0 -7
  242. package/types/contact-info.ts +0 -11
  243. package/types/index.ts +0 -4
  244. package/types/site-def.ts +0 -46
@@ -0,0 +1,96 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
+
27
+ var ColorModeContext = React__namespace.createContext(void 0);
28
+ function ColorModeProvider(props) {
29
+ const { children, defaultTheme = "light", value: controlledValue, onValueChange } = props;
30
+ const [internalMode, setInternalMode] = React__namespace.useState(() => {
31
+ if (controlledValue === "dark" || controlledValue === "light") {
32
+ return controlledValue;
33
+ }
34
+ if (typeof document !== "undefined") {
35
+ if (document.documentElement.classList.contains("dark")) return "dark";
36
+ }
37
+ return defaultTheme === "dark" ? "dark" : "light";
38
+ });
39
+ const colorMode = controlledValue === "dark" || controlledValue === "light" ? controlledValue : internalMode;
40
+ const setColorMode = React__namespace.useCallback((mode) => {
41
+ const resolved = mode === "dark" ? "dark" : "light";
42
+ setInternalMode(resolved);
43
+ onValueChange?.(resolved);
44
+ if (typeof document !== "undefined") {
45
+ document.documentElement.classList.toggle("dark", resolved === "dark");
46
+ document.documentElement.classList.toggle("light", resolved === "light");
47
+ }
48
+ }, [onValueChange]);
49
+ const toggleColorMode = React__namespace.useCallback(() => {
50
+ setColorMode(colorMode === "dark" ? "light" : "dark");
51
+ }, [colorMode, setColorMode]);
52
+ const ctx = React__namespace.useMemo(
53
+ () => ({ colorMode, setColorMode, toggleColorMode }),
54
+ [colorMode, setColorMode, toggleColorMode]
55
+ );
56
+ return /* @__PURE__ */ jsxRuntime.jsx(ColorModeContext.Provider, { value: ctx, children });
57
+ }
58
+ function useColorMode() {
59
+ const ctx = React__namespace.useContext(ColorModeContext);
60
+ if (!ctx) {
61
+ const [mode, setMode] = React__namespace.useState(() => {
62
+ if (typeof document !== "undefined" && document.documentElement.classList.contains("dark")) {
63
+ return "dark";
64
+ }
65
+ return "light";
66
+ });
67
+ return {
68
+ colorMode: mode,
69
+ setColorMode: (m) => {
70
+ const resolved = m === "dark" ? "dark" : "light";
71
+ setMode(resolved);
72
+ if (typeof document !== "undefined") {
73
+ document.documentElement.classList.toggle("dark", resolved === "dark");
74
+ document.documentElement.classList.toggle("light", resolved === "light");
75
+ }
76
+ },
77
+ toggleColorMode: () => {
78
+ const next = mode === "dark" ? "light" : "dark";
79
+ setMode(next);
80
+ if (typeof document !== "undefined") {
81
+ document.documentElement.classList.toggle("dark", next === "dark");
82
+ document.documentElement.classList.toggle("light", next === "light");
83
+ }
84
+ }
85
+ };
86
+ }
87
+ return ctx;
88
+ }
89
+ function useColorModeValue(light, dark) {
90
+ const { colorMode } = useColorMode();
91
+ return colorMode === "dark" ? dark : light;
92
+ }
93
+
94
+ exports.ColorModeProvider = ColorModeProvider;
95
+ exports.useColorMode = useColorMode;
96
+ exports.useColorModeValue = useColorModeValue;
@@ -0,0 +1,72 @@
1
+ "use client";
2
+ import * as React from 'react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ var ColorModeContext = React.createContext(void 0);
6
+ function ColorModeProvider(props) {
7
+ const { children, defaultTheme = "light", value: controlledValue, onValueChange } = props;
8
+ const [internalMode, setInternalMode] = React.useState(() => {
9
+ if (controlledValue === "dark" || controlledValue === "light") {
10
+ return controlledValue;
11
+ }
12
+ if (typeof document !== "undefined") {
13
+ if (document.documentElement.classList.contains("dark")) return "dark";
14
+ }
15
+ return defaultTheme === "dark" ? "dark" : "light";
16
+ });
17
+ const colorMode = controlledValue === "dark" || controlledValue === "light" ? controlledValue : internalMode;
18
+ const setColorMode = React.useCallback((mode) => {
19
+ const resolved = mode === "dark" ? "dark" : "light";
20
+ setInternalMode(resolved);
21
+ onValueChange?.(resolved);
22
+ if (typeof document !== "undefined") {
23
+ document.documentElement.classList.toggle("dark", resolved === "dark");
24
+ document.documentElement.classList.toggle("light", resolved === "light");
25
+ }
26
+ }, [onValueChange]);
27
+ const toggleColorMode = React.useCallback(() => {
28
+ setColorMode(colorMode === "dark" ? "light" : "dark");
29
+ }, [colorMode, setColorMode]);
30
+ const ctx = React.useMemo(
31
+ () => ({ colorMode, setColorMode, toggleColorMode }),
32
+ [colorMode, setColorMode, toggleColorMode]
33
+ );
34
+ return /* @__PURE__ */ jsx(ColorModeContext.Provider, { value: ctx, children });
35
+ }
36
+ function useColorMode() {
37
+ const ctx = React.useContext(ColorModeContext);
38
+ if (!ctx) {
39
+ const [mode, setMode] = React.useState(() => {
40
+ if (typeof document !== "undefined" && document.documentElement.classList.contains("dark")) {
41
+ return "dark";
42
+ }
43
+ return "light";
44
+ });
45
+ return {
46
+ colorMode: mode,
47
+ setColorMode: (m) => {
48
+ const resolved = m === "dark" ? "dark" : "light";
49
+ setMode(resolved);
50
+ if (typeof document !== "undefined") {
51
+ document.documentElement.classList.toggle("dark", resolved === "dark");
52
+ document.documentElement.classList.toggle("light", resolved === "light");
53
+ }
54
+ },
55
+ toggleColorMode: () => {
56
+ const next = mode === "dark" ? "light" : "dark";
57
+ setMode(next);
58
+ if (typeof document !== "undefined") {
59
+ document.documentElement.classList.toggle("dark", next === "dark");
60
+ document.documentElement.classList.toggle("light", next === "light");
61
+ }
62
+ }
63
+ };
64
+ }
65
+ return ctx;
66
+ }
67
+ function useColorModeValue(light, dark) {
68
+ const { colorMode } = useColorMode();
69
+ return colorMode === "dark" ? dark : light;
70
+ }
71
+
72
+ export { ColorModeProvider, useColorMode, useColorModeValue };
@@ -0,0 +1,279 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var RadixDialog = require('@radix-ui/react-dialog');
5
+ var React2 = require('react');
6
+ var clsx = require('clsx');
7
+ var tailwindMerge = require('tailwind-merge');
8
+ var jsxRuntime = require('react/jsx-runtime');
9
+
10
+ function _interopNamespace(e) {
11
+ if (e && e.__esModule) return e;
12
+ var n = Object.create(null);
13
+ if (e) {
14
+ Object.keys(e).forEach(function (k) {
15
+ if (k !== 'default') {
16
+ var d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: function () { return e[k]; }
20
+ });
21
+ }
22
+ });
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+
28
+ var RadixDialog__namespace = /*#__PURE__*/_interopNamespace(RadixDialog);
29
+ var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
30
+
31
+ // src/dialog.tsx
32
+ function cn(...inputs) {
33
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
34
+ }
35
+ var CLOSE_ICON_PATH = "M9.44 8.035a.791.791 0 0 0 1.12 0l3.802-3.803a.791.791 0 0 1 1.119 0l.287.287a.79.79 0 0 1 0 1.119L11.965 9.44a.79.79 0 0 0 0 1.118l3.803 3.803a.791.791 0 0 1 0 1.119l-.287.287a.791.791 0 0 1-1.119 0l-3.803-3.803a.79.79 0 0 0-1.118 0l-3.803 3.803a.79.79 0 0 1-1.119 0l-.287-.287a.791.791 0 0 1 0-1.119l3.803-3.803a.791.791 0 0 0 0-1.118L4.232 5.638a.791.791 0 0 1 0-1.119l.287-.287a.791.791 0 0 1 1.119 0L9.44 8.035Z";
36
+ var CloseButton = React2__namespace.forwardRef(function CloseButton2(props, ref) {
37
+ const { variant: _variant, size: _size, className, children, ...rest } = props;
38
+ return /* @__PURE__ */ jsxRuntime.jsx(
39
+ "button",
40
+ {
41
+ type: "button",
42
+ "aria-label": "Close",
43
+ ref,
44
+ className: cn(
45
+ "inline-flex items-center justify-center",
46
+ "size-5 min-w-0 shrink-0 p-0",
47
+ "rounded-sm border-0 overflow-hidden",
48
+ "bg-transparent text-[var(--closeButton-fg,currentColor)]",
49
+ "hover:bg-transparent hover:text-[var(--hover-color,currentColor)]",
50
+ "disabled:opacity-40",
51
+ "cursor-pointer",
52
+ className
53
+ ),
54
+ ...rest,
55
+ children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
56
+ "svg",
57
+ {
58
+ className: "size-5",
59
+ viewBox: "0 0 20 20",
60
+ fill: "none",
61
+ "aria-hidden": "true",
62
+ children: /* @__PURE__ */ jsxRuntime.jsx(
63
+ "path",
64
+ {
65
+ d: CLOSE_ICON_PATH,
66
+ fill: "currentColor"
67
+ }
68
+ )
69
+ }
70
+ )
71
+ }
72
+ );
73
+ });
74
+ function BackToButton({ onClick }) {
75
+ return /* @__PURE__ */ jsxRuntime.jsx(
76
+ "button",
77
+ {
78
+ type: "button",
79
+ onClick,
80
+ className: "inline-flex items-center justify-center size-8 rounded-md bg-transparent text-current hover:bg-[var(--color-button-subtle-bg)] cursor-pointer",
81
+ "aria-label": "Go back",
82
+ children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "size-5", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12.5 15L7.5 10L12.5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
83
+ }
84
+ );
85
+ }
86
+ var DialogContext = React2__namespace.createContext({ size: "md" });
87
+ function useDialogContext() {
88
+ return React2__namespace.useContext(DialogContext);
89
+ }
90
+ var CONTENT_SIZE_MAP = {
91
+ sm: "max-w-[400px]",
92
+ md: "max-w-[728px]",
93
+ full: "max-w-[100vw] min-h-dvh rounded-none [--dialog-margin:0]",
94
+ cover: "w-full h-full [--dialog-margin:0]"
95
+ };
96
+ function sizeClasses(size) {
97
+ if (typeof size === "string") {
98
+ return CONTENT_SIZE_MAP[size];
99
+ }
100
+ const parts = [];
101
+ const small = size.base ?? size.lgDown;
102
+ if (small) {
103
+ parts.push(CONTENT_SIZE_MAP[small]);
104
+ }
105
+ if (size.lg) {
106
+ const lgClasses = CONTENT_SIZE_MAP[size.lg].split(" ").map((c) => `lg:${c}`).join(" ");
107
+ parts.push(lgClasses);
108
+ }
109
+ return parts.join(" ");
110
+ }
111
+ var DialogRoot = ({
112
+ children,
113
+ open,
114
+ defaultOpen,
115
+ onOpenChange,
116
+ size = "md",
117
+ modal = true
118
+ // motionPreset is intentionally unused — kept for API compat
119
+ }) => {
120
+ const handleOpenChange = React2__namespace.useCallback(
121
+ (nextOpen) => {
122
+ onOpenChange?.({ open: nextOpen });
123
+ },
124
+ [onOpenChange]
125
+ );
126
+ const ctx = React2__namespace.useMemo(() => ({ size }), [size]);
127
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
128
+ RadixDialog__namespace.Root,
129
+ {
130
+ open,
131
+ defaultOpen,
132
+ onOpenChange: handleOpenChange,
133
+ modal,
134
+ children
135
+ }
136
+ ) });
137
+ };
138
+ var DialogContent = React2__namespace.forwardRef(function DialogContent2(props, ref) {
139
+ const {
140
+ children,
141
+ portalled = true,
142
+ portalRef,
143
+ backdrop = true,
144
+ className,
145
+ paddingTop: _paddingTop,
146
+ style: styleProp,
147
+ ...rest
148
+ } = props;
149
+ const contentInlineStyle = {
150
+ ...styleProp,
151
+ ..._paddingTop !== void 0 ? { paddingTop: typeof _paddingTop === "number" ? `${_paddingTop * 4}px` : _paddingTop } : {}
152
+ };
153
+ const { size } = useDialogContext();
154
+ let portalProps;
155
+ if (!portalled) {
156
+ portalProps = { container: void 0 };
157
+ } else if (portalRef) {
158
+ portalProps = { container: portalRef.current };
159
+ } else {
160
+ portalProps = {};
161
+ }
162
+ const Wrapper = portalled ? RadixDialog__namespace.Portal : React2__namespace.Fragment;
163
+ const wrapperProps = portalled ? portalProps : {};
164
+ return /* @__PURE__ */ jsxRuntime.jsxs(Wrapper, { ...wrapperProps, children: [
165
+ backdrop && /* @__PURE__ */ jsxRuntime.jsx(
166
+ RadixDialog__namespace.Overlay,
167
+ {
168
+ className: "fixed inset-0 z-[1400] bg-black/80"
169
+ }
170
+ ),
171
+ /* @__PURE__ */ jsxRuntime.jsx(
172
+ "div",
173
+ {
174
+ className: cn(
175
+ "fixed inset-0 z-[1400] flex w-screen h-dvh",
176
+ "items-start lg:items-center justify-center",
177
+ "overflow-hidden"
178
+ ),
179
+ children: /* @__PURE__ */ jsxRuntime.jsx(
180
+ RadixDialog__namespace.Content,
181
+ {
182
+ ref,
183
+ className: cn(
184
+ // Base content styles
185
+ "relative flex flex-col w-full p-6 outline-none text-base",
186
+ "bg-dialog-bg text-dialog-fg shadow-lg rounded-xl",
187
+ "my-[var(--dialog-margin,var(--dialog-base-margin))]",
188
+ "mx-auto [--dialog-base-margin:4rem] lg:[--dialog-base-margin:auto]",
189
+ "max-h-[calc(100%-7.5rem)] overflow-hidden",
190
+ // Size variant
191
+ sizeClasses(size),
192
+ className
193
+ ),
194
+ style: Object.keys(contentInlineStyle).length > 0 ? contentInlineStyle : void 0,
195
+ ...rest,
196
+ children
197
+ }
198
+ )
199
+ }
200
+ )
201
+ ] });
202
+ });
203
+ var DialogCloseTrigger = React2__namespace.forwardRef(function DialogCloseTrigger2(props, ref) {
204
+ const { className, ...rest } = props;
205
+ return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { ref, className, ...rest, children: props.children }) });
206
+ });
207
+ var DialogHeader = React2__namespace.forwardRef(function DialogHeader2(props, ref) {
208
+ const { startElement: startElementProp, onBackToClick, className, children, ...rest } = props;
209
+ const startElement = startElementProp ?? (onBackToClick ? /* @__PURE__ */ jsxRuntime.jsx(BackToButton, { onClick: onBackToClick }) : void 0);
210
+ return /* @__PURE__ */ jsxRuntime.jsxs(
211
+ "div",
212
+ {
213
+ ref,
214
+ className: cn(
215
+ "flex-none p-0 mb-2 flex items-center gap-x-2 min-h-[40px]",
216
+ className
217
+ ),
218
+ ...rest,
219
+ children: [
220
+ startElement,
221
+ /* @__PURE__ */ jsxRuntime.jsx(
222
+ RadixDialog__namespace.Title,
223
+ {
224
+ className: cn(
225
+ "text-base lg:text-lg font-medium",
226
+ "whitespace-nowrap overflow-hidden text-ellipsis"
227
+ ),
228
+ children
229
+ }
230
+ ),
231
+ /* @__PURE__ */ jsxRuntime.jsx(DialogCloseTrigger, { className: "ml-auto" })
232
+ ]
233
+ }
234
+ );
235
+ });
236
+ var DialogBody = React2__namespace.forwardRef(function DialogBody2({ className, pt, display, flexDir, style: styleProp, ...props }, ref) {
237
+ const bodyStyle = {
238
+ ...styleProp,
239
+ ...pt !== void 0 ? { paddingTop: typeof pt === "number" ? `${pt * 4}px` : pt } : {},
240
+ ...display ? { display } : {},
241
+ ...flexDir ? { flexDirection: flexDir } : {}
242
+ };
243
+ return /* @__PURE__ */ jsxRuntime.jsx(
244
+ "div",
245
+ {
246
+ ref,
247
+ className: cn("flex-1 p-0 overflow-auto", className),
248
+ style: Object.keys(bodyStyle).length > 0 ? bodyStyle : void 0,
249
+ ...props
250
+ }
251
+ );
252
+ });
253
+ var DialogFooter = React2__namespace.forwardRef(function DialogFooter2({ className, ...props }, ref) {
254
+ return /* @__PURE__ */ jsxRuntime.jsx(
255
+ "div",
256
+ {
257
+ ref,
258
+ className: cn("flex items-center justify-start gap-6 p-0 mt-6", className),
259
+ ...props
260
+ }
261
+ );
262
+ });
263
+ var DialogBackdrop = RadixDialog__namespace.Overlay;
264
+ var DialogTitle = RadixDialog__namespace.Title;
265
+ var DialogDescription = RadixDialog__namespace.Description;
266
+ var DialogTrigger = RadixDialog__namespace.Trigger;
267
+ var DialogActionTrigger = RadixDialog__namespace.Close;
268
+
269
+ exports.DialogActionTrigger = DialogActionTrigger;
270
+ exports.DialogBackdrop = DialogBackdrop;
271
+ exports.DialogBody = DialogBody;
272
+ exports.DialogCloseTrigger = DialogCloseTrigger;
273
+ exports.DialogContent = DialogContent;
274
+ exports.DialogDescription = DialogDescription;
275
+ exports.DialogFooter = DialogFooter;
276
+ exports.DialogHeader = DialogHeader;
277
+ exports.DialogRoot = DialogRoot;
278
+ exports.DialogTitle = DialogTitle;
279
+ exports.DialogTrigger = DialogTrigger;
package/dist/dialog.js ADDED
@@ -0,0 +1,246 @@
1
+ "use client";
2
+ import * as RadixDialog from '@radix-ui/react-dialog';
3
+ import * as React2 from 'react';
4
+ import { clsx } from 'clsx';
5
+ import { twMerge } from 'tailwind-merge';
6
+ import { jsx, jsxs } from 'react/jsx-runtime';
7
+
8
+ // src/dialog.tsx
9
+ function cn(...inputs) {
10
+ return twMerge(clsx(inputs));
11
+ }
12
+ var CLOSE_ICON_PATH = "M9.44 8.035a.791.791 0 0 0 1.12 0l3.802-3.803a.791.791 0 0 1 1.119 0l.287.287a.79.79 0 0 1 0 1.119L11.965 9.44a.79.79 0 0 0 0 1.118l3.803 3.803a.791.791 0 0 1 0 1.119l-.287.287a.791.791 0 0 1-1.119 0l-3.803-3.803a.79.79 0 0 0-1.118 0l-3.803 3.803a.79.79 0 0 1-1.119 0l-.287-.287a.791.791 0 0 1 0-1.119l3.803-3.803a.791.791 0 0 0 0-1.118L4.232 5.638a.791.791 0 0 1 0-1.119l.287-.287a.791.791 0 0 1 1.119 0L9.44 8.035Z";
13
+ var CloseButton = React2.forwardRef(function CloseButton2(props, ref) {
14
+ const { variant: _variant, size: _size, className, children, ...rest } = props;
15
+ return /* @__PURE__ */ jsx(
16
+ "button",
17
+ {
18
+ type: "button",
19
+ "aria-label": "Close",
20
+ ref,
21
+ className: cn(
22
+ "inline-flex items-center justify-center",
23
+ "size-5 min-w-0 shrink-0 p-0",
24
+ "rounded-sm border-0 overflow-hidden",
25
+ "bg-transparent text-[var(--closeButton-fg,currentColor)]",
26
+ "hover:bg-transparent hover:text-[var(--hover-color,currentColor)]",
27
+ "disabled:opacity-40",
28
+ "cursor-pointer",
29
+ className
30
+ ),
31
+ ...rest,
32
+ children: children ?? /* @__PURE__ */ jsx(
33
+ "svg",
34
+ {
35
+ className: "size-5",
36
+ viewBox: "0 0 20 20",
37
+ fill: "none",
38
+ "aria-hidden": "true",
39
+ children: /* @__PURE__ */ jsx(
40
+ "path",
41
+ {
42
+ d: CLOSE_ICON_PATH,
43
+ fill: "currentColor"
44
+ }
45
+ )
46
+ }
47
+ )
48
+ }
49
+ );
50
+ });
51
+ function BackToButton({ onClick }) {
52
+ return /* @__PURE__ */ jsx(
53
+ "button",
54
+ {
55
+ type: "button",
56
+ onClick,
57
+ className: "inline-flex items-center justify-center size-8 rounded-md bg-transparent text-current hover:bg-[var(--color-button-subtle-bg)] cursor-pointer",
58
+ "aria-label": "Go back",
59
+ children: /* @__PURE__ */ jsx("svg", { className: "size-5", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M12.5 15L7.5 10L12.5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
60
+ }
61
+ );
62
+ }
63
+ var DialogContext = React2.createContext({ size: "md" });
64
+ function useDialogContext() {
65
+ return React2.useContext(DialogContext);
66
+ }
67
+ var CONTENT_SIZE_MAP = {
68
+ sm: "max-w-[400px]",
69
+ md: "max-w-[728px]",
70
+ full: "max-w-[100vw] min-h-dvh rounded-none [--dialog-margin:0]",
71
+ cover: "w-full h-full [--dialog-margin:0]"
72
+ };
73
+ function sizeClasses(size) {
74
+ if (typeof size === "string") {
75
+ return CONTENT_SIZE_MAP[size];
76
+ }
77
+ const parts = [];
78
+ const small = size.base ?? size.lgDown;
79
+ if (small) {
80
+ parts.push(CONTENT_SIZE_MAP[small]);
81
+ }
82
+ if (size.lg) {
83
+ const lgClasses = CONTENT_SIZE_MAP[size.lg].split(" ").map((c) => `lg:${c}`).join(" ");
84
+ parts.push(lgClasses);
85
+ }
86
+ return parts.join(" ");
87
+ }
88
+ var DialogRoot = ({
89
+ children,
90
+ open,
91
+ defaultOpen,
92
+ onOpenChange,
93
+ size = "md",
94
+ modal = true
95
+ // motionPreset is intentionally unused — kept for API compat
96
+ }) => {
97
+ const handleOpenChange = React2.useCallback(
98
+ (nextOpen) => {
99
+ onOpenChange?.({ open: nextOpen });
100
+ },
101
+ [onOpenChange]
102
+ );
103
+ const ctx = React2.useMemo(() => ({ size }), [size]);
104
+ return /* @__PURE__ */ jsx(DialogContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
105
+ RadixDialog.Root,
106
+ {
107
+ open,
108
+ defaultOpen,
109
+ onOpenChange: handleOpenChange,
110
+ modal,
111
+ children
112
+ }
113
+ ) });
114
+ };
115
+ var DialogContent = React2.forwardRef(function DialogContent2(props, ref) {
116
+ const {
117
+ children,
118
+ portalled = true,
119
+ portalRef,
120
+ backdrop = true,
121
+ className,
122
+ paddingTop: _paddingTop,
123
+ style: styleProp,
124
+ ...rest
125
+ } = props;
126
+ const contentInlineStyle = {
127
+ ...styleProp,
128
+ ..._paddingTop !== void 0 ? { paddingTop: typeof _paddingTop === "number" ? `${_paddingTop * 4}px` : _paddingTop } : {}
129
+ };
130
+ const { size } = useDialogContext();
131
+ let portalProps;
132
+ if (!portalled) {
133
+ portalProps = { container: void 0 };
134
+ } else if (portalRef) {
135
+ portalProps = { container: portalRef.current };
136
+ } else {
137
+ portalProps = {};
138
+ }
139
+ const Wrapper = portalled ? RadixDialog.Portal : React2.Fragment;
140
+ const wrapperProps = portalled ? portalProps : {};
141
+ return /* @__PURE__ */ jsxs(Wrapper, { ...wrapperProps, children: [
142
+ backdrop && /* @__PURE__ */ jsx(
143
+ RadixDialog.Overlay,
144
+ {
145
+ className: "fixed inset-0 z-[1400] bg-black/80"
146
+ }
147
+ ),
148
+ /* @__PURE__ */ jsx(
149
+ "div",
150
+ {
151
+ className: cn(
152
+ "fixed inset-0 z-[1400] flex w-screen h-dvh",
153
+ "items-start lg:items-center justify-center",
154
+ "overflow-hidden"
155
+ ),
156
+ children: /* @__PURE__ */ jsx(
157
+ RadixDialog.Content,
158
+ {
159
+ ref,
160
+ className: cn(
161
+ // Base content styles
162
+ "relative flex flex-col w-full p-6 outline-none text-base",
163
+ "bg-dialog-bg text-dialog-fg shadow-lg rounded-xl",
164
+ "my-[var(--dialog-margin,var(--dialog-base-margin))]",
165
+ "mx-auto [--dialog-base-margin:4rem] lg:[--dialog-base-margin:auto]",
166
+ "max-h-[calc(100%-7.5rem)] overflow-hidden",
167
+ // Size variant
168
+ sizeClasses(size),
169
+ className
170
+ ),
171
+ style: Object.keys(contentInlineStyle).length > 0 ? contentInlineStyle : void 0,
172
+ ...rest,
173
+ children
174
+ }
175
+ )
176
+ }
177
+ )
178
+ ] });
179
+ });
180
+ var DialogCloseTrigger = React2.forwardRef(function DialogCloseTrigger2(props, ref) {
181
+ const { className, ...rest } = props;
182
+ return /* @__PURE__ */ jsx(RadixDialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(CloseButton, { ref, className, ...rest, children: props.children }) });
183
+ });
184
+ var DialogHeader = React2.forwardRef(function DialogHeader2(props, ref) {
185
+ const { startElement: startElementProp, onBackToClick, className, children, ...rest } = props;
186
+ const startElement = startElementProp ?? (onBackToClick ? /* @__PURE__ */ jsx(BackToButton, { onClick: onBackToClick }) : void 0);
187
+ return /* @__PURE__ */ jsxs(
188
+ "div",
189
+ {
190
+ ref,
191
+ className: cn(
192
+ "flex-none p-0 mb-2 flex items-center gap-x-2 min-h-[40px]",
193
+ className
194
+ ),
195
+ ...rest,
196
+ children: [
197
+ startElement,
198
+ /* @__PURE__ */ jsx(
199
+ RadixDialog.Title,
200
+ {
201
+ className: cn(
202
+ "text-base lg:text-lg font-medium",
203
+ "whitespace-nowrap overflow-hidden text-ellipsis"
204
+ ),
205
+ children
206
+ }
207
+ ),
208
+ /* @__PURE__ */ jsx(DialogCloseTrigger, { className: "ml-auto" })
209
+ ]
210
+ }
211
+ );
212
+ });
213
+ var DialogBody = React2.forwardRef(function DialogBody2({ className, pt, display, flexDir, style: styleProp, ...props }, ref) {
214
+ const bodyStyle = {
215
+ ...styleProp,
216
+ ...pt !== void 0 ? { paddingTop: typeof pt === "number" ? `${pt * 4}px` : pt } : {},
217
+ ...display ? { display } : {},
218
+ ...flexDir ? { flexDirection: flexDir } : {}
219
+ };
220
+ return /* @__PURE__ */ jsx(
221
+ "div",
222
+ {
223
+ ref,
224
+ className: cn("flex-1 p-0 overflow-auto", className),
225
+ style: Object.keys(bodyStyle).length > 0 ? bodyStyle : void 0,
226
+ ...props
227
+ }
228
+ );
229
+ });
230
+ var DialogFooter = React2.forwardRef(function DialogFooter2({ className, ...props }, ref) {
231
+ return /* @__PURE__ */ jsx(
232
+ "div",
233
+ {
234
+ ref,
235
+ className: cn("flex items-center justify-start gap-6 p-0 mt-6", className),
236
+ ...props
237
+ }
238
+ );
239
+ });
240
+ var DialogBackdrop = RadixDialog.Overlay;
241
+ var DialogTitle = RadixDialog.Title;
242
+ var DialogDescription = RadixDialog.Description;
243
+ var DialogTrigger = RadixDialog.Trigger;
244
+ var DialogActionTrigger = RadixDialog.Close;
245
+
246
+ export { DialogActionTrigger, DialogBackdrop, DialogBody, DialogCloseTrigger, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogRoot, DialogTitle, DialogTrigger };