@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,254 @@
|
|
|
1
|
+
import { createVar, 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: '26px',
|
|
7
|
+
sm: '30px',
|
|
8
|
+
md: '38px',
|
|
9
|
+
lg: '42px',
|
|
10
|
+
xl: '48px',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const borderRadiuses = {
|
|
14
|
+
xs: '2px',
|
|
15
|
+
sm: '3px',
|
|
16
|
+
md: '4px',
|
|
17
|
+
lg: '6px',
|
|
18
|
+
xl: '8px',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const vars = {
|
|
22
|
+
height: createVar(),
|
|
23
|
+
radius: createVar(),
|
|
24
|
+
paddingX: createVar(),
|
|
25
|
+
paddingY: createVar(),
|
|
26
|
+
borderColor: createVar(),
|
|
27
|
+
backgroundColor: createVar(),
|
|
28
|
+
color: createVar(),
|
|
29
|
+
cursor: createVar(),
|
|
30
|
+
optionColor: createVar(),
|
|
31
|
+
optionBackgroundColor: createVar(),
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const wrapper = style({
|
|
35
|
+
position: 'relative',
|
|
36
|
+
outline: 'none',
|
|
37
|
+
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export const base = style({
|
|
41
|
+
vars: {
|
|
42
|
+
[vars.height]: sizes.md,
|
|
43
|
+
[vars.radius]: borderRadiuses.md,
|
|
44
|
+
[vars.paddingX]: themeVars.space[2],
|
|
45
|
+
[vars.paddingY]: themeVars.space[0],
|
|
46
|
+
[vars.borderColor]: themeVars.color.gray[300],
|
|
47
|
+
[vars.color]: themeVars.color.gray[900],
|
|
48
|
+
[vars.backgroundColor]: '#FFFFFF',
|
|
49
|
+
[vars.cursor]: 'text',
|
|
50
|
+
},
|
|
51
|
+
height: vars.height,
|
|
52
|
+
minHeight: vars.height,
|
|
53
|
+
width: '100%',
|
|
54
|
+
borderRadius: vars.radius,
|
|
55
|
+
borderWidth: 1,
|
|
56
|
+
borderStyle: 'solid',
|
|
57
|
+
borderColor: vars.borderColor,
|
|
58
|
+
padding: `${vars.paddingY} ${vars.paddingX}`,
|
|
59
|
+
fontSize: themeVars.fontSize.base,
|
|
60
|
+
display: 'block',
|
|
61
|
+
textAlign: 'left',
|
|
62
|
+
appearance: 'none',
|
|
63
|
+
lineHeight: vars.height,
|
|
64
|
+
boxSizing: 'border-box',
|
|
65
|
+
resize: 'none',
|
|
66
|
+
boxShadow: 'none',
|
|
67
|
+
transition: `color .3s ${themeVars.transition.default},
|
|
68
|
+
background-color .3s ${themeVars.transition.default},
|
|
69
|
+
box-shadow .3s ${themeVars.transition.default},
|
|
70
|
+
border-color .3s ${themeVars.transition.default}`,
|
|
71
|
+
':hover': {
|
|
72
|
+
vars: {
|
|
73
|
+
[vars.borderColor]: themeVars.color.blue[400],
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
':focus': {
|
|
77
|
+
vars: {
|
|
78
|
+
[vars.borderColor]: themeVars.color.blue[500],
|
|
79
|
+
},
|
|
80
|
+
outline: 'none',
|
|
81
|
+
boxShadow: `0 0 0 2px ${themeVars.color.blue[200]}`,
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export const selectedTags = style({
|
|
86
|
+
display: 'flex',
|
|
87
|
+
flexWrap: 'wrap',
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
gap: themeVars.space[1],
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export const block = style({
|
|
93
|
+
width: '100%',
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export const disabled = style({
|
|
97
|
+
vars: {
|
|
98
|
+
[vars.borderColor]: themeVars.color.gray[200],
|
|
99
|
+
[vars.color]: themeVars.color.gray[500],
|
|
100
|
+
[vars.backgroundColor]: themeVars.color.gray[50],
|
|
101
|
+
[vars.cursor]: 'not-allowed',
|
|
102
|
+
},
|
|
103
|
+
':focus': {
|
|
104
|
+
boxShadow: 'none',
|
|
105
|
+
},
|
|
106
|
+
':hover': {
|
|
107
|
+
cursor: 'not-allowed',
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
export const label = style({
|
|
112
|
+
fontVariationSettings: `"wght" ${fonts.INTER.wghts[500]}`,
|
|
113
|
+
display: 'inline-block',
|
|
114
|
+
fontSize: themeVars.fontSize.base,
|
|
115
|
+
wordBreak: 'break-word',
|
|
116
|
+
cursor: 'pointer',
|
|
117
|
+
marginBottom: themeVars.space[1],
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
export const description = style({
|
|
121
|
+
display: 'block',
|
|
122
|
+
textDecoration: 'none',
|
|
123
|
+
fontSize: themeVars.fontSize.base,
|
|
124
|
+
color: themeVars.color.gray[600],
|
|
125
|
+
lineHeight: themeVars.fontSize.large,
|
|
126
|
+
wordBreak: 'break-word',
|
|
127
|
+
marginBottom: themeVars.space[1.5],
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
export const errorMessage = style({
|
|
131
|
+
display: 'block',
|
|
132
|
+
textDecoration: 'none',
|
|
133
|
+
fontSize: themeVars.fontSize.base,
|
|
134
|
+
color: themeVars.color.red[600],
|
|
135
|
+
wordBreak: 'break-word',
|
|
136
|
+
marginTop: themeVars.space[1.5],
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export const error = style({
|
|
140
|
+
vars: {
|
|
141
|
+
[vars.borderColor]: themeVars.color.red[500],
|
|
142
|
+
},
|
|
143
|
+
':hover': {
|
|
144
|
+
vars: {
|
|
145
|
+
[vars.borderColor]: themeVars.color.red[500],
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
':focus': {
|
|
149
|
+
boxShadow: `0 0 0 2px ${themeVars.color.red[200]}`,
|
|
150
|
+
vars: {
|
|
151
|
+
[vars.borderColor]: themeVars.color.red[500],
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
export const rightIcon = style({
|
|
157
|
+
pointerEvents: 'none',
|
|
158
|
+
position: 'absolute',
|
|
159
|
+
zIndex: 1,
|
|
160
|
+
right: 0,
|
|
161
|
+
top: 0,
|
|
162
|
+
bottom: 0,
|
|
163
|
+
display: 'flex',
|
|
164
|
+
alignItems: 'center',
|
|
165
|
+
justifyContent: 'center',
|
|
166
|
+
width: "2.25rem",
|
|
167
|
+
color: themeVars.color.gray[400],
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
export const hasRightIcon = style({
|
|
171
|
+
paddingRight: "2.25rem",
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
export const menu = style({
|
|
175
|
+
backgroundColor: "#FFFFFF",
|
|
176
|
+
borderRadius: "4px",
|
|
177
|
+
zIndex: 4000,
|
|
178
|
+
border: `1px solid ${themeVars.color.gray[200]}`,
|
|
179
|
+
boxShadow: themeVars.shadow.md,
|
|
180
|
+
maxHeight: "230px",
|
|
181
|
+
overflowY: "auto",
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
export const placeholder = style({
|
|
185
|
+
userSelect: "none",
|
|
186
|
+
color: themeVars.color.gray[500],
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
export const search = style({
|
|
190
|
+
padding: `${themeVars.space[1]} ${themeVars.space[1]} 0`,
|
|
191
|
+
backgroundColor: '#FFFFFF',
|
|
192
|
+
position: 'sticky',
|
|
193
|
+
top: 0,
|
|
194
|
+
zIndex: 1,
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
export const options = style({
|
|
198
|
+
padding: themeVars.space[1],
|
|
199
|
+
display: 'flex',
|
|
200
|
+
flexDirection: 'column',
|
|
201
|
+
gap: themeVars.space[0.5],
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
export const option = style({
|
|
205
|
+
vars: {
|
|
206
|
+
[vars.optionColor]: themeVars.color.gray[800],
|
|
207
|
+
[vars.optionBackgroundColor]: '#FFFFFF',
|
|
208
|
+
},
|
|
209
|
+
position: "relative",
|
|
210
|
+
display: "flex",
|
|
211
|
+
alignItems: "center",
|
|
212
|
+
cursor: "pointer",
|
|
213
|
+
minHeight: "36px",
|
|
214
|
+
fontSize: themeVars.fontSize.base,
|
|
215
|
+
paddingBlock: themeVars.space['1.5'],
|
|
216
|
+
paddingInline: themeVars.space['3'],
|
|
217
|
+
gap: themeVars.space[2],
|
|
218
|
+
color: vars.optionColor,
|
|
219
|
+
transition: "background-color 0.05s ease-in-out",
|
|
220
|
+
backgroundColor: vars.optionBackgroundColor,
|
|
221
|
+
borderRadius: borderRadiuses.md,
|
|
222
|
+
':hover': {
|
|
223
|
+
vars: {
|
|
224
|
+
[vars.optionColor]: themeVars.color.gray[800],
|
|
225
|
+
[vars.optionBackgroundColor]: themeVars.color.gray[100],
|
|
226
|
+
},
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
export const optionFocused = style({
|
|
231
|
+
vars: {
|
|
232
|
+
[vars.optionColor]: themeVars.color.gray[800],
|
|
233
|
+
[vars.optionBackgroundColor]: themeVars.color.gray[100],
|
|
234
|
+
},
|
|
235
|
+
':hover': {
|
|
236
|
+
vars: {
|
|
237
|
+
[vars.optionColor]: themeVars.color.gray[800],
|
|
238
|
+
[vars.optionBackgroundColor]: themeVars.color.gray[100],
|
|
239
|
+
},
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
export const optionSelected = style({
|
|
244
|
+
vars: {
|
|
245
|
+
[vars.optionColor]: themeVars.color.blue[50],
|
|
246
|
+
[vars.optionBackgroundColor]: themeVars.color.blue[500],
|
|
247
|
+
},
|
|
248
|
+
':hover': {
|
|
249
|
+
vars: {
|
|
250
|
+
[vars.optionColor]: themeVars.color.blue[50],
|
|
251
|
+
[vars.optionBackgroundColor]: themeVars.color.blue[600],
|
|
252
|
+
},
|
|
253
|
+
}
|
|
254
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Select.css';
|
|
@@ -1,47 +1,55 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="computedClasses"
|
|
4
|
+
:style="computedStyles"
|
|
5
|
+
></div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import {computed, defineComponent} from 'vue';
|
|
10
|
+
import * as style from "./style";
|
|
11
|
+
|
|
12
|
+
export default defineComponent({
|
|
13
|
+
name: "MSkeleton",
|
|
14
|
+
props: {
|
|
15
|
+
width: {
|
|
16
|
+
type: String
|
|
17
|
+
},
|
|
18
|
+
height: {
|
|
19
|
+
type: String
|
|
20
|
+
},
|
|
21
|
+
loading: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
setup(props) {
|
|
27
|
+
const computedClasses = computed(() => {
|
|
28
|
+
return [
|
|
29
|
+
style.base,
|
|
30
|
+
{
|
|
31
|
+
[style.loading]: props.loading
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const computedStyles = computed(() => {
|
|
37
|
+
let styles = {} as Record<string, string>;
|
|
38
|
+
if (props.width) {
|
|
39
|
+
styles[style.vars.width] = props.width;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (props.height) {
|
|
43
|
+
styles[style.vars.height] = props.height;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return style.assignInlineVars(styles);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
computedClasses,
|
|
51
|
+
computedStyles
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
</script>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createStory } from "
|
|
1
|
+
import { createStory } from "../../../__storybook__";
|
|
2
2
|
import MSkeleton from "../Skeleton.vue";
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -10,13 +10,6 @@ export default {
|
|
|
10
10
|
component: MSkeleton,
|
|
11
11
|
title: 'Components/Skeleton',
|
|
12
12
|
argTypes: {
|
|
13
|
-
variant: {
|
|
14
|
-
options: ['thumb', 'line', 'circle', 'block'],
|
|
15
|
-
control: {
|
|
16
|
-
type: 'select',
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
13
|
}
|
|
21
14
|
}
|
|
22
15
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {createVar, globalKeyframes, style} from "@vanilla-extract/css";
|
|
2
|
+
import {themeVars} from "../../../styles/theme.css";
|
|
3
|
+
|
|
4
|
+
const borderRadiuses = {
|
|
5
|
+
xs: '2px',
|
|
6
|
+
sm: '3px',
|
|
7
|
+
md: '4px',
|
|
8
|
+
lg: '6px',
|
|
9
|
+
xl: '8px',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const vars = {
|
|
13
|
+
height: createVar(),
|
|
14
|
+
width: createVar(),
|
|
15
|
+
marginBottom: createVar(),
|
|
16
|
+
radius: createVar(),
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const base = style({
|
|
20
|
+
vars: {
|
|
21
|
+
[vars.width]: '100%',
|
|
22
|
+
[vars.height]: '1em',
|
|
23
|
+
[vars.marginBottom]: themeVars.space[2],
|
|
24
|
+
[vars.radius]: borderRadiuses.md,
|
|
25
|
+
},
|
|
26
|
+
width: vars.width,
|
|
27
|
+
height: vars.height,
|
|
28
|
+
marginBottom: vars.marginBottom,
|
|
29
|
+
borderRadius: vars.radius,
|
|
30
|
+
position: "relative",
|
|
31
|
+
display: "inline-block",
|
|
32
|
+
overflow: "hidden",
|
|
33
|
+
backgroundColor: themeVars.color.gray[200],
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const shineAnimation = "skeleton-shine-animation";
|
|
37
|
+
globalKeyframes(shineAnimation, {
|
|
38
|
+
'from': {
|
|
39
|
+
transform: 'translate(-37.5%)',
|
|
40
|
+
},
|
|
41
|
+
'to': {
|
|
42
|
+
transform: 'translate(37.5%)'
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const loading = style({
|
|
47
|
+
selectors: {
|
|
48
|
+
['&::after']: {
|
|
49
|
+
content: '',
|
|
50
|
+
position: 'absolute',
|
|
51
|
+
pointerEvents: 'none',
|
|
52
|
+
inset: '0 -150%',
|
|
53
|
+
backgroundImage: `linear-gradient(to right,transparent 25%,${themeVars.color.gray[100]} 37%,transparent 63%)`,
|
|
54
|
+
animation: `${shineAnimation} 2s ${themeVars.transition.default} infinite`
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="style.slider">
|
|
3
|
+
<div :class="style.sliderTransparent">
|
|
4
|
+
<div ref="slider" @mousedown="handleMouseDown" :class="style.sliderBar" :style="{ background: background }">
|
|
5
|
+
</div>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div style="position: absolute; inset: 0px 9px;" @mousedown="handleMouseDown">
|
|
9
|
+
<div draggable :class="style.hueSliderThumb" @mousedown="handleMouseDown" :style="{ left: `${modelValue}%` }"></div>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import { watch } from "vue";
|
|
16
|
+
import { defineComponent, ref } from 'vue';
|
|
17
|
+
import * as style from './style';
|
|
18
|
+
import { useMouseInElement, useMousePressed } from '@vueuse/core';
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: "MSlider",
|
|
22
|
+
props: {
|
|
23
|
+
modelValue: {
|
|
24
|
+
type: Number,
|
|
25
|
+
required: true
|
|
26
|
+
},
|
|
27
|
+
background: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: ""
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
components: {},
|
|
33
|
+
emits: ['update:modelValue'],
|
|
34
|
+
setup(props, { emit }) {
|
|
35
|
+
const slider = ref<HTMLElement>();
|
|
36
|
+
|
|
37
|
+
const { elementX } = useMouseInElement(slider);
|
|
38
|
+
const { pressed } = useMousePressed();
|
|
39
|
+
|
|
40
|
+
watch(() => pressed.value, () => {
|
|
41
|
+
if (!pressed.value) {
|
|
42
|
+
dragging.value = false;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
watch(() => elementX.value, () => {
|
|
47
|
+
if (!dragging.value) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
setThumbPosition();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
const dragging = ref(false);
|
|
56
|
+
|
|
57
|
+
const setThumbPosition = () => {
|
|
58
|
+
emit('update:modelValue', ((Math.min(Math.max(elementX.value, 0), slider.value?.clientWidth || 0) / (slider.value?.clientWidth || 0)) * 100));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const handleMouseDown = () => {
|
|
62
|
+
dragging.value = true;
|
|
63
|
+
setThumbPosition();
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
setThumbPosition,
|
|
68
|
+
elementX,
|
|
69
|
+
pressed,
|
|
70
|
+
handleMouseDown,
|
|
71
|
+
slider,
|
|
72
|
+
style,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
</script>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createVar, globalKeyframes, globalStyle, style, styleVariants } from "@vanilla-extract/css";
|
|
2
|
+
|
|
3
|
+
export const slider = style({
|
|
4
|
+
userSelect: 'none',
|
|
5
|
+
position: 'relative',
|
|
6
|
+
height: '14px',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const sliderTransparent = style({
|
|
10
|
+
userSelect: 'none',
|
|
11
|
+
position: 'absolute',
|
|
12
|
+
height: '14px',
|
|
13
|
+
backgroundImage: 'linear-gradient(45deg, #bebebe 25%, transparent 25%), linear-gradient(-45deg, #bebebe 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #bebebe 75%), linear-gradient(-45deg, transparent 75%, #bebebe 75%)',
|
|
14
|
+
backgroundSize: '14px 14px',
|
|
15
|
+
backgroundPosition: '0 0, 0 7px, 7px -7px, -7px 0px',
|
|
16
|
+
overflow: 'hidden',
|
|
17
|
+
top: 0,
|
|
18
|
+
left: 0,
|
|
19
|
+
right: 0,
|
|
20
|
+
bottom: 0,
|
|
21
|
+
borderRadius: '6px'
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const sliderBar = style({
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
top: 0,
|
|
27
|
+
left: 0,
|
|
28
|
+
right: 0,
|
|
29
|
+
bottom: 0
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const hueSliderThumb = style({
|
|
33
|
+
transform: 'translate(-50%)',
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
top: '-2px',
|
|
36
|
+
width: '18px',
|
|
37
|
+
height: '18px',
|
|
38
|
+
borderRadius: '50%',
|
|
39
|
+
backgroundColor: 'rgba(255,255,255,0.5)',
|
|
40
|
+
border: '2px solid white',
|
|
41
|
+
boxShadow: '0 0 3px rgba(0, 0, 0, 1)',
|
|
42
|
+
cursor: 'e-resize',
|
|
43
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Slider.css';
|
|
File without changes
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="computedClasses">
|
|
3
|
+
<span>
|
|
4
|
+
<slot />
|
|
5
|
+
</span>
|
|
6
|
+
<button v-if="closeable" @click.stop="close" :class="style.close" tabindex="0">
|
|
7
|
+
<svg viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" style="width: 1em; height: 1em;">
|
|
8
|
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
9
|
+
<g fill="currentColor" fill-rule="nonzero">
|
|
10
|
+
<path
|
|
11
|
+
d="M2.08859116,2.2156945 L2.14644661,2.14644661 C2.32001296,1.97288026 2.58943736,1.95359511 2.7843055,2.08859116 L2.85355339,2.14644661 L6,5.293 L9.14644661,2.14644661 C9.34170876,1.95118446 9.65829124,1.95118446 9.85355339,2.14644661 C10.0488155,2.34170876 10.0488155,2.65829124 9.85355339,2.85355339 L6.707,6 L9.85355339,9.14644661 C10.0271197,9.32001296 10.0464049,9.58943736 9.91140884,9.7843055 L9.85355339,9.85355339 C9.67998704,10.0271197 9.41056264,10.0464049 9.2156945,9.91140884 L9.14644661,9.85355339 L6,6.707 L2.85355339,9.85355339 C2.65829124,10.0488155 2.34170876,10.0488155 2.14644661,9.85355339 C1.95118446,9.65829124 1.95118446,9.34170876 2.14644661,9.14644661 L5.293,6 L2.14644661,2.85355339 C1.97288026,2.67998704 1.95359511,2.41056264 2.08859116,2.2156945 L2.14644661,2.14644661 L2.08859116,2.2156945 Z">
|
|
12
|
+
</path>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</svg>
|
|
16
|
+
|
|
17
|
+
</button>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import type { Color, Size } from "../../types/props";
|
|
23
|
+
import { computed, defineComponent, type PropType } from "vue";
|
|
24
|
+
import * as style from "./style";
|
|
25
|
+
|
|
26
|
+
export default defineComponent({
|
|
27
|
+
name: "MTag",
|
|
28
|
+
props: {
|
|
29
|
+
color: {
|
|
30
|
+
type: String as PropType<Color>,
|
|
31
|
+
default: "primary",
|
|
32
|
+
},
|
|
33
|
+
size: {
|
|
34
|
+
type: String as PropType<Size>,
|
|
35
|
+
default: "md",
|
|
36
|
+
},
|
|
37
|
+
closeable: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
emits: ['close'],
|
|
43
|
+
setup(props, { emit }) {
|
|
44
|
+
const computedClasses = computed(() => {
|
|
45
|
+
return [
|
|
46
|
+
style.base
|
|
47
|
+
];
|
|
48
|
+
return {
|
|
49
|
+
"m-tag": true,
|
|
50
|
+
[`m-tag--${props.color}`]: true,
|
|
51
|
+
[`m-tag--${props.size}`]: true,
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const close = () => {
|
|
56
|
+
emit('close')
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
computedClasses,
|
|
61
|
+
close,
|
|
62
|
+
style
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import MTag from "../Tag.vue";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
MTagBasic,
|
|
5
|
+
} from "./index";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
colorArgType,
|
|
9
|
+
createStory,
|
|
10
|
+
sizeArgType
|
|
11
|
+
} from "../../../__storybook__";
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
component: MTag,
|
|
15
|
+
title: 'Components/Tag',
|
|
16
|
+
argTypes: {
|
|
17
|
+
...colorArgType(),
|
|
18
|
+
...sizeArgType()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const Basic = createStory(MTagBasic);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MTagBasic } from './basic.vue';
|