@apliteni/apliteni-ui 0.165.3 → 0.167.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.
@@ -328,6 +328,7 @@ page before anything is clicked. A panel adds nothing to the page's scrollable w
328
328
  `--ui-dropdown-edge` is the gap a panel keeps from the edge of the view. Set it to 0 for a panel
329
329
  flush with the edge, or wider for more room. A view that cannot afford the gap on both sides halves
330
330
  it. At 720px and below the gap is the page margin, 16px, so a panel lines up with the page's text.
331
+ Where a phone's safe area is wider than 16px, the gap is the safe area.
331
332
 
332
333
  **A panel has a floor and a ceiling.** The floor is the kit's 240px, which is what makes a list of
333
334
  rows readable. The ceiling is the view less that gap at each side. The floor wins where the two
@@ -1442,7 +1443,15 @@ asterisk. **A `dropdown()` inside `field()` is wired through its trigger button*
1442
1443
  dropdown's `id` sits on a wrapper that a label cannot name. The label and then the chosen value name
1443
1444
  the trigger, the error or hint describes it, and an error marks it invalid. The list is named by the
1444
1445
  label unless you give it an `ariaLabel`. A control outside a `field()` needs its own `ariaLabel`. A
1445
- placeholder is not a name. Put a form on a card, not on the page ground. A field is drawn by its edge, but the page ground
1446
+ placeholder is not a name. **In a field, a dropdown trigger has the shape of a text input.** It
1447
+ takes the input's corner, its top and bottom padding and its type size, so the two have the same
1448
+ height. Its side padding is 16px, 1px more than the input's. On a touch screen its text is a
1449
+ fixed 16px, as the input's is, also when the host changes `--text-base`. A long value stays on
1450
+ one line, starts at the left and ends with an ellipsis, as in a select, so the trigger keeps the
1451
+ input's height at every value length. A person mark stands as far from the left edge as from the
1452
+ top and bottom edges. A date picker in a field does the same. Outside a field, for example in a
1453
+ filter bar, a toolbar or the topbar, the trigger keeps the pill.
1454
+ Put a form on a card, not on the page ground. A field is drawn by its edge, but the page ground
1446
1455
  is too close to the field's own fill for you to see that edge. See
1447
1456
  [Colour and contrast](foundations.md#colour-and-contrast).
1448
1457
 
@@ -30,4 +30,5 @@ Each row names one guideline page, the screen parts it covers, and when to read
30
30
  | [Hover readouts](hover-readouts.md) | Hover values, their placement and touch access. | Read it before you show values on hover or tap. |
31
31
  | [Going back](going-back.md) | The back link, its destination and the parent address. | Read it when a page sits under another page. |
32
32
  | [Account and settings](account-and-settings.md) | The account window, the account menu and settings rows. | Read it before you build the account menu or settings. |
33
+ | [Notifications](notifications.md) | The bell, its unread count, read state and a failed load. | Read it before you build a bell or a notifications list. |
33
34
  | [Guidelines](overview.md) | No screen parts. The file holds only the collection heading. | Read it only for the heading. The six-card overview is in Storybook, not in the package. |
@@ -0,0 +1,43 @@
1
+ # Notifications
2
+
3
+ ## Keep missed events in the bell
4
+
5
+ <!-- rule: bell-toast-callout -->
6
+
7
+ **Rule:** Put an event that the reader can miss in the bell.
8
+
9
+ **Why:** A toast closes after 5 seconds.
10
+
11
+ **Except:** A toast for the reader's own action, such as Saved, stays out of the bell.
12
+
13
+ **Do:** Show “99+” above 99, and name the bell “Notifications, 120 unread”.
14
+
15
+ **Don't:** Report a failed run only in a toast.
16
+
17
+ ## Mark read on open
18
+
19
+ <!-- rule: read-state -->
20
+
21
+ **Rule:** Mark a notification read when the reader opens it, and let a toast undo Mark all read.
22
+
23
+ **Why:** One Undo restores the set, so a confirmation only adds a click.
24
+
25
+ **Do:** Show “3 notifications marked read” with Undo.
26
+
27
+ **Don't:** Ask “Mark all notifications read?” first.
28
+
29
+ **Gap #798:** The kit has no unread row weight, so only hidden text marks the row.
30
+
31
+ ## Show a failed load as an error
32
+
33
+ <!-- rule: failed-load -->
34
+
35
+ **Rule:** When a list or a panel fails to load, say so and offer Retry.
36
+
37
+ **Why:** “No notifications” after a failure tells the reader that nothing happened.
38
+
39
+ **Do:** Show “Notifications did not load” with Retry.
40
+
41
+ **Don't:** Show “No notifications” after a failed request.
42
+
43
+ **Gap #798:** The dropdown has no error part, so a panel uses the empty state.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apliteni/apliteni-ui",
3
- "version": "0.165.3",
3
+ "version": "0.167.0",
4
4
  "workspaces": [
5
5
  "react"
6
6
  ],
@@ -124,7 +124,7 @@
124
124
  --tap-clear-y: var(--tap-gap);
125
125
  }
126
126
  .ui-confirm__acts,
127
- .ui-toolbar,
127
+ .ui-toolbar:not(.ui-table *),
128
128
  .ui-empty__actions,
129
129
  .ui-sx__actions,
130
130
  .ui-fbc__foot,
@@ -1087,15 +1087,6 @@
1087
1087
  clip-path: inset(-100vmax var(--toast-card-clip, -100vmax) var(--toast-card-clip, -100vmax));
1088
1088
  transition: translate var(--dur-med) var(--ease), scale var(--dur-med) var(--ease);
1089
1089
  }
1090
- .ui-toast-stack--collapsed > .ui-toast > .ui-toast__icon,
1091
- .ui-toast-stack--collapsed > .ui-toast > .ui-toast__body,
1092
- .ui-toast-stack--collapsed > .ui-toast > .ui-toast__action {
1093
- margin-block: auto;
1094
- }
1095
- .ui-toast-stack--collapsed:hover > .ui-toast > *,
1096
- .ui-toast-stack--collapsed:focus-within > .ui-toast > * {
1097
- margin-block: 0;
1098
- }
1099
1090
  .ui-toast-stack--collapsed:hover,
1100
1091
  .ui-toast-stack--collapsed:focus-within {
1101
1092
  height: var(--toast-fan-height, auto);
@@ -1374,6 +1365,14 @@
1374
1365
  .ui-react-app__band-control > :first-child {
1375
1366
  min-width: 0;
1376
1367
  }
1368
+ .ui-react-app__band-control > * {
1369
+ position: relative;
1370
+ z-index: var(--z-base);
1371
+ }
1372
+ .ui-react-app__band-control > .ui-dropdown > .ui-dropdown__trigger::after {
1373
+ min-width: calc(100% + 2px);
1374
+ min-height: calc(100% + 2px);
1375
+ }
1377
1376
  .ui-react-app__band-control > .ui-btn,
1378
1377
  .ui-react-app__band-control > .ui-dropdown > .ui-dropdown__trigger {
1379
1378
  min-height: 40px;
@@ -2633,7 +2633,8 @@ function DatePicker({
2633
2633
  if (!got) return;
2634
2634
  el.style.setProperty("--ui-dropdown-ceiling", got.max > 0 ? `${got.max}px` : "");
2635
2635
  if (got.width > got.max) got = dropdownViewportFit(el) ?? got;
2636
- el.style.translate = got.shift ? `${got.shift}px` : "";
2636
+ el.style.marginLeft = got.shift ? `${got.shift}px` : "";
2637
+ el.style.marginRight = got.shift ? `${-got.shift}px` : "";
2637
2638
  };
2638
2639
  fit();
2639
2640
  const ro = typeof view.ResizeObserver === "function" ? new view.ResizeObserver(fit) : null;
@@ -3298,7 +3299,8 @@ function Dropdown({
3298
3299
  if (!got) return;
3299
3300
  el.style.setProperty("--ui-dropdown-ceiling", got.max > 0 ? `${got.max}px` : "");
3300
3301
  if (got.width > got.max) got = dropdownViewportFit2(el) ?? got;
3301
- el.style.translate = got.shift ? `${got.shift}px` : "";
3302
+ el.style.marginLeft = got.shift ? `${got.shift}px` : "";
3303
+ el.style.marginRight = got.shift ? `${-got.shift}px` : "";
3302
3304
  };
3303
3305
  fit();
3304
3306
  const view = root.current?.ownerDocument?.defaultView;
@@ -350,7 +350,8 @@ function ddPlaceLifted(dd, panel) {
350
350
  const other = configured ? below : above;
351
351
  const up = mine < Math.min(ddMin(panel), ddContentHeight(panel)) && other > mine ? !configured : configured;
352
352
  const s = panel.style;
353
- s.translate = '';
353
+ s.marginLeft = '';
354
+ s.marginRight = '';
354
355
  if (panel.getAttribute('data-dd-lifted') !== (up ? 'up' : 'down')) {
355
356
  const held = s.transition;
356
357
  s.transition = 'none';
@@ -624,8 +625,10 @@ export const DD_EXIT_SLACK_MS = 50;
624
625
  /** The shift a panel is already carrying, the one ddFitViewport() wrote. Taken
625
626
  * off before the next measurement, so asking twice answers the same as asking
626
627
  * once — the fit is measured from where the sheet puts the panel, not from where
627
- * the last fit left it. */
628
- const ddShiftOf = (panel) => parseFloat(panel.style?.translate) || 0;
628
+ * the last fit left it. The shift is side margins, not a translate: Chromium 158
629
+ * kept the page as wide as a translated panel's old place after a transition
630
+ * ended (#812). The far margin gives the room back, so the panel keeps its width. */
631
+ const ddShiftOf = (panel) => parseFloat(panel.style?.marginLeft) || 0;
629
632
 
630
633
  /** The widest a panel may be: the view it is laid out in, less the keep-out it owes
631
634
  * each edge. It is the bound a PORTALLED panel needs, whose room is the whole view
@@ -36,7 +36,7 @@
36
36
  .ui-toast {
37
37
  position: relative;
38
38
  display: flex;
39
- align-items: center;
39
+ align-items: flex-start; /* every part centres on the first line: a glyph or a button never drifts to the middle of a wrapped text */
40
40
  gap: 12px;
41
41
  padding: var(--space-3);
42
42
  border-radius: var(--radius-sm);
@@ -58,28 +58,28 @@
58
58
  .ui-toast--info { --toast-accent: var(--cyan); --toast-action-ink: var(--chip-info-ink); --toast-glow: var(--glow-cyan); --toast-on: var(--signal-contrast); --toast-solid: var(--signal-solid-info); }
59
59
  .ui-toast--neutral { --toast-accent: var(--muted); --toast-action-ink: var(--text); --toast-glow: var(--surface); --toast-on: var(--signal-solid-ink); --toast-solid: var(--signal-solid-neutral); }
60
60
 
61
- .ui-toast__icon { width: 22px; height: 22px; flex: none; display: grid; place-items: center; background: transparent; color: var(--toast-action-ink); }
61
+ .ui-toast__icon { width: 22px; height: 1lh; flex: none; display: grid; place-items: center; background: transparent; color: var(--toast-action-ink); }
62
62
  .ui-toast__icon svg { width: var(--space-4); height: var(--space-4); stroke: currentColor; fill: none; stroke-width: 2.25; } /* 16px × 2.25 / 24 = 1.5 CSS px. */
63
63
  .ui-toast__body { flex: 1; min-width: 0; }
64
64
  .ui-toast__title { font-weight: var(--weight-medium); color: var(--strong); }
65
65
  .ui-toast__text { color: var(--text); }
66
66
 
67
67
  /* Tone ink keeps actions readable on the neutral surface. */
68
- .ui-toast__action { flex: none; align-self: center; background: none; border: 0; padding: 4px 9px; border-radius: var(--radius-xs); font: inherit; font-weight: var(--weight-medium); color: var(--toast-action-ink); cursor: pointer; }
68
+ .ui-toast__action { flex: none; margin-block: -4px; /* the fill overhangs the first line by its own padding */ background: none; border: 0; padding: 4px 9px; border-radius: var(--radius-xs); font: inherit; font-weight: var(--weight-medium); color: var(--toast-action-ink); cursor: pointer; }
69
69
  .ui-toast__action:hover { background: color-mix(in srgb, var(--bg) 55%, transparent); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */ }
70
70
  .ui-toast__action:focus-visible { outline: var(--ring); outline-offset: var(--ring-offset); }
71
71
 
72
- .ui-toast__close { flex: none; align-self: flex-start; background: none; border: 0; /* muted-ink: glyph — dismiss icon */ color: var(--muted); cursor: pointer; padding: 2px; display: grid; place-items: center; position: relative; font: inherit; }
72
+ .ui-toast__close { flex: none; align-self: flex-start; background: none; border: 0; /* muted-ink: glyph — dismiss icon */ color: var(--muted); cursor: pointer; height: 1lh; padding: 0 2px; display: grid; place-items: center; position: relative; font: inherit; }
73
73
  .ui-toast__close svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.5; }
74
74
  /* The target, not the ink. WCAG 2.5.8 measures what a pointer can land on, and
75
- the drawn button is 19x19 — a 15px glyph in 2px of padding. Growing the box
76
- to 24 would push the glyph 2.5px off the corner it is aligned to, so the
75
+ the drawn button is 19px wide and one line tall, a 15px glyph centred on the
76
+ first line. Growing the box to 24 would push the glyph off that line, so the
77
77
  TARGET grows instead and the glyph does not move at all.
78
78
  Centred, so the overhang is 2.5px on every side. It has 12px of flex gap to
79
79
  .ui-toast__action beside it and 12px between stacked toasts, so it reaches no
80
80
  neighbouring target; .ui-toast's overflow: hidden clips at 12px of padding,
81
81
  well outside it. Measured, not asserted:
82
- stories/guidelines/accessibility-floor.test.js reads this rule out of the
82
+ stories/tap-zone.test.js reads this rule out of the
83
83
  sheet and reports the target it makes. #219 */
84
84
  .ui-toast__close::before {
85
85
  content: '';
@@ -216,10 +216,13 @@
216
216
  at the room the viewport left either way. #489 */
217
217
  .ui-dropdown__panel.is-scroll { --ui-dropdown-cap: var(--ui-dropdown-max); }
218
218
 
219
- /* On a phone, the panel keeps the page's 16px margin at the shell fold.
219
+ /* On a phone, the panel keeps the page's 16px margin at the shell fold, or the wider
220
+ safe-area inset, the gap the phone account window keeps. Registered as a length so
221
+ the wiring reads one number, not the max() expression. #808
220
222
  why: docs/components.md#the-dropdown-panel */
223
+ @property --ui-dropdown-edge { syntax: "<length>"; inherits: true; initial-value: 8px; }
221
224
  @media (max-width: 720px) {
222
- .ui-dropdown__panel { --ui-dropdown-edge: var(--space-4); }
225
+ .ui-dropdown__panel { --ui-dropdown-edge: max(var(--space-4), env(safe-area-inset-left), env(safe-area-inset-right)); }
223
226
  }
224
227
 
225
228
  /* The wiring adds this where the room is below the floor: even spending the whole
@@ -378,7 +381,8 @@
378
381
  /* rank: chip */
379
382
  font-size: var(--text-xs);
380
383
  font-weight: var(--weight-semibold);
381
- padding: 3px 9px;
384
+ --ui-dropdown-badge-pad: 3px;
385
+ padding: var(--ui-dropdown-badge-pad) 9px;
382
386
  border-radius: var(--radius-pill);
383
387
  margin-left: auto;
384
388
  flex: none;
@@ -390,6 +394,17 @@
390
394
  }
391
395
  .ui-dropdown__badge.is-live { color: var(--chip-success-ink); background: var(--chip-success-fill); /* code-bg: inherit — decorative or text-only surface has no nested chip. */ }
392
396
 
397
+ /* A row with a description is two lines tall. Its glyph, its trailing parts and its
398
+ tick centre on the label line, not on the middle of the two lines. The badge
399
+ subtracts its own line and its block padding (#798). */
400
+ .ui-dropdown__item:has(> .ui-dropdown__main > .ui-dropdown__desc) {
401
+ --ui-dropdown-line: calc((var(--text-sm) - 0.5px) * var(--leading-normal));
402
+ align-items: flex-start;
403
+ }
404
+ .ui-dropdown__item:has(> .ui-dropdown__main > .ui-dropdown__desc) > :is(.ui-dropdown__ic, .ui-dropdown__tick, .ui-dropdown__more) { height: var(--ui-dropdown-line); align-items: center; }
405
+ .ui-dropdown__item:has(> .ui-dropdown__main > .ui-dropdown__desc) > .ui-dropdown__aside { line-height: var(--ui-dropdown-line); }
406
+ .ui-dropdown__item:has(> .ui-dropdown__main > .ui-dropdown__desc) > .ui-dropdown__badge { margin-top: calc((var(--ui-dropdown-line) - var(--text-xs) * var(--leading-normal)) / 2 - var(--ui-dropdown-badge-pad)); }
407
+
393
408
  /* Disabled + danger rows */
394
409
  .ui-dropdown__item.is-disabled { /* muted-ink: state — unavailable control */ color: var(--disabled-ink); cursor: not-allowed; pointer-events: none; }
395
410
  .ui-dropdown__item.is-disabled .ui-dropdown__label,
@@ -531,3 +546,36 @@
531
546
  .ui-field > .ui-dropdown { display: grid; }
532
547
  .ui-field > .ui-dropdown > .ui-dropdown__trigger > .ui-dropdown__chevron { margin-left: auto; }
533
548
  .ui-field > .ui-dropdown > .ui-dropdown__panel { inline-size: 100%; min-width: 0; }
549
+ /* In a form the trigger takes the text input's corner, block padding and type, so the
550
+ two stand at one height. Elsewhere it keeps the pill. #812
551
+ why: docs/components.md#forms */
552
+ @property --ui-dropdown-line { syntax: "<length>"; inherits: true; initial-value: 0px; }
553
+ .ui-field > .ui-dropdown > .ui-dropdown__trigger {
554
+ border-radius: var(--radius-md);
555
+ padding: var(--space-3) var(--space-4);
556
+ font-size: var(--text-base);
557
+ min-inline-size: 0;
558
+ /* The value line, as a length the mark below can read. */
559
+ --ui-dropdown-line: 1lh;
560
+ }
561
+ /* A long value keeps one line from the left and ends in an ellipsis, as the select
562
+ does, so the trigger keeps the input's height at every length. */
563
+ .ui-field > .ui-dropdown > .ui-dropdown__trigger > .ui-dropdown__value,
564
+ .ui-field > .ui-dropdown > .ui-dropdown__trigger > .ui-dropdown__text {
565
+ min-inline-size: 0;
566
+ overflow: hidden;
567
+ white-space: nowrap;
568
+ text-overflow: ellipsis;
569
+ text-align: start;
570
+ }
571
+ /* The mark stands as far from the left edge as from the top and bottom edges. */
572
+ .ui-field > .ui-dropdown > .ui-dropdown__trigger > .ui-avatar {
573
+ --ui-avatar-pull-start: calc(var(--space-4) - var(--space-3) - (var(--ui-dropdown-line) - var(--ui-avatar-size)) / 2);
574
+ }
575
+ /* The input beside it is 16px on a touch screen, so the trigger follows it. A flat
576
+ 16px like the zoom net, so a host's --text-base does not move it off the input.
577
+ Not the net's job: the trigger takes no typing.
578
+ why: docs/foundations.md#a-field-is-16px-on-a-touch-screen */
579
+ @media (pointer: coarse) {
580
+ .ui-field > .ui-dropdown > .ui-dropdown__trigger { font-size: 16px; }
581
+ }
@@ -195,9 +195,10 @@
195
195
  at 390 is often already full, so widening its column gap does not move the
196
196
  buttons apart — it makes them narrower, and that is the half #488 rules
197
197
  out. Measured on a toolbar of three buttons and a dropdown. These rows
198
- wrap, which is also where the review measured them colliding. */
198
+ wrap, which is also where the review measured them colliding. Not a toolbar in a
199
+ table cell: the row would grow, and a table's rows keep their height. #812 */
199
200
  .ui-confirm__acts,
200
- .ui-toolbar,
201
+ .ui-toolbar:not(.ui-table *),
201
202
  .ui-empty__actions,
202
203
  .ui-sx__actions,
203
204
  .ui-fbc__foot,