@tangible/ui 0.0.12 → 0.0.14

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.
@@ -8,4 +8,4 @@ import type { AvatarProps } from './types';
8
8
  * - Shows placeholder icon if neither `src` nor `name` provided
9
9
  * - Colors for initials are derived from the name hash for consistency
10
10
  */
11
- export declare const Avatar: React.NamedExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
11
+ export declare const Avatar: React.MemoExoticComponent<React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>>;
@@ -19,4 +19,4 @@ export interface IconProps {
19
19
  * - Decorative icons (no label): automatically hidden from screen readers
20
20
  * - Informative icons: provide a `label` prop for screen reader announcement
21
21
  */
22
- export declare const Icon: React.NamedExoticComponent<IconProps & React.RefAttributes<HTMLSpanElement>>;
22
+ export declare const Icon: React.MemoExoticComponent<React.ForwardRefExoticComponent<IconProps & React.RefAttributes<HTMLSpanElement>>>;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { SizeStandard } from '../../types';
3
- type Size = SizeStandard;
4
- export type ModalProps = {
3
+ type Size = SizeStandard | 'xl';
4
+ export type ModalProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'role' | 'aria-modal' | 'tabIndex' | 'children'> & {
5
5
  open: boolean;
6
6
  onClose: () => void;
7
7
  size?: Size;
@@ -21,9 +21,12 @@ export type ModalProps = {
21
21
  * when focus is restored on close. Useful when the trigger may be off-screen
22
22
  * inside a scrollable container. Default: false. */
23
23
  preventScrollOnRestore?: boolean;
24
+ /** Additional class names applied to the dialog element (`.tui-modal__dialog`).
25
+ * Use for layout tweaks, custom widths, or context-specific theming. */
26
+ className?: string;
24
27
  children?: React.ReactNode;
25
28
  };
26
- declare function ModalRoot({ open, onClose, size, stickyHead, stickyFoot, 'aria-labelledby': labelledBy, 'aria-describedby': describedBy, initialFocusSelector, container, showCloseButton, closeLabel, closeOnBackdropClick, closeOnEscape, preventScrollOnRestore, children, }: ModalProps): React.ReactPortal | null;
29
+ declare function ModalRoot({ open, onClose, size, stickyHead, stickyFoot, 'aria-labelledby': labelledBy, 'aria-describedby': describedBy, initialFocusSelector, container, showCloseButton, closeLabel, closeOnBackdropClick, closeOnEscape, preventScrollOnRestore, className, children, ...rest }: ModalProps): React.ReactPortal | null;
27
30
  type ModalCloseProps = {
28
31
  label?: string;
29
32
  className?: string;
@@ -8,11 +8,22 @@ import { useFocusTrap, getInitialFocus } from '../../utils/focus-trap.js';
8
8
  import { ModalContext, useModalContext } from './context.js';
9
9
  import { IconButton } from '../IconButton/index.js';
10
10
  const isBrowser = typeof document !== 'undefined';
11
- function ModalRoot({ open, onClose, size = 'md', stickyHead, stickyFoot, 'aria-labelledby': labelledBy, 'aria-describedby': describedBy, initialFocusSelector, container, showCloseButton, closeLabel = 'Close', closeOnBackdropClick = true, closeOnEscape = true, preventScrollOnRestore = false, children, }) {
11
+ function ModalRoot({ open, onClose, size = 'md', stickyHead, stickyFoot, 'aria-labelledby': labelledBy, 'aria-describedby': describedBy, initialFocusSelector, container, showCloseButton, closeLabel = 'Close', closeOnBackdropClick = true, closeOnEscape = true, preventScrollOnRestore = false, className, children, ...rest }) {
12
12
  const dialogRef = useRef(null);
13
13
  const restoreRef = useRef(null);
14
14
  const warnedRef = useRef(false);
15
+ const warnedAriaLabelRef = useRef(false);
15
16
  const [mount, setMount] = useState(null);
17
+ // Dev warning: aria-label via ...rest silently competes with aria-labelledby
18
+ // (labelledby wins per AccName 1.2 step 2B, leaving aria-label dead code).
19
+ useEffect(() => {
20
+ if (isDev() && !warnedAriaLabelRef.current && open && labelledBy && 'aria-label' in rest) {
21
+ warnedAriaLabelRef.current = true;
22
+ console.warn('[TUI Modal] Both `aria-labelledby` and `aria-label` are set. ' +
23
+ '`aria-labelledby` takes precedence; `aria-label` is ignored. ' +
24
+ 'Remove one. Prefer `aria-labelledby` referencing a visible heading.');
25
+ }
26
+ }, [open, labelledBy, rest]);
16
27
  // Dev warning: Modal should have an accessible name
17
28
  useEffect(() => {
18
29
  if (isDev() && !warnedRef.current && open && !labelledBy) {
@@ -130,7 +141,7 @@ function ModalRoot({ open, onClose, size = 'md', stickyHead, stickyFoot, 'aria-l
130
141
  const contextValue = useMemo(() => ({ onClose }), [onClose]);
131
142
  if (!open || !mount)
132
143
  return null;
133
- return createPortal(_jsx(ModalContext.Provider, { value: contextValue, children: _jsxs("div", { className: "tui-modal", "data-state": "open", style: { pointerEvents: 'auto' }, children: [_jsx("div", { className: "tui-modal__backdrop", onClick: closeOnBackdropClick ? onClose : undefined }), _jsxs("div", { ref: dialogRef, role: "dialog", "aria-modal": "true", "aria-labelledby": labelledBy, "aria-describedby": describedBy, className: cx('tui-modal__dialog', `is-size-${size}`, stickyHead && 'is-sticky-head', stickyFoot && 'is-sticky-foot'), tabIndex: -1, children: [showCloseButton && (_jsx(IconButton, { icon: "system/close", label: closeLabel, variant: "ghost", size: "sm", onClick: onClose, className: "tui-modal__close", showTooltip: true })), children] })] }) }), mount);
144
+ return createPortal(_jsx(ModalContext.Provider, { value: contextValue, children: _jsxs("div", { className: "tui-modal", "data-state": "open", style: { pointerEvents: 'auto' }, children: [_jsx("div", { className: "tui-modal__backdrop", onClick: closeOnBackdropClick ? onClose : undefined }), _jsxs("div", { ref: dialogRef, role: "dialog", "aria-modal": "true", "aria-labelledby": labelledBy, "aria-describedby": describedBy, className: cx('tui-modal__dialog', `is-size-${size}`, stickyHead && 'is-sticky-head', stickyFoot && 'is-sticky-foot', className), tabIndex: -1, ...rest, children: [showCloseButton && (_jsx(IconButton, { icon: "system/close", label: closeLabel, variant: "ghost", size: "sm", onClick: onClose, className: "tui-modal__close", showTooltip: true })), children] })] }) }), mount);
134
145
  }
135
146
  function ModalClose({ label = 'Close', className }) {
136
147
  const { onClose } = useModalContext();
@@ -1,2 +1,2 @@
1
1
  import type { MoveHandleProps } from './types';
2
- export declare const MoveHandle: import("react").NamedExoticComponent<MoveHandleProps & import("react").RefAttributes<HTMLElement>>;
2
+ export declare const MoveHandle: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<MoveHandleProps & import("react").RefAttributes<HTMLElement>>>;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { JSX } from 'react';
3
- import type { ThemeStatus } from '../../types';
3
+ import type { ThemeStatus, SizeStandard } from '../../types';
4
4
  type RootAs = 'section' | 'div';
5
5
  type HeadingAs = 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
6
6
  type NoticeTheme = ThemeStatus;
@@ -20,6 +20,11 @@ type CommonProps = {
20
20
  disabled?: boolean;
21
21
  /** Show left accent stripe in theme color */
22
22
  stripe?: boolean;
23
+ /**
24
+ * Scale of padding, internal gap, title typography, and body text.
25
+ * Default 'md' emits no class.
26
+ */
27
+ size?: SizeStandard;
23
28
  className?: string;
24
29
  style?: React.CSSProperties;
25
30
  };
@@ -9,7 +9,7 @@ function prefersReducedMotion() {
9
9
  return false;
10
10
  return window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
11
11
  }
12
- export const Notice = forwardRef(function Notice({ as = 'section', inline, elevated, interactive, disabled, stripe, className, style, onClick, theme = 'info', announce = 'off', 'aria-label': ariaLabel, dismissible, onDismiss, dismissLabel = 'Dismiss', exitAnimation = 'none', focusable, children, ...rest }, ref) {
12
+ export const Notice = forwardRef(function Notice({ as = 'section', inline, elevated, interactive, disabled, stripe, size, className, style, onClick, theme = 'info', announce = 'off', 'aria-label': ariaLabel, dismissible, onDismiss, dismissLabel = 'Dismiss', exitAnimation = 'none', focusable, children, ...rest }, ref) {
13
13
  const Tag = as;
14
14
  const innerRef = useRef(null);
15
15
  const [isExiting, setIsExiting] = useState(false);
@@ -119,7 +119,7 @@ export const Notice = forwardRef(function Notice({ as = 'section', inline, eleva
119
119
  // useLayoutEffect in NoticeHead ensures hasTitle is set before first paint.
120
120
  const computedLabelledBy = hasTitle ? titleId : undefined;
121
121
  const computedAriaLabel = hasTitle ? undefined : (ariaLabel || undefined);
122
- const classes = cx('tui-notice', `is-theme-${theme}`, inline && 'is-layout-inline', elevated && 'is-style-elevated', interactive && 'has-interaction', disabled && 'is-disabled', stripe && 'has-stripe', dismissible && 'is-dismissible', focusable && 'is-focusable', isExiting && exitType && `is-exiting-${exitType}`, className);
122
+ const classes = cx('tui-notice', `is-theme-${theme}`, size && size !== 'md' && `is-size-${size}`, inline && 'is-layout-inline', elevated && 'is-style-elevated', interactive && 'has-interaction', disabled && 'is-disabled', stripe && 'has-stripe', dismissible && 'is-dismissible', focusable && 'is-focusable', isExiting && exitType && `is-exiting-${exitType}`, className);
123
123
  // Dismiss button component
124
124
  const dismissButton = dismissible && (_jsx(IconButton, { icon: "system/close", label: dismissLabel, size: "sm", variant: "ghost", className: "tui-notice__dismiss", onClick: (e) => {
125
125
  e.stopPropagation();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangible/ui",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Tangible Design System",
5
5
  "type": "module",
6
6
  "main": "./components/index.js",
@@ -46,53 +46,155 @@
46
46
  "./icons/manifest": "./icons/manifest.json",
47
47
  "./icons/*": "./icons/*",
48
48
  "./manifest.json": "./tui-manifest.json",
49
- "./components/Icon": {
50
- "import": "./components/Icon/Icon.js",
51
- "types": "./components/Icon/Icon.d.ts"
49
+ "./components/Accordion": {
50
+ "import": "./components/Accordion/index.js",
51
+ "types": "./components/Accordion/index.d.ts"
52
+ },
53
+ "./components/Avatar": {
54
+ "import": "./components/Avatar/index.js",
55
+ "types": "./components/Avatar/index.d.ts"
52
56
  },
53
57
  "./components/Button": {
54
- "import": "./components/Button/Button.js",
55
- "types": "./components/Button/Button.d.ts"
58
+ "import": "./components/Button/index.js",
59
+ "types": "./components/Button/index.d.ts"
60
+ },
61
+ "./components/Card": {
62
+ "import": "./components/Card/index.js",
63
+ "types": "./components/Card/index.d.ts"
64
+ },
65
+ "./components/Checkbox": {
66
+ "import": "./components/Checkbox/index.js",
67
+ "types": "./components/Checkbox/index.d.ts"
68
+ },
69
+ "./components/Chip": {
70
+ "import": "./components/Chip/index.js",
71
+ "types": "./components/Chip/index.d.ts"
72
+ },
73
+ "./components/ChipGroup": {
74
+ "import": "./components/ChipGroup/index.js",
75
+ "types": "./components/ChipGroup/index.d.ts"
76
+ },
77
+ "./components/Chips": {
78
+ "import": "./components/Chips/index.js",
79
+ "types": "./components/Chips/index.d.ts"
80
+ },
81
+ "./components/Combobox": {
82
+ "import": "./components/Combobox/index.js",
83
+ "types": "./components/Combobox/index.d.ts"
84
+ },
85
+ "./components/ContentIndicator": {
86
+ "import": "./components/ContentIndicator/index.js",
87
+ "types": "./components/ContentIndicator/index.d.ts"
88
+ },
89
+ "./components/Dropdown": {
90
+ "import": "./components/Dropdown/index.js",
91
+ "types": "./components/Dropdown/index.d.ts"
92
+ },
93
+ "./components/Field": {
94
+ "import": "./components/Field/index.js",
95
+ "types": "./components/Field/index.d.ts"
96
+ },
97
+ "./components/Icon": {
98
+ "import": "./components/Icon/index.js",
99
+ "types": "./components/Icon/index.d.ts"
56
100
  },
57
101
  "./components/IconButton": {
58
- "import": "./components/IconButton/IconButton.js",
59
- "types": "./components/IconButton/IconButton.d.ts"
102
+ "import": "./components/IconButton/index.js",
103
+ "types": "./components/IconButton/index.d.ts"
60
104
  },
61
105
  "./components/Modal": {
62
- "import": "./components/Modal/Modal.js",
63
- "types": "./components/Modal/Modal.d.ts"
106
+ "import": "./components/Modal/index.js",
107
+ "types": "./components/Modal/index.d.ts"
64
108
  },
65
- "./components/SegmentedControl": {
66
- "import": "./components/SegmentedControl/SegmentedControl.js",
67
- "types": "./components/SegmentedControl/SegmentedControl.d.ts"
109
+ "./components/MoveHandle": {
110
+ "import": "./components/MoveHandle/index.js",
111
+ "types": "./components/MoveHandle/index.d.ts"
112
+ },
113
+ "./components/MultiSelect": {
114
+ "import": "./components/MultiSelect/index.js",
115
+ "types": "./components/MultiSelect/index.d.ts"
116
+ },
117
+ "./components/Notice": {
118
+ "import": "./components/Notice/index.js",
119
+ "types": "./components/Notice/index.d.ts"
68
120
  },
69
121
  "./components/OverlapStack": {
70
- "import": "./components/OverlapStack/OverlapStack.js",
71
- "types": "./components/OverlapStack/OverlapStack.d.ts"
122
+ "import": "./components/OverlapStack/index.js",
123
+ "types": "./components/OverlapStack/index.d.ts"
72
124
  },
73
- "./components/Tooltip": {
74
- "import": "./components/Tooltip/Tooltip.js",
75
- "types": "./components/Tooltip/Tooltip.d.ts"
125
+ "./components/Pager": {
126
+ "import": "./components/Pager/index.js",
127
+ "types": "./components/Pager/index.d.ts"
76
128
  },
77
- "./components/Dropdown": {
78
- "import": "./components/Dropdown/Dropdown.js",
79
- "types": "./components/Dropdown/Dropdown.d.ts"
129
+ "./components/Progress": {
130
+ "import": "./components/Progress/index.js",
131
+ "types": "./components/Progress/index.d.ts"
132
+ },
133
+ "./components/Radio": {
134
+ "import": "./components/Radio/index.js",
135
+ "types": "./components/Radio/index.d.ts"
136
+ },
137
+ "./components/Rating": {
138
+ "import": "./components/Rating/index.js",
139
+ "types": "./components/Rating/index.d.ts"
140
+ },
141
+ "./components/SegmentedControl": {
142
+ "import": "./components/SegmentedControl/index.js",
143
+ "types": "./components/SegmentedControl/index.d.ts"
144
+ },
145
+ "./components/Select": {
146
+ "import": "./components/Select/index.js",
147
+ "types": "./components/Select/index.d.ts"
148
+ },
149
+ "./components/Sidebar": {
150
+ "import": "./components/Sidebar/index.js",
151
+ "types": "./components/Sidebar/index.d.ts"
152
+ },
153
+ "./components/StepIndicator": {
154
+ "import": "./components/StepIndicator/index.js",
155
+ "types": "./components/StepIndicator/index.d.ts"
156
+ },
157
+ "./components/StepList": {
158
+ "import": "./components/StepList/index.js",
159
+ "types": "./components/StepList/index.d.ts"
160
+ },
161
+ "./components/Switch": {
162
+ "import": "./components/Switch/index.js",
163
+ "types": "./components/Switch/index.d.ts"
164
+ },
165
+ "./components/Table": {
166
+ "import": "./components/Table/index.js",
167
+ "types": "./components/Table/index.d.ts"
168
+ },
169
+ "./components/Tabs": {
170
+ "import": "./components/Tabs/index.js",
171
+ "types": "./components/Tabs/index.d.ts"
172
+ },
173
+ "./components/TextInput": {
174
+ "import": "./components/TextInput/index.js",
175
+ "types": "./components/TextInput/index.d.ts"
176
+ },
177
+ "./components/Textarea": {
178
+ "import": "./components/Textarea/index.js",
179
+ "types": "./components/Textarea/index.d.ts"
180
+ },
181
+ "./components/Toolbar": {
182
+ "import": "./components/Toolbar/index.js",
183
+ "types": "./components/Toolbar/index.d.ts"
184
+ },
185
+ "./components/Tooltip": {
186
+ "import": "./components/Tooltip/index.js",
187
+ "types": "./components/Tooltip/index.d.ts"
80
188
  }
81
189
  },
190
+ "dependencies": {
191
+ "@floating-ui/react": "^0.27.16",
192
+ "@tanstack/react-table": "^8.21.3"
193
+ },
82
194
  "peerDependencies": {
83
- "@floating-ui/react": ">=0.27.0",
84
- "@tanstack/react-table": ">=8.0.0",
85
195
  "react": ">=18.0.0",
86
196
  "react-dom": ">=18.0.0"
87
197
  },
88
- "peerDependenciesMeta": {
89
- "@floating-ui/react": {
90
- "optional": true
91
- },
92
- "@tanstack/react-table": {
93
- "optional": true
94
- }
95
- },
96
198
  "homepage": "https://github.com/tangibleinc/tangible-ui",
97
199
  "repository": {
98
200
  "url": "git+ssh://git@github.com/tangibleinc/tangible-ui.git"