@antscorp/antsomi-ui 1.1.10 → 1.2.0-beta.0

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 (166) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/553.index.js +1 -0
  3. package/dist/index.js +2 -0
  4. package/dist/index.js.LICENSE.txt +16 -0
  5. package/dist/json/14638bd595156a64396a653046e5e5a7.json +33 -0
  6. package/dist/json/1dbd5812919e8dacbfdefb2ba7273faa.json +33 -0
  7. package/dist/json/6c296f4f68b6157dbae376b802e8cb69.json +8 -0
  8. package/dist/json/92f420e6aec822089f8cf33e83aa1e0c.json +8 -0
  9. package/dist/package.json +110 -0
  10. package/dist/types/components/atoms/Button/index.d.ts +10 -0
  11. package/dist/types/components/atoms/Input/Input.d.ts +7 -0
  12. package/dist/types/components/atoms/InputNumber/InputNumber.d.ts +7 -0
  13. package/dist/types/components/atoms/InputNumber/index.d.ts +1 -0
  14. package/dist/types/components/atoms/Tag/Tag.d.ts +1 -0
  15. package/dist/types/components/atoms/Tag/index.d.ts +1 -0
  16. package/dist/types/components/atoms/Typography/Text.d.ts +1 -0
  17. package/dist/types/components/atoms/Typography/index.d.ts +1 -0
  18. package/dist/types/components/atoms/index.d.ts +9 -0
  19. package/dist/types/components/common/index.d.ts +1 -0
  20. package/dist/types/components/icons/EventIcon.d.ts +3 -0
  21. package/dist/types/components/icons/index.d.ts +1 -0
  22. package/dist/types/components/index.d.ts +3 -0
  23. package/dist/types/components/molecules/CustomComponent/CustomComponent.d.ts +2 -0
  24. package/dist/types/components/molecules/CustomComponent/index.d.ts +1 -0
  25. package/dist/types/components/molecules/DatePicker/DatePicker.d.ts +8 -0
  26. package/dist/types/components/molecules/DatePicker/DatePicker.stories.d.ts +4 -0
  27. package/dist/types/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.d.ts +24 -0
  28. package/dist/types/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.stories.d.ts +5 -0
  29. package/dist/types/components/molecules/DatePicker/components/AdvancedPicker/constants.d.ts +53 -0
  30. package/dist/types/components/molecules/DatePicker/components/AdvancedPicker/index.d.ts +3 -0
  31. package/dist/types/components/molecules/DatePicker/components/AdvancedPicker/styled.d.ts +6 -0
  32. package/dist/types/components/molecules/DatePicker/components/AdvancedPicker/types.d.ts +11 -0
  33. package/dist/types/components/molecules/DatePicker/components/AdvancedPicker/utils.d.ts +15 -0
  34. package/dist/types/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.d.ts +9 -0
  35. package/dist/types/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.stories.d.ts +7 -0
  36. package/dist/types/components/molecules/DatePicker/components/AdvancedRangePicker/constants.d.ts +4 -0
  37. package/dist/types/components/molecules/DatePicker/components/AdvancedRangePicker/index.d.ts +2 -0
  38. package/dist/types/components/molecules/DatePicker/components/AdvancedRangePicker/types.d.ts +14 -0
  39. package/dist/types/components/molecules/DatePicker/index.d.ts +3 -0
  40. package/dist/types/components/molecules/Select/Select.d.ts +15 -0
  41. package/dist/types/components/molecules/Select/Select.stories.d.ts +28 -0
  42. package/dist/types/components/molecules/Select/Test.d.ts +3 -0
  43. package/dist/types/components/molecules/Select/index.d.ts +2 -0
  44. package/dist/types/components/molecules/Select/styled.d.ts +4 -0
  45. package/dist/types/components/molecules/index.d.ts +8 -0
  46. package/dist/types/hooks/index.d.ts +2 -0
  47. package/dist/types/jest-setup.d.ts +1 -0
  48. package/dist/types/src/components/atoms/Button/__tests__/Button.test.d.ts +1 -0
  49. package/dist/types/src/components/atoms/Button/index.d.ts +10 -0
  50. package/dist/types/src/components/atoms/Input/Input.d.ts +7 -0
  51. package/dist/types/src/components/atoms/InputNumber/InputNumber.d.ts +7 -0
  52. package/dist/types/src/components/atoms/InputNumber/index.d.ts +1 -0
  53. package/dist/types/src/components/atoms/Tag/Tag.d.ts +1 -0
  54. package/dist/types/src/components/atoms/Tag/index.d.ts +1 -0
  55. package/dist/types/src/components/atoms/Typography/Text.d.ts +1 -0
  56. package/dist/types/src/components/atoms/Typography/index.d.ts +1 -0
  57. package/dist/types/src/components/atoms/index.d.ts +9 -0
  58. package/dist/{esm/types/components → types/src/components/common}/ConfigProvider/ConfigProvider.d.ts +4 -1
  59. package/dist/types/src/components/common/index.d.ts +1 -0
  60. package/dist/types/src/components/icons/EventIcon.d.ts +3 -0
  61. package/dist/types/src/components/icons/index.d.ts +1 -0
  62. package/dist/types/src/components/index.d.ts +3 -0
  63. package/dist/types/src/components/molecules/CustomComponent/CustomComponent.d.ts +2 -0
  64. package/dist/types/src/components/molecules/CustomComponent/index.d.ts +1 -0
  65. package/dist/types/src/components/molecules/DatePicker/DatePicker.d.ts +8 -0
  66. package/dist/types/src/components/molecules/DatePicker/DatePicker.stories.d.ts +4 -0
  67. package/dist/types/src/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.d.ts +24 -0
  68. package/dist/types/src/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.stories.d.ts +5 -0
  69. package/dist/types/src/components/molecules/DatePicker/components/AdvancedPicker/constants.d.ts +53 -0
  70. package/dist/types/src/components/molecules/DatePicker/components/AdvancedPicker/index.d.ts +3 -0
  71. package/dist/types/src/components/molecules/DatePicker/components/AdvancedPicker/styled.d.ts +6 -0
  72. package/dist/types/src/components/molecules/DatePicker/components/AdvancedPicker/types.d.ts +11 -0
  73. package/dist/types/src/components/molecules/DatePicker/components/AdvancedPicker/utils.d.ts +15 -0
  74. package/dist/types/src/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.d.ts +9 -0
  75. package/dist/types/src/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.stories.d.ts +7 -0
  76. package/dist/types/src/components/molecules/DatePicker/components/AdvancedRangePicker/constants.d.ts +4 -0
  77. package/dist/types/src/components/molecules/DatePicker/components/AdvancedRangePicker/index.d.ts +2 -0
  78. package/dist/types/src/components/molecules/DatePicker/components/AdvancedRangePicker/types.d.ts +14 -0
  79. package/dist/types/src/components/molecules/DatePicker/index.d.ts +3 -0
  80. package/dist/types/src/components/molecules/Select/Select.d.ts +15 -0
  81. package/dist/types/src/components/molecules/Select/Select.stories.d.ts +28 -0
  82. package/dist/types/src/components/molecules/Select/Test.d.ts +3 -0
  83. package/dist/types/src/components/molecules/Select/index.d.ts +2 -0
  84. package/dist/types/src/components/molecules/Select/styled.d.ts +4 -0
  85. package/dist/types/src/components/molecules/index.d.ts +8 -0
  86. package/dist/types/src/hooks/index.d.ts +2 -0
  87. package/dist/types/src/locales/i18n.d.ts +73 -0
  88. package/dist/types/src/locales/translations.d.ts +37 -0
  89. package/dist/types/src/locales/types.d.ts +15 -0
  90. package/dist/types/src/types/index.d.ts +6 -0
  91. package/dist/types/src/utils/common.d.ts +8 -0
  92. package/dist/types/src/utils/handleError.d.ts +2 -0
  93. package/dist/types/types/index.d.ts +5 -0
  94. package/dist/types/utils/common.d.ts +8 -0
  95. package/dist/types/utils/handleError.d.ts +2 -0
  96. package/package.json +43 -27
  97. package/dist/cjs/index.js +0 -155
  98. package/dist/cjs/index.js.map +0 -1
  99. package/dist/cjs/types/components/Button/index.d.ts +0 -1
  100. package/dist/cjs/types/components/Input/Input.d.ts +0 -1
  101. package/dist/cjs/types/components/Select/Select.d.ts +0 -1
  102. package/dist/cjs/types/components/Select/index.d.ts +0 -1
  103. package/dist/cjs/types/components/index.d.ts +0 -12
  104. package/dist/esm/index.js +0 -155
  105. package/dist/esm/index.js.map +0 -1
  106. package/dist/esm/types/components/Button/index.d.ts +0 -1
  107. package/dist/esm/types/components/Input/Input.d.ts +0 -1
  108. package/dist/esm/types/components/Select/Select.d.ts +0 -1
  109. package/dist/esm/types/components/Select/index.d.ts +0 -1
  110. package/dist/esm/types/components/index.d.ts +0 -12
  111. package/dist/index.d.ts +0 -10
  112. /package/dist/{cjs/types/components → types/components/atoms}/Button/Button.d.ts +0 -0
  113. /package/dist/{cjs/types/components → types/components/atoms}/Button/Button.stories.d.ts +0 -0
  114. /package/dist/{cjs/types/components → types/components/atoms}/Button/test.d.ts +0 -0
  115. /package/dist/{cjs/types/components → types/components/atoms}/Divider/Divider.d.ts +0 -0
  116. /package/dist/{cjs/types/components → types/components/atoms}/Divider/Divider.stories.d.ts +0 -0
  117. /package/dist/{cjs/types/components → types/components/atoms}/Divider/index.d.ts +0 -0
  118. /package/dist/{cjs/types/components → types/components/atoms}/Input/Input.stories.d.ts +0 -0
  119. /package/dist/{cjs/types/components → types/components/atoms}/Input/index.d.ts +0 -0
  120. /package/dist/{cjs/types/components → types/components/atoms}/Radio/Radio.d.ts +0 -0
  121. /package/dist/{cjs/types/components → types/components/atoms}/Radio/index.d.ts +0 -0
  122. /package/dist/{cjs/types/components → types/components/atoms}/Space/Space.d.ts +0 -0
  123. /package/dist/{cjs/types/components → types/components/atoms}/Space/index.d.ts +0 -0
  124. /package/dist/{cjs/types/components → types/components/atoms}/Tooltip/Tooltip.d.ts +0 -0
  125. /package/dist/{cjs/types/components → types/components/atoms}/Tooltip/index.d.ts +0 -0
  126. /package/dist/{cjs/types/components → types/components/common}/ConfigProvider/ConfigProvider.d.ts +0 -0
  127. /package/dist/{cjs/types/components → types/components/common}/ConfigProvider/GlobalStyle.d.ts +0 -0
  128. /package/dist/{cjs/types/components → types/components/common}/ConfigProvider/index.d.ts +0 -0
  129. /package/dist/{cjs/types/components → types/components/molecules}/Alert/Alert.d.ts +0 -0
  130. /package/dist/{cjs/types/components → types/components/molecules}/Alert/index.d.ts +0 -0
  131. /package/dist/{cjs/types/components → types/components/molecules}/Cascader/Cascader.d.ts +0 -0
  132. /package/dist/{cjs/types/components → types/components/molecules}/Cascader/index.d.ts +0 -0
  133. /package/dist/{cjs/types/components → types/components/molecules}/Dropdown/Dropdown.d.ts +0 -0
  134. /package/dist/{cjs/types/components → types/components/molecules}/Dropdown/index.d.ts +0 -0
  135. /package/dist/{cjs/types/components → types/components/molecules}/Modal/Modal.d.ts +0 -0
  136. /package/dist/{cjs/types/components → types/components/molecules}/Modal/index.d.ts +0 -0
  137. /package/dist/{cjs/types → types}/constants.d.ts +0 -0
  138. /package/dist/{cjs/types → types}/index.d.ts +0 -0
  139. /package/dist/{esm/types/components → types/src/components/atoms}/Button/Button.d.ts +0 -0
  140. /package/dist/{esm/types/components → types/src/components/atoms}/Button/Button.stories.d.ts +0 -0
  141. /package/dist/{esm/types/components → types/src/components/atoms}/Button/test.d.ts +0 -0
  142. /package/dist/{esm/types/components → types/src/components/atoms}/Divider/Divider.d.ts +0 -0
  143. /package/dist/{esm/types/components → types/src/components/atoms}/Divider/Divider.stories.d.ts +0 -0
  144. /package/dist/{esm/types/components → types/src/components/atoms}/Divider/index.d.ts +0 -0
  145. /package/dist/{esm/types/components → types/src/components/atoms}/Input/Input.stories.d.ts +0 -0
  146. /package/dist/{esm/types/components → types/src/components/atoms}/Input/index.d.ts +0 -0
  147. /package/dist/{esm/types/components → types/src/components/atoms}/Radio/Radio.d.ts +0 -0
  148. /package/dist/{esm/types/components → types/src/components/atoms}/Radio/index.d.ts +0 -0
  149. /package/dist/{esm/types/components → types/src/components/atoms}/Space/Space.d.ts +0 -0
  150. /package/dist/{esm/types/components → types/src/components/atoms}/Space/index.d.ts +0 -0
  151. /package/dist/{esm/types/components → types/src/components/atoms}/Tooltip/Tooltip.d.ts +0 -0
  152. /package/dist/{esm/types/components → types/src/components/atoms}/Tooltip/index.d.ts +0 -0
  153. /package/dist/{esm/types/components → types/src/components/common}/ConfigProvider/GlobalStyle.d.ts +0 -0
  154. /package/dist/{esm/types/components → types/src/components/common}/ConfigProvider/index.d.ts +0 -0
  155. /package/dist/{esm/types/components → types/src/components/molecules}/Alert/Alert.d.ts +0 -0
  156. /package/dist/{esm/types/components → types/src/components/molecules}/Alert/index.d.ts +0 -0
  157. /package/dist/{esm/types/components → types/src/components/molecules}/Cascader/Cascader.d.ts +0 -0
  158. /package/dist/{esm/types/components → types/src/components/molecules}/Cascader/index.d.ts +0 -0
  159. /package/dist/{esm/types/components → types/src/components/molecules}/Dropdown/Dropdown.d.ts +0 -0
  160. /package/dist/{esm/types/components → types/src/components/molecules}/Dropdown/index.d.ts +0 -0
  161. /package/dist/{esm/types/components → types/src/components/molecules}/Modal/Modal.d.ts +0 -0
  162. /package/dist/{esm/types/components → types/src/components/molecules}/Modal/index.d.ts +0 -0
  163. /package/dist/{esm/types → types/src}/constants.d.ts +0 -0
  164. /package/dist/{esm/types → types/src}/index.d.ts +0 -0
  165. /package/dist/{cjs/types → types/src}/test.d.ts +0 -0
  166. /package/dist/{esm/types → types}/test.d.ts +0 -0
@@ -0,0 +1,9 @@
1
+ export { Button } from './Button';
2
+ export { Divider } from './Divider';
3
+ export { Input } from './Input';
4
+ export { InputNumber } from './InputNumber';
5
+ export { Radio } from './Radio';
6
+ export { Space } from './Space';
7
+ export { Tag } from './Tag';
8
+ export { Tooltip } from './Tooltip';
9
+ export { Typography } from './Typography';
@@ -1,7 +1,10 @@
1
1
  import { ConfigProviderProps as AntdConfigProviderProps } from 'antd/es/config-provider';
2
2
  import React, { ReactNode } from 'react';
3
- interface ConfigProviderProps extends AntdConfigProviderProps {
3
+ import { TLocale } from 'src/types';
4
+ import 'src/locales/i18n';
5
+ interface ConfigProviderProps extends Omit<AntdConfigProviderProps, 'locale'> {
4
6
  children?: ReactNode;
7
+ locale?: TLocale;
5
8
  }
6
9
  declare const ConfigProvider: React.FC<ConfigProviderProps>;
7
10
  export default ConfigProvider;
@@ -0,0 +1 @@
1
+ export { ConfigProvider } from './ConfigProvider';
@@ -0,0 +1,3 @@
1
+ export declare const EventIcon: ({ ...props }: {
2
+ [x: string]: any;
3
+ }) => JSX.Element;
@@ -0,0 +1 @@
1
+ export { EventIcon } from './EventIcon';
@@ -0,0 +1,3 @@
1
+ export * from './atoms';
2
+ export * from './molecules';
3
+ export * from './common';
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const CustomComponent: React.FC<any>;
@@ -0,0 +1 @@
1
+ export { CustomComponent } from './CustomComponent';
@@ -0,0 +1,8 @@
1
+ import { DatePicker as AntdDatePicker } from 'antd';
2
+ import { AdvancedPicker } from './components/AdvancedPicker';
3
+ import { AdvancedRangePicker } from './components/AdvancedRangePicker';
4
+ export type TDatePicker = typeof AntdDatePicker & {
5
+ AdvancedPicker: typeof AdvancedPicker;
6
+ AdvancedRangePicker: typeof AdvancedRangePicker;
7
+ };
8
+ export declare const DatePicker: TDatePicker;
@@ -0,0 +1,4 @@
1
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
2
+ declare const _default: ComponentMeta<import("./DatePicker").TDatePicker>;
3
+ export default _default;
4
+ export declare const Default: ComponentStory<import("./DatePicker").TDatePicker>;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { TAdvancedType, TOperatorKey, TOption } from './types';
3
+ export interface AdvancedPickerProps {
4
+ label?: string;
5
+ dateTypeKeysShow?: string[];
6
+ defaultDateTypeKey?: string;
7
+ valueType?: string;
8
+ option?: TOption;
9
+ operatorKey?: TOperatorKey;
10
+ type?: TAdvancedType;
11
+ date?: string;
12
+ format?: string;
13
+ formatInputDisplay?: string;
14
+ inputStyle?: React.CSSProperties;
15
+ disableAfterDate?: string;
16
+ disableBeforeDate?: string;
17
+ errorMessage?: string;
18
+ onUpdatedNewDate?: (newDate: any) => void;
19
+ onApply?: ({ date, option }: {
20
+ date: string;
21
+ option: TOption;
22
+ }) => void;
23
+ }
24
+ export declare const AdvancedPicker: React.FC<AdvancedPickerProps>;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ declare const _default: ComponentMeta<React.FC<import("./AdvancedPicker").AdvancedPickerProps>>;
4
+ export default _default;
5
+ export declare const Default: ComponentStory<React.FC<import("./AdvancedPicker").AdvancedPickerProps>>;
@@ -0,0 +1,53 @@
1
+ import { TAdvancedType } from './types';
2
+ export declare const DATE_TYPES: {
3
+ value: string;
4
+ label: string;
5
+ }[];
6
+ export declare const CALCULATION_TYPES: {
7
+ value: string;
8
+ label: string;
9
+ }[];
10
+ export declare const CALCULATION_DATES: {
11
+ value: string;
12
+ label: string;
13
+ }[];
14
+ export declare const VALUE_TYPES: {
15
+ INPUT_TEXT: string;
16
+ INPUT_NUMBER: string;
17
+ MATCHES_ANY: string;
18
+ YEAR: string;
19
+ YEAR_QUARTER: string;
20
+ YEAR_MONTH: string;
21
+ YEAR_WEEK: string;
22
+ YEAR_MONTH_DAY: string;
23
+ YEAR_MONTH_DAY_HOUR: string;
24
+ YEAR_MONTH_DAY_MINUTE: string;
25
+ YEAR_MONTH_DAY_SECOND: string;
26
+ QUARTER: string;
27
+ MONTH: string;
28
+ WEEK: string;
29
+ MONTH_DAY: string;
30
+ DAY_OF_WEEK: string;
31
+ DAY: string;
32
+ HOUR: string;
33
+ MINUTE: string;
34
+ INPUT_TEXT_NO_FIELD: string;
35
+ };
36
+ export declare const DEFAULT_DATE_FORMAT = "YYYYMMDDHHmmss";
37
+ export declare const DEFAULT_TIME_FORMAT = "HH:mm:ss";
38
+ export declare const DEFAULT_DATE_DISPLAY_FORMAT = "DD/MM/YYYY HH:mm:ss";
39
+ export declare const TIME_PICKER_TYPE: {
40
+ DATE_TIME: string;
41
+ DATE_HOUR: string;
42
+ DATE_HOUR_MINUTE: string;
43
+ DATE: string;
44
+ };
45
+ export declare const YEAR_PICKER_TYPE: {
46
+ YEAR: string;
47
+ MONTH: string;
48
+ QUARTER: string;
49
+ };
50
+ export declare const ADVANCED_PICKER_TYPE: Record<string, {
51
+ value: TAdvancedType;
52
+ label: string;
53
+ }>;
@@ -0,0 +1,3 @@
1
+ export { AdvancedPicker } from './AdvancedPicker';
2
+ export type { AdvancedPickerProps } from './AdvancedPicker';
3
+ export type { TOption as TAdvancedPickerOption } from './types';
@@ -0,0 +1,6 @@
1
+ export declare const DropdownContent: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const DropdownHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const DropdownFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const DatePickerHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ export declare const DatePickerCustomInput: import("styled-components").StyledComponent<"input", any, {}, never>;
6
+ export declare const DatePickerFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,11 @@
1
+ export type TOption = {
2
+ dateType: TDateType;
3
+ calculationType: TCalculationType;
4
+ calculationDate: TCalculationDate;
5
+ value: number;
6
+ };
7
+ export type TDateType = 'today' | 'first_day_of_week_mon_sun' | 'first_day_of_week_sun_sat' | 'first_day_of_month' | 'first_day_of_quarter' | 'first_day_of_year' | 'last_day_of_week_mon_sun' | 'last_day_of_week_sun_sat' | 'last_day_of_month' | 'last_day_of_quarter' | 'last_day_of_year' | 'fixed';
8
+ export type TCalculationType = 'minus' | 'plus' | '';
9
+ export type TCalculationDate = 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years' | '';
10
+ export type TOperatorKey = 'after' | 'between' | 'before';
11
+ export type TAdvancedType = 'startDate' | 'endDate';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Calculates a new date based on the given parameters.
3
+ * @param {string} [dateTypeKey='today'] - Key to determine the type of date to be used as the starting point.
4
+ * Valid values are: 'today', 'first_day_of_week_mon_sun', 'first_day_of_week_sun_sat',
5
+ * 'first_day_of_month', 'first_day_of_quarter', 'first_day_of_year', 'last_day_of_week_mon_sun',
6
+ * 'last_day_of_week_sun_sat', 'last_day_of_month', 'last_day_of_quarter', 'last_day_of_year'.
7
+ * @param {string} [calculationTypeKey='minus'] - Key to determine whether to add or subtract the specified value.
8
+ * Valid values are: 'plus', 'minus'.
9
+ * @param {string} [calculationDateKey='days'] - Key to determine the unit of time to be added or subtracted.
10
+ * Valid values are: 'days', 'weeks', 'months', 'quarters', 'years'.
11
+ * @param {number} [value=0] - Value to be added or subtracted.
12
+ * @param {string} [dateFormat=DEFAULT_DATE_FORMAT] - Format in which to return the new date.
13
+ * @returns {string} The new date in the specified format.
14
+ */
15
+ export declare const calculationDateAdvanced: (dateTypeKey?: string, calculationTypeKey?: string, calculationDateKey?: any, value?: number, dateFormat?: string) => any;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { TOnChangePayload, TTimeRange } from './types';
3
+ export interface AdvancedRangePickerProps {
4
+ timeRange: TTimeRange;
5
+ errorMessage?: string;
6
+ showLabel?: boolean;
7
+ onChange?: ({ timeRange, mode }: TOnChangePayload) => void;
8
+ }
9
+ export declare const AdvancedRangePicker: React.FC<AdvancedRangePickerProps>;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ import { AdvancedRangePicker } from './AdvancedRangePicker';
4
+ declare const _default: ComponentMeta<React.FC<import("./AdvancedRangePicker").AdvancedRangePickerProps>>;
5
+ export default _default;
6
+ export declare const Template: ComponentStory<typeof AdvancedRangePicker>;
7
+ export declare const Basic: ComponentStory<typeof AdvancedRangePicker>;
@@ -0,0 +1,4 @@
1
+ export declare const ADVANCED_RANGE_PICKER_FORMAT: {
2
+ startDate: string;
3
+ endDate: string;
4
+ };
@@ -0,0 +1,2 @@
1
+ export { AdvancedRangePicker } from './AdvancedRangePicker';
2
+ export type { TTimeRange as TAdvancedRangePickerTimeRange } from './types';
@@ -0,0 +1,14 @@
1
+ import { TOption } from '../AdvancedPicker/types';
2
+ export type TOnChangeMode = 'system' | 'user';
3
+ export type TTimeRange = {
4
+ startDate: TOption & {
5
+ date: string;
6
+ };
7
+ endDate: TOption & {
8
+ date: string;
9
+ };
10
+ };
11
+ export type TOnChangePayload = {
12
+ timeRange: TTimeRange;
13
+ mode: 'system' | 'user';
14
+ };
@@ -0,0 +1,3 @@
1
+ export { DatePicker } from './DatePicker';
2
+ export type { AdvancedPickerProps, TAdvancedPickerOption } from './components/AdvancedPicker';
3
+ export type { TAdvancedRangePickerTimeRange } from './components/AdvancedRangePicker';
@@ -0,0 +1,15 @@
1
+ import { SelectProps as AntdSelectProps } from 'antd';
2
+ import React from 'react';
3
+ export interface SelectProps extends AntdSelectProps {
4
+ }
5
+ declare const Select: (<ValueType = any, OptionType extends import("rc-select/lib/Select").DefaultOptionType | import("rc-select/lib/Select").BaseOptionType = import("rc-select/lib/Select").DefaultOptionType>(props: AntdSelectProps<ValueType, OptionType> & {
6
+ children?: React.ReactNode;
7
+ } & {
8
+ ref?: React.Ref<import("antd").RefSelectProps> | undefined;
9
+ }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
10
+ SECRET_COMBOBOX_MODE_DO_NOT_USE: string;
11
+ Option: import("rc-select/lib/Option").OptionFC;
12
+ OptGroup: import("rc-select/lib/OptGroup").OptionGroupFC;
13
+ _InternalPanelDoNotUseOrYouWillBeFired: any;
14
+ } & React.FC<SelectProps>;
15
+ export { Select };
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ import { Select, SelectProps } from './Select';
4
+ declare const _default: ComponentMeta<(<ValueType = any, OptionType extends import("rc-select/lib/Select").DefaultOptionType | import("rc-select/lib/Select").BaseOptionType = import("rc-select/lib/Select").DefaultOptionType>(props: import("antd").SelectProps<ValueType, OptionType> & {
5
+ children?: React.ReactNode;
6
+ } & {
7
+ ref?: React.Ref<import("rc-select").BaseSelectRef> | undefined;
8
+ }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
9
+ SECRET_COMBOBOX_MODE_DO_NOT_USE: string;
10
+ Option: import("rc-select/lib/Option").OptionFC;
11
+ OptGroup: import("rc-select/lib/OptGroup").OptionGroupFC;
12
+ _InternalPanelDoNotUseOrYouWillBeFired: any;
13
+ } & React.FC<SelectProps>>;
14
+ export default _default;
15
+ export declare const Default: ComponentStory<(<ValueType = any, OptionType extends import("rc-select/lib/Select").DefaultOptionType | import("rc-select/lib/Select").BaseOptionType = import("rc-select/lib/Select").DefaultOptionType>(props: import("antd").SelectProps<ValueType, OptionType> & {
16
+ children?: React.ReactNode;
17
+ } & {
18
+ ref?: React.Ref<import("rc-select").BaseSelectRef> | undefined;
19
+ }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
20
+ SECRET_COMBOBOX_MODE_DO_NOT_USE: string;
21
+ Option: import("rc-select/lib/Option").OptionFC;
22
+ OptGroup: import("rc-select/lib/OptGroup").OptionGroupFC;
23
+ _InternalPanelDoNotUseOrYouWillBeFired: any;
24
+ } & React.FC<SelectProps>>;
25
+ export declare const BasicUsage: ComponentStory<typeof Select>;
26
+ export declare const MultipleSelection: ComponentStory<typeof Select>;
27
+ export declare const CustomSelectionRender: ComponentStory<typeof Select>;
28
+ export declare const Status: ComponentStory<typeof Select>;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const SelectTest: () => JSX.Element;
3
+ export default SelectTest;
@@ -0,0 +1,2 @@
1
+ export { Select } from './Select';
2
+ export type { SelectProps } from './Select';
@@ -0,0 +1,4 @@
1
+ export declare const StyledTag: import("styled-components").StyledComponent<import("antd").TagType, any, {}, never>;
2
+ export declare const TagCloseBtn: import("styled-components").StyledComponent<"div", any, {
3
+ borderColor?: string | undefined;
4
+ }, never>;
@@ -0,0 +1,8 @@
1
+ export { Alert } from './Alert';
2
+ export { Cascader } from './Cascader';
3
+ export { Dropdown } from './Dropdown';
4
+ export { Modal } from './Modal';
5
+ export { Select } from './Select';
6
+ export { CustomComponent } from './CustomComponent';
7
+ export { DatePicker } from './DatePicker';
8
+ export type { AdvancedPickerProps, TAdvancedPickerOption, TAdvancedRangePickerTimeRange, } from './DatePicker';
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function useDeepCompareEffect(callback: React.EffectCallback, dependencies: React.DependencyList | undefined): void;
@@ -0,0 +1,73 @@
1
+ export declare const translationsJson: {
2
+ en: {
3
+ translation: {
4
+ global: {
5
+ minus: string;
6
+ plus: string;
7
+ };
8
+ button: {};
9
+ datePicker: {
10
+ startDate: string;
11
+ endDate: string;
12
+ dateTypes: {
13
+ today: string;
14
+ firstDayOfWeekMonSun: string;
15
+ firstDayOfWeekSunSat: string;
16
+ firstDayOfMonth: string;
17
+ firstDayOfQuarter: string;
18
+ firstDayOfYear: string;
19
+ lastDayOfWeekMonSun: string;
20
+ lastDayOfWeekSunSat: string;
21
+ lastDayOfMonth: string;
22
+ lastDayOfQuarter: string;
23
+ lastDayOfYear: string;
24
+ fixed: string;
25
+ };
26
+ seconds: string;
27
+ minutes: string;
28
+ hours: string;
29
+ days: string;
30
+ weeks: string;
31
+ months: string;
32
+ quarters: string;
33
+ years: string;
34
+ };
35
+ };
36
+ };
37
+ vi: {
38
+ translation: {
39
+ global: {
40
+ minus: string;
41
+ plus: string;
42
+ };
43
+ button: {};
44
+ datePicker: {
45
+ startDate: string;
46
+ endDate: string;
47
+ dateTypes: {
48
+ today: string;
49
+ firstDayOfWeekMonSun: string;
50
+ firstDayOfWeekSunSat: string;
51
+ firstDayOfMonth: string;
52
+ firstDayOfQuarter: string;
53
+ firstDayOfYear: string;
54
+ lastDayOfWeekMonSun: string;
55
+ lastDayOfWeekSunSat: string;
56
+ lastDayOfMonth: string;
57
+ lastDayOfQuarter: string;
58
+ lastDayOfYear: string;
59
+ fixed: string;
60
+ };
61
+ seconds: string;
62
+ minutes: string;
63
+ hours: string;
64
+ days: string;
65
+ weeks: string;
66
+ months: string;
67
+ quarters: string;
68
+ years: string;
69
+ };
70
+ };
71
+ };
72
+ };
73
+ export declare const i18n: Promise<import("i18next").TFunction<"translation", undefined, "translation">>;
@@ -0,0 +1,37 @@
1
+ import { ConvertedToObjectType, TranslationJsonType } from './types';
2
+ export declare const translations: ConvertedToObjectType<TranslationJsonType>;
3
+ export declare const convertLanguageJsonToObject: (json: any, objToConvertTo?: ConvertedToObjectType<{
4
+ global: {
5
+ minus: string;
6
+ plus: string;
7
+ };
8
+ button: {};
9
+ datePicker: {
10
+ startDate: string;
11
+ endDate: string;
12
+ dateTypes: {
13
+ today: string;
14
+ firstDayOfWeekMonSun: string;
15
+ firstDayOfWeekSunSat: string;
16
+ firstDayOfMonth: string;
17
+ firstDayOfQuarter: string;
18
+ firstDayOfYear: string;
19
+ lastDayOfWeekMonSun: string;
20
+ lastDayOfWeekSunSat: string;
21
+ lastDayOfMonth: string;
22
+ lastDayOfQuarter: string;
23
+ lastDayOfYear: string;
24
+ fixed: string;
25
+ };
26
+ seconds: string;
27
+ minutes: string;
28
+ hours: string;
29
+ days: string;
30
+ weeks: string;
31
+ months: string;
32
+ quarters: string;
33
+ years: string;
34
+ };
35
+ }>, current?: string) => void;
36
+ export declare const t: (id: string, ...rest: any[]) => [string, ...any[]];
37
+ export declare const getTranslateMessage: (id: string, defaultMessage?: string, value?: Record<string, unknown>) => string;
@@ -0,0 +1,15 @@
1
+ export type ConvertedToObjectType<T> = {
2
+ [P in keyof T]: T[P] extends string ? string : ConvertedToObjectType<T[P]>;
3
+ };
4
+ /**
5
+
6
+ If you don't want non-existing keys to throw ts error you can simply do(also keeping the intellisense)
7
+
8
+ export type ConvertedToObjectType<T> = {
9
+ [P in keyof T]: T[P] extends string ? string : ConvertedToObjectType<T[P]>;
10
+ } & {
11
+ [P: string]: any;
12
+ };
13
+
14
+ */
15
+ export type TranslationJsonType = typeof import('./en/translation.json');
@@ -0,0 +1,6 @@
1
+ export type THandleErrorPayload = {
2
+ path: string;
3
+ name: string;
4
+ args: Record<string, any>;
5
+ };
6
+ export type TLocale = 'en' | 'vi';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Function to reorder list
3
+ * @param {Object[]} list - list of item want to reorder
4
+ * @param {number} startIndex - start item index want to replace position: ;
5
+ * @param {number} endIndex - end item index want to replace position: ;
6
+ * @returns {object[]}
7
+ */
8
+ export declare const reorder: (list: Array<Record<string, unknown> | string | number>, startIndex: number, endIndex: number) => any[];
@@ -0,0 +1,2 @@
1
+ import { THandleErrorPayload } from 'src/types';
2
+ export declare const handleError: (error: any, payload: THandleErrorPayload) => void;
@@ -0,0 +1,5 @@
1
+ export type THandleErrorPayload = {
2
+ path: string;
3
+ name: string;
4
+ args: Record<string, any>;
5
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Function to reorder list
3
+ * @param {Object[]} list - list of item want to reorder
4
+ * @param {number} startIndex - start item index want to replace position: ;
5
+ * @param {number} endIndex - end item index want to replace position: ;
6
+ * @returns {object[]}
7
+ */
8
+ export declare const reorder: (list: Array<Record<string, unknown> | string | number>, startIndex: number, endIndex: number) => any[];
@@ -0,0 +1,2 @@
1
+ import { THandleErrorPayload } from 'src/types';
2
+ export declare const handleError: (error: any, payload: THandleErrorPayload) => void;
package/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.1.10",
3
+ "version": "1.2.0-beta.0",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
- "main": "dist/cjs/index.js",
6
- "module": "dist/esm/index.js",
5
+ "main": "dist/index.js",
7
6
  "files": [
8
7
  "dist"
9
8
  ],
10
- "types": "dist/index.d.ts",
9
+ "types": "dist/types",
11
10
  "scripts": {
12
11
  "dev": "vite",
13
- "build": "rollup -c",
12
+ "build": "webpack --config webpack.build.js",
14
13
  "eslint": "eslint --ext js,ts,tsx",
15
14
  "lint": "yarn run eslint src",
16
15
  "lint:fix": "yarn run eslint src --fix",
@@ -18,7 +17,10 @@
18
17
  "storybook": "start-storybook -p 6006 -s public",
19
18
  "build-storybook": "build-storybook",
20
19
  "serve-storybook": "serve storybook-static",
21
- "version": "auto-changelog -p && git add CHANGELOG.md"
20
+ "version": "auto-changelog -p && git add CHANGELOG.md",
21
+ "test": "jest",
22
+ "test:watch": "jest --watch",
23
+ "test:coverage": "jest --coverage"
22
24
  },
23
25
  "husky": {
24
26
  "hooks": {
@@ -32,7 +34,12 @@
32
34
  },
33
35
  "author": "",
34
36
  "license": "MIT",
35
- "dependencies": {},
37
+ "dependencies": {
38
+ "antd": "^5.3.2",
39
+ "dayjs": "^1.11.7",
40
+ "lodash": "^4.17.21",
41
+ "ts-dedent": "^2.2.0"
42
+ },
36
43
  "devDependencies": {
37
44
  "@ant-design/cssinjs": "^1.6.2",
38
45
  "@antscorp/eslint-config-antsomi": "1.0.4",
@@ -40,13 +47,9 @@
40
47
  "@babel/core": "^7.21.3",
41
48
  "@babel/preset-env": "^7.20.2",
42
49
  "@babel/preset-react": "^7.18.6",
43
- "@commitlint/cli": "^17.5.0",
44
- "@commitlint/config-conventional": "^17.4.4",
50
+ "@commitlint/cli": "17.5.0",
51
+ "@commitlint/config-conventional": "17.4.4",
45
52
  "@emotion/react": "^11.10.6",
46
- "@rollup/plugin-commonjs": "^24.0.1",
47
- "@rollup/plugin-image": "^3.0.2",
48
- "@rollup/plugin-node-resolve": "^15.0.1",
49
- "@rollup/plugin-typescript": "^11.0.0",
50
53
  "@storybook/addon-actions": "^6.5.16",
51
54
  "@storybook/addon-essentials": "^6.5.16",
52
55
  "@storybook/addon-interactions": "^6.5.16",
@@ -56,50 +59,63 @@
56
59
  "@storybook/manager-webpack5": "^6.5.16",
57
60
  "@storybook/react": "^6.5.16",
58
61
  "@storybook/testing-library": "^0.0.13",
59
- "@types/jest": "^29.2.5",
62
+ "@testing-library/jest-dom": "^5.16.5",
63
+ "@testing-library/react": "^14.0.0",
64
+ "@types/jest": "^29.5.0",
60
65
  "@types/node": "^18.15.10",
61
- "@types/react": "^18.0.29",
66
+ "@types/react": "^18.0.33",
62
67
  "@types/react-dom": "^18.0.11",
68
+ "@types/react-test-renderer": "^18.0.0",
63
69
  "@types/styled-components": "^5.1.26",
64
70
  "@typescript-eslint/eslint-plugin": "^5.55.0",
65
71
  "@typescript-eslint/parser": "^5.55.0",
66
72
  "@vitejs/plugin-react": "^3.1.0",
67
- "antd": "^5.3.2",
68
73
  "auto-changelog": "^2.4.0",
69
74
  "babel-loader": "^8.3.0",
75
+ "clsx": "^1.2.1",
70
76
  "css-loader": "^6.7.3",
77
+ "date-fns": "^2.29.3",
71
78
  "eslint": "^8.36.0",
72
79
  "eslint-config-airbnb": "^19.0.4",
73
80
  "eslint-config-airbnb-typescript": "^17.0.0",
81
+ "eslint-config-prettier": "^8.8.0",
74
82
  "eslint-plugin-import": "^2.27.5",
75
83
  "eslint-plugin-jsx-a11y": "^6.7.1",
84
+ "eslint-plugin-prettier": "^4.2.1",
76
85
  "eslint-plugin-react": "^7.32.2",
77
86
  "eslint-plugin-react-hooks": "^4.6.0",
78
87
  "eslint-plugin-storybook": "^0.6.11",
88
+ "file-loader": "^6.2.0",
79
89
  "husky": "^8.0.3",
90
+ "i18next": "^22.4.14",
91
+ "i18next-browser-languagedetector": "^7.0.1",
92
+ "jest": "^29.5.0",
93
+ "jest-environment-jsdom": "^29.5.0",
80
94
  "lint-staged": "^13.2.0",
95
+ "mini-css-extract-plugin": "^2.7.5",
81
96
  "postcss": "^8.4.21",
82
97
  "postcss-loader": "^7.1.0",
83
- "react": "17.0.2",
84
- "react-dom": "17.0.2",
85
- "rollup": "^3.20.0",
86
- "rollup-plugin-dts": "^5.3.0",
87
- "rollup-plugin-peer-deps-external": "^2.2.4",
88
- "rollup-plugin-postcss": "^4.0.2",
89
- "rollup-plugin-terser": "^7.0.2",
90
- "rollup-plugin-typescript-paths": "^1.4.0",
98
+ "prettier": "^2.8.7",
99
+ "react": "18.2.0",
100
+ "react-dom": "18.2.0",
101
+ "react-fast-compare": "^3.2.1",
102
+ "react-i18next": "^12.2.0",
91
103
  "sass": "^1.60.0",
92
- "sass-loader": "^13.2.1",
104
+ "sass-loader": "^13.2.2",
93
105
  "style-loader": "^3.3.2",
94
106
  "styled-components": "^5.3.9",
107
+ "terser-webpack-plugin": "^5.3.7",
108
+ "ts-jest": "^29.1.0",
95
109
  "ts-loader": "^9.4.2",
110
+ "ts-node": "^10.9.1",
96
111
  "tsconfig-paths-webpack-plugin": "^4.0.1",
97
- "tslib": "^2.5.0",
98
112
  "typescript": "^4.9.4",
99
113
  "vite": "^4.2.1",
100
- "webpack": "^5.75.0"
114
+ "webpack": "^5.78.0",
115
+ "webpack-cli": "^5.0.1"
101
116
  },
102
117
  "peerDependencies": {
118
+ "@antscorp/icons": ">=0.26.0",
103
119
  "react": ">=16.9.0",
104
120
  "react-dom": ">=16.9.0"
105
121
  }