@teammodlr/ui-kit 1.0.7 → 2.0.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/lib/__storybook__/argTypes.d.ts +10 -1
- package/lib/components/avatar/Avatar.vue.d.ts +16 -30
- package/lib/components/avatar/style/Avatar.css.d.ts +9 -0
- package/lib/components/avatar/style/index.d.ts +1 -0
- package/lib/components/avatargroup/AvatarGroup.vue.d.ts +28 -13
- package/lib/components/avatargroup/style/AvatarGroup.css.d.ts +2 -0
- package/lib/components/avatargroup/style/index.d.ts +1 -0
- package/lib/components/avatargroup/symbol.d.ts +13 -0
- package/lib/components/badge/Badge.vue.d.ts +30 -0
- package/lib/components/badge/style/Badge.css.d.ts +4 -0
- package/lib/components/badge/style/index.d.ts +1 -0
- package/lib/components/breadcrumb/Breadcrumb.vue.d.ts +12 -3
- package/lib/components/{breadcrumbitem → breadcrumb}/BreadcrumbItem.vue.d.ts +11 -0
- package/lib/components/breadcrumb/style/Breadcrumb.css.d.ts +4 -0
- package/lib/components/breadcrumb/style/index.d.ts +1 -0
- package/lib/components/breadcrumb/symbol.d.ts +13 -0
- package/lib/components/button/Button.vue.d.ts +39 -28
- package/lib/components/button/style/Button.css.d.ts +24 -0
- package/lib/components/button/style/index.d.ts +1 -0
- package/lib/components/buttongroup/ButtonGroup.vue.d.ts +2 -13
- package/lib/components/buttongroup/style/ButtonGroup.css.d.ts +2 -0
- package/lib/components/buttongroup/style/index.d.ts +1 -0
- package/lib/components/buttongroup/symbol.d.ts +6 -0
- package/lib/components/checkbox/Checkbox.vue.d.ts +17 -20
- package/lib/components/checkbox/style/Checkbox.css.d.ts +16 -0
- package/lib/components/checkbox/style/index.d.ts +1 -0
- package/lib/components/colorpicker/ColorPicker.vue.d.ts +75 -0
- package/lib/components/colorpicker/style/ColorPicker.css.d.ts +9 -0
- package/lib/components/colorpicker/style/index.d.ts +1 -0
- package/lib/components/colorpicker/utils.d.ts +16 -0
- package/lib/components/dropdown/Dropdown.vue.d.ts +5 -4
- package/lib/components/dropdown/DropdownItem.vue.d.ts +12 -5
- package/lib/components/dropdown/DropdownList.vue.d.ts +4 -1
- package/lib/components/dropdown/style/Dropdown.css.d.ts +5 -0
- package/lib/components/dropdown/style/index.d.ts +1 -0
- package/lib/components/dropdown/symbol.d.ts +6 -0
- package/lib/components/index.d.ts +10 -1
- package/lib/components/input/Input.vue.d.ts +35 -19
- package/lib/components/input/style/Input.css.d.ts +23 -0
- package/lib/components/input/style/index.d.ts +1 -0
- package/lib/components/link/Link.vue.d.ts +2 -2
- package/lib/components/messageprovider/Message.vue.d.ts +13 -1
- package/lib/components/messageprovider/MessageProvider.vue.d.ts +6 -5
- package/lib/components/messageprovider/style/Message.css.d.ts +12 -0
- package/lib/components/messageprovider/style/index.d.ts +1 -0
- package/lib/components/messageprovider/types.d.ts +2 -1
- package/lib/components/modal/Modal.vue.d.ts +52 -0
- package/lib/components/modal/style/Modal.css.d.ts +21 -0
- package/lib/components/modal/style/index.d.ts +1 -0
- package/lib/components/radio/Radio.vue.d.ts +85 -0
- package/lib/components/radio/style/Checkbox.css.d.ts +16 -0
- package/lib/components/radio/style/index.d.ts +1 -0
- package/lib/components/radiobutton/RadioButton.vue.d.ts +98 -0
- package/lib/components/radiobutton/style/RadioButton.css.d.ts +14 -0
- package/lib/components/radiobutton/style/index.d.ts +1 -0
- package/lib/components/radiobuttongroup/RadioButtonGroup.vue.d.ts +48 -0
- package/lib/components/radiobuttongroup/style/RadioButtonGroup.css.d.ts +3 -0
- package/lib/components/radiobuttongroup/style/index.d.ts +1 -0
- package/lib/components/radiobuttongroup/symbol.d.ts +9 -0
- package/lib/components/select/Select.vue.d.ts +22 -13
- package/lib/components/select/style/Select.css.d.ts +30 -0
- package/lib/components/select/style/index.d.ts +1 -0
- package/lib/components/skeleton/Skeleton.vue.d.ts +15 -21
- package/lib/components/skeleton/style/Skeleton.css.d.ts +8 -0
- package/lib/components/skeleton/style/index.d.ts +2 -0
- package/lib/components/slider/Slider.vue.d.ts +32 -0
- package/lib/components/slider/style/Slider.css.d.ts +4 -0
- package/lib/components/slider/style/index.d.ts +1 -0
- package/lib/components/tab/TabGroup.vue.d.ts +1 -1
- package/lib/components/table/Table.vue.d.ts +1 -1
- package/lib/components/tag/Tag.vue.d.ts +44 -0
- package/lib/components/tag/style/Tag.css.d.ts +11 -0
- package/lib/components/tag/style/index.d.ts +1 -0
- package/lib/components/tooltip/Tooltip.vue.d.ts +17 -2
- package/lib/components/tooltip/style/Tooltip.css.d.ts +6 -0
- package/lib/components/tooltip/style/index.d.ts +1 -0
- package/lib/components/virtualscroll/VirtualScroll.vue.d.ts +46 -16
- package/lib/components/virtualscroll/style/VirtualScroll.css.d.ts +1 -0
- package/lib/components/virtualscroll/style/index.d.ts +1 -0
- package/lib/composables/useInput.d.ts +1 -1
- package/lib/composables/useInteractive.d.ts +15 -0
- package/lib/composables/useZIndex.d.ts +8 -0
- package/lib/index.cjs.js +8 -2
- package/lib/index.d.ts +0 -1
- package/lib/index.es.js +3688 -1692
- package/lib/style.css +1 -1
- package/lib/styles/theme.css.d.ts +147 -0
- package/lib/styles/typography.css.d.ts +22 -0
- package/lib/types/props.d.ts +1 -0
- package/package.json +33 -26
- package/src/__storybook__/argTypes.ts +19 -1
- package/src/components/avatar/Avatar.vue +33 -26
- package/src/components/avatar/examples/index.stories.ts +1 -1
- package/src/components/avatar/style/Avatar.css.ts +92 -0
- package/src/components/avatar/style/index.ts +1 -0
- package/src/components/avatargroup/AvatarGroup.vue +71 -32
- package/src/components/avatargroup/examples/basic.vue +33 -7
- package/src/components/avatargroup/examples/index.stories.ts +4 -8
- package/src/components/avatargroup/style/AvatarGroup.css.ts +21 -0
- package/src/components/avatargroup/style/index.ts +1 -0
- package/src/components/avatargroup/symbol.ts +17 -0
- package/src/components/badge/Badge.css +128 -0
- package/src/components/badge/Badge.vue +43 -0
- package/src/components/badge/examples/basic.vue +10 -0
- package/src/components/badge/examples/index.stories.ts +21 -0
- package/src/components/badge/examples/index.ts +1 -0
- package/src/components/badge/style/Badge.css.ts +124 -0
- package/src/components/badge/style/index.ts +1 -0
- package/src/components/breadcrumb/Breadcrumb.vue +22 -15
- package/src/components/breadcrumb/BreadcrumbItem.vue +73 -0
- package/src/components/breadcrumb/examples/basic.vue +5 -7
- package/src/components/breadcrumb/examples/index.stories.ts +2 -2
- package/src/components/breadcrumb/style/Breadcrumb.css.ts +40 -0
- package/src/components/breadcrumb/style/index.ts +1 -0
- package/src/components/breadcrumb/symbol.ts +17 -0
- package/src/components/button/Button.vue +194 -107
- package/src/components/button/examples/icon-left.vue +12 -0
- package/src/components/button/examples/icon.vue +6 -7
- package/src/components/button/examples/index.stories.ts +9 -7
- package/src/components/button/examples/index.ts +3 -2
- package/src/components/button/examples/variants-secondary.vue +8 -0
- package/src/components/button/examples/variants.vue +8 -0
- package/src/components/button/style/Button.css.ts +585 -0
- package/src/components/button/style/index.ts +1 -0
- package/src/components/buttongroup/ButtonGroup.vue +36 -47
- package/src/components/buttongroup/examples/basic.vue +2 -2
- package/src/components/buttongroup/examples/icon-group.vue +22 -0
- package/src/components/buttongroup/examples/index.stories.ts +4 -2
- package/src/components/buttongroup/examples/index.ts +1 -0
- package/src/components/buttongroup/style/ButtonGroup.css.ts +40 -0
- package/src/components/buttongroup/style/index.ts +1 -0
- package/src/components/buttongroup/symbol.ts +8 -0
- package/src/components/checkbox/Checkbox.vue +70 -54
- package/src/components/checkbox/examples/index.stories.ts +1 -1
- package/src/components/checkbox/style/Checkbox.css.ts +127 -0
- package/src/components/checkbox/style/index.ts +1 -0
- package/src/components/colorpicker/ColorPicker.vue +283 -0
- package/src/components/colorpicker/examples/basic.vue +3 -0
- package/src/components/colorpicker/examples/index.stories.ts +17 -0
- package/src/components/colorpicker/examples/index.ts +1 -0
- package/src/components/colorpicker/style/ColorPicker.css.ts +97 -0
- package/src/components/colorpicker/style/index.ts +1 -0
- package/src/components/colorpicker/utils.ts +188 -0
- package/src/components/dropdown/Dropdown.vue +45 -24
- package/src/components/dropdown/DropdownItem.vue +121 -118
- package/src/components/dropdown/DropdownList.vue +3 -3
- package/src/components/dropdown/DropdownWrapper.vue +2 -1
- package/src/components/dropdown/examples/custom.vue +13 -0
- package/src/components/dropdown/examples/index.stories.ts +4 -2
- package/src/components/dropdown/examples/index.ts +1 -0
- package/src/components/dropdown/style/Dropdown.css.ts +48 -0
- package/src/components/dropdown/style/index.ts +1 -0
- package/src/components/dropdown/symbol.ts +8 -0
- package/src/components/form/examples/basic.vue +4 -2
- package/src/components/form/examples/index.stories.ts +4 -2
- package/src/components/image/examples/index.stories.ts +1 -1
- package/src/components/index.ts +10 -2
- package/src/components/input/Input.vue +84 -42
- package/src/components/input/examples/basic.vue +2 -1
- package/src/components/input/examples/index.stories.ts +1 -1
- package/src/components/input/examples/prefix.vue +4 -2
- package/src/components/input/examples/suffix.vue +4 -2
- package/src/components/input/style/Input.css.ts +221 -0
- package/src/components/input/style/index.ts +1 -0
- package/src/components/link/examples/index.stories.ts +1 -1
- package/src/components/messageprovider/Message.vue +52 -5
- package/src/components/messageprovider/MessageProvider.css +0 -13
- package/src/components/messageprovider/MessageProvider.vue +18 -16
- package/src/components/messageprovider/examples/basic.vue +56 -5
- package/src/components/messageprovider/examples/index.stories.ts +0 -1
- package/src/components/messageprovider/examples/index.ts +1 -0
- package/src/components/messageprovider/examples/update.vue +34 -0
- package/src/components/messageprovider/examples/wrapper.vue +1 -1
- package/src/components/messageprovider/style/Message.css.ts +109 -0
- package/src/components/messageprovider/style/index.ts +1 -0
- package/src/components/messageprovider/types.ts +9 -1
- package/src/components/modal/Modal.vue +126 -0
- package/src/components/modal/examples/basic.vue +40 -0
- package/src/components/modal/examples/index.stories.ts +20 -0
- package/src/components/modal/examples/index.ts +2 -0
- package/src/components/modal/examples/modal-form.vue +99 -0
- package/src/components/modal/style/Modal.css.ts +257 -0
- package/src/components/modal/style/index.ts +1 -0
- package/src/components/radio/Checkbox.css +185 -0
- package/src/components/radio/Radio.vue +137 -0
- package/src/components/radio/examples/basic.vue +9 -0
- package/src/components/radio/examples/index.stories.ts +19 -0
- package/src/components/radio/examples/index.ts +2 -0
- package/src/components/radio/style/Checkbox.css.ts +132 -0
- package/src/components/radio/style/index.ts +1 -0
- package/src/components/radiobutton/RadioButton.vue +131 -0
- package/src/components/radiobutton/style/RadioButton.css.ts +185 -0
- package/src/components/radiobutton/style/index.ts +1 -0
- package/src/components/radiobuttongroup/RadioButtonGroup.vue +75 -0
- package/src/components/radiobuttongroup/examples/basic.vue +17 -0
- package/src/components/radiobuttongroup/examples/index.stories.ts +22 -0
- package/src/components/radiobuttongroup/examples/index.ts +2 -0
- package/src/components/radiobuttongroup/style/RadioButtonGroup.css.ts +37 -0
- package/src/components/radiobuttongroup/style/index.ts +1 -0
- package/src/components/radiobuttongroup/symbol.ts +11 -0
- package/src/components/select/Select.css +0 -226
- package/src/components/select/Select.vue +116 -48
- package/src/components/select/examples/index.stories.ts +1 -1
- package/src/components/select/examples/multiple.vue +1 -2
- package/src/components/select/style/Select.css.ts +254 -0
- package/src/components/select/style/index.ts +1 -0
- package/src/components/skeleton/Skeleton.vue +55 -47
- package/src/components/skeleton/examples/index.stories.ts +1 -8
- package/src/components/skeleton/style/Skeleton.css.ts +57 -0
- package/src/components/skeleton/style/index.ts +2 -0
- package/src/components/slider/Slider.vue +76 -0
- package/src/components/slider/style/Slider.css.ts +43 -0
- package/src/components/slider/style/index.ts +1 -0
- package/src/components/tab/examples/index.stories.ts +1 -1
- package/src/components/table/examples/index.stories.ts +1 -1
- package/src/components/tag/Tag.css +0 -0
- package/src/components/tag/Tag.vue +66 -0
- package/src/components/tag/examples/basic.vue +5 -0
- package/src/components/tag/examples/index.stories.ts +22 -0
- package/src/components/tag/examples/index.ts +1 -0
- package/src/components/tag/style/Tag.css.ts +79 -0
- package/src/components/tag/style/index.ts +1 -0
- package/src/components/tooltip/Tooltip.css +0 -6
- package/src/components/tooltip/Tooltip.vue +53 -22
- package/src/components/tooltip/examples/basic.vue +2 -5
- package/src/components/tooltip/examples/index.stories.ts +1 -1
- package/src/components/tooltip/style/Tooltip.css.ts +48 -0
- package/src/components/tooltip/style/index.ts +1 -0
- package/src/components/virtualscroll/VirtualScroll.vue +159 -53
- package/src/components/virtualscroll/examples/basic.vue +21 -27
- package/src/components/virtualscroll/examples/index.stories.ts +2 -18
- package/src/components/virtualscroll/style/VirtualScroll.css.ts +18 -0
- package/src/components/virtualscroll/style/index.ts +1 -0
- package/src/composables/useInput.ts +2 -2
- package/src/composables/useInteractive.ts +20 -0
- package/src/composables/usePopper.ts +1 -1
- package/src/composables/useZIndex.ts +31 -0
- package/src/css/components.css +4 -3
- package/src/css/normalize.css +0 -379
- package/src/css/variables.css +2 -2
- package/src/examples/cards/cards.stories.ts +9 -0
- package/src/examples/cards/sidebar.vue +263 -0
- package/src/index.ts +1 -1
- package/src/styles/theme.css.ts +149 -0
- package/src/styles/typography.css.ts +91 -0
- package/src/types/props.ts +2 -0
- package/lib/components/breadcrumbitem/index.d.ts +0 -1
- package/src/components/avatar/Avatar.css +0 -69
- package/src/components/breadcrumbitem/BreadcrumbItem.vue +0 -66
- package/src/components/breadcrumbitem/index.ts +0 -1
- package/src/components/button/examples/colors-secondary.vue +0 -8
- package/src/components/button/examples/colors.vue +0 -8
- package/src/components/dropdown/Dropdown.css +0 -68
- /package/src/components/button/{Button.css → Button-old.css} +0 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { createVar, globalKeyframes, globalStyle, style, styleVariants } from "@vanilla-extract/css";
|
|
2
|
+
import { themeVars } from "../../../styles/theme.css";
|
|
3
|
+
import { fonts } from "../../../styles/typography.css";
|
|
4
|
+
|
|
5
|
+
const sizes = {
|
|
6
|
+
xs: '300px',
|
|
7
|
+
sm: '400px',
|
|
8
|
+
md: '640px',
|
|
9
|
+
lg: '800px',
|
|
10
|
+
xl: '1140px',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const vars = {
|
|
14
|
+
maxWidth: createVar(),
|
|
15
|
+
backgroundColor: createVar(),
|
|
16
|
+
borderColor: createVar(),
|
|
17
|
+
initialLeft: createVar(),
|
|
18
|
+
initialTop: createVar(),
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const size = styleVariants({
|
|
22
|
+
xs: {
|
|
23
|
+
vars: {
|
|
24
|
+
[vars.maxWidth]: sizes.xs,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
sm: {
|
|
28
|
+
vars: {
|
|
29
|
+
[vars.maxWidth]: sizes.sm,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
md: {
|
|
33
|
+
vars: {
|
|
34
|
+
[vars.maxWidth]: sizes.md,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
lg: {
|
|
38
|
+
vars: {
|
|
39
|
+
[vars.maxWidth]: sizes.lg,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
xl: {
|
|
43
|
+
vars: {
|
|
44
|
+
[vars.maxWidth]: sizes.xl,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
export const background = style({
|
|
51
|
+
zIndex: 100,
|
|
52
|
+
backgroundColor: 'hsla(0,0%,45.1%,0.7)',
|
|
53
|
+
position: "fixed",
|
|
54
|
+
top: 0,
|
|
55
|
+
bottom: 0,
|
|
56
|
+
left: 0,
|
|
57
|
+
right: 0,
|
|
58
|
+
display: "flex",
|
|
59
|
+
justifyContent: "center",
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export const container = style({
|
|
64
|
+
backgroundColor: "#fff",
|
|
65
|
+
width: "100%",
|
|
66
|
+
maxWidth: vars.maxWidth,
|
|
67
|
+
borderRadius: themeVars.rounded.medium,
|
|
68
|
+
boxShadow: "0 1px 2px -2px rgba(0, 0, 0, 0.08), 0 3px 6px 0 rgba(0, 0, 0, 0.06), 0 5px 12px 4px rgba(0, 0, 0, 0.04)",
|
|
69
|
+
border: `1px solid rgba(0, 0, 0, 0.45)`,
|
|
70
|
+
display: "flex",
|
|
71
|
+
flexDirection: "column",
|
|
72
|
+
position: "relative",
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export const header = style({
|
|
76
|
+
display: "flex",
|
|
77
|
+
justifyContent: "space-between",
|
|
78
|
+
alignItems: "start",
|
|
79
|
+
padding: `${themeVars.space[4]} ${themeVars.space[4]} 0 ${themeVars.space[4]}`,
|
|
80
|
+
flexShrink: "0"
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const title = style({
|
|
84
|
+
margin: 0,
|
|
85
|
+
fontSize: `${themeVars.fontSize.xlarge}`,
|
|
86
|
+
fontVariationSettings: `"wght" ${fonts.INTER.wghts[500]}`,
|
|
87
|
+
display: "flex",
|
|
88
|
+
alignItems: "center"
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export const close = style([
|
|
92
|
+
{
|
|
93
|
+
outline: `none ${themeVars.color.gray[300]}`,
|
|
94
|
+
display: 'inline-block',
|
|
95
|
+
position: 'relative',
|
|
96
|
+
width: '1.5rem',
|
|
97
|
+
height: '1.5rem',
|
|
98
|
+
backgroundColor: 'transparent',
|
|
99
|
+
border: 'none',
|
|
100
|
+
padding: 0,
|
|
101
|
+
cursor: 'pointer',
|
|
102
|
+
transition: 'all 0.2s',
|
|
103
|
+
borderRadius: themeVars.rounded.full,
|
|
104
|
+
marginLeft: themeVars.space[2],
|
|
105
|
+
':hover': {
|
|
106
|
+
backgroundColor: themeVars.color.gray[100]
|
|
107
|
+
},
|
|
108
|
+
':focus': {
|
|
109
|
+
backgroundColor: themeVars.color.gray[100]
|
|
110
|
+
},
|
|
111
|
+
'::before': {
|
|
112
|
+
content: '""',
|
|
113
|
+
position: 'absolute',
|
|
114
|
+
top: '50%',
|
|
115
|
+
left: '50%',
|
|
116
|
+
transform: 'translate(-50%, -50%) rotate(45deg)',
|
|
117
|
+
width: '0.8rem',
|
|
118
|
+
height: '2px',
|
|
119
|
+
backgroundColor: themeVars.color.gray[500],
|
|
120
|
+
transformOrigin: 'center',
|
|
121
|
+
transition: 'all 0.2s'
|
|
122
|
+
},
|
|
123
|
+
'::after': {
|
|
124
|
+
content: '""',
|
|
125
|
+
position: 'absolute',
|
|
126
|
+
top: '50%',
|
|
127
|
+
left: '50%',
|
|
128
|
+
transform: 'translate(-50%, -50%) rotate(-45deg)',
|
|
129
|
+
width: '0.8rem',
|
|
130
|
+
height: '2px',
|
|
131
|
+
backgroundColor: themeVars.color.gray[500],
|
|
132
|
+
transformOrigin: 'center',
|
|
133
|
+
transition: 'all 0.2s',
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
]);
|
|
137
|
+
|
|
138
|
+
export const body = style({
|
|
139
|
+
padding: `${themeVars.space[4]}`,
|
|
140
|
+
display: "flex",
|
|
141
|
+
flexDirection: "column",
|
|
142
|
+
flexGrow: "1"
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
export const footer = style({
|
|
146
|
+
display: "flex",
|
|
147
|
+
width: "100%",
|
|
148
|
+
alignItems: "center",
|
|
149
|
+
padding: `0 ${themeVars.space[4]} ${themeVars.space[4]} ${themeVars.space[4]}`,
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const fadeOutBackgroundAnimation = "fade-out-background-animation";
|
|
153
|
+
globalKeyframes(fadeOutBackgroundAnimation, {
|
|
154
|
+
'from': {
|
|
155
|
+
opacity: 1,
|
|
156
|
+
},
|
|
157
|
+
'to': {
|
|
158
|
+
opacity: 0,
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const fadeInBackgroundAnimation = "fade-in-background-animation";
|
|
163
|
+
globalKeyframes(fadeInBackgroundAnimation, {
|
|
164
|
+
'from': {
|
|
165
|
+
opacity: 0,
|
|
166
|
+
},
|
|
167
|
+
'to': {
|
|
168
|
+
opacity: 1,
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
const fadeOutAnimation = "fade-out-animation";
|
|
173
|
+
globalKeyframes(fadeOutAnimation, {
|
|
174
|
+
'from': {
|
|
175
|
+
opacity: 1,
|
|
176
|
+
transform: 'scale(1)'
|
|
177
|
+
},
|
|
178
|
+
'to': {
|
|
179
|
+
opacity: 0,
|
|
180
|
+
transform: 'scale(0.8)'
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
const fadeInAnimation = "fade-in-animation";
|
|
185
|
+
globalKeyframes(fadeInAnimation, {
|
|
186
|
+
'0%': {
|
|
187
|
+
opacity: 0,
|
|
188
|
+
transform: 'scale(0.5)',
|
|
189
|
+
left: vars.initialLeft,
|
|
190
|
+
top: vars.initialTop
|
|
191
|
+
},
|
|
192
|
+
'70%': {
|
|
193
|
+
opacity: 1,
|
|
194
|
+
transform: 'scale(1.03)',
|
|
195
|
+
left: 0,
|
|
196
|
+
top: 0
|
|
197
|
+
},
|
|
198
|
+
'100%': {
|
|
199
|
+
opacity: 1,
|
|
200
|
+
transform: 'scale(1)',
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
const fadeInAnimationNoBounce = "fade-in-animation-no-bounce";
|
|
205
|
+
globalKeyframes(fadeInAnimationNoBounce, {
|
|
206
|
+
'0%': {
|
|
207
|
+
opacity: 0,
|
|
208
|
+
transform: 'scale(0.5)',
|
|
209
|
+
left: vars.initialLeft,
|
|
210
|
+
top: vars.initialTop
|
|
211
|
+
},
|
|
212
|
+
'60%': {
|
|
213
|
+
opacity: 1,
|
|
214
|
+
},
|
|
215
|
+
'100%': {
|
|
216
|
+
opacity: 1,
|
|
217
|
+
transform: 'scale(1)',
|
|
218
|
+
left: 0,
|
|
219
|
+
top: 0
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
export const fadeEnterNoBounce = style({
|
|
224
|
+
animationName: fadeInAnimationNoBounce,
|
|
225
|
+
animationDuration: '0.2s',
|
|
226
|
+
animationTimingFunction: 'ease-in-out',
|
|
227
|
+
transition: "transform 0.3s ease-out",
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
export const fadeEnter = style({
|
|
231
|
+
animationName: fadeInAnimation,
|
|
232
|
+
animationDuration: '0.25s',
|
|
233
|
+
animationTimingFunction: 'ease-in-out',
|
|
234
|
+
transition: themeVars.transition.default,
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
export const fadeLeave = style({
|
|
238
|
+
animationName: fadeOutAnimation,
|
|
239
|
+
animationDuration: '0.2s',
|
|
240
|
+
animationTimingFunction: 'ease-in-out',
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
export const fadeBackgroundEnter = style({
|
|
244
|
+
animationName: fadeInBackgroundAnimation,
|
|
245
|
+
animationDuration: '0.1s',
|
|
246
|
+
animationTimingFunction: 'ease-in-out',
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
export const fadeBackgroundLeave = style({
|
|
250
|
+
animationName: fadeOutBackgroundAnimation,
|
|
251
|
+
animationDuration: '0.2s',
|
|
252
|
+
animationTimingFunction: 'ease-in-out',
|
|
253
|
+
})
|
|
254
|
+
|
|
255
|
+
export const fadeEnterFrom = style({
|
|
256
|
+
|
|
257
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Modal.css';
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
.m-checkbox {
|
|
2
|
+
--checkbox-width: 22px;
|
|
3
|
+
--checkbox-height: 22px;
|
|
4
|
+
--checkbox-border-radius: 6px;
|
|
5
|
+
--checkbox-border-width: 1px;
|
|
6
|
+
--checkbox-background-color: var(--white);
|
|
7
|
+
--checkbox-border-color: var(--gray-300);
|
|
8
|
+
--checkbox-gap: 6px;
|
|
9
|
+
|
|
10
|
+
--checkbox-tick-width: 4px;
|
|
11
|
+
--checkbox-tick-height: 10px;
|
|
12
|
+
--checkbox-tick-height-negative: -10px;
|
|
13
|
+
|
|
14
|
+
--checkbox-tick-top: 8px;
|
|
15
|
+
--checkbox-tick-left: 3px;
|
|
16
|
+
--checkbox-tick-border-width: 3px;
|
|
17
|
+
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
position: relative;
|
|
21
|
+
font-weight: bold;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
gap: var(--checkbox-gap);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.m-checkbox.m-checkbox--xs {
|
|
27
|
+
--checkbox-width: 16px;
|
|
28
|
+
--checkbox-height: 16px;
|
|
29
|
+
--checkbox-border-radius: 4px;
|
|
30
|
+
--checkbox-border-width: 1px;
|
|
31
|
+
--checkbox-tick-top: 6px;
|
|
32
|
+
--checkbox-tick-left: 1px;
|
|
33
|
+
|
|
34
|
+
--checkbox-tick-width: 3px;
|
|
35
|
+
--checkbox-tick-height: 8px;
|
|
36
|
+
--checkbox-tick-height-negative: -8px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.m-checkbox.m-checkbox--sm {
|
|
40
|
+
--checkbox-width: 20px;
|
|
41
|
+
--checkbox-height: 20px;
|
|
42
|
+
--checkbox-border-radius: 4px;
|
|
43
|
+
--checkbox-border-width: 1px;
|
|
44
|
+
--checkbox-tick-top: 7px;
|
|
45
|
+
--checkbox-tick-left: 2px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.m-checkbox.m-checkbox--lg {
|
|
49
|
+
--checkbox-width: 26px;
|
|
50
|
+
--checkbox-height: 26px;
|
|
51
|
+
--checkbox-border-radius: 8px;
|
|
52
|
+
--checkbox-border-width: 1px;
|
|
53
|
+
|
|
54
|
+
--checkbox-tick-top: 10px;
|
|
55
|
+
--checkbox-tick-left: 3px;
|
|
56
|
+
|
|
57
|
+
--checkbox-tick-border-width: 4px;
|
|
58
|
+
--checkbox-tick-width: 4px;
|
|
59
|
+
--checkbox-tick-height: 14px;
|
|
60
|
+
--checkbox-tick-height-negative: -14px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.m-checkbox.m-checkbox--xl {
|
|
64
|
+
--checkbox-width: 32px;
|
|
65
|
+
--checkbox-height: 32px;
|
|
66
|
+
--checkbox-border-radius: 8px;
|
|
67
|
+
--checkbox-border-width: 1px;
|
|
68
|
+
|
|
69
|
+
--checkbox-tick-top: 14px;
|
|
70
|
+
--checkbox-tick-left: 5px;
|
|
71
|
+
|
|
72
|
+
--checkbox-tick-border-width: 4px;
|
|
73
|
+
--checkbox-tick-width: 5px;
|
|
74
|
+
--checkbox-tick-height: 16px;
|
|
75
|
+
--checkbox-tick-height-negative: -16px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.m-checkbox.m-checkbox--blue.m-checkbox--checked {
|
|
79
|
+
--checkbox-background-color: var(--blue);
|
|
80
|
+
--checkbox-border-color: var(--blue);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.m-checkbox.m-checkbox--green.m-checkbox--checked {
|
|
84
|
+
--checkbox-background-color: var(--green);
|
|
85
|
+
--checkbox-border-color: var(--green);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.m-checkbox.m-checkbox--red.m-checkbox--checked {
|
|
89
|
+
--checkbox-background-color: var(--red);
|
|
90
|
+
--checkbox-border-color: var(--red);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.m-checkbox.m-checkbox--yellow.m-checkbox--checked {
|
|
94
|
+
--checkbox-background-color: var(--yellow);
|
|
95
|
+
--checkbox-border-color: var(--yellow);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.m-checkbox input {
|
|
99
|
+
position: absolute;
|
|
100
|
+
opacity: 0;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
height: 0;
|
|
103
|
+
width: 0;
|
|
104
|
+
display: none;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.m-checkbox span {
|
|
108
|
+
display: flex;
|
|
109
|
+
height: var(--checkbox-height);
|
|
110
|
+
width: var(--checkbox-width);
|
|
111
|
+
border-radius: var(--checkbox-border-radius);
|
|
112
|
+
border: var(--checkbox-border-width) solid var(--checkbox-border-color);
|
|
113
|
+
background-color: var(--checkbox-background-color);
|
|
114
|
+
transition: all 125ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
115
|
+
position: relative;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.m-checkbox:hover:not(.m-checkbox--checked):not(.m-checkbox--disabled) span {
|
|
119
|
+
--checkbox-border-color: var(--gray-400);
|
|
120
|
+
--checkbox-background-color: var(--gray-100);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.m-checkbox.m-checkbox--disabled span,
|
|
124
|
+
.m-checkbox.m-checkbox--disabled .m-checkbox__label {
|
|
125
|
+
cursor: not-allowed;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.m-checkbox.m-checkbox--disabled span {
|
|
129
|
+
opacity: 0.6;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.m-checkbox:not(.m-checkbox--checked).m-checkbox--disabled span {
|
|
133
|
+
--checkbox-border-color: var(--gray-300);
|
|
134
|
+
--checkbox-background-color: var(--gray-100);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.m-checkbox.m-checkbox--checked span {
|
|
138
|
+
background-color: var(--checkbox-background-color);
|
|
139
|
+
border-color: var(--checkbox-background-color);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.m-checkbox.m-checkbox--checked span::before {
|
|
143
|
+
content: "";
|
|
144
|
+
position: absolute;
|
|
145
|
+
transform: rotate(45deg);
|
|
146
|
+
border-right: var(--checkbox-tick-border-width) solid transparent;
|
|
147
|
+
border-bottom: var(--checkbox-tick-border-width) solid transparent;
|
|
148
|
+
top: var(--checkbox-tick-top);
|
|
149
|
+
left: var(--checkbox-tick-left);
|
|
150
|
+
color: #FFFFFF;
|
|
151
|
+
transform-origin: 0% 100%;
|
|
152
|
+
animation: draw-tick 125ms 170ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.m-checkbox .m-checkbox__label {
|
|
156
|
+
display: inline-block;
|
|
157
|
+
vertical-align: middle;
|
|
158
|
+
font-size: 14px;
|
|
159
|
+
line-height: 24px;
|
|
160
|
+
color: #000000;
|
|
161
|
+
font-weight: 400;
|
|
162
|
+
user-select: none;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@keyframes draw-tick {
|
|
166
|
+
0% {
|
|
167
|
+
height: 0px;
|
|
168
|
+
width: 0px;
|
|
169
|
+
border-color: #FFF;
|
|
170
|
+
transform: translate3d(0, 0, 0) rotate(45deg);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
25% {
|
|
174
|
+
height: 0px;
|
|
175
|
+
width: var(--checkbox-tick-width);
|
|
176
|
+
transform: translate3d(0, 0, 0) rotate(45deg);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
100% {
|
|
180
|
+
border-color: #FFF;
|
|
181
|
+
height: var(--checkbox-tick-height);
|
|
182
|
+
width: var(--checkbox-tick-width);
|
|
183
|
+
transform: translate3d(0, var(--checkbox-tick-height-negative), 0) rotate(45deg);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label :class="style.base" @click.prevent="toggle">
|
|
3
|
+
<input
|
|
4
|
+
v-model="checked"
|
|
5
|
+
type="radio"
|
|
6
|
+
:aria-checked="checked ? 'true' : 'false'"
|
|
7
|
+
:aria-disabled="(disabled || loading) ? 'true' : 'false'"
|
|
8
|
+
:aria-labelledby="`${id}-label`"
|
|
9
|
+
:disabled="disabled || loading"
|
|
10
|
+
:name="name"
|
|
11
|
+
:id="id"
|
|
12
|
+
:class="style.input"
|
|
13
|
+
v-bind="$attrs"
|
|
14
|
+
v-on="inputListeners"
|
|
15
|
+
/>
|
|
16
|
+
<span :class="classes"></span>
|
|
17
|
+
<span :class="style.label" :id="`${id}-label`">
|
|
18
|
+
<template v-if="hasSlot">
|
|
19
|
+
<slot/>
|
|
20
|
+
</template>
|
|
21
|
+
<template v-else>
|
|
22
|
+
{{ label }}
|
|
23
|
+
</template>
|
|
24
|
+
</span>
|
|
25
|
+
|
|
26
|
+
</label>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script lang="ts">
|
|
30
|
+
import {defineComponent, toRef, ref, type PropType, watch, computed, defineExpose} from 'vue';
|
|
31
|
+
import {useInput} from '../../composables/useInput';
|
|
32
|
+
import {useInteractive} from "../../composables/useInteractive";
|
|
33
|
+
import type {Size} from '../../types/props';
|
|
34
|
+
import * as style from './style';
|
|
35
|
+
|
|
36
|
+
export default defineComponent({
|
|
37
|
+
name: "Radio",
|
|
38
|
+
emits: useInput.emits(),
|
|
39
|
+
props: {
|
|
40
|
+
...useInput.props(),
|
|
41
|
+
...useInteractive.props(),
|
|
42
|
+
label: {
|
|
43
|
+
type: String
|
|
44
|
+
},
|
|
45
|
+
size: {
|
|
46
|
+
type: String as PropType<Size>,
|
|
47
|
+
default: 'md',
|
|
48
|
+
},
|
|
49
|
+
disabled: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
loading: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
setup(props, {slots, emit}) {
|
|
59
|
+
const radioRef = ref<HTMLElement | null>(null);
|
|
60
|
+
|
|
61
|
+
const {focus, blur} = useInteractive(radioRef);
|
|
62
|
+
|
|
63
|
+
const {
|
|
64
|
+
id,
|
|
65
|
+
insideForm,
|
|
66
|
+
reset,
|
|
67
|
+
validate,
|
|
68
|
+
setError,
|
|
69
|
+
formError,
|
|
70
|
+
formDisabled,
|
|
71
|
+
formLoading,
|
|
72
|
+
inputListeners
|
|
73
|
+
} = useInput(props, {focus, emit});
|
|
74
|
+
|
|
75
|
+
const disabled = computed(() => formDisabled || formLoading || props.disabled || props.loading);
|
|
76
|
+
const name = toRef(props, 'name');
|
|
77
|
+
const checked = ref(false);
|
|
78
|
+
const hasSlot = computed(() => !!(slots.default));
|
|
79
|
+
|
|
80
|
+
const classes = computed(() => {
|
|
81
|
+
return [
|
|
82
|
+
style.checkbox,
|
|
83
|
+
[style.size[props.size]],
|
|
84
|
+
{
|
|
85
|
+
[style.disabled]: disabled.value,
|
|
86
|
+
[style.checked]: checked.value
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const inputError = computed(() => {
|
|
92
|
+
return formError.value || props.error;
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
watch(() => props.modelValue, (value) => {
|
|
96
|
+
checked.value = !!value;
|
|
97
|
+
}, {immediate: true});
|
|
98
|
+
|
|
99
|
+
watch(() => checked.value, (value) => {
|
|
100
|
+
emit('update:modelValue', value);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
function toggle() {
|
|
104
|
+
if (disabled.value) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
checked.value = !checked.value;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
defineExpose({
|
|
111
|
+
focus,
|
|
112
|
+
blur,
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
id,
|
|
117
|
+
formError,
|
|
118
|
+
insideForm,
|
|
119
|
+
reset,
|
|
120
|
+
validate,
|
|
121
|
+
setError,
|
|
122
|
+
disabled,
|
|
123
|
+
name,
|
|
124
|
+
checked,
|
|
125
|
+
radioRef,
|
|
126
|
+
inputError,
|
|
127
|
+
toggle,
|
|
128
|
+
style,
|
|
129
|
+
classes,
|
|
130
|
+
hasSlot,
|
|
131
|
+
inputListeners,
|
|
132
|
+
focus,
|
|
133
|
+
blur
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import MRadio from "../Radio.vue";
|
|
2
|
+
import {
|
|
3
|
+
MRadioBasic,
|
|
4
|
+
} from "./index";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
createStory, sizeArgType, colorArgType
|
|
8
|
+
} from "../../../__storybook__";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
component: MRadio,
|
|
12
|
+
title: 'Components/Radio',
|
|
13
|
+
argTypes: {
|
|
14
|
+
...sizeArgType(),
|
|
15
|
+
...colorArgType()
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Basic = createStory(MRadioBasic);
|