@udixio/ui-react 2.5.2 → 2.7.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 +41 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +2566 -2264
- package/dist/lib/components/Button.d.ts.map +1 -1
- package/dist/lib/components/Card.d.ts.map +1 -1
- package/dist/lib/components/Carousel.d.ts +0 -2
- package/dist/lib/components/Carousel.d.ts.map +1 -1
- package/dist/lib/components/Fab.d.ts +1 -1
- package/dist/lib/components/Fab.d.ts.map +1 -1
- package/dist/lib/components/FabMenu.d.ts +9 -0
- package/dist/lib/components/FabMenu.d.ts.map +1 -0
- package/dist/lib/components/IconButton.d.ts.map +1 -1
- package/dist/lib/components/NavigationRail.d.ts.map +1 -1
- package/dist/lib/components/NavigationRailItem.d.ts.map +1 -1
- package/dist/lib/components/Tab.d.ts.map +1 -1
- package/dist/lib/components/ToolTip.d.ts.map +1 -1
- package/dist/lib/components/index.d.ts +1 -0
- package/dist/lib/components/index.d.ts.map +1 -1
- package/dist/lib/effects/AnimateOnScroll.d.ts.map +1 -1
- package/dist/lib/effects/State.d.ts +26 -0
- package/dist/lib/effects/State.d.ts.map +1 -0
- package/dist/lib/effects/index.d.ts +1 -0
- package/dist/lib/effects/index.d.ts.map +1 -1
- package/dist/lib/effects/ripple/RippleEffect.d.ts.map +1 -1
- package/dist/lib/interfaces/button.interface.d.ts +4 -1
- package/dist/lib/interfaces/button.interface.d.ts.map +1 -1
- package/dist/lib/interfaces/fab-menu.interface.d.ts +12 -0
- package/dist/lib/interfaces/fab-menu.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/fab.interface.d.ts +2 -2
- package/dist/lib/interfaces/fab.interface.d.ts.map +1 -1
- package/dist/lib/interfaces/index.d.ts +1 -0
- package/dist/lib/interfaces/index.d.ts.map +1 -1
- package/dist/lib/interfaces/side-sheet.interface.d.ts +1 -1
- package/dist/lib/interfaces/side-sheet.interface.d.ts.map +1 -1
- package/dist/lib/styles/button.style.d.ts +43 -3
- package/dist/lib/styles/button.style.d.ts.map +1 -1
- package/dist/lib/styles/card.style.d.ts +9 -1
- package/dist/lib/styles/card.style.d.ts.map +1 -1
- package/dist/lib/styles/carousel-item.style.d.ts +11 -1
- package/dist/lib/styles/carousel-item.style.d.ts.map +1 -1
- package/dist/lib/styles/carousel.style.d.ts +16 -1
- package/dist/lib/styles/carousel.style.d.ts.map +1 -1
- package/dist/lib/styles/divider.style.d.ts +8 -2
- package/dist/lib/styles/divider.style.d.ts.map +1 -1
- package/dist/lib/styles/fab-menu.style.d.ts +83 -0
- package/dist/lib/styles/fab-menu.style.d.ts.map +1 -0
- package/dist/lib/styles/fab.style.d.ts +29 -5
- package/dist/lib/styles/fab.style.d.ts.map +1 -1
- package/dist/lib/styles/icon-button.style.d.ts +37 -1
- package/dist/lib/styles/icon-button.style.d.ts.map +1 -1
- package/dist/lib/styles/index.d.ts +2 -0
- package/dist/lib/styles/index.d.ts.map +1 -1
- package/dist/lib/styles/navigation-rail-item.style.d.ts +11 -1
- package/dist/lib/styles/navigation-rail-item.style.d.ts.map +1 -1
- package/dist/lib/styles/navigation-rail.style.d.ts +31 -1
- package/dist/lib/styles/navigation-rail.style.d.ts.map +1 -1
- package/dist/lib/styles/progress-indicator.style.d.ts +12 -1
- package/dist/lib/styles/progress-indicator.style.d.ts.map +1 -1
- package/dist/lib/styles/side-sheet.style.d.ts +20 -3
- package/dist/lib/styles/side-sheet.style.d.ts.map +1 -1
- package/dist/lib/styles/slider.style.d.ts +21 -2
- package/dist/lib/styles/slider.style.d.ts.map +1 -1
- package/dist/lib/styles/snackbar.style.d.ts +14 -3
- package/dist/lib/styles/snackbar.style.d.ts.map +1 -1
- package/dist/lib/styles/switch.style.d.ts +14 -2
- package/dist/lib/styles/switch.style.d.ts.map +1 -1
- package/dist/lib/styles/tab.style.d.ts +12 -2
- package/dist/lib/styles/tab.style.d.ts.map +1 -1
- package/dist/lib/styles/tabs.style.d.ts +17 -2
- package/dist/lib/styles/tabs.style.d.ts.map +1 -1
- package/dist/lib/styles/text-field.style.d.ts +23 -2
- package/dist/lib/styles/text-field.style.d.ts.map +1 -1
- package/dist/lib/styles/tooltip.style.d.ts +20 -3
- package/dist/lib/styles/tooltip.style.d.ts.map +1 -1
- package/dist/lib/utils/styles/get-classname.d.ts +3 -0
- package/dist/lib/utils/styles/get-classname.d.ts.map +1 -1
- package/dist/lib/utils/styles/index.d.ts +1 -0
- package/dist/lib/utils/styles/index.d.ts.map +1 -1
- package/dist/lib/utils/styles/use-classnames.d.ts +6 -0
- package/dist/lib/utils/styles/use-classnames.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/lib/components/Button.tsx +54 -20
- package/src/lib/components/Card.tsx +11 -9
- package/src/lib/components/Carousel.tsx +70 -205
- package/src/lib/components/CarouselItem.tsx +2 -2
- package/src/lib/components/Divider.tsx +2 -2
- package/src/lib/components/Fab.tsx +22 -21
- package/src/lib/components/FabMenu.tsx +229 -0
- package/src/lib/components/IconButton.tsx +24 -30
- package/src/lib/components/NavigationRail.tsx +7 -4
- package/src/lib/components/NavigationRailItem.tsx +13 -4
- package/src/lib/components/ProgressIndicator.tsx +2 -2
- package/src/lib/components/SideSheet.tsx +2 -2
- package/src/lib/components/Slider.tsx +2 -2
- package/src/lib/components/Snackbar.tsx +2 -2
- package/src/lib/components/Switch.tsx +2 -2
- package/src/lib/components/Tab.tsx +11 -11
- package/src/lib/components/Tabs.tsx +2 -2
- package/src/lib/components/TextField.tsx +2 -2
- package/src/lib/components/ToolTip.tsx +9 -3
- package/src/lib/components/index.ts +1 -0
- package/src/lib/effects/AnimateOnScroll.ts +51 -18
- package/src/lib/effects/State.tsx +83 -0
- package/src/lib/effects/index.ts +1 -0
- package/src/lib/effects/ripple/RippleEffect.tsx +40 -27
- package/src/lib/interfaces/button.interface.ts +5 -1
- package/src/lib/interfaces/fab-menu.interface.ts +12 -0
- package/src/lib/interfaces/fab.interface.ts +8 -2
- package/src/lib/interfaces/index.ts +1 -0
- package/src/lib/interfaces/side-sheet.interface.tsx +1 -1
- package/src/lib/styles/button.style.ts +127 -136
- package/src/lib/styles/card.style.ts +22 -17
- package/src/lib/styles/carousel-item.style.ts +23 -9
- package/src/lib/styles/carousel.style.ts +17 -5
- package/src/lib/styles/divider.style.ts +27 -13
- package/src/lib/styles/fab-menu.style.ts +28 -0
- package/src/lib/styles/fab.style.ts +41 -43
- package/src/lib/styles/icon-button.style.ts +160 -149
- package/src/lib/styles/index.ts +2 -0
- package/src/lib/styles/navigation-rail-item.style.ts +49 -40
- package/src/lib/styles/navigation-rail.style.ts +31 -15
- package/src/lib/styles/progress-indicator.style.ts +49 -36
- package/src/lib/styles/side-sheet.style.ts +41 -27
- package/src/lib/styles/slider.style.ts +37 -23
- package/src/lib/styles/snackbar.style.ts +22 -10
- package/src/lib/styles/switch.style.ts +61 -45
- package/src/lib/styles/tab.style.ts +76 -66
- package/src/lib/styles/tabs.style.ts +19 -10
- package/src/lib/styles/text-field.style.ts +108 -97
- package/src/lib/styles/tooltip.style.ts +42 -33
- package/src/lib/utils/styles/get-classname.ts +23 -0
- package/src/lib/utils/styles/index.ts +1 -0
- package/src/lib/utils/styles/use-classnames.ts +25 -0
- package/src/tests/useClassNames.spec.tsx +82 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
|
+
import { FabMenuInterface } from '../interfaces/fab-menu.interface';
|
|
3
|
+
import { useFabMenuStyle } from '../styles/fab-menu.style';
|
|
4
|
+
import { ReactProps } from '../utils/component';
|
|
5
|
+
import { Fab } from './Fab';
|
|
6
|
+
import { Button } from './Button';
|
|
7
|
+
import { ButtonInterface } from '../interfaces';
|
|
8
|
+
import { classNames } from '../utils';
|
|
9
|
+
import { IconButton } from './IconButton';
|
|
10
|
+
import { faClose } from '@fortawesome/free-solid-svg-icons';
|
|
11
|
+
import { AnimatePresence, motion } from 'motion/react';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Floating action buttons (FABs) help people take primary actions
|
|
15
|
+
* @status beta
|
|
16
|
+
* @category Action
|
|
17
|
+
*/
|
|
18
|
+
export const FabMenu = ({
|
|
19
|
+
className,
|
|
20
|
+
label,
|
|
21
|
+
variant = 'primary',
|
|
22
|
+
size = 'medium',
|
|
23
|
+
href,
|
|
24
|
+
type,
|
|
25
|
+
icon,
|
|
26
|
+
extended = false,
|
|
27
|
+
ref,
|
|
28
|
+
transition,
|
|
29
|
+
children,
|
|
30
|
+
open: openProp,
|
|
31
|
+
defaultOpen = false,
|
|
32
|
+
onOpenChange,
|
|
33
|
+
...restProps
|
|
34
|
+
}: ReactProps<FabMenuInterface>) => {
|
|
35
|
+
transition = { duration: 0.3, ease: 'easeInOut', ...transition };
|
|
36
|
+
|
|
37
|
+
const defaultRef = useRef(null);
|
|
38
|
+
const resolvedRef = ref || defaultRef;
|
|
39
|
+
|
|
40
|
+
// Controlled/uncontrolled open state
|
|
41
|
+
const isControlled = typeof openProp === 'boolean';
|
|
42
|
+
const [internalOpen, setInternalOpen] = useState<boolean>(defaultOpen);
|
|
43
|
+
const open = isControlled ? (openProp as boolean) : internalOpen;
|
|
44
|
+
const setOpen = (next: boolean) => {
|
|
45
|
+
if (!isControlled) setInternalOpen(next);
|
|
46
|
+
onOpenChange?.(next);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const buttonChildren = React.Children.toArray(children).filter(
|
|
50
|
+
(child) => React.isValidElement(child) && child.type === Button,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const styles = useFabMenuStyle({
|
|
54
|
+
href,
|
|
55
|
+
icon,
|
|
56
|
+
extended,
|
|
57
|
+
label,
|
|
58
|
+
size,
|
|
59
|
+
variant,
|
|
60
|
+
className,
|
|
61
|
+
transition,
|
|
62
|
+
children: label,
|
|
63
|
+
open,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const MotionFab = motion.create(Fab);
|
|
67
|
+
const MotionIconButton = motion.create(IconButton);
|
|
68
|
+
const MotionButton = motion.create(Button);
|
|
69
|
+
|
|
70
|
+
const renderFab = (props) => (
|
|
71
|
+
<MotionFab
|
|
72
|
+
icon={icon}
|
|
73
|
+
extended={extended}
|
|
74
|
+
label={label}
|
|
75
|
+
variant={(variant + 'Container') as any}
|
|
76
|
+
size={size}
|
|
77
|
+
className={styles.fab + ' ' + (className ?? '')}
|
|
78
|
+
aria-expanded={open}
|
|
79
|
+
onClick={() => setOpen(true)}
|
|
80
|
+
style={{ transition: 'border-radius 0.3s ease-in-out' }}
|
|
81
|
+
transition={{
|
|
82
|
+
duration: transition.duration,
|
|
83
|
+
ease: 'easeInOut',
|
|
84
|
+
borderRadius: { duration: transition.duration, ease: 'easeInOut' },
|
|
85
|
+
background: { duration: transition.duration, ease: 'easeInOut' },
|
|
86
|
+
...transition,
|
|
87
|
+
}}
|
|
88
|
+
{...props}
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<div className={styles.fabMenu} ref={resolvedRef} {...restProps}>
|
|
94
|
+
<AnimatePresence>
|
|
95
|
+
{open && (
|
|
96
|
+
<div className={styles.actions} role="menu" aria-hidden={!open}>
|
|
97
|
+
{(() => {
|
|
98
|
+
const total = buttonChildren.length;
|
|
99
|
+
return buttonChildren.map((child, index) => {
|
|
100
|
+
const childProps = (
|
|
101
|
+
child as React.ReactElement<ReactProps<ButtonInterface>>
|
|
102
|
+
).props;
|
|
103
|
+
const reverseIndex = total - 1 - index; // inverser l'ordre d'animation
|
|
104
|
+
const delay = (transition?.delay ?? 0) + reverseIndex * 0.06; // délai échelonné inversé, un peu plus marqué
|
|
105
|
+
|
|
106
|
+
const variants = {
|
|
107
|
+
open: {
|
|
108
|
+
opacity: 1,
|
|
109
|
+
width: 'auto',
|
|
110
|
+
transition: {
|
|
111
|
+
...transition,
|
|
112
|
+
delay,
|
|
113
|
+
opacity: {
|
|
114
|
+
delay: transition?.duration / 2 + delay,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
close: {
|
|
119
|
+
opacity: 0,
|
|
120
|
+
width: 0,
|
|
121
|
+
transition: {
|
|
122
|
+
...transition,
|
|
123
|
+
delay,
|
|
124
|
+
opacity: {
|
|
125
|
+
duration: transition?.duration / 2,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<motion.div
|
|
133
|
+
initial={'close'}
|
|
134
|
+
animate={'open'}
|
|
135
|
+
className={'overflow-hidden'}
|
|
136
|
+
variants={variants}
|
|
137
|
+
transition={transition}
|
|
138
|
+
exit={'close'}
|
|
139
|
+
>
|
|
140
|
+
{React.cloneElement(
|
|
141
|
+
child as React.ReactElement<ReactProps<ButtonInterface>>,
|
|
142
|
+
{
|
|
143
|
+
key: index,
|
|
144
|
+
shape: 'rounded',
|
|
145
|
+
variant: 'filled',
|
|
146
|
+
className: () => ({
|
|
147
|
+
button: classNames('max-w-full overflow-hidden', {
|
|
148
|
+
'px-0': !open,
|
|
149
|
+
'bg-primary-container text-on-primary-container ':
|
|
150
|
+
variant === 'primary',
|
|
151
|
+
'bg-secondary-container text-on-secondary-container':
|
|
152
|
+
variant === 'secondary',
|
|
153
|
+
'bg-tertiary-container text-on-tertiary-container':
|
|
154
|
+
variant === 'tertiary',
|
|
155
|
+
}),
|
|
156
|
+
stateLayer: classNames({
|
|
157
|
+
'state-on-primary-container': variant === 'primary',
|
|
158
|
+
'state-on-secondary-container':
|
|
159
|
+
variant === 'secondary',
|
|
160
|
+
'state-on-tertiary-container':
|
|
161
|
+
variant === 'tertiary',
|
|
162
|
+
}),
|
|
163
|
+
}),
|
|
164
|
+
},
|
|
165
|
+
)}
|
|
166
|
+
</motion.div>
|
|
167
|
+
);
|
|
168
|
+
});
|
|
169
|
+
})()}
|
|
170
|
+
</div>
|
|
171
|
+
)}
|
|
172
|
+
</AnimatePresence>
|
|
173
|
+
|
|
174
|
+
{renderFab({
|
|
175
|
+
className: 'invisible pointer-events-none',
|
|
176
|
+
})}
|
|
177
|
+
<div className={'absolute right-0 top-0'}>
|
|
178
|
+
{!open &&
|
|
179
|
+
renderFab({
|
|
180
|
+
className: '',
|
|
181
|
+
layout: true,
|
|
182
|
+
layoutId: 'fab-menu',
|
|
183
|
+
})}
|
|
184
|
+
{open && (
|
|
185
|
+
<>
|
|
186
|
+
<MotionIconButton
|
|
187
|
+
layout
|
|
188
|
+
layoutId="fab-menu"
|
|
189
|
+
variant={'filled'}
|
|
190
|
+
className={() => ({
|
|
191
|
+
iconButton: classNames('', {
|
|
192
|
+
'bg-primary text-on-primary': variant === 'primary',
|
|
193
|
+
'bg-secondary text-on-secondary': variant === 'secondary',
|
|
194
|
+
'bg-tertiary text-on-tertiary': variant === 'tertiary',
|
|
195
|
+
}),
|
|
196
|
+
stateLayer: classNames({
|
|
197
|
+
'[--default-color:var(--color-on-primary)]':
|
|
198
|
+
variant === 'primary',
|
|
199
|
+
'[--default-color:var(--color-on-secondary)]':
|
|
200
|
+
variant === 'secondary',
|
|
201
|
+
'[--default-color:var(--color-on-tertiary)]':
|
|
202
|
+
variant === 'tertiary',
|
|
203
|
+
}),
|
|
204
|
+
})}
|
|
205
|
+
style={{ transition: 'border-radius 0.3s ease-in-out' }}
|
|
206
|
+
transition={{
|
|
207
|
+
duration: transition.duration,
|
|
208
|
+
ease: 'easeInOut',
|
|
209
|
+
borderRadius: {
|
|
210
|
+
duration: transition.duration,
|
|
211
|
+
ease: 'easeInOut',
|
|
212
|
+
},
|
|
213
|
+
background: {
|
|
214
|
+
duration: transition.duration,
|
|
215
|
+
ease: 'easeInOut',
|
|
216
|
+
},
|
|
217
|
+
...transition,
|
|
218
|
+
}}
|
|
219
|
+
icon={faClose}
|
|
220
|
+
onClick={() => setOpen(false)}
|
|
221
|
+
>
|
|
222
|
+
Close
|
|
223
|
+
</MotionIconButton>
|
|
224
|
+
</>
|
|
225
|
+
)}
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
);
|
|
229
|
+
};
|
|
@@ -2,9 +2,9 @@ import React, { useEffect, useRef } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { Icon } from '../icon/icon';
|
|
4
4
|
import { IconButtonInterface } from '../interfaces/icon-button.interface';
|
|
5
|
-
import {
|
|
5
|
+
import { useIconButtonStyle } from '../styles/icon-button.style';
|
|
6
6
|
import { ReactProps } from '../utils/component';
|
|
7
|
-
import {
|
|
7
|
+
import { State } from '../effects';
|
|
8
8
|
import { classNames } from '../utils';
|
|
9
9
|
import { ToolTip } from './ToolTip';
|
|
10
10
|
|
|
@@ -76,7 +76,7 @@ export const IconButton = ({
|
|
|
76
76
|
// Détermine le type de l'élément à rendre : un bouton ou un lien
|
|
77
77
|
const ElementType = href ? 'a' : 'button';
|
|
78
78
|
|
|
79
|
-
const styles =
|
|
79
|
+
const styles = useIconButtonStyle({
|
|
80
80
|
transition,
|
|
81
81
|
shape,
|
|
82
82
|
allowShapeTransformation,
|
|
@@ -120,35 +120,29 @@ export const IconButton = ({
|
|
|
120
120
|
></ToolTip>
|
|
121
121
|
|
|
122
122
|
<div className={styles.touchTarget} />
|
|
123
|
-
<
|
|
124
|
-
className={styles.stateLayer}
|
|
123
|
+
<State
|
|
125
124
|
style={{ transition: transition.duration + 's' }}
|
|
126
|
-
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
'on-primary': isActive,
|
|
145
|
-
},
|
|
146
|
-
)}
|
|
147
|
-
triggerRef={resolvedRef}
|
|
148
|
-
/>
|
|
125
|
+
className={styles.stateLayer}
|
|
126
|
+
colorName={classNames(
|
|
127
|
+
variant === 'standard' && {
|
|
128
|
+
'on-surface-variant': !isActive,
|
|
129
|
+
'on-primary': isActive,
|
|
130
|
+
},
|
|
131
|
+
variant === 'filled' && {
|
|
132
|
+
'on-surface-variant': !isActive && Boolean(onToggle),
|
|
133
|
+
'on-primary': isActive || !onToggle,
|
|
134
|
+
},
|
|
135
|
+
variant === 'tonal' && {
|
|
136
|
+
'on-secondary': isActive && Boolean(onToggle),
|
|
137
|
+
'on-secondary-container': !isActive || !onToggle,
|
|
138
|
+
},
|
|
139
|
+
variant === 'outlined' && {
|
|
140
|
+
'inverse-on-surface': isActive && Boolean(onToggle),
|
|
141
|
+
'on-surface-variant': !isActive || !onToggle,
|
|
142
|
+
},
|
|
149
143
|
)}
|
|
150
|
-
|
|
151
|
-
|
|
144
|
+
stateClassName={'state-ripple-group-[icon-button]'}
|
|
145
|
+
/>
|
|
152
146
|
{icon && <Icon icon={icon} className={styles.icon} />}
|
|
153
147
|
</ElementType>
|
|
154
148
|
);
|
|
@@ -8,12 +8,15 @@ import {
|
|
|
8
8
|
RefObject,
|
|
9
9
|
useEffect,
|
|
10
10
|
useRef,
|
|
11
|
-
useState
|
|
11
|
+
useState,
|
|
12
12
|
} from 'react';
|
|
13
13
|
import { ReactProps } from '../utils';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
NavigationRailItem,
|
|
16
|
+
NavigationRailSection,
|
|
17
|
+
} from './NavigationRailItem';
|
|
15
18
|
import { Fab } from './Fab';
|
|
16
|
-
import {
|
|
19
|
+
import { useNavigationRailStyle } from '../styles/navigation-rail.style';
|
|
17
20
|
import { NavigationRailInterface } from '../interfaces/navigation-rail.interface';
|
|
18
21
|
import { FabInterface, NavigationRailItemInterface } from '../interfaces';
|
|
19
22
|
import { faBars, faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
@@ -96,7 +99,7 @@ export const NavigationRail = ({
|
|
|
96
99
|
(child) => isValidElement(child) && child.type === Fab,
|
|
97
100
|
);
|
|
98
101
|
|
|
99
|
-
const styles =
|
|
102
|
+
const styles = useNavigationRailStyle({
|
|
100
103
|
children,
|
|
101
104
|
onItemSelected,
|
|
102
105
|
selectedItem,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { Icon } from '../icon';
|
|
4
|
-
import { ReactProps } from '../utils';
|
|
4
|
+
import { classNames, ReactProps } from '../utils';
|
|
5
5
|
import { NavigationRailItemInterface } from '../interfaces';
|
|
6
|
-
import {
|
|
6
|
+
import { useNavigationRailItemStyle } from '../styles/navigation-rail-item.style';
|
|
7
7
|
import { AnimatePresence, motion } from 'motion/react';
|
|
8
|
+
import { State } from '../effects';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @status beta
|
|
@@ -80,7 +81,7 @@ export const NavigationRailItem = ({
|
|
|
80
81
|
}
|
|
81
82
|
};
|
|
82
83
|
|
|
83
|
-
const styles =
|
|
84
|
+
const styles = useNavigationRailItemStyle({
|
|
84
85
|
isExtended,
|
|
85
86
|
extendedOnly,
|
|
86
87
|
className,
|
|
@@ -128,7 +129,15 @@ export const NavigationRailItem = ({
|
|
|
128
129
|
transition={transition}
|
|
129
130
|
className={styles.container}
|
|
130
131
|
>
|
|
131
|
-
<
|
|
132
|
+
<State
|
|
133
|
+
style={{ transition: transition.duration + 's' }}
|
|
134
|
+
className={styles.stateLayer}
|
|
135
|
+
colorName={classNames({
|
|
136
|
+
'on-surface': !isSelected,
|
|
137
|
+
'on-secondary-container': isSelected,
|
|
138
|
+
})}
|
|
139
|
+
stateClassName={'state-ripple-group-[navigation-rail-item]'}
|
|
140
|
+
/>
|
|
132
141
|
{icon && (
|
|
133
142
|
<Icon
|
|
134
143
|
icon={isSelected ? iconSelected : icon}
|
|
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
|
|
|
2
2
|
import { ProgressIndicatorInterface } from '../interfaces/progress-indicator.interface';
|
|
3
3
|
|
|
4
4
|
import { motion } from 'motion/react';
|
|
5
|
-
import {
|
|
5
|
+
import { useProgressIndicatorStyle } from '../styles/progress-indicator.style';
|
|
6
6
|
import { ReactProps } from '../utils/component';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -67,7 +67,7 @@ export const ProgressIndicator = ({
|
|
|
67
67
|
return;
|
|
68
68
|
}, [completedPercentage, transitionDuration]);
|
|
69
69
|
|
|
70
|
-
const styles =
|
|
70
|
+
const styles = useProgressIndicatorStyle({
|
|
71
71
|
className,
|
|
72
72
|
variant,
|
|
73
73
|
value,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MotionProps } from '../utils';
|
|
2
2
|
import { SideSheetInterface } from '../interfaces';
|
|
3
|
-
import { sideSheetStyle } from '../styles';
|
|
4
3
|
import { Divider } from './Divider';
|
|
5
4
|
|
|
6
5
|
import { faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
@@ -8,6 +7,7 @@ import { IconButton } from './IconButton';
|
|
|
8
7
|
import { useEffect, useState } from 'react';
|
|
9
8
|
import { createPortal } from 'react-dom';
|
|
10
9
|
import { AnimatePresence, motion } from 'motion/react';
|
|
10
|
+
import { sideSheetStyle } from '../styles';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Side sheets show secondary content anchored to the side of the screen
|
|
@@ -82,7 +82,7 @@ export const SideSheet = ({
|
|
|
82
82
|
{isExtended && (
|
|
83
83
|
<div
|
|
84
84
|
{...rest}
|
|
85
|
-
className={styles.
|
|
85
|
+
className={styles.sideSheet}
|
|
86
86
|
style={{ transition: transition.duration + 's' }}
|
|
87
87
|
>
|
|
88
88
|
<motion.div
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnimatePresence, motion } from 'motion/react';
|
|
2
2
|
import { SliderInterface } from '../interfaces';
|
|
3
|
-
import {
|
|
3
|
+
import { useSliderStyle } from '../styles';
|
|
4
4
|
import { classNames, ReactProps } from '../utils';
|
|
5
5
|
import { useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
@@ -106,7 +106,7 @@ export const Slider = ({
|
|
|
106
106
|
};
|
|
107
107
|
}, [mouseDown]);
|
|
108
108
|
|
|
109
|
-
const styles =
|
|
109
|
+
const styles = useSliderStyle({
|
|
110
110
|
className,
|
|
111
111
|
isChanging,
|
|
112
112
|
marks,
|
|
@@ -2,7 +2,7 @@ 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';
|
|
5
|
-
import {
|
|
5
|
+
import { useSnackbarStyle } from '../styles/snackbar.style';
|
|
6
6
|
|
|
7
7
|
import { MotionProps } from '../utils/component';
|
|
8
8
|
import { IconButton } from './IconButton';
|
|
@@ -22,7 +22,7 @@ export const Snackbar = ({
|
|
|
22
22
|
}: MotionProps<SnackbarInterface>) => {
|
|
23
23
|
const [isVisible, setIsVisible] = useState(true);
|
|
24
24
|
|
|
25
|
-
const styles =
|
|
25
|
+
const styles = useSnackbarStyle({
|
|
26
26
|
className,
|
|
27
27
|
closeIcon,
|
|
28
28
|
duration,
|
|
@@ -3,7 +3,7 @@ import React, { useRef, useState } from 'react';
|
|
|
3
3
|
import { Icon } from '../icon';
|
|
4
4
|
import { motion } from 'motion/react';
|
|
5
5
|
import { SwitchInterface } from '../interfaces/switch.interface';
|
|
6
|
-
import {
|
|
6
|
+
import { useSwitchStyle } from '../styles/switch.style';
|
|
7
7
|
import { MotionProps } from '../utils/component';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -48,7 +48,7 @@ export const Switch = ({
|
|
|
48
48
|
setIsSelected(!isSelected);
|
|
49
49
|
onChange?.(!isSelected);
|
|
50
50
|
};
|
|
51
|
-
const styles =
|
|
51
|
+
const styles = useSwitchStyle({
|
|
52
52
|
className,
|
|
53
53
|
isSelected,
|
|
54
54
|
activeIcon,
|
|
@@ -2,10 +2,10 @@ import { motion } from 'motion/react';
|
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Icon } from '../icon';
|
|
5
|
-
import {
|
|
6
|
-
import { tabStyle } from '../styles/tab.style';
|
|
5
|
+
import { useTabStyle } from '../styles/tab.style';
|
|
7
6
|
import { TabInterface } from '../interfaces/tab.interface';
|
|
8
7
|
import { ReactProps } from '../utils/component';
|
|
8
|
+
import { State } from '../effects';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @status beta
|
|
@@ -63,7 +63,7 @@ export const Tab = ({
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
const styles =
|
|
66
|
+
const styles = useTabStyle({
|
|
67
67
|
className,
|
|
68
68
|
onTabSelected,
|
|
69
69
|
scrollable,
|
|
@@ -90,14 +90,14 @@ export const Tab = ({
|
|
|
90
90
|
onClick={handleClick}
|
|
91
91
|
{...(restProps as any)}
|
|
92
92
|
>
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
<State
|
|
94
|
+
style={{ transition: 0.3 + 's' }}
|
|
95
|
+
className={styles.stateLayer}
|
|
96
|
+
colorName={
|
|
97
|
+
variant === 'primary' && isSelected ? 'primary' : 'on-surface'
|
|
98
|
+
}
|
|
99
|
+
stateClassName={'state-ripple-group-[tab]'}
|
|
100
|
+
/>
|
|
101
101
|
<span className={styles.content}>
|
|
102
102
|
{icon && <Icon icon={icon} className={styles.icon} />}
|
|
103
103
|
<span className={styles.label}>{label}</span>
|
|
@@ -2,7 +2,7 @@ import React, { useMemo, useState } from 'react';
|
|
|
2
2
|
import { v4 as uuidv4 } from 'uuid';
|
|
3
3
|
import { TabsInterface } from '../interfaces/tabs.interface';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { useTabsStyle } from '../styles/tabs.style';
|
|
6
6
|
import { ReactProps } from '../utils/component';
|
|
7
7
|
import { TabProps } from '../interfaces/tab.interface';
|
|
8
8
|
import { Tab } from './Tab';
|
|
@@ -62,7 +62,7 @@ export const Tabs = ({
|
|
|
62
62
|
|
|
63
63
|
const tabsId = useMemo(() => uuidv4(), []);
|
|
64
64
|
|
|
65
|
-
const styles =
|
|
65
|
+
const styles = useTabsStyle({
|
|
66
66
|
children,
|
|
67
67
|
onTabSelected,
|
|
68
68
|
scrollable,
|
|
@@ -5,7 +5,7 @@ import { motion } from 'motion/react';
|
|
|
5
5
|
import { v4 as uuidv4 } from 'uuid';
|
|
6
6
|
|
|
7
7
|
import TextareaAutosize from 'react-textarea-autosize';
|
|
8
|
-
import {
|
|
8
|
+
import { useTextFieldStyle } from '../styles/text-field.style';
|
|
9
9
|
import { classNames } from '../utils';
|
|
10
10
|
import { ReactProps } from '../utils/component';
|
|
11
11
|
import { TextFieldInterface } from '../interfaces/text-field.interface';
|
|
@@ -102,7 +102,7 @@ export const TextField = ({
|
|
|
102
102
|
setIsFocused(false);
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
const styles =
|
|
105
|
+
const styles = useTextFieldStyle({
|
|
106
106
|
showSupportingText,
|
|
107
107
|
isFocused,
|
|
108
108
|
showErrorIcon,
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
cloneElement,
|
|
3
|
+
isValidElement,
|
|
4
|
+
useEffect,
|
|
5
|
+
useRef,
|
|
6
|
+
useState,
|
|
7
|
+
} from 'react';
|
|
2
8
|
import { MotionProps } from '../utils';
|
|
3
9
|
import { Button } from './Button';
|
|
4
10
|
import { ToolTipInterface } from '../interfaces';
|
|
5
|
-
import {
|
|
11
|
+
import { useToolTipStyle } from '../styles';
|
|
6
12
|
import { v4 } from 'uuid';
|
|
7
13
|
import { AnimatePresence, motion } from 'motion/react';
|
|
8
14
|
import { SyncedFixedWrapper } from '../effects';
|
|
@@ -170,7 +176,7 @@ export const ToolTip = ({
|
|
|
170
176
|
}
|
|
171
177
|
}
|
|
172
178
|
|
|
173
|
-
const styles =
|
|
179
|
+
const styles = useToolTipStyle({
|
|
174
180
|
variant,
|
|
175
181
|
buttons,
|
|
176
182
|
className,
|