@flood-md/react 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -10
- package/dist/fonts/InterVariable.woff2 +0 -0
- package/dist/fonts/LICENSE.txt +92 -0
- package/dist/fonts/README.md +18 -0
- package/dist/foundations.css +296 -0
- package/dist/index.d.ts +48 -4
- package/dist/index.js +38 -8
- package/dist/styles.css +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,18 +1,50 @@
|
|
|
1
1
|
# @flood-md/react
|
|
2
2
|
|
|
3
|
-
Original
|
|
3
|
+
Original React 18.3/19 components for TypeScript and Next.js App Router. Native
|
|
4
|
+
HTML semantics and refs, no third-party component library or Tailwind dependency.
|
|
5
|
+
|
|
6
|
+
This package documents the **0.2.0** API. Keep Flood package versions aligned
|
|
7
|
+
and follow the guide matching your installed version.
|
|
4
8
|
|
|
5
9
|
```tsx
|
|
6
10
|
import "@flood-md/react/styles.css";
|
|
7
|
-
import { Button,
|
|
11
|
+
import { Button, FloodRoot, Heading, Stack, Text } from "@flood-md/react";
|
|
12
|
+
|
|
13
|
+
export function Welcome() {
|
|
14
|
+
return (
|
|
15
|
+
<FloodRoot>
|
|
16
|
+
<Stack gap="4">
|
|
17
|
+
<Heading level={1}>Welcome</Heading>
|
|
18
|
+
<Text as="p" size="compact">Your workspace is ready.</Text>
|
|
19
|
+
<Button>Open workspace</Button>
|
|
20
|
+
</Stack>
|
|
21
|
+
</FloodRoot>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
8
24
|
```
|
|
9
25
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
26
|
+
FloodRoot selects the neutral dark foundations profile: locally bundled Inter
|
|
27
|
+
with its original SIL OFL notice, semantic colors, relative typography/spacing,
|
|
28
|
+
radii, control sizes and state recipes. No new light foundations profile is
|
|
29
|
+
included. Legacy controls outside FloodRoot keep their earlier theme behavior.
|
|
30
|
+
|
|
31
|
+
Exports: FloodRoot, Text, Heading, Stack, Inline, Surface, Divider, IconSlot,
|
|
32
|
+
IconButton, Button, Input, Textarea, Checkbox, Radio, Switch, Field and Link,
|
|
33
|
+
plus TypeScript prop types. Button variants are solid/subtle/outline/ghost;
|
|
34
|
+
sizes are 2xs/xs/sm/md/lg/xl/2xl. Prefer subtle for standalone secondary actions;
|
|
35
|
+
ghost belongs in a clear parent context. Loading disables activation.
|
|
36
|
+
|
|
37
|
+
Input/Textarea controlSize is sm/md/lg/xl; native Input size is preserved.
|
|
38
|
+
Field uses `{props => <Input {...props} />}`. Its required prop forwards native
|
|
39
|
+
required and displays a marker; describedBy merges external IDs with hint/error
|
|
40
|
+
associations. Checkbox/Radio/Switch require a visible label. IconSlot accepts
|
|
41
|
+
host SVG artwork without bundling an icon pack.
|
|
42
|
+
|
|
43
|
+
Import CSS once in Next app/layout.tsx. Add "use client" to host components
|
|
44
|
+
using state/callbacks or Field's function child. Override semantic --flood-sys-*
|
|
45
|
+
variables on the scope after the import. Surface overlay is visual elevation,
|
|
46
|
+
not dialog behavior. The focus accent remains configurable and provisional.
|
|
15
47
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
48
|
+
See [components](../../docs/components.md), [foundations](../../docs/foundations.md)
|
|
49
|
+
and [Inter provenance](src/fonts/README.md). Verify contrast, focus, keyboard,
|
|
50
|
+
narrow layouts and text scaling in your actual application.
|
|
Binary file
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
PREAMBLE
|
|
12
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
13
|
+
development of collaborative font projects, to support the font creation
|
|
14
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
15
|
+
open framework in which fonts may be shared and improved in partnership
|
|
16
|
+
with others.
|
|
17
|
+
|
|
18
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
19
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
20
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
21
|
+
redistributed and/or sold with any software provided that any reserved
|
|
22
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
23
|
+
however, cannot be released under any other type of license. The
|
|
24
|
+
requirement for fonts to remain under this license does not apply
|
|
25
|
+
to any document created using the fonts or their derivatives.
|
|
26
|
+
|
|
27
|
+
DEFINITIONS
|
|
28
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
29
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
30
|
+
include source files, build scripts and documentation.
|
|
31
|
+
|
|
32
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
33
|
+
copyright statement(s).
|
|
34
|
+
|
|
35
|
+
"Original Version" refers to the collection of Font Software components as
|
|
36
|
+
distributed by the Copyright Holder(s).
|
|
37
|
+
|
|
38
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
39
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
40
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
41
|
+
new environment.
|
|
42
|
+
|
|
43
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
44
|
+
writer or other person who contributed to the Font Software.
|
|
45
|
+
|
|
46
|
+
PERMISSION AND CONDITIONS
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
48
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
49
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
50
|
+
Software, subject to the following conditions:
|
|
51
|
+
|
|
52
|
+
1) Neither the Font Software nor any of its individual components,
|
|
53
|
+
in Original or Modified Versions, may be sold by itself.
|
|
54
|
+
|
|
55
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
56
|
+
redistributed and/or sold with any software, provided that each copy
|
|
57
|
+
contains the above copyright notice and this license. These can be
|
|
58
|
+
included either as stand-alone text files, human-readable headers or
|
|
59
|
+
in the appropriate machine-readable metadata fields within text or
|
|
60
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
61
|
+
|
|
62
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
63
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
64
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
65
|
+
presented to the users.
|
|
66
|
+
|
|
67
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
68
|
+
Software shall not be used to promote, endorse or advertise any
|
|
69
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
70
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
71
|
+
permission.
|
|
72
|
+
|
|
73
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
74
|
+
must be distributed entirely under this license, and must not be
|
|
75
|
+
distributed under any other license. The requirement for fonts to
|
|
76
|
+
remain under this license does not apply to any document created
|
|
77
|
+
using the Font Software.
|
|
78
|
+
|
|
79
|
+
TERMINATION
|
|
80
|
+
This license becomes null and void if any of the above conditions are
|
|
81
|
+
not met.
|
|
82
|
+
|
|
83
|
+
DISCLAIMER
|
|
84
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
87
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
88
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
89
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
90
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
91
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
92
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Inter font asset
|
|
2
|
+
|
|
3
|
+
`InterVariable.woff2` is an unmodified third-party font by the Inter Project
|
|
4
|
+
Authors, distributed under the [SIL Open Font License 1.1](LICENSE.txt).
|
|
5
|
+
It is not original Flood artwork. Retain the license with redistributed copies.
|
|
6
|
+
|
|
7
|
+
- Official source: <https://github.com/rsms/inter/releases/tag/v4.1>
|
|
8
|
+
- Archive: <https://github.com/rsms/inter/releases/download/v4.1/Inter-4.1.zip>
|
|
9
|
+
- Archive member: `web/InterVariable.woff2`
|
|
10
|
+
- Font internal version: `Version 4.001;git-9221beed3`
|
|
11
|
+
- Variable axes: weight 100–900; optical size 14–32.
|
|
12
|
+
- SHA-256: `693b77d4f32ee9b8bfc995589b5fad5e99adf2832738661f5402f9978429a8e3`
|
|
13
|
+
- License SHA-256: `262481e844521b326f5ecd053e59b98c8b2da78c8ee1bdbb6e8174305e54935a`
|
|
14
|
+
|
|
15
|
+
The full upstream font includes Cyrillic; it has not been subsetted or converted.
|
|
16
|
+
The original `LICENSE.txt` is copied verbatim from the same release archive.
|
|
17
|
+
The asset supplies normal variable weights, including the Flood 400/500 roles;
|
|
18
|
+
italic text needs a separate face or an explicitly documented fallback.
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
@import "@flood-md/tokens/foundations.css";
|
|
2
|
+
|
|
3
|
+
@font-face {
|
|
4
|
+
font-family: "Inter";
|
|
5
|
+
font-style: normal;
|
|
6
|
+
font-weight: 100 900;
|
|
7
|
+
font-display: swap;
|
|
8
|
+
src: url("./fonts/InterVariable.woff2") format("woff2");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.flood-root[data-flood-foundations="neutral"][data-flood-theme="dark"] {
|
|
12
|
+
color-scheme: dark;
|
|
13
|
+
color: var(--flood-sys-color-content-default);
|
|
14
|
+
background: var(--flood-sys-color-surface-canvas);
|
|
15
|
+
font-family: var(--flood-sys-font-sans);
|
|
16
|
+
font-size: var(--flood-sys-type-body-size);
|
|
17
|
+
line-height: var(--flood-sys-type-body-line-height);
|
|
18
|
+
letter-spacing: var(--flood-sys-type-body-tracking);
|
|
19
|
+
font-weight: var(--flood-sys-type-body-weight);
|
|
20
|
+
font-optical-sizing: auto;
|
|
21
|
+
font-synthesis: none;
|
|
22
|
+
}
|
|
23
|
+
.flood-root :where(.flood-text, .flood-heading, .flood-button, .flood-input, .flood-field, .flood-choice, .flood-link, .flood-icon, .flood-switch-input, .flood-check) {
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
font-family: inherit;
|
|
26
|
+
min-inline-size: 0;
|
|
27
|
+
overflow-wrap: anywhere;
|
|
28
|
+
}
|
|
29
|
+
.flood-root :where(.flood-text, .flood-heading) {
|
|
30
|
+
margin: 0;
|
|
31
|
+
font-size: var(--flood-type-size);
|
|
32
|
+
line-height: var(--flood-type-line);
|
|
33
|
+
letter-spacing: var(--flood-type-tracking);
|
|
34
|
+
font-weight: var(--flood-type-weight);
|
|
35
|
+
}
|
|
36
|
+
.flood-root .flood-tone--default { color: var(--flood-sys-color-content-default); }
|
|
37
|
+
.flood-root .flood-tone--subtle { color: var(--flood-sys-color-content-subtle); }
|
|
38
|
+
.flood-root .flood-tone--error { color: var(--flood-sys-color-feedback-error); }
|
|
39
|
+
.flood-root .flood-tone--success { color: var(--flood-sys-color-feedback-success); }
|
|
40
|
+
.flood-root .flood-tone--warning { color: var(--flood-sys-color-feedback-warning); }
|
|
41
|
+
.flood-root .flood-tone--info { color: var(--flood-sys-color-feedback-info); }
|
|
42
|
+
.flood-root .flood-stack { display: flex; flex-direction: column; gap: var(--flood-layout-gap); min-inline-size: 0; }
|
|
43
|
+
.flood-root .flood-inline { display: flex; flex-wrap: wrap; gap: var(--flood-layout-gap); min-inline-size: 0; }
|
|
44
|
+
.flood-root .flood-surface {
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
border-radius: var(--flood-sys-radius-block);
|
|
47
|
+
min-inline-size: 0;
|
|
48
|
+
--flood-surface-action-rest: var(--flood-sys-color-action-on-surface-rest);
|
|
49
|
+
--flood-surface-action-hover: var(--flood-sys-color-action-on-surface-hover);
|
|
50
|
+
}
|
|
51
|
+
.flood-root .flood-divider { border: 0; border-block-start: var(--flood-sys-stroke-width) solid var(--flood-sys-color-divider-decorative); margin: 0; inline-size: 100%; }
|
|
52
|
+
.flood-root .flood-button {
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
min-block-size: var(--flood-control-height);
|
|
57
|
+
padding-block: calc((var(--flood-control-height) - var(--flood-control-text) * var(--flood-control-line)) / 2 - var(--flood-sys-stroke-width));
|
|
58
|
+
padding-inline: calc(var(--flood-control-padding) - var(--flood-sys-stroke-width));
|
|
59
|
+
gap: var(--flood-control-gap);
|
|
60
|
+
border: var(--flood-sys-stroke-width) solid transparent;
|
|
61
|
+
border-radius: var(--flood-sys-radius-action);
|
|
62
|
+
font-size: var(--flood-control-text);
|
|
63
|
+
line-height: var(--flood-control-line);
|
|
64
|
+
font-weight: var(--flood-sys-type-control-weight);
|
|
65
|
+
letter-spacing: var(--flood-sys-type-control-tracking);
|
|
66
|
+
background: var(--flood-action-rest);
|
|
67
|
+
color: var(--flood-action-content);
|
|
68
|
+
transition: background-color var(--flood-sys-motion-duration-fast) var(--flood-sys-motion-easing);
|
|
69
|
+
}
|
|
70
|
+
.flood-root .flood-button:hover:not(:disabled) { background: var(--flood-action-hover); opacity: 1; }
|
|
71
|
+
.flood-root .flood-button:active:not(:disabled) { background: var(--flood-action-pressed); }
|
|
72
|
+
.flood-root .flood-button:disabled { background: var(--flood-action-disabled); color: var(--flood-action-disabled-content); opacity: 1; }
|
|
73
|
+
.flood-root .flood-button[aria-pressed="true"]:not(:disabled) { background: var(--flood-sys-color-selection-background); color: var(--flood-sys-color-selection-content); }
|
|
74
|
+
.flood-root .flood-surface .flood-button--subtle {
|
|
75
|
+
--flood-action-rest: var(--flood-surface-action-rest);
|
|
76
|
+
--flood-action-hover: var(--flood-surface-action-hover);
|
|
77
|
+
--flood-action-pressed: var(--flood-sys-color-action-on-surface-pressed);
|
|
78
|
+
--flood-action-content: var(--flood-sys-color-action-on-surface-content);
|
|
79
|
+
--flood-action-disabled: var(--flood-sys-color-action-on-surface-disabled);
|
|
80
|
+
--flood-action-disabled-content: var(--flood-sys-color-action-on-surface-disabled-content);
|
|
81
|
+
}
|
|
82
|
+
.flood-root .flood-surface[data-flood-elevation="overlay"] {
|
|
83
|
+
--flood-surface-action-rest: var(--flood-sys-color-action-on-surface-hover);
|
|
84
|
+
--flood-surface-action-hover: var(--flood-sys-color-action-on-surface-pressed);
|
|
85
|
+
}
|
|
86
|
+
.flood-root .flood-button--outline { border-color: var(--flood-sys-color-field-boundary); }
|
|
87
|
+
.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; }
|
|
89
|
+
.flood-root .flood-icon > svg { display: block; inline-size: 100%; block-size: 100%; }
|
|
90
|
+
.flood-root .flood-input {
|
|
91
|
+
display: block;
|
|
92
|
+
inline-size: 100%;
|
|
93
|
+
min-block-size: var(--flood-control-height);
|
|
94
|
+
padding-block: calc((var(--flood-control-height) - var(--flood-control-text) * var(--flood-control-line)) / 2 - var(--flood-sys-stroke-width));
|
|
95
|
+
padding-inline: calc(var(--flood-control-padding) - var(--flood-sys-stroke-width));
|
|
96
|
+
border: var(--flood-sys-stroke-width) solid var(--flood-sys-color-field-border);
|
|
97
|
+
border-block-end-color: var(--flood-sys-color-field-boundary);
|
|
98
|
+
border-radius: var(--flood-sys-radius-field);
|
|
99
|
+
background: var(--flood-sys-color-field-background);
|
|
100
|
+
color: var(--flood-sys-color-field-content);
|
|
101
|
+
font-size: var(--flood-control-text);
|
|
102
|
+
line-height: var(--flood-control-line);
|
|
103
|
+
letter-spacing: var(--flood-sys-type-compact-tracking);
|
|
104
|
+
font-weight: var(--flood-sys-type-compact-weight);
|
|
105
|
+
}
|
|
106
|
+
.flood-root .flood-input::placeholder { color: var(--flood-sys-color-field-placeholder); opacity: 1; }
|
|
107
|
+
.flood-root .flood-input[aria-invalid="true"] { border-color: var(--flood-sys-color-feedback-error); }
|
|
108
|
+
.flood-root .flood-input[readonly] { cursor: text; }
|
|
109
|
+
.flood-root .flood-input:disabled { background: var(--flood-sys-color-field-disabled); color: var(--flood-sys-color-field-disabled-content); border-color: var(--flood-sys-color-field-border); opacity: 1; }
|
|
110
|
+
.flood-root .flood-input:focus-visible {
|
|
111
|
+
outline: none;
|
|
112
|
+
outline-offset: var(--flood-sys-focus-offset);
|
|
113
|
+
border: var(--flood-sys-focus-width) solid var(--flood-sys-color-focus-ring);
|
|
114
|
+
padding-block: calc((var(--flood-control-height) - var(--flood-control-text) * var(--flood-control-line)) / 2 - var(--flood-sys-focus-width));
|
|
115
|
+
padding-inline: calc(var(--flood-control-padding) - var(--flood-sys-focus-width));
|
|
116
|
+
}
|
|
117
|
+
.flood-root .flood-textarea { min-block-size: calc(var(--flood-control-height) * 3); resize: vertical; }
|
|
118
|
+
.flood-root .flood-field { display: grid; gap: var(--flood-sys-space-2); }
|
|
119
|
+
.flood-root .flood-label { color: var(--flood-sys-color-content-helper); font-size: var(--flood-sys-type-label-size); line-height: var(--flood-sys-type-label-line-height); font-weight: var(--flood-sys-type-label-weight); letter-spacing: var(--flood-sys-type-label-tracking); }
|
|
120
|
+
.flood-root :where(.flood-hint, .flood-error) { font-size: var(--flood-sys-type-helper-size); line-height: var(--flood-sys-type-helper-line-height); font-weight: var(--flood-sys-type-helper-weight); letter-spacing: var(--flood-sys-type-helper-tracking); }
|
|
121
|
+
.flood-root .flood-hint { color: var(--flood-sys-color-content-helper); }
|
|
122
|
+
.flood-root .flood-error { color: var(--flood-sys-color-content-helper); }
|
|
123
|
+
.flood-root .flood-choice { gap: var(--flood-sys-space-2); min-block-size: var(--flood-sys-control-md-height); color: var(--flood-sys-color-content-default); font-size: var(--flood-sys-type-compact-size); line-height: var(--flood-sys-type-compact-line-height); letter-spacing: var(--flood-sys-type-compact-tracking); }
|
|
124
|
+
.flood-root .flood-choice:has(input:disabled) { color: var(--flood-sys-color-field-disabled-content); }
|
|
125
|
+
.flood-root .flood-check { inline-size: var(--flood-sys-size-choice); block-size: var(--flood-sys-size-choice); accent-color: var(--flood-sys-color-action-primary-rest); }
|
|
126
|
+
.flood-root .flood-switch-input { inline-size: var(--flood-sys-size-switch-width); block-size: var(--flood-sys-size-switch-height); padding: calc((var(--flood-sys-size-switch-height) - var(--flood-sys-size-switch-thumb)) / 2 - var(--flood-sys-stroke-width)); border: var(--flood-sys-stroke-width) solid var(--flood-sys-color-field-boundary); border-radius: var(--flood-sys-radius-action); background: var(--flood-sys-color-action-subtle-hover); }
|
|
127
|
+
.flood-root .flood-switch-input::before { inline-size: var(--flood-sys-size-switch-thumb); block-size: var(--flood-sys-size-switch-thumb); border-radius: var(--flood-sys-radius-action); background: var(--flood-sys-color-content-default); transition: transform var(--flood-sys-motion-duration-fast) var(--flood-sys-motion-easing); }
|
|
128
|
+
.flood-root .flood-switch-input:checked { background: var(--flood-sys-color-action-primary-rest); border-color: var(--flood-sys-color-action-primary-rest); }
|
|
129
|
+
.flood-root .flood-switch-input:checked::before { transform: translateX(calc(var(--flood-sys-size-switch-width) - var(--flood-sys-size-switch-height))); background: var(--flood-sys-color-action-primary-content); }
|
|
130
|
+
.flood-root .flood-switch-input:dir(rtl):checked::before { transform: translateX(calc(var(--flood-sys-size-switch-height) - var(--flood-sys-size-switch-width))); }
|
|
131
|
+
.flood-root .flood-switch-input:disabled { opacity: 1; border-color: var(--flood-sys-color-field-border); background: var(--flood-sys-color-field-disabled); }
|
|
132
|
+
.flood-root .flood-switch-input:disabled::before { background: var(--flood-sys-color-field-disabled-content); }
|
|
133
|
+
.flood-root .flood-link { font-size: inherit; color: var(--flood-sys-color-content-default); text-underline-offset: var(--flood-sys-space-1); }
|
|
134
|
+
.flood-root :where(.flood-button, .flood-check, .flood-switch-input, .flood-link):focus-visible { outline: var(--flood-sys-focus-width) solid var(--flood-sys-color-focus-ring); outline-offset: var(--flood-sys-focus-offset); }
|
|
135
|
+
.flood-root .flood-spinner { inline-size: var(--flood-control-icon); block-size: var(--flood-control-icon); border-width: var(--flood-sys-focus-width); }
|
|
136
|
+
@media (pointer: coarse) {
|
|
137
|
+
.flood-root .flood-button, .flood-root .flood-choice, .flood-root .flood-input { min-block-size: max(var(--flood-control-height, var(--flood-sys-control-md-height)), var(--flood-sys-size-touch)); }
|
|
138
|
+
.flood-root .flood-icon-button { min-inline-size: var(--flood-sys-size-touch); }
|
|
139
|
+
.flood-root .flood-input { font-size: max(var(--flood-control-text), var(--flood-sys-type-body-size)); }
|
|
140
|
+
}
|
|
141
|
+
@media (prefers-reduced-motion: reduce) {
|
|
142
|
+
.flood-root .flood-button, .flood-root .flood-switch-input::before, .flood-root .flood-spinner { transition-duration: var(--flood-sys-motion-duration-reduced); animation: none; }
|
|
143
|
+
}
|
|
144
|
+
@media (forced-colors: active) {
|
|
145
|
+
.flood-root .flood-button { border-color: ButtonText; }
|
|
146
|
+
.flood-root .flood-input { border-color: CanvasText; }
|
|
147
|
+
.flood-root .flood-input:focus-visible { border-color: Highlight; }
|
|
148
|
+
.flood-root :where(.flood-button, .flood-check, .flood-switch-input, .flood-link):focus-visible { outline-color: Highlight; }
|
|
149
|
+
.flood-root .flood-switch-input { appearance: auto; }
|
|
150
|
+
.flood-root .flood-switch-input::before { display: none; }
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* Role recipes keep every value in the authored token source. */
|
|
154
|
+
.flood-root .flood-type--large {
|
|
155
|
+
--flood-type-size: var(--flood-sys-type-large-size);
|
|
156
|
+
--flood-type-line: var(--flood-sys-type-large-line-height);
|
|
157
|
+
--flood-type-tracking: var(--flood-sys-type-large-tracking);
|
|
158
|
+
--flood-type-weight: var(--flood-sys-type-large-weight);
|
|
159
|
+
}
|
|
160
|
+
.flood-root .flood-type--page {
|
|
161
|
+
--flood-type-size: var(--flood-sys-type-page-size);
|
|
162
|
+
--flood-type-line: var(--flood-sys-type-page-line-height);
|
|
163
|
+
--flood-type-tracking: var(--flood-sys-type-page-tracking);
|
|
164
|
+
--flood-type-weight: var(--flood-sys-type-page-weight);
|
|
165
|
+
}
|
|
166
|
+
.flood-root .flood-type--section {
|
|
167
|
+
--flood-type-size: var(--flood-sys-type-section-size);
|
|
168
|
+
--flood-type-line: var(--flood-sys-type-section-line-height);
|
|
169
|
+
--flood-type-tracking: var(--flood-sys-type-section-tracking);
|
|
170
|
+
--flood-type-weight: var(--flood-sys-type-section-weight);
|
|
171
|
+
}
|
|
172
|
+
.flood-root .flood-type--body {
|
|
173
|
+
--flood-type-size: var(--flood-sys-type-body-size);
|
|
174
|
+
--flood-type-line: var(--flood-sys-type-body-line-height);
|
|
175
|
+
--flood-type-tracking: var(--flood-sys-type-body-tracking);
|
|
176
|
+
--flood-type-weight: var(--flood-sys-type-body-weight);
|
|
177
|
+
}
|
|
178
|
+
.flood-root .flood-type--compact {
|
|
179
|
+
--flood-type-size: var(--flood-sys-type-compact-size);
|
|
180
|
+
--flood-type-line: var(--flood-sys-type-compact-line-height);
|
|
181
|
+
--flood-type-tracking: var(--flood-sys-type-compact-tracking);
|
|
182
|
+
--flood-type-weight: var(--flood-sys-type-compact-weight);
|
|
183
|
+
}
|
|
184
|
+
.flood-root .flood-type--label {
|
|
185
|
+
--flood-type-size: var(--flood-sys-type-label-size);
|
|
186
|
+
--flood-type-line: var(--flood-sys-type-label-line-height);
|
|
187
|
+
--flood-type-tracking: var(--flood-sys-type-label-tracking);
|
|
188
|
+
--flood-type-weight: var(--flood-sys-type-label-weight);
|
|
189
|
+
}
|
|
190
|
+
.flood-root .flood-type--helper {
|
|
191
|
+
--flood-type-size: var(--flood-sys-type-helper-size);
|
|
192
|
+
--flood-type-line: var(--flood-sys-type-helper-line-height);
|
|
193
|
+
--flood-type-tracking: var(--flood-sys-type-helper-tracking);
|
|
194
|
+
--flood-type-weight: var(--flood-sys-type-helper-weight);
|
|
195
|
+
}
|
|
196
|
+
.flood-root .flood-type--control {
|
|
197
|
+
--flood-type-size: var(--flood-sys-type-control-size);
|
|
198
|
+
--flood-type-line: var(--flood-sys-type-control-line-height);
|
|
199
|
+
--flood-type-tracking: var(--flood-sys-type-control-tracking);
|
|
200
|
+
--flood-type-weight: var(--flood-sys-type-control-weight);
|
|
201
|
+
}
|
|
202
|
+
.flood-root .flood-button--2xs, .flood-root .flood-control--2xs {
|
|
203
|
+
--flood-control-height: var(--flood-sys-control-2xs-height);
|
|
204
|
+
--flood-control-text: var(--flood-sys-control-2xs-text-size);
|
|
205
|
+
--flood-control-line: var(--flood-sys-control-2xs-line-height);
|
|
206
|
+
--flood-control-padding: var(--flood-sys-control-2xs-padding-inline);
|
|
207
|
+
--flood-control-gap: var(--flood-sys-control-2xs-gap);
|
|
208
|
+
--flood-control-icon: var(--flood-sys-control-2xs-icon-size);
|
|
209
|
+
}
|
|
210
|
+
.flood-root .flood-icon--2xs { --flood-icon-size: var(--flood-sys-control-2xs-icon-size); }
|
|
211
|
+
.flood-root .flood-button--xs, .flood-root .flood-control--xs {
|
|
212
|
+
--flood-control-height: var(--flood-sys-control-xs-height);
|
|
213
|
+
--flood-control-text: var(--flood-sys-control-xs-text-size);
|
|
214
|
+
--flood-control-line: var(--flood-sys-control-xs-line-height);
|
|
215
|
+
--flood-control-padding: var(--flood-sys-control-xs-padding-inline);
|
|
216
|
+
--flood-control-gap: var(--flood-sys-control-xs-gap);
|
|
217
|
+
--flood-control-icon: var(--flood-sys-control-xs-icon-size);
|
|
218
|
+
}
|
|
219
|
+
.flood-root .flood-icon--xs { --flood-icon-size: var(--flood-sys-control-xs-icon-size); }
|
|
220
|
+
.flood-root .flood-button--sm, .flood-root .flood-control--sm {
|
|
221
|
+
--flood-control-height: var(--flood-sys-control-sm-height);
|
|
222
|
+
--flood-control-text: var(--flood-sys-control-sm-text-size);
|
|
223
|
+
--flood-control-line: var(--flood-sys-control-sm-line-height);
|
|
224
|
+
--flood-control-padding: var(--flood-sys-control-sm-padding-inline);
|
|
225
|
+
--flood-control-gap: var(--flood-sys-control-sm-gap);
|
|
226
|
+
--flood-control-icon: var(--flood-sys-control-sm-icon-size);
|
|
227
|
+
}
|
|
228
|
+
.flood-root .flood-icon--sm { --flood-icon-size: var(--flood-sys-control-sm-icon-size); }
|
|
229
|
+
.flood-root .flood-button--md, .flood-root .flood-control--md {
|
|
230
|
+
--flood-control-height: var(--flood-sys-control-md-height);
|
|
231
|
+
--flood-control-text: var(--flood-sys-control-md-text-size);
|
|
232
|
+
--flood-control-line: var(--flood-sys-control-md-line-height);
|
|
233
|
+
--flood-control-padding: var(--flood-sys-control-md-padding-inline);
|
|
234
|
+
--flood-control-gap: var(--flood-sys-control-md-gap);
|
|
235
|
+
--flood-control-icon: var(--flood-sys-control-md-icon-size);
|
|
236
|
+
}
|
|
237
|
+
.flood-root .flood-icon--md { --flood-icon-size: var(--flood-sys-control-md-icon-size); }
|
|
238
|
+
.flood-root .flood-button--lg, .flood-root .flood-control--lg {
|
|
239
|
+
--flood-control-height: var(--flood-sys-control-lg-height);
|
|
240
|
+
--flood-control-text: var(--flood-sys-control-lg-text-size);
|
|
241
|
+
--flood-control-line: var(--flood-sys-control-lg-line-height);
|
|
242
|
+
--flood-control-padding: var(--flood-sys-control-lg-padding-inline);
|
|
243
|
+
--flood-control-gap: var(--flood-sys-control-lg-gap);
|
|
244
|
+
--flood-control-icon: var(--flood-sys-control-lg-icon-size);
|
|
245
|
+
}
|
|
246
|
+
.flood-root .flood-icon--lg { --flood-icon-size: var(--flood-sys-control-lg-icon-size); }
|
|
247
|
+
.flood-root .flood-button--xl, .flood-root .flood-control--xl {
|
|
248
|
+
--flood-control-height: var(--flood-sys-control-xl-height);
|
|
249
|
+
--flood-control-text: var(--flood-sys-control-xl-text-size);
|
|
250
|
+
--flood-control-line: var(--flood-sys-control-xl-line-height);
|
|
251
|
+
--flood-control-padding: var(--flood-sys-control-xl-padding-inline);
|
|
252
|
+
--flood-control-gap: var(--flood-sys-control-xl-gap);
|
|
253
|
+
--flood-control-icon: var(--flood-sys-control-xl-icon-size);
|
|
254
|
+
}
|
|
255
|
+
.flood-root .flood-icon--xl { --flood-icon-size: var(--flood-sys-control-xl-icon-size); }
|
|
256
|
+
.flood-root .flood-button--2xl, .flood-root .flood-control--2xl {
|
|
257
|
+
--flood-control-height: var(--flood-sys-control-2xl-height);
|
|
258
|
+
--flood-control-text: var(--flood-sys-control-2xl-text-size);
|
|
259
|
+
--flood-control-line: var(--flood-sys-control-2xl-line-height);
|
|
260
|
+
--flood-control-padding: var(--flood-sys-control-2xl-padding-inline);
|
|
261
|
+
--flood-control-gap: var(--flood-sys-control-2xl-gap);
|
|
262
|
+
--flood-control-icon: var(--flood-sys-control-2xl-icon-size);
|
|
263
|
+
}
|
|
264
|
+
.flood-root .flood-icon--2xl { --flood-icon-size: var(--flood-sys-control-2xl-icon-size); }
|
|
265
|
+
.flood-root .flood-button--solid {
|
|
266
|
+
--flood-action-rest: var(--flood-sys-color-action-primary-rest);
|
|
267
|
+
--flood-action-hover: var(--flood-sys-color-action-primary-hover);
|
|
268
|
+
--flood-action-pressed: var(--flood-sys-color-action-primary-pressed);
|
|
269
|
+
--flood-action-content: var(--flood-sys-color-action-primary-content);
|
|
270
|
+
--flood-action-disabled: var(--flood-sys-color-action-primary-disabled);
|
|
271
|
+
--flood-action-disabled-content: var(--flood-sys-color-action-primary-disabled-content);
|
|
272
|
+
}
|
|
273
|
+
.flood-root .flood-button--subtle {
|
|
274
|
+
--flood-action-rest: var(--flood-sys-color-action-subtle-rest);
|
|
275
|
+
--flood-action-hover: var(--flood-sys-color-action-subtle-hover);
|
|
276
|
+
--flood-action-pressed: var(--flood-sys-color-action-subtle-pressed);
|
|
277
|
+
--flood-action-content: var(--flood-sys-color-action-subtle-content);
|
|
278
|
+
--flood-action-disabled: var(--flood-sys-color-action-subtle-disabled);
|
|
279
|
+
--flood-action-disabled-content: var(--flood-sys-color-action-subtle-disabled-content);
|
|
280
|
+
}
|
|
281
|
+
.flood-root .flood-button--outline {
|
|
282
|
+
--flood-action-rest: var(--flood-sys-color-action-subtle-rest);
|
|
283
|
+
--flood-action-hover: var(--flood-sys-color-action-subtle-hover);
|
|
284
|
+
--flood-action-pressed: var(--flood-sys-color-action-subtle-pressed);
|
|
285
|
+
--flood-action-content: var(--flood-sys-color-action-subtle-content);
|
|
286
|
+
--flood-action-disabled: var(--flood-sys-color-action-subtle-disabled);
|
|
287
|
+
--flood-action-disabled-content: var(--flood-sys-color-action-subtle-disabled-content);
|
|
288
|
+
}
|
|
289
|
+
.flood-root .flood-button--ghost {
|
|
290
|
+
--flood-action-rest: var(--flood-sys-color-action-ghost-rest);
|
|
291
|
+
--flood-action-hover: var(--flood-sys-color-action-ghost-hover);
|
|
292
|
+
--flood-action-pressed: var(--flood-sys-color-action-ghost-pressed);
|
|
293
|
+
--flood-action-content: var(--flood-sys-color-action-ghost-content);
|
|
294
|
+
--flood-action-disabled: var(--flood-sys-color-action-ghost-disabled);
|
|
295
|
+
--flood-action-disabled-content: var(--flood-sys-color-action-ghost-disabled-content);
|
|
296
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { type ButtonHTMLAttributes, type InputHTMLAttributes, type TextareaHTMLAttributes, type AnchorHTMLAttributes, type ReactNode } from "react";
|
|
1
|
+
import { type ButtonHTMLAttributes, type InputHTMLAttributes, type TextareaHTMLAttributes, type AnchorHTMLAttributes, type ReactNode, type HTMLAttributes } from "react";
|
|
2
|
+
export type ControlSize = "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
2
3
|
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
-
variant?: "solid" | "outline" | "ghost";
|
|
4
|
-
size?:
|
|
4
|
+
variant?: "solid" | "subtle" | "outline" | "ghost";
|
|
5
|
+
size?: ControlSize;
|
|
5
6
|
loading?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
8
9
|
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
9
10
|
invalid?: boolean;
|
|
11
|
+
controlSize?: "sm" | "md" | "lg" | "xl";
|
|
10
12
|
}
|
|
11
13
|
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
12
14
|
export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
13
15
|
invalid?: boolean;
|
|
16
|
+
controlSize?: "sm" | "md" | "lg" | "xl";
|
|
14
17
|
}
|
|
15
18
|
export declare const Textarea: import("react").ForwardRefExoticComponent<TextareaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
16
19
|
export interface ChoiceProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size"> {
|
|
@@ -23,13 +26,54 @@ export interface FieldControlProps {
|
|
|
23
26
|
id: string;
|
|
24
27
|
"aria-describedby"?: string;
|
|
25
28
|
"aria-invalid"?: true;
|
|
29
|
+
required?: boolean;
|
|
26
30
|
}
|
|
27
31
|
export interface FieldProps {
|
|
28
32
|
id?: string;
|
|
29
33
|
label: ReactNode;
|
|
30
34
|
hint?: ReactNode;
|
|
31
35
|
error?: ReactNode;
|
|
36
|
+
required?: boolean;
|
|
37
|
+
describedBy?: string;
|
|
32
38
|
children: (props: FieldControlProps) => ReactNode;
|
|
33
39
|
}
|
|
34
|
-
export declare function Field({ id: explicitId, label, hint, error, children, }: FieldProps): import("react").JSX.Element;
|
|
40
|
+
export declare function Field({ id: explicitId, label, hint, error, required, describedBy, children, }: FieldProps): import("react").JSX.Element;
|
|
35
41
|
export declare const Link: import("react").ForwardRefExoticComponent<AnchorHTMLAttributes<HTMLAnchorElement> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
42
|
+
/** Explicit opt-in to the dark foundations profile; no global theme mutation. */
|
|
43
|
+
export declare const FloodRoot: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
44
|
+
export interface TextProps extends HTMLAttributes<HTMLElement> {
|
|
45
|
+
as?: "span" | "p" | "div";
|
|
46
|
+
size?: "body" | "compact" | "label" | "helper";
|
|
47
|
+
tone?: "default" | "subtle" | "error" | "success" | "warning" | "info";
|
|
48
|
+
}
|
|
49
|
+
export declare const Text: import("react").ForwardRefExoticComponent<TextProps & import("react").RefAttributes<HTMLElement>>;
|
|
50
|
+
export interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
51
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
52
|
+
size?: "large" | "page" | "section";
|
|
53
|
+
}
|
|
54
|
+
export declare const Heading: import("react").ForwardRefExoticComponent<HeadingProps & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
55
|
+
export type Space = "0" | "1" | "2" | "3" | "4" | "6" | "8" | "12";
|
|
56
|
+
export interface LayoutProps extends HTMLAttributes<HTMLDivElement> {
|
|
57
|
+
gap?: Space;
|
|
58
|
+
}
|
|
59
|
+
export declare const Stack: import("react").ForwardRefExoticComponent<LayoutProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
60
|
+
export interface InlineProps extends LayoutProps {
|
|
61
|
+
align?: "start" | "center" | "end" | "baseline";
|
|
62
|
+
}
|
|
63
|
+
export declare const Inline: import("react").ForwardRefExoticComponent<InlineProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
64
|
+
export interface SurfaceProps extends HTMLAttributes<HTMLDivElement> {
|
|
65
|
+
elevation?: "default" | "raised" | "overlay";
|
|
66
|
+
padding?: Space;
|
|
67
|
+
}
|
|
68
|
+
export declare const Surface: import("react").ForwardRefExoticComponent<SurfaceProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
69
|
+
export interface IconSlotProps extends HTMLAttributes<HTMLSpanElement> {
|
|
70
|
+
size?: ControlSize;
|
|
71
|
+
label?: string;
|
|
72
|
+
}
|
|
73
|
+
/** Adapter for the host's SVG icon package; glyphs are not bundled. */
|
|
74
|
+
export declare const IconSlot: import("react").ForwardRefExoticComponent<IconSlotProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
75
|
+
export interface IconButtonProps extends Omit<ButtonProps, "aria-label"> {
|
|
76
|
+
label: string;
|
|
77
|
+
}
|
|
78
|
+
export declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
79
|
+
export declare const Divider: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLHRElement> & import("react").RefAttributes<HTMLHRElement>>;
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, useId, } from "react";
|
|
3
|
+
import { forwardRef, createElement, useId, } from "react";
|
|
4
4
|
const classes = (...values) => values.filter(Boolean).join(" ");
|
|
5
5
|
export const Button = forwardRef(function Button({ variant = "solid", size = "md", loading = false, disabled, type = "button", className, children, ...props }, ref) {
|
|
6
6
|
return (_jsxs("button", { ...props, ref: ref, type: type, disabled: disabled || loading, "aria-busy": loading || undefined, className: classes("flood-button", `flood-button--${variant}`, `flood-button--${size}`, className), children: [loading && _jsx("span", { className: "flood-spinner", "aria-hidden": "true" }), children] }));
|
|
7
7
|
});
|
|
8
|
-
export const Input = forwardRef(function Input({ invalid, className, ...props }, ref) {
|
|
9
|
-
return (_jsx("input", { ...props, ref: ref, "aria-invalid": invalid || props["aria-invalid"], className: classes("flood-input", className) }));
|
|
8
|
+
export const Input = forwardRef(function Input({ invalid, controlSize = "md", className, ...props }, ref) {
|
|
9
|
+
return (_jsx("input", { ...props, ref: ref, "aria-invalid": invalid || props["aria-invalid"], className: classes("flood-input", `flood-control--${controlSize}`, className) }));
|
|
10
10
|
});
|
|
11
|
-
export const Textarea = forwardRef(function Textarea({ invalid, className, ...props }, ref) {
|
|
12
|
-
return (_jsx("textarea", { ...props, ref: ref, "aria-invalid": invalid || props["aria-invalid"], className: classes("flood-input", "flood-textarea", className) }));
|
|
11
|
+
export const Textarea = forwardRef(function Textarea({ invalid, controlSize = "md", className, ...props }, ref) {
|
|
12
|
+
return (_jsx("textarea", { ...props, ref: ref, "aria-invalid": invalid || props["aria-invalid"], className: classes("flood-input", "flood-textarea", `flood-control--${controlSize}`, className) }));
|
|
13
13
|
});
|
|
14
14
|
export const Checkbox = forwardRef(function Checkbox({ label, className, ...props }, ref) {
|
|
15
15
|
return (_jsxs("label", { className: classes("flood-choice", className), children: [_jsx("input", { ...props, ref: ref, type: "checkbox", className: "flood-check" }), _jsx("span", { children: label })] }));
|
|
@@ -20,17 +20,47 @@ export const Radio = forwardRef(function Radio({ label, className, ...props }, r
|
|
|
20
20
|
export const Switch = forwardRef(function Switch({ label, className, ...props }, ref) {
|
|
21
21
|
return (_jsxs("label", { className: classes("flood-choice", "flood-switch", className), children: [_jsx("span", { children: label }), _jsx("input", { ...props, ref: ref, type: "checkbox", role: "switch", className: "flood-switch-input" })] }));
|
|
22
22
|
});
|
|
23
|
-
export function Field({ id: explicitId, label, hint, error, children, }) {
|
|
23
|
+
export function Field({ id: explicitId, label, hint, error, required, describedBy, children, }) {
|
|
24
24
|
const generatedId = useId();
|
|
25
25
|
const id = explicitId ?? `flood-${generatedId}`;
|
|
26
|
-
const description = [hint && `${id}-hint`, error && `${id}-error`].filter(Boolean).join(" ") ||
|
|
26
|
+
const description = [describedBy, hint && `${id}-hint`, error && `${id}-error`].filter(Boolean).join(" ") ||
|
|
27
27
|
undefined;
|
|
28
|
-
return (_jsxs("div", { className: "flood-field", children: [
|
|
28
|
+
return (_jsxs("div", { className: "flood-field", children: [_jsxs("label", { className: "flood-label", htmlFor: id, children: [label, required && _jsx("span", { "aria-hidden": "true", children: " *" })] }), children({
|
|
29
29
|
id,
|
|
30
30
|
"aria-describedby": description,
|
|
31
31
|
"aria-invalid": error ? true : undefined,
|
|
32
|
+
required,
|
|
32
33
|
}), hint && (_jsx("div", { id: `${id}-hint`, className: "flood-hint", children: hint })), error && (_jsx("div", { id: `${id}-error`, className: "flood-error", role: "alert", children: error }))] }));
|
|
33
34
|
}
|
|
34
35
|
export const Link = forwardRef(function Link({ className, ...props }, ref) {
|
|
35
36
|
return (_jsx("a", { ...props, ref: ref, className: classes("flood-link", className) }));
|
|
36
37
|
});
|
|
38
|
+
/** Explicit opt-in to the dark foundations profile; no global theme mutation. */
|
|
39
|
+
export const FloodRoot = forwardRef(function FloodRoot({ className, ...props }, ref) {
|
|
40
|
+
return _jsx("div", { ...props, ref: ref, "data-flood-foundations": "neutral", "data-flood-theme": "dark", className: classes("flood-root", className) });
|
|
41
|
+
});
|
|
42
|
+
export const Text = forwardRef(function Text({ as = "span", size = "body", tone = "default", className, ...props }, ref) {
|
|
43
|
+
return createElement(as, { ...props, ref, className: classes("flood-text", `flood-type--${size}`, `flood-tone--${tone}`, className) });
|
|
44
|
+
});
|
|
45
|
+
export const Heading = forwardRef(function Heading({ level = 2, size = "page", className, ...props }, ref) {
|
|
46
|
+
return createElement(`h${level}`, { ...props, ref, className: classes("flood-heading", `flood-type--${size}`, className) });
|
|
47
|
+
});
|
|
48
|
+
export const Stack = forwardRef(function Stack({ gap = "4", style, className, ...props }, ref) {
|
|
49
|
+
return _jsx("div", { ...props, ref: ref, className: classes("flood-stack", className), style: { "--flood-layout-gap": `var(--flood-sys-space-${gap})`, ...style } });
|
|
50
|
+
});
|
|
51
|
+
export const Inline = forwardRef(function Inline({ gap = "2", align = "center", style, className, ...props }, ref) {
|
|
52
|
+
return _jsx("div", { ...props, ref: ref, className: classes("flood-inline", className), style: { "--flood-layout-gap": `var(--flood-sys-space-${gap})`, alignItems: align === "start" ? "flex-start" : align === "end" ? "flex-end" : align, ...style } });
|
|
53
|
+
});
|
|
54
|
+
export const Surface = forwardRef(function Surface({ elevation = "default", padding = "6", style, className, ...props }, ref) {
|
|
55
|
+
return _jsx("div", { ...props, ref: ref, "data-flood-elevation": elevation, className: classes("flood-surface", className), style: { background: `var(--flood-sys-color-surface-${elevation})`, padding: `var(--flood-sys-space-${padding})`, ...style } });
|
|
56
|
+
});
|
|
57
|
+
/** Adapter for the host's SVG icon package; glyphs are not bundled. */
|
|
58
|
+
export const IconSlot = forwardRef(function IconSlot({ size = "md", label, className, children, ...props }, ref) {
|
|
59
|
+
return _jsx("span", { ...props, ref: ref, role: label ? "img" : undefined, "aria-label": label, "aria-hidden": label ? undefined : true, className: classes("flood-icon", `flood-icon--${size}`, className), children: children });
|
|
60
|
+
});
|
|
61
|
+
export const IconButton = forwardRef(function IconButton({ label, size = "md", variant = "subtle", className, children, ...props }, ref) {
|
|
62
|
+
return _jsx(Button, { ...props, ref: ref, size: size, variant: variant, "aria-label": label, className: classes("flood-icon-button", className), children: _jsx(IconSlot, { size: size, children: children }) });
|
|
63
|
+
});
|
|
64
|
+
export const Divider = forwardRef(function Divider({ className, ...props }, ref) {
|
|
65
|
+
return _jsx("hr", { ...props, ref: ref, className: classes("flood-divider", className) });
|
|
66
|
+
});
|
package/dist/styles.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flood-md/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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.
|
|
33
|
+
"@flood-md/tokens": "0.2.0"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|