blunt-ui 1.0.0 → 1.1.0
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 +20 -12
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Table/Table.types.d.ts +3 -0
- package/dist/components/Table/stories/Table.stories.d.ts +1 -5
- package/dist/index.cjs +93 -50
- package/dist/index.js +918 -866
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,16 +103,18 @@ Sizes: `sm`, `md`. Shows an error message below when `error` is a string, turns
|
|
|
103
103
|
Same hidden-input pattern as Checkbox, but circular. Use multiple radios with the same `name` for a group, or manage `checked` yourself.
|
|
104
104
|
|
|
105
105
|
```tsx
|
|
106
|
-
{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
106
|
+
{
|
|
107
|
+
["remote", "hybrid", "on-site"].map((option) => (
|
|
108
|
+
<Radio
|
|
109
|
+
key={option}
|
|
110
|
+
name="workMode"
|
|
111
|
+
value={option}
|
|
112
|
+
label={option}
|
|
113
|
+
checked={value === option}
|
|
114
|
+
onChange={(e) => setValue(e.target.value)}
|
|
115
|
+
/>
|
|
116
|
+
));
|
|
117
|
+
}
|
|
116
118
|
```
|
|
117
119
|
|
|
118
120
|
### Switch
|
|
@@ -441,13 +443,19 @@ Each input's `name` needs to match a key in `initialValues`. `reset()` puts ever
|
|
|
441
443
|
The library ships with validators you can use in the `validate` function:
|
|
442
444
|
|
|
443
445
|
```tsx
|
|
444
|
-
import {
|
|
446
|
+
import {
|
|
447
|
+
required,
|
|
448
|
+
minLength,
|
|
449
|
+
isEmail,
|
|
450
|
+
isUrl,
|
|
451
|
+
composeValidators,
|
|
452
|
+
} from "blunt-ui";
|
|
445
453
|
|
|
446
454
|
validate: (v) => ({
|
|
447
455
|
email: composeValidators(required(), isEmail())(v.email),
|
|
448
456
|
password: minLength(8)(v.password),
|
|
449
457
|
website: isUrl()(v.website),
|
|
450
|
-
})
|
|
458
|
+
});
|
|
451
459
|
```
|
|
452
460
|
|
|
453
461
|
`composeValidators` runs validators left to right and returns the first error. Available validators: `required`, `minLength`, `maxLength`, `isEmail`, `isUrl`, `pattern`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TableProps } from './Table.types';
|
|
2
|
-
export declare function Table<T extends Record<string, unknown> = Record<string, unknown>>({ columns, data, rowKey, size, striped, bordered, stickyHeader, caption, emptyMessage, loading, sort, defaultSort, onSortChange, pageSize, page, defaultPage, totalRows, onPageChange, onChange, onRowClick, borderColor, headerColor, rowColor, stripeColor, className, style, }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function Table<T extends Record<string, unknown> = Record<string, unknown>>({ columns, data, rowKey, size, striped, bordered, stickyHeader, stickyPagination, caption, emptyMessage, loading, sort, defaultSort, onSortChange, pageSize, page, defaultPage, totalRows, onPageChange, pageSizeOptions, onPageSizeChange, onChange, onRowClick, borderColor, headerColor, rowColor, stripeColor, className, style, }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export declare namespace Table {
|
|
4
4
|
var displayName: string;
|
|
5
5
|
}
|
|
@@ -34,6 +34,7 @@ export interface TableProps<T extends Record<string, unknown> = Record<string, u
|
|
|
34
34
|
striped?: boolean;
|
|
35
35
|
bordered?: boolean;
|
|
36
36
|
stickyHeader?: boolean;
|
|
37
|
+
stickyPagination?: boolean;
|
|
37
38
|
caption?: string;
|
|
38
39
|
emptyMessage?: string;
|
|
39
40
|
loading?: boolean;
|
|
@@ -45,6 +46,8 @@ export interface TableProps<T extends Record<string, unknown> = Record<string, u
|
|
|
45
46
|
defaultPage?: number;
|
|
46
47
|
totalRows?: number;
|
|
47
48
|
onPageChange?: (page: number) => void;
|
|
49
|
+
pageSizeOptions?: number[];
|
|
50
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
48
51
|
onChange?: (state: TableChangeState) => void;
|
|
49
52
|
borderColor?: string;
|
|
50
53
|
headerColor?: string;
|
|
@@ -4,14 +4,10 @@ declare const meta: Meta<typeof Table>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof Table>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
|
-
export declare const StripedAndBordered: Story;
|
|
8
7
|
export declare const WithCustomRender: Story;
|
|
9
8
|
export declare const Sortable: Story;
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const WithUseTable: Story;
|
|
9
|
+
export declare const WithPagination: Story;
|
|
12
10
|
export declare const Loading: Story;
|
|
13
11
|
export declare const Empty: Story;
|
|
14
|
-
export declare const Paginated: Story;
|
|
15
12
|
export declare const StickyHeader: Story;
|
|
16
13
|
export declare const WithRowClick: Story;
|
|
17
|
-
export declare const FullyCustomized: Story;
|