frame.select 1.1.0 → 1.1.1
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/App.js +12 -13
- package/dist/components/BrandList.d.ts +4 -5
- package/dist/components/BrandList.d.ts.map +1 -1
- package/dist/components/BrandList.js +10 -5
- package/dist/components/types.d.ts +1 -2
- package/dist/components/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/App.js
CHANGED
|
@@ -10,43 +10,37 @@ function App() {
|
|
|
10
10
|
name: 'Adidas',
|
|
11
11
|
id: 1,
|
|
12
12
|
description: 'Description of Adidas',
|
|
13
|
-
|
|
14
|
-
item: ['Adidas'],
|
|
13
|
+
// item: ['Adidas'],
|
|
15
14
|
},
|
|
16
15
|
{
|
|
17
16
|
name: 'Nike',
|
|
18
17
|
id: 2,
|
|
19
18
|
description: 'Description of Nike',
|
|
20
|
-
|
|
21
|
-
item: ['Nike'],
|
|
19
|
+
// item: ['Nike'],
|
|
22
20
|
},
|
|
23
21
|
{
|
|
24
22
|
name: 'Puma',
|
|
25
23
|
id: 3,
|
|
26
24
|
description: 'Description of Puma',
|
|
27
|
-
|
|
28
|
-
item: ['Puma'],
|
|
25
|
+
// item: ['Puma'],
|
|
29
26
|
},
|
|
30
27
|
{
|
|
31
28
|
name: 'Reebok',
|
|
32
29
|
id: 4,
|
|
33
30
|
description: 'Description of Reebok',
|
|
34
|
-
|
|
35
|
-
item: ['Reebok'],
|
|
31
|
+
// item: ['Reebok'],
|
|
36
32
|
},
|
|
37
33
|
{
|
|
38
34
|
name: 'Under Armour',
|
|
39
35
|
id: 5,
|
|
40
36
|
description: 'Description of Under Armour',
|
|
41
|
-
|
|
42
|
-
item: ['Under Armour'],
|
|
37
|
+
// item: ['Under Armour'],
|
|
43
38
|
},
|
|
44
39
|
{
|
|
45
40
|
name: 'New Balance',
|
|
46
41
|
id: 6,
|
|
47
42
|
description: 'Description of New Balance',
|
|
48
|
-
|
|
49
|
-
item: ['New Balance'],
|
|
43
|
+
// item: ['New Balance'],
|
|
50
44
|
},
|
|
51
45
|
];
|
|
52
46
|
const columnHelper = createColumnHelper();
|
|
@@ -64,6 +58,9 @@ function App() {
|
|
|
64
58
|
const onClickItem = (item) => {
|
|
65
59
|
window.alert(`Item clicked: ${item.getValue()}\n${JSON.stringify(item.row.original)}`);
|
|
66
60
|
};
|
|
61
|
+
const onClickBrand = (index) => {
|
|
62
|
+
window.alert(`Item clicked: ${index}\n${JSON.stringify(brands[index], null, 2)}`);
|
|
63
|
+
};
|
|
67
64
|
const [filter, setFilter] = useState('');
|
|
68
65
|
function filterMatches(item, fltr) {
|
|
69
66
|
const match = item.name
|
|
@@ -82,6 +79,8 @@ function App() {
|
|
|
82
79
|
return (React.createElement(React.Fragment, null,
|
|
83
80
|
React.createElement("h1", null, "Brand List"),
|
|
84
81
|
React.createElement(ItemList, { itemList: brands, renderItem: renderItem, clickFunc: onClickItem, itemFilter: tItemFilter, extraColumns: colWidth }),
|
|
85
|
-
React.createElement(BrandList, { brandList: brands,
|
|
82
|
+
React.createElement(BrandList, { brandList: brands, onClick: onClickBrand,
|
|
83
|
+
// renderItem={renderItem}
|
|
84
|
+
extraColumns: colWidth })));
|
|
86
85
|
}
|
|
87
86
|
export default App;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { Cell } from '@tanstack/react-table';
|
|
2
1
|
import { TColumn } from './itemTypes';
|
|
3
2
|
import { JSX } from 'react';
|
|
4
3
|
import React from 'react';
|
|
5
|
-
import {
|
|
4
|
+
import { TBrandObj } from './types';
|
|
6
5
|
export declare function BrandList(props: {
|
|
7
|
-
brandList:
|
|
6
|
+
brandList: TBrandObj[];
|
|
7
|
+
onClick?: (index: number) => void;
|
|
8
8
|
renderItem?: (item: string) => React.ReactNode;
|
|
9
|
-
|
|
10
|
-
extraColumns?: TColumn<TBrand>[];
|
|
9
|
+
extraColumns?: TColumn<TBrandObj>[];
|
|
11
10
|
style?: React.CSSProperties;
|
|
12
11
|
}): JSX.Element;
|
|
13
12
|
//# sourceMappingURL=BrandList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrandList.d.ts","sourceRoot":"","sources":["../../src/components/BrandList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BrandList.d.ts","sourceRoot":"","sources":["../../src/components/BrandList.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAe,OAAO,EAAS,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,GAAG,EAA6C,MAAM,OAAO,CAAC;AACvE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC/B,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IAC/C,YAAY,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;IACpC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,GAAG,GAAG,CAAC,OAAO,CAmLd"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Button, } from '@mui/material';
|
|
2
|
-
import { useReactTable, getCoreRowModel, getFilteredRowModel, createColumnHelper, } from '@tanstack/react-table';
|
|
2
|
+
import { useReactTable, getCoreRowModel, getFilteredRowModel, createColumnHelper, flexRender, } from '@tanstack/react-table';
|
|
3
3
|
import ItemFilter from './ItemFilter';
|
|
4
4
|
import { useMemo, useState, useCallback } from 'react';
|
|
5
5
|
import React from 'react';
|
|
@@ -60,9 +60,12 @@ export function BrandList(props) {
|
|
|
60
60
|
columns.push(col.column);
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
|
-
const onClick = (
|
|
64
|
-
if (props.
|
|
65
|
-
props.
|
|
63
|
+
const onClick = (index) => () => {
|
|
64
|
+
if (props.onClick) {
|
|
65
|
+
props.onClick?.(index);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
console.log(`Clicked item index: ${index}`);
|
|
66
69
|
}
|
|
67
70
|
};
|
|
68
71
|
function displayHeader(header) {
|
|
@@ -88,7 +91,9 @@ export function BrandList(props) {
|
|
|
88
91
|
const cll = cell.getValue();
|
|
89
92
|
if (cell.column.columnDef.header === defaultHeader) {
|
|
90
93
|
cellContent = (React.createElement(TableCell, { style: { backgroundColor: 'white', padding: 2 }, key: cell.id },
|
|
91
|
-
React.createElement(Button, { onClick: onClick(cell) }, props.renderItem
|
|
94
|
+
React.createElement(Button, { onClick: onClick(cell.row.index) }, props.renderItem
|
|
95
|
+
? props.renderItem(cll)
|
|
96
|
+
: flexRender(cell.column.columnDef.cell, cell.getContext()))));
|
|
92
97
|
}
|
|
93
98
|
else {
|
|
94
99
|
cellContent = (React.createElement(TableCell, { style: { backgroundColor: 'white', padding: 2 }, key: cell.id }, props.renderItem ? props.renderItem(cll) : React.createElement("div", null, cll)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as ItemList } from './components/ItemList';
|
|
2
2
|
export type { TColumn, TItem, TItemFilter } from './components/itemTypes';
|
|
3
3
|
export { BrandList } from './components/BrandList';
|
|
4
|
-
export type {
|
|
4
|
+
export type { TBrandObj } from './components/types';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "frame.select",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "A React component for selecting items from a list with a search bar.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"react": "^19.2.3",
|
|
34
34
|
"react-dom": "^19.2.3",
|
|
35
|
-
"@eslint/js": "^9.39.
|
|
35
|
+
"@eslint/js": "^9.39.2",
|
|
36
36
|
"@testing-library/dom": "^10.4.1",
|
|
37
37
|
"@testing-library/jest-dom": "^6.9.1",
|
|
38
38
|
"@testing-library/react": "^16.2.0",
|
|
39
39
|
"@types/react": "^19.2.7",
|
|
40
40
|
"@types/react-dom": "^19.2.3",
|
|
41
41
|
"@vitejs/plugin-react": "^5.1.2",
|
|
42
|
-
"eslint": "^9.39.
|
|
42
|
+
"eslint": "^9.39.2",
|
|
43
43
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
44
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
44
|
+
"eslint-plugin-react-refresh": "^0.4.25",
|
|
45
45
|
"globals": "^16.5.0",
|
|
46
46
|
"jsdom": "^27.3.0",
|
|
47
47
|
"typescript": "~5.9.3",
|