@ngrok/mantle 0.83.7 → 0.83.9
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/dist/agent.json +1 -1
- package/dist/{alert-BQdon-PF.d.ts → alert-Blmunr_D.d.ts} +1 -1
- package/dist/{alert-cszhDIVl.js → alert-DDjzRuGa.js} +1 -1
- package/dist/alert-center.d.ts +1 -1
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +27 -16
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js +1 -1
- package/dist/area-chart.d.ts +1 -1
- package/dist/area-chart.js +1 -1
- package/dist/bar-chart.d.ts +1 -1
- package/dist/bar-chart.js +1 -1
- package/dist/{button-DkUUma3k.d.ts → button-C39M5h4K.d.ts} +20 -3
- package/dist/button-CC10rP6X.js +1 -0
- package/dist/{button-BsfLZ42S.d.ts → button-CRCNRnk6.d.ts} +1 -1
- package/dist/button.d.ts +2 -2
- package/dist/button.js +1 -1
- package/dist/{chart-G2pIR4uW.js → chart-BDxpXPfo.js} +1 -1
- package/dist/{chart-TWkSYqAs.d.ts → chart-DgaWVBqi.d.ts} +10 -4
- package/dist/code-block.d.ts +9 -2
- package/dist/code-block.js +1 -1
- package/dist/combobox.d.ts +20 -15
- package/dist/command.d.ts +1 -1
- package/dist/command.js +1 -1
- package/dist/data-table.d.ts +1 -1
- package/dist/data-table.js +1 -1
- package/dist/{dialog-DJ6jSRyj.d.ts → dialog-CEk0L7M7.d.ts} +23 -15
- package/dist/dialog-CnlaqHNh.js +1 -0
- package/dist/{dialog-BM4wPCft.d.ts → dialog-u8PtHYES.d.ts} +7 -1
- package/dist/dialog.d.ts +2 -2
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-CNaaABck.d.ts +1 -0
- package/dist/{dropdown-menu-DZOfj6HB.d.ts → dropdown-menu-CpsUJGbn.d.ts} +34 -16
- package/dist/dropdown-menu-DJDrRzDU.js +1 -0
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/dropdown-menu.js +1 -1
- package/dist/field.d.ts +2 -2
- package/dist/field.js +1 -1
- package/dist/hover-card.d.ts +60 -16
- package/dist/hover-card.js +1 -1
- package/dist/input.js +1 -1
- package/dist/layer-container-CglTh9-6.js +1 -0
- package/dist/layer-container.d.ts +57 -0
- package/dist/layer-container.js +1 -0
- package/dist/line-chart.d.ts +1 -1
- package/dist/line-chart.js +1 -1
- package/dist/llms.txt +1 -1
- package/dist/mantle.css +54 -1
- package/dist/multi-select.d.ts +25 -15
- package/dist/multi-select.js +1 -1
- package/dist/pagination.d.ts +2 -2
- package/dist/pagination.js +1 -1
- package/dist/popover-D6x6Bq-G.js +1 -0
- package/dist/{popover-C9fEVWL1.d.ts → popover-DDuw1UaJ.d.ts} +24 -12
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +1 -1
- package/dist/primitive-BWyxJnXn.js +1 -0
- package/dist/scatter-plot.d.ts +1 -1
- package/dist/scatter-plot.js +1 -1
- package/dist/select-BK6n6OIK.js +1 -0
- package/dist/{select-DVHmgih8.d.ts → select-DkFkSYBP.d.ts} +30 -15
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/sheet-BcfnKUit.js +1 -0
- package/dist/sheet.d.ts +24 -16
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +5 -6
- package/dist/sidebar.js +1 -1
- package/dist/split-button.d.ts +2 -2
- package/dist/split-button.js +1 -1
- package/dist/theme-switcher.d.ts +8 -8
- package/dist/theme-switcher.js +1 -1
- package/dist/{tooltip-DuXGxIse.d.ts → tooltip-BKWK5c7_.d.ts} +30 -15
- package/dist/tooltip-BZRRJgpm.js +1 -0
- package/dist/tooltip.d.ts +1 -1
- package/dist/tooltip.js +1 -1
- package/package.json +5 -5
- package/dist/button-CNg69RsV.js +0 -1
- package/dist/dialog-BYILOABg.js +0 -1
- package/dist/dropdown-menu-BRH0Wd_z.js +0 -1
- package/dist/dropdown-menu-BcALUQMp.d.ts +0 -1
- package/dist/popover-B1ZzHCym.js +0 -1
- package/dist/primitive-D-9GIFWb.js +0 -1
- package/dist/select-LK9NX-vV.js +0 -1
- package/dist/sheet-CfFXVAzz.js +0 -1
- package/dist/tooltip-Dnu35cjU.js +0 -1
package/dist/multi-select.d.ts
CHANGED
|
@@ -21,9 +21,11 @@ type MultiSelectProps = Primitive.ComboboxProviderProps<string[]>;
|
|
|
21
21
|
* combobox input — so a native form submit sends the selected values, not the
|
|
22
22
|
* typeahead filter text.
|
|
23
23
|
*
|
|
24
|
-
* `MultiSelect.Content` renders at Tailwind `z-50
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* `MultiSelect.Content` renders at Tailwind `z-50` and portals into the closest
|
|
25
|
+
* `data-mantle-modal-content` element — an enclosing overlay's content — else
|
|
26
|
+
* the nearest overlay's positioner, else `document.body`. Inside an overlay it
|
|
27
|
+
* paints above the content that contains
|
|
28
|
+
* it. Outside one, an open overlay (`z-60`) covers it.
|
|
27
29
|
*
|
|
28
30
|
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectroot
|
|
29
31
|
*
|
|
@@ -206,9 +208,11 @@ type MultiSelectContentProps = Omit<Primitive.ComboboxPopoverProps, "render"> &
|
|
|
206
208
|
* Renders a popover that contains multi-select content, such as items, groups,
|
|
207
209
|
* and separators. Opens below the trigger.
|
|
208
210
|
*
|
|
209
|
-
* `MultiSelect.Content` renders at Tailwind `z-50
|
|
210
|
-
*
|
|
211
|
-
*
|
|
211
|
+
* `MultiSelect.Content` renders at Tailwind `z-50` and portals into the closest
|
|
212
|
+
* `data-mantle-modal-content` element — an enclosing overlay's content — else
|
|
213
|
+
* the nearest overlay's positioner, else `document.body`. Inside an overlay it
|
|
214
|
+
* paints above the content that contains
|
|
215
|
+
* it. Outside one, an open overlay (`z-60`) covers it.
|
|
212
216
|
*
|
|
213
217
|
* By default, mantle disables Ariakit's body scroll lock when the trigger is
|
|
214
218
|
* inside a mantle modal (`Dialog`, `Sheet`, `AlertDialog`) — the modal already
|
|
@@ -411,9 +415,11 @@ declare const ContentFooter: ({ className, children, ref, ...props }: MultiSelec
|
|
|
411
415
|
* items rendered as removable tags/chips. For single selection, use Combobox (with search)
|
|
412
416
|
* or Select (without).
|
|
413
417
|
*
|
|
414
|
-
* `MultiSelect.Content` renders at Tailwind `z-50
|
|
415
|
-
*
|
|
416
|
-
*
|
|
418
|
+
* `MultiSelect.Content` renders at Tailwind `z-50` and portals into the closest
|
|
419
|
+
* `data-mantle-modal-content` element — an enclosing overlay's content — else
|
|
420
|
+
* the nearest overlay's positioner, else `document.body`. Inside an overlay it
|
|
421
|
+
* paints above the content that contains
|
|
422
|
+
* it. Outside one, an open overlay (`z-60`) covers it.
|
|
417
423
|
*
|
|
418
424
|
* @see https://mantle.ngrok.com/components/forms/multi-select
|
|
419
425
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
|
|
@@ -460,9 +466,11 @@ declare const MultiSelect: {
|
|
|
460
466
|
* items rendered as removable tags/chips. For single selection, use Combobox (with search)
|
|
461
467
|
* or Select (without).
|
|
462
468
|
*
|
|
463
|
-
* `MultiSelect.Content` renders at Tailwind `z-50
|
|
464
|
-
*
|
|
465
|
-
*
|
|
469
|
+
* `MultiSelect.Content` renders at Tailwind `z-50` and portals into the
|
|
470
|
+
* closest `data-mantle-modal-content` element — an enclosing overlay's content
|
|
471
|
+
* — else the nearest overlay's positioner, else `document.body`. Inside an
|
|
472
|
+
* overlay it paints above the content that contains it. Outside one, an open
|
|
473
|
+
* overlay (`z-60`) covers it.
|
|
466
474
|
*
|
|
467
475
|
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectroot
|
|
468
476
|
*
|
|
@@ -584,9 +592,11 @@ declare const MultiSelect: {
|
|
|
584
592
|
/**
|
|
585
593
|
* Renders a popover that contains multi-select content.
|
|
586
594
|
*
|
|
587
|
-
* `MultiSelect.Content` renders at Tailwind `z-50
|
|
588
|
-
*
|
|
589
|
-
*
|
|
595
|
+
* `MultiSelect.Content` renders at Tailwind `z-50` and portals into the
|
|
596
|
+
* closest `data-mantle-modal-content` element — an enclosing overlay's content
|
|
597
|
+
* — else the nearest overlay's positioner, else `document.body`. Inside an
|
|
598
|
+
* overlay it paints above the content that contains it. Outside one, an open
|
|
599
|
+
* overlay (`z-60`) covers it.
|
|
590
600
|
*
|
|
591
601
|
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectcontent
|
|
592
602
|
*
|
package/dist/multi-select.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./icon-lZ48P8Nn.js";import{t as r}from"./slot-DpNWVci8.js";import{a as i,r as a}from"./field-Bpptk_9t.js";import{t as o}from"./field-B1wqeZr4.js";import{n as s}from"./separator-D0D6VyyM.js";import{t as c}from"./use-prefers-reduced-motion-Bk5zAfHY.js";import{createContext as l,useCallback as u,useContext as d,useEffect as f,useMemo as p,useRef as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{XIcon as y}from"@phosphor-icons/react/X";import{CheckIcon as b}from"@phosphor-icons/react/Check";import*as x from"@ariakit/react";import{LockIcon as S}from"@phosphor-icons/react/Lock";const C=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),w=[],T=l({current:null}),E=l({current:[]}),D=l({onInputKeyDownRef:{current:void 0},inputRef:{current:null}}),O=({children:e,defaultSelectedValue:t=w,...n})=>{let r=m(null),i=m(void 0),a=m(null),o=m([]),s=p(()=>({onInputKeyDownRef:i,inputRef:a}),[]);return _(T.Provider,{value:r,children:_(D.Provider,{value:s,children:_(E.Provider,{value:o,children:_(x.ComboboxProvider,{defaultSelectedValue:t,...n,children:e})})})})},k=({"aria-invalid":n,className:r,children:o,onKeyDown:s,onMouseDown:c,ref:l,validation:u,...f})=>{let p=d(T),{inputRef:m}=d(D),h=x.useComboboxContext(),g=i(),{validation:v}=a({"aria-invalid":n,validation:u??g});return _(`div`,{role:`group`,"data-slot":`multi-select-trigger`,className:t(`cursor-text select-none font-sans text-sm`,`border-form bg-form text-strong flex min-h-9 w-full flex-wrap items-center gap-1 rounded-md border px-3 py-1 has-[[data-slot=multi-select-tag]]:px-1`,`has-focus:outline-hidden has-focus-within:ring-4 has-aria-expanded:ring-4`,`has-focus-within:border-accent-600 has-focus-within:ring-focus-accent has-aria-expanded:border-accent-600 has-aria-expanded:ring-focus-accent`,`data-validation-success:border-success-600 data-validation-success:has-focus-within:border-success-600 data-validation-success:has-focus-within:ring-focus-success data-validation-success:has-aria-expanded:border-success-600 data-validation-success:has-aria-expanded:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:has-focus-within:border-warning-600 data-validation-warning:has-focus-within:ring-focus-warning data-validation-warning:has-aria-expanded:border-warning-600 data-validation-warning:has-aria-expanded:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:has-focus-within:border-danger-600 data-validation-error:has-focus-within:ring-focus-danger data-validation-error:has-aria-expanded:border-danger-600 data-validation-error:has-aria-expanded:ring-focus-danger`,r),"data-validation":v||void 0,onKeyDown:e=>{e.key===`Escape`&&h?.getState().open&&(e.preventDefault(),h.hide()),s?.(e)},onMouseDown:e=>{e.target instanceof HTMLElement&&!e.target.closest(`button, input, [role='option']`)&&(e.preventDefault(),m.current?.focus()),c?.(e)},ref:e(p,l),...f,children:o})},A=({className:r,value:i,onRemove:a,locked:o=!1,onKeyDown:s,ref:c,...l})=>{let u=m(null);return v(`span`,{ref:e(u,c),role:`option`,"aria-selected":!0,tabIndex:-1,"data-slot":`multi-select-tag`,"data-locked":o||void 0,className:t(`cursor-default bg-neutral-500/10 border border-neutral-500/20 rounded-xs text-strong inline-flex items-center gap-1 pl-2 pr-0.5 py-0.5 text-sm font-normal`,`focus-visible:outline-hidden focus-visible:border-accent-600/50 focus-visible:ring-3 focus-visible:ring-focus-accent`,r),onKeyDown:e=>{if(o&&(e.key===`Backspace`||e.key===`Delete`)){e.preventDefault(),M(e.currentTarget);return}s?.(e)},...l,children:[i,_(`button`,{type:`button`,"aria-label":`Remove ${i}`,tabIndex:-1,"aria-disabled":o||void 0,className:t(`cursor-pointer text-strong/40 hover:bg-neutral-500/15 hover:text-strong rounded-xs p-0.5`,`aria-disabled:cursor-default aria-disabled:hover:bg-transparent aria-disabled:hover:text-strong/40`),onClick:e=>{if(e.stopPropagation(),o){let e=u.current;e&&M(e);return}a?.()},onMouseDown:e=>{e.preventDefault()},children:_(n,{svg:o?_(S,{}):_(y,{weight:`bold`}),className:`size-4`})})]})},j={Root:O,Trigger:k,TagValues:({children:e,lockedValues:t=w})=>{let n=x.useComboboxContext(),r=x.useStoreState(n,`selectedValue`),i=(C(r)?r:void 0)??w,a=m(i);a.current=i;let o=d(E);o.current=t;let s=p(()=>new Set(t),[t]),c=m(new Map),{onInputKeyDownRef:l,inputRef:u}=d(D),h=m(new Set);f(()=>()=>{h.current.forEach(cancelAnimationFrame)},[]);let v=e=>{let t=requestAnimationFrame(()=>{h.current.delete(t),e()});h.current.add(t)},y=e=>{if(n){let t=n.getState().selectedValue;if(!C(t))return;n.setSelectedValue(t.filter(t=>t!==e))}},b=e=>{let t=a.current[e];if(t==null)return;let r=c.current.get(t);r&&(r.focus(),n?.show())},S=()=>{u.current?.focus()},T=(e,t)=>{let n=i[t];switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&b(t-1);break;case`ArrowRight`:e.preventDefault(),t<i.length-1?b(t+1):S();break;case`Backspace`:case`Delete`:if(e.preventDefault(),n!=null){if(s.has(n)){let e=c.current.get(n);e&&M(e);break}if(y(n),e.key===`Backspace`)if(t>0){let e=t-1;v(()=>b(e))}else v(()=>{a.current.length>0?b(0):S()});else v(()=>{t<a.current.length?b(t):S()})}break;case`ArrowUp`:case`ArrowDown`:e.preventDefault(),S(),u.current?.dispatchEvent(new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0,cancelable:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey}));break;default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&S()}};return l.current=e=>{if(e.key===`ArrowLeft`&&e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===0&&i.length>0){e.preventDefault(),b(i.length-1);return}if(e.key===`Backspace`&&e.currentTarget.value===``&&i.length>0){let e=i[i.length-1];if(e!=null)if(o.current.includes(e)){let t=c.current.get(e);t&&M(t)}else y(e)}},_(g,{children:i.map((t,n)=>{let r={value:t,locked:s.has(t),onRemove:()=>{if(s.has(t)){let e=c.current.get(t);e&&M(e);return}y(t)},ref:e=>{e?c.current.set(t,e):c.current.delete(t)},onKeyDown:e=>T(e,n),onClick:()=>b(n)};return e?e(r):_(A,{...r},t)})})},Input:({className:n,onBlur:r,onChange:i,onFocus:a,onKeyDown:s,onValueChange:c,placeholder:l,ref:u,...f})=>{let p=x.useComboboxContext(),{onInputKeyDownRef:m,inputRef:h}=d(D),g=d(o),v=x.useStoreState(p,`selectedValue`),y=((C(v)?v:void 0)?.length??0)>0;return _(x.Combobox,{autoSelect:!0,"data-slot":`multi-select-input`,className:t(`pointer-coarse:text-base min-w-20 flex-1 select-text border-0 bg-transparent text-sm outline-hidden`,`placeholder:select-none placeholder:text-placeholder`,n),onChange:e=>{c?.(e.target.value),i?.(e)},onKeyDown:e=>{m.current?.(e),s?.(e)},onBlur:e=>{e.relatedTarget instanceof HTMLElement&&e.relatedTarget.closest(`[data-slot="multi-select-tag"]`)&&p?.show(),r?.(e)},onFocus:e=>{p?.show(),a?.(e)},placeholder:y?void 0:l,ref:e(h,u),...f,...g?{"aria-describedby":g[`aria-describedby`],"aria-errormessage":g[`aria-errormessage`],"aria-invalid":g[`aria-invalid`],id:g.id,name:g.name}:void 0})},Tag:A,Content:({asChild:e=!1,backdrop:n=!1,children:i,className:a,modal:o=!0,portalElement:s,preventBodyScroll:c,ref:l,sameWidth:p=!0,unmountOnHide:m=!0,...g})=>{let v=d(T),[y,b]=h(!1);f(()=>{b(v.current?.closest(`[data-mantle-modal-content]`)!=null)},[v]);let S=u(()=>v.current?.getBoundingClientRect()??null,[v]),C=u(e=>typeof s==`function`?s(e):s??v.current?.closest(`[data-mantle-modal-content]`)??e.ownerDocument.body,[s,v]),w=u(e=>!(e.target instanceof Node&&v.current?.contains(e.target)),[v]);return _(x.ComboboxPopover,{"data-slot":`multi-select-content`,className:t(`border-popover bg-popover relative z-50 max-h-96 min-w-32 scrollbar overflow-y-scroll overflow-x-hidden overscroll-y-none rounded-md border shadow-md pt-1 pb-1 has-data-content-footer:pb-0 font-sans flex flex-col gap-px focus:outline-hidden`,a),backdrop:n,getAnchorRect:S,gutter:4,hideOnInteractOutside:w,modal:o,portalElement:C,preventBodyScroll:c??!y,ref:l,render:e?({ref:e,...t})=>_(r,{ref:e,...t}):void 0,sameWidth:p,unmountOnHide:m,...g,children:i})},ContentFooter:({className:e,children:n,ref:r,...i})=>_(`div`,{ref:r,"data-slot":`multi-select-content-footer`,"data-content-footer":!0,className:t(`bg-popover sticky bottom-0 border-t border-popover`,e),...i,children:n}),Item:({asChild:e=!1,children:i,className:a,focusOnHover:o=!0,value:s,onClick:c,ref:l,...u})=>{let f=d(E),p=s!=null&&f.current.includes(s);return v(x.ComboboxItem,{"data-slot":`multi-select-item`,className:t(`relative mx-1 cursor-pointer rounded-md pl-2 pr-8 py-1.5 text-strong text-sm font-normal flex min-w-0 items-center gap-2`,`[[role=option]+&]:mt-px`,`data-active-item:bg-active-menu-item`,`aria-disabled:opacity-50`,`aria-selected:bg-selected-menu-item aria-selected:data-active-item:bg-active-selected-menu-item`,a),focusOnHover:o,onClick:e=>{if(p){e.preventDefault();return}c?.(e)},ref:l,render:e?({ref:e,...t})=>_(r,{ref:e,...t}):void 0,resetValueOnSelect:!0,value:s,...u,children:[i,_(x.ComboboxItemCheck,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:_(n,{svg:_(b,{weight:`bold`}),className:`size-4 text-accent-600`})})]})},Group:({asChild:e=!1,children:t,ref:n,...i})=>_(x.ComboboxGroup,{"data-slot":`multi-select-group`,className:`mx-1`,ref:n,render:e?({ref:e,...t})=>_(r,{ref:e,...t}):void 0,...i,children:t}),GroupLabel:({asChild:e=!1,children:n,className:i,ref:a,...o})=>_(x.ComboboxGroupLabel,{"data-slot":`multi-select-group-label`,className:t(`text-muted px-2 py-1 text-xs font-medium`,i),ref:a,render:e?({ref:e,...t})=>_(r,{ref:e,...t}):void 0,...o,children:n}),GroupDescription:({className:e,children:n,ref:r,...i})=>_(`p`,{"data-slot":`multi-select-group-description`,className:t(`text-muted px-2 pb-1 text-xs`,e),ref:r,...i,children:n}),Separator:({className:e,ref:n,...r})=>_(s,{"data-slot":`multi-select-separator`,ref:n,className:t(`my-1 w-auto`,e),...r}),Empty:({className:e,children:n,ref:r,...i})=>_(`div`,{"data-slot":`multi-select-empty`,className:t(`mx-1 text-muted px-2 py-6 text-center text-sm`,e),ref:r,role:`presentation`,...i,children:n})};function M(e){c()||e.animate([{transform:`translateX(0)`},{transform:`translateX(-4px)`},{transform:`translateX(4px)`},{transform:`translateX(-4px)`},{transform:`translateX(4px)`},{transform:`translateX(0)`}],{duration:300,easing:`ease-in-out`})}export{j as MultiSelect};
|
|
1
|
+
import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./icon-lZ48P8Nn.js";import{t as r}from"./slot-DpNWVci8.js";import{r as i}from"./layer-container-CglTh9-6.js";import{a,r as o}from"./field-Bpptk_9t.js";import{t as s}from"./field-B1wqeZr4.js";import{n as c}from"./separator-D0D6VyyM.js";import{t as l}from"./use-prefers-reduced-motion-Bk5zAfHY.js";import{createContext as u,useCallback as d,useContext as f,useEffect as p,useMemo as m,useRef as h,useState as g}from"react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import{XIcon as b}from"@phosphor-icons/react/X";import{CheckIcon as x}from"@phosphor-icons/react/Check";import*as S from"@ariakit/react";import{LockIcon as C}from"@phosphor-icons/react/Lock";const w=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),T=[],E=u({current:null}),D=u({current:[]}),O=u({onInputKeyDownRef:{current:void 0},inputRef:{current:null}}),k=({children:e,defaultSelectedValue:t=T,...n})=>{let r=h(null),i=h(void 0),a=h(null),o=h([]),s=m(()=>({onInputKeyDownRef:i,inputRef:a}),[]);return v(E.Provider,{value:r,children:v(O.Provider,{value:s,children:v(D.Provider,{value:o,children:v(S.ComboboxProvider,{defaultSelectedValue:t,...n,children:e})})})})},A=({"aria-invalid":n,className:r,children:i,onKeyDown:s,onMouseDown:c,ref:l,validation:u,...d})=>{let p=f(E),{inputRef:m}=f(O),h=S.useComboboxContext(),g=a(),{validation:_}=o({"aria-invalid":n,validation:u??g});return v(`div`,{role:`group`,"data-slot":`multi-select-trigger`,className:t(`cursor-text select-none font-sans text-sm`,`border-form bg-form text-strong flex min-h-9 w-full flex-wrap items-center gap-1 rounded-md border px-3 py-1 has-[[data-slot=multi-select-tag]]:px-1`,`has-focus:outline-hidden has-focus-within:ring-4 has-aria-expanded:ring-4`,`has-focus-within:border-accent-600 has-focus-within:ring-focus-accent has-aria-expanded:border-accent-600 has-aria-expanded:ring-focus-accent`,`data-validation-success:border-success-600 data-validation-success:has-focus-within:border-success-600 data-validation-success:has-focus-within:ring-focus-success data-validation-success:has-aria-expanded:border-success-600 data-validation-success:has-aria-expanded:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:has-focus-within:border-warning-600 data-validation-warning:has-focus-within:ring-focus-warning data-validation-warning:has-aria-expanded:border-warning-600 data-validation-warning:has-aria-expanded:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:has-focus-within:border-danger-600 data-validation-error:has-focus-within:ring-focus-danger data-validation-error:has-aria-expanded:border-danger-600 data-validation-error:has-aria-expanded:ring-focus-danger`,r),"data-validation":_||void 0,onKeyDown:e=>{e.key===`Escape`&&h?.getState().open&&(e.preventDefault(),h.hide()),s?.(e)},onMouseDown:e=>{e.target instanceof HTMLElement&&!e.target.closest(`button, input, [role='option']`)&&(e.preventDefault(),m.current?.focus()),c?.(e)},ref:e(p,l),...d,children:i})},j=({className:r,value:i,onRemove:a,locked:o=!1,onKeyDown:s,ref:c,...l})=>{let u=h(null);return y(`span`,{ref:e(u,c),role:`option`,"aria-selected":!0,tabIndex:-1,"data-slot":`multi-select-tag`,"data-locked":o||void 0,className:t(`cursor-default bg-neutral-500/10 border border-neutral-500/20 rounded-xs text-strong inline-flex items-center gap-1 pl-2 pr-0.5 py-0.5 text-sm font-normal`,`focus-visible:outline-hidden focus-visible:border-accent-600/50 focus-visible:ring-3 focus-visible:ring-focus-accent`,r),onKeyDown:e=>{if(o&&(e.key===`Backspace`||e.key===`Delete`)){e.preventDefault(),N(e.currentTarget);return}s?.(e)},...l,children:[i,v(`button`,{type:`button`,"aria-label":`Remove ${i}`,tabIndex:-1,"aria-disabled":o||void 0,className:t(`cursor-pointer text-strong/40 hover:bg-neutral-500/15 hover:text-strong rounded-xs p-0.5`,`aria-disabled:cursor-default aria-disabled:hover:bg-transparent aria-disabled:hover:text-strong/40`),onClick:e=>{if(e.stopPropagation(),o){let e=u.current;e&&N(e);return}a?.()},onMouseDown:e=>{e.preventDefault()},children:v(n,{svg:o?v(C,{}):v(b,{weight:`bold`}),className:`size-4`})})]})},M={Root:k,Trigger:A,TagValues:({children:e,lockedValues:t=T})=>{let n=S.useComboboxContext(),r=S.useStoreState(n,`selectedValue`),i=(w(r)?r:void 0)??T,a=h(i);a.current=i;let o=f(D);o.current=t;let s=m(()=>new Set(t),[t]),c=h(new Map),{onInputKeyDownRef:l,inputRef:u}=f(O),d=h(new Set);p(()=>()=>{d.current.forEach(cancelAnimationFrame)},[]);let g=e=>{let t=requestAnimationFrame(()=>{d.current.delete(t),e()});d.current.add(t)},y=e=>{if(n){let t=n.getState().selectedValue;if(!w(t))return;n.setSelectedValue(t.filter(t=>t!==e))}},b=e=>{let t=a.current[e];if(t==null)return;let r=c.current.get(t);r&&(r.focus(),n?.show())},x=()=>{u.current?.focus()},C=(e,t)=>{let n=i[t];switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&b(t-1);break;case`ArrowRight`:e.preventDefault(),t<i.length-1?b(t+1):x();break;case`Backspace`:case`Delete`:if(e.preventDefault(),n!=null){if(s.has(n)){let e=c.current.get(n);e&&N(e);break}if(y(n),e.key===`Backspace`)if(t>0){let e=t-1;g(()=>b(e))}else g(()=>{a.current.length>0?b(0):x()});else g(()=>{t<a.current.length?b(t):x()})}break;case`ArrowUp`:case`ArrowDown`:e.preventDefault(),x(),u.current?.dispatchEvent(new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0,cancelable:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey}));break;default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&x()}};return l.current=e=>{if(e.key===`ArrowLeft`&&e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===0&&i.length>0){e.preventDefault(),b(i.length-1);return}if(e.key===`Backspace`&&e.currentTarget.value===``&&i.length>0){let e=i[i.length-1];if(e!=null)if(o.current.includes(e)){let t=c.current.get(e);t&&N(t)}else y(e)}},v(_,{children:i.map((t,n)=>{let r={value:t,locked:s.has(t),onRemove:()=>{if(s.has(t)){let e=c.current.get(t);e&&N(e);return}y(t)},ref:e=>{e?c.current.set(t,e):c.current.delete(t)},onKeyDown:e=>C(e,n),onClick:()=>b(n)};return e?e(r):v(j,{...r},t)})})},Input:({className:n,onBlur:r,onChange:i,onFocus:a,onKeyDown:o,onValueChange:c,placeholder:l,ref:u,...d})=>{let p=S.useComboboxContext(),{onInputKeyDownRef:m,inputRef:h}=f(O),g=f(s),_=S.useStoreState(p,`selectedValue`),y=((w(_)?_:void 0)?.length??0)>0;return v(S.Combobox,{autoSelect:!0,"data-slot":`multi-select-input`,className:t(`pointer-coarse:text-base min-w-20 flex-1 select-text border-0 bg-transparent text-sm outline-hidden`,`placeholder:select-none placeholder:text-placeholder`,n),onChange:e=>{c?.(e.target.value),i?.(e)},onKeyDown:e=>{m.current?.(e),o?.(e)},onBlur:e=>{e.relatedTarget instanceof HTMLElement&&e.relatedTarget.closest(`[data-slot="multi-select-tag"]`)&&p?.show(),r?.(e)},onFocus:e=>{p?.show(),a?.(e)},placeholder:y?void 0:l,ref:e(h,u),...d,...g?{"aria-describedby":g[`aria-describedby`],"aria-errormessage":g[`aria-errormessage`],"aria-invalid":g[`aria-invalid`],id:g.id,name:g.name}:void 0})},Tag:j,Content:({asChild:e=!1,backdrop:n=!1,children:a,className:o,modal:s=!0,portalElement:c,preventBodyScroll:l,ref:u,sameWidth:m=!0,unmountOnHide:h=!0,..._})=>{let y=f(E),b=i(),[x,C]=g(!1);p(()=>{C(y.current?.closest(`[data-mantle-modal-content]`)!=null)},[y]);let w=x||b!=null,T=d(()=>y.current?.getBoundingClientRect()??null,[y]),D=d(e=>typeof c==`function`?c(e):c??y.current?.closest(`[data-mantle-modal-content]`)??(b instanceof HTMLElement?b:null)??e.ownerDocument.body,[b,c,y]),O=d(e=>!(e.target instanceof Node&&y.current?.contains(e.target)),[y]);return v(S.ComboboxPopover,{"data-slot":`multi-select-content`,className:t(`border-popover bg-popover relative z-50 max-h-96 min-w-32 scrollbar overflow-y-scroll overflow-x-hidden overscroll-y-none rounded-md border shadow-md pt-1 pb-1 has-data-content-footer:pb-0 font-sans flex flex-col gap-px focus:outline-hidden`,o),backdrop:n,getAnchorRect:T,gutter:4,hideOnInteractOutside:O,modal:s,portalElement:D,preventBodyScroll:l??!w,ref:u,render:e?({ref:e,...t})=>v(r,{ref:e,...t}):void 0,sameWidth:m,unmountOnHide:h,..._,children:a})},ContentFooter:({className:e,children:n,ref:r,...i})=>v(`div`,{ref:r,"data-slot":`multi-select-content-footer`,"data-content-footer":!0,className:t(`bg-popover sticky bottom-0 border-t border-popover`,e),...i,children:n}),Item:({asChild:e=!1,children:i,className:a,focusOnHover:o=!0,value:s,onClick:c,ref:l,...u})=>{let d=f(D),p=s!=null&&d.current.includes(s);return y(S.ComboboxItem,{"data-slot":`multi-select-item`,className:t(`relative mx-1 cursor-pointer rounded-md pl-2 pr-8 py-1.5 text-strong text-sm font-normal flex min-w-0 items-center gap-2`,`[[role=option]+&]:mt-px`,`data-active-item:bg-active-menu-item`,`aria-disabled:opacity-50`,`aria-selected:bg-selected-menu-item aria-selected:data-active-item:bg-active-selected-menu-item`,a),focusOnHover:o,onClick:e=>{if(p){e.preventDefault();return}c?.(e)},ref:l,render:e?({ref:e,...t})=>v(r,{ref:e,...t}):void 0,resetValueOnSelect:!0,value:s,...u,children:[i,v(S.ComboboxItemCheck,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:v(n,{svg:v(x,{weight:`bold`}),className:`size-4 text-accent-600`})})]})},Group:({asChild:e=!1,children:t,ref:n,...i})=>v(S.ComboboxGroup,{"data-slot":`multi-select-group`,className:`mx-1`,ref:n,render:e?({ref:e,...t})=>v(r,{ref:e,...t}):void 0,...i,children:t}),GroupLabel:({asChild:e=!1,children:n,className:i,ref:a,...o})=>v(S.ComboboxGroupLabel,{"data-slot":`multi-select-group-label`,className:t(`text-muted px-2 py-1 text-xs font-medium`,i),ref:a,render:e?({ref:e,...t})=>v(r,{ref:e,...t}):void 0,...o,children:n}),GroupDescription:({className:e,children:n,ref:r,...i})=>v(`p`,{"data-slot":`multi-select-group-description`,className:t(`text-muted px-2 pb-1 text-xs`,e),ref:r,...i,children:n}),Separator:({className:e,ref:n,...r})=>v(c,{"data-slot":`multi-select-separator`,ref:n,className:t(`my-1 w-auto`,e),...r}),Empty:({className:e,children:n,ref:r,...i})=>v(`div`,{"data-slot":`multi-select-empty`,className:t(`mx-1 text-muted px-2 py-6 text-center text-sm`,e),ref:r,role:`presentation`,...i,children:n})};function N(e){l()||e.animate([{transform:`translateX(0)`},{transform:`translateX(-4px)`},{transform:`translateX(4px)`},{transform:`translateX(-4px)`},{transform:`translateX(4px)`},{transform:`translateX(0)`}],{duration:300,easing:`ease-in-out`})}export{M as MultiSelect};
|
package/dist/pagination.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as ButtonGroup } from "./button-
|
|
2
|
-
import { t as Select } from "./select-
|
|
1
|
+
import { t as ButtonGroup } from "./button-CRCNRnk6.js";
|
|
2
|
+
import { t as Select } from "./select-DkFkSYBP.js";
|
|
3
3
|
import { ComponentProps } from "react";
|
|
4
4
|
//#region src/components/pagination/cursor-pagination.d.ts
|
|
5
5
|
type CursorPaginationProps = ComponentProps<"div"> & {
|
package/dist/pagination.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./button-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./button-CC10rP6X.js";import{t as n}from"./button-DmJkYfyl.js";import{n as r}from"./separator-D0D6VyyM.js";import{t as i}from"./select-BK6n6OIK.js";import{createContext as a,useContext as o,useEffect as s,useMemo as c,useState as l}from"react";import u from"tiny-invariant";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{CaretRightIcon as p}from"@phosphor-icons/react/CaretRight";import{CaretLeftIcon as m}from"@phosphor-icons/react/CaretLeft";const h=a(void 0),g=({className:t,children:n,defaultPageSize:r,ref:i,...a})=>{let[o,s]=l(r),u=c(()=>({defaultPageSize:r,pageSize:o,setPageSize:s}),[r,o]);return d(h.Provider,{value:u,children:d(`div`,{"data-slot":`cursor-pagination`,className:e(`inline-flex items-center justify-between gap-2`,t),ref:i,...a,children:n})})},_=({hasNextPage:e,hasPreviousPage:i,onNextPage:a,onPreviousPage:o,ref:s,...c})=>f(n,{"data-slot":`cursor-pagination-buttons`,appearance:`panel`,ref:s,...c,children:[d(t,{"data-slot":`cursor-pagination-previous`,appearance:`ghost`,disabled:!i,icon:d(m,{}),intent:`neutral`,label:`Previous page`,onClick:o,size:`sm`,type:`button`}),d(r,{"data-slot":`cursor-pagination-separator`,orientation:`vertical`,className:`min-h-5`}),d(t,{"data-slot":`cursor-pagination-next`,appearance:`ghost`,disabled:!e,icon:d(p,{}),intent:`neutral`,label:`Next page`,onClick:a,size:`sm`,type:`button`})]}),v=[5,10,20,50,100],y=({className:t,pageSizes:n=v,onChangePageSize:r,ref:a,...s})=>{let c=o(h);return u(c,`CursorPageSizeSelect must be used as a child of a CursorPagination component`),u(n.includes(c.defaultPageSize),`CursorPagination.defaultPageSize must be included in CursorPageSizeSelect.pageSizes`),u(n.includes(c.pageSize),`CursorPagination.pageSize must be included in CursorPageSizeSelect.pageSizes`),f(i.Root,{defaultValue:`${c.pageSize}`,onValueChange:e=>{let t=Number.parseInt(e,10);Number.isNaN(t)&&(t=c.defaultPageSize),c.setPageSize(t),r?.(t)},children:[d(i.Trigger,{ref:a,"data-slot":`cursor-pagination-page-size-select`,className:e(`w-auto min-w-36`,t),value:c.pageSize,...s,children:d(i.Value,{})}),d(i.Content,{width:`trigger`,children:n.map(e=>f(i.Item,{value:`${e}`,children:[e,` per page`]},e))})]})};function b({className:t,...n}){let r=o(h);return u(r,`CursorPageSizeValue must be used as a child of a CursorPagination component`),f(`span`,{"data-slot":`cursor-pagination-page-size-value`,className:e(`text-muted text-sm font-normal`,t),...n,children:[r.pageSize,` per page`]})}const x={Root:g,Buttons:_,PageSizeSelect:y,PageSizeValue:b};function S({listSize:e,pageSize:t}){let[n,r]=l(1),[i,a]=l(t);s(()=>{a(t),r(1)},[t]),s(()=>{r(1)},[e]);let o=Math.ceil(e/i),c=(n-1)*i,u=n>1,d=n<o;function f(e){r(Math.max(1,Math.min(e,o)))}function p(){d&&r(e=>Math.min(e+1,o))}function m(){u&&r(e=>Math.max(e-1,1))}function h(e){a(e),r(1)}function g(){r(o)}function _(){r(1)}return{currentPage:n,goToFirstPage:_,goToLastPage:g,goToPage:f,hasNextPage:d,hasPreviousPage:u,nextPage:p,offset:c,pageSize:i,previousPage:m,setPageSize:h,totalPages:o}}function C(e,t){return e.slice(t.offset,t.offset+t.pageSize)}export{x as CursorPagination,C as getOffsetPaginatedSlice,S as useOffsetPagination};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{r as t}from"./layer-container-CglTh9-6.js";import{jsx as n,jsxs as r}from"react/jsx-runtime";import*as i from"@radix-ui/react-popover";const a=i.Root,o=i.Trigger,s={Root:a,Anchor:i.Anchor,Arrow:({className:t,height:a=7,width:o=14,...s})=>n(i.Arrow,{"aria-hidden":`true`,asChild:!0,"data-slot":`popover-arrow`,height:a,width:o,...s,children:r(`svg`,{className:e(`fill-[var(--background-color-popover)]`,`[clip-path:inset(0_-200%_-200%_-200%)]`,`[filter:drop-shadow(0_0_4px_color-mix(in_oklab,var(--shadow-color)_var(--shadow-first-opacity),transparent))]`,t),children:[n(`polygon`,{points:`0,0 30,0 15,10`}),n(`polyline`,{className:`stroke-[color:var(--border-color-popover)]`,fill:`none`,points:`0,0 15,10 30,0`,strokeWidth:1.5,vectorEffect:`non-scaling-stroke`})]})}),Close:i.Close,Content:({align:r=`center`,className:a,onClick:o,preferredWidth:s=`max-w-72`,ref:c,sideOffset:l=4,...u})=>{let d=t();return n(i.Portal,{container:d,children:n(i.Content,{align:r,"data-slot":`popover-content`,className:e(`relative`,`text-popover-foreground border-popover bg-popover data-side-bottom:slide-in-from-top-2 data-side-left:slide-in-from-right-2 data-side-right:slide-in-from-left-2 data-side-top:slide-in-from-bottom-2 data-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 z-50 rounded-md border p-4 shadow-md outline-hidden`,s,a),onClick:e=>{e.stopPropagation(),o?.(e)},ref:c,sideOffset:l,...u})})},Trigger:o};export{s as t};
|
|
@@ -15,9 +15,12 @@ type PopoverContentProps = ComponentProps<typeof PopoverPrimitive.Content> & {
|
|
|
15
15
|
/**
|
|
16
16
|
* The content to render inside the popover.
|
|
17
17
|
*
|
|
18
|
-
* `Popover.Content` renders at Tailwind `z-50`, Mantle's
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* `Popover.Content` renders at Tailwind `z-50`, Mantle's float tier. When
|
|
19
|
+
* composed inside an open `Dialog`, `AlertDialog`, or `Sheet`, it portals into
|
|
20
|
+
* that overlay's positioner and paints above the overlay that owns it. Outside
|
|
21
|
+
* every overlay, it portals to `document.body`, below the overlay tier
|
|
22
|
+
* (`z-60`). When sibling floats share a container, the most recently mounted
|
|
23
|
+
* float paints on top.
|
|
21
24
|
*
|
|
22
25
|
* It sets `position: relative`, so `Popover.Arrow`'s absolutely-positioned
|
|
23
26
|
* wrapper keeps one containing block through the open animation. An
|
|
@@ -83,9 +86,12 @@ declare const Arrow: ({ className, height, width, ...props }: PopoverArrowProps)
|
|
|
83
86
|
* the content, block interaction with the rest of the page, and lock body
|
|
84
87
|
* scroll while the popover is open.
|
|
85
88
|
*
|
|
86
|
-
* `Popover.Content` renders at Tailwind `z-50`, Mantle's
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
+
* `Popover.Content` renders at Tailwind `z-50`, Mantle's float tier. When
|
|
90
|
+
* composed inside an open `Dialog`, `AlertDialog`, or `Sheet`, it portals into
|
|
91
|
+
* that overlay's positioner and paints above the overlay that owns it. Outside
|
|
92
|
+
* every overlay, it portals to `document.body`, below the overlay tier
|
|
93
|
+
* (`z-60`). When sibling floats share a container, the most recently mounted
|
|
94
|
+
* float paints on top.
|
|
89
95
|
*
|
|
90
96
|
* @see https://mantle.ngrok.com/components/overlays/popover
|
|
91
97
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
|
|
@@ -119,9 +125,12 @@ declare const Popover: {
|
|
|
119
125
|
/**
|
|
120
126
|
* The root, stateful component that manages the open/closed state of the popover.
|
|
121
127
|
*
|
|
122
|
-
* `Popover.Content` renders at Tailwind `z-50`, Mantle's
|
|
123
|
-
*
|
|
124
|
-
*
|
|
128
|
+
* `Popover.Content` renders at Tailwind `z-50`, Mantle's float tier. When
|
|
129
|
+
* composed inside an open `Dialog`, `AlertDialog`, or `Sheet`, it portals into
|
|
130
|
+
* that overlay's positioner and paints above the overlay that owns it. Outside
|
|
131
|
+
* every overlay, it portals to `document.body`, below the overlay tier
|
|
132
|
+
* (`z-60`). When sibling floats share a container, the most recently mounted
|
|
133
|
+
* float paints on top.
|
|
125
134
|
*
|
|
126
135
|
* @see https://mantle.ngrok.com/components/overlays/popover#popoverroot
|
|
127
136
|
*
|
|
@@ -216,9 +225,12 @@ declare const Popover: {
|
|
|
216
225
|
/**
|
|
217
226
|
* The content to render inside the popover. Appears in a portal with rich styling and animations.
|
|
218
227
|
*
|
|
219
|
-
* `Popover.Content` renders at Tailwind `z-50`, Mantle's
|
|
220
|
-
*
|
|
221
|
-
*
|
|
228
|
+
* `Popover.Content` renders at Tailwind `z-50`, Mantle's float tier. When
|
|
229
|
+
* composed inside an open `Dialog`, `AlertDialog`, or `Sheet`, it portals into
|
|
230
|
+
* that overlay's positioner and paints above the overlay that owns it. Outside
|
|
231
|
+
* every overlay, it portals to `document.body`, below the overlay tier
|
|
232
|
+
* (`z-60`). When sibling floats share a container, the most recently mounted
|
|
233
|
+
* float paints on top.
|
|
222
234
|
*
|
|
223
235
|
* @see https://mantle.ngrok.com/components/overlays/popover#popovercontent
|
|
224
236
|
*
|
package/dist/popover.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Popover } from "./popover-
|
|
1
|
+
import { t as Popover } from "./popover-DDuw1UaJ.js";
|
|
2
2
|
export { Popover };
|
package/dist/popover.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./popover-
|
|
1
|
+
import{t as e}from"./popover-D6x6Bq-G.js";export{e as Popover};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./slot-DpNWVci8.js";import{t}from"./booleanish-BfvnW6vy.js";import{n,r}from"./layer-container-CglTh9-6.js";import{createContext as i,useContext as a,useEffect as o,useMemo as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";import*as u from"@radix-ui/react-dialog";function d(e){e.target instanceof Element&&e.target.closest(`.overlay-prompt`)&&e.preventDefault()}const f=i({hasDescription:!1,setHasDescription:()=>{}});function p(e){let[t,n]=c(!1),r=s(()=>({hasDescription:t,setHasDescription:n}),[t]);return l(f.Provider,{value:r,children:l(u.Root,{...e})})}const m=u.Trigger,h=({container:e,...t})=>{let i=r(),a=e??i;return l(n.Provider,{value:a,children:l(u.Portal,{container:a,...t})})},g=u.Close,_=e=>l(u.Overlay,{"data-overlay":!0,...e}),v=({onEscapeKeyDown:e,onInteractOutside:t,onPointerDownOutside:n,ref:r,...i})=>{let o=a(f);return l(u.Content,{ref:r,onEscapeKeyDown:t=>{S(t),e?.(t)},onInteractOutside:e=>{d(e),t?.(e)},onPointerDownOutside:e=>{d(e),n?.(e)},...o.hasDescription?{}:{"aria-describedby":void 0},...i})},y=u.Title,b=({asChild:t,children:n,ref:r,...i})=>{let s=a(f);o(()=>(s.setHasDescription(!0),()=>s.setHasDescription(!1)),[s]);let c=t?e:`div`;return l(u.Description,{ref:r,asChild:!0,children:l(c,{...i,children:n})})};function x(e){return e instanceof HTMLElement&&e.hasAttribute(`data-overlay`)}function S(e){if(!E(e.currentTarget))return;let n=e.currentTarget,r=n instanceof Document?n.activeElement:n.ownerDocument?.activeElement??null,i=C(e.target)??C(r),a=i?w(i):null;i!=null&&t(i.getAttribute(`aria-expanded`))&&a!=null&&n.contains(i)&&n.contains(a)&&(a.getAttribute(`data-open`)===`true`||a.getAttribute(`data-state`)===`open`)&&e.preventDefault()}function C(e){return T(e)?e.closest(`[aria-expanded='true'][aria-controls]`):null}function w(e){let t=e.getAttribute(`aria-controls`);if(!t)return null;let n=e.ownerDocument.getElementById(t);return n instanceof HTMLElement?n:null}function T(e){return e instanceof HTMLElement}function E(e){return e instanceof Node&&`querySelector`in e}export{h as a,m as c,_ as i,x as l,v as n,p as o,b as r,y as s,g as t};
|
package/dist/scatter-plot.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as PointShape, a as LegendPrimitiveProps, c as XAxisPrimitiveProps, f as ChartDatum, i as GridPrimitiveProps, l as YAxisPrimitiveProps, m as ChartSeriesSlot, n as ChartRootBaseProps, o as ReferenceLinePrimitiveProps, p as ChartDatumEvent, r as CopyButtonPrimitiveProps, s as TooltipPrimitiveProps, t as ChartAccessibilityProps, v as SeriesColor } from "./chart-
|
|
1
|
+
import { _ as PointShape, a as LegendPrimitiveProps, c as XAxisPrimitiveProps, f as ChartDatum, i as GridPrimitiveProps, l as YAxisPrimitiveProps, m as ChartSeriesSlot, n as ChartRootBaseProps, o as ReferenceLinePrimitiveProps, p as ChartDatumEvent, r as CopyButtonPrimitiveProps, s as TooltipPrimitiveProps, t as ChartAccessibilityProps, v as SeriesColor } from "./chart-DgaWVBqi.js";
|
|
2
2
|
//#region src/components/scatter-plot/scatter-plot.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Props for {@link ScatterPlot.Root}. Scatter x values must be continuous
|
package/dist/scatter-plot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./chart-
|
|
1
|
+
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./chart-BDxpXPfo.js";import{jsx as l}from"react/jsx-runtime";const u={Root:e=>l(o,{kind:`scatter`,componentName:`ScatterPlot`,slotName:`scatter-plot`,...e}),Point:e=>a(`ScatterPlot.Point`,`scatter`,e),Grid:e=>n(`ScatterPlot.Grid`,e),XAxis:e=>t(`ScatterPlot.XAxis`,e),YAxis:e=>r(`ScatterPlot.YAxis`,e),ReferenceLine:t=>e(`ScatterPlot.ReferenceLine`,t),Tooltip:e=>s(`ScatterPlot.Tooltip`,e),Legend:e=>l(i,{partName:`ScatterPlot.Legend`,slotName:`scatter-plot`,...e}),CopyButton:e=>l(c,{partName:`ScatterPlot.CopyButton`,slotName:`scatter-plot`,...e})};export{u as ScatterPlot};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./icon-lZ48P8Nn.js";import{r}from"./layer-container-CglTh9-6.js";import{a as i,r as a}from"./field-Bpptk_9t.js";import{t as o}from"./field-B1wqeZr4.js";import{n as s}from"./separator-D0D6VyyM.js";import{CaretDownIcon as c}from"@phosphor-icons/react/CaretDown";import{createContext as l,useContext as u,useMemo as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{CheckIcon as m}from"@phosphor-icons/react/Check";import{CaretUpIcon as h}from"@phosphor-icons/react/CaretUp";import*as g from"@radix-ui/react-select";const _=l({}),v=({"aria-invalid":e,children:t,id:n,validation:r,onBlur:i,onValueChange:a,onChange:o,ref:s,...c})=>{let l=d(()=>({"aria-invalid":e,id:n,validation:r,onBlur:i,ref:s}),[e,n,r,i,s]);return f(g.Root,{...c,onValueChange:e=>{o?.(e),a?.(e)},children:f(_.Provider,{value:l,children:t})})},y=({className:e,ref:n,...r})=>f(g.Group,{ref:n,"data-slot":`select-group`,className:t(`space-y-px`,e),...r}),b=g.Value,x=({"aria-invalid":r,className:s,children:l,id:d,ref:m,validation:h,...v})=>{let y=u(_),b=u(o),x=i(),S=b?b[`aria-invalid`]:y[`aria-invalid`]??r,C=y.validation??h??x,{ariaInvalid:w,validation:T}=a({"aria-invalid":S,validation:C}),E=b?b.id:y.id??d;return p(g.Trigger,{"data-slot":`select-trigger`,className:t(`h-9 text-sm`,`border-form bg-form text-strong font-sans placeholder:text-placeholder hover:bg-form-hover hover:text-strong flex w-full items-center justify-between gap-1.5 rounded-md border px-3 py-2 disabled:pointer-events-none disabled:opacity-50 [&>span]:line-clamp-1 [&>span]:text-left`,`hover:border-neutral-400`,`focus:outline-hidden focus:ring-4 aria-expanded:ring-4`,`focus:border-accent-600 focus:ring-focus-accent aria-expanded:border-accent-600 aria-expanded:ring-focus-accent`,`data-validation-success:border-success-600 data-validation-success:focus:border-success-600 data-validation-success:focus:ring-focus-success data-validation-success:aria-expanded:border-success-600 data-validation-success:aria-expanded:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:focus:border-warning-600 data-validation-warning:focus:ring-focus-warning data-validation-warning:aria-expanded:border-warning-600 data-validation-warning:aria-expanded:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:focus:border-danger-600 data-validation-error:focus:ring-focus-danger data-validation-error:aria-expanded:border-danger-600 data-validation-error:aria-expanded:ring-focus-danger`,s),"data-validation":T||void 0,id:E,ref:e(m,y.ref),...v,...b?{"aria-describedby":b[`aria-describedby`],"aria-errormessage":b[`aria-errormessage`]}:void 0,"aria-invalid":w,children:[l,f(g.Icon,{asChild:!0,children:f(n,{svg:f(c,{weight:`bold`}),className:`size-4`})})]})},S=({className:e,ref:r,...i})=>f(g.ScrollUpButton,{ref:r,className:t(`flex cursor-default items-center justify-center py-1`,e),...i,children:f(n,{svg:f(h,{weight:`bold`}),className:`size-4`})}),C=({className:e,ref:r,...i})=>f(g.ScrollDownButton,{ref:r,className:t(`flex cursor-default items-center justify-center py-1`,e),...i,children:f(n,{svg:f(c,{weight:`bold`}),className:`size-4`})}),w={Root:v,Content:({className:e,children:n,position:i=`popper`,ref:a,width:o=`trigger`,...s})=>{let c=r();return f(g.Portal,{container:c,children:p(g.Content,{ref:a,"data-slot":`select-content`,className:t(`border-popover data-side-bottom:slide-in-from-top-2 data-side-left:slide-in-from-right-2 data-side-right:slide-in-from-left-2 data-side-top:slide-in-from-bottom-2 data-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 relative z-50 max-h-96 min-w-32 overflow-hidden rounded-md border shadow-md`,`bg-popover font-sans`,i===`popper`&&`data-side-bottom:translate-y-2 data-side-left:-translate-x-2 data-side-right:translate-x-2 data-side-top:-translate-y-2 max-h-(--radix-select-content-available-height)`,o===`trigger`&&`w-(--radix-select-trigger-width)`,e),position:i,...s,children:[f(S,{}),f(g.Viewport,{className:t(`p-1 space-y-px`,i===`popper`&&`h-(--radix-select-trigger-height) w-full`),children:n}),f(C,{})]})})},Group:y,Item:({className:e,children:r,icon:i,ref:a,...o})=>p(g.Item,{ref:a,"data-slot":`select-item`,className:t(`relative flex gap-2 w-full cursor-pointer select-none items-center rounded-md py-1.5 pl-2 pr-8 text-strong text-sm outline-hidden`,`focus:bg-active-menu-item`,`data-disabled:pointer-events-none data-disabled:opacity-50`,`data-state-checked:bg-selected-menu-item`,`focus:data-state-checked:bg-active-selected-menu-item`,e),...o,children:[i&&f(n,{svg:i}),f(g.ItemText,{children:r}),f(g.ItemIndicator,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:f(n,{svg:f(m,{weight:`bold`}),className:`size-4 text-accent-600`})})]}),Label:({className:e,ref:n,...r})=>f(g.Label,{ref:n,"data-slot":`select-label`,className:t(`px-2 py-1.5 text-sm font-medium`,e),...r}),Separator:({className:e,ref:n,...r})=>f(s,{ref:n,"data-slot":`select-separator`,className:t(`-mx-1 my-1 h-px w-auto`,e),...r}),Trigger:x,Value:b};export{w as t};
|
|
@@ -48,9 +48,12 @@ type SelectProps = PropsWithChildren & {
|
|
|
48
48
|
* state — suppress the inferred error by passing `validation` on `Field.Item`
|
|
49
49
|
* if a non-error `Select.Root` state needs to win in that case.
|
|
50
50
|
*
|
|
51
|
-
* `Select.Content` renders at Tailwind `z-50`, Mantle's
|
|
52
|
-
*
|
|
53
|
-
*
|
|
51
|
+
* `Select.Content` renders at Tailwind `z-50`, Mantle's float tier. When
|
|
52
|
+
* composed inside an open `Dialog`, `AlertDialog`, or `Sheet`, it portals into
|
|
53
|
+
* that overlay's positioner and paints above the overlay that owns it. Outside
|
|
54
|
+
* every overlay, it portals to `document.body`, below the overlay tier
|
|
55
|
+
* (`z-60`). When sibling floats share a container, the most recently mounted
|
|
56
|
+
* float paints on top.
|
|
54
57
|
*
|
|
55
58
|
* @see https://mantle.ngrok.com/components/forms/select#selectroot
|
|
56
59
|
*
|
|
@@ -154,9 +157,12 @@ type SelectContentProps = ComponentProps<typeof SelectPrimitive.Content> & {
|
|
|
154
157
|
* The component that pops out when the select is open as a portal adjacent to the trigger button.
|
|
155
158
|
* It contains a scrolling viewport of the select items.
|
|
156
159
|
*
|
|
157
|
-
* `Select.Content` renders at Tailwind `z-50`, Mantle's
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
+
* `Select.Content` renders at Tailwind `z-50`, Mantle's float tier. When
|
|
161
|
+
* composed inside an open `Dialog`, `AlertDialog`, or `Sheet`, it portals into
|
|
162
|
+
* that overlay's positioner and paints above the overlay that owns it. Outside
|
|
163
|
+
* every overlay, it portals to `document.body`, below the overlay tier
|
|
164
|
+
* (`z-60`). When sibling floats share a container, the most recently mounted
|
|
165
|
+
* float paints on top.
|
|
160
166
|
*
|
|
161
167
|
* @see https://mantle.ngrok.com/components/forms/select#selectcontent
|
|
162
168
|
*
|
|
@@ -284,9 +290,12 @@ declare const SelectSeparatorComponent: ({ className, ref, ...props }: Component
|
|
|
284
290
|
* and search/filtering is unnecessary. For larger lists or async/searchable data, use
|
|
285
291
|
* Combobox. For picking multiple options, use MultiSelect.
|
|
286
292
|
*
|
|
287
|
-
* `Select.Content` renders at Tailwind `z-50`, Mantle's
|
|
288
|
-
*
|
|
289
|
-
*
|
|
293
|
+
* `Select.Content` renders at Tailwind `z-50`, Mantle's float tier. When
|
|
294
|
+
* composed inside an open `Dialog`, `AlertDialog`, or `Sheet`, it portals into
|
|
295
|
+
* that overlay's positioner and paints above the overlay that owns it. Outside
|
|
296
|
+
* every overlay, it portals to `document.body`, below the overlay tier
|
|
297
|
+
* (`z-60`). When sibling floats share a container, the most recently mounted
|
|
298
|
+
* float paints on top.
|
|
290
299
|
*
|
|
291
300
|
* @see https://mantle.ngrok.com/components/forms/select
|
|
292
301
|
*
|
|
@@ -334,9 +343,12 @@ declare const Select: {
|
|
|
334
343
|
* and search/filtering is unnecessary. For larger lists or async/searchable data, use
|
|
335
344
|
* Combobox. For picking multiple options, use MultiSelect.
|
|
336
345
|
*
|
|
337
|
-
* `Select.Content` renders at Tailwind `z-50`, Mantle's
|
|
338
|
-
*
|
|
339
|
-
*
|
|
346
|
+
* `Select.Content` renders at Tailwind `z-50`, Mantle's float tier. When
|
|
347
|
+
* composed inside an open `Dialog`, `AlertDialog`, or `Sheet`, it portals into
|
|
348
|
+
* that overlay's positioner and paints above the overlay that owns it. Outside
|
|
349
|
+
* every overlay, it portals to `document.body`, below the overlay tier
|
|
350
|
+
* (`z-60`). When sibling floats share a container, the most recently mounted
|
|
351
|
+
* float paints on top.
|
|
340
352
|
*
|
|
341
353
|
* @see https://mantle.ngrok.com/components/forms/select#selectroot
|
|
342
354
|
*
|
|
@@ -368,9 +380,12 @@ declare const Select: {
|
|
|
368
380
|
* The component that pops out when the select is open as a portal adjacent to the trigger button.
|
|
369
381
|
* It contains a scrolling viewport of the select items.
|
|
370
382
|
*
|
|
371
|
-
* `Select.Content` renders at Tailwind `z-50`, Mantle's
|
|
372
|
-
*
|
|
373
|
-
*
|
|
383
|
+
* `Select.Content` renders at Tailwind `z-50`, Mantle's float tier. When
|
|
384
|
+
* composed inside an open `Dialog`, `AlertDialog`, or `Sheet`, it portals into
|
|
385
|
+
* that overlay's positioner and paints above the overlay that owns it. Outside
|
|
386
|
+
* every overlay, it portals to `document.body`, below the overlay tier
|
|
387
|
+
* (`z-60`). When sibling floats share a container, the most recently mounted
|
|
388
|
+
* float paints on top.
|
|
374
389
|
*
|
|
375
390
|
* @see https://mantle.ngrok.com/components/forms/select#selectcontent
|
|
376
391
|
*
|
package/dist/select.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Select } from "./select-
|
|
1
|
+
import { t as Select } from "./select-DkFkSYBP.js";
|
|
2
2
|
export { Select };
|
package/dist/select.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./select-
|
|
1
|
+
import{t as e}from"./select-BK6n6OIK.js";export{e as Select};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./button-CC10rP6X.js";import{t as n}from"./layer-container-CglTh9-6.js";import{a as r,c as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./primitive-BWyxJnXn.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{XIcon as p}from"@phosphor-icons/react/X";import{cva as m}from"class-variance-authority";const h=s,g=i,_=u,v=r,y=({className:t,ref:n,...r})=>d(a,{"data-slot":`sheet-overlay`,className:e(`bg-overlay data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:animate-in data-state-open:fade-in-0 fixed inset-0 z-60 backdrop-blur-xs`,t),...r,ref:n}),b=m(`bg-dialog border-dialog inset-y-0 h-full w-full fixed flex flex-col shadow-lg outline-hidden transition ease-in-out focus-within:outline-hidden data-state-closed:duration-100 data-state-closed:animate-out data-state-open:duration-100 data-state-open:animate-in`,{variants:{side:{left:`data-state-closed:slide-out-to-left data-state-open:slide-in-from-left left-0 border-r`,right:`data-state-closed:slide-out-to-right data-state-open:slide-in-from-right right-0 border-l`}},defaultVariants:{side:`right`}}),x={Root:h,Actions:({children:t,className:n,ref:r,...i})=>d(`div`,{"data-slot":`sheet-actions`,className:e(`flex h-full items-center gap-2`,n),...i,ref:r,children:t}),Body:({className:t,...n})=>d(`div`,{"data-slot":`sheet-body`,className:e(`scrollbar scrollbar-gutter-stable text-body flex-1 overflow-y-auto p-6`,t),...n}),Close:_,CloseIconButton:({size:e=`md`,type:n=`button`,label:r=`Close Sheet`,appearance:i=`ghost`,intent:a=`neutral`,...o})=>d(u,{asChild:!0,children:d(t,{"data-slot":`sheet-close-icon-button`,appearance:i,icon:d(p,{}),intent:a,label:r,size:e,type:n,...o})}),Content:({children:t,className:r,preferredWidth:i=`sm:max-w-[30rem]`,side:a=`right`,ref:s,...c})=>f(v,{children:[d(y,{}),d(n,{"data-slot":`sheet-positioner`,className:`fixed z-60`,children:d(o,{"data-slot":`sheet-content`,"data-mantle-modal-content":!0,className:e(b({side:a}),i,r),ref:s,...c,children:t})})]}),Description:({className:t,ref:n,...r})=>d(c,{"data-slot":`sheet-description`,ref:n,className:e(`text-body text-sm`,t),...r}),Footer:({className:t,...n})=>d(`div`,{"data-slot":`sheet-footer`,className:e(`border-dialog-muted flex shrink-0 justify-end gap-2 border-t px-6 py-2.5`,t),...n}),Header:({className:t,...n})=>d(`div`,{"data-slot":`sheet-header`,className:e(`border-dialog-muted flex shrink-0 flex-col gap-2 border-b py-4 pl-6 pr-4`,`has-[.icon-button]:pr-4`,t),...n}),Title:({className:t,ref:n,...r})=>d(l,{"data-slot":`sheet-title`,ref:n,className:e(`text-strong flex-1 truncate text-lg font-medium`,t),...r}),TitleGroup:({children:t,className:n,ref:r,...i})=>d(`div`,{"data-slot":`sheet-title-group`,className:e(`flex items-center justify-between gap-2`,n),...i,ref:r,children:t}),Trigger:g};export{x as t};
|
package/dist/sheet.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { i as IconButtonIntent, n as IconButtonProps, r as IconButtonAppearance } from "./button-
|
|
2
|
-
import {
|
|
1
|
+
import { i as IconButtonIntent, n as IconButtonProps, r as IconButtonAppearance } from "./button-C39M5h4K.js";
|
|
2
|
+
import { n as Content$1, o as Root, r as Description$1, s as Title$1 } from "./dialog-u8PtHYES.js";
|
|
3
3
|
import { ComponentProps, HTMLAttributes } from "react";
|
|
4
4
|
import { VariantProps } from "class-variance-authority";
|
|
5
5
|
//#region src/components/sheet/sheet.d.ts
|
|
6
|
-
declare const
|
|
6
|
+
declare const sheetVariants: (props?: ({
|
|
7
7
|
side?: "left" | "right" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
-
type SheetContentProps = ComponentProps<typeof Content$1> & VariantProps<typeof
|
|
9
|
+
type SheetContentProps = ComponentProps<typeof Content$1> & VariantProps<typeof sheetVariants> & {
|
|
10
10
|
/**
|
|
11
11
|
* The preferred width of the `Sheet.Content` as a tailwind `max-w-` class.
|
|
12
12
|
*
|
|
@@ -23,9 +23,11 @@ type SheetContentProps = ComponentProps<typeof Content$1> & VariantProps<typeof
|
|
|
23
23
|
* Renders on top of the overlay backdrop.
|
|
24
24
|
* Should contain the `Sheet.Header`, `Sheet.Body`, and `Sheet.Footer`.
|
|
25
25
|
*
|
|
26
|
-
* `Sheet.Content` renders its floating layer at Tailwind `z-
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* `Sheet.Content` renders its floating layer at Tailwind `z-60`, Mantle's
|
|
27
|
+
* overlay tier, above every float (`z-50`). Floats composed inside the content
|
|
28
|
+
* portal into the positioner (`data-slot="sheet-positioner"`) and paint above
|
|
29
|
+
* the content. When multiple overlays are open, the most recently mounted
|
|
30
|
+
* overlay renders on top.
|
|
29
31
|
*
|
|
30
32
|
* @see https://mantle.ngrok.com/components/overlays/sheet#sheetcontent
|
|
31
33
|
*
|
|
@@ -509,9 +511,11 @@ declare const Actions: ({ children, className, ref, ...props }: ComponentProps<"
|
|
|
509
511
|
* interrupts the user, use `Dialog` (or `AlertDialog` for destructive
|
|
510
512
|
* confirmations).
|
|
511
513
|
*
|
|
512
|
-
* `Sheet` renders its floating layer at Tailwind `z-
|
|
513
|
-
*
|
|
514
|
-
*
|
|
514
|
+
* `Sheet` renders its floating layer at Tailwind `z-60`, Mantle's overlay tier,
|
|
515
|
+
* above every float (`z-50`). Floats composed inside the content portal into
|
|
516
|
+
* the positioner (`data-slot="sheet-positioner"`) and paint above the content.
|
|
517
|
+
* When multiple overlays are open, the most recently mounted overlay renders on
|
|
518
|
+
* top.
|
|
515
519
|
*
|
|
516
520
|
* @see https://mantle.ngrok.com/components/overlays/sheet
|
|
517
521
|
*
|
|
@@ -629,9 +633,11 @@ declare const Sheet: {
|
|
|
629
633
|
* The root component for a `Sheet`. Should compose the `Sheet.Trigger` and `Sheet.Content`.
|
|
630
634
|
* Acts as a stateful provider for the Sheet's open/closed state.
|
|
631
635
|
*
|
|
632
|
-
* `Sheet` renders its floating layer at Tailwind `z-
|
|
633
|
-
*
|
|
634
|
-
*
|
|
636
|
+
* `Sheet` renders its floating layer at Tailwind `z-60`, Mantle's overlay
|
|
637
|
+
* tier, above every float (`z-50`). Floats composed inside the content portal
|
|
638
|
+
* into the positioner (`data-slot="sheet-positioner"`) and paint above the
|
|
639
|
+
* content. When multiple overlays are open, the most recently mounted overlay
|
|
640
|
+
* renders on top.
|
|
635
641
|
*
|
|
636
642
|
* @see https://mantle.ngrok.com/components/overlays/sheet#sheetroot
|
|
637
643
|
*
|
|
@@ -827,9 +833,11 @@ declare const Sheet: {
|
|
|
827
833
|
* Renders on top of the overlay backdrop.
|
|
828
834
|
* Should contain the `Sheet.Header`, `Sheet.Body`, and `Sheet.Footer`.
|
|
829
835
|
*
|
|
830
|
-
* `Sheet.Content` renders its floating layer at Tailwind `z-
|
|
831
|
-
*
|
|
832
|
-
*
|
|
836
|
+
* `Sheet.Content` renders its floating layer at Tailwind `z-60`, Mantle's
|
|
837
|
+
* overlay tier, above every float (`z-50`). Floats composed inside the content
|
|
838
|
+
* portal into the positioner (`data-slot="sheet-positioner"`) and paint above
|
|
839
|
+
* the content. When multiple overlays are open, the most recently mounted
|
|
840
|
+
* overlay renders on top.
|
|
833
841
|
*
|
|
834
842
|
* @see https://mantle.ngrok.com/components/overlays/sheet#sheetcontent
|
|
835
843
|
*
|
package/dist/sheet.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./sheet-
|
|
1
|
+
import{t as e}from"./sheet-BcfnKUit.js";export{e as Sheet};
|
package/dist/sidebar.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
2
|
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
3
|
-
import { n as IconButtonProps } from "./button-
|
|
3
|
+
import { n as IconButtonProps } from "./button-C39M5h4K.js";
|
|
4
4
|
import { n as Separator } from "./separator-CNDs98Dv.js";
|
|
5
|
-
import { t as Tooltip } from "./tooltip-
|
|
5
|
+
import { t as Tooltip } from "./tooltip-BKWK5c7_.js";
|
|
6
6
|
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
7
7
|
//#region src/components/sidebar/sidebar.d.ts
|
|
8
8
|
/**
|
|
@@ -333,7 +333,7 @@ declare const Nav: ({ "aria-label": ariaLabelProp, "aria-labelledby": ariaLabell
|
|
|
333
333
|
/**
|
|
334
334
|
* The props for `Sidebar.Trigger`. `IconButton`'s props, except the parts the
|
|
335
335
|
* trigger owns: `asChild` and `children` are removed (the trigger renders
|
|
336
|
-
* only its icon and
|
|
336
|
+
* only its icon and `aria-label`; build custom triggers with `useSidebar`
|
|
337
337
|
* instead), and `appearance`, `icon`, `intent`, and `label` become optional
|
|
338
338
|
* with sidebar defaults.
|
|
339
339
|
*/
|
|
@@ -357,9 +357,8 @@ type SidebarTriggerProps = Omit<IconButtonProps, "appearance" | "asChild" | "chi
|
|
|
357
357
|
*/
|
|
358
358
|
intent?: IconButtonProps["intent"];
|
|
359
359
|
/**
|
|
360
|
-
* The accessible name for the trigger, and what its tooltip says.
|
|
361
|
-
*
|
|
362
|
-
* Override it for localization.
|
|
360
|
+
* The accessible name for the trigger, and what its tooltip says. Renders
|
|
361
|
+
* as the button's `aria-label`. Override it for localization.
|
|
363
362
|
*
|
|
364
363
|
* @default "Toggle Sidebar"
|
|
365
364
|
*/
|
package/dist/sidebar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./slot-DpNWVci8.js";import{t as r}from"./button-CNg69RsV.js";import{t as i}from"./use-is-hydrated-DDCqXmju.js";import{n as a}from"./separator-D0D6VyyM.js";import{n as o,t as s}from"./use-is-apple-platform-Cxwrb86L.js";import{t as c}from"./use-callback-ref-IYti9y7x.js";import{n as l}from"./cookie-ca4g5CKp.js";import{t as u}from"./sheet-CfFXVAzz.js";import{r as d}from"./use-breakpoint-Dqu12Szq.js";import{t as f}from"./tooltip-Dnu35cjU.js";import{createContext as p,useCallback as m,useContext as h,useEffect as g,useId as _,useMemo as v,useRef as y,useState as b}from"react";import x from"tiny-invariant";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";import{SidebarSimpleIcon as T}from"@phosphor-icons/react/SidebarSimple";const E={sm:`hidden sm:block`,md:`hidden md:block`,lg:`hidden lg:block`},D=p(null);function O(){let e=h(D);return x(e,`useSidebar must be used within Sidebar.Root.`),e}function k(e){let t=h(D);return x(t,`Sidebar.${e} must be rendered inside Sidebar.Root.`),t}const A=[];function j(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.tagName===`SELECT`:!1}function M(){let e=Symbol(`sidebar-keyboard-shortcut`);return A.push(e),{isOwner:()=>A[0]===e,release:()=>{let t=A.indexOf(e);t!==-1&&A.splice(t,1)}}}const N=({children:e,defaultOpen:t=!0,keyboardShortcut:n=!0,mobileBreakpoint:r=`lg`,onOpenChange:i,onOpenMobileChange:a,open:s,openMobile:l})=>{let u=d(r),f=_(),p=s!=null,[h,x]=b(t),S=p?s:h,w=m(e=>{p||x(e),i?.(e)},[p,i]),T=l!=null,[E,O]=b(!1),k=T?l:E,A=m(e=>{T||O(e),a?.(e)},[T,a]),N=y(u);g(()=>{let e=N.current&&!u;N.current=u,e&&k&&A(!1)},[u,k,A]);let P=m(()=>{u?A(!k):w(!S)},[u,S,k,w,A]),F=c(P);g(()=>{if(!n)return;let e=M(),t=o(),r=n=>{if(!e.isOwner()||j(n.target))return;let r=t?n.metaKey:n.ctrlKey,i=t?n.ctrlKey:n.metaKey;n.key.toLowerCase()===`b`&&r&&!i&&!n.altKey&&!n.shiftKey&&(n.preventDefault(),F())};return window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`keydown`,r),e.release()}},[n,F]);let I=v(()=>({isMobile:u,keyboardShortcut:n,mobileBreakpoint:r,navId:f,open:S,openMobile:k,setOpen:w,setOpenMobile:A,toggle:P}),[u,n,r,f,S,k,w,A,P]);return C(D.Provider,{value:I,children:e})},P=({"aria-label":n,"aria-labelledby":r,children:a,className:o,"data-slot":s,...c})=>{let{isMobile:l,mobileBreakpoint:d,navId:f,open:p,openMobile:m,setOpenMobile:h}=k(`Nav`),g=i(),_=n??(r==null?`Main`:void 0);return l?C(u.Root,{open:m,onOpenChange:h,children:w(u.Content,{side:`left`,preferredWidth:`sm:max-w-(--sidebar-width-mobile,18rem)`,"data-slot":t(s,`sidebar-nav`),"data-mobile":``,...r==null?null:{"aria-labelledby":r},className:e(`bg-base w-(--sidebar-width-mobile,18rem) max-w-full p-0`,o),...c,children:[C(u.Title,{className:`sr-only`,children:_??`Sidebar`}),C(`nav`,{id:f,"aria-label":_,"aria-labelledby":r,className:`flex h-full w-full min-w-0 flex-col text-sm`,children:a})]})}):C(`div`,{"data-slot":t(s,`sidebar-nav`),"data-state":p?`expanded`:`collapsed`,"data-hydrated":g?``:void 0,className:e(`group/sidebar-nav bg-base relative h-full w-(--sidebar-width,13rem) shrink-0 overflow-hidden`,`data-[state=collapsed]:w-(--sidebar-width-icon,3.25rem)`,!g&&E[d],g&&[`transition-[width] duration-200 ease-linear motion-reduce:transition-none`],o),...c,children:C(`nav`,{id:f,"aria-label":_,"aria-labelledby":r,className:`absolute inset-y-0 left-0 flex w-full min-w-0 flex-col text-sm`,children:a})})},F=C(T,{}),I=({label:e,shortcut:t})=>t==null?e:w(`span`,{className:`flex items-center gap-1.5`,children:[e,C(`span`,{"aria-hidden":!0,className:`inline-flex shrink-0 items-center gap-0.5 [&_kbd]:h-4 [&_kbd]:min-w-4 [&_kbd]:bg-neutral-500/25 [&_kbd]:px-0.5 [&_kbd]:text-xs`,children:t})]}),L=({appearance:e=`ghost`,"data-slot":n,icon:i=F,intent:a=`neutral`,label:o=`Toggle Sidebar`,onClick:c,shortcut:l,...u})=>{let{isMobile:d,keyboardShortcut:p,navId:m,open:h,openMobile:g,toggle:_}=k(`Trigger`),v=s(),y=d?g:h,b=!d||g,x=p?l:void 0,S=v?`Meta+B`:`Control+B`;return w(f.Root,{children:[C(f.Trigger,{asChild:!0,children:C(r,{appearance:e,"aria-controls":b?m:void 0,"aria-expanded":y,"aria-keyshortcuts":p?S:void 0,"data-slot":t(n,`sidebar-trigger`),"data-state":y?`expanded`:`collapsed`,icon:i,intent:a,label:o,onClick:e=>{c?.(e),e.defaultPrevented||_()},...u})}),C(f.Content,{"data-slot":`sidebar-trigger-tooltip`,children:C(I,{label:o,shortcut:x})})]})},R=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`div`,{"data-slot":t(o,`sidebar-header`),className:e(`grid grid-cols-1 grid-rows-(--sidebar-header-height,4.5rem) shrink-0 items-center px-3`,`group-data-[state=expanded]/sidebar-nav:pr-1`,a),...s,children:i}),z=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`div`,{"data-slot":t(o,`sidebar-body`),className:e(`scrollbar scrollbar-gutter-stable scroll-fade-y flex-1 scroll-py-6 space-y-2 overflow-y-auto overflow-x-hidden px-3 pt-1.5 pb-4`,`group-data-[state=expanded]/sidebar-nav:pr-1`,`group-data-[state=collapsed]/sidebar-nav:scrollbar-none`,`group-data-[state=collapsed]/sidebar-nav:scrollbar-gutter-auto`,`group-data-[state=collapsed]/sidebar-nav:[&::-webkit-scrollbar]:hidden`,a),...s,children:i}),B=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`div`,{"data-slot":t(o,`sidebar-footer`),className:e(`shrink-0 px-3 pt-3 pb-3.5`,`group-data-[state=expanded]/sidebar-nav:pr-1`,a),...s,children:i}),V=p(null),H=({asChild:r,children:i,className:a,"data-slot":o,...s})=>{let[c,l]=b(null),u=v(()=>({mountedLabelId:c,setMountedLabelId:l}),[c]),d=r?n:`div`;return C(V.Provider,{value:u,children:C(d,{"data-slot":t(o,`sidebar-group`),className:e(`pt-0.5`,a),...s,children:i})})},U=({asChild:r,children:i,className:a,"data-slot":o,id:s,...c})=>{let l=h(V),u=_(),d=s??(l==null?void 0:u),f=l?.setMountedLabelId;return g(()=>{if(f!=null&&d!=null)return f(d),()=>{f(null)}},[f,d]),C(r?n:`div`,{id:d,"data-slot":t(o,`sidebar-group-label`),className:e(`text-muted flex min-w-0 items-center gap-2 truncate px-2 py-1 text-xs font-medium`,`group-data-[state=collapsed]/sidebar-nav:opacity-0`,`group-data-[state=collapsed]/sidebar-nav:pointer-events-none`,`group-data-hydrated/sidebar-nav:transition-opacity group-data-hydrated/sidebar-nav:duration-200 group-data-hydrated/sidebar-nav:ease-linear group-data-hydrated/sidebar-nav:motion-reduce:transition-none`,a),...c,children:i})},W=({"aria-labelledby":r,asChild:i,children:a,className:o,"data-slot":s,...c})=>{let l=h(V);return C(i?n:`ul`,{"aria-labelledby":r??l?.mountedLabelId??void 0,"data-slot":t(s,`sidebar-list`),className:e(`mb-2 space-y-px`,o),...c,children:a})},G=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`li`,{"data-slot":t(o,`sidebar-item`),className:e(`list-none`,a),...s,children:i}),K=[`ring-focus-accent flex w-full min-w-0 items-center gap-2 truncate rounded-md px-2 py-1 text-left font-normal transition-none focus:outline-hidden focus-visible:ring-4`,`text-body hover:text-strong hover:bg-neutral-500/10`,`data-state-open:bg-neutral-500/15 data-state-open:text-strong`,`group-data-[state=collapsed]/sidebar-nav:ml-1`,`group-data-[state=collapsed]/sidebar-nav:w-7`,`group-data-[state=collapsed]/sidebar-nav:p-1`],q={Root:N,Nav:P,Trigger:L,Header:R,Body:z,Footer:B,Group:H,GroupLabel:U,List:W,Item:G,ItemButton:({asChild:r,children:i,className:a,current:o,"data-slot":s,type:c,...l})=>C(r?n:`button`,{"data-slot":t(s,`sidebar-item-button`),"data-current":o?``:void 0,"aria-current":o?`page`:void 0,type:r?c:c??`button`,className:e(K,`data-current:bg-neutral-500/15 data-current:text-strong`,`aria-[current=page]:bg-neutral-500/15 aria-[current=page]:text-strong`,`[&>svg]:text-muted hover:[&>svg]:text-strong data-current:[&>svg]:text-strong aria-[current=page]:[&>svg]:text-strong [&>svg:first-child]:size-5 [&>svg]:shrink-0`,a),...l,children:i}),SearchTrigger:({asChild:r,children:i,className:a,"data-slot":o,shortcut:s,type:c,...l})=>{let u=r?n:`button`,d=s==null?i:w(S,{children:[i,C(`span`,{"aria-hidden":!0,className:e(`pointer-events-none -mr-1 ml-auto inline-flex shrink-0 items-center gap-0.5 opacity-0 select-none`,`group-hover:opacity-100 group-focus-visible:opacity-100`,`group-data-[state=collapsed]/sidebar-nav:hidden`,`[&_kbd]:text-body [&_kbd]:h-5 [&_kbd]:min-w-5 [&_kbd]:bg-neutral-500/20 [&_kbd]:px-1 [&_kbd]:text-xs [&_kbd]:font-normal`),children:s})]});return C(u,{"data-slot":t(o,`sidebar-search-trigger`),type:r?c:c??`button`,className:e(`group`,K,`[&>svg:first-child]:text-muted hover:[&>svg:first-child]:text-strong [&>svg:first-child]:size-5 [&>svg]:shrink-0`,a),...l,children:d})},SwitcherTrigger:({asChild:r,children:i,className:a,"data-slot":o,type:s,...c})=>C(r?n:`button`,{"data-slot":t(o,`sidebar-switcher-trigger`),type:r?s:s??`button`,className:e(`text-body hover:text-strong hover:bg-neutral-500/10 flex w-full min-w-0 items-center gap-2 rounded-[0.625rem] py-1 pr-1.5 pl-1 text-left font-medium transition-none`,`data-state-open:bg-neutral-500/15 data-state-open:text-strong`,`ring-focus-accent focus:outline-hidden focus-visible:ring-4`,`*:first:size-7`,`group-data-[state=collapsed]/sidebar-nav:w-9`,`group-data-[state=collapsed]/sidebar-nav:p-1`,`group-data-[state=collapsed]/sidebar-nav:[&>:not(:first-child)]:sr-only`,a),...c,children:i}),Tooltip:({children:e,"data-slot":n,label:r,shortcut:i,side:a=`right`,...o})=>{let{isMobile:s,open:c}=k(`Tooltip`),l=!s&&!c,[u,d]=b(!1),[p,m]=b(l);return p!==l&&(m(l),d(!1)),w(f.Root,{disableHoverableContent:!0,onOpenChange:e=>{d(e&&l)},open:l&&u,children:[C(f.Trigger,{asChild:!0,children:e}),C(f.Content,{"data-slot":t(n,`sidebar-tooltip`),side:a,...o,children:C(I,{label:r,shortcut:i})})]})},Separator:({className:n,"data-slot":r,...i})=>C(a,{"data-slot":t(r,`sidebar-separator`),className:e(`my-3`,`group-data-[state=collapsed]/sidebar-nav:w-9`,n),...i})},J=`mantle-sidebar-state`,Y={collapsed:`collapsed`,expanded:`expanded`};function X(e){let t=l(e,J);if(t===Y.expanded)return!0;if(t===Y.collapsed)return!1}function Z(e,t={}){let{domain:n,maxAge:r=31536e3,path:i=`/`,sameSite:a=`Lax`,secure:o=!1}=t,s=e?Y.expanded:Y.collapsed,c=[`${J}=${s}`,`Max-Age=${r}`,`Path=${i}`];return n!=null&&c.push(`Domain=${n}`),c.push(`SameSite=${a}`),o&&c.push(`Secure`),c.join(`; `)}export{J as SIDEBAR_STATE_COOKIE_NAME,q as Sidebar,X as extractSidebarStateCookie,Z as serializeSidebarStateCookie,O as useSidebar};
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./slot-DpNWVci8.js";import{t as r}from"./button-CC10rP6X.js";import{t as i}from"./use-is-hydrated-DDCqXmju.js";import{n as a}from"./separator-D0D6VyyM.js";import{n as o,t as s}from"./use-is-apple-platform-Cxwrb86L.js";import{t as c}from"./use-callback-ref-IYti9y7x.js";import{n as l}from"./cookie-ca4g5CKp.js";import{t as u}from"./sheet-BcfnKUit.js";import{r as d}from"./use-breakpoint-Dqu12Szq.js";import{t as f}from"./tooltip-BZRRJgpm.js";import{createContext as p,useCallback as m,useContext as h,useEffect as g,useId as _,useMemo as v,useRef as y,useState as b}from"react";import x from"tiny-invariant";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";import{SidebarSimpleIcon as T}from"@phosphor-icons/react/SidebarSimple";const E={sm:`hidden sm:block`,md:`hidden md:block`,lg:`hidden lg:block`},D=p(null);function O(){let e=h(D);return x(e,`useSidebar must be used within Sidebar.Root.`),e}function k(e){let t=h(D);return x(t,`Sidebar.${e} must be rendered inside Sidebar.Root.`),t}const A=[];function j(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.tagName===`SELECT`:!1}function M(){let e=Symbol(`sidebar-keyboard-shortcut`);return A.push(e),{isOwner:()=>A[0]===e,release:()=>{let t=A.indexOf(e);t!==-1&&A.splice(t,1)}}}const N=({children:e,defaultOpen:t=!0,keyboardShortcut:n=!0,mobileBreakpoint:r=`lg`,onOpenChange:i,onOpenMobileChange:a,open:s,openMobile:l})=>{let u=d(r),f=_(),p=s!=null,[h,x]=b(t),S=p?s:h,w=m(e=>{p||x(e),i?.(e)},[p,i]),T=l!=null,[E,O]=b(!1),k=T?l:E,A=m(e=>{T||O(e),a?.(e)},[T,a]),N=y(u);g(()=>{let e=N.current&&!u;N.current=u,e&&k&&A(!1)},[u,k,A]);let P=m(()=>{u?A(!k):w(!S)},[u,S,k,w,A]),F=c(P);g(()=>{if(!n)return;let e=M(),t=o(),r=n=>{if(!e.isOwner()||j(n.target))return;let r=t?n.metaKey:n.ctrlKey,i=t?n.ctrlKey:n.metaKey;n.key.toLowerCase()===`b`&&r&&!i&&!n.altKey&&!n.shiftKey&&(n.preventDefault(),F())};return window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`keydown`,r),e.release()}},[n,F]);let I=v(()=>({isMobile:u,keyboardShortcut:n,mobileBreakpoint:r,navId:f,open:S,openMobile:k,setOpen:w,setOpenMobile:A,toggle:P}),[u,n,r,f,S,k,w,A,P]);return C(D.Provider,{value:I,children:e})},P=({"aria-label":n,"aria-labelledby":r,children:a,className:o,"data-slot":s,...c})=>{let{isMobile:l,mobileBreakpoint:d,navId:f,open:p,openMobile:m,setOpenMobile:h}=k(`Nav`),g=i(),_=n??(r==null?`Main`:void 0);return l?C(u.Root,{open:m,onOpenChange:h,children:w(u.Content,{side:`left`,preferredWidth:`sm:max-w-(--sidebar-width-mobile,18rem)`,"data-slot":t(s,`sidebar-nav`),"data-mobile":``,...r==null?null:{"aria-labelledby":r},className:e(`bg-base w-(--sidebar-width-mobile,18rem) max-w-full p-0`,o),...c,children:[C(u.Title,{className:`sr-only`,children:_??`Sidebar`}),C(`nav`,{id:f,"aria-label":_,"aria-labelledby":r,className:`flex h-full w-full min-w-0 flex-col text-sm`,children:a})]})}):C(`div`,{"data-slot":t(s,`sidebar-nav`),"data-state":p?`expanded`:`collapsed`,"data-hydrated":g?``:void 0,className:e(`group/sidebar-nav bg-base relative h-full w-(--sidebar-width,13rem) shrink-0 overflow-hidden`,`data-[state=collapsed]:w-(--sidebar-width-icon,3.25rem)`,!g&&E[d],g&&[`transition-[width] duration-200 ease-linear motion-reduce:transition-none`],o),...c,children:C(`nav`,{id:f,"aria-label":_,"aria-labelledby":r,className:`absolute inset-y-0 left-0 flex w-full min-w-0 flex-col text-sm`,children:a})})},F=C(T,{}),I=({label:e,shortcut:t})=>t==null?e:w(`span`,{className:`flex items-center gap-1.5`,children:[e,C(`span`,{"aria-hidden":!0,className:`inline-flex shrink-0 items-center gap-0.5 [&_kbd]:h-4 [&_kbd]:min-w-4 [&_kbd]:bg-neutral-500/25 [&_kbd]:px-0.5 [&_kbd]:text-xs`,children:t})]}),L=({appearance:e=`ghost`,"data-slot":n,icon:i=F,intent:a=`neutral`,label:o=`Toggle Sidebar`,onClick:c,shortcut:l,...u})=>{let{isMobile:d,keyboardShortcut:p,navId:m,open:h,openMobile:g,toggle:_}=k(`Trigger`),v=s(),y=d?g:h,b=!d||g,x=p?l:void 0,S=v?`Meta+B`:`Control+B`;return w(f.Root,{children:[C(f.Trigger,{asChild:!0,children:C(r,{appearance:e,"aria-controls":b?m:void 0,"aria-expanded":y,"aria-keyshortcuts":p?S:void 0,"data-slot":t(n,`sidebar-trigger`),"data-state":y?`expanded`:`collapsed`,icon:i,intent:a,label:o,onClick:e=>{c?.(e),e.defaultPrevented||_()},...u})}),C(f.Content,{"data-slot":`sidebar-trigger-tooltip`,children:C(I,{label:o,shortcut:x})})]})},R=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`div`,{"data-slot":t(o,`sidebar-header`),className:e(`grid grid-cols-1 grid-rows-(--sidebar-header-height,4.5rem) shrink-0 items-center px-3`,`group-data-[state=expanded]/sidebar-nav:pr-1`,a),...s,children:i}),z=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`div`,{"data-slot":t(o,`sidebar-body`),className:e(`scrollbar scrollbar-gutter-stable scroll-fade-y flex-1 scroll-py-6 space-y-2 overflow-y-auto overflow-x-hidden px-3 pt-1.5 pb-4`,`group-data-[state=expanded]/sidebar-nav:pr-1`,`group-data-[state=collapsed]/sidebar-nav:scrollbar-none`,`group-data-[state=collapsed]/sidebar-nav:scrollbar-gutter-auto`,`group-data-[state=collapsed]/sidebar-nav:[&::-webkit-scrollbar]:hidden`,a),...s,children:i}),B=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`div`,{"data-slot":t(o,`sidebar-footer`),className:e(`shrink-0 px-3 pt-3 pb-3.5`,`group-data-[state=expanded]/sidebar-nav:pr-1`,a),...s,children:i}),V=p(null),H=({asChild:r,children:i,className:a,"data-slot":o,...s})=>{let[c,l]=b(null),u=v(()=>({mountedLabelId:c,setMountedLabelId:l}),[c]),d=r?n:`div`;return C(V.Provider,{value:u,children:C(d,{"data-slot":t(o,`sidebar-group`),className:e(`pt-0.5`,a),...s,children:i})})},U=({asChild:r,children:i,className:a,"data-slot":o,id:s,...c})=>{let l=h(V),u=_(),d=s??(l==null?void 0:u),f=l?.setMountedLabelId;return g(()=>{if(f!=null&&d!=null)return f(d),()=>{f(null)}},[f,d]),C(r?n:`div`,{id:d,"data-slot":t(o,`sidebar-group-label`),className:e(`text-muted flex min-w-0 items-center gap-2 truncate px-2 py-1 text-xs font-medium`,`group-data-[state=collapsed]/sidebar-nav:opacity-0`,`group-data-[state=collapsed]/sidebar-nav:pointer-events-none`,`group-data-hydrated/sidebar-nav:transition-opacity group-data-hydrated/sidebar-nav:duration-200 group-data-hydrated/sidebar-nav:ease-linear group-data-hydrated/sidebar-nav:motion-reduce:transition-none`,a),...c,children:i})},W=({"aria-labelledby":r,asChild:i,children:a,className:o,"data-slot":s,...c})=>{let l=h(V);return C(i?n:`ul`,{"aria-labelledby":r??l?.mountedLabelId??void 0,"data-slot":t(s,`sidebar-list`),className:e(`mb-2 space-y-px`,o),...c,children:a})},G=({asChild:r,children:i,className:a,"data-slot":o,...s})=>C(r?n:`li`,{"data-slot":t(o,`sidebar-item`),className:e(`list-none`,a),...s,children:i}),K=[`ring-focus-accent flex w-full min-w-0 items-center gap-2 truncate rounded-md px-2 py-1 text-left font-normal transition-none focus:outline-hidden focus-visible:ring-4`,`text-body hover:text-strong hover:bg-neutral-500/10`,`data-state-open:bg-neutral-500/15 data-state-open:text-strong`,`group-data-[state=collapsed]/sidebar-nav:ml-1`,`group-data-[state=collapsed]/sidebar-nav:w-7`,`group-data-[state=collapsed]/sidebar-nav:p-1`],q={Root:N,Nav:P,Trigger:L,Header:R,Body:z,Footer:B,Group:H,GroupLabel:U,List:W,Item:G,ItemButton:({asChild:r,children:i,className:a,current:o,"data-slot":s,type:c,...l})=>C(r?n:`button`,{"data-slot":t(s,`sidebar-item-button`),"data-current":o?``:void 0,"aria-current":o?`page`:void 0,type:r?c:c??`button`,className:e(K,`data-current:bg-neutral-500/15 data-current:text-strong`,`aria-[current=page]:bg-neutral-500/15 aria-[current=page]:text-strong`,`[&>svg]:text-muted hover:[&>svg]:text-strong data-current:[&>svg]:text-strong aria-[current=page]:[&>svg]:text-strong [&>svg:first-child]:size-5 [&>svg]:shrink-0`,a),...l,children:i}),SearchTrigger:({asChild:r,children:i,className:a,"data-slot":o,shortcut:s,type:c,...l})=>{let u=r?n:`button`,d=s==null?i:w(S,{children:[i,C(`span`,{"aria-hidden":!0,className:e(`pointer-events-none -mr-1 ml-auto inline-flex shrink-0 items-center gap-0.5 opacity-0 select-none`,`group-hover:opacity-100 group-focus-visible:opacity-100`,`group-data-[state=collapsed]/sidebar-nav:hidden`,`[&_kbd]:text-body [&_kbd]:h-5 [&_kbd]:min-w-5 [&_kbd]:bg-neutral-500/20 [&_kbd]:px-1 [&_kbd]:text-xs [&_kbd]:font-normal`),children:s})]});return C(u,{"data-slot":t(o,`sidebar-search-trigger`),type:r?c:c??`button`,className:e(`group`,K,`[&>svg:first-child]:text-muted hover:[&>svg:first-child]:text-strong [&>svg:first-child]:size-5 [&>svg]:shrink-0`,a),...l,children:d})},SwitcherTrigger:({asChild:r,children:i,className:a,"data-slot":o,type:s,...c})=>C(r?n:`button`,{"data-slot":t(o,`sidebar-switcher-trigger`),type:r?s:s??`button`,className:e(`text-body hover:text-strong hover:bg-neutral-500/10 flex w-full min-w-0 items-center gap-2 rounded-[0.625rem] py-1 pr-1.5 pl-1 text-left font-medium transition-none`,`data-state-open:bg-neutral-500/15 data-state-open:text-strong`,`ring-focus-accent focus:outline-hidden focus-visible:ring-4`,`*:first:size-7`,`group-data-[state=collapsed]/sidebar-nav:w-9`,`group-data-[state=collapsed]/sidebar-nav:p-1`,`group-data-[state=collapsed]/sidebar-nav:[&>:not(:first-child)]:sr-only`,a),...c,children:i}),Tooltip:({children:e,"data-slot":n,label:r,shortcut:i,side:a=`right`,...o})=>{let{isMobile:s,open:c}=k(`Tooltip`),l=!s&&!c,[u,d]=b(!1),[p,m]=b(l);return p!==l&&(m(l),d(!1)),w(f.Root,{disableHoverableContent:!0,onOpenChange:e=>{d(e&&l)},open:l&&u,children:[C(f.Trigger,{asChild:!0,children:e}),C(f.Content,{"data-slot":t(n,`sidebar-tooltip`),side:a,...o,children:C(I,{label:r,shortcut:i})})]})},Separator:({className:n,"data-slot":r,...i})=>C(a,{"data-slot":t(r,`sidebar-separator`),className:e(`my-3`,`group-data-[state=collapsed]/sidebar-nav:w-9`,n),...i})},J=`mantle-sidebar-state`,Y={collapsed:`collapsed`,expanded:`expanded`};function X(e){let t=l(e,J);if(t===Y.expanded)return!0;if(t===Y.collapsed)return!1}function Z(e,t={}){let{domain:n,maxAge:r=31536e3,path:i=`/`,sameSite:a=`Lax`,secure:o=!1}=t,s=e?Y.expanded:Y.collapsed,c=[`${J}=${s}`,`Max-Age=${r}`,`Path=${i}`];return n!=null&&c.push(`Domain=${n}`),c.push(`SameSite=${a}`),o&&c.push(`Secure`),c.join(`; `)}export{J as SIDEBAR_STATE_COOKIE_NAME,q as Sidebar,X as extractSidebarStateCookie,Z as serializeSidebarStateCookie,O as useSidebar};
|
package/dist/split-button.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as Button } from "./button-DjsmeoJ2.js";
|
|
2
|
-
import { t as IconButton } from "./button-
|
|
2
|
+
import { t as IconButton } from "./button-C39M5h4K.js";
|
|
3
3
|
import { t as ButtonSize } from "./button-BCoI4bhP.js";
|
|
4
|
-
import { t as DropdownMenu } from "./dropdown-menu-
|
|
4
|
+
import { t as DropdownMenu } from "./dropdown-menu-CpsUJGbn.js";
|
|
5
5
|
import { ComponentProps, ReactNode } from "react";
|
|
6
6
|
//#region src/components/split-button/split-button.d.ts
|
|
7
7
|
type RootProps = ComponentProps<typeof DropdownMenu.Root> & ComponentProps<"div"> & {
|
package/dist/split-button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./button-Bc0lEOJ2.js";import{t as r}from"./button-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./button-Bc0lEOJ2.js";import{t as r}from"./button-CC10rP6X.js";import{t as i}from"./dropdown-menu-DJDrRzDU.js";import{CaretDownIcon as a}from"@phosphor-icons/react/CaretDown";import{createContext as o,useContext as s,useMemo as c}from"react";import{jsx as l}from"react/jsx-runtime";const u=o({size:`md`}),d={Root:({className:t,children:n,dir:r,open:a,defaultOpen:o,onOpenChange:s,modal:d,size:f=`md`,ref:p,...m})=>{let h=c(()=>({size:f}),[f]);return l(i.Root,{dir:r,open:a,defaultOpen:o,onOpenChange:s,modal:d,children:l(u.Provider,{value:h,children:l(`div`,{"data-slot":`split-button`,"data-size":f,className:e(`flex flex-row [&>*:first-child]:rounded-r-none [&>*:last-child]:rounded-l-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:not(:first-child)]:-ml-px [&>*:focus]:relative [&>*:focus]:z-10 [&>*:hover]:relative [&>*:hover]:z-10 *:active:scale-100!`,t),ref:p,...m,children:n})})})},PrimaryAction:e=>{let{size:t}=s(u);return l(n,{appearance:`outlined`,intent:`neutral`,size:t,...e})},MenuTrigger:({icon:e,...n})=>{let{size:o}=s(u);return l(i.Trigger,{asChild:!0,className:`group`,children:l(r,{icon:e??l(t,{svg:l(a,{weight:`bold`,className:`size-4 group-data-[state=open]:-rotate-180 transition-transform ease-out duration-150`})}),appearance:`outlined`,intent:`neutral`,size:o,...n})})},MenuContent:({align:e=`end`,...t})=>l(i.Content,{align:e,...t}),MenuItem:({className:t,...n})=>l(i.Item,{className:e(`gap-2`,t),...n})};export{d as SplitButton};
|