@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,158 @@
|
|
|
1
|
+
// 组件允许单个组件打包,因此默认引入公共基础样式
|
|
2
|
+
|
|
3
|
+
@import '../../vars.scss';
|
|
4
|
+
|
|
5
|
+
@import './_var.scss';
|
|
6
|
+
|
|
7
|
+
@import './_mixin.scss';
|
|
8
|
+
|
|
9
|
+
@import '../../mixins/_layout.scss';
|
|
10
|
+
|
|
11
|
+
@import '../../mixins/_reset.scss';
|
|
12
|
+
|
|
13
|
+
@import '../../mixins/_focus.scss';
|
|
14
|
+
|
|
15
|
+
// <name> 替换为组件名
|
|
16
|
+
.#{$checkbox-cls}-group {
|
|
17
|
+
@include reset;
|
|
18
|
+
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
flex-wrap: wrap;
|
|
21
|
+
gap: $checkbox-group-gap;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.#{$checkbox-cls} {
|
|
25
|
+
@include reset;
|
|
26
|
+
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
position: relative;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
color: $checkbox-label-color;
|
|
32
|
+
|
|
33
|
+
& + .#{$checkbox-cls} {
|
|
34
|
+
margin-left: $checkbox-margin;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&__former {
|
|
38
|
+
@include input-visually-hidden();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&__input {
|
|
42
|
+
position: relative;
|
|
43
|
+
display: inline-block;
|
|
44
|
+
width: $checkbox-size;
|
|
45
|
+
height: $checkbox-size;
|
|
46
|
+
vertical-align: middle;
|
|
47
|
+
border: 1px solid $checkbox-border-color;
|
|
48
|
+
border-radius: $checkbox-border-radius;
|
|
49
|
+
background-color: $checkbox-input-color;
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
flex-shrink: 0;
|
|
52
|
+
|
|
53
|
+
&::after {
|
|
54
|
+
content: '';
|
|
55
|
+
position: absolute;
|
|
56
|
+
opacity: 0;
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&__label {
|
|
62
|
+
display: inline-block;
|
|
63
|
+
margin-left: $checkbox-input-label-spacer;
|
|
64
|
+
vertical-align: middle;
|
|
65
|
+
font: $checkbox-font;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&:hover {
|
|
69
|
+
.#{$checkbox-cls}__input {
|
|
70
|
+
border-color: $checkbox-border-color-hover;
|
|
71
|
+
transition: border-color $anim-duration-base linear;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&.#{$prefix}-is-checked {
|
|
76
|
+
.#{$checkbox-cls}__input {
|
|
77
|
+
border-color: $checkbox-border-color-checked;
|
|
78
|
+
background-color: $checkbox-input-color-checked;
|
|
79
|
+
transition: background-color $anim-duration-base $anim-time-fn-ease-in;
|
|
80
|
+
|
|
81
|
+
&::after {
|
|
82
|
+
opacity: 1;
|
|
83
|
+
top: (($checkbox-size) / 2 - 2px);
|
|
84
|
+
left: $checkbox-check-left;
|
|
85
|
+
width: $checkbox-check-width;
|
|
86
|
+
height: $checkbox-check-height;
|
|
87
|
+
border: 2px solid $checkbox-check-color;
|
|
88
|
+
border-radius: 0 0 1px;
|
|
89
|
+
border-top: 0;
|
|
90
|
+
border-left: 0;
|
|
91
|
+
transform: rotate(45deg) scale(1) translate(-50%, -50%);
|
|
92
|
+
background: transparent;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&.#{$prefix}-is-indeterminate {
|
|
98
|
+
.#{$checkbox-cls}__input {
|
|
99
|
+
border-color: $checkbox-input-color-indeterminate;
|
|
100
|
+
background-color: $checkbox-input-color-indeterminate;
|
|
101
|
+
transition: background-color $anim-duration-base $anim-time-fn-ease-in;
|
|
102
|
+
|
|
103
|
+
&::after {
|
|
104
|
+
opacity: 1;
|
|
105
|
+
width: $checkbox-indeterminate-width;
|
|
106
|
+
height: $checkbox-indeterminate-height;
|
|
107
|
+
left: -1px;
|
|
108
|
+
right: 0;
|
|
109
|
+
top: (($checkbox-size - 2 - $checkbox-indeterminate-height) * 0.5);
|
|
110
|
+
border: unset;
|
|
111
|
+
transform: scale(0.5);
|
|
112
|
+
background-color: $checkbox-indeterminate-color;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&.#{$prefix}-is-disabled {
|
|
118
|
+
cursor: not-allowed;
|
|
119
|
+
|
|
120
|
+
.#{$checkbox-cls}__label {
|
|
121
|
+
color: $checkbox-check-color-disabled;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.#{$checkbox-cls}__input {
|
|
125
|
+
background-color: $checkbox-input-color-disabled;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&:hover {
|
|
129
|
+
.#{$checkbox-cls}__input {
|
|
130
|
+
border-color: $checkbox-border-color;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&.#{$prefix}-is-checked {
|
|
135
|
+
.#{$checkbox-cls}__input {
|
|
136
|
+
border-color: $checkbox-border-color;
|
|
137
|
+
|
|
138
|
+
&::after {
|
|
139
|
+
border-color: $checkbox-check-icon-disabled-color;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&.#{$prefix}-is-indeterminate {
|
|
145
|
+
.#{$checkbox-cls}__input {
|
|
146
|
+
border-color: $checkbox-border-color;
|
|
147
|
+
|
|
148
|
+
&::after {
|
|
149
|
+
background-color: $checkbox-indeterminate-color-disabled;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.#{$prefix}-checkbox:focus-visible {
|
|
157
|
+
@include tab-focus-style-rect();
|
|
158
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// 组件变量
|
|
2
|
+
// 名称可按如下规则定义:
|
|
3
|
+
// <component>-[type]-[attrtype]-<attr>-[status]
|
|
4
|
+
|
|
5
|
+
// component:组件名,如button,
|
|
6
|
+
// type: 组件类型,如 button 的次要按钮(line)
|
|
7
|
+
// attrtype: 属性的具体应用场景。如颜色,用于背景(bg)、文本(text)、边框(border)等
|
|
8
|
+
// attr: 属性名称,如color、height、radius等
|
|
9
|
+
// status: 表示组件状态或尺寸,如 hover、disabled、s、l 等
|
|
10
|
+
|
|
11
|
+
// 如:$button-line-bg-color-hover
|
|
12
|
+
// 如:$button-line-height-s
|
|
13
|
+
|
|
14
|
+
$checkbox-cls: '#{$prefix}-checkbox';
|
|
15
|
+
|
|
16
|
+
// 颜色
|
|
17
|
+
$checkbox-border-color: $border-level-2-color;
|
|
18
|
+
$checkbox-border-color-checked: $brand-color;
|
|
19
|
+
$checkbox-border-color-hover: $brand-color;
|
|
20
|
+
|
|
21
|
+
$checkbox-input-color: $bg-color-container;
|
|
22
|
+
$checkbox-input-color-checked: $brand-color;
|
|
23
|
+
$checkbox-input-color-disabled: $bg-color-component-disabled;
|
|
24
|
+
|
|
25
|
+
$checkbox-check-color: $text-color-anti;
|
|
26
|
+
$checkbox-check-color-disabled: $text-color-disabled;
|
|
27
|
+
// 图标禁止选中状态下时icon的色值变量
|
|
28
|
+
$checkbox-check-icon-disabled-color: $text-color-disabled;
|
|
29
|
+
|
|
30
|
+
$checkbox-input-color-indeterminate: $brand-color;
|
|
31
|
+
$checkbox-indeterminate-color-disabled: $text-color-disabled;
|
|
32
|
+
|
|
33
|
+
$checkbox-label-color: $text-color-primary;
|
|
34
|
+
|
|
35
|
+
// 尺寸
|
|
36
|
+
$checkbox-size: 16px;
|
|
37
|
+
$checkbox-border-radius: $border-radius-default;
|
|
38
|
+
$checkbox-margin-right: $comp-margin-s;
|
|
39
|
+
|
|
40
|
+
$checkbox-check-width: 5px;
|
|
41
|
+
$checkbox-check-height: 9px;
|
|
42
|
+
$checkbox-check-size: (
|
|
43
|
+
($checkbox-check-width + $checkbox-check-height) / sqrt(2)
|
|
44
|
+
);
|
|
45
|
+
$checkbox-check-left: 3px;
|
|
46
|
+
|
|
47
|
+
$checkbox-indeterminate-width: 16px;
|
|
48
|
+
$checkbox-indeterminate-height: 4px;
|
|
49
|
+
$checkbox-indeterminate-color: $font-white-1;
|
|
50
|
+
|
|
51
|
+
// 字号
|
|
52
|
+
$checkbox-font: $font-body-medium;
|
|
53
|
+
|
|
54
|
+
// padding
|
|
55
|
+
$checkbox-input-label-spacer: $spacer;
|
|
56
|
+
|
|
57
|
+
// 组合复选框margin
|
|
58
|
+
$checkbox-group-gap: $spacer-2;
|
|
59
|
+
// 单个复选框margin
|
|
60
|
+
$checkbox-margin: inherit;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
@import '../../_vars.scss';
|
|
2
|
+
|
|
3
|
+
.#{$prefix}-dialog-zoom {
|
|
4
|
+
@keyframes tDialogZoomIn {
|
|
5
|
+
// 解决弹窗中带有动效的Icon不展示(如loading),初始scale为1可以展示正常
|
|
6
|
+
0% {
|
|
7
|
+
opacity: 0;
|
|
8
|
+
transform: scale(0.01);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
100% {
|
|
12
|
+
opacity: 1;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@keyframes tDialogZoomOut {
|
|
17
|
+
from {
|
|
18
|
+
opacity: 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
to {
|
|
22
|
+
opacity: 0;
|
|
23
|
+
transform: scale(0.01);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@keyframes tDialogMaskIn {
|
|
28
|
+
from {
|
|
29
|
+
opacity: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
to {
|
|
33
|
+
opacity: 1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@keyframes tDialogMaskOut {
|
|
38
|
+
from {
|
|
39
|
+
opacity: 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
to {
|
|
43
|
+
opacity: 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@mixin animation-enter {
|
|
48
|
+
animation-duration: $dialog-anim-duration;
|
|
49
|
+
animation-fill-mode: both;
|
|
50
|
+
animation-timing-function: $anim-time-fn-ease-out;
|
|
51
|
+
animation-play-state: paused;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@mixin animation-exit {
|
|
55
|
+
animation-duration: $dialog-anim-duration;
|
|
56
|
+
animation-fill-mode: both;
|
|
57
|
+
animation-timing-function: $dialog-anim-time-fn-exit;
|
|
58
|
+
animation-play-state: paused;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@mixin animation-active {
|
|
62
|
+
animation-play-state: running;
|
|
63
|
+
animation-fill-mode: both;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&-enter,
|
|
67
|
+
&-enter-from,
|
|
68
|
+
&-appear {
|
|
69
|
+
@include animation-enter;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&-exit {
|
|
73
|
+
@include animation-exit;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&-enter-active,
|
|
77
|
+
&-appear-active {
|
|
78
|
+
animation-name: tDialogZoomIn;
|
|
79
|
+
@include animation-active;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&-exit-active {
|
|
83
|
+
animation-name: tDialogZoomOut;
|
|
84
|
+
@include animation-active;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.#{$prefix}-dialog-fade-enter,
|
|
91
|
+
.#{$prefix}-dialog-fade-appear {
|
|
92
|
+
opacity: 0;
|
|
93
|
+
animation-duration: $dialog-anim-duration;
|
|
94
|
+
animation-fill-mode: both;
|
|
95
|
+
animation-timing-function: $anim-time-fn-ease-out;
|
|
96
|
+
animation-play-state: paused;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.#{$prefix}-dialog-fade-exit {
|
|
100
|
+
animation-duration: $dialog-anim-duration;
|
|
101
|
+
animation-fill-mode: both;
|
|
102
|
+
animation-timing-function: $anim-time-fn-ease-out;
|
|
103
|
+
animation-play-state: paused;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.#{$prefix}-dialog-fade-enter.#{$prefix}-dialog-fade-enter-active,
|
|
107
|
+
.#{$prefix}-dialog-fade-appear.#{$prefix}-dialog-fade-appear-active {
|
|
108
|
+
animation-name: tDialogFadeIn;
|
|
109
|
+
animation-play-state: running;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.#{$prefix}-dialog-fade-exit.#{$prefix}-dialog-fade-exit-active {
|
|
113
|
+
animation-name: tDialogFadeOut;
|
|
114
|
+
animation-play-state: running;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@keyframes tDialogFadeIn {
|
|
118
|
+
0% {
|
|
119
|
+
opacity: 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
100% {
|
|
123
|
+
opacity: 1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@keyframes tDialogFadeOut {
|
|
128
|
+
0% {
|
|
129
|
+
opacity: 1;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
100% {
|
|
133
|
+
opacity: 0;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
// 组件允许单个组件打包,因此默认引入公共基础样式
|
|
2
|
+
|
|
3
|
+
@import '../../_vars.scss';
|
|
4
|
+
|
|
5
|
+
@import './_vars.scss';
|
|
6
|
+
|
|
7
|
+
@import './_animate.scss';
|
|
8
|
+
|
|
9
|
+
@import './_mixins.scss';
|
|
10
|
+
|
|
11
|
+
@import '../../mixins/_reset.scss';
|
|
12
|
+
|
|
13
|
+
@import '../../mixins/_scrollbar.scss';
|
|
14
|
+
|
|
15
|
+
// <name> 替换为组件名
|
|
16
|
+
.#{$prefix}-dialog {
|
|
17
|
+
@include reset;
|
|
18
|
+
|
|
19
|
+
width: $dialog-width;
|
|
20
|
+
background-color: $dialog-bg-color;
|
|
21
|
+
position: relative;
|
|
22
|
+
border: $dialog-border;
|
|
23
|
+
border-radius: $border-radius-large;
|
|
24
|
+
|
|
25
|
+
// icon theme
|
|
26
|
+
.t-icon.#{$prefix}-is-info {
|
|
27
|
+
color: $dialog-info-icon-color;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.t-icon.#{$prefix}-is-success {
|
|
31
|
+
color: $dialog-success-icon-color;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.t-icon.#{$prefix}-is-warning {
|
|
35
|
+
color: $dialog-warning-icon-color;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.t-icon.#{$prefix}-is-error {
|
|
39
|
+
color: $dialog-error-icon-color;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&--lock {
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&__header {
|
|
47
|
+
color: $dialog-header-text-color;
|
|
48
|
+
font: $dialog-header-font;
|
|
49
|
+
font-weight: $dialog-header-weight;
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
word-break: break-word;
|
|
53
|
+
gap: $dialog-header-content-margin-right;
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
|
|
56
|
+
.#{$prefix}-dialog__header-content {
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: flex-start;
|
|
59
|
+
width: 100%;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.t-icon:not(.t-icon-close) {
|
|
63
|
+
font-size: $dialog-icon-size;
|
|
64
|
+
display: inline-flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
margin-right: $dialog-header-icon-margin-right;
|
|
67
|
+
flex-shrink: 0;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&__header--fullscreen {
|
|
72
|
+
background-color: $dialog-header-bg-color-fullscreen;
|
|
73
|
+
min-height: $dialog-header-height-fullscreen;
|
|
74
|
+
justify-content: flex-end;
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
flex-direction: row;
|
|
78
|
+
padding: $dialog-header-padding-fullscreen;
|
|
79
|
+
|
|
80
|
+
.#{$prefix}-dialog__header-content {
|
|
81
|
+
box-sizing: border-box;
|
|
82
|
+
display: flex;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
align-items: center;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&__body {
|
|
89
|
+
@include scrollbar();
|
|
90
|
+
|
|
91
|
+
color: $dialog-body-text-color;
|
|
92
|
+
font: $dialog-body-text-font;
|
|
93
|
+
overflow: auto;
|
|
94
|
+
padding: $dialog-body-padding;
|
|
95
|
+
word-break: break-word;
|
|
96
|
+
|
|
97
|
+
&__icon,
|
|
98
|
+
&--icon {
|
|
99
|
+
padding: $dialog-body-icon-padding;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&__body--fullscreen {
|
|
104
|
+
@include scrollbar();
|
|
105
|
+
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
padding: $dialog-body-padding-fullscreen;
|
|
108
|
+
height: calc(
|
|
109
|
+
100% - $dialog-header-height-fullscreen - $dialog-footer-height-fullscreen
|
|
110
|
+
);
|
|
111
|
+
overflow: auto;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&__body--fullscreen--without-footer {
|
|
115
|
+
box-sizing: border-box;
|
|
116
|
+
padding: $dialog-body-padding-fullscreen;
|
|
117
|
+
height: calc(100% - $dialog-header-height-fullscreen);
|
|
118
|
+
overflow: auto;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&__footer {
|
|
122
|
+
width: 100%;
|
|
123
|
+
text-align: right;
|
|
124
|
+
padding: $dialog-footer-padding;
|
|
125
|
+
.#{$prefix}-button + .#{$prefix}-button {
|
|
126
|
+
margin-left: $dialog-footer-button-margin-left;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&__footer--fullscreen {
|
|
131
|
+
min-height: $dialog-footer-height-fullscreen;
|
|
132
|
+
padding: $dialog-footer-padding-fullscreen;
|
|
133
|
+
box-sizing: border-box;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&--default {
|
|
137
|
+
padding: $dialog-default-spacer;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&__close {
|
|
141
|
+
font-size: $dialog-close-icon-size;
|
|
142
|
+
color: $dialog-close-color;
|
|
143
|
+
display: flex;
|
|
144
|
+
width: $dialog-close-icon-size;
|
|
145
|
+
height: $dialog-close-icon-size;
|
|
146
|
+
align-items: center;
|
|
147
|
+
border-radius: $border-radius-default;
|
|
148
|
+
transition: all $anim-duration-base linear;
|
|
149
|
+
padding: $dialog-closebtn-padding;
|
|
150
|
+
|
|
151
|
+
&:hover {
|
|
152
|
+
cursor: pointer;
|
|
153
|
+
background: $dialog-close-icon-hover;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&:active {
|
|
157
|
+
background: $dialog-close-icon-active;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&__close--fullscreen {
|
|
162
|
+
display: flex;
|
|
163
|
+
background: transparent;
|
|
164
|
+
|
|
165
|
+
&:hover {
|
|
166
|
+
cursor: pointer;
|
|
167
|
+
background: $dialog-close-icon-fullscreen-hover;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
&:active {
|
|
171
|
+
background: $dialog-close-icon-fullscreen-active;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&.#{$prefix}-dialog--draggable {
|
|
176
|
+
&:hover {
|
|
177
|
+
cursor: move;
|
|
178
|
+
}
|
|
179
|
+
.#{$prefix}-dialog__header,
|
|
180
|
+
.#{$prefix}-dialog__body,
|
|
181
|
+
.#{$prefix}-dialog__footer {
|
|
182
|
+
&:hover {
|
|
183
|
+
cursor: auto;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&__fullscreen {
|
|
189
|
+
width: 100%;
|
|
190
|
+
border-radius: 0;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// t-dialog 组件本身
|
|
195
|
+
.#{$prefix}-dialog__ctx {
|
|
196
|
+
// dialog内容溢出需要考虑滚动
|
|
197
|
+
pointer-events: auto;
|
|
198
|
+
outline: none;
|
|
199
|
+
top: 0;
|
|
200
|
+
left: 0;
|
|
201
|
+
width: 100%;
|
|
202
|
+
height: 100%;
|
|
203
|
+
|
|
204
|
+
// modeless 点击穿透 即可以操作背景后的元素
|
|
205
|
+
&.#{$prefix}-dialog__ctx--modeless {
|
|
206
|
+
pointer-events: none;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&.#{$prefix}-dialog__ctx--fixed {
|
|
210
|
+
position: fixed;
|
|
211
|
+
z-index: $z-index-dialog;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&.#{$prefix}-dialog__ctx--absolute {
|
|
215
|
+
position: absolute;
|
|
216
|
+
// 用于挂载元素 修改定位方式
|
|
217
|
+
.#{$prefix}-dialog__mask {
|
|
218
|
+
position: absolute;
|
|
219
|
+
}
|
|
220
|
+
.#{$prefix}-dialog__wrap {
|
|
221
|
+
position: absolute;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
&.#{$prefix}-is-visible {
|
|
226
|
+
visibility: visible;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
&.#{$prefix}-is-hidden {
|
|
230
|
+
visibility: hidden;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
&.#{$prefix}-is-display {
|
|
234
|
+
display: block;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
&.#{$prefix}-not-display {
|
|
238
|
+
display: none;
|
|
239
|
+
}
|
|
240
|
+
// 遮罩层
|
|
241
|
+
.#{$prefix}-dialog__mask {
|
|
242
|
+
position: fixed;
|
|
243
|
+
top: 0;
|
|
244
|
+
left: 0;
|
|
245
|
+
width: 100%;
|
|
246
|
+
height: 100%;
|
|
247
|
+
z-index: 1;
|
|
248
|
+
background: $dialog-mask-bg-color;
|
|
249
|
+
pointer-events: auto;
|
|
250
|
+
}
|
|
251
|
+
// wrap 滚动的显示层 固定为页面窗口大小
|
|
252
|
+
.#{$prefix}-dialog__wrap {
|
|
253
|
+
position: fixed;
|
|
254
|
+
top: 0;
|
|
255
|
+
left: 0;
|
|
256
|
+
width: 100%;
|
|
257
|
+
height: 100%;
|
|
258
|
+
z-index: 1;
|
|
259
|
+
overflow: auto;
|
|
260
|
+
@include scrollbar(8px, 2px);
|
|
261
|
+
}
|
|
262
|
+
// 定位层 用于实现居中 或者距离顶部 定位
|
|
263
|
+
.#{$prefix}-dialog__position {
|
|
264
|
+
// 因为内容会超出 使用flex布局
|
|
265
|
+
display: flex;
|
|
266
|
+
justify-content: center;
|
|
267
|
+
min-height: 100%;
|
|
268
|
+
width: 100%;
|
|
269
|
+
// 通过修改position为absolute进行拖拽定位
|
|
270
|
+
position: relative;
|
|
271
|
+
// 设置最小距离顶部底部距离
|
|
272
|
+
padding: 48px 0;
|
|
273
|
+
box-sizing: border-box;
|
|
274
|
+
// 居中和距顶部布局
|
|
275
|
+
&.#{$prefix}-dialog--top {
|
|
276
|
+
align-items: flex-start;
|
|
277
|
+
// 这里top api实现 更改padding 因为子元素拖拽定位 如果使用子元素margin 拖拽时需要计算margin 比较麻烦
|
|
278
|
+
padding-top: $dialog-top-position-top;
|
|
279
|
+
}
|
|
280
|
+
// 垂直居中布局
|
|
281
|
+
&.#{$prefix}-dialog--center {
|
|
282
|
+
align-items: center;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.#{$prefix}-dialog__position_fullscreen {
|
|
287
|
+
// 因为内容会超出 使用flex布局
|
|
288
|
+
display: flex;
|
|
289
|
+
justify-content: center;
|
|
290
|
+
min-height: 100%;
|
|
291
|
+
width: 100%;
|
|
292
|
+
// 通过修改position为absolute进行拖拽定位
|
|
293
|
+
position: relative;
|
|
294
|
+
box-sizing: border-box;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.#{$prefix}-is-hidden {
|
|
298
|
+
background: none;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.#{$prefix}-dialog {
|
|
302
|
+
pointer-events: auto;
|
|
303
|
+
z-index: $z-index-dialog;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
&.#{$prefix}-dialog__ctx--modeless {
|
|
307
|
+
.#{$prefix}-dialog {
|
|
308
|
+
box-shadow: $shadow-3;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
File without changes
|