@colletdev/react 0.1.7 → 0.1.9

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.
@@ -1,7 +1,7 @@
1
1
  import type React from 'react';
2
2
  export interface TextProps {
3
3
  id?: string;
4
- role?: 'display' | 'h1' | 'h2' | 'h3' | 'label-lg' | 'label-md' | 'label-sm' | 'body-lg' | 'body-md' | 'body-sm' | 'overline' | 'caption' | 'code';
4
+ textRole?: 'display' | 'h1' | 'h2' | 'h3' | 'label-lg' | 'label-md' | 'label-sm' | 'body-lg' | 'body-md' | 'body-sm' | 'overline' | 'caption' | 'code';
5
5
  align?: 'start' | 'center' | 'end';
6
6
  color?: 'primary' | 'inverse' | 'muted';
7
7
  muted?: boolean;
@@ -3,17 +3,6 @@ import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
3
3
  export const Text = forwardRef((props, forwardedRef) => {
4
4
  const ref = useRef(null);
5
5
  useImperativeHandle(forwardedRef, () => ref.current);
6
- useEffect(() => {
7
- const el = ref.current;
8
- if (!el)
9
- return;
10
- if (props.role != null) {
11
- el.setAttribute('role', String(props.role));
12
- }
13
- else {
14
- el.removeAttribute('role');
15
- }
16
- }, [props.role]);
17
6
  useEffect(() => {
18
7
  const el = ref.current;
19
8
  if (!el)
@@ -51,6 +40,8 @@ export const Text = forwardRef((props, forwardedRef) => {
51
40
  const attrs = {};
52
41
  if (props.id != null)
53
42
  attrs['id'] = typeof props.id === 'object' ? JSON.stringify(props.id) : String(props.id);
43
+ if (props.textRole != null)
44
+ attrs['text-role'] = typeof props.textRole === 'object' ? JSON.stringify(props.textRole) : String(props.textRole);
54
45
  if (props.muted)
55
46
  attrs['muted'] = '';
56
47
  if (props.strong)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colletdev/react",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "React wrappers for Collet Rust/WASM UI components",
5
5
  "type": "module",
6
6
  "main": "dist/generated/index.js",