@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.
- package/babel.config.js +20 -14
- package/components/alert/alert.css +7 -7
- package/components/alert/alert.d.ts +2 -2
- package/components/alert/alert.js +10 -12
- package/components/alert/container.js +1 -1
- package/components/alert-service/alert-service.js +4 -2
- package/components/analytics/analytics__custom-plugin.js +1 -1
- package/components/auth/auth.js +1 -1
- package/components/auth/auth__core.js +36 -36
- package/components/auth/background-flow.js +2 -2
- package/components/auth/down-notification.js +3 -1
- package/components/auth/iframe-flow.js +4 -2
- package/components/auth/request-builder.js +5 -5
- package/components/auth/storage.js +10 -9
- package/components/auth/token-validator.js +8 -15
- package/components/auth-dialog/auth-dialog.js +8 -8
- package/components/auth-dialog-service/auth-dialog-service.js +4 -4
- package/components/avatar/avatar.js +9 -7
- package/components/avatar/fallback-avatar.js +15 -12
- package/components/button/button.css +31 -24
- package/components/button/button.js +9 -9
- package/components/button/button__classes.d.ts +1 -1
- package/components/button/button__classes.js +3 -4
- package/components/button-group/button-group.css +25 -13
- package/components/button-group/caption.js +1 -1
- package/components/button-toolbar/button-toolbar.d.ts +1 -1
- package/components/button-toolbar/button-toolbar.js +2 -2
- package/components/caret/caret.js +8 -8
- package/components/checkbox/checkbox.css +8 -5
- package/components/checkbox/checkbox.js +1 -1
- package/components/clipboard/clipboard-fallback.js +2 -6
- package/components/clipboard/clipboard.js +5 -5
- package/components/code/code.d.ts +1 -1
- package/components/code/code.js +2 -2
- package/components/code/highlight.css +3 -1
- package/components/collapse/collapse-content.js +3 -3
- package/components/collapse/collapse-context.js +1 -1
- package/components/collapse/collapse-control.js +5 -3
- package/components/collapse/collapse.css +21 -20
- package/components/collapse/collapse.js +2 -2
- package/components/confirm/confirm.d.ts +2 -2
- package/components/confirm/confirm.js +2 -2
- package/components/confirm-service/confirm-service.d.ts +1 -1
- package/components/confirm-service/confirm-service.js +6 -6
- package/components/content-layout/content-layout.css +6 -5
- package/components/content-layout/content-layout.js +7 -6
- package/components/content-layout/sidebar.js +5 -5
- package/components/contenteditable/contenteditable.d.ts +1 -1
- package/components/contenteditable/contenteditable.js +3 -4
- package/components/control-label/control-label.js +5 -3
- package/components/data-list/data-list.css +3 -3
- package/components/data-list/data-list.d.ts +2 -2
- package/components/data-list/data-list.js +6 -7
- package/components/data-list/data-list.mock.js +57 -47
- package/components/data-list/item.js +14 -16
- package/components/data-list/selection.js +5 -7
- package/components/data-list/title.js +5 -6
- package/components/date-picker/consts.js +2 -2
- package/components/date-picker/date-input.js +4 -4
- package/components/date-picker/date-picker.css +23 -18
- package/components/date-picker/date-picker.d.ts +2 -1
- package/components/date-picker/date-picker.js +13 -19
- package/components/date-picker/date-popup.js +30 -36
- package/components/date-picker/day.js +6 -9
- package/components/date-picker/formats.js +647 -1
- package/components/date-picker/month-names.js +6 -8
- package/components/date-picker/month-slider.js +2 -2
- package/components/date-picker/month.js +1 -3
- package/components/date-picker/months.js +2 -6
- package/components/date-picker/weekdays.js +2 -3
- package/components/date-picker/years.js +3 -3
- package/components/dialog/dialog.d.ts +1 -0
- package/components/dialog/dialog.js +20 -13
- package/components/dialog/dialog__body-scroll-preventer.js +1 -1
- package/components/dropdown/dropdown.css +2 -4
- package/components/dropdown/dropdown.d.ts +2 -2
- package/components/dropdown/dropdown.js +5 -5
- package/components/dropdown-menu/dropdown-menu.js +5 -5
- package/components/editable-heading/editable-heading.css +5 -2
- package/components/editable-heading/editable-heading.js +21 -19
- package/components/error-bubble/error-bubble.js +1 -1
- package/components/error-message/error-message.js +2 -4
- package/components/footer/footer.js +11 -15
- package/components/form/form.stories.js +45 -63
- package/components/global/create-stateful-context.js +2 -4
- package/components/global/data-tests.js +5 -6
- package/components/global/dom.js +8 -11
- package/components/global/focus-sensor-hoc.js +5 -6
- package/components/global/fuzzy-highlight.js +1 -1
- package/components/global/get-event-key.js +2 -2
- package/components/global/global.css +0 -3
- package/components/global/linear-function.js +1 -1
- package/components/global/normalize-indent.js +2 -6
- package/components/global/react-dom-renderer.js +2 -3
- package/components/global/theme.js +9 -10
- package/components/global/url.js +8 -8
- package/components/global/variables.css +1 -8
- package/components/global/variables_dark.css +0 -1
- package/components/grid/col.js +6 -6
- package/components/grid/grid.css +174 -173
- package/components/grid/grid.js +1 -1
- package/components/grid/row.js +13 -6
- package/components/group/group.js +1 -1
- package/components/header/header-icon.js +2 -2
- package/components/header/header.css +19 -15
- package/components/header/header.js +3 -5
- package/components/header/links.js +1 -1
- package/components/header/logo.js +1 -1
- package/components/header/profile.d.ts +2 -2
- package/components/header/profile.js +9 -9
- package/components/header/services-link.js +1 -1
- package/components/header/services.js +4 -5
- package/components/header/smart-profile.js +4 -3
- package/components/header/smart-services.js +9 -5
- package/components/header/tray.js +1 -1
- package/components/heading/heading.css +0 -1
- package/components/heading/heading.js +2 -2
- package/components/http/http.d.ts +3 -3
- package/components/http/http.js +25 -29
- package/components/http/http.mock.js +9 -6
- package/components/hub-source/hub-source.js +5 -7
- package/components/hub-source/hub-source__user.js +1 -1
- package/components/hub-source/hub-source__users-groups.js +6 -7
- package/components/i18n/README.md +3 -4
- package/components/i18n/i18n-context.js +2 -4
- package/components/icon/icon.js +7 -9
- package/components/icon/icon__svg.js +6 -6
- package/components/input/input.js +11 -14
- package/components/input-size/input-size.stories.js +42 -22
- package/components/island/adaptive-island-hoc.js +1 -1
- package/components/island/content.js +4 -6
- package/components/island/header.js +8 -10
- package/components/island/island.css +5 -5
- package/components/island/island.js +1 -1
- package/components/link/clickableLink.js +3 -1
- package/components/link/link.js +5 -3
- package/components/list/consts.js +1 -1
- package/components/list/list.d.ts +1 -1
- package/components/list/list.js +35 -57
- package/components/list/list__custom.js +3 -5
- package/components/list/list__hint.js +3 -1
- package/components/list/list__item.js +11 -9
- package/components/list/list__link.js +1 -1
- package/components/list/list__separator.js +2 -2
- package/components/list/list__title.js +7 -3
- package/components/list/list__users-groups-source.js +6 -8
- package/components/loader/loader.js +1 -1
- package/components/loader/loader__core.js +5 -5
- package/components/loader-inline/loader-inline.css +0 -3
- package/components/loader-inline/loader-inline.js +5 -7
- package/components/loader-screen/loader-screen.js +1 -1
- package/components/login-dialog/login-dialog.js +4 -4
- package/components/login-dialog/service.js +5 -5
- package/components/markdown/markdown.css +6 -6
- package/components/markdown/markdown.d.ts +2 -2
- package/components/markdown/markdown.js +4 -6
- package/components/message/message.css +2 -1
- package/components/message/message.js +30 -21
- package/components/old-browsers-message/old-browsers-message.js +2 -2
- package/components/old-browsers-message/white-list.js +2 -3
- package/components/pager/pager.js +28 -29
- package/components/permissions/permissions.js +8 -13
- package/components/permissions/permissions__cache.js +6 -7
- package/components/popup/popup.consts.js +8 -2
- package/components/popup/popup.js +27 -33
- package/components/popup/popup.target.js +4 -4
- package/components/popup/position.js +21 -28
- package/components/popup-menu/popup-menu.js +1 -1
- package/components/progress-bar/progress-bar.css +10 -8
- package/components/progress-bar/progress-bar.d.ts +2 -2
- package/components/progress-bar/progress-bar.js +2 -2
- package/components/query-assist/query-assist.css +0 -3
- package/components/query-assist/query-assist.js +73 -84
- package/components/query-assist/query-assist__suggestions.js +10 -9
- package/components/radio/radio.css +6 -2
- package/components/radio/radio.js +1 -3
- package/components/scrollable-section/scrollable-section.css +5 -6
- package/components/scrollable-section/scrollable-section.js +1 -1
- package/components/select/select.css +5 -5
- package/components/select/select.d.ts +1 -1
- package/components/select/select.js +96 -110
- package/components/select/select__filter.js +1 -1
- package/components/select/select__popup.js +40 -51
- package/components/shortcuts/core.js +10 -7
- package/components/shortcuts/shortcut-title.js +6 -6
- package/components/shortcuts/shortcuts.js +1 -1
- package/components/sidebar/sidebar.css +3 -1
- package/components/slider/slider.css +14 -14
- package/components/slider/slider.js +7 -7
- package/components/tab-trap/tab-trap.js +7 -9
- package/components/table/cell.js +3 -1
- package/components/table/disable-hover-hoc.js +2 -2
- package/components/table/header-cell.js +5 -3
- package/components/table/header.d.ts +1 -2
- package/components/table/header.js +10 -12
- package/components/table/multitable.js +5 -3
- package/components/table/row.d.ts +0 -1
- package/components/table/row.js +20 -27
- package/components/table/selection-adapter.js +1 -1
- package/components/table/selection-shortcuts-hoc.js +2 -2
- package/components/table/selection.d.ts +2 -3
- package/components/table/selection.js +4 -5
- package/components/table/simple-table.js +4 -4
- package/components/table/smart-table.js +5 -5
- package/components/table/table.css +8 -9
- package/components/table/table.d.ts +0 -1
- package/components/table/table.js +22 -23
- package/components/table/table.stories.json +45 -16
- package/components/tabs/collapsible-more.d.ts +1 -1
- package/components/tabs/collapsible-more.js +13 -16
- package/components/tabs/collapsible-tab.js +2 -2
- package/components/tabs/collapsible-tabs.d.ts +2 -2
- package/components/tabs/collapsible-tabs.js +13 -22
- package/components/tabs/dumb-tabs.js +6 -9
- package/components/tabs/smart-tabs.js +4 -4
- package/components/tabs/tab-link.js +1 -3
- package/components/tabs/tabs.css +7 -9
- package/components/tag/tag.css +6 -6
- package/components/tag/tag.d.ts +1 -1
- package/components/tag/tag.js +9 -12
- package/components/tags-input/tags-input.js +15 -19
- package/components/tags-list/tags-list.d.ts +2 -2
- package/components/tags-list/tags-list.js +6 -5
- package/components/text/text.js +5 -3
- package/components/toggle/toggle.css +12 -10
- package/components/toggle/toggle.d.ts +2 -2
- package/components/toggle/toggle.js +4 -3
- package/components/tooltip/tooltip.js +13 -8
- package/components/user-agreement/service.js +15 -13
- package/components/user-agreement/user-agreement.js +3 -5
- package/components/user-card/card.js +10 -9
- package/components/user-card/smart-user-card-tooltip.js +5 -7
- package/components/user-card/tooltip.js +4 -4
- package/components/user-card/user-card.css +4 -0
- package/jslint-xml.js +20 -19
- package/package.json +59 -50
- package/postcss.config.js +3 -4
- package/typings.d.ts +2 -4
- package/webpack.config.js +20 -25
- package/components/badge/badge.css +0 -42
- package/components/badge/badge.d.ts +0 -14
- package/components/badge/badge.js +0 -29
- package/components/island-legacy/content-legacy.d.ts +0 -5
- package/components/island-legacy/content-legacy.js +0 -12
- package/components/island-legacy/header-legacy.d.ts +0 -5
- package/components/island-legacy/header-legacy.js +0 -14
- package/components/island-legacy/island-legacy.css +0 -98
- package/components/island-legacy/island-legacy.d.ts +0 -7
- package/components/island-legacy/island-legacy.js +0 -14
- package/components/table-legacy/table-legacy.css +0 -346
- 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) =>
|
|
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
|
|
13
|
-
{children}
|
|
14
|
-
</I18nContext.Provider>);
|
|
12
|
+
return <I18nContext.Provider value={{ messages, translate }}>{children}</I18nContext.Provider>;
|
|
15
13
|
};
|
package/components/icon/icon.js
CHANGED
|
@@ -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
|
|
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\.]+"/
|
|
45
|
-
const hasHeight = /height="[\d\.]+"/
|
|
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}>
|
|
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">
|
|
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">
|
|
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">
|
|
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">
|
|
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">
|
|
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">
|
|
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">
|
|
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">
|
|
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">
|
|
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">
|
|
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 &&
|
|
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 =
|
|
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,
|
|
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,
|
|
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}>
|
|
23
|
+
return (<a href={href} {...restProps} onClick={this.onClick}>
|
|
24
|
+
{children}
|
|
25
|
+
</a>);
|
|
24
26
|
}
|
|
25
27
|
}
|
package/components/link/link.js
CHANGED
|
@@ -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)}>
|
|
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}
|
|
@@ -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;
|