@stackloop/ui 4.0.6 → 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 +49 -0
- package/dist/Table.d.ts +5 -1
- package/dist/Tooltip.d.ts +19 -0
- package/dist/assets/index-DHBqG65w.js +17 -0
- package/dist/assets/index-Z5A9fp3I.css +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.html +2 -2
- package/dist/index.js +1771 -1566
- package/dist/index.js.map +1 -1
- package/dist/stackloop-ui.css +1 -1
- package/package.json +1 -1
- package/dist/assets/index-ClujkPIe.js +0 -17
- package/dist/assets/index-dTMgJbB4.css +0 -1
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:**
|
|
@@ -616,6 +639,32 @@ Call `setupRippleEffects()` only once per app (for example in `main.tsx`) to avo
|
|
|
616
639
|
<Dropdown options={[{value:'a',label:'A'}]} value={val} onChange={setVal} searchable />
|
|
617
640
|
```
|
|
618
641
|
|
|
642
|
+
**Tooltip**:
|
|
643
|
+
- **Description:** Portal-based tooltip for short hints and context text. It renders outside normal layout flow (so it does not affect element positioning), supports top/bottom/left/right placement, auto-flips when space is limited, and stays visible above overflow-clipped containers.
|
|
644
|
+
- **Props:**
|
|
645
|
+
- **`children`**: `ReactNode` — required. Trigger element.
|
|
646
|
+
- **`content`**: `ReactNode` — required. Tooltip body.
|
|
647
|
+
- **`side`**: `'top' | 'bottom' | 'left' | 'right'` — preferred side (default: `'bottom'`).
|
|
648
|
+
- **`offset`**: `number` — gap between trigger and tooltip (default: `10`).
|
|
649
|
+
- **`delay`**: `number` — open delay in ms (default: `120`).
|
|
650
|
+
- **`showArrow`**: `boolean` — default: `true`.
|
|
651
|
+
- **`arrowSize`**: `number` — default: `10`.
|
|
652
|
+
- **`open`**, **`defaultOpen`**, **`onOpenChange`** — controlled/uncontrolled visibility.
|
|
653
|
+
- **`className`**, **`arrowClassName`**, **`disabled`** — optional styling/behavior controls.
|
|
654
|
+
- **Usage:**
|
|
655
|
+
|
|
656
|
+
```jsx
|
|
657
|
+
import { Tooltip, Button } from '@stackloop/ui'
|
|
658
|
+
|
|
659
|
+
<Tooltip content="More actions">
|
|
660
|
+
<Button variant="ghost">Hover me</Button>
|
|
661
|
+
</Tooltip>
|
|
662
|
+
|
|
663
|
+
<Tooltip content="Delete item" side="top" showArrow>
|
|
664
|
+
<Button variant="danger">Delete</Button>
|
|
665
|
+
</Tooltip>
|
|
666
|
+
```
|
|
667
|
+
|
|
619
668
|
**Select**:
|
|
620
669
|
- **Description:** **Form-specific** select component with label, error, hint, and validation support. Specifically designed for use in forms with proper semantics, accessibility, and validation integration. Use this component when building forms. For general UI selections (navigation, filters, etc.), use the **Dropdown** component instead. Based on Dropdown but includes form-specific features like `required` prop, hint text, and better integration with form libraries (React Hook Form, Formik, etc.).
|
|
621
670
|
- **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;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type TooltipSide = 'top' | 'bottom' | 'left' | 'right';
|
|
3
|
+
export interface TooltipProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
content: React.ReactNode;
|
|
6
|
+
side?: TooltipSide;
|
|
7
|
+
offset?: number;
|
|
8
|
+
delay?: number;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
open?: boolean;
|
|
11
|
+
defaultOpen?: boolean;
|
|
12
|
+
onOpenChange?: (open: boolean) => void;
|
|
13
|
+
className?: string;
|
|
14
|
+
showArrow?: boolean;
|
|
15
|
+
arrowSize?: number;
|
|
16
|
+
arrowClassName?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const Tooltip: React.FC<TooltipProps>;
|
|
19
|
+
export {};
|