@antscorp/antsomi-ui 1.3.3-beta.2 → 1.3.3-beta.4

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 (45) hide show
  1. package/dist/index.js +1 -1
  2. package/es/components/atoms/Flex/Flex.d.ts +2 -0
  3. package/es/components/atoms/Flex/Flex.js +1 -0
  4. package/es/components/atoms/Flex/index.d.ts +1 -0
  5. package/es/components/atoms/Flex/index.js +1 -0
  6. package/es/components/atoms/Input/Input.d.ts +11 -3
  7. package/es/components/atoms/Input/Input.js +3 -0
  8. package/es/components/atoms/index.d.ts +1 -0
  9. package/es/components/atoms/index.js +1 -0
  10. package/es/components/common/ConfigProvider/GlobalStyle.js +29 -1
  11. package/es/components/molecules/Collapse/Collapse.d.ts +3 -3
  12. package/es/components/molecules/Collapse/Collapse.js +9 -0
  13. package/es/components/molecules/FontFamilySelect/constants.d.ts +307 -0
  14. package/es/components/molecules/FontFamilySelect/constants.js +257 -0
  15. package/es/components/molecules/FontFamilySelect/index.d.ts +17 -0
  16. package/es/components/molecules/FontFamilySelect/index.js +53 -0
  17. package/es/components/molecules/FontSetting/index.d.ts +18 -0
  18. package/es/components/molecules/FontSetting/index.js +53 -0
  19. package/es/components/molecules/FontSetting/types.d.ts +22 -0
  20. package/es/components/molecules/FontSetting/types.js +1 -0
  21. package/es/components/molecules/FontWeightSelect/constants.d.ts +28 -0
  22. package/es/components/molecules/FontWeightSelect/constants.js +11 -0
  23. package/es/components/molecules/FontWeightSelect/index.d.ts +9 -0
  24. package/es/components/molecules/FontWeightSelect/index.js +39 -0
  25. package/es/components/molecules/Form/Form.d.ts +1 -0
  26. package/es/components/molecules/Form/Form.js +1 -0
  27. package/es/components/molecules/Form/index.d.ts +1 -0
  28. package/es/components/molecules/Form/index.js +1 -0
  29. package/es/components/molecules/Select/Select.d.ts +3 -0
  30. package/es/components/molecules/Select/Select.js +23 -2
  31. package/es/components/molecules/SettingWrapper/index.d.ts +1 -2
  32. package/es/components/molecules/SettingWrapperPopover/index.d.ts +16 -0
  33. package/es/components/molecules/SettingWrapperPopover/index.js +17 -0
  34. package/es/components/molecules/TextDecorationSelect/constants.d.ts +19 -0
  35. package/es/components/molecules/TextDecorationSelect/constants.js +26 -0
  36. package/es/components/molecules/TextDecorationSelect/index.d.ts +15 -0
  37. package/es/components/molecules/TextDecorationSelect/index.js +45 -0
  38. package/es/components/molecules/TextTransformSelect/constants.d.ts +13 -0
  39. package/es/components/molecules/TextTransformSelect/constants.js +19 -0
  40. package/es/components/molecules/TextTransformSelect/index.d.ts +9 -0
  41. package/es/components/molecules/TextTransformSelect/index.js +39 -0
  42. package/es/components/molecules/index.d.ts +8 -0
  43. package/es/components/molecules/index.js +7 -0
  44. package/es/constants/theme.js +18 -2
  45. package/package.json +1 -1
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { OPTION_FONT_FAMILY } from './constants';
3
+ import { SelectProps } from 'antd';
4
+ export type FontFamilySelectProps = Omit<SelectProps, 'onChange'> & {
5
+ defaultValue?: string;
6
+ value?: string;
7
+ label?: string;
8
+ showOptions?: (typeof OPTION_FONT_FAMILY)[number]['label'][];
9
+ onChange?: (family: string) => void;
10
+ };
11
+ /**
12
+ * Renders a select input for font family options.
13
+ *
14
+ * @param {FontFamilySelectProps} props - The props for the component.
15
+ * @return {ReactNode} The rendered React node.
16
+ */
17
+ export declare const FontFamilySelect: React.FC<FontFamilySelectProps>;
@@ -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,18 @@
1
+ import React from 'react';
2
+ import { PopoverProps } from 'antd';
3
+ import { SettingWrapperProps } from '../SettingWrapper';
4
+ import { TFontSettings, TFontStyles } from './types';
5
+ export type TFontSettingProps = {
6
+ label?: string;
7
+ settings: TFontSettings;
8
+ wrapperProps?: Omit<SettingWrapperProps, 'label'>;
9
+ popoverProps?: Omit<PopoverProps, 'content'>;
10
+ childrenProps?: Omit<TFontSettingEditProps, 'settings' | 'styles' | 'onChange'>;
11
+ onChange?: TFontSettingEditProps['onChange'];
12
+ };
13
+ export type TFontSettingEditProps = {
14
+ settings: TFontSettings;
15
+ onChange?: (settings: Partial<TFontSettings>, styles?: TFontStyles) => void;
16
+ };
17
+ export declare const FontSettingEdit: React.FC<TFontSettingEditProps>;
18
+ export declare const FontSetting: React.FC<TFontSettingProps>;
@@ -0,0 +1,53 @@
1
+ import React 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
+ export const FontSettingEdit = (props) => {
13
+ const { settings, onChange } = props;
14
+ const generateStyles = (settings) => ({
15
+ fontFamily: settings.fontFamily,
16
+ fontColor: settings.fontColor,
17
+ fontSize: settings.fontSize,
18
+ fontWeight: settings.fontWeight,
19
+ lineHeight: settings.lineHeight,
20
+ letterSpacing: settings.letterSpacing,
21
+ textTransform: settings.textTransform,
22
+ textDecoration: settings.textDecoration,
23
+ fontStyle: settings.fontItalic ? 'italic' : 'normal',
24
+ });
25
+ const handleChange = (setting) => {
26
+ if (typeof onChange === 'function') {
27
+ const newSettings = Object.assign(Object.assign({}, settings), setting);
28
+ const newStyles = generateStyles(newSettings);
29
+ onChange(newSettings, newStyles);
30
+ }
31
+ };
32
+ return (React.createElement(Space, { direction: "vertical" },
33
+ React.createElement(FontFamilySelect, { label: "Font Family", value: settings === null || settings === void 0 ? void 0 : settings.fontFamily, onChange: family => handleChange({ fontFamily: family }) }),
34
+ React.createElement(ColorSetting, { label: "Font Color", color: settings === null || settings === void 0 ? void 0 : settings.fontColor, onChange: fontColor => handleChange({ fontColor }) }),
35
+ React.createElement(SettingWrapper, { label: "Font Size", vertical: true },
36
+ React.createElement(SliderWithInputNumber, { value: typeof (settings === null || settings === void 0 ? void 0 : settings.fontSize) !== 'undefined' ? +settings.fontSize : 0, onAfterChange: fontSize => handleChange({ fontSize }) })),
37
+ React.createElement(FontWeightSelect, { label: "Font Weight", value: settings === null || settings === void 0 ? void 0 : settings.fontWeight, showOptions: ['Light', 'Black'], onChange: fontWeight => handleChange({ fontWeight }) }),
38
+ React.createElement(SettingWrapper, { label: "Line Height", vertical: true },
39
+ 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 }) })),
40
+ React.createElement(SettingWrapper, { label: "Letter Spacing", vertical: true },
41
+ 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 }) })),
42
+ React.createElement(TextTransformSelect, { label: "Text Transform", value: settings === null || settings === void 0 ? void 0 : settings.textTransform, onChange: textTransform => handleChange({ textTransform }) }),
43
+ React.createElement(TextDecorationSelect, { label: "Text Decoration", value: settings === null || settings === void 0 ? void 0 : settings.textDecoration, onChange: textDecoration => handleChange({ textDecoration }) }),
44
+ React.createElement(SettingWrapper, { label: "Font Style Italic" },
45
+ React.createElement(Switch, { checked: settings === null || settings === void 0 ? void 0 : settings.fontItalic, onChange: fontItalic => handleChange({ fontItalic }) }))));
46
+ };
47
+ export const FontSetting = (props) => {
48
+ const { label, settings, wrapperProps, popoverProps, childrenProps, onChange } = props;
49
+ return (React.createElement(SettingWrapperPopover, { label: label !== null && label !== void 0 ? label : 'Font Settings',
50
+ // labelStyle={{ fontWeight: 'bold', ...wrapperProps?.labelStyle }}
51
+ popoverProps: Object.assign({ overlayStyle: { top: 0 }, placement: 'bottomRight' }, popoverProps), wrapperProps: Object.assign({ containerStyle: { minWidth: '288px' } }, wrapperProps) },
52
+ React.createElement(FontSettingEdit, Object.assign({ settings: settings, onChange: onChange }, childrenProps))));
53
+ };
@@ -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
+ fontColor: 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';
@@ -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 '../../../constants';
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 => React.createElement(AntdSelect, Object.assign({}, 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>;
@@ -0,0 +1,45 @@
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 { OPTION_TEXT_DECORATION } from './constants';
15
+ import { SettingWrapper } from '../SettingWrapper';
16
+ /**
17
+ * Generates a function comment for the given function body.
18
+ *
19
+ * @param {TextDecorationSelectProps} props - the props for the TextDecorationSelect component
20
+ * @return {React.FC<TextDecorationSelectProps>} the TextDecorationSelect component
21
+ */
22
+ export const TextDecorationSelect = (props) => {
23
+ const { defaultValue, label, value, showOptions, onChange } = props, selectProps = __rest(props, ["defaultValue", "label", "value", "showOptions", "onChange"]);
24
+ const [selected, setSelected] = useState(defaultValue || value);
25
+ useEffect(() => {
26
+ setSelected(value === null || value === void 0 ? void 0 : value.toString());
27
+ }, [value]);
28
+ const textDecorationOptions = useMemo(() => {
29
+ let draftFontFamily = [...OPTION_TEXT_DECORATION];
30
+ if (showOptions === null || showOptions === void 0 ? void 0 : showOptions.length) {
31
+ draftFontFamily = OPTION_TEXT_DECORATION.filter(({ label }) => showOptions.some(font => font === label));
32
+ }
33
+ return draftFontFamily;
34
+ }, [showOptions]);
35
+ const handleChange = (value) => {
36
+ if (onChange && typeof onChange === 'function') {
37
+ onChange(value);
38
+ }
39
+ };
40
+ return (React.createElement(SettingWrapper, { label: label !== null && label !== void 0 ? label : '', containerStyle: { width: '100%' }, vertical: true },
41
+ React.createElement(Select, Object.assign({ value: selected, options: [...textDecorationOptions], style: { width: '100%' }, onChange: select => {
42
+ setSelected(select);
43
+ handleChange(select);
44
+ }, showSearch: true }, selectProps))));
45
+ };
@@ -0,0 +1,13 @@
1
+ export declare const OPTION_TEXT_TRANSFORM: readonly [{
2
+ readonly label: "None";
3
+ readonly value: "none";
4
+ }, {
5
+ readonly label: "Capitalize";
6
+ readonly value: "capitalize";
7
+ }, {
8
+ readonly label: "Uppercase";
9
+ readonly value: "uppercase";
10
+ }, {
11
+ readonly label: "Lowercase";
12
+ readonly value: "lowercase";
13
+ }];
@@ -0,0 +1,19 @@
1
+ // export const LABEL_TEXT_TRANSFORM = 'None' || 'Capitalize' || 'Uppercase' || 'Lowercase';
2
+ export const OPTION_TEXT_TRANSFORM = [
3
+ {
4
+ label: 'None',
5
+ value: 'none',
6
+ },
7
+ {
8
+ label: 'Capitalize',
9
+ value: 'capitalize',
10
+ },
11
+ {
12
+ label: 'Uppercase',
13
+ value: 'uppercase',
14
+ },
15
+ {
16
+ label: 'Lowercase',
17
+ value: 'lowercase',
18
+ },
19
+ ];
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { SelectProps } from '../Select';
3
+ import { OPTION_TEXT_TRANSFORM } from './constants';
4
+ export type TextTransformSelectProps = Omit<SelectProps, 'onChange'> & {
5
+ label?: string;
6
+ showOptions?: (typeof OPTION_TEXT_TRANSFORM)[number]['label'][];
7
+ onChange?: (textTransform: (typeof OPTION_TEXT_TRANSFORM)[number]['value']) => void;
8
+ };
9
+ export declare const TextTransformSelect: React.FC<TextTransformSelectProps>;
@@ -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_TEXT_TRANSFORM } from './constants';
16
+ export const TextTransformSelect = (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
+ useEffect(() => {
20
+ setSelected(value === null || value === void 0 ? void 0 : value.toString());
21
+ }, [value]);
22
+ const textTransformOptions = useMemo(() => {
23
+ let draftFontFamily = [...OPTION_TEXT_TRANSFORM];
24
+ if (showOptions === null || showOptions === void 0 ? void 0 : showOptions.length) {
25
+ draftFontFamily = OPTION_TEXT_TRANSFORM.filter(({ label }) => showOptions.some(font => font === label));
26
+ }
27
+ return draftFontFamily;
28
+ }, [showOptions]);
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: [...textTransformOptions], style: { width: '100%' }, onChange: select => {
36
+ setSelected(select);
37
+ handleChange(select);
38
+ }, showSearch: true }, selectProps))));
39
+ };
@@ -25,6 +25,14 @@ export { InputNumberWithUnit } from './InputNumberWithUnit';
25
25
  export { GradientSetting } from './GradientSetting';
26
26
  export { Collapse } from './Collapse';
27
27
  export { Drawer } from './Drawer';
28
+ export { SettingWrapperPopover } from './SettingWrapperPopover';
29
+ export { FontWeightSelect } from './FontWeightSelect';
30
+ export { FontFamilySelect } from './FontFamilySelect';
31
+ export { TextDecorationSelect } from './TextDecorationSelect';
32
+ export { TextTransformSelect } from './TextTransformSelect';
33
+ export { FontSetting, FontSettingEdit } from './FontSetting';
34
+ export { Form } from './Form';
28
35
  export type { AdvancedPickerProps, TAdvancedPickerOption, TAdvancedRangePickerTimeRange, } from './DatePicker';
29
36
  export type { ColorPickerProps } from './ColorPicker';
30
37
  export type { AlignEditProps, AlignSettingProps } from './AlignSetting';
38
+ export type { TFontSettingProps, TFontSettingEditProps } from './FontSetting';
@@ -25,3 +25,10 @@ export { InputNumberWithUnit } from './InputNumberWithUnit';
25
25
  export { GradientSetting } from './GradientSetting';
26
26
  export { Collapse } from './Collapse';
27
27
  export { Drawer } from './Drawer';
28
+ export { SettingWrapperPopover } from './SettingWrapperPopover';
29
+ export { FontWeightSelect } from './FontWeightSelect';
30
+ export { FontFamilySelect } from './FontFamilySelect';
31
+ export { TextDecorationSelect } from './TextDecorationSelect';
32
+ export { TextTransformSelect } from './TextTransformSelect';
33
+ export { FontSetting, FontSettingEdit } from './FontSetting';
34
+ export { Form } from './Form';