shelving 1.322.0 → 1.322.2
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/docs/api/APIProvider.md +2 -2
- package/docs/api/CachedAPIProvider.md +6 -8
- package/docs/api/ClientAPIProvider.md +5 -5
- package/docs/api/DebugAPIProvider.md +3 -5
- package/docs/api/HydratingAPIProvider.md +2 -2
- package/docs/api/JSONAPIProvider.md +3 -5
- package/docs/api/LoggingAPIProvider.md +7 -9
- package/docs/api/MockAPIProvider.md +4 -4
- package/docs/api/MockEndpointAPIProvider.md +5 -7
- package/docs/api/ThroughAPIProvider.md +15 -10
- package/docs/api/ValidationAPIProvider.md +3 -5
- package/docs/api/XMLAPIProvider.md +3 -3
- package/docs/api.md +48 -44
- package/docs/bun.md +9 -9
- package/docs/db/DBProvider.md +6 -6
- package/docs/db/MemoryDBProvider.md +3 -3
- package/docs/db/PostgresProvider.md +6 -4
- package/docs/db/SQLProvider.md +6 -3
- package/docs/db/SQLiteProvider.md +9 -4
- package/docs/db/StorageDBProvider.md +2 -2
- package/docs/db/ThroughDBProvider.md +6 -6
- package/docs/db/UndoDBProvider.md +2 -2
- package/docs/db.md +32 -32
- package/docs/error/NetworkError.md +5 -5
- package/docs/error/RequestError.md +4 -4
- package/docs/error/RequiredError.md +2 -2
- package/docs/error/ResponseError.md +1 -1
- package/docs/error/UnexpectedError.md +1 -1
- package/docs/error/UnsupportedError.md +3 -3
- package/docs/error/ValueError.md +2 -2
- package/docs/error.md +20 -19
- package/docs/extract.md +14 -14
- package/docs/firebase.md +6 -6
- package/docs/guides/building-with-shelving.md +113 -85
- package/docs/guides/styleguide.md +29 -29
- package/docs/index.md +3 -2
- package/docs/llms-full.txt +2541 -2295
- package/docs/markup.md +15 -17
- package/docs/react/createAPIContext.md +12 -12
- package/docs/react/createDBContext.md +21 -15
- package/docs/react/useInstance.md +2 -2
- package/docs/react/useLazy.md +1 -1
- package/docs/react/useMap.md +10 -6
- package/docs/react/useReduce.md +2 -2
- package/docs/react/useSequence.md +2 -2
- package/docs/react/useStore.md +10 -10
- package/docs/react.md +22 -16
- package/docs/schema/ArraySchema.md +6 -6
- package/docs/schema/BooleanSchema.md +5 -5
- package/docs/schema/ChoiceSchema.md +1 -1
- package/docs/schema/CurrencyAmountSchema.md +2 -2
- package/docs/schema/DataSchema.md +5 -5
- package/docs/schema/NullableSchema.md +4 -4
- package/docs/schema/NumberSchema.md +4 -4
- package/docs/schema/OptionalSchema.md +1 -1
- package/docs/schema/StringSchema.md +7 -7
- package/docs/schema.md +21 -21
- package/docs/sequence/DeferredSequence.md +1 -1
- package/docs/sequence/InspectSequence.md +8 -6
- package/docs/sequence/LazySequence.md +3 -3
- package/docs/sequence/Sequence.md +6 -6
- package/docs/sequence/ThroughSequence.md +4 -2
- package/docs/sequence.md +3 -3
- package/docs/store/ArrayStore.md +6 -6
- package/docs/store/BooleanStore.md +2 -2
- package/docs/store/BusyStore.md +1 -1
- package/docs/store/DataStore.md +5 -5
- package/docs/store/DictionaryStore.md +4 -4
- package/docs/store/FetchStore.md +6 -6
- package/docs/store/PathStore.md +4 -4
- package/docs/store/PayloadFetchStore.md +1 -5
- package/docs/store/Store.md +8 -6
- package/docs/store/URLStore.md +5 -5
- package/docs/store.md +15 -15
- package/docs/test.md +6 -6
- package/docs/ui/App.md +99 -69
- package/docs/ui/AppLayout.md +35 -26
- package/docs/ui/BackButton.md +13 -11
- package/docs/ui/Button.md +73 -64
- package/docs/ui/Card.md +23 -22
- package/docs/ui/Catcher.md +3 -3
- package/docs/ui/ClassProps.md +1 -1
- package/docs/ui/Code.md +11 -11
- package/docs/ui/CollapseTransition.md +5 -5
- package/docs/ui/Deleted.md +6 -6
- package/docs/ui/Details.md +13 -13
- package/docs/ui/Dialog.md +42 -28
- package/docs/ui/Dialogs.md +4 -0
- package/docs/ui/DocumentationButtons.md +2 -2
- package/docs/ui/DocumentationCard.md +2 -2
- package/docs/ui/DocumentationFrame.md +4 -4
- package/docs/ui/DocumentationLive.md +11 -11
- package/docs/ui/DocumentationPage.md +3 -3
- package/docs/ui/Emphasis.md +4 -4
- package/docs/ui/Empty.md +2 -2
- package/docs/ui/FadeTransition.md +9 -9
- package/docs/ui/Field.md +14 -14
- package/docs/ui/FixedLayout.md +27 -25
- package/docs/ui/Form.md +41 -39
- package/docs/ui/FormStore.md +6 -2
- package/docs/ui/Grid.md +21 -9
- package/docs/ui/HTML.md +10 -8
- package/docs/ui/Head.md +2 -3
- package/docs/ui/Heading.md +12 -12
- package/docs/ui/HorizontalTransition.md +10 -10
- package/docs/ui/Icon.md +4 -4
- package/docs/ui/ImageInput.md +12 -12
- package/docs/ui/Inserted.md +6 -6
- package/docs/ui/Link.md +11 -11
- package/docs/ui/List.md +7 -7
- package/docs/ui/Loading.md +6 -6
- package/docs/ui/Mark.md +11 -9
- package/docs/ui/Markup.md +4 -4
- package/docs/ui/Menu.md +24 -24
- package/docs/ui/MenuItem.md +29 -29
- package/docs/ui/Modal.md +57 -45
- package/docs/ui/Navigation.md +28 -26
- package/docs/ui/NavigationStore.md +18 -18
- package/docs/ui/Notice.md +15 -15
- package/docs/ui/Notices.md +17 -17
- package/docs/ui/Page.md +13 -13
- package/docs/ui/Panel.md +8 -8
- package/docs/ui/Paragraph.md +5 -5
- package/docs/ui/Progress.md +11 -11
- package/docs/ui/Prose.md +6 -6
- package/docs/ui/QueryRadiosInput.md +2 -2
- package/docs/ui/RouteCache.md +27 -27
- package/docs/ui/Router.md +70 -61
- package/docs/ui/SchemaInput.md +20 -20
- package/docs/ui/Scroll.md +16 -16
- package/docs/ui/Section.md +13 -10
- package/docs/ui/SidebarLayout.md +27 -27
- package/docs/ui/Small.md +4 -4
- package/docs/ui/Span.md +3 -1
- package/docs/ui/StackButton.md +13 -7
- package/docs/ui/Strong.md +4 -4
- package/docs/ui/Subheading.md +12 -12
- package/docs/ui/TINT_CLASS.md +11 -11
- package/docs/ui/Table.md +40 -29
- package/docs/ui/Tag.md +15 -15
- package/docs/ui/Title.md +13 -13
- package/docs/ui/Transition.md +22 -22
- package/docs/ui/TreeApp.md +8 -8
- package/docs/ui/TreeMarkup.md +2 -2
- package/docs/ui/TreeMenu.md +3 -3
- package/docs/ui/TreeSidebar.md +1 -1
- package/docs/ui/VerticalTransition.md +8 -8
- package/docs/ui/getClass.md +10 -10
- package/docs/ui/getColorClass.md +23 -23
- package/docs/ui/getDurationClass.md +5 -5
- package/docs/ui/getGridClass.md +2 -2
- package/docs/ui/getHeightClass.md +4 -4
- package/docs/ui/getRadiusClass.md +9 -9
- package/docs/ui/getShadowClass.md +6 -6
- package/docs/ui/getSpaceClass.md +13 -13
- package/docs/ui/getStrokeClass.md +6 -6
- package/docs/ui/getTypographyClass.md +38 -38
- package/docs/ui/getWidthClass.md +4 -4
- package/docs/ui/notify.md +11 -11
- package/docs/ui/requireContext.md +1 -1
- package/docs/ui.md +4 -4
- package/docs/util/array.md +35 -29
- package/docs/util/async.md +2 -2
- package/docs/util/base64.md +7 -7
- package/docs/util/boolean.md +10 -10
- package/docs/util/buffer.md +5 -5
- package/docs/util/bytes.md +9 -9
- package/docs/util/class.md +10 -6
- package/docs/util/color.md +13 -13
- package/docs/util/constants.md +2 -2
- package/docs/util/crypto.md +1 -1
- package/docs/util/currency.md +2 -2
- package/docs/util/data.md +18 -18
- package/docs/util/date.md +22 -22
- package/docs/util/debug/debug.md +12 -12
- package/docs/util/dictionary.md +21 -18
- package/docs/util/diff.md +6 -6
- package/docs/util/dispose/dispose.md +5 -5
- package/docs/util/duration.md +9 -9
- package/docs/util/element.md +1 -1
- package/docs/util/entity.md +6 -6
- package/docs/util/entry.md +21 -8
- package/docs/util/env.md +2 -2
- package/docs/util/equal.md +16 -16
- package/docs/util/error.md +4 -4
- package/docs/util/file.md +8 -8
- package/docs/util/filter.md +9 -5
- package/docs/util/format.md +18 -18
- package/docs/util/function.md +4 -4
- package/docs/util/geo.md +13 -13
- package/docs/util/hash.md +3 -3
- package/docs/util/http.md +1 -1
- package/docs/util/hydrate/hydrate.md +7 -4
- package/docs/util/item.md +4 -4
- package/docs/util/iterate.md +11 -11
- package/docs/util/jwt.md +1 -6
- package/docs/util/link.md +5 -5
- package/docs/util/map.md +17 -11
- package/docs/util/merge.md +2 -5
- package/docs/util/null.md +20 -10
- package/docs/util/number.md +16 -16
- package/docs/util/object.md +25 -22
- package/docs/util/path.md +17 -17
- package/docs/util/query.md +23 -25
- package/docs/util/random.md +7 -7
- package/docs/util/regexp.md +16 -16
- package/docs/util/sequence.md +16 -10
- package/docs/util/serialise/serialise.md +6 -6
- package/docs/util/set.md +10 -10
- package/docs/util/sort.md +10 -11
- package/docs/util/source.md +11 -7
- package/docs/util/start.md +8 -8
- package/docs/util/string.md +14 -14
- package/docs/util/template.md +3 -3
- package/docs/util/timeout.md +5 -5
- package/docs/util/transform.md +6 -6
- package/docs/util/tree.md +13 -13
- package/docs/util/undefined.md +3 -3
- package/docs/util/units.md +15 -15
- package/docs/util/update.md +16 -16
- package/docs/util/uri.md +12 -12
- package/docs/util/url.md +11 -11
- package/docs/util/uuid.md +3 -3
- package/docs/util/validate.md +14 -9
- package/package.json +3 -3
- package/skills/shelving/SKILL.md +1 -0
- package/ui/README.md +4 -4
- package/ui/app/App.md +99 -69
- package/ui/block/Card.md +23 -22
- package/ui/block/Details.md +13 -13
- package/ui/block/Grid.md +21 -9
- package/ui/block/Heading.md +12 -12
- package/ui/block/List.md +7 -7
- package/ui/block/Panel.md +8 -8
- package/ui/block/Paragraph.md +5 -5
- package/ui/block/Prose.md +6 -6
- package/ui/block/Section.md +13 -10
- package/ui/block/Subheading.md +12 -12
- package/ui/block/Title.md +13 -13
- package/ui/button/Button.md +73 -64
- package/ui/dialog/Dialog.md +42 -28
- package/ui/dialog/Dialogs.d.ts +4 -0
- package/ui/dialog/Dialogs.js +4 -0
- package/ui/dialog/Dialogs.tsx +4 -0
- package/ui/dialog/Modal.md +57 -45
- package/ui/docs/DocumentationButtons.md +2 -2
- package/ui/docs/DocumentationCard.md +2 -2
- package/ui/docs/DocumentationFrame.md +4 -4
- package/ui/docs/DocumentationLive.md +11 -11
- package/ui/docs/DocumentationPage.md +3 -3
- package/ui/form/Field.md +14 -14
- package/ui/form/Form.md +41 -39
- package/ui/form/FormStore.md +6 -2
- package/ui/form/Progress.md +11 -11
- package/ui/inline/Code.md +11 -11
- package/ui/inline/Deleted.md +6 -6
- package/ui/inline/Emphasis.md +4 -4
- package/ui/inline/Inserted.md +6 -6
- package/ui/inline/Link.md +11 -11
- package/ui/inline/Mark.md +11 -9
- package/ui/inline/Small.md +4 -4
- package/ui/inline/Span.md +3 -1
- package/ui/inline/Strong.md +4 -4
- package/ui/input/ImageInput.md +12 -12
- package/ui/input/QueryRadiosInput.md +2 -2
- package/ui/input/SchemaInput.md +20 -20
- package/ui/layout/AppLayout.md +35 -26
- package/ui/layout/AppLayout.module.css +3 -16
- package/ui/layout/FixedLayout.md +27 -25
- package/ui/layout/SidebarLayout.md +27 -27
- package/ui/layout/SidebarLayout.module.css +1 -0
- package/ui/menu/Menu.md +24 -24
- package/ui/menu/MenuItem.md +29 -29
- package/ui/misc/Catcher.md +3 -3
- package/ui/misc/Icon.md +4 -4
- package/ui/misc/Loading.md +6 -6
- package/ui/misc/Markup.md +4 -4
- package/ui/misc/Tag.md +15 -15
- package/ui/notice/Empty.md +2 -2
- package/ui/notice/Notice.md +15 -15
- package/ui/notice/Notices.md +17 -17
- package/ui/page/HTML.md +10 -8
- package/ui/page/Head.md +2 -3
- package/ui/page/Page.md +13 -13
- package/ui/router/BackButton.md +13 -11
- package/ui/router/Navigation.md +28 -26
- package/ui/router/NavigationStore.md +18 -18
- package/ui/router/RouteCache.md +27 -27
- package/ui/router/Router.md +70 -61
- package/ui/router/StackButton.md +13 -7
- package/ui/style/Scroll.md +16 -16
- package/ui/style/TINT_CLASS.md +11 -11
- package/ui/style/getColorClass.md +23 -23
- package/ui/style/getDurationClass.md +5 -5
- package/ui/style/getGridClass.md +2 -2
- package/ui/style/getHeightClass.md +4 -4
- package/ui/style/getRadiusClass.md +9 -9
- package/ui/style/getShadowClass.md +6 -6
- package/ui/style/getSpaceClass.md +13 -13
- package/ui/style/getStrokeClass.md +6 -6
- package/ui/style/getTypographyClass.md +38 -38
- package/ui/style/getWidthClass.md +4 -4
- package/ui/table/Table.md +40 -30
- package/ui/transition/CollapseTransition.md +5 -5
- package/ui/transition/FadeTransition.md +9 -9
- package/ui/transition/HorizontalTransition.md +10 -10
- package/ui/transition/Transition.md +22 -22
- package/ui/transition/VerticalTransition.md +8 -8
- package/ui/tree/TreeApp.md +8 -8
- package/ui/tree/TreeMarkup.md +2 -2
- package/ui/tree/TreeMenu.md +3 -3
- package/ui/tree/TreeSidebar.md +1 -1
- package/ui/util/ClassProps.md +1 -1
- package/ui/util/getClass.md +10 -10
- package/ui/util/notify.md +11 -11
- package/ui/util/requireContext.md +1 -1
package/ui/dialog/Modal.md
CHANGED
|
@@ -26,14 +26,16 @@ Put the `Modal` inside a `<Dialog>` that you mount from React state.
|
|
|
26
26
|
import { Dialog, Modal } from "shelving/ui";
|
|
27
27
|
|
|
28
28
|
function ConfirmDelete({ onConfirm, onClose }: { onConfirm: () => void; onClose: () => void }) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
return (
|
|
30
|
+
<Dialog onClose={onClose}>
|
|
31
|
+
<Modal>
|
|
32
|
+
<p>Delete this item?</p>
|
|
33
|
+
<button type="button" onClick={onConfirm}>
|
|
34
|
+
Delete
|
|
35
|
+
</button>
|
|
36
|
+
</Modal>
|
|
37
|
+
</Dialog>
|
|
38
|
+
);
|
|
37
39
|
}
|
|
38
40
|
```
|
|
39
41
|
|
|
@@ -45,15 +47,21 @@ Pass the `Modal` to `DialogsStore.show()`. The store adds the `<Dialog>` for you
|
|
|
45
47
|
import { Modal, requireDialogs } from "shelving/ui";
|
|
46
48
|
|
|
47
49
|
function DeleteButton({ onConfirm }: { onConfirm: () => void }) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
const dialogs = requireDialogs();
|
|
51
|
+
const open = () =>
|
|
52
|
+
dialogs.show(
|
|
53
|
+
<Modal>
|
|
54
|
+
<p>Delete this item?</p>
|
|
55
|
+
<button type="button" onClick={onConfirm}>
|
|
56
|
+
Delete
|
|
57
|
+
</button>
|
|
58
|
+
</Modal>,
|
|
59
|
+
);
|
|
60
|
+
return (
|
|
61
|
+
<button type="button" onClick={open}>
|
|
62
|
+
Delete
|
|
63
|
+
</button>
|
|
64
|
+
);
|
|
57
65
|
}
|
|
58
66
|
```
|
|
59
67
|
|
|
@@ -61,16 +69,16 @@ function DeleteButton({ onConfirm }: { onConfirm: () => void }) {
|
|
|
61
69
|
|
|
62
70
|
```tsx
|
|
63
71
|
<Modal padding="large" indent="large" radius="large">
|
|
64
|
-
|
|
65
|
-
</Modal
|
|
72
|
+
<p>More space on all sides, and rounder corners.</p>
|
|
73
|
+
</Modal>;
|
|
66
74
|
```
|
|
67
75
|
|
|
68
76
|
### Shadow
|
|
69
77
|
|
|
70
78
|
```tsx
|
|
71
79
|
<Modal shadow="small">
|
|
72
|
-
|
|
73
|
-
</Modal
|
|
80
|
+
<p>Sits closer to the page.</p>
|
|
81
|
+
</Modal>;
|
|
74
82
|
```
|
|
75
83
|
|
|
76
84
|
### Pinned to an edge
|
|
@@ -79,17 +87,21 @@ function DeleteButton({ onConfirm }: { onConfirm: () => void }) {
|
|
|
79
87
|
import { Menu, MenuItem, Modal, requireDialogs } from "shelving/ui";
|
|
80
88
|
|
|
81
89
|
function MenuButton() {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
const dialogs = requireDialogs();
|
|
91
|
+
const open = () =>
|
|
92
|
+
dialogs.show(
|
|
93
|
+
<Modal left>
|
|
94
|
+
<Menu>
|
|
95
|
+
<MenuItem href="/">Home</MenuItem>
|
|
96
|
+
<MenuItem href="/settings">Settings</MenuItem>
|
|
97
|
+
</Menu>
|
|
98
|
+
</Modal>,
|
|
99
|
+
);
|
|
100
|
+
return (
|
|
101
|
+
<button type="button" onClick={open}>
|
|
102
|
+
Menu
|
|
103
|
+
</button>
|
|
104
|
+
);
|
|
93
105
|
}
|
|
94
106
|
```
|
|
95
107
|
|
|
@@ -99,18 +111,18 @@ A link click inside a `<Dialog>` closes it, so the menu slides out as the page c
|
|
|
99
111
|
|
|
100
112
|
`Modal` paints a shadowed surface with no border. Set `--modal-stroke` (for example `var(--stroke-normal)`) to show the themed border, or `--modal-border` to replace it. A pinned panel then has no visible border on the side that touches the screen edge. That side has a transparent border as wide as the screen's safe area (notch, rounded corners, home bar), so the content stays clear of it and the background fills it. On a pinned panel, only the corners that do not touch a screen edge are round. Override these hooks at `:root` (or any ancestor scope) to retheme.
|
|
101
113
|
|
|
102
|
-
| Variable
|
|
103
|
-
|
|
104
|
-
| `--modal-width`
|
|
105
|
-
| `--modal-stroke`
|
|
106
|
-
| `--modal-border`
|
|
107
|
-
| `--modal-radius`
|
|
108
|
-
| `--modal-background`
|
|
109
|
-
| `--modal-padding`
|
|
110
|
-
| `--modal-indent`
|
|
111
|
-
| `--modal-color`
|
|
112
|
-
| `--modal-max-height`
|
|
113
|
-
| `--modal-transition-duration` | Length of the slide for a pinned panel. Keep it the same as `--fade-transition-duration`, so the panel and the `<Dialog>` overlay finish together | `var(--duration-fast)` (150ms)
|
|
114
|
-
| `--modal-shadow`
|
|
114
|
+
| Variable | Styles | Default |
|
|
115
|
+
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
|
|
116
|
+
| `--modal-width` | Width of a `left` or `right` panel, and maximum width of a `top` or `bottom` panel (a centred panel takes `--dialog-width`) | `var(--width-narrow)` |
|
|
117
|
+
| `--modal-stroke` | Border width | `0` (no border) |
|
|
118
|
+
| `--modal-border` | Border shorthand | `var(--modal-stroke)` solid `--tint-80` |
|
|
119
|
+
| `--modal-radius` | Corner radius (the `radius` variant wins over it) | `var(--radius-normal)` (16px) |
|
|
120
|
+
| `--modal-background` | Surface fill | `var(--tint-100)` |
|
|
121
|
+
| `--modal-padding` | Inner top and bottom padding (one length; the `padding` variant overrides it) | `var(--space-normal)` (16px) |
|
|
122
|
+
| `--modal-indent` | Inner left and right padding (one length; the `indent` variant overrides it) | `var(--space-normal)` (16px) |
|
|
123
|
+
| `--modal-color` | Text colour | `var(--tint-00)` |
|
|
124
|
+
| `--modal-max-height` | Maximum height of a `top` or `bottom` panel (it scrolls past this) | `100%` |
|
|
125
|
+
| `--modal-transition-duration` | Length of the slide for a pinned panel. Keep it the same as `--fade-transition-duration`, so the panel and the `<Dialog>` overlay finish together | `var(--duration-fast)` (150ms) |
|
|
126
|
+
| `--modal-shadow` | Drop shadow (the `shadow` variant wins over it) | `var(--shadow-large)` |
|
|
115
127
|
|
|
116
128
|
**Global tokens it reads** — move these to retheme broadly: the tint ladder `--tint-00` / `--tint-80` / `--tint-100`, plus `--width-narrow`, `--space-normal`, `--radius-normal`, `--shadow-large`, and `--duration-fast`.
|
|
@@ -17,13 +17,13 @@ Used automatically by `<DocumentationPage>` and `<DocumentationCard>`. To render
|
|
|
17
17
|
```tsx
|
|
18
18
|
import { DocumentationButtons } from "shelving/ui";
|
|
19
19
|
|
|
20
|
-
<DocumentationButtons class="Store" extends="AbstractStore" implements={["Serializable"]}
|
|
20
|
+
<DocumentationButtons class="Store" extends="AbstractStore" implements={["Serializable"]} />;
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Drop a relation by omitting it, or tighten spacing with `space`.
|
|
24
24
|
|
|
25
25
|
```tsx
|
|
26
|
-
<DocumentationButtons extends="AbstractStore" space="none"
|
|
26
|
+
<DocumentationButtons extends="AbstractStore" space="none" />;
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
## Styling
|
|
@@ -4,7 +4,7 @@ A compact link tile summarising a documented symbol — the default card rendere
|
|
|
4
4
|
|
|
5
5
|
**Things to know:**
|
|
6
6
|
|
|
7
|
-
- It leads with the symbol's signature(s) via `<DocumentationSignatures>` (the same calm code blocks as `<DocumentationPage>`). The signature already carries the name (and `readonly` for properties), so there is no separate title or kind tag — the card's
|
|
7
|
+
- It leads with the symbol's signature(s) via `<DocumentationSignatures>` (the same calm code blocks as `<DocumentationPage>`). The signature already carries the name (and `readonly` for properties), so there is no separate title or kind tag — the card's _colour_ carries the kind. Symbols with no signature (classes, interfaces, modules) fall back to a plain-name heading.
|
|
8
8
|
- Below the heading it renders the symbol's `<DocumentationButtons>` relations, then a prose lead-in. The `member of` relation is dropped — a member card almost always sits on its own class's page already.
|
|
9
9
|
- The card links to the element's stamped `path` (the canonical URL set by `flattenTree()` — see `<TreeProvider>`).
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ Used automatically via `<TreeCards>` (which `<DocumentationPage>` uses for its c
|
|
|
16
16
|
import { DocumentationCard } from "shelving/ui";
|
|
17
17
|
|
|
18
18
|
// `element` is a `tree-documentation` element from DirectoryExtractor (see /extract).
|
|
19
|
-
<DocumentationCard {...element.props}
|
|
19
|
+
<DocumentationCard {...element.props} />;
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
To replace this renderer across the whole site, wrap the app in `TreeCardMapping`.
|
|
@@ -15,14 +15,14 @@ Show a live preview of TSX and CSS in an `<iframe>` of the playground frame page
|
|
|
15
15
|
```tsx
|
|
16
16
|
import { DocumentationFrame } from "shelving/ui";
|
|
17
17
|
|
|
18
|
-
<DocumentationFrame code={`import { Button } from "shelving/ui";\n<Button>Hi</Button>`} css=":root { --radius-normal: 4px; }"
|
|
18
|
+
<DocumentationFrame code={`import { Button } from "shelving/ui";\n<Button>Hi</Button>`} css=":root { --radius-normal: 4px; }" />;
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## Styling
|
|
22
22
|
|
|
23
23
|
The frame has no border, radius, or margin. It fills the width of its parent, so the parent sets the look around it (see `<DocumentationLive>`). The space around the preview comes from padding inside the frame page.
|
|
24
24
|
|
|
25
|
-
| Variable
|
|
26
|
-
|
|
25
|
+
| Variable | Styles | Default |
|
|
26
|
+
| ---------------------------------- | ------------------------------------- | ------- |
|
|
27
27
|
| `--documentation-frame-background` | Fill behind the frame before it loads | `white` |
|
|
28
|
-
| `--documentation-frame-height`
|
|
28
|
+
| `--documentation-frame-height` | Minimum height (one length) | `4rem` |
|
|
@@ -42,16 +42,16 @@ function Counter() {
|
|
|
42
42
|
|
|
43
43
|
## Styling
|
|
44
44
|
|
|
45
|
-
| Variable
|
|
46
|
-
|
|
47
|
-
| `--documentation-live-bezel`
|
|
48
|
-
| `--documentation-live-body`
|
|
49
|
-
| `--documentation-live-detail` | Colour of the speaker slot and home button
|
|
50
|
-
| `--documentation-live-edge`
|
|
51
|
-
| `--documentation-live-gap`
|
|
52
|
-
| `--documentation-live-height` | Height of the screen (one length)
|
|
53
|
-
| `--documentation-live-radius` | Corner radius of the phone
|
|
54
|
-
| `--documentation-live-space`
|
|
55
|
-
| `--documentation-live-width`
|
|
45
|
+
| Variable | Styles | Default |
|
|
46
|
+
| ----------------------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------- |
|
|
47
|
+
| `--documentation-live-bezel` | Space above and below the speaker slot, which sets the thickness of the top and the chin (one length) | `2.25rem` |
|
|
48
|
+
| `--documentation-live-body` | Fill of the phone | `oklch(92% 0 0deg)` (light grey) |
|
|
49
|
+
| `--documentation-live-detail` | Colour of the speaker slot and home button | `oklch(80% 0 0deg)` |
|
|
50
|
+
| `--documentation-live-edge` | Width of the phone edge left and right of the screen (one length) | `0.75rem` |
|
|
51
|
+
| `--documentation-live-gap` | Space between the code and the phone (one length) | `var(--space-normal)` (16px) |
|
|
52
|
+
| `--documentation-live-height` | Height of the screen (one length) | `26rem` |
|
|
53
|
+
| `--documentation-live-radius` | Corner radius of the phone | `2.5rem` |
|
|
54
|
+
| `--documentation-live-space` | Outer block margin (top + bottom) | `var(--space-paragraph)` (16px) |
|
|
55
|
+
| `--documentation-live-width` | Width of the phone (one length) | `22rem` |
|
|
56
56
|
|
|
57
57
|
Global tokens: `--space-normal`, `--space-xsmall`, `--space-paragraph`, `--font-label`, `--size-small`. The code block is a raw `<pre>` with `--preformatted-space` set to `0`, so it takes the other `.prose pre` styles of `<Preformatted>`. The code and phone are side by side when the screen is 75rem or wider.
|
|
@@ -17,7 +17,7 @@ Used automatically by `<TreeApp>`. To render a single page manually, spread the
|
|
|
17
17
|
import { DocumentationPage } from "shelving/ui";
|
|
18
18
|
|
|
19
19
|
// `element` is a `tree-documentation` element from DirectoryExtractor (see /extract).
|
|
20
|
-
<DocumentationPage {...element.props}
|
|
20
|
+
<DocumentationPage {...element.props} />;
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
To replace this renderer across the whole site, wrap the app in `TreePageMapping`.
|
|
@@ -26,8 +26,8 @@ To replace this renderer across the whole site, wrap the app in `TreePageMapping
|
|
|
26
26
|
import { TreeApp, TreePageMapping } from "shelving/ui";
|
|
27
27
|
|
|
28
28
|
<TreePageMapping mapping={{ "tree-documentation": MyDocumentationPage }}>
|
|
29
|
-
|
|
30
|
-
</TreePageMapping
|
|
29
|
+
<TreeApp tree={tree} />
|
|
30
|
+
</TreePageMapping>;
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## Styling
|
package/ui/form/Field.md
CHANGED
|
@@ -16,8 +16,8 @@ The visual wrapper for a single form control. `Field` renders a `<label>` with a
|
|
|
16
16
|
import { Field, TextInput } from "shelving/ui";
|
|
17
17
|
|
|
18
18
|
<Field title="Email address" message={emailError}>
|
|
19
|
-
|
|
20
|
-
</Field
|
|
19
|
+
<TextInput name="email" value={email} onValue={setEmail} required />
|
|
20
|
+
</Field>;
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
### Two-up layout
|
|
@@ -37,17 +37,17 @@ import { Field, TextInput } from "shelving/ui";
|
|
|
37
37
|
|
|
38
38
|
`Field` paints its label, description, and message text. Override these hooks at `:root` or any ancestor scope.
|
|
39
39
|
|
|
40
|
-
| Variable
|
|
41
|
-
|
|
42
|
-
| `--field-space`
|
|
43
|
-
| `--field-gap`
|
|
44
|
-
| `--field-title-size`
|
|
45
|
-
| `--field-title-leading`
|
|
46
|
-
| `--field-title-weight`
|
|
47
|
-
| `--field-title-color`
|
|
48
|
-
| `--field-description-size`
|
|
49
|
-
| `--field-description-leading` | Description line height
|
|
50
|
-
| `--field-description-weight`
|
|
51
|
-
| `--field-description-color`
|
|
40
|
+
| Variable | Styles | Default |
|
|
41
|
+
| ----------------------------- | --------------------------------------- | ------------------------------- |
|
|
42
|
+
| `--field-space` | Outer block margin (top + bottom) | `var(--space-paragraph)` (16px) |
|
|
43
|
+
| `--field-gap` | Gap between label, control, and message | `var(--space-xsmall)` |
|
|
44
|
+
| `--field-title-size` | Title font size | `var(--size-normal)` |
|
|
45
|
+
| `--field-title-leading` | Title line height | `var(--leading)` |
|
|
46
|
+
| `--field-title-weight` | Title font weight | `var(--weight-strong)` |
|
|
47
|
+
| `--field-title-color` | Title colour | `var(--tint-00)` |
|
|
48
|
+
| `--field-description-size` | Description font size | `var(--size-normal)` |
|
|
49
|
+
| `--field-description-leading` | Description line height | `var(--leading)` |
|
|
50
|
+
| `--field-description-weight` | Description font weight | `var(--weight-normal)` |
|
|
51
|
+
| `--field-description-color` | Description colour | `var(--tint-70)` |
|
|
52
52
|
|
|
53
53
|
**Global tokens it reads:** the tint ladder `--tint-00` and `--tint-70`, plus `--space-paragraph`, `--space-xsmall`, `--size-normal`, `--weight-strong`, `--weight-normal`, and `--leading`.
|
package/ui/form/Form.md
CHANGED
|
@@ -21,21 +21,21 @@ import { Form } from "shelving/ui";
|
|
|
21
21
|
import { DATA, StringSchema, NumberSchema } from "shelving/schema";
|
|
22
22
|
|
|
23
23
|
const PRODUCT_SCHEMA = DATA({
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
name: new StringSchema({ title: "Name", min: 1, max: 100 }),
|
|
25
|
+
price: new NumberSchema({ title: "Price", min: 0 }),
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
export function NewProductForm() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
return (
|
|
30
|
+
<Form
|
|
31
|
+
schema={PRODUCT_SCHEMA}
|
|
32
|
+
submit="Create product"
|
|
33
|
+
onSubmit={async data => {
|
|
34
|
+
await createProduct(data);
|
|
35
|
+
return "Product created"; // dispatched as a success notice
|
|
36
|
+
}}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
39
|
}
|
|
40
40
|
```
|
|
41
41
|
|
|
@@ -46,23 +46,23 @@ import { Form } from "shelving/ui";
|
|
|
46
46
|
import { DATA, StringSchema, NumberSchema, BOOLEAN } from "shelving/schema";
|
|
47
47
|
|
|
48
48
|
const LISTING_SCHEMA = DATA({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
title: new StringSchema({ title: "Title", min: 1, max: 80 }),
|
|
50
|
+
price: new NumberSchema({ title: "Price", min: 0 }),
|
|
51
|
+
published: BOOLEAN,
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
export function ListingForm({ listing }: { listing?: typeof LISTING_SCHEMA.type }) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
return (
|
|
56
|
+
<Form
|
|
57
|
+
schema={LISTING_SCHEMA}
|
|
58
|
+
data={listing}
|
|
59
|
+
submit={listing ? "Save changes" : "Publish listing"}
|
|
60
|
+
onSubmit={async data => {
|
|
61
|
+
await saveListing(data);
|
|
62
|
+
return listing ? "Listing updated" : "Listing published";
|
|
63
|
+
}}
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
66
|
}
|
|
67
67
|
```
|
|
68
68
|
|
|
@@ -74,19 +74,21 @@ Provide explicit `children` when you need control over field order, groupings, o
|
|
|
74
74
|
import { Form, Field, FormInput, SubmitButton, Button, FormMessage } from "shelving/ui";
|
|
75
75
|
|
|
76
76
|
<Form schema={LISTING_SCHEMA} data={listing} onSubmit={handleSubmit}>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
77
|
+
<Field title="Title" required>
|
|
78
|
+
<FormInput name="title" />
|
|
79
|
+
</Field>
|
|
80
|
+
<Field title="Price">
|
|
81
|
+
<FormInput name="price" />
|
|
82
|
+
</Field>
|
|
83
|
+
<FormInput name="published" />
|
|
84
|
+
<footer>
|
|
85
|
+
<SubmitButton>Save changes</SubmitButton>
|
|
86
|
+
<Button plain onClick={onCancel}>
|
|
87
|
+
Cancel
|
|
88
|
+
</Button>
|
|
89
|
+
<FormMessage />
|
|
90
|
+
</footer>
|
|
91
|
+
</Form>;
|
|
90
92
|
```
|
|
91
93
|
|
|
92
94
|
## Notices and error surfacing
|
package/ui/form/FormStore.md
CHANGED
|
@@ -33,7 +33,11 @@ const data = store.validated; // Fully-typed data, or throws a string message.
|
|
|
33
33
|
import { requireForm } from "shelving/ui";
|
|
34
34
|
|
|
35
35
|
function ResetButton() {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const store = requireForm();
|
|
37
|
+
return (
|
|
38
|
+
<Button plain onClick={() => store.set("name", "")}>
|
|
39
|
+
Clear name
|
|
40
|
+
</Button>
|
|
41
|
+
);
|
|
38
42
|
}
|
|
39
43
|
```
|
package/ui/form/Progress.md
CHANGED
|
@@ -19,7 +19,7 @@ A continuous horizontal progress bar for the completion of a task. Rendered as a
|
|
|
19
19
|
import { Progress } from "shelving/ui";
|
|
20
20
|
|
|
21
21
|
// 75% full.
|
|
22
|
-
<Progress value={3} max={4}
|
|
22
|
+
<Progress value={3} max={4} />;
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### Custom range
|
|
@@ -28,7 +28,7 @@ import { Progress } from "shelving/ui";
|
|
|
28
28
|
import { Progress } from "shelving/ui";
|
|
29
29
|
|
|
30
30
|
// 50% full — value 15 within the 10–20 range.
|
|
31
|
-
<Progress value={15} min={10} max={20}
|
|
31
|
+
<Progress value={15} min={10} max={20} />;
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
### Status and colour
|
|
@@ -57,20 +57,20 @@ import { Progress } from "shelving/ui";
|
|
|
57
57
|
|
|
58
58
|
`Progress` paints a track (the element / `::-webkit-progress-bar`) and a fill (`::-webkit-progress-value` / `::-moz-progress-bar`) from the [tint ladder](/ui/TINT_CLASS). Apply `color=` / `status=` (on the bar or a tinted ancestor scope) to recolour the fill and track together — reach for a per-property hook only for a single surgical change. Override these hooks at `:root` (or any ancestor scope) to retheme.
|
|
59
59
|
|
|
60
|
-
| Variable
|
|
61
|
-
|
|
62
|
-
| `--progress-height`
|
|
63
|
-
| `--progress-radius`
|
|
64
|
-
| `--progress-background` | Track fill
|
|
65
|
-
| `--progress-color`
|
|
66
|
-
| `--progress-duration`
|
|
60
|
+
| Variable | Styles | Default |
|
|
61
|
+
| ----------------------- | -------------------------------- | ---------------- |
|
|
62
|
+
| `--progress-height` | Bar thickness | `0.375rem` (6px) |
|
|
63
|
+
| `--progress-radius` | Corner radius | `999px` (pill) |
|
|
64
|
+
| `--progress-background` | Track fill | `var(--tint-90)` |
|
|
65
|
+
| `--progress-color` | Fill colour | `var(--tint-50)` |
|
|
66
|
+
| `--progress-duration` | Indeterminate flow-loop duration | `1.5s` |
|
|
67
67
|
|
|
68
68
|
**Global tokens it reads** — move these to retheme broadly rather than overriding the hooks directly: the tint-ladder steps `--tint-50` (fill) and `--tint-90` (track), plus `--duration-fast` (the fill's grow transition). To recolour a bar, prefer `color=` / `status=` (or a tinted ancestor scope) over the per-component hooks.
|
|
69
69
|
|
|
70
70
|
```css
|
|
71
71
|
/* Theme: a chunkier, square-cornered bar. */
|
|
72
72
|
:root {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
--progress-height: 0.75rem;
|
|
74
|
+
--progress-radius: var(--radius-small);
|
|
75
75
|
}
|
|
76
76
|
```
|
package/ui/inline/Code.md
CHANGED
|
@@ -32,22 +32,22 @@ import { Code, Keyboard, Sample } from "shelving/ui";
|
|
|
32
32
|
```tsx live
|
|
33
33
|
import { Code } from "shelving/ui";
|
|
34
34
|
|
|
35
|
-
<Code plain>const x = 1;</Code
|
|
35
|
+
<Code plain>const x = 1;</Code>;
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
## Styling
|
|
39
39
|
|
|
40
40
|
`Code` paints from the [tint ladder](/ui/TINT_CLASS): the box `background` / `color` default to ladder steps so they re-tint with the surrounding scope, and every property has a per-instance override hook.
|
|
41
41
|
|
|
42
|
-
| Variable
|
|
43
|
-
|
|
44
|
-
| `--code-font`
|
|
45
|
-
| `--code-weight`
|
|
46
|
-
| `--code-size`
|
|
47
|
-
| `--code-leading`
|
|
48
|
-
| `--code-indent`
|
|
49
|
-
| `--code-radius`
|
|
50
|
-
| `--code-background` | Background fill (non-`plain`)
|
|
51
|
-
| `--code-color`
|
|
42
|
+
| Variable | Styles | Default |
|
|
43
|
+
| ------------------- | ------------------------------------------------ | ----------------------- |
|
|
44
|
+
| `--code-font` | Font family | `var(--font-code)` |
|
|
45
|
+
| `--code-weight` | Font weight | `var(--weight-code)` |
|
|
46
|
+
| `--code-size` | Font size | `var(--size-smaller)` |
|
|
47
|
+
| `--code-leading` | Line height | `var(--leading)` |
|
|
48
|
+
| `--code-indent` | Left and right padding (one length; non-`plain`) | `var(--space-xxsmall)` |
|
|
49
|
+
| `--code-radius` | Corner radius (non-`plain`) | `var(--radius-xxsmall)` |
|
|
50
|
+
| `--code-background` | Background fill (non-`plain`) | `var(--tint-90)` |
|
|
51
|
+
| `--code-color` | Text colour (non-`plain`) | `var(--tint-00)` |
|
|
52
52
|
|
|
53
53
|
**Global tokens it reads:** `--font-code`, `--weight-code`, `--size-smaller`, `--leading`, `--space-xxsmall`, `--radius-xxsmall`, and the tint-ladder steps `--tint-00` / `--tint-90` for the box fill and text.
|
package/ui/inline/Deleted.md
CHANGED
|
@@ -16,18 +16,18 @@ Deleted text — renders a `<del>` element to mark content that has been removed
|
|
|
16
16
|
import { Paragraph, Deleted, Inserted } from "shelving/ui";
|
|
17
17
|
|
|
18
18
|
<Paragraph>
|
|
19
|
-
|
|
20
|
-
</Paragraph
|
|
19
|
+
Was <Deleted>$50</Deleted> <Inserted>$35</Inserted>.
|
|
20
|
+
</Paragraph>;
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Styling
|
|
24
24
|
|
|
25
25
|
`Deleted` colours its text directly from `--color-red` (not the tint ladder), so deletions stay a consistent red regardless of the surrounding tint. Override `--deleted-color` to recolour.
|
|
26
26
|
|
|
27
|
-
| Variable
|
|
28
|
-
|
|
29
|
-
| `--deleted-color`
|
|
27
|
+
| Variable | Styles | Default |
|
|
28
|
+
| ---------------------- | --------------- | ----------------------------------- |
|
|
29
|
+
| `--deleted-color` | Text colour | `var(--color-red)` |
|
|
30
30
|
| `--deleted-decoration` | Text decoration | `line-through var(--stroke-normal)` |
|
|
31
|
-
| `--deleted-weight`
|
|
31
|
+
| `--deleted-weight` | Font weight | `var(--weight-strong)` |
|
|
32
32
|
|
|
33
33
|
**Global tokens it reads:** `--color-red`, `--stroke-normal`, and `--weight-strong`.
|
package/ui/inline/Emphasis.md
CHANGED
|
@@ -16,14 +16,14 @@ Emphasised text — renders an `<em>` element for stress emphasis, the kind that
|
|
|
16
16
|
import { Paragraph, Emphasis } from "shelving/ui";
|
|
17
17
|
|
|
18
18
|
<Paragraph>
|
|
19
|
-
|
|
20
|
-
</Paragraph
|
|
19
|
+
You were meant to turn <Emphasis>left</Emphasis>.
|
|
20
|
+
</Paragraph>;
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Styling
|
|
24
24
|
|
|
25
25
|
`Emphasis` only sets its font style and inherits everything else from its surroundings.
|
|
26
26
|
|
|
27
|
-
| Variable
|
|
28
|
-
|
|
27
|
+
| Variable | Styles | Default |
|
|
28
|
+
| ------------------ | ---------- | -------- |
|
|
29
29
|
| `--emphasis-style` | Font style | `italic` |
|
package/ui/inline/Inserted.md
CHANGED
|
@@ -16,18 +16,18 @@ Inserted text — renders an `<ins>` element to mark content that has been added
|
|
|
16
16
|
import { Paragraph, Deleted, Inserted } from "shelving/ui";
|
|
17
17
|
|
|
18
18
|
<Paragraph>
|
|
19
|
-
|
|
20
|
-
</Paragraph
|
|
19
|
+
Was <Deleted>$50</Deleted> <Inserted>$35</Inserted>.
|
|
20
|
+
</Paragraph>;
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Styling
|
|
24
24
|
|
|
25
25
|
`Inserted` colours its text directly from `--color-green` (not the tint ladder), so insertions stay a consistent green regardless of the surrounding tint. Override `--inserted-color` to recolour.
|
|
26
26
|
|
|
27
|
-
| Variable
|
|
28
|
-
|
|
29
|
-
| `--inserted-color`
|
|
27
|
+
| Variable | Styles | Default |
|
|
28
|
+
| ----------------------- | --------------- | -------------------------------- |
|
|
29
|
+
| `--inserted-color` | Text colour | `var(--color-green)` |
|
|
30
30
|
| `--inserted-decoration` | Text decoration | `underline var(--stroke-normal)` |
|
|
31
|
-
| `--inserted-weight`
|
|
31
|
+
| `--inserted-weight` | Font weight | `var(--weight-strong)` |
|
|
32
32
|
|
|
33
33
|
**Global tokens it reads:** `--color-green`, `--stroke-normal`, and `--weight-strong`.
|
package/ui/inline/Link.md
CHANGED
|
@@ -18,8 +18,8 @@ An inline link or action. Delegates to `<Clickable>`, rendering an `<a>` when `h
|
|
|
18
18
|
import { Paragraph, Link } from "shelving/ui";
|
|
19
19
|
|
|
20
20
|
<Paragraph>
|
|
21
|
-
|
|
22
|
-
</Paragraph
|
|
21
|
+
Read our <Link href="/privacy">privacy policy</Link> for details.
|
|
22
|
+
</Paragraph>;
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### Action button
|
|
@@ -27,7 +27,7 @@ import { Paragraph, Link } from "shelving/ui";
|
|
|
27
27
|
```tsx live
|
|
28
28
|
import { Link } from "shelving/ui";
|
|
29
29
|
|
|
30
|
-
<Link onClick={() => save()}>Save now</Link
|
|
30
|
+
<Link onClick={() => save()}>Save now</Link>;
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
### Plain link around a block
|
|
@@ -36,20 +36,20 @@ import { Link } from "shelving/ui";
|
|
|
36
36
|
import { Link, Row, Span } from "shelving/ui";
|
|
37
37
|
|
|
38
38
|
<Link plain href="/jane">
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</Link
|
|
39
|
+
<Row left>
|
|
40
|
+
<Span weight="strong">Jane Smith</Span>
|
|
41
|
+
<Span tint="60">@jane</Span>
|
|
42
|
+
</Row>
|
|
43
|
+
</Link>;
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
## Styling
|
|
47
47
|
|
|
48
48
|
`Link` colours itself from the global `--color-link` token by default. Inside a tinted scope (`color=` / `status=` on an ancestor) `--color-link` resolves to `inherit`, so links adopt the surrounding tinted text colour. Override `--link-color` to set it directly. A `plain` link ignores both hooks and inherits the colour and weight of its parent.
|
|
49
49
|
|
|
50
|
-
| Variable
|
|
51
|
-
|
|
52
|
-
| `--link-color`
|
|
50
|
+
| Variable | Styles | Default |
|
|
51
|
+
| --------------- | ----------- | ---------------------- |
|
|
52
|
+
| `--link-color` | Text colour | `var(--color-link)` |
|
|
53
53
|
| `--link-weight` | Font weight | `var(--weight-strong)` |
|
|
54
54
|
|
|
55
55
|
**Global tokens it reads:** `--color-link`, `--weight-strong`, and `--stroke-normal` (the underline thickness).
|