@mucsi96/react-ui 0.2.0 → 0.4.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 +35 -1
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/forms/select.d.ts +3 -2
- package/dist/index.js +395 -356
- package/dist/styles.css +1 -1
- package/dist/typography.css +29 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -27,6 +27,23 @@ export function SaveAction() {
|
|
|
27
27
|
|
|
28
28
|
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.
|
|
29
29
|
|
|
30
|
+
To normalize native headings, opt in to the typography reset before your
|
|
31
|
+
application styles:
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import '@mucsi96/react-ui/styles.css';
|
|
35
|
+
import '@mucsi96/react-ui/typography.css';
|
|
36
|
+
import './styles.css';
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
This restores normal-weight, unscaled native headings with no default margins.
|
|
40
|
+
Set page-specific heading sizes and spacing in your CSS Modules. The single font
|
|
41
|
+
token `--bt-font` uses only `system-ui`, including avatar initials. Code uses an
|
|
42
|
+
inline `ui-monospace, monospace` stack without a font token. The main stylesheet applies
|
|
43
|
+
the font to the document root, so applications need no font-family declarations
|
|
44
|
+
or token overrides. No font downloads are needed.
|
|
45
|
+
The optional stylesheet does not import fonts or reset page layouts.
|
|
46
|
+
|
|
30
47
|
## Buttons
|
|
31
48
|
|
|
32
49
|
```tsx
|
|
@@ -35,6 +52,7 @@ Components need no theme provider. The stylesheet defines the dark `--bt-*` toke
|
|
|
35
52
|
<Button variant="outlined">Secondary</Button>
|
|
36
53
|
<Button variant="text">Cancel</Button>
|
|
37
54
|
<Button variant="icon" aria-label="Search"><SearchIcon /></Button>
|
|
55
|
+
<Button variant="avatar" aria-label="User menu">IB</Button>
|
|
38
56
|
<Button variant="fab"><PlusIcon />New item</Button>
|
|
39
57
|
<Button variant="mini-fab" aria-label="Add"><PlusIcon /></Button>
|
|
40
58
|
<Button isDisabled>Unavailable</Button>
|
|
@@ -45,6 +63,10 @@ Components need no theme provider. The stylesheet defines the dark `--bt-*` toke
|
|
|
45
63
|
|
|
46
64
|
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.
|
|
47
65
|
|
|
66
|
+
Use `avatar` for initials-based profile/menu triggers: a 40px filled circle with
|
|
67
|
+
normal-weight 18px initials. Compose it with
|
|
68
|
+
`MenuTrigger` just like other buttons; keep the accessible name on the button.
|
|
69
|
+
|
|
48
70
|
## Forms
|
|
49
71
|
|
|
50
72
|
```tsx
|
|
@@ -68,6 +90,18 @@ Labels, descriptions, and validation messages are associated with the input auto
|
|
|
68
90
|
|
|
69
91
|
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.
|
|
70
92
|
|
|
93
|
+
### Field and button sizing
|
|
94
|
+
|
|
95
|
+
Fields default to `appearance="filled"`, with always-visible floating labels and
|
|
96
|
+
a 56px content height (58px including its border). `TextField`,
|
|
97
|
+
`Select`, and `ComboBox` also accept `appearance="outlined"`. On an outlined field
|
|
98
|
+
over a custom surface, set `--bt-field-label-background` to that surface color.
|
|
99
|
+
Required markers are visual only; the accessible name remains the supplied label.
|
|
100
|
+
|
|
101
|
+
Buttons use a 40px default height; icon buttons are circular, and FABs
|
|
102
|
+
use 56px/40px sizes. Consumers needing taller touch targets can set `min-height`
|
|
103
|
+
on their CSS Module class.
|
|
104
|
+
|
|
71
105
|
## Donut slider
|
|
72
106
|
|
|
73
107
|
```tsx
|
|
@@ -231,6 +265,6 @@ All loading animations respect reduced motion. `Card` supports `outlined` and `e
|
|
|
231
265
|
}
|
|
232
266
|
```
|
|
233
267
|
|
|
234
|
-
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-
|
|
268
|
+
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-radius`, `--bt-radius-lg`, and `--bt-shadow` tokens complete the foundation.
|
|
235
269
|
|
|
236
270
|
MIT © Igor Bari
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ButtonProps as AriaButtonProps, LinkProps } from 'react-aria-components';
|
|
2
2
|
import type { CSSProperties, ReactNode, Ref } from 'react';
|
|
3
3
|
import type { Tone } from '../../types';
|
|
4
|
-
export type ButtonVariant = 'filled' | 'raised' | 'outlined' | 'text' | 'icon' | 'fab' | 'mini-fab';
|
|
4
|
+
export type ButtonVariant = 'filled' | 'raised' | 'outlined' | 'text' | 'icon' | 'avatar' | 'fab' | 'mini-fab';
|
|
5
5
|
interface Appearance {
|
|
6
6
|
variant?: ButtonVariant;
|
|
7
7
|
tone?: Tone;
|
|
@@ -11,12 +11,13 @@ interface FieldProps {
|
|
|
11
11
|
description?: ReactNode;
|
|
12
12
|
error?: ReactNode;
|
|
13
13
|
placeholder?: string;
|
|
14
|
+
appearance?: 'outlined' | 'filled';
|
|
14
15
|
className?: string;
|
|
15
16
|
}
|
|
16
17
|
export interface SelectProps extends Omit<AriaSelectProps<SelectOption>, keyof FieldProps | 'children' | 'items'>, FieldProps {
|
|
17
18
|
}
|
|
18
|
-
export declare function Select({ label, options, description, error, placeholder, className, ...props }: SelectProps): import("react").JSX.Element;
|
|
19
|
+
export declare function Select({ label, options, description, error, placeholder, appearance, className, ...props }: SelectProps): import("react").JSX.Element;
|
|
19
20
|
export interface ComboBoxProps extends Omit<AriaComboBoxProps<SelectOption>, keyof FieldProps | 'children' | 'items' | 'defaultItems'>, FieldProps {
|
|
20
21
|
}
|
|
21
|
-
export declare function ComboBox({ label, options, description, error, placeholder, className, ...props }: ComboBoxProps): import("react").JSX.Element;
|
|
22
|
+
export declare function ComboBox({ label, options, description, error, placeholder, appearance, className, ...props }: ComboBoxProps): import("react").JSX.Element;
|
|
22
23
|
export {};
|