@feitio/react 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +35 -2
- package/dist/Anchor.d.ts +19 -0
- package/dist/AppShell.d.ts +24 -0
- package/dist/BackToTop.d.ts +8 -0
- package/dist/Block.d.ts +7 -0
- package/dist/Breadcrumbs.d.ts +12 -0
- package/dist/Button.d.ts +16 -0
- package/dist/Checkbox.d.ts +11 -0
- package/dist/CodeBlock.d.ts +10 -0
- package/dist/Details.d.ts +9 -0
- package/dist/Dialog.d.ts +21 -0
- package/dist/Divider.d.ts +7 -0
- package/dist/DoDont.d.ts +14 -0
- package/dist/Drawer.d.ts +13 -0
- package/dist/EmptyState.d.ts +11 -0
- package/dist/ErrorMessage.d.ts +8 -0
- package/dist/ErrorSummary.d.ts +11 -0
- package/dist/Example.d.ts +14 -0
- package/dist/FeitioProvider.d.ts +8 -0
- package/dist/Field.d.ts +15 -0
- package/dist/Fieldset.d.ts +8 -0
- package/dist/FilterField.d.ts +19 -0
- package/dist/Footer.d.ts +14 -0
- package/dist/Grid.d.ts +10 -0
- package/dist/Header.d.ts +22 -0
- package/dist/Heading.d.ts +8 -0
- package/dist/Hint.d.ts +7 -0
- package/dist/Icon.d.ts +9 -0
- package/dist/Inline.d.ts +9 -0
- package/dist/Kbd.d.ts +5 -0
- package/dist/Label.d.ts +8 -0
- package/dist/Link.d.ts +11 -0
- package/dist/LinkCard.d.ts +9 -0
- package/dist/Menu.d.ts +25 -0
- package/dist/Nav.d.ts +17 -0
- package/dist/Notice.d.ts +19 -0
- package/dist/Pagination.d.ts +20 -0
- package/dist/Radios.d.ts +13 -0
- package/dist/ScrollFade.d.ts +3 -0
- package/dist/Search.d.ts +17 -0
- package/dist/SegmentedControl.d.ts +9 -0
- package/dist/Select.d.ts +16 -0
- package/dist/SkipLink.d.ts +6 -0
- package/dist/Stack.d.ts +9 -0
- package/dist/StatusOverlay.d.ts +12 -0
- package/dist/SummaryList.d.ts +13 -0
- package/dist/Swatch.d.ts +5 -0
- package/dist/Switch.d.ts +12 -0
- package/dist/Table.d.ts +18 -0
- package/dist/Tag.d.ts +9 -0
- package/dist/TaskList.d.ts +13 -0
- package/dist/Text.d.ts +5 -0
- package/dist/TextInput.d.ts +10 -0
- package/dist/Textarea.d.ts +8 -0
- package/dist/TimeInput.d.ts +14 -0
- package/dist/VisuallyHidden.d.ts +5 -0
- package/dist/actions/notices.d.ts +16 -0
- package/dist/actions/status.d.ts +5 -0
- package/dist/actions/use-element-behavior.d.ts +6 -0
- package/dist/actions/use-page-behavior.d.ts +6 -0
- package/dist/actions/use-sprite.d.ts +2 -0
- package/dist/actions/wire.d.ts +10 -0
- package/dist/calculations/pagination.d.ts +10 -0
- package/dist/calculations/svg-parts.d.ts +9 -0
- package/dist/calculations/text.d.ts +4 -0
- package/dist/data/sprite.d.ts +4 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.js +2482 -0
- package/package.json +56 -4
- package/src/Anchor.tsx +47 -0
- package/src/AppShell.tsx +95 -0
- package/src/BackToTop.tsx +26 -0
- package/src/Block.tsx +11 -0
- package/src/Breadcrumbs.tsx +40 -0
- package/src/Button.tsx +40 -0
- package/src/Checkbox.tsx +34 -0
- package/src/CodeBlock.tsx +38 -0
- package/src/Details.tsx +22 -0
- package/src/Dialog.tsx +70 -0
- package/src/Divider.tsx +17 -0
- package/src/DoDont.tsx +46 -0
- package/src/Drawer.tsx +52 -0
- package/src/EmptyState.tsx +37 -0
- package/src/ErrorMessage.tsx +18 -0
- package/src/ErrorSummary.tsx +27 -0
- package/src/Example.tsx +45 -0
- package/src/FeitioProvider.tsx +13 -0
- package/src/Field.tsx +45 -0
- package/src/Fieldset.tsx +18 -0
- package/src/FilterField.tsx +61 -0
- package/src/Footer.tsx +37 -0
- package/src/Grid.tsx +19 -0
- package/src/Header.tsx +60 -0
- package/src/Heading.tsx +13 -0
- package/src/Hint.tsx +15 -0
- package/src/Icon.tsx +19 -0
- package/src/Inline.tsx +17 -0
- package/src/Kbd.tsx +6 -0
- package/src/Label.tsx +16 -0
- package/src/Link.tsx +33 -0
- package/src/LinkCard.tsx +22 -0
- package/src/Menu.tsx +73 -0
- package/src/Nav.tsx +36 -0
- package/src/Notice.tsx +73 -0
- package/src/Pagination.tsx +98 -0
- package/src/Radios.tsx +43 -0
- package/src/ScrollFade.tsx +10 -0
- package/src/Search.tsx +66 -0
- package/src/SegmentedControl.tsx +36 -0
- package/src/Select.tsx +50 -0
- package/src/SkipLink.tsx +16 -0
- package/src/Stack.tsx +17 -0
- package/src/StatusOverlay.tsx +46 -0
- package/src/SummaryList.tsx +27 -0
- package/src/Swatch.tsx +11 -0
- package/src/Switch.tsx +41 -0
- package/src/Table.tsx +74 -0
- package/src/Tag.tsx +21 -0
- package/src/TaskList.tsx +34 -0
- package/src/Text.tsx +6 -0
- package/src/TextInput.tsx +29 -0
- package/src/Textarea.tsx +25 -0
- package/src/TimeInput.tsx +59 -0
- package/src/VisuallyHidden.tsx +6 -0
- package/src/actions/notices.ts +30 -0
- package/src/actions/status.ts +13 -0
- package/src/actions/use-element-behavior.ts +23 -0
- package/src/actions/use-page-behavior.ts +17 -0
- package/src/actions/use-sprite.ts +8 -0
- package/src/actions/wire.ts +30 -0
- package/src/calculations/pagination.ts +15 -0
- package/src/calculations/svg-parts.ts +22 -0
- package/src/calculations/text.ts +9 -0
- package/src/data/sprite.ts +7 -0
- package/src/index.ts +59 -0
- package/src/text-modules.d.ts +5 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Henrique Artur
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @feitio/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Feitio's components for React. They render the same HTML as the Astro components
|
|
4
|
+
(`@feitio/astro`), and a test in the repository holds them to it.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npm install @feitio/core @feitio/react
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import '@feitio/core/css/fonts.css';
|
|
12
|
+
import '@feitio/core/css/feitio.css';
|
|
13
|
+
import { Button, Notice, Stack } from '@feitio/react';
|
|
14
|
+
|
|
15
|
+
export function Saved() {
|
|
16
|
+
return (
|
|
17
|
+
<Stack gap={3}>
|
|
18
|
+
<Notice status="ok" title="Salvo" timeout={5000} />
|
|
19
|
+
<Button variant="primary">Continuar</Button>
|
|
20
|
+
</Stack>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- **Behaviors wire themselves.** Menu, Notice, Dialog, Switch, SegmentedControl, TimeInput,
|
|
26
|
+
FilterField, ScrollFade, BackToTop and AppShell bring their JavaScript (from `@feitio/vanilla`)
|
|
27
|
+
when they mount. Nothing to call.
|
|
28
|
+
- **Notices from code.** `const { show, close } = useNotices()`, then `show(element)` with the
|
|
29
|
+
element a Notice's `ref` points to.
|
|
30
|
+
- **Feedback from state.** A StatusOverlay follows its `state` and `label` props.
|
|
31
|
+
- **Icons** come from `/feitio/icons/sprite.svg` (copy `@feitio/core/icons/sprite.svg` there), or
|
|
32
|
+
from wherever `<FeitioProvider sprite="...">` says.
|
|
33
|
+
- **Controls are uncontrolled**: `value`, `checked` and `on` are where they start; `onChange` tells
|
|
34
|
+
what changed.
|
|
35
|
+
|
|
36
|
+
The guidelines, every component and when not to use it: https://made-by-maid.github.io/feitio/
|
package/dist/Anchor.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export interface AnchorItem {
|
|
3
|
+
id: string;
|
|
4
|
+
text: string;
|
|
5
|
+
current?: boolean;
|
|
6
|
+
children?: {
|
|
7
|
+
id: string;
|
|
8
|
+
text: string;
|
|
9
|
+
current?: boolean;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
export interface AnchorProps {
|
|
13
|
+
title?: string;
|
|
14
|
+
items: AnchorItem[];
|
|
15
|
+
label?: string;
|
|
16
|
+
sprite?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Anchor: the page index, following the scroll; the current part in ink, with the hand-drawn arrow. */
|
|
19
|
+
export declare function Anchor({ title, items, label, sprite }: AnchorProps): ReactElement;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import { type NavGroup } from './Nav.js';
|
|
3
|
+
export interface AppShellProps {
|
|
4
|
+
id: string;
|
|
5
|
+
brand: string;
|
|
6
|
+
nav: NavGroup[];
|
|
7
|
+
user?: string;
|
|
8
|
+
signOut?: {
|
|
9
|
+
text: string;
|
|
10
|
+
href: string;
|
|
11
|
+
};
|
|
12
|
+
menuLabel?: string;
|
|
13
|
+
closeLabel?: string;
|
|
14
|
+
topLabel?: string;
|
|
15
|
+
sprite?: string;
|
|
16
|
+
/** The main area's content. */
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* AppShell: a product's layout of regions: the header (it leaves when scrolling down on mobile and
|
|
21
|
+
* comes back up), the navigation in a Drawer from the right, the main area with its ScrollFade and
|
|
22
|
+
* BackToTop.
|
|
23
|
+
*/
|
|
24
|
+
export declare function AppShell({ id, brand, nav, user, signOut, menuLabel, closeLabel, topLabel, sprite, children, }: AppShellProps): ReactElement;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
export interface BackToTopProps {
|
|
3
|
+
href?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
sprite?: string;
|
|
6
|
+
}
|
|
7
|
+
/** BackToTop: shows after half a screen of scrolling and takes the reader (and the focus) back up. */
|
|
8
|
+
export declare function BackToTop({ href, label, sprite, }: BackToTopProps): ReactElement;
|
package/dist/Block.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface BlockProps {
|
|
3
|
+
as?: 'div' | 'section' | 'article';
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/** Block: a surface that groups related content, with the inner padding of the scale. */
|
|
7
|
+
export declare function Block({ as: Tag, children }: BlockProps): ReactElement;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export interface BreadcrumbsProps {
|
|
3
|
+
items: {
|
|
4
|
+
text: string;
|
|
5
|
+
href: string;
|
|
6
|
+
}[];
|
|
7
|
+
current: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
sprite?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Breadcrumbs: where the page sits, from the top down to here. */
|
|
12
|
+
export declare function Breadcrumbs({ items, current, label, sprite, }: BreadcrumbsProps): ReactElement;
|
package/dist/Button.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, ButtonHTMLAttributes, ReactElement } from 'react';
|
|
2
|
+
interface Common {
|
|
3
|
+
/** primary is the screen's main action (orange, at most one); danger destroys something. */
|
|
4
|
+
variant?: 'primary' | 'danger';
|
|
5
|
+
size?: 'small' | 'large';
|
|
6
|
+
}
|
|
7
|
+
export type ButtonProps = Common & ((Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'> & {
|
|
8
|
+
type?: 'button' | 'submit' | 'reset';
|
|
9
|
+
href?: undefined;
|
|
10
|
+
}) | (AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
11
|
+
/** Makes it a link that looks like a button. */
|
|
12
|
+
href: string;
|
|
13
|
+
}));
|
|
14
|
+
/** Button: an action. With href, a link that looks like one. */
|
|
15
|
+
export declare function Button(props: ButtonProps): ReactElement;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ChangeEvent, ReactElement } from 'react';
|
|
2
|
+
export interface CheckboxProps {
|
|
3
|
+
label: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
onChange?: (checked: boolean, event: ChangeEvent<HTMLInputElement>) => void;
|
|
9
|
+
}
|
|
10
|
+
/** Checkbox: one choice that is on or off, its words beside it. */
|
|
11
|
+
export declare function Checkbox({ label, name, value, checked, disabled, onChange, }: CheckboxProps): ReactElement;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export interface CodeBlockProps {
|
|
3
|
+
code: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
syntax?: 'html' | 'jsx' | 'shell';
|
|
6
|
+
copyLabel?: string;
|
|
7
|
+
copiedLabel?: string;
|
|
8
|
+
}
|
|
9
|
+
/** CodeBlock: code to read and copy, with its language named on the bar. */
|
|
10
|
+
export declare function CodeBlock({ code, label, syntax, copyLabel, copiedLabel, }: CodeBlockProps): ReactElement;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface DetailsProps {
|
|
3
|
+
summary: string;
|
|
4
|
+
open?: boolean;
|
|
5
|
+
sprite?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/** Details: more about something, closed until the reader asks for it. */
|
|
9
|
+
export declare function Details({ summary, open, sprite, children }: DetailsProps): ReactElement;
|
package/dist/Dialog.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface DialogProps {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
action: string;
|
|
6
|
+
cancel?: string;
|
|
7
|
+
danger?: boolean;
|
|
8
|
+
/** For what deletes a lot at once: the word to type, and the field's label. */
|
|
9
|
+
confirmWord?: {
|
|
10
|
+
word: string;
|
|
11
|
+
label: string;
|
|
12
|
+
};
|
|
13
|
+
/** Called when it closes, with "yes" or "cancel". */
|
|
14
|
+
onClose?: (answer: string) => void;
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Dialog: a question that stops everything until it is answered. A button with
|
|
19
|
+
* data-open-dialog="its id" opens it.
|
|
20
|
+
*/
|
|
21
|
+
export declare function Dialog({ id, title, action, cancel, danger, confirmWord, onClose, children, }: DialogProps): ReactElement;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export interface DividerProps {
|
|
3
|
+
tone?: 'ink';
|
|
4
|
+
orientation?: 'horizontal' | 'vertical';
|
|
5
|
+
}
|
|
6
|
+
/** Divider: a hand-drawn line between two parts. */
|
|
7
|
+
export declare function Divider({ tone, orientation }: DividerProps): ReactElement;
|
package/dist/DoDont.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface DoDontProps {
|
|
3
|
+
doWhy: string;
|
|
4
|
+
dontWhy: string;
|
|
5
|
+
doLabel?: string;
|
|
6
|
+
dontLabel?: string;
|
|
7
|
+
sprite?: string;
|
|
8
|
+
/** The right way. */
|
|
9
|
+
do?: ReactNode;
|
|
10
|
+
/** The wrong way. */
|
|
11
|
+
dont?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** DoDont: the right way and the wrong way side by side, each with why. */
|
|
14
|
+
export declare function DoDont({ doWhy, dontWhy, doLabel, dontLabel, sprite, do: right, dont: wrong, }: DoDontProps): ReactElement;
|
package/dist/Drawer.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface DrawerProps {
|
|
3
|
+
id: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
side?: 'end' | 'start' | 'top' | 'bottom';
|
|
6
|
+
label?: string;
|
|
7
|
+
closeLabel?: string;
|
|
8
|
+
sprite?: string;
|
|
9
|
+
footer?: ReactNode;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/** Drawer: a panel that slides in from a side, over the page; a button with popoverTarget opens it. */
|
|
13
|
+
export declare function Drawer({ id, title, side, label, closeLabel, sprite, footer, children, }: DrawerProps): ReactElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface EmptyStateProps {
|
|
3
|
+
title: string;
|
|
4
|
+
text?: string;
|
|
5
|
+
/** "basket" for nothing yet, "torn" for an error. */
|
|
6
|
+
illustration?: 'basket' | 'torn' | 'none';
|
|
7
|
+
size?: 'compact';
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/** EmptyState: what shows where there is nothing yet, or where something went wrong, and what to do. */
|
|
11
|
+
export declare function EmptyState({ title, text, illustration, size, children, }: EmptyStateProps): ReactElement;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface ErrorMessageProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
sprite?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/** ErrorMessage: what is wrong with a field and how to fix it, right above it. */
|
|
8
|
+
export declare function ErrorMessage({ id, sprite, children }: ErrorMessageProps): ReactElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export interface ErrorSummaryProps {
|
|
3
|
+
title: string;
|
|
4
|
+
errors: {
|
|
5
|
+
text: string;
|
|
6
|
+
href: string;
|
|
7
|
+
}[];
|
|
8
|
+
sprite?: string;
|
|
9
|
+
}
|
|
10
|
+
/** ErrorSummary: every error of a form at the top, each one a link to its field. */
|
|
11
|
+
export declare function ErrorSummary({ title, errors, sprite }: ErrorSummaryProps): ReactElement;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface ExampleProps {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
code: string;
|
|
7
|
+
showLabel?: string;
|
|
8
|
+
copyLabel?: string;
|
|
9
|
+
copiedLabel?: string;
|
|
10
|
+
sprite?: string;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** Example: a live piece of interface, what it is for, and its code behind a Details. */
|
|
14
|
+
export declare function Example({ id, title, description, code, showLabel, copyLabel, copiedLabel, sprite, children, }: ExampleProps): ReactElement;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface FeitioProviderProps {
|
|
3
|
+
/** Where the icon sprite is served, for every icon inside. */
|
|
4
|
+
sprite?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/** Settings for every Feitio component inside it; today, where the icon sprite lives. */
|
|
8
|
+
export declare function FeitioProvider({ sprite, children }: FeitioProviderProps): ReactElement;
|
package/dist/Field.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface FieldProps {
|
|
3
|
+
label: string;
|
|
4
|
+
/** The id of the control inside; the hint and the error take ids from it. */
|
|
5
|
+
for: string;
|
|
6
|
+
hint?: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
sprite?: string;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Field: a label, an optional hint, the control and its error, in that order. The hint is
|
|
13
|
+
* "{for}-hint" and the error "{for}-error", for the control's aria-describedby.
|
|
14
|
+
*/
|
|
15
|
+
export declare function Field({ label, for: target, hint, error, sprite, children, }: FieldProps): ReactElement;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface FieldsetProps {
|
|
3
|
+
legend: string;
|
|
4
|
+
hint?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/** Fieldset: controls that answer one question together, under its legend. */
|
|
8
|
+
export declare function Fieldset({ legend, hint, children }: FieldsetProps): ReactElement;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export interface FilterFieldProps {
|
|
3
|
+
id: string;
|
|
4
|
+
/** The id of the list it filters; each item carries data-search. */
|
|
5
|
+
list: string;
|
|
6
|
+
label: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
/** Milliseconds to wait for the typing to stop before filtering. */
|
|
9
|
+
debounce?: number;
|
|
10
|
+
/**
|
|
11
|
+
* The search runs elsewhere: the field sends a feitio-filter event with the query and a done() to
|
|
12
|
+
* call when the results are in, and shows it is busy meanwhile.
|
|
13
|
+
*/
|
|
14
|
+
async?: boolean;
|
|
15
|
+
/** What the count says while an asynchronous search runs. */
|
|
16
|
+
busyLabel?: string;
|
|
17
|
+
}
|
|
18
|
+
/** FilterField: narrows a list as you type, and says how many are left. */
|
|
19
|
+
export declare function FilterField({ id, list, label, placeholder, debounce, async: isAsync, busyLabel, }: FilterFieldProps): ReactElement;
|
package/dist/Footer.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface FooterProps {
|
|
3
|
+
name: string;
|
|
4
|
+
since: number;
|
|
5
|
+
links: {
|
|
6
|
+
text: string;
|
|
7
|
+
href: string;
|
|
8
|
+
}[];
|
|
9
|
+
/** A short note, as HTML (it may hold a link). */
|
|
10
|
+
note?: string;
|
|
11
|
+
logo?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** Footer: who made it, since when, and the links that go at the end of every page. */
|
|
14
|
+
export declare function Footer({ name, since, links, note, logo }: FooterProps): ReactElement;
|
package/dist/Grid.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface GridProps {
|
|
3
|
+
gap?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
4
|
+
/** The narrowest a column may get, like "9rem". */
|
|
5
|
+
min?: string;
|
|
6
|
+
as?: 'div' | 'ul';
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/** Grid: columns that fit the width; below their narrowest, they wrap. */
|
|
10
|
+
export declare function Grid({ gap, min, as: Tag, children }: GridProps): ReactElement;
|
package/dist/Header.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface HeaderProps {
|
|
3
|
+
brand: string;
|
|
4
|
+
brandHref: string;
|
|
5
|
+
areas: {
|
|
6
|
+
text: string;
|
|
7
|
+
href: string;
|
|
8
|
+
current?: boolean;
|
|
9
|
+
}[];
|
|
10
|
+
label?: string;
|
|
11
|
+
/** The Menu button's words and the id of the Drawer it opens; without it, no Menu. */
|
|
12
|
+
menu?: {
|
|
13
|
+
label: string;
|
|
14
|
+
target: string;
|
|
15
|
+
};
|
|
16
|
+
sprite?: string;
|
|
17
|
+
logo?: ReactNode;
|
|
18
|
+
/** Tools on the right, like search or the language. */
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/** Header: the brand, the areas of the site and its tools; on a narrow screen, a Menu for a Drawer. */
|
|
22
|
+
export declare function Header({ brand, brandHref, areas, label, menu, sprite, logo, children, }: HeaderProps): ReactElement;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface HeadingProps {
|
|
3
|
+
level?: 1 | 2 | 3 | 4;
|
|
4
|
+
id?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/** Heading: a title at one of the four levels of the scale. */
|
|
8
|
+
export declare function Heading({ level, id, children }: HeadingProps): ReactElement;
|
package/dist/Hint.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface HintProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/** Hint: a short help under a label; the control points to it with aria-describedby. */
|
|
7
|
+
export declare function Hint({ id, children }: HintProps): ReactElement;
|
package/dist/Icon.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export interface IconProps {
|
|
3
|
+
/** The icon's name in the sprite, like "check" or "search". */
|
|
4
|
+
name: string;
|
|
5
|
+
/** Where the sprite is served; without it, the FeitioProvider's, else /feitio/icons/sprite.svg. */
|
|
6
|
+
sprite?: string;
|
|
7
|
+
}
|
|
8
|
+
/** A hand-drawn icon from the sprite. Decorative: the words beside it say what it means. */
|
|
9
|
+
export declare function Icon({ name, sprite }: IconProps): ReactElement;
|
package/dist/Inline.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface InlineProps {
|
|
3
|
+
gap?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
4
|
+
justify?: 'between' | 'end';
|
|
5
|
+
as?: 'div' | 'ul';
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/** Inline: pieces side by side, wrapping when they do not fit, one step of the scale apart. */
|
|
9
|
+
export declare function Inline({ gap, justify, as: Tag, children }: InlineProps): ReactElement;
|
package/dist/Kbd.d.ts
ADDED
package/dist/Label.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface LabelProps {
|
|
3
|
+
/** The control's id. */
|
|
4
|
+
htmlFor: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/** Label: a control's name, tied to it by htmlFor (the control's id). */
|
|
8
|
+
export declare function Label({ htmlFor, children }: LabelProps): ReactElement;
|
package/dist/Link.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface LinkProps {
|
|
3
|
+
href: string;
|
|
4
|
+
newTab?: boolean;
|
|
5
|
+
/** What screen readers hear after the text when it opens in a new tab. */
|
|
6
|
+
newTabLabel?: string;
|
|
7
|
+
sprite?: string;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/** Link: goes somewhere; opening in a new tab, it says so, to the eye and to the ear. */
|
|
11
|
+
export declare function Link({ href, newTab, newTabLabel, sprite, children, }: LinkProps): ReactElement;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface LinkCardProps {
|
|
3
|
+
href: string;
|
|
4
|
+
title: string;
|
|
5
|
+
sprite?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/** LinkCard: a whole card that is one link, its title and a line about where it goes. */
|
|
9
|
+
export declare function LinkCard({ href, title, sprite, children }: LinkCardProps): ReactElement;
|
package/dist/Menu.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
export interface MenuItem {
|
|
3
|
+
text: string;
|
|
4
|
+
href?: string;
|
|
5
|
+
current?: boolean;
|
|
6
|
+
lang?: string;
|
|
7
|
+
hreflang?: string;
|
|
8
|
+
/** For an item without href: what it does. */
|
|
9
|
+
onSelect?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface MenuProps {
|
|
12
|
+
/** What the button says: the current choice, or what the menu is for. */
|
|
13
|
+
label: string;
|
|
14
|
+
/**
|
|
15
|
+
* Words screen readers hear after the label, when it is short ("PT" + ", idioma: Português"). They
|
|
16
|
+
* come after the visible text, never instead of it, so a voice command can still say "PT".
|
|
17
|
+
*/
|
|
18
|
+
hint?: string;
|
|
19
|
+
items: MenuItem[];
|
|
20
|
+
id: string;
|
|
21
|
+
size?: 'small';
|
|
22
|
+
sprite?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Menu: a button that opens a short list of links or actions, moved through with the arrows. */
|
|
25
|
+
export declare function Menu({ label, hint, items, id, size, sprite }: MenuProps): ReactElement;
|
package/dist/Nav.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export interface NavGroup {
|
|
3
|
+
title?: string;
|
|
4
|
+
items: {
|
|
5
|
+
text: string;
|
|
6
|
+
href: string;
|
|
7
|
+
current?: boolean;
|
|
8
|
+
icon?: string;
|
|
9
|
+
}[];
|
|
10
|
+
}
|
|
11
|
+
export interface NavProps {
|
|
12
|
+
groups: NavGroup[];
|
|
13
|
+
label?: string;
|
|
14
|
+
sprite?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Nav: the side navigation of a product, in groups, the current page marked. */
|
|
17
|
+
export declare function Nav({ groups, label, sprite }: NavProps): ReactElement;
|
package/dist/Notice.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode, type Ref } from 'react';
|
|
2
|
+
export interface NoticeProps {
|
|
3
|
+
status?: 'ok' | 'warn' | 'error';
|
|
4
|
+
title: string;
|
|
5
|
+
close?: boolean;
|
|
6
|
+
/** Milliseconds until it closes by itself (never for a warning or an error). */
|
|
7
|
+
timeout?: number;
|
|
8
|
+
id?: string;
|
|
9
|
+
hidden?: boolean;
|
|
10
|
+
/** "status" after an action, "alert" for an error after an action. */
|
|
11
|
+
role?: 'status' | 'alert';
|
|
12
|
+
closeLabel?: string;
|
|
13
|
+
sprite?: string;
|
|
14
|
+
/** The element, for useNotices().show() and close(). */
|
|
15
|
+
ref?: Ref<HTMLDivElement | null>;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/** Notice: a message about the page or about what just happened; it may close, or close by itself. */
|
|
19
|
+
export declare function Notice({ status, title, close, timeout, id, hidden, role, closeLabel, sprite, ref, children, }: NoticeProps): ReactElement;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export interface PaginationProps {
|
|
3
|
+
label: string;
|
|
4
|
+
current: number;
|
|
5
|
+
total: number;
|
|
6
|
+
href: (page: number) => string;
|
|
7
|
+
count?: string;
|
|
8
|
+
perPage?: {
|
|
9
|
+
label: string;
|
|
10
|
+
options: number[];
|
|
11
|
+
current: number;
|
|
12
|
+
href: (n: number) => string;
|
|
13
|
+
};
|
|
14
|
+
previousLabel?: string;
|
|
15
|
+
nextLabel?: string;
|
|
16
|
+
pageLabel?: (page: number) => string;
|
|
17
|
+
sprite?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Pagination: the pages of a long list, the first and last always in reach. */
|
|
20
|
+
export declare function Pagination({ label, current, total, href, count, perPage, previousLabel, nextLabel, pageLabel, sprite, }: PaginationProps): ReactElement;
|
package/dist/Radios.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export interface RadiosProps {
|
|
3
|
+
legend: string;
|
|
4
|
+
name: string;
|
|
5
|
+
options: string[];
|
|
6
|
+
value?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/** "inline" puts short options side by side. */
|
|
9
|
+
layout?: 'stack' | 'inline';
|
|
10
|
+
onChange?: (value: string) => void;
|
|
11
|
+
}
|
|
12
|
+
/** Radios: one answer out of a few, all of them in sight. */
|
|
13
|
+
export declare function Radios({ legend, name, options, value, disabled, layout, onChange, }: RadiosProps): ReactElement;
|
package/dist/Search.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface SearchProps {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
closeLabel?: string;
|
|
7
|
+
keys?: {
|
|
8
|
+
open: string;
|
|
9
|
+
choose: string;
|
|
10
|
+
close: string;
|
|
11
|
+
};
|
|
12
|
+
sprite?: string;
|
|
13
|
+
/** The results, as list items. */
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/** Search: the site's search in a Dialog, its results in a list, moved through with the keyboard. */
|
|
17
|
+
export declare function Search({ id, title, placeholder, closeLabel, keys, sprite, children, }: SearchProps): ReactElement;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export interface SegmentedControlProps {
|
|
3
|
+
label: string;
|
|
4
|
+
options: string[];
|
|
5
|
+
value?: string;
|
|
6
|
+
onChange?: (value: string) => void;
|
|
7
|
+
}
|
|
8
|
+
/** SegmentedControl: a few options side by side, one of them on. */
|
|
9
|
+
export declare function SegmentedControl({ label, options, value, onChange, }: SegmentedControlProps): ReactElement;
|
package/dist/Select.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export interface SelectProps {
|
|
3
|
+
id: string;
|
|
4
|
+
options: string[];
|
|
5
|
+
value?: string;
|
|
6
|
+
/** A first, empty option, like "Choose…". */
|
|
7
|
+
empty?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
invalid?: boolean;
|
|
10
|
+
describedBy?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
sprite?: string;
|
|
13
|
+
onChange?: (value: string) => void;
|
|
14
|
+
}
|
|
15
|
+
/** Select: one option out of a long list, closed until opened. */
|
|
16
|
+
export declare function Select({ id, options, value, empty, disabled, invalid, describedBy, name, sprite, onChange, }: SelectProps): ReactElement;
|