@purpurds/autocomplete
Advanced tools
Comparing version 5.4.1 to 5.4.2
@@ -13,3 +13,3 @@ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react/jsx-runtime"),d=require("react");function _r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W={exports:{}};/*! | ||
http://jedwatson.github.io/classnames | ||
*/(function(e){(function(){var o={}.hasOwnProperty;function n(){for(var r="",t=0;t<arguments.length;t++){var s=arguments[t];s&&(r=i(r,l(s)))}return r}function l(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return n.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var t="";for(var s in r)o.call(r,s)&&r[s]&&(t=i(t,s));return t}function i(r,t){return t?r?r+" "+t:r+t:r}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(er);var Nr=er.exports;const Pr=Sr(Nr),I={"purpur-paragraph":"_purpur-paragraph_1rh57_1","purpur-paragraph--disabled":"_purpur-paragraph--disabled_1rh57_7","purpur-paragraph--hyphens":"_purpur-paragraph--hyphens_1rh57_10","purpur-paragraph--negative":"_purpur-paragraph--negative_1rh57_13","purpur-paragraph--paragraph-100":"_purpur-paragraph--paragraph-100_1rh57_16","purpur-paragraph--paragraph-100-medium":"_purpur-paragraph--paragraph-100-medium_1rh57_22","purpur-paragraph--paragraph-100-bold":"_purpur-paragraph--paragraph-100-bold_1rh57_29","purpur-paragraph--paragraph-200":"_purpur-paragraph--paragraph-200_1rh57_36","purpur-paragraph--preamble-100":"_purpur-paragraph--preamble-100_1rh57_42","purpur-paragraph--preamble-200":"_purpur-paragraph--preamble-200_1rh57_48","purpur-paragraph--additional-100":"_purpur-paragraph--additional-100_1rh57_54","purpur-paragraph--additional-100-medium":"_purpur-paragraph--additional-100-medium_1rh57_60","purpur-paragraph--overline-100":"_purpur-paragraph--overline-100_1rh57_67","purpur-paragraph--overline-200":"_purpur-paragraph--overline-200_1rh57_75"},jr={PARAGRAPH100:"paragraph-100",PARAGRAPH100MEDIUM:"paragraph-100-medium",PARAGRAPH100BOLD:"paragraph-100-bold",PARAGRAPH200:"paragraph-200",PREAMBLE100:"preamble-100",PREAMBLE200:"preamble-200",ADDITIONAL100:"additional-100",ADDITIONAL100MEDIUM:"additional-100-medium",OVERLINE100:"overline-100",OVERLINE200:"overline-200"},L="purpur-paragraph",Cr=({["data-testid"]:e,children:o,className:n="",disabled:l,enableHyphenation:i=!1,negative:r=!1,variant:t=jr.PARAGRAPH100,...s})=>{const b=Pr([n,I[L],I[`${L}--${t}`],{[I[`${L}--hyphens`]]:i,[I[`${L}--disabled`]]:l,[I[`${L}--negative`]]:r}]);return _.jsx("p",{...s,className:b,"data-testid":e,children:o})},Br={"purpur-listbox":"_purpur-listbox_qhoi7_1","purpur-listbox-item":"_purpur-listbox-item_qhoi7_15","purpur-listbox-item--hovered":"_purpur-listbox-item--hovered_qhoi7_29","purpur-listbox-item--highlighted":"_purpur-listbox-item--highlighted_qhoi7_37","purpur-listbox-item--noninteractive":"_purpur-listbox-item--noninteractive_qhoi7_41","purpur-listbox-item--disabled":"_purpur-listbox-item--disabled_qhoi7_44","purpur-listbox-item__icon":"_purpur-listbox-item__icon_qhoi7_51"},Dr=e=>d.useRef(e),kr=(e,o)=>{const n=d.useCallback(l=>{e&&!e.contains(l.target)&&o()},[o,e]);d.useEffect(()=>(document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}),[n])},tr=({highlightFirstOption:e,defaultInputValue:o,inputValue:n,filterOption:l,id:i,listboxLabel:r,listboxMaxHeight:t,onInputChange:s,openOnFocus:b,noOptionsText:A,onSelect:R,options:v,selectedOption:c,["data-testid"]:E})=>{const[j,f]=d.useState((typeof n=="string"?n:o)||(c==null?void 0:c.label)),S=typeof n=="string"?n:j,[u,x]=d.useState(e?v[0]:void 0),C=d.useRef(null),T=Dr(null),O=d.useRef(null),N=d.useRef({}),[V,K]=d.useState(!1);function B(a){return E?`${E}-${a}`:void 0}const P=()=>{K(!1),x(void 0)};kr(T.current,P);const $=({eventType:a})=>{K(!0),c&&requestAnimationFrame(()=>{x({...c,isSetByClickEvent:a==="CLICK"}),D(N.current[c.id])})},sr=a=>{if(l)return v.filter(m=>l(a,m));if(!a)return v;const p=a.toUpperCase().split(" ")||[];return v.filter(m=>p.every(h=>(m.value||m.label).toUpperCase().includes(h)))},H=a=>c&&(c==null?void 0:c.label)===a?v:sr(a),g=H(S),U=a=>{s==null||s(a),f(a)},D=a=>{var p;if(a){const m=a.getBoundingClientRect(),h=((p=O.current)==null?void 0:p.getBoundingClientRect())||{top:0,bottom:0};(m.top<h.top||m.bottom>h.bottom)&&a.scrollIntoView({block:"nearest"})}},G=a=>{var p;a&&((p=C.current)==null||p.focus(),U(a.label),R==null||R(a)),P()},or=a=>{const p=e&&!u?0:g.findIndex(h=>h&&(u==null?void 0:u.id)===h.id),m=g.length;return a==="ArrowDown"?g[(p??-1)+1]||g[0]:g[(p??m)-1]||g[m-1]},y=V&&(!!g.length||!!A),ur=a=>{!y&&$({eventType:"KEYBOARD"});const p=or(a);x(p),p&&D(N.current[p.id])},ir=a=>{switch(a.key){case"ArrowUp":case"ArrowDown":a.preventDefault(),ur(a.key);break;case"Enter":{const p=u||(e?v[0]:void 0);y&&G(p),!y&&$({eventType:"KEYBOARD"});break}case"Escape":case"Tab":P();break}},pr=a=>{const p=H(a.target.value);U(a.target.value),x(void 0),!y&&$({eventType:"KEYBOARD"}),e&&p[0]&&D(N.current[p[0].id])},lr=()=>{y?P():$({eventType:"CLICK"})},cr=()=>{var a;!V&&b&&$({eventType:"KEYBOARD"}),(a=C.current)==null||a.select()},dr={maxHeight:typeof t=="number"?`${t}px`:t},Y={"aria-label":r,"aria-expanded":y,"data-testid":B("listbox"),id:`${i}-listbox`,ref:O,onMouseLeave:()=>x(void 0),style:t?dr:void 0},z=a=>`${i}-listbox-item-${a.id}`,mr=(a,p)=>{const m=()=>a.id!==(u==null?void 0:u.id)&&x({...a,isSetByClickEvent:!0}),h=(a.id===(u==null?void 0:u.id)||!!e&&!u&&p===0)&&!(u!=null&&u.isSetByClickEvent);return{"data-testid":B(`listbox-item-${a.id}`),id:z(a),key:a.id,onMouseMove:m,onMouseUp:()=>G(a),ref:k=>k&&(N.current[a.id]=k),tabIndex:-1,selected:a.id===(c==null?void 0:c.id),disabled:a.disabled,highlighted:h,hovered:a.id===(u==null?void 0:u.id)&&!!(u!=null&&u.isSetByClickEvent)}},fr={"aria-activedescendant":u?z(u):void 0,"aria-autocomplete":"list","aria-controls":Y.id,"aria-expanded":y,"data-testid":B("input"),autoComplete:"off",id:`${i}-input`,onChange:pr,onMouseDown:lr,onFocus:cr,onKeyDown:ir,ref:C,role:"combobox",value:S};return{id:i,inputProps:fr,internalRef:T,optionsToShow:g,showListbox:y,noOptionsText:A,getListBoxItemProps:mr,listboxProps:Y}},M=X.bind(Br),w="purpur-listbox",ar=d.forwardRef(({children:e,...o},n)=>_.jsx("ul",{...o,ref:n,className:M(w,o.className),role:"listbox",children:d.Children.toArray(e).filter(Mr)}));ar.displayName="ListBox";const q=d.forwardRef((e,o)=>{const{disabled:n,highlighted:l,hovered:i,selected:r,children:t,noninteractive:s,...b}=e,A=M(`${w}-item`,b.className,{[`${w}-item--highlighted`]:l,[`${w}-item--selected`]:r,[`${w}-item--hovered`]:i,[`${w}-item--disabled`]:n,[`${w}-item--noninteractive`]:s});return _.jsxs("li",{...b,ref:o,className:A,"aria-selected":!!r,role:"option","aria-disabled":!!n,children:[typeof t=="string"?_.jsx(Cr,{children:t}):t,r&&_.jsx(Er,{svg:wr,size:"xs",className:M(`${w}-item__icon`)})]})});q.displayName="ListBoxItem";function Mr(e){return d.isValidElement(e)&&(e==null?void 0:e.type)===q}const qr=ar,Z=q,J=X.bind(hr),Q="purpur-autocomplete",Tr=({className:e,renderInput:o,renderOption:n,...l},i)=>{const{id:r,inputProps:t,internalRef:s,optionsToShow:b,showListbox:A,noOptionsText:R,getListBoxItemProps:v,listboxProps:c}=tr(l),E=(f,S)=>{const{key:u,...x}=v(f,S);return _.jsx(Z,{...x,children:n?n==null?void 0:n(f):f.label},u)},j=f=>{s.current=f,typeof i=="function"?i(f):i&&(i.current=f)};return _.jsxs("div",{id:r,ref:j,className:J([e,Q]),children:[o(t),A&&_.jsx(qr,{...c,className:J(`${Q}__listbox`),children:b.length?b.filter(f=>!!f).map(E):_.jsx(Z,{noninteractive:!0,children:R})})]})},nr=d.forwardRef(Tr);nr.displayName="Autocomplete";exports.Autocomplete=nr;exports.useAutocomplete=tr; | ||
*/(function(e){(function(){var o={}.hasOwnProperty;function n(){for(var r="",t=0;t<arguments.length;t++){var s=arguments[t];s&&(r=i(r,l(s)))}return r}function l(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return n.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var t="";for(var s in r)o.call(r,s)&&r[s]&&(t=i(t,s));return t}function i(r,t){return t?r?r+" "+t:r+t:r}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(er);var Nr=er.exports;const Pr=Sr(Nr),I={"purpur-paragraph":"_purpur-paragraph_1rh57_1","purpur-paragraph--disabled":"_purpur-paragraph--disabled_1rh57_7","purpur-paragraph--hyphens":"_purpur-paragraph--hyphens_1rh57_10","purpur-paragraph--negative":"_purpur-paragraph--negative_1rh57_13","purpur-paragraph--paragraph-100":"_purpur-paragraph--paragraph-100_1rh57_16","purpur-paragraph--paragraph-100-medium":"_purpur-paragraph--paragraph-100-medium_1rh57_22","purpur-paragraph--paragraph-100-bold":"_purpur-paragraph--paragraph-100-bold_1rh57_29","purpur-paragraph--paragraph-200":"_purpur-paragraph--paragraph-200_1rh57_36","purpur-paragraph--preamble-100":"_purpur-paragraph--preamble-100_1rh57_42","purpur-paragraph--preamble-200":"_purpur-paragraph--preamble-200_1rh57_48","purpur-paragraph--additional-100":"_purpur-paragraph--additional-100_1rh57_54","purpur-paragraph--additional-100-medium":"_purpur-paragraph--additional-100-medium_1rh57_60","purpur-paragraph--overline-100":"_purpur-paragraph--overline-100_1rh57_67","purpur-paragraph--overline-200":"_purpur-paragraph--overline-200_1rh57_75"},jr={PARAGRAPH100:"paragraph-100",PARAGRAPH100MEDIUM:"paragraph-100-medium",PARAGRAPH100BOLD:"paragraph-100-bold",PARAGRAPH200:"paragraph-200",PREAMBLE100:"preamble-100",PREAMBLE200:"preamble-200",ADDITIONAL100:"additional-100",ADDITIONAL100MEDIUM:"additional-100-medium",OVERLINE100:"overline-100",OVERLINE200:"overline-200"},L="purpur-paragraph",Cr=({["data-testid"]:e,children:o,className:n="",disabled:l,enableHyphenation:i=!1,negative:r=!1,variant:t=jr.PARAGRAPH100,...s})=>{const b=Pr([n,I[L],I[`${L}--${t}`],{[I[`${L}--hyphens`]]:i,[I[`${L}--disabled`]]:l,[I[`${L}--negative`]]:r}]);return _.jsx("p",{...s,className:b,"data-testid":e,children:o})},Br={"purpur-listbox":"_purpur-listbox_qhoi7_1","purpur-listbox-item":"_purpur-listbox-item_qhoi7_15","purpur-listbox-item--hovered":"_purpur-listbox-item--hovered_qhoi7_29","purpur-listbox-item--highlighted":"_purpur-listbox-item--highlighted_qhoi7_37","purpur-listbox-item--noninteractive":"_purpur-listbox-item--noninteractive_qhoi7_41","purpur-listbox-item--disabled":"_purpur-listbox-item--disabled_qhoi7_44","purpur-listbox-item__icon":"_purpur-listbox-item__icon_qhoi7_51"},Dr=e=>d.useRef(e),kr=(e,o)=>{const n=d.useCallback(l=>{e&&!e.contains(l.target)&&o()},[o,e]);d.useEffect(()=>(document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}),[n])},tr=({highlightFirstOption:e,defaultInputValue:o,inputValue:n,filterOption:l,id:i,listboxLabel:r,listboxMaxHeight:t,onInputChange:s,openOnFocus:b,noOptionsText:A,onSelect:R,options:v,selectedOption:c,["data-testid"]:E})=>{const[j,f]=d.useState((typeof n=="string"?n:o)||(c==null?void 0:c.label)),S=typeof n=="string"?n:j,[u,x]=d.useState(e?v[0]:void 0),C=d.useRef(null),T=Dr(null),O=d.useRef(null),N=d.useRef({}),[V,K]=d.useState(!1);function B(a){return E?`${E}-${a}`:void 0}const P=()=>{K(!1),x(void 0)};kr(T.current,P);const $=({eventType:a})=>{K(!0),c&&requestAnimationFrame(()=>{x({...c,isSetByClickEvent:a==="CLICK"}),D(N.current[c.id])})},sr=a=>{if(l)return v.filter(m=>l(a,m));if(!a)return v;const p=a.toUpperCase().split(" ")||[];return v.filter(m=>p.every(h=>(m.value||m.label).toUpperCase().includes(h)))},H=a=>c&&(c==null?void 0:c.label)===a?v:sr(a),g=H(S),U=a=>{s==null||s(a),f(a)},D=a=>{var p;if(a){const m=a.getBoundingClientRect(),h=((p=O.current)==null?void 0:p.getBoundingClientRect())||{top:0,bottom:0};(m.top<h.top||m.bottom>h.bottom)&&a.scrollIntoView({block:"nearest"})}},G=a=>{var p;a&&((p=C.current)==null||p.focus(),U(a.label),R==null||R(a)),P()},or=a=>{const p=e&&!u?0:g.findIndex(h=>h&&(u==null?void 0:u.id)===h.id),m=g.length;return a==="ArrowDown"?g[(p??-1)+1]||g[0]:g[(p??m)-1]||g[m-1]},w=V&&(!!g.length||!!A),ur=a=>{!w&&$({eventType:"KEYBOARD"});const p=or(a);x(p),p&&D(N.current[p.id])},ir=a=>{switch(a.key){case"ArrowUp":case"ArrowDown":a.preventDefault(),ur(a.key);break;case"Enter":{const p=u||(e?v[0]:void 0);w&&G(p),!w&&$({eventType:"KEYBOARD"});break}case"Escape":case"Tab":P();break}},pr=a=>{const p=H(a.target.value);U(a.target.value),x(void 0),!w&&$({eventType:"KEYBOARD"}),e&&p[0]&&D(N.current[p[0].id])},lr=()=>{w?P():$({eventType:"CLICK"})},cr=()=>{var a;!V&&b&&$({eventType:"KEYBOARD"}),(a=C.current)==null||a.select()},dr={maxHeight:typeof t=="number"?`${t}px`:t},Y={"aria-label":r,"aria-expanded":w,"data-testid":B("listbox"),id:`${i}-listbox`,ref:O,onMouseLeave:()=>x(void 0),style:t?dr:void 0},z=a=>`${i}-listbox-item-${a.id}`,mr=(a,p)=>{const m=()=>a.id!==(u==null?void 0:u.id)&&x({...a,isSetByClickEvent:!0}),h=(a.id===(u==null?void 0:u.id)||!!e&&!u&&p===0)&&!(u!=null&&u.isSetByClickEvent);return{"data-testid":B(`listbox-item-${a.id}`),id:z(a),key:a.id,onMouseMove:m,onMouseUp:()=>G(a),ref:k=>k&&(N.current[a.id]=k),tabIndex:-1,selected:a.id===(c==null?void 0:c.id),disabled:a.disabled,highlighted:h,hovered:a.id===(u==null?void 0:u.id)&&!!(u!=null&&u.isSetByClickEvent)}},fr={"aria-activedescendant":u?z(u):void 0,"aria-autocomplete":"list","aria-controls":Y.id,"data-testid":B("input"),autoComplete:"off",id:`${i}-input`,onChange:pr,onMouseDown:lr,onFocus:cr,onKeyDown:ir,ref:C,role:"combobox",value:S};return{id:i,inputProps:fr,internalRef:T,optionsToShow:g,showListbox:w,noOptionsText:A,getListBoxItemProps:mr,listboxProps:Y}},M=X.bind(Br),y="purpur-listbox",ar=d.forwardRef(({children:e,...o},n)=>_.jsx("ul",{...o,ref:n,className:M(y,o.className),role:"listbox",children:d.Children.toArray(e).filter(Mr)}));ar.displayName="ListBox";const q=d.forwardRef((e,o)=>{const{disabled:n,highlighted:l,hovered:i,selected:r,children:t,noninteractive:s,...b}=e,A=M(`${y}-item`,b.className,{[`${y}-item--highlighted`]:l,[`${y}-item--selected`]:r,[`${y}-item--hovered`]:i,[`${y}-item--disabled`]:n,[`${y}-item--noninteractive`]:s});return _.jsxs("li",{...b,ref:o,className:A,"aria-selected":!!r,role:"option","aria-disabled":!!n,children:[typeof t=="string"?_.jsx(Cr,{children:t}):t,r&&_.jsx(Er,{svg:wr,size:"xs",className:M(`${y}-item__icon`)})]})});q.displayName="ListBoxItem";function Mr(e){return d.isValidElement(e)&&(e==null?void 0:e.type)===q}const qr=ar,Z=q,J=X.bind(hr),Q="purpur-autocomplete",Tr=({className:e,renderInput:o,renderOption:n,...l},i)=>{const{id:r,inputProps:t,internalRef:s,optionsToShow:b,showListbox:A,noOptionsText:R,getListBoxItemProps:v,listboxProps:c}=tr(l),E=(f,S)=>{const{key:u,...x}=v(f,S);return _.jsx(Z,{...x,children:n?n==null?void 0:n(f):f.label},u)},j=f=>{s.current=f,typeof i=="function"?i(f):i&&(i.current=f)};return _.jsxs("div",{id:r,ref:j,className:J([e,Q]),children:[o(t),A&&_.jsx(qr,{...c,className:J(`${Q}__listbox`),children:b.length?b.filter(f=>!!f).map(E):_.jsx(Z,{noninteractive:!0,children:R})})]})},nr=d.forwardRef(Tr);nr.displayName="Autocomplete";exports.Autocomplete=nr;exports.useAutocomplete=tr; | ||
//# sourceMappingURL=autocomplete.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import { jsx as y, jsxs as rr } from "react/jsx-runtime"; | ||
import { jsx as g, jsxs as rr } from "react/jsx-runtime"; | ||
import { useRef as S, useCallback as hr, useEffect as br, useState as M, forwardRef as q, Children as vr, isValidElement as xr } from "react"; | ||
@@ -120,3 +120,3 @@ function gr(t) { | ||
}), o = Er(l, J, `${J}--${i}`); | ||
return /* @__PURE__ */ y( | ||
return /* @__PURE__ */ g( | ||
"span", | ||
@@ -218,3 +218,3 @@ { | ||
]); | ||
return /* @__PURE__ */ y("p", { ...o, className: _, "data-testid": t, children: s }); | ||
return /* @__PURE__ */ g("p", { ...o, className: _, "data-testid": t, children: s }); | ||
}, Tr = { | ||
@@ -293,4 +293,4 @@ "purpur-listbox": "_purpur-listbox_qhoi7_1", | ||
return a === "ArrowDown" ? v[(p ?? -1) + 1] || v[0] : v[(p ?? d) - 1] || v[d - 1]; | ||
}, x = H && (!!v.length || !!w), ir = (a) => { | ||
!x && R({ eventType: "KEYBOARD" }); | ||
}, y = H && (!!v.length || !!w), ir = (a) => { | ||
!y && R({ eventType: "KEYBOARD" }); | ||
const p = ur(a); | ||
@@ -306,3 +306,3 @@ b(p), p && D(N.current[p.id]); | ||
const p = u || (t ? h[0] : void 0); | ||
x && z(p), !x && R({ eventType: "KEYBOARD" }); | ||
y && z(p), !y && R({ eventType: "KEYBOARD" }); | ||
break; | ||
@@ -317,5 +317,5 @@ } | ||
const p = G(a.target.value); | ||
Y(a.target.value), b(void 0), !x && R({ eventType: "KEYBOARD" }), t && p[0] && D(N.current[p[0].id]); | ||
Y(a.target.value), b(void 0), !y && R({ eventType: "KEYBOARD" }), t && p[0] && D(N.current[p[0].id]); | ||
}, cr = () => { | ||
x ? P() : R({ eventType: "CLICK" }); | ||
y ? P() : R({ eventType: "CLICK" }); | ||
}, dr = () => { | ||
@@ -328,3 +328,3 @@ var a; | ||
"aria-label": r, | ||
"aria-expanded": x, | ||
"aria-expanded": y, | ||
"data-testid": B("listbox"), | ||
@@ -354,3 +354,2 @@ id: `${i}-listbox`, | ||
"aria-controls": F.id, | ||
"aria-expanded": x, | ||
"data-testid": B("input"), | ||
@@ -372,3 +371,3 @@ autoComplete: "off", | ||
optionsToShow: v, | ||
showListbox: x, | ||
showListbox: y, | ||
noOptionsText: w, | ||
@@ -378,4 +377,4 @@ getListBoxItemProps: _r, | ||
}; | ||
}, j = er.bind(Tr), g = "purpur-listbox", or = q( | ||
({ children: t, ...s }, n) => /* @__PURE__ */ y( | ||
}, j = er.bind(Tr), x = "purpur-listbox", or = q( | ||
({ children: t, ...s }, n) => /* @__PURE__ */ g( | ||
"ul", | ||
@@ -385,3 +384,3 @@ { | ||
ref: n, | ||
className: j(g, s.className), | ||
className: j(x, s.className), | ||
role: "listbox", | ||
@@ -394,8 +393,8 @@ children: vr.toArray(t).filter(Hr) | ||
const T = q((t, s) => { | ||
const { disabled: n, highlighted: l, hovered: i, selected: r, children: e, noninteractive: o, ..._ } = t, w = j(`${g}-item`, _.className, { | ||
[`${g}-item--highlighted`]: l, | ||
[`${g}-item--selected`]: r, | ||
[`${g}-item--hovered`]: i, | ||
[`${g}-item--disabled`]: n, | ||
[`${g}-item--noninteractive`]: o | ||
const { disabled: n, highlighted: l, hovered: i, selected: r, children: e, noninteractive: o, ..._ } = t, w = j(`${x}-item`, _.className, { | ||
[`${x}-item--highlighted`]: l, | ||
[`${x}-item--selected`]: r, | ||
[`${x}-item--hovered`]: i, | ||
[`${x}-item--disabled`]: n, | ||
[`${x}-item--noninteractive`]: o | ||
}); | ||
@@ -412,4 +411,4 @@ return /* @__PURE__ */ rr( | ||
children: [ | ||
typeof e == "string" ? /* @__PURE__ */ y(qr, { children: e }) : e, | ||
r && /* @__PURE__ */ y(Br, { svg: Lr, size: "xs", className: j(`${g}-item__icon`) }) | ||
typeof e == "string" ? /* @__PURE__ */ g(qr, { children: e }) : e, | ||
r && /* @__PURE__ */ g(Br, { svg: Lr, size: "xs", className: j(`${x}-item__icon`) }) | ||
] | ||
@@ -435,3 +434,3 @@ } | ||
const { key: u, ...b } = h(m, E); | ||
return /* @__PURE__ */ y(Q, { ...b, children: n ? n == null ? void 0 : n(m) : m.label }, u); | ||
return /* @__PURE__ */ g(Q, { ...b, children: n ? n == null ? void 0 : n(m) : m.label }, u); | ||
}; | ||
@@ -442,3 +441,3 @@ return /* @__PURE__ */ rr("div", { id: r, ref: (m) => { | ||
s(e), | ||
w && /* @__PURE__ */ y(Ur, { ...c, className: W(`${X}__listbox`), children: _.length ? _.filter((m) => !!m).map(L) : /* @__PURE__ */ y(Q, { noninteractive: !0, children: A }) }) | ||
w && /* @__PURE__ */ g(Ur, { ...c, className: W(`${X}__listbox`), children: _.length ? _.filter((m) => !!m).map(L) : /* @__PURE__ */ g(Q, { noninteractive: !0, children: A }) }) | ||
] }); | ||
@@ -445,0 +444,0 @@ }, Yr = q(Gr); |
@@ -36,3 +36,3 @@ Name: classnames | ||
Name: @purpurds/icon | ||
Version: 5.4.0 | ||
Version: 5.4.1 | ||
License: AGPL-3.0-only | ||
@@ -44,4 +44,4 @@ Private: false | ||
Name: @purpurds/paragraph | ||
Version: 5.4.0 | ||
Version: 5.4.1 | ||
License: AGPL-3.0-only | ||
Private: false |
{ | ||
"name": "@purpurds/autocomplete", | ||
"version": "5.4.1", | ||
"version": "5.4.2", | ||
"license": "AGPL-3.0-only", | ||
@@ -18,5 +18,5 @@ "main": "./dist/autocomplete.cjs.js", | ||
"classnames": "~2.5.0", | ||
"@purpurds/icon": "5.4.1", | ||
"@purpurds/paragraph": "5.4.1", | ||
"@purpurds/tokens": "5.4.1" | ||
"@purpurds/tokens": "5.4.2", | ||
"@purpurds/icon": "5.4.2", | ||
"@purpurds/paragraph": "5.4.2" | ||
}, | ||
@@ -46,6 +46,6 @@ "devDependencies": { | ||
"vitest": "~1.5.0", | ||
"@purpurds/button": "5.4.1", | ||
"@purpurds/icon": "5.4.1", | ||
"@purpurds/text-field": "5.4.1", | ||
"@purpurds/search-field": "5.4.1", | ||
"@purpurds/button": "5.4.2", | ||
"@purpurds/icon": "5.4.2", | ||
"@purpurds/search-field": "5.4.2", | ||
"@purpurds/text-field": "5.4.2", | ||
"@purpurds/component-rig": "1.0.0" | ||
@@ -52,0 +52,0 @@ }, |
@@ -156,3 +156,2 @@ import { ComponentPropsWithRef, CSSProperties, ReactNode, useRef, useState } from "react"; | ||
optionRect.top < listboxRect.top || optionRect.bottom > listboxRect.bottom; | ||
if (isOptionOutsideView) { | ||
@@ -280,3 +279,2 @@ option.scrollIntoView({ block: "nearest" }); | ||
"aria-controls": listboxProps.id, | ||
"aria-expanded": showListbox, | ||
"data-testid": getTestId("input"), | ||
@@ -283,0 +281,0 @@ autoComplete: "off", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
993501
1675
+ Added@purpurds/icon@5.4.2(transitive)
+ Added@purpurds/paragraph@5.4.2(transitive)
+ Added@purpurds/tokens@5.4.2(transitive)
- Removed@purpurds/icon@5.4.1(transitive)
- Removed@purpurds/paragraph@5.4.1(transitive)
- Removed@purpurds/tokens@5.4.1(transitive)
Updated@purpurds/icon@5.4.2
Updated@purpurds/paragraph@5.4.2
Updated@purpurds/tokens@5.4.2