@bigbinary/neeto-image-uploader-frontend 2.3.21 → 2.3.22

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.
@@ -10,8 +10,8 @@ import '@bigbinary/neetoui/Toastr';
10
10
  import '@bigbinary/neetoui/Typography';
11
11
  import 'ramda';
12
12
  import 'react-i18next';
13
- import './utils-Bb1hqKhN.js';
14
- export { M as default } from './index-DQC5j8GS.js';
13
+ import './utils-RGGHgnQc.js';
14
+ export { M as default } from './index-C7sAzF3s.js';
15
15
  import './useImageUploader-BfrsCPBL.js';
16
16
  import './index-B1JijZPf.js';
17
17
  import 'react/jsx-runtime';
@@ -4,7 +4,7 @@ import classnames from 'classnames';
4
4
  import { noop } from '@bigbinary/neeto-cist';
5
5
  import Delete from '@bigbinary/neeto-icons/Delete';
6
6
  import Button from '@bigbinary/neetoui/Button';
7
- import { b as isNilOrEmpty, i as isNotNilOrEmpty, I as IMAGE_WRAPPER_CLASSNAME, a as ImageDirectUpload } from './utils-Bb1hqKhN.js';
7
+ import { i as isNilOrEmpty, a as isNotNilOrEmpty, I as IMAGE_WRAPPER_CLASSNAME, b as ImageDirectUpload } from './utils-RGGHgnQc.js';
8
8
  import { I as ImageWithFallback } from './ImageWithFallback-Csv6Oivd.js';
9
9
  import { jsx, jsxs } from 'react/jsx-runtime';
10
10
  import '@bigbinary/neetoui/Typography';
@@ -0,0 +1,283 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+ import { useField, useFormikContext, getIn } from 'formik';
3
+ import { isEmpty, isNil } from 'ramda';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { hyphenate, noop } from '@bigbinary/neeto-cist';
6
+ import Input from '@bigbinary/neetoui/formik/Input';
7
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
8
+ import Button from '@bigbinary/neetoui/Button';
9
+ import Typography from '@bigbinary/neetoui/Typography';
10
+ import { t } from 'i18next';
11
+ import LeftAlign from '@bigbinary/neeto-icons/LeftAlign';
12
+ import CenterAlign from '@bigbinary/neeto-icons/CenterAlign';
13
+ import RightAlign from '@bigbinary/neeto-icons/RightAlign';
14
+ import { jsxs, jsx } from 'react/jsx-runtime';
15
+ import { createElement } from 'react';
16
+ import classnames from 'classnames';
17
+ import Spinner from '@bigbinary/neetoui/Spinner';
18
+ import ImageUploader from './ImageUploader.js';
19
+ import Slider from '@bigbinary/neetoui/Slider';
20
+ import '@babel/runtime/helpers/objectWithoutProperties';
21
+ import '@babel/runtime/helpers/asyncToGenerator';
22
+ import '@babel/runtime/regenerator';
23
+ import '@bigbinary/neeto-commons-frontend/initializers';
24
+ import '@bigbinary/neeto-icons/MenuHorizontal';
25
+ import '@bigbinary/neetoui/Dropdown';
26
+ import './utils-RGGHgnQc.js';
27
+ import '@bigbinary/neetoui/ProgressBar';
28
+ import 'react-dropzone';
29
+ import '@bigbinary/neetoui/Toastr';
30
+ import './index-B1JijZPf.js';
31
+ import './ImageWithFallback-Csv6Oivd.js';
32
+ import './index-C7sAzF3s.js';
33
+ import '@bigbinary/neetoui/Modal';
34
+ import '@bigbinary/neetoui/Tab';
35
+ import './useImageUploader-BfrsCPBL.js';
36
+ import '@tanstack/react-query';
37
+ import '@bigbinary/neeto-commons-frontend/react-utils';
38
+ import './query-DMtOS6FM.js';
39
+ import '@rails/activestorage';
40
+ import 'axios';
41
+ import '@bigbinary/neeto-icons/LeftArrow';
42
+ import '@bigbinary/neeto-commons-frontend/utils';
43
+ import '@bigbinary/neetoui/Input';
44
+ import '@bigbinary/neetoui/Switch';
45
+ import '@bigbinary/neetoui/Label';
46
+ import '@bigbinary/neeto-team-members-frontend/constants';
47
+ import '@bigbinary/neetoui/Alert';
48
+
49
+ var ALIGNMENTS = [{
50
+ label: t("neetoImageUploader.labels.leftAlign"),
51
+ value: "left",
52
+ icon: LeftAlign,
53
+ dataCy: "left-alignment"
54
+ }, {
55
+ label: t("neetoImageUploader.labels.centerAlign"),
56
+ value: "center",
57
+ icon: CenterAlign,
58
+ dataCy: "center-alignment"
59
+ }, {
60
+ label: t("neetoImageUploader.labels.rightAlign"),
61
+ value: "right",
62
+ icon: RightAlign,
63
+ dataCy: "right-alignment"
64
+ }];
65
+ var MINIMUM_LOGO_HEIGHT = 64;
66
+ var MAXIMUM_LOGO_HEIGHT = 100;
67
+ var DEFAULT_LOGO_HEIGHT = 64;
68
+ var DEFAULT_LOGO_POSITION = "left";
69
+ var ONE_MEGABYTE = 1;
70
+
71
+ var AlignmentBlock = function AlignmentBlock(_ref) {
72
+ var name = _ref.name,
73
+ title = _ref.title,
74
+ _ref$onChange = _ref.onChange,
75
+ onChange = _ref$onChange === void 0 ? noop : _ref$onChange;
76
+ var _useField = useField(name),
77
+ _useField2 = _slicedToArray(_useField, 3);
78
+ _useField2[0];
79
+ var _useField2$1$value = _useField2[1].value,
80
+ alignment = _useField2$1$value === void 0 ? DEFAULT_LOGO_POSITION : _useField2$1$value,
81
+ setValue = _useField2[2].setValue;
82
+ var handleChange = function handleChange(newAlignment) {
83
+ if (alignment === newAlignment) return;
84
+ setValue(newAlignment, false);
85
+ onChange(name, newAlignment);
86
+ };
87
+ return /*#__PURE__*/jsxs("div", {
88
+ dataCy: "".concat(hyphenate(title), "-block"),
89
+ children: [/*#__PURE__*/jsx(Typography, {
90
+ lineHeight: "normal",
91
+ style: "body2",
92
+ weight: "medium",
93
+ children: title
94
+ }), /*#__PURE__*/jsx("div", {
95
+ className: "mt-2 flex items-center gap-3",
96
+ children: ALIGNMENTS.map(function (_ref2) {
97
+ var label = _ref2.label,
98
+ value = _ref2.value,
99
+ icon = _ref2.icon,
100
+ dataCy = _ref2.dataCy;
101
+ return /*#__PURE__*/createElement(Button, {
102
+ icon: icon,
103
+ "data-cy": dataCy,
104
+ key: value,
105
+ size: "large",
106
+ style: alignment === value ? "primary" : "text",
107
+ tooltipProps: {
108
+ content: label,
109
+ position: "bottom"
110
+ },
111
+ onClick: function onClick() {
112
+ return handleChange(value);
113
+ }
114
+ });
115
+ })
116
+ })]
117
+ });
118
+ };
119
+
120
+ var Block = function Block(_ref) {
121
+ var title = _ref.title,
122
+ children = _ref.children,
123
+ dataCy = _ref.dataCy,
124
+ _ref$className = _ref.className,
125
+ className = _ref$className === void 0 ? "" : _ref$className,
126
+ _ref$childrenClassNam = _ref.childrenClassName,
127
+ childrenClassName = _ref$childrenClassNam === void 0 ? "" : _ref$childrenClassNam,
128
+ _ref$isLoading = _ref.isLoading,
129
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading;
130
+ return /*#__PURE__*/jsxs("div", {
131
+ className: classnames("space-y-4", className),
132
+ "data-cy": dataCy,
133
+ children: [/*#__PURE__*/jsxs("div", {
134
+ className: "flex items-center justify-between",
135
+ "data-cy": "properties-header",
136
+ children: [/*#__PURE__*/jsx(Typography, {
137
+ lineHeight: "normal",
138
+ style: "body1",
139
+ weight: "semibold",
140
+ children: title
141
+ }), isLoading && /*#__PURE__*/jsx(Spinner, {})]
142
+ }), /*#__PURE__*/jsx("div", {
143
+ className: classnames("space-y-4", childrenClassName),
144
+ children: children
145
+ })]
146
+ });
147
+ };
148
+
149
+ var ImageUpload = function ImageUpload(_ref) {
150
+ var name = _ref.name,
151
+ handleUpdate = _ref.handleUpdate,
152
+ _ref$maxSize = _ref.maxSize,
153
+ maxSize = _ref$maxSize === void 0 ? ONE_MEGABYTE : _ref$maxSize;
154
+ var _useTranslation = useTranslation(),
155
+ t = _useTranslation.t;
156
+ var _useField = useField(name),
157
+ _useField2 = _slicedToArray(_useField, 3);
158
+ _useField2[0];
159
+ var image = _useField2[1].value,
160
+ setValue = _useField2[2].setValue;
161
+ var handleImageChange = function handleImageChange(changedImage) {
162
+ if (isEmpty(changedImage === null || changedImage === void 0 ? void 0 : changedImage.url)) {
163
+ setValue(null, false);
164
+ handleUpdate(null);
165
+ return;
166
+ }
167
+ setValue(changedImage, false);
168
+ handleUpdate(changedImage);
169
+ };
170
+ return /*#__PURE__*/jsx(Block, {
171
+ dataCy: "add-image-card",
172
+ title: t("neetoImageUploader.labels.addImage"),
173
+ children: /*#__PURE__*/jsx(ImageUploader, {
174
+ className: "w-full",
175
+ src: image === null || image === void 0 ? void 0 : image.url,
176
+ uploadConfig: {
177
+ maxImageSize: maxSize
178
+ },
179
+ onUploadComplete: handleImageChange
180
+ }, image === null || image === void 0 ? void 0 : image.url)
181
+ });
182
+ };
183
+
184
+ var SliderBlock = function SliderBlock(_ref) {
185
+ var title = _ref.title,
186
+ name = _ref.name,
187
+ _ref$onChange = _ref.onChange,
188
+ onChange = _ref$onChange === void 0 ? noop : _ref$onChange,
189
+ defaultValue = _ref.defaultValue,
190
+ min = _ref.min,
191
+ max = _ref.max;
192
+ var _useField = useField(name),
193
+ _useField2 = _slicedToArray(_useField, 3);
194
+ _useField2[0];
195
+ var value = _useField2[1].value,
196
+ setValue = _useField2[2].setValue;
197
+ var handleChange = function handleChange(newValue) {
198
+ if (value === newValue) return;
199
+ setValue(newValue, false);
200
+ onChange(newValue);
201
+ };
202
+ return /*#__PURE__*/jsx("div", {
203
+ "data-cy": "".concat(hyphenate(title), "-slider-block"),
204
+ children: /*#__PURE__*/jsx(Slider, {
205
+ defaultValue: defaultValue,
206
+ max: max,
207
+ min: min,
208
+ value: value,
209
+ label: title,
210
+ onChange: handleChange
211
+ })
212
+ });
213
+ };
214
+
215
+ var root = document.querySelector(":root");
216
+ var setLogoHeight = function setLogoHeight(value, variableName) {
217
+ return root.style.setProperty(variableName, "".concat(Number(value) || DEFAULT_LOGO_HEIGHT, "px"));
218
+ };
219
+
220
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
221
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
222
+ var ImageForm = function ImageForm(_ref) {
223
+ var _ref$onChange = _ref.onChange,
224
+ onChange = _ref$onChange === void 0 ? noop : _ref$onChange,
225
+ _ref$imageUploaderPro = _ref.imageUploaderProps,
226
+ imageUploaderProps = _ref$imageUploaderPro === void 0 ? {} : _ref$imageUploaderPro,
227
+ _ref$className = _ref.className,
228
+ className = _ref$className === void 0 ? "" : _ref$className,
229
+ _ref$names = _ref.names,
230
+ names = _ref$names === void 0 ? {} : _ref$names,
231
+ _ref$logoHeight = _ref.logoHeight,
232
+ logoHeight = _ref$logoHeight === void 0 ? {
233
+ "default": DEFAULT_LOGO_HEIGHT,
234
+ min: MINIMUM_LOGO_HEIGHT,
235
+ max: MAXIMUM_LOGO_HEIGHT
236
+ } : _ref$logoHeight,
237
+ logoSizeVariableName = _ref.logoSizeVariableName;
238
+ var _useFormikContext = useFormikContext(),
239
+ values = _useFormikContext.values,
240
+ setFieldValue = _useFormikContext.setFieldValue;
241
+ var _useTranslation = useTranslation(),
242
+ t = _useTranslation.t;
243
+ var imageValue = getIn(values, names.image);
244
+ var handleImageChange = function handleImageChange(image) {
245
+ if (isNil(image)) {
246
+ setLogoHeight(logoHeight["default"], logoSizeVariableName);
247
+ setFieldValue(names.height, logoHeight["default"]);
248
+ }
249
+ onChange === null || onChange === void 0 || onChange(names.image, image);
250
+ };
251
+ var handleSliderChange = function handleSliderChange(value) {
252
+ setLogoHeight(value, logoSizeVariableName);
253
+ onChange === null || onChange === void 0 || onChange(names.height, value);
254
+ };
255
+ return /*#__PURE__*/jsxs("div", {
256
+ className: "space-y-4 ".concat(className),
257
+ children: [/*#__PURE__*/jsx(ImageUpload, _objectSpread({
258
+ handleUpdate: handleImageChange,
259
+ name: names.image
260
+ }, imageUploaderProps)), imageValue && /*#__PURE__*/jsxs("div", {
261
+ className: "space-y-4 px-2",
262
+ children: [/*#__PURE__*/jsx(SliderBlock, {
263
+ defaultValue: logoHeight["default"],
264
+ max: logoHeight.max,
265
+ min: logoHeight.min,
266
+ name: names.height,
267
+ title: t("neetoImageUploader.labels.logoSize"),
268
+ onChange: handleSliderChange
269
+ }), /*#__PURE__*/jsx(AlignmentBlock, {
270
+ name: names.alignment,
271
+ title: t("neetoImageUploader.labels.alignment"),
272
+ onChange: onChange
273
+ }), /*#__PURE__*/jsx(Input, {
274
+ name: "altText",
275
+ helpText: t("neetoImageUploader.tooltips.logoAltText"),
276
+ placeholder: t("neetoImageUploader.labels.logoAltText")
277
+ })]
278
+ })]
279
+ });
280
+ };
281
+
282
+ export { ImageForm as default };
283
+ //# sourceMappingURL=ImageForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageForm.js","sources":["../app/javascript/src/components/ImageForm/constants.js","../app/javascript/src/components/ImageForm/AlignmentBlock.jsx","../app/javascript/src/components/ImageForm/Block.jsx","../app/javascript/src/components/ImageForm/ImageUpload.jsx","../app/javascript/src/components/ImageForm/SliderBlock.jsx","../app/javascript/src/components/ImageForm/utils.js","../app/javascript/src/components/ImageForm/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport { LeftAlign, CenterAlign, RightAlign } from \"neetoicons\";\n\nexport const ALIGNMENTS = [\n {\n label: t(\"neetoImageUploader.labels.leftAlign\"),\n value: \"left\",\n icon: LeftAlign,\n dataCy: \"left-alignment\",\n },\n {\n label: t(\"neetoImageUploader.labels.centerAlign\"),\n value: \"center\",\n icon: CenterAlign,\n dataCy: \"center-alignment\",\n },\n {\n label: t(\"neetoImageUploader.labels.rightAlign\"),\n value: \"right\",\n icon: RightAlign,\n dataCy: \"right-alignment\",\n },\n];\n\nexport const MINIMUM_LOGO_HEIGHT = 64;\nexport const MAXIMUM_LOGO_HEIGHT = 100;\nexport const DEFAULT_LOGO_HEIGHT = 64;\nexport const DEFAULT_LOGO_POSITION = \"left\";\nexport const ONE_MEGABYTE = 1;\n","import { useField } from \"formik\";\nimport { hyphenate, noop } from \"neetocist\";\nimport { Button, Typography } from \"neetoui\";\n\nimport { ALIGNMENTS, DEFAULT_LOGO_POSITION } from \"./constants\";\n\nconst AlignmentBlock = ({ name, title, onChange = noop }) => {\n const [_, { value: alignment = DEFAULT_LOGO_POSITION }, { setValue }] =\n useField(name);\n\n const handleChange = newAlignment => {\n if (alignment === newAlignment) return;\n\n setValue(newAlignment, false);\n onChange(name, newAlignment);\n };\n\n return (\n <div dataCy={`${hyphenate(title)}-block`}>\n <Typography lineHeight=\"normal\" style=\"body2\" weight=\"medium\">\n {title}\n </Typography>\n <div className=\"mt-2 flex items-center gap-3\">\n {ALIGNMENTS.map(({ label, value, icon, dataCy }) => (\n <Button\n {...{ icon }}\n data-cy={dataCy}\n key={value}\n size=\"large\"\n style={alignment === value ? \"primary\" : \"text\"}\n tooltipProps={{ content: label, position: \"bottom\" }}\n onClick={() => handleChange(value)}\n />\n ))}\n </div>\n </div>\n );\n};\n\nexport default AlignmentBlock;\n","import classnames from \"classnames\";\nimport { Spinner, Typography } from \"neetoui\";\n\nconst Block = ({\n title,\n children,\n dataCy,\n className = \"\",\n childrenClassName = \"\",\n isLoading = false,\n}) => (\n <div className={classnames(\"space-y-4\", className)} data-cy={dataCy}>\n <div\n className=\"flex items-center justify-between\"\n data-cy=\"properties-header\"\n >\n <Typography lineHeight=\"normal\" style=\"body1\" weight=\"semibold\">\n {title}\n </Typography>\n {isLoading && <Spinner />}\n </div>\n <div className={classnames(\"space-y-4\", childrenClassName)}>{children}</div>\n </div>\n);\n\nexport default Block;\n","import { useField } from \"formik\";\nimport { isEmpty } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport Block from \"./Block\";\nimport { ONE_MEGABYTE } from \"./constants\";\n\nimport ImageUploader from \"../ImageUploader\";\n\nconst ImageUpload = ({ name, handleUpdate, maxSize = ONE_MEGABYTE }) => {\n const { t } = useTranslation();\n const [_, { value: image }, { setValue }] = useField(name);\n\n const handleImageChange = changedImage => {\n if (isEmpty(changedImage?.url)) {\n setValue(null, false);\n handleUpdate(null);\n\n return;\n }\n setValue(changedImage, false);\n handleUpdate(changedImage);\n };\n\n return (\n <Block\n dataCy=\"add-image-card\"\n title={t(\"neetoImageUploader.labels.addImage\")}\n >\n <ImageUploader\n className=\"w-full\"\n key={image?.url}\n src={image?.url}\n uploadConfig={{ maxImageSize: maxSize }}\n onUploadComplete={handleImageChange}\n />\n </Block>\n );\n};\n\nexport default ImageUpload;\n","import { useField } from \"formik\";\nimport { hyphenate, noop } from \"neetocist\";\nimport { Slider } from \"neetoui\";\n\nconst SliderBlock = ({\n title,\n name,\n onChange = noop,\n defaultValue,\n min,\n max,\n}) => {\n const [_, { value }, { setValue }] = useField(name);\n\n const handleChange = newValue => {\n if (value === newValue) return;\n\n setValue(newValue, false);\n onChange(newValue);\n };\n\n return (\n <div data-cy={`${hyphenate(title)}-slider-block`}>\n <Slider\n {...{ defaultValue, max, min, value }}\n label={title}\n onChange={handleChange}\n />\n </div>\n );\n};\n\nexport default SliderBlock;\n","import { DEFAULT_LOGO_HEIGHT } from \"./constants\";\n\nconst root = document.querySelector(\":root\");\n\nexport const setLogoHeight = (value, variableName) =>\n root.style.setProperty(\n variableName,\n `${Number(value) || DEFAULT_LOGO_HEIGHT}px`\n );\n","import { useFormikContext, getIn } from \"formik\";\nimport { isNil } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\nimport { noop } from \"neetocist\";\nimport { Input } from \"neetoui/formik\";\n\nimport AlignmentBlock from \"./AlignmentBlock\";\nimport {\n DEFAULT_LOGO_HEIGHT,\n MAXIMUM_LOGO_HEIGHT,\n MINIMUM_LOGO_HEIGHT,\n} from \"./constants\";\nimport ImageUpload from \"./ImageUpload\";\nimport SliderBlock from \"./SliderBlock\";\nimport { setLogoHeight } from \"./utils\";\n\nconst ImageForm = ({\n onChange = noop,\n imageUploaderProps = {},\n className = \"\",\n names = {},\n logoHeight = {\n default: DEFAULT_LOGO_HEIGHT,\n min: MINIMUM_LOGO_HEIGHT,\n max: MAXIMUM_LOGO_HEIGHT,\n },\n logoSizeVariableName,\n}) => {\n const { values, setFieldValue } = useFormikContext();\n\n const { t } = useTranslation();\n\n const imageValue = getIn(values, names.image);\n\n const handleImageChange = image => {\n if (isNil(image)) {\n setLogoHeight(logoHeight.default, logoSizeVariableName);\n setFieldValue(names.height, logoHeight.default);\n }\n\n onChange?.(names.image, image);\n };\n\n const handleSliderChange = value => {\n setLogoHeight(value, logoSizeVariableName);\n onChange?.(names.height, value);\n };\n\n return (\n <div className={`space-y-4 ${className}`}>\n <ImageUpload\n handleUpdate={handleImageChange}\n name={names.image}\n {...imageUploaderProps}\n />\n {imageValue && (\n <div className=\"space-y-4 px-2\">\n <SliderBlock\n defaultValue={logoHeight.default}\n max={logoHeight.max}\n min={logoHeight.min}\n name={names.height}\n title={t(\"neetoImageUploader.labels.logoSize\")}\n onChange={handleSliderChange}\n />\n <AlignmentBlock\n name={names.alignment}\n title={t(\"neetoImageUploader.labels.alignment\")}\n {...{ onChange }}\n />\n <Input\n name=\"altText\"\n helpText={t(\"neetoImageUploader.tooltips.logoAltText\")}\n placeholder={t(\"neetoImageUploader.labels.logoAltText\")}\n />\n </div>\n )}\n </div>\n );\n};\n\nexport default ImageForm;\n"],"names":["ALIGNMENTS","label","t","value","icon","LeftAlign","dataCy","CenterAlign","RightAlign","MINIMUM_LOGO_HEIGHT","MAXIMUM_LOGO_HEIGHT","DEFAULT_LOGO_HEIGHT","DEFAULT_LOGO_POSITION","ONE_MEGABYTE","AlignmentBlock","_ref","name","title","_ref$onChange","onChange","noop","_useField","useField","_useField2","_slicedToArray","_","_useField2$1$value","alignment","setValue","handleChange","newAlignment","_jsxs","concat","hyphenate","children","_jsx","Typography","lineHeight","style","weight","className","map","_ref2","_createElement","Button","key","size","tooltipProps","content","position","onClick","Block","_ref$className","_ref$childrenClassNam","childrenClassName","_ref$isLoading","isLoading","classnames","Spinner","ImageUpload","handleUpdate","_ref$maxSize","maxSize","_useTranslation","useTranslation","image","handleImageChange","changedImage","isEmpty","url","ImageUploader","src","uploadConfig","maxImageSize","onUploadComplete","SliderBlock","defaultValue","min","max","newValue","Slider","root","document","querySelector","setLogoHeight","variableName","setProperty","Number","ImageForm","_ref$imageUploaderPro","imageUploaderProps","_ref$names","names","_ref$logoHeight","logoHeight","logoSizeVariableName","_useFormikContext","useFormikContext","values","setFieldValue","imageValue","getIn","isNil","height","handleSliderChange","_objectSpread","Input","helpText","placeholder"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,UAAU,GAAG,CACxB;AACEC,EAAAA,KAAK,EAAEC,CAAC,CAAC,qCAAqC,CAAC;AAC/CC,EAAAA,KAAK,EAAE,MAAM;AACbC,EAAAA,IAAI,EAAEC,SAAS;AACfC,EAAAA,MAAM,EAAE;AACV,CAAC,EACD;AACEL,EAAAA,KAAK,EAAEC,CAAC,CAAC,uCAAuC,CAAC;AACjDC,EAAAA,KAAK,EAAE,QAAQ;AACfC,EAAAA,IAAI,EAAEG,WAAW;AACjBD,EAAAA,MAAM,EAAE;AACV,CAAC,EACD;AACEL,EAAAA,KAAK,EAAEC,CAAC,CAAC,sCAAsC,CAAC;AAChDC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,IAAI,EAAEI,UAAU;AAChBF,EAAAA,MAAM,EAAE;AACV,CAAC,CACF;AAEM,IAAMG,mBAAmB,GAAG,EAAE;AAC9B,IAAMC,mBAAmB,GAAG,GAAG;AAC/B,IAAMC,mBAAmB,GAAG,EAAE;AAC9B,IAAMC,qBAAqB,GAAG,MAAM;AACpC,IAAMC,YAAY,GAAG,CAAC;;ACtB7B,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAAyC;AAAA,EAAA,IAAnCC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IAAEC,KAAK,GAAA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I;QACpB7D,IAAI,EAAE4E,KAAK,CAACW,MAAO;AACnBtF,QAAAA,KAAK,EAAEf,CAAC,CAAC,oCAAoC,CAAE;AAC/CiB,QAAAA,QAAQ,EAAEqF;AAAmB,OAC9B,CAAC,eACFrE,GAAA,CAACrB,cAAc,EAAA;QACbE,IAAI,EAAE4E,KAAK,CAACjE,SAAU;AACtBV,QAAAA,KAAK,EAAEf,CAAC,CAAC,qCAAqC,CAAE;AAC1CiB,QAAAA,QAAQ,EAARA;AAAQ,OACf,CAAC,eACFgB,GAAA,CAACuE,KAAK,EAAA;AACJ1F,QAAAA,IAAI,EAAC,SAAS;AACd2F,QAAAA,QAAQ,EAAEzG,CAAC,CAAC,yCAAyC,CAAE;QACvD0G,WAAW,EAAE1G,CAAC,CAAC,uCAAuC;AAAE,OACzD,CAAC;AAAA,KACC,CACN;AAAA,GACE,CAAC;AAEV;;;;"}
@@ -11,9 +11,9 @@ import MenuHorizontal from '@bigbinary/neeto-icons/MenuHorizontal';
11
11
  import Dropdown from '@bigbinary/neetoui/Dropdown';
12
12
  import { mergeRight } from 'ramda';
13
13
  import { useTranslation } from 'react-i18next';
14
- import { D as DEFAULT_UPLOAD_CONFIG, O as OPTION_KEYS, i as isNotNilOrEmpty, I as IMAGE_WRAPPER_CLASSNAME, a as ImageDirectUpload } from './utils-Bb1hqKhN.js';
14
+ import { D as DEFAULT_UPLOAD_CONFIG, O as OPTION_KEYS, a as isNotNilOrEmpty, I as IMAGE_WRAPPER_CLASSNAME, b as ImageDirectUpload } from './utils-RGGHgnQc.js';
15
15
  import { I as ImageWithFallback } from './ImageWithFallback-Csv6Oivd.js';
16
- import { M as Modal, c as constructCloudflareImageURL } from './index-DQC5j8GS.js';
16
+ import { M as Modal, c as constructCloudflareImageURL } from './index-C7sAzF3s.js';
17
17
  import { a as useCreateBlob, u as useImageUploader, g as generateASCIIFileName } from './useImageUploader-BfrsCPBL.js';
18
18
  import { C as CLOUD_FLARE, I as IS_DEVELOPMENT_OR_HEROKU_ENV } from './index-B1JijZPf.js';
19
19
  import { jsxs, jsx } from 'react/jsx-runtime';
@@ -0,0 +1,285 @@
1
+ 'use strict';
2
+
3
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var formik = require('formik');
5
+ var ramda = require('ramda');
6
+ var reactI18next = require('react-i18next');
7
+ var neetoCist = require('@bigbinary/neeto-cist');
8
+ var Input = require('@bigbinary/neetoui/formik/Input');
9
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
10
+ var Button = require('@bigbinary/neetoui/Button');
11
+ var Typography = require('@bigbinary/neetoui/Typography');
12
+ var i18next = require('i18next');
13
+ var LeftAlign = require('@bigbinary/neeto-icons/LeftAlign');
14
+ var CenterAlign = require('@bigbinary/neeto-icons/CenterAlign');
15
+ var RightAlign = require('@bigbinary/neeto-icons/RightAlign');
16
+ var jsxRuntime = require('react/jsx-runtime');
17
+ var g = require('react');
18
+ var classnames = require('classnames');
19
+ var Spinner = require('@bigbinary/neetoui/Spinner');
20
+ var ImageUploader = require('./ImageUploader.js');
21
+ var Slider = require('@bigbinary/neetoui/Slider');
22
+ require('@babel/runtime/helpers/objectWithoutProperties');
23
+ require('@babel/runtime/helpers/asyncToGenerator');
24
+ require('@babel/runtime/regenerator');
25
+ require('@bigbinary/neeto-commons-frontend/initializers');
26
+ require('@bigbinary/neeto-icons/MenuHorizontal');
27
+ require('@bigbinary/neetoui/Dropdown');
28
+ require('../utils-BoO2mwcq.js');
29
+ require('@bigbinary/neetoui/ProgressBar');
30
+ require('react-dropzone');
31
+ require('@bigbinary/neetoui/Toastr');
32
+ require('../index-CmR3zLng.js');
33
+ require('../ImageWithFallback-DzT_N2Su.js');
34
+ require('../index-DspO4oaA.js');
35
+ require('@bigbinary/neetoui/Modal');
36
+ require('@bigbinary/neetoui/Tab');
37
+ require('../useImageUploader-YWyed_UV.js');
38
+ require('@tanstack/react-query');
39
+ require('@bigbinary/neeto-commons-frontend/react-utils');
40
+ require('../query-BslM05TL.js');
41
+ require('@rails/activestorage');
42
+ require('axios');
43
+ require('@bigbinary/neeto-icons/LeftArrow');
44
+ require('@bigbinary/neeto-commons-frontend/utils');
45
+ require('@bigbinary/neetoui/Input');
46
+ require('@bigbinary/neetoui/Switch');
47
+ require('@bigbinary/neetoui/Label');
48
+ require('@bigbinary/neeto-team-members-frontend/constants');
49
+ require('@bigbinary/neetoui/Alert');
50
+
51
+ var ALIGNMENTS = [{
52
+ label: i18next.t("neetoImageUploader.labels.leftAlign"),
53
+ value: "left",
54
+ icon: LeftAlign,
55
+ dataCy: "left-alignment"
56
+ }, {
57
+ label: i18next.t("neetoImageUploader.labels.centerAlign"),
58
+ value: "center",
59
+ icon: CenterAlign,
60
+ dataCy: "center-alignment"
61
+ }, {
62
+ label: i18next.t("neetoImageUploader.labels.rightAlign"),
63
+ value: "right",
64
+ icon: RightAlign,
65
+ dataCy: "right-alignment"
66
+ }];
67
+ var MINIMUM_LOGO_HEIGHT = 64;
68
+ var MAXIMUM_LOGO_HEIGHT = 100;
69
+ var DEFAULT_LOGO_HEIGHT = 64;
70
+ var DEFAULT_LOGO_POSITION = "left";
71
+ var ONE_MEGABYTE = 1;
72
+
73
+ var AlignmentBlock = function AlignmentBlock(_ref) {
74
+ var name = _ref.name,
75
+ title = _ref.title,
76
+ _ref$onChange = _ref.onChange,
77
+ onChange = _ref$onChange === void 0 ? neetoCist.noop : _ref$onChange;
78
+ var _useField = formik.useField(name),
79
+ _useField2 = _slicedToArray(_useField, 3);
80
+ _useField2[0];
81
+ var _useField2$1$value = _useField2[1].value,
82
+ alignment = _useField2$1$value === void 0 ? DEFAULT_LOGO_POSITION : _useField2$1$value,
83
+ setValue = _useField2[2].setValue;
84
+ var handleChange = function handleChange(newAlignment) {
85
+ if (alignment === newAlignment) return;
86
+ setValue(newAlignment, false);
87
+ onChange(name, newAlignment);
88
+ };
89
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
90
+ dataCy: "".concat(neetoCist.hyphenate(title), "-block"),
91
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
92
+ lineHeight: "normal",
93
+ style: "body2",
94
+ weight: "medium",
95
+ children: title
96
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
97
+ className: "mt-2 flex items-center gap-3",
98
+ children: ALIGNMENTS.map(function (_ref2) {
99
+ var label = _ref2.label,
100
+ value = _ref2.value,
101
+ icon = _ref2.icon,
102
+ dataCy = _ref2.dataCy;
103
+ return /*#__PURE__*/g.createElement(Button, {
104
+ icon: icon,
105
+ "data-cy": dataCy,
106
+ key: value,
107
+ size: "large",
108
+ style: alignment === value ? "primary" : "text",
109
+ tooltipProps: {
110
+ content: label,
111
+ position: "bottom"
112
+ },
113
+ onClick: function onClick() {
114
+ return handleChange(value);
115
+ }
116
+ });
117
+ })
118
+ })]
119
+ });
120
+ };
121
+
122
+ var Block = function Block(_ref) {
123
+ var title = _ref.title,
124
+ children = _ref.children,
125
+ dataCy = _ref.dataCy,
126
+ _ref$className = _ref.className,
127
+ className = _ref$className === void 0 ? "" : _ref$className,
128
+ _ref$childrenClassNam = _ref.childrenClassName,
129
+ childrenClassName = _ref$childrenClassNam === void 0 ? "" : _ref$childrenClassNam,
130
+ _ref$isLoading = _ref.isLoading,
131
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading;
132
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
133
+ className: classnames("space-y-4", className),
134
+ "data-cy": dataCy,
135
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
136
+ className: "flex items-center justify-between",
137
+ "data-cy": "properties-header",
138
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
139
+ lineHeight: "normal",
140
+ style: "body1",
141
+ weight: "semibold",
142
+ children: title
143
+ }), isLoading && /*#__PURE__*/jsxRuntime.jsx(Spinner, {})]
144
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
145
+ className: classnames("space-y-4", childrenClassName),
146
+ children: children
147
+ })]
148
+ });
149
+ };
150
+
151
+ var ImageUpload = function ImageUpload(_ref) {
152
+ var name = _ref.name,
153
+ handleUpdate = _ref.handleUpdate,
154
+ _ref$maxSize = _ref.maxSize,
155
+ maxSize = _ref$maxSize === void 0 ? ONE_MEGABYTE : _ref$maxSize;
156
+ var _useTranslation = reactI18next.useTranslation(),
157
+ t = _useTranslation.t;
158
+ var _useField = formik.useField(name),
159
+ _useField2 = _slicedToArray(_useField, 3);
160
+ _useField2[0];
161
+ var image = _useField2[1].value,
162
+ setValue = _useField2[2].setValue;
163
+ var handleImageChange = function handleImageChange(changedImage) {
164
+ if (ramda.isEmpty(changedImage === null || changedImage === void 0 ? void 0 : changedImage.url)) {
165
+ setValue(null, false);
166
+ handleUpdate(null);
167
+ return;
168
+ }
169
+ setValue(changedImage, false);
170
+ handleUpdate(changedImage);
171
+ };
172
+ return /*#__PURE__*/jsxRuntime.jsx(Block, {
173
+ dataCy: "add-image-card",
174
+ title: t("neetoImageUploader.labels.addImage"),
175
+ children: /*#__PURE__*/jsxRuntime.jsx(ImageUploader, {
176
+ className: "w-full",
177
+ src: image === null || image === void 0 ? void 0 : image.url,
178
+ uploadConfig: {
179
+ maxImageSize: maxSize
180
+ },
181
+ onUploadComplete: handleImageChange
182
+ }, image === null || image === void 0 ? void 0 : image.url)
183
+ });
184
+ };
185
+
186
+ var SliderBlock = function SliderBlock(_ref) {
187
+ var title = _ref.title,
188
+ name = _ref.name,
189
+ _ref$onChange = _ref.onChange,
190
+ onChange = _ref$onChange === void 0 ? neetoCist.noop : _ref$onChange,
191
+ defaultValue = _ref.defaultValue,
192
+ min = _ref.min,
193
+ max = _ref.max;
194
+ var _useField = formik.useField(name),
195
+ _useField2 = _slicedToArray(_useField, 3);
196
+ _useField2[0];
197
+ var value = _useField2[1].value,
198
+ setValue = _useField2[2].setValue;
199
+ var handleChange = function handleChange(newValue) {
200
+ if (value === newValue) return;
201
+ setValue(newValue, false);
202
+ onChange(newValue);
203
+ };
204
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
205
+ "data-cy": "".concat(neetoCist.hyphenate(title), "-slider-block"),
206
+ children: /*#__PURE__*/jsxRuntime.jsx(Slider, {
207
+ defaultValue: defaultValue,
208
+ max: max,
209
+ min: min,
210
+ value: value,
211
+ label: title,
212
+ onChange: handleChange
213
+ })
214
+ });
215
+ };
216
+
217
+ var root = document.querySelector(":root");
218
+ var setLogoHeight = function setLogoHeight(value, variableName) {
219
+ return root.style.setProperty(variableName, "".concat(Number(value) || DEFAULT_LOGO_HEIGHT, "px"));
220
+ };
221
+
222
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
223
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
224
+ var ImageForm = function ImageForm(_ref) {
225
+ var _ref$onChange = _ref.onChange,
226
+ onChange = _ref$onChange === void 0 ? neetoCist.noop : _ref$onChange,
227
+ _ref$imageUploaderPro = _ref.imageUploaderProps,
228
+ imageUploaderProps = _ref$imageUploaderPro === void 0 ? {} : _ref$imageUploaderPro,
229
+ _ref$className = _ref.className,
230
+ className = _ref$className === void 0 ? "" : _ref$className,
231
+ _ref$names = _ref.names,
232
+ names = _ref$names === void 0 ? {} : _ref$names,
233
+ _ref$logoHeight = _ref.logoHeight,
234
+ logoHeight = _ref$logoHeight === void 0 ? {
235
+ "default": DEFAULT_LOGO_HEIGHT,
236
+ min: MINIMUM_LOGO_HEIGHT,
237
+ max: MAXIMUM_LOGO_HEIGHT
238
+ } : _ref$logoHeight,
239
+ logoSizeVariableName = _ref.logoSizeVariableName;
240
+ var _useFormikContext = formik.useFormikContext(),
241
+ values = _useFormikContext.values,
242
+ setFieldValue = _useFormikContext.setFieldValue;
243
+ var _useTranslation = reactI18next.useTranslation(),
244
+ t = _useTranslation.t;
245
+ var imageValue = formik.getIn(values, names.image);
246
+ var handleImageChange = function handleImageChange(image) {
247
+ if (ramda.isNil(image)) {
248
+ setLogoHeight(logoHeight["default"], logoSizeVariableName);
249
+ setFieldValue(names.height, logoHeight["default"]);
250
+ }
251
+ onChange === null || onChange === void 0 || onChange(names.image, image);
252
+ };
253
+ var handleSliderChange = function handleSliderChange(value) {
254
+ setLogoHeight(value, logoSizeVariableName);
255
+ onChange === null || onChange === void 0 || onChange(names.height, value);
256
+ };
257
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
258
+ className: "space-y-4 ".concat(className),
259
+ children: [/*#__PURE__*/jsxRuntime.jsx(ImageUpload, _objectSpread({
260
+ handleUpdate: handleImageChange,
261
+ name: names.image
262
+ }, imageUploaderProps)), imageValue && /*#__PURE__*/jsxRuntime.jsxs("div", {
263
+ className: "space-y-4 px-2",
264
+ children: [/*#__PURE__*/jsxRuntime.jsx(SliderBlock, {
265
+ defaultValue: logoHeight["default"],
266
+ max: logoHeight.max,
267
+ min: logoHeight.min,
268
+ name: names.height,
269
+ title: t("neetoImageUploader.labels.logoSize"),
270
+ onChange: handleSliderChange
271
+ }), /*#__PURE__*/jsxRuntime.jsx(AlignmentBlock, {
272
+ name: names.alignment,
273
+ title: t("neetoImageUploader.labels.alignment"),
274
+ onChange: onChange
275
+ }), /*#__PURE__*/jsxRuntime.jsx(Input, {
276
+ name: "altText",
277
+ helpText: t("neetoImageUploader.tooltips.logoAltText"),
278
+ placeholder: t("neetoImageUploader.labels.logoAltText")
279
+ })]
280
+ })]
281
+ });
282
+ };
283
+
284
+ module.exports = ImageForm;
285
+ //# sourceMappingURL=ImageForm.js.map