@douyinfe/semi-ui 2.9.1 → 2.10.0-alpha.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 (67) hide show
  1. package/badge/_story/badge.stories.js +2 -34
  2. package/checkbox/checkbox.tsx +18 -8
  3. package/dist/css/semi.css +0 -1
  4. package/dist/css/semi.min.css +1 -1
  5. package/dist/umd/semi-ui.js +23030 -22978
  6. package/dist/umd/semi-ui.js.map +1 -1
  7. package/dist/umd/semi-ui.min.js +1 -1
  8. package/dist/umd/semi-ui.min.js.map +1 -1
  9. package/form/hoc/withField.tsx +5 -8
  10. package/lib/cjs/_portal/index.d.ts +1 -1
  11. package/lib/cjs/checkbox/checkbox.d.ts +4 -0
  12. package/lib/cjs/checkbox/checkbox.js +25 -13
  13. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  14. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  15. package/lib/cjs/datePicker/insetInput.d.ts +0 -1
  16. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
  17. package/lib/cjs/dropdown/dropdownMenu.d.ts +0 -1
  18. package/lib/cjs/form/baseForm.d.ts +1 -1
  19. package/lib/cjs/form/field.d.ts +1 -1
  20. package/lib/cjs/form/hoc/withField.js +4 -6
  21. package/lib/cjs/modal/useModal/index.d.ts +0 -1
  22. package/lib/cjs/notification/useNotification/index.d.ts +0 -1
  23. package/lib/cjs/radio/radio.d.ts +5 -1
  24. package/lib/cjs/radio/radio.js +26 -12
  25. package/lib/cjs/radio/radioGroup.d.ts +1 -1
  26. package/lib/cjs/scrollList/scrollItem.js +1 -1
  27. package/lib/cjs/timePicker/Combobox.d.ts +0 -1
  28. package/lib/cjs/timePicker/TimePicker.d.ts +2 -2
  29. package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
  30. package/lib/cjs/timePicker/index.d.ts +2 -2
  31. package/lib/cjs/toast/useToast/index.d.ts +0 -1
  32. package/lib/cjs/tooltip/index.d.ts +1 -0
  33. package/lib/cjs/tooltip/index.js +7 -2
  34. package/lib/cjs/typography/title.d.ts +1 -1
  35. package/lib/cjs/upload/index.d.ts +1 -1
  36. package/lib/es/_portal/index.d.ts +1 -1
  37. package/lib/es/checkbox/checkbox.d.ts +4 -0
  38. package/lib/es/checkbox/checkbox.js +25 -13
  39. package/lib/es/datePicker/dateInput.d.ts +1 -1
  40. package/lib/es/datePicker/datePicker.d.ts +1 -1
  41. package/lib/es/datePicker/insetInput.d.ts +0 -1
  42. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  43. package/lib/es/dropdown/dropdownMenu.d.ts +0 -1
  44. package/lib/es/form/baseForm.d.ts +1 -1
  45. package/lib/es/form/field.d.ts +1 -1
  46. package/lib/es/form/hoc/withField.js +4 -6
  47. package/lib/es/modal/useModal/index.d.ts +0 -1
  48. package/lib/es/notification/useNotification/index.d.ts +0 -1
  49. package/lib/es/radio/radio.d.ts +5 -1
  50. package/lib/es/radio/radio.js +26 -12
  51. package/lib/es/radio/radioGroup.d.ts +1 -1
  52. package/lib/es/scrollList/scrollItem.js +1 -1
  53. package/lib/es/timePicker/Combobox.d.ts +0 -1
  54. package/lib/es/timePicker/TimePicker.d.ts +2 -2
  55. package/lib/es/timePicker/TimeShape.d.ts +1 -1
  56. package/lib/es/timePicker/index.d.ts +2 -2
  57. package/lib/es/toast/useToast/index.d.ts +0 -1
  58. package/lib/es/tooltip/index.d.ts +1 -0
  59. package/lib/es/tooltip/index.js +7 -2
  60. package/lib/es/typography/title.d.ts +1 -1
  61. package/lib/es/upload/index.d.ts +1 -1
  62. package/package.json +9 -9
  63. package/radio/radio.tsx +17 -7
  64. package/scrollList/scrollItem.tsx +1 -1
  65. package/timePicker/TimePicker.tsx +1 -1
  66. package/timePicker/_story/timepicker.stories.js +1 -20
  67. package/tooltip/index.tsx +6 -2
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import { Avatar, Badge } from '../../index';
3
- import { IconLock } from '@douyinfe/semi-icons';
2
+ import Badge from '../index';
4
3
 
5
4
  export default {
6
5
  title: 'Badge',
@@ -89,35 +88,4 @@ export const Theme = () => (
89
88
  <a style={style}></a>
90
89
  </Badge>
91
90
  </div>
92
- );
93
-
94
- export const AvatarBadge = () => {
95
- const style = {
96
- width: '42px',
97
- height: '42px',
98
- borderRadius: '4px',
99
- };
100
- return (
101
- <div>
102
- <Badge count={5}>
103
- <Avatar color='blue' shape='square' style={style}>BM</Avatar>
104
- </Badge>
105
- <br/>
106
- <br/>
107
- <Badge dot>
108
- <Avatar color='blue' shape='square' style={style}>YL</Avatar>
109
- </Badge>
110
- <br/>
111
- <br/>
112
- <Badge count={<IconLock style={{color:'var(--semi-color-primary)'}}/>}>
113
- <Avatar color='light-blue' shape='square' style={style}>XZ</Avatar>
114
- </Badge>
115
- <br/>
116
- <br/>
117
- <Badge count='NEW' >
118
- <Avatar color='light-blue' shape='square' style={style}>WF</Avatar>
119
- </Badge>
120
- </div>
121
- );
122
- };
123
- AvatarBadge.storyName = '头像 badge';
91
+ );
@@ -29,9 +29,13 @@ export interface CheckboxProps extends BaseCheckboxProps {
29
29
  'aria-label'?: React.AriaAttributes['aria-label'];
30
30
  role?: React.HTMLAttributes<HTMLSpanElement>['role']; // a11y: wrapper role
31
31
  tabIndex?: number; // a11y: wrapper tabIndex
32
+ addonId?: string;
33
+ extraId?: string;
32
34
  }
33
35
  interface CheckboxState {
34
36
  checked: boolean;
37
+ addonId?: string;
38
+ extraId?: string;
35
39
  }
36
40
  class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
37
41
  static contextType = Context;
@@ -89,7 +93,13 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
89
93
  notifyGroupChange: cbContent => {
90
94
  this.context.checkboxGroup.onChange(cbContent);
91
95
  },
92
- getGroupDisabled: () => (this.context && this.context.checkboxGroup.disabled)
96
+ getGroupDisabled: () => (this.context && this.context.checkboxGroup.disabled),
97
+ setAddonId: () => {
98
+ this.setState({ addonId: getUuidShort({ prefix: 'addon' }) });
99
+ },
100
+ setExtraId: () => {
101
+ this.setState({ extraId: getUuidShort({ prefix: 'extra' }) });
102
+ }
93
103
  };
94
104
  }
95
105
 
@@ -103,11 +113,11 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
103
113
 
104
114
  this.state = {
105
115
  checked: props.checked || props.defaultChecked || checked,
116
+ addonId: props.addonId,
117
+ extraId: props.extraId,
106
118
  };
107
119
 
108
120
  this.checkboxEntity = null;
109
- this.addonId = getUuidShort({ prefix: 'addon' });
110
- this.extraId = getUuidShort({ prefix: 'extra' });
111
121
  this.foundation = new CheckboxFoundation(this.adapter);
112
122
  }
113
123
 
@@ -153,7 +163,7 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
153
163
  tabIndex,
154
164
  id
155
165
  } = this.props;
156
- const { checked } = this.state;
166
+ const { checked, addonId, extraId } = this.state;
157
167
  const props: Record<string, any> = {
158
168
  checked,
159
169
  disabled,
@@ -196,8 +206,8 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
196
206
 
197
207
  const renderContent = () => (
198
208
  <>
199
- {children ? <span id={this.addonId} className={`${prefix}-addon`}>{children}</span> : null}
200
- {extra ? <div id={this.extraId} className={extraCls}>{extra}</div> : null}
209
+ {children ? <span id={addonId} className={`${prefix}-addon`}>{children}</span> : null}
210
+ {extra ? <div id={extraId} className={extraCls}>{extra}</div> : null}
201
211
  </>
202
212
  );
203
213
  return (
@@ -218,8 +228,8 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
218
228
  <CheckboxInner
219
229
  {...this.props}
220
230
  {...props}
221
- addonId={children && this.addonId}
222
- extraId={extra && this.extraId}
231
+ addonId={children && addonId}
232
+ extraId={extra && extraId}
223
233
  name={name}
224
234
  isPureCardType={props.isPureCardType}
225
235
  ref={ref => {
package/dist/css/semi.css CHANGED
@@ -14622,7 +14622,6 @@ body[theme-mode=dark], body .semi-always-dark {
14622
14622
  }
14623
14623
  .semi-select-open:hover, .semi-select-focus:hover {
14624
14624
  background-color: var(--semi-color-fill-0);
14625
- border: 1px solid var(--semi-color-focus-border);
14626
14625
  }
14627
14626
  .semi-select-warning {
14628
14627
  background-color: var(--semi-color-warning-light-default);