@stackloop/ui 4.0.7 → 4.0.8

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/README.md CHANGED
@@ -393,6 +393,10 @@ Call `setupRippleEffects()` only once per app (for example in `main.tsx`) to avo
393
393
  - **`loading`**: `boolean` — optional. Shows animated skeleton loading state when true.
394
394
  - **`onRowClick`**: `(item: T) => void` — optional. Callback fired when a row is clicked. Adds hover effect and pointer cursor to rows.
395
395
  - **`keyExtractor`**: `(item: T) => string` — required. Function to extract unique key from each data item for React reconciliation.
396
+ - **`selectable`**: `boolean` — optional (default: `false`). Adds a checkbox column with header-level select all and per-row selection.
397
+ - **`selectedKeys`**: `string[]` — optional. Controlled selected row keys.
398
+ - **`defaultSelectedKeys`**: `string[]` — optional. Initial selected row keys for uncontrolled mode.
399
+ - **`onSelectionChange`**: `(selectedKeys: string[], selectedItems: T[]) => void` — optional. Fires whenever selection changes.
396
400
  - **`className`**: `string` — optional. Additional CSS classes for the table wrapper.
397
401
 
398
402
  - **Column Interface:**
@@ -600,6 +604,25 @@ Call `setupRippleEffects()` only once per app (for example in `main.tsx`) to avo
600
604
  />
601
605
  ```
602
606
 
607
+ - **Selection Example:**
608
+
609
+ ```jsx
610
+ const [selectedRows, setSelectedRows] = useState([])
611
+
612
+ <Table
613
+ data={users}
614
+ columns={columns}
615
+ keyExtractor={(user) => String(user.id)}
616
+ selectable
617
+ selectedKeys={selectedRows}
618
+ onSelectionChange={(keys, items) => {
619
+ setSelectedRows(keys)
620
+ console.log('Selected row IDs:', keys)
621
+ console.log('Selected row objects:', items)
622
+ }}
623
+ />
624
+ ```
625
+
603
626
  **Dropdown**:
604
627
  - **Description:** General-purpose select component with optional search, clear, and icons. Use this for general UI selections outside of forms. For form-specific needs with validation, use the **Select** component instead.
605
628
  - **Props:**
package/dist/Table.d.ts CHANGED
@@ -13,7 +13,11 @@ export interface TableProps<T> {
13
13
  loading?: boolean;
14
14
  onRowClick?: (item: T) => void;
15
15
  keyExtractor: (item: T) => string;
16
+ selectable?: boolean;
17
+ selectedKeys?: string[];
18
+ defaultSelectedKeys?: string[];
19
+ onSelectionChange?: (selectedKeys: string[], selectedItems: T[]) => void;
16
20
  className?: string;
17
21
  animate?: boolean;
18
22
  }
19
- export declare function Table<T>({ data, columns, loading, onRowClick, keyExtractor, className, animate }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
23
+ export declare function Table<T>({ data, columns, loading, onRowClick, keyExtractor, selectable, selectedKeys, defaultSelectedKeys, onSelectionChange, className, animate }: TableProps<T>): import("react/jsx-runtime").JSX.Element;