@tooark/react 1.6.1 → 1.8.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 +7 -7
- package/dist/ark-alert.js +2 -1
- package/dist/ark-avatar.d.ts +3 -3
- package/dist/ark-avatar.js +2 -1
- package/dist/ark-badge.d.ts +1 -1
- package/dist/ark-badge.js +2 -1
- package/dist/ark-button.d.ts +11 -3
- package/dist/ark-button.js +16 -4
- package/dist/ark-calendar.d.ts +1 -1
- package/dist/ark-calendar.js +2 -1
- package/dist/ark-card.d.ts +3 -3
- package/dist/ark-card.js +6 -3
- package/dist/ark-carousel.d.ts +1 -1
- package/dist/ark-carousel.js +2 -1
- package/dist/ark-checkbox.d.ts +9 -9
- package/dist/ark-checkbox.js +2 -1
- package/dist/ark-clock.d.ts +3 -3
- package/dist/ark-clock.js +2 -1
- package/dist/ark-color-swatches.d.ts +5 -5
- package/dist/ark-color-swatches.js +2 -1
- package/dist/ark-command-palette.d.ts +21 -21
- package/dist/ark-command-palette.js +3 -2
- package/dist/ark-copy-button.d.ts +3 -3
- package/dist/ark-copy-button.js +2 -1
- package/dist/ark-data-view.d.ts +79 -0
- package/dist/ark-data-view.js +196 -0
- package/dist/ark-datepicker.d.ts +1 -1
- package/dist/ark-datepicker.js +2 -1
- package/dist/ark-dialog.d.ts +13 -13
- package/dist/ark-dialog.js +6 -4
- package/dist/ark-drawer.d.ts +13 -13
- package/dist/ark-drawer.js +6 -4
- package/dist/ark-empty.d.ts +5 -5
- package/dist/ark-empty.js +5 -3
- package/dist/ark-file-input.d.ts +10 -10
- package/dist/ark-file-input.js +2 -1
- package/dist/ark-input.d.ts +8 -4
- package/dist/ark-input.js +2 -1
- package/dist/ark-kbd.d.ts +1 -1
- package/dist/ark-kbd.js +2 -1
- package/dist/ark-kv-editor.d.ts +12 -12
- package/dist/ark-kv-editor.js +4 -3
- package/dist/ark-mark.d.ts +3 -3
- package/dist/ark-mark.js +2 -1
- package/dist/ark-menu.d.ts +24 -12
- package/dist/ark-menu.js +11 -2
- package/dist/ark-nav.d.ts +111 -0
- package/dist/ark-nav.js +80 -0
- package/dist/ark-pagination.d.ts +36 -0
- package/dist/ark-pagination.js +32 -0
- package/dist/ark-progress.d.ts +9 -9
- package/dist/ark-progress.js +2 -1
- package/dist/ark-radio.d.ts +11 -11
- package/dist/ark-radio.js +2 -1
- package/dist/ark-scheduler.d.ts +2 -2
- package/dist/ark-scheduler.js +2 -1
- package/dist/ark-select.d.ts +1 -1
- package/dist/ark-select.js +2 -1
- package/dist/ark-shape-picker.d.ts +7 -7
- package/dist/ark-shape-picker.js +2 -1
- package/dist/ark-skeleton.d.ts +3 -3
- package/dist/ark-skeleton.js +2 -1
- package/dist/ark-spinner.d.ts +3 -3
- package/dist/ark-spinner.js +2 -1
- package/dist/ark-split-pane.d.ts +5 -5
- package/dist/ark-split-pane.js +2 -1
- package/dist/ark-status-dot.d.ts +3 -3
- package/dist/ark-status-dot.js +2 -1
- package/dist/ark-switch.d.ts +7 -4
- package/dist/ark-switch.js +5 -3
- package/dist/ark-tabs.d.ts +7 -7
- package/dist/ark-tabs.js +3 -2
- package/dist/ark-textarea.d.ts +10 -10
- package/dist/ark-textarea.js +2 -1
- package/dist/ark-time.d.ts +18 -0
- package/dist/ark-time.js +23 -0
- package/dist/ark-toaster.d.ts +1 -1
- package/dist/ark-toaster.js +2 -1
- package/dist/ark-toggle.d.ts +1 -1
- package/dist/ark-toggle.js +3 -2
- package/dist/ark-tooltip.d.ts +5 -5
- package/dist/ark-tooltip.js +2 -1
- package/dist/ark-tree.d.ts +86 -0
- package/dist/ark-tree.js +56 -0
- package/dist/chart.d.ts +65 -0
- package/dist/chart.js +36 -0
- package/dist/code.d.ts +148 -0
- package/dist/code.js +78 -0
- package/dist/dom-props.d.ts +6 -0
- package/dist/dom-props.js +13 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.js +7 -2
- package/dist/jsx-intrinsics.d.ts +133 -1
- package/dist/wysiwyg.d.ts +108 -0
- package/dist/wysiwyg.js +69 -0
- package/package.json +47 -3
package/dist/ark-tabs.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createElement, forwardRef, useEffect } from "react";
|
|
2
|
+
import { domAttrs } from "./dom-props.js";
|
|
2
3
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
4
|
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
4
5
|
export const ArkTabs = forwardRef(function ArkTabs(props, forwardedRef) {
|
|
@@ -21,7 +22,7 @@ export const ArkTabs = forwardRef(function ArkTabs(props, forwardedRef) {
|
|
|
21
22
|
};
|
|
22
23
|
}, [ref, onChange, onClose]);
|
|
23
24
|
const attrs = {
|
|
24
|
-
...rest,
|
|
25
|
+
...domAttrs(rest),
|
|
25
26
|
ref: setRef,
|
|
26
27
|
class: className,
|
|
27
28
|
"locale-json": localeJson
|
|
@@ -34,7 +35,7 @@ export const ArkTab = forwardRef(function ArkTab(props, forwardedRef) {
|
|
|
34
35
|
ensureTooarkComponentsRegistered();
|
|
35
36
|
}, []);
|
|
36
37
|
const attrs = {
|
|
37
|
-
...rest,
|
|
38
|
+
...domAttrs(rest),
|
|
38
39
|
ref: forwardedRef,
|
|
39
40
|
class: className,
|
|
40
41
|
disabled: disabled ? "" : undefined,
|
package/dist/ark-textarea.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { ArkTextareaResize, ArkTextareaStyleOptions } from "@tooark/core";
|
|
2
2
|
import type { ArkTextarea as ArkTextareaElement } from "@tooark/web-components";
|
|
3
3
|
import React, { type PropsWithChildren } from "react";
|
|
4
|
-
import type
|
|
4
|
+
import { type ArkDomProps } from "./dom-props.js";
|
|
5
5
|
export type ArkTextareaProps = PropsWithChildren<ArkDomProps<ArkTextareaStyleOptions & {
|
|
6
6
|
label?: string;
|
|
7
7
|
placeholder?: string;
|
|
8
8
|
value?: string;
|
|
9
9
|
name?: string;
|
|
10
|
-
/** Linhas
|
|
10
|
+
/** Linhas visíveis iniciais. Padrão: 3. */
|
|
11
11
|
rows?: number;
|
|
12
|
-
/** Cresce com o
|
|
12
|
+
/** Cresce com o conteúdo (field-sizing nativo, fallback por JS). */
|
|
13
13
|
autosize?: boolean;
|
|
14
|
-
/** Fonte
|
|
14
|
+
/** Fonte monoespaçada, para código e dados. */
|
|
15
15
|
monospace?: boolean;
|
|
16
|
-
/**
|
|
16
|
+
/** Direções de redimensionamento pelo usuário. Padrão: "vertical". */
|
|
17
17
|
resize?: ArkTextareaResize;
|
|
18
18
|
helper?: string;
|
|
19
19
|
error?: boolean;
|
|
@@ -38,13 +38,13 @@ export declare const ArkTextarea: React.ForwardRefExoticComponent<ArkTextareaSty
|
|
|
38
38
|
placeholder?: string;
|
|
39
39
|
value?: string;
|
|
40
40
|
name?: string;
|
|
41
|
-
/** Linhas
|
|
41
|
+
/** Linhas visíveis iniciais. Padrão: 3. */
|
|
42
42
|
rows?: number;
|
|
43
|
-
/** Cresce com o
|
|
43
|
+
/** Cresce com o conteúdo (field-sizing nativo, fallback por JS). */
|
|
44
44
|
autosize?: boolean;
|
|
45
|
-
/** Fonte
|
|
45
|
+
/** Fonte monoespaçada, para código e dados. */
|
|
46
46
|
monospace?: boolean;
|
|
47
|
-
/**
|
|
47
|
+
/** Direções de redimensionamento pelo usuário. Padrão: "vertical". */
|
|
48
48
|
resize?: ArkTextareaResize;
|
|
49
49
|
helper?: string;
|
|
50
50
|
error?: boolean;
|
|
@@ -63,6 +63,6 @@ export declare const ArkTextarea: React.ForwardRefExoticComponent<ArkTextareaSty
|
|
|
63
63
|
className?: string;
|
|
64
64
|
onInput?: (event: Event) => void;
|
|
65
65
|
onChange?: (event: Event) => void;
|
|
66
|
-
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "aria-label" | "onChange" | "onInput" | "error" | "resize" | "label" | "name" | "disabled" | "value" | "helper" | "placeholder" | "errorMessage" | "required" | "readonly" | "autocomplete" | "autofocus" | "maxlength" | "minlength" | "spellcheck" |
|
|
66
|
+
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "aria-label" | "onChange" | "onInput" | "error" | "resize" | "label" | "name" | "disabled" | "value" | "helper" | "placeholder" | "rows" | "errorMessage" | "required" | "readonly" | "autocomplete" | "autofocus" | "maxlength" | "minlength" | "spellcheck" | keyof ArkTextareaStyleOptions | "autosize" | "monospace" | "wrap"> & {
|
|
67
67
|
children?: React.ReactNode | undefined;
|
|
68
68
|
} & React.RefAttributes<ArkTextareaElement>>;
|
package/dist/ark-textarea.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createElement, forwardRef, useEffect } from "react";
|
|
2
|
+
import { domAttrs } from "./dom-props.js";
|
|
2
3
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
4
|
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
4
5
|
// Atributo do custom element: string ou ausente.
|
|
@@ -25,7 +26,7 @@ export const ArkTextarea = forwardRef(function ArkTextarea(props, forwardedRef)
|
|
|
25
26
|
};
|
|
26
27
|
}, [ref, onInput, onChange]);
|
|
27
28
|
const attrs = {
|
|
28
|
-
...rest,
|
|
29
|
+
...domAttrs(rest),
|
|
29
30
|
ref: setRef,
|
|
30
31
|
class: className,
|
|
31
32
|
rows: attr(rows),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ArkTimeFormat, ArkTimeStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkTime as ArkTimeElement } from "@tooark/web-components";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
import { type ArkDomProps } from "./dom-props.js";
|
|
5
|
+
export type ArkTimeProps = ArkDomProps<ArkTimeStyleOptions & {
|
|
6
|
+
/** Instante: ISO com ou sem fuso, só a data (`YYYY-MM-DD`), um `Date` ou ms. */
|
|
7
|
+
datetime?: string | number | Date;
|
|
8
|
+
/** relative ("há 3 minutos"), date, time ou datetime. Padrão: "relative". */
|
|
9
|
+
format?: ArkTimeFormat;
|
|
10
|
+
className?: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const ArkTime: React.ForwardRefExoticComponent<ArkTimeStyleOptions & {
|
|
13
|
+
/** Instante: ISO com ou sem fuso, só a data (`YYYY-MM-DD`), um `Date` ou ms. */
|
|
14
|
+
datetime?: string | number | Date;
|
|
15
|
+
/** relative ("há 3 minutos"), date, time ou datetime. Padrão: "relative". */
|
|
16
|
+
format?: ArkTimeFormat;
|
|
17
|
+
className?: string;
|
|
18
|
+
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "format" | "datetime" | keyof ArkTimeStyleOptions> & React.RefAttributes<ArkTimeElement>>;
|
package/dist/ark-time.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createElement, forwardRef, useEffect } from "react";
|
|
2
|
+
import { domAttrs } from "./dom-props.js";
|
|
3
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
4
|
+
/** `Date` e número viram ISO: o atributo é texto. */
|
|
5
|
+
function isoOf(value) {
|
|
6
|
+
if (value === undefined || typeof value === "string")
|
|
7
|
+
return value || undefined;
|
|
8
|
+
const date = new Date(value);
|
|
9
|
+
return Number.isNaN(date.getTime()) ? undefined : date.toISOString();
|
|
10
|
+
}
|
|
11
|
+
export const ArkTime = forwardRef(function ArkTime(props, forwardedRef) {
|
|
12
|
+
const { className, datetime, ...rest } = props;
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
ensureTooarkComponentsRegistered();
|
|
15
|
+
}, []);
|
|
16
|
+
const attrs = {
|
|
17
|
+
...domAttrs(rest),
|
|
18
|
+
ref: forwardedRef,
|
|
19
|
+
class: className,
|
|
20
|
+
datetime: isoOf(datetime)
|
|
21
|
+
};
|
|
22
|
+
return createElement("ark-time", attrs);
|
|
23
|
+
});
|
package/dist/ark-toaster.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ArkToasterStyleOptions } from "@tooark/core";
|
|
2
2
|
import type { ArkToaster as ArkToasterElement } from "@tooark/web-components";
|
|
3
3
|
import type React from "react";
|
|
4
|
-
import type
|
|
4
|
+
import { type ArkDomProps } from "./dom-props.js";
|
|
5
5
|
export type ArkToasterProps = ArkDomProps<ArkToasterStyleOptions & {
|
|
6
6
|
className?: string;
|
|
7
7
|
/** Botão de ação de um toast: detail traz o id do toast e o actionId das opções. */
|
package/dist/ark-toaster.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createElement, forwardRef, useEffect } from "react";
|
|
2
|
+
import { domAttrs } from "./dom-props.js";
|
|
2
3
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
4
|
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
4
5
|
export const ArkToaster = forwardRef(function ArkToaster(props, forwardedRef) {
|
|
@@ -17,7 +18,7 @@ export const ArkToaster = forwardRef(function ArkToaster(props, forwardedRef) {
|
|
|
17
18
|
}, [ref, onAction]);
|
|
18
19
|
// O rest leva theme, duration, lang, testid e o que mais vier (data-*, aria-*) ao elemento.
|
|
19
20
|
const attrs = {
|
|
20
|
-
...rest,
|
|
21
|
+
...domAttrs(rest),
|
|
21
22
|
ref: setRef,
|
|
22
23
|
position,
|
|
23
24
|
"max-visible": maxVisible,
|
package/dist/ark-toggle.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ArkToggleGroupStyleOptions, ArkToggleStyleOptions } from "@tooark/core";
|
|
2
2
|
import type { ArkToggle as ArkToggleElement, ArkToggleGroup as ArkToggleGroupElement } from "@tooark/web-components";
|
|
3
3
|
import React, { type PropsWithChildren } from "react";
|
|
4
|
-
import type
|
|
4
|
+
import { type ArkDomProps } from "./dom-props.js";
|
|
5
5
|
export type ArkToggleProps = PropsWithChildren<ArkDomProps<ArkToggleStyleOptions & {
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
className?: string;
|
package/dist/ark-toggle.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createElement, forwardRef, useEffect } from "react";
|
|
2
|
+
import { domAttrs } from "./dom-props.js";
|
|
2
3
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
4
|
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
4
5
|
export const ArkToggle = forwardRef(function ArkToggle(props, forwardedRef) {
|
|
@@ -16,7 +17,7 @@ export const ArkToggle = forwardRef(function ArkToggle(props, forwardedRef) {
|
|
|
16
17
|
return () => el.removeEventListener("change", handler);
|
|
17
18
|
}, [ref, onChange]);
|
|
18
19
|
const attrs = {
|
|
19
|
-
...rest,
|
|
20
|
+
...domAttrs(rest),
|
|
20
21
|
ref: setRef,
|
|
21
22
|
class: className,
|
|
22
23
|
pressed: pressed ? "" : undefined,
|
|
@@ -39,7 +40,7 @@ export const ArkToggleGroup = forwardRef(function ArkToggleGroup(props, forwarde
|
|
|
39
40
|
return () => el.removeEventListener("change", handler);
|
|
40
41
|
}, [ref, onChange]);
|
|
41
42
|
const attrs = {
|
|
42
|
-
...rest,
|
|
43
|
+
...domAttrs(rest),
|
|
43
44
|
ref: setRef,
|
|
44
45
|
class: className,
|
|
45
46
|
multiple: multiple ? "" : undefined,
|
package/dist/ark-tooltip.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { ArkTooltipStyleOptions } from "@tooark/core";
|
|
2
2
|
import type { ArkTooltip as ArkTooltipElement } from "@tooark/web-components";
|
|
3
3
|
import React, { type PropsWithChildren } from "react";
|
|
4
|
-
import type
|
|
4
|
+
import { type ArkDomProps } from "./dom-props.js";
|
|
5
5
|
export type ArkTooltipProps = PropsWithChildren<ArkDomProps<ArkTooltipStyleOptions & {
|
|
6
|
-
/** Texto do
|
|
6
|
+
/** Texto do balão; para conteúdo rico, passe um filho com slot="content". */
|
|
7
7
|
content?: string;
|
|
8
|
-
/** Aberto; refletido do estado do
|
|
8
|
+
/** Aberto; refletido do estado do balão. */
|
|
9
9
|
open?: boolean;
|
|
10
10
|
className?: string;
|
|
11
11
|
}>>;
|
|
12
12
|
export declare const ArkTooltip: React.ForwardRefExoticComponent<ArkTooltipStyleOptions & {
|
|
13
|
-
/** Texto do
|
|
13
|
+
/** Texto do balão; para conteúdo rico, passe um filho com slot="content". */
|
|
14
14
|
content?: string;
|
|
15
|
-
/** Aberto; refletido do estado do
|
|
15
|
+
/** Aberto; refletido do estado do balão. */
|
|
16
16
|
open?: boolean;
|
|
17
17
|
className?: string;
|
|
18
18
|
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "content" | "open" | keyof ArkTooltipStyleOptions> & {
|
package/dist/ark-tooltip.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createElement, forwardRef, useEffect } from "react";
|
|
2
|
+
import { domAttrs } from "./dom-props.js";
|
|
2
3
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
4
|
export const ArkTooltip = forwardRef(function ArkTooltip(props, forwardedRef) {
|
|
4
5
|
const { children, className, open, delay, ...rest } = props;
|
|
@@ -6,7 +7,7 @@ export const ArkTooltip = forwardRef(function ArkTooltip(props, forwardedRef) {
|
|
|
6
7
|
ensureTooarkComponentsRegistered();
|
|
7
8
|
}, []);
|
|
8
9
|
const attrs = {
|
|
9
|
-
...rest,
|
|
10
|
+
...domAttrs(rest),
|
|
10
11
|
ref: forwardedRef,
|
|
11
12
|
class: className,
|
|
12
13
|
open: open ? "" : undefined,
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { ArkTreeItemStyleOptions, ArkTreeSelection, ArkTreeStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkTree as ArkTreeElement, ArkTreeItem as ArkTreeItemElement } from "@tooark/web-components";
|
|
3
|
+
import React, { type PropsWithChildren } from "react";
|
|
4
|
+
import { type ArkDomProps } from "./dom-props.js";
|
|
5
|
+
/** `detail` do `ark-toggle`: o item expandido ou recolhido. */
|
|
6
|
+
export type ArkTreeToggleDetail = {
|
|
7
|
+
value: string;
|
|
8
|
+
expanded: boolean;
|
|
9
|
+
item: ArkTreeItemElement;
|
|
10
|
+
};
|
|
11
|
+
/** `detail` do `ark-selection-change`: os valores escolhidos (`value` em `single`). */
|
|
12
|
+
export type ArkTreeSelectionDetail = {
|
|
13
|
+
values: string[];
|
|
14
|
+
value?: string | null;
|
|
15
|
+
};
|
|
16
|
+
/** `detail` do `ark-activate`: o item ativado (Enter ou clique na linha). */
|
|
17
|
+
export type ArkTreeActivateDetail = {
|
|
18
|
+
value: string;
|
|
19
|
+
item: ArkTreeItemElement;
|
|
20
|
+
};
|
|
21
|
+
export type ArkTreeProps = PropsWithChildren<ArkDomProps<ArkTreeStyleOptions & {
|
|
22
|
+
/** none (só navega, expande e ativa), single ou multiple. Padrão: "none". */
|
|
23
|
+
selection?: ArkTreeSelection;
|
|
24
|
+
/** Com `multiple`: uma caixa por nó. */
|
|
25
|
+
checkboxes?: boolean;
|
|
26
|
+
/** Com `checkboxes`: marcar um pai marca os descendentes, e o pai fica mixed com parte marcada. */
|
|
27
|
+
propagate?: boolean;
|
|
28
|
+
/** Valores selecionados: um em `single`, a lista em `multiple`. */
|
|
29
|
+
value?: string | string[];
|
|
30
|
+
/** Nome da árvore (vira `aria-label`). */
|
|
31
|
+
label?: string;
|
|
32
|
+
className?: string;
|
|
33
|
+
onToggle?: (event: CustomEvent<ArkTreeToggleDetail>) => void;
|
|
34
|
+
onSelectionChange?: (event: CustomEvent<ArkTreeSelectionDetail>) => void;
|
|
35
|
+
onActivate?: (event: CustomEvent<ArkTreeActivateDetail>) => void;
|
|
36
|
+
}>>;
|
|
37
|
+
export declare const ArkTree: React.ForwardRefExoticComponent<ArkTreeStyleOptions & {
|
|
38
|
+
/** none (só navega, expande e ativa), single ou multiple. Padrão: "none". */
|
|
39
|
+
selection?: ArkTreeSelection;
|
|
40
|
+
/** Com `multiple`: uma caixa por nó. */
|
|
41
|
+
checkboxes?: boolean;
|
|
42
|
+
/** Com `checkboxes`: marcar um pai marca os descendentes, e o pai fica mixed com parte marcada. */
|
|
43
|
+
propagate?: boolean;
|
|
44
|
+
/** Valores selecionados: um em `single`, a lista em `multiple`. */
|
|
45
|
+
value?: string | string[];
|
|
46
|
+
/** Nome da árvore (vira `aria-label`). */
|
|
47
|
+
label?: string;
|
|
48
|
+
className?: string;
|
|
49
|
+
onToggle?: (event: CustomEvent<ArkTreeToggleDetail>) => void;
|
|
50
|
+
onSelectionChange?: (event: CustomEvent<ArkTreeSelectionDetail>) => void;
|
|
51
|
+
onActivate?: (event: CustomEvent<ArkTreeActivateDetail>) => void;
|
|
52
|
+
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "onToggle" | "label" | "value" | "onSelectionChange" | keyof ArkTreeStyleOptions | "selection" | "checkboxes" | "propagate" | "onActivate"> & {
|
|
53
|
+
children?: React.ReactNode | undefined;
|
|
54
|
+
} & React.RefAttributes<ArkTreeElement>>;
|
|
55
|
+
export type ArkTreeItemProps = PropsWithChildren<ArkDomProps<ArkTreeItemStyleOptions & {
|
|
56
|
+
value?: string;
|
|
57
|
+
/** Texto do nó (também usado na busca por digitação). */
|
|
58
|
+
label?: string;
|
|
59
|
+
expanded?: boolean;
|
|
60
|
+
/** Mostra o chevron sem filhos: carregue os filhos no `onToggle` com `expanded: true`. */
|
|
61
|
+
lazy?: boolean;
|
|
62
|
+
/** Spinner no lugar do chevron enquanto os filhos carregam. */
|
|
63
|
+
loading?: boolean;
|
|
64
|
+
selected?: boolean;
|
|
65
|
+
/** Caixa com `checkboxes`: true, false ou "mixed". */
|
|
66
|
+
checked?: boolean | "mixed";
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
className?: string;
|
|
69
|
+
}>>;
|
|
70
|
+
export declare const ArkTreeItem: React.ForwardRefExoticComponent<ArkTreeItemStyleOptions & {
|
|
71
|
+
value?: string;
|
|
72
|
+
/** Texto do nó (também usado na busca por digitação). */
|
|
73
|
+
label?: string;
|
|
74
|
+
expanded?: boolean;
|
|
75
|
+
/** Mostra o chevron sem filhos: carregue os filhos no `onToggle` com `expanded: true`. */
|
|
76
|
+
lazy?: boolean;
|
|
77
|
+
/** Spinner no lugar do chevron enquanto os filhos carregam. */
|
|
78
|
+
loading?: boolean;
|
|
79
|
+
selected?: boolean;
|
|
80
|
+
/** Caixa com `checkboxes`: true, false ou "mixed". */
|
|
81
|
+
checked?: boolean | "mixed";
|
|
82
|
+
disabled?: boolean;
|
|
83
|
+
className?: string;
|
|
84
|
+
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "label" | "loading" | "disabled" | "value" | "checked" | "selected" | keyof ArkTreeItemStyleOptions | "expanded" | "lazy"> & {
|
|
85
|
+
children?: React.ReactNode | undefined;
|
|
86
|
+
} & React.RefAttributes<ArkTreeItemElement>>;
|
package/dist/ark-tree.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createElement, forwardRef, useEffect } from "react";
|
|
2
|
+
import { domAttrs } from "./dom-props.js";
|
|
3
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
4
|
+
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
5
|
+
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
6
|
+
export const ArkTree = forwardRef(function ArkTree(props, forwardedRef) {
|
|
7
|
+
const { children, className, checkboxes, propagate, value, iconColor, onToggle, onSelectionChange, onActivate, ...rest } = props;
|
|
8
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
ensureTooarkComponentsRegistered();
|
|
11
|
+
}, []);
|
|
12
|
+
useIsomorphicLayoutEffect(() => {
|
|
13
|
+
const el = ref.current;
|
|
14
|
+
if (!el)
|
|
15
|
+
return;
|
|
16
|
+
const handleToggle = (event) => onToggle?.(event);
|
|
17
|
+
const handleSelection = (event) => onSelectionChange?.(event);
|
|
18
|
+
const handleActivate = (event) => onActivate?.(event);
|
|
19
|
+
el.addEventListener("ark-toggle", handleToggle);
|
|
20
|
+
el.addEventListener("ark-selection-change", handleSelection);
|
|
21
|
+
el.addEventListener("ark-activate", handleActivate);
|
|
22
|
+
return () => {
|
|
23
|
+
el.removeEventListener("ark-toggle", handleToggle);
|
|
24
|
+
el.removeEventListener("ark-selection-change", handleSelection);
|
|
25
|
+
el.removeEventListener("ark-activate", handleActivate);
|
|
26
|
+
};
|
|
27
|
+
}, [ref, onToggle, onSelectionChange, onActivate]);
|
|
28
|
+
const attrs = {
|
|
29
|
+
...domAttrs(rest),
|
|
30
|
+
ref: setRef,
|
|
31
|
+
class: className,
|
|
32
|
+
checkboxes: checkboxes ? "" : undefined,
|
|
33
|
+
propagate: propagate ? "" : undefined,
|
|
34
|
+
"icon-color": iconColor || undefined,
|
|
35
|
+
value: Array.isArray(value) ? (value.length ? JSON.stringify(value) : undefined) : value || undefined
|
|
36
|
+
};
|
|
37
|
+
return createElement("ark-tree", attrs, children);
|
|
38
|
+
});
|
|
39
|
+
export const ArkTreeItem = forwardRef(function ArkTreeItem(props, forwardedRef) {
|
|
40
|
+
const { children, className, expanded, lazy, loading, selected, checked, disabled, ...rest } = props;
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
ensureTooarkComponentsRegistered();
|
|
43
|
+
}, []);
|
|
44
|
+
const attrs = {
|
|
45
|
+
...domAttrs(rest),
|
|
46
|
+
ref: forwardedRef,
|
|
47
|
+
class: className,
|
|
48
|
+
expanded: expanded ? "" : undefined,
|
|
49
|
+
lazy: lazy ? "" : undefined,
|
|
50
|
+
loading: loading ? "" : undefined,
|
|
51
|
+
selected: selected ? "" : undefined,
|
|
52
|
+
checked: checked === "mixed" ? "mixed" : checked ? "" : undefined,
|
|
53
|
+
disabled: disabled ? "" : undefined
|
|
54
|
+
};
|
|
55
|
+
return createElement("ark-tree-item", attrs, children);
|
|
56
|
+
});
|
package/dist/chart.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type ArkChart as ArkChartElement, type EChartsOption } from "@tooark/chart";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import { type ArkDomProps } from "./dom-props.js";
|
|
4
|
+
/** Atributos da tag `ark-chart`, os mesmos da entrada principal, mais as propriedades JS. */
|
|
5
|
+
type ArkChartTagProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
|
|
6
|
+
testid?: string;
|
|
7
|
+
theme?: "auto" | "light" | "dark";
|
|
8
|
+
palette?: "default" | "tokens";
|
|
9
|
+
renderer?: "canvas" | "svg";
|
|
10
|
+
height?: string;
|
|
11
|
+
"auto-resize"?: boolean | "false";
|
|
12
|
+
/** Opções nativas do ECharts (propriedade JS; o React 19 a atribui como propriedade). */
|
|
13
|
+
option?: EChartsOption | null;
|
|
14
|
+
};
|
|
15
|
+
declare module "react" {
|
|
16
|
+
namespace JSX {
|
|
17
|
+
interface IntrinsicElements {
|
|
18
|
+
"ark-chart": ArkChartTagProps;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
declare global {
|
|
23
|
+
namespace JSX {
|
|
24
|
+
interface IntrinsicElements {
|
|
25
|
+
"ark-chart": ArkChartTagProps;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export type ArkChartProps = ArkDomProps<{
|
|
30
|
+
/** Opções nativas do ECharts; trocar a referência re-renderiza o gráfico (`notMerge`). */
|
|
31
|
+
option?: EChartsOption | null;
|
|
32
|
+
/** auto (segue o color-scheme da página), light ou dark. Padrão: "auto". */
|
|
33
|
+
theme?: "auto" | "light" | "dark";
|
|
34
|
+
/** default (paleta do ECharts) ou tokens (cores dos tokens `--ark-color-*`, @tooark/chart 1.7+). Padrão: "default". */
|
|
35
|
+
palette?: "default" | "tokens";
|
|
36
|
+
/** Padrão: "canvas". */
|
|
37
|
+
renderer?: "canvas" | "svg";
|
|
38
|
+
/** Altura do gráfico (comprimento CSS). Padrão: "320px". */
|
|
39
|
+
height?: string;
|
|
40
|
+
/** Redimensiona junto com o contêiner. Padrão: true. */
|
|
41
|
+
autoResize?: boolean;
|
|
42
|
+
testid?: string;
|
|
43
|
+
className?: string;
|
|
44
|
+
/** Clique numa série, com os params nativos do ECharts em `detail`. */
|
|
45
|
+
onChartClick?: (event: CustomEvent) => void;
|
|
46
|
+
}>;
|
|
47
|
+
export declare const ArkChart: React.ForwardRefExoticComponent<{
|
|
48
|
+
/** Opções nativas do ECharts; trocar a referência re-renderiza o gráfico (`notMerge`). */
|
|
49
|
+
option?: EChartsOption | null;
|
|
50
|
+
/** auto (segue o color-scheme da página), light ou dark. Padrão: "auto". */
|
|
51
|
+
theme?: "auto" | "light" | "dark";
|
|
52
|
+
/** default (paleta do ECharts) ou tokens (cores dos tokens `--ark-color-*`, @tooark/chart 1.7+). Padrão: "default". */
|
|
53
|
+
palette?: "default" | "tokens";
|
|
54
|
+
/** Padrão: "canvas". */
|
|
55
|
+
renderer?: "canvas" | "svg";
|
|
56
|
+
/** Altura do gráfico (comprimento CSS). Padrão: "320px". */
|
|
57
|
+
height?: string;
|
|
58
|
+
/** Redimensiona junto com o contêiner. Padrão: true. */
|
|
59
|
+
autoResize?: boolean;
|
|
60
|
+
testid?: string;
|
|
61
|
+
className?: string;
|
|
62
|
+
/** Clique numa série, com os params nativos do ECharts em `detail`. */
|
|
63
|
+
onChartClick?: (event: CustomEvent) => void;
|
|
64
|
+
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "testid" | "theme" | "option" | "height" | "palette" | "renderer" | "autoResize" | "onChartClick"> & React.RefAttributes<ArkChartElement>>;
|
|
65
|
+
export {};
|
package/dist/chart.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Entry point @tooark/react/chart: o wrapper do ark-chart, fora da entrada principal para que o ECharts (peer do
|
|
2
|
+
// @tooark/chart) só entre no app que importa este caminho. Também tipa a tag crua <ark-chart> com as propriedades JS.
|
|
3
|
+
import { registerTooarkChart } from "@tooark/chart";
|
|
4
|
+
import { createElement, forwardRef, useEffect } from "react";
|
|
5
|
+
import { domAttrs } from "./dom-props.js";
|
|
6
|
+
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
7
|
+
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
8
|
+
export const ArkChart = forwardRef(function ArkChart(props, forwardedRef) {
|
|
9
|
+
const { className, option, autoResize, onChartClick, ...rest } = props;
|
|
10
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
registerTooarkChart();
|
|
13
|
+
}, []);
|
|
14
|
+
// Pela propriedade, como no React 18 (que gravaria o objeto como texto no atributo), e só quando a referência
|
|
15
|
+
// muda: cada atribuição re-renderiza o gráfico com notMerge.
|
|
16
|
+
useIsomorphicLayoutEffect(() => {
|
|
17
|
+
const el = ref.current;
|
|
18
|
+
if (el && el.option !== (option ?? null))
|
|
19
|
+
el.option = option ?? null;
|
|
20
|
+
}, [ref, option]);
|
|
21
|
+
useIsomorphicLayoutEffect(() => {
|
|
22
|
+
const el = ref.current;
|
|
23
|
+
if (!el || !onChartClick)
|
|
24
|
+
return;
|
|
25
|
+
const handle = (event) => onChartClick(event);
|
|
26
|
+
el.addEventListener("ark-chart-click", handle);
|
|
27
|
+
return () => el.removeEventListener("ark-chart-click", handle);
|
|
28
|
+
}, [ref, onChartClick]);
|
|
29
|
+
const attrs = {
|
|
30
|
+
...domAttrs(rest),
|
|
31
|
+
ref: setRef,
|
|
32
|
+
class: className,
|
|
33
|
+
"auto-resize": autoResize === false ? "false" : undefined
|
|
34
|
+
};
|
|
35
|
+
return createElement("ark-chart", attrs);
|
|
36
|
+
});
|
package/dist/code.d.ts
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { type ArkCodeCompletion, type ArkCodeCompletionSource, type ArkCodeEditor as ArkCodeEditorElement, type ArkCodeExtension, type ArkCodeFormatter, type ArkCodeIndentStyle, type ArkCodeLanguage, type ArkCodeLineEnding, type ArkCodeVariable } from "@tooark/code";
|
|
2
|
+
import type { ArkSize } from "@tooark/core";
|
|
3
|
+
import type React from "react";
|
|
4
|
+
import { type ArkDomProps } from "./dom-props.js";
|
|
5
|
+
/** Atributos da tag `ark-code-editor`, os mesmos da entrada principal, mais as propriedades JS. */
|
|
6
|
+
type ArkCodeEditorTagProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
|
|
7
|
+
testid?: string;
|
|
8
|
+
theme?: "auto" | "light" | "dark";
|
|
9
|
+
language?: "json" | "javascript" | "yaml" | "text";
|
|
10
|
+
readonly?: boolean;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
"min-height"?: string;
|
|
13
|
+
"max-height"?: string;
|
|
14
|
+
"line-numbers"?: boolean | "false";
|
|
15
|
+
fold?: boolean | "false";
|
|
16
|
+
wrap?: boolean;
|
|
17
|
+
"indent-style"?: "space" | "tab";
|
|
18
|
+
"indent-size"?: number;
|
|
19
|
+
"line-ending"?: "auto" | "lf" | "crlf";
|
|
20
|
+
"tab-indent"?: boolean | "false";
|
|
21
|
+
autocomplete?: boolean | "false";
|
|
22
|
+
"mark-unknown-variables"?: boolean;
|
|
23
|
+
"single-line"?: boolean;
|
|
24
|
+
size?: ArkSize;
|
|
25
|
+
/** Texto do editor (propriedade JS). */
|
|
26
|
+
value?: string;
|
|
27
|
+
variableKeys?: string[];
|
|
28
|
+
variables?: ArkCodeVariable[];
|
|
29
|
+
completions?: ArkCodeCompletion[];
|
|
30
|
+
completionSource?: ArkCodeCompletionSource;
|
|
31
|
+
formatter?: ArkCodeFormatter;
|
|
32
|
+
extensions?: ArkCodeExtension;
|
|
33
|
+
};
|
|
34
|
+
declare module "react" {
|
|
35
|
+
namespace JSX {
|
|
36
|
+
interface IntrinsicElements {
|
|
37
|
+
"ark-code-editor": ArkCodeEditorTagProps;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
declare global {
|
|
42
|
+
namespace JSX {
|
|
43
|
+
interface IntrinsicElements {
|
|
44
|
+
"ark-code-editor": ArkCodeEditorTagProps;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export type ArkCodeEditorProps = ArkDomProps<{
|
|
49
|
+
/** Texto do editor. Controlado: o `onChange` devolve o texto e o app o repassa; atribuir não emite `change`. */
|
|
50
|
+
value?: string;
|
|
51
|
+
/** json, javascript, yaml ou text. Padrão: "text". */
|
|
52
|
+
language?: ArkCodeLanguage;
|
|
53
|
+
/** auto (segue a página), light ou dark. Padrão: "auto". */
|
|
54
|
+
theme?: "auto" | "light" | "dark";
|
|
55
|
+
readonly?: boolean;
|
|
56
|
+
placeholder?: string;
|
|
57
|
+
/** Altura mínima (comprimento CSS). Padrão: "8rem". */
|
|
58
|
+
minHeight?: string;
|
|
59
|
+
/** Altura máxima (comprimento CSS), com rolagem interna acima dela. Padrão: sem limite. */
|
|
60
|
+
maxHeight?: string;
|
|
61
|
+
/** Numeração das linhas. Padrão: true. */
|
|
62
|
+
lineNumbers?: boolean;
|
|
63
|
+
/** Calha de dobra. Padrão: true. */
|
|
64
|
+
fold?: boolean;
|
|
65
|
+
wrap?: boolean;
|
|
66
|
+
indentStyle?: ArkCodeIndentStyle;
|
|
67
|
+
indentSize?: number;
|
|
68
|
+
lineEnding?: ArkCodeLineEnding;
|
|
69
|
+
/** Tab recua (Esc e Tab saem). Padrão: true. */
|
|
70
|
+
tabIndent?: boolean;
|
|
71
|
+
/** Completions ao digitar. Padrão: true. */
|
|
72
|
+
autocomplete?: boolean;
|
|
73
|
+
markUnknownVariables?: boolean;
|
|
74
|
+
singleLine?: boolean;
|
|
75
|
+
size?: ArkSize;
|
|
76
|
+
variableKeys?: string[];
|
|
77
|
+
variables?: ArkCodeVariable[];
|
|
78
|
+
completions?: ArkCodeCompletion[];
|
|
79
|
+
completionSource?: ArkCodeCompletionSource;
|
|
80
|
+
formatter?: ArkCodeFormatter;
|
|
81
|
+
/** Extensões do CodeMirror do app; mantenha a referência estável (useMemo), uma nova reconfigura o editor. */
|
|
82
|
+
extensions?: ArkCodeExtension;
|
|
83
|
+
testid?: string;
|
|
84
|
+
className?: string;
|
|
85
|
+
/** Cada edição do usuário, com `detail: { value }`. */
|
|
86
|
+
onChange?: (event: CustomEvent<{
|
|
87
|
+
value: string;
|
|
88
|
+
}>) => void;
|
|
89
|
+
/** Enter em `singleLine`, com `detail: { value }`. */
|
|
90
|
+
onSubmit?: (event: CustomEvent<{
|
|
91
|
+
value: string;
|
|
92
|
+
}>) => void;
|
|
93
|
+
/** `format()` falhou, com `detail: { error }`. */
|
|
94
|
+
onFormatError?: (event: CustomEvent<{
|
|
95
|
+
error: unknown;
|
|
96
|
+
}>) => void;
|
|
97
|
+
}>;
|
|
98
|
+
export declare const ArkCodeEditor: React.ForwardRefExoticComponent<{
|
|
99
|
+
/** Texto do editor. Controlado: o `onChange` devolve o texto e o app o repassa; atribuir não emite `change`. */
|
|
100
|
+
value?: string;
|
|
101
|
+
/** json, javascript, yaml ou text. Padrão: "text". */
|
|
102
|
+
language?: ArkCodeLanguage;
|
|
103
|
+
/** auto (segue a página), light ou dark. Padrão: "auto". */
|
|
104
|
+
theme?: "auto" | "light" | "dark";
|
|
105
|
+
readonly?: boolean;
|
|
106
|
+
placeholder?: string;
|
|
107
|
+
/** Altura mínima (comprimento CSS). Padrão: "8rem". */
|
|
108
|
+
minHeight?: string;
|
|
109
|
+
/** Altura máxima (comprimento CSS), com rolagem interna acima dela. Padrão: sem limite. */
|
|
110
|
+
maxHeight?: string;
|
|
111
|
+
/** Numeração das linhas. Padrão: true. */
|
|
112
|
+
lineNumbers?: boolean;
|
|
113
|
+
/** Calha de dobra. Padrão: true. */
|
|
114
|
+
fold?: boolean;
|
|
115
|
+
wrap?: boolean;
|
|
116
|
+
indentStyle?: ArkCodeIndentStyle;
|
|
117
|
+
indentSize?: number;
|
|
118
|
+
lineEnding?: ArkCodeLineEnding;
|
|
119
|
+
/** Tab recua (Esc e Tab saem). Padrão: true. */
|
|
120
|
+
tabIndent?: boolean;
|
|
121
|
+
/** Completions ao digitar. Padrão: true. */
|
|
122
|
+
autocomplete?: boolean;
|
|
123
|
+
markUnknownVariables?: boolean;
|
|
124
|
+
singleLine?: boolean;
|
|
125
|
+
size?: ArkSize;
|
|
126
|
+
variableKeys?: string[];
|
|
127
|
+
variables?: ArkCodeVariable[];
|
|
128
|
+
completions?: ArkCodeCompletion[];
|
|
129
|
+
completionSource?: ArkCodeCompletionSource;
|
|
130
|
+
formatter?: ArkCodeFormatter;
|
|
131
|
+
/** Extensões do CodeMirror do app; mantenha a referência estável (useMemo), uma nova reconfigura o editor. */
|
|
132
|
+
extensions?: ArkCodeExtension;
|
|
133
|
+
testid?: string;
|
|
134
|
+
className?: string;
|
|
135
|
+
/** Cada edição do usuário, com `detail: { value }`. */
|
|
136
|
+
onChange?: (event: CustomEvent<{
|
|
137
|
+
value: string;
|
|
138
|
+
}>) => void;
|
|
139
|
+
/** Enter em `singleLine`, com `detail: { value }`. */
|
|
140
|
+
onSubmit?: (event: CustomEvent<{
|
|
141
|
+
value: string;
|
|
142
|
+
}>) => void;
|
|
143
|
+
/** `format()` falhou, com `detail: { error }`. */
|
|
144
|
+
onFormatError?: (event: CustomEvent<{
|
|
145
|
+
error: unknown;
|
|
146
|
+
}>) => void;
|
|
147
|
+
} & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "onChange" | "onSubmit" | "testid" | "theme" | "size" | "value" | "placeholder" | "readonly" | "autocomplete" | "wrap" | "language" | "minHeight" | "maxHeight" | "lineNumbers" | "fold" | "indentStyle" | "indentSize" | "lineEnding" | "tabIndent" | "markUnknownVariables" | "singleLine" | "variableKeys" | "variables" | "completions" | "completionSource" | "formatter" | "extensions" | "onFormatError"> & React.RefAttributes<ArkCodeEditorElement>>;
|
|
148
|
+
export {};
|