@mucsi96/react-ui 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +233 -2
- package/dist/components/button/button.d.ts +21 -0
- package/dist/components/dialog/dialog.d.ts +13 -0
- package/dist/components/donut-slider/donut-slider.d.ts +16 -0
- package/dist/components/forms/controls.d.ts +23 -0
- package/dist/components/forms/select.d.ts +22 -0
- package/dist/components/forms/text-field.d.ts +14 -0
- package/dist/components/loader/loader.d.ts +13 -0
- package/dist/components/menu/menu.d.ts +18 -0
- package/dist/components/notifications/notifications.d.ts +26 -0
- package/dist/components/split-button/split-button.d.ts +9 -0
- package/dist/components/surface/surface.d.ts +22 -0
- package/dist/components/table/data-table.d.ts +21 -0
- package/dist/components/tooltip/tooltip.d.ts +9 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +831 -0
- package/dist/internal/classes.d.ts +1 -0
- package/dist/internal/icon.d.ts +16 -0
- package/dist/styles.css +2 -0
- package/dist/types.d.ts +1 -0
- package/package.json +50 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Igor Bari
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,234 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mucsi96/react-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Accessible, dark-first React components with CSS Modules, TypeScript, and a cohesive semantic palette.
|
|
4
|
+
|
|
5
|
+
[Interactive gallery](https://mucsi96.github.io/react-ui/) · [Source](https://github.com/mucsi96/react-ui)
|
|
6
|
+
|
|
7
|
+
## Getting started
|
|
8
|
+
|
|
9
|
+
Requires React and React DOM 19.3 or newer within React 19. The package is ESM and includes TypeScript declarations. Versions are released automatically from verified main-branch builds.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @mucsi96/react-ui
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Import the stylesheet **once**, at your application entry point:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Button } from '@mucsi96/react-ui';
|
|
19
|
+
import '@mucsi96/react-ui/styles.css';
|
|
20
|
+
|
|
21
|
+
export function SaveAction() {
|
|
22
|
+
return <Button onPress={() => save()}>Save</Button>;
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Components need no theme provider. The stylesheet defines the dark `--bt-*` tokens and `color-scheme` on `:root`; all component selectors and animations are locally scoped. It does not reset your application's typography or layout. The library entry is marked as a client boundary for React Server Component frameworks.
|
|
27
|
+
|
|
28
|
+
## Buttons
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
<Button variant="filled" tone="success" onPress={save}>Save</Button>
|
|
32
|
+
<Button variant="raised" tone="error">Incorrect</Button>
|
|
33
|
+
<Button variant="outlined">Secondary</Button>
|
|
34
|
+
<Button variant="text">Cancel</Button>
|
|
35
|
+
<Button variant="icon" aria-label="Search"><SearchIcon /></Button>
|
|
36
|
+
<Button variant="fab"><PlusIcon />New item</Button>
|
|
37
|
+
<Button variant="mini-fab" aria-label="Add"><PlusIcon /></Button>
|
|
38
|
+
<Button isDisabled>Unavailable</Button>
|
|
39
|
+
<LinkButton href="/settings" variant="outlined">Settings</LinkButton>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`tone` accepts `primary` (default), `success`, `warn`, and `error`. Solid variants share the same background, automatically contrasting black/white label, and same-hue hover. Modern relative OKLCH color syntax derives these coordinated colors. Pass `background="#28a745"` or set `--bt-button-bg` in your own CSS Module to customize a solid action. Text/outlined/icon variants use neutral surfaces.
|
|
43
|
+
|
|
44
|
+
Buttons expose React Aria's press API (`onPress`, `isDisabled`) and React 19's `ref` prop. Set `type="submit"` for form submission. Supply an accessible label for icon-only actions. Icons are ordinary React children; no icon package is imposed on consumers.
|
|
45
|
+
|
|
46
|
+
## Forms
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
const [email, setEmail] = useState('');
|
|
50
|
+
const options = [{ id: 'apple', label: 'Apple' }, { id: 'pear', label: 'Pear' }];
|
|
51
|
+
|
|
52
|
+
<TextField label="Email" name="email" type="email" isRequired
|
|
53
|
+
value={email} onChange={setEmail} description="We will never share your address." />
|
|
54
|
+
<TextField label="Bio" multiline rows={4} appearance="filled" />
|
|
55
|
+
<Select label="Fruit" options={options} />
|
|
56
|
+
<ComboBox label="Search fruits" options={options} />
|
|
57
|
+
<Checkbox defaultSelected>Subscribe</Checkbox>
|
|
58
|
+
<RadioGroup label="Size" defaultValue="medium">
|
|
59
|
+
<Radio value="small">Small</Radio>
|
|
60
|
+
<Radio value="medium">Medium</Radio>
|
|
61
|
+
</RadioGroup>
|
|
62
|
+
<Switch defaultSelected>Notifications</Switch>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Labels, descriptions, and validation messages are associated with the input automatically. `TextField`, `Select`, and `ComboBox` accept `error` for application validation. For an externally managed error, use `validationBehavior="aria"` to expose invalid state without waiting for native form submission. Native constraints (`isRequired`, `type`, `minLength`, etc.) also remain available.
|
|
66
|
+
|
|
67
|
+
Select options have `{ id, label, isDisabled? }`; React Aria handles selection, typeahead, and filtering. Checkbox and switch controlled state uses `isSelected`/`onChange`; radio group state uses `value`/`onChange`. React Aria form `name` props support native form submissions.
|
|
68
|
+
|
|
69
|
+
## Donut slider
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
const [amount, setAmount] = useState(15);
|
|
73
|
+
|
|
74
|
+
<DonutSlider
|
|
75
|
+
label="Tip"
|
|
76
|
+
unit="%"
|
|
77
|
+
value={amount}
|
|
78
|
+
onChange={setAmount}
|
|
79
|
+
valuePerTurn={20}
|
|
80
|
+
step={1}
|
|
81
|
+
min={0}
|
|
82
|
+
max={100}
|
|
83
|
+
/>;
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
| Prop | Default | Purpose |
|
|
87
|
+
| -------------------- | --------- | ---------------------------------------------- |
|
|
88
|
+
| `label` | required | Visible and accessible name |
|
|
89
|
+
| `value` / `onChange` | — | Controlled value and callback |
|
|
90
|
+
| `defaultValue` | `0` | Initial uncontrolled value |
|
|
91
|
+
| `valuePerTurn` | `100` | Value added by one full clockwise turn |
|
|
92
|
+
| `step` | `1` | Positive snap grid and keyboard increment |
|
|
93
|
+
| `min` / `max` | unbounded | Optional limits; negative values are supported |
|
|
94
|
+
| `unit` | `''` | Readout and accessible-value suffix |
|
|
95
|
+
| `size` | `220` | Diameter in pixels, capped by available width |
|
|
96
|
+
| `displayDecimals` | `0` | Decimal places in the readout |
|
|
97
|
+
| `isDisabled` | `false` | Prevent pointer/keyboard interaction |
|
|
98
|
+
|
|
99
|
+
Tap chooses the nearest revolution; continuous dragging accumulates full turns across the seam. Pointer capture keeps the drag active outside the ring and releases on pointer cancellation. Arrow keys increment/decrement by `step`; Page Up/Down move by one tenth of a turn; Home/End use the supplied bounds. Values snap to zero-based step multiples and then clamp to bounds. The slider is not a native form field; include a hidden input if you need its value in `FormData`.
|
|
100
|
+
|
|
101
|
+
## Menus and split buttons
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
<MenuTrigger>
|
|
105
|
+
<Button>Actions</Button>
|
|
106
|
+
<MenuPopover>
|
|
107
|
+
<Menu aria-label="Actions">
|
|
108
|
+
<MenuItem onAction={edit}>Edit</MenuItem>
|
|
109
|
+
<MenuItem onAction={duplicate}>Duplicate</MenuItem>
|
|
110
|
+
<MenuSeparator />
|
|
111
|
+
<MenuItem tone="error" onAction={remove}>Delete</MenuItem>
|
|
112
|
+
</Menu>
|
|
113
|
+
</MenuPopover>
|
|
114
|
+
</MenuTrigger>
|
|
115
|
+
|
|
116
|
+
<SplitButton label="Save" onPress={save} menuLabel="Save options">
|
|
117
|
+
<MenuItem onAction={saveAs}>Save as…</MenuItem>
|
|
118
|
+
<MenuItem onAction={saveAndClose}>Save and close</MenuItem>
|
|
119
|
+
</SplitButton>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
For nested actions, compose `SubmenuTrigger` with a `MenuItem` and another `MenuPopover`/`Menu`. Use `textValue` on items containing icons or other complex content. `MenuSeparator` separates groups. `SplitButton` accepts the button's tone, custom background, and disabled props for both halves.
|
|
123
|
+
|
|
124
|
+
## Dialogs and tooltips
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
<DialogTrigger>
|
|
128
|
+
<Button>Create project</Button>
|
|
129
|
+
<Dialog title="New project" description="Give your next idea a home.">
|
|
130
|
+
{({ close }) => <>
|
|
131
|
+
<TextField label="Project name" />
|
|
132
|
+
<Button onPress={close}>Done</Button>
|
|
133
|
+
</>}
|
|
134
|
+
</Dialog>
|
|
135
|
+
</DialogTrigger>
|
|
136
|
+
|
|
137
|
+
<Tooltip content="Search">
|
|
138
|
+
<Button variant="icon" aria-label="Search"><SearchIcon /></Button>
|
|
139
|
+
</Tooltip>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Dialog focus is trapped while open and restored to the trigger on close. Escape and outside interaction dismiss by default; `isDismissable={false}` disables outside dismissal, and `isKeyboardDismissDisabled` disables Escape. Use `role="alertdialog"` for important confirmations. Dialogs also support controlled `isOpen`/`onOpenChange` without a `DialogTrigger`. Forms and action layouts are composed as ordinary children. Tooltips accept a single pressable child, `content`, optional `placement`, and `delay`.
|
|
143
|
+
|
|
144
|
+
## Notifications
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
<NotificationsProvider>
|
|
148
|
+
<App />
|
|
149
|
+
</NotificationsProvider>;
|
|
150
|
+
|
|
151
|
+
function SaveButton() {
|
|
152
|
+
const notifications = useNotifications();
|
|
153
|
+
return <Button onPress={() => notifications.success('Changes saved')}>Save</Button>;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
<Alert tone="error" title="Unable to save">
|
|
157
|
+
Try again in a moment.
|
|
158
|
+
</Alert>;
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
The hook exposes `info`, `success`, `warn`, and `error`, returning a notification ID. Each accepts `{ title?, duration? }`; the default duration is 4000 ms, and `0` keeps it until dismissed. Timers pause while hovered or focused and are cleaned up on unmount. Use `dismiss(id)` or `clear()` to remove notifications. Error notifications use an assertive live region; other tones use a polite status. Toasts render in a body portal, so theme overrides for overlays belong on `:root`.
|
|
162
|
+
|
|
163
|
+
## Data table
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
const columns: TableColumn<Person>[] = [
|
|
167
|
+
{
|
|
168
|
+
id: 'name',
|
|
169
|
+
label: 'Person',
|
|
170
|
+
renderCell: (row) => row.name,
|
|
171
|
+
compare: (a, b) => a.name.localeCompare(b.name),
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
id: 'age',
|
|
175
|
+
label: 'Age',
|
|
176
|
+
renderCell: (row) => row.age,
|
|
177
|
+
compare: (a, b) => a.age - b.age,
|
|
178
|
+
align: 'end',
|
|
179
|
+
},
|
|
180
|
+
];
|
|
181
|
+
|
|
182
|
+
<DataTable
|
|
183
|
+
caption="People"
|
|
184
|
+
rows={people}
|
|
185
|
+
columns={columns}
|
|
186
|
+
getRowKey={(row) => row.id}
|
|
187
|
+
pageSize={10}
|
|
188
|
+
selectedKey={selectedKey}
|
|
189
|
+
onSelectionChange={setSelectedKey}
|
|
190
|
+
getRowLabel={(row) => row.name}
|
|
191
|
+
/>;
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
This is a semantic HTML table. Columns with `compare` have three-state sorting (ascending, descending, original order) and `aria-sort` feedback. Sorting precedes pagination. Selection is controlled and exposed through keyboard-accessible row buttons; `getRowLabel` names those buttons. Omitting `onSelectionChange` removes selection entirely. Use `emptyMessage` for empty results. Horizontal overflow stays within the table on narrow screens.
|
|
195
|
+
|
|
196
|
+
## Loading, surfaces, and typography
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
<BarLoader label="Loading workspace" />
|
|
200
|
+
<Spinner label="Fetching results" />
|
|
201
|
+
<ProgressBar label="Uploading" value={65} />
|
|
202
|
+
<ProgressBar label="Preparing" isIndeterminate />
|
|
203
|
+
|
|
204
|
+
<Card variant="outlined">
|
|
205
|
+
<Heading level={3}>Workspace</Heading>
|
|
206
|
+
<Text muted>Supporting information.</Text>
|
|
207
|
+
<Divider />
|
|
208
|
+
<Badge tone="success">Active</Badge>
|
|
209
|
+
</Card>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
All loading animations respect reduced motion. `Card` supports `outlined` and `elevated`; `Badge` accepts semantic tones and `neutral`. `Heading` supports semantic levels 1–6, `Text` supports `muted`, and `Code` provides inline monospace styling.
|
|
213
|
+
|
|
214
|
+
## Customize with CSS Modules
|
|
215
|
+
|
|
216
|
+
```css
|
|
217
|
+
/* Application-level tokens, including portaled overlays */
|
|
218
|
+
:root {
|
|
219
|
+
--bt-primary: hsl(280, 80%, 60%);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/* MyPanel.module.css */
|
|
223
|
+
.panel {
|
|
224
|
+
background: var(--bt-surface-1);
|
|
225
|
+
color: var(--bt-text-default);
|
|
226
|
+
}
|
|
227
|
+
.customAction {
|
|
228
|
+
--bt-button-bg: #28a745;
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Use `className` to extend styles without reaching into internal module selectors. The public palette includes `surface-0` through `surface-4`, `outline`, `text-strong`, `text-default`, `text-muted`, `text-on-brand`, `primary`, `primary-hover`, `link`, `link-hint`, semantic `success`/`warn`/`error` colors, hover variants, soft variants, and success/error foreground tokens. Shared `--bt-font`, `--bt-font-mono`, `--bt-radius`, `--bt-radius-lg`, and `--bt-shadow` tokens complete the foundation.
|
|
233
|
+
|
|
234
|
+
MIT © Igor Bari
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ButtonProps as AriaButtonProps, LinkProps } from 'react-aria-components';
|
|
2
|
+
import type { CSSProperties, ReactNode, Ref } from 'react';
|
|
3
|
+
import type { Tone } from '../../types';
|
|
4
|
+
export type ButtonVariant = 'filled' | 'raised' | 'outlined' | 'text' | 'icon' | 'fab' | 'mini-fab';
|
|
5
|
+
interface Appearance {
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
tone?: Tone;
|
|
8
|
+
background?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export interface ButtonProps extends Omit<AriaButtonProps, keyof Appearance>, Appearance {
|
|
14
|
+
ref?: Ref<HTMLButtonElement>;
|
|
15
|
+
}
|
|
16
|
+
export declare function Button({ variant, tone, background, className, style, children, ref, ...props }: ButtonProps): import("react").JSX.Element;
|
|
17
|
+
export interface LinkButtonProps extends Omit<LinkProps, keyof Appearance>, Appearance {
|
|
18
|
+
ref?: Ref<HTMLAnchorElement>;
|
|
19
|
+
}
|
|
20
|
+
export declare function LinkButton({ variant, tone, background, className, style, children, ref, ...props }: LinkButtonProps): import("react").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ModalOverlayProps } from 'react-aria-components';
|
|
3
|
+
export { DialogTrigger } from 'react-aria-components';
|
|
4
|
+
export interface DialogProps extends Omit<ModalOverlayProps, 'children' | 'className'> {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
children: ReactNode | ((props: {
|
|
8
|
+
close: () => void;
|
|
9
|
+
}) => ReactNode);
|
|
10
|
+
role?: 'dialog' | 'alertdialog';
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function Dialog({ title, description, children, role, className, isDismissable, ...props }: DialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface DonutSliderProps {
|
|
2
|
+
label: string;
|
|
3
|
+
value?: number;
|
|
4
|
+
defaultValue?: number;
|
|
5
|
+
onChange?: (value: number) => void;
|
|
6
|
+
valuePerTurn?: number;
|
|
7
|
+
step?: number;
|
|
8
|
+
min?: number;
|
|
9
|
+
max?: number;
|
|
10
|
+
unit?: string;
|
|
11
|
+
size?: number;
|
|
12
|
+
displayDecimals?: number;
|
|
13
|
+
isDisabled?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function DonutSlider({ label, value, defaultValue, onChange, valuePerTurn, step, min, max, unit, size, displayDecimals, isDisabled, className, }: DonutSliderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CheckboxProps as AriaCheckboxProps, RadioGroupProps as AriaRadioGroupProps, RadioProps as AriaRadioProps, SwitchProps as AriaSwitchProps } from 'react-aria-components';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
export interface CheckboxProps extends Omit<AriaCheckboxProps, 'children' | 'className'> {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function Checkbox({ children, className, ...props }: CheckboxProps): import("react").JSX.Element;
|
|
8
|
+
export interface RadioGroupProps extends Omit<AriaRadioGroupProps, 'children' | 'className'> {
|
|
9
|
+
label: string;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function RadioGroup({ label, children, className, ...props }: RadioGroupProps): import("react").JSX.Element;
|
|
14
|
+
export interface RadioProps extends Omit<AriaRadioProps, 'children' | 'className'> {
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function Radio({ children, className, ...props }: RadioProps): import("react").JSX.Element;
|
|
19
|
+
export interface SwitchProps extends Omit<AriaSwitchProps, 'children' | 'className'> {
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function Switch({ children, className, ...props }: SwitchProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SelectProps as AriaSelectProps, ComboBoxProps as AriaComboBoxProps } from 'react-aria-components';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
export interface SelectOption {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface FieldProps {
|
|
9
|
+
label: string;
|
|
10
|
+
options: readonly SelectOption[];
|
|
11
|
+
description?: ReactNode;
|
|
12
|
+
error?: ReactNode;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SelectProps extends Omit<AriaSelectProps<SelectOption>, keyof FieldProps | 'children' | 'items'>, FieldProps {
|
|
17
|
+
}
|
|
18
|
+
export declare function Select({ label, options, description, error, placeholder, className, ...props }: SelectProps): import("react").JSX.Element;
|
|
19
|
+
export interface ComboBoxProps extends Omit<AriaComboBoxProps<SelectOption>, keyof FieldProps | 'children' | 'items' | 'defaultItems'>, FieldProps {
|
|
20
|
+
}
|
|
21
|
+
export declare function ComboBox({ label, options, description, error, placeholder, className, ...props }: ComboBoxProps): import("react").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TextFieldProps as AriaTextFieldProps } from 'react-aria-components';
|
|
2
|
+
import type { ReactNode, Ref } from 'react';
|
|
3
|
+
export interface TextFieldProps extends Omit<AriaTextFieldProps, 'children' | 'className'> {
|
|
4
|
+
label: string;
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
error?: ReactNode;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
multiline?: boolean;
|
|
9
|
+
rows?: number;
|
|
10
|
+
appearance?: 'outlined' | 'filled';
|
|
11
|
+
className?: string;
|
|
12
|
+
ref?: Ref<HTMLDivElement>;
|
|
13
|
+
}
|
|
14
|
+
export declare function TextField({ label, description, error, placeholder, multiline, rows, appearance, className, ref, ...props }: TextFieldProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ProgressBarProps as AriaProgressBarProps } from 'react-aria-components';
|
|
2
|
+
export interface BarLoaderProps {
|
|
3
|
+
label?: string;
|
|
4
|
+
color?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function BarLoader({ label, color, className }: BarLoaderProps): import("react").JSX.Element;
|
|
8
|
+
export declare function Spinner({ label, className }: Omit<BarLoaderProps, 'color'>): import("react").JSX.Element;
|
|
9
|
+
export interface ProgressBarProps extends Omit<AriaProgressBarProps, 'children' | 'className'> {
|
|
10
|
+
label: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function ProgressBar({ label, className, ...props }: ProgressBarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { MenuProps as AriaMenuProps, MenuItemProps as AriaMenuItemProps, PopoverProps } from 'react-aria-components';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
export { MenuTrigger, SubmenuTrigger } from 'react-aria-components';
|
|
4
|
+
export interface MenuProps<T extends object> extends Omit<AriaMenuProps<T>, 'className'> {
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function Menu<T extends object>({ className, ...props }: MenuProps<T>): import("react").JSX.Element;
|
|
8
|
+
export interface MenuItemProps extends Omit<AriaMenuItemProps, 'className' | 'children'> {
|
|
9
|
+
className?: string;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
tone?: 'default' | 'error';
|
|
12
|
+
}
|
|
13
|
+
export declare function MenuItem({ className, tone, children, ...props }: MenuItemProps): import("react").JSX.Element;
|
|
14
|
+
export interface MenuPopoverProps extends Omit<PopoverProps, 'className'> {
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function MenuPopover({ className, ...props }: MenuPopoverProps): import("react").JSX.Element;
|
|
18
|
+
export declare function MenuSeparator(): import("react").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type NotificationTone = 'info' | 'success' | 'warn' | 'error';
|
|
3
|
+
export interface AlertProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
tone?: NotificationTone;
|
|
5
|
+
title?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function Alert({ tone, title, children, className, role, ...props }: AlertProps): import("react").JSX.Element;
|
|
8
|
+
export interface NotificationOptions {
|
|
9
|
+
title?: string;
|
|
10
|
+
/** Set to 0 to keep a notification until it is dismissed. */
|
|
11
|
+
duration?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface Notifications {
|
|
14
|
+
info: (message: string, options?: NotificationOptions) => number;
|
|
15
|
+
success: (message: string, options?: NotificationOptions) => number;
|
|
16
|
+
warn: (message: string, options?: NotificationOptions) => number;
|
|
17
|
+
error: (message: string, options?: NotificationOptions) => number;
|
|
18
|
+
dismiss: (id: number) => void;
|
|
19
|
+
clear: () => void;
|
|
20
|
+
}
|
|
21
|
+
export interface NotificationsProviderProps {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
defaultDuration?: number;
|
|
24
|
+
}
|
|
25
|
+
export declare function NotificationsProvider({ children, defaultDuration, }: NotificationsProviderProps): import("react").JSX.Element;
|
|
26
|
+
export declare function useNotifications(): Notifications;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ButtonProps } from '../button/button';
|
|
3
|
+
export interface SplitButtonProps extends Omit<ButtonProps, 'children' | 'variant' | 'ref'> {
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
menuLabel?: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function SplitButton({ label, icon, menuLabel, children, className, ...props }: SplitButtonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import type { Tone } from '../../types';
|
|
3
|
+
export interface CardProps extends HTMLAttributes<HTMLElement> {
|
|
4
|
+
variant?: 'elevated' | 'outlined';
|
|
5
|
+
}
|
|
6
|
+
export declare function Card({ variant, className, ...props }: CardProps): import("react").JSX.Element;
|
|
7
|
+
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
8
|
+
tone?: Tone | 'neutral';
|
|
9
|
+
}
|
|
10
|
+
export declare function Badge({ tone, className, ...props }: BadgeProps): import("react").JSX.Element;
|
|
11
|
+
export interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
12
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
13
|
+
}
|
|
14
|
+
export declare function Heading({ level, className, ...props }: HeadingProps): import("react").JSX.Element;
|
|
15
|
+
export interface TextProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
16
|
+
muted?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function Text({ muted, className, ...props }: TextProps): import("react").JSX.Element;
|
|
19
|
+
export declare function Code({ children }: {
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
22
|
+
export declare function Divider(): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Key, ReactNode } from 'react';
|
|
2
|
+
export interface TableColumn<T> {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
renderCell: (row: T) => ReactNode;
|
|
6
|
+
compare?: (a: T, b: T) => number;
|
|
7
|
+
align?: 'start' | 'end';
|
|
8
|
+
}
|
|
9
|
+
export interface DataTableProps<T> {
|
|
10
|
+
caption: string;
|
|
11
|
+
rows: readonly T[];
|
|
12
|
+
columns: readonly TableColumn<T>[];
|
|
13
|
+
getRowKey: (row: T) => Key;
|
|
14
|
+
pageSize?: number;
|
|
15
|
+
selectedKey?: Key | null;
|
|
16
|
+
onSelectionChange?: (key: Key | null) => void;
|
|
17
|
+
getRowLabel?: (row: T) => string;
|
|
18
|
+
emptyMessage?: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function DataTable<T>({ caption, rows, columns, getRowKey, pageSize, selectedKey, onSelectionChange, getRowLabel, emptyMessage, className, }: DataTableProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Placement } from 'react-aria-components';
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
export interface TooltipProps {
|
|
4
|
+
children: ReactElement;
|
|
5
|
+
content: ReactNode;
|
|
6
|
+
placement?: Placement;
|
|
7
|
+
delay?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function Tooltip({ children, content, placement, delay }: TooltipProps): import("react").JSX.Element;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export { Button, LinkButton } from './components/button/button';
|
|
2
|
+
export type { ButtonProps, ButtonVariant, LinkButtonProps } from './components/button/button';
|
|
3
|
+
export { TextField } from './components/forms/text-field';
|
|
4
|
+
export type { TextFieldProps } from './components/forms/text-field';
|
|
5
|
+
export { Select, ComboBox } from './components/forms/select';
|
|
6
|
+
export type { SelectProps, ComboBoxProps, SelectOption } from './components/forms/select';
|
|
7
|
+
export { Checkbox, Radio, RadioGroup, Switch } from './components/forms/controls';
|
|
8
|
+
export type { CheckboxProps, RadioProps, RadioGroupProps, SwitchProps, } from './components/forms/controls';
|
|
9
|
+
export { DonutSlider } from './components/donut-slider/donut-slider';
|
|
10
|
+
export type { DonutSliderProps } from './components/donut-slider/donut-slider';
|
|
11
|
+
export { Menu, MenuItem, MenuPopover, MenuSeparator, MenuTrigger, SubmenuTrigger, } from './components/menu/menu';
|
|
12
|
+
export type { MenuProps, MenuItemProps, MenuPopoverProps } from './components/menu/menu';
|
|
13
|
+
export { SplitButton } from './components/split-button/split-button';
|
|
14
|
+
export type { SplitButtonProps } from './components/split-button/split-button';
|
|
15
|
+
export { Dialog, DialogTrigger } from './components/dialog/dialog';
|
|
16
|
+
export type { DialogProps } from './components/dialog/dialog';
|
|
17
|
+
export { Tooltip } from './components/tooltip/tooltip';
|
|
18
|
+
export type { TooltipProps } from './components/tooltip/tooltip';
|
|
19
|
+
export { DataTable } from './components/table/data-table';
|
|
20
|
+
export type { DataTableProps, TableColumn } from './components/table/data-table';
|
|
21
|
+
export { Alert, NotificationsProvider, useNotifications, } from './components/notifications/notifications';
|
|
22
|
+
export type { AlertProps, Notifications, NotificationOptions, NotificationsProviderProps, NotificationTone, } from './components/notifications/notifications';
|
|
23
|
+
export { BarLoader, Spinner, ProgressBar } from './components/loader/loader';
|
|
24
|
+
export type { BarLoaderProps, ProgressBarProps } from './components/loader/loader';
|
|
25
|
+
export { Card, Badge, Heading, Text, Code, Divider } from './components/surface/surface';
|
|
26
|
+
export type { CardProps, BadgeProps, HeadingProps, TextProps } from './components/surface/surface';
|
|
27
|
+
export type { Tone } from './types';
|