@contentful/f36-autocomplete
Advanced tools
Comparing version 4.0.1-next-v4-9320.2421 to 4.0.1-next-v4-9335.2422
@@ -1,2 +0,2 @@ | ||
import e from"@babel/runtime/helpers/esm/extends";import{cx as t,css as o}from"emotion";import a,{useState as n}from"react";import{useCombobox as s}from"downshift";import{mergeRefs as l}from"@contentful/f36-core";import{IconButton as i}from"@contentful/f36-button";import{TextInput as r}from"@contentful/f36-forms";import{ChevronDownIcon as c,CloseIcon as m}from"@contentful/f36-icons";import{SkeletonBodyText as p,SkeletonContainer as u}from"@contentful/f36-skeleton";import{Popover as d}from"@contentful/f36-popover";import g from"@contentful/f36-tokens";var f,b,h,y;f={},b="Autocomplete",h=()=>x,Object.defineProperty(f,b,{get:h,set:y,enumerable:!0,configurable:!0});function k(p,u){const{id:f,className:b,clearAfterSelect:h=!1,items:y,onFilter:k,onSelectItem:x,renderItem:C,itemToString:E=(e=>e),isInvalid:v,isDisabled:S,isRequired:w,isReadOnly:N,noMatchesMessage:R="No matches",placeholder:T="Search",inputRef:P,toggleRef:B,listRef:M,listWidth:O="auto",listMaxHeight:D=180,isLoading:$=!1,testId:z="cf-autocomplete"}=p,A=(e=>({autocomplete:o({name:"1jke4yk",styles:"position:relative;width:100%;"}),combobox:o({name:"79elbk",styles:"position:relative;"}),toggleButton:o({name:"1nbt92p",styles:"position:absolute;top:4px;right:4px;z-index:1;"}),list:o({overflowY:"auto",listStyle:"none",padding:`${g.spacingXs} 0`,margin:0,maxHeight:`${e}px`},""),item:o({display:"block",padding:`${g.spacingXs} ${g.spacingM}`,wordBreak:"break-word",whiteSpace:"break-spaces",cursor:"pointer",hyphens:"auto","&:focus, &:hover":{backgroundColor:g.gray100},"&:active":{backgroundColor:g.gray200}},""),disabled:o({name:"1e07izz",styles:"opacity:0.5;pointer-events:none;"}),highlighted:o({backgroundColor:g.gray100},"")}))(D),[F,H]=n(y),{getComboboxProps:V,getInputProps:j,getItemProps:q,getMenuProps:L,getToggleButtonProps:W,highlightedIndex:X,isOpen:K,setInputValue:Y,inputValue:G,toggleMenu:J}=s({items:F,itemToString:E,onStateChange:({inputValue:e,type:t,selectedItem:o})=>{switch(t){case s.stateChangeTypes.InputChange:{const t=y.filter((t=>k(t,e)));H(t);break}case s.stateChangeTypes.InputKeyDownEnter:case s.stateChangeTypes.ItemClick:o&&x(o),h&&Y("")}}}),{"aria-labelledby":Q,id:U,...Z}=j(),_=V(),ee=W(),te=L();return a.createElement("div",{"data-test-id":z,className:t(A.autocomplete,b),ref:u},a.createElement(d,{autoFocus:!1,usePortal:!1,isOpen:K,isFullWidth:"full"===O},a.createElement(d.Trigger,null,a.createElement("div",e({},_,{className:A.combobox}),a.createElement(r,e({},Z,{id:f,isInvalid:v,isDisabled:S,isRequired:w,isReadOnly:N,ref:l(Z.ref,P),testId:"cf-autocomplete-input",placeholder:T})),a.createElement(i,e({},ee,{ref:l(ee.ref,B),"aria-label":"toggle menu",className:A.toggleButton,variant:"transparent",icon:G?a.createElement(m,{"aria-label":"Clear"}):a.createElement(c,{"aria-label":"Show list"}),onClick:()=>{G?(Y(""),H(y)):J()},isDisabled:S,size:"small"})))),a.createElement(d.Content,null,a.createElement("ul",e({},te,{ref:l(te.ref,M),className:A.list,"data-test-id":"cf-autocomplete-list"}),$&&[...Array(3)].map(((e,o)=>a.createElement("li",{key:o,className:t(A.item,A.disabled)},a.createElement(I,null)))),!$&&0===F.length&&a.createElement("li",{className:t(A.item,A.disabled)},R),!$&&F.map(((o,n)=>{const s=q({item:o,index:n});return a.createElement("li",e({},s,{key:n,className:t([A.item,X===n&&A.highlighted]),"data-test-id":`cf-autocomplete-list-item-${n}`}),C?C(o):o)}))))))}function I(){return a.createElement(u,{svgHeight:16},a.createElement(p,{numberOfLines:1}))}const x=a.forwardRef(k);export{x as Autocomplete}; | ||
import e from"@babel/runtime/helpers/esm/extends";import{cx as t,css as o}from"emotion";import a,{useState as n}from"react";import{useCombobox as s}from"downshift";import{mergeRefs as l}from"@contentful/f36-core";import{IconButton as i}from"@contentful/f36-button";import{TextInput as r}from"@contentful/f36-forms";import{CloseIcon as c,ChevronDownIcon as m}from"@contentful/f36-icons";import{SkeletonContainer as p,SkeletonBodyText as u}from"@contentful/f36-skeleton";import{Popover as d}from"@contentful/f36-popover";import g from"@contentful/f36-tokens";var f,b,h,y;f={},b="Autocomplete",h=()=>x,Object.defineProperty(f,b,{get:h,set:y,enumerable:!0,configurable:!0});function k(p,u){const{id:f,className:b,clearAfterSelect:h=!1,items:y,onFilter:k,onSelectItem:x,renderItem:C,itemToString:E=(e=>e),isInvalid:v,isDisabled:S,isRequired:w,isReadOnly:N,noMatchesMessage:R="No matches",placeholder:T="Search",inputRef:P,toggleRef:B,listRef:M,listWidth:O="auto",listMaxHeight:D=180,isLoading:$=!1,testId:z="cf-autocomplete"}=p,A=(e=>({autocomplete:o({name:"1jke4yk",styles:"position:relative;width:100%;"}),combobox:o({name:"79elbk",styles:"position:relative;"}),toggleButton:o({name:"1nbt92p",styles:"position:absolute;top:4px;right:4px;z-index:1;"}),list:o({overflowY:"auto",listStyle:"none",padding:`${g.spacingXs} 0`,margin:0,maxHeight:`${e}px`},""),item:o({display:"block",padding:`${g.spacingXs} ${g.spacingM}`,wordBreak:"break-word",whiteSpace:"break-spaces",cursor:"pointer",hyphens:"auto","&:focus, &:hover":{backgroundColor:g.gray100},"&:active":{backgroundColor:g.gray200}},""),disabled:o({name:"1e07izz",styles:"opacity:0.5;pointer-events:none;"}),highlighted:o({backgroundColor:g.gray100},"")}))(D),[F,H]=n(y),{getComboboxProps:V,getInputProps:j,getItemProps:q,getMenuProps:L,getToggleButtonProps:W,highlightedIndex:X,isOpen:K,setInputValue:Y,inputValue:G,toggleMenu:J}=s({items:F,itemToString:E,onStateChange:({inputValue:e,type:t,selectedItem:o})=>{switch(t){case s.stateChangeTypes.InputChange:{const t=y.filter((t=>k(t,e)));H(t);break}case s.stateChangeTypes.InputKeyDownEnter:case s.stateChangeTypes.ItemClick:o&&x(o),h&&Y("")}}}),{"aria-labelledby":Q,id:U,...Z}=j(),_=V(),ee=W(),te=L();return a.createElement("div",{"data-test-id":z,className:t(A.autocomplete,b),ref:u},a.createElement(d,{autoFocus:!1,usePortal:!1,isOpen:K,isFullWidth:"full"===O},a.createElement(d.Trigger,null,a.createElement("div",e({},_,{className:A.combobox}),a.createElement(r,e({},Z,{id:f,isInvalid:v,isDisabled:S,isRequired:w,isReadOnly:N,ref:l(Z.ref,P),testId:"cf-autocomplete-input",placeholder:T})),a.createElement(i,e({},ee,{ref:l(ee.ref,B),"aria-label":"toggle menu",className:A.toggleButton,variant:"transparent",icon:G?a.createElement(c,{"aria-label":"Clear"}):a.createElement(m,{"aria-label":"Show list"}),onClick:()=>{G?(Y(""),H(y)):J()},isDisabled:S,size:"small"})))),a.createElement(d.Content,null,a.createElement("ul",e({},te,{ref:l(te.ref,M),className:A.list,"data-test-id":"cf-autocomplete-list"}),$&&[...Array(3)].map(((e,o)=>a.createElement("li",{key:o,className:t(A.item,A.disabled)},a.createElement(I,null)))),!$&&0===F.length&&a.createElement("li",{className:t(A.item,A.disabled)},R),!$&&F.map(((o,n)=>{const s=q({item:o,index:n});return a.createElement("li",e({},s,{key:n,className:t([A.item,X===n&&A.highlighted]),"data-test-id":`cf-autocomplete-list-item-${n}`}),C?C(o):o)}))))))}function I(){return a.createElement(p,{svgHeight:16},a.createElement(u,{numberOfLines:1}))}const x=a.forwardRef(k);export{x as Autocomplete}; | ||
//# sourceMappingURL=module.js.map |
{ | ||
"name": "@contentful/f36-autocomplete", | ||
"version": "4.0.1-next-v4-9320.2421+96dfad4f", | ||
"version": "4.0.1-next-v4-9335.2422+c74e3393", | ||
"description": "Forma 36: Autocomplete component", | ||
@@ -10,9 +10,9 @@ "scripts": { | ||
"@babel/runtime": "^7.6.2", | ||
"@contentful/f36-button": "4.0.1-next-v4-9320.2421+96dfad4f", | ||
"@contentful/f36-core": "4.0.1-next-v4-9320.2421+96dfad4f", | ||
"@contentful/f36-forms": "4.0.1-next-v4-9320.2421+96dfad4f", | ||
"@contentful/f36-icons": "4.0.1-next-v4-9320.2421+96dfad4f", | ||
"@contentful/f36-popover": "4.0.1-next-v4-9320.2421+96dfad4f", | ||
"@contentful/f36-skeleton": "4.0.1-next-v4-9320.2421+96dfad4f", | ||
"@contentful/f36-tokens": "4.0.1-next-v4-9320.2421+96dfad4f", | ||
"@contentful/f36-button": "4.0.1-next-v4-9335.2422+c74e3393", | ||
"@contentful/f36-core": "4.0.1-next-v4-9335.2422+c74e3393", | ||
"@contentful/f36-forms": "4.0.1-next-v4-9335.2422+c74e3393", | ||
"@contentful/f36-icons": "4.0.1-next-v4-9335.2422+c74e3393", | ||
"@contentful/f36-popover": "4.0.1-next-v4-9335.2422+c74e3393", | ||
"@contentful/f36-skeleton": "4.0.1-next-v4-9335.2422+c74e3393", | ||
"@contentful/f36-tokens": "4.0.1-next-v4-9335.2422+c74e3393", | ||
"downshift": "^6.1.7", | ||
@@ -42,3 +42,3 @@ "emotion": "^10.0.17" | ||
}, | ||
"gitHead": "96dfad4f76e42d3e8711f0b706b6060996a46fa1" | ||
"gitHead": "c74e3393850edf45dd54a7615034c70367452c3e" | ||
} |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Updated@contentful/f36-button@4.0.1-next-v4-9335.2422+c74e3393
Updated@contentful/f36-core@4.0.1-next-v4-9335.2422+c74e3393
Updated@contentful/f36-forms@4.0.1-next-v4-9335.2422+c74e3393
Updated@contentful/f36-icons@4.0.1-next-v4-9335.2422+c74e3393
Updated@contentful/f36-popover@4.0.1-next-v4-9335.2422+c74e3393
Updated@contentful/f36-skeleton@4.0.1-next-v4-9335.2422+c74e3393
Updated@contentful/f36-tokens@4.0.1-next-v4-9335.2422+c74e3393