@udixio/ui-react 2.9.9 → 2.9.10
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/CHANGELOG.md +12 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +1826 -1813
- package/dist/lib/components/Button.d.ts +6 -0
- package/dist/lib/components/Button.d.ts.map +1 -1
- package/dist/lib/components/Card.d.ts +4 -0
- package/dist/lib/components/Card.d.ts.map +1 -1
- package/dist/lib/components/Carousel.d.ts +4 -0
- package/dist/lib/components/Carousel.d.ts.map +1 -1
- package/dist/lib/components/CarouselItem.d.ts +4 -0
- package/dist/lib/components/CarouselItem.d.ts.map +1 -1
- package/dist/lib/components/Chip.d.ts +7 -0
- package/dist/lib/components/Chip.d.ts.map +1 -1
- package/dist/lib/components/Chips.d.ts +10 -0
- package/dist/lib/components/Chips.d.ts.map +1 -1
- package/dist/lib/components/Divider.d.ts +2 -0
- package/dist/lib/components/Divider.d.ts.map +1 -1
- package/dist/lib/components/Fab.d.ts +4 -0
- package/dist/lib/components/Fab.d.ts.map +1 -1
- package/dist/lib/components/FabMenu.d.ts +7 -0
- package/dist/lib/components/FabMenu.d.ts.map +1 -1
- package/dist/lib/components/IconButton.d.ts +7 -2
- package/dist/lib/components/IconButton.d.ts.map +1 -1
- package/dist/lib/components/NavigationRail.d.ts +6 -0
- package/dist/lib/components/NavigationRail.d.ts.map +1 -1
- package/dist/lib/components/NavigationRailItem.d.ts +7 -0
- package/dist/lib/components/NavigationRailItem.d.ts.map +1 -1
- package/dist/lib/components/ProgressIndicator.d.ts +6 -0
- package/dist/lib/components/ProgressIndicator.d.ts.map +1 -1
- package/dist/lib/components/SideSheet.d.ts +7 -0
- package/dist/lib/components/SideSheet.d.ts.map +1 -1
- package/dist/lib/components/Slider.d.ts +5 -0
- package/dist/lib/components/Slider.d.ts.map +1 -1
- package/dist/lib/components/Snackbar.d.ts +6 -0
- package/dist/lib/components/Snackbar.d.ts.map +1 -1
- package/dist/lib/components/Switch.d.ts +4 -0
- package/dist/lib/components/Switch.d.ts.map +1 -1
- package/dist/lib/components/Tab.d.ts +5 -0
- package/dist/lib/components/Tab.d.ts.map +1 -1
- package/dist/lib/components/TabGroup.d.ts +4 -0
- package/dist/lib/components/TabGroup.d.ts.map +1 -1
- package/dist/lib/components/TabGroupContext.d.ts +4 -0
- package/dist/lib/components/TabGroupContext.d.ts.map +1 -1
- package/dist/lib/components/TabPanel.d.ts +2 -0
- package/dist/lib/components/TabPanel.d.ts.map +1 -1
- package/dist/lib/components/TabPanels.d.ts +4 -0
- package/dist/lib/components/TabPanels.d.ts.map +1 -1
- package/dist/lib/components/Tabs.d.ts +4 -0
- package/dist/lib/components/Tabs.d.ts.map +1 -1
- package/dist/lib/components/TextField.d.ts +5 -0
- package/dist/lib/components/TextField.d.ts.map +1 -1
- package/dist/lib/components/Tooltip.d.ts +5 -0
- package/dist/lib/components/Tooltip.d.ts.map +1 -1
- package/dist/lib/interfaces/fab.interface.d.ts +2 -1
- package/dist/lib/interfaces/fab.interface.d.ts.map +1 -1
- package/dist/lib/styles/fab-menu.style.d.ts +4 -4
- package/dist/lib/styles/fab.style.d.ts +4 -4
- package/dist/lib/styles/icon-button.style.d.ts +2 -2
- package/dist/lib/styles/tooltip.style.d.ts +2 -2
- package/package.json +1 -1
- package/src/lib/components/Button.tsx +6 -0
- package/src/lib/components/Card.tsx +4 -0
- package/src/lib/components/Carousel.tsx +4 -0
- package/src/lib/components/CarouselItem.tsx +4 -0
- package/src/lib/components/Chip.tsx +7 -0
- package/src/lib/components/Chips.tsx +10 -0
- package/src/lib/components/Divider.tsx +2 -0
- package/src/lib/components/Fab.tsx +4 -0
- package/src/lib/components/FabMenu.tsx +7 -0
- package/src/lib/components/IconButton.tsx +9 -5
- package/src/lib/components/NavigationRail.tsx +6 -0
- package/src/lib/components/NavigationRailItem.tsx +7 -0
- package/src/lib/components/ProgressIndicator.tsx +6 -0
- package/src/lib/components/SideSheet.tsx +7 -0
- package/src/lib/components/Slider.tsx +5 -0
- package/src/lib/components/Snackbar.tsx +6 -0
- package/src/lib/components/Switch.tsx +4 -0
- package/src/lib/components/Tab.tsx +5 -0
- package/src/lib/components/TabGroup.tsx +4 -0
- package/src/lib/components/TabGroupContext.tsx +6 -1
- package/src/lib/components/TabPanel.tsx +2 -0
- package/src/lib/components/TabPanels.tsx +4 -0
- package/src/lib/components/Tabs.tsx +4 -0
- package/src/lib/components/TextField.tsx +5 -0
- package/src/lib/components/Tooltip.tsx +46 -1
- package/src/lib/interfaces/fab.interface.ts +2 -1
|
@@ -41,7 +41,7 @@ export declare const toolStyle: (states: ({
|
|
|
41
41
|
content?: import('react').ReactNode;
|
|
42
42
|
buttons?: import('..').ReactProps<import('..').ButtonInterface> | import('..').ReactProps<import('..').ButtonInterface>[];
|
|
43
43
|
position?: "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
44
|
-
trigger?: ("
|
|
44
|
+
trigger?: ("hover" | "click" | "focus" | null) | ("hover" | "click" | "focus" | null)[];
|
|
45
45
|
transition?: import('motion').Transition;
|
|
46
46
|
openDelay?: number;
|
|
47
47
|
closeDelay?: number;
|
|
@@ -65,7 +65,7 @@ export declare const useToolTipStyle: (states: ({
|
|
|
65
65
|
content?: import('react').ReactNode;
|
|
66
66
|
buttons?: import('..').ReactProps<import('..').ButtonInterface> | import('..').ReactProps<import('..').ButtonInterface>[];
|
|
67
67
|
position?: "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
68
|
-
trigger?: ("
|
|
68
|
+
trigger?: ("hover" | "click" | "focus" | null) | ("hover" | "click" | "focus" | null)[];
|
|
69
69
|
transition?: import('motion').Transition;
|
|
70
70
|
openDelay?: number;
|
|
71
71
|
closeDelay?: number;
|
package/package.json
CHANGED
|
@@ -38,6 +38,12 @@ function resolveVariantAlias(
|
|
|
38
38
|
* Buttons prompt most actions in a UI
|
|
39
39
|
* @status beta
|
|
40
40
|
* @category Action
|
|
41
|
+
* @devx
|
|
42
|
+
* - Requires `label` or children; used for visible text and a11y.
|
|
43
|
+
* - `onToggle` uses internal state; pair with `activated` for controlled usage.
|
|
44
|
+
* @limitations
|
|
45
|
+
* - No explicit `type` prop; HTML button defaults may submit in forms.
|
|
46
|
+
* - When `href` is set, `disabled` is visual only (no `aria-disabled`).
|
|
41
47
|
*/
|
|
42
48
|
export const Button = ({
|
|
43
49
|
variant = 'filled',
|
|
@@ -8,6 +8,10 @@ import { State } from '../effects';
|
|
|
8
8
|
* Cards display content and actions about a single subject
|
|
9
9
|
* @status beta
|
|
10
10
|
* @category Layout
|
|
11
|
+
* @devx
|
|
12
|
+
* - `isInteractive` only adds a state layer; add your own click/role semantics.
|
|
13
|
+
* @limitations
|
|
14
|
+
* - No built-in header/actions slots; layout is fully custom via children.
|
|
11
15
|
*/
|
|
12
16
|
export const Card = ({
|
|
13
17
|
variant = 'outlined',
|
|
@@ -16,9 +16,13 @@ function clamp(v: number, min: number, max: number) {
|
|
|
16
16
|
*
|
|
17
17
|
* @status beta
|
|
18
18
|
* @category Layout
|
|
19
|
+
* @devx
|
|
20
|
+
* - Only `CarouselItem` children are rendered; other children are ignored.
|
|
21
|
+
* - Use `index` for controlled positioning; otherwise relies on internal scroll state.
|
|
19
22
|
* @limitations
|
|
20
23
|
* - Responsive behavior on mobile is not supported.
|
|
21
24
|
* - Only the default (hero) variant is supported.
|
|
25
|
+
* - No keyboard navigation or focus management.
|
|
22
26
|
*/
|
|
23
27
|
export const Carousel = ({
|
|
24
28
|
variant = 'hero',
|
|
@@ -21,6 +21,10 @@ export const normalize = (
|
|
|
21
21
|
/**
|
|
22
22
|
* @status beta
|
|
23
23
|
* @parent Carousel
|
|
24
|
+
* @devx
|
|
25
|
+
* - Intended for use inside `Carousel`; width and outputRange drive sizing.
|
|
26
|
+
* @limitations
|
|
27
|
+
* - Requires `outputRange` for min/max sizing; missing values can break layout.
|
|
24
28
|
*/
|
|
25
29
|
export const CarouselItem = ({
|
|
26
30
|
className,
|
|
@@ -10,6 +10,13 @@ import { faCheck, faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
|
10
10
|
* Chips prompt most actions in a UI
|
|
11
11
|
* @status beta
|
|
12
12
|
* @category Action
|
|
13
|
+
* @devx
|
|
14
|
+
* - `editable` relies on contentEditable; label should be a string.
|
|
15
|
+
* - `onToggle` uses internal state; pair with `activated` for controlled usage.
|
|
16
|
+
* @a11y
|
|
17
|
+
* - Uses `aria-pressed` only when togglable.
|
|
18
|
+
* @limitations
|
|
19
|
+
* - Edit mode starts after a 1s focus delay (no prop to customize).
|
|
13
20
|
*/
|
|
14
21
|
export const Chip = ({
|
|
15
22
|
variant = 'outlined',
|
|
@@ -6,6 +6,16 @@ import { Chip } from './Chip';
|
|
|
6
6
|
import { Divider } from './Divider';
|
|
7
7
|
import { v4 } from 'uuid';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Chips group for input or selection lists
|
|
11
|
+
* @status beta
|
|
12
|
+
* @category Input
|
|
13
|
+
* @devx
|
|
14
|
+
* - Works best as controlled: pass `items` + `onItemsChange`.
|
|
15
|
+
* - Internal ids are derived from object identity; replace items carefully.
|
|
16
|
+
* @limitations
|
|
17
|
+
* - No virtualization; very large lists can be slow.
|
|
18
|
+
*/
|
|
9
19
|
export const Chips = ({
|
|
10
20
|
variant = 'input',
|
|
11
21
|
className,
|
|
@@ -6,6 +6,8 @@ import { ReactProps } from '../utils';
|
|
|
6
6
|
* Dividers are thin lines that group content in lists or other containers
|
|
7
7
|
* @status beta
|
|
8
8
|
* @category Layout
|
|
9
|
+
* @devx
|
|
10
|
+
* - Renders a semantic `<hr>`; use `orientation` for vertical dividers.
|
|
9
11
|
*/
|
|
10
12
|
export const Divider = ({
|
|
11
13
|
orientation = 'horizontal',
|
|
@@ -12,6 +12,10 @@ import { State } from '../effects';
|
|
|
12
12
|
* Floating action buttons (FABs) help people take primary actions
|
|
13
13
|
* @status beta
|
|
14
14
|
* @category Action
|
|
15
|
+
* @devx
|
|
16
|
+
* - Requires `label` or children; icon-only still needs a label for a11y.
|
|
17
|
+
* @limitations
|
|
18
|
+
* - No built-in positioning; placement is handled by the layout.
|
|
15
19
|
*/
|
|
16
20
|
export const Fab = ({
|
|
17
21
|
className,
|
|
@@ -15,6 +15,13 @@ import { v4 } from 'uuid';
|
|
|
15
15
|
* Floating action buttons (FABs) help people take primary actions
|
|
16
16
|
* @status beta
|
|
17
17
|
* @category Action
|
|
18
|
+
* @devx
|
|
19
|
+
* - Only `Button` children are rendered as actions.
|
|
20
|
+
* - Controlled via `open`/`onOpenChange` or `defaultOpen`.
|
|
21
|
+
* @a11y
|
|
22
|
+
* - No focus trap or Escape handling when open.
|
|
23
|
+
* @limitations
|
|
24
|
+
* - No outside-click handling; close uses the explicit close button.
|
|
18
25
|
*/
|
|
19
26
|
export const FabMenu = ({
|
|
20
27
|
className,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
|
|
3
|
-
import { Icon } from '../icon
|
|
4
|
-
import { IconButtonInterface } from '../interfaces
|
|
5
|
-
import { useIconButtonStyle } from '../styles
|
|
6
|
-
import { ReactProps } from '../utils
|
|
3
|
+
import { Icon } from '../icon';
|
|
4
|
+
import { IconButtonInterface } from '../interfaces';
|
|
5
|
+
import { useIconButtonStyle } from '../styles';
|
|
6
|
+
import { classNames, ReactProps } from '../utils';
|
|
7
7
|
import { State } from '../effects';
|
|
8
|
-
import { classNames } from '../utils';
|
|
9
8
|
import { Tooltip } from './Tooltip';
|
|
10
9
|
|
|
11
10
|
export type IconButtonVariant = 'standard' | 'filled' | 'tonal' | 'outlined';
|
|
@@ -14,6 +13,11 @@ export type IconButtonVariant = 'standard' | 'filled' | 'tonal' | 'outlined';
|
|
|
14
13
|
* Icon buttons help people take minor actions with one tap
|
|
15
14
|
* @status beta
|
|
16
15
|
* @category Action
|
|
16
|
+
* @devx
|
|
17
|
+
* - Requires `label` or children to provide an aria-label.
|
|
18
|
+
* - Uses `title` as tooltip text; native title attribute is suppressed.
|
|
19
|
+
* @limitations
|
|
20
|
+
* - Tooltip is always rendered (no explicit opt-out).
|
|
17
21
|
*/
|
|
18
22
|
export const IconButton = ({
|
|
19
23
|
variant = 'standard',
|
|
@@ -26,6 +26,12 @@ import { IconButton } from './IconButton';
|
|
|
26
26
|
* Navigation rails let people switch between UI views on mid-sized devices
|
|
27
27
|
* @status beta
|
|
28
28
|
* @category Navigation
|
|
29
|
+
* @devx
|
|
30
|
+
* - Treats `NavigationRailItem`, `NavigationRailSection`, and `Fab` specially.
|
|
31
|
+
* - Selection is index-based; provide `selectedItem` for controlled usage.
|
|
32
|
+
* @limitations
|
|
33
|
+
* - `extended` is not fully controlled (prop changes after mount aren’t synced).
|
|
34
|
+
* - Keyboard navigation/roving tabindex is not implemented.
|
|
29
35
|
*/
|
|
30
36
|
export const NavigationRail = ({
|
|
31
37
|
variant = 'standard',
|
|
@@ -10,6 +10,8 @@ import { State } from '../effects';
|
|
|
10
10
|
/**
|
|
11
11
|
* @status beta
|
|
12
12
|
* @parent NavigationRail
|
|
13
|
+
* @devx
|
|
14
|
+
* - Section labels only render when the rail is extended.
|
|
13
15
|
*/
|
|
14
16
|
export const NavigationRailSection = ({ label }: { label: string }) => {
|
|
15
17
|
return (
|
|
@@ -22,6 +24,11 @@ export const NavigationRailSection = ({ label }: { label: string }) => {
|
|
|
22
24
|
/**
|
|
23
25
|
* @status beta
|
|
24
26
|
* @parent NavigationRail
|
|
27
|
+
* @devx
|
|
28
|
+
* - Selection is index-based and provided by the parent rail.
|
|
29
|
+
* - `extendedOnly` hides items when the rail is collapsed.
|
|
30
|
+
* @a11y
|
|
31
|
+
* - Uses `role="tab"` but no roving tabindex or aria-controls wiring.
|
|
25
32
|
*/
|
|
26
33
|
export const NavigationRailItem = ({
|
|
27
34
|
className,
|
|
@@ -8,6 +8,12 @@ import { ReactProps } from '../utils/component';
|
|
|
8
8
|
/**
|
|
9
9
|
* @status beta
|
|
10
10
|
* @category Communication
|
|
11
|
+
* @devx
|
|
12
|
+
* - `value` is clamped to 0–100; indeterminate variants ignore it.
|
|
13
|
+
* @a11y
|
|
14
|
+
* - Missing `role="progressbar"` and aria-* attributes.
|
|
15
|
+
* @limitations
|
|
16
|
+
* - Visibility auto-hides at 100% (no controlled open prop).
|
|
11
17
|
*/
|
|
12
18
|
export const ProgressIndicator = ({
|
|
13
19
|
variant = 'linear-determinate',
|
|
@@ -13,6 +13,13 @@ import { sideSheetStyle } from '../styles';
|
|
|
13
13
|
* Side sheets show secondary content anchored to the side of the screen
|
|
14
14
|
* @status beta
|
|
15
15
|
* @category Layout
|
|
16
|
+
* @devx
|
|
17
|
+
* - Controlled via `extended`/`onExtendedChange` or internal state.
|
|
18
|
+
* - `variant="modal"` renders into a portal on `document.body`.
|
|
19
|
+
* @a11y
|
|
20
|
+
* - No focus trap, Escape handling, or `aria-modal` attributes.
|
|
21
|
+
* @limitations
|
|
22
|
+
* - No body scroll lock when open.
|
|
16
23
|
*/
|
|
17
24
|
export const SideSheet = ({
|
|
18
25
|
variant = 'standard',
|
|
@@ -8,6 +8,11 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
8
8
|
* Sliders let users make selections from a range of values
|
|
9
9
|
* @status beta
|
|
10
10
|
* @category Input
|
|
11
|
+
* @devx
|
|
12
|
+
* - `value` is treated as the initial value; component is uncontrolled after mount.
|
|
13
|
+
* - `onChange` receives the numeric value (not the DOM event).
|
|
14
|
+
* @a11y
|
|
15
|
+
* - Provides slider role/aria values, but no label prop.
|
|
11
16
|
*/
|
|
12
17
|
export const Slider = ({
|
|
13
18
|
className,
|
|
@@ -11,6 +11,12 @@ import { IconButton } from './IconButton';
|
|
|
11
11
|
* Snackbars show short updates about app processes at the bottom of the screen
|
|
12
12
|
* @status beta
|
|
13
13
|
* @category Communication
|
|
14
|
+
* @devx
|
|
15
|
+
* - Uncontrolled visibility; use `duration` to auto-dismiss.
|
|
16
|
+
* @a11y
|
|
17
|
+
* - No `role="status"`/`alert` announcements.
|
|
18
|
+
* @limitations
|
|
19
|
+
* - No queue/stacking and no controlled open prop.
|
|
14
20
|
*/
|
|
15
21
|
export const Snackbar = ({
|
|
16
22
|
message,
|
|
@@ -10,6 +10,10 @@ import { MotionProps } from '../utils/component';
|
|
|
10
10
|
* Switches toggle the selection of an item on or off
|
|
11
11
|
* @status beta
|
|
12
12
|
* @category Input
|
|
13
|
+
* @devx
|
|
14
|
+
* - `selected` is used as initial state only; prop changes won’t sync.
|
|
15
|
+
* @a11y
|
|
16
|
+
* - Uses `role="switch"` but no label prop is exposed here.
|
|
13
17
|
*/
|
|
14
18
|
export const Switch = ({
|
|
15
19
|
selected = false,
|
|
@@ -10,6 +10,11 @@ import { State } from '../effects';
|
|
|
10
10
|
/**
|
|
11
11
|
* @status beta
|
|
12
12
|
* @parent Tabs
|
|
13
|
+
* @devx
|
|
14
|
+
* - `label` can come from string children; selection is index-based.
|
|
15
|
+
* - Use `TabGroup` to sync selection with panels/animations.
|
|
16
|
+
* @a11y
|
|
17
|
+
* - No keyboard navigation or `aria-controls` wiring.
|
|
13
18
|
*/
|
|
14
19
|
export const Tab = ({
|
|
15
20
|
className,
|
|
@@ -8,6 +8,10 @@ import { ReactProps } from '../utils/component';
|
|
|
8
8
|
* TabGroup provides shared state for Tabs and TabPanels
|
|
9
9
|
* @status beta
|
|
10
10
|
* @category Navigation
|
|
11
|
+
* @devx
|
|
12
|
+
* - Provides selection + slide direction for Tabs/TabPanels.
|
|
13
|
+
* @limitations
|
|
14
|
+
* - No URL/hash syncing or persistence built in.
|
|
11
15
|
*/
|
|
12
16
|
export const TabGroup = ({
|
|
13
17
|
children,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { createContext, Dispatch, SetStateAction } from 'react';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Shared state container for Tabs and TabPanels.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
|
|
3
8
|
export interface TabGroupContextValue {
|
|
4
9
|
selectedTab: number | null;
|
|
5
10
|
setSelectedTab: Dispatch<SetStateAction<number | null>>;
|
|
@@ -8,4 +13,4 @@ export interface TabGroupContextValue {
|
|
|
8
13
|
tabsId: string;
|
|
9
14
|
}
|
|
10
15
|
|
|
11
|
-
export const TabGroupContext = createContext<TabGroupContextValue | null>(null);
|
|
16
|
+
export const TabGroupContext = createContext<TabGroupContextValue | null>(null);
|
|
@@ -8,6 +8,8 @@ import { useTabPanelStyle } from '../styles/tab-panels.style';
|
|
|
8
8
|
* Must be used within TabPanels
|
|
9
9
|
* @status beta
|
|
10
10
|
* @category Navigation
|
|
11
|
+
* @devx
|
|
12
|
+
* - Should be rendered inside `TabPanels` for animations and aria wiring.
|
|
11
13
|
*/
|
|
12
14
|
export const TabPanel = ({
|
|
13
15
|
children,
|
|
@@ -11,6 +11,10 @@ import { TabPanel } from './TabPanel';
|
|
|
11
11
|
* Must be used within a TabGroup
|
|
12
12
|
* @status beta
|
|
13
13
|
* @category Navigation
|
|
14
|
+
* @devx
|
|
15
|
+
* - Requires `TabGroup` context; otherwise it renders nothing.
|
|
16
|
+
* @limitations
|
|
17
|
+
* - Only renders the active panel (no offscreen preservation).
|
|
14
18
|
*/
|
|
15
19
|
export const TabPanels = ({
|
|
16
20
|
children,
|
|
@@ -12,6 +12,10 @@ import { TabGroupContext } from './TabGroupContext';
|
|
|
12
12
|
* Tabs organize content across different screens and views
|
|
13
13
|
* @status beta
|
|
14
14
|
* @category Navigation
|
|
15
|
+
* @devx
|
|
16
|
+
* - Can be controlled via `selectedTab`/`setSelectedTab` or through `TabGroup`.
|
|
17
|
+
* @a11y
|
|
18
|
+
* - No keyboard navigation or roving tabindex.
|
|
15
19
|
*/
|
|
16
20
|
export const Tabs = ({
|
|
17
21
|
variant = 'primary',
|
|
@@ -14,6 +14,11 @@ import { TextFieldInterface } from '../interfaces/text-field.interface';
|
|
|
14
14
|
* Text fields let users enter text into a UI
|
|
15
15
|
* @status beta
|
|
16
16
|
* @category Input
|
|
17
|
+
* @devx
|
|
18
|
+
* - `onChange` receives the string value (not the DOM event).
|
|
19
|
+
* - `value` syncs internal state; not a fully controlled input.
|
|
20
|
+
* @a11y
|
|
21
|
+
* - Uses `label` for `aria-label`; no `aria-describedby` for supporting text.
|
|
17
22
|
*/
|
|
18
23
|
export const TextField = ({
|
|
19
24
|
variant = 'filled',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cloneElement, isValidElement, useRef } from 'react';
|
|
1
|
+
import { cloneElement, isValidElement, useEffect, useRef } from 'react';
|
|
2
2
|
import { MotionProps } from '../utils';
|
|
3
3
|
import { Button } from './Button';
|
|
4
4
|
import { ToolTipInterface } from '../interfaces';
|
|
@@ -11,6 +11,11 @@ import { useTooltipTrigger, useTooltipPosition } from '../hooks';
|
|
|
11
11
|
* Tooltips display brief labels or messages
|
|
12
12
|
* @status beta
|
|
13
13
|
* @category Communication
|
|
14
|
+
* @devx
|
|
15
|
+
* - `content` overrides `title`/`text`/`buttons` for fully custom content.
|
|
16
|
+
* - Supports controlled `isOpen` plus `openDelay`/`closeDelay`.
|
|
17
|
+
* @a11y
|
|
18
|
+
* - Provides `role="tooltip"` and `aria-describedby` when open.
|
|
14
19
|
*/
|
|
15
20
|
export const Tooltip = ({
|
|
16
21
|
variant = 'plain',
|
|
@@ -99,6 +104,46 @@ export const Tooltip = ({
|
|
|
99
104
|
} as any)
|
|
100
105
|
: children;
|
|
101
106
|
|
|
107
|
+
// Attach trigger handlers when using targetRef (no direct child to clone)
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (!targetRef) return;
|
|
110
|
+
const element = targetRef.current;
|
|
111
|
+
if (!element) return;
|
|
112
|
+
|
|
113
|
+
const handleMouseEnter = () => triggerProps.onMouseEnter();
|
|
114
|
+
const handleMouseLeave = () => triggerProps.onMouseLeave();
|
|
115
|
+
const handleFocus = () => triggerProps.onFocus();
|
|
116
|
+
const handleBlur = () => triggerProps.onBlur();
|
|
117
|
+
const handleClick = () => triggerProps.onClick();
|
|
118
|
+
const handleKeyDown = (event: KeyboardEvent) =>
|
|
119
|
+
triggerProps.onKeyDown(event as unknown as React.KeyboardEvent);
|
|
120
|
+
|
|
121
|
+
element.addEventListener('mouseenter', handleMouseEnter);
|
|
122
|
+
element.addEventListener('mouseleave', handleMouseLeave);
|
|
123
|
+
element.addEventListener('focus', handleFocus, true);
|
|
124
|
+
element.addEventListener('blur', handleBlur, true);
|
|
125
|
+
element.addEventListener('click', handleClick);
|
|
126
|
+
element.addEventListener('keydown', handleKeyDown);
|
|
127
|
+
|
|
128
|
+
if (triggerProps['aria-describedby']) {
|
|
129
|
+
element.setAttribute(
|
|
130
|
+
'aria-describedby',
|
|
131
|
+
triggerProps['aria-describedby'],
|
|
132
|
+
);
|
|
133
|
+
} else {
|
|
134
|
+
element.removeAttribute('aria-describedby');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return () => {
|
|
138
|
+
element.removeEventListener('mouseenter', handleMouseEnter);
|
|
139
|
+
element.removeEventListener('mouseleave', handleMouseLeave);
|
|
140
|
+
element.removeEventListener('focus', handleFocus, true);
|
|
141
|
+
element.removeEventListener('blur', handleBlur, true);
|
|
142
|
+
element.removeEventListener('click', handleClick);
|
|
143
|
+
element.removeEventListener('keydown', handleKeyDown);
|
|
144
|
+
};
|
|
145
|
+
}, [targetRef, triggerProps]);
|
|
146
|
+
|
|
102
147
|
const styles = useToolTipStyle({
|
|
103
148
|
variant,
|
|
104
149
|
buttons,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ActionOrLink } from '../utils/component';
|
|
2
2
|
import { Transition } from 'motion';
|
|
3
3
|
import { Icon } from '../icon';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
4
5
|
|
|
5
6
|
export type FabVariant =
|
|
6
7
|
| 'primary'
|
|
@@ -12,7 +13,7 @@ export type FabVariant =
|
|
|
12
13
|
type Props = {
|
|
13
14
|
variant?: FabVariant;
|
|
14
15
|
label?: string;
|
|
15
|
-
children?:
|
|
16
|
+
children?: ReactNode;
|
|
16
17
|
icon: Icon;
|
|
17
18
|
size?: 'small' | 'medium' | 'large';
|
|
18
19
|
extended?: boolean;
|