@delacour/react-native-ui 0.4.1-alpha.20261021072908 → 0.4.1-alpha.20261021114607
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/package.json +1 -1
- package/src/{lib/cn.parity.test.ts → cn.parity.test.ts} +3 -3
- package/src/components/accordion/AGENTS.md +2 -2
- package/src/components/accordion/accordion.variants.test.ts +1 -3
- package/src/components/accordion/accordion.variants.ts +4 -6
- package/src/components/alert/AGENTS.md +1 -1
- package/src/components/alert/alert-glyphs.ts +1 -1
- package/src/components/alert/alert.variants.test.ts +2 -3
- package/src/components/alert/alert.variants.ts +1 -2
- package/src/components/animated-badge/AGENTS.md +1 -1
- package/src/components/animated-badge/animated-badge-glyph.tsx +1 -1
- package/src/components/attachment/AGENTS.md +1 -1
- package/src/components/attachment/attachment.utils.ts +1 -1
- package/src/components/avatar/avatar.utils.ts +1 -1
- package/src/components/badge/AGENTS.md +1 -1
- package/src/components/badge/badge.variants.ts +2 -3
- package/src/components/bottom-sheet/AGENTS.md +1 -1
- package/src/components/breadcrumb/AGENTS.md +1 -1
- package/src/components/breadcrumb/breadcrumb.variants.test.ts +1 -4
- package/src/components/button/AGENTS.md +3 -3
- package/src/components/button/button-group-separator.tsx +1 -1
- package/src/components/button/button.variants.ts +11 -12
- package/src/components/card/AGENTS.md +1 -1
- package/src/components/card/card.variants.ts +1 -2
- package/src/components/carousel/carousel.variants.ts +1 -2
- package/src/components/chart/chart.variants.ts +4 -5
- package/src/components/checkbox/AGENTS.md +8 -9
- package/src/components/checkbox/checkbox.variants.ts +12 -14
- package/src/components/chip/chip.variants.ts +2 -2
- package/src/components/circular-text/circular-text.variants.ts +1 -1
- package/src/components/collapsible/AGENTS.md +2 -4
- package/src/components/collapsible/collapsible.variants.test.ts +1 -4
- package/src/components/collapsible/collapsible.variants.ts +1 -1
- package/src/components/color-picker/color-picker.color.ts +1 -1
- package/src/components/combobox/combobox.filter.ts +1 -1
- package/src/components/combobox/combobox.variants.ts +2 -3
- package/src/components/compare/AGENTS.md +1 -1
- package/src/components/context-menu/context-menu.variants.ts +1 -1
- package/src/components/date-time-picker/date-time-picker.value.ts +1 -1
- package/src/components/dialog/AGENTS.md +2 -2
- package/src/components/dialog/dialog.variants.ts +1 -1
- package/src/components/direction/AGENTS.md +3 -1
- package/src/components/direction/direction.variants.ts +2 -2
- package/src/components/drawer/AGENTS.md +3 -2
- package/src/components/empty-state/empty-state.variants.ts +1 -2
- package/src/components/fab/AGENTS.md +1 -1
- package/src/components/feedback/AGENTS.md +4 -4
- package/src/components/feedback/feedback.variants.ts +3 -3
- package/src/components/field/AGENTS.md +4 -4
- package/src/components/field/field.variants.ts +6 -8
- package/src/components/flip-card/AGENTS.md +2 -3
- package/src/components/frame/frame.variants.ts +1 -2
- package/src/components/grid-item/grid-item.layout.ts +1 -2
- package/src/components/icon/AGENTS.md +1 -1
- package/src/components/icon/icon.variants.ts +2 -3
- package/src/components/image-viewer/AGENTS.md +1 -1
- package/src/components/image-viewer/image-viewer.variants.ts +1 -2
- package/src/components/input/AGENTS.md +5 -6
- package/src/components/input/input-group.tsx +1 -2
- package/src/components/input/input.tsx +1 -1
- package/src/components/input/input.variants.ts +15 -15
- package/src/components/item/AGENTS.md +4 -3
- package/src/components/item/item.variants.ts +2 -2
- package/src/components/label/AGENTS.md +3 -3
- package/src/components/label/label.variants.ts +5 -5
- package/src/components/list-group/list-group.variants.ts +2 -2
- package/src/components/map/AGENTS.md +4 -4
- package/src/components/markdown-editor/AGENTS.md +1 -1
- package/src/components/marquee/AGENTS.md +1 -1
- package/src/components/menu/menu.variants.ts +1 -1
- package/src/components/message-scroller/message-scroller.utils.ts +2 -2
- package/src/components/number-input/AGENTS.md +1 -1
- package/src/components/number-input/number-input.format.ts +2 -2
- package/src/components/number-input/number-input.variants.ts +2 -2
- package/src/components/number-input/use-step-repeat.ts +1 -1
- package/src/components/otp-input/otp-input.logic.ts +1 -1
- package/src/components/otp-input/otp-input.variants.ts +3 -3
- package/src/components/overlay/AGENTS.md +1 -1
- package/src/components/page-header/page-header.utils.ts +1 -2
- package/src/components/pagination/pagination.variants.test.ts +1 -5
- package/src/components/planner/planner-dates.ts +1 -1
- package/src/components/popover/AGENTS.md +1 -1
- package/src/components/popover/popover.position.ts +1 -2
- package/src/components/post/AGENTS.md +3 -2
- package/src/components/post/post.utils.ts +2 -2
- package/src/components/post/post.variants.ts +2 -2
- package/src/components/pressable/pressable.variants.ts +4 -4
- package/src/components/progress/progress.variants.ts +2 -2
- package/src/components/provider/AGENTS.md +1 -1
- package/src/components/qr-code/AGENTS.md +5 -5
- package/src/components/qr-code/qr-code.constants.ts +1 -1
- package/src/components/qr-code/qr-code.path.ts +2 -2
- package/src/components/qr-code/qr-code.tables.ts +2 -2
- package/src/components/qr-code/qr-code.variants.ts +2 -2
- package/src/components/questionnaire/AGENTS.md +1 -1
- package/src/components/questionnaire/questionnaire.logic.ts +1 -1
- package/src/components/radio/AGENTS.md +6 -7
- package/src/components/radio/radio-indicator.tsx +2 -2
- package/src/components/radio/radio.tsx +1 -1
- package/src/components/radio/radio.variants.test.ts +1 -4
- package/src/components/radio/radio.variants.ts +6 -6
- package/src/components/rating/AGENTS.md +2 -2
- package/src/components/screen/AGENTS.md +1 -1
- package/src/components/screen/screen.variants.ts +9 -9
- package/src/components/scroll-canvas/AGENTS.md +1 -1
- package/src/components/scroll-canvas/scroll-canvas.variants.ts +2 -2
- package/src/components/scroll-fade/AGENTS.md +1 -1
- package/src/components/scroll-header/AGENTS.md +2 -2
- package/src/components/scroll-text/AGENTS.md +1 -1
- package/src/components/search-bar/search-bar.debounce.ts +2 -2
- package/src/components/search-bar/search-bar.variants.ts +2 -2
- package/src/components/section-progress/AGENTS.md +2 -2
- package/src/components/select/AGENTS.md +2 -1
- package/src/components/select/select.variants.ts +5 -5
- package/src/components/separator/AGENTS.md +1 -1
- package/src/components/separator/separator.tsx +3 -3
- package/src/components/signature/AGENTS.md +1 -1
- package/src/components/signature/signature.stroke.ts +1 -1
- package/src/components/skeleton/AGENTS.md +1 -1
- package/src/components/sketch/AGENTS.md +2 -2
- package/src/components/sketch/sketch.paths.ts +2 -2
- package/src/components/slider/AGENTS.md +2 -2
- package/src/components/slider/slider-fill.tsx +3 -3
- package/src/components/slider/slider.variants.ts +7 -7
- package/src/components/sortable/sortable.variants.test.ts +1 -4
- package/src/components/spinner/AGENTS.md +1 -1
- package/src/components/spinner/spinner.variants.ts +3 -3
- package/src/components/splitter/AGENTS.md +5 -6
- package/src/components/splitter/splitter.math.ts +1 -1
- package/src/components/steps/AGENTS.md +2 -2
- package/src/components/steps/steps.variants.test.ts +1 -5
- package/src/components/steps/steps.variants.ts +1 -1
- package/src/components/support/AGENTS.md +3 -2
- package/src/components/surface/surface.variants.test.ts +2 -3
- package/src/components/surface/surface.variants.ts +1 -1
- package/src/components/switch/AGENTS.md +1 -2
- package/src/components/switch/switch.tsx +2 -3
- package/src/components/switch/switch.variants.test.ts +1 -5
- package/src/components/switch/switch.variants.ts +5 -5
- package/src/components/tabs/AGENTS.md +2 -2
- package/src/components/tabs/tabs-label.tsx +1 -1
- package/src/components/tabs/tabs.variants.ts +2 -2
- package/src/components/tag-input/AGENTS.md +1 -1
- package/src/components/tag-input/tag-input.logic.ts +2 -2
- package/src/components/tag-input/tag-input.variants.ts +2 -2
- package/src/components/text/text.tsx +2 -2
- package/src/components/text/text.variants.ts +3 -3
- package/src/components/text-animation/AGENTS.md +4 -4
- package/src/components/textarea/AGENTS.md +2 -2
- package/src/components/textarea/textarea.variants.test.ts +1 -4
- package/src/components/textarea/textarea.variants.ts +6 -7
- package/src/components/theme-selector/theme-selector.logic.ts +1 -1
- package/src/components/theme-selector/theme-selector.variants.ts +1 -1
- package/src/components/time-picker/time-picker.time.ts +1 -1
- package/src/components/time-picker/time-picker.variants.ts +2 -2
- package/src/components/toast/AGENTS.md +2 -2
- package/src/components/toast/toast.timer.ts +1 -2
- package/src/components/toggle-button/toggle-button.variants.ts +3 -3
- package/src/components/tooltip/AGENTS.md +2 -2
- package/src/components/tree/tree.variants.test.ts +1 -4
- package/src/components/tree/tree.variants.ts +1 -1
- package/src/hooks/use-keyboard-state-sync.tsx +1 -1
- package/src/hooks/use-navigation-theme.ts +1 -1
- package/src/lib/cn.ts +1 -1
- package/src/lib/color.ts +2 -2
- package/src/lib/keyboard-animation.ts +2 -3
- package/src/lib/navigation-theme.ts +2 -3
- package/src/lib/paging.ts +1 -1
- package/src/lib/scroll-edges.ts +1 -1
- package/src/lib/scroll-maths.ts +2 -2
- package/src/lib/wrap-text-children.ts +1 -1
- package/src/styles/theme-tokens.test.ts +9 -2
- package/src/styles/theme.css +4 -5
- package/src/styles/tokens.css +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CircularText's geometry and resolvers, free of React Native imports so every decision is
|
|
3
|
-
*
|
|
3
|
+
* unit-testable. Angles are degrees, 0 at 12 o'clock, growing clockwise on screen.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export const CIRCULAR_TEXT_DIRECTIONS = ["clockwise", "counterclockwise"] as const;
|
|
@@ -37,8 +37,7 @@ section first. What follows is only where a standalone disclosure differs.
|
|
|
37
37
|
derives an item's dependencies from its imports, so importing even the
|
|
38
38
|
accordion's leaf would make `delacour add collapsible` copy an accordion in
|
|
39
39
|
too. The spring, fade, rotation, variants, sizes and glyph step are written
|
|
40
|
-
again here and
|
|
41
|
-
is the only thing that imports both, and tests are not shipped.
|
|
40
|
+
again here and must stay equal to the accordion's.
|
|
42
41
|
- **The root owns the state and the travel.** With no item layer, what
|
|
43
42
|
`Accordion.Item` owns — `progress`, `contentHeight`, the spring, the
|
|
44
43
|
`isMeasured` state `onMeasured` flips — lives on the root. The race it closes
|
|
@@ -86,8 +85,7 @@ section first. What follows is only where a standalone disclosure differs.
|
|
|
86
85
|
|
|
87
86
|
- **`resolveCollapsibleAccessibility` is the one source.** The trigger announces
|
|
88
87
|
`expanded` and `disabled` from it; the panel takes
|
|
89
|
-
`accessibilityElementsHidden` and `importantForAccessibility` from it. Pure, so
|
|
90
|
-
`bun test` holds the matrix.
|
|
88
|
+
`accessibilityElementsHidden` and `importantForAccessibility` from it. Pure, so the matrix is unit-testable.
|
|
91
89
|
- **A closed panel is out of the tree, not just clipped.** It stays mounted after
|
|
92
90
|
its first open, and mounted content is content a screen reader reads. A
|
|
93
91
|
disabled but open panel is still on screen and still read.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
2
|
import { join } from "node:path";
|
|
4
|
-
import { declarationCount } from "../../styles/theme-tokens.test";
|
|
3
|
+
import { declarationCount, TOKENS_CSS } from "../../styles/theme-tokens.test";
|
|
5
4
|
import {
|
|
6
5
|
ACCORDION_CONTENT_FADE,
|
|
7
6
|
ACCORDION_GLYPH_STEP,
|
|
@@ -32,8 +31,6 @@ import {
|
|
|
32
31
|
toggleCollapsibleOpen,
|
|
33
32
|
} from "./collapsible.variants";
|
|
34
33
|
|
|
35
|
-
const TOKENS_CSS = readFileSync(join(import.meta.dirname, "../../styles/tokens.css"), "utf-8");
|
|
36
|
-
|
|
37
34
|
/** The minimum a touch target may be, in points. Apple's number, and Android's. */
|
|
38
35
|
const MINIMUM_TARGET = 44;
|
|
39
36
|
|
|
@@ -115,7 +115,7 @@ export const COLLAPSIBLE_CONTENT_FADE = { start: 0.1, end: 0.6 } as const;
|
|
|
115
115
|
* measure as a single unwrapped line.
|
|
116
116
|
*
|
|
117
117
|
* No slot worn by a `View` carries `text-*` (rule 1). Free of React Native
|
|
118
|
-
* imports so it stays
|
|
118
|
+
* imports so it stays unit-testable.
|
|
119
119
|
*/
|
|
120
120
|
export const collapsibleVariants = tv({
|
|
121
121
|
slots: {
|
|
@@ -4,7 +4,7 @@ import type { ColorFormat, Hsla, Hsva, HsvaChannel, Rgba } from "./color-picker.
|
|
|
4
4
|
* The picker's colour maths — parsing, conversion, formatting and the geometry
|
|
5
5
|
* the gestures map through.
|
|
6
6
|
*
|
|
7
|
-
* Free of React Native imports so
|
|
7
|
+
* Free of React Native imports so all of it is unit-testable. The functions a
|
|
8
8
|
* gesture or an animated style calls on the UI thread carry a `'worklet'`
|
|
9
9
|
* directive, and every one of those is **flat**: none calls another. A
|
|
10
10
|
* module-scope worklet binds at import time in source order, so one calling a
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
/**
|
|
14
14
|
* Pure filtering, highlighting and editing logic for `Combobox`.
|
|
15
15
|
*
|
|
16
|
-
* Free of React Native imports so
|
|
16
|
+
* Free of React Native imports so all of it is unit-testable. Text folding is
|
|
17
17
|
* Select's `normalizeSearchText` — defined once for every picker that filters a
|
|
18
18
|
* list — so a combobox and a searchable select agree on what "matches" means.
|
|
19
19
|
*/
|
|
@@ -31,8 +31,7 @@ export const COMBOBOX_CHIP_LAYOUT_MS = 150;
|
|
|
31
31
|
* `rowLabel`, so the create row is the same height and type as the options
|
|
32
32
|
* under it.
|
|
33
33
|
*
|
|
34
|
-
* Free of React Native imports so it stays unit-testable
|
|
35
|
-
* parse React Native's Flow-typed source. See AGENTS.md.
|
|
34
|
+
* Free of React Native imports so it stays pure and unit-testable. See AGENTS.md.
|
|
36
35
|
*/
|
|
37
36
|
export const comboboxVariants = tv({
|
|
38
37
|
slots: {
|
|
@@ -74,7 +73,7 @@ export type ComboboxVariantProps = VariantProps<typeof comboboxVariants>;
|
|
|
74
73
|
* grow the field the way a textarea grows with its text, rather than spilling
|
|
75
74
|
* out of a box the height of one line.
|
|
76
75
|
*
|
|
77
|
-
* Pure, so the whole matrix is
|
|
76
|
+
* Pure, so the whole matrix is unit-testable. See AGENTS.md.
|
|
78
77
|
*/
|
|
79
78
|
export function resolveComboboxTriggerClass({
|
|
80
79
|
hasChips,
|
|
@@ -142,7 +142,7 @@ scroll keeps the rest of the frame. On iOS a `ScrollView` delays content touches
|
|
|
142
142
|
|
|
143
143
|
## Previews (follow-up)
|
|
144
144
|
|
|
145
|
-
No demo carries `capture` yet: a captured demo with no manifest entry fails
|
|
145
|
+
No demo carries `capture` yet: a captured demo with no manifest entry fails the demo registry test, and the
|
|
146
146
|
media are shot after integration. The five to capture: `anatomy` (**hero**), `themes`
|
|
147
147
|
(`align: "stretch"`), `vertical`, `snap-points` and `colours-and-sizes` (`align: "stretch"`);
|
|
148
148
|
`anatomy`, `vertical` and `snap-points` are clips whose flows drag the handle by its `testID`
|
|
@@ -134,7 +134,7 @@ export function resolveContextMenuAccessibility({
|
|
|
134
134
|
* - `item` makes a row taller: content menus are reached by a held finger, and a
|
|
135
135
|
* 48pt row is easier to land after the lift.
|
|
136
136
|
*
|
|
137
|
-
* Free of React Native imports so it stays
|
|
137
|
+
* Free of React Native imports so it stays unit-testable.
|
|
138
138
|
*/
|
|
139
139
|
export const contextMenuVariants = tv({
|
|
140
140
|
slots: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A date and a time of day, held together — and everything a picker needs to reason about one.
|
|
3
3
|
*
|
|
4
|
-
* Pure: no React, no React Native, so
|
|
4
|
+
* Pure: no React, no React Native, so every function here is unit-testable. It composes the two
|
|
5
5
|
* leaves it stands on rather than restating them: every day sum is `calendar.date`'s and every
|
|
6
6
|
* minute sum is `time-picker.time`'s. What lives here is only what neither can answer alone —
|
|
7
7
|
* the order of two date-times, and how a bound on one day becomes a bound on that day's clock.
|
|
@@ -91,7 +91,7 @@ It is drawn with the [overlay foundation](../overlay/AGENTS.md) — `Overlay.Por
|
|
|
91
91
|
|
|
92
92
|
## Testing
|
|
93
93
|
|
|
94
|
-
`
|
|
95
|
-
keyboard lift. Opening from a trigger and controlled, every dismissal path, the alert dialog, the
|
|
94
|
+
`dialogVariants`, the size classes, the footer direction, the role and the
|
|
95
|
+
keyboard lift are unit-testable. Opening from a trigger and controlled, every dismissal path, the alert dialog, the
|
|
96
96
|
z-order over a sheet, the exit, the keyboard, VoiceOver focus and reduce motion are verified on a
|
|
97
97
|
simulator through `/dialog` in the playground — `over-sheet` is the z-order case.
|
|
@@ -114,7 +114,7 @@ export type DialogVariantProps = VariantProps<typeof dialogVariants>;
|
|
|
114
114
|
*
|
|
115
115
|
* Only the `sm` card stacks: two labelled buttons in a row on a 320pt card
|
|
116
116
|
* leave each label a few characters before it truncates. Pure so the rule is
|
|
117
|
-
*
|
|
117
|
+
* unit-testable.
|
|
118
118
|
*/
|
|
119
119
|
export function resolveDialogFooterDirection(size: DialogSize): DialogFooterDirection {
|
|
120
120
|
return size === "sm" ? "column" : "row";
|
|
@@ -18,7 +18,7 @@ which way is start.
|
|
|
18
18
|
|
|
19
19
|
There is no `tv()`: Direction has no tokens and no styled parts. The `*.variants.ts` file exists
|
|
20
20
|
only because a component's pure resolvers live in a leaf with no React Native imports, so
|
|
21
|
-
|
|
21
|
+
they are unit-testable.
|
|
22
22
|
|
|
23
23
|
## Design
|
|
24
24
|
|
|
@@ -80,7 +80,9 @@ only because a component's pure resolvers live in a leaf with no React Native im
|
|
|
80
80
|
|
|
81
81
|
## Verification
|
|
82
82
|
|
|
83
|
+
<!-- registry:omit -->
|
|
83
84
|
- `bun test packages/react-native-ui/src/components/direction` — the resolvers.
|
|
85
|
+
<!-- /registry:omit -->
|
|
84
86
|
- Simulator, 2026-10-05, via warden + agent-device on the toggle demo: before the toggle,
|
|
85
87
|
`dir-step-one` at x 37; after, at x 261 and `dir-step-three` at x 37. The nested LTR row
|
|
86
88
|
(`dir-fixed-1..3`) kept x 37 / 149 / 261 in both states.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Direction's pure resolvers. No React Native imports, so
|
|
3
|
-
*
|
|
2
|
+
* Direction's pure resolvers. No React Native imports, so every one is
|
|
3
|
+
* unit-testable, and each is tagged `"worklet"` so a gesture or `useAnimatedStyle`
|
|
4
4
|
* can call it on the UI thread.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -102,7 +102,8 @@ It is drawn with the [overlay foundation](../overlay/AGENTS.md) — `Overlay.Por
|
|
|
102
102
|
|
|
103
103
|
## Preview capture
|
|
104
104
|
|
|
105
|
-
The settings
|
|
105
|
+
The settings:<!-- registry:omit --> the bodies are in `apps/playground/e2e/previews/drawer.e2e.ts`.<!-- /registry:omit -->
|
|
106
|
+
|
|
106
107
|
|
|
107
108
|
| Demo | Capture |
|
|
108
109
|
| --- | --- |
|
|
@@ -113,7 +114,7 @@ The settings, with the bodies in `apps/playground/e2e/previews/drawer.e2e.ts`:
|
|
|
113
114
|
|
|
114
115
|
## Testing
|
|
115
116
|
|
|
116
|
-
|
|
117
|
+
The edge resolution in both directions is unit-testable, as are the extents on a small and a wide window, the frame extent with the docked inset,
|
|
117
118
|
the offset, the drag and its rubber band, the drag fraction, the release (threshold, fling toward,
|
|
118
119
|
fling away), the exit duration, the insets per edge and the slots per edge with their tokens in both
|
|
119
120
|
themes. All four sides from every dismissal path, the swipe's continue-and-restore, the scrolling
|
|
@@ -62,8 +62,7 @@ export const EMPTY_STATE_MEDIA_FOREGROUND_TOKEN: Record<EmptyStateMediaVariant,
|
|
|
62
62
|
* cascade colour to a `Text` descendant, so colour lives on `title` and
|
|
63
63
|
* `description`, and a glyph's colour on {@link EMPTY_STATE_MEDIA_FOREGROUND_TOKEN}.
|
|
64
64
|
*
|
|
65
|
-
* Free of React Native imports so it stays unit-testable
|
|
66
|
-
* parse React Native's Flow-typed source. See AGENTS.md.
|
|
65
|
+
* Free of React Native imports so it stays pure and unit-testable. See AGENTS.md.
|
|
67
66
|
*/
|
|
68
67
|
export const emptyStateVariants = tv({
|
|
69
68
|
slots: {
|
|
@@ -30,7 +30,7 @@ Compound root plus `Fab.Label`, `Fab.Group` and `Fab.Action`.
|
|
|
30
30
|
button, and a form retuning `--spacing-button-*` must not move the one thing
|
|
31
31
|
floating over its list. Declared in both `tokens.css` and theme.css's
|
|
32
32
|
`@variant native` block, per the package rule, and registered in
|
|
33
|
-
`styles/tokens.ts
|
|
33
|
+
`styles/tokens.ts`. The floor is 44pt.
|
|
34
34
|
- **Icons on `Fab` are composed; on `Fab.Group` and `Fab.Action` they are a
|
|
35
35
|
prop.** `Fab` matches `Button`: it publishes its icon step (`sm` → `icon-md`,
|
|
36
36
|
`md`/`lg` → `icon-lg`, `resolveFabIconSize`) and its variant's foreground
|
|
@@ -83,11 +83,11 @@ Not for confirmations or warnings — those are a `Dialog`. Like every overlay i
|
|
|
83
83
|
|
|
84
84
|
## Testing
|
|
85
85
|
|
|
86
|
-
`
|
|
87
|
-
field-height resolvers. Opening, the submit gate, the async send, the draft across close and
|
|
86
|
+
`feedbackVariants`, the tokens in both themes, `canSubmitFeedback` and the
|
|
87
|
+
field-height resolvers are unit-testable. Opening, the submit gate, the async send, the draft across close and
|
|
88
88
|
reopen, the keyboard, the multi-step resize and every dismissal path are verified on a simulator
|
|
89
89
|
through `/feedback` in the playground.
|
|
90
90
|
|
|
91
91
|
Preview media: `basic` is the hero and `sending` and `multi-step` are clips, all
|
|
92
|
-
`{ flow: true, frame: "device" }
|
|
93
|
-
`apps/playground/e2e/previews/feedback.e2e.ts`; `bun run previews -- -- --only feedback` recaptures them
|
|
92
|
+
`{ flow: true, frame: "device" }`.<!-- registry:omit --> Their bodies are in
|
|
93
|
+
`apps/playground/e2e/previews/feedback.e2e.ts`; `bun run previews -- -- --only feedback` recaptures them.<!-- /registry:omit -->
|
|
@@ -77,7 +77,7 @@ export type CanSubmitFeedbackInput = {
|
|
|
77
77
|
* Whitespace is empty: a message of three spaces sends nothing, and `onSubmit`
|
|
78
78
|
* receives the trimmed text anyway. Disabled outranks `canSubmitEmpty`.
|
|
79
79
|
*
|
|
80
|
-
* Pure, so it is
|
|
80
|
+
* Pure, so it is unit-testable. See AGENTS.md.
|
|
81
81
|
*/
|
|
82
82
|
export function canSubmitFeedback({
|
|
83
83
|
value,
|
|
@@ -96,7 +96,7 @@ export function canSubmitFeedback({
|
|
|
96
96
|
* Tailwind's static scanner. A bad row count degrades the way `Textarea`'s
|
|
97
97
|
* does — floored to whole lines, clamped to one, the default on `NaN`.
|
|
98
98
|
*
|
|
99
|
-
* Pure, so it is
|
|
99
|
+
* Pure, so it is unit-testable. See AGENTS.md.
|
|
100
100
|
*/
|
|
101
101
|
export function resolveFeedbackFieldMinHeight(minRows: number | undefined, lineHeight: number): number {
|
|
102
102
|
const rows =
|
|
@@ -111,7 +111,7 @@ export function resolveFeedbackFieldMinHeight(minRows: number | undefined, lineH
|
|
|
111
111
|
* one would push its footer under the keyboard.
|
|
112
112
|
*
|
|
113
113
|
* A ceiling below the floor is lifted up to it, so the field never shrinks as
|
|
114
|
-
* it grows. Pure, so it is
|
|
114
|
+
* it grows. Pure, so it is unit-testable. See AGENTS.md.
|
|
115
115
|
*/
|
|
116
116
|
export function resolveFeedbackFieldHeightStyle({
|
|
117
117
|
minRows,
|
|
@@ -45,8 +45,8 @@ A form field's layout, and the one place its state is written down. Root plus
|
|
|
45
45
|
it. A checkbox in a form is a small square next to a sentence, and the sentence
|
|
46
46
|
is what people aim at. This is [`Input.Group`](../input/AGENTS.md)'s trick one level out: that group
|
|
47
47
|
is a pressable whose press focuses the field through a ref on its context.
|
|
48
|
-
`resolveFieldInteractive` is the decision and it is pure, so
|
|
49
|
-
|
|
48
|
+
`resolveFieldInteractive` is the decision and it is pure, so it is
|
|
49
|
+
unit-testable. A field of static text registers nothing and stays a `View` — mounting a
|
|
50
50
|
detector regardless would put one under every label and description in a form,
|
|
51
51
|
the thing [`Badge`](../badge/AGENTS.md) refuses for a list of fifty tags. The row is
|
|
52
52
|
`accessible={false}`, so the control stays the element a screen reader sees,
|
|
@@ -64,7 +64,7 @@ A form field's layout, and the one place its state is written down. Root plus
|
|
|
64
64
|
icon's key, say — would name the control after the wrong thing. State rather
|
|
65
65
|
than a ref for the same reason as the press: the control renders differently
|
|
66
66
|
for it, and the label registers in an effect, so it costs one render on mount.
|
|
67
|
-
- **A data-attribute class would also
|
|
67
|
+
- **A data-attribute class would also hide the decision from unit tests.** Even for a part styling
|
|
68
68
|
itself, `data-invalid:text-destructive` moves the decision from `field.variants.ts`
|
|
69
69
|
into uniwind's runtime matcher, where no unit test can see it. The parts style
|
|
70
70
|
themselves from `tv()` booleans; the context is only for crossing a component
|
|
@@ -107,7 +107,7 @@ A form field's layout, and the one place its state is written down. Root plus
|
|
|
107
107
|
primitive. `Label` narrows `children` from `Text`'s and reports
|
|
108
108
|
`accessibilityState.disabled`, so wrapping it would change this part's public
|
|
109
109
|
surface. The two colour and fade identically instead, and
|
|
110
|
-
|
|
110
|
+
they must stay in step with `fieldVariants`' label slot
|
|
111
111
|
and `resolveFieldTextColor`. A required field uses `Label` directly, since
|
|
112
112
|
`Field.Label` has no `isRequired`.
|
|
113
113
|
- **There is no `Field.Title`.** On the web it exists because a `<div>` is not a
|
|
@@ -21,9 +21,8 @@ export type FieldTextPart = (typeof FIELD_TEXT_PARTS)[number];
|
|
|
21
21
|
* label with its description, `root` groups a field's parts, `set` groups a
|
|
22
22
|
* legend with its fields, and `group` separates one field from the next. Each
|
|
23
23
|
* step is looser than the one inside it, which is what makes a field read as one
|
|
24
|
-
* thing and two fields as two —
|
|
25
|
-
*
|
|
26
|
-
* becoming a transcript of it.
|
|
24
|
+
* thing and two fields as two — the ordering is the
|
|
25
|
+
* contract, not the numbers, so the spacing can be retuned freely.
|
|
27
26
|
*
|
|
28
27
|
* **No slot here carries a type scale or a colour.** The text parts render the
|
|
29
28
|
* `Text` presets — `Text.Label`, `Text.Caption` — and pass a colour through
|
|
@@ -35,8 +34,7 @@ export type FieldTextPart = (typeof FIELD_TEXT_PARTS)[number];
|
|
|
35
34
|
* The `View` slots hold no `text-*` at all: a React Native `View` does not
|
|
36
35
|
* cascade colour to a `Text` descendant. See AGENTS.md rule 1.
|
|
37
36
|
*
|
|
38
|
-
* Free of React Native imports so it stays unit-testable
|
|
39
|
-
* parse React Native's Flow-typed source. See AGENTS.md.
|
|
37
|
+
* Free of React Native imports so it stays pure and unit-testable. See AGENTS.md.
|
|
40
38
|
*/
|
|
41
39
|
export const fieldVariants = tv({
|
|
42
40
|
slots: {
|
|
@@ -102,7 +100,7 @@ export const fieldVariants = tv({
|
|
|
102
100
|
* The error is destructive even outside an invalid field, because an error message is
|
|
103
101
|
* never the calm case.
|
|
104
102
|
*
|
|
105
|
-
* Pure, so the whole matrix is
|
|
103
|
+
* Pure, so the whole matrix is unit-testable. See AGENTS.md.
|
|
106
104
|
*/
|
|
107
105
|
export function resolveFieldTextColor(part: FieldTextPart, isInvalid: boolean): TextColor | undefined {
|
|
108
106
|
switch (part) {
|
|
@@ -127,7 +125,7 @@ export function resolveFieldTextColor(part: FieldTextPart, isInvalid: boolean):
|
|
|
127
125
|
* A type predicate rather than a plain boolean, so the branch that renders the
|
|
128
126
|
* `Pressable` gets a non-null `onPress` out of the same check that decided it.
|
|
129
127
|
*
|
|
130
|
-
* Pure, so the decision is
|
|
128
|
+
* Pure, so the decision is unit-testable. See AGENTS.md.
|
|
131
129
|
*/
|
|
132
130
|
export function resolveFieldInteractive(press: (() => void) | null): press is () => void {
|
|
133
131
|
return press !== null;
|
|
@@ -144,7 +142,7 @@ export function resolveFieldInteractive(press: (() => void) | null): press is ()
|
|
|
144
142
|
* all, which is worse than reading the value alone.
|
|
145
143
|
*
|
|
146
144
|
* React Native has no `<label for>`; this is the association, done by hand
|
|
147
|
-
* through the field's context. Pure, so
|
|
145
|
+
* through the field's context. Pure, so it is unit-testable. See AGENTS.md.
|
|
148
146
|
*/
|
|
149
147
|
export function resolveFieldLabelText(children: unknown): string | null {
|
|
150
148
|
if (typeof children === "number") return String(children);
|
|
@@ -118,8 +118,7 @@ the back's `Button` counted a copy and the card stayed on its back. No `Gesture.
|
|
|
118
118
|
- **No worklet reads a module binding from a parameter default.** The worklets plugin captures what
|
|
119
119
|
a worklet's body reads, not its parameter defaults: `resolveRubberBand(rotation, max =
|
|
120
120
|
FLIP_CARD_RUBBER_BAND)` threw *Property 'FLIP_CARD_RUBBER_BAND' doesn't exist* on the UI thread
|
|
121
|
-
the first time a swipe card was dragged. The default is now resolved in the body, and a test
|
|
122
|
-
`flip-card.variants.test.ts` fails on any worklet with an identifier default.
|
|
121
|
+
the first time a swipe card was dragged. The default is now resolved in the body, and a test fails on any worklet with an identifier default.
|
|
123
122
|
|
|
124
123
|
Checked on an iOS 26 simulator (iPhone 17) through the `preview` route, with agent-device:
|
|
125
124
|
|
|
@@ -143,7 +142,7 @@ card's `activate` action, a swipe card inside a vertical `ScrollView`.
|
|
|
143
142
|
|
|
144
143
|
`anatomy` (**hero**), `swipe`, `flashcard`, `vertical-axis` and `faces` carry `meta.capture`, and
|
|
145
144
|
the four animated ones have flows under `.argent/flows/previews/flip-card/`, written but never run.
|
|
146
|
-
`flip-card` sits in `AWAITING_FIRST_CAPTURE` in
|
|
145
|
+
`flip-card` sits in `AWAITING_FIRST_CAPTURE` in the playground's demo registry test until the
|
|
147
146
|
media are shot; remove it in that commit, and add `<Preview id="flip-card/anatomy" title={null} />`
|
|
148
147
|
plus a `<Preview>` per section to `flip-card.mdx` in the same change — a `<Preview id>` for an
|
|
149
148
|
uncaptured demo throws at render.
|
|
@@ -59,8 +59,7 @@ export type FrameDivider = "inset" | "full";
|
|
|
59
59
|
* No slot carries a shadow — nothing in this package casts one — and the layout
|
|
60
60
|
* slots carry no `text-*` colour (rule 1): a `View` cannot cascade one.
|
|
61
61
|
*
|
|
62
|
-
* Free of React Native imports so it stays unit-testable
|
|
63
|
-
* parse React Native's Flow-typed source. See AGENTS.md.
|
|
62
|
+
* Free of React Native imports so it stays pure and unit-testable. See AGENTS.md.
|
|
64
63
|
*/
|
|
65
64
|
export const frameVariants = tv({
|
|
66
65
|
slots: {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The placement maths behind `GridItem.Group`.
|
|
3
3
|
*
|
|
4
|
-
* Pure and free of React Native imports, so the whole matrix is
|
|
5
|
-
* `bun test` — React Native ships Flow-typed source Bun cannot parse. The group
|
|
4
|
+
* Pure and free of React Native imports, so the whole matrix is unit-testable. The group
|
|
6
5
|
* calls these in order: measure, `resolveCellSize`, `placeTiles`, then
|
|
7
6
|
* `tileRect` per tile and `gridHeight` for itself.
|
|
8
7
|
*/
|
|
@@ -91,7 +91,7 @@ instead of every call site repeating them.
|
|
|
91
91
|
- **Central Icons only**, via `@delacour/react-native-ui/icons/central` — never Lucide,
|
|
92
92
|
Hugeicons, or anything else. That is rule 5.
|
|
93
93
|
- **`icon.variants.ts` is free of React Native imports** so the whole ladder is
|
|
94
|
-
|
|
94
|
+
unit-testable — `resolveIconSizeClass`, `isIconSize` and
|
|
95
95
|
`iconVariants` are all pure. See [Testing](../../../AGENTS.md#testing).
|
|
96
96
|
|
|
97
97
|
## Known gaps
|
|
@@ -24,8 +24,7 @@ export type IconSize = (typeof ICON_SIZES)[number];
|
|
|
24
24
|
* class, and a default here would emit from inside this same call, ahead of it
|
|
25
25
|
* in the merge. {@link resolveIconSizeClass} orders the sources instead.
|
|
26
26
|
*
|
|
27
|
-
* Free of React Native imports so it stays unit-testable
|
|
28
|
-
* parse React Native's Flow-typed source. See AGENTS.md.
|
|
27
|
+
* Free of React Native imports so it stays pure and unit-testable. See AGENTS.md.
|
|
29
28
|
*/
|
|
30
29
|
export const iconVariants = tv({
|
|
31
30
|
variants: {
|
|
@@ -64,7 +63,7 @@ export function isIconSize(size: IconSize | number | undefined): size is IconSiz
|
|
|
64
63
|
* `h-*`. tailwind-merge conflicts `size` into `w`/`h` but not the reverse, so a
|
|
65
64
|
* trailing `w-6` will not clear a leading `size-5`.
|
|
66
65
|
*
|
|
67
|
-
* Pure, so the whole ladder is
|
|
66
|
+
* Pure, so the whole ladder is unit-testable. See AGENTS.md.
|
|
68
67
|
*/
|
|
69
68
|
export function resolveIconSizeClass({
|
|
70
69
|
size,
|
|
@@ -152,7 +152,7 @@ pass it through `renderImage`.
|
|
|
152
152
|
|
|
153
153
|
## Verification
|
|
154
154
|
|
|
155
|
-
Rendering is verified in the playground (`/image-viewer`), not by
|
|
155
|
+
Rendering is verified in the playground (`/image-viewer`), not by unit tests.
|
|
156
156
|
See the simulator notes at the end of this file for what was checked.
|
|
157
157
|
|
|
158
158
|
### Simulator notes
|
|
@@ -66,8 +66,7 @@ export type ViewerImageLike = {
|
|
|
66
66
|
/**
|
|
67
67
|
* ImageViewer's slots.
|
|
68
68
|
*
|
|
69
|
-
* Free of React Native imports so it stays unit-testable
|
|
70
|
-
* parse React Native's Flow-typed source. See AGENTS.md.
|
|
69
|
+
* Free of React Native imports so it stays pure and unit-testable. See AGENTS.md.
|
|
71
70
|
*/
|
|
72
71
|
export const imageViewerVariants = tv({
|
|
73
72
|
slots: {
|
|
@@ -31,9 +31,8 @@ Root plus `Input.Group` and its parts: `Prefix`, `Suffix`, `Button`,
|
|
|
31
31
|
- **The box is one slot with two homes, and that is the whole design.** The
|
|
32
32
|
`root` slot of `inputVariants` lands on the `TextInput` when a field stands
|
|
33
33
|
alone and on `Input.Group`'s outer element when it does not. `resolveInputFieldClass` is
|
|
34
|
-
the decision, and it is pure, so
|
|
35
|
-
matrix and asserts
|
|
36
|
-
the group's box. The inner `row` slot is layout only — no border, background,
|
|
34
|
+
the decision, and it is pure, so every chrome utility a lone field wears must be present on
|
|
35
|
+
the group's box.<!-- registry:omit --> `input.variants.test.ts` sweeps the entire matrix and asserts it.<!-- /registry:omit --> The inner `row` slot is layout only — no border, background,
|
|
37
36
|
corner or height — and the test asserts that too. A grouped field is therefore the *same* box rather than a
|
|
38
37
|
similar one. **Do not give `Input.Group` a border, background or height of its
|
|
39
38
|
own** — a second class string is a second thing that can drift, and the drift
|
|
@@ -71,7 +70,7 @@ Root plus `Input.Group` and its parts: `Prefix`, `Suffix`, `Button`,
|
|
|
71
70
|
track its own focus, and `focus:border-ring` would work on a lone field — and
|
|
72
71
|
do nothing at all for the box `Input.Group` draws around a grouped one, since a
|
|
73
72
|
`View` cannot see a sibling's focus. One state, read by an `isFocused` variant,
|
|
74
|
-
keeps the two identical and puts the decision somewhere
|
|
73
|
+
keeps the two identical and puts the decision somewhere a unit test can reach.
|
|
75
74
|
- **Invalid outranks focus.** A field that went grey the moment it was tapped
|
|
76
75
|
would drop the only signal it has that its value is wrong, exactly while the
|
|
77
76
|
value is being corrected. The border, the caret and the decorators all stay
|
|
@@ -155,8 +154,8 @@ reads as one control rather than two boxes touching.
|
|
|
155
154
|
`h-button-md`. In a group that independence is exactly wrong: a run capped by
|
|
156
155
|
a field at one end and a button at the other would draw two different arcs.
|
|
157
156
|
The group owns the shape of its run, so a joined field switches to
|
|
158
|
-
`--radius-button-*`.
|
|
159
|
-
corner classes cell for cell, so the copies cannot drift.
|
|
157
|
+
`--radius-button-*`. The two must emit identical
|
|
158
|
+
corner classes cell for cell, so the copies cannot drift.<!-- registry:omit --> `input.variants.test.ts` asserts it.<!-- /registry:omit -->
|
|
160
159
|
- **A field nested in an `Input.Group` never consults the member axes.** That
|
|
161
160
|
group owns the box, and `resolveInputFieldClass` already drops the `root` slot
|
|
162
161
|
entirely when the field is grouped — so the corner and the seam land on the
|
|
@@ -167,8 +167,7 @@ function classifyGroupChild(child: ReactNode): InputGroupChildKind {
|
|
|
167
167
|
* The box is the same one a lone `Input` draws. It is not a copy: both read the
|
|
168
168
|
* one `root` slot of `inputVariants`, which lands on the `TextInput` when a
|
|
169
169
|
* field stands alone and on this row when it does not. A grouped field is
|
|
170
|
-
* therefore indistinguishable from an ungrouped one by construction,
|
|
171
|
-
* `input.variants.test.ts` pins that as a property rather than a comment.
|
|
170
|
+
* therefore indistinguishable from an ungrouped one by construction, as a property rather than a comment.
|
|
172
171
|
*
|
|
173
172
|
* The group owns the box, so it owns the axes that draw one — `variant`, `size`,
|
|
174
173
|
* `isInvalid`, `isDisabled` all live here and the `Input` inside reads them from
|
|
@@ -169,7 +169,7 @@ function InputRoot({
|
|
|
169
169
|
* Focus styling is driven from React state rather than a `focus:` class.
|
|
170
170
|
* Uniwind tracks focus per component, so a `focus:` utility would light up a
|
|
171
171
|
* lone field and do nothing for the box `Input.Group` draws around a grouped
|
|
172
|
-
* one — and the decision would sit somewhere
|
|
172
|
+
* one — and the decision would sit somewhere a unit test cannot reach.
|
|
173
173
|
*
|
|
174
174
|
* Everything `TextInput` accepts is accepted here, with one name removed:
|
|
175
175
|
* uniwind's `placeholderTextColorClassName` is replaced by
|
|
@@ -44,8 +44,8 @@ export const INPUT_INVALID_SELECTION_ACCENT_CLASS = "accent-destructive";
|
|
|
44
44
|
* `root` slot is the whole bordered box, and it lands on the `TextInput` when
|
|
45
45
|
* the field stands alone or on `Input.Group`'s row when it does not. That is
|
|
46
46
|
* what makes a grouped field identical to a lone one by construction rather
|
|
47
|
-
* than by two class strings happening to agree;
|
|
48
|
-
*
|
|
47
|
+
* than by two class strings happening to agree; it holds
|
|
48
|
+
* as a property over every combination of the axes.
|
|
49
49
|
*
|
|
50
50
|
* `root` therefore holds no `text-*` utility. When the field is grouped that
|
|
51
51
|
* slot is worn by a `View`, and a React Native `View` does not cascade colour
|
|
@@ -62,8 +62,8 @@ export const INPUT_INVALID_SELECTION_ACCENT_CLASS = "accent-destructive";
|
|
|
62
62
|
* different places, and a second identical slot is a second definition that can
|
|
63
63
|
* drift.
|
|
64
64
|
*
|
|
65
|
-
* Free of React Native imports so it stays unit-testable —
|
|
66
|
-
*
|
|
65
|
+
* Free of React Native imports so it stays unit-testable — it must not
|
|
66
|
+
* pull in React Native's Flow-typed source. See AGENTS.md.
|
|
67
67
|
*/
|
|
68
68
|
export const inputVariants = tv({
|
|
69
69
|
slots: {
|
|
@@ -199,8 +199,8 @@ export const inputVariants = tv({
|
|
|
199
199
|
// Joined, it takes the *group's* corner instead. A group owns the shape
|
|
200
200
|
// of its run, so a field capping one end of it has to draw the same arc
|
|
201
201
|
// the button capping the other end does — two ramps meeting in one row
|
|
202
|
-
// is the mismatch this replaces.
|
|
203
|
-
//
|
|
202
|
+
// is the mismatch this replaces. These strings must match the button's
|
|
203
|
+
// cell for cell.
|
|
204
204
|
{ groupPosition: "only", size: "sm", class: { root: "rounded-button-sm" } },
|
|
205
205
|
{ groupPosition: "only", size: "md", class: { root: "rounded-button-md" } },
|
|
206
206
|
{ groupPosition: "only", size: "lg", class: { root: "rounded-button-lg" } },
|
|
@@ -322,7 +322,7 @@ export type InputBoxState = {
|
|
|
322
322
|
* a lone one: both read the same `root` slot, so there is no second class
|
|
323
323
|
* string that could drift from the first.
|
|
324
324
|
*
|
|
325
|
-
* Pure, so the whole matrix is
|
|
325
|
+
* Pure, so the whole matrix is unit-testable. See AGENTS.md.
|
|
326
326
|
*/
|
|
327
327
|
export function resolveInputFieldClass({
|
|
328
328
|
className,
|
|
@@ -349,7 +349,7 @@ export type InputGroupBoxState = InputBoxState & {
|
|
|
349
349
|
* the field is. The row keeps its own alignment, so a single-line field stays
|
|
350
350
|
* centred in it.
|
|
351
351
|
*
|
|
352
|
-
* Pure, so the whole matrix is
|
|
352
|
+
* Pure, so the whole matrix is unit-testable. See AGENTS.md.
|
|
353
353
|
*/
|
|
354
354
|
export function resolveInputGroupClass({
|
|
355
355
|
className,
|
|
@@ -364,7 +364,7 @@ export function resolveInputGroupClass({
|
|
|
364
364
|
* The class `Input.Group`'s inner row wears — layout only, never chrome. The
|
|
365
365
|
* row is always rendered, blocks or not, so adding one never remounts the field.
|
|
366
366
|
*
|
|
367
|
-
* Pure, so it is
|
|
367
|
+
* Pure, so it is unit-testable. See AGENTS.md.
|
|
368
368
|
*/
|
|
369
369
|
export function resolveInputGroupRowClass({ className, hasBlocks: _hasBlocks, ...state }: InputGroupBoxState): string {
|
|
370
370
|
return inputVariants({ ...state, isGrouped: true }).row({ className });
|
|
@@ -382,7 +382,7 @@ export type InputDecoratorChildKind = "text" | "icon" | "other";
|
|
|
382
382
|
* holding anything else might be a control, so it stays reachable. An empty
|
|
383
383
|
* decorator has nothing to hide.
|
|
384
384
|
*
|
|
385
|
-
* Pure, so it is
|
|
385
|
+
* Pure, so it is unit-testable. See AGENTS.md.
|
|
386
386
|
*/
|
|
387
387
|
export function resolveIsDecorative({
|
|
388
388
|
explicit,
|
|
@@ -400,7 +400,7 @@ export function resolveIsDecorative({
|
|
|
400
400
|
* inside the border with room around it, and square when it holds only an icon.
|
|
401
401
|
* `sm` has no smaller step, so it stays `sm`.
|
|
402
402
|
*
|
|
403
|
-
* Pure, so it is
|
|
403
|
+
* Pure, so it is unit-testable. See AGENTS.md.
|
|
404
404
|
*/
|
|
405
405
|
export function resolveGroupButtonSize(size: InputSize, isIconOnly: boolean): ButtonSize {
|
|
406
406
|
const step = GROUP_BUTTON_STEP[size];
|
|
@@ -417,7 +417,7 @@ const GROUP_BUTTON_STEP: Record<InputSize, InputSize> = { sm: "sm", md: "sm", lg
|
|
|
417
417
|
* a quarter. `opacity-100` replaces that one utility through the button's own
|
|
418
418
|
* className merge, and leaves the rest of its disabled treatment alone.
|
|
419
419
|
*
|
|
420
|
-
* Pure, so it is
|
|
420
|
+
* Pure, so it is unit-testable. See AGENTS.md.
|
|
421
421
|
*/
|
|
422
422
|
export function resolveGroupButtonClass({
|
|
423
423
|
isDisabled,
|
|
@@ -448,7 +448,7 @@ export type InputGroupSegment = "start" | "row" | "end";
|
|
|
448
448
|
* sections are known in the first render, so the box never draws one frame as a
|
|
449
449
|
* row and the next as a column.
|
|
450
450
|
*
|
|
451
|
-
* Pure, so it is
|
|
451
|
+
* Pure, so it is unit-testable. See AGENTS.md.
|
|
452
452
|
*/
|
|
453
453
|
export function resolveGroupSegments(kinds: readonly InputGroupChildKind[]): InputGroupSegment[] {
|
|
454
454
|
const first = kinds.indexOf("content");
|
|
@@ -468,7 +468,7 @@ export function resolveGroupSegments(kinds: readonly InputGroupChildKind[]): Inp
|
|
|
468
468
|
/**
|
|
469
469
|
* The `accent-*` class uniwind resolves the placeholder colour from.
|
|
470
470
|
*
|
|
471
|
-
* Pure, so it is
|
|
471
|
+
* Pure, so it is unit-testable. See AGENTS.md.
|
|
472
472
|
*/
|
|
473
473
|
export function resolvePlaceholderAccentClass(className?: string): string {
|
|
474
474
|
return cn(INPUT_PLACEHOLDER_ACCENT_CLASS, className);
|
|
@@ -481,7 +481,7 @@ export function resolvePlaceholderAccentClass(className?: string): string {
|
|
|
481
481
|
* still legible while the value is being corrected — the moment the border is
|
|
482
482
|
* the only thing carrying it. A caller's class still wins.
|
|
483
483
|
*
|
|
484
|
-
* Pure, so it is
|
|
484
|
+
* Pure, so it is unit-testable. See AGENTS.md.
|
|
485
485
|
*/
|
|
486
486
|
export function resolveSelectionAccentClass({
|
|
487
487
|
className,
|
|
@@ -49,7 +49,7 @@ A row of media, text and actions, for lists and settings. Compound root plus
|
|
|
49
49
|
its text and its divider out of line. The tests assert the item's `min-h`,
|
|
50
50
|
`gap`, `px` and `py` against `listGroupVariants().item()` at every size, and
|
|
51
51
|
the bare media icon against the group's `prefixIcon` — change one without the
|
|
52
|
-
other and `bun test` fails by name
|
|
52
|
+
other and they drift apart<!-- registry:omit --> — `bun test` fails by name<!-- /registry:omit -->.
|
|
53
53
|
- **Pressable only with a handler.** `resolveItemRender` returns one of two:
|
|
54
54
|
`pressable` (a handler — a `Pressable`, role `button`, children merged into
|
|
55
55
|
one accessible element; disabled, it keeps the role, reports `disabled` and
|
|
@@ -97,7 +97,8 @@ A row of media, text and actions, for lists and settings. Compound root plus
|
|
|
97
97
|
rebuilt the children as an array. Under `asChild` nothing is wrapped at all;
|
|
98
98
|
without it, a lone element still comes back as that same element, not a
|
|
99
99
|
re-keyed copy or a one-item array. Text under `asChild` is the caller's to
|
|
100
|
-
wrap — `Slot` cannot pass props to a string.
|
|
101
|
-
holds the single-element,
|
|
100
|
+
wrap — `Slot` cannot pass props to a string.
|
|
101
|
+
<!-- registry:omit -->`wrap-text-children.test.ts` holds the single-element,
|
|
102
|
+
`asChild`, string and mixed cases.<!-- /registry:omit -->
|
|
102
103
|
- **Text colour goes on the text.** No slot but `title` and `description` holds
|
|
103
104
|
a `text-*` colour; the tests assert the root never does.
|