@antscorp/antsomi-ui 1.1.11 → 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 (81) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/553.index.js +1 -0
  3. package/dist/index.js +1 -1
  4. package/dist/json/14638bd595156a64396a653046e5e5a7.json +33 -0
  5. package/dist/json/1dbd5812919e8dacbfdefb2ba7273faa.json +33 -0
  6. package/dist/json/6c296f4f68b6157dbae376b802e8cb69.json +8 -0
  7. package/dist/json/92f420e6aec822089f8cf33e83aa1e0c.json +8 -0
  8. package/dist/types/jest-setup.d.ts +1 -0
  9. package/dist/types/src/components/atoms/Button/Button.d.ts +1 -0
  10. package/dist/types/src/components/atoms/Button/Button.stories.d.ts +32 -0
  11. package/dist/types/src/components/atoms/Button/__tests__/Button.test.d.ts +1 -0
  12. package/dist/types/src/components/atoms/Button/index.d.ts +10 -0
  13. package/dist/types/src/components/atoms/Button/test.d.ts +3 -0
  14. package/dist/types/src/components/atoms/Divider/Divider.d.ts +1 -0
  15. package/dist/types/src/components/atoms/Divider/Divider.stories.d.ts +8 -0
  16. package/dist/types/src/components/atoms/Divider/index.d.ts +1 -0
  17. package/dist/types/src/components/atoms/Input/Input.d.ts +7 -0
  18. package/dist/types/src/components/atoms/Input/Input.stories.d.ts +19 -0
  19. package/dist/types/src/components/atoms/Input/index.d.ts +1 -0
  20. package/dist/types/src/components/atoms/InputNumber/InputNumber.d.ts +7 -0
  21. package/dist/types/src/components/atoms/InputNumber/index.d.ts +1 -0
  22. package/dist/types/src/components/atoms/Radio/Radio.d.ts +1 -0
  23. package/dist/types/src/components/atoms/Radio/index.d.ts +1 -0
  24. package/dist/types/src/components/atoms/Space/Space.d.ts +1 -0
  25. package/dist/types/src/components/atoms/Space/index.d.ts +1 -0
  26. package/dist/types/src/components/atoms/Tag/Tag.d.ts +1 -0
  27. package/dist/types/src/components/atoms/Tag/index.d.ts +1 -0
  28. package/dist/types/src/components/atoms/Tooltip/Tooltip.d.ts +1 -0
  29. package/dist/types/src/components/atoms/Tooltip/index.d.ts +1 -0
  30. package/dist/types/src/components/atoms/Typography/Text.d.ts +1 -0
  31. package/dist/types/src/components/atoms/Typography/index.d.ts +1 -0
  32. package/dist/types/src/components/atoms/index.d.ts +9 -0
  33. package/dist/types/src/components/common/ConfigProvider/ConfigProvider.d.ts +10 -0
  34. package/dist/types/src/components/common/ConfigProvider/GlobalStyle.d.ts +5 -0
  35. package/dist/types/src/components/common/ConfigProvider/index.d.ts +1 -0
  36. package/dist/types/src/components/common/index.d.ts +1 -0
  37. package/dist/types/src/components/icons/EventIcon.d.ts +3 -0
  38. package/dist/types/src/components/icons/index.d.ts +1 -0
  39. package/dist/types/src/components/index.d.ts +3 -0
  40. package/dist/types/src/components/molecules/Alert/Alert.d.ts +1 -0
  41. package/dist/types/src/components/molecules/Alert/index.d.ts +1 -0
  42. package/dist/types/src/components/molecules/Cascader/Cascader.d.ts +1 -0
  43. package/dist/types/src/components/molecules/Cascader/index.d.ts +1 -0
  44. package/dist/types/src/components/molecules/CustomComponent/CustomComponent.d.ts +2 -0
  45. package/dist/types/src/components/molecules/CustomComponent/index.d.ts +1 -0
  46. package/dist/types/src/components/molecules/DatePicker/DatePicker.d.ts +8 -0
  47. package/dist/types/src/components/molecules/DatePicker/DatePicker.stories.d.ts +4 -0
  48. package/dist/types/src/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.d.ts +24 -0
  49. package/dist/types/src/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.stories.d.ts +5 -0
  50. package/dist/types/src/components/molecules/DatePicker/components/AdvancedPicker/constants.d.ts +53 -0
  51. package/dist/types/src/components/molecules/DatePicker/components/AdvancedPicker/index.d.ts +3 -0
  52. package/dist/types/src/components/molecules/DatePicker/components/AdvancedPicker/styled.d.ts +6 -0
  53. package/dist/types/src/components/molecules/DatePicker/components/AdvancedPicker/types.d.ts +11 -0
  54. package/dist/types/src/components/molecules/DatePicker/components/AdvancedPicker/utils.d.ts +15 -0
  55. package/dist/types/src/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.d.ts +9 -0
  56. package/dist/types/src/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.stories.d.ts +7 -0
  57. package/dist/types/src/components/molecules/DatePicker/components/AdvancedRangePicker/constants.d.ts +4 -0
  58. package/dist/types/src/components/molecules/DatePicker/components/AdvancedRangePicker/index.d.ts +2 -0
  59. package/dist/types/src/components/molecules/DatePicker/components/AdvancedRangePicker/types.d.ts +14 -0
  60. package/dist/types/src/components/molecules/DatePicker/index.d.ts +3 -0
  61. package/dist/types/src/components/molecules/Dropdown/Dropdown.d.ts +1 -0
  62. package/dist/types/src/components/molecules/Dropdown/index.d.ts +1 -0
  63. package/dist/types/src/components/molecules/Modal/Modal.d.ts +1 -0
  64. package/dist/types/src/components/molecules/Modal/index.d.ts +1 -0
  65. package/dist/types/src/components/molecules/Select/Select.d.ts +15 -0
  66. package/dist/types/src/components/molecules/Select/Select.stories.d.ts +28 -0
  67. package/dist/types/src/components/molecules/Select/Test.d.ts +3 -0
  68. package/dist/types/src/components/molecules/Select/index.d.ts +2 -0
  69. package/dist/types/src/components/molecules/Select/styled.d.ts +4 -0
  70. package/dist/types/src/components/molecules/index.d.ts +8 -0
  71. package/dist/types/src/constants.d.ts +12 -0
  72. package/dist/types/src/hooks/index.d.ts +2 -0
  73. package/dist/types/src/index.d.ts +1 -0
  74. package/dist/types/src/locales/i18n.d.ts +73 -0
  75. package/dist/types/src/locales/translations.d.ts +37 -0
  76. package/dist/types/src/locales/types.d.ts +15 -0
  77. package/dist/types/src/test.d.ts +3 -0
  78. package/dist/types/src/types/index.d.ts +6 -0
  79. package/dist/types/src/utils/common.d.ts +8 -0
  80. package/dist/types/src/utils/handleError.d.ts +2 -0
  81. package/package.json +20 -6
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function useDeepCompareEffect(callback: React.EffectCallback, dependencies: React.DependencyList | undefined): void;
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -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,3 @@
1
+ /// <reference types="react" />
2
+ import '@antscorp/icons/main.css';
3
+ export declare const App: () => JSX.Element;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.1.11",
3
+ "version": "1.2.0-beta.0",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -17,7 +17,10 @@
17
17
  "storybook": "start-storybook -p 6006 -s public",
18
18
  "build-storybook": "build-storybook",
19
19
  "serve-storybook": "serve storybook-static",
20
- "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"
21
24
  },
22
25
  "husky": {
23
26
  "hooks": {
@@ -56,10 +59,13 @@
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",
@@ -72,26 +78,34 @@
72
78
  "eslint": "^8.36.0",
73
79
  "eslint-config-airbnb": "^19.0.4",
74
80
  "eslint-config-airbnb-typescript": "^17.0.0",
81
+ "eslint-config-prettier": "^8.8.0",
75
82
  "eslint-plugin-import": "^2.27.5",
76
83
  "eslint-plugin-jsx-a11y": "^6.7.1",
84
+ "eslint-plugin-prettier": "^4.2.1",
77
85
  "eslint-plugin-react": "^7.32.2",
78
86
  "eslint-plugin-react-hooks": "^4.6.0",
79
87
  "eslint-plugin-storybook": "^0.6.11",
80
88
  "file-loader": "^6.2.0",
81
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",
82
94
  "lint-staged": "^13.2.0",
83
95
  "mini-css-extract-plugin": "^2.7.5",
84
96
  "postcss": "^8.4.21",
85
97
  "postcss-loader": "^7.1.0",
86
98
  "prettier": "^2.8.7",
87
- "react": "17.0.2",
88
- "react-dom": "17.0.2",
99
+ "react": "18.2.0",
100
+ "react-dom": "18.2.0",
89
101
  "react-fast-compare": "^3.2.1",
102
+ "react-i18next": "^12.2.0",
90
103
  "sass": "^1.60.0",
91
104
  "sass-loader": "^13.2.2",
92
105
  "style-loader": "^3.3.2",
93
106
  "styled-components": "^5.3.9",
94
107
  "terser-webpack-plugin": "^5.3.7",
108
+ "ts-jest": "^29.1.0",
95
109
  "ts-loader": "^9.4.2",
96
110
  "ts-node": "^10.9.1",
97
111
  "tsconfig-paths-webpack-plugin": "^4.0.1",