@mistersee/global-table 0.1.5 → 0.1.7

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  A lightweight, Tailwind-first React data table for product UIs that need sticky columns, pagination, column visibility, drag-and-drop reordering, and flexible styling — without a heavy grid framework.
4
4
 
5
- ![@mistersee/global-table demo](./media/demo-table.png)
5
+ ![@mistersee/global-table demo](https://cdn.jsdelivr.net/npm/@mistersee/global-table@0.1.6/media/demo-table.png)
6
6
 
7
7
  <p align="center">
8
8
  <em>Demo UI: index column, sticky Actions, field colors, column toggle, and pagination.</em>
@@ -15,6 +15,7 @@ A lightweight, Tailwind-first React data table for product UIs that need sticky
15
15
  - **Sticky columns** — pin any fields left or right while scrolling horizontally
16
16
  - **Hybrid pagination** — controlled or uncontrolled (`limit` / `skip`)
17
17
  - **Column visibility** — toggle which fields are shown
18
+ - **Column settings tabs** — switch between Visibility and Pinning with smooth transitions; pin fields using inline radio controls
18
19
  - **Column reorder** — optional drag-and-drop header reordering
19
20
  - **Custom actions** — inject any React nodes into the actions column
20
21
  - **Row index** — optional leading `#` column (pagination-aware)
@@ -185,7 +186,22 @@ Use `width: 'auto'` for content-sized columns such as action button groups.
185
186
  />
186
187
  ```
187
188
 
188
- When `stickyLeft` / `stickyRight` are provided, they become the source of truth for sticky sides.
189
+ `stickyLeft` / `stickyRight` override `column.sticky` as the base configuration.
190
+
191
+ The **Columns** dropdown has two tabs:
192
+
193
+ - **Visibility**: show or hide columns.
194
+ - **Pinning**: the right-hand tab shows horizontal **None / Left / Right** radio controls on the right of each field, including the index column when enabled. Choose one option per field; changes apply immediately without a Save button. Multiple fields can be pinned on either side.
195
+
196
+ | Pinning option | Behavior |
197
+ | --- | --- |
198
+ | **None** | The column scrolls normally with the table |
199
+ | **Left** | The column stays on the left when scrolling horizontally |
200
+ | **Right** | The column stays on the right when scrolling horizontally |
201
+
202
+ Tab changes use a sliding highlight and a short fade/slide transition. These tab animations respect the user's reduced-motion preference. With a tab focused, use the arrow keys or Home/End to switch tabs. Press Escape to close the dropdown and return focus to the Columns button.
203
+
204
+ Dropdown choices override the base configuration for the selected field until the table is unmounted. Hidden fields keep their sticky choice and apply it when shown again. Choices are stored locally in the table, not persisted across page reloads.
189
205
 
190
206
  ### Pagination (hybrid)
191
207
 
@@ -201,12 +217,15 @@ When `stickyLeft` / `stickyRight` are provided, they become the source of truth
201
217
 
202
218
  **Controlled (API / server):** pass the current page `data`, plus `limit`, `skip`, `total`, and `onPaginationChange`.
203
219
 
204
- ### Column visibility toggle
220
+ ### Column settings (Visibility & Pinning)
221
+
222
+ Both tabs are available by default through the **Columns** button; no additional props are required. `columnsLabel` changes the button label, while the tab titles remain **Visibility** and **Pinning**. Setting `showColumnToggle={false}` hides both tabs but keeps programmatic sticky configuration active.
205
223
 
206
224
  | Prop | Type | Default | Description |
207
225
  | --- | --- | --- | --- |
208
226
  | `showColumnToggle` | `boolean` | `true` | Show/hide the Columns button |
209
227
  | `columnsLabel` | `ReactNode` | `"Columns"` | Button label |
228
+ | `columnTogglePosition` | `'after-skip' \| 'end' \| 'before-limit' \| 'start'` | `'after-skip'` | Place the button after pagination controls or before the page-size selector |
210
229
 
211
230
  ```tsx
212
231
  <MisterSeeGlobalTable showColumnToggle={false} {...props} />
@@ -1,9 +1,14 @@
1
+ import type { StickySide } from './types';
1
2
  export interface ColumnToggleItem {
2
3
  key: string;
3
4
  label: React.ReactNode;
4
5
  }
5
- export declare function ColumnToggle({ columns, visibleKeys, onChange, className, label, }: {
6
+ export declare function ColumnToggle({ columns, visibleKeys, stickyColumns, onStickyChange, onChange, className, label, }: {
6
7
  columns: ColumnToggleItem[];
8
+ stickyColumns: (ColumnToggleItem & {
9
+ sticky?: StickySide;
10
+ })[];
11
+ onStickyChange: (key: string, side: StickySide | null) => void;
7
12
  visibleKeys: Set<string>;
8
13
  onChange: (next: Set<string>) => void;
9
14
  className?: string;