@stevederico/skateboard-ui 3.11.0 → 4.0.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/CHANGELOG.md +17 -0
- package/README.md +37 -31
- package/dist/shadcn/ui/accordion.d.ts +1 -6
- package/dist/shadcn/ui/accordion.js +3 -17
- package/dist/shadcn/ui/alert-dialog.d.ts +1 -18
- package/dist/shadcn/ui/alert-dialog.js +3 -43
- package/dist/shadcn/ui/alert.d.ts +1 -13
- package/dist/shadcn/ui/alert.js +3 -28
- package/dist/shadcn/ui/aspect-ratio.d.ts +1 -4
- package/dist/shadcn/ui/aspect-ratio.js +3 -8
- package/dist/shadcn/ui/avatar.d.ts +1 -11
- package/dist/shadcn/ui/avatar.js +3 -24
- package/dist/shadcn/ui/badge.d.ts +1 -14
- package/dist/shadcn/ui/badge.js +3 -33
- package/dist/shadcn/ui/breadcrumb.d.ts +1 -10
- package/dist/shadcn/ui/breadcrumb.js +3 -37
- package/dist/shadcn/ui/button-group.d.ts +1 -13
- package/dist/shadcn/ui/button-group.js +3 -36
- package/dist/shadcn/ui/button.d.ts +1 -34
- package/dist/shadcn/ui/button.js +3 -48
- package/dist/shadcn/ui/calendar.d.ts +1 -13
- package/dist/shadcn/ui/calendar.js +3 -75
- package/dist/shadcn/ui/card.d.ts +1 -11
- package/dist/shadcn/ui/card.js +3 -25
- package/dist/shadcn/ui/checkbox.d.ts +1 -3
- package/dist/shadcn/ui/checkbox.js +3 -9
- package/dist/shadcn/ui/collapsible.d.ts +1 -5
- package/dist/shadcn/ui/collapsible.js +3 -13
- package/dist/shadcn/ui/command.d.ts +1 -19
- package/dist/shadcn/ui/command.js +3 -35
- package/dist/shadcn/ui/context-menu.d.ts +1 -29
- package/dist/shadcn/ui/context-menu.js +3 -52
- package/dist/shadcn/ui/dialog.d.ts +1 -17
- package/dist/shadcn/ui/dialog.js +3 -38
- package/dist/shadcn/ui/drawer.d.ts +1 -13
- package/dist/shadcn/ui/drawer.js +3 -196
- package/dist/shadcn/ui/dropdown-menu.d.ts +1 -29
- package/dist/shadcn/ui/dropdown-menu.js +3 -52
- package/dist/shadcn/ui/empty.d.ts +1 -14
- package/dist/shadcn/ui/empty.js +3 -33
- package/dist/shadcn/ui/field.d.ts +1 -28
- package/dist/shadcn/ui/field.js +3 -68
- package/dist/shadcn/ui/hover-card.d.ts +1 -5
- package/dist/shadcn/ui/hover-card.js +3 -14
- package/dist/shadcn/ui/input-group.d.ts +1 -28
- package/dist/shadcn/ui/input-group.js +3 -58
- package/dist/shadcn/ui/input.d.ts +1 -3
- package/dist/shadcn/ui/input.js +3 -8
- package/dist/shadcn/ui/item.d.ts +1 -34
- package/dist/shadcn/ui/item.js +3 -79
- package/dist/shadcn/ui/kbd.d.ts +1 -3
- package/dist/shadcn/ui/kbd.js +3 -9
- package/dist/shadcn/ui/label.d.ts +1 -3
- package/dist/shadcn/ui/label.js +3 -8
- package/dist/shadcn/ui/menubar.d.ts +1 -29
- package/dist/shadcn/ui/menubar.js +3 -57
- package/dist/shadcn/ui/navigation-menu.d.ts +1 -13
- package/dist/shadcn/ui/navigation-menu.js +3 -31
- package/dist/shadcn/ui/pagination.d.ts +1 -17
- package/dist/shadcn/ui/pagination.js +3 -27
- package/dist/shadcn/ui/popover.d.ts +1 -9
- package/dist/shadcn/ui/popover.js +3 -24
- package/dist/shadcn/ui/progress.d.ts +1 -7
- package/dist/shadcn/ui/progress.js +3 -20
- package/dist/shadcn/ui/radio-group.d.ts +1 -5
- package/dist/shadcn/ui/radio-group.js +3 -12
- package/dist/shadcn/ui/scroll-area.d.ts +1 -5
- package/dist/shadcn/ui/scroll-area.js +3 -12
- package/dist/shadcn/ui/select.d.ts +1 -15
- package/dist/shadcn/ui/select.js +3 -35
- package/dist/shadcn/ui/separator.d.ts +1 -3
- package/dist/shadcn/ui/separator.js +3 -8
- package/dist/shadcn/ui/sheet.d.ts +1 -14
- package/dist/shadcn/ui/sheet.js +3 -38
- package/dist/shadcn/ui/sidebar.d.ts +1 -70
- package/dist/shadcn/ui/sidebar.js +3 -256
- package/dist/shadcn/ui/skeleton.d.ts +1 -2
- package/dist/shadcn/ui/skeleton.js +3 -6
- package/dist/shadcn/ui/slider.d.ts +1 -3
- package/dist/shadcn/ui/slider.js +3 -12
- package/dist/shadcn/ui/spinner.d.ts +1 -2
- package/dist/shadcn/ui/spinner.js +3 -7
- package/dist/shadcn/ui/switch.d.ts +1 -5
- package/dist/shadcn/ui/switch.js +3 -8
- package/dist/shadcn/ui/table.d.ts +1 -10
- package/dist/shadcn/ui/table.js +3 -29
- package/dist/shadcn/ui/tabs.d.ts +1 -13
- package/dist/shadcn/ui/tabs.js +3 -29
- package/dist/shadcn/ui/textarea.d.ts +1 -3
- package/dist/shadcn/ui/textarea.js +3 -7
- package/dist/shadcn/ui/toggle-group.d.ts +1 -11
- package/dist/shadcn/ui/toggle-group.js +3 -25
- package/dist/shadcn/ui/toggle.d.ts +1 -15
- package/dist/shadcn/ui/toggle.js +3 -26
- package/dist/shadcn/ui/tooltip.d.ts +1 -6
- package/dist/shadcn/ui/tooltip.js +3 -17
- package/dist/ui/accordion.d.ts +21 -0
- package/dist/ui/accordion.js +67 -0
- package/dist/ui/alert-dialog.d.ts +32 -0
- package/dist/ui/alert-dialog.js +102 -0
- package/dist/ui/alert.d.ts +13 -0
- package/dist/ui/alert.js +28 -0
- package/dist/ui/aspect-ratio.d.ts +5 -0
- package/dist/ui/aspect-ratio.js +9 -0
- package/dist/ui/avatar.d.ts +14 -0
- package/dist/ui/avatar.js +49 -0
- package/dist/ui/badge.d.ts +22 -0
- package/dist/ui/badge.js +26 -0
- package/dist/ui/breadcrumb.d.ts +13 -0
- package/dist/ui/breadcrumb.js +29 -0
- package/dist/ui/button-group.d.ts +21 -0
- package/dist/ui/button-group.js +29 -0
- package/dist/ui/button.d.ts +38 -0
- package/dist/ui/button.js +49 -0
- package/dist/ui/calendar.d.ts +13 -0
- package/dist/ui/calendar.js +75 -0
- package/dist/ui/card.d.ts +11 -0
- package/dist/ui/card.js +25 -0
- package/dist/ui/checkbox.d.ts +17 -0
- package/dist/ui/checkbox.js +25 -0
- package/dist/ui/collapsible.d.ts +11 -0
- package/dist/ui/collapsible.js +40 -0
- package/dist/ui/command.d.ts +19 -0
- package/dist/ui/command.js +35 -0
- package/dist/ui/context-menu.d.ts +53 -0
- package/dist/ui/context-menu.js +345 -0
- package/dist/ui/dialog.d.ts +40 -0
- package/dist/ui/dialog.js +109 -0
- package/dist/ui/drawer.d.ts +36 -0
- package/dist/ui/drawer.js +234 -0
- package/dist/ui/dropdown-menu.d.ts +61 -0
- package/dist/ui/dropdown-menu.js +323 -0
- package/dist/ui/empty.d.ts +14 -0
- package/dist/ui/empty.js +33 -0
- package/dist/ui/field.d.ts +28 -0
- package/dist/ui/field.js +68 -0
- package/dist/ui/hover-card.d.ts +32 -0
- package/dist/ui/hover-card.js +119 -0
- package/dist/ui/input-group.d.ts +28 -0
- package/dist/ui/input-group.js +58 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/input.js +7 -0
- package/dist/ui/item.d.ts +41 -0
- package/dist/ui/item.js +69 -0
- package/dist/ui/kbd.d.ts +4 -0
- package/dist/ui/kbd.js +10 -0
- package/dist/ui/label.d.ts +3 -0
- package/dist/ui/label.js +8 -0
- package/dist/ui/menubar.d.ts +59 -0
- package/dist/ui/menubar.js +384 -0
- package/dist/ui/navigation-menu.d.ts +24 -0
- package/dist/ui/navigation-menu.js +134 -0
- package/dist/ui/pagination.d.ts +17 -0
- package/dist/ui/pagination.js +36 -0
- package/dist/ui/popover.d.ts +25 -0
- package/dist/ui/popover.js +68 -0
- package/dist/ui/portal.d.ts +7 -0
- package/dist/ui/portal.js +12 -0
- package/dist/ui/progress.d.ts +15 -0
- package/dist/ui/progress.js +36 -0
- package/dist/ui/radio-group.d.ts +17 -0
- package/dist/ui/radio-group.js +54 -0
- package/dist/ui/scroll-area.d.ts +9 -0
- package/dist/ui/scroll-area.js +72 -0
- package/dist/ui/select.d.ts +37 -0
- package/dist/ui/select.js +216 -0
- package/dist/ui/separator.d.ts +14 -0
- package/dist/ui/separator.js +13 -0
- package/dist/ui/sheet.d.ts +31 -0
- package/dist/ui/sheet.js +121 -0
- package/dist/ui/sidebar.d.ts +86 -0
- package/dist/ui/sidebar.js +211 -0
- package/dist/ui/skeleton.d.ts +3 -0
- package/dist/ui/skeleton.js +7 -0
- package/dist/ui/slider.d.ts +18 -0
- package/dist/ui/slider.js +94 -0
- package/dist/ui/slot.d.ts +27 -0
- package/dist/ui/slot.js +62 -0
- package/dist/ui/spinner.d.ts +3 -0
- package/dist/ui/spinner.js +8 -0
- package/dist/ui/switch.d.ts +17 -0
- package/dist/ui/switch.js +23 -0
- package/dist/ui/table.d.ts +10 -0
- package/dist/ui/table.js +29 -0
- package/dist/ui/tabs.d.ts +29 -0
- package/dist/ui/tabs.js +82 -0
- package/dist/ui/textarea.d.ts +3 -0
- package/dist/ui/textarea.js +7 -0
- package/dist/ui/toggle-group.d.ts +23 -0
- package/dist/ui/toggle-group.js +52 -0
- package/dist/ui/toggle.d.ts +25 -0
- package/dist/ui/toggle.js +41 -0
- package/dist/ui/tooltip.d.ts +25 -0
- package/dist/ui/tooltip.js +90 -0
- package/dist/ui/use-controllable-state.d.ts +10 -0
- package/dist/ui/use-controllable-state.js +17 -0
- package/dist/ui/use-dismiss.d.ts +10 -0
- package/dist/ui/use-dismiss.js +51 -0
- package/dist/ui/use-floating.d.ts +38 -0
- package/dist/ui/use-floating.js +128 -0
- package/dist/ui/use-presence.d.ts +8 -0
- package/dist/ui/use-presence.js +48 -0
- package/package.json +6 -1
- package/dist/shadcn/lib/base-ui/LICENSE +0 -21
- package/dist/shadcn/lib/base-ui/_chunk-000kmre8.js +0 -150
- package/dist/shadcn/lib/base-ui/_chunk-1vw45v38.js +0 -64
- package/dist/shadcn/lib/base-ui/_chunk-23rx7haq.js +0 -81
- package/dist/shadcn/lib/base-ui/_chunk-242gh8ph.js +0 -230
- package/dist/shadcn/lib/base-ui/_chunk-26cc610z.js +0 -6
- package/dist/shadcn/lib/base-ui/_chunk-2z044bba.js +0 -5890
- package/dist/shadcn/lib/base-ui/_chunk-3cpd1vjz.js +0 -13
- package/dist/shadcn/lib/base-ui/_chunk-3enq1vat.js +0 -82
- package/dist/shadcn/lib/base-ui/_chunk-3xpke33f.js +0 -23
- package/dist/shadcn/lib/base-ui/_chunk-451nqgsa.js +0 -6
- package/dist/shadcn/lib/base-ui/_chunk-4maf6pas.js +0 -11
- package/dist/shadcn/lib/base-ui/_chunk-4zhfq4d3.js +0 -16
- package/dist/shadcn/lib/base-ui/_chunk-5gaqyne5.js +0 -21
- package/dist/shadcn/lib/base-ui/_chunk-5tt5hk59.js +0 -4
- package/dist/shadcn/lib/base-ui/_chunk-5tze5c8q.js +0 -13
- package/dist/shadcn/lib/base-ui/_chunk-5xmdvndx.js +0 -225
- package/dist/shadcn/lib/base-ui/_chunk-6adaer33.js +0 -435
- package/dist/shadcn/lib/base-ui/_chunk-6ejf1z1r.js +0 -9
- package/dist/shadcn/lib/base-ui/_chunk-6kqramh9.js +0 -27
- package/dist/shadcn/lib/base-ui/_chunk-7b9dc493.js +0 -14
- package/dist/shadcn/lib/base-ui/_chunk-8a9vv8am.js +0 -89
- package/dist/shadcn/lib/base-ui/_chunk-8ctgmf06.js +0 -129
- package/dist/shadcn/lib/base-ui/_chunk-8ganmsbg.js +0 -54
- package/dist/shadcn/lib/base-ui/_chunk-8xaqxgck.js +0 -15
- package/dist/shadcn/lib/base-ui/_chunk-95tf2rxq.js +0 -62
- package/dist/shadcn/lib/base-ui/_chunk-9x63vfqj.js +0 -70
- package/dist/shadcn/lib/base-ui/_chunk-ase0ydtt.js +0 -9
- package/dist/shadcn/lib/base-ui/_chunk-b0nc8wq7.js +0 -34
- package/dist/shadcn/lib/base-ui/_chunk-b5ya6xds.js +0 -10
- package/dist/shadcn/lib/base-ui/_chunk-b6dkjkbw.js +0 -43
- package/dist/shadcn/lib/base-ui/_chunk-c2bz952e.js +0 -19
- package/dist/shadcn/lib/base-ui/_chunk-cdgfsr3q.js +0 -15
- package/dist/shadcn/lib/base-ui/_chunk-cdj8cpx5.js +0 -347
- package/dist/shadcn/lib/base-ui/_chunk-cgptgywc.js +0 -104
- package/dist/shadcn/lib/base-ui/_chunk-cwvtvwc7.js +0 -35
- package/dist/shadcn/lib/base-ui/_chunk-dan0mva4.js +0 -23
- package/dist/shadcn/lib/base-ui/_chunk-dzvjwv25.js +0 -0
- package/dist/shadcn/lib/base-ui/_chunk-e13rsb6b.js +0 -184
- package/dist/shadcn/lib/base-ui/_chunk-e56mpvk1.js +0 -118
- package/dist/shadcn/lib/base-ui/_chunk-e6k2ecs7.js +0 -48
- package/dist/shadcn/lib/base-ui/_chunk-ebyxgtb4.js +0 -29
- package/dist/shadcn/lib/base-ui/_chunk-f2wttwrf.js +0 -39
- package/dist/shadcn/lib/base-ui/_chunk-fdzctasg.js +0 -38
- package/dist/shadcn/lib/base-ui/_chunk-ffpjy0ta.js +0 -39
- package/dist/shadcn/lib/base-ui/_chunk-fqry7pew.js +0 -603
- package/dist/shadcn/lib/base-ui/_chunk-ghn1tzt8.js +0 -84
- package/dist/shadcn/lib/base-ui/_chunk-gy0bpkmx.js +0 -12
- package/dist/shadcn/lib/base-ui/_chunk-hm5h9vsk.js +0 -16
- package/dist/shadcn/lib/base-ui/_chunk-htdj1jps.js +0 -833
- package/dist/shadcn/lib/base-ui/_chunk-j29xjete.js +0 -146
- package/dist/shadcn/lib/base-ui/_chunk-j3qkyd10.js +0 -50
- package/dist/shadcn/lib/base-ui/_chunk-ktvsd5k6.js +0 -2386
- package/dist/shadcn/lib/base-ui/_chunk-kw8nnq00.js +0 -546
- package/dist/shadcn/lib/base-ui/_chunk-m307wpdj.js +0 -18
- package/dist/shadcn/lib/base-ui/_chunk-mnd0j7v9.js +0 -15
- package/dist/shadcn/lib/base-ui/_chunk-n11h505c.js +0 -32
- package/dist/shadcn/lib/base-ui/_chunk-p0e2qacz.js +0 -26
- package/dist/shadcn/lib/base-ui/_chunk-pv7b791x.js +0 -106
- package/dist/shadcn/lib/base-ui/_chunk-q5cg71p7.js +0 -83
- package/dist/shadcn/lib/base-ui/_chunk-qbezxj1g.js +0 -385
- package/dist/shadcn/lib/base-ui/_chunk-qmsqz6nt.js +0 -15
- package/dist/shadcn/lib/base-ui/_chunk-rrh8rt4v.js +0 -65
- package/dist/shadcn/lib/base-ui/_chunk-s5pwkz8v.js +0 -25
- package/dist/shadcn/lib/base-ui/_chunk-svxv97ph.js +0 -218
- package/dist/shadcn/lib/base-ui/_chunk-t7ppm3t0.js +0 -68
- package/dist/shadcn/lib/base-ui/_chunk-vg16xxmb.js +0 -52
- package/dist/shadcn/lib/base-ui/_chunk-vgkfmtbe.js +0 -21
- package/dist/shadcn/lib/base-ui/_chunk-watha94s.js +0 -14
- package/dist/shadcn/lib/base-ui/_chunk-wdqynnjf.js +0 -35
- package/dist/shadcn/lib/base-ui/_chunk-wx2nxg0p.js +0 -15
- package/dist/shadcn/lib/base-ui/_chunk-x11e1k9r.js +0 -0
- package/dist/shadcn/lib/base-ui/_chunk-x8xehj6d.js +0 -302
- package/dist/shadcn/lib/base-ui/_chunk-xcqbtm2f.js +0 -28
- package/dist/shadcn/lib/base-ui/_chunk-ytnp24gq.js +0 -328
- package/dist/shadcn/lib/base-ui/_chunk-yzr7eg4b.js +0 -6
- package/dist/shadcn/lib/base-ui/_chunk-zk4mtm9m.js +0 -9
- package/dist/shadcn/lib/base-ui/accordion.d.ts +0 -447
- package/dist/shadcn/lib/base-ui/accordion.js +0 -630
- package/dist/shadcn/lib/base-ui/alert-dialog.d.ts +0 -1467
- package/dist/shadcn/lib/base-ui/alert-dialog.js +0 -98
- package/dist/shadcn/lib/base-ui/avatar.d.ts +0 -123
- package/dist/shadcn/lib/base-ui/avatar.js +0 -235
- package/dist/shadcn/lib/base-ui/button.d.ts +0 -84
- package/dist/shadcn/lib/base-ui/button.js +0 -51
- package/dist/shadcn/lib/base-ui/checkbox.d.ts +0 -341
- package/dist/shadcn/lib/base-ui/checkbox.js +0 -501
- package/dist/shadcn/lib/base-ui/collapsible.d.ts +0 -291
- package/dist/shadcn/lib/base-ui/collapsible.js +0 -264
- package/dist/shadcn/lib/base-ui/context-menu.d.ts +0 -2213
- package/dist/shadcn/lib/base-ui/context-menu.js +0 -323
- package/dist/shadcn/lib/base-ui/dialog.d.ts +0 -1448
- package/dist/shadcn/lib/base-ui/dialog.js +0 -79
- package/dist/shadcn/lib/base-ui/input.d.ts +0 -506
- package/dist/shadcn/lib/base-ui/input.js +0 -1027
- package/dist/shadcn/lib/base-ui/menu.d.ts +0 -2275
- package/dist/shadcn/lib/base-ui/menu.js +0 -60
- package/dist/shadcn/lib/base-ui/menubar.d.ts +0 -48
- package/dist/shadcn/lib/base-ui/menubar.js +0 -156
- package/dist/shadcn/lib/base-ui/merge-props.d.ts +0 -70
- package/dist/shadcn/lib/base-ui/merge-props.js +0 -15
- package/dist/shadcn/lib/base-ui/navigation-menu.d.ts +0 -825
- package/dist/shadcn/lib/base-ui/navigation-menu.js +0 -1849
- package/dist/shadcn/lib/base-ui/popover.d.ts +0 -1743
- package/dist/shadcn/lib/base-ui/popover.js +0 -1089
- package/dist/shadcn/lib/base-ui/preview-card.d.ts +0 -1608
- package/dist/shadcn/lib/base-ui/preview-card.js +0 -919
- package/dist/shadcn/lib/base-ui/progress.d.ts +0 -172
- package/dist/shadcn/lib/base-ui/progress.js +0 -272
- package/dist/shadcn/lib/base-ui/radio-group.d.ts +0 -260
- package/dist/shadcn/lib/base-ui/radio-group.js +0 -239
- package/dist/shadcn/lib/base-ui/radio.d.ts +0 -176
- package/dist/shadcn/lib/base-ui/radio.js +0 -387
- package/dist/shadcn/lib/base-ui/scroll-area.d.ts +0 -241
- package/dist/shadcn/lib/base-ui/scroll-area.js +0 -1055
- package/dist/shadcn/lib/base-ui/select.d.ts +0 -1266
- package/dist/shadcn/lib/base-ui/select.js +0 -2450
- package/dist/shadcn/lib/base-ui/separator.d.ts +0 -76
- package/dist/shadcn/lib/base-ui/separator.js +0 -11
- package/dist/shadcn/lib/base-ui/slider.d.ts +0 -551
- package/dist/shadcn/lib/base-ui/slider.js +0 -1583
- package/dist/shadcn/lib/base-ui/switch.d.ts +0 -313
- package/dist/shadcn/lib/base-ui/switch.js +0 -326
- package/dist/shadcn/lib/base-ui/tabs.d.ts +0 -406
- package/dist/shadcn/lib/base-ui/tabs.js +0 -915
- package/dist/shadcn/lib/base-ui/toggle-group.d.ts +0 -235
- package/dist/shadcn/lib/base-ui/toggle-group.js +0 -145
- package/dist/shadcn/lib/base-ui/toggle.d.ts +0 -224
- package/dist/shadcn/lib/base-ui/toggle.js +0 -127
- package/dist/shadcn/lib/base-ui/tooltip.d.ts +0 -1656
- package/dist/shadcn/lib/base-ui/tooltip.js +0 -920
- package/dist/shadcn/lib/base-ui/use-render.d.ts +0 -87
- package/dist/shadcn/lib/base-ui/use-render.js +0 -15
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { Toggle as TogglePrimitive } from "../lib/base-ui/toggle.js";
|
|
5
|
-
import { ToggleGroup as ToggleGroupPrimitive } from "../lib/base-ui/toggle-group.js";
|
|
6
|
-
import {} from "../lib/cva.js";
|
|
7
|
-
import { cn } from "../lib/utils.js";
|
|
8
|
-
import { toggleVariants } from "./toggle.js";
|
|
9
|
-
const ToggleGroupContext = React.createContext({
|
|
10
|
-
size: "default",
|
|
11
|
-
variant: "default",
|
|
12
|
-
spacing: 2,
|
|
13
|
-
orientation: "horizontal",
|
|
14
|
-
});
|
|
15
|
-
function ToggleGroup({ className, variant, size, spacing = 2, orientation = "horizontal", children, ...props }) {
|
|
16
|
-
return (_jsx(ToggleGroupPrimitive, { "data-slot": "toggle-group", "data-variant": variant, "data-size": size, "data-spacing": spacing, "data-orientation": orientation, style: { "--gap": spacing }, className: cn("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=0]:data-[variant=outline]:shadow-xs data-vertical:flex-col data-vertical:items-stretch", className), ...props, children: _jsx(ToggleGroupContext.Provider, { value: { variant, size, spacing, orientation }, children: children }) }));
|
|
17
|
-
}
|
|
18
|
-
function ToggleGroupItem({ className, children, variant = "default", size = "default", ...props }) {
|
|
19
|
-
const context = React.useContext(ToggleGroupContext);
|
|
20
|
-
return (_jsx(TogglePrimitive, { "data-slot": "toggle-group-item", "data-variant": context.variant || variant, "data-size": context.size || size, "data-spacing": context.spacing, className: cn("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-[spacing=0]/toggle-group:shadow-none focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md data-[state=on]:bg-muted group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t", toggleVariants({
|
|
21
|
-
variant: context.variant || variant,
|
|
22
|
-
size: context.size || size,
|
|
23
|
-
}), className), ...props, children: children }));
|
|
24
|
-
}
|
|
25
|
-
export { ToggleGroup, ToggleGroupItem };
|
|
1
|
+
// Linker shim: this path now re-exports the self-contained component from
|
|
2
|
+
// `ui/toggle-group`. The legacy base-ui implementation was removed in 4.0.0.
|
|
3
|
+
export * from "../../ui/toggle-group.js";
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { type VariantProps } from "../lib/cva.js";
|
|
3
|
-
declare const toggleVariants: (props?: import("../lib/cva.js").CvaProps<{
|
|
4
|
-
variant: {
|
|
5
|
-
default: string;
|
|
6
|
-
outline: string;
|
|
7
|
-
};
|
|
8
|
-
size: {
|
|
9
|
-
default: string;
|
|
10
|
-
sm: string;
|
|
11
|
-
lg: string;
|
|
12
|
-
};
|
|
13
|
-
}> | undefined) => string;
|
|
14
|
-
declare function Toggle({ className, variant, size, ...props }: TogglePrimitive.Props & VariantProps<typeof toggleVariants>): import("react").JSX.Element;
|
|
15
|
-
export { Toggle, toggleVariants };
|
|
1
|
+
export * from "../../ui/toggle.js";
|
package/dist/shadcn/ui/toggle.js
CHANGED
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { cva } from "../lib/cva.js";
|
|
5
|
-
import { cn } from "../lib/utils.js";
|
|
6
|
-
const toggleVariants = cva("cursor-pointer group/toggle inline-flex items-center justify-center gap-1 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
7
|
-
variants: {
|
|
8
|
-
variant: {
|
|
9
|
-
default: "bg-transparent",
|
|
10
|
-
outline: "border border-input bg-transparent shadow-xs hover:bg-muted",
|
|
11
|
-
},
|
|
12
|
-
size: {
|
|
13
|
-
default: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
14
|
-
sm: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
15
|
-
lg: "h-10 min-w-10 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
defaultVariants: {
|
|
19
|
-
variant: "default",
|
|
20
|
-
size: "default",
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
function Toggle({ className, variant = "default", size = "default", ...props }) {
|
|
24
|
-
return (_jsx(TogglePrimitive, { "data-slot": "toggle", className: cn(toggleVariants({ variant, size, className })), ...props }));
|
|
25
|
-
}
|
|
26
|
-
export { Toggle, toggleVariants };
|
|
1
|
+
// Linker shim: this path now re-exports the self-contained component from
|
|
2
|
+
// `ui/toggle`. The legacy base-ui implementation was removed in 4.0.0.
|
|
3
|
+
export * from "../../ui/toggle.js";
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
declare function TooltipProvider({ delay, ...props }: TooltipPrimitive.Provider.Props): import("react").JSX.Element;
|
|
3
|
-
declare function Tooltip({ ...props }: TooltipPrimitive.Root.Props): import("react").JSX.Element;
|
|
4
|
-
declare function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props): import("react").JSX.Element;
|
|
5
|
-
declare function TooltipContent({ className, side, sideOffset, align, alignOffset, children, ...props }: TooltipPrimitive.Popup.Props & Pick<TooltipPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset">): import("react").JSX.Element;
|
|
6
|
-
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
1
|
+
export * from "../../ui/tooltip.js";
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { cn } from "../lib/utils.js";
|
|
5
|
-
function TooltipProvider({ delay = 0, ...props }) {
|
|
6
|
-
return (_jsx(TooltipPrimitive.Provider, { "data-slot": "tooltip-provider", delay: delay, ...props }));
|
|
7
|
-
}
|
|
8
|
-
function Tooltip({ ...props }) {
|
|
9
|
-
return _jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
|
|
10
|
-
}
|
|
11
|
-
function TooltipTrigger({ ...props }) {
|
|
12
|
-
return _jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
13
|
-
}
|
|
14
|
-
function TooltipContent({ className, side = "top", sideOffset = 4, align = "center", alignOffset = 0, children, ...props }) {
|
|
15
|
-
return (_jsx(TooltipPrimitive.Portal, { children: _jsx(TooltipPrimitive.Positioner, { align: align, alignOffset: alignOffset, side: side, sideOffset: sideOffset, className: "isolate z-50", children: _jsxs(TooltipPrimitive.Popup, { "data-slot": "tooltip-content", className: cn("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 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-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 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", className), ...props, children: [children, _jsx(TooltipPrimitive.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" })] }) }) }));
|
|
16
|
-
}
|
|
17
|
-
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
1
|
+
// Linker shim: this path now re-exports the self-contained component from
|
|
2
|
+
// `ui/tooltip`. The legacy base-ui implementation was removed in 4.0.0.
|
|
3
|
+
export * from "../../ui/tooltip.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface AccordionProps extends Omit<React.ComponentProps<"div">, "onChange"> {
|
|
3
|
+
value?: string[];
|
|
4
|
+
defaultValue?: string[];
|
|
5
|
+
onValueChange?: (value: string[]) => void;
|
|
6
|
+
/** Allow more than one item open at once (default true, like Base UI). */
|
|
7
|
+
openMultiple?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Self-contained accordion. Open state is tracked as an array of item values;
|
|
11
|
+
* panels animate height with a pure-CSS grid-rows transition (no measured
|
|
12
|
+
* `--accordion-panel-height` var or keyframes).
|
|
13
|
+
*/
|
|
14
|
+
declare function Accordion({ className, value: controlled, defaultValue, onValueChange, openMultiple, ...props }: AccordionProps): React.JSX.Element;
|
|
15
|
+
export interface AccordionItemProps extends React.ComponentProps<"div"> {
|
|
16
|
+
value: string;
|
|
17
|
+
}
|
|
18
|
+
declare function AccordionItem({ className, value, ...props }: AccordionItemProps): React.JSX.Element;
|
|
19
|
+
declare function AccordionTrigger({ className, children, onClick, ...props }: React.ComponentProps<"button">): React.JSX.Element;
|
|
20
|
+
declare function AccordionContent({ className, children, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
21
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../shadcn/lib/utils.js";
|
|
5
|
+
import { ChevronDownIcon } from "../icons/index.js";
|
|
6
|
+
const AccordionContext = React.createContext({
|
|
7
|
+
value: [],
|
|
8
|
+
toggle: () => { },
|
|
9
|
+
});
|
|
10
|
+
const ItemContext = React.createContext(null);
|
|
11
|
+
function useItem() {
|
|
12
|
+
const ctx = React.useContext(ItemContext);
|
|
13
|
+
if (!ctx)
|
|
14
|
+
throw new Error("Accordion parts must be used within <AccordionItem>");
|
|
15
|
+
return ctx;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Self-contained accordion. Open state is tracked as an array of item values;
|
|
19
|
+
* panels animate height with a pure-CSS grid-rows transition (no measured
|
|
20
|
+
* `--accordion-panel-height` var or keyframes).
|
|
21
|
+
*/
|
|
22
|
+
function Accordion({ className, value: controlled, defaultValue = [], onValueChange, openMultiple = true, ...props }) {
|
|
23
|
+
const [value, setValue] = React.useState(defaultValue);
|
|
24
|
+
const isControlled = controlled !== undefined;
|
|
25
|
+
const open = isControlled ? controlled : value;
|
|
26
|
+
const commit = (next) => {
|
|
27
|
+
if (!isControlled)
|
|
28
|
+
setValue(next);
|
|
29
|
+
onValueChange?.(next);
|
|
30
|
+
};
|
|
31
|
+
const toggle = (item) => {
|
|
32
|
+
const has = open.includes(item);
|
|
33
|
+
const next = has
|
|
34
|
+
? open.filter((v) => v !== item)
|
|
35
|
+
: openMultiple
|
|
36
|
+
? [...open, item]
|
|
37
|
+
: [item];
|
|
38
|
+
commit(next);
|
|
39
|
+
};
|
|
40
|
+
return (_jsx(AccordionContext.Provider, { value: { value: open, toggle }, children: _jsx("div", { "data-slot": "accordion", className: cn("flex w-full flex-col", className), ...props }) }));
|
|
41
|
+
}
|
|
42
|
+
function AccordionItem({ className, value, ...props }) {
|
|
43
|
+
const { value: openValues } = React.useContext(AccordionContext);
|
|
44
|
+
const open = openValues.includes(value);
|
|
45
|
+
const reactId = React.useId();
|
|
46
|
+
const ctx = {
|
|
47
|
+
value,
|
|
48
|
+
open,
|
|
49
|
+
triggerId: `${reactId}-trigger`,
|
|
50
|
+
panelId: `${reactId}-panel`,
|
|
51
|
+
};
|
|
52
|
+
return (_jsx(ItemContext.Provider, { value: ctx, children: _jsx("div", { "data-slot": "accordion-item", "data-state": open ? "open" : "closed", className: cn("not-last:border-b", className), ...props }) }));
|
|
53
|
+
}
|
|
54
|
+
function AccordionTrigger({ className, children, onClick, ...props }) {
|
|
55
|
+
const { value, open, triggerId, panelId } = useItem();
|
|
56
|
+
const { toggle } = React.useContext(AccordionContext);
|
|
57
|
+
return (_jsx("h3", { className: "flex", children: _jsxs("button", { type: "button", id: triggerId, "aria-expanded": open, "aria-controls": panelId, "data-slot": "accordion-trigger", "data-state": open ? "open" : "closed", className: cn("cursor-pointer group/accordion-trigger relative flex flex-1 items-start justify-between gap-4 rounded-md border border-transparent py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50", className), onClick: (e) => {
|
|
58
|
+
onClick?.(e);
|
|
59
|
+
if (!e.defaultPrevented)
|
|
60
|
+
toggle(value);
|
|
61
|
+
}, ...props, children: [children, _jsx(ChevronDownIcon, { "aria-hidden": true, className: "pointer-events-none mt-0.5 size-4 shrink-0 text-muted-foreground transition-transform duration-200 group-data-[state=open]/accordion-trigger:rotate-180" })] }) }));
|
|
62
|
+
}
|
|
63
|
+
function AccordionContent({ className, children, ...props }) {
|
|
64
|
+
const { open, triggerId, panelId } = useItem();
|
|
65
|
+
return (_jsx("div", { role: "region", id: panelId, "aria-labelledby": triggerId, inert: !open, "data-slot": "accordion-content", "data-state": open ? "open" : "closed", className: cn("grid text-sm transition-[grid-template-rows] duration-200 ease-out", open ? "grid-rows-[1fr]" : "grid-rows-[0fr]"), ...props, children: _jsx("div", { className: "overflow-hidden", children: _jsx("div", { className: cn("pt-0 pb-4 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4", className), children: children }) }) }));
|
|
66
|
+
}
|
|
67
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Button } from "./button.js";
|
|
3
|
+
export interface AlertDialogProps {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
onOpenChange?: (open: boolean) => void;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/** Self-contained alert dialog on native `<dialog>`: Escape closes, but (unlike
|
|
10
|
+
* Dialog) clicking the backdrop does not — a decision must be made. */
|
|
11
|
+
declare function AlertDialog({ open, defaultOpen, onOpenChange, children, }: AlertDialogProps): React.JSX.Element;
|
|
12
|
+
declare function AlertDialogTrigger({ className, asChild, render, nativeButton: _nativeButton, children, onClick, ...props }: React.ComponentProps<"button"> & {
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
render?: React.ReactElement;
|
|
15
|
+
nativeButton?: boolean;
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
declare function AlertDialogPortal({ children }: {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
declare function AlertDialogOverlay(): null;
|
|
21
|
+
export interface AlertDialogContentProps extends React.ComponentProps<"div"> {
|
|
22
|
+
size?: "default" | "sm";
|
|
23
|
+
}
|
|
24
|
+
declare function AlertDialogContent({ className, size, children, ...props }: AlertDialogContentProps): React.JSX.Element;
|
|
25
|
+
declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
26
|
+
declare function AlertDialogFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
27
|
+
declare function AlertDialogMedia({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
28
|
+
declare function AlertDialogTitle({ className, ...props }: React.ComponentProps<"h2">): React.JSX.Element;
|
|
29
|
+
declare function AlertDialogDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
30
|
+
declare function AlertDialogAction({ className, onClick, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
31
|
+
declare function AlertDialogCancel({ className, variant, size, onClick, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
32
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../shadcn/lib/utils.js";
|
|
5
|
+
import { Button } from "./button.js";
|
|
6
|
+
import { Slot, resolveRender } from "./slot.js";
|
|
7
|
+
import { useControllableState } from "./use-controllable-state.js";
|
|
8
|
+
const AlertDialogContext = React.createContext(null);
|
|
9
|
+
function useAlertDialog() {
|
|
10
|
+
const ctx = React.useContext(AlertDialogContext);
|
|
11
|
+
if (!ctx)
|
|
12
|
+
throw new Error("AlertDialog parts must be used within <AlertDialog>");
|
|
13
|
+
return ctx;
|
|
14
|
+
}
|
|
15
|
+
/** Self-contained alert dialog on native `<dialog>`: Escape closes, but (unlike
|
|
16
|
+
* Dialog) clicking the backdrop does not — a decision must be made. */
|
|
17
|
+
function AlertDialog({ open, defaultOpen = false, onOpenChange, children, }) {
|
|
18
|
+
const [isOpen, setOpen] = useControllableState({
|
|
19
|
+
value: open,
|
|
20
|
+
defaultValue: defaultOpen,
|
|
21
|
+
onChange: onOpenChange,
|
|
22
|
+
});
|
|
23
|
+
const titleId = React.useId();
|
|
24
|
+
const descriptionId = React.useId();
|
|
25
|
+
return (_jsx(AlertDialogContext.Provider, { value: { open: isOpen, setOpen, titleId, descriptionId }, children: children }));
|
|
26
|
+
}
|
|
27
|
+
function AlertDialogTrigger({ className, asChild = false, render, nativeButton: _nativeButton, children, onClick, ...props }) {
|
|
28
|
+
const { open, setOpen } = useAlertDialog();
|
|
29
|
+
const { useSlot, slotChild } = resolveRender(asChild, render, children);
|
|
30
|
+
const Comp = useSlot ? Slot : "button";
|
|
31
|
+
return (_jsx(Comp, { type: useSlot ? undefined : "button", "data-slot": "alert-dialog-trigger", "aria-haspopup": "dialog", "data-state": open ? "open" : "closed", className: cn("cursor-pointer", className), onClick: (e) => {
|
|
32
|
+
onClick?.(e);
|
|
33
|
+
if (!e.defaultPrevented)
|
|
34
|
+
setOpen(true);
|
|
35
|
+
}, ...props, children: slotChild }));
|
|
36
|
+
}
|
|
37
|
+
function AlertDialogPortal({ children }) {
|
|
38
|
+
return _jsx(_Fragment, { children: children });
|
|
39
|
+
}
|
|
40
|
+
function AlertDialogOverlay() {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
function AlertDialogContent({ className, size = "default", children, ...props }) {
|
|
44
|
+
const { open, setOpen, titleId, descriptionId } = useAlertDialog();
|
|
45
|
+
const ref = React.useRef(null);
|
|
46
|
+
React.useEffect(() => {
|
|
47
|
+
const node = ref.current;
|
|
48
|
+
if (!node)
|
|
49
|
+
return;
|
|
50
|
+
if (open && !node.open)
|
|
51
|
+
node.showModal();
|
|
52
|
+
else if (!open && node.open)
|
|
53
|
+
node.close();
|
|
54
|
+
}, [open]);
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
if (!open)
|
|
57
|
+
return;
|
|
58
|
+
const prev = document.body.style.overflow;
|
|
59
|
+
document.body.style.overflow = "hidden";
|
|
60
|
+
return () => {
|
|
61
|
+
document.body.style.overflow = prev;
|
|
62
|
+
};
|
|
63
|
+
}, [open]);
|
|
64
|
+
return (_jsx("dialog", { ref: ref, role: "alertdialog", "aria-labelledby": titleId, "aria-describedby": descriptionId, "data-slot": "alert-dialog-overlay", "data-state": open ? "open" : "closed", "data-open": open ? "" : undefined, "data-closed": open ? undefined : "", onCancel: (e) => {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
setOpen(false);
|
|
67
|
+
}, onClose: () => setOpen(false), className: "m-0 grid max-h-none max-w-none place-items-center bg-transparent p-4 backdrop:bg-black/10 backdrop:duration-100 supports-backdrop-filter:backdrop:backdrop-blur-xs open:fixed open:inset-0 open:size-full", children: open ? (_jsx("div", { "data-slot": "alert-dialog-content", "data-size": size, "data-state": open ? "open" : "closed", "data-open": open ? "" : undefined, className: cn("group/alert-dialog-content relative grid w-full gap-6 rounded-xl bg-background p-6 text-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95", className), ...props, children: children })) : null }));
|
|
68
|
+
}
|
|
69
|
+
function AlertDialogHeader({ className, ...props }) {
|
|
70
|
+
return (_jsx("div", { "data-slot": "alert-dialog-header", className: cn("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]", className), ...props }));
|
|
71
|
+
}
|
|
72
|
+
function AlertDialogFooter({ className, ...props }) {
|
|
73
|
+
return (_jsx("div", { "data-slot": "alert-dialog-footer", className: cn("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end", className), ...props }));
|
|
74
|
+
}
|
|
75
|
+
function AlertDialogMedia({ className, ...props }) {
|
|
76
|
+
return (_jsx("div", { "data-slot": "alert-dialog-media", className: cn("mb-2 inline-flex size-16 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8", className), ...props }));
|
|
77
|
+
}
|
|
78
|
+
function AlertDialogTitle({ className, ...props }) {
|
|
79
|
+
const { titleId } = useAlertDialog();
|
|
80
|
+
return (_jsx("h2", { id: titleId, "data-slot": "alert-dialog-title", className: cn("text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2", className), ...props }));
|
|
81
|
+
}
|
|
82
|
+
function AlertDialogDescription({ className, ...props }) {
|
|
83
|
+
const { descriptionId } = useAlertDialog();
|
|
84
|
+
return (_jsx("p", { id: descriptionId, "data-slot": "alert-dialog-description", className: cn("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className), ...props }));
|
|
85
|
+
}
|
|
86
|
+
function AlertDialogAction({ className, onClick, ...props }) {
|
|
87
|
+
const { setOpen } = useAlertDialog();
|
|
88
|
+
return (_jsx(Button, { "data-slot": "alert-dialog-action", className: cn(className), onClick: (e) => {
|
|
89
|
+
onClick?.(e);
|
|
90
|
+
if (!e.defaultPrevented)
|
|
91
|
+
setOpen(false);
|
|
92
|
+
}, ...props }));
|
|
93
|
+
}
|
|
94
|
+
function AlertDialogCancel({ className, variant = "outline", size = "default", onClick, ...props }) {
|
|
95
|
+
const { setOpen } = useAlertDialog();
|
|
96
|
+
return (_jsx(Button, { "data-slot": "alert-dialog-cancel", variant: variant, size: size, className: cn(className), onClick: (e) => {
|
|
97
|
+
onClick?.(e);
|
|
98
|
+
if (!e.defaultPrevented)
|
|
99
|
+
setOpen(false);
|
|
100
|
+
}, ...props }));
|
|
101
|
+
}
|
|
102
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "../shadcn/lib/cva.js";
|
|
3
|
+
declare const alertVariants: (props?: import("../shadcn/lib/cva.js").CvaProps<{
|
|
4
|
+
variant: {
|
|
5
|
+
default: string;
|
|
6
|
+
destructive: string;
|
|
7
|
+
};
|
|
8
|
+
}> | undefined) => string;
|
|
9
|
+
declare function Alert({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>): React.JSX.Element;
|
|
10
|
+
declare function AlertTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
11
|
+
declare function AlertDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
12
|
+
declare function AlertAction({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
13
|
+
export { Alert, AlertTitle, AlertDescription, AlertAction };
|
package/dist/ui/alert.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cva } from "../shadcn/lib/cva.js";
|
|
4
|
+
import { cn } from "../shadcn/lib/utils.js";
|
|
5
|
+
const alertVariants = cva("group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "bg-card text-card-foreground",
|
|
9
|
+
destructive: "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
variant: "default",
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
function Alert({ className, variant, ...props }) {
|
|
17
|
+
return (_jsx("div", { "data-slot": "alert", role: "alert", className: cn(alertVariants({ variant }), className), ...props }));
|
|
18
|
+
}
|
|
19
|
+
function AlertTitle({ className, ...props }) {
|
|
20
|
+
return (_jsx("div", { "data-slot": "alert-title", className: cn("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground", className), ...props }));
|
|
21
|
+
}
|
|
22
|
+
function AlertDescription({ className, ...props }) {
|
|
23
|
+
return (_jsx("div", { "data-slot": "alert-description", className: cn("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4", className), ...props }));
|
|
24
|
+
}
|
|
25
|
+
function AlertAction({ className, ...props }) {
|
|
26
|
+
return (_jsx("div", { "data-slot": "alert-action", className: cn("absolute top-2.5 right-3", className), ...props }));
|
|
27
|
+
}
|
|
28
|
+
export { Alert, AlertTitle, AlertDescription, AlertAction };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../shadcn/lib/utils.js";
|
|
4
|
+
function AspectRatio({ ratio, className, ...props }) {
|
|
5
|
+
return (_jsx("div", { "data-slot": "aspect-ratio", style: {
|
|
6
|
+
"--ratio": ratio,
|
|
7
|
+
}, className: cn("relative aspect-(--ratio)", className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
export { AspectRatio };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Self-contained avatar: the image reports its load status up through context;
|
|
4
|
+
* the fallback renders until the image successfully loads (or if it errors).
|
|
5
|
+
*/
|
|
6
|
+
declare function Avatar({ className, size, ...props }: React.ComponentProps<"span"> & {
|
|
7
|
+
size?: "default" | "sm" | "lg";
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
declare function AvatarImage({ className, onLoad, onError, src, ...props }: React.ComponentProps<"img">): React.JSX.Element | null;
|
|
10
|
+
declare function AvatarFallback({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element | null;
|
|
11
|
+
declare function AvatarBadge({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
12
|
+
declare function AvatarGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
13
|
+
declare function AvatarGroupCount({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
14
|
+
export { Avatar, AvatarImage, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarBadge, };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../shadcn/lib/utils.js";
|
|
5
|
+
const AvatarContext = React.createContext({ status: "idle", setStatus: () => { } });
|
|
6
|
+
/**
|
|
7
|
+
* Self-contained avatar: the image reports its load status up through context;
|
|
8
|
+
* the fallback renders until the image successfully loads (or if it errors).
|
|
9
|
+
*/
|
|
10
|
+
function Avatar({ className, size = "default", ...props }) {
|
|
11
|
+
const [status, setStatus] = React.useState("idle");
|
|
12
|
+
return (_jsx(AvatarContext.Provider, { value: { status, setStatus }, children: _jsx("span", { "data-slot": "avatar", "data-size": size, className: cn("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten", className), ...props }) }));
|
|
13
|
+
}
|
|
14
|
+
function AvatarImage({ className, onLoad, onError, src, ...props }) {
|
|
15
|
+
const { status, setStatus } = React.useContext(AvatarContext);
|
|
16
|
+
// A missing/empty src never fires load or error, so mark it errored up front;
|
|
17
|
+
// otherwise the fallback would sit next to a blank img, each squeezed to half.
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
if (!src)
|
|
20
|
+
setStatus("error");
|
|
21
|
+
}, [src, setStatus]);
|
|
22
|
+
// Render nothing until the image has actually loaded — the fallback owns the
|
|
23
|
+
// box until then (matches Base UI, avoids the blank-img squeeze on slow loads).
|
|
24
|
+
if (!src || status === "error")
|
|
25
|
+
return null;
|
|
26
|
+
return (_jsx("img", { src: src, "data-slot": "avatar-image", className: cn("absolute inset-0 aspect-square size-full rounded-full object-cover", status === "loaded" ? undefined : "opacity-0", className), onLoad: (e) => {
|
|
27
|
+
setStatus("loaded");
|
|
28
|
+
onLoad?.(e);
|
|
29
|
+
}, onError: (e) => {
|
|
30
|
+
setStatus("error");
|
|
31
|
+
onError?.(e);
|
|
32
|
+
}, ...props }));
|
|
33
|
+
}
|
|
34
|
+
function AvatarFallback({ className, ...props }) {
|
|
35
|
+
const { status } = React.useContext(AvatarContext);
|
|
36
|
+
if (status === "loaded")
|
|
37
|
+
return null;
|
|
38
|
+
return (_jsx("span", { "data-slot": "avatar-fallback", className: cn("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs", className), ...props }));
|
|
39
|
+
}
|
|
40
|
+
function AvatarBadge({ className, ...props }) {
|
|
41
|
+
return (_jsx("span", { "data-slot": "avatar-badge", className: cn("absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none", "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden", "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2", "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2", className), ...props }));
|
|
42
|
+
}
|
|
43
|
+
function AvatarGroup({ className, ...props }) {
|
|
44
|
+
return (_jsx("div", { "data-slot": "avatar-group", className: cn("group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background", className), ...props }));
|
|
45
|
+
}
|
|
46
|
+
function AvatarGroupCount({ className, ...props }) {
|
|
47
|
+
return (_jsx("div", { "data-slot": "avatar-group-count", className: cn("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3", className), ...props }));
|
|
48
|
+
}
|
|
49
|
+
export { Avatar, AvatarImage, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarBadge, };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "../shadcn/lib/cva.js";
|
|
3
|
+
declare const badgeVariants: (props?: import("../shadcn/lib/cva.js").CvaProps<{
|
|
4
|
+
variant: {
|
|
5
|
+
default: string;
|
|
6
|
+
secondary: string;
|
|
7
|
+
destructive: string;
|
|
8
|
+
outline: string;
|
|
9
|
+
ghost: string;
|
|
10
|
+
link: string;
|
|
11
|
+
};
|
|
12
|
+
}> | undefined) => string;
|
|
13
|
+
export interface BadgeProps extends React.ComponentProps<"span">, VariantProps<typeof badgeVariants> {
|
|
14
|
+
/** Render the single child element styled as a badge (e.g. an `<a>`). */
|
|
15
|
+
asChild?: boolean;
|
|
16
|
+
/** Base UI compat: a React element rendered in place of the badge. */
|
|
17
|
+
render?: React.ReactElement;
|
|
18
|
+
/** Base UI compat: ignored (the element is inferred from `render`/`asChild`). */
|
|
19
|
+
nativeButton?: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare function Badge({ className, variant, asChild, render, nativeButton: _nativeButton, children, ...props }: BadgeProps): React.JSX.Element;
|
|
22
|
+
export { Badge, badgeVariants };
|
package/dist/ui/badge.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cva } from "../shadcn/lib/cva.js";
|
|
4
|
+
import { cn } from "../shadcn/lib/utils.js";
|
|
5
|
+
import { Slot, resolveRender } from "./slot.js";
|
|
6
|
+
const badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
10
|
+
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
11
|
+
destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
|
|
12
|
+
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
13
|
+
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
14
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
variant: "default",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
function Badge({ className, variant = "default", asChild = false, render, nativeButton: _nativeButton, children, ...props }) {
|
|
22
|
+
const { useSlot, slotChild } = resolveRender(asChild, render, children);
|
|
23
|
+
const Comp = useSlot ? Slot : "span";
|
|
24
|
+
return (_jsx(Comp, { "data-slot": "badge", className: cn(badgeVariants({ variant }), className), ...props, children: slotChild }));
|
|
25
|
+
}
|
|
26
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function Breadcrumb({ className, ...props }: React.ComponentProps<"nav">): React.JSX.Element;
|
|
3
|
+
declare function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">): React.JSX.Element;
|
|
4
|
+
declare function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">): React.JSX.Element;
|
|
5
|
+
declare function BreadcrumbLink({ className, asChild, render, nativeButton: _nativeButton, children, ...props }: React.ComponentProps<"a"> & {
|
|
6
|
+
asChild?: boolean;
|
|
7
|
+
render?: React.ReactElement;
|
|
8
|
+
nativeButton?: boolean;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
declare function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
11
|
+
declare function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<"li">): React.JSX.Element;
|
|
12
|
+
declare function BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
13
|
+
export { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../shadcn/lib/utils.js";
|
|
4
|
+
import { Slot, resolveRender } from "./slot.js";
|
|
5
|
+
import { ChevronRightIcon, MoreHorizontalIcon } from "../icons/index.js";
|
|
6
|
+
function Breadcrumb({ className, ...props }) {
|
|
7
|
+
return (_jsx("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", className: cn(className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
function BreadcrumbList({ className, ...props }) {
|
|
10
|
+
return (_jsx("ol", { "data-slot": "breadcrumb-list", className: cn("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground sm:gap-2.5", className), ...props }));
|
|
11
|
+
}
|
|
12
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
13
|
+
return (_jsx("li", { "data-slot": "breadcrumb-item", className: cn("inline-flex items-center gap-1.5", className), ...props }));
|
|
14
|
+
}
|
|
15
|
+
function BreadcrumbLink({ className, asChild = false, render, nativeButton: _nativeButton, children, ...props }) {
|
|
16
|
+
const { useSlot, slotChild } = resolveRender(asChild, render, children);
|
|
17
|
+
const Comp = useSlot ? Slot : "a";
|
|
18
|
+
return (_jsx(Comp, { "data-slot": "breadcrumb-link", className: cn("cursor-pointer transition-colors hover:text-foreground", className), ...props, children: slotChild }));
|
|
19
|
+
}
|
|
20
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
21
|
+
return (_jsx("span", { "data-slot": "breadcrumb-page", role: "link", "aria-disabled": "true", "aria-current": "page", className: cn("font-normal text-foreground", className), ...props }));
|
|
22
|
+
}
|
|
23
|
+
function BreadcrumbSeparator({ children, className, ...props }) {
|
|
24
|
+
return (_jsx("li", { "data-slot": "breadcrumb-separator", role: "presentation", "aria-hidden": "true", className: cn("[&>svg]:size-3.5", className), ...props, children: children ?? _jsx(ChevronRightIcon, {}) }));
|
|
25
|
+
}
|
|
26
|
+
function BreadcrumbEllipsis({ className, ...props }) {
|
|
27
|
+
return (_jsxs("span", { "data-slot": "breadcrumb-ellipsis", role: "presentation", "aria-hidden": "true", className: cn("flex size-5 items-center justify-center [&>svg]:size-4", className), ...props, children: [_jsx(MoreHorizontalIcon, {}), _jsx("span", { className: "sr-only", children: "More" })] }));
|
|
28
|
+
}
|
|
29
|
+
export { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "../shadcn/lib/cva.js";
|
|
3
|
+
import { Separator } from "./separator.js";
|
|
4
|
+
declare const buttonGroupVariants: (props?: import("../shadcn/lib/cva.js").CvaProps<{
|
|
5
|
+
orientation: {
|
|
6
|
+
horizontal: string;
|
|
7
|
+
vertical: string;
|
|
8
|
+
};
|
|
9
|
+
}> | undefined) => string;
|
|
10
|
+
declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>): React.JSX.Element;
|
|
11
|
+
export interface ButtonGroupTextProps extends React.ComponentProps<"div"> {
|
|
12
|
+
/** Render the single child element styled as button-group text. */
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
/** Base UI compat: a React element rendered in place of the text. */
|
|
15
|
+
render?: React.ReactElement;
|
|
16
|
+
/** Base UI compat: ignored (the element is inferred from `render`/`asChild`). */
|
|
17
|
+
nativeButton?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare function ButtonGroupText({ className, asChild, render, nativeButton: _nativeButton, children, ...props }: ButtonGroupTextProps): React.JSX.Element;
|
|
20
|
+
declare function ButtonGroupSeparator({ className, orientation, ...props }: React.ComponentProps<typeof Separator>): React.JSX.Element;
|
|
21
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants, };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cva } from "../shadcn/lib/cva.js";
|
|
4
|
+
import { cn } from "../shadcn/lib/utils.js";
|
|
5
|
+
import { Slot, resolveRender } from "./slot.js";
|
|
6
|
+
import { Separator } from "./separator.js";
|
|
7
|
+
const buttonGroupVariants = cva("flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
|
|
8
|
+
variants: {
|
|
9
|
+
orientation: {
|
|
10
|
+
horizontal: "*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0",
|
|
11
|
+
vertical: "flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
orientation: "horizontal",
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
function ButtonGroup({ className, orientation, ...props }) {
|
|
19
|
+
return (_jsx("div", { role: "group", "data-slot": "button-group", "data-orientation": orientation, className: cn(buttonGroupVariants({ orientation }), className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
function ButtonGroupText({ className, asChild = false, render, nativeButton: _nativeButton, children, ...props }) {
|
|
22
|
+
const { useSlot, slotChild } = resolveRender(asChild, render, children);
|
|
23
|
+
const Comp = useSlot ? Slot : "div";
|
|
24
|
+
return (_jsx(Comp, { "data-slot": "button-group-text", className: cn("flex items-center gap-2 rounded-md border bg-muted px-2.5 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className), ...props, children: slotChild }));
|
|
25
|
+
}
|
|
26
|
+
function ButtonGroupSeparator({ className, orientation = "vertical", ...props }) {
|
|
27
|
+
return (_jsx(Separator, { "data-slot": "button-group-separator", orientation: orientation, className: cn("relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto", className), ...props }));
|
|
28
|
+
}
|
|
29
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants, };
|