@antscorp/antsomi-ui 1.3.3-beta.3 → 1.3.3-beta.30

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 (106) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/public/icons/stars_slider.png +0 -0
  3. package/es/assets/images/stars_slider.png +0 -0
  4. package/es/components/atoms/Button/index.d.ts +1 -8
  5. package/es/components/atoms/Flex/Flex.d.ts +2 -0
  6. package/es/components/atoms/Flex/Flex.js +1 -0
  7. package/es/components/atoms/Flex/index.d.ts +1 -0
  8. package/es/components/atoms/Flex/index.js +1 -0
  9. package/es/components/atoms/Input/Input.d.ts +14 -3
  10. package/es/components/atoms/Input/Input.js +7 -3
  11. package/es/components/atoms/InputDynamic/EditCaretPositioning.d.ts +2 -0
  12. package/es/components/atoms/InputDynamic/EditCaretPositioning.js +89 -0
  13. package/es/components/atoms/InputDynamic/InputDynamic.d.ts +29 -0
  14. package/es/components/atoms/InputDynamic/InputDynamic.js +320 -0
  15. package/es/components/atoms/InputDynamic/PopupShortLink.d.ts +16 -0
  16. package/es/components/atoms/InputDynamic/PopupShortLink.js +98 -0
  17. package/es/components/atoms/InputDynamic/index.d.ts +2 -0
  18. package/es/components/atoms/InputDynamic/index.js +1 -0
  19. package/es/components/atoms/InputDynamic/styled.d.ts +12 -0
  20. package/es/components/atoms/InputDynamic/styled.js +279 -0
  21. package/es/components/atoms/InputDynamic/utils.d.ts +22 -0
  22. package/es/components/atoms/InputDynamic/utils.js +751 -0
  23. package/es/components/atoms/Pagination/index.d.ts +1 -0
  24. package/es/components/atoms/Popover/Popover.d.ts +1 -1
  25. package/es/components/atoms/Popover/styled.d.ts +1 -1
  26. package/es/components/atoms/Progress/Progress.d.ts +1 -1
  27. package/es/components/atoms/Radio/index.d.ts +3 -3
  28. package/es/components/atoms/RateV2/RateV2.d.ts +18 -0
  29. package/es/components/atoms/RateV2/RateV2.js +73 -0
  30. package/es/components/atoms/RateV2/index.d.ts +1 -0
  31. package/es/components/atoms/RateV2/index.js +1 -0
  32. package/es/components/atoms/RequiredLabel/index.d.ts +1 -0
  33. package/es/components/atoms/RequiredLabel/index.js +4 -3
  34. package/es/components/atoms/Slider/index.d.ts +2 -1
  35. package/es/components/atoms/Slider/index.js +7 -14
  36. package/es/components/atoms/SliderV2/index.d.ts +6 -0
  37. package/es/components/atoms/SliderV2/index.js +21 -0
  38. package/es/components/atoms/Space/Space.d.ts +1 -1
  39. package/es/components/atoms/Spin/styled.d.ts +1 -1
  40. package/es/components/atoms/Statistic/Statistic.d.ts +1 -4
  41. package/es/components/atoms/index.d.ts +6 -0
  42. package/es/components/atoms/index.js +4 -0
  43. package/es/components/common/ConfigProvider/GlobalStyle.js +69 -2
  44. package/es/components/molecules/Collapse/Collapse.d.ts +3 -3
  45. package/es/components/molecules/Collapse/Collapse.js +9 -0
  46. package/es/components/molecules/ColorSetting/styled.d.ts +1 -8
  47. package/es/components/molecules/FontSetting/constants.d.ts +3 -0
  48. package/es/components/molecules/FontSetting/constants.js +22 -0
  49. package/es/components/molecules/FontSetting/index.d.ts +10 -4
  50. package/es/components/molecules/FontSetting/index.js +36 -35
  51. package/es/components/molecules/FontSetting/types.d.ts +1 -1
  52. package/es/components/molecules/Form/Form.d.ts +1 -0
  53. package/es/components/molecules/Form/Form.js +1 -0
  54. package/es/components/molecules/Form/index.d.ts +1 -0
  55. package/es/components/molecules/Form/index.js +1 -0
  56. package/es/components/molecules/IconSelection/styled.d.ts +1 -8
  57. package/es/components/molecules/Modal/Modal.d.ts +2 -2
  58. package/es/components/molecules/Modal/index.d.ts +1 -0
  59. package/es/components/molecules/Modal/styled.d.ts +1 -1
  60. package/es/components/molecules/ModalV2/ModalV2.d.ts +5 -0
  61. package/es/components/molecules/ModalV2/ModalV2.js +26 -0
  62. package/es/components/molecules/ModalV2/index.d.ts +2 -0
  63. package/es/components/molecules/ModalV2/index.js +1 -0
  64. package/es/components/molecules/ModalV2/styled.d.ts +7 -0
  65. package/es/components/molecules/ModalV2/styled.js +22 -0
  66. package/es/components/molecules/Popconfirm/Popconfirm.d.ts +1 -1
  67. package/es/components/molecules/PreviewModal/PreviewModal.d.ts +7 -0
  68. package/es/components/molecules/PreviewModal/PreviewModal.js +30 -0
  69. package/es/components/molecules/PreviewModal/index.d.ts +2 -0
  70. package/es/components/molecules/PreviewModal/index.js +1 -0
  71. package/es/components/molecules/PreviewModal/styled.d.ts +4 -0
  72. package/es/components/molecules/PreviewModal/styled.js +39 -0
  73. package/es/components/molecules/ResizeGrid/ResizeGrid.d.ts +3 -0
  74. package/es/components/molecules/ResizeGrid/ResizeGrid.js +640 -0
  75. package/es/components/molecules/ResizeGrid/components/Cell/Cell.d.ts +3 -0
  76. package/es/components/molecules/ResizeGrid/components/Cell/Cell.js +85 -0
  77. package/es/components/molecules/ResizeGrid/components/Cell/index.d.ts +1 -0
  78. package/es/components/molecules/ResizeGrid/components/Cell/index.js +1 -0
  79. package/es/components/molecules/ResizeGrid/components/Cell/styled.d.ts +3 -0
  80. package/es/components/molecules/ResizeGrid/components/Cell/styled.js +80 -0
  81. package/es/components/molecules/ResizeGrid/constant.d.ts +35 -0
  82. package/es/components/molecules/ResizeGrid/constant.js +111 -0
  83. package/es/components/molecules/ResizeGrid/index.d.ts +2 -0
  84. package/es/components/molecules/ResizeGrid/index.js +1 -0
  85. package/es/components/molecules/ResizeGrid/styled.d.ts +10 -0
  86. package/es/components/molecules/ResizeGrid/styled.js +55 -0
  87. package/es/components/molecules/ResizeGrid/types.d.ts +144 -0
  88. package/es/components/molecules/ResizeGrid/types.js +1 -0
  89. package/es/components/molecules/Select/Select.d.ts +6 -4
  90. package/es/components/molecules/Select/Select.js +23 -2
  91. package/es/components/molecules/TreeSelect/TreeSelect.d.ts +3 -4
  92. package/es/components/molecules/index.d.ts +6 -0
  93. package/es/components/molecules/index.js +4 -0
  94. package/es/components/organism/Help/styled.d.ts +6 -16
  95. package/es/components/organism/Table/ExplorePivotTable/styled.d.ts +1 -0
  96. package/es/constants/theme.js +30 -3
  97. package/es/hooks/useDeepCompareEffect.d.ts +1 -0
  98. package/es/hooks/useDeepCompareEffect.js +21 -0
  99. package/es/locales/en/translation.json +2 -1
  100. package/es/locales/i18n.d.ts +2 -0
  101. package/es/locales/translations.d.ts +1 -0
  102. package/es/locales/vi/translation.json +2 -1
  103. package/es/test.js +164 -66
  104. package/es/utils/common.d.ts +2 -0
  105. package/es/utils/common.js +16 -0
  106. package/package.json +8 -4
@@ -1 +1,2 @@
1
1
  export { Pagination } from './Pagination';
2
+ export type { PaginationProps } from 'antd';
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  export declare const Popover: import("react").ForwardRefExoticComponent<import("antd").PopoverProps & import("react").RefAttributes<unknown>> & {
3
- _InternalPanelDoNotUseOrYouWillBeFired: typeof import("antd/es/popover/PurePanel").default;
3
+ _InternalPanelDoNotUseOrYouWillBeFired: import("react").FC<import("antd/es/popover/PurePanel").PurePanelProps>;
4
4
  };
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  export declare const PopoverWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").PopoverProps & import("react").RefAttributes<unknown>> & {
3
- _InternalPanelDoNotUseOrYouWillBeFired: typeof import("antd/es/popover/PurePanel").default;
3
+ _InternalPanelDoNotUseOrYouWillBeFired: import("react").FC<import("antd/es/popover/PurePanel").PurePanelProps>;
4
4
  }, any, {}, never>;
@@ -1,2 +1,2 @@
1
1
  /// <reference types="react" />
2
- export declare const Progress: import("react").FC<import("antd").ProgressProps>;
2
+ export declare const Progress: import("react").ForwardRefExoticComponent<import("antd").ProgressProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- export declare const Radio: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").RadioProps & import("react").RefAttributes<HTMLElement>> & {
2
+ export declare const Radio: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").RadioProps & import("react").RefAttributes<import("rc-checkbox").CheckboxRef>> & {
3
3
  Group: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("antd").RadioGroupProps & import("react").RefAttributes<HTMLDivElement>>>;
4
- Button: import("react").ForwardRefExoticComponent<import("antd/es/radio/radioButton").RadioButtonProps & import("react").RefAttributes<any>>;
4
+ Button: import("react").ForwardRefExoticComponent<import("antd/es/radio/radioButton").RadioButtonProps & import("react").RefAttributes<import("rc-checkbox").CheckboxRef>>;
5
5
  }, any, {}, never>;
6
- export declare const RadioButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/radio/radioButton").RadioButtonProps & import("react").RefAttributes<any>>, any, {}, never>;
6
+ export declare const RadioButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd/es/radio/radioButton").RadioButtonProps & import("react").RefAttributes<import("rc-checkbox").CheckboxRef>>, any, {}, never>;
7
7
  export declare const RadioGroupSub: import("styled-components").StyledComponent<import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("antd").RadioGroupProps & import("react").RefAttributes<HTMLDivElement>>>, any, {}, never>;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ interface RateContinuousProps {
3
+ count?: number;
4
+ className?: string;
5
+ defaultValue?: number;
6
+ /**
7
+ * @description number of star
8
+ */
9
+ value?: number;
10
+ type?: 'full' | 'half' | 'continuous';
11
+ /**
12
+ * @param value current number of stars are selected
13
+ * @description number of stars = fillWidth / STAR_WIDTH
14
+ */
15
+ onChange?: (value: number) => void;
16
+ }
17
+ export declare const RateV2: React.FC<RateContinuousProps>;
18
+ export {};
@@ -0,0 +1,73 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import StarImage from '@antscorp/antsomi-ui/es/assets/images/stars_slider.png';
3
+ const STAR_WIDTH = 30;
4
+ const parseNumDecimals = (input, decimals) => +Number.parseFloat(input === null || input === void 0 ? void 0 : input.toString()).toFixed(decimals);
5
+ const roundHalf = (num) => {
6
+ const multiplier = 1 / 0.5;
7
+ return Math.round(num * multiplier) / multiplier;
8
+ };
9
+ /**
10
+ *
11
+ * @param width width measure from the left edge of star container
12
+ * @param type type of star - 'full' | 'half' | 'continuous'
13
+ * @default type 'full'
14
+ * @returns
15
+ */
16
+ const getWidth = (width, type = 'full') => {
17
+ const numberOfStar = width / STAR_WIDTH;
18
+ return type === 'full'
19
+ ? Math.ceil(numberOfStar) * STAR_WIDTH
20
+ : type === 'half'
21
+ ? roundHalf(numberOfStar) * STAR_WIDTH
22
+ : width;
23
+ };
24
+ export const RateV2 = ({ count = 5, className, defaultValue = 0, value, type = 'full', onChange, }) => {
25
+ const fullWidth = count * STAR_WIDTH;
26
+ // The width is calculated when move mouse => change the UI, not change the real value
27
+ const [fillWidth, setFillWidth] = useState(() => defaultValue ? getWidth(defaultValue * STAR_WIDTH, type) : 0);
28
+ // The real current value that will be return to parent component by onChange function
29
+ // currWidth = value * STAR_WIDTH
30
+ const [currWidth, setCurrWidth] = useState(0);
31
+ const handleMouseMove = e => {
32
+ const rect = e.currentTarget.getBoundingClientRect();
33
+ const x = e.clientX - rect.left;
34
+ const hoverWidth = Math.round(x);
35
+ setFillWidth(getWidth(hoverWidth, type));
36
+ };
37
+ const handleClick = () => {
38
+ // If have no value => auto set current value; if have value => must control value with onChange props
39
+ if (!value)
40
+ setCurrWidth(fillWidth);
41
+ if (onChange)
42
+ onChange(parseNumDecimals(fillWidth / STAR_WIDTH, 2));
43
+ };
44
+ useEffect(() => {
45
+ if (typeof value === 'number') {
46
+ const width = getWidth(value * STAR_WIDTH, type);
47
+ setCurrWidth(width);
48
+ setFillWidth(width);
49
+ }
50
+ }, [value]);
51
+ return (React.createElement("div", { className: `antsomi-rate-continuous${className ? ` ${className}` : ''}`, style: {
52
+ position: 'relative',
53
+ width: `${fullWidth}px`,
54
+ backgroundPosition: '-27px',
55
+ height: '28px',
56
+ }, onMouseMove: handleMouseMove, onMouseLeave: () => setFillWidth(currWidth || 0), onClick: handleClick },
57
+ React.createElement("div", { className: "custom-rate custom-rate--fill", style: {
58
+ position: 'absolute',
59
+ background: `url(${StarImage}) 0px 0px`,
60
+ width: `${fillWidth}px`,
61
+ height: '26px',
62
+ zIndex: 1,
63
+ } }),
64
+ React.createElement("div", { className: "custom-rate custom-rate--empty", style: {
65
+ position: 'absolute',
66
+ top: '0px',
67
+ left: '0px',
68
+ backgroundImage: 'none',
69
+ background: `transparent url(${StarImage}) 0px -26px`,
70
+ width: `${fullWidth}px`,
71
+ height: '26px',
72
+ } })));
73
+ };
@@ -0,0 +1 @@
1
+ export { RateV2 } from './RateV2';
@@ -0,0 +1 @@
1
+ export { RateV2 } from './RateV2';
@@ -2,6 +2,7 @@ import React, { ReactNode } from 'react';
2
2
  import { TextProps } from '../Text';
3
3
  interface RequiredLabelProps extends TextProps {
4
4
  children?: ReactNode;
5
+ isReverseMask?: boolean;
5
6
  }
6
7
  export declare const RequiredLabel: React.FC<RequiredLabelProps>;
7
8
  export {};
@@ -17,8 +17,9 @@ import { Text } from '../Text';
17
17
  import { StyledRequired } from './styled';
18
18
  export const RequiredLabel = memo(props => {
19
19
  // Props
20
- const { children } = props, restProps = __rest(props, ["children"]);
20
+ const { children, isReverseMask = false } = props, restProps = __rest(props, ["children", "isReverseMask"]);
21
21
  return (React.createElement(Text, Object.assign({}, restProps),
22
- React.createElement(StyledRequired, null, "*"),
23
- children));
22
+ !isReverseMask && React.createElement(StyledRequired, null, "*"),
23
+ children,
24
+ isReverseMask && React.createElement(StyledRequired, null, "*")));
24
25
  });
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { SliderRangeProps, SliderSingleProps } from 'antd/es/slider';
3
- export interface SliderProps extends SliderSingleProps {
3
+ export interface SliderProps extends Omit<SliderSingleProps, 'tooltipVisible'> {
4
+ tooltipVisible?: boolean | 'default';
4
5
  }
5
6
  export declare const Slider: React.FC<SliderProps | SliderRangeProps>;
@@ -1,30 +1,23 @@
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
1
  // Libraries
13
2
  import React, { memo, useMemo } from 'react';
14
3
  // Antd Components
15
4
  import { Slider as AntdSlider } from 'antd';
16
5
  // Styled
17
6
  import { SliderWrapper } from './styled';
7
+ import { omit } from 'lodash';
18
8
  export const Slider = memo(props => {
19
- const { range, value, min = 0, max = 0, className } = props, restOf = __rest(props, ["range", "value", "min", "max", "className"]);
9
+ const { range, value, min = 0, max = 0, className, tooltipVisible } = props;
20
10
  const isNegative = useMemo(() => !!(!range && min < 0), [range, min]);
21
11
  const calculateWidth = useMemo(() => ((value || 0) * 100) / (Math.abs(max) + Math.abs(min) || 1), [min, max, value]);
12
+ const restProps = tooltipVisible === 'default' ? omit(props, ['tooltipVisible']) : props;
22
13
  if (isNegative) {
23
14
  return (React.createElement(SliderWrapper, { isNegative: true, width: calculateWidth, className: className },
24
- React.createElement(AntdSlider, Object.assign({ min: min, max: max, value: value }, restOf, { marks: { 0: ' ' } }))));
15
+ React.createElement(AntdSlider, Object.assign({}, omit(restProps, ['marks', 'className']), { marks: {
16
+ 0: ' ',
17
+ } }))));
25
18
  }
26
19
  return (React.createElement(SliderWrapper, { className: className },
27
- React.createElement(AntdSlider, Object.assign({}, props))));
20
+ React.createElement(AntdSlider, Object.assign({}, restProps))));
28
21
  });
29
22
  Slider.defaultProps = {
30
23
  tooltipVisible: false,
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { SliderRangeProps, SliderSingleProps } from 'antd/es/slider';
3
+ export interface SliderProps {
4
+ defaultSliderTrack?: boolean;
5
+ }
6
+ export declare const SliderV2: React.FC<(SliderSingleProps & SliderProps) | (SliderRangeProps & SliderProps)>;
@@ -0,0 +1,21 @@
1
+ // Libraries
2
+ import React, { useState } from 'react';
3
+ // Antd Components
4
+ import { Slider as AntdSlider } from 'antd';
5
+ // React.FC<SliderProps>
6
+ export const SliderV2 = props => {
7
+ const { min, max, onChange, styles, range, value, defaultValue, marks, defaultSliderTrack } = props;
8
+ const [valueInternal, setValueInternal] = useState(defaultValue || min || 0);
9
+ if (min && max && min < 0 && max > 0 && !range && !defaultSliderTrack) {
10
+ const sliderWidth = max - min;
11
+ const calcValue = value || valueInternal;
12
+ const leftTrackPosition = `${(Math.abs(calcValue > 0 ? min : min - calcValue) / sliderWidth) * 100}%`;
13
+ const sliderTrackWidth = `${(Math.abs(calcValue) / sliderWidth) * 100}%`;
14
+ return (React.createElement(AntdSlider, Object.assign({ value: value || valueInternal, onChange: value => {
15
+ setValueInternal(value);
16
+ if (onChange)
17
+ onChange(value);
18
+ }, styles: Object.assign({ track: Object.assign({ left: leftTrackPosition, width: sliderTrackWidth }, styles === null || styles === void 0 ? void 0 : styles.track) }, styles), marks: marks || { 0: ' ' } }, props)));
19
+ }
20
+ return React.createElement(AntdSlider, Object.assign({}, props));
21
+ };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { SpaceProps } from 'antd';
3
3
  export declare const OriginSpace: React.FC<SpaceProps>;
4
- export declare const Space: React.FC<SpaceProps> & {
4
+ export declare const Space: React.ForwardRefExoticComponent<SpaceProps & React.RefAttributes<HTMLDivElement>> & {
5
5
  Compact: React.FC<import("antd/es/space/Compact").SpaceCompactProps>;
6
6
  };
@@ -1 +1 @@
1
- export declare const StyledSpin: import("styled-components").StyledComponent<import("antd/es/spin").SpinFCType, any, {}, never>;
1
+ export declare const StyledSpin: import("styled-components").StyledComponent<import("antd/es/spin").SpinType, any, {}, never>;
@@ -1,4 +1 @@
1
- /// <reference types="react" />
2
- export declare const Statistic: import("react").FC<import("antd").StatisticProps> & {
3
- Countdown: import("react").NamedExoticComponent<import("antd").CountdownProps>;
4
- };
1
+ export declare const Statistic: import("antd/es/statistic").CompoundedStatistic;
@@ -30,4 +30,10 @@ export { Spin } from './Spin';
30
30
  export { Alert } from './Alert';
31
31
  export { ScrollBox } from './ScrollBox';
32
32
  export { Rate } from './Rate';
33
+ export { SliderV2 } from './SliderV2';
34
+ export * from './Flex';
35
+ export * from './RateV2';
36
+ export { InputDynamic } from './InputDynamic';
33
37
  export type { SliderProps } from './Slider';
38
+ export type { PaginationProps } from './Pagination';
39
+ export type { InputDynamicProps } from './InputDynamic';
@@ -30,3 +30,7 @@ export { Spin } from './Spin';
30
30
  export { Alert } from './Alert';
31
31
  export { ScrollBox } from './ScrollBox';
32
32
  export { Rate } from './Rate';
33
+ export { SliderV2 } from './SliderV2';
34
+ export * from './Flex';
35
+ export * from './RateV2';
36
+ export { InputDynamic } from './InputDynamic';
@@ -9,11 +9,35 @@ import { fas } from '@fortawesome/free-solid-svg-icons';
9
9
  import { far } from '@fortawesome/free-regular-svg-icons';
10
10
  import { fab } from '@fortawesome/free-brands-svg-icons';
11
11
  library.add(fas, far, fab);
12
+ const { accent6, accent7, scrollBarSize } = THEME.token || {};
12
13
  export const GlobalStyle = () => {
13
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30;
14
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33;
14
15
  return (React.createElement(Global, { styles: css `
15
16
  @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap');
16
17
 
18
+ /* width */
19
+ ::-webkit-scrollbar {
20
+ width: ${scrollBarSize};
21
+ height: ${scrollBarSize};
22
+ }
23
+
24
+ /* Track */
25
+ ::-webkit-scrollbar-track {
26
+ background: ${accent6};
27
+ }
28
+
29
+ /* Handle */
30
+ ::-webkit-scrollbar-thumb {
31
+ background: ${accent7};
32
+ }
33
+
34
+ .scrollbar--gutter-stable {
35
+ overflow-y: auto;
36
+ scrollbar-gutter: stable;
37
+ margin-right: -${scrollBarSize};
38
+ padding-right: -${scrollBarSize};
39
+ }
40
+
17
41
  /* Button */
18
42
  .antsomi-btn {
19
43
  font-weight: 700 !important;
@@ -409,6 +433,12 @@ export const GlobalStyle = () => {
409
433
  font-size: ${(_27 = THEME.token) === null || _27 === void 0 ? void 0 : _27.fontSize}px;
410
434
  margin-right: 0;
411
435
 
436
+ .antsomi-radio-disabled {
437
+ .antsomi-radio-inner {
438
+ border-color: #d9d9d9 !important;
439
+ }
440
+ }
441
+
412
442
  .antsomi-radio-inner {
413
443
  display: flex;
414
444
  justify-content: center;
@@ -474,7 +504,7 @@ export const GlobalStyle = () => {
474
504
  }
475
505
  }
476
506
  .antsomi-modal-footer {
477
- padding: 10px 16px;
507
+ padding: 15px;
478
508
  text-align: right;
479
509
  background: transparent;
480
510
  border-top: 1px solid #f0f0f0;
@@ -486,5 +516,42 @@ export const GlobalStyle = () => {
486
516
  .ant-message {
487
517
  z-index: 999999 !important;
488
518
  }
519
+
520
+ /* Collapse */
521
+ .antsomi-collapse-header {
522
+ font-size: 14px;
523
+ }
524
+
525
+ .antsomi-collapse {
526
+ &.antsomi-collapse-borderless {
527
+ border-bottom: 1px solid ${(_31 = THEME.token) === null || _31 === void 0 ? void 0 : _31.gray5};
528
+ }
529
+
530
+ > .antsomi-collapse-item > .antsomi-collapse-header .antsomi-collapse-arrow {
531
+ transition: all 200ms;
532
+ }
533
+ }
534
+
535
+ /* Switch */
536
+ .antsomi-switch {
537
+ border: 2px solid ${(_32 = THEME.token) === null || _32 === void 0 ? void 0 : _32.colorPrimary} !important;
538
+
539
+ &.antsomi-switch-checked {
540
+ > .antsomi-switch-handle {
541
+ &::before {
542
+ background-color: ${(_33 = THEME.token) === null || _33 === void 0 ? void 0 : _33.bw0} !important;
543
+ }
544
+ }
545
+ }
546
+ }
547
+
548
+ /* Tabs */
549
+ .antsomi-tabs {
550
+ .antsomi-tabs-tab {
551
+ &.antsomi-tabs-tab-active {
552
+ font-weight: bold;
553
+ }
554
+ }
555
+ }
489
556
  ` }));
490
557
  };
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
2
- export declare const Collapse: import("react").ForwardRefExoticComponent<import("antd").CollapseProps & import("react").RefAttributes<HTMLDivElement>> & {
3
- Panel: import("react").ForwardRefExoticComponent<import("antd").CollapsePanelProps & import("react").RefAttributes<HTMLDivElement>>;
1
+ import React from 'react';
2
+ export declare const Collapse: React.ForwardRefExoticComponent<import("antd").CollapseProps & React.RefAttributes<HTMLDivElement>> & {
3
+ Panel: React.ForwardRefExoticComponent<import("antd").CollapsePanelProps & React.RefAttributes<HTMLDivElement>>;
4
4
  };
@@ -1,2 +1,11 @@
1
+ // Libraries
2
+ import React from 'react';
1
3
  import { Collapse as AntdCollapse } from 'antd';
4
+ // Icons
5
+ import { Icon } from '../../atoms';
2
6
  export const Collapse = AntdCollapse;
7
+ Collapse.defaultProps = {
8
+ expandIcon({ isActive }) {
9
+ return (React.createElement(Icon, { type: "icon-ants-expand-more", size: 24, style: { transform: `rotate(${isActive ? -180 : 0}deg)`, color: '#666' } }));
10
+ },
11
+ };
@@ -1,14 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export declare const ColorSettingWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const PresetColor: import("styled-components").StyledComponent<"div", any, {}, never>;
4
- export declare const ButtonPreset: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Partial<{
5
- href: string;
6
- target?: string | undefined;
7
- onClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
8
- } & import("antd/es/button/button").BaseButtonProps & Omit<import("react").AnchorHTMLAttributes<HTMLAnchorElement | HTMLButtonElement>, "type" | "onClick"> & {
9
- htmlType?: "button" | "reset" | "submit" | undefined;
10
- onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
11
- } & Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "type" | "onClick">> & import("react").RefAttributes<HTMLElement>> & {
4
+ export declare const ButtonPreset: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("antd").ButtonProps & import("react").RefAttributes<HTMLElement>> & {
12
5
  Group: import("react").FC<import("antd/es/button").ButtonGroupProps>;
13
6
  }, any, {}, never>;
14
7
  export declare const PresetWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -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
+ };
@@ -2,17 +2,23 @@ import React from 'react';
2
2
  import { PopoverProps } from 'antd';
3
3
  import { SettingWrapperProps } from '../SettingWrapper';
4
4
  import { TFontSettings, TFontStyles } from './types';
5
+ type TFontSettingOptions = 'fontFamily' | 'color' | 'fontSize' | 'fontWeight' | 'textTransform' | 'textDecoration' | 'italic' | 'lineHeight' | 'letterSpacing';
5
6
  export type TFontSettingProps = {
6
7
  label?: string;
7
- settings: TFontSettings;
8
+ settings: Partial<TFontSettings>;
9
+ styles: Partial<TFontStyles>;
10
+ showSettings?: TFontSettingOptions[];
8
11
  wrapperProps?: Omit<SettingWrapperProps, 'label'>;
9
12
  popoverProps?: Omit<PopoverProps, 'content'>;
10
13
  childrenProps?: Omit<TFontSettingEditProps, 'settings' | 'styles' | 'onChange'>;
11
- onChange?: TFontSettingEditProps['onChange'];
14
+ onChange?: (settings: Partial<TFontSettings>, styles: Partial<TFontStyles>) => void;
12
15
  };
13
16
  export type TFontSettingEditProps = {
14
- settings: TFontSettings;
15
- onChange?: (settings: Partial<TFontSettings>, styles?: TFontStyles) => void;
17
+ settings: Partial<TFontSettings>;
18
+ styles: Partial<TFontStyles>;
19
+ showSettings?: TFontSettingOptions[];
20
+ onChange?: (settings: Partial<TFontSettings>, styles: Partial<TFontStyles>) => void;
16
21
  };
17
22
  export declare const FontSettingEdit: React.FC<TFontSettingEditProps>;
18
23
  export declare const FontSetting: React.FC<TFontSettingProps>;
24
+ export {};
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  /* Components */
3
3
  import { Space, Switch } from '../../atoms';
4
4
  import { ColorSetting } from '../ColorSetting';
@@ -9,45 +9,46 @@ import { FontFamilySelect } from '../FontFamilySelect';
9
9
  import { FontWeightSelect } from '../FontWeightSelect';
10
10
  import { TextTransformSelect } from '../TextTransformSelect';
11
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) => {
12
+ import { FONT_SETTING_DEFAULT, FONT_STYLE_DEFAULT } from './constants';
13
+ export const FontSettingEdit = ({ settings, styles, showSettings, onChange, }) => {
14
+ const handleChange = (setting, style) => {
26
15
  if (typeof onChange === 'function') {
27
16
  const newSettings = Object.assign(Object.assign({}, settings), setting);
28
- const newStyles = generateStyles(newSettings);
17
+ const newStyles = Object.assign(Object.assign({}, styles), style);
29
18
  onChange(newSettings, newStyles);
30
19
  }
31
20
  };
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 }) }))));
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);
46
45
  };
47
46
  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))));
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,
53
54
  };
@@ -11,7 +11,7 @@ export type TFontSettings = {
11
11
  };
12
12
  export type TFontStyles = {
13
13
  fontFamily: string;
14
- fontColor: string;
14
+ color: string;
15
15
  fontSize: string | number;
16
16
  fontWeight: string | number;
17
17
  lineHeight: string | number;
@@ -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';
@@ -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>;