@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,157 +1,168 @@
|
|
|
1
1
|
import { IconButtonInterface } from '../interfaces/icon-button.interface';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type ClassNameComponent,
|
|
4
|
+
classNames,
|
|
5
|
+
createUseClassNames,
|
|
6
|
+
defaultClassNames,
|
|
7
|
+
} from '../utils';
|
|
3
8
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
const iconButtonConfig: ClassNameComponent<IconButtonInterface> = ({
|
|
10
|
+
variant,
|
|
11
|
+
disabled,
|
|
12
|
+
onToggle,
|
|
13
|
+
isActive,
|
|
14
|
+
size,
|
|
15
|
+
width,
|
|
16
|
+
shape,
|
|
17
|
+
allowShapeTransformation,
|
|
18
|
+
}) => {
|
|
19
|
+
return {
|
|
20
|
+
iconButton: classNames(
|
|
21
|
+
'rounded-full relative flex transition-all duration-300',
|
|
22
|
+
'group/icon-button cursor-pointer',
|
|
23
|
+
{
|
|
24
|
+
'cursor-default': disabled,
|
|
25
|
+
},
|
|
26
|
+
shape === 'rounded' && {
|
|
27
|
+
'rounded-[30px]': size === 'xSmall' || size == 'small',
|
|
28
|
+
'rounded-[40px]': size === 'medium',
|
|
29
|
+
'rounded-[70px]': size === 'large' || size == 'xLarge',
|
|
30
|
+
},
|
|
31
|
+
(shape === 'squared' || (allowShapeTransformation && isActive)) && {
|
|
32
|
+
'rounded-[12px]': size === 'xSmall' || size == 'small',
|
|
33
|
+
'rounded-[16px]': size === 'medium',
|
|
34
|
+
'rounded-[28px]': size === 'large' || size == 'xLarge',
|
|
35
|
+
},
|
|
36
|
+
allowShapeTransformation &&
|
|
37
|
+
!disabled && {
|
|
38
|
+
'active:rounded-[12px]': size === 'xSmall' || size == 'small',
|
|
39
|
+
'active:rounded-[16px]': size === 'medium',
|
|
40
|
+
'active:rounded-[28px]': size === 'large' || size == 'xLarge',
|
|
41
|
+
},
|
|
42
|
+
variant === 'filled' && [
|
|
43
|
+
!disabled && {
|
|
44
|
+
'bg-surface-container': !isActive && Boolean(onToggle),
|
|
45
|
+
'bg-primary': isActive || !onToggle,
|
|
46
|
+
},
|
|
47
|
+
Boolean(disabled) && 'bg-on-surface/[0.12]',
|
|
48
|
+
],
|
|
49
|
+
variant === 'tonal' && [
|
|
50
|
+
!disabled && {
|
|
51
|
+
'bg-secondary-container text-on-secondary-container':
|
|
52
|
+
!isActive && Boolean(onToggle),
|
|
53
|
+
'bg-secondary text-on-secondary': isActive || !onToggle,
|
|
54
|
+
},
|
|
55
|
+
Boolean(disabled) && 'bg-on-surface/[0.12]',
|
|
56
|
+
],
|
|
57
|
+
variant === 'outlined' && [
|
|
58
|
+
!disabled && {
|
|
59
|
+
'border border-outline': !isActive,
|
|
60
|
+
'border border-transparent bg-inverse-surface': isActive,
|
|
61
|
+
},
|
|
62
|
+
Boolean(disabled) && {
|
|
63
|
+
'border border-on-surface/[0.12]': !isActive,
|
|
64
|
+
'border border-transparent bg-on-surface/[0.12]': isActive,
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
),
|
|
68
|
+
touchTarget: classNames(
|
|
69
|
+
'absolute -translate-x-1/2 -translate-y-1/2 left-1/2 top-1/2 h-12 w-full',
|
|
70
|
+
),
|
|
71
|
+
stateLayer: classNames(
|
|
72
|
+
'absolute top-0 left-0 h-full w-full overflow-hidden',
|
|
73
|
+
(shape === 'rounded' ||
|
|
74
|
+
(shape === 'squared' &&
|
|
75
|
+
onToggle &&
|
|
76
|
+
!disabled &&
|
|
77
|
+
isActive &&
|
|
78
|
+
allowShapeTransformation)) && {
|
|
79
|
+
'rounded-[30px]': size === 'xSmall' || size == 'small',
|
|
80
|
+
'rounded-[40px]': size === 'medium',
|
|
81
|
+
'rounded-[70px]': size === 'large' || size == 'xLarge',
|
|
82
|
+
},
|
|
83
|
+
(shape === 'squared' ||
|
|
84
|
+
(shape === 'rounded' &&
|
|
85
|
+
onToggle &&
|
|
86
|
+
!disabled &&
|
|
87
|
+
isActive &&
|
|
88
|
+
allowShapeTransformation)) && {
|
|
89
|
+
'rounded-[12px]': size === 'xSmall' || size == 'small',
|
|
90
|
+
'rounded-[16px]': size === 'medium',
|
|
91
|
+
'rounded-[28px]': size === 'large' || size == 'xLarge',
|
|
92
|
+
},
|
|
93
|
+
allowShapeTransformation &&
|
|
94
|
+
!disabled && {
|
|
95
|
+
'group-active/icon-button:rounded-[12px]':
|
|
96
|
+
size === 'xSmall' || size == 'small',
|
|
97
|
+
'group-active/icon-button:rounded-[16px]': size === 'medium',
|
|
98
|
+
'group-active/icon-button:rounded-[28px]':
|
|
99
|
+
size === 'large' || size == 'xLarge',
|
|
100
|
+
},
|
|
101
|
+
!disabled && [
|
|
102
|
+
variant === 'standard' && {
|
|
103
|
+
'state-on-surface-variant': !isActive,
|
|
104
|
+
'state-primary': isActive,
|
|
22
105
|
},
|
|
23
|
-
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'rounded-[70px]': size === 'large' || size == 'xLarge',
|
|
106
|
+
variant === 'filled' && {
|
|
107
|
+
'state-primary': !isActive && Boolean(onToggle),
|
|
108
|
+
'state-inverse-on-surface': isActive || !onToggle,
|
|
27
109
|
},
|
|
28
|
-
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'rounded-[28px]': size === 'large' || size == 'xLarge',
|
|
110
|
+
variant === 'tonal' && {
|
|
111
|
+
'state-on-surface-variant': !isActive && Boolean(onToggle),
|
|
112
|
+
'state-on-secondary-container': isActive || !onToggle,
|
|
32
113
|
},
|
|
33
|
-
|
|
34
|
-
!
|
|
35
|
-
|
|
36
|
-
'active:rounded-[16px]': size === 'medium',
|
|
37
|
-
'active:rounded-[28px]': size === 'large' || size == 'xLarge',
|
|
38
|
-
},
|
|
39
|
-
variant === 'filled' && [
|
|
40
|
-
!disabled && {
|
|
41
|
-
'bg-surface-container': !isActive && Boolean(onToggle),
|
|
42
|
-
'bg-primary': isActive || !onToggle,
|
|
43
|
-
},
|
|
44
|
-
Boolean(disabled) && 'bg-on-surface/[0.12]',
|
|
45
|
-
],
|
|
46
|
-
variant === 'tonal' && [
|
|
47
|
-
!disabled && {
|
|
48
|
-
'bg-surface-container': !isActive && Boolean(onToggle),
|
|
49
|
-
'bg-secondary-container': isActive || !onToggle,
|
|
50
|
-
},
|
|
51
|
-
Boolean(disabled) && 'bg-on-surface/[0.12]',
|
|
52
|
-
],
|
|
53
|
-
variant === 'outlined' && [
|
|
54
|
-
!disabled && {
|
|
55
|
-
'border border-outline': !isActive,
|
|
56
|
-
'border border-transparent bg-inverse-surface': isActive,
|
|
57
|
-
},
|
|
58
|
-
Boolean(disabled) && {
|
|
59
|
-
'border border-on-surface/[0.12]': !isActive,
|
|
60
|
-
'border border-transparent bg-on-surface/[0.12]': isActive,
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
),
|
|
64
|
-
touchTarget: classNames(
|
|
65
|
-
'absolute -translate-x-1/2 -translate-y-1/2 left-1/2 top-1/2 h-12 w-full',
|
|
66
|
-
),
|
|
67
|
-
stateLayer: classNames(
|
|
68
|
-
'absolute top-0 left-0 h-full w-full overflow-hidden',
|
|
69
|
-
(shape === 'rounded' ||
|
|
70
|
-
(shape === 'squared' &&
|
|
71
|
-
onToggle &&
|
|
72
|
-
!disabled &&
|
|
73
|
-
isActive &&
|
|
74
|
-
allowShapeTransformation)) && {
|
|
75
|
-
'rounded-[30px]': size === 'xSmall' || size == 'small',
|
|
76
|
-
'rounded-[40px]': size === 'medium',
|
|
77
|
-
'rounded-[70px]': size === 'large' || size == 'xLarge',
|
|
114
|
+
variant === 'outlined' && {
|
|
115
|
+
'state-on-surface-variant': !isActive,
|
|
116
|
+
'state-on-primary': isActive,
|
|
78
117
|
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
118
|
+
],
|
|
119
|
+
),
|
|
120
|
+
icon: classNames(
|
|
121
|
+
' transition-all duration-300',
|
|
122
|
+
{ 'size-5 p-1.5': size === 'xSmall' },
|
|
123
|
+
{ 'size-6 p-2': size === 'small' },
|
|
124
|
+
{ 'size-6 p-4': size === 'medium' },
|
|
125
|
+
{ 'size-8 p-8': size === 'large' },
|
|
126
|
+
{ 'size-10 p-12': size === 'xLarge' },
|
|
127
|
+
width == 'narrow' && [
|
|
128
|
+
{ 'px-1': size === 'xSmall' },
|
|
129
|
+
{ 'px-1': size === 'small' },
|
|
130
|
+
{ 'px-3': size === 'medium' },
|
|
131
|
+
{ 'px-4': size === 'large' },
|
|
132
|
+
{ 'px-8': size === 'xLarge' },
|
|
133
|
+
],
|
|
134
|
+
width == 'wide' && [
|
|
135
|
+
{ 'px-2.5': size === 'xSmall' },
|
|
136
|
+
{ 'px-3.5': size === 'small' },
|
|
137
|
+
{ 'px-6': size === 'medium' },
|
|
138
|
+
{ 'px-12': size === 'large' },
|
|
139
|
+
{ 'px-[72px]': size === 'xLarge' },
|
|
140
|
+
],
|
|
141
|
+
!disabled && [
|
|
142
|
+
variant === 'standard' && {
|
|
143
|
+
'text-on-surface-variant': !isActive,
|
|
144
|
+
'text-primary': isActive,
|
|
88
145
|
},
|
|
89
|
-
|
|
90
|
-
!
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
),
|
|
114
|
-
icon: classNames(
|
|
115
|
-
' transition-all duration-300',
|
|
116
|
-
{ 'size-5 p-1.5': size === 'xSmall' },
|
|
117
|
-
{ 'size-6 p-2': size === 'small' },
|
|
118
|
-
{ 'size-6 p-4': size === 'medium' },
|
|
119
|
-
{ 'size-8 p-8': size === 'large' },
|
|
120
|
-
{ 'size-10 p-12': size === 'xLarge' },
|
|
121
|
-
width == 'narrow' && [
|
|
122
|
-
{ 'px-1': size === 'xSmall' },
|
|
123
|
-
{ 'px-1': size === 'small' },
|
|
124
|
-
{ 'px-3': size === 'medium' },
|
|
125
|
-
{ 'px-4': size === 'large' },
|
|
126
|
-
{ 'px-8': size === 'xLarge' },
|
|
127
|
-
],
|
|
128
|
-
width == 'wide' && [
|
|
129
|
-
{ 'px-2.5': size === 'xSmall' },
|
|
130
|
-
{ 'px-3.5': size === 'small' },
|
|
131
|
-
{ 'px-6': size === 'medium' },
|
|
132
|
-
{ 'px-12': size === 'large' },
|
|
133
|
-
{ 'px-[72px]': size === 'xLarge' },
|
|
134
|
-
],
|
|
135
|
-
!disabled && [
|
|
136
|
-
variant === 'standard' && {
|
|
137
|
-
'text-on-surface-variant': !isActive,
|
|
138
|
-
'text-primary': isActive,
|
|
139
|
-
},
|
|
140
|
-
variant === 'filled' && {
|
|
141
|
-
'text-primary': !isActive && Boolean(onToggle),
|
|
142
|
-
'text-on-primary': isActive || !onToggle,
|
|
143
|
-
},
|
|
144
|
-
variant === 'tonal' && {
|
|
145
|
-
'text-on-surface-variant': !isActive && Boolean(onToggle),
|
|
146
|
-
'text-on-secondary-container': isActive || !onToggle,
|
|
147
|
-
},
|
|
148
|
-
variant === 'outlined' && {
|
|
149
|
-
'text-on-surface-variant': !isActive,
|
|
150
|
-
'text-inverse-on-surface': isActive,
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
Boolean(disabled) && 'text-on-surface/[0.38]',
|
|
154
|
-
),
|
|
155
|
-
};
|
|
156
|
-
},
|
|
146
|
+
variant === 'filled' && {
|
|
147
|
+
'text-primary': !isActive && Boolean(onToggle),
|
|
148
|
+
'text-on-primary': isActive || !onToggle,
|
|
149
|
+
},
|
|
150
|
+
variant === 'outlined' && {
|
|
151
|
+
'text-on-surface-variant': !isActive,
|
|
152
|
+
'text-inverse-on-surface': isActive,
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
Boolean(disabled) && 'text-on-surface/[0.38]',
|
|
156
|
+
),
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export const iconButtonStyle = defaultClassNames<IconButtonInterface>(
|
|
161
|
+
'iconButton',
|
|
162
|
+
iconButtonConfig,
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
export const useIconButtonStyle = createUseClassNames<IconButtonInterface>(
|
|
166
|
+
'iconButton',
|
|
167
|
+
iconButtonConfig,
|
|
157
168
|
);
|
package/src/lib/styles/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './carousel-item.style';
|
|
|
4
4
|
export * from './carousel.style';
|
|
5
5
|
export * from './divider.style';
|
|
6
6
|
export * from './fab.style';
|
|
7
|
+
export * from './fab-menu.style';
|
|
7
8
|
export * from './icon-button.style';
|
|
8
9
|
export * from './progress-indicator.style';
|
|
9
10
|
export * from './side-sheet.style';
|
|
@@ -14,3 +15,4 @@ export * from './tab.style';
|
|
|
14
15
|
export * from './tabs.style';
|
|
15
16
|
export * from './text-field.style';
|
|
16
17
|
export * from './tooltip.style';
|
|
18
|
+
export { useButtonStyle } from './button.style';
|
|
@@ -1,47 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type ClassNameComponent,
|
|
3
|
+
classNames,
|
|
4
|
+
createUseClassNames,
|
|
5
|
+
defaultClassNames,
|
|
6
|
+
} from '../utils';
|
|
2
7
|
import { NavigationRailItemInterface } from '../interfaces';
|
|
3
8
|
|
|
9
|
+
const navigationRailItemConfig: ClassNameComponent<
|
|
10
|
+
NavigationRailItemInterface
|
|
11
|
+
> = ({ isSelected, icon, label, variant }) => ({
|
|
12
|
+
navigationRailItem: classNames(
|
|
13
|
+
' group/navigation-rail-item flex flex-col pt-1 pb-1.5 cursor-pointer',
|
|
14
|
+
{
|
|
15
|
+
'text-on-surface-variant': !isSelected,
|
|
16
|
+
'text-on-secondary-container': isSelected,
|
|
17
|
+
'gap-2 h-[68px]': variant == 'vertical',
|
|
18
|
+
'gap-0 h-[66px]': variant == 'horizontal',
|
|
19
|
+
},
|
|
20
|
+
),
|
|
21
|
+
container: classNames(
|
|
22
|
+
' w-fit flex justify-center relative rounded-full items-center mx-5',
|
|
23
|
+
{
|
|
24
|
+
'bg-secondary-container overflow-hidden': isSelected,
|
|
25
|
+
'gap-2 ': variant == 'horizontal',
|
|
26
|
+
'gap-0 ': variant == 'vertical',
|
|
27
|
+
'p-4': !label,
|
|
28
|
+
},
|
|
29
|
+
label && [
|
|
30
|
+
'px-4',
|
|
31
|
+
{
|
|
32
|
+
'py-1 ': variant == 'vertical',
|
|
33
|
+
'py-4 ': variant == 'horizontal',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
),
|
|
37
|
+
stateLayer: classNames('rounded-full'),
|
|
38
|
+
|
|
39
|
+
icon: classNames('size-6 flex'),
|
|
40
|
+
label: classNames('w-fit mx-auto text-nowrap', {
|
|
41
|
+
'text-label-large ': variant == 'horizontal',
|
|
42
|
+
'text-label-medium': variant == 'vertical',
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
|
|
4
46
|
export const navigationRailItemStyle =
|
|
5
47
|
defaultClassNames<NavigationRailItemInterface>(
|
|
6
48
|
'navigationRailItem',
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
' group flex flex-col pt-1 pb-1.5 cursor-pointer',
|
|
10
|
-
{
|
|
11
|
-
'text-on-surface-variant': !isSelected,
|
|
12
|
-
'text-on-secondary-container': isSelected,
|
|
13
|
-
'gap-2 h-[68px]': variant == 'vertical',
|
|
14
|
-
'gap-0 h-[66px]': variant == 'horizontal',
|
|
15
|
-
},
|
|
16
|
-
),
|
|
17
|
-
container: classNames(
|
|
18
|
-
' w-fit flex justify-center relative rounded-full items-center mx-5',
|
|
19
|
-
{
|
|
20
|
-
'bg-secondary-container overflow-hidden': isSelected,
|
|
21
|
-
'gap-2 ': variant == 'horizontal',
|
|
22
|
-
'gap-0 ': variant == 'vertical',
|
|
23
|
-
'p-4': !label,
|
|
24
|
-
},
|
|
25
|
-
label && [
|
|
26
|
-
'px-4',
|
|
27
|
-
{
|
|
28
|
-
'py-1 ': variant == 'vertical',
|
|
29
|
-
'py-4 ': variant == 'horizontal',
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
),
|
|
33
|
-
stateLayer: classNames(
|
|
34
|
-
' absolute w-full rounded-full h-full left-0 top-0 ',
|
|
35
|
-
{
|
|
36
|
-
'group-state-on-surface': !isSelected,
|
|
37
|
-
'group-state-on-secondary-container': isSelected,
|
|
38
|
-
},
|
|
39
|
-
),
|
|
49
|
+
navigationRailItemConfig,
|
|
50
|
+
);
|
|
40
51
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}),
|
|
46
|
-
}),
|
|
52
|
+
export const useNavigationRailItemStyle =
|
|
53
|
+
createUseClassNames<NavigationRailItemInterface>(
|
|
54
|
+
'navigationRailItem',
|
|
55
|
+
navigationRailItemConfig,
|
|
47
56
|
);
|
|
@@ -1,20 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type ClassNameComponent,
|
|
3
|
+
classNames,
|
|
4
|
+
createUseClassNames,
|
|
5
|
+
defaultClassNames,
|
|
6
|
+
} from '../utils';
|
|
2
7
|
import { NavigationRailInterface } from '../interfaces/navigation-rail.interface';
|
|
3
8
|
|
|
9
|
+
const navigationRailConfig: ClassNameComponent<NavigationRailInterface> = ({
|
|
10
|
+
isExtended,
|
|
11
|
+
alignment,
|
|
12
|
+
}) => ({
|
|
13
|
+
navigationRail: classNames('flex flex-col left-0 h-full top-0 pt-11', {
|
|
14
|
+
'w-fit max-w-24': !isExtended,
|
|
15
|
+
'w-fit min-w-[220px] max-w-[360px]': isExtended,
|
|
16
|
+
'justify-between': alignment == 'middle',
|
|
17
|
+
'justify-start': alignment == 'top',
|
|
18
|
+
}),
|
|
19
|
+
header: classNames('flex flex-col gap-1 items-start'),
|
|
20
|
+
menuIcon: 'mx-5',
|
|
21
|
+
segments: classNames(' flex flex-col overflow-auto min-w-full mt-10', {
|
|
22
|
+
'w-full': !isExtended,
|
|
23
|
+
'w-fit items-start': isExtended,
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
|
|
4
27
|
export const navigationRailStyle = defaultClassNames<NavigationRailInterface>(
|
|
5
28
|
'navigationRail',
|
|
6
|
-
|
|
7
|
-
navigationRail: classNames('flex flex-col left-0 h-full top-0 pt-11', {
|
|
8
|
-
'w-fit max-w-24': !isExtended,
|
|
9
|
-
'w-fit min-w-[220px] max-w-[360px]': isExtended,
|
|
10
|
-
'justify-between': alignment == 'middle',
|
|
11
|
-
'justify-start': alignment == 'top',
|
|
12
|
-
}),
|
|
13
|
-
header: classNames('flex flex-col gap-1 items-start'),
|
|
14
|
-
menuIcon: 'mx-5',
|
|
15
|
-
segments: classNames(' flex flex-col overflow-auto min-w-full mt-10', {
|
|
16
|
-
'w-full': !isExtended,
|
|
17
|
-
'w-fit items-start': isExtended,
|
|
18
|
-
}),
|
|
19
|
-
})
|
|
29
|
+
navigationRailConfig,
|
|
20
30
|
);
|
|
31
|
+
|
|
32
|
+
export const useNavigationRailStyle =
|
|
33
|
+
createUseClassNames<NavigationRailInterface>(
|
|
34
|
+
'navigationRail',
|
|
35
|
+
navigationRailConfig,
|
|
36
|
+
);
|
|
@@ -1,43 +1,56 @@
|
|
|
1
1
|
import { ProgressIndicatorInterface } from '../interfaces/progress-indicator.interface';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type ClassNameComponent,
|
|
4
|
+
classNames,
|
|
5
|
+
createUseClassNames,
|
|
6
|
+
defaultClassNames,
|
|
7
|
+
} from '../utils';
|
|
8
|
+
|
|
9
|
+
const progressIndicatorConfig: ClassNameComponent<
|
|
10
|
+
ProgressIndicatorInterface
|
|
11
|
+
> = ({ variant, isVisible }) => ({
|
|
12
|
+
progressIndicator: classNames(
|
|
13
|
+
(variant === 'linear-determinate' || variant == 'linear-indeterminate') &&
|
|
14
|
+
'flex w-full h-1',
|
|
15
|
+
),
|
|
16
|
+
track: classNames('h-full rounded-full bg-primary rounded-l-full', {
|
|
17
|
+
'max-h-0': !isVisible,
|
|
18
|
+
'max-h-full': isVisible,
|
|
19
|
+
}),
|
|
20
|
+
activeIndicator: classNames(
|
|
21
|
+
{
|
|
22
|
+
'max-h-0': !isVisible,
|
|
23
|
+
'max-h-full': isVisible,
|
|
24
|
+
},
|
|
25
|
+
(variant === 'linear-determinate' || variant == 'linear-indeterminate') &&
|
|
26
|
+
'h-full flex-1 rounded-full bg-primary-container',
|
|
27
|
+
|
|
28
|
+
(variant === 'circular-determinate' ||
|
|
29
|
+
variant == 'circular-indeterminate') && [
|
|
30
|
+
'stroke-primary fill-transparent ',
|
|
31
|
+
{
|
|
32
|
+
'stroke-[4px]': isVisible,
|
|
33
|
+
'stroke-[0px]': !isVisible,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
),
|
|
37
|
+
stop: classNames(
|
|
38
|
+
'absolute top-1/2 -translate-y-1/2 right-0 bg-primary rounded-full size-1',
|
|
39
|
+
{
|
|
40
|
+
'max-h-0': !isVisible,
|
|
41
|
+
'max-h-full': isVisible,
|
|
42
|
+
},
|
|
43
|
+
),
|
|
44
|
+
});
|
|
3
45
|
|
|
4
46
|
export const progressIndicatorStyle =
|
|
5
47
|
defaultClassNames<ProgressIndicatorInterface>(
|
|
6
48
|
'progressIndicator',
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
(variant === 'linear-determinate' ||
|
|
10
|
-
variant == 'linear-indeterminate') &&
|
|
11
|
-
'flex w-full h-1',
|
|
12
|
-
),
|
|
13
|
-
track: classNames('h-full rounded-full bg-primary rounded-l-full', {
|
|
14
|
-
'max-h-0': !isVisible,
|
|
15
|
-
'max-h-full': isVisible,
|
|
16
|
-
}),
|
|
17
|
-
activeIndicator: classNames(
|
|
18
|
-
{
|
|
19
|
-
'max-h-0': !isVisible,
|
|
20
|
-
'max-h-full': isVisible,
|
|
21
|
-
},
|
|
22
|
-
(variant === 'linear-determinate' ||
|
|
23
|
-
variant == 'linear-indeterminate') &&
|
|
24
|
-
'h-full flex-1 rounded-full bg-primary-container',
|
|
49
|
+
progressIndicatorConfig,
|
|
50
|
+
);
|
|
25
51
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
'stroke-[4px]': isVisible,
|
|
31
|
-
'stroke-[0px]': !isVisible,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
),
|
|
35
|
-
stop: classNames(
|
|
36
|
-
'absolute top-1/2 -translate-y-1/2 right-0 bg-primary rounded-full size-1',
|
|
37
|
-
{
|
|
38
|
-
'max-h-0': !isVisible,
|
|
39
|
-
'max-h-full': isVisible,
|
|
40
|
-
},
|
|
41
|
-
),
|
|
42
|
-
}),
|
|
52
|
+
export const useProgressIndicatorStyle =
|
|
53
|
+
createUseClassNames<ProgressIndicatorInterface>(
|
|
54
|
+
'progressIndicator',
|
|
55
|
+
progressIndicatorConfig,
|
|
43
56
|
);
|
|
@@ -1,31 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
type ClassNameComponent,
|
|
3
|
+
classNames,
|
|
4
|
+
createUseClassNames,
|
|
5
|
+
defaultClassNames,
|
|
6
|
+
} from '../utils';
|
|
3
7
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
import { SideSheetInterface } from '../interfaces';
|
|
9
|
+
|
|
10
|
+
export const sideSheetConfig: ClassNameComponent<SideSheetInterface> = ({
|
|
11
|
+
variant,
|
|
12
|
+
position,
|
|
13
|
+
}) => ({
|
|
14
|
+
sideSheet: classNames(
|
|
15
|
+
'bg-surface flex justify-between max-w-xs z-10',
|
|
16
|
+
{
|
|
17
|
+
'flex-row-reverse': position == 'right',
|
|
18
|
+
'h-full': variant == 'standard',
|
|
19
|
+
},
|
|
20
|
+
variant == 'modal' && [
|
|
21
|
+
'rounded-2xl fixed top-0 m-[1rem] h-[calc(100dvh-2rem)]',
|
|
9
22
|
{
|
|
10
|
-
'
|
|
11
|
-
'
|
|
23
|
+
'right-0': position == 'right',
|
|
24
|
+
'left-0': position == 'left',
|
|
12
25
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
],
|
|
27
|
+
),
|
|
28
|
+
container: classNames('w-full overflow-hidden', {}),
|
|
29
|
+
content: classNames('w-fit '),
|
|
30
|
+
header: classNames('p-4 flex items-center gap-2'),
|
|
31
|
+
title: classNames('text-on-surface-variant text-title-large'),
|
|
32
|
+
closeButton: classNames('ml-auto'),
|
|
33
|
+
divider: classNames({ hidden: variant == 'modal' }),
|
|
34
|
+
overlay: classNames('bg-[black]/[0.32] fixed top-0 left-0 w-screen h-screen'),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const sideSheetStyle = defaultClassNames<SideSheetInterface>(
|
|
38
|
+
'sideSheet',
|
|
39
|
+
sideSheetConfig,
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export const useSideSheetStyle = createUseClassNames<SideSheetInterface>(
|
|
43
|
+
'sideSheet',
|
|
44
|
+
sideSheetConfig,
|
|
31
45
|
);
|