@teammodlr/ui-kit 2.1.39 → 2.1.43
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/checkbox/Checkbox.vue.d.ts +1 -0
- package/lib/components/checkbox/style/Checkbox.css.d.ts +1 -0
- package/lib/index.cjs.js +10 -10
- package/lib/index.es.js +1950 -1932
- package/lib/nuxt.js +35 -35
- package/lib/nuxt.plugin.js +8 -8
- package/lib/style.css +1 -1
- package/package.json +89 -89
- package/src/__storybook__/argTypes.ts +53 -53
- package/src/__storybook__/createStory.ts +15 -15
- package/src/__storybook__/index.ts +2 -2
- package/src/call.ts +34 -34
- 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.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.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.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.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.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/Button.css.ts +695 -695
- 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.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 -145
- package/src/components/checkbox/examples/basic.vue +9 -9
- package/src/components/checkbox/examples/index.ts +2 -2
- package/src/components/checkbox/examples/slot.vue +14 -11
- package/src/components/checkbox/style/Checkbox.css.ts +178 -161
- package/src/components/checkbox/style/index.ts +1 -1
- package/src/components/colorpicker/ColorPicker.vue +333 -333
- package/src/components/colorpicker/examples/basic.vue +2 -2
- package/src/components/colorpicker/examples/index.ts +1 -1
- package/src/components/colorpicker/style/ColorPicker.css.ts +127 -127
- package/src/components/colorpicker/style/index.ts +1 -1
- package/src/components/colorpicker/utils.ts +206 -206
- package/src/components/confirm/Confirm.vue +65 -65
- package/src/components/confirm/ConfirmProvider.vue +83 -83
- package/src/components/confirm/examples/basic.vue +48 -48
- 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/Dialog.vue +118 -118
- package/src/components/dialog/examples/basic.vue +16 -16
- package/src/components/dialog/examples/index.ts +1 -1
- package/src/components/dialog/style/Dialog.css.ts +100 -100
- package/src/components/dialog/style/index.ts +1 -1
- package/src/components/dropdown/Dropdown.vue +308 -308
- package/src/components/dropdown/DropdownHeading.vue +23 -23
- package/src/components/dropdown/DropdownItem.vue +151 -151
- package/src/components/dropdown/DropdownList.vue +20 -20
- package/src/components/dropdown/DropdownSeperator.vue +22 -22
- package/src/components/dropdown/DropdownWrapper.vue +18 -18
- package/src/components/dropdown/examples/basic.vue +119 -119
- package/src/components/dropdown/examples/context.vue +71 -71
- package/src/components/dropdown/examples/index.ts +3 -3
- package/src/components/dropdown/hooks.ts +30 -30
- package/src/components/dropdown/style/Dropdown.css.ts +158 -158
- 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.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.ts +1 -1
- package/src/components/index.ts +47 -47
- package/src/components/input/Input.vue +233 -233
- package/src/components/input/examples/basic.vue +21 -21
- 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.ts +1 -1
- package/src/components/messageprovider/Message.vue +135 -135
- package/src/components/messageprovider/MessageProvider.vue +156 -156
- package/src/components/messageprovider/examples/basic.vue +70 -70
- 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.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.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.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.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.ts +1 -1
- package/src/components/renderer/props.ts +14 -14
- package/src/components/renderer/renderer.ts +16 -16
- package/src/components/select/Select.vue +781 -781
- package/src/components/select/examples/basic.vue +21 -21
- 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/Select.css.ts +368 -368
- package/src/components/select/style/index.ts +1 -1
- package/src/components/skeleton/Skeleton.vue +55 -55
- package/src/components/skeleton/examples/basic.vue +3 -3
- 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/Slider.vue +76 -76
- 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.ts +2 -2
- package/src/components/switch/examples/slot.vue +11 -11
- package/src/components/switch/style/Switch.css.ts +135 -135
- package/src/components/switch/style/index.ts +1 -1
- package/src/components/tab/Tab.css +113 -113
- package/src/components/tab/Tab.vue +98 -98
- package/src/components/tab/TabGroup.vue +90 -90
- package/src/components/tab/examples/basic.vue +19 -19
- 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.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.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.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/Tooltip.vue +196 -196
- package/src/components/tooltip/examples/basic.vue +5 -5
- 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.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.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.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 +4 -4
- package/src/composables/useCachedUid.ts +49 -49
- 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/sidebar.vue +262 -262
- 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/styles/transitions.css.ts +97 -97
- package/src/types/props.ts +19 -19
- package/src/utils/injection.ts +5 -5
- package/volar.d.ts +16 -16
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<MColorPicker />
|
|
1
|
+
<template>
|
|
2
|
+
<MColorPicker />
|
|
3
3
|
</template>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as MColorBasic } from './basic.vue';
|
|
1
|
+
export { default as MColorBasic } from './basic.vue';
|
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createVar,
|
|
3
|
-
globalKeyframes,
|
|
4
|
-
globalStyle,
|
|
5
|
-
style,
|
|
6
|
-
styleVariants
|
|
7
|
-
} from '@vanilla-extract/css';
|
|
8
|
-
import { themeVars } from '../../../styles/theme.css';
|
|
9
|
-
|
|
10
|
-
export const container = style({
|
|
11
|
-
display: 'flex',
|
|
12
|
-
flexDirection: 'column',
|
|
13
|
-
width: '280px',
|
|
14
|
-
alignItems: 'center',
|
|
15
|
-
gap: '10px',
|
|
16
|
-
userSelect: 'none',
|
|
17
|
-
zIndex: 100,
|
|
18
|
-
backgroundColor: '#FFF',
|
|
19
|
-
borderRadius: '5px',
|
|
20
|
-
padding: themeVars.space[3],
|
|
21
|
-
border: `1px solid ${themeVars.color.gray[200]}`,
|
|
22
|
-
boxShadow: themeVars.shadow.md
|
|
23
|
-
});
|
|
24
|
-
export const sliderThumb = style({
|
|
25
|
-
transform: 'translate(-50%, -50%)',
|
|
26
|
-
position: 'absolute',
|
|
27
|
-
width: '14px',
|
|
28
|
-
height: '14px',
|
|
29
|
-
borderRadius: '50%',
|
|
30
|
-
backgroundColor: 'transparent',
|
|
31
|
-
border: '2px solid white',
|
|
32
|
-
boxShadow: themeVars.shadow.sm,
|
|
33
|
-
cursor: 'crosshair',
|
|
34
|
-
userSelect: 'none'
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
export const eyeDrop = style({
|
|
38
|
-
backgroundColor: 'transparent',
|
|
39
|
-
outline: 'none',
|
|
40
|
-
border: 0,
|
|
41
|
-
color: themeVars.color.gray[600],
|
|
42
|
-
width: '32px',
|
|
43
|
-
height: '32px',
|
|
44
|
-
borderRadius: themeVars.rounded.default,
|
|
45
|
-
display: 'flex',
|
|
46
|
-
alignItems: 'center',
|
|
47
|
-
justifyContent: 'center',
|
|
48
|
-
flexShrink: 0,
|
|
49
|
-
cursor: 'pointer',
|
|
50
|
-
selectors: {
|
|
51
|
-
'&:hover': {
|
|
52
|
-
backgroundColor: themeVars.color.gray[100],
|
|
53
|
-
color: themeVars.color.gray[700]
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
export const preview = style({
|
|
59
|
-
backgroundImage:
|
|
60
|
-
'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%)',
|
|
61
|
-
backgroundSize: '12px 12px',
|
|
62
|
-
backgroundPosition: '0 0, 0 6px, 6px -6px, -6px 0px',
|
|
63
|
-
overflow: 'hidden',
|
|
64
|
-
minWidth: '32px',
|
|
65
|
-
minHeight: '32px',
|
|
66
|
-
width: '32px',
|
|
67
|
-
height: '32px',
|
|
68
|
-
borderRadius: '100%',
|
|
69
|
-
border: `1px solid ${themeVars.color.gray[200]}`
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
export const colours = style({
|
|
73
|
-
position: 'relative',
|
|
74
|
-
height: '160px',
|
|
75
|
-
width: '100%',
|
|
76
|
-
cursor: 'crosshair'
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
export const reference = style({
|
|
80
|
-
backgroundImage:
|
|
81
|
-
'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%)',
|
|
82
|
-
backgroundSize: '12px 12px',
|
|
83
|
-
backgroundPosition: '0 0, 0 6px, 6px -6px, -6px 0px',
|
|
84
|
-
overflow: 'hidden',
|
|
85
|
-
minWidth: '28px',
|
|
86
|
-
minHeight: '28px',
|
|
87
|
-
width: '28px',
|
|
88
|
-
height: '28px',
|
|
89
|
-
borderRadius: themeVars.rounded.default,
|
|
90
|
-
position: 'relative',
|
|
91
|
-
cursor: 'pointer',
|
|
92
|
-
userSelect: 'none'
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
export const referenceColor = style({
|
|
96
|
-
position: 'absolute',
|
|
97
|
-
top: 0,
|
|
98
|
-
left: 0,
|
|
99
|
-
right: 0,
|
|
100
|
-
bottom: 0
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
export const colorActions = style({
|
|
104
|
-
display: 'flex',
|
|
105
|
-
gap: themeVars.space[2],
|
|
106
|
-
width: '100%',
|
|
107
|
-
alignItems: 'center',
|
|
108
|
-
justifyContent: 'space-between'
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
export const whiteGradient = style({
|
|
112
|
-
position: 'absolute',
|
|
113
|
-
top: 0,
|
|
114
|
-
left: 0,
|
|
115
|
-
right: 0,
|
|
116
|
-
bottom: 0,
|
|
117
|
-
background: 'linear-gradient(90deg, #FFF, rgba(255, 255, 255, 0))'
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
export const blackGradient = style({
|
|
121
|
-
position: 'absolute',
|
|
122
|
-
top: 0,
|
|
123
|
-
left: 0,
|
|
124
|
-
right: 0,
|
|
125
|
-
bottom: 0,
|
|
126
|
-
background: 'linear-gradient(0deg, #000, transparent)'
|
|
127
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
createVar,
|
|
3
|
+
globalKeyframes,
|
|
4
|
+
globalStyle,
|
|
5
|
+
style,
|
|
6
|
+
styleVariants
|
|
7
|
+
} from '@vanilla-extract/css';
|
|
8
|
+
import { themeVars } from '../../../styles/theme.css';
|
|
9
|
+
|
|
10
|
+
export const container = style({
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
width: '280px',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
gap: '10px',
|
|
16
|
+
userSelect: 'none',
|
|
17
|
+
zIndex: 100,
|
|
18
|
+
backgroundColor: '#FFF',
|
|
19
|
+
borderRadius: '5px',
|
|
20
|
+
padding: themeVars.space[3],
|
|
21
|
+
border: `1px solid ${themeVars.color.gray[200]}`,
|
|
22
|
+
boxShadow: themeVars.shadow.md
|
|
23
|
+
});
|
|
24
|
+
export const sliderThumb = style({
|
|
25
|
+
transform: 'translate(-50%, -50%)',
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
width: '14px',
|
|
28
|
+
height: '14px',
|
|
29
|
+
borderRadius: '50%',
|
|
30
|
+
backgroundColor: 'transparent',
|
|
31
|
+
border: '2px solid white',
|
|
32
|
+
boxShadow: themeVars.shadow.sm,
|
|
33
|
+
cursor: 'crosshair',
|
|
34
|
+
userSelect: 'none'
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const eyeDrop = style({
|
|
38
|
+
backgroundColor: 'transparent',
|
|
39
|
+
outline: 'none',
|
|
40
|
+
border: 0,
|
|
41
|
+
color: themeVars.color.gray[600],
|
|
42
|
+
width: '32px',
|
|
43
|
+
height: '32px',
|
|
44
|
+
borderRadius: themeVars.rounded.default,
|
|
45
|
+
display: 'flex',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
justifyContent: 'center',
|
|
48
|
+
flexShrink: 0,
|
|
49
|
+
cursor: 'pointer',
|
|
50
|
+
selectors: {
|
|
51
|
+
'&:hover': {
|
|
52
|
+
backgroundColor: themeVars.color.gray[100],
|
|
53
|
+
color: themeVars.color.gray[700]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const preview = style({
|
|
59
|
+
backgroundImage:
|
|
60
|
+
'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%)',
|
|
61
|
+
backgroundSize: '12px 12px',
|
|
62
|
+
backgroundPosition: '0 0, 0 6px, 6px -6px, -6px 0px',
|
|
63
|
+
overflow: 'hidden',
|
|
64
|
+
minWidth: '32px',
|
|
65
|
+
minHeight: '32px',
|
|
66
|
+
width: '32px',
|
|
67
|
+
height: '32px',
|
|
68
|
+
borderRadius: '100%',
|
|
69
|
+
border: `1px solid ${themeVars.color.gray[200]}`
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const colours = style({
|
|
73
|
+
position: 'relative',
|
|
74
|
+
height: '160px',
|
|
75
|
+
width: '100%',
|
|
76
|
+
cursor: 'crosshair'
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export const reference = style({
|
|
80
|
+
backgroundImage:
|
|
81
|
+
'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%)',
|
|
82
|
+
backgroundSize: '12px 12px',
|
|
83
|
+
backgroundPosition: '0 0, 0 6px, 6px -6px, -6px 0px',
|
|
84
|
+
overflow: 'hidden',
|
|
85
|
+
minWidth: '28px',
|
|
86
|
+
minHeight: '28px',
|
|
87
|
+
width: '28px',
|
|
88
|
+
height: '28px',
|
|
89
|
+
borderRadius: themeVars.rounded.default,
|
|
90
|
+
position: 'relative',
|
|
91
|
+
cursor: 'pointer',
|
|
92
|
+
userSelect: 'none'
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
export const referenceColor = style({
|
|
96
|
+
position: 'absolute',
|
|
97
|
+
top: 0,
|
|
98
|
+
left: 0,
|
|
99
|
+
right: 0,
|
|
100
|
+
bottom: 0
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export const colorActions = style({
|
|
104
|
+
display: 'flex',
|
|
105
|
+
gap: themeVars.space[2],
|
|
106
|
+
width: '100%',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
justifyContent: 'space-between'
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
export const whiteGradient = style({
|
|
112
|
+
position: 'absolute',
|
|
113
|
+
top: 0,
|
|
114
|
+
left: 0,
|
|
115
|
+
right: 0,
|
|
116
|
+
bottom: 0,
|
|
117
|
+
background: 'linear-gradient(90deg, #FFF, rgba(255, 255, 255, 0))'
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
export const blackGradient = style({
|
|
121
|
+
position: 'absolute',
|
|
122
|
+
top: 0,
|
|
123
|
+
left: 0,
|
|
124
|
+
right: 0,
|
|
125
|
+
bottom: 0,
|
|
126
|
+
background: 'linear-gradient(0deg, #000, transparent)'
|
|
127
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './ColorPicker.css';
|
|
1
|
+
export * from './ColorPicker.css';
|
|
@@ -1,206 +1,206 @@
|
|
|
1
|
-
export interface Color {
|
|
2
|
-
r: number;
|
|
3
|
-
g: number;
|
|
4
|
-
b: number;
|
|
5
|
-
a: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface HSV {
|
|
9
|
-
h: number;
|
|
10
|
-
s: number;
|
|
11
|
-
v: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const RGBAToHex = (
|
|
15
|
-
r: number,
|
|
16
|
-
g: number,
|
|
17
|
-
b: number,
|
|
18
|
-
a: number
|
|
19
|
-
): string => {
|
|
20
|
-
const hexR: string = r.toString(16).padStart(2, '0');
|
|
21
|
-
const hexG: string = g.toString(16).padStart(2, '0');
|
|
22
|
-
const hexB: string = b.toString(16).padStart(2, '0');
|
|
23
|
-
const hexA: string = Math.round(a * 255)
|
|
24
|
-
.toString(16)
|
|
25
|
-
.padStart(2, '0');
|
|
26
|
-
|
|
27
|
-
return `#${hexR}${hexG}${hexB}${a >= 1 ? '' : hexA}`;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const hexToRGB = (
|
|
31
|
-
hexColor: string,
|
|
32
|
-
defaultR = 0,
|
|
33
|
-
defaultG = 0,
|
|
34
|
-
defaultB = 0,
|
|
35
|
-
defaultA = 0
|
|
36
|
-
): Color => {
|
|
37
|
-
hexColor = hexColor.replace('#', '');
|
|
38
|
-
|
|
39
|
-
let r = defaultR;
|
|
40
|
-
let g = defaultG;
|
|
41
|
-
let b = defaultB;
|
|
42
|
-
let a = defaultA;
|
|
43
|
-
|
|
44
|
-
if (hexColor.length >= 2) {
|
|
45
|
-
r = parseInt(hexColor.substring(0, 2), 16);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (hexColor.length >= 4) {
|
|
49
|
-
g = parseInt(hexColor.substring(2, 4), 16);
|
|
50
|
-
} else {
|
|
51
|
-
g = 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (hexColor.length >= 6) {
|
|
55
|
-
b = parseInt(hexColor.substring(4, 6), 16);
|
|
56
|
-
} else {
|
|
57
|
-
b = 0;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (hexColor.length >= 8) {
|
|
61
|
-
a = parseInt(hexColor.substring(6, 8), 16) / 255;
|
|
62
|
-
} else {
|
|
63
|
-
a = 1;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (isNaN(r) || isNaN(g) || isNaN(b) || isNaN(a)) {
|
|
67
|
-
r = 0;
|
|
68
|
-
b = 0;
|
|
69
|
-
g = 0;
|
|
70
|
-
a = 1;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
r,
|
|
75
|
-
g,
|
|
76
|
-
b,
|
|
77
|
-
a
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export const RGBToHSV = (r: number, g: number, b: number): HSV => {
|
|
82
|
-
const max = Math.max(r, g, b);
|
|
83
|
-
const min = Math.min(r, g, b);
|
|
84
|
-
|
|
85
|
-
const delta = max - min;
|
|
86
|
-
const brightness = max;
|
|
87
|
-
let saturation = 0;
|
|
88
|
-
if (max !== 0) {
|
|
89
|
-
saturation = delta / max;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
let hue = 0;
|
|
93
|
-
if (delta !== 0) {
|
|
94
|
-
if (max === r) {
|
|
95
|
-
hue = ((g - b) / delta) % 6;
|
|
96
|
-
} else if (max === g) {
|
|
97
|
-
hue = (b - r) / delta + 2;
|
|
98
|
-
} else {
|
|
99
|
-
hue = (r - g) / delta + 4;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
hue *= 60;
|
|
103
|
-
if (hue < 0) {
|
|
104
|
-
hue += 360;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return {
|
|
109
|
-
h: hue,
|
|
110
|
-
s: saturation,
|
|
111
|
-
v: brightness / 255
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export const HSVToRGBA = (
|
|
116
|
-
hue: number,
|
|
117
|
-
brightness: number,
|
|
118
|
-
saturation: number,
|
|
119
|
-
alpha: number
|
|
120
|
-
): Color => {
|
|
121
|
-
const hueInDegrees = hue;
|
|
122
|
-
const chroma = brightness * saturation;
|
|
123
|
-
const hue1 = hueInDegrees / 60;
|
|
124
|
-
const x = chroma * (1 - Math.abs((hue1 % 2) - 1));
|
|
125
|
-
let r1 = 0;
|
|
126
|
-
let g1 = 0;
|
|
127
|
-
let b1 = 0;
|
|
128
|
-
if (hue1 >= 0 && hue1 < 1) {
|
|
129
|
-
r1 = chroma;
|
|
130
|
-
g1 = x;
|
|
131
|
-
} else if (hue1 >= 1 && hue1 < 2) {
|
|
132
|
-
r1 = x;
|
|
133
|
-
g1 = chroma;
|
|
134
|
-
} else if (hue1 >= 2 && hue1 < 3) {
|
|
135
|
-
g1 = chroma;
|
|
136
|
-
b1 = x;
|
|
137
|
-
} else if (hue1 >= 3 && hue1 < 4) {
|
|
138
|
-
g1 = x;
|
|
139
|
-
b1 = chroma;
|
|
140
|
-
} else if (hue1 >= 4 && hue1 < 5) {
|
|
141
|
-
r1 = x;
|
|
142
|
-
b1 = chroma;
|
|
143
|
-
} else {
|
|
144
|
-
r1 = chroma;
|
|
145
|
-
b1 = x;
|
|
146
|
-
}
|
|
147
|
-
const m = brightness - chroma;
|
|
148
|
-
const r = Math.round((r1 + m) * 255);
|
|
149
|
-
const g = Math.round((g1 + m) * 255);
|
|
150
|
-
const b = Math.round((b1 + m) * 255);
|
|
151
|
-
|
|
152
|
-
return {
|
|
153
|
-
r,
|
|
154
|
-
g,
|
|
155
|
-
b,
|
|
156
|
-
a: alpha
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
export const HueToRGBA = (hue: number, alpha: number): Color => {
|
|
161
|
-
const chroma = 1 - Math.abs(2 * 0.5 - 1);
|
|
162
|
-
const huePrime = (hue / 360) * 6;
|
|
163
|
-
const intermediateValue = chroma * (1 - Math.abs((huePrime % 2) - 1));
|
|
164
|
-
let red = 0;
|
|
165
|
-
let green = 0;
|
|
166
|
-
let blue = 0;
|
|
167
|
-
|
|
168
|
-
if (huePrime >= 0 && huePrime < 1) {
|
|
169
|
-
red = chroma;
|
|
170
|
-
green = intermediateValue;
|
|
171
|
-
blue = 0;
|
|
172
|
-
} else if (huePrime >= 1 && huePrime < 2) {
|
|
173
|
-
red = intermediateValue;
|
|
174
|
-
green = chroma;
|
|
175
|
-
blue = 0;
|
|
176
|
-
} else if (huePrime >= 2 && huePrime < 3) {
|
|
177
|
-
red = 0;
|
|
178
|
-
green = chroma;
|
|
179
|
-
blue = intermediateValue;
|
|
180
|
-
} else if (huePrime >= 3 && huePrime < 4) {
|
|
181
|
-
red = 0;
|
|
182
|
-
green = intermediateValue;
|
|
183
|
-
blue = chroma;
|
|
184
|
-
} else if (huePrime >= 4 && huePrime < 5) {
|
|
185
|
-
red = intermediateValue;
|
|
186
|
-
green = 0;
|
|
187
|
-
blue = chroma;
|
|
188
|
-
} else {
|
|
189
|
-
red = chroma;
|
|
190
|
-
green = 0;
|
|
191
|
-
blue = intermediateValue;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
const lightnessDecimal = 0.5;
|
|
195
|
-
const lightnessAdjustment = (1 - chroma) * (lightnessDecimal - 0.5);
|
|
196
|
-
const finalRed = Math.round((red + lightnessAdjustment) * 255);
|
|
197
|
-
const finalGreen = Math.round((green + lightnessAdjustment) * 255);
|
|
198
|
-
const finalBlue = Math.round((blue + lightnessAdjustment) * 255);
|
|
199
|
-
|
|
200
|
-
return {
|
|
201
|
-
r: finalRed,
|
|
202
|
-
g: finalGreen,
|
|
203
|
-
b: finalBlue,
|
|
204
|
-
a: alpha
|
|
205
|
-
};
|
|
206
|
-
};
|
|
1
|
+
export interface Color {
|
|
2
|
+
r: number;
|
|
3
|
+
g: number;
|
|
4
|
+
b: number;
|
|
5
|
+
a: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface HSV {
|
|
9
|
+
h: number;
|
|
10
|
+
s: number;
|
|
11
|
+
v: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const RGBAToHex = (
|
|
15
|
+
r: number,
|
|
16
|
+
g: number,
|
|
17
|
+
b: number,
|
|
18
|
+
a: number
|
|
19
|
+
): string => {
|
|
20
|
+
const hexR: string = r.toString(16).padStart(2, '0');
|
|
21
|
+
const hexG: string = g.toString(16).padStart(2, '0');
|
|
22
|
+
const hexB: string = b.toString(16).padStart(2, '0');
|
|
23
|
+
const hexA: string = Math.round(a * 255)
|
|
24
|
+
.toString(16)
|
|
25
|
+
.padStart(2, '0');
|
|
26
|
+
|
|
27
|
+
return `#${hexR}${hexG}${hexB}${a >= 1 ? '' : hexA}`;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const hexToRGB = (
|
|
31
|
+
hexColor: string,
|
|
32
|
+
defaultR = 0,
|
|
33
|
+
defaultG = 0,
|
|
34
|
+
defaultB = 0,
|
|
35
|
+
defaultA = 0
|
|
36
|
+
): Color => {
|
|
37
|
+
hexColor = hexColor.replace('#', '');
|
|
38
|
+
|
|
39
|
+
let r = defaultR;
|
|
40
|
+
let g = defaultG;
|
|
41
|
+
let b = defaultB;
|
|
42
|
+
let a = defaultA;
|
|
43
|
+
|
|
44
|
+
if (hexColor.length >= 2) {
|
|
45
|
+
r = parseInt(hexColor.substring(0, 2), 16);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (hexColor.length >= 4) {
|
|
49
|
+
g = parseInt(hexColor.substring(2, 4), 16);
|
|
50
|
+
} else {
|
|
51
|
+
g = 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (hexColor.length >= 6) {
|
|
55
|
+
b = parseInt(hexColor.substring(4, 6), 16);
|
|
56
|
+
} else {
|
|
57
|
+
b = 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (hexColor.length >= 8) {
|
|
61
|
+
a = parseInt(hexColor.substring(6, 8), 16) / 255;
|
|
62
|
+
} else {
|
|
63
|
+
a = 1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (isNaN(r) || isNaN(g) || isNaN(b) || isNaN(a)) {
|
|
67
|
+
r = 0;
|
|
68
|
+
b = 0;
|
|
69
|
+
g = 0;
|
|
70
|
+
a = 1;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
r,
|
|
75
|
+
g,
|
|
76
|
+
b,
|
|
77
|
+
a
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const RGBToHSV = (r: number, g: number, b: number): HSV => {
|
|
82
|
+
const max = Math.max(r, g, b);
|
|
83
|
+
const min = Math.min(r, g, b);
|
|
84
|
+
|
|
85
|
+
const delta = max - min;
|
|
86
|
+
const brightness = max;
|
|
87
|
+
let saturation = 0;
|
|
88
|
+
if (max !== 0) {
|
|
89
|
+
saturation = delta / max;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
let hue = 0;
|
|
93
|
+
if (delta !== 0) {
|
|
94
|
+
if (max === r) {
|
|
95
|
+
hue = ((g - b) / delta) % 6;
|
|
96
|
+
} else if (max === g) {
|
|
97
|
+
hue = (b - r) / delta + 2;
|
|
98
|
+
} else {
|
|
99
|
+
hue = (r - g) / delta + 4;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
hue *= 60;
|
|
103
|
+
if (hue < 0) {
|
|
104
|
+
hue += 360;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
h: hue,
|
|
110
|
+
s: saturation,
|
|
111
|
+
v: brightness / 255
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const HSVToRGBA = (
|
|
116
|
+
hue: number,
|
|
117
|
+
brightness: number,
|
|
118
|
+
saturation: number,
|
|
119
|
+
alpha: number
|
|
120
|
+
): Color => {
|
|
121
|
+
const hueInDegrees = hue;
|
|
122
|
+
const chroma = brightness * saturation;
|
|
123
|
+
const hue1 = hueInDegrees / 60;
|
|
124
|
+
const x = chroma * (1 - Math.abs((hue1 % 2) - 1));
|
|
125
|
+
let r1 = 0;
|
|
126
|
+
let g1 = 0;
|
|
127
|
+
let b1 = 0;
|
|
128
|
+
if (hue1 >= 0 && hue1 < 1) {
|
|
129
|
+
r1 = chroma;
|
|
130
|
+
g1 = x;
|
|
131
|
+
} else if (hue1 >= 1 && hue1 < 2) {
|
|
132
|
+
r1 = x;
|
|
133
|
+
g1 = chroma;
|
|
134
|
+
} else if (hue1 >= 2 && hue1 < 3) {
|
|
135
|
+
g1 = chroma;
|
|
136
|
+
b1 = x;
|
|
137
|
+
} else if (hue1 >= 3 && hue1 < 4) {
|
|
138
|
+
g1 = x;
|
|
139
|
+
b1 = chroma;
|
|
140
|
+
} else if (hue1 >= 4 && hue1 < 5) {
|
|
141
|
+
r1 = x;
|
|
142
|
+
b1 = chroma;
|
|
143
|
+
} else {
|
|
144
|
+
r1 = chroma;
|
|
145
|
+
b1 = x;
|
|
146
|
+
}
|
|
147
|
+
const m = brightness - chroma;
|
|
148
|
+
const r = Math.round((r1 + m) * 255);
|
|
149
|
+
const g = Math.round((g1 + m) * 255);
|
|
150
|
+
const b = Math.round((b1 + m) * 255);
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
r,
|
|
154
|
+
g,
|
|
155
|
+
b,
|
|
156
|
+
a: alpha
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export const HueToRGBA = (hue: number, alpha: number): Color => {
|
|
161
|
+
const chroma = 1 - Math.abs(2 * 0.5 - 1);
|
|
162
|
+
const huePrime = (hue / 360) * 6;
|
|
163
|
+
const intermediateValue = chroma * (1 - Math.abs((huePrime % 2) - 1));
|
|
164
|
+
let red = 0;
|
|
165
|
+
let green = 0;
|
|
166
|
+
let blue = 0;
|
|
167
|
+
|
|
168
|
+
if (huePrime >= 0 && huePrime < 1) {
|
|
169
|
+
red = chroma;
|
|
170
|
+
green = intermediateValue;
|
|
171
|
+
blue = 0;
|
|
172
|
+
} else if (huePrime >= 1 && huePrime < 2) {
|
|
173
|
+
red = intermediateValue;
|
|
174
|
+
green = chroma;
|
|
175
|
+
blue = 0;
|
|
176
|
+
} else if (huePrime >= 2 && huePrime < 3) {
|
|
177
|
+
red = 0;
|
|
178
|
+
green = chroma;
|
|
179
|
+
blue = intermediateValue;
|
|
180
|
+
} else if (huePrime >= 3 && huePrime < 4) {
|
|
181
|
+
red = 0;
|
|
182
|
+
green = intermediateValue;
|
|
183
|
+
blue = chroma;
|
|
184
|
+
} else if (huePrime >= 4 && huePrime < 5) {
|
|
185
|
+
red = intermediateValue;
|
|
186
|
+
green = 0;
|
|
187
|
+
blue = chroma;
|
|
188
|
+
} else {
|
|
189
|
+
red = chroma;
|
|
190
|
+
green = 0;
|
|
191
|
+
blue = intermediateValue;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const lightnessDecimal = 0.5;
|
|
195
|
+
const lightnessAdjustment = (1 - chroma) * (lightnessDecimal - 0.5);
|
|
196
|
+
const finalRed = Math.round((red + lightnessAdjustment) * 255);
|
|
197
|
+
const finalGreen = Math.round((green + lightnessAdjustment) * 255);
|
|
198
|
+
const finalBlue = Math.round((blue + lightnessAdjustment) * 255);
|
|
199
|
+
|
|
200
|
+
return {
|
|
201
|
+
r: finalRed,
|
|
202
|
+
g: finalGreen,
|
|
203
|
+
b: finalBlue,
|
|
204
|
+
a: alpha
|
|
205
|
+
};
|
|
206
|
+
};
|