@ngrok/mantle 0.93.7 → 0.94.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.d.ts +13 -1
- package/dist/accordion.js +1 -1
- package/dist/agent.json +1181 -36
- package/dist/alert-CH99Rw-R.js +1 -0
- package/dist/{alert-BcSBNR3S.d.ts → alert-HffaioZM.d.ts} +31 -21
- package/dist/alert-center.d.ts +15 -3
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +15 -2
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +6 -1
- package/dist/alert.js +1 -1
- package/dist/anchor.d.ts +12 -0
- package/dist/app-layout.d.ts +16 -1
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +144 -88
- package/dist/area-chart.js +1 -1
- package/dist/avatar.d.ts +12 -0
- package/dist/badge.d.ts +13 -1
- package/dist/bar-chart.d.ts +144 -89
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +11 -0
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only.d.ts +8 -0
- package/dist/{button-Yxyu1XMd.d.ts → button-BGwOPjGV.d.ts} +7 -1
- package/dist/{button-B8k98Pby.js → button-BWGUuWnu.js} +1 -1
- package/dist/{button-CPsKGDK0.d.ts → button-Cgf2IcEC.d.ts} +8 -1
- package/dist/button-Cu9e3SM7.js +1 -0
- package/dist/{button-BX-4lYUn.d.ts → button-K0pKc3GN.d.ts} +3 -3
- package/dist/button.d.ts +9 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +7 -0
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +6 -1
- package/dist/centered-layout.d.ts +11 -0
- package/dist/chart-BO9EwQ60.js +1 -0
- package/dist/chart-CE5Uaqz9.js +1 -0
- package/dist/chart-DCTGGlWL.js +1 -0
- package/dist/chart-DudCw24t.js +2 -0
- package/dist/{chart-BpfbtOUN.d.ts → chart-jitNqimS.d.ts} +99 -103
- package/dist/{checkbox-DmSQXs26.js → checkbox-CS504fKk.js} +1 -1
- package/dist/checkbox.d.ts +14 -1
- package/dist/checkbox.js +1 -1
- package/dist/{choice-BLR0_MeB.d.ts → choice-BwfmbepO.d.ts} +7 -1
- package/dist/choice-uyYccm0A.js +1 -0
- package/dist/choice.d.ts +6 -1
- package/dist/choice.js +1 -1
- package/dist/code-block.d.ts +13 -2
- package/dist/code-block.js +1 -1
- package/dist/code-block_highlight-utils.d.ts +5 -0
- package/dist/code.d.ts +13 -0
- package/dist/color-CHZbU1Ww.js +1 -0
- package/dist/color.js +1 -1
- package/dist/combobox.d.ts +28 -14
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +14 -2
- package/dist/command.js +1 -1
- package/dist/cx.js +1 -1
- package/dist/data-table.d.ts +50 -19
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +12 -1
- package/dist/dialog-B9JAGy_x.d.ts +28 -0
- package/dist/{dialog-7TUgiSzX.js → dialog-CsugEt2A.js} +1 -1
- package/dist/{dialog-2fRO4ca4.d.ts → dialog-DD5H3EH1.d.ts} +10 -2
- package/dist/dialog.d.ts +7 -2
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-DHdgaw4P.js +1 -0
- package/dist/{dropdown-menu-CpjRwMWe.d.ts → dropdown-menu-DmDxYPde.d.ts} +34 -26
- package/dist/dropdown-menu.d.ts +6 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +5 -0
- package/dist/empty.js +1 -1
- package/dist/{field-V_gnkcmN.d.ts → field-BshcNVe_.d.ts} +1 -1
- package/dist/field.d.ts +17 -6
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +8 -0
- package/dist/hooks.d.ts +5 -0
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +23 -12
- package/dist/{icon-ByLVhdYq.d.ts → icon-NYvyyRMG.d.ts} +6 -0
- package/dist/icon.d.ts +7 -2
- package/dist/icon.js +1 -1
- package/dist/{icons-DP3lQw5O.js → icons-4JA-SGfv.js} +1 -1
- package/dist/icons.d.ts +13 -1
- package/dist/icons.js +1 -1
- package/dist/{index-BhfgyurF.d.ts → index-KJ06KK6t.d.ts} +3 -3
- package/dist/input-BjCDSOPA.js +1 -0
- package/dist/input-DHovzBjS.js +1 -0
- package/dist/{input-Dx5owTCc.d.ts → input-q8o5uMhW.d.ts} +11 -1
- package/dist/input.d.ts +34 -2
- package/dist/input.js +1 -1
- package/dist/kbd.d.ts +12 -0
- package/dist/{label-nHqqYS7e.js → label-DmDwzPD8.js} +1 -1
- package/dist/{label-Dn5CPJUj.d.ts → label-r2sJcSQ4.d.ts} +6 -0
- package/dist/label.d.ts +6 -1
- package/dist/label.js +1 -1
- package/dist/line-chart.d.ts +139 -82
- package/dist/line-chart.js +1 -1
- package/dist/{list-RFRIQxU2.js → list-CO_yLdln.js} +1 -1
- package/dist/list.d.ts +19 -1
- package/dist/list.js +1 -1
- package/dist/live-region.d.ts +14 -1
- package/dist/llms.txt +78 -76
- package/dist/main.d.ts +12 -0
- package/dist/mantle.css +110 -65
- package/dist/media-object.d.ts +12 -0
- 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 +15 -2
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +17 -5
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +92 -3
- package/dist/pagination.js +1 -1
- package/dist/popover-BhTFutCz.d.ts +1 -0
- package/dist/{popover-BfB2I9G0.d.ts → popover-lwkwWcRW.d.ts} +16 -7
- package/dist/popover.d.ts +7 -2
- package/dist/progress.d.ts +27 -10
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +9 -1
- package/dist/query.d.ts +2 -2
- package/dist/query.js +1 -1
- package/dist/radio-group-jj2abc0t.js +1 -0
- package/dist/radio-group-sLz5AA9I.d.ts +27 -0
- package/dist/radio-group.d.ts +20 -99
- package/dist/radio-group.js +1 -1
- package/dist/sandbar.d.ts +14 -1
- package/dist/sandbar.js +1 -1
- package/dist/sandboxed-on-click.d.ts +8 -0
- package/dist/scatter-plot.d.ts +126 -64
- 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-BkhBxtOT.d.ts → select-BqmpVJJT.d.ts} +29 -21
- package/dist/select-C6Su0dU0.js +1 -0
- package/dist/select.d.ts +6 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +13 -2
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-D9AWEkcJ.d.ts → separator-QfH0ot5K.d.ts} +3 -1
- package/dist/separator.d.ts +6 -1
- package/dist/{sheet-CSJc_sB4.js → sheet-Bd2LIhzF.js} +1 -1
- package/dist/sheet.d.ts +15 -2
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +19 -3
- package/dist/sidebar.js +1 -1
- package/dist/skeleton.d.ts +11 -0
- package/dist/skip-to-main-link.d.ts +11 -0
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.d.ts +10 -0
- package/dist/{slot-C0OCJjdJ.d.ts → slot-D12N_fZJ.d.ts} +3 -1
- package/dist/slot.d.ts +6 -1
- package/dist/split-button.d.ts +14 -3
- package/dist/split-button.js +1 -1
- package/dist/strata.d.ts +13 -0
- package/dist/switch.d.ts +13 -1
- package/dist/switch.js +1 -1
- package/dist/{table-vT6Okwfa.d.ts → table-rWiVWEgB.d.ts} +79 -0
- package/dist/table.d.ts +6 -1
- package/dist/tabs.d.ts +23 -11
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +11 -1
- package/dist/theme-DdZgLvKH.js +1 -0
- package/dist/theme-switcher.d.ts +16 -2
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +12 -0
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +14 -1
- package/dist/toast.js +1 -1
- package/dist/{tooltip-NcLIeBy5.d.ts → tooltip-CpK3XTor.d.ts} +15 -8
- package/dist/tooltip.d.ts +6 -1
- package/dist/truncated-text.d.ts +27 -13
- package/dist/truncated-text.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/use-inert-siblings-CNmNuS2h.js +1 -0
- package/dist/use-swipe-to-dismiss-i__cTF2v.js +1 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/visually-hidden.d.ts +13 -0
- package/dist/well.d.ts +6 -1
- package/package.json +6 -6
- package/src/components/chart/d3-license.md +25 -0
- package/dist/alert-P9lwn25X.js +0 -1
- package/dist/button-Dge0D5bl.js +0 -1
- package/dist/chart-BpWfQAwf.js +0 -2
- package/dist/choice-2Lrv8_nl.js +0 -1
- package/dist/dialog-Dp0QGWwo.d.ts +0 -28
- package/dist/dropdown-menu-BHBzCDSZ.js +0 -1
- package/dist/input-CpQ6jlpI.js +0 -1
- package/dist/popover-C96V8SXi.d.ts +0 -1
- package/dist/select-CAAYk4Yj.js +0 -1
- package/dist/theme-C-glc5Q-.js +0 -1
- package/dist/use-swipe-to-dismiss-DceYk1Id.js +0 -1
package/dist/multi-select.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Multi Select component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select
|
|
5
|
+
*/
|
|
1
6
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
7
|
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
3
|
-
import { o as WithValidation } from "./field-
|
|
4
|
-
import { n as Separator } from "./separator-
|
|
8
|
+
import { o as WithValidation } from "./field-BshcNVe_.js";
|
|
9
|
+
import { n as Separator } from "./separator-QfH0ot5K.js";
|
|
5
10
|
import { ComponentProps, ReactNode } from "react";
|
|
6
11
|
import { ComboboxGroupLabelProps, ComboboxGroupProps, ComboboxItemProps, ComboboxPopoverProps, ComboboxProps, ComboboxProviderProps } from "@ariakit/react/combobox";
|
|
7
12
|
type MultiSelectProps = ComboboxProviderProps<string[]>;
|
|
@@ -470,6 +475,14 @@ declare const ContentFooter: ({ "data-slot": dataSlot, className, children, ref,
|
|
|
470
475
|
* paints above the content that contains
|
|
471
476
|
* it. Outside one, an open overlay (`z-60`) covers it.
|
|
472
477
|
*
|
|
478
|
+
* @useWhen Pick several values from a list with a typeahead filter, and show the picks as removable
|
|
479
|
+
* tags.
|
|
480
|
+
*
|
|
481
|
+
* @siblings
|
|
482
|
+
* - `Combobox`: the user picks one value with a filter.
|
|
483
|
+
* - `Select`: the user picks one value from a short list.
|
|
484
|
+
* - `SelectableList`: the options show inline as checkbox rows, with no popover.
|
|
485
|
+
*
|
|
473
486
|
* @see https://mantle.ngrok.com/components/forms/multi-select
|
|
474
487
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
|
|
475
488
|
* @see https://ariakit.org/components/combobox
|
package/dist/multi-select.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-isomorphic-layout-effect-CLSmHzo4.js";import{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{t as i}from"./icon-kK0c-POG.js";import{t as a}from"./slot-DdYN1L1C.js";import{i as o,r as s}from"./layer-container-kEQiE4zV.js";import{a as c,r as l}from"./field-CPvjazWN.js";import{t as u}from"./field-Bihblt8U.js";import{n as d}from"./separator-DfzxVutO.js";import{t as f}from"./shake-DL6WhMXM.js";import{c as p}from"react/compiler-runtime";import{cloneElement as m,createContext as h,isValidElement as g,useContext as _,useEffect as v,useRef as y,useState as b}from"react";import x from"tiny-invariant";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";import{XIcon as T}from"@phosphor-icons/react/X";import{CheckIcon as E}from"@phosphor-icons/react/Check";import{Combobox as D,ComboboxGroup as O,ComboboxGroupLabel as k,ComboboxItem as A,ComboboxItemCheck as j,ComboboxPopover as M,ComboboxProvider as N,useComboboxContext as P}from"@ariakit/react/combobox";import{useStoreState as F}from"@ariakit/react/store";import{LockIcon as I}from"@phosphor-icons/react/Lock";const L=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),R=[],z=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),B=h({current:null}),V=h(void 0),H=h(R),U=h({onInputKeyDownRef:{current:void 0},inputRef:{current:null},setLockedValues:()=>{}}),W=e=>{let t=p(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,defaultSelectedValue:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?R:i,o=y(null),s=y(void 0),c=y(null),[l,u]=b(R),d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d={onInputKeyDownRef:s,inputRef:c,setLockedValues:u},t[4]=d):d=t[4];let f=d,m;t[5]!==n||t[6]!==a||t[7]!==r?(m=/* @__PURE__ */ C(N,{defaultSelectedValue:a,...r,children:n}),t[5]=n,t[6]=a,t[7]=r,t[8]=m):m=t[8];let h;return t[9]!==l||t[10]!==m?(h=/* @__PURE__ */ C(B.Provider,{value:o,children:/* @__PURE__ */ C(U.Provider,{value:f,children:/* @__PURE__ */ C(H.Provider,{value:l,children:m})})}),t[9]=l,t[10]=m,t[11]=h):h=t[11],h},G=e=>{let i=p(38),a,o,s,u,d,f,m,h,g;i[0]===e?(a=i[1],o=i[2],s=i[3],u=i[4],d=i[5],f=i[6],m=i[7],h=i[8],g=i[9]):({"data-slot":d,"aria-invalid":a,className:u,children:s,onKeyDown:f,onMouseDown:m,ref:g,validation:o,...h}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=u,i[5]=d,i[6]=f,i[7]=m,i[8]=h,i[9]=g);let v=_(B),{inputRef:y}=_(U),b=P(),x=c(),S=o??x,w;i[10]!==a||i[11]!==S?(w=l({"aria-invalid":a,validation:S}),i[10]=a,i[11]=S,i[12]=w):w=i[12];let{ariaInvalid:T,validation:E}=w,D;i[13]===d?D=i[14]:(D=r(d,`multi-select-trigger`),i[13]=d,i[14]=D);let O;i[15]===u?O=i[16]:(O=n(`cursor-text select-none font-sans text-sm`,`border-form bg-form text-strong flex min-h-9 w-full flex-wrap items-center gap-1 rounded-md border px-3 py-1 has-data-[slot=multi-select-tag]:px-1`,`has-focus:outline-hidden has-focus-within:ring-4 has-aria-expanded:ring-4`,`has-focus-within:border-accent-600 has-focus-within:ring-focus-accent has-aria-expanded:border-accent-600 has-aria-expanded:ring-focus-accent`,`data-validation-success:border-success-600 data-validation-success:has-focus-within:border-success-600 data-validation-success:has-focus-within:ring-focus-success data-validation-success:has-aria-expanded:border-success-600 data-validation-success:has-aria-expanded:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:has-focus-within:border-warning-600 data-validation-warning:has-focus-within:ring-focus-warning data-validation-warning:has-aria-expanded:border-warning-600 data-validation-warning:has-aria-expanded:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:has-focus-within:border-danger-600 data-validation-error:has-focus-within:ring-focus-danger data-validation-error:has-aria-expanded:border-danger-600 data-validation-error:has-aria-expanded:ring-focus-danger motion-safe:data-validation-error:animate-shake`,u),i[15]=u,i[16]=O);let k=E||void 0,A;i[17]!==f||i[18]!==b?(A=e=>{e.key===`Escape`&&b?.getState().open&&(e.preventDefault(),b.hide()),f?.(e)},i[17]=f,i[18]=b,i[19]=A):A=i[19];let j;i[20]!==y||i[21]!==m?(j=e=>{e.target instanceof HTMLElement&&!e.target.closest(`button, input, [data-slot='multi-select-tag']`)&&(e.preventDefault(),y.current?.focus()),m?.(e)},i[20]=y,i[21]=m,i[22]=j):j=i[22];let M;i[23]!==g||i[24]!==v?(M=t(v,g),i[23]=g,i[24]=v,i[25]=M):M=i[25];let N;i[26]!==s||i[27]!==h||i[28]!==D||i[29]!==O||i[30]!==k||i[31]!==A||i[32]!==j||i[33]!==M?(N=/* @__PURE__ */ C(`div`,{role:`presentation`,"data-slot":D,className:O,"data-validation":k,onKeyDown:A,onMouseDown:j,ref:M,...h,children:s}),i[26]=s,i[27]=h,i[28]=D,i[29]=O,i[30]=k,i[31]=A,i[32]=j,i[33]=M,i[34]=N):N=i[34];let F;return i[35]!==T||i[36]!==N?(F=/* @__PURE__ */ C(V.Provider,{value:T,children:N}),i[35]=T,i[36]=N,i[37]=F):F=i[37],F},K=e=>{let a=p(47),o,s,c,l,u,d,m,h,g,_;a[0]===e?(o=a[1],s=a[2],c=a[3],l=a[4],u=a[5],d=a[6],m=a[7],h=a[8],g=a[9],_=a[10]):({"data-slot":s,className:o,value:_,onRemove:d,locked:g,onBlur:c,onFocus:l,onKeyDown:u,ref:h,...m}=e,a[0]=e,a[1]=o,a[2]=s,a[3]=c,a[4]=l,a[5]=u,a[6]=d,a[7]=m,a[8]=h,a[9]=g,a[10]=_);let v=g!==void 0&&g,x=y(null),[S,E]=b(!1),D;a[11]===h?D=a[12]:(D=t(x,h),a[11]=h,a[12]=D);let O;a[13]===s?O=a[14]:(O=r(s,`multi-select-tag`),a[13]=s,a[14]=O);let k=S||void 0,A=v||void 0,j;a[15]===o?j=a[16]:(j=n(`cursor-default bg-neutral-500/10 border border-neutral-500/20 rounded-xs text-strong inline-flex items-center gap-1 pl-2 pr-0.5 py-0.5 text-sm font-normal motion-safe:data-shake:animate-shake`,`focus-visible:outline-hidden focus-visible:border-accent-600/50 focus-visible:ring-3 focus-visible:ring-focus-accent`,o),a[15]=o,a[16]=j);let M;a[17]===c?M=a[18]:(M=e=>{E(!1),c?.(e)},a[17]=c,a[18]=M);let N;a[19]===l?N=a[20]:(N=e=>{E(!0),l?.(e)},a[19]=l,a[20]=N);let P;a[21]!==v||a[22]!==u?(P=e=>{v&&(e.key===`Backspace`||e.key===`Delete`)?(e.preventDefault(),f(e.currentTarget)):u?.(e)},a[21]=v,a[22]=u,a[23]=P):P=a[23];let F=`Remove ${_}`,L=v||void 0,R;a[24]===Symbol.for(`react.memo_cache_sentinel`)?(R=n(`cursor-pointer text-strong/40 hover:bg-neutral-500/15 hover:text-strong rounded-xs p-0.5`,`aria-disabled:cursor-default aria-disabled:hover:bg-transparent aria-disabled:hover:text-strong/40`),a[24]=R):R=a[24];let z;a[25]!==v||a[26]!==d?(z=e=>{if(e.stopPropagation(),v){let e=x.current;e&&f(e)}else d?.()},a[25]=v,a[26]=d,a[27]=z):z=a[27];let B;a[28]===v?B=a[29]:(B=/* @__PURE__ */ C(i,{svg:v?/* @__PURE__ */ C(I,{}):/* @__PURE__ */ C(T,{weight:`bold`}),className:`size-4`}),a[28]=v,a[29]=B);let V;a[30]!==F||a[31]!==L||a[32]!==z||a[33]!==B?(V=/* @__PURE__ */ C(`button`,{type:`button`,"aria-label":F,tabIndex:-1,"aria-disabled":L,className:R,onClick:z,onMouseDown:$,children:B}),a[30]=F,a[31]=L,a[32]=z,a[33]=B,a[34]=V):V=a[34];let H;return a[35]!==m||a[36]!==V||a[37]!==D||a[38]!==O||a[39]!==k||a[40]!==A||a[41]!==j||a[42]!==M||a[43]!==N||a[44]!==P||a[45]!==_?(H=/* @__PURE__ */ w(`span`,{ref:D,role:`listitem`,tabIndex:-1,"data-slot":O,"data-active":k,"data-locked":A,className:j,onBlur:M,onFocus:N,onKeyDown:P,...m,children:[_,V]}),a[35]=m,a[36]=V,a[37]=D,a[38]=O,a[39]=k,a[40]=A,a[41]=j,a[42]=M,a[43]=N,a[44]=P,a[45]=_,a[46]=H):H=a[46],H},q=({render:e,...t})=>e(t),J=t=>{let n=p(22),{"aria-label":r,children:i,lockedValues:a}=t,o=r===void 0?`Selected values`:r,s=a===void 0?R:a,c=P(),l=F(c,`selectedValue`),u;n[0]===l?u=n[1]:(u=L(l)?l:void 0,n[0]=l,n[1]=u);let d=u??R,m=y(d),h,g;n[2]===d?(h=n[3],g=n[4]):(h=()=>{m.current=d},g=[d],n[2]=d,n[3]=h,n[4]=g),e(h,g);let b;n[5]===s?b=n[6]:(b=new Set(s),n[5]=s,n[6]=b);let x=b,S=y(/* @__PURE__ */ new Map),{onInputKeyDownRef:w,inputRef:T,setLockedValues:E}=_(U),D,O;n[7]!==s||n[8]!==E?(D=()=>{E(e=>z(e,s)?e:s)},O=[s,E],n[7]=s,n[8]=E,n[9]=D,n[10]=O):(D=n[9],O=n[10]),e(D,O);let k,A;n[11]===E?(k=n[12],A=n[13]):(A=()=>()=>{E(R)},k=[E],n[11]=E,n[12]=k,n[13]=A),e(A,k);let j;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(j=/* @__PURE__ */ new Set,n[14]=j):j=n[14];let M=y(j),N,I;n[15]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>()=>{M.current.forEach(cancelAnimationFrame)},I=[],n[15]=N,n[16]=I):(N=n[15],I=n[16]),v(N,I);let B=e=>{let t=requestAnimationFrame(()=>{M.current.delete(t),e()});M.current.add(t)},V;n[17]===c?V=n[18]:(V=e=>{if(c){let t=c.getState().selectedValue;if(!L(t))return;c.setSelectedValue(t.filter(t=>t!==e))}},n[17]=c,n[18]=V);let H=V,W=e=>{let t=m.current[e];if(t==null)return;let n=S.current.get(t);n&&(n.focus(),c?.show())},G=()=>{T.current?.focus()},J=(e,t)=>{let n=d[t];bb65:switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&W(t-1);break bb65;case`ArrowRight`:e.preventDefault(),t<d.length-1?W(t+1):G();break bb65;case`Backspace`:case`Delete`:if(e.preventDefault(),n!=null){if(x.has(n)){let e=S.current.get(n);e&&f(e);break bb65}if(H(n),e.key===`Backspace`){if(t>0){let e=t-1;B(()=>W(e))}else B(()=>{m.current.length>0?W(0):G()})}else B(()=>{t<m.current.length?W(t):G()})}break bb65;case`ArrowUp`:case`ArrowDown`:e.preventDefault(),G(),T.current?.dispatchEvent(new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0,cancelable:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey}));break bb65;default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&G()}},Y=e=>{if(e.key===`ArrowLeft`&&e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===0&&d.length>0)e.preventDefault(),W(d.length-1);else if(e.key===`Backspace`&&e.currentTarget.value===``&&d.length>0){let e=d[d.length-1];if(e!=null){if(x.has(e)){let t=S.current.get(e);t&&f(t)}else H(e)}}};if(e(()=>(w.current=Y,()=>{w.current=void 0})),d.length===0)return null;let X=d.map((e,t)=>{let n={value:e,locked:x.has(e),onRemove:()=>{if(x.has(e)){let t=S.current.get(e);t&&f(t)}else H(e)},ref:t=>{t?S.current.set(e,t):S.current.delete(e)},onKeyDown:e=>J(e,t),onClick:()=>W(t)};return i?/* @__PURE__ */ C(q,{render:i,...n},e):/* @__PURE__ */ C(K,{...n},e)}),Z;return n[19]!==o||n[20]!==X?(Z=/* @__PURE__ */ C(`span`,{role:`list`,"aria-label":o,"data-slot":`multi-select-tag-list`,className:`contents`,children:X}),n[19]=o,n[20]=X,n[21]=Z):Z=n[21],Z},Y=e=>{let i=p(44),a,o,s,c,l,d,f,m,h,g;i[0]===e?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],d=i[6],f=i[7],m=i[8],h=i[9],g=i[10]):({"data-slot":o,className:a,onBlur:s,onChange:c,onFocus:l,onKeyDown:d,onValueChange:f,placeholder:m,ref:g,...h}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l,i[6]=d,i[7]=f,i[8]=m,i[9]=h,i[10]=g);let v=P(),{onInputKeyDownRef:y,inputRef:b}=_(U),x=_(u),S=_(V),w=F(v,`selectedValue`),T=((L(w)?w:void 0)?.length??0)>0,E;i[11]===o?E=i[12]:(E=r(o,`multi-select-input`),i[11]=o,i[12]=E);let O;i[13]===a?O=i[14]:(O=n(`pointer-coarse:text-base min-w-20 flex-1 select-text border-0 bg-transparent text-sm outline-hidden`,`placeholder:select-none placeholder:text-placeholder`,a),i[13]=a,i[14]=O);let k;i[15]!==c||i[16]!==f?(k=e=>{f?.(e.target.value),c?.(e)},i[15]=c,i[16]=f,i[17]=k):k=i[17];let A;i[18]!==y||i[19]!==d?(A=e=>{y.current?.(e),d?.(e)},i[18]=y,i[19]=d,i[20]=A):A=i[20];let j;i[21]!==s||i[22]!==v?(j=e=>{e.relatedTarget instanceof HTMLElement&&e.relatedTarget.closest(`[data-slot~="multi-select-tag"]`)&&v?.show(),s?.(e)},i[21]=s,i[22]=v,i[23]=j):j=i[23];let M;i[24]!==l||i[25]!==v?(M=e=>{v?.show(),l?.(e)},i[24]=l,i[25]=v,i[26]=M):M=i[26];let N=T?void 0:m,I;i[27]!==b||i[28]!==g?(I=t(b,g),i[27]=b,i[28]=g,i[29]=I):I=i[29];let R;i[30]===x?R=i[31]:(R=x?{"aria-describedby":x[`aria-describedby`],"aria-errormessage":x[`aria-errormessage`],"aria-invalid":x[`aria-invalid`],id:x.id,name:x.name}:void 0,i[30]=x,i[31]=R);let z;return i[32]!==h||i[33]!==E||i[34]!==O||i[35]!==k||i[36]!==A||i[37]!==j||i[38]!==M||i[39]!==N||i[40]!==I||i[41]!==R||i[42]!==S?(z=/* @__PURE__ */ C(D,{autoSelect:!0,"aria-invalid":S,"data-slot":E,className:O,onChange:k,onKeyDown:A,onBlur:j,onFocus:M,placeholder:N,ref:I,...h,...R}),i[32]=h,i[33]=E,i[34]=O,i[35]=k,i[36]=A,i[37]=j,i[38]=M,i[39]=N,i[40]=I,i[41]=R,i[42]=S,i[43]=z):z=i[43],z},X=e=>{let t=p(40),i,a,c,l,u,d,f,m,h,g,v,y;t[0]===e?(i=t[1],a=t[2],c=t[3],l=t[4],u=t[5],d=t[6],f=t[7],m=t[8],h=t[9],g=t[10],v=t[11],y=t[12]):({"data-slot":c,asChild:m,backdrop:h,children:i,className:a,modal:g,portalElement:l,preventBodyScroll:u,ref:f,sameWidth:v,unmountOnHide:y,...d}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=c,t[4]=l,t[5]=u,t[6]=d,t[7]=f,t[8]=m,t[9]=h,t[10]=g,t[11]=v,t[12]=y);let b=m!==void 0&&m,x=h!==void 0&&h,S=g===void 0||g,w=v===void 0||v,T=y===void 0||y,E=_(B),D=o(),O=s(),k;t[13]===E?k=t[14]:(k=()=>E.current?.getBoundingClientRect()??null,t[13]=E,t[14]=k);let A=k,j;t[15]!==D||t[16]!==l||t[17]!==E?(j=e=>typeof l==`function`?l(e):l??E.current?.closest(`[data-mantle-modal-content]`)??(D instanceof HTMLElement?D:null)??e.ownerDocument.body,t[15]=D,t[16]=l,t[17]=E,t[18]=j):j=t[18];let N=j,P;t[19]===E?P=t[20]:(P=e=>!(e.target instanceof Node&&E.current?.contains(e.target)),t[19]=E,t[20]=P);let F=P,I;t[21]===c?I=t[22]:(I=r(c,`multi-select-content`),t[21]=c,t[22]=I);let L;t[23]===a?L=t[24]:(L=n(`border-popover bg-popover relative z-50 max-h-96 min-w-32 scrollbar overflow-y-scroll overflow-x-hidden overscroll-y-none rounded-md border shadow-md pt-1 pb-1 has-data-content-footer:pb-0 font-sans flex flex-col gap-px focus:outline-hidden`,a),t[23]=a,t[24]=L);let R=u??!O,z=b?ee:void 0,V;return t[25]!==x||t[26]!==i||t[27]!==A||t[28]!==N||t[29]!==F||t[30]!==S||t[31]!==d||t[32]!==f||t[33]!==w||t[34]!==L||t[35]!==R||t[36]!==z||t[37]!==I||t[38]!==T?(V=/* @__PURE__ */ C(M,{"data-slot":I,className:L,backdrop:x,getAnchorRect:A,gutter:4,hideOnInteractOutside:F,modal:S,portalElement:N,preventBodyScroll:R,ref:f,render:z,sameWidth:w,unmountOnHide:T,...d,children:i}),t[25]=x,t[26]=i,t[27]=A,t[28]=N,t[29]=F,t[30]=S,t[31]=d,t[32]=f,t[33]=w,t[34]=L,t[35]=R,t[36]=z,t[37]=I,t[38]=T,t[39]=V):V=t[39],V},Z=e=>/* @__PURE__ */ C(`div`,{"data-slot":`multi-select-item-label`,className:`contents`,children:e}),Q={Root:W,Trigger:G,TagValues:J,Input:Y,Tag:K,Content:X,ContentFooter:e=>{let t=p(16),i,a,o,s,c;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5]):({"data-slot":o,className:a,children:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c);let l;t[6]===o?l=t[7]:(l=r(o,`multi-select-content-footer`),t[6]=o,t[7]=l);let u;t[8]===a?u=t[9]:(u=n(`bg-popover sticky bottom-0 border-t border-popover`,a),t[8]=a,t[9]=u);let d;return t[10]!==i||t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==u?(d=/* @__PURE__ */ C(`div`,{ref:c,"data-slot":l,"data-content-footer":!0,className:u,...s,children:i}),t[10]=i,t[11]=s,t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15],d},Item:e=>{let t=p(41),a,o,s,c,l,u,d,f,h;t[0]===e?(a=t[1],o=t[2],s=t[3],c=t[4],l=t[5],u=t[6],d=t[7],f=t[8],h=t[9]):({"data-slot":s,asChild:d,children:a,className:o,focusOnHover:f,value:h,onClick:c,ref:u,...l}=e,t[0]=e,t[1]=a,t[2]=o,t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=h);let v=d!==void 0&&d,y=f===void 0||f,b=_(H),T;t[10]!==b||t[11]!==h?(T=h!=null&&b.includes(h),t[10]=b,t[11]=h,t[12]=T):T=t[12];let D=T,O;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(O=/* @__PURE__ */ C(j,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:/* @__PURE__ */ C(i,{svg:/* @__PURE__ */ C(E,{weight:`bold`}),className:`size-4 text-accent-600`})}),t[13]=O):O=t[13];let k=O,M;if(v){x(g(a),"When using `asChild`, MultiSelect.Item must be passed a single child as a JSX tag.");let e;if(t[14]!==a){let n;t[16]===a.props.children?n=t[17]:(n=Z(a.props.children),t[16]=a.props.children,t[17]=n);let r;t[18]===n?r=t[19]:(r=/* @__PURE__ */ w(S,{children:[n,k]}),t[18]=n,t[19]=r),e=m(a,{},r),t[14]=a,t[15]=e}else e=t[15];M=e}else{let e;t[20]===a?e=t[21]:(e=Z(a),t[20]=a,t[21]=e);let n;t[22]===e?n=t[23]:(n=/* @__PURE__ */ w(S,{children:[e,k]}),t[22]=e,t[23]=n),M=n}let N;t[24]===s?N=t[25]:(N=r(s,`multi-select-item`),t[24]=s,t[25]=N);let P;t[26]===o?P=t[27]:(P=n(`relative mx-1 cursor-pointer rounded-md pl-2 pr-8 py-1.5 text-strong text-sm font-normal flex min-w-0 items-center gap-2`,`[[role=option]+&]:mt-px`,`data-active-item:bg-active-menu-item`,`aria-disabled:opacity-50`,`aria-selected:bg-selected-menu-item aria-selected:data-active-item:bg-active-selected-menu-item`,o),t[26]=o,t[27]=P);let F;t[28]!==D||t[29]!==c?(F=e=>{D?e.preventDefault():c?.(e)},t[28]=D,t[29]=c,t[30]=F):F=t[30];let I=v?te:void 0,L;return t[31]!==M||t[32]!==y||t[33]!==l||t[34]!==u||t[35]!==N||t[36]!==P||t[37]!==F||t[38]!==I||t[39]!==h?(L=/* @__PURE__ */ C(A,{"data-slot":N,className:P,focusOnHover:y,onClick:F,ref:u,render:I,resetValueOnSelect:!0,value:h,...l,children:M}),t[31]=M,t[32]=y,t[33]=l,t[34]=u,t[35]=N,t[36]=P,t[37]=F,t[38]=I,t[39]=h,t[40]=L):L=t[40],L},Group:e=>{let t=p(14),n,i,a,o,s;t[0]===e?(n=t[1],i=t[2],a=t[3],o=t[4],s=t[5]):({"data-slot":i,asChild:s,children:n,ref:o,...a}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s);let c=s!==void 0&&s,l;t[6]===i?l=t[7]:(l=r(i,`multi-select-group`),t[6]=i,t[7]=l);let u=c?ne:void 0,d;return t[8]!==n||t[9]!==a||t[10]!==o||t[11]!==l||t[12]!==u?(d=/* @__PURE__ */ C(O,{"data-slot":l,className:`mx-1`,ref:o,render:u,...a,children:n}),t[8]=n,t[9]=a,t[10]=o,t[11]=l,t[12]=u,t[13]=d):d=t[13],d},GroupLabel:e=>{let t=p(18),i,a,o,s,c,l;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6]):({"data-slot":o,asChild:l,children:i,className:a,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l);let u=l!==void 0&&l,d;t[7]===o?d=t[8]:(d=r(o,`multi-select-group-label`),t[7]=o,t[8]=d);let f;t[9]===a?f=t[10]:(f=n(`text-muted px-2 py-1 text-xs font-medium`,a),t[9]=a,t[10]=f);let m=u?re:void 0,h;return t[11]!==i||t[12]!==s||t[13]!==c||t[14]!==d||t[15]!==f||t[16]!==m?(h=/* @__PURE__ */ C(k,{"data-slot":d,className:f,ref:c,render:m,...s,children:i}),t[11]=i,t[12]=s,t[13]=c,t[14]=d,t[15]=f,t[16]=m,t[17]=h):h=t[17],h},GroupDescription:e=>{let t=p(16),i,a,o,s,c;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5]):({"data-slot":o,className:a,children:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c);let l;t[6]===o?l=t[7]:(l=r(o,`multi-select-group-description`),t[6]=o,t[7]=l);let u;t[8]===a?u=t[9]:(u=n(`text-muted px-2 pb-1 text-xs`,a),t[8]=a,t[9]=u);let d;return t[10]!==i||t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==u?(d=/* @__PURE__ */ C(`p`,{"data-slot":l,className:u,ref:c,...s,children:i}),t[10]=i,t[11]=s,t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15],d},Separator:e=>{let t=p(14),i,a,o,s;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4]):({"data-slot":a,className:i,ref:s,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s);let c;t[5]===a?c=t[6]:(c=r(a,`multi-select-separator`),t[5]=a,t[6]=c);let l;t[7]===i?l=t[8]:(l=n(`my-1 w-auto`,i),t[7]=i,t[8]=l);let u;return t[9]!==o||t[10]!==s||t[11]!==c||t[12]!==l?(u=/* @__PURE__ */ C(d,{"data-slot":c,ref:s,className:l,...o}),t[9]=o,t[10]=s,t[11]=c,t[12]=l,t[13]=u):u=t[13],u},Empty:e=>{let t=p(16),i,a,o,s,c;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5]):({"data-slot":o,className:a,children:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c);let l;t[6]===o?l=t[7]:(l=r(o,`multi-select-empty`),t[6]=o,t[7]=l);let u;t[8]===a?u=t[9]:(u=n(`mx-1 text-muted px-2 py-6 text-center text-sm`,a),t[8]=a,t[9]=u);let d;return t[10]!==i||t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==u?(d=/* @__PURE__ */ C(`div`,{"data-slot":l,className:u,ref:c,role:`presentation`,...s,children:i}),t[10]=i,t[11]=s,t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15],d}};function $(e){e.preventDefault()}function ee(e){let{ref:t,...n}=e;return/* @__PURE__ */ C(a,{ref:t,...n})}function te(e){let{ref:t,...n}=e;return/* @__PURE__ */ C(a,{ref:t,...n})}function ne(e){let{ref:t,...n}=e;return/* @__PURE__ */ C(a,{ref:t,...n})}function re(e){let{ref:t,...n}=e;return/* @__PURE__ */ C(a,{ref:t,...n})}export{Q as MultiSelect};
|
|
1
|
+
import{t as e}from"./use-isomorphic-layout-effect-CLSmHzo4.js";import{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{i,r as a}from"./layer-container-kEQiE4zV.js";import{t as o}from"./shake-DL6WhMXM.js";import{t as s}from"./field-Bihblt8U.js";import{a as c,r as l}from"./field-CPvjazWN.js";import{t as u}from"./icon-kK0c-POG.js";import{n as d}from"./separator-DfzxVutO.js";import{t as f}from"./slot-DdYN1L1C.js";import{c as p}from"react/compiler-runtime";import{cloneElement as m,createContext as h,isValidElement as g,useContext as _,useEffect as v,useRef as y,useState as b}from"react";import x from"tiny-invariant";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";import{XIcon as T}from"@phosphor-icons/react/X";import{CheckIcon as E}from"@phosphor-icons/react/Check";import{Combobox as D,ComboboxGroup as O,ComboboxGroupLabel as k,ComboboxItem as A,ComboboxItemCheck as j,ComboboxPopover as M,ComboboxProvider as N,useComboboxContext as P}from"@ariakit/react/combobox";import{useStoreState as F}from"@ariakit/react/store";import{LockIcon as I}from"@phosphor-icons/react/Lock";const L=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),R=[],z=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),B=h({current:null}),V=h(void 0),H=h(R),U=h({onInputKeyDownRef:{current:void 0},inputRef:{current:null},setLockedValues:()=>{}}),W=e=>{let t=p(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,defaultSelectedValue:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?R:i,o=y(null),s=y(void 0),c=y(null),[l,u]=b(R),d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d={onInputKeyDownRef:s,inputRef:c,setLockedValues:u},t[4]=d):d=t[4];let f=d,m;t[5]!==n||t[6]!==a||t[7]!==r?(m=/* @__PURE__ */ C(N,{defaultSelectedValue:a,...r,children:n}),t[5]=n,t[6]=a,t[7]=r,t[8]=m):m=t[8];let h;return t[9]!==l||t[10]!==m?(h=/* @__PURE__ */ C(B.Provider,{value:o,children:/* @__PURE__ */ C(U.Provider,{value:f,children:/* @__PURE__ */ C(H.Provider,{value:l,children:m})})}),t[9]=l,t[10]=m,t[11]=h):h=t[11],h},G=e=>{let i=p(38),a,o,s,u,d,f,m,h,g;i[0]===e?(a=i[1],o=i[2],s=i[3],u=i[4],d=i[5],f=i[6],m=i[7],h=i[8],g=i[9]):({"data-slot":d,"aria-invalid":a,className:u,children:s,onKeyDown:f,onMouseDown:m,ref:g,validation:o,...h}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=s,i[4]=u,i[5]=d,i[6]=f,i[7]=m,i[8]=h,i[9]=g);let v=_(B),{inputRef:y}=_(U),b=P(),x=c(),S=o??x,w;i[10]!==a||i[11]!==S?(w=l({"aria-invalid":a,validation:S}),i[10]=a,i[11]=S,i[12]=w):w=i[12];let{ariaInvalid:T,validation:E}=w,D;i[13]===d?D=i[14]:(D=r(d,`multi-select-trigger`),i[13]=d,i[14]=D);let O;i[15]===u?O=i[16]:(O=n(`cursor-text select-none font-sans text-sm`,`border-form bg-form text-strong flex min-h-9 w-full flex-wrap items-center gap-1 rounded-md border px-3 py-1 has-data-[slot=multi-select-tag]:px-1`,`has-focus:outline-hidden has-focus-within:ring-4 has-aria-expanded:ring-4`,`has-focus-within:border-accent-600 has-focus-within:ring-focus-accent has-aria-expanded:border-accent-600 has-aria-expanded:ring-focus-accent`,`data-validation-success:border-success-600 data-validation-success:has-focus-within:border-success-600 data-validation-success:has-focus-within:ring-focus-success data-validation-success:has-aria-expanded:border-success-600 data-validation-success:has-aria-expanded:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:has-focus-within:border-warning-600 data-validation-warning:has-focus-within:ring-focus-warning data-validation-warning:has-aria-expanded:border-warning-600 data-validation-warning:has-aria-expanded:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:has-focus-within:border-danger-600 data-validation-error:has-focus-within:ring-focus-danger data-validation-error:has-aria-expanded:border-danger-600 data-validation-error:has-aria-expanded:ring-focus-danger motion-safe:data-validation-error:animate-shake`,u),i[15]=u,i[16]=O);let k=E||void 0,A;i[17]!==f||i[18]!==b?(A=e=>{e.key===`Escape`&&b?.getState().open&&(e.preventDefault(),b.hide()),f?.(e)},i[17]=f,i[18]=b,i[19]=A):A=i[19];let j;i[20]!==y||i[21]!==m?(j=e=>{e.target instanceof HTMLElement&&!e.target.closest(`button, input, [data-slot='multi-select-tag']`)&&(e.preventDefault(),y.current?.focus()),m?.(e)},i[20]=y,i[21]=m,i[22]=j):j=i[22];let M;i[23]!==g||i[24]!==v?(M=t(v,g),i[23]=g,i[24]=v,i[25]=M):M=i[25];let N;i[26]!==s||i[27]!==h||i[28]!==D||i[29]!==O||i[30]!==k||i[31]!==A||i[32]!==j||i[33]!==M?(N=/* @__PURE__ */ C(`div`,{role:`presentation`,"data-slot":D,className:O,"data-validation":k,onKeyDown:A,onMouseDown:j,ref:M,...h,children:s}),i[26]=s,i[27]=h,i[28]=D,i[29]=O,i[30]=k,i[31]=A,i[32]=j,i[33]=M,i[34]=N):N=i[34];let F;return i[35]!==T||i[36]!==N?(F=/* @__PURE__ */ C(V.Provider,{value:T,children:N}),i[35]=T,i[36]=N,i[37]=F):F=i[37],F},K=e=>{let i=p(47),a,s,c,l,d,f,m,h,g,_;i[0]===e?(a=i[1],s=i[2],c=i[3],l=i[4],d=i[5],f=i[6],m=i[7],h=i[8],g=i[9],_=i[10]):({"data-slot":s,className:a,value:_,onRemove:f,locked:g,onBlur:c,onFocus:l,onKeyDown:d,ref:h,...m}=e,i[0]=e,i[1]=a,i[2]=s,i[3]=c,i[4]=l,i[5]=d,i[6]=f,i[7]=m,i[8]=h,i[9]=g,i[10]=_);let v=g!==void 0&&g,x=y(null),[S,E]=b(!1),D;i[11]===h?D=i[12]:(D=t(x,h),i[11]=h,i[12]=D);let O;i[13]===s?O=i[14]:(O=r(s,`multi-select-tag`),i[13]=s,i[14]=O);let k=S||void 0,A=v||void 0,j;i[15]===a?j=i[16]:(j=n(`cursor-default bg-neutral-500/10 border border-neutral-500/20 rounded-xs text-strong inline-flex items-center gap-1 pl-2 pr-0.5 py-0.5 text-sm font-normal motion-safe:data-shake:animate-shake`,`focus-visible:outline-hidden focus-visible:border-accent-600/50 focus-visible:ring-3 focus-visible:ring-focus-accent`,a),i[15]=a,i[16]=j);let M;i[17]===c?M=i[18]:(M=e=>{E(!1),c?.(e)},i[17]=c,i[18]=M);let N;i[19]===l?N=i[20]:(N=e=>{E(!0),l?.(e)},i[19]=l,i[20]=N);let P;i[21]!==v||i[22]!==d?(P=e=>{v&&(e.key===`Backspace`||e.key===`Delete`)?(e.preventDefault(),o(e.currentTarget)):d?.(e)},i[21]=v,i[22]=d,i[23]=P):P=i[23];let F=`Remove ${_}`,L=v||void 0,R;i[24]===Symbol.for(`react.memo_cache_sentinel`)?(R=n(`cursor-pointer text-strong/40 hover:bg-neutral-500/15 hover:text-strong rounded-xs p-0.5`,`aria-disabled:cursor-default aria-disabled:hover:bg-transparent aria-disabled:hover:text-strong/40`),i[24]=R):R=i[24];let z;i[25]!==v||i[26]!==f?(z=e=>{if(e.stopPropagation(),v){let e=x.current;e&&o(e)}else f?.()},i[25]=v,i[26]=f,i[27]=z):z=i[27];let B;i[28]===v?B=i[29]:(B=/* @__PURE__ */ C(u,{svg:v?/* @__PURE__ */ C(I,{}):/* @__PURE__ */ C(T,{weight:`bold`}),className:`size-4`}),i[28]=v,i[29]=B);let V;i[30]!==F||i[31]!==L||i[32]!==z||i[33]!==B?(V=/* @__PURE__ */ C(`button`,{type:`button`,"aria-label":F,tabIndex:-1,"aria-disabled":L,className:R,onClick:z,onMouseDown:$,children:B}),i[30]=F,i[31]=L,i[32]=z,i[33]=B,i[34]=V):V=i[34];let H;return i[35]!==m||i[36]!==V||i[37]!==D||i[38]!==O||i[39]!==k||i[40]!==A||i[41]!==j||i[42]!==M||i[43]!==N||i[44]!==P||i[45]!==_?(H=/* @__PURE__ */ w(`span`,{ref:D,role:`listitem`,tabIndex:-1,"data-slot":O,"data-active":k,"data-locked":A,className:j,onBlur:M,onFocus:N,onKeyDown:P,...m,children:[_,V]}),i[35]=m,i[36]=V,i[37]=D,i[38]=O,i[39]=k,i[40]=A,i[41]=j,i[42]=M,i[43]=N,i[44]=P,i[45]=_,i[46]=H):H=i[46],H},q=({render:e,...t})=>e(t),J=t=>{let n=p(22),{"aria-label":r,children:i,lockedValues:a}=t,s=r===void 0?`Selected values`:r,c=a===void 0?R:a,l=P(),u=F(l,`selectedValue`),d;n[0]===u?d=n[1]:(d=L(u)?u:void 0,n[0]=u,n[1]=d);let f=d??R,m=y(f),h,g;n[2]===f?(h=n[3],g=n[4]):(h=()=>{m.current=f},g=[f],n[2]=f,n[3]=h,n[4]=g),e(h,g);let b;n[5]===c?b=n[6]:(b=new Set(c),n[5]=c,n[6]=b);let x=b,S=y(/* @__PURE__ */ new Map),{onInputKeyDownRef:w,inputRef:T,setLockedValues:E}=_(U),D,O;n[7]!==c||n[8]!==E?(D=()=>{E(e=>z(e,c)?e:c)},O=[c,E],n[7]=c,n[8]=E,n[9]=D,n[10]=O):(D=n[9],O=n[10]),e(D,O);let k,A;n[11]===E?(k=n[12],A=n[13]):(A=()=>()=>{E(R)},k=[E],n[11]=E,n[12]=k,n[13]=A),e(A,k);let j;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(j=/* @__PURE__ */ new Set,n[14]=j):j=n[14];let M=y(j),N,I;n[15]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>()=>{M.current.forEach(cancelAnimationFrame)},I=[],n[15]=N,n[16]=I):(N=n[15],I=n[16]),v(N,I);let B=e=>{let t=requestAnimationFrame(()=>{M.current.delete(t),e()});M.current.add(t)},V;n[17]===l?V=n[18]:(V=e=>{if(l){let t=l.getState().selectedValue;if(!L(t))return;l.setSelectedValue(t.filter(t=>t!==e))}},n[17]=l,n[18]=V);let H=V,W=e=>{let t=m.current[e];if(t==null)return;let n=S.current.get(t);n&&(n.focus(),l?.show())},G=()=>{T.current?.focus()},J=(e,t)=>{let n=f[t];bb65:switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&W(t-1);break bb65;case`ArrowRight`:e.preventDefault(),t<f.length-1?W(t+1):G();break bb65;case`Backspace`:case`Delete`:if(e.preventDefault(),n!=null){if(x.has(n)){let e=S.current.get(n);e&&o(e);break bb65}if(H(n),e.key===`Backspace`){if(t>0){let e=t-1;B(()=>W(e))}else B(()=>{m.current.length>0?W(0):G()})}else B(()=>{t<m.current.length?W(t):G()})}break bb65;case`ArrowUp`:case`ArrowDown`:e.preventDefault(),G(),T.current?.dispatchEvent(new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0,cancelable:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey}));break bb65;default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&G()}},Y=e=>{if(e.key===`ArrowLeft`&&e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===0&&f.length>0)e.preventDefault(),W(f.length-1);else if(e.key===`Backspace`&&e.currentTarget.value===``&&f.length>0){let e=f[f.length-1];if(e!=null){if(x.has(e)){let t=S.current.get(e);t&&o(t)}else H(e)}}};if(e(()=>(w.current=Y,()=>{w.current=void 0})),f.length===0)return null;let X=f.map((e,t)=>{let n={value:e,locked:x.has(e),onRemove:()=>{if(x.has(e)){let t=S.current.get(e);t&&o(t)}else H(e)},ref:t=>{t?S.current.set(e,t):S.current.delete(e)},onKeyDown:e=>J(e,t),onClick:()=>W(t)};return i?/* @__PURE__ */ C(q,{render:i,...n},e):/* @__PURE__ */ C(K,{...n},e)}),Z;return n[19]!==s||n[20]!==X?(Z=/* @__PURE__ */ C(`span`,{role:`list`,"aria-label":s,"data-slot":`multi-select-tag-list`,className:`contents`,children:X}),n[19]=s,n[20]=X,n[21]=Z):Z=n[21],Z},Y=e=>{let i=p(44),a,o,c,l,u,d,f,m,h,g;i[0]===e?(a=i[1],o=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],m=i[8],h=i[9],g=i[10]):({"data-slot":o,className:a,onBlur:c,onChange:l,onFocus:u,onKeyDown:d,onValueChange:f,placeholder:m,ref:g,...h}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=c,i[4]=l,i[5]=u,i[6]=d,i[7]=f,i[8]=m,i[9]=h,i[10]=g);let v=P(),{onInputKeyDownRef:y,inputRef:b}=_(U),x=_(s),S=_(V),w=F(v,`selectedValue`),T=((L(w)?w:void 0)?.length??0)>0,E;i[11]===o?E=i[12]:(E=r(o,`multi-select-input`),i[11]=o,i[12]=E);let O;i[13]===a?O=i[14]:(O=n(`pointer-coarse:text-base min-w-20 flex-1 select-text border-0 bg-transparent text-sm outline-hidden`,`placeholder:select-none placeholder:text-placeholder`,a),i[13]=a,i[14]=O);let k;i[15]!==l||i[16]!==f?(k=e=>{f?.(e.target.value),l?.(e)},i[15]=l,i[16]=f,i[17]=k):k=i[17];let A;i[18]!==y||i[19]!==d?(A=e=>{y.current?.(e),d?.(e)},i[18]=y,i[19]=d,i[20]=A):A=i[20];let j;i[21]!==c||i[22]!==v?(j=e=>{e.relatedTarget instanceof HTMLElement&&e.relatedTarget.closest(`[data-slot~="multi-select-tag"]`)&&v?.show(),c?.(e)},i[21]=c,i[22]=v,i[23]=j):j=i[23];let M;i[24]!==u||i[25]!==v?(M=e=>{v?.show(),u?.(e)},i[24]=u,i[25]=v,i[26]=M):M=i[26];let N=T?void 0:m,I;i[27]!==b||i[28]!==g?(I=t(b,g),i[27]=b,i[28]=g,i[29]=I):I=i[29];let R;i[30]===x?R=i[31]:(R=x?{"aria-describedby":x[`aria-describedby`],"aria-errormessage":x[`aria-errormessage`],"aria-invalid":x[`aria-invalid`],id:x.id,name:x.name}:void 0,i[30]=x,i[31]=R);let z;return i[32]!==h||i[33]!==E||i[34]!==O||i[35]!==k||i[36]!==A||i[37]!==j||i[38]!==M||i[39]!==N||i[40]!==I||i[41]!==R||i[42]!==S?(z=/* @__PURE__ */ C(D,{autoSelect:!0,"aria-invalid":S,"data-slot":E,className:O,onChange:k,onKeyDown:A,onBlur:j,onFocus:M,placeholder:N,ref:I,...h,...R}),i[32]=h,i[33]=E,i[34]=O,i[35]=k,i[36]=A,i[37]=j,i[38]=M,i[39]=N,i[40]=I,i[41]=R,i[42]=S,i[43]=z):z=i[43],z},X=e=>{let t=p(40),o,s,c,l,u,d,f,m,h,g,v,y;t[0]===e?(o=t[1],s=t[2],c=t[3],l=t[4],u=t[5],d=t[6],f=t[7],m=t[8],h=t[9],g=t[10],v=t[11],y=t[12]):({"data-slot":c,asChild:m,backdrop:h,children:o,className:s,modal:g,portalElement:l,preventBodyScroll:u,ref:f,sameWidth:v,unmountOnHide:y,...d}=e,t[0]=e,t[1]=o,t[2]=s,t[3]=c,t[4]=l,t[5]=u,t[6]=d,t[7]=f,t[8]=m,t[9]=h,t[10]=g,t[11]=v,t[12]=y);let b=m!==void 0&&m,x=h!==void 0&&h,S=g===void 0||g,w=v===void 0||v,T=y===void 0||y,E=_(B),D=i(),O=a(),k;t[13]===E?k=t[14]:(k=()=>E.current?.getBoundingClientRect()??null,t[13]=E,t[14]=k);let A=k,j;t[15]!==D||t[16]!==l||t[17]!==E?(j=e=>typeof l==`function`?l(e):l??E.current?.closest(`[data-mantle-modal-content]`)??(D instanceof HTMLElement?D:null)??e.ownerDocument.body,t[15]=D,t[16]=l,t[17]=E,t[18]=j):j=t[18];let N=j,P;t[19]===E?P=t[20]:(P=e=>!(e.target instanceof Node&&E.current?.contains(e.target)),t[19]=E,t[20]=P);let F=P,I;t[21]===c?I=t[22]:(I=r(c,`multi-select-content`),t[21]=c,t[22]=I);let L;t[23]===s?L=t[24]:(L=n(`border-popover bg-popover relative z-50 max-h-96 min-w-32 scrollbar overflow-y-scroll overflow-x-hidden overscroll-y-none rounded-md border shadow-md pt-1 pb-1 has-data-content-footer:pb-0 font-sans flex flex-col gap-px focus:outline-hidden`,s),t[23]=s,t[24]=L);let R=u??!O,z=b?ee:void 0,V;return t[25]!==x||t[26]!==o||t[27]!==A||t[28]!==N||t[29]!==F||t[30]!==S||t[31]!==d||t[32]!==f||t[33]!==w||t[34]!==L||t[35]!==R||t[36]!==z||t[37]!==I||t[38]!==T?(V=/* @__PURE__ */ C(M,{"data-slot":I,className:L,backdrop:x,getAnchorRect:A,gutter:4,hideOnInteractOutside:F,modal:S,portalElement:N,preventBodyScroll:R,ref:f,render:z,sameWidth:w,unmountOnHide:T,...d,children:o}),t[25]=x,t[26]=o,t[27]=A,t[28]=N,t[29]=F,t[30]=S,t[31]=d,t[32]=f,t[33]=w,t[34]=L,t[35]=R,t[36]=z,t[37]=I,t[38]=T,t[39]=V):V=t[39],V},Z=e=>/* @__PURE__ */ C(`div`,{"data-slot":`multi-select-item-label`,className:`contents`,children:e}),Q={Root:W,Trigger:G,TagValues:J,Input:Y,Tag:K,Content:X,ContentFooter:e=>{let t=p(16),i,a,o,s,c;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5]):({"data-slot":o,className:a,children:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c);let l;t[6]===o?l=t[7]:(l=r(o,`multi-select-content-footer`),t[6]=o,t[7]=l);let u;t[8]===a?u=t[9]:(u=n(`bg-popover sticky bottom-0 border-t border-popover`,a),t[8]=a,t[9]=u);let d;return t[10]!==i||t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==u?(d=/* @__PURE__ */ C(`div`,{ref:c,"data-slot":l,"data-content-footer":!0,className:u,...s,children:i}),t[10]=i,t[11]=s,t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15],d},Item:e=>{let t=p(41),i,a,o,s,c,l,d,f,h;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],d=t[7],f=t[8],h=t[9]):({"data-slot":o,asChild:d,children:i,className:a,focusOnHover:f,value:h,onClick:s,ref:l,...c}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=d,t[8]=f,t[9]=h);let v=d!==void 0&&d,y=f===void 0||f,b=_(H),T;t[10]!==b||t[11]!==h?(T=h!=null&&b.includes(h),t[10]=b,t[11]=h,t[12]=T):T=t[12];let D=T,O;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(O=/* @__PURE__ */ C(j,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:/* @__PURE__ */ C(u,{svg:/* @__PURE__ */ C(E,{weight:`bold`}),className:`size-4 text-accent-600`})}),t[13]=O):O=t[13];let k=O,M;if(v){x(g(i),"When using `asChild`, MultiSelect.Item must be passed a single child as a JSX tag.");let e;if(t[14]!==i){let n;t[16]===i.props.children?n=t[17]:(n=Z(i.props.children),t[16]=i.props.children,t[17]=n);let r;t[18]===n?r=t[19]:(r=/* @__PURE__ */ w(S,{children:[n,k]}),t[18]=n,t[19]=r),e=m(i,{},r),t[14]=i,t[15]=e}else e=t[15];M=e}else{let e;t[20]===i?e=t[21]:(e=Z(i),t[20]=i,t[21]=e);let n;t[22]===e?n=t[23]:(n=/* @__PURE__ */ w(S,{children:[e,k]}),t[22]=e,t[23]=n),M=n}let N;t[24]===o?N=t[25]:(N=r(o,`multi-select-item`),t[24]=o,t[25]=N);let P;t[26]===a?P=t[27]:(P=n(`relative mx-1 cursor-pointer rounded-md pl-2 pr-8 py-1.5 text-strong text-sm font-normal flex min-w-0 items-center gap-2`,`[[role=option]+&]:mt-px`,`data-active-item:bg-active-menu-item`,`aria-disabled:opacity-50`,`aria-selected:bg-selected-menu-item aria-selected:data-active-item:bg-active-selected-menu-item`,a),t[26]=a,t[27]=P);let F;t[28]!==D||t[29]!==s?(F=e=>{D?e.preventDefault():s?.(e)},t[28]=D,t[29]=s,t[30]=F):F=t[30];let I=v?te:void 0,L;return t[31]!==M||t[32]!==y||t[33]!==c||t[34]!==l||t[35]!==N||t[36]!==P||t[37]!==F||t[38]!==I||t[39]!==h?(L=/* @__PURE__ */ C(A,{"data-slot":N,className:P,focusOnHover:y,onClick:F,ref:l,render:I,resetValueOnSelect:!0,value:h,...c,children:M}),t[31]=M,t[32]=y,t[33]=c,t[34]=l,t[35]=N,t[36]=P,t[37]=F,t[38]=I,t[39]=h,t[40]=L):L=t[40],L},Group:e=>{let t=p(14),n,i,a,o,s;t[0]===e?(n=t[1],i=t[2],a=t[3],o=t[4],s=t[5]):({"data-slot":i,asChild:s,children:n,ref:o,...a}=e,t[0]=e,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s);let c=s!==void 0&&s,l;t[6]===i?l=t[7]:(l=r(i,`multi-select-group`),t[6]=i,t[7]=l);let u=c?ne:void 0,d;return t[8]!==n||t[9]!==a||t[10]!==o||t[11]!==l||t[12]!==u?(d=/* @__PURE__ */ C(O,{"data-slot":l,className:`mx-1`,ref:o,render:u,...a,children:n}),t[8]=n,t[9]=a,t[10]=o,t[11]=l,t[12]=u,t[13]=d):d=t[13],d},GroupLabel:e=>{let t=p(18),i,a,o,s,c,l;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6]):({"data-slot":o,asChild:l,children:i,className:a,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l);let u=l!==void 0&&l,d;t[7]===o?d=t[8]:(d=r(o,`multi-select-group-label`),t[7]=o,t[8]=d);let f;t[9]===a?f=t[10]:(f=n(`text-muted px-2 py-1 text-xs font-medium`,a),t[9]=a,t[10]=f);let m=u?re:void 0,h;return t[11]!==i||t[12]!==s||t[13]!==c||t[14]!==d||t[15]!==f||t[16]!==m?(h=/* @__PURE__ */ C(k,{"data-slot":d,className:f,ref:c,render:m,...s,children:i}),t[11]=i,t[12]=s,t[13]=c,t[14]=d,t[15]=f,t[16]=m,t[17]=h):h=t[17],h},GroupDescription:e=>{let t=p(16),i,a,o,s,c;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5]):({"data-slot":o,className:a,children:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c);let l;t[6]===o?l=t[7]:(l=r(o,`multi-select-group-description`),t[6]=o,t[7]=l);let u;t[8]===a?u=t[9]:(u=n(`text-muted px-2 pb-1 text-xs`,a),t[8]=a,t[9]=u);let d;return t[10]!==i||t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==u?(d=/* @__PURE__ */ C(`p`,{"data-slot":l,className:u,ref:c,...s,children:i}),t[10]=i,t[11]=s,t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15],d},Separator:e=>{let t=p(14),i,a,o,s;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4]):({"data-slot":a,className:i,ref:s,...o}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s);let c;t[5]===a?c=t[6]:(c=r(a,`multi-select-separator`),t[5]=a,t[6]=c);let l;t[7]===i?l=t[8]:(l=n(`my-1 w-auto`,i),t[7]=i,t[8]=l);let u;return t[9]!==o||t[10]!==s||t[11]!==c||t[12]!==l?(u=/* @__PURE__ */ C(d,{"data-slot":c,ref:s,className:l,...o}),t[9]=o,t[10]=s,t[11]=c,t[12]=l,t[13]=u):u=t[13],u},Empty:e=>{let t=p(16),i,a,o,s,c;t[0]===e?(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5]):({"data-slot":o,className:a,children:i,ref:c,...s}=e,t[0]=e,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c);let l;t[6]===o?l=t[7]:(l=r(o,`multi-select-empty`),t[6]=o,t[7]=l);let u;t[8]===a?u=t[9]:(u=n(`mx-1 text-muted px-2 py-6 text-center text-sm`,a),t[8]=a,t[9]=u);let d;return t[10]!==i||t[11]!==s||t[12]!==c||t[13]!==l||t[14]!==u?(d=/* @__PURE__ */ C(`div`,{"data-slot":l,className:u,ref:c,role:`presentation`,...s,children:i}),t[10]=i,t[11]=s,t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15],d}};function $(e){e.preventDefault()}function ee(e){let{ref:t,...n}=e;return/* @__PURE__ */ C(f,{ref:t,...n})}function te(e){let{ref:t,...n}=e;return/* @__PURE__ */ C(f,{ref:t,...n})}function ne(e){let{ref:t,...n}=e;return/* @__PURE__ */ C(f,{ref:t,...n})}function re(e){let{ref:t,...n}=e;return/* @__PURE__ */ C(f,{ref:t,...n})}export{Q as MultiSelect};
|
package/dist/otp-input.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the OtpInput component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
5
|
+
*/
|
|
1
6
|
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
7
|
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
3
|
-
import { o as WithValidation } from "./field-
|
|
8
|
+
import { o as WithValidation } from "./field-BshcNVe_.js";
|
|
4
9
|
import { ComponentProps, ReactNode } from "react";
|
|
5
10
|
import { OTPInput, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS } from "input-otp";
|
|
6
11
|
type OtpInputRootProps = Omit<ComponentProps<typeof OTPInput>, "render" | "children"> & WithValidation & {
|
|
@@ -26,10 +31,11 @@ type OtpInputRootProps = Omit<ComponentProps<typeof OTPInput>, "render" | "child
|
|
|
26
31
|
* **Accessibility.** The hidden input needs an accessible name. Inside a
|
|
27
32
|
* `Field.Item`, `Field.Label` supplies it. On its own, pass `aria-label`.
|
|
28
33
|
*
|
|
29
|
-
* **Password managers.** The hidden input
|
|
30
|
-
* 1Password, Bitwarden, Dashlane,
|
|
31
|
-
*
|
|
32
|
-
* attribute
|
|
34
|
+
* **Password managers.** The hidden input sets `autocomplete="one-time-code"`,
|
|
35
|
+
* so 1Password, Bitwarden, Dashlane, and Proton Pass can fill the code. Each
|
|
36
|
+
* can also show its badge beside the last slot. Do not add their ignore
|
|
37
|
+
* attributes: an ignore attribute also stops the fill. LastPass does not fill
|
|
38
|
+
* one-time codes, so the input carries `data-lpignore`.
|
|
33
39
|
*
|
|
34
40
|
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
35
41
|
*
|
|
@@ -160,6 +166,12 @@ declare const Separator: ({ "data-slot": dataSlot, asChild, children, className,
|
|
|
160
166
|
* single hidden input (handling paste, autofill, and IME) with a row of
|
|
161
167
|
* styled character slots.
|
|
162
168
|
*
|
|
169
|
+
* @useWhen Enter a one-time passcode, such as a two-factor code, with one box for each character.
|
|
170
|
+
*
|
|
171
|
+
* @siblings
|
|
172
|
+
* - `Input`: the value is free-form text.
|
|
173
|
+
* - `PasswordInput`: the value is a password or another long-lived secret.
|
|
174
|
+
*
|
|
163
175
|
* @see https://mantle.ngrok.com/components/forms/otp-input
|
|
164
176
|
*
|
|
165
177
|
* @example
|
package/dist/otp-input.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as
|
|
1
|
+
import{t as e}from"./css-properties-D85fCNV3.js";import{t}from"./cx-CK7o_rVv.js";import{t as n}from"./data-slot-EM6s2WEU.js";import{t as r}from"./field-Bihblt8U.js";import{t as i}from"./input-BjCDSOPA.js";import{a,r as o}from"./field-CPvjazWN.js";import{t as s}from"./slot-DdYN1L1C.js";import{c}from"react/compiler-runtime";import{useContext as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{MinusIcon as f}from"@phosphor-icons/react/Minus";import{OTPInput as p,OTPInputContext as m,REGEXP_ONLY_CHARS as h,REGEXP_ONLY_DIGITS as g,REGEXP_ONLY_DIGITS_AND_CHARS as _}from"input-otp";const v={error:`danger`,success:`success`,warning:`warning`},y=e=>`var(--color-${e}-600)`,b=e=>`var(--ring-color-focus-${e})`,x=({totalActive:e,total:t})=>e===0?`idle`:e===1?`caret`:e===t?`all`:`range`,S=t=>{let n=c(10),{children:r,validation:i}=t,a=l(m),o=a.slots.length,s;if(n[0]!==a.slots||n[1]!==o){let e=a.slots.reduce(w,0);s=x({totalActive:e,total:o}),n[0]=a.slots,n[1]=o,n[2]=s}else s=n[2];let d=s,f=i?v[i]:void 0,p;n[3]===f?p=n[4]:(p=f?e({"--otp-validation-border":y(f),"--otp-validation-ring":b(f)}):void 0,n[3]=f,n[4]=p);let h=p,g=i||void 0,_;return n[5]!==r||n[6]!==d||n[7]!==g||n[8]!==h?(_=/* @__PURE__ */ u(`div`,{className:`group/otp contents`,"data-otp-state":d,"data-validation":g,style:h,children:r}),n[5]=r,n[6]=d,n[7]=g,n[8]=h,n[9]=_):_=n[9],_},C={Root:e=>{let s=c(32),d,f,m,h,g,_,v,y;s[0]===e?(d=s[1],f=s[2],m=s[3],h=s[4],g=s[5],_=s[6],v=s[7],y=s[8]):({"data-slot":_,"aria-invalid":f,children:m,className:h,containerClassName:g,ref:y,validation:d,...v}=e,s[0]=e,s[1]=d,s[2]=f,s[3]=m,s[4]=h,s[5]=g,s[6]=_,s[7]=v,s[8]=y);let b=a(),x=l(r),C=d??b,w;s[9]!==f||s[10]!==C?(w=o({"aria-invalid":f,defaultAriaInvalid:!1,validation:C}),s[9]=f,s[10]=C,s[11]=w):w=s[11];let{ariaInvalid:T,validation:E}=w,D;s[12]===_?D=s[13]:(D=n(_,`otp-input`),s[12]=_,s[13]=D);let O;s[14]===g?O=s[15]:(O=t(`flex items-center gap-2 has-disabled:opacity-50`,g),s[14]=g,s[15]=O);let k;s[16]===h?k=s[17]:(k=t(`disabled:cursor-not-allowed`,h),s[16]=h,s[17]=k);let A;s[18]===x?A=s[19]:(A=x?{"aria-describedby":x[`aria-describedby`],"aria-errormessage":x[`aria-errormessage`],id:x.id,name:x.name}:void 0,s[18]=x,s[19]=A);let j;s[20]!==m||s[21]!==E?(j=/* @__PURE__ */ u(S,{validation:E,children:m}),s[20]=m,s[21]=E,s[22]=j):j=s[22];let M;return s[23]!==v||s[24]!==y||s[25]!==T||s[26]!==D||s[27]!==O||s[28]!==k||s[29]!==A||s[30]!==j?(M=/* @__PURE__ */ u(p,{ref:y,"aria-invalid":T,"data-slot":D,containerClassName:O,className:k,"data-lpignore":i[`data-lpignore`],...v,...A,children:j}),s[23]=v,s[24]=y,s[25]=T,s[26]=D,s[27]=O,s[28]=k,s[29]=A,s[30]=j,s[31]=M):M=s[31],M},Group:e=>{let r=c(18),i,a,o,l,d,f;r[0]===e?(i=r[1],a=r[2],o=r[3],l=r[4],d=r[5],f=r[6]):({"data-slot":l,asChild:i,children:a,className:o,ref:f,...d}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=d,r[6]=f);let p=i?s:`div`,m;r[7]===l?m=r[8]:(m=n(l,`otp-input-group`),r[7]=l,r[8]=m);let h;r[9]===o?h=r[10]:(h=t(`relative flex items-center rounded-md`,`has-[[data-active]~[data-active]]:ring-focus-accent has-[[data-active]~[data-active]]:ring-4`,`group-data-validation/otp:has-[[data-active]~[data-active]]:ring-(--otp-validation-ring)`,o),r[9]=o,r[10]=h);let g;return r[11]!==p||r[12]!==a||r[13]!==d||r[14]!==f||r[15]!==m||r[16]!==h?(g=/* @__PURE__ */ u(p,{ref:f,"data-slot":m,className:h,...d,children:a}),r[11]=p,r[12]=a,r[13]=d,r[14]=f,r[15]=m,r[16]=h,r[17]=g):g=r[17],g},Slot:e=>{let r=c(20),i,a,o,s,f;r[0]===e?(i=r[1],a=r[2],o=r[3],s=r[4],f=r[5]):({"data-slot":a,className:i,index:o,ref:f,...s}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=f);let p=l(m).slots[o],h=p?.char??null,g=p?.hasFakeCaret??!1,_=p?.isActive??!1,v;r[6]===a?v=r[7]:(v=n(a,`otp-input-slot`),r[6]=a,r[7]=v);let y=_?``:void 0,b;r[8]===i?b=r[9]:(b=t(`border-form bg-form text-strong relative flex h-10 w-10 items-center justify-center border-y border-r text-sm shadow-sm outline-hidden transition-all duration-150 ease-out`,`first:rounded-l-md first:border-l last:rounded-r-md`,`[&:has(+[data-active])]:group-data-[otp-state=caret]/otp:border-r-transparent`,`data-active:group-data-[otp-state=caret]/otp:border-accent-600`,`data-active:group-data-[otp-state=caret]/otp:border-l`,`data-active:group-data-[otp-state=caret]/otp:ring-focus-accent`,`data-active:group-data-[otp-state=caret]/otp:z-20`,`data-active:group-data-[otp-state=caret]/otp:ring-4`,`group-data-[otp-state=all]/otp:border-accent-600`,`group-data-validation/otp:border-y-(--otp-validation-border)`,`group-data-validation/otp:first:border-l-(--otp-validation-border)`,`group-data-validation/otp:last:border-r-(--otp-validation-border)`,`group-data-validation/otp:data-active:group-data-[otp-state=caret]/otp:border-(--otp-validation-border)`,`group-data-validation/otp:data-active:group-data-[otp-state=caret]/otp:ring-(--otp-validation-ring)`,`group-data-validation/otp:group-data-[otp-state=all]/otp:border-(--otp-validation-border)`,i),r[8]=i,r[9]=b);let x;r[10]===g?x=r[11]:(x=g&&/* @__PURE__ */ u(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:/* @__PURE__ */ u(`div`,{className:`bg-strong h-4 w-px animate-pulse`})}),r[10]=g,r[11]=x);let S;return r[12]!==h||r[13]!==s||r[14]!==f||r[15]!==v||r[16]!==y||r[17]!==b||r[18]!==x?(S=/* @__PURE__ */ d(`div`,{ref:f,"data-slot":v,"data-active":y,className:b,...s,translate:`no`,children:[h,x]}),r[12]=h,r[13]=s,r[14]=f,r[15]=v,r[16]=y,r[17]=b,r[18]=x,r[19]=S):S=r[19],S},Separator:e=>{let r=c(24),i,a,o,l,d,p,m;r[0]===e?(i=r[1],a=r[2],o=r[3],l=r[4],d=r[5],p=r[6],m=r[7]):({"data-slot":l,asChild:i,children:a,className:o,ref:p,semantic:m,...d}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=d,r[6]=p,r[7]=m);let h=m!==void 0&&m,g=i?s:`div`,_;r[8]===h?_=r[9]:(_=h?{role:`separator`}:{"aria-hidden":!0,role:`none`},r[8]=h,r[9]=_);let v=_,y;r[10]===l?y=r[11]:(y=n(l,`otp-input-separator`),r[10]=l,r[11]=y);let b;r[12]===o?b=r[13]:(b=t(`text-separator flex items-center`,o),r[12]=o,r[13]=b);let x;r[14]===a?x=r[15]:(x=a??/* @__PURE__ */ u(f,{weight:`bold`}),r[14]=a,r[15]=x);let S;return r[16]!==g||r[17]!==d||r[18]!==p||r[19]!==v||r[20]!==y||r[21]!==b||r[22]!==x?(S=/* @__PURE__ */ u(g,{ref:p,"data-slot":y,className:b,...v,...d,children:x}),r[16]=g,r[17]=d,r[18]=p,r[19]=v,r[20]=y,r[21]=b,r[22]=x,r[23]=S):S=r[23],S}};function w(e,t){return e+ +!!t.isActive}export{C as OtpInput,h as REGEXP_ONLY_CHARS,g as REGEXP_ONLY_DIGITS,_ as REGEXP_ONLY_DIGITS_AND_CHARS};
|
package/dist/pagination.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Pagination component family — `CursorPagination`'s parts
|
|
3
|
+
* for cursor paging, `useOffsetPagination` for offset paging, and
|
|
4
|
+
* `PaginationRange` for the count line of a list whose total is known.
|
|
5
|
+
*
|
|
6
|
+
* @useWhen Move through paged data one page at a time, with a cursor or an offset.
|
|
7
|
+
*
|
|
8
|
+
* @see https://mantle.ngrok.com/components/navigation/pagination
|
|
9
|
+
*/
|
|
1
10
|
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
2
|
-
import { t as ButtonGroup } from "./button-
|
|
3
|
-
import { t as Select } from "./select-
|
|
11
|
+
import { t as ButtonGroup } from "./button-K0pKc3GN.js";
|
|
12
|
+
import { t as Select } from "./select-BqmpVJJT.js";
|
|
13
|
+
import { t as SelfClosingWithAsChild } from "./as-child-DFxX3U2i.js";
|
|
4
14
|
import { ComponentProps } from "react";
|
|
5
15
|
/**
|
|
6
16
|
* The page size owner: either the root, seeded by `defaultPageSize`, or the
|
|
@@ -301,6 +311,85 @@ declare const CursorPagination: {
|
|
|
301
311
|
*/
|
|
302
312
|
readonly PageSizeValue: typeof PageSizeValue;
|
|
303
313
|
};
|
|
314
|
+
/**
|
|
315
|
+
* The noun a count line counts, in both grammatical numbers. Pass both forms,
|
|
316
|
+
* because an English plural is irregular: "IP policy" becomes "IP policies".
|
|
317
|
+
*/
|
|
318
|
+
type PaginationNoun = {
|
|
319
|
+
/** The form for a count of exactly 1. */
|
|
320
|
+
singular: string;
|
|
321
|
+
/** The form for every other count, 0 included. */
|
|
322
|
+
plural: string;
|
|
323
|
+
};
|
|
324
|
+
/** The page and the list that `formatPaginationRange` describes. */
|
|
325
|
+
type PaginationRangeValue = {
|
|
326
|
+
/**
|
|
327
|
+
* The index of the first row on the page, from 0. For `useOffsetPagination`,
|
|
328
|
+
* pass its `offset`. For a TanStack table, pass `pageIndex * pageSize`.
|
|
329
|
+
*/
|
|
330
|
+
offset: number;
|
|
331
|
+
/** The most rows a page holds. Must be a positive integer. */
|
|
332
|
+
pageSize: number;
|
|
333
|
+
/** How many rows the list holds after its filter. Must be a non-negative integer. */
|
|
334
|
+
total: number;
|
|
335
|
+
/**
|
|
336
|
+
* The noun to count.
|
|
337
|
+
*
|
|
338
|
+
* @default { singular: "result", plural: "results" }
|
|
339
|
+
*/
|
|
340
|
+
noun?: PaginationNoun;
|
|
341
|
+
};
|
|
342
|
+
type PaginationRangeProps = Omit<ComponentProps<"span">, "children"> & SelfClosingWithAsChild & WithDataSlot & PaginationRangeValue;
|
|
343
|
+
/**
|
|
344
|
+
* The count line beside a paginated list or table, such as "1–20 of 2,396
|
|
345
|
+
* domains". It is a live region, so a screen reader announces the new range
|
|
346
|
+
* when the page changes. Without it, the rows change and a screen reader says
|
|
347
|
+
* nothing.
|
|
348
|
+
*
|
|
349
|
+
* The line shows the total alone when one page holds every row, and no text
|
|
350
|
+
* for an empty list, because the list shows its own empty state. The element
|
|
351
|
+
* renders in every state, because a live region added together with its text
|
|
352
|
+
* is not announced.
|
|
353
|
+
*
|
|
354
|
+
* It takes `offset`, `pageSize`, and `total`, so the same part serves offset
|
|
355
|
+
* state from `useOffsetPagination` beside a `Table` and a TanStack table
|
|
356
|
+
* instance beside a `DataTable`. Place it in `CursorPagination.Root`, beside
|
|
357
|
+
* the page-size select and the buttons. Digits group in `en-US`, so the server
|
|
358
|
+
* and the client render the same text.
|
|
359
|
+
*
|
|
360
|
+
* **Polymorphism.** Pass `asChild` to render the text in your own element. The
|
|
361
|
+
* child must have no children of its own, because the part renders the text.
|
|
362
|
+
*
|
|
363
|
+
* | Data Attribute | Value | Description |
|
|
364
|
+
* | -------------- | -------------------- | ------------ |
|
|
365
|
+
* | `data-slot` | `"pagination-range"` | On the root. |
|
|
366
|
+
*
|
|
367
|
+
* @see https://mantle.ngrok.com/components/navigation/pagination#paginationrange
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```tsx
|
|
371
|
+
* import { CursorPagination, PaginationRange, useOffsetPagination } from "@ngrok/mantle/pagination";
|
|
372
|
+
*
|
|
373
|
+
* const pagination = useOffsetPagination({ listSize: domains.length, pageSize: 20 });
|
|
374
|
+
*
|
|
375
|
+
* <CursorPagination.Root pageSize={pagination.pageSize} onChangePageSize={pagination.setPageSize}>
|
|
376
|
+
* <PaginationRange
|
|
377
|
+
* offset={pagination.offset}
|
|
378
|
+
* pageSize={pagination.pageSize}
|
|
379
|
+
* total={domains.length}
|
|
380
|
+
* noun={{ singular: "domain", plural: "domains" }}
|
|
381
|
+
* />
|
|
382
|
+
* <CursorPagination.PageSizeSelect />
|
|
383
|
+
* <CursorPagination.Buttons
|
|
384
|
+
* hasNextPage={pagination.hasNextPage}
|
|
385
|
+
* hasPreviousPage={pagination.hasPreviousPage}
|
|
386
|
+
* onNextPage={pagination.nextPage}
|
|
387
|
+
* onPreviousPage={pagination.previousPage}
|
|
388
|
+
* />
|
|
389
|
+
* </CursorPagination.Root>
|
|
390
|
+
* ```
|
|
391
|
+
*/
|
|
392
|
+
declare function PaginationRange({ asChild, children, className, "data-slot": dataSlot, noun, offset, pageSize, total, ...props }: PaginationRangeProps): import("react").JSX.Element;
|
|
304
393
|
type UseOffsetPaginationProps = {
|
|
305
394
|
/**
|
|
306
395
|
* The total number of items in the list to paginate. A change resets the
|
|
@@ -447,4 +536,4 @@ declare function useOffsetPagination({ defaultPage, listSize, onPageChange, page
|
|
|
447
536
|
* ```
|
|
448
537
|
*/
|
|
449
538
|
declare function getOffsetPaginatedSlice<T>(list: readonly T[], pagination: OffsetPaginationState): T[];
|
|
450
|
-
export { type CursorButtonsProps, type CursorPageSizeSelectProps, type CursorPageSizeValueProps, CursorPagination, type CursorPaginationProps, type OffsetPaginationState, type UseOffsetPaginationProps, getOffsetPaginatedSlice, useOffsetPagination };
|
|
539
|
+
export { type CursorButtonsProps, type CursorPageSizeSelectProps, type CursorPageSizeValueProps, CursorPagination, type CursorPaginationProps, type OffsetPaginationState, type PaginationNoun, PaginationRange, type PaginationRangeProps, type UseOffsetPaginationProps, getOffsetPaginatedSlice, useOffsetPagination };
|
package/dist/pagination.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"./button-
|
|
1
|
+
import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./button-69InNC_m.js";import{t as r}from"./button-BWGUuWnu.js";import{t as i}from"./select-C6Su0dU0.js";import{n as a}from"./separator-DfzxVutO.js";import{t as o}from"./slot-DdYN1L1C.js";import{c as s}from"react/compiler-runtime";import{Children as c,cloneElement as l,createContext as u,isValidElement as d,useContext as f,useEffect as p,useRef as m,useState as h}from"react";import g from"tiny-invariant";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{CaretRightIcon as y}from"@phosphor-icons/react/CaretRight";import{CaretLeftIcon as b}from"@phosphor-icons/react/CaretLeft";const x=u(void 0),S=n=>{let r=s(28),i,a,o,c,l,u,d,f;r[0]===n?(i=r[1],a=r[2],o=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=r[8]):({"data-slot":o,className:a,children:i,defaultPageSize:c,onChangePageSize:l,pageSize:u,ref:f,...d}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=c,r[5]=l,r[6]=u,r[7]=d,r[8]=f);let p=u!=null,[m,v]=h(c),y=p?u:m;g(y!=null,"CursorPagination.Root requires either `defaultPageSize` or `pageSize`");let b;r[9]!==p||r[10]!==l?(b=e=>{p||v(e),l?.(e)},r[9]=p,r[10]=l,r[11]=b):b=r[11];let S;r[12]!==y||r[13]!==b?(S={pageSize:y,setPageSize:b},r[12]=y,r[13]=b,r[14]=S):S=r[14];let C=S,w;r[15]===o?w=r[16]:(w=t(o,`cursor-pagination`),r[15]=o,r[16]=w);let T;r[17]===a?T=r[18]:(T=e(`inline-flex items-center justify-between gap-2`,a),r[17]=a,r[18]=T);let E;r[19]!==i||r[20]!==d||r[21]!==f||r[22]!==w||r[23]!==T?(E=/* @__PURE__ */ _(`div`,{"data-slot":w,className:T,ref:f,...d,children:i}),r[19]=i,r[20]=d,r[21]=f,r[22]=w,r[23]=T,r[24]=E):E=r[24];let D;return r[25]!==C||r[26]!==E?(D=/* @__PURE__ */ _(x.Provider,{value:C,children:E}),r[25]=C,r[26]=E,r[27]=D):D=r[27],D},C=e=>{let i=s(25),o,c,l,u,d,f,p;i[0]===e?(o=i[1],c=i[2],l=i[3],u=i[4],d=i[5],f=i[6],p=i[7]):({"data-slot":o,hasNextPage:c,hasPreviousPage:l,onNextPage:u,onPreviousPage:d,ref:p,...f}=e,i[0]=e,i[1]=o,i[2]=c,i[3]=l,i[4]=u,i[5]=d,i[6]=f,i[7]=p);let m;i[8]===o?m=i[9]:(m=t(o,`cursor-pagination-buttons`),i[8]=o,i[9]=m);let h=!l,g;i[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=/* @__PURE__ */ _(b,{}),i[10]=g):g=i[10];let x;i[11]!==d||i[12]!==h?(x=/* @__PURE__ */ _(r,{"data-slot":`cursor-pagination-previous`,appearance:`ghost`,disabled:h,icon:g,intent:`neutral`,label:`Previous page`,onClick:d,size:`sm`,type:`button`}),i[11]=d,i[12]=h,i[13]=x):x=i[13];let S;i[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=/* @__PURE__ */ _(a,{"data-slot":`cursor-pagination-separator`,orientation:`vertical`,className:`min-h-5`}),i[14]=S):S=i[14];let C=!c,w;i[15]===Symbol.for(`react.memo_cache_sentinel`)?(w=/* @__PURE__ */ _(y,{}),i[15]=w):w=i[15];let T;i[16]!==u||i[17]!==C?(T=/* @__PURE__ */ _(r,{"data-slot":`cursor-pagination-next`,appearance:`ghost`,disabled:C,icon:w,intent:`neutral`,label:`Next page`,onClick:u,size:`sm`,type:`button`}),i[16]=u,i[17]=C,i[18]=T):T=i[18];let E;return i[19]!==f||i[20]!==p||i[21]!==m||i[22]!==x||i[23]!==T?(E=/* @__PURE__ */ v(n,{"data-slot":m,appearance:`panel`,ref:p,...f,children:[x,S,T]}),i[19]=f,i[20]=p,i[21]=m,i[22]=x,i[23]=T,i[24]=E):E=i[24],E},w=[5,10,20,50,100],T=n=>{let r=s(31),a,o,c,l,u,d;r[0]===n?(a=r[1],o=r[2],c=r[3],l=r[4],u=r[5],d=r[6]):({"data-slot":o,className:a,pageSizes:d,onChangePageSize:c,ref:l,...u}=n,r[0]=n,r[1]=a,r[2]=o,r[3]=c,r[4]=l,r[5]=u,r[6]=d);let p=d===void 0?w:d,m=f(x);g(m,`CursorPageSizeSelect must be used as a child of a CursorPagination component`),g(p.includes(m.pageSize),`CursorPagination.pageSize must be included in CursorPageSizeSelect.pageSizes`);let h=`${m.pageSize}`,y;r[7]!==m||r[8]!==c?(y=e=>{let t=Number.parseInt(e,10);g(!Number.isNaN(t),`CursorPageSizeSelect.pageSizes must contain only numbers`),m.setPageSize(t),c?.(t)},r[7]=m,r[8]=c,r[9]=y):y=r[9];let b;r[10]===o?b=r[11]:(b=t(o,`cursor-pagination-page-size-select`),r[10]=o,r[11]=b);let S;r[12]===a?S=r[13]:(S=e(`w-auto min-w-36`,a),r[12]=a,r[13]=S);let C;r[14]===m.pageSize?C=r[15]:(C=/* @__PURE__ */ v(i.Value,{children:[m.pageSize,` per page`]}),r[14]=m.pageSize,r[15]=C);let T;r[16]!==l||r[17]!==u||r[18]!==b||r[19]!==S||r[20]!==C?(T=/* @__PURE__ */ _(i.Trigger,{ref:l,"aria-label":`Items per page`,"data-slot":b,className:S,...u,children:C}),r[16]=l,r[17]=u,r[18]=b,r[19]=S,r[20]=C,r[21]=T):T=r[21];let E;r[22]===p?E=r[23]:(E=p.map(O),r[22]=p,r[23]=E);let D;r[24]===E?D=r[25]:(D=/* @__PURE__ */ _(i.Content,{width:`trigger`,children:E}),r[24]=E,r[25]=D);let k;return r[26]!==h||r[27]!==y||r[28]!==T||r[29]!==D?(k=/* @__PURE__ */ v(i.Root,{value:h,onValueChange:y,children:[T,D]}),r[26]=h,r[27]=y,r[28]=T,r[29]=D,r[30]=k):k=r[30],k};function E(n){let r=s(13),i,a,o;r[0]===n?(i=r[1],a=r[2],o=r[3]):({"data-slot":a,className:i,...o}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o);let c=f(x);g(c,`CursorPageSizeValue must be used as a child of a CursorPagination component`);let l;r[4]===a?l=r[5]:(l=t(a,`cursor-pagination-page-size-value`),r[4]=a,r[5]=l);let u;r[6]===i?u=r[7]:(u=e(`text-muted text-sm font-normal`,i),r[6]=i,r[7]=u);let d;return r[8]!==c.pageSize||r[9]!==o||r[10]!==l||r[11]!==u?(d=/* @__PURE__ */ v(`span`,{"data-slot":l,className:u,...o,children:[c.pageSize,` per page`]}),r[8]=c.pageSize,r[9]=o,r[10]=l,r[11]=u,r[12]=d):d=r[12],d}const D={Root:S,Buttons:C,PageSizeSelect:T,PageSizeValue:E};function O(e){return/* @__PURE__ */ v(i.Item,{value:`${e}`,children:[e,` per page`]},e)}const k=new Intl.NumberFormat(`en-US`),A={singular:`result`,plural:`results`};function j({offset:e,pageSize:t,total:n,noun:r=A}){if(g(Number.isInteger(t)&&t>0,`PaginationRange: \`pageSize\` must be a positive integer, received ${String(t)}.`),g(Number.isInteger(n)&&n>=0,`PaginationRange: \`total\` must be a non-negative integer, received ${String(n)}.`),g(Number.isInteger(e)&&e>=0,`PaginationRange: \`offset\` must be a non-negative integer, received ${String(e)}.`),n===0)return``;let i=n===1?r.singular:r.plural;if(n<=t)return`${k.format(n)} ${i}`;let a=Math.min(e,n-1)+1,o=Math.min(a+t-1,n);return`${a===o?k.format(a):`${k.format(a)}–${k.format(o)}`} of ${k.format(n)} ${i}`}function M(n){let r=s(29),i,a,u,f,p,m,h,v,y;r[0]===n?(i=r[1],a=r[2],u=r[3],f=r[4],p=r[5],m=r[6],h=r[7],v=r[8],y=r[9]):({asChild:v,children:i,className:a,"data-slot":u,noun:f,offset:p,pageSize:m,total:y,...h}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=u,r[4]=f,r[5]=p,r[6]=m,r[7]=h,r[8]=v,r[9]=y);let b=v!==void 0&&v,x,S;if(r[10]!==b||r[11]!==i||r[12]!==a||r[13]!==u||r[14]!==f||r[15]!==p||r[16]!==m||r[17]!==h||r[18]!==y){S=Symbol.for(`react.early_return_sentinel`);bb0:{let n=j({offset:p,pageSize:m,total:y,noun:f}),s;r[21]===u?s=r[22]:(s=t(u,`pagination-range`),r[21]=u,r[22]=s);let v;r[23]===a?v=r[24]:(v=e(`text-muted text-sm font-normal`,a),r[23]=a,r[24]=v);let C;r[25]!==h||r[26]!==s||r[27]!==v?(C={role:`status`,"data-slot":s,className:v,...h},r[25]=h,r[26]=s,r[27]=v,r[28]=C):C=r[28];let w=C;if(!b){S=/* @__PURE__ */ _(`span`,{...w,children:n});break bb0}let T=c.only(i);g(d(T),"When using `asChild`, PaginationRange must be passed a single child as a JSX tag."),g(T.props.children==null,"When using `asChild`, the child of PaginationRange must have no children of its own. The part renders the text."),x=/* @__PURE__ */ _(o,{...w,children:l(T,{},n)})}r[10]=b,r[11]=i,r[12]=a,r[13]=u,r[14]=f,r[15]=p,r[16]=m,r[17]=h,r[18]=y,r[19]=x,r[20]=S}else x=r[19],S=r[20];return S===Symbol.for(`react.early_return_sentinel`)?x:S}function N(e,t){return Math.max(1,Math.min(Number.isNaN(e)?1:Math.floor(e),t))}function P(e){let t=s(41),{defaultPage:n,listSize:r,onPageChange:i,page:a,pageSize:o,resetPageOnListSizeChange:c}=e,l=n===void 0?1:n,u=c===void 0||c,d=a!=null,[f,g]=h(l),[_,v]=h(o),y=Math.ceil(r/_),b=d?a:f,x=N(b,y),S=(x-1)*_,C=x>1,w=x<y,T;t[0]!==d||t[1]!==i||t[2]!==b?(T=e=>{e!==b&&(d||g(e),i?.(e))},t[0]=d,t[1]=i,t[2]=b,t[3]=T):T=t[3];let E=T,D=m(o),O=m(r),k,A;t[4]!==r||t[5]!==o||t[6]!==u||t[7]!==E?(k=()=>{let e=D.current!==o,t=O.current!==r;D.current=o,O.current=r,e&&v(o),(e||t&&u)&&E(1)},A=[r,o,u,E],t[4]=r,t[5]=o,t[6]=u,t[7]=E,t[8]=k,t[9]=A):(k=t[8],A=t[9]),p(k,A);let j;t[10]!==E||t[11]!==y?(j=function(e){E(N(e,y))},t[10]=E,t[11]=y,t[12]=j):j=t[12];let M=j,P;t[13]!==x||t[14]!==w||t[15]!==E?(P=function(){w&&E(x+1)},t[13]=x,t[14]=w,t[15]=E,t[16]=P):P=t[16];let F=P,I;t[17]!==x||t[18]!==C||t[19]!==E?(I=function(){C&&E(x-1)},t[17]=x,t[18]=C,t[19]=E,t[20]=I):I=t[20];let L=I,R;t[21]===E?R=t[22]:(R=function(e){v(e),E(1)},t[21]=E,t[22]=R);let z=R,B;t[23]!==E||t[24]!==y?(B=function(){E(N(y,y))},t[23]=E,t[24]=y,t[25]=B):B=t[25];let V=B,H;t[26]===E?H=t[27]:(H=function(){E(1)},t[26]=E,t[27]=H);let U=H,W;return t[28]!==x||t[29]!==_||t[30]!==U||t[31]!==V||t[32]!==M||t[33]!==w||t[34]!==C||t[35]!==F||t[36]!==S||t[37]!==L||t[38]!==z||t[39]!==y?(W={currentPage:x,goToFirstPage:U,goToLastPage:V,goToPage:M,hasNextPage:w,hasPreviousPage:C,nextPage:F,offset:S,pageSize:_,previousPage:L,setPageSize:z,totalPages:y},t[28]=x,t[29]=_,t[30]=U,t[31]=V,t[32]=M,t[33]=w,t[34]=C,t[35]=F,t[36]=S,t[37]=L,t[38]=z,t[39]=y,t[40]=W):W=t[40],W}function F(e,t){return e.slice(t.offset,t.offset+t.pageSize)}export{D as CursorPagination,M as PaginationRange,F as getOffsetPaginatedSlice,P as useOffsetPagination};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./popover-lwkwWcRW.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
2
2
|
import { ComponentProps } from "react";
|
|
3
|
-
import { Arrow, Content } from "@radix-ui/react-popover";
|
|
4
|
-
type PopoverContentProps = ComponentProps<typeof Content> & {
|
|
3
|
+
import { Arrow as Arrow$1, Content as Content$1 } from "@radix-ui/react-popover";
|
|
4
|
+
type PopoverContentProps = ComponentProps<typeof Content$1> & {
|
|
5
5
|
/**
|
|
6
6
|
* The preferred width of the `PopoverContent` as a tailwind `max-w-` class.
|
|
7
7
|
*
|
|
@@ -42,8 +42,8 @@ type PopoverContentProps = ComponentProps<typeof Content> & {
|
|
|
42
42
|
* </Popover.Root>
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
declare const Content
|
|
46
|
-
type PopoverArrowProps = Omit<ComponentProps<typeof Arrow>, "asChild" | "children"> & WithDataSlot;
|
|
45
|
+
declare const Content: ({ "data-slot": dataSlot, align, className, onClick, preferredWidth, ref, sideOffset, ...props }: PopoverContentProps) => import("react").JSX.Element;
|
|
46
|
+
type PopoverArrowProps = Omit<ComponentProps<typeof Arrow$1>, "asChild" | "children"> & WithDataSlot;
|
|
47
47
|
/**
|
|
48
48
|
* An optional tip that points from `Popover.Content` at its anchor. Render it as
|
|
49
49
|
* a child of `Popover.Content`. Radix positions it with floating-ui's arrow
|
|
@@ -69,7 +69,7 @@ type PopoverArrowProps = Omit<ComponentProps<typeof Arrow>, "asChild" | "childre
|
|
|
69
69
|
* </Popover.Root>
|
|
70
70
|
* ```
|
|
71
71
|
*/
|
|
72
|
-
declare const Arrow
|
|
72
|
+
declare const Arrow: ({ "data-slot": dataSlot, className, height, width, ...props }: PopoverArrowProps) => import("react").JSX.Element;
|
|
73
73
|
/**
|
|
74
74
|
* A floating overlay that displays rich content in a portal, triggered by a button.
|
|
75
75
|
*
|
|
@@ -93,6 +93,15 @@ declare const Arrow$1: ({ "data-slot": dataSlot, className, height, width, ...pr
|
|
|
93
93
|
* (`z-60`). When sibling floats share a container, the most recently mounted
|
|
94
94
|
* float paints on top.
|
|
95
95
|
*
|
|
96
|
+
* @useWhen Show interactive content, such as a small form, a settings menu, or a color picker, that
|
|
97
|
+
* the user opens from a button.
|
|
98
|
+
*
|
|
99
|
+
* @siblings
|
|
100
|
+
* - `Tooltip`: the content is a short label or hint that shows on hover or focus.
|
|
101
|
+
* - `HoverCard`: the content is a preview of a link that shows on hover.
|
|
102
|
+
* - `DropdownMenu`: the content is a list of actions.
|
|
103
|
+
* - `Dialog`: the task needs a modal window that blocks the page.
|
|
104
|
+
*
|
|
96
105
|
* @see https://mantle.ngrok.com/components/overlays/popover
|
|
97
106
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/
|
|
98
107
|
*
|
|
@@ -197,7 +206,7 @@ declare const Popover: {
|
|
|
197
206
|
* </Popover.Root>
|
|
198
207
|
* ```
|
|
199
208
|
*/
|
|
200
|
-
readonly Arrow: typeof Arrow
|
|
209
|
+
readonly Arrow: typeof Arrow;
|
|
201
210
|
/**
|
|
202
211
|
* A button that closes an open popover.
|
|
203
212
|
*
|
|
@@ -254,7 +263,7 @@ declare const Popover: {
|
|
|
254
263
|
* </Popover.Root>
|
|
255
264
|
* ```
|
|
256
265
|
*/
|
|
257
|
-
readonly Content: typeof Content
|
|
266
|
+
readonly Content: typeof Content;
|
|
258
267
|
/**
|
|
259
268
|
* The trigger button that opens the popover.
|
|
260
269
|
*
|
package/dist/popover.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Popover component.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/overlays/popover
|
|
5
|
+
*/
|
|
6
|
+
import { t as Popover } from "./popover-lwkwWcRW.js";
|
|
7
|
+
import "./popover-BhTFutCz.js";
|
|
3
8
|
export { Popover };
|
package/dist/progress.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports for the Progress component family.
|
|
3
|
+
*
|
|
4
|
+
* @see https://mantle.ngrok.com/components/feedback/progress-bar
|
|
5
|
+
* @see https://mantle.ngrok.com/components/feedback/progress-donut
|
|
6
|
+
*/
|
|
1
7
|
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
2
8
|
import { ComponentProps, HTMLAttributes } from "react";
|
|
3
|
-
import { Indicator } from "@radix-ui/react-progress";
|
|
9
|
+
import { Indicator as Indicator$2 } from "@radix-ui/react-progress";
|
|
4
10
|
type ValueType = number | "indeterminate";
|
|
5
11
|
type RemValue = `${number}rem`;
|
|
6
12
|
type StrokeWidth = number | RemValue;
|
|
@@ -71,7 +77,7 @@ type Props = SvgAttributes & {
|
|
|
71
77
|
* </ProgressDonut.Root>
|
|
72
78
|
* ```
|
|
73
79
|
*/
|
|
74
|
-
declare const Root$
|
|
80
|
+
declare const Root$1: ({ "data-slot": dataSlot, children, className, max: _max, strokeWidth: _strokeWidth, value: _value, indeterminateRotationSpeed, ...props }: Props) => import("react").JSX.Element;
|
|
75
81
|
type ProgressDonutIndicatorProps = Omit<ComponentProps<"g">, "children"> & WithDataSlot;
|
|
76
82
|
/**
|
|
77
83
|
* The indicator for the circular progress bar.
|
|
@@ -89,13 +95,18 @@ type ProgressDonutIndicatorProps = Omit<ComponentProps<"g">, "children"> & WithD
|
|
|
89
95
|
* </ProgressDonut.Root>
|
|
90
96
|
* ```
|
|
91
97
|
*/
|
|
92
|
-
declare const Indicator$
|
|
98
|
+
declare const Indicator$1: ({ "data-slot": dataSlot, className, ...props }: ProgressDonutIndicatorProps) => import("react").JSX.Element;
|
|
93
99
|
/**
|
|
94
100
|
* A simple circular progress bar which shows the completion progress of a task.
|
|
95
101
|
*
|
|
96
102
|
* The indicator color is inherited via `currentColor`. Override the default
|
|
97
103
|
* (`accent-600`) by setting the `ProgressDonut.Indicator`'s text color.
|
|
98
104
|
*
|
|
105
|
+
* @useWhen Show how much of a task or a quota is complete, as a small circle.
|
|
106
|
+
*
|
|
107
|
+
* @siblings
|
|
108
|
+
* - `ProgressBar`: the indicator is a horizontal bar.
|
|
109
|
+
*
|
|
99
110
|
* @see https://mantle.ngrok.com/components/feedback/progress-donut
|
|
100
111
|
*
|
|
101
112
|
* @example
|
|
@@ -141,7 +152,7 @@ declare const ProgressDonut: {
|
|
|
141
152
|
* </ProgressDonut.Root>
|
|
142
153
|
* ```
|
|
143
154
|
*/
|
|
144
|
-
readonly Root: typeof Root$
|
|
155
|
+
readonly Root: typeof Root$1;
|
|
145
156
|
/**
|
|
146
157
|
* The indicator for the circular progress bar.
|
|
147
158
|
*
|
|
@@ -158,7 +169,7 @@ declare const ProgressDonut: {
|
|
|
158
169
|
* </ProgressDonut.Root>
|
|
159
170
|
* ```
|
|
160
171
|
*/
|
|
161
|
-
readonly Indicator: typeof Indicator$
|
|
172
|
+
readonly Indicator: typeof Indicator$1;
|
|
162
173
|
};
|
|
163
174
|
type RootProps = ComponentProps<"div"> & {
|
|
164
175
|
/**
|
|
@@ -216,8 +227,8 @@ type RootProps = ComponentProps<"div"> & {
|
|
|
216
227
|
* </ProgressBar.Root>
|
|
217
228
|
* ```
|
|
218
229
|
*/
|
|
219
|
-
declare function Root
|
|
220
|
-
type IndicatorProps = ComponentProps<typeof Indicator> & WithDataSlot;
|
|
230
|
+
declare function Root({ "data-slot": dataSlot, className, children, max: _max, value: _value, ...props }: RootProps): import("react").JSX.Element;
|
|
231
|
+
type IndicatorProps = ComponentProps<typeof Indicator$2> & WithDataSlot;
|
|
221
232
|
/**
|
|
222
233
|
* Displays the progress indicator, which visually represents the completion progress of a task.
|
|
223
234
|
*
|
|
@@ -238,13 +249,19 @@ type IndicatorProps = ComponentProps<typeof Indicator> & WithDataSlot;
|
|
|
238
249
|
* </ProgressBar.Root>
|
|
239
250
|
* ```
|
|
240
251
|
*/
|
|
241
|
-
declare function Indicator
|
|
252
|
+
declare function Indicator({ "data-slot": dataSlot, className, style, ...props }: IndicatorProps): import("react").JSX.Element;
|
|
242
253
|
/**
|
|
243
254
|
* Displays an indicator showing the completion progress of a task, typically displayed as a progress bar.
|
|
244
255
|
*
|
|
245
256
|
* A horizontal progress bar that shows the completion progress of a task.
|
|
246
257
|
* Use this component for linear progress indication.
|
|
247
258
|
*
|
|
259
|
+
* @useWhen Show how much of a task or a quota is complete, as a horizontal bar.
|
|
260
|
+
*
|
|
261
|
+
* @siblings
|
|
262
|
+
* - `ProgressDonut`: the indicator must be a small circle.
|
|
263
|
+
* - `Skeleton`: the content still loads, and its progress is unknown.
|
|
264
|
+
*
|
|
248
265
|
* @see https://mantle.ngrok.com/components/feedback/progress-bar
|
|
249
266
|
*
|
|
250
267
|
* @example
|
|
@@ -300,7 +317,7 @@ declare const ProgressBar: {
|
|
|
300
317
|
* </ProgressBar.Root>
|
|
301
318
|
* ```
|
|
302
319
|
*/
|
|
303
|
-
readonly Root: typeof Root
|
|
320
|
+
readonly Root: typeof Root;
|
|
304
321
|
/**
|
|
305
322
|
* Displays the progress indicator, which visually represents the completion progress of a task.
|
|
306
323
|
*
|
|
@@ -321,6 +338,6 @@ declare const ProgressBar: {
|
|
|
321
338
|
* </ProgressBar.Root>
|
|
322
339
|
* ```
|
|
323
340
|
*/
|
|
324
|
-
readonly Indicator: typeof Indicator
|
|
341
|
+
readonly Indicator: typeof Indicator;
|
|
325
342
|
};
|
|
326
343
|
export { ProgressBar, ProgressDonut };
|
package/dist/progress.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./
|
|
1
|
+
import{t as e}from"./css-properties-D85fCNV3.js";import{t}from"./clsx-DUGZgXfJ.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{c as i}from"react/compiler-runtime";import{createContext as a,useContext as o,useId as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{Indicator as u,Root as d}from"@radix-ui/react-progress";function f(e,{min:t,max:n}){return Math.min(n,Math.max(t,e))}function p(e){return typeof e==`number`}function m(e,t){return p(e)&&!Number.isNaN(e)&&e<=t&&e>=0}function h(e){return p(e)&&!Number.isNaN(e)&&e>0}const g={max:100,strokeWidth:`0.25rem`,value:0},_=a(g);function v(e,t){return m(e,t)?e:e==null?0:`indeterminate`}const y={Root:t=>{let a=i(40),o,s,u,d,f,m,y,S;a[0]===t?(o=a[1],s=a[2],u=a[3],d=a[4],f=a[5],m=a[6],y=a[7],S=a[8]):({"data-slot":d,children:s,className:u,max:y,strokeWidth:S,value:o,indeterminateRotationSpeed:f,...m}=t,a[0]=t,a[1]=o,a[2]=s,a[3]=u,a[4]=d,a[5]=f,a[6]=m,a[7]=y,a[8]=S);let C=y===void 0?100:y,w=S===void 0?4:S,T=h(C)?C:100,E,D,O,k;if(a[9]!==w||a[10]!==o||a[11]!==T){O=v(o,T),E=b(w??g.strokeWidth),k=p(O)?O:void 0;let t=x(E);D=e({"--radius":t}),a[9]=w,a[10]=o,a[11]=T,a[12]=E,a[13]=D,a[14]=O,a[15]=k}else E=a[12],D=a[13],O=a[14],k=a[15];let A=D,j;a[16]!==T||a[17]!==E||a[18]!==O?(j={max:T,strokeWidth:E,value:O},a[16]=T,a[17]=E,a[18]=O,a[19]=j):j=a[19];let M=j,N;a[20]===d?N=a[21]:(N=r(d,`progress-donut`),a[20]=d,a[21]=N);let P;a[22]!==u||a[23]!==f||a[24]!==O?(P=n(`size-6 text-gray-200 dark:text-gray-300`,O===`indeterminate`&&[`animate-spin`,f??`animation-duration-[15s]`],u),a[22]=u,a[23]=f,a[24]=O,a[25]=P):P=a[25];let F;a[26]!==E||a[27]!==A?(F=/* @__PURE__ */ c(`circle`,{className:`[r:var(--radius)]`,cx:`50%`,cy:`50%`,fill:`transparent`,stroke:`currentColor`,strokeWidth:E,style:A}),a[26]=E,a[27]=A,a[28]=F):F=a[28];let I;a[29]!==s||a[30]!==T||a[31]!==m||a[32]!==N||a[33]!==P||a[34]!==F||a[35]!==k?(I=/* @__PURE__ */ l(`svg`,{"data-slot":N,"aria-valuemax":T,"aria-valuemin":0,"aria-valuenow":k,className:P,"data-max":T,"data-min":0,"data-value":k,height:`100%`,role:`progressbar`,width:`100%`,...m,children:[F,s]}),a[29]=s,a[30]=T,a[31]=m,a[32]=N,a[33]=P,a[34]=F,a[35]=k,a[36]=I):I=a[36];let L;return a[37]!==M||a[38]!==I?(L=/* @__PURE__ */ c(_.Provider,{value:M,children:I}),a[37]=M,a[38]=I,a[39]=L):L=a[39],L},Indicator:a=>{let u=i(52),d,f,p;u[0]===a?(d=u[1],f=u[2],p=u[3]):({"data-slot":f,className:d,...p}=a,u[0]=a,u[1]=d,u[2]=f,u[3]=p);let m=s(),h=o(_)??g,v=(h.value===`indeterminate`?.6:h.value/h.max)*100,y,S,C,w,T,E,D,O,k,A,j,M,N,P,F;if(u[4]!==d||u[5]!==h.strokeWidth||u[6]!==h.value||u[7]!==f||u[8]!==m||u[9]!==v||u[10]!==p){let i=b(h.strokeWidth),a=x(i);u[26]===f?w=u[27]:(w=r(f,`progress-donut-indicator`),u[26]=f,u[27]=w),u[28]===d?T=u[29]:(T=n(`text-accent-600`,d),u[28]=d,u[29]=T),E=p,u[30]!==h.value||u[31]!==m?(D=h.value===`indeterminate`&&/* @__PURE__ */ c(`defs`,{children:/* @__PURE__ */ l(`linearGradient`,{id:m,children:[/* @__PURE__ */ c(`stop`,{className:`stop-opacity-100 stop-color-current`,offset:`0%`}),/* @__PURE__ */ c(`stop`,{className:`stop-opacity-0 stop-color-current`,offset:`95%`})]})}),u[30]=h.value,u[31]=m,u[32]=D):D=u[32],u[33]===Symbol.for(`react.memo_cache_sentinel`)?(y=t(`[r:var(--radius)]`,`origin-center`),u[33]=y):y=u[33],O=`50%`,k=`50%`,A=`transparent`,j=100,M=h.value===`indeterminate`?`url(#${m})`:`currentColor`,N=100,P=100-v,F=`round`,S=i,C=e({"--radius":a}),u[4]=d,u[5]=h.strokeWidth,u[6]=h.value,u[7]=f,u[8]=m,u[9]=v,u[10]=p,u[11]=y,u[12]=S,u[13]=C,u[14]=w,u[15]=T,u[16]=E,u[17]=D,u[18]=O,u[19]=k,u[20]=A,u[21]=j,u[22]=M,u[23]=N,u[24]=P,u[25]=F}else y=u[11],S=u[12],C=u[13],w=u[14],T=u[15],E=u[16],D=u[17],O=u[18],k=u[19],A=u[20],j=u[21],M=u[22],N=u[23],P=u[24],F=u[25];let I;u[34]!==y||u[35]!==S||u[36]!==C||u[37]!==O||u[38]!==k||u[39]!==A||u[40]!==j||u[41]!==M||u[42]!==N||u[43]!==P||u[44]!==F?(I=/* @__PURE__ */ c(`circle`,{className:y,cx:O,cy:k,fill:A,pathLength:j,stroke:M,strokeDasharray:N,strokeDashoffset:P,strokeLinecap:F,strokeWidth:S,style:C,transform:`rotate(-90)`}),u[34]=y,u[35]=S,u[36]=C,u[37]=O,u[38]=k,u[39]=A,u[40]=j,u[41]=M,u[42]=N,u[43]=P,u[44]=F,u[45]=I):I=u[45];let L;return u[46]!==w||u[47]!==T||u[48]!==E||u[49]!==D||u[50]!==I?(L=/* @__PURE__ */ l(`g`,{"data-slot":w,className:T,...E,children:[D,I]}),u[46]=w,u[47]=T,u[48]=E,u[49]=D,u[50]=I,u[51]=L):L=u[51],L}};function b(e){let t=4;return e==null?t:(t=typeof e==`number`?e:e.endsWith(`rem`)?Number(e.replace(`rem`,``))*16:Number(e),f(Number.isNaN(t)?4:t,{min:1,max:12}))}function x(e){return`calc(50% - ${e/2}px)`}const S=a({max:100,value:0});function C(e,t){return m(e,t)?e:e==null?0:`indeterminate`}function w(e){let t=i(28),a,o,s,l,u,f;t[0]===e?(a=t[1],o=t[2],s=t[3],l=t[4],u=t[5],f=t[6]):({"data-slot":l,className:s,children:o,max:f,value:a,...u}=e,t[0]=e,t[1]=a,t[2]=o,t[3]=s,t[4]=l,t[5]=u,t[6]=f);let m=f===void 0?100:f,g=h(m)?m:100,_,v;t[7]!==a||t[8]!==g?(v=C(a,g),_=p(v)?v:void 0,t[7]=a,t[8]=g,t[9]=_,t[10]=v):(_=t[9],v=t[10]);let y=_,b;t[11]!==g||t[12]!==v?(b={max:g,value:v},t[11]=g,t[12]=v,t[13]=b):b=t[13];let x=b,w;t[14]===l?w=t[15]:(w=r(l,`progress-bar`),t[14]=l,t[15]=w);let T;t[16]===s?T=t[17]:(T=n(`bg-base-hover dark:bg-base shadow-inner relative h-3 w-full overflow-hidden rounded-md`,s),t[16]=s,t[17]=T);let E;t[18]!==o||t[19]!==g||t[20]!==u||t[21]!==w||t[22]!==T||t[23]!==y?(E=/* @__PURE__ */ c(d,{"data-slot":w,className:T,value:y,max:g,...u,children:o}),t[18]=o,t[19]=g,t[20]=u,t[21]=w,t[22]=T,t[23]=y,t[24]=E):E=t[24];let D;return t[25]!==x||t[26]!==E?(D=/* @__PURE__ */ c(S.Provider,{value:x,children:E}),t[25]=x,t[26]=E,t[27]=D):D=t[27],D}function T(e){let t=i(17),a,s,l,d;t[0]===e?(a=t[1],s=t[2],l=t[3],d=t[4]):({"data-slot":s,className:a,style:d,...l}=e,t[0]=e,t[1]=a,t[2]=s,t[3]=l,t[4]=d);let f=o(S),{max:p}=f,m=(p-(f.value===`indeterminate`?0:f.value))/p*100,h;t[5]===s?h=t[6]:(h=r(s,`progress-bar-indicator`),t[5]=s,t[6]=h);let g;t[7]===a?g=t[8]:(g=n(`bg-accent-600 h-full w-full flex-1 transition-transform duration-200 ease-out-strong motion-reduce:transition-none`,a),t[7]=a,t[8]=g);let _=`translateX(-${m}%)`,v;t[9]!==d||t[10]!==_?(v={...d,transform:_},t[9]=d,t[10]=_,t[11]=v):v=t[11];let y;return t[12]!==l||t[13]!==h||t[14]!==g||t[15]!==v?(y=/* @__PURE__ */ c(u,{"data-slot":h,className:g,style:v,...l}),t[12]=l,t[13]=h,t[14]=g,t[15]=v,t[16]=y):y=t[16],y}const E={Root:w,Indicator:T};export{E as ProgressBar,y as ProgressDonut};
|