@udixio/ui-react 0.1.2 → 0.2.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.
- package/CHANGELOG.md +0 -10
- package/dist/index.cjs +2 -2
- package/dist/index.js +1164 -1181
- package/dist/lib/components/Button.d.ts +4 -2
- package/dist/lib/components/Button.d.ts.map +1 -1
- package/dist/lib/components/Card.d.ts +5 -0
- package/dist/lib/components/Card.d.ts.map +1 -1
- package/dist/lib/components/Carousel.d.ts +6 -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/{Divided.d.ts → Divider.d.ts} +6 -1
- package/dist/lib/components/Divider.d.ts.map +1 -0
- package/dist/lib/components/Fab.d.ts +5 -0
- package/dist/lib/components/Fab.d.ts.map +1 -1
- package/dist/lib/components/IconButton.d.ts +6 -1
- package/dist/lib/components/IconButton.d.ts.map +1 -1
- package/dist/lib/components/NavigationRail.d.ts +5 -0
- package/dist/lib/components/NavigationRail.d.ts.map +1 -1
- package/dist/lib/components/NavigationRailItem.d.ts +8 -0
- package/dist/lib/components/NavigationRailItem.d.ts.map +1 -1
- package/dist/lib/components/ProgressIndicator.d.ts +4 -0
- package/dist/lib/components/ProgressIndicator.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 +5 -0
- package/dist/lib/components/Snackbar.d.ts.map +1 -1
- package/dist/lib/components/Switch.d.ts +5 -0
- package/dist/lib/components/Switch.d.ts.map +1 -1
- package/dist/lib/components/Tab.d.ts +4 -0
- package/dist/lib/components/Tab.d.ts.map +1 -1
- package/dist/lib/components/Tabs.d.ts +5 -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/components/index.d.ts +1 -1
- package/dist/lib/effects/SyncedFixedWrapper.d.ts.map +1 -1
- package/dist/lib/interfaces/button.interface.d.ts +5 -0
- package/dist/lib/interfaces/button.interface.d.ts.map +1 -1
- package/dist/lib/interfaces/icon-button.interface.d.ts +1 -1
- package/dist/lib/interfaces/icon-button.interface.d.ts.map +1 -1
- package/dist/lib/styles/button.style.d.ts +14 -4
- package/dist/lib/styles/button.style.d.ts.map +1 -1
- package/dist/lib/styles/icon-button.style.d.ts +4 -4
- package/package.json +2 -2
- package/src/lib/components/Button.tsx +42 -15
- package/src/lib/components/Card.tsx +5 -0
- package/src/lib/components/Carousel.tsx +12 -6
- package/src/lib/components/CarouselItem.tsx +6 -1
- package/src/lib/components/{Divided.tsx → Divider.tsx} +5 -0
- package/src/lib/components/Fab.tsx +6 -1
- package/src/lib/components/IconButton.tsx +12 -7
- package/src/lib/components/NavigationRail.tsx +40 -41
- package/src/lib/components/NavigationRailItem.tsx +8 -0
- package/src/lib/components/ProgressIndicator.tsx +8 -2
- package/src/lib/components/Slider.tsx +5 -0
- package/src/lib/components/Snackbar.tsx +7 -2
- package/src/lib/components/Switch.tsx +5 -0
- package/src/lib/components/Tab.tsx +4 -0
- package/src/lib/components/Tabs.tsx +8 -3
- package/src/lib/components/TextField.tsx +8 -3
- package/src/lib/components/ToolTip.tsx +8 -8
- package/src/lib/components/index.ts +1 -1
- package/src/lib/effects/SyncedFixedWrapper.tsx +0 -2
- package/src/lib/interfaces/button.interface.ts +6 -0
- package/src/lib/interfaces/icon-button.interface.ts +1 -1
- package/src/lib/styles/button.style.ts +27 -48
- package/dist/lib/components/Divided.d.ts.map +0 -1
|
@@ -8,6 +8,12 @@ import { CustomScroll } from '../effects';
|
|
|
8
8
|
import { ReactProps } from '../utils';
|
|
9
9
|
import { CarouselItem, normalize } from './CarouselItem';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Carousels show a collection of items that can be scrolled on and off the screen
|
|
13
|
+
* Resources
|
|
14
|
+
* @status beta
|
|
15
|
+
* @category Layout
|
|
16
|
+
*/
|
|
11
17
|
export const Carousel = ({
|
|
12
18
|
variant = 'hero',
|
|
13
19
|
className,
|
|
@@ -37,7 +43,7 @@ export const Carousel = ({
|
|
|
37
43
|
});
|
|
38
44
|
|
|
39
45
|
const items = React.Children.toArray(children).filter(
|
|
40
|
-
(child) => React.isValidElement(child) && child.type === CarouselItem
|
|
46
|
+
(child) => React.isValidElement(child) && child.type === CarouselItem,
|
|
41
47
|
);
|
|
42
48
|
|
|
43
49
|
const trackRef = useRef<HTMLDivElement>(null);
|
|
@@ -55,10 +61,10 @@ export const Carousel = ({
|
|
|
55
61
|
|
|
56
62
|
function assignRelativeIndexes(
|
|
57
63
|
values: number[],
|
|
58
|
-
progressScroll: number
|
|
64
|
+
progressScroll: number,
|
|
59
65
|
): number[] {
|
|
60
66
|
return values.map(
|
|
61
|
-
(value) => (value - progressScroll) / Math.abs(values[1] - values[0])
|
|
67
|
+
(value) => (value - progressScroll) / Math.abs(values[1] - values[0]),
|
|
62
68
|
);
|
|
63
69
|
}
|
|
64
70
|
|
|
@@ -117,7 +123,7 @@ export const Carousel = ({
|
|
|
117
123
|
ref: itemRefs[index],
|
|
118
124
|
key: index,
|
|
119
125
|
index,
|
|
120
|
-
}
|
|
126
|
+
},
|
|
121
127
|
);
|
|
122
128
|
});
|
|
123
129
|
|
|
@@ -130,12 +136,12 @@ export const Carousel = ({
|
|
|
130
136
|
0,
|
|
131
137
|
1 -
|
|
132
138
|
(ref.current?.clientWidth ?? 0) / (trackRef?.current?.clientWidth ?? 0),
|
|
133
|
-
]
|
|
139
|
+
],
|
|
134
140
|
);
|
|
135
141
|
|
|
136
142
|
const percentTransform = useTransform(
|
|
137
143
|
transform,
|
|
138
|
-
(value) => `${-value * 100}
|
|
144
|
+
(value) => `${-value * 100}%`,
|
|
139
145
|
);
|
|
140
146
|
|
|
141
147
|
const handleScroll = (args: {
|
|
@@ -7,7 +7,7 @@ import { MotionProps } from '../utils';
|
|
|
7
7
|
export const normalize = (
|
|
8
8
|
value: number,
|
|
9
9
|
inputRange: [number, number],
|
|
10
|
-
outputRange: [number, number] = [0, 1]
|
|
10
|
+
outputRange: [number, number] = [0, 1],
|
|
11
11
|
): number => {
|
|
12
12
|
const [inputMin, inputMax] = inputRange;
|
|
13
13
|
const [outputMin, outputMax] = outputRange;
|
|
@@ -18,6 +18,11 @@ export const normalize = (
|
|
|
18
18
|
|
|
19
19
|
return outputMin + normalizedValue * (outputMax - outputMin);
|
|
20
20
|
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @status beta
|
|
24
|
+
* @parent Carousel
|
|
25
|
+
*/
|
|
21
26
|
export const CarouselItem = ({
|
|
22
27
|
className,
|
|
23
28
|
children,
|
|
@@ -2,6 +2,11 @@ import { dividerStyle } from '../styles';
|
|
|
2
2
|
import { DividerInterface } from '../interfaces';
|
|
3
3
|
import { ReactProps } from '../utils';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Dividers are thin lines that group content in lists or other containers
|
|
7
|
+
* @status beta
|
|
8
|
+
* @category Layout
|
|
9
|
+
*/
|
|
5
10
|
export const Divider = ({
|
|
6
11
|
orientation = 'horizontal',
|
|
7
12
|
className,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useRef } from 'react';
|
|
2
2
|
import { Icon } from '../icon';
|
|
3
3
|
|
|
4
4
|
import { RippleEffect } from '../effects/ripple';
|
|
@@ -9,6 +9,11 @@ import { classNames } from '../utils';
|
|
|
9
9
|
import { ReactProps } from '../utils/component';
|
|
10
10
|
import { ToolTip } from './ToolTip';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Floating action buttons (FABs) help people take primary actions
|
|
14
|
+
* @status beta
|
|
15
|
+
* @category Action
|
|
16
|
+
*/
|
|
12
17
|
export const Fab = ({
|
|
13
18
|
className,
|
|
14
19
|
label,
|
|
@@ -10,13 +10,18 @@ import { ToolTip } from './ToolTip';
|
|
|
10
10
|
|
|
11
11
|
export type IconButtonVariant = 'standard' | 'filled' | 'tonal' | 'outlined';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Icon buttons help people take minor actions with one tap
|
|
15
|
+
* @status beta
|
|
16
|
+
* @category Action
|
|
17
|
+
*/
|
|
13
18
|
export const IconButton = ({
|
|
14
19
|
variant = 'standard',
|
|
15
20
|
href,
|
|
16
21
|
disabled = false,
|
|
17
22
|
type = 'button',
|
|
18
23
|
title,
|
|
19
|
-
|
|
24
|
+
ariaLabel,
|
|
20
25
|
onToggle,
|
|
21
26
|
activated = false,
|
|
22
27
|
onClick,
|
|
@@ -32,12 +37,12 @@ export const IconButton = ({
|
|
|
32
37
|
...restProps
|
|
33
38
|
}: ReactProps<IconButtonInterface>) => {
|
|
34
39
|
if (!title) {
|
|
35
|
-
title =
|
|
40
|
+
title = ariaLabel;
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
const [isActive, setIsActive] = React.useState(activated);
|
|
39
|
-
let handleClick;
|
|
40
44
|
|
|
45
|
+
let handleClick;
|
|
41
46
|
if (!onToggle) {
|
|
42
47
|
handleClick = (e: React.MouseEvent<any, MouseEvent>) => {
|
|
43
48
|
if (disabled) {
|
|
@@ -70,8 +75,8 @@ export const IconButton = ({
|
|
|
70
75
|
allowShapeTransformation,
|
|
71
76
|
width,
|
|
72
77
|
href,
|
|
73
|
-
activated,
|
|
74
|
-
|
|
78
|
+
activated: isActive,
|
|
79
|
+
ariaLabel,
|
|
75
80
|
iconSelected,
|
|
76
81
|
isActive,
|
|
77
82
|
onToggle,
|
|
@@ -93,7 +98,7 @@ export const IconButton = ({
|
|
|
93
98
|
disabled={disabled}
|
|
94
99
|
href={href}
|
|
95
100
|
className={styles.iconButton}
|
|
96
|
-
aria-label={
|
|
101
|
+
aria-label={ariaLabel}
|
|
97
102
|
{...(restProps as any)}
|
|
98
103
|
title={undefined}
|
|
99
104
|
onClick={handleClick}
|
|
@@ -127,7 +132,7 @@ export const IconButton = ({
|
|
|
127
132
|
variant === 'outlined' && {
|
|
128
133
|
'on-surface-variant': !isActive,
|
|
129
134
|
'on-primary': isActive,
|
|
130
|
-
}
|
|
135
|
+
},
|
|
131
136
|
)}
|
|
132
137
|
triggerRef={resolvedRef}
|
|
133
138
|
/>
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { ReactProps } from '../utils';
|
|
3
1
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
Children,
|
|
3
|
+
cloneElement,
|
|
4
|
+
Fragment,
|
|
5
|
+
isValidElement,
|
|
6
|
+
ReactElement,
|
|
7
|
+
ReactNode,
|
|
8
|
+
RefObject,
|
|
9
|
+
useEffect,
|
|
10
|
+
useRef,
|
|
11
|
+
useState
|
|
12
|
+
} from 'react';
|
|
13
|
+
import { ReactProps } from '../utils';
|
|
14
|
+
import { NavigationRailItem, NavigationRailSection } from './NavigationRailItem';
|
|
7
15
|
import { Fab } from './Fab';
|
|
8
16
|
import { navigationRailStyle } from '../styles/navigation-rail.style';
|
|
9
17
|
import { NavigationRailInterface } from '../interfaces/navigation-rail.interface';
|
|
@@ -11,6 +19,11 @@ import { FabInterface, NavigationRailItemInterface } from '../interfaces';
|
|
|
11
19
|
import { faBars, faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
12
20
|
import { IconButton } from './IconButton';
|
|
13
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Navigation rails let people switch between UI views on mid-sized devices
|
|
24
|
+
* @status beta
|
|
25
|
+
* @category Navigation
|
|
26
|
+
*/
|
|
14
27
|
export const NavigationRail = ({
|
|
15
28
|
variant = 'standard',
|
|
16
29
|
onItemSelected,
|
|
@@ -49,25 +62,25 @@ export const NavigationRail = ({
|
|
|
49
62
|
|
|
50
63
|
const setSelectedItem = externalSetSelectedItem || internalSetSelectedItem;
|
|
51
64
|
|
|
52
|
-
const ref =
|
|
65
|
+
const ref = useRef<HTMLDivElement | null>(null);
|
|
53
66
|
|
|
54
67
|
const handleOnItemSelected = (
|
|
55
68
|
args: { index: number } & Pick<
|
|
56
69
|
ReactProps<NavigationRailItemInterface>,
|
|
57
70
|
'label' | 'icon'
|
|
58
71
|
> & {
|
|
59
|
-
ref:
|
|
60
|
-
}
|
|
72
|
+
ref: RefObject<any>;
|
|
73
|
+
},
|
|
61
74
|
) => {
|
|
62
75
|
onItemSelected?.(args);
|
|
63
76
|
};
|
|
64
77
|
|
|
65
|
-
function flattenChildren(children:
|
|
66
|
-
const flatChildren:
|
|
67
|
-
|
|
78
|
+
function flattenChildren(children: ReactNode): ReactNode[] {
|
|
79
|
+
const flatChildren: ReactNode[] = [];
|
|
80
|
+
Children.forEach(children, (child) => {
|
|
68
81
|
if (
|
|
69
|
-
|
|
70
|
-
child.type ===
|
|
82
|
+
isValidElement<{ children?: ReactNode }>(child) &&
|
|
83
|
+
child.type === Fragment
|
|
71
84
|
) {
|
|
72
85
|
flatChildren.push(...flattenChildren(child.props.children));
|
|
73
86
|
} else {
|
|
@@ -80,7 +93,7 @@ export const NavigationRail = ({
|
|
|
80
93
|
const childrenArray = flattenChildren(children);
|
|
81
94
|
|
|
82
95
|
const fab = childrenArray.filter(
|
|
83
|
-
(child) =>
|
|
96
|
+
(child) => isValidElement(child) && child.type === Fab,
|
|
84
97
|
);
|
|
85
98
|
|
|
86
99
|
const styles = navigationRailStyle({
|
|
@@ -114,33 +127,25 @@ export const NavigationRail = ({
|
|
|
114
127
|
<div className={styles.header}>
|
|
115
128
|
<IconButton
|
|
116
129
|
onClick={() => setIsExtended(!isExtended)}
|
|
117
|
-
|
|
130
|
+
ariaLabel={isExtended ? menu?.opened.label : menu?.closed.label}
|
|
118
131
|
className={styles.menuIcon}
|
|
119
132
|
icon={!isExtended ? menu?.closed.icon : menu.opened.icon}
|
|
120
133
|
/>
|
|
121
134
|
{fab.length > 0 &&
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
className: '!shadow-none mx-5 ' + (fab[0] as any).props.className,
|
|
128
|
-
}
|
|
129
|
-
)}
|
|
135
|
+
cloneElement(fab[0] as ReactElement<ReactProps<FabInterface>>, {
|
|
136
|
+
transition: transition,
|
|
137
|
+
isExtended: isExtended,
|
|
138
|
+
className: '!shadow-none mx-5 ' + (fab[0] as any).props.className,
|
|
139
|
+
})}
|
|
130
140
|
</div>
|
|
131
141
|
|
|
132
142
|
<div className={styles.segments}>
|
|
133
143
|
{(() => {
|
|
134
144
|
let itemIndex = 0;
|
|
135
145
|
return childrenArray.map((child) => {
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
) {
|
|
140
|
-
return React.cloneElement(
|
|
141
|
-
child as React.ReactElement<
|
|
142
|
-
ReactProps<NavigationRailItemInterface>
|
|
143
|
-
>,
|
|
146
|
+
if (isValidElement(child) && child.type === NavigationRailItem) {
|
|
147
|
+
return cloneElement(
|
|
148
|
+
child as ReactElement<ReactProps<NavigationRailItemInterface>>,
|
|
144
149
|
{
|
|
145
150
|
key: itemIndex,
|
|
146
151
|
index: itemIndex++, // Utilise et incrémente le compteur dédié
|
|
@@ -151,22 +156,16 @@ export const NavigationRail = ({
|
|
|
151
156
|
transition,
|
|
152
157
|
extendedOnly: extendedOnly.current,
|
|
153
158
|
isExtended,
|
|
154
|
-
}
|
|
159
|
+
},
|
|
155
160
|
);
|
|
156
161
|
}
|
|
157
|
-
if (
|
|
162
|
+
if (isValidElement(child) && child.type === Fab) {
|
|
158
163
|
return null;
|
|
159
164
|
}
|
|
160
|
-
if (
|
|
161
|
-
React.isValidElement(child) &&
|
|
162
|
-
child.type === NavigationRailSection
|
|
163
|
-
) {
|
|
165
|
+
if (isValidElement(child) && child.type === NavigationRailSection) {
|
|
164
166
|
extendedOnly.current = true;
|
|
165
167
|
if (!isExtended) return null;
|
|
166
|
-
return
|
|
167
|
-
child as React.ReactElement<{ label: string }>,
|
|
168
|
-
{}
|
|
169
|
-
);
|
|
168
|
+
return cloneElement(child as ReactElement<{ label: string }>, {});
|
|
170
169
|
}
|
|
171
170
|
return child;
|
|
172
171
|
});
|
|
@@ -6,6 +6,10 @@ import { NavigationRailItemInterface } from '../interfaces';
|
|
|
6
6
|
import { navigationRailItemStyle } from '../styles/navigation-rail-item.style';
|
|
7
7
|
import { AnimatePresence, motion } from 'motion/react';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @status beta
|
|
11
|
+
* @parent NavigationRail
|
|
12
|
+
*/
|
|
9
13
|
export const NavigationRailSection = ({ label }: { label: string }) => {
|
|
10
14
|
return (
|
|
11
15
|
<div className={' h-9 flex items-center mx-9 mt-3'}>
|
|
@@ -14,6 +18,10 @@ export const NavigationRailSection = ({ label }: { label: string }) => {
|
|
|
14
18
|
);
|
|
15
19
|
};
|
|
16
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @status beta
|
|
23
|
+
* @parent NavigationRail
|
|
24
|
+
*/
|
|
17
25
|
export const NavigationRailItem = ({
|
|
18
26
|
className,
|
|
19
27
|
onClick,
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import { ProgressIndicatorInterface } from '../interfaces/progress-indicator.interface';
|
|
3
3
|
|
|
4
4
|
import { motion } from 'motion/react';
|
|
5
5
|
import { progressIndicatorStyle } from '../styles/progress-indicator.style';
|
|
6
6
|
import { ReactProps } from '../utils/component';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @status beta
|
|
10
|
+
* @category Communication
|
|
11
|
+
*/
|
|
8
12
|
export const ProgressIndicator = ({
|
|
9
13
|
variant = 'linear-determinate',
|
|
10
14
|
minHeight = 4,
|
|
@@ -15,7 +19,7 @@ export const ProgressIndicator = ({
|
|
|
15
19
|
}: ReactProps<ProgressIndicatorInterface>): any => {
|
|
16
20
|
const [completedPercentage, setCompletedPercentage] = useState(value);
|
|
17
21
|
|
|
18
|
-
const [transitionRotate
|
|
22
|
+
const [transitionRotate] = useState(1.5);
|
|
19
23
|
|
|
20
24
|
useEffect(() => {
|
|
21
25
|
if (value > 100) {
|
|
@@ -45,6 +49,7 @@ export const ProgressIndicator = ({
|
|
|
45
49
|
}, getTransitionRotate() * 1000);
|
|
46
50
|
return () => clearInterval(interval);
|
|
47
51
|
}
|
|
52
|
+
return;
|
|
48
53
|
}, [variant, togglePercentage, completedPercentage]);
|
|
49
54
|
|
|
50
55
|
const [isVisible, setIsVisible] = useState(false);
|
|
@@ -60,6 +65,7 @@ export const ProgressIndicator = ({
|
|
|
60
65
|
} else {
|
|
61
66
|
setIsVisible(true);
|
|
62
67
|
}
|
|
68
|
+
return;
|
|
63
69
|
}, [completedPercentage, transitionDuration]);
|
|
64
70
|
|
|
65
71
|
const styles = progressIndicatorStyle({
|
|
@@ -4,6 +4,11 @@ import { sliderStyle } from '../styles';
|
|
|
4
4
|
import { classNames, ReactProps } from '../utils';
|
|
5
5
|
import { useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Sliders let users make selections from a range of values
|
|
9
|
+
* @status beta
|
|
10
|
+
* @category Input
|
|
11
|
+
*/
|
|
7
12
|
export const Slider = ({
|
|
8
13
|
className,
|
|
9
14
|
valueFormatter,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import { AnimatePresence, motion } from 'motion/react';
|
|
3
3
|
import { faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
4
4
|
import { SnackbarInterface } from '../interfaces/snackbar.interface';
|
|
@@ -7,6 +7,11 @@ import { snackbarStyle } from '../styles/snackbar.style';
|
|
|
7
7
|
import { MotionProps } from '../utils/component';
|
|
8
8
|
import { IconButton } from './IconButton';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Snackbars show short updates about app processes at the bottom of the screen
|
|
12
|
+
* @status beta
|
|
13
|
+
* @category Communication
|
|
14
|
+
*/
|
|
10
15
|
export const Snackbar = ({
|
|
11
16
|
supportingText,
|
|
12
17
|
className,
|
|
@@ -56,7 +61,7 @@ export const Snackbar = ({
|
|
|
56
61
|
onClick={() => handleClose()}
|
|
57
62
|
className={styles.icon}
|
|
58
63
|
icon={closeIcon}
|
|
59
|
-
|
|
64
|
+
ariaLabel={'close the snackbar'}
|
|
60
65
|
></IconButton>
|
|
61
66
|
</div>
|
|
62
67
|
</motion.div>
|
|
@@ -6,6 +6,11 @@ import { SwitchInterface } from '../interfaces/switch.interface';
|
|
|
6
6
|
import { switchStyle } from '../styles/switch.style';
|
|
7
7
|
import { MotionProps } from '../utils/component';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Switches toggle the selection of an item on or off
|
|
11
|
+
* @status beta
|
|
12
|
+
* @category Input
|
|
13
|
+
*/
|
|
9
14
|
export const Switch = ({
|
|
10
15
|
selected = false,
|
|
11
16
|
className,
|
|
@@ -7,6 +7,10 @@ import { tabStyle } from '../styles/tab.style';
|
|
|
7
7
|
import { TabInterface } from '../interfaces/tab.interface';
|
|
8
8
|
import { ReactProps } from '../utils/component';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @status beta
|
|
12
|
+
* @parent Tabs
|
|
13
|
+
*/
|
|
10
14
|
export const Tab = ({
|
|
11
15
|
className,
|
|
12
16
|
onClick,
|
|
@@ -7,6 +7,11 @@ import { ReactProps } from '../utils/component';
|
|
|
7
7
|
import { TabProps } from '../interfaces/tab.interface';
|
|
8
8
|
import { Tab } from './Tab';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Tabs organize content across different screens and views
|
|
12
|
+
* @status beta
|
|
13
|
+
* @category Navigation
|
|
14
|
+
*/
|
|
10
15
|
export const Tabs = ({
|
|
11
16
|
variant = 'primary',
|
|
12
17
|
onTabSelected,
|
|
@@ -17,7 +22,7 @@ export const Tabs = ({
|
|
|
17
22
|
scrollable = false,
|
|
18
23
|
}: ReactProps<TabsInterface>) => {
|
|
19
24
|
const [internalSelectedTab, internalSetSelectedTab] = useState<number | null>(
|
|
20
|
-
null
|
|
25
|
+
null,
|
|
21
26
|
);
|
|
22
27
|
|
|
23
28
|
let selectedTab: number | null;
|
|
@@ -30,7 +35,7 @@ export const Tabs = ({
|
|
|
30
35
|
const setSelectedTab = externalSetSelectedTab || internalSetSelectedTab;
|
|
31
36
|
|
|
32
37
|
const tabChildren = React.Children.toArray(children).filter(
|
|
33
|
-
(child) => React.isValidElement(child) && child.type === Tab
|
|
38
|
+
(child) => React.isValidElement(child) && child.type === Tab,
|
|
34
39
|
);
|
|
35
40
|
|
|
36
41
|
const ref = React.useRef<HTMLDivElement | null>(null);
|
|
@@ -38,7 +43,7 @@ export const Tabs = ({
|
|
|
38
43
|
const handleOnTabSelected = (
|
|
39
44
|
args: { index: number } & Pick<TabProps, 'label' | 'icon'> & {
|
|
40
45
|
ref: React.RefObject<any>;
|
|
41
|
-
}
|
|
46
|
+
},
|
|
42
47
|
) => {
|
|
43
48
|
onTabSelected?.(args);
|
|
44
49
|
|
|
@@ -10,6 +10,11 @@ import { classNames } from '../utils';
|
|
|
10
10
|
import { ReactProps } from '../utils/component';
|
|
11
11
|
import { TextFieldInterface } from '../interfaces/text-field.interface';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Text fields let users enter text into a UI
|
|
15
|
+
* @status beta
|
|
16
|
+
* @category Input
|
|
17
|
+
*/
|
|
13
18
|
export const TextField = ({
|
|
14
19
|
variant = 'filled',
|
|
15
20
|
disabled = false,
|
|
@@ -34,7 +39,7 @@ export const TextField = ({
|
|
|
34
39
|
const [isFocused, setIsFocused] = useState(false);
|
|
35
40
|
const [showErrorIcon, setShowErrorIcon] = useState(false);
|
|
36
41
|
const [showSupportingText, setShowSupportingText] = useState(
|
|
37
|
-
defaultShowSupportingText
|
|
42
|
+
defaultShowSupportingText,
|
|
38
43
|
);
|
|
39
44
|
|
|
40
45
|
useEffect(() => {
|
|
@@ -80,7 +85,7 @@ export const TextField = ({
|
|
|
80
85
|
};
|
|
81
86
|
|
|
82
87
|
const handleChange = (
|
|
83
|
-
event: React.ChangeEvent<HTMLInputElement & HTMLTextAreaElement
|
|
88
|
+
event: React.ChangeEvent<HTMLInputElement & HTMLTextAreaElement>,
|
|
84
89
|
) => {
|
|
85
90
|
const newValue = event.target.value;
|
|
86
91
|
setValue(newValue); // Update local state
|
|
@@ -187,7 +192,7 @@ export const TextField = ({
|
|
|
187
192
|
'text-body-large top-1/2 transform -translate-y-1/2': !(
|
|
188
193
|
variant == 'filled' && !(!isFocused && !value.length)
|
|
189
194
|
),
|
|
190
|
-
}
|
|
195
|
+
},
|
|
191
196
|
)}
|
|
192
197
|
transition={{ duration: 0.3 }}
|
|
193
198
|
>
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cloneElement,
|
|
3
|
-
isValidElement,
|
|
4
|
-
useEffect,
|
|
5
|
-
useRef,
|
|
6
|
-
useState,
|
|
7
|
-
} from 'react';
|
|
1
|
+
import { cloneElement, isValidElement, useEffect, useRef, useState } from 'react';
|
|
8
2
|
import { MotionProps } from '../utils';
|
|
9
3
|
import { Button } from './Button';
|
|
10
4
|
import { ToolTipInterface } from '../interfaces';
|
|
@@ -13,6 +7,11 @@ import { v4 } from 'uuid';
|
|
|
13
7
|
import { AnimatePresence, motion } from 'motion/react';
|
|
14
8
|
import { SyncedFixedWrapper } from '../effects';
|
|
15
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Tooltips display brief labels or messages
|
|
12
|
+
* @status beta
|
|
13
|
+
* @category Communication
|
|
14
|
+
*/
|
|
16
15
|
export const ToolTip = ({
|
|
17
16
|
variant = 'plain',
|
|
18
17
|
buttons,
|
|
@@ -55,7 +54,7 @@ export const ToolTip = ({
|
|
|
55
54
|
return () => {
|
|
56
55
|
document.removeEventListener(
|
|
57
56
|
'tooltip-update',
|
|
58
|
-
handleUpdate as EventListener
|
|
57
|
+
handleUpdate as EventListener,
|
|
59
58
|
);
|
|
60
59
|
};
|
|
61
60
|
}, []);
|
|
@@ -130,6 +129,7 @@ export const ToolTip = ({
|
|
|
130
129
|
targetElement.removeEventListener('blur', handleBlur);
|
|
131
130
|
};
|
|
132
131
|
}
|
|
132
|
+
return;
|
|
133
133
|
}, [resolvedRef, trigger, id, isVisible]);
|
|
134
134
|
|
|
135
135
|
// Si targetRef est undefined, on applique la réf au premier enfant
|
|
@@ -3,7 +3,7 @@ export * from './Card';
|
|
|
3
3
|
export * from './Carousel';
|
|
4
4
|
export * from './CarouselItem';
|
|
5
5
|
export * from './CarouselItem';
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './Divider';
|
|
7
7
|
export * from './Fab';
|
|
8
8
|
export * from './IconButton';
|
|
9
9
|
export * from './IconButton';
|
|
@@ -37,10 +37,16 @@ type Props = {
|
|
|
37
37
|
allowShapeTransformation?: boolean;
|
|
38
38
|
|
|
39
39
|
transition?: Transition;
|
|
40
|
+
|
|
41
|
+
onToggle?: (isActive: boolean) => void;
|
|
42
|
+
activated?: boolean;
|
|
40
43
|
};
|
|
41
44
|
|
|
42
45
|
type Elements = ['button', 'stateLayer', 'container', 'icon', 'label'];
|
|
43
46
|
|
|
44
47
|
export type ButtonInterface = ActionOrLink<Props> & {
|
|
45
48
|
elements: Elements;
|
|
49
|
+
states: {
|
|
50
|
+
isActive: boolean;
|
|
51
|
+
};
|
|
46
52
|
};
|
|
@@ -4,7 +4,7 @@ import { ActionOrLink } from '../utils/component';
|
|
|
4
4
|
import { Transition } from 'motion';
|
|
5
5
|
|
|
6
6
|
type Props = {
|
|
7
|
-
|
|
7
|
+
ariaLabel: string;
|
|
8
8
|
icon: IconDefinition;
|
|
9
9
|
size?: 'xSmall' | 'small' | 'medium' | 'large' | 'xLarge';
|
|
10
10
|
width?: 'default' | 'narrow' | 'wide';
|