@antscorp/antsomi-ui 1.3.3 → 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.
Files changed (138) hide show
  1. package/es/assets/css/main.scss +4 -0
  2. package/es/components/atoms/Button/index.d.ts +1 -8
  3. package/es/components/atoms/Flex/Flex.d.ts +2 -0
  4. package/es/components/atoms/Flex/Flex.js +1 -0
  5. package/es/components/atoms/Flex/index.d.ts +1 -0
  6. package/es/components/atoms/Flex/index.js +1 -0
  7. package/es/components/atoms/Input/Input.d.ts +11 -3
  8. package/es/components/atoms/Input/Input.js +3 -0
  9. package/es/components/atoms/Popover/Popover.d.ts +1 -1
  10. package/es/components/atoms/Progress/Progress.d.ts +1 -1
  11. package/es/components/atoms/Radio/index.d.ts +3 -3
  12. package/es/components/atoms/Slider/index.d.ts +2 -1
  13. package/es/components/atoms/Slider/index.js +9 -16
  14. package/es/components/atoms/SliderV2/index.d.ts +5 -0
  15. package/es/components/atoms/SliderV2/index.js +23 -0
  16. package/es/components/atoms/Space/Space.d.ts +1 -1
  17. package/es/components/atoms/Spin/Spin.d.ts +2 -1
  18. package/es/components/atoms/Spin/styled.d.ts +1 -1
  19. package/es/components/atoms/Statistic/Statistic.d.ts +1 -4
  20. package/es/components/atoms/index.d.ts +3 -0
  21. package/es/components/atoms/index.js +3 -0
  22. package/es/components/common/ConfigProvider/ConfigProvider.d.ts +1 -0
  23. package/es/components/common/ConfigProvider/ConfigProvider.js +1 -0
  24. package/es/components/common/ConfigProvider/GlobalStyle.js +38 -1
  25. package/es/components/icons/ArrowGrowIcon.d.ts +2 -1
  26. package/es/components/icons/AudioRecordIcon.d.ts +2 -1
  27. package/es/components/icons/BugIcon.d.ts +2 -1
  28. package/es/components/icons/CameraIcon.d.ts +2 -1
  29. package/es/components/icons/CaptureIcon.d.ts +2 -1
  30. package/es/components/icons/CheckSlimIcon.d.ts +2 -1
  31. package/es/components/icons/CloseIcon.d.ts +2 -1
  32. package/es/components/icons/CommentIcon.d.ts +2 -1
  33. package/es/components/icons/EventIcon.d.ts +2 -1
  34. package/es/components/icons/FreeDrawIcon.d.ts +2 -1
  35. package/es/components/icons/GPTIcon.d.ts +2 -1
  36. package/es/components/icons/GPTIconV2.d.ts +2 -1
  37. package/es/components/icons/GPTIconV3.d.ts +2 -1
  38. package/es/components/icons/HighlightIcon.d.ts +2 -1
  39. package/es/components/icons/IdeaIcon.d.ts +2 -1
  40. package/es/components/icons/InvisibleIcon.d.ts +2 -1
  41. package/es/components/icons/MuteIcon.d.ts +2 -1
  42. package/es/components/icons/OpenUrlIcon.d.ts +2 -1
  43. package/es/components/icons/PauseIcon.d.ts +2 -1
  44. package/es/components/icons/PlaneIcon.d.ts +2 -1
  45. package/es/components/icons/RequestIcon.d.ts +2 -1
  46. package/es/components/icons/StopRecordIcon.d.ts +2 -1
  47. package/es/components/icons/UserIcon.d.ts +2 -1
  48. package/es/components/icons/VerticalDotsIcon.d.ts +2 -1
  49. package/es/components/icons/WarningIcon.d.ts +2 -1
  50. package/es/components/molecules/CaptureScreen/CaptureScreen.d.ts +2 -1
  51. package/es/components/molecules/CaptureScreen/components/CommentBox/CommentBox.d.ts +2 -1
  52. package/es/components/molecules/CaptureScreen/components/Cursor/Cursor.d.ts +2 -1
  53. package/es/components/molecules/Collapse/Collapse.d.ts +3 -3
  54. package/es/components/molecules/Collapse/Collapse.js +9 -0
  55. package/es/components/molecules/ColorPicker/CustomPicker/index.js +9 -18
  56. package/es/components/molecules/ColorPicker/CustomPicker/styled.d.ts +5 -1
  57. package/es/components/molecules/ColorPicker/CustomPicker/styled.js +14 -3
  58. package/es/components/molecules/ColorPicker/index.js +3 -3
  59. package/es/components/molecules/ColorSetting/index.js +3 -3
  60. package/es/components/molecules/ColorSetting/styled.d.ts +1 -8
  61. package/es/components/molecules/FontFamilySelect/constants.d.ts +307 -0
  62. package/es/components/molecules/FontFamilySelect/constants.js +257 -0
  63. package/es/components/molecules/FontFamilySelect/index.d.ts +17 -0
  64. package/es/components/molecules/FontFamilySelect/index.js +53 -0
  65. package/es/components/molecules/FontSetting/constants.d.ts +3 -0
  66. package/es/components/molecules/FontSetting/constants.js +22 -0
  67. package/es/components/molecules/FontSetting/index.d.ts +24 -0
  68. package/es/components/molecules/FontSetting/index.js +54 -0
  69. package/es/components/molecules/FontSetting/types.d.ts +22 -0
  70. package/es/components/molecules/FontSetting/types.js +1 -0
  71. package/es/components/molecules/FontWeightSelect/constants.d.ts +28 -0
  72. package/es/components/molecules/FontWeightSelect/constants.js +11 -0
  73. package/es/components/molecules/FontWeightSelect/index.d.ts +9 -0
  74. package/es/components/molecules/FontWeightSelect/index.js +39 -0
  75. package/es/components/molecules/Form/Form.d.ts +1 -0
  76. package/es/components/molecules/Form/Form.js +1 -0
  77. package/es/components/molecules/Form/index.d.ts +1 -0
  78. package/es/components/molecules/Form/index.js +1 -0
  79. package/es/components/molecules/GradientSetting/index.d.ts +19 -2
  80. package/es/components/molecules/GradientSetting/index.js +52 -30
  81. package/es/components/molecules/GradientSetting/styled.d.ts +1 -0
  82. package/es/components/molecules/GradientSetting/styled.js +59 -0
  83. package/es/components/molecules/IconSelection/styled.d.ts +1 -8
  84. package/es/components/molecules/InputNumber/index.js +2 -2
  85. package/es/components/molecules/Modal/Modal.d.ts +2 -2
  86. package/es/components/molecules/Modal/styled.d.ts +1 -1
  87. package/es/components/molecules/Popconfirm/Popconfirm.d.ts +1 -1
  88. package/es/components/molecules/Select/Select.d.ts +6 -4
  89. package/es/components/molecules/Select/Select.js +23 -2
  90. package/es/components/molecules/Select/Test.d.ts +2 -1
  91. package/es/components/molecules/SettingWrapper/index.d.ts +1 -2
  92. package/es/components/molecules/SettingWrapperPopover/index.d.ts +16 -0
  93. package/es/components/molecules/SettingWrapperPopover/index.js +17 -0
  94. package/es/components/molecules/TextDecorationSelect/constants.d.ts +19 -0
  95. package/es/components/molecules/TextDecorationSelect/constants.js +26 -0
  96. package/es/components/molecules/TextDecorationSelect/index.d.ts +15 -0
  97. package/es/components/molecules/TextDecorationSelect/index.js +45 -0
  98. package/es/components/molecules/TextTransformSelect/constants.d.ts +13 -0
  99. package/es/components/molecules/TextTransformSelect/constants.js +19 -0
  100. package/es/components/molecules/TextTransformSelect/index.d.ts +9 -0
  101. package/es/components/molecules/TextTransformSelect/index.js +39 -0
  102. package/es/components/molecules/TreeSelect/TreeSelect.d.ts +3 -4
  103. package/es/components/molecules/UploadImage/MediaIcon.d.ts +2 -1
  104. package/es/components/molecules/index.d.ts +8 -0
  105. package/es/components/molecules/index.js +7 -0
  106. package/es/components/organism/Help/styled.d.ts +6 -16
  107. package/es/components/organism/Table/ExplorePivotTable/styled.d.ts +1 -0
  108. package/es/constants/storybook.d.ts +2 -1
  109. package/es/constants/theme.js +25 -3
  110. package/es/test.d.ts +2 -1
  111. package/es/test.js +26 -39
  112. package/package.json +6 -5
  113. package/dist/0173b5993573afa04880.woff +0 -0
  114. package/dist/0dfb9214dfd945cd7290.png +0 -1
  115. package/dist/2883cad25a2b4e87ce5f.eot +0 -0
  116. package/dist/4f54a37971347e3d7122.png +0 -1
  117. package/dist/574b7bee0563a9fe9a29.png +0 -1
  118. package/dist/6b586356e837581204dc.svg +0 -1
  119. package/dist/72eec5c1c786b45a667f.ttf +0 -0
  120. package/dist/bc6bf11c6f5e6743aa4c.png +0 -1
  121. package/dist/dbc405edd6e0806efbc9.svg +0 -1
  122. package/dist/e32f09119052a55cce3c.png +0 -1
  123. package/dist/e3851b9384a984c6fdb5.png +0 -1
  124. package/dist/index.js +0 -2
  125. package/dist/index.js.LICENSE.txt +0 -69
  126. package/dist/main.css +0 -68
  127. package/dist/public/icons/2d496b55d85a9545d7311c073af442bb.png +0 -0
  128. package/dist/public/icons/2fbb4e0927d18e3f8e5c6511ab88d5b3.png +0 -0
  129. package/dist/public/icons/725a52bd91a3ce534b10833df510e5fa.png +0 -0
  130. package/dist/public/icons/7d037e0b378e87a82804443636cd0e13.svg +0 -346
  131. package/dist/public/icons/90553767e0a05b9585a54797cfd9ce51.png +0 -0
  132. package/dist/public/icons/bb64e23a1ff390a416d765ee556096ab.svg +0 -87
  133. package/dist/public/icons/d327b24e9c5d8f486f08d253aab58ce6.png +0 -0
  134. package/dist/public/icons/f1cf266d0a0a53ce07f2dbb859869b7a.png +0 -0
  135. package/dist/public/icons/placeholder-image.png +0 -0
  136. package/dist/public/icons/transparent.svg +0 -1
  137. package/es/components/atoms/Popover/styled.d.ts +0 -4
  138. package/es/components/atoms/Popover/styled.js +0 -5
@@ -0,0 +1,53 @@
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
+ // Libraries
13
+ import React, { useEffect, useMemo, useState } from 'react';
14
+ // Molecules
15
+ import { Select } from '../Select';
16
+ import { SettingWrapper } from '../SettingWrapper';
17
+ // Constants
18
+ import { OPTION_FONT_FAMILY } from './constants';
19
+ import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
20
+ /**
21
+ * Renders a select input for font family options.
22
+ *
23
+ * @param {FontFamilySelectProps} props - The props for the component.
24
+ * @return {ReactNode} The rendered React node.
25
+ */
26
+ export const FontFamilySelect = (props) => {
27
+ const { defaultValue, label, value, showOptions, onChange } = props, selectProps = __rest(props, ["defaultValue", "label", "value", "showOptions", "onChange"]);
28
+ const [selected, setSelected] = useState(defaultValue || value);
29
+ useEffect(() => {
30
+ setSelected(value);
31
+ }, [value]);
32
+ const { t } = i18nInstance;
33
+ const filteredFontFamilyOptions = useMemo(() => {
34
+ let filteredOptions = [...OPTION_FONT_FAMILY];
35
+ if (showOptions === null || showOptions === void 0 ? void 0 : showOptions.length) {
36
+ filteredOptions = OPTION_FONT_FAMILY.filter(({ value }) => showOptions.some(font => font === value));
37
+ }
38
+ return filteredOptions;
39
+ }, [showOptions]);
40
+ const handleChange = (value) => {
41
+ if (typeof onChange === 'function') {
42
+ onChange(value);
43
+ }
44
+ };
45
+ return (React.createElement(SettingWrapper, { label: label !== null && label !== void 0 ? label : '', containerStyle: { width: '100%' }, vertical: true },
46
+ React.createElement(Select, Object.assign({ value: selected, options: [...filteredFontFamilyOptions], style: { fontFamily: value, width: '100%' }, onChange: select => {
47
+ setSelected(select);
48
+ handleChange(select);
49
+ }, showSearch: true }, selectProps))));
50
+ };
51
+ FontFamilySelect.defaultProps = {
52
+ showOptions: [],
53
+ };
@@ -0,0 +1,3 @@
1
+ import { TFontSettings, TFontStyles } from './types';
2
+ export declare const FONT_SETTING_DEFAULT: TFontSettings;
3
+ export declare const FONT_STYLE_DEFAULT: TFontStyles;
@@ -0,0 +1,22 @@
1
+ export const FONT_SETTING_DEFAULT = {
2
+ fontColor: '#000000',
3
+ fontFamily: 'Roboto',
4
+ fontItalic: false,
5
+ fontSize: 14,
6
+ fontWeight: '400',
7
+ letterSpacing: 2,
8
+ lineHeight: 1.5,
9
+ textTransform: 'none',
10
+ textDecoration: 'none',
11
+ };
12
+ export const FONT_STYLE_DEFAULT = {
13
+ color: '#000000',
14
+ fontFamily: 'Roboto',
15
+ fontSize: 14,
16
+ fontWeight: '400',
17
+ lineHeight: 1.5,
18
+ letterSpacing: 2,
19
+ textTransform: 'none',
20
+ textDecoration: 'none',
21
+ fontStyle: 'normal',
22
+ };
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { PopoverProps } from 'antd';
3
+ import { SettingWrapperProps } from '../SettingWrapper';
4
+ import { TFontSettings, TFontStyles } from './types';
5
+ type TFontSettingOptions = 'fontFamily' | 'color' | 'fontSize' | 'fontWeight' | 'textTransform' | 'textDecoration' | 'italic' | 'lineHeight' | 'letterSpacing';
6
+ export type TFontSettingProps = {
7
+ label?: string;
8
+ settings: Partial<TFontSettings>;
9
+ styles: Partial<TFontStyles>;
10
+ showSettings?: TFontSettingOptions[];
11
+ wrapperProps?: Omit<SettingWrapperProps, 'label'>;
12
+ popoverProps?: Omit<PopoverProps, 'content'>;
13
+ childrenProps?: Omit<TFontSettingEditProps, 'settings' | 'styles' | 'onChange'>;
14
+ onChange?: (settings: Partial<TFontSettings>, styles: Partial<TFontStyles>) => void;
15
+ };
16
+ export type TFontSettingEditProps = {
17
+ settings: Partial<TFontSettings>;
18
+ styles: Partial<TFontStyles>;
19
+ showSettings?: TFontSettingOptions[];
20
+ onChange?: (settings: Partial<TFontSettings>, styles: Partial<TFontStyles>) => void;
21
+ };
22
+ export declare const FontSettingEdit: React.FC<TFontSettingEditProps>;
23
+ export declare const FontSetting: React.FC<TFontSettingProps>;
24
+ export {};
@@ -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 = ({ onChange, defaultValue }) => {
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 && onChange({ gradients, gradientType, radialPosition, linearAngle });
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(React.Fragment, null,
33
- React.createElement(SettingWrapper, { className: "ants-mb-[15px]", label: t(translations.gradientStyle) },
34
- React.createElement(Select, { className: "ants-w-[112px]", options: Object.values(GRADIENT_TYPE), value: gradientType, onChange: value => setGradientType(value) })),
35
- 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) },
36
- React.createElement(Select, { className: "ants-w-[112px]", options: Object.values(POSITION), value: radialPosition, onChange: value => setRadialPosition(value) }))),
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: "ants-flex ants-gap-x-2 ants-mb-[15px]", key: index },
41
- React.createElement("div", { className: "ants-grid md:ants-grid-cols-5 ants-grid-cols-1 ants-gap-y-5" },
42
- React.createElement("div", { className: "ants-col-span-2" },
43
- React.createElement(ColorSetting, { labelClassName: "!ants-text-cus-base", label: t(translations.gradientColor, {
44
- name: t(translations.ordinalText[mapNumberToOrdinalText(index + 1)]),
45
- }), color: gradientColor, positionInput: "right", onChange: color => {
46
- setGradients(prev => {
47
- const clonePrev = cloneDeep(prev);
48
- clonePrev[index].gradientColor = color;
49
- return clonePrev;
50
- });
51
- } })),
52
- React.createElement("div", { className: "ants-col-span-3" },
53
- React.createElement(SliderWithInputNumber, { label: t(translations.gradientLocation, {
54
- name: t(translations.ordinalText[mapNumberToOrdinalText(index + 1)]),
55
- }), min: 0, max: 100, value: gradientColorLocation, onAfterChange: color => {
56
- setGradients(prev => {
57
- const clonePrev = cloneDeep(prev);
58
- clonePrev[index].gradientColorLocation = color;
59
- return clonePrev;
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
+ `;
@@ -2,14 +2,7 @@
2
2
  export declare const IconSelectionWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const WrapperListRender: import("styled-components").StyledComponent<"div", any, {}, never>;
4
4
  export declare const WrapperListItemRender: import("styled-components").StyledComponent<"div", any, {}, never>;
5
- export declare const CustomButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Partial<{
6
- href: string;
7
- target?: string | undefined;
8
- onClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
9
- } & import("antd/es/button/button").BaseButtonProps & Omit<import("react").AnchorHTMLAttributes<HTMLAnchorElement | HTMLButtonElement>, "type" | "onClick"> & {
10
- htmlType?: "button" | "reset" | "submit" | undefined;
11
- onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
12
- } & Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "type" | "onClick">> & import("react").RefAttributes<HTMLElement>> & {
5
+ export declare const CustomButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").ButtonProps & import("react").RefAttributes<HTMLElement>> & {
13
6
  Group: import("react").FC<import("antd/es/button").ButtonGroupProps>;
14
7
  }, any, {}, never>;
15
8
  export declare const Overlay: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -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", null,
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) {
@@ -14,10 +14,10 @@ export declare const Modal: string & import("styled-components").StyledComponent
14
14
  useModal: typeof import("antd/es/modal/useModal").default;
15
15
  destroyAll: () => void;
16
16
  config: typeof import("antd/es/modal/confirm").modalGlobalConfig;
17
- _InternalPanelDoNotUseOrYouWillBeFired: React.FC<import("antd/es/modal/PurePanel").PurePanelProps>;
17
+ _InternalPanelDoNotUseOrYouWillBeFired: (props: import("antd/es/modal/PurePanel").PurePanelProps) => React.JSX.Element;
18
18
  }, any, import("./styled").CustomModalProps, never> & import("hoist-non-react-statics").NonReactStatics<React.FC<AntdModalProps> & import("antd/es/modal/confirm").ModalStaticFunctions & {
19
19
  useModal: typeof import("antd/es/modal/useModal").default;
20
20
  destroyAll: () => void;
21
21
  config: typeof import("antd/es/modal/confirm").modalGlobalConfig;
22
- _InternalPanelDoNotUseOrYouWillBeFired: React.FC<import("antd/es/modal/PurePanel").PurePanelProps>;
22
+ _InternalPanelDoNotUseOrYouWillBeFired: (props: import("antd/es/modal/PurePanel").PurePanelProps) => React.JSX.Element;
23
23
  }, {}> & React.FC<ModalProps>;
@@ -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: import("react").FC<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,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  export declare const Popconfirm: import("react").ForwardRefExoticComponent<import("antd").PopconfirmProps & import("react").RefAttributes<unknown>> & {
3
- _InternalPanelDoNotUseOrYouWillBeFired: typeof import("antd/es/popconfirm/PurePanel").default;
3
+ _InternalPanelDoNotUseOrYouWillBeFired: import("react").FC<import("antd/es/popconfirm/PurePanel").PurePanelProps>;
4
4
  };
@@ -1,15 +1,17 @@
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;
7
- } & {
8
- ref?: React.Ref<import("antd").RefSelectProps> | undefined;
9
- }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
10
+ } & React.RefAttributes<import("antd").RefSelectProps>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
11
+ displayName?: string | undefined;
10
12
  SECRET_COMBOBOX_MODE_DO_NOT_USE: string;
11
13
  Option: import("rc-select/lib/Option").OptionFC;
12
14
  OptGroup: import("rc-select/lib/OptGroup").OptionGroupFC;
13
- _InternalPanelDoNotUseOrYouWillBeFired: any;
15
+ _InternalPanelDoNotUseOrYouWillBeFired: (props: import("antd/es/_util/type").AnyObject) => React.JSX.Element;
14
16
  } & React.FC<SelectProps>;
15
17
  export { Select };