@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
package/dist/alert-center.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-isomorphic-layout-effect-CLSmHzo4.js";import{n as t}from"./compose-refs-sFdxsL7k.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{n as i,t as a}from"./alert-P9lwn25X.js";import{c as o}from"react/compiler-runtime";import{createContext as s,useContext as c,useEffect as l,useId as u,useReducer as d,useRef as f,useState as p,useSyncExternalStore as m}from"react";import h from"tiny-invariant";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{createPortal as v}from"react-dom";const y={danger:5,warning:4,important:3,info:2,success:1};function b(e,t){if(t.parentElement===e)return!1;if(typeof e.moveBefore==`function`&&t.isConnected&&e.isConnected)try{return e.moveBefore(t,null),!0}catch{}return e.appendChild(t),!0}function x(e){return e.replace(/\s+/g,` `).trim()}function S(e){let t=e.querySelector(`[data-slot~="alert-title"]`);if(t==null)return``;let n=t.cloneNode(!0);if(!(n instanceof Element))return x(t.textContent??``);for(let e of n.querySelectorAll(`button`))e.remove();let r=x(n.textContent??``);for(let e of n.querySelectorAll(`a`))e.remove();let i=x(n.textContent??``);return i===``?r:i}function C(e){return e.toSorted((e,t)=>y[t.intent]-y[e.intent]||w(e.order,t.order)||e.sequence-t.sequence)}function w(e,t){return e===t?0:e==null?1:t==null||e<t?-1:1}function T(e,t){if(t===0)return``;if(e===``)return`${t} alert${t===1?``:`s`}`;let n=t-1;return n===0?e:`${e}, and ${n} more alert${n===1?``:`s`}`}const E=[];var D=class{#e=/* @__PURE__ */ new Set;#t=/* @__PURE__ */ new Map;#n=/* @__PURE__ */ new Map;#r=/* @__PURE__ */ new Map;#i=0;#a=E;#o=``;#s=!1;getHost(e){let t=this.#r.get(e);if(t!=null)return t;let n=document.createElement(`div`);return n.style.display=`contents`,n.setAttribute(`data-slot`,`alert-center-item-host`),n.setAttribute(`data-alert-host`,e),this.#r.set(e,n),n}#c=null;captureHostSnapshot(e){if(e!==this.#a[0]?.id)return;let t=this.#r.get(e);t!=null&&t.firstElementChild?.hasChildNodes()===!0&&(this.#c={id:e,content:t.cloneNode(!0)})}getHostSnapshot=e=>this.#c?.id===e?this.#c.content:null;subscribe=e=>(this.#e.add(e),()=>{this.#e.delete(e)});getSnapshot=()=>this.#a;hasAlert=e=>this.#t.has(e);getTopLabel=()=>this.#o;setTopLabel(e){this.#o!==e&&(this.#o=e,this.#p())}#l=null;requestFocusRestore(e){this.#l=e}flushFocusRestore(){let e=this.#l;e!=null&&e.isConnected&&(this.#l=null,document.activeElement!==e&&e.focus({preventScroll:!0}))}#u=null;#d=0;getPlacementVersion=()=>this.#d;notifyPlacementChange(){this.#d++,this.#p()}setBarElement(e){this.#u=e}getBarElement=()=>this.#u;getContentMounted=()=>this.#s;setContentMounted(e){this.#s!==e&&(this.#s=e,this.#p())}register(e){h(!this.#t.has(e.id),`AlertCenter.Item id "${e.id}" is already registered by another mounted item — ids must be unique under one <AlertCenter.Root>. Render one item per id, or give each alert its own id.`);let t=this.#n.get(e.id)??this.#i++;this.#n.set(e.id,t);let n={...e,sequence:t};return this.#t.set(e.id,n),this.#f(),()=>{this.#t.get(e.id)===n&&(this.#t.delete(e.id),this.#f())}}#f(){this.#a=C([...this.#t.values()]),this.#p()}#p(){for(let e of this.#e)e()}};const O=s(null),k=s(null);function A(e){let t=c(O);return h(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}function ee(e){let t=c(k);return h(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}const te=e=>m(e.subscribe,e.getSnapshot,e.getSnapshot),j=s(!1);function M(e){let t=o(5),{store:n}=e,r=te(n),i=m(n.subscribe,n.getTopLabel,n.getTopLabel),a;t[0]!==r.length||t[1]!==i?(a=T(i,r.length),t[0]=r.length,t[1]=i,t[2]=a):a=t[2];let s;return t[3]===a?s=t[4]:(s=/* @__PURE__ */ g(`div`,{"data-slot":`alert-center-announcer`,className:`sr-only`,role:`status`,"aria-live":`polite`,children:a}),t[3]=a,t[4]=s),s}const N=e=>{let t=o(18),{children:n,defaultOpen:r,onOpenChange:i,open:a}=e,[s]=p(U),c=u(),[l,d]=p(r??!1),f=a??l,m;t[0]!==i||t[1]!==a?(m=e=>{a??d(e),i?.(e)},t[0]=i,t[1]=a,t[2]=m):m=t[2];let h=m,v;t[3]!==c||t[4]!==s?(v={store:s,contentId:c},t[3]=c,t[4]=s,t[5]=v):v=t[5];let y=v,b;t[6]!==f||t[7]!==h?(b={isExpanded:f,setExpanded:h},t[6]=f,t[7]=h,t[8]=b):b=t[8];let x=b,S;t[9]!==n||t[10]!==x?(S=/* @__PURE__ */ g(k.Provider,{value:x,children:n}),t[9]=n,t[10]=x,t[11]=S):S=t[11];let C;t[12]===s?C=t[13]:(C=/* @__PURE__ */ g(M,{store:s}),t[12]=s,t[13]=C);let w;return t[14]!==y||t[15]!==S||t[16]!==C?(w=/* @__PURE__ */ _(O.Provider,{value:y,children:[S,C]}),t[14]=y,t[15]=S,t[16]=C,t[17]=w):w=t[17],w},P=t=>{let n=o(22),{children:r,className:a,id:s,intent:l,order:u}=t,{store:d}=A(`AlertCenter.Item`),f=c(j);h(!f,`AlertCenter.Item cannot be rendered inside another item's children.`);let[m,_]=p(null),y,b;n[0]!==s||n[1]!==d?(y=()=>{_(d.getHost(s))},b=[d,s],n[0]=s,n[1]=d,n[2]=y,n[3]=b):(y=n[2],b=n[3]),e(y,b);let x,S;n[4]!==a||n[5]!==s||n[6]!==l||n[7]!==u||n[8]!==d?(x=()=>d.register({id:s,intent:l,className:a,order:u}),S=[d,s,l,a,u],n[4]=a,n[5]=s,n[6]=l,n[7]=u,n[8]=d,n[9]=x,n[10]=S):(x=n[9],S=n[10]),e(x,S);let C;if(n[11]!==s||n[12]!==d?(C=()=>{d.captureHostSnapshot(s)},n[11]=s,n[12]=d,n[13]=C):C=n[13],e(C),m==null)return null;let w;n[14]===r?w=n[15]:(w=/* @__PURE__ */ g(j.Provider,{value:!0,children:/* @__PURE__ */ g(`div`,{className:`contents`,"data-slot":`alert-center-item-label`,children:r})}),n[14]=r,n[15]=w);let T;n[16]!==l||n[17]!==w?(T=/* @__PURE__ */ g(i,{intent:l,redirectDismissFocus:!1,children:w}),n[16]=l,n[17]=w,n[18]=T):T=n[18];let E;return n[19]!==m||n[20]!==T?(E=v(T,m),n[19]=m,n[20]=T,n[21]=E):E=n[21],E},F=n=>{let i=o(14),s,l,u,d;i[0]===n?(s=i[1],l=i[2],u=i[3],d=i[4]):({"data-slot":s,label:l,ref:d,...u}=n,i[0]=n,i[1]=s,i[2]=l,i[3]=u,i[4]=d);let _=c(j);h(_,`AlertCenter.DismissIconButton must be composed inside an <AlertCenter.Item>'s children.`);let{store:v}=A(`AlertCenter.DismissIconButton`);m(v.subscribe,v.getPlacementVersion,v.getPlacementVersion);let y=f(null),b=t(y,d),[x,C]=p(null),w;i[5]===l?w=i[6]:(w=()=>{if(l!=null)return;let e=y.current?.closest(`[data-alert-id]`),t=e==null?``:S(e);C(t===``?null:`Dismiss ${t}`)},i[5]=l,i[6]=w),e(w);let T=l??x??void 0,E;i[7]===s?E=i[8]:(E=r(s,`alert-center-dismiss-icon-button`),i[7]=s,i[8]=E);let D;return i[9]!==b||i[10]!==u||i[11]!==T||i[12]!==E?(D=/* @__PURE__ */ g(a.DismissIconButton,{ref:b,label:T,...u,"data-slot":E}),i[9]=b,i[10]=u,i[11]=T,i[12]=E,i[13]=D):D=i[13],D};function I(e,t){switch(t){case`show`:return`open`;case`hide`:return e===`closed`?`closed`:`closing`;case`exited`:return e===`closing`?`closed`:e}}function L(t){let n=o(10),{present:r}=t,[i,a]=d(I,r?`open`:`closed`),s,c;n[0]===r?(s=n[1],c=n[2]):(s=()=>{a(r?`show`:`hide`)},c=[r],n[0]=r,n[1]=s,n[2]=c),e(s,c);let u,f;n[3]===i?(u=n[4],f=n[5]):(u=()=>{if(i!==`closing`)return;let e=window.setTimeout(()=>a(`exited`),200);return()=>window.clearTimeout(e)},f=[i],n[3]=i,n[4]=u,n[5]=f),l(u,f);let p;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e.target===e.currentTarget&&e.propertyName===`height`&&a(`exited`)},n[6]=p):p=n[6];let m=p,h=i!==`closed`,g=i===`open`?`open`:`closed`,_;return n[7]!==h||n[8]!==g?(_={isMounted:h,dataState:g,onExitTransitionEnd:m},n[7]=h,n[8]=g,n[9]=_):_=n[9],_}function R(t){let n=o(5),{containerRef:r,isAttached:i}=t,a=f(null),s,c;n[0]!==r||n[1]!==i?(s=()=>{let e=r.current;if(!i||e==null)return;let t=e=>{e.target instanceof Element&&(a.current=e.target)},n=t=>{t.relatedTarget instanceof Node&&!e.contains(t.relatedTarget)&&(a.current=null)};return e.addEventListener(`focusin`,t),e.addEventListener(`focusout`,n),()=>{e.removeEventListener(`focusin`,t),e.removeEventListener(`focusout`,n)}},c=[r,i],n[0]=r,n[1]=i,n[2]=s,n[3]=c):(s=n[2],c=n[3]),e(s,c);let l;return n[4]===Symbol.for(`react.memo_cache_sentinel`)?(l={lastFocusedWithinRef:a},n[4]=l):l=n[4],l}function z(){let e=document.querySelector(`main, [role="main"]`);e!=null&&(e.hasAttribute(`tabindex`)||(e.tabIndex=-1),e.focus({preventScroll:!0}))}function B(t){let n=o(10),{isMounted:r,store:i,topId:a}=t,s=f(null),c;n[0]===r?c=n[1]:(c={containerRef:s,isAttached:r},n[0]=r,n[1]=c);let{lastFocusedWithinRef:l}=R(c),u=f(a),d;n[2]!==l||n[3]!==i||n[4]!==a?(d=()=>{let e=u.current;if(u.current=a,e==null||a===e)return;let t=l.current;if(i.hasAlert(e)){t instanceof HTMLElement&&document.activeElement!==t&&i.requestFocusRestore(t);return}if(t==null||t.isConnected)return;l.current=null;let n=s.current;a==null?z():n!=null&&(n.querySelector(`[data-alert-dismiss], [data-alert-expand]`)??n).focus()},n[2]=l,n[3]=i,n[4]=a,n[5]=d):d=n[5];let p;n[6]!==i||n[7]!==a?(p=[i,a],n[6]=i,n[7]=a,n[8]=p):p=n[8],e(d,p);let m;return n[9]===Symbol.for(`react.memo_cache_sentinel`)?(m={wrapperRef:s},n[9]=m):m=n[9],m}const V=`gap-2 py-2 pr-2 **:data-[slot~=alert-icon]:shrink-0`,H={Root:N,Bar:t=>{let i=o(62),s,c,l,u;i[0]===t?(s=i[1],c=i[2],l=i[3],u=i[4]):({className:s,"data-slot":c,ref:u,...l}=t,i[0]=t,i[1]=s,i[2]=c,i[3]=l,i[4]=u);let{store:d,contentId:h}=A(`AlertCenter.Bar`),{isExpanded:v,setExpanded:y}=ee(`AlertCenter.Bar`),x=te(d),C=m(d.subscribe,d.getContentMounted,d.getContentMounted),w=x[0]??null,T=w!=null,E;i[5]===T?E=i[6]:(E={present:T},i[5]=T,i[6]=E);let{isMounted:D,dataState:O,onExitTransitionEnd:k}=L(E),[j,M]=p(w);w!=null&&w!==j&&M(w);let N=w??j,P=f(null),F;i[7]!==N||i[8]!==d||i[9]!==w?(F=()=>{let e=P.current;if(e==null)return;if(w!=null){let t=d.getHost(w.id);t.parentElement!==e&&e.childNodes.length>0&&e.replaceChildren(),b(e,t)&&d.notifyPlacementChange(),d.flushFocusRestore();return}let t=N==null?null:d.getHostSnapshot(N.id);t!=null&&t.parentNode!==e&&e.replaceChildren(t)},i[7]=N,i[8]=d,i[9]=w,i[10]=F):F=i[10],e(F);let I=w?.id,R;i[11]!==D||i[12]!==d||i[13]!==I?(R={isMounted:D,store:d,topId:I},i[11]=D,i[12]=d,i[13]=I,i[14]=R):R=i[14];let{wrapperRef:z}=B(R),H;i[15]!==T||i[16]!==d||i[17]!==z?(H=()=>{let e=z.current;d.setTopLabel(T&&e!=null?S(e):``)},i[15]=T,i[16]=d,i[17]=z,i[18]=H):H=i[18],e(H);let U;i[19]!==T||i[20]!==d||i[21]!==z?(U=()=>{let e=z.current;if(e==null)return;let t=new MutationObserver(()=>{d.setTopLabel(T?S(e):``)});return t.observe(e,{subtree:!0,childList:!0,characterData:!0}),()=>{t.disconnect()}},i[19]=T,i[20]=d,i[21]=z,i[22]=U):U=i[22];let W;i[23]!==D||i[24]!==T||i[25]!==d?(W=[d,T,D],i[23]=D,i[24]=T,i[25]=d,i[26]=W):W=i[26],e(U,W);let G,K;i[27]===d?(G=i[28],K=i[29]):(G=()=>()=>{d.setTopLabel(``)},K=[d],i[27]=d,i[28]=G,i[29]=K),e(G,K);let q;i[30]!==d||i[31]!==z?(q=()=>{d.setBarElement(z.current)},i[30]=d,i[31]=z,i[32]=q):q=i[32],e(q);let J,Y;if(i[33]===d?(J=i[34],Y=i[35]):(J=()=>()=>{d.setBarElement(null)},Y=[d],i[33]=d,i[34]=J,i[35]=Y),e(J,Y),!D||N==null)return null;let ne=T?x.length-1:0,re=!T,ie=N.intent,X;i[36]!==N.className||i[37]!==s?(X=n(V,`not-has-data-[slot=alert-description]:[&_[data-alert-dismiss],&_[data-alert-expand]]:top-1/2 not-has-data-[slot=alert-description]:[&_[data-alert-dismiss],&_[data-alert-expand]]:-translate-y-1/2`,`has-data-alert-expand:**:data-alert-dismiss:right-16 md:has-data-alert-expand:**:data-alert-dismiss:right-24`,s,N.className),i[36]=N.className,i[37]=s,i[38]=X):X=i[38];let Z;i[39]===c?Z=i[40]:(Z=r(c,`alert-center-bar`),i[39]=c,i[40]=Z);let ae;i[41]===Symbol.for(`react.memo_cache_sentinel`)?(ae=/* @__PURE__ */ g(`div`,{ref:P,className:`contents`,"data-slot":`alert-center-bar-mount`}),i[41]=ae):ae=i[41];let Q;i[42]!==h||i[43]!==C||i[44]!==v||i[45]!==ne||i[46]!==y?(Q=ne>0&&C&&/* @__PURE__ */ g(a.ExpandButton,{count:ne,expanded:v,"aria-controls":h,onClick:()=>y(!v)}),i[42]=h,i[43]=C,i[44]=v,i[45]=ne,i[46]=y,i[47]=Q):Q=i[47];let $;i[48]!==N.id||i[49]!==N.intent||i[50]!==l||i[51]!==u||i[52]!==X||i[53]!==Z||i[54]!==Q?($=/* @__PURE__ */ _(a.Root,{ref:u,appearance:`banner`,intent:ie,className:X,...l,"data-slot":Z,"data-placement":`bar`,"data-alert-id":N.id,children:[ae,Q]}),i[48]=N.id,i[49]=N.intent,i[50]=l,i[51]=u,i[52]=X,i[53]=Z,i[54]=Q,i[55]=$):$=i[55];let oe;return i[56]!==O||i[57]!==k||i[58]!==re||i[59]!==$||i[60]!==z?(oe=/* @__PURE__ */ g(`div`,{ref:z,"data-slot":`alert-center-bar-wrapper`,tabIndex:-1,inert:re,className:`shrink-0 overflow-hidden transition-[height,opacity] duration-200 ease-out [interpolate-size:allow-keywords] starting:h-0 starting:opacity-0 data-state-closed:h-0 data-state-closed:opacity-0 data-state-closed:duration-150 motion-reduce:transition-none`,"data-state":O,onTransitionEnd:k,children:$}),i[56]=O,i[57]=k,i[58]=re,i[59]=$,i[60]=z,i[61]=oe):oe=i[61],oe},Content:i=>{let a=o(38),s,c,l,u,d,p;a[0]===i?(s=a[1],c=a[2],l=a[3],u=a[4],d=a[5],p=a[6]):({"aria-label":p,"aria-labelledby":s,className:c,"data-slot":l,ref:d,...u}=i,a[0]=i,a[1]=s,a[2]=c,a[3]=l,a[4]=u,a[5]=d,a[6]=p);let m=p===void 0?`More alerts`:p,{store:h,contentId:_}=A(`AlertCenter.Content`),{isExpanded:v,setExpanded:y}=ee(`AlertCenter.Content`),x=te(h).slice(1),S=x.length>0,C,w;a[7]===h?(C=a[8],w=a[9]):(C=()=>(h.setContentMounted(!0),()=>{h.setContentMounted(!1)}),w=[h],a[7]=h,a[8]=C,a[9]=w),e(C,w);let T=f(S),E,D;a[10]!==S||a[11]!==v||a[12]!==y?(E=()=>{let e=T.current&&!S;T.current=S,e&&v&&y(!1)},D=[S,v,y],a[10]=S,a[11]=v,a[12]=y,a[13]=E,a[14]=D):(E=a[13],D=a[14]),e(E,D);let O=f(null),k=t(O,d),j;a[15]===S?j=a[16]:(j={containerRef:O,isAttached:S},a[15]=S,a[16]=j);let{lastFocusedWithinRef:M}=R(j),N=x.map(W).join(` `),P;a[17]===h?P=a[18]:(P=()=>{let e=O.current;if(e==null)return;let t=!1;for(let n of e.querySelectorAll(`[data-alert-mount]`)){let e=n.getAttribute(`data-alert-mount`);e!=null&&b(n,h.getHost(e))&&(t=!0)}t&&h.notifyPlacementChange(),h.flushFocusRestore()},a[17]=h,a[18]=P),e(P,[h,N]);let F;if(a[19]!==M||a[20]!==h?(F=()=>{let e=M.current;if(e==null)return;if(e.isConnected){let t=O.current;e instanceof HTMLElement&&document.activeElement!==e&&(t==null||!t.contains(e))&&(M.current=null,e.focus({preventScroll:!0}));return}M.current=null;let t=O.current?.querySelector(`[data-alert-dismiss]`);if(t!=null){t.focus();return}let n=h.getBarElement()?.querySelector(`[data-alert-dismiss], [data-alert-expand]`);n==null?z():n.focus()},a[19]=M,a[20]=h,a[21]=F):F=a[21],e(F,[h,N]),x.length===0)return null;let I;a[22]===l?I=a[23]:(I=r(l,`alert-center-content`),a[22]=l,a[23]=I);let L=v?`open`:`closed`,B;a[24]===c?B=a[25]:(B=n(`h-0 overflow-hidden invisible [content-visibility:hidden] transition-[height,visibility,content-visibility] transition-discrete duration-200 ease-out [interpolate-size:allow-keywords] data-state-open:h-auto data-state-open:visible data-state-open:[content-visibility:visible] motion-reduce:transition-none`,c),a[24]=c,a[25]=B);let V=s==null?m:void 0,H=x.map(G),U;a[26]!==s||a[27]!==V||a[28]!==H?(U=/* @__PURE__ */ g(`ul`,{"aria-label":V,"aria-labelledby":s,className:`flex w-full flex-col`,children:H}),a[26]=s,a[27]=V,a[28]=H,a[29]=U):U=a[29];let K;return a[30]!==k||a[31]!==_||a[32]!==u||a[33]!==L||a[34]!==B||a[35]!==U||a[36]!==I?(K=/* @__PURE__ */ g(`div`,{...u,ref:k,"data-slot":I,id:_,"data-state":L,className:B,children:U}),a[30]=k,a[31]=_,a[32]=u,a[33]=L,a[34]=B,a[35]=U,a[36]=I,a[37]=K):K=a[37],K},Item:P,DismissIconButton:F};function U(){return new D}function W(e){return e.id}function G(e){return/* @__PURE__ */ g(`li`,{children:/* @__PURE__ */ g(a.Root,{appearance:`banner`,intent:e.intent,className:n(V,e.className),"data-slot":`alert-center-item`,"data-placement":`list`,"data-alert-id":e.id,children:/* @__PURE__ */ g(`div`,{className:`contents`,"data-alert-mount":e.id})})},e.id)}export{H as AlertCenter};
|
|
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"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{n as i,t as a}from"./alert-BkJHDx9X.js";import{c as o}from"react/compiler-runtime";import{createContext as s,useContext as c,useEffect as l,useId as u,useReducer as d,useRef as f,useState as p,useSyncExternalStore as m}from"react";import h from"tiny-invariant";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{createPortal as v}from"react-dom";const y={danger:5,warning:4,important:3,info:2,success:1};function b(e,t){if(t.parentElement===e)return!1;if(typeof e.moveBefore==`function`&&t.isConnected&&e.isConnected)try{return e.moveBefore(t,null),!0}catch{}return e.appendChild(t),!0}function x(e){return e.replace(/\s+/g,` `).trim()}function S(e){let t=e.querySelector(`[data-slot~="alert-title"]`);if(t==null)return``;let n=t.cloneNode(!0);if(!(n instanceof Element))return x(t.textContent??``);for(let e of n.querySelectorAll(`button`))e.remove();let r=x(n.textContent??``);for(let e of n.querySelectorAll(`a`))e.remove();let i=x(n.textContent??``);return i===``?r:i}function C(e){return e.toSorted((e,t)=>y[t.intent]-y[e.intent]||w(e.order,t.order)||e.sequence-t.sequence)}function w(e,t){return e===t?0:e==null?1:t==null||e<t?-1:1}function T(e,t){if(t===0)return``;if(e===``)return`${t} alert${t===1?``:`s`}`;let n=t-1;return n===0?e:`${e}, and ${n} more alert${n===1?``:`s`}`}const E=[];var D=class{#e=/* @__PURE__ */ new Set;#t=/* @__PURE__ */ new Map;#n=/* @__PURE__ */ new Map;#r=/* @__PURE__ */ new Map;#i=0;#a=E;#o=``;#s=!1;getHost(e){let t=this.#r.get(e);if(t!=null)return t;let n=document.createElement(`div`);return n.style.display=`contents`,n.setAttribute(`data-slot`,`alert-center-item-host`),n.setAttribute(`data-alert-host`,e),this.#r.set(e,n),n}#c=null;captureHostSnapshot(e){if(e!==this.#a[0]?.id)return;let t=this.#r.get(e);t!=null&&t.firstElementChild?.hasChildNodes()===!0&&(this.#c={id:e,content:t.cloneNode(!0)})}getHostSnapshot=e=>this.#c?.id===e?this.#c.content:null;subscribe=e=>(this.#e.add(e),()=>{this.#e.delete(e)});getSnapshot=()=>this.#a;hasAlert=e=>this.#t.has(e);getTopLabel=()=>this.#o;setTopLabel(e){this.#o!==e&&(this.#o=e,this.#p())}#l=null;requestFocusRestore(e){this.#l=e}flushFocusRestore(){let e=this.#l;e!=null&&e.isConnected&&(this.#l=null,document.activeElement!==e&&e.focus({preventScroll:!0}))}#u=null;#d=0;getPlacementVersion=()=>this.#d;notifyPlacementChange(){this.#d++,this.#p()}setBarElement(e){this.#u=e}getBarElement=()=>this.#u;getContentMounted=()=>this.#s;setContentMounted(e){this.#s!==e&&(this.#s=e,this.#p())}register(e){h(!this.#t.has(e.id),`AlertCenter.Item id "${e.id}" is already registered by another mounted item. Ids must be unique under one <AlertCenter.Root>. Render one item per id, or give each alert its own id.`);let t=this.#n.get(e.id)??this.#i++;this.#n.set(e.id,t);let n={...e,sequence:t};return this.#t.set(e.id,n),this.#f(),()=>{this.#t.get(e.id)===n&&(this.#t.delete(e.id),this.#f())}}#f(){this.#a=C([...this.#t.values()]),this.#p()}#p(){for(let e of this.#e)e()}};const O=s(null),k=s(null);function A(e){let t=c(O);return h(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}function ee(e){let t=c(k);return h(t,`${e} must be rendered inside <AlertCenter.Root>.`),t}const te=e=>m(e.subscribe,e.getSnapshot,e.getSnapshot),j=s(!1);function M(e){let t=o(5),{store:n}=e,r=te(n),i=m(n.subscribe,n.getTopLabel,n.getTopLabel),a;t[0]!==r.length||t[1]!==i?(a=T(i,r.length),t[0]=r.length,t[1]=i,t[2]=a):a=t[2];let s;return t[3]===a?s=t[4]:(s=/* @__PURE__ */ g(`div`,{"data-slot":`alert-center-announcer`,className:`sr-only`,role:`status`,"aria-live":`polite`,children:a}),t[3]=a,t[4]=s),s}const N=e=>{let t=o(18),{children:n,defaultOpen:r,onOpenChange:i,open:a}=e,[s]=p(U),c=u(),[l,d]=p(r??!1),f=a??l,m;t[0]!==i||t[1]!==a?(m=e=>{a??d(e),i?.(e)},t[0]=i,t[1]=a,t[2]=m):m=t[2];let h=m,v;t[3]!==c||t[4]!==s?(v={store:s,contentId:c},t[3]=c,t[4]=s,t[5]=v):v=t[5];let y=v,b;t[6]!==f||t[7]!==h?(b={isExpanded:f,setExpanded:h},t[6]=f,t[7]=h,t[8]=b):b=t[8];let x=b,S;t[9]!==n||t[10]!==x?(S=/* @__PURE__ */ g(k.Provider,{value:x,children:n}),t[9]=n,t[10]=x,t[11]=S):S=t[11];let C;t[12]===s?C=t[13]:(C=/* @__PURE__ */ g(M,{store:s}),t[12]=s,t[13]=C);let w;return t[14]!==y||t[15]!==S||t[16]!==C?(w=/* @__PURE__ */ _(O.Provider,{value:y,children:[S,C]}),t[14]=y,t[15]=S,t[16]=C,t[17]=w):w=t[17],w},P=t=>{let n=o(22),{children:r,className:a,id:s,intent:l,order:u}=t,{store:d}=A(`AlertCenter.Item`),f=c(j);h(!f,`AlertCenter.Item cannot be rendered inside another item's children.`);let[m,_]=p(null),y,b;n[0]!==s||n[1]!==d?(y=()=>{_(d.getHost(s))},b=[d,s],n[0]=s,n[1]=d,n[2]=y,n[3]=b):(y=n[2],b=n[3]),e(y,b);let x,S;n[4]!==a||n[5]!==s||n[6]!==l||n[7]!==u||n[8]!==d?(x=()=>d.register({id:s,intent:l,className:a,order:u}),S=[d,s,l,a,u],n[4]=a,n[5]=s,n[6]=l,n[7]=u,n[8]=d,n[9]=x,n[10]=S):(x=n[9],S=n[10]),e(x,S);let C;if(n[11]!==s||n[12]!==d?(C=()=>{d.captureHostSnapshot(s)},n[11]=s,n[12]=d,n[13]=C):C=n[13],e(C),m==null)return null;let w;n[14]===r?w=n[15]:(w=/* @__PURE__ */ g(j.Provider,{value:!0,children:/* @__PURE__ */ g(`div`,{className:`contents`,"data-slot":`alert-center-item-label`,children:r})}),n[14]=r,n[15]=w);let T;n[16]!==l||n[17]!==w?(T=/* @__PURE__ */ g(i,{intent:l,redirectDismissFocus:!1,children:w}),n[16]=l,n[17]=w,n[18]=T):T=n[18];let E;return n[19]!==m||n[20]!==T?(E=v(T,m),n[19]=m,n[20]=T,n[21]=E):E=n[21],E},F=n=>{let i=o(14),s,l,u,d;i[0]===n?(s=i[1],l=i[2],u=i[3],d=i[4]):({"data-slot":s,label:l,ref:d,...u}=n,i[0]=n,i[1]=s,i[2]=l,i[3]=u,i[4]=d);let _=c(j);h(_,`AlertCenter.DismissIconButton must be composed inside an <AlertCenter.Item>'s children.`);let{store:v}=A(`AlertCenter.DismissIconButton`);m(v.subscribe,v.getPlacementVersion,v.getPlacementVersion);let y=f(null),b=t(y,d),[x,C]=p(null),w;i[5]===l?w=i[6]:(w=()=>{if(l!=null)return;let e=y.current?.closest(`[data-alert-id]`),t=e==null?``:S(e);C(t===``?null:`Dismiss ${t}`)},i[5]=l,i[6]=w),e(w);let T=l??x??void 0,E;i[7]===s?E=i[8]:(E=r(s,`alert-center-dismiss-icon-button`),i[7]=s,i[8]=E);let D;return i[9]!==b||i[10]!==u||i[11]!==T||i[12]!==E?(D=/* @__PURE__ */ g(a.DismissIconButton,{ref:b,label:T,...u,"data-slot":E}),i[9]=b,i[10]=u,i[11]=T,i[12]=E,i[13]=D):D=i[13],D};function I(e,t){switch(t){case`show`:return`open`;case`hide`:return e===`closed`?`closed`:`closing`;case`exited`:return e===`closing`?`closed`:e}}function L(t){let n=o(10),{present:r}=t,[i,a]=d(I,r?`open`:`closed`),s,c;n[0]===r?(s=n[1],c=n[2]):(s=()=>{a(r?`show`:`hide`)},c=[r],n[0]=r,n[1]=s,n[2]=c),e(s,c);let u,f;n[3]===i?(u=n[4],f=n[5]):(u=()=>{if(i!==`closing`)return;let e=window.setTimeout(()=>a(`exited`),200);return()=>window.clearTimeout(e)},f=[i],n[3]=i,n[4]=u,n[5]=f),l(u,f);let p;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e.target===e.currentTarget&&e.propertyName===`height`&&a(`exited`)},n[6]=p):p=n[6];let m=p,h=i!==`closed`,g=i===`open`?`open`:`closed`,_;return n[7]!==h||n[8]!==g?(_={isMounted:h,dataState:g,onExitTransitionEnd:m},n[7]=h,n[8]=g,n[9]=_):_=n[9],_}function R(t){let n=o(5),{containerRef:r,isAttached:i}=t,a=f(null),s,c;n[0]!==r||n[1]!==i?(s=()=>{let e=r.current;if(!i||e==null)return;let t=e=>{e.target instanceof Element&&(a.current=e.target)},n=t=>{t.relatedTarget instanceof Node&&!e.contains(t.relatedTarget)&&(a.current=null)};return e.addEventListener(`focusin`,t),e.addEventListener(`focusout`,n),()=>{e.removeEventListener(`focusin`,t),e.removeEventListener(`focusout`,n)}},c=[r,i],n[0]=r,n[1]=i,n[2]=s,n[3]=c):(s=n[2],c=n[3]),e(s,c);let l;return n[4]===Symbol.for(`react.memo_cache_sentinel`)?(l={lastFocusedWithinRef:a},n[4]=l):l=n[4],l}function z(){let e=document.querySelector(`main, [role="main"]`);e!=null&&(e.hasAttribute(`tabindex`)||(e.tabIndex=-1),e.focus({preventScroll:!0}))}function B(t){let n=o(10),{isMounted:r,store:i,topId:a}=t,s=f(null),c;n[0]===r?c=n[1]:(c={containerRef:s,isAttached:r},n[0]=r,n[1]=c);let{lastFocusedWithinRef:l}=R(c),u=f(a),d;n[2]!==l||n[3]!==i||n[4]!==a?(d=()=>{let e=u.current;if(u.current=a,e==null||a===e)return;let t=l.current;if(i.hasAlert(e)){t instanceof HTMLElement&&document.activeElement!==t&&i.requestFocusRestore(t);return}if(t==null||t.isConnected)return;l.current=null;let n=s.current;a==null?z():n!=null&&(n.querySelector(`[data-alert-dismiss], [data-alert-expand]`)??n).focus()},n[2]=l,n[3]=i,n[4]=a,n[5]=d):d=n[5];let p;n[6]!==i||n[7]!==a?(p=[i,a],n[6]=i,n[7]=a,n[8]=p):p=n[8],e(d,p);let m;return n[9]===Symbol.for(`react.memo_cache_sentinel`)?(m={wrapperRef:s},n[9]=m):m=n[9],m}const V=`gap-2 py-2 pr-2 **:data-[slot~=alert-icon]:shrink-0`,H={Root:N,Bar:t=>{let i=o(62),s,c,l,u;i[0]===t?(s=i[1],c=i[2],l=i[3],u=i[4]):({className:s,"data-slot":c,ref:u,...l}=t,i[0]=t,i[1]=s,i[2]=c,i[3]=l,i[4]=u);let{store:d,contentId:h}=A(`AlertCenter.Bar`),{isExpanded:v,setExpanded:y}=ee(`AlertCenter.Bar`),x=te(d),C=m(d.subscribe,d.getContentMounted,d.getContentMounted),w=x[0]??null,T=w!=null,E;i[5]===T?E=i[6]:(E={present:T},i[5]=T,i[6]=E);let{isMounted:D,dataState:O,onExitTransitionEnd:k}=L(E),[j,M]=p(w);w!=null&&w!==j&&M(w);let N=w??j,P=f(null),F;i[7]!==N||i[8]!==d||i[9]!==w?(F=()=>{let e=P.current;if(e==null)return;if(w!=null){let t=d.getHost(w.id);t.parentElement!==e&&e.childNodes.length>0&&e.replaceChildren(),b(e,t)&&d.notifyPlacementChange(),d.flushFocusRestore();return}let t=N==null?null:d.getHostSnapshot(N.id);t!=null&&t.parentNode!==e&&e.replaceChildren(t)},i[7]=N,i[8]=d,i[9]=w,i[10]=F):F=i[10],e(F);let I=w?.id,R;i[11]!==D||i[12]!==d||i[13]!==I?(R={isMounted:D,store:d,topId:I},i[11]=D,i[12]=d,i[13]=I,i[14]=R):R=i[14];let{wrapperRef:z}=B(R),H;i[15]!==T||i[16]!==d||i[17]!==z?(H=()=>{let e=z.current;d.setTopLabel(T&&e!=null?S(e):``)},i[15]=T,i[16]=d,i[17]=z,i[18]=H):H=i[18],e(H);let U;i[19]!==T||i[20]!==d||i[21]!==z?(U=()=>{let e=z.current;if(e==null)return;let t=new MutationObserver(()=>{d.setTopLabel(T?S(e):``)});return t.observe(e,{subtree:!0,childList:!0,characterData:!0}),()=>{t.disconnect()}},i[19]=T,i[20]=d,i[21]=z,i[22]=U):U=i[22];let W;i[23]!==D||i[24]!==T||i[25]!==d?(W=[d,T,D],i[23]=D,i[24]=T,i[25]=d,i[26]=W):W=i[26],e(U,W);let G,K;i[27]===d?(G=i[28],K=i[29]):(G=()=>()=>{d.setTopLabel(``)},K=[d],i[27]=d,i[28]=G,i[29]=K),e(G,K);let q;i[30]!==d||i[31]!==z?(q=()=>{d.setBarElement(z.current)},i[30]=d,i[31]=z,i[32]=q):q=i[32],e(q);let J,Y;if(i[33]===d?(J=i[34],Y=i[35]):(J=()=>()=>{d.setBarElement(null)},Y=[d],i[33]=d,i[34]=J,i[35]=Y),e(J,Y),!D||N==null)return null;let ne=T?x.length-1:0,re=!T,ie=N.intent,X;i[36]!==N.className||i[37]!==s?(X=n(V,`not-has-data-[slot=alert-description]:[&_[data-alert-dismiss],&_[data-alert-expand]]:top-1/2 not-has-data-[slot=alert-description]:[&_[data-alert-dismiss],&_[data-alert-expand]]:-translate-y-1/2`,s,N.className),i[36]=N.className,i[37]=s,i[38]=X):X=i[38];let Z;i[39]===c?Z=i[40]:(Z=r(c,`alert-center-bar`),i[39]=c,i[40]=Z);let ae;i[41]===Symbol.for(`react.memo_cache_sentinel`)?(ae=/* @__PURE__ */ g(`div`,{ref:P,className:`contents`,"data-slot":`alert-center-bar-mount`}),i[41]=ae):ae=i[41];let Q;i[42]!==h||i[43]!==C||i[44]!==v||i[45]!==ne||i[46]!==y?(Q=ne>0&&C&&/* @__PURE__ */ g(a.ExpandButton,{count:ne,expanded:v,"aria-controls":h,onClick:()=>y(!v)}),i[42]=h,i[43]=C,i[44]=v,i[45]=ne,i[46]=y,i[47]=Q):Q=i[47];let $;i[48]!==N.id||i[49]!==N.intent||i[50]!==l||i[51]!==u||i[52]!==X||i[53]!==Z||i[54]!==Q?($=/* @__PURE__ */ _(a.Root,{ref:u,appearance:`banner`,intent:ie,className:X,...l,"data-slot":Z,"data-placement":`bar`,"data-alert-id":N.id,children:[ae,Q]}),i[48]=N.id,i[49]=N.intent,i[50]=l,i[51]=u,i[52]=X,i[53]=Z,i[54]=Q,i[55]=$):$=i[55];let oe;return i[56]!==O||i[57]!==k||i[58]!==re||i[59]!==$||i[60]!==z?(oe=/* @__PURE__ */ g(`div`,{ref:z,"data-slot":`alert-center-bar-wrapper`,tabIndex:-1,inert:re,className:`shrink-0 overflow-hidden transition-[height,opacity] duration-200 ease-out [interpolate-size:allow-keywords] starting:h-0 starting:opacity-0 data-state-closed:h-0 data-state-closed:opacity-0 data-state-closed:duration-150 motion-reduce:transition-none`,"data-state":O,onTransitionEnd:k,children:$}),i[56]=O,i[57]=k,i[58]=re,i[59]=$,i[60]=z,i[61]=oe):oe=i[61],oe},Content:i=>{let a=o(38),s,c,l,u,d,p;a[0]===i?(s=a[1],c=a[2],l=a[3],u=a[4],d=a[5],p=a[6]):({"aria-label":p,"aria-labelledby":s,className:c,"data-slot":l,ref:d,...u}=i,a[0]=i,a[1]=s,a[2]=c,a[3]=l,a[4]=u,a[5]=d,a[6]=p);let m=p===void 0?`More alerts`:p,{store:h,contentId:_}=A(`AlertCenter.Content`),{isExpanded:v,setExpanded:y}=ee(`AlertCenter.Content`),x=te(h).slice(1),S=x.length>0,C,w;a[7]===h?(C=a[8],w=a[9]):(C=()=>(h.setContentMounted(!0),()=>{h.setContentMounted(!1)}),w=[h],a[7]=h,a[8]=C,a[9]=w),e(C,w);let T=f(S),E,D;a[10]!==S||a[11]!==v||a[12]!==y?(E=()=>{let e=T.current&&!S;T.current=S,e&&v&&y(!1)},D=[S,v,y],a[10]=S,a[11]=v,a[12]=y,a[13]=E,a[14]=D):(E=a[13],D=a[14]),e(E,D);let O=f(null),k=t(O,d),j;a[15]===S?j=a[16]:(j={containerRef:O,isAttached:S},a[15]=S,a[16]=j);let{lastFocusedWithinRef:M}=R(j),N=x.map(W).join(` `),P;a[17]===h?P=a[18]:(P=()=>{let e=O.current;if(e==null)return;let t=!1;for(let n of e.querySelectorAll(`[data-alert-mount]`)){let e=n.getAttribute(`data-alert-mount`);e!=null&&b(n,h.getHost(e))&&(t=!0)}t&&h.notifyPlacementChange(),h.flushFocusRestore()},a[17]=h,a[18]=P),e(P,[h,N]);let F;if(a[19]!==M||a[20]!==h?(F=()=>{let e=M.current;if(e==null)return;if(e.isConnected){let t=O.current;e instanceof HTMLElement&&document.activeElement!==e&&(t==null||!t.contains(e))&&(M.current=null,e.focus({preventScroll:!0}));return}M.current=null;let t=O.current?.querySelector(`[data-alert-dismiss]`);if(t!=null){t.focus();return}let n=h.getBarElement()?.querySelector(`[data-alert-dismiss], [data-alert-expand]`);n==null?z():n.focus()},a[19]=M,a[20]=h,a[21]=F):F=a[21],e(F,[h,N]),x.length===0)return null;let I;a[22]===l?I=a[23]:(I=r(l,`alert-center-content`),a[22]=l,a[23]=I);let L=v?`open`:`closed`,B;a[24]===c?B=a[25]:(B=n(`h-0 overflow-hidden invisible [content-visibility:hidden] transition-[height,visibility,content-visibility] transition-discrete duration-200 ease-out [interpolate-size:allow-keywords] data-state-open:h-auto data-state-open:visible data-state-open:[content-visibility:visible] motion-reduce:transition-none`,c),a[24]=c,a[25]=B);let V=s==null?m:void 0,H=x.map(G),U;a[26]!==s||a[27]!==V||a[28]!==H?(U=/* @__PURE__ */ g(`ul`,{"aria-label":V,"aria-labelledby":s,className:`flex w-full flex-col`,children:H}),a[26]=s,a[27]=V,a[28]=H,a[29]=U):U=a[29];let K;return a[30]!==k||a[31]!==_||a[32]!==u||a[33]!==L||a[34]!==B||a[35]!==U||a[36]!==I?(K=/* @__PURE__ */ g(`div`,{...u,ref:k,"data-slot":I,id:_,"data-state":L,className:B,children:U}),a[30]=k,a[31]=_,a[32]=u,a[33]=L,a[34]=B,a[35]=U,a[36]=I,a[37]=K):K=a[37],K},Item:P,DismissIconButton:F};function U(){return new D}function W(e){return e.id}function G(e){return/* @__PURE__ */ g(`li`,{children:/* @__PURE__ */ g(a.Root,{appearance:`banner`,intent:e.intent,className:n(V,e.className),"data-slot":`alert-center-item`,"data-placement":`list`,"data-alert-id":e.id,children:/* @__PURE__ */ g(`div`,{className:`contents`,"data-alert-mount":e.id})})},e.id)}export{H as AlertCenter};
|
package/dist/alert-dialog.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Alert Dialog component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/overlays/alert-dialog
|
|
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
|
-
import {
|
|
7
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
8
|
+
import { i as ButtonIntent, n as ButtonAppearance, r as ButtonProps } from "./button-Ddj6yr10.js";
|
|
9
|
+
import { c as Trigger$1, n as Content$1, o as Root$1, r as Description$1, s as Title$1, t as Close$1 } from "./dialog-CbEEA0fl.js";
|
|
10
|
+
import { t as SvgAttributes } from "./icon--purqHRo.js";
|
|
6
11
|
import { ComponentProps, ReactNode } from "react";
|
|
7
12
|
declare const intents: readonly ["info", "danger"];
|
|
8
13
|
type AlertDialogIntent = (typeof intents)[number];
|
|
9
14
|
type AlertDialogProps = ComponentProps<typeof Root$1> & {
|
|
10
15
|
/**
|
|
11
|
-
* The intent of the AlertDialog
|
|
16
|
+
* The intent of the AlertDialog: the tone its color communicates to the
|
|
12
17
|
* user, affecting the color and styling of descendants like
|
|
13
18
|
* `AlertDialog.Icon` and `AlertDialog.Action`.
|
|
14
19
|
*/
|
|
@@ -128,6 +133,12 @@ type AlertDialogContentProps = ComponentProps<typeof Content$1> & {
|
|
|
128
133
|
* focus and hides outside content from assistive technology. Put a control that
|
|
129
134
|
* every user must reach inside the content.
|
|
130
135
|
*
|
|
136
|
+
* A script can show its own popup in a frame on `<body>`, above the alert
|
|
137
|
+
* dialog, such as the 3-D Secure challenge of a payment script. While that
|
|
138
|
+
* frame is on top at the center of the viewport, the alert dialog yields to
|
|
139
|
+
* the popup. Focus that a script moves into the popup stays there. Escape
|
|
140
|
+
* moves focus into the popup and does not close the alert dialog.
|
|
141
|
+
*
|
|
131
142
|
* @see https://mantle.ngrok.com/components/overlays/alert-dialog#alertdialogcontent
|
|
132
143
|
*
|
|
133
144
|
* @example
|
|
@@ -351,7 +362,7 @@ declare const Title: ({ "data-slot": dataSlot, className, ref, ...props }: Compo
|
|
|
351
362
|
declare const Description: ({ "data-slot": dataSlot, className, ref, ...props }: ComponentProps<typeof Description$1> & WithDataSlot) => import("react").JSX.Element;
|
|
352
363
|
type AlertDialogActionProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
353
364
|
/**
|
|
354
|
-
* The visual style of the action button. Optional here
|
|
365
|
+
* The visual style of the action button. Optional here: `AlertDialog.Action`
|
|
355
366
|
* defaults to `"filled"` so the confirming action carries the heaviest
|
|
356
367
|
* visual weight in the dialog.
|
|
357
368
|
*
|
|
@@ -359,7 +370,7 @@ type AlertDialogActionProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
|
359
370
|
*/
|
|
360
371
|
appearance?: ButtonAppearance;
|
|
361
372
|
/**
|
|
362
|
-
* The tone of the action button. Optional here
|
|
373
|
+
* The tone of the action button. Optional here. When omitted,
|
|
363
374
|
* `AlertDialog.Action` derives the tone from the parent `AlertDialog.Root`'s
|
|
364
375
|
* `intent` (`"danger"` → `"danger"`, `"info"` → `"neutral"`). A passed
|
|
365
376
|
* value always wins over the context-derived tone.
|
|
@@ -412,7 +423,7 @@ type AlertDialogActionProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
|
412
423
|
declare const Action: ({ "data-slot": dataSlot, appearance, intent, ref, ...props }: AlertDialogActionProps) => import("react").JSX.Element;
|
|
413
424
|
type AlertDialogCancelProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
414
425
|
/**
|
|
415
|
-
* The visual style of the cancel button. Optional here
|
|
426
|
+
* The visual style of the cancel button. Optional here: `AlertDialog.Cancel`
|
|
416
427
|
* defaults to `"outlined"` so it visually de-emphasizes against
|
|
417
428
|
* `AlertDialog.Action`.
|
|
418
429
|
*
|
|
@@ -420,7 +431,7 @@ type AlertDialogCancelProps = Omit<ButtonProps, "appearance" | "intent"> & {
|
|
|
420
431
|
*/
|
|
421
432
|
appearance?: ButtonAppearance;
|
|
422
433
|
/**
|
|
423
|
-
* The tone of the cancel button. Optional here
|
|
434
|
+
* The tone of the cancel button. Optional here: `AlertDialog.Cancel`
|
|
424
435
|
* defaults to `"neutral"`, the workhorse tone for routine actions.
|
|
425
436
|
*
|
|
426
437
|
* @default "neutral"
|
|
@@ -559,7 +570,7 @@ declare const Close: ({ "data-slot": dataSlot, ref, ...props }: ComponentProps<t
|
|
|
559
570
|
* A modal dialog that interrupts the user with important content and expects a
|
|
560
571
|
* response. Use AlertDialog for destructive or irreversible confirmations
|
|
561
572
|
* (delete, sign out, leave without saving) where the user must explicitly
|
|
562
|
-
* acknowledge before proceeding
|
|
573
|
+
* acknowledge before proceeding. It blocks all background interaction by
|
|
563
574
|
* default. For non-destructive input modals or confirmation flows, use
|
|
564
575
|
* `Dialog` instead. For side-panel content (filter panels, detail views,
|
|
565
576
|
* navigation drawers), use `Sheet`.
|
|
@@ -570,6 +581,14 @@ declare const Close: ({ "data-slot": dataSlot, ref, ...props }: ComponentProps<t
|
|
|
570
581
|
* the content. When multiple overlays are open, the most recently mounted
|
|
571
582
|
* overlay renders on top.
|
|
572
583
|
*
|
|
584
|
+
* @useWhen The user must confirm a destructive or irreversible action, such as a delete or a
|
|
585
|
+
* sign-out, before it runs.
|
|
586
|
+
*
|
|
587
|
+
* @siblings
|
|
588
|
+
* - `Dialog`: a modal window gathers input or confirms a choice that is not destructive.
|
|
589
|
+
* - `Sheet`: the content slides in from the edge of the screen, such as a filter panel or a detail view.
|
|
590
|
+
* - `Sandbar`: the page holds unsaved changes, and a bar waits for the user to save or discard them.
|
|
591
|
+
*
|
|
573
592
|
* @see https://mantle.ngrok.com/components/overlays/alert-dialog
|
|
574
593
|
*
|
|
575
594
|
* @example
|
|
@@ -850,6 +869,12 @@ declare const AlertDialog: {
|
|
|
850
869
|
* focus and hides outside content from assistive technology. Put a control that
|
|
851
870
|
* every user must reach inside the content.
|
|
852
871
|
*
|
|
872
|
+
* A script can show its own popup in a frame on `<body>`, above the alert
|
|
873
|
+
* dialog, such as the 3-D Secure challenge of a payment script. While that
|
|
874
|
+
* frame is on top at the center of the viewport, the alert dialog yields to
|
|
875
|
+
* the popup. Focus that a script moves into the popup stays there. Escape
|
|
876
|
+
* moves focus into the popup and does not close the alert dialog.
|
|
877
|
+
*
|
|
853
878
|
* @see https://mantle.ngrok.com/components/overlays/alert-dialog#alertdialogcontent
|
|
854
879
|
*
|
|
855
880
|
* @example
|
package/dist/alert-dialog.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"./
|
|
1
|
+
"use client";import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./layer-container-DL4yclOu.js";import{t as r}from"./button-DNLTJ32M.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./primitive-D8CzV_Ft.js";import{t as f}from"./icon-BudQMD2S.js";import{t as p}from"./slot-B7rwscwd.js";import{c as m}from"react/compiler-runtime";import{createContext as h,useContext as g}from"react";import _ from"tiny-invariant";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{InfoIcon as b}from"@phosphor-icons/react/Info";import{WarningIcon as x}from"@phosphor-icons/react/Warning";const S=h(null);function C(){let e=g(S);return _(e,`AlertDialog parts must be rendered inside AlertDialog.Root.`),e}function w(e){let t=m(10),n,r;t[0]===e?(n=t[1],r=t[2]):({intent:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i={intent:n},t[3]=n,t[4]=i);let a=i,o;t[5]===r?o=t[6]:(o=/* @__PURE__ */ v(c,{...r}),t[5]=r,t[6]=o);let s;return t[7]!==a||t[8]!==o?(s=/* @__PURE__ */ v(S.Provider,{value:a,children:o}),t[7]=a,t[8]=o,t[9]=s):s=t[9],s}const T=e=>{let n=m(10),r,i,o;n[0]===e?(r=n[1],i=n[2],o=n[3]):({"data-slot":r,ref:o,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=o);let s;n[4]===r?s=n[5]:(s=t(r,`alert-dialog-trigger`),n[4]=r,n[5]=s);let c;return n[6]!==i||n[7]!==o||n[8]!==s?(c=/* @__PURE__ */ v(a,{ref:o,"data-slot":s,...i}),n[6]=i,n[7]=o,n[8]=s,n[9]=c):c=n[9],c},E=i,D=n=>{let r=m(14),i,a,s,c;r[0]===n?(i=r[1],a=r[2],s=r[3],c=r[4]):({"data-slot":a,className:i,ref:c,...s}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=s,r[4]=c);let l;r[5]===a?l=r[6]:(l=t(a,`alert-dialog-overlay`),r[5]=a,r[6]=l);let u;r[7]===i?u=r[8]:(u=e(`data-state-open:animate-in data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:fade-in-0 duration-200 ease-out-strong data-state-closed:duration-150 bg-overlay fixed inset-0 z-60 backdrop-blur-xs`,i),r[7]=i,r[8]=u);let d;return r[9]!==s||r[10]!==c||r[11]!==l||r[12]!==u?(d=/* @__PURE__ */ v(o,{"data-slot":l,className:u,...s,ref:c}),r[9]=s,r[10]=c,r[11]=l,r[12]=u,r[13]=d):d=r[13],d},O=r=>{let i=m(21),a,o,c,l,u,d;i[0]===r?(a=i[1],o=i[2],c=i[3],l=i[4],u=i[5],d=i[6]):({"data-slot":o,className:a,onInteractOutside:c,preferredWidth:d,ref:u,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=c,i[4]=l,i[5]=u,i[6]=d);let f=d===void 0?`max-w-md`:d,p;i[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=/* @__PURE__ */ v(D,{}),i[7]=p):p=i[7];let h;i[8]===o?h=i[9]:(h=t(o,`alert-dialog-content`),i[8]=o,i[9]=h);let g;i[10]===c?g=i[11]:(g=e=>{c?.(e),e.preventDefault()},i[10]=c,i[11]=g);let _;i[12]!==a||i[13]!==f?(_=e(`flex w-full flex-1 flex-col items-center gap-4 sm:flex-row sm:items-start`,`outline-hidden focus-within:outline-hidden`,`p-6`,`border-dialog bg-dialog rounded-xl border shadow-lg duration-200 ease-out-strong data-state-closed:duration-150 motion-reduce:animate-none!`,`data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95`,f,a),i[12]=a,i[13]=f,i[14]=_):_=i[14];let b;return i[15]!==l||i[16]!==u||i[17]!==h||i[18]!==g||i[19]!==_?(b=/* @__PURE__ */ y(E,{children:[p,/* @__PURE__ */ v(n,{"data-slot":`alert-dialog-positioner`,className:`fixed inset-4 z-60 flex items-center justify-center motion-safe:not-has-[>[data-mantle-modal-content][data-state=open]]:animate-exit-hold`,children:/* @__PURE__ */ v(s,{role:`alertdialog`,"data-slot":h,"data-mantle-modal-content":!0,ref:u,onInteractOutside:g,className:_,...l})})]}),i[15]=l,i[16]=u,i[17]=h,i[18]=g,i[19]=_,i[20]=b):b=i[20],b},k=n=>{let r=m(16),i,a,o,s,c;r[0]===n?(i=r[1],a=r[2],o=r[3],s=r[4],c=r[5]):({"data-slot":a,asChild:c,className:i,ref:s,...o}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=c);let l=c!==void 0&&c?p:`div`,u;r[6]===a?u=r[7]:(u=t(a,`alert-dialog-body`),r[6]=a,r[7]=u);let d;r[8]===i?d=r[9]:(d=e(`flex-1 space-y-4`,i),r[8]=i,r[9]=d);let f;return r[10]!==l||r[11]!==o||r[12]!==s||r[13]!==u||r[14]!==d?(f=/* @__PURE__ */ v(l,{"data-slot":u,className:d,ref:s,...o}),r[10]=l,r[11]=o,r[12]=s,r[13]=u,r[14]=d,r[15]=f):f=r[15],f},A=n=>{let r=m(16),i,a,o,s,c;r[0]===n?(i=r[1],a=r[2],o=r[3],s=r[4],c=r[5]):({"data-slot":a,asChild:c,className:i,ref:s,...o}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=c);let l=c!==void 0&&c?p:`div`,u;r[6]===a?u=r[7]:(u=t(a,`alert-dialog-header`),r[6]=a,r[7]=u);let d;r[8]===i?d=r[9]:(d=e(`flex flex-col space-y-2 text-center sm:text-start`,i),r[8]=i,r[9]=d);let f;return r[10]!==l||r[11]!==o||r[12]!==s||r[13]!==u||r[14]!==d?(f=/* @__PURE__ */ v(l,{"data-slot":u,className:d,ref:s,...o}),r[10]=l,r[11]=o,r[12]=s,r[13]=u,r[14]=d,r[15]=f):f=r[15],f},j=n=>{let r=m(16),i,a,o,s,c;r[0]===n?(i=r[1],a=r[2],o=r[3],s=r[4],c=r[5]):({"data-slot":a,asChild:c,className:i,ref:s,...o}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=c);let l=c!==void 0&&c?p:`div`,u;r[6]===a?u=r[7]:(u=t(a,`alert-dialog-footer`),r[6]=a,r[7]=u);let d;r[8]===i?d=r[9]:(d=e(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,i),r[8]=i,r[9]=d);let f;return r[10]!==l||r[11]!==o||r[12]!==s||r[13]!==u||r[14]!==d?(f=/* @__PURE__ */ v(l,{"data-slot":u,className:d,ref:s,...o}),r[10]=l,r[11]=o,r[12]=s,r[13]=u,r[14]=d,r[15]=f):f=r[15],f},M=n=>{let r=m(14),i,a,o,s;r[0]===n?(i=r[1],a=r[2],o=r[3],s=r[4]):({"data-slot":a,className:i,ref:s,...o}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s);let c;r[5]===a?c=r[6]:(c=t(a,`alert-dialog-title`),r[5]=a,r[6]=c);let l;r[7]===i?l=r[8]:(l=e(`text-strong text-center text-lg font-medium sm:text-start`,i),r[7]=i,r[8]=l);let d;return r[9]!==o||r[10]!==s||r[11]!==c||r[12]!==l?(d=/* @__PURE__ */ v(u,{ref:s,"data-slot":c,className:l,...o}),r[9]=o,r[10]=s,r[11]=c,r[12]=l,r[13]=d):d=r[13],d},N=n=>{let r=m(14),i,a,o,s;r[0]===n?(i=r[1],a=r[2],o=r[3],s=r[4]):({"data-slot":a,className:i,ref:s,...o}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s);let c;r[5]===a?c=r[6]:(c=t(a,`alert-dialog-description`),r[5]=a,r[6]=c);let u;r[7]===i?u=r[8]:(u=e(`text-body text-center text-sm font-normal sm:text-start`,i),r[7]=i,r[8]=u);let d;return r[9]!==o||r[10]!==s||r[11]!==c||r[12]!==u?(d=/* @__PURE__ */ v(l,{ref:s,"data-slot":c,className:u,...o}),r[9]=o,r[10]=s,r[11]=c,r[12]=u,r[13]=d):d=r[13],d},P={danger:`danger`,info:`neutral`},F=e=>{let n=m(14),i,a,o,s,c;n[0]===e?(i=n[1],a=n[2],o=n[3],s=n[4],c=n[5]):({"data-slot":i,appearance:c,intent:a,ref:s,...o}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=o,n[4]=s,n[5]=c);let l=c===void 0?`filled`:c,u=C(),d=P[u.intent],f;n[6]===i?f=n[7]:(f=t(i,`alert-dialog-action`),n[6]=i,n[7]=f);let p=a??d,h;return n[8]!==l||n[9]!==o||n[10]!==s||n[11]!==f||n[12]!==p?(h=/* @__PURE__ */ v(r,{appearance:l,"data-slot":f,intent:p,ref:s,...o}),n[8]=l,n[9]=o,n[10]=s,n[11]=f,n[12]=p,n[13]=h):h=n[13],h},I=n=>{let i=m(18),a,o,s,c,l,u;i[0]===n?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6]):({"data-slot":o,appearance:l,className:a,intent:u,ref:c,...s}=n,i[0]=n,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l,i[6]=u);let f=l===void 0?`outlined`:l,p=u===void 0?`neutral`:u,h;i[7]===o?h=i[8]:(h=t(o,`alert-dialog-cancel`),i[7]=o,i[8]=h);let g;i[9]===a?g=i[10]:(g=e(`mt-2 sm:mt-0`,a),i[9]=a,i[10]=g);let _;return i[11]!==f||i[12]!==p||i[13]!==s||i[14]!==c||i[15]!==h||i[16]!==g?(_=/* @__PURE__ */ v(d,{asChild:!0,children:/* @__PURE__ */ v(r,{appearance:f,"data-slot":h,className:g,intent:p,ref:c,...s})}),i[11]=f,i[12]=p,i[13]=s,i[14]=c,i[15]=h,i[16]=g,i[17]=_):_=i[17],_},L={danger:/* @__PURE__ */ v(x,{}),info:/* @__PURE__ */ v(b,{})},R={danger:`text-danger-600`,info:`text-accent-600`},z={Root:w,Action:F,Body:k,Cancel:I,Close:e=>{let n=m(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,`alert-dialog-close`),n[4]=r,n[5]=o);let s;return n[6]!==i||n[7]!==a||n[8]!==o?(s=/* @__PURE__ */ v(d,{ref:a,"data-slot":o,...i}),n[6]=i,n[7]=a,n[8]=o,n[9]=s):s=n[9],s},Content:O,Description:N,Footer:j,Header:A,Icon:n=>{let r=m(17),i,a,o,s,c;r[0]===n?(i=r[1],a=r[2],o=r[3],s=r[4],c=r[5]):({"data-slot":a,className:i,ref:s,svg:c,...o}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=c);let l=C(),u=R[l.intent],d=L[l.intent],p;r[6]===a?p=r[7]:(p=t(a,`alert-dialog-icon`),r[6]=a,r[7]=p);let h;r[8]!==i||r[9]!==u?(h=e(`size-12 sm:size-7`,u,i),r[8]=i,r[9]=u,r[10]=h):h=r[10];let g=c??d,_;return r[11]!==o||r[12]!==s||r[13]!==p||r[14]!==h||r[15]!==g?(_=/* @__PURE__ */ v(f,{ref:s,"data-slot":p,className:h,svg:g,...o}),r[11]=o,r[12]=s,r[13]=p,r[14]=h,r[15]=g,r[16]=_):_=r[16],_},Title:M,Trigger:T};export{z as AlertDialog};
|
package/dist/alert.d.ts
CHANGED
package/dist/alert.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as Alert}from"./alert-
|
|
1
|
+
export{t as Alert}from"./alert-BkJHDx9X.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./icon-xb7d9M7X.js";import{t as r}from"./slot-B7rwscwd.js";import{c as i}from"react/compiler-runtime";import{Children as a,cloneElement as o,isValidElement as s}from"react";import c from"tiny-invariant";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";const f=t=>e(`cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-hidden focus-visible:ring-3 focus-visible:ring-focus-accent`,t),p=e=>{let p=i(72),g,_,v,y,b,x,S,C,w;p[0]===e?(g=p[1],_=p[2],v=p[3],y=p[4],b=p[5],x=p[6],S=p[7],C=p[8],w=p[9]):({"data-slot":y,asChild:g,children:_,className:v,rel:x,icon:b,iconPlacement:w,ref:C,...S}=e,p[0]=e,p[1]=g,p[2]=_,p[3]=v,p[4]=y,p[5]=b,p[6]=x,p[7]=S,p[8]=C,p[9]=w);let T=w===void 0?`start`:w,E;p[10]===x?E=p[11]:(E=h(x),p[10]=x,p[11]=E);let D=E;if(g){let e,i,h,g,x,w,E;if(p[12]!==_||p[13]!==v||p[14]!==y||p[15]!==b||p[16]!==T||p[17]!==S||p[18]!==C||p[19]!==D){let O=a.only(_);c(s(O),"When using `asChild`, Anchor must be passed a single child as a JSX tag.");let k=O.props?.children,A=S.target===`_blank`||O.props?.target===`_blank`;e=r,p[27]===y?i=p[28]:(i=t(y,`anchor`),p[27]=y,p[28]=i),p[29]===v?h=p[30]:(h=f(v),p[29]=v,p[30]=h),g=C,p[31]!==A||p[32]!==D?(x=D??m(A),p[31]=A,p[32]=D,p[33]=x):x=p[33],w=S;let j;p[34]!==b||p[35]!==T?(j=b&&T===`start`&&/* @__PURE__ */ u(n,{className:`inline-block mr-1.5`,svg:b}),p[34]=b,p[35]=T,p[36]=j):j=p[36];let M;p[37]!==b||p[38]!==T?(M=b&&T===`end`&&/* @__PURE__ */ u(n,{className:`inline-block ml-1.5`,svg:b}),p[37]=b,p[38]=T,p[39]=M):M=p[39],E=o(O,{},/* @__PURE__ */ d(l,{children:[j,/* @__PURE__ */ u(`span`,{"data-slot":`anchor-label`,children:k}),M]})),p[12]=_,p[13]=v,p[14]=y,p[15]=b,p[16]=T,p[17]=S,p[18]=C,p[19]=D,p[20]=e,p[21]=i,p[22]=h,p[23]=g,p[24]=x,p[25]=w,p[26]=E}else e=p[20],i=p[21],h=p[22],g=p[23],x=p[24],w=p[25],E=p[26];let O;return p[40]!==e||p[41]!==i||p[42]!==h||p[43]!==g||p[44]!==x||p[45]!==w||p[46]!==E?(O=/* @__PURE__ */ u(e,{"data-slot":i,className:h,ref:g,rel:x,...w,children:E}),p[40]=e,p[41]=i,p[42]=h,p[43]=g,p[44]=x,p[45]=w,p[46]=E,p[47]=O):O=p[47],O}let O;p[48]===y?O=p[49]:(O=t(y,`anchor`),p[48]=y,p[49]=O);let k;p[50]===v?k=p[51]:(k=f(v),p[50]=v,p[51]=k);let A;p[52]!==S||p[53]!==D?(A=D??m(S.target===`_blank`),p[52]=S,p[53]=D,p[54]=A):A=p[54];let j;p[55]!==b||p[56]!==T?(j=b&&T===`start`&&/* @__PURE__ */ u(n,{className:`inline-block mr-1.5`,svg:b}),p[55]=b,p[56]=T,p[57]=j):j=p[57];let M;p[58]===_?M=p[59]:(M=/* @__PURE__ */ u(`span`,{"data-slot":`anchor-label`,children:_}),p[58]=_,p[59]=M);let N;p[60]!==b||p[61]!==T?(N=b&&T===`end`&&/* @__PURE__ */ u(n,{className:`inline-block ml-1.5`,svg:b}),p[60]=b,p[61]=T,p[62]=N):N=p[62];let P;return p[63]!==S||p[64]!==C||p[65]!==O||p[66]!==k||p[67]!==A||p[68]!==j||p[69]!==M||p[70]!==N?(P=/* @__PURE__ */ d(`a`,{"data-slot":O,className:k,ref:C,rel:A,...S,children:[j,M,N]}),p[63]=S,p[64]=C,p[65]=O,p[66]=k,p[67]=A,p[68]=j,p[69]=M,p[70]=N,p[71]=P):P=p[71],P};function m(e){return e?`noopener noreferrer`:void 0}function h(e){return Array.isArray(e)?[...new Set(e)].map(e=>e?.trim()).filter(Boolean).toSorted().join(` `)||void 0:e?.trim()||void 0}export{f as n,h as r,p as t};
|
package/dist/anchor.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Anchor component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/navigation/anchor
|
|
5
|
+
*/
|
|
1
6
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
7
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
3
8
|
import { ComponentProps, ReactNode } from "react";
|
|
4
9
|
/**
|
|
5
10
|
* The rel attribute defines the relationship between a linked resource and the current document. Valid on <link>, <a>, <area>, and <form>, the supported values depend on the element on which the attribute is found.
|
|
@@ -37,7 +42,7 @@ type AnchorProps = Omit<ComponentProps<"a">, "rel"> & WithAsChild & WithDataSlot
|
|
|
37
42
|
rel?: Rel | (string & {}) | undefined | (Rel | (string & {}) | undefined | null)[];
|
|
38
43
|
};
|
|
39
44
|
/**
|
|
40
|
-
* A styled hyperlink
|
|
45
|
+
* A styled hyperlink: a native `<a>` with mantle's link styling, focus
|
|
41
46
|
* treatment, optional leading/trailing icon, and a safer default for the
|
|
42
47
|
* `rel` attribute. Use for links that point _outside_ the current
|
|
43
48
|
* application.
|
|
@@ -47,16 +52,16 @@ type AnchorProps = Omit<ComponentProps<"a">, "rel"> & WithAsChild & WithDataSlot
|
|
|
47
52
|
* - Links to files or `mailto:` / `tel:` destinations.
|
|
48
53
|
*
|
|
49
54
|
* **When not to use**
|
|
50
|
-
* - Internal application routes
|
|
55
|
+
* - Internal application routes: prefer the framework router's link
|
|
51
56
|
* primitive ({@link https://reactrouter.com/en/main/components/link `react-router` `<Link>`})
|
|
52
57
|
* so client-side navigation kicks in. You can keep mantle's styling by
|
|
53
58
|
* composing: `<Anchor asChild><Link to="/foo">…</Link></Anchor>`.
|
|
54
|
-
* - For triggering an action
|
|
59
|
+
* - For triggering an action: use a {@link https://mantle.ngrok.com/components/actions/button Button}
|
|
55
60
|
* instead. If it doesn't navigate, it's not a link.
|
|
56
61
|
*
|
|
57
62
|
* **Icons.** Pass `icon` (a phosphor or custom SVG) and optionally
|
|
58
63
|
* `iconPlacement` (`"start"` default, or `"end"`) to render a small inline
|
|
59
|
-
* icon
|
|
64
|
+
* icon. It suits "external link" or "download" affordances. Icons are
|
|
60
65
|
* decorative; the link text must still describe the destination on its own.
|
|
61
66
|
*
|
|
62
67
|
* **Security.** When `target="_blank"` and `rel` is omitted, the anchor
|
|
@@ -77,6 +82,13 @@ type AnchorProps = Omit<ComponentProps<"a">, "rel"> & WithAsChild & WithDataSlot
|
|
|
77
82
|
* | -------------- | ---------------- | --------------------------------------------------------------------------- |
|
|
78
83
|
* | `data-slot` | `"anchor-label"` | On the `<span>` wrapping `children`. Stable styling hook for the link text. |
|
|
79
84
|
*
|
|
85
|
+
* @useWhen Link to an address outside the app, such as an external site, a file, or a `mailto:`
|
|
86
|
+
* address.
|
|
87
|
+
*
|
|
88
|
+
* @siblings
|
|
89
|
+
* - `Button`: the control runs an action and does not navigate.
|
|
90
|
+
* - `Breadcrumb`: the links show the path from a root page to the current page.
|
|
91
|
+
*
|
|
80
92
|
* @see https://mantle.ngrok.com/components/navigation/anchor
|
|
81
93
|
*
|
|
82
94
|
* @example
|
package/dist/anchor.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{t as Anchor,n as anchorClassNames,r as resolveRel}from"./anchor-
|
|
1
|
+
export{t as Anchor,n as anchorClassNames,r as resolveRel}from"./anchor-Dc6IgvXV.js";
|
package/dist/app-layout.d.ts
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the AppLayout compound component: a viewport-locked
|
|
3
|
+
* application shell with a full-width notice strip, a workspace row holding
|
|
4
|
+
* the app's columns, a rounded content card whose page region
|
|
5
|
+
* (`AppLayout.Body`) is the shell's only scroll container, and an optional
|
|
6
|
+
* side panel that opens beside the card.
|
|
7
|
+
*
|
|
8
|
+
* @see https://mantle.ngrok.com/layouts/app-layout
|
|
9
|
+
*/
|
|
1
10
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
3
|
-
import { n as IconButtonProps } from "./button-
|
|
11
|
+
import { t as WithDataSlot } from "./data-slot-BW8KQ9Xo.js";
|
|
12
|
+
import { n as IconButtonProps } from "./button-DnYv7IOT.js";
|
|
4
13
|
import { ComponentProps, ReactNode } from "react";
|
|
5
14
|
/**
|
|
6
15
|
* The outer frame of an application shell. Renders a `<div>` with
|
|
7
16
|
* `relative isolate flex h-full w-full flex-col overflow-clip`, so
|
|
8
|
-
* it fills its nearest sized ancestor
|
|
17
|
+
* it fills its nearest sized ancestor. That makes it embeddable in docs
|
|
9
18
|
* demos and tests. Real app shells pin it to the viewport by merging
|
|
10
19
|
* `className="fixed inset-0"` (mantle `cx` is tailwind-merge-backed, so the
|
|
11
|
-
* override is deterministic); the shell itself never scrolls
|
|
20
|
+
* override is deterministic); the shell itself never scrolls. Only
|
|
12
21
|
* `AppLayout.Body` does.
|
|
13
22
|
*
|
|
14
23
|
* It clips with `overflow-clip` rather than `overflow-hidden` for the same
|
|
15
24
|
* reason `AppLayout.Content` does: `hidden` **is** a scroll container that
|
|
16
25
|
* paints no scrollbar, so anything wider than the frame lets focus scroll the
|
|
17
|
-
* entire shell sideways
|
|
18
|
-
* view with no scrollbar and no gesture to bring them back. On a frame pinned
|
|
26
|
+
* entire shell sideways. That translates the notice, the rail, and the card out
|
|
27
|
+
* of view with no scrollbar and no gesture to bring them back. On a frame pinned
|
|
19
28
|
* with `fixed inset-0` that is the whole window. `clip` is not a scroll
|
|
20
29
|
* container at all.
|
|
21
30
|
*
|
|
@@ -57,14 +66,14 @@ import { ComponentProps, ReactNode } from "react";
|
|
|
57
66
|
*/
|
|
58
67
|
declare const Root: ({ asChild, children, className, "data-slot": dataSlot, ...props }: ComponentProps<"div"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
59
68
|
/**
|
|
60
|
-
* A full-window-width strip pinned above everything else in the shell
|
|
61
|
-
* including any sidebar
|
|
69
|
+
* A full-window-width strip pinned above everything else in the shell
|
|
70
|
+
* (including any sidebar) for maintenance notices, environment warnings,
|
|
62
71
|
* and similar app-wide messaging. It is a vertical composition slot: place a
|
|
63
72
|
* maintenance banner and an `AlertCenter.Bar` here, and each contributes its
|
|
64
73
|
* own row while the slot pushes the shell down. Renders an unstyled `<div>`
|
|
65
74
|
* (`flex w-full shrink-0 flex-col`): its children bring their own colors and
|
|
66
75
|
* layout, and the part collapses to nothing when empty. Deliberately not named
|
|
67
|
-
* `Banner` so it never reads as the ARIA `banner` landmark
|
|
76
|
+
* `Banner` so it never reads as the ARIA `banner` landmark: it claims no
|
|
68
77
|
* landmark at all.
|
|
69
78
|
*
|
|
70
79
|
* @see https://mantle.ngrok.com/layouts/app-layout#applayoutnotice
|
|
@@ -162,11 +171,11 @@ declare const Workspace: ({ asChild, children, className, "data-slot": dataSlot,
|
|
|
162
171
|
* the sidebar, holding `AppLayout.Header` and `AppLayout.Body`. A flex column
|
|
163
172
|
* that fills the remaining width of
|
|
164
173
|
* `AppLayout.Workspace` and insets itself from the window edge and the rail with
|
|
165
|
-
* its own margin (`--app-layout-card-gutter`, default `0.5rem`)
|
|
174
|
+
* its own margin (`--app-layout-card-gutter`, default `0.5rem`). The gutter
|
|
166
175
|
* belongs to the card so a rail stays flush against the window edge.
|
|
167
176
|
*
|
|
168
177
|
* The card does **not** scroll: `AppLayout.Body` does. `Content` is
|
|
169
|
-
* `overflow-clip`, which does two jobs
|
|
178
|
+
* `overflow-clip`, which does two jobs: it keeps a full-bleed page background
|
|
170
179
|
* from painting square corners over the card's `rounded-xl`, and it is
|
|
171
180
|
* deliberately `clip` rather than `hidden` because `hidden` is a scroll
|
|
172
181
|
* container with no scrollbar: a long toolbar would let focus scroll the card
|
|
@@ -413,7 +422,7 @@ declare const HeaderContent: ({ asChild, children, className, "data-slot": dataS
|
|
|
413
422
|
declare const HeaderActions: ({ asChild, children, className, "data-slot": dataSlot, ...props }: ComponentProps<"div"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
414
423
|
/**
|
|
415
424
|
* The page region of the content card, and the shell's **only** scroll
|
|
416
|
-
* container (`overflow-y-auto overscroll-none`)
|
|
425
|
+
* container (`overflow-y-auto overscroll-none`). The page body never scrolls,
|
|
417
426
|
* and scroll never bounces the shell. Render it after `AppLayout.Header` inside
|
|
418
427
|
* `AppLayout.Content`.
|
|
419
428
|
*
|
|
@@ -435,17 +444,17 @@ declare const HeaderActions: ({ asChild, children, className, "data-slot": dataS
|
|
|
435
444
|
* - `min-h-0 flex-1` gives it a definite height, so a page that asks for
|
|
436
445
|
* `h-full` fills exactly the card interior instead of overflowing it by the
|
|
437
446
|
* toolbar's height.
|
|
438
|
-
* - block layout inside
|
|
447
|
+
* - block layout inside (not flex) is why `mx-auto max-w-7xl` still centers a
|
|
439
448
|
* page at its max width. As a *flex child*, auto margins beat
|
|
440
449
|
* `align-items: stretch` and the same container shrink-to-fits, getting
|
|
441
450
|
* *narrower* as the viewport gets wider.
|
|
442
451
|
* - `w-full` states the width outright instead of leaning on the flex
|
|
443
452
|
* container's cross-axis `stretch`, so an `mx-auto` merged onto `Body` still
|
|
444
|
-
* leaves it full width
|
|
453
|
+
* leaves it full width. Auto cross-axis margins would otherwise turn a
|
|
445
454
|
* stretched item into a shrink-to-fit one. It is no floor, though: `cx` is
|
|
446
455
|
* tailwind-merge-backed and the consumer's `className` wins, so a merged
|
|
447
|
-
* `w-*` replaces it outright, while a merged `max-w-*`
|
|
448
|
-
* group
|
|
456
|
+
* `w-*` replaces it outright, while a merged `max-w-*` (a separate conflict
|
|
457
|
+
* group) survives beside it and clamps the scrollport. Constrain the *page*
|
|
449
458
|
* inside `Body`, not `Body` itself.
|
|
450
459
|
*
|
|
451
460
|
* It is `relative` too, so page content positioned with `absolute` is contained
|
|
@@ -1173,6 +1182,12 @@ declare const SidePanelFooter: ({ asChild, children, className, "data-slot": dat
|
|
|
1173
1182
|
* bottom bar is exactly what most consumers want. Make the page's root a flex
|
|
1174
1183
|
* column instead; see the docs' "Sizing a page to the card".
|
|
1175
1184
|
*
|
|
1185
|
+
* @useWhen Frame a signed-in app with navigation that persists across routes: a sidebar, a header
|
|
1186
|
+
* toolbar, and one scrolling content card.
|
|
1187
|
+
*
|
|
1188
|
+
* @siblings
|
|
1189
|
+
* - `CenteredLayout`: the page is one focused flow with no sidebar, such as sign-in, onboarding, or a 404 page.
|
|
1190
|
+
*
|
|
1176
1191
|
* @see https://mantle.ngrok.com/layouts/app-layout
|
|
1177
1192
|
*
|
|
1178
1193
|
* @example
|
|
@@ -1349,8 +1364,8 @@ declare const AppLayout: {
|
|
|
1349
1364
|
readonly Workspace: typeof Workspace;
|
|
1350
1365
|
/**
|
|
1351
1366
|
* The rounded `bg-card` surface beside the sidebar, holding the toolbar and
|
|
1352
|
-
* the page region. Insets itself with `--app-layout-card-gutter
|
|
1353
|
-
* scroll
|
|
1367
|
+
* the page region. Insets itself with `--app-layout-card-gutter`. It does not
|
|
1368
|
+
* scroll: `AppLayout.Body` does.
|
|
1354
1369
|
*
|
|
1355
1370
|
* @see https://mantle.ngrok.com/layouts/app-layout#applayoutcontent
|
|
1356
1371
|
*
|
package/dist/app-layout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./compose-refs-sFdxsL7k.js";import{t}from"./cx-CK7o_rVv.js";import{t as n}from"./data-slot-EM6s2WEU.js";import{t as r}from"./slot-DdYN1L1C.js";import{t as i}from"./button-B8k98Pby.js";import{r as a}from"./alert-DO00UiQe.js";import{u as o}from"./primitive-Dz9Al-us.js";import{n as s,r as c,t as l}from"./use-swipe-to-dismiss-DceYk1Id.js";import{t as u}from"./use-is-hydrated-after-paint-r9Cl2mGp.js";import{t as d}from"./use-matches-media-query-m860lols.js";import{t as f}from"./main-CC1L9IsH.js";import{t as p}from"./tooltip-b6oiTaWq.js";import{n as m}from"./cookie-ca4g5CKp.js";import{c as h}from"react/compiler-runtime";import{createContext as g,useContext as _,useEffect as v,useId as y,useLayoutEffect as b,useRef as x,useState as S}from"react";import C from"tiny-invariant";import{jsx as w,jsxs as T}from"react/jsx-runtime";import{SidebarSimpleIcon as E}from"@phosphor-icons/react/SidebarSimple";const D=e=>{let i=h(16),a,o,s,c,l;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?r:`div`,d;i[6]===c?d=i[7]:(d=n(c,`app-layout`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=t(`group/app-layout bg-base relative isolate flex h-full w-full flex-col`,`overflow-clip`,s),i[8]=s,i[9]=f);let p;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(p=/* @__PURE__ */ w(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=p):p=i[15],p},O=e=>{let i=h(16),a,o,s,c,l;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?r:`div`,d;i[6]===c?d=i[7]:(d=n(c,`app-layout-notice`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=t(`flex w-full shrink-0 flex-col`,s),i[8]=s,i[9]=f);let p;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(p=/* @__PURE__ */ w(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=p):p=i[15],p},k=e=>{let i=h(16),a,o,s,c,l;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?r:`div`,d;i[6]===c?d=i[7]:(d=n(c,`app-layout-workspace`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=t(`flex min-h-0 flex-1`,`min-w-0`,`relative`,`@container/app-layout-workspace`,s),i[8]=s,i[9]=f);let p;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(p=/* @__PURE__ */ w(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=p):p=i[15],p},A=e=>{let i=h(16),a,o,s,c,l;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?r:`div`,d;i[6]===c?d=i[7]:(d=n(c,`app-layout-content`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=t(`bg-card border-card-muted relative flex min-w-0 flex-1 flex-col rounded-xl border shadow-sm`,`m-(--app-layout-card-gutter,0.5rem)`,`overflow-clip`,s),i[8]=s,i[9]=f);let p;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(p=/* @__PURE__ */ w(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=p):p=i[15],p},j=`h-14 group-has-data-[slot~=sidebar-header]/app-layout:h-[calc(var(--sidebar-header-height,4.5rem)-2*var(--app-layout-card-gutter,0.5rem)-2px)]`,M=e=>{let i=h(16),a,o,s,c,l;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?r:`div`,d;i[6]===c?d=i[7]:(d=n(c,`app-layout-header`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=t(`border-card-muted flex shrink-0 items-center gap-2 border-b px-4`,j,s),i[8]=s,i[9]=f);let p;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(p=/* @__PURE__ */ w(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=p):p=i[15],p},ee=e=>{let i=h(16),a,o,s,c,l;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?r:`div`,d;i[6]===c?d=i[7]:(d=n(c,`app-layout-header-start`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=t(`flex shrink-0 items-center gap-2`,s),i[8]=s,i[9]=f);let p;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(p=/* @__PURE__ */ w(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=p):p=i[15],p},N=e=>{let i=h(16),a,o,s,c,l;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?r:`div`,d;i[6]===c?d=i[7]:(d=n(c,`app-layout-header-content`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=t(`flex min-w-0 flex-1 items-center gap-2`,s),i[8]=s,i[9]=f);let p;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(p=/* @__PURE__ */ w(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=p):p=i[15],p},P=e=>{let i=h(16),a,o,s,c,l;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?r:`div`,d;i[6]===c?d=i[7]:(d=n(c,`app-layout-header-actions`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=t(`ml-auto flex shrink-0 items-center gap-2`,s),i[8]=s,i[9]=f);let p;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(p=/* @__PURE__ */ w(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=p):p=i[15],p},F=e=>{let i=h(16),a,o,s,c,l;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?r:f,d;i[6]===c?d=i[7]:(d=n(c,`app-layout-body`),i[6]=c,i[7]=d);let p;i[8]===s?p=i[9]:(p=t(`scrollbar relative min-h-0 w-full flex-1 overflow-y-auto overscroll-none`,s),i[8]=s,i[9]=p);let m;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==p?(m=/* @__PURE__ */ w(u,{"data-slot":d,className:p,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=p,i[15]=m):m=i[15],m},te={sm:`sm:@min-side-panel-lane/app-layout-workspace:data-state-closed:basis-0 sm:[[data-slot~=app-layout-workspace]:not(:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed])))_&]:@min-side-panel-lane-icon-rail/app-layout-workspace:data-state-closed:basis-0 max-sm:absolute max-sm:inset-y-(--app-layout-card-gutter,0.5rem) max-sm:left-(--app-layout-card-gutter,0.5rem) max-sm:right-(--app-layout-card-gutter,0.5rem) max-sm:z-20 max-sm:my-0 max-sm:rounded-xl max-sm:shadow-lg max-sm:[--_side-panel-content-width:100%] max-sm:[--_side-panel-content-inset:0px] max-sm:data-state-closed:translate-x-[calc(100%+var(--app-layout-card-gutter,0.5rem))] max-sm:data-state-closed:invisible`,md:`md:@min-side-panel-lane/app-layout-workspace:data-state-closed:basis-0 md:[[data-slot~=app-layout-workspace]:not(:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed])))_&]:@min-side-panel-lane-icon-rail/app-layout-workspace:data-state-closed:basis-0 max-md:absolute max-md:inset-y-(--app-layout-card-gutter,0.5rem) max-md:right-(--app-layout-card-gutter,0.5rem) max-md:z-20 max-md:my-0 max-md:w-[min(24rem,calc(100cqw-5rem))] max-md:rounded-xl max-md:shadow-lg max-md:[--_side-panel-content-width:100%] max-md:[--_side-panel-content-inset:0px] max-md:data-state-closed:translate-x-[calc(100%+var(--app-layout-card-gutter,0.5rem))] max-md:data-state-closed:invisible max-sm:left-(--app-layout-card-gutter,0.5rem) max-sm:w-auto`,lg:`lg:@min-side-panel-lane/app-layout-workspace:data-state-closed:basis-0 lg:[[data-slot~=app-layout-workspace]:not(:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed])))_&]:@min-side-panel-lane-icon-rail/app-layout-workspace:data-state-closed:basis-0 max-lg:absolute max-lg:inset-y-(--app-layout-card-gutter,0.5rem) max-lg:right-(--app-layout-card-gutter,0.5rem) max-lg:z-20 max-lg:my-0 max-lg:w-[min(24rem,calc(100cqw-5rem))] max-lg:rounded-xl max-lg:shadow-lg max-lg:[--_side-panel-content-width:100%] max-lg:[--_side-panel-content-inset:0px] max-lg:data-state-closed:translate-x-[calc(100%+var(--app-layout-card-gutter,0.5rem))] max-lg:data-state-closed:invisible max-md:left-(--app-layout-card-gutter,0.5rem) max-md:w-auto`},ne={sm:`sm:@max-side-panel-lane-icon-rail/app-layout-workspace:w-[min(24rem,calc(100cqw-5rem))] sm:[[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:w-[min(24rem,calc(100cqw-5rem))]`,md:`sm:@max-side-panel-lane-icon-rail/app-layout-workspace:w-[min(24rem,calc(100cqw-5rem))] sm:[[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:w-[min(24rem,calc(100cqw-5rem))]`,lg:`md:@max-side-panel-lane-icon-rail/app-layout-workspace:w-[min(24rem,calc(100cqw-5rem))] md:[[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:w-[min(24rem,calc(100cqw-5rem))]`},re={sm:`(width < 40rem)`,md:`(width < 40rem)`,lg:`(width < 48rem)`};function ie(e){return e!=null&&getComputedStyle(e).position===`absolute`}function I(e){return e.split(`,`).map(e=>Number.parseFloat(e)||0)}function ae(e){let t=getComputedStyle(e),n=I(t.transitionDuration),r=I(t.transitionDelay),i=t.transitionProperty.split(`,`).map((e,t)=>(n[t%n.length]??0)+(r[t%r.length]??0));return Math.max(0,...i)*1e3}const L=g(null);function R(){let e=_(L);return C(e,`useSidePanel must be used within AppLayout.SidePanelRoot.`),e.state}function oe(e){let t=_(L);return C(t,`AppLayout.${e} must be rendered inside AppLayout.SidePanelRoot.`),t}const z=e=>{let t=h(19),{children:n,defaultOpen:r,onOpenChange:i,open:o}=e,s=r!==void 0&&r,c=y(),l=o!=null,[u,d]=S(s),f=l?o:u,p=x(i),m;t[0]===i?m=t[1]:(m=()=>{p.current=i},t[0]=i,t[1]=m),b(m);let g=x(null),_=x(null),v;t[2]===l?v=t[3]:(v=e=>{l||d(e),p.current?.(e)},t[2]=l,t[3]=v);let C=v,T;t[4]!==f||t[5]!==C?(T=()=>{C(!f)},t[4]=f,t[5]=C,t[6]=T):T=t[6];let E=T,D,O;t[7]!==f||t[8]!==c?(D=()=>{if(f)return;let e=g.current;if(g.current=null,e==null)return;let t=document.getElementById(c),n=document.activeElement,r=t!=null&&t.contains(n),i=n===document.body;if(!r&&!i)return;let o=document.querySelectorAll(`[aria-controls="${c}"]`);for(let e of o)if(!(t!=null&&t.contains(e)||!a(e))&&(e.focus(),document.activeElement===e))return},O=[f,c],t[7]=f,t[8]=c,t[9]=D,t[10]=O):(D=t[9],O=t[10]),b(D,O);let k;t[11]!==f||t[12]!==c||t[13]!==C||t[14]!==E?(k={lastFocusedInsideRef:g,panelRef:_,state:{open:f,panelId:c,setOpen:C,toggle:E}},t[11]=f,t[12]=c,t[13]=C,t[14]=E,t[15]=k):k=t[15];let A=k,j;return t[16]!==n||t[17]!==A?(j=/* @__PURE__ */ w(L.Provider,{value:A,children:n}),t[16]=n,t[17]=A,t[18]=j):j=t[18],j},B=r=>{let i=h(53),a,l,f,p,m,g,_,y,b;i[0]===r?(a=i[1],l=i[2],f=i[3],p=i[4],m=i[5],g=i[6],_=i[7],y=i[8],b=i[9]):({children:a,className:l,"data-slot":f,mobileBreakpoint:b,onBlur:p,onFocus:m,onKeyDown:g,ref:y,..._}=r,i[0]=r,i[1]=a,i[2]=l,i[3]=f,i[4]=p,i[5]=m,i[6]=g,i[7]=_,i[8]=y,i[9]=b);let C=b===void 0?`lg`:b,{lastFocusedInsideRef:T,panelRef:E,state:D}=oe(`SidePanel`),{open:O,panelId:k,setOpen:A}=D,j=u(),M=e(y,E),[ee,N]=S(!O);O&&ee&&N(!1);let P,F;i[10]!==O||i[11]!==E?(P=()=>{if(O)return;let e=E.current;if(e==null)return;let t=setTimeout(()=>N(!0),ae(e));return()=>clearTimeout(t)},F=[O,E],i[10]=O,i[11]=E,i[12]=P,i[13]=F):(P=i[12],F=i[13]),v(P,F);let I=d(re[C]),L=O&&I,R;i[14]===L?R=i[15]:(R={active:L},i[14]=L,i[15]=R),s(E,R);let z;i[16]===L?z=i[17]:(z={active:L},i[16]=L,i[17]=z),c(E,z);let B=x(!1),V,H;i[18]===E?(V=i[19],H=i[20]):(V=()=>{let e=E.current;if(e==null)return;let t=t=>{t.key===`Escape`&&(B.current=o(e,t.target))};return document.addEventListener(`keydown`,t,!0),()=>{document.removeEventListener(`keydown`,t,!0)}},H=[E],i[18]=E,i[19]=V,i[20]=H),v(V,H);let U;i[21]===f?U=i[22]:(U=n(f,`app-layout-side-panel`),i[21]=f,i[22]=U);let W=!O&&ee&&`transition-none`,G=te[C],K=ne[C],q;i[23]!==l||i[24]!==W||i[25]!==G||i[26]!==K?(q=t(`relative min-w-0`,`isolate`,`overflow-x-clip`,`[--_side-panel-content-width:var(--app-layout-side-panel-width,clamp(21rem,24cqw,27rem))] [--_side-panel-content-inset:var(--app-layout-card-gutter,0.5rem)] [--_side-panel-box-width:calc(var(--app-layout-side-panel-width,clamp(21rem,24cqw,27rem))+var(--app-layout-card-gutter,0.5rem))]`,`grow-0 shrink-0 basis-(--_side-panel-box-width)`,`my-(--app-layout-card-gutter,0.5rem) mr-0 ml-0`,`transition-[flex-basis,translate,visibility] duration-200 ease-out-strong motion-reduce:transition-none not-data-hydrated:transition-none`,W,`data-state-closed:pointer-events-none`,G,`@max-side-panel-lane-icon-rail/app-layout-workspace:absolute @max-side-panel-lane-icon-rail/app-layout-workspace:inset-y-(--app-layout-card-gutter,0.5rem) @max-side-panel-lane-icon-rail/app-layout-workspace:right-(--app-layout-card-gutter,0.5rem) @max-side-panel-lane-icon-rail/app-layout-workspace:z-20 @max-side-panel-lane-icon-rail/app-layout-workspace:my-0 @max-side-panel-lane-icon-rail/app-layout-workspace:rounded-xl @max-side-panel-lane-icon-rail/app-layout-workspace:shadow-lg @max-side-panel-lane-icon-rail/app-layout-workspace:[--_side-panel-content-width:100%] @max-side-panel-lane-icon-rail/app-layout-workspace:[--_side-panel-content-inset:0px] @max-side-panel-lane-icon-rail/app-layout-workspace:data-state-closed:translate-x-[calc(100%+var(--app-layout-card-gutter,0.5rem))] @max-side-panel-lane-icon-rail/app-layout-workspace:data-state-closed:invisible`,`[[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:absolute [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:inset-y-(--app-layout-card-gutter,0.5rem) [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:right-(--app-layout-card-gutter,0.5rem) [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:z-20 [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:my-0 [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:rounded-xl [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:shadow-lg [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:[--_side-panel-content-width:100%] [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:[--_side-panel-content-inset:0px] [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:data-state-closed:translate-x-[calc(100%+var(--app-layout-card-gutter,0.5rem))] [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:data-state-closed:invisible`,K,l),i[23]=l,i[24]=W,i[25]=G,i[26]=K,i[27]=q):q=i[27];let J;i[28]!==T||i[29]!==m?(J=e=>{m?.(e),T.current=e.target},i[28]=T,i[29]=m,i[30]=J):J=i[30];let Y;i[31]!==T||i[32]!==p?(Y=e=>{p?.(e),e.relatedTarget!=null&&!e.currentTarget.contains(e.relatedTarget)&&(T.current=null)},i[31]=T,i[32]=p,i[33]=Y):Y=i[33];let X;i[34]!==g||i[35]!==A?(X=e=>{g?.(e),!(e.defaultPrevented||e.key!==`Escape`)&&ie(e.currentTarget)&&(B.current?B.current=!1:(e.preventDefault(),A(!1)))},i[34]=g,i[35]=A,i[36]=X):X=i[36];let se=O?`open`:`closed`,ce=j?``:void 0,le=!O,Z;i[37]===Symbol.for(`react.memo_cache_sentinel`)?(Z=t(`bg-card border-card-muted absolute inset-y-0 flex flex-col rounded-xl border shadow-sm`,`right-(--_side-panel-content-inset) w-(--_side-panel-content-width)`,`overflow-clip`),i[37]=Z):Z=i[37];let Q;i[38]===a?Q=i[39]:(Q=/* @__PURE__ */ w(`div`,{className:Z,children:a}),i[38]=a,i[39]=Q);let $;return i[40]!==M||i[41]!==k||i[42]!==_||i[43]!==q||i[44]!==J||i[45]!==Y||i[46]!==X||i[47]!==se||i[48]!==ce||i[49]!==le||i[50]!==Q||i[51]!==U?($=/* @__PURE__ */ w(`aside`,{ref:M,"data-slot":U,className:q,onFocus:J,onBlur:Y,onKeyDown:X,..._,id:k,"data-state":se,"data-hydrated":ce,inert:le,children:Q}),i[40]=M,i[41]=k,i[42]=_,i[43]=q,i[44]=J,i[45]=Y,i[46]=X,i[47]=se,i[48]=ce,i[49]=le,i[50]=Q,i[51]=U,i[52]=$):$=i[52],$},V=/* @__PURE__ */ w(E,{mirrored:!0}),H={Root:D,Notice:O,Workspace:k,Content:A,Header:M,HeaderStart:ee,HeaderContent:N,HeaderActions:P,Body:F,SidePanelRoot:z,SidePanel:B,SidePanelTrigger:e=>{let t=h(31),r,a,o,s,c,l,u,d;t[0]===e?(r=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8]):({appearance:s,"data-slot":r,icon:c,intent:l,label:u,onClick:a,size:d,...o}=e,t[0]=e,t[1]=r,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d);let f=s===void 0?`ghost`:s,m=c===void 0?V:c,g=l===void 0?`neutral`:l,_=u===void 0?`Toggle side panel`:u,v=d===void 0?`sm`:d,{open:y,panelId:b,toggle:x}=oe(`SidePanelTrigger`).state,S;t[9]===r?S=t[10]:(S=n(r,`app-layout-side-panel-trigger`),t[9]=r,t[10]=S);let C=y?`open`:`closed`,E;t[11]!==a||t[12]!==x?(E=e=>{a?.(e),e.defaultPrevented||x()},t[11]=a,t[12]=x,t[13]=E):E=t[13];let D;t[14]!==f||t[15]!==m||t[16]!==g||t[17]!==_||t[18]!==y||t[19]!==b||t[20]!==o||t[21]!==v||t[22]!==S||t[23]!==C||t[24]!==E?(D=/* @__PURE__ */ w(p.Trigger,{asChild:!0,children:/* @__PURE__ */ w(i,{appearance:f,"aria-controls":b,"aria-expanded":y,"data-slot":S,"data-state":C,icon:m,intent:g,label:_,onClick:E,size:v,...o})}),t[14]=f,t[15]=m,t[16]=g,t[17]=_,t[18]=y,t[19]=b,t[20]=o,t[21]=v,t[22]=S,t[23]=C,t[24]=E,t[25]=D):D=t[25];let O;t[26]===_?O=t[27]:(O=/* @__PURE__ */ w(p.Content,{"data-slot":`app-layout-side-panel-trigger-tooltip`,children:_}),t[26]=_,t[27]=O);let k;return t[28]!==O||t[29]!==D?(k=/* @__PURE__ */ T(p.Root,{children:[D,O]}),t[28]=O,t[29]=D,t[30]=k):k=t[30],k},SidePanelHeader:i=>{let a=h(27),o,s,c,u,d,f;a[0]===i?(o=a[1],s=a[2],c=a[3],u=a[4],d=a[5],f=a[6]):({asChild:o,children:s,className:c,"data-slot":u,ref:f,...d}=i,a[0]=i,a[1]=o,a[2]=s,a[3]=c,a[4]=u,a[5]=d,a[6]=f);let p=o?r:`div`,m=_(L),g=x(null),v=e(f,g),y=m?.panelRef,b=m?.state.setOpen,S=m!=null,C;a[7]===y?.current?C=a[8]:(C=()=>ie(y?.current??null)?`translate`:`flex-basis`,a[7]=y?.current,a[8]=C);let T;a[9]===b?T=a[10]:(T=()=>{b?.(!1)},a[9]=b,a[10]=T);let E;a[11]!==y||a[12]!==S||a[13]!==C||a[14]!==T?(E={target:y,active:S,property:C,onDismiss:T},a[11]=y,a[12]=S,a[13]=C,a[14]=T,a[15]=E):E=a[15],l(g,E);let D;a[16]===u?D=a[17]:(D=n(u,`app-layout-side-panel-header`),a[16]=u,a[17]=D);let O;a[18]===c?O=a[19]:(O=t(`border-card-muted flex shrink-0 items-center gap-2 border-b px-4`,`touch-pan-y`,j,c),a[18]=c,a[19]=O);let k;return a[20]!==p||a[21]!==s||a[22]!==v||a[23]!==d||a[24]!==D||a[25]!==O?(k=/* @__PURE__ */ w(p,{ref:v,"data-slot":D,className:O,...d,children:s}),a[20]=p,a[21]=s,a[22]=v,a[23]=d,a[24]=D,a[25]=O,a[26]=k):k=a[26],k},SidePanelBody:e=>{let i=h(16),a,o,s,c,l;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?r:`div`,d;i[6]===c?d=i[7]:(d=n(c,`app-layout-side-panel-body`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=t(`scrollbar relative min-h-0 w-full flex-1 overflow-y-auto overscroll-none`,s),i[8]=s,i[9]=f);let p;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(p=/* @__PURE__ */ w(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=p):p=i[15],p},SidePanelFooter:e=>{let i=h(16),a,o,s,c,l;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?r:`div`,d;i[6]===c?d=i[7]:(d=n(c,`app-layout-side-panel-footer`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=t(`flex shrink-0 flex-col gap-2 px-3 pb-3`,s),i[8]=s,i[9]=f);let p;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(p=/* @__PURE__ */ w(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=p):p=i[15],p}},U=`mantle-side-panel-state`,W={closed:`closed`,open:`open`};function G(e){let t=m(e,U);if(t===W.open)return!0;if(t===W.closed)return!1}function K(e,t={}){let{domain:n,maxAge:r=31536e3,path:i=`/`,sameSite:a=`Lax`,secure:o=!1}=t,s=e?W.open:W.closed,c=[`${U}=${s}`,`Max-Age=${r}`,`Path=${i}`];return n!=null&&c.push(`Domain=${n}`),c.push(`SameSite=${a}`),o&&c.push(`Secure`),c.join(`; `)}export{H as AppLayout,U as SIDE_PANEL_STATE_COOKIE_NAME,G as extractSidePanelStateCookie,K as serializeSidePanelStateCookie,R as useSidePanel};
|
|
1
|
+
"use client";import{n as e,t}from"./use-inert-siblings-C4RHXrZc.js";import{t as n}from"./use-is-hydrated-after-paint-CrHt3OHw.js";import{t as r}from"./use-matches-media-query-FfvtNKQe.js";import{n as i}from"./use-swipe-to-dismiss-BYdlca8r.js";import{t as a}from"./use-composed-refs-DPYmLDSe.js";import{t as o}from"./cx-CK7o_rVv.js";import{t as s}from"./data-slot-EM6s2WEU.js";import{r as c}from"./alert-DO00UiQe.js";import{u as l}from"./primitive-D8CzV_Ft.js";import{t as u}from"./button-B9bChDgl.js";import{t as d}from"./main-CHyWYDak.js";import{t as f}from"./slot-B7rwscwd.js";import{t as p}from"./tooltip-DQO40Mrq.js";import{n as m}from"./cookie-ca4g5CKp.js";import{c as h}from"react/compiler-runtime";import{createContext as g,useContext as _,useEffect as v,useId as y,useLayoutEffect as b,useRef as x,useState as S}from"react";import C from"tiny-invariant";import{jsx as w,jsxs as T}from"react/jsx-runtime";import{SidebarSimpleIcon as E}from"@phosphor-icons/react/SidebarSimple";const D=e=>{let t=h(16),n,r,i,a,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],c=t[5]):({asChild:n,children:r,className:i,"data-slot":a,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=c);let l=n?f:`div`,u;t[6]===a?u=t[7]:(u=s(a,`app-layout`),t[6]=a,t[7]=u);let d;t[8]===i?d=t[9]:(d=o(`group/app-layout bg-base relative isolate flex h-full w-full flex-col`,`overflow-clip`,i),t[8]=i,t[9]=d);let p;return t[10]!==l||t[11]!==r||t[12]!==c||t[13]!==u||t[14]!==d?(p=/* @__PURE__ */ w(l,{"data-slot":u,className:d,...c,children:r}),t[10]=l,t[11]=r,t[12]=c,t[13]=u,t[14]=d,t[15]=p):p=t[15],p},O=e=>{let t=h(16),n,r,i,a,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],c=t[5]):({asChild:n,children:r,className:i,"data-slot":a,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=c);let l=n?f:`div`,u;t[6]===a?u=t[7]:(u=s(a,`app-layout-notice`),t[6]=a,t[7]=u);let d;t[8]===i?d=t[9]:(d=o(`flex w-full shrink-0 flex-col`,i),t[8]=i,t[9]=d);let p;return t[10]!==l||t[11]!==r||t[12]!==c||t[13]!==u||t[14]!==d?(p=/* @__PURE__ */ w(l,{"data-slot":u,className:d,...c,children:r}),t[10]=l,t[11]=r,t[12]=c,t[13]=u,t[14]=d,t[15]=p):p=t[15],p},k=e=>{let t=h(16),n,r,i,a,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],c=t[5]):({asChild:n,children:r,className:i,"data-slot":a,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=c);let l=n?f:`div`,u;t[6]===a?u=t[7]:(u=s(a,`app-layout-workspace`),t[6]=a,t[7]=u);let d;t[8]===i?d=t[9]:(d=o(`flex min-h-0 flex-1`,`min-w-0`,`relative`,`@container/app-layout-workspace`,i),t[8]=i,t[9]=d);let p;return t[10]!==l||t[11]!==r||t[12]!==c||t[13]!==u||t[14]!==d?(p=/* @__PURE__ */ w(l,{"data-slot":u,className:d,...c,children:r}),t[10]=l,t[11]=r,t[12]=c,t[13]=u,t[14]=d,t[15]=p):p=t[15],p},A=e=>{let t=h(16),n,r,i,a,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],c=t[5]):({asChild:n,children:r,className:i,"data-slot":a,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=c);let l=n?f:`div`,u;t[6]===a?u=t[7]:(u=s(a,`app-layout-content`),t[6]=a,t[7]=u);let d;t[8]===i?d=t[9]:(d=o(`bg-card border-card-muted relative flex min-w-0 flex-1 flex-col rounded-xl border shadow-sm`,`m-(--app-layout-card-gutter,0.5rem)`,`overflow-clip`,i),t[8]=i,t[9]=d);let p;return t[10]!==l||t[11]!==r||t[12]!==c||t[13]!==u||t[14]!==d?(p=/* @__PURE__ */ w(l,{"data-slot":u,className:d,...c,children:r}),t[10]=l,t[11]=r,t[12]=c,t[13]=u,t[14]=d,t[15]=p):p=t[15],p},j=`h-14 group-has-data-[slot~=sidebar-header]/app-layout:h-[calc(var(--sidebar-header-height,4.5rem)-2*var(--app-layout-card-gutter,0.5rem)-2px)]`,M=e=>{let t=h(16),n,r,i,a,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],c=t[5]):({asChild:n,children:r,className:i,"data-slot":a,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=c);let l=n?f:`div`,u;t[6]===a?u=t[7]:(u=s(a,`app-layout-header`),t[6]=a,t[7]=u);let d;t[8]===i?d=t[9]:(d=o(`border-card-muted flex shrink-0 items-center gap-2 border-b px-4`,j,i),t[8]=i,t[9]=d);let p;return t[10]!==l||t[11]!==r||t[12]!==c||t[13]!==u||t[14]!==d?(p=/* @__PURE__ */ w(l,{"data-slot":u,className:d,...c,children:r}),t[10]=l,t[11]=r,t[12]=c,t[13]=u,t[14]=d,t[15]=p):p=t[15],p},ee=e=>{let t=h(16),n,r,i,a,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],c=t[5]):({asChild:n,children:r,className:i,"data-slot":a,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=c);let l=n?f:`div`,u;t[6]===a?u=t[7]:(u=s(a,`app-layout-header-start`),t[6]=a,t[7]=u);let d;t[8]===i?d=t[9]:(d=o(`flex shrink-0 items-center gap-2`,i),t[8]=i,t[9]=d);let p;return t[10]!==l||t[11]!==r||t[12]!==c||t[13]!==u||t[14]!==d?(p=/* @__PURE__ */ w(l,{"data-slot":u,className:d,...c,children:r}),t[10]=l,t[11]=r,t[12]=c,t[13]=u,t[14]=d,t[15]=p):p=t[15],p},N=e=>{let t=h(16),n,r,i,a,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],c=t[5]):({asChild:n,children:r,className:i,"data-slot":a,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=c);let l=n?f:`div`,u;t[6]===a?u=t[7]:(u=s(a,`app-layout-header-content`),t[6]=a,t[7]=u);let d;t[8]===i?d=t[9]:(d=o(`flex min-w-0 flex-1 items-center gap-2`,i),t[8]=i,t[9]=d);let p;return t[10]!==l||t[11]!==r||t[12]!==c||t[13]!==u||t[14]!==d?(p=/* @__PURE__ */ w(l,{"data-slot":u,className:d,...c,children:r}),t[10]=l,t[11]=r,t[12]=c,t[13]=u,t[14]=d,t[15]=p):p=t[15],p},P=e=>{let t=h(16),n,r,i,a,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],c=t[5]):({asChild:n,children:r,className:i,"data-slot":a,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=c);let l=n?f:`div`,u;t[6]===a?u=t[7]:(u=s(a,`app-layout-header-actions`),t[6]=a,t[7]=u);let d;t[8]===i?d=t[9]:(d=o(`ml-auto flex shrink-0 items-center gap-2`,i),t[8]=i,t[9]=d);let p;return t[10]!==l||t[11]!==r||t[12]!==c||t[13]!==u||t[14]!==d?(p=/* @__PURE__ */ w(l,{"data-slot":u,className:d,...c,children:r}),t[10]=l,t[11]=r,t[12]=c,t[13]=u,t[14]=d,t[15]=p):p=t[15],p},F=e=>{let t=h(16),n,r,i,a,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],c=t[5]):({asChild:n,children:r,className:i,"data-slot":a,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=c);let l=n?f:d,u;t[6]===a?u=t[7]:(u=s(a,`app-layout-body`),t[6]=a,t[7]=u);let p;t[8]===i?p=t[9]:(p=o(`scrollbar relative min-h-0 w-full flex-1 overflow-y-auto overscroll-none`,i),t[8]=i,t[9]=p);let m;return t[10]!==l||t[11]!==r||t[12]!==c||t[13]!==u||t[14]!==p?(m=/* @__PURE__ */ w(l,{"data-slot":u,className:p,...c,children:r}),t[10]=l,t[11]=r,t[12]=c,t[13]=u,t[14]=p,t[15]=m):m=t[15],m},te={sm:`sm:@min-side-panel-lane/app-layout-workspace:data-state-closed:basis-0 sm:[[data-slot~=app-layout-workspace]:not(:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed])))_&]:@min-side-panel-lane-icon-rail/app-layout-workspace:data-state-closed:basis-0 max-sm:absolute max-sm:inset-y-(--app-layout-card-gutter,0.5rem) max-sm:left-(--app-layout-card-gutter,0.5rem) max-sm:right-(--app-layout-card-gutter,0.5rem) max-sm:z-20 max-sm:my-0 max-sm:rounded-xl max-sm:shadow-lg max-sm:[--_side-panel-content-width:100%] max-sm:[--_side-panel-content-inset:0px] max-sm:data-state-closed:translate-x-[calc(100%+var(--app-layout-card-gutter,0.5rem))] max-sm:data-state-closed:invisible`,md:`md:@min-side-panel-lane/app-layout-workspace:data-state-closed:basis-0 md:[[data-slot~=app-layout-workspace]:not(:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed])))_&]:@min-side-panel-lane-icon-rail/app-layout-workspace:data-state-closed:basis-0 max-md:absolute max-md:inset-y-(--app-layout-card-gutter,0.5rem) max-md:right-(--app-layout-card-gutter,0.5rem) max-md:z-20 max-md:my-0 max-md:w-[min(24rem,calc(100cqw-5rem))] max-md:rounded-xl max-md:shadow-lg max-md:[--_side-panel-content-width:100%] max-md:[--_side-panel-content-inset:0px] max-md:data-state-closed:translate-x-[calc(100%+var(--app-layout-card-gutter,0.5rem))] max-md:data-state-closed:invisible max-sm:left-(--app-layout-card-gutter,0.5rem) max-sm:w-auto`,lg:`lg:@min-side-panel-lane/app-layout-workspace:data-state-closed:basis-0 lg:[[data-slot~=app-layout-workspace]:not(:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed])))_&]:@min-side-panel-lane-icon-rail/app-layout-workspace:data-state-closed:basis-0 max-lg:absolute max-lg:inset-y-(--app-layout-card-gutter,0.5rem) max-lg:right-(--app-layout-card-gutter,0.5rem) max-lg:z-20 max-lg:my-0 max-lg:w-[min(24rem,calc(100cqw-5rem))] max-lg:rounded-xl max-lg:shadow-lg max-lg:[--_side-panel-content-width:100%] max-lg:[--_side-panel-content-inset:0px] max-lg:data-state-closed:translate-x-[calc(100%+var(--app-layout-card-gutter,0.5rem))] max-lg:data-state-closed:invisible max-md:left-(--app-layout-card-gutter,0.5rem) max-md:w-auto`},ne={sm:`sm:@max-side-panel-lane-icon-rail/app-layout-workspace:w-[min(24rem,calc(100cqw-5rem))] sm:[[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:w-[min(24rem,calc(100cqw-5rem))]`,md:`sm:@max-side-panel-lane-icon-rail/app-layout-workspace:w-[min(24rem,calc(100cqw-5rem))] sm:[[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:w-[min(24rem,calc(100cqw-5rem))]`,lg:`md:@max-side-panel-lane-icon-rail/app-layout-workspace:w-[min(24rem,calc(100cqw-5rem))] md:[[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:w-[min(24rem,calc(100cqw-5rem))]`},re={sm:`(width < 40rem)`,md:`(width < 40rem)`,lg:`(width < 48rem)`};function ie(e){return e!=null&&getComputedStyle(e).position===`absolute`}function I(e){return e.split(`,`).map(e=>Number.parseFloat(e)||0)}function ae(e){let t=getComputedStyle(e),n=I(t.transitionDuration),r=I(t.transitionDelay),i=t.transitionProperty.split(`,`).map((e,t)=>(n[t%n.length]??0)+(r[t%r.length]??0));return Math.max(0,...i)*1e3}const L=g(null);function R(){let e=_(L);return C(e,`useSidePanel must be used within AppLayout.SidePanelRoot.`),e.state}function oe(e){let t=_(L);return C(t,`AppLayout.${e} must be rendered inside AppLayout.SidePanelRoot.`),t}const z=e=>{let t=h(19),{children:n,defaultOpen:r,onOpenChange:i,open:a}=e,o=r!==void 0&&r,s=y(),l=a!=null,[u,d]=S(o),f=l?a:u,p=x(i),m;t[0]===i?m=t[1]:(m=()=>{p.current=i},t[0]=i,t[1]=m),b(m);let g=x(null),_=x(null),v;t[2]===l?v=t[3]:(v=e=>{l||d(e),p.current?.(e)},t[2]=l,t[3]=v);let C=v,T;t[4]!==f||t[5]!==C?(T=()=>{C(!f)},t[4]=f,t[5]=C,t[6]=T):T=t[6];let E=T,D,O;t[7]!==f||t[8]!==s?(D=()=>{if(f)return;let e=g.current;if(g.current=null,e==null)return;let t=document.getElementById(s),n=document.activeElement,r=t!=null&&t.contains(n),i=n===document.body;if(!r&&!i)return;let a=document.querySelectorAll(`[aria-controls="${s}"]`);for(let e of a)if(!(t!=null&&t.contains(e)||!c(e))&&(e.focus(),document.activeElement===e))return},O=[f,s],t[7]=f,t[8]=s,t[9]=D,t[10]=O):(D=t[9],O=t[10]),b(D,O);let k;t[11]!==f||t[12]!==s||t[13]!==C||t[14]!==E?(k={lastFocusedInsideRef:g,panelRef:_,state:{open:f,panelId:s,setOpen:C,toggle:E}},t[11]=f,t[12]=s,t[13]=C,t[14]=E,t[15]=k):k=t[15];let A=k,j;return t[16]!==n||t[17]!==A?(j=/* @__PURE__ */ w(L.Provider,{value:A,children:n}),t[16]=n,t[17]=A,t[18]=j):j=t[18],j},B=i=>{let c=h(53),u,d,f,p,m,g,_,y,b;c[0]===i?(u=c[1],d=c[2],f=c[3],p=c[4],m=c[5],g=c[6],_=c[7],y=c[8],b=c[9]):({children:u,className:d,"data-slot":f,mobileBreakpoint:b,onBlur:p,onFocus:m,onKeyDown:g,ref:y,..._}=i,c[0]=i,c[1]=u,c[2]=d,c[3]=f,c[4]=p,c[5]=m,c[6]=g,c[7]=_,c[8]=y,c[9]=b);let C=b===void 0?`lg`:b,{lastFocusedInsideRef:T,panelRef:E,state:D}=oe(`SidePanel`),{open:O,panelId:k,setOpen:A}=D,j=n(),M=a(y,E),[ee,N]=S(!O);O&&ee&&N(!1);let P,F;c[10]!==O||c[11]!==E?(P=()=>{if(O)return;let e=E.current;if(e==null)return;let t=setTimeout(()=>N(!0),ae(e));return()=>clearTimeout(t)},F=[O,E],c[10]=O,c[11]=E,c[12]=P,c[13]=F):(P=c[12],F=c[13]),v(P,F);let I=r(re[C]),L=O&&I,R;c[14]===L?R=c[15]:(R={active:L},c[14]=L,c[15]=R),t(E,R);let z;c[16]===L?z=c[17]:(z={active:L},c[16]=L,c[17]=z),e(E,z);let B=x(!1),V,H;c[18]===E?(V=c[19],H=c[20]):(V=()=>{let e=E.current;if(e==null)return;let t=t=>{t.key===`Escape`&&(B.current=l(e,t.target))};return document.addEventListener(`keydown`,t,!0),()=>{document.removeEventListener(`keydown`,t,!0)}},H=[E],c[18]=E,c[19]=V,c[20]=H),v(V,H);let U;c[21]===f?U=c[22]:(U=s(f,`app-layout-side-panel`),c[21]=f,c[22]=U);let W=!O&&ee&&`transition-none`,G=te[C],K=ne[C],q;c[23]!==d||c[24]!==W||c[25]!==G||c[26]!==K?(q=o(`relative min-w-0`,`isolate`,`overflow-x-clip`,`[--_side-panel-content-width:var(--app-layout-side-panel-width,clamp(21rem,24cqw,27rem))] [--_side-panel-content-inset:var(--app-layout-card-gutter,0.5rem)] [--_side-panel-box-width:calc(var(--app-layout-side-panel-width,clamp(21rem,24cqw,27rem))+var(--app-layout-card-gutter,0.5rem))]`,`grow-0 shrink-0 basis-(--_side-panel-box-width)`,`my-(--app-layout-card-gutter,0.5rem) mr-0 ml-0`,`transition-[flex-basis,translate,visibility] duration-200 ease-out-strong motion-reduce:transition-none not-data-hydrated:transition-none`,W,`data-state-closed:pointer-events-none`,G,`@max-side-panel-lane-icon-rail/app-layout-workspace:absolute @max-side-panel-lane-icon-rail/app-layout-workspace:inset-y-(--app-layout-card-gutter,0.5rem) @max-side-panel-lane-icon-rail/app-layout-workspace:right-(--app-layout-card-gutter,0.5rem) @max-side-panel-lane-icon-rail/app-layout-workspace:z-20 @max-side-panel-lane-icon-rail/app-layout-workspace:my-0 @max-side-panel-lane-icon-rail/app-layout-workspace:rounded-xl @max-side-panel-lane-icon-rail/app-layout-workspace:shadow-lg @max-side-panel-lane-icon-rail/app-layout-workspace:[--_side-panel-content-width:100%] @max-side-panel-lane-icon-rail/app-layout-workspace:[--_side-panel-content-inset:0px] @max-side-panel-lane-icon-rail/app-layout-workspace:data-state-closed:translate-x-[calc(100%+var(--app-layout-card-gutter,0.5rem))] @max-side-panel-lane-icon-rail/app-layout-workspace:data-state-closed:invisible`,`[[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:absolute [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:inset-y-(--app-layout-card-gutter,0.5rem) [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:right-(--app-layout-card-gutter,0.5rem) [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:z-20 [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:my-0 [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:rounded-xl [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:shadow-lg [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:[--_side-panel-content-width:100%] [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:[--_side-panel-content-inset:0px] [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:data-state-closed:translate-x-[calc(100%+var(--app-layout-card-gutter,0.5rem))] [[data-slot~=app-layout-workspace]:has(>[data-slot~=sidebar-nav]:not([data-state~=collapsed]))_&]:@max-side-panel-lane/app-layout-workspace:data-state-closed:invisible`,K,d),c[23]=d,c[24]=W,c[25]=G,c[26]=K,c[27]=q):q=c[27];let J;c[28]!==T||c[29]!==m?(J=e=>{m?.(e),T.current=e.target},c[28]=T,c[29]=m,c[30]=J):J=c[30];let Y;c[31]!==T||c[32]!==p?(Y=e=>{p?.(e),e.relatedTarget!=null&&!e.currentTarget.contains(e.relatedTarget)&&(T.current=null)},c[31]=T,c[32]=p,c[33]=Y):Y=c[33];let X;c[34]!==g||c[35]!==A?(X=e=>{g?.(e),e.defaultPrevented||e.key!==`Escape`||ie(e.currentTarget)&&(B.current?B.current=!1:(e.preventDefault(),A(!1)))},c[34]=g,c[35]=A,c[36]=X):X=c[36];let se=O?`open`:`closed`,ce=j?``:void 0,le=!O,Z;c[37]===Symbol.for(`react.memo_cache_sentinel`)?(Z=o(`bg-card border-card-muted absolute inset-y-0 flex flex-col rounded-xl border shadow-sm`,`right-(--_side-panel-content-inset) w-(--_side-panel-content-width)`,`overflow-clip`),c[37]=Z):Z=c[37];let Q;c[38]===u?Q=c[39]:(Q=/* @__PURE__ */ w(`div`,{className:Z,children:u}),c[38]=u,c[39]=Q);let $;return c[40]!==M||c[41]!==k||c[42]!==_||c[43]!==q||c[44]!==J||c[45]!==Y||c[46]!==X||c[47]!==se||c[48]!==ce||c[49]!==le||c[50]!==Q||c[51]!==U?($=/* @__PURE__ */ w(`aside`,{ref:M,"data-slot":U,className:q,onFocus:J,onBlur:Y,onKeyDown:X,..._,id:k,"data-state":se,"data-hydrated":ce,inert:le,children:Q}),c[40]=M,c[41]=k,c[42]=_,c[43]=q,c[44]=J,c[45]=Y,c[46]=X,c[47]=se,c[48]=ce,c[49]=le,c[50]=Q,c[51]=U,c[52]=$):$=c[52],$},V=/* @__PURE__ */ w(E,{mirrored:!0}),H={Root:D,Notice:O,Workspace:k,Content:A,Header:M,HeaderStart:ee,HeaderContent:N,HeaderActions:P,Body:F,SidePanelRoot:z,SidePanel:B,SidePanelTrigger:e=>{let t=h(31),n,r,i,a,o,c,l,d;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],l=t[7],d=t[8]):({appearance:a,"data-slot":n,icon:o,intent:c,label:l,onClick:r,size:d,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=l,t[8]=d);let f=a===void 0?`ghost`:a,m=o===void 0?V:o,g=c===void 0?`neutral`:c,_=l===void 0?`Toggle side panel`:l,v=d===void 0?`sm`:d,{open:y,panelId:b,toggle:x}=oe(`SidePanelTrigger`).state,S;t[9]===n?S=t[10]:(S=s(n,`app-layout-side-panel-trigger`),t[9]=n,t[10]=S);let C=y?`open`:`closed`,E;t[11]!==r||t[12]!==x?(E=e=>{r?.(e),e.defaultPrevented||x()},t[11]=r,t[12]=x,t[13]=E):E=t[13];let D;t[14]!==f||t[15]!==m||t[16]!==g||t[17]!==_||t[18]!==y||t[19]!==b||t[20]!==i||t[21]!==v||t[22]!==S||t[23]!==C||t[24]!==E?(D=/* @__PURE__ */ w(p.Trigger,{asChild:!0,children:/* @__PURE__ */ w(u,{appearance:f,"aria-controls":b,"aria-expanded":y,"data-slot":S,"data-state":C,icon:m,intent:g,label:_,onClick:E,size:v,...i})}),t[14]=f,t[15]=m,t[16]=g,t[17]=_,t[18]=y,t[19]=b,t[20]=i,t[21]=v,t[22]=S,t[23]=C,t[24]=E,t[25]=D):D=t[25];let O;t[26]===_?O=t[27]:(O=/* @__PURE__ */ w(p.Content,{"data-slot":`app-layout-side-panel-trigger-tooltip`,children:_}),t[26]=_,t[27]=O);let k;return t[28]!==O||t[29]!==D?(k=/* @__PURE__ */ T(p.Root,{children:[D,O]}),t[28]=O,t[29]=D,t[30]=k):k=t[30],k},SidePanelHeader:e=>{let t=h(27),n,r,c,l,u,d;t[0]===e?(n=t[1],r=t[2],c=t[3],l=t[4],u=t[5],d=t[6]):({asChild:n,children:r,className:c,"data-slot":l,ref:d,...u}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=c,t[4]=l,t[5]=u,t[6]=d);let p=n?f:`div`,m=_(L),g=x(null),v=a(d,g),y=m?.panelRef,b=m?.state.setOpen,S=m!=null,C;t[7]===y?C=t[8]:(C=()=>ie(y?.current??null)?`translate`:`flex-basis`,t[7]=y,t[8]=C);let T;t[9]===b?T=t[10]:(T=()=>{b?.(!1)},t[9]=b,t[10]=T);let E;t[11]!==y||t[12]!==S||t[13]!==C||t[14]!==T?(E={target:y,active:S,property:C,onDismiss:T},t[11]=y,t[12]=S,t[13]=C,t[14]=T,t[15]=E):E=t[15],i(g,E);let D;t[16]===l?D=t[17]:(D=s(l,`app-layout-side-panel-header`),t[16]=l,t[17]=D);let O;t[18]===c?O=t[19]:(O=o(`border-card-muted flex shrink-0 items-center gap-2 border-b px-4`,`touch-pan-y`,j,c),t[18]=c,t[19]=O);let k;return t[20]!==p||t[21]!==r||t[22]!==v||t[23]!==u||t[24]!==D||t[25]!==O?(k=/* @__PURE__ */ w(p,{ref:v,"data-slot":D,className:O,...u,children:r}),t[20]=p,t[21]=r,t[22]=v,t[23]=u,t[24]=D,t[25]=O,t[26]=k):k=t[26],k},SidePanelBody:e=>{let t=h(16),n,r,i,a,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],c=t[5]):({asChild:n,children:r,className:i,"data-slot":a,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=c);let l=n?f:`div`,u;t[6]===a?u=t[7]:(u=s(a,`app-layout-side-panel-body`),t[6]=a,t[7]=u);let d;t[8]===i?d=t[9]:(d=o(`scrollbar relative min-h-0 w-full flex-1 overflow-y-auto overscroll-none`,i),t[8]=i,t[9]=d);let p;return t[10]!==l||t[11]!==r||t[12]!==c||t[13]!==u||t[14]!==d?(p=/* @__PURE__ */ w(l,{"data-slot":u,className:d,...c,children:r}),t[10]=l,t[11]=r,t[12]=c,t[13]=u,t[14]=d,t[15]=p):p=t[15],p},SidePanelFooter:e=>{let t=h(16),n,r,i,a,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],c=t[5]):({asChild:n,children:r,className:i,"data-slot":a,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=c);let l=n?f:`div`,u;t[6]===a?u=t[7]:(u=s(a,`app-layout-side-panel-footer`),t[6]=a,t[7]=u);let d;t[8]===i?d=t[9]:(d=o(`flex shrink-0 flex-col gap-2 px-3 pb-3`,i),t[8]=i,t[9]=d);let p;return t[10]!==l||t[11]!==r||t[12]!==c||t[13]!==u||t[14]!==d?(p=/* @__PURE__ */ w(l,{"data-slot":u,className:d,...c,children:r}),t[10]=l,t[11]=r,t[12]=c,t[13]=u,t[14]=d,t[15]=p):p=t[15],p}},U=`mantle-side-panel-state`,W={closed:`closed`,open:`open`};function G(e){let t=m(e,U);if(t===W.open)return!0;if(t===W.closed)return!1}function K(e,t={}){let{domain:n,maxAge:r=31536e3,path:i=`/`,sameSite:a=`Lax`,secure:o=!1}=t,s=e?W.open:W.closed,c=[`${U}=${s}`,`Max-Age=${r}`,`Path=${i}`];return n!=null&&c.push(`Domain=${n}`),c.push(`SameSite=${a}`),o&&c.push(`Secure`),c.join(`; `)}export{H as AppLayout,U as SIDE_PANEL_STATE_COOKIE_NAME,G as extractSidePanelStateCookie,K as serializeSidePanelStateCookie,R as useSidePanel};
|