@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.
Files changed (80) hide show
  1. package/README.md +42 -4
  2. package/README.pt-BR.md +42 -4
  3. package/dist/ark-alert.d.ts +12 -1
  4. package/dist/ark-alert.js +7 -6
  5. package/dist/ark-avatar.d.ts +8 -1
  6. package/dist/ark-avatar.js +4 -3
  7. package/dist/ark-badge.d.ts +6 -1
  8. package/dist/ark-badge.js +4 -3
  9. package/dist/ark-button.d.ts +7 -1
  10. package/dist/ark-button.js +4 -3
  11. package/dist/ark-calendar.d.ts +15 -2
  12. package/dist/ark-calendar.js +7 -6
  13. package/dist/ark-card.d.ts +8 -1
  14. package/dist/ark-card.js +4 -3
  15. package/dist/ark-carousel.d.ts +10 -1
  16. package/dist/ark-carousel.js +7 -6
  17. package/dist/ark-checkbox.d.ts +20 -1
  18. package/dist/ark-checkbox.js +7 -6
  19. package/dist/ark-clock.d.ts +10 -2
  20. package/dist/ark-clock.js +7 -6
  21. package/dist/ark-color-swatches.d.ts +15 -1
  22. package/dist/ark-color-swatches.js +7 -6
  23. package/dist/ark-command-palette.d.ts +48 -2
  24. package/dist/ark-command-palette.js +11 -8
  25. package/dist/ark-copy-button.d.ts +16 -1
  26. package/dist/ark-copy-button.js +7 -6
  27. package/dist/ark-datepicker.d.ts +13 -1
  28. package/dist/ark-datepicker.js +7 -6
  29. package/dist/ark-dialog.d.ts +22 -1
  30. package/dist/ark-dialog.js +6 -5
  31. package/dist/ark-drawer.d.ts +22 -1
  32. package/dist/ark-drawer.js +6 -5
  33. package/dist/ark-empty.d.ts +10 -1
  34. package/dist/ark-empty.js +4 -3
  35. package/dist/ark-file-input.d.ts +23 -1
  36. package/dist/ark-file-input.js +7 -6
  37. package/dist/ark-input.d.ts +34 -1
  38. package/dist/ark-input.js +7 -6
  39. package/dist/ark-kbd.d.ts +6 -1
  40. package/dist/ark-kbd.js +4 -3
  41. package/dist/ark-kv-editor.d.ts +39 -2
  42. package/dist/ark-kv-editor.js +16 -8
  43. package/dist/ark-mark.d.ts +6 -1
  44. package/dist/ark-mark.js +4 -3
  45. package/dist/ark-menu.d.ts +34 -2
  46. package/dist/ark-menu.js +9 -7
  47. package/dist/ark-progress.d.ts +14 -1
  48. package/dist/ark-progress.js +4 -3
  49. package/dist/ark-radio.d.ts +21 -1
  50. package/dist/ark-radio.js +7 -6
  51. package/dist/ark-scheduler.d.ts +25 -2
  52. package/dist/ark-scheduler.js +7 -6
  53. package/dist/ark-select.d.ts +20 -1
  54. package/dist/ark-select.js +7 -6
  55. package/dist/ark-shape-picker.d.ts +17 -1
  56. package/dist/ark-shape-picker.js +9 -7
  57. package/dist/ark-skeleton.d.ts +11 -1
  58. package/dist/ark-skeleton.js +4 -3
  59. package/dist/ark-spinner.d.ts +6 -1
  60. package/dist/ark-spinner.js +4 -3
  61. package/dist/ark-split-pane.d.ts +12 -1
  62. package/dist/ark-split-pane.js +7 -6
  63. package/dist/ark-status-dot.d.ts +6 -1
  64. package/dist/ark-status-dot.js +4 -3
  65. package/dist/ark-switch.d.ts +12 -2
  66. package/dist/ark-switch.js +7 -6
  67. package/dist/ark-tabs.d.ts +30 -2
  68. package/dist/ark-tabs.js +10 -8
  69. package/dist/ark-textarea.d.ts +34 -1
  70. package/dist/ark-textarea.js +7 -6
  71. package/dist/ark-toaster.d.ts +9 -1
  72. package/dist/ark-toaster.js +7 -6
  73. package/dist/ark-toggle.d.ts +21 -2
  74. package/dist/ark-toggle.js +12 -11
  75. package/dist/ark-tooltip.d.ts +10 -1
  76. package/dist/ark-tooltip.js +4 -3
  77. package/dist/jsx-intrinsics.d.ts +14 -0
  78. package/dist/use-forwarded-ref.d.ts +3 -0
  79. package/dist/use-forwarded-ref.js +31 -0
  80. package/package.json +3 -3
@@ -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 function ArkKvEditor(props: ArkKvEditorProps): React.JSX.Element;
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>>;
@@ -1,8 +1,9 @@
1
- import { createElement, useEffect, useRef } from "react";
1
+ import { createElement, forwardRef, useEffect } from "react";
2
2
  import { ensureTooarkComponentsRegistered } from "./register.js";
3
- export function ArkKvEditor(props) {
4
- const { className, rows, bulk, bulkFormat, types, description, secret, keyPlaceholder, valuePlaceholder, descriptionPlaceholder, readonly, localeJson, onChange, onAdd, onDelete, ...rest } = props;
5
- const ref = useRef(null);
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
+ });
@@ -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 function ArkMark(props: ArkMarkProps): React.JSX.Element;
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
+ });
@@ -1,4 +1,5 @@
1
1
  import type { ArkMenuAlign, ArkMenuDirection, ArkMenuItemStyleOptions, ArkMenuStyleOptions } from "@tooark/core";
2
+ import type { ArkMenu as ArkMenuElement, ArkMenuItem as ArkMenuItemElement } from "@tooark/web-components";
2
3
  import React, { type PropsWithChildren } from "react";
3
4
  export type ArkMenuProps = PropsWithChildren<ArkMenuStyleOptions & {
4
5
  /** id do gatilho (vira o atributo for): o menu escreve aria-* nele e escuta clique e setas. */
@@ -18,7 +19,26 @@ export type ArkMenuProps = PropsWithChildren<ArkMenuStyleOptions & {
18
19
  onOpen?: (event: CustomEvent) => void;
19
20
  onClose?: (event: CustomEvent) => void;
20
21
  }>;
21
- export declare function ArkMenu(props: ArkMenuProps): React.JSX.Element;
22
+ export declare const ArkMenu: React.ForwardRefExoticComponent<ArkMenuStyleOptions & {
23
+ /** id do gatilho (vira o atributo for): o menu escreve aria-* nele e escuta clique e setas. */
24
+ htmlFor?: string;
25
+ /** Aberto; refletido do estado do popover. */
26
+ open?: boolean;
27
+ /** Alinhamento em relacao ao gatilho. Padrao: "start". */
28
+ align?: ArkMenuAlign;
29
+ /** Lado do gatilho; vira quando nao cabe. Padrao: "down". */
30
+ direction?: ArkMenuDirection;
31
+ "aria-label"?: string;
32
+ className?: string;
33
+ /** Um item foi escolhido; o menu fecha em seguida. */
34
+ onSelect?: (event: CustomEvent<{
35
+ value: string;
36
+ }>) => void;
37
+ onOpen?: (event: CustomEvent) => void;
38
+ onClose?: (event: CustomEvent) => void;
39
+ } & {
40
+ children?: React.ReactNode | undefined;
41
+ } & React.RefAttributes<ArkMenuElement>>;
22
42
  export type ArkMenuItemProps = PropsWithChildren<ArkMenuItemStyleOptions & {
23
43
  value?: string;
24
44
  disabled?: boolean;
@@ -30,4 +50,16 @@ export type ArkMenuItemProps = PropsWithChildren<ArkMenuItemStyleOptions & {
30
50
  static?: boolean;
31
51
  className?: string;
32
52
  }>;
33
- export declare function ArkMenuItem(props: ArkMenuItemProps): React.JSX.Element;
53
+ export declare const ArkMenuItem: React.ForwardRefExoticComponent<ArkMenuItemStyleOptions & {
54
+ value?: string;
55
+ disabled?: boolean;
56
+ /** Item checkbox: true marcado, false desmarcado; omitido e um item comum. */
57
+ checked?: boolean;
58
+ /** Linha separadora (role separator). */
59
+ divider?: boolean;
60
+ /** Conteudo nao interativo (nome e e-mail), sem role de item. */
61
+ static?: boolean;
62
+ className?: string;
63
+ } & {
64
+ children?: React.ReactNode | undefined;
65
+ } & React.RefAttributes<ArkMenuItemElement>>;
package/dist/ark-menu.js CHANGED
@@ -1,9 +1,10 @@
1
- import React, { createElement, useEffect } from "react";
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 ArkMenu(props) {
5
+ export const ArkMenu = forwardRef(function ArkMenu(props, forwardedRef) {
5
6
  const { children, className, htmlFor, open, onSelect, onOpen, onClose, ...rest } = props;
6
- const ref = React.useRef(null);
7
+ const [ref, setRef] = useForwardedRef(forwardedRef);
7
8
  useEffect(() => {
8
9
  ensureTooarkComponentsRegistered();
9
10
  }, []);
@@ -25,20 +26,21 @@ export function ArkMenu(props) {
25
26
  }, [onSelect, onOpen, onClose]);
26
27
  const attrs = {
27
28
  ...rest,
28
- ref,
29
+ ref: setRef,
29
30
  class: className,
30
31
  for: htmlFor,
31
32
  open: open ? "" : undefined
32
33
  };
33
34
  return createElement("ark-menu", attrs, children);
34
- }
35
- export function ArkMenuItem(props) {
35
+ });
36
+ export const ArkMenuItem = forwardRef(function ArkMenuItem(props, forwardedRef) {
36
37
  const { children, className, disabled, checked, divider, static: isStatic, ...rest } = props;
37
38
  useEffect(() => {
38
39
  ensureTooarkComponentsRegistered();
39
40
  }, []);
40
41
  const attrs = {
41
42
  ...rest,
43
+ ref: forwardedRef,
42
44
  class: className,
43
45
  disabled: disabled ? "" : undefined,
44
46
  checked: checked === undefined ? undefined : checked ? "" : "false",
@@ -46,4 +48,4 @@ export function ArkMenuItem(props) {
46
48
  static: isStatic ? "" : undefined
47
49
  };
48
50
  return createElement("ark-menu-item", attrs, children);
49
- }
51
+ });
@@ -1,4 +1,5 @@
1
1
  import type { ArkProgressStyleOptions } from "@tooark/core";
2
+ import type { ArkProgress as ArkProgressElement } from "@tooark/web-components";
2
3
  import type React from "react";
3
4
  export type ArkProgressProps = ArkProgressStyleOptions & {
4
5
  /** Valor atual, de 0 a max. Padrao: 0. */
@@ -13,4 +14,16 @@ export type ArkProgressProps = ArkProgressStyleOptions & {
13
14
  showValue?: boolean;
14
15
  className?: string;
15
16
  };
16
- export declare function ArkProgress(props: ArkProgressProps): React.JSX.Element;
17
+ export declare const ArkProgress: React.ForwardRefExoticComponent<ArkProgressStyleOptions & {
18
+ /** Valor atual, de 0 a max. Padrao: 0. */
19
+ value?: number;
20
+ /** Valor maximo. Padrao: 100. */
21
+ max?: number;
22
+ /** Segmento em loop no lugar do valor (loader continuo, isento de movimento reduzido). */
23
+ indeterminate?: boolean;
24
+ /** Nome acessivel (aria-label). */
25
+ label?: string;
26
+ /** Mostra a porcentagem ao lado do trilho. */
27
+ showValue?: boolean;
28
+ className?: string;
29
+ } & React.RefAttributes<ArkProgressElement>>;
@@ -1,12 +1,13 @@
1
- import { createElement, useEffect } from "react";
1
+ import { createElement, forwardRef, useEffect } from "react";
2
2
  import { ensureTooarkComponentsRegistered } from "./register.js";
3
- export function ArkProgress(props) {
3
+ export const ArkProgress = forwardRef(function ArkProgress(props, forwardedRef) {
4
4
  const { className, value, max, indeterminate, showValue, ...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
  value: value === undefined ? undefined : String(value),
12
13
  max: max === undefined ? undefined : String(max),
@@ -14,4 +15,4 @@ export function ArkProgress(props) {
14
15
  "show-value": showValue ? "" : undefined
15
16
  };
16
17
  return createElement("ark-progress", attrs);
17
- }
18
+ });
@@ -1,4 +1,5 @@
1
1
  import type { ArkRadioStyleOptions } from "@tooark/core";
2
+ import type { ArkRadio as ArkRadioElement } from "@tooark/web-components";
2
3
  import React, { type PropsWithChildren } from "react";
3
4
  export type ArkRadioProps = PropsWithChildren<ArkRadioStyleOptions & {
4
5
  disabled?: boolean;
@@ -8,10 +9,29 @@ export type ArkRadioProps = PropsWithChildren<ArkRadioStyleOptions & {
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
  /** Dispara so no radio que ganhou a marca. */
13
16
  onChange?: (event: CustomEvent<{
14
17
  value: string;
15
18
  }>) => void;
16
19
  }>;
17
- export declare function ArkRadio(props: ArkRadioProps): React.JSX.Element;
20
+ export declare const ArkRadio: React.ForwardRefExoticComponent<ArkRadioStyleOptions & {
21
+ disabled?: boolean;
22
+ /** Nome do grupo: agrupa no formulario e para setas/roving tabindex. */
23
+ name?: string;
24
+ /** Valor submetido e publicado em `change` quando marcado. Padrao: "on". */
25
+ value?: string;
26
+ /** Rotulo proprio (<label for>); sem ele use aria-label ou filhos como rotulo livre. */
27
+ label?: string;
28
+ /** Dica abaixo do rotulo, ligada ao controle por aria-describedby. */
29
+ helper?: string;
30
+ className?: string;
31
+ /** Dispara so no radio que ganhou a marca. */
32
+ onChange?: (event: CustomEvent<{
33
+ value: string;
34
+ }>) => void;
35
+ } & {
36
+ children?: React.ReactNode | undefined;
37
+ } & React.RefAttributes<ArkRadioElement>>;
package/dist/ark-radio.js CHANGED
@@ -1,8 +1,9 @@
1
- import React, { createElement, useEffect } from "react";
1
+ import { createElement, forwardRef, useEffect } from "react";
2
2
  import { ensureTooarkComponentsRegistered } from "./register.js";
3
- export function ArkRadio(props) {
3
+ import { useForwardedRef } from "./use-forwarded-ref.js";
4
+ export const ArkRadio = forwardRef(function ArkRadio(props, forwardedRef) {
4
5
  const { children, className, checked, disabled, onChange, ...rest } = props;
5
- const ref = React.useRef(null);
6
+ const [ref, setRef] = useForwardedRef(forwardedRef);
6
7
  useEffect(() => {
7
8
  ensureTooarkComponentsRegistered();
8
9
  }, []);
@@ -13,13 +14,13 @@ export function ArkRadio(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
  disabled: disabled ? "" : undefined
23
24
  };
24
25
  return createElement("ark-radio", attrs, children);
25
- }
26
+ });
@@ -1,5 +1,6 @@
1
1
  import type { ArkDatepickerLang, ArkSchedulerEvent, ArkSchedulerStyleOptions } from "@tooark/core";
2
- import React from "react";
2
+ import type { ArkScheduler as ArkSchedulerElement } from "@tooark/web-components";
3
+ import type React from "react";
3
4
  export type ArkSchedulerProps = ArkSchedulerStyleOptions & {
4
5
  lang?: ArkDatepickerLang;
5
6
  /** JSON com strings próprias, mesclado sobre o inglês, quando lang é "custom". */
@@ -23,4 +24,26 @@ export type ArkSchedulerProps = ArkSchedulerStyleOptions & {
23
24
  view: string;
24
25
  }) => void;
25
26
  };
26
- export declare function ArkScheduler(props: ArkSchedulerProps): React.JSX.Element;
27
+ export declare const ArkScheduler: React.ForwardRefExoticComponent<ArkSchedulerStyleOptions & {
28
+ lang?: ArkDatepickerLang;
29
+ /** JSON com strings próprias, mesclado sobre o inglês, quando lang é "custom". */
30
+ localeJson?: string;
31
+ className?: string;
32
+ onEventClick?: (detail: {
33
+ event: ArkSchedulerEvent;
34
+ id: string | null;
35
+ }) => void;
36
+ onSlotClick?: (detail: {
37
+ start: string;
38
+ end: string;
39
+ allDay: boolean;
40
+ }) => void;
41
+ onViewChange?: (detail: {
42
+ view: string;
43
+ }) => void;
44
+ onRangeChange?: (detail: {
45
+ start: string;
46
+ end: string;
47
+ view: string;
48
+ }) => void;
49
+ } & React.RefAttributes<ArkSchedulerElement>>;
@@ -1,8 +1,9 @@
1
- import React, { createElement, useEffect } from "react";
1
+ import { createElement, forwardRef, useEffect } from "react";
2
2
  import { ensureTooarkComponentsRegistered } from "./register.js";
3
- export function ArkScheduler(props) {
3
+ import { useForwardedRef } from "./use-forwarded-ref.js";
4
+ export const ArkScheduler = forwardRef(function ArkScheduler(props, forwardedRef) {
4
5
  const { className, events, hourStart, hourEnd, slotMinutes, hoursFormat, localeJson, onEventClick, onSlotClick, onViewChange, onRangeChange, ...rest } = props;
5
- const ref = React.useRef(null);
6
+ const [ref, setRef] = useForwardedRef(forwardedRef);
6
7
  useEffect(() => {
7
8
  ensureTooarkComponentsRegistered();
8
9
  }, []);
@@ -27,10 +28,10 @@ export function ArkScheduler(props) {
27
28
  el.removeEventListener(name, listener);
28
29
  }
29
30
  };
30
- }, [onEventClick, onSlotClick, onViewChange, onRangeChange]);
31
+ }, [ref, onEventClick, onSlotClick, onViewChange, onRangeChange]);
31
32
  const attrs = {
32
33
  ...rest,
33
- ref,
34
+ ref: setRef,
34
35
  class: className,
35
36
  events: events ? JSON.stringify(events) : undefined,
36
37
  "hour-start": hourStart !== undefined ? String(hourStart) : undefined,
@@ -40,4 +41,4 @@ export function ArkScheduler(props) {
40
41
  "locale-json": localeJson
41
42
  };
42
43
  return createElement("ark-scheduler", attrs);
43
- }
44
+ });
@@ -1,4 +1,5 @@
1
1
  import type { ArkSelectOption, ArkSelectStyleOptions } from "@tooark/core";
2
+ import type { ArkSelect as ArkSelectElement } from "@tooark/web-components";
2
3
  import React, { type PropsWithChildren } from "react";
3
4
  export type ArkSelectProps = PropsWithChildren<ArkSelectStyleOptions & {
4
5
  label?: string;
@@ -17,4 +18,22 @@ export type ArkSelectProps = PropsWithChildren<ArkSelectStyleOptions & {
17
18
  value: string;
18
19
  }>) => void;
19
20
  }>;
20
- export declare function ArkSelect(props: ArkSelectProps): React.JSX.Element;
21
+ export declare const ArkSelect: React.ForwardRefExoticComponent<ArkSelectStyleOptions & {
22
+ label?: string;
23
+ placeholder?: string;
24
+ options?: ArkSelectOption[];
25
+ value?: string;
26
+ name?: string;
27
+ helper?: string;
28
+ error?: boolean;
29
+ errorMessage?: string;
30
+ disabled?: boolean;
31
+ required?: boolean;
32
+ className?: string;
33
+ onInput?: (event: Event) => void;
34
+ onChange?: (event: CustomEvent<{
35
+ value: string;
36
+ }>) => void;
37
+ } & {
38
+ children?: React.ReactNode | undefined;
39
+ } & React.RefAttributes<ArkSelectElement>>;
@@ -1,8 +1,9 @@
1
- import React, { createElement, useEffect } from "react";
1
+ import { createElement, forwardRef, useEffect } from "react";
2
2
  import { ensureTooarkComponentsRegistered } from "./register.js";
3
- export function ArkSelect(props) {
3
+ import { useForwardedRef } from "./use-forwarded-ref.js";
4
+ export const ArkSelect = forwardRef(function ArkSelect(props, forwardedRef) {
4
5
  const { children, className, options, errorMessage, error, disabled, required, onInput, onChange, ...rest } = props;
5
- const ref = React.useRef(null);
6
+ const [ref, setRef] = useForwardedRef(forwardedRef);
6
7
  useEffect(() => {
7
8
  ensureTooarkComponentsRegistered();
8
9
  }, []);
@@ -18,10 +19,10 @@ export function ArkSelect(props) {
18
19
  el.removeEventListener("input", handleInput);
19
20
  el.removeEventListener("change", handleChange);
20
21
  };
21
- }, [onInput, onChange]);
22
+ }, [ref, onInput, onChange]);
22
23
  const attrs = {
23
24
  ...rest,
24
- ref,
25
+ ref: setRef,
25
26
  class: className,
26
27
  options: options ? JSON.stringify(options) : undefined,
27
28
  "error-message": errorMessage,
@@ -30,4 +31,4 @@ export function ArkSelect(props) {
30
31
  required: required ? "" : undefined
31
32
  };
32
33
  return createElement("ark-select", attrs, children);
33
- }
34
+ });
@@ -1,8 +1,11 @@
1
1
  import type { ArkMarkShape, ArkShapePickerStyleOptions } from "@tooark/core";
2
+ import type { ArkShapePicker as ArkShapePickerElement } from "@tooark/web-components";
2
3
  import type React from "react";
3
4
  export type ArkShapePickerProps = ArkShapePickerStyleOptions & {
4
5
  /** Forma selecionada. */
5
6
  value?: ArkMarkShape;
7
+ /** Formas oferecidas, na ordem (ou "all"). Padrao: as dez. */
8
+ shapes?: ArkMarkShape[] | "all";
6
9
  /** Nome acessivel do radiogroup. */
7
10
  label?: string;
8
11
  disabled?: boolean;
@@ -12,4 +15,17 @@ export type ArkShapePickerProps = ArkShapePickerStyleOptions & {
12
15
  value: ArkMarkShape;
13
16
  }>) => void;
14
17
  };
15
- export declare function ArkShapePicker(props: ArkShapePickerProps): React.JSX.Element;
18
+ export declare const ArkShapePicker: React.ForwardRefExoticComponent<ArkShapePickerStyleOptions & {
19
+ /** Forma selecionada. */
20
+ value?: ArkMarkShape;
21
+ /** Formas oferecidas, na ordem (ou "all"). Padrao: as dez. */
22
+ shapes?: ArkMarkShape[] | "all";
23
+ /** Nome acessivel do radiogroup. */
24
+ label?: string;
25
+ disabled?: boolean;
26
+ className?: string;
27
+ /** Selecao mudou pelo usuario: detail.value e a forma. */
28
+ onChange?: (event: CustomEvent<{
29
+ value: ArkMarkShape;
30
+ }>) => void;
31
+ } & React.RefAttributes<ArkShapePickerElement>>;
@@ -1,8 +1,9 @@
1
- import { createElement, useEffect, useRef } from "react";
1
+ import { createElement, forwardRef, useEffect } from "react";
2
2
  import { ensureTooarkComponentsRegistered } from "./register.js";
3
- export function ArkShapePicker(props) {
4
- const { className, disabled, localeJson, onChange, ...rest } = props;
5
- const ref = useRef(null);
3
+ import { useForwardedRef } from "./use-forwarded-ref.js";
4
+ export const ArkShapePicker = forwardRef(function ArkShapePicker(props, forwardedRef) {
5
+ const { className, disabled, shapes, localeJson, onChange, ...rest } = props;
6
+ const [ref, setRef] = useForwardedRef(forwardedRef);
6
7
  useEffect(() => {
7
8
  ensureTooarkComponentsRegistered();
8
9
  }, []);
@@ -13,13 +14,14 @@ export function ArkShapePicker(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
  disabled: disabled ? "" : undefined,
23
+ shapes: Array.isArray(shapes) ? (shapes.length > 0 ? shapes.join(",") : undefined) : shapes,
22
24
  "locale-json": localeJson
23
25
  };
24
26
  return createElement("ark-shape-picker", attrs);
25
- }
27
+ });
@@ -1,4 +1,5 @@
1
1
  import type { ArkSkeletonStyleOptions } from "@tooark/core";
2
+ import type { ArkSkeleton as ArkSkeletonElement } from "@tooark/web-components";
2
3
  import React, { type PropsWithChildren } from "react";
3
4
  export type ArkSkeletonProps = PropsWithChildren<ArkSkeletonStyleOptions & {
4
5
  /** Numero de barras; acima de 1 troca o bloco por barras em coluna. Padrao: 1. */
@@ -8,4 +9,13 @@ export type ArkSkeletonProps = PropsWithChildren<ArkSkeletonStyleOptions & {
8
9
  className?: string;
9
10
  style?: React.CSSProperties;
10
11
  }>;
11
- export declare function ArkSkeleton(props: ArkSkeletonProps): React.JSX.Element;
12
+ export declare const ArkSkeleton: React.ForwardRefExoticComponent<ArkSkeletonStyleOptions & {
13
+ /** Numero de barras; acima de 1 troca o bloco por barras em coluna. Padrao: 1. */
14
+ rows?: number;
15
+ /** Liga o brilho que varre (opt-in; para sob movimento reduzido). */
16
+ animated?: boolean;
17
+ className?: string;
18
+ style?: React.CSSProperties;
19
+ } & {
20
+ children?: React.ReactNode | undefined;
21
+ } & React.RefAttributes<ArkSkeletonElement>>;
@@ -1,15 +1,16 @@
1
- import { createElement, useEffect } from "react";
1
+ import { createElement, forwardRef, useEffect } from "react";
2
2
  import { ensureTooarkComponentsRegistered } from "./register.js";
3
- export function ArkSkeleton(props) {
3
+ export const ArkSkeleton = forwardRef(function ArkSkeleton(props, forwardedRef) {
4
4
  const { children, className, rows, animated, ...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
  rows: rows === undefined ? undefined : String(rows),
12
13
  animated: animated ? "" : undefined
13
14
  };
14
15
  return createElement("ark-skeleton", attrs, children);
15
- }
16
+ });
@@ -1,8 +1,13 @@
1
1
  import type { ArkSpinnerStyleOptions } from "@tooark/core";
2
+ import type { ArkSpinner as ArkSpinnerElement } from "@tooark/web-components";
2
3
  import type React from "react";
3
4
  export type ArkSpinnerProps = ArkSpinnerStyleOptions & {
4
5
  /** Rotulo so para leitores de tela. Padrao: a string `loading` do idioma. */
5
6
  label?: string;
6
7
  className?: string;
7
8
  };
8
- export declare function ArkSpinner(props: ArkSpinnerProps): React.JSX.Element;
9
+ export declare const ArkSpinner: React.ForwardRefExoticComponent<ArkSpinnerStyleOptions & {
10
+ /** Rotulo so para leitores de tela. Padrao: a string `loading` do idioma. */
11
+ label?: string;
12
+ className?: string;
13
+ } & React.RefAttributes<ArkSpinnerElement>>;
@@ -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 ArkSpinner(props) {
3
+ export const ArkSpinner = forwardRef(function ArkSpinner(props, forwardedRef) {
4
4
  const { className, localeJson, ...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
  "locale-json": localeJson
12
13
  };
13
14
  return createElement("ark-spinner", attrs);
14
- }
15
+ });
@@ -1,4 +1,5 @@
1
1
  import type { ArkSplitPaneStyleOptions } from "@tooark/core";
2
+ import type { ArkSplitPane as ArkSplitPaneElement } from "@tooark/web-components";
2
3
  import type React from "react";
3
4
  import { type PropsWithChildren } from "react";
4
5
  export type ArkSplitPaneProps = PropsWithChildren<ArkSplitPaneStyleOptions & {
@@ -10,4 +11,14 @@ export type ArkSplitPaneProps = PropsWithChildren<ArkSplitPaneStyleOptions & {
10
11
  sizes: number[];
11
12
  }>) => void;
12
13
  }>;
13
- export declare function ArkSplitPane(props: ArkSplitPaneProps): React.JSX.Element;
14
+ export declare const ArkSplitPane: React.ForwardRefExoticComponent<ArkSplitPaneStyleOptions & {
15
+ /** Tamanhos dos paineis em percentuais, na ordem dos filhos (ex.: [30, 70]); faltantes sao distribuidos. */
16
+ sizes?: number[];
17
+ className?: string;
18
+ /** Tamanhos mudaram por arrasto ou teclado: detail.sizes e a lista normalizada. Persistir e do app. */
19
+ onResize?: (event: CustomEvent<{
20
+ sizes: number[];
21
+ }>) => void;
22
+ } & {
23
+ children?: React.ReactNode | undefined;
24
+ } & React.RefAttributes<ArkSplitPaneElement>>;