New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@purpurds/chip-group

Package Overview
Dependencies
Maintainers
0
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@purpurds/chip-group - npm Package Compare versions

Comparing version 5.17.0 to 5.18.0

4

dist/chip-group.cjs.js

@@ -5,7 +5,7 @@ "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:{}};/*!

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)({}).hasOwnProperty.call(n,c)&&(e[c]=n[c])}return e},g.apply(null,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,G)=>$.indexOf(x.ref.current)-$.indexOf(G.ref.current))},[d.collectionRef,d.itemMap])}return[{Provider:a,Slot:l,ItemSlot:f},p,c]}const Ge=globalThis!=null&&globalThis.document?o.useLayoutEffect:()=>{},Oe=W.useId||(()=>{});let Ae=0;function Me(e){const[r,n]=W.useState(Oe());return Ge(()=>{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),[G,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:_||G===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))})))}),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:{}};/*!
*/(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)({}).hasOwnProperty.call(n,c)&&(e[c]=n[c])}return e},g.apply(null,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 D(...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(q,g({},c,{ref:r}),o.isValidElement(a)?o.cloneElement(a,void 0,s):null)}return o.createElement(q,g({},c,{ref:r}),n)});k.displayName="Slot";const q=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});q.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=D(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=D(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,G)=>$.indexOf(x.ref.current)-$.indexOf(G.ref.current))},[d.collectionRef,d.itemMap])}return[{Provider:a,Slot:l,ItemSlot:f},p,c]}const Ge=globalThis!=null&&globalThis.document?o.useLayoutEffect:()=>{},Oe=W.useId||(()=>{});let Ae=0;function Me(e){const[r,n]=W.useState(Oe());return Ge(()=>{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 De=o.createContext(void 0);function re(e){const r=o.useContext(De);return e||r||"ltr"}const A="rovingFocusGroup.onEntryFocus",qe={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=D(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),[G,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:_||G===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,qe);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))})))}),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.
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})()})(fe);var lt=fe.exports;const pe=it(lt),be={"purpur-chip-group":"_purpur-chip-group_12qtk_1","purpur-chip-group--container":"_purpur-chip-group--container_12qtk_6","purpur-chip-group--full-width":"_purpur-chip-group--full-width_12qtk_12"};function dt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ge={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.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})()})(fe);var lt=fe.exports;const pe=it(lt),be={"purpur-chip-group":"_purpur-chip-group_m2vd5_1","purpur-chip-group--container":"_purpur-chip-group--container_m2vd5_6","purpur-chip-group--full-width":"_purpur-chip-group--full-width_m2vd5_12"};function dt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ge={exports:{}};/*!
Copyright (c) 2018 Jed Watson.

@@ -12,0 +12,0 @@ Licensed under the MIT License (MIT), see

import { jsx as I, jsxs as ie } from "react/jsx-runtime";
import * as le 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 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 D, useState as z, useId as Me } from "react";
import "react-dom";
function qe(e) {
function De(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;

@@ -44,4 +44,4 @@ }

})(fe);
var De = fe.exports;
const Le = /* @__PURE__ */ qe(De), A = {
var Le = fe.exports;
const qe = /* @__PURE__ */ De(Le), A = {
"purpur-heading": "_purpur-heading_k9fhq_1",

@@ -81,3 +81,3 @@ "purpur-heading--hyphens": "_purpur-heading--hyphens_k9fhq_8",

}) => {
const i = t, s = Le([
const i = t, s = qe([
r,

@@ -195,3 +195,3 @@ A[O],

}
const D = /* @__PURE__ */ w((e, n) => {
const L = /* @__PURE__ */ w((e, n) => {
const { children: r, ...o } = e, u = S.toArray(r), t = u.find(Ke);

@@ -208,3 +208,3 @@ if (t) {

});
D.displayName = "Slot";
L.displayName = "Slot";
const Z = /* @__PURE__ */ w((e, n) => {

@@ -260,5 +260,5 @@ const { children: r, ...o } = e;

"ul"
], k = Ye.reduce((e, n) => {
], G = Ye.reduce((e, n) => {
const r = /* @__PURE__ */ w((o, u) => {
const { asChild: t, ...c } = o, a = t ? D : n;
const { asChild: t, ...c } = o, a = t ? L : n;
return N(() => {

@@ -295,13 +295,13 @@ window[Symbol.for("radix-ui")] = !0;

const { scope: h, children: _ } = v, b = t(a, h), m = J(d, b.collectionRef);
return /* @__PURE__ */ l.createElement(D, {
return /* @__PURE__ */ l.createElement(L, {
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), G = J(d, m), x = t(s, h);
const { scope: h, children: _, ...b } = v, m = l.useRef(null), k = J(d, m), x = t(s, h);
return l.useEffect(() => (x.itemMap.set(m, {
ref: m,
...b
}), () => void x.itemMap.delete(m))), /* @__PURE__ */ l.createElement(D, {
}), () => void x.itemMap.delete(m))), /* @__PURE__ */ l.createElement(L, {
[$]: "",
ref: G
ref: k
}, _);

@@ -348,3 +348,3 @@ });

function te(e) {
const n = q(e);
const n = D(e);
return N(() => {

@@ -360,3 +360,3 @@ n.current = e;

}
function L({ prop: e, defaultProp: n, onChange: r = () => {
function q({ prop: e, defaultProp: n, onChange: r = () => {
} }) {

@@ -383,3 +383,3 @@ const [o, u] = We({

function We({ defaultProp: e, onChange: n }) {
const r = z(e), [o] = r, u = q(o), t = te(n);
const r = z(e), [o] = r, u = D(o), t = te(n);
return N(() => {

@@ -410,7 +410,7 @@ u.current !== o && (t(o), u.current = o);

}))))), 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 = J(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 = D(null), p = J(n, f), v = ge(t), [d = null, h] = q({
prop: c,
defaultProp: a,
onChange: i
}), [_, b] = z(!1), m = te(s), G = be(r), x = q(!1), [j, re] = z(0);
}), [_, b] = z(!1), m = te(s), k = be(r), x = D(!1), [j, re] = z(0);
return N(() => {

@@ -450,3 +450,3 @@ const C = f.current;

)
}, /* @__PURE__ */ y(k.div, g({
}, /* @__PURE__ */ y(G.div, g({
tabIndex: _ || j === 0 ? -1 : 0,

@@ -468,11 +468,11 @@ "data-orientation": o

if (C.currentTarget.dispatchEvent(oe), !oe.defaultPrevented) {
const B = G().filter(
const B = k().filter(
(T) => T.focusable
), Re = B.find(
(T) => T.active
), ke = B.find(
), Ge = B.find(
(T) => T.id === d
), Ge = [
), ke = [
Re,
ke,
Ge,
...B

@@ -482,3 +482,3 @@ ].filter(Boolean).map(

);
he(Ge);
he(ke);
}

@@ -507,3 +507,3 @@ }

active: u
}, /* @__PURE__ */ y(k.span, g({
}, /* @__PURE__ */ y(G.span, g({
tabIndex: $ ? 0 : -1,

@@ -581,3 +581,3 @@ "data-orientation": s.orientation

const $t = ut, gt = it, bt = /* @__PURE__ */ w((e, n) => {
const { pressed: r, defaultPressed: o = !1, onPressedChange: u, ...t } = e, [c = !1, a] = L({
const { pressed: r, defaultPressed: o = !1, onPressedChange: u, ...t } = e, [c = !1, a] = q({
prop: r,

@@ -587,3 +587,3 @@ onChange: u,

});
return /* @__PURE__ */ y(k.button, g({
return /* @__PURE__ */ y(G.button, g({
type: "button",

@@ -618,3 +618,3 @@ "aria-pressed": c,

const { value: r, defaultValue: o, onValueChange: u = () => {
}, ...t } = e, [c, a] = L({
}, ...t } = e, [c, a] = q({
prop: r,

@@ -642,3 +642,3 @@ defaultProp: o,

const { value: r, defaultValue: o, onValueChange: u = () => {
}, ...t } = e, [c = [], a] = L({
}, ...t } = e, [c = [], a] = q({
prop: r,

@@ -692,5 +692,5 @@ defaultProp: o,

loop: a
}), /* @__PURE__ */ l.createElement(k.div, g({}, f, {
}), /* @__PURE__ */ l.createElement(G.div, g({}, f, {
ref: n
}))) : /* @__PURE__ */ l.createElement(k.div, g({}, f, {
}))) : /* @__PURE__ */ l.createElement(G.div, g({}, f, {
ref: n

@@ -769,5 +769,5 @@ })));

const Te = /* @__PURE__ */ It(Tt), Se = {
"purpur-chip-group": "_purpur-chip-group_12qtk_1",
"purpur-chip-group--container": "_purpur-chip-group--container_12qtk_6",
"purpur-chip-group--full-width": "_purpur-chip-group--full-width_12qtk_12"
"purpur-chip-group": "_purpur-chip-group_m2vd5_1",
"purpur-chip-group--container": "_purpur-chip-group--container_m2vd5_6",
"purpur-chip-group--full-width": "_purpur-chip-group--full-width_m2vd5_12"
};

@@ -835,3 +835,3 @@ function St(e) {

we.displayName = "IconCheckmark";
const Nt = wt.bind(Pt), ae = "purpur-icon", Rt = "md", kt = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), Gt = ({ 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 = [

@@ -843,3 +843,3 @@ { name: "xmlns", value: "http://www.w3.org/2000/svg" },

], o = n ? `<title>${n}</title>` : "";
return `<svg ${kt(r)}>${o}${e}</svg>`;
return `<svg ${Gt(r)}>${o}${e}</svg>`;
}, At = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Ot = ({

@@ -853,3 +853,3 @@ ["data-testid"]: e,

}) => {
const c = Gt({
const c = kt({
content: At(n.svg),

@@ -922,4 +922,4 @@ title: r

);
}, 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([
}, Dt = (e) => R(e) && (e == null ? void 0 : e.type) === Pe, Lt = (e) => e.type === "choice", se = 2, qt = Te.bind(Se), H = "purpur-chip-group", Fe = ({ children: e, className: n, fullWidth: r = !1, title: o, titleProps: u, ...t }) => {
const c = qt([
H,

@@ -930,3 +930,3 @@ {

n
]), a = Me(), i = S.toArray(e).filter(qt), s = S.map(
]), a = Me(), i = S.toArray(e).filter(Dt), s = S.map(
i,

@@ -945,3 +945,3 @@ (p) => W(p, {

}, [s, t.type]);
const f = () => Dt(t) ? /* @__PURE__ */ I(
const f = () => Lt(t) ? /* @__PURE__ */ I(
ue,

@@ -948,0 +948,0 @@ {

Name: @purpurds/heading
Version: 5.16.1
Version: 5.17.0
License: AGPL-3.0-only

@@ -205,4 +205,4 @@ Private: false

Name: @purpurds/icon
Version: 5.16.1
Version: 5.17.0
License: AGPL-3.0-only
Private: false
{
"name": "@purpurds/chip-group",
"version": "5.17.0",
"version": "5.18.0",
"license": "AGPL-3.0-only",

@@ -19,5 +19,5 @@ "main": "./dist/chip-group.cjs.js",

"classnames": "~2.5.0",
"@purpurds/heading": "5.17.0",
"@purpurds/tokens": "5.17.0",
"@purpurds/icon": "5.17.0"
"@purpurds/heading": "5.18.0",
"@purpurds/tokens": "5.18.0",
"@purpurds/icon": "5.18.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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc