ruler-components 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/index.d.mts +51 -0
  2. package/dist/index.d.ts +51 -0
  3. package/dist/index.js +534 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/index.mjs +498 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +21 -2
  8. package/AGENTS.md +0 -9
  9. package/CLAUDE.md +0 -1
  10. package/app/docs/[slug]/page.tsx +0 -147
  11. package/app/docs/layout.tsx +0 -26
  12. package/app/docs/page.tsx +0 -148
  13. package/app/favicon.ico +0 -0
  14. package/app/globals.css +0 -168
  15. package/app/icon.png +0 -0
  16. package/app/layout.tsx +0 -90
  17. package/app/opengraph-image.tsx +0 -10
  18. package/app/page.tsx +0 -34
  19. package/app/twitter-image.tsx +0 -10
  20. package/components/docs/accordion-doc-page.tsx +0 -352
  21. package/components/docs/alert-doc-page.tsx +0 -293
  22. package/components/docs/allinput-doc-page.tsx +0 -183
  23. package/components/docs/avatar-doc-page.tsx +0 -424
  24. package/components/docs/badge-doc-page.tsx +0 -363
  25. package/components/docs/button-doc-page.tsx +0 -406
  26. package/components/docs/card-doc-page.tsx +0 -364
  27. package/components/docs/checkbox-doc-page.tsx +0 -277
  28. package/components/docs/colors-doc-page.tsx +0 -430
  29. package/components/docs/dialog-doc-page.tsx +0 -364
  30. package/components/docs/docs-footer.tsx +0 -11
  31. package/components/docs/docs-mobile-menu-bar.tsx +0 -22
  32. package/components/docs/docs-mobile-nav-context.tsx +0 -27
  33. package/components/docs/docs-page.tsx +0 -263
  34. package/components/docs/docs-search.tsx +0 -303
  35. package/components/docs/docs-sidebar.tsx +0 -165
  36. package/components/docs/docs-topbar.tsx +0 -32
  37. package/components/docs/dropdown-doc-page.tsx +0 -522
  38. package/components/docs/getting-started-doc-page.tsx +0 -205
  39. package/components/docs/label-doc-page.tsx +0 -173
  40. package/components/docs/loaders-doc-page.tsx +0 -244
  41. package/components/docs/menu-doc-page.tsx +0 -373
  42. package/components/docs/modal-doc-page.tsx +0 -436
  43. package/components/docs/next-steps.tsx +0 -53
  44. package/components/docs/pagination-doc-page.tsx +0 -316
  45. package/components/docs/progress-doc-page.tsx +0 -387
  46. package/components/docs/radio-doc-page.tsx +0 -270
  47. package/components/docs/skeleton-doc-page.tsx +0 -230
  48. package/components/docs/stepper-doc-page.tsx +0 -309
  49. package/components/docs/switch-doc-page.tsx +0 -264
  50. package/components/docs/table-doc-page.tsx +0 -689
  51. package/components/docs/tabs-doc-page.tsx +0 -359
  52. package/components/docs/theming-doc-page.tsx +0 -243
  53. package/components/docs/tooltip-doc-page.tsx +0 -357
  54. package/components/docs/usage-section.tsx +0 -21
  55. package/components/icons/discord.tsx +0 -9
  56. package/components/icons/github.tsx +0 -9
  57. package/components/icons/x.tsx +0 -9
  58. package/components/installation-section.tsx +0 -34
  59. package/components/landing/feature-highlights.tsx +0 -105
  60. package/components/landing/footer-strip.tsx +0 -45
  61. package/components/landing/hero-card.tsx +0 -14
  62. package/components/landing/hero-spotlight.tsx +0 -126
  63. package/components/landing/hero.tsx +0 -64
  64. package/components/landing/navbar.tsx +0 -44
  65. package/components/landing/quick-start-section.tsx +0 -59
  66. package/components/landing/site-footer.tsx +0 -55
  67. package/components/theme-provider.tsx +0 -60
  68. package/components/ui/accordion.tsx +0 -174
  69. package/components/ui/alert.tsx +0 -103
  70. package/components/ui/allinput.tsx +0 -210
  71. package/components/ui/avatar.tsx +0 -179
  72. package/components/ui/badge.tsx +0 -52
  73. package/components/ui/button.tsx +0 -75
  74. package/components/ui/card.tsx +0 -105
  75. package/components/ui/checkbox.tsx +0 -130
  76. package/components/ui/code-block.tsx +0 -60
  77. package/components/ui/data-table.tsx +0 -235
  78. package/components/ui/dialog.tsx +0 -173
  79. package/components/ui/dropdown.tsx +0 -78
  80. package/components/ui/feature-card.tsx +0 -38
  81. package/components/ui/input.tsx +0 -44
  82. package/components/ui/label.tsx +0 -110
  83. package/components/ui/loaders.tsx +0 -139
  84. package/components/ui/menu.tsx +0 -118
  85. package/components/ui/modal.tsx +0 -399
  86. package/components/ui/package-manager-tabs.tsx +0 -40
  87. package/components/ui/pagination.tsx +0 -200
  88. package/components/ui/progress.tsx +0 -134
  89. package/components/ui/radio.tsx +0 -262
  90. package/components/ui/skeleton.tsx +0 -102
  91. package/components/ui/steppers.tsx +0 -309
  92. package/components/ui/switch.tsx +0 -153
  93. package/components/ui/table.tsx +0 -58
  94. package/components/ui/tabs.tsx +0 -166
  95. package/components/ui/theme-toggle.tsx +0 -60
  96. package/components/ui/tooltip.tsx +0 -238
  97. package/data/color-palette.ts +0 -35
  98. package/data/docs-nav.ts +0 -84
  99. package/eslint.config.mjs +0 -18
  100. package/index.ts +0 -8
  101. package/lib/cn.ts +0 -4
  102. package/lib/color.ts +0 -85
  103. package/lib/og-image.tsx +0 -138
  104. package/lib/theme.ts +0 -33
  105. package/next.config.ts +0 -7
  106. package/postcss.config.mjs +0 -7
  107. package/public/dark.png +0 -0
  108. package/public/dark1.png +0 -0
  109. package/public/dark2.png +0 -0
  110. package/public/file.svg +0 -1
  111. package/public/globe.svg +0 -1
  112. package/public/light.png +0 -0
  113. package/public/light1.png +0 -0
  114. package/public/next.svg +0 -1
  115. package/public/vercel.svg +0 -1
  116. package/public/video/hero-demo.mp4 +0 -0
  117. package/public/window.svg +0 -1
  118. package/tsconfig.json +0 -34
@@ -0,0 +1,51 @@
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
+ import * as React from 'react';
3
+ import { VariantProps } from 'class-variance-authority';
4
+
5
+ declare const progressTrackVariants: (props?: ({
6
+ size?: "sm" | "md" | "lg" | null | undefined;
7
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
8
+ declare const progressIndicatorVariants: (props?: ({
9
+ variant?: "default" | "success" | "warning" | "error" | null | undefined;
10
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
11
+ interface ProgressProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children">, VariantProps<typeof progressTrackVariants>, VariantProps<typeof progressIndicatorVariants> {
12
+ value?: number;
13
+ max?: number;
14
+ label?: string;
15
+ showValue?: boolean;
16
+ indeterminate?: boolean;
17
+ disabled?: boolean;
18
+ }
19
+ declare const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLDivElement>>;
20
+
21
+ declare const switchTrackVariants: (props?: ({
22
+ size?: "sm" | "md" | "lg" | null | undefined;
23
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
24
+ interface SwitchProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onChange" | "size">, VariantProps<typeof switchTrackVariants> {
25
+ checked?: boolean;
26
+ defaultChecked?: boolean;
27
+ onCheckedChange?: (checked: boolean) => void;
28
+ label?: string;
29
+ description?: string;
30
+ }
31
+ declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
32
+
33
+ declare const tooltipVariants: (props?: ({
34
+ visible?: boolean | null | undefined;
35
+ side?: "top" | "bottom" | "left" | "right" | null | undefined;
36
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
37
+ type TooltipSide = "top" | "bottom" | "left" | "right";
38
+ type TooltipAlign = "start" | "center" | "end";
39
+ interface TooltipProps extends VariantProps<typeof tooltipVariants> {
40
+ content: React.ReactNode;
41
+ children: React.ReactNode;
42
+ side?: TooltipSide;
43
+ align?: TooltipAlign;
44
+ sideOffset?: number;
45
+ delayDuration?: number;
46
+ disabled?: boolean;
47
+ className?: string;
48
+ }
49
+ declare function Tooltip({ content, children, side, align, sideOffset, delayDuration, disabled, className, }: TooltipProps): React.JSX.Element;
50
+
51
+ export { Progress, type ProgressProps, Switch, type SwitchProps, Tooltip, type TooltipProps };
@@ -0,0 +1,51 @@
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
+ import * as React from 'react';
3
+ import { VariantProps } from 'class-variance-authority';
4
+
5
+ declare const progressTrackVariants: (props?: ({
6
+ size?: "sm" | "md" | "lg" | null | undefined;
7
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
8
+ declare const progressIndicatorVariants: (props?: ({
9
+ variant?: "default" | "success" | "warning" | "error" | null | undefined;
10
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
11
+ interface ProgressProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children">, VariantProps<typeof progressTrackVariants>, VariantProps<typeof progressIndicatorVariants> {
12
+ value?: number;
13
+ max?: number;
14
+ label?: string;
15
+ showValue?: boolean;
16
+ indeterminate?: boolean;
17
+ disabled?: boolean;
18
+ }
19
+ declare const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLDivElement>>;
20
+
21
+ declare const switchTrackVariants: (props?: ({
22
+ size?: "sm" | "md" | "lg" | null | undefined;
23
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
24
+ interface SwitchProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onChange" | "size">, VariantProps<typeof switchTrackVariants> {
25
+ checked?: boolean;
26
+ defaultChecked?: boolean;
27
+ onCheckedChange?: (checked: boolean) => void;
28
+ label?: string;
29
+ description?: string;
30
+ }
31
+ declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
32
+
33
+ declare const tooltipVariants: (props?: ({
34
+ visible?: boolean | null | undefined;
35
+ side?: "top" | "bottom" | "left" | "right" | null | undefined;
36
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
37
+ type TooltipSide = "top" | "bottom" | "left" | "right";
38
+ type TooltipAlign = "start" | "center" | "end";
39
+ interface TooltipProps extends VariantProps<typeof tooltipVariants> {
40
+ content: React.ReactNode;
41
+ children: React.ReactNode;
42
+ side?: TooltipSide;
43
+ align?: TooltipAlign;
44
+ sideOffset?: number;
45
+ delayDuration?: number;
46
+ disabled?: boolean;
47
+ className?: string;
48
+ }
49
+ declare function Tooltip({ content, children, side, align, sideOffset, delayDuration, disabled, className, }: TooltipProps): React.JSX.Element;
50
+
51
+ export { Progress, type ProgressProps, Switch, type SwitchProps, Tooltip, type TooltipProps };
package/dist/index.js ADDED
@@ -0,0 +1,534 @@
1
+ "use client";
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __defProps = Object.defineProperties;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
10
+ var __getProtoOf = Object.getPrototypeOf;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
13
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
+ var __spreadValues = (a, b) => {
15
+ for (var prop in b || (b = {}))
16
+ if (__hasOwnProp.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ if (__getOwnPropSymbols)
19
+ for (var prop of __getOwnPropSymbols(b)) {
20
+ if (__propIsEnum.call(b, prop))
21
+ __defNormalProp(a, prop, b[prop]);
22
+ }
23
+ return a;
24
+ };
25
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
+ var __objRest = (source, exclude) => {
27
+ var target = {};
28
+ for (var prop in source)
29
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
30
+ target[prop] = source[prop];
31
+ if (source != null && __getOwnPropSymbols)
32
+ for (var prop of __getOwnPropSymbols(source)) {
33
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
34
+ target[prop] = source[prop];
35
+ }
36
+ return target;
37
+ };
38
+ var __export = (target, all) => {
39
+ for (var name in all)
40
+ __defProp(target, name, { get: all[name], enumerable: true });
41
+ };
42
+ var __copyProps = (to, from, except, desc) => {
43
+ if (from && typeof from === "object" || typeof from === "function") {
44
+ for (let key of __getOwnPropNames(from))
45
+ if (!__hasOwnProp.call(to, key) && key !== except)
46
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
47
+ }
48
+ return to;
49
+ };
50
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
51
+ // If the importer is in node compatibility mode or this is not an ESM
52
+ // file that has been converted to a CommonJS file using a Babel-
53
+ // compatible transform (i.e. "__esModule" has not been set), then set
54
+ // "default" to the CommonJS "module.exports" for node compatibility.
55
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
56
+ mod
57
+ ));
58
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
59
+
60
+ // index.ts
61
+ var index_exports = {};
62
+ __export(index_exports, {
63
+ Progress: () => Progress,
64
+ Switch: () => Switch,
65
+ Tooltip: () => Tooltip
66
+ });
67
+ module.exports = __toCommonJS(index_exports);
68
+
69
+ // components/ui/progress.tsx
70
+ var React = __toESM(require("react"));
71
+ var import_class_variance_authority = require("class-variance-authority");
72
+
73
+ // lib/cn.ts
74
+ var import_clsx = require("clsx");
75
+ var import_tailwind_merge = require("tailwind-merge");
76
+ var cn = (...inputs) => (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
77
+
78
+ // components/ui/progress.tsx
79
+ var import_jsx_runtime = require("react/jsx-runtime");
80
+ var progressTrackVariants = (0, import_class_variance_authority.cva)(
81
+ "relative w-full overflow-hidden rounded-full bg-zinc-100 dark:bg-zinc-800/70",
82
+ {
83
+ variants: {
84
+ size: {
85
+ sm: "h-1",
86
+ md: "h-1.5",
87
+ lg: "h-2"
88
+ }
89
+ },
90
+ defaultVariants: { size: "md" }
91
+ }
92
+ );
93
+ var progressIndicatorVariants = (0, import_class_variance_authority.cva)(
94
+ "h-full rounded-full transition-[width] duration-500 ease-[cubic-bezier(0.4,0,0.2,1)]",
95
+ {
96
+ variants: {
97
+ variant: {
98
+ default: "bg-zinc-900 dark:bg-zinc-100",
99
+ success: "bg-[#28A745] dark:bg-[#5CC975]",
100
+ warning: "bg-[#E58E00] dark:bg-[#F5B84A]",
101
+ error: "bg-[#D93025] dark:bg-[#F06B62]"
102
+ }
103
+ },
104
+ defaultVariants: { variant: "default" }
105
+ }
106
+ );
107
+ var valuePillVariants = (0, import_class_variance_authority.cva)(
108
+ "inline-flex min-w-[2.25rem] items-center justify-end text-[11px] font-medium tabular-nums text-zinc-400 dark:text-zinc-500",
109
+ {
110
+ variants: {
111
+ variant: {
112
+ default: "",
113
+ success: "",
114
+ warning: "",
115
+ error: ""
116
+ }
117
+ },
118
+ defaultVariants: { variant: "default" }
119
+ }
120
+ );
121
+ var Progress = React.forwardRef(
122
+ (_a, ref) => {
123
+ var _b = _a, {
124
+ className,
125
+ value = 0,
126
+ max = 100,
127
+ variant,
128
+ size,
129
+ label,
130
+ showValue = false,
131
+ indeterminate = false,
132
+ disabled = false
133
+ } = _b, props = __objRest(_b, [
134
+ "className",
135
+ "value",
136
+ "max",
137
+ "variant",
138
+ "size",
139
+ "label",
140
+ "showValue",
141
+ "indeterminate",
142
+ "disabled"
143
+ ]);
144
+ const clamped = Math.min(max, Math.max(0, value));
145
+ const percentage = max > 0 ? Math.round(clamped / max * 100) : 0;
146
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
147
+ "div",
148
+ {
149
+ className: cn(
150
+ "flex w-full flex-col gap-2.5",
151
+ disabled && "pointer-events-none opacity-50",
152
+ className
153
+ ),
154
+ children: [
155
+ (label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [
156
+ label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-sm text-zinc-600 dark:text-zinc-300", children: label }),
157
+ showValue && !indeterminate && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: cn(valuePillVariants({ variant })), children: [
158
+ percentage,
159
+ "%"
160
+ ] })
161
+ ] }),
162
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
163
+ "div",
164
+ __spreadProps(__spreadValues({
165
+ ref,
166
+ role: "progressbar",
167
+ "aria-valuemin": 0,
168
+ "aria-valuemax": max,
169
+ "aria-valuenow": indeterminate || disabled ? void 0 : clamped,
170
+ "aria-label": label,
171
+ "aria-valuetext": indeterminate ? "Loading" : `${percentage}%`,
172
+ "aria-disabled": disabled || void 0,
173
+ className: cn(progressTrackVariants({ size }))
174
+ }, props), {
175
+ children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
176
+ "div",
177
+ {
178
+ className: cn(
179
+ progressIndicatorVariants({ variant }),
180
+ "w-[40%] animate-[progress-indeterminate_1.5s_ease-in-out_infinite]"
181
+ )
182
+ }
183
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
184
+ "div",
185
+ {
186
+ className: cn(progressIndicatorVariants({ variant })),
187
+ style: { width: `${percentage}%` }
188
+ }
189
+ )
190
+ })
191
+ )
192
+ ]
193
+ }
194
+ );
195
+ }
196
+ );
197
+ Progress.displayName = "Progress";
198
+
199
+ // components/ui/switch.tsx
200
+ var React2 = __toESM(require("react"));
201
+ var import_class_variance_authority2 = require("class-variance-authority");
202
+ var import_jsx_runtime2 = require("react/jsx-runtime");
203
+ var switchTrackVariants = (0, import_class_variance_authority2.cva)(
204
+ [
205
+ "relative inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors duration-200",
206
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-900/20 focus-visible:ring-offset-2 focus-visible:ring-offset-white",
207
+ "dark:focus-visible:ring-zinc-100/20 dark:focus-visible:ring-offset-zinc-950",
208
+ "disabled:cursor-not-allowed disabled:opacity-50",
209
+ "data-[state=checked]:bg-zinc-900 data-[state=unchecked]:bg-zinc-200",
210
+ "dark:data-[state=checked]:bg-zinc-100 dark:data-[state=unchecked]:bg-zinc-700",
211
+ "hover:data-[state=unchecked]:bg-zinc-300 dark:hover:data-[state=unchecked]:bg-zinc-600",
212
+ "hover:data-[state=checked]:bg-zinc-800 dark:hover:data-[state=checked]:bg-zinc-200"
213
+ ],
214
+ {
215
+ variants: {
216
+ size: {
217
+ sm: "h-5 w-9",
218
+ md: "h-6 w-11",
219
+ lg: "h-7 w-[3.25rem]"
220
+ }
221
+ },
222
+ defaultVariants: { size: "md" }
223
+ }
224
+ );
225
+ var switchThumbVariants = (0, import_class_variance_authority2.cva)(
226
+ "pointer-events-none absolute left-0.5 top-1/2 block -translate-y-1/2 rounded-full bg-white shadow-sm transition-transform duration-200 dark:bg-zinc-950",
227
+ {
228
+ variants: {
229
+ size: {
230
+ sm: "h-3.5 w-3.5 data-[state=checked]:translate-x-4",
231
+ md: "h-4 w-4 data-[state=checked]:translate-x-5",
232
+ lg: "h-5 w-5 data-[state=checked]:translate-x-6"
233
+ }
234
+ },
235
+ defaultVariants: { size: "md" }
236
+ }
237
+ );
238
+ var Switch = React2.forwardRef(
239
+ (_a, ref) => {
240
+ var _b = _a, {
241
+ className,
242
+ size,
243
+ checked,
244
+ defaultChecked = false,
245
+ onCheckedChange,
246
+ disabled,
247
+ label,
248
+ description,
249
+ id,
250
+ onClick
251
+ } = _b, props = __objRest(_b, [
252
+ "className",
253
+ "size",
254
+ "checked",
255
+ "defaultChecked",
256
+ "onCheckedChange",
257
+ "disabled",
258
+ "label",
259
+ "description",
260
+ "id",
261
+ "onClick"
262
+ ]);
263
+ const generatedId = React2.useId();
264
+ const switchId = id != null ? id : generatedId;
265
+ const isControlled = checked !== void 0;
266
+ const [uncontrolledChecked, setUncontrolledChecked] = React2.useState(defaultChecked);
267
+ const isChecked = isControlled ? checked : uncontrolledChecked;
268
+ const state = isChecked ? "checked" : "unchecked";
269
+ const toggle = () => {
270
+ if (disabled) return;
271
+ const next = !isChecked;
272
+ if (!isControlled) setUncontrolledChecked(next);
273
+ onCheckedChange == null ? void 0 : onCheckedChange(next);
274
+ };
275
+ const switchControl = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
276
+ "button",
277
+ __spreadProps(__spreadValues({
278
+ ref,
279
+ id: switchId,
280
+ type: "button",
281
+ role: "switch",
282
+ "aria-checked": isChecked,
283
+ "aria-labelledby": label ? `${switchId}-label` : void 0,
284
+ "aria-describedby": description ? `${switchId}-description` : void 0,
285
+ disabled,
286
+ "data-state": state,
287
+ className: cn(switchTrackVariants({ size }), className),
288
+ onClick: (event) => {
289
+ toggle();
290
+ onClick == null ? void 0 : onClick(event);
291
+ },
292
+ onKeyDown: (event) => {
293
+ if (event.key === " ") {
294
+ event.preventDefault();
295
+ toggle();
296
+ }
297
+ }
298
+ }, props), {
299
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "data-state": state, className: switchThumbVariants({ size }) })
300
+ })
301
+ );
302
+ if (!label && !description) {
303
+ return switchControl;
304
+ }
305
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
306
+ "div",
307
+ {
308
+ className: cn(
309
+ "flex items-start justify-between gap-4",
310
+ disabled && "opacity-60"
311
+ ),
312
+ children: [
313
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
314
+ label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
315
+ "label",
316
+ {
317
+ id: `${switchId}-label`,
318
+ htmlFor: switchId,
319
+ className: cn(
320
+ "text-sm font-medium leading-snug text-zinc-800 dark:text-zinc-100",
321
+ !disabled && "cursor-pointer"
322
+ ),
323
+ children: label
324
+ }
325
+ ),
326
+ description && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
327
+ "p",
328
+ {
329
+ id: `${switchId}-description`,
330
+ className: "text-xs leading-relaxed text-zinc-500 dark:text-zinc-400",
331
+ children: description
332
+ }
333
+ )
334
+ ] }),
335
+ switchControl
336
+ ]
337
+ }
338
+ );
339
+ }
340
+ );
341
+ Switch.displayName = "Switch";
342
+
343
+ // components/ui/tooltip.tsx
344
+ var React3 = __toESM(require("react"));
345
+ var import_react_dom = require("react-dom");
346
+ var import_class_variance_authority3 = require("class-variance-authority");
347
+ var import_jsx_runtime3 = require("react/jsx-runtime");
348
+ var tooltipVariants = (0, import_class_variance_authority3.cva)(
349
+ [
350
+ "pointer-events-none fixed z-50 max-w-[260px] rounded-lg px-3 py-2",
351
+ "text-[13px] font-medium leading-normal tracking-tight",
352
+ "bg-zinc-900 text-zinc-50",
353
+ "shadow-[0_4px_16px_rgba(0,0,0,0.14),0_0_0_1px_rgba(255,255,255,0.06)]",
354
+ "dark:bg-zinc-100 dark:text-zinc-900",
355
+ "dark:shadow-[0_4px_16px_rgba(0,0,0,0.35),0_0_0_1px_rgba(0,0,0,0.06)]",
356
+ "transition-[opacity,transform] duration-200 ease-[cubic-bezier(0.16,1,0.3,1)]",
357
+ "will-change-[opacity,transform]"
358
+ ],
359
+ {
360
+ variants: {
361
+ visible: {
362
+ true: "opacity-100 scale-100",
363
+ false: "opacity-0 scale-[0.97]"
364
+ },
365
+ side: {
366
+ top: "origin-bottom",
367
+ bottom: "origin-top",
368
+ left: "origin-right",
369
+ right: "origin-left"
370
+ }
371
+ },
372
+ defaultVariants: { visible: false, side: "top" }
373
+ }
374
+ );
375
+ var VIEWPORT_PADDING = 10;
376
+ var ARROW_SIZE = 6;
377
+ function getTooltipPosition(triggerRect, tooltipRect, side, align, sideOffset) {
378
+ const offset = sideOffset + ARROW_SIZE;
379
+ let top = 0;
380
+ let left = 0;
381
+ if (side === "top") {
382
+ top = triggerRect.top - tooltipRect.height - offset;
383
+ left = alignTooltipHorizontal(triggerRect, tooltipRect, align);
384
+ } else if (side === "bottom") {
385
+ top = triggerRect.bottom + offset;
386
+ left = alignTooltipHorizontal(triggerRect, tooltipRect, align);
387
+ } else if (side === "left") {
388
+ top = alignTooltipVertical(triggerRect, tooltipRect, align);
389
+ left = triggerRect.left - tooltipRect.width - offset;
390
+ } else {
391
+ top = alignTooltipVertical(triggerRect, tooltipRect, align);
392
+ left = triggerRect.right + offset;
393
+ }
394
+ const maxLeft = window.innerWidth - tooltipRect.width - VIEWPORT_PADDING;
395
+ const maxTop = window.innerHeight - tooltipRect.height - VIEWPORT_PADDING;
396
+ return {
397
+ top: Math.min(Math.max(top, VIEWPORT_PADDING), maxTop),
398
+ left: Math.min(Math.max(left, VIEWPORT_PADDING), maxLeft)
399
+ };
400
+ }
401
+ function alignTooltipHorizontal(triggerRect, tooltipRect, align) {
402
+ if (align === "start") return triggerRect.left;
403
+ if (align === "end") return triggerRect.right - tooltipRect.width;
404
+ return triggerRect.left + triggerRect.width / 2 - tooltipRect.width / 2;
405
+ }
406
+ function alignTooltipVertical(triggerRect, tooltipRect, align) {
407
+ if (align === "start") return triggerRect.top;
408
+ if (align === "end") return triggerRect.bottom - tooltipRect.height;
409
+ return triggerRect.top + triggerRect.height / 2 - tooltipRect.height / 2;
410
+ }
411
+ function TooltipArrow({ side }) {
412
+ const position = {
413
+ top: "bottom-0 left-1/2 -translate-x-1/2 translate-y-[calc(100%-1px)]",
414
+ bottom: "top-0 left-1/2 -translate-x-1/2 -translate-y-[calc(100%-1px)] rotate-180",
415
+ left: "right-0 top-1/2 -translate-y-1/2 translate-x-[calc(100%-1px)] -rotate-90",
416
+ right: "left-0 top-1/2 -translate-y-1/2 -translate-x-[calc(100%-1px)] rotate-90"
417
+ }[side];
418
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
419
+ "svg",
420
+ {
421
+ "aria-hidden": true,
422
+ width: "10",
423
+ height: "5",
424
+ viewBox: "0 0 10 5",
425
+ className: cn(
426
+ "absolute text-zinc-900 dark:text-zinc-100",
427
+ position
428
+ ),
429
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fill: "currentColor", d: "M0 0h10L5 5 0 0z" })
430
+ }
431
+ );
432
+ }
433
+ function Tooltip({
434
+ content,
435
+ children,
436
+ side = "top",
437
+ align = "center",
438
+ sideOffset = 8,
439
+ delayDuration = 250,
440
+ disabled = false,
441
+ className
442
+ }) {
443
+ const [open, setOpen] = React3.useState(false);
444
+ const [visible, setVisible] = React3.useState(false);
445
+ const [mounted, setMounted] = React3.useState(false);
446
+ const [position, setPosition] = React3.useState({ top: -9999, left: -9999 });
447
+ const timeoutRef = React3.useRef(null);
448
+ const triggerRef = React3.useRef(null);
449
+ const tooltipRef = React3.useRef(null);
450
+ const id = React3.useId();
451
+ React3.useEffect(() => setMounted(true), []);
452
+ const clearTimer = () => {
453
+ if (timeoutRef.current) {
454
+ clearTimeout(timeoutRef.current);
455
+ timeoutRef.current = null;
456
+ }
457
+ };
458
+ const updatePosition = React3.useCallback(() => {
459
+ const trigger2 = triggerRef.current;
460
+ const tooltip = tooltipRef.current;
461
+ if (!trigger2 || !tooltip) return;
462
+ const triggerRect = trigger2.getBoundingClientRect();
463
+ const tooltipRect = tooltip.getBoundingClientRect();
464
+ setPosition(getTooltipPosition(triggerRect, tooltipRect, side, align, sideOffset));
465
+ requestAnimationFrame(() => setVisible(true));
466
+ }, [side, align, sideOffset]);
467
+ const show = () => {
468
+ if (disabled) return;
469
+ clearTimer();
470
+ timeoutRef.current = setTimeout(() => {
471
+ setVisible(false);
472
+ setOpen(true);
473
+ }, delayDuration);
474
+ };
475
+ const hide = () => {
476
+ clearTimer();
477
+ setVisible(false);
478
+ setOpen(false);
479
+ };
480
+ React3.useEffect(() => clearTimer, []);
481
+ React3.useLayoutEffect(() => {
482
+ if (!open) return;
483
+ updatePosition();
484
+ const handleUpdate = () => updatePosition();
485
+ window.addEventListener("scroll", handleUpdate, true);
486
+ window.addEventListener("resize", handleUpdate);
487
+ return () => {
488
+ window.removeEventListener("scroll", handleUpdate, true);
489
+ window.removeEventListener("resize", handleUpdate);
490
+ };
491
+ }, [open, updatePosition, content]);
492
+ const child = React3.Children.only(children);
493
+ const trigger = React3.isValidElement(child) ? React3.cloneElement(
494
+ child,
495
+ { "aria-describedby": open && visible ? id : void 0 }
496
+ ) : children;
497
+ const tooltipNode = open ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
498
+ "div",
499
+ {
500
+ ref: tooltipRef,
501
+ id,
502
+ role: "tooltip",
503
+ "aria-hidden": !visible,
504
+ style: { top: position.top, left: position.left },
505
+ className: cn(tooltipVariants({ visible, side }), className),
506
+ children: [
507
+ content,
508
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TooltipArrow, { side })
509
+ ]
510
+ }
511
+ ) : null;
512
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
513
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
514
+ "span",
515
+ {
516
+ ref: triggerRef,
517
+ className: "inline-flex",
518
+ onMouseEnter: show,
519
+ onMouseLeave: hide,
520
+ onFocus: show,
521
+ onBlur: hide,
522
+ children: trigger
523
+ }
524
+ ),
525
+ mounted && tooltipNode ? (0, import_react_dom.createPortal)(tooltipNode, document.body) : null
526
+ ] });
527
+ }
528
+ // Annotate the CommonJS export names for ESM import in node:
529
+ 0 && (module.exports = {
530
+ Progress,
531
+ Switch,
532
+ Tooltip
533
+ });
534
+ //# sourceMappingURL=index.js.map