@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,346 @@
1
+ "use client";
2
+ import * as React from 'react';
3
+ import { clsx } from 'clsx';
4
+ import { twMerge } from 'tailwind-merge';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ // src/skeleton.tsx
8
+ function cn(...inputs) {
9
+ return twMerge(clsx(inputs));
10
+ }
11
+ var SPACING_SCALE = 4;
12
+ function toStylePx(value) {
13
+ if (value === void 0) return void 0;
14
+ if (typeof value === "string") return value;
15
+ return `${value * SPACING_SCALE}px`;
16
+ }
17
+ function extractSkeletonStyleProps(props) {
18
+ const style = {};
19
+ const rest = {};
20
+ function resolveDimension(value) {
21
+ if (value === void 0 || value === null) return void 0;
22
+ if (typeof value === "number") return `${value * SPACING_SCALE}px`;
23
+ if (typeof value === "string") return value;
24
+ if (typeof value === "object") {
25
+ const obj = value;
26
+ return obj.base ?? obj.lg ?? obj.xl ?? Object.values(obj)[0];
27
+ }
28
+ return void 0;
29
+ }
30
+ for (const [key, value] of Object.entries(props)) {
31
+ if (value === void 0) continue;
32
+ switch (key) {
33
+ case "w": {
34
+ const v = resolveDimension(value);
35
+ if (v) style.width = v;
36
+ break;
37
+ }
38
+ case "h": {
39
+ const v = resolveDimension(value);
40
+ if (v) style.height = v;
41
+ break;
42
+ }
43
+ case "minW": {
44
+ const v = resolveDimension(value);
45
+ if (v) style.minWidth = v;
46
+ break;
47
+ }
48
+ case "maxW": {
49
+ const v = resolveDimension(value);
50
+ if (v) style.maxWidth = v;
51
+ break;
52
+ }
53
+ case "height":
54
+ style.height = value;
55
+ break;
56
+ case "display":
57
+ style.display = value;
58
+ break;
59
+ case "flexGrow":
60
+ style.flexGrow = value;
61
+ break;
62
+ case "flexShrink":
63
+ style.flexShrink = value;
64
+ break;
65
+ case "flexBasis":
66
+ style.flexBasis = value;
67
+ break;
68
+ case "fontWeight":
69
+ style.fontWeight = value;
70
+ break;
71
+ case "borderRadius":
72
+ style.borderRadius = value;
73
+ break;
74
+ case "alignSelf":
75
+ style.alignSelf = value;
76
+ break;
77
+ case "alignItems":
78
+ style.alignItems = value;
79
+ break;
80
+ case "justifyContent":
81
+ style.justifyContent = value;
82
+ break;
83
+ case "color":
84
+ style.color = value;
85
+ break;
86
+ case "mt":
87
+ style.marginTop = toStylePx(value);
88
+ break;
89
+ case "mb":
90
+ style.marginBottom = toStylePx(value);
91
+ break;
92
+ case "ml":
93
+ style.marginLeft = toStylePx(value);
94
+ break;
95
+ case "mr":
96
+ style.marginRight = toStylePx(value);
97
+ break;
98
+ case "overflow":
99
+ style.overflow = value;
100
+ break;
101
+ case "whiteSpace":
102
+ style.whiteSpace = value;
103
+ break;
104
+ case "textOverflow":
105
+ style.textOverflow = value;
106
+ break;
107
+ case "textTransform":
108
+ style.textTransform = value;
109
+ break;
110
+ case "gap":
111
+ style.gap = typeof value === "number" ? `${value * SPACING_SCALE}px` : value;
112
+ break;
113
+ case "gridTemplateColumns":
114
+ style.gridTemplateColumns = value;
115
+ break;
116
+ case "minWidth":
117
+ style.minWidth = value;
118
+ break;
119
+ case "boxSize": {
120
+ const s = typeof value === "number" ? `${value * SPACING_SCALE}px` : value;
121
+ style.width = s;
122
+ style.height = s;
123
+ break;
124
+ }
125
+ case "py": {
126
+ const v = toStylePx(value);
127
+ style.paddingTop = v;
128
+ style.paddingBottom = v;
129
+ break;
130
+ }
131
+ case "px": {
132
+ const v = toStylePx(value);
133
+ style.paddingLeft = v;
134
+ style.paddingRight = v;
135
+ break;
136
+ }
137
+ case "p": {
138
+ const v = toStylePx(value);
139
+ style.padding = v;
140
+ break;
141
+ }
142
+ case "hideBelow":
143
+ break;
144
+ // handled via className
145
+ case "textStyle":
146
+ break;
147
+ // drop textStyle, not directly applicable
148
+ case "fontSize":
149
+ style.fontSize = value;
150
+ break;
151
+ case "flexWrap":
152
+ style.flexWrap = value;
153
+ break;
154
+ case "wordBreak":
155
+ style.wordBreak = value;
156
+ break;
157
+ case "lineHeight":
158
+ style.lineHeight = value;
159
+ break;
160
+ case "marginRight":
161
+ style.marginRight = value;
162
+ break;
163
+ case "position":
164
+ style.position = value;
165
+ break;
166
+ case "background":
167
+ style.background = value;
168
+ break;
169
+ default:
170
+ rest[key] = value;
171
+ break;
172
+ }
173
+ }
174
+ return { style, rest };
175
+ }
176
+ var Skeleton = React.forwardRef(
177
+ function Skeleton2(props, ref) {
178
+ const {
179
+ loading = false,
180
+ asChild,
181
+ className,
182
+ children,
183
+ style: styleProp,
184
+ // Destructure style-prop shims so they don't leak into DOM
185
+ w: _w,
186
+ h: _h,
187
+ minW: _minW,
188
+ maxW: _maxW,
189
+ display: _display,
190
+ flexGrow: _flexGrow,
191
+ flexShrink: _flexShrink,
192
+ flexBasis: _flexBasis,
193
+ fontWeight: _fontWeight,
194
+ textStyle: _textStyle,
195
+ borderRadius: _borderRadius,
196
+ alignSelf: _alignSelf,
197
+ alignItems: _alignItems,
198
+ justifyContent: _justifyContent,
199
+ color: _color,
200
+ mt: _mt,
201
+ mb: _mb,
202
+ ml: _ml,
203
+ mr: _mr,
204
+ height: _height,
205
+ overflow: _overflow,
206
+ whiteSpace: _whiteSpace,
207
+ textOverflow: _textOverflow,
208
+ textTransform: _textTransform,
209
+ gap: _gap,
210
+ gridTemplateColumns: _gridTemplateColumns,
211
+ minWidth: _minWidth,
212
+ boxSize: _boxSize,
213
+ py: _py,
214
+ px: _px,
215
+ p: _p,
216
+ hideBelow: _hideBelow,
217
+ fontSize: _fontSize,
218
+ flexWrap: _flexWrap,
219
+ wordBreak: _wordBreak,
220
+ lineHeight: _lineHeight,
221
+ marginRight: _marginRight,
222
+ position: _position,
223
+ background: _background,
224
+ as: Component = "div",
225
+ ...htmlRest
226
+ } = props;
227
+ const { style: shimStyle } = extractSkeletonStyleProps({
228
+ w: _w,
229
+ h: _h,
230
+ minW: _minW,
231
+ maxW: _maxW,
232
+ display: _display,
233
+ flexGrow: _flexGrow,
234
+ flexShrink: _flexShrink,
235
+ flexBasis: _flexBasis,
236
+ fontWeight: _fontWeight,
237
+ textStyle: _textStyle,
238
+ borderRadius: _borderRadius,
239
+ alignSelf: _alignSelf,
240
+ alignItems: _alignItems,
241
+ justifyContent: _justifyContent,
242
+ color: _color,
243
+ mt: _mt,
244
+ mb: _mb,
245
+ ml: _ml,
246
+ mr: _mr,
247
+ height: _height,
248
+ overflow: _overflow,
249
+ whiteSpace: _whiteSpace,
250
+ textOverflow: _textOverflow,
251
+ textTransform: _textTransform,
252
+ gap: _gap,
253
+ gridTemplateColumns: _gridTemplateColumns,
254
+ minWidth: _minWidth,
255
+ boxSize: _boxSize,
256
+ py: _py,
257
+ px: _px,
258
+ p: _p,
259
+ hideBelow: _hideBelow,
260
+ fontSize: _fontSize,
261
+ flexWrap: _flexWrap,
262
+ wordBreak: _wordBreak,
263
+ lineHeight: _lineHeight,
264
+ marginRight: _marginRight,
265
+ position: _position,
266
+ background: _background
267
+ });
268
+ const mergedStyle = Object.keys(shimStyle).length > 0 || styleProp ? { ...shimStyle, ...styleProp } : void 0;
269
+ const HIDE_BELOW_MAP = { lg: "lg:hidden", md: "md:hidden", sm: "sm:hidden" };
270
+ const hideBelowClass = _hideBelow ? HIDE_BELOW_MAP[_hideBelow] : void 0;
271
+ const finalClassName = hideBelowClass ? cn(className, hideBelowClass) : className;
272
+ if (!loading) {
273
+ if (asChild && React.isValidElement(children)) {
274
+ return children;
275
+ }
276
+ return /* @__PURE__ */ jsx(Component, { ref, className: finalClassName, style: mergedStyle, ...htmlRest, children });
277
+ }
278
+ if (asChild && React.isValidElement(children)) {
279
+ return /* @__PURE__ */ jsx(
280
+ Component,
281
+ {
282
+ ref,
283
+ "data-loading": true,
284
+ className: cn(
285
+ "animate-skeleton-shimmer rounded-sm",
286
+ "bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
287
+ "bg-[length:200%_100%]",
288
+ "text-transparent [&_*]:invisible",
289
+ finalClassName
290
+ ),
291
+ style: mergedStyle,
292
+ ...htmlRest,
293
+ children
294
+ }
295
+ );
296
+ }
297
+ return /* @__PURE__ */ jsx(
298
+ Component,
299
+ {
300
+ ref,
301
+ "data-loading": true,
302
+ className: cn(
303
+ "animate-skeleton-shimmer rounded-sm",
304
+ "bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
305
+ "bg-[length:200%_100%]",
306
+ children ? "text-transparent [&_*]:invisible" : "min-h-5",
307
+ finalClassName
308
+ ),
309
+ style: mergedStyle,
310
+ ...htmlRest,
311
+ children
312
+ }
313
+ );
314
+ }
315
+ );
316
+ var SkeletonCircle = React.forwardRef(
317
+ function SkeletonCircle2(props, ref) {
318
+ const { size = 40, loading = true, className, ...rest } = props;
319
+ const dimension = typeof size === "number" ? `${size}px` : size;
320
+ return /* @__PURE__ */ jsx(
321
+ Skeleton,
322
+ {
323
+ ref,
324
+ loading,
325
+ className: cn("rounded-full shrink-0", className),
326
+ style: { width: dimension, height: dimension, ...rest.style },
327
+ ...rest
328
+ }
329
+ );
330
+ }
331
+ );
332
+ var SkeletonText = React.forwardRef(
333
+ function SkeletonText2(props, ref) {
334
+ const { noOfLines = 3, loading = true, className, ...rest } = props;
335
+ return /* @__PURE__ */ jsx("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...rest, children: Array.from({ length: noOfLines }).map((_, index) => /* @__PURE__ */ jsx(
336
+ Skeleton,
337
+ {
338
+ loading,
339
+ className: cn("h-4", index === noOfLines - 1 && "max-w-[80%]")
340
+ },
341
+ index
342
+ )) });
343
+ }
344
+ );
345
+
346
+ export { Skeleton, SkeletonCircle, SkeletonText };
@@ -0,0 +1,138 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var RadixSlider = require('@radix-ui/react-slider');
5
+ var React = 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 RadixSlider__namespace = /*#__PURE__*/_interopNamespace(RadixSlider);
29
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
30
+
31
+ // src/slider.tsx
32
+ function cn(...inputs) {
33
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
34
+ }
35
+ var THUMB_SIZE = 20;
36
+ var TRACK_HEIGHT = 6;
37
+ var Slider = React__namespace.forwardRef(
38
+ function Slider2(props, ref) {
39
+ const {
40
+ marks: marksProp,
41
+ label,
42
+ showValue,
43
+ value,
44
+ defaultValue,
45
+ min = 0,
46
+ max = 100,
47
+ step,
48
+ disabled,
49
+ orientation,
50
+ name,
51
+ onValueChange,
52
+ onValueCommit,
53
+ className
54
+ } = props;
55
+ const resolvedValue = defaultValue ?? value;
56
+ const marks = marksProp?.map((mark) => {
57
+ if (typeof mark === "number") return { value: mark, label: void 0 };
58
+ return mark;
59
+ });
60
+ const hasMarkLabel = Boolean(marks?.some((mark) => mark.label));
61
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
62
+ label && !showValue && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium text-text-secondary", children: label }),
63
+ label && showValue && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
64
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium text-text-secondary", children: label }),
65
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-text-secondary", children: (value ?? defaultValue ?? [])?.join(", ") })
66
+ ] }),
67
+ /* @__PURE__ */ jsxRuntime.jsxs(
68
+ RadixSlider__namespace.Root,
69
+ {
70
+ ref,
71
+ className: cn(
72
+ "relative flex w-full touch-none select-none items-center",
73
+ hasMarkLabel && "mb-6"
74
+ ),
75
+ value,
76
+ defaultValue,
77
+ min,
78
+ max,
79
+ step,
80
+ disabled,
81
+ orientation,
82
+ name,
83
+ onValueChange,
84
+ onValueCommit,
85
+ children: [
86
+ /* @__PURE__ */ jsxRuntime.jsx(
87
+ RadixSlider__namespace.Track,
88
+ {
89
+ className: cn(
90
+ "relative grow rounded-full bg-border-divider",
91
+ `h-[${TRACK_HEIGHT}px]`
92
+ ),
93
+ children: /* @__PURE__ */ jsxRuntime.jsx(RadixSlider__namespace.Range, { className: "absolute h-full rounded-full bg-link-primary" })
94
+ }
95
+ ),
96
+ resolvedValue?.map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
97
+ RadixSlider__namespace.Thumb,
98
+ {
99
+ className: cn(
100
+ `block h-[${THUMB_SIZE}px] w-[${THUMB_SIZE}px]`,
101
+ "rounded-full border-2 border-link-primary bg-white",
102
+ "shadow-sm transition-colors",
103
+ "hover:border-link-primary-hover",
104
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-link-primary focus-visible:ring-offset-2",
105
+ "disabled:pointer-events-none disabled:opacity-50"
106
+ )
107
+ },
108
+ index
109
+ ))
110
+ ]
111
+ }
112
+ ),
113
+ /* @__PURE__ */ jsxRuntime.jsx(SliderMarks, { marks, min, max })
114
+ ] });
115
+ }
116
+ );
117
+ function SliderMarks(props) {
118
+ const { marks, min, max } = props;
119
+ if (!marks?.length) return null;
120
+ const range = max - min;
121
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full h-4", children: marks.map((mark, index) => {
122
+ const percent = (mark.value - min) / range * 100;
123
+ return /* @__PURE__ */ jsxRuntime.jsxs(
124
+ "div",
125
+ {
126
+ className: "absolute flex flex-col items-center -translate-x-1/2",
127
+ style: { left: `${percent}%` },
128
+ children: [
129
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-1.5 w-0.5 bg-border-divider" }),
130
+ mark.label != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-0.5 text-xs text-text-secondary whitespace-nowrap", children: mark.label })
131
+ ]
132
+ },
133
+ index
134
+ );
135
+ }) });
136
+ }
137
+
138
+ exports.Slider = Slider;
package/dist/slider.js ADDED
@@ -0,0 +1,115 @@
1
+ "use client";
2
+ import * as RadixSlider from '@radix-ui/react-slider';
3
+ import * as React from 'react';
4
+ import { clsx } from 'clsx';
5
+ import { twMerge } from 'tailwind-merge';
6
+ import { jsxs, jsx } from 'react/jsx-runtime';
7
+
8
+ // src/slider.tsx
9
+ function cn(...inputs) {
10
+ return twMerge(clsx(inputs));
11
+ }
12
+ var THUMB_SIZE = 20;
13
+ var TRACK_HEIGHT = 6;
14
+ var Slider = React.forwardRef(
15
+ function Slider2(props, ref) {
16
+ const {
17
+ marks: marksProp,
18
+ label,
19
+ showValue,
20
+ value,
21
+ defaultValue,
22
+ min = 0,
23
+ max = 100,
24
+ step,
25
+ disabled,
26
+ orientation,
27
+ name,
28
+ onValueChange,
29
+ onValueCommit,
30
+ className
31
+ } = props;
32
+ const resolvedValue = defaultValue ?? value;
33
+ const marks = marksProp?.map((mark) => {
34
+ if (typeof mark === "number") return { value: mark, label: void 0 };
35
+ return mark;
36
+ });
37
+ const hasMarkLabel = Boolean(marks?.some((mark) => mark.label));
38
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
39
+ label && !showValue && /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-text-secondary", children: label }),
40
+ label && showValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
41
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-text-secondary", children: label }),
42
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-text-secondary", children: (value ?? defaultValue ?? [])?.join(", ") })
43
+ ] }),
44
+ /* @__PURE__ */ jsxs(
45
+ RadixSlider.Root,
46
+ {
47
+ ref,
48
+ className: cn(
49
+ "relative flex w-full touch-none select-none items-center",
50
+ hasMarkLabel && "mb-6"
51
+ ),
52
+ value,
53
+ defaultValue,
54
+ min,
55
+ max,
56
+ step,
57
+ disabled,
58
+ orientation,
59
+ name,
60
+ onValueChange,
61
+ onValueCommit,
62
+ children: [
63
+ /* @__PURE__ */ jsx(
64
+ RadixSlider.Track,
65
+ {
66
+ className: cn(
67
+ "relative grow rounded-full bg-border-divider",
68
+ `h-[${TRACK_HEIGHT}px]`
69
+ ),
70
+ children: /* @__PURE__ */ jsx(RadixSlider.Range, { className: "absolute h-full rounded-full bg-link-primary" })
71
+ }
72
+ ),
73
+ resolvedValue?.map((_, index) => /* @__PURE__ */ jsx(
74
+ RadixSlider.Thumb,
75
+ {
76
+ className: cn(
77
+ `block h-[${THUMB_SIZE}px] w-[${THUMB_SIZE}px]`,
78
+ "rounded-full border-2 border-link-primary bg-white",
79
+ "shadow-sm transition-colors",
80
+ "hover:border-link-primary-hover",
81
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-link-primary focus-visible:ring-offset-2",
82
+ "disabled:pointer-events-none disabled:opacity-50"
83
+ )
84
+ },
85
+ index
86
+ ))
87
+ ]
88
+ }
89
+ ),
90
+ /* @__PURE__ */ jsx(SliderMarks, { marks, min, max })
91
+ ] });
92
+ }
93
+ );
94
+ function SliderMarks(props) {
95
+ const { marks, min, max } = props;
96
+ if (!marks?.length) return null;
97
+ const range = max - min;
98
+ return /* @__PURE__ */ jsx("div", { className: "relative w-full h-4", children: marks.map((mark, index) => {
99
+ const percent = (mark.value - min) / range * 100;
100
+ return /* @__PURE__ */ jsxs(
101
+ "div",
102
+ {
103
+ className: "absolute flex flex-col items-center -translate-x-1/2",
104
+ style: { left: `${percent}%` },
105
+ children: [
106
+ /* @__PURE__ */ jsx("div", { className: "h-1.5 w-0.5 bg-border-divider" }),
107
+ mark.label != null && /* @__PURE__ */ jsx("span", { className: "mt-0.5 text-xs text-text-secondary whitespace-nowrap", children: mark.label })
108
+ ]
109
+ },
110
+ index
111
+ );
112
+ }) });
113
+ }
114
+
115
+ export { Slider };