@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
|
@@ -1,27 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
type ClassNameComponent,
|
|
3
|
+
classNames,
|
|
4
|
+
createUseClassNames,
|
|
5
|
+
defaultClassNames,
|
|
6
|
+
} from '../utils';
|
|
7
|
+
import { SliderInterface } from '../interfaces';
|
|
8
|
+
|
|
9
|
+
export const sliderConfig: ClassNameComponent<SliderInterface> = ({
|
|
10
|
+
isChanging,
|
|
11
|
+
}) => ({
|
|
12
|
+
slider: classNames([
|
|
13
|
+
'relative w-full h-11 flex items-center rounded gap-x-1.5 cursor-pointer min-w-32',
|
|
14
|
+
]),
|
|
15
|
+
activeTrack: classNames([
|
|
16
|
+
'h-4 relative transition-all duration-100 bg-primary overflow-hidden rounded-l-full ',
|
|
17
|
+
]),
|
|
18
|
+
inactiveTrack: classNames([
|
|
19
|
+
'h-4 relative transition-all duration-100 bg-primary-container rounded-r-full overflow-hidden',
|
|
20
|
+
]),
|
|
21
|
+
handle: classNames([
|
|
22
|
+
'transform relative transition-all duration-100 bg-primary h-full rounded-full ',
|
|
23
|
+
{ 'w-0.5': isChanging, 'w-1': !isChanging },
|
|
24
|
+
]),
|
|
25
|
+
valueIndicator: classNames([
|
|
26
|
+
'absolute select-none bg-inverse-surface text-inverse-on-surface py-3 px-4 text-label-large rounded-full bottom-[calc(100%+4px)] transform left-1/2 -translate-x-1/2',
|
|
27
|
+
]),
|
|
28
|
+
dot: classNames([
|
|
29
|
+
'h-1 w-1 absolute transform -translate-y-1/2 -translate-x-1/2 top-1/2 rounded-full',
|
|
30
|
+
]),
|
|
31
|
+
});
|
|
3
32
|
|
|
4
33
|
export const sliderStyle = defaultClassNames<SliderInterface>(
|
|
5
34
|
'slider',
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
]),
|
|
13
|
-
inactiveTrack: classNames([
|
|
14
|
-
'h-4 relative transition-all duration-100 bg-primary-container rounded-r-full overflow-hidden',
|
|
15
|
-
]),
|
|
16
|
-
handle: classNames([
|
|
17
|
-
'transform relative transition-all duration-100 bg-primary h-full rounded-full ',
|
|
18
|
-
{ 'w-0.5': isChanging, 'w-1': !isChanging },
|
|
19
|
-
]),
|
|
20
|
-
valueIndicator: classNames([
|
|
21
|
-
'absolute select-none bg-inverse-surface text-inverse-on-surface py-3 px-4 text-label-large rounded-full bottom-[calc(100%+4px)] transform left-1/2 -translate-x-1/2',
|
|
22
|
-
]),
|
|
23
|
-
dot: classNames([
|
|
24
|
-
'h-1 w-1 absolute transform -translate-y-1/2 -translate-x-1/2 top-1/2 rounded-full',
|
|
25
|
-
]),
|
|
26
|
-
}),
|
|
35
|
+
sliderConfig,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export const useSliderStyle = createUseClassNames<SliderInterface>(
|
|
39
|
+
'slider',
|
|
40
|
+
sliderConfig,
|
|
27
41
|
);
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
type ClassNameComponent,
|
|
3
|
+
classNames,
|
|
4
|
+
createUseClassNames,
|
|
5
|
+
defaultClassNames,
|
|
6
|
+
} from '../utils';
|
|
7
|
+
import { SnackbarInterface } from '../interfaces';
|
|
8
|
+
|
|
9
|
+
const snackbarConfig: ClassNameComponent<SnackbarInterface> = () => ({
|
|
10
|
+
snackbar: classNames(' rounded bg-inverse-surface '),
|
|
11
|
+
container: classNames(
|
|
12
|
+
'pl-4 pr-2 max-w-full py-1 flex items-center flex-wrap',
|
|
13
|
+
),
|
|
14
|
+
supportingText: classNames('text-body-medium text-inverse-on-surface '),
|
|
15
|
+
icon: classNames(' ml-auto mr-0 text-inverse-on-surface block dark'),
|
|
16
|
+
});
|
|
3
17
|
|
|
4
18
|
export const snackbarStyle = defaultClassNames<SnackbarInterface>(
|
|
5
19
|
'snackbar',
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
icon: classNames(' ml-auto mr-0 text-inverse-on-surface block dark'),
|
|
13
|
-
}),
|
|
20
|
+
snackbarConfig,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export const useSnackbarStyle = createUseClassNames<SnackbarInterface>(
|
|
24
|
+
'snackbar',
|
|
25
|
+
snackbarConfig,
|
|
14
26
|
);
|
|
@@ -1,51 +1,67 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
type ClassNameComponent,
|
|
3
|
+
classNames,
|
|
4
|
+
createUseClassNames,
|
|
5
|
+
defaultClassNames,
|
|
6
|
+
} from '../utils';
|
|
7
|
+
import { SwitchInterface } from '../interfaces';
|
|
3
8
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
const switchConfig: ClassNameComponent<SwitchInterface> = ({
|
|
10
|
+
isSelected,
|
|
11
|
+
disabled,
|
|
12
|
+
inactiveIcon,
|
|
13
|
+
}) => ({
|
|
14
|
+
switch: classNames(
|
|
15
|
+
'group/switch w-[52px] h-[32px] outline-none rounded-full border-2 flex items-center',
|
|
16
|
+
|
|
17
|
+
{ 'bg-on-surface/[0.12] border-transparent': disabled },
|
|
18
|
+
!disabled && [
|
|
19
|
+
'cursor-pointer ',
|
|
20
|
+
{ 'bg-primary border-primary': isSelected },
|
|
21
|
+
{ 'bg-surface-container border-outline': !isSelected },
|
|
22
|
+
],
|
|
23
|
+
|
|
24
|
+
// { 'justify-start': !isSelected },
|
|
25
|
+
// { 'justify-end': isSelected },
|
|
26
|
+
),
|
|
27
|
+
handleContainer: classNames(
|
|
28
|
+
'flex items-center justify-center absolute',
|
|
29
|
+
{ 'left-[14px]': !isSelected },
|
|
30
|
+
{ 'right-[14px]': isSelected },
|
|
31
|
+
),
|
|
32
|
+
handle: classNames(
|
|
33
|
+
'transition-all duration-100 z-10 rounded-full flex items-center justify-center',
|
|
34
|
+
{ 'w-[16px] h-[16px]': !isSelected && !inactiveIcon },
|
|
35
|
+
{ 'w-[24px] h-[24px]': !(!isSelected && !inactiveIcon) },
|
|
36
|
+
!disabled && [
|
|
37
|
+
'cursor-pointer group-active/switch:h-[28px] group-active/switch:w-[28px]',
|
|
38
|
+
{ 'bg-on-primary group-hover/switch:bg-primary-container': isSelected },
|
|
39
|
+
{ 'bg-outline group-hover/switch:bg-on-surface-variant': !isSelected },
|
|
40
|
+
],
|
|
9
41
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
42
|
+
{ 'bg-surface': disabled },
|
|
43
|
+
),
|
|
44
|
+
handleStateLayer: classNames(
|
|
45
|
+
'w-[40px] h-[40px] -z-10 rounded-full absolute',
|
|
46
|
+
{ 'group-state-primary': !disabled },
|
|
47
|
+
),
|
|
48
|
+
icon: classNames(
|
|
49
|
+
'w-[16px] h-[16px]',
|
|
50
|
+
!disabled && [
|
|
51
|
+
{ 'text-on-primary-container': isSelected },
|
|
52
|
+
{ 'text-on-primary': !isSelected },
|
|
53
|
+
],
|
|
16
54
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
handleContainer: classNames(
|
|
21
|
-
'flex items-center justify-center absolute',
|
|
22
|
-
{ 'left-[14px]': !isSelected },
|
|
23
|
-
{ 'right-[14px]': isSelected }
|
|
24
|
-
),
|
|
25
|
-
handle: classNames(
|
|
26
|
-
'transition-all duration-100 z-10 rounded-full flex items-center justify-center',
|
|
27
|
-
{ 'w-[16px] h-[16px]': !isSelected && !inactiveIcon },
|
|
28
|
-
{ 'w-[24px] h-[24px]': !(!isSelected && !inactiveIcon) },
|
|
29
|
-
!disabled && [
|
|
30
|
-
'cursor-pointer group-active:h-[28px] group-active:w-[28px]',
|
|
31
|
-
{ 'bg-on-primary group-hover:bg-primary-container': isSelected },
|
|
32
|
-
{ 'bg-outline group-hover:bg-on-surface-variant': !isSelected },
|
|
33
|
-
],
|
|
55
|
+
{ 'text-on-surface/[0.38]': disabled },
|
|
56
|
+
),
|
|
57
|
+
});
|
|
34
58
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
{ 'group-state-primary': !disabled }
|
|
40
|
-
),
|
|
41
|
-
icon: classNames(
|
|
42
|
-
'w-[16px] h-[16px]',
|
|
43
|
-
!disabled && [
|
|
44
|
-
{ 'text-on-primary-container': isSelected },
|
|
45
|
-
{ 'text-on-primary': !isSelected },
|
|
46
|
-
],
|
|
59
|
+
export const switchStyle = defaultClassNames<SwitchInterface>(
|
|
60
|
+
'switch',
|
|
61
|
+
switchConfig,
|
|
62
|
+
);
|
|
47
63
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
64
|
+
export const useSwitchStyle = createUseClassNames<SwitchInterface>(
|
|
65
|
+
'switch',
|
|
66
|
+
switchConfig,
|
|
51
67
|
);
|
|
@@ -1,68 +1,78 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
type ClassNameComponent,
|
|
3
|
+
classNames,
|
|
4
|
+
createUseClassNames,
|
|
5
|
+
defaultClassNames,
|
|
6
|
+
} from '../utils';
|
|
7
|
+
import { TabInterface } from '../interfaces';
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
9
|
+
const tabConfig: ClassNameComponent<TabInterface> = ({
|
|
10
|
+
isSelected,
|
|
11
|
+
icon,
|
|
12
|
+
label,
|
|
13
|
+
variant,
|
|
14
|
+
}) => ({
|
|
15
|
+
tab: classNames(
|
|
16
|
+
'flex-1 group/tab outline-none flex px-4 justify-center items-center cursor-pointer',
|
|
17
|
+
{ 'z-10': isSelected },
|
|
18
|
+
Boolean(icon && label) && variant === 'primary' && 'h-16',
|
|
19
|
+
!(Boolean(icon && label) && variant === 'primary') && 'h-12',
|
|
20
|
+
),
|
|
21
|
+
stateLayer: classNames(
|
|
22
|
+
'absolute w-full h-full overflow-hidden left-1/2 top-1/2 transform -translate-y-1/2 -translate-x-1/2',
|
|
23
|
+
variant === 'primary' && {
|
|
24
|
+
'group-hover/tab:hover-state-on-surface group-focus-visible/tab:focus-state-on-surface':
|
|
25
|
+
!isSelected,
|
|
26
|
+
'group-hover/tab:hover-state-primary group-focus-visible/tab:focus-state-primary':
|
|
27
|
+
isSelected,
|
|
28
|
+
},
|
|
29
|
+
variant === 'secondary' &&
|
|
30
|
+
'group-hover/tab:hover-state-on-surface group-focus-visible/tab:focus-state-on-surface',
|
|
31
|
+
),
|
|
32
|
+
content: classNames(
|
|
33
|
+
'flex gap-0.5 h-full justify-center',
|
|
34
|
+
{
|
|
35
|
+
relative: variant == 'primary',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
'': Boolean(label && !icon),
|
|
39
|
+
},
|
|
33
40
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
41
|
+
variant === 'primary' && 'flex-col items-center',
|
|
42
|
+
variant === 'secondary' && {
|
|
43
|
+
'flex-col items-center': Boolean(!(label && icon)),
|
|
44
|
+
'flex-row items-center gap-2': Boolean(label && icon),
|
|
45
|
+
},
|
|
46
|
+
),
|
|
47
|
+
icon: classNames(
|
|
48
|
+
'h-6 w-6 p-0.5 !box-border',
|
|
49
|
+
variant === 'primary' && {
|
|
50
|
+
'text-on-surface-variant': !isSelected,
|
|
51
|
+
'text-primary': isSelected,
|
|
52
|
+
},
|
|
53
|
+
variant === 'secondary' && {
|
|
54
|
+
'text-on-surface-variant': !isSelected,
|
|
55
|
+
'text-on-surface': isSelected,
|
|
56
|
+
},
|
|
57
|
+
),
|
|
58
|
+
label: classNames(
|
|
59
|
+
'text-title-small text-nowrap',
|
|
60
|
+
variant === 'primary' && {
|
|
61
|
+
'text-on-surface-variant': !isSelected,
|
|
62
|
+
'text-primary': isSelected,
|
|
63
|
+
},
|
|
64
|
+
variant === 'secondary' && {
|
|
65
|
+
'text-on-surface-variant': !isSelected,
|
|
66
|
+
'text-on-surface': isSelected,
|
|
67
|
+
},
|
|
68
|
+
),
|
|
69
|
+
underline: classNames(
|
|
70
|
+
'bg-primary absolute w-full left-0 bottom-0',
|
|
71
|
+
variant === 'primary' && 'h-[3px] rounded-t',
|
|
72
|
+
variant === 'secondary' && 'h-0.5',
|
|
73
|
+
),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export const tabStyle = defaultClassNames<TabInterface>('tab', tabConfig);
|
|
77
|
+
|
|
78
|
+
export const useTabStyle = createUseClassNames<TabInterface>('tab', tabConfig);
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import { TabsInterface } from '../interfaces
|
|
2
|
-
import {
|
|
1
|
+
import { TabsInterface } from '../interfaces';
|
|
2
|
+
import {
|
|
3
|
+
type ClassNameComponent,
|
|
4
|
+
classNames,
|
|
5
|
+
createUseClassNames,
|
|
6
|
+
defaultClassNames,
|
|
7
|
+
} from '../utils';
|
|
3
8
|
|
|
4
|
-
|
|
9
|
+
const tabsConfig: ClassNameComponent<TabsInterface> = ({ scrollable }) => ({
|
|
10
|
+
tabs: classNames(
|
|
11
|
+
'border-b border-surface-container-highest bg-surface',
|
|
12
|
+
'flex relative ',
|
|
13
|
+
{ 'overflow-x-auto': scrollable },
|
|
14
|
+
),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const tabsStyle = defaultClassNames<TabsInterface>('tabs', tabsConfig);
|
|
18
|
+
|
|
19
|
+
export const useTabsStyle = createUseClassNames<TabsInterface>(
|
|
5
20
|
'tabs',
|
|
6
|
-
|
|
7
|
-
tabs: classNames(
|
|
8
|
-
'border-b border-surface-container-highest bg-surface',
|
|
9
|
-
'flex relative ',
|
|
10
|
-
{ 'overflow-x-auto': scrollable },
|
|
11
|
-
),
|
|
12
|
-
}),
|
|
21
|
+
tabsConfig,
|
|
13
22
|
);
|
|
@@ -1,104 +1,115 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
type ClassNameComponent,
|
|
4
|
+
classNames,
|
|
5
|
+
createUseClassNames,
|
|
6
|
+
defaultClassNames,
|
|
7
|
+
} from '../utils';
|
|
8
|
+
import { TextFieldInterface } from '../interfaces';
|
|
5
9
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{ 'bg-surface-container-highest': !disabled },
|
|
37
|
-
],
|
|
10
|
+
const textFieldConfig: ClassNameComponent<TextFieldInterface> = ({
|
|
11
|
+
disabled,
|
|
12
|
+
leadingIcon,
|
|
13
|
+
trailingIcon,
|
|
14
|
+
variant,
|
|
15
|
+
errorText,
|
|
16
|
+
isFocused,
|
|
17
|
+
value,
|
|
18
|
+
suffix,
|
|
19
|
+
textLine,
|
|
20
|
+
}) => ({
|
|
21
|
+
textField: classNames({
|
|
22
|
+
'opacity-[.38]': disabled,
|
|
23
|
+
}),
|
|
24
|
+
content: classNames(
|
|
25
|
+
'group/text-field transition-border duration-200 relative flex items-center ',
|
|
26
|
+
{ 'h-14': textLine == 'singleLine' },
|
|
27
|
+
{
|
|
28
|
+
'border-on-surface-variant':
|
|
29
|
+
!errorText?.length && !isFocused && variant == 'filled',
|
|
30
|
+
'border-outline':
|
|
31
|
+
!errorText?.length && !isFocused && variant == 'outlined',
|
|
32
|
+
'border-primary': !errorText?.length && isFocused,
|
|
33
|
+
'border-error': !!errorText?.length,
|
|
34
|
+
},
|
|
35
|
+
{ 'bg-on-surface/[0.04]': disabled },
|
|
36
|
+
variant == 'filled' && [
|
|
37
|
+
'rounded-t overflow-hidden border-b',
|
|
38
|
+
{ 'bg-surface-container-highest': !disabled },
|
|
39
|
+
],
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
'border-[3px]': isFocused,
|
|
43
|
-
},
|
|
44
|
-
]
|
|
45
|
-
),
|
|
46
|
-
stateLayer: classNames(
|
|
47
|
-
'absolute -z-10 w-full h-full top-0 left-0',
|
|
41
|
+
variant == 'outlined' && [
|
|
42
|
+
'border rounded box-border',
|
|
48
43
|
{
|
|
49
|
-
|
|
44
|
+
'border-[3px]': isFocused,
|
|
50
45
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
'
|
|
86
|
-
{ '
|
|
87
|
-
{ '
|
|
46
|
+
],
|
|
47
|
+
),
|
|
48
|
+
stateLayer: classNames(
|
|
49
|
+
'absolute -z-10 w-full h-full top-0 left-0',
|
|
50
|
+
{
|
|
51
|
+
hidden: variant == 'outlined',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
'group-state-on-surface': !disabled,
|
|
55
|
+
'focus-state-on-surface': isFocused,
|
|
56
|
+
},
|
|
57
|
+
),
|
|
58
|
+
label: classNames(
|
|
59
|
+
'inline-flex outline-none whitespace-nowrap',
|
|
60
|
+
{ 'text-on-surface-variant': !disabled && !errorText?.length },
|
|
61
|
+
{ 'text-on-surface': disabled },
|
|
62
|
+
{ 'text-error': !!errorText?.length },
|
|
63
|
+
{ 'text-primary': !errorText?.length && isFocused },
|
|
64
|
+
),
|
|
65
|
+
input: classNames(
|
|
66
|
+
'w-full resize-none px-4 text-body-large bg-[inherit] outline-none autofill:transition-colors autofill:duration-[5000000ms]',
|
|
67
|
+
{
|
|
68
|
+
' text-on-surface placeholder:text-on-surface-variant': !disabled,
|
|
69
|
+
'placeholder:text-on-surface text-on-surface': disabled,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
'pr-0': !!suffix,
|
|
73
|
+
},
|
|
74
|
+
variant == 'filled' && ' pb-2 pt-6',
|
|
75
|
+
variant == 'outlined' && 'py-4 relative z-10',
|
|
76
|
+
),
|
|
77
|
+
activeIndicator: classNames(
|
|
78
|
+
'absolute w-0 inset-x-0 border-rounded mx-auto bottom-0',
|
|
79
|
+
variant == 'filled' && [
|
|
80
|
+
'h-[2px] transition-all duration-300',
|
|
81
|
+
{ 'bg-primary': !errorText?.length },
|
|
82
|
+
{ 'bg-error': !!errorText?.length },
|
|
88
83
|
{ '!w-full': isFocused },
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
84
|
+
],
|
|
85
|
+
),
|
|
86
|
+
supportingText: classNames(
|
|
87
|
+
' text-body-small px-4 pt-1',
|
|
88
|
+
{ 'text-on-surface-variant': !disabled && !errorText?.length },
|
|
89
|
+
{ 'text-on-surface': disabled },
|
|
90
|
+
{ '!w-full': isFocused },
|
|
91
|
+
{ 'text-error': !!errorText?.length },
|
|
92
|
+
),
|
|
93
|
+
leadingIcon: classNames([
|
|
94
|
+
'h-12 ml-3 flex items-center justify-center',
|
|
95
|
+
{ 'cursor-text': !React.isValidElement(leadingIcon) },
|
|
96
|
+
]),
|
|
97
|
+
trailingIcon: classNames('h-12 w-12 flex items-center justify-center', {
|
|
98
|
+
'cursor-text': !React.isValidElement(trailingIcon),
|
|
99
|
+
}),
|
|
100
|
+
suffix: classNames(
|
|
101
|
+
'text-on-surface-variant pl-0 pr-4',
|
|
102
|
+
variant == 'filled' && ' pb-2 pt-6',
|
|
103
|
+
variant == 'outlined' && 'py-4 relative z-10',
|
|
104
|
+
),
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export const textFieldStyle = defaultClassNames<TextFieldInterface>(
|
|
108
|
+
'textField',
|
|
109
|
+
textFieldConfig,
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
export const useTextFieldStyle = createUseClassNames<TextFieldInterface>(
|
|
113
|
+
'textField',
|
|
114
|
+
textFieldConfig,
|
|
104
115
|
);
|