@king-design/intact 3.0.0-beta.1 → 3.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.
Files changed (226) hide show
  1. package/components/badge/styles.ts +1 -1
  2. package/components/breadcrumb/demos/separator.md +1 -1
  3. package/components/button/demos/basic.md +1 -1
  4. package/components/button/demos/disabled.md +2 -1
  5. package/components/button/demos/group.md +9 -2
  6. package/components/button/demos/icon.md +7 -7
  7. package/components/button/demos/loading.md +4 -4
  8. package/components/button/demos/size.md +4 -4
  9. package/components/button/group.ts +3 -1
  10. package/components/button/group.vdt +2 -1
  11. package/components/button/index.md +1 -0
  12. package/components/button/index.vdt +1 -1
  13. package/components/button/styles.ts +37 -16
  14. package/components/carousel/index.vdt +2 -2
  15. package/components/cascader/index.vdt +1 -1
  16. package/components/checkbox/demos/basic.md +1 -1
  17. package/components/checkbox/demos/group.md +1 -1
  18. package/components/checkbox/demos/indeterminate.md +1 -1
  19. package/components/checkbox/demos/value.md +1 -1
  20. package/components/checkbox/styles.ts +6 -10
  21. package/components/collapse/item.vdt +1 -1
  22. package/components/collapse/styles.ts +0 -2
  23. package/components/copy/index.vdt +1 -1
  24. package/components/datepicker/calendar.vdt +6 -6
  25. package/components/datepicker/demos/datetime.md +5 -4
  26. package/components/datepicker/index.spec.ts +11 -1
  27. package/components/datepicker/styles.ts +6 -1
  28. package/components/datepicker/useValue.ts +35 -10
  29. package/components/dialog/styles.ts +1 -1
  30. package/components/dropdown/demos/basic.md +1 -1
  31. package/components/dropdown/demos/checkbox.md +1 -1
  32. package/components/dropdown/demos/disabled.md +2 -2
  33. package/components/dropdown/demos/nested.md +6 -6
  34. package/components/dropdown/demos/position.md +3 -3
  35. package/components/dropdown/demos/trigger.md +2 -2
  36. package/components/dropdown/dropdown.ts +1 -0
  37. package/components/form/demos/basic.md +2 -2
  38. package/components/form/demos/custom.md +2 -4
  39. package/components/form/index.spec.ts +21 -0
  40. package/components/form/styles.ts +2 -2
  41. package/components/icon/demos/icons.md +130 -97
  42. package/components/icon/index.vdt +1 -1
  43. package/components/icon/styles.ts +6 -2
  44. package/components/input/demos/blocks.md +7 -2
  45. package/components/input/demos/clearable.md +2 -2
  46. package/components/input/demos/showCount.md +18 -0
  47. package/components/input/demos/size.md +6 -4
  48. package/components/input/index.md +1 -0
  49. package/components/input/index.ts +5 -0
  50. package/components/input/index.vdt +22 -14
  51. package/components/input/search.vdt +2 -5
  52. package/components/input/styles.ts +81 -77
  53. package/components/input/useFocus.ts +17 -0
  54. package/components/menu/item.vdt +1 -1
  55. package/components/message/demos/config.md +2 -2
  56. package/components/message/index.md +1 -1
  57. package/components/message/message.ts +1 -1
  58. package/components/pagination/index.vdt +2 -2
  59. package/components/pagination/styles.ts +1 -4
  60. package/components/popover/styles.ts +1 -1
  61. package/components/progress/index.vdt +1 -1
  62. package/components/radio/demos/basic.md +1 -1
  63. package/components/radio/demos/group.md +1 -1
  64. package/components/radio/demos/value.md +1 -1
  65. package/components/radio/styles.ts +4 -1
  66. package/components/scrollSelect/styles.ts +1 -1
  67. package/components/select/base.vdt +25 -20
  68. package/components/select/demos/customMenu.md +2 -2
  69. package/components/select/index.spec.ts +4 -1
  70. package/components/select/menu.vdt +2 -2
  71. package/components/select/option.vdt +1 -0
  72. package/components/select/styles.ts +6 -2
  73. package/components/spinner/index.vdt +4 -4
  74. package/components/spinner/styles.ts +9 -6
  75. package/components/steps/step.vdt +2 -2
  76. package/components/steps/styles.ts +5 -1
  77. package/components/switch/styles.ts +17 -1
  78. package/components/table/cell.vdt +1 -1
  79. package/components/table/column.vdt +28 -16
  80. package/components/table/demos/group.md +4 -3
  81. package/components/table/demos/showIndeterminate.md +2 -2
  82. package/components/table/demos/title.md +3 -5
  83. package/components/table/index.md +1 -1
  84. package/components/table/index.spec.ts +18 -1
  85. package/components/table/styles.ts +22 -28
  86. package/components/table/table.ts +1 -0
  87. package/components/table/useGroup.ts +42 -23
  88. package/components/tabs/demos/closable.md +1 -1
  89. package/components/tabs/index.vdt +3 -2
  90. package/components/tag/index.md +31 -0
  91. package/components/tag/styles.ts +6 -6
  92. package/components/tag/tags.vdt +1 -0
  93. package/components/tag/useNowrap.ts +1 -1
  94. package/components/tip/styles.ts +1 -1
  95. package/components/tooltip/index.spec.ts +30 -0
  96. package/components/tooltip/tooltip.ts +3 -0
  97. package/components/transfer/index.vdt +4 -3
  98. package/components/types.ts +1 -0
  99. package/components/upload/index.vdt +4 -4
  100. package/es/components/badge/styles.js +1 -1
  101. package/es/components/button/group.d.ts +1 -0
  102. package/es/components/button/group.js +2 -1
  103. package/es/components/button/group.vdt.js +4 -2
  104. package/es/components/button/index.vdt.js +1 -1
  105. package/es/components/button/styles.d.ts +1 -1
  106. package/es/components/button/styles.js +14 -9
  107. package/es/components/carousel/index.vdt.js +2 -2
  108. package/es/components/cascader/index.vdt.js +1 -1
  109. package/es/components/checkbox/styles.js +4 -8
  110. package/es/components/collapse/item.vdt.js +1 -1
  111. package/es/components/collapse/styles.js +2 -2
  112. package/es/components/copy/index.vdt.js +1 -1
  113. package/es/components/datepicker/calendar.vdt.js +6 -6
  114. package/es/components/datepicker/index.spec.js +170 -152
  115. package/es/components/datepicker/styles.js +1 -1
  116. package/es/components/datepicker/useValue.d.ts +3 -3
  117. package/es/components/datepicker/useValue.js +38 -9
  118. package/es/components/dialog/styles.js +1 -1
  119. package/es/components/dropdown/dropdown.js +2 -1
  120. package/es/components/form/index.spec.js +45 -0
  121. package/es/components/form/styles.js +1 -1
  122. package/es/components/icon/index.vdt.js +3 -2
  123. package/es/components/icon/styles.js +1 -1
  124. package/es/components/input/index.d.ts +3 -1
  125. package/es/components/input/index.js +4 -1
  126. package/es/components/input/index.vdt.js +21 -10
  127. package/es/components/input/search.vdt.js +2 -4
  128. package/es/components/input/styles.js +13 -6
  129. package/es/components/input/useFocus.d.ts +4 -0
  130. package/es/components/input/useFocus.js +21 -0
  131. package/es/components/menu/item.vdt.js +4 -1
  132. package/es/components/message/message.js +1 -1
  133. package/es/components/pagination/index.vdt.js +2 -2
  134. package/es/components/pagination/styles.js +2 -5
  135. package/es/components/popover/styles.js +1 -1
  136. package/es/components/progress/index.vdt.js +1 -1
  137. package/es/components/radio/styles.js +1 -1
  138. package/es/components/scrollSelect/styles.js +1 -1
  139. package/es/components/select/base.vdt.js +40 -20
  140. package/es/components/select/index.spec.js +23 -11
  141. package/es/components/select/menu.vdt.js +5 -5
  142. package/es/components/select/option.vdt.js +2 -1
  143. package/es/components/select/styles.js +2 -2
  144. package/es/components/spinner/index.vdt.js +4 -4
  145. package/es/components/spinner/styles.js +2 -2
  146. package/es/components/steps/step.vdt.js +2 -2
  147. package/es/components/steps/styles.js +6 -2
  148. package/es/components/switch/styles.js +10 -2
  149. package/es/components/table/cell.vdt.js +1 -1
  150. package/es/components/table/column.vdt.js +42 -24
  151. package/es/components/table/index.spec.js +37 -6
  152. package/es/components/table/styles.js +15 -8
  153. package/es/components/table/table.js +2 -1
  154. package/es/components/table/useGroup.d.ts +9 -3
  155. package/es/components/table/useGroup.js +46 -37
  156. package/es/components/tabs/index.vdt.js +7 -2
  157. package/es/components/tag/styles.js +1 -1
  158. package/es/components/tag/tags.vdt.js +14 -2
  159. package/es/components/tag/useNowrap.js +1 -1
  160. package/es/components/tip/styles.js +1 -1
  161. package/es/components/tooltip/index.spec.js +57 -0
  162. package/es/components/tooltip/tooltip.js +5 -1
  163. package/es/components/transfer/index.vdt.js +14 -3
  164. package/es/components/types.d.ts +1 -0
  165. package/es/components/upload/index.vdt.js +4 -4
  166. package/es/index.d.ts +2 -2
  167. package/es/index.js +2 -2
  168. package/es/site/data/components/button/demos/disabled/react.js +5 -2
  169. package/es/site/data/components/button/demos/group/react.js +19 -2
  170. package/es/site/data/components/button/demos/icon/react.js +7 -7
  171. package/es/site/data/components/button/demos/loading/react.js +4 -4
  172. package/es/site/data/components/button/demos/size/react.js +4 -4
  173. package/es/site/data/components/datepicker/demos/datetime/index.d.ts +1 -0
  174. package/es/site/data/components/datepicker/demos/datetime/index.js +1 -0
  175. package/es/site/data/components/dropdown/demos/basic/react.js +1 -1
  176. package/es/site/data/components/dropdown/demos/checkbox/react.js +1 -1
  177. package/es/site/data/components/dropdown/demos/disabled/react.js +2 -2
  178. package/es/site/data/components/dropdown/demos/nested/react.js +9 -9
  179. package/es/site/data/components/dropdown/demos/position/react.js +3 -3
  180. package/es/site/data/components/dropdown/demos/trigger/react.js +2 -2
  181. package/es/site/data/components/form/demos/basic/react.js +1 -1
  182. package/es/site/data/components/icon/demos/icons/index.d.ts +8 -4
  183. package/es/site/data/components/icon/demos/icons/index.js +35 -1
  184. package/es/site/data/components/icon/demos/icons/react.d.ts +9 -4
  185. package/es/site/data/components/icon/demos/icons/react.js +51 -9
  186. package/es/site/data/components/input/demos/blocks/react.js +7 -7
  187. package/es/site/data/components/input/demos/clearable/react.js +2 -2
  188. package/es/site/data/components/input/demos/showCount/index.d.ts +5 -0
  189. package/es/site/data/components/input/demos/showCount/index.js +17 -0
  190. package/es/site/data/components/input/demos/showCount/react.d.ts +4 -0
  191. package/es/site/data/components/input/demos/showCount/react.js +33 -0
  192. package/es/site/data/components/input/demos/size/react.js +8 -8
  193. package/es/site/data/components/message/demos/config/index.js +1 -1
  194. package/es/site/data/components/message/demos/config/react.js +1 -1
  195. package/es/site/data/components/select/demos/customMenu/react.js +5 -5
  196. package/es/site/data/components/table/demos/showIndeterminate/react.js +1 -1
  197. package/es/site/data/components/table/demos/title/react.js +4 -4
  198. package/es/site/data/components/tabs/demos/closable/react.js +2 -1
  199. package/es/site/src/pages/layout.js +1 -3
  200. package/es/site/src/pages/styles.js +1 -1
  201. package/es/site/src/router/index.js +1 -1
  202. package/es/styles/fonts/iconfont.eot +0 -0
  203. package/es/styles/fonts/iconfont.js +1 -1
  204. package/es/styles/fonts/iconfont.svg +36 -36
  205. package/es/styles/fonts/iconfont.ttf +0 -0
  206. package/es/styles/fonts/iconfont.woff +0 -0
  207. package/es/styles/global.js +1 -1
  208. package/es/styles/theme.js +1 -1
  209. package/index.ts +2 -2
  210. package/package.json +2 -2
  211. package/styles/fonts/demo.css +277 -108
  212. package/styles/fonts/demo_index.html +2169 -0
  213. package/styles/fonts/iconfont.css +52 -50
  214. package/styles/fonts/iconfont.eot +0 -0
  215. package/styles/fonts/iconfont.js +1 -0
  216. package/styles/fonts/iconfont.json +611 -0
  217. package/styles/fonts/iconfont.svg +36 -36
  218. package/styles/fonts/iconfont.ts +123 -124
  219. package/styles/fonts/iconfont.ttf +0 -0
  220. package/styles/fonts/iconfont.woff +0 -0
  221. package/styles/fonts/iconfont.woff2 +0 -0
  222. package/styles/global.ts +4 -4
  223. package/styles/theme.ts +1 -1
  224. package/components/select/useNowrap.ts +0 -24
  225. package/es/components/select/useNowrap.d.ts +0 -3
  226. package/es/components/select/useNowrap.js +0 -19
@@ -7,6 +7,7 @@ import {useFrozen} from './useFrozen';
7
7
  import {CommonInputHTMLAttributes, Events} from '../types';
8
8
  import {useAutoRows} from './useAutoRows';
9
9
  import { useShowPassword } from './useShowPassword';
10
+ import { useFocus } from './useFocus';
10
11
  export * from './search';
11
12
 
12
13
  export type HTMLInputTypes =
@@ -33,6 +34,7 @@ export type HTMLInputTypes =
33
34
  | 'time'
34
35
  | 'url'
35
36
  | 'week'
37
+ | 'maxlength'
36
38
  | (string & {});
37
39
 
38
40
  interface InputHTMLAttributes extends CommonInputHTMLAttributes {
@@ -68,6 +70,7 @@ export interface InputProps<V extends Value = Value> extends InputHTMLAttributes
68
70
  resize?: 'none' | 'vertical' | 'horizontal' | 'both'
69
71
  showPassword?: boolean
70
72
  flat?: boolean
73
+ showCount?: boolean
71
74
  }
72
75
 
73
76
  export type AutoRows = {
@@ -109,6 +112,7 @@ const typeDefs: Required<TypeDefs<Omit<InputProps, keyof InputHTMLAttributes>>>
109
112
  resize: ['none', 'vertical', 'horizontal', 'both'],
110
113
  showPassword: Boolean,
111
114
  flat: Boolean,
115
+ showCount: Boolean,
112
116
  }
113
117
 
114
118
  const defaults = (): Partial<InputProps> => ({
@@ -136,6 +140,7 @@ export class Input<V extends Value = Value> extends Component<InputProps<V>, Inp
136
140
  private frozen = useFrozen();
137
141
  private autoRows = useAutoRows(this.inputRef);
138
142
  private showPassword = useShowPassword();
143
+ private focusHook = useFocus();
139
144
 
140
145
  focus() {
141
146
  this.inputRef.value!.focus();
@@ -1,5 +1,5 @@
1
1
  import {Icon} from '../icon';
2
- import {addStyle, isTextBlock, getRestProps} from '../utils';
2
+ import {addStyle, isTextBlock, getRestProps, stopPropagation} from '../utils';
3
3
  import {makeStyles} from './styles';
4
4
  import {noop, isNullOrUndefined, isStringOrNumber} from 'intact-shared';
5
5
  import {Wave} from '../wave';
@@ -9,7 +9,7 @@ const {
9
9
  className, style, type, value, defaultValue, placeholder,
10
10
  clearable, disabled, size, rows, autoWidth, fluid,
11
11
  width, stackClearIcon, frozenOnInput, readonly, inline,
12
- waveDisabled, resize, flat,
12
+ waveDisabled, resize, flat, showCount, maxlength,
13
13
 
14
14
  'ev-click': click,
15
15
  'ev-mounseenter': mouseenter,
@@ -23,6 +23,7 @@ const {
23
23
  originalValue: {value: originalValue},
24
24
  startInput, onInput, endInput
25
25
  } = this.frozen;
26
+ const { isFocus, focusInputOnClick }= this.focusHook;
26
27
 
27
28
  const isNotAutoRows = isStringOrNumber(rows) && rows !== 'auto';
28
29
 
@@ -31,14 +32,14 @@ const classNameObj = {
31
32
  [`k-${size}`]: size !== 'default',
32
33
  'k-group': $blocks.prepend || $blocks.append,
33
34
  'k-disabled': disabled,
34
- 'k-with-prefix': $blocks.prefix,
35
- 'k-with-suffix': $blocks.suffix,
36
35
  'k-clearable': clearable,
37
36
  'k-auto-width': autoWidth,
38
37
  'k-fluid': fluid,
39
38
  'k-stack-clear': stackClearIcon,
40
39
  'k-inline': inline,
41
40
  'k-flat': flat,
41
+ 'k-type-textarea': type === 'textarea',
42
+ 'k-focus': isFocus.value,
42
43
  [`k-resize-${resize}`]: type === 'textarea' && isNotAutoRows,
43
44
  [`k-resize-none`]: type === 'textarea' && !isNotAutoRows,
44
45
  [className]: className,
@@ -67,6 +68,7 @@ const inputProps = {
67
68
  readOnly: readonly,
68
69
  placeholder,
69
70
  disabled,
71
+ maxLength: maxlength,
70
72
  ref: this.inputRef,
71
73
  style: autoWidth && fakeWidth ? {width: fakeWidth + 'px'} : undefined,
72
74
  };
@@ -95,8 +97,8 @@ if (hasInputValue) {
95
97
  }}
96
98
  <ErrorContext.Consumer defaultValue={false}>
97
99
  {isInvalid => {
98
- return <Wave disabled={waveDisabled || disabled || isInvalid}>
99
- <div class="k-input-wrapper">
100
+ return <Wave disabled={waveDisabled || disabled || isInvalid} inset="-2px">
101
+ <div class="k-input-wrapper" ev-click={focusInputOnClick}>
100
102
  <div class="k-input-prefix" v-if={$blocks.prefix}>
101
103
  <b:prefix />
102
104
  </div>
@@ -111,31 +113,37 @@ if (hasInputValue) {
111
113
  rows={isNotAutoRows ? rows : 1}
112
114
  style={height.value ? addStyle(inputProps.style, { height: height.value + 'px' }) : inputProps.style}
113
115
  ></textarea>
114
- <div class="k-input-suffix" v-if={$blocks.suffix || clearable && !disabled || showPasswordIcon.value}>
116
+ <div class="k-input-suffix"
117
+ v-if={$blocks.suffix || clearable && !disabled || showPasswordIcon.value || showCount}
118
+ ev-click={stopPropagation}
119
+ >
115
120
  <template v-if={showPasswordIcon.value}>
116
121
  <Icon hoverable
117
122
  class={{
118
123
  "k-input-show-password": true,
119
- "ion-eye-disabled": !isShowPassword.value,
120
- "ion-eye": isShowPassword.value,
124
+ "k-icon-hidden": !isShowPassword.value,
125
+ "k-icon-visible": isShowPassword.value,
121
126
  }}
122
127
  ev-click={toggleShowPassword}
123
128
  />{' '}
124
129
  </template>
125
130
  <Icon v-if={clearable && !disabled}
126
131
  class={{
127
- "k-input-clear ion-ios-close": true,
132
+ "k-input-clear k-icon-error-fill": true,
128
133
  "k-input-show": hasValue,
129
134
  }}
130
135
  ev-click={this.clear}
131
136
  hoverable
132
137
  />{' '}
138
+ <span class="k-input-count" v-if={showCount}>
139
+ {hasValue ? value.length : 0}
140
+ <span v-if={maxlength}> / {maxlength}</span>
141
+ </span>
133
142
  <b:suffix />
134
143
  </div>
135
- <div v-if={autoWidth}
136
- class="k-input-fake"
137
- ref={fakeRef}
138
- >{!hasValue ? placeholder : inputValue}</div>
144
+ <div class="k-input-fake" v-if={autoWidth}>
145
+ <span ref={fakeRef}>{!hasValue ? placeholder : inputValue}</span>
146
+ </div>
139
147
  </div>
140
148
  </Wave>
141
149
  }}
@@ -9,14 +9,12 @@ const {
9
9
  type, size, open,
10
10
  } = this.get();
11
11
 
12
- const isTypeNotDefault = type !== 'default';
13
-
14
12
  const classNameObj = {
15
13
  'k-search': true,
16
14
  [className]: className,
17
15
  'k-open': open,
18
16
  'k-hide': !open,
19
- [`k-${type}`]: isTypeNotDefault,
17
+ [`k-${type}`]: type,
20
18
  [makeSearchStyles()]: true,
21
19
  };
22
20
 
@@ -32,8 +30,7 @@ const classNameObj = {
32
30
  ev-$change:value={this.onChangeValue}
33
31
  readonly={!open}
34
32
  size={size}
35
- class="k-with-suffix"
36
- waveDisabled={isTypeNotDefault}
33
+ waveDisabled={type !== 'default'}
37
34
  />
38
35
  <Button icon type="none" ev-click={this.onClickBtn} size={size}>
39
36
  <Icon class="k-icon-search k-search-icon" />
@@ -45,6 +45,11 @@ const defaults = deepDefaults(
45
45
  flat: {
46
46
  get color() { return theme.color.lightBlack },
47
47
  get bgColor() { return theme.color.bg },
48
+ },
49
+
50
+ // count
51
+ count: {
52
+ get color() { return theme.color.placeholder },
48
53
  }
49
54
  },
50
55
  sizes.reduce((memo, size) => {
@@ -68,30 +73,35 @@ export function makeStyles() {
68
73
  return css`
69
74
  display: inline-block;
70
75
  width: ${input.width};
76
+ color: ${input.color};
71
77
  vertical-align: middle;
72
78
  .k-input-wrapper {
73
- display: inline-block;
79
+ display: inline-flex;
80
+ align-items: center;
74
81
  width: 100%;
75
82
  position: relative;
76
- }
77
- .k-input-inner {
78
- display: inline-block;
79
- width: 100%;
80
83
  border: ${input.border};
81
84
  background-color: ${input.bgColor};
82
85
  transition: border ${input.transition}, background ${input.transition}, box-shadow ${input.transition};
83
86
  border-radius: ${input.borderRadius};
84
- outline: none;
85
- position: relative;
86
- color: ${input.color};
87
87
  &:hover {
88
88
  border: ${input.hoverBorder};
89
89
  z-index: 1;
90
90
  }
91
- &:focus {
92
- border: ${input.focusBorder};
93
- z-index: 1;
94
- }
91
+ }
92
+ &.k-focus .k-input-wrapper {
93
+ border: ${input.focusBorder};
94
+ z-index: 1;
95
+ }
96
+ .k-input-inner {
97
+ flex: 1;
98
+ outline: none;
99
+ color: inherit;
100
+ font-size: inherit;
101
+ border: none;
102
+ background: transparent;
103
+ padding: 0;
104
+ width: 0; // must set width to 0, otherwise it has min width
95
105
  &::placeholder {
96
106
  color: ${input.placeholderColor};
97
107
  }
@@ -105,12 +115,17 @@ export function makeStyles() {
105
115
  // prefix & suffix
106
116
  .k-input-prefix,
107
117
  .k-input-suffix {
108
- position: absolute;
109
- top: 50%;
110
- transform: translateY(-50%);
111
- z-index: 2;
118
+ display: flex;
119
+ align-items: center;
120
+ gap: ${input.clearIconGap};
112
121
  color: ${theme.color.lightBlack};
113
- line-height: 1;
122
+ position: relative;
123
+ }
124
+ .k-input-prefix {
125
+ margin-right: ${input.clearIconGap};
126
+ }
127
+ .k-input-suffix {
128
+ margin-left: ${input.clearIconGap};
114
129
  }
115
130
 
116
131
  // clearable
@@ -119,9 +134,6 @@ export function makeStyles() {
119
134
  transition: opacity ${input.transition};
120
135
  pointer-events: none;
121
136
  color: ${input.clearIconColor};
122
- + * {
123
- margin-left: ${input.clearIconGap};
124
- }
125
137
  }
126
138
  &:hover .k-input-clear.k-input-show {
127
139
  opacity: 1;
@@ -139,12 +151,12 @@ export function makeStyles() {
139
151
  position: absolute;
140
152
  z-index: 1;
141
153
  right: 0;
142
- &.k-input-show + i {
154
+ &.k-input-show + * {
143
155
  transition: opacity ${input.transition};
144
156
  }
145
157
  }
146
158
  &:hover {
147
- .k-input-clear.k-input-show + i {
159
+ .k-input-clear.k-input-show + * {
148
160
  opacity: 0;
149
161
  }
150
162
  }
@@ -152,29 +164,23 @@ export function makeStyles() {
152
164
 
153
165
  // group
154
166
  &.k-group {
155
- display: table;
156
- .k-input-inner {
167
+ display: inline-flex;
168
+ .k-input-wrapper {
157
169
  border-radius: 0;
158
170
  }
159
171
  .k-input-wrapper:first-child {
160
- .k-input-inner {
161
- border-radius: ${input.borderRadius} 0 0 ${input.borderRadius};
162
- }
172
+ border-radius: ${input.borderRadius} 0 0 ${input.borderRadius};
163
173
  }
164
174
  .k-input-wrapper:last-child {
165
- .k-input-inner {
166
- border-radius: 0 ${input.borderRadius} ${input.borderRadius} 0;
167
- }
175
+ border-radius: 0 ${input.borderRadius} ${input.borderRadius} 0;
168
176
  }
169
177
  }
170
178
  .k-input-prepend,
171
179
  .k-input-append {
172
- display: table-cell;
173
- width: 1px;
174
- vertical-align: middle;
180
+ display: inline-flex;
181
+ align-items: center;
175
182
  background-color: ${input.groupBgColor};
176
183
  border: ${input.border};
177
- text-align: center;
178
184
  white-space: nowrap;
179
185
  .k-btn {
180
186
  margin: -1px;
@@ -216,10 +222,10 @@ export function makeStyles() {
216
222
 
217
223
  // flat
218
224
  &.k-flat {
219
- .k-input-inner {
225
+ color: ${input.flat.color};
226
+ .k-input-wrapper {
220
227
  border: none;
221
228
  background: ${input.flat.bgColor};
222
- color: ${input.flat.color};
223
229
  }
224
230
  }
225
231
 
@@ -227,10 +233,11 @@ export function makeStyles() {
227
233
  &.k-disabled {
228
234
  color: ${input.disabledColor};
229
235
  cursor: not-allowed;
230
- .k-input-inner {
231
- color: ${input.disabledColor};
236
+ .k-input-wrapper {
232
237
  border-color: ${input.disabledBorderColor};
233
238
  background: ${input.disabledBgColor};
239
+ }
240
+ .k-input-inner {
234
241
  cursor: not-allowed;
235
242
  }
236
243
  }
@@ -240,34 +247,10 @@ export function makeStyles() {
240
247
  const styles = input[size];
241
248
  const sizeClassName = css`
242
249
  font-size: ${styles.fontSize};
243
- .k-input-inner {
250
+ .k-input-wrapper {
244
251
  height: ${styles.height};
245
- line-height: ${styles.height};
246
- font-size: ${styles.fontSize};
247
252
  padding: 0 ${styles.paddingGap};
248
253
  }
249
- .k-input-prefix {
250
- left: ${styles.paddingGap};
251
- }
252
- .k-input-suffix {
253
- right: ${styles.paddingGap};
254
- }
255
- &.k-with-prefix {
256
- .k-input-inner {
257
- padding-left: calc(${styles.paddingGap} + 1rem + ${input.clearIconGap});
258
- }
259
- }
260
- &.k-with-suffix,
261
- &.k-clearable {
262
- .k-input-inner {
263
- padding-right: calc(${styles.paddingGap} + 1rem + ${input.clearIconGap});
264
- }
265
- }
266
- &:not(.k-stack-clear).k-with-suffix.k-clearable {
267
- .k-input-inner {
268
- padding-right: calc(${styles.paddingGap} + 2rem + ${input.clearIconGap} * 2);
269
- }
270
- }
271
254
  `;
272
255
 
273
256
  if (size === 'default') return sizeClassName;
@@ -280,9 +263,8 @@ export function makeStyles() {
280
263
 
281
264
  // inline
282
265
  &.k-inline {
283
- .k-input-inner {
266
+ .k-input-wrapper {
284
267
  height: auto;
285
- line-height: inherit;
286
268
  border: none;
287
269
  border-radius: 0;
288
270
  padding: 0;
@@ -290,11 +272,22 @@ export function makeStyles() {
290
272
  }
291
273
 
292
274
  // textarea
293
- .k-textarea {
294
- padding: ${input.textareaPadding};
295
- height: auto;
296
- line-height: 1.5;
297
- vertical-align: top;
275
+ &.k-type-textarea {
276
+ .k-input-wrapper {
277
+ display: inline-block;
278
+ padding: 0;
279
+ height: auto;
280
+ }
281
+ .k-textarea {
282
+ width: 100%;
283
+ padding: ${input.textareaPadding};
284
+ line-height: 1.5;
285
+ vertical-align: top;
286
+ }
287
+ .k-input-suffix {
288
+ margin: 0;
289
+ justify-content: flex-end;
290
+ }
298
291
  }
299
292
  ${(Input.typeDefs.resize as string[]).map(type => {
300
293
  return css`
@@ -308,18 +301,23 @@ export function makeStyles() {
308
301
 
309
302
  // fake dom for get value's width
310
303
  .k-input-fake {
304
+ left: 0;
305
+ top: 0;
306
+ right: 0;
311
307
  position: absolute;
308
+ overflow: hidden;
309
+ width: 100%;
312
310
  visibility: hidden;
313
- top: 0;
314
311
  white-space: nowrap;
315
312
  }
316
313
  &.k-auto-width {
317
314
  width: auto;
318
315
  max-width: 100%;
319
- .k-input-inner {
320
- max-width: 100%;
321
- box-sizing: content-box;
322
- }
316
+ }
317
+
318
+ // count
319
+ .k-input-count {
320
+ color: ${input.count.color};
323
321
  }
324
322
  `
325
323
  }
@@ -337,6 +335,9 @@ export function makeSearchStyles() {
337
335
  right: 0;
338
336
  z-index: 1;
339
337
  }
338
+ &.k-default .k-btn:hover {
339
+ background: transparent;
340
+ }
340
341
  .k-input-suffix {
341
342
  margin-right: ${input.search.suffixMarginRight};
342
343
  }
@@ -361,13 +362,16 @@ export function makeSearchStyles() {
361
362
 
362
363
  // line
363
364
  &.k-line {
364
- .k-input-inner {
365
+ .k-input-wrapper {
365
366
  border-width: 0;
366
367
  }
367
368
  &.k-open {
368
- .k-input-inner {
369
+ .k-input-wrapper {
369
370
  border-bottom-width: 1px;
370
371
  }
372
+ .k-btn:hover {
373
+ background: transparent;
374
+ }
371
375
  }
372
376
  }
373
377
  `
@@ -0,0 +1,17 @@
1
+ import {useInstance, createRef, onMounted, nextTick} from 'intact';
2
+ import type {Input} from './';
3
+ import {useState} from '../../hooks/useState';
4
+
5
+ export function useFocus() {
6
+ const instance = useInstance() as Input;
7
+ const isFocus = useState(false);
8
+
9
+ instance.on('focus', () => isFocus.set(true));
10
+ instance.on('blur', () => isFocus.set(false));
11
+
12
+ function focusInputOnClick(e: MouseEvent) {
13
+ instance.focus();
14
+ }
15
+
16
+ return { isFocus, focusInputOnClick };
17
+ }
@@ -35,7 +35,7 @@ const title = (children) => (
35
35
  >
36
36
  <Icon class="k-menu-dot ion-record" v-if={showDot} />
37
37
  <div class="k-menu-name">{children}</div>
38
- <i class="k-menu-arrow ion-ios-arrow-down" v-if={subMenuVNode}></i>
38
+ <Icon class="k-menu-arrow k-icon-down" v-if={subMenuVNode} />
39
39
  </div>
40
40
  );
41
41
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- title: 隐藏Icon或关闭按钮
2
+ title: 隐藏Icon或展示关闭按钮
3
3
  order: 1.1
4
4
  ---
5
5
 
@@ -32,7 +32,7 @@ export default class extends Component {
32
32
  Message[type]({
33
33
  content: type,
34
34
  duration: 3000,
35
- closable: false,
35
+ closable: true,
36
36
  hideIcon: true,
37
37
  });
38
38
  }
@@ -15,7 +15,7 @@ sidebar: doc
15
15
  | content | 提示内容 | `string` &#124; `VNode` | `undefined` |
16
16
  | duration | 提示展示多长时间后自动关闭,当传入0时,提示将会一直展示。单位ms | `number` | `5000` |
17
17
  | type | 提示类型 | `"info"` &#124; `"error"` &#124; `"success"` &#124; `"warning"`|
18
- | closable | 是否展示关闭按钮 | `boolean` | `true` |
18
+ | closable | 是否展示关闭按钮 | `boolean` | `false` |
19
19
  | hideIcon | 是否隐藏文字前面的icon | `boolean` | `false` |
20
20
 
21
21
  # 静态方法
@@ -33,7 +33,7 @@ let id = 0;
33
33
  const defaults = (): Partial<MessageProps> => ({
34
34
  duration: 5000,
35
35
  type: 'info',
36
- closable: true,
36
+ closable: false,
37
37
  });
38
38
 
39
39
  let messages: Messages | null = null;
@@ -121,13 +121,13 @@ let nextPage = value + 1;
121
121
  type="none"
122
122
  disabled={value <= 1 || !!(disablePage && disablePage(value - 1, limit))}
123
123
  ev-click={this.prev}
124
- ><Icon class="k-icon-arrow-left" /></Button>
124
+ ><Icon class="k-icon-left" /></Button>
125
125
  <template>{paginationItems}</template>
126
126
  <Button icon size={size}
127
127
  type="none"
128
128
  disabled={value >= totalPages || !!(disablePage && disablePage(value + 1, limit))}
129
129
  ev-click={this.next}
130
- ><Icon class="k-icon-arrow-right" /></Button>
130
+ ><Icon class="k-icon-right" /></Button>
131
131
  </ButtonGroup>
132
132
 
133
133
  <template v-if={!simple}>
@@ -32,7 +32,7 @@ const defaults = deepDefaults(
32
32
  gap: '6px',
33
33
  padding: '0 3px',
34
34
  get borderRadius() { return theme.borderRadius },
35
- get hoverBgColor() { return theme.color.hoverBg }
35
+ // get hoverBgColor() { return theme.color.hoverBg }
36
36
  },
37
37
  // goto
38
38
  goto: {
@@ -82,9 +82,6 @@ export function makeStyles() {
82
82
  &:last-of-type {
83
83
  margin: 0 !important;
84
84
  }
85
- &:hover {
86
- background: ${pagination.btn.hoverBgColor};
87
- }
88
85
  }
89
86
  .k-icon {
90
87
  font-size: 18px;
@@ -3,7 +3,7 @@ import {theme, setDefault} from '../../styles/theme';
3
3
  import {deepDefaults} from '../../styles/utils';
4
4
 
5
5
  const defaults = {
6
- width: '240px',
6
+ width: '320px',
7
7
  padding: '8px 16px',
8
8
  gap: '8px',
9
9
  title: {
@@ -90,7 +90,7 @@ const classNameObj = {
90
90
  } else {
91
91
  switch (status) {
92
92
  case 'success':
93
- icon = 'k-icon-truth';
93
+ icon = 'k-icon-check';
94
94
  break;
95
95
  case 'error':
96
96
  case 'warning':
@@ -20,7 +20,7 @@ import {Radio} from 'kpc';
20
20
 
21
21
  ```styl
22
22
  .k-radio
23
- margin-right 20px
23
+ margin-right 24px
24
24
  ```
25
25
 
26
26
  ```ts
@@ -18,7 +18,7 @@ import {Radio} from 'kpc';
18
18
 
19
19
  ```styl
20
20
  .k-radio
21
- margin-right 20px
21
+ margin-right 24px
22
22
  ```
23
23
 
24
24
  ```ts
@@ -23,7 +23,7 @@ import {Radio} from 'kpc';
23
23
 
24
24
  ```styl
25
25
  .k-radio
26
- margin-right 20px
26
+ margin-right 24px
27
27
  ```
28
28
 
29
29
  ```ts
@@ -67,10 +67,13 @@ export function makeStyles() {
67
67
  transform: scale(0);
68
68
  transition: all ${radio.transition};
69
69
  }
70
- &:hover {
70
+ }
71
+ &:hover {
72
+ .k-radio-wrapper {
71
73
  border: 1px solid ${radio.hoverBorderColor};
72
74
  }
73
75
  }
76
+
74
77
  input {
75
78
  width: 100%;
76
79
  height: 100%;
@@ -19,7 +19,7 @@ const defaults = {
19
19
  get color() { return theme.color.text },
20
20
  get activeColor() { return theme.color.primary },
21
21
  get hoverBgColor() { return theme.color.bg },
22
- activeFontSize: `1.1em`,
22
+ activeFontSize: `1.3em`,
23
23
  get disabledColor() { return theme.color.disabled },
24
24
  border: `1px solid #e5e5e5`,
25
25
  }