@antscorp/antsomi-ui 1.3.2-beta.25 → 1.3.2-beta.26

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,46 +1,9 @@
1
1
  import React from 'react';
2
+ import { POSITION } from '@antscorp/antsomi-ui/es/constants';
2
3
  interface GradientColor {
3
4
  gradientColor: string;
4
5
  gradientColorLocation: number;
5
6
  }
6
- declare const POSITION: {
7
- readonly LEFT_TOP: {
8
- readonly value: "left top";
9
- readonly label: string;
10
- };
11
- readonly LEFT_CENTER: {
12
- readonly value: "left center";
13
- readonly label: string;
14
- };
15
- readonly LEFT_BOTTOM: {
16
- readonly value: "left bottom";
17
- readonly label: string;
18
- };
19
- readonly RIGHT_TOP: {
20
- readonly value: "right top";
21
- readonly label: string;
22
- };
23
- readonly RIGHT_CENTER: {
24
- readonly value: "right center";
25
- readonly label: string;
26
- };
27
- readonly RIGHT_BOTTOM: {
28
- readonly value: "right bottom";
29
- readonly label: string;
30
- };
31
- readonly CENTER_TOP: {
32
- readonly value: "center top";
33
- readonly label: string;
34
- };
35
- readonly CENTER_CENTER: {
36
- readonly value: "center center";
37
- readonly label: string;
38
- };
39
- readonly CENTER_BOTTOM: {
40
- readonly value: "center bottom";
41
- readonly label: string;
42
- };
43
- };
44
7
  type PositionValue = (typeof POSITION)[keyof typeof POSITION]['value'];
45
8
  interface GradientConfig {
46
9
  gradients: GradientColor[];
@@ -1,8 +1,6 @@
1
1
  // Libraries
2
2
  import React, { useEffect, useState } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
- // Locales
5
- import { getTranslateMessage, translations } from '@antscorp/antsomi-ui/es/locales/translations';
6
4
  // Components
7
5
  import { ColorSetting, Select, SettingWrapper, SliderWithInputNumber, } from '@antscorp/antsomi-ui/es/components/molecules';
8
6
  // Utils
@@ -10,54 +8,8 @@ import { Button } from '@antscorp/antsomi-ui/es/components/atoms';
10
8
  import Icon from '@antscorp/icons';
11
9
  import { mapNumberToOrdinalText } from '@antscorp/antsomi-ui/es/utils';
12
10
  import { cloneDeep } from 'lodash';
13
- const GRADIENT_TYPE = {
14
- LINEAR: {
15
- value: 'linear-gradient',
16
- label: getTranslateMessage(translations.linear),
17
- },
18
- RADIAL: {
19
- value: 'radial-gradient',
20
- label: getTranslateMessage(translations.radial),
21
- },
22
- };
23
- const POSITION = {
24
- LEFT_TOP: {
25
- value: 'left top',
26
- label: getTranslateMessage(translations.leftTop),
27
- },
28
- LEFT_CENTER: {
29
- value: 'left center',
30
- label: getTranslateMessage(translations.leftCenter),
31
- },
32
- LEFT_BOTTOM: {
33
- value: 'left bottom',
34
- label: getTranslateMessage(translations.leftBottom),
35
- },
36
- RIGHT_TOP: {
37
- value: 'right top',
38
- label: getTranslateMessage(translations.rightTop),
39
- },
40
- RIGHT_CENTER: {
41
- value: 'right center',
42
- label: getTranslateMessage(translations.rightCenter),
43
- },
44
- RIGHT_BOTTOM: {
45
- value: 'right bottom',
46
- label: getTranslateMessage(translations.rightBottom),
47
- },
48
- CENTER_TOP: {
49
- value: 'center top',
50
- label: getTranslateMessage(translations.centerTop),
51
- },
52
- CENTER_CENTER: {
53
- value: 'center center',
54
- label: getTranslateMessage(translations.centerCenter),
55
- },
56
- CENTER_BOTTOM: {
57
- value: 'center bottom',
58
- label: getTranslateMessage(translations.centerBottom),
59
- },
60
- };
11
+ // Constants
12
+ import { GRADIENT_TEXT_LABEL, GRADIENT_TYPE, POSITION } from '@antscorp/antsomi-ui/es/constants';
61
13
  const GRADIENT_MIN = 2;
62
14
  const GRADIENT_MAX = 5;
63
15
  const DEFAULT_GRADIENTS = [
@@ -75,9 +27,9 @@ export const GradientSetting = ({ onChange }) => {
75
27
  // eslint-disable-next-line react-hooks/exhaustive-deps
76
28
  }, [JSON.stringify(gradients), gradientType, radialPosition, linearAngle]);
77
29
  return (React.createElement(React.Fragment, null,
78
- React.createElement(SettingWrapper, { className: "ants-mb-[15px]", label: t(translations.gradientStyle) },
30
+ React.createElement(SettingWrapper, { className: "ants-mb-[15px]", label: GRADIENT_TEXT_LABEL.gradientStyle },
79
31
  React.createElement(Select, { className: "ants-w-[112px]", options: Object.values(GRADIENT_TYPE), value: gradientType, onChange: value => setGradientType(value) })),
80
- gradientType === GRADIENT_TYPE.LINEAR.value ? (React.createElement(SliderWithInputNumber, { className: "ants-mb-[15px]", label: t(translations.angle), min: 0, max: 360, value: linearAngle, onAfterChange: value => setLinearAngle(value) })) : (React.createElement(SettingWrapper, { className: "ants-mb-[15px]", label: t(translations.position) },
32
+ gradientType === GRADIENT_TYPE.LINEAR.value ? (React.createElement(SliderWithInputNumber, { className: "ants-mb-[15px]", label: GRADIENT_TEXT_LABEL.angle, min: 0, max: 360, value: linearAngle, onAfterChange: value => setLinearAngle(value) })) : (React.createElement(SettingWrapper, { className: "ants-mb-[15px]", label: GRADIENT_TEXT_LABEL.position },
81
33
  React.createElement(Select, { className: "ants-w-[112px]", options: Object.values(POSITION), value: radialPosition, onChange: value => setRadialPosition(value) }))),
82
34
  Array.isArray(gradients) && gradients.length
83
35
  ? gradients.map((gradient, index) => {
@@ -85,9 +37,12 @@ export const GradientSetting = ({ onChange }) => {
85
37
  return (React.createElement("div", { className: "ants-flex ants-gap-x-2 ants-mb-[15px]", key: index },
86
38
  React.createElement("div", { className: "ants-grid md:ants-grid-cols-5 ants-grid-cols-1 ants-gap-y-5" },
87
39
  React.createElement("div", { className: "ants-col-span-2" },
88
- React.createElement(ColorSetting, { labelClassName: "!ants-text-cus-base", label: t(translations.gradientColor, {
89
- name: t(translations.ordinalText[mapNumberToOrdinalText(index + 1)]),
90
- }), color: gradientColor, positionInput: "right", onChange: color => {
40
+ React.createElement(ColorSetting, { labelClassName: "!ants-text-cus-base",
41
+ // label={t(translations.gradientColor, {
42
+ // name: translations?.ordinalText?.first,
43
+ // // name: t(translations.ordinalText[mapNumberToOrdinalText(index + 1)]),
44
+ // })}
45
+ label: GRADIENT_TEXT_LABEL.gradientColor.replace('{{name}}', GRADIENT_TEXT_LABEL.ordinalText[mapNumberToOrdinalText(index + 1)]), color: gradientColor, positionInput: "right", onChange: color => {
91
46
  setGradients(prev => {
92
47
  const clonePrev = cloneDeep(prev);
93
48
  clonePrev[index].gradientColor = color;
@@ -95,9 +50,17 @@ export const GradientSetting = ({ onChange }) => {
95
50
  });
96
51
  } })),
97
52
  React.createElement("div", { className: "ants-col-span-3" },
98
- React.createElement(SliderWithInputNumber, { label: t(translations.gradientLocation, {
99
- name: t(translations.ordinalText[mapNumberToOrdinalText(index + 1)]),
100
- }), min: 0, max: 100, value: gradientColorLocation, onAfterChange: color => {
53
+ React.createElement(SliderWithInputNumber
54
+ // label={t(translations.gradientLocation, {
55
+ // name: t(translations.ordinalText?.first),
56
+ // // name: t(translations.ordinalText[mapNumberToOrdinalText(index + 1)]),
57
+ // })}
58
+ , {
59
+ // label={t(translations.gradientLocation, {
60
+ // name: t(translations.ordinalText?.first),
61
+ // // name: t(translations.ordinalText[mapNumberToOrdinalText(index + 1)]),
62
+ // })}
63
+ label: GRADIENT_TEXT_LABEL.gradientLocation.replace('{{name}}', GRADIENT_TEXT_LABEL.ordinalText[mapNumberToOrdinalText(index + 1)]), min: 0, max: 100, value: gradientColorLocation, onAfterChange: color => {
101
64
  setGradients(prev => {
102
65
  const clonePrev = cloneDeep(prev);
103
66
  clonePrev[index].gradientColorLocation = color;
@@ -118,5 +81,5 @@ export const GradientSetting = ({ onChange }) => {
118
81
  });
119
82
  } },
120
83
  "+ ",
121
- t(translations.addColor)))));
84
+ GRADIENT_TEXT_LABEL.addColor))));
122
85
  };
@@ -0,0 +1,83 @@
1
+ export declare const GRADIENT_TEXT_LABEL: {
2
+ linear: string;
3
+ radial: string;
4
+ gradientStyle: string;
5
+ angle: string;
6
+ gradientColor: string;
7
+ gradientLocation: string;
8
+ firstColor: string;
9
+ secondColor: string;
10
+ firstColorLocation: string;
11
+ secondColorLocation: string;
12
+ leftTop: string;
13
+ leftCenter: string;
14
+ leftBottom: string;
15
+ rightTop: string;
16
+ rightCenter: string;
17
+ rightBottom: string;
18
+ centerTop: string;
19
+ centerCenter: string;
20
+ centerBottom: string;
21
+ position: string;
22
+ addColor: string;
23
+ ordinalText: {
24
+ first: string;
25
+ second: string;
26
+ third: string;
27
+ fourth: string;
28
+ fifth: string;
29
+ sixth: string;
30
+ seventh: string;
31
+ eighth: string;
32
+ ninth: string;
33
+ tenth: string;
34
+ };
35
+ };
36
+ export declare const GRADIENT_TYPE: {
37
+ LINEAR: {
38
+ value: string;
39
+ label: string;
40
+ };
41
+ RADIAL: {
42
+ value: string;
43
+ label: string;
44
+ };
45
+ };
46
+ export declare const POSITION: {
47
+ readonly LEFT_TOP: {
48
+ readonly value: "left top";
49
+ readonly label: string;
50
+ };
51
+ readonly LEFT_CENTER: {
52
+ readonly value: "left center";
53
+ readonly label: string;
54
+ };
55
+ readonly LEFT_BOTTOM: {
56
+ readonly value: "left bottom";
57
+ readonly label: string;
58
+ };
59
+ readonly RIGHT_TOP: {
60
+ readonly value: "right top";
61
+ readonly label: string;
62
+ };
63
+ readonly RIGHT_CENTER: {
64
+ readonly value: "right center";
65
+ readonly label: string;
66
+ };
67
+ readonly RIGHT_BOTTOM: {
68
+ readonly value: "right bottom";
69
+ readonly label: string;
70
+ };
71
+ readonly CENTER_TOP: {
72
+ readonly value: "center top";
73
+ readonly label: string;
74
+ };
75
+ readonly CENTER_CENTER: {
76
+ readonly value: "center center";
77
+ readonly label: string;
78
+ };
79
+ readonly CENTER_BOTTOM: {
80
+ readonly value: "center bottom";
81
+ readonly label: string;
82
+ };
83
+ };
@@ -0,0 +1,83 @@
1
+ export const GRADIENT_TEXT_LABEL = {
2
+ linear: 'Linear',
3
+ radial: 'Radial',
4
+ gradientStyle: 'Gradient Style',
5
+ angle: 'Angle',
6
+ gradientColor: '{{name}} Color',
7
+ gradientLocation: '{{name}} Color Location',
8
+ firstColor: 'First Color',
9
+ secondColor: 'Second Color',
10
+ firstColorLocation: 'First Color Location',
11
+ secondColorLocation: 'Second Color Location',
12
+ leftTop: 'Left Top',
13
+ leftCenter: 'Left Center',
14
+ leftBottom: 'Left Bottom',
15
+ rightTop: 'Right Top',
16
+ rightCenter: 'Right Center',
17
+ rightBottom: 'Right Bottom',
18
+ centerTop: 'Center Top',
19
+ centerCenter: 'Center Center',
20
+ centerBottom: 'Center Bottom',
21
+ position: 'Position',
22
+ addColor: 'Add color',
23
+ ordinalText: {
24
+ first: 'First',
25
+ second: 'Second',
26
+ third: 'Third',
27
+ fourth: 'Fourth',
28
+ fifth: 'Fifth',
29
+ sixth: 'Sixth',
30
+ seventh: 'Seventh',
31
+ eighth: 'Eighth',
32
+ ninth: 'Ninth',
33
+ tenth: 'Tenth',
34
+ },
35
+ };
36
+ export const GRADIENT_TYPE = {
37
+ LINEAR: {
38
+ value: 'linear-gradient',
39
+ label: GRADIENT_TEXT_LABEL.linear,
40
+ },
41
+ RADIAL: {
42
+ value: 'radial-gradient',
43
+ label: GRADIENT_TEXT_LABEL.radial,
44
+ },
45
+ };
46
+ export const POSITION = {
47
+ LEFT_TOP: {
48
+ value: 'left top',
49
+ label: GRADIENT_TEXT_LABEL.leftTop,
50
+ },
51
+ LEFT_CENTER: {
52
+ value: 'left center',
53
+ label: GRADIENT_TEXT_LABEL.leftCenter,
54
+ },
55
+ LEFT_BOTTOM: {
56
+ value: 'left bottom',
57
+ label: GRADIENT_TEXT_LABEL.leftBottom,
58
+ },
59
+ RIGHT_TOP: {
60
+ value: 'right top',
61
+ label: GRADIENT_TEXT_LABEL.rightTop,
62
+ },
63
+ RIGHT_CENTER: {
64
+ value: 'right center',
65
+ label: GRADIENT_TEXT_LABEL.rightCenter,
66
+ },
67
+ RIGHT_BOTTOM: {
68
+ value: 'right bottom',
69
+ label: GRADIENT_TEXT_LABEL.rightBottom,
70
+ },
71
+ CENTER_TOP: {
72
+ value: 'center top',
73
+ label: GRADIENT_TEXT_LABEL.centerTop,
74
+ },
75
+ CENTER_CENTER: {
76
+ value: 'center center',
77
+ label: GRADIENT_TEXT_LABEL.centerCenter,
78
+ },
79
+ CENTER_BOTTOM: {
80
+ value: 'center bottom',
81
+ label: GRADIENT_TEXT_LABEL.centerBottom,
82
+ },
83
+ };
@@ -1,2 +1,3 @@
1
1
  export { THEME } from './theme';
2
2
  export * from './storybook';
3
+ export * from './gradientSetting';
@@ -1,2 +1,3 @@
1
1
  export { THEME } from './theme';
2
2
  export * from './storybook';
3
+ export * from './gradientSetting';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.2-beta.25",
3
+ "version": "1.3.2-beta.26",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",
@@ -73,8 +73,6 @@
73
73
  "highlight.js": "^11.8.0",
74
74
  "html-to-image": "^1.11.11",
75
75
  "html2canvas": "^1.4.1",
76
- "i18next": "^23.7.11",
77
- "i18next-browser-languagedetector": "^7.2.0",
78
76
  "lodash": "^4.17.21",
79
77
  "moment": "2.29.2",
80
78
  "qs": "6.10.3",
@@ -147,6 +145,8 @@
147
145
  "eslint-plugin-storybook": "^0.6.11",
148
146
  "file-loader": "^6.2.0",
149
147
  "husky": "^8.0.3",
148
+ "i18next": "21.6.16",
149
+ "i18next-browser-languagedetector": "6.1.2",
150
150
  "jest": "^29.5.0",
151
151
  "jest-environment-jsdom": "^29.5.0",
152
152
  "lint-staged": "^13.2.0",
@@ -157,7 +157,7 @@
157
157
  "react": "18.2.0",
158
158
  "react-dom": "18.2.0",
159
159
  "react-fast-compare": "^3.2.1",
160
- "react-i18next": "^12.2.0",
160
+ "react-i18next": "11.16.7",
161
161
  "sass": "^1.60.0",
162
162
  "sass-loader": "^13.2.2",
163
163
  "style-loader": "^3.3.2",