@tooark/react 1.8.0 → 1.9.1

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 CHANGED
@@ -171,8 +171,8 @@ Installed automatically unless marked as peer; peer dependencies are yours to in
171
171
 
172
172
  | Package | Version | Description |
173
173
  | -------------------------------------------------------------------------------- | ----------------------- | ---------------------------------------------------------------- |
174
- | [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.8.0 | Types, i18n, toast/announce services, motion and overlay helpers |
175
- | [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.8.0 | The `ark-*` Custom Elements and their stylesheet |
174
+ | [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.9.1 | Types, i18n, toast/announce services, motion and overlay helpers |
175
+ | [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.9.1 | The `ark-*` Custom Elements and their stylesheet |
176
176
  | [`react`](https://www.npmjs.com/package/react) | >=18 (peer) | React 18 or 19 |
177
177
  | [`react-dom`](https://www.npmjs.com/package/react-dom) | >=18 (peer) | React DOM renderer |
178
178
  | [`@tooark/chart`](https://www.npmjs.com/package/@tooark/chart) | >=1.0.0 (optional peer) | ark-chart, for the `/chart` subpath |
package/README.pt-BR.md CHANGED
@@ -171,8 +171,8 @@ Instaladas automaticamente, salvo as marcadas como peer, que ficam por sua conta
171
171
 
172
172
  | Pacote | Versão | Descrição |
173
173
  | -------------------------------------------------------------------------------- | ----------------------- | -------------------------------------------------------------------- |
174
- | [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.8.0 | Tipos, i18n, serviços de toast/announce, motion e helpers de overlay |
175
- | [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.8.0 | Os Custom Elements `ark-*` e a folha de estilo deles |
174
+ | [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.9.1 | Tipos, i18n, serviços de toast/announce, motion e helpers de overlay |
175
+ | [`@tooark/web-components`](https://www.npmjs.com/package/@tooark/web-components) | ^1.9.1 | Os Custom Elements `ark-*` e a folha de estilo deles |
176
176
  | [`react`](https://www.npmjs.com/package/react) | >=18 (peer) | React 18 ou 19 |
177
177
  | [`react-dom`](https://www.npmjs.com/package/react-dom) | >=18 (peer) | Renderizador React DOM |
178
178
  | [`@tooark/chart`](https://www.npmjs.com/package/@tooark/chart) | >=1.0.0 (peer opcional) | ark-chart, para a subpath `/chart` |
@@ -1,5 +1,5 @@
1
- import type { ArkButtonNavigateDetail, ArkButtonStyleOptions, ArkButtonType } from "@tooark/core";
2
- import type { ArkButton as ArkButtonElement } from "@tooark/web-components";
1
+ import type { ArkButtonGroupStyleOptions, ArkButtonNavigateDetail, ArkButtonStyleOptions, ArkButtonType } from "@tooark/core";
2
+ import type { ArkButton as ArkButtonElement, ArkButtonGroup as ArkButtonGroupElement } from "@tooark/web-components";
3
3
  import type React from "react";
4
4
  import { type PropsWithChildren } from "react";
5
5
  import { type ArkDomProps } from "./dom-props.js";
@@ -22,3 +22,20 @@ export declare const ArkButton: React.ForwardRefExoticComponent<ArkButtonStyleOp
22
22
  } & Omit<React.HTMLAttributes<HTMLElement>, "children" | "form" | keyof ArkButtonStyleOptions | "type" | "disabled" | "onNavigate"> & {
23
23
  children?: React.ReactNode | undefined;
24
24
  } & React.RefAttributes<ArkButtonElement>>;
25
+ /** Props do ArkButtonGroup: variant, intent, size, rounded e theme valem para todos os botões do grupo. */
26
+ export type ArkButtonGroupProps = PropsWithChildren<ArkDomProps<ArkButtonGroupStyleOptions & {
27
+ /** Desabilita todos os botões do grupo. */
28
+ disabled?: boolean;
29
+ /** Nome do grupo (vira `aria-label`). */
30
+ label?: string;
31
+ className?: string;
32
+ }>>;
33
+ export declare const ArkButtonGroup: React.ForwardRefExoticComponent<ArkButtonGroupStyleOptions & {
34
+ /** Desabilita todos os botões do grupo. */
35
+ disabled?: boolean;
36
+ /** Nome do grupo (vira `aria-label`). */
37
+ label?: string;
38
+ className?: string;
39
+ } & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "label" | "disabled" | keyof ArkButtonGroupStyleOptions> & {
40
+ children?: React.ReactNode | undefined;
41
+ } & React.RefAttributes<ArkButtonGroupElement>>;
@@ -32,3 +32,18 @@ export const ArkButton = forwardRef(function ArkButton(props, forwardedRef) {
32
32
  };
33
33
  return createElement("ark-button", attrs, children);
34
34
  });
35
+ export const ArkButtonGroup = forwardRef(function ArkButtonGroup(props, forwardedRef) {
36
+ const { children, className, spaced, fullWidth, disabled, ...rest } = props;
37
+ useEffect(() => {
38
+ ensureTooarkComponentsRegistered();
39
+ }, []);
40
+ const attrs = {
41
+ ...domAttrs(rest),
42
+ ref: forwardedRef,
43
+ class: className,
44
+ spaced: spaced ? "" : undefined,
45
+ "full-width": fullWidth ? "" : undefined,
46
+ disabled: disabled ? "" : undefined
47
+ };
48
+ return createElement("ark-button-group", attrs, children);
49
+ });
@@ -1,5 +1,5 @@
1
- import type { ArkRadioStyleOptions } from "@tooark/core";
2
- import type { ArkRadio as ArkRadioElement } from "@tooark/web-components";
1
+ import type { ArkRadioGroupStyleOptions, ArkRadioStyleOptions } from "@tooark/core";
2
+ import type { ArkRadio as ArkRadioElement, ArkRadioGroup as ArkRadioGroupElement } from "@tooark/web-components";
3
3
  import React, { type PropsWithChildren } from "react";
4
4
  import { type ArkDomProps } from "./dom-props.js";
5
5
  export type ArkRadioProps = PropsWithChildren<ArkDomProps<ArkRadioStyleOptions & {
@@ -36,3 +36,52 @@ export declare const ArkRadio: React.ForwardRefExoticComponent<ArkRadioStyleOpti
36
36
  } & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "onChange" | "label" | "name" | "disabled" | "value" | "helper" | keyof ArkRadioStyleOptions> & {
37
37
  children?: React.ReactNode | undefined;
38
38
  } & React.RefAttributes<ArkRadioElement>>;
39
+ /** Props do ArkRadioGroup: name, size, intent e theme valem para todos os rádios do grupo. */
40
+ export type ArkRadioGroupProps = PropsWithChildren<ArkDomProps<ArkRadioGroupStyleOptions & {
41
+ /** O `value` do rádio marcado; atribuído, marca o rádio desse valor. */
42
+ value?: string;
43
+ /** `name` gravado em cada rádio, para o formulário. */
44
+ name?: string;
45
+ /** Legenda própria do grupo. */
46
+ label?: string;
47
+ /** Texto de apoio abaixo do grupo. */
48
+ helper?: string;
49
+ /** Marca o grupo como inválido, com ou sem mensagem. */
50
+ error?: boolean;
51
+ /** Mensagem de erro abaixo do grupo (vence o helper e marca inválido). */
52
+ errorMessage?: string;
53
+ /** Escolha obrigatória (aria-required). */
54
+ required?: boolean;
55
+ /** Desabilita todos os rádios do grupo. */
56
+ disabled?: boolean;
57
+ className?: string;
58
+ /** Um só por mudança, do grupo, com o `value` do rádio que ganhou a marca. */
59
+ onChange?: (event: CustomEvent<{
60
+ value: string;
61
+ }>) => void;
62
+ }>>;
63
+ export declare const ArkRadioGroup: React.ForwardRefExoticComponent<ArkRadioGroupStyleOptions & {
64
+ /** O `value` do rádio marcado; atribuído, marca o rádio desse valor. */
65
+ value?: string;
66
+ /** `name` gravado em cada rádio, para o formulário. */
67
+ name?: string;
68
+ /** Legenda própria do grupo. */
69
+ label?: string;
70
+ /** Texto de apoio abaixo do grupo. */
71
+ helper?: string;
72
+ /** Marca o grupo como inválido, com ou sem mensagem. */
73
+ error?: boolean;
74
+ /** Mensagem de erro abaixo do grupo (vence o helper e marca inválido). */
75
+ errorMessage?: string;
76
+ /** Escolha obrigatória (aria-required). */
77
+ required?: boolean;
78
+ /** Desabilita todos os rádios do grupo. */
79
+ disabled?: boolean;
80
+ className?: string;
81
+ /** Um só por mudança, do grupo, com o `value` do rádio que ganhou a marca. */
82
+ onChange?: (event: CustomEvent<{
83
+ value: string;
84
+ }>) => void;
85
+ } & Omit<React.HTMLAttributes<HTMLElement>, "children" | "className" | "onChange" | "error" | "label" | "name" | "disabled" | "value" | "helper" | "errorMessage" | "required" | keyof ArkRadioGroupStyleOptions> & {
86
+ children?: React.ReactNode | undefined;
87
+ } & React.RefAttributes<ArkRadioGroupElement>>;
package/dist/ark-radio.js CHANGED
@@ -25,3 +25,32 @@ export const ArkRadio = forwardRef(function ArkRadio(props, forwardedRef) {
25
25
  };
26
26
  return createElement("ark-radio", attrs, children);
27
27
  });
28
+ export const ArkRadioGroup = forwardRef(function ArkRadioGroup(props, forwardedRef) {
29
+ const { children, className, error, errorMessage, required, disabled, onChange, ...rest } = props;
30
+ useEffect(() => {
31
+ ensureTooarkComponentsRegistered();
32
+ }, []);
33
+ const [ref, setRef] = useForwardedRef(forwardedRef);
34
+ useEffect(() => {
35
+ const el = ref.current;
36
+ if (!el || !onChange)
37
+ return;
38
+ // O grupo para o `change` dos rádios e publica o próprio: só o dele (target no host) chega aqui.
39
+ const handler = (event) => {
40
+ if (event.target === el)
41
+ onChange(event);
42
+ };
43
+ el.addEventListener("change", handler);
44
+ return () => el.removeEventListener("change", handler);
45
+ }, [ref, onChange]);
46
+ const attrs = {
47
+ ...domAttrs(rest),
48
+ ref: setRef,
49
+ class: className,
50
+ error: error ? "" : undefined,
51
+ "error-message": errorMessage || undefined,
52
+ required: required ? "" : undefined,
53
+ disabled: disabled ? "" : undefined
54
+ };
55
+ return createElement("ark-radio-group", attrs, children);
56
+ });
package/dist/index.d.ts CHANGED
@@ -6,8 +6,8 @@ export type { ArkAvatarProps } from "./ark-avatar.js";
6
6
  export { ArkAvatar } from "./ark-avatar.js";
7
7
  export type { ArkBadgeProps } from "./ark-badge.js";
8
8
  export { ArkBadge } from "./ark-badge.js";
9
- export type { ArkButtonProps } from "./ark-button.js";
10
- export { ArkButton } from "./ark-button.js";
9
+ export type { ArkButtonGroupProps, ArkButtonProps } from "./ark-button.js";
10
+ export { ArkButton, ArkButtonGroup } from "./ark-button.js";
11
11
  export type { ArkCalendarProps } from "./ark-calendar.js";
12
12
  export { ArkCalendar } from "./ark-calendar.js";
13
13
  export type { ArkCardProps } from "./ark-card.js";
@@ -52,8 +52,8 @@ export type { ArkPaginationProps } from "./ark-pagination.js";
52
52
  export { ArkPagination } from "./ark-pagination.js";
53
53
  export type { ArkProgressProps } from "./ark-progress.js";
54
54
  export { ArkProgress } from "./ark-progress.js";
55
- export type { ArkRadioProps } from "./ark-radio.js";
56
- export { ArkRadio } from "./ark-radio.js";
55
+ export type { ArkRadioGroupProps, ArkRadioProps } from "./ark-radio.js";
56
+ export { ArkRadio, ArkRadioGroup } from "./ark-radio.js";
57
57
  export type { ArkSchedulerProps } from "./ark-scheduler.js";
58
58
  export { ArkScheduler } from "./ark-scheduler.js";
59
59
  export type { ArkSelectProps } from "./ark-select.js";
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ export { dismissToast, getArkLocale, observeArkLocale, setArkLocale, showToast,
2
2
  export { ArkAlert } from "./ark-alert.js";
3
3
  export { ArkAvatar } from "./ark-avatar.js";
4
4
  export { ArkBadge } from "./ark-badge.js";
5
- export { ArkButton } from "./ark-button.js";
5
+ export { ArkButton, ArkButtonGroup } from "./ark-button.js";
6
6
  export { ArkCalendar } from "./ark-calendar.js";
7
7
  export { ArkCard } from "./ark-card.js";
8
8
  export { ArkCarousel } from "./ark-carousel.js";
@@ -25,7 +25,7 @@ export { ArkMenu, ArkMenuGroup, ArkMenuItem } from "./ark-menu.js";
25
25
  export { ArkNav, ArkNavGroup, ArkNavItem } from "./ark-nav.js";
26
26
  export { ArkPagination } from "./ark-pagination.js";
27
27
  export { ArkProgress } from "./ark-progress.js";
28
- export { ArkRadio } from "./ark-radio.js";
28
+ export { ArkRadio, ArkRadioGroup } from "./ark-radio.js";
29
29
  export { ArkScheduler } from "./ark-scheduler.js";
30
30
  export { ArkSelect } from "./ark-select.js";
31
31
  export { ArkShapePicker } from "./ark-shape-picker.js";
@@ -25,6 +25,7 @@ import type {
25
25
  ArkNavCollapsible,
26
26
  ArkNavSide,
27
27
  ArkNavVariant,
28
+ ArkOrientation,
28
29
  ArkRounded,
29
30
  ArkSize,
30
31
  ArkTabsFill,
@@ -117,6 +118,34 @@ interface ArkIntrinsicElements {
117
118
  size?: ArkSize;
118
119
  theme?: ArkTheme;
119
120
  };
121
+ "ark-button-group": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
122
+ testid?: string;
123
+ orientation?: ArkOrientation;
124
+ spaced?: boolean;
125
+ "full-width"?: boolean;
126
+ disabled?: boolean;
127
+ label?: string;
128
+ variant?: ArkButtonVariant;
129
+ intent?: ArkIntent;
130
+ size?: ArkSize;
131
+ rounded?: ArkRounded;
132
+ theme?: ArkTheme;
133
+ };
134
+ "ark-radio-group": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
135
+ testid?: string;
136
+ value?: string;
137
+ name?: string;
138
+ label?: string;
139
+ helper?: string;
140
+ error?: boolean;
141
+ "error-message"?: string;
142
+ orientation?: ArkOrientation;
143
+ required?: boolean;
144
+ disabled?: boolean;
145
+ intent?: ArkIntent;
146
+ size?: ArkSize;
147
+ theme?: ArkTheme;
148
+ };
120
149
  "ark-radio": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
121
150
  testid?: string;
122
151
  checked?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tooark/react",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
4
4
  "description": "Tooark React — typed wrappers for ark-* components for React 18 and 19",
5
5
  "keywords": [
6
6
  "tooark",
@@ -100,13 +100,13 @@
100
100
  }
101
101
  },
102
102
  "dependencies": {
103
- "@tooark/core": "^1.8.0",
104
- "@tooark/web-components": "^1.8.0"
103
+ "@tooark/core": "^1.9.1",
104
+ "@tooark/web-components": "^1.9.1"
105
105
  },
106
106
  "devDependencies": {
107
- "@tooark/chart": "^1.8.0",
108
- "@tooark/code": "^1.8.0",
109
- "@tooark/wysiwyg": "^1.8.0"
107
+ "@tooark/chart": "^1.9.1",
108
+ "@tooark/code": "^1.9.1",
109
+ "@tooark/wysiwyg": "^1.9.1"
110
110
  },
111
111
  "scripts": {
112
112
  "build": "tsc -p tsconfig.json && tsc -p tsconfig.typecheck.json && node postbuild.mjs",