rockin 0.0.34 → 0.0.36
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.
- package/dist/chunk-3CZ2LLUN.js +198 -0
- package/dist/{chunk-7ZCRGTLA.js → chunk-54ZJAEO5.js} +5 -5
- package/dist/chunk-5GM3YR42.js +228 -0
- package/dist/chunk-6XUTSMTJ.js +183 -0
- package/dist/chunk-7JJBATB2.js +35 -0
- package/dist/chunk-BITCJZQZ.js +31 -0
- package/dist/chunk-COPQJFDI.js +158 -0
- package/dist/chunk-D6TULSM6.js +785 -0
- package/dist/chunk-DVNTJNDP.js +55 -0
- package/dist/chunk-EKDBYSMI.js +87 -0
- package/dist/chunk-FGWWRPMR.js +71 -0
- package/dist/chunk-G233W3IR.js +17 -0
- package/dist/chunk-G4NDAZTB.js +13 -0
- package/dist/chunk-GY2BX5SK.js +26 -0
- package/dist/chunk-MZBLIA6C.js +20 -0
- package/dist/chunk-OSVLAX37.js +101 -0
- package/dist/chunk-PRGKTXJU.js +20 -0
- package/dist/chunk-RUKQ532H.js +253 -0
- package/dist/chunk-S4H2HENE.js +113 -0
- package/dist/chunk-UHZTEDHK.js +61 -0
- package/dist/chunk-VFDNWPOI.js +293 -0
- package/dist/chunk-W4EIJWHF.js +150 -0
- package/dist/hooks/index.js +18 -9
- package/dist/index.js +4 -4
- package/dist/provider.js +3 -3
- package/dist/styles.css +2 -2
- package/dist/ui/accordion.js +95 -0
- package/dist/ui/alert-dialog.js +178 -0
- package/dist/ui/apple/english.js +7 -0
- package/dist/ui/apple/hindi.js +7 -0
- package/dist/ui/apple/index.js +52 -0
- package/dist/ui/apple/spanish.js +7 -0
- package/dist/ui/ariakit.js +7 -0
- package/dist/ui/autocomplete.js +296 -0
- package/dist/ui/avatar.js +106 -0
- package/dist/ui/badge.js +50 -0
- package/dist/ui/bridge.js +109 -0
- package/dist/ui/bubble.js +118 -0
- package/dist/ui/button-group.js +14 -0
- package/dist/ui/button.js +9 -0
- package/dist/ui/card.js +102 -0
- package/dist/ui/carousel.js +205 -0
- package/dist/ui/chart.js +253 -0
- package/dist/ui/checkbox.js +34 -0
- package/dist/ui/code-block.js +128 -0
- package/dist/ui/combobox.js +41 -0
- package/dist/ui/command.js +199 -0
- package/dist/ui/dashed.js +57 -0
- package/dist/ui/data-table/index.js +233 -0
- package/dist/ui/dialog.js +26 -0
- package/dist/ui/dock.js +86 -0
- package/dist/ui/drawer.js +216 -0
- package/dist/ui/dropdown-menu.js +35 -0
- package/dist/ui/empty.js +17 -0
- package/dist/ui/farmer/div.js +38 -0
- package/dist/ui/farmer/variants.js +314 -0
- package/dist/ui/field.js +224 -0
- package/dist/ui/filters.js +1524 -0
- package/dist/ui/image.js +88 -0
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +57 -8502
- package/dist/ui/input-group.js +20 -0
- package/dist/ui/input-otp.js +83 -0
- package/dist/ui/input.js +7 -0
- package/dist/ui/item.js +200 -0
- package/dist/ui/jelly.js +30 -0
- package/dist/ui/kbd.js +9 -0
- package/dist/ui/label.js +7 -0
- package/dist/ui/message-scroller.js +122 -0
- package/dist/ui/message.js +93 -0
- package/dist/ui/numberstepper.js +416 -0
- package/dist/ui/otp.js +403 -0
- package/dist/ui/popover.js +83 -0
- package/dist/ui/qr-code.js +124 -0
- package/dist/ui/quantity.js +48 -0
- package/dist/ui/radio-group.js +42 -0
- package/dist/ui/resizable.js +52 -0
- package/dist/ui/scroll-area.js +9 -0
- package/dist/ui/select.js +194 -0
- package/dist/ui/separator.js +7 -0
- package/dist/ui/skeleton.js +25 -0
- package/dist/ui/sonner.js +22 -0
- package/dist/ui/sortable.js +503 -0
- package/dist/ui/swipe-actions.js +45 -0
- package/dist/ui/switch.js +34 -0
- package/dist/ui/textarea.js +7 -0
- package/dist/ui/theme-toggle.js +141 -0
- package/dist/ui/tooltip.js +13 -0
- package/package.json +1 -1
- package/dist/chunk-4KFB6AJH.js +0 -1330
- /package/dist/{chunk-FYFBWCMJ.js → chunk-GBVAFFZR.js} +0 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
buttonVariants
|
|
4
|
+
} from "../chunk-DVNTJNDP.js";
|
|
5
|
+
|
|
6
|
+
// src/ui/theme-toggle.tsx
|
|
7
|
+
import { cn } from "cn";
|
|
8
|
+
import { motion, useReducedMotion } from "motion/react";
|
|
9
|
+
import { useTheme } from "next-themes";
|
|
10
|
+
import { useId } from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
var MORPH = { type: "spring", visualDuration: 0.4, bounce: 0 };
|
|
13
|
+
var RAY_STAGGER = 0.018;
|
|
14
|
+
var EASE_OUT = [0.23, 1, 0.32, 1];
|
|
15
|
+
var SUN_R = 4.5;
|
|
16
|
+
var MOON_R = 8;
|
|
17
|
+
var RAY_OUT = { inner: 7.5, outer: 10 };
|
|
18
|
+
var RAY_IN = { inner: 3.5, outer: 5 };
|
|
19
|
+
var BITE_R = 7.5;
|
|
20
|
+
var biteAt = (d) => ({
|
|
21
|
+
cx: 12 + d * Math.cos(-5 * Math.PI / 180),
|
|
22
|
+
cy: 12 + d * Math.sin(-5 * Math.PI / 180)
|
|
23
|
+
});
|
|
24
|
+
var BITE_OUT = biteAt(20);
|
|
25
|
+
var BITE_IN = biteAt(7.5);
|
|
26
|
+
var MOON_TILT = -40;
|
|
27
|
+
var RAYS = Array.from({ length: 8 }, (_, i) => {
|
|
28
|
+
const a = i * Math.PI / 4;
|
|
29
|
+
return { cos: Math.cos(a), sin: Math.sin(a) };
|
|
30
|
+
});
|
|
31
|
+
function ThemeToggle({
|
|
32
|
+
size = "default",
|
|
33
|
+
variant,
|
|
34
|
+
className
|
|
35
|
+
}) {
|
|
36
|
+
const { theme, resolvedTheme, setTheme } = useTheme();
|
|
37
|
+
const reduceMotion = useReducedMotion();
|
|
38
|
+
const dark = (resolvedTheme ?? theme) === "dark";
|
|
39
|
+
const activeVariant = variant ?? "ghost";
|
|
40
|
+
const maskId = `moon-${useId().replace(/[^\w-]/g, "")}`;
|
|
41
|
+
const morph = reduceMotion ? { duration: 0 } : MORPH;
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
"button",
|
|
44
|
+
{
|
|
45
|
+
type: "button",
|
|
46
|
+
"aria-label": "Toggle theme",
|
|
47
|
+
"aria-pressed": dark,
|
|
48
|
+
onClick: () => setTheme(dark ? "light" : "dark"),
|
|
49
|
+
className: cn(
|
|
50
|
+
buttonVariants({ variant: activeVariant }),
|
|
51
|
+
"shadow-raised relative touch-manipulation rounded-full outline-hidden select-none",
|
|
52
|
+
"transition-[scale,background-color] duration-150 ease-out active:scale-[0.96] motion-reduce:transition-[background-color]",
|
|
53
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground focus-visible:outline-solid",
|
|
54
|
+
size === "xs" && "size-6",
|
|
55
|
+
size === "sm" && "size-7",
|
|
56
|
+
size === "default" && "size-8",
|
|
57
|
+
size === "lg" && "size-9",
|
|
58
|
+
className
|
|
59
|
+
),
|
|
60
|
+
children: /* @__PURE__ */ jsxs(
|
|
61
|
+
motion.svg,
|
|
62
|
+
{
|
|
63
|
+
"aria-hidden": true,
|
|
64
|
+
viewBox: "0 0 24 24",
|
|
65
|
+
className: size === "xs" ? "size-3" : size === "sm" ? "size-3.5" : size === "lg" ? "size-5" : "size-4",
|
|
66
|
+
initial: false,
|
|
67
|
+
animate: { rotate: dark ? MOON_TILT : 0 },
|
|
68
|
+
transition: morph,
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
71
|
+
"mask",
|
|
72
|
+
{
|
|
73
|
+
id: maskId,
|
|
74
|
+
maskUnits: "userSpaceOnUse",
|
|
75
|
+
x: "0",
|
|
76
|
+
y: "0",
|
|
77
|
+
width: "24",
|
|
78
|
+
height: "24",
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ jsx("rect", { width: "24", height: "24", fill: "white" }),
|
|
81
|
+
/* @__PURE__ */ jsx(
|
|
82
|
+
motion.circle,
|
|
83
|
+
{
|
|
84
|
+
r: BITE_R,
|
|
85
|
+
fill: "black",
|
|
86
|
+
initial: false,
|
|
87
|
+
animate: dark ? BITE_IN : BITE_OUT,
|
|
88
|
+
transition: morph
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
) }),
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
motion.circle,
|
|
96
|
+
{
|
|
97
|
+
cx: "12",
|
|
98
|
+
cy: "12",
|
|
99
|
+
fill: "currentColor",
|
|
100
|
+
mask: `url(#${maskId})`,
|
|
101
|
+
initial: false,
|
|
102
|
+
animate: { r: dark ? MOON_R : SUN_R },
|
|
103
|
+
transition: morph
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
/* @__PURE__ */ jsx("g", { stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", children: RAYS.map((ray, i) => {
|
|
107
|
+
const { inner, outer } = dark ? RAY_IN : RAY_OUT;
|
|
108
|
+
const delay = reduceMotion ? 0 : dark ? i * RAY_STAGGER : 0.06 + (RAYS.length - 1 - i) * RAY_STAGGER;
|
|
109
|
+
return /* @__PURE__ */ jsx(
|
|
110
|
+
motion.line,
|
|
111
|
+
{
|
|
112
|
+
initial: false,
|
|
113
|
+
animate: {
|
|
114
|
+
x1: 12 + ray.cos * inner,
|
|
115
|
+
y1: 12 + ray.sin * inner,
|
|
116
|
+
x2: 12 + ray.cos * outer,
|
|
117
|
+
y2: 12 + ray.sin * outer,
|
|
118
|
+
opacity: dark ? 0 : 1
|
|
119
|
+
},
|
|
120
|
+
transition: {
|
|
121
|
+
...morph,
|
|
122
|
+
delay,
|
|
123
|
+
opacity: {
|
|
124
|
+
duration: dark ? 0.12 : 0.18,
|
|
125
|
+
ease: EASE_OUT,
|
|
126
|
+
delay
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
i
|
|
131
|
+
);
|
|
132
|
+
}) })
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
export {
|
|
140
|
+
ThemeToggle
|
|
141
|
+
};
|