@nanisoft/prism-llms 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 +88 -0
- package/THIRD-PARTY-NOTICES.md +48 -0
- package/dist/data.json +3998 -375
- package/dist/demo-graph.d.ts +21 -12
- package/dist/demo-graph.js +37 -21
- package/dist/extractor.d.ts +24 -17
- package/dist/extractor.js +269 -153
- package/dist/index.d.ts +12 -7
- package/dist/index.js +9 -7
- package/dist/llms-full.txt +7988 -1989
- package/dist/llms.txt +97 -91
- package/dist/markdown.d.ts +69 -23
- package/dist/markdown.js +131 -72
- package/dist/md/blocks/app-shell-01.md +135 -0
- package/dist/md/blocks/auth-form-01.md +135 -0
- package/dist/md/blocks/cta-01.md +88 -0
- package/dist/md/blocks/data-table-01.md +196 -0
- package/dist/md/blocks/feature-grid-01.md +92 -0
- package/dist/md/blocks/hero-01.md +90 -0
- package/dist/md/blocks/instrument-panel-01.md +109 -0
- package/dist/md/blocks/logo-strip-01.md +97 -0
- package/dist/md/blocks/note-grid-01.md +102 -0
- package/dist/md/blocks/page-header-01.md +97 -0
- package/dist/md/blocks/pricing-01.md +91 -0
- package/dist/md/blocks/process-rail-01.md +106 -0
- package/dist/md/blocks/product-grid-01.md +113 -0
- package/dist/md/blocks/settings-panel-01.md +148 -0
- package/dist/md/blocks/site-footer.md +111 -0
- package/dist/md/blocks/site-header.md +119 -0
- package/dist/md/blocks/stack-grid-01.md +108 -0
- package/dist/md/blocks/stats-01.md +89 -0
- package/dist/md/blocks/status-ledger-01.md +121 -0
- package/dist/md/changelogs/prism-llms.md +206 -0
- package/dist/md/changelogs/prism-mcp-server.md +88 -0
- package/dist/md/changelogs/prism-tokens.md +126 -0
- package/dist/md/changelogs/prism-ui.md +429 -0
- package/dist/md/components/accordion.md +108 -0
- package/dist/md/components/alert.md +90 -7
- package/dist/md/components/avatar.md +89 -7
- package/dist/md/components/badge.md +74 -7
- package/dist/md/components/breadcrumb.md +84 -7
- package/dist/md/components/button.md +90 -7
- package/dist/md/components/card.md +90 -7
- package/dist/md/components/checkbox.md +101 -7
- package/dist/md/components/cta-link.md +98 -0
- package/dist/md/components/diagram.md +124 -0
- package/dist/md/components/dialog.md +128 -0
- package/dist/md/components/dropdown-menu.md +125 -0
- package/dist/md/components/fact-list.md +85 -0
- package/dist/md/components/field.md +116 -0
- package/dist/md/components/input.md +86 -7
- package/dist/md/components/kbd.md +77 -0
- package/dist/md/components/pagination.md +95 -7
- package/dist/md/components/popover.md +95 -7
- package/dist/md/components/product-mark.md +123 -0
- package/dist/md/components/product-switcher.md +88 -0
- package/dist/md/components/progress.md +88 -7
- package/dist/md/components/prose.md +91 -0
- package/dist/md/components/radio-group.md +111 -0
- package/dist/md/components/section.md +91 -0
- package/dist/md/components/select.md +143 -7
- package/dist/md/components/separator.md +77 -0
- package/dist/md/components/skeleton.md +71 -7
- package/dist/md/components/slider.md +90 -7
- package/dist/md/components/switch.md +104 -7
- package/dist/md/components/table.md +104 -7
- package/dist/md/components/tabs.md +105 -7
- package/dist/md/components/textarea.md +101 -0
- package/dist/md/components/tooltip.md +95 -7
- package/dist/md/components/typography.md +82 -7
- package/dist/md/content/about-content.md +36 -0
- package/dist/md/content/audience.md +43 -0
- package/dist/md/content/glossary.md +69 -0
- package/dist/md/content/product-vocabulary.md +53 -0
- package/dist/md/content/voice.md +52 -0
- package/dist/md/content/writing-mechanics.md +58 -0
- package/dist/md/foundation/colors.md +10 -0
- package/dist/md/foundation/iconography.md +14 -0
- package/dist/md/foundation/motion.md +10 -0
- package/dist/md/foundation/radii.md +9 -0
- package/dist/md/foundation/shadows.md +9 -0
- package/dist/md/foundation/spacings.md +8 -0
- package/dist/md/foundation/typography.md +9 -0
- package/dist/md/foundation/variables.md +9 -0
- package/dist/md/overview/architecture.md +76 -0
- package/dist/md/overview/brand.md +41 -0
- package/dist/md/overview/composition.md +77 -0
- package/dist/md/overview/quickstart.md +97 -0
- package/dist/md/overview/theming.md +89 -0
- package/dist/md/overview/using-llms.md +83 -0
- package/dist/md/pages/auth-page.md +149 -0
- package/dist/md/pages/blog-post-page.md +136 -0
- package/dist/md/pages/dashboard-page.md +241 -0
- package/dist/md/pages/marketing-page.md +199 -0
- package/dist/md/pages/not-found-page.md +105 -0
- package/dist/md/pages/settings-page.md +206 -0
- package/dist/prism-skill.md +50 -0
- package/dist/store.d.ts +203 -0
- package/dist/store.js +317 -0
- package/package.json +29 -26
- package/dist/demo-graph.d.ts.map +0 -1
- package/dist/demo-graph.js.map +0 -1
- package/dist/extractor.d.ts.map +0 -1
- package/dist/extractor.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/markdown.d.ts.map +0 -1
- package/dist/markdown.js.map +0 -1
- package/dist/md/blocks/component-demo.md +0 -19
- package/dist/md/blocks/page-header.md +0 -19
- package/dist/md/components/affix.md +0 -14
- package/dist/md/components/anchor.md +0 -14
- package/dist/md/components/auto-complete.md +0 -14
- package/dist/md/components/back-top.md +0 -14
- package/dist/md/components/border-beam.md +0 -14
- package/dist/md/components/calendar.md +0 -14
- package/dist/md/components/carousel.md +0 -14
- package/dist/md/components/cascader.md +0 -14
- package/dist/md/components/col.md +0 -14
- package/dist/md/components/collapse.md +0 -14
- package/dist/md/components/color-picker.md +0 -14
- package/dist/md/components/date-picker.md +0 -14
- package/dist/md/components/descriptions.md +0 -14
- package/dist/md/components/display-title.md +0 -20
- package/dist/md/components/divider.md +0 -14
- package/dist/md/components/drawer.md +0 -14
- package/dist/md/components/dropdown.md +0 -14
- package/dist/md/components/empty.md +0 -14
- package/dist/md/components/flex.md +0 -14
- package/dist/md/components/float-button.md +0 -14
- package/dist/md/components/form.md +0 -14
- package/dist/md/components/grid.md +0 -14
- package/dist/md/components/image.md +0 -14
- package/dist/md/components/input-number.md +0 -14
- package/dist/md/components/layout.md +0 -14
- package/dist/md/components/list.md +0 -14
- package/dist/md/components/listy.md +0 -14
- package/dist/md/components/masonry.md +0 -14
- package/dist/md/components/mentions.md +0 -14
- package/dist/md/components/menu.md +0 -14
- package/dist/md/components/modal.md +0 -14
- package/dist/md/components/popconfirm.md +0 -14
- package/dist/md/components/qrcode.md +0 -14
- package/dist/md/components/radio.md +0 -14
- package/dist/md/components/rate.md +0 -14
- package/dist/md/components/result.md +0 -14
- package/dist/md/components/row.md +0 -14
- package/dist/md/components/segmented.md +0 -14
- package/dist/md/components/space.md +0 -14
- package/dist/md/components/spin.md +0 -14
- package/dist/md/components/splitter.md +0 -14
- package/dist/md/components/statistic.md +0 -14
- package/dist/md/components/steps.md +0 -14
- package/dist/md/components/tag.md +0 -14
- package/dist/md/components/time-picker.md +0 -14
- package/dist/md/components/timeline.md +0 -14
- package/dist/md/components/tour.md +0 -14
- package/dist/md/components/transfer.md +0 -14
- package/dist/md/components/tree-select.md +0 -14
- package/dist/md/components/tree.md +0 -14
- package/dist/md/components/upload.md +0 -14
- package/dist/md/components/watermark.md +0 -14
- package/dist/md/docs/brand.md +0 -41
- package/dist/md/pages/blog-layout.md +0 -19
- package/dist/md/pages/docs-shell.md +0 -23
- package/dist/md/theme/blue-dark.md +0 -127
- package/dist/md/theme/blue-light.md +0 -129
- package/dist/md/theme/green-dark.md +0 -127
- package/dist/md/theme/green-light.md +0 -129
- package/dist/md/theme/lavender-dark.md +0 -127
- package/dist/md/theme/lavender-light.md +0 -129
- package/dist/md/theme/peach-dark.md +0 -127
- package/dist/md/theme/peach-light.md +0 -129
- package/dist/md/theme/rose-dark.md +0 -127
- package/dist/md/theme/rose-light.md +0 -129
|
@@ -1,14 +1,97 @@
|
|
|
1
1
|
# Alert
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A static callout that carries an important message to the reader.
|
|
4
4
|
|
|
5
|
-
```
|
|
6
|
-
import { Alert } from '@nanisoft/prism-ui/components'
|
|
5
|
+
```tsx
|
|
6
|
+
import { Alert, AlertTitle, AlertDescription } from '@nanisoft/prism-ui/components/alert'
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
An Alert is a static callout that carries an important message in place. It
|
|
12
|
+
ships as `Alert`, `AlertTitle` and `AlertDescription`, all from the same module.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
The root renders a `<div role="alert">`, so assistive technology announces it
|
|
15
|
+
when it enters the document. `variant="destructive"` switches the border and
|
|
16
|
+
text to the destructive token for an error; the default is the neutral surface.
|
|
17
|
+
The icon, when one is passed as the first child, is placed beside the text and
|
|
18
|
+
takes the variant's colour.
|
|
19
|
+
|
|
20
|
+
## Guidelines
|
|
21
|
+
|
|
22
|
+
### When to use
|
|
23
|
+
|
|
24
|
+
Use an Alert for a message that must be read before the reader continues: a
|
|
25
|
+
failed publish, a failed connection, a maintenance window, a consequence of the
|
|
26
|
+
action they are about to take.
|
|
27
|
+
|
|
28
|
+
### When not to use
|
|
29
|
+
|
|
30
|
+
Do not use an Alert for a transient success. A message that confirms something
|
|
31
|
+
happened should not occupy the page afterwards; a toast covers that case, and
|
|
32
|
+
toasts are not in v1.
|
|
33
|
+
|
|
34
|
+
Do not use an Alert for a field-level problem. A FieldError sits beside the
|
|
35
|
+
control it belongs to.
|
|
36
|
+
|
|
37
|
+
Do not use an Alert for a decision the reader must make before continuing. A
|
|
38
|
+
dialog blocks the page and takes focus; an inline callout does neither.
|
|
39
|
+
|
|
40
|
+
### Best practices
|
|
41
|
+
|
|
42
|
+
- Lead with the condition in `AlertTitle` and put the next step in
|
|
43
|
+
`AlertDescription`. A reader scanning the page should get the point from the
|
|
44
|
+
title alone.
|
|
45
|
+
- Keep the whole callout to two short sentences. Anything longer is documentation
|
|
46
|
+
and belongs in the page body.
|
|
47
|
+
- Reserve `variant="destructive"` for a real failure. Using it for a warning
|
|
48
|
+
spends the one emphasis the system has.
|
|
49
|
+
- Pair the colour with the word. The title carries the meaning; the variant
|
|
50
|
+
reinforces it.
|
|
51
|
+
- Mark a decorative icon `aria-hidden` so it does not enter the announced text,
|
|
52
|
+
and never use the icon as the only signal of severity.
|
|
53
|
+
- Place any action the message calls for just after the callout, not inside the
|
|
54
|
+
description, so the reading order stays simple.
|
|
55
|
+
|
|
56
|
+
### Content guidelines
|
|
57
|
+
|
|
58
|
+
- State the condition and the next step: "Publish failed. Fix the type error and
|
|
59
|
+
publish again."
|
|
60
|
+
- Do not prefix the title with "Error" or "Warning". The variant and the words
|
|
61
|
+
already say it.
|
|
62
|
+
- Use sentence case and no period in the title. The description takes full
|
|
63
|
+
sentences.
|
|
64
|
+
|
|
65
|
+
**The neutral alert beside the destructive one.**
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
import {
|
|
69
|
+
Alert,
|
|
70
|
+
AlertDescription,
|
|
71
|
+
AlertTitle,
|
|
72
|
+
} from '@nanisoft/prism-ui/components/alert'
|
|
73
|
+
|
|
74
|
+
/** The neutral alert beside the destructive one. */
|
|
75
|
+
export default function AlertDemo() {
|
|
76
|
+
return (
|
|
77
|
+
<div className="flex flex-col gap-4">
|
|
78
|
+
<Alert>
|
|
79
|
+
<AlertTitle>Scheduled maintenance</AlertTitle>
|
|
80
|
+
<AlertDescription>
|
|
81
|
+
Reads stay available on 3 October between 02:00 and 04:00.
|
|
82
|
+
</AlertDescription>
|
|
83
|
+
</Alert>
|
|
84
|
+
<Alert variant="destructive">
|
|
85
|
+
<AlertTitle>Publish failed</AlertTitle>
|
|
86
|
+
<AlertDescription>
|
|
87
|
+
The build did not finish. Fix the type error and publish again.
|
|
88
|
+
</AlertDescription>
|
|
89
|
+
</Alert>
|
|
90
|
+
</div>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Props
|
|
96
|
+
|
|
97
|
+
**`variant`** `"default" | "destructive" | null | undefined` · optional · default: —
|
|
@@ -1,14 +1,96 @@
|
|
|
1
1
|
# Avatar
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The person or entity image with an initials fallback.
|
|
4
4
|
|
|
5
|
-
```
|
|
6
|
-
import { Avatar } from '@nanisoft/prism-ui/components'
|
|
5
|
+
```tsx
|
|
6
|
+
import { Avatar, AvatarImage, AvatarFallback } from '@nanisoft/prism-ui/components/avatar'
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
An Avatar shows a person or entity's image, with an initials fallback when the
|
|
12
|
+
image is missing or still loading. It ships as `Avatar`, `AvatarImage` and
|
|
13
|
+
`AvatarFallback`, all from the same module. The fallback covers the moment
|
|
14
|
+
before the image arrives and the case where it never does, so the control is
|
|
15
|
+
never an empty circle.
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
Size the root with `className`; the image and the fallback fill it. The image is
|
|
18
|
+
a real `<img>`, so give it a meaningful `alt`, or leave `alt` empty when the
|
|
19
|
+
adjacent name already identifies the person.
|
|
20
|
+
|
|
21
|
+
## Guidelines
|
|
22
|
+
|
|
23
|
+
### When to use
|
|
24
|
+
|
|
25
|
+
Use an Avatar to represent a person or an entity in a list, a header, a comment
|
|
26
|
+
or a member row, where a face or initials helps the reader identify the subject
|
|
27
|
+
at a glance.
|
|
28
|
+
|
|
29
|
+
### When not to use
|
|
30
|
+
|
|
31
|
+
Do not use an Avatar as a control on its own. A clickable avatar is a Button or
|
|
32
|
+
a link; wrap the Avatar rather than making the image interactive.
|
|
33
|
+
|
|
34
|
+
Do not use one when the name alone is enough, such as a single signed-in user's
|
|
35
|
+
own settings page. The name carries the meaning; the image adds noise.
|
|
36
|
+
|
|
37
|
+
Do not use an Avatar for a decorative mark. A logo or an icon tile is a
|
|
38
|
+
different job.
|
|
39
|
+
|
|
40
|
+
### Best practices
|
|
41
|
+
|
|
42
|
+
- Always render an `AvatarFallback`. Without it, a slow or missing image leaves
|
|
43
|
+
an empty circle.
|
|
44
|
+
- Keep the fallback to one or two initials, derived from the name, and set
|
|
45
|
+
`text-xs` or smaller on a small avatar.
|
|
46
|
+
- Give the image a name when it stands alone, and an empty `alt` when the name
|
|
47
|
+
sits beside it, so a screen reader does not read it twice.
|
|
48
|
+
- Use one size per context. A list of avatars at mixed sizes makes the rows
|
|
49
|
+
harder to compare.
|
|
50
|
+
- Do not encode status in the avatar alone. A presence dot needs a text
|
|
51
|
+
alternative nearby.
|
|
52
|
+
|
|
53
|
+
### Content guidelines
|
|
54
|
+
|
|
55
|
+
- Fall back to initials, not a generic icon, so the circle still identifies the
|
|
56
|
+
person.
|
|
57
|
+
- Use the same name form in the fallback as in the adjacent label, so the two
|
|
58
|
+
read as one subject.
|
|
59
|
+
- Keep the `alt` text to the person's name, without titles or roles.
|
|
60
|
+
|
|
61
|
+
**Avatars with an image, initials fallbacks and a smaller size.**
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { Avatar, AvatarFallback, AvatarImage } from '@nanisoft/prism-ui/components/avatar'
|
|
65
|
+
|
|
66
|
+
const portrait =
|
|
67
|
+
"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><rect width='80' height='80' fill='%23111827'/><circle cx='40' cy='30' r='14' fill='%2394a3b8'/><rect x='16' y='50' width='48' height='40' rx='20' fill='%2394a3b8'/></svg>"
|
|
68
|
+
|
|
69
|
+
/** Avatars with an image, initials fallbacks and a smaller size. */
|
|
70
|
+
export default function AvatarDemo() {
|
|
71
|
+
return (
|
|
72
|
+
<div className="flex items-center gap-4">
|
|
73
|
+
<Avatar>
|
|
74
|
+
<AvatarImage src={portrait} alt="" />
|
|
75
|
+
<AvatarFallback>AL</AvatarFallback>
|
|
76
|
+
</Avatar>
|
|
77
|
+
<Avatar>
|
|
78
|
+
<AvatarFallback>PR</AvatarFallback>
|
|
79
|
+
</Avatar>
|
|
80
|
+
<Avatar className="size-8">
|
|
81
|
+
<AvatarFallback className="text-xs">SM</AvatarFallback>
|
|
82
|
+
</Avatar>
|
|
83
|
+
<Avatar className="size-12">
|
|
84
|
+
<AvatarImage src={portrait} alt="Ada Lovelace" />
|
|
85
|
+
<AvatarFallback>AL</AvatarFallback>
|
|
86
|
+
</Avatar>
|
|
87
|
+
</div>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Props
|
|
93
|
+
|
|
94
|
+
**`onLoadingStatusChange`** `(status: 'idle' | 'loading' | 'loaded' | 'error') => void` · optional · default: — — Called when the image loading status changes.
|
|
95
|
+
**`keepMounted`** `boolean` · optional · default: `false` — Whether the image stays mounted and loads in place.
|
|
96
|
+
**`delay`** `number` · optional · default: `0` — How long to wait before showing the fallback, in milliseconds.
|
|
@@ -1,14 +1,81 @@
|
|
|
1
1
|
# Badge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A compact status or category label.
|
|
4
4
|
|
|
5
|
-
```
|
|
6
|
-
import { Badge } from '@nanisoft/prism-ui/components'
|
|
5
|
+
```tsx
|
|
6
|
+
import { Badge } from '@nanisoft/prism-ui/components/badge'
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
A Badge is a compact label for a short status or category. It renders a
|
|
12
|
+
`<span>` with a filled or outlined surface, and it is not interactive: it
|
|
13
|
+
carries meaning next to something else rather than being a control itself.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
`variant` selects the surface treatment. `default` is the neutral filled badge,
|
|
16
|
+
`secondary` is a quieter fill, `outline` is a bordered badge for a surface that
|
|
17
|
+
already has a fill, and `destructive`, `success` and `warning` carry the three
|
|
18
|
+
status colours.
|
|
19
|
+
|
|
20
|
+
## Guidelines
|
|
21
|
+
|
|
22
|
+
### When to use
|
|
23
|
+
|
|
24
|
+
Use a Badge to mark a row, a card or a heading with one short fact: a status, a
|
|
25
|
+
plan name, a count or a category.
|
|
26
|
+
|
|
27
|
+
### When not to use
|
|
28
|
+
|
|
29
|
+
Do not use a Badge as a control. It does not take focus and it does not respond
|
|
30
|
+
to a press; use a Button for an action and a link for navigation.
|
|
31
|
+
|
|
32
|
+
Do not use a Badge for a sentence or a long phrase. A badge is a label, and a
|
|
33
|
+
label that wraps stops reading as one.
|
|
34
|
+
|
|
35
|
+
Do not use `destructive`, `success` or `warning` for decoration. Those three
|
|
36
|
+
carry status meaning, and colour alone never carries it for a reader who cannot
|
|
37
|
+
distinguish it.
|
|
38
|
+
|
|
39
|
+
### Best practices
|
|
40
|
+
|
|
41
|
+
- Pair the colour with the word. A status is communicated by the label first;
|
|
42
|
+
the variant reinforces it.
|
|
43
|
+
- Use at most one status Badge per row. Two statuses on one row make the reader
|
|
44
|
+
decide which is current.
|
|
45
|
+
- Keep the variant to a small, consistent set across a product, so `success`
|
|
46
|
+
always means the same thing.
|
|
47
|
+
- Place a status Badge beside the name it qualifies, not at the far edge of the
|
|
48
|
+
row where it can be read as belonging to a neighbour.
|
|
49
|
+
|
|
50
|
+
### Content guidelines
|
|
51
|
+
|
|
52
|
+
- Keep a Badge to one or two words.
|
|
53
|
+
- Use sentence case: "Past due", not "Past Due".
|
|
54
|
+
- Prefer a noun or an adjective. "Active" and "Trial" read as states; "Started"
|
|
55
|
+
reads as an action that already happened.
|
|
56
|
+
- Do not invent a status the product does not have. If the set is unclear, the
|
|
57
|
+
status vocabulary belongs above the component.
|
|
58
|
+
|
|
59
|
+
**Badge at each variant, paired with the word that carries the status.**
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { Badge } from '@nanisoft/prism-ui/components/badge'
|
|
63
|
+
|
|
64
|
+
/** Badge at each variant, paired with the word that carries the status. */
|
|
65
|
+
export default function BadgeDemo() {
|
|
66
|
+
return (
|
|
67
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
68
|
+
<Badge>New</Badge>
|
|
69
|
+
<Badge variant="secondary">Draft</Badge>
|
|
70
|
+
<Badge variant="outline">Internal</Badge>
|
|
71
|
+
<Badge variant="success">Active</Badge>
|
|
72
|
+
<Badge variant="warning">Past due</Badge>
|
|
73
|
+
<Badge variant="destructive">Failed</Badge>
|
|
74
|
+
</div>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Props
|
|
80
|
+
|
|
81
|
+
**`variant`** `"default" | "destructive" | "outline" | "secondary" | "success" | "warning" | null | undefined` · optional · default: —
|
|
@@ -1,14 +1,91 @@
|
|
|
1
1
|
# Breadcrumb
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The trail of ancestor links that shows where the current page sits.
|
|
4
4
|
|
|
5
|
-
```
|
|
6
|
-
import { Breadcrumb } from '@nanisoft/prism-ui/components'
|
|
5
|
+
```tsx
|
|
6
|
+
import { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator } from '@nanisoft/prism-ui/components/breadcrumb'
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
A Breadcrumb shows the reader where the current page sits in a hierarchy and
|
|
12
|
+
offers a way back up it. It ships as a parent and five parts: `Breadcrumb`,
|
|
13
|
+
`BreadcrumbList`, `BreadcrumbItem`, `BreadcrumbLink`, `BreadcrumbPage` and
|
|
14
|
+
`BreadcrumbSeparator`, all from the same module.
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
The parts keep the native list semantics a screen reader expects. `Breadcrumb`
|
|
17
|
+
is a labelled `<nav>`, `BreadcrumbList` is an `<ol>`, and each `BreadcrumbItem`
|
|
18
|
+
is an `<li>`. The last item is a `BreadcrumbPage`, which renders text carrying
|
|
19
|
+
`aria-current="page"` rather than a dead link. Separators are decorative and
|
|
20
|
+
hidden from assistive technology, so the trail reads as a list of destinations
|
|
21
|
+
instead of a list of glyphs.
|
|
22
|
+
|
|
23
|
+
## Guidelines
|
|
24
|
+
|
|
25
|
+
### When to use
|
|
26
|
+
|
|
27
|
+
Use a Breadcrumb when the reader can be more than one step deep: a catalog item
|
|
28
|
+
inside a category, a record inside a project, or a settings page inside an
|
|
29
|
+
account. It answers two questions at once, which section this page belongs to
|
|
30
|
+
and how to leave it.
|
|
31
|
+
|
|
32
|
+
### When not to use
|
|
33
|
+
|
|
34
|
+
Do not use a Breadcrumb on a top-level page. A trail with one step restates the
|
|
35
|
+
page title and adds nothing.
|
|
36
|
+
|
|
37
|
+
Do not use it as the page's primary navigation. A Breadcrumb is a secondary
|
|
38
|
+
affordance; the header or side navigation still owns the main routes.
|
|
39
|
+
|
|
40
|
+
Do not use it to model a linear flow. A checkout or a wizard moves forward and
|
|
41
|
+
back in a fixed order, so previous and next controls express that better.
|
|
42
|
+
|
|
43
|
+
### Best practices
|
|
44
|
+
|
|
45
|
+
- Ship one Breadcrumb per page and place it above the page title.
|
|
46
|
+
- Link every ancestor and render only the current page as plain text with
|
|
47
|
+
`aria-current="page"`. A link to the page you are already on wastes a stop.
|
|
48
|
+
- Keep the labels the same as the destinations they point at, so the trail
|
|
49
|
+
matches the navigation the reader came from.
|
|
50
|
+
- Let the trail wrap rather than truncate the middle. A label a reader cannot
|
|
51
|
+
finish reading is not a label.
|
|
52
|
+
- Use `BreadcrumbSeparator`'s default chevron and leave it decorative. If a
|
|
53
|
+
separator carries meaning in the copy, it belongs in the link text instead.
|
|
54
|
+
|
|
55
|
+
**A three-level trail with the current page marked.**
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import {
|
|
59
|
+
Breadcrumb,
|
|
60
|
+
BreadcrumbItem,
|
|
61
|
+
BreadcrumbLink,
|
|
62
|
+
BreadcrumbList,
|
|
63
|
+
BreadcrumbPage,
|
|
64
|
+
BreadcrumbSeparator,
|
|
65
|
+
} from '@nanisoft/prism-ui/components/breadcrumb'
|
|
66
|
+
|
|
67
|
+
/** A three-level trail with the current page marked. */
|
|
68
|
+
export default function BreadcrumbDemo() {
|
|
69
|
+
return (
|
|
70
|
+
<Breadcrumb>
|
|
71
|
+
<BreadcrumbList>
|
|
72
|
+
<BreadcrumbItem>
|
|
73
|
+
<BreadcrumbLink href="/">Home</BreadcrumbLink>
|
|
74
|
+
</BreadcrumbItem>
|
|
75
|
+
<BreadcrumbSeparator />
|
|
76
|
+
<BreadcrumbItem>
|
|
77
|
+
<BreadcrumbLink href="/components">Components</BreadcrumbLink>
|
|
78
|
+
</BreadcrumbItem>
|
|
79
|
+
<BreadcrumbSeparator />
|
|
80
|
+
<BreadcrumbItem>
|
|
81
|
+
<BreadcrumbPage>Breadcrumb</BreadcrumbPage>
|
|
82
|
+
</BreadcrumbItem>
|
|
83
|
+
</BreadcrumbList>
|
|
84
|
+
</Breadcrumb>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Props
|
|
90
|
+
|
|
91
|
+
> Extends: the native `<nav>` element. No additional Prism-specific props.
|
|
@@ -1,14 +1,97 @@
|
|
|
1
1
|
# Button
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The action control for commands, links and loading states.
|
|
4
4
|
|
|
5
|
-
```
|
|
6
|
-
import { Button } from '@nanisoft/prism-ui/components'
|
|
5
|
+
```tsx
|
|
6
|
+
import { Button } from '@nanisoft/prism-ui/components/button'
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
The Button is the control for an action the reader takes deliberately. It
|
|
12
|
+
renders a native `<button>` and takes the standard React button props plus
|
|
13
|
+
`variant` and `size`, so it behaves like the element it is: it submits, it is
|
|
14
|
+
focusable, and it is reachable by keyboard without extra work.
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
The `variant` prop carries the action hierarchy. `default` is the primary
|
|
17
|
+
action, `secondary` and `outline` are supporting actions, `ghost` is for a quiet
|
|
18
|
+
action inside a surface that already carries weight, `destructive` marks an
|
|
19
|
+
action that cannot be undone, and `link` is an action styled as a link for the
|
|
20
|
+
rare case where an action sits inside a sentence.
|
|
21
|
+
|
|
22
|
+
## Guidelines
|
|
23
|
+
|
|
24
|
+
### When to use
|
|
25
|
+
|
|
26
|
+
Use a Button when the reader's intent is to make something happen: submit a
|
|
27
|
+
form, save a change, delete a record, open a dialog, or start a process.
|
|
28
|
+
|
|
29
|
+
Use one `default` Button per view for the action the view exists to perform.
|
|
30
|
+
Supporting actions take `secondary` or `outline`.
|
|
31
|
+
|
|
32
|
+
### When not to use
|
|
33
|
+
|
|
34
|
+
Do not use a Button to navigate. A route change is a link, and a link is
|
|
35
|
+
right-clickable, openable in a new tab, and announced as a link. Use an anchor
|
|
36
|
+
with the link styling instead.
|
|
37
|
+
|
|
38
|
+
Do not use a `ghost` Button as the only affordance on an empty surface. With no
|
|
39
|
+
surface to sit against, a ghost control reads as text; use `outline`.
|
|
40
|
+
|
|
41
|
+
Do not use a `destructive` Button for an action that can be undone. Reserve it
|
|
42
|
+
for the action that cannot.
|
|
43
|
+
|
|
44
|
+
### Best practices
|
|
45
|
+
|
|
46
|
+
- Keep one `default` Button visible at a time. Two primaries make neither of
|
|
47
|
+
them primary.
|
|
48
|
+
- Put the primary action last in reading order in a left-to-right layout, after
|
|
49
|
+
the supporting actions.
|
|
50
|
+
- For a destructive action, put the consequence in the confirmation, not in the
|
|
51
|
+
button label. The label names the thing, not the warning.
|
|
52
|
+
- A loading or disabled Button should explain why it is unavailable through
|
|
53
|
+
adjacent text or a tooltip. A disabled control with no reason in reach is a
|
|
54
|
+
dead end.
|
|
55
|
+
- The coarse-pointer media query grows the target to 44px on touch input
|
|
56
|
+
automatically. Do not add a second size rule for touch.
|
|
57
|
+
|
|
58
|
+
### Content guidelines
|
|
59
|
+
|
|
60
|
+
- Start a label with a verb in the imperative: "Save", "Delete project", "Add member".
|
|
61
|
+
- Use sentence case and no period.
|
|
62
|
+
- Name the object when the action is ambiguous: "Delete project" is better than
|
|
63
|
+
"Delete".
|
|
64
|
+
- Never use "Click here" or "Submit". The button's own label should state its
|
|
65
|
+
outcome.
|
|
66
|
+
- Keep a label to three words where possible.
|
|
67
|
+
|
|
68
|
+
**Buttons at each variant and size.**
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { Button } from '@nanisoft/prism-ui/components/button'
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Buttons at each variant and size.
|
|
75
|
+
*
|
|
76
|
+
* Self-contained: the only import is from the package, and it has a default
|
|
77
|
+
* export. The file is the source for the live preview, the copy control and the
|
|
78
|
+
* corpus.
|
|
79
|
+
*/
|
|
80
|
+
export default function ButtonDemo() {
|
|
81
|
+
return (
|
|
82
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
83
|
+
<Button>Save changes</Button>
|
|
84
|
+
<Button variant="secondary">Secondary</Button>
|
|
85
|
+
<Button variant="outline">Cancel</Button>
|
|
86
|
+
<Button variant="ghost">Ghost</Button>
|
|
87
|
+
<Button variant="destructive">Delete project</Button>
|
|
88
|
+
<Button variant="link">Read the guide</Button>
|
|
89
|
+
</div>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Props
|
|
95
|
+
|
|
96
|
+
**`variant`** `"default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined` · optional · default: —
|
|
97
|
+
**`size`** `"default" | "sm" | "lg" | "icon" | null | undefined` · optional · default: —
|
|
@@ -1,14 +1,97 @@
|
|
|
1
1
|
# Card
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A bordered surface for a small group of related content.
|
|
4
4
|
|
|
5
|
-
```
|
|
6
|
-
import { Card } from '@nanisoft/prism-ui/components'
|
|
5
|
+
```tsx
|
|
6
|
+
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@nanisoft/prism-ui/components/card'
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
A Card is a bordered surface that groups a small set of related content. It
|
|
12
|
+
ships as a parent and five parts: `Card`, `CardHeader`, `CardTitle`,
|
|
13
|
+
`CardDescription`, `CardContent` and `CardFooter`, all from the same module.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
The parts are optional and their order is the reading order. A card with a title
|
|
16
|
+
and a body uses `CardHeader`, `CardTitle` and `CardContent`; a card that ends in
|
|
17
|
+
an action adds `CardFooter`.
|
|
18
|
+
|
|
19
|
+
## Guidelines
|
|
20
|
+
|
|
21
|
+
### When to use
|
|
22
|
+
|
|
23
|
+
Use a Card when a small group of related content needs a shared boundary: a
|
|
24
|
+
summary tile, a settings group, a list item with a title and a body, or one item
|
|
25
|
+
in a grid.
|
|
26
|
+
|
|
27
|
+
### When not to use
|
|
28
|
+
|
|
29
|
+
Do not use a Card for the page's own frame. A Card inside a Card, or a Card used
|
|
30
|
+
as a section wrapper, produces a border inside a border and flattens the
|
|
31
|
+
hierarchy. Use `Section` for page rhythm.
|
|
32
|
+
|
|
33
|
+
Do not use a Card for a single field or a single line of text. A boundary around
|
|
34
|
+
one thing adds weight without grouping anything.
|
|
35
|
+
|
|
36
|
+
Do not use a Card as a link by wrapping it in an anchor with a nested button. If
|
|
37
|
+
the whole card is navigable, make the title the link and keep any action a
|
|
38
|
+
sibling of it.
|
|
39
|
+
|
|
40
|
+
### Best practices
|
|
41
|
+
|
|
42
|
+
- Use one heading per card. `CardTitle` is a title, not a second heading level
|
|
43
|
+
in the page outline; the card's own section provides that.
|
|
44
|
+
- Keep `CardDescription` to a single sentence. A paragraph belongs in
|
|
45
|
+
`CardContent`.
|
|
46
|
+
- Put the card's action in `CardFooter` so a grid of cards aligns its actions on
|
|
47
|
+
one line.
|
|
48
|
+
- In a grid, make cards the same height and keep the action at the end, so the
|
|
49
|
+
eye can compare rows.
|
|
50
|
+
|
|
51
|
+
### Content guidelines
|
|
52
|
+
|
|
53
|
+
- A title is a noun phrase and takes sentence case: "Release notes", not
|
|
54
|
+
"Release Notes".
|
|
55
|
+
- A description states what the group is, not what to do with it.
|
|
56
|
+
- A footer action uses the same verb-first, sentence-case rule as a Button
|
|
57
|
+
label.
|
|
58
|
+
|
|
59
|
+
**A card with a header, a body and a footer action.**
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import {
|
|
63
|
+
Card,
|
|
64
|
+
CardContent,
|
|
65
|
+
CardDescription,
|
|
66
|
+
CardFooter,
|
|
67
|
+
CardHeader,
|
|
68
|
+
CardTitle,
|
|
69
|
+
} from '@nanisoft/prism-ui/components/card'
|
|
70
|
+
import { Button } from '@nanisoft/prism-ui/components/button'
|
|
71
|
+
|
|
72
|
+
/** A card with a header, a body and a footer action. */
|
|
73
|
+
export default function CardDemo() {
|
|
74
|
+
return (
|
|
75
|
+
<Card className="max-w-sm">
|
|
76
|
+
<CardHeader>
|
|
77
|
+
<CardTitle>Release 2.4</CardTitle>
|
|
78
|
+
<CardDescription>Shipped to production on 12 August.</CardDescription>
|
|
79
|
+
</CardHeader>
|
|
80
|
+
<CardContent>
|
|
81
|
+
<p className="text-muted-foreground text-sm">
|
|
82
|
+
Three fixes and one new block, with no token changes.
|
|
83
|
+
</p>
|
|
84
|
+
</CardContent>
|
|
85
|
+
<CardFooter>
|
|
86
|
+
<Button variant="outline" size="sm">
|
|
87
|
+
View changelog
|
|
88
|
+
</Button>
|
|
89
|
+
</CardFooter>
|
|
90
|
+
</Card>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Props
|
|
96
|
+
|
|
97
|
+
> Extends: the native `<div>` element. No additional Prism-specific props.
|