@ngrok/mantle 0.93.7 → 0.94.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/dist/accordion.d.ts +73 -21
- package/dist/accordion.js +1 -1
- package/dist/agent.json +1234 -84
- package/dist/alert-BkJHDx9X.js +1 -0
- package/dist/{alert-BcSBNR3S.d.ts → alert-D0zRRUHV.d.ts} +35 -25
- package/dist/alert-center.d.ts +67 -55
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +35 -10
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +6 -1
- package/dist/alert.js +1 -1
- package/dist/anchor-Dc6IgvXV.js +1 -0
- package/dist/anchor.d.ts +17 -5
- package/dist/anchor.js +1 -1
- package/dist/app-layout.d.ts +33 -18
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +153 -97
- package/dist/area-chart.js +1 -1
- package/dist/avatar.d.ts +36 -24
- package/dist/avatar.js +1 -1
- package/dist/badge.d.ts +19 -7
- package/dist/badge.js +1 -1
- package/dist/bar-chart.d.ts +155 -100
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +47 -36
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only-CZfkNw5A.js +1 -0
- package/dist/browser-only-ymFoM3Ya.js +1 -0
- package/dist/browser-only.d.ts +8 -0
- package/dist/browser-only.js +1 -1
- package/dist/{button-BX-4lYUn.d.ts → button-5Pc7Mby_.d.ts} +4 -4
- package/dist/button-B9bChDgl.js +1 -0
- package/dist/button-D8jixIbH.js +1 -0
- package/dist/button-DNLTJ32M.js +1 -0
- package/dist/{button-CPsKGDK0.d.ts → button-Ddj6yr10.d.ts} +34 -27
- package/dist/{button-Yxyu1XMd.d.ts → button-DnYv7IOT.d.ts} +29 -22
- package/dist/button.d.ts +9 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +8 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +7 -2
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +34 -23
- package/dist/centered-layout.js +1 -1
- package/dist/chart-BLCqzt56.js +1 -0
- package/dist/chart-CChZiCrt.js +1 -0
- package/dist/chart-CUmSu9d7.js +1 -0
- package/dist/{chart-BpfbtOUN.d.ts → chart-Dl8gFo_D.d.ts} +117 -121
- package/dist/chart-DtgZBAas.js +2 -0
- package/dist/checkbox-Cu5cgZmk.js +1 -0
- package/dist/checkbox.d.ts +15 -2
- package/dist/checkbox.js +1 -1
- package/dist/choice-CCVG2hb9.js +1 -0
- package/dist/{choice-BLR0_MeB.d.ts → choice-CNiOSzqV.d.ts} +26 -20
- package/dist/choice.d.ts +6 -1
- package/dist/choice.js +1 -1
- package/dist/code-BPKNY1_w.js +1 -0
- package/dist/{code-block-BGdV4Yty.d.ts → code-block-BDw6MEwH.d.ts} +9 -9
- package/dist/{code-block-W3kWPxCJ.js → code-block-CKzsAMzj.js} +3 -3
- package/dist/code-block.d.ts +28 -19
- package/dist/code-block.js +1 -1
- package/dist/code-block_highlight-utils.d.ts +6 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +16 -3
- package/dist/code.js +1 -1
- package/dist/color-CHZbU1Ww.js +1 -0
- package/dist/color.js +1 -1
- package/dist/combobox.d.ts +42 -28
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +59 -47
- package/dist/command.js +1 -1
- package/dist/compose-refs-BdRUneoc.js +1 -0
- package/dist/{copy-to-clipboard-DInu78k_.js → copy-to-clipboard-Dd83caRw.js} +1 -1
- package/dist/cx.d.ts +4 -4
- package/dist/cx.js +1 -1
- package/dist/{data-slot-B-LqAcBB.d.ts → data-slot-BW8KQ9Xo.d.ts} +2 -2
- package/dist/data-table.d.ts +83 -52
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +13 -2
- package/dist/description-list.js +1 -1
- package/dist/{dialog-2fRO4ca4.d.ts → dialog-CIEuwNys.d.ts} +32 -8
- package/dist/dialog-CbEEA0fl.d.ts +32 -0
- package/dist/dialog-DmzoDfY3.js +1 -0
- package/dist/dialog.d.ts +7 -2
- package/dist/dialog.js +1 -1
- package/dist/{dropdown-menu-CpjRwMWe.d.ts → dropdown-menu-CeY498yk.d.ts} +41 -33
- package/dist/dropdown-menu-uheL0prz.js +1 -0
- package/dist/dropdown-menu.d.ts +6 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +7 -2
- package/dist/empty.js +1 -1
- package/dist/field-Bpvn4tQp.js +1 -0
- package/dist/{field-V_gnkcmN.d.ts → field-BshcNVe_.d.ts} +1 -1
- package/dist/field-Cai_4c1l.js +1 -0
- package/dist/field.d.ts +53 -42
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +11 -3
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +35 -10
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +25 -14
- package/dist/hover-card.js +1 -1
- package/dist/{icon-CgNqu-fl.d.ts → icon--purqHRo.d.ts} +1 -1
- package/dist/{icon-ByLVhdYq.d.ts → icon-DuIYoyft.d.ts} +8 -2
- package/dist/{icon-DXDyhy2N.d.ts → icon-QCm1ui29.d.ts} +2 -2
- package/dist/icon-xb7d9M7X.js +1 -0
- package/dist/icon.d.ts +8 -3
- package/dist/icon.js +1 -1
- package/dist/icons-DEDCLZ8B.js +1 -0
- package/dist/icons-DXadFwpo.js +1 -0
- package/dist/icons-DcesO4Ng.js +1 -0
- package/dist/icons.d.ts +13 -1
- package/dist/icons.js +1 -1
- package/dist/{in-view-B3nMAzfE.d.ts → in-view-C_daNafg.d.ts} +4 -23
- package/dist/{index-BhfgyurF.d.ts → index-KJ06KK6t.d.ts} +3 -3
- package/dist/input-BjCDSOPA.js +1 -0
- package/dist/{input-Dx5owTCc.d.ts → input-DC4nW0Sr.d.ts} +12 -2
- package/dist/input-fW8QSZEO.js +1 -0
- package/dist/input.d.ts +37 -5
- package/dist/input.js +1 -1
- package/dist/kbd-P1nQshWo.js +1 -0
- package/dist/kbd.d.ts +17 -5
- package/dist/kbd.js +1 -1
- package/dist/label-DO1RlMKl.js +1 -0
- package/dist/{label-Dn5CPJUj.d.ts → label-epgtywRz.d.ts} +14 -8
- package/dist/label.d.ts +6 -1
- package/dist/label.js +1 -1
- package/dist/layer-container-DL4yclOu.js +1 -0
- package/dist/layer-container.d.ts +2 -2
- package/dist/layer-container.js +1 -1
- package/dist/line-chart.d.ts +147 -90
- package/dist/line-chart.js +1 -1
- package/dist/list-cQZPSjfz.js +1 -0
- package/dist/list.d.ts +34 -16
- package/dist/list.js +1 -1
- package/dist/live-region-Dhapu8a5.js +1 -0
- package/dist/live-region.d.ts +15 -2
- package/dist/live-region.js +1 -1
- package/dist/llms.txt +82 -79
- package/dist/main-CHyWYDak.js +1 -0
- package/dist/main.d.ts +13 -1
- package/dist/main.js +1 -1
- package/dist/mantle.css +133 -88
- package/dist/media-object.d.ts +16 -4
- package/dist/media-object.js +1 -1
- package/dist/migrations/0014-chart-named-colors.yml +1389 -0
- package/dist/migrations/0015-segmented-control.yml +788 -0
- package/dist/multi-select.d.ts +42 -29
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +20 -8
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +93 -4
- package/dist/pagination.js +1 -1
- package/dist/{popover-BfB2I9G0.d.ts → popover-Bei0jyfH.d.ts} +87 -12
- package/dist/popover-DhgunktK.js +1 -0
- package/dist/popover-T2EyaqGK.d.ts +1 -0
- package/dist/popover.d.ts +7 -2
- package/dist/popover.js +1 -1
- package/dist/primitive-D8CzV_Ft.js +1 -0
- package/dist/progress.d.ts +28 -11
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +11 -3
- package/dist/qr-code.js +1 -1
- package/dist/query-filter.d.ts +6 -6
- package/dist/query.d.ts +9 -4
- package/dist/query.js +1 -1
- package/dist/radio-group-BJQ6EOqh.d.ts +27 -0
- package/dist/radio-group-BliblUqe.js +1 -0
- package/dist/radio-group-ggEkCi0V.js +1 -0
- package/dist/radio-group.d.ts +21 -100
- package/dist/radio-group.js +1 -1
- package/dist/sandbar.d.ts +43 -30
- package/dist/sandbar.js +1 -1
- package/dist/sandboxed-on-click-D4PL5_GR.js +1 -0
- package/dist/sandboxed-on-click.d.ts +8 -0
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot.d.ts +137 -76
- package/dist/scatter-plot.js +1 -1
- package/dist/segmented-control.d.ts +136 -0
- package/dist/segmented-control.js +1 -0
- package/dist/select-1xuUx_os.js +1 -0
- package/dist/{select-BkhBxtOT.d.ts → select-BpaXHxJm.d.ts} +33 -25
- package/dist/select.d.ts +6 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +29 -18
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-D9AWEkcJ.d.ts → separator-Ck4sPrdN.d.ts} +4 -2
- package/dist/separator-DnvhwY2J.js +1 -0
- package/dist/separator.d.ts +6 -1
- package/dist/separator.js +1 -1
- package/dist/{shake-DL6WhMXM.js → shake-CAUpKBHe.js} +1 -1
- package/dist/sheet-DHy_vlme.js +1 -0
- package/dist/sheet.d.ts +36 -7
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +53 -37
- package/dist/sidebar.js +1 -1
- package/dist/skeleton-DHfyjuQi.js +1 -0
- package/dist/skeleton.d.ts +15 -4
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.d.ts +12 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.d.ts +11 -1
- package/dist/slider.js +1 -1
- package/dist/slot-B7rwscwd.js +1 -0
- package/dist/{slot-C0OCJjdJ.d.ts → slot-BEMQMbk3.d.ts} +6 -4
- package/dist/slot.d.ts +6 -1
- package/dist/slot.js +1 -1
- package/dist/source-all.css +5 -1
- package/dist/split-button.d.ts +20 -9
- package/dist/split-button.js +1 -1
- package/dist/strata.d.ts +35 -22
- package/dist/strata.js +1 -1
- package/dist/{suggestions-NkqYTT49.d.ts → suggestions-BJeGvwDa.d.ts} +7 -7
- package/dist/switch.d.ts +14 -2
- package/dist/switch.js +1 -1
- package/dist/table-BnLdXUai.js +1 -0
- package/dist/{table-vT6Okwfa.d.ts → table-Ii9hHUWN.d.ts} +84 -5
- package/dist/table.d.ts +6 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +24 -12
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +12 -2
- package/dist/text-area.js +1 -1
- package/dist/theme-BNdZl352.js +1 -0
- package/dist/theme-switcher.d.ts +18 -4
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +25 -11
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +15 -2
- package/dist/toast.js +1 -1
- package/dist/tokens.dark.json +3261 -0
- package/dist/tokens.json +4933 -0
- package/dist/tokens.resolver.json +37 -0
- package/dist/{tooltip-NcLIeBy5.d.ts → tooltip-CstGDKwy.d.ts} +18 -11
- package/dist/tooltip-DQO40Mrq.js +1 -0
- package/dist/tooltip.d.ts +6 -1
- package/dist/tooltip.js +1 -1
- package/dist/truncated-text.d.ts +28 -14
- package/dist/truncated-text.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/use-breakpoint-B4Kh0xE6.js +1 -0
- package/dist/use-callback-ref-DiOXFQzM.js +1 -0
- package/dist/use-composed-refs-DPYmLDSe.js +1 -0
- package/dist/use-copy-to-clipboard-hBL6_65i.js +1 -0
- package/dist/use-inert-siblings-C4RHXrZc.js +1 -0
- package/dist/use-is-apple-platform-Bq6_KbVX.js +1 -0
- package/dist/use-is-hydrated-BeLOGKwE.js +1 -0
- package/dist/use-is-hydrated-after-paint-CrHt3OHw.js +1 -0
- package/dist/use-isomorphic-layout-effect-CL6iq0Bj.js +1 -0
- package/dist/use-matches-media-query-FfvtNKQe.js +1 -0
- package/dist/use-prefers-reduced-motion-Ck6dnOM9.js +1 -0
- package/dist/use-swipe-to-dismiss-BYdlca8r.js +1 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/visually-hidden.d.ts +14 -1
- package/dist/visually-hidden.js +1 -1
- package/dist/well.d.ts +7 -2
- package/dist/well.js +1 -1
- package/package.json +21 -7
- package/src/components/chart/d3-license.md +25 -0
- package/dist/alert-P9lwn25X.js +0 -1
- package/dist/anchor-CgcbWEUs.js +0 -1
- package/dist/browser-only-BTSrYWLj.js +0 -1
- package/dist/button-69InNC_m.js +0 -1
- package/dist/button-B8k98Pby.js +0 -1
- package/dist/button-Dge0D5bl.js +0 -1
- package/dist/chart-BpWfQAwf.js +0 -2
- package/dist/checkbox-DmSQXs26.js +0 -1
- package/dist/choice-2Lrv8_nl.js +0 -1
- package/dist/code-DUJzSl4K.js +0 -1
- package/dist/compose-refs-sFdxsL7k.js +0 -1
- package/dist/dialog-7TUgiSzX.js +0 -1
- package/dist/dialog-Dp0QGWwo.d.ts +0 -28
- package/dist/dropdown-menu-BHBzCDSZ.js +0 -1
- package/dist/field-Bihblt8U.js +0 -1
- package/dist/field-CPvjazWN.js +0 -1
- package/dist/icon-kK0c-POG.js +0 -1
- package/dist/icons-CDLz5lpI.js +0 -1
- package/dist/icons-CSwTVV2m.js +0 -1
- package/dist/icons-DP3lQw5O.js +0 -1
- package/dist/input-CpQ6jlpI.js +0 -1
- package/dist/kbd-CLHsJ99p.js +0 -1
- package/dist/label-nHqqYS7e.js +0 -1
- package/dist/layer-container-kEQiE4zV.js +0 -1
- package/dist/list-RFRIQxU2.js +0 -1
- package/dist/live-region-DQ1QLv3L.js +0 -1
- package/dist/main-CC1L9IsH.js +0 -1
- package/dist/popover-C96V8SXi.d.ts +0 -1
- package/dist/popover-DxOqLKxy.js +0 -1
- package/dist/primitive-Dz9Al-us.js +0 -1
- package/dist/radio-group-HDVxTNPi.js +0 -1
- package/dist/sandboxed-on-click-C7pPu-2M.js +0 -1
- package/dist/select-CAAYk4Yj.js +0 -1
- package/dist/separator-DfzxVutO.js +0 -1
- package/dist/sheet-CSJc_sB4.js +0 -1
- package/dist/skeleton-DBpI-ko5.js +0 -1
- package/dist/slot-DdYN1L1C.js +0 -1
- package/dist/table-CFHiDBW8.js +0 -1
- package/dist/theme-C-glc5Q-.js +0 -1
- package/dist/tooltip-b6oiTaWq.js +0 -1
- package/dist/use-breakpoint--mo7kr9d.js +0 -1
- package/dist/use-callback-ref-BvVyI5K1.js +0 -1
- package/dist/use-copy-to-clipboard-Dy_0Qzb7.js +0 -1
- package/dist/use-is-apple-platform-D4nifHMx.js +0 -1
- package/dist/use-is-hydrated-after-paint-r9Cl2mGp.js +0 -1
- package/dist/use-isomorphic-layout-effect-CLSmHzo4.js +0 -1
- package/dist/use-matches-media-query-m860lols.js +0 -1
- package/dist/use-prefers-reduced-motion-CU6mWmOe.js +0 -1
- package/dist/use-swipe-to-dismiss-DceYk1Id.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{t as e}from"./field-Cai_4c1l.js";import{t}from"./radio-group-BliblUqe.js";import{c as n}from"react/compiler-runtime";import{createContext as r,useContext as i,useState as a}from"react";import{jsx as o}from"react/jsx-runtime";import{Radio as s,RadioGroup as c}from"@headlessui/react";const l=e=>{let t=n(6),r,i;t[0]===e?(r=t[1],i=t[2]):({ref:i,...r}=e,t[0]=e,t[1]=r,t[2]=i);let a;return t[3]!==r||t[4]!==i?(a=/* @__PURE__ */ o(c,{...r,ref:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a},u=r({autofocus:!1,checked:!1,disabled:!1,focus:!1,hover:!1});function d(e){let t=e.filter(e=>e!=null&&e!==``);return t.length>0?t.join(` `):void 0}function f(){let e=n(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[r,i]=a(t),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>(i(t=>[...t,e]),()=>{i(t=>t.filter(t=>t!==e))}),e[1]=o):o=e[1];let s=o,c;return e[2]===r?c=e[3]:(c=[r,s],e[2]=r,e[3]=c),c}const p=r=>{let a=n(26),s,c,l,u;a[0]===r?(s=a[1],c=a[2],l=a[3],u=a[4]):({children:s,ref:l,tag:u,...c}=r,a[0]=r,a[1]=s,a[2]=c,a[3]=l,a[4]=u);let p=u===void 0?`div`:u,m=i(e),[h,g]=f(),[_,v]=f(),y;a[5]!==v||a[6]!==g?(y={registerLabelId:g,registerDescriptionId:v},a[5]=v,a[6]=g,a[7]=y):y=a[7];let b=y,x;a[8]===m?x=a[9]:(x=m?{"aria-errormessage":m[`aria-errormessage`],"aria-invalid":m[`aria-invalid`]}:void 0,a[8]=m,a[9]=x);let S;a[10]===h?S=a[11]:(S=d(h),a[10]=h,a[11]=S);let C=m?.[`aria-describedby`],w;a[12]!==_||a[13]!==C?(w=d([C,..._]),a[12]=_,a[13]=C,a[14]=w):w=a[14];let T;a[15]!==s||a[16]!==b?(T=/* @__PURE__ */ o(t.Provider,{value:b,children:s}),a[15]=s,a[16]=b,a[17]=T):T=a[17];let E;return a[18]!==p||a[19]!==c||a[20]!==l||a[21]!==x||a[22]!==S||a[23]!==w||a[24]!==T?(E=/* @__PURE__ */ o(p,{...c,...x,"aria-labelledby":S,"aria-describedby":w,ref:l,children:T}),a[18]=p,a[19]=c,a[20]=l,a[21]=x,a[22]=S,a[23]=w,a[24]=T,a[25]=E):E=a[25],E},m=e=>{let t=n(12),r,i,a,c;t[0]===e?(r=t[1],i=t[2],a=t[3],c=t[4]):({as:c,children:r,ref:a,...i}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a,t[4]=c);let l;t[5]===r?l=t[6]:(l=e=>/* @__PURE__ */ o(u.Provider,{value:e,children:r}),t[5]=r,t[6]=l);let d;return t[7]!==i||t[8]!==a||t[9]!==l||t[10]!==c?(d=/* @__PURE__ */ o(s,{...i,as:p,tag:c,ref:a,children:l}),t[7]=i,t[8]=a,t[9]=l,t[10]=c,t[11]=d):d=t[11],d};export{u as n,l as r,m as t};
|
package/dist/radio-group.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Radio Group component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/forms/radio-group
|
|
5
|
+
*/
|
|
1
6
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
type RadioGroupProps
|
|
6
|
-
ref?: Ref<HTMLElement>;
|
|
7
|
-
} & WithDataSlot;
|
|
7
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
8
|
+
import { n as RadioStateContextValue, r as RootProps, t as ItemProps } from "./radio-group-BJQ6EOqh.js";
|
|
9
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
10
|
+
type RadioGroupProps = RootProps;
|
|
8
11
|
/**
|
|
9
12
|
* A group of radio items. It manages the state of the children radios. Unstyled and simple.
|
|
10
13
|
* Used as the root component for grouping related radio items where only one can be selected.
|
|
@@ -32,20 +35,8 @@ type RadioGroupProps$1 = PropsWithChildren<Omit<RadioGroupProps, "as" | "childre
|
|
|
32
35
|
* </RadioGroup.Root>
|
|
33
36
|
* ```
|
|
34
37
|
*/
|
|
35
|
-
declare const Root: ({ "data-slot": dataSlot, ref, ...props }: RadioGroupProps
|
|
36
|
-
|
|
37
|
-
* The shape of the radio state context.
|
|
38
|
-
*/
|
|
39
|
-
type RadioStateContextValue = {
|
|
40
|
-
autofocus: boolean;
|
|
41
|
-
checked: boolean;
|
|
42
|
-
disabled: boolean;
|
|
43
|
-
focus: boolean;
|
|
44
|
-
hover: boolean;
|
|
45
|
-
};
|
|
46
|
-
type RadioItemProps = Omit<RadioProps, "children"> & PropsWithChildren & {
|
|
47
|
-
ref?: Ref<HTMLDivElement>;
|
|
48
|
-
} & WithDataSlot;
|
|
38
|
+
declare const Root: ({ "data-slot": dataSlot, ref, ...props }: RadioGroupProps) => import("react").JSX.Element;
|
|
39
|
+
type RadioItemProps = ItemProps;
|
|
49
40
|
/**
|
|
50
41
|
* A simple radio item that can be used inside a radio group. The "conventional" use-case.
|
|
51
42
|
* Must be a child of `RadioGroup`.
|
|
@@ -120,7 +111,7 @@ declare const Indicator: ({ "data-slot": dataSlot, children, className, name: _n
|
|
|
120
111
|
* </RadioGroup.Root>
|
|
121
112
|
* ```
|
|
122
113
|
*/
|
|
123
|
-
declare const List: ({ "data-slot": dataSlot, className, ref, ...props }: RadioGroupProps
|
|
114
|
+
declare const List: ({ "data-slot": dataSlot, className, ref, ...props }: RadioGroupProps) => import("react").JSX.Element;
|
|
124
115
|
type RadioListItemProps = RadioItemProps & WithDataSlot;
|
|
125
116
|
/**
|
|
126
117
|
* A radio list item that is used inside a `RadioGroup.List`.
|
|
@@ -210,48 +201,6 @@ declare const Card: ({ "data-slot": dataSlot, as: tag, children, className, ref,
|
|
|
210
201
|
* ```
|
|
211
202
|
*/
|
|
212
203
|
declare const ItemContent: ({ "data-slot": dataSlot, asChild, children, className, ...props }: RadioItemContentProps) => import("react").JSX.Element;
|
|
213
|
-
/**
|
|
214
|
-
* An inline group of radio buttons. Use RadioGroup.Button as direct children.
|
|
215
|
-
* Renders the radio group itself (it wraps `Root`) — use it *in place of*
|
|
216
|
-
* `RadioGroup.Root`, never nested inside one, or the buttons bind to an
|
|
217
|
-
* inner, uncontrolled group and outer `value`/`onChange` props are ignored.
|
|
218
|
-
*
|
|
219
|
-
* @see https://mantle.ngrok.com/components/forms/radio-group#radiogroupbuttongroup
|
|
220
|
-
*
|
|
221
|
-
* @example
|
|
222
|
-
* ```tsx
|
|
223
|
-
* <Label id="size-label">Size</Label>
|
|
224
|
-
* <RadioGroup.ButtonGroup aria-labelledby="size-label" defaultValue="small">
|
|
225
|
-
* <RadioGroup.Button value="small">Small</RadioGroup.Button>
|
|
226
|
-
* <RadioGroup.Button value="medium">Medium</RadioGroup.Button>
|
|
227
|
-
* <RadioGroup.Button value="large">Large</RadioGroup.Button>
|
|
228
|
-
* </RadioGroup.ButtonGroup>
|
|
229
|
-
* ```
|
|
230
|
-
*/
|
|
231
|
-
declare const ButtonGroup: ({ "data-slot": dataSlot, className, ref, ...props }: RadioGroupProps$1) => import("react").JSX.Element;
|
|
232
|
-
type RadioButtonProps = RadioItemProps & WithDataSlot;
|
|
233
|
-
/**
|
|
234
|
-
* A radio button that is used inside a `RadioGroup.ButtonGroup`.
|
|
235
|
-
*
|
|
236
|
-
* When rendered inside `Field.Control` (an alternative to the recommended
|
|
237
|
-
* `Field.Set` / `Field.Legend` composition), picks up `aria-invalid`,
|
|
238
|
-
* `aria-errormessage`, and `aria-describedby` from `FieldControlContext`. A
|
|
239
|
-
* `Choice.Title` inside the item names it through `aria-labelledby`, and a
|
|
240
|
-
* `Choice.Description` describes it through `aria-describedby`. The option's
|
|
241
|
-
* accessible name is then the title alone.
|
|
242
|
-
*
|
|
243
|
-
* @see https://mantle.ngrok.com/components/forms/radio-group#radiogroupbutton
|
|
244
|
-
*
|
|
245
|
-
* @example
|
|
246
|
-
* ```tsx
|
|
247
|
-
* <RadioGroup.ButtonGroup defaultValue="option1">
|
|
248
|
-
* <RadioGroup.Button value="option1">Option 1</RadioGroup.Button>
|
|
249
|
-
* <RadioGroup.Button value="option2">Option 2</RadioGroup.Button>
|
|
250
|
-
* <RadioGroup.Button value="option3">Option 3</RadioGroup.Button>
|
|
251
|
-
* </RadioGroup.ButtonGroup>
|
|
252
|
-
* ```
|
|
253
|
-
*/
|
|
254
|
-
declare const Button: ({ "data-slot": dataSlot, as: tag, children, className, ref, ...props }: RadioButtonProps) => import("react").JSX.Element;
|
|
255
204
|
type RadioInputSandboxProps = HTMLAttributes<HTMLDivElement> & WithDataSlot;
|
|
256
205
|
/**
|
|
257
206
|
* A sandbox container for input elements composed within radio group items.
|
|
@@ -281,6 +230,14 @@ declare const InputSandbox: ({ "data-slot": dataSlot, children, onClick, onKeyDo
|
|
|
281
230
|
/**
|
|
282
231
|
* A group of radio items. It manages the state of the children radios.
|
|
283
232
|
*
|
|
233
|
+
* @useWhen Pick exactly one value from a few fixed options, with every option visible at once.
|
|
234
|
+
*
|
|
235
|
+
* @siblings
|
|
236
|
+
* - `Select`: the set is long, or the form has little space.
|
|
237
|
+
* - `Checkbox`: the user picks any number of options.
|
|
238
|
+
* - `Choice`: each radio needs a title and a description beside it.
|
|
239
|
+
* - `SegmentedControl`: a few short options switch a view or a mode in one row.
|
|
240
|
+
*
|
|
284
241
|
* @see https://mantle.ngrok.com/components/forms/radio-group#radiogrouproot
|
|
285
242
|
*
|
|
286
243
|
* @example
|
|
@@ -298,10 +255,6 @@ declare const InputSandbox: ({ "data-slot": dataSlot, children, onClick, onKeyDo
|
|
|
298
255
|
* ├── RadioGroup.Indicator
|
|
299
256
|
* └── RadioGroup.ItemContent
|
|
300
257
|
*
|
|
301
|
-
* # Segmented button group
|
|
302
|
-
* RadioGroup.ButtonGroup
|
|
303
|
-
* └── RadioGroup.Button
|
|
304
|
-
*
|
|
305
258
|
* # Card-style radios
|
|
306
259
|
* RadioGroup.Root
|
|
307
260
|
* └── RadioGroup.Card
|
|
@@ -333,38 +286,6 @@ declare const InputSandbox: ({ "data-slot": dataSlot, children, onClick, onKeyDo
|
|
|
333
286
|
* ```
|
|
334
287
|
*/
|
|
335
288
|
declare const RadioGroup: {
|
|
336
|
-
/**
|
|
337
|
-
* A radio button that is used inside a RadioGroup.ButtonGroup for inline grouped radio options.
|
|
338
|
-
*
|
|
339
|
-
* @see https://mantle.ngrok.com/components/forms/radio-group#radiogroupbutton
|
|
340
|
-
*
|
|
341
|
-
* @example
|
|
342
|
-
* ```tsx
|
|
343
|
-
* <RadioGroup.ButtonGroup defaultValue="option1">
|
|
344
|
-
* <RadioGroup.Button value="option1">Option 1</RadioGroup.Button>
|
|
345
|
-
* <RadioGroup.Button value="option2">Option 2</RadioGroup.Button>
|
|
346
|
-
* <RadioGroup.Button value="option3">Option 3</RadioGroup.Button>
|
|
347
|
-
* </RadioGroup.ButtonGroup>
|
|
348
|
-
* ```
|
|
349
|
-
*/
|
|
350
|
-
readonly Button: typeof Button;
|
|
351
|
-
/**
|
|
352
|
-
* An inline group of radio buttons. Use RadioGroup.Button as direct children for horizontal radio layouts.
|
|
353
|
-
* Renders the radio group itself — use it in place of `RadioGroup.Root`, never nested inside one.
|
|
354
|
-
*
|
|
355
|
-
* @see https://mantle.ngrok.com/components/forms/radio-group#radiogroupbuttongroup
|
|
356
|
-
*
|
|
357
|
-
* @example
|
|
358
|
-
* ```tsx
|
|
359
|
-
* <Label id="size-label">Size</Label>
|
|
360
|
-
* <RadioGroup.ButtonGroup aria-labelledby="size-label" defaultValue="small">
|
|
361
|
-
* <RadioGroup.Button value="small">Small</RadioGroup.Button>
|
|
362
|
-
* <RadioGroup.Button value="medium">Medium</RadioGroup.Button>
|
|
363
|
-
* <RadioGroup.Button value="large">Large</RadioGroup.Button>
|
|
364
|
-
* </RadioGroup.ButtonGroup>
|
|
365
|
-
* ```
|
|
366
|
-
*/
|
|
367
|
-
readonly ButtonGroup: typeof ButtonGroup;
|
|
368
289
|
/**
|
|
369
290
|
* A radio card item with enhanced styling. Use it as a child of RadioGroup for card-based radio options.
|
|
370
291
|
*
|
|
@@ -469,7 +390,7 @@ declare const RadioGroup: {
|
|
|
469
390
|
*/
|
|
470
391
|
readonly ItemContent: typeof ItemContent;
|
|
471
392
|
/**
|
|
472
|
-
* A group of radio list items
|
|
393
|
+
* A bordered group of radio list items. Use RadioGroup.ListItem as direct children.
|
|
473
394
|
*
|
|
474
395
|
* @see https://mantle.ngrok.com/components/forms/radio-group#radiogrouplist
|
|
475
396
|
*
|
package/dist/radio-group.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./slot-DdYN1L1C.js";import{t as r}from"./clsx-DUGZgXfJ.js";import{t as i}from"./field-Bihblt8U.js";import{t as a}from"./radio-group-HDVxTNPi.js";import{t as o}from"./input-DQyN6gN0.js";import{c as s}from"react/compiler-runtime";import{Children as c,cloneElement as l,createContext as u,isValidElement as d,useContext as f,useRef as p,useState as m}from"react";import{jsx as h}from"react/jsx-runtime";import{Radio as g,RadioGroup as _}from"@headlessui/react";const v=e=>{let n=s(10),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({"data-slot":r,ref:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===r?o=n[5]:(o=t(r,`radio-group`),n[4]=r,n[5]=o);let c;return n[6]!==i||n[7]!==a||n[8]!==o?(c=/* @__PURE__ */ h(_,{"data-slot":o,...i,ref:a}),n[6]=i,n[7]=a,n[8]=o,n[9]=c):c=n[9],c},y=u({autofocus:!1,checked:!1,disabled:!1,focus:!1,hover:!1});function b(e){let t=e.filter(e=>e!=null&&e!==``);return t.length>0?t.join(` `):void 0}function x(){let e=s(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=m(t),i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=e=>(r(t=>[...t,e]),()=>{r(t=>t.filter(t=>t!==e))}),e[1]=i):i=e[1];let a=i,o;return e[2]===n?o=e[3]:(o=[n,a],e[2]=n,e[3]=o),o}const S=e=>{let t=s(26),n,r,o,c;t[0]===e?(n=t[1],r=t[2],o=t[3],c=t[4]):({children:n,ref:o,tag:c,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=c);let l=c===void 0?`div`:c,u=f(i),[d,p]=x(),[m,g]=x(),_;t[5]!==g||t[6]!==p?(_={registerLabelId:p,registerDescriptionId:g},t[5]=g,t[6]=p,t[7]=_):_=t[7];let v=_,y;t[8]===u?y=t[9]:(y=u?{"aria-errormessage":u[`aria-errormessage`],"aria-invalid":u[`aria-invalid`]}:void 0,t[8]=u,t[9]=y);let S;t[10]===d?S=t[11]:(S=b(d),t[10]=d,t[11]=S);let C=u?.[`aria-describedby`],w;t[12]!==m||t[13]!==C?(w=b([C,...m]),t[12]=m,t[13]=C,t[14]=w):w=t[14];let T;t[15]!==n||t[16]!==v?(T=/* @__PURE__ */ h(a.Provider,{value:v,children:n}),t[15]=n,t[16]=v,t[17]=T):T=t[17];let E;return t[18]!==l||t[19]!==r||t[20]!==o||t[21]!==y||t[22]!==S||t[23]!==w||t[24]!==T?(E=/* @__PURE__ */ h(l,{...r,...y,"aria-labelledby":S,"aria-describedby":w,ref:o,children:T}),t[18]=l,t[19]=r,t[20]=o,t[21]=y,t[22]=S,t[23]=w,t[24]=T,t[25]=E):E=t[25],E},C=n=>{let r=s(20),i,a,o,c,l,u;r[0]===n?(i=r[1],a=r[2],o=r[3],c=r[4],l=r[5],u=r[6]):({"data-slot":o,as:u,children:i,className:a,ref:l,...c}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=c,r[5]=l,r[6]=u);let d;r[7]===o?d=r[8]:(d=t(o,`radio-group-item`),r[7]=o,r[8]=d);let f;r[9]===a?f=r[10]:(f=e(`group/radio cursor-pointer aria-disabled:cursor-default [&_label]:cursor-inherit flex gap-2 py-1 text-sm focus:outline-hidden`,`not-has-data-radio-default-indicator:focus-visible:ring-focus-accent not-has-data-radio-default-indicator:focus-visible:ring-4 not-has-data-radio-default-indicator:focus-visible:rounded-md`,a),r[9]=a,r[10]=f);let p;r[11]===i?p=r[12]:(p=e=>/* @__PURE__ */ h(y.Provider,{value:e,children:i}),r[11]=i,r[12]=p);let m;return r[13]!==c||r[14]!==l||r[15]!==d||r[16]!==f||r[17]!==p||r[18]!==u?(m=/* @__PURE__ */ h(g,{"data-slot":d,className:f,...c,as:S,tag:u,ref:l,children:p}),r[13]=c,r[14]=l,r[15]=d,r[16]=f,r[17]=p,r[18]=u,r[19]=m):m=r[19],m},w=t=>{let n=s(10),{checked:r,disabled:i,focus:a,hover:o}=t,c=i&&`cursor-default opacity-50`,l=r&&`border-accent-600 bg-accent-600`,u=a&&!i&&`border-accent-600 ring-focus-accent ring-4`,d=o&&`border-accent-600`,f;n[0]!==c||n[1]!==l||n[2]!==u||n[3]!==d?(f=e(`border-form flex size-4 items-center justify-center rounded-full border shrink-0`,c,l,u,d),n[0]=c,n[1]=l,n[2]=u,n[3]=d,n[4]=f):f=n[4];let p;n[5]===r?p=n[6]:(p=r&&/* @__PURE__ */ h(`span`,{className:`size-2 rounded-full bg-white shrink-0`}),n[5]=r,n[6]=p);let m;return n[7]!==f||n[8]!==p?(m=/* @__PURE__ */ h(`span`,{"data-radio-default-indicator":``,className:f,children:p}),n[7]=f,n[8]=p,n[9]=m):m=n[9],m},T={Button:n=>{let r=s(20),i,a,o,c,l,u;r[0]===n?(i=r[1],a=r[2],o=r[3],c=r[4],l=r[5],u=r[6]):({"data-slot":o,as:u,children:i,className:a,ref:l,...c}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=c,r[5]=l,r[6]=u);let d;r[7]===o?d=r[8]:(d=t(o,`radio-group-button`),r[7]=o,r[8]=d);let f;r[9]===a?f=r[10]:(f=e(`group/radio border-form [&_label]:cursor-inherit relative flex flex-1 select-none items-center justify-center gap-2 border px-3 text-sm`,`h-9 whitespace-nowrap`,`focus-visible:ring-focus-accent not-aria-disabled:focus-visible:border-accent-600 focus-visible:ring-4`,`cursor-pointer aria-disabled:cursor-default focus:outline-hidden`,`first-of-type:rounded-bl-md first-of-type:rounded-tl-md last-of-type:rounded-br-md last-of-type:rounded-tr-md`,`not-aria-disabled:hover:z-1 not-aria-disabled:hover:border-accent-600 aria-disabled:opacity-50`,`aria-checked:z-1 aria-checked:border-accent-600/40 aria-checked:bg-accent-500/10 not-aria-disabled:hover:aria-checked:border-accent-600`,`has-[.radio-indicator:first-child]:pl-2 has-[.radio-indicator:last-child]:pr-2`,a),r[9]=a,r[10]=f);let p;r[11]===i?p=r[12]:(p=e=>/* @__PURE__ */ h(y.Provider,{value:e,children:i}),r[11]=i,r[12]=p);let m;return r[13]!==c||r[14]!==l||r[15]!==d||r[16]!==f||r[17]!==p||r[18]!==u?(m=/* @__PURE__ */ h(g,{"data-slot":d,className:f,...c,as:S,tag:u,ref:l,children:p}),r[13]=c,r[14]=l,r[15]=d,r[16]=f,r[17]=p,r[18]=u,r[19]=m):m=r[19],m},ButtonGroup:e=>{let n=s(14),i,a,o,c;n[0]===e?(i=n[1],a=n[2],o=n[3],c=n[4]):({"data-slot":a,className:i,ref:c,...o}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=o,n[4]=c);let l;n[5]===a?l=n[6]:(l=t(a,`radio-group-button-group`),n[5]=a,n[6]=l);let u;n[7]===i?u=n[8]:(u=r(`flex flex-row flex-nowrap -space-x-px`,i),n[7]=i,n[8]=u);let d;return n[9]!==o||n[10]!==c||n[11]!==l||n[12]!==u?(d=/* @__PURE__ */ h(v,{"data-slot":l,className:u,...o,ref:c}),n[9]=o,n[10]=c,n[11]=l,n[12]=u,n[13]=d):d=n[13],d},Card:e=>{let n=s(20),i,a,o,c,l,u;n[0]===e?(i=n[1],a=n[2],o=n[3],c=n[4],l=n[5],u=n[6]):({"data-slot":o,as:u,children:i,className:a,ref:l,...c}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=o,n[4]=c,n[5]=l,n[6]=u);let d;n[7]===o?d=n[8]:(d=t(o,`radio-group-card`),n[7]=o,n[8]=d);let f;n[9]===a?f=n[10]:(f=r(`group/radio border-card bg-card [&_label]:cursor-inherit relative rounded-md border p-4 text-sm`,`cursor-pointer aria-disabled:cursor-default focus:outline-hidden`,`focus-visible:ring-focus-accent not-aria-disabled:focus-visible:border-accent-600 focus-visible:ring-4`,`first-of-type:rounded-tl-md first-of-type:rounded-tr-md last-of-type:rounded-bl-md last-of-type:rounded-br-md`,`aria-disabled:border-form/50 not-aria-disabled:hover:z-1 not-aria-disabled:hover:border-accent-600`,`aria-checked:z-1 aria-checked:border-accent-600/50 aria-checked:bg-accent-500/10 not-aria-disabled:hover:aria-checked:border-accent-600`,a),n[9]=a,n[10]=f);let p;n[11]===i?p=n[12]:(p=e=>/* @__PURE__ */ h(y.Provider,{value:e,children:i}),n[11]=i,n[12]=p);let m;return n[13]!==c||n[14]!==l||n[15]!==d||n[16]!==f||n[17]!==p||n[18]!==u?(m=/* @__PURE__ */ h(g,{"data-slot":d,className:f,...c,as:S,tag:u,ref:l,children:p}),n[13]=c,n[14]=l,n[15]=d,n[16]=f,n[17]=p,n[18]=u,n[19]=m):m=n[19],m},Indicator:n=>{let r=s(21),i,a,o,c;if(r[0]!==n){let{"data-slot":e,children:t,className:s,name:l,...u}=n;o=e,i=t,a=s,c=u,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=c}else i=r[1],a=r[2],o=r[3],c=r[4];let l=f(y),u;r[5]!==i||r[6]!==l?(u=typeof i==`function`?i(l):i,r[5]=i,r[6]=l,r[7]=u):u=r[7];let d=u,p;r[8]===o?p=r[9]:(p=t(o,`radio-group-indicator`),r[8]=o,r[9]=p);let m;r[10]===a?m=r[11]:(m=e(`radio-indicator inline-flex size-5 select-none items-center justify-center shrink-0`,a),r[10]=a,r[11]=m);let g;r[12]!==i||r[13]!==l||r[14]!==d?(g=i==null?/* @__PURE__ */ h(w,{...l}):d,r[12]=i,r[13]=l,r[14]=d,r[15]=g):g=r[15];let _;return r[16]!==c||r[17]!==p||r[18]!==m||r[19]!==g?(_=/* @__PURE__ */ h(`div`,{"data-slot":p,className:m,...c,children:g}),r[16]=c,r[17]=p,r[18]=m,r[19]=g,r[20]=_):_=r[20],_},InputSandbox:e=>{let n=s(22),r,i,a,u,m;n[0]===e?(r=n[1],i=n[2],a=n[3],u=n[4],m=n[5]):({"data-slot":i,children:r,onClick:a,onKeyDown:u,...m}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=u,n[5]=m);let g=p(null),_=f(y),v;if(n[6]!==r||n[7]!==_.checked||n[8]!==_.disabled||n[9]!==i||n[10]!==a||n[11]!==u||n[12]!==m){let e=c.only(r),s=_.disabled||!_.checked,f;n[14]===i?f=n[15]:(f=t(i,`radio-group-input-sandbox`),n[14]=i,n[15]=f);let p;n[16]!==_.disabled||n[17]!==u?(p=e=>{if(_.disabled)e.stopPropagation(),e.preventDefault();else{bb9:switch(e.key){case`Enter`:case`Tab`:break bb9;default:e.stopPropagation()}u?.(e)}},n[16]=_.disabled,n[17]=u,n[18]=p):p=n[18];let y;n[19]!==_.disabled||n[20]!==a?(y=e=>{if(_.disabled){e.stopPropagation(),e.preventDefault();return}let t=e.target;o(t)&&window.requestAnimationFrame(()=>{t.focus()}),a?.(e)},n[19]=_.disabled,n[20]=a,n[21]=y):y=n[21],v=/* @__PURE__ */ h(`div`,{role:`none`,"data-slot":f,ref:g,onKeyDown:p,onClick:y,...m,children:d(e)&&l(e,{disabled:_.disabled||e.props.disabled,tabIndex:s?-1:e.props.tabIndex})}),n[6]=r,n[7]=_.checked,n[8]=_.disabled,n[9]=i,n[10]=a,n[11]=u,n[12]=m,n[13]=v}else v=n[13];return v},Item:C,ItemContent:e=>{let i=s(17),a,o,c,l,u;i[0]===e?(a=i[1],o=i[2],c=i[3],l=i[4],u=i[5]):({"data-slot":c,asChild:u,children:a,className:o,...l}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=c,i[4]=l,i[5]=u);let d=u!==void 0&&u,p=f(y),m=d?n:`div`,g;i[6]===c?g=i[7]:(g=t(c,`radio-group-item-content`),i[6]=c,i[7]=g);let _=p.disabled&&`opacity-50`,v;i[8]!==o||i[9]!==_?(v=r(`min-w-0 flex-1`,_,o),i[8]=o,i[9]=_,i[10]=v):v=i[10];let b;return i[11]!==m||i[12]!==a||i[13]!==l||i[14]!==g||i[15]!==v?(b=/* @__PURE__ */ h(m,{"data-slot":g,className:v,...l,children:a}),i[11]=m,i[12]=a,i[13]=l,i[14]=g,i[15]=v,i[16]=b):b=i[16],b},List:e=>{let n=s(14),i,a,o,c;n[0]===e?(i=n[1],a=n[2],o=n[3],c=n[4]):({"data-slot":a,className:i,ref:c,...o}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=o,n[4]=c);let l;n[5]===a?l=n[6]:(l=t(a,`radio-group-list`),n[5]=a,n[6]=l);let u;n[7]===i?u=n[8]:(u=r(`-space-y-px`,i),n[7]=i,n[8]=u);let d;return n[9]!==o||n[10]!==c||n[11]!==l||n[12]!==u?(d=/* @__PURE__ */ h(v,{"data-slot":l,className:u,...o,ref:c}),n[9]=o,n[10]=c,n[11]=l,n[12]=u,n[13]=d):d=n[13],d},ListItem:n=>{let r=s(20),i,a,o,c,l,u;r[0]===n?(i=r[1],a=r[2],o=r[3],c=r[4],l=r[5],u=r[6]):({"data-slot":o,as:u,children:i,className:a,ref:l,...c}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=c,r[5]=l,r[6]=u);let d;r[7]===o?d=r[8]:(d=t(o,`radio-group-list-item`),r[7]=o,r[8]=d);let f;r[9]===a?f=r[10]:(f=e(`group/radio border-form [&_label]:cursor-inherit relative flex select-none gap-2 border px-3 py-2 text-sm`,`cursor-pointer aria-disabled:cursor-default focus:outline-hidden`,`focus-visible:ring-focus-accent not-aria-disabled:focus-visible:border-accent-600 focus-visible:ring-4`,`first-of-type:rounded-tl-md first-of-type:rounded-tr-md last-of-type:rounded-bl-md last-of-type:rounded-br-md`,`aria-disabled:border-form/50 not-aria-disabled:hover:z-1 not-aria-disabled:hover:border-accent-600`,`aria-checked:z-1 aria-checked:border-accent-500/40 aria-checked:bg-accent-500/10 not-aria-disabled:hover:aria-checked:border-accent-600`,`has-[.radio-indicator:first-child]:pl-2 has-[.radio-indicator:last-child]:pr-2`,a),r[9]=a,r[10]=f);let p;r[11]===i?p=r[12]:(p=e=>/* @__PURE__ */ h(y.Provider,{value:e,children:i}),r[11]=i,r[12]=p);let m;return r[13]!==c||r[14]!==l||r[15]!==d||r[16]!==f||r[17]!==p||r[18]!==u?(m=/* @__PURE__ */ h(g,{"data-slot":d,className:f,...c,as:S,tag:u,ref:l,children:p}),r[13]=c,r[14]=l,r[15]=d,r[16]=f,r[17]=p,r[18]=u,r[19]=m):m=r[19],m},Root:v};export{T as RadioGroup};
|
|
1
|
+
"use client";import{t as e}from"./clsx-DUGZgXfJ.js";import{t}from"./cx-CK7o_rVv.js";import{t as n}from"./data-slot-EM6s2WEU.js";import{t as r}from"./input-DQyN6gN0.js";import{t as i}from"./slot-B7rwscwd.js";import{n as a,r as o,t as s}from"./radio-group-ggEkCi0V.js";import{c}from"react/compiler-runtime";import{Children as l,cloneElement as u,isValidElement as d,useContext as f,useRef as p}from"react";import{jsx as m}from"react/jsx-runtime";const h=e=>{let t=c(10),r,i,a;t[0]===e?(r=t[1],i=t[2],a=t[3]):({"data-slot":r,ref:a,...i}=e,t[0]=e,t[1]=r,t[2]=i,t[3]=a);let s;t[4]===r?s=t[5]:(s=n(r,`radio-group`),t[4]=r,t[5]=s);let l;return t[6]!==i||t[7]!==a||t[8]!==s?(l=/* @__PURE__ */ m(o,{"data-slot":s,...i,ref:a}),t[6]=i,t[7]=a,t[8]=s,t[9]=l):l=t[9],l},g=e=>{let r=c(18),i,a,o,l,u,d;r[0]===e?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],d=r[6]):({"data-slot":o,as:d,children:i,className:a,ref:u,...l}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u,r[6]=d);let f;r[7]===o?f=r[8]:(f=n(o,`radio-group-item`),r[7]=o,r[8]=f);let p;r[9]===a?p=r[10]:(p=t(`group/radio cursor-pointer aria-disabled:cursor-default [&_label]:cursor-inherit flex gap-2 py-1 text-sm focus:outline-hidden`,`not-has-data-radio-default-indicator:focus-visible:ring-focus-accent not-has-data-radio-default-indicator:focus-visible:ring-4 not-has-data-radio-default-indicator:focus-visible:rounded-md`,a),r[9]=a,r[10]=p);let h;return r[11]!==i||r[12]!==l||r[13]!==u||r[14]!==f||r[15]!==p||r[16]!==d?(h=/* @__PURE__ */ m(s,{"data-slot":f,className:p,...l,as:d,ref:u,children:i}),r[11]=i,r[12]=l,r[13]=u,r[14]=f,r[15]=p,r[16]=d,r[17]=h):h=r[17],h},_=e=>{let n=c(10),{checked:r,disabled:i,focus:a,hover:o}=e,s=i&&`cursor-default opacity-50`,l=r?`bg-filled-accent border-transparent`:`bg-form border-form`,u=o&&!i&&(r?`bg-filled-accent-hover`:`border-neutral-400`),d=a&&!i&&`ring-focus-accent ring-4`,f;n[0]!==s||n[1]!==l||n[2]!==u||n[3]!==d?(f=t(`flex size-4 items-center justify-center rounded-full border shrink-0`,s,l,u,d),n[0]=s,n[1]=l,n[2]=u,n[3]=d,n[4]=f):f=n[4];let p;n[5]===r?p=n[6]:(p=r&&/* @__PURE__ */ m(`span`,{className:`size-2 rounded-full bg-white shrink-0 forced-colors:forced-color-adjust-none forced-colors:bg-[CanvasText]`}),n[5]=r,n[6]=p);let h;return n[7]!==f||n[8]!==p?(h=/* @__PURE__ */ m(`span`,{"data-radio-default-indicator":``,className:f,children:p}),n[7]=f,n[8]=p,n[9]=h):h=n[9],h},v={Card:t=>{let r=c(18),i,a,o,l,u,d;r[0]===t?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],d=r[6]):({"data-slot":o,as:d,children:i,className:a,ref:u,...l}=t,r[0]=t,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u,r[6]=d);let f;r[7]===o?f=r[8]:(f=n(o,`radio-group-card`),r[7]=o,r[8]=f);let p;r[9]===a?p=r[10]:(p=e(`group/radio border-card bg-card [&_label]:cursor-inherit relative rounded-md border p-4 text-sm`,`cursor-pointer aria-disabled:cursor-default focus:outline-hidden`,`focus-visible:ring-focus-accent focus-visible:ring-4`,`first-of-type:rounded-tl-md first-of-type:rounded-tr-md last-of-type:rounded-bl-md last-of-type:rounded-br-md`,`aria-disabled:border-form/50 not-aria-disabled:hover:bg-card-hover`,`aria-checked:border-accent-500/50 aria-checked:bg-selected-menu-item not-aria-disabled:hover:aria-checked:bg-active-selected-menu-item`,a),r[9]=a,r[10]=p);let h;return r[11]!==i||r[12]!==l||r[13]!==u||r[14]!==f||r[15]!==p||r[16]!==d?(h=/* @__PURE__ */ m(s,{"data-slot":f,className:p,...l,as:d,ref:u,children:i}),r[11]=i,r[12]=l,r[13]=u,r[14]=f,r[15]=p,r[16]=d,r[17]=h):h=r[17],h},Indicator:e=>{let r=c(21),i,o,s,l;if(r[0]!==e){let{"data-slot":t,children:n,className:a,name:c,...u}=e;s=t,i=n,o=a,l=u,r[0]=e,r[1]=i,r[2]=o,r[3]=s,r[4]=l}else i=r[1],o=r[2],s=r[3],l=r[4];let u=f(a),d;r[5]!==i||r[6]!==u?(d=typeof i==`function`?i(u):i,r[5]=i,r[6]=u,r[7]=d):d=r[7];let p=d,h;r[8]===s?h=r[9]:(h=n(s,`radio-group-indicator`),r[8]=s,r[9]=h);let g;r[10]===o?g=r[11]:(g=t(`radio-indicator inline-flex size-5 select-none items-center justify-center shrink-0`,o),r[10]=o,r[11]=g);let v;r[12]!==i||r[13]!==u||r[14]!==p?(v=i==null?/* @__PURE__ */ m(_,{...u}):p,r[12]=i,r[13]=u,r[14]=p,r[15]=v):v=r[15];let y;return r[16]!==l||r[17]!==h||r[18]!==g||r[19]!==v?(y=/* @__PURE__ */ m(`div`,{"data-slot":h,className:g,...l,children:v}),r[16]=l,r[17]=h,r[18]=g,r[19]=v,r[20]=y):y=r[20],y},InputSandbox:e=>{let t=c(22),i,o,s,h,g;t[0]===e?(i=t[1],o=t[2],s=t[3],h=t[4],g=t[5]):({"data-slot":o,children:i,onClick:s,onKeyDown:h,...g}=e,t[0]=e,t[1]=i,t[2]=o,t[3]=s,t[4]=h,t[5]=g);let _=p(null),v=f(a),y;if(t[6]!==i||t[7]!==v.checked||t[8]!==v.disabled||t[9]!==o||t[10]!==s||t[11]!==h||t[12]!==g){let e=l.only(i),a=v.disabled||!v.checked,c;t[14]===o?c=t[15]:(c=n(o,`radio-group-input-sandbox`),t[14]=o,t[15]=c);let f;t[16]!==v.disabled||t[17]!==h?(f=e=>{if(v.disabled)e.stopPropagation(),e.preventDefault();else{bb9:switch(e.key){case`Enter`:case`Tab`:break bb9;default:e.stopPropagation()}h?.(e)}},t[16]=v.disabled,t[17]=h,t[18]=f):f=t[18];let p;t[19]!==v.disabled||t[20]!==s?(p=e=>{if(v.disabled){e.stopPropagation(),e.preventDefault();return}let t=e.target;r(t)&&window.requestAnimationFrame(()=>{t.focus()}),s?.(e)},t[19]=v.disabled,t[20]=s,t[21]=p):p=t[21],y=/* @__PURE__ */ m(`div`,{role:`none`,"data-slot":c,ref:_,onKeyDown:f,onClick:p,...g,children:d(e)&&u(e,{disabled:v.disabled||e.props.disabled,tabIndex:a?-1:e.props.tabIndex})}),t[6]=i,t[7]=v.checked,t[8]=v.disabled,t[9]=o,t[10]=s,t[11]=h,t[12]=g,t[13]=y}else y=t[13];return y},Item:g,ItemContent:t=>{let r=c(17),o,s,l,u,d;r[0]===t?(o=r[1],s=r[2],l=r[3],u=r[4],d=r[5]):({"data-slot":l,asChild:d,children:o,className:s,...u}=t,r[0]=t,r[1]=o,r[2]=s,r[3]=l,r[4]=u,r[5]=d);let p=d!==void 0&&d,h=f(a),g=p?i:`div`,_;r[6]===l?_=r[7]:(_=n(l,`radio-group-item-content`),r[6]=l,r[7]=_);let v=h.disabled&&`opacity-50`,y;r[8]!==s||r[9]!==v?(y=e(`min-w-0 flex-1`,v,s),r[8]=s,r[9]=v,r[10]=y):y=r[10];let b;return r[11]!==g||r[12]!==o||r[13]!==u||r[14]!==_||r[15]!==y?(b=/* @__PURE__ */ m(g,{"data-slot":_,className:y,...u,children:o}),r[11]=g,r[12]=o,r[13]=u,r[14]=_,r[15]=y,r[16]=b):b=r[16],b},List:t=>{let r=c(14),i,a,o,s;r[0]===t?(i=r[1],a=r[2],o=r[3],s=r[4]):({"data-slot":a,className:i,ref:s,...o}=t,r[0]=t,r[1]=i,r[2]=a,r[3]=o,r[4]=s);let l;r[5]===a?l=r[6]:(l=n(a,`radio-group-list`),r[5]=a,r[6]=l);let u;r[7]===i?u=r[8]:(u=e(`border-form flex flex-col gap-px rounded-[0.6875rem] border p-1`,i),r[7]=i,r[8]=u);let d;return r[9]!==o||r[10]!==s||r[11]!==l||r[12]!==u?(d=/* @__PURE__ */ m(h,{"data-slot":l,className:u,...o,ref:s}),r[9]=o,r[10]=s,r[11]=l,r[12]=u,r[13]=d):d=r[13],d},ListItem:e=>{let r=c(18),i,a,o,l,u,d;r[0]===e?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],d=r[6]):({"data-slot":o,as:d,children:i,className:a,ref:u,...l}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u,r[6]=d);let f;r[7]===o?f=r[8]:(f=n(o,`radio-group-list-item`),r[7]=o,r[8]=f);let p;r[9]===a?p=r[10]:(p=t(`group/radio [&_label]:cursor-inherit relative flex select-none gap-2 rounded-md px-3 py-2 text-sm`,`cursor-pointer aria-disabled:cursor-default focus:outline-hidden`,`focus-visible:ring-focus-accent focus-visible:z-1 focus-visible:ring-4`,`not-aria-disabled:hover:bg-active-menu-item`,`aria-checked:bg-selected-menu-item not-aria-disabled:hover:aria-checked:bg-active-selected-menu-item`,`has-[.radio-indicator:first-child]:pl-2 has-[.radio-indicator:last-child]:pr-2`,a),r[9]=a,r[10]=p);let h;return r[11]!==i||r[12]!==l||r[13]!==u||r[14]!==f||r[15]!==p||r[16]!==d?(h=/* @__PURE__ */ m(s,{"data-slot":f,className:p,...l,as:d,ref:u,children:i}),r[11]=i,r[12]=l,r[13]=u,r[14]=f,r[15]=p,r[16]=d,r[17]=h):h=r[17],h},Root:h};export{v as RadioGroup};
|
package/dist/sandbar.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Sandbar component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/feedback/sandbar
|
|
5
|
+
*/
|
|
1
6
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
3
|
-
import { r as ButtonProps } from "./button-
|
|
7
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
8
|
+
import { r as ButtonProps } from "./button-Ddj6yr10.js";
|
|
4
9
|
import { ComponentProps, ReactNode, Ref } from "react";
|
|
5
10
|
/**
|
|
6
11
|
* The imperative surface of a {@link Sandbar}, exposed via `Sandbar.Root`'s
|
|
7
|
-
* `handleRef` prop. `shake()` is a compound feedback action
|
|
12
|
+
* `handleRef` prop. `shake()` is a compound feedback action: it wiggles the
|
|
8
13
|
* panel (skipped under `prefers-reduced-motion`) and always pushes an
|
|
9
14
|
* assertive live-region announcement, so blocked navigation is perceivable
|
|
10
15
|
* with or without motion.
|
|
@@ -15,7 +20,7 @@ import { ComponentProps, ReactNode, Ref } from "react";
|
|
|
15
20
|
* ```tsx
|
|
16
21
|
* const sandbarHandle = useRef<SandbarHandle>(null);
|
|
17
22
|
*
|
|
18
|
-
* // hand this to your router's guard
|
|
23
|
+
* // hand this to your router's guard; it owns the blocking, and the bar reacts
|
|
19
24
|
* const onNavigationBlocked = () => sandbarHandle.current?.shake();
|
|
20
25
|
*
|
|
21
26
|
* <Sandbar.Root open={isDirty} handleRef={sandbarHandle}>
|
|
@@ -40,8 +45,8 @@ type SandbarHandle = {
|
|
|
40
45
|
}) => void;
|
|
41
46
|
};
|
|
42
47
|
/**
|
|
43
|
-
* Props for `Sandbar.Root`. Extends `<div>` props
|
|
44
|
-
* panel, not the fixed-position wrapper
|
|
48
|
+
* Props for `Sandbar.Root`. Extends `<div>` props (which target the visible
|
|
49
|
+
* panel, not the fixed-position wrapper) with the controlled `open` flag and
|
|
45
50
|
* the imperative `handleRef`. Deliberately no `asChild`: Root renders four
|
|
46
51
|
* nodes, so single-child polymorphism has no coherent meaning.
|
|
47
52
|
*
|
|
@@ -60,7 +65,7 @@ type SandbarHandle = {
|
|
|
60
65
|
*/
|
|
61
66
|
type SandbarRootProps = ComponentProps<"div"> & WithDataSlot & {
|
|
62
67
|
/**
|
|
63
|
-
* Whether the sandbar is showing. Controlled-only
|
|
68
|
+
* Whether the sandbar is showing. Controlled-only: the pending state
|
|
64
69
|
* (e.g. a form's dirty flag) lives in your app, not in the component.
|
|
65
70
|
*
|
|
66
71
|
* `Sandbar.Root` must stay mounted and be toggled with `open`, never
|
|
@@ -73,20 +78,20 @@ type SandbarRootProps = ComponentProps<"div"> & WithDataSlot & {
|
|
|
73
78
|
open: boolean;
|
|
74
79
|
/**
|
|
75
80
|
* Receives the imperative {@link SandbarHandle}. Kept separate from `ref`
|
|
76
|
-
* (which stays the panel's DOM element, like every other mantle part)
|
|
77
|
-
*
|
|
81
|
+
* (which stays the panel's DOM element, like every other mantle part).
|
|
82
|
+
* Wire it to your navigation guard's blocked callback.
|
|
78
83
|
*/
|
|
79
84
|
handleRef?: Ref<SandbarHandle>;
|
|
80
85
|
};
|
|
81
86
|
/**
|
|
82
87
|
* The always-mounted shell of the sandbar. Renders a private viewport-fixed
|
|
83
88
|
* wrapper, two persistent visually-hidden live regions (a polite `status`
|
|
84
|
-
* announcer and an assertive `alert` announcer), and the visible panel
|
|
89
|
+
* announcer and an assertive `alert` announcer), and the visible panel: a
|
|
85
90
|
* floating island with `role="group"`, named by `Sandbar.Message` via
|
|
86
91
|
* `aria-labelledby` (a consumer `aria-label` wins when passed).
|
|
87
92
|
*
|
|
88
93
|
* The panel is an `invert-theme` island: it renders in the opposite theme of
|
|
89
|
-
* the page (light ⇄ dark), and so does everything composed inside it
|
|
94
|
+
* the page (light ⇄ dark), and so does everything composed inside it: the
|
|
90
95
|
* blessed buttons and any custom children.
|
|
91
96
|
*
|
|
92
97
|
* The bar renders at Tailwind `z-70`, above Mantle's overlay tier (`z-60`), so
|
|
@@ -96,16 +101,16 @@ type SandbarRootProps = ComponentProps<"div"> & WithDataSlot & {
|
|
|
96
101
|
* form inside an overlay keeps its save actions in the overlay.
|
|
97
102
|
*
|
|
98
103
|
* `ref`, `className`, and all other props target the panel. Render it in
|
|
99
|
-
* place at the end of the form it saves
|
|
104
|
+
* place at the end of the form it saves. `position: fixed` changes paint
|
|
100
105
|
* position, not tab order, so Tab from the last field lands on the actions.
|
|
101
106
|
* Escape is intentionally inert (a one-keypress discard would destroy data).
|
|
102
107
|
*
|
|
103
108
|
* Data attributes stamped on the panel:
|
|
104
109
|
*
|
|
105
|
-
* | Data Attribute | Value | Description
|
|
106
|
-
* | -------------- | ---------------------- |
|
|
107
|
-
* | `data-slot` | `"sandbar"` | Stable styling hook for the panel. Survives `className` overrides.
|
|
108
|
-
* | `data-state` | `"open"` \| `"closed"` | `"open"` only at the resting open pose
|
|
110
|
+
* | Data Attribute | Value | Description |
|
|
111
|
+
* | -------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
112
|
+
* | `data-slot` | `"sandbar"` | Stable styling hook for the panel. Survives `className` overrides. |
|
|
113
|
+
* | `data-state` | `"open"` \| `"closed"` | `"open"` only at the resting open pose. `"closed"` covers both the pre-enter frame and the exit transition, which is what drives the slide/fade. |
|
|
109
114
|
*
|
|
110
115
|
* @see https://mantle.ngrok.com/components/feedback/sandbar#sandbarroot
|
|
111
116
|
*
|
|
@@ -123,7 +128,7 @@ type SandbarRootProps = ComponentProps<"div"> & WithDataSlot & {
|
|
|
123
128
|
declare const Root: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, children, className, "data-slot": dataSlot, handleRef, onTransitionEnd, open, ref, ...props }: SandbarRootProps) => import("react").JSX.Element;
|
|
124
129
|
/**
|
|
125
130
|
* Props for `Sandbar.Message`. Extends `<p>` props with `asChild`. An `id` is
|
|
126
|
-
* generated when none is passed
|
|
131
|
+
* generated when none is passed. It is what `Sandbar.Root` points
|
|
127
132
|
* `aria-labelledby` at, so passing your own keeps that wiring intact.
|
|
128
133
|
*
|
|
129
134
|
* @see https://mantle.ngrok.com/components/feedback/sandbar#sandbarmessage
|
|
@@ -184,7 +189,7 @@ declare const Message: ({ asChild, className, "data-slot": dataSlot, id: propId,
|
|
|
184
189
|
*/
|
|
185
190
|
type SandbarActionsProps = ComponentProps<"div"> & WithAsChild & WithDataSlot;
|
|
186
191
|
/**
|
|
187
|
-
* The action-button row. A plain flex container
|
|
192
|
+
* The action-button row. A plain flex container, deliberately not
|
|
188
193
|
* `role="toolbar"`, which the ARIA APG reserves for 3+ controls with roving
|
|
189
194
|
* tab stops.
|
|
190
195
|
*
|
|
@@ -209,8 +214,8 @@ type SandbarActionsProps = ComponentProps<"div"> & WithAsChild & WithDataSlot;
|
|
|
209
214
|
*/
|
|
210
215
|
declare const Actions: ({ asChild, className, "data-slot": dataSlot, ...props }: SandbarActionsProps) => import("react").JSX.Element;
|
|
211
216
|
/**
|
|
212
|
-
* Props for `Sandbar.SaveButton`. Extends `Button`'s props
|
|
213
|
-
* `asChild` and `isLoading`
|
|
217
|
+
* Props for `Sandbar.SaveButton`. Extends `Button`'s props (including
|
|
218
|
+
* `asChild` and `isLoading`) but makes `appearance` and `intent` optional
|
|
214
219
|
* with save-flavored defaults, and `children` required.
|
|
215
220
|
*
|
|
216
221
|
* @see https://mantle.ngrok.com/components/feedback/sandbar#sandbarsavebutton
|
|
@@ -238,7 +243,7 @@ type SandbarSaveButtonProps = Omit<ButtonProps, "appearance" | "children" | "int
|
|
|
238
243
|
*/
|
|
239
244
|
intent?: ButtonProps["intent"];
|
|
240
245
|
/**
|
|
241
|
-
* The visible action label (e.g. "Save"). Required
|
|
246
|
+
* The visible action label (e.g. "Save"). Required. Action labels are app
|
|
242
247
|
* voice and must be visible at the call site.
|
|
243
248
|
*/
|
|
244
249
|
children: ReactNode;
|
|
@@ -252,7 +257,7 @@ type SandbarSaveButtonProps = Omit<ButtonProps, "appearance" | "children" | "int
|
|
|
252
257
|
*
|
|
253
258
|
* Defaults to `type="button"`; pass `type="submit"` when rendered inside the
|
|
254
259
|
* form it saves. Announce the save's resolution yourself (e.g. a success
|
|
255
|
-
* Toast)
|
|
260
|
+
* Toast). The bar exits silently.
|
|
256
261
|
*
|
|
257
262
|
* Data attributes:
|
|
258
263
|
*
|
|
@@ -280,8 +285,8 @@ type SandbarSaveButtonProps = Omit<ButtonProps, "appearance" | "children" | "int
|
|
|
280
285
|
*/
|
|
281
286
|
declare const SaveButton: ({ appearance, children, "data-slot": dataSlot, intent, isLoading, ref, ...props }: SandbarSaveButtonProps) => import("react").JSX.Element;
|
|
282
287
|
/**
|
|
283
|
-
* Props for `Sandbar.DiscardButton`. Extends `Button`'s props
|
|
284
|
-
* `asChild`
|
|
288
|
+
* Props for `Sandbar.DiscardButton`. Extends `Button`'s props (including
|
|
289
|
+
* `asChild`) but makes `appearance` and `intent` optional with
|
|
285
290
|
* secondary-action defaults, and `children` required.
|
|
286
291
|
*
|
|
287
292
|
* @see https://mantle.ngrok.com/components/feedback/sandbar#sandbardiscardbutton
|
|
@@ -309,7 +314,7 @@ type SandbarDiscardButtonProps = Omit<ButtonProps, "appearance" | "children" | "
|
|
|
309
314
|
*/
|
|
310
315
|
intent?: ButtonProps["intent"];
|
|
311
316
|
/**
|
|
312
|
-
* The visible action label (e.g. "Discard"). Required
|
|
317
|
+
* The visible action label (e.g. "Discard"). Required. Action labels are
|
|
313
318
|
* app voice and must be visible at the call site.
|
|
314
319
|
*/
|
|
315
320
|
children: ReactNode;
|
|
@@ -346,16 +351,24 @@ type SandbarDiscardButtonProps = Omit<ButtonProps, "appearance" | "children" | "
|
|
|
346
351
|
declare const DiscardButton: ({ appearance, children, "data-slot": dataSlot, intent, ...props }: SandbarDiscardButtonProps) => import("react").JSX.Element;
|
|
347
352
|
/**
|
|
348
353
|
* A persistent, decision-bearing bar that floats near the bottom edge of the
|
|
349
|
-
* viewport. It surfaces pending state
|
|
350
|
-
* changes
|
|
354
|
+
* viewport. It surfaces pending state (primarily a form's unsaved ("dirty")
|
|
355
|
+
* changes) and stays until the user resolves it. Toast announces something
|
|
351
356
|
* that already happened and leaves on its own; a Sandbar waits for the user's
|
|
352
357
|
* decision. When the message needs no decision, reach for Toast or Alert.
|
|
353
358
|
*
|
|
354
|
-
* The name: a sandbar is a bar that blocks navigation
|
|
359
|
+
* The name: a sandbar is a bar that blocks navigation, exactly what this
|
|
355
360
|
* component does while changes are pending. Pair it with your app's
|
|
356
361
|
* navigation guard and call `shake()` on the {@link SandbarHandle} when a
|
|
357
362
|
* navigation attempt is blocked.
|
|
358
363
|
*
|
|
364
|
+
* @useWhen Hold the unsaved changes of a form in a bar at the bottom of the page until the user
|
|
365
|
+
* saves or discards them.
|
|
366
|
+
*
|
|
367
|
+
* @siblings
|
|
368
|
+
* - `Toast`: the message reports something that already happened and goes away on its own.
|
|
369
|
+
* - `Alert`: the message needs no decision and stays in the page.
|
|
370
|
+
* - `AlertDialog`: one destructive action needs a confirmation before it runs.
|
|
371
|
+
*
|
|
359
372
|
* @see https://mantle.ngrok.com/components/feedback/sandbar
|
|
360
373
|
*
|
|
361
374
|
* @example
|
|
@@ -383,7 +396,7 @@ declare const Sandbar: {
|
|
|
383
396
|
/**
|
|
384
397
|
* The always-mounted shell: fixed positioning, persistent live-region
|
|
385
398
|
* announcers, presence-managed panel. Toggle with the controlled `open`
|
|
386
|
-
* prop
|
|
399
|
+
* prop; never conditionally mount it.
|
|
387
400
|
*
|
|
388
401
|
* @see https://mantle.ngrok.com/components/feedback/sandbar#sandbarroot
|
|
389
402
|
*
|
|
@@ -436,7 +449,7 @@ declare const Sandbar: {
|
|
|
436
449
|
*/
|
|
437
450
|
readonly Actions: typeof Actions;
|
|
438
451
|
/**
|
|
439
|
-
* The primary (save) action
|
|
452
|
+
* The primary (save) action. It announces "Saving changes…" and keeps focus
|
|
440
453
|
* from being lost while the save is pending.
|
|
441
454
|
*
|
|
442
455
|
* @see https://mantle.ngrok.com/components/feedback/sandbar#sandbarsavebutton
|
package/dist/sandbar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-isomorphic-layout-effect-
|
|
1
|
+
"use client";import{t as e}from"./use-isomorphic-layout-effect-CL6iq0Bj.js";import{t}from"./use-composed-refs-DPYmLDSe.js";import{t as n}from"./alternate-announcement-BkH4bOKp.js";import{t as r}from"./cx-CK7o_rVv.js";import{t as i}from"./data-slot-EM6s2WEU.js";import{t as a}from"./layer-container-DL4yclOu.js";import{t as o}from"./shake-CAUpKBHe.js";import{t as s}from"./button-DNLTJ32M.js";import{t as c}from"./slot-B7rwscwd.js";import{c as l}from"react/compiler-runtime";import{createContext as u,useContext as d,useEffect as f,useId as p,useImperativeHandle as m,useRef as h,useState as g}from"react";import _ from"tiny-invariant";import{jsx as v,jsxs as y}from"react/jsx-runtime";const b=`Unsaved changes`,x=1e3,S=u(null);function C(e){let t=d(S);return _(t,`${e} must be rendered as a child of <Sandbar.Root>.`),t}function w({current:e,open:t}){return t?e===`open`||e===`opening`?e:e===`closing`?`open`:`opening`:e===`closed`?e:e===`opening`?`closed`:`closing`}const T={Root:e=>{let s=l(65),c,u,d,p,_,C,T,O,k,ee;s[0]===e?(c=s[1],u=s[2],d=s[3],p=s[4],_=s[5],C=s[6],T=s[7],O=s[8],k=s[9],ee=s[10]):({"aria-label":c,"aria-labelledby":u,children:d,className:p,"data-slot":_,handleRef:C,onTransitionEnd:T,open:O,ref:ee,...k}=e,s[0]=e,s[1]=c,s[2]=u,s[3]=d,s[4]=p,s[5]=_,s[6]=C,s[7]=T,s[8]=O,s[9]=k,s[10]=ee);let[A,j]=g(O?`open`:`closed`),[te,ne]=g(``),[re,ie]=g(``),[ae,oe]=g(null),se=h(null),M=h(null),ce=t(M,ee),N=h(void 0),le=h(void 0),P=h(void 0),ue=h(!1),de=h(!1),fe=h(!1),pe=h(null),F=h(null),me=h(O),he=h(A),I;s[11]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>{ne(n(e,ue)),window.clearTimeout(N.current),N.current=window.setTimeout(()=>{ne(``)},x)},s[11]=I):I=s[11];let ge=I,L;s[12]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{ie(n(e,de)),window.clearTimeout(le.current),le.current=window.setTimeout(()=>{ie(``)},x)},s[12]=L):L=s[12];let _e=L,R;s[13]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>(oe(e),()=>{oe(t=>t===e?null:t)}),s[13]=R):R=s[13];let ve=R,z;s[14]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{let{button:t,isSaving:n}=e,r=fe.current;if(fe.current=n,!n||r||(ge(`Saving changes…`),t==null||!t.matches(`:disabled`)))return;let i=document.activeElement,a=i===t,o=i===document.body&&F.current===t;(a||o)&&M.current?.focus({preventScroll:!0})},s[14]=z):z=s[14];let ye=z,B;s[15]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{_e(e?.announcement??`You have unsaved changes. Save or discard them before leaving.`),M.current!=null&&o(M.current)},s[15]=B):B=s[15];let be=B,V,H;s[16]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>({shake:be}),H=[be],s[16]=V,s[17]=H):(V=s[16],H=s[17]),m(C,V,H);let U;s[18]===Symbol.for(`react.memo_cache_sentinel`)?(U={announceAssertive:_e,registerMessage:ve,reportSaving:ye},s[18]=U):U=s[18];let xe=U,W;s[19]!==O||s[20]!==A?(W=w({current:A,open:O}),s[19]=O,s[20]=A,s[21]=W):W=s[21];let Se=W;Se!==A&&j(Se);let G,K;s[22]===A?(G=s[23],K=s[24]):(G=()=>{if(A!==`opening`)return;let e=window.requestAnimationFrame(()=>{e=window.requestAnimationFrame(()=>{j(E)})});return()=>{window.cancelAnimationFrame(e)}},K=[A],s[22]=A,s[23]=G,s[24]=K),f(G,K);let q,Ce;s[25]===A?(q=s[26],Ce=s[27]):(q=()=>{if(A!==`closing`)return;let e=window.setTimeout(()=>{j(`closed`)},400);return()=>{window.clearTimeout(e)}},Ce=[A],s[25]=A,s[26]=q,s[27]=Ce),f(q,Ce);let we,Te;s[28]!==c||s[29]!==O?(we=()=>{let e=me.current;if(me.current=O,!O){e&&(window.clearTimeout(N.current),ne(``));return}if(e)return;let t=(M.current?.querySelector(`[data-slot~="sandbar-message"]`))?.textContent?.trim();ge(t||c||b)},Te=[ge,c,O],s[28]=c,s[29]=O,s[30]=we,s[31]=Te):(we=s[30],Te=s[31]),f(we,Te);let Ee,De;s[32]===A?(Ee=s[33],De=s[34]):(Ee=()=>{let e=he.current;if(he.current=A,A!==`closed`||e!==`closing`)return;let t=se.current,n=document.activeElement,r=t!=null&&n instanceof HTMLElement&&t.contains(n),i=n===document.body&&F.current!=null,a=pe.current;pe.current=null,F.current=null,(r||i)&&a!=null&&a.isConnected&&!a.matches(`:disabled`)&&(typeof a.checkVisibility!=`function`||a.checkVisibility())&&a.focus()},De=[A],s[32]=A,s[33]=Ee,s[34]=De),f(Ee,De);let Oe,ke;s[35]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=()=>()=>{window.clearTimeout(N.current),window.clearTimeout(le.current),P.current!=null&&window.cancelAnimationFrame(P.current)},ke=[],s[35]=Oe,s[36]=ke):(Oe=s[35],ke=s[36]),f(Oe,ke);let Ae;s[37]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=e=>{let t=se.current,n=e.relatedTarget;t!=null&&(n==null||!t.contains(n))&&n instanceof HTMLElement&&(pe.current=n),e.target instanceof HTMLElement&&(F.current=e.target)},s[37]=Ae):Ae=s[37];let je=Ae,Me;s[38]===Symbol.for(`react.memo_cache_sentinel`)?(Me=e=>{if(e.relatedTarget!=null){let t=se.current;t!=null&&t.contains(e.relatedTarget)||(F.current=null);return}let t=e.target;t instanceof HTMLElement&&(P.current!=null&&window.cancelAnimationFrame(P.current),P.current=window.requestAnimationFrame(()=>{P.current=void 0;let e=M.current;e==null||e.hidden||(!t.isConnected||t.matches(`:disabled`)||t.hidden)&&document.activeElement===document.body&&e.focus({preventScroll:!0})}))},s[38]=Me):Me=s[38];let Ne=Me,Pe;s[39]===T?Pe=s[40]:(Pe=e=>{T?.(e),e.target===e.currentTarget&&(e.propertyName===`opacity`||e.propertyName===`translate`)&&j(D)},s[39]=T,s[40]=Pe);let Fe=Pe,Ie=u??(c==null&&ae!=null?ae:void 0),Le=Ie==null?c??b:c,Re=A===`closed`,ze=Re||A===`closing`,J;s[41]===te?J=s[42]:(J=/* @__PURE__ */ v(`div`,{"aria-atomic":`true`,"aria-live":`polite`,className:`sr-only`,role:`status`,children:te}),s[41]=te,s[42]=J);let Y;s[43]===re?Y=s[44]:(Y=/* @__PURE__ */ v(`div`,{className:`sr-only`,role:`alert`,children:re}),s[43]=re,s[44]=Y);let X;s[45]===p?X=s[46]:(X=r(`invert-theme pointer-events-auto flex w-fit max-w-full flex-wrap items-center justify-center gap-x-4 gap-y-2 rounded-2xl border border-transparent bg-base px-4 py-3 text-strong shadow-lg`,`max-h-[60svh] overflow-y-auto`,`focus:outline-hidden`,`[[hidden]]:hidden`,`motion-safe:data-shake:animate-shake`,`transition-[opacity,translate] duration-200 ease-out-strong`,`data-state-closed:pointer-events-none data-state-closed:opacity-0 data-state-closed:duration-150 motion-safe:data-state-closed:translate-y-[calc(100%+2.5rem)]`,p),s[45]=p,s[46]=X);let Z;s[47]===_?Z=s[48]:(Z=i(_,`sandbar`),s[47]=_,s[48]=Z);let Be=A===`open`?`open`:`closed`,Ve=Re?!0:void 0,He=ze?!0:void 0,Q;s[49]!==d||s[50]!==ce||s[51]!==Fe||s[52]!==Le||s[53]!==Ie||s[54]!==k||s[55]!==X||s[56]!==Z||s[57]!==Be||s[58]!==Ve||s[59]!==He?(Q=/* @__PURE__ */ v(`div`,{className:X,...k,"aria-label":Le,"aria-labelledby":Ie,"data-slot":Z,"data-state":Be,hidden:Ve,inert:He,onTransitionEnd:Fe,ref:ce,role:`group`,tabIndex:-1,children:d}),s[49]=d,s[50]=ce,s[51]=Fe,s[52]=Le,s[53]=Ie,s[54]=k,s[55]=X,s[56]=Z,s[57]=Be,s[58]=Ve,s[59]=He,s[60]=Q):Q=s[60];let $;return s[61]!==J||s[62]!==Y||s[63]!==Q?($=/* @__PURE__ */ v(S.Provider,{value:xe,children:/* @__PURE__ */ y(a,{className:`overlay-prompt pointer-events-none fixed inset-x-0 bottom-4 z-70 flex justify-center px-4 *:pointer-events-auto sm:bottom-10`,modal:!1,onBlur:Ne,onFocus:je,ref:se,children:[J,Y,Q]})}),s[61]=J,s[62]=Y,s[63]=Q,s[64]=$):$=s[64],$},Message:n=>{let a=l(22),o,s,u,d,f,m;a[0]===n?(o=a[1],s=a[2],u=a[3],d=a[4],f=a[5],m=a[6]):({asChild:o,className:s,"data-slot":u,id:d,ref:m,...f}=n,a[0]=n,a[1]=o,a[2]=s,a[3]=u,a[4]=d,a[5]=f,a[6]=m);let{registerMessage:g}=C(`Sandbar.Message`),_=p(),y=d??_,b=h(null),x=t(b,m),S,w;a[7]!==y||a[8]!==g?(S=()=>g(b.current?.id||y),w=[y,g],a[7]=y,a[8]=g,a[9]=S,a[10]=w):(S=a[9],w=a[10]),e(S,w);let T=o?c:`p`,E;a[11]===s?E=a[12]:(E=r(`text-sm font-sans`,s),a[11]=s,a[12]=E);let D;a[13]===u?D=a[14]:(D=i(u,`sandbar-message`),a[13]=u,a[14]=D);let O;return a[15]!==T||a[16]!==x||a[17]!==y||a[18]!==f||a[19]!==E||a[20]!==D?(O=/* @__PURE__ */ v(T,{className:E,id:y,...f,"data-slot":D,ref:x}),a[15]=T,a[16]=x,a[17]=y,a[18]=f,a[19]=E,a[20]=D,a[21]=O):O=a[21],O},Actions:e=>{let t=l(14),n,a,o,s;t[0]===e?(n=t[1],a=t[2],o=t[3],s=t[4]):({asChild:n,className:a,"data-slot":o,...s}=e,t[0]=e,t[1]=n,t[2]=a,t[3]=o,t[4]=s);let u=n?c:`div`,d;t[5]===a?d=t[6]:(d=r(`flex flex-wrap items-center justify-center gap-2`,a),t[5]=a,t[6]=d);let f;t[7]===o?f=t[8]:(f=i(o,`sandbar-actions`),t[7]=o,t[8]=f);let p;return t[9]!==u||t[10]!==s||t[11]!==d||t[12]!==f?(p=/* @__PURE__ */ v(u,{className:d,...s,"data-slot":f}),t[9]=u,t[10]=s,t[11]=d,t[12]=f,t[13]=p):p=t[13],p},SaveButton:n=>{let r=l(25),a,o,c,u,d,f,p;r[0]===n?(a=r[1],o=r[2],c=r[3],u=r[4],d=r[5],f=r[6],p=r[7]):({appearance:d,children:a,"data-slot":o,intent:f,isLoading:p,ref:u,...c}=n,r[0]=n,r[1]=a,r[2]=o,r[3]=c,r[4]=u,r[5]=d,r[6]=f,r[7]=p);let m=d===void 0?`filled`:d,g=f===void 0?`neutral`:f,_=p!==void 0&&p,{reportSaving:y}=C(`Sandbar.SaveButton`),b=h(null),x=t(b,u),S,w;r[8]!==_||r[9]!==y?(S=()=>{y({button:b.current,isSaving:_})},w=[_,y],r[8]=_,r[9]=y,r[10]=S,r[11]=w):(S=r[10],w=r[11]),e(S,w);let T,E;r[12]===y?(T=r[13],E=r[14]):(T=()=>()=>{y({button:null,isSaving:!1})},E=[y],r[12]=y,r[13]=T,r[14]=E),e(T,E);let D;r[15]===o?D=r[16]:(D=i(o,`sandbar-save-button`),r[15]=o,r[16]=D);let O;return r[17]!==m||r[18]!==a||r[19]!==x||r[20]!==g||r[21]!==_||r[22]!==c||r[23]!==D?(O=/* @__PURE__ */ v(s,{appearance:m,intent:g,isLoading:_,ref:x,...c,"data-slot":D,children:a}),r[17]=m,r[18]=a,r[19]=x,r[20]=g,r[21]=_,r[22]=c,r[23]=D,r[24]=O):O=r[24],O},DiscardButton:e=>{let t=l(14),n,r,a,o,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],c=t[5]):({appearance:o,children:n,"data-slot":r,intent:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=c);let u=o===void 0?`outlined`:o,d=c===void 0?`neutral`:c,f;t[6]===r?f=t[7]:(f=i(r,`sandbar-discard-button`),t[6]=r,t[7]=f);let p;return t[8]!==u||t[9]!==n||t[10]!==d||t[11]!==a||t[12]!==f?(p=/* @__PURE__ */ v(s,{appearance:u,intent:d,...a,"data-slot":f,children:n}),t[8]=u,t[9]=n,t[10]=d,t[11]=a,t[12]=f,t[13]=p):p=t[13],p}};function E(e){return e===`opening`?`open`:e}function D(e){return e===`closing`?`closed`:e}export{T as Sandbar};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{t as e}from"./slot-B7rwscwd.js";import{c as t}from"react/compiler-runtime";import{jsx as n}from"react/jsx-runtime";const r=({allowClickEventDefault:e=!1,onClick:t}={})=>({role:`presentation`,onClick:n=>{n.stopPropagation(),e||n.preventDefault(),t?.(n)}}),i=i=>{let a=t(23),o,s,c,l,u,d;a[0]===i?(o=a[1],s=a[2],c=a[3],l=a[4],u=a[5],d=a[6]):({allowClickEventDefault:u,asChild:d,children:o,onClick:s,ref:l,...c}=i,a[0]=i,a[1]=o,a[2]=s,a[3]=c,a[4]=l,a[5]=u,a[6]=d);let f=u!==void 0&&u,p=d!==void 0&&d,m=p?e:`div`,h;a[7]!==f||a[8]!==s?(h=r({allowClickEventDefault:f,onClick:s}),a[7]=f,a[8]=s,a[9]=h):h=a[9];let g,_;a[10]===h?(g=a[11],_=a[12]):({role:g,..._}=h,a[10]=h,a[11]=g,a[12]=_);let v;a[13]!==p||a[14]!==g?(v=!p&&{role:g},a[13]=p,a[14]=g,a[15]=v):v=a[15];let y;return a[16]!==m||a[17]!==o||a[18]!==c||a[19]!==l||a[20]!==_||a[21]!==v?(y=/* @__PURE__ */ n(m,{ref:l,...c,..._,...v,children:o}),a[16]=m,a[17]=o,a[18]=c,a[19]=l,a[20]=_,a[21]=v,a[22]=y):y=a[22],y};export{r as n,i as t};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the SandboxedOnClick component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/primitives/sandboxed-on-click
|
|
5
|
+
*/
|
|
1
6
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
7
|
import { ComponentProps, MouseEventHandler } from "react";
|
|
3
8
|
type BaseProps = {
|
|
@@ -48,6 +53,9 @@ type Props = ComponentProps<"div"> & WithAsChild & BaseProps;
|
|
|
48
53
|
* only the sandboxed `onClick`: a presentational role on a link or button is a
|
|
49
54
|
* conflict that user agents ignore.
|
|
50
55
|
*
|
|
56
|
+
* @useWhen Stop a click inside a region, such as a menu in a clickable table row, from reaching a
|
|
57
|
+
* click handler on an ancestor.
|
|
58
|
+
*
|
|
51
59
|
* @see https://mantle.ngrok.com/components/primitives/sandboxed-on-click
|
|
52
60
|
*
|
|
53
61
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as SandboxedOnClick,n as sandboxedOnClickProps}from"./sandboxed-on-click-
|
|
1
|
+
export{t as SandboxedOnClick,n as sandboxedOnClickProps}from"./sandboxed-on-click-D4PL5_GR.js";
|