frame.select 1.1.1 → 1.1.2

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.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AACA,OAAO,WAAW,CAAC;AAInB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,iBAAS,GAAG,sBAuGX;AAED,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AACA,OAAO,WAAW,CAAC;AAInB,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,iBAAS,GAAG,sBAwGX;AAED,eAAe,GAAG,CAAC"}
package/dist/App.js CHANGED
@@ -58,8 +58,10 @@ function App() {
58
58
  const onClickItem = (item) => {
59
59
  window.alert(`Item clicked: ${item.getValue()}\n${JSON.stringify(item.row.original)}`);
60
60
  };
61
- const onClickBrand = (index) => {
62
- window.alert(`Item clicked: ${index}\n${JSON.stringify(brands[index], null, 2)}`);
61
+ const onClickBrand = (cell, index) => {
62
+ console.log(`cell: ${JSON.stringify(cell.row.original, null, 2)}`);
63
+ const brand = brands.find((b) => b.name === cell.row.original.name);
64
+ window.alert(`Item clicked: ${index}\n${JSON.stringify(brand, null, 2)}`);
63
65
  };
64
66
  const [filter, setFilter] = useState('');
65
67
  function filterMatches(item, fltr) {
@@ -1,10 +1,11 @@
1
+ import { Cell } from '@tanstack/react-table';
1
2
  import { TColumn } from './itemTypes';
2
3
  import { JSX } from 'react';
3
4
  import React from 'react';
4
5
  import { TBrandObj } from './types';
5
6
  export declare function BrandList(props: {
6
7
  brandList: TBrandObj[];
7
- onClick?: (index: number) => void;
8
+ onClick?: (cell: Cell<TBrandObj, unknown>, index: number) => void;
8
9
  renderItem?: (item: string) => React.ReactNode;
9
10
  extraColumns?: TColumn<TBrandObj>[];
10
11
  style?: React.CSSProperties;
@@ -1 +1 @@
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
+ {"version":3,"file":"BrandList.d.ts","sourceRoot":"","sources":["../../src/components/BrandList.tsx"],"names":[],"mappings":"AASA,OAAO,EAIL,IAAI,EAIL,MAAM,uBAAuB,CAAC;AAE/B,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,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,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"}
@@ -60,9 +60,9 @@ export function BrandList(props) {
60
60
  columns.push(col.column);
61
61
  }
62
62
  });
63
- const onClick = (index) => () => {
63
+ const onClick = (cell, index) => () => {
64
64
  if (props.onClick) {
65
- props.onClick?.(index);
65
+ props.onClick?.(cell, index);
66
66
  }
67
67
  else {
68
68
  console.log(`Clicked item index: ${index}`);
@@ -91,7 +91,7 @@ export function BrandList(props) {
91
91
  const cll = cell.getValue();
92
92
  if (cell.column.columnDef.header === defaultHeader) {
93
93
  cellContent = (React.createElement(TableCell, { style: { backgroundColor: 'white', padding: 2 }, key: cell.id },
94
- React.createElement(Button, { onClick: onClick(cell.row.index) }, props.renderItem
94
+ React.createElement(Button, { onClick: onClick(cell, cell.row.index) }, props.renderItem
95
95
  ? props.renderItem(cll)
96
96
  : flexRender(cell.column.columnDef.cell, cell.getContext()))));
97
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frame.select",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "A React component for selecting items from a list with a search bar.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -46,7 +46,7 @@
46
46
  "jsdom": "^27.3.0",
47
47
  "typescript": "~5.9.3",
48
48
  "typescript-eslint": "^8.49.0",
49
- "vite": "^7.2.7",
49
+ "vite": "^7.3.0",
50
50
  "vitest": "^4.0.15"
51
51
  }
52
52
  }