@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
package/README.md
CHANGED
|
@@ -61,9 +61,27 @@ import "@tooark/web-components/styles.css";
|
|
|
61
61
|
|
|
62
62
|
One wrapper per element, named after it: `ark-button` → `ArkButton`, `ark-kv-editor` → `ArkKvEditor`, `ark-command-palette` → `ArkCommandPalette` + `ArkCommandItem`. Each exports its props type (`ArkButtonProps`, …).
|
|
63
63
|
|
|
64
|
-
- Props: the element's attributes in camelCase (`iconOnly`, `stepMinutes`, `localeJson`), `className`, plus the element's JS properties where they matter (`events`, `rows`, `options`, `sizes`, `colors`).
|
|
64
|
+
- Props: the element's attributes in camelCase (`iconOnly`, `stepMinutes`, `localeJson`), `className`, plus the element's JS properties where they matter (`events`, `rows`, `options`, `sizes`, `colors`, and `valueField` on `ArkKvEditor`, which must be a stable function: `useCallback`).
|
|
65
65
|
- Events: `on<Event>` for the custom events, receiving the `CustomEvent` (`onChange` on `ArkSelect`/`ArkKvEditor`, `onClose` on `ArkDialog`/`ArkDrawer`, `onSelect` on `ArkMenu`/`ArkCommandPalette`, …); `onChange` on `ArkCalendar`/`ArkDatepicker`/`ArkClock`, `onSlideChange` on `ArkCarousel` and `onEventClick`/`onSlotClick`/`onViewChange`/`onRangeChange` on `ArkScheduler` receive the `detail` itself. Native events bubble from the inner control (`onInput` on `ArkInput`: read `event.target.value`).
|
|
66
66
|
- State: attributes like `open` are the source of truth (`ArkDialog open={bool}` + `onClose`), so controlled rendering works and the exit still animates.
|
|
67
|
+
- Ref: every wrapper forwards `ref` to its `ark-*` element (React 18 and 19), typed as the element class from `@tooark/web-components`, so its methods and properties are typed. Object and callback refs both work (including React 19 callback refs that return a cleanup), and the wrapper's own events and properties keep working.
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { ArkButton, ArkDialog } from "@tooark/react";
|
|
71
|
+
import React, { useRef } from "react";
|
|
72
|
+
|
|
73
|
+
export function Shortcuts() {
|
|
74
|
+
const dialog = useRef<React.ComponentRef<typeof ArkDialog>>(null); // the <ark-dialog> element
|
|
75
|
+
return (
|
|
76
|
+
<>
|
|
77
|
+
<ArkButton onClick={() => dialog.current?.show()}>Keyboard shortcuts</ArkButton>
|
|
78
|
+
<ArkDialog ref={dialog} label="Keyboard shortcuts">
|
|
79
|
+
<p>Ctrl+K opens the command palette.</p>
|
|
80
|
+
</ArkDialog>
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
67
85
|
|
|
68
86
|
Full attribute reference, theming guide and E2E hooks: [https://github.com/Tooark/web-components#readme](https://github.com/Tooark/web-components#readme) · live examples with interaction tests: [Storybook](https://tooark.com/web-components/).
|
|
69
87
|
|
|
@@ -147,8 +165,8 @@ Installed automatically unless marked as peer; peer dependencies are yours to in
|
|
|
147
165
|
|
|
148
166
|
| Package | Version | Description |
|
|
149
167
|
| -------------------------------------------------------------------------------- | ----------- | ---------------------------------------------------------------- |
|
|
150
|
-
| [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.
|
|
151
|
-
| [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.
|
|
168
|
+
| [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.3.0 | Types, i18n, toast/announce services, motion and overlay helpers |
|
|
169
|
+
| [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.3.0 | The `ark-*` Custom Elements and their stylesheet |
|
|
152
170
|
| [`react`](https://www.npmjs.com/package/react) | >=18 (peer) | React 18 or 19 |
|
|
153
171
|
| [`react-dom`](https://www.npmjs.com/package/react-dom) | >=18 (peer) | React DOM renderer |
|
|
154
172
|
|
package/README.pt-BR.md
CHANGED
|
@@ -61,9 +61,27 @@ import "@tooark/web-components/styles.css";
|
|
|
61
61
|
|
|
62
62
|
Um wrapper por elemento, com o nome dele: `ark-button` → `ArkButton`, `ark-kv-editor` → `ArkKvEditor`, `ark-command-palette` → `ArkCommandPalette` + `ArkCommandItem`. Cada um exporta o tipo das props (`ArkButtonProps`, …).
|
|
63
63
|
|
|
64
|
-
- Props: os atributos do elemento em camelCase (`iconOnly`, `stepMinutes`, `localeJson`), `className`, mais as propriedades JS do elemento onde importam (`events`, `rows`, `options`, `sizes`, `colors`).
|
|
64
|
+
- Props: os atributos do elemento em camelCase (`iconOnly`, `stepMinutes`, `localeJson`), `className`, mais as propriedades JS do elemento onde importam (`events`, `rows`, `options`, `sizes`, `colors`, e `valueField` no `ArkKvEditor`, que precisa ser uma função estável: `useCallback`).
|
|
65
65
|
- Eventos: `on<Evento>` para os eventos customizados, recebendo o `CustomEvent` (`onChange` em `ArkSelect`/`ArkKvEditor`, `onClose` em `ArkDialog`/`ArkDrawer`, `onSelect` em `ArkMenu`/`ArkCommandPalette`, …); `onChange` em `ArkCalendar`/`ArkDatepicker`/`ArkClock`, `onSlideChange` em `ArkCarousel` e `onEventClick`/`onSlotClick`/`onViewChange`/`onRangeChange` em `ArkScheduler` recebem o próprio `detail`. Eventos nativos sobem do controle interno (`onInput` em `ArkInput`: leia `event.target.value`).
|
|
66
66
|
- Estado: atributos como `open` são a fonte da verdade (`ArkDialog open={bool}` + `onClose`), então renderização controlada funciona e a saída continua animando.
|
|
67
|
+
- Ref: todo wrapper encaminha a `ref` ao seu elemento `ark-*` (React 18 e 19), tipada como a classe do elemento de `@tooark/web-components`, então métodos e propriedades dele são tipados. Ref de objeto e callback ref funcionam (inclusive a callback ref do React 19 que devolve uma limpeza), e os eventos e propriedades do próprio wrapper continuam funcionando.
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { ArkButton, ArkDialog } from "@tooark/react";
|
|
71
|
+
import React, { useRef } from "react";
|
|
72
|
+
|
|
73
|
+
export function Atalhos() {
|
|
74
|
+
const dialog = useRef<React.ComponentRef<typeof ArkDialog>>(null); // o elemento <ark-dialog>
|
|
75
|
+
return (
|
|
76
|
+
<>
|
|
77
|
+
<ArkButton onClick={() => dialog.current?.show()}>Atalhos de teclado</ArkButton>
|
|
78
|
+
<ArkDialog ref={dialog} label="Atalhos de teclado">
|
|
79
|
+
<p>Ctrl+K abre a paleta de comandos.</p>
|
|
80
|
+
</ArkDialog>
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
67
85
|
|
|
68
86
|
Referência completa de atributos, guia de tema e hooks de E2E: [https://github.com/Tooark/web-components/blob/main/README.pt-BR.md](https://github.com/Tooark/web-components/blob/main/README.pt-BR.md) · exemplos vivos com testes de interação: [Storybook](https://tooark.com/web-components/).
|
|
69
87
|
|
|
@@ -147,8 +165,8 @@ Instaladas automaticamente, salvo as marcadas como peer, que ficam por sua conta
|
|
|
147
165
|
|
|
148
166
|
| Pacote | Versão | Descrição |
|
|
149
167
|
| -------------------------------------------------------------------------------- | ----------- | -------------------------------------------------------------------- |
|
|
150
|
-
| [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.
|
|
151
|
-
| [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.
|
|
168
|
+
| [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.3.0 | Tipos, i18n, serviços de toast/announce, motion e helpers de overlay |
|
|
169
|
+
| [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.3.0 | Os Custom Elements `ark-*` e a folha de estilo deles |
|
|
152
170
|
| [`react`](https://www.npmjs.com/package/react) | >=18 (peer) | React 18 ou 19 |
|
|
153
171
|
| [`react-dom`](https://www.npmjs.com/package/react-dom) | >=18 (peer) | Renderizador React DOM |
|
|
154
172
|
|
package/dist/ark-alert.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArkAlertStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkAlert as ArkAlertElement } from "@tooark/web-components";
|
|
2
3
|
import React, { type PropsWithChildren } from "react";
|
|
3
4
|
export type ArkAlertProps = PropsWithChildren<ArkAlertStyleOptions & {
|
|
4
5
|
/** Titulo proprio no inicio do alerta. */
|
|
@@ -9,4 +10,14 @@ export type ArkAlertProps = PropsWithChildren<ArkAlertStyleOptions & {
|
|
|
9
10
|
/** Depois da saida animada: o host ganha `hidden`; desmontar e do app. */
|
|
10
11
|
onDismiss?: (event: CustomEvent) => void;
|
|
11
12
|
}>;
|
|
12
|
-
export declare
|
|
13
|
+
export declare const ArkAlert: React.ForwardRefExoticComponent<ArkAlertStyleOptions & {
|
|
14
|
+
/** Titulo proprio no inicio do alerta. */
|
|
15
|
+
heading?: string;
|
|
16
|
+
/** Botao de dispensar (rotulo por lang/localeJson). */
|
|
17
|
+
dismissible?: boolean;
|
|
18
|
+
className?: string;
|
|
19
|
+
/** Depois da saida animada: o host ganha `hidden`; desmontar e do app. */
|
|
20
|
+
onDismiss?: (event: CustomEvent) => void;
|
|
21
|
+
} & {
|
|
22
|
+
children?: React.ReactNode | undefined;
|
|
23
|
+
} & React.RefAttributes<ArkAlertElement>>;
|
package/dist/ark-alert.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
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 ArkAlert = forwardRef(function ArkAlert(props, forwardedRef) {
|
|
4
5
|
const { children, className, localeJson, dismissible, onDismiss, ...rest } = props;
|
|
5
|
-
const ref =
|
|
6
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
6
7
|
useEffect(() => {
|
|
7
8
|
ensureTooarkComponentsRegistered();
|
|
8
9
|
}, []);
|
|
@@ -13,13 +14,13 @@ export function ArkAlert(props) {
|
|
|
13
14
|
const handler = (event) => onDismiss(event);
|
|
14
15
|
el.addEventListener("ark-dismiss", handler);
|
|
15
16
|
return () => el.removeEventListener("ark-dismiss", handler);
|
|
16
|
-
}, [onDismiss]);
|
|
17
|
+
}, [ref, onDismiss]);
|
|
17
18
|
const attrs = {
|
|
18
19
|
...rest,
|
|
19
|
-
ref,
|
|
20
|
+
ref: setRef,
|
|
20
21
|
class: className,
|
|
21
22
|
dismissible: dismissible ? "" : undefined,
|
|
22
23
|
"locale-json": localeJson
|
|
23
24
|
};
|
|
24
25
|
return createElement("ark-alert", attrs, children);
|
|
25
|
-
}
|
|
26
|
+
});
|
package/dist/ark-avatar.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArkAvatarStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkAvatar as ArkAvatarElement } from "@tooark/web-components";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
export type ArkAvatarProps = ArkAvatarStyleOptions & {
|
|
4
5
|
/** Nome da pessoa: vira aria-label e as iniciais (primeira letra, ou primeira + ultima com sobrenome). */
|
|
@@ -7,4 +8,10 @@ export type ArkAvatarProps = ArkAvatarStyleOptions & {
|
|
|
7
8
|
src?: string;
|
|
8
9
|
className?: string;
|
|
9
10
|
};
|
|
10
|
-
export declare
|
|
11
|
+
export declare const ArkAvatar: React.ForwardRefExoticComponent<ArkAvatarStyleOptions & {
|
|
12
|
+
/** Nome da pessoa: vira aria-label e as iniciais (primeira letra, ou primeira + ultima com sobrenome). */
|
|
13
|
+
name?: string;
|
|
14
|
+
/** Imagem; em erro de carga caem as iniciais. */
|
|
15
|
+
src?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
} & React.RefAttributes<ArkAvatarElement>>;
|
package/dist/ark-avatar.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 ArkAvatar(props) {
|
|
3
|
+
export const ArkAvatar = forwardRef(function ArkAvatar(props, forwardedRef) {
|
|
4
4
|
const { 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-avatar", attrs);
|
|
13
|
-
}
|
|
14
|
+
});
|
package/dist/ark-badge.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { ArkBadgeStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkBadge as ArkBadgeElement } from "@tooark/web-components";
|
|
2
3
|
import React, { type PropsWithChildren } from "react";
|
|
3
4
|
export type ArkBadgeProps = PropsWithChildren<ArkBadgeStyleOptions & {
|
|
4
5
|
className?: string;
|
|
5
6
|
}>;
|
|
6
|
-
export declare
|
|
7
|
+
export declare const ArkBadge: React.ForwardRefExoticComponent<ArkBadgeStyleOptions & {
|
|
8
|
+
className?: string;
|
|
9
|
+
} & {
|
|
10
|
+
children?: React.ReactNode | undefined;
|
|
11
|
+
} & React.RefAttributes<ArkBadgeElement>>;
|
package/dist/ark-badge.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 ArkBadge(props) {
|
|
3
|
+
export const ArkBadge = forwardRef(function ArkBadge(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-badge", attrs, children);
|
|
13
|
-
}
|
|
14
|
+
});
|
package/dist/ark-button.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArkButtonStyleOptions, ArkButtonType } from "@tooark/core";
|
|
2
|
+
import type { ArkButton as ArkButtonElement } from "@tooark/web-components";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
import { type PropsWithChildren } from "react";
|
|
4
5
|
/** Props do ArkButton: opções de estilo mais os atributos e handlers DOM do React (onClick, onFocus, id, style...). */
|
|
@@ -6,4 +7,9 @@ export type ArkButtonProps = PropsWithChildren<ArkButtonStyleOptions & Omit<Reac
|
|
|
6
7
|
type?: ArkButtonType;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
}>;
|
|
9
|
-
export declare
|
|
10
|
+
export declare const ArkButton: React.ForwardRefExoticComponent<ArkButtonStyleOptions & Omit<React.HTMLAttributes<HTMLElement>, "children" | keyof ArkButtonStyleOptions> & {
|
|
11
|
+
type?: ArkButtonType;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
} & {
|
|
14
|
+
children?: React.ReactNode | undefined;
|
|
15
|
+
} & React.RefAttributes<ArkButtonElement>>;
|
package/dist/ark-button.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createElement, useEffect } from "react";
|
|
1
|
+
import { createElement, forwardRef, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
-
export function ArkButton(props) {
|
|
3
|
+
export const ArkButton = forwardRef(function ArkButton(props, forwardedRef) {
|
|
4
4
|
const { children, className, textColor, loading, statusLabel, iconOnly, fullWidth, disabled, ...rest } = props;
|
|
5
5
|
useEffect(() => {
|
|
6
6
|
ensureTooarkComponentsRegistered();
|
|
@@ -9,6 +9,7 @@ export function ArkButton(props) {
|
|
|
9
9
|
// de disabled/loading do host (captura + stopImmediatePropagation) impede que disparem.
|
|
10
10
|
const attrs = {
|
|
11
11
|
...rest,
|
|
12
|
+
ref: forwardedRef,
|
|
12
13
|
class: className,
|
|
13
14
|
"text-color": textColor,
|
|
14
15
|
disabled: disabled ? "" : undefined,
|
|
@@ -18,4 +19,4 @@ export function ArkButton(props) {
|
|
|
18
19
|
"full-width": fullWidth ? "" : undefined
|
|
19
20
|
};
|
|
20
21
|
return createElement("ark-button", attrs, children);
|
|
21
|
-
}
|
|
22
|
+
});
|
package/dist/ark-calendar.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ArkCalendarEvent, ArkCalendarStyleOptions, ArkDatepickerLang, ArkLocale } from "@tooark/core";
|
|
2
|
-
import
|
|
2
|
+
import type { ArkCalendar as ArkCalendarElement } from "@tooark/web-components";
|
|
3
|
+
import type React from "react";
|
|
3
4
|
export type ArkCalendarProps = ArkCalendarStyleOptions & {
|
|
4
5
|
lang?: ArkDatepickerLang;
|
|
5
6
|
localeJson?: Partial<ArkLocale>;
|
|
@@ -13,4 +14,16 @@ export type ArkCalendarProps = ArkCalendarStyleOptions & {
|
|
|
13
14
|
}) => void;
|
|
14
15
|
className?: string;
|
|
15
16
|
};
|
|
16
|
-
export declare
|
|
17
|
+
export declare const ArkCalendar: React.ForwardRefExoticComponent<ArkCalendarStyleOptions & {
|
|
18
|
+
lang?: ArkDatepickerLang;
|
|
19
|
+
localeJson?: Partial<ArkLocale>;
|
|
20
|
+
value?: string;
|
|
21
|
+
min?: string;
|
|
22
|
+
max?: string;
|
|
23
|
+
onChange?: (detail: {
|
|
24
|
+
value: string | null;
|
|
25
|
+
date: Date | null;
|
|
26
|
+
events: ArkCalendarEvent[];
|
|
27
|
+
}) => void;
|
|
28
|
+
className?: string;
|
|
29
|
+
} & React.RefAttributes<ArkCalendarElement>>;
|
package/dist/ark-calendar.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createElement, forwardRef, useCallback, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
-
|
|
3
|
+
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
4
|
+
export const ArkCalendar = forwardRef(function ArkCalendar(props, forwardedRef) {
|
|
4
5
|
const { lang, localeJson, theme, intent, accentColor, value, min, max, onChange, className, testid, events, eventDisplay, ...rest } = props;
|
|
5
|
-
const ref =
|
|
6
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
6
7
|
useEffect(() => {
|
|
7
8
|
ensureTooarkComponentsRegistered();
|
|
8
9
|
}, []);
|
|
@@ -17,7 +18,7 @@ export function ArkCalendar(props) {
|
|
|
17
18
|
return;
|
|
18
19
|
el.addEventListener("ark-change", handleChange);
|
|
19
20
|
return () => el.removeEventListener("ark-change", handleChange);
|
|
20
|
-
}, [handleChange]);
|
|
21
|
+
}, [ref, handleChange]);
|
|
21
22
|
// O rest leva ao elemento o que o wrapper não mapeia (id, style, data-*, aria-*).
|
|
22
23
|
const attrs = {
|
|
23
24
|
...rest,
|
|
@@ -34,5 +35,5 @@ export function ArkCalendar(props) {
|
|
|
34
35
|
events: events ? JSON.stringify(events) : undefined,
|
|
35
36
|
"event-display": eventDisplay
|
|
36
37
|
};
|
|
37
|
-
return createElement("ark-calendar", { ...attrs, ref });
|
|
38
|
-
}
|
|
38
|
+
return createElement("ark-calendar", { ...attrs, ref: setRef });
|
|
39
|
+
});
|
package/dist/ark-card.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import type { ArkCardStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkCard as ArkCardElement } from "@tooark/web-components";
|
|
2
3
|
import React, { type PropsWithChildren } from "react";
|
|
3
4
|
export type ArkCardProps = PropsWithChildren<ArkCardStyleOptions & {
|
|
4
5
|
/** Titulo (h2) na linha de cima; com ele o filho slot="header" vira a linha seguinte do cabecalho. */
|
|
5
6
|
heading?: string;
|
|
6
7
|
className?: string;
|
|
7
8
|
}>;
|
|
8
|
-
export declare
|
|
9
|
+
export declare const ArkCard: React.ForwardRefExoticComponent<ArkCardStyleOptions & {
|
|
10
|
+
/** Titulo (h2) na linha de cima; com ele o filho slot="header" vira a linha seguinte do cabecalho. */
|
|
11
|
+
heading?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
} & {
|
|
14
|
+
children?: React.ReactNode | undefined;
|
|
15
|
+
} & React.RefAttributes<ArkCardElement>>;
|
package/dist/ark-card.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 ArkCard(props) {
|
|
3
|
+
export const ArkCard = forwardRef(function ArkCard(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-card", attrs, children);
|
|
13
|
-
}
|
|
14
|
+
});
|
package/dist/ark-carousel.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArkCarouselSnap, ArkCarouselStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkCarousel as ArkCarouselElement } from "@tooark/web-components";
|
|
2
3
|
import React, { type PropsWithChildren } from "react";
|
|
3
4
|
export type ArkCarouselProps = PropsWithChildren<ArkCarouselStyleOptions & {
|
|
4
5
|
snap?: ArkCarouselSnap;
|
|
@@ -7,4 +8,12 @@ export type ArkCarouselProps = PropsWithChildren<ArkCarouselStyleOptions & {
|
|
|
7
8
|
}) => void;
|
|
8
9
|
className?: string;
|
|
9
10
|
}>;
|
|
10
|
-
export declare
|
|
11
|
+
export declare const ArkCarousel: React.ForwardRefExoticComponent<ArkCarouselStyleOptions & {
|
|
12
|
+
snap?: ArkCarouselSnap;
|
|
13
|
+
onSlideChange?: (detail: {
|
|
14
|
+
index: number;
|
|
15
|
+
}) => void;
|
|
16
|
+
className?: string;
|
|
17
|
+
} & {
|
|
18
|
+
children?: React.ReactNode | undefined;
|
|
19
|
+
} & React.RefAttributes<ArkCarouselElement>>;
|
package/dist/ark-carousel.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createElement, forwardRef, useCallback, useEffect } from "react";
|
|
2
2
|
import { ensureTooarkComponentsRegistered } from "./register.js";
|
|
3
|
-
|
|
3
|
+
import { useForwardedRef } from "./use-forwarded-ref.js";
|
|
4
|
+
export const ArkCarousel = forwardRef(function ArkCarousel(props, forwardedRef) {
|
|
4
5
|
const { children, theme, intent, accentColor, slidesPerView, gap, startIndex, loop, autoplay, autoplayDelay, showDots, showArrows, dragFree, snap, onSlideChange, className, testid, ...rest } = props;
|
|
5
|
-
const ref =
|
|
6
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
6
7
|
useEffect(() => {
|
|
7
8
|
ensureTooarkComponentsRegistered();
|
|
8
9
|
}, []);
|
|
@@ -17,7 +18,7 @@ export function ArkCarousel(props) {
|
|
|
17
18
|
return;
|
|
18
19
|
el.addEventListener("ark-slide-change", handleSlideChange);
|
|
19
20
|
return () => el.removeEventListener("ark-slide-change", handleSlideChange);
|
|
20
|
-
}, [handleSlideChange]);
|
|
21
|
+
}, [ref, handleSlideChange]);
|
|
21
22
|
// O rest leva ao elemento o que o wrapper não mapeia (id, style, data-*, aria-*).
|
|
22
23
|
const attrs = {
|
|
23
24
|
...rest,
|
|
@@ -37,5 +38,5 @@ export function ArkCarousel(props) {
|
|
|
37
38
|
"show-dots": showDots === undefined ? undefined : showDots ? true : "false",
|
|
38
39
|
"show-arrows": showArrows === undefined ? undefined : showArrows ? true : "false"
|
|
39
40
|
};
|
|
40
|
-
return createElement("ark-carousel", { ...attrs, ref }, children);
|
|
41
|
-
}
|
|
41
|
+
return createElement("ark-carousel", { ...attrs, ref: setRef }, children);
|
|
42
|
+
});
|
package/dist/ark-checkbox.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArkCheckboxStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkCheckbox as ArkCheckboxElement } from "@tooark/web-components";
|
|
2
3
|
import React, { type PropsWithChildren } from "react";
|
|
3
4
|
export type ArkCheckboxProps = PropsWithChildren<ArkCheckboxStyleOptions & {
|
|
4
5
|
disabled?: boolean;
|
|
@@ -13,4 +14,18 @@ export type ArkCheckboxProps = PropsWithChildren<ArkCheckboxStyleOptions & {
|
|
|
13
14
|
checked: boolean;
|
|
14
15
|
}>) => void;
|
|
15
16
|
}>;
|
|
16
|
-
export declare
|
|
17
|
+
export declare const ArkCheckbox: React.ForwardRefExoticComponent<ArkCheckboxStyleOptions & {
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** Nome no formulario (submete `value` quando marcado). */
|
|
20
|
+
name?: string;
|
|
21
|
+
/** Valor submetido quando marcado. Padrao: "on". */
|
|
22
|
+
value?: string;
|
|
23
|
+
/** Rotulo proprio (<label for>); sem ele use aria-label ou filhos como rotulo livre. */
|
|
24
|
+
label?: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
onChange?: (event: CustomEvent<{
|
|
27
|
+
checked: boolean;
|
|
28
|
+
}>) => void;
|
|
29
|
+
} & {
|
|
30
|
+
children?: React.ReactNode | undefined;
|
|
31
|
+
} & React.RefAttributes<ArkCheckboxElement>>;
|
package/dist/ark-checkbox.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
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 ArkCheckbox = forwardRef(function ArkCheckbox(props, forwardedRef) {
|
|
4
5
|
const { children, className, checked, indeterminate, disabled, onChange, ...rest } = props;
|
|
5
|
-
const ref =
|
|
6
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
6
7
|
useEffect(() => {
|
|
7
8
|
ensureTooarkComponentsRegistered();
|
|
8
9
|
}, []);
|
|
@@ -13,14 +14,14 @@ export function ArkCheckbox(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
|
checked: checked ? "" : undefined,
|
|
22
23
|
indeterminate: indeterminate ? "" : undefined,
|
|
23
24
|
disabled: disabled ? "" : undefined
|
|
24
25
|
};
|
|
25
26
|
return createElement("ark-checkbox", attrs, children);
|
|
26
|
-
}
|
|
27
|
+
});
|
package/dist/ark-clock.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ArkClockStyleOptions, ArkDatepickerLang } from "@tooark/core";
|
|
2
|
-
import
|
|
2
|
+
import type { ArkClock as ArkClockElement } from "@tooark/web-components";
|
|
3
|
+
import type React from "react";
|
|
3
4
|
export type ArkClockProps = ArkClockStyleOptions & {
|
|
4
5
|
value?: string;
|
|
5
6
|
lang?: ArkDatepickerLang;
|
|
@@ -8,4 +9,11 @@ export type ArkClockProps = ArkClockStyleOptions & {
|
|
|
8
9
|
value: string;
|
|
9
10
|
}) => void;
|
|
10
11
|
};
|
|
11
|
-
export declare
|
|
12
|
+
export declare const ArkClock: React.ForwardRefExoticComponent<ArkClockStyleOptions & {
|
|
13
|
+
value?: string;
|
|
14
|
+
lang?: ArkDatepickerLang;
|
|
15
|
+
className?: string;
|
|
16
|
+
onChange?: (detail: {
|
|
17
|
+
value: string;
|
|
18
|
+
}) => void;
|
|
19
|
+
} & React.RefAttributes<ArkClockElement>>;
|
package/dist/ark-clock.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
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 ArkClock = forwardRef(function ArkClock(props, forwardedRef) {
|
|
4
5
|
const { className, seconds, stepMinutes, hoursFormat, onChange, ...rest } = props;
|
|
5
|
-
const ref =
|
|
6
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
6
7
|
useEffect(() => {
|
|
7
8
|
ensureTooarkComponentsRegistered();
|
|
8
9
|
}, []);
|
|
@@ -13,14 +14,14 @@ export function ArkClock(props) {
|
|
|
13
14
|
const handler = (event) => onChange(event.detail);
|
|
14
15
|
el.addEventListener("ark-change", handler);
|
|
15
16
|
return () => el.removeEventListener("ark-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
|
seconds: seconds ? "" : undefined,
|
|
22
23
|
"step-minutes": stepMinutes !== undefined ? String(stepMinutes) : undefined,
|
|
23
24
|
"hours-format": hoursFormat
|
|
24
25
|
};
|
|
25
26
|
return createElement("ark-clock", attrs);
|
|
26
|
-
}
|
|
27
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArkColorSwatch, ArkColorSwatchesStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkColorSwatches as ArkColorSwatchesElement } from "@tooark/web-components";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
export type ArkColorSwatchesProps = ArkColorSwatchesStyleOptions & {
|
|
4
5
|
/** Cor selecionada (o value da amostra). */
|
|
@@ -14,4 +15,17 @@ export type ArkColorSwatchesProps = ArkColorSwatchesStyleOptions & {
|
|
|
14
15
|
value: string;
|
|
15
16
|
}>) => void;
|
|
16
17
|
};
|
|
17
|
-
export declare
|
|
18
|
+
export declare const ArkColorSwatches: React.ForwardRefExoticComponent<ArkColorSwatchesStyleOptions & {
|
|
19
|
+
/** Cor selecionada (o value da amostra). */
|
|
20
|
+
value?: string;
|
|
21
|
+
/** Amostras { name, value }[]; vai como JSON no atributo. */
|
|
22
|
+
colors?: ArkColorSwatch[];
|
|
23
|
+
/** Nome acessivel do radiogroup. */
|
|
24
|
+
label?: string;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
className?: string;
|
|
27
|
+
/** Selecao mudou pelo usuario: detail.value e a cor. */
|
|
28
|
+
onChange?: (event: CustomEvent<{
|
|
29
|
+
value: string;
|
|
30
|
+
}>) => void;
|
|
31
|
+
} & React.RefAttributes<ArkColorSwatchesElement>>;
|
|
@@ -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 ArkColorSwatches = forwardRef(function ArkColorSwatches(props, forwardedRef) {
|
|
4
5
|
const { className, colors, disabled, onChange, ...rest } = props;
|
|
5
|
-
const ref =
|
|
6
|
+
const [ref, setRef] = useForwardedRef(forwardedRef);
|
|
6
7
|
useEffect(() => {
|
|
7
8
|
ensureTooarkComponentsRegistered();
|
|
8
9
|
}, []);
|
|
@@ -13,13 +14,13 @@ export function ArkColorSwatches(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
|
colors: colors ? JSON.stringify(colors) : undefined,
|
|
22
23
|
disabled: disabled ? "" : undefined
|
|
23
24
|
};
|
|
24
25
|
return createElement("ark-color-swatches", attrs);
|
|
25
|
-
}
|
|
26
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ArkCommandItemStyleOptions, ArkCommandPaletteStyleOptions } from "@tooark/core";
|
|
2
|
+
import type { ArkCommandItem as ArkCommandItemElement, ArkCommandPalette as ArkCommandPaletteElement } from "@tooark/web-components";
|
|
2
3
|
import type React from "react";
|
|
3
4
|
import { type PropsWithChildren } from "react";
|
|
4
5
|
export type ArkCommandPaletteProps = PropsWithChildren<ArkCommandPaletteStyleOptions & {
|
|
@@ -27,7 +28,34 @@ export type ArkCommandPaletteProps = PropsWithChildren<ArkCommandPaletteStyleOpt
|
|
|
27
28
|
onOpen?: (event: CustomEvent) => void;
|
|
28
29
|
onClose?: (event: CustomEvent) => void;
|
|
29
30
|
}>;
|
|
30
|
-
export declare
|
|
31
|
+
export declare const ArkCommandPalette: React.ForwardRefExoticComponent<ArkCommandPaletteStyleOptions & {
|
|
32
|
+
/** Aberta; a saida anima antes de sair do top layer. */
|
|
33
|
+
open?: boolean;
|
|
34
|
+
/** Placeholder e nome do campo de busca. Padrao: a string `search` do idioma. */
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
/** Atalho global: "/", "mod+k" (Ctrl ou Cmd), "ctrl+shift+p"... */
|
|
37
|
+
hotkey?: string;
|
|
38
|
+
/** Filtra localmente pelo label dos itens. */
|
|
39
|
+
filter?: boolean;
|
|
40
|
+
/** Debounce de ark-query em ms. Padrao: 150. */
|
|
41
|
+
queryDelay?: number;
|
|
42
|
+
/** Nome acessivel do dialogo. */
|
|
43
|
+
label?: string;
|
|
44
|
+
/** A pagina continua rolando com a paleta aberta. */
|
|
45
|
+
noScrollLock?: boolean;
|
|
46
|
+
"aria-label"?: string;
|
|
47
|
+
className?: string;
|
|
48
|
+
onSelect?: (event: CustomEvent<{
|
|
49
|
+
value: string;
|
|
50
|
+
}>) => void;
|
|
51
|
+
onQuery?: (event: CustomEvent<{
|
|
52
|
+
query: string;
|
|
53
|
+
}>) => void;
|
|
54
|
+
onOpen?: (event: CustomEvent) => void;
|
|
55
|
+
onClose?: (event: CustomEvent) => void;
|
|
56
|
+
} & {
|
|
57
|
+
children?: React.ReactNode | undefined;
|
|
58
|
+
} & React.RefAttributes<ArkCommandPaletteElement>>;
|
|
31
59
|
export type ArkCommandItemProps = PropsWithChildren<ArkCommandItemStyleOptions & {
|
|
32
60
|
value: string;
|
|
33
61
|
/** Secao em que a paleta lista o item. */
|
|
@@ -37,4 +65,14 @@ export type ArkCommandItemProps = PropsWithChildren<ArkCommandItemStyleOptions &
|
|
|
37
65
|
disabled?: boolean;
|
|
38
66
|
className?: string;
|
|
39
67
|
}>;
|
|
40
|
-
export declare
|
|
68
|
+
export declare const ArkCommandItem: React.ForwardRefExoticComponent<ArkCommandItemStyleOptions & {
|
|
69
|
+
value: string;
|
|
70
|
+
/** Secao em que a paleta lista o item. */
|
|
71
|
+
group?: string;
|
|
72
|
+
/** Texto do filtro e nome da opcao. Padrao: o texto dos filhos sem slot. */
|
|
73
|
+
label?: string;
|
|
74
|
+
disabled?: boolean;
|
|
75
|
+
className?: string;
|
|
76
|
+
} & {
|
|
77
|
+
children?: React.ReactNode | undefined;
|
|
78
|
+
} & React.RefAttributes<ArkCommandItemElement>>;
|