@tendaui/components 1.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/LICENSE +21 -0
- package/README.md +176 -0
- package/alert/Alert.tsx +147 -0
- package/alert/defaultProps.ts +3 -0
- package/alert/index.ts +9 -0
- package/alert/style/css.js +1 -0
- package/alert/style/index.js +1 -0
- package/alert/type.ts +44 -0
- package/badge/Badge.tsx +85 -0
- package/badge/defaultProps.ts +10 -0
- package/badge/index.ts +9 -0
- package/badge/style/css.js +1 -0
- package/badge/style/index.js +1 -0
- package/badge/type.ts +51 -0
- package/button/Button.tsx +95 -0
- package/button/defaultProps.ts +13 -0
- package/button/index.ts +7 -0
- package/button/style/css.js +1 -0
- package/button/style/index.js +1 -0
- package/button/type.ts +82 -0
- package/checkbox/Checkbox.tsx +19 -0
- package/checkbox/CheckboxGroup.tsx +207 -0
- package/checkbox/defaultProps.ts +14 -0
- package/checkbox/index.ts +10 -0
- package/checkbox/style/css.js +1 -0
- package/checkbox/style/index.js +1 -0
- package/checkbox/type.ts +117 -0
- package/common/Check.tsx +131 -0
- package/common/FakeArrow.tsx +36 -0
- package/common/PluginContainer.tsx +21 -0
- package/common/Portal.tsx +67 -0
- package/common.ts +76 -0
- package/config-provider/ConfigContext.tsx +21 -0
- package/config-provider/ConfigProvider.tsx +53 -0
- package/config-provider/index.ts +9 -0
- package/config-provider/type.ts +1062 -0
- package/dialog/Dialog.tsx +254 -0
- package/dialog/DialogCard.tsx +152 -0
- package/dialog/defaultProps.ts +25 -0
- package/dialog/hooks/useDialogDrag.ts +50 -0
- package/dialog/hooks/useDialogEsc.ts +31 -0
- package/dialog/hooks/useDialogPosition.ts +36 -0
- package/dialog/hooks/useLockStyle.ts +54 -0
- package/dialog/index.ts +13 -0
- package/dialog/plugin.tsx +78 -0
- package/dialog/style/css.js +1 -0
- package/dialog/style/index.js +1 -0
- package/dialog/type.ts +241 -0
- package/dialog/utils.ts +4 -0
- package/form/Form.tsx +136 -0
- package/form/FormContext.tsx +64 -0
- package/form/FormItem.tsx +554 -0
- package/form/FormList.tsx +303 -0
- package/form/const.ts +6 -0
- package/form/defaultProps.ts +26 -0
- package/form/formModel.ts +117 -0
- package/form/hooks/interface.ts +20 -0
- package/form/hooks/useForm.ts +122 -0
- package/form/hooks/useFormItemInitialData.ts +95 -0
- package/form/hooks/useFormItemStyle.tsx +122 -0
- package/form/hooks/useInstance.tsx +275 -0
- package/form/hooks/useWatch.ts +42 -0
- package/form/index.ts +11 -0
- package/form/style/css.js +1 -0
- package/form/style/index.js +1 -0
- package/form/type.ts +519 -0
- package/form/utils/index.ts +69 -0
- package/hooks/useAttach.ts +24 -0
- package/hooks/useCommonClassName.ts +45 -0
- package/hooks/useConfig.ts +3 -0
- package/hooks/useControlled.ts +39 -0
- package/hooks/useDefaultProps.ts +16 -0
- package/hooks/useDomCallback.ts +13 -0
- package/hooks/useDomRefCallback.ts +12 -0
- package/hooks/useDragSorter.tsx +151 -0
- package/hooks/useEventCallback.ts +47 -0
- package/hooks/useGlobalConfig.ts +14 -0
- package/hooks/useGlobalIcon.ts +14 -0
- package/hooks/useLastest.ts +13 -0
- package/hooks/useLayoutEffect.ts +7 -0
- package/hooks/useMouseEvent.ts +142 -0
- package/hooks/useMutationObserver.ts +56 -0
- package/hooks/usePopper.ts +189 -0
- package/hooks/useRipple.ts +0 -0
- package/hooks/useSetState.ts +25 -0
- package/hooks/useVirtualScroll.ts +246 -0
- package/hooks/useWindowSize.ts +31 -0
- package/index.ts +70 -0
- package/input/Input.tsx +383 -0
- package/input/InputGroup.tsx +29 -0
- package/input/defaultProps.ts +22 -0
- package/input/index.ts +11 -0
- package/input/style/css.js +1 -0
- package/input/style/index.js +1 -0
- package/input/type.ts +219 -0
- package/loading/Gradient.tsx +36 -0
- package/loading/Loading.tsx +169 -0
- package/loading/circleAdapter.ts +44 -0
- package/loading/defaultProps.ts +12 -0
- package/loading/index.ts +13 -0
- package/loading/style/css.js +1 -0
- package/loading/style/index.js +1 -0
- package/loading/type.ts +71 -0
- package/loading/utils/setStyle.ts +13 -0
- package/myform/index.ts +0 -0
- package/notification/Notify.ts +24 -0
- package/notification/NotifyContainer.tsx +90 -0
- package/notification/NotifyContext.tsx +173 -0
- package/notification/NotifyItem.tsx +121 -0
- package/notification/index.ts +3 -0
- package/notification/style/css.js +1 -0
- package/notification/style/index.js +1 -0
- package/notification/type.ts +23 -0
- package/package.json +52 -0
- package/popup/Popup.tsx +264 -0
- package/popup/defaultProps.ts +13 -0
- package/popup/hooks/useTrigger.ts +276 -0
- package/popup/index.ts +6 -0
- package/popup/style/css.js +1 -0
- package/popup/style/index.js +1 -0
- package/popup/type.ts +130 -0
- package/portal/Portal.tsx +63 -0
- package/portal/index.ts +1 -0
- package/select/Option.tsx +162 -0
- package/select/OptionGroup.tsx +30 -0
- package/select/PopupContent.tsx +271 -0
- package/select/Select.tsx +586 -0
- package/select/defaultProps.ts +27 -0
- package/select/hooks/useOptions.ts +120 -0
- package/select/hooks/usePanelVirtualScroll.ts +111 -0
- package/select/index.ts +9 -0
- package/select/style/css.js +1 -0
- package/select/style/index.js +2 -0
- package/select/type.ts +382 -0
- package/select/utils/helper.ts +256 -0
- package/select-input/SelectInput.tsx +98 -0
- package/select-input/defaultProps.ts +15 -0
- package/select-input/hook/useMultiple.tsx +100 -0
- package/select-input/hook/useOverlayInnerStyle.ts +84 -0
- package/select-input/hook/useSingle.tsx +112 -0
- package/select-input/index.ts +6 -0
- package/select-input/interface.ts +18 -0
- package/select-input/style/css.js +1 -0
- package/select-input/style/index.js +1 -0
- package/select-input/type.ts +280 -0
- package/space/defaultProps.ts +0 -0
- package/space/index.ts +0 -0
- package/space/type.ts +0 -0
- package/style/index.js +2 -0
- package/styles/_global.scss +39 -0
- package/styles/_vars.scss +386 -0
- package/styles/components/alert/_index.scss +175 -0
- package/styles/components/alert/_vars.scss +39 -0
- package/styles/components/badge/_index.scss +70 -0
- package/styles/components/badge/_vars.scss +25 -0
- package/styles/components/button/_index.scss +511 -0
- package/styles/components/button/_mixins.scss +39 -0
- package/styles/components/button/_vars.scss +122 -0
- package/styles/components/checkbox/_index.scss +158 -0
- package/styles/components/checkbox/_mixin.scss +0 -0
- package/styles/components/checkbox/_var.scss +60 -0
- package/styles/components/dialog/_animate.scss +135 -0
- package/styles/components/dialog/_index.scss +311 -0
- package/styles/components/dialog/_mixins.scss +0 -0
- package/styles/components/dialog/_vars.scss +59 -0
- package/styles/components/form/_index.scss +174 -0
- package/styles/components/form/_mixins.scss +76 -0
- package/styles/components/form/_vars.scss +100 -0
- package/styles/components/input/_index.scss +349 -0
- package/styles/components/input/_map.scss +0 -0
- package/styles/components/input/_mixins.scss +116 -0
- package/styles/components/input/_vars.scss +134 -0
- package/styles/components/loading/_index.scss +112 -0
- package/styles/components/loading/_vars.scss +39 -0
- package/styles/components/notification/_index.scss +160 -0
- package/styles/components/notification/_mixins.scss +12 -0
- package/styles/components/notification/_vars.scss +59 -0
- package/styles/components/popup/_index.scss +82 -0
- package/styles/components/popup/_mixin.scss +149 -0
- package/styles/components/popup/_var.scss +31 -0
- package/styles/components/select/_index.scss +290 -0
- package/styles/components/select/_var.scss +65 -0
- package/styles/components/select-input/_index.scss +5 -0
- package/styles/components/select-input/_var.scss +3 -0
- package/styles/components/switch/_index.scss +279 -0
- package/styles/components/switch/_mixins.scss +0 -0
- package/styles/components/switch/_vars.scss +61 -0
- package/styles/components/tag/_index.scss +316 -0
- package/styles/components/tag/_var.scss +85 -0
- package/styles/components/tag-input/_index.scss +163 -0
- package/styles/components/tag-input/_vars.scss +16 -0
- package/styles/globals.css +250 -0
- package/styles/mixins/_focus.scss +7 -0
- package/styles/mixins/_layout.scss +32 -0
- package/styles/mixins/_reset.scss +10 -0
- package/styles/mixins/_scrollbar.scss +31 -0
- package/styles/mixins/_text.scss +48 -0
- package/styles/rillple.css +16 -0
- package/styles/scrollbar.css +42 -0
- package/styles/themes/_dark.scss +191 -0
- package/styles/themes/_font.scss +79 -0
- package/styles/themes/_index.scss +5 -0
- package/styles/themes/_light.scss +190 -0
- package/styles/themes/_radius.scss +9 -0
- package/styles/themes/_size.scss +68 -0
- package/styles/themes.css +66 -0
- package/styles/utilities/_animation.scss +57 -0
- package/styles/utilities/_tips.scss +9 -0
- package/switch/Switch.tsx +120 -0
- package/switch/defaultProps.ts +3 -0
- package/switch/index.ts +7 -0
- package/switch/style/css.js +1 -0
- package/switch/style/index.js +1 -0
- package/switch/type.ts +46 -0
- package/tag/Tag.tsx +149 -0
- package/tag/defaultProps.ts +19 -0
- package/tag/index.ts +8 -0
- package/tag/style/css.js +1 -0
- package/tag/style/index.js +1 -0
- package/tag/type.ts +170 -0
- package/tag-input/TagInput.tsx +215 -0
- package/tag-input/defaultProps.ts +15 -0
- package/tag-input/hooks/useHover.ts +28 -0
- package/tag-input/hooks/useTagList.tsx +131 -0
- package/tag-input/hooks/useTagScroll.ts +105 -0
- package/tag-input/index.ts +9 -0
- package/tag-input/style/css.js +1 -0
- package/tag-input/style/index.js +1 -0
- package/tag-input/type.ts +224 -0
- package/tag-input/useTagList.tsx +131 -0
- package/utils/composeRefs.ts +14 -0
- package/utils/dom.ts +29 -0
- package/utils/forwardRefWithStatics.ts +12 -0
- package/utils/getScrollbarWidth.ts +11 -0
- package/utils/helper.ts +161 -0
- package/utils/isFragment.ts +22 -0
- package/utils/listener.ts +37 -0
- package/utils/noop.ts +3 -0
- package/utils/parentTNode.ts +38 -0
- package/utils/parseTNode.ts +38 -0
- package/utils/react-render.ts +108 -0
- package/utils/ref.ts +6 -0
- package/utils/refs.ts +81 -0
- package/utils/style.ts +60 -0
- package/utils/transition.ts +28 -0
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@import '../../vars.scss';
|
|
3
|
+
|
|
4
|
+
@import './_vars.scss';
|
|
5
|
+
|
|
6
|
+
@import './_mixins.scss';
|
|
7
|
+
|
|
8
|
+
@import '../../mixins/_reset.scss';
|
|
9
|
+
|
|
10
|
+
@function btn-color($theme, $state: default) {
|
|
11
|
+
$theme-map: map.get($btn-colors, $theme);
|
|
12
|
+
|
|
13
|
+
@if $theme-map == null {
|
|
14
|
+
@error "Theme `#{$theme}` not found in $btn-colors map.";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@return map.get($theme-map, $state);
|
|
18
|
+
}
|
|
19
|
+
@mixin button-attr-color($theme, $attr, $ghost: false) {
|
|
20
|
+
&:hover,
|
|
21
|
+
&:focus-visible {
|
|
22
|
+
#{$attr}: btn-color($theme, hover);
|
|
23
|
+
}
|
|
24
|
+
@if $ghost == true {
|
|
25
|
+
&:active {
|
|
26
|
+
#{$attr}: btn-color($theme, active);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@if $ghost == true {
|
|
31
|
+
&.#{$prefix}-is-loading {
|
|
32
|
+
#{$attr}: btn-color($theme, 'default');
|
|
33
|
+
}
|
|
34
|
+
} @else {
|
|
35
|
+
&.#{$prefix}-is-loading {
|
|
36
|
+
#{$attr}: btn-color($theme, 'disabled');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@if $ghost == true {
|
|
41
|
+
#{$attr}: btn-color('ghost', 'disabled');
|
|
42
|
+
background-color: transparent;
|
|
43
|
+
} @else {
|
|
44
|
+
#{$attr}: btn-color($theme, disabled);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
#{$attr}: btn-color($theme, default);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.#{$prefix}-button {
|
|
51
|
+
@include reset;
|
|
52
|
+
@include button;
|
|
53
|
+
|
|
54
|
+
text-decoration: none;
|
|
55
|
+
|
|
56
|
+
.#{$prefix}-button__text,
|
|
57
|
+
.t-icon {
|
|
58
|
+
position: relative;
|
|
59
|
+
z-index: 1;
|
|
60
|
+
display: inline-flex;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.t-icon {
|
|
64
|
+
font-size: $btn-icon-size-default;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.#{$prefix}-loading {
|
|
68
|
+
font-size: $btn-loading-size;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.t-icon + .#{$prefix}-button__text:not(:empty) {
|
|
72
|
+
margin-left: $btn-icon-text-margin-left;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.#{$prefix}-loading + .#{$prefix}-button__text:not(:empty) {
|
|
76
|
+
margin-left: $btn-icon-text-margin-left;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.#{$prefix}-button__suffix:not(:empty) {
|
|
80
|
+
display: inline-flex;
|
|
81
|
+
margin-left: $btn-icon-text-margin-left;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 主要按钮
|
|
85
|
+
&--variant-base {
|
|
86
|
+
color: $btn-text-variant-base-color;
|
|
87
|
+
@include button-size(
|
|
88
|
+
$btn-height-default,
|
|
89
|
+
$btn-font-default,
|
|
90
|
+
$btn-icon-size-default,
|
|
91
|
+
$btn-padding-horizontal-default
|
|
92
|
+
);
|
|
93
|
+
@include button-attr-color('gray-bg', background-color);
|
|
94
|
+
@include button-attr-color('gray-bg', border-color);
|
|
95
|
+
@include button-attr-color('text-gray', color);
|
|
96
|
+
|
|
97
|
+
&.#{$prefix}-button--theme-primary {
|
|
98
|
+
color: $btn-text-variant-base-color;
|
|
99
|
+
@include button-attr-color('primary', background-color);
|
|
100
|
+
@include button-attr-color('primary', border-color);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&.#{$prefix}-button--theme-success {
|
|
104
|
+
color: $btn-text-variant-base-color;
|
|
105
|
+
@include button-attr-color('success', background-color);
|
|
106
|
+
@include button-attr-color('success', border-color);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&.#{$prefix}-button--theme-warning {
|
|
110
|
+
color: $btn-text-variant-base-color;
|
|
111
|
+
@include button-attr-color('warning', background-color);
|
|
112
|
+
@include button-attr-color('warning', border-color);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&.#{$prefix}-button--theme-danger {
|
|
116
|
+
color: $btn-text-variant-base-color;
|
|
117
|
+
@include button-attr-color('danger', background-color);
|
|
118
|
+
@include button-attr-color('danger', border-color);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&.#{$prefix}-button--ghost {
|
|
122
|
+
@include button-attr-color('primary', background-color, true);
|
|
123
|
+
@include button-attr-color('white-ghost', color, true);
|
|
124
|
+
@include button-attr-color('white-ghost', border-color, true);
|
|
125
|
+
|
|
126
|
+
&.#{$prefix}-button--theme-primary {
|
|
127
|
+
@include button-attr-color('primary', color, true);
|
|
128
|
+
@include button-attr-color('primary', border-color, true);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&.#{$prefix}-button--theme-success {
|
|
132
|
+
@include button-attr-color('success', color, true);
|
|
133
|
+
@include button-attr-color('success', border-color, true);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&.#{$prefix}-button--theme-warning {
|
|
137
|
+
@include button-attr-color('warning', color, true);
|
|
138
|
+
@include button-attr-color('warning', border-color, true);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&.#{$prefix}-button--theme-danger {
|
|
142
|
+
@include button-attr-color('danger', color, true);
|
|
143
|
+
@include button-attr-color('danger', border-color, true);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&.#{$prefix}-is-loading:not(&.#{$prefix}-button--ghost) {
|
|
148
|
+
&.#{$prefix}-button--theme-default {
|
|
149
|
+
color: btn-color(text, default);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// 次要按钮
|
|
155
|
+
&--variant-outline {
|
|
156
|
+
@include button-size(
|
|
157
|
+
$btn-height-default,
|
|
158
|
+
$btn-font-default,
|
|
159
|
+
$btn-icon-size-default,
|
|
160
|
+
$btn-padding-horizontal-default
|
|
161
|
+
);
|
|
162
|
+
@include button-attr-color('text', color);
|
|
163
|
+
|
|
164
|
+
@include button-attr-color('white-bg', background-color);
|
|
165
|
+
@include button-attr-color('border-gray', border-color);
|
|
166
|
+
|
|
167
|
+
&.#{$prefix}-button--theme-primary {
|
|
168
|
+
@include button-attr-color('primary', color);
|
|
169
|
+
@include button-attr-color('primary', border-color);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&.#{$prefix}-button--theme-success {
|
|
173
|
+
@include button-attr-color('success', color);
|
|
174
|
+
@include button-attr-color('success', border-color);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&.#{$prefix}-button--theme-warning {
|
|
178
|
+
@include button-attr-color('warning', color);
|
|
179
|
+
@include button-attr-color('warning', border-color);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&.#{$prefix}-button--theme-danger {
|
|
183
|
+
@include button-attr-color('danger', color);
|
|
184
|
+
@include button-attr-color('danger', border-color);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&.#{$prefix}-button--ghost {
|
|
188
|
+
@include button-attr-color('none', background-color, true);
|
|
189
|
+
@include button-attr-color('white-ghost', color, true);
|
|
190
|
+
@include button-attr-color('white-ghost', border-color, true);
|
|
191
|
+
|
|
192
|
+
&.#{$prefix}-button--theme-primary {
|
|
193
|
+
@include button-attr-color('primary', color, true);
|
|
194
|
+
@include button-attr-color('primary', border-color, true);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
&.#{$prefix}-button--theme-success {
|
|
198
|
+
@include button-attr-color('success', color, true);
|
|
199
|
+
@include button-attr-color('success', border-color, true);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&.#{$prefix}-button--theme-warning {
|
|
203
|
+
@include button-attr-color('warning', color, true);
|
|
204
|
+
@include button-attr-color('warning', border-color, true);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
&.#{$prefix}-button--theme-danger {
|
|
208
|
+
@include button-attr-color('danger', color, true);
|
|
209
|
+
@include button-attr-color('danger', border-color, true);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
&.#{$prefix}-is-loading:not(&.#{$prefix}-button--ghost) {
|
|
214
|
+
color: btn-color(text, default);
|
|
215
|
+
|
|
216
|
+
&.#{$prefix}-button--theme-primary {
|
|
217
|
+
color: btn-color(primary, default);
|
|
218
|
+
background-color: btn-color(text-bg, default);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
&.#{$prefix}-button--theme-success {
|
|
222
|
+
color: btn-color(success, default);
|
|
223
|
+
background-color: btn-color(text-bg, default);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&.#{$prefix}-button--theme-warning {
|
|
227
|
+
color: btn-color(warning, default);
|
|
228
|
+
background-color: btn-color(text-bg, default);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
&.#{$prefix}-button--theme-danger {
|
|
232
|
+
color: btn-color(danger, default);
|
|
233
|
+
background-color: btn-color(text-bg, default);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// 虚线按钮
|
|
239
|
+
&--variant-dashed {
|
|
240
|
+
@include button-size(
|
|
241
|
+
$btn-height-default,
|
|
242
|
+
$btn-font-default,
|
|
243
|
+
$btn-icon-size-default,
|
|
244
|
+
$btn-padding-horizontal-default
|
|
245
|
+
);
|
|
246
|
+
@include button-attr-color(text, color);
|
|
247
|
+
@include button-attr-color(white-bg, background-color);
|
|
248
|
+
@include button-attr-color(border-gray, border-color);
|
|
249
|
+
|
|
250
|
+
border-style: dashed;
|
|
251
|
+
|
|
252
|
+
&.#{$prefix}-button--theme-primary {
|
|
253
|
+
@include button-attr-color('primary', color);
|
|
254
|
+
@include button-attr-color('primary', border-color);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
&.#{$prefix}-button--theme-success {
|
|
258
|
+
@include button-attr-color('success', color);
|
|
259
|
+
@include button-attr-color('success', border-color);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
&.#{$prefix}-button--theme-warning {
|
|
263
|
+
@include button-attr-color('warning', color);
|
|
264
|
+
@include button-attr-color('warning', border-color);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
&.#{$prefix}-button--theme-danger {
|
|
268
|
+
@include button-attr-color('danger', color);
|
|
269
|
+
@include button-attr-color('danger', border-color);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
&.#{$prefix}-button--ghost {
|
|
273
|
+
@include button-attr-color('none', background-color, true);
|
|
274
|
+
@include button-attr-color('white-ghost', color, true);
|
|
275
|
+
@include button-attr-color('white-ghost', border-color, true);
|
|
276
|
+
|
|
277
|
+
&.#{$prefix}-button--theme-primary {
|
|
278
|
+
@include button-attr-color('primary', color, true);
|
|
279
|
+
@include button-attr-color('primary', border-color, true);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
&.#{$prefix}-button--theme-success {
|
|
283
|
+
@include button-attr-color('success', color, true);
|
|
284
|
+
@include button-attr-color('success', border-color, true);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
&.#{$prefix}-button--theme-warning {
|
|
288
|
+
@include button-attr-color('warning', color, true);
|
|
289
|
+
@include button-attr-color('warning', border-color, true);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
&.#{$prefix}-button--theme-danger {
|
|
293
|
+
@include button-attr-color('danger', color, true);
|
|
294
|
+
@include button-attr-color('danger', border-color, true);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
&.#{$prefix}-is-loading:not(&.#{$prefix}-button--ghost) {
|
|
298
|
+
color: btn-color(text, default);
|
|
299
|
+
|
|
300
|
+
&.#{$prefix}-button--theme-primary {
|
|
301
|
+
color: btn-color(primary, default);
|
|
302
|
+
background-color: btn-color(text-bg, default);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
&.#{$prefix}-button--theme-success {
|
|
306
|
+
color: btn-color(success, default);
|
|
307
|
+
background-color: btn-color(text-bg, default);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
&.#{$prefix}-button--theme-warning {
|
|
311
|
+
color: btn-color(warning, default);
|
|
312
|
+
background-color: btn-color(text-bg, default);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
&.#{$prefix}-button--theme-danger {
|
|
316
|
+
color: btn-color(danger, default);
|
|
317
|
+
background-color: btn-color(text-bg, default);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// 文字按钮
|
|
323
|
+
&--variant-text {
|
|
324
|
+
@include button-size(
|
|
325
|
+
$btn-height-default,
|
|
326
|
+
$btn-font-default,
|
|
327
|
+
$btn-icon-size-default,
|
|
328
|
+
$btn-padding-horizontal-default
|
|
329
|
+
);
|
|
330
|
+
@include button-attr-color('text-gray', color);
|
|
331
|
+
@include button-attr-color('text-bg', background-color);
|
|
332
|
+
@include button-attr-color('text-bg', border-color);
|
|
333
|
+
|
|
334
|
+
&.#{$prefix}-button--theme-primary {
|
|
335
|
+
@include button-attr-color('primary', color);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
&.#{$prefix}-button--theme-success {
|
|
339
|
+
@include button-attr-color('success', color);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
&.#{$prefix}-button--theme-warning {
|
|
343
|
+
@include button-attr-color('warning', color);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
&.#{$prefix}-button--theme-danger {
|
|
347
|
+
@include button-attr-color('danger', color);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
&.#{$prefix}-button--ghost {
|
|
351
|
+
background: none;
|
|
352
|
+
|
|
353
|
+
@include button-attr-color('white-ghost', color, true);
|
|
354
|
+
|
|
355
|
+
&.#{$prefix}-button--theme-primary {
|
|
356
|
+
@include button-attr-color('primary', color, true);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
&.#{$prefix}-button--theme-success {
|
|
360
|
+
@include button-attr-color('success', color, true);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
&.#{$prefix}-button--theme-warning {
|
|
364
|
+
@include button-attr-color('warning', color, true);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
&.#{$prefix}-button--theme-danger {
|
|
368
|
+
@include button-attr-color('danger', color, true);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
&.#{$prefix}-is-loading:not(&.#{$prefix}-button--ghost) {
|
|
373
|
+
color: btn-color(text, default);
|
|
374
|
+
|
|
375
|
+
&.#{$prefix}-button--theme-primary {
|
|
376
|
+
color: btn-color(primary, default);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
&.#{$prefix}-button--theme-success {
|
|
380
|
+
color: btn-color(success, default);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
&.#{$prefix}-button--theme-warning {
|
|
384
|
+
color: btn-color(warning, default);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
&.#{$prefix}-button--theme-danger {
|
|
388
|
+
color: btn-color(danger, default);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
&.#{$prefix}-is-loading,
|
|
394
|
+
&.#{$prefix}-is-disabled {
|
|
395
|
+
cursor: not-allowed;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
&.#{$prefix}-size-s {
|
|
399
|
+
@include button-size(
|
|
400
|
+
$btn-height-s,
|
|
401
|
+
$btn-font-s,
|
|
402
|
+
$btn-icon-size-s,
|
|
403
|
+
$btn-padding-horizontal-s
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
&.#{$prefix}-size-l {
|
|
408
|
+
@include button-size(
|
|
409
|
+
$btn-height-l,
|
|
410
|
+
$btn-font-l,
|
|
411
|
+
$btn-icon-size-l,
|
|
412
|
+
$btn-padding-horizontal-l
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
&--shape-square {
|
|
417
|
+
width: $btn-height-default;
|
|
418
|
+
padding: 0;
|
|
419
|
+
|
|
420
|
+
&.#{$prefix}-size-s {
|
|
421
|
+
width: $btn-height-s;
|
|
422
|
+
padding: 0;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
&.#{$prefix}-size-l {
|
|
426
|
+
width: $btn-height-l;
|
|
427
|
+
padding: 0;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
&--shape-round {
|
|
432
|
+
border-radius: $border-radius-round;
|
|
433
|
+
|
|
434
|
+
&.#{$prefix}-size-s {
|
|
435
|
+
border-radius: $btn-shape-border-radius-s;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
&.#{$prefix}-size-l {
|
|
439
|
+
border-radius: $btn-shape-border-radius-l;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
&--shape-circle {
|
|
444
|
+
width: $btn-height-default;
|
|
445
|
+
padding: 0;
|
|
446
|
+
text-align: center;
|
|
447
|
+
border-radius: $btn-shape-border-radius-default;
|
|
448
|
+
|
|
449
|
+
.t-icon {
|
|
450
|
+
font-size: $btn-icon-size-default;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.#{$prefix}-loading {
|
|
454
|
+
font-size: $btn-loading-size;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
&.#{$prefix}-size-s {
|
|
458
|
+
width: $btn-height-s;
|
|
459
|
+
border-radius: $btn-shape-border-radius-s;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
&.#{$prefix}-size-l {
|
|
463
|
+
width: $btn-height-l;
|
|
464
|
+
padding: 0;
|
|
465
|
+
border-radius: $btn-shape-border-radius-l;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
&.#{$prefix}-size-full-width {
|
|
470
|
+
display: flex;
|
|
471
|
+
width: 100%;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.#{$prefix}-button--ghost {
|
|
476
|
+
--ripple-color: @gray-color-10; // 幽灵按钮相当于按钮深色模式,因此固定为深色模式 token
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.#{$prefix}-button:not(.#{$prefix}-is-disabled):not(.#{$prefix}-button--ghost) {
|
|
480
|
+
--ripple-color: btn-color(white-bg, active);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.#{$prefix}-button--variant-base:not(.#{$prefix}-is-disabled):not(
|
|
484
|
+
.#{$prefix}-button--ghost
|
|
485
|
+
) {
|
|
486
|
+
--ripple-color: btn-color(gray-bg, active);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.#{$prefix}-button--variant-base.#{$prefix}-button--theme-primary:not(
|
|
490
|
+
.#{$prefix}-is-disabled
|
|
491
|
+
):not(.#{$prefix}-button--ghost) {
|
|
492
|
+
--ripple-color: btn-color(primary, active);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.#{$prefix}-button--variant-base.#{$prefix}-button--theme-success:not(
|
|
496
|
+
.#{$prefix}-is-disabled
|
|
497
|
+
):not(.#{$prefix}-button--ghost) {
|
|
498
|
+
--ripple-color: btn-color(success, default)-active;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.#{$prefix}-button--variant-base.#{$prefix}-button--theme-warning:not(
|
|
502
|
+
.#{$prefix}-is-disabled
|
|
503
|
+
):not(.#{$prefix}-button--ghost) {
|
|
504
|
+
--ripple-color: btn-color(warning, active);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.#{$prefix}-button--variant-base.#{$prefix}-button--theme-danger:not(
|
|
508
|
+
.#{$prefix}-is-disabled
|
|
509
|
+
):not(.#{$prefix}-button--ghost) {
|
|
510
|
+
--ripple-color: btn-color(danger, active);
|
|
511
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
@import './_vars.scss';
|
|
2
|
+
|
|
3
|
+
@mixin button() {
|
|
4
|
+
position: relative;
|
|
5
|
+
z-index: 0;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
font-size: $btn-font-default;
|
|
8
|
+
outline: none;
|
|
9
|
+
border-width: $btn-border-width;
|
|
10
|
+
border-style: solid;
|
|
11
|
+
border-color: transparent;
|
|
12
|
+
background-color: transparent;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
vertical-align: middle;
|
|
18
|
+
white-space: nowrap;
|
|
19
|
+
border-radius: $btn-border-radius;
|
|
20
|
+
transition: all $anim-duration-base linear;
|
|
21
|
+
touch-action: manipulation;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@mixin button-size(
|
|
25
|
+
$btn-height,
|
|
26
|
+
$btn-font-size,
|
|
27
|
+
$btn-icon-size,
|
|
28
|
+
$padding-horizontal
|
|
29
|
+
) {
|
|
30
|
+
height: $btn-height;
|
|
31
|
+
font: $btn-font-size;
|
|
32
|
+
padding-left: calc($padding-horizontal - $btn-border-width);
|
|
33
|
+
padding-right: calc($padding-horizontal - $btn-border-width);
|
|
34
|
+
|
|
35
|
+
.t-icon,
|
|
36
|
+
.#{$prefix}-loading {
|
|
37
|
+
font-size: $btn-icon-size;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// 尺寸
|
|
2
|
+
$btn-height-s: $comp-size-xs;
|
|
3
|
+
$btn-height-default: $comp-size-m;
|
|
4
|
+
$btn-height-l: $comp-size-xl;
|
|
5
|
+
|
|
6
|
+
// 圆角
|
|
7
|
+
$btn-border-radius: $border-radius-default;
|
|
8
|
+
$btn-shape-border-radius-s: calc($btn-height-s / 2);
|
|
9
|
+
$btn-shape-border-radius-default: calc($btn-height-default / 2);
|
|
10
|
+
$btn-shape-border-radius-l: calc($btn-height-l / 2);
|
|
11
|
+
|
|
12
|
+
//字号
|
|
13
|
+
$btn-font-s: $font-body-small;
|
|
14
|
+
$btn-font-default: $font-body-medium;
|
|
15
|
+
$btn-font-l: $font-body-large;
|
|
16
|
+
|
|
17
|
+
// 图标大小
|
|
18
|
+
$btn-icon-size-s: $font-size-base;
|
|
19
|
+
$btn-icon-size-default: $font-size-l;
|
|
20
|
+
$btn-icon-size-l: $font-size-xl;
|
|
21
|
+
$btn-loading-size: $font-size-l;
|
|
22
|
+
|
|
23
|
+
// 按钮中icon和文字的间距
|
|
24
|
+
$btn-icon-text-margin-left: $spacer;
|
|
25
|
+
|
|
26
|
+
// padding
|
|
27
|
+
$btn-padding-horizontal-s: $comp-paddingLR-s;
|
|
28
|
+
$btn-padding-horizontal-default: $comp-paddingLR-l;
|
|
29
|
+
$btn-padding-horizontal-l: $comp-paddingLR-xl;
|
|
30
|
+
|
|
31
|
+
$btn-border-width: 1px;
|
|
32
|
+
|
|
33
|
+
$btn-colors: (
|
|
34
|
+
primary: (
|
|
35
|
+
default: $brand-color,
|
|
36
|
+
hover: $brand-color-hover,
|
|
37
|
+
active: $brand-color-active,
|
|
38
|
+
disabled: $brand-color-disabled
|
|
39
|
+
),
|
|
40
|
+
success: (
|
|
41
|
+
default: $success-color,
|
|
42
|
+
hover: $success-color-hover,
|
|
43
|
+
active: $success-color-active,
|
|
44
|
+
disabled: $success-color-disabled
|
|
45
|
+
),
|
|
46
|
+
warning: (
|
|
47
|
+
default: $warning-color,
|
|
48
|
+
hover: $warning-color-hover,
|
|
49
|
+
active: $warning-color-active,
|
|
50
|
+
disabled: $warning-color-disabled
|
|
51
|
+
),
|
|
52
|
+
danger: (
|
|
53
|
+
default: $error-color,
|
|
54
|
+
hover: $error-color-hover,
|
|
55
|
+
active: $error-color-active,
|
|
56
|
+
disabled: $error-color-disabled
|
|
57
|
+
),
|
|
58
|
+
white-bg: (
|
|
59
|
+
default: $bg-color-specialcomponent,
|
|
60
|
+
hover: $bg-color-specialcomponent,
|
|
61
|
+
active: $bg-color-container-active,
|
|
62
|
+
disabled: $bg-color-component-disabled
|
|
63
|
+
),
|
|
64
|
+
white-ghost: (
|
|
65
|
+
default: $text-color-anti,
|
|
66
|
+
hover: $brand-color-hover,
|
|
67
|
+
active: $brand-color-active,
|
|
68
|
+
disabled: $border-level-2-color
|
|
69
|
+
),
|
|
70
|
+
gray-bg: (
|
|
71
|
+
default: $bg-color-component,
|
|
72
|
+
hover: $bg-color-component-hover,
|
|
73
|
+
active: $bg-color-component-active,
|
|
74
|
+
disabled: $bg-color-component-disabled
|
|
75
|
+
),
|
|
76
|
+
text-bg: (
|
|
77
|
+
default: transparent,
|
|
78
|
+
hover: $bg-color-container-hover,
|
|
79
|
+
active: $bg-color-container-active,
|
|
80
|
+
disabled: transparent
|
|
81
|
+
),
|
|
82
|
+
border-gray: (
|
|
83
|
+
default: $border-level-2-color,
|
|
84
|
+
hover: $brand-color-hover,
|
|
85
|
+
active: $brand-color-active,
|
|
86
|
+
disabled: $border-level-2-color
|
|
87
|
+
),
|
|
88
|
+
text: (
|
|
89
|
+
default: $text-color-primary,
|
|
90
|
+
hover: $brand-color-hover,
|
|
91
|
+
active: $brand-color-active,
|
|
92
|
+
disabled: $text-color-disabled
|
|
93
|
+
),
|
|
94
|
+
text-gray: (
|
|
95
|
+
default: $text-color-primary,
|
|
96
|
+
hover: $text-color-primary,
|
|
97
|
+
active: $text-color-primary,
|
|
98
|
+
disabled: $text-color-disabled
|
|
99
|
+
),
|
|
100
|
+
none:(
|
|
101
|
+
default: transparent,
|
|
102
|
+
hover: transparent,
|
|
103
|
+
active: transparent,
|
|
104
|
+
disabled: transparent
|
|
105
|
+
),
|
|
106
|
+
"ghost":(
|
|
107
|
+
disabled:rgba(255, 255, 255, .22)
|
|
108
|
+
)
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
$btn-color-none: transparent;
|
|
114
|
+
$btn-color-none-hover: transparent;
|
|
115
|
+
$btn-color-none-active: transparent;
|
|
116
|
+
$btn-color-none-disabled: transparent;
|
|
117
|
+
|
|
118
|
+
// 文本
|
|
119
|
+
$btn-text-variant-base-color: $text-color-anti;
|
|
120
|
+
|
|
121
|
+
// 状态色 - disabled ghost
|
|
122
|
+
$btn-color-ghost-disabled: rgba(255, 255, 255, .22);
|