@ishtar-sink/vega 0.1.0 → 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 -6
- package/dist/app-shell/app-shell.constants.d.ts +13 -0
- package/dist/app-shell/app-shell.d.ts +6 -0
- package/dist/app-shell/app-shell.types.d.ts +20 -0
- package/dist/app-shell/bottom-nav.d.ts +3 -0
- package/dist/app-shell/bottom-nav.types.d.ts +12 -0
- package/dist/app-shell/nav-link.d.ts +11 -0
- package/dist/app-shell/nav.types.d.ts +22 -0
- package/dist/app-shell/sidebar.d.ts +3 -0
- package/dist/app-shell/sidebar.types.d.ts +22 -0
- package/dist/app-shell/topbar.d.ts +3 -0
- package/dist/app-shell/topbar.types.d.ts +9 -0
- package/dist/app-shell/use-focus-trap.d.ts +6 -0
- package/dist/app-shell/use-media-query.d.ts +2 -0
- package/dist/bottom-sheet/bottom-sheet.constants.d.ts +3 -0
- package/dist/bottom-sheet/bottom-sheet.d.ts +3 -0
- package/dist/bottom-sheet/bottom-sheet.types.d.ts +26 -0
- package/dist/bottom-sheet/use-bottom-sheet.d.ts +14 -0
- package/dist/button/button.d.ts +5 -1
- package/dist/callout/callout.constants.d.ts +4 -0
- package/dist/callout/callout.d.ts +3 -0
- package/dist/callout/callout.types.d.ts +14 -0
- package/dist/card-link/card-button.d.ts +3 -0
- package/dist/card-link/card-link.d.ts +3 -0
- package/dist/card-link/card-link.types.d.ts +10 -0
- package/dist/disclosure/accordion-context.d.ts +5 -0
- package/dist/disclosure/accordion.d.ts +3 -0
- package/dist/disclosure/disclosure.d.ts +3 -0
- package/dist/disclosure/disclosure.types.d.ts +24 -0
- package/dist/disclosure/use-disclosure.d.ts +22 -0
- package/dist/focus-header/focus-header.constants.d.ts +2 -0
- package/dist/focus-header/focus-header.d.ts +3 -0
- package/dist/focus-header/focus-header.types.d.ts +24 -0
- package/dist/icons/icon.d.ts +10 -0
- package/dist/icons/icon.types.d.ts +5 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/interface-icons.d.ts +144 -0
- package/dist/index.d.ts +29 -2
- package/dist/index.js +1813 -948
- package/dist/progress-bar/progress-bar.d.ts +5 -1
- package/dist/prose/index.d.ts +2 -0
- package/dist/prose/prose.constants.d.ts +2 -0
- package/dist/prose/prose.d.ts +2 -0
- package/dist/prose/prose.types.d.ts +23 -0
- package/dist/prose/prose.utils.d.ts +4 -0
- package/dist/prose.js +91 -0
- package/dist/radio-group/radio-group.constants.d.ts +4 -0
- package/dist/radio-group/radio-group.d.ts +2 -0
- package/dist/radio-group/radio-group.types.d.ts +41 -0
- package/dist/radio-group/radio-option.d.ts +12 -0
- package/dist/style.css +1 -1
- package/dist/switch/switch.d.ts +3 -0
- package/dist/switch/switch.types.d.ts +11 -0
- package/dist/text-area-field/text-area-field.d.ts +2 -0
- package/dist/text-area-field/text-area-field.types.d.ts +17 -0
- package/dist/text-area-field/use-auto-resize.d.ts +7 -0
- package/package.json +15 -2
package/README.md
CHANGED
|
@@ -17,16 +17,19 @@ A Vega nasce da extração do `@atria/ui` e do `@atria/theme`, a biblioteca e o
|
|
|
17
17
|
|
|
18
18
|
| Grupo | Componentes e funções |
|
|
19
19
|
|---|---|
|
|
20
|
-
| Ações | `Button
|
|
21
|
-
| Campos | `TextField`, `SelectField`, `Checkbox`, `SegmentedField`, `Autocomplete`, `TagField`, `ColorField`, `ColorPicker`, `DEFAULT_COLOR_FIELD_LABELS`, `hexToRgb`, `rgbToHex`, `hslToRgb`, `rgbToHsl` |
|
|
20
|
+
| Ações | `Button` (com `size` e `block` desde a 0.2.0), `IconButton`, `MenuButton` |
|
|
21
|
+
| Campos | `TextField`, `SelectField`, `Checkbox`, `SegmentedField`, `Autocomplete`, `TagField`, `ColorField`, `ColorPicker`, `DEFAULT_COLOR_FIELD_LABELS`, `hexToRgb`, `rgbToHex`, `hslToRgb`, `rgbToHsl`; na 0.2.0, `Switch`, `RadioGroup`, `TextAreaField` |
|
|
22
22
|
| Data e hora | `Calendar`, `DateField`, `TimeField`, `DateTimeField`, `PeriodField`, `parseTime`, `maskTime`, `resolvePeriod` |
|
|
23
23
|
| Dinheiro | `MoneyField`, `maskMoneyInput`, `parseMoneyInput`, `formatCents` |
|
|
24
|
-
| Estrutura | `Card`, `PageHeader`, `Toolbar`, `Tabs`, `ViewSwitcher`, `FormGrid`, `FormActions` |
|
|
25
|
-
| Diálogos e avisos | `Dialog`, `ConfirmDialog`, `Toast`, `ToastRegion` |
|
|
26
|
-
| Estados | `EmptyState`, `LoadingState`, `Skeleton`, `ErrorState`, `ProgressBar` |
|
|
24
|
+
| Estrutura | `Card`, `PageHeader`, `Toolbar`, `Tabs`, `ViewSwitcher`, `FormGrid`, `FormActions`; na 0.2.0, `CardLink`, `CardButton`, `FocusHeader`, `Disclosure`, `Accordion` |
|
|
25
|
+
| Diálogos e avisos | `Dialog`, `ConfirmDialog`, `Toast`, `ToastRegion`; na 0.2.0, `BottomSheet`, `Callout` |
|
|
26
|
+
| Estados | `EmptyState`, `LoadingState`, `Skeleton`, `ErrorState`, `ProgressBar` (com `valueText` e `indeterminate` desde a 0.2.0) |
|
|
27
27
|
| Marca e itens | `BrandLogo`, `Badge`, `ItemSwatch`, `ListIcon`, `GridIcon`, `ShelfIcon`, `TableIcon`, `DayIcon`, `TimelineIcon` |
|
|
28
|
+
| Ícones de interface | Os 36 da seção [Ícones](#ícones), na 0.2.0 |
|
|
29
|
+
| Navegação | `AppShell`, `Sidebar`, `BottomNav`, `Topbar`, na 0.2.0 |
|
|
30
|
+
| Conteúdo | `Prose`, na 0.2.0, pela entrada `@ishtar-sink/vega/prose` |
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
Os grupos Ações, Campos, Data e hora, Dinheiro, Estrutura, Diálogos e avisos, Estados e Marca e itens entraram na 0.1.0; o que a tabela marca com 0.2.0, e os grupos Ícones de interface, Navegação e Conteúdo, entraram na 0.2.0.
|
|
30
33
|
|
|
31
34
|
## Princípios
|
|
32
35
|
|
|
@@ -69,6 +72,39 @@ export function Exemplo() {
|
|
|
69
72
|
}
|
|
70
73
|
```
|
|
71
74
|
|
|
75
|
+
## Ícones
|
|
76
|
+
|
|
77
|
+
Os 36 ícones de interface vêm do [Lucide](https://lucide.dev), pelo pacote `lucide-react` (licença ISC), com os nomes da Vega: `HomeIcon`, `BookOpenIcon`, `LayersIcon`, `TimerIcon`, `UsersIcon`, `MenuIcon`, `ChevronLeftIcon`, `ChevronRightIcon`, `ChevronDownIcon`, `ArrowLeftIcon`, `CloseIcon`, `PlusIcon`, `MinusIcon`, `DownloadIcon`, `UploadIcon`, `FlagIcon`, `RefreshIcon`, `EyeIcon`, `CheckIcon`, `CircleCheckIcon`, `InfoIcon`, `AlertTriangleIcon`, `CircleAlertIcon`, `WifiOffIcon`, `CloudCheckIcon`, `UserIcon`, `SettingsIcon`, `LogOutIcon`, `SunIcon`, `MoonIcon`, `LightbulbIcon`, `ClockIcon`, `CalendarIcon`, `PencilIcon`, `SearchIcon` e `TrashIcon`.
|
|
78
|
+
|
|
79
|
+
Os ícones são sempre decorativos (`aria-hidden`), usam a cor do texto (`currentColor`) e têm tamanho 16, 20 ou 24, com 20 por padrão. O nome acessível fica no elemento que contém o ícone.
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import { Button, HomeIcon } from '@ishtar-sink/vega';
|
|
83
|
+
|
|
84
|
+
export function Inicio() {
|
|
85
|
+
return (
|
|
86
|
+
<Button variant="primary">
|
|
87
|
+
<HomeIcon size={16} />
|
|
88
|
+
Início
|
|
89
|
+
</Button>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Texto formatado (Prose)
|
|
95
|
+
|
|
96
|
+
O `Prose` sai numa entrada própria, `@ishtar-sink/vega/prose`, para que quem não usa Markdown não carregue o parser. O HTML cru do texto é ignorado, e links com `javascript:`, `data:` ou `vbscript:` são bloqueados.
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
import { Prose } from '@ishtar-sink/vega/prose';
|
|
100
|
+
|
|
101
|
+
export function Licao({ texto }: { texto: string }) {
|
|
102
|
+
return <Prose markdown={texto} size="reading" />;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Extensões do produto, como fórmulas de matemática, entram por `remarkPlugins` (sintaxe nova) e `components` (como cada elemento é renderizado), sem mudar a Vega.
|
|
107
|
+
|
|
72
108
|
## Tema próprio
|
|
73
109
|
|
|
74
110
|
```ts
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Textos padrão da `Sidebar` e da `BottomNav`. */
|
|
2
|
+
export declare const DEFAULT_NAV_LABELS: {
|
|
3
|
+
readonly navigation: "Principal";
|
|
4
|
+
};
|
|
5
|
+
/** Textos padrão do `AppShell`. */
|
|
6
|
+
export declare const DEFAULT_APP_SHELL_LABELS: {
|
|
7
|
+
readonly skipToContent: "Pular para o conteúdo";
|
|
8
|
+
readonly openMenu: "Abrir menu";
|
|
9
|
+
};
|
|
10
|
+
/** Abaixo de 720 px a navegação vira gaveta ou barra inferior, como o `@media` dos estilos. */
|
|
11
|
+
export declare const COMPACT_QUERY: string;
|
|
12
|
+
/** Elementos que recebem foco dentro da gaveta. */
|
|
13
|
+
export declare const FOCUSABLE = "a[href], button:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AppShellProps } from './app-shell.types';
|
|
2
|
+
/**
|
|
3
|
+
* Estrutura da aplicação: link de pular, `Sidebar`, `Topbar` e `<main>`. Abaixo de 720 px, a
|
|
4
|
+
* navegação vira gaveta com botão de menu ou `BottomNav`, conforme `mobileNav`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function AppShell({ sidebar, topbar, mobileNav, hideNavigation, children, labels, className, ...rest }: AppShellProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
import { SidebarProps } from './sidebar.types';
|
|
3
|
+
import { TopbarProps } from './topbar.types';
|
|
4
|
+
export interface AppShellProps extends ComponentPropsWithRef<'div'> {
|
|
5
|
+
/** Props da `Sidebar`; a gaveta é controlada pelo próprio `AppShell`. */
|
|
6
|
+
sidebar: Omit<SidebarProps, 'drawer' | 'open' | 'onClose'>;
|
|
7
|
+
/** Props da `Topbar`; sem ela, a barra só aparece no modo gaveta, com o botão de menu. */
|
|
8
|
+
topbar?: TopbarProps;
|
|
9
|
+
/** Navegação abaixo de 720 px: gaveta com botão de menu ou barra inferior. Padrão: `drawer`. */
|
|
10
|
+
mobileNav?: 'drawer' | 'bottom';
|
|
11
|
+
/** Esconde toda a navegação (barra lateral, gaveta, barra inferior e link de pular). */
|
|
12
|
+
hideNavigation?: boolean;
|
|
13
|
+
/** Conteúdo da página, dentro do `<main>`. */
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/** Textos visíveis e nomes acessíveis. Padrão: `Pular para o conteúdo` e `Abrir menu`. */
|
|
16
|
+
labels?: Partial<{
|
|
17
|
+
skipToContent: string;
|
|
18
|
+
openMenu: string;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
import { NavItem, RenderNavLink } from './nav.types';
|
|
3
|
+
export interface BottomNavProps extends ComponentPropsWithRef<'nav'> {
|
|
4
|
+
/** De 3 a 5 destinos; fora disso, um aviso no console em desenvolvimento. */
|
|
5
|
+
items: readonly NavItem[];
|
|
6
|
+
/** Desenha cada link com o roteador do produto; sem ele, um `<a href>` simples. */
|
|
7
|
+
renderLink?: RenderNavLink;
|
|
8
|
+
/** Textos visíveis e nomes acessíveis. Padrão: `{ navigation: 'Principal' }`. */
|
|
9
|
+
labels?: Partial<{
|
|
10
|
+
navigation: string;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NavItem, RenderNavLink } from './nav.types';
|
|
2
|
+
interface NavLinkProps {
|
|
3
|
+
item: NavItem;
|
|
4
|
+
className: string | undefined;
|
|
5
|
+
iconClassName?: string | undefined;
|
|
6
|
+
badgeClassName?: string | undefined;
|
|
7
|
+
renderLink?: RenderNavLink;
|
|
8
|
+
}
|
|
9
|
+
/** Link de um destino: usa o `renderLink` do produto ou, sem ele, um `<a href>` simples. */
|
|
10
|
+
export declare function NavLink({ item, className, iconClassName, badgeClassName, renderLink, }: NavLinkProps): string | number | bigint | boolean | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | import('react').JSX.Element | null | undefined;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Destino da navegação, usado pela `Sidebar`, pela `BottomNav` e pelo `AppShell`. */
|
|
3
|
+
export interface NavItem {
|
|
4
|
+
/** Identificador estável do destino, usado como chave. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Rótulo visível do destino. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Ícone em SVG inline; fica dentro de um `<span aria-hidden="true">`. */
|
|
9
|
+
icon: ReactNode;
|
|
10
|
+
/** Endereço do destino, usado pelo `<a>` simples ou pelo `renderLink`. */
|
|
11
|
+
href: string;
|
|
12
|
+
/** Marca o destino atual com `aria-current="page"`. */
|
|
13
|
+
current?: boolean;
|
|
14
|
+
/** Selo opcional ao lado do rótulo (ex.: a contagem de pendências). */
|
|
15
|
+
badge?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/** Desenha o link com o componente do roteador do produto, repassando as props recebidas. */
|
|
18
|
+
export type RenderNavLink = (item: NavItem, props: {
|
|
19
|
+
className: string;
|
|
20
|
+
'aria-current'?: 'page';
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}) => ReactNode;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SidebarProps } from './sidebar.types';
|
|
2
|
+
/** Barra lateral com a marca, a navegação principal e o rodapé; vira gaveta com `drawer`. */
|
|
3
|
+
export declare function Sidebar({ brand, items, renderLink, footer, drawer, open, onClose, labels, className, onKeyDown, ref, ...rest }: SidebarProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
import { NavItem, RenderNavLink } from './nav.types';
|
|
3
|
+
export interface SidebarProps extends ComponentPropsWithRef<'aside'> {
|
|
4
|
+
/** Marca do produto, no topo da barra. */
|
|
5
|
+
brand: ReactNode;
|
|
6
|
+
/** Destinos da navegação principal. */
|
|
7
|
+
items: readonly NavItem[];
|
|
8
|
+
/** Desenha cada link com o roteador do produto; sem ele, um `<a href>` simples. */
|
|
9
|
+
renderLink?: RenderNavLink;
|
|
10
|
+
/** Conteúdo do rodapé (ex.: conta, tema, ajustes). */
|
|
11
|
+
footer?: ReactNode;
|
|
12
|
+
/** Modo gaveta: barra fixa sobre o conteúdo, com foco preso enquanto aberta. Padrão: `false`. */
|
|
13
|
+
drawer?: boolean;
|
|
14
|
+
/** Gaveta aberta; fechada, ela fica `inert`. Só vale com `drawer`. */
|
|
15
|
+
open?: boolean;
|
|
16
|
+
/** Chamado no Escape e ao escolher um link com a gaveta aberta. */
|
|
17
|
+
onClose?: () => void;
|
|
18
|
+
/** Textos visíveis e nomes acessíveis. Padrão: `{ navigation: 'Principal' }`. */
|
|
19
|
+
labels?: Partial<{
|
|
20
|
+
navigation: string;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
export interface TopbarProps extends ComponentPropsWithRef<'header'> {
|
|
3
|
+
/** Slot do início da barra (ex.: o botão de menu ou o voltar). */
|
|
4
|
+
start?: ReactNode;
|
|
5
|
+
/** Slot do meio da barra (ex.: o título da tela). */
|
|
6
|
+
center?: ReactNode;
|
|
7
|
+
/** Slot do fim da barra (ex.: ações e busca). */
|
|
8
|
+
end?: ReactNode;
|
|
9
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { KeyboardEvent, RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Prende o foco dentro de `ref` enquanto `active`: foca o primeiro item ao ativar, faz o Tab dar a
|
|
4
|
+
* volta e entrega o Escape a `onEscape`. Devolve o `onKeyDown` a ligar no elemento.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useFocusTrap(ref: RefObject<HTMLElement | null>, active: boolean, onEscape?: () => void): (event: KeyboardEvent<HTMLElement>) => void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { BottomSheetProps } from './bottom-sheet.types';
|
|
2
|
+
/** Folha modal sobre o `<dialog>` nativo: embaixo em telas estreitas e na lateral a partir de 720 px. */
|
|
3
|
+
export declare function BottomSheet({ open, onClose, title, description, footer, placement, labels, children, className, ref, ...rest }: BottomSheetProps): import('react').JSX.Element | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
/** Posição da folha: `auto` fica embaixo abaixo de 720 px e na lateral a partir daí. */
|
|
3
|
+
export type BottomSheetPlacement = 'auto' | 'bottom' | 'side';
|
|
4
|
+
/** Textos visíveis do `BottomSheet`. */
|
|
5
|
+
export interface BottomSheetLabels {
|
|
6
|
+
/** Nome acessível do botão de fechar. Padrão: `Fechar`. */
|
|
7
|
+
close: string;
|
|
8
|
+
}
|
|
9
|
+
export interface BottomSheetProps extends Omit<ComponentPropsWithRef<'dialog'>, 'title' | 'open'> {
|
|
10
|
+
/** Abre a folha como modal (`showModal()`); ao ficar `false`, fecha e devolve o foco. */
|
|
11
|
+
open: boolean;
|
|
12
|
+
/** Chamado no Esc, no clique no fundo e no botão de fechar. */
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
/** Título, lido como nome acessível. */
|
|
15
|
+
title: ReactNode;
|
|
16
|
+
/** Descrição curta, ligada ao diálogo por `aria-describedby`. */
|
|
17
|
+
description?: ReactNode;
|
|
18
|
+
/** Rodapé fixo, fora da rolagem do conteúdo. */
|
|
19
|
+
footer?: ReactNode;
|
|
20
|
+
/** Posição da folha. Padrão: `auto`. */
|
|
21
|
+
placement?: BottomSheetPlacement;
|
|
22
|
+
/** Sobrescreve os textos padrão. */
|
|
23
|
+
labels?: Partial<BottomSheetLabels>;
|
|
24
|
+
/** Conteúdo rolável. */
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { KeyboardEvent, MouseEvent, Ref, SyntheticEvent } from 'react';
|
|
2
|
+
interface UseBottomSheetArgs {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
ref?: Ref<HTMLDialogElement>;
|
|
6
|
+
}
|
|
7
|
+
/** Abre o `<dialog>` como modal, prende o Tab e devolve o foco a quem abriu. */
|
|
8
|
+
export declare function useBottomSheet({ open, onClose, ref }: UseBottomSheetArgs): {
|
|
9
|
+
dialogRef: import('react').RefObject<HTMLDialogElement | null>;
|
|
10
|
+
onKeyDown: (event: KeyboardEvent<HTMLDialogElement>) => void;
|
|
11
|
+
onCancel: (event: SyntheticEvent<HTMLDialogElement>) => void;
|
|
12
|
+
onClick: (event: MouseEvent<HTMLDialogElement>) => void;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
package/dist/button/button.d.ts
CHANGED
|
@@ -7,5 +7,9 @@ export interface ButtonProps extends ComponentPropsWithRef<'button'> {
|
|
|
7
7
|
loading?: boolean;
|
|
8
8
|
/** Cor CSS usada pela variação `muted` (ex.: a cor de uma categoria). */
|
|
9
9
|
tint?: string;
|
|
10
|
+
/** `lg`: altura mínima de 48 px. Padrão: `md`. */
|
|
11
|
+
size?: 'md' | 'lg';
|
|
12
|
+
/** Ocupa a largura toda do contêiner. */
|
|
13
|
+
block?: boolean;
|
|
10
14
|
}
|
|
11
|
-
export declare function Button({ variant, loading, tint, type, disabled, className, style, children, ...rest }: ButtonProps): import('react').JSX.Element;
|
|
15
|
+
export declare function Button({ variant, loading, tint, size, block, type, disabled, className, style, children, ...rest }: ButtonProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
export type CalloutTone = 'neutral' | 'accent' | 'info' | 'success' | 'warning' | 'danger';
|
|
3
|
+
export interface CalloutProps extends Omit<ComponentPropsWithRef<'aside'>, 'title'> {
|
|
4
|
+
/** Tom do aviso, que define o fundo, a cor e o ícone. Padrão: `neutral`. */
|
|
5
|
+
tone?: CalloutTone;
|
|
6
|
+
/** Título do aviso; também dá o nome acessível ao `<aside>`. */
|
|
7
|
+
title?: ReactNode;
|
|
8
|
+
/** Ícone no lugar do padrão do tom; `false` remove o ícone. */
|
|
9
|
+
icon?: ReactNode | false;
|
|
10
|
+
/** Ação no fim do aviso, como um botão ou um link. */
|
|
11
|
+
action?: ReactNode;
|
|
12
|
+
/** `polite` anuncia o aviso como região viva (`role="status"`). Padrão: `off`. */
|
|
13
|
+
live?: 'off' | 'polite';
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
import { CardTone } from '../card/card';
|
|
3
|
+
export interface CardLinkProps extends ComponentPropsWithRef<'a'> {
|
|
4
|
+
/** Tom do fundo e da borda, o mesmo do `Card`. Padrão: `default`. */
|
|
5
|
+
tone?: CardTone;
|
|
6
|
+
}
|
|
7
|
+
export interface CardButtonProps extends ComponentPropsWithRef<'button'> {
|
|
8
|
+
/** Tom do fundo e da borda, o mesmo do `Card`. Padrão: `default`. */
|
|
9
|
+
tone?: CardTone;
|
|
10
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DisclosureProps } from './disclosure.types';
|
|
2
|
+
/** Seção recolhível sobre `<details>` e `<summary>` nativos. */
|
|
3
|
+
export declare function Disclosure({ title, icon, open, defaultOpen, onOpenChange, tone, className, children, ...rest }: DisclosureProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
export type DisclosureTone = 'default' | 'accent' | 'warning' | 'info';
|
|
3
|
+
export interface DisclosureProps extends Omit<ComponentPropsWithRef<'details'>, 'title' | 'open' | 'onToggle'> {
|
|
4
|
+
/** Título, exibido no resumo e lido como nome acessível. */
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
/** Ícone decorativo antes do título. */
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
/** Estado aberto. Quando definido, o componente é controlado. */
|
|
9
|
+
open?: boolean;
|
|
10
|
+
/** Estado inicial quando não controlado. Padrão: `false`. */
|
|
11
|
+
defaultOpen?: boolean;
|
|
12
|
+
/** Chamado com o novo estado; no modo controlado, o pai decide se muda `open`. */
|
|
13
|
+
onOpenChange?: (open: boolean) => void;
|
|
14
|
+
/** Tom do fundo, do título e do ícone. Padrão: `default`. */
|
|
15
|
+
tone?: DisclosureTone;
|
|
16
|
+
}
|
|
17
|
+
export interface AccordionProps extends ComponentPropsWithRef<'div'> {
|
|
18
|
+
/**
|
|
19
|
+
* `single` mantém só um `Disclosure` aberto (use-os não controlados); `multiple` os deixa
|
|
20
|
+
* independentes. Padrão: `multiple`.
|
|
21
|
+
*/
|
|
22
|
+
type?: 'single' | 'multiple';
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { KeyboardEvent, MouseEvent, SyntheticEvent } from 'react';
|
|
2
|
+
interface Options {
|
|
3
|
+
open?: boolean;
|
|
4
|
+
defaultOpen?: boolean;
|
|
5
|
+
onOpenChange?: (open: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
/** Estado controlado ou não do `<details>`, teclado do resumo e aviso ao `Accordion`. */
|
|
8
|
+
export declare function useDisclosure({ open, defaultOpen, onOpenChange }: Options): {
|
|
9
|
+
detailsProps: {
|
|
10
|
+
open: true | undefined;
|
|
11
|
+
onToggle: (event: SyntheticEvent<HTMLDetailsElement>) => void;
|
|
12
|
+
} | {
|
|
13
|
+
open: boolean;
|
|
14
|
+
onToggle?: undefined;
|
|
15
|
+
};
|
|
16
|
+
summaryProps: {
|
|
17
|
+
onClick: (event: MouseEvent<HTMLElement>) => void;
|
|
18
|
+
onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
|
|
19
|
+
};
|
|
20
|
+
accordion: import('./accordion-context').AccordionContextValue | null;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FocusHeaderProps } from './focus-header.types';
|
|
2
|
+
export type { FocusHeaderProps, FocusHeaderLabels } from './focus-header.types';
|
|
3
|
+
export declare function FocusHeader({ title, onExit, position, progress, labels, className, ...rest }: FocusHeaderProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
export interface FocusHeaderLabels {
|
|
3
|
+
/** Nome acessível do botão de sair. Padrão: `Sair`. */
|
|
4
|
+
exit: string;
|
|
5
|
+
}
|
|
6
|
+
export interface FocusHeaderProps extends Omit<ComponentPropsWithRef<'header'>, 'title'> {
|
|
7
|
+
/** Título do fluxo, exibido como `h1` em uma linha. */
|
|
8
|
+
title: string;
|
|
9
|
+
/** Chamado quando a pessoa aciona o botão de sair. */
|
|
10
|
+
onExit: () => void;
|
|
11
|
+
/** Posição no fluxo, em texto livre (ex.: `3/8`). */
|
|
12
|
+
position?: string;
|
|
13
|
+
/** Progresso do fluxo; sem ele a barra não aparece. */
|
|
14
|
+
progress?: {
|
|
15
|
+
/** Valor atual. */
|
|
16
|
+
value: number;
|
|
17
|
+
/** Valor que representa 100%. */
|
|
18
|
+
max: number;
|
|
19
|
+
/** Nome acessível da barra. */
|
|
20
|
+
label: string;
|
|
21
|
+
};
|
|
22
|
+
/** Textos sobrescrevíveis, com padrão em pt-br. */
|
|
23
|
+
labels?: Partial<FocusHeaderLabels>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LucideIcon } from 'lucide-react';
|
|
2
|
+
import { IconProps } from './icon.types';
|
|
3
|
+
/**
|
|
4
|
+
* Embrulha um ícone do `lucide-react` com os padrões da Vega: traço `currentColor`
|
|
5
|
+
* de espessura 2 e tamanho 20.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createIcon(Lucide: LucideIcon, displayName: string): {
|
|
8
|
+
({ size, ...rest }: IconProps): import('react').JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
package/dist/icons/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { ListIcon, GridIcon, ShelfIcon, TableIcon, DayIcon, TimelineIcon } from './view-icons';
|
|
2
2
|
export type { ViewIconProps } from './view-icons';
|
|
3
|
+
export { HomeIcon, BookOpenIcon, LayersIcon, TimerIcon, UsersIcon, MenuIcon, ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon, ArrowLeftIcon, CloseIcon, PlusIcon, MinusIcon, DownloadIcon, UploadIcon, FlagIcon, RefreshIcon, EyeIcon, CheckIcon, CircleCheckIcon, InfoIcon, AlertTriangleIcon, CircleAlertIcon, WifiOffIcon, CloudCheckIcon, UserIcon, SettingsIcon, LogOutIcon, SunIcon, MoonIcon, LightbulbIcon, ClockIcon, CalendarIcon, PencilIcon, SearchIcon, TrashIcon, } from './interface-icons';
|
|
4
|
+
export type { IconProps } from './icon.types';
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
export declare const HomeIcon: {
|
|
2
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
3
|
+
displayName: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const BookOpenIcon: {
|
|
6
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const LayersIcon: {
|
|
10
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const TimerIcon: {
|
|
14
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const UsersIcon: {
|
|
18
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const MenuIcon: {
|
|
22
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
23
|
+
displayName: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const ChevronLeftIcon: {
|
|
26
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
27
|
+
displayName: string;
|
|
28
|
+
};
|
|
29
|
+
export declare const ChevronRightIcon: {
|
|
30
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
31
|
+
displayName: string;
|
|
32
|
+
};
|
|
33
|
+
export declare const ChevronDownIcon: {
|
|
34
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
35
|
+
displayName: string;
|
|
36
|
+
};
|
|
37
|
+
export declare const ArrowLeftIcon: {
|
|
38
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
39
|
+
displayName: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const CloseIcon: {
|
|
42
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
43
|
+
displayName: string;
|
|
44
|
+
};
|
|
45
|
+
export declare const PlusIcon: {
|
|
46
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
47
|
+
displayName: string;
|
|
48
|
+
};
|
|
49
|
+
export declare const MinusIcon: {
|
|
50
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
51
|
+
displayName: string;
|
|
52
|
+
};
|
|
53
|
+
export declare const DownloadIcon: {
|
|
54
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
55
|
+
displayName: string;
|
|
56
|
+
};
|
|
57
|
+
export declare const UploadIcon: {
|
|
58
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
59
|
+
displayName: string;
|
|
60
|
+
};
|
|
61
|
+
export declare const FlagIcon: {
|
|
62
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
63
|
+
displayName: string;
|
|
64
|
+
};
|
|
65
|
+
export declare const RefreshIcon: {
|
|
66
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
67
|
+
displayName: string;
|
|
68
|
+
};
|
|
69
|
+
export declare const EyeIcon: {
|
|
70
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
71
|
+
displayName: string;
|
|
72
|
+
};
|
|
73
|
+
export declare const CheckIcon: {
|
|
74
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
75
|
+
displayName: string;
|
|
76
|
+
};
|
|
77
|
+
export declare const CircleCheckIcon: {
|
|
78
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
79
|
+
displayName: string;
|
|
80
|
+
};
|
|
81
|
+
export declare const InfoIcon: {
|
|
82
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
83
|
+
displayName: string;
|
|
84
|
+
};
|
|
85
|
+
export declare const AlertTriangleIcon: {
|
|
86
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
87
|
+
displayName: string;
|
|
88
|
+
};
|
|
89
|
+
export declare const CircleAlertIcon: {
|
|
90
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
91
|
+
displayName: string;
|
|
92
|
+
};
|
|
93
|
+
export declare const WifiOffIcon: {
|
|
94
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
95
|
+
displayName: string;
|
|
96
|
+
};
|
|
97
|
+
export declare const CloudCheckIcon: {
|
|
98
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
99
|
+
displayName: string;
|
|
100
|
+
};
|
|
101
|
+
export declare const UserIcon: {
|
|
102
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
103
|
+
displayName: string;
|
|
104
|
+
};
|
|
105
|
+
export declare const SettingsIcon: {
|
|
106
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
107
|
+
displayName: string;
|
|
108
|
+
};
|
|
109
|
+
export declare const LogOutIcon: {
|
|
110
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
111
|
+
displayName: string;
|
|
112
|
+
};
|
|
113
|
+
export declare const SunIcon: {
|
|
114
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
115
|
+
displayName: string;
|
|
116
|
+
};
|
|
117
|
+
export declare const MoonIcon: {
|
|
118
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
119
|
+
displayName: string;
|
|
120
|
+
};
|
|
121
|
+
export declare const LightbulbIcon: {
|
|
122
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
123
|
+
displayName: string;
|
|
124
|
+
};
|
|
125
|
+
export declare const ClockIcon: {
|
|
126
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
127
|
+
displayName: string;
|
|
128
|
+
};
|
|
129
|
+
export declare const CalendarIcon: {
|
|
130
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
131
|
+
displayName: string;
|
|
132
|
+
};
|
|
133
|
+
export declare const PencilIcon: {
|
|
134
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
135
|
+
displayName: string;
|
|
136
|
+
};
|
|
137
|
+
export declare const SearchIcon: {
|
|
138
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
139
|
+
displayName: string;
|
|
140
|
+
};
|
|
141
|
+
export declare const TrashIcon: {
|
|
142
|
+
({ size, ...rest }: import('./icon.types').IconProps): import('react').JSX.Element;
|
|
143
|
+
displayName: string;
|
|
144
|
+
};
|