@flood-md/react 0.2.0 → 0.2.2

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Original React 18.3/19 components for TypeScript and Next.js App Router. Native
4
4
  HTML semantics and refs, no third-party component library or Tailwind dependency.
5
5
 
6
- This package documents the **0.2.0** API. Keep Flood package versions aligned
6
+ This package documents the **0.2.2** API. Keep Flood package versions aligned
7
7
  and follow the guide matching your installed version.
8
8
 
9
9
  ```tsx
@@ -29,11 +29,20 @@ radii, control sizes and state recipes. No new light foundations profile is
29
29
  included. Legacy controls outside FloodRoot keep their earlier theme behavior.
30
30
 
31
31
  Exports: FloodRoot, Text, Heading, Stack, Inline, Surface, Divider, IconSlot,
32
- IconButton, Button, Input, Textarea, Checkbox, Radio, Switch, Field and Link,
32
+ IconButton, CodeSnippet, Button, Input, Textarea, Checkbox, Radio, Switch, Field and Link,
33
33
  plus TypeScript prop types. Button variants are solid/subtle/outline/ghost;
34
34
  sizes are 2xs/xs/sm/md/lg/xl/2xl. Prefer subtle for standalone secondary actions;
35
35
  ghost belongs in a clear parent context. Loading disables activation.
36
36
 
37
+ Heading adds `size="display"` for large marketing headings: 5.5rem / 1.12,
38
+ weight 500, tracking -.04em. Existing heading sizes retain their metrics.
39
+ Text adds `size="lead"` for introductory copy: 1.375rem / 1.45, weight 400,
40
+ tracking -.01em. The body role remains unchanged.
41
+ CodeSnippet takes required `code: string`, optional `action: ReactNode` and
42
+ native div props/ref. It escapes/selects/wraps code and uses the semantic mono
43
+ font stack; the host owns copy actions and status messages. Both additions are
44
+ compatible extensions in 0.2.2; they do not replace existing defaults.
45
+
37
46
  Input/Textarea controlSize is sm/md/lg/xl; native Input size is preserved.
38
47
  Field uses `{props => <Input {...props} />}`. Its required prop forwards native
39
48
  required and displays a marker; describedBy merges external IDs with hint/error
@@ -41,6 +41,32 @@
41
41
  .flood-root .flood-tone--info { color: var(--flood-sys-color-feedback-info); }
42
42
  .flood-root .flood-stack { display: flex; flex-direction: column; gap: var(--flood-layout-gap); min-inline-size: 0; }
43
43
  .flood-root .flood-inline { display: flex; flex-wrap: wrap; gap: var(--flood-layout-gap); min-inline-size: 0; }
44
+ .flood-root .flood-code-snippet {
45
+ box-sizing: border-box;
46
+ display: flex;
47
+ flex-wrap: wrap;
48
+ align-items: center;
49
+ gap: var(--flood-sys-space-2);
50
+ min-inline-size: 0;
51
+ padding: var(--flood-sys-space-3) var(--flood-sys-space-4);
52
+ border: var(--flood-sys-stroke-width) solid var(--flood-sys-color-border-decorative);
53
+ border-radius: var(--flood-sys-radius-field);
54
+ background: var(--flood-sys-color-surface-default);
55
+ color: var(--flood-sys-color-content-default);
56
+ }
57
+ .flood-root .flood-code-snippet__code {
58
+ flex: 1;
59
+ min-inline-size: 0;
60
+ font-family: var(--flood-sys-font-mono);
61
+ font-size: var(--flood-sys-type-compact-size);
62
+ font-weight: var(--flood-sys-type-compact-weight);
63
+ line-height: var(--flood-sys-type-compact-line-height);
64
+ letter-spacing: normal;
65
+ white-space: pre-wrap;
66
+ overflow-wrap: anywhere;
67
+ user-select: text;
68
+ }
69
+ .flood-root .flood-code-snippet__action { flex: none; }
44
70
  .flood-root .flood-surface {
45
71
  box-sizing: border-box;
46
72
  border-radius: var(--flood-sys-radius-block);
@@ -85,7 +111,7 @@
85
111
  }
86
112
  .flood-root .flood-button--outline { border-color: var(--flood-sys-color-field-boundary); }
87
113
  .flood-root .flood-icon-button { min-inline-size: var(--flood-control-height); padding: var(--flood-sys-space-1); }
88
- .flood-root .flood-icon { display: inline-flex; flex: none; inline-size: var(--flood-icon-size); block-size: var(--flood-icon-size); color: inherit; }
114
+ .flood-root .flood-icon { display: inline-flex; align-items: center; justify-content: center; line-height: 1; flex: none; inline-size: var(--flood-icon-size); block-size: var(--flood-icon-size); color: inherit; }
89
115
  .flood-root .flood-icon > svg { display: block; inline-size: 100%; block-size: 100%; }
90
116
  .flood-root .flood-input {
91
117
  display: block;
@@ -151,6 +177,18 @@
151
177
  }
152
178
 
153
179
  /* Role recipes keep every value in the authored token source. */
180
+ .flood-root .flood-type--lead {
181
+ --flood-type-size: var(--flood-sys-type-lead-size);
182
+ --flood-type-line: var(--flood-sys-type-lead-line-height);
183
+ --flood-type-tracking: var(--flood-sys-type-lead-tracking);
184
+ --flood-type-weight: var(--flood-sys-type-lead-weight);
185
+ }
186
+ .flood-root .flood-type--display {
187
+ --flood-type-size: var(--flood-sys-type-display-size);
188
+ --flood-type-line: var(--flood-sys-type-display-line-height);
189
+ --flood-type-tracking: var(--flood-sys-type-display-tracking);
190
+ --flood-type-weight: var(--flood-sys-type-display-weight);
191
+ }
154
192
  .flood-root .flood-type--large {
155
193
  --flood-type-size: var(--flood-sys-type-large-size);
156
194
  --flood-type-line: var(--flood-sys-type-large-line-height);
package/dist/index.d.ts CHANGED
@@ -43,13 +43,13 @@ export declare const Link: import("react").ForwardRefExoticComponent<AnchorHTMLA
43
43
  export declare const FloodRoot: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
44
44
  export interface TextProps extends HTMLAttributes<HTMLElement> {
45
45
  as?: "span" | "p" | "div";
46
- size?: "body" | "compact" | "label" | "helper";
46
+ size?: "lead" | "body" | "compact" | "label" | "helper";
47
47
  tone?: "default" | "subtle" | "error" | "success" | "warning" | "info";
48
48
  }
49
49
  export declare const Text: import("react").ForwardRefExoticComponent<TextProps & import("react").RefAttributes<HTMLElement>>;
50
50
  export interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {
51
51
  level?: 1 | 2 | 3 | 4 | 5 | 6;
52
- size?: "large" | "page" | "section";
52
+ size?: "display" | "large" | "page" | "section";
53
53
  }
54
54
  export declare const Heading: import("react").ForwardRefExoticComponent<HeadingProps & import("react").RefAttributes<HTMLHeadingElement>>;
55
55
  export type Space = "0" | "1" | "2" | "3" | "4" | "6" | "8" | "12";
@@ -77,3 +77,9 @@ export interface IconButtonProps extends Omit<ButtonProps, "aria-label"> {
77
77
  }
78
78
  export declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
79
79
  export declare const Divider: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLHRElement> & import("react").RefAttributes<HTMLHRElement>>;
80
+ export interface CodeSnippetProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
81
+ code: string;
82
+ action?: ReactNode;
83
+ }
84
+ /** Selectable code with an optional host-owned action; no clipboard side effects. */
85
+ export declare const CodeSnippet: import("react").ForwardRefExoticComponent<CodeSnippetProps & import("react").RefAttributes<HTMLDivElement>>;
package/dist/index.js CHANGED
@@ -64,3 +64,7 @@ export const IconButton = forwardRef(function IconButton({ label, size = "md", v
64
64
  export const Divider = forwardRef(function Divider({ className, ...props }, ref) {
65
65
  return _jsx("hr", { ...props, ref: ref, className: classes("flood-divider", className) });
66
66
  });
67
+ /** Selectable code with an optional host-owned action; no clipboard side effects. */
68
+ export const CodeSnippet = forwardRef(function CodeSnippet({ code, action, className, ...props }, ref) {
69
+ return (_jsxs("div", { ...props, ref: ref, className: classes("flood-code-snippet", className), children: [_jsx("code", { className: "flood-code-snippet__code", children: code }), action != null && _jsx("div", { className: "flood-code-snippet__action", children: action })] }));
70
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flood-md/react",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "Original Flood components for React and Next.js.",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "react-dom": "^18.3.0 || ^19.0.0"
31
31
  },
32
32
  "dependencies": {
33
- "@flood-md/tokens": "0.2.0"
33
+ "@flood-md/tokens": "0.2.2"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"