@synopackageland/ui 0.14.9 → 0.14.10

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.
@@ -55,6 +55,9 @@ are in [dsm-native-metrics.md](dsm-native-metrics.md).
55
55
  and `Wizard` footers, `FormActions`, `AppActionBar`, `Footbar`, a `Panel`
56
56
  `#fbar` or a `Notification` it is a capsule, everywhere else a tool button.
57
57
  Set `kind="tool"` on one footer button to keep it a tool button (Help, say).
58
+ - A Button in a `Callout`'s `#actions` and a toast's action are drawn as
59
+ capsules by the Callout and the Toast themselves ([callout](callout.md)).
60
+ They stay `kind="tool"` buttons, so they do not count as a footer's action.
58
61
  - In development, a Button warns in the console when `kind="action"` is set
59
62
  outside a footer, when a footer has two main actions, or when the main action
60
63
  is not last. Production builds do not check.
@@ -0,0 +1,123 @@
1
+ # Callout, Toast and inline notes
2
+
3
+ A page says three kinds of things outside its content: a result that just
4
+ happened, something the user has to act on, and a risk to keep in mind. Each
5
+ has its own component, and none of them is a full-width banner.
6
+
7
+ | The message | Use | Shape |
8
+ | --- | --- | --- |
9
+ | A passing result: "Settings applied", "The check passed", "Copied" | `useToast()` | A toast that fades after 4.5 s. Do not leave a Callout behind for it. |
10
+ | Something the user has to act on: a missing setting, a failed connection, a sign-in that waits | `<Callout>` | One-line title, at most one line of text, one action. |
11
+ | A risk or a limit of a feature | `<Callout variant="inline">` | One short sentence; longer text in `#details` behind "Learn more", or a link. |
12
+ | A failure the user has to know about now, outside the page | `Notification` / `MessageBox` | See their docs. |
13
+
14
+ ## The look
15
+
16
+ A Callout and a Toast share one look: a raised surface in the page's neutral
17
+ colour (`--ui-surface-raised`), with no frame and no tinted fill. A 1px ring
18
+ at 6% of the text colour and a soft shadow lift it off the page. The tone
19
+ appears in three small places only:
20
+
21
+ - a 1.5px light along the top edge, in the tone, fading out halfway across;
22
+ - a faint glow of the tone (9%; 14% in the workbench dark theme) in the
23
+ corner behind the icon;
24
+ - the 18px icon.
25
+
26
+ The title reads in the text colour at 600, and the message under it in the
27
+ secondary text colour. Corners are 12px (`--ui-callout-radius`), rounder than
28
+ a card on purpose: a Callout floats above the settings rather than being one
29
+ of them. Buttons in `#actions` and a toast's action are capsules. A Callout
30
+ fades in and rises 6px when it appears, and a toast slides in; with reduced
31
+ motion both appear at once.
32
+
33
+ A Callout grows to 720px (`--ui-callout-max-width`) and stops there, so a
34
+ wide page does not stretch it into a strip. `fill` makes it span the
35
+ container. Actions sit at the end of the message while the width allows; on
36
+ a narrow panel they move under the text.
37
+
38
+ Contrast was measured on the surface, light and dark, in every tone: text at
39
+ least 5.4:1, icons at least 3.3:1.
40
+
41
+ `variant="inline"` keeps the icon and the tones and drops the surface: an
42
+ icon and one line of secondary text, with a link or a small button after it.
43
+ Use it for a note under a field or a section heading, where a panel would
44
+ weigh more than the note.
45
+
46
+ ### Why this one
47
+
48
+ Three directions were drawn as working prototypes, each in every tone, with
49
+ and without an action, light and dark, and on a settings page:
50
+
51
+ 1. **Card with an icon chip** (in the manner of Stripe and Linear): a white
52
+ card with a hairline frame. The tone sits only in a rounded icon chip, and
53
+ the action is a text button. Calm, but close to the cards around it.
54
+ 2. **Status line** (in the manner of Apple's settings and Vercel): no
55
+ container. A filled round chip, the title and the message on one line, and
56
+ an "Action →" link. The lightest, but too quiet for something that blocks
57
+ the user.
58
+ 3. **Glow surface**: the look above. It was chosen because it keeps the page
59
+ neutral, still shows the tone at a glance, and reads as modern without a
60
+ coloured box.
61
+
62
+ Two earlier looks were rejected:
63
+
64
+ - **0.14.9 and before**: full width, a 3px bar on the leading edge, a tinted
65
+ strip, and buttons stacked under the text. It read as a dated admin-tool
66
+ warning box.
67
+ - **A first redesign**: a tinted fill with a thin tinted frame. It was still
68
+ a coloured box.
69
+
70
+ ## Writing one
71
+
72
+ - **No closing period.** Callout text (title, message, details, action
73
+ labels) does not end in a period; a period between two sentences stays.
74
+ - **Title**: what is wrong or missing, in a few words: "DSM external access
75
+ address is not set".
76
+ - **Message**: one line on why it matters or what happens next: "Share links
77
+ keep using the old address". Do not explain the steps; the action does them.
78
+ - **Action**: one button (`Button size="sm"`, drawn as a capsule), or a `Link` when it leaves the
79
+ app. Two only when the second is "Later" and the Callout cannot be closed.
80
+ The button label names what it does: "Apply nas.example.com", not "OK".
81
+ - **Risk notes**: one sentence. Put the explanation in `#details`:
82
+
83
+ ```vue
84
+ <Callout tone="warning" variant="inline">
85
+ Without an access policy, anyone who knows the name reaches the service
86
+ <template #actions><Link :href="accessDocs" external>Set up access</Link></template>
87
+ </Callout>
88
+
89
+ <Callout tone="warning" title="No access policy">
90
+ Anyone who knows the name reaches the service
91
+ <template #details>Add an access policy that allows only your accounts…</template>
92
+ </Callout>
93
+ ```
94
+
95
+ - A result the user caused, and that needs nothing more, is a toast:
96
+
97
+ ```ts
98
+ const toast = useToast()
99
+ toast.success('Settings applied', 'Added port 6690')
100
+ ```
101
+
102
+ - Put a machine error code in `code`, not in the text.
103
+ - Stack at most two Callouts in one section. More means the page should show
104
+ the state in its content (a `Badge`, a `KeyValueRow`) instead.
105
+
106
+ ## API
107
+
108
+ | Prop / slot | Use |
109
+ | --- | --- |
110
+ | `tone` | `info` (default), `success`, `warning`, `danger` |
111
+ | `variant` | `soft` (default) or `inline` |
112
+ | `title` | One line, the thing to know |
113
+ | default slot | The message |
114
+ | `#actions` | One action, at the end of the message |
115
+ | `#details` + `v-model:expanded` | Longer text behind a "Learn more" toggle (`moreLabel`, `lessLabel`) |
116
+ | `code` | A machine error code, shown quieter after the message |
117
+ | `closable`, `closeLabel`, `@close` | A close button for a message the user may dismiss |
118
+ | `fill` | Span the container instead of stopping at 720px |
119
+
120
+ Theme hooks (`data-tone`, `data-variant`, `data-fill`, the `data-ui-callout-*`
121
+ parts) and tokens (`--ui-callout-max-width`, `--ui-callout-radius`,
122
+ `--ui-callout-glow`, `--ui-callout-shadow`, which Toast shares) are listed in
123
+ [theme hooks](theme-hooks.md).
@@ -60,7 +60,7 @@ at 7:1 or more (`tests/css/palette.test.ts`).
60
60
  | `--ui-{tone}-soft` | `a3` of each tone (`gray-a3` for neutral) | badge fill |
61
61
  | `--ui-{tone}-text` | step 11 of each tone (`gray-11` for neutral) | badge text |
62
62
  | `--ui-danger-hover`, `--ui-danger-active` | `red-10`, `red-11` | red button hovered, pressed |
63
- | `--ui-warning-accent` | `orange-10` | a Callout's bar and icon |
63
+ | `--ui-warning-accent` | `orange-10` | a warning Callout's or Toast's top light, glow and icon |
64
64
 
65
65
  Tones stay DSM's whatever the accent: an info badge is blue in every app.
66
66
 
@@ -75,8 +75,8 @@ The scales follow DSM where the two disagree:
75
75
  as light as a button fill.
76
76
  - **A pressed button is step 6.** DSM fills it at 70% of `#c6d4e0`, the colour
77
77
  of a field's frame.
78
- - **Orange step 10 is darker than DSM's hover orange,** so a Callout's bar and
79
- icon keep 3:1 on its 5% tint.
78
+ - **Orange step 10 is darker than DSM's hover orange,** so a warning Callout's
79
+ icon keeps 3:1 on its tint.
80
80
 
81
81
  ## Accent
82
82
 
@@ -68,6 +68,7 @@ These rules keep pages built from `@synopackageland/ui` consistent. The componen
68
68
  - Show a headline number (space freed, files moved) with `Statistic`: `label`, `value`, optional `note`; `size="lg"` for the one number a page leads with. Put several in `Surface`s in a grid. Do not set font sizes for figures.
69
69
  - Colour a usage bar by meaning with `Progress tone` (`warning` when nearly full) rather than drawing your own bar.
70
70
  - Show a state as a `Badge` in a `KeyValueRow`, not as a sentence. A toned badge leads with a dot; keep `neutral` for plain values such as a version.
71
+ - A passing result ("Settings applied") is a toast; a Callout is for something the user has to act on or a short risk note, with one title, one line and one action ([callout](callout.md)).
71
72
  - Put a machine error code in `Callout`'s `code` prop, not in the message text: `<Callout tone="warning" :code="status.code">{{ message }}</Callout>`.
72
73
  - Do not show internal identifiers, such as job ids or catalog keys. Show the name the user gave.
73
74
  - In Chinese and Japanese, a label and its value are separated by a full-width colon `:`.
@@ -89,6 +89,11 @@ here stay implementation details and can change in any release.
89
89
  | `data-ui-dialog`, `data-ui-sheet` | `Dialog` / `Sheet` panels | present |
90
90
  | `data-ui-list-item-title`, `-description`, `-meta`, `-actions` | `ListItem` parts | present |
91
91
  | `data-ui-statistic-label`, `-value`, `-note` | `Statistic` parts | present |
92
+ | `data-tone` | `Callout` | `info`, `success`, `warning`, `danger` |
93
+ | `data-variant` | `Callout` | `soft`, `inline` |
94
+ | `data-fill` | `Callout` | present when it spans its container |
95
+ | `data-tone` | each `Toast` (class `ui-toast`) | `info`, `success`, `warning`, `danger` |
96
+ | `data-ui-callout-title`, `-body`, `-code`, `-more`, `-details`, `-actions` | `Callout` parts | present |
92
97
 
93
98
  Select a `Button` variant with its tag so a `Surface`'s `data-variant` is not
94
99
  caught as well: `button[data-variant='primary']`.
@@ -110,6 +115,10 @@ before the token existed. Set them on the app root or any ancestor.
110
115
  | `--ui-mobile-bar-bg` | the phone bar's background | `var(--ui-surface)` |
111
116
  | `--ui-mobile-bar-fg` | the phone bar's text, menu button and brand | `var(--ui-text-secondary)` (text), `var(--ui-text)` (button, brand) |
112
117
  | `--ui-mobile-bar-border` | the phone bar's bottom rule | `var(--ui-border-subtle)` |
118
+ | `--ui-callout-max-width` | how wide a `Callout` grows before it stops (`fill` ignores it) | 720px |
119
+ | `--ui-callout-radius` | a `Callout`'s and a `Toast`'s corners | 12px |
120
+ | `--ui-callout-glow` | how strong the tone's glow is behind a `Callout`'s or `Toast`'s icon; a dark theme raises it (workbench: 14%) | 9% |
121
+ | `--ui-callout-shadow` | the shadow under a `Callout` and a `Toast` (workbench dark: `0 10px 28px -12px rgba(0, 0, 0, 0.6)`) | `0 8px 24px -12px rgba(15, 23, 42, 0.18)` |
113
122
 
114
123
  The colour, radius, spacing and web tokens are listed in the
115
124
  [README](../README.md#theme-override), [colour system](color-system.md) and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/ui",
3
- "version": "0.14.9",
3
+ "version": "0.14.10",
4
4
  "description": "Shared Vue 3 UI component library with a DSM 7 inspired application theme",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -16,6 +16,7 @@
16
16
  "docs/adaptive-layout.md",
17
17
  "docs/app-local-modal.md",
18
18
  "docs/button-policy.md",
19
+ "docs/callout.md",
19
20
  "docs/color-system.md",
20
21
  "docs/component-defaults-0.5.7.md",
21
22
  "docs/json-ui.md",