@teammodlr/ui-kit 2.3.12 → 2.3.14
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/env.d.ts +1 -1
- package/lib/components/colorpicker/ColorPicker.vue.d.ts +11 -1
- package/lib/index.cjs.js +1 -1
- package/lib/index.es.js +291 -285
- package/lib/nuxt.js +35 -35
- package/lib/nuxt.plugin.js +8 -8
- package/package.json +1 -1
- package/src/__storybook__/argTypes.ts +53 -53
- package/src/__storybook__/createStory.ts +15 -15
- package/src/__storybook__/index.ts +2 -2
- package/src/components/avatar/Avatar.vue +110 -110
- package/src/components/avatar/examples/basic.vue +6 -6
- package/src/components/avatar/examples/custom-size.vue +7 -7
- package/src/components/avatar/examples/index.stories.ts +25 -25
- package/src/components/avatar/examples/index.ts +5 -5
- package/src/components/avatar/examples/sizes.vue +33 -33
- package/src/components/avatar/examples/slots.vue +8 -8
- package/src/components/avatar/examples/variants.vue +18 -18
- package/src/components/avatar/style/Avatar.css.ts +92 -92
- package/src/components/avatar/style/index.ts +1 -1
- package/src/components/avatargroup/AvatarGroup.vue +72 -72
- package/src/components/avatargroup/examples/basic.vue +37 -37
- package/src/components/avatargroup/examples/index.stories.ts +19 -19
- package/src/components/avatargroup/examples/index.ts +1 -1
- package/src/components/avatargroup/style/AvatarGroup.css.ts +26 -26
- package/src/components/avatargroup/style/index.ts +1 -1
- package/src/components/avatargroup/symbol.ts +17 -17
- package/src/components/badge/Badge.vue +43 -43
- package/src/components/badge/examples/basic.vue +10 -10
- package/src/components/badge/examples/index.stories.ts +19 -19
- package/src/components/badge/examples/index.ts +1 -1
- package/src/components/badge/style/Badge.css.ts +135 -135
- package/src/components/badge/style/index.ts +1 -1
- package/src/components/breadcrumb/Breadcrumb.vue +54 -54
- package/src/components/breadcrumb/BreadcrumbItem.vue +72 -72
- package/src/components/breadcrumb/examples/basic.vue +7 -7
- package/src/components/breadcrumb/examples/index.stories.ts +16 -16
- package/src/components/breadcrumb/examples/index.ts +1 -1
- package/src/components/breadcrumb/style/Breadcrumb.css.ts +40 -40
- package/src/components/breadcrumb/style/index.ts +1 -1
- package/src/components/breadcrumb/symbol.ts +18 -18
- package/src/components/button/Button.vue +203 -203
- package/src/components/button/examples/basic.vue +3 -3
- package/src/components/button/examples/disabled.vue +3 -3
- package/src/components/button/examples/icon-left.vue +12 -12
- package/src/components/button/examples/icon.vue +9 -9
- package/src/components/button/examples/index.stories.ts +37 -37
- package/src/components/button/examples/index.ts +9 -9
- package/src/components/button/examples/link.vue +3 -3
- package/src/components/button/examples/rounded.vue +7 -7
- package/src/components/button/examples/size.vue +7 -7
- package/src/components/button/examples/variants-secondary.vue +10 -10
- package/src/components/button/examples/variants.vue +10 -10
- package/src/components/button/style/index.ts +1 -1
- package/src/components/buttongroup/ButtonGroup.vue +36 -36
- package/src/components/buttongroup/examples/basic.vue +9 -9
- package/src/components/buttongroup/examples/icon-group.vue +21 -21
- package/src/components/buttongroup/examples/index.stories.ts +17 -17
- package/src/components/buttongroup/examples/index.ts +2 -2
- package/src/components/buttongroup/style/ButtonGroup.css.ts +42 -42
- package/src/components/buttongroup/style/index.ts +1 -1
- package/src/components/buttongroup/symbol.ts +9 -9
- package/src/components/checkbox/Checkbox.vue +149 -149
- package/src/components/checkbox/examples/basic.vue +9 -9
- package/src/components/checkbox/examples/index.stories.ts +16 -16
- package/src/components/checkbox/examples/index.ts +2 -2
- package/src/components/checkbox/examples/slot.vue +14 -14
- package/src/components/checkbox/style/Checkbox.css.ts +178 -178
- package/src/components/checkbox/style/index.ts +1 -1
- package/src/components/colorpicker/ColorPicker.vue +15 -4
- package/src/components/colorpicker/examples/index.stories.ts +12 -12
- package/src/components/colorpicker/examples/index.ts +1 -1
- package/src/components/colorpicker/style/index.ts +1 -1
- package/src/components/configprovider/ConfigProvider.vue +38 -38
- package/src/components/configprovider/types.ts +3 -3
- package/src/components/confirm/Confirm.vue +65 -65
- package/src/components/confirm/examples/basic.vue +48 -48
- package/src/components/confirm/examples/index.stories.ts +26 -26
- package/src/components/confirm/examples/index.ts +1 -1
- package/src/components/confirm/examples/wrapper.vue +9 -9
- package/src/components/confirm/props.ts +24 -24
- package/src/components/confirm/providerProps.ts +10 -10
- package/src/components/confirm/types.ts +33 -33
- package/src/components/confirm/useConfirm.ts +14 -14
- package/src/components/dialog/examples/basic.vue +23 -23
- package/src/components/dialog/examples/index.stories.ts +14 -14
- package/src/components/dialog/examples/index.ts +1 -1
- package/src/components/dialog/style/index.ts +1 -1
- package/src/components/dialogprovider/examples/index.stories.ts +26 -26
- package/src/components/dropdown/DropdownList.vue +20 -20
- package/src/components/dropdown/examples/index.stories.ts +26 -26
- package/src/components/dropdown/examples/index.ts +3 -3
- package/src/components/dropdown/hooks.ts +30 -30
- package/src/components/dropdown/style/index.ts +1 -1
- package/src/components/dropdown/symbol.ts +9 -9
- package/src/components/form/Form.vue +153 -153
- package/src/components/form/examples/basic.vue +75 -75
- package/src/components/form/examples/index.stories.ts +23 -23
- package/src/components/form/examples/index.ts +1 -1
- package/src/components/form/style/Form.css.ts +28 -28
- package/src/components/form/style/index.ts +2 -2
- package/src/components/form/symbol.ts +16 -16
- package/src/components/image/Image.vue +71 -71
- package/src/components/image/examples/basic.vue +5 -5
- package/src/components/image/examples/index.stories.ts +10 -10
- package/src/components/image/examples/index.ts +1 -1
- package/src/components/input/Input.vue +233 -233
- package/src/components/input/examples/basic.vue +21 -21
- package/src/components/input/examples/index.stories.ts +26 -26
- package/src/components/input/examples/index.ts +6 -6
- package/src/components/input/examples/left-icon.vue +9 -9
- package/src/components/input/examples/prefix.vue +5 -5
- package/src/components/input/examples/right-icon.vue +9 -9
- package/src/components/input/examples/sizes.vue +9 -9
- package/src/components/input/examples/suffix.vue +7 -7
- package/src/components/input/style/Input.css.ts +294 -294
- package/src/components/input/style/index.ts +1 -1
- package/src/components/link/Link.vue +53 -53
- package/src/components/link/examples/basic.vue +3 -3
- package/src/components/link/examples/index.stories.ts +15 -15
- package/src/components/link/examples/index.ts +1 -1
- package/src/components/messageprovider/Message.vue +135 -135
- package/src/components/messageprovider/MessageProvider.vue +152 -152
- package/src/components/messageprovider/examples/basic.vue +70 -70
- package/src/components/messageprovider/examples/index.stories.ts +26 -26
- package/src/components/messageprovider/examples/index.ts +2 -2
- package/src/components/messageprovider/examples/update.vue +34 -34
- package/src/components/messageprovider/examples/wrapper.vue +9 -9
- package/src/components/messageprovider/style/Message.css.ts +111 -111
- package/src/components/messageprovider/style/index.ts +1 -1
- package/src/components/messageprovider/types.ts +56 -56
- package/src/components/messageprovider/useMessage.ts +14 -14
- package/src/components/modal/Modal.vue +310 -310
- package/src/components/modal/examples/basic.vue +80 -80
- package/src/components/modal/examples/index.stories.ts +16 -16
- package/src/components/modal/examples/index.ts +3 -3
- package/src/components/modal/examples/modal-form.vue +99 -99
- package/src/components/modal/examples/sidebar.vue +79 -79
- package/src/components/modal/style/Modal.css.ts +318 -318
- package/src/components/modal/style/index.ts +1 -1
- package/src/components/pagination/Pagination.vue +296 -296
- package/src/components/pagination/examples/basic.vue +17 -17
- package/src/components/pagination/examples/index.stories.ts +11 -11
- package/src/components/pagination/examples/index.ts +1 -1
- package/src/components/pagination/style/Pagination.css.ts +93 -93
- package/src/components/pagination/style/index.ts +1 -1
- package/src/components/radio/Radio.vue +136 -136
- package/src/components/radio/examples/basic.vue +8 -8
- package/src/components/radio/examples/group.vue +15 -15
- package/src/components/radio/examples/index.stories.ts +16 -16
- package/src/components/radio/examples/index.ts +2 -2
- package/src/components/radio/style/Checkbox.css.ts +130 -130
- package/src/components/radio/style/index.ts +1 -1
- package/src/components/radiobutton/RadioButton.vue +131 -131
- package/src/components/radiobutton/style/RadioButton.css.ts +189 -189
- package/src/components/radiobutton/style/index.ts +1 -1
- package/src/components/radiobuttongroup/RadioButtonGroup.vue +74 -74
- package/src/components/radiobuttongroup/examples/basic.vue +16 -16
- package/src/components/radiobuttongroup/examples/index.stories.ts +18 -18
- package/src/components/radiobuttongroup/examples/index.ts +1 -1
- package/src/components/radiobuttongroup/style/RadioButtonGroup.css.ts +37 -37
- package/src/components/radiobuttongroup/style/index.ts +1 -1
- package/src/components/radiobuttongroup/symbol.ts +12 -12
- package/src/components/renderer/examlpes/basic.vue +23 -23
- package/src/components/renderer/examlpes/index.stories.ts +14 -14
- package/src/components/renderer/examlpes/index.ts +1 -1
- package/src/components/renderer/props.ts +14 -14
- package/src/components/renderer/renderer.ts +16 -16
- package/src/components/select/examples/basic.vue +26 -26
- package/src/components/select/examples/index.stories.ts +16 -16
- package/src/components/select/examples/index.ts +3 -3
- package/src/components/select/examples/multiple.vue +21 -21
- package/src/components/select/examples/searchable.vue +20 -20
- package/src/components/select/style/index.ts +1 -1
- package/src/components/select/types.ts +27 -27
- package/src/components/skeleton/Skeleton.vue +55 -55
- package/src/components/skeleton/examples/basic.vue +3 -3
- package/src/components/skeleton/examples/index.stories.ts +13 -13
- package/src/components/skeleton/examples/index.ts +2 -2
- package/src/components/skeleton/examples/post.vue +8 -8
- package/src/components/skeleton/style/Skeleton.css.ts +72 -72
- package/src/components/skeleton/style/index.ts +2 -2
- package/src/components/slider/style/Slider.css.ts +50 -50
- package/src/components/slider/style/index.ts +1 -1
- package/src/components/switch/Switch.vue +132 -132
- package/src/components/switch/examples/basic.vue +9 -9
- package/src/components/switch/examples/index.stories.ts +15 -15
- package/src/components/switch/examples/index.ts +2 -2
- package/src/components/switch/examples/slot.vue +11 -11
- package/src/components/switch/style/index.ts +1 -1
- package/src/components/tab/examples/basic.vue +23 -23
- package/src/components/tab/examples/index.ts +2 -2
- package/src/components/tab/examples/vertical.vue +19 -19
- package/src/components/table/Table.vue +198 -198
- package/src/components/table/TableBody.vue +13 -13
- package/src/components/table/TableCell.vue +13 -13
- package/src/components/table/TableHead.vue +46 -46
- package/src/components/table/TableHeadRow.vue +15 -15
- package/src/components/table/TableRow.vue +19 -19
- package/src/components/table/examples/basic.vue +61 -61
- package/src/components/table/examples/empty.vue +44 -44
- package/src/components/table/examples/index.stories.ts +17 -17
- package/src/components/table/examples/index.ts +3 -3
- package/src/components/table/examples/selected.vue +68 -68
- package/src/components/table/style/Table.css.ts +62 -62
- package/src/components/table/style/index.ts +1 -1
- package/src/components/table/types/index.ts +6 -6
- package/src/components/tag/Tag.vue +72 -72
- package/src/components/tag/examples/basic.vue +5 -5
- package/src/components/tag/examples/index.stories.ts +16 -16
- package/src/components/tag/examples/index.ts +1 -1
- package/src/components/tag/style/Tag.css.ts +83 -83
- package/src/components/tag/style/index.ts +1 -1
- package/src/components/textarea/Textarea.vue +180 -180
- package/src/components/textarea/examples/basic.vue +8 -8
- package/src/components/textarea/examples/index.stories.ts +14 -14
- package/src/components/textarea/examples/index.ts +1 -1
- package/src/components/textarea/style/Textarea.css.ts +191 -191
- package/src/components/textarea/style/index.ts +1 -1
- package/src/components/tooltip/examples/basic.vue +5 -5
- package/src/components/tooltip/examples/index.stories.ts +17 -17
- package/src/components/tooltip/examples/index.ts +2 -2
- package/src/components/tooltip/examples/placement.vue +9 -9
- package/src/components/tooltip/style/Tooltip.css.ts +90 -90
- package/src/components/tooltip/style/index.ts +1 -1
- package/src/components/transfer/Transfer.vue +145 -145
- package/src/components/transfer/examples/basic.vue +21 -21
- package/src/components/transfer/examples/index.stories.ts +12 -12
- package/src/components/transfer/examples/index.ts +1 -1
- package/src/components/transfer/style/Transfer.css.ts +81 -81
- package/src/components/transfer/style/index.ts +1 -1
- package/src/components/tree/Tree.vue +138 -138
- package/src/components/tree/TreeNode.vue +109 -109
- package/src/components/tree/TreeNodeToggle.vue +48 -48
- package/src/components/tree/examples/basic.vue +458 -458
- package/src/components/tree/examples/index.stories.ts +12 -12
- package/src/components/tree/examples/index.ts +1 -1
- package/src/components/tree/props.ts +97 -97
- package/src/components/tree/style/Tree.css.ts +75 -75
- package/src/components/tree/style/index.ts +1 -1
- package/src/components/tree/types.ts +103 -103
- package/src/components/virtualscroll/VirtualScroll.css +13 -13
- package/src/components/virtualscroll/VirtualScroll.vue +166 -166
- package/src/components/virtualscroll/examples/basic.vue +31 -31
- package/src/components/virtualscroll/examples/index.stories.ts +11 -11
- package/src/components/virtualscroll/examples/index.ts +1 -1
- package/src/components/virtualscroll/style/VirtualScroll.css.ts +17 -17
- package/src/components/virtualscroll/style/index.ts +1 -1
- package/src/composables/element.ts +13 -13
- package/src/composables/index.ts +5 -5
- package/src/composables/useCachedUid.ts +15 -15
- package/src/composables/useEventListener.ts +19 -19
- package/src/composables/useInput.ts +151 -151
- package/src/composables/useInteractive.ts +19 -19
- package/src/composables/useIsServer.ts +7 -7
- package/src/composables/useMergedState.ts +18 -18
- package/src/composables/useMount.ts +43 -43
- package/src/composables/usePopper.ts +215 -215
- package/src/composables/useZIndex.ts +33 -33
- package/src/create.ts +38 -38
- package/src/css/components.css +16 -16
- package/src/css/index.css +4 -4
- package/src/css/transitions.css +40 -40
- package/src/css/variables.css +80 -80
- package/src/examples/cards/cards.stories.ts +9 -9
- package/src/examples/cards/sidebar.vue +262 -262
- package/src/examples/modal/modal.stories.ts +9 -9
- package/src/examples/modal/modal.vue +52 -52
- package/src/exports/nuxt.js +35 -35
- package/src/exports/nuxt.plugin.js +8 -8
- package/src/index.ts +5 -5
- package/src/install.ts +8 -8
- package/src/shims-vue.d.ts +6 -6
- package/src/styles/theme.css.ts +181 -181
- package/src/types/props.ts +21 -21
- package/src/utils/call.ts +34 -34
- package/src/utils/injection.ts +45 -45
- package/volar.d.ts +16 -16
|
@@ -1,189 +1,189 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createVar,
|
|
3
|
-
globalStyle,
|
|
4
|
-
style,
|
|
5
|
-
styleVariants
|
|
6
|
-
} from '@vanilla-extract/css';
|
|
7
|
-
import { themeVars } from '../../../styles/theme.css';
|
|
8
|
-
|
|
9
|
-
const sizes = {
|
|
10
|
-
xs: '22px',
|
|
11
|
-
sm: '28px',
|
|
12
|
-
md: '36px',
|
|
13
|
-
lg: '40px',
|
|
14
|
-
xl: '45px'
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const borderRadiuses = {
|
|
18
|
-
xs: '2px',
|
|
19
|
-
sm: '3px',
|
|
20
|
-
md: '4px',
|
|
21
|
-
lg: '6px',
|
|
22
|
-
xl: '8px'
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const padding = {
|
|
26
|
-
xs: `0 ${themeVars.space[1]}`,
|
|
27
|
-
sm: `0 ${themeVars.space[2]}`,
|
|
28
|
-
md: `0 ${themeVars.space[3]}`,
|
|
29
|
-
lg: `0 ${themeVars.space[3]}`,
|
|
30
|
-
xl: `0 ${themeVars.space[4]}`
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const vars = {
|
|
34
|
-
height: createVar(),
|
|
35
|
-
radius: createVar(),
|
|
36
|
-
padding: createVar(),
|
|
37
|
-
backgroundColor: createVar(),
|
|
38
|
-
borderColor: createVar(),
|
|
39
|
-
boxShadowColor: createVar(),
|
|
40
|
-
color: createVar()
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const base = style({
|
|
44
|
-
vars: {
|
|
45
|
-
[vars.borderColor]: 'transparent'
|
|
46
|
-
},
|
|
47
|
-
alignItems: 'center',
|
|
48
|
-
boxSizing: 'border-box',
|
|
49
|
-
display: 'inline-flex',
|
|
50
|
-
fontSize: themeVars.fontSize.base,
|
|
51
|
-
fontWeight: '500',
|
|
52
|
-
maxWidth: '100%',
|
|
53
|
-
width: 'auto',
|
|
54
|
-
position: 'relative',
|
|
55
|
-
textAlign: 'center',
|
|
56
|
-
textDecoration: 'none',
|
|
57
|
-
verticalAlign: 'middle',
|
|
58
|
-
whiteSpace: 'nowrap',
|
|
59
|
-
justifyContent: 'center',
|
|
60
|
-
height: vars.height,
|
|
61
|
-
lineHeight: vars.height,
|
|
62
|
-
borderRadius: vars.radius,
|
|
63
|
-
padding: vars.padding,
|
|
64
|
-
zIndex: 'auto',
|
|
65
|
-
backgroundColor: vars.backgroundColor,
|
|
66
|
-
border: `1px solid ${vars.borderColor}`,
|
|
67
|
-
color: vars.color,
|
|
68
|
-
transition: `color .3s ${themeVars.transition.default},
|
|
69
|
-
background-color .3s ${themeVars.transition.default},
|
|
70
|
-
box-shadow .3s ${themeVars.transition.default},
|
|
71
|
-
border-color .3s ${themeVars.transition.default}`,
|
|
72
|
-
fontFamily: 'inherit',
|
|
73
|
-
':hover': {
|
|
74
|
-
cursor: 'pointer'
|
|
75
|
-
},
|
|
76
|
-
':focus': {
|
|
77
|
-
outline: 'none'
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
export const variant = styleVariants({
|
|
82
|
-
active: {
|
|
83
|
-
vars: {
|
|
84
|
-
[vars.backgroundColor]: 'white',
|
|
85
|
-
[vars.color]: themeVars.color.blue[500],
|
|
86
|
-
[vars.boxShadowColor]: themeVars.color.gray[900],
|
|
87
|
-
[vars.borderColor]: themeVars.color.gray[200]
|
|
88
|
-
},
|
|
89
|
-
boxShadow: `0 .5px 0px 4px rgba(0, 0, 0, 0.01)`,
|
|
90
|
-
':hover': {
|
|
91
|
-
vars: {
|
|
92
|
-
[vars.color]: themeVars.color.blue[600]
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
':focus': {
|
|
96
|
-
vars: {
|
|
97
|
-
[vars.color]: themeVars.color.blue[500]
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
default: {
|
|
102
|
-
vars: {
|
|
103
|
-
[vars.color]: themeVars.color.gray[400],
|
|
104
|
-
[vars.backgroundColor]: 'transparent',
|
|
105
|
-
[vars.boxShadowColor]: themeVars.color.blue[500],
|
|
106
|
-
[vars.borderColor]: 'transparent'
|
|
107
|
-
},
|
|
108
|
-
':hover': {
|
|
109
|
-
vars: {
|
|
110
|
-
[vars.color]: themeVars.color.blue[400]
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
':focus': {
|
|
114
|
-
vars: {
|
|
115
|
-
[vars.color]: themeVars.color.blue[400]
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
export const size = styleVariants({
|
|
122
|
-
xs: {
|
|
123
|
-
vars: {
|
|
124
|
-
[vars.height]: sizes.xs,
|
|
125
|
-
[vars.radius]: borderRadiuses.xs,
|
|
126
|
-
[vars.padding]: padding.xs
|
|
127
|
-
},
|
|
128
|
-
fontSize: themeVars.fontSize.small
|
|
129
|
-
},
|
|
130
|
-
sm: {
|
|
131
|
-
vars: {
|
|
132
|
-
[vars.height]: sizes.sm,
|
|
133
|
-
[vars.radius]: borderRadiuses.sm,
|
|
134
|
-
[vars.padding]: padding.sm
|
|
135
|
-
},
|
|
136
|
-
fontSize: themeVars.fontSize.small
|
|
137
|
-
},
|
|
138
|
-
md: {
|
|
139
|
-
vars: {
|
|
140
|
-
[vars.height]: sizes.md,
|
|
141
|
-
[vars.radius]: borderRadiuses.md,
|
|
142
|
-
[vars.padding]: padding.md
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
lg: {
|
|
146
|
-
vars: {
|
|
147
|
-
[vars.height]: sizes.lg,
|
|
148
|
-
[vars.radius]: borderRadiuses.lg,
|
|
149
|
-
[vars.padding]: padding.lg
|
|
150
|
-
},
|
|
151
|
-
fontSize: themeVars.fontSize.large
|
|
152
|
-
},
|
|
153
|
-
xl: {
|
|
154
|
-
vars: {
|
|
155
|
-
[vars.height]: sizes.xl,
|
|
156
|
-
[vars.radius]: borderRadiuses.xl,
|
|
157
|
-
[vars.padding]: padding.xl
|
|
158
|
-
},
|
|
159
|
-
fontSize: themeVars.fontSize.large
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
export const icon = style({
|
|
164
|
-
display: 'flex',
|
|
165
|
-
flexGrow: 0,
|
|
166
|
-
flexShrink: 0,
|
|
167
|
-
fontSize: 0,
|
|
168
|
-
lineHeight: 0,
|
|
169
|
-
userSelect: 'none'
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
globalStyle(`${icon} > svg`, {
|
|
173
|
-
overflow: 'hidden',
|
|
174
|
-
pointerEvents: 'none',
|
|
175
|
-
maxWidth: '100%',
|
|
176
|
-
maxHeight: '100%',
|
|
177
|
-
verticalAlign: 'middle'
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
export const radio = style({
|
|
181
|
-
pointerEvents: 'none',
|
|
182
|
-
position: 'absolute',
|
|
183
|
-
border: 0,
|
|
184
|
-
left: 0,
|
|
185
|
-
right: 0,
|
|
186
|
-
top: 0,
|
|
187
|
-
bottom: 0,
|
|
188
|
-
opacity: 0
|
|
189
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
createVar,
|
|
3
|
+
globalStyle,
|
|
4
|
+
style,
|
|
5
|
+
styleVariants
|
|
6
|
+
} from '@vanilla-extract/css';
|
|
7
|
+
import { themeVars } from '../../../styles/theme.css';
|
|
8
|
+
|
|
9
|
+
const sizes = {
|
|
10
|
+
xs: '22px',
|
|
11
|
+
sm: '28px',
|
|
12
|
+
md: '36px',
|
|
13
|
+
lg: '40px',
|
|
14
|
+
xl: '45px'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const borderRadiuses = {
|
|
18
|
+
xs: '2px',
|
|
19
|
+
sm: '3px',
|
|
20
|
+
md: '4px',
|
|
21
|
+
lg: '6px',
|
|
22
|
+
xl: '8px'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const padding = {
|
|
26
|
+
xs: `0 ${themeVars.space[1]}`,
|
|
27
|
+
sm: `0 ${themeVars.space[2]}`,
|
|
28
|
+
md: `0 ${themeVars.space[3]}`,
|
|
29
|
+
lg: `0 ${themeVars.space[3]}`,
|
|
30
|
+
xl: `0 ${themeVars.space[4]}`
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const vars = {
|
|
34
|
+
height: createVar(),
|
|
35
|
+
radius: createVar(),
|
|
36
|
+
padding: createVar(),
|
|
37
|
+
backgroundColor: createVar(),
|
|
38
|
+
borderColor: createVar(),
|
|
39
|
+
boxShadowColor: createVar(),
|
|
40
|
+
color: createVar()
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const base = style({
|
|
44
|
+
vars: {
|
|
45
|
+
[vars.borderColor]: 'transparent'
|
|
46
|
+
},
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
boxSizing: 'border-box',
|
|
49
|
+
display: 'inline-flex',
|
|
50
|
+
fontSize: themeVars.fontSize.base,
|
|
51
|
+
fontWeight: '500',
|
|
52
|
+
maxWidth: '100%',
|
|
53
|
+
width: 'auto',
|
|
54
|
+
position: 'relative',
|
|
55
|
+
textAlign: 'center',
|
|
56
|
+
textDecoration: 'none',
|
|
57
|
+
verticalAlign: 'middle',
|
|
58
|
+
whiteSpace: 'nowrap',
|
|
59
|
+
justifyContent: 'center',
|
|
60
|
+
height: vars.height,
|
|
61
|
+
lineHeight: vars.height,
|
|
62
|
+
borderRadius: vars.radius,
|
|
63
|
+
padding: vars.padding,
|
|
64
|
+
zIndex: 'auto',
|
|
65
|
+
backgroundColor: vars.backgroundColor,
|
|
66
|
+
border: `1px solid ${vars.borderColor}`,
|
|
67
|
+
color: vars.color,
|
|
68
|
+
transition: `color .3s ${themeVars.transition.default},
|
|
69
|
+
background-color .3s ${themeVars.transition.default},
|
|
70
|
+
box-shadow .3s ${themeVars.transition.default},
|
|
71
|
+
border-color .3s ${themeVars.transition.default}`,
|
|
72
|
+
fontFamily: 'inherit',
|
|
73
|
+
':hover': {
|
|
74
|
+
cursor: 'pointer'
|
|
75
|
+
},
|
|
76
|
+
':focus': {
|
|
77
|
+
outline: 'none'
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export const variant = styleVariants({
|
|
82
|
+
active: {
|
|
83
|
+
vars: {
|
|
84
|
+
[vars.backgroundColor]: 'white',
|
|
85
|
+
[vars.color]: themeVars.color.blue[500],
|
|
86
|
+
[vars.boxShadowColor]: themeVars.color.gray[900],
|
|
87
|
+
[vars.borderColor]: themeVars.color.gray[200]
|
|
88
|
+
},
|
|
89
|
+
boxShadow: `0 .5px 0px 4px rgba(0, 0, 0, 0.01)`,
|
|
90
|
+
':hover': {
|
|
91
|
+
vars: {
|
|
92
|
+
[vars.color]: themeVars.color.blue[600]
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
':focus': {
|
|
96
|
+
vars: {
|
|
97
|
+
[vars.color]: themeVars.color.blue[500]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
default: {
|
|
102
|
+
vars: {
|
|
103
|
+
[vars.color]: themeVars.color.gray[400],
|
|
104
|
+
[vars.backgroundColor]: 'transparent',
|
|
105
|
+
[vars.boxShadowColor]: themeVars.color.blue[500],
|
|
106
|
+
[vars.borderColor]: 'transparent'
|
|
107
|
+
},
|
|
108
|
+
':hover': {
|
|
109
|
+
vars: {
|
|
110
|
+
[vars.color]: themeVars.color.blue[400]
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
':focus': {
|
|
114
|
+
vars: {
|
|
115
|
+
[vars.color]: themeVars.color.blue[400]
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
export const size = styleVariants({
|
|
122
|
+
xs: {
|
|
123
|
+
vars: {
|
|
124
|
+
[vars.height]: sizes.xs,
|
|
125
|
+
[vars.radius]: borderRadiuses.xs,
|
|
126
|
+
[vars.padding]: padding.xs
|
|
127
|
+
},
|
|
128
|
+
fontSize: themeVars.fontSize.small
|
|
129
|
+
},
|
|
130
|
+
sm: {
|
|
131
|
+
vars: {
|
|
132
|
+
[vars.height]: sizes.sm,
|
|
133
|
+
[vars.radius]: borderRadiuses.sm,
|
|
134
|
+
[vars.padding]: padding.sm
|
|
135
|
+
},
|
|
136
|
+
fontSize: themeVars.fontSize.small
|
|
137
|
+
},
|
|
138
|
+
md: {
|
|
139
|
+
vars: {
|
|
140
|
+
[vars.height]: sizes.md,
|
|
141
|
+
[vars.radius]: borderRadiuses.md,
|
|
142
|
+
[vars.padding]: padding.md
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
lg: {
|
|
146
|
+
vars: {
|
|
147
|
+
[vars.height]: sizes.lg,
|
|
148
|
+
[vars.radius]: borderRadiuses.lg,
|
|
149
|
+
[vars.padding]: padding.lg
|
|
150
|
+
},
|
|
151
|
+
fontSize: themeVars.fontSize.large
|
|
152
|
+
},
|
|
153
|
+
xl: {
|
|
154
|
+
vars: {
|
|
155
|
+
[vars.height]: sizes.xl,
|
|
156
|
+
[vars.radius]: borderRadiuses.xl,
|
|
157
|
+
[vars.padding]: padding.xl
|
|
158
|
+
},
|
|
159
|
+
fontSize: themeVars.fontSize.large
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
export const icon = style({
|
|
164
|
+
display: 'flex',
|
|
165
|
+
flexGrow: 0,
|
|
166
|
+
flexShrink: 0,
|
|
167
|
+
fontSize: 0,
|
|
168
|
+
lineHeight: 0,
|
|
169
|
+
userSelect: 'none'
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
globalStyle(`${icon} > svg`, {
|
|
173
|
+
overflow: 'hidden',
|
|
174
|
+
pointerEvents: 'none',
|
|
175
|
+
maxWidth: '100%',
|
|
176
|
+
maxHeight: '100%',
|
|
177
|
+
verticalAlign: 'middle'
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
export const radio = style({
|
|
181
|
+
pointerEvents: 'none',
|
|
182
|
+
position: 'absolute',
|
|
183
|
+
border: 0,
|
|
184
|
+
left: 0,
|
|
185
|
+
right: 0,
|
|
186
|
+
top: 0,
|
|
187
|
+
bottom: 0,
|
|
188
|
+
opacity: 0
|
|
189
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './RadioButton.css';
|
|
1
|
+
export * from './RadioButton.css';
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
:class="computedClasses"
|
|
4
|
-
>
|
|
5
|
-
<slot/>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script lang="ts">
|
|
10
|
-
import {computed, defineComponent, type PropType, provide, reactive, toRef} from "vue";
|
|
11
|
-
import type {Size} from '../../types/props';
|
|
12
|
-
import * as style from "./style";
|
|
13
|
-
import type {RadioButtonGroupState} from "./symbol";
|
|
14
|
-
import {RADIO_BUTTON_GROUP_STATE} from "./symbol";
|
|
15
|
-
|
|
16
|
-
export default defineComponent({
|
|
17
|
-
name: "MRadioButtonGroup",
|
|
18
|
-
props: {
|
|
19
|
-
modelValue: {
|
|
20
|
-
type: [String, Number],
|
|
21
|
-
default: ""
|
|
22
|
-
},
|
|
23
|
-
size: {
|
|
24
|
-
type: String as PropType<Size>,
|
|
25
|
-
default: 'md'
|
|
26
|
-
},
|
|
27
|
-
name: {
|
|
28
|
-
type: String,
|
|
29
|
-
required: true
|
|
30
|
-
},
|
|
31
|
-
block: {
|
|
32
|
-
type: Boolean,
|
|
33
|
-
default: false
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
emits: ['update:modelValue'],
|
|
37
|
-
setup(props, {emit}) {
|
|
38
|
-
|
|
39
|
-
function doUpdateValue (value: string | number) {
|
|
40
|
-
emit('update:modelValue', value)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const selectedValue = computed({
|
|
44
|
-
get() {
|
|
45
|
-
return props.modelValue;
|
|
46
|
-
},
|
|
47
|
-
set(value) {
|
|
48
|
-
doUpdateValue(value);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
const state: RadioButtonGroupState = reactive({
|
|
53
|
-
size: toRef(props, 'size'),
|
|
54
|
-
name: toRef(props, 'name'),
|
|
55
|
-
modelValue: selectedValue,
|
|
56
|
-
doUpdateValue
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
provide(RADIO_BUTTON_GROUP_STATE, state);
|
|
60
|
-
|
|
61
|
-
const computedClasses = computed(() => {
|
|
62
|
-
return [
|
|
63
|
-
style.base,
|
|
64
|
-
{
|
|
65
|
-
[style.block]: props.block
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
computedClasses
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="computedClasses"
|
|
4
|
+
>
|
|
5
|
+
<slot/>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import {computed, defineComponent, type PropType, provide, reactive, toRef} from "vue";
|
|
11
|
+
import type {Size} from '../../types/props';
|
|
12
|
+
import * as style from "./style";
|
|
13
|
+
import type {RadioButtonGroupState} from "./symbol";
|
|
14
|
+
import {RADIO_BUTTON_GROUP_STATE} from "./symbol";
|
|
15
|
+
|
|
16
|
+
export default defineComponent({
|
|
17
|
+
name: "MRadioButtonGroup",
|
|
18
|
+
props: {
|
|
19
|
+
modelValue: {
|
|
20
|
+
type: [String, Number],
|
|
21
|
+
default: ""
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
type: String as PropType<Size>,
|
|
25
|
+
default: 'md'
|
|
26
|
+
},
|
|
27
|
+
name: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true
|
|
30
|
+
},
|
|
31
|
+
block: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
emits: ['update:modelValue'],
|
|
37
|
+
setup(props, {emit}) {
|
|
38
|
+
|
|
39
|
+
function doUpdateValue (value: string | number) {
|
|
40
|
+
emit('update:modelValue', value)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const selectedValue = computed({
|
|
44
|
+
get() {
|
|
45
|
+
return props.modelValue;
|
|
46
|
+
},
|
|
47
|
+
set(value) {
|
|
48
|
+
doUpdateValue(value);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const state: RadioButtonGroupState = reactive({
|
|
53
|
+
size: toRef(props, 'size'),
|
|
54
|
+
name: toRef(props, 'name'),
|
|
55
|
+
modelValue: selectedValue,
|
|
56
|
+
doUpdateValue
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
provide(RADIO_BUTTON_GROUP_STATE, state);
|
|
60
|
+
|
|
61
|
+
const computedClasses = computed(() => {
|
|
62
|
+
return [
|
|
63
|
+
style.base,
|
|
64
|
+
{
|
|
65
|
+
[style.block]: props.block
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
computedClasses
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
75
|
</script>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<MRadioButtonGroup v-model="value" size="sm" name="text-align">
|
|
3
|
-
<MRadioButton icon id="left-align">
|
|
4
|
-
<svg width="24px" height="24px" stroke-width="2" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3 10h14M3 6h18M3 18h14M3 14h18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>
|
|
5
|
-
</MRadioButton>
|
|
6
|
-
<MRadioButton icon id="center-align">
|
|
7
|
-
<svg width="24px" height="24px" stroke-width="2" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3 6h18M3 14h18M6 10h12M6 18h12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>
|
|
8
|
-
</MRadioButton>
|
|
9
|
-
<MRadioButton icon id="right-align">
|
|
10
|
-
<svg width="24px" height="24px" stroke-width="2" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 10h14M3 6h18M7 18h14M3 14h18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>
|
|
11
|
-
</MRadioButton>
|
|
12
|
-
</MRadioButtonGroup>
|
|
13
|
-
</template>
|
|
14
|
-
<script setup lang="ts">
|
|
15
|
-
import { ref } from 'vue'
|
|
16
|
-
const value = ref("left-align");
|
|
1
|
+
<template>
|
|
2
|
+
<MRadioButtonGroup v-model="value" size="sm" name="text-align">
|
|
3
|
+
<MRadioButton icon id="left-align">
|
|
4
|
+
<svg width="24px" height="24px" stroke-width="2" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3 10h14M3 6h18M3 18h14M3 14h18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>
|
|
5
|
+
</MRadioButton>
|
|
6
|
+
<MRadioButton icon id="center-align">
|
|
7
|
+
<svg width="24px" height="24px" stroke-width="2" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3 6h18M3 14h18M6 10h12M6 18h12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>
|
|
8
|
+
</MRadioButton>
|
|
9
|
+
<MRadioButton icon id="right-align">
|
|
10
|
+
<svg width="24px" height="24px" stroke-width="2" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 10h14M3 6h18M7 18h14M3 14h18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg>
|
|
11
|
+
</MRadioButton>
|
|
12
|
+
</MRadioButtonGroup>
|
|
13
|
+
</template>
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import { ref } from 'vue'
|
|
16
|
+
const value = ref("left-align");
|
|
17
17
|
</script>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import MRadioButtonGroup from '../RadioButtonGroup.vue';
|
|
2
|
-
import MRadioButton from '../../radiobutton/RadioButton.vue';
|
|
3
|
-
import { MRadioButtonGroupBasic } from './index';
|
|
4
|
-
|
|
5
|
-
import { createStory, sizeArgType, colorArgType } from '../../../__storybook__';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
component: MRadioButtonGroup,
|
|
9
|
-
subcomponents: {
|
|
10
|
-
MRadioButton
|
|
11
|
-
},
|
|
12
|
-
title: 'Components/Radio Button Group',
|
|
13
|
-
argTypes: {
|
|
14
|
-
...sizeArgType()
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const Basic = createStory(MRadioButtonGroupBasic);
|
|
1
|
+
import MRadioButtonGroup from '../RadioButtonGroup.vue';
|
|
2
|
+
import MRadioButton from '../../radiobutton/RadioButton.vue';
|
|
3
|
+
import { MRadioButtonGroupBasic } from './index';
|
|
4
|
+
|
|
5
|
+
import { createStory, sizeArgType, colorArgType } from '../../../__storybook__';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
component: MRadioButtonGroup,
|
|
9
|
+
subcomponents: {
|
|
10
|
+
MRadioButton
|
|
11
|
+
},
|
|
12
|
+
title: 'Components/Radio Button Group',
|
|
13
|
+
argTypes: {
|
|
14
|
+
...sizeArgType()
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const Basic = createStory(MRadioButtonGroupBasic);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as MRadioButtonGroupBasic } from './basic.vue';
|
|
1
|
+
export { default as MRadioButtonGroupBasic } from './basic.vue';
|