@tooark/react 1.6.1 → 1.7.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 +17 -10
- package/README.pt-BR.md +17 -10
- package/dist/ark-alert.d.ts +6 -6
- package/dist/ark-avatar.d.ts +2 -2
- package/dist/ark-button.d.ts +6 -2
- package/dist/ark-button.js +14 -3
- package/dist/ark-card.d.ts +2 -2
- package/dist/ark-card.js +4 -2
- package/dist/ark-checkbox.d.ts +8 -8
- package/dist/ark-clock.d.ts +2 -2
- package/dist/ark-color-swatches.d.ts +4 -4
- package/dist/ark-command-palette.d.ts +18 -18
- package/dist/ark-copy-button.d.ts +2 -2
- package/dist/ark-data-view.d.ts +79 -0
- package/dist/ark-data-view.js +195 -0
- package/dist/ark-dialog.d.ts +12 -12
- package/dist/ark-dialog.js +4 -3
- package/dist/ark-drawer.d.ts +12 -12
- package/dist/ark-drawer.js +4 -3
- package/dist/ark-empty.d.ts +4 -4
- package/dist/ark-empty.js +3 -2
- package/dist/ark-file-input.d.ts +8 -8
- package/dist/ark-input.d.ts +2 -2
- package/dist/ark-kv-editor.d.ts +11 -11
- package/dist/ark-kv-editor.js +2 -2
- package/dist/ark-mark.d.ts +2 -2
- package/dist/ark-menu.d.ts +23 -11
- package/dist/ark-menu.js +8 -0
- package/dist/ark-nav.d.ts +111 -0
- package/dist/ark-nav.js +79 -0
- package/dist/ark-pagination.d.ts +36 -0
- package/dist/ark-pagination.js +31 -0
- package/dist/ark-progress.d.ts +8 -8
- package/dist/ark-radio.d.ts +10 -10
- package/dist/ark-scheduler.d.ts +1 -1
- package/dist/ark-shape-picker.d.ts +6 -6
- package/dist/ark-skeleton.d.ts +2 -2
- package/dist/ark-spinner.d.ts +2 -2
- package/dist/ark-split-pane.d.ts +4 -4
- package/dist/ark-status-dot.d.ts +2 -2
- package/dist/ark-switch.d.ts +6 -3
- package/dist/ark-switch.js +3 -2
- package/dist/ark-tabs.d.ts +6 -6
- package/dist/ark-textarea.d.ts +9 -9
- package/dist/ark-time.d.ts +18 -0
- package/dist/ark-time.js +22 -0
- package/dist/ark-tooltip.d.ts +4 -4
- package/dist/ark-tree.d.ts +86 -0
- package/dist/ark-tree.js +54 -0
- package/dist/chart.d.ts +65 -0
- package/dist/chart.js +35 -0
- package/dist/code.d.ts +148 -0
- package/dist/code.js +77 -0
- package/dist/index.d.ts +13 -3
- package/dist/index.js +7 -2
- package/dist/jsx-intrinsics.d.ts +126 -1
- package/dist/wysiwyg.d.ts +108 -0
- package/dist/wysiwyg.js +68 -0
- package/package.json +47 -3
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { createElement, Fragment, forwardRef, useEffect, useReducer, useRef } from "react";
|
|
2
|
+
import { createPortal, flushSync } from "react-dom";
|
|
3
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
4
|
+
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
5
|
+
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
6
|
+
let hostSeq = 0;
|
|
7
|
+
// Assinatura das colunas sem as funções (só se existem): enquanto ela não muda o elemento fica com as colunas que
|
|
8
|
+
// tem, e um `render` novo a cada render do app (colunas declaradas inline) não refaz a tabela.
|
|
9
|
+
function signatureOf(columns) {
|
|
10
|
+
if (!columns)
|
|
11
|
+
return "";
|
|
12
|
+
return JSON.stringify(columns.map(({ render, compare, ...data }) => [data, typeof render === "function", typeof compare === "function"]));
|
|
13
|
+
}
|
|
14
|
+
function isDomNode(value) {
|
|
15
|
+
return typeof Node !== "undefined" && value instanceof Node;
|
|
16
|
+
}
|
|
17
|
+
const ArkDataViewBase = forwardRef(function ArkDataView(props, forwardedRef) {
|
|
18
|
+
const { children, className, rows, columns, rowKey, noViewSelector, page, pageSize, pageSizes, total, sort, search, searchable, searchPlaceholder, searchDebounce, selectable, selected, reorderable, clickable, loading, breakpoint, cardColumns, cardRender, localeJson, onQueryChange, onViewChange, onRowClick, onSelectionChange, onReorder, ...rest } = props;
|
|
19
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
20
|
+
const [, repaint] = useReducer((count) => count + 1, 0);
|
|
21
|
+
// Nós de célula entregues ao elemento, onde os portais desenham; quem cria e quem descarta é o elemento.
|
|
22
|
+
const hosts = useRef(new Map());
|
|
23
|
+
// O que o app passou no último render confirmado: as funções entregues ao elemento leem daqui, então continuam
|
|
24
|
+
// as mesmas enquanto o `render` do app muda.
|
|
25
|
+
const latest = useRef({});
|
|
26
|
+
const bridge = useRef(null);
|
|
27
|
+
if (!bridge.current) {
|
|
28
|
+
const host = (entry) => {
|
|
29
|
+
const node = document.createElement("span");
|
|
30
|
+
node.style.display = "contents";
|
|
31
|
+
hosts.current.set(node, entry);
|
|
32
|
+
return node;
|
|
33
|
+
};
|
|
34
|
+
bridge.current = {
|
|
35
|
+
signature: null,
|
|
36
|
+
cell: (key, context) => {
|
|
37
|
+
const out = latest.current.columns?.find((column) => column.key === key)?.render?.(context);
|
|
38
|
+
return isDomNode(out) ? out : host({ id: ++hostSeq, kind: "cell", key, context });
|
|
39
|
+
},
|
|
40
|
+
card: (context) => {
|
|
41
|
+
const out = latest.current.cardRender?.(context);
|
|
42
|
+
// Sem JSX para este card, a grade de campos do elemento fica.
|
|
43
|
+
if (out === null || out === undefined || isDomNode(out))
|
|
44
|
+
return out;
|
|
45
|
+
return host({ id: ++hostSeq, kind: "card", context });
|
|
46
|
+
},
|
|
47
|
+
compare: (key, a, b) => latest.current.columns?.find((column) => column.key === key)?.compare?.(a, b) ?? 0
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
ensureTooarkComponentsRegistered();
|
|
52
|
+
}, []);
|
|
53
|
+
useIsomorphicLayoutEffect(() => {
|
|
54
|
+
latest.current = { columns, cardRender };
|
|
55
|
+
});
|
|
56
|
+
// A cada redesenho do conteúdo o elemento troca os nós de célula: os que saíram do DOM são descartados e os
|
|
57
|
+
// portais dos novos são desenhados antes da pintura. Num microtask, porque o redesenho pode vir de dentro de um
|
|
58
|
+
// efeito do React, onde o flushSync não pode rodar.
|
|
59
|
+
useIsomorphicLayoutEffect(() => {
|
|
60
|
+
const el = ref.current;
|
|
61
|
+
if (!el)
|
|
62
|
+
return;
|
|
63
|
+
let alive = true;
|
|
64
|
+
let queued = false;
|
|
65
|
+
const flush = () => {
|
|
66
|
+
queued = false;
|
|
67
|
+
if (!alive)
|
|
68
|
+
return;
|
|
69
|
+
let dropped = false;
|
|
70
|
+
for (const node of Array.from(hosts.current.keys())) {
|
|
71
|
+
if (node.isConnected)
|
|
72
|
+
continue;
|
|
73
|
+
hosts.current.delete(node);
|
|
74
|
+
dropped = true;
|
|
75
|
+
}
|
|
76
|
+
if (hosts.current.size > 0 || dropped)
|
|
77
|
+
flushSync(repaint);
|
|
78
|
+
};
|
|
79
|
+
const handleRender = () => {
|
|
80
|
+
if (queued)
|
|
81
|
+
return;
|
|
82
|
+
queued = true;
|
|
83
|
+
queueMicrotask(flush);
|
|
84
|
+
};
|
|
85
|
+
el.addEventListener("ark-render", handleRender);
|
|
86
|
+
return () => {
|
|
87
|
+
alive = false;
|
|
88
|
+
el.removeEventListener("ark-render", handleRender);
|
|
89
|
+
};
|
|
90
|
+
}, [ref]);
|
|
91
|
+
// `columns`, `rows` e `selected` são propriedades (objetos e funções), não atributos; as colunas vão antes das
|
|
92
|
+
// linhas para a primeira renderização com dados já ter as células certas. As colunas só são regravadas quando a
|
|
93
|
+
// assinatura delas muda.
|
|
94
|
+
const signature = signatureOf(columns);
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
const el = ref.current;
|
|
97
|
+
const api = bridge.current;
|
|
98
|
+
const list = latest.current.columns;
|
|
99
|
+
if (!el || !api || !list || api.signature === signature)
|
|
100
|
+
return;
|
|
101
|
+
api.signature = signature;
|
|
102
|
+
el.columns = list.map(({ render, compare, ...data }) => ({
|
|
103
|
+
...data,
|
|
104
|
+
...(render ? { render: (context) => api.cell(data.key, context) } : {}),
|
|
105
|
+
...(compare ? { compare: (a, b) => api.compare(data.key, a, b) } : {})
|
|
106
|
+
}));
|
|
107
|
+
}, [ref, signature]);
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (ref.current && rows)
|
|
110
|
+
ref.current.rows = rows;
|
|
111
|
+
}, [ref, rows]);
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
if (ref.current && selected)
|
|
114
|
+
ref.current.selected = selected;
|
|
115
|
+
}, [ref, selected]);
|
|
116
|
+
// Função, então propriedade; só é gravada quando o app dá uma (e uma vez só: quem muda é a função lida por ela),
|
|
117
|
+
// para a view sem ela não refazer os cards.
|
|
118
|
+
const hasCardRender = typeof cardRender === "function";
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
const el = ref.current;
|
|
121
|
+
const api = bridge.current;
|
|
122
|
+
if (!el || !api)
|
|
123
|
+
return;
|
|
124
|
+
if (hasCardRender) {
|
|
125
|
+
if (el.cardRender !== api.card)
|
|
126
|
+
el.cardRender = api.card;
|
|
127
|
+
}
|
|
128
|
+
else if (el.cardRender) {
|
|
129
|
+
el.cardRender = null;
|
|
130
|
+
}
|
|
131
|
+
}, [ref, hasCardRender]);
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
const el = ref.current;
|
|
134
|
+
if (!el)
|
|
135
|
+
return;
|
|
136
|
+
const handlers = [];
|
|
137
|
+
function bind(name, handler) {
|
|
138
|
+
if (!handler)
|
|
139
|
+
return;
|
|
140
|
+
const listener = (event) => handler(event);
|
|
141
|
+
el.addEventListener(name, listener);
|
|
142
|
+
handlers.push([name, listener]);
|
|
143
|
+
}
|
|
144
|
+
bind("ark-query-change", onQueryChange);
|
|
145
|
+
bind("ark-view-change", onViewChange);
|
|
146
|
+
bind("ark-row-click", onRowClick);
|
|
147
|
+
bind("ark-selection-change", onSelectionChange);
|
|
148
|
+
bind("ark-reorder", onReorder);
|
|
149
|
+
return () => {
|
|
150
|
+
for (const [name, listener] of handlers) {
|
|
151
|
+
el.removeEventListener(name, listener);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}, [ref, onQueryChange, onViewChange, onRowClick, onSelectionChange, onReorder]);
|
|
155
|
+
const attrs = {
|
|
156
|
+
...rest,
|
|
157
|
+
ref: setRef,
|
|
158
|
+
class: className,
|
|
159
|
+
"row-key": rowKey,
|
|
160
|
+
"no-view-selector": noViewSelector ? "" : undefined,
|
|
161
|
+
breakpoint: breakpoint !== undefined ? String(breakpoint) : undefined,
|
|
162
|
+
page: page !== undefined ? String(page) : undefined,
|
|
163
|
+
"page-size": pageSize !== undefined ? String(pageSize) : undefined,
|
|
164
|
+
"page-sizes": pageSizes && pageSizes.length > 0 ? pageSizes.join(",") : undefined,
|
|
165
|
+
total: total !== undefined ? String(total) : undefined,
|
|
166
|
+
sort: sort && typeof sort === "object" ? `${sort.key}:${sort.direction}` : sort || undefined,
|
|
167
|
+
search: search || undefined,
|
|
168
|
+
searchable: searchable ? "" : undefined,
|
|
169
|
+
"search-placeholder": searchPlaceholder,
|
|
170
|
+
"search-debounce": searchDebounce !== undefined ? String(searchDebounce) : undefined,
|
|
171
|
+
selectable: selectable ? "" : undefined,
|
|
172
|
+
reorderable: reorderable ? "" : undefined,
|
|
173
|
+
clickable: clickable ? "" : undefined,
|
|
174
|
+
loading: loading ? "" : undefined,
|
|
175
|
+
"card-columns": cardColumns !== undefined ? String(cardColumns) : undefined,
|
|
176
|
+
"locale-json": localeJson
|
|
177
|
+
};
|
|
178
|
+
// Um portal por nó de célula, com o `render` deste render do app: o conteúdo se atualiza como qualquer filho,
|
|
179
|
+
// sem o elemento refazer a tabela.
|
|
180
|
+
const portals = [];
|
|
181
|
+
for (const [node, entry] of hosts.current) {
|
|
182
|
+
const content = entry.kind === "cell"
|
|
183
|
+
? columns?.find((column) => column.key === entry.key)?.render?.(entry.context)
|
|
184
|
+
: cardRender?.(entry.context);
|
|
185
|
+
if (isDomNode(content))
|
|
186
|
+
continue;
|
|
187
|
+
portals.push(createPortal(content, node, String(entry.id)));
|
|
188
|
+
}
|
|
189
|
+
return createElement(Fragment, null, createElement("ark-data-view", attrs, children), portals);
|
|
190
|
+
});
|
|
191
|
+
/**
|
|
192
|
+
* Wrapper do ark-data-view. Genérico no registro: `<ArkDataView<User> rows={users} ... />` tipa `columns`, `render`
|
|
193
|
+
* e o `detail.row` dos eventos com o tipo do app (inferido de `rows` quando o parâmetro é omitido).
|
|
194
|
+
*/
|
|
195
|
+
export const ArkDataView = ArkDataViewBase;
|
package/dist/ark-dialog.d.ts
CHANGED
|
@@ -3,39 +3,39 @@ import type { ArkDialog as ArkDialogElement } from "@tooark/web-components";
|
|
|
3
3
|
import React, { type PropsWithChildren } from "react";
|
|
4
4
|
import type { ArkDomProps } from "./dom-props.js";
|
|
5
5
|
export type ArkDialogProps = PropsWithChildren<ArkDomProps<ArkDialogStyleOptions & {
|
|
6
|
-
/** Aberto; a
|
|
6
|
+
/** Aberto; a saída anima antes de sair do top layer. */
|
|
7
7
|
open?: boolean;
|
|
8
|
-
/**
|
|
8
|
+
/** Título (h2) e nome acessível. Sem ele, passe aria-label. */
|
|
9
9
|
label?: string;
|
|
10
|
-
/** Esconde o
|
|
10
|
+
/** Esconde o botão de fechar do cabeçalho. */
|
|
11
11
|
noCloseButton?: boolean;
|
|
12
|
-
/** Esc e clique no scrim
|
|
12
|
+
/** Esc e clique no scrim não fecham. */
|
|
13
13
|
persistent?: boolean;
|
|
14
|
-
/** A
|
|
14
|
+
/** A página continua rolando com o diálogo aberto. */
|
|
15
15
|
noScrollLock?: boolean;
|
|
16
16
|
"aria-label"?: string;
|
|
17
17
|
className?: string;
|
|
18
18
|
onOpen?: (event: CustomEvent) => void;
|
|
19
|
-
/** O fechamento
|
|
19
|
+
/** O fechamento começou; detail.reason diz por que (escape, backdrop, close-button, api). */
|
|
20
20
|
onClose?: (event: CustomEvent<{
|
|
21
21
|
reason: ArkDialogCloseReason;
|
|
22
22
|
}>) => void;
|
|
23
23
|
}>>;
|
|
24
24
|
export declare const ArkDialog: React.ForwardRefExoticComponent<ArkDialogStyleOptions & {
|
|
25
|
-
/** Aberto; a
|
|
25
|
+
/** Aberto; a saída anima antes de sair do top layer. */
|
|
26
26
|
open?: boolean;
|
|
27
|
-
/**
|
|
27
|
+
/** Título (h2) e nome acessível. Sem ele, passe aria-label. */
|
|
28
28
|
label?: string;
|
|
29
|
-
/** Esconde o
|
|
29
|
+
/** Esconde o botão de fechar do cabeçalho. */
|
|
30
30
|
noCloseButton?: boolean;
|
|
31
|
-
/** Esc e clique no scrim
|
|
31
|
+
/** Esc e clique no scrim não fecham. */
|
|
32
32
|
persistent?: boolean;
|
|
33
|
-
/** A
|
|
33
|
+
/** A página continua rolando com o diálogo aberto. */
|
|
34
34
|
noScrollLock?: boolean;
|
|
35
35
|
"aria-label"?: string;
|
|
36
36
|
className?: string;
|
|
37
37
|
onOpen?: (event: CustomEvent) => void;
|
|
38
|
-
/** O fechamento
|
|
38
|
+
/** O fechamento começou; detail.reason diz por que (escape, backdrop, close-button, api). */
|
|
39
39
|
onClose?: (event: CustomEvent<{
|
|
40
40
|
reason: ArkDialogCloseReason;
|
|
41
41
|
}>) => void;
|
package/dist/ark-dialog.js
CHANGED
|
@@ -3,7 +3,7 @@ import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
|
3
3
|
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
4
4
|
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
5
5
|
export const ArkDialog = forwardRef(function ArkDialog(props, forwardedRef) {
|
|
6
|
-
const { children, className, open, width, height, noCloseButton, persistent, noScrollLock, localeJson, onOpen, onClose, ...rest } = props;
|
|
6
|
+
const { children, className, open, width, height, noCloseButton, persistent, noScrollLock, localeJson, headingLevel, onOpen, onClose, ...rest } = props;
|
|
7
7
|
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
ensureTooarkComponentsRegistered();
|
|
@@ -26,13 +26,14 @@ export const ArkDialog = forwardRef(function ArkDialog(props, forwardedRef) {
|
|
|
26
26
|
ref: setRef,
|
|
27
27
|
class: className,
|
|
28
28
|
open: open ? "" : undefined,
|
|
29
|
-
//
|
|
29
|
+
// Número vira string aqui; o componente acrescenta px a números sem unidade.
|
|
30
30
|
width: width === undefined ? undefined : String(width),
|
|
31
31
|
height: height === undefined ? undefined : String(height),
|
|
32
32
|
"no-close-button": noCloseButton ? "" : undefined,
|
|
33
33
|
persistent: persistent ? "" : undefined,
|
|
34
34
|
"no-scroll-lock": noScrollLock ? "" : undefined,
|
|
35
|
-
"locale-json": localeJson
|
|
35
|
+
"locale-json": localeJson,
|
|
36
|
+
"heading-level": headingLevel
|
|
36
37
|
};
|
|
37
38
|
return createElement("ark-dialog", attrs, children);
|
|
38
39
|
});
|
package/dist/ark-drawer.d.ts
CHANGED
|
@@ -4,39 +4,39 @@ import type React from "react";
|
|
|
4
4
|
import { type PropsWithChildren } from "react";
|
|
5
5
|
import type { ArkDomProps } from "./dom-props.js";
|
|
6
6
|
export type ArkDrawerProps = PropsWithChildren<ArkDomProps<ArkDrawerStyleOptions & {
|
|
7
|
-
/** Aberta; a
|
|
7
|
+
/** Aberta; a saída anima antes de esconder. */
|
|
8
8
|
open?: boolean;
|
|
9
|
-
/**
|
|
9
|
+
/** Título (h2) e nome acessível. Sem ele, passe aria-label. */
|
|
10
10
|
label?: string;
|
|
11
|
-
/** Esconde o
|
|
11
|
+
/** Esconde o botão de fechar do cabeçalho. */
|
|
12
12
|
noCloseButton?: boolean;
|
|
13
|
-
/** Esc e clique no scrim
|
|
13
|
+
/** Esc e clique no scrim não fecham (só no overlay). */
|
|
14
14
|
persistent?: boolean;
|
|
15
|
-
/** A
|
|
15
|
+
/** A página continua rolando com a gaveta aberta em overlay. */
|
|
16
16
|
noScrollLock?: boolean;
|
|
17
17
|
"aria-label"?: string;
|
|
18
18
|
className?: string;
|
|
19
19
|
onOpen?: (event: CustomEvent) => void;
|
|
20
|
-
/** O fechamento
|
|
20
|
+
/** O fechamento começou; detail.reason diz por que (escape, backdrop, close-button, api). */
|
|
21
21
|
onClose?: (event: CustomEvent<{
|
|
22
22
|
reason: ArkDrawerCloseReason;
|
|
23
23
|
}>) => void;
|
|
24
24
|
}>>;
|
|
25
25
|
export declare const ArkDrawer: React.ForwardRefExoticComponent<ArkDrawerStyleOptions & {
|
|
26
|
-
/** Aberta; a
|
|
26
|
+
/** Aberta; a saída anima antes de esconder. */
|
|
27
27
|
open?: boolean;
|
|
28
|
-
/**
|
|
28
|
+
/** Título (h2) e nome acessível. Sem ele, passe aria-label. */
|
|
29
29
|
label?: string;
|
|
30
|
-
/** Esconde o
|
|
30
|
+
/** Esconde o botão de fechar do cabeçalho. */
|
|
31
31
|
noCloseButton?: boolean;
|
|
32
|
-
/** Esc e clique no scrim
|
|
32
|
+
/** Esc e clique no scrim não fecham (só no overlay). */
|
|
33
33
|
persistent?: boolean;
|
|
34
|
-
/** A
|
|
34
|
+
/** A página continua rolando com a gaveta aberta em overlay. */
|
|
35
35
|
noScrollLock?: boolean;
|
|
36
36
|
"aria-label"?: string;
|
|
37
37
|
className?: string;
|
|
38
38
|
onOpen?: (event: CustomEvent) => void;
|
|
39
|
-
/** O fechamento
|
|
39
|
+
/** O fechamento começou; detail.reason diz por que (escape, backdrop, close-button, api). */
|
|
40
40
|
onClose?: (event: CustomEvent<{
|
|
41
41
|
reason: ArkDrawerCloseReason;
|
|
42
42
|
}>) => void;
|
package/dist/ark-drawer.js
CHANGED
|
@@ -3,7 +3,7 @@ import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
|
3
3
|
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
4
4
|
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
5
5
|
export const ArkDrawer = forwardRef(function ArkDrawer(props, forwardedRef) {
|
|
6
|
-
const { children, className, open, size, noCloseButton, persistent, noScrollLock, localeJson, onOpen, onClose, ...rest } = props;
|
|
6
|
+
const { children, className, open, size, noCloseButton, persistent, noScrollLock, localeJson, headingLevel, onOpen, onClose, ...rest } = props;
|
|
7
7
|
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
ensureTooarkComponentsRegistered();
|
|
@@ -26,12 +26,13 @@ export const ArkDrawer = forwardRef(function ArkDrawer(props, forwardedRef) {
|
|
|
26
26
|
ref: setRef,
|
|
27
27
|
class: className,
|
|
28
28
|
open: open ? "" : undefined,
|
|
29
|
-
//
|
|
29
|
+
// Número vira string aqui; o componente acrescenta px a números sem unidade.
|
|
30
30
|
size: size === undefined ? undefined : String(size),
|
|
31
31
|
"no-close-button": noCloseButton ? "" : undefined,
|
|
32
32
|
persistent: persistent ? "" : undefined,
|
|
33
33
|
"no-scroll-lock": noScrollLock ? "" : undefined,
|
|
34
|
-
"locale-json": localeJson
|
|
34
|
+
"locale-json": localeJson,
|
|
35
|
+
"heading-level": headingLevel
|
|
35
36
|
};
|
|
36
37
|
return createElement("ark-drawer", attrs, children);
|
|
37
38
|
});
|
package/dist/ark-empty.d.ts
CHANGED
|
@@ -3,16 +3,16 @@ import type { ArkEmpty as ArkEmptyElement } from "@tooark/web-components";
|
|
|
3
3
|
import React, { type PropsWithChildren } from "react";
|
|
4
4
|
import type { ArkDomProps } from "./dom-props.js";
|
|
5
5
|
export type ArkEmptyProps = PropsWithChildren<ArkDomProps<ArkEmptyStyleOptions & {
|
|
6
|
-
/**
|
|
6
|
+
/** Título (h3). */
|
|
7
7
|
heading?: string;
|
|
8
|
-
/** Texto abaixo do
|
|
8
|
+
/** Texto abaixo do título. */
|
|
9
9
|
description?: string;
|
|
10
10
|
className?: string;
|
|
11
11
|
}>>;
|
|
12
12
|
export declare const ArkEmpty: React.ForwardRefExoticComponent<ArkEmptyStyleOptions & {
|
|
13
|
-
/**
|
|
13
|
+
/** Título (h3). */
|
|
14
14
|
heading?: string;
|
|
15
|
-
/** Texto abaixo do
|
|
15
|
+
/** Texto abaixo do título. */
|
|
16
16
|
description?: string;
|
|
17
17
|
className?: string;
|
|
18
18
|
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "heading" | keyof ArkEmptyStyleOptions | "description"> & {
|
package/dist/ark-empty.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { createElement, forwardRef, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
3
|
export const ArkEmpty = forwardRef(function ArkEmpty(props, forwardedRef) {
|
|
4
|
-
const { children, className, ...rest } = props;
|
|
4
|
+
const { children, className, headingLevel, ...rest } = props;
|
|
5
5
|
useEffect(() => {
|
|
6
6
|
ensureTooarkComponentsRegistered();
|
|
7
7
|
}, []);
|
|
8
8
|
const attrs = {
|
|
9
9
|
...rest,
|
|
10
10
|
ref: forwardedRef,
|
|
11
|
-
class: className
|
|
11
|
+
class: className,
|
|
12
|
+
"heading-level": headingLevel
|
|
12
13
|
};
|
|
13
14
|
return createElement("ark-empty", attrs, children);
|
|
14
15
|
});
|
package/dist/ark-file-input.d.ts
CHANGED
|
@@ -5,11 +5,11 @@ import type { ArkDomProps } from "./dom-props.js";
|
|
|
5
5
|
export type ArkFileInputProps = ArkDomProps<ArkFileInputStyleOptions & {
|
|
6
6
|
/** Tipos aceitos pelo seletor nativo (accept). */
|
|
7
7
|
accept?: string;
|
|
8
|
-
/** Aceita
|
|
8
|
+
/** Aceita vários arquivos; sem ele o drop fica com o primeiro. */
|
|
9
9
|
multiple?: boolean;
|
|
10
|
-
/** Escolhe uma pasta inteira: o seletor abre em modo pasta e a zona
|
|
10
|
+
/** Escolhe uma pasta inteira: o seletor abre em modo pasta e a zona lê as pastas soltas. Padrão: desligado. */
|
|
11
11
|
directory?: boolean;
|
|
12
|
-
/**
|
|
12
|
+
/** Rótulo do campo (label for o input oculto; nomeia o botão junto do texto dele). */
|
|
13
13
|
label?: string;
|
|
14
14
|
helper?: string;
|
|
15
15
|
/** Mensagem de erro; liga aria-invalid e a borda de erro. */
|
|
@@ -18,7 +18,7 @@ export type ArkFileInputProps = ArkDomProps<ArkFileInputStyleOptions & {
|
|
|
18
18
|
error?: boolean;
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
required?: boolean;
|
|
21
|
-
/** Nome no
|
|
21
|
+
/** Nome no formulário (input nativo oculto). */
|
|
22
22
|
name?: string;
|
|
23
23
|
className?: string;
|
|
24
24
|
/** Arquivos escolhidos ou soltos em detail.files (array de File); com `directory`, detail.paths traz os caminhos. */
|
|
@@ -30,11 +30,11 @@ export type ArkFileInputProps = ArkDomProps<ArkFileInputStyleOptions & {
|
|
|
30
30
|
export declare const ArkFileInput: React.ForwardRefExoticComponent<ArkFileInputStyleOptions & {
|
|
31
31
|
/** Tipos aceitos pelo seletor nativo (accept). */
|
|
32
32
|
accept?: string;
|
|
33
|
-
/** Aceita
|
|
33
|
+
/** Aceita vários arquivos; sem ele o drop fica com o primeiro. */
|
|
34
34
|
multiple?: boolean;
|
|
35
|
-
/** Escolhe uma pasta inteira: o seletor abre em modo pasta e a zona
|
|
35
|
+
/** Escolhe uma pasta inteira: o seletor abre em modo pasta e a zona lê as pastas soltas. Padrão: desligado. */
|
|
36
36
|
directory?: boolean;
|
|
37
|
-
/**
|
|
37
|
+
/** Rótulo do campo (label for o input oculto; nomeia o botão junto do texto dele). */
|
|
38
38
|
label?: string;
|
|
39
39
|
helper?: string;
|
|
40
40
|
/** Mensagem de erro; liga aria-invalid e a borda de erro. */
|
|
@@ -43,7 +43,7 @@ export declare const ArkFileInput: React.ForwardRefExoticComponent<ArkFileInputS
|
|
|
43
43
|
error?: boolean;
|
|
44
44
|
disabled?: boolean;
|
|
45
45
|
required?: boolean;
|
|
46
|
-
/** Nome no
|
|
46
|
+
/** Nome no formulário (input nativo oculto). */
|
|
47
47
|
name?: string;
|
|
48
48
|
className?: string;
|
|
49
49
|
/** Arquivos escolhidos ou soltos em detail.files (array de File); com `directory`, detail.paths traz os caminhos. */
|
package/dist/ark-input.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type ArkInputProps = PropsWithChildren<ArkDomProps<ArkInputStyleOptions &
|
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
required?: boolean;
|
|
16
16
|
readonly?: boolean;
|
|
17
|
-
/** Com type="password",
|
|
17
|
+
/** Com type="password", botão de mostrar/ocultar na ponta direita. */
|
|
18
18
|
reveal?: boolean;
|
|
19
19
|
lang?: ArkLang;
|
|
20
20
|
localeJson?: string;
|
|
@@ -45,7 +45,7 @@ export declare const ArkInput: React.ForwardRefExoticComponent<ArkInputStyleOpti
|
|
|
45
45
|
disabled?: boolean;
|
|
46
46
|
required?: boolean;
|
|
47
47
|
readonly?: boolean;
|
|
48
|
-
/** Com type="password",
|
|
48
|
+
/** Com type="password", botão de mostrar/ocultar na ponta direita. */
|
|
49
49
|
reveal?: boolean;
|
|
50
50
|
lang?: ArkLang;
|
|
51
51
|
localeJson?: string;
|
package/dist/ark-kv-editor.d.ts
CHANGED
|
@@ -5,11 +5,11 @@ import type { ArkDomProps } from "./dom-props.js";
|
|
|
5
5
|
export type ArkKvEditorProps = ArkDomProps<ArkKvEditorStyleOptions & {
|
|
6
6
|
/** Linhas { id, key, value, enabled }; atribuir substitui tudo e renderiza de novo. */
|
|
7
7
|
rows?: ArkKvRow[];
|
|
8
|
-
/** Modo de
|
|
8
|
+
/** Modo de edição em massa (textarea). */
|
|
9
9
|
bulk?: boolean;
|
|
10
10
|
/** Tipos de valor da coluna de tipo (string, number, date, time, datetime, email, url); vazio esconde a coluna. */
|
|
11
11
|
types?: string[];
|
|
12
|
-
/** Mostra a coluna de
|
|
12
|
+
/** Mostra a coluna de descrição. */
|
|
13
13
|
description?: boolean;
|
|
14
14
|
/** Mostra o cadeado por linha: fechado mascara o valor como senha, com o olho para revelar. */
|
|
15
15
|
secret?: boolean;
|
|
@@ -18,12 +18,12 @@ export type ArkKvEditorProps = ArkDomProps<ArkKvEditorStyleOptions & {
|
|
|
18
18
|
descriptionPlaceholder?: string;
|
|
19
19
|
readonly?: boolean;
|
|
20
20
|
/**
|
|
21
|
-
* Cria a
|
|
22
|
-
* linhas secretas
|
|
21
|
+
* Cria a célula de valor de cada linha no lugar do ark-input (um campo com autocomplete de variáveis, por exemplo);
|
|
22
|
+
* linhas secretas mantêm o campo de senha. Precisa ser estável (useCallback): uma função nova recria as células.
|
|
23
23
|
*/
|
|
24
24
|
valueField?: ArkKvValueField;
|
|
25
25
|
className?: string;
|
|
26
|
-
/** Qualquer
|
|
26
|
+
/** Qualquer edição, inclusive ao sair do modo em massa: detail.rows são as linhas. */
|
|
27
27
|
onChange?: (event: CustomEvent<{
|
|
28
28
|
rows: ArkKvRow[];
|
|
29
29
|
}>) => void;
|
|
@@ -37,11 +37,11 @@ export type ArkKvEditorProps = ArkDomProps<ArkKvEditorStyleOptions & {
|
|
|
37
37
|
export declare const ArkKvEditor: React.ForwardRefExoticComponent<ArkKvEditorStyleOptions & {
|
|
38
38
|
/** Linhas { id, key, value, enabled }; atribuir substitui tudo e renderiza de novo. */
|
|
39
39
|
rows?: ArkKvRow[];
|
|
40
|
-
/** Modo de
|
|
40
|
+
/** Modo de edição em massa (textarea). */
|
|
41
41
|
bulk?: boolean;
|
|
42
42
|
/** Tipos de valor da coluna de tipo (string, number, date, time, datetime, email, url); vazio esconde a coluna. */
|
|
43
43
|
types?: string[];
|
|
44
|
-
/** Mostra a coluna de
|
|
44
|
+
/** Mostra a coluna de descrição. */
|
|
45
45
|
description?: boolean;
|
|
46
46
|
/** Mostra o cadeado por linha: fechado mascara o valor como senha, com o olho para revelar. */
|
|
47
47
|
secret?: boolean;
|
|
@@ -50,12 +50,12 @@ export declare const ArkKvEditor: React.ForwardRefExoticComponent<ArkKvEditorSty
|
|
|
50
50
|
descriptionPlaceholder?: string;
|
|
51
51
|
readonly?: boolean;
|
|
52
52
|
/**
|
|
53
|
-
* Cria a
|
|
54
|
-
* linhas secretas
|
|
53
|
+
* Cria a célula de valor de cada linha no lugar do ark-input (um campo com autocomplete de variáveis, por exemplo);
|
|
54
|
+
* linhas secretas mantêm o campo de senha. Precisa ser estável (useCallback): uma função nova recria as células.
|
|
55
55
|
*/
|
|
56
56
|
valueField?: ArkKvValueField;
|
|
57
57
|
className?: string;
|
|
58
|
-
/** Qualquer
|
|
58
|
+
/** Qualquer edição, inclusive ao sair do modo em massa: detail.rows são as linhas. */
|
|
59
59
|
onChange?: (event: CustomEvent<{
|
|
60
60
|
rows: ArkKvRow[];
|
|
61
61
|
}>) => void;
|
|
@@ -65,4 +65,4 @@ export declare const ArkKvEditor: React.ForwardRefExoticComponent<ArkKvEditorSty
|
|
|
65
65
|
onDelete?: (event: CustomEvent<{
|
|
66
66
|
id: string;
|
|
67
67
|
}>) => void;
|
|
68
|
-
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "onChange" | "secret" | "description" | "readonly" | keyof ArkKvEditorStyleOptions | "
|
|
68
|
+
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "onChange" | "secret" | "rows" | "description" | "readonly" | keyof ArkKvEditorStyleOptions | "bulk" | "types" | "keyPlaceholder" | "valuePlaceholder" | "descriptionPlaceholder" | "valueField" | "onAdd" | "onDelete"> & React.RefAttributes<ArkKvEditorElement>>;
|
package/dist/ark-kv-editor.js
CHANGED
|
@@ -7,12 +7,12 @@ export const ArkKvEditor = forwardRef(function ArkKvEditor(props, forwardedRef)
|
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
ensureTooarkComponentsRegistered();
|
|
9
9
|
}, []);
|
|
10
|
-
// `rows`
|
|
10
|
+
// `rows` é propriedade (objetos), não atributo.
|
|
11
11
|
useEffect(() => {
|
|
12
12
|
if (ref.current && rows)
|
|
13
13
|
ref.current.rows = rows;
|
|
14
14
|
}, [ref, rows]);
|
|
15
|
-
// `valueField`
|
|
15
|
+
// `valueField` é função, então propriedade; só passa a ser gravada quando o app dá uma, para o editor sem ela não
|
|
16
16
|
// recriar as linhas na montagem.
|
|
17
17
|
useEffect(() => {
|
|
18
18
|
const el = ref.current;
|
package/dist/ark-mark.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import type { ArkMark as ArkMarkElement } from "@tooark/web-components";
|
|
|
3
3
|
import type React from "react";
|
|
4
4
|
import type { ArkDomProps } from "./dom-props.js";
|
|
5
5
|
export type ArkMarkProps = ArkDomProps<ArkMarkStyleOptions & {
|
|
6
|
-
/** Com
|
|
6
|
+
/** Com rótulo a marca vira role="img" nomeado; sem ele é decorativa (aria-hidden). */
|
|
7
7
|
label?: string;
|
|
8
8
|
className?: string;
|
|
9
9
|
}>;
|
|
10
10
|
export declare const ArkMark: React.ForwardRefExoticComponent<ArkMarkStyleOptions & {
|
|
11
|
-
/** Com
|
|
11
|
+
/** Com rótulo a marca vira role="img" nomeado; sem ele é decorativa (aria-hidden). */
|
|
12
12
|
label?: string;
|
|
13
13
|
className?: string;
|
|
14
14
|
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "label" | keyof ArkMarkStyleOptions> & React.RefAttributes<ArkMarkElement>>;
|
package/dist/ark-menu.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ArkMenuAlign, ArkMenuDirection, ArkMenuItemStyleOptions, ArkMenuStyleOptions } from "@tooark/core";
|
|
2
|
-
import type { ArkMenu as ArkMenuElement, ArkMenuItem as ArkMenuItemElement } from "@tooark/web-components";
|
|
1
|
+
import type { ArkMenuAlign, ArkMenuDirection, ArkMenuGroupStyleOptions, ArkMenuItemStyleOptions, ArkMenuStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkMenu as ArkMenuElement, ArkMenuGroup as ArkMenuGroupElement, ArkMenuItem as ArkMenuItemElement } from "@tooark/web-components";
|
|
3
3
|
import React, { type PropsWithChildren } from "react";
|
|
4
4
|
import type { ArkDomProps } from "./dom-props.js";
|
|
5
5
|
export type ArkMenuProps = PropsWithChildren<ArkDomProps<ArkMenuStyleOptions & {
|
|
@@ -7,9 +7,9 @@ export type ArkMenuProps = PropsWithChildren<ArkDomProps<ArkMenuStyleOptions & {
|
|
|
7
7
|
htmlFor?: string;
|
|
8
8
|
/** Aberto; refletido do estado do popover. */
|
|
9
9
|
open?: boolean;
|
|
10
|
-
/** Alinhamento em
|
|
10
|
+
/** Alinhamento em relação ao gatilho. Padrão: "start". */
|
|
11
11
|
align?: ArkMenuAlign;
|
|
12
|
-
/** Lado do gatilho; vira quando
|
|
12
|
+
/** Lado do gatilho; vira quando não cabe. Padrão: "down". */
|
|
13
13
|
direction?: ArkMenuDirection;
|
|
14
14
|
"aria-label"?: string;
|
|
15
15
|
className?: string;
|
|
@@ -25,9 +25,9 @@ export declare const ArkMenu: React.ForwardRefExoticComponent<ArkMenuStyleOption
|
|
|
25
25
|
htmlFor?: string;
|
|
26
26
|
/** Aberto; refletido do estado do popover. */
|
|
27
27
|
open?: boolean;
|
|
28
|
-
/** Alinhamento em
|
|
28
|
+
/** Alinhamento em relação ao gatilho. Padrão: "start". */
|
|
29
29
|
align?: ArkMenuAlign;
|
|
30
|
-
/** Lado do gatilho; vira quando
|
|
30
|
+
/** Lado do gatilho; vira quando não cabe. Padrão: "down". */
|
|
31
31
|
direction?: ArkMenuDirection;
|
|
32
32
|
"aria-label"?: string;
|
|
33
33
|
className?: string;
|
|
@@ -37,30 +37,42 @@ export declare const ArkMenu: React.ForwardRefExoticComponent<ArkMenuStyleOption
|
|
|
37
37
|
}>) => void;
|
|
38
38
|
onOpen?: (event: CustomEvent) => void;
|
|
39
39
|
onClose?: (event: CustomEvent) => void;
|
|
40
|
-
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "aria-label" | "onSelect" | "open" | "onOpen" | "onClose" | "htmlFor" | keyof ArkMenuStyleOptions | "
|
|
40
|
+
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "aria-label" | "onSelect" | "open" | "onOpen" | "onClose" | "htmlFor" | "align" | keyof ArkMenuStyleOptions | "direction"> & {
|
|
41
41
|
children?: React.ReactNode | undefined;
|
|
42
42
|
} & React.RefAttributes<ArkMenuElement>>;
|
|
43
43
|
export type ArkMenuItemProps = PropsWithChildren<ArkDomProps<ArkMenuItemStyleOptions & {
|
|
44
44
|
value?: string;
|
|
45
45
|
disabled?: boolean;
|
|
46
|
-
/** Item checkbox: true marcado, false desmarcado; omitido
|
|
46
|
+
/** Item checkbox: true marcado, false desmarcado; omitido é um item comum. */
|
|
47
47
|
checked?: boolean;
|
|
48
48
|
/** Linha separadora (role separator). */
|
|
49
49
|
divider?: boolean;
|
|
50
|
-
/**
|
|
50
|
+
/** Conteúdo não interativo (nome e e-mail), sem role de item. */
|
|
51
51
|
static?: boolean;
|
|
52
52
|
className?: string;
|
|
53
53
|
}>>;
|
|
54
54
|
export declare const ArkMenuItem: React.ForwardRefExoticComponent<ArkMenuItemStyleOptions & {
|
|
55
55
|
value?: string;
|
|
56
56
|
disabled?: boolean;
|
|
57
|
-
/** Item checkbox: true marcado, false desmarcado; omitido
|
|
57
|
+
/** Item checkbox: true marcado, false desmarcado; omitido é um item comum. */
|
|
58
58
|
checked?: boolean;
|
|
59
59
|
/** Linha separadora (role separator). */
|
|
60
60
|
divider?: boolean;
|
|
61
|
-
/**
|
|
61
|
+
/** Conteúdo não interativo (nome e e-mail), sem role de item. */
|
|
62
62
|
static?: boolean;
|
|
63
63
|
className?: string;
|
|
64
64
|
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "disabled" | "value" | "checked" | keyof ArkMenuItemStyleOptions | "divider" | "static"> & {
|
|
65
65
|
children?: React.ReactNode | undefined;
|
|
66
66
|
} & React.RefAttributes<ArkMenuItemElement>>;
|
|
67
|
+
export type ArkMenuGroupProps = PropsWithChildren<ArkDomProps<ArkMenuGroupStyleOptions & {
|
|
68
|
+
/** Rótulo visível do grupo, que também o nomeia (aria-labelledby). */
|
|
69
|
+
label?: string;
|
|
70
|
+
className?: string;
|
|
71
|
+
}>>;
|
|
72
|
+
export declare const ArkMenuGroup: React.ForwardRefExoticComponent<ArkMenuGroupStyleOptions & {
|
|
73
|
+
/** Rótulo visível do grupo, que também o nomeia (aria-labelledby). */
|
|
74
|
+
label?: string;
|
|
75
|
+
className?: string;
|
|
76
|
+
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "testid" | "label"> & {
|
|
77
|
+
children?: React.ReactNode | undefined;
|
|
78
|
+
} & React.RefAttributes<ArkMenuGroupElement>>;
|