@mucsi96/react-ui 0.3.0 → 0.5.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 +54 -13
- package/dist/components/app-layout/app-layout.d.ts +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +469 -439
- package/dist/styles.css +1 -1
- package/dist/typography.css +9 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,8 +27,8 @@ 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
|
-
|
|
31
|
-
|
|
30
|
+
To normalize native headings, opt in to the typography reset before your
|
|
31
|
+
application styles:
|
|
32
32
|
|
|
33
33
|
```tsx
|
|
34
34
|
import '@mucsi96/react-ui/styles.css';
|
|
@@ -37,10 +37,52 @@ import './styles.css';
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
This restores normal-weight, unscaled native headings with no default margins.
|
|
40
|
-
Set page-specific heading sizes and spacing in your CSS Modules.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
+
|
|
47
|
+
## Application layout
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { AppHeader, AppHeaderActions, AppMain } from '@mucsi96/react-ui';
|
|
51
|
+
|
|
52
|
+
<AppHeader>
|
|
53
|
+
<a href="/">My application</a>
|
|
54
|
+
<AppHeaderActions>
|
|
55
|
+
<nav aria-label="Main navigation">{/* Application links */}</nav>
|
|
56
|
+
<ProfileMenu />
|
|
57
|
+
</AppHeaderActions>
|
|
58
|
+
</AppHeader>
|
|
59
|
+
<AppMain id="main-content">{/* Page content */}</AppMain>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`AppHeader` renders a native `header` with a width-constrained inner flex row.
|
|
63
|
+
Its safe-area top padding sits outside the row's minimum height, so iOS status
|
|
64
|
+
bars do not compress controls. Children wrap as needed. `AppHeaderActions` is a
|
|
65
|
+
wrapping, end-aligned `div`; make any nested navigation groups wrap as well.
|
|
66
|
+
`AppMain` renders a native `main` with matching horizontal gutters, page spacing,
|
|
67
|
+
and bottom safe-area padding. All three accept native element props, including
|
|
68
|
+
`className`, `style`, and React 19 `ref`. They use ordinary document flow.
|
|
69
|
+
|
|
70
|
+
Set these inherited CSS variables on a common ancestor to customize the layout:
|
|
71
|
+
|
|
72
|
+
| Variable | Default | Purpose |
|
|
73
|
+
| ------------------------ | ------- | ---------------------------------------------------- |
|
|
74
|
+
| `--bt-app-max-width` | `90rem` | Header row and main maximum width, including gutters |
|
|
75
|
+
| `--bt-app-gutter` | `1rem` | Minimum horizontal and bottom page padding |
|
|
76
|
+
| `--bt-app-header-height` | `4rem` | Minimum header row height, excluding top safe area |
|
|
77
|
+
| `--bt-app-header-gap` | `1rem` | Space between header children and actions |
|
|
78
|
+
| `--bt-app-content-gap` | `3rem` | Main content top padding |
|
|
79
|
+
|
|
80
|
+
The host document should reset the body margin and include
|
|
81
|
+
`<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">`
|
|
82
|
+
for edge-to-edge safe-area handling. The library does not modify document metadata
|
|
83
|
+
or global layout. Keep routing, profile fetching, navigation labels, and menu
|
|
84
|
+
contents in the application; compose profile menus with `MenuTrigger` and
|
|
85
|
+
`Button variant="avatar"`.
|
|
44
86
|
|
|
45
87
|
## Buttons
|
|
46
88
|
|
|
@@ -62,7 +104,7 @@ fallback. The optional stylesheet does not import fonts or reset page layouts.
|
|
|
62
104
|
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.
|
|
63
105
|
|
|
64
106
|
Use `avatar` for initials-based profile/menu triggers: a 40px filled circle with
|
|
65
|
-
normal-weight 18px initials
|
|
107
|
+
normal-weight 18px initials. Compose it with
|
|
66
108
|
`MenuTrigger` just like other buttons; keep the accessible name on the button.
|
|
67
109
|
|
|
68
110
|
## Forms
|
|
@@ -88,18 +130,17 @@ Labels, descriptions, and validation messages are associated with the input auto
|
|
|
88
130
|
|
|
89
131
|
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.
|
|
90
132
|
|
|
91
|
-
###
|
|
133
|
+
### Field and button sizing
|
|
92
134
|
|
|
93
135
|
Fields default to `appearance="filled"`, with always-visible floating labels and
|
|
94
|
-
|
|
136
|
+
a 56px content height (58px including its border). `TextField`,
|
|
95
137
|
`Select`, and `ComboBox` also accept `appearance="outlined"`. On an outlined field
|
|
96
138
|
over a custom surface, set `--bt-field-label-background` to that surface color.
|
|
97
139
|
Required markers are visual only; the accessible name remains the supplied label.
|
|
98
140
|
|
|
99
|
-
Buttons use
|
|
141
|
+
Buttons use a 40px default height; icon buttons are circular, and FABs
|
|
100
142
|
use 56px/40px sizes. Consumers needing taller touch targets can set `min-height`
|
|
101
|
-
on their CSS Module class.
|
|
102
|
-
for the component-by-component comparison and remaining differences.
|
|
143
|
+
on their CSS Module class.
|
|
103
144
|
|
|
104
145
|
## Donut slider
|
|
105
146
|
|
|
@@ -264,6 +305,6 @@ All loading animations respect reduced motion. `Card` supports `outlined` and `e
|
|
|
264
305
|
}
|
|
265
306
|
```
|
|
266
307
|
|
|
267
|
-
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-
|
|
308
|
+
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.
|
|
268
309
|
|
|
269
310
|
MIT © Igor Bari
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
+
export type AppHeaderProps = ComponentPropsWithRef<'header'>;
|
|
3
|
+
export type AppHeaderActionsProps = ComponentPropsWithRef<'div'>;
|
|
4
|
+
export type AppMainProps = ComponentPropsWithRef<'main'>;
|
|
5
|
+
export declare function AppHeader({ children, className, ...props }: AppHeaderProps): import("react").JSX.Element;
|
|
6
|
+
export declare function AppHeaderActions({ className, ...props }: AppHeaderActionsProps): import("react").JSX.Element;
|
|
7
|
+
export declare function AppMain({ className, ...props }: AppMainProps): import("react").JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { AppHeader, AppHeaderActions, AppMain } from './components/app-layout/app-layout';
|
|
2
|
+
export type { AppHeaderProps, AppHeaderActionsProps, AppMainProps, } from './components/app-layout/app-layout';
|
|
1
3
|
export { Button, LinkButton } from './components/button/button';
|
|
2
4
|
export type { ButtonProps, ButtonVariant, LinkButtonProps } from './components/button/button';
|
|
3
5
|
export { TextField } from './components/forms/text-field';
|