@flood-md/agent 0.2.2 → 0.2.3

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/DESIGN.md CHANGED
@@ -1,9 +1,19 @@
1
- # Flood design system · 0.2.2
1
+ # Flood design system · 0.2.3
2
+
3
+ Read project-root flood.json and installed declarations with this contract.
4
+ The source bundle's SKILL.md routes to focused composition, accessibility,
5
+ customization and verification references. Its routing matrix names prerequisites
6
+ and sources of truth; flood/rules.json indexes observable checks. Read only the
7
+ relevant reference. This expanded bundle belongs to 0.2.3; existing installations
8
+ keep their matching guide set.
2
9
 
3
10
  React + TypeScript and Next.js App Router. Use this guide with matching installed
4
11
  Flood packages and flood.json. The source repository's release status does not
5
12
  grant permission to publish or assume a version is available on npm.
6
13
 
14
+ This guide covers all 37 exports in 0.2.3 and their layout refinements. Confirm
15
+ the matching installed declarations before using APIs absent from older versions.
16
+
7
17
  ## Connect
8
18
 
9
19
  Import @flood-md/react/styles.css once in the application entry or Next root
@@ -23,6 +33,13 @@ child. Keep server data fetching in server components.
23
33
  - Use CodeSnippet with a code string and optional action slot for commands or
24
34
  short examples. The host owns clipboard permission, feedback and errors;
25
35
  selectable wrapped code remains available when copying fails.
36
+ - Use source ScrollArea for deliberately constrained overflow, with a named
37
+ viewport and explicit height/maxHeight for vertical content. Ref/style/native
38
+ div props target the native viewport. Overlay rails sit above content without
39
+ a gutter; default contentInset="scrollbar" protects text with inner padding.
40
+ Use explicit "none" only with adequate host padding or intentional overlap.
41
+ Keep wheel/touch/keyboard behavior and native
42
+ forced-colors fallback. Confirm this export exists in installed declarations.
26
43
  - Use Stack and wrapping Inline. Gap and Surface padding keys are strings
27
44
  0/1/2/3/4/6/8/12. Parent layout owns spacing; avoid redundant cards and borders.
28
45
  - Sizes use rem, line heights ratios, tracking em. Do not impose a fixed root
@@ -34,18 +51,57 @@ child. Keep server data fetching in server components.
34
51
  - Use Link for navigation and Button for actions. Button defaults to type=button;
35
52
  set type=submit deliberately. Loading disables activation and sets aria-busy;
36
53
  retain meaningful visible text and let the host announce completion.
37
- - Input/Textarea use controlSize sm/md/lg/xl. Preserve Input's native size prop.
54
+ - Input/Textarea and source Select use controlSize sm/md/lg/xl. Preserve native
55
+ numeric size props. Select accepts native option/optgroup children and an
56
+ HTMLSelectElement ref. Single selection uses Flood's custom trigger/listbox,
57
+ with a native select form-value/ref bridge; never replace it with the OS popup.
58
+ Multiple or size>1 remains an inline native listbox, without a dropdown arrow.
59
+ For single selection, arrows/Home/End highlight, Enter/Space/Tab commits, and
60
+ Escape cancels; typeahead matches option labels. Preserve trigger focus and
61
+ aria-activedescendant rather than moving focus into each option. The ref remains
62
+ HTMLSelectElement; its focus() targets the trigger. In onChange, read the event's
63
+ currentTarget as the native select; retain name/required/defaultValue/form reset.
64
+ Supply ordinary text-labeled options/optgroups, not interactive option content.
38
65
  Field required forwards native required and adds a visible marker. Spread all
39
66
  callback props to preserve id, aria-describedby and aria-invalid. describedBy
40
67
  merges external description IDs with hint/error IDs.
41
68
  - Checkbox, Radio and Switch require visible labels and preserve native forms.
42
69
  Radio groups share a name and belong in a host fieldset/legend. Readonly and
43
70
  disabled are different states; explain unavailability outside disabled controls.
71
+ Select has no native readOnly state. Do not block its keyboard events to fake one.
44
72
  - IconSlot adapts host SVG artwork; without label it is decorative. IconButton
45
73
  requires a nonempty action label. Retain the external icon pack's license.
46
74
  - Surface elevation overlay is visual only: no portal, focus trap, dismissal or
47
75
  dialog semantics are implied. Layer tokens do not implement an overlay manager.
48
76
 
77
+ ## Layout rules
78
+
79
+ - Keep Button width intrinsic to its content. Use Inline for sibling actions;
80
+ opt into full width only for a deliberate host layout with inlineSize:100%.
81
+ Do not stretch every action because its parent is a grid or vertical stack.
82
+ - Inside a choice, keep the indicator a non-shrinking 1.125rem square and its
83
+ visible label .5rem away (8px at the reference root). Custom Checkbox/Radio
84
+ appearance still uses real native inputs; forced colors restores native marks.
85
+ - Separate independent choices with Inline gap="4" (1rem/16px at the reference
86
+ root). Inline's default gap="2" remains unchanged. Internal label gap and
87
+ parent group gap are separate decisions; do not conflate them.
88
+ - Center-align choice rows; keep each label close to its indicator. Do not use
89
+ space-between inside a Checkbox/Radio/Switch to push the label to the other edge.
90
+ - Give form/Field parents a responsive width such as min(100%,26rem), with
91
+ min-inline-size:0 in grid/flex contexts. Input/Textarea/Select fill that width.
92
+ Check the actual wrapper tree after adding FloodRoot or Surface; do not leave
93
+ fields trapped in an intrinsic-width wrapper.
94
+ - Build hierarchy with Heading, body/compact text, Field labels and supporting
95
+ helper text. Use gap4 within groups, gap6 between related groups, and wrap
96
+ action rows. Add surfaces for meaningful grouping, not around every control.
97
+ - Keep geometry in rem, line-height unitless and tracking em; preserve the host
98
+ root size. Check320px widths, enlarged text and user text-spacing overrides
99
+ instead of shrinking type or clipping labels to make the layout fit.
100
+
101
+ For inset shapes that share a contour (Select popup and highlighted rows),
102
+ derive inner radius as max(0, outer radius - padding - border width). Keep this
103
+ local to the composition; independent nested actions keep their own radii.
104
+
49
105
  ## Tokens and accessibility
50
106
 
51
107
  Use semantic --flood-sys-* roles inside FloodRoot; values are authored only in
@@ -54,7 +110,10 @@ Nested token scopes repeat both data-flood-foundations=neutral and
54
110
  data-flood-theme=dark attributes. Preserve independent surface, content, boundary,
55
111
  selection, feedback and focus roles rather than hardcoding component colors.
56
112
 
57
- The quiet field outline needs its stronger necessary boundary. Focus is 2px
113
+ Default controls use the quiet field.border role, without a second bottom edge or
114
+ inset shadow. Keep field.boundary as an explicit stronger alternative; do not apply
115
+ it to every ordinary control. Quiet defaults do not establish 3:1 non-text
116
+ contrast. Focus is 2px
58
117
  without offset; the configurable pink default is provisional. Keep focus visible
59
118
  with invalid and selected states. Do not mute a whole component through opacity
60
119
  to reduce one border. Never convey error, selection or status by color alone.
package/README.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @flood-md/agent
2
2
 
3
- Version-matched DESIGN.md and SKILL.md for Flood React/Next.js projects. The CLI
4
- copies these into owned project files. Read the installed guide before composing
5
- screens. These files grant no authority to publish or modify external services.
3
+ Version-matched guidance for Flood React/Next.js projects. Read the installed
4
+ contract before composing screens. The 0.2.3 reference bundle includes spacing
5
+ guidance, routing and observable rules. These files grant
6
+ no authority to modify external services.
7
+
8
+ | Source | Role |
9
+ | --- | --- |
10
+ | DESIGN.md | Shared versioned UI/component contract |
11
+ | SKILL.md | Short entry and task router |
12
+ | references/routing.md | Applicability, audience, prerequisites and governing source |
13
+ | references/composition.md | Screen/form composition workflow |
14
+ | references/spacing.md | Measured spacing, density, nested geometry and hit areas |
15
+ | references/accessibility.md | Interaction and perception checks |
16
+ | references/customization.md | Scoped semantic customization |
17
+ | references/verification.md | Evidence before reporting completion |
18
+ | rules.json | Stable rule IDs with conditions, sources and observable checks |
19
+ | manifest.json | Source → installed-path mapping used by the CLI |
20
+
21
+ CLI init copies every manifest entry into an unused owned path. Doctor checks
22
+ expected regular files without linked destinations. Neither tool rewrites host
23
+ instructions or proves agent compliance. The website serves these sources under
24
+ /agent/ after a build. Read only relevant references; installed declarations
25
+ govern available APIs. See [the human guide](../../docs/agents.md).
26
+
27
+ DESIGN.md includes concrete composition rules: intrinsic action widths,
28
+ responsive form parents, a close indicator/label pair, spacing between choices,
29
+ and keyboard/native form requirements. Always check the declarations of the
30
+ installed package before using APIs introduced by a later version.
31
+ See the user-facing [layout guide](../../docs/layout.md) for complete examples.
32
+
33
+ Manifest entry/rule guide paths identify package sources; manifest.files maps
34
+ them to project-root targets. installedEntry points directly to the project
35
+ skill. Keep manifest.version aligned with the package and DESIGN header.
package/SKILL.md CHANGED
@@ -1,19 +1,35 @@
1
1
  ---
2
2
  name: flood-ui
3
- description: Build React and Next.js interfaces with Flood 0.2 dark foundations, native controls and shared layout primitives. Use for Flood components, tokens, forms and composition.
3
+ description: Compose, customize or review React and Next.js interfaces using installed Flood components, tokens and form contracts. Use in a Flood project; not for unrelated frameworks or deployment.
4
4
  ---
5
5
 
6
- Read flood.json and flood/DESIGN.md first. Use matching installed package and CLI
7
- versions; run doctor when uncertain. Import @flood-md/react/styles.css once and
8
- compose new interfaces inside FloodRoot for explicit neutral/dark foundations.
6
+ ## Start with the installed project
9
7
 
10
- Use Text/Heading, Stack/Inline/Surface, Button/IconButton, Field/Input/Textarea
11
- and native Checkbox/Radio/Switch. Secondary standalone actions use subtle; ghost
12
- needs context. Keep associations, required/invalid semantics, keyboard focus,
13
- relative typography/spacing and responsive layout. Use host SVG icons through
14
- IconSlot and retain their licenses. Respect Next.js client boundaries.
8
+ Read the host instructions, package.json, flood.json and flood/DESIGN.md from
9
+ the project root. Installed declarations decide which APIs exist. A newer web
10
+ page or repository example does not add exports to an older package. Run the
11
+ matching installed CLI's doctor when versions or guide files are uncertain.
15
12
 
16
- Only use the API provided by the installed version. Preserve host instructions;
17
- do not introduce another component library, hardcode a parallel token system,
18
- or assume npm publication from the repository version. This skill does not
19
- authorize deployment, data deletion or sending host source elsewhere.
13
+ Import @flood-md/react/styles.css once; compose new dark interfaces in FloodRoot.
14
+ Use Flood's existing components before introducing a local adapter. Keep user
15
+ scope and host conventions; missing Flood behavior must be stated rather than
16
+ invented as a package API. No external component library or parallel token system.
17
+
18
+ ## Read only the relevant reference
19
+
20
+ | Work | Read next | Required result |
21
+ | --- | --- | --- |
22
+ | New screen, layout or form | [Composition](references/composition.md) | Existing primitives, correct host width and form ownership |
23
+ | Spacing, density, nested geometry or shifting previews | [Spacing](references/spacing.md) | Measured visual relationships and nonoverlapping interactive areas |
24
+ | Keyboard, validation, names or states | [Accessibility](references/accessibility.md) | Real interaction and associations preserved |
25
+ | Brand, colors or typography | [Customization](references/customization.md) | Scoped semantic overrides; unchanged behavior |
26
+ | Completion, regression or upgrade review | [Verification](references/verification.md) | Checks and limits reported against the actual host |
27
+ | Decide which document governs a change | [Routing and sources](references/routing.md) | Source of truth and prerequisites identified |
28
+
29
+ The project-root flood/rules.json lists stable rule IDs and their observable
30
+ checks; it is an index, not executable policy. At completion report which checks
31
+ ran, their result and any unverified behavior. Doctor checks installation only.
32
+ Guidance cannot guarantee an agent's compliance or certify application accessibility.
33
+
34
+ Preserve existing instructions and customized guides. This skill authorizes no
35
+ deployment, deletion, external messages or sending host source to other services.
package/manifest.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "entry": "SKILL.md",
4
+ "files": [
5
+ {
6
+ "source": "DESIGN.md",
7
+ "target": "flood/DESIGN.md",
8
+ "kind": "contract"
9
+ },
10
+ {
11
+ "source": "rules.json",
12
+ "target": "flood/rules.json",
13
+ "kind": "rules"
14
+ },
15
+ {
16
+ "source": "manifest.json",
17
+ "target": "flood/manifest.json",
18
+ "kind": "manifest"
19
+ },
20
+ {
21
+ "source": "SKILL.md",
22
+ "target": ".agents/skills/flood-ui/SKILL.md",
23
+ "kind": "skill"
24
+ },
25
+ {
26
+ "source": "references/routing.md",
27
+ "target": ".agents/skills/flood-ui/references/routing.md",
28
+ "kind": "reference"
29
+ },
30
+ {
31
+ "source": "references/composition.md",
32
+ "target": ".agents/skills/flood-ui/references/composition.md",
33
+ "kind": "reference"
34
+ },
35
+ {
36
+ "source": "references/accessibility.md",
37
+ "target": ".agents/skills/flood-ui/references/accessibility.md",
38
+ "kind": "reference"
39
+ },
40
+ {
41
+ "source": "references/customization.md",
42
+ "target": ".agents/skills/flood-ui/references/customization.md",
43
+ "kind": "reference"
44
+ },
45
+ {
46
+ "source": "references/verification.md",
47
+ "target": ".agents/skills/flood-ui/references/verification.md",
48
+ "kind": "reference"
49
+ },
50
+ {
51
+ "source": "references/spacing.md",
52
+ "target": ".agents/skills/flood-ui/references/spacing.md",
53
+ "kind": "reference"
54
+ }
55
+ ],
56
+ "version": "0.2.3",
57
+ "installedEntry": ".agents/skills/flood-ui/SKILL.md",
58
+ "pathBase": "source is package-relative; target is relative to the host project root"
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flood-md/agent",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "description": "Versioned Flood design instructions for coding agents.",
6
6
  "license": "MIT",
@@ -12,11 +12,17 @@
12
12
  "files": [
13
13
  "DESIGN.md",
14
14
  "SKILL.md",
15
+ "references",
16
+ "rules.json",
17
+ "manifest.json",
15
18
  "README.md"
16
19
  ],
17
20
  "exports": {
18
21
  "./DESIGN.md": "./DESIGN.md",
19
- "./SKILL.md": "./SKILL.md"
22
+ "./SKILL.md": "./SKILL.md",
23
+ "./manifest.json": "./manifest.json",
24
+ "./rules.json": "./rules.json",
25
+ "./references/*": "./references/*"
20
26
  },
21
27
  "publishConfig": {
22
28
  "access": "public"
@@ -0,0 +1,63 @@
1
+ # Preserve interaction and perception
2
+
3
+ Read the installed component contract before changing its behavior. Do not add
4
+ ARIA to replace functioning native semantics or describe behavior that is absent.
5
+
6
+ - Every field needs a visible associated label. Spread Field callback props;
7
+ preserve id, required, aria-describedby and aria-invalid. Hint/error content
8
+ must describe the field. A placeholder is not its label.
9
+ - Keep the visible 2px focus perimeter with zero offset, including invalid and
10
+ selected states. Focus should not move layout or create another noisy contour.
11
+ Verify the actual foreground/background when overriding its accent.
12
+ - Checkbox, Radio and Switch keep native inputs, values, reset and keyboard.
13
+ Radios share name and use a host fieldset/legend. Disabled and readOnly differ;
14
+ Select has no native readOnly behavior.
15
+ - If installed Select exists: single choice uses Flood's custom popup, not an OS
16
+ dropdown. Arrows/Home/End highlight; Enter/Space/Tab commits; Escape cancels.
17
+ The native select bridge owns the form/ref contract. Multiple or size>1 is an
18
+ inline listbox. Do not turn the option text into another interactive control.
19
+ - Name icon-only actions by their effect, not glyph. Keep decorative SVGs out of
20
+ accessible names. Loading disables activation; announce host completion/errors
21
+ separately. Explain disabled actions in text outside the disabled element.
22
+ - Evaluate text contrast using WCAG and APCA guidance with actual size, weight
23
+ and background. APCA does not replace applicable WCAG requirements. Decorative
24
+ separators differ from necessary control boundaries; never mute a whole
25
+ component with opacity just to soften a border.
26
+ - Root font sizing belongs to the host. Preserve rem geometry, text wrapping,
27
+ forced-colors indicators and reduced-motion preferences.
28
+
29
+ Test keyboard start-to-finish, focus visibility, labels and descriptions,
30
+ validation, native form reset, long text, 320px layout and root text enlargement.
31
+ An automated scanner alone cannot establish application accessibility or WCAG 3
32
+ conformance. Record what was actually checked; see [verification](verification.md).
33
+ ## Field status and read-only values
34
+
35
+ Use status on Field/Input/Textarea/Select for error, warning, success or info.
36
+ With Field, provide message and spread its callback props onto the Flood control.
37
+ Only error marks aria-invalid; warning/success/info are advisory. Existing error
38
+ or invalid takes precedence. Include a useful description instead of relying on
39
+ color alone. Status does not implement host validation or native constraints.
40
+
41
+ readOnly on text-like Input/Textarea prevents editing while preserving focus,
42
+ selection, copy and submission. Do not substitute disabled or apply readOnly to
43
+ Select/checkboxes. Explain the restriction. Preserve the solid accent focus even
44
+ when a read-only field uses a dashed resting perimeter.
45
+
46
+ External-label visibility: source Field/Fieldset hideLabel preserves the actual
47
+ label/legend and accessible name while removing its visual row. RadioGroup,
48
+ CheckboxGroup and SegmentedControl inherit it. Keep label/legend supplied and
49
+ textual; do not hide interactive label content. Use it only where surrounding
50
+ context supplies the visible meaning. Input/Textarea/Select/InputGroup configure
51
+ this on their Field wrapper, not the control. Placeholder never replaces naming;
52
+ choice option labels and button names have separate contracts. Available in 0.2.3.
53
+
54
+ Overlay source APIs: forward trigger render props/ref onto one actual button;
55
+ keep trigger mounted/visible. Tooltip is noninteractive text help, not the only
56
+ name/instruction; hover/focus opens, Escape dismisses, focus stays. Popover is a
57
+ named nonmodal dialog; outside/focus-leave/Escape close without trapping Tab.
58
+ Dialog uses native showModal and inert background, cycles focus, restores scroll
59
+ and opener. Escape dismisses the top layer; outside closing is independently
60
+ configurable. Provide a visible title and safe initialFocusRef when needed. Closed
61
+ Popover/Dialog children unmount; host owns persistent values and controlled open.
62
+ Modern native APIs required. DOM/theme scope stays intact; no body portal needed.
63
+ Available in 0.2.3.
@@ -0,0 +1,141 @@
1
+ # Compose an interface
2
+
3
+ For spacing, density or nested-geometry decisions, read [Spacing](spacing.md).
4
+ Measure the complete row geometry before adding a gap to repeated controls.
5
+
6
+ Start with content and the user's interaction. Use the installed exports shown
7
+ in flood/DESIGN.md; no invented props, new component library or copied registry.
8
+
9
+ 1. Choose semantic Heading levels independently of visual size. Text handles
10
+ supporting copy; keep the content hierarchy quieter than the primary task.
11
+ 2. Compose vertical rhythm with Stack and wrapping rows with Inline. Surface
12
+ represents a real container/elevation, not a wrapper around every element.
13
+ 3. Keep action widths intrinsic. A full-width action is an explicit host choice.
14
+ Controls fill a responsive form parent such as min(100%, 26rem); min-inline-size:0
15
+ belongs on constrained grid/flex children. Inspect the actual wrapper tree.
16
+ 4. Keep a choice glyph and its label together: .5rem within Checkbox/Radio/Switch;
17
+ use an explicit Inline gap="4" (1rem) between separate choices. Center the row;
18
+ never use space-between to pull a single label away from its indicator.
19
+ 5. Use Field's callback props on the control. Keep name/value/required/form/reset
20
+ behavior and wire submission/validation in the host. Button type defaults to
21
+ button, so choose submit/reset deliberately. Link navigates.
22
+ 6. Standalone secondary actions use subtle. Ghost needs an existing toolbar or
23
+ clear parent context. Loading must leave a meaningful action name.
24
+
25
+ In Next.js import CSS once in app/layout.tsx. State, event callbacks and Field's
26
+ function child belong in a client component. Keep serializable compositions on
27
+ the server where useful. Flood does not save data or define permissions.
28
+
29
+ Use IconSlot for host SVGs and IconButton for named icon-only actions. Retain
30
+ the icon license; slot dimensions must control the artwork. A local semantic
31
+ adapter such as @/ui/button may re-export Flood, but does not change React APIs.
32
+
33
+ Before handing off, inspect a real composed screen at narrow and wide widths,
34
+ not only isolated controls. See [verification](verification.md).
35
+
36
+ For constrained overflow, use installed ScrollArea when available. Set height or
37
+ maxHeight on its viewport, choose the needed axis, and provide a useful accessible
38
+ name. Rails overlay content with insets; keep essential content out of the rail
39
+ zone through the default `contentInset="scrollbar"`. Use explicit `"none"` only
40
+ when host padding already protects essential content, or overlap is intentional.
41
+ The engine
42
+ shortens rails near rounded clipping corners; do not add ad-hoc per-page rail
43
+ offsets. Do not hide native scrolling as a CSS-only
44
+ substitute for an overlay engine. Check wheel, touch, keyboard, thumb drag, resize
45
+ and RTL; preserve the native forced-colors fallback.
46
+
47
+ ## label and group foundations
48
+
49
+ Field already composes Label. Use standalone Label when assembling an associated
50
+ control outside Field; its required marker does not set native required. Keep IDs
51
+ unique. Use Fieldset and its legend for related controls, with hint/message/error
52
+ on the group and individual labels on each control. A disabled native fieldset
53
+ disables descendants except controls in its first legend. Fieldset does not own
54
+ selected values or replace a RadioGroup/CheckboxGroup selection contract. Preserve
55
+ these semantics in nested groups and native form submission.
56
+
57
+ ## selection groups
58
+
59
+ Use RadioGroup for one string value and CheckboxGroup for a string array. Supply
60
+ name, legend and options with unique values; disable individual options when
61
+ needed. Use value/onValueChange for host-controlled selection, or defaultValue
62
+ for local selection. RadioGroup required is native; validate CheckboxGroup
63
+ selection counts in the host. Read repeated checkbox form values with getAll.
64
+ The group forwards Fieldset descriptions/status and native form ownership.
65
+ Form reset restores uncontrolled defaults and preserves controlled values;
66
+ canceled reset is ignored and reset does not emit onValueChange.
67
+
68
+ ## connected controls
69
+
70
+ ButtonGroup contains direct Button/IconButton actions with compatible sizes and
71
+ an accessible group label. Tab navigation is ordinary; do not invent toolbar
72
+ arrow-key behavior. InputGroup wraps one native text-like Input; Field callback
73
+ props and ref target that input. start/end slots provide host-owned text/icons/
74
+ actions; they are not submitted values or labels. className/style own the wrapper.
75
+ Disable addon actions explicitly when the task needs it. Preserve a single field
76
+ perimeter and distinguish input focus from action focus. Use supported installed
77
+ exports; these constructs are available in 0.2.3.
78
+
79
+ Nested actions in InputGroup use the group's height and equal space-1 optical
80
+ insets, with inner radius = field radius minus inset. Button size still controls
81
+ text/icon/padding; do not compensate with extra margins. Touch targets may grow
82
+ the shell. Text-only addons keep the field's reading padding.
83
+
84
+ ButtonGroup accepts Button and named IconButton children, including mixed groups;
85
+ full separators follow its orientation. InputGroup start/end independently accept
86
+ short text, decorative icons or named actions. Plain addons are subtle; actions
87
+ keep action colors. Explain units in the label/description. Prefixes are not masks
88
+ or automatically submitted value fragments; compose complete values in the host.
89
+
90
+ Toggle is a pressed native action: keep its name stable, use pressed/onPressedChange
91
+ or defaultPressed, and label iconOnly artwork. ToggleGroup uses unique options
92
+ and string-array values in both single/multiple modes; single can be cleared.
93
+ Arrow/Home/End navigate focus; Enter/Space activate; ordinary Tab order remains.
94
+ Do not use these as form inputs, required radios or tabs. No automatic native
95
+ form reset/submission is provided. Default props initialize only; host state owns
96
+ controlled values. Available in 0.2.3.
97
+
98
+ SegmentedControl composes native RadioGroup for one value/mode: label, unique form
99
+ name and string-label options, with optional artwork. Use value/onValueChange or
100
+ defaultValue; it does not clear when the selected item is pressed again. Arrows
101
+ select, Home/End select endpoints, Space checks; Enter keeps native form behavior.
102
+ Native form/required/disabled/reset behavior remains. Use actual tabs for panels,
103
+ not SegmentedControl. Choose short labels, icons or vertical orientation for
104
+ constrained widths; fullWidth distributes segments equally. iconOnly retains
105
+ accessible option labels. Available in 0.2.3.
106
+
107
+ Collapsible: title + children, open/onOpenChange or defaultOpen. Accordion composes
108
+ Collapsible via unique value/title/content items; string-array selection in single
109
+ (one or none) or multiple expansionMode. Choose headingLevel for host structure.
110
+ Enter/Space activate; Accordion Up/Down/Home/End focus enabled top-level headers,
111
+ not nested disclosures. Panels stay mounted and hidden, so form values and native
112
+ constraints persist. Disabled only prevents trigger activation. Programmatic
113
+ closing returns panel focus to an enabled trigger if focus has not moved elsewhere;
114
+ host owns focus for removed/disabled triggers. Only chevron motion, reduced-motion
115
+ aware; no height animation or per-panel landmark flood. Available in 0.2.3.
116
+
117
+ Tooltip/Popover/Dialog: trigger is a render function; forward every
118
+ supplied prop/ref to one connected visible Button in the same document. Tooltip
119
+ content is text only. Use Popover for interactive contextual UI and Dialog for a
120
+ modal task. Controlled open/onOpenChange needs host updates; initial defaults are
121
+ not synchronization. Closed Popover/Dialog children unmount, so keep persistent
122
+ form values in host state. initialFocusRef chooses a safe element in the panel;
123
+ closeLabel localizes the explicit close action. Native top-layer APIs preserve
124
+ FloodRoot theme scope without body portals. Avoid overriding positioning fields.
125
+ Native Popover/dialog support is required, no legacy polyfill. Available in 0.2.3.
126
+
127
+ Link defaults to text; opt-in solid/subtle/outline/ghost and
128
+ Button sizes share the button recipe without changing native anchor semantics.
129
+ Use href/target for navigation, Button for actions; never nest the two or add
130
+ role=button. Link has no disabled/loading contract. Available in 0.2.3.
131
+ Tabs switches linked content panels (not modes or radio values) on a shared
132
+ contained surface. Avoid a second enclosing card inside the panel; selected fill
133
+ joins the panel without an additional underline. Arrows activate by default,
134
+ or focus only with activationMode=manual; Enter/Space commit. One tab
135
+ stop, RTL/orientation aware, disabled skip. Panels stay mounted/hidden and retain
136
+ native form constraints. Controlled/missing/disabled selected values derive first
137
+ available; host reconciles values. Breadcrumb is an ordered native link hierarchy,
138
+ last item current. Pagination is controlled page/pageCount with onPageChange or
139
+ getHref; host owns data/routes and empty states. Counts must be positive safe
140
+ integers in range; siblingCount 0/1/2 bounds window size. Native modifier navigation,
141
+ localized names, unavailable endpoints and narrow wrapping stay intact. Available in 0.2.3.
@@ -0,0 +1,27 @@
1
+ # Customize without a parallel system
2
+
3
+ Use FloodRoot for the neutral/dark foundations profile. The new light foundations
4
+ profile is not supplied; do not infer it from legacy controls outside FloodRoot.
5
+
6
+ Read the installed @flood-md/tokens foundation manifest and matching DESIGN.md.
7
+ Override semantic --flood-sys-* variables on a deliberate host scope after the
8
+ Flood stylesheet. Reuse existing content, surface, state, typography, spacing,
9
+ radius and control roles before adding a local application token. State which
10
+ role changes, why and which components consume it.
11
+
12
+ Do not edit generated node_modules assets, paste a second raw color scale into
13
+ components or invent unsupported token names. In the Flood source repository,
14
+ tokens are authored only in packages/tokens/src/tokens.json; generated files
15
+ are outputs. A consuming application's overrides remain application-owned.
16
+
17
+ Keep reference values separate from semantic roles. Component recipes consume
18
+ roles, and screen composition consumes components. An accent/material experiment
19
+ must be scoped; it must not silently alter ordinary fields, text or focus.
20
+
21
+ Keep layout/typography in rem, role line heights and tracking intact unless the
22
+ task explicitly changes them. Never impose a root 16px or 62.5% reset. Bundled
23
+ Inter retains its OFL notice; external icon/font assets keep their own notices.
24
+
25
+ Verify resolved token values, all affected states and surfaces, WCAG/APCA text
26
+ context, focus/non-text contrast, forced colors, narrow layout and text scaling.
27
+ An attractive default screenshot does not validate an override across a product.
@@ -0,0 +1,26 @@
1
+ # Route work to its source
2
+
3
+ Read the host's instructions before Flood guidance. User requirements define the
4
+ task; Flood's contracts explain supported implementation. These files do not
5
+ override user authority or grant permission for unrelated operations.
6
+
7
+ | Question / when | Audience | Prerequisite | Source of truth | Verify with |
8
+ | --- | --- | --- | --- | --- |
9
+ | Which API can I import? Every component edit | Developer / agent | Installed exact versions | Installed @flood-md/react declarations; flood.json | Type-check host imports; CLI doctor for alignment |
10
+ | What does this release mean? Setup / upgrade | Developer / agent | Matching guide | flood/DESIGN.md, package changelog | Compare version and declarations; preserve host edits |
11
+ | How should a screen fit together? Screen / form work | Designer / developer / agent | Scope, content and current API | composition.md; host layout requirements | Narrow/wide rendered screen and native form interaction |
12
+ | Why does spacing look wrong? Density / nested geometry | Designer / developer / agent | Installed tokens and actual wrapper tree | spacing.md; host content hierarchy | Measured visible gaps, row pitch, text reflow and touch targets |
13
+ | What must remain accessible? Control/state work | Developer / reviewer / agent | Named controls and actual host context | accessibility.md; installed component contract | Keyboard, accessible names, validation and focus checks |
14
+ | How can appearance change? Theme / density work | Designer / developer / agent | Existing semantic roles | customization.md; installed token manifest | Inspect resolved roles, contrast and reflow |
15
+ | Is this done? Completion / regression | Reviewer / agent | Runnable host and checks | verification.md; project scripts | Report commands, manual checks and gaps |
16
+ | Which rules apply? Planning / review | Human / agent / tooling | Same installed guide set | flood/rules.json | Rule IDs linked to evidence, not a blanket pass |
17
+
18
+ References are beside this file. In an initialized project the contract and
19
+ rules are under project-root flood/. On the website these files are under
20
+ /agent/references/ and /agent/. Use installed files for existing applications;
21
+ the deployed website describes its own source/release status.
22
+
23
+ For exact per-component examples and API tables, read the matching component
24
+ Markdown page. Do not load every component page or all references by default.
25
+ Public source catalog/declarations generate website API tables during builds;
26
+ the website is not a replacement for the host's installed declarations.
@@ -0,0 +1,61 @@
1
+ # Spacing, density and nested geometry
2
+
3
+ Use this guide when composing Flood controls or correcting excessive gaps,
4
+ inconsistent grouping or shifting previews. Start with host instructions, the
5
+ installed declarations and token manifest. User-approved geometry takes precedence
6
+ over a generic recipe; newer website examples do not add APIs to an older package.
7
+
8
+ ## Identify the relationship
9
+
10
+ Decide what each space separates: an indicator and its label, a title and its
11
+ description, choices in one group, independent actions, sections or nested surfaces.
12
+ Keep related content together and give unrelated sections a stronger separation.
13
+ One gap value should not be repeated indiscriminately through nested wrappers.
14
+
15
+ | Relationship | Starting point; check the installed recipe |
16
+ | --- | --- |
17
+ | Indicator and its own label | Existing choice component geometry; do not add another wrapper gap |
18
+ | Title and supporting description | A close pair, typically space-1 in the current Fieldset recipe |
19
+ | Repeated choices | Group row height already provides separation; inspect it before adding gap |
20
+ | Separate horizontal actions | Explicit parent spacing; space-4 is a starting point |
21
+ | Sections | Host content hierarchy and available width |
22
+
23
+ These are contextual defaults rather than a universal scale. Prefer supported
24
+ Stack/Inline spacing props and scoped semantic tokens. Host layout CSS owns host
25
+ spacing. Do not edit installed package files or invent unavailable component props
26
+ to change density. Use relative units and preserve the host's root font size.
27
+
28
+ ## Measure visible geometry
29
+
30
+ Inspect the rendered interface, wrapper tree and computed gap, padding, margin,
31
+ line-height, minimum height and alignment. Measure the visible indicator/text as
32
+ well as the full interactive row. A zero flex gap can still look widely spaced.
33
+
34
+ For equal centered rows, indicator separation is approximately row height minus
35
+ indicator height plus row gap. A 40px row plus an 8px gap creates 48px row pitch;
36
+ the gap declaration alone does not describe perceived density. Those numbers
37
+ illustrate the calculation, not a fixed recipe for every installed release.
38
+
39
+ Remove redundant space at its owning layer. Preserve explicit icon dimensions,
40
+ the relationship between indicator and label, and independent form semantics.
41
+ Avoid negative margins or transforms that conceal a layout problem or overlap
42
+ click targets. For nested surfaces, compare inner radius with outer radius minus
43
+ padding and stroke; independent controls retain their own radius recipe.
44
+
45
+ ## Check the composition
46
+
47
+ - Inspect short and wrapping labels, narrow/wide widths and larger root text.
48
+ Rows may grow for content; do not clip text to enforce a compact height.
49
+ - Check hint, error, status, loading and disabled cases where applicable.
50
+ Different content must not unexpectedly reposition an unrelated demo control.
51
+ - Distinguish the component from its preview host. Fixed scenes and reserved
52
+ message rows belong to a demo when needed, not automatically to a host product.
53
+ - Check fine and coarse pointers separately. Compact mouse geometry must preserve
54
+ the supported touch-target minimum and nonoverlapping hit areas on touch.
55
+ - Recheck keyboard focus, label activation and a sibling that shares the recipe.
56
+
57
+ Use actual screenshots and measured geometry to judge the result. Follow the
58
+ host's verification workflow; add a regression check for a repeated failure rather
59
+ than a test that merely repeats a CSS declaration. Report what was measured and
60
+ what remains unverified. See [accessibility](accessibility.md) and
61
+ [verification](verification.md) for related contracts.
@@ -0,0 +1,28 @@
1
+ # Verify the actual change
2
+
3
+ Use the host's scripts and conventions; do not assume Flood's repository scripts
4
+ exist in a consumer. Run the matching CLI doctor for version/file alignment when
5
+ setup or upgrades changed. Doctor does not parse CSS imports or certify UI.
6
+
7
+ | Change | Evidence needed |
8
+ | --- | --- |
9
+ | Imports / package upgrade | Host type-check/build; installed versions and declarations match |
10
+ | Form / control behavior | Labels/descriptions, keyboard, value/submission, required/invalid, reset, disabled/loading and focus |
11
+ | Layout / typography | Actual narrow and wide screen, long content, root 24px text sizing and increased text spacing; no accidental page overflow |
12
+ | Appearance / tokens | Resolved roles and actual surfaces/states; contrast, focus, forced colors and reduced motion |
13
+ | Copy / external actions | Exact clipboard payload where applicable; honest local/saved/sent state and error feedback |
14
+
15
+ For visual changes capture and inspect the rendered screen. A passing build does
16
+ not show alignment, hierarchy or wrapping. Use meaningful existing browser tests
17
+ and an accessibility scanner when available; also perform keyboard checks.
18
+
19
+ In the Flood source repository run npm run verify, and browser tests for changed
20
+ behavior/styles. In a consuming project use its equivalent checks. Report commands
21
+ run and results, manual visual/keyboard checks, and anything left unverified.
22
+ Use rule IDs from project-root flood/rules.json when useful to connect findings
23
+ to the specific contract. Do not report a rule as tested from prose alone.
24
+
25
+ Never infer npm publication, a deployment or a backend save from a local build.
26
+ Updating an installed guide is a review/merge task: preserve customized files;
27
+ do not rerun init to overwrite them. No reference grants authority to deploy,
28
+ delete data or transmit private source.
package/rules.json ADDED
@@ -0,0 +1,184 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "scope": "Installed Flood React/Next.js projects",
4
+ "rules": [
5
+ {
6
+ "id": "api.installed",
7
+ "when": "Importing or changing Flood APIs",
8
+ "for": [
9
+ "developer",
10
+ "agent"
11
+ ],
12
+ "requires": [
13
+ "Host package.json",
14
+ "flood.json"
15
+ ],
16
+ "sourceOfTruth": "Installed @flood-md/react declarations",
17
+ "guide": "references/routing.md",
18
+ "verify": [
19
+ "Host type-check",
20
+ "Matching CLI doctor for package alignment"
21
+ ]
22
+ },
23
+ {
24
+ "id": "composition.primitives",
25
+ "when": "Composing screens or forms",
26
+ "for": [
27
+ "designer",
28
+ "developer",
29
+ "agent"
30
+ ],
31
+ "requires": [
32
+ "Supported installed exports",
33
+ "User interaction requirements"
34
+ ],
35
+ "sourceOfTruth": "DESIGN.md",
36
+ "guide": "references/composition.md",
37
+ "verify": [
38
+ "Rendered narrow/wide screen",
39
+ "Intrinsic actions and responsive form parent",
40
+ "Close choice label and independent group spacing"
41
+ ]
42
+ },
43
+ {
44
+ "id": "forms.associations",
45
+ "when": "Changing fields or submission",
46
+ "for": [
47
+ "developer",
48
+ "reviewer",
49
+ "agent"
50
+ ],
51
+ "requires": [
52
+ "Visible labels",
53
+ "Host validation and submission flow"
54
+ ],
55
+ "sourceOfTruth": "Installed Field/control contract",
56
+ "guide": "references/accessibility.md",
57
+ "verify": [
58
+ "Accessible names and descriptions",
59
+ "Native values, required and reset",
60
+ "Invalid focus and disabled/loading behavior"
61
+ ]
62
+ },
63
+ {
64
+ "id": "interaction.keyboard",
65
+ "when": "Changing interactive controls",
66
+ "for": [
67
+ "developer",
68
+ "reviewer",
69
+ "agent"
70
+ ],
71
+ "requires": [
72
+ "Runnable screen",
73
+ "Installed control keyboard contract"
74
+ ],
75
+ "sourceOfTruth": "Installed component behavior and DESIGN.md",
76
+ "guide": "references/accessibility.md",
77
+ "verify": [
78
+ "Keyboard-only full interaction",
79
+ "Visible focus in every relevant state",
80
+ "Select commit/cancel if present"
81
+ ]
82
+ },
83
+ {
84
+ "id": "theme.semantic",
85
+ "when": "Customizing visual roles",
86
+ "for": [
87
+ "designer",
88
+ "developer",
89
+ "agent"
90
+ ],
91
+ "requires": [
92
+ "Installed token manifest",
93
+ "Actual affected surfaces"
94
+ ],
95
+ "sourceOfTruth": "Installed token roles; source tokens.json when developing Flood",
96
+ "guide": "references/customization.md",
97
+ "verify": [
98
+ "Resolved scoped semantic values",
99
+ "Text and non-text contrast",
100
+ "No parallel raw palette"
101
+ ]
102
+ },
103
+ {
104
+ "id": "layout.reflow",
105
+ "when": "Changing layout or type",
106
+ "for": [
107
+ "designer",
108
+ "reviewer",
109
+ "agent"
110
+ ],
111
+ "requires": [
112
+ "Actual composed screen"
113
+ ],
114
+ "sourceOfTruth": "DESIGN.md and host content requirements",
115
+ "guide": "references/composition.md",
116
+ "verify": [
117
+ "320px width",
118
+ "Root 24px and increased text spacing",
119
+ "No glyph shrink or unintended page overflow"
120
+ ]
121
+ },
122
+ {
123
+ "id": "verification.evidence",
124
+ "when": "Reporting completion",
125
+ "for": [
126
+ "developer",
127
+ "reviewer",
128
+ "agent"
129
+ ],
130
+ "requires": [
131
+ "Host verification scripts",
132
+ "Task scope"
133
+ ],
134
+ "sourceOfTruth": "Observed command and rendered behavior results",
135
+ "guide": "references/verification.md",
136
+ "verify": [
137
+ "Commands and actual results recorded",
138
+ "Manual checks distinguished",
139
+ "Untested behavior stated"
140
+ ]
141
+ },
142
+ {
143
+ "id": "installation.preserve",
144
+ "when": "Installing or updating guidance",
145
+ "for": [
146
+ "developer",
147
+ "agent"
148
+ ],
149
+ "requires": [
150
+ "Existing host instructions",
151
+ "User scope"
152
+ ],
153
+ "sourceOfTruth": "Host files and version-matched guide set",
154
+ "guide": "references/routing.md",
155
+ "verify": [
156
+ "Existing files preserved",
157
+ "No linked destinations followed",
158
+ "No publication inferred from source version"
159
+ ]
160
+ },
161
+ {
162
+ "id": "layout.spacing",
163
+ "when": "Composing or reviewing spacing, density, nested surfaces or moving previews",
164
+ "for": [
165
+ "designer",
166
+ "developer",
167
+ "agent"
168
+ ],
169
+ "requires": [
170
+ "Installed token manifest",
171
+ "Rendered host and actual wrapper tree"
172
+ ],
173
+ "sourceOfTruth": "Installed component recipe and host layout requirements",
174
+ "guide": "references/spacing.md",
175
+ "verify": [
176
+ "Measure visible gaps and row pitch, including padding and minimum height",
177
+ "Check wrapping and enlarged text",
178
+ "Check fine/coarse pointers and nonoverlapping interactive targets",
179
+ "Preserve keyboard focus and label activation"
180
+ ]
181
+ }
182
+ ],
183
+ "guideResolution": "Match guide to source in manifest.files; use its target relative to the host project root."
184
+ }