react-restyle-components 0.4.65 → 0.4.67
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/lib/src/core-components/src/components/Table/Table.js +105 -16
- package/lib/src/core-components/src/components/Table/filters.d.ts +27 -12
- package/lib/src/core-components/src/components/Table/filters.js +93 -45
- package/lib/src/core-components/src/components/Table/index.d.ts +1 -1
- package/lib/src/core-components/src/components/Table/index.js +1 -1
- package/lib/src/core-components/src/components/Table/types.d.ts +12 -2
- package/lib/src/core-components/src/tc.global.css +10 -0
- package/package.json +3 -2
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import React, { forwardRef, useState, useCallback, useMemo, useEffect, useRef, } from 'react';
|
|
4
4
|
import { TableRoot, Toolbar, ToolbarGroup, SearchInput, ToolbarButton, TableWrapper, StyledTable, TableHeader, HeaderRow, HeaderCell, TableBody, TableRow, TableCell, TableCellContent, Checkbox, ExpandButton, ExpandedRow, ExpandedCell, TableFooter, FooterRow, FooterCell, PaginationWrapper, PaginationInfo, PaginationControls, PageButton, PageSizeInputWrapper, PageSizeInput, PageSizeDropdownIcon, PageSizeDropdown, PageSizeDropdownItem, QuickJumper, EmptyState, LoadingOverlay, LoadingSpinner, EditableCell, CellEditor, ColumnTogglePanel, ColumnToggleHeader, ColumnToggleSearch, ColumnToggleList, ColumnToggleItem, ColumnToggleDragHandle, SelectionIndicator, SelectionCount, SelectSortButton, } from './elements';
|
|
5
5
|
import { useSortState, useFilterState, usePaginationState, useRowSelection, useRowExpansion, useColumnVisibility, useTableDebounce, sortData, filterData, paginateData, getNestedValue, exportToCSV, exportToExcel, } from './hooks';
|
|
6
|
-
import { getFilterComponent } from './filters';
|
|
6
|
+
import { getFilterComponent, createCallableFilterHandle, FilterValueProvider } from './filters';
|
|
7
7
|
import { Tooltip } from '../Tooltip';
|
|
8
8
|
import { LoadingAnimateSpin } from '../Loader/loader.component';
|
|
9
9
|
import { useColumnResize, getColumnStyle } from './columnResize';
|
|
@@ -54,6 +54,31 @@ const RefreshIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", st
|
|
|
54
54
|
const PrintIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M6 9V2h12v7M6 18H4a2 2 0 01-2-2v-5a2 2 0 012-2h16a2 2 0 012 2v5a2 2 0 01-2 2h-2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("rect", { x: "6", y: "14", width: "12", height: "8" })] }));
|
|
55
55
|
const ErrorIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("path", { d: "M12 8v4M12 16h.01", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
56
56
|
const tableFilterCache = new Map();
|
|
57
|
+
/** Reads `getFilter` from TextFilter / NumberFilter / CustomFilter / DateFilter / SelectFilter factory `.props`. */
|
|
58
|
+
function getColumnFilterGetFilterCallback(filter) {
|
|
59
|
+
if (typeof filter !== 'function')
|
|
60
|
+
return undefined;
|
|
61
|
+
const props = filter.props;
|
|
62
|
+
return typeof props?.getFilter === 'function' ? props.getFilter : undefined;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* When using `filterRenderer`, the factory `filter` component does not mount, so its `getFilter`
|
|
66
|
+
* never runs. Registers the same callable imperative API as built-in filters (via table state).
|
|
67
|
+
*/
|
|
68
|
+
function FilterRendererGetFilterBridge({ getFilter, dataField, filters, handleFilterChange, }) {
|
|
69
|
+
const applyRef = useRef(() => { });
|
|
70
|
+
applyRef.current = (v) => handleFilterChange(dataField, v);
|
|
71
|
+
const getValueRef = useRef(() => filters[dataField]);
|
|
72
|
+
getValueRef.current = () => filters[dataField];
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
getFilter(createCallableFilterHandle({
|
|
75
|
+
getValue: () => getValueRef.current(),
|
|
76
|
+
setValue: (value) => applyRef.current(value),
|
|
77
|
+
clear: () => applyRef.current(null),
|
|
78
|
+
}));
|
|
79
|
+
}, [getFilter]);
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
57
82
|
export const Table = forwardRef(function TableComponent(props, ref) {
|
|
58
83
|
const { id, data, columns, keyField = '_id', loading = false, loadingIndicator, isLoading = false, pagination = true, paginationConfig, totalSize, remote = true, defaultSort, sort: controlledSort, filterable = false, defaultFilters, filters: controlledFilters, defaultShowFilters = true, showFilters: controlledShowFilters, onShowFiltersChange, showFilterToggle = true, searchable = true, searchPlaceholder = 'Search...', defaultSearchValue = '', searchValue: controlledSearchValue, searchDebounce = 300, rowSelection, expandable, editMode = 'dblclick', showEditIcon = false, onCellEdit, exportable = true, exportFileName = 'table_export', exportFormat = 'excel', exportSheetName, exportHeaderStyle, exportExtraSheets, exportSummaryRows, exportCharts, columnToggle = false, isFieldSelector = true, bordered = true, striped = false, hover = true, compact = false, cellPadding, stickyHeader = false, maxHeight, rowClassName, rowStyle, classNames = {}, styles = {}, className, style, emptyText = 'No data available', onChange, onPageChange, onSortChange, onFilterChange, onSearch, onRowClick, onRowDoubleClick, onClearFilters, toolbar, hideToolbar = false, showFooter = false, caption,
|
|
59
84
|
// Quick configuration props
|
|
@@ -466,6 +491,28 @@ export const Table = forwardRef(function TableComponent(props, ref) {
|
|
|
466
491
|
// Reset the flag after processing to prevent duplicate calls
|
|
467
492
|
shouldCallOnFilter.current = false;
|
|
468
493
|
}, [debouncedSearchValue, filters, page, pageSize]);
|
|
494
|
+
/** When remote filtering is used, pagination must re-send current criteria + new page/size. */
|
|
495
|
+
const getActiveRemoteFilterCallArgs = useCallback(() => {
|
|
496
|
+
const cleanFilters = {};
|
|
497
|
+
Object.keys(filters).forEach((key) => {
|
|
498
|
+
const value = filters[key];
|
|
499
|
+
if (value !== null && value !== undefined && value !== '') {
|
|
500
|
+
cleanFilters[key] = value;
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
const hasColumnFilters = Object.keys(cleanFilters).length > 0;
|
|
504
|
+
const hasSearch = Boolean(debouncedSearchValue);
|
|
505
|
+
if (!hasColumnFilters && !hasSearch)
|
|
506
|
+
return null;
|
|
507
|
+
const filterData = { ...cleanFilters };
|
|
508
|
+
if (hasSearch) {
|
|
509
|
+
filterData.srText = debouncedSearchValue;
|
|
510
|
+
}
|
|
511
|
+
const type = hasColumnFilters
|
|
512
|
+
? 'filter'
|
|
513
|
+
: 'search';
|
|
514
|
+
return { type, filterData };
|
|
515
|
+
}, [filters, debouncedSearchValue]);
|
|
469
516
|
// Track selection count changes for animation
|
|
470
517
|
useEffect(() => {
|
|
471
518
|
const currentCount = selectedKeys.size;
|
|
@@ -607,6 +654,15 @@ export const Table = forwardRef(function TableComponent(props, ref) {
|
|
|
607
654
|
lastOnFilterCallRef.current = null;
|
|
608
655
|
// Clear the cache so remounts also start fresh
|
|
609
656
|
tableFilterCache.delete(id);
|
|
657
|
+
// Remote tables: clear-all must notify like column-filter clears. Search uses debounce and
|
|
658
|
+
// never sets shouldCallOnFilter here, so invoke onFilter immediately with empty criteria.
|
|
659
|
+
if (onFilter) {
|
|
660
|
+
prevSearchRef.current = '';
|
|
661
|
+
prevFiltersRef.current = JSON.stringify({});
|
|
662
|
+
shouldCallOnFilter.current = false;
|
|
663
|
+
filterTypeRef.current = 'filter';
|
|
664
|
+
onFilterRef.current?.('filter', {}, page + 1, pageSize);
|
|
665
|
+
}
|
|
610
666
|
}, [
|
|
611
667
|
id,
|
|
612
668
|
clearFilters,
|
|
@@ -614,6 +670,9 @@ export const Table = forwardRef(function TableComponent(props, ref) {
|
|
|
614
670
|
onFilterChange,
|
|
615
671
|
onChange,
|
|
616
672
|
resetEditingState,
|
|
673
|
+
onFilter,
|
|
674
|
+
page,
|
|
675
|
+
pageSize,
|
|
617
676
|
]);
|
|
618
677
|
// Handle page change
|
|
619
678
|
const handlePageChange = useCallback((newPage) => {
|
|
@@ -621,13 +680,24 @@ export const Table = forwardRef(function TableComponent(props, ref) {
|
|
|
621
680
|
goToPage(newPage);
|
|
622
681
|
// Pass 1-indexed page number to callbacks (user-friendly)
|
|
623
682
|
const displayPage = newPage + 1;
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
683
|
+
const filterArgs = onFilter ? getActiveRemoteFilterCallArgs() : null;
|
|
684
|
+
// With active remote criteria, only onFilter should run (avoids double fetch vs onPageSizeChange)
|
|
685
|
+
if (filterArgs) {
|
|
686
|
+
onFilterRef.current?.(filterArgs.type, filterArgs.filterData, displayPage, pageSize);
|
|
687
|
+
// Keep onChange pagination for URL/sync; avoid duplicate fetch callbacks (onPageSizeChange / onPageChange)
|
|
688
|
+
onChange?.({
|
|
689
|
+
type: 'pagination',
|
|
690
|
+
pagination: { page: displayPage, pageSize },
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
else {
|
|
694
|
+
onPageSizeChange?.(displayPage, pageSize);
|
|
695
|
+
onPageChange?.(displayPage, pageSize);
|
|
696
|
+
onChange?.({
|
|
697
|
+
type: 'pagination',
|
|
698
|
+
pagination: { page: displayPage, pageSize },
|
|
699
|
+
});
|
|
700
|
+
}
|
|
631
701
|
}, [
|
|
632
702
|
goToPage,
|
|
633
703
|
pageSize,
|
|
@@ -635,24 +705,37 @@ export const Table = forwardRef(function TableComponent(props, ref) {
|
|
|
635
705
|
onPageChange,
|
|
636
706
|
onChange,
|
|
637
707
|
resetEditingState,
|
|
708
|
+
onFilter,
|
|
709
|
+
getActiveRemoteFilterCallArgs,
|
|
638
710
|
]);
|
|
639
711
|
// Handle page size change
|
|
640
712
|
const handlePageSizeChange = useCallback((newSize) => {
|
|
641
713
|
resetEditingState();
|
|
642
714
|
changePageSize(newSize);
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
715
|
+
const filterArgs = onFilter ? getActiveRemoteFilterCallArgs() : null;
|
|
716
|
+
if (filterArgs) {
|
|
717
|
+
onFilterRef.current?.(filterArgs.type, filterArgs.filterData, 1, newSize);
|
|
718
|
+
onChange?.({
|
|
719
|
+
type: 'pagination',
|
|
720
|
+
pagination: { page: 1, pageSize: newSize },
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
else {
|
|
724
|
+
onPageSizeChange?.(1, newSize);
|
|
725
|
+
onPageChange?.(1, newSize);
|
|
726
|
+
onChange?.({
|
|
727
|
+
type: 'pagination',
|
|
728
|
+
pagination: { page: 1, pageSize: newSize },
|
|
729
|
+
});
|
|
730
|
+
}
|
|
650
731
|
}, [
|
|
651
732
|
changePageSize,
|
|
652
733
|
onPageSizeChange,
|
|
653
734
|
onPageChange,
|
|
654
735
|
onChange,
|
|
655
736
|
resetEditingState,
|
|
737
|
+
onFilter,
|
|
738
|
+
getActiveRemoteFilterCallArgs,
|
|
656
739
|
]);
|
|
657
740
|
// Handle row click
|
|
658
741
|
const handleRowClick = useCallback((row, rowIndex, e) => {
|
|
@@ -1474,6 +1557,9 @@ export const Table = forwardRef(function TableComponent(props, ref) {
|
|
|
1474
1557
|
// Non-null reference for JSX rendering (guarded by showFilter check below)
|
|
1475
1558
|
const ResolvedFilter = FilterComponent;
|
|
1476
1559
|
const onFilter = (value) => handleFilterChange(column.dataField, value);
|
|
1560
|
+
const factoryGetFilter = column.filterRenderer
|
|
1561
|
+
? getColumnFilterGetFilterCallback(column.filter)
|
|
1562
|
+
: undefined;
|
|
1477
1563
|
// Get resized column style
|
|
1478
1564
|
const resizeStyle = resizable
|
|
1479
1565
|
? getColumnStyle(column, columnWidths, resizable, isResizing)
|
|
@@ -1598,7 +1684,10 @@ export const Table = forwardRef(function TableComponent(props, ref) {
|
|
|
1598
1684
|
display: 'flex',
|
|
1599
1685
|
alignItems: 'center',
|
|
1600
1686
|
overflow: 'hidden',
|
|
1601
|
-
}, onClick: (e) => e.stopPropagation(), children: column.filterRenderer ? (
|
|
1687
|
+
}, onClick: (e) => e.stopPropagation(), children: column.filterRenderer ? (_jsxs(FilterValueProvider, { value: filters[column.dataField], children: [factoryGetFilter ? (_jsx(FilterRendererGetFilterBridge, { getFilter: factoryGetFilter, dataField: column.dataField, filters: filters, handleFilterChange: handleFilterChange })) : null, column.filterRenderer(onFilter, column, {
|
|
1688
|
+
value: filters[column.dataField],
|
|
1689
|
+
onClear: () => handleFilterChange(column.dataField, null),
|
|
1690
|
+
})] })) : (_jsx("div", { onFocusCapture: () => {
|
|
1602
1691
|
focusedFilterFieldRef.current =
|
|
1603
1692
|
column.dataField;
|
|
1604
1693
|
saveFilterCache({
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TableFilterProps } from './types';
|
|
3
|
+
export declare const FilterValueProvider: React.FC<React.PropsWithChildren<{
|
|
4
|
+
value: any;
|
|
5
|
+
}>>;
|
|
3
6
|
/**
|
|
4
7
|
* Text filter options for factory function pattern
|
|
5
8
|
*/
|
|
@@ -175,6 +178,18 @@ export interface DateFilterInstance {
|
|
|
175
178
|
/** Clear the filter */
|
|
176
179
|
clear: () => void;
|
|
177
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Wraps `getFilter` instances so they are callable: `fn()`, `fn('')`, `fn(null)` clear;
|
|
183
|
+
* `fn(value)` sets. Still exposes `.value`, `.setValue`, and `.clear` like TextFilterInstance.
|
|
184
|
+
*/
|
|
185
|
+
export declare function createCallableFilterHandle({ getValue, setValue, clear, }: {
|
|
186
|
+
getValue: () => any;
|
|
187
|
+
setValue: (value: any) => void;
|
|
188
|
+
clear: () => void;
|
|
189
|
+
}): ((v?: any) => void) & {
|
|
190
|
+
setValue: (value: any) => void;
|
|
191
|
+
clear: () => void;
|
|
192
|
+
};
|
|
178
193
|
/**
|
|
179
194
|
* Text filter - can be used as a component or factory function
|
|
180
195
|
*
|
|
@@ -335,21 +350,21 @@ export interface CustomFilterInstance<T = any> {
|
|
|
335
350
|
* })
|
|
336
351
|
*
|
|
337
352
|
* @example
|
|
338
|
-
* //
|
|
339
|
-
* //
|
|
353
|
+
* // With filterRenderer, mount the same factory component as `filter` so getFilter runs.
|
|
354
|
+
* // CustomFilter’s getFilter is not called if you only render a different component in filterRenderer.
|
|
355
|
+
* const PictureFilter = NumberFilter({
|
|
356
|
+
* placeholder: 'Picture',
|
|
357
|
+
* getFilter: (f) => {
|
|
358
|
+
* pictureFilterRef.current = f;
|
|
359
|
+
* },
|
|
360
|
+
* });
|
|
340
361
|
* {
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
* placeholder: 'Picture',
|
|
345
|
-
* getFilter: (filter) => {
|
|
346
|
-
* pictureFilterRef.current = filter;
|
|
347
|
-
* },
|
|
348
|
-
* }),
|
|
349
|
-
* filterRenderer: (onFilter, column) => (
|
|
350
|
-
* <NumberFilter onFilter={onFilter} column={column} />
|
|
362
|
+
* filter: PictureFilter,
|
|
363
|
+
* filterRenderer: (onFilter, column, {value, onClear}) => (
|
|
364
|
+
* <PictureFilter column={column} value={value} onChange={onFilter} />
|
|
351
365
|
* ),
|
|
352
366
|
* }
|
|
367
|
+
* // clearAllFilter: () => pictureFilterRef.current?.clear()
|
|
353
368
|
*
|
|
354
369
|
* @example
|
|
355
370
|
* // Custom range filter
|
|
@@ -1,19 +1,64 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useCallback, useEffect, useRef } from 'react';
|
|
3
|
+
import { useState, useCallback, useEffect, useRef, useContext, createContext } from 'react';
|
|
4
4
|
import { useDebouncedValue } from '../../utils/hooks/useDebouncedValue';
|
|
5
5
|
import s from '../../tc.module.css';
|
|
6
6
|
import { cn } from '../../utils';
|
|
7
|
+
const UNSET = Symbol('FilterValueContext.UNSET');
|
|
8
|
+
/**
|
|
9
|
+
* Context that carries the current table filter-state value for a column.
|
|
10
|
+
* When a filter component is rendered inside `filterRenderer`, the Table wraps
|
|
11
|
+
* the output with `FilterValueProvider` so every filter picks up the value
|
|
12
|
+
* automatically — even when the consumer doesn't pass `value` explicitly.
|
|
13
|
+
*/
|
|
14
|
+
const FilterValueContext = createContext(UNSET);
|
|
15
|
+
export const FilterValueProvider = ({ value, children, }) => (_jsx(FilterValueContext.Provider, { value: value, children: children }));
|
|
16
|
+
function useFilterValueFromContext(propValue) {
|
|
17
|
+
const ctxValue = useContext(FilterValueContext);
|
|
18
|
+
if (propValue !== undefined)
|
|
19
|
+
return propValue;
|
|
20
|
+
if (ctxValue === UNSET)
|
|
21
|
+
return undefined;
|
|
22
|
+
return ctxValue;
|
|
23
|
+
}
|
|
7
24
|
// Tailwind CSS class helpers for filter components
|
|
8
25
|
const filterInputClass = cn(s['leading-4'], s['p-1'], s['focus:outline-none'], s['focus:ring'], s['shadow-sm'], s['text-xs'], s['font-normal'], s['border'], s['border-gray-300'], s['rounded-md'], s['text-black'], s['w-full'], s['bg-white'], s['placeholder-gray-400'], s['transition-all']);
|
|
9
26
|
const filterSelectClass = cn(s['leading-4'], s['p-1'], s['focus:outline-none'], s['focus:ring'], s['shadow-sm'], s['text-xs'], s['font-normal'], s['border'], s['border-gray-300'], s['rounded-md'], s['text-black'], s['w-full'], s['bg-white'], s['cursor-pointer'], s['transition-all']);
|
|
10
27
|
const comparatorSelectClass = cn(s['leading-4'], s['p-1'], s['focus:outline-none'], s['focus:ring'], s['shadow-sm'], s['text-xs'], s['font-normal'], s['border'], s['border-gray-300'], s['rounded-md'], s['text-black'], s['bg-white'], s['cursor-pointer'], s['w-12']);
|
|
11
28
|
const dateInputClass = cn(s['leading-4'], s['p-1'], s['focus:outline-none'], s['focus:ring'], s['shadow-sm'], s['text-xs'], s['font-normal'], s['border'], s['border-gray-300'], s['rounded-md'], s['text-black'], s['bg-white'], s['flex-1'], s['transition-all']);
|
|
12
29
|
const filterContainerClass = cn(s['flex'], s['flex-row'], s['gap-1'], s['items-center'], s['w-full']);
|
|
30
|
+
/**
|
|
31
|
+
* Wraps `getFilter` instances so they are callable: `fn()`, `fn('')`, `fn(null)` clear;
|
|
32
|
+
* `fn(value)` sets. Still exposes `.value`, `.setValue`, and `.clear` like TextFilterInstance.
|
|
33
|
+
*/
|
|
34
|
+
export function createCallableFilterHandle({ getValue, setValue, clear, }) {
|
|
35
|
+
const handle = Object.assign(function callFilter(v) {
|
|
36
|
+
if (arguments.length === 0 ||
|
|
37
|
+
v === '' ||
|
|
38
|
+
(typeof v === 'string' && v.trim() === '') ||
|
|
39
|
+
v == null) {
|
|
40
|
+
clear();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
setValue(v);
|
|
44
|
+
}, {
|
|
45
|
+
setValue,
|
|
46
|
+
clear,
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(handle, 'value', {
|
|
49
|
+
get() {
|
|
50
|
+
return getValue();
|
|
51
|
+
},
|
|
52
|
+
enumerable: true,
|
|
53
|
+
configurable: true,
|
|
54
|
+
});
|
|
55
|
+
return handle;
|
|
56
|
+
}
|
|
13
57
|
/**
|
|
14
58
|
* Internal Text filter component with options support
|
|
15
59
|
*/
|
|
16
|
-
const TextFilterComponent = ({ column, value, onChange, onFilter: onFilterProp, options }) => {
|
|
60
|
+
const TextFilterComponent = ({ column, value: valueProp, onChange, onFilter: onFilterProp, options }) => {
|
|
61
|
+
const value = useFilterValueFromContext(valueProp);
|
|
17
62
|
const { placeholder, className, style, defaultValue, delay = 500, getFilter, onFilter: onFilterOption, id, disabled, } = options || {};
|
|
18
63
|
// Support both onChange and onFilter props (onFilter is alias for onChange)
|
|
19
64
|
const onChangeCallback = onChange || onFilterProp || (() => { });
|
|
@@ -57,10 +102,8 @@ const TextFilterComponent = ({ column, value, onChange, onFilter: onFilterProp,
|
|
|
57
102
|
// Provide filter instance via getFilter callback - only on mount
|
|
58
103
|
useEffect(() => {
|
|
59
104
|
if (getFilter) {
|
|
60
|
-
getFilter({
|
|
61
|
-
|
|
62
|
-
return internalValueRef.current;
|
|
63
|
-
},
|
|
105
|
+
getFilter(createCallableFilterHandle({
|
|
106
|
+
getValue: () => internalValueRef.current,
|
|
64
107
|
setValue: (newValue) => {
|
|
65
108
|
setInternalValue(newValue);
|
|
66
109
|
onChangeRef.current(newValue || null);
|
|
@@ -71,7 +114,7 @@ const TextFilterComponent = ({ column, value, onChange, onFilter: onFilterProp,
|
|
|
71
114
|
onChangeRef.current(null);
|
|
72
115
|
onFilterRef.current?.('');
|
|
73
116
|
},
|
|
74
|
-
});
|
|
117
|
+
}));
|
|
75
118
|
}
|
|
76
119
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77
120
|
}, [getFilter]);
|
|
@@ -122,7 +165,8 @@ export function TextFilter(optionsOrProps) {
|
|
|
122
165
|
/**
|
|
123
166
|
* Internal Number filter component with options support
|
|
124
167
|
*/
|
|
125
|
-
const NumberFilterComponent = ({ column, value, onChange, onFilter: onFilterProp, options }) => {
|
|
168
|
+
const NumberFilterComponent = ({ column, value: valueProp, onChange, onFilter: onFilterProp, options }) => {
|
|
169
|
+
const value = useFilterValueFromContext(valueProp);
|
|
126
170
|
const { placeholder, className, style, defaultValue, delay = 500, defaultComparator = '=', allowDecimal = true, getFilter, onFilter: onFilterOption, id, disabled, hideComparator, comparators = ['=', '!=', '>', '>=', '<', '<='], } = options || {};
|
|
127
171
|
// Support both onChange and onFilter props (onFilter is alias for onChange)
|
|
128
172
|
const onChangeCallback = onChange || onFilterProp || (() => { });
|
|
@@ -178,16 +222,21 @@ const NumberFilterComponent = ({ column, value, onChange, onFilter: onFilterProp
|
|
|
178
222
|
// Provide filter instance via getFilter callback - only on mount
|
|
179
223
|
useEffect(() => {
|
|
180
224
|
if (getFilter) {
|
|
181
|
-
getFilter({
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
:
|
|
186
|
-
|
|
225
|
+
getFilter(createCallableFilterHandle({
|
|
226
|
+
getValue: () => numberRef.current
|
|
227
|
+
? {
|
|
228
|
+
number: numberRef.current,
|
|
229
|
+
comparator: comparatorRef.current,
|
|
230
|
+
}
|
|
231
|
+
: null,
|
|
187
232
|
setValue: (newValue) => {
|
|
188
233
|
if (newValue !== null && newValue !== undefined) {
|
|
189
|
-
const num = typeof newValue === 'object'
|
|
190
|
-
|
|
234
|
+
const num = typeof newValue === 'object'
|
|
235
|
+
? newValue.number
|
|
236
|
+
: String(newValue);
|
|
237
|
+
const comp = typeof newValue === 'object'
|
|
238
|
+
? newValue.comparator
|
|
239
|
+
: comparatorRef.current;
|
|
191
240
|
setNumber(num);
|
|
192
241
|
setComparator(comp);
|
|
193
242
|
onChangeRef.current({ number: num, comparator: comp });
|
|
@@ -205,7 +254,7 @@ const NumberFilterComponent = ({ column, value, onChange, onFilter: onFilterProp
|
|
|
205
254
|
onChangeRef.current(null);
|
|
206
255
|
onFilterRef.current?.(null);
|
|
207
256
|
},
|
|
208
|
-
});
|
|
257
|
+
}));
|
|
209
258
|
}
|
|
210
259
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
211
260
|
}, [getFilter]);
|
|
@@ -275,7 +324,8 @@ export function NumberFilter(optionsOrProps) {
|
|
|
275
324
|
/**
|
|
276
325
|
* Internal Date filter component with options support
|
|
277
326
|
*/
|
|
278
|
-
const DateFilterComponent = ({ column, value, onChange, onFilter: onFilterProp, options }) => {
|
|
327
|
+
const DateFilterComponent = ({ column, value: valueProp, onChange, onFilter: onFilterProp, options }) => {
|
|
328
|
+
const value = useFilterValueFromContext(valueProp);
|
|
279
329
|
const { className, style, defaultValue, defaultComparator = '=', defaultRangeMode = false, getFilter, onFilter: onFilterOption, id, disabled, minDate, maxDate, } = options || {};
|
|
280
330
|
// Support both onChange and onFilter props (onFilter is alias for onChange)
|
|
281
331
|
const handleChange = onChange || onFilterProp || (() => { });
|
|
@@ -353,8 +403,8 @@ const DateFilterComponent = ({ column, value, onChange, onFilter: onFilterProp,
|
|
|
353
403
|
// Provide filter instance via getFilter callback - only on mount
|
|
354
404
|
useEffect(() => {
|
|
355
405
|
if (getFilter) {
|
|
356
|
-
getFilter({
|
|
357
|
-
|
|
406
|
+
getFilter(createCallableFilterHandle({
|
|
407
|
+
getValue: () => {
|
|
358
408
|
const { startDate: s, endDate: e, diffFlag: d, comparator: c, } = stateRef.current;
|
|
359
409
|
return s || e
|
|
360
410
|
? { startDate: s, endDate: e, diffFlag: d, comparator: c }
|
|
@@ -384,7 +434,7 @@ const DateFilterComponent = ({ column, value, onChange, onFilter: onFilterProp,
|
|
|
384
434
|
onChangeRef.current(null);
|
|
385
435
|
onFilterRef.current?.(null);
|
|
386
436
|
},
|
|
387
|
-
});
|
|
437
|
+
}));
|
|
388
438
|
}
|
|
389
439
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
390
440
|
}, [getFilter]);
|
|
@@ -438,7 +488,8 @@ export function DateFilter(optionsOrProps) {
|
|
|
438
488
|
/**
|
|
439
489
|
* Internal Select filter component with options support
|
|
440
490
|
*/
|
|
441
|
-
const SelectFilterComponent = ({ column, value, onChange, onFilter: onFilterProp, options }) => {
|
|
491
|
+
const SelectFilterComponent = ({ column, value: valueProp, onChange, onFilter: onFilterProp, options }) => {
|
|
492
|
+
const value = useFilterValueFromContext(valueProp);
|
|
442
493
|
const { placeholder = 'All', className, style, defaultValue, delay = 300, options: customOptions, getFilter, onFilter: onFilterOption, id, disabled, } = options || {};
|
|
443
494
|
// Support both onChange and onFilter props (onFilter is alias for onChange)
|
|
444
495
|
const onChangeCallback = onChange || onFilterProp || (() => { });
|
|
@@ -479,10 +530,8 @@ const SelectFilterComponent = ({ column, value, onChange, onFilter: onFilterProp
|
|
|
479
530
|
// Provide filter instance via getFilter callback - only on mount
|
|
480
531
|
useEffect(() => {
|
|
481
532
|
if (getFilter) {
|
|
482
|
-
getFilter({
|
|
483
|
-
|
|
484
|
-
return selectedValueRef.current || null;
|
|
485
|
-
},
|
|
533
|
+
getFilter(createCallableFilterHandle({
|
|
534
|
+
getValue: () => selectedValueRef.current || null,
|
|
486
535
|
setValue: (newValue) => {
|
|
487
536
|
setSelectedValue(newValue || '');
|
|
488
537
|
onChangeRef.current(newValue);
|
|
@@ -493,7 +542,7 @@ const SelectFilterComponent = ({ column, value, onChange, onFilter: onFilterProp
|
|
|
493
542
|
onChangeRef.current(null);
|
|
494
543
|
onFilterRef.current?.(null);
|
|
495
544
|
},
|
|
496
|
-
});
|
|
545
|
+
}));
|
|
497
546
|
}
|
|
498
547
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
499
548
|
}, [getFilter]);
|
|
@@ -523,7 +572,8 @@ export function SelectFilter(optionsOrProps) {
|
|
|
523
572
|
/**
|
|
524
573
|
* Internal Custom filter component with options support
|
|
525
574
|
*/
|
|
526
|
-
const CustomFilterComponent = ({ column, value, onChange, onFilter: onFilterProp, options }) => {
|
|
575
|
+
const CustomFilterComponent = ({ column, value: valueProp, onChange, onFilter: onFilterProp, options }) => {
|
|
576
|
+
const value = useFilterValueFromContext(valueProp);
|
|
527
577
|
const { render, placeholder, className, style, defaultValue, delay = 300, getFilter, onFilter: onFilterOption, id, disabled, } = options;
|
|
528
578
|
// Support both onChange and onFilter props (onFilter is alias for onChange)
|
|
529
579
|
const onChangeCallback = onChange || onFilterProp || (() => { });
|
|
@@ -564,10 +614,8 @@ const CustomFilterComponent = ({ column, value, onChange, onFilter: onFilterProp
|
|
|
564
614
|
// Provide filter instance via getFilter callback - only on mount
|
|
565
615
|
useEffect(() => {
|
|
566
616
|
if (getFilter) {
|
|
567
|
-
getFilter({
|
|
568
|
-
|
|
569
|
-
return filterValueRef.current;
|
|
570
|
-
},
|
|
617
|
+
getFilter(createCallableFilterHandle({
|
|
618
|
+
getValue: () => filterValueRef.current,
|
|
571
619
|
setValue: (newValue) => {
|
|
572
620
|
setFilterValue(newValue);
|
|
573
621
|
onChangeRef.current(newValue);
|
|
@@ -578,7 +626,7 @@ const CustomFilterComponent = ({ column, value, onChange, onFilter: onFilterProp
|
|
|
578
626
|
onChangeRef.current(null);
|
|
579
627
|
onFilterRef.current?.(null);
|
|
580
628
|
},
|
|
581
|
-
});
|
|
629
|
+
}));
|
|
582
630
|
}
|
|
583
631
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
584
632
|
}, [getFilter]);
|
|
@@ -643,21 +691,21 @@ const CustomFilterComponent = ({ column, value, onChange, onFilter: onFilterProp
|
|
|
643
691
|
* })
|
|
644
692
|
*
|
|
645
693
|
* @example
|
|
646
|
-
* //
|
|
647
|
-
* //
|
|
694
|
+
* // With filterRenderer, mount the same factory component as `filter` so getFilter runs.
|
|
695
|
+
* // CustomFilter’s getFilter is not called if you only render a different component in filterRenderer.
|
|
696
|
+
* const PictureFilter = NumberFilter({
|
|
697
|
+
* placeholder: 'Picture',
|
|
698
|
+
* getFilter: (f) => {
|
|
699
|
+
* pictureFilterRef.current = f;
|
|
700
|
+
* },
|
|
701
|
+
* });
|
|
648
702
|
* {
|
|
649
|
-
*
|
|
650
|
-
*
|
|
651
|
-
*
|
|
652
|
-
* placeholder: 'Picture',
|
|
653
|
-
* getFilter: (filter) => {
|
|
654
|
-
* pictureFilterRef.current = filter;
|
|
655
|
-
* },
|
|
656
|
-
* }),
|
|
657
|
-
* filterRenderer: (onFilter, column) => (
|
|
658
|
-
* <NumberFilter onFilter={onFilter} column={column} />
|
|
703
|
+
* filter: PictureFilter,
|
|
704
|
+
* filterRenderer: (onFilter, column, {value, onClear}) => (
|
|
705
|
+
* <PictureFilter column={column} value={value} onChange={onFilter} />
|
|
659
706
|
* ),
|
|
660
707
|
* }
|
|
708
|
+
* // clearAllFilter: () => pictureFilterRef.current?.clear()
|
|
661
709
|
*
|
|
662
710
|
* @example
|
|
663
711
|
* // Custom range filter
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Table, default } from './Table';
|
|
2
2
|
export * from './types';
|
|
3
3
|
export { useSortState, useFilterState, usePaginationState, useRowSelection, useRowExpansion, useColumnVisibility, useTableDebounce, sortData, filterData, paginateData, getNestedValue, exportToCSV, exportToExcel, } from './hooks';
|
|
4
|
-
export { TextFilter, NumberFilter, DateFilter, SelectFilter, CustomFilter, getFilterComponent, } from './filters';
|
|
4
|
+
export { TextFilter, NumberFilter, DateFilter, SelectFilter, CustomFilter, getFilterComponent, createCallableFilterHandle, FilterValueProvider, } from './filters';
|
|
5
5
|
export type { TextFilterOptions, TextFilterInstance, NumberFilterOptions, NumberFilterInstance, SelectFilterOptions, SelectFilterInstance, DateFilterOptions, DateFilterInstance, CustomFilterOptions, CustomFilterRenderProps, CustomFilterInstance, } from './filters';
|
|
6
6
|
export { useColumnResize, getColumnStyle, ResizeHandle, ResizeLine, ResizableHeaderCell, } from './columnResize';
|
|
7
7
|
export type { ColumnResizeConfig, UseColumnResizeReturn } from './columnResize';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Table, default } from './Table';
|
|
2
2
|
export * from './types';
|
|
3
3
|
export { useSortState, useFilterState, usePaginationState, useRowSelection, useRowExpansion, useColumnVisibility, useTableDebounce, sortData, filterData, paginateData, getNestedValue, exportToCSV, exportToExcel, } from './hooks';
|
|
4
|
-
export { TextFilter, NumberFilter, DateFilter, SelectFilter, CustomFilter, getFilterComponent, } from './filters';
|
|
4
|
+
export { TextFilter, NumberFilter, DateFilter, SelectFilter, CustomFilter, getFilterComponent, createCallableFilterHandle, FilterValueProvider, } from './filters';
|
|
5
5
|
export { useColumnResize, getColumnStyle, ResizeHandle, ResizeLine, ResizableHeaderCell, } from './columnResize';
|
|
6
6
|
export { useColumnReorder, DragGhost, DropIndicator, DraggableHeader, ColumnReorderGhost, ColumnDropIndicator, getReorderableHeaderProps, } from './columnReorder';
|
|
@@ -155,6 +155,16 @@ export interface FieldConfig<T = any> {
|
|
|
155
155
|
/** Field type configuration for dynamic rendering */
|
|
156
156
|
export type FieldTypeConfig<T = any> = Record<string, FieldConfig<T>>;
|
|
157
157
|
/** Column definition */
|
|
158
|
+
/**
|
|
159
|
+
* Passed as the third argument to {@link TableColumn.filterRenderer} so custom
|
|
160
|
+
* filters stay controlled with table state (including clear-all).
|
|
161
|
+
*/
|
|
162
|
+
export interface TableFilterRendererContext {
|
|
163
|
+
/** Current value for this column from the table filter state */
|
|
164
|
+
value: any;
|
|
165
|
+
/** Clear this column’s filter only */
|
|
166
|
+
onClear: () => void;
|
|
167
|
+
}
|
|
158
168
|
export interface TableColumn<T = any> {
|
|
159
169
|
/** Unique field key */
|
|
160
170
|
dataField: string;
|
|
@@ -193,8 +203,8 @@ export interface TableColumn<T = any> {
|
|
|
193
203
|
}>;
|
|
194
204
|
/** Custom filter component (alias for filter when using component) */
|
|
195
205
|
filterComponent?: React.ComponentType<TableFilterProps>;
|
|
196
|
-
/** Custom filter renderer */
|
|
197
|
-
filterRenderer?: (onFilter: (value: any) => void, column: TableColumn<T
|
|
206
|
+
/** Custom filter renderer (third arg is always passed when provided by Table; optional in signature for backward compatibility) */
|
|
207
|
+
filterRenderer?: (onFilter: (value: any) => void, column: TableColumn<T>, context?: TableFilterRendererContext) => React.ReactNode;
|
|
198
208
|
/** Filter placeholder */
|
|
199
209
|
filterPlaceholder?: string;
|
|
200
210
|
/** Whether column is editable - boolean or function returning boolean/custom editor */
|
|
@@ -75,4 +75,14 @@
|
|
|
75
75
|
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/
|
|
76
76
|
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/
|
|
77
77
|
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/
|
|
78
|
+
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/
|
|
79
|
+
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/
|
|
80
|
+
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/
|
|
81
|
+
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/
|
|
82
|
+
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/
|
|
83
|
+
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/
|
|
84
|
+
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/
|
|
85
|
+
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/
|
|
86
|
+
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/
|
|
87
|
+
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/
|
|
78
88
|
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/.\!filter,.backdrop-blur-sm,.blur,.ring,.ring-2,.shadow,.shadow-inner,body{font-family:Arima Regular;font-size:14px}.dark\:bg-black:is(.dark *),.dark\:border-gray-600:is(.dark *){--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/fieldset,legend{padding:0}.container{width:100%}@media (min-width:0px){.container{max-width:0}}@media (min-width:20rem){.container{max-width:20rem}}@media (min-width:23.4375rem){.container{max-width:23.4375rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:90rem){.container{max-width:90rem}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.form-input,.form-input::-webkit-datetime-edit,.form-input::-webkit-datetime-edit-day-field,.form-input::-webkit-datetime-edit-hour-field,.form-input::-webkit-datetime-edit-meridiem-field,.form-input::-webkit-datetime-edit-millisecond-field,.form-input::-webkit-datetime-edit-minute-field,.form-input::-webkit-datetime-edit-month-field,.form-input::-webkit-datetime-edit-second-field,.form-input::placeholder,.form-input:focus,.form-multiselect,.form-multiselect:focus,.form-select,.form-select:focus,table{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}table:is(.dark *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}table tr:hover:is(.dark *){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}select:is(.dark *){--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.\!visible{visibility:visible!important}.top-1\/2{top:50%}.-translate-x-1\/2,.-translate-x-1\/2,.-translate-y-1\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y:-50%}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.25rem*var(--tw-space-x-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.divide-gray-100>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(243 244 246/var(--tw-divide-opacity,1))}.divide-teal-50>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(240 253 250/var(--tw-divide-opacity,1))}.bg-purple-900\/50{background-color:#581c8780}.p-0\.5{padding:.125rem}.py-1\.5{padding-bottom:.375rem;padding-top:.375rem}.\!filter,.blur,.ring,.ring-2,.shadow,.shadow-inner,.backdrop-blur-sm,body{font-family:Arima Regular;font-size:14px}.hover\:bg-white\/20:hover{background-color:#fff3}.dark\:border-gray-600:is(.dark *),.dark\:bg-black:is(.dark *){--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.dark\:bg-boxdark:is(.dark *){--tw-bg-opacity:1;background-color:rgb(36 48 63/var(--tw-bg-opacity,1))}.dark\:bg-gray-700:is(.dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.dark\:text-black:is(.dark *){--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity,1))}.dark\:text-gray-200:is(.dark *){--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.dark\:text-gray-300:is(.dark *){--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.dark\:text-gray-500:is(.dark *){--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.dark\:text-white:is(.dark *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\:placeholder-gray-400:is(.dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}.dark\:ring-offset-gray-800:is(.dark *){--tw-ring-offset-color:#1f2937}.dark\:hover\:bg-blue-900:hover:is(.dark *){--tw-bg-opacity:1;background-color:rgb(30 58 138/var(--tw-bg-opacity,1))}.dark\:hover\:bg-gray-600:hover:is(.dark *){--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.dark\:hover\:bg-gray-700:hover:is(.dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.dark\:focus\:ring-blue-600:focus:is(.dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(37 99 235/var(--tw-ring-opacity,1))}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}@font-face{font-family:ArimaRegular;src:url(library/assets/fonts/arima/arima-regular.ttf)}.container{width:100%}@media (min-width:0px){.container{max-width:0}}@media (min-width:20rem){.container{max-width:20rem}}@media (min-width:23.4375rem){.container{max-width:23.4375rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:90rem){.container{max-width:90rem}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.form-input,.form-multiselect,.form-select,.form-input:focus,.form-multiselect:focus,.form-select:focus,.form-input::placeholder,.form-input::-webkit-datetime-edit,.form-input::-webkit-datetime-edit-day-field,.form-input::-webkit-datetime-edit-hour-field,.form-input::-webkit-datetime-edit-meridiem-field,.form-input::-webkit-datetime-edit-millisecond-field,.form-input::-webkit-datetime-edit-minute-field,.form-input::-webkit-datetime-edit-month-field,.form-input::-webkit-datetime-edit-second-field,table{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}table:is(.dark *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}table tr:hover:is(.dark *){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}select:is(.dark *){--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.\!visible{visibility:visible!important}.top-1\/2{top:50%}.flex-grow,.-translate-x-1\/2{--tw-translate-x:-50%}.-translate-x-1\/2,.-translate-y-1\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y:-50%}@keyframes pulse{50%{opacity:.5}}@keyframes spin{to{transform:rotate(1turn)}}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.25rem*var(--tw-space-x-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.divide-gray-100>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(243 244 246/var(--tw-divide-opacity,1))}.divide-teal-50>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(240 253 250/var(--tw-divide-opacity,1))}.bg-purple-900\/50{background-color:#581c8780}.p-0\.5{padding:.125rem}.py-1\.5{padding-bottom:.375rem;padding-top:.375rem}.shadow,.shadow-inner,.shadow-md,.ring,.ring-2,.blur,.\!filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)!important}.backdrop-blur-sm,body{font-family:Arima Regular;font-size:14px}.menu ul{list-style:none;margin:0;padding:0}.menu li{border-bottom:1px solid #ddd;padding:10px}.menu li:last-child{border-bottom:none}.hover\:bg-white\/20:hover{background-color:#fff3}.focus\:ring-0:focus,.dark\:border-gray-600:is(.dark *){--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}.dark\:bg-black:is(.dark *){--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.dark\:bg-boxdark:is(.dark *){--tw-bg-opacity:1;background-color:rgb(36 48 63/var(--tw-bg-opacity,1))}.dark\:bg-gray-700:is(.dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.dark\:text-black:is(.dark *){--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity,1))}.dark\:text-gray-200:is(.dark *){--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.dark\:text-gray-300:is(.dark *){--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.dark\:text-gray-500:is(.dark *){--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.dark\:text-white:is(.dark *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\:placeholder-gray-400:is(.dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}.dark\:ring-offset-gray-800:is(.dark *){--tw-ring-offset-color:#1f2937}.dark\:hover\:bg-blue-900:hover:is(.dark *){--tw-bg-opacity:1;background-color:rgb(30 58 138/var(--tw-bg-opacity,1))}.dark\:hover\:bg-gray-600:hover:is(.dark *){--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.dark\:hover\:bg-gray-700:hover:is(.dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.dark\:focus\:ring-blue-600:focus:is(.dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(37 99 235/var(--tw-ring-opacity,1))}@media (min-width:0px) and (max-width:767px){}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-restyle-components",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.67",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easy use restyle components",
|
|
6
6
|
"author": {
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"precommit": "lint-staged --allow-empty",
|
|
21
21
|
"storybook": "storybook dev -p 6006",
|
|
22
22
|
"build-storybook": "rm -rf docs-build && storybook build -o docs-build",
|
|
23
|
-
"deploy-storybook": "gh-pages -d docs-build",
|
|
23
|
+
"deploy-storybook": "gh-pages -d docs-build --no-history -b gh-pages",
|
|
24
|
+
"build-deploy-storybook": "yarn build-storybook && yarn deploy-storybook",
|
|
24
25
|
"serve-storybook": "npm run build-storybook -- -o ./docs-build && npx http-server ./docs-build",
|
|
25
26
|
"lint": "eslint .",
|
|
26
27
|
"lint:fix": "eslint --fix .",
|