@janrankenhohn/react-thumbnail-list 0.7.1 → 1.0.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.
- package/dist/index.esm.js +1376 -2080
- package/dist/index.js +1369 -2073
- package/dist/types/components/ThumbnailListMainContent.d.ts +1 -1
- package/dist/types/src/components/DropdownInput.d.ts +26 -0
- package/dist/types/src/components/EllipsisContainer.d.ts +15 -0
- package/dist/types/src/components/ThumbnailList.d.ts +46 -0
- package/dist/types/src/components/ThumbnailListFilterTag.d.ts +25 -0
- package/dist/types/src/components/ThumbnailListFilterTags.d.ts +44 -0
- package/dist/types/src/components/ThumbnailListHeader.d.ts +33 -0
- package/dist/types/src/components/ThumbnailListHeaderSort.d.ts +30 -0
- package/dist/types/src/components/ThumbnailListItem.d.ts +11 -0
- package/dist/types/src/components/ThumbnailListItemContext.d.ts +61 -0
- package/dist/types/src/components/ThumbnailListItemInfoLabel.d.ts +14 -0
- package/dist/types/src/components/ThumbnailListItemTitle.d.ts +15 -0
- package/dist/types/src/components/ThumbnailListItemType.d.ts +20 -0
- package/dist/types/src/components/ThumbnailListMainContent.d.ts +24 -0
- package/dist/types/src/components/ThumbnailListSearchField.d.ts +3 -0
- package/dist/types/src/config/ThumbnailListConfiguration.d.ts +23 -0
- package/dist/types/src/hooks/useFilteredThumbnailListItems.d.ts +23 -0
- package/dist/types/src/hooks/usePagedThumbnailListItems.d.ts +29 -0
- package/dist/types/src/hooks/useSortedThumbnailListItems.d.ts +29 -0
- package/dist/types/src/hooks/useTagFilteredThumbnailListItems.d.ts +51 -0
- package/dist/types/src/hooks/useWithLoading.d.ts +22 -0
- package/dist/types/src/index.d.ts +5 -0
- package/dist/types/src/interfaces/ThumbnailListItemInterface.d.ts +21 -0
- package/dist/types/src/stories/Button.d.ts +15 -0
- package/dist/types/src/stories/Header.d.ts +12 -0
- package/dist/types/src/stories/Page.d.ts +3 -0
- package/dist/types/src/tests/mocks/MockListItems.d.ts +41 -0
- package/dist/types/src/types/AlignType.d.ts +7 -0
- package/dist/types/src/types/BreakpointType.d.ts +25 -0
- package/dist/types/src/utils/arrayHelper.d.ts +26 -0
- package/dist/types/src/utils/logHelper.d.ts +24 -0
- package/dist/types/utils/logHelper.d.ts +2 -0
- package/dist/types/vitest.setup.d.ts +1 -0
- package/package.json +103 -84
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const items: ({
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
title: string;
|
|
5
|
+
subTitle: string;
|
|
6
|
+
label: string;
|
|
7
|
+
isScheduled: boolean;
|
|
8
|
+
thumbnailUrl: string;
|
|
9
|
+
link: string;
|
|
10
|
+
startDateTimeStamp?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
title: string;
|
|
15
|
+
subTitle: string;
|
|
16
|
+
label: string;
|
|
17
|
+
thumbnailUrl: string;
|
|
18
|
+
link: string;
|
|
19
|
+
isScheduled?: undefined;
|
|
20
|
+
startDateTimeStamp?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
id: string;
|
|
23
|
+
title: string;
|
|
24
|
+
subTitle: string;
|
|
25
|
+
label: string;
|
|
26
|
+
thumbnailUrl: string;
|
|
27
|
+
link: string;
|
|
28
|
+
name?: undefined;
|
|
29
|
+
isScheduled?: undefined;
|
|
30
|
+
startDateTimeStamp?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
subTitle: string;
|
|
35
|
+
label: string;
|
|
36
|
+
startDateTimeStamp: number;
|
|
37
|
+
thumbnailUrl: string;
|
|
38
|
+
link: string;
|
|
39
|
+
name?: undefined;
|
|
40
|
+
isScheduled?: undefined;
|
|
41
|
+
})[];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definition for Material-UI Grid breakpoint configuration.
|
|
3
|
+
* Defines how many columns an item should span at each screen size.
|
|
4
|
+
* Grid has 12 columns total at each breakpoint.
|
|
5
|
+
*
|
|
6
|
+
* @property {number} xs - Extra small screens (<600px) - Number of columns to span
|
|
7
|
+
* @property {number} sm - Small screens (≥600px) - Number of columns to span
|
|
8
|
+
* @property {number} md - Medium screens (≥900px) - Number of columns to span
|
|
9
|
+
* @property {number} lg - Large screens (≥1200px) - Number of columns to span
|
|
10
|
+
* @property {number} xl - Extra large screens (≥1536px) - Number of columns to span
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const breakpoints: BreakpointType = { xs: 12, sm: 6, md: 4, lg: 3, xl: 2 };
|
|
15
|
+
* // On xs: 1 column, sm: 2 columns, md: 3 columns, lg: 4 columns, xl: 6 columns
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
type BreakpointType = {
|
|
19
|
+
xs: number;
|
|
20
|
+
sm: number;
|
|
21
|
+
md: number;
|
|
22
|
+
lg: number;
|
|
23
|
+
xl: number;
|
|
24
|
+
};
|
|
25
|
+
export default BreakpointType;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic method that sorts an array of items based on an item key
|
|
3
|
+
* @param values The array that should be sorted
|
|
4
|
+
* @param orderType The key of the entity that the array should be sorted by
|
|
5
|
+
* @returns A new reference of the ordered array
|
|
6
|
+
*/
|
|
7
|
+
export declare function orderByArray<T>(values: T[], orderType: keyof T): T[];
|
|
8
|
+
/**
|
|
9
|
+
* Function type for filtering array items based on a custom condition.
|
|
10
|
+
*
|
|
11
|
+
* @template T - The type of value to be evaluated
|
|
12
|
+
* @param {T} value - The value to evaluate
|
|
13
|
+
* @returns {boolean} True if the value passes the condition, false otherwise
|
|
14
|
+
*/
|
|
15
|
+
export type ConditionFunction<T> = (value: T) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Filters an array of items based on a tag property and optional condition function.
|
|
18
|
+
* If no condition is provided, items are filtered based on the truthiness of the tag value.
|
|
19
|
+
*
|
|
20
|
+
* @template T - The type of items in the array
|
|
21
|
+
* @param {T[]} array - The array to filter
|
|
22
|
+
* @param {keyof T} tagType - The property key to use for filtering
|
|
23
|
+
* @param {ConditionFunction<T[keyof T]>} [condition] - Optional condition function to apply to tag values
|
|
24
|
+
* @returns {T[]} A new array containing only items that pass the filter
|
|
25
|
+
*/
|
|
26
|
+
export declare function filterByTag<T>(array: T[], tagType: keyof T, condition?: ConditionFunction<T[keyof T]>): T[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logs a message to the console only in development mode.
|
|
3
|
+
* In production, this function does nothing, preventing debug logs from appearing in production builds.
|
|
4
|
+
*
|
|
5
|
+
* @param {unknown} message - The message or value to log
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* logDev('Component rendered');
|
|
10
|
+
* logDev({ items: filteredItems });
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare const logDev: (message: unknown) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Logs a message to the console in all environments.
|
|
16
|
+
*
|
|
17
|
+
* @param {unknown} message - The message or value to log
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* log('Critical error occurred');
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const log: (message: unknown) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
package/package.json
CHANGED
|
@@ -1,84 +1,103 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@janrankenhohn/react-thumbnail-list",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"main": "dist/index.js",
|
|
5
|
-
"module": "dist/index.esm.js",
|
|
6
|
-
"types": "dist/types/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist"
|
|
9
|
-
],
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/JanRankenhohn/react-thumbnail-list.git"
|
|
13
|
-
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "rollup -c",
|
|
16
|
-
"build-watch": "rollup -c -w",
|
|
17
|
-
"play": "cd playground && npm run dev",
|
|
18
|
-
"i-all": "npm i && cd playground && npm i",
|
|
19
|
-
"dev": "npm-run-all --parallel build-watch
|
|
20
|
-
"
|
|
21
|
-
"test": "
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"@babel/
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
|
|
84
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@janrankenhohn/react-thumbnail-list",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"module": "dist/index.esm.js",
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/JanRankenhohn/react-thumbnail-list.git"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "cross-env NODE_ENV=production rollup -c",
|
|
16
|
+
"build-watch": "rollup -c -w",
|
|
17
|
+
"play": "cd playground && npm run dev",
|
|
18
|
+
"i-all": "npm i && cd playground && npm i",
|
|
19
|
+
"dev": "npm-run-all --parallel build-watch play",
|
|
20
|
+
"test": "vitest",
|
|
21
|
+
"test:run": "vitest run --reporter verbose",
|
|
22
|
+
"test:watch": "vitest --watch",
|
|
23
|
+
"test:ui": "vitest --ui",
|
|
24
|
+
"storybook": "storybook dev -p 6006",
|
|
25
|
+
"build-storybook": "storybook build"
|
|
26
|
+
},
|
|
27
|
+
"eslintConfig": {
|
|
28
|
+
"extends": [
|
|
29
|
+
"react-app",
|
|
30
|
+
"react-app/jest"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"browserslist": {
|
|
34
|
+
"production": [
|
|
35
|
+
">0.2%",
|
|
36
|
+
"not dead",
|
|
37
|
+
"not op_mini all"
|
|
38
|
+
],
|
|
39
|
+
"development": [
|
|
40
|
+
"last 1 chrome version",
|
|
41
|
+
"last 1 firefox version",
|
|
42
|
+
"last 1 safari version"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@babel/cli": "^7.23.9",
|
|
47
|
+
"@babel/core": "^7.23.9",
|
|
48
|
+
"@babel/preset-env": "^7.23.9",
|
|
49
|
+
"@babel/preset-react": "^7.23.3",
|
|
50
|
+
"@chromatic-com/storybook": "^4.1.3",
|
|
51
|
+
"@eslint/js": "^9.1.1",
|
|
52
|
+
"@rollup/plugin-commonjs": "^25.0.8",
|
|
53
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
54
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
55
|
+
"@rollup/plugin-replace": "^6.0.2",
|
|
56
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
57
|
+
"@rollup/plugin-url": "^8.0.2",
|
|
58
|
+
"@storybook/addon-a11y": "^10.1.11",
|
|
59
|
+
"@storybook/addon-docs": "^10.1.11",
|
|
60
|
+
"@storybook/addon-vitest": "^10.1.11",
|
|
61
|
+
"@storybook/react-vite": "^10.1.11",
|
|
62
|
+
"@testing-library/jest-dom": "^5.17.0",
|
|
63
|
+
"@testing-library/react": "^13.4.0",
|
|
64
|
+
"@testing-library/user-event": "^13.5.0",
|
|
65
|
+
"@types/lodash": "^4.17.0",
|
|
66
|
+
"@types/react": "^18.3.3",
|
|
67
|
+
"@types/react-dom": "^18.3.0",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^8.51.0",
|
|
69
|
+
"@typescript-eslint/parser": "^8.51.0",
|
|
70
|
+
"@vitest/browser-playwright": "^4.0.16",
|
|
71
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
72
|
+
"@vitest/ui": "^4.0.16",
|
|
73
|
+
"cross-env": "^7.0.3",
|
|
74
|
+
"eslint": "^9.39.2",
|
|
75
|
+
"eslint-config-prettier": "^10.1.8",
|
|
76
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
77
|
+
"eslint-plugin-react": "^7.37.5",
|
|
78
|
+
"eslint-plugin-storybook": "^10.1.11",
|
|
79
|
+
"globals": "^15.1.0",
|
|
80
|
+
"jest": "^27.5.1",
|
|
81
|
+
"npm-run-all": "^4.1.5",
|
|
82
|
+
"playwright": "^1.57.0",
|
|
83
|
+
"prettier": "^3.2.5",
|
|
84
|
+
"react-router": "^6.26.1",
|
|
85
|
+
"rollup": "^4.18.0",
|
|
86
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
87
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
88
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
89
|
+
"storybook": "^10.1.11",
|
|
90
|
+
"typescript": "^5.9.3",
|
|
91
|
+
"vitest": "^4.0.16"
|
|
92
|
+
},
|
|
93
|
+
"peerDependencies": {
|
|
94
|
+
"@emotion/react": "^11.11.4",
|
|
95
|
+
"@emotion/styled": "^11.11.0",
|
|
96
|
+
"@mui/icons-material": "^5.15.11 || ^6.0.0",
|
|
97
|
+
"@mui/material": "^5.15.11 || ^6.0.0",
|
|
98
|
+
"lodash.debounce": "^4.0.8",
|
|
99
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
100
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
101
|
+
"web-vitals": "^2.1.4"
|
|
102
|
+
}
|
|
103
|
+
}
|