{"version":3,"file":"commonStyles-Dh0qK8jg.js","sources":["../../../app/javascript/components/builder/components/mixins/commonStyles.js"],"sourcesContent":["import { addAlpha } from \"@/helpers/utils.js\";\n\nconst commonStyles = {\n props: {\n styling: {\n type: Object,\n },\n editing: {\n type: Boolean,\n default: false,\n },\n active: {\n type: Boolean,\n default: false,\n },\n item: {\n type: Object,\n required: true,\n },\n isChildComponent: {\n type: Boolean,\n default: false,\n },\n },\n computed: {\n // Item Level Styles\n itemStyling() {\n return this.item.styling || {};\n },\n // Input Styles\n inputStyles() {\n return {\n \"background-color\": this.isDisabled\n ? addAlpha(this.styling.placeholderColor, 0.9)\n : this.styling.placeholderColor,\n cursor: this.isDisabled ? \"not-allowed\" : \"auto\",\n opacity: this.isDisabled ? 0.6 : 1,\n };\n },\n // Layout Classes\n layoutClasses() {\n return {\n \"left-right\": this.styling.alignment === \"Left-Right\",\n };\n },\n // Root Classes\n rootClasses() {\n return {\n active: this.active,\n \"drag-wrapper\": this.editing,\n \"non-editing\": !this.editing,\n };\n },\n // Root Styles\n rootStyles() {\n if (this.isChildComponent) return {};\n\n return {\n \"margin-top\": this.styling.marginTop\n ? `${this.styling.marginTop}px`\n : \"\",\n \"margin-bottom\": this.styling.marginBottom\n ? `${this.styling.marginBottom}px`\n : \"\",\n };\n },\n // Label Styles\n labelStyles() {\n return {\n // default styles\n display: \"block\",\n\n // custom styles\n \"margin-bottom\": this.styling.labelBottomMargin\n ? `${this.styling.labelBottomMargin}px`\n : \"8px\",\n color: this.styling.fontColor || \"#575757\",\n \"font-family\": this.styling.fontFamily || \"sans-serif\",\n \"font-size\": this.item.componentFromRepeatField\n ? `${this.styling.optionFontSize}px`\n : `${this.styling.fontSize}px` || \"16px\",\n \"font-weight\": this.item.componentFromRepeatField\n ? this.styling.optionFontWeight\n : this.styling.labelFontWeight || 700,\n \"font-style\": this.styling.italicFont ? \"italic\" : \"normal\",\n \"line-height\": \"150%\",\n margin: !this.item.label && \"0px\",\n \"word-wrap\": \"break-word\",\n };\n },\n // Description Styles\n descriptionStyles() {\n return {\n color: this.styling.descriptionFontColor || \"#3D3D3DB3\",\n \"font-family\": this.styling.fontFamily || \"sans-serif\",\n \"font-size\": `${this.styling.descriptionFontSize}px` || \"14px\",\n \"font-style\": this.styling.italicFont ? \"italic\" : \"normal\",\n \"font-weight\": this.styling.descriptionFontWeight || 400,\n \"line-height\": \"150%\",\n \"margin-bottom\": this.styling.descriptionBottomMargin\n ? `${this.styling.descriptionBottomMargin}px`\n : \"8px\",\n margin: !this.item.description && !this.editing && \"0px\",\n \"word-wrap\": \"break-word\",\n };\n },\n // SubLabel Styles\n subLabelStyles() {\n return {\n // default styles\n display: \"block\",\n \"margin-bottom\": \"8px\",\n\n // custom styles\n color: this.styling.fontColor || \"#575757\",\n \"font-family\": this.styling.fontFamily || \"sans-serif\",\n \"font-size\": `${this.styling.sublabelFontSize}px` || \"12px\",\n \"font-weight\": this.styling.sublabelFontWeight || 400,\n \"line-height\": \"150%\",\n };\n },\n // Option Styles\n optionStyles() {\n return {\n color: this.styling.optionFontColor,\n \"font-style\": this.styling.italicFont ? \"italic\" : \"normal\",\n \"font-family\": this.styling.fontFamily || \"sans-serif\",\n \"font-size\": `${this.styling.optionFontSize}px` || \"12px\",\n \"font-weight\": this.styling.optionFontWeight || 400,\n \"line-height\": \"150%\",\n };\n },\n // Label Classes\n labelClasses() {\n return {\n \"formester-label\": true,\n \"field-required formester-required\":\n this.item.required && this.styling.isRequiredMarkerVisible, // TODO: rename the class to something better\n };\n },\n labelDescriptionWrapperStyles() {\n return {\n paddingBottom:\n this.item.description || (this.editing && this.active)\n ? \"8px\"\n : \"12px\",\n };\n },\n },\n methods: {\n // SubLabel Classes\n subLabelClasses(required) {\n return {\n \"formester-label\": true,\n \"field-required formester-required\":\n required && this.styling.isRequiredMarkerVisible, // TODO: rename the class to something better\n };\n },\n },\n};\n\nexport default commonStyles;\n"],"names":["commonStyles","addAlpha","required"],"mappings":"sZAEK,MAACA,EAAe,CACnB,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