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

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 (197) hide show
  1. package/es/assets/images/iphone-top-bar.png +0 -0
  2. package/es/assets/images/iphone.png +0 -0
  3. package/es/assets/images/stars_slider.png +0 -0
  4. package/es/components/atoms/Input/Input.d.ts +3 -0
  5. package/es/components/atoms/Input/Input.js +4 -3
  6. package/es/components/atoms/InputDynamic/EditCaretPositioning.d.ts +2 -0
  7. package/es/components/atoms/InputDynamic/EditCaretPositioning.js +89 -0
  8. package/es/components/atoms/InputDynamic/InputDynamic.d.ts +30 -0
  9. package/es/components/atoms/InputDynamic/InputDynamic.js +320 -0
  10. package/es/components/atoms/InputDynamic/PopupShortLink.d.ts +16 -0
  11. package/es/components/atoms/InputDynamic/PopupShortLink.js +98 -0
  12. package/es/components/atoms/InputDynamic/index.d.ts +2 -0
  13. package/es/components/atoms/InputDynamic/index.js +1 -0
  14. package/es/components/atoms/InputDynamic/styled.d.ts +12 -0
  15. package/es/components/atoms/InputDynamic/styled.js +281 -0
  16. package/es/components/atoms/InputDynamic/utils.d.ts +22 -0
  17. package/es/components/atoms/InputDynamic/utils.js +751 -0
  18. package/es/components/atoms/MobileFrame/MobileFrame.d.ts +4 -0
  19. package/es/components/atoms/MobileFrame/MobileFrame.js +22 -0
  20. package/es/components/atoms/MobileFrame/constants.d.ts +4 -0
  21. package/es/components/atoms/MobileFrame/constants.js +4 -0
  22. package/es/components/atoms/MobileFrame/index.d.ts +2 -0
  23. package/es/components/atoms/MobileFrame/index.js +1 -0
  24. package/es/components/atoms/MobileFrame/styled.d.ts +3 -0
  25. package/es/components/atoms/MobileFrame/styled.js +33 -0
  26. package/es/components/atoms/Pagination/index.d.ts +1 -0
  27. package/es/components/atoms/PreviewTabs/PreviewTabs.d.ts +7 -0
  28. package/es/components/atoms/PreviewTabs/PreviewTabs.js +67 -0
  29. package/es/components/atoms/PreviewTabs/index.d.ts +2 -0
  30. package/es/components/atoms/PreviewTabs/index.js +1 -0
  31. package/es/components/atoms/PreviewTabs/styled.d.ts +6 -0
  32. package/es/components/atoms/PreviewTabs/styled.js +79 -0
  33. package/es/components/atoms/RateV2/RateV2.d.ts +18 -0
  34. package/es/components/atoms/RateV2/RateV2.js +73 -0
  35. package/es/components/atoms/RateV2/index.d.ts +1 -0
  36. package/es/components/atoms/RateV2/index.js +1 -0
  37. package/es/components/atoms/RequiredLabel/index.d.ts +1 -0
  38. package/es/components/atoms/RequiredLabel/index.js +4 -3
  39. package/es/components/atoms/Slider/index.d.ts +2 -1
  40. package/es/components/atoms/Slider/index.js +7 -14
  41. package/es/components/atoms/SliderV2/index.d.ts +6 -0
  42. package/es/components/atoms/SliderV2/index.js +21 -0
  43. package/es/components/atoms/Spin/Spin.d.ts +2 -1
  44. package/es/components/atoms/Spin/styled.d.ts +1 -1
  45. package/es/components/atoms/index.d.ts +7 -0
  46. package/es/components/atoms/index.js +5 -0
  47. package/es/components/common/ConfigProvider/GlobalStyle.js +66 -2
  48. package/es/components/icons/ArrowGrowIcon.d.ts +2 -1
  49. package/es/components/icons/AudioRecordIcon.d.ts +2 -1
  50. package/es/components/icons/BugIcon.d.ts +2 -1
  51. package/es/components/icons/CameraIcon.d.ts +2 -1
  52. package/es/components/icons/CaptureIcon.d.ts +2 -1
  53. package/es/components/icons/CheckSlimIcon.d.ts +2 -1
  54. package/es/components/icons/CloseIcon.d.ts +2 -1
  55. package/es/components/icons/CommentIcon.d.ts +2 -1
  56. package/es/components/icons/EventIcon.d.ts +2 -1
  57. package/es/components/icons/FreeDrawIcon.d.ts +2 -1
  58. package/es/components/icons/GPTIcon.d.ts +2 -1
  59. package/es/components/icons/GPTIconV2.d.ts +2 -1
  60. package/es/components/icons/GPTIconV3.d.ts +2 -1
  61. package/es/components/icons/HighlightIcon.d.ts +2 -1
  62. package/es/components/icons/IdeaIcon.d.ts +2 -1
  63. package/es/components/icons/InvisibleIcon.d.ts +2 -1
  64. package/es/components/icons/MuteIcon.d.ts +2 -1
  65. package/es/components/icons/OpenUrlIcon.d.ts +2 -1
  66. package/es/components/icons/PauseIcon.d.ts +2 -1
  67. package/es/components/icons/PlaneIcon.d.ts +2 -1
  68. package/es/components/icons/RequestIcon.d.ts +2 -1
  69. package/es/components/icons/StopRecordIcon.d.ts +2 -1
  70. package/es/components/icons/UserIcon.d.ts +2 -1
  71. package/es/components/icons/VerticalDotsIcon.d.ts +2 -1
  72. package/es/components/icons/WarningIcon.d.ts +2 -1
  73. package/es/components/molecules/CaptureScreen/CaptureScreen.d.ts +2 -1
  74. package/es/components/molecules/CaptureScreen/components/CommentBox/CommentBox.d.ts +2 -1
  75. package/es/components/molecules/CaptureScreen/components/Cursor/Cursor.d.ts +2 -1
  76. package/es/components/molecules/FontSetting/constants.d.ts +3 -0
  77. package/es/components/molecules/FontSetting/constants.js +22 -0
  78. package/es/components/molecules/FontSetting/index.d.ts +10 -4
  79. package/es/components/molecules/FontSetting/index.js +36 -35
  80. package/es/components/molecules/FontSetting/types.d.ts +1 -1
  81. package/es/components/molecules/Modal/Modal.d.ts +2 -2
  82. package/es/components/molecules/Modal/index.d.ts +1 -0
  83. package/es/components/molecules/Modal/styled.d.ts +1 -1
  84. package/es/components/molecules/ModalV2/ModalV2.d.ts +5 -0
  85. package/es/components/molecules/ModalV2/ModalV2.js +26 -0
  86. package/es/components/molecules/ModalV2/index.d.ts +2 -0
  87. package/es/components/molecules/ModalV2/index.js +1 -0
  88. package/es/components/molecules/ModalV2/styled.d.ts +7 -0
  89. package/es/components/molecules/ModalV2/styled.js +22 -0
  90. package/es/components/molecules/PreviewModal/PreviewModal.d.ts +7 -0
  91. package/es/components/molecules/PreviewModal/PreviewModal.js +30 -0
  92. package/es/components/molecules/PreviewModal/index.d.ts +2 -0
  93. package/es/components/molecules/PreviewModal/index.js +1 -0
  94. package/es/components/molecules/PreviewModal/styled.d.ts +4 -0
  95. package/es/components/molecules/PreviewModal/styled.js +39 -0
  96. package/es/components/molecules/ResizeGrid/ResizeGrid.d.ts +3 -0
  97. package/es/components/molecules/ResizeGrid/ResizeGrid.js +719 -0
  98. package/es/components/molecules/ResizeGrid/components/Cell/Cell.d.ts +3 -0
  99. package/es/components/molecules/ResizeGrid/components/Cell/Cell.js +86 -0
  100. package/es/components/molecules/ResizeGrid/components/Cell/index.d.ts +1 -0
  101. package/es/components/molecules/ResizeGrid/components/Cell/index.js +1 -0
  102. package/es/components/molecules/ResizeGrid/components/Cell/styled.d.ts +3 -0
  103. package/es/components/molecules/ResizeGrid/components/Cell/styled.js +80 -0
  104. package/es/components/molecules/ResizeGrid/constant.d.ts +35 -0
  105. package/es/components/molecules/ResizeGrid/constant.js +111 -0
  106. package/es/components/molecules/ResizeGrid/index.d.ts +2 -0
  107. package/es/components/molecules/ResizeGrid/index.js +1 -0
  108. package/es/components/molecules/ResizeGrid/styled.d.ts +10 -0
  109. package/es/components/molecules/ResizeGrid/styled.js +56 -0
  110. package/es/components/molecules/ResizeGrid/types.d.ts +147 -0
  111. package/es/components/molecules/ResizeGrid/types.js +1 -0
  112. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.d.ts +9 -0
  113. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.js +49 -0
  114. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/index.d.ts +10 -0
  115. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/index.js +47 -0
  116. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/styled.d.ts +8 -0
  117. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/styled.js +36 -0
  118. package/es/components/molecules/RichMenu/RichMenuBlock/constants.d.ts +2 -0
  119. package/es/components/molecules/RichMenu/RichMenuBlock/constants.js +765 -0
  120. package/es/components/molecules/RichMenu/RichMenuBlock/index.d.ts +3 -0
  121. package/es/components/molecules/RichMenu/RichMenuBlock/index.js +2 -0
  122. package/es/components/molecules/RichMenu/RichMenuBlock/styled.d.ts +9 -0
  123. package/es/components/molecules/RichMenu/RichMenuBlock/styled.js +17 -0
  124. package/es/components/molecules/RichMenu/RichMenuChatBar/RichMenuChatBar.d.ts +10 -0
  125. package/es/components/molecules/RichMenu/RichMenuChatBar/RichMenuChatBar.js +32 -0
  126. package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/index.d.ts +6 -0
  127. package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/index.js +15 -0
  128. package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/styled.d.ts +4 -0
  129. package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/styled.js +47 -0
  130. package/es/components/molecules/RichMenu/RichMenuChatBar/index.d.ts +2 -0
  131. package/es/components/molecules/RichMenu/RichMenuChatBar/index.js +1 -0
  132. package/es/components/molecules/RichMenu/RichMenuChatBar/styled.d.ts +9 -0
  133. package/es/components/molecules/RichMenu/RichMenuChatBar/styled.js +37 -0
  134. package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.d.ts +10 -0
  135. package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.js +37 -0
  136. package/es/components/molecules/RichMenu/RichMenuMobileView/index.d.ts +1 -0
  137. package/es/components/molecules/RichMenu/RichMenuMobileView/index.js +1 -0
  138. package/es/components/molecules/RichMenu/RichMenuMobileView/styled.d.ts +6 -0
  139. package/es/components/molecules/RichMenu/RichMenuMobileView/styled.js +20 -0
  140. package/es/components/molecules/RichMenu/index.d.ts +3 -0
  141. package/es/components/molecules/RichMenu/index.js +3 -0
  142. package/es/components/molecules/Select/Select.d.ts +4 -2
  143. package/es/components/molecules/Select/Test.d.ts +2 -1
  144. package/es/components/molecules/TreeSelect/TreeSelect.d.ts +4 -2
  145. package/es/components/molecules/UploadImage/MediaIcon.d.ts +2 -1
  146. package/es/components/molecules/index.d.ts +6 -0
  147. package/es/components/molecules/index.js +4 -0
  148. package/es/components/organism/Help/styled.d.ts +6 -2
  149. package/es/constants/index.d.ts +1 -0
  150. package/es/constants/index.js +1 -0
  151. package/es/constants/richMenu.d.ts +19 -0
  152. package/es/constants/richMenu.js +19 -0
  153. package/es/constants/storybook.d.ts +2 -1
  154. package/es/constants/theme.js +13 -2
  155. package/es/hooks/useDeepCompareEffect.d.ts +1 -0
  156. package/es/hooks/useDeepCompareEffect.js +21 -0
  157. package/es/locales/en/translation.json +3 -1
  158. package/es/locales/i18n.d.ts +3 -0
  159. package/es/locales/translations.d.ts +2 -0
  160. package/es/locales/vi/translation.json +2 -1
  161. package/es/test.d.ts +2 -1
  162. package/es/test.js +164 -66
  163. package/es/types/index.d.ts +12 -0
  164. package/es/types/index.js +2 -1
  165. package/es/types/richMenu.d.ts +191 -0
  166. package/es/types/richMenu.js +1 -0
  167. package/es/types/variables.d.ts +2 -0
  168. package/es/types/variables.js +1 -0
  169. package/es/utils/common.d.ts +2 -0
  170. package/es/utils/common.js +16 -0
  171. package/es/utils/handleError.d.ts +32 -2
  172. package/es/utils/handleError.js +42 -4
  173. package/package.json +9 -5
  174. package/dist/0173b5993573afa04880.woff +0 -0
  175. package/dist/0dfb9214dfd945cd7290.png +0 -1
  176. package/dist/2883cad25a2b4e87ce5f.eot +0 -0
  177. package/dist/4f54a37971347e3d7122.png +0 -1
  178. package/dist/574b7bee0563a9fe9a29.png +0 -1
  179. package/dist/6b586356e837581204dc.svg +0 -1
  180. package/dist/72eec5c1c786b45a667f.ttf +0 -0
  181. package/dist/bc6bf11c6f5e6743aa4c.png +0 -1
  182. package/dist/dbc405edd6e0806efbc9.svg +0 -1
  183. package/dist/e32f09119052a55cce3c.png +0 -1
  184. package/dist/e3851b9384a984c6fdb5.png +0 -1
  185. package/dist/index.js +0 -2
  186. package/dist/index.js.LICENSE.txt +0 -69
  187. package/dist/main.css +0 -69
  188. package/dist/public/icons/2d496b55d85a9545d7311c073af442bb.png +0 -0
  189. package/dist/public/icons/2fbb4e0927d18e3f8e5c6511ab88d5b3.png +0 -0
  190. package/dist/public/icons/725a52bd91a3ce534b10833df510e5fa.png +0 -0
  191. package/dist/public/icons/7d037e0b378e87a82804443636cd0e13.svg +0 -346
  192. package/dist/public/icons/90553767e0a05b9585a54797cfd9ce51.png +0 -0
  193. package/dist/public/icons/bb64e23a1ff390a416d765ee556096ab.svg +0 -87
  194. package/dist/public/icons/d327b24e9c5d8f486f08d253aab58ce6.png +0 -0
  195. package/dist/public/icons/f1cf266d0a0a53ce07f2dbb859869b7a.png +0 -0
  196. package/dist/public/icons/placeholder-image.png +0 -0
  197. package/dist/public/icons/transparent.svg +0 -1
package/es/test.js CHANGED
@@ -2,12 +2,7 @@
2
2
  import React, { useState } from 'react';
3
3
  import { createRoot } from 'react-dom/client';
4
4
  import '@antscorp/icons/main.css';
5
- import { ConfigProvider, EdgeSetting, GradientSetting, IconSelection, PositionSetting, SettingWrapper,
6
- // Slider,
7
- SliderWithInputNumber, Space, UploadImage, } from './components';
8
- // import { Slider } from 'antd';
9
- import { Slider } from '@antscorp/antsomi-ui/es/components/atoms/Slider';
10
- import { Rate } from './components/atoms/Rate';
5
+ import { ConfigProvider, InputDynamic, } from './components';
11
6
  export const BACKGROUND_COLOR_STYLE = {
12
7
  SOLID: {
13
8
  value: 'color',
@@ -31,6 +26,8 @@ export const customColors = [
31
26
  '#57b8c2',
32
27
  ];
33
28
  export const App = () => {
29
+ // const [valueShortlink, setValueShortlink] = useState('#{shortlink(https://test.com.vn)}');
30
+ const [valueShortlink, setValueShortlink] = useState('');
34
31
  const [state, setState] = useState({
35
32
  option: {
36
33
  dateType: 'today',
@@ -49,6 +46,7 @@ export const App = () => {
49
46
  const [sliderValue, setSliderValue] = useState(10);
50
47
  const [edge, setEdge] = useState(['auto', 'auto', 700, 700]);
51
48
  const [icon, setIcon] = useState('');
49
+ console.log('valueShortlink :>', valueShortlink);
52
50
  const callbackColorSetting = (key, dataIn) => {
53
51
  switch (key) {
54
52
  case 'ON_ADD_NEW_PRESET':
@@ -78,6 +76,17 @@ export const App = () => {
78
76
  const handleSetIcon = value => {
79
77
  setIcon(value);
80
78
  };
79
+ // ---------------------------- Test Input Dynamic start ------------------------------
80
+ return (React.createElement("div", { style: {
81
+ width: 500,
82
+ height: 500,
83
+ border: '1px solid black',
84
+ margin: '0 auto',
85
+ padding: 12,
86
+ borderRadius: '10px',
87
+ } },
88
+ React.createElement(InputDynamic, { errors: [], onChange: dataOut => setValueShortlink(dataOut), onError: () => { }, isViewMode: false, canMultipleLine: false, value: valueShortlink })));
89
+ // ---------------------------- Test Input Dynamic End ------------------------------
81
90
  // ---------------------------- Test Helps Start ------------------------------
82
91
  // return (
83
92
  // <div style={{ display: 'flex', justifyContent: 'center', width: '100vw', height: '100vh' }}>
@@ -86,67 +95,156 @@ export const App = () => {
86
95
  // );
87
96
  // ---------------------------- Test Helps End ------------------------------
88
97
  // ------------------------ Media template components test start -------------------------
89
- return (React.createElement(ConfigProvider, null,
90
- React.createElement("div", { style: {
91
- width: 500,
92
- height: 1000,
93
- border: '1px solid black',
94
- margin: '0 auto',
95
- padding: 12,
96
- borderRadius: '10px',
97
- marginTop: 12,
98
- } },
99
- React.createElement("h2", { style: { textAlign: 'center' } }, "Test component of media template"),
100
- React.createElement(Space, { size: 20, direction: "vertical" },
101
- React.createElement(SettingWrapper, { vertical: true, label: "Color Setting" },
102
- React.createElement(GradientSetting, null)),
103
- React.createElement(SliderWithInputNumber, { label: "Size (px)", labelStyling: { marginTop: 10 }, min: 0, max: 100, value: sliderValue, onAfterChange: handleChangeSlider }),
104
- React.createElement(EdgeSetting, { label: "Notification Spacing", unit: "px", linked: false, values: edge,
105
- // edgeLabels={[t(translations.column.title), t(translations.row.title)]}
106
- onChange: ({ values, linked, unit }) => {
107
- setEdge(values);
108
- // onUpdateSettings({
109
- // gapX: values[0] + unit,
110
- // gapY: values[1] + unit,
111
- // gapSuffix: unit,
112
- // linkedGapInput: linked,
113
- // });
114
- } }),
115
- React.createElement(PositionSetting, { settings: { linkedPositionInput: false, positionSuffix: 'px' }, styles: { top: '10px', right: '20px', bottom: '30', left: '40' }, onChange: () => { } })),
116
- React.createElement(Space, { size: 10, direction: "vertical" },
117
- React.createElement(SettingWrapper, { vertical: true, label: "Background Image", containerStyle: { gap: '20px' } },
118
- React.createElement(UploadImage, { domainMedia: "https://sandbox-media-template.antsomi.com", slug: "cdp/api/v1", labelButtonSelect: "Select Toggle from Computor", labelHeadingModal: "Toggle Selection", searchPlaceholder: "Search toggle", paramConfigs: {
119
- token: '5474r2x214z294b423a4y474d4j5q274p4g494f4k5p5',
120
- userId: '1600084695',
121
- accountId: '1600084695',
122
- },
123
- // title="Background Image"
124
- selectedImage: {
125
- url: 'https://th.bing.com/th?id=OSK.8664d1b5838c79a3d74a3e97739978b5&w=148&h=148&c=7&o=6&dpr=2&pid=SANGAM',
126
- }, onChangeImage: image => { }, onRemoveImage: () => {
127
- // onChangeSettings('backgroundImageObj', {
128
- // name: '',
129
- // previewUrl: '',
130
- // });
131
- } })),
132
- React.createElement(SettingWrapper, { vertical: true, label: "Icon" },
133
- React.createElement(IconSelection, { isOpen: false, labelHeadingModal: "Toggle Selection", searchPlaceholder: "Search for toggle...", icon: icon, onChange: handleSetIcon, iconTypes: ['cus', 'font-awesome'], onChangeSvg: value => {
134
- console.log('onChangeSvg', value);
135
- } }))))));
98
+ // return (
99
+ // <ConfigProvider>
100
+ // <div
101
+ // style={{
102
+ // width: 500,
103
+ // height: 1000,
104
+ // border: '1px solid black',
105
+ // margin: '0 auto',
106
+ // padding: 12,
107
+ // borderRadius: '10px',
108
+ // marginTop: 12,
109
+ // }}
110
+ // >
111
+ // <h2 style={{ textAlign: 'center' }}>Test component of media template</h2>
112
+ // <Space size={20} direction="vertical">
113
+ // {/* <SettingWrapper vertical label="Color Setting">
114
+ // <ColorSetting
115
+ // label="Background Color"
116
+ // labelStyling={{ color: THEME.token?.colorIcon }}
117
+ // color={colorSettingState.color}
118
+ // customColors={colorSettingState.customColors}
119
+ // callback={callbackColorSetting}
120
+ // onChange={handleChangeColorSetting}
121
+ // />
122
+ // </SettingWrapper>
123
+ // <SettingWrapper vertical label="Input number with unit">
124
+ // <InputNumberWithUnit
125
+ // unit="px"
126
+ // min={0}
127
+ // max={2000}
128
+ // value={700}
129
+ // onChange={value => {
130
+ // console.log('onChange:: ', value);
131
+ // }}
132
+ // onChangeUnit={unit => {
133
+ // console.log('onChangeUnit:: ', unit);
134
+ // }}
135
+ // />
136
+ // </SettingWrapper>
137
+ // <SettingWrapper label="Radio Group">
138
+ // <RadioGroup
139
+ // options={Object.values(BACKGROUND_COLOR_STYLE)}
140
+ // value={radioValue}
141
+ // onChange={e => handleChangeRadio(e)}
142
+ // />
143
+ // </SettingWrapper> */}
144
+ // <SettingWrapper vertical label="Color Setting">
145
+ // <GradientSetting />
146
+ // </SettingWrapper>
147
+ // <SliderWithInputNumber
148
+ // label="Size (px)"
149
+ // labelStyling={{ marginTop: 10 }}
150
+ // min={0}
151
+ // max={100}
152
+ // value={sliderValue}
153
+ // onAfterChange={handleChangeSlider}
154
+ // />
155
+ // <EdgeSetting
156
+ // label="Notification Spacing"
157
+ // unit="px"
158
+ // linked={false}
159
+ // values={edge}
160
+ // // edgeLabels={[t(translations.column.title), t(translations.row.title)]}
161
+ // onChange={({ values, linked, unit }) => {
162
+ // setEdge(values);
163
+ // // onUpdateSettings({
164
+ // // gapX: values[0] + unit,
165
+ // // gapY: values[1] + unit,
166
+ // // gapSuffix: unit,
167
+ // // linkedGapInput: linked,
168
+ // // });
169
+ // }}
170
+ // />
171
+ // <PositionSetting
172
+ // settings={{ linkedPositionInput: false, positionSuffix: 'px' }}
173
+ // styles={{ top: '10px', right: '20px', bottom: '30', left: '40' }}
174
+ // onChange={() => {}}
175
+ // />
176
+ // </Space>
177
+ // <Space size={10} direction="vertical">
178
+ // <SettingWrapper vertical label="Background Image" containerStyle={{ gap: '20px' }}>
179
+ // <UploadImage
180
+ // domainMedia="https://sandbox-media-template.antsomi.com"
181
+ // slug="cdp/api/v1"
182
+ // labelButtonSelect="Select Toggle from Computor"
183
+ // labelHeadingModal="Toggle Selection"
184
+ // searchPlaceholder="Search toggle"
185
+ // paramConfigs={{
186
+ // token: '5474r2x214z294b423a4y474d4j5q274p4g494f4k5p5',
187
+ // userId: '1600084695',
188
+ // accountId: '1600084695',
189
+ // }}
190
+ // // title="Background Image"
191
+ // selectedImage={{
192
+ // url: 'https://th.bing.com/th?id=OSK.8664d1b5838c79a3d74a3e97739978b5&w=148&h=148&c=7&o=6&dpr=2&pid=SANGAM',
193
+ // }}
194
+ // onChangeImage={image =>
195
+ // // onChangeSettings('backgroundImageObj', {
196
+ // // name: image.name,
197
+ // // previewUrl: image.url,
198
+ // // })
199
+ // {}
200
+ // }
201
+ // onRemoveImage={() => {
202
+ // // onChangeSettings('backgroundImageObj', {
203
+ // // name: '',
204
+ // // previewUrl: '',
205
+ // // });
206
+ // }}
207
+ // />
208
+ // </SettingWrapper>
209
+ // <SettingWrapper vertical label="Icon">
210
+ // <IconSelection
211
+ // isOpen={false}
212
+ // labelHeadingModal="Toggle Selection"
213
+ // searchPlaceholder="Search for toggle..."
214
+ // icon={icon}
215
+ // onChange={handleSetIcon}
216
+ // iconTypes={['cus', 'font-awesome']}
217
+ // onChangeSvg={value => {
218
+ // console.log('onChangeSvg', value);
219
+ // }}
220
+ // />
221
+ // </SettingWrapper>
222
+ // </Space>
223
+ // </div>
224
+ // </ConfigProvider>
225
+ // );
136
226
  // ------------------------ Media template components test end -------------------------
137
- return (React.createElement("div", { style: { width: '500px', margin: '32px' } },
138
- React.createElement(GradientSetting, { onChange: e => console.log('gradient change') }),
139
- React.createElement("br", null),
140
- React.createElement("br", null),
141
- React.createElement("br", null),
142
- React.createElement("br", null),
143
- React.createElement(Slider, { className: "test-classname", min: -10, max: 10, onChange: e => console.log('slider change', e) }),
144
- React.createElement("br", null),
145
- React.createElement("br", null),
146
- React.createElement(Rate, null),
147
- React.createElement("br", null),
148
- React.createElement("br", null),
149
- React.createElement(Slider, { className: "test-classname" })));
227
+ // return (
228
+ // <div style={{ width: '500px', margin: '32px' }}>
229
+ // <GradientSetting onChange={e => console.log('gradient change')} />
230
+ // <br />
231
+ // <br />
232
+ // <br />
233
+ // <br />
234
+ // <Slider
235
+ // className="test-classname"
236
+ // min={-10}
237
+ // max={10}
238
+ // onChange={e => console.log('slider change', e)}
239
+ // />
240
+ // <br />
241
+ // <br />
242
+ // <Rate />
243
+ // <br />
244
+ // <br />
245
+ // <Slider className="test-classname" />
246
+ // </div>
247
+ // );
150
248
  };
151
249
  const container = document.getElementById('root');
152
250
  const root = createRoot(container);
@@ -4,3 +4,15 @@ export type THandleErrorPayload = {
4
4
  args: Record<string, any>;
5
5
  };
6
6
  export type TLocale = 'en' | 'vi';
7
+ export type GenericFunction = (...args: any[]) => any;
8
+ export type TConfigErrorInfo = {
9
+ [key: string]: any;
10
+ path?: string;
11
+ action?: string;
12
+ name?: string;
13
+ args?: any;
14
+ priority?: 'low' | 'medium' | 'high';
15
+ from?: 'try-catch' | 'error-boundary';
16
+ };
17
+ export * from './richMenu';
18
+ export * from './variables';
package/es/types/index.js CHANGED
@@ -1 +1,2 @@
1
- export {};
1
+ export * from './richMenu';
2
+ export * from './variables';
@@ -0,0 +1,191 @@
1
+ /// <reference types="react" />
2
+ import { AREA_LAYOUT_KEYS, BLOCK_KEYS } from '../constants';
3
+ import { TAlign } from './variables';
4
+ export type TImageStyles = {
5
+ borderTopLeftRadius: string;
6
+ borderTopRightRadius: string;
7
+ borderBottomRightRadius: string;
8
+ borderBottomLeftRadius: string;
9
+ borderTopWidth: string;
10
+ borderRightWidth: string;
11
+ borderBottomWidth: string;
12
+ borderLeftWidth: string;
13
+ borderStyle: string;
14
+ borderColor: string;
15
+ boxShadow: string;
16
+ opacity: number;
17
+ width: string;
18
+ height: string;
19
+ objectPosition: string;
20
+ objectFit: string;
21
+ paddingTop: string;
22
+ paddingRight: string;
23
+ paddingBottom: string;
24
+ paddingLeft: string;
25
+ };
26
+ export type TImageSettings = {
27
+ borderRadiusStyle: string;
28
+ borderRadiusSuffix: string;
29
+ linkedBorderRadiusInput: boolean;
30
+ linkedBorderWidthInput: boolean;
31
+ linkedPaddingInput: boolean;
32
+ paddingSuffix: string;
33
+ boxShadowStyle: string;
34
+ boxShadowColor: string;
35
+ boxShadowBlur: string;
36
+ boxShadowSpread: string;
37
+ boxShadowHorizontal: string;
38
+ boxShadowVertical: string;
39
+ boxShadowInset: boolean;
40
+ widthSuffix: string;
41
+ heightSuffix: string;
42
+ };
43
+ export type TOuterContainerStyles = {
44
+ textAlign: TAlign;
45
+ };
46
+ export type TAreaStyles = React.CSSProperties;
47
+ export type TAreaStylesSettings = {
48
+ borderRadiusStyle: string;
49
+ borderRadiusSuffix: string;
50
+ linkedBorderRadiusInput: boolean;
51
+ linkedBorderWidthInput: boolean;
52
+ linkedPaddingInput: boolean;
53
+ paddingSuffix: string;
54
+ linkedMarginInput: boolean;
55
+ marginSuffix: string;
56
+ boxShadowStyle: string;
57
+ boxShadowColor: string;
58
+ boxShadowBlur: string;
59
+ boxShadowSpread: string;
60
+ boxShadowHorizontal: string;
61
+ boxShadowVertical: string;
62
+ boxShadowInset: boolean;
63
+ backgroundColor: string;
64
+ backgroundColorStyle: string;
65
+ backgroundPosition: string;
66
+ backgroundRepeat: string;
67
+ backgroundSize: string;
68
+ gradientType: string;
69
+ radialPosition: string;
70
+ linearAngle: number;
71
+ gradients: {
72
+ gradientColor: string;
73
+ gradientColorLocation: number;
74
+ }[];
75
+ };
76
+ export type TRichMenuMode = 'single' | 'multiple';
77
+ export type TUPloadMode = 'single' | 'multiple';
78
+ export type TAreaLayoutType = 'large' | 'compact';
79
+ export type TActionType = 'none' | 'message' | 'uri' | 'postback' | 'richmenuswitch' | 'datetimepicker';
80
+ export type TImage = {
81
+ imageUrl: string;
82
+ imageStyles: TImageStyles;
83
+ imageSettings: TImageSettings;
84
+ };
85
+ export type AreaLayoutKey = (typeof AREA_LAYOUT_KEYS)[keyof typeof AREA_LAYOUT_KEYS];
86
+ export type BlockKey = (typeof BLOCK_KEYS)[keyof typeof BLOCK_KEYS];
87
+ export type TActionMessageSettings = {
88
+ text: string;
89
+ };
90
+ export type TActionUriSettings = {
91
+ uriType: 'url' | 'tel';
92
+ uri: string | number;
93
+ };
94
+ export type TActionPostbackSettings = {
95
+ data: string | number;
96
+ };
97
+ export type TActionRichmenuSwitchSettings = {
98
+ richMenuAliasId: string | number;
99
+ data: string | number;
100
+ };
101
+ export type TActionDateTimePickerSettings = {
102
+ data: string;
103
+ mode: 'date' | 'time' | 'datetime';
104
+ min: string | {
105
+ date: string;
106
+ time: string;
107
+ };
108
+ max: string | {
109
+ date: string;
110
+ time: string;
111
+ };
112
+ initial: string | {
113
+ date: string;
114
+ time: string;
115
+ };
116
+ };
117
+ export type TAction = {
118
+ type: 'none';
119
+ } | ({
120
+ type: 'message';
121
+ } & TActionMessageSettings) | ({
122
+ type: 'uri';
123
+ } & TActionUriSettings) | ({
124
+ type: 'postback';
125
+ } & TActionPostbackSettings) | ({
126
+ type: 'richmenuswitch';
127
+ } & TActionRichmenuSwitchSettings) | ({
128
+ type: 'datetimepicker';
129
+ } & TActionDateTimePickerSettings);
130
+ export type CellArea = {
131
+ bounds: CellBounds;
132
+ action: TAction;
133
+ };
134
+ export interface RichMenuSettings {
135
+ size: {
136
+ width: number;
137
+ height: number;
138
+ };
139
+ selected: boolean;
140
+ name: string;
141
+ chatBarText: string;
142
+ areas: CellArea[];
143
+ }
144
+ export interface RichMenu {
145
+ id: number | string;
146
+ menuName?: string;
147
+ aliasId?: number | string;
148
+ isDefault: boolean;
149
+ rows: number;
150
+ cols: number;
151
+ cells: TChildrenCell[];
152
+ areaLayoutId?: AreaLayoutKey;
153
+ gridTemplateRows: (number | string)[];
154
+ gridTemplateCols: (number | string)[];
155
+ layoutType: TAreaLayoutType;
156
+ uploadMode: TUPloadMode;
157
+ image: TImage;
158
+ chatBar: {
159
+ label: string;
160
+ displayDefault: boolean;
161
+ };
162
+ settings?: RichMenuSettings;
163
+ }
164
+ export type CellBounds = {
165
+ x: number;
166
+ y: number;
167
+ width: number;
168
+ height: number;
169
+ };
170
+ export interface RichMenuTemplate {
171
+ name: string;
172
+ id: number | string;
173
+ mode: TRichMenuMode;
174
+ richMenus: RichMenu[];
175
+ }
176
+ export type TChildrenCell = {
177
+ rowStart: number;
178
+ colStart: number;
179
+ rowEnd: number;
180
+ colEnd: number;
181
+ width?: number;
182
+ height?: number;
183
+ x?: number;
184
+ y?: number;
185
+ action?: TAction;
186
+ image: TImage;
187
+ outerContainerStyles: TOuterContainerStyles;
188
+ areaStyles: TAreaStyles;
189
+ areaStylesSettings: TAreaStylesSettings;
190
+ active?: boolean;
191
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export type TUnit = 'px' | '%' | any;
2
+ export type TAlign = 'left' | 'center' | 'right';
@@ -0,0 +1 @@
1
+ export {};
@@ -7,6 +7,8 @@
7
7
  */
8
8
  export declare const reorder: (list: Array<Record<string, unknown> | string | number>, startIndex: number, endIndex: number) => any[];
9
9
  export declare const safeParse: (val: any, defaultVal: any) => any;
10
+ export declare const getObjectPropSafely: (fn: any, defaultValue?: string) => any;
11
+ export declare const random: (number: any) => string;
10
12
  export declare function getPortalId(config: any): any;
11
13
  export declare const safeParseInt: (val: any, defaultVal: any) => any;
12
14
  export declare function isUrlEmbedded(): boolean;
@@ -26,6 +26,22 @@ export const safeParse = (val, defaultVal) => {
26
26
  }
27
27
  return val;
28
28
  };
29
+ export const getObjectPropSafely = (fn, defaultValue = '') => {
30
+ try {
31
+ return fn();
32
+ }
33
+ catch (e) {
34
+ return defaultValue;
35
+ }
36
+ };
37
+ export const random = number => {
38
+ let text = '';
39
+ const possible = 'abcdefghijklmnopqrstuvwxyz0123456789';
40
+ for (let i = 0; i < number; i++) {
41
+ text += possible.charAt(Math.floor(Math.random() * possible.length));
42
+ }
43
+ return text;
44
+ };
29
45
  export function getPortalId(config) {
30
46
  const portalId = safeParse(getSessionStorage('api_pid', config), 0);
31
47
  if (portalId === 0) {
@@ -1,2 +1,32 @@
1
- import { THandleErrorPayload } from '@antscorp/antsomi-ui/es/types';
2
- export declare const handleError: (error: any, payload: THandleErrorPayload) => void;
1
+ import { GenericFunction, TConfigErrorInfo } from '@antscorp/antsomi-ui/es/types';
2
+ export declare const handleError: (error?: any, configInfo?: TConfigErrorInfo, isShowMessageError?: boolean) => Promise<void>;
3
+ type TryCatchWrapper<F extends GenericFunction> = (...args: Parameters<F>) => ReturnType<F>;
4
+ /**
5
+ * @param func callback function need to try-catch
6
+ * @param path relative path of current file that func execute
7
+ * @returns func(args:? any[])
8
+ * @example
9
+ * ```
10
+ * function handler(argument: string) {
11
+ * console.log(argument)
12
+ * }
13
+ *
14
+ * tryCatchWrapper(handler, PATH)('this string will be log to console');
15
+ * ```
16
+ */
17
+ export declare function tryCatchWrapper<F extends GenericFunction>(func: F, path: string): TryCatchWrapper<F>;
18
+ /**
19
+ * @param func callback function need to try-catch
20
+ * @param options options config for handleError function
21
+ * @returns func(args:? any[])
22
+ * @example
23
+ * ```
24
+ * function handler(argument: string) {
25
+ * console.log(argument)
26
+ * }
27
+ *
28
+ * tryCatchWrapper(handler, PATH)('this string will be log to console');
29
+ * ```
30
+ */
31
+ export declare function tryCatchWrapper<F extends GenericFunction>(func: F, options: TConfigErrorInfo): TryCatchWrapper<F>;
32
+ export {};
@@ -1,6 +1,44 @@
1
- export const handleError = (error, payload) => {
2
- // eslint-disable-next-line no-console
3
- console.log({
4
- error: payload,
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
5
8
  });
6
9
  };
10
+ var __rest = (this && this.__rest) || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
+ t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
+ t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
20
+ };
21
+ export const handleError = (error = {}, configInfo = {}, isShowMessageError = false) => __awaiter(void 0, void 0, void 0, function* () {
22
+ const { response, message } = error;
23
+ const { name: functionName, path, from, priority = 'low' } = configInfo, restOfConfigInfo = __rest(configInfo, ["name", "path", "from", "priority"]);
24
+ console.log(error);
25
+ });
26
+ export function tryCatchWrapper(func, options = {}) {
27
+ return (...args) => {
28
+ try {
29
+ return func(...args);
30
+ }
31
+ catch (error) {
32
+ if (typeof options !== 'string') {
33
+ handleError(error, options);
34
+ }
35
+ else {
36
+ handleError(error, {
37
+ name: func.name || 'anonymous',
38
+ path: options,
39
+ args: {},
40
+ });
41
+ }
42
+ }
43
+ };
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.3-beta.4",
3
+ "version": "1.3.3-beta.40",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",
@@ -19,6 +19,7 @@
19
19
  "unpkg": "dist/index.js",
20
20
  "types": "es/index.d.ts",
21
21
  "scripts": {
22
+ "publish": "npm run clean && npm run build:es",
22
23
  "build:es": "npm run copy-files && npm run ts-compile",
23
24
  "clean": "rimraf dist lib es",
24
25
  "dev": "vite",
@@ -56,7 +57,7 @@
56
57
  "not op_mini all"
57
58
  ],
58
59
  "dependencies": {
59
- "@antscorp/icons": "0.26.58",
60
+ "@antscorp/icons": "0.27.3",
60
61
  "@antscorp/image-editor": "1.0.2",
61
62
  "@emotion/react": "^11.11.1",
62
63
  "@fortawesome/fontawesome-svg-core": "6.1.1",
@@ -65,14 +66,18 @@
65
66
  "@fortawesome/free-solid-svg-icons": "6.1.1",
66
67
  "@fortawesome/react-fontawesome": "0.2.0",
67
68
  "@tinymce/tinymce-react": "^3.7.0",
68
- "antd": "^5.3.2",
69
+ "antd": "5.10.0",
69
70
  "axios": "^1.4.0",
70
71
  "babel-plugin-file-loader": "^2.0.0",
71
72
  "dayjs": "^1.11.7",
72
73
  "font-awesome": "4.7.0",
73
74
  "highlight.js": "^11.8.0",
75
+ "html-entities": "^2.0.2",
74
76
  "html-to-image": "^1.11.11",
75
77
  "html2canvas": "^1.4.1",
78
+ "i18next": "21.6.16",
79
+ "i18next-browser-languagedetector": "6.1.2",
80
+ "immer": "^10.0.3",
76
81
  "lodash": "^4.17.21",
77
82
  "moment": "2.29.2",
78
83
  "qs": "6.10.3",
@@ -84,8 +89,7 @@
84
89
  "remark-gfm": "^3.0.1",
85
90
  "ts-dedent": "^2.2.0",
86
91
  "tui-image-editor": "^3.15.3",
87
- "i18next": "21.6.16",
88
- "i18next-browser-languagedetector": "6.1.2"
92
+ "use-immer": "^0.9.0"
89
93
  },
90
94
  "devDependencies": {
91
95
  "@ant-design/cssinjs": "^1.6.2",
Binary file