@nanisoft/prism-llms 0.4.0 → 0.5.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/README.md +88 -0
- package/THIRD-PARTY-NOTICES.md +48 -0
- package/dist/data.json +4037 -386
- 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 +299 -156
- package/dist/index.d.ts +12 -7
- package/dist/index.js +9 -7
- package/dist/llms-full.txt +8248 -2013
- package/dist/llms.txt +98 -93
- 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 +98 -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 +107 -0
- package/dist/md/blocks/settings-panel-01.md +146 -0
- package/dist/md/blocks/site-footer.md +103 -11
- package/dist/md/blocks/site-header.md +107 -11
- 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 +244 -0
- package/dist/md/changelogs/prism-mcp-server.md +95 -0
- package/dist/md/changelogs/prism-tokens.md +126 -0
- package/dist/md/changelogs/prism-ui.md +467 -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 +114 -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/docs-shell.md +210 -15
- 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/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,111 @@
|
|
|
1
1
|
# Table
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The semantic table components for rows, columns and captions.
|
|
4
4
|
|
|
5
|
-
```
|
|
6
|
-
import { Table } from '@nanisoft/prism-ui/components'
|
|
5
|
+
```tsx
|
|
6
|
+
import { Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption } from '@nanisoft/prism-ui/components/table'
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
A Table presents tabular data: records compared across named columns. It ships
|
|
12
|
+
as `Table`, `TableHeader`, `TableBody`, `TableFooter`, `TableRow`, `TableHead`,
|
|
13
|
+
`TableCell` and `TableCaption`, all from the same module.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
`Table` renders a real `<table>` inside a container that scrolls horizontally at
|
|
16
|
+
narrow widths, so a wide set of columns stays reachable. `TableHeader`,
|
|
17
|
+
`TableBody` and `TableFooter` map to `<thead>`, `<tbody>` and `<tfoot>`;
|
|
18
|
+
`TableHead` is a `<th>` and `TableCell` is a `<td>`. `TableCaption` names the
|
|
19
|
+
table for every reader, and it is read before the data.
|
|
20
|
+
|
|
21
|
+
## Guidelines
|
|
22
|
+
|
|
23
|
+
### When to use
|
|
24
|
+
|
|
25
|
+
Use a Table when records share the same set of attributes and the reader needs
|
|
26
|
+
to compare them down a column: invoices, members, deployments, line items.
|
|
27
|
+
|
|
28
|
+
### When not to use
|
|
29
|
+
|
|
30
|
+
Do not use a Table for page layout. It was a layout tool once, and every reader
|
|
31
|
+
and crawler now interprets a table as data.
|
|
32
|
+
|
|
33
|
+
Do not use one for a few key and value pairs. A description list states a record
|
|
34
|
+
better than a table with two columns.
|
|
35
|
+
|
|
36
|
+
Do not use a Table for a list where every row shows the same fields as prose.
|
|
37
|
+
If there is nothing to compare across columns, a list is the honest unit.
|
|
38
|
+
|
|
39
|
+
### Best practices
|
|
40
|
+
|
|
41
|
+
- Name the table. Use `TableCaption` or an adjacent heading, and do not leave a
|
|
42
|
+
reader to infer the subject from the column labels.
|
|
43
|
+
- Put the identifying column first, so a row is recognisable before it is read
|
|
44
|
+
across.
|
|
45
|
+
- Align numbers to the right through `className` and text to the left. The
|
|
46
|
+
alignment is layout, which is the one use of `className` the system permits.
|
|
47
|
+
- Keep cells terse. A paragraph in a cell is a row that has outgrown the table.
|
|
48
|
+
- Use `TableFooter` for a total or a count, so the summary is part of the table
|
|
49
|
+
rather than a paragraph after it.
|
|
50
|
+
- Add `scope="col"` to `TableHead` and `scope="row"` to a row header when a
|
|
51
|
+
control supplies it. The generated markup makes each cell identifiable.
|
|
52
|
+
- Avoid horizontal scrolling where you can. A table that fits its container is
|
|
53
|
+
easier to read than one the reader has to drag.
|
|
54
|
+
|
|
55
|
+
**A small invoices table with a header, a body and a footer total.**
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import {
|
|
59
|
+
Table,
|
|
60
|
+
TableBody,
|
|
61
|
+
TableCaption,
|
|
62
|
+
TableCell,
|
|
63
|
+
TableFooter,
|
|
64
|
+
TableHead,
|
|
65
|
+
TableHeader,
|
|
66
|
+
TableRow,
|
|
67
|
+
} from '@nanisoft/prism-ui/components/table'
|
|
68
|
+
|
|
69
|
+
/** A small invoices table with a header, a body and a footer total. */
|
|
70
|
+
export default function TableDemo() {
|
|
71
|
+
return (
|
|
72
|
+
<Table>
|
|
73
|
+
<TableCaption>Invoices from the current quarter.</TableCaption>
|
|
74
|
+
<TableHeader>
|
|
75
|
+
<TableRow>
|
|
76
|
+
<TableHead>Invoice</TableHead>
|
|
77
|
+
<TableHead>Status</TableHead>
|
|
78
|
+
<TableHead className="text-right">Amount</TableHead>
|
|
79
|
+
</TableRow>
|
|
80
|
+
</TableHeader>
|
|
81
|
+
<TableBody>
|
|
82
|
+
<TableRow>
|
|
83
|
+
<TableCell className="font-medium">INV-001</TableCell>
|
|
84
|
+
<TableCell>Paid</TableCell>
|
|
85
|
+
<TableCell className="text-right">$250.00</TableCell>
|
|
86
|
+
</TableRow>
|
|
87
|
+
<TableRow>
|
|
88
|
+
<TableCell className="font-medium">INV-002</TableCell>
|
|
89
|
+
<TableCell>Pending</TableCell>
|
|
90
|
+
<TableCell className="text-right">$150.00</TableCell>
|
|
91
|
+
</TableRow>
|
|
92
|
+
<TableRow>
|
|
93
|
+
<TableCell className="font-medium">INV-003</TableCell>
|
|
94
|
+
<TableCell>Draft</TableCell>
|
|
95
|
+
<TableCell className="text-right">$350.00</TableCell>
|
|
96
|
+
</TableRow>
|
|
97
|
+
</TableBody>
|
|
98
|
+
<TableFooter>
|
|
99
|
+
<TableRow>
|
|
100
|
+
<TableCell colSpan={2}>Total</TableCell>
|
|
101
|
+
<TableCell className="text-right">$750.00</TableCell>
|
|
102
|
+
</TableRow>
|
|
103
|
+
</TableFooter>
|
|
104
|
+
</Table>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Props
|
|
110
|
+
|
|
111
|
+
> Extends: the native `<table>` element. No additional Prism-specific props.
|
|
@@ -1,14 +1,112 @@
|
|
|
1
1
|
# Tabs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The set of peer views shown one at a time.
|
|
4
4
|
|
|
5
|
-
```
|
|
6
|
-
import { Tabs } from '@nanisoft/prism-ui/components'
|
|
5
|
+
```tsx
|
|
6
|
+
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@nanisoft/prism-ui/components/tabs'
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
Tabs show a set of peer views one at a time. It ships as `Tabs`, `TabsList`,
|
|
12
|
+
`TabsTrigger` and `TabsContent`, all from the same module. Each trigger names a
|
|
13
|
+
panel, and the matching panel shares the trigger's value.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
The tab list is a single Tab stop. Arrow keys move between triggers and show the
|
|
16
|
+
matching panel, while Tab moves into the panel itself. The active trigger is
|
|
17
|
+
marked with an active state, and the panel it controls is tied to it for
|
|
18
|
+
assistive technology.
|
|
19
|
+
|
|
20
|
+
## Guidelines
|
|
21
|
+
|
|
22
|
+
### When to use
|
|
23
|
+
|
|
24
|
+
Use Tabs to switch between views of the same subject when the reader only needs
|
|
25
|
+
one at a time: overview and activity, code and preview, one setting group among
|
|
26
|
+
several.
|
|
27
|
+
|
|
28
|
+
### When not to use
|
|
29
|
+
|
|
30
|
+
Do not use Tabs for steps in a process. Order matters there, and steps belong in
|
|
31
|
+
a form or a wizard where progress is visible.
|
|
32
|
+
|
|
33
|
+
Do not use Tabs to hide content that a reader needs to compare across panels.
|
|
34
|
+
Side-by-side sections compare better than tabs.
|
|
35
|
+
|
|
36
|
+
Do not use more tabs than fit on one line. If the list wraps, a Select or a
|
|
37
|
+
sidebar section is the better control.
|
|
38
|
+
|
|
39
|
+
### Best practices
|
|
40
|
+
|
|
41
|
+
- Give every `TabsTrigger` a matching `TabsContent` with the same value, and
|
|
42
|
+
keep the order the same in both.
|
|
43
|
+
- Choose a sensible default panel. The first tab is a fine default only if it is
|
|
44
|
+
the view most readers want.
|
|
45
|
+
- Keep panel content structurally similar so switching does not move the
|
|
46
|
+
reader's place on the page.
|
|
47
|
+
- On a narrow screen, let a long tab list scroll rather than wrap, and keep the
|
|
48
|
+
active tab in view.
|
|
49
|
+
- Do not nest tabs inside tabs. One tab set per region keeps the keyboard model
|
|
50
|
+
predictable.
|
|
51
|
+
|
|
52
|
+
### Content guidelines
|
|
53
|
+
|
|
54
|
+
- Label tabs with a noun or a short noun phrase: "Overview", "Activity",
|
|
55
|
+
"Settings".
|
|
56
|
+
- Use sentence case and no trailing periods.
|
|
57
|
+
- Keep labels to one or two words so the row scans at a glance.
|
|
58
|
+
- If a tab needs a count, keep it short and place it after the label, such as
|
|
59
|
+
"Activity 4".
|
|
60
|
+
|
|
61
|
+
**Tabs that switch between three peer views of one subject.**
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
'use client'
|
|
65
|
+
|
|
66
|
+
import {
|
|
67
|
+
Tabs,
|
|
68
|
+
TabsContent,
|
|
69
|
+
TabsList,
|
|
70
|
+
TabsTrigger,
|
|
71
|
+
} from '@nanisoft/prism-ui/components/tabs'
|
|
72
|
+
|
|
73
|
+
/** Tabs that switch between three peer views of one subject. */
|
|
74
|
+
export default function TabsDemo() {
|
|
75
|
+
return (
|
|
76
|
+
<Tabs defaultValue="overview" className="max-w-measure-narrow">
|
|
77
|
+
<TabsList>
|
|
78
|
+
<TabsTrigger value="overview">Overview</TabsTrigger>
|
|
79
|
+
<TabsTrigger value="activity">Activity</TabsTrigger>
|
|
80
|
+
<TabsTrigger value="settings">Settings</TabsTrigger>
|
|
81
|
+
</TabsList>
|
|
82
|
+
<TabsContent value="overview">
|
|
83
|
+
<p className="text-muted-foreground pt-2 text-sm">
|
|
84
|
+
Release 2.4 shipped three fixes and one new block, with no token
|
|
85
|
+
changes.
|
|
86
|
+
</p>
|
|
87
|
+
</TabsContent>
|
|
88
|
+
<TabsContent value="activity">
|
|
89
|
+
<p className="text-muted-foreground pt-2 text-sm">
|
|
90
|
+
Four deploys this week, all from the main branch.
|
|
91
|
+
</p>
|
|
92
|
+
</TabsContent>
|
|
93
|
+
<TabsContent value="settings">
|
|
94
|
+
<p className="text-muted-foreground pt-2 text-sm">
|
|
95
|
+
The workspace uses the Blush pack in light mode.
|
|
96
|
+
</p>
|
|
97
|
+
</TabsContent>
|
|
98
|
+
</Tabs>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Props
|
|
104
|
+
|
|
105
|
+
**`value`** `string` · optional · default: — — The active panel's value, when the tabs are controlled.
|
|
106
|
+
**`defaultValue`** `string` · optional · default: — — The panel shown initially, for uncontrolled tabs.
|
|
107
|
+
**`onValueChange`** `(value: string) => void` · optional · default: — — Called when the active panel changes.
|
|
108
|
+
**`orientation`** `'horizontal' | 'vertical'` · optional · default: `horizontal` — The direction the tab list flows.
|
|
109
|
+
**`activateOnFocus`** `boolean` · optional · default: `false` — Whether arrow-key focus also activates the tab.
|
|
110
|
+
**`loopFocus`** `boolean` · optional · default: `true` — Whether arrow keys wrap at the ends of the list.
|
|
111
|
+
**`disabled`** `boolean` · optional · default: — — Whether the trigger ignores user interaction.
|
|
112
|
+
**`keepMounted`** `boolean` · optional · default: `false` — Whether the panel stays in the DOM while hidden.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Textarea
|
|
2
|
+
|
|
3
|
+
The multi-line text control for a form.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { Textarea } from '@nanisoft/prism-ui/components/textarea'
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
A Textarea is the multi-line text control. It renders a native `<textarea>` with
|
|
12
|
+
a minimum height and a resize grip, so a reader can see more than one line of
|
|
13
|
+
what they have written.
|
|
14
|
+
|
|
15
|
+
It shares the Input's focus treatment: a full-strength ring on focus and a
|
|
16
|
+
destructive border and ring when the control is marked with `aria-invalid`. The
|
|
17
|
+
height follows the content where the browser supports field sizing, and `rows`
|
|
18
|
+
remains the fallback.
|
|
19
|
+
|
|
20
|
+
## Guidelines
|
|
21
|
+
|
|
22
|
+
### When to use
|
|
23
|
+
|
|
24
|
+
Use a Textarea for free-form text that runs past a line: a note, a comment, a
|
|
25
|
+
bio, a support message, a release description.
|
|
26
|
+
|
|
27
|
+
Pair it with a Field label and a helper line, and set `rows` to a height that
|
|
28
|
+
shows the expected answer rather than one line.
|
|
29
|
+
|
|
30
|
+
### When not to use
|
|
31
|
+
|
|
32
|
+
Do not use a Textarea for a single-line value. A name or a search term does not
|
|
33
|
+
need a resize grip.
|
|
34
|
+
|
|
35
|
+
Do not use one for structured data the product can model as separate fields. If
|
|
36
|
+
the parts have names, they deserve their own controls and validation.
|
|
37
|
+
|
|
38
|
+
Do not use a Textarea for rich text. Formatting, links and embeds need an
|
|
39
|
+
editor the design system does not ship.
|
|
40
|
+
|
|
41
|
+
### Best practices
|
|
42
|
+
|
|
43
|
+
- Set a minimum height that matches the expected answer. A box that shows one
|
|
44
|
+
line suggests the answer is one line.
|
|
45
|
+
- Keep the label above the control and the helper line below it, exactly as an
|
|
46
|
+
Input does, so a form reads as one pattern.
|
|
47
|
+
- Leave the resize grip available. Readers with motor or vision differences
|
|
48
|
+
often size the box to the draft they are writing.
|
|
49
|
+
- Show the current and maximum length next to the field when there is a limit,
|
|
50
|
+
and count down rather than up so the remaining space is obvious.
|
|
51
|
+
- Mark a failed field with `aria-invalid` and put the reason in a FieldError.
|
|
52
|
+
The border is not the message.
|
|
53
|
+
|
|
54
|
+
### Content guidelines
|
|
55
|
+
|
|
56
|
+
- A helper line may state the limit or the format: "Up to 500 characters",
|
|
57
|
+
"Plain text only".
|
|
58
|
+
- A placeholder may sketch the expected answer, and should be shorter than the
|
|
59
|
+
label it sits under.
|
|
60
|
+
- Do not repeat the label inside the placeholder. The two are read together by
|
|
61
|
+
a screen reader.
|
|
62
|
+
|
|
63
|
+
**A textarea with a label and helper line, plus a disabled one.**
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import {
|
|
67
|
+
Field,
|
|
68
|
+
FieldDescription,
|
|
69
|
+
FieldLabel,
|
|
70
|
+
} from '@nanisoft/prism-ui/components/field'
|
|
71
|
+
import { Textarea } from '@nanisoft/prism-ui/components/textarea'
|
|
72
|
+
|
|
73
|
+
/** A textarea with a label and helper line, plus a disabled one. */
|
|
74
|
+
export default function TextareaDemo() {
|
|
75
|
+
return (
|
|
76
|
+
<div className="flex max-w-measure-narrow flex-col gap-4">
|
|
77
|
+
<Field>
|
|
78
|
+
<FieldLabel htmlFor="textarea-note">Release note</FieldLabel>
|
|
79
|
+
<Textarea
|
|
80
|
+
id="textarea-note"
|
|
81
|
+
rows={4}
|
|
82
|
+
placeholder="What changed, and who it affects."
|
|
83
|
+
/>
|
|
84
|
+
<FieldDescription>Plain text. Markdown is added later.</FieldDescription>
|
|
85
|
+
</Field>
|
|
86
|
+
<Field>
|
|
87
|
+
<FieldLabel htmlFor="textarea-summary">Generated summary</FieldLabel>
|
|
88
|
+
<Textarea
|
|
89
|
+
id="textarea-summary"
|
|
90
|
+
defaultValue="Written by the pipeline."
|
|
91
|
+
disabled
|
|
92
|
+
/>
|
|
93
|
+
</Field>
|
|
94
|
+
</div>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Props
|
|
100
|
+
|
|
101
|
+
> Extends: the native `<textarea>` element. No additional Prism-specific props.
|
|
@@ -1,14 +1,102 @@
|
|
|
1
1
|
# Tooltip
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The short label shown on hover or focus beside a control.
|
|
4
4
|
|
|
5
|
-
```
|
|
6
|
-
import { Tooltip } from '@nanisoft/prism-ui/components'
|
|
5
|
+
```tsx
|
|
6
|
+
import { Tooltip, TooltipTrigger, TooltipContent } from '@nanisoft/prism-ui/components/tooltip'
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
A Tooltip is a short label that appears on hover or focus beside the control it
|
|
12
|
+
explains. It ships as `Tooltip`, `TooltipTrigger` and `TooltipContent`, all from
|
|
13
|
+
the same module. The trigger stays focusable, and the tooltip opens on keyboard
|
|
14
|
+
focus as well as on hover, so it is not a mouse-only affordance.
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
The content is positioned by the library and flips when there is no room on the
|
|
17
|
+
chosen side. Escape dismisses it. Because it is unavailable on touch, a tooltip
|
|
18
|
+
never carries the only copy of information a reader needs.
|
|
19
|
+
|
|
20
|
+
## Guidelines
|
|
21
|
+
|
|
22
|
+
### When to use
|
|
23
|
+
|
|
24
|
+
Use a Tooltip to name or briefly explain a control that is already visible: an
|
|
25
|
+
icon-only button, an abbreviated label, or a term a reader may not know.
|
|
26
|
+
|
|
27
|
+
### When not to use
|
|
28
|
+
|
|
29
|
+
Do not put essential content in a Tooltip. Keyboard and pointer users can reach
|
|
30
|
+
it, but touch users cannot, so anything required belongs in visible text.
|
|
31
|
+
|
|
32
|
+
Do not use a Tooltip for a form field's validation message. Errors need to be
|
|
33
|
+
persistent and programmatically tied to the field; a tooltip disappears.
|
|
34
|
+
|
|
35
|
+
Do not use one for rich content such as a form or a menu. That is a Popover.
|
|
36
|
+
|
|
37
|
+
### Best practices
|
|
38
|
+
|
|
39
|
+
- Keep the content to a short phrase. A sentence is the ceiling; a paragraph
|
|
40
|
+
belongs in a Popover or on the page.
|
|
41
|
+
- Attach the Tooltip to a focusable trigger. A tooltip on a plain span is
|
|
42
|
+
unreachable by keyboard.
|
|
43
|
+
- Give an icon-only trigger an `aria-label` as well. The tooltip is visual help;
|
|
44
|
+
the accessible name must stand on its own.
|
|
45
|
+
- Choose a side that does not cover the content the reader is looking at, and
|
|
46
|
+
let the library flip it near an edge.
|
|
47
|
+
- Do not nest interactive content in a Tooltip. It opens on focus and closes on
|
|
48
|
+
blur, so anything inside it is hard to reach.
|
|
49
|
+
|
|
50
|
+
### Content guidelines
|
|
51
|
+
|
|
52
|
+
- Write a noun phrase or one short sentence that adds information, not a repeat
|
|
53
|
+
of the trigger's label.
|
|
54
|
+
- Use sentence case and no closing period on a fragment; use one on a full
|
|
55
|
+
sentence.
|
|
56
|
+
- Never make the tooltip the first place a key term appears. Explain the term
|
|
57
|
+
where it is introduced, and let the tooltip remind.
|
|
58
|
+
|
|
59
|
+
**Tooltips on a text trigger and on an icon-only control.**
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
'use client'
|
|
63
|
+
|
|
64
|
+
import {
|
|
65
|
+
Tooltip,
|
|
66
|
+
TooltipContent,
|
|
67
|
+
TooltipTrigger,
|
|
68
|
+
} from '@nanisoft/prism-ui/components/tooltip'
|
|
69
|
+
|
|
70
|
+
/** Tooltips on a text trigger and on an icon-only control. */
|
|
71
|
+
export default function TooltipDemo() {
|
|
72
|
+
return (
|
|
73
|
+
<div className="flex flex-wrap items-center gap-8 text-sm">
|
|
74
|
+
<Tooltip>
|
|
75
|
+
<TooltipTrigger className="underline decoration-dotted underline-offset-4">
|
|
76
|
+
Beta feature
|
|
77
|
+
</TooltipTrigger>
|
|
78
|
+
<TooltipContent>Not covered by the uptime target.</TooltipContent>
|
|
79
|
+
</Tooltip>
|
|
80
|
+
<Tooltip>
|
|
81
|
+
<TooltipTrigger aria-label="Copy link" className="font-medium">
|
|
82
|
+
Copy link
|
|
83
|
+
</TooltipTrigger>
|
|
84
|
+
<TooltipContent side="bottom">Copies the current page URL.</TooltipContent>
|
|
85
|
+
</Tooltip>
|
|
86
|
+
</div>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Props
|
|
92
|
+
|
|
93
|
+
**`open`** `boolean` · optional · default: — — The controlled open state.
|
|
94
|
+
**`defaultOpen`** `boolean` · optional · default: — — The initially open state, for an uncontrolled tooltip.
|
|
95
|
+
**`onOpenChange`** `(open: boolean) => void` · optional · default: — — Called when the open state changes.
|
|
96
|
+
**`disabled`** `boolean` · optional · default: — — Whether the tooltip is disabled.
|
|
97
|
+
**`children`** `React.ReactNode` · optional · default: — — The trigger and content.
|
|
98
|
+
**`delay`** `number` · optional · default: `600` — How long to wait before opening on hover, in milliseconds.
|
|
99
|
+
**`closeDelay`** `number` · optional · default: `0` — How long to wait before closing, in milliseconds.
|
|
100
|
+
**`side`** `'top' | 'right' | 'bottom' | 'left'` · optional · default: `top` — Which side of the trigger the tooltip is placed on.
|
|
101
|
+
**`align`** `'start' | 'center' | 'end'` · optional · default: `center` — How the tooltip aligns against the trigger.
|
|
102
|
+
**`sideOffset`** `number` · optional · default: `4` — The distance in pixels between the trigger and the tooltip.
|
|
@@ -1,14 +1,89 @@
|
|
|
1
1
|
# Typography
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The text and heading components that apply the type scale.
|
|
4
4
|
|
|
5
|
-
```
|
|
6
|
-
import {
|
|
5
|
+
```tsx
|
|
6
|
+
import { Text, Heading } from '@nanisoft/prism-ui/components/typography'
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Overview
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
Typography is the pair of text exports that apply the type scale. `Heading`
|
|
12
|
+
renders a document heading and `Text` renders a run of body copy, both from the
|
|
13
|
+
same module.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
`Heading` separates the element from the visual step. The `as` prop chooses the
|
|
16
|
+
outline, and `size` chooses the scale, so a section that needs an `h2` attuned
|
|
17
|
+
to a compact card keeps the outline while taking a smaller visual size. `Text`
|
|
18
|
+
offers `size` and a `tone`, where `tone="muted"` is the supporting copy that
|
|
19
|
+
sits beside a heading.
|
|
20
|
+
|
|
21
|
+
## Guidelines
|
|
22
|
+
|
|
23
|
+
### When to use
|
|
24
|
+
|
|
25
|
+
Use `Heading` and `Text` for long-form content and documentation, where the
|
|
26
|
+
outline and the scale are the structure the reader navigates by.
|
|
27
|
+
|
|
28
|
+
Use the `as` and `size` split when a heading's place in the outline and its
|
|
29
|
+
visual weight are not the same decision.
|
|
30
|
+
|
|
31
|
+
### When not to use
|
|
32
|
+
|
|
33
|
+
Do not use Typography for a control label or a card title. Components such as
|
|
34
|
+
Button and CardTitle own their own text treatment, and restyling them from the
|
|
35
|
+
outside is the override the system forbids.
|
|
36
|
+
|
|
37
|
+
Do not use `Heading` to make text bigger. A paragraph that is important is still
|
|
38
|
+
a paragraph; emphasis comes from placement and copy.
|
|
39
|
+
|
|
40
|
+
Do not use Typography to fix spacing. Rhythm comes from the container, not from
|
|
41
|
+
a text size chosen to close a gap.
|
|
42
|
+
|
|
43
|
+
### Best practices
|
|
44
|
+
|
|
45
|
+
- Choose `as` by the document outline and `size` by the layout. One page has one
|
|
46
|
+
`h1`, and the levels below it never skip a step.
|
|
47
|
+
- Let `Heading` default to `h2`. A block or an article body is composed under a
|
|
48
|
+
page heading, so the surrounding document already owns the top level.
|
|
49
|
+
- Keep a prose measure near the container token. A line that runs the full
|
|
50
|
+
window is hard to track back to its start.
|
|
51
|
+
- Use `tone="muted"` for supporting copy and keep it to a sentence or two. If
|
|
52
|
+
the muted text carries the point, promote it.
|
|
53
|
+
- Keep headings in sentence case and leave the full stop off. A heading is a
|
|
54
|
+
label, not a sentence.
|
|
55
|
+
- Do not scale text with `className`. Size is a token decision, and a one-off
|
|
56
|
+
value breaks the scale for the next reader.
|
|
57
|
+
|
|
58
|
+
**The scale: a display heading, a subheading and both text tones.**
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import {
|
|
62
|
+
Heading,
|
|
63
|
+
Text,
|
|
64
|
+
} from '@nanisoft/prism-ui/components/typography'
|
|
65
|
+
|
|
66
|
+
/** The scale: a display heading, a subheading and both text tones. */
|
|
67
|
+
export default function TypographyDemo() {
|
|
68
|
+
return (
|
|
69
|
+
<div className="flex max-w-measure flex-col gap-3">
|
|
70
|
+
<Heading as="h3" size="3xl">
|
|
71
|
+
Release notes
|
|
72
|
+
</Heading>
|
|
73
|
+
<Text tone="muted">What shipped in the last two weeks, in reading order.</Text>
|
|
74
|
+
<Heading as="h4" size="xl">
|
|
75
|
+
Fixes
|
|
76
|
+
</Heading>
|
|
77
|
+
<Text>Three defects in the table toolbar and one in the theme switcher.</Text>
|
|
78
|
+
<Text as="span" size="sm" tone="muted">
|
|
79
|
+
Updated 12 August.
|
|
80
|
+
</Text>
|
|
81
|
+
</div>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Props
|
|
87
|
+
|
|
88
|
+
**`size`** `"sm" | "lg" | "base" | null | undefined` · optional · default: —
|
|
89
|
+
**`tone`** `"default" | "muted" | null | undefined` · optional · default: —
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# About content
|
|
2
|
+
|
|
3
|
+
What "content" means at NaniSoft, and the scope of this section.
|
|
4
|
+
|
|
5
|
+
Content is the information in a user interface that works alongside the visual
|
|
6
|
+
design. It includes every string a person reads inside a product: labels,
|
|
7
|
+
headings, helper text, button text, empty states, error messages, tooltips,
|
|
8
|
+
notifications and confirmation dialogs.
|
|
9
|
+
|
|
10
|
+
RULE: Content is product text. It is not marketing copy, and it does not live on
|
|
11
|
+
this documentation site.
|
|
12
|
+
|
|
13
|
+
## Who this section is for
|
|
14
|
+
|
|
15
|
+
This section is for anyone at NaniSoft who writes text a customer will read:
|
|
16
|
+
designers writing labels, engineers writing empty states and errors, product
|
|
17
|
+
managers writing release notes, and support staff writing help text.
|
|
18
|
+
|
|
19
|
+
RULE: Anyone who writes product copy MUST follow this section. It applies to
|
|
20
|
+
first drafts as much as to reviews.
|
|
21
|
+
|
|
22
|
+
## What this section is not
|
|
23
|
+
|
|
24
|
+
This section is not a style guide for source code, commit messages or internal
|
|
25
|
+
documents. Those have their own conventions. It is also not the design system's
|
|
26
|
+
vocabulary; that is the [Glossary](/content/glossary).
|
|
27
|
+
|
|
28
|
+
## The register
|
|
29
|
+
|
|
30
|
+
RULE: This section MUST use RFC 2119 keywords (MUST, SHOULD, MAY) so a rule can
|
|
31
|
+
be read unambiguously, and it MUST prefix each rule line with `RULE:` so the
|
|
32
|
+
rules are machine-greppable.
|
|
33
|
+
|
|
34
|
+
Outside this section, Prism write in plain language and avoid those keywords.
|
|
35
|
+
The difference is deliberate: a rule that a reader must follow is stated as a
|
|
36
|
+
rule, and everything else is explanation.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Audience
|
|
2
|
+
|
|
3
|
+
The three people NaniSoft product copy serves, and what each one needs from a sentence.
|
|
4
|
+
|
|
5
|
+
Product copy serves three audiences. A piece of text MUST land for the person who
|
|
6
|
+
reads it in that moment, and the three do not always want the same thing.
|
|
7
|
+
|
|
8
|
+
## The operator
|
|
9
|
+
|
|
10
|
+
The operator uses the product to finish a job, often repeatedly. They know the
|
|
11
|
+
interface and resent being told what they already know, but they need
|
|
12
|
+
confirmation that a consequential action will do what they expect.
|
|
13
|
+
|
|
14
|
+
- They read errors, confirmations and destructive-action warnings closely.
|
|
15
|
+
- They skip onboarding and explanation.
|
|
16
|
+
- RULE: For the operator, be brief and specific. State the consequence, not the
|
|
17
|
+
mechanism.
|
|
18
|
+
|
|
19
|
+
## The evaluator
|
|
20
|
+
|
|
21
|
+
The evaluator is deciding whether the product does what they need. They meet the
|
|
22
|
+
product once, with a task in mind, and they are quick to leave.
|
|
23
|
+
|
|
24
|
+
- They read empty states, first-run text and headings.
|
|
25
|
+
- They need the next step to be obvious.
|
|
26
|
+
- RULE: For the evaluator, name the outcome and give exactly one clear next
|
|
27
|
+
action.
|
|
28
|
+
|
|
29
|
+
## The builder
|
|
30
|
+
|
|
31
|
+
The builder integrates NaniSoft into something they own. They read documentation
|
|
32
|
+
more than product copy, but the two meet in import errors, configuration screens
|
|
33
|
+
and generated code.
|
|
34
|
+
|
|
35
|
+
- They need exact names: packs, tokens, props and package paths.
|
|
36
|
+
- They are unforgiving of a label that does not match the API.
|
|
37
|
+
- RULE: For the builder, use the exact, cased term from the glossary. Do not
|
|
38
|
+
paraphrase a name of anything.
|
|
39
|
+
|
|
40
|
+
## Reading level
|
|
41
|
+
|
|
42
|
+
RULE: Write for a general professional audience. Prefer common words, active
|
|
43
|
+
voice and a single idea per sentence.
|