@purpurds/chip-group
Advanced tools
Comparing version 5.13.0 to 5.14.0
@@ -1,6 +0,6 @@ | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),o=require("react");require("react-dom");function ye(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const c=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,c.get?c:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const X=ye(o);function xe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ee={exports:{}};/*! | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),o=require("react");require("react-dom");function ye(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const c=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,c.get?c:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const W=ye(o);function xe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ee={exports:{}};/*! | ||
Copyright (c) 2018 Jed Watson. | ||
Licensed under the MIT License (MIT), see | ||
http://jedwatson.github.io/classnames | ||
*/(function(e){(function(){var r={}.hasOwnProperty;function n(){for(var t="",a=0;a<arguments.length;a++){var s=arguments[a];s&&(t=u(t,c(s)))}return t}function c(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t!="object")return"";if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var a="";for(var s in t)r.call(t,s)&&t[s]&&(a=u(a,s));return a}function u(t,a){return a?t?t+" "+a:t+a:t}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(ee);var Ee=ee.exports;const Ie=xe(Ee),R={"purpur-heading":"_purpur-heading_k9fhq_1","purpur-heading--hyphens":"_purpur-heading--hyphens_k9fhq_8","purpur-heading--negative":"_purpur-heading--negative_k9fhq_11","purpur-heading--subsection-100":"_purpur-heading--subsection-100_k9fhq_14","purpur-heading--title-100":"_purpur-heading--title-100_k9fhq_20","purpur-heading--title-200":"_purpur-heading--title-200_k9fhq_26","purpur-heading--title-300":"_purpur-heading--title-300_k9fhq_32","purpur-heading--title-400":"_purpur-heading--title-400_k9fhq_38","purpur-heading--title-500":"_purpur-heading--title-500_k9fhq_44","purpur-heading--title-600":"_purpur-heading--title-600_k9fhq_50","purpur-heading--title-700":"_purpur-heading--title-700_k9fhq_56","purpur-heading--display-25":"_purpur-heading--display-25_k9fhq_62","purpur-heading--display-50":"_purpur-heading--display-50_k9fhq_68","purpur-heading--display-100":"_purpur-heading--display-100_k9fhq_74","purpur-heading--display-200":"_purpur-heading--display-200_k9fhq_80"},Te={TITLE100:"title-100",TITLE200:"title-200",TITLE300:"title-300",TITLE400:"title-400",TITLE500:"title-500",TITLE600:"title-600",TITLE700:"title-700",SUBSECTION100:"subsection-100"},P="purpur-heading",te=({["data-testid"]:e,children:r,className:n="",enableHyphenation:c=!1,negative:u=!1,tag:t,variant:a=Te.TITLE100,...s})=>{const l=t,i=Ie([n,R[P],R[`${P}--${a}`],{[R[`${P}--hyphens`]]:c,[R[`${P}--negative`]]:u}]);return y.jsx(l,{...s,className:i,"data-testid":e,children:r})};te.displayName="Heading";function g(){return g=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var c in n)Object.prototype.hasOwnProperty.call(n,c)&&(e[c]=n[c])}return e},g.apply(this,arguments)}function B(e,r=[]){let n=[];function c(t,a){const s=o.createContext(a),l=n.length;n=[...n,a];function i(f){const{scope:p,children:v,...d}=f,h=(p==null?void 0:p[e][l])||s,_=o.useMemo(()=>d,Object.values(d));return o.createElement(h.Provider,{value:_},v)}function b(f,p){const v=(p==null?void 0:p[e][l])||s,d=o.useContext(v);if(d)return d;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${t}\``)}return i.displayName=t+"Provider",[i,b]}const u=()=>{const t=n.map(a=>o.createContext(a));return function(s){const l=(s==null?void 0:s[e])||t;return o.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return u.scopeName=e,[c,Se(u,...r)]}function Se(...e){const r=e[0];if(e.length===1)return r;const n=()=>{const c=e.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(t){const a=c.reduce((s,{useScope:l,scopeName:i})=>{const f=l(t)[`__scope${i}`];return{...s,...f}},{});return o.useMemo(()=>({[`__scope${r.scopeName}`]:a}),[a])}};return n.scopeName=r.scopeName,n}function we(e,r){typeof e=="function"?e(r):e!=null&&(e.current=r)}function ne(...e){return r=>e.forEach(n=>we(n,r))}function q(...e){return o.useCallback(ne(...e),e)}const k=o.forwardRef((e,r)=>{const{children:n,...c}=e,u=o.Children.toArray(n),t=u.find(Pe);if(t){const a=t.props.children,s=u.map(l=>l===t?o.Children.count(a)>1?o.Children.only(null):o.isValidElement(a)?a.props.children:null:l);return o.createElement(D,g({},c,{ref:r}),o.isValidElement(a)?o.cloneElement(a,void 0,s):null)}return o.createElement(D,g({},c,{ref:r}),n)});k.displayName="Slot";const D=o.forwardRef((e,r)=>{const{children:n,...c}=e;return o.isValidElement(n)?o.cloneElement(n,{...ke(c,n.props),ref:r?ne(r,n.ref):n.ref}):o.Children.count(n)>1?o.Children.only(null):null});D.displayName="SlotClone";const Re=({children:e})=>o.createElement(o.Fragment,null,e);function Pe(e){return o.isValidElement(e)&&e.type===Re}function ke(e,r){const n={...r};for(const c in r){const u=e[c],t=r[c];/^on[A-Z]/.test(c)?u&&t?n[c]=(...s)=>{t(...s),u(...s)}:u&&(n[c]=u):c==="style"?n[c]={...u,...t}:c==="className"&&(n[c]=[u,t].filter(Boolean).join(" "))}return{...e,...n}}const Fe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],S=Fe.reduce((e,r)=>{const n=o.forwardRef((c,u)=>{const{asChild:t,...a}=c,s=t?k:r;return o.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),o.createElement(s,g({},a,{ref:u}))});return n.displayName=`Primitive.${r}`,{...e,[r]:n}},{});function I(e,r,{checkForDefaultPrevented:n=!0}={}){return function(u){if(e==null||e(u),n===!1||!u.defaultPrevented)return r==null?void 0:r(u)}}function Ge(e){const r=e+"CollectionProvider",[n,c]=B(r),[u,t]=n(r,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:d,children:h}=v,_=o.useRef(null),$=o.useRef(new Map).current;return o.createElement(u,{scope:d,itemMap:$,collectionRef:_},h)},s=e+"CollectionSlot",l=o.forwardRef((v,d)=>{const{scope:h,children:_}=v,$=t(s,h),m=q(d,$.collectionRef);return o.createElement(k,{ref:m},_)}),i=e+"CollectionItemSlot",b="data-radix-collection-item",f=o.forwardRef((v,d)=>{const{scope:h,children:_,...$}=v,m=o.useRef(null),w=q(d,m),x=t(i,h);return o.useEffect(()=>(x.itemMap.set(m,{ref:m,...$}),()=>void x.itemMap.delete(m))),o.createElement(k,{[b]:"",ref:w},_)});function p(v){const d=t(e+"CollectionConsumer",v);return o.useCallback(()=>{const _=d.collectionRef.current;if(!_)return[];const $=Array.from(_.querySelectorAll(`[${b}]`));return Array.from(d.itemMap.values()).sort((x,N)=>$.indexOf(x.ref.current)-$.indexOf(N.ref.current))},[d.collectionRef,d.itemMap])}return[{Provider:a,Slot:l,ItemSlot:f},p,c]}const Ne=globalThis!=null&&globalThis.document?o.useLayoutEffect:()=>{},Oe=X.useId||(()=>{});let Ae=0;function Me(e){const[r,n]=X.useState(Oe());return Ne(()=>{n(c=>c??String(Ae++))},[e]),r?`radix-${r}`:""}function U(e){const r=o.useRef(e);return o.useEffect(()=>{r.current=e}),o.useMemo(()=>(...n)=>{var c;return(c=r.current)===null||c===void 0?void 0:c.call(r,...n)},[])}function F({prop:e,defaultProp:r,onChange:n=()=>{}}){const[c,u]=je({defaultProp:r,onChange:n}),t=e!==void 0,a=t?e:c,s=U(n),l=o.useCallback(i=>{if(t){const f=typeof i=="function"?i(e):i;f!==e&&s(f)}else u(i)},[t,e,u,s]);return[a,l]}function je({defaultProp:e,onChange:r}){const n=o.useState(e),[c]=n,u=o.useRef(c),t=U(r);return o.useEffect(()=>{u.current!==c&&(t(c),u.current=c)},[c,u,t]),n}const qe=o.createContext(void 0);function re(e){const r=o.useContext(qe);return e||r||"ltr"}const A="rovingFocusGroup.onEntryFocus",De={bubbles:!1,cancelable:!0},K="RovingFocusGroup",[V,oe,Ve]=Ge(K),[Le,ce]=B(K,[Ve]),[Be,Ue]=Le(K),Ke=o.forwardRef((e,r)=>o.createElement(V.Provider,{scope:e.__scopeRovingFocusGroup},o.createElement(V.Slot,{scope:e.__scopeRovingFocusGroup},o.createElement(ze,g({},e,{ref:r}))))),ze=o.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:n,orientation:c,loop:u=!1,dir:t,currentTabStopId:a,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:i,...b}=e,f=o.useRef(null),p=q(r,f),v=re(t),[d=null,h]=F({prop:a,defaultProp:s,onChange:l}),[_,$]=o.useState(!1),m=U(i),w=oe(n),x=o.useRef(!1),[N,H]=o.useState(0);return o.useEffect(()=>{const C=f.current;if(C)return C.addEventListener(A,m),()=>C.removeEventListener(A,m)},[m]),o.createElement(Be,{scope:n,orientation:c,dir:v,loop:u,currentTabStopId:d,onItemFocus:o.useCallback(C=>h(C),[h]),onItemShiftTab:o.useCallback(()=>$(!0),[]),onFocusableItemAdd:o.useCallback(()=>H(C=>C+1),[]),onFocusableItemRemove:o.useCallback(()=>H(C=>C-1),[])},o.createElement(S.div,g({tabIndex:_||N===0?-1:0,"data-orientation":c},b,{ref:p,style:{outline:"none",...e.style},onMouseDown:I(e.onMouseDown,()=>{x.current=!0}),onFocus:I(e.onFocus,C=>{const he=!x.current;if(C.target===C.currentTarget&&he&&!_){const Y=new CustomEvent(A,De);if(C.currentTarget.dispatchEvent(Y),!Y.defaultPrevented){const O=w().filter(E=>E.focusable),ve=O.find(E=>E.active),_e=O.find(E=>E.id===d),Ce=[ve,_e,...O].filter(Boolean).map(E=>E.ref.current);ae(Ce)}}x.current=!1}),onBlur:I(e.onBlur,()=>$(!1))})))}),He="RovingFocusGroupItem",Ye=o.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:n,focusable:c=!0,active:u=!1,tabStopId:t,...a}=e,s=Me(),l=t||s,i=Ue(He,n),b=i.currentTabStopId===l,f=oe(n),{onFocusableItemAdd:p,onFocusableItemRemove:v}=i;return o.useEffect(()=>{if(c)return p(),()=>v()},[c,p,v]),o.createElement(V.ItemSlot,{scope:n,id:l,focusable:c,active:u},o.createElement(S.span,g({tabIndex:b?0:-1,"data-orientation":i.orientation},a,{ref:r,onMouseDown:I(e.onMouseDown,d=>{c?i.onItemFocus(l):d.preventDefault()}),onFocus:I(e.onFocus,()=>i.onItemFocus(l)),onKeyDown:I(e.onKeyDown,d=>{if(d.key==="Tab"&&d.shiftKey){i.onItemShiftTab();return}if(d.target!==d.currentTarget)return;const h=We(d,i.orientation,i.dir);if(h!==void 0){d.preventDefault();let $=f().filter(m=>m.focusable).map(m=>m.ref.current);if(h==="last")$.reverse();else if(h==="prev"||h==="next"){h==="prev"&&$.reverse();const m=$.indexOf(d.currentTarget);$=i.loop?Qe($,m+1):$.slice(m+1)}setTimeout(()=>ae($))}})})))}),Ze={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Je(e,r){return r!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function We(e,r,n){const c=Je(e.key,n);if(!(r==="vertical"&&["ArrowLeft","ArrowRight"].includes(c))&&!(r==="horizontal"&&["ArrowUp","ArrowDown"].includes(c)))return Ze[c]}function ae(e){const r=document.activeElement;for(const n of e)if(n===r||(n.focus(),document.activeElement!==r))return}function Qe(e,r){return e.map((n,c)=>e[(r+c)%e.length])}const Xe=Ke,et=Ye,tt=o.forwardRef((e,r)=>{const{pressed:n,defaultPressed:c=!1,onPressedChange:u,...t}=e,[a=!1,s]=F({prop:n,onChange:u,defaultProp:c});return o.createElement(S.button,g({type:"button","aria-pressed":a,"data-state":a?"on":"off","data-disabled":e.disabled?"":void 0},t,{ref:r,onClick:I(e.onClick,()=>{e.disabled||s(!a)})}))}),G="ToggleGroup",[ue,St]=B(G,[ce]),se=ce(),nt=o.forwardRef((e,r)=>{const{type:n,...c}=e;if(n==="single"){const u=c;return o.createElement(rt,g({},u,{ref:r}))}if(n==="multiple"){const u=c;return o.createElement(ot,g({},u,{ref:r}))}throw new Error(`Missing prop \`type\` expected on \`${G}\``)}),[ie,le]=ue(G),rt=o.forwardRef((e,r)=>{const{value:n,defaultValue:c,onValueChange:u=()=>{},...t}=e,[a,s]=F({prop:n,defaultProp:c,onChange:u});return o.createElement(ie,{scope:e.__scopeToggleGroup,type:"single",value:a?[a]:[],onItemActivate:s,onItemDeactivate:o.useCallback(()=>s(""),[s])},o.createElement(de,g({},t,{ref:r})))}),ot=o.forwardRef((e,r)=>{const{value:n,defaultValue:c,onValueChange:u=()=>{},...t}=e,[a=[],s]=F({prop:n,defaultProp:c,onChange:u}),l=o.useCallback(b=>s((f=[])=>[...f,b]),[s]),i=o.useCallback(b=>s((f=[])=>f.filter(p=>p!==b)),[s]);return o.createElement(ie,{scope:e.__scopeToggleGroup,type:"multiple",value:a,onItemActivate:l,onItemDeactivate:i},o.createElement(de,g({},t,{ref:r})))}),[ct,at]=ue(G),de=o.forwardRef((e,r)=>{const{__scopeToggleGroup:n,disabled:c=!1,rovingFocus:u=!0,orientation:t,dir:a,loop:s=!0,...l}=e,i=se(n),b=re(a),f={role:"group",dir:b,...l};return o.createElement(ct,{scope:n,rovingFocus:u,disabled:c},u?o.createElement(Xe,g({asChild:!0},i,{orientation:t,dir:b,loop:s}),o.createElement(S.div,g({},f,{ref:r}))):o.createElement(S.div,g({},f,{ref:r})))}),L="ToggleGroupItem",ut=o.forwardRef((e,r)=>{const n=le(L,e.__scopeToggleGroup),c=at(L,e.__scopeToggleGroup),u=se(e.__scopeToggleGroup),t=n.value.includes(e.value),a=c.disabled||e.disabled,s={...e,pressed:t,disabled:a},l=o.useRef(null);return c.rovingFocus?o.createElement(et,g({asChild:!0},u,{focusable:!a,active:t,ref:l}),o.createElement(Z,g({},s,{ref:r}))):o.createElement(Z,g({},s,{ref:r}))}),Z=o.forwardRef((e,r)=>{const{__scopeToggleGroup:n,value:c,...u}=e,t=le(L,n),a={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},s=t.type==="single"?a:void 0;return o.createElement(tt,g({},s,u,{ref:r,onPressedChange:l=>{l?t.onItemActivate(c):t.onItemDeactivate(c)}}))}),J=nt,st=ut;function it(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fe={exports:{}};/*! | ||
*/(function(e){(function(){var r={}.hasOwnProperty;function n(){for(var t="",a=0;a<arguments.length;a++){var s=arguments[a];s&&(t=u(t,c(s)))}return t}function c(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t!="object")return"";if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var a="";for(var s in t)r.call(t,s)&&t[s]&&(a=u(a,s));return a}function u(t,a){return a?t?t+" "+a:t+a:t}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(ee);var Ee=ee.exports;const Ie=xe(Ee),R={"purpur-heading":"_purpur-heading_k9fhq_1","purpur-heading--hyphens":"_purpur-heading--hyphens_k9fhq_8","purpur-heading--negative":"_purpur-heading--negative_k9fhq_11","purpur-heading--subsection-100":"_purpur-heading--subsection-100_k9fhq_14","purpur-heading--title-100":"_purpur-heading--title-100_k9fhq_20","purpur-heading--title-200":"_purpur-heading--title-200_k9fhq_26","purpur-heading--title-300":"_purpur-heading--title-300_k9fhq_32","purpur-heading--title-400":"_purpur-heading--title-400_k9fhq_38","purpur-heading--title-500":"_purpur-heading--title-500_k9fhq_44","purpur-heading--title-600":"_purpur-heading--title-600_k9fhq_50","purpur-heading--title-700":"_purpur-heading--title-700_k9fhq_56","purpur-heading--display-25":"_purpur-heading--display-25_k9fhq_62","purpur-heading--display-50":"_purpur-heading--display-50_k9fhq_68","purpur-heading--display-100":"_purpur-heading--display-100_k9fhq_74","purpur-heading--display-200":"_purpur-heading--display-200_k9fhq_80"},Te={TITLE100:"title-100",TITLE200:"title-200",TITLE300:"title-300",TITLE400:"title-400",TITLE500:"title-500",TITLE600:"title-600",TITLE700:"title-700",SUBSECTION100:"subsection-100"},P="purpur-heading",te=({["data-testid"]:e,children:r,className:n="",enableHyphenation:c=!1,negative:u=!1,tag:t,variant:a=Te.TITLE100,...s})=>{const l=t,i=Ie([n,R[P],R[`${P}--${a}`],{[R[`${P}--hyphens`]]:c,[R[`${P}--negative`]]:u}]);return y.jsx(l,{...s,className:i,"data-testid":e,children:r})};te.displayName="Heading";function g(){return g=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var c in n)Object.prototype.hasOwnProperty.call(n,c)&&(e[c]=n[c])}return e},g.apply(this,arguments)}function B(e,r=[]){let n=[];function c(t,a){const s=o.createContext(a),l=n.length;n=[...n,a];function i(f){const{scope:p,children:v,...d}=f,h=(p==null?void 0:p[e][l])||s,_=o.useMemo(()=>d,Object.values(d));return o.createElement(h.Provider,{value:_},v)}function b(f,p){const v=(p==null?void 0:p[e][l])||s,d=o.useContext(v);if(d)return d;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${t}\``)}return i.displayName=t+"Provider",[i,b]}const u=()=>{const t=n.map(a=>o.createContext(a));return function(s){const l=(s==null?void 0:s[e])||t;return o.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return u.scopeName=e,[c,Se(u,...r)]}function Se(...e){const r=e[0];if(e.length===1)return r;const n=()=>{const c=e.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(t){const a=c.reduce((s,{useScope:l,scopeName:i})=>{const f=l(t)[`__scope${i}`];return{...s,...f}},{});return o.useMemo(()=>({[`__scope${r.scopeName}`]:a}),[a])}};return n.scopeName=r.scopeName,n}function we(e,r){typeof e=="function"?e(r):e!=null&&(e.current=r)}function ne(...e){return r=>e.forEach(n=>we(n,r))}function q(...e){return o.useCallback(ne(...e),e)}const k=o.forwardRef((e,r)=>{const{children:n,...c}=e,u=o.Children.toArray(n),t=u.find(Pe);if(t){const a=t.props.children,s=u.map(l=>l===t?o.Children.count(a)>1?o.Children.only(null):o.isValidElement(a)?a.props.children:null:l);return o.createElement(D,g({},c,{ref:r}),o.isValidElement(a)?o.cloneElement(a,void 0,s):null)}return o.createElement(D,g({},c,{ref:r}),n)});k.displayName="Slot";const D=o.forwardRef((e,r)=>{const{children:n,...c}=e;return o.isValidElement(n)?o.cloneElement(n,{...ke(c,n.props),ref:r?ne(r,n.ref):n.ref}):o.Children.count(n)>1?o.Children.only(null):null});D.displayName="SlotClone";const Re=({children:e})=>o.createElement(o.Fragment,null,e);function Pe(e){return o.isValidElement(e)&&e.type===Re}function ke(e,r){const n={...r};for(const c in r){const u=e[c],t=r[c];/^on[A-Z]/.test(c)?u&&t?n[c]=(...s)=>{t(...s),u(...s)}:u&&(n[c]=u):c==="style"?n[c]={...u,...t}:c==="className"&&(n[c]=[u,t].filter(Boolean).join(" "))}return{...e,...n}}const Fe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],S=Fe.reduce((e,r)=>{const n=o.forwardRef((c,u)=>{const{asChild:t,...a}=c,s=t?k:r;return o.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),o.createElement(s,g({},a,{ref:u}))});return n.displayName=`Primitive.${r}`,{...e,[r]:n}},{});function I(e,r,{checkForDefaultPrevented:n=!0}={}){return function(u){if(e==null||e(u),n===!1||!u.defaultPrevented)return r==null?void 0:r(u)}}function Ne(e){const r=e+"CollectionProvider",[n,c]=B(r),[u,t]=n(r,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:d,children:h}=v,_=o.useRef(null),$=o.useRef(new Map).current;return o.createElement(u,{scope:d,itemMap:$,collectionRef:_},h)},s=e+"CollectionSlot",l=o.forwardRef((v,d)=>{const{scope:h,children:_}=v,$=t(s,h),m=q(d,$.collectionRef);return o.createElement(k,{ref:m},_)}),i=e+"CollectionItemSlot",b="data-radix-collection-item",f=o.forwardRef((v,d)=>{const{scope:h,children:_,...$}=v,m=o.useRef(null),w=q(d,m),x=t(i,h);return o.useEffect(()=>(x.itemMap.set(m,{ref:m,...$}),()=>void x.itemMap.delete(m))),o.createElement(k,{[b]:"",ref:w},_)});function p(v){const d=t(e+"CollectionConsumer",v);return o.useCallback(()=>{const _=d.collectionRef.current;if(!_)return[];const $=Array.from(_.querySelectorAll(`[${b}]`));return Array.from(d.itemMap.values()).sort((x,O)=>$.indexOf(x.ref.current)-$.indexOf(O.ref.current))},[d.collectionRef,d.itemMap])}return[{Provider:a,Slot:l,ItemSlot:f},p,c]}const Oe=globalThis!=null&&globalThis.document?o.useLayoutEffect:()=>{},Ge=W.useId||(()=>{});let Ae=0;function Me(e){const[r,n]=W.useState(Ge());return Oe(()=>{n(c=>c??String(Ae++))},[e]),r?`radix-${r}`:""}function U(e){const r=o.useRef(e);return o.useEffect(()=>{r.current=e}),o.useMemo(()=>(...n)=>{var c;return(c=r.current)===null||c===void 0?void 0:c.call(r,...n)},[])}function F({prop:e,defaultProp:r,onChange:n=()=>{}}){const[c,u]=je({defaultProp:r,onChange:n}),t=e!==void 0,a=t?e:c,s=U(n),l=o.useCallback(i=>{if(t){const f=typeof i=="function"?i(e):i;f!==e&&s(f)}else u(i)},[t,e,u,s]);return[a,l]}function je({defaultProp:e,onChange:r}){const n=o.useState(e),[c]=n,u=o.useRef(c),t=U(r);return o.useEffect(()=>{u.current!==c&&(t(c),u.current=c)},[c,u,t]),n}const qe=o.createContext(void 0);function re(e){const r=o.useContext(qe);return e||r||"ltr"}const A="rovingFocusGroup.onEntryFocus",De={bubbles:!1,cancelable:!0},K="RovingFocusGroup",[V,oe,Ve]=Ne(K),[Le,ce]=B(K,[Ve]),[Be,Ue]=Le(K),Ke=o.forwardRef((e,r)=>o.createElement(V.Provider,{scope:e.__scopeRovingFocusGroup},o.createElement(V.Slot,{scope:e.__scopeRovingFocusGroup},o.createElement(He,g({},e,{ref:r}))))),He=o.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:n,orientation:c,loop:u=!1,dir:t,currentTabStopId:a,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:i,...b}=e,f=o.useRef(null),p=q(r,f),v=re(t),[d=null,h]=F({prop:a,defaultProp:s,onChange:l}),[_,$]=o.useState(!1),m=U(i),w=oe(n),x=o.useRef(!1),[O,z]=o.useState(0);return o.useEffect(()=>{const C=f.current;if(C)return C.addEventListener(A,m),()=>C.removeEventListener(A,m)},[m]),o.createElement(Be,{scope:n,orientation:c,dir:v,loop:u,currentTabStopId:d,onItemFocus:o.useCallback(C=>h(C),[h]),onItemShiftTab:o.useCallback(()=>$(!0),[]),onFocusableItemAdd:o.useCallback(()=>z(C=>C+1),[]),onFocusableItemRemove:o.useCallback(()=>z(C=>C-1),[])},o.createElement(S.div,g({tabIndex:_||O===0?-1:0,"data-orientation":c},b,{ref:p,style:{outline:"none",...e.style},onMouseDown:I(e.onMouseDown,()=>{x.current=!0}),onFocus:I(e.onFocus,C=>{const he=!x.current;if(C.target===C.currentTarget&&he&&!_){const Y=new CustomEvent(A,De);if(C.currentTarget.dispatchEvent(Y),!Y.defaultPrevented){const G=w().filter(E=>E.focusable),ve=G.find(E=>E.active),_e=G.find(E=>E.id===d),Ce=[ve,_e,...G].filter(Boolean).map(E=>E.ref.current);ae(Ce)}}x.current=!1}),onBlur:I(e.onBlur,()=>$(!1))})))}),ze="RovingFocusGroupItem",Ye=o.forwardRef((e,r)=>{const{__scopeRovingFocusGroup:n,focusable:c=!0,active:u=!1,tabStopId:t,...a}=e,s=Me(),l=t||s,i=Ue(ze,n),b=i.currentTabStopId===l,f=oe(n),{onFocusableItemAdd:p,onFocusableItemRemove:v}=i;return o.useEffect(()=>{if(c)return p(),()=>v()},[c,p,v]),o.createElement(V.ItemSlot,{scope:n,id:l,focusable:c,active:u},o.createElement(S.span,g({tabIndex:b?0:-1,"data-orientation":i.orientation},a,{ref:r,onMouseDown:I(e.onMouseDown,d=>{c?i.onItemFocus(l):d.preventDefault()}),onFocus:I(e.onFocus,()=>i.onItemFocus(l)),onKeyDown:I(e.onKeyDown,d=>{if(d.key==="Tab"&&d.shiftKey){i.onItemShiftTab();return}if(d.target!==d.currentTarget)return;const h=Xe(d,i.orientation,i.dir);if(h!==void 0){d.preventDefault();let $=f().filter(m=>m.focusable).map(m=>m.ref.current);if(h==="last")$.reverse();else if(h==="prev"||h==="next"){h==="prev"&&$.reverse();const m=$.indexOf(d.currentTarget);$=i.loop?Qe($,m+1):$.slice(m+1)}setTimeout(()=>ae($))}})})))}),Je={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ze(e,r){return r!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Xe(e,r,n){const c=Ze(e.key,n);if(!(r==="vertical"&&["ArrowLeft","ArrowRight"].includes(c))&&!(r==="horizontal"&&["ArrowUp","ArrowDown"].includes(c)))return Je[c]}function ae(e){const r=document.activeElement;for(const n of e)if(n===r||(n.focus(),document.activeElement!==r))return}function Qe(e,r){return e.map((n,c)=>e[(r+c)%e.length])}const We=Ke,et=Ye,tt=o.forwardRef((e,r)=>{const{pressed:n,defaultPressed:c=!1,onPressedChange:u,...t}=e,[a=!1,s]=F({prop:n,onChange:u,defaultProp:c});return o.createElement(S.button,g({type:"button","aria-pressed":a,"data-state":a?"on":"off","data-disabled":e.disabled?"":void 0},t,{ref:r,onClick:I(e.onClick,()=>{e.disabled||s(!a)})}))}),N="ToggleGroup",[ue,St]=B(N,[ce]),se=ce(),nt=o.forwardRef((e,r)=>{const{type:n,...c}=e;if(n==="single"){const u=c;return o.createElement(rt,g({},u,{ref:r}))}if(n==="multiple"){const u=c;return o.createElement(ot,g({},u,{ref:r}))}throw new Error(`Missing prop \`type\` expected on \`${N}\``)}),[ie,le]=ue(N),rt=o.forwardRef((e,r)=>{const{value:n,defaultValue:c,onValueChange:u=()=>{},...t}=e,[a,s]=F({prop:n,defaultProp:c,onChange:u});return o.createElement(ie,{scope:e.__scopeToggleGroup,type:"single",value:a?[a]:[],onItemActivate:s,onItemDeactivate:o.useCallback(()=>s(""),[s])},o.createElement(de,g({},t,{ref:r})))}),ot=o.forwardRef((e,r)=>{const{value:n,defaultValue:c,onValueChange:u=()=>{},...t}=e,[a=[],s]=F({prop:n,defaultProp:c,onChange:u}),l=o.useCallback(b=>s((f=[])=>[...f,b]),[s]),i=o.useCallback(b=>s((f=[])=>f.filter(p=>p!==b)),[s]);return o.createElement(ie,{scope:e.__scopeToggleGroup,type:"multiple",value:a,onItemActivate:l,onItemDeactivate:i},o.createElement(de,g({},t,{ref:r})))}),[ct,at]=ue(N),de=o.forwardRef((e,r)=>{const{__scopeToggleGroup:n,disabled:c=!1,rovingFocus:u=!0,orientation:t,dir:a,loop:s=!0,...l}=e,i=se(n),b=re(a),f={role:"group",dir:b,...l};return o.createElement(ct,{scope:n,rovingFocus:u,disabled:c},u?o.createElement(We,g({asChild:!0},i,{orientation:t,dir:b,loop:s}),o.createElement(S.div,g({},f,{ref:r}))):o.createElement(S.div,g({},f,{ref:r})))}),L="ToggleGroupItem",ut=o.forwardRef((e,r)=>{const n=le(L,e.__scopeToggleGroup),c=at(L,e.__scopeToggleGroup),u=se(e.__scopeToggleGroup),t=n.value.includes(e.value),a=c.disabled||e.disabled,s={...e,pressed:t,disabled:a},l=o.useRef(null);return c.rovingFocus?o.createElement(et,g({asChild:!0},u,{focusable:!a,active:t,ref:l}),o.createElement(J,g({},s,{ref:r}))):o.createElement(J,g({},s,{ref:r}))}),J=o.forwardRef((e,r)=>{const{__scopeToggleGroup:n,value:c,...u}=e,t=le(L,n),a={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},s=t.type==="single"?a:void 0;return o.createElement(tt,g({},s,u,{ref:r,onPressedChange:l=>{l?t.onItemActivate(c):t.onItemDeactivate(c)}}))}),Z=nt,st=ut;function it(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fe={exports:{}};/*! | ||
Copyright (c) 2018 Jed Watson. | ||
@@ -13,3 +13,3 @@ Licensed under the MIT License (MIT), see | ||
http://jedwatson.github.io/classnames | ||
*/(function(e){(function(){var r={}.hasOwnProperty;function n(){for(var t="",a=0;a<arguments.length;a++){var s=arguments[a];s&&(t=u(t,c.call(this,s)))}return t}function c(t){if(typeof t=="string"||typeof t=="number")return this&&this[t]||t;if(typeof t!="object")return"";if(Array.isArray(t))return n.apply(this,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var a="";for(var s in t)r.call(t,s)&&t[s]&&(a=u(a,this&&this[s]||s));return a}function u(t,a){return a?t?t+" "+a:t+a:t}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(ge);var ft=ge.exports;const pt=dt(ft),bt={"purpur-icon":"_purpur-icon_8u1lq_1","purpur-icon--xxs":"_purpur-icon--xxs_8u1lq_4","purpur-icon--xs":"_purpur-icon--xs_8u1lq_8","purpur-icon--sm":"_purpur-icon--sm_8u1lq_12","purpur-icon--md":"_purpur-icon--md_8u1lq_16","purpur-icon--lg":"_purpur-icon--lg_8u1lq_20","purpur-icon--xl":"_purpur-icon--xl_8u1lq_24"},gt={name:"checkmark",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M21.06 3.795a.9.9 0 0 1 .145 1.264l-11.5 14.5a.9.9 0 0 1-1.341.077l-6-6a.9.9 0 0 1 1.272-1.272l5.286 5.286L19.795 3.94a.9.9 0 0 1 1.264-.145Z" clip-rule="evenodd"/></svg>',keywords:["checkmark"],category:"utility"},$e=e=>y.jsx(Ct,{...e,svg:gt});$e.displayName="IconCheckmark";const $t=pt.bind(bt),W="purpur-icon",mt="md",ht=e=>e.filter(r=>Object.keys(r).length>=1).map(r=>`${r.name}="${r.value}"`).join(" "),vt=({content:e="",title:r}={})=>{const n=[{name:"xmlns",value:"http://www.w3.org/2000/svg"},{name:"fill",value:"currentColor"},{name:"viewBox",value:"0 0 24 24"},r?{name:"role",value:"img"}:{name:"aria-hidden",value:"true"}],c=r?`<title>${r}</title>`:"";return`<svg ${ht(n)}>${c}${e}</svg>`},_t=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),Ct=({["data-testid"]:e,svg:r,allyTitle:n,className:c,size:u=mt,...t})=>{const a=vt({content:_t(r.svg),title:n}),s=$t(c,W,`${W}--${u}`);return y.jsx("span",{"aria-label":n,className:s,"data-testid":e,dangerouslySetInnerHTML:{__html:a},...t})},yt={"purpur-chip-group-item":"_purpur-chip-group-item_11ac4_1","purpur-chip-group-item__line-wrapper":"_purpur-chip-group-item__line-wrapper_11ac4_19","purpur-chip-group-item__checkmark-icon":"_purpur-chip-group-item__checkmark-icon_11ac4_36","purpur-chip-group-item--disabled":"_purpur-chip-group-item--disabled_11ac4_51"},M=pe.bind(yt),T="purpur-chip-group-item",me=({["aria-label"]:e,children:r,className:n,["data-testid"]:c,disabled:u=!1,showCheckmark:t=!1,unavailable:a=!1,value:s})=>{const l=M([T,{[`${T}--disabled`]:u,[`${T}--unavailable`]:a},n]),i=b=>{u&&b.preventDefault()};return y.jsxs(st,{"aria-label":e,"data-testid":c,className:`${l} ${T}`,value:s,onClick:i,"aria-disabled":u,children:[r,t&&y.jsx($e,{size:"sm",className:M(`${T}__checkmark-icon`),"data-testid":"checkmark icon"}),a&&y.jsx("span",{className:M(`${T}__line-wrapper`),"data-testid":"unavailable line wrapper"})]})},xt=e=>o.isValidElement(e)&&(e==null?void 0:e.type)===me,Et=e=>e.type==="choice",Q=2,It=pe.bind(be),j="purpur-chip-group",z=({children:e,className:r,fullWidth:n=!1,title:c,titleProps:u,...t})=>{const a=It([j,{[`${j}--full-width`]:n},r]),s=o.useId(),l=o.Children.toArray(e).filter(xt),i=o.Children.map(l,p=>o.cloneElement(p,{showCheckmark:t.type==="filter"&&t.value.includes(p.props.value),unavailable:t.type==="choice"&&p.props.unavailable})),b=p=>{(t.type==="filter"||p!=="")&&t.onValueChange(p)};o.useEffect(()=>{t.type==="choice"&&i.length<Q&&console.warn(`Minimum number of chips should be ${Q} when using the "choice" type`)},[i,t.type]);const f=()=>Et(t)?y.jsx(J,{className:a,...t,"aria-labelledby":c?`${(u==null?void 0:u.id)??s}-label`:void 0,onValueChange:b,type:"single",children:i}):y.jsx(J,{className:a,...t,"aria-labelledby":c?`${(u==null?void 0:u.id)??s}-label`:void 0,onValueChange:b,type:"multiple",children:i});return y.jsxs("div",{className:be[`${j}--container`],children:[c&&y.jsx(te,{tag:"h2",variant:"subsection-100",...u,id:`${(u==null?void 0:u.id)??s}-label`,children:c}),f()]})};z.Item=me;z.displayName="ChipGroup";exports.ChipGroup=z; | ||
*/(function(e){(function(){var r={}.hasOwnProperty;function n(){for(var t="",a=0;a<arguments.length;a++){var s=arguments[a];s&&(t=u(t,c.call(this,s)))}return t}function c(t){if(typeof t=="string"||typeof t=="number")return this&&this[t]||t;if(typeof t!="object")return"";if(Array.isArray(t))return n.apply(this,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var a="";for(var s in t)r.call(t,s)&&t[s]&&(a=u(a,this&&this[s]||s));return a}function u(t,a){return a?t?t+" "+a:t+a:t}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(ge);var ft=ge.exports;const pt=dt(ft),bt={"purpur-icon":"_purpur-icon_8u1lq_1","purpur-icon--xxs":"_purpur-icon--xxs_8u1lq_4","purpur-icon--xs":"_purpur-icon--xs_8u1lq_8","purpur-icon--sm":"_purpur-icon--sm_8u1lq_12","purpur-icon--md":"_purpur-icon--md_8u1lq_16","purpur-icon--lg":"_purpur-icon--lg_8u1lq_20","purpur-icon--xl":"_purpur-icon--xl_8u1lq_24"},gt={name:"checkmark",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M21.06 3.795a.9.9 0 0 1 .145 1.264l-11.5 14.5a.9.9 0 0 1-1.341.077l-6-6a.9.9 0 0 1 1.272-1.272l5.286 5.286L19.795 3.94a.9.9 0 0 1 1.264-.145Z" clip-rule="evenodd"/></svg>',keywords:["checkmark"],category:"utility"},$e=e=>y.jsx(Ct,{...e,svg:gt});$e.displayName="IconCheckmark";const $t=pt.bind(bt),X="purpur-icon",mt="md",ht=e=>e.filter(r=>Object.keys(r).length>=1).map(r=>`${r.name}="${r.value}"`).join(" "),vt=({content:e="",title:r}={})=>{const n=[{name:"xmlns",value:"http://www.w3.org/2000/svg"},{name:"fill",value:"currentColor"},{name:"viewBox",value:"0 0 24 24"},r?{name:"role",value:"img"}:{name:"aria-hidden",value:"true"}],c=r?`<title>${r}</title>`:"";return`<svg ${ht(n)}>${c}${e}</svg>`},_t=e=>e.replace(/<(\/?)svg([^>]*)>/g,"").trim(),Ct=({["data-testid"]:e,svg:r,allyTitle:n,className:c,size:u=mt,...t})=>{const a=vt({content:_t(r.svg),title:n}),s=$t(c,X,`${X}--${u}`);return y.jsx("span",{"aria-label":n,className:s,"data-testid":e,dangerouslySetInnerHTML:{__html:a},...t})},yt={"purpur-chip-group-item":"_purpur-chip-group-item_11ac4_1","purpur-chip-group-item__line-wrapper":"_purpur-chip-group-item__line-wrapper_11ac4_19","purpur-chip-group-item__checkmark-icon":"_purpur-chip-group-item__checkmark-icon_11ac4_36","purpur-chip-group-item--disabled":"_purpur-chip-group-item--disabled_11ac4_51"},M=pe.bind(yt),T="purpur-chip-group-item",me=({["aria-label"]:e,children:r,className:n,["data-testid"]:c,disabled:u=!1,showCheckmark:t=!1,unavailable:a=!1,value:s})=>{const l=M([T,{[`${T}--disabled`]:u,[`${T}--unavailable`]:a},n]),i=b=>{u&&b.preventDefault()};return y.jsxs(st,{"aria-label":e,"data-testid":c,className:`${l} ${T}`,value:s,onClick:i,"aria-disabled":u,children:[r,t&&y.jsx($e,{size:"sm",className:M(`${T}__checkmark-icon`),"data-testid":"checkmark icon"}),a&&y.jsx("span",{className:M(`${T}__line-wrapper`),"data-testid":"unavailable line wrapper"})]})},xt=e=>o.isValidElement(e)&&(e==null?void 0:e.type)===me,Et=e=>e.type==="choice",Q=2,It=pe.bind(be),j="purpur-chip-group",H=({children:e,className:r,fullWidth:n=!1,title:c,titleProps:u,...t})=>{const a=It([j,{[`${j}--full-width`]:n},r]),s=o.useId(),l=o.Children.toArray(e).filter(xt),i=o.Children.map(l,p=>o.cloneElement(p,{showCheckmark:t.type==="filter"&&t.value.includes(p.props.value),unavailable:t.type==="choice"&&p.props.unavailable})),b=p=>{(t.type==="filter"||p!=="")&&t.onValueChange(p)};o.useEffect(()=>{t.type==="choice"&&i.length<Q&&console.warn(`Minimum number of chips should be ${Q} when using the "choice" type`)},[i,t.type]);const f=()=>Et(t)?y.jsx(Z,{className:a,...t,"aria-labelledby":c?`${(u==null?void 0:u.id)??s}-label`:void 0,onValueChange:b,type:"single",children:i}):y.jsx(Z,{className:a,...t,"aria-labelledby":c?`${(u==null?void 0:u.id)??s}-label`:void 0,onValueChange:b,type:"multiple",children:i});return y.jsxs("div",{className:be[`${j}--container`],children:[c&&y.jsx(te,{tag:"h2",variant:"subsection-100",...u,id:`${(u==null?void 0:u.id)??s}-label`,children:c}),f()]})};H.Item=me;H.displayName="ChipGroup";exports.ChipGroup=H; | ||
//# sourceMappingURL=chip-group.cjs.js.map |
import { jsx as I, jsxs as ie } from "react/jsx-runtime"; | ||
import * as le from "react"; | ||
import l, { createContext as z, useMemo as M, createElement as y, useContext as de, useCallback as F, forwardRef as w, Children as S, isValidElement as G, cloneElement as X, Fragment as Ae, useEffect as R, useLayoutEffect as Oe, useRef as q, useState as Y, useId as Me } from "react"; | ||
import l, { createContext as Y, useMemo as M, createElement as y, useContext as de, useCallback as F, forwardRef as w, Children as S, isValidElement as R, cloneElement as W, Fragment as Ae, useEffect as N, useLayoutEffect as Oe, useRef as q, useState as z, useId as Me } from "react"; | ||
import "react-dom"; | ||
@@ -92,4 +92,4 @@ function qe(e) { | ||
pe.displayName = "Heading"; | ||
function g() { | ||
return g = Object.assign ? Object.assign.bind() : function(e) { | ||
function b() { | ||
return b = Object.assign ? Object.assign.bind() : function(e) { | ||
for (var n = 1; n < arguments.length; n++) { | ||
@@ -101,3 +101,3 @@ var r = arguments[n]; | ||
return e; | ||
}, g.apply(this, arguments); | ||
}, b.apply(this, arguments); | ||
} | ||
@@ -107,3 +107,3 @@ function ee(e, n = []) { | ||
function o(t, c) { | ||
const a = /* @__PURE__ */ z(c), i = r.length; | ||
const a = /* @__PURE__ */ Y(c), i = r.length; | ||
r = [ | ||
@@ -134,3 +134,3 @@ ...r, | ||
const u = () => { | ||
const t = r.map((c) => /* @__PURE__ */ z(c)); | ||
const t = r.map((c) => /* @__PURE__ */ Y(c)); | ||
return function(a) { | ||
@@ -195,3 +195,3 @@ const i = (a == null ? void 0 : a[e]) || t; | ||
} | ||
function Z(...e) { | ||
function J(...e) { | ||
return F($e(...e), e); | ||
@@ -202,8 +202,8 @@ } | ||
if (t) { | ||
const c = t.props.children, a = u.map((i) => i === t ? S.count(c) > 1 ? S.only(null) : /* @__PURE__ */ G(c) ? c.props.children : null : i); | ||
return /* @__PURE__ */ y(J, g({}, o, { | ||
const c = t.props.children, a = u.map((i) => i === t ? S.count(c) > 1 ? S.only(null) : /* @__PURE__ */ R(c) ? c.props.children : null : i); | ||
return /* @__PURE__ */ y(Z, b({}, o, { | ||
ref: n | ||
}), /* @__PURE__ */ G(c) ? /* @__PURE__ */ X(c, void 0, a) : null); | ||
}), /* @__PURE__ */ R(c) ? /* @__PURE__ */ W(c, void 0, a) : null); | ||
} | ||
return /* @__PURE__ */ y(J, g({}, o, { | ||
return /* @__PURE__ */ y(Z, b({}, o, { | ||
ref: n | ||
@@ -213,5 +213,5 @@ }), r); | ||
D.displayName = "Slot"; | ||
const J = /* @__PURE__ */ w((e, n) => { | ||
const Z = /* @__PURE__ */ w((e, n) => { | ||
const { children: r, ...o } = e; | ||
return /* @__PURE__ */ G(r) ? /* @__PURE__ */ X(r, { | ||
return /* @__PURE__ */ R(r) ? /* @__PURE__ */ W(r, { | ||
...He(o, r.props), | ||
@@ -221,6 +221,6 @@ ref: n ? $e(n, r.ref) : r.ref | ||
}); | ||
J.displayName = "SlotClone"; | ||
Z.displayName = "SlotClone"; | ||
const Ue = ({ children: e }) => /* @__PURE__ */ y(Ae, null, e); | ||
function Ke(e) { | ||
return /* @__PURE__ */ G(e) && e.type === Ue; | ||
return /* @__PURE__ */ R(e) && e.type === Ue; | ||
} | ||
@@ -248,3 +248,3 @@ function He(e, n) { | ||
} | ||
const ze = [ | ||
const Ye = [ | ||
"a", | ||
@@ -266,8 +266,8 @@ "button", | ||
"ul" | ||
], N = ze.reduce((e, n) => { | ||
], G = Ye.reduce((e, n) => { | ||
const r = /* @__PURE__ */ w((o, u) => { | ||
const { asChild: t, ...c } = o, a = t ? D : n; | ||
return R(() => { | ||
return N(() => { | ||
window[Symbol.for("radix-ui")] = !0; | ||
}, []), /* @__PURE__ */ y(a, g({}, c, { | ||
}, []), /* @__PURE__ */ y(a, b({}, c, { | ||
ref: u | ||
@@ -286,3 +286,3 @@ })); | ||
} | ||
function Ye(e) { | ||
function ze(e) { | ||
const n = e + "CollectionProvider", [r, o] = ee(n), [u, t] = r(n, { | ||
@@ -294,10 +294,10 @@ collectionRef: { | ||
}), c = (v) => { | ||
const { scope: d, children: h } = v, _ = l.useRef(null), b = l.useRef(/* @__PURE__ */ new Map()).current; | ||
const { scope: d, children: h } = v, _ = l.useRef(null), g = l.useRef(/* @__PURE__ */ new Map()).current; | ||
return /* @__PURE__ */ l.createElement(u, { | ||
scope: d, | ||
itemMap: b, | ||
itemMap: g, | ||
collectionRef: _ | ||
}, h); | ||
}, a = e + "CollectionSlot", i = /* @__PURE__ */ l.forwardRef((v, d) => { | ||
const { scope: h, children: _ } = v, b = t(a, h), m = Z(d, b.collectionRef); | ||
const { scope: h, children: _ } = v, g = t(a, h), m = J(d, g.collectionRef); | ||
return /* @__PURE__ */ l.createElement(D, { | ||
@@ -307,6 +307,6 @@ ref: m | ||
}), s = e + "CollectionItemSlot", $ = "data-radix-collection-item", f = /* @__PURE__ */ l.forwardRef((v, d) => { | ||
const { scope: h, children: _, ...b } = v, m = l.useRef(null), k = Z(d, m), x = t(s, h); | ||
const { scope: h, children: _, ...g } = v, m = l.useRef(null), k = J(d, m), x = t(s, h); | ||
return l.useEffect(() => (x.itemMap.set(m, { | ||
ref: m, | ||
...b | ||
...g | ||
}), () => void x.itemMap.delete(m))), /* @__PURE__ */ l.createElement(D, { | ||
@@ -322,5 +322,5 @@ [$]: "", | ||
if (!_) return []; | ||
const b = Array.from(_.querySelectorAll(`[${$}]`)); | ||
const g = Array.from(_.querySelectorAll(`[${$}]`)); | ||
return Array.from(d.itemMap.values()).sort( | ||
(x, j) => b.indexOf(x.ref.current) - b.indexOf(j.ref.current) | ||
(x, j) => g.indexOf(x.ref.current) - g.indexOf(j.ref.current) | ||
); | ||
@@ -342,11 +342,11 @@ }, [ | ||
} | ||
const Ze = globalThis != null && globalThis.document ? Oe : () => { | ||
}, Je = le.useId || (() => { | ||
const Je = globalThis != null && globalThis.document ? Oe : () => { | ||
}, Ze = le.useId || (() => { | ||
}); | ||
let We = 0; | ||
let Xe = 0; | ||
function Qe(e) { | ||
const [n, r] = le.useState(Je()); | ||
return Ze(() => { | ||
const [n, r] = le.useState(Ze()); | ||
return Je(() => { | ||
r( | ||
(o) => o ?? String(We++) | ||
(o) => o ?? String(Xe++) | ||
); | ||
@@ -359,3 +359,3 @@ }, [ | ||
const n = q(e); | ||
return R(() => { | ||
return N(() => { | ||
n.current = e; | ||
@@ -372,3 +372,3 @@ }), M( | ||
} }) { | ||
const [o, u] = Xe({ | ||
const [o, u] = We({ | ||
defaultProp: n, | ||
@@ -392,5 +392,5 @@ onChange: r | ||
} | ||
function Xe({ defaultProp: e, onChange: n }) { | ||
const r = Y(e), [o] = r, u = q(o), t = te(n); | ||
return R(() => { | ||
function We({ defaultProp: e, onChange: n }) { | ||
const r = z(e), [o] = r, u = q(o), t = te(n); | ||
return N(() => { | ||
u.current !== o && (t(o), u.current = o); | ||
@@ -403,4 +403,4 @@ }, [ | ||
} | ||
const et = /* @__PURE__ */ z(void 0); | ||
function ge(e) { | ||
const et = /* @__PURE__ */ Y(void 0); | ||
function be(e) { | ||
const n = de(et); | ||
@@ -412,17 +412,17 @@ return e || n || "ltr"; | ||
cancelable: !0 | ||
}, ne = "RovingFocusGroup", [W, be, nt] = Ye(ne), [rt, me] = ee(ne, [ | ||
}, ne = "RovingFocusGroup", [X, ge, nt] = ze(ne), [rt, me] = ee(ne, [ | ||
nt | ||
]), [ot, ct] = rt(ne), ut = /* @__PURE__ */ w((e, n) => /* @__PURE__ */ y(W.Provider, { | ||
]), [ot, ct] = rt(ne), ut = /* @__PURE__ */ w((e, n) => /* @__PURE__ */ y(X.Provider, { | ||
scope: e.__scopeRovingFocusGroup | ||
}, /* @__PURE__ */ y(W.Slot, { | ||
}, /* @__PURE__ */ y(X.Slot, { | ||
scope: e.__scopeRovingFocusGroup | ||
}, /* @__PURE__ */ y(at, g({}, e, { | ||
}, /* @__PURE__ */ y(at, b({}, e, { | ||
ref: n | ||
}))))), at = /* @__PURE__ */ w((e, n) => { | ||
const { __scopeRovingFocusGroup: r, orientation: o, loop: u = !1, dir: t, currentTabStopId: c, defaultCurrentTabStopId: a, onCurrentTabStopIdChange: i, onEntryFocus: s, ...$ } = e, f = q(null), p = Z(n, f), v = ge(t), [d = null, h] = L({ | ||
const { __scopeRovingFocusGroup: r, orientation: o, loop: u = !1, dir: t, currentTabStopId: c, defaultCurrentTabStopId: a, onCurrentTabStopIdChange: i, onEntryFocus: s, ...$ } = e, f = q(null), p = J(n, f), v = be(t), [d = null, h] = L({ | ||
prop: c, | ||
defaultProp: a, | ||
onChange: i | ||
}), [_, b] = Y(!1), m = te(s), k = be(r), x = q(!1), [j, re] = Y(0); | ||
return R(() => { | ||
}), [_, g] = z(!1), m = te(s), k = ge(r), x = q(!1), [j, re] = z(0); | ||
return N(() => { | ||
const C = f.current; | ||
@@ -446,3 +446,3 @@ if (C) | ||
onItemShiftTab: F( | ||
() => b(!0), | ||
() => g(!0), | ||
[] | ||
@@ -462,3 +462,3 @@ ), | ||
) | ||
}, /* @__PURE__ */ y(N.div, g({ | ||
}, /* @__PURE__ */ y(G.div, b({ | ||
tabIndex: _ || j === 0 ? -1 : 0, | ||
@@ -476,4 +476,4 @@ "data-orientation": o | ||
onFocus: E(e.onFocus, (C) => { | ||
const Re = !x.current; | ||
if (C.target === C.currentTarget && Re && !_) { | ||
const Ne = !x.current; | ||
if (C.target === C.currentTarget && Ne && !_) { | ||
const oe = new CustomEvent(U, tt); | ||
@@ -483,9 +483,9 @@ if (C.currentTarget.dispatchEvent(oe), !oe.defaultPrevented) { | ||
(T) => T.focusable | ||
), Re = B.find( | ||
(T) => T.active | ||
), Ge = B.find( | ||
(T) => T.active | ||
), Ne = B.find( | ||
(T) => T.id === d | ||
), ke = [ | ||
Re, | ||
Ge, | ||
Ne, | ||
...B | ||
@@ -502,8 +502,8 @@ ].filter(Boolean).map( | ||
e.onBlur, | ||
() => b(!1) | ||
() => g(!1) | ||
) | ||
}))); | ||
}), st = "RovingFocusGroupItem", it = /* @__PURE__ */ w((e, n) => { | ||
const { __scopeRovingFocusGroup: r, focusable: o = !0, active: u = !1, tabStopId: t, ...c } = e, a = Qe(), i = t || a, s = ct(st, r), $ = s.currentTabStopId === i, f = be(r), { onFocusableItemAdd: p, onFocusableItemRemove: v } = s; | ||
return R(() => { | ||
const { __scopeRovingFocusGroup: r, focusable: o = !0, active: u = !1, tabStopId: t, ...c } = e, a = Qe(), i = t || a, s = ct(st, r), $ = s.currentTabStopId === i, f = ge(r), { onFocusableItemAdd: p, onFocusableItemRemove: v } = s; | ||
return N(() => { | ||
if (o) | ||
@@ -515,3 +515,3 @@ return p(), () => v(); | ||
v | ||
]), /* @__PURE__ */ y(W.ItemSlot, { | ||
]), /* @__PURE__ */ y(X.ItemSlot, { | ||
scope: r, | ||
@@ -521,3 +521,3 @@ id: i, | ||
active: u | ||
}, /* @__PURE__ */ y(N.span, g({ | ||
}, /* @__PURE__ */ y(G.span, b({ | ||
tabIndex: $ ? 0 : -1, | ||
@@ -543,3 +543,3 @@ "data-orientation": s.orientation | ||
d.preventDefault(); | ||
let b = f().filter( | ||
let g = f().filter( | ||
(m) => m.focusable | ||
@@ -549,10 +549,10 @@ ).map( | ||
); | ||
if (h === "last") b.reverse(); | ||
if (h === "last") g.reverse(); | ||
else if (h === "prev" || h === "next") { | ||
h === "prev" && b.reverse(); | ||
const m = b.indexOf(d.currentTarget); | ||
b = s.loop ? pt(b, m + 1) : b.slice(m + 1); | ||
h === "prev" && g.reverse(); | ||
const m = g.indexOf(d.currentTarget); | ||
g = s.loop ? pt(g, m + 1) : g.slice(m + 1); | ||
} | ||
setTimeout( | ||
() => he(b) | ||
() => he(g) | ||
); | ||
@@ -596,3 +596,3 @@ } | ||
} | ||
const $t = ut, gt = it, bt = /* @__PURE__ */ w((e, n) => { | ||
const $t = ut, bt = it, gt = /* @__PURE__ */ w((e, n) => { | ||
const { pressed: r, defaultPressed: o = !1, onPressedChange: u, ...t } = e, [c = !1, a] = L({ | ||
@@ -603,3 +603,3 @@ prop: r, | ||
}); | ||
return /* @__PURE__ */ y(N.button, g({ | ||
return /* @__PURE__ */ y(G.button, b({ | ||
type: "button", | ||
@@ -621,3 +621,3 @@ "aria-pressed": c, | ||
const u = o; | ||
return /* @__PURE__ */ l.createElement(ht, g({}, u, { | ||
return /* @__PURE__ */ l.createElement(ht, b({}, u, { | ||
ref: n | ||
@@ -628,3 +628,3 @@ })); | ||
const u = o; | ||
return /* @__PURE__ */ l.createElement(vt, g({}, u, { | ||
return /* @__PURE__ */ l.createElement(vt, b({}, u, { | ||
ref: n | ||
@@ -654,3 +654,3 @@ })); | ||
) | ||
}, /* @__PURE__ */ l.createElement(xe, g({}, t, { | ||
}, /* @__PURE__ */ l.createElement(xe, b({}, t, { | ||
ref: n | ||
@@ -690,7 +690,7 @@ }))); | ||
onItemDeactivate: s | ||
}, /* @__PURE__ */ l.createElement(xe, g({}, t, { | ||
}, /* @__PURE__ */ l.createElement(xe, b({}, t, { | ||
ref: n | ||
}))); | ||
}), [_t, Ct] = ve(V), xe = /* @__PURE__ */ l.forwardRef((e, n) => { | ||
const { __scopeToggleGroup: r, disabled: o = !1, rovingFocus: u = !0, orientation: t, dir: c, loop: a = !0, ...i } = e, s = _e(r), $ = ge(c), f = { | ||
const { __scopeToggleGroup: r, disabled: o = !1, rovingFocus: u = !0, orientation: t, dir: c, loop: a = !0, ...i } = e, s = _e(r), $ = be(c), f = { | ||
role: "group", | ||
@@ -704,3 +704,3 @@ dir: $, | ||
disabled: o | ||
}, u ? /* @__PURE__ */ l.createElement($t, g({ | ||
}, u ? /* @__PURE__ */ l.createElement($t, b({ | ||
asChild: !0 | ||
@@ -711,5 +711,5 @@ }, s, { | ||
loop: a | ||
}), /* @__PURE__ */ l.createElement(N.div, g({}, f, { | ||
}), /* @__PURE__ */ l.createElement(G.div, b({}, f, { | ||
ref: n | ||
}))) : /* @__PURE__ */ l.createElement(N.div, g({}, f, { | ||
}))) : /* @__PURE__ */ l.createElement(G.div, b({}, f, { | ||
ref: n | ||
@@ -723,3 +723,3 @@ }))); | ||
}, i = l.useRef(null); | ||
return o.rovingFocus ? /* @__PURE__ */ l.createElement(gt, g({ | ||
return o.rovingFocus ? /* @__PURE__ */ l.createElement(bt, b({ | ||
asChild: !0 | ||
@@ -730,5 +730,5 @@ }, u, { | ||
ref: i | ||
}), /* @__PURE__ */ l.createElement(ce, g({}, a, { | ||
}), /* @__PURE__ */ l.createElement(ce, b({}, a, { | ||
ref: n | ||
}))) : /* @__PURE__ */ l.createElement(ce, g({}, a, { | ||
}))) : /* @__PURE__ */ l.createElement(ce, b({}, a, { | ||
ref: n | ||
@@ -742,3 +742,3 @@ })); | ||
}, a = t.type === "single" ? c : void 0; | ||
return /* @__PURE__ */ l.createElement(bt, g({}, a, u, { | ||
return /* @__PURE__ */ l.createElement(gt, b({}, a, u, { | ||
ref: n, | ||
@@ -856,3 +856,3 @@ onPressedChange: (i) => { | ||
we.displayName = "IconCheckmark"; | ||
const Rt = wt.bind(Pt), ae = "purpur-icon", Gt = "md", Nt = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), kt = ({ content: e = "", title: n } = {}) => { | ||
const Nt = wt.bind(Pt), ae = "purpur-icon", Rt = "md", Gt = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), kt = ({ content: e = "", title: n } = {}) => { | ||
const r = [ | ||
@@ -864,3 +864,3 @@ { name: "xmlns", value: "http://www.w3.org/2000/svg" }, | ||
], o = n ? `<title>${n}</title>` : ""; | ||
return `<svg ${Nt(r)}>${o}${e}</svg>`; | ||
return `<svg ${Gt(r)}>${o}${e}</svg>`; | ||
}, At = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Ot = ({ | ||
@@ -871,3 +871,3 @@ ["data-testid"]: e, | ||
className: o, | ||
size: u = Gt, | ||
size: u = Rt, | ||
...t | ||
@@ -878,3 +878,3 @@ }) => { | ||
title: r | ||
}), a = Rt(o, ae, `${ae}--${u}`); | ||
}), a = Nt(o, ae, `${ae}--${u}`); | ||
return /* @__PURE__ */ I( | ||
@@ -944,3 +944,3 @@ "span", | ||
); | ||
}, qt = (e) => G(e) && (e == null ? void 0 : e.type) === Pe, Dt = (e) => e.type === "choice", se = 2, Lt = Te.bind(Se), H = "purpur-chip-group", Fe = ({ children: e, className: n, fullWidth: r = !1, title: o, titleProps: u, ...t }) => { | ||
}, qt = (e) => R(e) && (e == null ? void 0 : e.type) === Pe, Dt = (e) => e.type === "choice", se = 2, Lt = Te.bind(Se), H = "purpur-chip-group", Fe = ({ children: e, className: n, fullWidth: r = !1, title: o, titleProps: u, ...t }) => { | ||
const c = Lt([ | ||
@@ -954,3 +954,3 @@ H, | ||
i, | ||
(p) => X(p, { | ||
(p) => W(p, { | ||
showCheckmark: t.type === "filter" && t.value.includes(p.props.value), | ||
@@ -962,3 +962,3 @@ unavailable: t.type === "choice" && p.props.unavailable | ||
}; | ||
R(() => { | ||
N(() => { | ||
t.type === "choice" && s.length < se && console.warn( | ||
@@ -965,0 +965,0 @@ `Minimum number of chips should be ${se} when using the "choice" type` |
Name: @purpurds/heading | ||
Version: 5.12.0 | ||
Version: 5.13.0 | ||
License: AGPL-3.0-only | ||
@@ -205,4 +205,4 @@ Private: false | ||
Name: @purpurds/icon | ||
Version: 5.12.0 | ||
Version: 5.13.0 | ||
License: AGPL-3.0-only | ||
Private: false |
{ | ||
"name": "@purpurds/chip-group", | ||
"version": "5.13.0", | ||
"version": "5.14.0", | ||
"license": "AGPL-3.0-only", | ||
@@ -19,5 +19,5 @@ "main": "./dist/chip-group.cjs.js", | ||
"classnames": "~2.5.0", | ||
"@purpurds/heading": "5.13.0", | ||
"@purpurds/tokens": "5.13.0", | ||
"@purpurds/icon": "5.13.0" | ||
"@purpurds/icon": "5.14.0", | ||
"@purpurds/tokens": "5.14.0", | ||
"@purpurds/heading": "5.14.0" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1164878
9
+ Added@purpurds/heading@5.14.0(transitive)
+ Added@purpurds/icon@5.14.0(transitive)
+ Added@purpurds/tokens@5.14.0(transitive)
- Removed@purpurds/heading@5.13.0(transitive)
- Removed@purpurds/icon@5.13.0(transitive)
- Removed@purpurds/tokens@5.13.0(transitive)
Updated@purpurds/heading@5.14.0
Updated@purpurds/icon@5.14.0
Updated@purpurds/tokens@5.14.0