@pixelium/web-vue 0.0.2-fix → 0.0.3-alpha
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/README.md +42 -0
- package/README.zh.md +6 -3
- package/dist/font.css +1 -1
- package/dist/index.d.ts +1602 -248
- package/dist/normalize.css +2 -0
- package/dist/pixelium-vue-icon-hn.cjs +1 -1
- package/dist/pixelium-vue-icon-hn.css +2 -1
- package/dist/pixelium-vue-icon-hn.js +8533 -8154
- package/dist/pixelium-vue-icon-hn.umd.cjs +1 -1
- package/dist/pixelium-vue-icon-pa.cjs +1 -1
- package/dist/pixelium-vue-icon-pa.css +2 -1
- package/dist/pixelium-vue-icon-pa.js +10625 -10143
- package/dist/pixelium-vue-icon-pa.umd.cjs +1 -1
- package/dist/pixelium-vue.cjs +2 -2
- package/dist/pixelium-vue.css +2 -1
- package/dist/pixelium-vue.js +7407 -5854
- package/dist/pixelium-vue.umd.cjs +2 -2
- package/es/aside/index.css +1 -0
- package/es/aside/index.js +46 -151
- package/es/auto-complete/draw.d.ts +1 -1
- package/es/auto-complete/draw.js +26 -51
- package/es/auto-complete/index.css +92 -32
- package/es/auto-complete/index.d.ts +12 -15
- package/es/auto-complete/index.js +338 -400
- package/es/auto-complete/type.d.ts +25 -13
- package/es/avatar/css.js +2 -0
- package/es/avatar/draw.d.ts +2 -0
- package/es/avatar/draw.js +11 -0
- package/es/avatar/index.css +49 -0
- package/es/avatar/index.d.ts +15 -0
- package/es/avatar/index.js +110 -0
- package/es/avatar/type.d.ts +34 -0
- package/es/button/draw.d.ts +4 -4
- package/es/button/draw.js +213 -297
- package/es/button/index.css +40 -30
- package/es/button/index.d.ts +0 -4
- package/es/button/index.js +230 -256
- package/es/button/type.d.ts +3 -3
- package/es/button-group/index.css +0 -3
- package/es/button-group/index.d.ts +1 -2
- package/es/button-group/index.js +59 -31
- package/es/button-group/type.d.ts +21 -4
- package/es/checkbox/css.js +2 -0
- package/es/checkbox/draw.d.ts +4 -0
- package/es/checkbox/draw.js +46 -0
- package/es/checkbox/index.css +85 -0
- package/es/checkbox/index.d.ts +31 -0
- package/es/checkbox/index.js +206 -0
- package/es/checkbox/type.d.ts +88 -0
- package/es/checkbox-group/css.js +2 -0
- package/es/checkbox-group/index.css +20 -0
- package/es/checkbox-group/index.d.ts +23 -0
- package/es/checkbox-group/index.js +84 -0
- package/es/checkbox-group/type.d.ts +78 -0
- package/es/col/index.d.ts +2 -2
- package/es/col/index.js +43 -58
- package/es/container/index.css +1 -0
- package/es/container/index.js +18 -31
- package/es/divider/index.js +39 -53
- package/es/empty/index.css +4 -4
- package/es/empty/index.js +16 -71
- package/es/entry.js +102 -0
- package/es/footer/index.css +1 -0
- package/es/footer/index.js +31 -40
- package/es/form/css.js +1 -0
- package/es/form/index.d.ts +27 -0
- package/es/form/index.js +125 -0
- package/es/form/type.d.ts +238 -0
- package/es/form/use-form.d.ts +4 -0
- package/es/form/use-form.js +48 -0
- package/es/form-item/css.js +2 -0
- package/es/form-item/index.css +77 -0
- package/es/form-item/index.d.ts +37 -0
- package/es/form-item/index.js +318 -0
- package/es/form-item/type.d.ts +96 -0
- package/es/grid/index.js +56 -75
- package/es/grid-item/css.js +0 -1
- package/es/grid-item/index.d.ts +1 -1
- package/es/grid-item/index.js +85 -121
- package/es/header/index.css +1 -0
- package/es/header/index.js +31 -40
- package/es/icon/index.js +44 -55
- package/es/icons/css-hn.js +0 -1
- package/es/icons/css-pa.js +0 -1
- package/es/icons/icon-hn.js +10337 -15986
- package/es/icons/icon-pa.js +12573 -17447
- package/es/image/css.js +2 -0
- package/es/image/index.css +69 -0
- package/es/image/index.d.ts +35 -0
- package/es/image/index.js +199 -0
- package/es/image/type.d.ts +126 -0
- package/es/index.css +1 -515
- package/es/index.d.ts +22 -2
- package/es/index.js +144 -123
- package/es/input/draw.d.ts +1 -1
- package/es/input/draw.js +26 -51
- package/es/input/index.css +85 -33
- package/es/input/index.d.ts +9 -16
- package/es/input/index.js +319 -423
- package/es/input/type.d.ts +3 -3
- package/es/input-group/index.css +0 -1
- package/es/input-group/index.d.ts +2 -2
- package/es/input-group/index.js +66 -37
- package/es/input-group/type.d.ts +16 -4
- package/es/input-group-label/draw.d.ts +1 -1
- package/es/input-group-label/draw.js +26 -51
- package/es/input-group-label/index.css +33 -22
- package/es/input-group-label/index.d.ts +1 -4
- package/es/input-group-label/index.js +104 -127
- package/es/input-group-label/type.d.ts +3 -3
- package/es/input-number/draw.d.ts +1 -1
- package/es/input-number/draw.js +26 -51
- package/es/input-number/index.css +90 -35
- package/es/input-number/index.d.ts +9 -16
- package/es/input-number/index.js +428 -536
- package/es/input-number/type.d.ts +3 -3
- package/es/input-tag/draw.d.ts +1 -1
- package/es/input-tag/draw.js +26 -48
- package/es/input-tag/index.css +100 -33
- package/es/input-tag/index.d.ts +7 -13
- package/es/input-tag/index.js +442 -467
- package/es/input-tag/type.d.ts +24 -13
- package/es/link/index.js +75 -106
- package/es/main/index.css +4 -0
- package/es/main/index.d.ts +4 -1
- package/es/main/index.js +15 -15
- package/es/main/type.d.ts +7 -0
- package/es/mask/index.js +94 -115
- package/es/message/index.css +1 -1
- package/es/message/index.js +168 -346
- package/es/message-box/css.js +1 -1
- package/es/message-box/index.js +98 -114
- package/es/message-box/message-box-wrapped.js +33 -46
- package/es/message-box/message-box.js +79 -111
- package/es/option-list/index.css +13 -13
- package/es/option-list/index.d.ts +4 -31
- package/es/option-list/index.js +99 -167
- package/es/option-list/type.d.ts +5 -1
- package/es/pixelate/pixel.d.ts +5 -0
- package/es/pixelate/pixel.js +70 -0
- package/es/pixelate/pixelate.worker.d.ts +1 -0
- package/es/popover/index.d.ts +13 -99
- package/es/popover/index.js +75 -238
- package/es/popover/type.d.ts +7 -2
- package/es/popup/css.js +1 -0
- package/es/popup/index.d.ts +210 -0
- package/es/popup/index.js +203 -0
- package/es/popup/type.d.ts +105 -0
- package/es/popup-content/draw.d.ts +2 -2
- package/es/popup-content/draw.js +98 -143
- package/es/popup-content/index.css +11 -11
- package/es/popup-content/index.d.ts +1 -0
- package/es/popup-content/index.js +253 -1576
- package/es/popup-content/type.d.ts +1 -0
- package/es/popup-trigger/index.d.ts +8 -2
- package/es/popup-trigger/index.js +122 -95
- package/es/popup-trigger/type.d.ts +4 -1
- package/es/popup-wrapper/css.js +2 -0
- package/es/popup-wrapper/index.css +14 -0
- package/es/popup-wrapper/index.d.ts +18 -0
- package/es/popup-wrapper/index.js +67 -0
- package/es/popup-wrapper/type.d.ts +9 -0
- package/es/radio/css.js +1 -0
- package/es/radio/draw.d.ts +4 -0
- package/es/radio/draw.js +47 -0
- package/es/radio/index.d.ts +30 -0
- package/es/radio/index.js +190 -0
- package/es/radio/style.css +73 -0
- package/es/radio/type.d.ts +76 -0
- package/es/radio-group/css.js +2 -0
- package/es/radio-group/index.css +20 -0
- package/es/radio-group/index.d.ts +23 -0
- package/es/radio-group/index.js +77 -0
- package/es/radio-group/type.d.ts +77 -0
- package/es/row/index.js +56 -70
- package/es/select/draw.d.ts +1 -1
- package/es/select/draw.js +26 -51
- package/es/select/index.css +118 -36
- package/es/select/index.d.ts +14 -16
- package/es/select/index.js +625 -675
- package/es/select/type.d.ts +60 -25
- package/es/share/const/event-bus-key.js +1 -6
- package/es/share/const/index.d.ts +4 -0
- package/es/share/const/index.js +22 -24
- package/es/share/const/provide-key.d.ts +5 -0
- package/es/share/const/provide-key.js +6 -5
- package/es/share/const/style.d.ts +6 -0
- package/es/share/const/style.js +7 -0
- package/es/share/hook/use-cancelable-delay.d.ts +1 -0
- package/es/share/hook/use-cancelable-delay.js +42 -0
- package/es/share/hook/use-click-outside-listener.d.ts +1 -1
- package/es/share/hook/use-click-outside-listener.js +28 -41
- package/es/share/hook/use-composition.js +17 -15
- package/es/share/hook/use-controlled-mode.d.ts +3 -3
- package/es/share/hook/use-controlled-mode.js +20 -23
- package/es/share/hook/use-dark-mode.js +51 -65
- package/es/share/hook/use-index-of-children.d.ts +2 -1
- package/es/share/hook/use-index-of-children.js +47 -45
- package/es/share/hook/use-lazy-load.d.ts +10 -0
- package/es/share/hook/use-lazy-load.js +133 -0
- package/es/share/hook/use-props-detect.d.ts +2 -0
- package/es/share/hook/use-resize-observer.d.ts +1 -2
- package/es/share/hook/use-resize-observer.js +28 -20
- package/es/share/hook/use-screen-width.js +27 -36
- package/es/share/hook/use-smooth-transition.d.ts +2 -0
- package/es/share/hook/use-smooth-transition.js +65 -0
- package/es/share/hook/use-textarea-height.js +86 -92
- package/es/share/hook/use-theme-mode.js +41 -42
- package/es/share/hook/use-transition-end.d.ts +2 -0
- package/es/share/hook/use-transition-end.js +12 -0
- package/es/share/hook/use-watch-global-css-var.js +12 -16
- package/es/share/hook/use-window-resize-listener.d.ts +1 -0
- package/es/share/hook/use-window-resize-listener.js +15 -0
- package/es/share/hook/use-z-index.js +30 -27
- package/es/share/style/index.css +5 -0
- package/es/share/type/index.d.ts +18 -3
- package/es/share/util/color.d.ts +5 -3
- package/es/share/util/color.js +156 -149
- package/es/share/util/common.d.ts +7 -2
- package/es/share/util/common.js +127 -65
- package/es/share/util/console.d.ts +3 -3
- package/es/share/util/console.js +10 -7
- package/es/share/util/dom.d.ts +19 -0
- package/es/share/util/dom.js +88 -0
- package/es/share/util/env.d.ts +1 -0
- package/es/share/util/env.js +5 -4
- package/es/share/util/event-bus.js +3 -20
- package/es/share/util/lru-cache.js +29 -33
- package/es/share/util/pixel.d.ts +4 -0
- package/es/share/util/plot.d.ts +8 -3
- package/es/share/util/plot.js +457 -229
- package/es/share/util/reactivity.d.ts +8 -0
- package/es/share/util/reactivity.js +23 -0
- package/es/share/util/render.js +31 -41
- package/es/share/util/theme.d.ts +3 -0
- package/es/share/util/theme.js +77 -57
- package/es/slider/css.js +2 -0
- package/es/slider/draw.d.ts +25 -0
- package/es/slider/draw.js +113 -0
- package/es/slider/index.css +119 -0
- package/es/slider/index.d.ts +66 -0
- package/es/slider/index.js +503 -0
- package/es/slider/type.d.ts +162 -0
- package/es/slider/util.d.ts +37 -0
- package/es/slider/util.js +130 -0
- package/es/space/index.css +24 -29
- package/es/space/index.js +73 -97
- package/es/spin/index.css +18 -17
- package/es/spin/index.js +72 -102
- package/es/spin/type.d.ts +11 -5
- package/es/switch/css.js +2 -0
- package/es/switch/draw.d.ts +2 -0
- package/es/switch/draw.js +18 -0
- package/es/switch/index.css +121 -0
- package/es/switch/index.d.ts +42 -0
- package/es/switch/index.js +259 -0
- package/es/switch/type.d.ts +133 -0
- package/es/tag/draw.d.ts +2 -2
- package/es/tag/draw.js +80 -127
- package/es/tag/index.css +38 -22
- package/es/tag/index.d.ts +2 -2
- package/es/tag/index.js +121 -190
- package/es/tag/type.d.ts +3 -3
- package/es/text-outline/css.js +2 -0
- package/es/text-outline/index.css +4 -0
- package/es/text-outline/index.d.ts +17 -0
- package/es/text-outline/index.js +33 -0
- package/es/text-outline/type.d.ts +23 -0
- package/es/textarea/draw.js +9 -11
- package/es/textarea/index.css +37 -23
- package/es/textarea/index.d.ts +8 -14
- package/es/textarea/index.js +274 -262
- package/es/tooltip/index.d.ts +100 -4
- package/es/tooltip/index.js +70 -226
- package/es/tooltip/type.d.ts +7 -2
- package/es/vendor.js +504 -0
- package/es/virtual-list/css.js +2 -0
- package/es/virtual-list/index.css +25 -0
- package/es/virtual-list/index.d.ts +11 -0
- package/es/virtual-list/index.js +313 -0
- package/es/virtual-list/type.d.ts +26 -0
- package/package.json +10 -16
- package/es/grid-item/index.css +0 -0
- /package/es/message-box/{message-box.css → index.css} +0 -0
package/es/button/draw.js
CHANGED
|
@@ -1,308 +1,224 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { l as TRANSPARENT_RGBA_COLOR_OBJECT } from "../share/const/index.js";
|
|
2
|
+
import { a as drawCircle, r as calcWhenLeaveBaseline } from "../share/util/plot.js";
|
|
3
|
+
import { a as rgbaColor2string, n as getGlobalThemeColor } from "../share/util/color.js";
|
|
4
4
|
function getBackgroundColor(disabled, loading, type, theme = "primary", palette, hoverFlag, activeFlag) {
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
default:
|
|
60
|
-
if (disabled) return getGlobalThemeColor("neutral", 1);
|
|
61
|
-
if (activeFlag) return getGlobalThemeColor("neutral", 3);
|
|
62
|
-
if (hoverFlag && !loading) return getGlobalThemeColor("neutral", 2);
|
|
63
|
-
return getGlobalThemeColor("neutral", 1);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
5
|
+
if (palette) switch (type) {
|
|
6
|
+
case "text":
|
|
7
|
+
if (disabled) return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
8
|
+
if (activeFlag) return palette[1];
|
|
9
|
+
if (hoverFlag && !loading) return palette[0];
|
|
10
|
+
return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
11
|
+
case "outline": return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
12
|
+
case "plain":
|
|
13
|
+
if (disabled) return palette[0];
|
|
14
|
+
if (activeFlag) return palette[2];
|
|
15
|
+
if (hoverFlag && !loading) return palette[1];
|
|
16
|
+
return palette[0];
|
|
17
|
+
default:
|
|
18
|
+
if (disabled) return palette[1];
|
|
19
|
+
if (activeFlag) return palette[5];
|
|
20
|
+
if (hoverFlag && !loading) return palette[4];
|
|
21
|
+
return palette[5];
|
|
22
|
+
}
|
|
23
|
+
else if (theme !== "info") switch (type) {
|
|
24
|
+
case "text":
|
|
25
|
+
if (disabled) return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
26
|
+
if (activeFlag) return getGlobalThemeColor(theme, 2);
|
|
27
|
+
if (hoverFlag && !loading) return getGlobalThemeColor(theme, 1);
|
|
28
|
+
return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
29
|
+
case "outline": return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
30
|
+
case "plain":
|
|
31
|
+
if (disabled) return getGlobalThemeColor(theme, 1);
|
|
32
|
+
if (activeFlag) return getGlobalThemeColor(theme, 3);
|
|
33
|
+
if (hoverFlag && !loading) return getGlobalThemeColor(theme, 2);
|
|
34
|
+
return getGlobalThemeColor(theme, 1);
|
|
35
|
+
default:
|
|
36
|
+
if (disabled) return getGlobalThemeColor(theme, 2);
|
|
37
|
+
if (activeFlag) return getGlobalThemeColor(theme, 6);
|
|
38
|
+
if (hoverFlag && !loading) return getGlobalThemeColor(theme, 5);
|
|
39
|
+
return getGlobalThemeColor(theme, 6);
|
|
40
|
+
}
|
|
41
|
+
else switch (type) {
|
|
42
|
+
case "outline": return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
43
|
+
case "text":
|
|
44
|
+
if (disabled) return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
45
|
+
if (activeFlag) return getGlobalThemeColor("neutral", 3);
|
|
46
|
+
if (hoverFlag && !loading) return getGlobalThemeColor("neutral", 2);
|
|
47
|
+
return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
48
|
+
case "plain":
|
|
49
|
+
if (disabled) return getGlobalThemeColor("neutral", 1);
|
|
50
|
+
if (activeFlag) return getGlobalThemeColor("neutral", 4);
|
|
51
|
+
if (hoverFlag && !loading) return getGlobalThemeColor("neutral", 3);
|
|
52
|
+
return getGlobalThemeColor("neutral", 1);
|
|
53
|
+
default:
|
|
54
|
+
if (disabled) return getGlobalThemeColor("neutral", 1);
|
|
55
|
+
if (activeFlag) return getGlobalThemeColor("neutral", 3);
|
|
56
|
+
if (hoverFlag && !loading) return getGlobalThemeColor("neutral", 2);
|
|
57
|
+
return getGlobalThemeColor("neutral", 1);
|
|
58
|
+
}
|
|
66
59
|
}
|
|
67
60
|
function getBorderColor(disabled, loading, type, theme = "primary", palette, hoverFlag, activeFlag) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return getGlobalThemeColor("neutral", 10);
|
|
125
|
-
}
|
|
126
|
-
return disabled ? getGlobalThemeColor("neutral", 8) : getGlobalThemeColor("neutral", 10);
|
|
127
|
-
}
|
|
61
|
+
if (palette) switch (type) {
|
|
62
|
+
case "text":
|
|
63
|
+
if (disabled) return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
64
|
+
if (activeFlag) return palette[1];
|
|
65
|
+
if (hoverFlag && !loading) return palette[0];
|
|
66
|
+
return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
67
|
+
case "plain":
|
|
68
|
+
if (disabled) return palette[1];
|
|
69
|
+
if (activeFlag) return palette[3];
|
|
70
|
+
if (hoverFlag && !loading) return palette[2];
|
|
71
|
+
return palette[1];
|
|
72
|
+
case "outline":
|
|
73
|
+
if (disabled) return palette[0];
|
|
74
|
+
if (activeFlag) return palette[6];
|
|
75
|
+
if (hoverFlag && !loading) return palette[4];
|
|
76
|
+
return palette[5];
|
|
77
|
+
default: return disabled ? getGlobalThemeColor("neutral", 8) : getGlobalThemeColor("neutral", 10);
|
|
78
|
+
}
|
|
79
|
+
else if (theme !== "info") switch (type) {
|
|
80
|
+
case "text":
|
|
81
|
+
if (disabled) return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
82
|
+
if (activeFlag) return getGlobalThemeColor(theme, 2);
|
|
83
|
+
if (hoverFlag && !loading) return getGlobalThemeColor(theme, 1);
|
|
84
|
+
return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
85
|
+
case "plain":
|
|
86
|
+
if (disabled) return getGlobalThemeColor(theme, 2);
|
|
87
|
+
if (activeFlag) return getGlobalThemeColor(theme, 4);
|
|
88
|
+
if (hoverFlag && !loading) return getGlobalThemeColor(theme, 3);
|
|
89
|
+
return getGlobalThemeColor(theme, 2);
|
|
90
|
+
case "outline":
|
|
91
|
+
if (disabled) return getGlobalThemeColor(theme, 1);
|
|
92
|
+
if (activeFlag) return getGlobalThemeColor(theme, 7);
|
|
93
|
+
if (hoverFlag && !loading) return getGlobalThemeColor(theme, 5);
|
|
94
|
+
return getGlobalThemeColor(theme, 6);
|
|
95
|
+
default: return disabled ? getGlobalThemeColor("neutral", 8) : getGlobalThemeColor("neutral", 10);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
switch (type) {
|
|
99
|
+
case "text":
|
|
100
|
+
if (disabled) return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
101
|
+
if (activeFlag) return getGlobalThemeColor("neutral", 3);
|
|
102
|
+
if (hoverFlag && !loading) return getGlobalThemeColor("neutral", 2);
|
|
103
|
+
return TRANSPARENT_RGBA_COLOR_OBJECT;
|
|
104
|
+
case "plain":
|
|
105
|
+
if (disabled) return getGlobalThemeColor("neutral", 5);
|
|
106
|
+
if (activeFlag) return getGlobalThemeColor("neutral", 9);
|
|
107
|
+
if (hoverFlag && !loading) return getGlobalThemeColor("neutral", 8);
|
|
108
|
+
return getGlobalThemeColor("neutral", 7);
|
|
109
|
+
case "outline":
|
|
110
|
+
if (disabled) return getGlobalThemeColor("neutral", 6);
|
|
111
|
+
if (activeFlag) return getGlobalThemeColor("neutral", 8);
|
|
112
|
+
if (hoverFlag && !loading) return getGlobalThemeColor("neutral", 9);
|
|
113
|
+
return getGlobalThemeColor("neutral", 10);
|
|
114
|
+
}
|
|
115
|
+
return disabled ? getGlobalThemeColor("neutral", 8) : getGlobalThemeColor("neutral", 10);
|
|
116
|
+
}
|
|
128
117
|
}
|
|
129
|
-
const drawBorder = (ctx, width, height, center, borderRadius, rad, borderColor, pixelSize, type, inner, first, last) => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
center[1][1],
|
|
153
|
-
pixelSize,
|
|
154
|
-
center[2][1] - center[1][1] + pixelSize
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
if (center[3][0] < center[2][0] + pixelSize) {
|
|
158
|
-
ctx.fillRect(
|
|
159
|
-
center[3][0],
|
|
160
|
-
height - pixelSize,
|
|
161
|
-
center[2][0] - center[3][0] + pixelSize,
|
|
162
|
-
pixelSize
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
const flag = inner && !first && type !== "text";
|
|
166
|
-
if (!flag && center[3][1] + pixelSize > center[0][1]) {
|
|
167
|
-
ctx.fillRect(0, center[0][1], pixelSize, center[3][1] - center[0][1] + pixelSize);
|
|
168
|
-
}
|
|
169
|
-
if (inner && !first && type !== "text") {
|
|
170
|
-
ctx.fillRect(pixelSize / 2, 0, pixelSize / 2, height);
|
|
171
|
-
}
|
|
172
|
-
if (inner && !last && type !== "text") {
|
|
173
|
-
ctx.fillRect(width - 2 * pixelSize - 1, 0, pixelSize, height);
|
|
174
|
-
}
|
|
118
|
+
const drawBorder = (ctx, width, height, center, borderRadius, rad, borderColor, pixelSize, type, inner, first, last, nextIsTextButton) => {
|
|
119
|
+
ctx.fillStyle = rgbaColor2string(borderColor);
|
|
120
|
+
for (let i = 0; i < 4; i++) if (borderRadius[i] > pixelSize) {
|
|
121
|
+
if (i === 1 || i === 2 ? inner && last || !inner : true) drawCircle(ctx, center[i][0], center[i][1], borderRadius[i], rad[i][0], rad[i][1], pixelSize);
|
|
122
|
+
}
|
|
123
|
+
if (center[1][0] + pixelSize > center[0][0]) {
|
|
124
|
+
let length = center[1][0] - center[0][0] + pixelSize;
|
|
125
|
+
if (inner && !last) length -= pixelSize;
|
|
126
|
+
ctx.fillRect(center[0][0], 0, length, pixelSize);
|
|
127
|
+
}
|
|
128
|
+
if (center[2][1] + pixelSize > center[1][1] && (inner && last || !inner)) ctx.fillRect(width - pixelSize, center[1][1], pixelSize, center[2][1] - center[1][1] + pixelSize);
|
|
129
|
+
if (center[3][0] < center[2][0] + pixelSize) {
|
|
130
|
+
let length = center[2][0] - center[3][0] + pixelSize;
|
|
131
|
+
if (inner && !last) length -= pixelSize;
|
|
132
|
+
ctx.fillRect(center[3][0], height - pixelSize, length, pixelSize);
|
|
133
|
+
}
|
|
134
|
+
if ((!inner || first) && center[3][1] + pixelSize > center[0][1]) ctx.fillRect(0, center[0][1], pixelSize, center[3][1] - center[0][1] + pixelSize);
|
|
135
|
+
if (inner && !first) ctx.fillRect(pixelSize / 2, 0, pixelSize / 2, height);
|
|
136
|
+
if (inner && !last) {
|
|
137
|
+
let length = pixelSize;
|
|
138
|
+
if (type === "text" || nextIsTextButton) length /= 2;
|
|
139
|
+
ctx.fillRect(width - 2 * pixelSize - 1, 0, length, height);
|
|
140
|
+
}
|
|
175
141
|
};
|
|
176
142
|
function getGradientColor(disabled, loading, theme = "primary", palette, hoverFlag, activeFlag) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
143
|
+
if (palette) {
|
|
144
|
+
if (disabled) return palette[0];
|
|
145
|
+
if (activeFlag) return palette[6];
|
|
146
|
+
if (hoverFlag && !loading) return palette[3];
|
|
147
|
+
return palette[4];
|
|
148
|
+
}
|
|
149
|
+
if (theme !== "info") {
|
|
150
|
+
if (disabled) return getGlobalThemeColor(theme, 1);
|
|
151
|
+
if (activeFlag) return getGlobalThemeColor(theme, 7);
|
|
152
|
+
if (hoverFlag && !loading) return getGlobalThemeColor(theme, 4);
|
|
153
|
+
return getGlobalThemeColor(theme, 5);
|
|
154
|
+
}
|
|
155
|
+
if (disabled) return getGlobalThemeColor("neutral", 2);
|
|
156
|
+
if (activeFlag) return getGlobalThemeColor("neutral", 5);
|
|
157
|
+
if (hoverFlag && !loading) return getGlobalThemeColor("neutral", 4);
|
|
158
|
+
return getGlobalThemeColor("neutral", 3);
|
|
193
159
|
}
|
|
194
160
|
const drawGradient = (ctx, width, height, center, borderRadius, rad, pixelSize, disabled, loading, theme = "primary", palette, inner, first, last, hoverFlag, activeFlag) => {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
center[1][1] - dxTopRight,
|
|
243
|
-
pixelSize,
|
|
244
|
-
barLenY
|
|
245
|
-
);
|
|
246
|
-
} else {
|
|
247
|
-
const barColor = getGradientColor(disabled, loading, theme, palette, hoverFlag, activeFlag);
|
|
248
|
-
ctx.fillStyle = rgbaColor2string(barColor);
|
|
249
|
-
if (borderRadius[0] > pixelSize) {
|
|
250
|
-
drawCircle(
|
|
251
|
-
ctx,
|
|
252
|
-
center[0][0] + pixelSize,
|
|
253
|
-
center[0][1],
|
|
254
|
-
borderRadius[0],
|
|
255
|
-
rad[0][0],
|
|
256
|
-
rad[0][1],
|
|
257
|
-
pixelSize
|
|
258
|
-
);
|
|
259
|
-
ctx.globalCompositeOperation = "destination-out";
|
|
260
|
-
ctx.fillRect(center[0][0] + pixelSize, 0, dxTopRight, pixelSize);
|
|
261
|
-
ctx.globalCompositeOperation = "source-over";
|
|
262
|
-
}
|
|
263
|
-
if (borderRadius[3] > pixelSize) {
|
|
264
|
-
drawCircle(
|
|
265
|
-
ctx,
|
|
266
|
-
center[3][0] + pixelSize,
|
|
267
|
-
center[3][1],
|
|
268
|
-
borderRadius[3],
|
|
269
|
-
rad[3][0],
|
|
270
|
-
rad[3][1],
|
|
271
|
-
pixelSize
|
|
272
|
-
);
|
|
273
|
-
ctx.globalCompositeOperation = "destination-out";
|
|
274
|
-
ctx.fillRect(center[3][0] + pixelSize, height - pixelSize, dxBottomRight, pixelSize);
|
|
275
|
-
ctx.globalCompositeOperation = "source-over";
|
|
276
|
-
}
|
|
277
|
-
const barLenX = center[1][0] + pixelSize - center[0][0] + dxTopRight * +innerAndLastOrNotInner + dxTopLeft * innerFlag - 1 * +!innerAndLastOrNotInner;
|
|
278
|
-
barLenX > 0 && ctx.fillRect(center[0][0] - dxTopLeft * innerFlag, pixelSize, barLenX, pixelSize);
|
|
279
|
-
const barLenY = pixelSize + center[3][1] - center[0][1] + dxBottomLeft + dxTopLeft;
|
|
280
|
-
barLenY > 0 && ctx.fillRect(pixelSize, center[0][1] - dxTopLeft, pixelSize, barLenY);
|
|
281
|
-
}
|
|
161
|
+
const dxBottomRight = calcWhenLeaveBaseline(pixelSize, borderRadius[2]);
|
|
162
|
+
const dxBottomLeft = calcWhenLeaveBaseline(pixelSize, borderRadius[3]);
|
|
163
|
+
const dxTopRight = calcWhenLeaveBaseline(pixelSize, borderRadius[1]);
|
|
164
|
+
const dxTopLeft = calcWhenLeaveBaseline(pixelSize, borderRadius[0]);
|
|
165
|
+
const innerAndFirstOrNotInner = +!(inner && !first);
|
|
166
|
+
const innerAndLastOrNotInner = +!inner || +(inner && last);
|
|
167
|
+
if (!activeFlag || disabled) {
|
|
168
|
+
const barColor = getGradientColor(disabled, loading, theme, palette, hoverFlag, activeFlag);
|
|
169
|
+
if (!barColor) return;
|
|
170
|
+
ctx.fillStyle = rgbaColor2string(barColor);
|
|
171
|
+
if (borderRadius[1] > pixelSize) {
|
|
172
|
+
drawCircle(ctx, center[1][0] - pixelSize, center[1][1], borderRadius[1], rad[1][0], rad[1][1], pixelSize);
|
|
173
|
+
ctx.globalCompositeOperation = "destination-out";
|
|
174
|
+
ctx.fillRect(center[1][0] - pixelSize, 0, dxTopLeft, pixelSize);
|
|
175
|
+
ctx.globalCompositeOperation = "source-over";
|
|
176
|
+
}
|
|
177
|
+
if (borderRadius[2] > pixelSize) {
|
|
178
|
+
drawCircle(ctx, center[2][0] - pixelSize, center[2][1], borderRadius[2], rad[2][0], rad[2][1], pixelSize);
|
|
179
|
+
ctx.globalCompositeOperation = "destination-out";
|
|
180
|
+
ctx.fillRect(center[2][0] - pixelSize, height - pixelSize, dxBottomLeft, pixelSize);
|
|
181
|
+
ctx.globalCompositeOperation = "source-over";
|
|
182
|
+
}
|
|
183
|
+
const barLenX = center[2][0] - center[3][0] + dxBottomLeft * innerAndFirstOrNotInner + dxBottomRight * innerAndLastOrNotInner - 1 * +!innerAndLastOrNotInner;
|
|
184
|
+
barLenX > 0 && ctx.fillRect(center[3][0] - dxBottomLeft * innerAndFirstOrNotInner, height - pixelSize * 2, barLenX, pixelSize);
|
|
185
|
+
const barLenY = center[2][1] + pixelSize - center[1][1] + dxTopRight + dxBottomRight;
|
|
186
|
+
barLenY > 0 && ctx.fillRect(width - pixelSize * 2 - (!last ? +inner * pixelSize * 1 : 0), center[1][1] - dxTopRight, pixelSize, barLenY);
|
|
187
|
+
} else {
|
|
188
|
+
const barColor = getGradientColor(disabled, loading, theme, palette, hoverFlag, activeFlag);
|
|
189
|
+
if (!barColor) return;
|
|
190
|
+
ctx.fillStyle = rgbaColor2string(barColor);
|
|
191
|
+
if (borderRadius[0] > pixelSize) {
|
|
192
|
+
drawCircle(ctx, center[0][0] + pixelSize, center[0][1], borderRadius[0], rad[0][0], rad[0][1], pixelSize);
|
|
193
|
+
ctx.globalCompositeOperation = "destination-out";
|
|
194
|
+
ctx.fillRect(center[0][0] + pixelSize, 0, dxTopRight, pixelSize);
|
|
195
|
+
ctx.globalCompositeOperation = "source-over";
|
|
196
|
+
}
|
|
197
|
+
if (borderRadius[3] > pixelSize) {
|
|
198
|
+
drawCircle(ctx, center[3][0] + pixelSize, center[3][1], borderRadius[3], rad[3][0], rad[3][1], pixelSize);
|
|
199
|
+
ctx.globalCompositeOperation = "destination-out";
|
|
200
|
+
ctx.fillRect(center[3][0] + pixelSize, height - pixelSize, dxBottomRight, pixelSize);
|
|
201
|
+
ctx.globalCompositeOperation = "source-over";
|
|
202
|
+
}
|
|
203
|
+
const barLenX = center[1][0] + pixelSize - center[0][0] + dxTopRight * +innerAndLastOrNotInner + dxTopLeft * innerAndFirstOrNotInner - 1 * +!innerAndLastOrNotInner;
|
|
204
|
+
barLenX > 0 && ctx.fillRect(center[0][0] - dxTopLeft * innerAndFirstOrNotInner, pixelSize, barLenX, pixelSize);
|
|
205
|
+
const barLenY = pixelSize + center[3][1] - center[0][1] + dxBottomLeft + dxTopLeft;
|
|
206
|
+
barLenY > 0 && ctx.fillRect(pixelSize, center[0][1] - dxTopLeft, pixelSize, barLenY);
|
|
207
|
+
}
|
|
282
208
|
};
|
|
283
209
|
const getTextColorWithPalette = (palette, type, disabled, loading, hoverFlag, activeFlag) => {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
return rgbaColor2string(palette[5]);
|
|
298
|
-
default:
|
|
299
|
-
return void 0;
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
export {
|
|
303
|
-
getBorderColor as a,
|
|
304
|
-
drawBorder as b,
|
|
305
|
-
getBackgroundColor as c,
|
|
306
|
-
drawGradient as d,
|
|
307
|
-
getTextColorWithPalette as g
|
|
210
|
+
if (!palette || type === "primary") return void 0;
|
|
211
|
+
if (disabled) {
|
|
212
|
+
if (type === "plain") return rgbaColor2string(palette[2]);
|
|
213
|
+
return rgbaColor2string(palette[1]);
|
|
214
|
+
}
|
|
215
|
+
if (loading) return rgbaColor2string(palette[5]);
|
|
216
|
+
if (activeFlag && type !== "plain") return rgbaColor2string(palette[6]);
|
|
217
|
+
switch (type) {
|
|
218
|
+
case "text": return rgbaColor2string(palette[5]);
|
|
219
|
+
case "outline": return hoverFlag ? rgbaColor2string(palette[4]) : rgbaColor2string(palette[5]);
|
|
220
|
+
case "plain": return rgbaColor2string(palette[5]);
|
|
221
|
+
default: return;
|
|
222
|
+
}
|
|
308
223
|
};
|
|
224
|
+
export { getTextColorWithPalette as a, getBorderColor as i, drawGradient as n, getBackgroundColor as r, drawBorder as t };
|
package/es/button/index.css
CHANGED
|
@@ -6,20 +6,12 @@
|
|
|
6
6
|
z-index: -1;
|
|
7
7
|
pointer-events: none;
|
|
8
8
|
}
|
|
9
|
-
button.px-button {
|
|
10
|
-
font-size: var(--text-size);
|
|
11
|
-
}
|
|
12
9
|
.px-button {
|
|
13
10
|
--button-size: var(--px-medium-size);
|
|
14
|
-
--px-medium-padding-x: var(--px-interval-4);
|
|
15
|
-
--px-large-padding-x: var(--px-interval-5);
|
|
16
|
-
--px-small-padding-x: var(--px-interval-3);
|
|
17
|
-
--padding-x-size: var(--px-medium-padding-x);
|
|
18
11
|
--text-color: var(--px-neutral-1);
|
|
19
|
-
--text-size: var(--px-medium-font-size);
|
|
20
12
|
height: var(--button-size);
|
|
21
|
-
padding-left:
|
|
22
|
-
padding-right:
|
|
13
|
+
padding-left: 16px;
|
|
14
|
+
padding-right: 16px;
|
|
23
15
|
background-color: transparent;
|
|
24
16
|
border-color: transparent;
|
|
25
17
|
border-width: var(--px-bit);
|
|
@@ -32,38 +24,46 @@ button.px-button {
|
|
|
32
24
|
user-select: none;
|
|
33
25
|
transition: 0.25s;
|
|
34
26
|
z-index: 0;
|
|
35
|
-
font-size: var(--text-size);
|
|
36
27
|
box-sizing: border-box;
|
|
37
28
|
}
|
|
38
|
-
.px-
|
|
39
|
-
|
|
40
|
-
padding-right: calc(var(--padding-x-size) + 1px + 1 * var(--px-bit));
|
|
29
|
+
.px-button.px-button {
|
|
30
|
+
font-size: 14px;
|
|
41
31
|
}
|
|
42
|
-
.px-button__inner
|
|
43
|
-
padding-right: var(--
|
|
32
|
+
.px-button.px-button__small.px-button__inner {
|
|
33
|
+
padding-right: calc(12px + 1px + 1 * var(--px-bit));
|
|
44
34
|
}
|
|
45
|
-
.px-
|
|
46
|
-
padding-right:
|
|
47
|
-
margin-right: calc(1px + 1 * var(--px-bit));
|
|
35
|
+
.px-button.px-button__small.px-button__inner:last-child {
|
|
36
|
+
padding-right: 12px;
|
|
48
37
|
}
|
|
49
|
-
.px-
|
|
50
|
-
|
|
38
|
+
.px-button.px-button__medium.px-button__inner {
|
|
39
|
+
padding-right: calc(16px + 1px + 1 * var(--px-bit));
|
|
40
|
+
}
|
|
41
|
+
.px-button.px-button__medium.px-button__inner:last-child {
|
|
42
|
+
padding-right: 16px;
|
|
43
|
+
}
|
|
44
|
+
.px-button.px-button__large.px-button__inner {
|
|
45
|
+
padding-right: calc(20px + 1px + 1 * var(--px-bit));
|
|
46
|
+
}
|
|
47
|
+
.px-button.px-button__large.px-button__inner:last-child {
|
|
48
|
+
padding-right: 20px;
|
|
51
49
|
}
|
|
52
50
|
.px-button__circle,
|
|
53
51
|
.px-button__square {
|
|
54
52
|
width: var(--button-size);
|
|
55
|
-
|
|
53
|
+
padding: 0px;
|
|
56
54
|
justify-content: center;
|
|
57
55
|
}
|
|
58
56
|
.px-button__large {
|
|
59
|
-
|
|
57
|
+
padding-left: 20px;
|
|
58
|
+
padding-right: 20px;
|
|
60
59
|
--button-size: var(--px-large-size);
|
|
61
|
-
|
|
60
|
+
font-size: 15px;
|
|
62
61
|
}
|
|
63
62
|
.px-button__small {
|
|
64
|
-
|
|
63
|
+
padding-left: 12px;
|
|
64
|
+
padding-right: 12px;
|
|
65
65
|
--button-size: var(--px-small-size);
|
|
66
|
-
|
|
66
|
+
font-size: 15px;
|
|
67
67
|
}
|
|
68
68
|
.px-button__loading {
|
|
69
69
|
cursor: auto;
|
|
@@ -77,16 +77,26 @@ button.px-button {
|
|
|
77
77
|
cursor: not-allowed;
|
|
78
78
|
}
|
|
79
79
|
.px-button-icon-wrapper {
|
|
80
|
-
margin-right:
|
|
80
|
+
margin-right: 8px;
|
|
81
81
|
display: flex;
|
|
82
82
|
align-items: center;
|
|
83
83
|
}
|
|
84
84
|
.px-button-icon-wrapper__last {
|
|
85
85
|
margin-right: 0;
|
|
86
86
|
}
|
|
87
|
-
.px-button-icon {
|
|
88
|
-
height:
|
|
89
|
-
width:
|
|
87
|
+
.px-button.px-button__small .px-button-icon {
|
|
88
|
+
height: 12px;
|
|
89
|
+
width: 12px;
|
|
90
|
+
fill: var(--text-color);
|
|
91
|
+
}
|
|
92
|
+
.px-button.px-button__medium .px-button-icon {
|
|
93
|
+
height: 14px;
|
|
94
|
+
width: 14px;
|
|
95
|
+
fill: var(--text-color);
|
|
96
|
+
}
|
|
97
|
+
.px-button.px-button__large .px-button-icon {
|
|
98
|
+
height: 15px;
|
|
99
|
+
width: 15px;
|
|
90
100
|
fill: var(--text-color);
|
|
91
101
|
}
|
|
92
102
|
.px-button.px-button__primary:focus-visible {
|