@redradix/components.select
Advanced tools
Comparing version 2.0.4 to 2.1.0
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react"),require("classnames"),require("react-select")):"function"==typeof define&&define.amd?define(["react","classnames","react-select"],r):"object"==typeof exports?exports.select=r(require("react"),require("classnames"),require("react-select")):(e.components=e.components||{},e.components.select=r(e.react,e.classnames,e["react-select"]))}(window,(function(e,r,n){return function(e){var r={};function n(t){if(r[t])return r[t].exports;var a=r[t]={i:t,l:!1,exports:{}};return e[t].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var a in e)n.d(t,a,function(r){return e[r]}.bind(null,a));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=3)}([function(r,n){r.exports=e},function(e,n){e.exports=r},function(e,r){e.exports=n},function(e,r,n){e.exports=n(4)},function(e,r,n){"use strict";n.r(r);var t=n(0),a=n.n(t),o=n(2),i=n.n(o);function l(e,r){if(null==e)return{};var n,t,a=function(e,r){if(null==e)return{};var n,t,a={},o=Object.keys(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function s(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var c=n(1),u=n.n(c);function d(){return(d=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}var p=a.a.createElement("title",{id:"close-title"},"Close icon"),f=a.a.createElement("desc",{id:"close-description"},"Close icon in svg"),m=a.a.createElement("path",{d:"M12 10.586l5.293-5.293a1 1 0 0 1 1.414 1.414L13.414 12l5.293 5.293a1 1 0 0 1-1.414 1.414L12 13.414l-5.293 5.293a1 1 0 1 1-1.414-1.414L10.586 12 5.293 6.707a1 1 0 0 1 1.414-1.414L12 10.586z"}),h=function(e){return a.a.createElement("svg",d({width:24,height:24,viewBox:"0 0 24 24","aria-labelledby":"close-title close-description",role:"img"},e),p,f,m)},b=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return"function"==typeof e&&e.apply(void 0,n)};function v(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function x(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?v(n,!0).forEach((function(r){s(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(n).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}var P=function(e){return!(e&&Object.keys(e).length)},w=function(e){return"dynamic"===e.componentsProps.behaviour&&P(e.value)},g=function(e){return e.placeholder!==e.componentsProps.label&&w(e)},O=a.a.createElement("span",{className:"rdx-icon--require"},"*"),y={ClearIndicator:function(e){var r=e.innerProps,n=e.selectProps;return b(n.componentsProps.renderClearIcon,x({},r,{className:"".concat("rdx-icon rdx-select-field-icon"," rdx-select-field-icon-clear")}))},Control:function(e){var r=e.selectProps,n=e.innerProps,t=e.innerRef,o=e.children;return a.a.createElement("div",Object.assign({"aria-expanded":r.menuIsOpen,className:"rdx-select-field-wrapper",ref:t},n),o,r.componentsProps.label&&a.a.createElement("label",{className:"rdx-select-field-label",htmlFor:r.id},r.componentsProps.label,r.componentsProps.isRequired?O:null))},DropdownIndicator:function(e){var r=e.selectProps,n=e.innerProps;return b(r.componentsProps.renderDownIcon,x({},n,{className:"".concat("rdx-icon rdx-select-field-icon"," rdx-select-field-icon-open")}))},IndicatorsContainer:function(e){var r=e.children;return a.a.createElement("div",{className:"rdx-select-field-icons-wrapper"},r)},IndicatorSeparator:function(){return null},Input:function(e){var r=e.selectProps,n=e.innerRef,t=e.isDisabled,o=l(e,["selectProps","innerRef","isDisabled"]),i=!P(r.value)&&r.componentsProps.searchHint,s=u()("rdx-select-field-select",{"is-hidden":!r.isMulti&&r.value});return a.a.createElement("input",Object.assign({className:s,disabled:t,ref:n},o,{placeholder:i?r.componentsProps.searchHint:void 0}))},Menu:function(e){var r=e.innerRef,n=e.innerProps,t=e.children;return a.a.createElement("div",Object.assign({className:"rdx-select-field-items",ref:r},n),t)},MenuList:function(e){var r=e.innerRef,n=e.children;return a.a.createElement("ul",{"aria-label":"submenu",ref:r},n)},MultiValue:function(e){var r=e.children,n=e.data,t=e.removeProps,o=e.isFocused,i=u()("rdx-select-field-tag",{"is-fixed":n.isFixed,"is-focused":o});return a.a.createElement("button",{className:i,tabIndex:-1},a.a.createElement("p",null,r),!n.isFixed&&a.a.createElement("div",Object.assign({className:"rdx-select-field-icon-close",role:"button"},t),a.a.createElement(h,{className:"rdx-icon rdx-icon-close"})))},Option:function(e){var r=e.data,n=e.selectProps,t=e.isFocused,o=e.innerRef,i=e.innerProps,l=e.label,s=e.value,c=(e.onOptionClick,!n.isMulti&&n.value&&s===n.value.value&&!n.isDisabled),d=u()("rdx-select-field-option",{"is-disabled":r.isDisabled,"is-link":r.isLink,"is-focused":t,"is-selected":c});return a.a.createElement("li",Object.assign({ref:o,className:d,"aria-selected":c,role:"option"},i),r.imgPath&&a.a.createElement("span",{className:"rdx-select-option-image-wrapper"},a.a.createElement("img",{className:"rdx-select-option-image",src:r.imgPath,alt:r.imgAlt})),r.renderIcon&&a.a.createElement("span",{className:"rdx-select-option-icon-wrapper"},b(r.renderIcon,{className:"rdx-select-option-icon"})),a.a.createElement("span",null,l))},Placeholder:function(e){var r=e.children,n=e.selectProps;return w(n)&&!g(n)?null:a.a.createElement("div",{className:"rdx-select-field-placeholder"},r,n.componentsProps.isRequired&&!n.componentsProps.label?O:null)},SelectContainer:function(e){var r=e.selectProps,n=e.innerProps,t=e.children,o=e.isFocused,i=u()("rdx-select-field rdx-select-field-".concat(r.componentsProps.appearance," is-custom"),{"has-error":r.componentsProps.hasError,"has-label":r.componentsProps.label,"has-width-fixed":"fixed"===r.componentsProps.widthBehaviour,"has-width-adaptative":"adaptative"===r.componentsProps.widthBehaviour,"has-height-fixed":"fixed"===r.componentsProps.heightBehaviour,"has-height-adaptative":"adaptative"===r.componentsProps.heightBehaviour,"has-width-full":"full"===r.componentsProps.widthBehaviour,"is-disabled":r.isDisabled,"is-dynamic":w(r),"is-fading":g(r),"is-focused":o,"is-multi":r.isMulti,"is-open-down":r.menuIsOpen&&"down"===r.componentsProps.dropDownPos,"is-open-up":r.menuIsOpen&&"up"===r.componentsProps.dropDownPos,"is-required":r.componentsProps.isRequired,"is-searchable":r.isSearchable,"is-touched":r.componentsProps.isTouched});return a.a.createElement("div",Object.assign({className:i},n),t,r.componentsProps.helperText&&!r.componentsProps.errorText?a.a.createElement("div",{className:"rdx-select-field-helper"},r.componentsProps.helperText):null,r.componentsProps.hasError&&!r.isDisabled?a.a.createElement("div",{className:"rdx-select-field-helper"},r.componentsProps.errorText):null)},SingleValue:function(e){var r=e.selectProps,n=e.children;return a.a.createElement(t.Fragment,null,r.options.map((function(e){return e.label===n?e.imgPath?a.a.createElement("span",{className:"rdx-select-option-image-wrapper",key:e.value},a.a.createElement("img",{className:"rdx-select-option-image",src:e.imgPath,alt:e.imgAlt})):e.renderIcon?a.a.createElement("span",{className:"rdx-select-option-icon-wrapper",key:e.value},b(e.renderIcon,{className:"rdx-icon rdx-select-option-icon"})):null:null})),a.a.createElement("div",{className:"rdx-select-field-value"},n))},ValueContainer:function(e){return e.children}};function E(){return(E=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}var j=a.a.createElement("title",{id:"chevron-down-title"},"Chevron down icon"),N=a.a.createElement("desc",{id:"chevron-down-description"},"Chevron down icon in svg"),D=a.a.createElement("path",{d:"M19.293 7.293a1 1 0 0 1 1.414 1.414l-8 8a1 1 0 0 1-1.414 0l-8-8a1 1 0 0 1 1.414-1.414L12 14.586l7.293-7.293z"}),C=function(e){return a.a.createElement("svg",E({width:24,height:24,viewBox:"0 0 24 24","aria-labelledby":"chevron-down-title chevron-down-description",role:"img"},e),j,N,D)};function B(){return(B=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}var I=a.a.createElement("title",{id:"delete-title"},"Delete icon"),S=a.a.createElement("desc",{id:"delete-description"},"Delete icon in svg"),M=a.a.createElement("path",{d:"M20.182 4C21.73 4 23 5.222 23 6.75v10.5c0 1.528-1.27 2.75-2.818 2.75H8.364a1 1 0 0 1-.74-.327l-6.364-7a1 1 0 0 1 0-1.346l6.364-7A1 1 0 0 1 8.364 4h11.818zM8.806 18h11.376c.46 0 .818-.345.818-.75V6.75c0-.405-.358-.75-.818-.75H8.806l-5.455 6 5.455 6zm9.912-3.697a1 1 0 1 1-1.415 1.415L15 13.414l-2.303 2.304a1 1 0 1 1-1.415-1.415L13.586 12l-2.293-2.293a1 1 0 1 1 1.414-1.414L15 10.586l2.293-2.293a1 1 0 0 1 1.414 1.414L16.414 12l2.304 2.303z"}),F=function(e){return a.a.createElement("svg",B({width:24,height:24,viewBox:"0 0 24 24","aria-labelledby":"delete-title delete-description",role:"img"},e),I,S,M)},T=function(e){var r=e.appearance,n=e.ariaLabel,t=e.autoFocus,o=e.behaviour,l=e.defaultIsOpen,s=e.dropDownPos,c=e.errorText,u=e.heightBehaviour,d=e.helperText,p=e.id,f=e.isDisabled,m=e.isMulti,h=e.isRequired,b=e.isSearchable,v=e.isTouched,x=e.label,P=e.name,w=e.onBlur,g=e.onChange,O=e.onClose,E=e.onFocus,j=e.onInputChange,N=e.onKeyDown,D=e.onOpen,C=e.options,B=e.placeholder,I=e.renderClearIcon,S=e.renderDownIcon,M=e.searchHint,F=e.value,T=e.widthBehaviour,q=c&&v;return a.a.createElement(i.a,{id:p,ariaLabel:n||x||p,autoFocus:t,defaultMenuIsOpen:l,placeholder:B,isDisabled:f,isMulti:m,isSearchable:b,name:P,options:C,value:F,isClearable:m&&F&&F.some((function(e){return!e.isFixed})),onBlur:w,onChange:function(e,r){var n=r.action,t=r.removedValue;switch(n){case"remove-value":case"pop-value":if(t.isFixed)return;break;case"clear":e=C.filter((function(e){return e.isFixed}))}g(e,{action:n,removedValue:t})},onClose:O,onFocus:E,onInputChange:j,onKeyDown:N,onOpen:D,components:y,componentsProps:{renderClearIcon:I,renderDownIcon:S,label:x,isRequired:h,hasError:q,behaviour:o,isTouched:v,heightBehaviour:u,widthBehaviour:T,appearance:r,dropDownPos:s,errorText:c,helperText:d,searchHint:M}})};T.defaultProps={appearance:"box",behaviour:"static",dropDownPos:"down",defaultIsOpen:!1,isSearchable:!0,renderDownIcon:function(e){return a.a.createElement(C,e)},renderClearIcon:function(e){return a.a.createElement(F,e)}};var q=T,k=function(e){return a.a.createElement(q,Object.assign({},e,{isSearchable:!1,isMulti:!0,behaviour:"static"}))};k.defaultProps={appearance:"box",dropDownPos:"down",defaultIsOpen:!1,renderClearIcon:function(){return null}};var L=k,R=function(e){return a.a.createElement(q,Object.assign({},e,{isSearchable:!1,isMulti:!1,behaviour:"static"}))};R.defaultProps={appearance:"box",dropDownPos:"down",defaultIsOpen:!1};var A=R;function V(e){return function(e){if(Array.isArray(e)){for(var r=0,n=new Array(e.length);r<e.length;r++)n[r]=e[r];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var z=function(e){var r=e.ariaLabel,n=e.autoComplete,t=e.autoFocus,o=e.hasError,i=e.id,l=e.isDisabled,s=e.isRequired,c=e.name,u=e.onBlur,d=e.onChange,p=e.onFocus,f=e.options,m=e.placeholder,h=e.value,b=m?[{label:m,isDisabled:!0,selected:!0}].concat(V(f)):f;return a.a.createElement("select",{"aria-invalid":o,"aria-label":r,autoComplete:n,autoFocus:t,className:"rdx-select-field-select",disabled:l,id:i,name:c,onBlur:u,onChange:function(e){return d(f.find((function(r){return r.value===e.target.value})))},onFocus:p,required:s,value:h&&h.value},b.map((function(e,r){var n=e.value,t=e.label,o=e.isDisabled,i=e.selected;return a.a.createElement("option",{key:r,selected:!!h&&n===h.value||i,value:n,disabled:o},t)})))};z.defaultProps={appearance:"box",autoComplete:"off"};var H=z,_=function(e){var r=e.appearance,n=e.ariaLabel,t=e.autoComplete,o=e.autoFocus,i=e.errorText,l=e.heightBehaviour,s=e.helperText,c=e.id,d=e.isDisabled,p=e.isRequired,f=e.isTouched,m=e.label,h=e.name,v=e.options,x=e.onBlur,P=e.onChange,w=e.onFocus,g=e.placeholder,O=e.renderDownIcon,y=e.value,E=e.widthBehaviour,j=Boolean(i&&f),N="rdx-icon rdx-select-field-icon-open",D=u()("rdx-select-field rdx-select-field-".concat(r," is-native"),{"has-error":j,"has-label":m,"has-width-adaptative":"adaptative"===E,"has-width-fixed":"fixed"===E,"has-width-full":"full"===E,"has-height-adaptative":"adaptative"===l,"has-height-fixed":"fixed"===l,"is-disabled":d,"is-required":p,"is-touched":f});return a.a.createElement("div",{className:D},a.a.createElement("div",{className:"rdx-select-field-wrapper"},a.a.createElement(H,{appearance:r,ariaLabel:n||m||h||c,autoComplete:t,autoFocus:o,hasError:j,id:c,isDisabled:d,isRequired:p,isTouched:f,name:h,onBlur:x,onChange:P,onFocus:w,options:v,placeholder:g,value:y}),m&&a.a.createElement("label",{className:"rdx-select-field-label",htmlFor:c},m),a.a.createElement("div",{className:"rdx-select-field-icons-wrapper"},b(O,{className:N})||a.a.createElement(C,{className:N}))),s&&!i?a.a.createElement("div",{className:"rdx-select-field-helper"},s):null,j&&!d?a.a.createElement("div",{className:"rdx-select-field-helper"},i):null)};_.defaultProps={appearance:"box",autoComplete:"off"};var W=_,K=function(e){return void 0!==e.useNative?e.useNative:/Mobi|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Opera Mobile|Kindle|Windows Phone|PSP|AvantGo|Atomic Web Browser|Blazer|Chrome Mobile|Dolphin|Dolfin|Doris|GO Browser|Jasmine|MicroB|Mobile Firefox|Mobile Safari|Mobile Silk|Motorola Internet Browser|NetFront|NineSky|Nokia Web Browser|Obigo|Openwave Mobile Browser|Palm Pre web browser|Polaris|PS Vita browser|Puffin|QQbrowser|SEMC Browser|Skyfire|Tear|TeaShark|UC Browser|uZard Web|wOSBrowser|Yandex.Browser mobile/i.test(navigator.userAgent)},G=function(e){return K(e)?a.a.createElement(W,e):a.a.createElement(A,e)};n.d(r,"SelectMultiple",(function(){return L})),n.d(r,"SelectSimple",(function(){return G}))}])})); | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react"),require("classnames"),require("react-select")):"function"==typeof define&&define.amd?define(["react","classnames","react-select"],r):"object"==typeof exports?exports.select=r(require("react"),require("classnames"),require("react-select")):(e.components=e.components||{},e.components.select=r(e.react,e.classnames,e["react-select"]))}(window,(function(e,r,n){return function(e){var r={};function n(t){if(r[t])return r[t].exports;var a=r[t]={i:t,l:!1,exports:{}};return e[t].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var a in e)n.d(t,a,function(r){return e[r]}.bind(null,a));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=3)}([function(r,n){r.exports=e},function(e,n){e.exports=r},function(e,r){e.exports=n},function(e,r,n){e.exports=n(4)},function(e,r,n){"use strict";n.r(r);var t=n(0),a=n.n(t),o=n(2),i=n.n(o);function l(e,r){if(null==e)return{};var n,t,a=function(e,r){if(null==e)return{};var n,t,a={},o=Object.keys(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||(a[n]=e[n]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t<o.length;t++)n=o[t],r.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function s(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var c=n(1),u=n.n(c);function d(){return(d=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}var p=a.a.createElement("title",{id:"close-title"},"Close icon"),f=a.a.createElement("desc",{id:"close-description"},"Close icon in svg"),m=a.a.createElement("path",{d:"M12 10.586l5.293-5.293a1 1 0 0 1 1.414 1.414L13.414 12l5.293 5.293a1 1 0 0 1-1.414 1.414L12 13.414l-5.293 5.293a1 1 0 1 1-1.414-1.414L10.586 12 5.293 6.707a1 1 0 0 1 1.414-1.414L12 10.586z"}),h=function(e){return a.a.createElement("svg",d({width:24,height:24,viewBox:"0 0 24 24","aria-labelledby":"close-title close-description",role:"img"},e),p,f,m)},b=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return"function"==typeof e&&e.apply(void 0,n)};function v(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function x(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?v(n,!0).forEach((function(r){s(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(n).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}var P=function(e){return!(e&&Object.keys(e).length)},g=function(e){return"dynamic"===e.componentsProps.behaviour&&P(e.value)},w=function(e){return e.placeholder!==e.componentsProps.label&&g(e)},O=a.a.createElement("span",{className:"rdx-icon--require"},"*"),y={ClearIndicator:function(e){var r=e.innerProps,n=e.selectProps;return b(n.componentsProps.renderClearIcon,x({},r,{className:"".concat("rdx-icon rdx-select-field-icon"," rdx-select-field-icon-clear")}))},Control:function(e){var r=e.selectProps,n=e.innerProps,t=e.innerRef,o=e.children;return a.a.createElement("div",Object.assign({"aria-expanded":r.menuIsOpen,className:"rdx-select-field-wrapper",ref:t},n),o,r.componentsProps.label&&a.a.createElement("label",{className:"rdx-select-field-label",htmlFor:r.id},r.componentsProps.label,r.componentsProps.isRequired?O:null))},DropdownIndicator:function(e){var r=e.selectProps,n=e.innerProps;return b(r.componentsProps.renderDownIcon,x({},n,{className:"".concat("rdx-icon rdx-select-field-icon"," rdx-select-field-icon-open")}))},IndicatorsContainer:function(e){var r=e.children;return a.a.createElement("div",{className:"rdx-select-field-icons-wrapper"},r)},IndicatorSeparator:function(){return null},Input:function(e){var r=e.selectProps,n=e.innerRef,t=e.isDisabled,o=l(e,["selectProps","innerRef","isDisabled"]),i=!P(r.value)&&r.componentsProps.searchHint,s=u()("rdx-select-field-select",{"is-hidden":!r.isMulti&&r.value});return a.a.createElement("input",Object.assign({className:s,disabled:t,ref:n},o,{placeholder:i?r.componentsProps.searchHint:void 0}))},Menu:function(e){var r=e.innerRef,n=e.innerProps,t=e.children;return a.a.createElement("div",Object.assign({className:"rdx-select-field-items",ref:r},n),t)},MenuList:function(e){var r=e.innerRef,n=e.children;return a.a.createElement("ul",{"aria-label":"submenu",ref:r},n)},MultiValue:function(e){var r=e.children,n=e.data,t=e.removeProps,o=e.isFocused,i=u()("rdx-select-field-tag",{"is-fixed":n.isFixed,"is-focused":o});return a.a.createElement("button",{className:i,tabIndex:-1},a.a.createElement("p",null,r),!n.isFixed&&a.a.createElement("div",Object.assign({className:"rdx-select-field-icon-close",role:"button"},t),a.a.createElement(h,{className:"rdx-icon rdx-icon-close"})))},Option:function(e){var r=e.data,n=e.selectProps,t=e.isFocused,o=e.innerRef,i=e.innerProps,l=e.label,s=e.value,c=(e.onOptionClick,!n.isMulti&&n.value&&s===n.value.value&&!n.isDisabled),d=u()("rdx-select-field-option",{"is-disabled":r.isDisabled,"is-link":r.isLink,"is-focused":t,"is-selected":c});return a.a.createElement("li",Object.assign({ref:o,className:d,"aria-selected":c,role:"option"},i),r.imgPath&&a.a.createElement("span",{className:"rdx-select-option-image-wrapper"},a.a.createElement("img",{className:"rdx-select-option-image",src:r.imgPath,alt:r.imgAlt})),r.renderIcon&&a.a.createElement("span",{className:"rdx-select-option-icon-wrapper"},b(r.renderIcon,{className:"rdx-select-option-icon"})),a.a.createElement("span",null,l))},Placeholder:function(e){var r=e.children,n=e.selectProps;return g(n)&&!w(n)?null:a.a.createElement("div",{className:"rdx-select-field-placeholder"},r,n.componentsProps.isRequired&&!n.componentsProps.label?O:null)},SelectContainer:function(e){var r=e.selectProps,n=e.innerProps,t=e.children,o=e.isFocused,i=u()("rdx-select-field rdx-select-field-".concat(r.componentsProps.appearance," is-custom"),{"has-error":r.componentsProps.hasError,"has-label":r.componentsProps.label,"has-width-fixed":"fixed"===r.componentsProps.widthBehaviour,"has-width-adaptative":"adaptative"===r.componentsProps.widthBehaviour,"has-height-fixed":"fixed"===r.componentsProps.heightBehaviour,"has-height-adaptative":"adaptative"===r.componentsProps.heightBehaviour,"has-width-full":"full"===r.componentsProps.widthBehaviour,"is-disabled":r.isDisabled,"is-dynamic":g(r),"is-fading":w(r),"is-focused":o,"is-multi":r.isMulti,"is-open-down":r.menuIsOpen&&"down"===r.componentsProps.dropDownPos,"is-open-up":r.menuIsOpen&&"up"===r.componentsProps.dropDownPos,"is-required":r.componentsProps.isRequired,"is-searchable":r.isSearchable,"is-touched":r.componentsProps.isTouched});return a.a.createElement("div",Object.assign({className:i},n),t,r.componentsProps.helperText&&!r.componentsProps.errorText?a.a.createElement("div",{className:"rdx-select-field-helper"},r.componentsProps.helperText):null,r.componentsProps.hasError&&!r.isDisabled?a.a.createElement("div",{className:"rdx-select-field-helper"},r.componentsProps.errorText):null)},SingleValue:function(e){var r=e.selectProps,n=e.children;return a.a.createElement(t.Fragment,null,r.options.map((function(e){return e.label===n?e.imgPath?a.a.createElement("span",{className:"rdx-select-option-image-wrapper",key:e.value},a.a.createElement("img",{className:"rdx-select-option-image",src:e.imgPath,alt:e.imgAlt})):e.renderIcon?a.a.createElement("span",{className:"rdx-select-option-icon-wrapper",key:e.value},b(e.renderIcon,{className:"rdx-icon rdx-select-option-icon"})):null:null})),a.a.createElement("div",{className:"rdx-select-field-value"},n))},ValueContainer:function(e){return e.children}};function E(){return(E=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}var j=a.a.createElement("title",{id:"chevron-down-title"},"Chevron down icon"),N=a.a.createElement("desc",{id:"chevron-down-description"},"Chevron down icon in svg"),D=a.a.createElement("path",{d:"M19.293 7.293a1 1 0 0 1 1.414 1.414l-8 8a1 1 0 0 1-1.414 0l-8-8a1 1 0 0 1 1.414-1.414L12 14.586l7.293-7.293z"}),C=function(e){return a.a.createElement("svg",E({width:24,height:24,viewBox:"0 0 24 24","aria-labelledby":"chevron-down-title chevron-down-description",role:"img"},e),j,N,D)};function B(){return(B=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}var I=a.a.createElement("title",{id:"delete-title"},"Delete icon"),M=a.a.createElement("desc",{id:"delete-description"},"Delete icon in svg"),S=a.a.createElement("path",{d:"M20.182 4C21.73 4 23 5.222 23 6.75v10.5c0 1.528-1.27 2.75-2.818 2.75H8.364a1 1 0 0 1-.74-.327l-6.364-7a1 1 0 0 1 0-1.346l6.364-7A1 1 0 0 1 8.364 4h11.818zM8.806 18h11.376c.46 0 .818-.345.818-.75V6.75c0-.405-.358-.75-.818-.75H8.806l-5.455 6 5.455 6zm9.912-3.697a1 1 0 1 1-1.415 1.415L15 13.414l-2.303 2.304a1 1 0 1 1-1.415-1.415L13.586 12l-2.293-2.293a1 1 0 1 1 1.414-1.414L15 10.586l2.293-2.293a1 1 0 0 1 1.414 1.414L16.414 12l2.304 2.303z"}),F=function(e){return a.a.createElement("svg",B({width:24,height:24,viewBox:"0 0 24 24","aria-labelledby":"delete-title delete-description",role:"img"},e),I,M,S)},T=function(e){var r=e.appearance,n=e.ariaLabel,t=e.autoFocus,o=e.behaviour,l=e.defaultIsOpen,s=e.dropDownPos,c=e.errorText,u=e.heightBehaviour,d=e.helperText,p=e.id,f=e.isDisabled,m=e.isMulti,h=e.isRequired,b=e.isSearchable,v=e.isTouched,x=e.label,P=e.name,g=e.onBlur,w=e.onChange,O=e.onClose,E=e.onFocus,j=e.onInputChange,N=e.onKeyDown,D=e.onOpen,C=e.options,B=e.placeholder,I=e.renderClearIcon,M=e.renderDownIcon,S=e.searchHint,F=e.value,T=e.widthBehaviour,q=e.noOptionsMessage,k=c&&v;return a.a.createElement(i.a,{id:p,ariaLabel:n||x||p,autoFocus:t,noOptionsMessage:q,defaultMenuIsOpen:l,placeholder:B,isDisabled:f,isMulti:m,isSearchable:b,name:P,options:C,value:F,isClearable:m&&F&&F.some((function(e){return!e.isFixed})),onBlur:g,onChange:function(e,r){var n=r.action,t=r.removedValue;switch(n){case"remove-value":case"pop-value":if(t.isFixed)return;break;case"clear":e=C.filter((function(e){return e.isFixed}))}w(e,{action:n,removedValue:t})},onClose:O,onFocus:E,onInputChange:j,onKeyDown:N,onOpen:D,components:y,componentsProps:{renderClearIcon:I,renderDownIcon:M,label:x,isRequired:h,hasError:k,behaviour:o,isTouched:v,heightBehaviour:u,widthBehaviour:T,appearance:r,dropDownPos:s,errorText:c,helperText:d,searchHint:S}})};T.defaultProps={appearance:"box",behaviour:"static",dropDownPos:"down",defaultIsOpen:!1,isSearchable:!0,renderDownIcon:function(e){return a.a.createElement(C,e)},renderClearIcon:function(e){return a.a.createElement(F,e)}};var q=T,k=function(e){return a.a.createElement(q,Object.assign({},e,{isSearchable:!1,isMulti:!0,behaviour:"static"}))};k.defaultProps={appearance:"box",dropDownPos:"down",defaultIsOpen:!1,renderClearIcon:function(){return null}};var L=k,R=function(e){return a.a.createElement(q,Object.assign({},e,{isSearchable:!1,isMulti:!1,behaviour:"static"}))};R.defaultProps={appearance:"box",dropDownPos:"down",defaultIsOpen:!1};var A=R;function V(e){return function(e){if(Array.isArray(e)){for(var r=0,n=new Array(e.length);r<e.length;r++)n[r]=e[r];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var z=function(e){var r=e.ariaLabel,n=e.autoComplete,t=e.autoFocus,o=e.hasError,i=e.id,l=e.isDisabled,s=e.isRequired,c=e.name,u=e.onBlur,d=e.onChange,p=e.onFocus,f=e.options,m=e.placeholder,h=e.value,b=m?[{label:m,isDisabled:!0,selected:!0}].concat(V(f)):f;return a.a.createElement("select",{"aria-invalid":o,"aria-label":r,autoComplete:n,autoFocus:t,className:"rdx-select-field-select",disabled:l,id:i,name:c,onBlur:u,onChange:function(e){return d(f.find((function(r){return r.value===e.target.value})))},onFocus:p,required:s,value:h&&h.value},b.map((function(e,r){var n=e.value,t=e.label,o=e.isDisabled,i=e.selected;return a.a.createElement("option",{key:r,selected:!!h&&n===h.value||i,value:n,disabled:o},t)})))};z.defaultProps={appearance:"box",autoComplete:"off"};var H=z,_=function(e){var r=e.appearance,n=e.ariaLabel,t=e.autoComplete,o=e.autoFocus,i=e.errorText,l=e.heightBehaviour,s=e.helperText,c=e.id,d=e.isDisabled,p=e.isRequired,f=e.isTouched,m=e.label,h=e.name,v=e.options,x=e.onBlur,P=e.onChange,g=e.onFocus,w=e.placeholder,O=e.renderDownIcon,y=e.value,E=e.widthBehaviour,j=Boolean(i&&f),N="rdx-icon rdx-select-field-icon-open",D=u()("rdx-select-field rdx-select-field-".concat(r," is-native"),{"has-error":j,"has-label":m,"has-width-adaptative":"adaptative"===E,"has-width-fixed":"fixed"===E,"has-width-full":"full"===E,"has-height-adaptative":"adaptative"===l,"has-height-fixed":"fixed"===l,"is-disabled":d,"is-required":p,"is-touched":f});return a.a.createElement("div",{className:D},a.a.createElement("div",{className:"rdx-select-field-wrapper"},a.a.createElement(H,{appearance:r,ariaLabel:n||m||h||c,autoComplete:t,autoFocus:o,hasError:j,id:c,isDisabled:d,isRequired:p,isTouched:f,name:h,onBlur:x,onChange:P,onFocus:g,options:v,placeholder:w,value:y}),m&&a.a.createElement("label",{className:"rdx-select-field-label",htmlFor:c},m),a.a.createElement("div",{className:"rdx-select-field-icons-wrapper"},b(O,{className:N})||a.a.createElement(C,{className:N}))),s&&!i?a.a.createElement("div",{className:"rdx-select-field-helper"},s):null,j&&!d?a.a.createElement("div",{className:"rdx-select-field-helper"},i):null)};_.defaultProps={appearance:"box",autoComplete:"off"};var W=_,K=function(e){return void 0!==e.useNative?e.useNative:/Mobi|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Opera Mobile|Kindle|Windows Phone|PSP|AvantGo|Atomic Web Browser|Blazer|Chrome Mobile|Dolphin|Dolfin|Doris|GO Browser|Jasmine|MicroB|Mobile Firefox|Mobile Safari|Mobile Silk|Motorola Internet Browser|NetFront|NineSky|Nokia Web Browser|Obigo|Openwave Mobile Browser|Palm Pre web browser|Polaris|PS Vita browser|Puffin|QQbrowser|SEMC Browser|Skyfire|Tear|TeaShark|UC Browser|uZard Web|wOSBrowser|Yandex.Browser mobile/i.test(navigator.userAgent)},G=function(e){return K(e)?a.a.createElement(W,e):a.a.createElement(A,e)};n.d(r,"SelectMultiple",(function(){return L})),n.d(r,"SelectSimple",(function(){return G}))}])})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@redradix/components.select", | ||
"version": "2.0.4", | ||
"version": "2.1.0", | ||
"description": "", | ||
@@ -26,3 +26,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "81423db0fdff65d937eb5b568b8fe82a35b4a71e" | ||
"gitHead": "678cbb9d5d217afc33b894f6254397620b62a1de" | ||
} |
@@ -40,2 +40,3 @@ import React from 'react' | ||
widthBehaviour, | ||
noOptionsMessage | ||
}) => { | ||
@@ -68,2 +69,3 @@ const hasError = errorText && isTouched | ||
autoFocus={autoFocus} | ||
noOptionsMessage={noOptionsMessage} | ||
defaultMenuIsOpen={defaultIsOpen} | ||
@@ -70,0 +72,0 @@ placeholder={placeholder} |
@@ -73,2 +73,4 @@ import React from 'react' | ||
), | ||
/** Function that provides a message when there are no options */ | ||
noOptionsMessage: PropTypes.func, | ||
/** String that defines the default value of the <select> */ | ||
@@ -75,0 +77,0 @@ placeholder: PropTypes.string, |
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
136695
1318