@bigbinary/neeto-trash-frontend 3.1.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 (113) hide show
  1. package/README.md +185 -0
  2. package/app/javascript/src/translations/ar.json +32 -0
  3. package/app/javascript/src/translations/bg.json +32 -0
  4. package/app/javascript/src/translations/ca.json +32 -0
  5. package/app/javascript/src/translations/cs.json +32 -0
  6. package/app/javascript/src/translations/da.json +32 -0
  7. package/app/javascript/src/translations/de.json +32 -0
  8. package/app/javascript/src/translations/en.json +32 -0
  9. package/app/javascript/src/translations/es-MX.json +32 -0
  10. package/app/javascript/src/translations/es.json +32 -0
  11. package/app/javascript/src/translations/et.json +32 -0
  12. package/app/javascript/src/translations/fi.json +32 -0
  13. package/app/javascript/src/translations/fil.json +32 -0
  14. package/app/javascript/src/translations/fr.json +32 -0
  15. package/app/javascript/src/translations/he.json +32 -0
  16. package/app/javascript/src/translations/hi.json +32 -0
  17. package/app/javascript/src/translations/hr.json +32 -0
  18. package/app/javascript/src/translations/hu.json +32 -0
  19. package/app/javascript/src/translations/id.json +32 -0
  20. package/app/javascript/src/translations/index.js +3 -0
  21. package/app/javascript/src/translations/it.json +32 -0
  22. package/app/javascript/src/translations/ja.json +32 -0
  23. package/app/javascript/src/translations/ko.json +32 -0
  24. package/app/javascript/src/translations/nl.json +32 -0
  25. package/app/javascript/src/translations/pl.json +32 -0
  26. package/app/javascript/src/translations/pt-BR.json +32 -0
  27. package/app/javascript/src/translations/pt.json +32 -0
  28. package/app/javascript/src/translations/ro.json +32 -0
  29. package/app/javascript/src/translations/ru.json +32 -0
  30. package/app/javascript/src/translations/sk.json +32 -0
  31. package/app/javascript/src/translations/sl.json +32 -0
  32. package/app/javascript/src/translations/sv.json +32 -0
  33. package/app/javascript/src/translations/th.json +32 -0
  34. package/app/javascript/src/translations/tr.json +32 -0
  35. package/app/javascript/src/translations/uk.json +32 -0
  36. package/app/javascript/src/translations/vi.json +32 -0
  37. package/app/javascript/src/translations/zh-CN.json +32 -0
  38. package/app/javascript/src/translations/zh-TW.json +32 -0
  39. package/dist/.ready +1 -0
  40. package/dist/DeleteConfirmationAlert-CO3e6GqN.js +37 -0
  41. package/dist/DeleteConfirmationAlert-CO3e6GqN.js.map +1 -0
  42. package/dist/DeleteConfirmationAlert-Cpiz0Dyn.js +39 -0
  43. package/dist/DeleteConfirmationAlert-Cpiz0Dyn.js.map +1 -0
  44. package/dist/DeletePermanentlyAction.js +63 -0
  45. package/dist/DeletePermanentlyAction.js.map +1 -0
  46. package/dist/MoveToTrashAction.js +49 -0
  47. package/dist/MoveToTrashAction.js.map +1 -0
  48. package/dist/RestoreButton.js +47 -0
  49. package/dist/RestoreButton.js.map +1 -0
  50. package/dist/TrashBanner.js +28 -0
  51. package/dist/TrashBanner.js.map +1 -0
  52. package/dist/TrashList.js +329 -0
  53. package/dist/TrashList.js.map +1 -0
  54. package/dist/cjs/DeletePermanentlyAction.js +65 -0
  55. package/dist/cjs/DeletePermanentlyAction.js.map +1 -0
  56. package/dist/cjs/MoveToTrashAction.js +51 -0
  57. package/dist/cjs/MoveToTrashAction.js.map +1 -0
  58. package/dist/cjs/RestoreButton.js +49 -0
  59. package/dist/cjs/RestoreButton.js.map +1 -0
  60. package/dist/cjs/TrashBanner.js +30 -0
  61. package/dist/cjs/TrashBanner.js.map +1 -0
  62. package/dist/cjs/TrashList.js +331 -0
  63. package/dist/cjs/TrashList.js.map +1 -0
  64. package/dist/cjs/index.js +57 -0
  65. package/dist/cjs/index.js.map +1 -0
  66. package/dist/cjs/v2/DeletePermanentlyAction.js +64 -0
  67. package/dist/cjs/v2/DeletePermanentlyAction.js.map +1 -0
  68. package/dist/cjs/v2/MoveToTrashAction.js +51 -0
  69. package/dist/cjs/v2/MoveToTrashAction.js.map +1 -0
  70. package/dist/cjs/v2/RestoreButton.js +49 -0
  71. package/dist/cjs/v2/RestoreButton.js.map +1 -0
  72. package/dist/cjs/v2/TrashBanner.js +31 -0
  73. package/dist/cjs/v2/TrashBanner.js.map +1 -0
  74. package/dist/cjs/v2/TrashList.js +356 -0
  75. package/dist/cjs/v2/TrashList.js.map +1 -0
  76. package/dist/cjs/v2/index.js +48 -0
  77. package/dist/cjs/v2/index.js.map +1 -0
  78. package/dist/constants-BHoEWkzr.js +12 -0
  79. package/dist/constants-BHoEWkzr.js.map +1 -0
  80. package/dist/constants-D31SDP8c.js +8 -0
  81. package/dist/constants-D31SDP8c.js.map +1 -0
  82. package/dist/index-C3QMyI-t.js +39 -0
  83. package/dist/index-C3QMyI-t.js.map +1 -0
  84. package/dist/index-DNy0WI3h.js +37 -0
  85. package/dist/index-DNy0WI3h.js.map +1 -0
  86. package/dist/index.js +39 -0
  87. package/dist/index.js.map +1 -0
  88. package/dist/useConfirmedDelete-B0cAv2Ny.js +49 -0
  89. package/dist/useConfirmedDelete-B0cAv2Ny.js.map +1 -0
  90. package/dist/useConfirmedDelete-CUx3mFWB.js +47 -0
  91. package/dist/useConfirmedDelete-CUx3mFWB.js.map +1 -0
  92. package/dist/useTrashApi-88bP4rc1.js +92 -0
  93. package/dist/useTrashApi-88bP4rc1.js.map +1 -0
  94. package/dist/useTrashApi-DIlG3dId.js +86 -0
  95. package/dist/useTrashApi-DIlG3dId.js.map +1 -0
  96. package/dist/utils-CAHr5BB2.js +12 -0
  97. package/dist/utils-CAHr5BB2.js.map +1 -0
  98. package/dist/utils-f7lcIdEF.js +14 -0
  99. package/dist/utils-f7lcIdEF.js.map +1 -0
  100. package/dist/v2/DeletePermanentlyAction.js +62 -0
  101. package/dist/v2/DeletePermanentlyAction.js.map +1 -0
  102. package/dist/v2/MoveToTrashAction.js +49 -0
  103. package/dist/v2/MoveToTrashAction.js.map +1 -0
  104. package/dist/v2/RestoreButton.js +47 -0
  105. package/dist/v2/RestoreButton.js.map +1 -0
  106. package/dist/v2/TrashBanner.js +29 -0
  107. package/dist/v2/TrashBanner.js.map +1 -0
  108. package/dist/v2/TrashList.js +354 -0
  109. package/dist/v2/TrashList.js.map +1 -0
  110. package/dist/v2/index.js +30 -0
  111. package/dist/v2/index.js.map +1 -0
  112. package/package.json +248 -0
  113. package/types.d.ts +124 -0
package/package.json ADDED
@@ -0,0 +1,248 @@
1
+ {
2
+ "name": "@bigbinary/neeto-trash-frontend",
3
+ "version": "3.1.0",
4
+ "description": "A repo acts as the source of truth for the new nano's structure, configs, data etc.",
5
+ "license": "UNLICENSED",
6
+ "homepage": "https://github.com/bigbinary/neeto-trash-nano",
7
+ "bugs": {
8
+ "url": "https://github.com/bigbinary/neeto-trash-nano/issues"
9
+ },
10
+ "repository": "neeto-trash-nano",
11
+ "author": "BigBinary",
12
+ "files": [
13
+ "dist",
14
+ "types.d.ts",
15
+ "app/javascript/src/translations"
16
+ ],
17
+ "exports": {
18
+ ".": {
19
+ "import": "./dist/index.js",
20
+ "require": "./dist/cjs/index.js",
21
+ "types": "./types.d.ts"
22
+ },
23
+ "./*": {
24
+ "import": "./dist/*.js",
25
+ "require": "./dist/cjs/*.js",
26
+ "types": "./types.d.ts"
27
+ },
28
+ "./v2": {
29
+ "import": "./dist/v2/index.js",
30
+ "require": "./dist/cjs/v2/index.js",
31
+ "types": "./types.d.ts"
32
+ },
33
+ "./v2/*": {
34
+ "import": "./dist/v2/*.js",
35
+ "require": "./dist/cjs/v2/*.js",
36
+ "types": "./types.d.ts"
37
+ }
38
+ },
39
+ "main": "dist/index.cjs.js",
40
+ "module": "dist/index.js",
41
+ "types": "types.d.ts",
42
+ "scripts": {
43
+ "build": "NODE_ENV=production rollup --bundleConfigAsCjs -c --environment production",
44
+ "build-preview": "NODE_ENV=production webpack",
45
+ "prepare": "husky install",
46
+ "release": "yarn build && yalc push --sig"
47
+ },
48
+ "lint-staged": {
49
+ "./**/*.rb": [
50
+ "bundle exec rubocop -a --force-exclusion"
51
+ ],
52
+ "./**/app/javascript/**/*.{js,jsx,json}": [
53
+ "prettier --write",
54
+ "eslint --fix"
55
+ ],
56
+ "./test/dummy/**/app/javascript/**/*.{js,jsx,json}": [
57
+ "prettier --write",
58
+ "eslint --fix"
59
+ ],
60
+ "{Gemfile,Rakefile,config.ru}": [
61
+ "bundle exec rubocop -a --force-exclusion"
62
+ ]
63
+ },
64
+ "devDependencies": {
65
+ "@babel/core": "7.26.0",
66
+ "@babel/eslint-parser": "7.25.9",
67
+ "@babel/plugin-transform-runtime": "7.25.9",
68
+ "@babel/preset-env": "7.26.0",
69
+ "@babel/preset-react": "7.25.9",
70
+ "@babel/preset-typescript": "7.26.0",
71
+ "@babel/runtime": "7.29.2",
72
+ "@bigbinary/babel-preset-neeto": "^1.0.3",
73
+ "@bigbinary/eslint-plugin-neeto": "1.9.0",
74
+ "@bigbinary/neeto-atoms": "1.0.90",
75
+ "@bigbinary/neeto-cist": "1.0.17",
76
+ "@bigbinary/neeto-commons-frontend": "4.13.131",
77
+ "@bigbinary/neeto-filters-frontend": "4.3.39",
78
+ "@bigbinary/neeto-icons": "1.20.89",
79
+ "@bigbinary/neeto-molecules": "5.2.6",
80
+ "@bigbinary/neetoui": "8.8.1",
81
+ "@emotion/is-prop-valid": "1.2.0",
82
+ "@faker-js/faker": "8.2.0",
83
+ "@honeybadger-io/js": "6.10.1",
84
+ "@honeybadger-io/react": "6.1.25",
85
+ "@rollup/plugin-alias": "5.1.1",
86
+ "@rollup/plugin-babel": "6.1.0",
87
+ "@rollup/plugin-commonjs": "25.0.8",
88
+ "@rollup/plugin-json": "6.1.0",
89
+ "@rollup/plugin-node-resolve": "15.3.0",
90
+ "@rollup/plugin-replace": "5.0.4",
91
+ "@svgr/rollup": "8.1.0",
92
+ "@tailwindcss/postcss": "^4.1.17",
93
+ "@tanstack/react-query": "5.59.20",
94
+ "@tanstack/react-query-devtools": "5.59.20",
95
+ "antd": "5.22.1",
96
+ "autoprefixer": "^10.4.5",
97
+ "axios": "1.16.1",
98
+ "babel-loader": "^8.2.5",
99
+ "babel-plugin-istanbul": "^6.1.1",
100
+ "babel-plugin-js-logger": "1.0.17",
101
+ "babel-plugin-macros": "3.1.0",
102
+ "babel-plugin-module-resolver": "5.0.3",
103
+ "babel-plugin-preval": "^5.1.0",
104
+ "babel-plugin-transform-react-remove-prop-types": "0.4.24",
105
+ "babel-preset-react": "6.24.1",
106
+ "babel-preset-typescript": "^7.0.0-alpha.19",
107
+ "browserify-zlib": "0.2.0",
108
+ "buffer": "^6.0.3",
109
+ "classnames": "2.5.1",
110
+ "crypto-browserify": "3.12.1",
111
+ "css-loader": "6.8.1",
112
+ "dompurify": "3.4.7",
113
+ "dotenv-webpack": "^8.0.1",
114
+ "eslint": "^9.25.1",
115
+ "eslint-config-prettier": "^10.1.2",
116
+ "eslint-plugin-cypress": "2.12.1",
117
+ "eslint-plugin-import": "^2.31.0",
118
+ "eslint-plugin-jam3": "^0.2.3",
119
+ "eslint-plugin-json": "^4.0.1",
120
+ "eslint-plugin-prettier": "^5.2.6",
121
+ "eslint-plugin-promise": "^7.2.1",
122
+ "eslint-plugin-react": "^7.37.5",
123
+ "eslint-plugin-react-hooks": "^5.2.0",
124
+ "eslint-plugin-security": "^3.0.1",
125
+ "eslint-plugin-sonarjs": "^4.0.2",
126
+ "eslint-plugin-unused-imports": "^4.1.4",
127
+ "eslint-plugin-xss": "^0.1.12",
128
+ "formik": "2.4.6",
129
+ "globals": "16.0.0",
130
+ "globby": "^14.1.0",
131
+ "html-webpack-plugin": "5.5.3",
132
+ "https-browserify": "1.0.0",
133
+ "husky": "7.0.4",
134
+ "i18next": "22.5.1",
135
+ "i18next-browser-languagedetector": "7.0.1",
136
+ "js-logger": "1.6.1",
137
+ "lint-staged": "12.4.1",
138
+ "lucide-react": "^1.8.0",
139
+ "mini-css-extract-plugin": "2.7.6",
140
+ "mixpanel-browser": "2.47.0",
141
+ "os-browserify": "0.3.0",
142
+ "path-browserify": "^1.0.1",
143
+ "postcss": "8.5.12",
144
+ "postcss-import": "^15.0.0",
145
+ "postcss-loader": "^7.0.1",
146
+ "postcss-preset-env": "7.8.2",
147
+ "prettier": "3",
148
+ "prettier-plugin-tailwindcss": "^0.7.1",
149
+ "process": "0.11.10",
150
+ "qs": "6.15.2",
151
+ "ramda": "0.29.0",
152
+ "react": "18.3.1",
153
+ "react-dom": "18.3.1",
154
+ "react-helmet": "^6.1.0",
155
+ "react-i18next": "12.3.1",
156
+ "react-router-dom": "5.3.3",
157
+ "react-toastify": "8.0.2",
158
+ "rollup": "4.59.0",
159
+ "rollup-plugin-analyzer": "4.0.0",
160
+ "rollup-plugin-cleaner": "1.0.0",
161
+ "rollup-plugin-copy": "3.5.0",
162
+ "rollup-plugin-peer-deps-external": "2.2.4",
163
+ "rollup-plugin-styles": "4.0.0",
164
+ "sass": "1.98.0",
165
+ "sass-loader": "^13.0.2",
166
+ "source-map-loader": "4.0.1",
167
+ "stream-browserify": "^3.0.0",
168
+ "stream-http": "3.2.0",
169
+ "style-loader": "^3.3.1",
170
+ "tailwindcss": "^4.1.17",
171
+ "tty-browserify": "0.0.1",
172
+ "url": "0.11.4",
173
+ "util": "^0.12.5",
174
+ "vm-browserify": "1.1.2",
175
+ "webpack": "5.104.1",
176
+ "webpack-assets-manifest": "5.1.0",
177
+ "webpack-cli": "5.1.4",
178
+ "webpack-dev-server": "5.2.4",
179
+ "yup": "0.32.11",
180
+ "zustand": "4.4.2"
181
+ },
182
+ "peerDependencies": {
183
+ "@babel/runtime": "7.29.2",
184
+ "@bigbinary/neeto-atoms": "1.0.90",
185
+ "@bigbinary/neeto-cist": "1.0.17",
186
+ "@bigbinary/neeto-commons-frontend": "4.13.131",
187
+ "@bigbinary/neeto-filters-frontend": "4.3.39",
188
+ "@bigbinary/neeto-icons": "1.20.89",
189
+ "@bigbinary/neeto-molecules": "5.2.6",
190
+ "@bigbinary/neetoui": "8.8.1",
191
+ "@honeybadger-io/js": "6.10.1",
192
+ "@honeybadger-io/react": "6.1.25",
193
+ "@tanstack/react-query": "5.59.20",
194
+ "@tanstack/react-query-devtools": "5.59.20",
195
+ "antd": "5.22.1",
196
+ "axios": "1.16.1",
197
+ "buffer": "^6.0.3",
198
+ "classnames": "2.5.1",
199
+ "crypto-browserify": "3.12.1",
200
+ "dompurify": "3.4.7",
201
+ "formik": "2.4.6",
202
+ "https-browserify": "1.0.0",
203
+ "i18next": "22.5.1",
204
+ "js-logger": "1.6.1",
205
+ "lucide-react": "^1.8.0",
206
+ "mixpanel-browser": "2.45.0",
207
+ "os-browserify": "0.3.0",
208
+ "path-browserify": "^1.0.1",
209
+ "qs": "6.15.2",
210
+ "ramda": "0.29.0",
211
+ "react": "18.3.1",
212
+ "react-dom": "18.3.1",
213
+ "react-helmet": "^6.1.0",
214
+ "react-i18next": "12.3.1",
215
+ "react-router-dom": "5.3.3",
216
+ "react-toastify": "8.0.2",
217
+ "source-map-loader": "4.0.1",
218
+ "stream-browserify": "^3.0.0",
219
+ "stream-http": "3.2.0",
220
+ "tailwindcss": "4.1.17",
221
+ "tty-browserify": "0.0.1",
222
+ "url": "0.11.4",
223
+ "util": "^0.12.5",
224
+ "vm-browserify": "1.1.2",
225
+ "yup": "0.32.11",
226
+ "zustand": "4.4.2"
227
+ },
228
+ "resolutions": {
229
+ "postcss": "^8",
230
+ "wrap-ansi": "7.0.0",
231
+ "string-width": "4.1.0",
232
+ "pbkdf2": "^3.1.3",
233
+ "sha.js": "^2.4.12",
234
+ "node-forge": "^1.3.2",
235
+ "qs": "6.14.2"
236
+ },
237
+ "engines": {
238
+ "node": ">=22.13",
239
+ "npm": ">=9",
240
+ "yarn": ">=1.22"
241
+ },
242
+ "dependencies": {
243
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
244
+ "babel-plugin-transform-imports": "^2.0.0",
245
+ "react-router-nav-prompt": "0.4.1"
246
+ },
247
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
248
+ }
package/types.d.ts ADDED
@@ -0,0 +1,124 @@
1
+ import React from "react";
2
+ import type {
3
+ UseMutationOptions,
4
+ UseMutationResult,
5
+ UseQueryResult,
6
+ } from "@tanstack/react-query";
7
+
8
+ type TrashedItem = {
9
+ id: string;
10
+ type: string;
11
+ title?: string;
12
+ trashedAt: string;
13
+ trashedBy?: string;
14
+ daysUntilDeletion: number;
15
+ };
16
+
17
+ type TrashedItemsResponse = {
18
+ trashedItems: TrashedItem[];
19
+ counts: Record<string, number>;
20
+ totalCount: number;
21
+ retentionPeriodDays?: number;
22
+ };
23
+
24
+ type TrashColumn = {
25
+ title: string;
26
+ dataIndex: string;
27
+ key: string;
28
+ render?: (value: unknown, row: TrashedItem) => React.ReactNode;
29
+ };
30
+
31
+ type ItemTypeConfig = {
32
+ label: string;
33
+ icon?: React.ComponentType;
34
+ columns?: TrashColumn[];
35
+ isRestorable?: boolean;
36
+ isDeletable?: boolean;
37
+ renderRowActions?: (args: {
38
+ row: TrashedItem;
39
+ requestDelete: (args: {
40
+ type: string;
41
+ ids: Array<string | number>;
42
+ }) => void;
43
+ onActionSuccess: () => void;
44
+ }) => React.ReactNode;
45
+ };
46
+
47
+ type MutationOptions<TVariables> = Partial<
48
+ UseMutationOptions<unknown, unknown, TVariables>
49
+ >;
50
+
51
+ export const TrashList: React.FC<{
52
+ itemTypes: Record<string, ItemTypeConfig>;
53
+ retentionPeriodDays?: number;
54
+ pageSize?: number;
55
+ onRestoreSuccess?: () => void;
56
+ onDeleteSuccess?: () => void;
57
+ }>;
58
+
59
+ export const TrashBanner: React.FC<{
60
+ retentionPeriodDays?: number;
61
+ [key: string]: any;
62
+ }>;
63
+
64
+ export const MoveToTrashAction: React.FC<{
65
+ type: string;
66
+ ids: Array<string | number>;
67
+ label?: string;
68
+ onSuccess?: () => void;
69
+ [key: string]: any;
70
+ }>;
71
+
72
+ export const RestoreButton: React.FC<{
73
+ type: string;
74
+ id: string | number;
75
+ onSuccess?: () => void;
76
+ [key: string]: any;
77
+ }>;
78
+
79
+ export const DeletePermanentlyAction: React.FC<{
80
+ type: string;
81
+ ids: Array<string | number>;
82
+ label?: string;
83
+ onSuccess?: () => void;
84
+ [key: string]: any;
85
+ }>;
86
+
87
+ export function useFetchTrashedItems(
88
+ params?: {
89
+ type?: string;
90
+ pageNumber?: number;
91
+ pageSize?: number;
92
+ },
93
+ options?: object
94
+ ): UseQueryResult<TrashedItemsResponse>;
95
+
96
+ type MoveToTrashVariables = { type: string; ids: Array<string | number> };
97
+ type RestoreVariables = { type: string; id: string | number };
98
+ type PermanentlyDeleteVariables = {
99
+ type: string;
100
+ ids: Array<string | number>;
101
+ };
102
+
103
+ export function useMoveToTrash(
104
+ options?: MutationOptions<MoveToTrashVariables>
105
+ ): UseMutationResult<unknown, unknown, MoveToTrashVariables>;
106
+
107
+ export function useRestore(
108
+ options?: MutationOptions<RestoreVariables>
109
+ ): UseMutationResult<unknown, unknown, RestoreVariables>;
110
+
111
+ export function usePermanentlyDelete(
112
+ options?: MutationOptions<PermanentlyDeleteVariables>
113
+ ): UseMutationResult<unknown, unknown, PermanentlyDeleteVariables>;
114
+
115
+ export function getDaysUntilDeletion(args: {
116
+ trashedAt: string | Date;
117
+ retentionPeriodDays?: number;
118
+ }): number;
119
+
120
+ export const DEFAULT_RETENTION_PERIOD_DAYS: number;
121
+
122
+ export const QUERY_KEYS: {
123
+ TRASHED_ITEMS: string;
124
+ };