@tooark/react 1.2.2 → 1.4.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 +42 -4
- package/README.pt-BR.md +42 -4
- 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 +20 -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 +48 -2
- package/dist/ark-command-palette.js +11 -8
- 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 +21 -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 +14 -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
|
@@ -9,7 +9,7 @@ Typed React wrappers for the Tooark Web Components: camelCase props, custom even
|
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
## Contents
|
|
12
|
+
## 📑 Contents
|
|
13
13
|
|
|
14
14
|
- [Overview](#-overview)
|
|
15
15
|
- [Installation](#-installation)
|
|
@@ -18,6 +18,8 @@ Typed React wrappers for the Tooark Web Components: camelCase props, custom even
|
|
|
18
18
|
- [Usage examples](#-usage-examples)
|
|
19
19
|
- [Dependencies](#-dependencies)
|
|
20
20
|
- [Contributing](#-contributing)
|
|
21
|
+
- [Help & Security](#-help--security)
|
|
22
|
+
- [Support](#-support)
|
|
21
23
|
- [License](#-license)
|
|
22
24
|
|
|
23
25
|
---
|
|
@@ -61,9 +63,27 @@ import "@tooark/web-components/styles.css";
|
|
|
61
63
|
|
|
62
64
|
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
65
|
|
|
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`).
|
|
66
|
+
- 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
67
|
- 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
68
|
- State: attributes like `open` are the source of truth (`ArkDialog open={bool}` + `onClose`), so controlled rendering works and the exit still animates.
|
|
69
|
+
- 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.
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { ArkButton, ArkDialog } from "@tooark/react";
|
|
73
|
+
import React, { useRef } from "react";
|
|
74
|
+
|
|
75
|
+
export function Shortcuts() {
|
|
76
|
+
const dialog = useRef<React.ComponentRef<typeof ArkDialog>>(null); // the <ark-dialog> element
|
|
77
|
+
return (
|
|
78
|
+
<>
|
|
79
|
+
<ArkButton onClick={() => dialog.current?.show()}>Keyboard shortcuts</ArkButton>
|
|
80
|
+
<ArkDialog ref={dialog} label="Keyboard shortcuts">
|
|
81
|
+
<p>Ctrl+K opens the command palette.</p>
|
|
82
|
+
</ArkDialog>
|
|
83
|
+
</>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
```
|
|
67
87
|
|
|
68
88
|
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
89
|
|
|
@@ -147,8 +167,8 @@ Installed automatically unless marked as peer; peer dependencies are yours to in
|
|
|
147
167
|
|
|
148
168
|
| Package | Version | Description |
|
|
149
169
|
| -------------------------------------------------------------------------------- | ----------- | ---------------------------------------------------------------- |
|
|
150
|
-
| [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.
|
|
151
|
-
| [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.
|
|
170
|
+
| [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.4.0 | Types, i18n, toast/announce services, motion and overlay helpers |
|
|
171
|
+
| [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.4.0 | The `ark-*` Custom Elements and their stylesheet |
|
|
152
172
|
| [`react`](https://www.npmjs.com/package/react) | >=18 (peer) | React 18 or 19 |
|
|
153
173
|
| [`react-dom`](https://www.npmjs.com/package/react-dom) | >=18 (peer) | React DOM renderer |
|
|
154
174
|
|
|
@@ -160,6 +180,24 @@ Contributions are welcome! Open issues and pull requests in the [Tooark/web-comp
|
|
|
160
180
|
|
|
161
181
|
---
|
|
162
182
|
|
|
183
|
+
## 🆘 Help & Security
|
|
184
|
+
|
|
185
|
+
- ❓ **Questions, bugs, feature ideas** — see [SUPPORT.md](https://github.com/Tooark/web-components/blob/main/SUPPORT.md) for the right channel
|
|
186
|
+
- 🔒 **Security vulnerabilities** — do **not** open a public issue; follow [SECURITY.md](https://github.com/Tooark/web-components/blob/main/SECURITY.md)
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 💖 Support
|
|
191
|
+
|
|
192
|
+
If this project helps your workflow, consider supporting its development:
|
|
193
|
+
|
|
194
|
+
- 💙 [GitHub Sponsors](https://github.com/sponsors/paulosfjunior)
|
|
195
|
+
- ☕ [Ko-fi](https://ko-fi.com/paulosfjunior)
|
|
196
|
+
|
|
197
|
+
Every contribution helps keep the project maintained and improving. Thank you! 🙏
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
163
201
|
## 📄 License
|
|
164
202
|
|
|
165
203
|
This project is licensed under the Apache License 2.0. See the [LICENSE](https://github.com/Tooark/web-components/blob/main/LICENSE) file for details.
|
package/README.pt-BR.md
CHANGED
|
@@ -9,7 +9,7 @@ Wrappers React tipados dos Tooark Web Components: props camelCase, eventos custo
|
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
## Conteúdo
|
|
12
|
+
## 📑 Conteúdo
|
|
13
13
|
|
|
14
14
|
- [Visão Geral](#-visão-geral)
|
|
15
15
|
- [Instalação](#-instalação)
|
|
@@ -18,6 +18,8 @@ Wrappers React tipados dos Tooark Web Components: props camelCase, eventos custo
|
|
|
18
18
|
- [Exemplos de Uso](#-exemplos-de-uso)
|
|
19
19
|
- [Dependências](#-dependências)
|
|
20
20
|
- [Contribuição](#-contribuição)
|
|
21
|
+
- [Ajuda & Segurança](#-ajuda--segurança)
|
|
22
|
+
- [Apoie](#-apoie)
|
|
21
23
|
- [Licença](#-licença)
|
|
22
24
|
|
|
23
25
|
---
|
|
@@ -61,9 +63,27 @@ import "@tooark/web-components/styles.css";
|
|
|
61
63
|
|
|
62
64
|
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
65
|
|
|
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`).
|
|
66
|
+
- 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
67
|
- 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
68
|
- 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.
|
|
69
|
+
- 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.
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { ArkButton, ArkDialog } from "@tooark/react";
|
|
73
|
+
import React, { useRef } from "react";
|
|
74
|
+
|
|
75
|
+
export function Atalhos() {
|
|
76
|
+
const dialog = useRef<React.ComponentRef<typeof ArkDialog>>(null); // o elemento <ark-dialog>
|
|
77
|
+
return (
|
|
78
|
+
<>
|
|
79
|
+
<ArkButton onClick={() => dialog.current?.show()}>Atalhos de teclado</ArkButton>
|
|
80
|
+
<ArkDialog ref={dialog} label="Atalhos de teclado">
|
|
81
|
+
<p>Ctrl+K abre a paleta de comandos.</p>
|
|
82
|
+
</ArkDialog>
|
|
83
|
+
</>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
```
|
|
67
87
|
|
|
68
88
|
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
89
|
|
|
@@ -147,8 +167,8 @@ Instaladas automaticamente, salvo as marcadas como peer, que ficam por sua conta
|
|
|
147
167
|
|
|
148
168
|
| Pacote | Versão | Descrição |
|
|
149
169
|
| -------------------------------------------------------------------------------- | ----------- | -------------------------------------------------------------------- |
|
|
150
|
-
| [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.
|
|
151
|
-
| [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.
|
|
170
|
+
| [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.4.0 | Tipos, i18n, serviços de toast/announce, motion e helpers de overlay |
|
|
171
|
+
| [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.4.0 | Os Custom Elements `ark-*` e a folha de estilo deles |
|
|
152
172
|
| [`react`](https://www.npmjs.com/package/react) | >=18 (peer) | React 18 ou 19 |
|
|
153
173
|
| [`react-dom`](https://www.npmjs.com/package/react-dom) | >=18 (peer) | Renderizador React DOM |
|
|
154
174
|
|
|
@@ -160,6 +180,24 @@ Contribuições são bem-vindas! Abra issues e pull requests no repositório [To
|
|
|
160
180
|
|
|
161
181
|
---
|
|
162
182
|
|
|
183
|
+
## 🆘 Ajuda & Segurança
|
|
184
|
+
|
|
185
|
+
- ❓ **Dúvidas, bugs e ideias** — veja o [SUPPORT.md](https://github.com/Tooark/web-components/blob/main/SUPPORT.md) para escolher o canal certo
|
|
186
|
+
- 🔒 **Vulnerabilidades de segurança** — **não** abra issue pública; siga o [SECURITY.md](https://github.com/Tooark/web-components/blob/main/SECURITY.md)
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 💖 Apoie
|
|
191
|
+
|
|
192
|
+
Se este projeto ajuda no seu dia a dia, considere apoiar o desenvolvimento:
|
|
193
|
+
|
|
194
|
+
- 💙 [GitHub Sponsors](https://github.com/sponsors/paulosfjunior)
|
|
195
|
+
- ☕ [Ko-fi](https://ko-fi.com/paulosfjunior)
|
|
196
|
+
|
|
197
|
+
Cada contribuição ajuda a manter o projeto ativo e em evolução. Obrigado! 🙏
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
163
201
|
## 📄 Licença
|
|
164
202
|
|
|
165
203
|
Este projeto está licenciado sob a licença Apache 2.0. Veja o arquivo [LICENSE](https://github.com/Tooark/web-components/blob/main/LICENSE) para mais detalhes.
|
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;
|
|
@@ -8,9 +9,27 @@ export type ArkCheckboxProps = PropsWithChildren<ArkCheckboxStyleOptions & {
|
|
|
8
9
|
value?: string;
|
|
9
10
|
/** Rotulo proprio (<label for>); sem ele use aria-label ou filhos como rotulo livre. */
|
|
10
11
|
label?: string;
|
|
12
|
+
/** Dica abaixo do rotulo, ligada ao controle por aria-describedby. */
|
|
13
|
+
helper?: string;
|
|
11
14
|
className?: string;
|
|
12
15
|
onChange?: (event: CustomEvent<{
|
|
13
16
|
checked: boolean;
|
|
14
17
|
}>) => void;
|
|
15
18
|
}>;
|
|
16
|
-
export declare
|
|
19
|
+
export declare const ArkCheckbox: React.ForwardRefExoticComponent<ArkCheckboxStyleOptions & {
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** Nome no formulario (submete `value` quando marcado). */
|
|
22
|
+
name?: string;
|
|
23
|
+
/** Valor submetido quando marcado. Padrao: "on". */
|
|
24
|
+
value?: string;
|
|
25
|
+
/** Rotulo proprio (<label for>); sem ele use aria-label ou filhos como rotulo livre. */
|
|
26
|
+
label?: string;
|
|
27
|
+
/** Dica abaixo do rotulo, ligada ao controle por aria-describedby. */
|
|
28
|
+
helper?: string;
|
|
29
|
+
className?: string;
|
|
30
|
+
onChange?: (event: CustomEvent<{
|
|
31
|
+
checked: boolean;
|
|
32
|
+
}>) => void;
|
|
33
|
+
} & {
|
|
34
|
+
children?: React.ReactNode | undefined;
|
|
35
|
+
} & 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>>;
|