@antscorp/antsomi-ui 1.3.3-beta.9 → 1.3.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 (87) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/main.css +1 -101
  3. package/es/assets/css/main.scss +0 -4
  4. package/es/components/atoms/Slider/index.d.ts +1 -2
  5. package/es/components/atoms/Slider/index.js +16 -9
  6. package/es/components/atoms/Spin/Spin.d.ts +1 -2
  7. package/es/components/atoms/index.d.ts +0 -2
  8. package/es/components/atoms/index.js +0 -2
  9. package/es/components/common/ConfigProvider/ConfigProvider.d.ts +0 -1
  10. package/es/components/common/ConfigProvider/ConfigProvider.js +0 -1
  11. package/es/components/icons/ArrowGrowIcon.d.ts +1 -2
  12. package/es/components/icons/AudioRecordIcon.d.ts +1 -2
  13. package/es/components/icons/BugIcon.d.ts +1 -2
  14. package/es/components/icons/CameraIcon.d.ts +1 -2
  15. package/es/components/icons/CaptureIcon.d.ts +1 -2
  16. package/es/components/icons/CheckSlimIcon.d.ts +1 -2
  17. package/es/components/icons/CloseIcon.d.ts +1 -2
  18. package/es/components/icons/CommentIcon.d.ts +1 -2
  19. package/es/components/icons/EventIcon.d.ts +1 -2
  20. package/es/components/icons/FreeDrawIcon.d.ts +1 -2
  21. package/es/components/icons/GPTIcon.d.ts +1 -2
  22. package/es/components/icons/GPTIconV2.d.ts +1 -2
  23. package/es/components/icons/GPTIconV3.d.ts +1 -2
  24. package/es/components/icons/HighlightIcon.d.ts +1 -2
  25. package/es/components/icons/IdeaIcon.d.ts +1 -2
  26. package/es/components/icons/InvisibleIcon.d.ts +1 -2
  27. package/es/components/icons/MuteIcon.d.ts +1 -2
  28. package/es/components/icons/OpenUrlIcon.d.ts +1 -2
  29. package/es/components/icons/PauseIcon.d.ts +1 -2
  30. package/es/components/icons/PlaneIcon.d.ts +1 -2
  31. package/es/components/icons/RequestIcon.d.ts +1 -2
  32. package/es/components/icons/StopRecordIcon.d.ts +1 -2
  33. package/es/components/icons/UserIcon.d.ts +1 -2
  34. package/es/components/icons/VerticalDotsIcon.d.ts +1 -2
  35. package/es/components/icons/WarningIcon.d.ts +1 -2
  36. package/es/components/molecules/CaptureScreen/CaptureScreen.d.ts +1 -2
  37. package/es/components/molecules/CaptureScreen/components/CommentBox/CommentBox.d.ts +1 -2
  38. package/es/components/molecules/CaptureScreen/components/Cursor/Cursor.d.ts +1 -2
  39. package/es/components/molecules/ColorPicker/CustomPicker/index.js +18 -9
  40. package/es/components/molecules/ColorPicker/CustomPicker/styled.d.ts +1 -5
  41. package/es/components/molecules/ColorPicker/CustomPicker/styled.js +3 -14
  42. package/es/components/molecules/ColorPicker/index.js +3 -3
  43. package/es/components/molecules/ColorSetting/index.js +3 -3
  44. package/es/components/molecules/GradientSetting/index.d.ts +2 -19
  45. package/es/components/molecules/GradientSetting/index.js +30 -52
  46. package/es/components/molecules/InputNumber/index.js +2 -2
  47. package/es/components/molecules/Modal/styled.d.ts +1 -1
  48. package/es/components/molecules/Select/Test.d.ts +1 -2
  49. package/es/components/molecules/SettingWrapper/index.d.ts +2 -1
  50. package/es/components/molecules/TreeSelect/TreeSelect.d.ts +1 -1
  51. package/es/components/molecules/UploadImage/MediaIcon.d.ts +1 -2
  52. package/es/components/molecules/index.d.ts +0 -7
  53. package/es/components/molecules/index.js +0 -6
  54. package/es/constants/storybook.d.ts +1 -2
  55. package/es/test.d.ts +1 -2
  56. package/es/test.js +39 -26
  57. package/package.json +1 -1
  58. package/es/components/atoms/Popover/styled.d.ts +0 -4
  59. package/es/components/atoms/Popover/styled.js +0 -5
  60. package/es/components/atoms/SliderV2/index.d.ts +0 -5
  61. package/es/components/atoms/SliderV2/index.js +0 -23
  62. package/es/components/molecules/FontFamilySelect/constants.d.ts +0 -307
  63. package/es/components/molecules/FontFamilySelect/constants.js +0 -257
  64. package/es/components/molecules/FontFamilySelect/index.d.ts +0 -17
  65. package/es/components/molecules/FontFamilySelect/index.js +0 -53
  66. package/es/components/molecules/FontSetting/constants.d.ts +0 -3
  67. package/es/components/molecules/FontSetting/constants.js +0 -22
  68. package/es/components/molecules/FontSetting/index.d.ts +0 -24
  69. package/es/components/molecules/FontSetting/index.js +0 -54
  70. package/es/components/molecules/FontSetting/types.d.ts +0 -22
  71. package/es/components/molecules/FontSetting/types.js +0 -1
  72. package/es/components/molecules/FontWeightSelect/constants.d.ts +0 -28
  73. package/es/components/molecules/FontWeightSelect/constants.js +0 -11
  74. package/es/components/molecules/FontWeightSelect/index.d.ts +0 -9
  75. package/es/components/molecules/FontWeightSelect/index.js +0 -39
  76. package/es/components/molecules/GradientSetting/styled.d.ts +0 -1
  77. package/es/components/molecules/GradientSetting/styled.js +0 -59
  78. package/es/components/molecules/SettingWrapperPopover/index.d.ts +0 -16
  79. package/es/components/molecules/SettingWrapperPopover/index.js +0 -17
  80. package/es/components/molecules/TextDecorationSelect/constants.d.ts +0 -19
  81. package/es/components/molecules/TextDecorationSelect/constants.js +0 -26
  82. package/es/components/molecules/TextDecorationSelect/index.d.ts +0 -15
  83. package/es/components/molecules/TextDecorationSelect/index.js +0 -45
  84. package/es/components/molecules/TextTransformSelect/constants.d.ts +0 -13
  85. package/es/components/molecules/TextTransformSelect/constants.js +0 -19
  86. package/es/components/molecules/TextTransformSelect/index.d.ts +0 -9
  87. package/es/components/molecules/TextTransformSelect/index.js +0 -39
@@ -1,54 +0,0 @@
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
- };
@@ -1,22 +0,0 @@
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
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,28 +0,0 @@
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
- }];
@@ -1,11 +0,0 @@
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
- ];
@@ -1,9 +0,0 @@
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>;
@@ -1,39 +0,0 @@
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
- };
@@ -1 +0,0 @@
1
- export declare const GradientSettingWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,59 +0,0 @@
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
- `;
@@ -1,16 +0,0 @@
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>>;
@@ -1,17 +0,0 @@
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
- };
@@ -1,19 +0,0 @@
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
- }];
@@ -1,26 +0,0 @@
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
- ];
@@ -1,15 +0,0 @@
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>;
@@ -1,45 +0,0 @@
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
- };
@@ -1,13 +0,0 @@
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
- }];
@@ -1,19 +0,0 @@
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
- ];
@@ -1,9 +0,0 @@
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>;
@@ -1,39 +0,0 @@
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
- };