@stevederico/skateboard-ui 3.12.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 +12 -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 -53
- 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
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
// Shared stack of open dismissable layers (most-recently-opened last). Escape
|
|
4
|
+
// only closes the topmost layer, so a popover opened inside a dialog doesn't
|
|
5
|
+
// close both at once.
|
|
6
|
+
const escapeStack = [];
|
|
7
|
+
/**
|
|
8
|
+
* Close an open layer on Escape or on a pointer press outside all of the given
|
|
9
|
+
* elements (e.g. the popup and its trigger). The listeners are only attached
|
|
10
|
+
* while `open`, and because the effect runs after the click that opened the
|
|
11
|
+
* layer, that same click never re-closes it. Escape is stacked: only the
|
|
12
|
+
* top layer closes, and the keydown is prevented/stopped so a native `<dialog>`
|
|
13
|
+
* ancestor's Escape-to-close doesn't also fire.
|
|
14
|
+
*/
|
|
15
|
+
export function useDismiss(open, onDismiss, refs) {
|
|
16
|
+
const onDismissRef = React.useRef(onDismiss);
|
|
17
|
+
onDismissRef.current = onDismiss;
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
if (!open)
|
|
20
|
+
return;
|
|
21
|
+
const token = () => onDismissRef.current();
|
|
22
|
+
escapeStack.push(token);
|
|
23
|
+
const onKeyDown = (e) => {
|
|
24
|
+
if (e.key !== "Escape")
|
|
25
|
+
return;
|
|
26
|
+
if (escapeStack[escapeStack.length - 1] !== token)
|
|
27
|
+
return;
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
e.stopPropagation();
|
|
30
|
+
onDismissRef.current();
|
|
31
|
+
};
|
|
32
|
+
const onPointerDown = (e) => {
|
|
33
|
+
const target = e.target;
|
|
34
|
+
if (!target)
|
|
35
|
+
return;
|
|
36
|
+
if (refs.some((r) => r.current && r.current.contains(target)))
|
|
37
|
+
return;
|
|
38
|
+
onDismissRef.current();
|
|
39
|
+
};
|
|
40
|
+
document.addEventListener("keydown", onKeyDown, true);
|
|
41
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
42
|
+
return () => {
|
|
43
|
+
const i = escapeStack.indexOf(token);
|
|
44
|
+
if (i !== -1)
|
|
45
|
+
escapeStack.splice(i, 1);
|
|
46
|
+
document.removeEventListener("keydown", onKeyDown, true);
|
|
47
|
+
document.removeEventListener("pointerdown", onPointerDown, true);
|
|
48
|
+
};
|
|
49
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
|
+
}, [open]);
|
|
51
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type Side = "top" | "bottom" | "left" | "right";
|
|
3
|
+
export type Align = "start" | "center" | "end";
|
|
4
|
+
export interface FloatingOptions {
|
|
5
|
+
side?: Side;
|
|
6
|
+
align?: Align;
|
|
7
|
+
sideOffset?: number;
|
|
8
|
+
alignOffset?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface FloatingResult {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
side: Side;
|
|
14
|
+
align: Align;
|
|
15
|
+
transformOrigin: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Pure positioning math: place a floating box relative to an anchor on the given
|
|
19
|
+
* side/alignment, flipping to the opposite side when it would overflow and
|
|
20
|
+
* shifting along the cross axis to stay within the viewport. A focused subset of
|
|
21
|
+
* what a full floating-ui pipeline does — enough for popovers, menus, tooltips.
|
|
22
|
+
*/
|
|
23
|
+
export declare function computePosition(anchor: DOMRect, floating: {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
}, opts: Required<FloatingOptions>, viewport: {
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
}): FloatingResult;
|
|
30
|
+
/**
|
|
31
|
+
* Position a floating element against an anchor, recomputing on scroll, resize,
|
|
32
|
+
* and content resize while `open`. Attach `floatingRef` to the popup.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useFloating(anchorRef: React.RefObject<HTMLElement | null>, open: boolean, options?: FloatingOptions): {
|
|
35
|
+
floatingRef: React.RefObject<HTMLDivElement | null>;
|
|
36
|
+
pos: FloatingResult | null;
|
|
37
|
+
update: () => void;
|
|
38
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
const PAD = 8;
|
|
4
|
+
const OPPOSITE = {
|
|
5
|
+
top: "bottom",
|
|
6
|
+
bottom: "top",
|
|
7
|
+
left: "right",
|
|
8
|
+
right: "left",
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Pure positioning math: place a floating box relative to an anchor on the given
|
|
12
|
+
* side/alignment, flipping to the opposite side when it would overflow and
|
|
13
|
+
* shifting along the cross axis to stay within the viewport. A focused subset of
|
|
14
|
+
* what a full floating-ui pipeline does — enough for popovers, menus, tooltips.
|
|
15
|
+
*/
|
|
16
|
+
export function computePosition(anchor, floating, opts, viewport) {
|
|
17
|
+
let { side } = opts;
|
|
18
|
+
const { align, sideOffset, alignOffset } = opts;
|
|
19
|
+
const space = {
|
|
20
|
+
top: anchor.top,
|
|
21
|
+
bottom: viewport.height - anchor.bottom,
|
|
22
|
+
left: anchor.left,
|
|
23
|
+
right: viewport.width - anchor.right,
|
|
24
|
+
};
|
|
25
|
+
const isVertical = side === "top" || side === "bottom";
|
|
26
|
+
const need = (isVertical ? floating.height : floating.width) + sideOffset;
|
|
27
|
+
if (space[side] < need && space[OPPOSITE[side]] > space[side]) {
|
|
28
|
+
side = OPPOSITE[side];
|
|
29
|
+
}
|
|
30
|
+
const vertical = side === "top" || side === "bottom";
|
|
31
|
+
let x = 0;
|
|
32
|
+
let y = 0;
|
|
33
|
+
if (side === "bottom")
|
|
34
|
+
y = anchor.bottom + sideOffset;
|
|
35
|
+
else if (side === "top")
|
|
36
|
+
y = anchor.top - floating.height - sideOffset;
|
|
37
|
+
else if (side === "right")
|
|
38
|
+
x = anchor.right + sideOffset;
|
|
39
|
+
else
|
|
40
|
+
x = anchor.left - floating.width - sideOffset;
|
|
41
|
+
if (vertical) {
|
|
42
|
+
if (align === "start")
|
|
43
|
+
x = anchor.left + alignOffset;
|
|
44
|
+
else if (align === "end")
|
|
45
|
+
x = anchor.right - floating.width - alignOffset;
|
|
46
|
+
else
|
|
47
|
+
x = anchor.left + anchor.width / 2 - floating.width / 2 + alignOffset;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
if (align === "start")
|
|
51
|
+
y = anchor.top + alignOffset;
|
|
52
|
+
else if (align === "end")
|
|
53
|
+
y = anchor.bottom - floating.height - alignOffset;
|
|
54
|
+
else
|
|
55
|
+
y = anchor.top + anchor.height / 2 - floating.height / 2 + alignOffset;
|
|
56
|
+
}
|
|
57
|
+
x = Math.max(PAD, Math.min(x, viewport.width - floating.width - PAD));
|
|
58
|
+
y = Math.max(PAD, Math.min(y, viewport.height - floating.height - PAD));
|
|
59
|
+
const originX = vertical
|
|
60
|
+
? align === "start"
|
|
61
|
+
? "left"
|
|
62
|
+
: align === "end"
|
|
63
|
+
? "right"
|
|
64
|
+
: "center"
|
|
65
|
+
: side === "right"
|
|
66
|
+
? "left"
|
|
67
|
+
: "right";
|
|
68
|
+
const originY = vertical
|
|
69
|
+
? side === "bottom"
|
|
70
|
+
? "top"
|
|
71
|
+
: "bottom"
|
|
72
|
+
: align === "start"
|
|
73
|
+
? "top"
|
|
74
|
+
: align === "end"
|
|
75
|
+
? "bottom"
|
|
76
|
+
: "center";
|
|
77
|
+
return { x, y, side, align, transformOrigin: `${originX} ${originY}` };
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Position a floating element against an anchor, recomputing on scroll, resize,
|
|
81
|
+
* and content resize while `open`. Attach `floatingRef` to the popup.
|
|
82
|
+
*/
|
|
83
|
+
export function useFloating(anchorRef, open, options = {}) {
|
|
84
|
+
const floatingRef = React.useRef(null);
|
|
85
|
+
const [pos, setPos] = React.useState(null);
|
|
86
|
+
const side = options.side ?? "bottom";
|
|
87
|
+
const align = options.align ?? "center";
|
|
88
|
+
const sideOffset = options.sideOffset ?? 0;
|
|
89
|
+
const alignOffset = options.alignOffset ?? 0;
|
|
90
|
+
const update = React.useCallback(() => {
|
|
91
|
+
const a = anchorRef.current;
|
|
92
|
+
const f = floatingRef.current;
|
|
93
|
+
if (!a || !f)
|
|
94
|
+
return;
|
|
95
|
+
setPos(computePosition(a.getBoundingClientRect(), { width: f.offsetWidth, height: f.offsetHeight }, { side, align, sideOffset, alignOffset }, { width: window.innerWidth, height: window.innerHeight }));
|
|
96
|
+
}, [anchorRef, side, align, sideOffset, alignOffset]);
|
|
97
|
+
React.useLayoutEffect(() => {
|
|
98
|
+
if (!open)
|
|
99
|
+
return;
|
|
100
|
+
const ro = new ResizeObserver(update);
|
|
101
|
+
window.addEventListener("scroll", update, true);
|
|
102
|
+
window.addEventListener("resize", update);
|
|
103
|
+
// The floating node is portaled and may attach a frame late (the Portal
|
|
104
|
+
// defers rendering until its own effect runs). Retry each frame until the
|
|
105
|
+
// ref is set, then measure + observe — otherwise the first update() runs
|
|
106
|
+
// against a null ref, `pos` stays null, and the popup is stuck
|
|
107
|
+
// `visibility:hidden`.
|
|
108
|
+
let raf = 0;
|
|
109
|
+
const attach = () => {
|
|
110
|
+
if (!floatingRef.current) {
|
|
111
|
+
raf = requestAnimationFrame(attach);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
update();
|
|
115
|
+
ro.observe(floatingRef.current);
|
|
116
|
+
if (anchorRef.current)
|
|
117
|
+
ro.observe(anchorRef.current);
|
|
118
|
+
};
|
|
119
|
+
attach();
|
|
120
|
+
return () => {
|
|
121
|
+
cancelAnimationFrame(raf);
|
|
122
|
+
window.removeEventListener("scroll", update, true);
|
|
123
|
+
window.removeEventListener("resize", update);
|
|
124
|
+
ro.disconnect();
|
|
125
|
+
};
|
|
126
|
+
}, [open, update, anchorRef]);
|
|
127
|
+
return { floatingRef, pos, update };
|
|
128
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Keep an element mounted through its CSS exit animation. When `open` flips to
|
|
4
|
+
* false the element stays rendered (so `data-closed:animate-out` can play) until
|
|
5
|
+
* its animations finish, then unmounts. Falls back to a timeout if there are
|
|
6
|
+
* none. Returns `[mounted, ref]` — attach `ref` to the animated element.
|
|
7
|
+
*/
|
|
8
|
+
export declare function usePresence<T extends HTMLElement = HTMLElement>(open: boolean): [boolean, React.RefObject<T | null>];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Keep an element mounted through its CSS exit animation. When `open` flips to
|
|
5
|
+
* false the element stays rendered (so `data-closed:animate-out` can play) until
|
|
6
|
+
* its animations finish, then unmounts. Falls back to a timeout if there are
|
|
7
|
+
* none. Returns `[mounted, ref]` — attach `ref` to the animated element.
|
|
8
|
+
*/
|
|
9
|
+
export function usePresence(open) {
|
|
10
|
+
const ref = React.useRef(null);
|
|
11
|
+
const [mounted, setMounted] = React.useState(open);
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
if (open) {
|
|
14
|
+
setMounted(true);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const node = ref.current;
|
|
18
|
+
if (!node) {
|
|
19
|
+
setMounted(false);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
let cancelled = false;
|
|
23
|
+
let fallback = 0;
|
|
24
|
+
const finish = () => {
|
|
25
|
+
if (!cancelled)
|
|
26
|
+
setMounted(false);
|
|
27
|
+
};
|
|
28
|
+
// Let the data-closed classes apply and animations register, then wait for
|
|
29
|
+
// the actual animations to finish (no short timeout racing them — that would
|
|
30
|
+
// cut off any exit animation longer than the timeout). A generous backstop
|
|
31
|
+
// only guards against animations that never settle.
|
|
32
|
+
const raf = requestAnimationFrame(() => {
|
|
33
|
+
const anims = node.getAnimations?.() ?? [];
|
|
34
|
+
if (anims.length === 0) {
|
|
35
|
+
finish();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
Promise.allSettled(anims.map((a) => a.finished)).then(finish);
|
|
39
|
+
fallback = window.setTimeout(finish, 2000);
|
|
40
|
+
});
|
|
41
|
+
return () => {
|
|
42
|
+
cancelled = true;
|
|
43
|
+
window.clearTimeout(fallback);
|
|
44
|
+
cancelAnimationFrame(raf);
|
|
45
|
+
};
|
|
46
|
+
}, [open]);
|
|
47
|
+
return [mounted, ref];
|
|
48
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stevederico/skateboard-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -148,6 +148,11 @@
|
|
|
148
148
|
"import": "./dist/shadcn/ui/*.js",
|
|
149
149
|
"default": "./dist/shadcn/ui/*.js"
|
|
150
150
|
},
|
|
151
|
+
"./ui/*": {
|
|
152
|
+
"types": "./dist/ui/*.d.ts",
|
|
153
|
+
"import": "./dist/ui/*.js",
|
|
154
|
+
"default": "./dist/ui/*.js"
|
|
155
|
+
},
|
|
151
156
|
"./shadcn/lib/utils": {
|
|
152
157
|
"types": "./dist/shadcn/lib/utils.d.ts",
|
|
153
158
|
"import": "./dist/shadcn/lib/utils.js",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Material-UI SAS
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
// node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
2
|
-
function hasWindow() {
|
|
3
|
-
return typeof window !== "undefined";
|
|
4
|
-
}
|
|
5
|
-
function getNodeName(node) {
|
|
6
|
-
if (isNode(node)) {
|
|
7
|
-
return (node.nodeName || "").toLowerCase();
|
|
8
|
-
}
|
|
9
|
-
return "#document";
|
|
10
|
-
}
|
|
11
|
-
function getWindow(node) {
|
|
12
|
-
var _node$ownerDocument;
|
|
13
|
-
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? undefined : _node$ownerDocument.defaultView) || window;
|
|
14
|
-
}
|
|
15
|
-
function getDocumentElement(node) {
|
|
16
|
-
var _ref;
|
|
17
|
-
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? undefined : _ref.documentElement;
|
|
18
|
-
}
|
|
19
|
-
function isNode(value) {
|
|
20
|
-
if (!hasWindow()) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
24
|
-
}
|
|
25
|
-
function isElement(value) {
|
|
26
|
-
if (!hasWindow()) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
30
|
-
}
|
|
31
|
-
function isHTMLElement(value) {
|
|
32
|
-
if (!hasWindow()) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
36
|
-
}
|
|
37
|
-
function isShadowRoot(value) {
|
|
38
|
-
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
42
|
-
}
|
|
43
|
-
function isOverflowElement(element) {
|
|
44
|
-
const {
|
|
45
|
-
overflow,
|
|
46
|
-
overflowX,
|
|
47
|
-
overflowY,
|
|
48
|
-
display
|
|
49
|
-
} = getComputedStyle(element);
|
|
50
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
|
|
51
|
-
}
|
|
52
|
-
function isTableElement(element) {
|
|
53
|
-
return /^(table|td|th)$/.test(getNodeName(element));
|
|
54
|
-
}
|
|
55
|
-
function isTopLayer(element) {
|
|
56
|
-
try {
|
|
57
|
-
if (element.matches(":popover-open")) {
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
} catch (_e) {}
|
|
61
|
-
try {
|
|
62
|
-
return element.matches(":modal");
|
|
63
|
-
} catch (_e) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
68
|
-
var containRe = /paint|layout|strict|content/;
|
|
69
|
-
var isNotNone = (value) => !!value && value !== "none";
|
|
70
|
-
var isWebKitValue;
|
|
71
|
-
function isContainingBlock(elementOrCss) {
|
|
72
|
-
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
73
|
-
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
|
|
74
|
-
}
|
|
75
|
-
function getContainingBlock(element) {
|
|
76
|
-
let currentNode = getParentNode(element);
|
|
77
|
-
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
78
|
-
if (isContainingBlock(currentNode)) {
|
|
79
|
-
return currentNode;
|
|
80
|
-
} else if (isTopLayer(currentNode)) {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
currentNode = getParentNode(currentNode);
|
|
84
|
-
}
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
function isWebKit() {
|
|
88
|
-
if (isWebKitValue == null) {
|
|
89
|
-
isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
|
|
90
|
-
}
|
|
91
|
-
return isWebKitValue;
|
|
92
|
-
}
|
|
93
|
-
function isLastTraversableNode(node) {
|
|
94
|
-
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
95
|
-
}
|
|
96
|
-
function getComputedStyle(element) {
|
|
97
|
-
return getWindow(element).getComputedStyle(element);
|
|
98
|
-
}
|
|
99
|
-
function getNodeScroll(element) {
|
|
100
|
-
if (isElement(element)) {
|
|
101
|
-
return {
|
|
102
|
-
scrollLeft: element.scrollLeft,
|
|
103
|
-
scrollTop: element.scrollTop
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
scrollLeft: element.scrollX,
|
|
108
|
-
scrollTop: element.scrollY
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
function getParentNode(node) {
|
|
112
|
-
if (getNodeName(node) === "html") {
|
|
113
|
-
return node;
|
|
114
|
-
}
|
|
115
|
-
const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node);
|
|
116
|
-
return isShadowRoot(result) ? result.host : result;
|
|
117
|
-
}
|
|
118
|
-
function getNearestOverflowAncestor(node) {
|
|
119
|
-
const parentNode = getParentNode(node);
|
|
120
|
-
if (isLastTraversableNode(parentNode)) {
|
|
121
|
-
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
122
|
-
}
|
|
123
|
-
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
124
|
-
return parentNode;
|
|
125
|
-
}
|
|
126
|
-
return getNearestOverflowAncestor(parentNode);
|
|
127
|
-
}
|
|
128
|
-
function getOverflowAncestors(node, list, traverseIframes) {
|
|
129
|
-
var _node$ownerDocument2;
|
|
130
|
-
if (list === undefined) {
|
|
131
|
-
list = [];
|
|
132
|
-
}
|
|
133
|
-
if (traverseIframes === undefined) {
|
|
134
|
-
traverseIframes = true;
|
|
135
|
-
}
|
|
136
|
-
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
137
|
-
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? undefined : _node$ownerDocument2.body);
|
|
138
|
-
const win = getWindow(scrollableAncestor);
|
|
139
|
-
if (isBody) {
|
|
140
|
-
const frameElement = getFrameElement(win);
|
|
141
|
-
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
142
|
-
} else {
|
|
143
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
function getFrameElement(win) {
|
|
147
|
-
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export { getNodeName, getWindow, getDocumentElement, isNode, isElement, isHTMLElement, isShadowRoot, isOverflowElement, isTableElement, isTopLayer, isContainingBlock, getContainingBlock, isWebKit, isLastTraversableNode, getComputedStyle, getNodeScroll, getParentNode, getOverflowAncestors, getFrameElement };
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__commonJS
|
|
3
|
-
} from "./_chunk-svxv97ph.js";
|
|
4
|
-
|
|
5
|
-
// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
|
|
6
|
-
import * as React from "react";
|
|
7
|
-
var require_use_sync_external_store_shim_development = __commonJS((exports) => {
|
|
8
|
-
(function() {
|
|
9
|
-
function is(x, y) {
|
|
10
|
-
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
|
|
11
|
-
}
|
|
12
|
-
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
13
|
-
didWarnOld18Alpha || React.startTransition === undefined || (didWarnOld18Alpha = true, console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
|
14
|
-
var value = getSnapshot();
|
|
15
|
-
if (!didWarnUncachedGetSnapshot) {
|
|
16
|
-
var cachedValue = getSnapshot();
|
|
17
|
-
objectIs(value, cachedValue) || (console.error("The result of getSnapshot should be cached to avoid an infinite loop"), didWarnUncachedGetSnapshot = true);
|
|
18
|
-
}
|
|
19
|
-
cachedValue = useState2({
|
|
20
|
-
inst: { value, getSnapshot }
|
|
21
|
-
});
|
|
22
|
-
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
23
|
-
useLayoutEffect2(function() {
|
|
24
|
-
inst.value = value;
|
|
25
|
-
inst.getSnapshot = getSnapshot;
|
|
26
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
27
|
-
}, [subscribe, value, getSnapshot]);
|
|
28
|
-
useEffect2(function() {
|
|
29
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
30
|
-
return subscribe(function() {
|
|
31
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
32
|
-
});
|
|
33
|
-
}, [subscribe]);
|
|
34
|
-
useDebugValue2(value);
|
|
35
|
-
return value;
|
|
36
|
-
}
|
|
37
|
-
function checkIfSnapshotChanged(inst) {
|
|
38
|
-
var latestGetSnapshot = inst.getSnapshot;
|
|
39
|
-
inst = inst.value;
|
|
40
|
-
try {
|
|
41
|
-
var nextValue = latestGetSnapshot();
|
|
42
|
-
return !objectIs(inst, nextValue);
|
|
43
|
-
} catch (error) {
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
48
|
-
return getSnapshot();
|
|
49
|
-
}
|
|
50
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
51
|
-
var objectIs = typeof Object.is === "function" ? Object.is : is, useState2 = React.useState, useEffect2 = React.useEffect, useLayoutEffect2 = React.useLayoutEffect, useDebugValue2 = React.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = typeof window === "undefined" || typeof window.document === "undefined" || typeof window.document.createElement === "undefined" ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
52
|
-
exports.useSyncExternalStore = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
|
|
53
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
54
|
-
})();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// node_modules/use-sync-external-store/shim/index.js
|
|
58
|
-
var require_shim = __commonJS((exports, module) => {
|
|
59
|
-
if (false) {} else {
|
|
60
|
-
module.exports = require_use_sync_external_store_shim_development();
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
export { require_shim };
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useLabelableContext
|
|
3
|
-
} from "./_chunk-8ctgmf06.js";
|
|
4
|
-
import {
|
|
5
|
-
useBaseUiId
|
|
6
|
-
} from "./_chunk-wdqynnjf.js";
|
|
7
|
-
import {
|
|
8
|
-
isElement
|
|
9
|
-
} from "./_chunk-000kmre8.js";
|
|
10
|
-
import {
|
|
11
|
-
useStableCallback
|
|
12
|
-
} from "./_chunk-cwvtvwc7.js";
|
|
13
|
-
import {
|
|
14
|
-
useIsoLayoutEffect
|
|
15
|
-
} from "./_chunk-5tze5c8q.js";
|
|
16
|
-
import {
|
|
17
|
-
NOOP,
|
|
18
|
-
useRefWithInit
|
|
19
|
-
} from "./_chunk-x8xehj6d.js";
|
|
20
|
-
|
|
21
|
-
// node_modules/@base-ui/react/esm/internals/labelable-provider/useLabelableId.js
|
|
22
|
-
import * as React from "react";
|
|
23
|
-
"use client";
|
|
24
|
-
function useLabelableId(params = {}) {
|
|
25
|
-
const {
|
|
26
|
-
id,
|
|
27
|
-
implicit = false,
|
|
28
|
-
controlRef
|
|
29
|
-
} = params;
|
|
30
|
-
const {
|
|
31
|
-
controlId,
|
|
32
|
-
registerControlId
|
|
33
|
-
} = useLabelableContext();
|
|
34
|
-
const defaultId = useBaseUiId(id);
|
|
35
|
-
const controlIdForEffect = implicit ? controlId : undefined;
|
|
36
|
-
const controlSourceRef = useRefWithInit(() => Symbol("labelable-control"));
|
|
37
|
-
const hasRegisteredRef = React.useRef(false);
|
|
38
|
-
const hadExplicitIdRef = React.useRef(id != null);
|
|
39
|
-
const unregisterControlId = useStableCallback(() => {
|
|
40
|
-
if (!hasRegisteredRef.current || registerControlId === NOOP) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
hasRegisteredRef.current = false;
|
|
44
|
-
registerControlId(controlSourceRef.current, undefined);
|
|
45
|
-
});
|
|
46
|
-
useIsoLayoutEffect(() => {
|
|
47
|
-
if (registerControlId === NOOP) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
let nextId;
|
|
51
|
-
if (implicit) {
|
|
52
|
-
const elem = controlRef?.current;
|
|
53
|
-
if (isElement(elem) && elem.closest("label") != null) {
|
|
54
|
-
nextId = id ?? null;
|
|
55
|
-
} else {
|
|
56
|
-
nextId = controlIdForEffect ?? defaultId;
|
|
57
|
-
}
|
|
58
|
-
} else if (id != null) {
|
|
59
|
-
hadExplicitIdRef.current = true;
|
|
60
|
-
nextId = id;
|
|
61
|
-
} else if (hadExplicitIdRef.current) {
|
|
62
|
-
nextId = defaultId;
|
|
63
|
-
} else {
|
|
64
|
-
unregisterControlId();
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (nextId === undefined) {
|
|
68
|
-
unregisterControlId();
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
hasRegisteredRef.current = true;
|
|
72
|
-
registerControlId(controlSourceRef.current, nextId);
|
|
73
|
-
return;
|
|
74
|
-
}, [id, controlRef, controlIdForEffect, registerControlId, implicit, defaultId, controlSourceRef, unregisterControlId]);
|
|
75
|
-
React.useEffect(() => {
|
|
76
|
-
return unregisterControlId;
|
|
77
|
-
}, [unregisterControlId]);
|
|
78
|
-
return controlId ?? defaultId;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export { useLabelableId };
|