@antscorp/antsomi-ui 1.3.4 → 1.3.5
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.
- package/es/assets/css/main.scss +4 -0
- package/es/components/atoms/Flex/Flex.d.ts +2 -0
- package/es/components/atoms/Flex/Flex.js +1 -0
- package/es/components/atoms/Flex/index.d.ts +1 -0
- package/es/components/atoms/Flex/index.js +1 -0
- package/es/components/atoms/Input/Input.d.ts +11 -3
- package/es/components/atoms/Input/Input.js +3 -0
- package/es/components/atoms/Slider/index.d.ts +2 -1
- package/es/components/atoms/Slider/index.js +9 -16
- package/es/components/atoms/SliderV2/index.d.ts +5 -0
- package/es/components/atoms/SliderV2/index.js +23 -0
- package/es/components/atoms/Spin/Spin.d.ts +2 -1
- package/es/components/atoms/index.d.ts +3 -0
- package/es/components/atoms/index.js +3 -0
- package/es/components/common/ConfigProvider/ConfigProvider.d.ts +1 -0
- package/es/components/common/ConfigProvider/ConfigProvider.js +1 -0
- package/es/components/common/ConfigProvider/GlobalStyle.js +38 -1
- package/es/components/icons/ArrowGrowIcon.d.ts +2 -1
- package/es/components/icons/AudioRecordIcon.d.ts +2 -1
- package/es/components/icons/BugIcon.d.ts +2 -1
- package/es/components/icons/CameraIcon.d.ts +2 -1
- package/es/components/icons/CaptureIcon.d.ts +2 -1
- package/es/components/icons/CheckSlimIcon.d.ts +2 -1
- package/es/components/icons/CloseIcon.d.ts +2 -1
- package/es/components/icons/CommentIcon.d.ts +2 -1
- package/es/components/icons/EventIcon.d.ts +2 -1
- package/es/components/icons/FreeDrawIcon.d.ts +2 -1
- package/es/components/icons/GPTIcon.d.ts +2 -1
- package/es/components/icons/GPTIconV2.d.ts +2 -1
- package/es/components/icons/GPTIconV3.d.ts +2 -1
- package/es/components/icons/HighlightIcon.d.ts +2 -1
- package/es/components/icons/IdeaIcon.d.ts +2 -1
- package/es/components/icons/InvisibleIcon.d.ts +2 -1
- package/es/components/icons/MuteIcon.d.ts +2 -1
- package/es/components/icons/OpenUrlIcon.d.ts +2 -1
- package/es/components/icons/PauseIcon.d.ts +2 -1
- package/es/components/icons/PlaneIcon.d.ts +2 -1
- package/es/components/icons/RequestIcon.d.ts +2 -1
- package/es/components/icons/StopRecordIcon.d.ts +2 -1
- package/es/components/icons/UserIcon.d.ts +2 -1
- package/es/components/icons/VerticalDotsIcon.d.ts +2 -1
- package/es/components/icons/WarningIcon.d.ts +2 -1
- package/es/components/molecules/CaptureScreen/CaptureScreen.d.ts +2 -1
- package/es/components/molecules/CaptureScreen/components/CommentBox/CommentBox.d.ts +2 -1
- package/es/components/molecules/CaptureScreen/components/Cursor/Cursor.d.ts +2 -1
- package/es/components/molecules/Collapse/Collapse.d.ts +3 -3
- package/es/components/molecules/Collapse/Collapse.js +9 -0
- package/es/components/molecules/ColorPicker/CustomPicker/index.js +9 -18
- package/es/components/molecules/ColorPicker/CustomPicker/styled.d.ts +5 -1
- package/es/components/molecules/ColorPicker/CustomPicker/styled.js +14 -3
- package/es/components/molecules/ColorPicker/index.js +3 -3
- package/es/components/molecules/ColorSetting/index.js +3 -3
- package/es/components/molecules/FontFamilySelect/constants.d.ts +307 -0
- package/es/components/molecules/FontFamilySelect/constants.js +257 -0
- package/es/components/molecules/FontFamilySelect/index.d.ts +17 -0
- package/es/components/molecules/FontFamilySelect/index.js +53 -0
- package/es/components/molecules/FontSetting/constants.d.ts +3 -0
- package/es/components/molecules/FontSetting/constants.js +22 -0
- package/es/components/molecules/FontSetting/index.d.ts +24 -0
- package/es/components/molecules/FontSetting/index.js +54 -0
- package/es/components/molecules/FontSetting/types.d.ts +22 -0
- package/es/components/molecules/FontSetting/types.js +1 -0
- package/es/components/molecules/FontWeightSelect/constants.d.ts +28 -0
- package/es/components/molecules/FontWeightSelect/constants.js +11 -0
- package/es/components/molecules/FontWeightSelect/index.d.ts +9 -0
- package/es/components/molecules/FontWeightSelect/index.js +39 -0
- package/es/components/molecules/Form/Form.d.ts +1 -0
- package/es/components/molecules/Form/Form.js +1 -0
- package/es/components/molecules/Form/index.d.ts +1 -0
- package/es/components/molecules/Form/index.js +1 -0
- package/es/components/molecules/GradientSetting/index.d.ts +19 -2
- package/es/components/molecules/GradientSetting/index.js +52 -30
- package/es/components/molecules/GradientSetting/styled.d.ts +1 -0
- package/es/components/molecules/GradientSetting/styled.js +59 -0
- package/es/components/molecules/InputNumber/index.js +2 -2
- package/es/components/molecules/Modal/styled.d.ts +1 -1
- package/es/components/molecules/Select/Select.d.ts +3 -0
- package/es/components/molecules/Select/Select.js +23 -2
- package/es/components/molecules/Select/Test.d.ts +2 -1
- package/es/components/molecules/SettingWrapper/index.d.ts +1 -2
- package/es/components/molecules/SettingWrapperPopover/index.d.ts +16 -0
- package/es/components/molecules/SettingWrapperPopover/index.js +17 -0
- package/es/components/molecules/TextDecorationSelect/constants.d.ts +19 -0
- package/es/components/molecules/TextDecorationSelect/constants.js +26 -0
- package/es/components/molecules/TextDecorationSelect/index.d.ts +15 -0
- package/es/components/molecules/TextDecorationSelect/index.js +45 -0
- package/es/components/molecules/TextTransformSelect/constants.d.ts +13 -0
- package/es/components/molecules/TextTransformSelect/constants.js +19 -0
- package/es/components/molecules/TextTransformSelect/index.d.ts +9 -0
- package/es/components/molecules/TextTransformSelect/index.js +39 -0
- package/es/components/molecules/TreeSelect/TreeSelect.d.ts +1 -1
- package/es/components/molecules/UploadImage/MediaIcon.d.ts +2 -1
- package/es/components/molecules/index.d.ts +8 -0
- package/es/components/molecules/index.js +7 -0
- package/es/constants/storybook.d.ts +2 -1
- package/es/constants/theme.js +25 -3
- package/es/test.d.ts +2 -1
- package/es/test.js +26 -39
- package/package.json +5 -5
- package/dist/0173b5993573afa04880.woff +0 -0
- package/dist/0dfb9214dfd945cd7290.png +0 -1
- package/dist/2883cad25a2b4e87ce5f.eot +0 -0
- package/dist/4f54a37971347e3d7122.png +0 -1
- package/dist/574b7bee0563a9fe9a29.png +0 -1
- package/dist/6b586356e837581204dc.svg +0 -1
- package/dist/72eec5c1c786b45a667f.ttf +0 -0
- package/dist/bc6bf11c6f5e6743aa4c.png +0 -1
- package/dist/dbc405edd6e0806efbc9.svg +0 -1
- package/dist/e32f09119052a55cce3c.png +0 -1
- package/dist/e3851b9384a984c6fdb5.png +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.LICENSE.txt +0 -69
- package/dist/main.css +0 -68
- package/dist/public/icons/2d496b55d85a9545d7311c073af442bb.png +0 -0
- package/dist/public/icons/2fbb4e0927d18e3f8e5c6511ab88d5b3.png +0 -0
- package/dist/public/icons/725a52bd91a3ce534b10833df510e5fa.png +0 -0
- package/dist/public/icons/7d037e0b378e87a82804443636cd0e13.svg +0 -346
- package/dist/public/icons/90553767e0a05b9585a54797cfd9ce51.png +0 -0
- package/dist/public/icons/bb64e23a1ff390a416d765ee556096ab.svg +0 -87
- package/dist/public/icons/d327b24e9c5d8f486f08d253aab58ce6.png +0 -0
- package/dist/public/icons/f1cf266d0a0a53ce07f2dbb859869b7a.png +0 -0
- package/dist/public/icons/placeholder-image.png +0 -0
- package/dist/public/icons/transparent.svg +0 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
/* Components */
|
|
3
|
+
import { Space, Switch } from '../../atoms';
|
|
4
|
+
import { ColorSetting } from '../ColorSetting';
|
|
5
|
+
import { SliderWithInputNumber } from '../SliderWithInputNumber';
|
|
6
|
+
import { SettingWrapper } from '../SettingWrapper';
|
|
7
|
+
import { SettingWrapperPopover } from '../SettingWrapperPopover';
|
|
8
|
+
import { FontFamilySelect } from '../FontFamilySelect';
|
|
9
|
+
import { FontWeightSelect } from '../FontWeightSelect';
|
|
10
|
+
import { TextTransformSelect } from '../TextTransformSelect';
|
|
11
|
+
import { TextDecorationSelect } from '../TextDecorationSelect';
|
|
12
|
+
import { FONT_SETTING_DEFAULT, FONT_STYLE_DEFAULT } from './constants';
|
|
13
|
+
export const FontSettingEdit = ({ settings, styles, showSettings, onChange, }) => {
|
|
14
|
+
const handleChange = (setting, style) => {
|
|
15
|
+
if (typeof onChange === 'function') {
|
|
16
|
+
const newSettings = Object.assign(Object.assign({}, settings), setting);
|
|
17
|
+
const newStyles = Object.assign(Object.assign({}, styles), style);
|
|
18
|
+
onChange(newSettings, newStyles);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const settingMap = useMemo(() => ({
|
|
22
|
+
fontFamily: (React.createElement(FontFamilySelect, { label: "Font Family", value: settings === null || settings === void 0 ? void 0 : settings.fontFamily, onChange: fontFamily => handleChange({ fontFamily }, { fontFamily }) })),
|
|
23
|
+
color: (React.createElement(ColorSetting, { label: "Font Color", color: settings === null || settings === void 0 ? void 0 : settings.fontColor, onChange: fontColor => handleChange({ fontColor }, { color: fontColor }) })),
|
|
24
|
+
fontSize: (React.createElement(SettingWrapper, { label: "Font Size", vertical: true },
|
|
25
|
+
React.createElement(SliderWithInputNumber, { value: typeof (settings === null || settings === void 0 ? void 0 : settings.fontSize) !== 'undefined' ? +settings.fontSize : 0, onAfterChange: fontSize => handleChange({ fontSize }, { fontSize }) }))),
|
|
26
|
+
fontWeight: (React.createElement(FontWeightSelect, { label: "Font Weight", value: settings === null || settings === void 0 ? void 0 : settings.fontWeight, onChange: fontWeight => handleChange({ fontWeight }, { fontWeight }) })),
|
|
27
|
+
lineHeight: (React.createElement(SettingWrapper, { label: "Line Height", vertical: true },
|
|
28
|
+
React.createElement(SliderWithInputNumber, { defaultValue: typeof (settings === null || settings === void 0 ? void 0 : settings.lineHeight) !== 'undefined' ? +settings.lineHeight : 0, min: 1, max: 5, step: 0.1, onAfterChange: lineHeight => handleChange({ lineHeight }, { lineHeight }) }))),
|
|
29
|
+
letterSpacing: (React.createElement(SettingWrapper, { label: "Letter Spacing", vertical: true },
|
|
30
|
+
React.createElement(SliderWithInputNumber, { defaultValue: typeof (settings === null || settings === void 0 ? void 0 : settings.letterSpacing) !== 'undefined' ? +settings.letterSpacing : 0, min: -10, max: 10, onAfterChange: letterSpacing => handleChange({ letterSpacing }, { letterSpacing }) }))),
|
|
31
|
+
textTransform: (React.createElement(TextTransformSelect, { label: "Text Transform", value: settings === null || settings === void 0 ? void 0 : settings.textTransform, onChange: textTransform => handleChange({ textTransform }, { textTransform }) })),
|
|
32
|
+
textDecoration: (React.createElement(TextDecorationSelect, { label: "Text Decoration", value: settings === null || settings === void 0 ? void 0 : settings.textDecoration, onChange: textDecoration => handleChange({ textDecoration }, { textDecoration }) })),
|
|
33
|
+
italic: (React.createElement(SettingWrapper, { label: "Font Style Italic" },
|
|
34
|
+
React.createElement(Switch, { checked: settings === null || settings === void 0 ? void 0 : settings.fontItalic, onChange: fontItalic => handleChange({ fontItalic }, { fontStyle: fontItalic ? 'italic' : 'normal' }) }))),
|
|
35
|
+
}),
|
|
36
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
|
+
[settings]);
|
|
38
|
+
const filteredSetting = useMemo(() => {
|
|
39
|
+
if (!showSettings || (showSettings === null || showSettings === void 0 ? void 0 : showSettings.length) === 0) {
|
|
40
|
+
return Object.keys(settingMap).map(keySetting => settingMap[keySetting]);
|
|
41
|
+
}
|
|
42
|
+
return showSettings.map(keySetting => settingMap[keySetting]);
|
|
43
|
+
}, [showSettings, settingMap]);
|
|
44
|
+
return React.createElement(Space, { direction: "vertical" }, filteredSetting);
|
|
45
|
+
};
|
|
46
|
+
export const FontSetting = (props) => {
|
|
47
|
+
const { label, settings, styles, wrapperProps, popoverProps, childrenProps, showSettings, onChange, } = props;
|
|
48
|
+
return (React.createElement(SettingWrapperPopover, { label: label !== null && label !== void 0 ? label : 'Font Settings', popoverProps: Object.assign({ overlayStyle: { top: 0 }, placement: 'bottomRight' }, popoverProps), wrapperProps: Object.assign({ containerStyle: { minWidth: '288px' } }, wrapperProps) },
|
|
49
|
+
React.createElement(FontSettingEdit, Object.assign({ settings: settings, styles: styles, showSettings: showSettings, onChange: onChange }, childrenProps))));
|
|
50
|
+
};
|
|
51
|
+
FontSetting.defaultProps = {
|
|
52
|
+
settings: FONT_SETTING_DEFAULT,
|
|
53
|
+
styles: FONT_STYLE_DEFAULT,
|
|
54
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type TFontSettings = {
|
|
2
|
+
fontFamily: string;
|
|
3
|
+
fontColor: string;
|
|
4
|
+
fontSize: string | number;
|
|
5
|
+
fontWeight: string | number;
|
|
6
|
+
lineHeight: string | number;
|
|
7
|
+
letterSpacing: string | number;
|
|
8
|
+
textTransform: string | number;
|
|
9
|
+
textDecoration: string;
|
|
10
|
+
fontItalic: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type TFontStyles = {
|
|
13
|
+
fontFamily: string;
|
|
14
|
+
color: string;
|
|
15
|
+
fontSize: string | number;
|
|
16
|
+
fontWeight: string | number;
|
|
17
|
+
lineHeight: string | number;
|
|
18
|
+
letterSpacing: string | number;
|
|
19
|
+
textTransform: string | number;
|
|
20
|
+
textDecoration: string;
|
|
21
|
+
fontStyle: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const OPTION_FONT_WEIGHT: readonly [{
|
|
2
|
+
readonly label: "Thin";
|
|
3
|
+
readonly value: "100";
|
|
4
|
+
}, {
|
|
5
|
+
readonly label: "Extra Light";
|
|
6
|
+
readonly value: "200";
|
|
7
|
+
}, {
|
|
8
|
+
readonly label: "Light";
|
|
9
|
+
readonly value: "300";
|
|
10
|
+
}, {
|
|
11
|
+
readonly label: "Regular";
|
|
12
|
+
readonly value: "400";
|
|
13
|
+
}, {
|
|
14
|
+
readonly label: "Medium";
|
|
15
|
+
readonly value: "500";
|
|
16
|
+
}, {
|
|
17
|
+
readonly label: "Semi Bold";
|
|
18
|
+
readonly value: "600";
|
|
19
|
+
}, {
|
|
20
|
+
readonly label: "Bold";
|
|
21
|
+
readonly value: "700";
|
|
22
|
+
}, {
|
|
23
|
+
readonly label: "Extra Bold";
|
|
24
|
+
readonly value: "800";
|
|
25
|
+
}, {
|
|
26
|
+
readonly label: "Black";
|
|
27
|
+
readonly value: "900";
|
|
28
|
+
}];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const OPTION_FONT_WEIGHT = [
|
|
2
|
+
{ label: 'Thin', value: '100' },
|
|
3
|
+
{ label: 'Extra Light', value: '200' },
|
|
4
|
+
{ label: 'Light', value: '300' },
|
|
5
|
+
{ label: 'Regular', value: '400' },
|
|
6
|
+
{ label: 'Medium', value: '500' },
|
|
7
|
+
{ label: 'Semi Bold', value: '600' },
|
|
8
|
+
{ label: 'Bold', value: '700' },
|
|
9
|
+
{ label: 'Extra Bold', value: '800' },
|
|
10
|
+
{ label: 'Black', value: '900' },
|
|
11
|
+
];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectProps } from '../Select';
|
|
3
|
+
import { OPTION_FONT_WEIGHT } from './constants';
|
|
4
|
+
export type FontWeightSelectProps = Omit<SelectProps, 'onChange'> & {
|
|
5
|
+
label?: string;
|
|
6
|
+
showOptions?: (typeof OPTION_FONT_WEIGHT)[number]['label'][];
|
|
7
|
+
onChange?: (family: string) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const FontWeightSelect: React.FC<FontWeightSelectProps>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
13
|
+
import { Select } from '../Select';
|
|
14
|
+
import { SettingWrapper } from '../SettingWrapper';
|
|
15
|
+
import { OPTION_FONT_WEIGHT } from './constants';
|
|
16
|
+
export const FontWeightSelect = props => {
|
|
17
|
+
const { defaultValue, label, value, showOptions, onChange } = props, selectProps = __rest(props, ["defaultValue", "label", "value", "showOptions", "onChange"]);
|
|
18
|
+
const [selected, setSelected] = useState(defaultValue || value);
|
|
19
|
+
const fontWeightOptions = useMemo(() => {
|
|
20
|
+
let draftFontFamily = [...OPTION_FONT_WEIGHT];
|
|
21
|
+
if (showOptions === null || showOptions === void 0 ? void 0 : showOptions.length) {
|
|
22
|
+
draftFontFamily = OPTION_FONT_WEIGHT.filter(({ label }) => showOptions.some(font => font === label));
|
|
23
|
+
}
|
|
24
|
+
return draftFontFamily;
|
|
25
|
+
}, [showOptions]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setSelected(value === null || value === void 0 ? void 0 : value.toString());
|
|
28
|
+
}, [value]);
|
|
29
|
+
const handleChange = (value) => {
|
|
30
|
+
if (onChange && typeof onChange === 'function') {
|
|
31
|
+
onChange(value);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return (React.createElement(SettingWrapper, { label: label !== null && label !== void 0 ? label : '', containerStyle: { width: '100%' }, vertical: true },
|
|
35
|
+
React.createElement(Select, Object.assign({ value: selected, options: [...fontWeightOptions], style: { fontFamily: value, width: '100%' }, onChange: select => {
|
|
36
|
+
setSelected(select);
|
|
37
|
+
handleChange(select);
|
|
38
|
+
}, showSearch: true }, selectProps))));
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Form } from 'antd';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Form } from 'antd';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Form } from './Form';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Form } from './Form';
|
|
@@ -5,15 +5,32 @@ interface GradientColor {
|
|
|
5
5
|
gradientColorLocation: number;
|
|
6
6
|
}
|
|
7
7
|
type PositionValue = (typeof POSITION)[keyof typeof POSITION]['value'];
|
|
8
|
-
interface GradientConfig {
|
|
8
|
+
export interface GradientConfig {
|
|
9
9
|
gradients: GradientColor[];
|
|
10
10
|
gradientType: 'linear-gradient' | 'radial-gradient';
|
|
11
11
|
radialPosition: PositionValue;
|
|
12
12
|
linearAngle: number;
|
|
13
13
|
}
|
|
14
|
-
interface GradientSettingProps {
|
|
14
|
+
interface GradientSettingProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
15
15
|
onChange?: (gradientConfig: GradientConfig) => void;
|
|
16
|
+
/** Return full background css with gradient color
|
|
17
|
+
* * @example
|
|
18
|
+
* ```
|
|
19
|
+
* getCSSProperty={value => {
|
|
20
|
+
* // format of value is something like that: linear-gradient(90deg, rgb(209, 26, 102) 0%, rgb(255, 189, 100) 50%)
|
|
21
|
+
* setBackgroundProperty(value)
|
|
22
|
+
* }}
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
getCSSProperty?: (value: string) => void;
|
|
16
26
|
defaultValue?: GradientConfig;
|
|
27
|
+
/** Use to store color settings, if customColors undefine => hide preset colors
|
|
28
|
+
* @example
|
|
29
|
+
* ```
|
|
30
|
+
* customColors={['#646EFFDB', '#D11AB2']}
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
customColors?: string[];
|
|
17
34
|
}
|
|
18
35
|
export declare const GradientSetting: React.FC<GradientSettingProps>;
|
|
19
36
|
export {};
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
// Libraries
|
|
2
13
|
import React, { useEffect, useState } from 'react';
|
|
3
14
|
// Components
|
|
@@ -11,13 +22,15 @@ import { cloneDeep } from 'lodash';
|
|
|
11
22
|
import { GRADIENT_TYPE, POSITION } from '@antscorp/antsomi-ui/es/constants';
|
|
12
23
|
import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
|
|
13
24
|
import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
25
|
+
import { GradientSettingWrapper } from './styled';
|
|
14
26
|
const GRADIENT_MIN = 2;
|
|
15
27
|
const GRADIENT_MAX = 5;
|
|
16
28
|
const DEFAULT_GRADIENTS = [
|
|
17
29
|
{ gradientColor: '#D11A66', gradientColorLocation: 0 },
|
|
18
30
|
{ gradientColor: '#FFBD64', gradientColorLocation: 50 },
|
|
19
31
|
];
|
|
20
|
-
export const GradientSetting =
|
|
32
|
+
export const GradientSetting = props => {
|
|
33
|
+
const { defaultValue, customColors, className, onChange, getCSSProperty } = props, rest = __rest(props, ["defaultValue", "customColors", "className", "onChange", "getCSSProperty"]);
|
|
21
34
|
const { gradientType: defaultGradientType, gradients: defaultGradients, linearAngle: defaultLinearAngle, radialPosition: defaultRadialPosition, } = defaultValue || {};
|
|
22
35
|
// const { t } = useTranslation();
|
|
23
36
|
const { t } = i18nInstance;
|
|
@@ -26,40 +39,49 @@ export const GradientSetting = ({ onChange, defaultValue }) => {
|
|
|
26
39
|
const [radialPosition, setRadialPosition] = useState(defaultRadialPosition || 'center center');
|
|
27
40
|
const [linearAngle, setLinearAngle] = useState(defaultLinearAngle || 90);
|
|
28
41
|
useEffect(() => {
|
|
29
|
-
onChange
|
|
42
|
+
if (onChange) {
|
|
43
|
+
onChange({ gradients, gradientType, radialPosition, linearAngle });
|
|
44
|
+
}
|
|
45
|
+
if (getCSSProperty) {
|
|
46
|
+
const prefixGradient = gradientType === 'linear-gradient'
|
|
47
|
+
? `${linearAngle}deg`
|
|
48
|
+
: radialPosition !== 'center center'
|
|
49
|
+
? `circle at ${radialPosition}`
|
|
50
|
+
: 'circle';
|
|
51
|
+
const gradientColor = gradients === null || gradients === void 0 ? void 0 : gradients.map(item => `${item.gradientColor} ${item.gradientColorLocation}%`).join(', ');
|
|
52
|
+
const gradientConfig = `${gradientType}(${prefixGradient}, ${gradientColor})`;
|
|
53
|
+
getCSSProperty(gradientConfig);
|
|
54
|
+
}
|
|
30
55
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
56
|
}, [JSON.stringify(gradients), gradientType, radialPosition, linearAngle]);
|
|
32
|
-
return (React.createElement(
|
|
33
|
-
React.createElement(SettingWrapper, { className: "
|
|
34
|
-
React.createElement(Select, {
|
|
35
|
-
gradientType === GRADIENT_TYPE.LINEAR.value ? (React.createElement(SliderWithInputNumber, { className: "
|
|
36
|
-
React.createElement(Select, {
|
|
57
|
+
return (React.createElement(GradientSettingWrapper, Object.assign({ className: className || '' }, rest),
|
|
58
|
+
React.createElement(SettingWrapper, { className: "setting-container", label: t(translations.gradientStyle) },
|
|
59
|
+
React.createElement(Select, { options: Object.values(GRADIENT_TYPE), value: gradientType, onChange: value => setGradientType(value) })),
|
|
60
|
+
gradientType === GRADIENT_TYPE.LINEAR.value ? (React.createElement(SliderWithInputNumber, { className: "setting-container", label: t(translations.angle), min: 0, max: 360, value: linearAngle, onAfterChange: value => setLinearAngle(value) })) : (React.createElement(SettingWrapper, { className: "setting-container", label: t(translations.position) },
|
|
61
|
+
React.createElement(Select, { options: Object.values(POSITION), value: radialPosition, onChange: value => setRadialPosition(value) }))),
|
|
37
62
|
Array.isArray(gradients) && gradients.length
|
|
38
63
|
? gradients.map((gradient, index) => {
|
|
39
64
|
const { gradientColor, gradientColorLocation } = gradient;
|
|
40
|
-
return (React.createElement("div", { className: "
|
|
41
|
-
React.createElement(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
61
|
-
} }))),
|
|
62
|
-
(gradients === null || gradients === void 0 ? void 0 : gradients.length) > GRADIENT_MIN && (React.createElement(Icon, { type: "icon-ants-outline-delete", className: "ants-text-primary ants-cursor-pointer", style: { alignSelf: 'flex-end', marginBottom: '10px', fontSize: '16px' }, onClick: () => {
|
|
65
|
+
return (React.createElement("div", { className: "color-setting__controller", key: index },
|
|
66
|
+
React.createElement(ColorSetting, { labelClassName: "color-picker__label", label: t(translations.gradientColor, {
|
|
67
|
+
name: t(translations.ordinalText[mapNumberToOrdinalText(index + 1)]),
|
|
68
|
+
}), color: gradientColor, positionInput: "right", onChange: color => {
|
|
69
|
+
setGradients(prev => {
|
|
70
|
+
const clonePrev = cloneDeep(prev);
|
|
71
|
+
clonePrev[index].gradientColor = color;
|
|
72
|
+
return clonePrev;
|
|
73
|
+
});
|
|
74
|
+
}, customColors: customColors }),
|
|
75
|
+
React.createElement(SliderWithInputNumber, { label: t(translations.gradientLocation, {
|
|
76
|
+
name: t(translations.ordinalText[mapNumberToOrdinalText(index + 1)]),
|
|
77
|
+
}), min: 0, max: 100, value: gradientColorLocation, onAfterChange: color => {
|
|
78
|
+
setGradients(prev => {
|
|
79
|
+
const clonePrev = cloneDeep(prev);
|
|
80
|
+
clonePrev[index].gradientColorLocation = color;
|
|
81
|
+
return clonePrev;
|
|
82
|
+
});
|
|
83
|
+
} }),
|
|
84
|
+
(gradients === null || gradients === void 0 ? void 0 : gradients.length) > GRADIENT_MIN && (React.createElement(Icon, { type: "icon-ants-outline-delete", onClick: () => {
|
|
63
85
|
const clonePrev = cloneDeep(gradients);
|
|
64
86
|
clonePrev.splice(index, 1);
|
|
65
87
|
setGradients(clonePrev);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GradientSettingWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export const GradientSettingWrapper = styled.div `
|
|
3
|
+
.setting-container {
|
|
4
|
+
margin-top: 15px;
|
|
5
|
+
|
|
6
|
+
& .antsomi-select {
|
|
7
|
+
width: 112px;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
& > button {
|
|
12
|
+
margin-top: 15px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.color-setting__controller {
|
|
16
|
+
& > i {
|
|
17
|
+
align-self: flex-end;
|
|
18
|
+
margin-bottom: 10px;
|
|
19
|
+
font-size: 16px;
|
|
20
|
+
color: var(--primary-color);
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
display: flex;
|
|
25
|
+
gap: 10px;
|
|
26
|
+
|
|
27
|
+
width: 100%;
|
|
28
|
+
margin-top: 15px;
|
|
29
|
+
|
|
30
|
+
/* Slider css selector */
|
|
31
|
+
& > div:first-child ~ div {
|
|
32
|
+
flex: 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Color picker select */
|
|
36
|
+
& > div:first-child {
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
align-items: flex-start;
|
|
39
|
+
|
|
40
|
+
& .color-picker__label {
|
|
41
|
+
color: var(--text-base-color) !important;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
& .antsomi-color-picker,
|
|
45
|
+
& .antsomi-popover-button {
|
|
46
|
+
margin: 0 !important;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
& .antsomi-color-picker {
|
|
50
|
+
align-items: center;
|
|
51
|
+
gap: 10px;
|
|
52
|
+
|
|
53
|
+
input {
|
|
54
|
+
padding: 5px 6px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
@@ -19,7 +19,7 @@ import { getPreventKeyboardAction } from '@antscorp/antsomi-ui/es/utils/web';
|
|
|
19
19
|
import { handleError } from '@antscorp/antsomi-ui/es/utils';
|
|
20
20
|
const PATH = '@antscorp/antsomi-ui/es/app/components/molecules/InputNumber/index.tsx';
|
|
21
21
|
export const InputNumber = props => {
|
|
22
|
-
const { label, required, focused, errorMsg, onChange } = props, restOf = __rest(props, ["label", "required", "focused", "errorMsg", "onChange"]);
|
|
22
|
+
const { label, required, focused, errorMsg, onChange, className } = props, restOf = __rest(props, ["label", "required", "focused", "errorMsg", "onChange", "className"]);
|
|
23
23
|
const [isFocused, setFocused] = useState(false);
|
|
24
24
|
const requiredMsg = useMemo(() => {
|
|
25
25
|
let msg = '';
|
|
@@ -65,7 +65,7 @@ export const InputNumber = props => {
|
|
|
65
65
|
if (props.disableUndo) {
|
|
66
66
|
listDisableActions.push('undo');
|
|
67
67
|
}
|
|
68
|
-
return (React.createElement("div",
|
|
68
|
+
return (React.createElement("div", { className: className },
|
|
69
69
|
label && renderRequiredLabel(label),
|
|
70
70
|
React.createElement(AntdInputNumber, Object.assign({}, restOf, { className: "--show-handler", required: required, onChange: onChangeInputNumber, onBlur: e => {
|
|
71
71
|
if (!focused) {
|
|
@@ -10,6 +10,6 @@ export declare const StyledModal: import("styled-components").StyledComponent<im
|
|
|
10
10
|
useModal: typeof import("antd/es/modal/useModal").default;
|
|
11
11
|
destroyAll: () => void;
|
|
12
12
|
config: typeof import("antd/es/modal/confirm").modalGlobalConfig;
|
|
13
|
-
_InternalPanelDoNotUseOrYouWillBeFired: (props: import("antd/es/modal/PurePanel").PurePanelProps) =>
|
|
13
|
+
_InternalPanelDoNotUseOrYouWillBeFired: (props: import("antd/es/modal/PurePanel").PurePanelProps) => import("react").JSX.Element;
|
|
14
14
|
}, any, CustomModalProps, never>;
|
|
15
15
|
export declare const WrapperSpin: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { SelectProps as AntdSelectProps } from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { TextProps } from '../../atoms/Text';
|
|
3
4
|
export interface SelectProps extends AntdSelectProps {
|
|
5
|
+
label?: string | React.ReactNode;
|
|
6
|
+
labelProps?: TextProps;
|
|
4
7
|
}
|
|
5
8
|
declare const Select: (<ValueType = any, OptionType extends import("rc-select/lib/Select").DefaultOptionType | import("rc-select/lib/Select").BaseOptionType = import("rc-select/lib/Select").DefaultOptionType>(props: AntdSelectProps<ValueType, OptionType> & {
|
|
6
9
|
children?: React.ReactNode;
|
|
@@ -1,11 +1,26 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
var _a;
|
|
2
13
|
// Libraries
|
|
3
14
|
import { Select as AntdSelect } from 'antd';
|
|
4
15
|
import React from 'react';
|
|
16
|
+
// Components
|
|
17
|
+
import { Flex } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
18
|
+
import { Text } from '../../atoms/Text';
|
|
5
19
|
// Icons
|
|
6
20
|
import Icon from '@antscorp/icons';
|
|
7
21
|
// Constants
|
|
8
|
-
import { THEME } from '
|
|
22
|
+
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
23
|
+
// Styled
|
|
9
24
|
import { StyledTag, TagCloseBtn } from './styled';
|
|
10
25
|
const tagRender = (props) => {
|
|
11
26
|
const { label, closable, onClose } = props;
|
|
@@ -18,11 +33,17 @@ const tagRender = (props) => {
|
|
|
18
33
|
fontSize: 10,
|
|
19
34
|
} })) }, label));
|
|
20
35
|
};
|
|
21
|
-
const CustomSelect = props =>
|
|
36
|
+
const CustomSelect = props => {
|
|
37
|
+
const { label, labelProps } = props, rest = __rest(props, ["label", "labelProps"]);
|
|
38
|
+
return (React.createElement(Flex, { vertical: true, gap: 4 },
|
|
39
|
+
typeof label === 'string' ? React.createElement(Text, Object.assign({}, labelProps), label) : label,
|
|
40
|
+
React.createElement(AntdSelect, Object.assign({}, rest))));
|
|
41
|
+
};
|
|
22
42
|
const Select = CustomSelect;
|
|
23
43
|
Select.OptGroup = AntdSelect.OptGroup;
|
|
24
44
|
Select.Option = AntdSelect.Option;
|
|
25
45
|
Select.defaultProps = {
|
|
46
|
+
labelProps: { color: '#66666' },
|
|
26
47
|
suffixIcon: (React.createElement(Icon, { type: "icon-ants-expand-more", style: { fontSize: 16, color: (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.bw10 } })),
|
|
27
48
|
tagRender,
|
|
28
49
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
|
-
interface SettingWrapperProps {
|
|
2
|
+
export interface SettingWrapperProps {
|
|
3
3
|
label: string;
|
|
4
4
|
className?: string;
|
|
5
5
|
labelColor?: string;
|
|
@@ -10,4 +10,3 @@ interface SettingWrapperProps {
|
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
}
|
|
12
12
|
export declare const SettingWrapper: React.FC<SettingWrapperProps>;
|
|
13
|
-
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SettingWrapperProps } from '../SettingWrapper';
|
|
3
|
+
import { PopoverProps } from 'antd';
|
|
4
|
+
export type SettingWrapperPopoverProps = {
|
|
5
|
+
label: string;
|
|
6
|
+
wrapperProps?: Omit<SettingWrapperProps, 'label'>;
|
|
7
|
+
popoverProps?: Omit<PopoverProps, 'content'>;
|
|
8
|
+
iconPopover?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Renders a popover wrapper for a setting.
|
|
12
|
+
*
|
|
13
|
+
* @param {React.PropsWithChildren<SettingWrapperPopoverProps>} props - The props object containing the label, children, wrapperProps and popoverProps.
|
|
14
|
+
* @returns {React.ReactElement} The rendered popover wrapper.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SettingWrapperPopover: React.FC<React.PropsWithChildren<SettingWrapperPopoverProps>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SettingWrapper } from '../SettingWrapper';
|
|
3
|
+
import { Button, Icon, Popover } from '../../atoms';
|
|
4
|
+
/**
|
|
5
|
+
* Renders a popover wrapper for a setting.
|
|
6
|
+
*
|
|
7
|
+
* @param {React.PropsWithChildren<SettingWrapperPopoverProps>} props - The props object containing the label, children, wrapperProps and popoverProps.
|
|
8
|
+
* @returns {React.ReactElement} The rendered popover wrapper.
|
|
9
|
+
*/
|
|
10
|
+
export const SettingWrapperPopover = ({ label, children, wrapperProps, popoverProps, iconPopover, }) => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
return (React.createElement(SettingWrapper, Object.assign({ label: label, labelStyle: Object.assign({ fontWeight: 'bold' }, ((_a = wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.labelStyle) !== null && _a !== void 0 ? _a : {})) }, (wrapperProps !== null && wrapperProps !== void 0 ? wrapperProps : {})),
|
|
13
|
+
React.createElement(Popover, Object.assign({ content: children, trigger: ['click'], overlayInnerStyle: Object.assign({ padding: '12px 16px', minWidth: 288, maxHeight: '90vh', overflow: 'auto' }, ((_b = popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.overlayInnerStyle) !== null && _b !== void 0 ? _b : {})) }, (popoverProps !== null && popoverProps !== void 0 ? popoverProps : {})), iconPopover)));
|
|
14
|
+
};
|
|
15
|
+
SettingWrapperPopover.defaultProps = {
|
|
16
|
+
iconPopover: React.createElement(Button, { icon: React.createElement(Icon, { type: "icon-ants-edit-2" }), type: "text" }),
|
|
17
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const OPTION_TEXT_DECORATION: readonly [{
|
|
2
|
+
readonly label: "None";
|
|
3
|
+
readonly value: "none";
|
|
4
|
+
}, {
|
|
5
|
+
readonly label: "Underline";
|
|
6
|
+
readonly value: "underline";
|
|
7
|
+
}, {
|
|
8
|
+
readonly label: "Overline";
|
|
9
|
+
readonly value: "overline";
|
|
10
|
+
}, {
|
|
11
|
+
readonly label: "Line Through";
|
|
12
|
+
readonly value: "line-through";
|
|
13
|
+
}, {
|
|
14
|
+
readonly label: "Underline - Overline";
|
|
15
|
+
readonly value: "underline overline";
|
|
16
|
+
}, {
|
|
17
|
+
readonly label: "Underline - Line Through";
|
|
18
|
+
readonly value: "underline line-through";
|
|
19
|
+
}];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const OPTION_TEXT_DECORATION = [
|
|
2
|
+
{
|
|
3
|
+
label: 'None',
|
|
4
|
+
value: 'none',
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
label: 'Underline',
|
|
8
|
+
value: 'underline',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
label: 'Overline',
|
|
12
|
+
value: 'overline',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: 'Line Through',
|
|
16
|
+
value: 'line-through',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: 'Underline - Overline',
|
|
20
|
+
value: 'underline overline',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: 'Underline - Line Through',
|
|
24
|
+
value: 'underline line-through',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectProps } from '../Select';
|
|
3
|
+
import { OPTION_TEXT_DECORATION } from './constants';
|
|
4
|
+
export type TextDecorationSelectProps = Omit<SelectProps, 'onChange'> & {
|
|
5
|
+
label?: string;
|
|
6
|
+
showOptions?: (typeof OPTION_TEXT_DECORATION)[number]['label'][];
|
|
7
|
+
onChange?: (textTransform: (typeof OPTION_TEXT_DECORATION)[number]['value']) => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Generates a function comment for the given function body.
|
|
11
|
+
*
|
|
12
|
+
* @param {TextDecorationSelectProps} props - the props for the TextDecorationSelect component
|
|
13
|
+
* @return {React.FC<TextDecorationSelectProps>} the TextDecorationSelect component
|
|
14
|
+
*/
|
|
15
|
+
export declare const TextDecorationSelect: React.FC<TextDecorationSelectProps>;
|