@tooark/react 1.2.2 → 1.3.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 +21 -3
- package/README.pt-BR.md +21 -3
- package/dist/ark-alert.d.ts +12 -1
- package/dist/ark-alert.js +7 -6
- package/dist/ark-avatar.d.ts +8 -1
- package/dist/ark-avatar.js +4 -3
- package/dist/ark-badge.d.ts +6 -1
- package/dist/ark-badge.js +4 -3
- package/dist/ark-button.d.ts +7 -1
- package/dist/ark-button.js +4 -3
- package/dist/ark-calendar.d.ts +15 -2
- package/dist/ark-calendar.js +7 -6
- package/dist/ark-card.d.ts +8 -1
- package/dist/ark-card.js +4 -3
- package/dist/ark-carousel.d.ts +10 -1
- package/dist/ark-carousel.js +7 -6
- package/dist/ark-checkbox.d.ts +16 -1
- package/dist/ark-checkbox.js +7 -6
- package/dist/ark-clock.d.ts +10 -2
- package/dist/ark-clock.js +7 -6
- package/dist/ark-color-swatches.d.ts +15 -1
- package/dist/ark-color-swatches.js +7 -6
- package/dist/ark-command-palette.d.ts +40 -2
- package/dist/ark-command-palette.js +9 -7
- package/dist/ark-copy-button.d.ts +16 -1
- package/dist/ark-copy-button.js +7 -6
- package/dist/ark-datepicker.d.ts +13 -1
- package/dist/ark-datepicker.js +7 -6
- package/dist/ark-dialog.d.ts +22 -1
- package/dist/ark-dialog.js +6 -5
- package/dist/ark-drawer.d.ts +22 -1
- package/dist/ark-drawer.js +6 -5
- package/dist/ark-empty.d.ts +10 -1
- package/dist/ark-empty.js +4 -3
- package/dist/ark-file-input.d.ts +23 -1
- package/dist/ark-file-input.js +7 -6
- package/dist/ark-input.d.ts +34 -1
- package/dist/ark-input.js +7 -6
- package/dist/ark-kbd.d.ts +6 -1
- package/dist/ark-kbd.js +4 -3
- package/dist/ark-kv-editor.d.ts +39 -2
- package/dist/ark-kv-editor.js +16 -8
- package/dist/ark-mark.d.ts +6 -1
- package/dist/ark-mark.js +4 -3
- package/dist/ark-menu.d.ts +34 -2
- package/dist/ark-menu.js +9 -7
- package/dist/ark-progress.d.ts +14 -1
- package/dist/ark-progress.js +4 -3
- package/dist/ark-radio.d.ts +17 -1
- package/dist/ark-radio.js +7 -6
- package/dist/ark-scheduler.d.ts +25 -2
- package/dist/ark-scheduler.js +7 -6
- package/dist/ark-select.d.ts +20 -1
- package/dist/ark-select.js +7 -6
- package/dist/ark-shape-picker.d.ts +17 -1
- package/dist/ark-shape-picker.js +9 -7
- package/dist/ark-skeleton.d.ts +11 -1
- package/dist/ark-skeleton.js +4 -3
- package/dist/ark-spinner.d.ts +6 -1
- package/dist/ark-spinner.js +4 -3
- package/dist/ark-split-pane.d.ts +12 -1
- package/dist/ark-split-pane.js +7 -6
- package/dist/ark-status-dot.d.ts +6 -1
- package/dist/ark-status-dot.js +4 -3
- package/dist/ark-switch.d.ts +12 -2
- package/dist/ark-switch.js +7 -6
- package/dist/ark-tabs.d.ts +30 -2
- package/dist/ark-tabs.js +10 -8
- package/dist/ark-textarea.d.ts +34 -1
- package/dist/ark-textarea.js +7 -6
- package/dist/ark-toaster.d.ts +9 -1
- package/dist/ark-toaster.js +7 -6
- package/dist/ark-toggle.d.ts +21 -2
- package/dist/ark-toggle.js +12 -11
- package/dist/ark-tooltip.d.ts +10 -1
- package/dist/ark-tooltip.js +4 -3
- package/dist/jsx-intrinsics.d.ts +8 -0
- package/dist/use-forwarded-ref.d.ts +3 -0
- package/dist/use-forwarded-ref.js +31 -0
- package/package.json +3 -3
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { createElement,
|
|
1
|
+
import { createElement, forwardRef, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
3
4
|
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
4
|
-
export function ArkCommandPalette(props) {
|
|
5
|
+
export const ArkCommandPalette = forwardRef(function ArkCommandPalette(props, forwardedRef) {
|
|
5
6
|
const { children, className, open, filter, queryDelay, noScrollLock, localeJson, onSelect, onQuery, onOpen, onClose, ...rest } = props;
|
|
6
|
-
const ref =
|
|
7
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
7
8
|
useEffect(() => {
|
|
8
9
|
ensureTooarkComponentsRegistered();
|
|
9
10
|
}, []);
|
|
@@ -28,7 +29,7 @@ export function ArkCommandPalette(props) {
|
|
|
28
29
|
}, [onSelect, onQuery, onOpen, onClose]);
|
|
29
30
|
const attrs = {
|
|
30
31
|
...rest,
|
|
31
|
-
ref,
|
|
32
|
+
ref: setRef,
|
|
32
33
|
class: className,
|
|
33
34
|
open: open ? "" : undefined,
|
|
34
35
|
filter: filter ? "" : undefined,
|
|
@@ -37,16 +38,17 @@ export function ArkCommandPalette(props) {
|
|
|
37
38
|
"locale-json": localeJson
|
|
38
39
|
};
|
|
39
40
|
return createElement("ark-command-palette", attrs, children);
|
|
40
|
-
}
|
|
41
|
-
export function ArkCommandItem(props) {
|
|
41
|
+
});
|
|
42
|
+
export const ArkCommandItem = forwardRef(function ArkCommandItem(props, forwardedRef) {
|
|
42
43
|
const { children, className, disabled, ...rest } = props;
|
|
43
44
|
useEffect(() => {
|
|
44
45
|
ensureTooarkComponentsRegistered();
|
|
45
46
|
}, []);
|
|
46
47
|
const attrs = {
|
|
47
48
|
...rest,
|
|
49
|
+
ref: forwardedRef,
|
|
48
50
|
class: className,
|
|
49
51
|
disabled: disabled ? "" : undefined
|
|
50
52
|
};
|
|
51
53
|
return createElement("ark-command-item", attrs, children);
|
|
52
|
-
}
|
|
54
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArkCopyButtonStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkCopyButton as ArkCopyButtonElement } from "@tooark/web-components";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
import { type PropsWithChildren } from "react";
|
|
4
5
|
export type ArkCopyButtonProps = PropsWithChildren<ArkCopyButtonStyleOptions & {
|
|
@@ -14,4 +15,18 @@ export type ArkCopyButtonProps = PropsWithChildren<ArkCopyButtonStyleOptions & {
|
|
|
14
15
|
value: string;
|
|
15
16
|
}>) => void;
|
|
16
17
|
}>;
|
|
17
|
-
export declare
|
|
18
|
+
export declare const ArkCopyButton: React.ForwardRefExoticComponent<ArkCopyButtonStyleOptions & {
|
|
19
|
+
/** Texto a copiar. */
|
|
20
|
+
value?: string;
|
|
21
|
+
/** id de um elemento (vira o atributo for): copia o value de inputs/textareas ou o textContent. */
|
|
22
|
+
htmlFor?: string;
|
|
23
|
+
/** Duracao do feedback "copiado" em ms. Padrao: 1500. */
|
|
24
|
+
feedbackMs?: number;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
className?: string;
|
|
27
|
+
onCopy?: (event: CustomEvent<{
|
|
28
|
+
value: string;
|
|
29
|
+
}>) => void;
|
|
30
|
+
} & {
|
|
31
|
+
children?: React.ReactNode | undefined;
|
|
32
|
+
} & React.RefAttributes<ArkCopyButtonElement>>;
|
package/dist/ark-copy-button.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { createElement,
|
|
1
|
+
import { createElement, forwardRef, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
-
|
|
3
|
+
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
4
|
+
export const ArkCopyButton = forwardRef(function ArkCopyButton(props, forwardedRef) {
|
|
4
5
|
const { children, className, htmlFor, feedbackMs, textColor, localeJson, loading, iconOnly, fullWidth, disabled, onCopy, ...rest } = props;
|
|
5
|
-
const ref =
|
|
6
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
6
7
|
useEffect(() => {
|
|
7
8
|
ensureTooarkComponentsRegistered();
|
|
8
9
|
}, []);
|
|
@@ -13,10 +14,10 @@ export function ArkCopyButton(props) {
|
|
|
13
14
|
const handler = (event) => onCopy(event);
|
|
14
15
|
el.addEventListener("ark-copy", handler);
|
|
15
16
|
return () => el.removeEventListener("ark-copy", handler);
|
|
16
|
-
}, [onCopy]);
|
|
17
|
+
}, [ref, onCopy]);
|
|
17
18
|
const attrs = {
|
|
18
19
|
...rest,
|
|
19
|
-
ref,
|
|
20
|
+
ref: setRef,
|
|
20
21
|
class: className,
|
|
21
22
|
for: htmlFor,
|
|
22
23
|
"feedback-ms": feedbackMs === undefined ? undefined : String(feedbackMs),
|
|
@@ -28,4 +29,4 @@ export function ArkCopyButton(props) {
|
|
|
28
29
|
"full-width": fullWidth ? "" : undefined
|
|
29
30
|
};
|
|
30
31
|
return createElement("ark-copy-button", attrs, children);
|
|
31
|
-
}
|
|
32
|
+
});
|
package/dist/ark-datepicker.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArkDatepickerLang, ArkDatepickerStyleOptions, ArkLocale } from "@tooark/core";
|
|
2
|
+
import type { ArkDatepicker as ArkDatepickerElement } from "@tooark/web-components";
|
|
2
3
|
import React from "react";
|
|
3
4
|
export type ArkDatepickerProps = ArkDatepickerStyleOptions & {
|
|
4
5
|
lang?: ArkDatepickerLang;
|
|
@@ -12,4 +13,15 @@ export type ArkDatepickerProps = ArkDatepickerStyleOptions & {
|
|
|
12
13
|
}) => void;
|
|
13
14
|
className?: string;
|
|
14
15
|
};
|
|
15
|
-
export declare
|
|
16
|
+
export declare const ArkDatepicker: React.ForwardRefExoticComponent<ArkDatepickerStyleOptions & {
|
|
17
|
+
lang?: ArkDatepickerLang;
|
|
18
|
+
localeJson?: Partial<ArkLocale>;
|
|
19
|
+
value?: string;
|
|
20
|
+
min?: string;
|
|
21
|
+
max?: string;
|
|
22
|
+
onChange?: (detail: {
|
|
23
|
+
value: string | null;
|
|
24
|
+
date: Date | null;
|
|
25
|
+
}) => void;
|
|
26
|
+
className?: string;
|
|
27
|
+
} & React.RefAttributes<ArkDatepickerElement>>;
|
package/dist/ark-datepicker.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React, { useCallback, useEffect } from "react";
|
|
1
|
+
import React, { forwardRef, useCallback, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
-
|
|
3
|
+
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
4
|
+
export const ArkDatepicker = forwardRef(function ArkDatepicker(props, forwardedRef) {
|
|
4
5
|
const { lang, localeJson, theme, intent, accentColor, value, min, max, onChange, className, testid, mode, input, placeholder, name, format, seconds, disabled, events, eventDisplay, stepMinutes, hoursFormat, ...rest } = props;
|
|
5
|
-
const ref =
|
|
6
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
6
7
|
useEffect(() => {
|
|
7
8
|
ensureTooarkComponentsRegistered();
|
|
8
9
|
}, []);
|
|
@@ -18,7 +19,7 @@ export function ArkDatepicker(props) {
|
|
|
18
19
|
return;
|
|
19
20
|
el.addEventListener("ark-change", handleChange);
|
|
20
21
|
return () => el.removeEventListener("ark-change", handleChange);
|
|
21
|
-
}, [handleChange]);
|
|
22
|
+
}, [ref, handleChange]);
|
|
22
23
|
// O rest leva ao elemento o que o wrapper não mapeia (id, style, data-*, aria-*).
|
|
23
24
|
const attrs = {
|
|
24
25
|
...rest,
|
|
@@ -44,5 +45,5 @@ export function ArkDatepicker(props) {
|
|
|
44
45
|
"step-minutes": stepMinutes !== undefined ? String(stepMinutes) : undefined,
|
|
45
46
|
"hours-format": hoursFormat
|
|
46
47
|
};
|
|
47
|
-
return React.createElement("ark-datepicker", { ...attrs, ref });
|
|
48
|
-
}
|
|
48
|
+
return React.createElement("ark-datepicker", { ...attrs, ref: setRef });
|
|
49
|
+
});
|
package/dist/ark-dialog.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArkDialogCloseReason, ArkDialogStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkDialog as ArkDialogElement } from "@tooark/web-components";
|
|
2
3
|
import React, { type PropsWithChildren } from "react";
|
|
3
4
|
export type ArkDialogProps = PropsWithChildren<ArkDialogStyleOptions & {
|
|
4
5
|
/** Aberto; a saida anima antes de sair do top layer. */
|
|
@@ -19,4 +20,24 @@ export type ArkDialogProps = PropsWithChildren<ArkDialogStyleOptions & {
|
|
|
19
20
|
reason: ArkDialogCloseReason;
|
|
20
21
|
}>) => void;
|
|
21
22
|
}>;
|
|
22
|
-
export declare
|
|
23
|
+
export declare const ArkDialog: React.ForwardRefExoticComponent<ArkDialogStyleOptions & {
|
|
24
|
+
/** Aberto; a saida anima antes de sair do top layer. */
|
|
25
|
+
open?: boolean;
|
|
26
|
+
/** Titulo (h2) e nome acessivel. Sem ele, passe aria-label. */
|
|
27
|
+
label?: string;
|
|
28
|
+
/** Esconde o botao de fechar do cabecalho. */
|
|
29
|
+
noCloseButton?: boolean;
|
|
30
|
+
/** Esc e clique no scrim nao fecham. */
|
|
31
|
+
persistent?: boolean;
|
|
32
|
+
/** A pagina continua rolando com o dialogo aberto. */
|
|
33
|
+
noScrollLock?: boolean;
|
|
34
|
+
"aria-label"?: string;
|
|
35
|
+
className?: string;
|
|
36
|
+
onOpen?: (event: CustomEvent) => void;
|
|
37
|
+
/** O fechamento comecou; detail.reason diz por que (escape, backdrop, close-button, api). */
|
|
38
|
+
onClose?: (event: CustomEvent<{
|
|
39
|
+
reason: ArkDialogCloseReason;
|
|
40
|
+
}>) => void;
|
|
41
|
+
} & {
|
|
42
|
+
children?: React.ReactNode | undefined;
|
|
43
|
+
} & React.RefAttributes<ArkDialogElement>>;
|
package/dist/ark-dialog.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createElement, forwardRef, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
3
4
|
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
4
|
-
export function ArkDialog(props) {
|
|
5
|
+
export const ArkDialog = forwardRef(function ArkDialog(props, forwardedRef) {
|
|
5
6
|
const { children, className, open, width, height, noCloseButton, persistent, noScrollLock, localeJson, onOpen, onClose, ...rest } = props;
|
|
6
|
-
const ref =
|
|
7
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
7
8
|
useEffect(() => {
|
|
8
9
|
ensureTooarkComponentsRegistered();
|
|
9
10
|
}, []);
|
|
@@ -22,7 +23,7 @@ export function ArkDialog(props) {
|
|
|
22
23
|
}, [onOpen, onClose]);
|
|
23
24
|
const attrs = {
|
|
24
25
|
...rest,
|
|
25
|
-
ref,
|
|
26
|
+
ref: setRef,
|
|
26
27
|
class: className,
|
|
27
28
|
open: open ? "" : undefined,
|
|
28
29
|
// Numero vira string aqui; o componente acrescenta px a numeros sem unidade.
|
|
@@ -34,4 +35,4 @@ export function ArkDialog(props) {
|
|
|
34
35
|
"locale-json": localeJson
|
|
35
36
|
};
|
|
36
37
|
return createElement("ark-dialog", attrs, children);
|
|
37
|
-
}
|
|
38
|
+
});
|
package/dist/ark-drawer.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArkDrawerCloseReason, ArkDrawerStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkDrawer as ArkDrawerElement } from "@tooark/web-components";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
import { type PropsWithChildren } from "react";
|
|
4
5
|
export type ArkDrawerProps = PropsWithChildren<ArkDrawerStyleOptions & {
|
|
@@ -20,4 +21,24 @@ export type ArkDrawerProps = PropsWithChildren<ArkDrawerStyleOptions & {
|
|
|
20
21
|
reason: ArkDrawerCloseReason;
|
|
21
22
|
}>) => void;
|
|
22
23
|
}>;
|
|
23
|
-
export declare
|
|
24
|
+
export declare const ArkDrawer: React.ForwardRefExoticComponent<ArkDrawerStyleOptions & {
|
|
25
|
+
/** Aberta; a saida anima antes de esconder. */
|
|
26
|
+
open?: boolean;
|
|
27
|
+
/** Titulo (h2) e nome acessivel. Sem ele, passe aria-label. */
|
|
28
|
+
label?: string;
|
|
29
|
+
/** Esconde o botao de fechar do cabecalho. */
|
|
30
|
+
noCloseButton?: boolean;
|
|
31
|
+
/** Esc e clique no scrim nao fecham (so no overlay). */
|
|
32
|
+
persistent?: boolean;
|
|
33
|
+
/** A pagina continua rolando com a gaveta aberta em overlay. */
|
|
34
|
+
noScrollLock?: boolean;
|
|
35
|
+
"aria-label"?: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
onOpen?: (event: CustomEvent) => void;
|
|
38
|
+
/** O fechamento comecou; detail.reason diz por que (escape, backdrop, close-button, api). */
|
|
39
|
+
onClose?: (event: CustomEvent<{
|
|
40
|
+
reason: ArkDrawerCloseReason;
|
|
41
|
+
}>) => void;
|
|
42
|
+
} & {
|
|
43
|
+
children?: React.ReactNode | undefined;
|
|
44
|
+
} & React.RefAttributes<ArkDrawerElement>>;
|
package/dist/ark-drawer.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { createElement,
|
|
1
|
+
import { createElement, forwardRef, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
3
4
|
import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.js";
|
|
4
|
-
export function ArkDrawer(props) {
|
|
5
|
+
export const ArkDrawer = forwardRef(function ArkDrawer(props, forwardedRef) {
|
|
5
6
|
const { children, className, open, size, noCloseButton, persistent, noScrollLock, localeJson, onOpen, onClose, ...rest } = props;
|
|
6
|
-
const ref =
|
|
7
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
7
8
|
useEffect(() => {
|
|
8
9
|
ensureTooarkComponentsRegistered();
|
|
9
10
|
}, []);
|
|
@@ -22,7 +23,7 @@ export function ArkDrawer(props) {
|
|
|
22
23
|
}, [onOpen, onClose]);
|
|
23
24
|
const attrs = {
|
|
24
25
|
...rest,
|
|
25
|
-
ref,
|
|
26
|
+
ref: setRef,
|
|
26
27
|
class: className,
|
|
27
28
|
open: open ? "" : undefined,
|
|
28
29
|
// Numero vira string aqui; o componente acrescenta px a numeros sem unidade.
|
|
@@ -33,4 +34,4 @@ export function ArkDrawer(props) {
|
|
|
33
34
|
"locale-json": localeJson
|
|
34
35
|
};
|
|
35
36
|
return createElement("ark-drawer", attrs, children);
|
|
36
|
-
}
|
|
37
|
+
});
|
package/dist/ark-empty.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArkEmptyStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkEmpty as ArkEmptyElement } from "@tooark/web-components";
|
|
2
3
|
import React, { type PropsWithChildren } from "react";
|
|
3
4
|
export type ArkEmptyProps = PropsWithChildren<ArkEmptyStyleOptions & {
|
|
4
5
|
/** Titulo (h3). */
|
|
@@ -7,4 +8,12 @@ export type ArkEmptyProps = PropsWithChildren<ArkEmptyStyleOptions & {
|
|
|
7
8
|
description?: string;
|
|
8
9
|
className?: string;
|
|
9
10
|
}>;
|
|
10
|
-
export declare
|
|
11
|
+
export declare const ArkEmpty: React.ForwardRefExoticComponent<ArkEmptyStyleOptions & {
|
|
12
|
+
/** Titulo (h3). */
|
|
13
|
+
heading?: string;
|
|
14
|
+
/** Texto abaixo do titulo. */
|
|
15
|
+
description?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
} & {
|
|
18
|
+
children?: React.ReactNode | undefined;
|
|
19
|
+
} & React.RefAttributes<ArkEmptyElement>>;
|
package/dist/ark-empty.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { createElement, useEffect } from "react";
|
|
1
|
+
import { createElement, forwardRef, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
-
export function ArkEmpty(props) {
|
|
3
|
+
export const ArkEmpty = forwardRef(function ArkEmpty(props, forwardedRef) {
|
|
4
4
|
const { children, className, ...rest } = props;
|
|
5
5
|
useEffect(() => {
|
|
6
6
|
ensureTooarkComponentsRegistered();
|
|
7
7
|
}, []);
|
|
8
8
|
const attrs = {
|
|
9
9
|
...rest,
|
|
10
|
+
ref: forwardedRef,
|
|
10
11
|
class: className
|
|
11
12
|
};
|
|
12
13
|
return createElement("ark-empty", attrs, children);
|
|
13
|
-
}
|
|
14
|
+
});
|
package/dist/ark-file-input.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArkFileInputStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkFileInput as ArkFileInputElement } from "@tooark/web-components";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
export type ArkFileInputProps = ArkFileInputStyleOptions & {
|
|
4
5
|
/** Tipos aceitos pelo seletor nativo (accept). */
|
|
@@ -22,4 +23,25 @@ export type ArkFileInputProps = ArkFileInputStyleOptions & {
|
|
|
22
23
|
files: File[];
|
|
23
24
|
}>) => void;
|
|
24
25
|
};
|
|
25
|
-
export declare
|
|
26
|
+
export declare const ArkFileInput: React.ForwardRefExoticComponent<ArkFileInputStyleOptions & {
|
|
27
|
+
/** Tipos aceitos pelo seletor nativo (accept). */
|
|
28
|
+
accept?: string;
|
|
29
|
+
/** Aceita varios arquivos; sem ele o drop fica com o primeiro. */
|
|
30
|
+
multiple?: boolean;
|
|
31
|
+
/** Rotulo do campo (label for o input oculto; nomeia o botao junto do texto dele). */
|
|
32
|
+
label?: string;
|
|
33
|
+
helper?: string;
|
|
34
|
+
/** Mensagem de erro; liga aria-invalid e a borda de erro. */
|
|
35
|
+
errorMessage?: string;
|
|
36
|
+
/** Estado de erro sem mensagem (borda danger e aria-invalid), como no ArkInput. */
|
|
37
|
+
error?: boolean;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
required?: boolean;
|
|
40
|
+
/** Nome no formulario (input nativo oculto). */
|
|
41
|
+
name?: string;
|
|
42
|
+
className?: string;
|
|
43
|
+
/** Arquivos escolhidos ou soltos: detail.files e um array de File. */
|
|
44
|
+
onChange?: (event: CustomEvent<{
|
|
45
|
+
files: File[];
|
|
46
|
+
}>) => void;
|
|
47
|
+
} & React.RefAttributes<ArkFileInputElement>>;
|
package/dist/ark-file-input.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { createElement,
|
|
1
|
+
import { createElement, forwardRef, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
-
|
|
3
|
+
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
4
|
+
export const ArkFileInput = forwardRef(function ArkFileInput(props, forwardedRef) {
|
|
4
5
|
const { className, multiple, errorMessage, error, disabled, required, localeJson, onChange, ...rest } = props;
|
|
5
|
-
const ref =
|
|
6
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
6
7
|
useEffect(() => {
|
|
7
8
|
ensureTooarkComponentsRegistered();
|
|
8
9
|
}, []);
|
|
@@ -13,10 +14,10 @@ export function ArkFileInput(props) {
|
|
|
13
14
|
const handler = (event) => onChange(event);
|
|
14
15
|
el.addEventListener("change", handler);
|
|
15
16
|
return () => el.removeEventListener("change", handler);
|
|
16
|
-
}, [onChange]);
|
|
17
|
+
}, [ref, onChange]);
|
|
17
18
|
const attrs = {
|
|
18
19
|
...rest,
|
|
19
|
-
ref,
|
|
20
|
+
ref: setRef,
|
|
20
21
|
class: className,
|
|
21
22
|
multiple: multiple ? "" : undefined,
|
|
22
23
|
"error-message": errorMessage,
|
|
@@ -26,4 +27,4 @@ export function ArkFileInput(props) {
|
|
|
26
27
|
"locale-json": localeJson
|
|
27
28
|
};
|
|
28
29
|
return createElement("ark-file-input", attrs);
|
|
29
|
-
}
|
|
30
|
+
});
|
package/dist/ark-input.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArkInputStyleOptions, ArkLang } from "@tooark/core";
|
|
2
|
+
import type { ArkInput as ArkInputElement } from "@tooark/web-components";
|
|
2
3
|
import React, { type PropsWithChildren } from "react";
|
|
3
4
|
export type ArkInputProps = PropsWithChildren<ArkInputStyleOptions & {
|
|
4
5
|
type?: string;
|
|
@@ -31,4 +32,36 @@ export type ArkInputProps = PropsWithChildren<ArkInputStyleOptions & {
|
|
|
31
32
|
onInput?: (event: Event) => void;
|
|
32
33
|
onChange?: (event: Event) => void;
|
|
33
34
|
}>;
|
|
34
|
-
export declare
|
|
35
|
+
export declare const ArkInput: React.ForwardRefExoticComponent<ArkInputStyleOptions & {
|
|
36
|
+
type?: string;
|
|
37
|
+
label?: string;
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
value?: string;
|
|
40
|
+
name?: string;
|
|
41
|
+
helper?: string;
|
|
42
|
+
error?: boolean;
|
|
43
|
+
errorMessage?: string;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
required?: boolean;
|
|
46
|
+
readonly?: boolean;
|
|
47
|
+
/** Com type="password", botao de mostrar/ocultar na ponta direita. */
|
|
48
|
+
reveal?: boolean;
|
|
49
|
+
lang?: ArkLang;
|
|
50
|
+
localeJson?: string;
|
|
51
|
+
autocomplete?: string;
|
|
52
|
+
autofocus?: boolean;
|
|
53
|
+
inputmode?: string;
|
|
54
|
+
maxlength?: number;
|
|
55
|
+
minlength?: number;
|
|
56
|
+
pattern?: string;
|
|
57
|
+
min?: string | number;
|
|
58
|
+
max?: string | number;
|
|
59
|
+
step?: string | number;
|
|
60
|
+
spellcheck?: boolean;
|
|
61
|
+
"aria-label"?: string;
|
|
62
|
+
className?: string;
|
|
63
|
+
onInput?: (event: Event) => void;
|
|
64
|
+
onChange?: (event: Event) => void;
|
|
65
|
+
} & {
|
|
66
|
+
children?: React.ReactNode | undefined;
|
|
67
|
+
} & React.RefAttributes<ArkInputElement>>;
|
package/dist/ark-input.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createElement, forwardRef, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
+
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
3
4
|
// Atributo do custom element: string ou ausente.
|
|
4
5
|
function attr(value) {
|
|
5
6
|
return value === undefined ? undefined : String(value);
|
|
6
7
|
}
|
|
7
|
-
export function ArkInput(props) {
|
|
8
|
+
export const ArkInput = forwardRef(function ArkInput(props, forwardedRef) {
|
|
8
9
|
const { children, className, errorMessage, error, disabled, required, readonly, reveal, localeJson, autofocus, maxlength, minlength, min, max, step, spellcheck, onInput, onChange, ...rest } = props;
|
|
9
|
-
const ref =
|
|
10
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
10
11
|
useEffect(() => {
|
|
11
12
|
ensureTooarkComponentsRegistered();
|
|
12
13
|
}, []);
|
|
@@ -22,10 +23,10 @@ export function ArkInput(props) {
|
|
|
22
23
|
el.removeEventListener("input", handleInput);
|
|
23
24
|
el.removeEventListener("change", handleChange);
|
|
24
25
|
};
|
|
25
|
-
}, [onInput, onChange]);
|
|
26
|
+
}, [ref, onInput, onChange]);
|
|
26
27
|
const attrs = {
|
|
27
28
|
...rest,
|
|
28
|
-
ref,
|
|
29
|
+
ref: setRef,
|
|
29
30
|
class: className,
|
|
30
31
|
"error-message": errorMessage,
|
|
31
32
|
"locale-json": localeJson,
|
|
@@ -45,4 +46,4 @@ export function ArkInput(props) {
|
|
|
45
46
|
spellcheck
|
|
46
47
|
};
|
|
47
48
|
return createElement("ark-input", attrs, children);
|
|
48
|
-
}
|
|
49
|
+
});
|
package/dist/ark-kbd.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { ArkKbdStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkKbd as ArkKbdElement } from "@tooark/web-components";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
import { type PropsWithChildren } from "react";
|
|
4
5
|
export type ArkKbdProps = PropsWithChildren<ArkKbdStyleOptions & {
|
|
5
6
|
className?: string;
|
|
6
7
|
}>;
|
|
7
|
-
export declare
|
|
8
|
+
export declare const ArkKbd: React.ForwardRefExoticComponent<ArkKbdStyleOptions & {
|
|
9
|
+
className?: string;
|
|
10
|
+
} & {
|
|
11
|
+
children?: React.ReactNode | undefined;
|
|
12
|
+
} & React.RefAttributes<ArkKbdElement>>;
|
package/dist/ark-kbd.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { createElement, useEffect } from "react";
|
|
1
|
+
import { createElement, forwardRef, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
-
export function ArkKbd(props) {
|
|
3
|
+
export const ArkKbd = forwardRef(function ArkKbd(props, forwardedRef) {
|
|
4
4
|
const { children, className, ...rest } = props;
|
|
5
5
|
useEffect(() => {
|
|
6
6
|
ensureTooarkComponentsRegistered();
|
|
7
7
|
}, []);
|
|
8
8
|
const attrs = {
|
|
9
9
|
...rest,
|
|
10
|
+
ref: forwardedRef,
|
|
10
11
|
class: className
|
|
11
12
|
};
|
|
12
13
|
return createElement("ark-kbd", attrs, children);
|
|
13
|
-
}
|
|
14
|
+
});
|
package/dist/ark-kv-editor.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ArkKvEditorStyleOptions, ArkKvRow } from "@tooark/core";
|
|
1
|
+
import type { ArkKvEditorStyleOptions, ArkKvRow, ArkKvValueField } from "@tooark/core";
|
|
2
|
+
import type { ArkKvEditor as ArkKvEditorElement } from "@tooark/web-components";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
export type ArkKvEditorProps = ArkKvEditorStyleOptions & {
|
|
4
5
|
/** Linhas { id, key, value, enabled }; atribuir substitui tudo e renderiza de novo. */
|
|
@@ -15,6 +16,11 @@ export type ArkKvEditorProps = ArkKvEditorStyleOptions & {
|
|
|
15
16
|
valuePlaceholder?: string;
|
|
16
17
|
descriptionPlaceholder?: string;
|
|
17
18
|
readonly?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Cria a celula de valor de cada linha no lugar do ark-input (um campo com autocomplete de variaveis, por exemplo);
|
|
21
|
+
* linhas secretas mantem o campo de senha. Precisa ser estavel (useCallback): uma funcao nova recria as celulas.
|
|
22
|
+
*/
|
|
23
|
+
valueField?: ArkKvValueField;
|
|
18
24
|
className?: string;
|
|
19
25
|
/** Qualquer edicao, inclusive ao sair do modo em massa: detail.rows sao as linhas. */
|
|
20
26
|
onChange?: (event: CustomEvent<{
|
|
@@ -27,4 +33,35 @@ export type ArkKvEditorProps = ArkKvEditorStyleOptions & {
|
|
|
27
33
|
id: string;
|
|
28
34
|
}>) => void;
|
|
29
35
|
};
|
|
30
|
-
export declare
|
|
36
|
+
export declare const ArkKvEditor: React.ForwardRefExoticComponent<ArkKvEditorStyleOptions & {
|
|
37
|
+
/** Linhas { id, key, value, enabled }; atribuir substitui tudo e renderiza de novo. */
|
|
38
|
+
rows?: ArkKvRow[];
|
|
39
|
+
/** Modo de edicao em massa (textarea). */
|
|
40
|
+
bulk?: boolean;
|
|
41
|
+
/** Tipos de valor da coluna de tipo (string, number, date, time, datetime, email, url); vazio esconde a coluna. */
|
|
42
|
+
types?: string[];
|
|
43
|
+
/** Mostra a coluna de descricao. */
|
|
44
|
+
description?: boolean;
|
|
45
|
+
/** Mostra o cadeado por linha: fechado mascara o valor como senha, com o olho para revelar. */
|
|
46
|
+
secret?: boolean;
|
|
47
|
+
keyPlaceholder?: string;
|
|
48
|
+
valuePlaceholder?: string;
|
|
49
|
+
descriptionPlaceholder?: string;
|
|
50
|
+
readonly?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Cria a celula de valor de cada linha no lugar do ark-input (um campo com autocomplete de variaveis, por exemplo);
|
|
53
|
+
* linhas secretas mantem o campo de senha. Precisa ser estavel (useCallback): uma funcao nova recria as celulas.
|
|
54
|
+
*/
|
|
55
|
+
valueField?: ArkKvValueField;
|
|
56
|
+
className?: string;
|
|
57
|
+
/** Qualquer edicao, inclusive ao sair do modo em massa: detail.rows sao as linhas. */
|
|
58
|
+
onChange?: (event: CustomEvent<{
|
|
59
|
+
rows: ArkKvRow[];
|
|
60
|
+
}>) => void;
|
|
61
|
+
onAdd?: (event: CustomEvent<{
|
|
62
|
+
id: string;
|
|
63
|
+
}>) => void;
|
|
64
|
+
onDelete?: (event: CustomEvent<{
|
|
65
|
+
id: string;
|
|
66
|
+
}>) => void;
|
|
67
|
+
} & React.RefAttributes<ArkKvEditorElement>>;
|
package/dist/ark-kv-editor.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { createElement,
|
|
1
|
+
import { createElement, forwardRef, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
3
|
+
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
4
|
+
export const ArkKvEditor = forwardRef(function ArkKvEditor(props, forwardedRef) {
|
|
5
|
+
const { className, rows, bulk, bulkFormat, types, description, secret, keyPlaceholder, valuePlaceholder, descriptionPlaceholder, readonly, valueField, localeJson, onChange, onAdd, onDelete, ...rest } = props;
|
|
6
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
6
7
|
useEffect(() => {
|
|
7
8
|
ensureTooarkComponentsRegistered();
|
|
8
9
|
}, []);
|
|
@@ -10,7 +11,14 @@ export function ArkKvEditor(props) {
|
|
|
10
11
|
useEffect(() => {
|
|
11
12
|
if (ref.current && rows)
|
|
12
13
|
ref.current.rows = rows;
|
|
13
|
-
}, [rows]);
|
|
14
|
+
}, [ref, rows]);
|
|
15
|
+
// `valueField` e funcao, entao propriedade; so passa a ser gravada quando o app da uma, para o editor sem ela nao
|
|
16
|
+
// recriar as linhas na montagem.
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const el = ref.current;
|
|
19
|
+
if (el && (valueField || el.valueField))
|
|
20
|
+
el.valueField = valueField ?? null;
|
|
21
|
+
}, [ref, valueField]);
|
|
14
22
|
useEffect(() => {
|
|
15
23
|
const el = ref.current;
|
|
16
24
|
if (!el)
|
|
@@ -26,10 +34,10 @@ export function ArkKvEditor(props) {
|
|
|
26
34
|
el.removeEventListener("ark-add", handleAdd);
|
|
27
35
|
el.removeEventListener("ark-delete", handleDelete);
|
|
28
36
|
};
|
|
29
|
-
}, [onChange, onAdd, onDelete]);
|
|
37
|
+
}, [ref, onChange, onAdd, onDelete]);
|
|
30
38
|
const attrs = {
|
|
31
39
|
...rest,
|
|
32
|
-
ref,
|
|
40
|
+
ref: setRef,
|
|
33
41
|
class: className,
|
|
34
42
|
bulk: bulk ? "" : undefined,
|
|
35
43
|
"bulk-format": bulkFormat,
|
|
@@ -43,4 +51,4 @@ export function ArkKvEditor(props) {
|
|
|
43
51
|
"locale-json": localeJson
|
|
44
52
|
};
|
|
45
53
|
return createElement("ark-kv-editor", attrs);
|
|
46
|
-
}
|
|
54
|
+
});
|
package/dist/ark-mark.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { ArkMarkStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkMark as ArkMarkElement } from "@tooark/web-components";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
export type ArkMarkProps = ArkMarkStyleOptions & {
|
|
4
5
|
/** Com rotulo a marca vira role="img" nomeado; sem ele e decorativa (aria-hidden). */
|
|
5
6
|
label?: string;
|
|
6
7
|
className?: string;
|
|
7
8
|
};
|
|
8
|
-
export declare
|
|
9
|
+
export declare const ArkMark: React.ForwardRefExoticComponent<ArkMarkStyleOptions & {
|
|
10
|
+
/** Com rotulo a marca vira role="img" nomeado; sem ele e decorativa (aria-hidden). */
|
|
11
|
+
label?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
} & React.RefAttributes<ArkMarkElement>>;
|
package/dist/ark-mark.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { createElement, useEffect } from "react";
|
|
1
|
+
import { createElement, forwardRef, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
-
export function ArkMark(props) {
|
|
3
|
+
export const ArkMark = forwardRef(function ArkMark(props, forwardedRef) {
|
|
4
4
|
const { className, size, ...rest } = props;
|
|
5
5
|
useEffect(() => {
|
|
6
6
|
ensureTooarkComponentsRegistered();
|
|
7
7
|
}, []);
|
|
8
8
|
const attrs = {
|
|
9
9
|
...rest,
|
|
10
|
+
ref: forwardedRef,
|
|
10
11
|
class: className,
|
|
11
12
|
size: size === undefined ? undefined : String(size)
|
|
12
13
|
};
|
|
13
14
|
return createElement("ark-mark", attrs);
|
|
14
|
-
}
|
|
15
|
+
});
|