@vendorflow/components 2.1.0 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/lib/components/index.d.ts +1 -1
  2. package/lib/components/material-ui/DataTable/Data.d.ts +1 -1
  3. package/lib/components/material-ui/DataTable/DataTable.d.ts +9 -76
  4. package/lib/components/material-ui/DataTable/FilterTool/Filters/MultiSelectFilter.d.ts +1 -1
  5. package/lib/components/material-ui/DataTable/FilterTool/Filters/RangeFilter.d.ts +1 -1
  6. package/lib/components/material-ui/DataTable/FilterTool/Filters/SingleSelectFilter.d.ts +1 -1
  7. package/lib/components/material-ui/DataTable/FilterTool/Filters/TextFilter.d.ts +1 -1
  8. package/lib/components/material-ui/DataTable/FilterTool/index.d.ts +2 -2
  9. package/lib/components/material-ui/DataTable/TablePieces/BodyRow.d.ts +1 -1
  10. package/lib/components/material-ui/DataTable/TablePieces/HeaderCell.d.ts +1 -1
  11. package/lib/components/material-ui/DataTable/TablePieces/Toolbar.d.ts +1 -1
  12. package/lib/components/material-ui/DataTable/index.d.ts +1 -1
  13. package/lib/index.js +3 -14
  14. package/lib/index.js.LICENSE.txt +35 -0
  15. package/lib/index.js.map +1 -0
  16. package/lib/types/DataTable.types.d.ts +69 -0
  17. package/lib/types/index.d.ts +1 -0
  18. package/package.json +20 -99
  19. package/lib/TempHooks.d.ts +0 -9
  20. package/lib/TempHooks.js +0 -25
  21. package/lib/components/InfiniteScroll/InfiniteScroll.d.ts +0 -16
  22. package/lib/components/InfiniteScroll/InfiniteScroll.js +0 -159
  23. package/lib/components/InfiniteScroll/index.d.ts +0 -1
  24. package/lib/components/InfiniteScroll/index.js +0 -8
  25. package/lib/components/blueprint/InputGroup/InputGroup.d.ts +0 -20
  26. package/lib/components/blueprint/InputGroup/InputGroup.js +0 -13
  27. package/lib/components/blueprint/InputGroup/InputGroup.story.d.ts +0 -2
  28. package/lib/components/blueprint/InputGroup/InputGroup.story.js +0 -11
  29. package/lib/components/blueprint/InputGroup/index.d.ts +0 -1
  30. package/lib/components/blueprint/InputGroup/index.js +0 -4
  31. package/lib/components/blueprint/InputSelect/InputSelect.d.ts +0 -51
  32. package/lib/components/blueprint/InputSelect/InputSelect.js +0 -98
  33. package/lib/components/blueprint/InputSelect/InputSelect.story.d.ts +0 -3
  34. package/lib/components/blueprint/InputSelect/InputSelect.story.js +0 -19
  35. package/lib/components/blueprint/InputSelect/index.d.ts +0 -1
  36. package/lib/components/blueprint/InputSelect/index.js +0 -4
  37. package/lib/components/blueprint/InputTime/InputTime.d.ts +0 -24
  38. package/lib/components/blueprint/InputTime/InputTime.js +0 -28
  39. package/lib/components/blueprint/InputTime/InputTime.story.d.ts +0 -2
  40. package/lib/components/blueprint/InputTime/InputTime.story.js +0 -11
  41. package/lib/components/blueprint/InputTime/index.d.ts +0 -1
  42. package/lib/components/blueprint/InputTime/index.js +0 -4
  43. package/lib/components/index.js +0 -32
  44. package/lib/components/material-ui/AudioPlayer/AudioPlayer.js +0 -111
  45. package/lib/components/material-ui/AudioPlayer/AudioPlayer.story.js +0 -9
  46. package/lib/components/material-ui/AudioPlayer/index.js +0 -8
  47. package/lib/components/material-ui/Button/Button.js +0 -38
  48. package/lib/components/material-ui/Button/Button.story.js +0 -9
  49. package/lib/components/material-ui/Button/index.js +0 -8
  50. package/lib/components/material-ui/ButtonMenu/ButtonMenu.js +0 -115
  51. package/lib/components/material-ui/ButtonMenu/ButtonMenu.story.js +0 -79
  52. package/lib/components/material-ui/ButtonMenu/index.js +0 -8
  53. package/lib/components/material-ui/ChatInterface/ActionsMenu.d.ts +0 -4
  54. package/lib/components/material-ui/ChatInterface/ActionsMenu.js +0 -37
  55. package/lib/components/material-ui/ChatInterface/ChatInterface.d.ts +0 -33
  56. package/lib/components/material-ui/ChatInterface/ChatInterface.js +0 -109
  57. package/lib/components/material-ui/ChatInterface/ChatInterface.story.d.ts +0 -1
  58. package/lib/components/material-ui/ChatInterface/ChatInterface.story.js +0 -134
  59. package/lib/components/material-ui/ChatInterface/MessageInput.d.ts +0 -9
  60. package/lib/components/material-ui/ChatInterface/MessageInput.js +0 -53
  61. package/lib/components/material-ui/ChatInterface/MessageItem.d.ts +0 -8
  62. package/lib/components/material-ui/ChatInterface/MessageItem.js +0 -71
  63. package/lib/components/material-ui/ChatInterface/MessageThread.d.ts +0 -6
  64. package/lib/components/material-ui/ChatInterface/MessageThread.js +0 -119
  65. package/lib/components/material-ui/ChatInterface/index.d.ts +0 -1
  66. package/lib/components/material-ui/ChatInterface/index.js +0 -8
  67. package/lib/components/material-ui/ColorPicker/ColorPicker.js +0 -86
  68. package/lib/components/material-ui/ColorPicker/ColorPicker.story.js +0 -47
  69. package/lib/components/material-ui/ColorPicker/index.js +0 -8
  70. package/lib/components/material-ui/ColorPicker/styles.js +0 -24
  71. package/lib/components/material-ui/DataTable/AppliedFilters.d.ts +0 -12
  72. package/lib/components/material-ui/DataTable/AppliedFilters.js +0 -26
  73. package/lib/components/material-ui/DataTable/Data.js +0 -42
  74. package/lib/components/material-ui/DataTable/DataTable.js +0 -363
  75. package/lib/components/material-ui/DataTable/DataTable.story.js +0 -76
  76. package/lib/components/material-ui/DataTable/FilterTool/Filters/MultiSelectFilter.js +0 -63
  77. package/lib/components/material-ui/DataTable/FilterTool/Filters/RangeFilter.js +0 -76
  78. package/lib/components/material-ui/DataTable/FilterTool/Filters/SingleSelectFilter.js +0 -69
  79. package/lib/components/material-ui/DataTable/FilterTool/Filters/TextFilter.js +0 -52
  80. package/lib/components/material-ui/DataTable/FilterTool/index.js +0 -78
  81. package/lib/components/material-ui/DataTable/GlobalSearchFilter.d.ts +0 -10
  82. package/lib/components/material-ui/DataTable/GlobalSearchFilter.js +0 -49
  83. package/lib/components/material-ui/DataTable/IndeterminateCheckbox.d.ts +0 -4
  84. package/lib/components/material-ui/DataTable/IndeterminateCheckbox.js +0 -65
  85. package/lib/components/material-ui/DataTable/SortIndicator.d.ts +0 -10
  86. package/lib/components/material-ui/DataTable/SortIndicator.js +0 -33
  87. package/lib/components/material-ui/DataTable/TablePieces/AppliedFilters.js +0 -26
  88. package/lib/components/material-ui/DataTable/TablePieces/BodyCell.js +0 -50
  89. package/lib/components/material-ui/DataTable/TablePieces/BodyRow.js +0 -88
  90. package/lib/components/material-ui/DataTable/TablePieces/GlobalSearchFilter.js +0 -49
  91. package/lib/components/material-ui/DataTable/TablePieces/HeaderCell.js +0 -57
  92. package/lib/components/material-ui/DataTable/TablePieces/IndeterminateCheckbox.js +0 -65
  93. package/lib/components/material-ui/DataTable/TablePieces/SortIndicator.js +0 -33
  94. package/lib/components/material-ui/DataTable/TablePieces/Table.js +0 -47
  95. package/lib/components/material-ui/DataTable/TablePieces/TableBodyContent.js +0 -89
  96. package/lib/components/material-ui/DataTable/TablePieces/Toolbar.js +0 -59
  97. package/lib/components/material-ui/DataTable/TablePieces/ViewColumnTool.js +0 -77
  98. package/lib/components/material-ui/DataTable/Toolbar.d.ts +0 -24
  99. package/lib/components/material-ui/DataTable/Toolbar.js +0 -63
  100. package/lib/components/material-ui/DataTable/Utils.d.ts +0 -25
  101. package/lib/components/material-ui/DataTable/Utils.js +0 -119
  102. package/lib/components/material-ui/DataTable/ViewColumnTool.d.ts +0 -11
  103. package/lib/components/material-ui/DataTable/ViewColumnTool.js +0 -76
  104. package/lib/components/material-ui/DataTable/index.js +0 -8
  105. package/lib/components/material-ui/ErrorBoundary/ErrorBoundary.d.ts +0 -7
  106. package/lib/components/material-ui/ErrorBoundary/ErrorBoundary.js +0 -20
  107. package/lib/components/material-ui/ErrorBoundary/index.d.ts +0 -1
  108. package/lib/components/material-ui/ErrorBoundary/index.js +0 -8
  109. package/lib/components/material-ui/InputCheckboxGroup/InputCheckboxGroup.js +0 -99
  110. package/lib/components/material-ui/InputCheckboxGroup/InputCheckboxGroup.story.js +0 -52
  111. package/lib/components/material-ui/InputCheckboxGroup/index.js +0 -8
  112. package/lib/components/material-ui/InputDate/InputDate.js +0 -93
  113. package/lib/components/material-ui/InputDate/InputDate.story.js +0 -53
  114. package/lib/components/material-ui/InputDate/index.js +0 -8
  115. package/lib/components/material-ui/InputDateTime/InputDateTime.js +0 -82
  116. package/lib/components/material-ui/InputDateTime/InputDateTime.story.js +0 -53
  117. package/lib/components/material-ui/InputDateTime/index.js +0 -8
  118. package/lib/components/material-ui/InputGroup/InputGroup.js +0 -91
  119. package/lib/components/material-ui/InputGroup/InputGroup.story.js +0 -50
  120. package/lib/components/material-ui/InputGroup/index.js +0 -8
  121. package/lib/components/material-ui/InputRadioGroup/InputRadioGroup.js +0 -82
  122. package/lib/components/material-ui/InputRadioGroup/InputRadioGroup.story.js +0 -52
  123. package/lib/components/material-ui/InputRadioGroup/index.js +0 -8
  124. package/lib/components/material-ui/InputSearchDropdown/InputSearchDropdown.js +0 -146
  125. package/lib/components/material-ui/InputSearchDropdown/InputSearchDropdown.story.js +0 -66
  126. package/lib/components/material-ui/InputSearchDropdown/index.js +0 -8
  127. package/lib/components/material-ui/InputTime/InputTime.js +0 -82
  128. package/lib/components/material-ui/InputTime/InputTime.story.js +0 -53
  129. package/lib/components/material-ui/InputTime/index.js +0 -8
  130. package/lib/components/material-ui/Modal/Modal.js +0 -57
  131. package/lib/components/material-ui/Modal/Modal.story.js +0 -83
  132. package/lib/components/material-ui/Modal/index.js +0 -8
  133. package/lib/services/Select.service.d.ts +0 -5
  134. package/lib/services/Select.service.js +0 -67
  135. package/lib/stories/0-Inputs.stories.d.ts +0 -17
  136. package/lib/stories/0-Inputs.stories.js +0 -38
  137. package/lib/types/Component.types.js +0 -2
  138. package/lib/types/Internal.types.js +0 -2
  139. package/lib/types/index.js +0 -13
@@ -0,0 +1,69 @@
1
+ import { Column, UseSortByColumnProps, HeaderGroup, UseSortByOptions, TableOptions, UseSortByColumnOptions, UsePaginationOptions, UseSortByInstanceProps, UsePaginationInstanceProps, TableInstance, TableState, UseSortByState, UsePaginationState, UseRowSelectOptions, UseRowSelectInstanceProps, UseRowSelectState, Row, UseRowSelectRowProps, UseExpandedOptions, UseExpandedInstanceProps, UseExpandedState, UseExpandedRowProps, UseGlobalFiltersInstanceProps, UseGlobalFiltersState, UseFiltersOptions, UseFiltersInstanceProps, UseFiltersState, UseFiltersColumnOptions, UseFiltersColumnProps, UseTableOptions, UseGlobalFiltersOptions, UseResizeColumnsColumnOptions, UseResizeColumnsColumnProps, UseResizeColumnsState } from 'react-table';
2
+ export declare type Mode = 'single' | 'multi';
3
+ export declare type CustomColumnConfigProps<D extends object> = {
4
+ name?: string;
5
+ filterName?: string;
6
+ columns?: EnhancedColumn<D>[];
7
+ };
8
+ export declare type EnhancedHeader<D extends object> = HeaderGroup<D> & UseFiltersColumnProps<D> & UseSortByColumnProps<D> & UseResizeColumnsColumnProps<D> & CustomColumnConfigProps<D>;
9
+ export declare type EnhancedTableOptions<D extends object> = TableOptions<D> & UseExpandedOptions<D> & UseFiltersOptions<D> & UseGlobalFiltersOptions<D> & UseSortByOptions<D> & UsePaginationOptions<D> & UseRowSelectOptions<D>;
10
+ export declare type EnhancedTableInstance<D extends object> = Omit<TableInstance<D>, 'state'> & UseExpandedInstanceProps<D> & UseFiltersInstanceProps<D> & UseGlobalFiltersInstanceProps<D> & UseSortByInstanceProps<D> & UsePaginationInstanceProps<D> & UseRowSelectInstanceProps<D> & {
11
+ state: EnhancedTableState<D>;
12
+ };
13
+ export declare type EnhancedTableState<D extends object> = TableState<D> & UseExpandedState<D> & UseFiltersState<D> & UseGlobalFiltersState<D> & UseSortByState<D> & UsePaginationState<D> & UseRowSelectState<D> & UseResizeColumnsState<D>;
14
+ export declare type EnhancedColumn<D extends object> = CustomColumnConfigProps<D> & Partial<Omit<Column<D>, 'columns'>> & Partial<UseFiltersColumnOptions<D>> & Partial<UseSortByColumnOptions<D>> & Partial<UseResizeColumnsColumnOptions<D>>;
15
+ export declare type EnhancedRow<D extends object> = Row<D> & UseExpandedRowProps<D> & UseRowSelectRowProps<D>;
16
+ export interface TableFeatureOptions<D extends object> {
17
+ rowExpanding?: {
18
+ enabled: boolean;
19
+ mode: Mode;
20
+ /** @deprecated Use the ExpandedRow component prop instead. */
21
+ Component?: (props: {
22
+ data: D;
23
+ }) => JSX.Element;
24
+ autoResetExpanded?: boolean;
25
+ };
26
+ filters?: {
27
+ enabled: boolean;
28
+ };
29
+ globalSearch?: {
30
+ enabled: boolean;
31
+ setGlobalFilter?: (filterValue: any) => void | Promise<void>;
32
+ };
33
+ columnHiding?: {
34
+ enabled: boolean;
35
+ };
36
+ columnResizing?: {
37
+ enabled: boolean;
38
+ };
39
+ pagination?: {
40
+ enabled: boolean;
41
+ pageSize?: number;
42
+ rowsPerPageOptions?: number[];
43
+ };
44
+ rowSelect?: {
45
+ enabled: boolean;
46
+ mode: Mode;
47
+ };
48
+ sorting?: {
49
+ enabled: boolean;
50
+ };
51
+ table?: {
52
+ flexLayoutEnabled?: boolean;
53
+ hideToolbar?: boolean;
54
+ getRowId?: UseTableOptions<D>['getRowId'];
55
+ getRowClassName?: (rowId: string) => string;
56
+ };
57
+ virtualize?: {
58
+ enabled: boolean;
59
+ defaultRowHeight?: number;
60
+ };
61
+ }
62
+ export declare type FilterType = 'text' | 'select' | 'multi-select' | 'range';
63
+ export interface UseDefaultTableInstanceProps<D extends object> {
64
+ columns: EnhancedColumn<D>[];
65
+ data: D[];
66
+ options?: TableFeatureOptions<D>;
67
+ initialState?: Partial<EnhancedTableState<D>>;
68
+ defaultColumn?: Partial<Column<D>>;
69
+ }
@@ -1 +1,2 @@
1
1
  export * from './Component.types';
2
+ export * from './DataTable.types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendorflow/components",
3
- "version": "2.1.0",
3
+ "version": "3.0.4",
4
4
  "description": "React components for vendorflow",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -11,23 +11,17 @@
11
11
  "lib/**/*"
12
12
  ],
13
13
  "scripts": {
14
- "start": "node scripts/start.js",
15
- "build": "node scripts/build.js",
16
- "test": "node scripts/test.js",
14
+ "build": "webpack && tsc",
17
15
  "storybook": "start-storybook -p 9009 -s public",
18
16
  "build-storybook": "build-storybook -s public",
19
- "build:npm": "tsc",
20
17
  "format": "prettier --write \"src/**/*.ts\"",
21
18
  "lint": "eslint 'src/**/*.{js,ts,tsx}' --quiet --fix",
22
- "prepare": "npm run build:npm",
19
+ "prepare": "npm run build",
23
20
  "prepublishOnly": "npm run lint",
24
21
  "preversion": "npm run lint",
25
22
  "version": "npm run format && git add -A src",
26
23
  "postversion": "git push && git push --tags"
27
24
  },
28
- "eslintConfig": {
29
- "extends": "react-app"
30
- },
31
25
  "browserslist": {
32
26
  "production": [
33
27
  ">0.2%",
@@ -41,21 +35,9 @@
41
35
  ]
42
36
  },
43
37
  "dependencies": {
44
- "@babel/core": "^7.15.8",
45
38
  "@date-io/date-fns": "1.x",
46
- "@emotion/babel-plugin": "^11.3.0",
47
- "@emotion/react": "^11.4.0",
48
- "@emotion/styled": "^11.3.0",
49
- "@mui/icons-material": "^5.2.1",
50
- "@mui/lab": "^5.0.0-alpha.50",
51
- "@mui/material": "^5.0.3",
52
- "@mui/styles": "^5.0.1",
53
39
  "@svgr/webpack": "4.3.3",
54
- "@testing-library/jest-dom": "^4.2.4",
55
- "@testing-library/react": "^9.3.2",
56
- "@testing-library/user-event": "^7.1.2",
57
40
  "@types/faker": "^5.5.8",
58
- "@types/jest": "^24.0.0",
59
41
  "@types/node": "^12.0.0",
60
42
  "@types/react": "^17.0.27",
61
43
  "@types/react-dom": "^17.0.9",
@@ -63,21 +45,9 @@
63
45
  "@typescript-eslint/eslint-plugin": "^4.32.0",
64
46
  "@typescript-eslint/parser": "^4.32.0",
65
47
  "@vendorflow/common": "^1.0.50",
66
- "babel-eslint": "10.1.0",
67
- "babel-jest": "^24.9.0",
68
- "babel-loader": "^8.2.2",
69
- "babel-plugin-named-asset-import": "^0.3.6",
70
- "babel-plugin-polyfill-corejs2": "^0.2.2",
71
- "babel-plugin-polyfill-corejs3": "^0.2.5",
72
- "babel-plugin-polyfill-regenerator": "^0.2.2",
73
- "babel-preset-react-app": "^10.0.0",
74
- "camelcase": "^5.3.1",
75
- "case-sensitive-paths-webpack-plugin": "2.3.0",
76
48
  "classnames": "^2.3.1",
77
49
  "css-loader": "3.4.2",
78
50
  "date-fns": "^2.12.0",
79
- "dotenv": "8.2.0",
80
- "dotenv-expand": "5.1.0",
81
51
  "eslint": "^7.32.0",
82
52
  "eslint-config-react-app": "^6.0.0",
83
53
  "eslint-loader": "3.0.3",
@@ -88,14 +58,8 @@
88
58
  "eslint-plugin-react-hooks": "^4.2.0",
89
59
  "faker": "^5.5.3",
90
60
  "file-loader": "4.3.0",
91
- "fs-extra": "^8.1.0",
92
61
  "html-webpack-plugin": "4.0.0-beta.11",
93
- "identity-obj-proxy": "3.0.0",
94
62
  "immer": "^9.0.6",
95
- "jest": "24.9.0",
96
- "jest-environment-jsdom-fourteen": "1.0.1",
97
- "jest-resolve": "24.9.0",
98
- "jest-watch-typeahead": "0.4.2",
99
63
  "lodash": "^4.17.15",
100
64
  "material-ui-popup-state": "^2.0.0",
101
65
  "mini-css-extract-plugin": "0.9.0",
@@ -107,11 +71,9 @@
107
71
  "postcss-normalize": "8.0.1",
108
72
  "postcss-preset-env": "6.7.0",
109
73
  "postcss-safe-parser": "4.0.1",
110
- "react": "^17.0.2",
111
74
  "react-app-polyfill": "^1.0.6",
112
75
  "react-color-palette": "^6.1.0",
113
76
  "react-dev-utils": "^10.2.1",
114
- "react-dom": "^17.0.2",
115
77
  "react-h5-audio-player": "^3.8.1",
116
78
  "react-measure": "^2.5.2",
117
79
  "react-scripts": "^4.0.3",
@@ -130,14 +92,18 @@
130
92
  "ts-pnp": "1.1.6",
131
93
  "typescript": "^4.4.3",
132
94
  "url-loader": "2.3.0",
133
- "webpack": "4.42.0",
95
+ "webpack": "^5.68.0",
134
96
  "webpack-dev-server": "3.10.3",
135
97
  "webpack-manifest-plugin": "2.2.0",
136
98
  "workbox-webpack-plugin": "4.3.1"
137
99
  },
138
100
  "devDependencies": {
139
101
  "@babel/cli": "^7.15.7",
102
+ "@babel/core": "^7.22.5",
103
+ "@babel/preset-env": "^7.22.5",
140
104
  "@babel/preset-react": "^7.9.4",
105
+ "@babel/preset-typescript": "^7.22.5",
106
+ "@emotion/babel-plugin": "^11.3.0",
141
107
  "@storybook/addon-actions": "^6.5.14",
142
108
  "@storybook/addon-knobs": "^6.3.1",
143
109
  "@storybook/addon-links": "^6.5.14",
@@ -148,69 +114,24 @@
148
114
  "@types/react-measure": "^2.0.7",
149
115
  "@types/react-text-mask": "^5.4.6",
150
116
  "@types/react-virtualized": "^9.21.21",
117
+ "babel-loader": "^9.1.2",
151
118
  "eslint-config-prettier": "^8.3.0",
152
119
  "eslint-plugin-prettier": "^3.4.0",
153
120
  "eslint-plugin-storybook": "^0.6.8",
154
121
  "eslint-webpack-plugin": "^2.5.4",
155
122
  "prettier": "^2.0.5",
156
123
  "tslint": "^6.1.2",
157
- "tslint-config-prettier": "^1.18.0"
158
- },
159
- "jest": {
160
- "roots": [
161
- "<rootDir>/src"
162
- ],
163
- "collectCoverageFrom": [
164
- "src/**/*.{js,jsx,ts,tsx}",
165
- "!src/**/*.d.ts"
166
- ],
167
- "setupFiles": [
168
- "react-app-polyfill/jsdom"
169
- ],
170
- "setupFilesAfterEnv": [
171
- "<rootDir>/src/setupTests.ts"
172
- ],
173
- "testMatch": [
174
- "<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
175
- "<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
176
- ],
177
- "testEnvironment": "jest-environment-jsdom-fourteen",
178
- "transform": {
179
- "^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
180
- "^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
181
- "^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
182
- },
183
- "transformIgnorePatterns": [
184
- "[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$",
185
- "^.+\\.module\\.(css|sass|scss)$"
186
- ],
187
- "modulePaths": [
188
- "D:\\Documents\\Projects\\vendorflow-components\\src"
189
- ],
190
- "moduleNameMapper": {
191
- "^react-native$": "react-native-web",
192
- "^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy"
193
- },
194
- "moduleFileExtensions": [
195
- "web.js",
196
- "js",
197
- "web.ts",
198
- "ts",
199
- "web.tsx",
200
- "tsx",
201
- "json",
202
- "web.jsx",
203
- "jsx",
204
- "node"
205
- ],
206
- "watchPlugins": [
207
- "jest-watch-typeahead/filename",
208
- "jest-watch-typeahead/testname"
209
- ]
124
+ "tslint-config-prettier": "^1.18.0",
125
+ "webpack-cli": "^5.1.4"
210
126
  },
211
- "babel": {
212
- "presets": [
213
- "react-app"
214
- ]
127
+ "peerDependencies": {
128
+ "@emotion/react": "^11.4.0",
129
+ "@emotion/styled": "^11.3.0",
130
+ "@mui/icons-material": "^5.2.1",
131
+ "@mui/lab": "^5.0.0-alpha.50",
132
+ "@mui/material": "^5.0.3",
133
+ "@mui/styles": "^5.0.1",
134
+ "react": "^17.0.2",
135
+ "react-dom": "^17.0.2"
215
136
  }
216
137
  }
@@ -1,9 +0,0 @@
1
- import { RefObject } from 'react';
2
- interface UseInfiniteScrollProps {
3
- parentEl?: RefObject<HTMLDivElement>;
4
- isLoading?: boolean;
5
- hasMore?: boolean;
6
- loadMore?: () => Promise<void> | void;
7
- }
8
- export declare function useInfiniteScroll({ parentEl, isLoading, hasMore, loadMore }: UseInfiniteScrollProps): (node: any) => void;
9
- export {};
package/lib/TempHooks.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useInfiniteScroll = void 0;
4
- var react_1 = require("react");
5
- function useInfiniteScroll(_a) {
6
- var parentEl = _a.parentEl, isLoading = _a.isLoading, hasMore = _a.hasMore, loadMore = _a.loadMore;
7
- var observer = (0, react_1.useRef)();
8
- return (0, react_1.useCallback)(function (node) {
9
- if (isLoading)
10
- return;
11
- if (observer.current)
12
- observer.current.disconnect();
13
- observer.current = new IntersectionObserver(function (entries) {
14
- if (entries[0].isIntersecting && hasMore && loadMore) {
15
- loadMore();
16
- }
17
- }, {
18
- root: (parentEl === null || parentEl === void 0 ? void 0 : parentEl.current) || null,
19
- threshold: 1.0,
20
- });
21
- if (node)
22
- observer.current.observe(node);
23
- }, [isLoading, hasMore, loadMore, parentEl]);
24
- }
25
- exports.useInfiniteScroll = useInfiniteScroll;
@@ -1,16 +0,0 @@
1
- /** @jsxRuntime classic */
2
- /** @jsx jsx */
3
- import { jsx } from '@emotion/react';
4
- import { MutableRefObject, ReactElement } from 'react';
5
- interface Props {
6
- children: ReactElement[];
7
- scrollParent: MutableRefObject<HTMLDivElement | null>;
8
- isLoading?: boolean;
9
- isFetching?: boolean;
10
- isReverse?: boolean;
11
- hasNextPage?: boolean;
12
- fetchNextPage?: () => Promise<any> | any;
13
- Loader?: ReactElement;
14
- }
15
- export default function InfiniteScroll({ children, scrollParent, isLoading, isFetching, isReverse, hasNextPage, fetchNextPage, Loader, }: Props): jsx.JSX.Element;
16
- export {};
@@ -1,159 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __read = (this && this.__read) || function (o, n) {
7
- var m = typeof Symbol === "function" && o[Symbol.iterator];
8
- if (!m) return o;
9
- var i = m.call(o), r, ar = [], e;
10
- try {
11
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
12
- }
13
- catch (error) { e = { error: error }; }
14
- finally {
15
- try {
16
- if (r && !r.done && (m = i["return"])) m.call(i);
17
- }
18
- finally { if (e) throw e.error; }
19
- }
20
- return ar;
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- /** @jsxRuntime classic */
24
- /** @jsx jsx */
25
- var react_1 = require("@emotion/react");
26
- var react_2 = require("react");
27
- var material_1 = require("@mui/material");
28
- function InfiniteScroll(_a) {
29
- var children = _a.children, scrollParent = _a.scrollParent, isLoading = _a.isLoading, isFetching = _a.isFetching, isReverse = _a.isReverse, hasNextPage = _a.hasNextPage, fetchNextPage = _a.fetchNextPage, Loader = _a.Loader;
30
- var _b = __read((0, react_2.useState)(false), 2), isLoadMoreFetch = _b[0], setLoadMoreFetch = _b[1];
31
- var scrollBody = (0, react_2.useRef)(null);
32
- var loadMoreRef = useInfiniteScroll({
33
- scrollParent: scrollParent,
34
- scrollBody: scrollBody,
35
- isReverse: isReverse,
36
- isLoading: isLoading,
37
- isFetching: isFetching,
38
- hasNextPage: hasNextPage,
39
- fetchNextPage: fetchNextPageAndSetFlag,
40
- });
41
- (0, react_2.useEffect)(function () {
42
- if (!isFetching) {
43
- setLoadMoreFetch(false);
44
- }
45
- }, [isFetching]);
46
- function fetchNextPageAndSetFlag() {
47
- if (fetchNextPage) {
48
- fetchNextPage();
49
- setLoadMoreFetch(true);
50
- }
51
- }
52
- function renderLoader() {
53
- if (!hasNextPage) {
54
- return null;
55
- }
56
- if (Loader) {
57
- return ((0, react_1.jsx)(react_1.ClassNames, null, function (_a) {
58
- var css = _a.css;
59
- return (0, react_2.cloneElement)(Loader, {
60
- ref: loadMoreRef,
61
- className: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n && {\n visibility: ", ";\n }\n "], ["\n && {\n visibility: ", ";\n }\n "])), isFetching && isLoadMoreFetch ? 'visible' : 'hidden'),
62
- });
63
- }));
64
- }
65
- else {
66
- return ((0, react_1.jsx)(DefaultLoader, { css: (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n && {\n visibility: ", ";\n }\n "], ["\n && {\n visibility: ", ";\n }\n "])), isFetching && isLoadMoreFetch ? 'visible' : 'hidden'), ref: loadMoreRef }));
67
- }
68
- }
69
- return ((0, react_1.jsx)("div", { css: (0, react_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n flex-direction: ", ";\n justify-content: flex-start;\n align-items: flex-start;\n "], ["\n display: flex;\n flex-direction: ", ";\n justify-content: flex-start;\n align-items: flex-start;\n "])), isReverse ? 'column-reverse' : 'column'), ref: scrollBody },
70
- children,
71
- renderLoader()));
72
- }
73
- exports.default = InfiniteScroll;
74
- var DefaultLoader = (0, react_2.forwardRef)(function (_a, ref) {
75
- var className = _a.className, style = _a.style;
76
- return ((0, react_1.jsx)("div", { key: "loader", className: className, style: style, ref: ref, css: (0, react_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 100%;\n margin: 0.5rem 0;\n height: auto;\n display: flex;\n justify-content: center;\n align-items: center;\n "], ["\n width: 100%;\n margin: 0.5rem 0;\n height: auto;\n display: flex;\n justify-content: center;\n align-items: center;\n "]))) },
77
- (0, react_1.jsx)(material_1.CircularProgress, { size: "1.5rem", disableShrink: true })));
78
- });
79
- function useInfiniteScroll(_a) {
80
- var _b, _c, _d, _e;
81
- var scrollParent = _a.scrollParent, scrollBody = _a.scrollBody, isLoading = _a.isLoading, isFetching = _a.isFetching, isReverse = _a.isReverse, hasNextPage = _a.hasNextPage, fetchNextPage = _a.fetchNextPage;
82
- var prevPosition = (0, react_2.useRef)();
83
- var observer = (0, react_2.useRef)();
84
- var _f = __read((0, react_2.useState)(false), 2), isScrollInit = _f[0], setScrollInit = _f[1];
85
- var _g = __read((0, react_2.useState)(false), 2), isScrollLoad = _g[0], setScrollLoad = _g[1];
86
- var hasScrollbar = (0, react_2.useMemo)(function () {
87
- if (scrollParent.current && scrollBody.current) {
88
- return scrollBody.current.clientHeight > scrollParent.current.clientHeight;
89
- }
90
- return false;
91
- }, [(_b = scrollParent.current) === null || _b === void 0 ? void 0 : _b.clientHeight, (_c = scrollBody.current) === null || _c === void 0 ? void 0 : _c.clientHeight]);
92
- // Ensures that when the chat initializes, it will scroll to the bottom
93
- (0, react_2.useEffect)(function () {
94
- if (!isLoading && hasScrollbar) {
95
- prevPosition.current = null;
96
- setScrollLoad(false);
97
- scrollToStart();
98
- }
99
- }, [isLoading, hasScrollbar]);
100
- // If a fetch happens that was not started by a scroll action (aka fetchNextPage),
101
- // then this will track the prevPosition
102
- (0, react_2.useEffect)(function () {
103
- if (!isScrollLoad && scrollBody.current && isFetching) {
104
- prevPosition.current = scrollBody.current.clientHeight;
105
- }
106
- }, [isFetching, isScrollLoad, (_d = scrollBody.current) === null || _d === void 0 ? void 0 : _d.clientHeight]);
107
- // This will potentially scroll the page to the start when the page loads new data that did not
108
- // originate from a fetchNextPage action
109
- (0, react_2.useEffect)(function () {
110
- if (!isScrollLoad &&
111
- isReverse &&
112
- scrollBody.current &&
113
- prevPosition.current != null &&
114
- scrollBody.current.clientHeight - prevPosition.current <= 200) {
115
- prevPosition.current = null;
116
- scrollToStart();
117
- }
118
- }, [isScrollLoad, (_e = scrollBody.current) === null || _e === void 0 ? void 0 : _e.clientHeight]);
119
- function scrollToStart() {
120
- var _a;
121
- var scrollHeight = (scrollBody.current || { scrollHeight: 0 }).scrollHeight;
122
- var scrollToValue = isReverse ? scrollHeight : 0;
123
- (_a = scrollParent.current) === null || _a === void 0 ? void 0 : _a.scrollTo(0, scrollToValue);
124
- setScrollInit(true);
125
- }
126
- // this callback is used and fired based on the state of the element it is attached to
127
- return (0, react_2.useCallback)(function (node) {
128
- if (isLoading || isFetching) {
129
- return;
130
- }
131
- if (observer.current) {
132
- observer.current.disconnect();
133
- }
134
- observer.current = new IntersectionObserver(function (entries) {
135
- if (entries[0].isIntersecting && hasNextPage && fetchNextPage) {
136
- if (scrollBody.current && isReverse && isScrollInit) {
137
- // save the last element, so that we can scroll to it after the new data loads in
138
- prevPosition.current = scrollBody.current.clientHeight;
139
- }
140
- // load the next page
141
- fetchNextPage();
142
- setScrollLoad(true);
143
- }
144
- }, {
145
- root: (scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) || null,
146
- threshold: 1.0,
147
- });
148
- if (node) {
149
- if (isReverse && scrollParent.current && prevPosition.current != null && isScrollLoad) {
150
- // If we had a prev position, then we want to scroll to it
151
- scrollParent.current.scrollTo(0, scrollBody.current.clientHeight - prevPosition.current);
152
- prevPosition.current = null;
153
- setScrollLoad(false);
154
- }
155
- observer.current.observe(node);
156
- }
157
- }, [isLoading, isFetching, isReverse, hasNextPage, fetchNextPage, scrollParent, scrollBody, isScrollInit, isScrollLoad]);
158
- }
159
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -1 +0,0 @@
1
- export { default } from './InfiniteScroll';
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = void 0;
7
- var InfiniteScroll_1 = require("./InfiniteScroll");
8
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(InfiniteScroll_1).default; } });
@@ -1,20 +0,0 @@
1
- import { ChangeEvent } from 'react';
2
- import { IIntentProps, IInputGroupProps } from '@blueprintjs/core';
3
- interface Props {
4
- id?: string;
5
- className?: string;
6
- disabled?: boolean;
7
- fill?: boolean;
8
- helperText?: string;
9
- intent?: IIntentProps['intent'];
10
- label?: string;
11
- labelInfo?: string;
12
- name?: string;
13
- onChange: (evt: ChangeEvent<HTMLInputElement>) => void;
14
- placeholder?: string;
15
- type?: string;
16
- value: IInputGroupProps['value'];
17
- hideCharCount?: boolean;
18
- }
19
- export default function InputGroup(props: Props): JSX.Element;
20
- export {};
@@ -1,13 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var react_1 = __importDefault(require("react"));
7
- var core_1 = require("@blueprintjs/core");
8
- function InputGroup(props) {
9
- var id = props.id, className = props.className, disabled = props.disabled, fill = props.fill, helperText = props.helperText, intent = props.intent, label = props.label, labelInfo = props.labelInfo, name = props.name, onChange = props.onChange, placeholder = props.placeholder, _a = props.type, type = _a === void 0 ? 'text' : _a, value = props.value;
10
- return (react_1.default.createElement(core_1.FormGroup, { className: className, helperText: helperText, intent: intent, label: label, labelFor: id, labelInfo: labelInfo, disabled: disabled },
11
- react_1.default.createElement(core_1.InputGroup, { fill: fill, id: id, intent: intent, name: name, onChange: onChange, placeholder: placeholder, type: type, value: value })));
12
- }
13
- exports.default = InputGroup;
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const InputGroup: () => JSX.Element;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var react_1 = __importDefault(require("react"));
7
- var addon_actions_1 = require("@storybook/addon-actions");
8
- var InputGroup_1 = __importDefault(require("./InputGroup"));
9
- exports.InputGroup = function () {
10
- return (react_1.default.createElement(InputGroup_1.default, { name: "name", label: "First Name", labelInfo: "(required)", value: "", intent: "danger", onChange: addon_actions_1.action('changed') }));
11
- };
@@ -1 +0,0 @@
1
- export { default } from './InputGroup';
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var InputGroup_1 = require("./InputGroup");
4
- exports.default = InputGroup_1.default;
@@ -1,51 +0,0 @@
1
- /// <reference types="react" />
2
- import { IIntentProps } from '@blueprintjs/core';
3
- import { ItemRenderer } from '@blueprintjs/select';
4
- import { SimpleEvent, InputValueRender, TagRender } from '../../../types/Component.types';
5
- declare type Props<T> = InputSuggestProps<T> | InputMultiSelectProps<T>;
6
- declare type InputSuggestProps<T> = {
7
- type: 'suggest';
8
- className?: string;
9
- disabled?: boolean;
10
- fill?: boolean;
11
- helperText?: string;
12
- id?: string;
13
- inputValueRenderer: InputValueRender<T>;
14
- intent?: IIntentProps['intent'];
15
- itemRenderer?: ItemRenderer<T>;
16
- items: T[];
17
- uniqueKey: string | ((item: T) => string | number);
18
- label?: string;
19
- labelInfo?: string;
20
- multi?: boolean;
21
- name?: string;
22
- onChange: (evt: SimpleEvent<T | T[]>) => void;
23
- placeholder?: string;
24
- selectedItem: T | null;
25
- selectedItems?: undefined;
26
- tagRenderer?: undefined;
27
- };
28
- declare type InputMultiSelectProps<T> = {
29
- type: 'multiselect';
30
- className?: string;
31
- disabled?: boolean;
32
- fill?: boolean;
33
- helperText?: string;
34
- id?: string;
35
- inputValueRenderer: InputValueRender<T>;
36
- intent?: IIntentProps['intent'];
37
- itemRenderer?: ItemRenderer<T>;
38
- items: T[];
39
- uniqueKey: string | ((item: T) => string | number);
40
- label?: string;
41
- labelInfo?: string;
42
- multi?: boolean;
43
- name?: string;
44
- onChange: (evt: SimpleEvent<T | T[]>) => void;
45
- placeholder?: string;
46
- selectedItem?: undefined;
47
- selectedItems: T[];
48
- tagRenderer?: TagRender<T>;
49
- };
50
- export default function InputSelect<T>(props: Props<T>): JSX.Element;
51
- export {};