@contentful/f36-autocomplete
Advanced tools
Comparing version 4.0.1-next-v4-9745.2431 to 4.0.1-next-v4-9766.2432
@@ -1,2 +0,2 @@ | ||
var e=y(require("@babel/runtime/helpers/extends")),{cx:t,css:n}=require("emotion"),a=require("react"),r=y(a),{useCallback:o,useState:l}=a,{useCombobox:i}=require("downshift"),{mergeRefs:s}=require("@contentful/f36-core"),{IconButton:c}=require("@contentful/f36-button"),{TextInput:u}=require("@contentful/f36-forms"),{ChevronDownIcon:m,CloseIcon:p}=require("@contentful/f36-icons"),{SkeletonBodyText:d,SkeletonContainer:f}=require("@contentful/f36-skeleton"),{Popover:g}=require("@contentful/f36-popover"),b=y(require("@contentful/f36-tokens"));function h(e,t,n,a){Object.defineProperty(e,t,{get:n,set:a,enumerable:!0,configurable:!0})}function y(e){return e&&e.__esModule?e.default:e}var E={};function k(e,t){const n={before:"",match:"",after:""},a=new RegExp(`(?<before>.*?)(?<match>${t})(?<after>.*)`,"i"),r=e.match(a);return r&&(n.before=r.groups.before,n.match=r.groups.match,n.after=r.groups.after),n}h(E,"Autocomplete",(()=>I)),h(E,"getMatch",(()=>k));function v(a,d){const{id:f,className:h,clearAfterSelect:y=!1,items:E,onInputValueChange:k,onSelectItem:v,renderItem:I,itemToString:q=(e=>e),isInvalid:w,isDisabled:S,isRequired:R,isReadOnly:M,noMatchesMessage:N="No matches",placeholder:P="Search",inputRef:O,toggleRef:T,listRef:B,listWidth:V="auto",listMaxHeight:$=180,isLoading:D=!1,testId:j="cf-autocomplete"}=a,z=(e=>({autocomplete:n({name:"1jke4yk",styles:"position:relative;width:100%;"}),combobox:n({name:"79elbk",styles:"position:relative;"}),toggleButton:n({name:"1nbt92p",styles:"position:absolute;top:4px;right:4px;z-index:1;"}),list:n({overflowY:"auto",listStyle:"none",padding:`${b.spacingXs} 0`,margin:0,maxHeight:`${e}px`},""),item:n({display:"block",padding:`${b.spacingXs} ${b.spacingM}`,wordBreak:"break-word",whiteSpace:"break-spaces",cursor:"pointer",hyphens:"auto","&:focus, &:hover":{backgroundColor:b.gray100},"&:active":{backgroundColor:b.gray200}},""),disabled:n({name:"1e07izz",styles:"opacity:0.5;pointer-events:none;"}),highlighted:n({backgroundColor:b.gray100},"")}))($),[_,A]=l(""),F=o((e=>{A(e),null==k||k(e)}),[k]),{getComboboxProps:H,getInputProps:L,getItemProps:W,getMenuProps:X,getToggleButtonProps:K,highlightedIndex:Y,isOpen:G,toggleMenu:J}=i({items:E,inputValue:_,itemToString:q,onInputValueChange:({inputValue:e})=>{F(e)},onStateChange:({type:e,selectedItem:t})=>{switch(e){case i.stateChangeTypes.InputKeyDownEnter:case i.stateChangeTypes.ItemClick:t&&v(t),y&&F("")}}}),{"aria-labelledby":Q,id:U,...Z}=L(),ee=H(),te=K(),ne=X();return r.createElement("div",{"data-test-id":j,className:t(z.autocomplete,h),ref:d},r.createElement(g,{autoFocus:!1,usePortal:!1,isOpen:G,isFullWidth:"full"===V},r.createElement(g.Trigger,null,r.createElement("div",e({},ee,{className:z.combobox}),r.createElement(u,e({},Z,{id:f,isInvalid:w,isDisabled:S,isRequired:R,isReadOnly:M,ref:s(Z.ref,O),testId:"cf-autocomplete-input",placeholder:P})),r.createElement(c,e({},te,{ref:s(te.ref,T),"aria-label":"toggle menu",className:z.toggleButton,variant:"transparent",icon:_?r.createElement(p,{"aria-label":"Clear"}):r.createElement(m,{"aria-label":"Show list"}),onClick:()=>{_?F(""):J()},isDisabled:S,size:"small"})))),r.createElement(g.Content,null,r.createElement("ul",e({},ne,{ref:s(ne.ref,B),className:z.list,"data-test-id":"cf-autocomplete-list"}),D&&[...Array(3)].map(((e,n)=>r.createElement("li",{key:n,className:t(z.item,z.disabled)},r.createElement(C,null)))),!D&&0===E.length&&r.createElement("li",{className:t(z.item,z.disabled)},N),!D&&E.map(((n,a)=>{const o=W({item:n,index:a});return r.createElement("li",e({},o,{key:a,className:t([z.item,Y===a&&z.highlighted]),"data-test-id":`cf-autocomplete-list-item-${a}`}),I?I(n,_):"string"==typeof n?r.createElement(x,{item:n,inputValue:_}):n)}))))))}function x({item:e,inputValue:t}){const{before:n,match:a,after:o}=k(e,t);return r.createElement(r.Fragment,null,n,r.createElement("b",null,a),o)}function C(){return r.createElement(f,{svgHeight:16},r.createElement(d,{numberOfLines:1}))}const I=r.forwardRef(v);var q,w;q=module.exports,w=E,Object.keys(w).forEach((function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(q,e,{enumerable:!0,get:function(){return w[e]}})})); | ||
var e=y(require("@babel/runtime/helpers/extends")),{cx:t,css:n}=require("emotion"),a=require("react"),r=y(a),{useState:o,useCallback:l}=a,{useCombobox:i}=require("downshift"),{mergeRefs:s}=require("@contentful/f36-core"),{IconButton:c}=require("@contentful/f36-button"),{TextInput:u}=require("@contentful/f36-forms"),{ChevronDownIcon:m,CloseIcon:p}=require("@contentful/f36-icons"),{SkeletonContainer:d,SkeletonBodyText:f}=require("@contentful/f36-skeleton"),{Popover:g}=require("@contentful/f36-popover"),b=y(require("@contentful/f36-tokens"));function h(e,t,n,a){Object.defineProperty(e,t,{get:n,set:a,enumerable:!0,configurable:!0})}function y(e){return e&&e.__esModule?e.default:e}var E={};function k(e,t){const n={before:"",match:"",after:""},a=new RegExp(`(?<before>.*?)(?<match>${t})(?<after>.*)`,"i"),r=e.match(a);return r&&(n.before=r.groups.before,n.match=r.groups.match,n.after=r.groups.after),n}h(E,"Autocomplete",(()=>I)),h(E,"getMatch",(()=>k));function v(a,d){const{id:f,className:h,clearAfterSelect:y=!1,items:E,onInputValueChange:k,onSelectItem:v,renderItem:I,itemToString:q=(e=>e),isInvalid:w,isDisabled:S,isRequired:R,isReadOnly:M,noMatchesMessage:N="No matches",placeholder:P="Search",inputRef:O,toggleRef:T,listRef:B,listWidth:V="auto",listMaxHeight:$=180,isLoading:D=!1,testId:j="cf-autocomplete"}=a,z=(e=>({autocomplete:n({name:"1jke4yk",styles:"position:relative;width:100%;"}),combobox:n({name:"79elbk",styles:"position:relative;"}),toggleButton:n({name:"1nbt92p",styles:"position:absolute;top:4px;right:4px;z-index:1;"}),list:n({overflowY:"auto",listStyle:"none",padding:`${b.spacingXs} 0`,margin:0,maxHeight:`${e}px`},""),item:n({display:"block",padding:`${b.spacingXs} ${b.spacingM}`,wordBreak:"break-word",whiteSpace:"break-spaces",cursor:"pointer",hyphens:"auto","&:focus, &:hover":{backgroundColor:b.gray100},"&:active":{backgroundColor:b.gray200}},""),disabled:n({name:"1e07izz",styles:"opacity:0.5;pointer-events:none;"}),highlighted:n({backgroundColor:b.gray100},"")}))($),[_,A]=o(""),F=l((e=>{A(e),null==k||k(e)}),[k]),{getComboboxProps:H,getInputProps:L,getItemProps:W,getMenuProps:X,getToggleButtonProps:K,highlightedIndex:Y,isOpen:G,toggleMenu:J}=i({items:E,inputValue:_,itemToString:q,onInputValueChange:({inputValue:e})=>{F(e)},onStateChange:({type:e,selectedItem:t})=>{switch(e){case i.stateChangeTypes.InputKeyDownEnter:case i.stateChangeTypes.ItemClick:t&&v(t),y&&F("")}}}),{"aria-labelledby":Q,id:U,...Z}=L(),ee=H(),te=K(),ne=X();return r.createElement("div",{"data-test-id":j,className:t(z.autocomplete,h),ref:d},r.createElement(g,{autoFocus:!1,usePortal:!1,isOpen:G,isFullWidth:"full"===V},r.createElement(g.Trigger,null,r.createElement("div",e({},ee,{className:z.combobox}),r.createElement(u,e({},Z,{id:f,isInvalid:w,isDisabled:S,isRequired:R,isReadOnly:M,ref:s(Z.ref,O),testId:"cf-autocomplete-input",placeholder:P})),r.createElement(c,e({},te,{ref:s(te.ref,T),"aria-label":"toggle menu",className:z.toggleButton,variant:"transparent",icon:_?r.createElement(p,{"aria-label":"Clear"}):r.createElement(m,{"aria-label":"Show list"}),onClick:()=>{_?F(""):J()},isDisabled:S,size:"small"})))),r.createElement(g.Content,null,r.createElement("ul",e({},ne,{ref:s(ne.ref,B),className:z.list,"data-test-id":"cf-autocomplete-list"}),D&&[...Array(3)].map(((e,n)=>r.createElement("li",{key:n,className:t(z.item,z.disabled)},r.createElement(C,null)))),!D&&0===E.length&&r.createElement("li",{className:t(z.item,z.disabled)},N),!D&&E.map(((n,a)=>{const o=W({item:n,index:a});return r.createElement("li",e({},o,{key:a,className:t([z.item,Y===a&&z.highlighted]),"data-test-id":`cf-autocomplete-list-item-${a}`}),I?I(n,_):"string"==typeof n?r.createElement(x,{item:n,inputValue:_}):n)}))))))}function x({item:e,inputValue:t}){const{before:n,match:a,after:o}=k(e,t);return r.createElement(r.Fragment,null,n,r.createElement("b",null,a),o)}function C(){return r.createElement(d,{svgHeight:16},r.createElement(f,{numberOfLines:1}))}const I=r.forwardRef(v);var q,w;q=module.exports,w=E,Object.keys(w).forEach((function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(q,e,{enumerable:!0,get:function(){return w[e]}})})); | ||
//# sourceMappingURL=main.js.map |
@@ -1,2 +0,2 @@ | ||
import e from"@babel/runtime/helpers/esm/extends";import{cx as t,css as a}from"emotion";import o,{useState as n,useCallback as r}from"react";import{useCombobox as l}from"downshift";import{mergeRefs as s}from"@contentful/f36-core";import{IconButton as i}from"@contentful/f36-button";import{TextInput as c}from"@contentful/f36-forms";import{CloseIcon as m,ChevronDownIcon as u}from"@contentful/f36-icons";import{SkeletonContainer as p,SkeletonBodyText as f}from"@contentful/f36-skeleton";import{Popover as g}from"@contentful/f36-popover";import d from"@contentful/f36-tokens";function h(e,t,a,o){Object.defineProperty(e,t,{get:a,set:o,enumerable:!0,configurable:!0})}var b={};function y(e,t){const a={before:"",match:"",after:""},o=new RegExp(`(?<before>.*?)(?<match>${t})(?<after>.*)`,"i"),n=e.match(o);return n&&(a.before=n.groups.before,a.match=n.groups.match,a.after=n.groups.after),a}h(b,"Autocomplete",(()=>C)),h(b,"getMatch",(()=>y));function E(p,f){const{id:h,className:b,clearAfterSelect:y=!1,items:E,onInputValueChange:C,onSelectItem:I,renderItem:v,itemToString:w=(e=>e),isInvalid:S,isDisabled:R,isRequired:N,isReadOnly:M,noMatchesMessage:P="No matches",placeholder:T="Search",inputRef:B,toggleRef:O,listRef:V,listWidth:$="auto",listMaxHeight:D=180,isLoading:z=!1,testId:A="cf-autocomplete"}=p,F=(e=>({autocomplete:a({name:"1jke4yk",styles:"position:relative;width:100%;"}),combobox:a({name:"79elbk",styles:"position:relative;"}),toggleButton:a({name:"1nbt92p",styles:"position:absolute;top:4px;right:4px;z-index:1;"}),list:a({overflowY:"auto",listStyle:"none",padding:`${d.spacingXs} 0`,margin:0,maxHeight:`${e}px`},""),item:a({display:"block",padding:`${d.spacingXs} ${d.spacingM}`,wordBreak:"break-word",whiteSpace:"break-spaces",cursor:"pointer",hyphens:"auto","&:focus, &:hover":{backgroundColor:d.gray100},"&:active":{backgroundColor:d.gray200}},""),disabled:a({name:"1e07izz",styles:"opacity:0.5;pointer-events:none;"}),highlighted:a({backgroundColor:d.gray100},"")}))(D),[H,j]=n(""),q=r((e=>{j(e),null==C||C(e)}),[C]),{getComboboxProps:L,getInputProps:W,getItemProps:X,getMenuProps:K,getToggleButtonProps:Y,highlightedIndex:G,isOpen:J,toggleMenu:Q}=l({items:E,inputValue:H,itemToString:w,onInputValueChange:({inputValue:e})=>{q(e)},onStateChange:({type:e,selectedItem:t})=>{switch(e){case l.stateChangeTypes.InputKeyDownEnter:case l.stateChangeTypes.ItemClick:t&&I(t),y&&q("")}}}),{"aria-labelledby":U,id:Z,..._}=W(),ee=L(),te=Y(),ae=K();return o.createElement("div",{"data-test-id":A,className:t(F.autocomplete,b),ref:f},o.createElement(g,{autoFocus:!1,usePortal:!1,isOpen:J,isFullWidth:"full"===$},o.createElement(g.Trigger,null,o.createElement("div",e({},ee,{className:F.combobox}),o.createElement(c,e({},_,{id:h,isInvalid:S,isDisabled:R,isRequired:N,isReadOnly:M,ref:s(_.ref,B),testId:"cf-autocomplete-input",placeholder:T})),o.createElement(i,e({},te,{ref:s(te.ref,O),"aria-label":"toggle menu",className:F.toggleButton,variant:"transparent",icon:H?o.createElement(m,{"aria-label":"Clear"}):o.createElement(u,{"aria-label":"Show list"}),onClick:()=>{H?q(""):Q()},isDisabled:R,size:"small"})))),o.createElement(g.Content,null,o.createElement("ul",e({},ae,{ref:s(ae.ref,V),className:F.list,"data-test-id":"cf-autocomplete-list"}),z&&[...Array(3)].map(((e,a)=>o.createElement("li",{key:a,className:t(F.item,F.disabled)},o.createElement(x,null)))),!z&&0===E.length&&o.createElement("li",{className:t(F.item,F.disabled)},P),!z&&E.map(((a,n)=>{const r=X({item:a,index:n});return o.createElement("li",e({},r,{key:n,className:t([F.item,G===n&&F.highlighted]),"data-test-id":`cf-autocomplete-list-item-${n}`}),v?v(a,H):"string"==typeof a?o.createElement(k,{item:a,inputValue:H}):a)}))))))}function k({item:e,inputValue:t}){const{before:a,match:n,after:r}=y(e,t);return o.createElement(o.Fragment,null,a,o.createElement("b",null,n),r)}function x(){return o.createElement(p,{svgHeight:16},o.createElement(f,{numberOfLines:1}))}const C=o.forwardRef(E);export{C as Autocomplete,y as getMatch}; | ||
import e from"@babel/runtime/helpers/esm/extends";import{cx as t,css as a}from"emotion";import o,{useCallback as n,useState as r}from"react";import{useCombobox as l}from"downshift";import{mergeRefs as s}from"@contentful/f36-core";import{IconButton as i}from"@contentful/f36-button";import{TextInput as c}from"@contentful/f36-forms";import{ChevronDownIcon as m,CloseIcon as u}from"@contentful/f36-icons";import{SkeletonContainer as p,SkeletonBodyText as f}from"@contentful/f36-skeleton";import{Popover as g}from"@contentful/f36-popover";import d from"@contentful/f36-tokens";function h(e,t,a,o){Object.defineProperty(e,t,{get:a,set:o,enumerable:!0,configurable:!0})}var b={};function y(e,t){const a={before:"",match:"",after:""},o=new RegExp(`(?<before>.*?)(?<match>${t})(?<after>.*)`,"i"),n=e.match(o);return n&&(a.before=n.groups.before,a.match=n.groups.match,a.after=n.groups.after),a}h(b,"Autocomplete",(()=>C)),h(b,"getMatch",(()=>y));function E(p,f){const{id:h,className:b,clearAfterSelect:y=!1,items:E,onInputValueChange:C,onSelectItem:I,renderItem:v,itemToString:w=(e=>e),isInvalid:S,isDisabled:R,isRequired:N,isReadOnly:M,noMatchesMessage:P="No matches",placeholder:T="Search",inputRef:B,toggleRef:O,listRef:V,listWidth:$="auto",listMaxHeight:D=180,isLoading:z=!1,testId:A="cf-autocomplete"}=p,F=(e=>({autocomplete:a({name:"1jke4yk",styles:"position:relative;width:100%;"}),combobox:a({name:"79elbk",styles:"position:relative;"}),toggleButton:a({name:"1nbt92p",styles:"position:absolute;top:4px;right:4px;z-index:1;"}),list:a({overflowY:"auto",listStyle:"none",padding:`${d.spacingXs} 0`,margin:0,maxHeight:`${e}px`},""),item:a({display:"block",padding:`${d.spacingXs} ${d.spacingM}`,wordBreak:"break-word",whiteSpace:"break-spaces",cursor:"pointer",hyphens:"auto","&:focus, &:hover":{backgroundColor:d.gray100},"&:active":{backgroundColor:d.gray200}},""),disabled:a({name:"1e07izz",styles:"opacity:0.5;pointer-events:none;"}),highlighted:a({backgroundColor:d.gray100},"")}))(D),[H,j]=r(""),q=n((e=>{j(e),null==C||C(e)}),[C]),{getComboboxProps:L,getInputProps:W,getItemProps:X,getMenuProps:K,getToggleButtonProps:Y,highlightedIndex:G,isOpen:J,toggleMenu:Q}=l({items:E,inputValue:H,itemToString:w,onInputValueChange:({inputValue:e})=>{q(e)},onStateChange:({type:e,selectedItem:t})=>{switch(e){case l.stateChangeTypes.InputKeyDownEnter:case l.stateChangeTypes.ItemClick:t&&I(t),y&&q("")}}}),{"aria-labelledby":U,id:Z,..._}=W(),ee=L(),te=Y(),ae=K();return o.createElement("div",{"data-test-id":A,className:t(F.autocomplete,b),ref:f},o.createElement(g,{autoFocus:!1,usePortal:!1,isOpen:J,isFullWidth:"full"===$},o.createElement(g.Trigger,null,o.createElement("div",e({},ee,{className:F.combobox}),o.createElement(c,e({},_,{id:h,isInvalid:S,isDisabled:R,isRequired:N,isReadOnly:M,ref:s(_.ref,B),testId:"cf-autocomplete-input",placeholder:T})),o.createElement(i,e({},te,{ref:s(te.ref,O),"aria-label":"toggle menu",className:F.toggleButton,variant:"transparent",icon:H?o.createElement(u,{"aria-label":"Clear"}):o.createElement(m,{"aria-label":"Show list"}),onClick:()=>{H?q(""):Q()},isDisabled:R,size:"small"})))),o.createElement(g.Content,null,o.createElement("ul",e({},ae,{ref:s(ae.ref,V),className:F.list,"data-test-id":"cf-autocomplete-list"}),z&&[...Array(3)].map(((e,a)=>o.createElement("li",{key:a,className:t(F.item,F.disabled)},o.createElement(x,null)))),!z&&0===E.length&&o.createElement("li",{className:t(F.item,F.disabled)},P),!z&&E.map(((a,n)=>{const r=X({item:a,index:n});return o.createElement("li",e({},r,{key:n,className:t([F.item,G===n&&F.highlighted]),"data-test-id":`cf-autocomplete-list-item-${n}`}),v?v(a,H):"string"==typeof a?o.createElement(k,{item:a,inputValue:H}):a)}))))))}function k({item:e,inputValue:t}){const{before:a,match:n,after:r}=y(e,t);return o.createElement(o.Fragment,null,a,o.createElement("b",null,n),r)}function x(){return o.createElement(p,{svgHeight:16},o.createElement(f,{numberOfLines:1}))}const C=o.forwardRef(E);export{C as Autocomplete,y as getMatch}; | ||
//# sourceMappingURL=module.js.map |
import React from "react"; | ||
import { CommonProps } from "@contentful/f36-core"; | ||
import { TextInputProps } from "@contentful/f36-forms"; | ||
export function getMatch(item: string, inputValue: string): { | ||
interface MatchObj { | ||
before: string; | ||
match: string; | ||
after: string; | ||
}; | ||
} | ||
/** | ||
* Function that can be used to find a subsstring inside another string. | ||
* It needs two strings, the second one will be used in a Regex expression | ||
* to be matched to the first one. | ||
* The function will return an object containing the match, what comes before the match, | ||
* and what comes after the match in the base string | ||
* | ||
* @param base | ||
* @param match | ||
*/ | ||
export function getMatch(base: string, match: string): MatchObj; | ||
export interface AutocompleteProps<ItemType = any> extends CommonProps, Pick<TextInputProps, 'isDisabled' | 'isInvalid' | 'isReadOnly' | 'isRequired' | 'id'> { | ||
@@ -10,0 +21,0 @@ /** |
{ | ||
"name": "@contentful/f36-autocomplete", | ||
"version": "4.0.1-next-v4-9745.2431+840f6f33", | ||
"version": "4.0.1-next-v4-9766.2432+4c614c8e", | ||
"description": "Forma 36: Autocomplete component", | ||
@@ -10,9 +10,9 @@ "scripts": { | ||
"@babel/runtime": "^7.6.2", | ||
"@contentful/f36-button": "4.0.1-next-v4-9745.2431+840f6f33", | ||
"@contentful/f36-core": "4.0.1-next-v4-9745.2431+840f6f33", | ||
"@contentful/f36-forms": "4.0.1-next-v4-9745.2431+840f6f33", | ||
"@contentful/f36-icons": "4.0.1-next-v4-9745.2431+840f6f33", | ||
"@contentful/f36-popover": "4.0.1-next-v4-9745.2431+840f6f33", | ||
"@contentful/f36-skeleton": "4.0.1-next-v4-9745.2431+840f6f33", | ||
"@contentful/f36-tokens": "4.0.1-next-v4-9745.2431+840f6f33", | ||
"@contentful/f36-button": "4.0.1-next-v4-9766.2432+4c614c8e", | ||
"@contentful/f36-core": "4.0.1-next-v4-9766.2432+4c614c8e", | ||
"@contentful/f36-forms": "4.0.1-next-v4-9766.2432+4c614c8e", | ||
"@contentful/f36-icons": "4.0.1-next-v4-9766.2432+4c614c8e", | ||
"@contentful/f36-popover": "4.0.1-next-v4-9766.2432+4c614c8e", | ||
"@contentful/f36-skeleton": "4.0.1-next-v4-9766.2432+4c614c8e", | ||
"@contentful/f36-tokens": "4.0.1-next-v4-9766.2432+4c614c8e", | ||
"downshift": "^6.1.7", | ||
@@ -42,3 +42,3 @@ "emotion": "^10.0.17" | ||
}, | ||
"gitHead": "840f6f332ed8a46a33f5e066374b4c1fe64a4039" | ||
"gitHead": "4c614c8ef5bcb8c37a0d48f51d7eecc827b2e178" | ||
} |
@@ -1,9 +0,22 @@ | ||
export function getMatch(item: string, inputValue: string) { | ||
interface MatchObj { | ||
before: string; | ||
match: string; | ||
after: string; | ||
} | ||
/** | ||
* Function that can be used to find a subsstring inside another string. | ||
* It needs two strings, the second one will be used in a Regex expression | ||
* to be matched to the first one. | ||
* The function will return an object containing the match, what comes before the match, | ||
* and what comes after the match in the base string | ||
* | ||
* @param base | ||
* @param match | ||
*/ | ||
export function getMatch(base: string, match: string): MatchObj { | ||
const matchResult = { before: '', match: '', after: '' }; | ||
const regex = new RegExp( | ||
`(?<before>.*?)(?<match>${inputValue})(?<after>.*)`, | ||
'i', | ||
); | ||
const matches = item.match(regex); | ||
const regex = new RegExp(`(?<before>.*?)(?<match>${match})(?<after>.*)`, 'i'); | ||
const matches = base.match(regex); | ||
@@ -10,0 +23,0 @@ if (matches) { |
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
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
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
91488
499
Updated@contentful/f36-button@4.0.1-next-v4-9766.2432+4c614c8e
Updated@contentful/f36-core@4.0.1-next-v4-9766.2432+4c614c8e
Updated@contentful/f36-forms@4.0.1-next-v4-9766.2432+4c614c8e
Updated@contentful/f36-icons@4.0.1-next-v4-9766.2432+4c614c8e
Updated@contentful/f36-popover@4.0.1-next-v4-9766.2432+4c614c8e
Updated@contentful/f36-skeleton@4.0.1-next-v4-9766.2432+4c614c8e
Updated@contentful/f36-tokens@4.0.1-next-v4-9766.2432+4c614c8e