@apliteni/apliteni-ui 0.184.0 → 0.186.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.
@@ -179,6 +179,19 @@ holds each line of text that the button shows, and the menu takes the same name.
179
179
  reload. If your `palette` sets its own `onNavigate`, the shell uses that one.
180
180
  - `bandControl` stands under the sidebar head. `headControl` is one glyph control in the sidebar
181
181
  head, before the fold button.
182
+ - `bandActions` puts glyph controls, such as a notification bell, at the right end of the band,
183
+ in each sidebar structure and at every width. With a sidebar, they stand before the menu
184
+ button, and search keeps the centre of the band while it has room. Where the band is short of
185
+ room, search moves off the centre and shrinks, and never goes under an action. With no
186
+ sidebar, they stand before the theme switch. Put one or two there, and give each one a hover
187
+ title. Each action there is a 40px square with a 17px glyph, a `Button` and a dropdown trigger
188
+ alike, and the glyph stays in the centre of its square with or without a count. A count in a
189
+ dropdown trigger is a red pill on the trigger's top end corner, with a 2px ring in the band's
190
+ colour that cuts it from the glyph. The focus ring passes under it, so no ring line crosses the
191
+ digits. A long count, such as 99+, grows over the glyph and stays clear of the next control.
192
+ Give the trigger a name that holds the count it shows, such as "Notifications, 99+ unread".
193
+ Below 560px,
194
+ each action is a 40px glyph with no border and keeps a 44 by 44px tap zone.
182
195
 
183
196
  **Routing.** `renderLink` lets your router draw each section and sub-item link.
184
197
 
@@ -189,7 +202,7 @@ holds each line of text that the button shows, and the menu takes the same name.
189
202
  name and its count for keyboard and pointer users. A folded rail takes clicks only on the glyph
190
203
  column, so a click beside it reaches the page.
191
204
  - At 720px and below, the sidebar goes away and a 52px band shows. In the topbar layout, the band
192
- holds the brand mark, the page title on one line, the search trigger and a menu button. In the
205
+ holds the brand mark, the page title on one line, the search trigger, the band actions and a menu button. In the
193
206
  rail layout, it holds only the menu button and the mark. The menu button opens the full section
194
207
  list in a drawer. The drawer opens from the side of the menu button: the right in the topbar
195
208
  layout and the left in the rail layout. `drawerSide` chooses the side in either layout. The
@@ -395,8 +408,8 @@ dropdown must have a search field: [Component choice](../guidelines/component-ch
395
408
  ```
396
409
 
397
410
  `items` is a list of rows. A row has `label`, and can have `value`, `description`, `icon`,
398
- `avatar`, `badge`, `selected` and `disabled`. `'---'` is a separator. `sections` groups rows under
399
- captions. `header` and `footer` add content above and below the rows. `onSelect` gets the value
411
+ `avatar`, `badge`, `muted`, `selected` and `disabled`. `'---'` is a separator. `sections` groups
412
+ rows under captions, with space before each next group. `header` and `footer` add content above and below the rows. `onSelect` gets the value
400
413
  and the row. `open`, `defaultOpen` and `onOpenChange` control the panel. `disabled` turns the
401
414
  trigger off: no keyboard stop, no panel and the disabled paint.
402
415
 
@@ -424,9 +437,18 @@ trigger off: no keyboard stop, no panel and the disabled paint.
424
437
  the field while the user is still scrolled into the room that the panel needed.
425
438
  - The panel follows its trigger when the page moves the trigger: a new layout, a sideways scroll
426
439
  or a transition.
440
+ - A row names its item in the body weight, as a native list does. A group caption is a compact
441
+ label in body ink.
427
442
  - Each row answers the pointer with a fill and draws no edge. A destructive row turns `--pink` on
428
443
  hover and focus. In forced colours a separator stays a visible line.
429
444
 
445
+ **Muted or disabled.** Use `muted` for a row that the user can still pick but that is no
446
+ longer current, such as an archived unit for a late invoice. Give it the state word:
447
+ `muted: 'Archived'`. The row keeps its name in body ink and shows the word in a state badge after
448
+ it. The row stays in the keyboard order. After a pick, the trigger shows `Cedar Studio (Archived)`.
449
+ Use `disabled` for a row that the user cannot pick now. A disabled row is faded, and the arrow
450
+ keys skip it.
451
+
430
452
  **Search.** `search` adds a text field above the rows. Typing filters the rows, and the focus stays
431
453
  in the field. The match is anywhere in the label, without case or accents. Descriptions are not
432
454
  searched, so put the words that a user types in the label. `search={{ count, noun }}` names the
@@ -507,6 +529,11 @@ label and the value as its name, and the error gives it the invalid edge. In a f
507
529
  trigger has the height of a text input and keeps the pill corner. A long value stays on one line
508
530
  and ends with an ellipsis.
509
531
 
532
+ **A list of options in `SelectField`.** The browser draws the open list, so the kit does not
533
+ style an `<option>`. For an option that the user can still pick but that is no longer current,
534
+ write the state word in its text: `<option>Cedar Studio (Archived)</option>`. Do not disable it.
535
+ Name a group with `<optgroup label="Studios">`, not with a disabled option.
536
+
510
537
  **Keyboard and screen reader.** The component makes the ids and points the label, the hint and the
511
538
  error at the control. The error has `role="alert"`, so a new error is announced and the focus does
512
539
  not move.
@@ -89,3 +89,17 @@
89
89
  **Do:** Use the eyebrow for the period and the title for what is shown.
90
90
 
91
91
  **Don't:** Use a label-sized eyebrow as the only title.
92
+
93
+ ## Keep category labels compact
94
+
95
+ <!-- rule: category-compact -->
96
+
97
+ **Rule:** Give each category a compact, nonselectable label in body ink, with space before the next category.
98
+
99
+ **Why:** A compact label leaves the items prominent in a short list.
100
+
101
+ **Do:** Write “Studios” above the studio names.
102
+
103
+ **Don't:** Add “Studios” as a disabled item.
104
+
105
+ **Except:** A native picker keeps the spacing and label style supplied by the browser.
@@ -10,7 +10,7 @@
10
10
 
11
11
  **Except:** A toast for the reader's own action, such as Saved, stays out of the bell.
12
12
 
13
- **Do:** Show “99+” above 99, and name the bell “Notifications, 120 unread”.
13
+ **Do:** Show “99+” above 99, and name it “Notifications, 99+ unread”.
14
14
 
15
15
  **Don't:** Report a failed run only in a toast.
16
16
 
@@ -24,6 +24,18 @@
24
24
 
25
25
  **Don't:** Put Payouts and its sub-items under a Money label.
26
26
 
27
+ ## Keep the bar’s end for product alerts
28
+
29
+ <!-- rule: bar-end -->
30
+
31
+ **Rule:** Put only glyph controls that serve every page, such as the notification bell, at the right end of the bar.
32
+
33
+ **Why:** The reader looks for the bell in the same place on every page, and a phone bar has room for two glyphs at most.
34
+
35
+ **Do:** Put the bell at the bar’s end, after search.
36
+
37
+ **Don't:** Put a page’s own button, such as New report, in the bar.
38
+
27
39
  ## Choose content width
28
40
 
29
41
  <!-- rule: width -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apliteni/apliteni-ui",
3
- "version": "0.184.0",
3
+ "version": "0.186.0",
4
4
  "workspaces": [
5
5
  "react"
6
6
  ],
@@ -1366,6 +1366,20 @@
1366
1366
  display: none;
1367
1367
  }
1368
1368
  }
1369
+ @media (min-width: 561px) {
1370
+ .ui-react-app .ui-app__bar:not(:has(> .ui-app__menu)) .ui-app__bar-gap {
1371
+ display: none;
1372
+ }
1373
+ .ui-react-app .ui-app__bar:not(:has(> .ui-app__menu)) .ui-app__search {
1374
+ margin-inline-end: auto;
1375
+ }
1376
+ }
1377
+ @media (min-width: 561px) and (max-width: 720px) {
1378
+ .ui-react-app .ui-app__bar:has(> .ui-react-app__title) > .ui-react-app__title {
1379
+ flex-shrink: 0;
1380
+ max-width: 50%;
1381
+ }
1382
+ }
1369
1383
  @media (max-width: 560px) {
1370
1384
  .ui-react-app .ui-app__bar {
1371
1385
  gap: 0;
@@ -1384,7 +1398,9 @@
1384
1398
  .ui-react-app .ui-app__bar .ui-app__menu,
1385
1399
  .ui-react-app .ui-app__bar .ui-app__search,
1386
1400
  .ui-react-app .ui-app__bar .toggle,
1387
- .ui-react-app .ui-app__bar .ui-app__user-trigger {
1401
+ .ui-react-app .ui-app__bar .ui-app__user-trigger,
1402
+ .ui-react-app .ui-app__bar .ui-react-app__band-actions > .ui-btn,
1403
+ .ui-react-app .ui-app__bar .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger {
1388
1404
  flex: none;
1389
1405
  justify-content: center;
1390
1406
  width: 40px;
@@ -1399,7 +1415,9 @@
1399
1415
  }
1400
1416
  .ui-react-app .ui-app__bar .ui-app__search:hover,
1401
1417
  .ui-react-app .ui-app__bar .toggle:hover,
1402
- .ui-react-app .ui-app__bar .ui-app__user-trigger:hover {
1418
+ .ui-react-app .ui-app__bar .ui-app__user-trigger:hover,
1419
+ .ui-react-app .ui-app__bar .ui-react-app__band-actions > .ui-btn:hover,
1420
+ .ui-react-app .ui-app__bar .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger:hover {
1403
1421
  transform: none;
1404
1422
  background: var(--surface);
1405
1423
  }
@@ -1452,6 +1470,72 @@
1452
1470
  white-space: nowrap;
1453
1471
  }
1454
1472
  }
1473
+ .ui-react-app__band-actions {
1474
+ display: flex;
1475
+ align-items: center;
1476
+ flex: none;
1477
+ gap: var(--space-1);
1478
+ }
1479
+ .ui-react-app__band-actions > .ui-btn,
1480
+ .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger {
1481
+ min-width: 40px;
1482
+ min-height: 40px;
1483
+ justify-content: center;
1484
+ }
1485
+ .ui-react-app__band-actions > .ui-btn svg,
1486
+ .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger svg {
1487
+ flex: none;
1488
+ width: 17px;
1489
+ height: 17px;
1490
+ stroke-width: 2.2;
1491
+ }
1492
+ .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger {
1493
+ position: relative;
1494
+ gap: 0;
1495
+ padding: 0;
1496
+ border-color: transparent;
1497
+ background: transparent;
1498
+ }
1499
+ .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger .ui-badge {
1500
+ position: absolute;
1501
+ z-index: var(--z-base);
1502
+ inset-block-start: calc(var(--space-3) / -2);
1503
+ inset-inline-end: 0;
1504
+ min-width: var(--space-5);
1505
+ height: var(--space-5);
1506
+ padding: 0 var(--space-1);
1507
+ justify-content: center;
1508
+ border: calc(var(--space-1) / 2) solid var(--bg);
1509
+ color: var(--danger-contrast);
1510
+ background: var(--signal-solid-danger);
1511
+ }
1512
+ .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger:hover {
1513
+ transform: none;
1514
+ background: var(--surface);
1515
+ }
1516
+ @media (min-width: 721px) {
1517
+ .ui-react-app .ui-app__bar:has(> .ui-react-app__title):has(> .ui-react-app__band-actions) {
1518
+ display: grid;
1519
+ grid-template-columns: minmax(0, 1fr) minmax(0, var(--panel-sm)) minmax(max-content, 1fr);
1520
+ }
1521
+ .ui-react-app .ui-app__bar:has(> .ui-react-app__title) > .ui-react-app__band-actions {
1522
+ grid-column: 3;
1523
+ justify-self: end;
1524
+ }
1525
+ .ui-react-app .ui-app__bar:has(> .ui-react-app__title):has(> .ui-react-app__band-actions) .ui-app__search {
1526
+ grid-column: 2;
1527
+ margin-inline: 0;
1528
+ }
1529
+ }
1530
+ @media (max-width: 560px) {
1531
+ .ui-react-app .ui-app__bar > .ui-react-app__band-actions {
1532
+ margin-inline: var(--space-1);
1533
+ --tap-clear-x: var(--space-1);
1534
+ }
1535
+ .ui-react-app .ui-app__bar .ui-react-app__band-actions > .ui-dropdown > .ui-dropdown__trigger .ui-badge {
1536
+ inset-block-start: calc(var(--space-3) / -2 + 1px);
1537
+ }
1538
+ }
1455
1539
 
1456
1540
  /* src/AuthShell.css */
1457
1541
  .ui-auth__brand > span {
@@ -554,6 +554,10 @@ type DropdownItem = {
554
554
  * letters, `src` a photo. `{ empty: true }` is the dashed ring of a "No one" row. */
555
555
  avatar?: DropdownAvatar;
556
556
  badge?: DropdownBadge;
557
+ /** A row that stays selectable but is no longer current, named by its state word, e.g.
558
+ * 'Archived'. The word takes the badge slot in state ink, and the trigger shows it after
559
+ * the label. Use `disabled` for a row that cannot be picked. */
560
+ muted?: string;
557
561
  selected?: boolean;
558
562
  disabled?: boolean;
559
563
  danger?: boolean;
@@ -1014,6 +1018,9 @@ type AppShellProps = AppShellNav & {
1014
1018
  /** One glyph control in the sidebar head, before the fold button, drawn as the fold is.
1015
1019
  * On a phone it stands in the menu panel's head. Topbar layout only (#732). */
1016
1020
  headControl?: ReactNode;
1021
+ /** Glyph controls at the right end of the band, such as a notification bell, in every
1022
+ * sidebar structure and at every width. Topbar layout only (#847). */
1023
+ bandActions?: ReactNode;
1017
1024
  /** The band trigger's words and its name at every width. Below 560px the trigger shows
1018
1025
  * only its glyph (#729), and the words stay its accessible name. */
1019
1026
  searchLabel?: string;
@@ -1035,7 +1042,7 @@ type AppShellProps = AppShellNav & {
1035
1042
  /** Spread linkProps onto the router link, including children and onClick. */
1036
1043
  renderLink?: (section: AppShellLink, linkProps: ComponentPropsWithoutRef<'a'>) => ReactNode;
1037
1044
  };
1038
- declare function AppShell({ sections, groups, pathname, title, children, word, brand, layout, drawerSide, brandHref, width, back, lede, actions, tools, bandControl, headControl, account, accountItems, onSignOut, searchLabel, defaultCollapsed, palette, onNavigate, renderLink }: AppShellProps): react.JSX.Element;
1045
+ declare function AppShell({ sections, groups, pathname, title, children, word, brand, layout, drawerSide, brandHref, width, back, lede, actions, tools, bandControl, headControl, bandActions, account, accountItems, onSignOut, searchLabel, defaultCollapsed, palette, onNavigate, renderLink }: AppShellProps): react.JSX.Element;
1039
1046
 
1040
1047
  type AuthShellProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
1041
1048
  brand: ReactNode;
@@ -3156,6 +3156,8 @@ function RowBadge({ badge }) {
3156
3156
  if (!given && tone2 === "neutral" && /^(?:off|unset|disabled|archive|archived)$/i.test(text2)) tone2 = "state";
3157
3157
  return /* @__PURE__ */ jsx26("span", { className: `ui-dropdown__badge is-${tone2}`, children: text2 });
3158
3158
  }
3159
+ var mutedOf = (it) => it?.muted?.trim() || "";
3160
+ var shownOf = (it) => mutedOf(it) ? `${it?.label} (${mutedOf(it)})` : it?.label;
3159
3161
  var keyOf = (it) => it.value != null ? `v:${it.value}` : `l:${it.label}`;
3160
3162
  var itemsIn = (panel) => Array.from(panel?.querySelectorAll("[data-dd-item]") ?? []).filter((el) => el.getAttribute("aria-disabled") !== "true" && !el.hidden);
3161
3163
  var openNow = /* @__PURE__ */ new Set();
@@ -3326,7 +3328,7 @@ function Dropdown({
3326
3328
  }, [givenKey, pick]);
3327
3329
  const picked = pickedKey != null ? rows.find((it) => keyOf(it) === pickedKey) : void 0;
3328
3330
  const controlled = selectedValue !== void 0 ? rows.find((it) => it.value === selectedValue) : void 0;
3329
- const shown = value != null ? value : isSelect ? selectedValue !== void 0 ? controlled?.label : picked?.label ?? given?.label : null;
3331
+ const shown = value != null ? value : isSelect ? shownOf(selectedValue !== void 0 ? controlled : picked ?? given) : null;
3330
3332
  const marked2 = isSelect && rows.some((it) => it.avatar);
3331
3333
  const chosen = marked2 ? value != null ? rows.find((it) => it.label === value) : selectedValue !== void 0 ? controlled : picked ?? given : void 0;
3332
3334
  const selectedOf = (it) => selectedValue !== void 0 ? it.value === selectedValue : pickedKey != null ? it.disabled ? !!it.selected : keyOf(it) === pickedKey : !!it.selected;
@@ -3606,7 +3608,7 @@ function Dropdown({
3606
3608
  /* @__PURE__ */ jsx26("span", { className: "ui-dropdown__label", children: entry.label }),
3607
3609
  entry.description && /* @__PURE__ */ jsx26("span", { className: "ui-dropdown__desc", children: entry.description })
3608
3610
  ] }),
3609
- entry.badge ? /* @__PURE__ */ jsx26(RowBadge, { badge: entry.badge }) : null,
3611
+ mutedOf(entry) ? /* @__PURE__ */ jsx26(RowBadge, { badge: { text: mutedOf(entry), tone: "state" } }) : entry.badge ? /* @__PURE__ */ jsx26(RowBadge, { badge: entry.badge }) : null,
3610
3612
  asOption && /* @__PURE__ */ jsx26(Glyph2, { name: "check", className: "ui-dropdown__tick", hidden: true })
3611
3613
  ] })
3612
3614
  };
@@ -5072,6 +5074,7 @@ function AppShell({
5072
5074
  tools,
5073
5075
  bandControl,
5074
5076
  headControl,
5077
+ bandActions,
5075
5078
  account,
5076
5079
  accountItems = [],
5077
5080
  onSignOut,
@@ -5239,6 +5242,7 @@ function AppShell({
5239
5242
  }
5240
5243
  )
5241
5244
  ] });
5245
+ const ends = bandActions && /* @__PURE__ */ jsx41("div", { className: "ui-react-app__band-actions", children: bandActions });
5242
5246
  const control = bandControl && /* @__PURE__ */ jsx41("div", { className: "ui-react-app__control", inert: collapsed, children: bandControl });
5243
5247
  return /* @__PURE__ */ jsxs37("div", { className: `ui-app ui-app--topbar ui-react-app${collapsed ? " is-collapsed" : ""}`, children: [
5244
5248
  navigable && /* @__PURE__ */ jsxs37("div", { className: "ui-app__rail", role: "region", "aria-label": "Sidebar", children: [
@@ -5262,6 +5266,7 @@ function AppShell({
5262
5266
  /* @__PURE__ */ jsx41("kbd", { className: "ui-cmdk__key", children: paletteHotkey() })
5263
5267
  ] }),
5264
5268
  /* @__PURE__ */ jsx41("span", { className: "ui-app__bar-gap" }),
5269
+ navigable && ends,
5265
5270
  navigable ? /* @__PURE__ */ jsx41(
5266
5271
  Button,
5267
5272
  {
@@ -5278,6 +5283,7 @@ function AppShell({
5278
5283
  ) : /* @__PURE__ */ jsxs37(Fragment19, { children: [
5279
5284
  bandControl && /* @__PURE__ */ jsx41("span", { className: "ui-react-app__band-control", children: bandControl }),
5280
5285
  headControl && /* @__PURE__ */ jsx41("span", { className: "ui-react-app__band-control", children: headControl }),
5286
+ ends,
5281
5287
  /* @__PURE__ */ jsx41(ThemeToggle, {}),
5282
5288
  /* @__PURE__ */ jsx41("div", { className: "ui-app__user ui-app__user--bar", children: /* @__PURE__ */ jsx41(
5283
5289
  Dropdown,
@@ -361,7 +361,7 @@
361
361
  why: docs/foundations.md#the-focus-ring */
362
362
  .ui-dropdown__item:focus-visible { background: var(--surface); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */ outline: var(--ring-scroll); outline-offset: var(--ring-scroll-offset); }
363
363
  .ui-dropdown__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
364
- .ui-dropdown__label { font-family: var(--font-sans); font-size: var(--text-sm); color: var(--strong); font-weight: 600; letter-spacing: 0.01em; }
364
+ .ui-dropdown__label { font-family: var(--font-sans); font-size: var(--text-sm); color: var(--strong); font-weight: var(--weight-normal); letter-spacing: 0.01em; }
365
365
  .ui-dropdown__desc { font-size: var(--text-xs); color: var(--text); line-height: 1.35; }
366
366
  .ui-dropdown__ic { display: inline-flex; flex: none; /* muted-ink: glyph — option icon */ color: var(--muted); }
367
367
  .ui-dropdown__ic svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.1; }
@@ -427,9 +427,9 @@
427
427
  .ui-dropdown__item.is-danger:hover .ui-dropdown__label,
428
428
  .ui-dropdown__item.is-danger:focus-visible .ui-dropdown__label { color: var(--pink); }
429
429
 
430
- /* Grouped sections. `~` and :not([hidden]), because `+` counts a group a search
431
- query has hidden and drew the divider above the first group left showing. */
432
- .ui-dropdown__section:not([hidden]) ~ .ui-dropdown__section:not([hidden]) { border-top: 1px solid var(--border); margin-top: 5px; padding-top: 5px; }
430
+ /* Grouped sections: space, not a rule, before the next group (#852). `~` and :not([hidden]),
431
+ because `+` counts a group a search query has hidden and spaced the first one left showing. */
432
+ .ui-dropdown__section:not([hidden]) ~ .ui-dropdown__section:not([hidden]) { margin-top: var(--space-4); }
433
433
  .ui-dropdown__group {
434
434
  /* rank: label */
435
435
  font-size: var(--text-sm);
@@ -543,6 +543,9 @@
543
543
  /* muted-ink: state — off, unset, disabled or archived badge */
544
544
  color: var(--muted);
545
545
  }
546
+ /* On the row Enter would pick, the chip sits on --surface-2, where --muted reads 4.37:1 in
547
+ light. --dim keeps the state ink and clears 4.5:1 (#852). */
548
+ .ui-dropdown__item.is-active > .ui-dropdown__badge.is-state { /* muted-ink: state — archived badge on the search pick */ color: var(--dim); }
546
549
 
547
550
  /* A picker of people. A mark leads the trigger and each row; with no value the trigger
548
551
  shows the dashed ring beside the placeholder in the placeholder ink. The mark's own
@@ -109,9 +109,6 @@
109
109
  Primer and Radix all tick a chosen menu row. #549
110
110
  why: docs/components.md#filter-bar */
111
111
  .ui-filter-bar .ui-dropdown__item.is-selected { background: var(--glow-purple); /* code-bg: inherit — a translucent wash moves the ground, not the chip on it. */ }
112
- /* A chip's menu lists the values the chip prints, so its rows take the body weight and
113
- not the kit's semibold menu label. #757 */
114
- .ui-filter-bar__chip .ui-dropdown__label { font-weight: var(--weight-normal); }
115
112
  /* Kit-wide a chosen label steps down to --text, which left the row in force the
116
113
  faintest in the panel. Under the wash it holds --strong. */
117
114
  .ui-filter-bar .ui-dropdown__item.is-selected .ui-dropdown__label { color: var(--strong); }