Socket
Socket
Sign inDemoInstall

@reach/combobox

Package Overview
Dependencies
Maintainers
3
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reach/combobox - npm Package Compare versions

Comparing version 0.7.2 to 0.7.3

README.md

10

dist/combobox.cjs.development.js
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

@@ -168,3 +166,3 @@

/*#__PURE__*/
React.createContext({});
utils.createNamedContext("ComboboxContext", {});
/*

@@ -178,3 +176,3 @@ * Allows us to put the option's value on context so that ComboboxOptionText

/*#__PURE__*/
React.createContext(null); ////////////////////////////////////////////////////////////////////////////////
utils.createNamedContext("OptionContext", null); ////////////////////////////////////////////////////////////////////////////////

@@ -586,3 +584,3 @@ /**

}, [contextValue, value]);
return results.length ? results.map(function (result, index) {
return React__default.createElement(React__default.Fragment, null, results.length ? results.map(function (result, index) {
var str = value.slice(result.start, result.end);

@@ -594,3 +592,3 @@ return React__default.createElement("span", {

}, str);
}) : value;
}) : value);
}

@@ -597,0 +595,0 @@ ComboboxOptionText.displayName = "ComboboxOptionText"; ////////////////////////////////////////////////////////////////////////////////

2

dist/combobox.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),n=require("react"),o=e(n);require("prop-types");var a,r,i,u,s,l=require("@reach/utils"),c=require("highlight-words-core"),E=e(require("escape-regexp")),v=require("@reach/auto-id"),f=require("@reach/popover"),p=e(f),T="IDLE",_={initial:T,states:(a={},a.IDLE={on:(r={},r.BLUR=T,r.CLEAR=T,r.CHANGE="SUGGESTING",r.FOCUS="SUGGESTING",r.NAVIGATE="NAVIGATING",r.OPEN_WITH_BUTTON="SUGGESTING",r)},a.SUGGESTING={on:(i={},i.CHANGE="SUGGESTING",i.FOCUS="SUGGESTING",i.NAVIGATE="NAVIGATING",i.CLEAR=T,i.ESCAPE=T,i.BLUR=T,i.SELECT_WITH_CLICK=T,i.INTERACT="INTERACTING",i.CLOSE_WITH_BUTTON=T,i)},a.NAVIGATING={on:(u={},u.CHANGE="SUGGESTING",u.FOCUS="SUGGESTING",u.CLEAR=T,u.BLUR=T,u.ESCAPE=T,u.NAVIGATE="NAVIGATING",u.SELECT_WITH_KEYBOARD=T,u.CLOSE_WITH_BUTTON=T,u.INTERACT="INTERACTING",u)},a.INTERACTING={on:(s={},s.CHANGE="SUGGESTING",s.FOCUS="SUGGESTING",s.BLUR=T,s.ESCAPE=T,s.NAVIGATE="NAVIGATING",s.CLOSE_WITH_BUTTON=T,s.SELECT_WITH_CLICK=T,s)},a)},C=function(e,n){var o=t.__assign(t.__assign({},e),{lastEventType:n.type});switch(n.type){case"CHANGE":return t.__assign(t.__assign({},o),{navigationValue:null,value:n.value});case"NAVIGATE":case"OPEN_WITH_BUTTON":return t.__assign(t.__assign({},o),{navigationValue:N(o,n)});case"CLEAR":return t.__assign(t.__assign({},o),{value:"",navigationValue:null});case"BLUR":case"ESCAPE":return t.__assign(t.__assign({},o),{navigationValue:null});case"SELECT_WITH_CLICK":return t.__assign(t.__assign({},o),{value:n.value,navigationValue:null});case"SELECT_WITH_KEYBOARD":return t.__assign(t.__assign({},o),{value:e.navigationValue,navigationValue:null});case"CLOSE_WITH_BUTTON":return t.__assign(t.__assign({},o),{navigationValue:null});case"INTERACT":return o;case"FOCUS":return t.__assign(t.__assign({},o),{navigationValue:N(o,n)});default:return o}},d=["SUGGESTING","NAVIGATING","INTERACTING"],I=function(e){return d.includes(e)};function N(e,t){return t.value?t.value:t.persistSelection?e.value:null}var A=n.createContext({}),G=n.createContext(null),g=l.forwardRefWithAs((function(e,a){var r=e.onSelect,i=e.openOnFocus,u=void 0!==i&&i,s=e.children,c=e.as,E=void 0===c?"div":c,f=t.__rest(e,["onSelect","openOnFocus","children","as"]),p=n.useRef(null),T=n.useRef(),d=n.useRef(),N=n.useRef(),G=n.useRef(),g=n.useRef(),b=function(e,o,a){var r=n.useState(e.initial),i=r[0],u=r[1],s=n.useReducer(o,{value:"",navigationValue:null}),l=s[1];return[i,s[0],function(n,o){void 0===o&&(o={});var a=e.states[i],r=a&&a.on[n];if(!r)throw new Error('Unknown event "'+n+'" for state "'+i+'"');l(t.__assign({type:n,state:i,nextState:i},o)),u(r)}]}(_,C),S=b[0],h=b[1],R=b[2];!function(e,t){n.useLayoutEffect((function(){"NAVIGATE"!==e&&"ESCAPE"!==e&&"SELECT_WITH_CLICK"!==e&&"OPEN_WITH_BUTTON"!==e||t.current.focus()}),[e])}(h.lastEventType,T);var x=v.useId(f.id),m=x?l.makeId("listbox",x):"listbox",O={autocompletePropRef:G,buttonRef:N,data:h,inputRef:T,isVisible:I(S),listboxId:m,onSelect:r,openOnFocus:u,optionsRef:p,persistSelectionRef:g,popoverRef:d,state:S,transition:R};return n.useEffect((function(){return l.checkStyles("combobox")}),[]),o.createElement(A.Provider,{value:O},o.createElement(E,t.__assign({},f,{"data-reach-combobox":"",ref:a,role:"combobox","aria-haspopup":"listbox","aria-owns":m,"aria-expanded":O.isVisible}),s))}));g.displayName="Combobox";var b=l.forwardRefWithAs((function(e,a){var r=e.as,i=void 0===r?"input":r,u=e.selectOnClick,s=void 0!==u&&u,c=e.autocomplete,E=void 0===c||c,v=e.onClick,f=e.onChange,p=e.onKeyDown,T=e.onBlur,_=e.onFocus,C=e.value,d=t.__rest(e,["as","selectOnClick","autocomplete","onClick","onChange","onKeyDown","onBlur","onFocus","value"]),I=n.useContext(A),N=I.data,G=N.navigationValue,g=N.value,b=N.lastEventType,S=I.inputRef,h=I.state,R=I.transition,x=I.listboxId,m=I.autocompletePropRef,w=I.openOnFocus,U=l.useForkedRef(S,a),y=n.useRef(!1),B=O(),H=L(),W=null!=C;n.useLayoutEffect((function(){m.current=E}),[E]);var k=function(e){""===e.trim()?R("CLEAR"):R("CHANGE",{value:e})};return W&&C!==g&&k(C),o.createElement(i,t.__assign({},d,{"data-reach-combobox-input":"",ref:U,value:(!E||"NAVIGATING"!==h&&"INTERACTING"!==h?C||g:G||C||g)||"",onClick:l.wrapEvent(v,(function(){y.current&&(y.current=!1,S.current.select())})),onBlur:l.wrapEvent(T,H),onFocus:l.wrapEvent(_,(function(){s&&(y.current=!0),w&&"SELECT_WITH_CLICK"!==b&&R("FOCUS")})),onChange:l.wrapEvent(f,(function(e){W||k(e.target.value)})),onKeyDown:l.wrapEvent(p,B),id:x,"aria-autocomplete":"both","aria-activedescendant":G?String(V(G)):void 0}))}));b.displayName="ComboboxInput";var S=n.forwardRef((function(e,a){var r=e.children,i=e.portal,u=void 0===i||i,s=e.onKeyDown,c=e.onBlur,E=t.__rest(e,["children","portal","onKeyDown","onBlur"]),v=n.useContext(A),T=v.inputRef,_=v.isVisible,C=l.useForkedRef(v.popoverRef,a),d=O(),I=L(),N={"data-reach-combobox-popover":"",onKeyDown:l.wrapEvent(s,d),onBlur:l.wrapEvent(c,I),hidden:!_,tabIndex:-1,children:r};return u?o.createElement(p,t.__assign({},E,{ref:C,position:f.positionMatchWidth,targetRef:T},N)):o.createElement("div",t.__assign({ref:C},E,N))}));S.displayName="ComboboxPopover";var h=l.forwardRefWithAs((function(e,a){var r=e.persistSelection,i=void 0!==r&&r,u=e.as,s=void 0===u?"ul":u,l=t.__rest(e,["persistSelection","as"]),c=n.useContext(A),E=c.optionsRef;return i&&(c.persistSelectionRef.current=!0),n.useLayoutEffect((function(){return E.current=[],function(){E.current=[]}})),o.createElement(s,t.__assign({},l,{ref:a,"data-reach-combobox-list":"",role:"listbox"}))}));h.displayName="ComboboxList";var R=n.forwardRef((function(e,a){var r=e.children,i=e.value,u=e.onClick,s=t.__rest(e,["children","value","onClick"]),c=n.useContext(A),E=c.onSelect,v=c.data.navigationValue,f=c.transition,p=c.optionsRef;n.useEffect((function(){p.current.push(i)}));var T=v===i;return o.createElement(G.Provider,{value:i},o.createElement("li",t.__assign({},s,{"data-reach-combobox-option":"",ref:a,id:String(V(i)),role:"option","aria-selected":T,"data-highlighted":T?"":void 0,tabIndex:-1,onClick:l.wrapEvent(u,(function(){E&&E(i),f("SELECT_WITH_CLICK",{value:i})})),children:r||o.createElement(x,null)})))}));function x(){var e=n.useContext(G),t=n.useContext(A).data.value,a=n.useMemo((function(){return c.findAll({searchWords:E(t||"").split(/\s+/),textToHighlight:e})}),[t,e]);return a.length?a.map((function(t,n){var a=e.slice(t.start,t.end);return o.createElement("span",{key:n,"data-user-value":!!t.highlight||void 0,"data-suggested-value":!t.highlight||void 0},a)})):e}R.displayName="ComboboxOption",x.displayName="ComboboxOptionText";var m=l.forwardRefWithAs((function(e,a){var r=e.as,i=void 0===r?"button":r,u=e.onClick,s=e.onKeyDown,c=t.__rest(e,["as","onClick","onKeyDown"]),E=n.useContext(A),v=E.transition,f=E.state,p=E.listboxId,_=E.isVisible,C=l.useForkedRef(E.buttonRef,a),d=O();return o.createElement(i,t.__assign({"data-reach-combobox-button":"","aria-controls":p,"aria-haspopup":"listbox","aria-expanded":_,ref:C,onClick:l.wrapEvent(u,(function(){v(f===T?"OPEN_WITH_BUTTON":"CLOSE_WITH_BUTTON")})),onKeyDown:l.wrapEvent(s,d)},c))}));function O(){var e=n.useContext(A),t=e.data.navigationValue,o=e.onSelect,a=e.optionsRef,r=e.state,i=e.transition,u=e.autocompletePropRef,s=e.persistSelectionRef;return function(e){var n=a.current;switch(e.key){case"ArrowDown":if(e.preventDefault(),!n||0===n.length)return;r===T?i("NAVIGATE",{persistSelection:s.current}):(l=n.indexOf(t))===n.length-1?i("NAVIGATE",u.current?{value:null}:{value:n[0]}):i("NAVIGATE",{value:n[(l+1)%n.length]});break;case"ArrowUp":if(e.preventDefault(),!n||0===n.length)return;var l;r===T?i("NAVIGATE"):0===(l=n.indexOf(t))?i("NAVIGATE",u.current?{value:null}:{value:n[n.length-1]}):i("NAVIGATE",-1===l?{value:n.length?n[n.length-1]:null}:{value:n[(l-1+n.length)%n.length]});break;case"Escape":r!==T&&i("ESCAPE");break;case"Enter":"NAVIGATING"===r&&null!==t&&(e.preventDefault(),o&&o(t),i("SELECT_WITH_KEYBOARD"))}}}function L(){var e=n.useContext(A),t=e.state,o=e.transition,a=e.popoverRef,r=e.inputRef,i=e.buttonRef;return function(){requestAnimationFrame((function(){document.activeElement!==r.current&&document.activeElement!==i.current&&a.current&&(a.current.contains(document.activeElement)?"INTERACTING"!==t&&o("INTERACT"):o("BLUR"))}))}}m.displayName="ComboboxButton";var V=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return t};exports.Combobox=g,exports.ComboboxButton=m,exports.ComboboxInput=b,exports.ComboboxList=h,exports.ComboboxOption=R,exports.ComboboxOptionText=x,exports.ComboboxPopover=S;
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("tslib"),n=require("react"),o=e(n);require("prop-types");var a,r,i,u,s,l=require("@reach/utils"),c=require("highlight-words-core"),E=e(require("escape-regexp")),v=require("@reach/auto-id"),f=require("@reach/popover"),p=e(f),C="IDLE",T={initial:C,states:(a={},a.IDLE={on:(r={},r.BLUR=C,r.CLEAR=C,r.CHANGE="SUGGESTING",r.FOCUS="SUGGESTING",r.NAVIGATE="NAVIGATING",r.OPEN_WITH_BUTTON="SUGGESTING",r)},a.SUGGESTING={on:(i={},i.CHANGE="SUGGESTING",i.FOCUS="SUGGESTING",i.NAVIGATE="NAVIGATING",i.CLEAR=C,i.ESCAPE=C,i.BLUR=C,i.SELECT_WITH_CLICK=C,i.INTERACT="INTERACTING",i.CLOSE_WITH_BUTTON=C,i)},a.NAVIGATING={on:(u={},u.CHANGE="SUGGESTING",u.FOCUS="SUGGESTING",u.CLEAR=C,u.BLUR=C,u.ESCAPE=C,u.NAVIGATE="NAVIGATING",u.SELECT_WITH_KEYBOARD=C,u.CLOSE_WITH_BUTTON=C,u.INTERACT="INTERACTING",u)},a.INTERACTING={on:(s={},s.CHANGE="SUGGESTING",s.FOCUS="SUGGESTING",s.BLUR=C,s.ESCAPE=C,s.NAVIGATE="NAVIGATING",s.CLOSE_WITH_BUTTON=C,s.SELECT_WITH_CLICK=C,s)},a)},_=function(e,n){var o=t.__assign(t.__assign({},e),{lastEventType:n.type});switch(n.type){case"CHANGE":return t.__assign(t.__assign({},o),{navigationValue:null,value:n.value});case"NAVIGATE":case"OPEN_WITH_BUTTON":return t.__assign(t.__assign({},o),{navigationValue:N(o,n)});case"CLEAR":return t.__assign(t.__assign({},o),{value:"",navigationValue:null});case"BLUR":case"ESCAPE":return t.__assign(t.__assign({},o),{navigationValue:null});case"SELECT_WITH_CLICK":return t.__assign(t.__assign({},o),{value:n.value,navigationValue:null});case"SELECT_WITH_KEYBOARD":return t.__assign(t.__assign({},o),{value:e.navigationValue,navigationValue:null});case"CLOSE_WITH_BUTTON":return t.__assign(t.__assign({},o),{navigationValue:null});case"INTERACT":return o;case"FOCUS":return t.__assign(t.__assign({},o),{navigationValue:N(o,n)});default:return o}},d=["SUGGESTING","NAVIGATING","INTERACTING"],I=function(e){return d.includes(e)};function N(e,t){return t.value?t.value:t.persistSelection?e.value:null}var A=l.createNamedContext("ComboboxContext",{}),G=l.createNamedContext("OptionContext",null),g=l.forwardRefWithAs((function(e,a){var r=e.onSelect,i=e.openOnFocus,u=void 0!==i&&i,s=e.children,c=e.as,E=void 0===c?"div":c,f=t.__rest(e,["onSelect","openOnFocus","children","as"]),p=n.useRef(null),C=n.useRef(),d=n.useRef(),N=n.useRef(),G=n.useRef(),g=n.useRef(),b=function(e,o,a){var r=n.useState(e.initial),i=r[0],u=r[1],s=n.useReducer(o,{value:"",navigationValue:null}),l=s[1];return[i,s[0],function(n,o){void 0===o&&(o={});var a=e.states[i],r=a&&a.on[n];if(!r)throw new Error('Unknown event "'+n+'" for state "'+i+'"');l(t.__assign({type:n,state:i,nextState:i},o)),u(r)}]}(T,_),S=b[0],h=b[1],m=b[2];!function(e,t){n.useLayoutEffect((function(){"NAVIGATE"!==e&&"ESCAPE"!==e&&"SELECT_WITH_CLICK"!==e&&"OPEN_WITH_BUTTON"!==e||t.current.focus()}),[e])}(h.lastEventType,C);var x=v.useId(f.id),R=x?l.makeId("listbox",x):"listbox",O={autocompletePropRef:G,buttonRef:N,data:h,inputRef:C,isVisible:I(S),listboxId:R,onSelect:r,openOnFocus:u,optionsRef:p,persistSelectionRef:g,popoverRef:d,state:S,transition:m};return n.useEffect((function(){return l.checkStyles("combobox")}),[]),o.createElement(A.Provider,{value:O},o.createElement(E,t.__assign({},f,{"data-reach-combobox":"",ref:a,role:"combobox","aria-haspopup":"listbox","aria-owns":R,"aria-expanded":O.isVisible}),s))}));g.displayName="Combobox";var b=l.forwardRefWithAs((function(e,a){var r=e.as,i=void 0===r?"input":r,u=e.selectOnClick,s=void 0!==u&&u,c=e.autocomplete,E=void 0===c||c,v=e.onClick,f=e.onChange,p=e.onKeyDown,C=e.onBlur,T=e.onFocus,_=e.value,d=t.__rest(e,["as","selectOnClick","autocomplete","onClick","onChange","onKeyDown","onBlur","onFocus","value"]),I=n.useContext(A),N=I.data,G=N.navigationValue,g=N.value,b=N.lastEventType,S=I.inputRef,h=I.state,m=I.transition,x=I.listboxId,R=I.autocompletePropRef,w=I.openOnFocus,U=l.useForkedRef(S,a),y=n.useRef(!1),B=O(),H=L(),W=null!=_;n.useLayoutEffect((function(){R.current=E}),[E]);var k=function(e){""===e.trim()?m("CLEAR"):m("CHANGE",{value:e})};return W&&_!==g&&k(_),o.createElement(i,t.__assign({},d,{"data-reach-combobox-input":"",ref:U,value:(!E||"NAVIGATING"!==h&&"INTERACTING"!==h?_||g:G||_||g)||"",onClick:l.wrapEvent(v,(function(){y.current&&(y.current=!1,S.current.select())})),onBlur:l.wrapEvent(C,H),onFocus:l.wrapEvent(T,(function(){s&&(y.current=!0),w&&"SELECT_WITH_CLICK"!==b&&m("FOCUS")})),onChange:l.wrapEvent(f,(function(e){W||k(e.target.value)})),onKeyDown:l.wrapEvent(p,B),id:x,"aria-autocomplete":"both","aria-activedescendant":G?String(V(G)):void 0}))}));b.displayName="ComboboxInput";var S=n.forwardRef((function(e,a){var r=e.children,i=e.portal,u=void 0===i||i,s=e.onKeyDown,c=e.onBlur,E=t.__rest(e,["children","portal","onKeyDown","onBlur"]),v=n.useContext(A),C=v.inputRef,T=v.isVisible,_=l.useForkedRef(v.popoverRef,a),d=O(),I=L(),N={"data-reach-combobox-popover":"",onKeyDown:l.wrapEvent(s,d),onBlur:l.wrapEvent(c,I),hidden:!T,tabIndex:-1,children:r};return u?o.createElement(p,t.__assign({},E,{ref:_,position:f.positionMatchWidth,targetRef:C},N)):o.createElement("div",t.__assign({ref:_},E,N))}));S.displayName="ComboboxPopover";var h=l.forwardRefWithAs((function(e,a){var r=e.persistSelection,i=void 0!==r&&r,u=e.as,s=void 0===u?"ul":u,l=t.__rest(e,["persistSelection","as"]),c=n.useContext(A),E=c.optionsRef;return i&&(c.persistSelectionRef.current=!0),n.useLayoutEffect((function(){return E.current=[],function(){E.current=[]}})),o.createElement(s,t.__assign({},l,{ref:a,"data-reach-combobox-list":"",role:"listbox"}))}));h.displayName="ComboboxList";var m=n.forwardRef((function(e,a){var r=e.children,i=e.value,u=e.onClick,s=t.__rest(e,["children","value","onClick"]),c=n.useContext(A),E=c.onSelect,v=c.data.navigationValue,f=c.transition,p=c.optionsRef;n.useEffect((function(){p.current.push(i)}));var C=v===i;return o.createElement(G.Provider,{value:i},o.createElement("li",t.__assign({},s,{"data-reach-combobox-option":"",ref:a,id:String(V(i)),role:"option","aria-selected":C,"data-highlighted":C?"":void 0,tabIndex:-1,onClick:l.wrapEvent(u,(function(){E&&E(i),f("SELECT_WITH_CLICK",{value:i})})),children:r||o.createElement(x,null)})))}));function x(){var e=n.useContext(G),t=n.useContext(A).data.value,a=n.useMemo((function(){return c.findAll({searchWords:E(t||"").split(/\s+/),textToHighlight:e})}),[t,e]);return o.createElement(o.Fragment,null,a.length?a.map((function(t,n){var a=e.slice(t.start,t.end);return o.createElement("span",{key:n,"data-user-value":!!t.highlight||void 0,"data-suggested-value":!t.highlight||void 0},a)})):e)}m.displayName="ComboboxOption",x.displayName="ComboboxOptionText";var R=l.forwardRefWithAs((function(e,a){var r=e.as,i=void 0===r?"button":r,u=e.onClick,s=e.onKeyDown,c=t.__rest(e,["as","onClick","onKeyDown"]),E=n.useContext(A),v=E.transition,f=E.state,p=E.listboxId,T=E.isVisible,_=l.useForkedRef(E.buttonRef,a),d=O();return o.createElement(i,t.__assign({"data-reach-combobox-button":"","aria-controls":p,"aria-haspopup":"listbox","aria-expanded":T,ref:_,onClick:l.wrapEvent(u,(function(){v(f===C?"OPEN_WITH_BUTTON":"CLOSE_WITH_BUTTON")})),onKeyDown:l.wrapEvent(s,d)},c))}));function O(){var e=n.useContext(A),t=e.data.navigationValue,o=e.onSelect,a=e.optionsRef,r=e.state,i=e.transition,u=e.autocompletePropRef,s=e.persistSelectionRef;return function(e){var n=a.current;switch(e.key){case"ArrowDown":if(e.preventDefault(),!n||0===n.length)return;r===C?i("NAVIGATE",{persistSelection:s.current}):(l=n.indexOf(t))===n.length-1?i("NAVIGATE",u.current?{value:null}:{value:n[0]}):i("NAVIGATE",{value:n[(l+1)%n.length]});break;case"ArrowUp":if(e.preventDefault(),!n||0===n.length)return;var l;r===C?i("NAVIGATE"):0===(l=n.indexOf(t))?i("NAVIGATE",u.current?{value:null}:{value:n[n.length-1]}):i("NAVIGATE",-1===l?{value:n.length?n[n.length-1]:null}:{value:n[(l-1+n.length)%n.length]});break;case"Escape":r!==C&&i("ESCAPE");break;case"Enter":"NAVIGATING"===r&&null!==t&&(e.preventDefault(),o&&o(t),i("SELECT_WITH_KEYBOARD"))}}}function L(){var e=n.useContext(A),t=e.state,o=e.transition,a=e.popoverRef,r=e.inputRef,i=e.buttonRef;return function(){requestAnimationFrame((function(){document.activeElement!==r.current&&document.activeElement!==i.current&&a.current&&(a.current.contains(document.activeElement)?"INTERACTING"!==t&&o("INTERACT"):o("BLUR"))}))}}R.displayName="ComboboxButton";var V=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return t};exports.Combobox=g,exports.ComboboxButton=R,exports.ComboboxInput=b,exports.ComboboxList=h,exports.ComboboxOption=m,exports.ComboboxOptionText=x,exports.ComboboxPopover=S;
//# sourceMappingURL=combobox.cjs.production.min.js.map
import { __rest, __assign } from 'tslib';
import React, { useRef, useEffect, useContext, useLayoutEffect, forwardRef, useMemo, useState, useReducer, createContext } from 'react';
import React, { useRef, useEffect, useContext, useLayoutEffect, forwardRef, useMemo, useState, useReducer } from 'react';
import PropTypes from 'prop-types';
import { forwardRefWithAs, makeId, checkStyles, useForkedRef, wrapEvent } from '@reach/utils';
import { forwardRefWithAs, makeId, checkStyles, useForkedRef, wrapEvent, createNamedContext } from '@reach/utils';
import { findAll } from 'highlight-words-core';

@@ -160,3 +160,3 @@ import escapeRegexp from 'escape-regexp';

/*#__PURE__*/
createContext({});
createNamedContext("ComboboxContext", {});
/*

@@ -170,3 +170,3 @@ * Allows us to put the option's value on context so that ComboboxOptionText

/*#__PURE__*/
createContext(null); ////////////////////////////////////////////////////////////////////////////////
createNamedContext("OptionContext", null); ////////////////////////////////////////////////////////////////////////////////

@@ -578,3 +578,3 @@ /**

}, [contextValue, value]);
return results.length ? results.map(function (result, index) {
return React.createElement(React.Fragment, null, results.length ? results.map(function (result, index) {
var str = value.slice(result.start, result.end);

@@ -586,3 +586,3 @@ return React.createElement("span", {

}, str);
}) : value;
}) : value);
}

@@ -589,0 +589,0 @@ ComboboxOptionText.displayName = "ComboboxOptionText"; ////////////////////////////////////////////////////////////////////////////////

@@ -202,3 +202,3 @@ /**

*/
export declare function ComboboxOptionText(): string | JSX.Element[];
export declare function ComboboxOptionText(): JSX.Element;
export declare namespace ComboboxOptionText {

@@ -205,0 +205,0 @@ var displayName: string;

{
"name": "@reach/combobox",
"version": "0.7.2",
"version": "0.7.3",
"description": "Accessible React Combobox (Autocomplete).",

@@ -18,6 +18,6 @@ "author": "React Training <hello@reacttraining.com>",

"dependencies": {
"@reach/auto-id": "^0.7.2",
"@reach/popover": "^0.7.2",
"@reach/portal": "^0.7.2",
"@reach/utils": "^0.7.2",
"@reach/auto-id": "^0.7.3",
"@reach/popover": "^0.7.3",
"@reach/portal": "^0.7.3",
"@reach/utils": "^0.7.3",
"escape-regexp": "0.0.1",

@@ -35,6 +35,7 @@ "highlight-words-core": "1.2.2",

"files": [
"README.md",
"dist",
"styles.css"
],
"gitHead": "96cf6c191cca0f2cbcb7ff578f15e289efeda1e2"
"gitHead": "fe739beb1d94cc58c4e72f88ab58efa58e0de8c8"
}

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

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