@ngrok/mantle 0.94.1 → 0.95.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/README.md +2 -2
- package/dist/CaretDown-MgTrjdYK.js +1 -0
- package/dist/CaretLeft-CZIqCyEF.js +1 -0
- package/dist/CaretRight-BKz4JHCI.js +1 -0
- package/dist/Check-C5a1hX4x.js +1 -0
- package/dist/CheckCircle-Bi4tSau6.js +1 -0
- package/dist/CircleNotch-BKE0NAIr.js +1 -0
- package/dist/Copy-BYWMO6PW.js +1 -0
- package/dist/Desktop-BaSlSeg2.js +1 -0
- package/dist/Eye-C38LQkZ_.js +1 -0
- package/dist/EyeClosed-BvOq-W8o.js +1 -0
- package/dist/FileText-CqAezJDn.js +1 -0
- package/dist/Info-weHV1B4q.js +1 -0
- package/dist/MagnifyingGlass-DCAoDH5_.js +1 -0
- package/dist/Megaphone-Cir2KHXa.js +1 -0
- package/dist/Minus-KBzmC4_K.js +1 -0
- package/dist/Moon-hn_oivM6.js +1 -0
- package/dist/Plus-D90-H9Ei.js +1 -0
- package/dist/Question-BhvEyO0K.js +1 -0
- package/dist/SidebarSimple-BXKgNz4l.js +1 -0
- package/dist/SortAscending-CEk4rgu_.js +1 -0
- package/dist/SortDescending-C0cE7hpU.js +1 -0
- package/dist/Sun-C3SaXdLl.js +1 -0
- package/dist/Terminal-aKZ6Y9Lk.js +1 -0
- package/dist/Warning-DTwF27_O.js +1 -0
- package/dist/WarningDiamond-BwpdVJ34.js +1 -0
- package/dist/X-BPGjP4b6.js +1 -0
- package/dist/accordion-BmDXs1-q.js +1 -0
- package/dist/accordion-NpJz3Uer.js +1 -0
- package/dist/accordion-parts.d.ts +268 -0
- package/dist/accordion-parts.js +1 -0
- package/dist/accordion.d.ts +4 -395
- package/dist/accordion.js +1 -1
- package/dist/agent.json +409 -42
- package/dist/alert-DCGSrVTa.js +1 -0
- package/dist/{alert-D0zRRUHV.d.ts → alert-Dz541Ve9.d.ts} +7 -193
- package/dist/alert-center-Bb39SBqJ.js +1 -0
- package/dist/alert-center-CGBbqO-y.d.ts +391 -0
- package/dist/alert-center-parts.d.ts +6 -0
- package/dist/alert-center-parts.js +1 -0
- package/dist/alert-center.d.ts +6 -587
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog-CtKnvX5N.js +1 -0
- package/dist/alert-dialog-parts.d.ts +569 -0
- package/dist/alert-dialog-parts.js +1 -0
- package/dist/alert-dialog.d.ts +2 -1065
- package/dist/alert-dialog.js +1 -1
- package/dist/alert-parts.d.ts +6 -0
- package/dist/alert-parts.js +1 -0
- package/dist/alert.d.ts +43 -1
- package/dist/alert.js +1 -1
- package/dist/anchor-DW5_Gb-1.js +1 -0
- package/dist/anchor.d.ts +1 -1
- package/dist/anchor.js +1 -1
- package/dist/app-layout-D7kwv9su.js +1 -0
- package/dist/app-layout-k6UjK30v.d.ts +1167 -0
- package/dist/app-layout-parts.d.ts +6 -0
- package/dist/app-layout-parts.js +1 -0
- package/dist/app-layout.d.ts +98 -1883
- package/dist/app-layout.js +1 -1
- package/dist/area-chart-C6lKu7Un.d.ts +390 -0
- package/dist/area-chart-SAaGaZFD.js +1 -0
- package/dist/area-chart-parts.d.ts +6 -0
- package/dist/area-chart-parts.js +1 -0
- package/dist/area-chart.d.ts +4 -579
- package/dist/area-chart.js +1 -1
- package/dist/avatar-BMZ81f_5.js +1 -0
- package/dist/avatar-Ti8GKSnS.d.ts +201 -0
- package/dist/avatar-parts.d.ts +6 -0
- package/dist/avatar-parts.js +1 -0
- package/dist/avatar.d.ts +3 -275
- package/dist/avatar.js +1 -1
- package/dist/badge.d.ts +3 -2
- package/dist/badge.js +1 -1
- package/dist/bar-chart-C0Ra1ZpG.js +1 -0
- package/dist/bar-chart-Cb5fA8V7.d.ts +386 -0
- package/dist/bar-chart-parts.d.ts +6 -0
- package/dist/bar-chart-parts.js +1 -0
- package/dist/bar-chart.d.ts +4 -583
- package/dist/bar-chart.js +1 -1
- package/dist/behaviors-BW8RjkkS.js +1 -0
- package/dist/behaviors-BbOq5SFv.js +1 -0
- package/dist/behaviors-C7R7ZIoN.js +1 -0
- package/dist/behaviors-CHF5PT3C.js +1 -0
- package/dist/behaviors-CSZQSSfL.js +1 -0
- package/dist/behaviors-CcjvGa0d.js +1 -0
- package/dist/behaviors-CnarRd47.js +1 -0
- package/dist/behaviors-CoNi6Rd-.js +1 -0
- package/dist/behaviors-D9VIyDk1.js +1 -0
- package/dist/behaviors-DHVC34f9.js +1 -0
- package/dist/behaviors-DkCIgQ8w.js +1 -0
- package/dist/behaviors-Mkc_HjTB.js +1 -0
- package/dist/breadcrumb-CAzq3SlR.js +1 -0
- package/dist/breadcrumb-parts.d.ts +287 -0
- package/dist/breadcrumb-parts.js +1 -0
- package/dist/breadcrumb.d.ts +53 -543
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only-CokCtIvB.js +1 -0
- package/dist/browser-only.js +1 -1
- package/dist/button-Bqm7U0OC.js +1 -0
- package/dist/{button-5Pc7Mby_.d.ts → button-C6-6TecO.d.ts} +4 -4
- package/dist/{button-DnYv7IOT.d.ts → button-CL17Dxza.d.ts} +7 -5
- package/dist/button-CRCiBPEF.js +1 -0
- package/dist/{button-Ddj6yr10.d.ts → button-CRMoQyum.d.ts} +2 -3
- package/dist/button-Cr2iY2cI.js +1 -0
- package/dist/button-DhoE-BbZ.js +1 -0
- package/dist/button.d.ts +3 -3
- package/dist/button.js +1 -1
- package/dist/calendar-DQtapcSC.js +1 -0
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card-DbtGVKyo.d.ts +129 -0
- package/dist/card-parts.d.ts +6 -0
- package/dist/card-parts.js +1 -0
- package/dist/card.d.ts +3 -228
- package/dist/card.js +1 -1
- package/dist/centered-layout-parts.d.ts +169 -0
- package/dist/centered-layout-parts.js +1 -0
- package/dist/centered-layout.d.ts +2 -299
- package/dist/centered-layout.js +1 -1
- package/dist/chart-B0n2xyYi.js +1 -0
- package/dist/chart-BPsMxs1f.js +1 -0
- package/dist/chart-BmZoTjRu.js +1 -0
- package/dist/chart-Bybyh2Dc.js +1 -0
- package/dist/chart-CACfdGlp.d.ts +86 -0
- package/dist/chart-CBQJUTIX.js +1 -0
- package/dist/chart-Cb0MBaZx.js +1 -0
- package/dist/chart-CmMcfDmv.js +1 -0
- package/dist/chart-Dlp9FidW.js +2 -0
- package/dist/{chart-Dl8gFo_D.d.ts → chart-XvStK-oM.d.ts} +3 -79
- package/dist/chart-wTwYzUMJ.js +1 -0
- package/dist/checkbox-DH7WFfuR.js +1 -0
- package/dist/checkbox-DsVXD96X.js +1 -0
- package/dist/checkbox-TX74-Iep.js +1 -0
- package/dist/checkbox-group-parts.d.ts +197 -0
- package/dist/checkbox-group-parts.js +1 -0
- package/dist/checkbox.d.ts +59 -8
- package/dist/checkbox.js +1 -1
- package/dist/{choice-CNiOSzqV.d.ts → choice-BekuLm-b.d.ts} +16 -204
- package/dist/choice-DGI8VNR9.d.ts +1 -0
- package/dist/choice-PDT386cc.js +1 -0
- package/dist/choice-parts.d.ts +7 -0
- package/dist/choice-parts.js +1 -0
- package/dist/choice.d.ts +63 -1
- package/dist/choice.js +1 -1
- package/dist/code-UKPv6LVP.js +1 -0
- package/dist/{code-block-CKzsAMzj.js → code-block-B-xD4_RW.js} +3 -3
- package/dist/code-block-B7XPzZnp.js +1 -0
- package/dist/code-block-BXXceNVo.js +1 -0
- package/dist/code-block-C7uzLs8t.js +1 -0
- package/dist/{code-block-BDw6MEwH.d.ts → code-block-Cs1Lcmdr.d.ts} +81 -252
- package/dist/code-block-Erv7wuWW.d.ts +173 -0
- package/dist/code-block-parts.d.ts +380 -0
- package/dist/code-block-parts.js +1 -0
- package/dist/code-block.d.ts +66 -691
- package/dist/code-block.js +6 -6
- package/dist/code-block_highlight-utils.d.ts +2 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +1 -1
- package/dist/code.js +1 -1
- package/dist/combobox-6LXe1cLx.js +1 -0
- package/dist/combobox-parts.d.ts +303 -0
- package/dist/combobox-parts.js +1 -0
- package/dist/combobox.d.ts +2 -465
- package/dist/combobox.js +1 -1
- package/dist/command-B8L-zjGt.js +1 -0
- package/dist/command-CCMWCjAK.js +1 -0
- package/dist/command-VKj84zAX.d.ts +859 -0
- package/dist/command-cbgO9CiG.js +1 -0
- package/dist/command-parts.d.ts +6 -0
- package/dist/command-parts.js +1 -0
- package/dist/command.d.ts +71 -1115
- package/dist/command.js +1 -1
- package/dist/compose-refs-Ce1vWUz0.js +1 -0
- package/dist/cx-CfAFHj5_.js +73 -0
- package/dist/cx-DhYnQ07J.js +1 -0
- package/dist/cx.d.ts +20 -14
- package/dist/cx.js +1 -1
- package/dist/data-table-C-FgaN3_.js +1 -0
- package/dist/data-table-Cw9dUo1w.js +1 -0
- package/dist/data-table-CwqrMtp0.js +1 -0
- package/dist/data-table-GUbt8mzo.d.ts +38 -0
- package/dist/data-table-parts.d.ts +763 -0
- package/dist/data-table-parts.js +1 -0
- package/dist/data-table.d.ts +12 -1208
- package/dist/data-table.js +1 -1
- package/dist/description-list-CjcKOOnr.d.ts +110 -0
- package/dist/description-list-parts.d.ts +6 -0
- package/dist/description-list-parts.js +1 -0
- package/dist/description-list.d.ts +3 -183
- package/dist/description-list.js +1 -1
- package/dist/dialog-4Ed3U7hz.js +1 -0
- package/dist/dialog-BDb_obii.d.ts +166 -0
- package/dist/dialog-BaR9D58J.js +1 -0
- package/dist/dialog-BkNxAcol.d.ts +467 -0
- package/dist/dialog-DSYuhFD5.js +1 -0
- package/dist/dialog-fXMCxM9W.js +1 -0
- package/dist/dialog-parts.d.ts +6 -0
- package/dist/dialog-parts.js +1 -0
- package/dist/dialog.d.ts +88 -2
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-BuluRn0Z.js +1 -0
- package/dist/dropdown-menu-CDXlp0QT.d.ts +507 -0
- package/dist/dropdown-menu-parts.d.ts +6 -0
- package/dist/dropdown-menu-parts.js +1 -0
- package/dist/dropdown-menu.d.ts +57 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty-parts.d.ts +120 -0
- package/dist/empty-parts.js +1 -0
- package/dist/empty.d.ts +2 -216
- package/dist/empty.js +1 -1
- package/dist/field-BRYypbjO.js +1 -0
- package/dist/field-BVMx7HoG.js +1 -0
- package/dist/field-BwCq1b9R.js +1 -0
- package/dist/field-CYAaNexp.js +1 -0
- package/dist/field-DRHAcM1s.js +1 -0
- package/dist/field-parts.d.ts +767 -0
- package/dist/field-parts.js +1 -0
- package/dist/field.d.ts +21 -1201
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +1 -1
- package/dist/flag.js +1 -1
- package/dist/float-C_vwTtzU.js +1 -0
- package/dist/float-JmSzKDHd.js +1 -0
- package/dist/float-OhVY3cf4.js +1 -0
- package/dist/hooks-B-Cd15iL.js +1 -0
- package/dist/hooks-BP_uqBsI.js +1 -0
- package/dist/hooks-BsOjpTgs.js +1 -0
- package/dist/hooks-BybaGF7O.js +1 -0
- package/dist/hooks-C9b-2wGy.js +1 -0
- package/dist/hooks-CMmpICCH.js +1 -0
- package/dist/hooks-CUYIUcp6.js +1 -0
- package/dist/hooks-DKbOd_pQ.js +1 -0
- package/dist/hooks-DejuqCNF.js +1 -0
- package/dist/hooks-GsDfo7Zl.js +1 -0
- package/dist/hooks-PsYFJkz2.js +1 -0
- package/dist/hooks-lDz_S9UG.js +1 -0
- package/dist/hooks.d.ts +96 -7
- package/dist/hooks.js +1 -1
- package/dist/hover-card-BEC5EQiH.js +1 -0
- package/dist/hover-card-parts.d.ts +160 -0
- package/dist/hover-card-parts.js +1 -0
- package/dist/hover-card.d.ts +8 -280
- package/dist/hover-card.js +1 -1
- package/dist/icon-0RoVrpGj.js +1 -0
- package/dist/icon-BSGMvJ0W.js +1 -0
- package/dist/icon-DIiKxRTh.js +1 -0
- package/dist/{icon-QCm1ui29.d.ts → icon-Dqn_LLrR.d.ts} +1 -1
- package/dist/{icon-DuIYoyft.d.ts → icon-KTcDR4--.d.ts} +1 -1
- package/dist/icon.d.ts +2 -2
- package/dist/icon.js +1 -1
- package/dist/icons-CVgj9Whd.js +1 -0
- package/dist/icons-D_4cZaL1.js +1 -0
- package/dist/icons-DucrvIOa.js +1 -0
- package/dist/icons.js +1 -1
- package/dist/{index-KJ06KK6t.d.ts → index-CCkilmv8.d.ts} +1 -1
- package/dist/input-83xaPZWK.js +1 -0
- package/dist/input-B78ah4AB.js +1 -0
- package/dist/{input-DC4nW0Sr.d.ts → input-Bvpu3ruQ.d.ts} +1 -1
- package/dist/input.d.ts +2 -2
- package/dist/input.js +1 -1
- package/dist/kbd-Bz_Rbpv8.js +1 -0
- package/dist/kbd.d.ts +1 -1
- package/dist/kbd.js +1 -1
- package/dist/{label-epgtywRz.d.ts → label-DZpKu3Pu.d.ts} +1 -1
- package/dist/label-DmkAp9xI.js +1 -0
- package/dist/label.d.ts +1 -1
- package/dist/label.js +1 -1
- package/dist/layer-container-DDOZJ0fn.js +1 -0
- package/dist/layer-container.d.ts +9 -1
- package/dist/layer-container.js +1 -1
- package/dist/line-chart-CBL7eCqF.js +1 -0
- package/dist/line-chart-CIDFDkyb.d.ts +380 -0
- package/dist/line-chart-parts.d.ts +6 -0
- package/dist/line-chart-parts.js +1 -0
- package/dist/line-chart.d.ts +4 -568
- package/dist/line-chart.js +1 -1
- package/dist/list-CC3Pi__V.js +1 -0
- package/dist/list-Cx4KNfgC.d.ts +286 -0
- package/dist/list-FiFQJ0BU.js +1 -0
- package/dist/list-parts.d.ts +6 -0
- package/dist/list-parts.js +1 -0
- package/dist/list.d.ts +3 -400
- package/dist/list.js +1 -1
- package/dist/live-region-78gbKwlB.js +1 -0
- package/dist/live-region.d.ts +1 -1
- package/dist/live-region.js +1 -1
- package/dist/llms.txt +33 -10
- package/dist/main-9d96oUPG.js +1 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/mantle.css +1287 -893
- package/dist/media-object-parts.d.ts +65 -0
- package/dist/media-object-parts.js +1 -0
- package/dist/media-object.d.ts +2 -118
- package/dist/media-object.js +1 -1
- package/dist/migrations/0017-select-owned-behavior.yml +117 -0
- package/dist/migrations/0018-combobox-owned-behavior.yml +1661 -0
- package/dist/migrations/0019-multi-select-owned-behavior.yml +1414 -0
- package/dist/migrations/0020-native-floats.yml +823 -0
- package/dist/migrations/0021-native-radio-group.yml +397 -0
- package/dist/migrations/0024-command-owned-behavior.yml +66 -0
- package/dist/migrations/0026-native-dropdown-menu.yml +351 -0
- package/dist/migrations/0029-data-attribute-contract.yml +1707 -0
- package/dist/migrations/0030-between-variant.yml +1954 -0
- package/dist/multi-select-parts.d.ts +487 -0
- package/dist/multi-select-parts.js +1 -0
- package/dist/multi-select-qC0BuYKD.js +1 -0
- package/dist/multi-select.d.ts +6 -803
- package/dist/multi-select.js +1 -1
- package/dist/otp-input-LPdkb_Fg.js +1 -0
- package/dist/otp-input-parts.d.ts +211 -0
- package/dist/otp-input-parts.js +1 -0
- package/dist/otp-input-zl6MVio6.js +1 -0
- package/dist/otp-input.d.ts +11 -252
- package/dist/otp-input.js +1 -1
- package/dist/overlay-prompt-BIzMQvx7.js +1 -0
- package/dist/overlay-prompt-CDnhSoPJ.js +1 -0
- package/dist/overlay-prompt.d.ts +57 -0
- package/dist/overlay-prompt.js +1 -0
- package/dist/pagination-B2ESEbMI.d.ts +171 -0
- package/dist/pagination-CxaLKZcE.js +1 -0
- package/dist/pagination-Df1gTCN-.js +1 -0
- package/dist/pagination-cursor-pagination-parts.d.ts +6 -0
- package/dist/pagination-cursor-pagination-parts.js +1 -0
- package/dist/pagination.d.ts +38 -303
- package/dist/pagination.js +1 -1
- package/dist/popover-DOd6zLvE.d.ts +226 -0
- package/dist/popover-DWvHbepV.js +1 -0
- package/dist/popover-parts.d.ts +6 -0
- package/dist/popover-parts.js +1 -0
- package/dist/popover.d.ts +60 -2
- package/dist/popover.js +1 -1
- package/dist/position-Cv3XpSur.d.ts +5 -0
- package/dist/progress-BE0c8GW8.js +1 -0
- package/dist/progress-ZhFJhv9u.js +1 -0
- package/dist/progress-bar-parts.d.ts +86 -0
- package/dist/progress-bar-parts.js +1 -0
- package/dist/progress-donut-parts.d.ts +94 -0
- package/dist/progress-donut-parts.js +1 -0
- package/dist/progress-mJQMhxMX.js +1 -0
- package/dist/progress-zDpT3TY4.d.ts +2 -0
- package/dist/progress.d.ts +4 -268
- package/dist/progress.js +1 -1
- package/dist/qr-code-0zh10iIE.d.ts +148 -0
- package/dist/qr-code-BOOubA9x.js +1 -0
- package/dist/qr-code-D8tBKtjP.js +1 -0
- package/dist/qr-code-DzJjumoc.d.ts +46 -0
- package/dist/qr-code-encoder.browser.d.ts +15 -0
- package/dist/qr-code-encoder.browser.js +1 -0
- package/dist/qr-code-encoder.d.ts +15 -0
- package/dist/qr-code-encoder.js +1 -0
- package/dist/qr-code-parts.d.ts +6 -0
- package/dist/qr-code-parts.js +1 -0
- package/dist/qr-code.d.ts +4 -227
- package/dist/qr-code.js +1 -1
- package/dist/query-C0e5VYNp.d.ts +440 -0
- package/dist/query-V5NifJGs.js +1 -0
- package/dist/query-filter.js +1 -1
- package/dist/query-parts.d.ts +6 -0
- package/dist/query-parts.js +1 -0
- package/dist/query.d.ts +3 -637
- package/dist/query.js +1 -1
- package/dist/radio-group-B9jtIbV1.d.ts +39 -0
- package/dist/radio-group-f3ThXQCx.js +1 -0
- package/dist/radio-group-parts.d.ts +249 -0
- package/dist/radio-group-parts.js +1 -0
- package/dist/radio-group-zA5DjlLg.js +1 -0
- package/dist/radio-group.d.ts +7 -399
- package/dist/radio-group.js +1 -1
- package/dist/sandbar-Cm2yMjEZ.js +1 -0
- package/dist/sandbar-DU4wpKRc.d.ts +345 -0
- package/dist/sandbar-parts.d.ts +6 -0
- package/dist/sandbar-parts.js +1 -0
- package/dist/sandbar.d.ts +3 -438
- package/dist/sandbar.js +1 -1
- package/dist/sandboxed-on-click-Cg3lewoG.js +1 -0
- package/dist/sandboxed-on-click-DOw_Jkhk.js +1 -0
- package/dist/sandboxed-on-click.d.ts +1 -1
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot-1vFxkpjT.js +1 -0
- package/dist/scatter-plot-D25jLIVw.d.ts +388 -0
- package/dist/scatter-plot-parts.d.ts +6 -0
- package/dist/scatter-plot-parts.js +1 -0
- package/dist/scatter-plot.d.ts +4 -573
- package/dist/scatter-plot.js +1 -1
- package/dist/segmented-control-DuiDPKDZ.js +1 -0
- package/dist/segmented-control-parts.d.ts +72 -0
- package/dist/segmented-control-parts.js +1 -0
- package/dist/segmented-control.d.ts +4 -100
- package/dist/segmented-control.js +1 -1
- package/dist/select-08IEtypH.js +1 -0
- package/dist/select-DM2wWfOO.d.ts +478 -0
- package/dist/select-parts.d.ts +6 -0
- package/dist/select-parts.js +1 -0
- package/dist/select.d.ts +63 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list-Ax5F2Gz1.js +1 -0
- package/dist/selectable-list-CyLc3EEt.d.ts +407 -0
- package/dist/selectable-list-GcpbbRM1.js +1 -0
- package/dist/selectable-list-parts.d.ts +6 -0
- package/dist/selectable-list-parts.js +1 -0
- package/dist/selectable-list.d.ts +3 -643
- package/dist/selectable-list.js +1 -1
- package/dist/separator-BB1ohsjn.js +1 -0
- package/dist/{separator-Ck4sPrdN.d.ts → separator-BzHNVyyv.d.ts} +1 -1
- package/dist/separator.d.ts +1 -1
- package/dist/separator.js +1 -1
- package/dist/sheet-5JgxVaWC.js +1 -0
- package/dist/sheet-parts.d.ts +732 -0
- package/dist/sheet-parts.js +1 -0
- package/dist/sheet-qYPi5MP8.js +1 -0
- package/dist/sheet.d.ts +11 -1224
- package/dist/sheet.js +1 -1
- package/dist/sidebar-CsC9fyPL.js +1 -0
- package/dist/sidebar-HDVxTNPi.js +1 -0
- package/dist/sidebar-OBA7L42d.d.ts +1480 -0
- package/dist/sidebar-parts.d.ts +6 -0
- package/dist/sidebar-parts.js +1 -0
- package/dist/sidebar.d.ts +108 -2518
- package/dist/sidebar.js +1 -1
- package/dist/skeleton-DB0oQyAx.js +1 -0
- package/dist/skeleton.d.ts +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link-BGhAWSqB.js +1 -0
- package/dist/skip-to-main-link.d.ts +1 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider-YlBozcPQ.js +1 -0
- package/dist/slider.d.ts +149 -15
- package/dist/slider.js +1 -1
- package/dist/slot-5ZSmrISx.d.ts +19 -0
- package/dist/slot-BxngGBJ2.js +1 -0
- package/dist/slot-CBcGhRdV.js +1 -0
- package/dist/{slot-BEMQMbk3.d.ts → slot-tuk2J6bY.d.ts} +6 -23
- package/dist/slot.d.ts +1 -1
- package/dist/slot.js +1 -1
- package/dist/split-button-DvJHD7cZ.js +1 -0
- package/dist/split-button-parts.d.ts +178 -0
- package/dist/split-button-parts.js +1 -0
- package/dist/split-button.d.ts +2 -314
- package/dist/split-button.js +1 -1
- package/dist/strata-parts.d.ts +256 -0
- package/dist/strata-parts.js +1 -0
- package/dist/strata.d.ts +4 -493
- package/dist/strata.js +1 -1
- package/dist/switch-DajWYrq3.js +1 -0
- package/dist/switch.d.ts +36 -4
- package/dist/switch.js +1 -1
- package/dist/{table-Ii9hHUWN.d.ts → table-C2KnE83u.d.ts} +5 -444
- package/dist/table-DJHK48-8.js +1 -0
- package/dist/table-parts.d.ts +6 -0
- package/dist/table-parts.js +1 -0
- package/dist/table.d.ts +81 -1
- package/dist/table.js +1 -1
- package/dist/tabs-36-4SlRo.js +1 -0
- package/dist/tabs-CC_HAqr4.d.ts +193 -0
- package/dist/tabs-DayeszXP.js +1 -0
- package/dist/tabs-headless-tabs-parts.d.ts +6 -0
- package/dist/tabs-headless-tabs-parts.js +1 -0
- package/dist/tabs-parts.d.ts +237 -0
- package/dist/tabs-parts.js +1 -0
- package/dist/tabs.d.ts +43 -420
- package/dist/tabs.js +1 -1
- package/dist/text-area-D29JTaZg.js +1 -0
- package/dist/text-area.d.ts +1 -1
- package/dist/text-area.js +1 -1
- package/dist/theme-D6rP5Fy8.js +1 -0
- package/dist/theme-switcher-PKMCyJxT.js +1 -0
- package/dist/theme-switcher.d.ts +23 -19
- package/dist/theme-switcher.js +1 -1
- package/dist/theme-xoFnLba6.js +1 -0
- package/dist/theme.d.ts +70 -65
- package/dist/theme.js +1 -1
- package/dist/time-zone-CpWYKHdp.js +1 -0
- package/dist/time-zone-DZ4hUJ8K.js +1 -0
- package/dist/time-zone.d.ts +190 -0
- package/dist/time-zone.js +1 -0
- package/dist/toast-BJZ__22c.js +1 -0
- package/dist/toast-Cb9IN-6e.d.ts +185 -0
- package/dist/toast-DM_oq-3E.js +1 -0
- package/dist/toast-parts.d.ts +6 -0
- package/dist/toast-parts.js +1 -0
- package/dist/toast.d.ts +7 -256
- package/dist/toast.js +1 -1
- package/dist/tokens.dark.json +31 -266
- package/dist/tokens.json +139 -205
- package/dist/tooltip-D4HZn19B.js +1 -0
- package/dist/tooltip-DP6Lz6jv.d.ts +180 -0
- package/dist/tooltip-Uy-kz0rK.d.ts +1 -0
- package/dist/tooltip-parts.d.ts +7 -0
- package/dist/tooltip-parts.js +1 -0
- package/dist/tooltip.d.ts +57 -1
- package/dist/tooltip.js +1 -1
- package/dist/truncated-text-B5u2AlNg.js +1 -0
- package/dist/truncated-text-BoXHP-cD.js +1 -0
- package/dist/truncated-text.d.ts +3 -5
- package/dist/truncated-text.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/typography-C2BmSH12.d.ts +148 -0
- package/dist/typography-parts.d.ts +6 -0
- package/dist/typography-parts.js +1 -0
- package/dist/typography.d.ts +52 -0
- package/dist/typography.js +1 -0
- package/dist/use-combobox-OhIEVioc.d.ts +23 -0
- package/dist/use-float-WEqqhXBE.d.ts +18 -0
- package/dist/use-listbox-D4uIonSN.d.ts +1 -0
- package/dist/utils-BN3rwHzz.js +1 -0
- package/dist/utils-BlLYcYik.js +1 -0
- package/dist/utils-C4astHJG.js +1 -0
- package/dist/utils-CPSttKPD.js +1 -0
- package/dist/utils.js +1 -1
- package/dist/visually-hidden.d.ts +1 -1
- package/dist/visually-hidden.js +1 -1
- package/dist/well.d.ts +2 -2
- package/dist/well.js +1 -1
- package/dist/world-map-BDd3N_Ap.d.ts +424 -0
- package/dist/world-map-D3c8Pq-h.js +1 -0
- package/dist/world-map-parts.d.ts +6 -0
- package/dist/world-map-parts.js +1 -0
- package/dist/world-map-t9U-IMKS.js +1 -0
- package/dist/world-map.d.ts +80 -0
- package/dist/world-map.js +1 -0
- package/package.json +15 -18
- package/dist/alert-BkJHDx9X.js +0 -1
- package/dist/anchor-Dc6IgvXV.js +0 -1
- package/dist/browser-only-CZfkNw5A.js +0 -1
- package/dist/button-B9bChDgl.js +0 -1
- package/dist/button-BQZ6eoD3.js +0 -1
- package/dist/button-D8jixIbH.js +0 -1
- package/dist/button-DNLTJ32M.js +0 -1
- package/dist/chart-BLCqzt56.js +0 -1
- package/dist/chart-CChZiCrt.js +0 -1
- package/dist/chart-CUmSu9d7.js +0 -1
- package/dist/chart-DtgZBAas.js +0 -2
- package/dist/checkbox-Cu5cgZmk.js +0 -1
- package/dist/choice-CCVG2hb9.js +0 -1
- package/dist/clsx-DUGZgXfJ.js +0 -1
- package/dist/clsx-Dj3RWZ2l.js +0 -1
- package/dist/code-BPKNY1_w.js +0 -1
- package/dist/cx-CK7o_rVv.js +0 -1
- package/dist/dialog-CIEuwNys.d.ts +0 -958
- package/dist/dialog-CbEEA0fl.d.ts +0 -32
- package/dist/dialog-DmzoDfY3.js +0 -1
- package/dist/dropdown-menu-CeY498yk.d.ts +0 -775
- package/dist/dropdown-menu-uheL0prz.js +0 -1
- package/dist/field-Bpvn4tQp.js +0 -1
- package/dist/field-Cai_4c1l.js +0 -1
- package/dist/icon-BudQMD2S.js +0 -1
- package/dist/icon-xb7d9M7X.js +0 -1
- package/dist/icons-DEDCLZ8B.js +0 -1
- package/dist/icons-DXadFwpo.js +0 -1
- package/dist/icons-DcesO4Ng.js +0 -1
- package/dist/input-DQyN6gN0.js +0 -1
- package/dist/input-fW8QSZEO.js +0 -1
- package/dist/interactive-target-BXScNeOr.js +0 -1
- package/dist/kbd-P1nQshWo.js +0 -1
- package/dist/label-DO1RlMKl.js +0 -1
- package/dist/layer-container-DL4yclOu.js +0 -1
- package/dist/list-cQZPSjfz.js +0 -1
- package/dist/live-region-Dhapu8a5.js +0 -1
- package/dist/main-CHyWYDak.js +0 -1
- package/dist/popover-Bei0jyfH.d.ts +0 -357
- package/dist/popover-DhgunktK.js +0 -1
- package/dist/popover-T2EyaqGK.d.ts +0 -1
- package/dist/primitive-D8CzV_Ft.js +0 -1
- package/dist/radio-group-BJQ6EOqh.d.ts +0 -27
- package/dist/radio-group-ggEkCi0V.js +0 -1
- package/dist/sandboxed-on-click-D4PL5_GR.js +0 -1
- package/dist/select-1xuUx_os.js +0 -1
- package/dist/select-BpaXHxJm.d.ts +0 -890
- package/dist/separator-DnvhwY2J.js +0 -1
- package/dist/shake-CAUpKBHe.js +0 -1
- package/dist/sheet-DHy_vlme.js +0 -1
- package/dist/skeleton-DHfyjuQi.js +0 -1
- package/dist/slot-B7rwscwd.js +0 -1
- package/dist/table-BnLdXUai.js +0 -1
- package/dist/theme-BNdZl352.js +0 -1
- package/dist/tooltip-CstGDKwy.d.ts +0 -283
- package/dist/tooltip-DQO40Mrq.js +0 -1
- package/dist/use-breakpoint-B4Kh0xE6.js +0 -1
- package/dist/use-callback-ref-DiOXFQzM.js +0 -1
- package/dist/use-composed-refs-DPYmLDSe.js +0 -1
- package/dist/use-copy-to-clipboard-hBL6_65i.js +0 -1
- package/dist/use-inert-siblings-C4RHXrZc.js +0 -1
- package/dist/use-is-apple-platform-Bq6_KbVX.js +0 -1
- package/dist/use-is-hydrated-after-paint-CrHt3OHw.js +0 -1
- package/dist/use-isomorphic-layout-effect-CL6iq0Bj.js +0 -1
- package/dist/use-matches-media-query-FfvtNKQe.js +0 -1
- package/dist/use-prefers-reduced-motion-Ck6dnOM9.js +0 -1
- package/dist/use-swipe-to-dismiss-BYdlca8r.js +0 -1
- /package/dist/{use-is-hydrated-BeLOGKwE.js → hooks-BeLOGKwE.js} +0 -0
- /package/dist/{suggestions-Ciz2vaJO.js → query-filter-Ciz2vaJO.js} +0 -0
- /package/dist/{direction-CvDpql3O.js → sorting-CvDpql3O.js} +0 -0
- /package/dist/{booleanish-BfvnW6vy.js → types-BfvnW6vy.js} +0 -0
- /package/dist/{css-properties-D85fCNV3.js → types-D85fCNV3.js} +0 -0
- /package/dist/{alternate-announcement-BkH4bOKp.js → utils-BkH4bOKp.js} +0 -0
- /package/dist/{copy-to-clipboard-Dd83caRw.js → utils-Dd83caRw.js} +0 -0
- /package/dist/{in-view-Dxv_GrUU.js → utils-Dxv_GrUU.js} +0 -0
- /package/dist/{data-slot-EM6s2WEU.js → utils-EM6s2WEU.js} +0 -0
- /package/dist/{cookie-ca4g5CKp.js → utils-ca4g5CKp.js} +0 -0
package/dist/multi-select.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{t as e}from"./use-isomorphic-layout-effect-CL6iq0Bj.js";import{t}from"./compose-refs-BdRUneoc.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{o as i,s as a}from"./layer-container-DL4yclOu.js";import{t as o}from"./shake-CAUpKBHe.js";import{t as s}from"./field-Cai_4c1l.js";import{a as c,r as l}from"./field-Bpvn4tQp.js";import{t as u}from"./icon-xb7d9M7X.js";import{n as d}from"./separator-DnvhwY2J.js";import{t as f}from"./slot-B7rwscwd.js";import{c as p}from"react/compiler-runtime";import{cloneElement as m,createContext as h,isValidElement as g,useContext as _,useEffect as v,useRef as y,useState as b}from"react";import x from"tiny-invariant";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";import{XIcon as T}from"@phosphor-icons/react/X";import{CheckIcon as E}from"@phosphor-icons/react/Check";import{Combobox as D,ComboboxGroup as O,ComboboxGroupLabel as k,ComboboxItem as A,ComboboxItemCheck as j,ComboboxPopover as M,ComboboxProvider as N,useComboboxContext as P}from"@ariakit/react/combobox";import{useStoreState as F}from"@ariakit/react/store";import{LockIcon as I}from"@phosphor-icons/react/Lock";const L=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),R=[],z=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),B=h({current:null}),V=h(void 0),H=h(R),U=h({onInputKeyDownRef:{current:void 0},inputRef:{current:null},setLockedValues:()=>{}}),W=e=>{let t=p(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,defaultSelectedValue:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?R:i,o=y(null),s=y(void 0),c=y(null),[l,u]=b(R),d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d={onInputKeyDownRef:s,inputRef:c,setLockedValues:u},t[4]=d):d=t[4];let f=d,m;t[5]!==n||t[6]!==a||t[7]!==r?(m=/* @__PURE__ */ C(N,{defaultSelectedValue:a,...r,children:n}),t[5]=n,t[6]=a,t[7]=r,t[8]=m):m=t[8];let h;return t[9]!==l||t[10]!==m?(h=/* @__PURE__ */ C(B.Provider,{value:o,children:/* @__PURE__ */ C(U.Provider,{value:f,children:/* @__PURE__ */ C(H.Provider,{value:l,children:m})})}),t[9]=l,t[10]=m,t[11]=h):h=t[11],h},G=e=>{let i=p(38),a,o,s,u,d,f,m,h,g;i[0]===e?(a=i[1],o=i[2],s=i[3],u=i[4],d=i[5],f=i[6],m=i[7],h=i[8],g=i[9]):({"data-slot":d,"aria-invalid":a,className:u,children:s,onKeyDown:f,onMouseDown:m,ref:g,validation:o,...h}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=u,i[5]=d,i[6]=f,i[7]=m,i[8]=h,i[9]=g);let v=_(B),{inputRef:y}=_(U),b=P(),x=c(),S=o??x,w;i[10]!==a||i[11]!==S?(w=l({"aria-invalid":a,validation:S}),i[10]=a,i[11]=S,i[12]=w):w=i[12];let{ariaInvalid:T,validation:E}=w,D;i[13]===d?D=i[14]:(D=r(d,`multi-select-trigger`),i[13]=d,i[14]=D);let O;i[15]===u?O=i[16]:(O=n(`cursor-text select-none font-sans text-sm`,`border-form bg-form text-strong flex min-h-9 w-full flex-wrap items-center gap-1 rounded-md border px-3 py-1 has-data-[slot=multi-select-tag]:px-1`,`has-focus:outline-hidden has-focus-within:ring-4 has-aria-expanded:ring-4`,`has-focus-within:border-accent-600 has-focus-within:ring-focus-accent has-aria-expanded:border-accent-600 has-aria-expanded:ring-focus-accent`,`data-validation-success:border-success-600 data-validation-success:has-focus-within:border-success-600 data-validation-success:has-focus-within:ring-focus-success data-validation-success:has-aria-expanded:border-success-600 data-validation-success:has-aria-expanded:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:has-focus-within:border-warning-600 data-validation-warning:has-focus-within:ring-focus-warning data-validation-warning:has-aria-expanded:border-warning-600 data-validation-warning:has-aria-expanded:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:has-focus-within:border-danger-600 data-validation-error:has-focus-within:ring-focus-danger data-validation-error:has-aria-expanded:border-danger-600 data-validation-error:has-aria-expanded:ring-focus-danger motion-safe:data-validation-error:animate-shake`,u),i[15]=u,i[16]=O);let k=E||void 0,A;i[17]!==f||i[18]!==b?(A=e=>{e.key===`Escape`&&b?.getState().open&&(e.preventDefault(),b.hide()),f?.(e)},i[17]=f,i[18]=b,i[19]=A):A=i[19];let j;i[20]!==y||i[21]!==m?(j=e=>{e.target instanceof HTMLElement&&!e.target.closest(`button, input, [data-slot='multi-select-tag']`)&&(e.preventDefault(),y.current?.focus()),m?.(e)},i[20]=y,i[21]=m,i[22]=j):j=i[22];let M;i[23]!==g||i[24]!==v?(M=t(v,g),i[23]=g,i[24]=v,i[25]=M):M=i[25];let N;i[26]!==s||i[27]!==h||i[28]!==D||i[29]!==O||i[30]!==k||i[31]!==A||i[32]!==j||i[33]!==M?(N=/* @__PURE__ */ C(`div`,{role:`presentation`,"data-slot":D,className:O,"data-validation":k,onKeyDown:A,onMouseDown:j,ref:M,...h,children:s}),i[26]=s,i[27]=h,i[28]=D,i[29]=O,i[30]=k,i[31]=A,i[32]=j,i[33]=M,i[34]=N):N=i[34];let F;return i[35]!==T||i[36]!==N?(F=/* @__PURE__ */ C(V.Provider,{value:T,children:N}),i[35]=T,i[36]=N,i[37]=F):F=i[37],F},K=e=>{let i=p(47),a,s,c,l,d,f,m,h,g,_;i[0]===e?(a=i[1],s=i[2],c=i[3],l=i[4],d=i[5],f=i[6],m=i[7],h=i[8],g=i[9],_=i[10]):({"data-slot":s,className:a,value:_,onRemove:f,locked:g,onBlur:c,onFocus:l,onKeyDown:d,ref:h,...m}=e,i[0]=e,i[1]=a,i[2]=s,i[3]=c,i[4]=l,i[5]=d,i[6]=f,i[7]=m,i[8]=h,i[9]=g,i[10]=_);let v=g!==void 0&&g,x=y(null),[S,E]=b(!1),D;i[11]===h?D=i[12]:(D=t(x,h),i[11]=h,i[12]=D);let O;i[13]===s?O=i[14]:(O=r(s,`multi-select-tag`),i[13]=s,i[14]=O);let k=S||void 0,A=v||void 0,j;i[15]===a?j=i[16]:(j=n(`cursor-default bg-neutral-500/10 border border-neutral-500/20 rounded-xs text-strong inline-flex items-center gap-1 pl-2 pr-0.5 py-0.5 text-sm font-normal motion-safe:data-shake:animate-shake`,`focus-visible:outline-hidden focus-visible:border-accent-600/50 focus-visible:ring-3 focus-visible:ring-focus-accent`,a),i[15]=a,i[16]=j);let M;i[17]===c?M=i[18]:(M=e=>{E(!1),c?.(e)},i[17]=c,i[18]=M);let N;i[19]===l?N=i[20]:(N=e=>{E(!0),l?.(e)},i[19]=l,i[20]=N);let P;i[21]!==v||i[22]!==d?(P=e=>{v&&(e.key===`Backspace`||e.key===`Delete`)?(e.preventDefault(),o(e.currentTarget)):d?.(e)},i[21]=v,i[22]=d,i[23]=P):P=i[23];let F=`Remove ${_}`,L=v||void 0,R;i[24]===Symbol.for(`react.memo_cache_sentinel`)?(R=n(`cursor-pointer text-strong/40 hover:bg-neutral-500/15 hover:text-strong rounded-xs p-0.5`,`aria-disabled:cursor-default aria-disabled:hover:bg-transparent aria-disabled:hover:text-strong/40`),i[24]=R):R=i[24];let z;i[25]!==v||i[26]!==f?(z=e=>{if(e.stopPropagation(),v){let e=x.current;e&&o(e)}else f?.()},i[25]=v,i[26]=f,i[27]=z):z=i[27];let B;i[28]===v?B=i[29]:(B=/* @__PURE__ */ C(u,{svg:v?/* @__PURE__ */ C(I,{}):/* @__PURE__ */ C(T,{weight:`bold`}),className:`size-4`}),i[28]=v,i[29]=B);let V;i[30]!==F||i[31]!==L||i[32]!==z||i[33]!==B?(V=/* @__PURE__ */ C(`button`,{type:`button`,"aria-label":F,tabIndex:-1,"aria-disabled":L,className:R,onClick:z,onMouseDown:$,children:B}),i[30]=F,i[31]=L,i[32]=z,i[33]=B,i[34]=V):V=i[34];let H;return i[35]!==m||i[36]!==V||i[37]!==D||i[38]!==O||i[39]!==k||i[40]!==A||i[41]!==j||i[42]!==M||i[43]!==N||i[44]!==P||i[45]!==_?(H=/* @__PURE__ */ w(`span`,{ref:D,role:`listitem`,tabIndex:-1,"data-slot":O,"data-active":k,"data-locked":A,className:j,onBlur:M,onFocus:N,onKeyDown:P,...m,children:[_,V]}),i[35]=m,i[36]=V,i[37]=D,i[38]=O,i[39]=k,i[40]=A,i[41]=j,i[42]=M,i[43]=N,i[44]=P,i[45]=_,i[46]=H):H=i[46],H},q=({render:e,...t})=>e(t),J=t=>{let n=p(22),{"aria-label":r,children:i,lockedValues:a}=t,s=r===void 0?`Selected values`:r,c=a===void 0?R:a,l=P(),u=F(l,`selectedValue`),d;n[0]===u?d=n[1]:(d=L(u)?u:void 0,n[0]=u,n[1]=d);let f=d??R,m=y(f),h,g;n[2]===f?(h=n[3],g=n[4]):(h=()=>{m.current=f},g=[f],n[2]=f,n[3]=h,n[4]=g),e(h,g);let b;n[5]===c?b=n[6]:(b=new Set(c),n[5]=c,n[6]=b);let x=b,S=y(/* @__PURE__ */ new Map),{onInputKeyDownRef:w,inputRef:T,setLockedValues:E}=_(U),D,O;n[7]!==c||n[8]!==E?(D=()=>{E(e=>z(e,c)?e:c)},O=[c,E],n[7]=c,n[8]=E,n[9]=D,n[10]=O):(D=n[9],O=n[10]),e(D,O);let k,A;n[11]===E?(k=n[12],A=n[13]):(A=()=>()=>{E(R)},k=[E],n[11]=E,n[12]=k,n[13]=A),e(A,k);let j;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(j=/* @__PURE__ */ new Set,n[14]=j):j=n[14];let M=y(j),N,I;n[15]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>()=>{M.current.forEach(cancelAnimationFrame)},I=[],n[15]=N,n[16]=I):(N=n[15],I=n[16]),v(N,I);let B=e=>{let t=requestAnimationFrame(()=>{M.current.delete(t),e()});M.current.add(t)},V;n[17]===l?V=n[18]:(V=e=>{if(l){let t=l.getState().selectedValue;if(!L(t))return;l.setSelectedValue(t.filter(t=>t!==e))}},n[17]=l,n[18]=V);let H=V,W=e=>{let t=m.current[e];if(t==null)return;let n=S.current.get(t);n&&(n.focus(),l?.show())},G=()=>{T.current?.focus()},J=(e,t)=>{let n=f[t];bb65:switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&W(t-1);break bb65;case`ArrowRight`:e.preventDefault(),t<f.length-1?W(t+1):G();break bb65;case`Backspace`:case`Delete`:if(e.preventDefault(),n!=null){if(x.has(n)){let e=S.current.get(n);e&&o(e);break bb65}if(H(n),e.key===`Backspace`){if(t>0){let e=t-1;B(()=>W(e))}else B(()=>{m.current.length>0?W(0):G()})}else B(()=>{t<m.current.length?W(t):G()})}break bb65;case`ArrowUp`:case`ArrowDown`:e.preventDefault(),G(),T.current?.dispatchEvent(new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0,cancelable:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey}));break bb65;default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&G()}},Y=e=>{if(e.key===`ArrowLeft`&&e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===0&&f.length>0)e.preventDefault(),W(f.length-1);else if(e.key===`Backspace`&&e.currentTarget.value===``&&f.length>0){let e=f[f.length-1];if(e!=null){if(x.has(e)){let t=S.current.get(e);t&&o(t)}else H(e)}}};if(e(()=>(w.current=Y,()=>{w.current=void 0})),f.length===0)return null;let X=f.map((e,t)=>{let n={value:e,locked:x.has(e),onRemove:()=>{if(x.has(e)){let t=S.current.get(e);t&&o(t)}else H(e)},ref:t=>{t?S.current.set(e,t):S.current.delete(e)},onKeyDown:e=>J(e,t),onClick:()=>W(t)};return i?/* @__PURE__ */ C(q,{render:i,...n},e):/* @__PURE__ */ C(K,{...n},e)}),Z;return n[19]!==s||n[20]!==X?(Z=/* @__PURE__ */ C(`span`,{role:`list`,"aria-label":s,"data-slot":`multi-select-tag-list`,className:`contents`,children:X}),n[19]=s,n[20]=X,n[21]=Z):Z=n[21],Z},Y=e=>{let i=p(44),a,o,c,l,u,d,f,m,h,g;i[0]===e?(a=i[1],o=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],m=i[8],h=i[9],g=i[10]):({"data-slot":o,className:a,onBlur:c,onChange:l,onFocus:u,onKeyDown:d,onValueChange:f,placeholder:m,ref:g,...h}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=c,i[4]=l,i[5]=u,i[6]=d,i[7]=f,i[8]=m,i[9]=h,i[10]=g);let v=P(),{onInputKeyDownRef:y,inputRef:b}=_(U),x=_(s),S=_(V),w=F(v,`selectedValue`),T=((L(w)?w:void 0)?.length??0)>0,E;i[11]===o?E=i[12]:(E=r(o,`multi-select-input`),i[11]=o,i[12]=E);let O;i[13]===a?O=i[14]:(O=n(`pointer-coarse:text-base min-w-20 flex-1 select-text border-0 bg-transparent text-sm outline-hidden`,`placeholder:select-none placeholder:text-placeholder`,a),i[13]=a,i[14]=O);let k;i[15]!==l||i[16]!==f?(k=e=>{f?.(e.target.value),l?.(e)},i[15]=l,i[16]=f,i[17]=k):k=i[17];let A;i[18]!==y||i[19]!==d?(A=e=>{y.current?.(e),d?.(e)},i[18]=y,i[19]=d,i[20]=A):A=i[20];let j;i[21]!==c||i[22]!==v?(j=e=>{e.relatedTarget instanceof HTMLElement&&e.relatedTarget.closest(`[data-slot~="multi-select-tag"]`)&&v?.show(),c?.(e)},i[21]=c,i[22]=v,i[23]=j):j=i[23];let M;i[24]!==u||i[25]!==v?(M=e=>{v?.show(),u?.(e)},i[24]=u,i[25]=v,i[26]=M):M=i[26];let N=T?void 0:m,I;i[27]!==b||i[28]!==g?(I=t(b,g),i[27]=b,i[28]=g,i[29]=I):I=i[29];let R;i[30]===x?R=i[31]:(R=x?{"aria-describedby":x[`aria-describedby`],"aria-errormessage":x[`aria-errormessage`],"aria-invalid":x[`aria-invalid`],id:x.id,name:x.name}:void 0,i[30]=x,i[31]=R);let z;return i[32]!==h||i[33]!==E||i[34]!==O||i[35]!==k||i[36]!==A||i[37]!==j||i[38]!==M||i[39]!==N||i[40]!==I||i[41]!==R||i[42]!==S?(z=/* @__PURE__ */ C(D,{autoSelect:!0,"aria-invalid":S,"data-slot":E,className:O,onChange:k,onKeyDown:A,onBlur:j,onFocus:M,placeholder:N,ref:I,...h,...R}),i[32]=h,i[33]=E,i[34]=O,i[35]=k,i[36]=A,i[37]=j,i[38]=M,i[39]=N,i[40]=I,i[41]=R,i[42]=S,i[43]=z):z=i[43],z},X=e=>{let t=p(40),o,s,c,l,u,d,f,m,h,g,v,y;t[0]===e?(o=t[1],s=t[2],c=t[3],l=t[4],u=t[5],d=t[6],f=t[7],m=t[8],h=t[9],g=t[10],v=t[11],y=t[12]):({"data-slot":c,asChild:m,backdrop:h,children:o,className:s,modal:g,portalElement:l,preventBodyScroll:u,ref:f,sameWidth:v,unmountOnHide:y,...d}=e,t[0]=e,t[1]=o,t[2]=s,t[3]=c,t[4]=l,t[5]=u,t[6]=d,t[7]=f,t[8]=m,t[9]=h,t[10]=g,t[11]=v,t[12]=y);let b=m!==void 0&&m,x=h!==void 0&&h,S=g===void 0||g,w=v===void 0||v,T=y===void 0||y,E=_(B),D=a(),O=i(),k;t[13]===E?k=t[14]:(k=()=>E.current?.getBoundingClientRect()??null,t[13]=E,t[14]=k);let A=k,j;t[15]!==D||t[16]!==l||t[17]!==E?(j=e=>typeof l==`function`?l(e):l??E.current?.closest(`[data-mantle-modal-content]`)??(D instanceof HTMLElement?D:null)??e.ownerDocument.body,t[15]=D,t[16]=l,t[17]=E,t[18]=j):j=t[18];let N=j,P;t[19]===E?P=t[20]:(P=e=>!(e.target instanceof Node&&E.current?.contains(e.target)),t[19]=E,t[20]=P);let F=P,I;t[21]===c?I=t[22]:(I=r(c,`multi-select-content`),t[21]=c,t[22]=I);let L;t[23]===s?L=t[24]:(L=n(`border-popover bg-popover relative z-50 max-h-96 min-w-32 scrollbar overflow-y-scroll overflow-x-hidden overscroll-y-none rounded-md border shadow-md pt-1 pb-1 has-data-content-footer:pb-0 font-sans flex flex-col gap-px focus:outline-hidden`,s),t[23]=s,t[24]=L);let R=u??!O,z=b?ee:void 0,V;return t[25]!==x||t[26]!==o||t[27]!==A||t[28]!==N||t[29]!==F||t[30]!==S||t[31]!==d||t[32]!==f||t[33]!==w||t[34]!==L||t[35]!==R||t[36]!==z||t[37]!==I||t[38]!==T?(V=/* @__PURE__ */ C(M,{"data-slot":I,className:L,backdrop:x,getAnchorRect:A,gutter:4,hideOnInteractOutside:F,modal:S,portalElement:N,preventBodyScroll:R,ref:f,render:z,sameWidth:w,unmountOnHide:T,...d,children:o}),t[25]=x,t[26]=o,t[27]=A,t[28]=N,t[29]=F,t[30]=S,t[31]=d,t[32]=f,t[33]=w,t[34]=L,t[35]=R,t[36]=z,t[37]=I,t[38]=T,t[39]=V):V=t[39],V},Z=e=>/* @__PURE__ */ C(`div`,{"data-slot":`multi-select-item-label`,className:`contents`,children:e}),Q={Root:W,Trigger:G,TagValues:J,Input:Y,Tag:K,Content:X,ContentFooter:e=>{let t=p(16),i,a,o,s,c;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5]):({"data-slot":o,className:a,children:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c);let l;t[6]===o?l=t[7]:(l=r(o,`multi-select-content-footer`),t[6]=o,t[7]=l);let u;t[8]===a?u=t[9]:(u=n(`bg-popover sticky bottom-0 border-t border-popover`,a),t[8]=a,t[9]=u);let d;return t[10]!==i||t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==u?(d=/* @__PURE__ */ C(`div`,{ref:c,"data-slot":l,"data-content-footer":!0,className:u,...s,children:i}),t[10]=i,t[11]=s,t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15],d},Item:e=>{let t=p(41),i,a,o,s,c,l,d,f,h;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],d=t[7],f=t[8],h=t[9]):({"data-slot":o,asChild:d,children:i,className:a,focusOnHover:f,value:h,onClick:s,ref:l,...c}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=d,t[8]=f,t[9]=h);let v=d!==void 0&&d,y=f===void 0||f,b=_(H),T;t[10]!==b||t[11]!==h?(T=h!=null&&b.includes(h),t[10]=b,t[11]=h,t[12]=T):T=t[12];let D=T,O;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(O=/* @__PURE__ */ C(j,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:/* @__PURE__ */ C(u,{svg:/* @__PURE__ */ C(E,{weight:`bold`}),className:`size-4 text-accent-600`})}),t[13]=O):O=t[13];let k=O,M;if(v){x(g(i),"When using `asChild`, MultiSelect.Item must be passed a single child as a JSX tag.");let e;if(t[14]!==i){let n;t[16]===i.props.children?n=t[17]:(n=Z(i.props.children),t[16]=i.props.children,t[17]=n);let r;t[18]===n?r=t[19]:(r=/* @__PURE__ */ w(S,{children:[n,k]}),t[18]=n,t[19]=r),e=m(i,{},r),t[14]=i,t[15]=e}else e=t[15];M=e}else{let e;t[20]===i?e=t[21]:(e=Z(i),t[20]=i,t[21]=e);let n;t[22]===e?n=t[23]:(n=/* @__PURE__ */ w(S,{children:[e,k]}),t[22]=e,t[23]=n),M=n}let N;t[24]===o?N=t[25]:(N=r(o,`multi-select-item`),t[24]=o,t[25]=N);let P;t[26]===a?P=t[27]:(P=n(`relative mx-1 cursor-pointer rounded-md pl-2 pr-8 py-1.5 text-strong text-sm font-normal flex min-w-0 items-center gap-2`,`[[role=option]+&]:mt-px`,`data-active-item:bg-active-menu-item`,`aria-disabled:opacity-50`,`aria-selected:bg-selected-menu-item aria-selected:data-active-item:bg-active-selected-menu-item`,a),t[26]=a,t[27]=P);let F;t[28]!==D||t[29]!==s?(F=e=>{D?e.preventDefault():s?.(e)},t[28]=D,t[29]=s,t[30]=F):F=t[30];let I=v?te:void 0,L;return t[31]!==M||t[32]!==y||t[33]!==c||t[34]!==l||t[35]!==N||t[36]!==P||t[37]!==F||t[38]!==I||t[39]!==h?(L=/* @__PURE__ */ C(A,{"data-slot":N,className:P,focusOnHover:y,onClick:F,ref:l,render:I,resetValueOnSelect:!0,value:h,...c,children:M}),t[31]=M,t[32]=y,t[33]=c,t[34]=l,t[35]=N,t[36]=P,t[37]=F,t[38]=I,t[39]=h,t[40]=L):L=t[40],L},Group:e=>{let t=p(18),i,a,o,s,c,l;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6]):({"data-slot":o,asChild:l,children:i,className:a,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l);let u=l!==void 0&&l,d;t[7]===o?d=t[8]:(d=r(o,`multi-select-group`),t[7]=o,t[8]=d);let f;t[9]===a?f=t[10]:(f=n(`mx-1`,a),t[9]=a,t[10]=f);let m=u?ne:void 0,h;return t[11]!==i||t[12]!==s||t[13]!==c||t[14]!==d||t[15]!==f||t[16]!==m?(h=/* @__PURE__ */ C(O,{"data-slot":d,className:f,ref:c,render:m,...s,children:i}),t[11]=i,t[12]=s,t[13]=c,t[14]=d,t[15]=f,t[16]=m,t[17]=h):h=t[17],h},GroupLabel:e=>{let t=p(18),i,a,o,s,c,l;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6]):({"data-slot":o,asChild:l,children:i,className:a,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l);let u=l!==void 0&&l,d;t[7]===o?d=t[8]:(d=r(o,`multi-select-group-label`),t[7]=o,t[8]=d);let f;t[9]===a?f=t[10]:(f=n(`text-muted px-2 py-1 text-xs font-medium`,a),t[9]=a,t[10]=f);let m=u?re:void 0,h;return t[11]!==i||t[12]!==s||t[13]!==c||t[14]!==d||t[15]!==f||t[16]!==m?(h=/* @__PURE__ */ C(k,{"data-slot":d,className:f,ref:c,render:m,...s,children:i}),t[11]=i,t[12]=s,t[13]=c,t[14]=d,t[15]=f,t[16]=m,t[17]=h):h=t[17],h},GroupDescription:e=>{let t=p(16),i,a,o,s,c;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5]):({"data-slot":o,className:a,children:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c);let l;t[6]===o?l=t[7]:(l=r(o,`multi-select-group-description`),t[6]=o,t[7]=l);let u;t[8]===a?u=t[9]:(u=n(`text-muted px-2 pb-1 text-xs`,a),t[8]=a,t[9]=u);let d;return t[10]!==i||t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==u?(d=/* @__PURE__ */ C(`p`,{"data-slot":l,className:u,ref:c,...s,children:i}),t[10]=i,t[11]=s,t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15],d},Separator:e=>{let t=p(14),i,a,o,s;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4]):({"data-slot":a,className:i,ref:s,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s);let c;t[5]===a?c=t[6]:(c=r(a,`multi-select-separator`),t[5]=a,t[6]=c);let l;t[7]===i?l=t[8]:(l=n(`my-1 w-auto`,i),t[7]=i,t[8]=l);let u;return t[9]!==o||t[10]!==s||t[11]!==c||t[12]!==l?(u=/* @__PURE__ */ C(d,{"data-slot":c,ref:s,className:l,...o}),t[9]=o,t[10]=s,t[11]=c,t[12]=l,t[13]=u):u=t[13],u},Empty:e=>{let t=p(16),i,a,o,s,c;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5]):({"data-slot":o,className:a,children:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c);let l;t[6]===o?l=t[7]:(l=r(o,`multi-select-empty`),t[6]=o,t[7]=l);let u;t[8]===a?u=t[9]:(u=n(`mx-1 text-muted px-2 py-6 text-center text-sm`,a),t[8]=a,t[9]=u);let d;return t[10]!==i||t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==u?(d=/* @__PURE__ */ C(`div`,{"data-slot":l,className:u,ref:c,role:`presentation`,...s,children:i}),t[10]=i,t[11]=s,t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15],d}};function $(e){e.preventDefault()}function ee(e){let{ref:t,...n}=e;return/* @__PURE__ */ C(f,{ref:t,...n})}function te(e){let{ref:t,...n}=e;return/* @__PURE__ */ C(f,{ref:t,...n})}function ne(e){let{ref:t,...n}=e;return/* @__PURE__ */ C(f,{ref:t,...n})}function re(e){let{ref:t,...n}=e;return/* @__PURE__ */ C(f,{ref:t,...n})}export{Q as MultiSelect};
|
|
1
|
+
export*as MultiSelect from"./multi-select-parts.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=({selection:e,length:t,maxLength:n,previous:r})=>{let{start:i}=e;if(t===0||i!==e.end||i===t&&t<n)return e;if(i===0)return{start:0,end:1,direction:`forward`};if(i===n)return{start:i-1,end:i,direction:`backward`};if(n<2||t<2)return e;if(r==null)return{start:i,end:i+1,direction:e.direction};let a=i<r.end?`backward`:`forward`,o=r.start===r.end&&r.start<n,s=a===`backward`&&!o?-1:0;return{start:i+s,end:i+s+1,direction:a}},t=({selection:e,index:t})=>e==null?!1:e.start===e.end?t===e.start:t>=e.start&&t<e.end,n=({selection:e,maxLength:t})=>{if(e==null)return`idle`;let n=e.start===e.end?Number(e.start<t):Math.min(e.end,t)-e.start;return n<=0?`idle`:n===1?`caret`:n===t?`all`:`range`};export{n,e as r,t};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The parts of the `OtpInput` namespace. `index.ts` imports them as one module
|
|
3
|
+
* namespace, so a bundler keeps only the parts a consumer reads.
|
|
4
|
+
*/
|
|
5
|
+
import { ComponentProps, ReactNode } from "react";
|
|
6
|
+
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
7
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
8
|
+
import { o as WithValidation } from "./field-BshcNVe_.js";
|
|
9
|
+
declare const textAlignClasses: {
|
|
10
|
+
readonly left: "text-left";
|
|
11
|
+
readonly center: "text-center";
|
|
12
|
+
readonly right: "text-right";
|
|
13
|
+
};
|
|
14
|
+
type OtpInputRootProps = Omit<ComponentProps<"input">, "children" | "maxLength" | "onChange" | "value"> & WithValidation & {
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* The class of the element that holds the slots and the input.
|
|
18
|
+
*/
|
|
19
|
+
containerClassName?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The total number of character slots.
|
|
22
|
+
*/
|
|
23
|
+
maxLength: number;
|
|
24
|
+
/**
|
|
25
|
+
* The CSS that shows the input when JavaScript is off, in a `<noscript>`. It
|
|
26
|
+
* selects the input with `[data-input-otp]`. When omitted, the input shows
|
|
27
|
+
* with mantle's form colors. `null` turns the fallback off.
|
|
28
|
+
*/
|
|
29
|
+
noScriptCSSFallback?: string | null;
|
|
30
|
+
/**
|
|
31
|
+
* The new value, after each change.
|
|
32
|
+
*/
|
|
33
|
+
onChange?: (value: string) => void;
|
|
34
|
+
/**
|
|
35
|
+
* The full value, when the value grows to `maxLength` characters: the user
|
|
36
|
+
* fills the final slot, or a parent sets the full value.
|
|
37
|
+
*/
|
|
38
|
+
onComplete?: (value: string) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Rewrites the pasted text before the input reads it, for example to remove
|
|
41
|
+
* dashes and spaces.
|
|
42
|
+
*/
|
|
43
|
+
pasteTransformer?: (pasted: string) => string;
|
|
44
|
+
/**
|
|
45
|
+
* `"increase-width"` makes the input reach a 40px gutter past the last slot
|
|
46
|
+
* when the gutter fits, so a password manager draws its badge there and
|
|
47
|
+
* not over the last character. `"none"` keeps the input on the slots.
|
|
48
|
+
*
|
|
49
|
+
* @default "increase-width"
|
|
50
|
+
*/
|
|
51
|
+
pushPasswordManagerStrategy?: "increase-width" | "none";
|
|
52
|
+
/**
|
|
53
|
+
* The text alignment of the input, which moves its invisible caret.
|
|
54
|
+
*
|
|
55
|
+
* @default "left"
|
|
56
|
+
*/
|
|
57
|
+
textAlign?: keyof typeof textAlignClasses;
|
|
58
|
+
/**
|
|
59
|
+
* The controlled value.
|
|
60
|
+
*/
|
|
61
|
+
value?: string;
|
|
62
|
+
} & WithDataSlot;
|
|
63
|
+
/**
|
|
64
|
+
* The root of the OTP input. Renders one native `<input>` over the slots: it
|
|
65
|
+
* takes the keystrokes, the paste, the SMS and password manager fill, and the
|
|
66
|
+
* focus, and each `OtpInput.Slot` shows one character of its value.
|
|
67
|
+
*
|
|
68
|
+
* Pass `validation="error"` (or `"success"` / `"warning"`) to recolor each
|
|
69
|
+
* group's outer borders and the active focus ring with the matching validation hue.
|
|
70
|
+
* `validation="error"` also sets `aria-invalid` on the underlying input so
|
|
71
|
+
* assistive tech announces the failure state.
|
|
72
|
+
*
|
|
73
|
+
* When composing with `Field.Item`, wrap `OtpInput.Root` in `Field.Control`.
|
|
74
|
+
* `Field.Control` flows the generated `id`, `aria-invalid`, `aria-describedby`,
|
|
75
|
+
* and `aria-errormessage` through to the underlying focusable input via
|
|
76
|
+
* `FieldControlContext`.
|
|
77
|
+
*
|
|
78
|
+
* **Accessibility.** The input needs an accessible name. Inside a `Field.Item`,
|
|
79
|
+
* `Field.Label` supplies it. On its own, pass `aria-label`.
|
|
80
|
+
*
|
|
81
|
+
* **Password managers.** The input sets `autocomplete="one-time-code"`, so
|
|
82
|
+
* 1Password, Bitwarden, Dashlane, and Proton Pass can fill the code. Each can
|
|
83
|
+
* also show its badge beside the last slot. Do not add their ignore
|
|
84
|
+
* attributes: an ignore attribute also stops the fill. LastPass does not fill
|
|
85
|
+
* one-time codes, so the input carries `data-lpignore`.
|
|
86
|
+
*
|
|
87
|
+
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsx
|
|
91
|
+
* <OtpInput.Root maxLength={6}>
|
|
92
|
+
* <OtpInput.Group>
|
|
93
|
+
* <OtpInput.Slot index={0} />
|
|
94
|
+
* <OtpInput.Slot index={1} />
|
|
95
|
+
* <OtpInput.Slot index={2} />
|
|
96
|
+
* </OtpInput.Group>
|
|
97
|
+
* <OtpInput.Separator />
|
|
98
|
+
* <OtpInput.Group>
|
|
99
|
+
* <OtpInput.Slot index={3} />
|
|
100
|
+
* <OtpInput.Slot index={4} />
|
|
101
|
+
* <OtpInput.Slot index={5} />
|
|
102
|
+
* </OtpInput.Group>
|
|
103
|
+
* </OtpInput.Root>
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
declare const Root: ({ "aria-invalid": ariaInvalid, "data-slot": dataSlot, autoComplete, children, className, containerClassName, defaultValue, inputMode, maxLength, noScriptCSSFallback, onBlur, onChange, onComplete, onFocus, onPaste, pasteTransformer, pattern, placeholder, pushPasswordManagerStrategy, ref, spellCheck, style, textAlign, validation: _validation, value: valueProp, ...props }: OtpInputRootProps) => import("react").JSX.Element;
|
|
107
|
+
type OtpInputGroupProps = ComponentProps<"div"> & WithAsChild & WithDataSlot;
|
|
108
|
+
/**
|
|
109
|
+
* Groups one or more `OtpInput.Slot` parts into a visually-connected segment.
|
|
110
|
+
* Slots inside a group share rounded corners on the outer edges and join with
|
|
111
|
+
* shared borders between adjacent slots.
|
|
112
|
+
*
|
|
113
|
+
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```tsx
|
|
117
|
+
* <OtpInput.Root maxLength={6}>
|
|
118
|
+
* <OtpInput.Group>
|
|
119
|
+
* <OtpInput.Slot index={0} />
|
|
120
|
+
* <OtpInput.Slot index={1} />
|
|
121
|
+
* <OtpInput.Slot index={2} />
|
|
122
|
+
* </OtpInput.Group>
|
|
123
|
+
* <OtpInput.Separator />
|
|
124
|
+
* <OtpInput.Group>
|
|
125
|
+
* <OtpInput.Slot index={3} />
|
|
126
|
+
* <OtpInput.Slot index={4} />
|
|
127
|
+
* <OtpInput.Slot index={5} />
|
|
128
|
+
* </OtpInput.Group>
|
|
129
|
+
* </OtpInput.Root>
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
declare const Group: ({ "data-slot": dataSlot, asChild, children, className, ref, ...props }: OtpInputGroupProps) => import("react").JSX.Element;
|
|
133
|
+
type OtpInputSlotProps = Omit<ComponentProps<"div">, "translate"> & {
|
|
134
|
+
/**
|
|
135
|
+
* The zero-based index of the character slot to render. Must be a valid
|
|
136
|
+
* index within the parent `OtpInput.Root`'s `maxLength`.
|
|
137
|
+
*/
|
|
138
|
+
index: number;
|
|
139
|
+
} & WithDataSlot;
|
|
140
|
+
/**
|
|
141
|
+
* Renders a single character slot for the OTP input. Reads its display state
|
|
142
|
+
* (the typed character, active/focused state, and fake caret position) from
|
|
143
|
+
* the nearest `OtpInput.Root` via context, so this part must always be
|
|
144
|
+
* rendered inside an `OtpInput.Root`.
|
|
145
|
+
*
|
|
146
|
+
* **Translation.** The slot always carries `translate="no"`, so a browser
|
|
147
|
+
* translation engine skips the character inside it. A translated passcode
|
|
148
|
+
* character is wrong. The engine also wraps that character's text node in a
|
|
149
|
+
* `<font>`, which detaches the node React holds. The next keystroke then makes
|
|
150
|
+
* React remove a node its parent no longer owns, and the DOM raises
|
|
151
|
+
* `NotFoundError`. The `translate` prop is omitted from the type, so no call
|
|
152
|
+
* site can turn the guard off.
|
|
153
|
+
*
|
|
154
|
+
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
155
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/translate
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```tsx
|
|
159
|
+
* <OtpInput.Root maxLength={6}>
|
|
160
|
+
* <OtpInput.Group>
|
|
161
|
+
* <OtpInput.Slot index={0} />
|
|
162
|
+
* <OtpInput.Slot index={1} />
|
|
163
|
+
* <OtpInput.Slot index={2} />
|
|
164
|
+
* </OtpInput.Group>
|
|
165
|
+
* <OtpInput.Separator />
|
|
166
|
+
* <OtpInput.Group>
|
|
167
|
+
* <OtpInput.Slot index={3} />
|
|
168
|
+
* <OtpInput.Slot index={4} />
|
|
169
|
+
* <OtpInput.Slot index={5} />
|
|
170
|
+
* </OtpInput.Group>
|
|
171
|
+
* </OtpInput.Root>
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
declare const OtpInputSlotImpl: ({ "data-slot": dataSlot, className, index, ref, ...props }: OtpInputSlotProps) => import("react").JSX.Element;
|
|
175
|
+
type OtpInputSeparatorProps = ComponentProps<"div"> & WithAsChild & {
|
|
176
|
+
/**
|
|
177
|
+
* If `true`, the separator renders with `role="separator"` so assistive
|
|
178
|
+
* tech announces it as a divider between OTP groups.
|
|
179
|
+
* If `false`, the separator is purely decorative and is removed from
|
|
180
|
+
* the accessibility tree. Prefer `false` inside an OTP control where the
|
|
181
|
+
* minus icon is visual chrome between slot groups.
|
|
182
|
+
*
|
|
183
|
+
* @default false
|
|
184
|
+
*/
|
|
185
|
+
semantic?: boolean;
|
|
186
|
+
} & WithDataSlot;
|
|
187
|
+
/**
|
|
188
|
+
* A visual separator between two `OtpInput.Group` segments. Renders a minus
|
|
189
|
+
* icon by default; pass `children` to override the visual.
|
|
190
|
+
*
|
|
191
|
+
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```tsx
|
|
195
|
+
* <OtpInput.Root maxLength={6}>
|
|
196
|
+
* <OtpInput.Group>
|
|
197
|
+
* <OtpInput.Slot index={0} />
|
|
198
|
+
* <OtpInput.Slot index={1} />
|
|
199
|
+
* <OtpInput.Slot index={2} />
|
|
200
|
+
* </OtpInput.Group>
|
|
201
|
+
* <OtpInput.Separator />
|
|
202
|
+
* <OtpInput.Group>
|
|
203
|
+
* <OtpInput.Slot index={3} />
|
|
204
|
+
* <OtpInput.Slot index={4} />
|
|
205
|
+
* <OtpInput.Slot index={5} />
|
|
206
|
+
* </OtpInput.Group>
|
|
207
|
+
* </OtpInput.Root>
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
declare const Separator: ({ "data-slot": dataSlot, asChild, children, className, ref, semantic, ...props }: OtpInputSeparatorProps) => import("react").JSX.Element;
|
|
211
|
+
export { Group, Root, Separator, OtpInputSlotImpl as Slot };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as Group,r as Root,i as Separator,n as Slot}from"./otp-input-zl6MVio6.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{t as e}from"./Minus-KBzmC4_K.js";import{createContext as t,useCallback as n,useContext as r,useEffect as i,useMemo as a,useRef as o,useState as s}from"react";import{flushSync as c}from"react-dom";import l from"tiny-invariant";import{t as ee}from"./behaviors-DHVC34f9.js";import{t as u}from"./types-D85fCNV3.js";import{t as te}from"./compose-refs-Ce1vWUz0.js";import{n as d,t as ne}from"./cx-CfAFHj5_.js";import{t as f}from"./utils-EM6s2WEU.js";import{t as re}from"./field-BwCq1b9R.js";import{t as ie}from"./input-BjCDSOPA.js";import{n as ae}from"./field-BRYypbjO.js";import{n as oe}from"./field-CYAaNexp.js";import{t as p}from"./slot-CBcGhRdV.js";import{n as se,r as ce,t as m}from"./otp-input-LPdkb_Fg.js";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const le={error:`danger`,success:`success`,warning:`warning`},ue=e=>`var(--color-${e}-600)`,v=e=>`var(--ring-color-focus-${e})`,y={left:`text-left`,center:`text-center`,right:`text-right`},b=t(null),x=e=>{let t=e.getBoundingClientRect().right;for(let n=e;n!=null;n=n.parentElement)if(getComputedStyle(n).overflowX!==`visible`)return n.getBoundingClientRect().left+n.clientLeft+n.clientWidth-t>=40;return document.documentElement.clientWidth-t>=40},S=({"aria-invalid":e,"data-slot":t,autoComplete:l,children:p,className:m,containerClassName:S,defaultValue:C,inputMode:w=`numeric`,maxLength:T,noScriptCSSFallback:E,onBlur:de,onChange:fe,onComplete:pe,onFocus:me,onPaste:D,pasteTransformer:O,pattern:k,placeholder:A,pushPasswordManagerStrategy:j=`increase-width`,ref:M,spellCheck:N=!1,style:P,textAlign:F=`left`,validation:I,value:L,...R})=>{let z=oe(),B=r(re),{ariaInvalid:he,validation:V}=ae({"aria-invalid":e,defaultAriaInvalid:!1,validation:I??z}),[H,ge]=ee({value:L,defaultValue:typeof C==`string`?C:``,onChange:fe}),[U,W]=s(null),[_e,ve]=s(!1),G=o(null),K=o(null),q=o(H),J=te(M,G),Y=n(e=>{let t=ce({selection:{start:e.selectionStart??0,end:e.selectionEnd??0,direction:e.selectionDirection??`none`},length:e.value.length,maxLength:e.maxLength,previous:K.current});(t.start!==e.selectionStart||t.end!==e.selectionEnd)&&e.setSelectionRange(t.start,t.end,t.direction),K.current=t,W(e=>e?.start===t.start&&e.end===t.end?e:t)},[]),X=e=>{j===`increase-width`&&e.parentElement!=null&&ve(x(e.parentElement))},Z=e=>e.length>0&&k!=null&&!new RegExp(k).test(e)?!1:(ge(e),!0),Q=U!=null;i(()=>{let e=G.current;if(!Q||e==null)return;let t=()=>{document.activeElement===e?Y(e):W(null)};return document.addEventListener(`selectionchange`,t,{capture:!0}),()=>{document.removeEventListener(`selectionchange`,t,{capture:!0})}},[Q,Y]),i(()=>{let e=G.current;e!=null&&(e.value!==H&&Z(e.value.slice(0,T)),H!==q.current&&(H.length===T&&q.current.length<T&&pe?.(H),q.current=H),U==null?document.activeElement===e&&document.hasFocus()&&(X(e),Y(e)):(e.selectionStart!==U.start||e.selectionEnd!==U.end)&&Y(e))});let ye=a(()=>({value:H,selection:U}),[H,U]),$=V?le[V]:void 0,be=$?u({"--otp-validation-border":ue($),"--otp-validation-ring":v($)}):void 0;return/* @__PURE__ */ _(h,{children:[E!=null&&/* @__PURE__ */ g(`noscript`,{children:/* @__PURE__ */ g(`style`,{children:`@layer utilities{${E}}`})}),/* @__PURE__ */ _(`div`,{className:d(`pointer-events-none relative flex items-center gap-2 select-none has-disabled:opacity-50`,S),"data-input-otp-container":!0,translate:`no`,children:[/* @__PURE__ */ g(b,{value:ye,children:/* @__PURE__ */ g(`div`,{className:`group/otp contents`,"data-otp-state":se({selection:U,maxLength:T}),"data-validation":V||void 0,style:be,children:p})}),/* @__PURE__ */ g(`div`,{className:`pointer-events-none absolute inset-0 [container-type:size] [&>*]:pointer-events-auto!`,children:/* @__PURE__ */ g(`input`,{autoComplete:l||`one-time-code`,"aria-invalid":he,"aria-placeholder":A,"data-slot":f(t,`otp-input`),"data-input-otp":!0,"data-input-otp-mss":U?.start,"data-input-otp-mse":U?.end,"data-input-otp-placeholder-shown":H.length===0||void 0,"data-lpignore":ie[`data-lpignore`],inputMode:w,spellCheck:N,...R,...B?{"aria-describedby":B[`aria-describedby`],"aria-errormessage":B[`aria-errormessage`],id:B.id,name:B.name}:void 0,ref:J,className:ne(`otp-input-overlay disabled:cursor-not-allowed`,E===void 0&&`noscript:rounded-md! noscript:border! noscript:border-form! noscript:bg-form! noscript:text-center! noscript:text-base! noscript:tracking-[.25em]! noscript:text-strong! noscript:caret-current!`,y[F],m),style:_e&&j===`increase-width`?{...P,...u({"--_otp-badge-gutter":`40px`})}:P,maxLength:T,pattern:k,value:H,onBlur:e=>{W(null),de?.(e)},onChange:e=>{let t=e.currentTarget;Z(t.value.slice(0,T))&&document.activeElement===t&&Y(t)},onFocus:e=>{let t=e.currentTarget,n=t.value.length;t.setSelectionRange(Math.min(n,T-1),n),X(t),Y(t),me?.(e)},onPaste:e=>{D?.(e);let t=e.currentTarget;if(e.defaultPrevented||t.readOnly||O==null&&!CSS.supports?.(`-webkit-touch-callout`,`none`))return;e.preventDefault();let n=e.clipboardData.getData(`text/plain`),r=O?O(n):n,i=(H.slice(0,t.selectionStart??H.length)+r+H.slice(t.selectionEnd??H.length)).slice(0,T);c(()=>Z(i));let a=t.value.length;t.setSelectionRange(Math.min(a,T-1),a),Y(t)}})})]})]})},C=({"data-slot":e,asChild:t,children:n,className:r,ref:i,...a})=>/* @__PURE__ */ g(t?p:`div`,{ref:i,"data-slot":f(e,`otp-input-group`),className:d(`relative flex items-center rounded-md has-[[data-highlighted]~[data-highlighted]]:ring-focus-accent has-[[data-highlighted]~[data-highlighted]]:ring-4 group-data-validation/otp:has-[[data-highlighted]~[data-highlighted]]:ring-(--otp-validation-ring)`,r),...a,children:n}),w=({"data-slot":e,className:t,index:n,ref:i,...a})=>{let o=r(b);l(o!=null,`OtpInput.Slot must be rendered inside OtpInput.Root.`);let s=o.value[n],c=m({selection:o.selection,index:n});return/* @__PURE__ */ _(`div`,{ref:i,"data-slot":f(e,`otp-input-slot`),"data-highlighted":c?``:void 0,className:d(`border-form bg-form text-strong relative flex h-10 w-10 items-center justify-center border-y border-e text-sm shadow-sm outline-hidden transition-all duration-150 ease-out first:rounded-s-md first:border-s last:rounded-e-md [&:has(+[data-highlighted])]:group-data-[otp-state=caret]/otp:border-e-transparent data-highlighted:group-data-[otp-state=caret]/otp:border-accent-600 data-highlighted:group-data-[otp-state=caret]/otp:border-s data-highlighted:group-data-[otp-state=caret]/otp:ring-focus-accent data-highlighted:group-data-[otp-state=caret]/otp:z-20 data-highlighted:group-data-[otp-state=caret]/otp:ring-4 group-data-[otp-state=all]/otp:border-accent-600 group-data-validation/otp:border-y-(--otp-validation-border) group-data-validation/otp:first:border-s-(--otp-validation-border) group-data-validation/otp:last:border-e-(--otp-validation-border) group-data-validation/otp:data-highlighted:group-data-[otp-state=caret]/otp:border-(--otp-validation-border) group-data-validation/otp:data-highlighted:group-data-[otp-state=caret]/otp:ring-(--otp-validation-ring) group-data-validation/otp:group-data-[otp-state=all]/otp:border-(--otp-validation-border)`,t),...a,translate:`no`,children:[s,c&&s==null&&/* @__PURE__ */ g(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:/* @__PURE__ */ g(`div`,{className:`bg-strong h-4 w-px animate-pulse`})})]})},T=({"data-slot":t,asChild:n,children:r,className:i,ref:a,semantic:o=!1,...s})=>{let c=n?p:`div`,l=o?{role:`separator`}:{"aria-hidden":!0,role:`none`};return/* @__PURE__ */ g(c,{ref:a,"data-slot":f(t,`otp-input-separator`),className:d(`text-separator flex items-center`,i),...l,...s,children:r??/* @__PURE__ */ g(e,{weight:`bold`})})};export{T as i,w as n,S as r,C as t};
|
package/dist/otp-input.d.ts
CHANGED
|
@@ -3,164 +3,28 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
7
|
-
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
8
|
-
import { o as WithValidation } from "./field-BshcNVe_.js";
|
|
9
|
-
import { ComponentProps, ReactNode } from "react";
|
|
10
|
-
import { OTPInput, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS } from "input-otp";
|
|
11
|
-
type OtpInputRootProps = Omit<ComponentProps<typeof OTPInput>, "render" | "children"> & WithValidation & {
|
|
12
|
-
children?: ReactNode;
|
|
13
|
-
} & WithDataSlot;
|
|
6
|
+
import * as OtpInputParts from "./otp-input-parts.js";
|
|
14
7
|
/**
|
|
15
|
-
* The
|
|
16
|
-
* captures keystrokes, paste events, and autofill, and exposes per-slot state
|
|
17
|
-
* (active, char, fake caret) to descendant `OtpInput.Slot` parts via context.
|
|
18
|
-
*
|
|
19
|
-
* Wraps the `input-otp` library by Guilherme Rodz.
|
|
20
|
-
*
|
|
21
|
-
* Pass `validation="error"` (or `"success"` / `"warning"`) to recolor each
|
|
22
|
-
* group's outer borders and the active focus ring with the matching validation hue.
|
|
23
|
-
* `validation="error"` also sets `aria-invalid` on the underlying input so
|
|
24
|
-
* assistive tech announces the failure state.
|
|
25
|
-
*
|
|
26
|
-
* When composing with `Field.Item`, wrap `OtpInput.Root` in `Field.Control`.
|
|
27
|
-
* `Field.Control` flows the generated `id`, `aria-invalid`, `aria-describedby`,
|
|
28
|
-
* and `aria-errormessage` through to the underlying focusable input via
|
|
29
|
-
* `FieldControlContext`.
|
|
30
|
-
*
|
|
31
|
-
* **Accessibility.** The hidden input needs an accessible name. Inside a
|
|
32
|
-
* `Field.Item`, `Field.Label` supplies it. On its own, pass `aria-label`.
|
|
33
|
-
*
|
|
34
|
-
* **Password managers.** The hidden input sets `autocomplete="one-time-code"`,
|
|
35
|
-
* so 1Password, Bitwarden, Dashlane, and Proton Pass can fill the code. Each
|
|
36
|
-
* can also show its badge beside the last slot. Do not add their ignore
|
|
37
|
-
* attributes: an ignore attribute also stops the fill. LastPass does not fill
|
|
38
|
-
* one-time codes, so the input carries `data-lpignore`.
|
|
39
|
-
*
|
|
40
|
-
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
8
|
+
* The `pattern` that accepts digits only.
|
|
41
9
|
*
|
|
42
10
|
* @example
|
|
43
|
-
*
|
|
44
|
-
* <OtpInput.Root maxLength={6}>
|
|
45
|
-
* <OtpInput.Group>
|
|
46
|
-
* <OtpInput.Slot index={0} />
|
|
47
|
-
* <OtpInput.Slot index={1} />
|
|
48
|
-
* <OtpInput.Slot index={2} />
|
|
49
|
-
* </OtpInput.Group>
|
|
50
|
-
* <OtpInput.Separator />
|
|
51
|
-
* <OtpInput.Group>
|
|
52
|
-
* <OtpInput.Slot index={3} />
|
|
53
|
-
* <OtpInput.Slot index={4} />
|
|
54
|
-
* <OtpInput.Slot index={5} />
|
|
55
|
-
* </OtpInput.Group>
|
|
56
|
-
* </OtpInput.Root>
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
declare const Root: ({ "data-slot": dataSlot, "aria-invalid": ariaInvalid, children, className, containerClassName, ref, validation: _validation, ...props }: OtpInputRootProps) => import("react").JSX.Element;
|
|
60
|
-
type OtpInputGroupProps = ComponentProps<"div"> & WithAsChild & WithDataSlot;
|
|
61
|
-
/**
|
|
62
|
-
* Groups one or more `OtpInput.Slot` parts into a visually-connected segment.
|
|
63
|
-
* Slots inside a group share rounded corners on the outer edges and join with
|
|
64
|
-
* shared borders between adjacent slots.
|
|
65
|
-
*
|
|
66
|
-
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```tsx
|
|
70
|
-
* <OtpInput.Root maxLength={6}>
|
|
71
|
-
* <OtpInput.Group>
|
|
72
|
-
* <OtpInput.Slot index={0} />
|
|
73
|
-
* <OtpInput.Slot index={1} />
|
|
74
|
-
* <OtpInput.Slot index={2} />
|
|
75
|
-
* </OtpInput.Group>
|
|
76
|
-
* <OtpInput.Separator />
|
|
77
|
-
* <OtpInput.Group>
|
|
78
|
-
* <OtpInput.Slot index={3} />
|
|
79
|
-
* <OtpInput.Slot index={4} />
|
|
80
|
-
* <OtpInput.Slot index={5} />
|
|
81
|
-
* </OtpInput.Group>
|
|
82
|
-
* </OtpInput.Root>
|
|
83
|
-
* ```
|
|
11
|
+
* <OtpInput.Root maxLength={6} pattern={REGEXP_ONLY_DIGITS} />
|
|
84
12
|
*/
|
|
85
|
-
declare const
|
|
86
|
-
type OtpInputSlotProps = Omit<ComponentProps<"div">, "translate"> & {
|
|
87
|
-
/**
|
|
88
|
-
* The zero-based index of the character slot to render. Must be a valid
|
|
89
|
-
* index within the parent `OtpInput.Root`'s `maxLength`.
|
|
90
|
-
*/
|
|
91
|
-
index: number;
|
|
92
|
-
} & WithDataSlot;
|
|
13
|
+
declare const REGEXP_ONLY_DIGITS = "^\\d+$";
|
|
93
14
|
/**
|
|
94
|
-
*
|
|
95
|
-
* (the typed character, active/focused state, and fake caret position) from
|
|
96
|
-
* the nearest `OtpInput.Root` via context, so this part must always be
|
|
97
|
-
* rendered inside an `OtpInput.Root`.
|
|
98
|
-
*
|
|
99
|
-
* **Translation.** The slot always carries `translate="no"`, so a browser
|
|
100
|
-
* translation engine skips the character inside it. A translated passcode
|
|
101
|
-
* character is wrong. The engine also wraps that character's text node in a
|
|
102
|
-
* `<font>`, which detaches the node React holds. The next keystroke then makes
|
|
103
|
-
* React remove a node its parent no longer owns, and the DOM raises
|
|
104
|
-
* `NotFoundError`. The `translate` prop is omitted from the type, so no call
|
|
105
|
-
* site can turn the guard off.
|
|
106
|
-
*
|
|
107
|
-
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
108
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/translate
|
|
15
|
+
* The `pattern` that accepts ASCII letters only.
|
|
109
16
|
*
|
|
110
17
|
* @example
|
|
111
|
-
*
|
|
112
|
-
* <OtpInput.Root maxLength={6}>
|
|
113
|
-
* <OtpInput.Group>
|
|
114
|
-
* <OtpInput.Slot index={0} />
|
|
115
|
-
* <OtpInput.Slot index={1} />
|
|
116
|
-
* <OtpInput.Slot index={2} />
|
|
117
|
-
* </OtpInput.Group>
|
|
118
|
-
* <OtpInput.Separator />
|
|
119
|
-
* <OtpInput.Group>
|
|
120
|
-
* <OtpInput.Slot index={3} />
|
|
121
|
-
* <OtpInput.Slot index={4} />
|
|
122
|
-
* <OtpInput.Slot index={5} />
|
|
123
|
-
* </OtpInput.Group>
|
|
124
|
-
* </OtpInput.Root>
|
|
125
|
-
* ```
|
|
18
|
+
* <OtpInput.Root maxLength={6} pattern={REGEXP_ONLY_CHARS} />
|
|
126
19
|
*/
|
|
127
|
-
declare const
|
|
128
|
-
type OtpInputSeparatorProps = ComponentProps<"div"> & WithAsChild & {
|
|
129
|
-
/**
|
|
130
|
-
* If `true`, the separator renders with `role="separator"` so assistive
|
|
131
|
-
* tech announces it as a divider between OTP groups.
|
|
132
|
-
* If `false`, the separator is purely decorative and is removed from
|
|
133
|
-
* the accessibility tree. Prefer `false` inside an OTP control where the
|
|
134
|
-
* minus icon is visual chrome between slot groups.
|
|
135
|
-
*
|
|
136
|
-
* @default false
|
|
137
|
-
*/
|
|
138
|
-
semantic?: boolean;
|
|
139
|
-
} & WithDataSlot;
|
|
20
|
+
declare const REGEXP_ONLY_CHARS = "^[a-zA-Z]+$";
|
|
140
21
|
/**
|
|
141
|
-
*
|
|
142
|
-
* icon by default; pass `children` to override the visual.
|
|
143
|
-
*
|
|
144
|
-
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
22
|
+
* The `pattern` that accepts ASCII letters and digits.
|
|
145
23
|
*
|
|
146
24
|
* @example
|
|
147
|
-
*
|
|
148
|
-
* <OtpInput.Root maxLength={6}>
|
|
149
|
-
* <OtpInput.Group>
|
|
150
|
-
* <OtpInput.Slot index={0} />
|
|
151
|
-
* <OtpInput.Slot index={1} />
|
|
152
|
-
* <OtpInput.Slot index={2} />
|
|
153
|
-
* </OtpInput.Group>
|
|
154
|
-
* <OtpInput.Separator />
|
|
155
|
-
* <OtpInput.Group>
|
|
156
|
-
* <OtpInput.Slot index={3} />
|
|
157
|
-
* <OtpInput.Slot index={4} />
|
|
158
|
-
* <OtpInput.Slot index={5} />
|
|
159
|
-
* </OtpInput.Group>
|
|
160
|
-
* </OtpInput.Root>
|
|
161
|
-
* ```
|
|
25
|
+
* <OtpInput.Root maxLength={6} pattern={REGEXP_ONLY_DIGITS_AND_CHARS} />
|
|
162
26
|
*/
|
|
163
|
-
declare const
|
|
27
|
+
declare const REGEXP_ONLY_DIGITS_AND_CHARS = "^[a-zA-Z0-9]+$";
|
|
164
28
|
/**
|
|
165
29
|
* Compound component for capturing one-time passcodes (OTP). Combines a
|
|
166
30
|
* single hidden input (handling paste, autofill, and IME) with a row of
|
|
@@ -202,110 +66,5 @@ declare const Separator: ({ "data-slot": dataSlot, asChild, children, className,
|
|
|
202
66
|
* </OtpInput.Root>
|
|
203
67
|
* ```
|
|
204
68
|
*/
|
|
205
|
-
declare const OtpInput:
|
|
206
|
-
/**
|
|
207
|
-
* The root of the OTP input. Renders an accessible single hidden input that
|
|
208
|
-
* captures keystrokes, paste events, and autofill, and exposes per-slot state
|
|
209
|
-
* (active, char, fake caret) to descendant `OtpInput.Slot` parts via context.
|
|
210
|
-
*
|
|
211
|
-
* The hidden input needs an accessible name. Inside a `Field.Item`,
|
|
212
|
-
* `Field.Label` supplies it. On its own, pass `aria-label`.
|
|
213
|
-
*
|
|
214
|
-
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
215
|
-
*
|
|
216
|
-
* @example
|
|
217
|
-
* ```tsx
|
|
218
|
-
* <OtpInput.Root maxLength={6}>
|
|
219
|
-
* <OtpInput.Group>
|
|
220
|
-
* <OtpInput.Slot index={0} />
|
|
221
|
-
* <OtpInput.Slot index={1} />
|
|
222
|
-
* <OtpInput.Slot index={2} />
|
|
223
|
-
* </OtpInput.Group>
|
|
224
|
-
* <OtpInput.Separator />
|
|
225
|
-
* <OtpInput.Group>
|
|
226
|
-
* <OtpInput.Slot index={3} />
|
|
227
|
-
* <OtpInput.Slot index={4} />
|
|
228
|
-
* <OtpInput.Slot index={5} />
|
|
229
|
-
* </OtpInput.Group>
|
|
230
|
-
* </OtpInput.Root>
|
|
231
|
-
* ```
|
|
232
|
-
*/
|
|
233
|
-
readonly Root: typeof Root;
|
|
234
|
-
/**
|
|
235
|
-
* Groups one or more `OtpInput.Slot` parts into a visually-connected
|
|
236
|
-
* segment with shared rounded corners and joined borders.
|
|
237
|
-
*
|
|
238
|
-
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
239
|
-
*
|
|
240
|
-
* @example
|
|
241
|
-
* ```tsx
|
|
242
|
-
* <OtpInput.Root maxLength={6}>
|
|
243
|
-
* <OtpInput.Group>
|
|
244
|
-
* <OtpInput.Slot index={0} />
|
|
245
|
-
* <OtpInput.Slot index={1} />
|
|
246
|
-
* <OtpInput.Slot index={2} />
|
|
247
|
-
* </OtpInput.Group>
|
|
248
|
-
* <OtpInput.Separator />
|
|
249
|
-
* <OtpInput.Group>
|
|
250
|
-
* <OtpInput.Slot index={3} />
|
|
251
|
-
* <OtpInput.Slot index={4} />
|
|
252
|
-
* <OtpInput.Slot index={5} />
|
|
253
|
-
* </OtpInput.Group>
|
|
254
|
-
* </OtpInput.Root>
|
|
255
|
-
* ```
|
|
256
|
-
*/
|
|
257
|
-
readonly Group: typeof Group;
|
|
258
|
-
/**
|
|
259
|
-
* A single character slot. Must be rendered inside an `OtpInput.Root`.
|
|
260
|
-
* Reads its character, active state, and fake caret position from the
|
|
261
|
-
* root via context.
|
|
262
|
-
*
|
|
263
|
-
* The slot always carries `translate="no"`, so a browser translation
|
|
264
|
-
* engine skips the character inside it.
|
|
265
|
-
*
|
|
266
|
-
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
267
|
-
*
|
|
268
|
-
* @example
|
|
269
|
-
* ```tsx
|
|
270
|
-
* <OtpInput.Root maxLength={6}>
|
|
271
|
-
* <OtpInput.Group>
|
|
272
|
-
* <OtpInput.Slot index={0} />
|
|
273
|
-
* <OtpInput.Slot index={1} />
|
|
274
|
-
* <OtpInput.Slot index={2} />
|
|
275
|
-
* </OtpInput.Group>
|
|
276
|
-
* <OtpInput.Separator />
|
|
277
|
-
* <OtpInput.Group>
|
|
278
|
-
* <OtpInput.Slot index={3} />
|
|
279
|
-
* <OtpInput.Slot index={4} />
|
|
280
|
-
* <OtpInput.Slot index={5} />
|
|
281
|
-
* </OtpInput.Group>
|
|
282
|
-
* </OtpInput.Root>
|
|
283
|
-
* ```
|
|
284
|
-
*/
|
|
285
|
-
readonly Slot: typeof OtpInputSlotImpl;
|
|
286
|
-
/**
|
|
287
|
-
* A visual separator between two `OtpInput.Group` segments. Renders a
|
|
288
|
-
* minus icon by default; pass `children` to override.
|
|
289
|
-
*
|
|
290
|
-
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
291
|
-
*
|
|
292
|
-
* @example
|
|
293
|
-
* ```tsx
|
|
294
|
-
* <OtpInput.Root maxLength={6}>
|
|
295
|
-
* <OtpInput.Group>
|
|
296
|
-
* <OtpInput.Slot index={0} />
|
|
297
|
-
* <OtpInput.Slot index={1} />
|
|
298
|
-
* <OtpInput.Slot index={2} />
|
|
299
|
-
* </OtpInput.Group>
|
|
300
|
-
* <OtpInput.Separator />
|
|
301
|
-
* <OtpInput.Group>
|
|
302
|
-
* <OtpInput.Slot index={3} />
|
|
303
|
-
* <OtpInput.Slot index={4} />
|
|
304
|
-
* <OtpInput.Slot index={5} />
|
|
305
|
-
* </OtpInput.Group>
|
|
306
|
-
* </OtpInput.Root>
|
|
307
|
-
* ```
|
|
308
|
-
*/
|
|
309
|
-
readonly Separator: typeof Separator;
|
|
310
|
-
};
|
|
69
|
+
declare const OtpInput: typeof OtpInputParts;
|
|
311
70
|
export { OtpInput, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS };
|
package/dist/otp-input.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import*as e from"./otp-input-parts.js";const t=`^\\d+$`,n=`^[a-zA-Z]+$`,r=`^[a-zA-Z0-9]+$`;export{e as OtpInput,n as REGEXP_ONLY_CHARS,t as REGEXP_ONLY_DIGITS,r as REGEXP_ONLY_DIGITS_AND_CHARS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=/* @__PURE__ */ new Map;let t=null;function n(e,t){e.parentElement!==t&&(e.isConnected&&t.isConnected&&`moveBefore`in t?t.moveBefore(e,null):t.append(e))}function r(e,r){t!=null&&e.contains(t)||(e.querySelector(`dialog:modal`)??n(e,t==null||t.contains(r)?r:t))}function i(t,n){return e.set(t,n),r(t,n),()=>{e.delete(t),t.remove()}}function a(n){t=n;for(let[t,n]of e)r(t,n)}export{a as n,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useLayoutEffect as e,useRef as t,useState as n}from"react";import{createPortal as r}from"react-dom";import{t as i}from"./hooks-BeLOGKwE.js";import{t as a}from"./browser-only-ymFoM3Ya.js";import{t as o}from"./compose-refs-Ce1vWUz0.js";import{t as s}from"./utils-EM6s2WEU.js";import{t as c}from"./layer-container-DDOZJ0fn.js";import{t as l}from"./overlay-prompt-BIzMQvx7.js";import{jsx as u}from"react/jsx-runtime";function d(){let e=document.createElement(`div`);return e.className=`overlay-prompt`,e.style.display=`contents`,e}function f({children:f,"data-slot":p,ref:m}){let h=i(),[g]=n(()=>a()?d():null),[_,v]=n(!1),y=t(null),b=o(y,m);e(()=>{let e=y.current;if(g==null||e==null)return;let t=l(g,e);return v(!0),t},[g]);let x=/* @__PURE__ */ u(c,{className:`contents`,modal:!1,children:f}),S=x;return h&&g!=null&&(S=_?r(x,g):null),/* @__PURE__ */ u(`div`,{className:`contents`,"data-slot":s(p,`overlay-prompt`),ref:b,children:S})}export{f as t};
|