@lotics/ui 33.0.0 → 34.0.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.
package/MIGRATION.md CHANGED
@@ -4,6 +4,50 @@ Breaking changes, newest first — normally per major, plus the rare minor that
4
4
  anyway (recorded under its exact version). The current contract lives in `AGENTS.md` + `docs/`;
5
5
  this file exists only to move an app from one release to the next.
6
6
 
7
+ ## 34.0.0 — one avatar rung fits a control band
8
+
9
+ **`AVATAR_PX.md` is 28, not 36.** Nothing to change at a call site — `md` is still
10
+ the default and still shows two initials — but every `Avatar`, `MemberChip` and
11
+ `GroupAvatar` on that rung renders 8px smaller (its initials drop a type rung with
12
+ it, to hold the same share of the circle), and the controls holding them get
13
+ SHORTER, which is the point.
14
+
15
+ `CONTROL_HEIGHT` is a promise: a toolbar row, a record's value column and a
16
+ picker's option list read as one band because every control on them is 40. TEXT
17
+ keeps that promise for free — a line is ~20, so `minHeight` governs and a
18
+ surface's vertical padding never binds. That is exactly why each 40px surface had
19
+ quietly picked its own inset (`Select`'s trigger 4, the inline editor 6,
20
+ `InlineSlot` 8) with no number to pick it from, and nothing on a resting screen
21
+ ever showed the disagreement.
22
+
23
+ Putting a 36px avatar in one broke all three at once. The same member chip
24
+ measured **46** in a `Select` trigger, **50** in an inline editor and **54** in an
25
+ `InlineSlot` — a record whose value column is the only thing telling a reader
26
+ these fields belong to one record, with the member row 10px off every other row
27
+ in it.
28
+
29
+ So the budget is stated once and the surfaces derive from it:
30
+
31
+ - **`CONTROL_CONTENT_HEIGHT`** (28) — the tallest fixed-height node a 40px band
32
+ seats, 6 per side of air. Not a fresh number: it is what `InlineButton` and a
33
+ `md` `IconButton` had already settled on for sitting inside a field. An avatar
34
+ is not a special kind of child, so it gets the same height they do.
35
+ - **`CONTROL_PADDING_V`** (5) — derived, and the 1px border counts inside the 6
36
+ per side. Reading the padding and forgetting the border is how the drift
37
+ started.
38
+
39
+ Both from `@lotics/ui/control_surface`. **If you build your own 40px control, pad
40
+ by `CONTROL_PADDING_V` and keep fixed-height children at or under
41
+ `CONTROL_CONTENT_HEIGHT`** — anything taller belongs in a row that sets its own
42
+ height, not in a control.
43
+
44
+ Two knock-on effects worth looking at once:
45
+
46
+ - A **multi-line control at rest** (a rich select showing title + description) is
47
+ ~2px shorter, since its padding came off the same constant.
48
+ - An `InlineSlot`/`InlineStatic` value now actually matches the editor beside it.
49
+ It always claimed to; it was 2px more padded, invisible at one line.
50
+
7
51
  ## 33.0.0 — `DrawerScrollArea`
8
52
 
9
53
  A `Drawer` gets the content primitive its siblings already had, named to match
package/docs/catalog.md CHANGED
@@ -76,12 +76,20 @@ inline: a picker option, an assignee, a `select_member` value. Pure: resolve the
76
76
  your directory and pass `name` / `image`; never hand-roll `Avatar` + `Text`. (`MemberSelect`
77
77
  renders these per option.)
78
78
 
79
- **Size is a RUNG, never a pixel count** — `sm | md | lg | xl` = 24 / 36 / 48 / 72
79
+ **Size is a RUNG, never a pixel count** — `sm | md | lg | xl` = 24 / 28 / 48 / 72
80
80
  (`@lotics/ui/avatar_size`, shared by `Avatar`, `MemberChip` and `GroupAvatar`). Default `md`.
81
81
  The number was removed because the same concept had drifted to eleven different values across
82
82
  the product and its apps, so one person looked different on every screen. Pick by density:
83
- `sm` for a dense row or inline cell, `md` for a register or list (the default), `lg` for a
84
- prominent row or the account menu, `xl` for a profile's own header.
83
+ `sm` for a dense row or inline cell, `md` for a control band, register or list (the default),
84
+ `lg` for a prominent row or the account menu, `xl` for a profile's own header.
85
+
86
+ **`md` is `CONTROL_CONTENT_HEIGHT`** (28) — the largest rung a 40px control band seats without
87
+ growing, and the height `InlineButton` and a `md` `IconButton` already used to sit inside a
88
+ field. An avatar is the tallest thing in whatever row holds it, so a rung that overshoots
89
+ doesn't look slightly big, it RESIZES the control: at the old 36 the same member chip measured
90
+ 46 in a `Select` trigger, 50 in an inline editor and 54 in an `InlineSlot`, because each
91
+ surface had picked its own inset with no number to pick it from. Put nothing taller than `md`
92
+ in a control — a bigger avatar belongs in a row that sets its own height.
85
93
 
86
94
  **`sm` shows ONE initial; every larger rung shows two** — two letters are not legible at 24px.
87
95
  That is the practical reason not to reach for `sm` by reflex: on a real roster a single letter
@@ -411,7 +419,13 @@ source (`src/<module>.tsx`/`.ts`) is the API reference.
411
419
  hand-rolled plain DOM/CSS (nothing injects them automatically; `@lotics/ui` components
412
420
  don't need them).
413
421
  - **`spacing`** — the `SPACE` scale + `SpaceToken`.
414
- - **`control_surface`** — `CONTROL_HEIGHT` (40), `CONTROL_RADIUS` (10), `CONTROL_TEXT_INSET`
422
+ - **`control_surface`** — `CONTROL_HEIGHT` (40), `CONTROL_CONTENT_HEIGHT` (28 — the tallest
423
+ FIXED-height node a 40px band seats, 6 per side of air; what `InlineButton` and a `md`
424
+ `IconButton` already used, now named so an avatar or any other child lands on it too. Text
425
+ never needs it because `minHeight` governs a single line, which is exactly why three surfaces
426
+ could each pick a different inset and only disagree once an avatar went in),
427
+ `CONTROL_PADDING_V` (5 — derived from the pair, BORDER INCLUDED in the 6 per side; every 40px
428
+ surface pads by it instead of a number of its own), `CONTROL_RADIUS` (10), `CONTROL_TEXT_INSET`
415
429
  (9 — how far a control insets its OWN text: 1px border + 8px padding; anything that must line
416
430
  up with a control's WORDS rather than its box carries it — a caption under an inline editor,
417
431
  a note under a figure — rather than a hand-measured 8),
@@ -517,7 +517,19 @@ shape.
517
517
 
518
518
  ## One view-control vocabulary
519
519
 
520
- All view controls are 40px tall (`CONTROL_HEIGHT`), `sm` labels, in ONE wrapping band:
520
+ All view controls are 40px tall (`CONTROL_HEIGHT`), `sm` labels, in ONE wrapping band.
521
+
522
+ **A 40px band affords 28 (`CONTROL_CONTENT_HEIGHT`), and a surface pads by
523
+ `CONTROL_PADDING_V` rather than a number of its own.** The height only holds for free when the
524
+ content is TEXT: a line is ~20, so `minHeight` governs and the padding never binds — which is
525
+ why a surface can pick any inset it likes and nothing on a resting screen ever contradicts it.
526
+ The moment something with a FIXED height goes in — an avatar, a swatch, a thumbnail — that
527
+ inset decides the control's whole height, and three surfaces that had each chosen their own
528
+ (4, 6, 8) rendered one member chip at 46, 50 and 54. So: a fixed-height child is sized against
529
+ the band's budget, never against how it looks alone, and a surface that needs more room than
530
+ the budget is not a control. The budget is 28 because that is what `InlineButton` and a `md`
531
+ `IconButton` were already using inside a field — a control's children must not differ in height
532
+ by what KIND of thing they are, so an avatar takes the same number rather than a fourth one.
521
533
 
522
534
  - **`SearchInput`** is THE search box — a white `TextInputField` preset (the shared
523
535
  `CONTROL_RADIUS` like every other input, a thin border, the leading search glyph + a clear ✕).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/ui",
3
- "version": "33.0.0",
3
+ "version": "34.0.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./vite": {
@@ -13,11 +13,28 @@ import type { TextSize } from "./text";
13
13
  */
14
14
  export type AvatarSize = "sm" | "md" | "lg" | "xl";
15
15
 
16
+ /**
17
+ * THE RUNGS.
18
+ *
19
+ * `md` IS `CONTROL_CONTENT_HEIGHT`, and that is the whole design. An avatar is
20
+ * the tallest thing in any row that holds one, so a rung that overshoots its
21
+ * container does not look slightly big — it RESIZES the container. The default
22
+ * rung therefore has to be the largest a 40px control band can seat, and that
23
+ * number was already fixed elsewhere in the kit: 28, what `InlineButton` and a
24
+ * `md` `IconButton` use to sit inside a field. An avatar is not a special kind
25
+ * of child; it gets the same height they do.
26
+ *
27
+ * It was 36, which fits nothing. The same member chip measured 46 in a `Select`
28
+ * trigger, 50 in an inline editor and 54 in an `InlineSlot` — three heights for
29
+ * one control band, because each surface had picked its own inset and none of
30
+ * them had a number to pick it FROM.
31
+ */
16
32
  export const AVATAR_PX: Record<AvatarSize, number> = {
17
33
  /** Dense rows and inline chips — one initial, because two do not fit. */
18
34
  sm: 24,
19
- /** The default: registers, lists, anywhere a person is a row. */
20
- md: 36,
35
+ /** The default: a 40px control band, a register, a list — anywhere a person is
36
+ * a row. Equals `CONTROL_CONTENT_HEIGHT` (`control_surface`). */
37
+ md: 28,
21
38
  /** Prominent rows, the account menu. */
22
39
  lg: 48,
23
40
  /** A profile's own header. */
@@ -32,19 +49,27 @@ export const AVATAR_PX: Record<AvatarSize, number> = {
32
49
  * native, and `text.css` moves again at 768px, so these are the desktop numbers
33
50
  * and only a render can give them):
34
51
  *
35
- * sm 12 on 24 = 50% · md 14 on 36 = 39%
36
- * lg 20 on 48 = 42% · xl 32 on 72 = 44%
52
+ * sm 12 on 24 = 50%
53
+ * md 12 on 28 = 43%
54
+ * lg 20 on 48 = 42%
55
+ * xl 32 on 72 = 44%
37
56
  *
38
- * The two-letter rungs sit within 6 points of each other, so an avatar reads the
57
+ * The two-letter rungs sit within 2 points of each other, so an avatar reads the
39
58
  * same at every size rather than growing emptier as it grows — `lg` was on `md`
40
59
  * type (16 on 48 = 33%) and was visibly the thin one. `sm` runs richer by design:
41
60
  * one letter in a small circle needs the weight.
61
+ *
62
+ * `md` shares `sm`'s rung and is NOT the odd one out for it: the same 12px reads
63
+ * as 50% of a 24px circle holding one letter and 43% of a 28px circle holding
64
+ * two. Keeping it on `sm` type (14) would have put `md` at 50% — the fattest of
65
+ * the two-letter rungs, and the same defect in the other direction as the `lg`
66
+ * one this table was written to fix.
42
67
  */
43
68
  export const AVATAR_TEXT: Record<AvatarSize, TextSize> = {
44
69
  sm: "xs", // 12 on 24 — one letter, so it carries a larger share of the circle
45
- md: "sm", // 14 on 36
46
- lg: "lg", // 18 on 48
47
- xl: "xxl", // 28 on 72
70
+ md: "xs", // 12 on 28
71
+ lg: "lg", // 20 on 48
72
+ xl: "xxl", // 32 on 72
48
73
  };
49
74
 
50
75
  const words = (name: string): string[] => name.trim().split(/\s+/).filter((w) => w !== "");
@@ -5,6 +5,38 @@ import { colors } from "./colors";
5
5
  * buttons) aligns to it so a toolbar row reads as one band. */
6
6
  export const CONTROL_HEIGHT = 40;
7
7
 
8
+ /**
9
+ * THE TALLEST FIXED-HEIGHT NODE A CONTROL BAND CAN SEAT — and so the inner height
10
+ * every 40px surface must afford. 6 per side of air, BORDER INCLUDED.
11
+ *
12
+ * `CONTROL_HEIGHT` is a promise — a toolbar row, a record's value column and a
13
+ * picker's option list read as one band because every control on them is 40. TEXT
14
+ * keeps that promise for free: a line is ~20, so `minHeight` governs and a
15
+ * surface's padding never binds. That is precisely why the promise broke the
16
+ * first time a control was handed something with a FIXED height. Each surface had
17
+ * quietly picked its own inset — 4, 6, 8 — with no number to pick it from, and
18
+ * nothing on a resting screen could reveal the disagreement; the moment a 36px
19
+ * avatar went in, the same member chip came out 46 in a `Select` trigger, 50 in
20
+ * an inline editor and 54 in an `InlineSlot`.
21
+ *
22
+ * 28 is not a fresh choice: it is what `InlineButton` and an `IconButton` at `md`
23
+ * had ALREADY settled on for sitting inside a field, air and all. Naming it once
24
+ * is what stops the next fixed-height child inventing a fourth number, and it is
25
+ * why an avatar on the default rung is 28 too — a control's children should not
26
+ * differ in height by what kind of thing they are.
27
+ *
28
+ * Anything taller does not belong in a control at all; it belongs in a row that
29
+ * sets its own height.
30
+ */
31
+ export const CONTROL_CONTENT_HEIGHT = 28;
32
+
33
+ /** A control's own vertical inset, derived so the band seats
34
+ * {@link CONTROL_CONTENT_HEIGHT} at exactly {@link CONTROL_HEIGHT}. The 1px
35
+ * border is part of the 6, so a bordered surface pads by this and an unbordered
36
+ * one by this + 1 — reading the padding and forgetting the border is what let
37
+ * three surfaces drift in the first place. */
38
+ export const CONTROL_PADDING_V = (CONTROL_HEIGHT - CONTROL_CONTENT_HEIGHT) / 2 - 1;
39
+
8
40
  /** The narrowest a control may be and still be usable — below it, editors get
9
41
  * crushed and option text has nowhere to go. It is the threshold at which a
10
42
  * `DetailTable` gives up its side-by-side columns and stacks, and the floor
@@ -2,11 +2,14 @@ import { type GestureResponderEvent } from "react-native";
2
2
  import { Text } from "./text";
3
3
  import { colors } from "./colors";
4
4
  import { PressableHighlight } from "./pressable_highlight";
5
- import { CONTROL_TRANSITION } from "./control_surface";
5
+ import { CONTROL_CONTENT_HEIGHT, CONTROL_TRANSITION } from "./control_surface";
6
6
 
7
7
  /** The height that fits INSIDE the 40px inline control band with 6px of air
8
- * above and below — the same air a `DetailRow`'s label gets against its value. */
9
- const INLINE_BUTTON_HEIGHT = 28;
8
+ * above and below — the same air a `DetailRow`'s label gets against its value.
9
+ * This file is where that number was FIRST worked out; it now lives in
10
+ * `control_surface` so an avatar or any other fixed-height child of a control
11
+ * lands on the same line rather than inventing its own. */
12
+ const INLINE_BUTTON_HEIGHT = CONTROL_CONTENT_HEIGHT;
10
13
 
11
14
  interface InlineButtonProps {
12
15
  /** The verb, as a word. An inline button is never icon-only — it sits on a
@@ -6,7 +6,7 @@ import { useLoticsLocale } from "./locale";
6
6
  import { ActivityIndicator } from "./activity_indicator";
7
7
  import { FocusRingPressable } from "./focus_ring_pressable";
8
8
  import { colors } from "./colors";
9
- import { FOCUS_RING, CONTROL_RADIUS, HOVER_BORDER, CONTROL_TRANSITION } from "./control_surface";
9
+ import { FOCUS_RING, CONTROL_RADIUS, CONTROL_PADDING_V, HOVER_BORDER, CONTROL_TRANSITION } from "./control_surface";
10
10
  import { fontFamilyRegular, getInputTextStyle, getMultilineInputHeight, getTextColor, type TextColor } from "./text_utils";
11
11
  import { getInteractionModality } from "./interaction_modality";
12
12
  import { shouldOpenOnFocus, shouldRestoreFocusOnClose } from "./inline_focus";
@@ -653,11 +653,15 @@ const styles = StyleSheet.create({
653
653
  borderColor: colors.border,
654
654
  backgroundColor: colors.white,
655
655
  paddingHorizontal: 8,
656
- // Vertical padding matters only when the display content is TALLER than
657
- // one line (a rich select showing title + description at rest): minHeight
658
- // still governs single-line rows, so those render pixel-identical, while
659
- // multi-line content gets breathing room instead of touching the edges.
660
- paddingVertical: 6,
656
+ // Vertical padding binds on two kinds of content, never on a single line
657
+ // (minHeight governs there, so those rows render pixel-identical whatever
658
+ // this is): content TALLER than one line, which gets breathing room instead
659
+ // of touching the edges, and content of FIXED height — an avatar, a swatch —
660
+ // which this decides the field's whole height for. Hence the shared
661
+ // constant: an editor seats a `CONTROL_CONTENT_HEIGHT` node at exactly 40,
662
+ // the same as every other 40px surface, rather than at a number this file
663
+ // happened to choose.
664
+ paddingVertical: CONTROL_PADDING_V,
661
665
  flexDirection: "row",
662
666
  alignItems: "center",
663
667
  gap: 6,
@@ -1,6 +1,6 @@
1
1
  import { StyleSheet, View, type StyleProp, type ViewStyle } from "react-native";
2
2
  import { type ReactNode } from "react";
3
- import { CONTROL_RADIUS } from "./control_surface";
3
+ import { CONTROL_PADDING_V, CONTROL_RADIUS } from "./control_surface";
4
4
  import { INLINE_CONTROL_HEIGHT } from "./inline_edit";
5
5
 
6
6
  export interface InlineSlotProps {
@@ -46,13 +46,16 @@ const styles = StyleSheet.create({
46
46
  borderWidth: 1,
47
47
  borderColor: "transparent",
48
48
  paddingHorizontal: 8,
49
- // The editors' vertical padding too, not just the horizontal. A single line
50
- // hides its absence the box is `minHeight` 40 and the text is ~20, so both
51
- // sides land on 40 whether or not this exists but an auto-growing input
52
- // sizes itself to content PLUS its padding and border, so from the SECOND
53
- // line on, a value without this sits ~14px shorter than the input that
54
- // replaces it. Matching by coincidence at one line is not matching.
55
- paddingVertical: 8,
49
+ // The editors' vertical padding too, not just the horizontal and it comes
50
+ // from the shared constant, NOT from the 8 the horizontal happens to use. A
51
+ // single line hides both the absence and a mismatch: the box is `minHeight`
52
+ // 40 and the text is ~20, so any padding from 0 to 10 lands on 40. It bites
53
+ // from the SECOND line on (an auto-growing input sizes to content PLUS its
54
+ // padding and border, so a value without this sits shorter than the input
55
+ // that replaces it) and on any FIXED-height content, where this slot's old
56
+ // hand-picked 8 made it 4px taller than the editor beside it for the very
57
+ // same child. Matching by coincidence at one line is not matching.
58
+ paddingVertical: CONTROL_PADDING_V,
56
59
  justifyContent: "center",
57
60
  },
58
61
  });
@@ -12,7 +12,8 @@ interface MemberChipProps {
12
12
  image?: string | null;
13
13
  /** Optional secondary line under the name — e.g. email, role, department. */
14
14
  secondary?: string | null;
15
- /** A rung on the shared avatar scale. Default `md`. */
15
+ /** A rung on the shared avatar scale. Default `md`, which is sized to seat in a
16
+ * 40px control band; drop to `sm` for a dense cell. See `AVATAR_PX`. */
16
17
  size?: AvatarSize;
17
18
  style?: StyleProp<ViewStyle>;
18
19
  }
@@ -26,6 +27,12 @@ interface MemberChipProps {
26
27
  * Pure: pass the member's fields in (from `useMembers`, or a resolved
27
28
  * `select_member` cell joined against that roster); this component fetches
28
29
  * nothing and carries no domain types.
30
+ *
31
+ * A chip's usual home is a 40px CONTROL BAND — a picker option, a select's
32
+ * trigger, an inline editor at rest, a diff slot — and the default `md` is sized
33
+ * to seat in one (`CONTROL_CONTENT_HEIGHT`). That is not a coincidence to
34
+ * preserve by hand: it is why `md` is 28 rather than the 36 that used to grow
35
+ * those three surfaces to 46, 50 and 54 for the very same chip.
29
36
  */
30
37
  export function MemberChip({ name, image, secondary, size = "md", style }: MemberChipProps) {
31
38
  const displayName = name?.trim() || "Unknown";
package/src/select.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import { StyleSheet, View, type GestureResponderEvent, type StyleProp, type ViewStyle } from "react-native";
2
2
  import { useState, useCallback, useMemo, type ReactNode, type Ref } from "react";
3
3
  import { colors } from "./colors";
4
- import { FOCUS_RING, CONTROL_RADIUS, HOVER_BORDER, CONTROL_TRANSITION } from "./control_surface";
4
+ import { FOCUS_RING, CONTROL_RADIUS, CONTROL_HEIGHT, CONTROL_PADDING_V, HOVER_BORDER, CONTROL_TRANSITION } from "./control_surface";
5
5
  import { FocusRingPressable } from "./focus_ring_pressable";
6
6
  import { Text } from "./text";
7
7
  import { Popover, PopoverTrigger, PopoverContent } from "./popover";
@@ -293,11 +293,14 @@ const styles = StyleSheet.create({
293
293
  flexDirection: "row",
294
294
  alignItems: "center",
295
295
  paddingHorizontal: 6,
296
- paddingVertical: 4,
296
+ // Shared, so a trigger seats a `CONTROL_CONTENT_HEIGHT` node at exactly
297
+ // `CONTROL_HEIGHT` — the hand-picked 4 here made this trigger 4px shorter
298
+ // than the inline editor holding the identical chip.
299
+ paddingVertical: CONTROL_PADDING_V,
297
300
  borderWidth: 1,
298
301
  borderColor: colors.border,
299
302
  borderRadius: CONTROL_RADIUS,
300
- minHeight: 40,
303
+ minHeight: CONTROL_HEIGHT,
301
304
  },
302
305
  opened: {
303
306
  // Mouse-opened, so the trigger never takes keyboard focus — wear the same 2px