@gem-sdk/components 2.0.0-staging.150 → 2.0.0-staging.151

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.
@@ -34,7 +34,7 @@ const isHexTransparent = (hex)=>{
34
34
  return Boolean(a);
35
35
  };
36
36
  const youtubeShortsRegex = /^(?:https?:\/\/)?(?:www\.)?youtube\.com\/shorts\/([^"&?/\s]{11})$/i;
37
- const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal = '', translate, isReplaceLocationOrigin })=>{
37
+ const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal = '', translate, isReplaceLocationOrigin, isReplaceMaxSize })=>{
38
38
  const hasLiquidInValue = new RegExp(/\{\{.*?\}\}|\{%.*?%\}/).test(val?.toString() ?? '');
39
39
  const translateLimit = pageContext?.isTranslateWithLocale ? 1000 : 5000;
40
40
  if (!translate || !val?.toString().trim() || val.toString().length > translateLimit || hasLiquidInValue || pageContext?.isPreviewing) return val ?? defaultVal;
@@ -46,6 +46,9 @@ const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, i
46
46
  if (isReplaceLocationOrigin) {
47
47
  locale += ` | replace: '$locationOrigin', locationOrigin`;
48
48
  }
49
+ if (isReplaceMaxSize) {
50
+ locale += ` | replace: '$max_size', '10MB'`;
51
+ }
49
52
  if (isCapitalize) {
50
53
  locale = `${locale} | downcase`;
51
54
  }
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const getTextDropContent = (textContent)=>{
4
- if (textContent?.includes('{max_size}')) {
5
- return textContent?.replace('{max_size}', '10MB');
4
+ if (textContent?.includes('$max_size')) {
5
+ return textContent?.replace('$max_size', '10MB');
6
6
  }
7
7
  return textContent;
8
8
  };
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@gem-sdk/core');
6
6
  var helpers = require('../../helpers.js');
7
- var index = require('./FileUpload/components/common/index.js');
8
7
 
9
8
  const FileUpload = ({ setting, styles, builderProps, pageContext })=>{
10
9
  const appendTypoClass = core.composeTypographyClassName(styles?.typo);
@@ -12,12 +11,13 @@ const FileUpload = ({ setting, styles, builderProps, pageContext })=>{
12
11
  const composeGlobalSize = core.makeGlobalSize(setting?.size);
13
12
  const composePaddingSize = core.makeGlobalSize(setting?.paddingSize);
14
13
  const displayText = helpers.getDynamicSourceLocales({
15
- val: index.getTextDropContent(setting?.textContent),
14
+ val: setting?.textContent,
16
15
  uid: builderProps?.uid,
17
16
  settingId: 'textContent',
18
17
  pageContext,
19
18
  isCapitalize: styles?.typo?.attrs?.transform === 'capitalize',
20
- translate: setting?.translate
19
+ translate: setting?.translate,
20
+ isReplaceMaxSize: true
21
21
  });
22
22
  const cssInLine = `
23
23
  .${builderProps?.uid}:hover .gp-file-upload__icon {
@@ -20,7 +20,7 @@ const config = {
20
20
  {
21
21
  id: 'textContent',
22
22
  type: 'textarea',
23
- default: 'Click or drop your image to upload (Max {max_size})'
23
+ default: 'Click or drop your image to upload (Max $max_size)'
24
24
  },
25
25
  {
26
26
  id: 'translate',
@@ -32,7 +32,7 @@ const isHexTransparent = (hex)=>{
32
32
  return Boolean(a);
33
33
  };
34
34
  const youtubeShortsRegex = /^(?:https?:\/\/)?(?:www\.)?youtube\.com\/shorts\/([^"&?/\s]{11})$/i;
35
- const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal = '', translate, isReplaceLocationOrigin })=>{
35
+ const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal = '', translate, isReplaceLocationOrigin, isReplaceMaxSize })=>{
36
36
  const hasLiquidInValue = new RegExp(/\{\{.*?\}\}|\{%.*?%\}/).test(val?.toString() ?? '');
37
37
  const translateLimit = pageContext?.isTranslateWithLocale ? 1000 : 5000;
38
38
  if (!translate || !val?.toString().trim() || val.toString().length > translateLimit || hasLiquidInValue || pageContext?.isPreviewing) return val ?? defaultVal;
@@ -44,6 +44,9 @@ const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, i
44
44
  if (isReplaceLocationOrigin) {
45
45
  locale += ` | replace: '$locationOrigin', locationOrigin`;
46
46
  }
47
+ if (isReplaceMaxSize) {
48
+ locale += ` | replace: '$max_size', '10MB'`;
49
+ }
47
50
  if (isCapitalize) {
48
51
  locale = `${locale} | downcase`;
49
52
  }
@@ -1,6 +1,6 @@
1
1
  const getTextDropContent = (textContent)=>{
2
- if (textContent?.includes('{max_size}')) {
3
- return textContent?.replace('{max_size}', '10MB');
2
+ if (textContent?.includes('$max_size')) {
3
+ return textContent?.replace('$max_size', '10MB');
4
4
  }
5
5
  return textContent;
6
6
  };
@@ -1,6 +1,5 @@
1
1
  import { composeTypographyClassName, composeTypographyStyle, makeGlobalSize, template, makeStyleResponsive, makeStyle, makeStyleState, composeRadius, handleConvertBorderWidth, handleConvertBorderStyle, handleConvertBorderColor, getStyleShadowState, cls, getGlobalColorStateStyle, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
2
2
  import { getDynamicSourceLocales, getSettingPreloadData } from '../../helpers.js';
3
- import { getTextDropContent } from './FileUpload/components/common/index.js';
4
3
 
5
4
  const FileUpload = ({ setting, styles, builderProps, pageContext })=>{
6
5
  const appendTypoClass = composeTypographyClassName(styles?.typo);
@@ -8,12 +7,13 @@ const FileUpload = ({ setting, styles, builderProps, pageContext })=>{
8
7
  const composeGlobalSize = makeGlobalSize(setting?.size);
9
8
  const composePaddingSize = makeGlobalSize(setting?.paddingSize);
10
9
  const displayText = getDynamicSourceLocales({
11
- val: getTextDropContent(setting?.textContent),
10
+ val: setting?.textContent,
12
11
  uid: builderProps?.uid,
13
12
  settingId: 'textContent',
14
13
  pageContext,
15
14
  isCapitalize: styles?.typo?.attrs?.transform === 'capitalize',
16
- translate: setting?.translate
15
+ translate: setting?.translate,
16
+ isReplaceMaxSize: true
17
17
  });
18
18
  const cssInLine = `
19
19
  .${builderProps?.uid}:hover .gp-file-upload__icon {
@@ -16,7 +16,7 @@ const config = {
16
16
  {
17
17
  id: 'textContent',
18
18
  type: 'textarea',
19
- default: 'Click or drop your image to upload (Max {max_size})'
19
+ default: 'Click or drop your image to upload (Max $max_size)'
20
20
  },
21
21
  {
22
22
  id: 'translate',
@@ -7833,12 +7833,13 @@ type DynamicSource = {
7833
7833
  defaultVal?: string;
7834
7834
  translate?: string;
7835
7835
  isReplaceLocationOrigin?: boolean;
7836
+ isReplaceMaxSize?: boolean;
7836
7837
  };
7837
7838
  declare const isTransparentColor: (str?: string) => boolean;
7838
7839
  declare const isTransparentRGBA: (rgbStr: string) => boolean;
7839
7840
  declare const isHexTransparent: (hex: string) => boolean;
7840
7841
  declare const youtubeShortsRegex: RegExp;
7841
- declare const getDynamicSourceLocales: ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal, translate, isReplaceLocationOrigin, }: DynamicSource) => string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>;
7842
+ declare const getDynamicSourceLocales: ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal, translate, isReplaceLocationOrigin, isReplaceMaxSize, }: DynamicSource) => string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>;
7842
7843
  declare const getStaticLocale: (tag: string, key: string) => string;
7843
7844
  declare const getSettingPreloadData: (disabledValue: string, enabledValue?: string) => string;
7844
7845
  declare const getInsertLinkData: (defaultWrap: string, setting?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-staging.150",
3
+ "version": "2.0.0-staging.151",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",