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

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.
@@ -13,7 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  import { StyleProvider } from '@ant-design/cssinjs';
14
14
  import { ConfigProvider as AntdConfigProvider } from 'antd';
15
15
  import React, { useEffect } from 'react';
16
- import { useTranslation } from 'react-i18next';
16
+ import { useTranslation, I18nextProvider } from 'react-i18next';
17
17
  // Constants
18
18
  import { THEME } from '@antscorp/antsomi-ui/es/constants';
19
19
  // Style
@@ -31,9 +31,10 @@ const ConfigProvider = props => {
31
31
  i18n.changeLanguage(locale);
32
32
  }
33
33
  }, [i18n, locale]);
34
- return (React.createElement(AntdConfigProvider, Object.assign({}, restOfProps),
35
- React.createElement(GlobalStyle, null),
36
- React.createElement(StyleProvider, { hashPriority: "high" }, children)));
34
+ return (React.createElement(I18nextProvider, { i18n: i18n },
35
+ React.createElement(AntdConfigProvider, Object.assign({}, restOfProps),
36
+ React.createElement(GlobalStyle, null),
37
+ React.createElement(StyleProvider, { hashPriority: "high" }, children))));
37
38
  };
38
39
  ConfigProvider.defaultProps = {
39
40
  theme: THEME,
@@ -13,6 +13,7 @@ interface GradientConfig {
13
13
  }
14
14
  interface GradientSettingProps {
15
15
  onChange?: (gradientConfig: GradientConfig) => void;
16
+ defaultValue?: GradientConfig;
16
17
  }
17
18
  export declare const GradientSetting: React.FC<GradientSettingProps>;
18
19
  export {};
@@ -1,6 +1,5 @@
1
1
  // Libraries
2
2
  import React, { useEffect, useState } from 'react';
3
- import { useTranslation } from 'react-i18next';
4
3
  // Components
5
4
  import { ColorSetting, Select, SettingWrapper, SliderWithInputNumber, } from '@antscorp/antsomi-ui/es/components/molecules';
6
5
  // Utils
@@ -16,12 +15,12 @@ const DEFAULT_GRADIENTS = [
16
15
  { gradientColor: '#D11A66', gradientColorLocation: 0 },
17
16
  { gradientColor: '#FFBD64', gradientColorLocation: 50 },
18
17
  ];
19
- export const GradientSetting = ({ onChange }) => {
20
- const { t } = useTranslation();
21
- const [gradients, setGradients] = useState(DEFAULT_GRADIENTS);
22
- const [gradientType, setGradientType] = useState('linear-gradient');
23
- const [radialPosition, setRadialPosition] = useState('center center');
24
- const [linearAngle, setLinearAngle] = useState(90);
18
+ export const GradientSetting = ({ onChange, defaultValue }) => {
19
+ const { gradientType: defaultGradientType, gradients: defaultGradients, linearAngle: defaultLinearAngle, radialPosition: defaultRadialPosition, } = defaultValue || {};
20
+ const [gradients, setGradients] = useState(defaultGradients || DEFAULT_GRADIENTS);
21
+ const [gradientType, setGradientType] = useState(defaultGradientType || 'linear-gradient');
22
+ const [radialPosition, setRadialPosition] = useState(defaultRadialPosition || 'center center');
23
+ const [linearAngle, setLinearAngle] = useState(defaultLinearAngle || 90);
25
24
  useEffect(() => {
26
25
  onChange && onChange({ gradients, gradientType, radialPosition, linearAngle });
27
26
  // eslint-disable-next-line react-hooks/exhaustive-deps
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.2-beta.26",
3
+ "version": "1.3.2-beta.28",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",