@etic-insa/ui 0.3.0 → 0.4.1
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/README.md +128 -78
- package/dist/components/etic/app-shell.d.ts +4 -1
- package/dist/components/etic/app-shell.js +150 -113
- package/dist/components/etic/app-shell.js.map +1 -1
- package/dist/components/etic/data-table-bulk-actions.d.ts +14 -2
- package/dist/components/etic/data-table-bulk-actions.js +100 -53
- package/dist/components/etic/data-table-bulk-actions.js.map +1 -1
- package/dist/components/etic/data-table-focus.d.ts +1 -1
- package/dist/components/etic/data-table-focus.js.map +1 -1
- package/dist/components/etic/data-table.d.ts +12 -4
- package/dist/components/etic/data-table.js +199 -223
- package/dist/components/etic/data-table.js.map +1 -1
- package/dist/components/etic/delete-button.d.ts +2 -2
- package/dist/components/etic/delete-button.js.map +1 -1
- package/dist/components/etic/detail-list.d.ts +3 -1
- package/dist/components/etic/detail-list.js +1 -1
- package/dist/components/etic/detail-list.js.map +1 -1
- package/dist/components/etic/disclosure.js +1 -0
- package/dist/components/etic/disclosure.js.map +1 -1
- package/dist/components/etic/icon-toggle.js +1 -1
- package/dist/components/etic/icon-toggle.js.map +1 -1
- package/dist/components/etic/page-header.d.ts +12 -4
- package/dist/components/etic/page-header.js +27 -16
- package/dist/components/etic/page-header.js.map +1 -1
- package/dist/components/etic/phone-input.js +1 -1
- package/dist/components/etic/phone-input.js.map +1 -1
- package/dist/components/etic/removable-badge.js +26 -18
- package/dist/components/etic/removable-badge.js.map +1 -1
- package/dist/components/etic/save-bar.d.ts +4 -3
- package/dist/components/etic/save-bar.js +2 -2
- package/dist/components/etic/save-bar.js.map +1 -1
- package/dist/components/etic/stat-tile.d.ts +9 -2
- package/dist/components/etic/stat-tile.js +32 -18
- package/dist/components/etic/stat-tile.js.map +1 -1
- package/dist/components/etic/theme-menu.d.ts +28 -0
- package/dist/components/etic/theme-menu.js +62 -35
- package/dist/components/etic/theme-menu.js.map +1 -1
- package/dist/components/etic/toggletip.js +3 -3
- package/dist/components/etic/toggletip.js.map +1 -1
- package/dist/components/etic/tooltip-button.d.ts +7 -3
- package/dist/components/etic/tooltip-button.js +2 -2
- package/dist/components/etic/tooltip-button.js.map +1 -1
- package/dist/components/ui/button.js +2 -2
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.js +119 -81
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +2 -2
- package/dist/components/ui/dropdown-menu.js +102 -68
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/select.js +3 -3
- package/dist/components/ui/select.js.map +1 -1
- package/dist/styles.css +107 -73
- package/package.json +1 -1
|
@@ -1,96 +1,134 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Button as e, buttonVariants as t } from "./button.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { Select as n, SelectContent as r, SelectItem as i, SelectTrigger as a, SelectValue as o } from "./select.js";
|
|
4
|
+
import { cn as s } from "cn";
|
|
5
|
+
import * as c from "react";
|
|
6
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
+
import { ChevronDownIcon as d, ChevronLeftIcon as f, ChevronRightIcon as p } from "lucide-react";
|
|
8
|
+
import { DayPicker as m, getDefaultClassNames as h } from "react-day-picker";
|
|
9
|
+
import { fr as g } from "react-day-picker/locale/fr";
|
|
9
10
|
// src/components/ui/calendar.tsx
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
function _({ options: e = [], value: t, onChange: s, disabled: c, "aria-label": d }) {
|
|
12
|
+
let f = e.map(({ value: e, label: t }) => ({
|
|
13
|
+
value: e,
|
|
14
|
+
label: t
|
|
15
|
+
}));
|
|
16
|
+
return /* @__PURE__ */ u(n, {
|
|
17
|
+
items: f,
|
|
18
|
+
value: Number(t),
|
|
19
|
+
disabled: c,
|
|
20
|
+
onValueChange: (e) => {
|
|
21
|
+
e !== null && s?.({ target: { value: String(e) } });
|
|
22
|
+
},
|
|
23
|
+
children: [/* @__PURE__ */ l(a, {
|
|
24
|
+
size: "sm",
|
|
25
|
+
"aria-label": d,
|
|
26
|
+
className: "relative z-10 gap-1 border-none bg-transparent px-1.5 font-medium shadow-none hover:bg-muted data-[size=sm]:h-(--cell-size) dark:bg-transparent dark:hover:bg-muted [&_svg]:size-3.5",
|
|
27
|
+
children: /* @__PURE__ */ l(o, {})
|
|
28
|
+
}), /* @__PURE__ */ l(r, {
|
|
29
|
+
className: "max-h-[min(22rem,var(--available-height))] min-w-0",
|
|
30
|
+
children: e.map((e) => /* @__PURE__ */ l(i, {
|
|
31
|
+
value: e.value,
|
|
32
|
+
disabled: e.disabled,
|
|
33
|
+
children: e.label
|
|
34
|
+
}, e.value))
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function v({ className: e, rootRef: t, ...n }) {
|
|
39
|
+
return /* @__PURE__ */ l("div", {
|
|
40
|
+
"data-slot": "calendar",
|
|
41
|
+
ref: t,
|
|
42
|
+
className: s(e),
|
|
43
|
+
...n
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function y({ className: e, orientation: t, ...n }) {
|
|
47
|
+
return l(t === "left" ? f : t === "right" ? p : d, {
|
|
48
|
+
className: s("size-4", e),
|
|
49
|
+
...n
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function b({ children: e, ...t }) {
|
|
53
|
+
return /* @__PURE__ */ l("td", {
|
|
54
|
+
...t,
|
|
55
|
+
children: /* @__PURE__ */ l("div", {
|
|
56
|
+
className: "flex size-(--cell-size) items-center justify-center text-center",
|
|
57
|
+
children: e
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function x({ className: e, classNames: n, showOutsideDays: r = !0, captionLayout: i = "label", buttonVariant: a = "ghost", locale: o = g, weekStartsOn: u = 1, formatters: d, components: f, ...p }) {
|
|
62
|
+
let x = h(), C = c.useMemo(() => ({
|
|
63
|
+
Root: v,
|
|
64
|
+
Chevron: y,
|
|
65
|
+
DayButton: (e) => /* @__PURE__ */ l(S, {
|
|
66
|
+
locale: o,
|
|
67
|
+
...e
|
|
68
|
+
}),
|
|
69
|
+
Dropdown: _,
|
|
70
|
+
WeekNumber: b,
|
|
71
|
+
...f
|
|
72
|
+
}), [o, f]);
|
|
73
|
+
return /* @__PURE__ */ l(m, {
|
|
74
|
+
showOutsideDays: r,
|
|
75
|
+
className: s("group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(9)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent min-[1025px]:[--cell-size:--spacing(7)]", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, e),
|
|
76
|
+
captionLayout: i,
|
|
77
|
+
locale: o,
|
|
78
|
+
weekStartsOn: u,
|
|
18
79
|
formatters: {
|
|
19
|
-
formatMonthDropdown: (e) => e.toLocaleString(
|
|
20
|
-
...
|
|
80
|
+
formatMonthDropdown: (e) => e.toLocaleString(o?.code, { month: "short" }),
|
|
81
|
+
...d
|
|
21
82
|
},
|
|
22
83
|
classNames: {
|
|
23
|
-
root:
|
|
24
|
-
months:
|
|
25
|
-
month:
|
|
26
|
-
nav:
|
|
27
|
-
button_previous:
|
|
28
|
-
button_next:
|
|
29
|
-
month_caption:
|
|
30
|
-
dropdowns:
|
|
31
|
-
dropdown_root:
|
|
32
|
-
dropdown:
|
|
33
|
-
caption_label:
|
|
34
|
-
month_grid:
|
|
35
|
-
weekdays:
|
|
36
|
-
weekday:
|
|
37
|
-
week:
|
|
38
|
-
week_number_header:
|
|
39
|
-
week_number:
|
|
40
|
-
day:
|
|
41
|
-
range_start:
|
|
42
|
-
range_middle:
|
|
43
|
-
range_end:
|
|
44
|
-
today:
|
|
45
|
-
outside:
|
|
46
|
-
disabled:
|
|
47
|
-
hidden:
|
|
48
|
-
...
|
|
49
|
-
},
|
|
50
|
-
components: {
|
|
51
|
-
Root: ({ className: e, rootRef: t, ...r }) => /* @__PURE__ */ i("div", {
|
|
52
|
-
"data-slot": "calendar",
|
|
53
|
-
ref: t,
|
|
54
|
-
className: n(e),
|
|
55
|
-
...r
|
|
56
|
-
}),
|
|
57
|
-
Chevron: ({ className: e, orientation: t, ...r }) => i(t === "left" ? o : t === "right" ? s : a, {
|
|
58
|
-
className: n("size-4", e),
|
|
59
|
-
...r
|
|
60
|
-
}),
|
|
61
|
-
DayButton: ({ ...e }) => /* @__PURE__ */ i(f, {
|
|
62
|
-
locale: h,
|
|
63
|
-
...e
|
|
64
|
-
}),
|
|
65
|
-
WeekNumber: ({ children: e, ...t }) => /* @__PURE__ */ i("td", {
|
|
66
|
-
...t,
|
|
67
|
-
children: /* @__PURE__ */ i("div", {
|
|
68
|
-
className: "flex size-(--cell-size) items-center justify-center text-center",
|
|
69
|
-
children: e
|
|
70
|
-
})
|
|
71
|
-
}),
|
|
72
|
-
...v
|
|
84
|
+
root: s("w-fit", x.root),
|
|
85
|
+
months: s("relative flex flex-col gap-4 md:flex-row", x.months),
|
|
86
|
+
month: s("flex w-full flex-col gap-4", x.month),
|
|
87
|
+
nav: s("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", x.nav),
|
|
88
|
+
button_previous: s(t({ variant: a }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", x.button_previous),
|
|
89
|
+
button_next: s(t({ variant: a }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", x.button_next),
|
|
90
|
+
month_caption: s("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", x.month_caption),
|
|
91
|
+
dropdowns: s("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", x.dropdowns),
|
|
92
|
+
dropdown_root: s("relative rounded-(--cell-radius)", x.dropdown_root),
|
|
93
|
+
dropdown: s("absolute inset-0 bg-popover opacity-0", x.dropdown),
|
|
94
|
+
caption_label: s("font-medium select-none", i === "label" ? "text-sm" : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground", x.caption_label),
|
|
95
|
+
month_grid: s("w-full border-collapse", x.month_grid),
|
|
96
|
+
weekdays: s("flex", x.weekdays),
|
|
97
|
+
weekday: s("flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none", x.weekday),
|
|
98
|
+
week: s("mt-2 flex w-full", x.week),
|
|
99
|
+
week_number_header: s("w-(--cell-size) select-none", x.week_number_header),
|
|
100
|
+
week_number: s("text-[0.8rem] text-muted-foreground select-none", x.week_number),
|
|
101
|
+
day: s("group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)", p.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)", x.day),
|
|
102
|
+
range_start: s("relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted", x.range_start),
|
|
103
|
+
range_middle: s("rounded-none", x.range_middle),
|
|
104
|
+
range_end: s("relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted", x.range_end),
|
|
105
|
+
today: s("rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none", x.today),
|
|
106
|
+
outside: s("text-muted-foreground aria-selected:text-muted-foreground", x.outside),
|
|
107
|
+
disabled: s("text-muted-foreground opacity-50", x.disabled),
|
|
108
|
+
hidden: s("invisible", x.hidden),
|
|
109
|
+
...n
|
|
73
110
|
},
|
|
74
|
-
|
|
111
|
+
components: C,
|
|
112
|
+
...p
|
|
75
113
|
});
|
|
76
114
|
}
|
|
77
|
-
function
|
|
78
|
-
let
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
}, [
|
|
82
|
-
ref:
|
|
115
|
+
function S({ className: t, day: n, modifiers: r, locale: i, ...a }) {
|
|
116
|
+
let o = h(), u = c.useRef(null);
|
|
117
|
+
return c.useEffect(() => {
|
|
118
|
+
r.focused && u.current?.focus();
|
|
119
|
+
}, [r.focused]), /* @__PURE__ */ l(e, {
|
|
120
|
+
ref: u,
|
|
83
121
|
variant: "ghost",
|
|
84
122
|
size: "icon",
|
|
85
|
-
"data-day":
|
|
86
|
-
"data-selected-single":
|
|
87
|
-
"data-range-start":
|
|
88
|
-
"data-range-end":
|
|
89
|
-
"data-range-middle":
|
|
90
|
-
className:
|
|
91
|
-
...
|
|
123
|
+
"data-day": n.date.toLocaleDateString(i?.code),
|
|
124
|
+
"data-selected-single": r.selected && !r.range_start && !r.range_end && !r.range_middle,
|
|
125
|
+
"data-range-start": r.range_start,
|
|
126
|
+
"data-range-end": r.range_end,
|
|
127
|
+
"data-range-middle": r.range_middle,
|
|
128
|
+
className: s("relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70", o.day, t),
|
|
129
|
+
...a
|
|
92
130
|
});
|
|
93
131
|
}
|
|
94
|
-
export {
|
|
132
|
+
export { x as Calendar, S as CalendarDayButton };
|
|
95
133
|
|
|
96
134
|
//# sourceMappingURL=calendar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","names":["React","Calendar","fr","props","defaultClassNames","getDefaultClassNames","DayPicker","cn","className","date","locale","formatters","buttonVariants","buttonVariant","captionLayout","classNames","rootRef","jsx","orientation","ChevronLeftIcon","ChevronRightIcon","ChevronDownIcon","CalendarDayButton","components","ref","modifiers","Button","day"],"sources":["../../../src/components/ui/calendar.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"cn\"\nimport {\n DayPicker,\n getDefaultClassNames,\n type DayButton,\n type Locale,\n} from \"react-day-picker\"\n// La seule locale française : `react-day-picker/locale` les charge toutes.\nimport { fr } from \"react-day-picker/locale/fr\"\n\nimport { Button, buttonVariants } from \"@etic-ui/components/ui/button\"\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n ChevronDownIcon,\n} from \"lucide-react\"\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"label\",\n buttonVariant = \"ghost\",\n locale = fr,\n weekStartsOn = 1,\n formatters,\n components,\n ...props\n}: React.ComponentProps<typeof DayPicker> & {\n buttonVariant?: React.ComponentProps<typeof Button>[\"variant\"]\n}) {\n const defaultClassNames = getDefaultClassNames()\n\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\n \"group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(9)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent min-[1025px]:[--cell-size:--spacing(7)]\",\n String.raw`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,\n String.raw`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,\n className\n )}\n captionLayout={captionLayout}\n locale={locale}\n weekStartsOn={weekStartsOn}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(locale?.code, { month: \"short\" }),\n ...formatters,\n }}\n classNames={{\n root: cn(\"w-fit\", defaultClassNames.root),\n months: cn(\n \"relative flex flex-col gap-4 md:flex-row\",\n defaultClassNames.months\n ),\n month: cn(\"flex w-full flex-col gap-4\", defaultClassNames.month),\n nav: cn(\n \"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1\",\n defaultClassNames.nav\n ),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant }),\n \"size-(--cell-size) p-0 select-none aria-disabled:opacity-50\",\n defaultClassNames.button_previous\n ),\n button_next: cn(\n buttonVariants({ variant: buttonVariant }),\n \"size-(--cell-size) p-0 select-none aria-disabled:opacity-50\",\n defaultClassNames.button_next\n ),\n month_caption: cn(\n \"flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)\",\n defaultClassNames.month_caption\n ),\n dropdowns: cn(\n \"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium\",\n defaultClassNames.dropdowns\n ),\n dropdown_root: cn(\n \"relative rounded-(--cell-radius)\",\n defaultClassNames.dropdown_root\n ),\n dropdown: cn(\n \"absolute inset-0 bg-popover opacity-0\",\n defaultClassNames.dropdown\n ),\n caption_label: cn(\n \"font-medium select-none\",\n captionLayout === \"label\"\n ? \"text-sm\"\n : \"flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground\",\n defaultClassNames.caption_label\n ),\n month_grid: cn(\"w-full border-collapse\", defaultClassNames.month_grid),\n weekdays: cn(\"flex\", defaultClassNames.weekdays),\n weekday: cn(\n \"flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none\",\n defaultClassNames.weekday\n ),\n week: cn(\"mt-2 flex w-full\", defaultClassNames.week),\n week_number_header: cn(\n \"w-(--cell-size) select-none\",\n defaultClassNames.week_number_header\n ),\n week_number: cn(\n \"text-[0.8rem] text-muted-foreground select-none\",\n defaultClassNames.week_number\n ),\n day: cn(\n \"group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)\",\n props.showWeekNumber\n ? \"[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)\"\n : \"[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)\",\n defaultClassNames.day\n ),\n range_start: cn(\n \"relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted\",\n defaultClassNames.range_start\n ),\n range_middle: cn(\"rounded-none\", defaultClassNames.range_middle),\n range_end: cn(\n \"relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted\",\n defaultClassNames.range_end\n ),\n today: cn(\n \"rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none\",\n defaultClassNames.today\n ),\n outside: cn(\n \"text-muted-foreground aria-selected:text-muted-foreground\",\n defaultClassNames.outside\n ),\n disabled: cn(\n \"text-muted-foreground opacity-50\",\n defaultClassNames.disabled\n ),\n hidden: cn(\"invisible\", defaultClassNames.hidden),\n ...classNames,\n }}\n components={{\n Root: ({ className, rootRef, ...props }) => {\n return (\n <div\n data-slot=\"calendar\"\n ref={rootRef}\n className={cn(className)}\n {...props}\n />\n )\n },\n Chevron: ({ className, orientation, ...props }) => {\n if (orientation === \"left\") {\n return (\n <ChevronLeftIcon className={cn(\"size-4\", className)} {...props} />\n )\n }\n\n if (orientation === \"right\") {\n return (\n <ChevronRightIcon\n className={cn(\"size-4\", className)}\n {...props}\n />\n )\n }\n\n return (\n <ChevronDownIcon className={cn(\"size-4\", className)} {...props} />\n )\n },\n DayButton: ({ ...props }) => (\n <CalendarDayButton locale={locale} {...props} />\n ),\n WeekNumber: ({ children, ...props }) => {\n return (\n <td {...props}>\n <div className=\"flex size-(--cell-size) items-center justify-center text-center\">\n {children}\n </div>\n </td>\n )\n },\n ...components,\n }}\n {...props}\n />\n )\n}\n\nfunction CalendarDayButton({\n className,\n day,\n modifiers,\n locale,\n ...props\n}: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {\n const defaultClassNames = getDefaultClassNames()\n\n const ref = React.useRef<HTMLButtonElement>(null)\n React.useEffect(() => {\n if (modifiers.focused) ref.current?.focus()\n }, [modifiers.focused])\n\n return (\n <Button\n ref={ref}\n variant=\"ghost\"\n size=\"icon\"\n data-day={day.date.toLocaleDateString(locale?.code)}\n data-selected-single={\n modifiers.selected &&\n !modifiers.range_start &&\n !modifiers.range_end &&\n !modifiers.range_middle\n }\n data-range-start={modifiers.range_start}\n data-range-end={modifiers.range_end}\n data-range-middle={modifiers.range_middle}\n className={cn(\n \"relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70\",\n defaultClassNames.day,\n className\n )}\n {...props}\n />\n )\n}\n\nexport { Calendar, CalendarDayButton }\n"],"mappings":";;;;;;;;;AAoBA,SAASC,EAAS,EAChB,cACA,eACA,qBAAkB,IAClB,mBAAgB,SAChB,mBAAgB,SAChB,YAASC,GACT,kBAAe,GACf,eACA,eACA,GAAGC,KAGF;CACD,IAAMC,IAAoBC,EAAqB;CAE/C,OACE,kBAACC,GA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CalendarDropdown","ariaLabel","items","options","Select","value","choisie","onChange","SelectTrigger","SelectValue","SelectContent","SelectItem","option","CalendarRoot","props","rootRef","cn","className","CalendarChevron","jsx","orientation","ChevronLeftIcon","ChevronRightIcon","ChevronDownIcon","CalendarWeekNumber","Calendar","fr","defaultClassNames","getDefaultClassNames","composants","CalendarDayButton","components","locale","DayPicker","date","formatters","buttonVariants","buttonVariant","captionLayout","classNames","ref","modifiers","Button","day"],"sources":["../../../src/components/ui/calendar.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"cn\"\nimport {\n DayPicker,\n getDefaultClassNames,\n type CustomComponents,\n type DayButton,\n type DropdownProps,\n type Locale,\n} from \"react-day-picker\"\n// La seule locale française : `react-day-picker/locale` les charge toutes.\nimport { fr } from \"react-day-picker/locale/fr\"\n\nimport { Button, buttonVariants } from \"@etic-ui/components/ui/button\"\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@etic-ui/components/ui/select\"\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n ChevronDownIcon,\n} from \"lucide-react\"\n\n/**\n * Liste du mois ou de l'année (`captionLayout=\"dropdown\"`). Écart avec\n * shadcn : son `<select>` natif, transparent sur un libellé, ouvrait la liste\n * du système, sans le style de la bibliothèque. Ici, le `Select` de la\n * bibliothèque, à l'allure du libellé (sans bordure ni fond). react-day-picker\n * attend un `onChange` de `<select>` : il ne lit que `event.target.value`.\n */\nfunction CalendarDropdown({\n options = [],\n value,\n onChange,\n disabled,\n \"aria-label\": ariaLabel,\n}: DropdownProps) {\n const items = options.map(({ value, label }) => ({ value, label }))\n return (\n <Select\n items={items}\n value={Number(value)}\n disabled={disabled}\n onValueChange={(choisie) => {\n if (choisie === null) return\n onChange?.({\n target: { value: String(choisie) },\n } as React.ChangeEvent<HTMLSelectElement>)\n }}\n >\n <SelectTrigger\n size=\"sm\"\n aria-label={ariaLabel}\n // relative z-10 : au-dessus de la barre des flèches, posée en absolu\n // sur toute la largeur, qui prenait les clics. Hauteur des flèches\n // (--cell-size) : cible tactile de 36 px sur mobile.\n className=\"relative z-10 gap-1 border-none bg-transparent px-1.5 font-medium shadow-none hover:bg-muted data-[size=sm]:h-(--cell-size) dark:bg-transparent dark:hover:bg-muted [&_svg]:size-3.5\"\n >\n <SelectValue />\n </SelectTrigger>\n {/* Les douze mois tiennent sans défiler ; une liste d'années, qui peut\n compter un siècle, défile. */}\n <SelectContent className=\"max-h-[min(22rem,var(--available-height))] min-w-0\">\n {options.map((option) => (\n <SelectItem\n key={option.value}\n value={option.value}\n disabled={option.disabled}\n >\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )\n}\n\nfunction CalendarRoot({\n className,\n rootRef,\n ...props\n}: CustomComponents[\"Root\"] extends React.ComponentType<infer P> ? P : never) {\n return (\n <div\n data-slot=\"calendar\"\n ref={rootRef}\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction CalendarChevron({\n className,\n orientation,\n ...props\n}: CustomComponents[\"Chevron\"] extends React.ComponentType<infer P>\n ? P\n : never) {\n if (orientation === \"left\") {\n return <ChevronLeftIcon className={cn(\"size-4\", className)} {...props} />\n }\n\n if (orientation === \"right\") {\n return <ChevronRightIcon className={cn(\"size-4\", className)} {...props} />\n }\n\n return <ChevronDownIcon className={cn(\"size-4\", className)} {...props} />\n}\n\nfunction CalendarWeekNumber({\n children,\n ...props\n}: CustomComponents[\"WeekNumber\"] extends React.ComponentType<infer P>\n ? P\n : never) {\n return (\n <td {...props}>\n <div className=\"flex size-(--cell-size) items-center justify-center text-center\">\n {children}\n </div>\n </td>\n )\n}\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"label\",\n buttonVariant = \"ghost\",\n locale = fr,\n weekStartsOn = 1,\n formatters,\n components,\n ...props\n}: React.ComponentProps<typeof DayPicker> & {\n buttonVariant?: React.ComponentProps<typeof Button>[\"variant\"]\n}) {\n const defaultClassNames = getDefaultClassNames()\n // Écart avec shadcn, qui les écrit en ligne : des composants recréés à\n // chaque rendu sont, pour React, d'un type nouveau, et tout le calendrier\n // était remonté quand le parent le redessinait (mois piloté par `month`,\n // comme dans DatePicker) : le focus d'une liste du mois ou de l'année se\n // perdait. Ils ne changent qu'avec la locale ou `components`.\n const composants = React.useMemo(\n () => ({\n Root: CalendarRoot,\n Chevron: CalendarChevron,\n DayButton: (props: React.ComponentProps<typeof DayButton>) => (\n <CalendarDayButton locale={locale} {...props} />\n ),\n Dropdown: CalendarDropdown,\n WeekNumber: CalendarWeekNumber,\n ...components,\n }),\n [locale, components]\n )\n\n return (\n <DayPicker\n showOutsideDays={showOutsideDays}\n className={cn(\n \"group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(9)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent min-[1025px]:[--cell-size:--spacing(7)]\",\n String.raw`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,\n String.raw`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,\n className\n )}\n captionLayout={captionLayout}\n locale={locale}\n weekStartsOn={weekStartsOn}\n formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(locale?.code, { month: \"short\" }),\n ...formatters,\n }}\n classNames={{\n root: cn(\"w-fit\", defaultClassNames.root),\n months: cn(\n \"relative flex flex-col gap-4 md:flex-row\",\n defaultClassNames.months\n ),\n month: cn(\"flex w-full flex-col gap-4\", defaultClassNames.month),\n nav: cn(\n \"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1\",\n defaultClassNames.nav\n ),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant }),\n \"size-(--cell-size) p-0 select-none aria-disabled:opacity-50\",\n defaultClassNames.button_previous\n ),\n button_next: cn(\n buttonVariants({ variant: buttonVariant }),\n \"size-(--cell-size) p-0 select-none aria-disabled:opacity-50\",\n defaultClassNames.button_next\n ),\n month_caption: cn(\n \"flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)\",\n defaultClassNames.month_caption\n ),\n dropdowns: cn(\n \"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium\",\n defaultClassNames.dropdowns\n ),\n dropdown_root: cn(\n \"relative rounded-(--cell-radius)\",\n defaultClassNames.dropdown_root\n ),\n dropdown: cn(\n \"absolute inset-0 bg-popover opacity-0\",\n defaultClassNames.dropdown\n ),\n caption_label: cn(\n \"font-medium select-none\",\n captionLayout === \"label\"\n ? \"text-sm\"\n : \"flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground\",\n defaultClassNames.caption_label\n ),\n month_grid: cn(\"w-full border-collapse\", defaultClassNames.month_grid),\n weekdays: cn(\"flex\", defaultClassNames.weekdays),\n weekday: cn(\n \"flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none\",\n defaultClassNames.weekday\n ),\n week: cn(\"mt-2 flex w-full\", defaultClassNames.week),\n week_number_header: cn(\n \"w-(--cell-size) select-none\",\n defaultClassNames.week_number_header\n ),\n week_number: cn(\n \"text-[0.8rem] text-muted-foreground select-none\",\n defaultClassNames.week_number\n ),\n day: cn(\n \"group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)\",\n props.showWeekNumber\n ? \"[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)\"\n : \"[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)\",\n defaultClassNames.day\n ),\n range_start: cn(\n \"relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted\",\n defaultClassNames.range_start\n ),\n range_middle: cn(\"rounded-none\", defaultClassNames.range_middle),\n range_end: cn(\n \"relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted\",\n defaultClassNames.range_end\n ),\n today: cn(\n \"rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none\",\n defaultClassNames.today\n ),\n outside: cn(\n \"text-muted-foreground aria-selected:text-muted-foreground\",\n defaultClassNames.outside\n ),\n disabled: cn(\n \"text-muted-foreground opacity-50\",\n defaultClassNames.disabled\n ),\n hidden: cn(\"invisible\", defaultClassNames.hidden),\n ...classNames,\n }}\n components={composants}\n {...props}\n />\n )\n}\n\nfunction CalendarDayButton({\n className,\n day,\n modifiers,\n locale,\n ...props\n}: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {\n const defaultClassNames = getDefaultClassNames()\n\n const ref = React.useRef<HTMLButtonElement>(null)\n React.useEffect(() => {\n if (modifiers.focused) ref.current?.focus()\n }, [modifiers.focused])\n\n return (\n <Button\n ref={ref}\n variant=\"ghost\"\n size=\"icon\"\n data-day={day.date.toLocaleDateString(locale?.code)}\n data-selected-single={\n modifiers.selected &&\n !modifiers.range_start &&\n !modifiers.range_end &&\n !modifiers.range_middle\n }\n data-range-start={modifiers.range_start}\n data-range-end={modifiers.range_end}\n data-range-middle={modifiers.range_middle}\n className={cn(\n \"relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70\",\n defaultClassNames.day,\n className\n )}\n {...props}\n />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aAAaX,EACX,mDACAW,EAAkB,WACpB;GACA,KAAKX,EACH,0KACAF,EAAM,iBACF,0EACA,wEACJa,EAAkB,GACpB;GACA,aAAaX,EACX,iIACAW,EAAkB,WACpB;GACA,cAAcX,EAAG,gBAAgBW,EAAkB,YAAY;GAC/D,WAAWX,EACT,gIACAW,EAAkB,SACpB;GACA,OAAOX,EACL,sFACAW,EAAkB,KACpB;GACA,SAASX,EACP,6DACAW,EAAkB,OACpB;GACA,UAAUX,EACR,oCACAW,EAAkB,QACpB;GACA,QAAQX,EAAG,aAAaW,EAAkB,MAAM;GAChD,GAAGY;EACL;EACA,YAAYV;EACZ,GAAIf;CACL,CAAA;AAEL;AAEA,SAASgB,EAAkB,EACzB,cACA,QACA,cACA,WACA,GAAGhB,KACqE;CACxE,IAAMa,IAAoBC,EAAqB,GAEzCY,IAAMzC,EAAM,OAA0B,IAAI;CAKhD,OAJAA,EAAM,gBAAgB;EACpB,AAAI0C,EAAU,WAASD,EAAI,SAAS,MAAM;CAC5C,GAAG,CAACC,EAAU,OAAO,CAAC,GAGpB,kBAACC,GAAD;EACO;EACL,SAAQ;EACR,MAAK;EACL,YAAUC,EAAI,KAAK,mBAAmBX,GAAQ,IAAI;EAClD,wBACES,EAAU,YACV,CAACA,EAAU,eACX,CAACA,EAAU,aACX,CAACA,EAAU;EAEb,oBAAkBA,EAAU;EAC5B,kBAAgBA,EAAU;EAC1B,qBAAmBA,EAAU;EAC7B,WAAWzB,EACT,w7BACAW,EAAkB,KAClBV,CACF;EACA,GAAIH;CACL,CAAA;AAEL"}
|
|
@@ -2,8 +2,8 @@ import { Menu as MenuPrimitive } from '@base-ui/react/menu';
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
declare function DropdownMenu({ ...props }: MenuPrimitive.Root.Props): React.JSX.Element;
|
|
4
4
|
declare function DropdownMenuPortal({ ...props }: MenuPrimitive.Portal.Props): React.JSX.Element;
|
|
5
|
-
declare function DropdownMenuTrigger({ ...props }: MenuPrimitive.Trigger.Props): React.JSX.Element;
|
|
6
|
-
declare function DropdownMenuContent({ align, alignOffset, side, sideOffset, className, ...props }: MenuPrimitive.Popup.Props & Pick<MenuPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset">): React.JSX.Element;
|
|
5
|
+
declare function DropdownMenuTrigger({ ref, ...props }: MenuPrimitive.Trigger.Props): React.JSX.Element;
|
|
6
|
+
declare function DropdownMenuContent({ align, alignOffset, side, sideOffset, className, finalFocus, ...props }: MenuPrimitive.Popup.Props & Pick<MenuPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset">): React.JSX.Element;
|
|
7
7
|
declare function DropdownMenuGroup({ ...props }: MenuPrimitive.Group.Props): React.JSX.Element;
|
|
8
8
|
declare function DropdownMenuLabel({ className, inset, ...props }: MenuPrimitive.GroupLabel.Props & {
|
|
9
9
|
inset?: boolean;
|
|
@@ -1,137 +1,171 @@
|
|
|
1
1
|
import { cn as e } from "cn";
|
|
2
|
-
import "react";
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { CheckIcon as
|
|
5
|
-
import { Menu as
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
import { CheckIcon as i, ChevronRightIcon as a } from "lucide-react";
|
|
5
|
+
import { Menu as o } from "@base-ui/react/menu";
|
|
6
6
|
// src/components/ui/dropdown-menu.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
var s = t.createContext(null);
|
|
8
|
+
function c() {
|
|
9
|
+
let e = null;
|
|
10
|
+
return {
|
|
11
|
+
noter: (t) => {
|
|
12
|
+
t && (e = t);
|
|
13
|
+
},
|
|
14
|
+
lire: () => e
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function l(e, t) {
|
|
18
|
+
if (typeof e == "function") return e(t);
|
|
19
|
+
e && (e.current = t);
|
|
20
|
+
}
|
|
21
|
+
var u = t.createContext(!1);
|
|
22
|
+
function d(e, t, n) {
|
|
23
|
+
let r = typeof t == "function" ? t(e) : t ?? !0;
|
|
24
|
+
if (r !== !0) return r;
|
|
25
|
+
let i = document.activeElement;
|
|
26
|
+
if (i && i !== document.body && !i.closest("[data-slot^=\"dropdown-menu-\"]")) return !1;
|
|
27
|
+
let a = n?.lire();
|
|
28
|
+
return !a || a.isConnected;
|
|
29
|
+
}
|
|
30
|
+
function f({ ...e }) {
|
|
31
|
+
let [r] = t.useState(c);
|
|
32
|
+
return /* @__PURE__ */ n(s.Provider, {
|
|
33
|
+
value: r,
|
|
34
|
+
children: /* @__PURE__ */ n(o.Root, {
|
|
35
|
+
"data-slot": "dropdown-menu",
|
|
36
|
+
...e
|
|
37
|
+
})
|
|
11
38
|
});
|
|
12
39
|
}
|
|
13
|
-
function
|
|
14
|
-
return /* @__PURE__ */
|
|
40
|
+
function p({ ...e }) {
|
|
41
|
+
return /* @__PURE__ */ n(o.Portal, {
|
|
15
42
|
"data-slot": "dropdown-menu-portal",
|
|
16
43
|
...e
|
|
17
44
|
});
|
|
18
45
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
46
|
+
function m({ ref: e, ...r }) {
|
|
47
|
+
let i = t.useContext(s), a = t.useCallback((t) => (i?.noter(t), l(e, t)), [i, e]);
|
|
48
|
+
return /* @__PURE__ */ n(o.Trigger, {
|
|
21
49
|
"data-slot": "dropdown-menu-trigger",
|
|
22
|
-
|
|
50
|
+
ref: a,
|
|
51
|
+
...r
|
|
23
52
|
});
|
|
24
53
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
54
|
+
function h({ align: r = "start", alignOffset: i = 0, side: a = "bottom", sideOffset: c = 4, className: l, finalFocus: f, ...p }) {
|
|
55
|
+
let m = t.useContext(s), h = t.useContext(u);
|
|
56
|
+
return /* @__PURE__ */ n(o.Portal, { children: /* @__PURE__ */ n(o.Positioner, {
|
|
27
57
|
className: "isolate z-50 outline-none",
|
|
28
|
-
align:
|
|
29
|
-
alignOffset:
|
|
30
|
-
side:
|
|
31
|
-
sideOffset:
|
|
32
|
-
children: /* @__PURE__ */
|
|
58
|
+
align: r,
|
|
59
|
+
alignOffset: i,
|
|
60
|
+
side: a,
|
|
61
|
+
sideOffset: c,
|
|
62
|
+
children: /* @__PURE__ */ n(o.Popup, {
|
|
33
63
|
"data-slot": "dropdown-menu-content",
|
|
34
|
-
|
|
35
|
-
|
|
64
|
+
finalFocus: h || f && typeof f == "object" ? f : (e) => d(e, f, m),
|
|
65
|
+
className: e("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95", l),
|
|
66
|
+
...p
|
|
36
67
|
})
|
|
37
68
|
}) });
|
|
38
69
|
}
|
|
39
|
-
function
|
|
40
|
-
return /* @__PURE__ */
|
|
70
|
+
function g({ ...e }) {
|
|
71
|
+
return /* @__PURE__ */ n(o.Group, {
|
|
41
72
|
"data-slot": "dropdown-menu-group",
|
|
42
73
|
...e
|
|
43
74
|
});
|
|
44
75
|
}
|
|
45
|
-
function
|
|
46
|
-
return /* @__PURE__ */
|
|
76
|
+
function _({ className: t, inset: r, ...i }) {
|
|
77
|
+
return /* @__PURE__ */ n(o.GroupLabel, {
|
|
47
78
|
"data-slot": "dropdown-menu-label",
|
|
48
79
|
"data-inset": r,
|
|
49
|
-
className: e("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",
|
|
80
|
+
className: e("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7", t),
|
|
50
81
|
...i
|
|
51
82
|
});
|
|
52
83
|
}
|
|
53
|
-
function
|
|
54
|
-
return /* @__PURE__ */
|
|
84
|
+
function v({ className: t, inset: r, variant: i = "default", ...a }) {
|
|
85
|
+
return /* @__PURE__ */ n(o.Item, {
|
|
55
86
|
"data-slot": "dropdown-menu-item",
|
|
56
87
|
"data-inset": r,
|
|
57
88
|
"data-variant": i,
|
|
58
|
-
className: e("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
|
|
59
|
-
...
|
|
89
|
+
className: e("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive", t),
|
|
90
|
+
...a
|
|
60
91
|
});
|
|
61
92
|
}
|
|
62
|
-
function
|
|
63
|
-
return /* @__PURE__ */
|
|
93
|
+
function y({ ...e }) {
|
|
94
|
+
return /* @__PURE__ */ n(o.SubmenuRoot, {
|
|
64
95
|
"data-slot": "dropdown-menu-sub",
|
|
65
96
|
...e
|
|
66
97
|
});
|
|
67
98
|
}
|
|
68
|
-
function
|
|
69
|
-
return /* @__PURE__ */
|
|
99
|
+
function b({ className: t, inset: i, children: s, ...c }) {
|
|
100
|
+
return /* @__PURE__ */ r(o.SubmenuTrigger, {
|
|
70
101
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
71
|
-
"data-inset":
|
|
72
|
-
className: e("flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
102
|
+
"data-inset": i,
|
|
103
|
+
className: e("flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", t),
|
|
73
104
|
...c,
|
|
74
|
-
children: [s, /* @__PURE__ */
|
|
105
|
+
children: [s, /* @__PURE__ */ n(a, { className: "ml-auto" })]
|
|
75
106
|
});
|
|
76
107
|
}
|
|
77
|
-
function
|
|
78
|
-
return /* @__PURE__ */
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
108
|
+
function x({ align: t = "start", alignOffset: r = -3, side: i = "right", sideOffset: a = 0, className: o, ...s }) {
|
|
109
|
+
return /* @__PURE__ */ n(u.Provider, {
|
|
110
|
+
value: !0,
|
|
111
|
+
children: /* @__PURE__ */ n(h, {
|
|
112
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
113
|
+
className: e("w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", o),
|
|
114
|
+
align: t,
|
|
115
|
+
alignOffset: r,
|
|
116
|
+
side: i,
|
|
117
|
+
sideOffset: a,
|
|
118
|
+
...s
|
|
119
|
+
})
|
|
86
120
|
});
|
|
87
121
|
}
|
|
88
|
-
function
|
|
89
|
-
return /* @__PURE__ */
|
|
122
|
+
function S({ className: t, children: a, checked: s, inset: c, ...l }) {
|
|
123
|
+
return /* @__PURE__ */ r(o.CheckboxItem, {
|
|
90
124
|
"data-slot": "dropdown-menu-checkbox-item",
|
|
91
125
|
"data-inset": c,
|
|
92
|
-
className: e("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
126
|
+
className: e("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", t),
|
|
93
127
|
checked: s,
|
|
94
128
|
...l,
|
|
95
|
-
children: [/* @__PURE__ */
|
|
129
|
+
children: [/* @__PURE__ */ n("span", {
|
|
96
130
|
className: "pointer-events-none absolute right-2 flex items-center justify-center",
|
|
97
131
|
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
98
|
-
children: /* @__PURE__ */
|
|
99
|
-
}),
|
|
132
|
+
children: /* @__PURE__ */ n(o.CheckboxItemIndicator, { children: /* @__PURE__ */ n(i, {}) })
|
|
133
|
+
}), a]
|
|
100
134
|
});
|
|
101
135
|
}
|
|
102
|
-
function
|
|
103
|
-
return /* @__PURE__ */
|
|
136
|
+
function C({ ...e }) {
|
|
137
|
+
return /* @__PURE__ */ n(o.RadioGroup, {
|
|
104
138
|
"data-slot": "dropdown-menu-radio-group",
|
|
105
139
|
...e
|
|
106
140
|
});
|
|
107
141
|
}
|
|
108
|
-
function
|
|
109
|
-
return /* @__PURE__ */
|
|
142
|
+
function w({ className: t, children: a, inset: s, ...c }) {
|
|
143
|
+
return /* @__PURE__ */ r(o.RadioItem, {
|
|
110
144
|
"data-slot": "dropdown-menu-radio-item",
|
|
111
145
|
"data-inset": s,
|
|
112
|
-
className: e("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
146
|
+
className: e("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", t),
|
|
113
147
|
...c,
|
|
114
|
-
children: [/* @__PURE__ */
|
|
148
|
+
children: [/* @__PURE__ */ n("span", {
|
|
115
149
|
className: "pointer-events-none absolute right-2 flex items-center justify-center",
|
|
116
150
|
"data-slot": "dropdown-menu-radio-item-indicator",
|
|
117
|
-
children: /* @__PURE__ */
|
|
118
|
-
}),
|
|
151
|
+
children: /* @__PURE__ */ n(o.RadioItemIndicator, { children: /* @__PURE__ */ n(i, {}) })
|
|
152
|
+
}), a]
|
|
119
153
|
});
|
|
120
154
|
}
|
|
121
|
-
function
|
|
122
|
-
return /* @__PURE__ */
|
|
155
|
+
function T({ className: t, ...r }) {
|
|
156
|
+
return /* @__PURE__ */ n(o.Separator, {
|
|
123
157
|
"data-slot": "dropdown-menu-separator",
|
|
124
|
-
className: e("-mx-1 my-1 h-px bg-border",
|
|
158
|
+
className: e("-mx-1 my-1 h-px bg-border", t),
|
|
125
159
|
...r
|
|
126
160
|
});
|
|
127
161
|
}
|
|
128
|
-
function
|
|
129
|
-
return /* @__PURE__ */
|
|
162
|
+
function E({ className: t, ...r }) {
|
|
163
|
+
return /* @__PURE__ */ n("span", {
|
|
130
164
|
"data-slot": "dropdown-menu-shortcut",
|
|
131
|
-
className: e("ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground",
|
|
165
|
+
className: e("ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground", t),
|
|
132
166
|
...r
|
|
133
167
|
});
|
|
134
168
|
}
|
|
135
|
-
export {
|
|
169
|
+
export { f as DropdownMenu, S as DropdownMenuCheckboxItem, h as DropdownMenuContent, g as DropdownMenuGroup, v as DropdownMenuItem, _ as DropdownMenuLabel, p as DropdownMenuPortal, C as DropdownMenuRadioGroup, w as DropdownMenuRadioItem, T as DropdownMenuSeparator, E as DropdownMenuShortcut, y as DropdownMenuSub, x as DropdownMenuSubContent, b as DropdownMenuSubTrigger, m as DropdownMenuTrigger };
|
|
136
170
|
|
|
137
171
|
//# sourceMappingURL=dropdown-menu.js.map
|