@dragunio/fe-libs 0.1.1 → 0.1.3
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 +78 -7
- package/dist/index.d.mts +400 -3
- package/dist/index.d.ts +400 -3
- package/dist/index.js +968 -94
- package/dist/index.mjs +944 -88
- package/dist/styles.css +1437 -5
- package/package.json +36 -9
package/README.md
CHANGED
|
@@ -9,7 +9,17 @@ src/ # Public library entrypoints and styles
|
|
|
9
9
|
packages/ # Internal component source folders
|
|
10
10
|
├── icons/
|
|
11
11
|
├── button/
|
|
12
|
-
|
|
12
|
+
├── table/
|
|
13
|
+
├── toggle/
|
|
14
|
+
├── drawer/
|
|
15
|
+
├── form-controls/
|
|
16
|
+
├── tooltip/
|
|
17
|
+
├── expandable-section/
|
|
18
|
+
├── loading/
|
|
19
|
+
├── skeleton/
|
|
20
|
+
├── modal/
|
|
21
|
+
├── progress/
|
|
22
|
+
└── chip/
|
|
13
23
|
apps/playground/ # Local component storybook
|
|
14
24
|
```
|
|
15
25
|
|
|
@@ -29,14 +39,30 @@ The playground resolves package names directly to `packages/*/src`, so component
|
|
|
29
39
|
pnpm dev
|
|
30
40
|
```
|
|
31
41
|
|
|
32
|
-
Open the URL printed by Vite, usually `http://127.0.0.1:
|
|
42
|
+
Open the URL printed by Vite, usually `http://127.0.0.1:3000`.
|
|
33
43
|
|
|
34
44
|
Available review routes:
|
|
35
45
|
|
|
36
|
-
- `http://127.0.0.1:
|
|
37
|
-
- `http://127.0.0.1:
|
|
38
|
-
- `http://127.0.0.1:
|
|
39
|
-
- `http://127.0.0.1:
|
|
46
|
+
- `http://127.0.0.1:3000/#/` — overview
|
|
47
|
+
- `http://127.0.0.1:3000/#/icons` — SVG Icons
|
|
48
|
+
- `http://127.0.0.1:3000/#/button` — Button
|
|
49
|
+
- `http://127.0.0.1:3000/#/table` — Table
|
|
50
|
+
- `http://127.0.0.1:3000/#/drawer` — Drawer
|
|
51
|
+
- `http://127.0.0.1:3000/#/selection` — Selection
|
|
52
|
+
- `http://127.0.0.1:3000/#/datetime` — DateTimePicker
|
|
53
|
+
- `http://127.0.0.1:3000/#/currency` — CurrencyInput
|
|
54
|
+
- `http://127.0.0.1:3000/#/number` — NumberInput
|
|
55
|
+
- `http://127.0.0.1:3000/#/tooltip` — Tooltip
|
|
56
|
+
- `http://127.0.0.1:3000/#/expandable` — ExpandableSection
|
|
57
|
+
- `http://127.0.0.1:3000/#/loading` — Loading
|
|
58
|
+
- `http://127.0.0.1:3000/#/skeleton` — Skeleton
|
|
59
|
+
- `http://127.0.0.1:3000/#/modal` — Modal
|
|
60
|
+
- `http://127.0.0.1:3000/#/progress` — ProgressBar
|
|
61
|
+
- `http://127.0.0.1:3000/#/chip` — Chip
|
|
62
|
+
- `http://127.0.0.1:3000/#/text-input` — TextInput & TextArea
|
|
63
|
+
- `http://127.0.0.1:3000/#/pagination` — Pagination
|
|
64
|
+
- `http://127.0.0.1:3000/#/message` — Message
|
|
65
|
+
- `http://127.0.0.1:3000/#/snackbar` — Snackbar
|
|
40
66
|
|
|
41
67
|
To test the playground against generated package output instead of source aliases:
|
|
42
68
|
|
|
@@ -57,10 +83,23 @@ pnpm add @dragunio/fe-libs
|
|
|
57
83
|
```
|
|
58
84
|
|
|
59
85
|
```tsx
|
|
60
|
-
import { Button, PlusIcon, Table } from '@dragunio/fe-libs';
|
|
86
|
+
import { Button, PlusIcon, Table, Toggle, Selection, DateTimePicker } from '@dragunio/fe-libs';
|
|
61
87
|
import '@dragunio/fe-libs/styles.css';
|
|
62
88
|
```
|
|
63
89
|
|
|
90
|
+
### Toggle
|
|
91
|
+
|
|
92
|
+
`Toggle` is a native checkbox styled as a switch. It supports controlled and uncontrolled usage, including the standard `onChange`, `onClick`, and `disabled` props. The active color is green by default and accepts any CSS color.
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
<Toggle
|
|
96
|
+
checked={enabled}
|
|
97
|
+
onChange={(event) => setEnabled(event.target.checked)}
|
|
98
|
+
color="#16a34a"
|
|
99
|
+
aria-label="Enable notifications"
|
|
100
|
+
/>
|
|
101
|
+
```
|
|
102
|
+
|
|
64
103
|
### Resizable data table
|
|
65
104
|
|
|
66
105
|
Pass `headers` and `data` to have `Table` derive the maximum column count and an initial width for each column. The resize callback emits pixel widths, ready to persist in user preferences.
|
|
@@ -83,4 +122,36 @@ const [columnSizes, setColumnSizes] = useState<number[]>();
|
|
|
83
122
|
|
|
84
123
|
Use `minColumnWidth` to change the minimum resize limit. The header resize handles support pointer dragging and left/right arrow keys.
|
|
85
124
|
|
|
125
|
+
Set `pageSize` to paginate a data-driven table (it enables pagination automatically), or use `pagination` with the default page size of 10. `page`, `defaultPage`, and `onPageChange` support controlled or uncontrolled state; `paginationPosition` accepts `top-right`, `bottom-right`, and `bottom-center`.
|
|
126
|
+
|
|
86
127
|
The library exposes ESM, CommonJS, TypeScript declarations, and keeps React as a peer dependency.
|
|
128
|
+
|
|
129
|
+
### New form and overlay primitives
|
|
130
|
+
|
|
131
|
+
- `Drawer` is a portal-based modal panel with `left`, `right`, `top`, and `bottom` slide-in animations. Use `fullScreen` for a full-viewport panel and `footer` for fixed actions below the scrollable body.
|
|
132
|
+
- `Selection` is a rounded custom dropdown inspired by DropdownCustom, with single/multiple modes, optional search, clear action, tags, form-field values, and keyboard navigation.
|
|
133
|
+
- `DateTimePicker` supports `mode="single"` and `mode="range"`; its default format is `dd/MM/yyyy HH:mm`.
|
|
134
|
+
- `NumberInput` and `CurrencyInput` format values immediately while typing (`1000` → `1,000`) and keep up to two fractional digits by default. Use `allowDecimal`, `decimals`, `min`, and `max` to control decimal input and numeric limits. Both support `error` and `errorMessage` with the same red border/message treatment as `TextInput`. `CurrencyInput` adds a `VND` suffix by default, or a currency dropdown through `currencies`.
|
|
135
|
+
- `Tooltip` shows accessible content on hover and focus.
|
|
136
|
+
- `ExpandableSection` provides controlled and uncontrolled expand/collapse behavior.
|
|
137
|
+
- `TextInput` and `TextArea` support `error`/`errorMessage`, `helperText`, `clearable`, `onClear`, and `onValueChange`. Passing a string to `error` shows it below the field and applies the error border.
|
|
138
|
+
- `Modal` is a centered portal dialog in `small`, `medium`, `large`, `xlarge`, and `full` sizes. Its close control and `actions` are library `Button` instances.
|
|
139
|
+
- `Loading` provides `small`, `medium`, and `large` circular indicators (or a custom pixel `size`); use `Skeleton.Circle` and `Skeleton.Square` with `size`, or `Skeleton.Box` and `Skeleton.Line` with `width` and `height`.
|
|
140
|
+
- `ProgressBar` is determinate when `value` is supplied and renders an indeterminate back-and-forth animation when it is omitted.
|
|
141
|
+
- `Chip` supports the standard `default`, `success`, `error`, `info`, and `warning` palettes, plus `color` for any CSS color and `subtle`, `solid`, or `outline` variants.
|
|
142
|
+
- `Pagination` supports controlled (`page`) and uncontrolled (`defaultPage`) navigation, compact ellipses, and accessible previous/next controls.
|
|
143
|
+
- Mount `Message` once near the app root and trigger top-right alert notifications with `Message.success`, `Message.info`, `Message.warning`, or `Message.error`. `Snackbar` is a controlled temporary notification with actions, auto-hide, and configurable placement.
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
<TextInput
|
|
147
|
+
label="Email"
|
|
148
|
+
value={email}
|
|
149
|
+
onValueChange={setEmail}
|
|
150
|
+
errorMessage={emailError}
|
|
151
|
+
clearable
|
|
152
|
+
/>
|
|
153
|
+
|
|
154
|
+
<ProgressBar label="Upload" value={72} />
|
|
155
|
+
<ProgressBar label="Synchronising" />
|
|
156
|
+
<Chip status="success" dot>Complete</Chip>
|
|
157
|
+
```
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ButtonHTMLAttributes, ReactNode, SVGProps, TableHTMLAttributes, HTMLAttributes } from 'react';
|
|
2
|
+
import { ButtonHTMLAttributes, ReactNode, SVGProps, TableHTMLAttributes, HTMLAttributes, InputHTMLAttributes, KeyboardEventHandler, TextareaHTMLAttributes, ReactElement } from 'react';
|
|
3
3
|
|
|
4
4
|
type ButtonHierarchy = 'primary' | 'secondary-gray' | 'secondary-color' | 'tertiary-gray' | 'tertiary-color';
|
|
5
5
|
type ButtonSize = '24' | '32' | '40';
|
|
@@ -53,6 +53,7 @@ declare function SearchIcon(props: IconProps): react.JSX.Element;
|
|
|
53
53
|
|
|
54
54
|
type TableData = readonly (readonly ReactNode[])[];
|
|
55
55
|
type ColumnResizeHandler = (columnSizes: number[], columnIndex: number) => void;
|
|
56
|
+
type TablePaginationPosition = 'top-right' | 'bottom-right' | 'bottom-center' | 'middle-bottom';
|
|
56
57
|
type TableProps = TableHTMLAttributes<HTMLTableElement> & {
|
|
57
58
|
/** Enables alternating background colors for body rows. */
|
|
58
59
|
striped?: boolean;
|
|
@@ -68,12 +69,24 @@ type TableProps = TableHTMLAttributes<HTMLTableElement> & {
|
|
|
68
69
|
onColumnResize?: ColumnResizeHandler;
|
|
69
70
|
/** Smallest width, in pixels, that a user can resize a column to. */
|
|
70
71
|
minColumnWidth?: number;
|
|
72
|
+
/** Shows the built-in Pagination for data-driven tables. Enabled by pageSize as well. */
|
|
73
|
+
pagination?: boolean;
|
|
74
|
+
/** Number of data rows shown on each page. Defaults to 10 when pagination is enabled. */
|
|
75
|
+
pageSize?: number;
|
|
76
|
+
/** Controlled one-based page number. */
|
|
77
|
+
page?: number;
|
|
78
|
+
/** Initial page number for uncontrolled pagination. */
|
|
79
|
+
defaultPage?: number;
|
|
80
|
+
/** Called with the newly selected one-based page number. */
|
|
81
|
+
onPageChange?: (page: number) => void;
|
|
82
|
+
/** Location of the built-in Pagination. Defaults to bottom-right. */
|
|
83
|
+
paginationPosition?: TablePaginationPosition;
|
|
71
84
|
};
|
|
72
85
|
/**
|
|
73
86
|
* A semantic table. Use its child primitives for custom markup, or pass headers
|
|
74
87
|
* and data for an automatically sized, striped and resizable table.
|
|
75
88
|
*/
|
|
76
|
-
declare function Table({ headers, data, striped, children, ...props }: TableProps): react.JSX.Element;
|
|
89
|
+
declare function Table({ headers, data, striped, children, pagination, pageSize, page, defaultPage, onPageChange, paginationPosition, ...props }: TableProps): react.JSX.Element;
|
|
77
90
|
declare function TableHead(props: HTMLAttributes<HTMLTableSectionElement>): react.JSX.Element;
|
|
78
91
|
declare function TableBody(props: HTMLAttributes<HTMLTableSectionElement>): react.JSX.Element;
|
|
79
92
|
declare function TableRow({ children, ...props }: HTMLAttributes<HTMLTableRowElement>): react.JSX.Element;
|
|
@@ -81,4 +94,388 @@ declare function TableCell({ children, ...props }: HTMLAttributes<HTMLTableCellE
|
|
|
81
94
|
declare function TableHeader({ children, ...props }: HTMLAttributes<HTMLTableCellElement>): react.JSX.Element;
|
|
82
95
|
declare function TableCaption(props: HTMLAttributes<HTMLTableCaptionElement>): react.JSX.Element;
|
|
83
96
|
|
|
84
|
-
|
|
97
|
+
type ToggleProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'color' | 'type'> & {
|
|
98
|
+
/** Active track color. Accepts any valid CSS color, for example `#16a34a`. */
|
|
99
|
+
color?: string;
|
|
100
|
+
/** Optional text displayed next to the switch. */
|
|
101
|
+
label?: ReactNode;
|
|
102
|
+
};
|
|
103
|
+
declare const Toggle: react.ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "color" | "type"> & {
|
|
104
|
+
/** Active track color. Accepts any valid CSS color, for example `#16a34a`. */
|
|
105
|
+
color?: string;
|
|
106
|
+
/** Optional text displayed next to the switch. */
|
|
107
|
+
label?: ReactNode;
|
|
108
|
+
} & react.RefAttributes<HTMLInputElement>>;
|
|
109
|
+
|
|
110
|
+
type DrawerProps = Omit<HTMLAttributes<HTMLElement>, 'title'> & {
|
|
111
|
+
open: boolean;
|
|
112
|
+
onClose: () => void;
|
|
113
|
+
title?: ReactNode;
|
|
114
|
+
/** Optional content pinned below the scrollable body. */
|
|
115
|
+
footer?: ReactNode;
|
|
116
|
+
side?: 'left' | 'right' | 'top' | 'bottom';
|
|
117
|
+
/** Width of a left/right drawer. Defaults to 400px. */
|
|
118
|
+
width?: number | string;
|
|
119
|
+
/** Makes the panel fill the entire viewport while retaining the chosen entrance direction. */
|
|
120
|
+
fullScreen?: boolean;
|
|
121
|
+
children?: ReactNode;
|
|
122
|
+
closeOnBackdropClick?: boolean;
|
|
123
|
+
};
|
|
124
|
+
/** A modal panel with fixed header/footer regions and a scrollable body. */
|
|
125
|
+
declare function Drawer({ open, onClose, title, footer, side, width, fullScreen, children, closeOnBackdropClick, className, style, ...props }: DrawerProps): react.ReactPortal | null;
|
|
126
|
+
|
|
127
|
+
type FieldError = boolean | ReactNode;
|
|
128
|
+
type TextFieldBaseProps = {
|
|
129
|
+
label?: ReactNode;
|
|
130
|
+
helperText?: ReactNode;
|
|
131
|
+
/** A string/node is displayed beneath the control; `true` uses a default message. */
|
|
132
|
+
error?: FieldError;
|
|
133
|
+
errorMessage?: ReactNode;
|
|
134
|
+
clearable?: boolean;
|
|
135
|
+
onClear?: () => void;
|
|
136
|
+
onValueChange?: (value: string) => void;
|
|
137
|
+
clearLabel?: string;
|
|
138
|
+
};
|
|
139
|
+
type TextInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'value' | 'defaultValue'> & TextFieldBaseProps & {
|
|
140
|
+
value?: string;
|
|
141
|
+
defaultValue?: string;
|
|
142
|
+
};
|
|
143
|
+
type TextAreaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'defaultValue'> & TextFieldBaseProps & {
|
|
144
|
+
value?: string;
|
|
145
|
+
defaultValue?: string;
|
|
146
|
+
};
|
|
147
|
+
/** A text field with helper/error text and a Button-powered clear action. */
|
|
148
|
+
declare const TextInput: react.ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "value" | "defaultValue"> & TextFieldBaseProps & {
|
|
149
|
+
value?: string;
|
|
150
|
+
defaultValue?: string;
|
|
151
|
+
} & react.RefAttributes<HTMLInputElement>>;
|
|
152
|
+
/** A multi-line text field with helper/error text and a Button-powered clear action. */
|
|
153
|
+
declare const TextArea: react.ForwardRefExoticComponent<Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "value" | "defaultValue"> & TextFieldBaseProps & {
|
|
154
|
+
value?: string;
|
|
155
|
+
defaultValue?: string;
|
|
156
|
+
} & react.RefAttributes<HTMLTextAreaElement>>;
|
|
157
|
+
type SelectionOption = {
|
|
158
|
+
label: ReactNode;
|
|
159
|
+
value: string | number;
|
|
160
|
+
disabled?: boolean;
|
|
161
|
+
searchText?: string;
|
|
162
|
+
};
|
|
163
|
+
type SelectionValue = string | number | Array<string | number>;
|
|
164
|
+
type SelectionProps = Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'value' | 'onKeyDown'> & {
|
|
165
|
+
label?: ReactNode;
|
|
166
|
+
helperText?: ReactNode;
|
|
167
|
+
error?: boolean;
|
|
168
|
+
options: SelectionOption[];
|
|
169
|
+
placeholder?: string;
|
|
170
|
+
size?: 'small' | 'medium';
|
|
171
|
+
value?: SelectionValue;
|
|
172
|
+
defaultValue?: SelectionValue;
|
|
173
|
+
onChange?: (value: SelectionValue, selected: SelectionOption | SelectionOption[] | undefined) => void;
|
|
174
|
+
multiple?: boolean;
|
|
175
|
+
searchable?: boolean;
|
|
176
|
+
tag?: boolean;
|
|
177
|
+
clearable?: boolean;
|
|
178
|
+
disabled?: boolean;
|
|
179
|
+
name?: string;
|
|
180
|
+
onKeyDown?: KeyboardEventHandler<HTMLButtonElement>;
|
|
181
|
+
};
|
|
182
|
+
/** A rounded, searchable custom dropdown with single, multiple, and tag modes. */
|
|
183
|
+
declare const Selection: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "value" | "defaultValue" | "onChange" | "onKeyDown"> & {
|
|
184
|
+
label?: ReactNode;
|
|
185
|
+
helperText?: ReactNode;
|
|
186
|
+
error?: boolean;
|
|
187
|
+
options: SelectionOption[];
|
|
188
|
+
placeholder?: string;
|
|
189
|
+
size?: "small" | "medium";
|
|
190
|
+
value?: SelectionValue;
|
|
191
|
+
defaultValue?: SelectionValue;
|
|
192
|
+
onChange?: (value: SelectionValue, selected: SelectionOption | SelectionOption[] | undefined) => void;
|
|
193
|
+
multiple?: boolean;
|
|
194
|
+
searchable?: boolean;
|
|
195
|
+
tag?: boolean;
|
|
196
|
+
clearable?: boolean;
|
|
197
|
+
disabled?: boolean;
|
|
198
|
+
name?: string;
|
|
199
|
+
onKeyDown?: KeyboardEventHandler<HTMLButtonElement>;
|
|
200
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
201
|
+
type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max'> & {
|
|
202
|
+
value?: number | null;
|
|
203
|
+
defaultValue?: number | null;
|
|
204
|
+
onValueChange?: (value: number | null) => void;
|
|
205
|
+
/** Allows the decimal separator and fractional digits. Defaults to true. */
|
|
206
|
+
allowDecimal?: boolean;
|
|
207
|
+
/** Maximum number of fractional digits when allowDecimal is enabled. Defaults to 2. */
|
|
208
|
+
decimals?: number;
|
|
209
|
+
/** Numeric limits applied immediately as the value changes. */
|
|
210
|
+
min?: number;
|
|
211
|
+
max?: number;
|
|
212
|
+
decimalSeparator?: string;
|
|
213
|
+
thousandSeparator?: string;
|
|
214
|
+
label?: ReactNode;
|
|
215
|
+
helperText?: ReactNode;
|
|
216
|
+
/** A string/node is displayed beneath the control; `true` uses a default message. */
|
|
217
|
+
error?: FieldError;
|
|
218
|
+
errorMessage?: ReactNode;
|
|
219
|
+
};
|
|
220
|
+
declare function formatNumber(value: number, decimals?: number, thousandSeparator?: string, decimalSeparator?: string): string;
|
|
221
|
+
/** A text input that displays numbers as 1,000.05 by default. */
|
|
222
|
+
declare const NumberInput: react.ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange" | "max" | "min"> & {
|
|
223
|
+
value?: number | null;
|
|
224
|
+
defaultValue?: number | null;
|
|
225
|
+
onValueChange?: (value: number | null) => void;
|
|
226
|
+
/** Allows the decimal separator and fractional digits. Defaults to true. */
|
|
227
|
+
allowDecimal?: boolean;
|
|
228
|
+
/** Maximum number of fractional digits when allowDecimal is enabled. Defaults to 2. */
|
|
229
|
+
decimals?: number;
|
|
230
|
+
/** Numeric limits applied immediately as the value changes. */
|
|
231
|
+
min?: number;
|
|
232
|
+
max?: number;
|
|
233
|
+
decimalSeparator?: string;
|
|
234
|
+
thousandSeparator?: string;
|
|
235
|
+
label?: ReactNode;
|
|
236
|
+
helperText?: ReactNode;
|
|
237
|
+
/** A string/node is displayed beneath the control; `true` uses a default message. */
|
|
238
|
+
error?: FieldError;
|
|
239
|
+
errorMessage?: ReactNode;
|
|
240
|
+
} & react.RefAttributes<HTMLInputElement>>;
|
|
241
|
+
type Currency = {
|
|
242
|
+
code: string;
|
|
243
|
+
label?: string;
|
|
244
|
+
suffix?: string;
|
|
245
|
+
};
|
|
246
|
+
type CurrencyInputProps = Omit<NumberInputProps, 'suffix'> & {
|
|
247
|
+
suffix?: ReactNode;
|
|
248
|
+
currencies?: Currency[];
|
|
249
|
+
currency?: string;
|
|
250
|
+
defaultCurrency?: string;
|
|
251
|
+
onCurrencyChange?: (currency: Currency) => void;
|
|
252
|
+
};
|
|
253
|
+
/** NumberInput with an optional currency suffix or currency list dropdown. */
|
|
254
|
+
declare function CurrencyInput({ suffix, currencies, currency, defaultCurrency, onCurrencyChange, className, ...props }: CurrencyInputProps): react.JSX.Element;
|
|
255
|
+
type DateRange = [Date | null, Date | null];
|
|
256
|
+
type DateTimeBaseProps = Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> & {
|
|
257
|
+
label?: ReactNode;
|
|
258
|
+
format?: string;
|
|
259
|
+
disabled?: boolean;
|
|
260
|
+
placeholder?: string;
|
|
261
|
+
locale?: string;
|
|
262
|
+
};
|
|
263
|
+
type DateTimePickerSingleProps = DateTimeBaseProps & {
|
|
264
|
+
mode?: 'single';
|
|
265
|
+
value?: Date | null;
|
|
266
|
+
defaultValue?: Date | null;
|
|
267
|
+
onChange?: (value: Date | null) => void;
|
|
268
|
+
};
|
|
269
|
+
type DateTimePickerRangeProps = DateTimeBaseProps & {
|
|
270
|
+
mode: 'range';
|
|
271
|
+
value?: DateRange;
|
|
272
|
+
defaultValue?: DateRange;
|
|
273
|
+
onChange?: (value: DateRange) => void;
|
|
274
|
+
};
|
|
275
|
+
type DateTimePickerProps = DateTimePickerSingleProps | DateTimePickerRangeProps;
|
|
276
|
+
/** Calendar and time picker. Supports a single Date or [start, end] range. */
|
|
277
|
+
declare function DateTimePicker(props: DateTimePickerProps): react.JSX.Element;
|
|
278
|
+
|
|
279
|
+
type TooltipProps = Omit<HTMLAttributes<HTMLSpanElement>, 'content'> & {
|
|
280
|
+
content: ReactNode;
|
|
281
|
+
children: ReactElement;
|
|
282
|
+
placement?: 'top' | 'bottom' | 'left' | 'right';
|
|
283
|
+
disabled?: boolean;
|
|
284
|
+
};
|
|
285
|
+
/** Accessible hover/focus tooltip. The child must accept focus and mouse event props. */
|
|
286
|
+
declare function Tooltip({ content, children, placement, disabled, className, ...props }: TooltipProps): react.JSX.Element;
|
|
287
|
+
|
|
288
|
+
type ExpandableSectionProps = Omit<HTMLAttributes<HTMLDivElement>, 'title'> & {
|
|
289
|
+
title: ReactNode;
|
|
290
|
+
children: ReactNode;
|
|
291
|
+
expanded?: boolean;
|
|
292
|
+
defaultExpanded?: boolean;
|
|
293
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
294
|
+
disabled?: boolean;
|
|
295
|
+
};
|
|
296
|
+
/** An outlined section that can be expanded or collapsed. */
|
|
297
|
+
declare function ExpandableSection({ title, children, expanded, defaultExpanded, onExpandedChange, disabled, className, ...props }: ExpandableSectionProps): react.JSX.Element;
|
|
298
|
+
|
|
299
|
+
type LoadingSize = 'small' | 'medium' | 'large' | number;
|
|
300
|
+
type LoadingProps = HTMLAttributes<HTMLSpanElement> & {
|
|
301
|
+
/** Diameter of the spinner. Accepts presets or a pixel value. */
|
|
302
|
+
size?: LoadingSize;
|
|
303
|
+
/** Spinner color. Accepts every valid CSS color. */
|
|
304
|
+
color?: string;
|
|
305
|
+
/** Optional visible status text. */
|
|
306
|
+
label?: ReactNode;
|
|
307
|
+
};
|
|
308
|
+
/** An accessible circular loading indicator with three preset sizes. */
|
|
309
|
+
declare function Loading({ size, color, label, className, style, ...props }: LoadingProps): react.JSX.Element;
|
|
310
|
+
|
|
311
|
+
type SkeletonVariant = 'box' | 'circle' | 'line';
|
|
312
|
+
type SkeletonProps = HTMLAttributes<HTMLDivElement> & {
|
|
313
|
+
/** Visual shape. `box` is the default. */
|
|
314
|
+
variant?: SkeletonVariant;
|
|
315
|
+
/** Alias for variant, useful when describing the visual shape. */
|
|
316
|
+
shape?: SkeletonVariant;
|
|
317
|
+
width?: number | string;
|
|
318
|
+
height?: number | string;
|
|
319
|
+
/** Render multiple stacked placeholders. */
|
|
320
|
+
count?: number;
|
|
321
|
+
/** Turns off the shimmer animation. */
|
|
322
|
+
animated?: boolean;
|
|
323
|
+
};
|
|
324
|
+
type SkeletonSizeProps = Omit<SkeletonProps, 'variant' | 'shape' | 'width' | 'height' | 'count'> & {
|
|
325
|
+
/** Diameter/edge length. A number is converted to pixels. */
|
|
326
|
+
size?: number | string;
|
|
327
|
+
};
|
|
328
|
+
type SkeletonBoxProps = Omit<SkeletonProps, 'variant' | 'shape' | 'count'>;
|
|
329
|
+
/** A shimmer placeholder for rectangular boxes, avatars, and text lines. */
|
|
330
|
+
declare function SkeletonBase({ variant, shape, width, height, count, animated, className, style, ...props }: SkeletonProps): react.JSX.Element;
|
|
331
|
+
/** A circular placeholder, useful for avatars and icon buttons. */
|
|
332
|
+
declare function SkeletonCircle({ size, ...props }: SkeletonSizeProps): react.JSX.Element;
|
|
333
|
+
/** A square placeholder, useful for thumbnails and image previews. */
|
|
334
|
+
declare function SkeletonSquare({ size, ...props }: SkeletonSizeProps): react.JSX.Element;
|
|
335
|
+
/** A rectangular placeholder with explicit width and height. */
|
|
336
|
+
declare function SkeletonBox({ width, height, ...props }: SkeletonBoxProps): react.JSX.Element;
|
|
337
|
+
/** A text-line placeholder with explicit width and height. */
|
|
338
|
+
declare function SkeletonLine({ width, height, ...props }: SkeletonBoxProps): react.JSX.Element;
|
|
339
|
+
type SkeletonComponent = typeof SkeletonBase & {
|
|
340
|
+
Circle: typeof SkeletonCircle;
|
|
341
|
+
Square: typeof SkeletonSquare;
|
|
342
|
+
Box: typeof SkeletonBox;
|
|
343
|
+
Line: typeof SkeletonLine;
|
|
344
|
+
};
|
|
345
|
+
/**
|
|
346
|
+
* A shimmer placeholder. Use the focused helpers for new code:
|
|
347
|
+
* `Skeleton.Circle`, `Skeleton.Square`, `Skeleton.Box`, and `Skeleton.Line`.
|
|
348
|
+
*/
|
|
349
|
+
declare const Skeleton: SkeletonComponent;
|
|
350
|
+
|
|
351
|
+
type ModalSize = 'small' | 'medium' | 'large' | 'xlarge' | 'full';
|
|
352
|
+
type ModalAction = Omit<ButtonProps, 'children' | 'content'> & {
|
|
353
|
+
label: ReactNode;
|
|
354
|
+
};
|
|
355
|
+
type ModalProps = Omit<HTMLAttributes<HTMLDivElement>, 'title'> & {
|
|
356
|
+
open: boolean;
|
|
357
|
+
onClose: () => void;
|
|
358
|
+
title?: ReactNode;
|
|
359
|
+
description?: ReactNode;
|
|
360
|
+
children?: ReactNode;
|
|
361
|
+
/** Custom footer content, rendered before actions. */
|
|
362
|
+
footer?: ReactNode;
|
|
363
|
+
/** Actions rendered with the library Button component. */
|
|
364
|
+
actions?: ModalAction[];
|
|
365
|
+
size?: ModalSize;
|
|
366
|
+
closeOnBackdropClick?: boolean;
|
|
367
|
+
closeButton?: boolean;
|
|
368
|
+
closeLabel?: string;
|
|
369
|
+
};
|
|
370
|
+
/** A centered, portal-based dialog with Button-powered close and footer actions. */
|
|
371
|
+
declare function Modal({ open, onClose, title, description, children, footer, actions, size, closeOnBackdropClick, closeButton, closeLabel, className, ...props }: ModalProps): react.ReactPortal | null;
|
|
372
|
+
|
|
373
|
+
type ProgressBarSize = 'small' | 'medium' | 'large';
|
|
374
|
+
type ProgressBarProps = HTMLAttributes<HTMLDivElement> & {
|
|
375
|
+
/** Current value. Omit it for the indeterminate, bouncing state. */
|
|
376
|
+
value?: number | null;
|
|
377
|
+
max?: number;
|
|
378
|
+
label?: ReactNode;
|
|
379
|
+
showValue?: boolean;
|
|
380
|
+
size?: ProgressBarSize;
|
|
381
|
+
color?: string;
|
|
382
|
+
};
|
|
383
|
+
/** A determinate percentage bar or an indeterminate bar that moves back and forth. */
|
|
384
|
+
declare function ProgressBar({ value, max, label, showValue, size, color, className, style, 'aria-label': ariaLabel, ...props }: ProgressBarProps): react.JSX.Element;
|
|
385
|
+
|
|
386
|
+
type ChipStatus = 'default' | 'info' | 'success' | 'warning' | 'error' | 'neutral' | 'pending' | 'processing';
|
|
387
|
+
type ChipVariant = 'subtle' | 'solid' | 'outline';
|
|
388
|
+
type ChipProps = HTMLAttributes<HTMLSpanElement> & {
|
|
389
|
+
children: ReactNode;
|
|
390
|
+
/** Status color palette: default, success, error, info, warning, plus neutral/pending/processing. */
|
|
391
|
+
status?: ChipStatus;
|
|
392
|
+
/** Any CSS color. Overrides the status palette. */
|
|
393
|
+
color?: string;
|
|
394
|
+
variant?: ChipVariant;
|
|
395
|
+
dot?: boolean;
|
|
396
|
+
onRemove?: () => void;
|
|
397
|
+
removeLabel?: string;
|
|
398
|
+
};
|
|
399
|
+
/** A compact status label with status palettes and custom CSS colors. */
|
|
400
|
+
declare function Chip({ children, status, color, variant, dot, onRemove, removeLabel, className, style, ...props }: ChipProps): react.JSX.Element;
|
|
401
|
+
|
|
402
|
+
type PaginationProps = Omit<HTMLAttributes<HTMLElement>, 'onChange'> & {
|
|
403
|
+
/** Current page (one-based). Provide this with onPageChange for controlled use. */
|
|
404
|
+
page?: number;
|
|
405
|
+
/** Starting page for uncontrolled use. */
|
|
406
|
+
defaultPage?: number;
|
|
407
|
+
/** Total number of pages. */
|
|
408
|
+
totalPages: number;
|
|
409
|
+
/** Called whenever the selected page changes. */
|
|
410
|
+
onPageChange?: (page: number) => void;
|
|
411
|
+
/** Number of page buttons shown around the current page. */
|
|
412
|
+
siblingCount?: number;
|
|
413
|
+
/** Number of page buttons retained at each edge. */
|
|
414
|
+
boundaryCount?: number;
|
|
415
|
+
disabled?: boolean;
|
|
416
|
+
previousLabel?: string;
|
|
417
|
+
nextLabel?: string;
|
|
418
|
+
};
|
|
419
|
+
/** A compact, accessible page navigator with controlled and uncontrolled APIs. */
|
|
420
|
+
declare function Pagination({ page, defaultPage, totalPages, onPageChange, siblingCount, boundaryCount, disabled, previousLabel, nextLabel, className, ...props }: PaginationProps): react.JSX.Element;
|
|
421
|
+
|
|
422
|
+
type MessageSeverity = 'success' | 'info' | 'warning' | 'error';
|
|
423
|
+
type MessageOptions = {
|
|
424
|
+
content: ReactNode;
|
|
425
|
+
severity?: MessageSeverity;
|
|
426
|
+
title?: ReactNode;
|
|
427
|
+
/** Set to null to leave the message visible until manually dismissed. */
|
|
428
|
+
duration?: number | null;
|
|
429
|
+
action?: ReactNode;
|
|
430
|
+
onClose?: () => void;
|
|
431
|
+
};
|
|
432
|
+
declare function dismiss(id: number): void;
|
|
433
|
+
declare function show({ duration, severity, ...options }: MessageOptions): number;
|
|
434
|
+
declare const message: {
|
|
435
|
+
show: typeof show;
|
|
436
|
+
success: (content: ReactNode, options?: Omit<MessageOptions, "content" | "severity">) => number;
|
|
437
|
+
info: (content: ReactNode, options?: Omit<MessageOptions, "content" | "severity">) => number;
|
|
438
|
+
warning: (content: ReactNode, options?: Omit<MessageOptions, "content" | "severity">) => number;
|
|
439
|
+
error: (content: ReactNode, options?: Omit<MessageOptions, "content" | "severity">) => number;
|
|
440
|
+
dismiss: typeof dismiss;
|
|
441
|
+
clear: () => void;
|
|
442
|
+
};
|
|
443
|
+
type MessageProps = HTMLAttributes<HTMLDivElement> & {
|
|
444
|
+
/** Maximum notifications shown at the same time. */
|
|
445
|
+
maxCount?: number;
|
|
446
|
+
closeLabel?: string;
|
|
447
|
+
};
|
|
448
|
+
/**
|
|
449
|
+
* Notification viewport for the global `message` trigger.
|
|
450
|
+
* Mount once near the application root, then call `message.success(...)`.
|
|
451
|
+
*/
|
|
452
|
+
declare function Message({ maxCount, closeLabel, className, ...props }: MessageProps): react.JSX.Element;
|
|
453
|
+
/** Imperative trigger aliases, available as `Message.success(...)` as well. */
|
|
454
|
+
declare namespace Message {
|
|
455
|
+
const show: ({ duration, severity, ...options }: MessageOptions) => number;
|
|
456
|
+
const success: (content: ReactNode, options?: Omit<MessageOptions, "content" | "severity">) => number;
|
|
457
|
+
const info: (content: ReactNode, options?: Omit<MessageOptions, "content" | "severity">) => number;
|
|
458
|
+
const warning: (content: ReactNode, options?: Omit<MessageOptions, "content" | "severity">) => number;
|
|
459
|
+
const error: (content: ReactNode, options?: Omit<MessageOptions, "content" | "severity">) => number;
|
|
460
|
+
const dismiss: (id: number) => void;
|
|
461
|
+
const clear: () => void;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
type SnackbarAnchorOrigin = {
|
|
465
|
+
vertical?: 'top' | 'bottom';
|
|
466
|
+
horizontal?: 'left' | 'center' | 'right';
|
|
467
|
+
};
|
|
468
|
+
type SnackbarProps = Omit<HTMLAttributes<HTMLDivElement>, 'onClose'> & {
|
|
469
|
+
open: boolean;
|
|
470
|
+
message: ReactNode;
|
|
471
|
+
/** Set to null to keep the snackbar open until dismissed. */
|
|
472
|
+
autoHideDuration?: number | null;
|
|
473
|
+
onClose?: (reason: 'timeout' | 'closeButton' | 'escapeKeyDown') => void;
|
|
474
|
+
action?: ReactNode;
|
|
475
|
+
anchorOrigin?: SnackbarAnchorOrigin;
|
|
476
|
+
closeLabel?: string;
|
|
477
|
+
};
|
|
478
|
+
/** A controlled, temporary notification surface. */
|
|
479
|
+
declare function Snackbar({ open, message, autoHideDuration, onClose, action, anchorOrigin, closeLabel, className, ...props }: SnackbarProps): react.JSX.Element | null;
|
|
480
|
+
|
|
481
|
+
export { Button, type ButtonColor, type ButtonHierarchy, type ButtonProps, type ButtonSize, type ButtonVariant, ChevronDownIcon, Chip, type ChipProps, type ChipStatus, type ChipVariant, CloseIcon, type ColumnResizeHandler, type Currency, CurrencyInput, type CurrencyInputProps, type DateRange, DateTimePicker, type DateTimePickerProps, type DateTimePickerRangeProps, type DateTimePickerSingleProps, Drawer, type DrawerProps, ExpandableSection, type ExpandableSectionProps, type FieldError, type IconProps, Loading, type LoadingProps, type LoadingSize, Message, type MessageOptions, type MessageProps, type MessageSeverity, Modal, type ModalAction, type ModalProps, type ModalSize, NumberInput, type NumberInputProps, Pagination, type PaginationProps, PlusIcon, ProgressBar, type ProgressBarProps, type ProgressBarSize, SearchIcon, Selection, type SelectionOption, type SelectionProps, type SelectionValue, Skeleton, SkeletonBox, type SkeletonBoxProps, SkeletonCircle, SkeletonLine, type SkeletonProps, type SkeletonSizeProps, SkeletonSquare, type SkeletonVariant, Snackbar, type SnackbarAnchorOrigin, type SnackbarProps, Table, TableBody, TableCaption, TableCell, type TableData, TableHead, TableHeader, type TablePaginationPosition, type TableProps, TableRow, TextArea, type TextAreaProps, TextInput, type TextInputProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, formatNumber, getIconSize, message };
|