forked from BuilderIO/demo-editor
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
259.43b8f2f4.chunk.js.download
1 lines (1 loc) · 21 KB
/
259.43b8f2f4.chunk.js.download
1
(this["webpackJsonp@builder.io/app"]=this["webpackJsonp@builder.io/app"]||[]).push([[259,26],{2028:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",function(){return VirtualizedSelect});var tslib__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5),_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(0),react_select__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(685),react_select_creatable__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(2383),react_window__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(2435),match_sorter__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(2091),react__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(3),react__WEBPACK_IMPORTED_MODULE_6___default=__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__),_designer_components_style_editor_input_style__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(2094),_constants_theme_constant__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(7),_material_ui_core__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(236),_material_ui_core__WEBPACK_IMPORTED_MODULE_9___default=__webpack_require__.n(_material_ui_core__WEBPACK_IMPORTED_MODULE_9__),_material_ui_core__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(105),_material_ui_core__WEBPACK_IMPORTED_MODULE_10___default=__webpack_require__.n(_material_ui_core__WEBPACK_IMPORTED_MODULE_10__),_material_ui_core__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(289),_material_ui_core__WEBPACK_IMPORTED_MODULE_11___default=__webpack_require__.n(_material_ui_core__WEBPACK_IMPORTED_MODULE_11__),_material_ui_core__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(446),_material_ui_core__WEBPACK_IMPORTED_MODULE_12___default=__webpack_require__.n(_material_ui_core__WEBPACK_IMPORTED_MODULE_12__),_material_ui_core__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(131),_material_ui_core__WEBPACK_IMPORTED_MODULE_13___default=__webpack_require__.n(_material_ui_core__WEBPACK_IMPORTED_MODULE_13__),_material_ui_core__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(2657),_material_ui_core__WEBPACK_IMPORTED_MODULE_14___default=__webpack_require__.n(_material_ui_core__WEBPACK_IMPORTED_MODULE_14__),lodash_uniqBy__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(550),lodash_uniqBy__WEBPACK_IMPORTED_MODULE_15___default=__webpack_require__.n(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_15__),_Loading__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(57),lodash_orderBy__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__(2434),lodash_orderBy__WEBPACK_IMPORTED_MODULE_17___default=__webpack_require__.n(lodash_orderBy__WEBPACK_IMPORTED_MODULE_17__),_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__(1);const DEFAULT_MENU_DIMENSIONS={optionHeight:40,rows:6,width:320},menuDimensionsContext=Object(react__WEBPACK_IMPORTED_MODULE_6__.createContext)(DEFAULT_MENU_DIMENSIONS),MenuList=props=>{var _a,_b,_c;const{options,children,getValue,isMulti,setValue,clearValue}=props;if(!Array.isArray(children))return Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)("div",{children});const{optionHeight,rows,width}=Object(react__WEBPACK_IMPORTED_MODULE_6__.useContext)(menuDimensionsContext),isMultipleGroups=Array.isArray((_a=options?.[0])===null||_a===void 0?void 0:_a.options),hasMultiplelabeledGroups=Array.isArray((_b=options?.[0])===null||_b===void 0?void 0:_b.options)&&Array.isArray((_c=options?.[1])===null||_c===void 0?void 0:_c.options);if(isMultipleGroups)return Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.a,{children:children.map((group,i)=>{var _a2;const activeOptionData=group.props.data,value2=getValue().map(v=>v.value),grandChildren=group.props.children,height=Math.min(grandChildren.length,rows)*optionHeight+(grandChildren.length>rows?Math.round(optionHeight/2):0),optionValues=((_a2=activeOptionData.options)===null||_a2===void 0?void 0:_a2.map(opt=>opt.value))||[],allSelected=optionValues.every(val=>value2.includes(val)),indeterminate=!allSelected&&value2.find(val=>optionValues.includes(val));return Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.c)("div",{children:[activeOptionData.label&&hasMultiplelabeledGroups&&!!optionValues.length&&Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_material_ui_core__WEBPACK_IMPORTED_MODULE_9___default.a,{disabled:!isMulti,css:{marginLeft:"auto",marginRight:0,width:"100%",height:optionHeight,transition:"opacity 0.2s"},onChange:(_,checked)=>{if(checked)setValue(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_15___default()(getValue().concat(activeOptionData.options),"value"),"select-option");else{const val=getValue().filter(opt=>!optionValues.includes(opt.value));setValue(val,"deselect-option")}},label:Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_material_ui_core__WEBPACK_IMPORTED_MODULE_10___default.a,Object.assign({css:{width:"100%"},variant:"caption"},{children:activeOptionData.label})),control:isMulti?Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_material_ui_core__WEBPACK_IMPORTED_MODULE_11___default.a,{checked:allSelected,indeterminate:!!indeterminate,color:"primary"}):Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)("div",{css:{padding:5}})}),Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)("div",Object.assign({style:hasMultiplelabeledGroups?{backgroundColor:"var(--off-background)"}:{paddingLeft:0}},{children:activeOptionData.loading?Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_Loading__WEBPACK_IMPORTED_MODULE_16__.a,{css:{margin:"auto"}}):optionValues.length?Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(react_window__WEBPACK_IMPORTED_MODULE_4__.a,Object.assign({height,width,itemCount:grandChildren.length,itemSize:optionHeight},{children:({style,index})=>Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_material_ui_core__WEBPACK_IMPORTED_MODULE_12___default.a,Object.assign({style:Object.assign(Object.assign({},style),!hasMultiplelabeledGroups&&{padding:0})},{children:Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_material_ui_core__WEBPACK_IMPORTED_MODULE_9___default.a,{css:{marginLeft:"auto",marginRight:0,width:"100%",transition:"opacity 0.2s"},style:value2[0]===activeOptionData.options[index].value?{backgroundColor:"var(--off-background)"}:{},onClick:event=>{var _a3;if(event.preventDefault(),isMulti)if(!getValue().find(opt=>activeOptionData.options[index].value===opt.value))setValue(getValue().concat(activeOptionData.options[index]),"select-option");else{const val=getValue().filter(opt=>opt.value!==activeOptionData.options[index].value);setValue(val,"deselect-option")}else((_a3=getValue()[0])===null||_a3===void 0?void 0:_a3.value)!==activeOptionData.options[index].value?setValue(activeOptionData.options[index],"select-option"):clearValue()},label:Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_material_ui_core__WEBPACK_IMPORTED_MODULE_13___default.a,Object.assign({disableHoverListener:!activeOptionData.options[index].caption,title:activeOptionData.options[index].caption||"",placement:"right"},{children:Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_material_ui_core__WEBPACK_IMPORTED_MODULE_10___default.a,Object.assign({css:{width:"100%",whiteSpace:"nowrap"},variant:"subheading"},{children:activeOptionData.options[index].label}))})),control:isMulti?Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_material_ui_core__WEBPACK_IMPORTED_MODULE_11___default.a,{checked:value2?.includes(activeOptionData.options[index].value),color:"primary"}):Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_material_ui_core__WEBPACK_IMPORTED_MODULE_14___default.a,{checked:value2[0]===activeOptionData.options[index].value,color:"primary"})})}),index)})):group}))]},i)})});const[value]=getValue(),indexOfValue=options.indexOf(value),initialOffset=children.length>=rows&&indexOfValue>=rows?indexOfValue*optionHeight-optionHeight*5:0,rowsToShow=children.length>=rows?rows:children.length;return Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(react_window__WEBPACK_IMPORTED_MODULE_4__.a,Object.assign({height:rowsToShow*optionHeight,width,itemCount:children.length,itemSize:optionHeight,initialScrollOffset:initialOffset},{children:({style,index})=>Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)("div",Object.assign({style},{children:children[index]}))}))},VirtualizedSelect=_a=>{var{components,styles,options,isCreatable=!1,menuDimensions=DEFAULT_MENU_DIMENSIONS,getSearchValue}=_a,otherProps=Object(tslib__WEBPACK_IMPORTED_MODULE_0__.b)(_a,["components","styles","options","isCreatable","menuDimensions","getSearchValue"]);const[sortedOptions,setSortedOptions]=Object(react__WEBPACK_IMPORTED_MODULE_6__.useState)(options);Object(react__WEBPACK_IMPORTED_MODULE_6__.useEffect)(()=>{var _a2;if(Array.isArray((_a2=options[0])===null||_a2===void 0?void 0:_a2.options)){const cloned=options.map(opt=>Object.assign(Object.assign({},opt),{options:lodash_orderBy__WEBPACK_IMPORTED_MODULE_17___default()(opt.options,["count","label"],["desc","asc"])}));setSortedOptions(cloned)}else setSortedOptions(options)},[options]);const onInputChange=Object(react__WEBPACK_IMPORTED_MODULE_6__.useCallback)((value,{action})=>{if(action==="input-change")if(Array.isArray(options[0].options)){const cloned=options.map(opt=>Object.assign(Object.assign({},opt),{options:Object(match_sorter__WEBPACK_IMPORTED_MODULE_5__.a)(opt.options,value,{keys:["label","count"]})}));setSortedOptions(cloned)}else{const filteredOptions=Object(match_sorter__WEBPACK_IMPORTED_MODULE_5__.a)(options,value,{keys:["label"]});setSortedOptions(filteredOptions),getSearchValue&&getSearchValue(value)}else action==="menu-close"&&setSortedOptions(options)},[options,setSortedOptions]),dimensions=Object.assign(Object.assign({},DEFAULT_MENU_DIMENSIONS),menuDimensions),props=Object.assign(Object.assign({},otherProps),{onInputChange,components:Object.assign({MenuList},components),filterOption:()=>!0,styles:Object.assign(Object.assign({},styles),{option(provided,props2){const{isFocused,isSelected}=props2,isSelectedStyle={backgroundColor:_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_18__.appState.theme.isDarkMode?_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_18__.appState.theme.colors.primaryVeryLight:"var(--select-selected-background)",color:"var(--text-regular)"},isFocusedStyle={backgroundColor:"var(--select-hover-background)"},style={color:"inherit",cursor:"pointer","&:active":{backgroundColor:"var(--select-selected-background)"}};return isFocused&&Object.assign(style,isFocusedStyle),isSelected&&Object.assign(style,isSelectedStyle),Object.assign(Object.assign({},provided),style)},menu:(provided,props2)=>{var _a2;return Object.assign(Object.assign(Object.assign(Object.assign({},provided),{border:"var(--control-border-color)",boxShadow:"var(--shadow)",overflow:"hidden",width:"initial",zIndex:6}),(_a2=styles?.menu)===null||_a2===void 0?void 0:_a2.call(styles,provided,props2)),{backgroundColor:"var(--background)"})},control:(provided,props2)=>{var _a2;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},provided),{minWidth:100,minHeight:0}),_designer_components_style_editor_input_style__WEBPACK_IMPORTED_MODULE_7__.a),{boxShadow:"none",background:"transparent",cursor:"pointer"}),(_a2=styles?.control)===null||_a2===void 0?void 0:_a2.call(styles,provided,props2))},container:(provided,props2)=>{var _a2;return Object.assign(Object.assign({},provided),(_a2=styles?.container)===null||_a2===void 0?void 0:_a2.call(styles,provided,props2))},input:(provided,props2)=>{var _a2;return Object.assign(Object.assign(Object.assign({},provided),(_a2=styles?.input)===null||_a2===void 0?void 0:_a2.call(styles,provided,props2)),{color:"var(--text-regular)"})},valueContainer:(provided,props2)=>{var _a2;return Object.assign(Object.assign(Object.assign({},provided),(_a2=styles?.valueContainer)===null||_a2===void 0?void 0:_a2.call(styles,provided,props2)),{padding:2})},singleValue:(provided,props2)=>{var _a2;return Object.assign(Object.assign(Object.assign({},provided),{color:"inherit"}),(_a2=styles?.singleValue)===null||_a2===void 0?void 0:_a2.call(styles,provided,props2))},multiValue:(provided,props2)=>{var _a2;return Object.assign(Object.assign(Object.assign({},provided),{color:"inherit",backgroundColor:_constants_theme_constant__WEBPACK_IMPORTED_MODULE_8__.a.isDarkMode?_constants_theme_constant__WEBPACK_IMPORTED_MODULE_8__.a.colors.grey:_constants_theme_constant__WEBPACK_IMPORTED_MODULE_8__.a.colors.grey10}),(_a2=styles?.multiValue)===null||_a2===void 0?void 0:_a2.call(styles,provided,props2))},multiValueLabel:(provided,props2)=>{var _a2;return Object.assign(Object.assign(Object.assign({},provided),{color:"var(--text-regular)"}),(_a2=styles?.multiValueLabel)===null||_a2===void 0?void 0:_a2.call(styles,provided,props2))},multiValueRemove:(provided,props2)=>{var _a2;return Object.assign(Object.assign(Object.assign({},provided),{color:_constants_theme_constant__WEBPACK_IMPORTED_MODULE_8__.a.isDarkMode?_constants_theme_constant__WEBPACK_IMPORTED_MODULE_8__.a.colors.text.regular:"var(--text-light)",":hover":{color:_constants_theme_constant__WEBPACK_IMPORTED_MODULE_8__.a.isDarkMode?_constants_theme_constant__WEBPACK_IMPORTED_MODULE_8__.a.colors.text.light:"var(--text-regular)"}}),(_a2=styles?.multiValueRemove)===null||_a2===void 0?void 0:_a2.call(styles,provided,props2))},dropdownIndicator:(provided,props2)=>{var _a2;return Object.assign(Object.assign(Object.assign({},provided),(_a2=styles?.dropdownIndicator)===null||_a2===void 0?void 0:_a2.call(styles,provided,props2)),{padding:2,width:15,height:15,alignItems:"center",color:_constants_theme_constant__WEBPACK_IMPORTED_MODULE_8__.a.colors.iconColor})},indicatorSeparator:(provided,props2)=>{var _a2;return Object.assign(Object.assign(Object.assign({},provided),(_a2=styles?.indicatorSeparator)===null||_a2===void 0?void 0:_a2.call(styles,provided,props2)),{margin:0,display:"none"})},placeholder:(provided,props2)=>{var _a2;return Object.assign(Object.assign(Object.assign({},provided),(_a2=styles?.placeholder)===null||_a2===void 0?void 0:_a2.call(styles,provided,props2)),{whiteSpace:"nowrap"})}}),options:sortedOptions});return Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(menuDimensionsContext.Provider,Object.assign({value:dimensions},{children:isCreatable?Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(react_select_creatable__WEBPACK_IMPORTED_MODULE_3__.a,Object.assign({},props)):Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(react_select__WEBPACK_IMPORTED_MODULE_2__.a,Object.assign({},props))}))}},2094:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",function(){return inputStyle});const inputStyle={borderRadius:4,borderWidth:1,borderColor:"var(--control-border-color)",borderStyle:"solid",padding:"6px 0px 6px 6px"}},4735:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,"MultiSelectEditor",function(){return MultiSelectEditor});var _emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_builder_io_react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(19),mobx_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(90),_VirtualizedSelect__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(2028),_functions_fast_clone_function__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(25),react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(3),react__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_5__),_material_ui_core__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(1088),_material_ui_core__WEBPACK_IMPORTED_MODULE_6___default=__webpack_require__.n(_material_ui_core__WEBPACK_IMPORTED_MODULE_6__),_material_ui_icons__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(1970),_material_ui_icons__WEBPACK_IMPORTED_MODULE_7___default=__webpack_require__.n(_material_ui_icons__WEBPACK_IMPORTED_MODULE_7__),_constants_theme_constant__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(7),_material_ui_icons_Close__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(573),_material_ui_icons_Close__WEBPACK_IMPORTED_MODULE_9___default=__webpack_require__.n(_material_ui_icons_Close__WEBPACK_IMPORTED_MODULE_9__);function MultiSelectEditor(props){return Object(mobx_react__WEBPACK_IMPORTED_MODULE_2__.g)(()=>{const fieldSettings=props.field.options;let options=Object(_functions_fast_clone_function__WEBPACK_IMPORTED_MODULE_4__.b)(fieldSettings.options||[]);const width=320;fieldSettings?.optionsFn&&(options=fieldSettings.optionsFn({path:props.path}));const flattenedOptions=options?.map(o=>o.options||o).flat()||[];return Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.b)(_VirtualizedSelect__WEBPACK_IMPORTED_MODULE_3__.a,{value:flattenedOptions.filter(option=>{var _a;return(_a=props.value)===null||_a===void 0?void 0:_a.includes(option.value)}),options,css:Object.assign({paddingBottom:8},props.field.styles),isMulti:!0,isClearable:!1,hideSelectedOptions:!1,closeMenuOnSelect:!1,menuDimensions:{optionHeight:46,rows:fieldSettings.rows||6,width},menuPortalTarget:document.body,components:{MultiValue:props2=>{const{removeProps,data}=props2,onDelete=react__WEBPACK_IMPORTED_MODULE_5___default.a.useCallback(event=>{event.preventDefault(),event.stopPropagation(),removeProps.onClick(event)},[]);return Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.b)(_material_ui_core__WEBPACK_IMPORTED_MODULE_6___default.a,{label:data.label,onDoubleClick:onDelete,onDelete,deleteIcon:Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.b)(_material_ui_icons_Close__WEBPACK_IMPORTED_MODULE_9___default.a,{css:{fontSize:14}}),css:{borderRadius:0,marginRight:4}})},DropdownIndicator:props2=>Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.b)(_material_ui_icons__WEBPACK_IMPORTED_MODULE_7___default.a,{css:{color:_constants_theme_constant__WEBPACK_IMPORTED_MODULE_8__.a.colors.iconColor}}),IndicatorSeparator:null},styles:{menuPortal:provided=>Object.assign(Object.assign({},provided),{zIndex:1300}),menu:provided=>Object.assign(Object.assign({},provided),{width}),control:provided=>Object.assign(Object.assign({},provided),{minWidth:width,backgroundColor:"transparent",boxShadow:"none",border:_constants_theme_constant__WEBPACK_IMPORTED_MODULE_8__.a.colors.inputBorder}),input:()=>({height:27,minWidth:"100px",maxWidth:"350px"}),placeholder:provided=>Object.assign({},provided)},onChange:value=>{props.onChange(value.map(item=>item.value))}})})}_builder_io_react__WEBPACK_IMPORTED_MODULE_1__.Builder.registerEditor({name:"internal:multiSelect",component:MultiSelectEditor,hidden:!0})},5836:function(module,exports,__webpack_require__){module.exports=__webpack_require__.p+"static/media/tags.793435a2.svg"},6331:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,"TagsEditor",function(){return TagsEditor});var _emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),lodash__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(6),lodash__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__),_builder_io_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(19),material_ui_chip_input__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(692),material_ui_chip_input__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(material_ui_chip_input__WEBPACK_IMPORTED_MODULE_3__),mobx_react__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(90),_assets_tags_svg__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(5836),_assets_tags_svg__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(_assets_tags_svg__WEBPACK_IMPORTED_MODULE_5__),_components_governance_MultiSelectEditor__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(4735);function TagsEditor(props){return Object(mobx_react__WEBPACK_IMPORTED_MODULE_4__.g)(()=>{var _a;if(Object(lodash__WEBPACK_IMPORTED_MODULE_1__.noop)(...props.value||[]),!((_a=props.field.enum)===null||_a===void 0)&&_a.length)return Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.b)(_components_governance_MultiSelectEditor__WEBPACK_IMPORTED_MODULE_6__.MultiSelectEditor,Object.assign({},props,{field:Object.assign(Object.assign({},props.field),{options:{rows:2,isMulti:!0,hideSelectedOptions:!1,options:props.field.enum.map(value2=>typeof value2=="string"?{value:value2,label:value2}:value2)}})}));const value=props.value||[],tagList=Array.isArray(value)?value:[value];return Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.b)(material_ui_chip_input__WEBPACK_IMPORTED_MODULE_3___default.a,{fullWidth:!0,placeholder:"Enter tags...",value:tagList,helperText:"Press Enter to add a tag",onChange:props.onChange,onDelete:chip=>props.onChange(tagList.filter(item=>item!==chip)),onAdd:chip=>props.onChange(tagList.concat([chip])),css:{marginBottom:12}})})}_builder_io_react__WEBPACK_IMPORTED_MODULE_2__.Builder.registerEditor({name:"Tags",description:"Allows users to add tags",icon:_assets_tags_svg__WEBPACK_IMPORTED_MODULE_5___default.a,component:TagsEditor})}}]);