@pushwoosh/smart-components-kit 1.1.1 → 1.1.2

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.
@@ -1,12 +1,12 @@
1
1
  import { type FC } from 'react';
2
2
  import type { MediaFile } from '@pushwoosh/rpc-v2-http-api-data/media_files';
3
- type CreateVariantDrawerProps = {
3
+ type CreateCropDrawerProps = {
4
4
  application: string;
5
5
  original: MediaFile | null;
6
6
  isOpen: boolean;
7
- existingVariants: MediaFile[];
7
+ existingCrops: MediaFile[];
8
8
  onClose: () => void;
9
- onCreated: (parentUuid: string, variant: MediaFile) => void;
9
+ onCreated: (parentUuid: string, crop: MediaFile) => void;
10
10
  };
11
- export declare const CreateVariantDrawer: FC<CreateVariantDrawerProps>;
11
+ export declare const CreateCropDrawer: FC<CreateCropDrawerProps>;
12
12
  export {};
@@ -7,7 +7,7 @@ import { Text } from '@pushwoosh/kit-typography';
7
7
  import { useSPAContext } from '@pushwoosh/spa-context';
8
8
  import { getRatioLabel, getThumbUrl } from './mediaFile.utils';
9
9
  import { useLang } from './polyglot';
10
- import { Chip, Chips, FieldLabel, PreviewFrame, PreviewImage, PreviewStage, Segment, SegmentItem, TileImage, VariantStrip, VariantThumb, VariantThumbCaption } from './styled';
10
+ import { Chip, Chips, CropStrip, CropThumb, CropThumbCaption, FieldLabel, PreviewFrame, PreviewImage, PreviewStage, Segment, SegmentItem, TileImage } from './styled';
11
11
  const RATIOS = [{
12
12
  value: 'ASPECT_RATIO_1_1',
13
13
  label: '1:1',
@@ -48,11 +48,11 @@ const RATIOS = [{
48
48
  const DEFAULT_RATIO = 'ASPECT_RATIO_16_9';
49
49
  const DEFAULT_SIZE = '1080';
50
50
  const DEFAULT_QUALITY = '90';
51
- export const CreateVariantDrawer = ({
51
+ export const CreateCropDrawer = ({
52
52
  application,
53
53
  original,
54
54
  isOpen,
55
- existingVariants,
55
+ existingCrops,
56
56
  onClose,
57
57
  onCreated
58
58
  }) => {
@@ -87,14 +87,14 @@ export const CreateVariantDrawer = ({
87
87
  const selectedRatio = RATIOS.find(item => item.value === ratio) ?? RATIOS[0];
88
88
  const outputWidth = dimension === 'width' ? sizeValue : Math.round(sizeValue * selectedRatio.ar);
89
89
  const outputHeight = dimension === 'height' ? sizeValue : Math.round(sizeValue / selectedRatio.ar);
90
- const ratioExists = existingVariants.some(variant => {
91
- var _variant$meta;
92
- return ((_variant$meta = variant.meta) === null || _variant$meta === void 0 ? void 0 : _variant$meta.type) === 'imageMeta' && variant.meta.data.ratio === selectedRatio.label;
90
+ const ratioExists = existingCrops.some(crop => {
91
+ var _crop$meta;
92
+ return ((_crop$meta = crop.meta) === null || _crop$meta === void 0 ? void 0 : _crop$meta.type) === 'imageMeta' && crop.meta.data.ratio === selectedRatio.label;
93
93
  });
94
94
  const handleCreate = async () => {
95
95
  if (!original || !isSizeValid || !isQualityValid || ratioExists) return;
96
96
  // Capture the parent up front so a concurrent reopen for another image
97
- // can't misroute the created variant.
97
+ // can't misroute the created crop.
98
98
  const parent = original;
99
99
  setIsCreating(true);
100
100
  try {
@@ -112,7 +112,7 @@ export const CreateVariantDrawer = ({
112
112
  });
113
113
  openToast({
114
114
  title: lang({
115
- message: 'SMART.MEDIA_STORE.CREATE_VARIANT.SUCCESS'
115
+ message: 'SMART.MEDIA_STORE.CREATE_CROP.SUCCESS'
116
116
  }),
117
117
  type: 'success'
118
118
  });
@@ -120,7 +120,7 @@ export const CreateVariantDrawer = ({
120
120
  } catch (error) {
121
121
  openToast({
122
122
  title: error.message || lang({
123
- message: 'SMART.MEDIA_STORE.CREATE_VARIANT.ERROR'
123
+ message: 'SMART.MEDIA_STORE.CREATE_CROP.ERROR'
124
124
  }),
125
125
  type: 'error'
126
126
  });
@@ -136,7 +136,7 @@ export const CreateVariantDrawer = ({
136
136
  children: _jsxs(DrawerTitle, {
137
137
  children: [_jsx("span", {
138
138
  children: lang({
139
- message: 'SMART.MEDIA_STORE.CREATE_VARIANT.TITLE'
139
+ message: 'SMART.MEDIA_STORE.CREATE_CROP.TITLE'
140
140
  })
141
141
  }), _jsx(Button, {
142
142
  view: "ghost",
@@ -146,7 +146,7 @@ export const CreateVariantDrawer = ({
146
146
  size: "small"
147
147
  }),
148
148
  "aria-label": lang({
149
- message: 'SMART.MEDIA_STORE.CREATE_VARIANT.CLOSE'
149
+ message: 'SMART.MEDIA_STORE.CREATE_CROP.CLOSE'
150
150
  }),
151
151
  onClick: onClose
152
152
  })]
@@ -157,7 +157,7 @@ export const CreateVariantDrawer = ({
157
157
  children: [_jsxs("div", {
158
158
  children: [_jsx(FieldLabel, {
159
159
  children: lang({
160
- message: 'SMART.MEDIA_STORE.CREATE_VARIANT.RATIO_LABEL'
160
+ message: 'SMART.MEDIA_STORE.CREATE_CROP.RATIO_LABEL'
161
161
  })
162
162
  }), _jsx(Chips, {
163
163
  children: RATIOS.map(item => _jsx(Chip, {
@@ -170,7 +170,7 @@ export const CreateVariantDrawer = ({
170
170
  }), _jsxs("div", {
171
171
  children: [_jsx(FieldLabel, {
172
172
  children: lang({
173
- message: 'SMART.MEDIA_STORE.CREATE_VARIANT.SIZE_LABEL'
173
+ message: 'SMART.MEDIA_STORE.CREATE_CROP.SIZE_LABEL'
174
174
  })
175
175
  }), _jsxs(Columns, {
176
176
  "$sizes": "auto 1fr",
@@ -182,14 +182,14 @@ export const CreateVariantDrawer = ({
182
182
  "$active": dimension === 'width',
183
183
  onClick: () => setDimension('width'),
184
184
  children: lang({
185
- message: 'SMART.MEDIA_STORE.CREATE_VARIANT.WIDTH'
185
+ message: 'SMART.MEDIA_STORE.CREATE_CROP.WIDTH'
186
186
  })
187
187
  }), _jsx(SegmentItem, {
188
188
  type: "button",
189
189
  "$active": dimension === 'height',
190
190
  onClick: () => setDimension('height'),
191
191
  children: lang({
192
- message: 'SMART.MEDIA_STORE.CREATE_VARIANT.HEIGHT'
192
+ message: 'SMART.MEDIA_STORE.CREATE_CROP.HEIGHT'
193
193
  })
194
194
  })]
195
195
  }), _jsx(NativeInput, {
@@ -216,7 +216,7 @@ export const CreateVariantDrawer = ({
216
216
  }), isJpeg && _jsxs("div", {
217
217
  children: [_jsx(FieldLabel, {
218
218
  children: lang({
219
- message: 'SMART.MEDIA_STORE.CREATE_VARIANT.QUALITY_LABEL'
219
+ message: 'SMART.MEDIA_STORE.CREATE_CROP.QUALITY_LABEL'
220
220
  })
221
221
  }), _jsx(NativeInput, {
222
222
  type: "number",
@@ -228,7 +228,7 @@ export const CreateVariantDrawer = ({
228
228
  })]
229
229
  }), ratioExists && _jsx(Text, {
230
230
  children: lang({
231
- message: 'SMART.MEDIA_STORE.CREATE_VARIANT.RATIO_EXISTS'
231
+ message: 'SMART.MEDIA_STORE.CREATE_CROP.RATIO_EXISTS'
232
232
  })
233
233
  }), _jsx(Button, {
234
234
  color: "primary",
@@ -237,26 +237,26 @@ export const CreateVariantDrawer = ({
237
237
  isLoading: isCreating,
238
238
  onClick: () => void handleCreate(),
239
239
  children: lang({
240
- message: 'SMART.MEDIA_STORE.CREATE_VARIANT.CREATE_BUTTON'
240
+ message: 'SMART.MEDIA_STORE.CREATE_CROP.CREATE_BUTTON'
241
241
  })
242
242
  }), _jsxs("div", {
243
243
  children: [_jsx(FieldLabel, {
244
244
  children: lang({
245
- message: 'SMART.MEDIA_STORE.CREATE_VARIANT.EXISTING_LABEL'
245
+ message: 'SMART.MEDIA_STORE.CREATE_CROP.EXISTING_LABEL'
246
246
  })
247
- }), existingVariants.length === 0 ? _jsx(Text, {
247
+ }), existingCrops.length === 0 ? _jsx(Text, {
248
248
  children: lang({
249
- message: 'SMART.MEDIA_STORE.CREATE_VARIANT.NO_VARIANTS'
249
+ message: 'SMART.MEDIA_STORE.CREATE_CROP.NO_CROPS'
250
250
  })
251
- }) : _jsx(VariantStrip, {
252
- children: existingVariants.map(variant => _jsxs(VariantThumb, {
251
+ }) : _jsx(CropStrip, {
252
+ children: existingCrops.map(crop => _jsxs(CropThumb, {
253
253
  children: [_jsx(TileImage, {
254
- src: getThumbUrl(variant),
255
- alt: variant.filename
256
- }), _jsx(VariantThumbCaption, {
257
- children: getRatioLabel(variant) || variant.filename
254
+ src: getThumbUrl(crop),
255
+ alt: crop.filename
256
+ }), _jsx(CropThumbCaption, {
257
+ children: getRatioLabel(crop) || crop.filename
258
258
  })]
259
- }, variant.uuid))
259
+ }, crop.uuid))
260
260
  })]
261
261
  })]
262
262
  })
@@ -3,6 +3,6 @@ import type { MediaStoreProps } from './types';
3
3
  /**
4
4
  * Controlled media gallery: the parent owns the current page (and page size)
5
5
  * and is notified of navigation via `onPageChange`. For a self-contained
6
- * variant that keeps the page in internal state, use `MediaStorePaginated`.
6
+ * version that keeps the page in internal state, use `MediaStorePaginated`.
7
7
  */
8
8
  export declare const MediaStore: FC<MediaStoreProps>;
@@ -5,15 +5,15 @@ import { Horizontal, useAsync } from '@pushwoosh/kit-helpers';
5
5
  import { CheckIcon, EditIcon, UploadIcon } from '@pushwoosh/kit-icons';
6
6
  import { Text } from '@pushwoosh/kit-typography';
7
7
  import { useSPAContext } from '@pushwoosh/spa-context';
8
- import { CreateVariantDrawer } from './CreateVariantDrawer';
8
+ import { CreateCropDrawer } from './CreateCropDrawer';
9
9
  import { getRatioLabel, getThumbUrl } from './mediaFile.utils';
10
10
  import { useLang } from './polyglot';
11
- import { Dropzone, EmptyState, Grid, HiddenInput, Tile, TileActions, TileImage, VariantBadge } from './styled';
11
+ import { CropBadge, Dropzone, EmptyState, Grid, HiddenInput, Tile, TileActions, TileImage } from './styled';
12
12
  const UPLOAD_PATH = '/api/media/upload';
13
13
  /**
14
14
  * Controlled media gallery: the parent owns the current page (and page size)
15
15
  * and is notified of navigation via `onPageChange`. For a self-contained
16
- * variant that keeps the page in internal state, use `MediaStorePaginated`.
16
+ * version that keeps the page in internal state, use `MediaStorePaginated`.
17
17
  */
18
18
  export const MediaStore = ({
19
19
  application,
@@ -39,13 +39,13 @@ export const MediaStore = ({
39
39
  // the post-upload decision isn't made on a value captured at click time.
40
40
  const pageRef = useRef(page);
41
41
  pageRef.current = page;
42
- const [variantsByUuid, setVariantsByUuid] = useState({});
42
+ const [cropsByUuid, setCropsByUuid] = useState({});
43
43
  // Bumped to force a reload of the current page (e.g. after an upload) when
44
44
  // the page prop itself does not change.
45
45
  const [reloadToken, setReloadToken] = useState(0);
46
46
  const [isUploading, setIsUploading] = useState(false);
47
47
  const [isDragOver, setIsDragOver] = useState(false);
48
- const [createVariantFor, setCreateVariantFor] = useState(null);
48
+ const [createCropFor, setCreateCropFor] = useState(null);
49
49
  const listAsync = useAsync(async () => {
50
50
  const response = await rpcGateway.mediaFiles.List({
51
51
  application,
@@ -73,15 +73,15 @@ export const MediaStore = ({
73
73
  });
74
74
  }
75
75
  }, [listAsync.error, openToast, lang]);
76
- // The List of originals carries no variant count, so once a page of originals
77
- // resolves, fetch each one's variants in the background and let the
78
- // "N variants" badge appear per file as soon as its request resolves. The
76
+ // The List of originals carries no crop count, so once a page of originals
77
+ // resolves, fetch each one's crops in the background and let the
78
+ // "N crops" badge appear per file as soon as its request resolves. The
79
79
  // cleanup flag drops results of a page that has since been replaced.
80
80
  useEffect(() => {
81
81
  var _listAsync$value3;
82
82
  const originals = (_listAsync$value3 = listAsync.value) === null || _listAsync$value3 === void 0 ? void 0 : _listAsync$value3.files;
83
83
  if (!originals) return undefined;
84
- setVariantsByUuid({});
84
+ setCropsByUuid({});
85
85
  let cancelled = false;
86
86
  originals.forEach(file => {
87
87
  void (async () => {
@@ -91,7 +91,7 @@ export const MediaStore = ({
91
91
  parentUuid: file.uuid
92
92
  });
93
93
  if (cancelled) return;
94
- setVariantsByUuid(prev => ({
94
+ setCropsByUuid(prev => ({
95
95
  ...prev,
96
96
  [file.uuid]: response.files ?? []
97
97
  }));
@@ -152,10 +152,10 @@ export const MediaStore = ({
152
152
  setIsUploading(false);
153
153
  }
154
154
  };
155
- const handleVariantCreated = (parentUuid, variant) => {
156
- setVariantsByUuid(prev => ({
155
+ const handleCropCreated = (parentUuid, crop) => {
156
+ setCropsByUuid(prev => ({
157
157
  ...prev,
158
- [parentUuid]: [...(prev[parentUuid] ?? []), variant]
158
+ [parentUuid]: [...(prev[parentUuid] ?? []), crop]
159
159
  }));
160
160
  };
161
161
  const totalPages = Math.ceil(total / perPage);
@@ -203,18 +203,18 @@ export const MediaStore = ({
203
203
  }), !loading && files.length > 0 && _jsxs(_Fragment, {
204
204
  children: [_jsx(Grid, {
205
205
  children: files.map(file => {
206
- const variants = variantsByUuid[file.uuid] ?? [];
206
+ const crops = cropsByUuid[file.uuid] ?? [];
207
207
  return _jsxs(Tile, {
208
208
  children: [_jsx(TileImage, {
209
209
  src: getThumbUrl(file),
210
210
  alt: file.filename
211
- }), variants.length > 0 && _jsx(VariantBadge, {
211
+ }), crops.length > 0 && _jsx(CropBadge, {
212
212
  children: lang({
213
- message: 'SMART.MEDIA_STORE.VARIANTS_BADGE',
214
- count: variants.length
213
+ message: 'SMART.MEDIA_STORE.CROPS_BADGE',
214
+ count: crops.length
215
215
  })
216
216
  }), _jsxs(TileActions, {
217
- children: [variants.length > 0 ? _jsx(DropdownMenuButton, {
217
+ children: [crops.length > 0 ? _jsx(DropdownMenuButton, {
218
218
  color: "secondary",
219
219
  size: "compact",
220
220
  icon: _jsx(CheckIcon, {
@@ -227,10 +227,10 @@ export const MediaStore = ({
227
227
  children: lang({
228
228
  message: 'SMART.MEDIA_STORE.SELECT_ORIGINAL'
229
229
  })
230
- }), variants.map(variant => _jsx(DropdownMenuItem, {
231
- onClick: () => onSelect(variant.url),
232
- children: getRatioLabel(variant) || variant.filename
233
- }, variant.uuid))]
230
+ }), crops.map(crop => _jsx(DropdownMenuItem, {
231
+ onClick: () => onSelect(crop.url),
232
+ children: getRatioLabel(crop) || crop.filename
233
+ }, crop.uuid))]
234
234
  })
235
235
  }) : _jsx(Button, {
236
236
  color: "secondary",
@@ -250,9 +250,9 @@ export const MediaStore = ({
250
250
  view: "lined"
251
251
  }),
252
252
  "aria-label": lang({
253
- message: 'SMART.MEDIA_STORE.CREATE_VARIANT_HINT'
253
+ message: 'SMART.MEDIA_STORE.CREATE_CROP_HINT'
254
254
  }),
255
- onClick: () => setCreateVariantFor(file)
255
+ onClick: () => setCreateCropFor(file)
256
256
  })]
257
257
  })]
258
258
  }, file.uuid);
@@ -286,13 +286,13 @@ export const MediaStore = ({
286
286
  })
287
287
  })]
288
288
  })]
289
- }), _jsx(CreateVariantDrawer, {
289
+ }), _jsx(CreateCropDrawer, {
290
290
  application: application,
291
- original: createVariantFor,
292
- isOpen: createVariantFor !== null,
293
- existingVariants: createVariantFor ? variantsByUuid[createVariantFor.uuid] ?? [] : [],
294
- onClose: () => setCreateVariantFor(null),
295
- onCreated: handleVariantCreated
291
+ original: createCropFor,
292
+ isOpen: createCropFor !== null,
293
+ existingCrops: createCropFor ? cropsByUuid[createCropFor.uuid] ?? [] : [],
294
+ onClose: () => setCreateCropFor(null),
295
+ onCreated: handleCropCreated
296
296
  })]
297
297
  });
298
298
  };
@@ -1,5 +1,5 @@
1
1
  import type { MediaFile } from '@pushwoosh/rpc-v2-http-api-data/media_files';
2
2
  /** Thumbnail URL from image meta, falling back to the full-size URL. */
3
3
  export declare const getThumbUrl: (file: MediaFile) => string;
4
- /** Aspect-ratio label (e.g. "16:9") for a variant; empty for originals. */
4
+ /** Aspect-ratio label (e.g. "16:9") for a crop; empty for originals. */
5
5
  export declare const getRatioLabel: (file: MediaFile) => string;
@@ -3,7 +3,7 @@ export const getThumbUrl = file => {
3
3
  var _file$meta;
4
4
  return ((_file$meta = file.meta) === null || _file$meta === void 0 ? void 0 : _file$meta.type) === 'imageMeta' ? file.meta.data.thumbnailUrl : file.url;
5
5
  };
6
- /** Aspect-ratio label (e.g. "16:9") for a variant; empty for originals. */
6
+ /** Aspect-ratio label (e.g. "16:9") for a crop; empty for originals. */
7
7
  export const getRatioLabel = file => {
8
8
  var _file$meta2;
9
9
  return ((_file$meta2 = file.meta) === null || _file$meta2 === void 0 ? void 0 : _file$meta2.type) === 'imageMeta' ? file.meta.data.ratio : '';
@@ -9,20 +9,20 @@ export const messages = {
9
9
  'SMART.MEDIA_STORE.LOAD_ERROR': 'Failed to load media files',
10
10
  'SMART.MEDIA_STORE.UPLOAD_ERROR': 'Failed to upload image',
11
11
  'SMART.MEDIA_STORE.UPLOAD_SUCCESS': 'Image uploaded',
12
- 'SMART.MEDIA_STORE.VARIANTS_BADGE': '{{count}} var.',
12
+ 'SMART.MEDIA_STORE.CROPS_BADGE': '{{count}} cr.',
13
13
  'SMART.MEDIA_STORE.SELECT_ORIGINAL': 'Original',
14
- 'SMART.MEDIA_STORE.CREATE_VARIANT_HINT': 'Create variants',
15
- 'SMART.MEDIA_STORE.CREATE_VARIANT.TITLE': 'Create variant',
16
- 'SMART.MEDIA_STORE.CREATE_VARIANT.CLOSE': 'Close',
17
- 'SMART.MEDIA_STORE.CREATE_VARIANT.RATIO_LABEL': 'Aspect ratio',
18
- 'SMART.MEDIA_STORE.CREATE_VARIANT.SIZE_LABEL': 'Size',
19
- 'SMART.MEDIA_STORE.CREATE_VARIANT.WIDTH': 'Width',
20
- 'SMART.MEDIA_STORE.CREATE_VARIANT.HEIGHT': 'Height',
21
- 'SMART.MEDIA_STORE.CREATE_VARIANT.QUALITY_LABEL': 'JPEG quality (1–100)',
22
- 'SMART.MEDIA_STORE.CREATE_VARIANT.CREATE_BUTTON': 'Create variant',
23
- 'SMART.MEDIA_STORE.CREATE_VARIANT.RATIO_EXISTS': 'A variant with this aspect ratio already exists',
24
- 'SMART.MEDIA_STORE.CREATE_VARIANT.EXISTING_LABEL': 'Existing variants',
25
- 'SMART.MEDIA_STORE.CREATE_VARIANT.NO_VARIANTS': 'No variants yet',
26
- 'SMART.MEDIA_STORE.CREATE_VARIANT.SUCCESS': 'Variant created',
27
- 'SMART.MEDIA_STORE.CREATE_VARIANT.ERROR': 'Failed to create variant'
14
+ 'SMART.MEDIA_STORE.CREATE_CROP_HINT': 'Create crops',
15
+ 'SMART.MEDIA_STORE.CREATE_CROP.TITLE': 'Create crop',
16
+ 'SMART.MEDIA_STORE.CREATE_CROP.CLOSE': 'Close',
17
+ 'SMART.MEDIA_STORE.CREATE_CROP.RATIO_LABEL': 'Aspect ratio',
18
+ 'SMART.MEDIA_STORE.CREATE_CROP.SIZE_LABEL': 'Size',
19
+ 'SMART.MEDIA_STORE.CREATE_CROP.WIDTH': 'Width',
20
+ 'SMART.MEDIA_STORE.CREATE_CROP.HEIGHT': 'Height',
21
+ 'SMART.MEDIA_STORE.CREATE_CROP.QUALITY_LABEL': 'JPEG quality (1–100)',
22
+ 'SMART.MEDIA_STORE.CREATE_CROP.CREATE_BUTTON': 'Create crop',
23
+ 'SMART.MEDIA_STORE.CREATE_CROP.RATIO_EXISTS': 'A crop with this aspect ratio already exists',
24
+ 'SMART.MEDIA_STORE.CREATE_CROP.EXISTING_LABEL': 'Existing crops',
25
+ 'SMART.MEDIA_STORE.CREATE_CROP.NO_CROPS': 'No crops yet',
26
+ 'SMART.MEDIA_STORE.CREATE_CROP.SUCCESS': 'Crop created',
27
+ 'SMART.MEDIA_STORE.CREATE_CROP.ERROR': 'Failed to create crop'
28
28
  };
@@ -9,20 +9,20 @@ export const messages = {
9
9
  'SMART.MEDIA_STORE.LOAD_ERROR': 'Не удалось загрузить медиафайлы',
10
10
  'SMART.MEDIA_STORE.UPLOAD_ERROR': 'Не удалось загрузить изображение',
11
11
  'SMART.MEDIA_STORE.UPLOAD_SUCCESS': 'Изображение загружено',
12
- 'SMART.MEDIA_STORE.VARIANTS_BADGE': '{{count}} вар.',
12
+ 'SMART.MEDIA_STORE.CROPS_BADGE': '{{count}} кр.',
13
13
  'SMART.MEDIA_STORE.SELECT_ORIGINAL': 'Оригинал',
14
- 'SMART.MEDIA_STORE.CREATE_VARIANT_HINT': 'Создать варианты',
15
- 'SMART.MEDIA_STORE.CREATE_VARIANT.TITLE': 'Создание варианта',
16
- 'SMART.MEDIA_STORE.CREATE_VARIANT.CLOSE': 'Закрыть',
17
- 'SMART.MEDIA_STORE.CREATE_VARIANT.RATIO_LABEL': 'Соотношение сторон',
18
- 'SMART.MEDIA_STORE.CREATE_VARIANT.SIZE_LABEL': 'Размер',
19
- 'SMART.MEDIA_STORE.CREATE_VARIANT.WIDTH': 'Ширина',
20
- 'SMART.MEDIA_STORE.CREATE_VARIANT.HEIGHT': 'Высота',
21
- 'SMART.MEDIA_STORE.CREATE_VARIANT.QUALITY_LABEL': 'Качество JPEG (1–100)',
22
- 'SMART.MEDIA_STORE.CREATE_VARIANT.CREATE_BUTTON': 'Создать вариант',
23
- 'SMART.MEDIA_STORE.CREATE_VARIANT.RATIO_EXISTS': 'Вариант с таким соотношением сторон уже существует',
24
- 'SMART.MEDIA_STORE.CREATE_VARIANT.EXISTING_LABEL': 'Созданные варианты',
25
- 'SMART.MEDIA_STORE.CREATE_VARIANT.NO_VARIANTS': 'Вариантов пока нет',
26
- 'SMART.MEDIA_STORE.CREATE_VARIANT.SUCCESS': 'Вариант создан',
27
- 'SMART.MEDIA_STORE.CREATE_VARIANT.ERROR': 'Не удалось создать вариант'
14
+ 'SMART.MEDIA_STORE.CREATE_CROP_HINT': 'Создать кропы',
15
+ 'SMART.MEDIA_STORE.CREATE_CROP.TITLE': 'Создание кропа',
16
+ 'SMART.MEDIA_STORE.CREATE_CROP.CLOSE': 'Закрыть',
17
+ 'SMART.MEDIA_STORE.CREATE_CROP.RATIO_LABEL': 'Соотношение сторон',
18
+ 'SMART.MEDIA_STORE.CREATE_CROP.SIZE_LABEL': 'Размер',
19
+ 'SMART.MEDIA_STORE.CREATE_CROP.WIDTH': 'Ширина',
20
+ 'SMART.MEDIA_STORE.CREATE_CROP.HEIGHT': 'Высота',
21
+ 'SMART.MEDIA_STORE.CREATE_CROP.QUALITY_LABEL': 'Качество JPEG (1–100)',
22
+ 'SMART.MEDIA_STORE.CREATE_CROP.CREATE_BUTTON': 'Создать кроп',
23
+ 'SMART.MEDIA_STORE.CREATE_CROP.RATIO_EXISTS': 'Кроп с таким соотношением сторон уже существует',
24
+ 'SMART.MEDIA_STORE.CREATE_CROP.EXISTING_LABEL': 'Созданные кропы',
25
+ 'SMART.MEDIA_STORE.CREATE_CROP.NO_CROPS': 'Кропов пока нет',
26
+ 'SMART.MEDIA_STORE.CREATE_CROP.SUCCESS': 'Кроп создан',
27
+ 'SMART.MEDIA_STORE.CREATE_CROP.ERROR': 'Не удалось создать кроп'
28
28
  };
@@ -10,22 +10,22 @@ export type MediaStoreMessages = {
10
10
  'SMART.MEDIA_STORE.LOAD_ERROR': NoParams;
11
11
  'SMART.MEDIA_STORE.UPLOAD_ERROR': NoParams;
12
12
  'SMART.MEDIA_STORE.UPLOAD_SUCCESS': NoParams;
13
- 'SMART.MEDIA_STORE.VARIANTS_BADGE': {
13
+ 'SMART.MEDIA_STORE.CROPS_BADGE': {
14
14
  count: number;
15
15
  };
16
16
  'SMART.MEDIA_STORE.SELECT_ORIGINAL': NoParams;
17
- 'SMART.MEDIA_STORE.CREATE_VARIANT_HINT': NoParams;
18
- 'SMART.MEDIA_STORE.CREATE_VARIANT.TITLE': NoParams;
19
- 'SMART.MEDIA_STORE.CREATE_VARIANT.CLOSE': NoParams;
20
- 'SMART.MEDIA_STORE.CREATE_VARIANT.RATIO_LABEL': NoParams;
21
- 'SMART.MEDIA_STORE.CREATE_VARIANT.SIZE_LABEL': NoParams;
22
- 'SMART.MEDIA_STORE.CREATE_VARIANT.WIDTH': NoParams;
23
- 'SMART.MEDIA_STORE.CREATE_VARIANT.HEIGHT': NoParams;
24
- 'SMART.MEDIA_STORE.CREATE_VARIANT.QUALITY_LABEL': NoParams;
25
- 'SMART.MEDIA_STORE.CREATE_VARIANT.CREATE_BUTTON': NoParams;
26
- 'SMART.MEDIA_STORE.CREATE_VARIANT.RATIO_EXISTS': NoParams;
27
- 'SMART.MEDIA_STORE.CREATE_VARIANT.EXISTING_LABEL': NoParams;
28
- 'SMART.MEDIA_STORE.CREATE_VARIANT.NO_VARIANTS': NoParams;
29
- 'SMART.MEDIA_STORE.CREATE_VARIANT.SUCCESS': NoParams;
30
- 'SMART.MEDIA_STORE.CREATE_VARIANT.ERROR': NoParams;
17
+ 'SMART.MEDIA_STORE.CREATE_CROP_HINT': NoParams;
18
+ 'SMART.MEDIA_STORE.CREATE_CROP.TITLE': NoParams;
19
+ 'SMART.MEDIA_STORE.CREATE_CROP.CLOSE': NoParams;
20
+ 'SMART.MEDIA_STORE.CREATE_CROP.RATIO_LABEL': NoParams;
21
+ 'SMART.MEDIA_STORE.CREATE_CROP.SIZE_LABEL': NoParams;
22
+ 'SMART.MEDIA_STORE.CREATE_CROP.WIDTH': NoParams;
23
+ 'SMART.MEDIA_STORE.CREATE_CROP.HEIGHT': NoParams;
24
+ 'SMART.MEDIA_STORE.CREATE_CROP.QUALITY_LABEL': NoParams;
25
+ 'SMART.MEDIA_STORE.CREATE_CROP.CREATE_BUTTON': NoParams;
26
+ 'SMART.MEDIA_STORE.CREATE_CROP.RATIO_EXISTS': NoParams;
27
+ 'SMART.MEDIA_STORE.CREATE_CROP.EXISTING_LABEL': NoParams;
28
+ 'SMART.MEDIA_STORE.CREATE_CROP.NO_CROPS': NoParams;
29
+ 'SMART.MEDIA_STORE.CREATE_CROP.SUCCESS': NoParams;
30
+ 'SMART.MEDIA_STORE.CREATE_CROP.ERROR': NoParams;
31
31
  };
@@ -1,7 +1,7 @@
1
1
  export declare const Grid: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  export declare const Tile: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const TileImage: import("styled-components").StyledComponent<"img", any, {}, never>;
4
- export declare const VariantBadge: import("styled-components").StyledComponent<"span", any, {}, never>;
4
+ export declare const CropBadge: import("styled-components").StyledComponent<"span", any, {}, never>;
5
5
  export declare const TileActions: import("styled-components").StyledComponent<"div", any, {}, never>;
6
6
  export declare const EmptyState: import("styled-components").StyledComponent<"div", any, {}, never>;
7
7
  export declare const Dropzone: import("styled-components").StyledComponent<"button", any, {
@@ -22,6 +22,6 @@ export declare const Segment: import("styled-components").StyledComponent<"div",
22
22
  export declare const SegmentItem: import("styled-components").StyledComponent<"button", any, {
23
23
  $active?: boolean;
24
24
  }, never>;
25
- export declare const VariantStrip: import("styled-components").StyledComponent<"div", any, {}, never>;
26
- export declare const VariantThumb: import("styled-components").StyledComponent<"div", any, {}, never>;
27
- export declare const VariantThumbCaption: import("styled-components").StyledComponent<"div", any, {}, never>;
25
+ export declare const CropStrip: import("styled-components").StyledComponent<"div", any, {}, never>;
26
+ export declare const CropThumb: import("styled-components").StyledComponent<"div", any, {}, never>;
27
+ export declare const CropThumbCaption: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -12,8 +12,8 @@ export const TileImage = styled.img.withConfig({
12
12
  displayName: "TileImage",
13
13
  componentId: "sc-1d9kmgw-2"
14
14
  })(["width:100%;aspect-ratio:1;object-fit:cover;display:block;"]);
15
- export const VariantBadge = styled.span.withConfig({
16
- displayName: "VariantBadge",
15
+ export const CropBadge = styled.span.withConfig({
16
+ displayName: "CropBadge",
17
17
  componentId: "sc-1d9kmgw-3"
18
18
  })(["position:absolute;top:6px;right:6px;font-size:10px;font-weight:", ";line-height:1;color:", ";background:", ";border-radius:20px;padding:3px 7px;pointer-events:none;"], FontWeight.BOLD, Color.CLEAR, Color.PRIMARY);
19
19
  export const TileActions = styled.div.withConfig({
@@ -36,7 +36,7 @@ export const HiddenInput = styled.input.withConfig({
36
36
  displayName: "HiddenInput",
37
37
  componentId: "sc-1d9kmgw-7"
38
38
  })(["display:none;"]);
39
- /* ---------- CreateVariantDrawer ---------- */
39
+ /* ---------- CreateCropDrawer ---------- */
40
40
  export const PreviewStage = styled.div.withConfig({
41
41
  displayName: "PreviewStage",
42
42
  componentId: "sc-1d9kmgw-8"
@@ -81,15 +81,15 @@ export const SegmentItem = styled.button.withConfig({
81
81
  }) => $active ? Color.PRIMARY : Color.CLEAR, ({
82
82
  $active
83
83
  }) => $active ? Color.CLEAR : Color.MAIN, Color.DIVIDER);
84
- export const VariantStrip = styled.div.withConfig({
85
- displayName: "VariantStrip",
84
+ export const CropStrip = styled.div.withConfig({
85
+ displayName: "CropStrip",
86
86
  componentId: "sc-1d9kmgw-16"
87
87
  })(["display:flex;gap:10px;flex-wrap:wrap;align-items:flex-start;"]);
88
- export const VariantThumb = styled.div.withConfig({
89
- displayName: "VariantThumb",
88
+ export const CropThumb = styled.div.withConfig({
89
+ displayName: "CropThumb",
90
90
  componentId: "sc-1d9kmgw-17"
91
91
  })(["width:88px;border:1px solid ", ";border-radius:6px;overflow:hidden;background:", ";"], Color.DIVIDER, Color.SOFT_LIGHT);
92
- export const VariantThumbCaption = styled.div.withConfig({
93
- displayName: "VariantThumbCaption",
92
+ export const CropThumbCaption = styled.div.withConfig({
93
+ displayName: "CropThumbCaption",
94
94
  componentId: "sc-1d9kmgw-18"
95
95
  })(["font-size:10px;text-align:center;padding:3px 2px;color:", ";"], Color.LOCKED);
@@ -7,7 +7,7 @@ export type MediaStoreProps = {
7
7
  perPage: number;
8
8
  /** Called when the user requests a different page. */
9
9
  onPageChange: (page: number) => void;
10
- /** Called with the chosen file URL (original or variant). */
10
+ /** Called with the chosen file URL (original or crop). */
11
11
  onSelect: (url: string) => void;
12
12
  };
13
13
  export type MediaStorePaginatedProps = {
@@ -17,6 +17,6 @@ export type MediaStorePaginatedProps = {
17
17
  initialPage?: number;
18
18
  /** Page size. Defaults to 30. */
19
19
  perPage?: number;
20
- /** Called with the chosen file URL (original or variant). */
20
+ /** Called with the chosen file URL (original or crop). */
21
21
  onSelect: (url: string) => void;
22
22
  };
package/package.json CHANGED
@@ -49,5 +49,5 @@
49
49
  "react": "^16.14.0 || ^18.0.0",
50
50
  "react-dom": "^16.14.0 || ^18.0.0"
51
51
  },
52
- "version": "1.1.1"
52
+ "version": "1.1.2"
53
53
  }