@ngrok/mantle 0.81.0 → 0.82.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 +6 -6
- package/dist/accordion.js +1 -1
- package/dist/agent.json +4 -1
- package/dist/alert-BWwNPOMI.d.ts +391 -0
- package/dist/alert-QMs0PqMq.js +1 -0
- package/dist/alert-center.d.ts +449 -0
- package/dist/alert-center.js +1 -0
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +1 -288
- package/dist/alert.js +1 -1
- package/dist/{anchor-DfeXTpKW.js → anchor-DvbNsphX.js} +1 -1
- package/dist/anchor.js +1 -1
- package/dist/app-layout.d.ts +483 -0
- package/dist/app-layout.js +1 -0
- package/dist/area-chart.d.ts +4 -3
- package/dist/area-chart.js +1 -1
- package/dist/badge.js +1 -1
- package/dist/bar-chart.d.ts +4 -3
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only-CmEEzfU3.js +1 -0
- package/dist/browser-only.js +1 -1
- package/dist/{button-D9n09xUg.js → button-BO2CKsz6.js} +1 -1
- package/dist/{button-DjpEKt2X.js → button-BUospUB3.js} +1 -1
- package/dist/{button-BAno7KIU.js → button-C0S8RbaJ.js} +1 -1
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +9 -9
- package/dist/centered-layout.js +1 -1
- package/dist/{chart-BcOC6Qj0.d.ts → chart-1cVjAcj8.d.ts} +81 -22
- package/dist/chart-DdBQ3xwx.js +2 -0
- package/dist/checkbox.d.ts +12 -0
- package/dist/{choice-BHwFSSyv.js → choice-C9gLKECf.js} +1 -1
- package/dist/choice.js +1 -1
- package/dist/code-block.d.ts +46 -0
- package/dist/code-block.js +1 -1
- package/dist/code.js +1 -1
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +67 -9
- package/dist/command.js +1 -1
- package/dist/{copy-to-clipboard-BsCQ9m6K.js → copy-to-clipboard-B4UB6pts.js} +1 -1
- package/dist/data-slot-EM6s2WEU.js +1 -0
- package/dist/data-table.d.ts +1 -1
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +36 -16
- package/dist/description-list.js +1 -1
- package/dist/{dialog-DWZWd5Jt.js → dialog-Bsj_dX6r.js} +1 -1
- package/dist/dialog.d.ts +1 -1
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-BbbQuae2.d.ts +1 -0
- package/dist/{dropdown-menu-DZg-Cd69.d.ts → dropdown-menu-D6pMAY7I.d.ts} +138 -0
- package/dist/dropdown-menu-fUMqjRC0.js +1 -0
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.js +1 -1
- package/dist/field.d.ts +12 -9
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +1 -1
- package/dist/hooks.js +1 -1
- package/dist/{icons-DLCs1hLP.js → icons-CPbOq7cF.js} +1 -1
- package/dist/icons.d.ts +52 -1
- package/dist/icons.js +1 -1
- package/dist/input.js +1 -1
- package/dist/line-chart.d.ts +4 -3
- package/dist/line-chart.js +1 -1
- package/dist/{list-51KQvENW.js → list-CQFWx6Z8.js} +1 -1
- package/dist/list.js +1 -1
- package/dist/llms.txt +4 -1
- package/dist/main.d.ts +4 -1
- package/dist/main.js +1 -1
- package/dist/mantle.css +21 -1
- package/dist/media-object.d.ts +42 -0
- package/dist/media-object.js +1 -1
- package/dist/multi-select.d.ts +10 -2
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +6 -7
- package/dist/pagination.js +1 -1
- package/dist/{primitive-trJDqIXJ.js → primitive-Dv-3snU3.js} +1 -1
- package/dist/progress.d.ts +8 -8
- package/dist/qr-code.js +1 -1
- package/dist/radio-group.d.ts +129 -0
- package/dist/radio-group.js +1 -1
- package/dist/sandboxed-on-click.d.ts +2 -2
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot.d.ts +4 -3
- package/dist/scatter-plot.js +1 -1
- package/dist/{select-BCHWvmyC.js → select-B-9yWrif.js} +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-bpE_kooz.js → separator-BepAcFFy.js} +1 -1
- package/dist/separator.js +1 -1
- package/dist/sheet-_fXLjiq2.js +1 -0
- package/dist/sheet.d.ts +11 -11
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +2084 -0
- package/dist/sidebar.js +1 -0
- package/dist/{skeleton-CsbUHbBA.js → skeleton-DsHXIa9j.js} +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slot-Dpsqz16D.js +1 -0
- package/dist/slot.js +1 -1
- package/dist/split-button.d.ts +147 -8
- package/dist/split-button.js +1 -1
- package/dist/{table-Bo0vNxIJ.d.ts → table-CZBYEmyK.d.ts} +2 -2
- package/dist/table.d.ts +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +1 -1
- package/dist/{theme-CYNpplwN.d.ts → theme-FbfjYiD3.d.ts} +16 -0
- package/dist/{theme-C26-Xolp.js → theme-IAnQ35bd.js} +1 -1
- package/dist/theme-switcher.d.ts +2 -2
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +42 -2
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +4 -0
- package/dist/toast.js +1 -1
- package/dist/types.js +1 -1
- package/dist/use-breakpoint-Wd7_5-Mu.js +1 -0
- package/dist/use-copy-to-clipboard-CSyp4Zk0.js +1 -0
- package/dist/use-is-hydrated-DDCqXmju.js +1 -0
- package/dist/{use-prefers-reduced-motion-CagaNRgm.js → use-prefers-reduced-motion-Bk5zAfHY.js} +1 -1
- package/dist/utils.js +1 -1
- package/dist/well.js +1 -1
- package/package.json +18 -15
- package/dist/browser-only-CPH56Xw_.js +0 -1
- package/dist/chart-BROa2gqt.js +0 -2
- package/dist/dropdown-menu-Dw-OtXPm.d.ts +0 -1
- package/dist/dropdown-menu-RyDWoKHx.js +0 -1
- package/dist/slot-CDk0Bb9z.js +0 -1
- package/dist/use-copy-to-clipboard-DqQ0_N3E.js +0 -1
package/dist/field.d.ts
CHANGED
|
@@ -372,6 +372,17 @@ declare const Optional: ({ asChild, children, className, ref, ...props }: Compon
|
|
|
372
372
|
* ```
|
|
373
373
|
*/
|
|
374
374
|
declare const Group: ({ asChild, className, ref, ...props }: ComponentProps<"div"> & WithAsChild) => import("react").JSX.Element;
|
|
375
|
+
/**
|
|
376
|
+
* Props for `Field.Item`.
|
|
377
|
+
*/
|
|
378
|
+
type FieldItemProps = ComponentProps<"div"> & WithAsChild & WithValidation & {
|
|
379
|
+
/**
|
|
380
|
+
* Form-value name for the field. Required so `Field.Control` can splat
|
|
381
|
+
* it onto the focusable child while `Field.Item` owns the stable
|
|
382
|
+
* generated control id used by `Field.Label`'s `htmlFor`.
|
|
383
|
+
*/
|
|
384
|
+
name: string;
|
|
385
|
+
};
|
|
375
386
|
/**
|
|
376
387
|
* A single form field — `Label`, a control (`Input`, `Select`, `Checkbox`,
|
|
377
388
|
* etc.), and any `Field.Description`, `Field.Errors`, or `Field.ErrorList` siblings stacked
|
|
@@ -416,14 +427,6 @@ declare const Group: ({ asChild, className, ref, ...props }: ComponentProps<"div
|
|
|
416
427
|
* </Field.Group>
|
|
417
428
|
* ```
|
|
418
429
|
*/
|
|
419
|
-
type FieldItemProps = ComponentProps<"div"> & WithAsChild & WithValidation & {
|
|
420
|
-
/**
|
|
421
|
-
* Form-value name for the field. Required so `Field.Control` can splat
|
|
422
|
-
* it onto the focusable child while `Field.Item` owns the stable
|
|
423
|
-
* generated control id used by `Field.Label`'s `htmlFor`.
|
|
424
|
-
*/
|
|
425
|
-
name: string;
|
|
426
|
-
};
|
|
427
430
|
declare const Item: ({ asChild, children, className, name, ref, validation: validationProp, ...props }: FieldItemProps) => import("react").JSX.Element;
|
|
428
431
|
type FieldControlSlotProps = Omit<ComponentProps<typeof Slot>, "aria-describedby" | "aria-errormessage" | "aria-invalid" | "children">;
|
|
429
432
|
/**
|
|
@@ -874,7 +877,7 @@ declare const Field: {
|
|
|
874
877
|
* opt out (e.g. when the focusable element is rendered outside of
|
|
875
878
|
* `Field.Control`).
|
|
876
879
|
*
|
|
877
|
-
* @see https://mantle.ngrok.com/components/forms/
|
|
880
|
+
* @see https://mantle.ngrok.com/components/forms/field#fieldlabel
|
|
878
881
|
*
|
|
879
882
|
* @example
|
|
880
883
|
* ```tsx
|
package/dist/field.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./slot-
|
|
1
|
+
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./slot-Dpsqz16D.js";import{t as r}from"./button-C0S8RbaJ.js";import{i,n as a,r as o,t as s}from"./field-Bpptk_9t.js";import{n as c,r as l,t as u}from"./field-B1wqeZr4.js";import{t as d}from"./label-D-D11mlp.js";import{t as f}from"./popover-CQ9s7jG5.js";import{Children as p,Fragment as m,cloneElement as h,isValidElement as g,useCallback as _,useContext as v,useId as y,useMemo as b,useState as x}from"react";import S from"tiny-invariant";import{jsx as C}from"react/jsx-runtime";import{QuestionIcon as w}from"@phosphor-icons/react/Question";const T=e=>{let t=[],n=new Set;for(let r of e??[]){if(typeof r!=`string`)continue;let e=r.trim();e.length===0||n.has(e)||(n.add(e),t.push(e))}return t},E=e=>!(e==null||typeof e==`boolean`||typeof e==`string`&&e.trim().length===0),D=({children:e,errorItemType:t})=>{let n=!1;return p.forEach(e,e=>{if(!(n||e==null||typeof e==`boolean`)){if(typeof e==`string`){e.trim().length>0&&(n=!0);return}if(!g(e)){n=!0;return}if(e.type===t){n=E(e.props.children);return}if(e.type===m){n=D({children:e.props.children,errorItemType:t});return}n=!0}}),n},O=({className:e,ref:n,...r})=>C(`fieldset`,{ref:n,"data-slot":`field-set`,className:t(`flex w-full min-w-0 flex-col gap-4 border-0 p-0`,e),...r}),k=({className:e,ref:n,...r})=>C(`legend`,{ref:n,"data-slot":`field-legend`,className:t(`text-strong mb-1.5 text-sm font-medium font-sans`,e),...r}),A=({htmlFor:e,ref:t,...n})=>{let r=v(c);return C(d,{ref:t,htmlFor:e??r?.controlId,...n})},j=({asChild:e,className:r,ref:i,...a})=>C(e?n:`p`,{ref:i,"data-slot":`field-label-text`,className:t(`text-strong text-sm font-medium font-sans`,r),...a}),M=({asChild:e,className:r,ref:i,...a})=>C(e?n:`div`,{ref:i,"data-slot":`field-label-row`,className:t(`flex items-center gap-1`,r),...a}),N=f.Root,P=C(w,{}),F=({appearance:e=`ghost`,className:n,icon:i=P,intent:a=`neutral`,label:o,ref:s,size:c=`xs`,type:l=`button`,...u})=>C(f.Trigger,{asChild:!0,children:C(r,{ref:s,appearance:e,className:t(`text-body -my-0.5`,n),icon:i,intent:a,label:o,size:c,type:l,...u})}),I=({ref:e,...t})=>C(f.Content,{ref:e,"data-slot":`field-help-content`,...t}),L=({asChild:e,children:r,className:i,ref:a,...o})=>C(e?n:`span`,{ref:a,"data-slot":`field-optional`,className:t(`text-muted text-sm font-normal font-sans`,i),...o,children:r??`(Optional)`}),R=({asChild:e,className:r,ref:i,...a})=>C(e?n:`div`,{ref:i,"data-slot":`field-group`,className:t(`flex w-full flex-col gap-4`,r),...a}),z=({asChild:e,children:r,className:a,name:o,ref:l,validation:u,...d})=>{let f=e?n:`div`,p=y(),m=y(),h=y(),[g,v]=x(!1),S=i(u??(g?`error`:void 0)),w=_(()=>(v(!0),()=>{v(!1)}),[]),T=b(()=>({controlId:p,descriptionId:m,errorId:h,hasErrors:g,name:o,registerError:w,validation:S}),[p,m,h,g,o,w,S]);return C(c.Provider,{value:T,children:C(s,{validation:S,children:C(f,{ref:l,"data-slot":`field-item`,"data-validation":S,className:t(`flex w-full flex-col gap-1.5`,a),...d,children:r})})})},B=({children:e,ref:t,...r})=>{let i=v(c),a=l({context:i});return typeof e==`function`?C(s,{validation:a.validation,children:C(u.Provider,{value:i?a.ariaProps:null,children:e(a.ariaProps)})}):(S(g(e),`Field.Control expects a single React element child (or a render-prop function). Got a non-element value (string, array, fragment, null, or undefined). Wrap the control in a single element, or use the function child form: <Field.Control>{(props) => <YourControl {...props} />}</Field.Control>.`),C(s,{validation:a.validation,children:C(u.Provider,{value:i?a.ariaProps:null,children:C(n,{ref:t,...r,children:h(e,a.ariaProps)})})}))},V=({asChild:e,className:r,ref:i,...a})=>C(e?n:`p`,{ref:i,"data-slot":`field-description`,id:v(c)?.descriptionId,className:t(`text-body text-sm leading-4`,`[:where([data-slot=field-error-list]+&)]:-mt-1.5`,r),...a}),H=({children:e,className:n,ref:r,...i})=>E(e)?C(`li`,{ref:r,"data-slot":`field-error`,className:t(`text-danger-600 text-sm leading-4`,n),...i,children:e}):null,U=({messages:e,ref:t,...n})=>C(W,{ref:t,...n,children:T(e).map(e=>C(H,{children:e},e))}),W=({asChild:r,children:i,className:a,ref:o,...s})=>{let l=D({children:i,errorItemType:H}),u=v(c),d=u?.registerError;return e(()=>{if(!(!l||d==null))return d()},[l,d]),l?C(r?n:`ul`,{ref:o,"data-slot":`field-error-list`,id:u?.errorId,role:`list`,className:t(`m-0 flex w-full flex-col list-none p-0`,a),...s,children:i}):null},G={Item:z,Control:B,Group:R,Set:O,Legend:k,Label:A,LabelText:j,LabelRow:M,Help:N,HelpTrigger:F,HelpContent:I,Optional:L,Description:V,Errors:U,ErrorList:W,ErrorItem:H},K=e=>T(e?.map(e=>typeof e==`string`||!e?e:e.message));export{G as Field,a as isAriaInvalid,o as parseValidation,i as resolveValidation,K as toErrorMessages};
|
package/dist/flag.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ type Props = Omit<ComponentProps<"div">, "children"> & {
|
|
|
57
57
|
* **Loading.** Defaults to `loading="lazy"`. Use `loading="eager"` for flags
|
|
58
58
|
* above the fold or in critical content.
|
|
59
59
|
*
|
|
60
|
-
* @see https://mantle.ngrok.com/components/data-display/flag
|
|
60
|
+
* @see https://mantle.ngrok.com/components/data-display/flag
|
|
61
61
|
*
|
|
62
62
|
* @example
|
|
63
63
|
* ```tsx
|
package/dist/hooks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{n as t}from"./compose-refs-BdBMM9ga.js";import{
|
|
1
|
+
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{n as t}from"./compose-refs-BdBMM9ga.js";import{t as n}from"./use-is-hydrated-DDCqXmju.js";import{t as r}from"./use-copy-to-clipboard-CSyp4Zk0.js";import{t as i}from"./use-matches-media-query-CMSxHR9n.js";import{n as a,t as o}from"./use-prefers-reduced-motion-Bk5zAfHY.js";import{i as s,n as c,r as l,t as u}from"./use-breakpoint-Wd7_5-Mu.js";import{t as d}from"./in-view-C2DpZ6s0.js";import{useCallback as f,useEffect as p,useMemo as m,useReducer as h,useRef as g,useState as _,useSyncExternalStore as v}from"react";function y(e,t){let[n,r]=_(e);return p(()=>{let n=window.setTimeout(()=>{r(e)},t.waitMs);return()=>{window.clearTimeout(n)}},[e,t.waitMs]),n}function b(e,t){let n=s(e),r=g(0);return p(()=>()=>window.clearTimeout(r.current),[]),f((...e)=>{window.clearTimeout(r.current),r.current=window.setTimeout(()=>n(...e),t.waitMs)},[n,t.waitMs])}function x(e){return function(t){function n(n){let r=n.storageArea==null||n.storageArea===window.localStorage,i=n.key==null||n.key===e;r&&i&&t()}return window.addEventListener(`storage`,n),()=>{window.removeEventListener(`storage`,n)}}}function S(){return null}function C(e,t){try{let n=JSON.parse(e);return typeof n==`string`?n:t}catch{return t}}function w(e,t){let n=v(m(()=>x(e),[e]),()=>window.localStorage.getItem(e),S);return[n==null?t:C(n,t),f(t=>{let n=JSON.stringify(t);window.localStorage.setItem(e,n),window.dispatchEvent(new StorageEvent(`storage`,{key:e,newValue:n,storageArea:window.localStorage}))},[e])]}function T(e){return function(t){function n(n){let r=n.storageArea==null||n.storageArea===window.sessionStorage,i=n.key==null||n.key===e;r&&i&&t()}return window.addEventListener(`storage`,n),()=>{window.removeEventListener(`storage`,n)}}}function E(){return null}function D(e,t){try{let n=JSON.parse(e);return typeof n==`string`?n:t}catch{return t}}function O(e,t){let n=v(m(()=>T(e),[e]),()=>window.sessionStorage.getItem(e),E);return[n==null?t:D(n,t),f(t=>{let n=JSON.stringify(t);window.sessionStorage.setItem(e,n),window.dispatchEvent(new StorageEvent(`storage`,{key:e,newValue:n,storageArea:window.sessionStorage}))},[e])]}function k(){let e=a();return m(()=>e?`auto`:`smooth`,[e])}function A(e,{root:t,margin:n,amount:r,once:i=!1,initial:a=!1}={}){let[o,s]=_(a);return p(()=>{if(!e.current||i&&o)return;function a(){return s(!0),i?void 0:()=>s(!1)}let c={root:t&&t.current||void 0,margin:n,amount:r};return d(e.current,a,c)},[t,e,n,i,r]),o}function j(){let e=g([]),t=g([]),[,n]=h(e=>e+1,0),r=f(r=>{e.current.push(r),t.current=[],n()},[]),i=f(r=>{let i=e.current[e.current.length-1];if(i!==void 0)return e.current.pop(),t.current.push(r),n(),i},[]),a=f(r=>{let i=t.current[t.current.length-1];if(i!==void 0)return t.current.pop(),e.current.push(r),n(),i},[]),o=e.current.length>0,s=t.current.length>0;return m(()=>({canUndo:o,canRedo:s,push:r,undo:i,redo:a}),[o,s,r,i,a])}export{u as breakpoints,o as getPrefersReducedMotion,c as useBreakpoint,s as useCallbackRef,t as useComposedRefs,r as useCopyToClipboard,y as useDebounce,b as useDebouncedCallback,A as useInView,l as useIsBelowBreakpoint,n as useIsHydrated,e as useIsomorphicLayoutEffect,w as useLocalStorage,i as useMatchesMediaQuery,a as usePrefersReducedMotion,k as useScrollBehavior,O as useSessionStorage,j as useUndoRedo};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./theme-
|
|
1
|
+
import{s as e}from"./theme-IAnQ35bd.js";import{jsx as t}from"react/jsx-runtime";import{DesktopIcon as n}from"@phosphor-icons/react/Desktop";import{MoonIcon as r}from"@phosphor-icons/react/Moon";import{SunIcon as i}from"@phosphor-icons/react/Sun";function a(n){return t(o,{theme:e(),...n})}function o({theme:e,...a}){switch(e){case`system`:return t(n,{...a});case`light`:return t(i,{...a});case`dark`:return t(r,{...a});case`light-high-contrast`:return t(i,{...a,weight:`fill`});case`dark-high-contrast`:return t(r,{...a,weight:`fill`})}}export{o as n,a as t};
|
package/dist/icons.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as SvgAttributes } from "./icon-D1RY5Tcj.js";
|
|
2
2
|
import { a as AlphanumericSortingDirection, c as TimeSortingDirection, o as SortingDirection, s as SortingMode } from "./direction-BjU0bPST.js";
|
|
3
|
-
import { i as Theme } from "./theme-
|
|
3
|
+
import { i as Theme } from "./theme-FbfjYiD3.js";
|
|
4
4
|
import { ComponentProps } from "react";
|
|
5
5
|
//#region src/components/icons/sort.d.ts
|
|
6
6
|
type Props = SvgAttributes & ({
|
|
@@ -23,12 +23,26 @@ type Props = SvgAttributes & ({
|
|
|
23
23
|
/**
|
|
24
24
|
* A sorting icon that can be used to indicate the sorting direction of a table column or list.
|
|
25
25
|
* It is aware of the sorting mode (alphanumeric or time) and the sorting direction (ascending or descending).
|
|
26
|
+
*
|
|
27
|
+
* @see https://mantle.ngrok.com/components/data-display/icons
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <SortIcon mode="time" direction="newest-to-oldest" />
|
|
32
|
+
* ```
|
|
26
33
|
*/
|
|
27
34
|
declare const SortIcon: ({ mode, direction, ...props }: Props) => import("react").JSX.Element;
|
|
28
35
|
//#endregion
|
|
29
36
|
//#region src/components/icons/traffic-policy-file.d.ts
|
|
30
37
|
/**
|
|
31
38
|
* An icon representing a traffic policy file.
|
|
39
|
+
*
|
|
40
|
+
* @see https://mantle.ngrok.com/components/data-display/icons
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <TrafficPolicyFileIcon className="size-5" />
|
|
45
|
+
* ```
|
|
32
46
|
*/
|
|
33
47
|
declare function TrafficPolicyFileIcon(props: SvgAttributes): import("react").JSX.Element;
|
|
34
48
|
//#endregion
|
|
@@ -39,6 +53,13 @@ declare function TrafficPolicyFileIcon(props: SvgAttributes): import("react").JS
|
|
|
39
53
|
* - `dark`: MoonIcon
|
|
40
54
|
* - `light-high-contrast`: SunIcon (fill)
|
|
41
55
|
* - `dark-high-contrast`: MoonIcon (fill)
|
|
56
|
+
*
|
|
57
|
+
* @see https://mantle.ngrok.com/components/data-display/icons
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <AutoThemeIcon className="size-5" />
|
|
62
|
+
* ```
|
|
42
63
|
*/
|
|
43
64
|
declare function AutoThemeIcon(props: SvgAttributes): import("react").JSX.Element;
|
|
44
65
|
type ThemeIconProps = SvgAttributes & {
|
|
@@ -52,12 +73,28 @@ type ThemeIconProps = SvgAttributes & {
|
|
|
52
73
|
* - `dark`: MoonIcon
|
|
53
74
|
* - `light-high-contrast`: SunIcon (fill)
|
|
54
75
|
* - `dark-high-contrast`: MoonIcon (fill)
|
|
76
|
+
*
|
|
77
|
+
* @see https://mantle.ngrok.com/components/data-display/icons
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* <ThemeIcon theme="system" />
|
|
82
|
+
* ```
|
|
55
83
|
*/
|
|
56
84
|
declare function ThemeIcon({ theme, ...props }: ThemeIconProps): import("react").JSX.Element;
|
|
57
85
|
//#endregion
|
|
58
86
|
//#region src/components/icons/types.d.ts
|
|
59
87
|
/**
|
|
60
88
|
* Props for an inline svg icon.
|
|
89
|
+
*
|
|
90
|
+
* @see https://mantle.ngrok.com/components/data-display/icons
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```tsx
|
|
94
|
+
* function BrandIcon(props: InlineIconProps) {
|
|
95
|
+
* return <svg {...props} />;
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
61
98
|
*/
|
|
62
99
|
type InlineIconProps = Omit<ComponentProps<"svg">, "xmlns" | "fill" | "viewBox" | "color" | "children"> & {
|
|
63
100
|
/**
|
|
@@ -72,10 +109,24 @@ type InlineIconProps = Omit<ComponentProps<"svg">, "xmlns" | "fill" | "viewBox"
|
|
|
72
109
|
//#region src/components/icons/ngrok.d.ts
|
|
73
110
|
/**
|
|
74
111
|
* An inline svg icon that renders the ngrok wordmark logo. Fill color is determined by the `color` CSS property.
|
|
112
|
+
*
|
|
113
|
+
* @see https://mantle.ngrok.com/components/data-display/icons
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```tsx
|
|
117
|
+
* <NgrokWordmarkIcon />
|
|
118
|
+
* ```
|
|
75
119
|
*/
|
|
76
120
|
declare function NgrokWordmarkIcon(props: Omit<InlineIconProps, "color">): import("react").JSX.Element;
|
|
77
121
|
/**
|
|
78
122
|
* An inline svg icon that renders the ngrok lettermark "n" logo. Fill color is determined by the `color` CSS property.
|
|
123
|
+
*
|
|
124
|
+
* @see https://mantle.ngrok.com/components/data-display/icons
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```tsx
|
|
128
|
+
* <NgrokLettermarkIcon />
|
|
129
|
+
* ```
|
|
79
130
|
*/
|
|
80
131
|
declare function NgrokLettermarkIcon(props: Omit<InlineIconProps, "color">): import("react").JSX.Element;
|
|
81
132
|
//#endregion
|
package/dist/icons.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./icons-CF1lbWtp.js";import{t}from"./icons-B_DDQcVD.js";import{n,t as r}from"./icons-
|
|
1
|
+
import{t as e}from"./icons-CF1lbWtp.js";import{t}from"./icons-B_DDQcVD.js";import{n,t as r}from"./icons-CPbOq7cF.js";import{jsx as i}from"react/jsx-runtime";function a(e){return i(`svg`,{fill:`currentColor`,height:`1em`,viewBox:`0 0 94 36`,width:`2.61em`,...e,children:i(`path`,{d:`M32.272 12.011c-1.298-1.466-2.904-2.205-4.812-2.205-1.176 0-2.26.233-3.255.7a7.995 7.995 0 0 0-2.581 1.906 9.205 9.205 0 0 0-1.715 2.853 9.773 9.773 0 0 0-.628 3.546c0 1.25.194 2.39.58 3.419.362.98.918 1.877 1.635 2.636A7.543 7.543 0 0 0 24 26.584c.965.41 2.025.617 3.176.617.522 0 1.005-.041 1.445-.116.439-.075.858-.2 1.26-.37.4-.175.79-.398 1.18-.664.385-.27.792-.612 1.21-1.018v4.353h-.005v.421h-5.33l-4.005 4.64v.798h15.037v-24.98h-5.697v1.746Zm-.014 7.979a4.25 4.25 0 0 1-.786 1.215 3.555 3.555 0 0 1-2.592 1.1 3.627 3.627 0 0 1-1.464-.292 3.508 3.508 0 0 1-1.166-.808 3.93 3.93 0 0 1-1.054-2.72c0-.519.097-1.006.298-1.457a3.77 3.77 0 0 1 .804-1.181 4.114 4.114 0 0 1 1.162-.808 3.484 3.484 0 0 1 2.817-.016c.448.19.844.463 1.181.81.336.347.6.743.804 1.194.202.452.298.95.298 1.493 0 .505-.104 1.005-.302 1.47m-16.261-7.708a6.173 6.173 0 0 0-2.06-1.602 4.875 4.875 0 0 0-.57-.22 6.383 6.383 0 0 0-.923-.216H8.383L5.697 13.39v-3.082H.002v16.61h5.695V15.712h5.35l.444-.01v11.214h5.697V16.528c0-.885-.084-1.674-.25-2.366a4.655 4.655 0 0 0-.941-1.877zm38.367-2.018h-6.213l-2.47 2.863v-2.864h-5.7v16.61h5.71l.004-11.117h4.144l4.526-5.26zm31.051 7.672 7.79-7.392v-.281H85.7l-5.975 5.991V0h-5.696v26.87h5.696v-6.766l6.262 6.763h7.663v-.316l-8.233-8.617zm-16.11-5.78a9.436 9.436 0 0 0-3.085-1.842 10.953 10.953 0 0 0-3.855-.664c-1.407 0-2.705.226-3.884.678a9.611 9.611 0 0 0-3.072 1.858 8.488 8.488 0 0 0-2.016 2.788 8.281 8.281 0 0 0-.722 3.449c0 1.362.24 2.596.722 3.707a8.52 8.52 0 0 0 2.002 2.862c.85.798 1.86 1.415 3.036 1.847 1.177.432 2.455.647 3.842.647 1.406 0 2.707-.215 3.919-.647 1.204-.431 2.24-1.04 3.098-1.833a8.583 8.583 0 0 0 2.031-2.816c.493-1.09.742-2.29.742-3.611 0-1.316-.244-2.52-.722-3.612a8.424 8.424 0 0 0-2.035-2.81Zm-3.558 7.864c-.2.461-.463.869-.786 1.215a3.573 3.573 0 0 1-2.592 1.1c-.502 0-.981-.096-1.434-.291a3.44 3.44 0 0 1-1.16-.809 4.155 4.155 0 0 1-.788-1.215 3.825 3.825 0 0 1-.297-1.537c0-.517.098-1.004.297-1.456.201-.451.46-.849.787-1.194a3.579 3.579 0 0 1 2.597-1.1c.502 0 .98.096 1.43.29.448.19.839.461 1.16.81.328.345.586.752.786 1.214.2.461.297.954.297 1.471 0 .538-.096 1.04-.297 1.502`})})}function o(e){return i(`svg`,{fill:`currentColor`,height:`1em`,viewBox:`0 0 32 32`,width:`1em`,...e,children:i(`path`,{d:`M27.2 6.18a9.47 9.47 0 0 0-3.12-2.5A9.42 9.42 0 0 0 21.82 3h-6.14l-4.06 4.9V3.1H3V29h8.62V11.53h8.09l.67-.02v17.48H29V12.8c0-1.37-.13-2.6-.38-3.68a7.35 7.35 0 0 0-1.42-2.93Z`})})}export{r as AutoThemeIcon,o as NgrokLettermarkIcon,a as NgrokWordmarkIcon,t as SortIcon,n as ThemeIcon,e as TrafficPolicyFileIcon};
|
package/dist/input.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./icon-lZ48P8Nn.js";import{n as t,t as n}from"./input-BnlpQF0c.js";import{t as r}from"./use-prefers-reduced-motion-
|
|
1
|
+
import{t as e}from"./icon-lZ48P8Nn.js";import{n as t,t as n}from"./input-BnlpQF0c.js";import{t as r}from"./use-prefers-reduced-motion-Bk5zAfHY.js";import{t as i}from"./input-CXmS0OFN.js";import{useEffect as a,useRef as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{flushSync as u}from"react-dom";import{EyeIcon as d}from"@phosphor-icons/react/Eye";import{EyeClosedIcon as f}from"@phosphor-icons/react/EyeClosed";const p=({onValueVisibilityChange:i,ref:p,showValue:m=!1,...h})=>{let[g,_]=s(m),v=g?`text`:`password`,y=g?d:f,b=o(null),x=o(null);return a(()=>{_(m)},[m]),l(n,{"data-slot":`password-input`,type:v,ref:p,...h,children:[c(t,{}),l(`button`,{type:`button`,tabIndex:-1,className:`text-body hover:text-strong ml-1 cursor-pointer bg-inherit p-0`,onClick:()=>{x.current&&=(x.current.cancel(),null);let e=!g;u(()=>{_(e)}),i?.(e);let t=b.current;t&&!r()&&(x.current=t.animate([{transform:`scaleY(0)`},{transform:`scaleY(1)`}],{duration:200,easing:`ease-out`}),x.current.onfinish=()=>{x.current=null})},children:[l(`span`,{className:`sr-only`,children:[`Turn password visibility `,g?`off`:`on`]}),c(e,{ref:b,svg:c(y,{"aria-hidden":!0})})]})]})};export{n as Input,t as InputCapture,p as PasswordInput,i as isInput};
|
package/dist/line-chart.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { _ as SeriesColor, a as LegendPrimitiveProps, c as XAxisPrimitiveProps, f as ChartDatum, g as PointShape, h as CurveKind, i as GridPrimitiveProps, l as YAxisPrimitiveProps, m as ContinuousXScale, n as ChartRootBaseProps, o as ReferenceLinePrimitiveProps, p as ChartDatumEvent, r as CopyButtonPrimitiveProps, s as TooltipPrimitiveProps, t as
|
|
1
|
+
import { _ as SeriesColor, a as LegendPrimitiveProps, c as XAxisPrimitiveProps, f as ChartDatum, g as PointShape, h as CurveKind, i as GridPrimitiveProps, l as YAxisPrimitiveProps, m as ContinuousXScale, n as ChartRootBaseProps, o as ReferenceLinePrimitiveProps, p as ChartDatumEvent, r as CopyButtonPrimitiveProps, s as TooltipPrimitiveProps, t as ChartAccessibilityProps } from "./chart-1cVjAcj8.js";
|
|
2
2
|
//#region src/components/line-chart/line-chart.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Props for {@link LineChart.Root}. Lines encode value by vertical position,
|
|
5
5
|
* not length from a baseline, so the full y domain stays overridable via
|
|
6
6
|
* `yDomain` — and lines never stack, so there is no `stacked` prop.
|
|
7
7
|
*/
|
|
8
|
-
type LineChartRootProps<TDatum extends ChartDatum = ChartDatum> = Omit<ChartRootBaseProps, "stacked"> &
|
|
8
|
+
type LineChartRootProps<TDatum extends ChartDatum = ChartDatum> = Omit<ChartRootBaseProps, "stacked"> & ChartAccessibilityProps & {
|
|
9
9
|
/** Rows of data; each `LineChart.Line` reads one numeric key per row. */
|
|
10
10
|
data: readonly TDatum[];
|
|
11
11
|
/** The key of each row's x value. */
|
|
@@ -292,7 +292,8 @@ declare const CopyButton: (props: LineChartCopyButtonProps) => import("react").J
|
|
|
292
292
|
* ├── LineChart.Line (one per series)
|
|
293
293
|
* ├── LineChart.ReferenceLine
|
|
294
294
|
* ├── LineChart.Tooltip
|
|
295
|
-
*
|
|
295
|
+
* ├── LineChart.Legend
|
|
296
|
+
* └── LineChart.CopyButton
|
|
296
297
|
* ```
|
|
297
298
|
*
|
|
298
299
|
* @example
|
package/dist/line-chart.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-DdBQ3xwx.js";import{jsx as l}from"react/jsx-runtime";const u={Root:e=>l(o,{kind:`line`,componentName:`LineChart`,slotName:`line-chart`,...e}),Line:e=>a(`LineChart.Line`,`line`,e),Grid:e=>n(`LineChart.Grid`,e),XAxis:e=>t(`LineChart.XAxis`,e),YAxis:e=>r(`LineChart.YAxis`,e),ReferenceLine:t=>e(`LineChart.ReferenceLine`,t),Tooltip:e=>s(`LineChart.Tooltip`,e),Legend:e=>l(i,{partName:`LineChart.Legend`,slotName:`line-chart`,...e}),CopyButton:e=>l(c,{partName:`LineChart.CopyButton`,slotName:`line-chart`,...e})};export{u as LineChart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./slot-
|
|
1
|
+
import{n as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./slot-Dpsqz16D.js";import{Children as r,createContext as i,isValidElement as a,useCallback as o,useContext as s,useEffect as c,useId as l,useMemo as u,useRef as d,useState as f}from"react";import p from"tiny-invariant";import{jsx as m}from"react/jsx-runtime";import{useVirtualizer as h}from"@tanstack/react-virtual";const g=i(null);function _(e){let t=s(g);return p(t,`List.${e} must be composed inside List.Root / List.VirtualRoot (or a SelectableList viewport).`),t}const v=i(null),y=i(null);function b(e){return a(e)?e.props.disabled===!0:!1}function x({start:e,step:t,count:n,isItemDisabled:r}){for(let i=e;i>=0&&i<n;i+=t)if(!r(i))return i;return-1}const S=`a[href]:not([tabindex="-1"]), button:not(:disabled):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])`;function C(e){let t=e.matches(S)?e:e.querySelector(S);return t instanceof HTMLElement?t:null}function w(e){let t=e instanceof Element?e.closest(`[data-index]`):null;if(t==null)return null;let n=Number(t.getAttribute(`data-index`));return!Number.isInteger(n)||n<0?null:{item:t,index:n}}function T(e,t){if(!(e instanceof Element))return!1;let n=e.closest(`a[href], button, input, select, textarea, label, [role="button"], [role="link"], [role="menuitem"], [contenteditable="true"]`);return n!=null&&t.contains(n)}function E({count:e,isItemDisabled:t,focusItemAt:n}){return{onKeyDown:r=>{if(r.target instanceof HTMLElement&&(r.target.isContentEditable||r.target.tagName===`INPUT`||r.target.tagName===`TEXTAREA`||r.target.tagName===`SELECT`)||r.altKey||r.ctrlKey||r.metaKey)return;let i=w(r.target);if(i==null)return;let a=-1,o=1;switch(r.key){case`ArrowDown`:o=1,a=x({start:i.index+1,step:o,count:e,isItemDisabled:t});break;case`ArrowUp`:o=-1,a=x({start:i.index-1,step:o,count:e,isItemDisabled:t});break;case`Home`:o=1,a=x({start:0,step:o,count:e,isItemDisabled:t});break;case`End`:o=-1,a=x({start:e-1,step:o,count:e,isItemDisabled:t});break;default:return}r.preventDefault(),a>=0&&a!==i.index&&n(a,o)}}}function D({count:e,enabled:t,isItemDisabled:n,onActivate:r,itemId:i,scrollToIndex:a}){let[o,s]=f(-1),l=d(!1),u=o>=e?e-1:o;if(c(()=>{o>=e&&s(e-1)},[o,e]),!t)return{activeIndex:-1,collectionProps:{}};let p=e=>n?.(e)??!1,m=(t,n)=>x({start:t,step:n,count:e,isItemDisabled:p}),h=e=>{e<0||(s(e),a(e))};return{activeIndex:u,collectionProps:{tabIndex:0,"aria-activedescendant":u>=0?i(u):void 0,onMouseDown:e=>{let t=w(e.target);if(t!=null&&!p(t.index)){s(t.index),l.current=!1;return}l.current=!0},onClick:e=>{if(e.defaultPrevented)return;let t=w(e.target);t==null||p(t.index)||T(e.target,t.item)||(s(t.index),r?.(t.index))},onFocus:t=>{if(t.target!==t.currentTarget){let e=w(t.target);e!=null&&!p(e.index)&&s(e.index),t.target instanceof HTMLElement&&t.target.tabIndex>=0||t.currentTarget.focus({preventScroll:!0}),l.current=!1;return}let n=l.current;l.current=!1,e>0&&!n&&s(e=>e<0?m(0,1):e)},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(s(-1),l.current=!1)},onKeyDown:t=>{if(t.target===t.currentTarget&&!(t.altKey||t.ctrlKey||t.metaKey))switch(l.current=!1,t.key){case`ArrowDown`:t.preventDefault(),h(m(u<0?0:u+1,1));break;case`ArrowUp`:t.preventDefault(),h(u<0?m(0,1):m(u-1,-1));break;case`Home`:t.preventDefault(),h(m(0,1));break;case`End`:t.preventDefault(),h(m(e-1,-1));break;case` `:case`Enter`:!t.repeat&&u>=0&&!p(u)&&(t.preventDefault(),r?.(u));break;default:break}}}}}function O({count:e,focusItemAt:t,isItemDisabled:n,onActivate:r,itemId:i,scrollToIndex:a,semantics:o}){let s=l(),c=u(()=>({semantics:o}),[o]),d=u(()=>i??(e=>`${s}-item-${e}`),[i,s]),{activeIndex:f,collectionProps:p}=D({count:e,enabled:o===`grid`,isItemDisabled:n,onActivate:r,itemId:d,scrollToIndex:a}),m=u(()=>({activeIndex:f,stampItemId:i==null?d:null}),[f,d,i]);return{collectionProps:o===`list`?E({count:e,isItemDisabled:n,focusItemAt:t}):p,gridNav:m,listContext:c}}function k({"aria-label":e,"aria-labelledby":n,"aria-multiselectable":r,children:i,className:a,collectionProps:o,gridNav:s,listContext:c,viewportProps:l,ref:u}){return m(g.Provider,{value:c,children:m(y.Provider,{value:s,children:m(`div`,{ref:u,"data-slot":`list`,className:t(`border-popover bg-popover scrollbar overscroll-none overflow-x-hidden overflow-y-auto rounded-md border p-1`,a),...l,children:m(`div`,{"data-slot":`list-collection`,role:c.semantics===`grid`?`grid`:`list`,"aria-label":e,"aria-labelledby":n,"aria-multiselectable":r,className:`relative flex w-full flex-col gap-px outline-hidden`,...o,children:i})})})})}const A=({asChild:r,children:i,className:a,disabled:o=!1,ref:c,selected:l=!1,style:u,...d})=>{let{semantics:f}=_(`Item`),p=s(v),h=s(y),g=f===`grid`,b=r?n:`div`,x=p?.placement??null,S=p?.index,C=g&&h!=null&&S!=null&&h.activeIndex===S;return m(b,{ref:e(c,x?.measureRef??null),"data-slot":`list-item`,...d,id:g&&S!=null&&h?.stampItemId!=null?h.stampItemId(S):d.id,"data-index":S,"data-state":l?`selected`:`unselected`,"data-disabled":o||void 0,"data-active":C||void 0,role:g?`row`:`listitem`,"aria-selected":g?l:void 0,"aria-disabled":g&&o?!0:d[`aria-disabled`],"aria-rowindex":g?x?.posInSet:void 0,"aria-posinset":g?void 0:x?.posInSet,"aria-setsize":g?void 0:x?.setSize,className:t(`rounded-md data-[state=selected]:bg-selected-menu-item data-[active]:bg-active-menu-item data-[active]:data-[state=selected]:bg-active-selected-menu-item`,!o&&`hover:bg-active-menu-item hover:data-[state=selected]:bg-active-selected-menu-item`,!g&&!o&&`has-[:focus-visible]:bg-active-menu-item has-[:focus-visible]:data-[state=selected]:bg-active-selected-menu-item`,a),style:x?{...u,...x.style}:u,children:i})};function j({children:e,index:t}){let n=u(()=>({index:t,placement:null}),[t]);return m(v.Provider,{value:n,children:e})}const M=({"aria-label":t,"aria-labelledby":n,"aria-multiselectable":i,children:s,className:c,isItemDisabled:l,onActivate:f,itemId:p,ref:h,semantics:g=`list`,..._})=>{let v=d(null),y=e(v,h),x=u(()=>r.toArray(s).filter(a),[s]),S=o(e=>{v.current?.querySelector(`[data-index="${e}"]`)?.scrollIntoView({block:`nearest`})},[]),w=o((e,t)=>{let n=v.current;if(n!=null)for(let r=e;r>=0&&r<x.length;r+=t){let e=n.querySelector(`[data-index="${r}"]`);if(e==null)continue;let t=C(e);if(t!=null){t.focus({preventScroll:!0}),e.scrollIntoView({block:`nearest`});return}}},[x.length]),{collectionProps:T,gridNav:E,listContext:D}=O({count:x.length,focusItemAt:w,isItemDisabled:l??(e=>b(x[e])),onActivate:f,itemId:p,scrollToIndex:S,semantics:g});return m(k,{"aria-label":t,"aria-labelledby":n,"aria-multiselectable":i,className:c,collectionProps:T,gridNav:E,listContext:D,viewportProps:_,ref:y,children:x.map((e,t)=>m(j,{index:t,children:e},e.key??t))})};function N({virtualItem:e,count:t,measureRef:n}){return{posInSet:e.index+1,setSize:t,measureRef:n,style:{position:`absolute`,left:0,top:0,width:`100%`,transform:`translateY(${e.start}px)`}}}function P({children:e,count:t,measureRef:n,virtualItem:r}){let i=u(()=>({index:r.index,placement:N({virtualItem:r,count:t,measureRef:n})}),[r,t,n]);return m(v.Provider,{value:i,children:e})}const F=({"aria-label":t,"aria-labelledby":n,"aria-multiselectable":i,children:s,className:l,estimateItemHeight:f=44,isItemDisabled:p,onActivate:g,overscan:_=8,itemId:v,ref:y,semantics:x=`list`,...S})=>{let w=d(null),T=e(w,y),E=u(()=>r.toArray(s).filter(a),[s]),D=E.length,A=h({count:D,getScrollElement:()=>w.current,estimateSize:()=>f,getItemKey:e=>E[e]?.key??e,overscan:_,gap:1}),j=o(e=>A.scrollToIndex(e,{align:`auto`}),[A]),M=d(null);c(()=>()=>{M.current!=null&&cancelAnimationFrame(M.current)},[]);let{collectionProps:N,gridNav:F,listContext:I}=O({count:D,focusItemAt:o((e,t)=>{M.current!=null&&(cancelAnimationFrame(M.current),M.current=null);let n=e,r=0,i=()=>{M.current=null;let e=w.current;if(e==null||n<0||n>=D)return;A.scrollToIndex(n,{align:`auto`});let a=e.querySelector(`[data-index="${n}"]`);if(a!=null){let e=C(a);if(e!=null){e.focus({preventScroll:!0});return}n+=t,r=0}r+=1,r<10&&(M.current=requestAnimationFrame(i))};i()},[D,A]),isItemDisabled:p??(e=>b(E[e])),onActivate:g,itemId:v,scrollToIndex:j,semantics:x}),L=A.getVirtualItems(),R=L.some(e=>e.index===F.activeIndex);return m(k,{"aria-label":t,"aria-labelledby":n,"aria-multiselectable":i,className:l,collectionProps:{...N,"aria-activedescendant":R?N[`aria-activedescendant`]:void 0,"aria-rowcount":x===`grid`?D:void 0,style:{height:`${A.getTotalSize()}px`}},gridNav:F,listContext:I,viewportProps:S,ref:T,children:L.map(e=>{let t=E[e.index];return t==null?null:m(P,{virtualItem:e,count:D,measureRef:A.measureElement,children:t},e.key)})})};export{A as n,M as r,F as t};
|
package/dist/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-Dpsqz16D.js";import{n,r,t as i}from"./list-CQFWx6Z8.js";import{jsx as a}from"react/jsx-runtime";const o={Root:e=>a(r,{semantics:`list`,...e}),VirtualRoot:e=>a(i,{semantics:`list`,...e}),Item:({asChild:r,className:i,current:o,disabled:s,onClick:c,ref:l,...u})=>a(n,{selected:o,disabled:s,children:a(r?t:`button`,{ref:l,"data-slot":`list-item-control`,"aria-current":o||void 0,...r?{"aria-disabled":s||void 0,tabIndex:s?-1:void 0}:{type:`button`,disabled:s},onClick:e=>{if(r&&s){e.preventDefault(),e.stopPropagation();return}c?.(e)},className:e(`flex w-full cursor-pointer flex-col gap-0.5 rounded-md bg-transparent px-2 py-1.5 text-left text-sm`,`disabled:cursor-default disabled:opacity-50 aria-disabled:cursor-default aria-disabled:opacity-50 aria-disabled:pointer-events-none`,`focus-visible:outline-hidden`,i),...u,onClickCapture:r&&s?e=>{e.preventDefault(),e.stopPropagation()}:u.onClickCapture})}),ItemTitle:({className:t,ref:n,...r})=>a(`span`,{ref:n,"data-slot":`list-item-title`,className:e(`text-strong font-medium`,t),...r}),ItemDescription:({className:t,ref:n,...r})=>a(`span`,{ref:n,"data-slot":`list-item-description`,className:e(`text-body leading-4`,t),...r})};export{o as List};
|
package/dist/llms.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @ngrok/mantle (0.
|
|
1
|
+
# @ngrok/mantle (0.82.0)
|
|
2
2
|
|
|
3
3
|
> Offline discovery hint shipped inside the @ngrok/mantle npm package. Authoritative metadata lives at https://mantle.ngrok.com/for-ai-agents.
|
|
4
4
|
|
|
@@ -21,8 +21,10 @@ Full text: https://mantle.ngrok.com/llms-full.txt
|
|
|
21
21
|
|
|
22
22
|
- `@ngrok/mantle/accordion`
|
|
23
23
|
- `@ngrok/mantle/alert`
|
|
24
|
+
- `@ngrok/mantle/alert-center`
|
|
24
25
|
- `@ngrok/mantle/alert-dialog`
|
|
25
26
|
- `@ngrok/mantle/anchor`
|
|
27
|
+
- `@ngrok/mantle/app-layout`
|
|
26
28
|
- `@ngrok/mantle/area-chart`
|
|
27
29
|
- `@ngrok/mantle/badge`
|
|
28
30
|
- `@ngrok/mantle/bar-chart`
|
|
@@ -72,6 +74,7 @@ Full text: https://mantle.ngrok.com/llms-full.txt
|
|
|
72
74
|
- `@ngrok/mantle/selectable-list`
|
|
73
75
|
- `@ngrok/mantle/separator`
|
|
74
76
|
- `@ngrok/mantle/sheet`
|
|
77
|
+
- `@ngrok/mantle/sidebar`
|
|
75
78
|
- `@ngrok/mantle/skeleton`
|
|
76
79
|
- `@ngrok/mantle/skip-to-main-link`
|
|
77
80
|
- `@ngrok/mantle/slider`
|
package/dist/main.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
1
2
|
import { ComponentProps } from "react";
|
|
2
3
|
//#region src/components/main/main.d.ts
|
|
3
4
|
/**
|
|
@@ -7,6 +8,8 @@ import { ComponentProps } from "react";
|
|
|
7
8
|
* a visible focus ring on the region itself (`focus:outline-hidden`).
|
|
8
9
|
*
|
|
9
10
|
* Pair with the `<SkipToMainLink>` component at the top of the document.
|
|
11
|
+
* `ref` lands on the rendered `<main>`, so it also composes as an `asChild`
|
|
12
|
+
* child of layout parts (e.g. `AppLayout.Content asChild`).
|
|
10
13
|
*
|
|
11
14
|
* @see https://mantle.ngrok.com/components/primitives/main
|
|
12
15
|
*
|
|
@@ -19,6 +22,6 @@ import { ComponentProps } from "react";
|
|
|
19
22
|
* </Main>
|
|
20
23
|
* ```
|
|
21
24
|
*/
|
|
22
|
-
declare const Main: ({ className, ...props }: ComponentProps<"main">) => import("react").JSX.Element;
|
|
25
|
+
declare const Main: ({ className, "data-slot": dataSlot, ...props }: ComponentProps<"main"> & WithDataSlot) => import("react").JSX.Element;
|
|
23
26
|
//#endregion
|
|
24
27
|
export { Main };
|
package/dist/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{jsx as
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./data-slot-EM6s2WEU.js";import{jsx as n}from"react/jsx-runtime";const r=({className:r,"data-slot":i,...a})=>n(`main`,{...a,"data-slot":t(i,`main`),id:`main`,tabIndex:-1,className:e(`focus:outline-hidden`,r)});export{r as Main};
|
package/dist/mantle.css
CHANGED
|
@@ -366,7 +366,7 @@ MARK: LIGHT DEFS
|
|
|
366
366
|
/* Chart series tokens — light picks validated against the white card surface:
|
|
367
367
|
worst adjacent CVD ΔE 14.0 (target ≥ 8), normal-vision floor 15.7 (≥ 15),
|
|
368
368
|
all slots ≥ 3:1 contrast. Semantic ramps (sky/emerald/rose/amber/purple) are
|
|
369
|
-
deliberately excluded so a series never
|
|
369
|
+
deliberately excluded so a series never reads as a status color. */
|
|
370
370
|
--color-chart-1: var(--color-blue-500);
|
|
371
371
|
--color-chart-2: var(--color-green-700);
|
|
372
372
|
--color-chart-3: var(--color-pink-500);
|
|
@@ -412,6 +412,26 @@ MARK: LIGHT DEFS
|
|
|
412
412
|
--bg-indeterminate-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath fill='white' d='M4 8c0-.55228.44772-1 1-1h6c.5523 0 1 .44772 1 1s-.4477 1-1 1H5c-.55228 0-1-.44772-1-1Z'/%3e%3c/svg%3e");
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
+
/**
|
|
416
|
+
MARK: COMPONENT GEOMETRY
|
|
417
|
+
*/
|
|
418
|
+
/* Geometry a component publishes for surfaces that render OUTSIDE it.
|
|
419
|
+
`--sidebar-row-width` is the width of one row inside an expanded `Sidebar`
|
|
420
|
+
panel — `--sidebar-width` minus the row gutter every sidebar region applies
|
|
421
|
+
(`px-3` plus the expanded `pr-1` on Sidebar.Header/Body/Footer = 1rem). A
|
|
422
|
+
switcher's menu renders in a portal on `document.body`, so it inherits
|
|
423
|
+
nothing the sidebar sets; declaring the row width here is what lets such a
|
|
424
|
+
menu stay as wide as the expanded row while the panel is collapsed to the
|
|
425
|
+
icon rail (`min-w-(--sidebar-row-width)` on the menu content). Resolved at
|
|
426
|
+
`:root`, so a per-sidebar `--sidebar-width` override set on `Sidebar.Nav`
|
|
427
|
+
does not reach it in either direction — a narrower panel leaves the floor
|
|
428
|
+
wider than its row. Override `--sidebar-width` here to move both (and
|
|
429
|
+
`--sidebar-width-mobile` with it, or the floor outgrows the sheet's row),
|
|
430
|
+
or set `--sidebar-row-width` on the outside surface itself. */
|
|
431
|
+
:root {
|
|
432
|
+
--sidebar-row-width: calc(var(--sidebar-width, 16rem) - 1rem);
|
|
433
|
+
}
|
|
434
|
+
|
|
415
435
|
/**
|
|
416
436
|
MARK: CUSTOM VARIANTS
|
|
417
437
|
*/
|
package/dist/media-object.d.ts
CHANGED
|
@@ -6,14 +6,56 @@ type Props = ComponentProps<"div"> & WithAsChild;
|
|
|
6
6
|
* The media object is an image/icon (media) to the left, with descriptive
|
|
7
7
|
* content (title and subtitle/description) to the right. This is the root
|
|
8
8
|
* component of the media object.
|
|
9
|
+
*
|
|
10
|
+
* @see https://mantle.ngrok.com/components/structure/media-object#mediaobjectroot
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <MediaObject.Root>
|
|
15
|
+
* <MediaObject.Media>
|
|
16
|
+
* <ExampleMedia />
|
|
17
|
+
* </MediaObject.Media>
|
|
18
|
+
* <MediaObject.Content>
|
|
19
|
+
* <p>Ea culpa id id ea minim labore.</p>
|
|
20
|
+
* </MediaObject.Content>
|
|
21
|
+
* </MediaObject.Root>
|
|
22
|
+
* ```
|
|
9
23
|
*/
|
|
10
24
|
declare const Root: ({ asChild, className, children, style, ref }: Props) => import("react").JSX.Element;
|
|
11
25
|
/**
|
|
12
26
|
* The container for an image or icon to display in the media slot of the media object.
|
|
27
|
+
*
|
|
28
|
+
* @see https://mantle.ngrok.com/components/structure/media-object#mediaobjectmedia
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <MediaObject.Root>
|
|
33
|
+
* <MediaObject.Media>
|
|
34
|
+
* <ExampleMedia />
|
|
35
|
+
* </MediaObject.Media>
|
|
36
|
+
* <MediaObject.Content>
|
|
37
|
+
* <p>Ea culpa id id ea minim labore.</p>
|
|
38
|
+
* </MediaObject.Content>
|
|
39
|
+
* </MediaObject.Root>
|
|
40
|
+
* ```
|
|
13
41
|
*/
|
|
14
42
|
declare const Media: ({ asChild, className, children, style, ref }: Props) => import("react").JSX.Element;
|
|
15
43
|
/**
|
|
16
44
|
* The container for the content slot of a media object.
|
|
45
|
+
*
|
|
46
|
+
* @see https://mantle.ngrok.com/components/structure/media-object#mediaobjectcontent
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <MediaObject.Root>
|
|
51
|
+
* <MediaObject.Media>
|
|
52
|
+
* <ExampleMedia />
|
|
53
|
+
* </MediaObject.Media>
|
|
54
|
+
* <MediaObject.Content>
|
|
55
|
+
* <p>Ea culpa id id ea minim labore.</p>
|
|
56
|
+
* </MediaObject.Content>
|
|
57
|
+
* </MediaObject.Root>
|
|
58
|
+
* ```
|
|
17
59
|
*/
|
|
18
60
|
declare const Content: ({ asChild, className, children, style, ref }: Props) => import("react").JSX.Element;
|
|
19
61
|
/**
|
package/dist/media-object.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-Dpsqz16D.js";import{jsx as n}from"react/jsx-runtime";const r={Root:({asChild:r=!1,className:i,children:a,style:o,ref:s})=>n(r?t:`div`,{ref:s,"data-slot":`media-object`,className:e(`flex gap-4`,i),style:o,children:a}),Media:({asChild:r=!1,className:i,children:a,style:o,ref:s})=>n(r?t:`div`,{ref:s,"data-slot":`media-object-media`,className:e(`shrink-0 leading-none`,i),style:o,children:a}),Content:({asChild:r=!1,className:i,children:a,style:o,ref:s})=>n(r?t:`div`,{ref:s,"data-slot":`media-object-content`,className:e(`min-w-0 flex-1`,i),style:o,children:a})};export{r as MediaObject};
|
package/dist/multi-select.d.ts
CHANGED
|
@@ -14,9 +14,12 @@ type MultiSelectProps = Primitive.ComboboxProviderProps<string[]>;
|
|
|
14
14
|
* or Select (without).
|
|
15
15
|
*
|
|
16
16
|
* When composing with `Field.Item`, wrap `MultiSelect.Root` in `Field.Control`.
|
|
17
|
-
* `Field.Control` flows the generated `id`, `
|
|
17
|
+
* `Field.Control` flows the generated `id`, `aria-describedby`,
|
|
18
18
|
* `aria-errormessage`, and `aria-invalid` through to the focusable
|
|
19
|
-
* `MultiSelect.Input` via `FieldControlContext`.
|
|
19
|
+
* `MultiSelect.Input` via `FieldControlContext`. The field `name` flows through
|
|
20
|
+
* too, but lands on one hidden input per selected value rather than on the
|
|
21
|
+
* combobox input — so a native form submit sends the selected values, not the
|
|
22
|
+
* typeahead filter text.
|
|
20
23
|
*
|
|
21
24
|
* `MultiSelect.Content` renders at Tailwind `z-50`, Mantle's shared floating
|
|
22
25
|
* z-index. When multiple shared layers are open, the most recently mounted
|
|
@@ -177,6 +180,11 @@ type MultiSelectInputProps = Omit<Primitive.ComboboxProps, "render"> & {
|
|
|
177
180
|
* `id`, `aria-invalid`, `aria-describedby`, and `aria-errormessage` flow onto
|
|
178
181
|
* the input here via `FieldControlContext`.
|
|
179
182
|
*
|
|
183
|
+
* A `name` — passed directly or flowed from `Field.Control` — is not set on this
|
|
184
|
+
* input. Its value is the typeahead filter text, so naming it would submit what
|
|
185
|
+
* the user typed. The name is applied to one hidden input per selected value
|
|
186
|
+
* instead, which is what a native form submit sends.
|
|
187
|
+
*
|
|
180
188
|
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectinput
|
|
181
189
|
*
|
|
182
190
|
* @example
|
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-CDk0Bb9z.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-bpE_kooz.js";import{t as c}from"./use-prefers-reduced-motion-CagaNRgm.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();break}};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-Dpsqz16D.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-BepAcFFy.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();break}};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};
|
package/dist/otp-input.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-Dpsqz16D.js";import{t as n}from"./types-D85fCNV3.js";import{a as r,r as i}from"./field-Bpptk_9t.js";import{t as a}from"./field-B1wqeZr4.js";import{useContext as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{MinusIcon as l}from"@phosphor-icons/react/Minus";import{OTPInput as u,OTPInputContext as d,REGEXP_ONLY_CHARS as f,REGEXP_ONLY_DIGITS as p,REGEXP_ONLY_DIGITS_AND_CHARS as m}from"input-otp";const h={error:`danger`,success:`success`,warning:`warning`},g=e=>`var(--color-${e}-600)`,_=e=>`var(--ring-color-focus-${e})`,v=({totalActive:e,total:t})=>e===0?`idle`:e===1?`caret`:e===t?`all`:`range`,y=({children:e,validation:t})=>{let r=o(d),i=r.slots.length,a=r.slots.reduce((e,t)=>e+ +!!t.isActive,0),c=v({totalActive:a,total:i}),l=t?h[t]:void 0,u=l?n({"--otp-validation-border":g(l),"--otp-validation-ring":_(l)}):void 0;return s(`div`,{className:`group/otp contents`,"data-otp-state":c,"data-validation":t||void 0,style:u,children:e})},b={Root:({"aria-invalid":t,children:n,className:c,containerClassName:l,ref:d,validation:f,...p})=>{let m=r(),h=o(a),{ariaInvalid:g,validation:_}=i({"aria-invalid":t,defaultAriaInvalid:!1,validation:f??m});return s(u,{ref:d,"aria-invalid":g,"data-slot":`otp-input`,containerClassName:e(`flex items-center gap-2 has-disabled:opacity-50`,l),className:e(`disabled:cursor-not-allowed`,c),...p,...h?{"aria-describedby":h[`aria-describedby`],"aria-errormessage":h[`aria-errormessage`],id:h.id,name:h.name}:void 0,children:s(y,{validation:_,children:n})})},Group:({asChild:n,children:r,className:i,ref:a,...o})=>s(n?t:`div`,{ref:a,"data-slot":`otp-input-group`,className:e(`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)`,i),...o,children:r}),Slot:({className:t,index:n,ref:r,...i})=>{let a=o(d).slots[n],l=a?.char??null,u=a?.hasFakeCaret??!1;return c(`div`,{ref:r,"data-slot":`otp-input-slot`,"data-active":a?.isActive??!1?``:void 0,className:e(`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)`,t),...i,children:[l,u&&s(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:s(`div`,{className:`bg-strong h-4 w-px animate-pulse`})})]})},Separator:({asChild:n,children:r,className:i,ref:a,semantic:o=!1,...c})=>{let u=n?t:`div`,d=o?{role:`separator`}:{"aria-hidden":!0,role:`none`};return s(u,{ref:a,"data-slot":`otp-input-separator`,className:e(`text-separator flex items-center`,i),...d,...c,children:r??s(l,{weight:`bold`})})}};export{b as OtpInput,f as REGEXP_ONLY_CHARS,p as REGEXP_ONLY_DIGITS,m as REGEXP_ONLY_DIGITS_AND_CHARS};
|