rootzz-layout 0.1.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 +287 -0
- package/dist/index.cjs +857 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +462 -0
- package/dist/index.d.ts +462 -0
- package/dist/index.mjs +836 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +1004 -0
- package/package.json +78 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ReactNode, MouseEvent, CSSProperties, InputHTMLAttributes, ButtonHTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
/** Tema visual do layout. */
|
|
5
|
+
type ThemeMode = 'light' | 'dark';
|
|
6
|
+
/**
|
|
7
|
+
* Componente usado para renderizar links de navegação (itens da sidebar, logo, etc.).
|
|
8
|
+
* Por padrão é uma tag `<a>`. Passe o `Link` do seu router (Next.js, React Router…)
|
|
9
|
+
* para navegação SPA sem recarregar a página. Recebe `href`, `className` e `children`.
|
|
10
|
+
*/
|
|
11
|
+
type LinkComponent = ElementType;
|
|
12
|
+
/** Um aplicativo no menu de apps (formato de `applications.json` da Eduzz). */
|
|
13
|
+
interface AppItem {
|
|
14
|
+
/** Identificador da aplicação (ex.: "orbita"). */
|
|
15
|
+
application?: string;
|
|
16
|
+
/** Nome exibido (ex.: "MyEduzz"). */
|
|
17
|
+
label: string;
|
|
18
|
+
/** URL do ícone (SVG/PNG). */
|
|
19
|
+
icon: string;
|
|
20
|
+
/** Descrição curta (usada como tooltip). */
|
|
21
|
+
description?: string;
|
|
22
|
+
/** Destino ao clicar. */
|
|
23
|
+
url: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Fonte dos apps do menu de grade:
|
|
27
|
+
* - `true` → busca a lista padrão da Eduzz no CDN.
|
|
28
|
+
* - `false`/omitido → não exibe o botão de apps.
|
|
29
|
+
* - `AppItem[]` → lista estática que você fornece.
|
|
30
|
+
* - `string` → URL custom de onde buscar o JSON.
|
|
31
|
+
* - `{ url }` / `{ items }` → forma objeto equivalente.
|
|
32
|
+
*/
|
|
33
|
+
type AppsSource = boolean | string | AppItem[] | {
|
|
34
|
+
url?: string;
|
|
35
|
+
items?: AppItem[];
|
|
36
|
+
};
|
|
37
|
+
/** Configuração do logo exibido na topbar. */
|
|
38
|
+
interface LogoConfig {
|
|
39
|
+
/** URL da imagem do logo. */
|
|
40
|
+
src: string;
|
|
41
|
+
/** Texto alternativo (acessibilidade). */
|
|
42
|
+
alt?: string;
|
|
43
|
+
/** Se informado, o logo vira um link para esta URL. */
|
|
44
|
+
href?: string;
|
|
45
|
+
/** Callback ao clicar no logo. */
|
|
46
|
+
onClick?: () => void;
|
|
47
|
+
/** Altura do logo (px ou string CSS). Padrão: 28. */
|
|
48
|
+
height?: number | string;
|
|
49
|
+
}
|
|
50
|
+
/** Item de ação no dropdown do usuário. */
|
|
51
|
+
interface UserMenuItem {
|
|
52
|
+
key?: string;
|
|
53
|
+
/** Rótulo da ação. */
|
|
54
|
+
label: ReactNode;
|
|
55
|
+
/** Ícone opcional à esquerda. */
|
|
56
|
+
icon?: ReactNode;
|
|
57
|
+
/** Ação ao clicar. */
|
|
58
|
+
onClick?: () => void;
|
|
59
|
+
/** Se informado, renderiza como link. */
|
|
60
|
+
href?: string;
|
|
61
|
+
/** Estilo de ação destrutiva (ex.: "Sair"). */
|
|
62
|
+
danger?: boolean;
|
|
63
|
+
/** Desabilita o item. */
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/** Divisor no dropdown do usuário. */
|
|
67
|
+
interface UserMenuDivider {
|
|
68
|
+
type: 'divider';
|
|
69
|
+
key?: string;
|
|
70
|
+
}
|
|
71
|
+
type UserMenuEntry = UserMenuItem | UserMenuDivider;
|
|
72
|
+
/** Configuração do usuário exibido à direita da topbar. */
|
|
73
|
+
interface UserConfig {
|
|
74
|
+
/** Nome exibido (truncado se longo). */
|
|
75
|
+
name: string;
|
|
76
|
+
/** E-mail/subtítulo opcional no cabeçalho do dropdown. */
|
|
77
|
+
email?: string;
|
|
78
|
+
/** URL do avatar. Se ausente, usa `initials`. */
|
|
79
|
+
avatarUrl?: string;
|
|
80
|
+
/** Iniciais exibidas quando não há avatar (ex.: "Dd"). Calculadas do nome se omitido. */
|
|
81
|
+
initials?: string;
|
|
82
|
+
/** Itens de ação do dropdown. Se vazio/omitido, o clique chama `onClick`. */
|
|
83
|
+
menu?: UserMenuEntry[];
|
|
84
|
+
/** Clique no usuário quando não há `menu`. */
|
|
85
|
+
onClick?: () => void;
|
|
86
|
+
}
|
|
87
|
+
/** Item simples (link) da sidebar. */
|
|
88
|
+
interface MenuLink {
|
|
89
|
+
type?: 'item';
|
|
90
|
+
/** Chave única — usada para casar com `activeKey`. */
|
|
91
|
+
key: string;
|
|
92
|
+
/** Rótulo. */
|
|
93
|
+
label: ReactNode;
|
|
94
|
+
/** Ícone à esquerda. */
|
|
95
|
+
icon?: ReactNode;
|
|
96
|
+
/** Destino. Renderiza com `linkComponent` (padrão `<a>`). */
|
|
97
|
+
href?: string;
|
|
98
|
+
/** `target` do link (ex.: "_blank"). */
|
|
99
|
+
target?: string;
|
|
100
|
+
/** Clique (alternativa a `href`). */
|
|
101
|
+
onClick?: (event: MouseEvent) => void;
|
|
102
|
+
/** Marca o item como ativo manualmente (sobrepõe `activeKey`). */
|
|
103
|
+
active?: boolean;
|
|
104
|
+
/** Conteúdo à direita (ex.: contador, tag). */
|
|
105
|
+
badge?: ReactNode;
|
|
106
|
+
/** Desabilita o item. */
|
|
107
|
+
disabled?: boolean;
|
|
108
|
+
}
|
|
109
|
+
/** Grupo colapsável de itens na sidebar. */
|
|
110
|
+
interface MenuGroup {
|
|
111
|
+
type: 'group';
|
|
112
|
+
/** Chave única do grupo. */
|
|
113
|
+
key: string;
|
|
114
|
+
/** Rótulo do grupo (geralmente em maiúsculas). */
|
|
115
|
+
label: ReactNode;
|
|
116
|
+
/** Ícone opcional do grupo. */
|
|
117
|
+
icon?: ReactNode;
|
|
118
|
+
/** Itens filhos. */
|
|
119
|
+
items: MenuLink[];
|
|
120
|
+
/** Inicia colapsado. Padrão: `false`. */
|
|
121
|
+
defaultCollapsed?: boolean;
|
|
122
|
+
/** Permite colapsar/expandir. Padrão: `true`. Se `false`, fica sempre aberto. */
|
|
123
|
+
collapsible?: boolean;
|
|
124
|
+
}
|
|
125
|
+
/** Divisor entre itens da sidebar. */
|
|
126
|
+
interface MenuDivider {
|
|
127
|
+
type: 'divider';
|
|
128
|
+
key?: string;
|
|
129
|
+
}
|
|
130
|
+
/** Qualquer entrada da sidebar. */
|
|
131
|
+
type MenuItem = MenuLink | MenuGroup | MenuDivider;
|
|
132
|
+
/**
|
|
133
|
+
* Props do shell `<RootzzLayout>`. É um componente composto — passe
|
|
134
|
+
* `RootzzLayout.Topbar`, `RootzzLayout.Sidebar` e `RootzzLayout.Content` como
|
|
135
|
+
* filhos, cada um com suas próprias props. Aqui ficam apenas configs de
|
|
136
|
+
* nível de shell (tema e componente de link), compartilhadas por todos.
|
|
137
|
+
*/
|
|
138
|
+
interface RootzzLayoutProps {
|
|
139
|
+
/** Subcomponentes: `RootzzLayout.Topbar`, `.Sidebar`, `.Content`. */
|
|
140
|
+
children?: ReactNode;
|
|
141
|
+
/** Tema controlado. Se informado, você gerencia o estado via `onThemeChange`. */
|
|
142
|
+
theme?: ThemeMode;
|
|
143
|
+
/** Tema inicial quando não-controlado. Padrão: `'light'`. */
|
|
144
|
+
defaultTheme?: ThemeMode;
|
|
145
|
+
/** Chamado quando o tema muda (toggle ou API). */
|
|
146
|
+
onThemeChange?: (theme: ThemeMode) => void;
|
|
147
|
+
/**
|
|
148
|
+
* Componente para renderizar links de navegação (padrão `<a>`), usado por
|
|
149
|
+
* topbar e sidebar. Passe o `Link` do seu router para navegação SPA.
|
|
150
|
+
*/
|
|
151
|
+
linkComponent?: LinkComponent;
|
|
152
|
+
/** Classe extra no elemento raiz (`.rootzz-layout`). */
|
|
153
|
+
className?: string;
|
|
154
|
+
/** Estilo inline no elemento raiz — útil para sobrescrever tokens `--rzl-*`. */
|
|
155
|
+
style?: CSSProperties;
|
|
156
|
+
/** `id` do elemento raiz. */
|
|
157
|
+
id?: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
interface ContentProps {
|
|
161
|
+
children?: ReactNode;
|
|
162
|
+
/**
|
|
163
|
+
* Largura máxima do conteúdo. `false` ocupa 100%.
|
|
164
|
+
* Omitido usa o token `--rzl-content-max-width`.
|
|
165
|
+
*/
|
|
166
|
+
maxWidth?: number | string | false;
|
|
167
|
+
/** Classe extra no wrapper interno. */
|
|
168
|
+
className?: string;
|
|
169
|
+
/** Remove o padding padrão. */
|
|
170
|
+
noPadding?: boolean;
|
|
171
|
+
}
|
|
172
|
+
/** Área de conteúdo: rola verticalmente e centraliza/limita a largura do que for inserido. */
|
|
173
|
+
declare function Content({ children, maxWidth, className, noPadding }: ContentProps): react.JSX.Element;
|
|
174
|
+
|
|
175
|
+
interface SidebarProps {
|
|
176
|
+
/** Entradas do menu (links, grupos, divisores). */
|
|
177
|
+
menu?: MenuItem[];
|
|
178
|
+
/** Chave do item ativo (casa com `MenuLink.key`). */
|
|
179
|
+
activeKey?: string;
|
|
180
|
+
/** Conteúdo fixo no topo. */
|
|
181
|
+
header?: ReactNode;
|
|
182
|
+
/** Conteúdo fixo no rodapé. */
|
|
183
|
+
footer?: ReactNode;
|
|
184
|
+
/** Rótulo acessível da navegação. Padrão: "Navegação principal". */
|
|
185
|
+
ariaLabel?: string;
|
|
186
|
+
/** Conteúdo custom (substitui `menu` se quiser compor manualmente). */
|
|
187
|
+
children?: ReactNode;
|
|
188
|
+
className?: string;
|
|
189
|
+
/** Título do drawer mobile. */
|
|
190
|
+
mobileTitle?: ReactNode;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Sidebar de navegação.
|
|
194
|
+
* - Desktop (≥768px): coluna fixa com largura `--rzl-sidebar-width`.
|
|
195
|
+
* - Mobile (<768px): drawer off-canvas com overlay e fade/slide suaves.
|
|
196
|
+
*/
|
|
197
|
+
declare function Sidebar({ menu, activeKey, header, footer, ariaLabel, children, className, mobileTitle, }: SidebarProps): react.JSX.Element;
|
|
198
|
+
|
|
199
|
+
interface TopbarProps {
|
|
200
|
+
/**
|
|
201
|
+
* Logo exibido à esquerda. Aceita a string `"myeduzz"` (renderiza o logo
|
|
202
|
+
* oficial do MyEduzz), um `LogoConfig` ou qualquer `ReactNode`.
|
|
203
|
+
* Ignorado quando `application` é informado.
|
|
204
|
+
*/
|
|
205
|
+
logo?: ReactNode | LogoConfig;
|
|
206
|
+
/**
|
|
207
|
+
* Identificador de um aplicativo da Eduzz (ex.: `"orbita"`). Busca o app no
|
|
208
|
+
* `applications.json` e renderiza o logo + nome dele (no mobile, só o logo),
|
|
209
|
+
* linkando para a URL do app. Tem precedência sobre `logo`.
|
|
210
|
+
*/
|
|
211
|
+
application?: string;
|
|
212
|
+
apps?: AppsSource;
|
|
213
|
+
search?: ReactNode;
|
|
214
|
+
actions?: ReactNode;
|
|
215
|
+
user?: UserConfig;
|
|
216
|
+
showThemeToggle?: boolean;
|
|
217
|
+
/** Exibe o botão de menu (hambúrguer) no mobile. Padrão: `true`. */
|
|
218
|
+
showMenuButton?: boolean;
|
|
219
|
+
appsLabel?: string;
|
|
220
|
+
menuButtonLabel?: string;
|
|
221
|
+
className?: string;
|
|
222
|
+
}
|
|
223
|
+
/** Barra superior fixa: marca à esquerda, busca opcional ao centro, ações/usuário à direita. */
|
|
224
|
+
declare function Topbar({ logo, application, apps, search, actions, user, showThemeToggle, showMenuButton, appsLabel, menuButtonLabel, className, }: TopbarProps): react.JSX.Element;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Shell de aplicação composável. Forneça os subcomponentes como filhos —
|
|
228
|
+
* cada um com suas próprias props.
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* import { RootzzLayout } from 'rootzz-layout';
|
|
232
|
+
* import 'rootzz-layout/styles.css';
|
|
233
|
+
*
|
|
234
|
+
* <RootzzLayout>
|
|
235
|
+
* <RootzzLayout.Topbar
|
|
236
|
+
* logo={{ src: '/logo.svg', alt: 'MyEduzz', href: '/' }}
|
|
237
|
+
* apps
|
|
238
|
+
* showThemeToggle
|
|
239
|
+
* user={{ name: 'Designers da Eduzz', initials: 'Dd', menu: [{ label: 'Sair', danger: true }] }}
|
|
240
|
+
* />
|
|
241
|
+
* <RootzzLayout.Sidebar
|
|
242
|
+
* activeKey="resumo"
|
|
243
|
+
* menu={[
|
|
244
|
+
* { key: 'resumo', label: 'Resumo', href: '/' },
|
|
245
|
+
* { type: 'group', key: 'vendas', label: 'Vendas', items: [{ key: 'pedidos', label: 'Pedidos', href: '/pedidos' }] },
|
|
246
|
+
* ]}
|
|
247
|
+
* />
|
|
248
|
+
* <RootzzLayout.Content>conteúdo aqui</RootzzLayout.Content>
|
|
249
|
+
* </RootzzLayout>
|
|
250
|
+
*
|
|
251
|
+
* Config de nível de shell (tema, linkComponent) fica no `<RootzzLayout>`:
|
|
252
|
+
* `<RootzzLayout theme="dark" linkComponent={Link}>…</RootzzLayout>`
|
|
253
|
+
*/
|
|
254
|
+
declare function RootzzLayoutBase({ children, theme, defaultTheme, onThemeChange, linkComponent, className, style, id, }: RootzzLayoutProps): react.JSX.Element;
|
|
255
|
+
/**
|
|
256
|
+
* `RootzzLayout` + subcomponentes anexados:
|
|
257
|
+
* `RootzzLayout.Topbar`, `RootzzLayout.Sidebar`, `RootzzLayout.Content`.
|
|
258
|
+
* (Os mesmos componentes também são exportados individualmente.)
|
|
259
|
+
*/
|
|
260
|
+
declare const RootzzLayout: typeof RootzzLayoutBase & {
|
|
261
|
+
Topbar: typeof Topbar;
|
|
262
|
+
Sidebar: typeof Sidebar;
|
|
263
|
+
Content: typeof Content;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
interface BrandProps {
|
|
267
|
+
/**
|
|
268
|
+
* Logo da topbar. Aceita:
|
|
269
|
+
* - a string `"myeduzz"` → renderiza o logo oficial do MyEduzz;
|
|
270
|
+
* - um `LogoConfig` (`{ src, alt, href… }`) → imagem configurável;
|
|
271
|
+
* - qualquer `ReactNode` → renderizado como veio.
|
|
272
|
+
*
|
|
273
|
+
* Ignorado quando `application` resolve um app.
|
|
274
|
+
*/
|
|
275
|
+
logo?: ReactNode | LogoConfig;
|
|
276
|
+
/**
|
|
277
|
+
* Identificador de um aplicativo da Eduzz (campo `application` do
|
|
278
|
+
* `applications.json`, ex.: `"orbita"`). Busca o app na lista oficial e
|
|
279
|
+
* renderiza o logo + nome dele, linkando para a `url` do app.
|
|
280
|
+
* No mobile, mostra apenas o logo (sem o nome). Tem precedência sobre `logo`.
|
|
281
|
+
*/
|
|
282
|
+
application?: string;
|
|
283
|
+
apps?: AppsSource;
|
|
284
|
+
appsLabel?: string;
|
|
285
|
+
}
|
|
286
|
+
/** Bloco da esquerda da topbar: botão de aplicativos + logo/aplicação. */
|
|
287
|
+
declare function Brand({ logo, application, apps, appsLabel }: BrandProps): react.JSX.Element;
|
|
288
|
+
|
|
289
|
+
interface AppsMenuProps {
|
|
290
|
+
/** Fonte dos apps (veja {@link AppsSource}). */
|
|
291
|
+
source?: AppsSource;
|
|
292
|
+
/** Rótulo acessível do botão. Padrão: "Aplicativos". */
|
|
293
|
+
label?: string;
|
|
294
|
+
/** Título exibido no topo do painel. Padrão: "Aplicativos". */
|
|
295
|
+
title?: string;
|
|
296
|
+
}
|
|
297
|
+
/** Botão de grade 9-pontos que abre o menu de aplicativos da Eduzz. */
|
|
298
|
+
declare function AppsMenu({ source, label, title }: AppsMenuProps): react.JSX.Element | null;
|
|
299
|
+
|
|
300
|
+
interface SearchBarProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
301
|
+
/** Texto de placeholder. */
|
|
302
|
+
placeholder?: string;
|
|
303
|
+
/** Dica de atalho exibida à direita (ex.: "⌘K"). */
|
|
304
|
+
shortcut?: ReactNode;
|
|
305
|
+
/** Classe extra do wrapper. */
|
|
306
|
+
wrapperClassName?: string;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Campo de busca estilizado para o centro da topbar (opcional).
|
|
310
|
+
* É um `<input>` comum — controle via `value`/`onChange` como qualquer input.
|
|
311
|
+
*/
|
|
312
|
+
declare const SearchBar: react.ForwardRefExoticComponent<SearchBarProps & react.RefAttributes<HTMLInputElement>>;
|
|
313
|
+
|
|
314
|
+
interface UserMenuProps {
|
|
315
|
+
user: UserConfig;
|
|
316
|
+
}
|
|
317
|
+
/** Usuário à direita da topbar: avatar + nome + dropdown de ações. */
|
|
318
|
+
declare function UserMenu({ user }: UserMenuProps): react.JSX.Element;
|
|
319
|
+
|
|
320
|
+
interface ThemeToggleProps {
|
|
321
|
+
/** Rótulo acessível. Padrão: "Alternar tema". */
|
|
322
|
+
label?: string;
|
|
323
|
+
}
|
|
324
|
+
/** Botão de alternância de tema (claro/escuro), com crossfade dos ícones. */
|
|
325
|
+
declare function ThemeToggle({ label }: ThemeToggleProps): react.JSX.Element;
|
|
326
|
+
|
|
327
|
+
interface SidebarItemProps {
|
|
328
|
+
item: MenuLink;
|
|
329
|
+
/** Recuo extra (usado para itens dentro de grupos). */
|
|
330
|
+
nested?: boolean;
|
|
331
|
+
}
|
|
332
|
+
/** Item simples (link) da sidebar, com estado ativo. */
|
|
333
|
+
declare function SidebarItem({ item, nested }: SidebarItemProps): react.JSX.Element;
|
|
334
|
+
|
|
335
|
+
interface SidebarGroupProps {
|
|
336
|
+
group: MenuGroup;
|
|
337
|
+
}
|
|
338
|
+
/** Grupo colapsável da sidebar (label em maiúsculas + chevron animado + altura animada). */
|
|
339
|
+
declare function SidebarGroup({ group }: SidebarGroupProps): react.JSX.Element;
|
|
340
|
+
|
|
341
|
+
interface DropdownTriggerArgs {
|
|
342
|
+
open: boolean;
|
|
343
|
+
toggle: () => void;
|
|
344
|
+
/** Props a serem espalhadas no elemento de trigger (acessibilidade). */
|
|
345
|
+
triggerProps: {
|
|
346
|
+
'aria-haspopup': 'menu';
|
|
347
|
+
'aria-expanded': boolean;
|
|
348
|
+
'aria-controls': string;
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
interface DropdownProps {
|
|
352
|
+
/** Renderiza o gatilho. Receba `toggle` e `triggerProps`. */
|
|
353
|
+
renderTrigger: (args: DropdownTriggerArgs) => ReactNode;
|
|
354
|
+
/** Conteúdo do painel. */
|
|
355
|
+
children: ReactNode;
|
|
356
|
+
/** Alinhamento horizontal do painel. Padrão: `'end'`. */
|
|
357
|
+
align?: 'start' | 'end';
|
|
358
|
+
/** Classe extra do painel. */
|
|
359
|
+
panelClassName?: string;
|
|
360
|
+
/** Largura do painel (px ou CSS). */
|
|
361
|
+
panelWidth?: number | string;
|
|
362
|
+
/** Fecha o painel ao clicar em qualquer lugar dentro dele. Padrão: `true`. */
|
|
363
|
+
closeOnContentClick?: boolean;
|
|
364
|
+
/** Rótulo acessível do menu. */
|
|
365
|
+
ariaLabel?: string;
|
|
366
|
+
/** Estado controlado (opcional). */
|
|
367
|
+
open?: boolean;
|
|
368
|
+
onOpenChange?: (open: boolean) => void;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Dropdown inline (sem portal — garante herança do escopo de estilo `.rootzz-layout`).
|
|
372
|
+
* Fecha em clique fora / Escape e faz fade in/out suave.
|
|
373
|
+
*/
|
|
374
|
+
declare function Dropdown({ renderTrigger, children, align, panelClassName, panelWidth, closeOnContentClick, ariaLabel, open: openProp, onOpenChange, }: DropdownProps): react.JSX.Element;
|
|
375
|
+
|
|
376
|
+
interface OverlayProps {
|
|
377
|
+
open: boolean;
|
|
378
|
+
onClick?: () => void;
|
|
379
|
+
className?: string;
|
|
380
|
+
}
|
|
381
|
+
/** Camada escura semitransparente (mobile), com fade in/out. */
|
|
382
|
+
declare function Overlay({ open, onClick, className }: OverlayProps): react.JSX.Element | null;
|
|
383
|
+
|
|
384
|
+
interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
385
|
+
/** Ícone/conteúdo central. */
|
|
386
|
+
children: ReactNode;
|
|
387
|
+
/** Conteúdo do badge (número ou nó). `true` exibe um ponto. */
|
|
388
|
+
badge?: ReactNode | boolean;
|
|
389
|
+
/** Tamanho do botão em px. Padrão: 40. */
|
|
390
|
+
size?: number;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Botão de ícone padronizado para a topbar (hover suave, foco acessível, badge opcional).
|
|
394
|
+
* Útil também para montar suas próprias ações custom mantendo a consistência visual.
|
|
395
|
+
*/
|
|
396
|
+
declare const IconButton: react.ForwardRefExoticComponent<IconButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
397
|
+
|
|
398
|
+
interface LayoutContextValue {
|
|
399
|
+
/** Tema atual. */
|
|
400
|
+
theme: ThemeMode;
|
|
401
|
+
/** Define o tema. */
|
|
402
|
+
setTheme: (theme: ThemeMode) => void;
|
|
403
|
+
/** Alterna entre claro e escuro. */
|
|
404
|
+
toggleTheme: () => void;
|
|
405
|
+
/** Drawer mobile aberto? */
|
|
406
|
+
mobileOpen: boolean;
|
|
407
|
+
/** Abre/fecha o drawer mobile. */
|
|
408
|
+
setMobileOpen: (open: boolean) => void;
|
|
409
|
+
/** Estamos em viewport mobile? */
|
|
410
|
+
isMobile: boolean;
|
|
411
|
+
/** Componente de link usado na navegação (padrão `<a>`). */
|
|
412
|
+
linkComponent: LinkComponent;
|
|
413
|
+
}
|
|
414
|
+
/** Acessa o estado do layout (tema, drawer mobile, etc.). */
|
|
415
|
+
declare function useLayout(): LayoutContextValue;
|
|
416
|
+
interface LayoutProviderProps {
|
|
417
|
+
children: ReactNode;
|
|
418
|
+
theme?: ThemeMode;
|
|
419
|
+
defaultTheme?: ThemeMode;
|
|
420
|
+
onThemeChange?: (theme: ThemeMode) => void;
|
|
421
|
+
linkComponent?: LinkComponent;
|
|
422
|
+
}
|
|
423
|
+
declare function LayoutProvider({ children, theme: themeProp, defaultTheme, onThemeChange, linkComponent, }: LayoutProviderProps): react.JSX.Element;
|
|
424
|
+
|
|
425
|
+
/** URL padrão da lista de aplicativos da Eduzz. */
|
|
426
|
+
declare const DEFAULT_APPS_URL = "https://cdn.eduzzcdn.com/topbar/applications.json";
|
|
427
|
+
interface UseAppsResult {
|
|
428
|
+
items: AppItem[];
|
|
429
|
+
loading: boolean;
|
|
430
|
+
error: Error | null;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Resolve a fonte de apps em `{ items, loading, error }`.
|
|
434
|
+
* Listas estáticas são usadas direto; URLs são buscadas (com cache).
|
|
435
|
+
*/
|
|
436
|
+
declare function useApps(source: AppsSource | undefined): UseAppsResult;
|
|
437
|
+
interface UseApplicationResult {
|
|
438
|
+
/** App encontrado pelo identificador, ou `null` enquanto carrega / se não existir. */
|
|
439
|
+
app: AppItem | null;
|
|
440
|
+
loading: boolean;
|
|
441
|
+
error: Error | null;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Resolve um único aplicativo da Eduzz pelo seu identificador (campo
|
|
445
|
+
* `application` do `applications.json`). Reaproveita o mesmo fetch/cache de
|
|
446
|
+
* {@link useApps}, então não há requisição extra quando o menu de apps já carregou.
|
|
447
|
+
*
|
|
448
|
+
* @param application Identificador (ex.: `"orbita"`). `undefined` desativa.
|
|
449
|
+
* @param url Fonte custom do JSON. Padrão: {@link DEFAULT_APPS_URL}.
|
|
450
|
+
*/
|
|
451
|
+
declare function useApplication(application: string | undefined, url?: string): UseApplicationResult;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Concatena classes condicionalmente. Substituto mínimo de `clsx` para manter
|
|
455
|
+
* a biblioteca sem dependências de runtime.
|
|
456
|
+
*
|
|
457
|
+
* @example cx('rootzz-item', isActive && 'rootzz-item--active', { 'rootzz-hidden': hidden })
|
|
458
|
+
*/
|
|
459
|
+
type ClassValue = string | number | null | false | undefined | ClassValue[] | Record<string, boolean | null | undefined>;
|
|
460
|
+
declare function cx(...inputs: ClassValue[]): string;
|
|
461
|
+
|
|
462
|
+
export { type AppItem, AppsMenu, type AppsMenuProps, type AppsSource, Brand, type BrandProps, Content, type ContentProps, DEFAULT_APPS_URL, Dropdown, type DropdownProps, type DropdownTriggerArgs, IconButton, type IconButtonProps, type LayoutContextValue, LayoutProvider, type LayoutProviderProps, type LinkComponent, type LogoConfig, type MenuDivider, type MenuGroup, type MenuItem, type MenuLink, Overlay, type OverlayProps, RootzzLayout, type RootzzLayoutProps, SearchBar, type SearchBarProps, Sidebar, SidebarGroup, type SidebarGroupProps, SidebarItem, type SidebarItemProps, type SidebarProps, type ThemeMode, ThemeToggle, type ThemeToggleProps, Topbar, type TopbarProps, type UseApplicationResult, type UseAppsResult, type UserConfig, UserMenu, type UserMenuDivider, type UserMenuEntry, type UserMenuItem, type UserMenuProps, cx, useApplication, useApps, useLayout };
|