@tooark/react 1.0.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 +201 -0
- package/NOTICE +12 -0
- package/README.md +163 -0
- package/README.pt-BR.md +163 -0
- package/dist/ark-alert.d.ts +12 -0
- package/dist/ark-alert.js +25 -0
- package/dist/ark-avatar.d.ts +10 -0
- package/dist/ark-avatar.js +13 -0
- package/dist/ark-badge.d.ts +6 -0
- package/dist/ark-badge.js +13 -0
- package/dist/ark-button.d.ts +9 -0
- package/dist/ark-button.js +19 -0
- package/dist/ark-calendar.d.ts +16 -0
- package/dist/ark-calendar.js +36 -0
- package/dist/ark-card.d.ts +8 -0
- package/dist/ark-card.js +13 -0
- package/dist/ark-carousel.d.ts +10 -0
- package/dist/ark-carousel.js +39 -0
- package/dist/ark-checkbox.d.ts +16 -0
- package/dist/ark-checkbox.js +26 -0
- package/dist/ark-clock.d.ts +11 -0
- package/dist/ark-clock.js +26 -0
- package/dist/ark-color-swatches.d.ts +17 -0
- package/dist/ark-color-swatches.js +25 -0
- package/dist/ark-command-palette.d.ts +40 -0
- package/dist/ark-command-palette.js +51 -0
- package/dist/ark-copy-button.d.ts +17 -0
- package/dist/ark-copy-button.js +31 -0
- package/dist/ark-datepicker.d.ts +15 -0
- package/dist/ark-datepicker.js +46 -0
- package/dist/ark-dialog.d.ts +22 -0
- package/dist/ark-dialog.js +36 -0
- package/dist/ark-drawer.d.ts +23 -0
- package/dist/ark-drawer.js +35 -0
- package/dist/ark-empty.d.ts +10 -0
- package/dist/ark-empty.js +13 -0
- package/dist/ark-file-input.d.ts +23 -0
- package/dist/ark-file-input.js +28 -0
- package/dist/ark-input.d.ts +34 -0
- package/dist/ark-input.js +46 -0
- package/dist/ark-kbd.d.ts +7 -0
- package/dist/ark-kbd.js +13 -0
- package/dist/ark-kv-editor.d.ts +30 -0
- package/dist/ark-kv-editor.js +46 -0
- package/dist/ark-mark.d.ts +8 -0
- package/dist/ark-mark.js +14 -0
- package/dist/ark-menu.d.ts +33 -0
- package/dist/ark-menu.js +48 -0
- package/dist/ark-progress.d.ts +16 -0
- package/dist/ark-progress.js +17 -0
- package/dist/ark-radio.d.ts +17 -0
- package/dist/ark-radio.js +25 -0
- package/dist/ark-scheduler.d.ts +24 -0
- package/dist/ark-scheduler.js +42 -0
- package/dist/ark-select.d.ts +20 -0
- package/dist/ark-select.js +33 -0
- package/dist/ark-shape-picker.d.ts +15 -0
- package/dist/ark-shape-picker.js +25 -0
- package/dist/ark-skeleton.d.ts +11 -0
- package/dist/ark-skeleton.js +15 -0
- package/dist/ark-spinner.d.ts +8 -0
- package/dist/ark-spinner.js +14 -0
- package/dist/ark-split-pane.d.ts +13 -0
- package/dist/ark-split-pane.js +25 -0
- package/dist/ark-status-dot.d.ts +8 -0
- package/dist/ark-status-dot.js +13 -0
- package/dist/ark-switch.d.ts +13 -0
- package/dist/ark-switch.js +29 -0
- package/dist/ark-tabs.d.ts +29 -0
- package/dist/ark-tabs.js +43 -0
- package/dist/ark-textarea.d.ts +32 -0
- package/dist/ark-textarea.js +44 -0
- package/dist/ark-toaster.d.ts +6 -0
- package/dist/ark-toaster.js +19 -0
- package/dist/ark-toggle.d.ts +20 -0
- package/dist/ark-toggle.js +48 -0
- package/dist/ark-tooltip.d.ts +10 -0
- package/dist/ark-tooltip.js +15 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +38 -0
- package/dist/jsx-intrinsics.d.ts +538 -0
- package/dist/register.d.ts +1 -0
- package/dist/register.js +8 -0
- package/package.json +71 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createElement, useEffect, useRef } from "react";
|
|
2
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
export function ArkFileInput(props) {
|
|
4
|
+
const { className, multiple, errorMessage, disabled, required, localeJson, onChange, ...rest } = props;
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
ensureTooarkComponentsRegistered();
|
|
8
|
+
}, []);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const el = ref.current;
|
|
11
|
+
if (!el || !onChange)
|
|
12
|
+
return;
|
|
13
|
+
const handler = (event) => onChange(event);
|
|
14
|
+
el.addEventListener("change", handler);
|
|
15
|
+
return () => el.removeEventListener("change", handler);
|
|
16
|
+
}, [onChange]);
|
|
17
|
+
const attrs = {
|
|
18
|
+
...rest,
|
|
19
|
+
ref,
|
|
20
|
+
class: className,
|
|
21
|
+
multiple: multiple ? "" : undefined,
|
|
22
|
+
"error-message": errorMessage,
|
|
23
|
+
disabled: disabled ? "" : undefined,
|
|
24
|
+
required: required ? "" : undefined,
|
|
25
|
+
"locale-json": localeJson
|
|
26
|
+
};
|
|
27
|
+
return createElement("ark-file-input", attrs);
|
|
28
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ArkInputStyleOptions, ArkLang } from "@tooark/core";
|
|
2
|
+
import React, { type PropsWithChildren } from "react";
|
|
3
|
+
export type ArkInputProps = PropsWithChildren<ArkInputStyleOptions & {
|
|
4
|
+
type?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
helper?: string;
|
|
10
|
+
error?: boolean;
|
|
11
|
+
errorMessage?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
readonly?: boolean;
|
|
15
|
+
/** Com type="password", botao de mostrar/ocultar na ponta direita. */
|
|
16
|
+
reveal?: boolean;
|
|
17
|
+
lang?: ArkLang;
|
|
18
|
+
localeJson?: string;
|
|
19
|
+
autocomplete?: string;
|
|
20
|
+
autofocus?: boolean;
|
|
21
|
+
inputmode?: string;
|
|
22
|
+
maxlength?: number;
|
|
23
|
+
minlength?: number;
|
|
24
|
+
pattern?: string;
|
|
25
|
+
min?: string | number;
|
|
26
|
+
max?: string | number;
|
|
27
|
+
step?: string | number;
|
|
28
|
+
spellcheck?: boolean;
|
|
29
|
+
"aria-label"?: string;
|
|
30
|
+
className?: string;
|
|
31
|
+
onInput?: (event: Event) => void;
|
|
32
|
+
onChange?: (event: Event) => void;
|
|
33
|
+
}>;
|
|
34
|
+
export declare function ArkInput(props: ArkInputProps): React.JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { createElement, useEffect } from "react";
|
|
2
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
// Atributo do custom element: string ou ausente.
|
|
4
|
+
function attr(value) {
|
|
5
|
+
return value === undefined ? undefined : String(value);
|
|
6
|
+
}
|
|
7
|
+
export function ArkInput(props) {
|
|
8
|
+
const { children, className, errorMessage, error, disabled, required, readonly, reveal, localeJson, autofocus, maxlength, minlength, min, max, step, spellcheck, onInput, onChange, ...rest } = props;
|
|
9
|
+
const ref = React.useRef(null);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
ensureTooarkComponentsRegistered();
|
|
12
|
+
}, []);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const el = ref.current;
|
|
15
|
+
if (!el)
|
|
16
|
+
return;
|
|
17
|
+
const handleInput = (event) => onInput?.(event);
|
|
18
|
+
const handleChange = (event) => onChange?.(event);
|
|
19
|
+
el.addEventListener("input", handleInput);
|
|
20
|
+
el.addEventListener("change", handleChange);
|
|
21
|
+
return () => {
|
|
22
|
+
el.removeEventListener("input", handleInput);
|
|
23
|
+
el.removeEventListener("change", handleChange);
|
|
24
|
+
};
|
|
25
|
+
}, [onInput, onChange]);
|
|
26
|
+
const attrs = {
|
|
27
|
+
...rest,
|
|
28
|
+
ref,
|
|
29
|
+
class: className,
|
|
30
|
+
"error-message": errorMessage,
|
|
31
|
+
"locale-json": localeJson,
|
|
32
|
+
error: error ? "" : undefined,
|
|
33
|
+
disabled: disabled ? "" : undefined,
|
|
34
|
+
required: required ? "" : undefined,
|
|
35
|
+
readonly: readonly ? "" : undefined,
|
|
36
|
+
reveal: reveal ? "" : undefined,
|
|
37
|
+
autofocus: autofocus ? "" : undefined,
|
|
38
|
+
maxlength: attr(maxlength),
|
|
39
|
+
minlength: attr(minlength),
|
|
40
|
+
min: attr(min),
|
|
41
|
+
max: attr(max),
|
|
42
|
+
step: attr(step),
|
|
43
|
+
spellcheck: spellcheck === undefined ? undefined : spellcheck ? "true" : "false"
|
|
44
|
+
};
|
|
45
|
+
return createElement("ark-input", attrs, children);
|
|
46
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ArkKbdStyleOptions } from "@tooark/core";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import { type PropsWithChildren } from "react";
|
|
4
|
+
export type ArkKbdProps = PropsWithChildren<ArkKbdStyleOptions & {
|
|
5
|
+
className?: string;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function ArkKbd(props: ArkKbdProps): React.JSX.Element;
|
package/dist/ark-kbd.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createElement, useEffect } from "react";
|
|
2
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
export function ArkKbd(props) {
|
|
4
|
+
const { children, className, ...rest } = props;
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
ensureTooarkComponentsRegistered();
|
|
7
|
+
}, []);
|
|
8
|
+
const attrs = {
|
|
9
|
+
...rest,
|
|
10
|
+
class: className
|
|
11
|
+
};
|
|
12
|
+
return createElement("ark-kbd", attrs, children);
|
|
13
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ArkKvEditorStyleOptions, ArkKvRow } from "@tooark/core";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export type ArkKvEditorProps = ArkKvEditorStyleOptions & {
|
|
4
|
+
/** Linhas { id, key, value, enabled }; atribuir substitui tudo e renderiza de novo. */
|
|
5
|
+
rows?: ArkKvRow[];
|
|
6
|
+
/** Modo de edicao em massa (textarea). */
|
|
7
|
+
bulk?: boolean;
|
|
8
|
+
/** Tipos de valor da coluna de tipo (string, number, date, time, datetime, email, url); vazio esconde a coluna. */
|
|
9
|
+
types?: string[];
|
|
10
|
+
/** Mostra a coluna de descricao. */
|
|
11
|
+
description?: boolean;
|
|
12
|
+
/** Mostra o cadeado por linha: fechado mascara o valor como senha, com o olho para revelar. */
|
|
13
|
+
secret?: boolean;
|
|
14
|
+
keyPlaceholder?: string;
|
|
15
|
+
valuePlaceholder?: string;
|
|
16
|
+
descriptionPlaceholder?: string;
|
|
17
|
+
readonly?: boolean;
|
|
18
|
+
className?: string;
|
|
19
|
+
/** Qualquer edicao, inclusive ao sair do modo em massa: detail.rows sao as linhas. */
|
|
20
|
+
onChange?: (event: CustomEvent<{
|
|
21
|
+
rows: ArkKvRow[];
|
|
22
|
+
}>) => void;
|
|
23
|
+
onAdd?: (event: CustomEvent<{
|
|
24
|
+
id: string;
|
|
25
|
+
}>) => void;
|
|
26
|
+
onDelete?: (event: CustomEvent<{
|
|
27
|
+
id: string;
|
|
28
|
+
}>) => void;
|
|
29
|
+
};
|
|
30
|
+
export declare function ArkKvEditor(props: ArkKvEditorProps): React.JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createElement, useEffect, useRef } from "react";
|
|
2
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
export function ArkKvEditor(props) {
|
|
4
|
+
const { className, rows, bulk, bulkFormat, types, description, secret, keyPlaceholder, valuePlaceholder, descriptionPlaceholder, readonly, localeJson, onChange, onAdd, onDelete, ...rest } = props;
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
ensureTooarkComponentsRegistered();
|
|
8
|
+
}, []);
|
|
9
|
+
// `rows` e propriedade (objetos), nao atributo.
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (ref.current && rows)
|
|
12
|
+
ref.current.rows = rows;
|
|
13
|
+
}, [rows]);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const el = ref.current;
|
|
16
|
+
if (!el)
|
|
17
|
+
return;
|
|
18
|
+
const handleChange = (event) => onChange?.(event);
|
|
19
|
+
const handleAdd = (event) => onAdd?.(event);
|
|
20
|
+
const handleDelete = (event) => onDelete?.(event);
|
|
21
|
+
el.addEventListener("change", handleChange);
|
|
22
|
+
el.addEventListener("ark-add", handleAdd);
|
|
23
|
+
el.addEventListener("ark-delete", handleDelete);
|
|
24
|
+
return () => {
|
|
25
|
+
el.removeEventListener("change", handleChange);
|
|
26
|
+
el.removeEventListener("ark-add", handleAdd);
|
|
27
|
+
el.removeEventListener("ark-delete", handleDelete);
|
|
28
|
+
};
|
|
29
|
+
}, [onChange, onAdd, onDelete]);
|
|
30
|
+
const attrs = {
|
|
31
|
+
...rest,
|
|
32
|
+
ref,
|
|
33
|
+
class: className,
|
|
34
|
+
bulk: bulk ? "" : undefined,
|
|
35
|
+
"bulk-format": bulkFormat,
|
|
36
|
+
types: types && types.length > 0 ? types.join(",") : undefined,
|
|
37
|
+
description: description ? "" : undefined,
|
|
38
|
+
secret: secret ? "" : undefined,
|
|
39
|
+
"key-placeholder": keyPlaceholder,
|
|
40
|
+
"value-placeholder": valuePlaceholder,
|
|
41
|
+
"description-placeholder": descriptionPlaceholder,
|
|
42
|
+
readonly: readonly ? "" : undefined,
|
|
43
|
+
"locale-json": localeJson
|
|
44
|
+
};
|
|
45
|
+
return createElement("ark-kv-editor", attrs);
|
|
46
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ArkMarkStyleOptions } from "@tooark/core";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export type ArkMarkProps = ArkMarkStyleOptions & {
|
|
4
|
+
/** Com rotulo a marca vira role="img" nomeado; sem ele e decorativa (aria-hidden). */
|
|
5
|
+
label?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function ArkMark(props: ArkMarkProps): React.JSX.Element;
|
package/dist/ark-mark.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createElement, useEffect } from "react";
|
|
2
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
export function ArkMark(props) {
|
|
4
|
+
const { className, size, ...rest } = props;
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
ensureTooarkComponentsRegistered();
|
|
7
|
+
}, []);
|
|
8
|
+
const attrs = {
|
|
9
|
+
...rest,
|
|
10
|
+
class: className,
|
|
11
|
+
size: size === undefined ? undefined : String(size)
|
|
12
|
+
};
|
|
13
|
+
return createElement("ark-mark", attrs);
|
|
14
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ArkMenuAlign, ArkMenuDirection, ArkMenuItemStyleOptions, ArkMenuStyleOptions } from "@tooark/core";
|
|
2
|
+
import React, { type PropsWithChildren } from "react";
|
|
3
|
+
export type ArkMenuProps = PropsWithChildren<ArkMenuStyleOptions & {
|
|
4
|
+
/** id do gatilho (vira o atributo for): o menu escreve aria-* nele e escuta clique e setas. */
|
|
5
|
+
htmlFor?: string;
|
|
6
|
+
/** Aberto; refletido do estado do popover. */
|
|
7
|
+
open?: boolean;
|
|
8
|
+
/** Alinhamento em relacao ao gatilho. Padrao: "start". */
|
|
9
|
+
align?: ArkMenuAlign;
|
|
10
|
+
/** Lado do gatilho; vira quando nao cabe. Padrao: "down". */
|
|
11
|
+
direction?: ArkMenuDirection;
|
|
12
|
+
"aria-label"?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
/** Um item foi escolhido; o menu fecha em seguida. */
|
|
15
|
+
onSelect?: (event: CustomEvent<{
|
|
16
|
+
value: string;
|
|
17
|
+
}>) => void;
|
|
18
|
+
onOpen?: (event: CustomEvent) => void;
|
|
19
|
+
onClose?: (event: CustomEvent) => void;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function ArkMenu(props: ArkMenuProps): React.JSX.Element;
|
|
22
|
+
export type ArkMenuItemProps = PropsWithChildren<ArkMenuItemStyleOptions & {
|
|
23
|
+
value?: string;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/** Item checkbox: true marcado, false desmarcado; omitido e um item comum. */
|
|
26
|
+
checked?: boolean;
|
|
27
|
+
/** Linha separadora (role separator). */
|
|
28
|
+
divider?: boolean;
|
|
29
|
+
/** Conteudo nao interativo (nome e e-mail), sem role de item. */
|
|
30
|
+
static?: boolean;
|
|
31
|
+
className?: string;
|
|
32
|
+
}>;
|
|
33
|
+
export declare function ArkMenuItem(props: ArkMenuItemProps): React.JSX.Element;
|
package/dist/ark-menu.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { createElement, useEffect } from "react";
|
|
2
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
export function ArkMenu(props) {
|
|
4
|
+
const { children, className, htmlFor, open, onSelect, onOpen, onClose, ...rest } = props;
|
|
5
|
+
const ref = React.useRef(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
ensureTooarkComponentsRegistered();
|
|
8
|
+
}, []);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const el = ref.current;
|
|
11
|
+
if (!el)
|
|
12
|
+
return;
|
|
13
|
+
const handleSelect = (event) => onSelect?.(event);
|
|
14
|
+
const handleOpen = (event) => onOpen?.(event);
|
|
15
|
+
const handleClose = (event) => onClose?.(event);
|
|
16
|
+
el.addEventListener("ark-select", handleSelect);
|
|
17
|
+
el.addEventListener("ark-open", handleOpen);
|
|
18
|
+
el.addEventListener("ark-close", handleClose);
|
|
19
|
+
return () => {
|
|
20
|
+
el.removeEventListener("ark-select", handleSelect);
|
|
21
|
+
el.removeEventListener("ark-open", handleOpen);
|
|
22
|
+
el.removeEventListener("ark-close", handleClose);
|
|
23
|
+
};
|
|
24
|
+
}, [onSelect, onOpen, onClose]);
|
|
25
|
+
const attrs = {
|
|
26
|
+
...rest,
|
|
27
|
+
ref,
|
|
28
|
+
class: className,
|
|
29
|
+
for: htmlFor,
|
|
30
|
+
open: open ? "" : undefined
|
|
31
|
+
};
|
|
32
|
+
return createElement("ark-menu", attrs, children);
|
|
33
|
+
}
|
|
34
|
+
export function ArkMenuItem(props) {
|
|
35
|
+
const { children, className, disabled, checked, divider, static: isStatic, ...rest } = props;
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
ensureTooarkComponentsRegistered();
|
|
38
|
+
}, []);
|
|
39
|
+
const attrs = {
|
|
40
|
+
...rest,
|
|
41
|
+
class: className,
|
|
42
|
+
disabled: disabled ? "" : undefined,
|
|
43
|
+
checked: checked === undefined ? undefined : checked ? "" : "false",
|
|
44
|
+
divider: divider ? "" : undefined,
|
|
45
|
+
static: isStatic ? "" : undefined
|
|
46
|
+
};
|
|
47
|
+
return createElement("ark-menu-item", attrs, children);
|
|
48
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ArkProgressStyleOptions } from "@tooark/core";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export type ArkProgressProps = ArkProgressStyleOptions & {
|
|
4
|
+
/** Valor atual, de 0 a max. Padrao: 0. */
|
|
5
|
+
value?: number;
|
|
6
|
+
/** Valor maximo. Padrao: 100. */
|
|
7
|
+
max?: number;
|
|
8
|
+
/** Segmento em loop no lugar do valor (loader continuo, isento de movimento reduzido). */
|
|
9
|
+
indeterminate?: boolean;
|
|
10
|
+
/** Nome acessivel (aria-label). */
|
|
11
|
+
label?: string;
|
|
12
|
+
/** Mostra a porcentagem ao lado do trilho. */
|
|
13
|
+
showValue?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function ArkProgress(props: ArkProgressProps): React.JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createElement, useEffect } from "react";
|
|
2
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
export function ArkProgress(props) {
|
|
4
|
+
const { className, value, max, indeterminate, showValue, ...rest } = props;
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
ensureTooarkComponentsRegistered();
|
|
7
|
+
}, []);
|
|
8
|
+
const attrs = {
|
|
9
|
+
...rest,
|
|
10
|
+
class: className,
|
|
11
|
+
value: value === undefined ? undefined : String(value),
|
|
12
|
+
max: max === undefined ? undefined : String(max),
|
|
13
|
+
indeterminate: indeterminate ? "" : undefined,
|
|
14
|
+
"show-value": showValue ? "" : undefined
|
|
15
|
+
};
|
|
16
|
+
return createElement("ark-progress", attrs);
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ArkRadioStyleOptions } from "@tooark/core";
|
|
2
|
+
import React, { type PropsWithChildren } from "react";
|
|
3
|
+
export type ArkRadioProps = PropsWithChildren<ArkRadioStyleOptions & {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
/** Nome do grupo: agrupa no formulario e para setas/roving tabindex. */
|
|
6
|
+
name?: string;
|
|
7
|
+
/** Valor submetido e publicado em `change` quando marcado. Padrao: "on". */
|
|
8
|
+
value?: string;
|
|
9
|
+
/** Rotulo proprio (<label for>); sem ele use aria-label ou filhos como rotulo livre. */
|
|
10
|
+
label?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
/** Dispara so no radio que ganhou a marca. */
|
|
13
|
+
onChange?: (event: CustomEvent<{
|
|
14
|
+
value: string;
|
|
15
|
+
}>) => void;
|
|
16
|
+
}>;
|
|
17
|
+
export declare function ArkRadio(props: ArkRadioProps): React.JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { createElement, useEffect } from "react";
|
|
2
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
export function ArkRadio(props) {
|
|
4
|
+
const { children, className, checked, disabled, onChange, ...rest } = props;
|
|
5
|
+
const ref = React.useRef(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
ensureTooarkComponentsRegistered();
|
|
8
|
+
}, []);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const el = ref.current;
|
|
11
|
+
if (!el || !onChange)
|
|
12
|
+
return;
|
|
13
|
+
const handler = (event) => onChange(event);
|
|
14
|
+
el.addEventListener("change", handler);
|
|
15
|
+
return () => el.removeEventListener("change", handler);
|
|
16
|
+
}, [onChange]);
|
|
17
|
+
const attrs = {
|
|
18
|
+
...rest,
|
|
19
|
+
ref,
|
|
20
|
+
class: className,
|
|
21
|
+
checked: checked ? "" : undefined,
|
|
22
|
+
disabled: disabled ? "" : undefined
|
|
23
|
+
};
|
|
24
|
+
return createElement("ark-radio", attrs, children);
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ArkDatepickerLang, ArkSchedulerEvent, ArkSchedulerStyleOptions } from "@tooark/core";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export type ArkSchedulerProps = ArkSchedulerStyleOptions & {
|
|
4
|
+
lang?: ArkDatepickerLang;
|
|
5
|
+
className?: string;
|
|
6
|
+
onEventClick?: (detail: {
|
|
7
|
+
event: ArkSchedulerEvent;
|
|
8
|
+
id: string | null;
|
|
9
|
+
}) => void;
|
|
10
|
+
onSlotClick?: (detail: {
|
|
11
|
+
start: string;
|
|
12
|
+
end: string;
|
|
13
|
+
allDay: boolean;
|
|
14
|
+
}) => void;
|
|
15
|
+
onViewChange?: (detail: {
|
|
16
|
+
view: string;
|
|
17
|
+
}) => void;
|
|
18
|
+
onRangeChange?: (detail: {
|
|
19
|
+
start: string;
|
|
20
|
+
end: string;
|
|
21
|
+
view: string;
|
|
22
|
+
}) => void;
|
|
23
|
+
};
|
|
24
|
+
export declare function ArkScheduler(props: ArkSchedulerProps): React.JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { createElement, useEffect } from "react";
|
|
2
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
export function ArkScheduler(props) {
|
|
4
|
+
const { className, events, hourStart, hourEnd, slotMinutes, hoursFormat, onEventClick, onSlotClick, onViewChange, onRangeChange, ...rest } = props;
|
|
5
|
+
const ref = React.useRef(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
ensureTooarkComponentsRegistered();
|
|
8
|
+
}, []);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const el = ref.current;
|
|
11
|
+
if (!el)
|
|
12
|
+
return;
|
|
13
|
+
const handlers = [];
|
|
14
|
+
function bind(name, handler) {
|
|
15
|
+
if (!handler)
|
|
16
|
+
return;
|
|
17
|
+
const listener = (event) => handler(event.detail);
|
|
18
|
+
el.addEventListener(name, listener);
|
|
19
|
+
handlers.push([name, listener]);
|
|
20
|
+
}
|
|
21
|
+
bind("ark-event-click", onEventClick);
|
|
22
|
+
bind("ark-slot-click", onSlotClick);
|
|
23
|
+
bind("ark-view-change", onViewChange);
|
|
24
|
+
bind("ark-range-change", onRangeChange);
|
|
25
|
+
return () => {
|
|
26
|
+
for (const [name, listener] of handlers) {
|
|
27
|
+
el.removeEventListener(name, listener);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}, [onEventClick, onSlotClick, onViewChange, onRangeChange]);
|
|
31
|
+
const attrs = {
|
|
32
|
+
...rest,
|
|
33
|
+
ref,
|
|
34
|
+
class: className,
|
|
35
|
+
events: events ? JSON.stringify(events) : undefined,
|
|
36
|
+
"hour-start": hourStart !== undefined ? String(hourStart) : undefined,
|
|
37
|
+
"hour-end": hourEnd !== undefined ? String(hourEnd) : undefined,
|
|
38
|
+
"slot-minutes": slotMinutes !== undefined ? String(slotMinutes) : undefined,
|
|
39
|
+
"hours-format": hoursFormat
|
|
40
|
+
};
|
|
41
|
+
return createElement("ark-scheduler", attrs);
|
|
42
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ArkSelectOption, ArkSelectStyleOptions } from "@tooark/core";
|
|
2
|
+
import React, { type PropsWithChildren } from "react";
|
|
3
|
+
export type ArkSelectProps = PropsWithChildren<ArkSelectStyleOptions & {
|
|
4
|
+
label?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
options?: ArkSelectOption[];
|
|
7
|
+
value?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
helper?: string;
|
|
10
|
+
error?: boolean;
|
|
11
|
+
errorMessage?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
onInput?: (event: Event) => void;
|
|
16
|
+
onChange?: (event: CustomEvent<{
|
|
17
|
+
value: string;
|
|
18
|
+
}>) => void;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function ArkSelect(props: ArkSelectProps): React.JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { createElement, useEffect } from "react";
|
|
2
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
export function ArkSelect(props) {
|
|
4
|
+
const { children, className, options, errorMessage, error, disabled, required, onInput, onChange, ...rest } = props;
|
|
5
|
+
const ref = React.useRef(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
ensureTooarkComponentsRegistered();
|
|
8
|
+
}, []);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const el = ref.current;
|
|
11
|
+
if (!el)
|
|
12
|
+
return;
|
|
13
|
+
const handleInput = (event) => onInput?.(event);
|
|
14
|
+
const handleChange = (event) => onChange?.(event);
|
|
15
|
+
el.addEventListener("input", handleInput);
|
|
16
|
+
el.addEventListener("change", handleChange);
|
|
17
|
+
return () => {
|
|
18
|
+
el.removeEventListener("input", handleInput);
|
|
19
|
+
el.removeEventListener("change", handleChange);
|
|
20
|
+
};
|
|
21
|
+
}, [onInput, onChange]);
|
|
22
|
+
const attrs = {
|
|
23
|
+
...rest,
|
|
24
|
+
ref,
|
|
25
|
+
class: className,
|
|
26
|
+
options: options ? JSON.stringify(options) : undefined,
|
|
27
|
+
"error-message": errorMessage,
|
|
28
|
+
error: error ? "" : undefined,
|
|
29
|
+
disabled: disabled ? "" : undefined,
|
|
30
|
+
required: required ? "" : undefined
|
|
31
|
+
};
|
|
32
|
+
return createElement("ark-select", attrs, children);
|
|
33
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ArkMarkShape, ArkShapePickerStyleOptions } from "@tooark/core";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export type ArkShapePickerProps = ArkShapePickerStyleOptions & {
|
|
4
|
+
/** Forma selecionada. */
|
|
5
|
+
value?: ArkMarkShape;
|
|
6
|
+
/** Nome acessivel do radiogroup. */
|
|
7
|
+
label?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Selecao mudou pelo usuario: detail.value e a forma. */
|
|
11
|
+
onChange?: (event: CustomEvent<{
|
|
12
|
+
value: ArkMarkShape;
|
|
13
|
+
}>) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare function ArkShapePicker(props: ArkShapePickerProps): React.JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createElement, useEffect, useRef } from "react";
|
|
2
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
export function ArkShapePicker(props) {
|
|
4
|
+
const { className, disabled, localeJson, onChange, ...rest } = props;
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
ensureTooarkComponentsRegistered();
|
|
8
|
+
}, []);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const el = ref.current;
|
|
11
|
+
if (!el || !onChange)
|
|
12
|
+
return;
|
|
13
|
+
const handler = (event) => onChange(event);
|
|
14
|
+
el.addEventListener("change", handler);
|
|
15
|
+
return () => el.removeEventListener("change", handler);
|
|
16
|
+
}, [onChange]);
|
|
17
|
+
const attrs = {
|
|
18
|
+
...rest,
|
|
19
|
+
ref,
|
|
20
|
+
class: className,
|
|
21
|
+
disabled: disabled ? "" : undefined,
|
|
22
|
+
"locale-json": localeJson
|
|
23
|
+
};
|
|
24
|
+
return createElement("ark-shape-picker", attrs);
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ArkSkeletonStyleOptions } from "@tooark/core";
|
|
2
|
+
import React, { type PropsWithChildren } from "react";
|
|
3
|
+
export type ArkSkeletonProps = PropsWithChildren<ArkSkeletonStyleOptions & {
|
|
4
|
+
/** Numero de barras; acima de 1 troca o bloco por barras em coluna. Padrao: 1. */
|
|
5
|
+
rows?: number;
|
|
6
|
+
/** Liga o brilho que varre (opt-in; para sob movimento reduzido). */
|
|
7
|
+
animated?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function ArkSkeleton(props: ArkSkeletonProps): React.JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createElement, useEffect } from "react";
|
|
2
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
export function ArkSkeleton(props) {
|
|
4
|
+
const { children, className, rows, animated, ...rest } = props;
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
ensureTooarkComponentsRegistered();
|
|
7
|
+
}, []);
|
|
8
|
+
const attrs = {
|
|
9
|
+
...rest,
|
|
10
|
+
class: className,
|
|
11
|
+
rows: rows === undefined ? undefined : String(rows),
|
|
12
|
+
animated: animated ? "" : undefined
|
|
13
|
+
};
|
|
14
|
+
return createElement("ark-skeleton", attrs, children);
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ArkSpinnerStyleOptions } from "@tooark/core";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export type ArkSpinnerProps = ArkSpinnerStyleOptions & {
|
|
4
|
+
/** Rotulo so para leitores de tela. Padrao: a string `loading` do idioma. */
|
|
5
|
+
label?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function ArkSpinner(props: ArkSpinnerProps): React.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createElement, useEffect } from "react";
|
|
2
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
export function ArkSpinner(props) {
|
|
4
|
+
const { className, localeJson, ...rest } = props;
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
ensureTooarkComponentsRegistered();
|
|
7
|
+
}, []);
|
|
8
|
+
const attrs = {
|
|
9
|
+
...rest,
|
|
10
|
+
class: className,
|
|
11
|
+
"locale-json": localeJson
|
|
12
|
+
};
|
|
13
|
+
return createElement("ark-spinner", attrs);
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ArkSplitPaneStyleOptions } from "@tooark/core";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import { type PropsWithChildren } from "react";
|
|
4
|
+
export type ArkSplitPaneProps = PropsWithChildren<ArkSplitPaneStyleOptions & {
|
|
5
|
+
/** Tamanhos dos paineis em percentuais, na ordem dos filhos (ex.: [30, 70]); faltantes sao distribuidos. */
|
|
6
|
+
sizes?: number[];
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Tamanhos mudaram por arrasto ou teclado: detail.sizes e a lista normalizada. Persistir e do app. */
|
|
9
|
+
onResize?: (event: CustomEvent<{
|
|
10
|
+
sizes: number[];
|
|
11
|
+
}>) => void;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function ArkSplitPane(props: ArkSplitPaneProps): React.JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createElement, useEffect, useRef } from "react";
|
|
2
|
+
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
export function ArkSplitPane(props) {
|
|
4
|
+
const { children, className, sizes, localeJson, onResize, ...rest } = props;
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
ensureTooarkComponentsRegistered();
|
|
8
|
+
}, []);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const el = ref.current;
|
|
11
|
+
if (!el || !onResize)
|
|
12
|
+
return;
|
|
13
|
+
const handler = (event) => onResize(event);
|
|
14
|
+
el.addEventListener("ark-resize", handler);
|
|
15
|
+
return () => el.removeEventListener("ark-resize", handler);
|
|
16
|
+
}, [onResize]);
|
|
17
|
+
const attrs = {
|
|
18
|
+
...rest,
|
|
19
|
+
ref,
|
|
20
|
+
class: className,
|
|
21
|
+
sizes: sizes ? sizes.join(",") : undefined,
|
|
22
|
+
"locale-json": localeJson
|
|
23
|
+
};
|
|
24
|
+
return createElement("ark-split-pane", attrs, children);
|
|
25
|
+
}
|