@arolariu/components 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DEBUGGING.md +396 -396
- package/LICENSE.md +21 -21
- package/changelog.md +120 -118
- package/dist/components/ui/accordion.d.ts +6 -6
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/accordion.js +20 -28
- package/dist/components/ui/accordion.js.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +19 -13
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.js +40 -63
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/alert.d.ts +7 -8
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/alert.js +18 -21
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/aspect-ratio.d.ts +1 -2
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui/aspect-ratio.js +1 -8
- package/dist/components/ui/aspect-ratio.js.map +1 -1
- package/dist/components/ui/avatar.d.ts +5 -5
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/avatar.js +17 -20
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/background-beams.d.ts.map +1 -1
- package/dist/components/ui/background-beams.js +6 -6
- package/dist/components/ui/background-beams.js.map +1 -1
- package/dist/components/ui/badge.d.ts +7 -7
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +9 -12
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts +17 -9
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.js +32 -39
- package/dist/components/ui/breadcrumb.js.map +1 -1
- package/dist/components/ui/bubble-background.d.ts +1 -1
- package/dist/components/ui/bubble-background.d.ts.map +1 -1
- package/dist/components/ui/bubble-background.js +13 -13
- package/dist/components/ui/bubble-background.js.map +1 -1
- package/dist/components/ui/button-group.d.ts +13 -0
- package/dist/components/ui/button-group.d.ts.map +1 -0
- package/dist/components/ui/button-group.js +47 -0
- package/dist/components/ui/button-group.js.map +1 -0
- package/dist/components/ui/button.d.ts +8 -7
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +16 -15
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/calendar.js +22 -22
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/card.d.ts +7 -8
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +33 -46
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/carousel.d.ts +7 -8
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel.js +30 -21
- package/dist/components/ui/carousel.js.map +1 -1
- package/dist/components/ui/chart.d.ts +37 -29
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/chart.js +29 -27
- package/dist/components/ui/chart.js.map +1 -1
- package/dist/components/ui/checkbox.d.ts +2 -2
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +11 -13
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/collapsible.d.ts +4 -5
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/collapsible.js +3 -20
- package/dist/components/ui/collapsible.js.map +1 -1
- package/dist/components/ui/command.d.ts +79 -17
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/command.js +52 -77
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/context-menu.d.ts +23 -21
- package/dist/components/ui/context-menu.d.ts.map +1 -1
- package/dist/components/ui/context-menu.js +60 -104
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/components/ui/counting-number.d.ts +1 -1
- package/dist/components/ui/counting-number.d.ts.map +1 -1
- package/dist/components/ui/counting-number.js +4 -3
- package/dist/components/ui/counting-number.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +17 -13
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +38 -66
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/dot-background.d.ts +10 -17
- package/dist/components/ui/dot-background.d.ts.map +1 -1
- package/dist/components/ui/dot-background.js +2 -2
- package/dist/components/ui/dot-background.js.map +1 -1
- package/dist/components/ui/drawer.d.ts +20 -11
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer.js +37 -62
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +23 -21
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +65 -109
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdrawer.d.ts +3 -3
- package/dist/components/ui/dropdrawer.d.ts.map +1 -1
- package/dist/components/ui/dropdrawer.js +13 -16
- package/dist/components/ui/dropdrawer.js.map +1 -1
- package/dist/components/ui/empty.d.ts +13 -0
- package/dist/components/ui/empty.d.ts.map +1 -0
- package/dist/components/ui/empty.js +65 -0
- package/dist/components/ui/empty.js.map +1 -0
- package/dist/components/ui/field.d.ts +25 -0
- package/dist/components/ui/field.d.ts.map +1 -0
- package/dist/components/ui/field.js +135 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/fireworks-background.d.ts.map +1 -1
- package/dist/components/ui/fireworks-background.js +1 -1
- package/dist/components/ui/fireworks-background.js.map +1 -1
- package/dist/components/ui/flip-button.d.ts +1 -1
- package/dist/components/ui/flip-button.d.ts.map +1 -1
- package/dist/components/ui/flip-button.js +3 -3
- package/dist/components/ui/flip-button.js.map +1 -1
- package/dist/components/ui/form.d.ts +7 -8
- package/dist/components/ui/form.d.ts.map +1 -1
- package/dist/components/ui/form.js +29 -28
- package/dist/components/ui/form.js.map +1 -1
- package/dist/components/ui/gradient-background.d.ts +1 -1
- package/dist/components/ui/gradient-background.d.ts.map +1 -1
- package/dist/components/ui/gradient-background.js +2 -2
- package/dist/components/ui/gradient-background.js.map +1 -1
- package/dist/components/ui/gradient-text.d.ts +1 -1
- package/dist/components/ui/gradient-text.d.ts.map +1 -1
- package/dist/components/ui/gradient-text.js +5 -5
- package/dist/components/ui/gradient-text.js.map +1 -1
- package/dist/components/ui/highlight-text.d.ts +1 -1
- package/dist/components/ui/highlight-text.d.ts.map +1 -1
- package/dist/components/ui/highlight-text.js +3 -3
- package/dist/components/ui/highlight-text.js.map +1 -1
- package/dist/components/ui/hole-background.d.ts.map +1 -1
- package/dist/components/ui/hole-background.js +11 -10
- package/dist/components/ui/hole-background.js.map +1 -1
- package/dist/components/ui/hover-card.d.ts +5 -5
- package/dist/components/ui/hover-card.d.ts.map +1 -1
- package/dist/components/ui/hover-card.js +12 -26
- package/dist/components/ui/hover-card.js.map +1 -1
- package/dist/components/ui/input-group.d.ts +17 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group.js +91 -0
- package/dist/components/ui/input-group.js.map +1 -0
- package/dist/components/ui/input-otp.d.ts +31 -8
- package/dist/components/ui/input-otp.d.ts.map +1 -1
- package/dist/components/ui/input-otp.js +24 -27
- package/dist/components/ui/input-otp.js.map +1 -1
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +7 -8
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/item.d.ts +24 -0
- package/dist/components/ui/item.d.ts.map +1 -0
- package/dist/components/ui/item.js +122 -0
- package/dist/components/ui/item.js.map +1 -0
- package/dist/components/ui/kbd.d.ts +5 -0
- package/dist/components/ui/kbd.d.ts.map +1 -0
- package/dist/components/ui/kbd.js +21 -0
- package/dist/components/ui/kbd.js.map +1 -0
- package/dist/components/ui/label.d.ts +3 -2
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/label.js +9 -8
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/menubar.d.ts +20 -18
- package/dist/components/ui/menubar.d.ts.map +1 -1
- package/dist/components/ui/menubar.js +75 -95
- package/dist/components/ui/menubar.js.map +1 -1
- package/dist/components/ui/navigation-menu.d.ts +11 -13
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.js +39 -58
- package/dist/components/ui/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination.d.ts +25 -10
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/pagination.js +33 -41
- package/dist/components/ui/pagination.js.map +1 -1
- package/dist/components/ui/popover.d.ts +6 -6
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +10 -26
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.d.ts +2 -2
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/progress.js +8 -10
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/radio-group.d.ts +3 -3
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group.js +17 -20
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/resizable.d.ts +21 -6
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/resizable.js +9 -21
- package/dist/components/ui/resizable.js.map +1 -1
- package/dist/components/ui/ripple-button.d.ts +1 -1
- package/dist/components/ui/ripple-button.d.ts.map +1 -1
- package/dist/components/ui/ripple-button.js +4 -4
- package/dist/components/ui/ripple-button.js.map +1 -1
- package/dist/components/ui/scratcher.d.ts.map +1 -1
- package/dist/components/ui/scratcher.js +7 -5
- package/dist/components/ui/scratcher.js.map +1 -1
- package/dist/components/ui/scroll-area.d.ts +3 -3
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +14 -18
- package/dist/components/ui/scroll-area.js.map +1 -1
- package/dist/components/ui/select.d.ts +11 -13
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +55 -78
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/separator.d.ts +2 -2
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/separator.js +7 -8
- package/dist/components/ui/separator.js.map +1 -1
- package/dist/components/ui/sheet.d.ts +24 -12
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet.js +56 -68
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/sidebar.d.ts +35 -39
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/sidebar.js +115 -124
- package/dist/components/ui/sidebar.js.map +1 -1
- package/dist/components/ui/skeleton.d.ts +1 -1
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/skeleton.js +2 -3
- package/dist/components/ui/skeleton.js.map +1 -1
- package/dist/components/ui/slider.d.ts +2 -2
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/slider.js +12 -31
- package/dist/components/ui/slider.js.map +1 -1
- package/dist/components/ui/sonner.d.ts +4 -2
- package/dist/components/ui/sonner.d.ts.map +1 -1
- package/dist/components/ui/sonner.js +8 -5
- package/dist/components/ui/sonner.js.map +1 -1
- package/dist/components/ui/spinner.d.ts +4 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +16 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/switch.d.ts +2 -2
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/switch.js +8 -10
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/table.d.ts +9 -9
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +40 -49
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.d.ts +6 -6
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/tabs.js +18 -27
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/components/ui/textarea.d.ts +1 -1
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/textarea.js +7 -8
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/toggle-group.d.ts +9 -4
- package/dist/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle-group.js +12 -16
- package/dist/components/ui/toggle-group.js.map +1 -1
- package/dist/components/ui/toggle.d.ts +9 -6
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/toggle.js +8 -9
- package/dist/components/ui/toggle.js.map +1 -1
- package/dist/components/ui/tooltip.d.ts +6 -6
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +14 -39
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/components/ui/typewriter.d.ts.map +1 -1
- package/dist/components/ui/typewriter.js +9 -9
- package/dist/components/ui/typewriter.js.map +1 -1
- package/dist/hooks/useIsMobile.d.ts +2 -5
- package/dist/hooks/useIsMobile.d.ts.map +1 -1
- package/dist/hooks/useIsMobile.js +1 -1
- package/dist/hooks/useIsMobile.js.map +1 -1
- package/dist/hooks/useWindowSize.d.ts +0 -1
- package/dist/hooks/useWindowSize.d.ts.map +1 -1
- package/dist/hooks/useWindowSize.js +1 -1
- package/dist/hooks/useWindowSize.js.map +1 -1
- package/dist/index.css +841 -1128
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +43 -37
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -5
- package/dist/lib/utilities.d.ts +9 -0
- package/dist/lib/utilities.d.ts.map +1 -0
- package/dist/lib/{utils.js → utilities.js} +1 -1
- package/dist/lib/utilities.js.map +1 -0
- package/package.json +121 -90
- package/{README.md → readme.md} +627 -627
- package/src/components/ui/accordion.tsx +55 -66
- package/src/components/ui/alert-dialog.tsx +124 -160
- package/src/components/ui/alert.tsx +56 -69
- package/src/components/ui/aspect-ratio.tsx +7 -12
- package/src/components/ui/avatar.tsx +43 -53
- package/src/components/ui/background-beams.tsx +145 -142
- package/src/components/ui/badge.tsx +39 -48
- package/src/components/ui/breadcrumb.tsx +94 -117
- package/src/components/ui/bubble-background.tsx +170 -189
- package/src/components/ui/button-group.tsx +69 -0
- package/src/components/ui/button.tsx +55 -61
- package/src/components/ui/calendar.tsx +175 -216
- package/src/components/ui/card.tsx +64 -97
- package/src/components/ui/carousel.tsx +216 -241
- package/src/components/ui/chart.tsx +293 -385
- package/src/components/ui/checkbox.tsx +27 -32
- package/src/components/ui/collapsible.tsx +11 -34
- package/src/components/ui/command.tsx +138 -184
- package/src/components/ui/context-menu.tsx +186 -255
- package/src/components/ui/counting-number.tsx +92 -108
- package/src/components/ui/dialog.tsx +106 -146
- package/src/components/ui/dot-background.tsx +153 -158
- package/src/components/ui/drawer.tsx +105 -141
- package/src/components/ui/dropdown-menu.tsx +188 -260
- package/src/components/ui/dropdrawer.tsx +865 -973
- package/src/components/ui/empty.tsx +86 -0
- package/src/components/ui/field.tsx +198 -0
- package/src/components/ui/fireworks-background.tsx +325 -378
- package/src/components/ui/flip-button.tsx +89 -110
- package/src/components/ui/form.tsx +144 -174
- package/src/components/ui/gradient-background.tsx +30 -43
- package/src/components/ui/gradient-text.tsx +62 -65
- package/src/components/ui/highlight-text.tsx +54 -71
- package/src/components/ui/hole-background.tsx +326 -361
- package/src/components/ui/hover-card.tsx +29 -44
- package/src/components/ui/input-group.tsx +145 -0
- package/src/components/ui/input-otp.tsx +66 -77
- package/src/components/ui/input.tsx +21 -22
- package/src/components/ui/item.tsx +163 -0
- package/src/components/ui/kbd.tsx +31 -0
- package/src/components/ui/label.tsx +23 -24
- package/src/components/ui/menubar.tsx +233 -279
- package/src/components/ui/navigation-menu.tsx +120 -171
- package/src/components/ui/pagination.tsx +92 -129
- package/src/components/ui/popover.tsx +33 -48
- package/src/components/ui/progress.tsx +24 -31
- package/src/components/ui/radio-group.tsx +43 -45
- package/src/components/ui/resizable.tsx +38 -56
- package/src/components/ui/ripple-button.tsx +90 -111
- package/src/components/ui/scratcher.tsx +167 -171
- package/src/components/ui/scroll-area.tsx +42 -58
- package/src/components/ui/select.tsx +145 -191
- package/src/components/ui/separator.tsx +26 -28
- package/src/components/ui/sheet.tsx +112 -145
- package/src/components/ui/sidebar.tsx +664 -729
- package/src/components/ui/skeleton.tsx +15 -19
- package/src/components/ui/slider.tsx +23 -63
- package/src/components/ui/sonner.tsx +36 -26
- package/src/components/ui/spinner.tsx +18 -0
- package/src/components/ui/switch.tsx +28 -31
- package/src/components/ui/table.tsx +93 -119
- package/src/components/ui/tabs.tsx +54 -66
- package/src/components/ui/textarea.tsx +21 -20
- package/src/components/ui/toggle-group.tsx +53 -73
- package/src/components/ui/toggle.tsx +44 -47
- package/src/components/ui/tooltip.tsx +32 -61
- package/src/components/ui/typewriter.tsx +173 -188
- package/src/hooks/useIsMobile.tsx +42 -45
- package/src/hooks/useWindowSize.tsx +66 -72
- package/src/index.css +67 -67
- package/src/index.ts +342 -408
- package/src/lib/utilities.ts +12 -0
- package/dist/lib/utils.d.ts +0 -7
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/utils.js.map +0 -1
- package/src/lib/utils.ts +0 -10
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
4
3
|
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
5
|
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
6
|
-
import { cn } from "../../lib/utils.js";
|
|
7
6
|
import { Button, buttonVariants } from "./button.js";
|
|
7
|
+
import { cn } from "../../lib/utilities.js";
|
|
8
8
|
function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", formatters, components, ...props }) {
|
|
9
9
|
const defaultClassNames = getDefaultClassNames();
|
|
10
10
|
return /*#__PURE__*/ jsx(DayPicker, {
|
|
11
11
|
showOutsideDays: showOutsideDays,
|
|
12
|
-
className: cn("bg-white
|
|
12
|
+
className: cn("group/calendar bg-white p-3 [--cell-size:2rem] dark:bg-neutral-950 [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className),
|
|
13
13
|
captionLayout: captionLayout,
|
|
14
14
|
formatters: {
|
|
15
15
|
formatMonthDropdown: (date)=>date.toLocaleString("default", {
|
|
@@ -19,30 +19,30 @@ function Calendar({ className, classNames, showOutsideDays = true, captionLayout
|
|
|
19
19
|
},
|
|
20
20
|
classNames: {
|
|
21
21
|
root: cn("w-fit", defaultClassNames.root),
|
|
22
|
-
months: cn("flex gap-4
|
|
23
|
-
month: cn("flex flex-col
|
|
24
|
-
nav: cn("
|
|
22
|
+
months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
|
|
23
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
24
|
+
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
|
|
25
25
|
button_previous: cn(buttonVariants({
|
|
26
26
|
variant: buttonVariant
|
|
27
|
-
}), "size-
|
|
27
|
+
}), "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50", defaultClassNames.button_previous),
|
|
28
28
|
button_next: cn(buttonVariants({
|
|
29
29
|
variant: buttonVariant
|
|
30
|
-
}), "size-
|
|
31
|
-
month_caption: cn("flex
|
|
32
|
-
dropdowns: cn("w-full
|
|
33
|
-
dropdown_root: cn("
|
|
34
|
-
dropdown: cn("
|
|
35
|
-
caption_label: cn("select-none font-medium", "label" === captionLayout ? "text-sm" : "
|
|
30
|
+
}), "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50", defaultClassNames.button_next),
|
|
31
|
+
month_caption: cn("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]", defaultClassNames.month_caption),
|
|
32
|
+
dropdowns: cn("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
|
|
33
|
+
dropdown_root: cn("has-focus:border-neutral-950 border-neutral-200 shadow-xs has-focus:ring-neutral-950/50 has-focus:ring-[3px] relative rounded-md border dark:has-focus:border-neutral-300 dark:border-neutral-800 dark:has-focus:ring-neutral-300/50", defaultClassNames.dropdown_root),
|
|
34
|
+
dropdown: cn("bg-white absolute inset-0 opacity-0 dark:bg-neutral-950", defaultClassNames.dropdown),
|
|
35
|
+
caption_label: cn("select-none font-medium", "label" === captionLayout ? "text-sm" : "[&>svg]:text-neutral-500 flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5 dark:[&>svg]:text-neutral-400", defaultClassNames.caption_label),
|
|
36
36
|
table: "w-full border-collapse",
|
|
37
37
|
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
38
|
-
weekday: cn("text-neutral-500
|
|
39
|
-
week: cn("flex w-full
|
|
40
|
-
week_number_header: cn("
|
|
41
|
-
week_number: cn("text-
|
|
42
|
-
day: cn("relative
|
|
43
|
-
range_start: cn("rounded-l-md
|
|
38
|
+
weekday: cn("text-neutral-500 flex-1 select-none rounded-md text-[0.8rem] font-normal dark:text-neutral-400", defaultClassNames.weekday),
|
|
39
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
40
|
+
week_number_header: cn("w-[--cell-size] select-none", defaultClassNames.week_number_header),
|
|
41
|
+
week_number: cn("text-neutral-500 select-none text-[0.8rem] dark:text-neutral-400", defaultClassNames.week_number),
|
|
42
|
+
day: cn("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md", defaultClassNames.day),
|
|
43
|
+
range_start: cn("bg-neutral-100 rounded-l-md dark:bg-neutral-800", defaultClassNames.range_start),
|
|
44
44
|
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
45
|
-
range_end: cn("rounded-r-md
|
|
45
|
+
range_end: cn("bg-neutral-100 rounded-r-md dark:bg-neutral-800", defaultClassNames.range_end),
|
|
46
46
|
today: cn("bg-neutral-100 text-neutral-900 rounded-md data-[selected=true]:rounded-none dark:bg-neutral-800 dark:text-neutral-50", defaultClassNames.today),
|
|
47
47
|
outside: cn("text-neutral-500 aria-selected:text-neutral-500 dark:text-neutral-400 dark:aria-selected:text-neutral-400", defaultClassNames.outside),
|
|
48
48
|
disabled: cn("text-neutral-500 opacity-50 dark:text-neutral-400", defaultClassNames.disabled),
|
|
@@ -74,7 +74,7 @@ function Calendar({ className, classNames, showOutsideDays = true, captionLayout
|
|
|
74
74
|
WeekNumber: ({ children, ...props })=>/*#__PURE__*/ jsx("td", {
|
|
75
75
|
...props,
|
|
76
76
|
children: /*#__PURE__*/ jsx("div", {
|
|
77
|
-
className: "flex size-
|
|
77
|
+
className: "flex size-[--cell-size] items-center justify-center text-center",
|
|
78
78
|
children: children
|
|
79
79
|
})
|
|
80
80
|
}),
|
|
@@ -100,7 +100,7 @@ function CalendarDayButton({ className, day, modifiers, ...props }) {
|
|
|
100
100
|
"data-range-start": modifiers["range_start"],
|
|
101
101
|
"data-range-end": modifiers["range_end"],
|
|
102
102
|
"data-range-middle": modifiers["range_middle"],
|
|
103
|
-
className: cn("
|
|
103
|
+
className: cn("group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:bg-neutral-900 data-[range-end=true]:text-neutral-50 data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-neutral-100 data-[range-middle=true]:text-neutral-900 data-[range-start=true]:rounded-md data-[range-start=true]:bg-neutral-900 data-[range-start=true]:text-neutral-50 data-[selected-single=true]:bg-neutral-900 data-[selected-single=true]:text-neutral-50 dark:data-[range-end=true]:bg-neutral-50 dark:data-[range-end=true]:text-neutral-900 dark:data-[range-middle=true]:bg-neutral-800 dark:data-[range-middle=true]:text-neutral-50 dark:data-[range-start=true]:bg-neutral-50 dark:data-[range-start=true]:text-neutral-900 dark:data-[selected-single=true]:bg-neutral-50 dark:data-[selected-single=true]:text-neutral-900 [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className),
|
|
104
104
|
...props
|
|
105
105
|
});
|
|
106
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\ui\\calendar.js","sources":["webpack://@arolariu/components/./src/components/ui/calendar.tsx"],"sourcesContent":["\n\nimport * as React from \"react\";\nimport {\n ChevronDownIcon,\n ChevronLeftIcon,\n ChevronRightIcon,\n} from \"lucide-react\";\nimport { DayButton, DayPicker, getDefaultClassNames } from \"react-day-picker\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Button, buttonVariants } from \"@/components/ui/button\";\n\nfunction Calendar({\n className,\n classNames,\n showOutsideDays = true,\n captionLayout = \"label\",\n buttonVariant = \"ghost\",\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 \"bg-white group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent dark:bg-neutral-950\",\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 formatters={{\n formatMonthDropdown: (date) =>\n date.toLocaleString(\"default\", { month: \"short\" }),\n ...formatters,\n }}\n classNames={{\n root: cn(\"w-fit\", defaultClassNames.root),\n months: cn(\n \"flex gap-4 flex-col md:flex-row relative\",\n defaultClassNames.months,\n ),\n month: cn(\"flex flex-col w-full gap-4\", defaultClassNames.month),\n nav: cn(\n \"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between\",\n defaultClassNames.nav,\n ),\n button_previous: cn(\n buttonVariants({ variant: buttonVariant }),\n \"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none\",\n defaultClassNames.button_previous,\n ),\n button_next: cn(\n buttonVariants({ variant: buttonVariant }),\n \"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none\",\n defaultClassNames.button_next,\n ),\n month_caption: cn(\n \"flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)\",\n defaultClassNames.month_caption,\n ),\n dropdowns: cn(\n \"w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5\",\n defaultClassNames.dropdowns,\n ),\n dropdown_root: cn(\n \"relative has-focus:border-neutral-950 border border-neutral-200 shadow-xs has-focus:ring-neutral-950/50 has-focus:ring-[3px] rounded-md dark:has-focus:border-neutral-300 dark:border-neutral-800 dark:has-focus:ring-neutral-300/50\",\n defaultClassNames.dropdown_root,\n ),\n dropdown: cn(\n \"absolute bg-white inset-0 opacity-0 dark:bg-neutral-950\",\n defaultClassNames.dropdown,\n ),\n caption_label: cn(\n \"select-none font-medium\",\n captionLayout === \"label\"\n ? \"text-sm\"\n : \"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-neutral-500 [&>svg]:size-3.5 dark:[&>svg]:text-neutral-400\",\n defaultClassNames.caption_label,\n ),\n table: \"w-full border-collapse\",\n weekdays: cn(\"flex\", defaultClassNames.weekdays),\n weekday: cn(\n \"text-neutral-500 rounded-md flex-1 font-normal text-[0.8rem] select-none dark:text-neutral-400\",\n defaultClassNames.weekday,\n ),\n week: cn(\"flex w-full mt-2\", defaultClassNames.week),\n week_number_header: cn(\n \"select-none w-(--cell-size)\",\n defaultClassNames.week_number_header,\n ),\n week_number: cn(\n \"text-[0.8rem] select-none text-neutral-500 dark:text-neutral-400\",\n defaultClassNames.week_number,\n ),\n day: cn(\n \"relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none\",\n defaultClassNames.day,\n ),\n range_start: cn(\n \"rounded-l-md bg-neutral-100 dark:bg-neutral-800\",\n defaultClassNames.range_start,\n ),\n range_middle: cn(\"rounded-none\", defaultClassNames.range_middle),\n range_end: cn(\n \"rounded-r-md bg-neutral-100 dark:bg-neutral-800\",\n defaultClassNames.range_end,\n ),\n today: cn(\n \"bg-neutral-100 text-neutral-900 rounded-md data-[selected=true]:rounded-none dark:bg-neutral-800 dark:text-neutral-50\",\n defaultClassNames.today,\n ),\n outside: cn(\n \"text-neutral-500 aria-selected:text-neutral-500 dark:text-neutral-400 dark:aria-selected:text-neutral-400\",\n defaultClassNames.outside,\n ),\n disabled: cn(\n \"text-neutral-500 opacity-50 dark:text-neutral-400\",\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: CalendarDayButton,\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 ...props\n}: React.ComponentProps<typeof DayButton>) {\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()}\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 \"data-[selected-single=true]:bg-neutral-900 data-[selected-single=true]:text-neutral-50 data-[range-middle=true]:bg-neutral-100 data-[range-middle=true]:text-neutral-900 data-[range-start=true]:bg-neutral-900 data-[range-start=true]:text-neutral-50 data-[range-end=true]:bg-neutral-900 data-[range-end=true]:text-neutral-50 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-neutral-900 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70 dark:data-[selected-single=true]:bg-neutral-50 dark:data-[selected-single=true]:text-neutral-900 dark:data-[range-middle=true]:bg-neutral-800 dark:data-[range-middle=true]:text-neutral-50 dark:data-[range-start=true]:bg-neutral-50 dark:data-[range-start=true]:text-neutral-900 dark:data-[range-end=true]:bg-neutral-50 dark:data-[range-end=true]:text-neutral-900 dark:dark:hover:text-neutral-50\",\n defaultClassNames.day,\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Calendar, CalendarDayButton };\n"],"names":["Calendar","className","classNames","showOutsideDays","captionLayout","buttonVariant","formatters","components","props","defaultClassNames","getDefaultClassNames","DayPicker","cn","String","date","buttonVariants","rootRef","orientation","ChevronLeftIcon","ChevronRightIcon","ChevronDownIcon","CalendarDayButton","children","day","modifiers","ref","React","Button"],"mappings":";;;;;;;AAaA,SAASA,SAAS,EAChBC,SAAS,EACTC,UAAU,EACVC,kBAAkB,IAAI,EACtBC,gBAAgB,OAAO,EACvBC,gBAAgB,OAAO,EACvBC,UAAU,EACVC,UAAU,EACV,GAAGC,OAGJ;IACC,MAAMC,oBAAoBC;IAE1B,OAAO,WAAP,GACE,IAACC,WAASA;QACR,iBAAiBR;QACjB,WAAWS,GACT,yKACAC,OAAO,GAAG,CAAC,yCAAyC,CAAC,EACrDA,OAAO,GAAG,CAAC,6CAA6C,CAAC,EACzDZ;QAEF,eAAeG;QACf,YAAY;YACV,qBAAqB,CAACU,OACpBA,KAAK,cAAc,CAAC,WAAW;oBAAE,OAAO;gBAAQ;YAClD,GAAGR,UAAU;QACf;QACA,YAAY;YACV,MAAMM,GAAG,SAASH,kBAAkB,IAAI;YACxC,QAAQG,GACN,4CACAH,kBAAkB,MAAM;YAE1B,OAAOG,GAAG,8BAA8BH,kBAAkB,KAAK;YAC/D,KAAKG,GACH,2EACAH,kBAAkB,GAAG;YAEvB,iBAAiBG,GACfG,eAAe;gBAAE,SAASV;YAAc,IACxC,+DACAI,kBAAkB,eAAe;YAEnC,aAAaG,GACXG,eAAe;gBAAE,SAASV;YAAc,IACxC,+DACAI,kBAAkB,WAAW;YAE/B,eAAeG,GACb,4EACAH,kBAAkB,aAAa;YAEjC,WAAWG,GACT,uFACAH,kBAAkB,SAAS;YAE7B,eAAeG,GACb,wOACAH,kBAAkB,aAAa;YAEjC,UAAUG,GACR,2DACAH,kBAAkB,QAAQ;YAE5B,eAAeG,GACb,2BACAR,YAAAA,gBACI,YACA,oIACJK,kBAAkB,aAAa;YAEjC,OAAO;YACP,UAAUG,GAAG,QAAQH,kBAAkB,QAAQ;YAC/C,SA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AGC,KAAK;;AAGf;AAEA,SAASa,kBAAkB,EACzBpB,SAAS,EACTsB,GAAG,EACHC,SAAS,EACT,GAAGhB,OACoC;IACvC,MAAMC,oBAAoBC;IAE1B,MAAMe,MAAMC,OAAgC;IAC5CA,UAAgB;QACd,IAAIF,SAAS,CAAC,UAAU,EAAEC,IAAI,OAAO,EAAE;IACzC,GAAG;QAACD,SAAS,CAAC,UAAU;KAAC;IAEzB,OAAO,WAAP,GACE,IAACG,QAAMA;QACL,KAAKF;QACL,SAAQ;QACR,MAAK;QACL,YAAUF,IAAI,IAAI,CAAC,kBAAkB;QACrC,wBACEC,SAAS,CAAC,WAAW,IACrB,CAACA,SAAS,CAAC,cAAc,IACzB,CAACA,SAAS,CAAC,YAAY,IACvB,CAACA,SAAS,CAAC,eAAe;QAE5B,oBAAkBA,SAAS,CAAC,cAAc;QAC1C,kBAAgBA,SAAS,CAAC,YAAY;QACtC,qBAAmBA,SAAS,CAAC,eAAe;QAC5C,WAAWZ,GACT,2uCACAH,kBAAkB,GAAG,EACrBR;QAED,GAAGO,KAAK;;AAGf"}
|
|
1
|
+
{"version":3,"file":"components\\ui\\calendar.js","sources":["webpack://@arolariu/components/./src/components/ui/calendar.tsx"],"sourcesContent":["\r\n\r\nimport {ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon} from \"lucide-react\";\r\nimport * as React from \"react\";\r\nimport {DayButton, DayPicker, getDefaultClassNames} from \"react-day-picker\";\r\n\r\nimport {Button, buttonVariants} from \"@/components/ui/button\";\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\nfunction Calendar({\r\n className,\r\n classNames,\r\n showOutsideDays = true,\r\n captionLayout = \"label\",\r\n buttonVariant = \"ghost\",\r\n formatters,\r\n components,\r\n ...props\r\n}: React.ComponentProps<typeof DayPicker> & {\r\n buttonVariant?: React.ComponentProps<typeof Button>[\"variant\"];\r\n}) {\r\n const defaultClassNames = getDefaultClassNames();\r\n\r\n return (\r\n <DayPicker\r\n showOutsideDays={showOutsideDays}\r\n className={cn(\r\n \"group/calendar bg-white p-3 [--cell-size:2rem] dark:bg-neutral-950 [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent\",\r\n String.raw`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,\r\n String.raw`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,\r\n className,\r\n )}\r\n captionLayout={captionLayout}\r\n formatters={{\r\n formatMonthDropdown: (date) => date.toLocaleString(\"default\", {month: \"short\"}),\r\n ...formatters,\r\n }}\r\n classNames={{\r\n root: cn(\"w-fit\", defaultClassNames.root),\r\n months: cn(\"relative flex flex-col gap-4 md:flex-row\", defaultClassNames.months),\r\n month: cn(\"flex w-full flex-col gap-4\", defaultClassNames.month),\r\n nav: cn(\"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1\", defaultClassNames.nav),\r\n button_previous: cn(\r\n buttonVariants({variant: buttonVariant}),\r\n \"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50\",\r\n defaultClassNames.button_previous,\r\n ),\r\n button_next: cn(\r\n buttonVariants({variant: buttonVariant}),\r\n \"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50\",\r\n defaultClassNames.button_next,\r\n ),\r\n month_caption: cn(\"flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]\", defaultClassNames.month_caption),\r\n dropdowns: cn(\"flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium\", defaultClassNames.dropdowns),\r\n dropdown_root: cn(\r\n \"has-focus:border-neutral-950 border-neutral-200 shadow-xs has-focus:ring-neutral-950/50 has-focus:ring-[3px] relative rounded-md border dark:has-focus:border-neutral-300 dark:border-neutral-800 dark:has-focus:ring-neutral-300/50\",\r\n defaultClassNames.dropdown_root,\r\n ),\r\n dropdown: cn(\"bg-white absolute inset-0 opacity-0 dark:bg-neutral-950\", defaultClassNames.dropdown),\r\n caption_label: cn(\r\n \"select-none font-medium\",\r\n captionLayout === \"label\"\r\n ? \"text-sm\"\r\n : \"[&>svg]:text-neutral-500 flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5 dark:[&>svg]:text-neutral-400\",\r\n defaultClassNames.caption_label,\r\n ),\r\n table: \"w-full border-collapse\",\r\n weekdays: cn(\"flex\", defaultClassNames.weekdays),\r\n weekday: cn(\r\n \"text-neutral-500 flex-1 select-none rounded-md text-[0.8rem] font-normal dark:text-neutral-400\",\r\n defaultClassNames.weekday,\r\n ),\r\n week: cn(\"mt-2 flex w-full\", defaultClassNames.week),\r\n week_number_header: cn(\"w-[--cell-size] select-none\", defaultClassNames.week_number_header),\r\n week_number: cn(\"text-neutral-500 select-none text-[0.8rem] dark:text-neutral-400\", defaultClassNames.week_number),\r\n day: cn(\r\n \"group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md\",\r\n defaultClassNames.day,\r\n ),\r\n range_start: cn(\"bg-neutral-100 rounded-l-md dark:bg-neutral-800\", defaultClassNames.range_start),\r\n range_middle: cn(\"rounded-none\", defaultClassNames.range_middle),\r\n range_end: cn(\"bg-neutral-100 rounded-r-md dark:bg-neutral-800\", defaultClassNames.range_end),\r\n today: cn(\r\n \"bg-neutral-100 text-neutral-900 rounded-md data-[selected=true]:rounded-none dark:bg-neutral-800 dark:text-neutral-50\",\r\n defaultClassNames.today,\r\n ),\r\n outside: cn(\r\n \"text-neutral-500 aria-selected:text-neutral-500 dark:text-neutral-400 dark:aria-selected:text-neutral-400\",\r\n defaultClassNames.outside,\r\n ),\r\n disabled: cn(\"text-neutral-500 opacity-50 dark:text-neutral-400\", defaultClassNames.disabled),\r\n hidden: cn(\"invisible\", defaultClassNames.hidden),\r\n ...classNames,\r\n }}\r\n components={{\r\n Root: ({className, rootRef, ...props}) => {\r\n return (\r\n <div\r\n data-slot='calendar'\r\n ref={rootRef}\r\n className={cn(className)}\r\n {...props}\r\n />\r\n );\r\n },\r\n Chevron: ({className, orientation, ...props}) => {\r\n if (orientation === \"left\") {\r\n return (\r\n <ChevronLeftIcon\r\n className={cn(\"size-4\", className)}\r\n {...props}\r\n />\r\n );\r\n }\r\n\r\n if (orientation === \"right\") {\r\n return (\r\n <ChevronRightIcon\r\n className={cn(\"size-4\", className)}\r\n {...props}\r\n />\r\n );\r\n }\r\n\r\n return (\r\n <ChevronDownIcon\r\n className={cn(\"size-4\", className)}\r\n {...props}\r\n />\r\n );\r\n },\r\n DayButton: CalendarDayButton,\r\n WeekNumber: ({children, ...props}) => {\r\n return (\r\n <td {...props}>\r\n <div className='flex size-[--cell-size] items-center justify-center text-center'>{children}</div>\r\n </td>\r\n );\r\n },\r\n ...components,\r\n }}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction CalendarDayButton({className, day, modifiers, ...props}: React.ComponentProps<typeof DayButton>) {\r\n const defaultClassNames = getDefaultClassNames();\r\n\r\n const ref = React.useRef<HTMLButtonElement>(null);\r\n React.useEffect(() => {\r\n if (modifiers[\"focused\"]) ref.current?.focus();\r\n }, [modifiers[\"focused\"]]);\r\n\r\n return (\r\n <Button\r\n ref={ref}\r\n variant='ghost'\r\n size='icon'\r\n data-day={day.date.toLocaleDateString()}\r\n data-selected-single={modifiers[\"selected\"] && !modifiers[\"range_start\"] && !modifiers[\"range_end\"] && !modifiers[\"range_middle\"]}\r\n data-range-start={modifiers[\"range_start\"]}\r\n data-range-end={modifiers[\"range_end\"]}\r\n data-range-middle={modifiers[\"range_middle\"]}\r\n className={cn(\r\n \"group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:bg-neutral-900 data-[range-end=true]:text-neutral-50 data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-neutral-100 data-[range-middle=true]:text-neutral-900 data-[range-start=true]:rounded-md data-[range-start=true]:bg-neutral-900 data-[range-start=true]:text-neutral-50 data-[selected-single=true]:bg-neutral-900 data-[selected-single=true]:text-neutral-50 dark:data-[range-end=true]:bg-neutral-50 dark:data-[range-end=true]:text-neutral-900 dark:data-[range-middle=true]:bg-neutral-800 dark:data-[range-middle=true]:text-neutral-50 dark:data-[range-start=true]:bg-neutral-50 dark:data-[range-start=true]:text-neutral-900 dark:data-[selected-single=true]:bg-neutral-50 dark:data-[selected-single=true]:text-neutral-900 [&>span]:text-xs [&>span]:opacity-70\",\r\n defaultClassNames.day,\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nexport {Calendar, CalendarDayButton};\r\n"],"names":["Calendar","className","classNames","showOutsideDays","captionLayout","buttonVariant","formatters","components","props","defaultClassNames","getDefaultClassNames","DayPicker","cn","String","date","buttonVariants","rootRef","orientation","ChevronLeftIcon","ChevronRightIcon","ChevronDownIcon","CalendarDayButton","children","day","modifiers","ref","React","Button"],"mappings":";;;;;;;AASA,SAASA,SAAS,EAChBC,SAAS,EACTC,UAAU,EACVC,kBAAkB,IAAI,EACtBC,gBAAgB,OAAO,EACvBC,gBAAgB,OAAO,EACvBC,UAAU,EACVC,UAAU,EACV,GAAGC,OAGJ;IACC,MAAMC,oBAAoBC;IAE1B,OAAO,WAAP,GACE,IAACC,WAASA;QACR,iBAAiBR;QACjB,WAAWS,GACT,iKACAC,OAAO,GAAG,CAAC,yCAAyC,CAAC,EACrDA,OAAO,GAAG,CAAC,6CAA6C,CAAC,EACzDZ;QAEF,eAAeG;QACf,YAAY;YACV,qBAAqB,CAACU,OAASA,KAAK,cAAc,CAAC,WAAW;oBAAC,OAAO;gBAAO;YAC7E,GAAGR,UAAU;QACf;QACA,YAAY;YACV,MAAMM,GAAG,SAASH,kBAAkB,IAAI;YACxC,QAAQG,GAAG,4CAA4CH,kBAAkB,MAAM;YAC/E,OAAOG,GAAG,8BAA8BH,kB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1
|
import * as React from "react";
|
|
2
|
-
declare
|
|
3
|
-
declare
|
|
4
|
-
declare
|
|
5
|
-
declare
|
|
6
|
-
declare
|
|
7
|
-
declare
|
|
8
|
-
|
|
9
|
-
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
|
2
|
+
declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
3
|
+
declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
10
9
|
//# sourceMappingURL=card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/ui/card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/ui/card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,IAAI,6GASR,CAAC;AAGH,QAAA,MAAM,UAAU,6GAMd,CAAC;AAGH,QAAA,MAAM,SAAS,6GAMb,CAAC;AAGH,QAAA,MAAM,eAAe,6GAMnB,CAAC;AAGH,QAAA,MAAM,WAAW,6GAMf,CAAC;AAGH,QAAA,MAAM,UAAU,6GAMd,CAAC;AAGH,OAAO,EAAC,IAAI,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAC,CAAC"}
|
|
@@ -1,56 +1,43 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import "react";
|
|
4
|
-
import { cn } from "../../lib/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
className: cn("bg-white text-neutral-950 flex flex-col gap-6 rounded-xl border border-neutral-200 py-6 shadow-sm dark:bg-neutral-950 dark:text-neutral-50 dark:border-neutral-800", className),
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { cn } from "../../lib/utilities.js";
|
|
5
|
+
const Card = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
|
|
6
|
+
ref: ref,
|
|
7
|
+
className: cn("rounded-xl border border-neutral-200 bg-white text-neutral-950 shadow dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50", className),
|
|
9
8
|
...props
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
className: cn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6", className),
|
|
9
|
+
}));
|
|
10
|
+
Card.displayName = "Card";
|
|
11
|
+
const CardHeader = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
|
|
12
|
+
ref: ref,
|
|
13
|
+
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
16
14
|
...props
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
className: cn("leading-none font-semibold", className),
|
|
15
|
+
}));
|
|
16
|
+
CardHeader.displayName = "CardHeader";
|
|
17
|
+
const CardTitle = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
|
|
18
|
+
ref: ref,
|
|
19
|
+
className: cn("leading-none font-semibold tracking-tight", className),
|
|
23
20
|
...props
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
className: cn("text-neutral-500 text-sm dark:text-neutral-400", className),
|
|
21
|
+
}));
|
|
22
|
+
CardTitle.displayName = "CardTitle";
|
|
23
|
+
const CardDescription = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
|
|
24
|
+
ref: ref,
|
|
25
|
+
className: cn("text-sm text-neutral-500 dark:text-neutral-400", className),
|
|
30
26
|
...props
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className),
|
|
27
|
+
}));
|
|
28
|
+
CardDescription.displayName = "CardDescription";
|
|
29
|
+
const CardContent = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
|
|
30
|
+
ref: ref,
|
|
31
|
+
className: cn("p-6 pt-0", className),
|
|
37
32
|
...props
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
className: cn("px-6", className),
|
|
33
|
+
}));
|
|
34
|
+
CardContent.displayName = "CardContent";
|
|
35
|
+
const CardFooter = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
|
|
36
|
+
ref: ref,
|
|
37
|
+
className: cn("flex items-center p-6 pt-0", className),
|
|
44
38
|
...props
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return /*#__PURE__*/ jsx("div", {
|
|
49
|
-
"data-slot": "card-footer",
|
|
50
|
-
className: cn("flex items-center px-6 [.border-t]:pt-6", className),
|
|
51
|
-
...props
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
39
|
+
}));
|
|
40
|
+
CardFooter.displayName = "CardFooter";
|
|
41
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
55
42
|
|
|
56
43
|
//# sourceMappingURL=card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\ui\\card.js","sources":["webpack://@arolariu/components/./src/components/ui/card.tsx"],"sourcesContent":["\n\nimport * as React from \"react\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"components\\ui\\card.js","sources":["webpack://@arolariu/components/./src/components/ui/card.tsx"],"sourcesContent":["\r\n\r\nimport * as React from \"react\";\r\n\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\nconst Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({className, ...props}, ref) => (\r\n <div\r\n ref={ref}\r\n className={cn(\r\n \"rounded-xl border border-neutral-200 bg-white text-neutral-950 shadow dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n));\r\nCard.displayName = \"Card\";\r\n\r\nconst CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({className, ...props}, ref) => (\r\n <div\r\n ref={ref}\r\n className={cn(\"flex flex-col space-y-1.5 p-6\", className)}\r\n {...props}\r\n />\r\n));\r\nCardHeader.displayName = \"CardHeader\";\r\n\r\nconst CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({className, ...props}, ref) => (\r\n <div\r\n ref={ref}\r\n className={cn(\"leading-none font-semibold tracking-tight\", className)}\r\n {...props}\r\n />\r\n));\r\nCardTitle.displayName = \"CardTitle\";\r\n\r\nconst CardDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({className, ...props}, ref) => (\r\n <div\r\n ref={ref}\r\n className={cn(\"text-sm text-neutral-500 dark:text-neutral-400\", className)}\r\n {...props}\r\n />\r\n));\r\nCardDescription.displayName = \"CardDescription\";\r\n\r\nconst CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({className, ...props}, ref) => (\r\n <div\r\n ref={ref}\r\n className={cn(\"p-6 pt-0\", className)}\r\n {...props}\r\n />\r\n));\r\nCardContent.displayName = \"CardContent\";\r\n\r\nconst CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({className, ...props}, ref) => (\r\n <div\r\n ref={ref}\r\n className={cn(\"flex items-center p-6 pt-0\", className)}\r\n {...props}\r\n />\r\n));\r\nCardFooter.displayName = \"CardFooter\";\r\n\r\nexport {Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle};\r\n"],"names":["Card","React","className","props","ref","cn","CardHeader","CardTitle","CardDescription","CardContent","CardFooter"],"mappings":";;;;AAMA,MAAMA,OAAO,WAAPA,GAAOC,WAAuE,CAAC,EAACC,SAAS,EAAE,GAAGC,OAAM,EAAEC,MAAAA,WAAAA,GAC1G,IAAC;QACC,KAAKA;QACL,WAAWC,GACT,0IACAH;QAED,GAAGC,KAAK;;AAGbH,KAAK,WAAW,GAAG;AAEnB,MAAMM,aAAa,WAAbA,GAAaL,WAAuE,CAAC,EAACC,SAAS,EAAE,GAAGC,OAAM,EAAEC,MAAAA,WAAAA,GAChH,IAAC;QACC,KAAKA;QACL,WAAWC,GAAG,iCAAiCH;QAC9C,GAAGC,KAAK;;AAGbG,WAAW,WAAW,GAAG;AAEzB,MAAMC,YAAY,WAAZA,GAAYN,WAAuE,CAAC,EAACC,SAAS,EAAE,GAAGC,OAAM,EAAEC,MAAAA,WAAAA,GAC/G,IAAC;QACC,KAAKA;QACL,WAAWC,GAAG,6CAA6CH;QAC1D,GAAGC,KAAK;;AAGbI,UAAU,WAAW,GAAG;AAExB,MAAMC,kBAAkB,WAAlBA,GAAkBP,WAAuE,CAAC,EAACC,SAAS,EAAE,GAAGC,OAAM,EAAEC,MAAAA,WAAAA,GACrH,IAAC;QACC,KAAKA;QACL,WAAWC,GAAG,kDAAkDH;QAC/D,GAAGC,KAAK;;AAGbK,gBAAgB,WAAW,GAAG;AAE9B,MAAMC,cAAc,WAAdA,GAAcR,WAAuE,CAAC,EAACC,SAAS,EAAE,GAAGC,OAAM,EAAEC,MAAAA,WAAAA,GACjH,IAAC;QACC,KAAKA;QACL,WAAWC,GAAG,YAAYH;QACzB,GAAGC,KAAK;;AAGbM,YAAY,WAAW,GAAG;AAE1B,MAAMC,aAAa,WAAbA,GAAaT,WAAuE,CAAC,EAACC,SAAS,EAAE,GAAGC,OAAM,EAAEC,MAAAA,WAAAA,GAChH,IAAC;QACC,KAAKA;QACL,WAAWC,GAAG,8BAA8BH;QAC3C,GAAGC,KAAK;;AAGbO,WAAW,WAAW,GAAG"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
|
|
3
|
-
import
|
|
2
|
+
import * as React from "react";
|
|
4
3
|
type CarouselApi = UseEmblaCarouselType[1];
|
|
5
4
|
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
6
5
|
type CarouselOptions = UseCarouselParameters[0];
|
|
@@ -11,10 +10,10 @@ type CarouselProps = {
|
|
|
11
10
|
orientation?: "horizontal" | "vertical";
|
|
12
11
|
setApi?: (api: CarouselApi) => void;
|
|
13
12
|
};
|
|
14
|
-
declare
|
|
15
|
-
declare
|
|
16
|
-
declare
|
|
17
|
-
declare
|
|
18
|
-
declare
|
|
19
|
-
export {
|
|
13
|
+
declare const Carousel: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & CarouselProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
declare const CarouselContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
declare const CarouselItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
declare const CarouselPrevious: React.ForwardRefExoticComponent<Omit<import("./button").ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
declare const CarouselNext: React.ForwardRefExoticComponent<Omit<import("./button").ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type CarouselApi };
|
|
20
19
|
//# sourceMappingURL=carousel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../src/components/ui/carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../src/components/ui/carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,gBAAgB,EAAE,EAAC,KAAK,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAEjF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,KAAK,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACjE,KAAK,eAAe,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAChD,KAAK,cAAc,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAE/C,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,CAAC;CACrC,CAAC;AAuBF,QAAA,MAAM,QAAQ,6HAwFb,CAAC;AAGF,QAAA,MAAM,eAAe,6GAcnB,CAAC;AAGH,QAAA,MAAM,YAAY,6GAYhB,CAAC;AAGH,QAAA,MAAM,gBAAgB,8KAsBrB,CAAC;AAGF,QAAA,MAAM,YAAY,8KAsBjB,CAAC;AAGF,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,KAAK,WAAW,EAAC,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useCallback, useContext, useEffect, useState } from "react";
|
|
4
3
|
import embla_carousel_react from "embla-carousel-react";
|
|
5
4
|
import { ArrowLeft, ArrowRight } from "lucide-react";
|
|
6
|
-
import {
|
|
5
|
+
import { createContext, forwardRef, useCallback, useContext, useEffect, useState } from "react";
|
|
7
6
|
import { Button } from "./button.js";
|
|
7
|
+
import { cn } from "../../lib/utilities.js";
|
|
8
8
|
const CarouselContext = /*#__PURE__*/ createContext(null);
|
|
9
9
|
function useCarousel() {
|
|
10
10
|
const context = useContext(CarouselContext);
|
|
11
11
|
if (!context) throw new Error("useCarousel must be used within a <Carousel />");
|
|
12
12
|
return context;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
const Carousel = /*#__PURE__*/ forwardRef(({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }, ref)=>{
|
|
15
15
|
const [carouselRef, api] = embla_carousel_react({
|
|
16
16
|
...opts,
|
|
17
17
|
axis: "horizontal" === orientation ? "x" : "y"
|
|
@@ -76,76 +76,85 @@ function Carousel({ orientation = "horizontal", opts, setApi, plugins, className
|
|
|
76
76
|
canScrollNext
|
|
77
77
|
},
|
|
78
78
|
children: /*#__PURE__*/ jsx("div", {
|
|
79
|
+
ref: ref,
|
|
79
80
|
onKeyDownCapture: handleKeyDown,
|
|
80
81
|
className: cn("relative", className),
|
|
81
82
|
role: "region",
|
|
82
83
|
"aria-roledescription": "carousel",
|
|
83
|
-
"data-slot": "carousel",
|
|
84
84
|
...props,
|
|
85
85
|
children: children
|
|
86
86
|
})
|
|
87
87
|
});
|
|
88
|
-
}
|
|
89
|
-
|
|
88
|
+
});
|
|
89
|
+
Carousel.displayName = "Carousel";
|
|
90
|
+
const CarouselContent = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
|
|
90
91
|
const { carouselRef, orientation } = useCarousel();
|
|
91
92
|
return /*#__PURE__*/ jsx("div", {
|
|
92
93
|
ref: carouselRef,
|
|
93
94
|
className: "overflow-hidden",
|
|
94
|
-
"data-slot": "carousel-content",
|
|
95
95
|
children: /*#__PURE__*/ jsx("div", {
|
|
96
|
+
ref: ref,
|
|
96
97
|
className: cn("flex", "horizontal" === orientation ? "-ml-4" : "-mt-4 flex-col", className),
|
|
97
98
|
...props
|
|
98
99
|
})
|
|
99
100
|
});
|
|
100
|
-
}
|
|
101
|
-
|
|
101
|
+
});
|
|
102
|
+
CarouselContent.displayName = "CarouselContent";
|
|
103
|
+
const CarouselItem = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
|
|
102
104
|
const { orientation } = useCarousel();
|
|
103
105
|
return /*#__PURE__*/ jsx("div", {
|
|
106
|
+
ref: ref,
|
|
104
107
|
role: "group",
|
|
105
108
|
"aria-roledescription": "slide",
|
|
106
|
-
"data-slot": "carousel-item",
|
|
107
109
|
className: cn("min-w-0 shrink-0 grow-0 basis-full", "horizontal" === orientation ? "pl-4" : "pt-4", className),
|
|
108
110
|
...props
|
|
109
111
|
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
+
});
|
|
113
|
+
CarouselItem.displayName = "CarouselItem";
|
|
114
|
+
const CarouselPrevious = /*#__PURE__*/ forwardRef(({ className, variant = "outline", size = "icon", ...props }, ref)=>{
|
|
112
115
|
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
113
116
|
return /*#__PURE__*/ jsxs(Button, {
|
|
114
|
-
|
|
117
|
+
ref: ref,
|
|
115
118
|
variant: variant,
|
|
116
119
|
size: size,
|
|
117
|
-
className: cn("absolute
|
|
120
|
+
className: cn("absolute h-8 w-8 rounded-full", "horizontal" === orientation ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90", className),
|
|
118
121
|
disabled: !canScrollPrev,
|
|
119
122
|
onClick: scrollPrev,
|
|
120
123
|
...props,
|
|
121
124
|
children: [
|
|
122
|
-
/*#__PURE__*/ jsx(ArrowLeft, {
|
|
125
|
+
/*#__PURE__*/ jsx(ArrowLeft, {
|
|
126
|
+
className: "h-4 w-4"
|
|
127
|
+
}),
|
|
123
128
|
/*#__PURE__*/ jsx("span", {
|
|
124
129
|
className: "sr-only",
|
|
125
130
|
children: "Previous slide"
|
|
126
131
|
})
|
|
127
132
|
]
|
|
128
133
|
});
|
|
129
|
-
}
|
|
130
|
-
|
|
134
|
+
});
|
|
135
|
+
CarouselPrevious.displayName = "CarouselPrevious";
|
|
136
|
+
const CarouselNext = /*#__PURE__*/ forwardRef(({ className, variant = "outline", size = "icon", ...props }, ref)=>{
|
|
131
137
|
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
132
138
|
return /*#__PURE__*/ jsxs(Button, {
|
|
133
|
-
|
|
139
|
+
ref: ref,
|
|
134
140
|
variant: variant,
|
|
135
141
|
size: size,
|
|
136
|
-
className: cn("absolute
|
|
142
|
+
className: cn("absolute h-8 w-8 rounded-full", "horizontal" === orientation ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className),
|
|
137
143
|
disabled: !canScrollNext,
|
|
138
144
|
onClick: scrollNext,
|
|
139
145
|
...props,
|
|
140
146
|
children: [
|
|
141
|
-
/*#__PURE__*/ jsx(ArrowRight, {
|
|
147
|
+
/*#__PURE__*/ jsx(ArrowRight, {
|
|
148
|
+
className: "h-4 w-4"
|
|
149
|
+
}),
|
|
142
150
|
/*#__PURE__*/ jsx("span", {
|
|
143
151
|
className: "sr-only",
|
|
144
152
|
children: "Next slide"
|
|
145
153
|
})
|
|
146
154
|
]
|
|
147
155
|
});
|
|
148
|
-
}
|
|
156
|
+
});
|
|
157
|
+
CarouselNext.displayName = "CarouselNext";
|
|
149
158
|
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious };
|
|
150
159
|
|
|
151
160
|
//# sourceMappingURL=carousel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components\\ui\\carousel.js","sources":["webpack://@arolariu/components/./src/components/ui/carousel.tsx"],"sourcesContent":["\n\nimport * as React from \"react\";\nimport useEmblaCarousel, {\n type UseEmblaCarouselType,\n} from \"embla-carousel-react\";\nimport { ArrowLeft, ArrowRight } from \"lucide-react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Button } from \"@/components/ui/button\";\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\n orientation?: \"horizontal\" | \"vertical\";\n setApi?: (api: CarouselApi) => void;\n};\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: ReturnType<typeof useEmblaCarousel>[1];\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n} & CarouselProps;\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext);\n\n if (!context) {\n throw new Error(\"useCarousel must be used within a <Carousel />\");\n }\n\n return context;\n}\n\nfunction Carousel({\n orientation = \"horizontal\",\n opts,\n setApi,\n plugins,\n className,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & CarouselProps) {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === \"horizontal\" ? \"x\" : \"y\",\n },\n plugins,\n );\n const [canScrollPrev, setCanScrollPrev] = React.useState(false);\n const [canScrollNext, setCanScrollNext] = React.useState(false);\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) return;\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n }, []);\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === \"ArrowRight\") {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n React.useEffect(() => {\n if (!api || !setApi) return;\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) return;\n onSelect(api);\n api.on(\"reInit\", onSelect);\n api.on(\"select\", onSelect);\n\n return () => {\n api?.off(\"select\", onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation:\n orientation || (opts?.axis === \"y\" ? \"vertical\" : \"horizontal\"),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n onKeyDownCapture={handleKeyDown}\n className={cn(\"relative\", className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n data-slot=\"carousel\"\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n}\n\nfunction CarouselContent({ className, ...props }: React.ComponentProps<\"div\">) {\n const { carouselRef, orientation } = useCarousel();\n\n return (\n <div\n ref={carouselRef}\n className=\"overflow-hidden\"\n data-slot=\"carousel-content\"\n >\n <div\n className={cn(\n \"flex\",\n orientation === \"horizontal\" ? \"-ml-4\" : \"-mt-4 flex-col\",\n className,\n )}\n {...props}\n />\n </div>\n );\n}\n\nfunction CarouselItem({ className, ...props }: React.ComponentProps<\"div\">) {\n const { orientation } = useCarousel();\n\n return (\n <div\n role=\"group\"\n aria-roledescription=\"slide\"\n data-slot=\"carousel-item\"\n className={cn(\n \"min-w-0 shrink-0 grow-0 basis-full\",\n orientation === \"horizontal\" ? \"pl-4\" : \"pt-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CarouselPrevious({\n className,\n variant = \"outline\",\n size = \"icon\",\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n data-slot=\"carousel-previous\"\n variant={variant}\n size={size}\n className={cn(\n \"absolute size-8 rounded-full\",\n orientation === \"horizontal\"\n ? \"top-1/2 -left-12 -translate-y-1/2\"\n : \"-top-12 left-1/2 -translate-x-1/2 rotate-90\",\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ArrowLeft />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n}\n\nfunction CarouselNext({\n className,\n variant = \"outline\",\n size = \"icon\",\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n data-slot=\"carousel-next\"\n variant={variant}\n size={size}\n className={cn(\n \"absolute size-8 rounded-full\",\n orientation === \"horizontal\"\n ? \"top-1/2 -right-12 -translate-y-1/2\"\n : \"-bottom-12 left-1/2 -translate-x-1/2 rotate-90\",\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ArrowRight />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n}\n\nexport {\n type CarouselApi,\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselPrevious,\n CarouselNext,\n};\n"],"names":["CarouselContext","React","useCarousel","context","Error","Carousel","orientation","opts","setApi","plugins","className","children","props","carouselRef","api","useEmblaCarousel","canScrollPrev","setCanScrollPrev","canScrollNext","setCanScrollNext","onSelect","scrollPrev","scrollNext","handleKeyDown","event","cn","CarouselContent","CarouselItem","CarouselPrevious","variant","size","Button","ArrowLeft","CarouselNext","ArrowRight"],"mappings":";;;;;;;AAgCA,MAAMA,kBAAkB,WAAlBA,GAAkBC,cAAiD;AAEzE,SAASC;IACP,MAAMC,UAAUF,WAAiBD;IAEjC,IAAI,CAACG,SACH,MAAM,IAAIC,MAAM;IAGlB,OAAOD;AACT;AAEA,SAASE,SAAS,EAChBC,cAAc,YAAY,EAC1BC,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,QAAQ,EACR,GAAGC,OACyC;IAC5C,MAAM,CAACC,aAAaC,IAAI,GAAGC,qBACzB;QACE,GAAGR,IAAI;QACP,MAAMD,iBAAAA,cAA+B,MAAM;IAC7C,GACAG;IAEF,MAAM,CAACO,eAAeC,iBAAiB,GAAGhB,SAAe;IACzD,MAAM,CAACiB,eAAeC,iBAAiB,GAAGlB,SAAe;IAEzD,MAAMmB,WAAWnB,YAAkB,CAACa;QAClC,IAAI,CAACA,KAAK;QACVG,iBAAiBH,IAAI,aAAa;QAClCK,iBAAiBL,IAAI,aAAa;IACpC,GAAG,EAAE;IAEL,MAAMO,aAAapB,YAAkB;QACnCa,KAAK;IACP,GAAG;QAACA;KAAI;IAER,MAAMQ,aAAarB,YAAkB;QACnCa,KAAK;IACP,GAAG;QAACA;KAAI;IAER,MAAMS,gBAAgBtB,YACpB,CAACuB;QACC,IAAIA,gBAAAA,MAAM,GAAG,EAAkB;YAC7BA,MAAM,cAAc;YACpBH;QACF,OAAO,IAAIG,iBAAAA,MAAM,GAAG,EAAmB;YACrCA,MAAM,cAAc;YACpBF;QACF;IACF,GACA;QAACD;QAAYC;KAAW;IAG1BrB,UAAgB;QACd,IAAI,CAACa,OAAO,CAACN,QAAQ;QACrBA,OAAOM;IACT,GAAG;QAACA;QAAKN;KAA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WAAWL,GACT,gCACAnB,iBAAAA,cACI,sCACA,+CACJI;QAEF,UAAU,CAACM;QACX,SAASK;QACR,GAAGT,KAAK;;0BAET,IAACoB,WAASA,CAAAA;0BACV,IAAC;gBAAK,WAAU;0BAAU;;;;AAGhC;AAEA,SAASC,aAAa,EACpBvB,SAAS,EACTmB,UAAU,SAAS,EACnBC,OAAO,MAAM,EACb,GAAGlB,OACiC;IACpC,MAAM,EAAEN,WAAW,EAAEgB,UAAU,EAAEJ,aAAa,EAAE,GAAGhB;IAEnD,OAAO,WAAP,GACE,KAAC6B,QAAMA;QACL,aAAU;QACV,SAASF;QACT,MAAMC;QACN,WAAWL,GACT,gCACAnB,iBAAAA,cACI,uCACA,kDACJI;QAEF,UAAU,CAACQ;QACX,SAASI;QACR,GAAGV,KAAK;;0BAET,IAACsB,YAAUA,CAAAA;0BACX,IAAC;gBAAK,WAAU;0BAAU;;;;AAGhC"}
|
|
1
|
+
{"version":3,"file":"components\\ui\\carousel.js","sources":["webpack://@arolariu/components/./src/components/ui/carousel.tsx"],"sourcesContent":["\r\n\r\nimport useEmblaCarousel, {type UseEmblaCarouselType} from \"embla-carousel-react\";\r\nimport {ArrowLeft, ArrowRight} from \"lucide-react\";\r\nimport * as React from \"react\";\r\n\r\nimport {Button} from \"@/components/ui/button\";\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\ntype CarouselApi = UseEmblaCarouselType[1];\r\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\r\ntype CarouselOptions = UseCarouselParameters[0];\r\ntype CarouselPlugin = UseCarouselParameters[1];\r\n\r\ntype CarouselProps = {\r\n opts?: CarouselOptions;\r\n plugins?: CarouselPlugin;\r\n orientation?: \"horizontal\" | \"vertical\";\r\n setApi?: (api: CarouselApi) => void;\r\n};\r\n\r\ntype CarouselContextProps = {\r\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\r\n api: ReturnType<typeof useEmblaCarousel>[1];\r\n scrollPrev: () => void;\r\n scrollNext: () => void;\r\n canScrollPrev: boolean;\r\n canScrollNext: boolean;\r\n} & CarouselProps;\r\n\r\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\r\n\r\nfunction useCarousel() {\r\n const context = React.useContext(CarouselContext);\r\n\r\n if (!context) {\r\n throw new Error(\"useCarousel must be used within a <Carousel />\");\r\n }\r\n\r\n return context;\r\n}\r\n\r\nconst Carousel = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & CarouselProps>(\r\n ({orientation = \"horizontal\", opts, setApi, plugins, className, children, ...props}, ref) => {\r\n const [carouselRef, api] = useEmblaCarousel(\r\n {\r\n ...opts,\r\n axis: orientation === \"horizontal\" ? \"x\" : \"y\",\r\n },\r\n plugins,\r\n );\r\n const [canScrollPrev, setCanScrollPrev] = React.useState(false);\r\n const [canScrollNext, setCanScrollNext] = React.useState(false);\r\n\r\n const onSelect = React.useCallback((api: CarouselApi) => {\r\n if (!api) {\r\n return;\r\n }\r\n\r\n setCanScrollPrev(api.canScrollPrev());\r\n setCanScrollNext(api.canScrollNext());\r\n }, []);\r\n\r\n const scrollPrev = React.useCallback(() => {\r\n api?.scrollPrev();\r\n }, [api]);\r\n\r\n const scrollNext = React.useCallback(() => {\r\n api?.scrollNext();\r\n }, [api]);\r\n\r\n const handleKeyDown = React.useCallback(\r\n (event: React.KeyboardEvent<HTMLDivElement>) => {\r\n if (event.key === \"ArrowLeft\") {\r\n event.preventDefault();\r\n scrollPrev();\r\n } else if (event.key === \"ArrowRight\") {\r\n event.preventDefault();\r\n scrollNext();\r\n }\r\n },\r\n [scrollPrev, scrollNext],\r\n );\r\n\r\n React.useEffect(() => {\r\n if (!api || !setApi) {\r\n return;\r\n }\r\n\r\n setApi(api);\r\n }, [api, setApi]);\r\n\r\n React.useEffect(() => {\r\n if (!api) {\r\n return;\r\n }\r\n\r\n onSelect(api);\r\n api.on(\"reInit\", onSelect);\r\n api.on(\"select\", onSelect);\r\n\r\n return () => {\r\n api?.off(\"select\", onSelect);\r\n };\r\n }, [api, onSelect]);\r\n\r\n return (\r\n <CarouselContext.Provider\r\n value={{\r\n carouselRef,\r\n api: api,\r\n opts,\r\n orientation: orientation || (opts?.axis === \"y\" ? \"vertical\" : \"horizontal\"),\r\n scrollPrev,\r\n scrollNext,\r\n canScrollPrev,\r\n canScrollNext,\r\n }}>\r\n <div\r\n ref={ref}\r\n onKeyDownCapture={handleKeyDown}\r\n className={cn(\"relative\", className)}\r\n role='region'\r\n aria-roledescription='carousel'\r\n {...props}>\r\n {children}\r\n </div>\r\n </CarouselContext.Provider>\r\n );\r\n },\r\n);\r\nCarousel.displayName = \"Carousel\";\r\n\r\nconst CarouselContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({className, ...props}, ref) => {\r\n const {carouselRef, orientation} = useCarousel();\r\n\r\n return (\r\n <div\r\n ref={carouselRef}\r\n className='overflow-hidden'>\r\n <div\r\n ref={ref}\r\n className={cn(\"flex\", orientation === \"horizontal\" ? \"-ml-4\" : \"-mt-4 flex-col\", className)}\r\n {...props}\r\n />\r\n </div>\r\n );\r\n});\r\nCarouselContent.displayName = \"CarouselContent\";\r\n\r\nconst CarouselItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({className, ...props}, ref) => {\r\n const {orientation} = useCarousel();\r\n\r\n return (\r\n <div\r\n ref={ref}\r\n role='group'\r\n aria-roledescription='slide'\r\n className={cn(\"min-w-0 shrink-0 grow-0 basis-full\", orientation === \"horizontal\" ? \"pl-4\" : \"pt-4\", className)}\r\n {...props}\r\n />\r\n );\r\n});\r\nCarouselItem.displayName = \"CarouselItem\";\r\n\r\nconst CarouselPrevious = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button>>(\r\n ({className, variant = \"outline\", size = \"icon\", ...props}, ref) => {\r\n const {orientation, scrollPrev, canScrollPrev} = useCarousel();\r\n\r\n return (\r\n <Button\r\n ref={ref}\r\n variant={variant}\r\n size={size}\r\n className={cn(\r\n \"absolute h-8 w-8 rounded-full\",\r\n orientation === \"horizontal\" ? \"top-1/2 -left-12 -translate-y-1/2\" : \"-top-12 left-1/2 -translate-x-1/2 rotate-90\",\r\n className,\r\n )}\r\n disabled={!canScrollPrev}\r\n onClick={scrollPrev}\r\n {...props}>\r\n <ArrowLeft className='h-4 w-4' />\r\n <span className='sr-only'>Previous slide</span>\r\n </Button>\r\n );\r\n },\r\n);\r\nCarouselPrevious.displayName = \"CarouselPrevious\";\r\n\r\nconst CarouselNext = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button>>(\r\n ({className, variant = \"outline\", size = \"icon\", ...props}, ref) => {\r\n const {orientation, scrollNext, canScrollNext} = useCarousel();\r\n\r\n return (\r\n <Button\r\n ref={ref}\r\n variant={variant}\r\n size={size}\r\n className={cn(\r\n \"absolute h-8 w-8 rounded-full\",\r\n orientation === \"horizontal\" ? \"top-1/2 -right-12 -translate-y-1/2\" : \"-bottom-12 left-1/2 -translate-x-1/2 rotate-90\",\r\n className,\r\n )}\r\n disabled={!canScrollNext}\r\n onClick={scrollNext}\r\n {...props}>\r\n <ArrowRight className='h-4 w-4' />\r\n <span className='sr-only'>Next slide</span>\r\n </Button>\r\n );\r\n },\r\n);\r\nCarouselNext.displayName = \"CarouselNext\";\r\n\r\nexport {Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type CarouselApi};\r\n"],"names":["CarouselContext","React","useCarousel","context","Error","Carousel","orientation","opts","setApi","plugins","className","children","props","ref","carouselRef","api","useEmblaCarousel","canScrollPrev","setCanScrollPrev","canScrollNext","setCanScrollNext","onSelect","scrollPrev","scrollNext","handleKeyDown","event","cn","CarouselContent","CarouselItem","CarouselPrevious","variant","size","Button","ArrowLeft","CarouselNext","ArrowRight"],"mappings":";;;;;;;AA8BA,MAAMA,kBAAkB,WAAlBA,GAAkBC,cAAiD;AAEzE,SAASC;IACP,MAAMC,UAAUF,WAAiBD;IAEjC,IAAI,CAACG,SACH,MAAM,IAAIC,MAAM;IAGl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