@pedidopago/ui 1.8.8 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/NewSelect/Examples/constants.d.ts +4 -0
- package/dist/components/NewSelect/Examples/constants.d.ts.map +1 -1
- package/dist/components/NewSelect/Examples/constants.js +1 -1
- package/dist/components/NewSelect/Examples/index.d.ts +1 -0
- package/dist/components/NewSelect/Examples/index.d.ts.map +1 -1
- package/dist/components/NewSelect/Examples/index.js +1 -1
- package/dist/components/NewSelect/components/SelectItem/index.d.ts.map +1 -1
- package/dist/components/NewSelect/components/SelectItem/index.js +1 -1
- package/dist/components/NewSelect/multiple/index.d.ts.map +1 -1
- package/dist/components/NewSelect/multiple/index.js +1 -1
- package/dist/components/NewSelect/single/index.d.ts.map +1 -1
- package/dist/components/NewSelect/single/index.js +1 -1
- package/dist/components/NewSelect/utils.ts/index.d.ts +3 -0
- package/dist/components/NewSelect/utils.ts/index.d.ts.map +1 -0
- package/dist/components/NewSelect/utils.ts/index.js +1 -0
- package/dist/components/Select/components/OptionsSelect/styles.d.ts +256 -2
- package/dist/components/Select/components/OptionsSelect/styles.d.ts.map +1 -1
- package/dist/components/Select/components/OptionsSelect/styles.js +1 -1
- package/dist/utils/formatters/strings.d.ts +6 -0
- package/dist/utils/formatters/strings.d.ts.map +1 -1
- package/dist/utils/formatters/strings.js +6 -2
- package/dist/utils/get-primitive-value.d.ts +4 -0
- package/dist/utils/get-primitive-value.d.ts.map +1 -0
- package/dist/utils/get-primitive-value.js +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/components/NewSelect/Examples/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB;;;GAiBhC,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/components/NewSelect/Examples/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB;;;GAiBhC,CAAC;AAEF,eAAO,MAAM,cAAc;;;GAK1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.optionsSelectExample=void 0;var optionsSelectExample=[{label:"Op\xE7\xE3o 1",value:"option1"},{label:"Op\xE7\xE3o 2",value:"option2"},{label:"Op\xE7\xE3o 3",value:"option3"},{label:"Op\xE7\xE3o 4",value:"option4"},{label:"Op\xE7\xE3o 5",value:"option5"},{label:"Op\xE7\xE3o 6",value:"option6"},{label:"Op\xE7\xE3o 7",value:"option7"},{label:"Op\xE7\xE3o 8",value:"option8"},{label:"Op\xE7\xE3o 9",value:"option9"},{label:"Op\xE7\xE3o 10",value:"option10"},{label:"Op\xE7\xE3o 11",value:"option11"},{label:"Op\xE7\xE3o 12",value:"option12"},{label:"Op\xE7\xE3o 13",value:"option13"},{label:"Op\xE7\xE3o 14",value:"option14"},{label:"Op\xE7\xE3o 15",value:"option15"},{label:"Op\xE7\xE3o 16",value:"option16"}];exports.optionsSelectExample=optionsSelectExample;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.optionsSelectExample=exports.optionsNumbers=void 0;var optionsSelectExample=[{label:"Op\xE7\xE3o 1",value:"option1"},{label:"Op\xE7\xE3o 2",value:"option2"},{label:"Op\xE7\xE3o 3",value:"option3"},{label:"Op\xE7\xE3o 4",value:"option4"},{label:"Op\xE7\xE3o 5",value:"option5"},{label:"Op\xE7\xE3o 6",value:"option6"},{label:"Op\xE7\xE3o 7",value:"option7"},{label:"Op\xE7\xE3o 8",value:"option8"},{label:"Op\xE7\xE3o 9",value:"option9"},{label:"Op\xE7\xE3o 10",value:"option10"},{label:"Op\xE7\xE3o 11",value:"option11"},{label:"Op\xE7\xE3o 12",value:"option12"},{label:"Op\xE7\xE3o 13",value:"option13"},{label:"Op\xE7\xE3o 14",value:"option14"},{label:"Op\xE7\xE3o 15",value:"option15"},{label:"Op\xE7\xE3o 16",value:"option16"}];exports.optionsSelectExample=optionsSelectExample;var optionsNumbers=[{label:"1",value:1},{label:"2",value:2},{label:"3",value:3},{label:"4",value:4}];exports.optionsNumbers=optionsNumbers;
|
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
export declare function MultipleSelectExampleWithDefaultValue(): JSX.Element;
|
|
3
3
|
export declare function MultipleSelectExampleWithInputSearch(): JSX.Element;
|
|
4
4
|
export declare function MultipleSelectExampleWithChip(): JSX.Element;
|
|
5
|
+
export declare function SelectWithNumberOptions(): JSX.Element;
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/NewSelect/Examples/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/NewSelect/Examples/index.tsx"],"names":[],"mappings":";AAYA,wBAAgB,qCAAqC,gBAmDpD;AAED,wBAAgB,oCAAoC,gBA4BnD;AACD,wBAAgB,6BAA6B,gBAiD5C;AAED,wBAAgB,uBAAuB,gBA0BtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MultipleSelectExampleWithChip=MultipleSelectExampleWithChip,exports.MultipleSelectExampleWithDefaultValue=MultipleSelectExampleWithDefaultValue,exports.MultipleSelectExampleWithInputSearch=MultipleSelectExampleWithInputSearch;var _react=require("react"),_Flex=_interopRequireDefault(require("../../../components/Flex")),_=require(".."),_SelectInputSearch=require("../components/SelectInputSearch"),_SelectItem=require("../components/SelectItem"),_Chip=require("../components/Chip"),_Skeleton=_interopRequireDefault(require("../../Skeleton")),_constants=require("./constants"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function MultipleSelectExampleWithDefaultValue(){var _useState=(0,_react.useState)(["option1","option2"]),_useState2=_slicedToArray(_useState,2),selectedMultipleOptions=_useState2[0],setSelectedMultipleOption=_useState2[1],_useState3=(0,_react.useState)("option1"),_useState4=_slicedToArray(_useState3,2),selectedOption=_useState4[0],setSelectedOption=_useState4[1],_useState5=(0,_react.useState)(!0),_useState6=_slicedToArray(_useState5,2),isLoading=_useState6[0],setIsLoading=_useState6[1];return(0,_react.useEffect)(function(){setTimeout(function(){setIsLoading(!1)},2e3)},[]),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",spacing:"1rem",children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.NewSelect,{label:"Multiplo",multiple:!0,value:selectedMultipleOptions,onChange:function onChange(value){setSelectedMultipleOption(value)},children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectItem.SelectItem,{value:"default-option",children:"Op\xE7\xE3o padr\xE3o"}),isLoading?/*#__PURE__*/(0,_jsxRuntime.jsx)(_Skeleton.default,{height:"100px",isLoaded:!1}):_constants.optionsSelectExample.map(function(option,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectItem.SelectItem,{value:option.value,children:option.label},index)})]}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.NewSelect,{label:"Single",value:selectedOption,onChange:function onChange(value){return setSelectedOption(value)},children:_constants.optionsSelectExample.map(function(option,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectItem.SelectItem,{value:option.value,children:option.label},"".concat(index,"-single-select"))})}),/*#__PURE__*/(0,_jsxRuntime.jsxs)("p",{children:["Current multiple value: ",selectedMultipleOptions.join(", ")]}),/*#__PURE__*/(0,_jsxRuntime.jsxs)("p",{children:["Current value: ",selectedOption]})]})}function MultipleSelectExampleWithInputSearch(){var _useState7=(0,_react.useState)(""),_useState8=_slicedToArray(_useState7,2),searchInput=_useState8[0],setSearchInput=_useState8[1],filteredOptions=_constants.optionsSelectExample.filter(function(option){return option.label.includes(searchInput)}),_useState9=(0,_react.useState)(""),_useState10=_slicedToArray(_useState9,2),selectedOption=_useState10[0],setSelectedOption=_useState10[1];return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.NewSelect,{label:"Com input search",value:selectedOption,onChange:function onChange(value){setSelectedOption(value)},children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectInputSearch.SelectInputSearch,{onChange:function onChange(event){return setSearchInput(event.currentTarget.value)}}),filteredOptions.map(function(option,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectItem.SelectItem,{value:option.value,children:option.label},index)})]}),/*#__PURE__*/(0,_jsxRuntime.jsxs)("p",{children:["Current value: ",selectedOption]})]})}function MultipleSelectExampleWithChip(){var _useState11=(0,_react.useState)(""),_useState12=_slicedToArray(_useState11,2),searchInput=_useState12[0],setSearchInput=_useState12[1],filteredOptions=_constants.optionsSelectExample.filter(function(option){return option.label.toLowerCase().includes(searchInput.toLowerCase())}),_useState13=(0,_react.useState)([]),_useState14=_slicedToArray(_useState13,2),selectedOption=_useState14[0],setSelectedOption=_useState14[1];return/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.NewSelect,{label:"Com input search",multiple:!0,value:selectedOption,onChange:function onChange(value){return setSelectedOption(value)},renderOptions:function renderOptions(option,remove){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_Chip.Chip,{onClick:function onClick(){return remove(option)},children:option.label})},children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectInputSearch.SelectInputSearch,{value:searchInput,onChange:function onChange(event){return setSearchInput(event.currentTarget.value)}}),filteredOptions.map(function(option,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectItem.SelectItem,{value:option.value,children:option.label},index)})]}),/*#__PURE__*/(0,_jsxRuntime.jsxs)("p",{children:["Current value: ",selectedOption]})]})}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MultipleSelectExampleWithChip=MultipleSelectExampleWithChip,exports.MultipleSelectExampleWithDefaultValue=MultipleSelectExampleWithDefaultValue,exports.MultipleSelectExampleWithInputSearch=MultipleSelectExampleWithInputSearch,exports.SelectWithNumberOptions=SelectWithNumberOptions;var _react=require("react"),_Flex=_interopRequireDefault(require("../../../components/Flex")),_=require(".."),_SelectInputSearch=require("../components/SelectInputSearch"),_SelectItem=require("../components/SelectItem"),_Chip=require("../components/Chip"),_Skeleton=_interopRequireDefault(require("../../Skeleton")),_Button=_interopRequireDefault(require("../../Button")),_constants=require("./constants"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function MultipleSelectExampleWithDefaultValue(){var _useState=(0,_react.useState)(["option1","option2"]),_useState2=_slicedToArray(_useState,2),selectedMultipleOptions=_useState2[0],setSelectedMultipleOption=_useState2[1],_useState3=(0,_react.useState)("option1"),_useState4=_slicedToArray(_useState3,2),selectedOption=_useState4[0],setSelectedOption=_useState4[1],_useState5=(0,_react.useState)(!0),_useState6=_slicedToArray(_useState5,2),isLoading=_useState6[0],setIsLoading=_useState6[1];return(0,_react.useEffect)(function(){setTimeout(function(){setIsLoading(!1)},2e3)},[]),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",spacing:"1rem",children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.NewSelect,{label:"Multiplo teste",multiple:!0,value:selectedMultipleOptions,onChange:function onChange(value){setSelectedMultipleOption(value)},children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectItem.SelectItem,{value:"default-option",children:"Op\xE7\xE3o padr\xE3o"}),isLoading?/*#__PURE__*/(0,_jsxRuntime.jsx)(_Skeleton.default,{height:"100px",isLoaded:!1}):_constants.optionsSelectExample.map(function(option,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectItem.SelectItem,{value:option.value,children:option.label},index)})]}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_.NewSelect,{label:"Single",value:selectedOption,onChange:function onChange(value){return setSelectedOption(value)},children:_constants.optionsSelectExample.map(function(option,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectItem.SelectItem,{value:option.value,children:option.label},"".concat(index,"-single-select"))})}),/*#__PURE__*/(0,_jsxRuntime.jsxs)("p",{children:["Current multiple value: ",selectedMultipleOptions.join(", ")]}),/*#__PURE__*/(0,_jsxRuntime.jsxs)("p",{children:["Current value: ",selectedOption]})]})}function MultipleSelectExampleWithInputSearch(){var _useState7=(0,_react.useState)(""),_useState8=_slicedToArray(_useState7,2),searchInput=_useState8[0],setSearchInput=_useState8[1],filteredOptions=_constants.optionsSelectExample.filter(function(option){return option.label.includes(searchInput)}),_useState9=(0,_react.useState)(""),_useState10=_slicedToArray(_useState9,2),selectedOption=_useState10[0],setSelectedOption=_useState10[1];return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.NewSelect,{label:"Com input search single",value:selectedOption,onChange:function onChange(value){setSelectedOption(value)},children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectInputSearch.SelectInputSearch,{onChange:function onChange(event){return setSearchInput(event.currentTarget.value)}}),filteredOptions.map(function(option,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectItem.SelectItem,{value:option.value,children:option.label},index)})]}),/*#__PURE__*/(0,_jsxRuntime.jsxs)("p",{children:["Current value: ",selectedOption]})]})}function MultipleSelectExampleWithChip(){var _useState11=(0,_react.useState)(""),_useState12=_slicedToArray(_useState11,2),searchInput=_useState12[0],setSearchInput=_useState12[1],filteredOptions=_constants.optionsSelectExample.filter(function(option){return option.label.toLowerCase().includes(searchInput.toLowerCase())}),_useState13=(0,_react.useState)([]),_useState14=_slicedToArray(_useState13,2),selectedOption=_useState14[0],setSelectedOption=_useState14[1];return/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{spacing:"2rem",style:{marginBlock:"2rem"},children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_Button.default,{onClick:function onClick(){setSelectedOption(["option1","option2"])},children:"Reset to two values"}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_Button.default,{onClick:function onClick(){setSelectedOption([])},children:"Reset"})]}),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.NewSelect,{label:"Com input search",multiple:!0,value:selectedOption,onChange:function onChange(value){return setSelectedOption(value)},renderOptions:function renderOptions(option,remove){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_Chip.Chip,{onClick:function onClick(){return remove(option)},children:(null===option||void 0===option?void 0:option.label)||""})},children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectInputSearch.SelectInputSearch,{value:searchInput,onChange:function onChange(event){return setSearchInput(event.currentTarget.value)}}),filteredOptions.map(function(option,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectItem.SelectItem,{value:option.value,children:option.label},index)})]}),/*#__PURE__*/(0,_jsxRuntime.jsxs)("p",{children:["Current value: ",selectedOption]})]})}function SelectWithNumberOptions(){var _useState15=(0,_react.useState)(""),_useState16=_slicedToArray(_useState15,2),searchInput=_useState16[0],setSearchInput=_useState16[1],_useState17=(0,_react.useState)([]),_useState18=_slicedToArray(_useState17,2),selectedOption=_useState18[0],setSelectedOption=_useState18[1];return/*#__PURE__*/(0,_jsxRuntime.jsxs)("div",{children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_.NewSelect,{label:"Numero",multiple:!0,value:selectedOption,onChange:function onChange(value){return setSelectedOption(value)},children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectInputSearch.SelectInputSearch,{value:searchInput,onChange:function onChange(event){return setSearchInput(event.currentTarget.value)}}),_constants.optionsNumbers.map(function(option,index){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_SelectItem.SelectItem,{value:option.value,children:option.label},index)})]}),/*#__PURE__*/(0,_jsxRuntime.jsxs)("p",{children:["Current value: ",selectedOption]})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/NewSelect/components/SelectItem/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/NewSelect/components/SelectItem/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAWhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SelectItem=SelectItem;var _styles=require("./styles"),_jsxRuntime=require("react/jsx-runtime");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SelectItem=SelectItem;var _styles=require("./styles"),_jsxRuntime=require("react/jsx-runtime");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function SelectItem(props){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.SelectItemContainer,_objectSpread(_objectSpread({"data-type-of-value":_typeof(props.value),type:"button",className:"select-item"},props),{},{children:props.children}))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/NewSelect/multiple/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/NewSelect/multiple/index.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAgB,yBAAyB,EAAe,MAAM,UAAU,CAAC;AAKhF,wBAAgB,iBAAiB,CAAC,EAChC,KAAU,EACV,WAAgB,EAChB,KAAK,EACL,UAAU,EACV,OAAO,EACP,QAAQ,EACR,KAAK,EACL,OAAO,EACP,MAAM,EACN,aAAa,EACb,QAAQ,EACR,sBAAsB,EACtB,GAAG,IAAI,EACR,EAAE,yBAAyB,eAsM3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.NewMultipleSelect=NewMultipleSelect;var _react=require("react"),_classnames=_interopRequireDefault(require("classnames")),_Flex=_interopRequireDefault(require("../../Flex")),_Icon=_interopRequireDefault(require("../../Icon")),_ReactPortal=require("../../ReactPortal"),_styles=require("../components/OptionsSelect/styles"),_useReposition=require("../../../shared/hooks/useReposition"),_useOnClickOutside=require("../../../shared/hooks/useOnClickOutside"),_styles2=require("../styles"),_SelectItem=require("../components/SelectItem"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["label","placeholder","alert","helperText","variant","children","value","onClose","onOpen","renderOptions","onChange","optionsContainerStyles"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}function NewMultipleSelect(_ref){function changeMultipleOption(valueOption){if(void 0===valueOption)return setSelectedValues([]),void setIsOpenOptions(!1);var findOption=selectedValues.find(function(option){return option===valueOption});findOption?removeOption(valueOption):(!(null!==value&&void 0!==value&&value[0])&&setSelectedValues([].concat(_toConsumableArray(selectedValues),[valueOption])),null===onChange||void 0===onChange?void 0:onChange([].concat(_toConsumableArray(selectedValues),[valueOption])))}function removeOption(optionToRemove){var newSelectedValues=null===selectedValues||void 0===selectedValues?void 0:selectedValues.filter(function(option){return option!==optionToRemove});setSelectedValues(newSelectedValues),null===onChange||void 0===onChange?void 0:onChange(newSelectedValues)}var _containerRef$current,_ref$label=_ref.label,label=void 0===_ref$label?"":_ref$label,_ref$placeholder=_ref.placeholder,placeholder=void 0===_ref$placeholder?"":_ref$placeholder,alert=_ref.alert,helperText=_ref.helperText,variant=_ref.variant,children=_ref.children,value=_ref.value,onClose=_ref.onClose,onOpen=_ref.onOpen,renderOptions=_ref.renderOptions,onChange=_ref.onChange,optionsContainerStyles=_ref.optionsContainerStyles,rest=_objectWithoutProperties(_ref,_excluded),containerRef=(0,_react.useRef)(null),selectRef=(0,_react.useRef)(null),_useState=(0,_react.useState)(!1),_useState2=_slicedToArray(_useState,2),isOpenOptions=_useState2[0],setIsOpenOptions=_useState2[1],_useState3=(0,_react.useState)([]),_useState4=_slicedToArray(_useState3,2),selectedValues=_useState4[0],setSelectedValues=_useState4[1],optionsModalRef=(0,_react.useRef)(null),_useState5=(0,_react.useState)([]),_useState6=_slicedToArray(_useState5,2),options=_useState6[0],setOptions=_useState6[1];(0,_react.useEffect)(function(){var _optionsModalRef$curr,childs=null===(_optionsModalRef$curr=optionsModalRef.current)||void 0===_optionsModalRef$curr?void 0:_optionsModalRef$curr.childNodes,newOptions=[];null===childs||void 0===childs?void 0:childs.forEach(function(child){var _child$classList;null!==child&&void 0!==child&&null!==(_child$classList=child.classList)&&void 0!==_child$classList&&_child$classList.contains("select-item")&&newOptions.push({value:null===child||void 0===child?void 0:child.value,label:null===child||void 0===child?void 0:child.innerText})}),setOptions(newOptions)},[children,optionsModalRef.current]),(0,_react.useEffect)(function(){function handler(){setIsOpenOptions(!1)}if(isOpenOptions){var _document;null===onOpen||void 0===onOpen?void 0:onOpen(),null===(_document=document)||void 0===_document?void 0:_document.addEventListener("scroll",handler)}else{var _document2;null===onClose||void 0===onClose?void 0:onClose(),null===(_document2=document)||void 0===_document2?void 0:_document2.removeEventListener("scroll",handler)}return function(){var _document3;return null===(_document3=document)||void 0===_document3?void 0:_document3.removeEventListener("scroll",handler)}},[isOpenOptions]),(0,_useOnClickOutside.useOnClickOutside)([containerRef,optionsModalRef],function(){isOpenOptions&&setIsOpenOptions(!1)});var positionsSelect=(0,_useReposition.useReposition)({containerRef:optionsModalRef,triggerRef:selectRef},[children]),SelectedOptionsWithCustomComponent=function(_ref2){var option=_ref2.option;return/*#__PURE__*/(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:null===renderOptions||void 0===renderOptions?void 0:renderOptions(option,function(){return removeOption(option.value)})})};return(0,_react.useEffect)(function(){value&&setSelectedValues(value)},[value]),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{ref:selectRef,style:{width:"100%"},children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",style:{width:"100%"},children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles2.SelectContainer,{"data-disabled":rest.disabled,"data-variant":variant,"data-label-in-top":!!(null!==selectedValues&&void 0!==selectedValues&&selectedValues[0])||!!placeholder,alert:alert,tabIndex:rest.disabled?-1:0,onClick:function onClick(){return setIsOpenOptions(!isOpenOptions)},className:rest.className,style:rest.style,ref:containerRef,children:[label&&"unstyled"!==variant&&/*#__PURE__*/(0,_jsxRuntime.jsx)("label",{title:label,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:"container_selected_options",children:null!==selectedValues&&void 0!==selectedValues&&selectedValues[0]?selectedValues.map(function(value,index){var currentOption=options.find(function(option){return option.value===value});return"function"==typeof renderOptions?/*#__PURE__*/(0,_jsxRuntime.jsx)(SelectedOptionsWithCustomComponent,{option:currentOption},"custom-option-selected-".concat(index)):/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles2.SelectedOptionSpan,{hasSelectedOption:!0,children:[null===currentOption||void 0===currentOption?void 0:currentOption.label,1<selectedValues.length&&index<selectedValues.length-1&&","]},index)}):/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles2.SelectedOptionSpan,{title:"placeholder",children:placeholder})}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_Flex.default,{className:"select_container_icon",children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"chevron-down"})})]}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_ReactPortal.ReactPortal,{wrapperId:"portal-root",children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.OptionsContainer,{ref:optionsModalRef,open:isOpenOptions,style:_objectSpread(_objectSpread({maxWidth:"".concat(null===(_containerRef$current=containerRef.current)||void 0===_containerRef$current?void 0:_containerRef$current.getBoundingClientRect().width,"px")},optionsContainerStyles),{},{left:positionsSelect.left,top:positionsSelect.top}),children:_react.Children.map(children,function(child){var isSelectItemElement=(null===child||void 0===child?void 0:child.type)===_SelectItem.SelectItem;if(!/*#__PURE__*/(0,_react.isValidElement)(child)||!isSelectItemElement)return/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{children:child});var childElement=child,isSelectedOption=null===selectedValues||void 0===selectedValues?void 0:selectedValues.find(function(value){var _childElement$props;return value===(null===(_childElement$props=childElement.props)||void 0===_childElement$props?void 0:_childElement$props.value)}),className=(0,_classnames.default)("select-item",{selected:isSelectedOption});return/*#__PURE__*/(0,_react.cloneElement)(childElement,{onClick:function onClick(event){var _childElement$props2,_childElement$props2$;null===(_childElement$props2=childElement.props)||void 0===_childElement$props2||null===(_childElement$props2$=_childElement$props2.onClick)||void 0===_childElement$props2$?void 0:_childElement$props2$.call(_childElement$props2,event),event.currentTarget.classList.contains("select-item")&&changeMultipleOption(childElement.props.value)},className:className})})})}),!!helperText&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles2.HelperText,{alert:alert,children:helperText})]})})}
|
|
1
|
+
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.NewMultipleSelect=NewMultipleSelect;var _react=require("react"),_classnames=_interopRequireDefault(require("classnames")),_Flex=_interopRequireDefault(require("../../Flex")),_Icon=_interopRequireDefault(require("../../Icon")),_ReactPortal=require("../../ReactPortal"),_styles=require("../components/OptionsSelect/styles"),_SelectItem=require("../components/SelectItem"),_useReposition=require("../../../shared/hooks/useReposition"),_useOnClickOutside=require("../../../shared/hooks/useOnClickOutside"),_styles2=require("../styles"),_getPrimitiveValue=require("../../../utils/get-primitive-value"),_utils=require("../utils.ts"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["label","placeholder","alert","helperText","variant","children","value","onClose","onOpen","renderOptions","onChange","optionsContainerStyles"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}function NewMultipleSelect(_ref){function changeMultipleOption(valueOption){if(void 0===valueOption)return setSelectedOptions([]),void setIsOpenOptions(!1);var findOption=selectedOptions.find(function(option){return option.value===valueOption});if(findOption)removeOption(valueOption);else{if(!(null!==value&&void 0!==value&&value[0])){var optionsFound=options.find(function(option){return option.value===valueOption});optionsFound&&setSelectedOptions([].concat(_toConsumableArray(selectedOptions),[optionsFound]))}var newValues=selectedOptions.map(function(option){return option.value});null===onChange||void 0===onChange?void 0:onChange([].concat(_toConsumableArray(newValues),[valueOption]))}}function removeOption(optionToRemove){var newSelectedOptions=null===selectedOptions||void 0===selectedOptions?void 0:selectedOptions.filter(function(option){return option.value!==optionToRemove});setSelectedOptions(newSelectedOptions);var newValues=newSelectedOptions.map(function(option){return option.value});null===onChange||void 0===onChange?void 0:onChange(newValues)}var _containerRef$current,_ref$label=_ref.label,label=void 0===_ref$label?"":_ref$label,_ref$placeholder=_ref.placeholder,placeholder=void 0===_ref$placeholder?"":_ref$placeholder,alert=_ref.alert,helperText=_ref.helperText,variant=_ref.variant,children=_ref.children,value=_ref.value,onClose=_ref.onClose,onOpen=_ref.onOpen,renderOptions=_ref.renderOptions,onChange=_ref.onChange,optionsContainerStyles=_ref.optionsContainerStyles,rest=_objectWithoutProperties(_ref,_excluded),containerRef=(0,_react.useRef)(null),selectRef=(0,_react.useRef)(null),_useState=(0,_react.useState)(!1),_useState2=_slicedToArray(_useState,2),isOpenOptions=_useState2[0],setIsOpenOptions=_useState2[1],_useState3=(0,_react.useState)([]),_useState4=_slicedToArray(_useState3,2),selectedOptions=_useState4[0],setSelectedOptions=_useState4[1],optionsModalRef=(0,_react.useRef)(null),_useState5=(0,_react.useState)([]),_useState6=_slicedToArray(_useState5,2),options=_useState6[0],setOptions=_useState6[1];(0,_react.useEffect)(function(){var _optionsModalRef$curr,childs=null===(_optionsModalRef$curr=optionsModalRef.current)||void 0===_optionsModalRef$curr?void 0:_optionsModalRef$curr.childNodes,newOptions=[];null===childs||void 0===childs?void 0:childs.forEach(function(child){var _child$classList,typeOfValue=child.getAttribute("data-type-of-value");null!==child&&void 0!==child&&null!==(_child$classList=child.classList)&&void 0!==_child$classList&&_child$classList.contains("select-item")&&newOptions.push({value:(0,_getPrimitiveValue.getPrimitiveValue)(null===child||void 0===child?void 0:child.value,typeOfValue),label:null===child||void 0===child?void 0:child.innerText})}),setOptions(newOptions)},[children,optionsModalRef.current]),(0,_react.useEffect)(function(){function handler(){setIsOpenOptions(!1)}if(isOpenOptions){var _document;null===onOpen||void 0===onOpen?void 0:onOpen(),null===(_document=document)||void 0===_document?void 0:_document.addEventListener("scroll",handler)}else{var _document2;null===onClose||void 0===onClose?void 0:onClose(),null===(_document2=document)||void 0===_document2?void 0:_document2.removeEventListener("scroll",handler)}return function(){var _document3;return null===(_document3=document)||void 0===_document3?void 0:_document3.removeEventListener("scroll",handler)}},[isOpenOptions]),(0,_useOnClickOutside.useOnClickOutside)([containerRef,optionsModalRef],function(){isOpenOptions&&setIsOpenOptions(!1)});var positionsSelect=(0,_useReposition.useReposition)({containerRef:optionsModalRef,triggerRef:selectRef},[children]),SelectedOptionsWithCustomComponent=function(_ref2){var option=_ref2.option;return/*#__PURE__*/(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:null===renderOptions||void 0===renderOptions?void 0:renderOptions(option,function(){return removeOption(option.value)})})};return(0,_react.useEffect)(function(){if(value){var newSelectedOptions=options.filter(function(option){return value.includes(option.value)}),oldSelectedOptions=selectedOptions.filter(function(option){return value.includes(option.value)}),uniqueSelectedOptions=(0,_utils.removeDuplicateOptions)([].concat(_toConsumableArray(oldSelectedOptions),_toConsumableArray(newSelectedOptions)));setSelectedOptions(uniqueSelectedOptions)}else setSelectedOptions([])},[value,options]),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{ref:selectRef,style:{width:"100%"},children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",style:{width:"100%"},children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles2.SelectContainer,{"data-disabled":rest.disabled,"data-variant":variant,"data-label-in-top":!!(null!==selectedOptions&&void 0!==selectedOptions&&selectedOptions[0])||!!placeholder,alert:alert,tabIndex:rest.disabled?-1:0,onClick:function onClick(){return setIsOpenOptions(!isOpenOptions)},className:rest.className,style:rest.style,ref:containerRef,children:[label&&"unstyled"!==variant&&/*#__PURE__*/(0,_jsxRuntime.jsx)("label",{title:label,children:label}),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{className:"container_selected_options",children:null!==selectedOptions&&void 0!==selectedOptions&&selectedOptions[0]?selectedOptions.map(function(option,index){return"function"==typeof renderOptions?/*#__PURE__*/(0,_jsxRuntime.jsx)(SelectedOptionsWithCustomComponent,{option:option},"custom-option-selected-".concat(index)):/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles2.SelectedOptionSpan,{hasSelectedOption:!0,children:[null===option||void 0===option?void 0:option.label,1<selectedOptions.length&&index<selectedOptions.length-1&&","]},index)}):/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles2.SelectedOptionSpan,{title:"placeholder",children:placeholder})}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_Flex.default,{className:"select_container_icon",children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"chevron-down"})})]}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_ReactPortal.ReactPortal,{wrapperId:"portal-root",children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.OptionsContainer,{ref:optionsModalRef,open:isOpenOptions,style:_objectSpread(_objectSpread({maxWidth:"".concat(null===(_containerRef$current=containerRef.current)||void 0===_containerRef$current?void 0:_containerRef$current.getBoundingClientRect().width,"px")},optionsContainerStyles),{},{left:positionsSelect.left,top:positionsSelect.top}),children:_react.Children.map(children,function(child){var isSelectItemElement=(null===child||void 0===child?void 0:child.type)===_SelectItem.SelectItem;if(!/*#__PURE__*/(0,_react.isValidElement)(child)||!isSelectItemElement)return/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{children:child});var childElement=child,isSelectedOption=null===selectedOptions||void 0===selectedOptions?void 0:selectedOptions.find(function(option){var _childElement$props;return option.value===(null===(_childElement$props=childElement.props)||void 0===_childElement$props?void 0:_childElement$props.value)}),className=(0,_classnames.default)("select-item",{selected:isSelectedOption});return/*#__PURE__*/(0,_react.cloneElement)(childElement,{onClick:function onClick(event){var _childElement$props2,_childElement$props2$;null===(_childElement$props2=childElement.props)||void 0===_childElement$props2||null===(_childElement$props2$=_childElement$props2.onClick)||void 0===_childElement$props2$?void 0:_childElement$props2$.call(_childElement$props2,event),event.currentTarget.classList.contains("select-item")&&changeMultipleOption(childElement.props.value)},className:className})})})}),!!helperText&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles2.HelperText,{alert:alert,children:helperText})]})})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/NewSelect/single/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/NewSelect/single/index.tsx"],"names":[],"mappings":";AAuBA,OAAO,EAAgB,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEjE,wBAAgB,eAAe,CAAC,CAAC,EAAE,EACjC,KAAU,EACV,WAAgB,EAChB,KAAK,EACL,UAAU,EACV,OAAO,EACP,QAAQ,EACR,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,EACR,aAAa,EACb,sBAAsB,EACtB,GAAG,IAAI,EACR,EAAE,uBAAuB,CAAC,CAAC,CAAC,eA0I5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.NewSingleSelect=NewSingleSelect;var _react=require("react"),_Flex=_interopRequireDefault(require("../../Flex")),_Icon=_interopRequireDefault(require("../../Icon")),_ReactPortal=require("../../ReactPortal"),_SelectItem=require("../components/SelectItem"),_useReposition=require("../../../shared/hooks/useReposition"),_useOnClickOutside=require("../../../shared/hooks/useOnClickOutside"),_styles=require("../components/OptionsSelect/styles"),_styles2=require("../styles"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["label","placeholder","alert","helperText","variant","children","value","onClose","onOpen","onChange","renderOptions","optionsContainerStyles"];/* eslint-disable no-console */function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}function NewSingleSelect(_ref){var _containerRef$current,_ref$label=_ref.label,label=void 0===_ref$label?"":_ref$label,_ref$placeholder=_ref.placeholder,placeholder=void 0===_ref$placeholder?"":_ref$placeholder,alert=_ref.alert,helperText=_ref.helperText,variant=_ref.variant,children=_ref.children,value=_ref.value,onClose=_ref.onClose,onOpen=_ref.onOpen,onChange=_ref.onChange,renderOptions=_ref.renderOptions,optionsContainerStyles=_ref.optionsContainerStyles,rest=_objectWithoutProperties(_ref,_excluded),containerRef=(0,_react.useRef)(null),selectRef=(0,_react.useRef)(null),_useState=(0,_react.useState)(!1),_useState2=_slicedToArray(_useState,2),isOpenOptions=_useState2[0],setIsOpenOptions=_useState2[1],_useState3=(0,_react.useState)(),_useState4=_slicedToArray(_useState3,2),selectedOption=_useState4[0],setSelectedOption=_useState4[1],optionsModalRef=(0,_react.useRef)(null),_useState5=(0,_react.useState)([]),_useState6=_slicedToArray(_useState5,2),options=_useState6[0],setOptions=_useState6[1],findOption=options.find(function(option){return option.value===selectedOption}),isFalseOptions=!1===(null===findOption||void 0===findOption?void 0:findOption.value),textPlaceholder=null!==findOption&&void 0!==findOption&&findOption.value||isFalseOptions?null===findOption||void 0===findOption?void 0:findOption.label:placeholder;(0,_react.useEffect)(function(){var _options$,_optionsModalRef$curr;if(!(null!==options&&void 0!==options&&null!==(_options$=options[0])&&void 0!==_options$&&_options$.value)){var childs=null===(_optionsModalRef$curr=optionsModalRef.current)||void 0===_optionsModalRef$curr?void 0:_optionsModalRef$curr.childNodes,newOptions=[];null===childs||void 0===childs?void 0:childs.forEach(function(child){var _child$classList;null!==(_child$classList=child.classList)&&void 0!==_child$classList&&_child$classList.contains("select-item")&&newOptions.push({value:null===child||void 0===child?void 0:child.value,label:null===child||void 0===child?void 0:child.innerText})}),setOptions(newOptions)}},[children,optionsModalRef.current,containerRef.current]),(0,_react.useEffect)(function(){function handler(){setIsOpenOptions(!1)}if(isOpenOptions){var _document;null===onOpen||void 0===onOpen?void 0:onOpen(),null===(_document=document)||void 0===_document?void 0:_document.addEventListener("scroll",handler)}else{var _document2;null===onClose||void 0===onClose?void 0:onClose(),null===(_document2=document)||void 0===_document2?void 0:_document2.removeEventListener("scroll",handler)}return function(){var _document3;return null===(_document3=document)||void 0===_document3?void 0:_document3.removeEventListener("scroll",handler)}},[isOpenOptions]),(0,_useOnClickOutside.useOnClickOutside)([containerRef,optionsModalRef],function(){isOpenOptions&&setIsOpenOptions(!1)});var positionsSelect=(0,_useReposition.useReposition)({containerRef:optionsModalRef,triggerRef:selectRef},[children]);return(0,_react.useEffect)(function(){setSelectedOption(value)},[value]),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{ref:selectRef,style:{width:"100%"},children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",style:{width:"100%"},children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles2.SelectContainer,{"data-disabled":rest.disabled,"data-variant":variant,"data-label-in-top":!!textPlaceholder||!!placeholder,alert:alert,tabIndex:rest.disabled?-1:0,onClick:function onClick(){return setIsOpenOptions(!isOpenOptions)},className:rest.className,style:rest.style,ref:containerRef,children:[label&&"unstyled"!==variant&&/*#__PURE__*/(0,_jsxRuntime.jsx)("label",{children:label}),"function"==typeof renderOptions&&selectedOption?/*#__PURE__*/(0,_jsxRuntime.jsx)(function SelectedOptionsWithCustomComponent(){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:null===renderOptions||void 0===renderOptions?void 0:renderOptions(selectedOption)})},{},"custom-option-selected-".concat(textPlaceholder)):/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles2.SelectedOptionSpan,{hasSelectedOption:!!selectedOption||isFalseOptions,children:textPlaceholder}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_Flex.default,{className:"select_container_icon",children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"chevron-down",color:"neutral.neutral5"})})]}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_ReactPortal.ReactPortal,{wrapperId:"portal-root",children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.OptionsContainer,{ref:optionsModalRef,open:isOpenOptions,style:_objectSpread(_objectSpread({maxWidth:"".concat(null===(_containerRef$current=containerRef.current)||void 0===_containerRef$current?void 0:_containerRef$current.getBoundingClientRect().width,"px")},optionsContainerStyles),{},{left:positionsSelect.left,top:positionsSelect.top}),children:_react.Children.map(children,function(child){var isSelectItemElement=(null===child||void 0===child?void 0:child.type)===_SelectItem.SelectItem;if(!/*#__PURE__*/(0,_react.isValidElement)(child)||!isSelectItemElement)return/*#__PURE__*/(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:child});var childElement=child;return/*#__PURE__*/(0,_react.cloneElement)(childElement,{onClick:function onClick(event){var _childElement$props,_childElement$props$o;null===(_childElement$props=childElement.props)||void 0===_childElement$props||null===(_childElement$props$o=_childElement$props.onClick)||void 0===_childElement$props$o?void 0:_childElement$props$o.call(_childElement$props,event),event.currentTarget.classList.contains("select-item")&&(setIsOpenOptions(!1),setSelectedOption(childElement.props.value),null===onChange||void 0===onChange?void 0:onChange(childElement.props.value))}})})})}),!!helperText&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles2.HelperText,{alert:alert,children:helperText})]})})}
|
|
1
|
+
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.NewSingleSelect=NewSingleSelect;var _react=require("react"),_Flex=_interopRequireDefault(require("../../Flex")),_Icon=_interopRequireDefault(require("../../Icon")),_ReactPortal=require("../../ReactPortal"),_SelectItem=require("../components/SelectItem"),_useReposition=require("../../../shared/hooks/useReposition"),_useOnClickOutside=require("../../../shared/hooks/useOnClickOutside"),_getPrimitiveValue=require("../../../utils/get-primitive-value"),_styles=require("../components/OptionsSelect/styles"),_styles2=require("../styles"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["label","placeholder","alert","helperText","variant","children","value","onClose","onOpen","onChange","renderOptions","optionsContainerStyles"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}function NewSingleSelect(_ref){var _containerRef$current,_ref$label=_ref.label,label=void 0===_ref$label?"":_ref$label,_ref$placeholder=_ref.placeholder,placeholder=void 0===_ref$placeholder?"":_ref$placeholder,alert=_ref.alert,helperText=_ref.helperText,variant=_ref.variant,children=_ref.children,value=_ref.value,onClose=_ref.onClose,onOpen=_ref.onOpen,onChange=_ref.onChange,renderOptions=_ref.renderOptions,optionsContainerStyles=_ref.optionsContainerStyles,rest=_objectWithoutProperties(_ref,_excluded),containerRef=(0,_react.useRef)(null),selectRef=(0,_react.useRef)(null),_useState=(0,_react.useState)(!1),_useState2=_slicedToArray(_useState,2),isOpenOptions=_useState2[0],setIsOpenOptions=_useState2[1],_useState3=(0,_react.useState)(),_useState4=_slicedToArray(_useState3,2),selectedOption=_useState4[0],setSelectedOption=_useState4[1],optionsModalRef=(0,_react.useRef)(null),_useState5=(0,_react.useState)([]),_useState6=_slicedToArray(_useState5,2),options=_useState6[0],setOptions=_useState6[1],findOption=options.find(function(option){return option.value===selectedOption}),isFalseOptions=!1===(null===findOption||void 0===findOption?void 0:findOption.value),textPlaceholder=null!==findOption&&void 0!==findOption&&findOption.value||isFalseOptions?null===findOption||void 0===findOption?void 0:findOption.label:placeholder;(0,_react.useEffect)(function(){var _options$,_optionsModalRef$curr;if(!(null!==options&&void 0!==options&&null!==(_options$=options[0])&&void 0!==_options$&&_options$.value)){var childs=null===(_optionsModalRef$curr=optionsModalRef.current)||void 0===_optionsModalRef$curr?void 0:_optionsModalRef$curr.childNodes,newOptions=[];null===childs||void 0===childs?void 0:childs.forEach(function(child){var _child$classList,typeOfValue=child.getAttribute("data-type-of-value");null!==(_child$classList=child.classList)&&void 0!==_child$classList&&_child$classList.contains("select-item")&&newOptions.push({value:(0,_getPrimitiveValue.getPrimitiveValue)(null===child||void 0===child?void 0:child.value,typeOfValue),label:null===child||void 0===child?void 0:child.innerText})}),setOptions(newOptions)}},[children,optionsModalRef.current,containerRef.current]),(0,_react.useEffect)(function(){function handler(){setIsOpenOptions(!1)}if(isOpenOptions){var _document;null===onOpen||void 0===onOpen?void 0:onOpen(),null===(_document=document)||void 0===_document?void 0:_document.addEventListener("scroll",handler)}else{var _document2;null===onClose||void 0===onClose?void 0:onClose(),null===(_document2=document)||void 0===_document2?void 0:_document2.removeEventListener("scroll",handler)}return function(){var _document3;return null===(_document3=document)||void 0===_document3?void 0:_document3.removeEventListener("scroll",handler)}},[isOpenOptions]),(0,_useOnClickOutside.useOnClickOutside)([containerRef,optionsModalRef],function(){isOpenOptions&&setIsOpenOptions(!1)});var positionsSelect=(0,_useReposition.useReposition)({containerRef:optionsModalRef,triggerRef:selectRef},[children]);return(0,_react.useEffect)(function(){setSelectedOption(value)},[value]),/*#__PURE__*/(0,_jsxRuntime.jsx)("div",{ref:selectRef,style:{width:"100%"},children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_Flex.default,{direction:"column",style:{width:"100%"},children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles2.SelectContainer,{"data-disabled":rest.disabled,"data-variant":variant,"data-label-in-top":!!textPlaceholder||!!placeholder,alert:alert,tabIndex:rest.disabled?-1:0,onClick:function onClick(){return setIsOpenOptions(!isOpenOptions)},className:rest.className,style:rest.style,ref:containerRef,children:[label&&"unstyled"!==variant&&/*#__PURE__*/(0,_jsxRuntime.jsx)("label",{children:label}),"function"==typeof renderOptions&&selectedOption?/*#__PURE__*/(0,_jsxRuntime.jsx)(function SelectedOptionsWithCustomComponent(){return/*#__PURE__*/(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:null===renderOptions||void 0===renderOptions?void 0:renderOptions(selectedOption)})},{},"custom-option-selected-".concat(textPlaceholder)):/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles2.SelectedOptionSpan,{hasSelectedOption:!!selectedOption||isFalseOptions,children:textPlaceholder}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_Flex.default,{className:"select_container_icon",children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"chevron-down",color:"neutral.neutral5"})})]}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_ReactPortal.ReactPortal,{wrapperId:"portal-root",children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.OptionsContainer,{ref:optionsModalRef,open:isOpenOptions,style:_objectSpread(_objectSpread({maxWidth:"".concat(null===(_containerRef$current=containerRef.current)||void 0===_containerRef$current?void 0:_containerRef$current.getBoundingClientRect().width,"px")},optionsContainerStyles),{},{left:positionsSelect.left,top:positionsSelect.top}),children:_react.Children.map(children,function(child){var isSelectItemElement=(null===child||void 0===child?void 0:child.type)===_SelectItem.SelectItem;if(!/*#__PURE__*/(0,_react.isValidElement)(child)||!isSelectItemElement)return/*#__PURE__*/(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:child});var childElement=child;return/*#__PURE__*/(0,_react.cloneElement)(childElement,{onClick:function onClick(event){var _childElement$props,_childElement$props$o;null===(_childElement$props=childElement.props)||void 0===_childElement$props||null===(_childElement$props$o=_childElement$props.onClick)||void 0===_childElement$props$o?void 0:_childElement$props$o.call(_childElement$props,event),event.currentTarget.classList.contains("select-item")&&(setIsOpenOptions(!1),setSelectedOption(childElement.props.value),null===onChange||void 0===onChange?void 0:onChange(childElement.props.value))}})})})}),!!helperText&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles2.HelperText,{alert:alert,children:helperText})]})})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/NewSelect/utils.ts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAY9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.removeDuplicateOptions=removeDuplicateOptions;function _createForOfIteratorHelper(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&"number"==typeof o.length){it&&(o=it);var i=0,F=function(){};return{s:F,n:function n(){return i>=o.length?{done:!0}:{done:!1,value:o[i++]}},e:function e(_e){throw _e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var err,normalCompletion=!0,didErr=!1;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();return normalCompletion=step.done,step},e:function e(_e2){didErr=!0,err=_e2},f:function f(){try{normalCompletion||null==it.return||it.return()}finally{if(didErr)throw err}}}}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function removeDuplicateOptions(options){var _step,uniqueOptions=[],valuesSeen=new Set,_iterator=_createForOfIteratorHelper(options);try{for(_iterator.s();!(_step=_iterator.n()).done;){var option=_step.value;valuesSeen.has(option.value)||(uniqueOptions.push(option),valuesSeen.add(option.value))}}catch(err){_iterator.e(err)}finally{_iterator.f()}return uniqueOptions}
|
|
@@ -8,8 +8,262 @@ interface OptionsContainerProps {
|
|
|
8
8
|
top: string;
|
|
9
9
|
}
|
|
10
10
|
export declare const OptionsContainer: import("@emotion/styled").StyledComponent<{
|
|
11
|
+
slot?: string | undefined;
|
|
12
|
+
title?: string | undefined;
|
|
13
|
+
color?: string | undefined;
|
|
14
|
+
translate?: "no" | "yes" | undefined;
|
|
15
|
+
id?: string | undefined;
|
|
16
|
+
hidden?: boolean | undefined;
|
|
17
|
+
className?: string | undefined;
|
|
18
|
+
lang?: string | undefined;
|
|
19
|
+
role?: import("react").AriaRole | undefined;
|
|
20
|
+
tabIndex?: number | undefined;
|
|
21
|
+
"aria-activedescendant"?: string | undefined;
|
|
22
|
+
"aria-atomic"?: (boolean | "false" | "true") | undefined;
|
|
23
|
+
"aria-autocomplete"?: "none" | "list" | "inline" | "both" | undefined;
|
|
24
|
+
"aria-busy"?: (boolean | "false" | "true") | undefined;
|
|
25
|
+
"aria-checked"?: boolean | "mixed" | "false" | "true" | undefined;
|
|
26
|
+
"aria-colcount"?: number | undefined;
|
|
27
|
+
"aria-colindex"?: number | undefined;
|
|
28
|
+
"aria-colspan"?: number | undefined;
|
|
29
|
+
"aria-controls"?: string | undefined;
|
|
30
|
+
"aria-current"?: boolean | "time" | "page" | "false" | "true" | "step" | "location" | "date" | undefined;
|
|
31
|
+
"aria-describedby"?: string | undefined;
|
|
32
|
+
"aria-details"?: string | undefined;
|
|
33
|
+
"aria-disabled"?: (boolean | "false" | "true") | undefined;
|
|
34
|
+
"aria-dropeffect"?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
|
|
35
|
+
"aria-errormessage"?: string | undefined;
|
|
36
|
+
"aria-expanded"?: (boolean | "false" | "true") | undefined;
|
|
37
|
+
"aria-flowto"?: string | undefined;
|
|
38
|
+
"aria-grabbed"?: (boolean | "false" | "true") | undefined;
|
|
39
|
+
"aria-haspopup"?: boolean | "dialog" | "menu" | "grid" | "listbox" | "false" | "true" | "tree" | undefined;
|
|
40
|
+
"aria-hidden"?: (boolean | "false" | "true") | undefined;
|
|
41
|
+
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
|
42
|
+
"aria-keyshortcuts"?: string | undefined;
|
|
43
|
+
"aria-label"?: string | undefined;
|
|
44
|
+
"aria-labelledby"?: string | undefined;
|
|
45
|
+
"aria-level"?: number | undefined;
|
|
46
|
+
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
|
47
|
+
"aria-modal"?: (boolean | "false" | "true") | undefined;
|
|
48
|
+
"aria-multiline"?: (boolean | "false" | "true") | undefined;
|
|
49
|
+
"aria-multiselectable"?: (boolean | "false" | "true") | undefined;
|
|
50
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
51
|
+
"aria-owns"?: string | undefined;
|
|
52
|
+
"aria-placeholder"?: string | undefined;
|
|
53
|
+
"aria-posinset"?: number | undefined;
|
|
54
|
+
"aria-pressed"?: boolean | "mixed" | "false" | "true" | undefined;
|
|
55
|
+
"aria-readonly"?: (boolean | "false" | "true") | undefined;
|
|
56
|
+
"aria-relevant"?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
|
57
|
+
"aria-required"?: (boolean | "false" | "true") | undefined;
|
|
58
|
+
"aria-roledescription"?: string | undefined;
|
|
59
|
+
"aria-rowcount"?: number | undefined;
|
|
60
|
+
"aria-rowindex"?: number | undefined;
|
|
61
|
+
"aria-rowspan"?: number | undefined;
|
|
62
|
+
"aria-selected"?: (boolean | "false" | "true") | undefined;
|
|
63
|
+
"aria-setsize"?: number | undefined;
|
|
64
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
65
|
+
"aria-valuemax"?: number | undefined;
|
|
66
|
+
"aria-valuemin"?: number | undefined;
|
|
67
|
+
"aria-valuenow"?: number | undefined;
|
|
68
|
+
"aria-valuetext"?: string | undefined;
|
|
69
|
+
dangerouslySetInnerHTML?: {
|
|
70
|
+
__html: string;
|
|
71
|
+
} | undefined;
|
|
72
|
+
onCopy?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
73
|
+
onCopyCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
74
|
+
onCut?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
75
|
+
onCutCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
76
|
+
onPaste?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
77
|
+
onPasteCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
78
|
+
onCompositionEnd?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
79
|
+
onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
80
|
+
onCompositionStart?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
81
|
+
onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
82
|
+
onCompositionUpdate?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
83
|
+
onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
84
|
+
onFocus?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
|
|
85
|
+
onFocusCapture?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
|
|
86
|
+
onBlur?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
|
|
87
|
+
onBlurCapture?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
|
|
88
|
+
onChange?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
89
|
+
onChangeCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
90
|
+
onBeforeInput?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
91
|
+
onBeforeInputCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
92
|
+
onInput?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
93
|
+
onInputCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
94
|
+
onReset?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
95
|
+
onResetCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
96
|
+
onSubmit?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
97
|
+
onSubmitCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
98
|
+
onInvalid?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
99
|
+
onInvalidCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
100
|
+
onLoad?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
101
|
+
onLoadCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
102
|
+
onError?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
103
|
+
onErrorCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
104
|
+
onKeyDown?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
105
|
+
onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
106
|
+
onKeyPress?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
107
|
+
onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
108
|
+
onKeyUp?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
109
|
+
onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
110
|
+
onAbort?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
111
|
+
onAbortCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
112
|
+
onCanPlay?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
113
|
+
onCanPlayCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
114
|
+
onCanPlayThrough?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
115
|
+
onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
116
|
+
onDurationChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
117
|
+
onDurationChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
118
|
+
onEmptied?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
119
|
+
onEmptiedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
120
|
+
onEncrypted?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
121
|
+
onEncryptedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
122
|
+
onEnded?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
123
|
+
onEndedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
124
|
+
onLoadedData?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
125
|
+
onLoadedDataCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
126
|
+
onLoadedMetadata?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
127
|
+
onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
128
|
+
onLoadStart?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
129
|
+
onLoadStartCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
130
|
+
onPause?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
131
|
+
onPauseCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
132
|
+
onPlay?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
133
|
+
onPlayCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
134
|
+
onPlaying?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
135
|
+
onPlayingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
136
|
+
onProgress?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
137
|
+
onProgressCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
138
|
+
onRateChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
139
|
+
onRateChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
140
|
+
onResize?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
141
|
+
onResizeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
142
|
+
onSeeked?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
143
|
+
onSeekedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
144
|
+
onSeeking?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
145
|
+
onSeekingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
146
|
+
onStalled?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
147
|
+
onStalledCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
148
|
+
onSuspend?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
149
|
+
onSuspendCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
150
|
+
onTimeUpdate?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
151
|
+
onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
152
|
+
onVolumeChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
153
|
+
onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
154
|
+
onWaiting?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
155
|
+
onWaitingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
156
|
+
onAuxClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
157
|
+
onAuxClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
158
|
+
onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
159
|
+
onClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
160
|
+
onContextMenu?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
161
|
+
onContextMenuCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
162
|
+
onDoubleClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
163
|
+
onDoubleClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
164
|
+
onDragCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
165
|
+
onDragEndCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
166
|
+
onDragEnter?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
167
|
+
onDragEnterCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
168
|
+
onDragExit?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
169
|
+
onDragExitCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
170
|
+
onDragLeave?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
171
|
+
onDragLeaveCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
172
|
+
onDragOver?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
173
|
+
onDragOverCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
174
|
+
onDragStartCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
175
|
+
onDrop?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
176
|
+
onDropCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
177
|
+
onMouseDown?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
178
|
+
onMouseDownCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
179
|
+
onMouseEnter?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
180
|
+
onMouseLeave?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
181
|
+
onMouseMove?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
182
|
+
onMouseMoveCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
183
|
+
onMouseOut?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
184
|
+
onMouseOutCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
185
|
+
onMouseOver?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
186
|
+
onMouseOverCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
187
|
+
onMouseUp?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
188
|
+
onMouseUpCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
189
|
+
onSelect?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
190
|
+
onSelectCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
191
|
+
onTouchCancel?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
192
|
+
onTouchCancelCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
193
|
+
onTouchEnd?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
194
|
+
onTouchEndCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
195
|
+
onTouchMove?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
196
|
+
onTouchMoveCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
197
|
+
onTouchStart?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
198
|
+
onTouchStartCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
199
|
+
onPointerDown?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
200
|
+
onPointerDownCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
201
|
+
onPointerMove?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
202
|
+
onPointerMoveCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
203
|
+
onPointerUp?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
204
|
+
onPointerUpCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
205
|
+
onPointerCancel?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
206
|
+
onPointerCancelCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
207
|
+
onPointerEnter?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
208
|
+
onPointerEnterCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
209
|
+
onPointerLeave?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
210
|
+
onPointerLeaveCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
211
|
+
onPointerOver?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
212
|
+
onPointerOverCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
213
|
+
onPointerOut?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
214
|
+
onPointerOutCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
215
|
+
onGotPointerCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
216
|
+
onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
217
|
+
onLostPointerCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
218
|
+
onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
219
|
+
onScroll?: import("react").UIEventHandler<HTMLDivElement> | undefined;
|
|
220
|
+
onScrollCapture?: import("react").UIEventHandler<HTMLDivElement> | undefined;
|
|
221
|
+
onWheel?: import("react").WheelEventHandler<HTMLDivElement> | undefined;
|
|
222
|
+
onWheelCapture?: import("react").WheelEventHandler<HTMLDivElement> | undefined;
|
|
223
|
+
onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
224
|
+
onAnimationEnd?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
225
|
+
onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
226
|
+
onAnimationIteration?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
227
|
+
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
228
|
+
onTransitionEnd?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
229
|
+
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
230
|
+
defaultChecked?: boolean | undefined;
|
|
231
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
232
|
+
suppressContentEditableWarning?: boolean | undefined;
|
|
233
|
+
suppressHydrationWarning?: boolean | undefined;
|
|
234
|
+
accessKey?: string | undefined;
|
|
235
|
+
autoFocus?: boolean | undefined;
|
|
236
|
+
contentEditable?: "inherit" | (boolean | "false" | "true") | undefined;
|
|
237
|
+
contextMenu?: string | undefined;
|
|
238
|
+
dir?: string | undefined;
|
|
239
|
+
draggable?: (boolean | "false" | "true") | undefined;
|
|
240
|
+
nonce?: string | undefined;
|
|
241
|
+
placeholder?: string | undefined;
|
|
242
|
+
spellCheck?: (boolean | "false" | "true") | undefined;
|
|
243
|
+
radioGroup?: string | undefined;
|
|
244
|
+
about?: string | undefined;
|
|
245
|
+
datatype?: string | undefined;
|
|
246
|
+
inlist?: any;
|
|
247
|
+
prefix?: string | undefined;
|
|
248
|
+
property?: string | undefined;
|
|
249
|
+
resource?: string | undefined;
|
|
250
|
+
typeof?: string | undefined;
|
|
251
|
+
vocab?: string | undefined;
|
|
252
|
+
autoCapitalize?: string | undefined;
|
|
253
|
+
autoCorrect?: string | undefined;
|
|
254
|
+
autoSave?: string | undefined;
|
|
255
|
+
itemProp?: string | undefined;
|
|
256
|
+
itemScope?: boolean | undefined;
|
|
257
|
+
itemType?: string | undefined;
|
|
258
|
+
itemID?: string | undefined;
|
|
259
|
+
itemRef?: string | undefined;
|
|
260
|
+
results?: number | undefined;
|
|
261
|
+
security?: string | undefined;
|
|
262
|
+
unselectable?: "off" | "on" | undefined;
|
|
263
|
+
inputMode?: "text" | "none" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
264
|
+
is?: string | undefined;
|
|
265
|
+
} & import("framer-motion").MotionProps & import("react").RefAttributes<HTMLDivElement> & {
|
|
11
266
|
theme?: import("@emotion/react").Theme | undefined;
|
|
12
|
-
|
|
13
|
-
} & OptionsContainerProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
267
|
+
} & OptionsContainerProps, {}, {}>;
|
|
14
268
|
export {};
|
|
15
269
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/Select/components/OptionsSelect/styles.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/Select/components/OptionsSelect/styles.ts"],"names":[],"mappings":";AAIA,UAAU,qBAAqB;IAC7B,IAAI,EAAE,OAAO,CAAC;IAEd,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAqC3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OptionsContainer=void 0;var _templateObject,_react=require("@emotion/react"),_styled=_interopRequireDefault(require("@emotion/styled")),_excluded=["theme"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _taggedTemplateLiteral(strings,raw){return raw||(raw=strings.slice(0)),Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}))}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}var OptionsContainer=_styled.default.div(function(_ref){var theme=_ref.theme,props=_objectWithoutProperties(_ref,_excluded);return(0,_react.css)(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: ",";\n min-width: ",";\n max-height: calc("," - 20px);\n position: fixed;\n left: ",";\n top: ",";\n z-index: ",";\n opacity: ",";\n pointer-events: ",";\n transition: opacity ease ",";\n overflow-y: auto;\n overflow-x: hidden;\n background: ",";\n border: 2px solid ",";\n border-radius: ",";\n\n &::-webkit-scrollbar {\n width: 6px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n border-radius: ",";\n background: ",";\n }\n li {\n list-style: none;\n }\n "])),props.maxWidth,props.minWidth||"initial",props.maxHeight,props.left,props.top,theme.zIndex.level24,props.open?1:0,props.open?"auto":"none",theme.transition.speed,theme.colors.neutral.white,theme.colors.neutral.neutral1,theme.borderRadius.default,theme.borderRadius.default,theme.colors.primary.default)});exports.OptionsContainer=OptionsContainer;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OptionsContainer=void 0;var _templateObject,_react=require("@emotion/react"),_styled=_interopRequireDefault(require("@emotion/styled")),_framerMotion=require("framer-motion"),_excluded=["theme"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _taggedTemplateLiteral(strings,raw){return raw||(raw=strings.slice(0)),Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}))}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}var OptionsContainer=(0,_styled.default)(_framerMotion.motion.div)(function(_ref){var theme=_ref.theme,props=_objectWithoutProperties(_ref,_excluded);return(0,_react.css)(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: ",";\n min-width: ",";\n max-height: calc("," - 20px);\n position: fixed;\n left: ",";\n top: ",";\n z-index: ",";\n opacity: ",";\n pointer-events: ",";\n transition: opacity ease ",";\n overflow-y: auto;\n overflow-x: hidden;\n background: ",";\n border: 2px solid ",";\n border-radius: ",";\n\n &::-webkit-scrollbar {\n width: 6px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n border-radius: ",";\n background: ",";\n }\n li {\n list-style: none;\n }\n "])),props.maxWidth,props.minWidth||"initial",props.maxHeight,props.left,props.top,theme.zIndex.level24,props.open?1:0,props.open?"auto":"none",theme.transition.speed,theme.colors.neutral.white,theme.colors.neutral.neutral1,theme.borderRadius.default,theme.borderRadius.default,theme.colors.primary.default)});exports.OptionsContainer=OptionsContainer;
|
|
@@ -17,4 +17,10 @@ export declare function removeLineBreaks(lineBreaks: string): string;
|
|
|
17
17
|
* @returns {string} The string without unnecessary spaces.
|
|
18
18
|
*/
|
|
19
19
|
export declare function replaceUnecessarySpaces(string: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Sanitizes a string by removing all non-alphanumeric characters, line breaks and unnecessary spaces.
|
|
22
|
+
* @param string
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
export declare function sanitizeString(string: string): string;
|
|
20
26
|
//# sourceMappingURL=strings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../../src/utils/formatters/strings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlE;AACD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE3D;AACD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE9D"}
|
|
1
|
+
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../../src/utils/formatters/strings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlE;AACD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE3D;AACD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.removeLineBreaks=removeLineBreaks,exports.replaceUnecessarySpaces=replaceUnecessarySpaces,exports.truncateString=truncateString;/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.removeLineBreaks=removeLineBreaks,exports.replaceUnecessarySpaces=replaceUnecessarySpaces,exports.sanitizeString=sanitizeString,exports.truncateString=truncateString;/**
|
|
2
2
|
* Truncates a string to a given character limit and adds ellipses at the end if necessary.
|
|
3
3
|
* @param {string} data - The string to truncate.
|
|
4
4
|
* @param {number} limit - The maximum number of characters the string can have.
|
|
@@ -11,4 +11,8 @@
|
|
|
11
11
|
* Replaces multiple consecutive spaces in a string with a single space and trims the string.
|
|
12
12
|
* @param {string} string - The string to replace unnecessary spaces in.
|
|
13
13
|
* @returns {string} The string without unnecessary spaces.
|
|
14
|
-
*/function replaceUnecessarySpaces(string){return string.replace(/ +/g," ").trim()}
|
|
14
|
+
*/function replaceUnecessarySpaces(string){return string.replace(/ +/g," ").trim()}/**
|
|
15
|
+
* Sanitizes a string by removing all non-alphanumeric characters, line breaks and unnecessary spaces.
|
|
16
|
+
* @param string
|
|
17
|
+
* @returns
|
|
18
|
+
*/function sanitizeString(string){return removeLineBreaks(replaceUnecessarySpaces(string.replace(/[^a-zA-Z0-9]+/g,"")))}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-primitive-value.d.ts","sourceRoot":"","sources":["../../src/utils/get-primitive-value.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAEzD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,GAAG,WAAW,CAarE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPrimitiveValue=getPrimitiveValue;function getPrimitiveValue(value,type){switch(type){case"number":return parseFloat(value);case"string":return value+"";case"boolean":return"true"===value;case"undefined":return;default:throw new Error("Unsupported type:".concat(type," of value:").concat(value));}}
|