@tendaui/react 1.1.1
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 +2 -0
- package/es/_chunks/dep-0QH2Ee4R.js +34 -0
- package/es/_chunks/dep-0QH2Ee4R.js.map +1 -0
- package/es/_chunks/dep-B7HmDtze.js +199 -0
- package/es/_chunks/dep-B7HmDtze.js.map +1 -0
- package/es/_chunks/dep-BH5n5r1M.js +55 -0
- package/es/_chunks/dep-BH5n5r1M.js.map +1 -0
- package/es/_chunks/dep-BP0-apUT.js +9 -0
- package/es/_chunks/dep-BP0-apUT.js.map +1 -0
- package/es/_chunks/dep-C1XcmShP.js +18 -0
- package/es/_chunks/dep-C1XcmShP.js.map +1 -0
- package/es/_chunks/dep-C36au4Ip.js +104 -0
- package/es/_chunks/dep-C36au4Ip.js.map +1 -0
- package/es/_chunks/dep-CgyDw_YI.js +20 -0
- package/es/_chunks/dep-CgyDw_YI.js.map +1 -0
- package/es/_chunks/dep-CoIiHOgo.js +162 -0
- package/es/_chunks/dep-CoIiHOgo.js.map +1 -0
- package/es/_chunks/dep-Cwish4GD.js +29 -0
- package/es/_chunks/dep-Cwish4GD.js.map +1 -0
- package/es/_chunks/dep-CzLhKWCf.js +56 -0
- package/es/_chunks/dep-CzLhKWCf.js.map +1 -0
- package/es/_chunks/dep-D-UKOauR.js +12 -0
- package/es/_chunks/dep-D-UKOauR.js.map +1 -0
- package/es/_chunks/dep-D6YxJv-F.js +31 -0
- package/es/_chunks/dep-D6YxJv-F.js.map +1 -0
- package/es/_chunks/dep-D7LanWes.js +171 -0
- package/es/_chunks/dep-D7LanWes.js.map +1 -0
- package/es/_chunks/dep-D8jki30S.js +31 -0
- package/es/_chunks/dep-D8jki30S.js.map +1 -0
- package/es/_chunks/dep-DB5wmwh1.js +48 -0
- package/es/_chunks/dep-DB5wmwh1.js.map +1 -0
- package/es/_chunks/dep-DGvfel3I.js +16 -0
- package/es/_chunks/dep-DGvfel3I.js.map +1 -0
- package/es/_chunks/dep-DHWwZ2Nj.js +139 -0
- package/es/_chunks/dep-DHWwZ2Nj.js.map +1 -0
- package/es/_chunks/dep-DN7d1SzH.js +24 -0
- package/es/_chunks/dep-DN7d1SzH.js.map +1 -0
- package/es/_chunks/dep-DZ_0EvBk.js +440 -0
- package/es/_chunks/dep-DZ_0EvBk.js.map +1 -0
- package/es/_chunks/dep-Dk2xX8lh.js +691 -0
- package/es/_chunks/dep-Dk2xX8lh.js.map +1 -0
- package/es/_chunks/dep-DwWrhxkd.js +26 -0
- package/es/_chunks/dep-DwWrhxkd.js.map +1 -0
- package/es/_chunks/dep-EcrDKDlu.js +1677 -0
- package/es/_chunks/dep-EcrDKDlu.js.map +1 -0
- package/es/_chunks/dep-PPA-yoAy.js +16 -0
- package/es/_chunks/dep-PPA-yoAy.js.map +1 -0
- package/es/_chunks/dep-U1T8CQY9.js +4 -0
- package/es/_chunks/dep-U1T8CQY9.js.map +1 -0
- package/es/_chunks/dep-bWaVq_y3.js +14 -0
- package/es/_chunks/dep-bWaVq_y3.js.map +1 -0
- package/es/_chunks/dep-u1x3x6MJ.js +9 -0
- package/es/_chunks/dep-u1x3x6MJ.js.map +1 -0
- package/es/alert/Alert.js +153 -0
- package/es/alert/Alert.js.map +1 -0
- package/es/alert/index.js +23 -0
- package/es/alert/index.js.map +1 -0
- package/es/alert/style/css.js +1 -0
- package/es/alert/style/index.css +172 -0
- package/es/alert/style/index.js +2 -0
- package/es/alert/style/index.js.map +1 -0
- package/es/badge/Badge.js +81 -0
- package/es/badge/Badge.js.map +1 -0
- package/es/badge/index.js +15 -0
- package/es/badge/index.js.map +1 -0
- package/es/badge/style/css.js +1 -0
- package/es/badge/style/index.css +60 -0
- package/es/badge/style/index.js +2 -0
- package/es/badge/style/index.js.map +1 -0
- package/es/button/Button.js +94 -0
- package/es/button/Button.js.map +1 -0
- package/es/button/index.js +28 -0
- package/es/button/index.js.map +1 -0
- package/es/button/style/css.js +1 -0
- package/es/button/style/index.css +1206 -0
- package/es/button/style/index.js +2 -0
- package/es/button/style/index.js.map +1 -0
- package/es/checkbox/Checkbox.js +17 -0
- package/es/checkbox/Checkbox.js.map +1 -0
- package/es/checkbox/CheckboxGroup.js +17 -0
- package/es/checkbox/CheckboxGroup.js.map +1 -0
- package/es/checkbox/index.js +22 -0
- package/es/checkbox/index.js.map +1 -0
- package/es/checkbox/style/css.js +1 -0
- package/es/checkbox/style/index.css +151 -0
- package/es/checkbox/style/index.js +2 -0
- package/es/checkbox/style/index.js.map +1 -0
- package/es/common/Check.js +101 -0
- package/es/common/Check.js.map +1 -0
- package/es/common/FakeArrow.js +28 -0
- package/es/common/FakeArrow.js.map +1 -0
- package/es/common/PluginContainer.js +19 -0
- package/es/common/PluginContainer.js.map +1 -0
- package/es/common/Portal.js +53 -0
- package/es/common/Portal.js.map +1 -0
- package/es/config-provider/ConfigContext.js +17 -0
- package/es/config-provider/ConfigContext.js.map +1 -0
- package/es/config-provider/ConfigProvider.js +45 -0
- package/es/config-provider/ConfigProvider.js.map +1 -0
- package/es/config-provider/index.js +12 -0
- package/es/config-provider/index.js.map +1 -0
- package/es/dialog/Dialog.js +575 -0
- package/es/dialog/Dialog.js.map +1 -0
- package/es/dialog/DialogCard.js +28 -0
- package/es/dialog/DialogCard.js.map +1 -0
- package/es/dialog/index.js +44 -0
- package/es/dialog/index.js.map +1 -0
- package/es/dialog/plugin.js +199 -0
- package/es/dialog/plugin.js.map +1 -0
- package/es/dialog/style/css.js +1 -0
- package/es/dialog/style/index.css +510 -0
- package/es/dialog/style/index.js +2 -0
- package/es/dialog/style/index.js.map +1 -0
- package/es/form/Form.js +190 -0
- package/es/form/Form.js.map +1 -0
- package/es/form/FormContext.js +38 -0
- package/es/form/FormContext.js.map +1 -0
- package/es/form/FormItem.js +39 -0
- package/es/form/FormItem.js.map +1 -0
- package/es/form/FormList.js +306 -0
- package/es/form/FormList.js.map +1 -0
- package/es/form/hooks/useFormItemStyle.js +10 -0
- package/es/form/hooks/useFormItemStyle.js.map +1 -0
- package/es/form/hooks/useInstance.js +326 -0
- package/es/form/hooks/useInstance.js.map +1 -0
- package/es/form/index.js +47 -0
- package/es/form/index.js.map +1 -0
- package/es/form/style/css.js +1 -0
- package/es/form/style/index.css +296 -0
- package/es/form/style/index.js +2 -0
- package/es/form/style/index.js.map +1 -0
- package/es/form/utils/index.js +75 -0
- package/es/form/utils/index.js.map +1 -0
- package/es/hooks/useDragSorter.js +137 -0
- package/es/hooks/useDragSorter.js.map +1 -0
- package/es/index.js +103 -0
- package/es/index.js.map +1 -0
- package/es/input/Input.js +375 -0
- package/es/input/Input.js.map +1 -0
- package/es/input/InputGroup.js +23 -0
- package/es/input/InputGroup.js.map +1 -0
- package/es/input/index.js +23 -0
- package/es/input/index.js.map +1 -0
- package/es/input/style/css.js +1 -0
- package/es/input/style/index.css +450 -0
- package/es/input/style/index.js +2 -0
- package/es/input/style/index.js.map +1 -0
- package/es/loading/Gradient.js +86 -0
- package/es/loading/Gradient.js.map +1 -0
- package/es/loading/Loading.js +147 -0
- package/es/loading/Loading.js.map +1 -0
- package/es/loading/index.js +24 -0
- package/es/loading/index.js.map +1 -0
- package/es/loading/style/css.js +1 -0
- package/es/loading/style/index.css +191 -0
- package/es/loading/style/index.js +2 -0
- package/es/loading/style/index.js.map +1 -0
- package/es/myform/index.js +2 -0
- package/es/myform/index.js.map +1 -0
- package/es/notification/NotifyContainer.js +78 -0
- package/es/notification/NotifyContainer.js.map +1 -0
- package/es/notification/NotifyContext.js +149 -0
- package/es/notification/NotifyContext.js.map +1 -0
- package/es/notification/NotifyItem.js +150 -0
- package/es/notification/NotifyItem.js.map +1 -0
- package/es/notification/index.js +32 -0
- package/es/notification/index.js.map +1 -0
- package/es/notification/style/css.js +1 -0
- package/es/notification/style/index.css +142 -0
- package/es/notification/style/index.js +2 -0
- package/es/notification/style/index.js.map +1 -0
- package/es/popup/Popup.js +790 -0
- package/es/popup/Popup.js.map +1 -0
- package/es/popup/index.js +28 -0
- package/es/popup/index.js.map +1 -0
- package/es/popup/style/css.js +1 -0
- package/es/popup/style/index.css +186 -0
- package/es/popup/style/index.js +2 -0
- package/es/popup/style/index.js.map +1 -0
- package/es/portal/Portal.js +48 -0
- package/es/portal/Portal.js.map +1 -0
- package/es/portal/index.js +7 -0
- package/es/portal/index.js.map +1 -0
- package/es/select/Option.js +118 -0
- package/es/select/Option.js.map +1 -0
- package/es/select/OptionGroup.js +9 -0
- package/es/select/OptionGroup.js.map +1 -0
- package/es/select/PopupContent.js +16 -0
- package/es/select/PopupContent.js.map +1 -0
- package/es/select/Select.js +709 -0
- package/es/select/Select.js.map +1 -0
- package/es/select/index.js +66 -0
- package/es/select/index.js.map +1 -0
- package/es/select/style/css.js +1 -0
- package/es/select/style/index.css +437 -0
- package/es/select/style/index.js +2 -0
- package/es/select/style/index.js.map +1 -0
- package/es/select-input/SelectInput.js +202 -0
- package/es/select-input/SelectInput.js.map +1 -0
- package/es/select-input/hook/useMultiple.js +118 -0
- package/es/select-input/hook/useMultiple.js.map +1 -0
- package/es/select-input/hook/useSingle.js +105 -0
- package/es/select-input/hook/useSingle.js.map +1 -0
- package/es/select-input/index.js +51 -0
- package/es/select-input/index.js.map +1 -0
- package/es/select-input/style/css.js +1 -0
- package/es/select-input/style/index.css +0 -0
- package/es/select-input/style/index.js +2 -0
- package/es/select-input/style/index.js.map +1 -0
- package/es/space/index.js +2 -0
- package/es/space/index.js.map +1 -0
- package/es/style/index.css +490 -0
- package/es/style/index.js +2 -0
- package/es/style/index.js.map +1 -0
- package/es/switch/Switch.js +174 -0
- package/es/switch/Switch.js.map +1 -0
- package/es/switch/index.js +28 -0
- package/es/switch/index.js.map +1 -0
- package/es/switch/style/css.js +1 -0
- package/es/switch/style/index.css +239 -0
- package/es/switch/style/index.js +2 -0
- package/es/switch/style/index.js.map +1 -0
- package/es/tag/Tag.js +1312 -0
- package/es/tag/Tag.js.map +1 -0
- package/es/tag/index.js +21 -0
- package/es/tag/index.js.map +1 -0
- package/es/tag/style/css.js +1 -0
- package/es/tag/style/index.css +236 -0
- package/es/tag/style/index.js +2 -0
- package/es/tag/style/index.js.map +1 -0
- package/es/tag-input/TagInput.js +360 -0
- package/es/tag-input/TagInput.js.map +1 -0
- package/es/tag-input/hooks/useTagList.js +167 -0
- package/es/tag-input/hooks/useTagList.js.map +1 -0
- package/es/tag-input/index.js +35 -0
- package/es/tag-input/index.js.map +1 -0
- package/es/tag-input/style/css.js +1 -0
- package/es/tag-input/style/index.css +223 -0
- package/es/tag-input/style/index.js +2 -0
- package/es/tag-input/style/index.js.map +1 -0
- package/es/tag-input/useTagList.js +167 -0
- package/es/tag-input/useTagList.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/* Alert */
|
|
3
|
+
.t-alert {
|
|
4
|
+
font: var(--td-font-body-medium);
|
|
5
|
+
color: var(--td-text-color-primary);
|
|
6
|
+
-webkit-box-sizing: border-box;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
margin: 0;
|
|
9
|
+
padding: 0;
|
|
10
|
+
list-style: none;
|
|
11
|
+
display: -webkit-box;
|
|
12
|
+
display: -ms-flexbox;
|
|
13
|
+
display: flex;
|
|
14
|
+
-webkit-box-align: start;
|
|
15
|
+
-ms-flex-align: start;
|
|
16
|
+
align-items: flex-start;
|
|
17
|
+
padding: var(--td-comp-paddingTB-l) var(--td-comp-paddingLR-xl);
|
|
18
|
+
opacity: 1;
|
|
19
|
+
-webkit-transition: opacity 0.2s;
|
|
20
|
+
transition: opacity 0.2s;
|
|
21
|
+
border-radius: var(--td-radius-medium);
|
|
22
|
+
}
|
|
23
|
+
.t-alert.t-is-hidden {
|
|
24
|
+
/* 隐藏 */
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
.t-alert--closing {
|
|
28
|
+
opacity: 0;
|
|
29
|
+
}
|
|
30
|
+
.t-alert--info {
|
|
31
|
+
background-color: var(--td-brand-color-focus);
|
|
32
|
+
}
|
|
33
|
+
.t-alert--info .t-alert__icon {
|
|
34
|
+
color: var(--td-brand-color);
|
|
35
|
+
}
|
|
36
|
+
.t-alert--info .t-alert__swiper-trigger-wrap {
|
|
37
|
+
color: var(--td-brand-color);
|
|
38
|
+
}
|
|
39
|
+
.t-alert--info .t-alert__swiper-trigger--active {
|
|
40
|
+
color: var(--td-brand-color);
|
|
41
|
+
}
|
|
42
|
+
.t-alert--success {
|
|
43
|
+
background-color: var(--td-success-color-focus);
|
|
44
|
+
}
|
|
45
|
+
.t-alert--success .t-alert__icon {
|
|
46
|
+
color: var(--td-success-color);
|
|
47
|
+
}
|
|
48
|
+
.t-alert--success .t-alert__swiper-trigger-wrap {
|
|
49
|
+
color: var(--td-success-color-focus);
|
|
50
|
+
}
|
|
51
|
+
.t-alert--success .t-alert__swiper-trigger--active {
|
|
52
|
+
color: var(--td-success-color);
|
|
53
|
+
}
|
|
54
|
+
.t-alert--warning {
|
|
55
|
+
background-color: var(--td-warning-color-focus);
|
|
56
|
+
}
|
|
57
|
+
.t-alert--warning .t-alert__icon {
|
|
58
|
+
color: var(--td-warning-color);
|
|
59
|
+
}
|
|
60
|
+
.t-alert--warning .t-alert__swiper-trigger-wrap {
|
|
61
|
+
color: var(--td-warning-color-focus);
|
|
62
|
+
}
|
|
63
|
+
.t-alert--warning .t-alert__swiper-trigger--active {
|
|
64
|
+
color: var(--td-warning-color);
|
|
65
|
+
}
|
|
66
|
+
.t-alert--error {
|
|
67
|
+
background-color: var(--td-error-color-focus);
|
|
68
|
+
}
|
|
69
|
+
.t-alert--error .t-alert__icon {
|
|
70
|
+
color: var(--td-error-color);
|
|
71
|
+
}
|
|
72
|
+
.t-alert--error .t-alert__swiper-trigger-wrap {
|
|
73
|
+
color: var(--td-error-color-focus);
|
|
74
|
+
}
|
|
75
|
+
.t-alert--error .t-alert__swiper-trigger--active {
|
|
76
|
+
color: var(--td-error-color);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.t-alert__icon {
|
|
80
|
+
font-size: var(--td-line-height-body-medium);
|
|
81
|
+
display: inherit;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.t-alert__icon,
|
|
85
|
+
.t-alert__close {
|
|
86
|
+
-webkit-box-flex: 0;
|
|
87
|
+
-ms-flex: 0 0 auto;
|
|
88
|
+
flex: 0 0 auto;
|
|
89
|
+
line-height: var(--td-line-height-body-small);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.t-alert__content {
|
|
93
|
+
-webkit-box-flex: 1;
|
|
94
|
+
-ms-flex: 1 1 0px;
|
|
95
|
+
flex: 1 1 0;
|
|
96
|
+
font-size: var(--td-font-size-body-medium);
|
|
97
|
+
line-height: var(--td-line-height-body-medium);
|
|
98
|
+
overflow: hidden;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.t-alert__title,
|
|
102
|
+
.t-alert__message {
|
|
103
|
+
width: 100%;
|
|
104
|
+
display: -webkit-box;
|
|
105
|
+
display: -ms-flexbox;
|
|
106
|
+
display: flex;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.t-alert__title {
|
|
110
|
+
color: var(--td-text-color-primary);
|
|
111
|
+
font-weight: bold;
|
|
112
|
+
}
|
|
113
|
+
.t-alert__title + .t-alert__message {
|
|
114
|
+
margin-top: var(--td-comp-margin-s);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.t-alert__description {
|
|
118
|
+
color: var(--td-text-color-secondary);
|
|
119
|
+
-webkit-box-flex: 0;
|
|
120
|
+
-ms-flex: 0 1 auto;
|
|
121
|
+
flex: 0 1 auto;
|
|
122
|
+
-webkit-transition: height 0.2s;
|
|
123
|
+
transition: height 0.2s;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.t-alert__operation {
|
|
127
|
+
-webkit-box-flex: 0;
|
|
128
|
+
-ms-flex: 0 0 auto;
|
|
129
|
+
flex: 0 0 auto;
|
|
130
|
+
padding: 0 var(--td-comp-paddingLR-s);
|
|
131
|
+
color: var(--td-brand-color);
|
|
132
|
+
cursor: pointer;
|
|
133
|
+
-webkit-transition: color 0.2s;
|
|
134
|
+
transition: color 0.2s;
|
|
135
|
+
}
|
|
136
|
+
.t-alert__operation:hover {
|
|
137
|
+
color: var(--td-brand-color-hover);
|
|
138
|
+
}
|
|
139
|
+
.t-alert__operation:active {
|
|
140
|
+
color: var(--td-brand-color-active);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.t-alert__icon + .t-alert__content {
|
|
144
|
+
margin-left: var(--td-comp-margin-s);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.t-alert__collapse {
|
|
148
|
+
margin-top: var(--td-comp-margin-s);
|
|
149
|
+
color: var(--td-brand-color);
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.t-alert__close {
|
|
154
|
+
display: -webkit-inline-box;
|
|
155
|
+
display: -ms-inline-flexbox;
|
|
156
|
+
display: inline-flex;
|
|
157
|
+
-webkit-box-align: center;
|
|
158
|
+
-ms-flex-align: center;
|
|
159
|
+
align-items: center;
|
|
160
|
+
margin-left: var(--td-comp-margin-l);
|
|
161
|
+
color: var(--td-text-color-secondary);
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
-webkit-transition: color 0.2s;
|
|
164
|
+
transition: color 0.2s;
|
|
165
|
+
}
|
|
166
|
+
.t-alert__close:hover {
|
|
167
|
+
color: var(--td-text-color-primary);
|
|
168
|
+
}
|
|
169
|
+
.t-alert__close > .t-icon {
|
|
170
|
+
font-size: calc(var(--td-line-height-body-medium) - 2px);
|
|
171
|
+
padding: calc((var(--td-line-height-body-medium) - (var(--td-line-height-body-medium) - 2px)) / 2) 0;
|
|
172
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { _ as _defineProperty } from '../_chunks/dep-Cwish4GD.js';
|
|
2
|
+
import { _ as _objectWithoutProperties } from '../_chunks/dep-DN7d1SzH.js';
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { u as useConfig } from '../_chunks/dep-u1x3x6MJ.js';
|
|
6
|
+
import { u as useDefaultProps } from '../_chunks/dep-DGvfel3I.js';
|
|
7
|
+
import '../_chunks/dep-D-UKOauR.js';
|
|
8
|
+
import '../config-provider/ConfigContext.js';
|
|
9
|
+
|
|
10
|
+
var badgeDefaultProps = {
|
|
11
|
+
count: 0,
|
|
12
|
+
dot: false,
|
|
13
|
+
maxCount: 99,
|
|
14
|
+
shape: "circle",
|
|
15
|
+
showZero: false,
|
|
16
|
+
size: "medium"
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
var _excluded = ["color", "dot", "maxCount", "count", "size", "shape", "showZero", "offset", "className", "content", "children", "style"];
|
|
20
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
|
+
var Badge = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
23
|
+
var _useDefaultProps = useDefaultProps(props, badgeDefaultProps),
|
|
24
|
+
color = _useDefaultProps.color,
|
|
25
|
+
dot = _useDefaultProps.dot,
|
|
26
|
+
maxCount = _useDefaultProps.maxCount,
|
|
27
|
+
count = _useDefaultProps.count,
|
|
28
|
+
size = _useDefaultProps.size,
|
|
29
|
+
shape = _useDefaultProps.shape,
|
|
30
|
+
showZero = _useDefaultProps.showZero,
|
|
31
|
+
offset = _useDefaultProps.offset,
|
|
32
|
+
className = _useDefaultProps.className,
|
|
33
|
+
content = _useDefaultProps.content,
|
|
34
|
+
children = _useDefaultProps.children,
|
|
35
|
+
style = _useDefaultProps.style,
|
|
36
|
+
restProps = _objectWithoutProperties(_useDefaultProps, _excluded);
|
|
37
|
+
var _useConfig = useConfig(),
|
|
38
|
+
classPrefix = _useConfig.classPrefix;
|
|
39
|
+
var childNode = content || children;
|
|
40
|
+
var badgeClassName = classNames(!childNode && "".concat(classPrefix, "-badge--static"), dot ? "".concat(classPrefix, "-badge--dot") : "".concat(classPrefix, "-badge--").concat(shape), size === "small" && "".concat(classPrefix, "-size-s"), !childNode && className);
|
|
41
|
+
var getDisplayCount = function getDisplayCount() {
|
|
42
|
+
if (typeof count === "number" && count > maxCount) {
|
|
43
|
+
return "".concat(maxCount, "+");
|
|
44
|
+
}
|
|
45
|
+
return count;
|
|
46
|
+
};
|
|
47
|
+
var isHidden = !count;
|
|
48
|
+
if (typeof count === "number") {
|
|
49
|
+
isHidden = count < 1 && !showZero;
|
|
50
|
+
}
|
|
51
|
+
var getStyle = function getStyle() {
|
|
52
|
+
var mergedStyle = _objectSpread({}, style);
|
|
53
|
+
if (color) {
|
|
54
|
+
mergedStyle.backgroundColor = color;
|
|
55
|
+
}
|
|
56
|
+
if (offset) {
|
|
57
|
+
if (offset[0]) {
|
|
58
|
+
mergedStyle.right = +offset[0];
|
|
59
|
+
}
|
|
60
|
+
if (offset[1]) {
|
|
61
|
+
mergedStyle.marginTop = +offset[1];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return mergedStyle;
|
|
65
|
+
};
|
|
66
|
+
var badge = !isHidden ? /* @__PURE__ */React.createElement("span", _objectSpread(_objectSpread({}, childNode ? {} : restProps), {}, {
|
|
67
|
+
className: badgeClassName,
|
|
68
|
+
style: getStyle()
|
|
69
|
+
}), !dot ? getDisplayCount() : null) : null;
|
|
70
|
+
if (!childNode) {
|
|
71
|
+
return badge;
|
|
72
|
+
}
|
|
73
|
+
return /* @__PURE__ */React.createElement("span", _objectSpread(_objectSpread({}, restProps), {}, {
|
|
74
|
+
className: classNames("".concat(classPrefix, "-badge"), className),
|
|
75
|
+
ref: ref
|
|
76
|
+
}), childNode, badge);
|
|
77
|
+
});
|
|
78
|
+
Badge.displayName = "Badge";
|
|
79
|
+
|
|
80
|
+
export { Badge as default };
|
|
81
|
+
//# sourceMappingURL=Badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../../../components/badge/defaultProps.ts","../../../components/badge/Badge.tsx"],"sourcesContent":["import { TdBadgeProps } from \"./type\";\n\nexport const badgeDefaultProps: TdBadgeProps = {\n count: 0,\n dot: false,\n maxCount: 99,\n shape: \"circle\",\n showZero: false,\n size: \"medium\"\n};\n","import React, { forwardRef } from \"react\";\nimport classNames from \"classnames\";\nimport { StyledProps } from \"../common\";\nimport useConfig from \"../hooks/useConfig\";\nimport { TdBadgeProps } from \"./type\";\nimport { badgeDefaultProps } from \"./defaultProps\";\nimport useDefaultProps from \"../hooks/useDefaultProps\";\n\nexport interface BadgeProps extends TdBadgeProps, StyledProps {}\n\nconst Badge = forwardRef<HTMLSpanElement, BadgeProps>((props, ref) => {\n const {\n color,\n dot,\n maxCount,\n count,\n size,\n shape,\n showZero,\n offset,\n className,\n content,\n children,\n style,\n ...restProps\n } = useDefaultProps<BadgeProps>(props, badgeDefaultProps);\n const { classPrefix } = useConfig();\n\n const childNode = content || children;\n\n const badgeClassName = classNames(\n !childNode && `${classPrefix}-badge--static`,\n dot ? `${classPrefix}-badge--dot` : `${classPrefix}-badge--${shape}`,\n size === \"small\" && `${classPrefix}-size-s`,\n !childNode && className\n );\n const getDisplayCount = () => {\n if (typeof count === \"number\" && count > maxCount) {\n return `${maxCount}+`;\n }\n return count;\n };\n\n let isHidden = !count;\n if (typeof count === \"number\") {\n isHidden = count < 1 && !showZero;\n }\n\n const getStyle = () => {\n const mergedStyle: React.CSSProperties = { ...style };\n if (color) {\n mergedStyle.backgroundColor = color;\n }\n if (offset) {\n if (offset[0]) {\n mergedStyle.right = +offset[0];\n }\n if (offset[1]) {\n mergedStyle.marginTop = +offset[1];\n }\n }\n return mergedStyle;\n };\n\n const badge = !isHidden ? (\n <span {...(childNode ? {} : restProps)} className={badgeClassName} style={getStyle()}>\n {!dot ? getDisplayCount() : null}\n </span>\n ) : null;\n\n if (!childNode) {\n return badge;\n }\n\n return (\n <span {...restProps} className={classNames(`${classPrefix}-badge`, className)} ref={ref}>\n {childNode}\n {badge}\n </span>\n );\n});\n\nBadge.displayName = \"Badge\";\n\nexport default Badge;\n"],"names":["badgeDefaultProps","count","dot","maxCount","shape","showZero","size","Badge","forwardRef","props","ref","_useDefaultProps","useDefaultProps","color","offset","className","content","children","style","restProps","_objectWithoutProperties","_excluded","_useConfig","useConfig","classPrefix","childNode","badgeClassName","classNames","concat","getDisplayCount","isHidden","getStyle","mergedStyle","_objectSpread","backgroundColor","right","marginTop","badge","React","createElement","displayName"],"mappings":";;;;;;;;;AAEO,IAAMA,iBAAA,GAAkC;AAC7CC,EAAAA,KAAA,EAAO,CAAA;AACPC,EAAAA,GAAA,EAAK,KAAA;AACLC,EAAAA,QAAA,EAAU,EAAA;AACVC,EAAAA,KAAA,EAAO,QAAA;AACPC,EAAAA,QAAA,EAAU,KAAA;AACVC,EAAAA,IAAA,EAAM;AACR,CAAA;;;;;ACCA,IAAMC,KAAA,gBAAQC,UAAA,CAAwC,UAACC,KAAA,EAAOC,GAAA,EAAQ;AACpE,EAAA,IAAAC,gBAAA,GAcIC,eAAA,CAA4BH,KAAA,EAAOT,iBAAiB,CAAA;IAbtDa,KAAA,GAAAF,gBAAA,CAAAE,KAAA;IACAX,GAAA,GAAAS,gBAAA,CAAAT,GAAA;I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,KACH,CAAA;AAEJ,CAAC;AAED9B,KAAA,CAAMiC,WAAA,GAAc,OAAA;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Badge$1 from './Badge.js';
|
|
2
|
+
import './style/css.js';
|
|
3
|
+
import '../_chunks/dep-Cwish4GD.js';
|
|
4
|
+
import '../_chunks/dep-D-UKOauR.js';
|
|
5
|
+
import '../_chunks/dep-DN7d1SzH.js';
|
|
6
|
+
import 'react';
|
|
7
|
+
import 'classnames';
|
|
8
|
+
import '../_chunks/dep-u1x3x6MJ.js';
|
|
9
|
+
import '../config-provider/ConfigContext.js';
|
|
10
|
+
import '../_chunks/dep-DGvfel3I.js';
|
|
11
|
+
|
|
12
|
+
var Badge = Badge$1;
|
|
13
|
+
|
|
14
|
+
export { Badge, Badge as default };
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../components/badge/index.ts"],"sourcesContent":["import _Badge from \"./Badge\";\n\nimport \"./style/index.js\";\n\nexport type { BadgeProps } from \"./Badge\";\nexport * from \"./type\";\n\nexport const Badge = _Badge;\nexport default Badge;\n"],"names":["Badge","_Badge"],"mappings":";;;;;;;;;;;AAOO,IAAMA,KAAA,GAAQC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.css";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.t-badge {
|
|
2
|
+
font: var(--td-font-body-medium);
|
|
3
|
+
color: var(--td-text-color-primary);
|
|
4
|
+
-webkit-box-sizing: border-box;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
margin: 0;
|
|
7
|
+
padding: 0;
|
|
8
|
+
list-style: none;
|
|
9
|
+
position: relative;
|
|
10
|
+
display: inline-block;
|
|
11
|
+
}
|
|
12
|
+
.t-badge--dot, .t-badge--circle, .t-badge--round {
|
|
13
|
+
position: absolute;
|
|
14
|
+
top: 0;
|
|
15
|
+
right: 0;
|
|
16
|
+
color: var(--td-text-color-anti);
|
|
17
|
+
text-align: center;
|
|
18
|
+
font: var(--td-font-body-small);
|
|
19
|
+
-webkit-transform: translate(50%, -50%);
|
|
20
|
+
transform: translate(50%, -50%);
|
|
21
|
+
-webkit-transform-origin: 100% 0;
|
|
22
|
+
transform-origin: 100% 0;
|
|
23
|
+
-webkit-box-sizing: content-box;
|
|
24
|
+
box-sizing: content-box;
|
|
25
|
+
}
|
|
26
|
+
.t-badge--static {
|
|
27
|
+
position: static;
|
|
28
|
+
display: inline-block;
|
|
29
|
+
-webkit-transform: none;
|
|
30
|
+
transform: none;
|
|
31
|
+
}
|
|
32
|
+
.t-badge--dot {
|
|
33
|
+
right: 1px;
|
|
34
|
+
margin-top: 1px;
|
|
35
|
+
width: 6px;
|
|
36
|
+
height: 6px;
|
|
37
|
+
border-radius: var(--td-radius-circle);
|
|
38
|
+
background-color: var(--td-error-color);
|
|
39
|
+
}
|
|
40
|
+
.t-badge--circle, .t-badge--round {
|
|
41
|
+
padding-right: calc((var(--td-comp-size-xxs) - 8px) / 2);
|
|
42
|
+
padding-left: calc((var(--td-comp-size-xxs) - 8px) / 2);
|
|
43
|
+
min-width: 8px;
|
|
44
|
+
height: var(--td-comp-size-xxs);
|
|
45
|
+
background-color: var(--td-error-color);
|
|
46
|
+
line-height: var(--td-comp-size-xxs);
|
|
47
|
+
}
|
|
48
|
+
.t-badge--circle.t-size-s, .t-badge--round.t-size-s {
|
|
49
|
+
padding-right: calc((var(--td-comp-size-xxxs) - 8px) / 2);
|
|
50
|
+
padding-left: calc((var(--td-comp-size-xxxs) - 8px) / 2);
|
|
51
|
+
min-width: 8px;
|
|
52
|
+
height: var(--td-comp-size-xxxs);
|
|
53
|
+
line-height: var(--td-comp-size-xxxs);
|
|
54
|
+
}
|
|
55
|
+
.t-badge--circle {
|
|
56
|
+
border-radius: calc(var(--td-comp-size-xxs) / 2);
|
|
57
|
+
}
|
|
58
|
+
.t-badge--round {
|
|
59
|
+
border-radius: var(--td-radius-default);
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { _ as _defineProperty } from '../_chunks/dep-Cwish4GD.js';
|
|
2
|
+
import { _ as _objectWithoutProperties } from '../_chunks/dep-DN7d1SzH.js';
|
|
3
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { u as useConfig } from '../_chunks/dep-u1x3x6MJ.js';
|
|
6
|
+
import { Loading } from '../loading/index.js';
|
|
7
|
+
import { p as parseTNode } from '../_chunks/dep-D6YxJv-F.js';
|
|
8
|
+
import { u as useDefaultProps } from '../_chunks/dep-DGvfel3I.js';
|
|
9
|
+
import '../_chunks/dep-D-UKOauR.js';
|
|
10
|
+
import '../config-provider/ConfigContext.js';
|
|
11
|
+
import '../loading/Loading.js';
|
|
12
|
+
import '../_chunks/dep-CzLhKWCf.js';
|
|
13
|
+
import '../_chunks/dep-0QH2Ee4R.js';
|
|
14
|
+
import 'lodash-es';
|
|
15
|
+
import '../common/Portal.js';
|
|
16
|
+
import 'react-dom';
|
|
17
|
+
import '../loading/Gradient.js';
|
|
18
|
+
import '../_chunks/dep-DHWwZ2Nj.js';
|
|
19
|
+
import '../_chunks/dep-PPA-yoAy.js';
|
|
20
|
+
import '../_chunks/dep-BH5n5r1M.js';
|
|
21
|
+
import '../loading/style/css.js';
|
|
22
|
+
|
|
23
|
+
var buttonDefaultProps = {
|
|
24
|
+
block: false,
|
|
25
|
+
disabled: false,
|
|
26
|
+
form: void 0,
|
|
27
|
+
ghost: false,
|
|
28
|
+
loading: false,
|
|
29
|
+
shape: "rectangle",
|
|
30
|
+
size: "medium",
|
|
31
|
+
type: "button",
|
|
32
|
+
variant: "base"
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var _excluded = ["type", "theme", "variant", "icon", "disabled", "loading", "size", "block", "ghost", "shape", "children", "content", "className", "suffix", "href", "tag", "onClick"];
|
|
36
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
37
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
38
|
+
var Button = /*#__PURE__*/forwardRef(function (originProps, ref) {
|
|
39
|
+
var props = useDefaultProps(originProps, buttonDefaultProps);
|
|
40
|
+
var type = props.type,
|
|
41
|
+
theme = props.theme,
|
|
42
|
+
variant = props.variant,
|
|
43
|
+
icon = props.icon,
|
|
44
|
+
disabled = props.disabled,
|
|
45
|
+
loading = props.loading,
|
|
46
|
+
size = props.size,
|
|
47
|
+
block = props.block,
|
|
48
|
+
ghost = props.ghost,
|
|
49
|
+
shape = props.shape,
|
|
50
|
+
children = props.children,
|
|
51
|
+
content = props.content,
|
|
52
|
+
className = props.className,
|
|
53
|
+
suffix = props.suffix,
|
|
54
|
+
href = props.href,
|
|
55
|
+
tag = props.tag,
|
|
56
|
+
onClick = props.onClick,
|
|
57
|
+
buttonProps = _objectWithoutProperties(props, _excluded);
|
|
58
|
+
var _useConfig = useConfig(),
|
|
59
|
+
classPrefix = _useConfig.classPrefix;
|
|
60
|
+
var renderChildren = content !== null && content !== void 0 ? content : children;
|
|
61
|
+
var iconNode = icon;
|
|
62
|
+
if (loading) iconNode = /* @__PURE__ */React.createElement(Loading, {
|
|
63
|
+
loading: loading,
|
|
64
|
+
inheritColor: true
|
|
65
|
+
});
|
|
66
|
+
var renderTheme = useMemo(function () {
|
|
67
|
+
if (!theme) {
|
|
68
|
+
if (variant === "base") return "primary";
|
|
69
|
+
return "default";
|
|
70
|
+
}
|
|
71
|
+
return theme;
|
|
72
|
+
}, [theme, variant]);
|
|
73
|
+
var renderTag = useMemo(function () {
|
|
74
|
+
if (!tag && href && !disabled) return "a";
|
|
75
|
+
if (!tag && disabled) return "div";
|
|
76
|
+
return tag || "button";
|
|
77
|
+
}, [tag, href, disabled]);
|
|
78
|
+
return /*#__PURE__*/React.createElement(renderTag, _objectSpread(_objectSpread({}, buttonProps), {}, {
|
|
79
|
+
href: href,
|
|
80
|
+
type: type,
|
|
81
|
+
ref: ref,
|
|
82
|
+
disabled: disabled || loading,
|
|
83
|
+
className: classNames(className, ["".concat(classPrefix, "-button"), "".concat(classPrefix, "-button--theme-").concat(renderTheme), "".concat(classPrefix, "-button--variant-").concat(variant)], _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(classPrefix, "-button--shape-").concat(shape), shape !== "rectangle"), "".concat(classPrefix, "-button--ghost"), ghost), "".concat(classPrefix, "-is-loading"), loading), "".concat(classPrefix, "-is-disabled"), disabled), "".concat(classPrefix, "-size-s"), size === "small"), "".concat(classPrefix, "-size-l"), size === "large"), "".concat(classPrefix, "-size-full-width"), block)),
|
|
84
|
+
onClick: !disabled && !loading ? onClick : void 0
|
|
85
|
+
}), /* @__PURE__ */React.createElement(React.Fragment, null, iconNode, renderChildren && /* @__PURE__ */React.createElement("span", {
|
|
86
|
+
className: "".concat(classPrefix, "-button__text")
|
|
87
|
+
}, renderChildren), suffix && /* @__PURE__ */React.createElement("span", {
|
|
88
|
+
className: "".concat(classPrefix, "-button__suffix")
|
|
89
|
+
}, parseTNode(suffix))));
|
|
90
|
+
});
|
|
91
|
+
Button.displayName = "Button";
|
|
92
|
+
|
|
93
|
+
export { Button as default };
|
|
94
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../components/button/defaultProps.ts","../../../components/button/Button.tsx"],"sourcesContent":["import { TdButtonProps } from \"./type\";\n\nexport const buttonDefaultProps: TdButtonProps = {\n block: false,\n disabled: false,\n form: undefined,\n ghost: false,\n loading: false,\n shape: \"rectangle\",\n size: \"medium\",\n type: \"button\",\n variant: \"base\"\n};\n","import React, { useMemo, forwardRef } from \"react\";\nimport classNames from \"classnames\";\nimport useConfig from \"../hooks/useConfig\";\nimport Loading from \"../loading\";\nimport { TdButtonProps } from \"./type\";\nimport { buttonDefaultProps } from \"./defaultProps\";\nimport parseTNode from \"../utils/parseTNode\";\nimport useDefaultProps from \"../hooks/useDefaultProps\";\n\nexport interface ButtonProps\n extends Omit<React.AllHTMLAttributes<HTMLElement>, \"content\" | \"shape\" | \"size\" | \"type\" | \"children\">,\n TdButtonProps {}\n\nconst Button = forwardRef((originProps: ButtonProps, ref: React.ForwardedRef<HTMLElement>) => {\n const props = useDefaultProps(originProps, buttonDefaultProps);\n const {\n type,\n theme,\n variant,\n icon,\n disabled,\n loading,\n size,\n block,\n ghost,\n shape,\n children,\n content,\n className,\n suffix,\n href,\n tag,\n onClick,\n ...buttonProps\n } = props;\n\n const { classPrefix } = useConfig();\n\n const renderChildren = content ?? children;\n\n let iconNode = icon;\n if (loading) iconNode = <Loading loading={loading} inheritColor={true} />;\n\n const renderTheme = useMemo(() => {\n if (!theme) {\n if (variant === \"base\") return \"primary\";\n return \"default\";\n }\n return theme;\n }, [theme, variant]);\n\n const renderTag = useMemo(() => {\n if (!tag && href && !disabled) return \"a\";\n if (!tag && disabled) return \"div\";\n return tag || \"button\";\n }, [tag, href, disabled]);\n\n return React.createElement(\n renderTag,\n {\n ...buttonProps,\n href,\n type,\n ref,\n disabled: disabled || loading,\n className: classNames(\n className,\n [\n `${classPrefix}-button`,\n `${classPrefix}-button--theme-${renderTheme}`,\n `${classPrefix}-button--variant-${variant}`\n ],\n {\n [`${classPrefix}-button--shape-${shape}`]: shape !== \"rectangle\",\n [`${classPrefix}-button--ghost`]: ghost,\n [`${classPrefix}-is-loading`]: loading,\n [`${classPrefix}-is-disabled`]: disabled,\n [`${classPrefix}-size-s`]: size === \"small\",\n [`${classPrefix}-size-l`]: size === \"large\",\n [`${classPrefix}-size-full-width`]: block\n }\n ),\n onClick: !disabled && !loading ? onClick : undefined\n },\n <>\n {iconNode}\n {renderChildren && <span className={`${classPrefix}-button__text`}>{renderChildren}</span>}\n {suffix && <span className={`${classPrefix}-button__suffix`}>{parseTNode(suffix)}</span>}\n </>\n );\n});\n\nButton.displayName = \"Button\";\n\nexport default Button;\n"],"names":["buttonDefaultProps","block","disabled","form","ghost","loading","shape","size","type","variant","Button","forwardRef","originProps","ref","props","useDefaultProps","theme","icon","children","content","className","suffix","href","tag","onClick","buttonProps","_objectWithoutProperties","_excluded","_useConfig","useConfig","classPrefix","renderChildren","iconNode","React","createElement","Loading","inheritColor","renderTheme","useMemo","renderTag","_objectSpread","classNames","concat","_defineProperty","Fragment","parseTNode","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEO,IAAMA,kBAAA,GAAoC;AAC/CC,EAAAA,KAAA,EAAO,KAAA;AACPC,EAAAA,QAAA,EAAU,KAAA;EACVC,IAAA,EAAM,KAAA,CAAA;AACNC,EAAAA,KAAA,EAAO,KAAA;AACPC,EAAAA,OAAA,EAAS,KAAA;AACTC,EAAAA,KAAA,EAAO,WAAA;AACPC,EAAAA,IAAA,EAAM,QAAA;AACNC,EAAAA,IAAA,EAAM,QAAA;AACNC,EAAAA,OAAA,EAAS;AACX,CAAA;;;;;ACCA,IAAMC,MAAA,gBAASC,UAAA,CAAW,UAACC,WAAA,EAA0BC,GAAA,EAAyC;AAC5F,EAAA,IAAMC,KAAA,GAAQC,eAAA,CAAgBH,WAAA,EAAaZ,kBAAkB,CAAA;AAC7D,EAAA,IACEQ,IAAA,GAkBEM,KAAA,CAlBFN,IAAA;I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,WAAW,EAAA,cAAA,CAAA,EAAiB5B,QAAA,MAAAwC,MAAA,CAC5BZ,WAAW,EAAA,SAAA,CAAA,EAAYvB,IAAA,KAAS,OAAA,CAAA,EAAA,EAAA,CAAAmC,MAAA,CAChCZ,WAAW,cAAYvB,IAAA,KAAS,OAAA,CAAA,EAAA,EAAA,CAAAmC,MAAA,CAChCZ,WAAW,EAAA,kBAAA,CAAA,EAAqB7B,KAAA,CAExC,CAAA;IACAuB,OAAA,EAAS,CAACtB,QAAA,IAAY,CAACG,UAAUmB,OAAA,GAAU,KAAA;GAAA,CAAA,iBAE7CS,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAW,QAAA,EAAA,IAAA,EACGZ,UACAD,cAAA,mBAAkBE,KAAA,CAAAC,aAAA,CAAC;IAAKd,SAAA,EAAA,EAAA,CAAAsB,MAAA,CAAcZ,WAAW,EAAA,eAAA;AAAA,GAAA,EAAkBC,cAAe,GAClFV,MAAA,mBAAUY,KAAA,CAAAC,aAAA,CAAC;IAAKd,SAAA,EAAA,EAAA,CAAAsB,MAAA,CAAcZ,WAAW,EAAA,iBAAA;AAAA,GAAA,EAAoBe,UAAA,CAAWxB,MAAM,CAAE,CACnF,CACF,CAAA;AACF,CAAC;AAEDX,MAAA,CAAOoC,WAAA,GAAc,QAAA;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Button$1 from './Button.js';
|
|
2
|
+
import './style/css.js';
|
|
3
|
+
import '../_chunks/dep-Cwish4GD.js';
|
|
4
|
+
import '../_chunks/dep-D-UKOauR.js';
|
|
5
|
+
import '../_chunks/dep-DN7d1SzH.js';
|
|
6
|
+
import 'react';
|
|
7
|
+
import 'classnames';
|
|
8
|
+
import '../_chunks/dep-u1x3x6MJ.js';
|
|
9
|
+
import '../config-provider/ConfigContext.js';
|
|
10
|
+
import '../loading/index.js';
|
|
11
|
+
import '../loading/Loading.js';
|
|
12
|
+
import '../_chunks/dep-CzLhKWCf.js';
|
|
13
|
+
import '../_chunks/dep-0QH2Ee4R.js';
|
|
14
|
+
import 'lodash-es';
|
|
15
|
+
import '../common/Portal.js';
|
|
16
|
+
import 'react-dom';
|
|
17
|
+
import '../loading/Gradient.js';
|
|
18
|
+
import '../_chunks/dep-DHWwZ2Nj.js';
|
|
19
|
+
import '../_chunks/dep-PPA-yoAy.js';
|
|
20
|
+
import '../_chunks/dep-DGvfel3I.js';
|
|
21
|
+
import '../_chunks/dep-BH5n5r1M.js';
|
|
22
|
+
import '../loading/style/css.js';
|
|
23
|
+
import '../_chunks/dep-D6YxJv-F.js';
|
|
24
|
+
|
|
25
|
+
var Button = Button$1;
|
|
26
|
+
|
|
27
|
+
export { Button, Button as default };
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../components/button/index.ts"],"sourcesContent":["import _Button from \"./Button\";\n\nimport \"./style/index\";\nexport type { ButtonProps } from \"./Button\";\nexport const Button = _Button;\nexport * from \"./type\";\nexport default Button;\n"],"names":["Button","_Button"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAIO,IAAMA,MAAA,GAASC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.css";
|