@rendra-ui/web 2.4.0 → 2.5.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 +24 -1
- package/dist/base.css +33 -1
- package/dist/{button-C6rjowQi.js → button-BzJgR2gH.js} +86 -21
- package/dist/button-BzJgR2gH.js.map +1 -0
- package/dist/chart.js +61 -15
- package/dist/chart.js.map +1 -1
- package/dist/cli/auditar.js +1 -1
- package/dist/cli/codigos.js +2 -2
- package/dist/cli/executar-auditar.js +1 -1
- package/dist/cli/help.js +1 -1
- package/dist/cli/trocar.js +2 -2
- package/dist/cli/typescript-loader.js +1 -1
- package/dist/{cn-DXDpTGsu.js → cn-Cw7M5kEP.js} +2 -2
- package/dist/{cn-DXDpTGsu.js.map → cn-Cw7M5kEP.js.map} +1 -1
- package/dist/{components-hp7iWioq.js → components-DkpspH9h.js} +2 -2
- package/dist/{components-hp7iWioq.js.map → components-DkpspH9h.js.map} +1 -1
- package/dist/components.css +169 -33
- package/dist/document-viewer.js +6 -6
- package/dist/document-viewer.js.map +1 -1
- package/dist/{empty-state-CdaDLcsB.js → empty-state-Cdb1vkMT.js} +36 -12
- package/dist/{empty-state-CdaDLcsB.js.map → empty-state-Cdb1vkMT.js.map} +1 -1
- package/dist/features-max--5VEt6M7.js +3 -0
- package/dist/index.js +1062 -339
- package/dist/index.js.map +1 -1
- package/dist/motion-context-5BRIQAJm.js +107 -0
- package/dist/motion-context-5BRIQAJm.js.map +1 -0
- package/dist/{rendra-provider-7jUgUHzR.js → rendra-provider-CRe0XdOU.js} +9 -5
- package/dist/rendra-provider-CRe0XdOU.js.map +1 -0
- package/dist/rich-text-editor.js +4 -4
- package/dist/router-bridge.js +5 -4
- package/dist/router-bridge.js.map +1 -1
- package/dist/tokens.css +63 -15
- package/dist/tooltip-BAMSaGbS.js +224 -0
- package/dist/tooltip-BAMSaGbS.js.map +1 -0
- package/dist/types/components/rendra-provider.d.ts +7 -1
- package/dist/types/components/rendra-router-bridge.d.ts +3 -1
- package/dist/types/components/ui/accordion.d.ts +1 -1
- package/dist/types/components/ui/badge.d.ts +1 -1
- package/dist/types/components/ui/button.d.ts +1 -1
- package/dist/types/components/ui/dropdown-menu.d.ts +5 -5
- package/dist/types/components/ui/picker-panel.d.ts +1 -1
- package/dist/types/components/ui/popover.d.ts +3 -3
- package/dist/types/components/ui/radio-group.d.ts +1 -1
- package/dist/types/components/ui/skeleton.d.ts +5 -1
- package/dist/types/components/ui/stat-card.d.ts +1 -1
- package/dist/types/components/ui/table.d.ts +0 -6
- package/dist/types/components/ui/tooltip.d.ts +1 -1
- package/dist/types/hooks/use-reduced-motion.d.ts +3 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/motion/count.d.ts +17 -0
- package/dist/types/lib/motion/features-max.d.ts +1 -0
- package/dist/types/lib/motion/index.d.ts +5 -0
- package/dist/types/lib/motion/motion-context.d.ts +43 -0
- package/dist/types/lib/motion/native-events.d.ts +16 -0
- package/dist/types/lib/motion/presets.d.ts +92 -0
- package/dist/types/lib/motion/reorder.d.ts +7 -0
- package/dist/types/lib/motion/tokens.d.ts +66 -0
- package/dist/types/lib/motion/use-motion-presets.d.ts +8 -0
- package/dist/{use-breakpoint-Dyp-0E_c.js → use-breakpoint-O9eqFmsF.js} +2 -2
- package/dist/{use-breakpoint-Dyp-0E_c.js.map → use-breakpoint-O9eqFmsF.js.map} +1 -1
- package/dist/use-motion-presets-BrkgL8lG.js +401 -0
- package/dist/use-motion-presets-BrkgL8lG.js.map +1 -0
- package/dist/widget-grid.js +3 -3
- package/package.json +3 -1
- package/dist/button-C6rjowQi.js.map +0 -1
- package/dist/rendra-provider-7jUgUHzR.js.map +0 -1
- package/dist/tooltip-bdmbX6vC.js +0 -105
- package/dist/tooltip-bdmbX6vC.js.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
import type { MotionMode } from '../lib/motion/motion-context';
|
|
2
3
|
/**
|
|
3
4
|
* Metadados de rota lidos pela trilha: handle: { crumb: 'Clientes' }. Convenção do
|
|
4
5
|
* react-router (`handle`), que não existe em outros roteadores; por isso fica aqui, na
|
|
@@ -13,6 +14,7 @@ export interface RouteHandle {
|
|
|
13
14
|
* componentes de `src/components/ui` e o `AppShell` não importam `react-router` diretamente.
|
|
14
15
|
* Sem `children`, renderiza `<Outlet />`, para ser usado como elemento raiz das rotas.
|
|
15
16
|
*/
|
|
16
|
-
export declare function RendraRouterBridge({ children }?: {
|
|
17
|
+
export declare function RendraRouterBridge({ children, motion, }?: {
|
|
17
18
|
children?: ReactNode;
|
|
19
|
+
motion?: MotionMode;
|
|
18
20
|
}): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
import type { HTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
tone?: "success" | "error" | "warning" | "info" | "primary" | "
|
|
4
|
+
tone?: "outline" | "success" | "error" | "warning" | "info" | "primary" | "neutral" | null | undefined;
|
|
5
5
|
solid?: boolean | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement>, VariantProps<typeof badgeVariants> {
|
|
@@ -6,7 +6,7 @@ import { type ButtonHTMLAttributes, type ReactNode } from 'react';
|
|
|
6
6
|
* Altura vem de h-control-*: 44px ou mais no mobile, compacta a partir de md.
|
|
7
7
|
*/
|
|
8
8
|
export declare const buttonVariants: (props?: ({
|
|
9
|
-
variant?: "link" | "
|
|
9
|
+
variant?: "link" | "outline" | "primary" | "secondary" | "ghost" | "destructive" | null | undefined;
|
|
10
10
|
size?: "sm" | "lg" | "md" | null | undefined;
|
|
11
11
|
iconOnly?: boolean | null | undefined;
|
|
12
12
|
fullWidth?: boolean | null | undefined;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DropdownMenu as D } from 'radix-ui';
|
|
2
|
-
import type
|
|
3
|
-
export declare
|
|
2
|
+
import { type ComponentProps } from 'react';
|
|
3
|
+
export declare function DropdownMenu(props: ComponentProps<typeof D.Root>): import("react").JSX.Element;
|
|
4
4
|
export declare const DropdownMenuTrigger: import("react").ForwardRefExoticComponent<D.DropdownMenuTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
export declare const DropdownMenuGroup: import("react").ForwardRefExoticComponent<D.DropdownMenuGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
-
export declare
|
|
6
|
+
export declare function DropdownMenuSub(props: ComponentProps<typeof D.Sub>): import("react").JSX.Element;
|
|
7
7
|
export declare const DropdownMenuRadioGroup: import("react").ForwardRefExoticComponent<D.DropdownMenuRadioGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
-
export declare function DropdownMenuContent({ className, sideOffset, ...props }: ComponentProps<typeof D.Content>): import("react").JSX.Element;
|
|
8
|
+
export declare function DropdownMenuContent({ className, sideOffset, children, asChild, ...props }: ComponentProps<typeof D.Content>): import("react").JSX.Element;
|
|
9
9
|
interface ItemProps extends ComponentProps<typeof D.Item> {
|
|
10
10
|
/** Item destrutivo (excluir, sair): texto na cor destrutiva. */
|
|
11
11
|
destructive?: boolean;
|
|
@@ -16,5 +16,5 @@ export declare function DropdownMenuRadioItem({ className, children, ...props }:
|
|
|
16
16
|
export declare function DropdownMenuLabel({ className, ...props }: ComponentProps<typeof D.Label>): import("react").JSX.Element;
|
|
17
17
|
export declare function DropdownMenuSeparator({ className, ...props }: ComponentProps<typeof D.Separator>): import("react").JSX.Element;
|
|
18
18
|
export declare function DropdownMenuSubTrigger({ className, children, ...props }: ComponentProps<typeof D.SubTrigger>): import("react").JSX.Element;
|
|
19
|
-
export declare function DropdownMenuSubContent({ className, ...props }: ComponentProps<typeof D.SubContent>): import("react").JSX.Element;
|
|
19
|
+
export declare function DropdownMenuSubContent({ className, children, asChild, ...props }: ComponentProps<typeof D.SubContent>): import("react").JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Popover as P } from 'radix-ui';
|
|
2
|
-
import type
|
|
3
|
-
export declare
|
|
2
|
+
import { type ComponentProps } from 'react';
|
|
3
|
+
export declare function Popover(props: ComponentProps<typeof P.Root>): import("react").JSX.Element;
|
|
4
4
|
export declare const PopoverTrigger: import("react").ForwardRefExoticComponent<P.PopoverTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
export declare const PopoverClose: import("react").ForwardRefExoticComponent<P.PopoverCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
6
6
|
export declare const PopoverAnchor: import("react").ForwardRefExoticComponent<P.PopoverAnchorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -8,5 +8,5 @@ interface PopoverContentProps extends ComponentProps<typeof P.Content> {
|
|
|
8
8
|
/** Largura: sm (16rem) ou md (22rem). Sempre limitada à tela menos 32px. */
|
|
9
9
|
width?: 'sm' | 'md';
|
|
10
10
|
}
|
|
11
|
-
export declare function PopoverContent({ className, align, sideOffset, width, ...props }: PopoverContentProps): import("react").JSX.Element;
|
|
11
|
+
export declare function PopoverContent({ className, align, sideOffset, width, children, asChild, ...props }: PopoverContentProps): import("react").JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'react';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Bloco de carregamento. Monte o skeleton com a mesma estrutura do conteúdo final. Em `off` pulsa
|
|
4
|
+
* (animate-pulse do Tailwind); em `on` um brilho suave cruza o bloco (skeleton-shimmer, em
|
|
5
|
+
* globals.css: transform, tempo e curva pelos tokens, parado com "reduzir movimento").
|
|
6
|
+
*/
|
|
3
7
|
export declare function Skeleton({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
@@ -125,10 +125,4 @@ export interface TableProps<T> {
|
|
|
125
125
|
/** Rótulo da tabela para leitores de tela. */
|
|
126
126
|
'aria-label': string;
|
|
127
127
|
}
|
|
128
|
-
/**
|
|
129
|
-
* Table única do sistema (TanStack Table). Tudo é prop: seleção, expansão, ordenação,
|
|
130
|
-
* busca, colunas visíveis, ações em massa e por linha, densidade e estados.
|
|
131
|
-
* Mobile (< 768px): a mesma tabela vira lista de cards, sem rolagem horizontal.
|
|
132
|
-
* Desktop: tabela larga rola na horizontal só dentro do próprio contêiner.
|
|
133
|
-
*/
|
|
134
128
|
export declare function Table<T>({ data: dataProp, source, queryKey, columns: columnsProp, statusLast, getRowId, selectable, expandable, sortable, globalFilter, columnVisibility, bulkActions, bulkMenu, rowActions, density, loading, error, onRetry, empty, pageSize: pageSizeProp, mobilePagination, toolbar, ...aria }: TableProps<T>): import("react").JSX.Element;
|
|
@@ -1 +1,4 @@
|
|
|
1
|
+
/** Fonte única da preferência (também usada pelo motion, que só a assina em `on`). */
|
|
2
|
+
export declare function subscribeReducedMotion(cb: () => void): () => void;
|
|
3
|
+
export declare function getReducedMotion(): boolean;
|
|
1
4
|
export declare function usePrefersReducedMotion(): boolean;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export * from './components/app-shell/app-shell';
|
|
|
58
58
|
export * from './components/app-shell/layout';
|
|
59
59
|
export * from './components/app-shell/types';
|
|
60
60
|
export * from './components/rendra-provider';
|
|
61
|
+
export type { MotionMode } from './lib/motion/motion-context';
|
|
61
62
|
export * from './catalog/components';
|
|
62
63
|
export * from './hooks/use-breakpoint';
|
|
63
64
|
export * from './hooks/use-debounced-value';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface ParsedNumber {
|
|
3
|
+
/** Tudo antes do número (inclui o sinal de menos). */
|
|
4
|
+
prefix: string;
|
|
5
|
+
/** Tudo depois do número. */
|
|
6
|
+
suffix: string;
|
|
7
|
+
/** Valor numérico (sem sinal no `prefix`: o sinal já está aqui). */
|
|
8
|
+
value: number;
|
|
9
|
+
decimals: number;
|
|
10
|
+
/** Separador de milhar "." (texto pt-BR que o usava). */
|
|
11
|
+
grouping: boolean;
|
|
12
|
+
/** Separador decimal: "," no texto pt-BR, "." no número do JavaScript. */
|
|
13
|
+
decimalSeparator: ',' | '.';
|
|
14
|
+
}
|
|
15
|
+
export declare function parseLocaleNumber(value: ReactNode): ParsedNumber | null;
|
|
16
|
+
/** Escreve `n` com o mesmo formato do valor original. */
|
|
17
|
+
export declare function formatLike(parsed: ParsedNumber, n: number): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { domMax as default } from 'motion/react';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { MotionModeScope, MotionProvider, RevealScope, useLayoutReady, useMotionMode, useRevealScope, type MotionMode, } from './motion-context';
|
|
2
|
+
export { useMotionPresets } from './use-motion-presets';
|
|
3
|
+
export type { MotionPreset, Presets, SlideDistance, SlideFrom } from './presets';
|
|
4
|
+
export { layoutEnabled } from './reorder';
|
|
5
|
+
export { formatLike, parseLocaleNumber, type ParsedNumber } from './count';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type MotionMode = 'off' | 'on';
|
|
3
|
+
/** Modo de motion do provider mais próximo (`off` sem provider). */
|
|
4
|
+
export declare function useMotionMode(): MotionMode;
|
|
5
|
+
/**
|
|
6
|
+
* Em `on`, o chunk do `domMax` já chegou. Um `m.*` com `layout` ou `layoutId` só ganha o nó de
|
|
7
|
+
* projeção se for criado DEPOIS disso (o Motion não monta a projeção de um elemento que já
|
|
8
|
+
* estava na tela), então quem usa layout liga a prop e remonta o item quando isto vira `true`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useLayoutReady(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Marca um trecho da árvore como "chegada de painel" (o dashboard): lá, o gráfico desenha no
|
|
13
|
+
* tempo do reveal (900 ms) em vez do tempo de rotina (`draw`, 420 ms). Fora dele, o gráfico de
|
|
14
|
+
* uma tela de uso diário desenha uma vez e rápido.
|
|
15
|
+
*/
|
|
16
|
+
export declare function RevealScope({ children }: {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
/** O componente está dentro de um `RevealScope`? */
|
|
20
|
+
export declare function useRevealScope(): boolean;
|
|
21
|
+
/** Só troca o modo lido pelos componentes; não monta nem desmonta o LazyMotion. */
|
|
22
|
+
export declare function MotionModeScope({ mode, children }: {
|
|
23
|
+
mode: MotionMode;
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}): import("react").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* Em `off`, só o contexto (nenhum nó novo, nenhum LazyMotion). Em `on`, dois `LazyMotion` (os
|
|
28
|
+
* dois `strict`: só `m.*` entra, um `motion.*` esquecido quebra em vez de puxar o pacote inteiro):
|
|
29
|
+
* o de fora carrega o `domMax` sob demanda (layout e arraste), em chunk separado; o de dentro traz
|
|
30
|
+
* o `domAnimation` síncrono (animação e gestos) e é o que os `m.*` enxergam. Nessa ordem o
|
|
31
|
+
* renderer síncrono já está no contexto na primeira renderização (elementos e gestos funcionam
|
|
32
|
+
* na hora), e os recursos de layout se juntam quando o chunk chega. A ordem contrária esconderia
|
|
33
|
+
* o renderer até o chunk terminar de baixar.
|
|
34
|
+
*
|
|
35
|
+
* O `MotionConfig` recebe "reduzir movimento" da mesma fonte dos presets (o `matchMedia` de
|
|
36
|
+
* `use-reduced-motion.ts`, reativo): com `always`, o Motion também tira o deslocamento e o layout
|
|
37
|
+
* de qualquer animação que um componente escreva à mão, e mantém a opacidade. Não é uma segunda
|
|
38
|
+
* fonte: é a primeira, lida uma vez, entregue a dois consumidores.
|
|
39
|
+
*/
|
|
40
|
+
export declare function MotionProvider({ mode, children }: {
|
|
41
|
+
mode: MotionMode;
|
|
42
|
+
children: ReactNode;
|
|
43
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const NATIVE_EVENTS: {
|
|
2
|
+
readonly onDrag: "drag";
|
|
3
|
+
readonly onDragStart: "dragstart";
|
|
4
|
+
readonly onDragEnd: "dragend";
|
|
5
|
+
readonly onAnimationStart: "animationstart";
|
|
6
|
+
};
|
|
7
|
+
type NativeKey = keyof typeof NATIVE_EVENTS;
|
|
8
|
+
type Handler = ((event: never) => void) | undefined;
|
|
9
|
+
/** Separa as quatro chaves em conflito; o resto segue para o elemento do Motion. */
|
|
10
|
+
export declare function splitNativeEvents<P extends object>(props: P): {
|
|
11
|
+
native: Partial<Record<"onDrag" | "onDragEnd" | "onDragStart" | "onAnimationStart", Handler>>;
|
|
12
|
+
rest: Omit<P, NativeKey>;
|
|
13
|
+
};
|
|
14
|
+
/** Liga os manipuladores como ouvintes nativos. Devolve a função que os remove. */
|
|
15
|
+
export declare function bindNativeEvents(el: HTMLElement, native: Partial<Record<NativeKey, Handler>>): () => void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { Target, TargetAndTransition, Transition } from 'motion/react';
|
|
2
|
+
import { type Bezier, type MotionTokens } from './tokens';
|
|
3
|
+
export interface MotionPreset {
|
|
4
|
+
initial: Target;
|
|
5
|
+
animate: TargetAndTransition;
|
|
6
|
+
exit: TargetAndTransition;
|
|
7
|
+
transition: Transition;
|
|
8
|
+
}
|
|
9
|
+
/** Toque: o alvo do `whileTap` (`undefined` no reduzido) e a transição de ida e de volta. */
|
|
10
|
+
export interface PressPreset {
|
|
11
|
+
whileTap: TargetAndTransition | undefined;
|
|
12
|
+
transition: Transition;
|
|
13
|
+
}
|
|
14
|
+
export type SlideFrom = 'left' | 'right' | 'top' | 'bottom';
|
|
15
|
+
/** Distância do slide: `full` (painel que entra da borda) ou `short` (conteúdo que assenta). */
|
|
16
|
+
export type SlideDistance = 'full' | 'short';
|
|
17
|
+
export interface Presets {
|
|
18
|
+
reduced: boolean;
|
|
19
|
+
/** Toque do botão, do polegar e dos controles: 120 ms, `ease.out`, escala 0,97. */
|
|
20
|
+
press: PressPreset;
|
|
21
|
+
/** Alias de `press.whileTap`, o nome antigo. Sem movimento reduzido vem `undefined`. */
|
|
22
|
+
tap: TargetAndTransition | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Salto curto de escala (célula do OTP), com a transição dentro do alvo. Estável entre
|
|
25
|
+
* renders; `undefined` se reduzido.
|
|
26
|
+
*/
|
|
27
|
+
bump: TargetAndTransition | undefined;
|
|
28
|
+
tokens: MotionTokens;
|
|
29
|
+
fade: MotionPreset;
|
|
30
|
+
/** Alias de `open()`: escala 0,95 com mola a partir da origem, saída rápida só em opacidade. */
|
|
31
|
+
scale: MotionPreset;
|
|
32
|
+
/**
|
|
33
|
+
* Cota rara de encanto (check do passo concluído): 0,8 -> 1 com a curva back, em `slow`. Nunca
|
|
34
|
+
* em controle de uso frequente.
|
|
35
|
+
*/
|
|
36
|
+
pop: MotionPreset;
|
|
37
|
+
/**
|
|
38
|
+
* Indicador de controle frequente (check do Checkbox, ponto do Radio): 0,9 -> 1 com opacidade
|
|
39
|
+
* em `fast`, sem quique e sem partir de zero.
|
|
40
|
+
*/
|
|
41
|
+
indicator: MotionPreset;
|
|
42
|
+
slide: (from: SlideFrom, distance?: SlideDistance) => MotionPreset;
|
|
43
|
+
/**
|
|
44
|
+
* Overlay ancorado (popover, menu, modal, painel do select). Número = escala de partida
|
|
45
|
+
* (padrão 0,95); `{ y }` = entrada plana, sem escala, para a superfície em tela cheia.
|
|
46
|
+
* Entra em mola criticamente amortecida (sem quique) em `base` e sai em `fast`, em opacidade.
|
|
47
|
+
*/
|
|
48
|
+
open: (from?: number | {
|
|
49
|
+
y: number;
|
|
50
|
+
}) => MotionPreset;
|
|
51
|
+
/** Gaveta e folha: entram de `from` em `slow` com `ease.drawer`, saem em `fast` pelo mesmo lado. */
|
|
52
|
+
sheet: (from: SlideFrom) => MotionPreset;
|
|
53
|
+
/** Tooltip: escala 0,97 em `fast`; aberto em `instant-open` não anima. */
|
|
54
|
+
tooltip: (instant: boolean) => MotionPreset;
|
|
55
|
+
/**
|
|
56
|
+
* Troca de conteúdo no lugar (passo do wizard), sem esperar a saída: o que sai esmaece com
|
|
57
|
+
* `blur` de 2 px em `fast`; o que entra vem de `direction` (1 avança, -1 volta), 8 px, em
|
|
58
|
+
* `base`. O desfoque disfarça o cruzamento: sem ele o olho vê dois objetos trocando de lugar.
|
|
59
|
+
*/
|
|
60
|
+
swap: (direction: 1 | -1) => MotionPreset;
|
|
61
|
+
/**
|
|
62
|
+
* Entrada de uso único (reveal do dashboard): desloca 8 px e dura `reveal.enter`, mais lenta
|
|
63
|
+
* que `slide`. Não serve a interação repetida (overlay, tab, botão).
|
|
64
|
+
*/
|
|
65
|
+
reveal: (from: SlideFrom) => MotionPreset;
|
|
66
|
+
/** Deslocamento na tela (indicador, reordenação): `move` em `ease.move`. */
|
|
67
|
+
move: Transition;
|
|
68
|
+
/** Nome antigo de `move`. */
|
|
69
|
+
layout: Transition;
|
|
70
|
+
/** Mola sem quique: onde há gesto ou soltura (drop do kanban, folha que volta). */
|
|
71
|
+
settle: Transition;
|
|
72
|
+
/** Mola da folha depois do arraste (quique mínimo). */
|
|
73
|
+
springSheet: Transition;
|
|
74
|
+
/**
|
|
75
|
+
* A mesma mola da folha em rigidez e amortecimento (massa 1), que é o que o arraste do Motion
|
|
76
|
+
* (`dragTransition`) pede para a volta à origem: rigidez = (2π / duração)², amortecimento =
|
|
77
|
+
* 2 (1 - quique) raiz(rigidez).
|
|
78
|
+
*/
|
|
79
|
+
sheetBounce: {
|
|
80
|
+
bounceStiffness: number;
|
|
81
|
+
bounceDamping: number;
|
|
82
|
+
};
|
|
83
|
+
/** Atraso de entrada do item `index`, limitado a `limit` itens (padrão 8: 480 ms). */
|
|
84
|
+
stagger: (index: number, limit?: number) => Transition;
|
|
85
|
+
/** Atraso do bloco `index` no reveal (passo `reveal.stagger`), limitado a `limit` blocos. */
|
|
86
|
+
staggerReveal: (index: number, limit?: number) => Transition;
|
|
87
|
+
}
|
|
88
|
+
export declare function createPresets(tokens: MotionTokens, reduced: boolean): Presets;
|
|
89
|
+
/** Curva no formato do recharts: `cubic-bezier(a,b,c,d)`, sem espaços. */
|
|
90
|
+
export declare function toCubicBezier([a, b, c, d,]: Bezier): `cubic-bezier(${number},${number},${number},${number})`;
|
|
91
|
+
/** Presets com os tokens lidos agora do documento. */
|
|
92
|
+
export declare function presetsFromDocument(reduced: boolean): Presets;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MotionMode } from './motion-context';
|
|
2
|
+
export declare function layoutEnabled({ mode, ready, dragging, }: {
|
|
3
|
+
mode: MotionMode;
|
|
4
|
+
/** O chunk do `domMax` já chegou (`useLayoutReady`). Antes disso `layout` não faz nada. */
|
|
5
|
+
ready: boolean;
|
|
6
|
+
dragging: boolean;
|
|
7
|
+
}): boolean;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type Bezier = [number, number, number, number];
|
|
2
|
+
/**
|
|
3
|
+
* Reserva das durações, em segundos (SSR, ou variável ausente).
|
|
4
|
+
* `press` e `fast` valem o mesmo (120 ms) com propósitos diferentes: o toque e a saída de overlay.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DURATION: {
|
|
7
|
+
press: number;
|
|
8
|
+
hover: number;
|
|
9
|
+
fast: number;
|
|
10
|
+
base: number;
|
|
11
|
+
move: number;
|
|
12
|
+
slow: number;
|
|
13
|
+
draw: number;
|
|
14
|
+
pulse: number;
|
|
15
|
+
};
|
|
16
|
+
export type DurationName = keyof typeof DURATION;
|
|
17
|
+
/**
|
|
18
|
+
* Reveal: entrada de uso único (dashboard: bloco, cascata, contador e desenho do gráfico), mais
|
|
19
|
+
* lenta que as interações do dia a dia. Reserva em segundos (SSR, ou variável ausente).
|
|
20
|
+
*/
|
|
21
|
+
export declare const REVEAL: {
|
|
22
|
+
enter: number;
|
|
23
|
+
stagger: number;
|
|
24
|
+
count: number;
|
|
25
|
+
draw: number;
|
|
26
|
+
};
|
|
27
|
+
export type RevealName = keyof typeof REVEAL;
|
|
28
|
+
/**
|
|
29
|
+
* Curvas do globals.css (`--rendra-ease-*`). `spring` é a curva "back" (quique): só para a cota
|
|
30
|
+
* rara de encanto. `move` desloca na tela; `drawer` é a curva de gaveta e folha.
|
|
31
|
+
*/
|
|
32
|
+
export declare const EASE: Record<'out' | 'inOut' | 'spring' | 'move' | 'drawer', Bezier>;
|
|
33
|
+
export type EaseName = keyof typeof EASE;
|
|
34
|
+
/**
|
|
35
|
+
* Molas no formato "duração e quique" (Motion). `settle` assenta sem passar do ponto (layout,
|
|
36
|
+
* overlay que entra, soltura do arraste); `sheet` é a folha depois do gesto, com quique mínimo.
|
|
37
|
+
* Mola não é variável CSS: mora aqui, e o app a espelha em `dampingRatio`.
|
|
38
|
+
*/
|
|
39
|
+
export declare const SPRING: {
|
|
40
|
+
settle: {
|
|
41
|
+
duration: number;
|
|
42
|
+
bounce: number;
|
|
43
|
+
};
|
|
44
|
+
sheet: {
|
|
45
|
+
duration: number;
|
|
46
|
+
bounce: number;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
/** Escalas da linguagem: entrada de overlay, tooltip, ponto pequeno, toque, pop e salto curto. */
|
|
50
|
+
export declare const SCALE: {
|
|
51
|
+
enter: number;
|
|
52
|
+
tooltip: number;
|
|
53
|
+
small: number;
|
|
54
|
+
press: number;
|
|
55
|
+
pop: number;
|
|
56
|
+
bump: number;
|
|
57
|
+
};
|
|
58
|
+
/** Desfoque (px) que disfarça o cruzamento entre dois estados (troca de passo). Abaixo de 20. */
|
|
59
|
+
export declare const BLUR = 2;
|
|
60
|
+
export interface MotionTokens {
|
|
61
|
+
duration: Record<DurationName, number>;
|
|
62
|
+
reveal: Record<RevealName, number>;
|
|
63
|
+
ease: Record<EaseName, Bezier>;
|
|
64
|
+
}
|
|
65
|
+
/** Lê as durações e as curvas do documento; o que faltar (ou sem window) vem da reserva. */
|
|
66
|
+
export declare function readMotionTokens(): MotionTokens;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Presets } from './presets';
|
|
2
|
+
/**
|
|
3
|
+
* Presets do motion para o componente. A preferência "reduzir movimento" vem do mesmo
|
|
4
|
+
* `matchMedia` do hook do projeto (`use-reduced-motion.ts`: Spinner, Progress), a fonte única,
|
|
5
|
+
* reativa e testável, sem `MotionConfig reducedMotion` somando por cima. Só em `on` a
|
|
6
|
+
* preferência é assinada e os tokens lidos do documento; em `off` o custo é zero.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useMotionPresets(): Presets;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Rendra Design System v2.
|
|
1
|
+
/*! Rendra Design System v2.5.0 | MIT | © 2026 Bruno Magalhaes | brunomagalhaes.me */
|
|
2
2
|
import { useSyncExternalStore } from "react";
|
|
3
3
|
//#region src/hooks/use-breakpoint.ts
|
|
4
4
|
/**
|
|
@@ -46,4 +46,4 @@ function useBreakpoint() {
|
|
|
46
46
|
//#endregion
|
|
47
47
|
export { useBreakpoint as n, breakpoints as t };
|
|
48
48
|
|
|
49
|
-
//# sourceMappingURL=use-breakpoint-
|
|
49
|
+
//# sourceMappingURL=use-breakpoint-O9eqFmsF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-breakpoint-
|
|
1
|
+
{"version":3,"file":"use-breakpoint-O9eqFmsF.js","names":[],"sources":["../src/hooks/use-breakpoint.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react'\n\n/**\n * Pontos de quebra, espelhando os padrões do Tailwind (sm 40rem, md 48rem, lg 64rem...).\n * Único hook de detecção de tela do sistema. Para adaptação ao espaço disponível\n * dentro de um bloco (e não à tela), use container queries (@container) no CSS.\n */\nexport const breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280, '2xl': 1536 } as const\nexport type Breakpoint = keyof typeof breakpoints\n\nconst order: Breakpoint[] = ['sm', 'md', 'lg', 'xl', '2xl']\n\nfunction subscribe(cb: () => void) {\n const lists = order.map((bp) => matchMedia(`(min-width: ${breakpoints[bp]}px)`))\n lists.forEach((mq) => mq.addEventListener('change', cb))\n return () => lists.forEach((mq) => mq.removeEventListener('change', cb))\n}\n\nfunction getCurrent(): Breakpoint | 'base' {\n let current: Breakpoint | 'base' = 'base'\n for (const bp of order) if (matchMedia(`(min-width: ${breakpoints[bp]}px)`).matches) current = bp\n return current\n}\n\nexport function useBreakpoint() {\n const current = useSyncExternalStore(subscribe, getCurrent, () => 'lg' as const)\n const rank = current === 'base' ? -1 : order.indexOf(current)\n const up = (bp: Breakpoint) => rank >= order.indexOf(bp)\n return {\n current,\n up,\n /** Abaixo de 768px: componentes se reconstroem no formato mobile. */\n isMobile: !up('md'),\n isTablet: up('md') && !up('lg'),\n isDesktop: up('lg'),\n }\n}\n"],"mappings":";;;;;;;;AAOA,IAAa,cAAc;CAAE,IAAI;CAAK,IAAI;CAAK,IAAI;CAAM,IAAI;CAAM,OAAO;AAAK;AAG/E,IAAM,QAAsB;CAAC;CAAM;CAAM;CAAM;CAAM;AAAK;AAE1D,SAAS,UAAU,IAAgB;CACjC,MAAM,QAAQ,MAAM,KAAK,OAAO,WAAW,eAAe,YAAY,IAAI,IAAI,CAAC;CAC/E,MAAM,SAAS,OAAO,GAAG,iBAAiB,UAAU,EAAE,CAAC;CACvD,aAAa,MAAM,SAAS,OAAO,GAAG,oBAAoB,UAAU,EAAE,CAAC;AACzE;AAEA,SAAS,aAAkC;CACzC,IAAI,UAA+B;CACnC,KAAK,MAAM,MAAM,OAAO,IAAI,WAAW,eAAe,YAAY,IAAI,IAAI,CAAC,CAAC,SAAS,UAAU;CAC/F,OAAO;AACT;AAEA,SAAgB,gBAAgB;CAC9B,MAAM,UAAU,qBAAqB,WAAW,kBAAkB,IAAa;CAC/E,MAAM,OAAO,YAAY,SAAS,KAAK,MAAM,QAAQ,OAAO;CAC5D,MAAM,MAAM,OAAmB,QAAQ,MAAM,QAAQ,EAAE;CACvD,OAAO;EACL;EACA;;EAEA,UAAU,CAAC,GAAG,IAAI;EAClB,UAAU,GAAG,IAAI,KAAK,CAAC,GAAG,IAAI;EAC9B,WAAW,GAAG,IAAI;CACpB;AACF"}
|