@king-design/intact 2.0.15 → 3.0.0-beta.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.
Files changed (177) hide show
  1. package/components/button/styles.ts +4 -1
  2. package/components/card/styles.ts +3 -2
  3. package/components/checkbox/styles.ts +31 -6
  4. package/components/collapse/styles.ts +4 -1
  5. package/components/datepicker/styles.ts +3 -1
  6. package/components/dialog/base.vdt +4 -5
  7. package/components/dialog/styles.ts +18 -13
  8. package/components/drawer/styles.ts +20 -10
  9. package/components/dropdown/styles.ts +1 -1
  10. package/components/form/styles.ts +1 -1
  11. package/components/icon/demos/disabled.md +21 -0
  12. package/components/icon/demos/icons.md +87 -116
  13. package/components/icon/index.md +1 -0
  14. package/components/icon/index.ts +2 -0
  15. package/components/icon/index.vdt +6 -2
  16. package/components/icon/styles.ts +8 -1
  17. package/components/input/styles.ts +14 -20
  18. package/components/message/demos/basic.md +1 -1
  19. package/components/message/demos/duration.md +3 -3
  20. package/components/message/index.md +1 -1
  21. package/components/message/message.ts +2 -2
  22. package/components/message/message.vdt +6 -6
  23. package/components/message/styles.ts +10 -19
  24. package/components/pagination/index.vdt +9 -9
  25. package/components/pagination/styles.ts +11 -7
  26. package/components/radio/styles.ts +28 -9
  27. package/components/select/base.vdt +4 -5
  28. package/components/select/demos/basic.md +1 -1
  29. package/components/select/index.md +1 -1
  30. package/components/select/styles.ts +4 -27
  31. package/components/spinner/index.vdt +6 -4
  32. package/components/spinner/styles.ts +36 -36
  33. package/components/steps/demos/basic.md +2 -1
  34. package/components/steps/demos/clickable.md +6 -0
  35. package/components/steps/demos/error.md +25 -5
  36. package/components/steps/demos/line.md +7 -6
  37. package/components/steps/demos/simple.md +0 -6
  38. package/components/steps/index.md +1 -1
  39. package/components/steps/index.ts +4 -4
  40. package/components/steps/index.vdt +1 -0
  41. package/components/steps/step.vdt +16 -13
  42. package/components/steps/styles.ts +297 -259
  43. package/components/switch/demos/basic.md +1 -2
  44. package/components/switch/demos/disabled.md +20 -0
  45. package/components/switch/demos/onOff.md +5 -0
  46. package/components/switch/styles.ts +29 -37
  47. package/components/table/column.vdt +26 -10
  48. package/components/table/demos/rowExpandable.md +1 -1
  49. package/components/table/demos/selectedKeys.md +1 -1
  50. package/components/table/index.md +3 -3
  51. package/components/table/index.spec.ts +2 -2
  52. package/components/table/styles.ts +17 -6
  53. package/components/table/useGroup.ts +18 -2
  54. package/components/table/useSortable.ts +4 -1
  55. package/components/tabs/demos/basic.md +0 -1
  56. package/components/tabs/index.ts +2 -2
  57. package/components/tabs/index.vdt +3 -3
  58. package/components/tabs/styles.ts +202 -152
  59. package/components/tag/base.ts +1 -1
  60. package/components/tag/demos/border.md +2 -2
  61. package/components/tag/index.md +1 -1
  62. package/components/tag/styles.ts +12 -11
  63. package/components/tip/index.vdt +1 -3
  64. package/components/tip/styles.ts +8 -2
  65. package/components/tooltip/content.vdt +1 -1
  66. package/components/tooltip/styles.ts +8 -6
  67. package/components/transfer/index.vdt +3 -2
  68. package/components/transfer/styles.ts +1 -0
  69. package/components/transfer/useCheck.ts +9 -2
  70. package/components/upload/demos/manually.md +12 -13
  71. package/components/upload/index.vdt +40 -34
  72. package/components/upload/styles.ts +60 -64
  73. package/es/components/button/styles.js +2 -2
  74. package/es/components/card/styles.js +10 -2
  75. package/es/components/checkbox/styles.js +21 -10
  76. package/es/components/collapse/styles.js +6 -1
  77. package/es/components/datepicker/styles.d.ts +1 -1
  78. package/es/components/datepicker/styles.js +4 -1
  79. package/es/components/dialog/base.vdt.js +5 -6
  80. package/es/components/dialog/styles.js +16 -14
  81. package/es/components/drawer/styles.js +20 -5
  82. package/es/components/dropdown/styles.js +1 -1
  83. package/es/components/form/styles.js +1 -1
  84. package/es/components/icon/index.d.ts +1 -0
  85. package/es/components/icon/index.js +2 -1
  86. package/es/components/icon/index.vdt.js +4 -2
  87. package/es/components/icon/styles.js +10 -2
  88. package/es/components/input/styles.js +1 -11
  89. package/es/components/message/message.js +1 -1
  90. package/es/components/message/message.vdt.js +7 -6
  91. package/es/components/message/styles.js +8 -8
  92. package/es/components/pagination/index.vdt.js +8 -8
  93. package/es/components/pagination/styles.js +11 -2
  94. package/es/components/radio/styles.js +16 -6
  95. package/es/components/select/base.vdt.js +5 -6
  96. package/es/components/select/styles.js +4 -24
  97. package/es/components/spinner/index.vdt.js +6 -4
  98. package/es/components/spinner/styles.js +33 -5
  99. package/es/components/steps/index.d.ts +2 -2
  100. package/es/components/steps/index.js +2 -2
  101. package/es/components/steps/index.vdt.js +1 -0
  102. package/es/components/steps/step.vdt.js +17 -8
  103. package/es/components/steps/styles.d.ts +1 -1
  104. package/es/components/steps/styles.js +80 -75
  105. package/es/components/switch/styles.js +20 -34
  106. package/es/components/table/column.vdt.js +43 -7
  107. package/es/components/table/index.spec.js +2 -2
  108. package/es/components/table/styles.js +16 -5
  109. package/es/components/table/useGroup.d.ts +3 -0
  110. package/es/components/table/useGroup.js +24 -1
  111. package/es/components/table/useSortable.d.ts +3 -1
  112. package/es/components/table/useSortable.js +4 -1
  113. package/es/components/tabs/index.d.ts +1 -1
  114. package/es/components/tabs/index.js +1 -1
  115. package/es/components/tabs/index.vdt.js +1 -1
  116. package/es/components/tabs/styles.js +68 -22
  117. package/es/components/tag/base.js +1 -1
  118. package/es/components/tag/styles.js +15 -10
  119. package/es/components/tip/index.vdt.js +1 -3
  120. package/es/components/tip/styles.js +4 -3
  121. package/es/components/tooltip/content.vdt.js +4 -4
  122. package/es/components/tooltip/styles.js +12 -7
  123. package/es/components/transfer/index.vdt.js +3 -1
  124. package/es/components/transfer/styles.js +1 -1
  125. package/es/components/transfer/useCheck.d.ts +1 -0
  126. package/es/components/transfer/useCheck.js +8 -1
  127. package/es/components/upload/index.vdt.js +21 -20
  128. package/es/components/upload/styles.js +22 -30
  129. package/es/i18n/en-US.d.ts +2 -1
  130. package/es/i18n/en-US.js +2 -1
  131. package/es/index.d.ts +2 -2
  132. package/es/index.js +2 -2
  133. package/es/site/data/components/icon/demos/disabled/index.d.ts +6 -0
  134. package/es/site/data/components/icon/demos/disabled/index.js +18 -0
  135. package/es/site/data/components/icon/demos/disabled/react.d.ts +5 -0
  136. package/es/site/data/components/icon/demos/disabled/react.js +33 -0
  137. package/es/site/data/components/icon/demos/icons/index.js +1 -1
  138. package/es/site/data/components/icon/demos/icons/react.js +1 -1
  139. package/es/site/data/components/menu/demos/collapse/react.d.ts +11 -0
  140. package/es/site/data/components/menu/demos/size/react.d.ts +7 -0
  141. package/es/site/data/components/message/demos/duration/index.js +2 -2
  142. package/es/site/data/components/message/demos/duration/react.js +2 -2
  143. package/es/site/data/components/select/demos/basic/react.js +1 -2
  144. package/es/site/data/components/steps/demos/basic/react.js +1 -1
  145. package/es/site/data/components/steps/demos/clickable/react.js +15 -0
  146. package/es/site/data/components/steps/demos/error/react.js +22 -2
  147. package/es/site/data/components/steps/demos/line/react.js +15 -11
  148. package/es/site/data/components/steps/demos/simple/react.js +1 -11
  149. package/es/site/data/components/switch/demos/basic/react.js +0 -2
  150. package/es/site/data/components/switch/demos/disabled/index.d.ts +6 -0
  151. package/es/site/data/components/switch/demos/disabled/index.js +18 -0
  152. package/es/site/data/components/switch/demos/disabled/react.d.ts +5 -0
  153. package/es/site/data/components/switch/demos/disabled/react.js +27 -0
  154. package/es/site/data/components/switch/demos/onOff/react.js +13 -0
  155. package/es/site/data/components/tag/demos/border/index.js +1 -1
  156. package/es/site/data/components/tag/demos/border/react.js +1 -1
  157. package/es/site/data/components/upload/demos/manually/react.js +5 -7
  158. package/es/site/src/pages/document/index.js +3 -2
  159. package/es/site/src/pages/document/styles.js +1 -1
  160. package/es/styles/fonts/iconfont.eot +0 -0
  161. package/es/styles/fonts/iconfont.js +1 -1
  162. package/es/styles/fonts/iconfont.svg +189 -369
  163. package/es/styles/fonts/iconfont.ttf +0 -0
  164. package/es/styles/fonts/iconfont.woff +0 -0
  165. package/es/styles/theme.d.ts +10 -2
  166. package/es/styles/theme.js +23 -21
  167. package/i18n/en-US.ts +2 -1
  168. package/index.ts +2 -2
  169. package/package.json +4 -3
  170. package/styles/fonts/iconfont.css +172 -289
  171. package/styles/fonts/iconfont.eot +0 -0
  172. package/styles/fonts/iconfont.svg +189 -369
  173. package/styles/fonts/iconfont.ts +255 -369
  174. package/styles/fonts/iconfont.ttf +0 -0
  175. package/styles/fonts/iconfont.woff +0 -0
  176. package/styles/fonts/iconfont.woff2 +0 -0
  177. package/styles/theme.ts +23 -19
@@ -4,75 +4,59 @@ import {deepDefaults} from '../../styles/utils';
4
4
  import '../../styles/global';
5
5
 
6
6
  const defaults = {
7
- get transition() { return theme.transition.middle },
8
- get height() { return theme.default.height },
9
- get bgColor() { return theme.color.bg },
10
- gutter: '10px',
11
- gapTop: '-2px',
7
+ gap: '10px',
8
+ get titleColor() { return theme.color.title },
9
+ get desColor() { return theme.color.lightBlack },
10
+ get markColor() { return theme.color.placeholder },
11
+ get markborder() { return `1px solid ${theme.color.placeholder}` },
12
+ markBgColor: '#fff',
12
13
 
13
- // head
14
- head: {
15
- innerWidth: '16px',
16
- get innerBorder() { return `1px solid ${theme.color.placeholder}` },
17
- iconFontSize: '24px',
18
- paddingRight: '10px',
19
- },
20
-
21
- main: {
22
- get color() { return theme.color.text },
23
- get titlePaddingRight() { return steps.head.paddingRight },
24
- contentFontSize: '12px',
14
+ default: {
15
+ get height() { return theme.default.height },
16
+ get bgColor() { return theme.color.bg },
17
+ markWidth: '16px',
25
18
  },
26
19
 
27
20
  // done
28
21
  done: {
29
- get headColor() { return theme.color.primary },
30
- get headInnerBorderColor() { return theme.color.primary },
31
- headInnerBgColor: 'transparent',
32
- get mainColor() { return theme.color.primary },
33
- get simpleColor() { return theme.color.text },
22
+ get markColor() { return theme.color.primary },
23
+ get markBorderColor() { return theme.color.primary },
24
+ markBgColor: '#fff',
25
+ get mainColor() { return theme.color.primary },
34
26
  },
35
27
 
36
28
  // active
37
29
  active: {
38
- headColor: '#fff',
39
- get headInnerBorderColor() { return theme.color.primary },
40
- get headInnerBgColor() { return theme.color.primary },
30
+ markColor: '#fff',
31
+ get markBorderColor() { return theme.color.primary },
32
+ get markBgColor() { return theme.color.primary },
41
33
  get mainColor() { return theme.color.primary },
42
- get simpleColor() { return theme.color.primary },
43
34
  },
44
35
 
45
36
  // error
46
37
  error: {
47
- get headColor() { return theme.color.danger },
48
- get headInnerBorderColor() { return theme.color.danger },
49
- headInnerBgColor: 'transparent',
38
+ get markColor() { return theme.color.danger },
39
+ get markBorderColor() { return theme.color.danger },
40
+ markBgColor: '#fff',
50
41
  get mainColor() { return theme.color.danger },
51
- get simpleColor() { return theme.color.danger },
52
42
  },
53
43
 
54
44
  // line
55
45
  line: {
56
- bgColor: '#fff',
57
- mainContentGap: '5px 0 0',
58
- get tailBgColor() { return theme.color.placeholder },
59
- get doneTailBgColor() { return theme.color.primary },
60
- innerWidth: '32px',
61
- innerLineHeight: '30px',
62
- innerFontSize: '18px',
63
- headTop: '16px',
64
- titleFontSize: '14px',
65
- titleGopTop: '16px',
66
- iconLineHeight: '30px',
67
- tailTop: '16px',
68
- width: '160px',
46
+ markWidth: '32px',
47
+ markFontSize: '24px',
48
+ get lineColor() { return theme.color.border},
49
+ titleGap: '16px',
50
+ descGap: '4px',
51
+ contentMaxWidth: '200px',
69
52
  },
70
53
 
71
54
  // simple
72
55
  simple: {
73
- fontSize: '14px',
74
- get color() { return theme.color.disabled },
75
- headPaddingRight: '6px',
56
+ markWidth: '12px',
57
+ get markBgColor() { return theme.color.placeholder },
58
+ get doneMarkBgColor() { return theme.color.primary },
59
+ get errorMarkBgColor() { return theme.color.danger },
76
60
  }
77
61
  };
78
62
 
@@ -86,256 +70,310 @@ const stepStatus = ['done', 'active', 'error'] as const;
86
70
  export function makeStepsStyles() {
87
71
  return css`
88
72
  display: flex;
89
- // default and line type
90
- &.k-default,
91
- &.k-line {
92
- .k-step-head {
93
- padding-right: ${steps.head.paddingRight};
73
+
74
+ ${makeCommonStyles()};
75
+
76
+ &.k-default {
77
+ ${makeDefaultStyles()};
78
+ }
79
+
80
+ &.k-line,
81
+ &.k-line-compact,
82
+ &.k-simple {
83
+ ${makeLineStyles()};
84
+ }
85
+
86
+ &.k-line-compact {
87
+ ${makeLineCompactStyles()};
88
+ }
89
+
90
+ &.k-simple {
91
+ ${makeSimpleStyles()};
92
+ }
93
+
94
+ // clickable
95
+ &.k-clickable {
96
+ .k-done {
97
+ cursor: pointer;
94
98
  }
95
- .k-step-inner {
96
- width: ${steps.head.innerWidth};
97
- height: ${steps.head.innerWidth};
98
- line-height: calc(${steps.head.innerWidth} - 2px);
99
- border-radius: 50%;
100
- text-align: center;
101
- border: ${steps.head.innerBorder};
99
+ }
100
+ `;
101
+ }
102
+
103
+ function makeDefaultStyles() {
104
+ const defaults = steps.default;
105
+
106
+ return css`
107
+ text-align: center;
108
+ height: ${defaults.height};
109
+ background: ${defaults.bgColor};
110
+
111
+ .k-step-wrapper {
112
+ ${center()};
113
+ height: 100%;
114
+ }
115
+ .k-step-mark {
116
+ width: ${defaults.markWidth};
117
+ height: ${defaults.markWidth};
118
+ margin-right: ${steps.gap};
119
+ }
120
+ .k-step-main {
121
+ display: flex;
122
+ overflow: hidden;
123
+ white-space: nowrap;
124
+ }
125
+ .k-step-title {
126
+ padding-right: ${steps.gap};
127
+ }
128
+
129
+ // tail
130
+ .k-step:last-of-type {
131
+ .k-step-tail {
132
+ display: none;
102
133
  }
103
- .k-step-icon:before {
104
- line-height: calc(${steps.head.innerWidth} - 2px);
134
+ }
135
+ .k-step-tail {
136
+ position: absolute;
137
+ top: 0;
138
+ right: calc(-1 * (${defaults.height} / 2 + ${steps.gap}));
139
+ width: calc(${defaults.height} / 2 + ${steps.gap});
140
+ height: ${defaults.height};
141
+ overflow: hidden;
142
+ z-index: 1;
143
+ &:after, &:before {
144
+ content: '';
145
+ border-width: calc(${defaults.height} / 2 + ${steps.gap});
146
+ border-style: solid;
147
+ border-color: transparent;
148
+ position: absolute;
149
+ top: calc(-1 * ${steps.gap});
105
150
  }
106
- .k-step-main {
107
- color: ${steps.main.color};
151
+ &:after {
152
+ border-left-color: ${defaults.bgColor};
153
+ left: calc(-1 * ${steps.gap});
108
154
  }
109
- .k-step-tail {
110
- position: absolute;
155
+ &:before {
156
+ border-left-color: #fff;
157
+ left: 0;
111
158
  }
112
- .k-step:last-of-type {
113
- .k-step-tail {
114
- display: none;
115
- }
116
- }
117
- // step
118
- ${stepStatus.map(status => {
119
- const styles = steps[status];
120
- return css`
121
- .k-${status} {
122
- .k-step-inner {
123
- color: ${styles.headColor};
124
- border-color: ${styles.headInnerBorderColor} !important;
125
- background: ${styles.headInnerBgColor};
126
- }
127
- .k-step-main {
128
- color: ${styles.mainColor};
129
- }
130
- }
131
- `
132
- })}
133
159
  }
134
-
135
- // default and simple type
136
- &.k-simple,
137
- &.k-default {
160
+ .k-step:not(:first-of-type) {
161
+ padding-left: calc(${defaults.height} / 2 + ${steps.gap});
162
+ }
163
+ `
164
+ }
165
+
166
+ function makeLineStyles() {
167
+ const line = defaults.line;
168
+ return css`
169
+ .k-step {
170
+ display: flex;
171
+ }
172
+ .k-step-wrapper {
173
+ display: inline-block;
138
174
  text-align: center;
139
- height: ${steps.height};
140
- line-height: ${steps.height};
141
- overflow: hidden;
142
- .k-step-head,
143
- .k-step-main,
144
- .k-step-content,
145
- .k-step-inner {
146
- display: inline-block;
147
- }
148
- .k-step {
149
- white-space: nowrap;
150
- }
151
- .k-step-wrapper {
152
- overflow: hidden;
175
+ position: relative;
176
+ }
177
+ .k-step:last-of-type {
178
+ flex: 0 0 auto;
179
+ }
180
+ .k-step-mark {
181
+ width: ${line.markWidth};
182
+ height: ${line.markWidth};
183
+ position: relative;
184
+ z-index: 1;
185
+ &, .k-icon {
186
+ font-size: ${line.markFontSize};
153
187
  }
154
188
  }
155
-
156
- // default
157
- &.k-default {
158
- background: ${steps.bgColor};
159
- .k-step-tail {
160
- top: 0;
161
- right: calc(-1 * (${steps.height} / 2 + ${steps.gutter}));
162
- width: calc(${steps.height} / 2 + ${steps.gutter});
163
- height: ${steps.height};
164
- overflow: hidden;
165
- z-index: 1;
166
- &:after, &:before {
167
- content: '';
168
- border-width: calc(${steps.height} / 2 + ${steps.gutter});
169
- border-style: solid;
170
- border-color: transparent;
171
- position: absolute;
172
- top: calc(-1 * ${steps.gutter});
173
- }
174
- &:after {
175
- border-left-color: ${steps.bgColor};
176
- left: calc(-1 * ${steps.head.paddingRight});
177
- }
178
- &:before {
179
- border-left-color: ${steps.line.bgColor};
180
- left: 0;
181
- }
189
+ .k-step-main {
190
+ padding-top: ${line.titleGap};
191
+ }
192
+ .k-step-title {
193
+ font-size: 14px;
194
+ color: ${theme.color.text};
195
+ }
196
+ .k-step-content {
197
+ margin-top: ${line.descGap};
198
+ color: ${theme.color.placeholder};
199
+ max-width: ${line.contentMaxWidth};
200
+ }
201
+
202
+ // draw connected line
203
+ .k-step-wrapper {
204
+ &:before,
205
+ &:after {
206
+ content: '';
207
+ display: block;
208
+ height: 1px;
209
+ background: ${line.lineColor};
210
+ width: 50%;
211
+ position: absolute;
212
+ top: calc(${line.markWidth} / 2);
182
213
  }
183
- .k-step-head,
184
- .k-step-inner {
185
- vertical-align: middle;
186
- margin-top: ${steps.gapTop};
214
+ &:after {
215
+ right: 0;
187
216
  }
188
- .k-step:not(:first-of-type) {
189
- padding-left: calc(${steps.height} / 2 + ${steps.gutter});
217
+ }
218
+ .k-step {
219
+ &:first-of-type .k-step-wrapper:before,
220
+ &:last-of-type .k-step-wrapper:after {
221
+ background: transparent;
190
222
  }
191
223
  }
224
+ .k-step-tail {
225
+ flex: 1;
226
+ height: 1px;
227
+ background: ${line.lineColor};
228
+ margin-top: calc(${line.markWidth} / 2);
229
+ }
192
230
 
193
- // line type
194
- &.k-line {
195
- .k-step {
196
- width: auto !important;
197
- &:last-of-type {
198
- flex: 0 0 auto;
199
- .k-step-wrapper {
200
- display: flex;
201
- }
202
- .k-step-title {
203
- padding-right: 0;
204
- }
231
+ // status
232
+ .k-step {
233
+ &.k-done {
234
+ .k-step-tail,
235
+ &:not(:last-of-type) .k-step-wrapper:after,
236
+ &:not(:first-of-type) .k-step-wrapper:before {
237
+ background: ${theme.color.primary};
205
238
  }
206
239
  }
207
- .k-step-head {
208
- background: ${steps.line.bgColor};
209
- position: relative;
210
- display: flex;
211
- padding: 0;
212
- &:before,
213
- &:after {
214
- content: '';
215
- display: block;
216
- flex: 1;
217
- height: 1px;
218
- background: ${theme.color.placeholder};
219
- top: ${steps.line.headTop};
220
- position: relative;
240
+ &:not(:first-of-type).k-active {
241
+ .k-step-wrapper:before {
242
+ background: ${theme.color.primary};
221
243
  }
222
244
  }
223
- .k-step-inner {
224
- width: ${steps.line.innerWidth};
225
- height: ${steps.line.innerWidth};
226
- line-height: ${steps.line.innerLineHeight};
227
- font-size: ${steps.line.innerFontSize};
245
+ &.k-active .k-step-title {
246
+ color: ${theme.color.primary};
228
247
  }
229
- .k-step-main {
230
- position: relative;
231
- width: ${steps.line.width};
248
+ &.k-error .k-step-title {
249
+ color: ${theme.color.danger};
232
250
  }
233
- .k-step-title {
234
- line-height: ${steps.head.innerWidth};
235
- background: ${steps.line.bgColor};
236
- font-size: ${steps.line.titleFontSize};
237
- padding: 0;
238
- margin-top: ${steps.line.titleGopTop};
239
- }
240
- .k-step-content {
241
- margin: ${steps.line.mainContentGap};
251
+ }
252
+ `;
253
+ }
254
+
255
+ function makeLineCompactStyles() {
256
+ const line = defaults.line;
257
+
258
+ return css`
259
+ .k-step-wrapper {
260
+ display: inline-flex;
261
+ text-align: left;
262
+ &:before, &:after {
263
+ display: none;
242
264
  }
243
- .k-step-tail {
244
- left: 0;
245
- right: ${steps.head.paddingRight};
246
- top: calc(${steps.head.innerWidth} / 2);
265
+ }
266
+ .k-step-main {
267
+ flex: 1;
268
+ padding: 0 0 0 ${line.titleGap};
269
+ }
270
+ .k-step-content {
271
+ margin: 0;
272
+ }
273
+ .k-step-tail {
274
+ margin-right: ${line.titleGap};
275
+ }
276
+ .k-step-title {
277
+ display: flex;
278
+ align-items: center;
279
+ height: ${line.markWidth};
280
+ &:after {
281
+ content: '';
282
+ display: block;
283
+ flex: 1;
247
284
  height: 1px;
248
- background: ${steps.line.tailBgColor};
249
- }
250
- .k-step:first-of-type .k-step-head:before,
251
- .k-step:last-of-type .k-step-head:after {
252
- background: transparent;
253
- }
254
- // done
255
- .k-done {
256
- .k-step-tail {
257
- background: ${steps.line.doneTailBgColor};
258
- }
259
- .k-step-head {
260
- &:before,
261
- &:after {
262
- background: ${theme.color.primary};
263
- }
264
- }
285
+ background: ${line.lineColor};
286
+ margin-left: ${line.titleGap};
265
287
  }
266
- .k-active {
267
- .k-step-head {
268
- &:before {
269
- background: ${theme.color.primary};
270
- }
288
+ }
289
+ .k-step:last-of-type .k-step-title:after {
290
+ display: none;
291
+ }
292
+ // status
293
+ .k-step {
294
+ &.k-done {
295
+ .k-step-title:after {
296
+ background: ${theme.color.primary};
271
297
  }
272
298
  }
273
- .k-step-icon:before {
274
- line-height: ${steps.line.iconLineHeight};
275
- }
276
- .k-step-wrapper {
277
- display: inline-block !important;
278
- text-align: center;
279
- }
280
- .k-step-tail {
281
- right: 0;
282
- top: ${steps.line.tailTop};
299
+ }
300
+ `;
301
+ }
302
+
303
+ function makeSimpleStyles() {
304
+ const simple = defaults.simple;
305
+ return css`
306
+ .k-step-mark {
307
+ width: ${simple.markWidth};
308
+ height: ${simple.markWidth};
309
+ background: ${simple.markBgColor};
310
+ }
311
+ .k-step-wrapper {
312
+ font-size: 0; // eliminate the gap
313
+ &:before,
314
+ &:after {
315
+ top: calc(${simple.markWidth} / 2);
283
316
  }
284
317
  }
285
-
286
- // simple type
287
- &.k-simple {
288
- font-size: ${steps.simple.fontSize};
289
- .k-step,
290
- .k-step-main {
291
- color: ${steps.simple.color};
318
+ .k-step-main {
319
+ font-size: ${theme.default.fontSize};
320
+ }
321
+ .k-step-tail {
322
+ margin-top: calc(${simple.markWidth} / 2);
323
+ }
324
+ .k-step {
325
+ &.k-done {
326
+ .k-step-mark {
327
+ background: ${simple.doneMarkBgColor};
328
+ }
292
329
  }
293
- .k-step-head {
294
- padding-right: ${steps.simple.headPaddingRight};
295
- vertical-align: top;
330
+ &.k-error {
331
+ .k-step-mark {
332
+ background: ${simple.errorMarkBgColor};
333
+ }
296
334
  }
335
+ }
336
+ `;
337
+ }
338
+
339
+ function center(flex: 'flex' | 'inline-flex' = 'flex') {
340
+ return css`
341
+ display: ${flex};
342
+ align-items: center;
343
+ justify-content: center;
344
+ `;
345
+ }
346
+
347
+ export function makeCommonStyles() {
348
+ return css`
349
+ .k-step {
350
+ position: relative;
351
+ flex: 1;
352
+
353
+ // status
297
354
  ${stepStatus.map(status => {
298
355
  const styles = steps[status];
299
356
  return css`
300
- .k-${status} {
301
- .k-step-main,
302
- .k-step-inner {
303
- color: ${styles.simpleColor};
357
+ &.k-${status} {
358
+ .k-step-mark {
359
+ color: ${styles.markColor};
360
+ border-color: ${styles.markBorderColor};
361
+ background: ${styles.markBgColor};
362
+ }
363
+ .k-step-main {
364
+ color: ${styles.mainColor};
304
365
  }
305
366
  }
306
367
  `
307
368
  })}
308
369
  }
309
-
310
- // clickable
311
- &.k-clickable {
312
- .k-done {
313
- cursor: pointer;
314
- }
370
+ .k-step-mark {
371
+ ${center('inline-flex')};
372
+ border: ${steps.markborder};
373
+ border-radius: 50%;
374
+ vertical-align: top;
375
+ color: ${steps.markColor};
376
+ background: ${steps.markBgColor};
315
377
  }
316
378
  `;
317
379
  }
318
-
319
- export function makeStepStyles() {
320
- return css`
321
- position: relative;
322
- flex: 1;
323
- .k-step-icon:before {
324
- font-size: ${steps.head.iconFontSize};
325
- }
326
- .k-step-title {
327
- display: inline-block;
328
- padding-right: ${steps.main.titlePaddingRight};
329
- white-space: nowrap;
330
- }
331
- .k-step-content {
332
- font-size: ${steps.main.contentFontSize};
333
- }
334
- .k-step-inner,
335
- .k-step-main {
336
- transition: all ${steps.transition};
337
- }
338
- `;
339
- }
340
-
341
-
@@ -3,14 +3,13 @@ title: 基础用法
3
3
  order: 0
4
4
  ---
5
5
 
6
- 通过`disabled`禁用组件,`v-model`进行数据双向绑定。
6
+ 通过`v-model`进行数据双向绑定。
7
7
 
8
8
  ```vdt
9
9
  import {Switch} from 'kpc';
10
10
 
11
11
  <div>
12
12
  <Switch v-model="value" />
13
- <Switch disabled />
14
13
  </div>
15
14
  ```
16
15
 
@@ -0,0 +1,20 @@
1
+ ---
2
+ title: 禁用状态
3
+ order: 0.1
4
+ ---
5
+
6
+ 添加`disabled`属性
7
+
8
+ ```vdt
9
+ import {Switch} from 'kpc';
10
+
11
+ <div>
12
+ <Switch disabled />
13
+ <Switch value={true} disabled />
14
+ </div>
15
+ ```
16
+
17
+ ```styl
18
+ .k-switch
19
+ margin-right 20px
20
+ ```
@@ -16,6 +16,11 @@ import {Switch} from 'kpc';
16
16
  <b:on><i class="ion-ios-checkmark-empty"></i></b:on>
17
17
  <b:off><i class="ion-ios-close-empty"></i></b:off>
18
18
  </Switch>
19
+ <Switch on="开" off="关" flat/>
20
+ <Switch value={true} flat>
21
+ <b:on><i class="ion-ios-checkmark-empty"></i></b:on>
22
+ <b:off><i class="ion-ios-close-empty"></i></b:off>
23
+ </Switch>
19
24
  </div>
20
25
  ```
21
26