@momoi-labs/kiso 0.6.0 → 0.7.1
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/kiso/README.md
CHANGED
|
@@ -73,6 +73,10 @@ npm install @momoi-labs/kiso
|
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
`ui.css` reads tokens as custom properties, so import it after `tokens.css`.
|
|
76
|
+
It does not load fonts: a nested Google Fonts `@import` becomes illegal once a
|
|
77
|
+
bundler flattens `tokens.css` ahead of it. Load Inter and JetBrains Mono from
|
|
78
|
+
the app (`next/font`, a `<link>`, or similar), or import
|
|
79
|
+
`@momoi-labs/kiso-react/styles.css`, which places that `@import` first.
|
|
76
80
|
|
|
77
81
|
## Proposing a change
|
|
78
82
|
|
|
@@ -40,7 +40,7 @@ behavioral reference where one exists.
|
|
|
40
40
|
|
|
41
41
|
## Navigation and structure
|
|
42
42
|
|
|
43
|
-
- [AppShell](app-shell.md):
|
|
43
|
+
- [AppShell / ApplicationShell](app-shell.md): Provides low-level columns or the complete shared application frame.
|
|
44
44
|
- [BrandMark](brand-mark.md): Decorative letter or icon beside a product name.
|
|
45
45
|
- [Breadcrumb](breadcrumb.md): Shows the current location within a hierarchy.
|
|
46
46
|
- [Header](header.md): Composes persistent application navigation and global actions.
|
|
@@ -62,6 +62,7 @@ behavioral reference where one exists.
|
|
|
62
62
|
## Required compositions
|
|
63
63
|
|
|
64
64
|
- [FormField](form-field.md) composes [Label](label.md) + [Input](input.md) (or another form control) + [HelperText](helper-text.md) + [ValidationMessage](validation-message.md).
|
|
65
|
+
- [ApplicationShell](app-shell.md) composes [Sidebar](sidebar.md) + [Navigation](navigation.md) + [Header](header.md) + page content.
|
|
65
66
|
- [Header](header.md) composes [Link](link.md) + [IconButton](icon-button.md) + optional [DropdownMenu](dropdown-menu.md).
|
|
66
67
|
- [Table / DataTable](table.md) composes [EmptyState](empty-state.md), [Skeleton](skeleton.md), and [Pagination](pagination.md) for empty, loading, and paged states.
|
|
67
68
|
- [PageHeader](page-header.md) composes a title + optional subtitle + [Buttons](button.md).
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
AppShell places persistent [Sidebar](sidebar.md) navigation beside the main
|
|
6
6
|
application content. It owns the page columns, not navigation state.
|
|
7
|
+
ApplicationShell composes the standard Sidebar, Navigation, Header, and main
|
|
8
|
+
column when a product wants the complete frame.
|
|
7
9
|
|
|
8
10
|
## Anatomy
|
|
9
11
|
|
|
@@ -19,6 +21,36 @@ The two slots are direct children. AppShell is a `div`; AppShellMain is a
|
|
|
19
21
|
`main` with `min-width: 0`, so wide tables and log lines cannot push the
|
|
20
22
|
Sidebar off screen. Sidebar owns its header, body, and footer.
|
|
21
23
|
|
|
24
|
+
ApplicationShell takes `brand`, optional `primaryAction`, navigation groups,
|
|
25
|
+
optional `footer`, optional `header`, and page content. A destination contains
|
|
26
|
+
`href`, `label`, optional `active`, optional `onClick`, and optional leading or
|
|
27
|
+
trailing content. The caller still decides the current destination and whether
|
|
28
|
+
a destination follows its link or changes a view in place.
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
<ApplicationShell
|
|
32
|
+
brand={<ProductBrand />}
|
|
33
|
+
navigation={[{
|
|
34
|
+
label: "Applications",
|
|
35
|
+
destinations: apps.map((app) => ({
|
|
36
|
+
href: `#app-${app.id}`,
|
|
37
|
+
label: app.name,
|
|
38
|
+
active: app.id === currentId,
|
|
39
|
+
onClick: () => open(app.id),
|
|
40
|
+
})),
|
|
41
|
+
}]}
|
|
42
|
+
header={<CurrentLocation />}
|
|
43
|
+
footer={<ProductSettings />}
|
|
44
|
+
>
|
|
45
|
+
{page}
|
|
46
|
+
</ApplicationShell>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
When `onClick` is present, ApplicationShell prevents link navigation and calls
|
|
50
|
+
it. Without `onClick`, the destination remains a normal link. Use
|
|
51
|
+
`navigationLabel` to distinguish this navigation landmark when the default
|
|
52
|
+
`Primary` label is not specific enough.
|
|
53
|
+
|
|
22
54
|
## Variants
|
|
23
55
|
|
|
24
56
|
One layout. No variant prop. Compose [Header](header.md) and
|
|
@@ -55,6 +87,8 @@ retain their own keyboard behavior.
|
|
|
55
87
|
|
|
56
88
|
- An application with persistent navigation beside a changing page.
|
|
57
89
|
- A console containing tables, detail panes, and logs in its main column.
|
|
90
|
+
- Use ApplicationShell when the product follows the standard complete frame.
|
|
91
|
+
- Use AppShell directly when its Sidebar or Header composition differs.
|
|
58
92
|
|
|
59
93
|
## When NOT to use
|
|
60
94
|
|
|
@@ -22,6 +22,28 @@ For the issue's foundational chain, read this literally as **Label + Input +
|
|
|
22
22
|
HelperText + ValidationMessage**. FormField owns layout and ID wiring; each
|
|
23
23
|
child retains its own behavior.
|
|
24
24
|
|
|
25
|
+
In React, omit `children` to render the default Input. Pass one control as
|
|
26
|
+
`children` to use a Textarea, Select trigger, or product-specific control.
|
|
27
|
+
FormField gives that control its `id`, `aria-describedby`, and
|
|
28
|
+
`aria-invalid` props. The control must forward them to its interactive DOM
|
|
29
|
+
element.
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
<FormField
|
|
33
|
+
id="compose"
|
|
34
|
+
label="Compose file"
|
|
35
|
+
hint="Docker Compose YAML."
|
|
36
|
+
error={errors.compose}
|
|
37
|
+
>
|
|
38
|
+
<Textarea rows={12} />
|
|
39
|
+
</FormField>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`hint` and `error` accept React content. FormField renders the error as a
|
|
43
|
+
ValidationMessage and points the control at every supplied description. Use
|
|
44
|
+
`fieldClassName` when the field wrapper needs a layout class; `className`
|
|
45
|
+
continues to style the default Input.
|
|
46
|
+
|
|
25
47
|
```text
|
|
26
48
|
Label
|
|
27
49
|
Input
|
|
@@ -59,6 +59,31 @@ appearing Toast. `F8` may move focus to the Toast viewport (Radix convention);
|
|
|
59
59
|
the timer on hover, focus, and page blur. Never make Toast the only copy of an
|
|
60
60
|
essential error, completed record, or required recovery step.
|
|
61
61
|
|
|
62
|
+
## React interface
|
|
63
|
+
|
|
64
|
+
Wrap the application in `Toasts`, then call `useToast` from any descendant.
|
|
65
|
+
The manager owns the list, IDs, six-second default duration, announcement
|
|
66
|
+
urgency, dismissal, and viewport.
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
function SaveButton() {
|
|
70
|
+
const notify = useToast();
|
|
71
|
+
return (
|
|
72
|
+
<Button onClick={() => notify("success", "Changes saved")}>Save</Button>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
<Toasts>
|
|
77
|
+
<Application />
|
|
78
|
+
</Toasts>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`notify` accepts a variant, title, and optional body. A string body renders as
|
|
82
|
+
ToastDescription. A React node renders as supplied so a product can compose
|
|
83
|
+
details it owns. Variants are `neutral`, `success`, `warning`, and `error`.
|
|
84
|
+
The lower-level ToastProvider, ToastViewport, Toast, and Toast parts remain
|
|
85
|
+
available for a controlled toast.
|
|
86
|
+
|
|
62
87
|
## When to use
|
|
63
88
|
|
|
64
89
|
- Brief confirmation of a completed, non-blocking action.
|
package/kiso/ui.css
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Kiso v2 — component layer (prototype)
|
|
3
3
|
Every value here resolves to a token in tokens.css. No raw hex, no raw px
|
|
4
4
|
for anything a token covers.
|
|
5
|
+
Fonts are not loaded here: a nested @import after tokens.css is illegal once
|
|
6
|
+
bundlers flatten the sheet. Load Inter and JetBrains Mono from the app, or
|
|
7
|
+
via @momoi-labs/kiso-react/styles.css which places the @import first.
|
|
5
8
|
=========================================================================== */
|
|
6
9
|
|
|
7
|
-
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");
|
|
8
|
-
|
|
9
10
|
*, *::before, *::after { box-sizing: border-box; }
|
|
10
11
|
|
|
11
12
|
html { -webkit-text-size-adjust: 100%; }
|