@definable/ui 0.1.29 → 0.1.30
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/components/picker.d.ts +3 -1
- package/dist/components/picker.js +22 -21
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Drawer } from './drawer';
|
|
1
2
|
interface PickerOption<T extends string | number> {
|
|
2
3
|
label: string;
|
|
3
4
|
value: T;
|
|
@@ -11,10 +12,11 @@ interface PickerProps<T extends string | number> {
|
|
|
11
12
|
className?: string;
|
|
12
13
|
pickerClassName?: string;
|
|
13
14
|
description?: string;
|
|
15
|
+
drawerProps?: React.ComponentProps<typeof Drawer>;
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* A premium mobile picker that opens in a sheet.
|
|
17
19
|
* Features a high-quality wheel/drum selector.
|
|
18
20
|
*/
|
|
19
|
-
export declare function Picker<T extends string | number>({ label, options, value, onChange, trigger, className, pickerClassName, description, }: PickerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function Picker<T extends string | number>({ label, options, value, onChange, trigger, className, pickerClassName, description, drawerProps, }: PickerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
20
22
|
export {};
|
|
@@ -2,10 +2,10 @@ import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState as u } from "react";
|
|
3
3
|
import i from "react-mobile-picker";
|
|
4
4
|
import { cn as l } from "../lib/utils.js";
|
|
5
|
-
import { Button as
|
|
6
|
-
import { ChevronRight as
|
|
7
|
-
import { Drawer as
|
|
8
|
-
function
|
|
5
|
+
import { Button as D } from "./button.js";
|
|
6
|
+
import { ChevronRight as j } from "lucide-react";
|
|
7
|
+
import { Drawer as z, DrawerTrigger as O, DrawerContent as P, DrawerHeader as T, DrawerTitle as V, DrawerFooter as H } from "./drawer.js";
|
|
8
|
+
function E({
|
|
9
9
|
label: n,
|
|
10
10
|
options: d,
|
|
11
11
|
value: a,
|
|
@@ -13,17 +13,18 @@ function A({
|
|
|
13
13
|
trigger: f,
|
|
14
14
|
className: g,
|
|
15
15
|
pickerClassName: x,
|
|
16
|
-
description: s
|
|
16
|
+
description: s,
|
|
17
|
+
drawerProps: b
|
|
17
18
|
}) {
|
|
18
|
-
const [
|
|
19
|
+
const [v, c] = u(!1), [m, h] = u(a), N = (r) => {
|
|
19
20
|
r && h(a), c(r);
|
|
20
|
-
}, o = d.find((r) => r.value === a),
|
|
21
|
+
}, o = d.find((r) => r.value === a), w = { column: m }, k = (r) => {
|
|
21
22
|
h(r.column);
|
|
22
|
-
},
|
|
23
|
+
}, y = () => {
|
|
23
24
|
p(m), c(!1);
|
|
24
25
|
};
|
|
25
|
-
return /* @__PURE__ */ t(
|
|
26
|
-
/* @__PURE__ */ e(
|
|
26
|
+
return /* @__PURE__ */ t(z, { open: v, onOpenChange: N, ...b, children: [
|
|
27
|
+
/* @__PURE__ */ e(O, { asChild: !0, children: /* @__PURE__ */ e(
|
|
27
28
|
"div",
|
|
28
29
|
{
|
|
29
30
|
className: l("cursor-pointer select-none", g),
|
|
@@ -38,28 +39,28 @@ function A({
|
|
|
38
39
|
] })
|
|
39
40
|
] })
|
|
40
41
|
] }),
|
|
41
|
-
/* @__PURE__ */ e("div", { className: "w-7 min-w-[28px] h-7 rounded-full bg-muted/30 flex items-center justify-center group-hover:bg-muted/50 transition-colors", children: /* @__PURE__ */ e(
|
|
42
|
+
/* @__PURE__ */ e("div", { className: "w-7 min-w-[28px] h-7 rounded-full bg-muted/30 flex items-center justify-center group-hover:bg-muted/50 transition-colors", children: /* @__PURE__ */ e(j, { className: "w-4 h-4 text-muted-foreground/60" }) })
|
|
42
43
|
] })
|
|
43
44
|
}
|
|
44
45
|
) }),
|
|
45
|
-
/* @__PURE__ */ t(
|
|
46
|
-
/* @__PURE__ */ e(
|
|
46
|
+
/* @__PURE__ */ t(P, { children: [
|
|
47
|
+
/* @__PURE__ */ e(T, { children: /* @__PURE__ */ e(V, { children: n }) }),
|
|
47
48
|
/* @__PURE__ */ e("div", { className: "px-6 pt-0 space-y-5 pb-10", children: /* @__PURE__ */ t("div", { className: "relative h-[220px] bg-card/60 dark:bg-muted/10 rounded-[32px] overflow-hidden border border-border/10 shadow-sm", children: [
|
|
48
49
|
/* @__PURE__ */ e("div", { className: "absolute left-4 right-4 top-1/2 -translate-y-1/2 h-[56px] bg-primary/[0.04] dark:bg-primary/10 border-y border-primary/10 rounded-2xl pointer-events-none z-10" }),
|
|
49
50
|
/* @__PURE__ */ e(
|
|
50
51
|
i,
|
|
51
52
|
{
|
|
52
|
-
value:
|
|
53
|
-
onChange:
|
|
53
|
+
value: w,
|
|
54
|
+
onChange: k,
|
|
54
55
|
height: 220,
|
|
55
56
|
itemHeight: 56,
|
|
56
57
|
className: l(x),
|
|
57
|
-
children: /* @__PURE__ */ e(i.Column, { name: "column", children: d.map((r) => /* @__PURE__ */ e(i.Item, { value: r.value, children: ({ selected:
|
|
58
|
+
children: /* @__PURE__ */ e(i.Column, { name: "column", children: d.map((r) => /* @__PURE__ */ e(i.Item, { value: r.value, children: ({ selected: C }) => /* @__PURE__ */ e(
|
|
58
59
|
"div",
|
|
59
60
|
{
|
|
60
61
|
className: l(
|
|
61
62
|
"flex items-center justify-center h-full px-6 text-center transition-all duration-300 ease-out",
|
|
62
|
-
|
|
63
|
+
C ? "text-primary text-xl font-bold tracking-tight" : "text-muted-foreground/30 text-base font-medium scale-95"
|
|
63
64
|
),
|
|
64
65
|
children: r.label
|
|
65
66
|
}
|
|
@@ -69,10 +70,10 @@ function A({
|
|
|
69
70
|
/* @__PURE__ */ e("div", { className: "absolute top-0 left-0 right-0 h-20 bg-gradient-to-b from-card via-card/90 to-transparent pointer-events-none z-10 dark:from-[#121212] dark:via-[#121212]/95" }),
|
|
70
71
|
/* @__PURE__ */ e("div", { className: "absolute bottom-0 left-0 right-0 h-20 bg-gradient-to-t from-card via-card/90 to-transparent pointer-events-none z-10 dark:from-[#121212] dark:via-[#121212]/95" })
|
|
71
72
|
] }) }),
|
|
72
|
-
/* @__PURE__ */ e(
|
|
73
|
-
|
|
73
|
+
/* @__PURE__ */ e(H, { children: /* @__PURE__ */ t(
|
|
74
|
+
D,
|
|
74
75
|
{
|
|
75
|
-
onClick:
|
|
76
|
+
onClick: y,
|
|
76
77
|
className: "w-full h-12 rounded-2xl text-base font-bold shadow-lg shadow-primary/10 bg-primary text-primary-foreground hover:opacity-95 active:scale-[0.98] transition-all",
|
|
77
78
|
children: [
|
|
78
79
|
"Confirm ",
|
|
@@ -84,5 +85,5 @@ function A({
|
|
|
84
85
|
] });
|
|
85
86
|
}
|
|
86
87
|
export {
|
|
87
|
-
|
|
88
|
+
E as Picker
|
|
88
89
|
};
|