@jetbrains/ring-ui 7.0.0-beta.9 → 7.0.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.
Files changed (251) hide show
  1. package/babel.config.js +20 -14
  2. package/components/alert/alert.css +7 -7
  3. package/components/alert/alert.d.ts +2 -2
  4. package/components/alert/alert.js +10 -12
  5. package/components/alert/container.js +1 -1
  6. package/components/alert-service/alert-service.js +4 -2
  7. package/components/analytics/analytics__custom-plugin.js +1 -1
  8. package/components/auth/auth.js +1 -1
  9. package/components/auth/auth__core.js +36 -36
  10. package/components/auth/background-flow.js +2 -2
  11. package/components/auth/down-notification.js +3 -1
  12. package/components/auth/iframe-flow.js +4 -2
  13. package/components/auth/request-builder.js +5 -5
  14. package/components/auth/storage.js +10 -9
  15. package/components/auth/token-validator.js +8 -15
  16. package/components/auth-dialog/auth-dialog.js +8 -8
  17. package/components/auth-dialog-service/auth-dialog-service.js +4 -4
  18. package/components/avatar/avatar.js +9 -7
  19. package/components/avatar/fallback-avatar.js +15 -12
  20. package/components/button/button.css +31 -24
  21. package/components/button/button.js +9 -9
  22. package/components/button/button__classes.d.ts +1 -1
  23. package/components/button/button__classes.js +3 -4
  24. package/components/button-group/button-group.css +25 -13
  25. package/components/button-group/caption.js +1 -1
  26. package/components/button-toolbar/button-toolbar.d.ts +1 -1
  27. package/components/button-toolbar/button-toolbar.js +2 -2
  28. package/components/caret/caret.js +8 -8
  29. package/components/checkbox/checkbox.css +8 -5
  30. package/components/checkbox/checkbox.js +1 -1
  31. package/components/clipboard/clipboard-fallback.js +2 -6
  32. package/components/clipboard/clipboard.js +5 -5
  33. package/components/code/code.d.ts +1 -1
  34. package/components/code/code.js +2 -2
  35. package/components/code/highlight.css +3 -1
  36. package/components/collapse/collapse-content.js +3 -3
  37. package/components/collapse/collapse-context.js +1 -1
  38. package/components/collapse/collapse-control.js +5 -3
  39. package/components/collapse/collapse.css +21 -20
  40. package/components/collapse/collapse.js +2 -2
  41. package/components/confirm/confirm.d.ts +2 -2
  42. package/components/confirm/confirm.js +2 -2
  43. package/components/confirm-service/confirm-service.d.ts +1 -1
  44. package/components/confirm-service/confirm-service.js +6 -6
  45. package/components/content-layout/content-layout.css +6 -5
  46. package/components/content-layout/content-layout.js +7 -6
  47. package/components/content-layout/sidebar.js +5 -5
  48. package/components/contenteditable/contenteditable.d.ts +1 -1
  49. package/components/contenteditable/contenteditable.js +3 -4
  50. package/components/control-label/control-label.js +5 -3
  51. package/components/data-list/data-list.css +3 -3
  52. package/components/data-list/data-list.d.ts +2 -2
  53. package/components/data-list/data-list.js +6 -7
  54. package/components/data-list/data-list.mock.js +57 -47
  55. package/components/data-list/item.js +14 -16
  56. package/components/data-list/selection.js +5 -7
  57. package/components/data-list/title.js +5 -6
  58. package/components/date-picker/consts.js +2 -2
  59. package/components/date-picker/date-input.js +4 -4
  60. package/components/date-picker/date-picker.css +23 -18
  61. package/components/date-picker/date-picker.d.ts +2 -1
  62. package/components/date-picker/date-picker.js +13 -19
  63. package/components/date-picker/date-popup.js +30 -36
  64. package/components/date-picker/day.js +6 -9
  65. package/components/date-picker/formats.js +647 -1
  66. package/components/date-picker/month-names.js +6 -8
  67. package/components/date-picker/month-slider.js +2 -2
  68. package/components/date-picker/month.js +1 -3
  69. package/components/date-picker/months.js +2 -6
  70. package/components/date-picker/weekdays.js +2 -3
  71. package/components/date-picker/years.js +3 -3
  72. package/components/dialog/dialog.d.ts +1 -0
  73. package/components/dialog/dialog.js +20 -13
  74. package/components/dialog/dialog__body-scroll-preventer.js +1 -1
  75. package/components/dropdown/dropdown.css +2 -4
  76. package/components/dropdown/dropdown.d.ts +2 -2
  77. package/components/dropdown/dropdown.js +5 -5
  78. package/components/dropdown-menu/dropdown-menu.js +5 -5
  79. package/components/editable-heading/editable-heading.css +5 -2
  80. package/components/editable-heading/editable-heading.js +21 -19
  81. package/components/error-bubble/error-bubble.js +1 -1
  82. package/components/error-message/error-message.js +2 -4
  83. package/components/footer/footer.js +11 -15
  84. package/components/form/form.stories.js +45 -63
  85. package/components/global/create-stateful-context.js +2 -4
  86. package/components/global/data-tests.js +5 -6
  87. package/components/global/dom.js +8 -11
  88. package/components/global/focus-sensor-hoc.js +5 -6
  89. package/components/global/fuzzy-highlight.js +1 -1
  90. package/components/global/get-event-key.js +2 -2
  91. package/components/global/global.css +0 -3
  92. package/components/global/linear-function.js +1 -1
  93. package/components/global/normalize-indent.js +2 -6
  94. package/components/global/react-dom-renderer.js +2 -3
  95. package/components/global/theme.js +9 -10
  96. package/components/global/url.js +8 -8
  97. package/components/global/variables.css +1 -8
  98. package/components/global/variables_dark.css +0 -1
  99. package/components/grid/col.js +6 -6
  100. package/components/grid/grid.css +174 -173
  101. package/components/grid/grid.js +1 -1
  102. package/components/grid/row.js +13 -6
  103. package/components/group/group.js +1 -1
  104. package/components/header/header-icon.js +2 -2
  105. package/components/header/header.css +19 -15
  106. package/components/header/header.js +3 -5
  107. package/components/header/links.js +1 -1
  108. package/components/header/logo.js +1 -1
  109. package/components/header/profile.d.ts +2 -2
  110. package/components/header/profile.js +9 -9
  111. package/components/header/services-link.js +1 -1
  112. package/components/header/services.js +4 -5
  113. package/components/header/smart-profile.js +4 -3
  114. package/components/header/smart-services.js +9 -5
  115. package/components/header/tray.js +1 -1
  116. package/components/heading/heading.css +0 -1
  117. package/components/heading/heading.js +2 -2
  118. package/components/http/http.d.ts +3 -3
  119. package/components/http/http.js +25 -29
  120. package/components/http/http.mock.js +9 -6
  121. package/components/hub-source/hub-source.js +5 -7
  122. package/components/hub-source/hub-source__user.js +1 -1
  123. package/components/hub-source/hub-source__users-groups.js +6 -7
  124. package/components/i18n/README.md +3 -4
  125. package/components/i18n/i18n-context.js +2 -4
  126. package/components/icon/icon.js +7 -9
  127. package/components/icon/icon__svg.js +6 -6
  128. package/components/input/input.js +11 -14
  129. package/components/input-size/input-size.stories.js +42 -22
  130. package/components/island/adaptive-island-hoc.js +1 -1
  131. package/components/island/content.js +4 -6
  132. package/components/island/header.js +8 -10
  133. package/components/island/island.css +5 -5
  134. package/components/island/island.js +1 -1
  135. package/components/link/clickableLink.js +3 -1
  136. package/components/link/link.js +5 -3
  137. package/components/list/consts.js +1 -1
  138. package/components/list/list.d.ts +1 -1
  139. package/components/list/list.js +35 -57
  140. package/components/list/list__custom.js +3 -5
  141. package/components/list/list__hint.js +3 -1
  142. package/components/list/list__item.js +11 -9
  143. package/components/list/list__link.js +1 -1
  144. package/components/list/list__separator.js +2 -2
  145. package/components/list/list__title.js +7 -3
  146. package/components/list/list__users-groups-source.js +6 -8
  147. package/components/loader/loader.js +1 -1
  148. package/components/loader/loader__core.js +5 -5
  149. package/components/loader-inline/loader-inline.css +0 -3
  150. package/components/loader-inline/loader-inline.js +5 -7
  151. package/components/loader-screen/loader-screen.js +1 -1
  152. package/components/login-dialog/login-dialog.js +4 -4
  153. package/components/login-dialog/service.js +5 -5
  154. package/components/markdown/markdown.css +6 -6
  155. package/components/markdown/markdown.d.ts +2 -2
  156. package/components/markdown/markdown.js +4 -6
  157. package/components/message/message.css +2 -1
  158. package/components/message/message.js +30 -21
  159. package/components/old-browsers-message/old-browsers-message.js +2 -2
  160. package/components/old-browsers-message/white-list.js +2 -3
  161. package/components/pager/pager.js +28 -29
  162. package/components/permissions/permissions.js +8 -13
  163. package/components/permissions/permissions__cache.js +6 -7
  164. package/components/popup/popup.consts.js +8 -2
  165. package/components/popup/popup.js +27 -33
  166. package/components/popup/popup.target.js +4 -4
  167. package/components/popup/position.js +21 -28
  168. package/components/popup-menu/popup-menu.js +1 -1
  169. package/components/progress-bar/progress-bar.css +10 -8
  170. package/components/progress-bar/progress-bar.d.ts +2 -2
  171. package/components/progress-bar/progress-bar.js +2 -2
  172. package/components/query-assist/query-assist.css +0 -3
  173. package/components/query-assist/query-assist.js +73 -84
  174. package/components/query-assist/query-assist__suggestions.js +10 -9
  175. package/components/radio/radio.css +6 -2
  176. package/components/radio/radio.js +1 -3
  177. package/components/scrollable-section/scrollable-section.css +5 -6
  178. package/components/scrollable-section/scrollable-section.js +1 -1
  179. package/components/select/select.css +5 -5
  180. package/components/select/select.d.ts +1 -1
  181. package/components/select/select.js +96 -110
  182. package/components/select/select__filter.js +1 -1
  183. package/components/select/select__popup.js +40 -51
  184. package/components/shortcuts/core.js +10 -7
  185. package/components/shortcuts/shortcut-title.js +6 -6
  186. package/components/shortcuts/shortcuts.js +1 -1
  187. package/components/sidebar/sidebar.css +3 -1
  188. package/components/slider/slider.css +14 -14
  189. package/components/slider/slider.js +7 -7
  190. package/components/tab-trap/tab-trap.js +7 -9
  191. package/components/table/cell.js +3 -1
  192. package/components/table/disable-hover-hoc.js +2 -2
  193. package/components/table/header-cell.js +5 -3
  194. package/components/table/header.d.ts +1 -2
  195. package/components/table/header.js +10 -12
  196. package/components/table/multitable.js +5 -3
  197. package/components/table/row.d.ts +0 -1
  198. package/components/table/row.js +20 -27
  199. package/components/table/selection-adapter.js +1 -1
  200. package/components/table/selection-shortcuts-hoc.js +2 -2
  201. package/components/table/selection.d.ts +2 -3
  202. package/components/table/selection.js +4 -5
  203. package/components/table/simple-table.js +4 -4
  204. package/components/table/smart-table.js +5 -5
  205. package/components/table/table.css +8 -9
  206. package/components/table/table.d.ts +0 -1
  207. package/components/table/table.js +22 -23
  208. package/components/table/table.stories.json +45 -16
  209. package/components/tabs/collapsible-more.d.ts +1 -1
  210. package/components/tabs/collapsible-more.js +13 -16
  211. package/components/tabs/collapsible-tab.js +2 -2
  212. package/components/tabs/collapsible-tabs.d.ts +2 -2
  213. package/components/tabs/collapsible-tabs.js +13 -22
  214. package/components/tabs/dumb-tabs.js +6 -9
  215. package/components/tabs/smart-tabs.js +4 -4
  216. package/components/tabs/tab-link.js +1 -3
  217. package/components/tabs/tabs.css +7 -9
  218. package/components/tag/tag.css +6 -6
  219. package/components/tag/tag.d.ts +1 -1
  220. package/components/tag/tag.js +9 -12
  221. package/components/tags-input/tags-input.js +15 -19
  222. package/components/tags-list/tags-list.d.ts +2 -2
  223. package/components/tags-list/tags-list.js +6 -5
  224. package/components/text/text.js +5 -3
  225. package/components/toggle/toggle.css +12 -10
  226. package/components/toggle/toggle.d.ts +2 -2
  227. package/components/toggle/toggle.js +4 -3
  228. package/components/tooltip/tooltip.js +13 -8
  229. package/components/user-agreement/service.js +15 -13
  230. package/components/user-agreement/user-agreement.js +3 -5
  231. package/components/user-card/card.js +10 -9
  232. package/components/user-card/smart-user-card-tooltip.js +5 -7
  233. package/components/user-card/tooltip.js +4 -4
  234. package/components/user-card/user-card.css +4 -0
  235. package/jslint-xml.js +20 -19
  236. package/package.json +59 -50
  237. package/postcss.config.js +3 -4
  238. package/typings.d.ts +2 -4
  239. package/webpack.config.js +20 -25
  240. package/components/badge/badge.css +0 -42
  241. package/components/badge/badge.d.ts +0 -14
  242. package/components/badge/badge.js +0 -29
  243. package/components/island-legacy/content-legacy.d.ts +0 -5
  244. package/components/island-legacy/content-legacy.js +0 -12
  245. package/components/island-legacy/header-legacy.d.ts +0 -5
  246. package/components/island-legacy/header-legacy.js +0 -14
  247. package/components/island-legacy/island-legacy.css +0 -98
  248. package/components/island-legacy/island-legacy.d.ts +0 -7
  249. package/components/island-legacy/island-legacy.js +0 -14
  250. package/components/table-legacy/table-legacy.css +0 -346
  251. package/components/table-legacy/table-legacy__toolbar.css +0 -25
@@ -1,7 +1,7 @@
1
1
  const defaultOptions = {
2
2
  searchMax: 20,
3
3
  searchSideThreshold: 100,
4
- queryFormatter: query => `${query} or ${query}*`
4
+ queryFormatter: query => `${query} or ${query}*`,
5
5
  };
6
6
  /**
7
7
  * HubSource is designed to speed up search requests for small installations.
@@ -62,15 +62,13 @@ export default class HubSource {
62
62
  processResults(res) {
63
63
  const items = res[this.relativeUrl] || [];
64
64
  if (this.isClientSideSearch) {
65
- return items.
66
- filter(it => this.filterFn(it)).
67
- slice(0, this.options.searchMax);
65
+ return items.filter(it => this.filterFn(it)).slice(0, this.options.searchMax);
68
66
  }
69
67
  return items;
70
68
  }
71
69
  async sideDetectionRequest(params, query) {
72
70
  const res = await this.makeCachedRequest(HubSource.mergeParams(params, {
73
- $top: this.options.searchSideThreshold
71
+ $top: this.options.searchSideThreshold,
74
72
  }));
75
73
  this.isClientSideSearch = this.checkIsClientSideSearch(res);
76
74
  if (!this.isClientSideSearch) {
@@ -80,13 +78,13 @@ export default class HubSource {
80
78
  }
81
79
  doClientSideSearch(params) {
82
80
  return this.makeCachedRequest(HubSource.mergeParams(params, {
83
- $top: this.constructor.TOP_ALL
81
+ $top: this.constructor.TOP_ALL,
84
82
  }));
85
83
  }
86
84
  doServerSideSearch(params, query) {
87
85
  return this.makeRequest(HubSource.mergeParams(params, {
88
86
  query: this.formatQuery(query),
89
- $top: this.options.searchMax
87
+ $top: this.options.searchMax,
90
88
  }));
91
89
  }
92
90
  getValueFromSuitableSource(query, params) {
@@ -8,7 +8,7 @@ export function convertUserForCard(hubUser, serverUri = '') {
8
8
  banReason: hubUser.banReason,
9
9
  email: hubUser.profile?.email?.email,
10
10
  avatarUrl: hubUser.profile?.avatar?.url,
11
- href: `${serverUri}users/${hubUser.id}`
11
+ href: `${serverUri}users/${hubUser.id}`,
12
12
  };
13
13
  }
14
14
  export function createHubUserCardSource(auth, userId, fields = DEFAULT_FIELDS) {
@@ -1,7 +1,7 @@
1
1
  import HubSource from './hub-source';
2
2
  const defaultOptions = {
3
3
  searchMax: 20,
4
- searchSideThreshold: 200
4
+ searchSideThreshold: 200,
5
5
  };
6
6
  export default class HubSourceUsersGroups {
7
7
  auth;
@@ -14,11 +14,11 @@ export default class HubSourceUsersGroups {
14
14
  this.usersSource = new HubSource(auth, 'users', {
15
15
  searchMax: this.options.searchMax,
16
16
  searchSideThreshold: this.options.searchSideThreshold,
17
- queryFormatter: query => `nameStartsWith: ${HubSourceUsersGroups.wrapMultiwordQuery(query)} or loginStartsWith: ${HubSourceUsersGroups.wrapMultiwordQuery(query)}`
17
+ queryFormatter: query => `nameStartsWith: ${HubSourceUsersGroups.wrapMultiwordQuery(query)} or loginStartsWith: ${HubSourceUsersGroups.wrapMultiwordQuery(query)}`,
18
18
  });
19
19
  this.groupsSource = new HubSource(auth, 'usergroups', {
20
20
  searchMax: this.options.searchMax,
21
- searchSideThreshold: this.options.searchSideThreshold
21
+ searchSideThreshold: this.options.searchSideThreshold,
22
22
  });
23
23
  }
24
24
  static wrapMultiwordQuery(query) {
@@ -32,19 +32,18 @@ export default class HubSourceUsersGroups {
32
32
  return () => true;
33
33
  }
34
34
  const normalizedQuery = query.toLowerCase();
35
- return (it) => (it.name.toLowerCase().indexOf(normalizedQuery) !== -1 ||
36
- it.login.toLowerCase().indexOf(normalizedQuery) !== -1);
35
+ return (it) => it.name.toLowerCase().indexOf(normalizedQuery) !== -1 || it.login.toLowerCase().indexOf(normalizedQuery) !== -1;
37
36
  }
38
37
  getUsers(query = '') {
39
38
  return this.usersSource.get(query, {
40
39
  fields: 'id,name,login,total,profile/avatar/url',
41
- orderBy: 'name'
40
+ orderBy: 'name',
42
41
  }, this.createUsersFilterFn(query));
43
42
  }
44
43
  getGroups(query = '') {
45
44
  return this.groupsSource.get(query, {
46
45
  fields: 'id,name,total,userCount,iconUrl',
47
- orderBy: 'name'
46
+ orderBy: 'name',
48
47
  });
49
48
  }
50
49
  getUserAndGroups(query) {
@@ -5,6 +5,7 @@ All messages should be stored in a messages.json, using that format https://www.
5
5
  ### How to use
6
6
 
7
7
  1. Using your project i18n tooling, construct an object with localised messages, like:
8
+
8
9
  ```
9
10
  // You can use https://ttag.js.org/ for example:
10
11
  const localised = {
@@ -25,15 +26,13 @@ const localised = {
25
26
  setTranslations(localised);
26
27
  ```
27
28
 
28
- 3. Add I18nContextHolder into your root React tree. If you replace "localised" object with another one, consumers would be updated automatically.
29
+ 3. Add I18nContextHolder into your root React tree. If you replace "localised" object with another one, consumers would be updated automatically.
29
30
 
30
31
  ```
31
32
  <I18nContextHolder messages={localised}>
32
33
  <App />
33
34
  </I18nContextHolder>
34
- ```
35
-
36
-
35
+ ```
37
36
 
38
37
  ### Utilities
39
38
 
@@ -3,13 +3,11 @@ import * as React from 'react';
3
3
  import { getTranslations, setTranslations, translate } from './i18n';
4
4
  export const I18nContext = React.createContext({
5
5
  messages: getTranslations(),
6
- translate
6
+ translate,
7
7
  });
8
8
  export const I18nContextHolder = ({ children, messages }) => {
9
9
  useEffect(() => {
10
10
  setTranslations(messages);
11
11
  }, [messages]);
12
- return (<I18nContext.Provider value={{ messages, translate }}>
13
- {children}
14
- </I18nContext.Provider>);
12
+ return <I18nContext.Provider value={{ messages, translate }}>{children}</I18nContext.Provider>;
15
13
  };
@@ -11,11 +11,11 @@ const warnSize = deprecate(() => { }, `\`size\`, \`width\` and \`height\` props
11
11
 
12
12
  We strongly recommend to use icons handcrafted for particular sizes. If your icon doesn't exist in the desired size, please ask your designer to draw one. "Responsive" checkmark should be unchecked when exporting icon.'`);
13
13
  export default class Icon extends PureComponent {
14
- static defaultProps = ({
14
+ static defaultProps = {
15
15
  className: '',
16
16
  color: Color.DEFAULT,
17
- glyph: ''
18
- });
17
+ glyph: '',
18
+ };
19
19
  static Color = Color;
20
20
  static Size = Size;
21
21
  warnSize() {
@@ -34,7 +34,7 @@ export default class Icon extends PureComponent {
34
34
  this.warnSize();
35
35
  return {
36
36
  width: size,
37
- height: size
37
+ height: size,
38
38
  };
39
39
  }
40
40
  return undefined;
@@ -46,12 +46,10 @@ export default class Icon extends PureComponent {
46
46
  }
47
47
  const classes = classNames(styles.icon, {
48
48
  [styles[color]]: !!color,
49
- [styles.loading]: loading
49
+ [styles.loading]: loading,
50
50
  }, className);
51
- return (<span {...restProps} className={classes}>
52
- {typeof Glyph === 'string'
53
- ? <IconSVG src={Glyph} style={this.getStyle()}/>
54
- : <Glyph className={styles.glyph} style={this.getStyle()}/>}
51
+ return (<span data-test="ring-icon" {...restProps} className={classes}>
52
+ {typeof Glyph === 'string' ? (<IconSVG src={Glyph} style={this.getStyle()}/>) : (<Glyph className={styles.glyph} style={this.getStyle()}/>)}
55
53
  </span>);
56
54
  }
57
55
  }
@@ -23,7 +23,7 @@ function serializeAttrs(map) {
23
23
  }
24
24
  function extractSVGProps(svgNode) {
25
25
  const map = svgNode.attributes;
26
- return (map.length > 0) ? serializeAttrs(map) : null;
26
+ return map.length > 0 ? serializeAttrs(map) : null;
27
27
  }
28
28
  const getSVGFromSource = memoize((src) => {
29
29
  const svgContainer = document.createElement('div');
@@ -37,21 +37,21 @@ const getSVGFromSource = memoize((src) => {
37
37
  }
38
38
  return {
39
39
  props: extractSVGProps(svg),
40
- html: svg.innerHTML
40
+ html: svg.innerHTML,
41
41
  };
42
42
  });
43
43
  function isCompatibilityMode(iconSrc) {
44
- const hasWidth = /width="[\d\.]+"/ig.test(iconSrc);
45
- const hasHeight = /height="[\d\.]+"/ig.test(iconSrc);
44
+ const hasWidth = /width="[\d\.]+"/gi.test(iconSrc);
45
+ const hasHeight = /height="[\d\.]+"/gi.test(iconSrc);
46
46
  return !hasWidth || !hasHeight;
47
47
  }
48
48
  function IconSVG({ src, className, ...rest }) {
49
49
  const glyphClasses = classNames(styles.glyph, {
50
- [styles.compatibilityMode]: isCompatibilityMode(src)
50
+ [styles.compatibilityMode]: isCompatibilityMode(src),
51
51
  }, className);
52
52
  const { props, html } = getSVGFromSource(src);
53
53
  return (<svg {...props} {...rest} className={glyphClasses} dangerouslySetInnerHTML={{
54
- __html: html
54
+ __html: html,
55
55
  }}/>);
56
56
  }
57
57
  export default memo(IconSVG);
@@ -28,10 +28,10 @@ export class Input extends PureComponent {
28
28
  size: Size.M,
29
29
  onChange: noop,
30
30
  inputRef: noop,
31
- enableShortcuts: ['esc']
31
+ enableShortcuts: ['esc'],
32
32
  };
33
33
  state = {
34
- empty: true
34
+ empty: true,
35
35
  };
36
36
  componentDidMount() {
37
37
  this.frame = requestAnimationFrame(() => this.adapt());
@@ -53,10 +53,9 @@ export class Input extends PureComponent {
53
53
  }
54
54
  checkValue() {
55
55
  this.setState({
56
- empty: !this.input?.value
56
+ empty: !this.input?.value,
57
57
  });
58
- if (this.props.multiline &&
59
- this.input != null && this.input.scrollHeight >= this.input.clientHeight) {
58
+ if (this.props.multiline && this.input != null && this.input.scrollHeight >= this.input.clientHeight) {
60
59
  this.stretch(this.input);
61
60
  }
62
61
  }
@@ -103,7 +102,7 @@ export class Input extends PureComponent {
103
102
  [styles.empty]: empty,
104
103
  [styles.withIcon]: icon != null,
105
104
  [styles.clearable]: clearable,
106
- [styles.borderless]: borderless
105
+ [styles.borderless]: borderless,
107
106
  });
108
107
  const inputClasses = classNames(styles.input, inputClassName);
109
108
  const text = value != null ? value : children;
@@ -115,22 +114,20 @@ export class Input extends PureComponent {
115
114
  id: this.getId(),
116
115
  placeholder,
117
116
  'aria-label': typeof label === 'string' && label ? label : placeholder,
118
- 'data-enabled-shortcuts': Array.isArray(enableShortcuts) ? enableShortcuts.join(',') : null
117
+ 'data-enabled-shortcuts': Array.isArray(enableShortcuts) ? enableShortcuts.join(',') : null,
119
118
  };
120
119
  return (<I18nContext.Consumer>
121
120
  {({ translate }) => (<div className={classes} data-test="ring-input">
122
- {label && (<ControlLabel htmlFor={this.getId()} disabled={disabled} type={labelType}>{label}</ControlLabel>)}
121
+ {label && (<ControlLabel htmlFor={this.getId()} disabled={disabled} type={labelType}>
122
+ {label}
123
+ </ControlLabel>)}
123
124
  <div className={styles.container}>
124
125
  {icon && <Icon glyph={icon} className={styles.icon}/>}
125
- {multiline
126
- ? (<textarea onChange={this.handleTextareaChange} rows={1} {...commonProps} {...restProps}/>)
127
- : (<input onChange={this.handleInputChange} {...commonProps} {...restProps}/>)}
126
+ {multiline ? (<textarea onChange={this.handleTextareaChange} rows={1} {...commonProps} {...restProps}/>) : (<input onChange={this.handleInputChange} {...commonProps} {...restProps}/>)}
128
127
  {clearable && !disabled && (<Button title={translations?.clear ?? translate('clear')} data-test="ring-input-clear" className={styles.clear} icon={closeIcon} onClick={this.clear}/>)}
129
128
  {afterInput}
130
129
  </div>
131
- {error
132
- ? <div className={styles.errorText}>{error}</div>
133
- : (help && <ControlHelp className={styles.helpText}>{help}</ControlHelp>)}
130
+ {error ? (<div className={styles.errorText}>{error}</div>) : (help && <ControlHelp className={styles.helpText}>{help}</ControlHelp>)}
134
131
  </div>)}
135
132
  </I18nContext.Consumer>);
136
133
  }
@@ -4,7 +4,7 @@ import './input-size.css';
4
4
  import '../error-bubble/error-bubble-legacy.css';
5
5
 
6
6
  export default {
7
- title: 'Style-only/Input Sizes'
7
+ title: 'Style-only/Input Sizes',
8
8
  };
9
9
 
10
10
  export const basic = () => (
@@ -12,48 +12,68 @@ export const basic = () => (
12
12
  <h3 className="example-block">Inputs</h3>
13
13
  <div className="example-block">
14
14
  <div className="ring-error-bubble-wrapper">
15
- <input id="extra-short-input" type="number" className="ring-input ring-input-size_xs"/>
16
- <label htmlFor="extra-short-input" className="ring-error-bubble active">Extra-short Input</label>
15
+ <input id="extra-short-input" type="number" className="ring-input ring-input-size_xs" />
16
+ <label htmlFor="extra-short-input" className="ring-error-bubble active">
17
+ Extra-short Input
18
+ </label>
17
19
  </div>
18
20
  <div className="ring-error-bubble-wrapper">
19
- <input id="short-input" type="number" className="ring-input ring-input-size_s"/>
20
- <label htmlFor="short-input" className="ring-error-bubble active">Short Input</label>
21
+ <input id="short-input" type="number" className="ring-input ring-input-size_s" />
22
+ <label htmlFor="short-input" className="ring-error-bubble active">
23
+ Short Input
24
+ </label>
21
25
  </div>
22
26
  <div className="ring-error-bubble-wrapper">
23
- <input id="medium-input" type="number" className="ring-input ring-input-size_m"/>
24
- <label htmlFor="medium-input" className="ring-error-bubble active">Medium Input</label>
27
+ <input id="medium-input" type="number" className="ring-input ring-input-size_m" />
28
+ <label htmlFor="medium-input" className="ring-error-bubble active">
29
+ Medium Input
30
+ </label>
25
31
  </div>
26
32
  <div className="ring-error-bubble-wrapper">
27
- <input id="long-input" type="number" className="ring-input ring-input-size_l"/>
28
- <label htmlFor="long-input" className="ring-error-bubble active">Long Input</label>
33
+ <input id="long-input" type="number" className="ring-input ring-input-size_l" />
34
+ <label htmlFor="long-input" className="ring-error-bubble active">
35
+ Long Input
36
+ </label>
29
37
  </div>
30
38
  <div className="ring-error-bubble-wrapper">
31
- <input id="full-width-input" type="number" className="ring-input"/>
32
- <label htmlFor="full-width-input" className="ring-error-bubble active">Full-width Input</label>
39
+ <input id="full-width-input" type="number" className="ring-input" />
40
+ <label htmlFor="full-width-input" className="ring-error-bubble active">
41
+ Full-width Input
42
+ </label>
33
43
  </div>
34
44
  </div>
35
45
 
36
46
  <h3 className="example-block">Textareas</h3>
37
47
  <div className="example-block">
38
48
  <div className="ring-error-bubble-wrapper">
39
- <textarea id="extra-short-textarea" className="ring-input ring-input-size_xs"/>
40
- <label htmlFor="extra-short-textarea" className="ring-error-bubble active">Extra-short Textarea</label>
49
+ <textarea id="extra-short-textarea" className="ring-input ring-input-size_xs" />
50
+ <label htmlFor="extra-short-textarea" className="ring-error-bubble active">
51
+ Extra-short Textarea
52
+ </label>
41
53
  </div>
42
54
  <div className="ring-error-bubble-wrapper">
43
- <textarea id="short-textarea" className="ring-input ring-input-size_s"/>
44
- <label htmlFor="short-textarea" className="ring-error-bubble active">Short Textarea</label>
55
+ <textarea id="short-textarea" className="ring-input ring-input-size_s" />
56
+ <label htmlFor="short-textarea" className="ring-error-bubble active">
57
+ Short Textarea
58
+ </label>
45
59
  </div>
46
60
  <div className="ring-error-bubble-wrapper">
47
- <textarea id="medium-textarea" className="ring-input ring-input-size_m"/>
48
- <label htmlFor="medium-textarea" className="ring-error-bubble active">Medium Textarea</label>
61
+ <textarea id="medium-textarea" className="ring-input ring-input-size_m" />
62
+ <label htmlFor="medium-textarea" className="ring-error-bubble active">
63
+ Medium Textarea
64
+ </label>
49
65
  </div>
50
66
  <div className="ring-error-bubble-wrapper">
51
- <textarea id="long-textarea" className="ring-input ring-input-size_l"/>
52
- <label htmlFor="long-textarea" className="ring-error-bubble active">Long Textarea</label>
67
+ <textarea id="long-textarea" className="ring-input ring-input-size_l" />
68
+ <label htmlFor="long-textarea" className="ring-error-bubble active">
69
+ Long Textarea
70
+ </label>
53
71
  </div>
54
72
  <div className="ring-error-bubble-wrapper">
55
- <textarea id="full-width-textarea" className="ring-input"/>
56
- <label htmlFor="full-width-textarea" className="ring-error-bubble active">Full-width Textarea</label>
73
+ <textarea id="full-width-textarea" className="ring-input" />
74
+ <label htmlFor="full-width-textarea" className="ring-error-bubble active">
75
+ Full-width Textarea
76
+ </label>
57
77
  </div>
58
78
  </div>
59
79
  </div>
@@ -68,5 +88,5 @@ basic.parameters = {
68
88
  margin: 16px;
69
89
  max-width: 600px;
70
90
  }
71
- </style>`
91
+ </style>`,
72
92
  };
@@ -7,7 +7,7 @@ export const ScrollHandlerContext = createContext(null);
7
7
  export default function adaptiveIslandHOC(ComposedComponent) {
8
8
  return class AdaptiveIsland extends Component {
9
9
  state = {
10
- phase: null
10
+ phase: null,
11
11
  };
12
12
  onContentScroll = ({ scrollTop, scrollHeight, clientHeight }) => {
13
13
  if (scrollHeight - clientHeight >=
@@ -12,11 +12,11 @@ class Content extends Component {
12
12
  fade: true,
13
13
  bottomBorder: false,
14
14
  onScroll: noop,
15
- onScrollToBottom: noop
15
+ onScrollToBottom: noop,
16
16
  };
17
17
  state = {
18
18
  scrolledToTop: true,
19
- scrolledToBottom: false
19
+ scrolledToBottom: false,
20
20
  };
21
21
  componentWillUnmount() {
22
22
  this.scrollableNode = null;
@@ -63,14 +63,12 @@ class Content extends Component {
63
63
  [styles.contentWithTopFade]: fade && !scrolledToTop,
64
64
  [styles.contentWithBottomFade]: fade && !scrolledToBottom,
65
65
  [styles.withTransparentBottomBorder]: bottomBorder,
66
- [styles.withBottomBorder]: bottomBorder && !scrolledToBottom
66
+ [styles.withBottomBorder]: bottomBorder && !scrolledToBottom,
67
67
  });
68
68
  const scrollableWrapperClasses = classNames(styles.scrollableWrapper, scrollableWrapperClassName);
69
69
  return (<div {...restProps} data-test="ring-island-content" className={classes}>
70
70
  <div tabIndex={tabIndex} className={scrollableWrapperClasses} ref={this.setScrollableNodeAndCalculatePosition} onScroll={fade ? this.calculateScrollPosition : noop}>
71
- {fade && (<div ref={this.setWrapper}>
72
- {children}
73
- </div>)}
71
+ {fade && <div ref={this.setWrapper}>{children}</div>}
74
72
 
75
73
  {!fade && children}
76
74
  </div>
@@ -10,7 +10,7 @@ const Start = {
10
10
  PADDING_BOTTOM: 0,
11
11
  X: 0,
12
12
  Y: 0,
13
- SPACING: 0
13
+ SPACING: 0,
14
14
  };
15
15
  const End = {
16
16
  FONT_SIZE: 13,
@@ -20,12 +20,12 @@ const End = {
20
20
  // Compensation
21
21
  X: 0.4,
22
22
  Y: 0.1,
23
- SPACING: 1.09
23
+ SPACING: 1.09,
24
24
  };
25
25
  const BORDER_APPEAR_PHASE = 0.5;
26
26
  class Header extends Component {
27
27
  static defaultProps = {
28
- wrapWithTitle: true
28
+ wrapWithTitle: true,
29
29
  };
30
30
  style(name) {
31
31
  return interpolateLinear(Start[name], End[name], this.props.phase ?? 0);
@@ -33,31 +33,29 @@ class Header extends Component {
33
33
  render() {
34
34
  const { children, className, wrapWithTitle, border, phase, ...restProps } = this.props;
35
35
  const classes = classNames(styles.header, className, {
36
- [styles.withBottomBorder]: border || phase != null && phase >= BORDER_APPEAR_PHASE
36
+ [styles.withBottomBorder]: border || (phase != null && phase >= BORDER_APPEAR_PHASE),
37
37
  });
38
38
  const headerStyle = phase != null
39
39
  ? {
40
40
  lineHeight: `${this.style('LINE_HEIGHT')}px`, // need to append px because number is a valid line-height value
41
41
  paddingTop: this.style('PADDING_TOP'),
42
- paddingBottom: this.style('PADDING_BOTTOM')
42
+ paddingBottom: this.style('PADDING_BOTTOM'),
43
43
  }
44
44
  : undefined;
45
45
  const scaleFont = phase != null && this.style('FONT_SIZE') / Start.FONT_SIZE;
46
- const titleStyle = (phase != null && phase < 1)
46
+ const titleStyle = phase != null && phase < 1
47
47
  ? {
48
48
  fontSize: Start.FONT_SIZE,
49
49
  transform: `translate(${this.style('X')}px, ${this.style('Y')}px) scale(${scaleFont})`,
50
- letterSpacing: this.style('SPACING')
50
+ letterSpacing: this.style('SPACING'),
51
51
  }
52
52
  : undefined;
53
53
  return (<div {...restProps} data-test="ring-island-header" className={classes} style={headerStyle}>
54
- {wrapWithTitle &&
55
- (<h2 className={styles.title} style={titleStyle}>
54
+ {wrapWithTitle && (<h2 className={styles.title} style={titleStyle}>
56
55
  {children}
57
56
  </h2>)}
58
57
 
59
58
  {!wrapWithTitle && children}
60
-
61
59
  </div>);
62
60
  }
63
61
  }
@@ -1,9 +1,9 @@
1
1
  @import "../global/variables.css";
2
2
 
3
- @value gradientStart: rgba(255, 255, 255, 0);
4
- @value gradientStop: var(--ring-content-background-color);
5
-
6
3
  .island {
4
+ --ring-island-gradient-start: rgba(255, 255, 255, 0);
5
+ --ring-island-gradient-stop: var(--ring-content-background-color);
6
+
7
7
  display: flex;
8
8
  flex-direction: column;
9
9
 
@@ -103,7 +103,7 @@
103
103
 
104
104
  opacity: 0.8;
105
105
 
106
- background: linear-gradient(to top, gradientStart, gradientStop);
106
+ background: linear-gradient(to top, var(--ring-island-gradient-start), var(--ring-island-gradient-stop));
107
107
  }
108
108
 
109
109
  .contentWithTopFade:first-child::before {
@@ -127,5 +127,5 @@
127
127
  opacity: 0.8;
128
128
  border-bottom-right-radius: var(--ring-border-radius);
129
129
  border-bottom-left-radius: var(--ring-border-radius);
130
- background: linear-gradient(to bottom, gradientStart, gradientStop);
130
+ background: linear-gradient(to bottom, var(--ring-island-gradient-start), var(--ring-island-gradient-stop));
131
131
  }
@@ -11,7 +11,7 @@ export default class Island extends Component {
11
11
  const { children, className, narrow, withoutPaddings, 'data-test': dataTest, ...restProps } = this.props;
12
12
  const classes = classNames(styles.island, className, {
13
13
  [styles.narrowIsland]: narrow,
14
- [styles.withoutPaddings]: withoutPaddings
14
+ [styles.withoutPaddings]: withoutPaddings,
15
15
  });
16
16
  return (<div {...restProps} className={classes} data-test={dataTests('ring-island', dataTest)}>
17
17
  {children}
@@ -20,6 +20,8 @@ export default class ClickableLink extends PureComponent {
20
20
  };
21
21
  render() {
22
22
  const { onConditionalClick, onPlainLeftClick, activeClassName, href, children, ...restProps } = this.props;
23
- return <a href={href} {...restProps} onClick={this.onClick}>{children}</a>;
23
+ return (<a href={href} {...restProps} onClick={this.onClick}>
24
+ {children}
25
+ </a>);
24
26
  }
25
27
  }
@@ -8,19 +8,21 @@ export function linkHOC(ComposedComponent) {
8
8
  return class Link extends PureComponent {
9
9
  render() {
10
10
  const { active, inherit, pseudo, hover, className, 'data-test': dataTest, href, children, onPlainLeftClick, onClick, ...restProps } = this.props;
11
- const useButton = pseudo || !isCustom && href == null;
11
+ const useButton = pseudo || (!isCustom && href == null);
12
12
  const classes = classNames(styles.link, className, {
13
13
  [styles.active]: active,
14
14
  [styles.inherit]: inherit,
15
15
  [styles.hover]: hover,
16
- [styles.pseudo]: useButton
16
+ [styles.pseudo]: useButton,
17
17
  });
18
18
  let props = restProps;
19
19
  if (isCustom && !props.activeClassName) {
20
20
  props = { ...props, activeClassName: styles.active };
21
21
  }
22
22
  if (useButton) {
23
- return (<button type="button" {...props} className={classes} onClick={(onClick || onPlainLeftClick)} data-test={dataTests('ring-link', dataTest)}>{children}</button>);
23
+ return (<button type="button" {...props} className={classes} onClick={(onClick || onPlainLeftClick)} data-test={dataTests('ring-link', dataTest)}>
24
+ {children}
25
+ </button>);
24
26
  }
25
27
  return (<ComposedComponent {...props} href={href} className={classes} onClick={onClick} onPlainLeftClick={onPlainLeftClick} data-test={dataTests('ring-link', dataTest)}>
26
28
  {children}
@@ -20,6 +20,6 @@ export const Dimension = {
20
20
  SEPARATOR_TEXT_HEIGHT: 18,
21
21
  TITLE_HEIGHT: 42,
22
22
  INNER_PADDING: 8,
23
- MARGIN: 8
23
+ MARGIN: 8,
24
24
  };
25
25
  export const DEFAULT_ITEM_TYPE = Type.ITEM;
@@ -163,7 +163,7 @@ export default class List<T = unknown> extends Component<ListProps<T>, ListState
163
163
  containerRef: (el: HTMLElement | null) => void;
164
164
  private _inner?;
165
165
  get inner(): HTMLElement | null | undefined;
166
- renderVirtualizedInner({ height, maxHeight, autoHeight, rowCount, isScrolling, onChildScroll, scrollTop, registerChild }: RenderVirtualizedInnerParams): import("react").JSX.Element;
166
+ renderVirtualizedInner({ height, maxHeight, autoHeight, rowCount, isScrolling, onChildScroll, scrollTop, registerChild, }: RenderVirtualizedInnerParams): import("react").JSX.Element;
167
167
  renderVirtualized(maxHeight: number | null | undefined, rowCount: number): import("react").JSX.Element;
168
168
  renderSimple(maxHeight: number | null | undefined, rowCount: number): import("react").JSX.Element;
169
169
  id: string;