@jetbrains/ring-ui 5.0.0-beta.3 → 5.0.0-beta.7
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/CHANGELOG.md +49 -1
- package/babel.config.js +1 -12
- package/components/alert/alert.css +3 -14
- package/components/alert/alert.d.ts +3 -0
- package/components/alert/alert.js +8 -7
- package/components/alert/container.css +0 -2
- package/components/alert-service/alert-service.examples.css +5 -3
- package/components/auth/auth__core.d.ts +3 -1
- package/components/auth/auth__core.js +42 -15
- package/components/auth/down-notification.css +1 -1
- package/components/auth-dialog/auth-dialog.d.ts +11 -0
- package/components/auth-dialog/auth-dialog.js +33 -2
- package/components/autofocus-ng/autofocus-ng.js +1 -1
- package/components/autofocus-ng/autofocus-ng.test.js +1 -1
- package/components/button/button.css +93 -204
- package/components/button/button.d.ts +7 -8
- package/components/button/button.js +6 -8
- package/components/button/button__classes.d.ts +1 -1
- package/components/button/button__classes.js +4 -7
- package/components/button-group/button-group.css +136 -19
- package/components/button-group/button-group.d.ts +4 -1
- package/components/button-group/button-group.js +3 -3
- package/components/button-group-ng/button-group-ng.css +1 -0
- package/components/button-group-ng/button-group-ng.examples.js +1 -1
- package/components/button-ng/button-ng.examples.js +6 -7
- package/components/button-ng/button-ng.js +6 -25
- package/components/button-set/button-set.css +1 -0
- package/components/button-toolbar/button-toolbar.css +2 -0
- package/components/checkbox/checkbox.css +10 -4
- package/components/date-picker/date-input.js +2 -1
- package/components/date-picker/date-picker.css +2 -1
- package/components/dialog/dialog.css +10 -3
- package/components/dialog-ng/dialog-ng__template.js +1 -0
- package/components/error-bubble/error-bubble-legacy.css +1 -1
- package/components/error-bubble/error-bubble.css +1 -1
- package/components/global/controls-height.d.ts +7 -0
- package/components/global/controls-height.js +8 -0
- package/components/global/theme.d.ts +7 -20
- package/components/global/theme.js +26 -32
- package/components/global/variables.css +30 -25
- package/components/global/variables.d.ts +10 -8
- package/components/global/variables_dark.css +68 -0
- package/components/header/header.css +19 -10
- package/components/header/header.d.ts +7 -69
- package/components/header/header.js +10 -9
- package/components/header/services.css +3 -3
- package/components/header/services.d.ts +5 -0
- package/components/header/services.js +8 -2
- package/components/header/tray-icon.d.ts +18 -575
- package/components/heading/heading.css +4 -1
- package/components/icon/icon.css +1 -1
- package/components/input/input.css +81 -151
- package/components/input/input.d.ts +13 -17
- package/components/input/input.js +28 -32
- package/components/input-ng/input-ng.examples.js +1 -1
- package/components/input-ng/input-ng.js +45 -49
- package/components/island/adaptive-island-hoc.d.ts +2 -2
- package/components/island/adaptive-island-hoc.js +2 -2
- package/components/island/content.js +2 -7
- package/components/island/header.js +7 -4
- package/components/island/island.css +8 -5
- package/components/island/island.d.ts +2 -2
- package/components/island-legacy/island-legacy.css +1 -1
- package/components/list/list.d.ts +1 -1
- package/components/loader-inline/loader-inline.css +14 -0
- package/components/loader-inline/loader-inline.d.ts +4 -41
- package/components/loader-inline/loader-inline.js +3 -11
- package/components/loader-inline-ng/loader-inline-ng.js +1 -17
- package/components/loader-inline-ng/loader-inline-ng.test.js +0 -11
- package/components/markdown/code.d.ts +6 -13
- package/components/markdown/code.js +2 -2
- package/components/markdown/heading.d.ts +5 -9
- package/components/markdown/heading.js +2 -2
- package/components/markdown/link.d.ts +4 -8
- package/components/markdown/link.js +1 -1
- package/components/markdown/markdown.d.ts +2 -3
- package/components/markdown/markdown.js +14 -11
- package/components/message/message.css +7 -3
- package/components/message/message.d.ts +3 -0
- package/components/message/message.js +16 -9
- package/components/pager/pager.js +2 -8
- package/components/popup/popup.css +1 -1
- package/components/popup/popup.target.d.ts +1 -0
- package/components/progress-bar/progress-bar.css +8 -12
- package/components/progress-bar/progress-bar.d.ts +0 -4
- package/components/progress-bar/progress-bar.js +1 -6
- package/components/progress-bar-ng/progress-bar-ng.examples.js +3 -2
- package/components/query-assist/query-assist.css +48 -64
- package/components/query-assist/query-assist.d.ts +0 -5
- package/components/query-assist/query-assist.js +4 -10
- package/components/radio/radio.css +10 -4
- package/components/select/select.css +19 -37
- package/components/select/select.d.ts +4 -6
- package/components/select/select.js +17 -30
- package/components/select/select__filter.js +2 -1
- package/components/select/select__popup.js +1 -2
- package/components/select-ng/select-ng.examples.js +1 -0
- package/components/select-ng/select-ng.js +3 -1
- package/components/select-ng/select-ng.test.js +1 -1
- package/components/select-ng/select-ng__lazy.js +1 -2
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.css +1 -1
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.examples.js +1 -1
- package/components/tabs/collapsible-tab.js +2 -2
- package/components/tabs/dumb-tabs.d.ts +4 -107
- package/components/tabs/dumb-tabs.js +5 -9
- package/components/tabs/tab.d.ts +2 -0
- package/components/tabs/tabs.css +8 -28
- package/components/tabs-ng/tabs-ng.examples.js +11 -3
- package/components/tabs-ng/tabs-ng.js +1 -4
- package/components/tabs-ng/tabs-ng__template.js +1 -1
- package/components/tag/tag.css +31 -8
- package/components/tag/tag.d.ts +1 -0
- package/components/tag/tag.js +1 -0
- package/components/tags-input/tags-input.css +10 -4
- package/components/toggle/toggle.css +61 -35
- package/components/toggle/toggle.d.ts +9 -89
- package/components/toggle/toggle.js +7 -7
- package/components/tooltip/tooltip.css +7 -0
- package/components/tooltip/tooltip.d.ts +1 -0
- package/components/tooltip/tooltip.js +3 -2
- package/components/user-agreement/service.d.ts +2 -2
- package/components/user-agreement/user-agreement.js +1 -1
- package/dist/_helpers/anchor.js +3 -3
- package/dist/_helpers/badge.js +1 -1
- package/dist/_helpers/button-group.js +1 -1
- package/dist/_helpers/button-set.js +1 -1
- package/dist/_helpers/button-toolbar.js +1 -1
- package/dist/_helpers/button__classes.js +5 -8
- package/dist/_helpers/card.js +1 -1
- package/dist/_helpers/checkbox.js +1 -1
- package/dist/_helpers/date-picker.js +1 -1
- package/dist/_helpers/dialog__body-scroll-preventer.js +1 -1
- package/dist/_helpers/error-message.js +1 -1
- package/dist/_helpers/footer.js +1 -1
- package/dist/_helpers/grid.js +1 -1
- package/dist/_helpers/group.js +1 -1
- package/dist/_helpers/header.js +1 -1
- package/dist/_helpers/icon.js +1 -1
- package/dist/_helpers/input.js +1 -1
- package/dist/_helpers/island.js +1 -1
- package/dist/_helpers/link.js +1 -1
- package/dist/_helpers/list.js +1 -1
- package/dist/_helpers/loader-inline.js +3 -0
- package/dist/_helpers/loader-screen.js +1 -1
- package/dist/_helpers/panel.js +1 -1
- package/dist/_helpers/query-assist__suggestions.js +1 -1
- package/dist/_helpers/radio.js +1 -1
- package/dist/_helpers/select__filter.js +5 -3
- package/dist/_helpers/services-link.js +1 -1
- package/dist/_helpers/sidebar.js +1 -1
- package/dist/_helpers/table.js +1 -1
- package/dist/_helpers/tabs.js +1 -1
- package/dist/_helpers/theme.js +50 -0
- package/dist/_helpers/title.js +1 -1
- package/dist/alert/alert.d.ts +3 -0
- package/dist/alert/alert.js +21 -19
- package/dist/alert/container.js +1 -1
- package/dist/alert-service/alert-service.js +9 -7
- package/dist/auth/auth.js +9 -9
- package/dist/auth/auth__core.d.ts +3 -1
- package/dist/auth/auth__core.js +58 -26
- package/dist/auth/down-notification.js +8 -8
- package/dist/auth/iframe-flow.js +1 -1
- package/dist/auth/landing.js +9 -9
- package/dist/auth/storage.js +9 -7
- package/dist/auth-dialog/auth-dialog.d.ts +11 -0
- package/dist/auth-dialog/auth-dialog.js +52 -7
- package/dist/auth-dialog-service/auth-dialog-service.js +1 -1
- package/dist/auth-ng/auth-ng.js +9 -9
- package/dist/autofocus-ng/autofocus-ng.js +1 -1
- package/dist/avatar/avatar.js +1 -1
- package/dist/avatar-editor-ng/avatar-editor-ng.js +9 -7
- package/dist/breadcrumb-ng/breadcrumb-ng.js +1 -1
- package/dist/button/button.d.ts +7 -8
- package/dist/button/button.js +6 -8
- package/dist/button/button__classes.d.ts +1 -1
- package/dist/button/button__classes.js +0 -3
- package/dist/button-group/button-group.d.ts +4 -1
- package/dist/button-group/button-group.js +5 -3
- package/dist/button-group-ng/button-group-ng.js +1 -1
- package/dist/button-ng/button-ng.js +6 -31
- package/dist/code/code.js +1 -1
- package/dist/confirm/confirm.js +5 -5
- package/dist/confirm-ng/confirm-ng.js +1 -1
- package/dist/confirm-service/confirm-service.js +1 -1
- package/dist/data-list/data-list.js +2 -7
- package/dist/data-list/item.js +8 -13
- package/dist/data-list-ng/data-list-ng.js +2 -7
- package/dist/date-picker/date-input.js +4 -3
- package/dist/date-picker/date-picker.js +1 -1
- package/dist/date-picker/date-popup.js +1 -1
- package/dist/dialog/dialog.js +3 -3
- package/dist/dialog-ng/dialog-ng.js +3 -3
- package/dist/dialog-ng/dialog-ng__template.js +1 -0
- package/dist/docked-panel-ng/docked-panel-ng.js +1 -1
- package/dist/dropdown/anchor.js +1 -1
- package/dist/dropdown/dropdown.js +1 -1
- package/dist/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/error-bubble/error-bubble.js +1 -1
- package/dist/global/controls-height.d.ts +7 -0
- package/dist/global/controls-height.js +13 -0
- package/dist/global/theme.d.ts +7 -20
- package/dist/global/theme.js +7 -62
- package/dist/global/variables.d.ts +10 -8
- package/dist/header/header.d.ts +7 -69
- package/dist/header/header.js +13 -17
- package/dist/header/profile.js +3 -3
- package/dist/header/services.d.ts +5 -0
- package/dist/header/services.js +11 -3
- package/dist/header/smart-profile.js +10 -14
- package/dist/header/smart-services.js +9 -13
- package/dist/header/tray-icon.d.ts +18 -575
- package/dist/header/tray-icon.js +4 -4
- package/dist/heading/heading.js +1 -1
- package/dist/input/input.d.ts +13 -17
- package/dist/input/input.js +32 -41
- package/dist/input-ng/input-ng.js +46 -49
- package/dist/island/adaptive-island-hoc.d.ts +2 -2
- package/dist/island/adaptive-island-hoc.js +4 -2
- package/dist/island/content.js +2 -9
- package/dist/island/header.js +7 -4
- package/dist/island/island.d.ts +2 -2
- package/dist/list/list.d.ts +1 -1
- package/dist/loader/loader__core.js +1 -1
- package/dist/loader-inline/loader-inline.d.ts +4 -41
- package/dist/loader-inline/loader-inline.js +3 -21
- package/dist/loader-inline-ng/loader-inline-ng.js +2 -30
- package/dist/login-dialog/login-dialog.js +2 -2
- package/dist/login-dialog/service.js +1 -1
- package/dist/markdown/code.d.ts +6 -13
- package/dist/markdown/code.js +3 -3
- package/dist/markdown/heading.d.ts +5 -9
- package/dist/markdown/heading.js +2 -2
- package/dist/markdown/link.d.ts +4 -8
- package/dist/markdown/link.js +1 -1
- package/dist/markdown/markdown.d.ts +2 -3
- package/dist/markdown/markdown.js +16 -16
- package/dist/message/message.d.ts +3 -0
- package/dist/message/message.js +18 -10
- package/dist/pager/pager.js +8 -12
- package/dist/pager-ng/pager-ng.js +3 -7
- package/dist/permissions-ng/permissions-ng.js +9 -9
- package/dist/popup/popup.js +1 -1
- package/dist/popup/popup.target.d.ts +1 -0
- package/dist/progress-bar/progress-bar.d.ts +0 -4
- package/dist/progress-bar/progress-bar.js +1 -7
- package/dist/progress-bar-ng/progress-bar-ng.js +0 -1
- package/dist/promised-click-ng/promised-click-ng.js +2 -2
- package/dist/query-assist/query-assist.d.ts +0 -5
- package/dist/query-assist/query-assist.js +10 -26
- package/dist/query-assist-ng/query-assist-ng.js +2 -7
- package/dist/save-field-ng/save-field-ng.js +2 -9
- package/dist/select/select.d.ts +4 -6
- package/dist/select/select.js +35 -58
- package/dist/select/select__filter.js +1 -1
- package/dist/select/select__popup.js +7 -13
- package/dist/select-ng/select-ng.js +5 -9
- package/dist/select-ng/select-ng__lazy.js +7 -11
- package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +2 -2
- package/dist/sidebar-ng/sidebar-ng.js +2 -2
- package/dist/storage/storage.js +9 -7
- package/dist/storage/storage__local.js +9 -7
- package/dist/style.css +1 -1
- package/dist/tab-trap/tab-trap.js +1 -1
- package/dist/table/row-with-focus-sensor.js +1 -1
- package/dist/table/row.js +5 -5
- package/dist/table/smart-table.js +1 -1
- package/dist/table/table.js +1 -1
- package/dist/table-legacy-ng/table-legacy-ng.js +3 -7
- package/dist/table-legacy-ng/table-legacy-ng__pager.js +3 -7
- package/dist/table-ng/smart-table-ng.js +1 -1
- package/dist/table-ng/table-ng.js +1 -1
- package/dist/tabs/collapsible-more.js +1 -1
- package/dist/tabs/collapsible-tab.js +3 -2
- package/dist/tabs/collapsible-tabs.js +1 -1
- package/dist/tabs/dumb-tabs.d.ts +4 -107
- package/dist/tabs/dumb-tabs.js +6 -12
- package/dist/tabs/smart-tabs.js +3 -3
- package/dist/tabs/tab.d.ts +2 -0
- package/dist/tabs/tabs.js +1 -1
- package/dist/tabs-ng/tabs-ng.js +1 -6
- package/dist/tabs-ng/tabs-ng__template.js +1 -1
- package/dist/tag/tag.d.ts +1 -0
- package/dist/tag/tag.js +5 -4
- package/dist/tags-input/tags-input.js +5 -9
- package/dist/tags-input-ng/tags-input-ng.js +4 -8
- package/dist/tags-list/tags-list.js +1 -1
- package/dist/text/text.js +1 -1
- package/dist/toggle/toggle.d.ts +9 -89
- package/dist/toggle/toggle.js +7 -8
- package/dist/toggle-ng/toggle-ng.js +2 -3
- package/dist/tooltip/tooltip.d.ts +1 -0
- package/dist/tooltip/tooltip.js +6 -3
- package/dist/user-agreement/service.d.ts +2 -2
- package/dist/user-agreement/service.js +9 -13
- package/dist/user-agreement/user-agreement.js +8 -10
- package/dist/user-card/smart-user-card-tooltip.js +6 -11
- package/dist/user-card/tooltip.js +1 -1
- package/dist/user-card/user-card.js +2 -7
- package/dist/user-card-ng/user-card-ng.js +4 -9
- package/package.json +5 -5
- package/webpack.config.js +0 -11
- package/components/global/conic-gradient.d.ts +0 -796
- package/components/global/conic-gradient.js +0 -21
- package/components/global/radial-gradient-mask.d.ts +0 -9
- package/components/global/radial-gradient-mask.js +0 -39
- package/components/global/supports-css.d.ts +0 -2
- package/components/global/supports-css.js +0 -14
- package/components/global/variables_dark.d.ts +0 -3
- package/components/global/variables_dark.js +0 -53
- package/components/loader-inline/inject-styles.d.ts +0 -2
- package/components/loader-inline/inject-styles.js +0 -17
- package/dist/_helpers/inject-styles.js +0 -22
- package/dist/global/conic-gradient.d.ts +0 -796
- package/dist/global/conic-gradient.js +0 -35
- package/dist/global/radial-gradient-mask.d.ts +0 -9
- package/dist/global/radial-gradient-mask.js +0 -49
- package/dist/global/supports-css.d.ts +0 -2
- package/dist/global/supports-css.js +0 -20
- package/dist/global/variables_dark.d.ts +0 -3
- package/dist/global/variables_dark.js +0 -57
- package/dist/loader-inline/inject-styles.d.ts +0 -2
- package/dist/loader-inline/inject-styles.js +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,56 @@
|
|
|
1
1
|
## [5.0.0]
|
|
2
2
|
|
|
3
3
|
### BREAKING CHANGES
|
|
4
|
-
-
|
|
4
|
+
- Design of some components is changed, see [RG-2156](https://youtrack.jetbrains.com/issue/RG-2156). By default, controls (buttons, inputs etc.) have 28px height. To bring back the old compact 24px height, wrap your app into `ControlsHeightContext.Provider`:
|
|
5
|
+
```js
|
|
6
|
+
import {ControlsHeight, ControlsHeightContext} from '@jetbrains/ring-ui/components/global/controls-height';
|
|
5
7
|
|
|
8
|
+
<ControlsHeightContext.Provider value={ControlsHeight.S}>
|
|
9
|
+
<App />
|
|
10
|
+
</ControlsHeightContext.Provider>
|
|
11
|
+
```
|
|
12
|
+
- Input: removed `compact` and `renderUnderline` props
|
|
13
|
+
- Select: removed `Type.MATERIAL`
|
|
14
|
+
- Toggle: added `Size.Size14` which is the new default
|
|
15
|
+
- Button Group: caption should be pllaced outside of the group
|
|
16
|
+
```
|
|
17
|
+
// Before
|
|
18
|
+
<ButtonGroup>
|
|
19
|
+
<Caption>Side:</Caption>
|
|
20
|
+
<Button>Left</Button>
|
|
21
|
+
<Button>Right</Button>
|
|
22
|
+
</ButtonGroup>
|
|
23
|
+
|
|
24
|
+
// After
|
|
25
|
+
<>
|
|
26
|
+
<Caption>Side:</Caption>
|
|
27
|
+
<ButtonGroup>
|
|
28
|
+
<Button>Left</Button>
|
|
29
|
+
<Button>Right</Button>
|
|
30
|
+
</ButtonGroup>
|
|
31
|
+
</>
|
|
32
|
+
```
|
|
33
|
+
- Components no longer accept `theme` prop, themes are managed using CSS Custom Properties instead. To apply a theme to your app or some part of it, wrap it into `ThemeProvider`:
|
|
34
|
+
```js
|
|
35
|
+
import Theme, {ThemeProvider} from '@jetbrains/ring-ui/components/global/theme';
|
|
36
|
+
|
|
37
|
+
<ThemeProvider theme={Theme.DARK}>{children}</ThemeProvider>
|
|
38
|
+
```
|
|
39
|
+
You can also pass `Theme.AUTO` to use the user-defined system theme.
|
|
40
|
+
The only exceptions are the components that provide dark context by default: Alert, Header, Message. Those still accept a `theme` prop.
|
|
41
|
+
- `--ring-dark-*` CSS custom properties are removed, `--ring-dark-text-color` is renamed to `--ring-white-text-color`
|
|
42
|
+
- The codebase has migrated to TypeScript
|
|
43
|
+
- `react-markdown` has been updated to v7, which affects the props of `Markdown` component. The most notable change is replacing `source` with `children`:
|
|
44
|
+
```js
|
|
45
|
+
// before
|
|
46
|
+
<Markdown source="some markdown" />
|
|
47
|
+
|
|
48
|
+
// after
|
|
49
|
+
<Markdown>some markdown</Markdown>
|
|
50
|
+
```
|
|
51
|
+
See `react-markdown`'s [changelog](https://github.com/remarkjs/react-markdown/blob/main/changelog.md#600---2021-04-15) for other changes
|
|
52
|
+
- Removed `core-js@2` support
|
|
53
|
+
- Removed `webpack@4` support
|
|
6
54
|
|
|
7
55
|
## [4.1.0]
|
|
8
56
|
|
package/babel.config.js
CHANGED
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
const browserslist = require('browserslist');
|
|
2
|
-
const deprecate = require('util-deprecate');
|
|
3
|
-
|
|
4
|
-
const coreJsVersion = process.env.RING_UI_COREJS_VERSION ||
|
|
5
|
-
require('core-js/package.json').version;
|
|
6
|
-
|
|
7
|
-
const isDeprecatedCoreJS = coreJsVersion.startsWith('2');
|
|
8
2
|
|
|
9
3
|
module.exports = function config(api) {
|
|
10
4
|
api.cache(true);
|
|
11
5
|
|
|
12
|
-
if (isDeprecatedCoreJS) {
|
|
13
|
-
// TODO remove in 5.0
|
|
14
|
-
deprecate(() => null, `Compiling Ring UI with deprecated Core JS version "${coreJsVersion}". Consider updating to 3rd.`)();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
6
|
return {
|
|
18
7
|
presets: [
|
|
19
8
|
['@jetbrains/babel-preset-jetbrains', {
|
|
20
9
|
typeScript: true,
|
|
21
10
|
angular: true,
|
|
22
11
|
useBuiltIns: 'usage',
|
|
23
|
-
corejs:
|
|
12
|
+
corejs: '3'
|
|
24
13
|
}]
|
|
25
14
|
],
|
|
26
15
|
plugins: [
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
border-radius: var(--ring-border-radius);
|
|
26
26
|
background-color: var(--ring-message-background-color);
|
|
27
|
-
box-shadow:
|
|
27
|
+
box-shadow: var(--ring-popup-shadow);
|
|
28
28
|
|
|
29
29
|
font-size: var(--ring-font-size);
|
|
30
30
|
line-height: calc(unit * 5);
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
.error {
|
|
38
38
|
word-wrap: break-word;
|
|
39
39
|
|
|
40
|
-
color: var(--ring-error-color);
|
|
40
|
+
color: var(--ring-icon-error-color);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.icon {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
|
|
54
54
|
white-space: normal;
|
|
55
55
|
|
|
56
|
-
color: var(--ring-
|
|
56
|
+
color: var(--ring-active-text-color);
|
|
57
57
|
|
|
58
58
|
line-height: 20px;
|
|
59
59
|
|
|
@@ -88,19 +88,8 @@
|
|
|
88
88
|
margin: calc(unit / 2);
|
|
89
89
|
padding: unit;
|
|
90
90
|
|
|
91
|
-
cursor: pointer;
|
|
92
|
-
|
|
93
|
-
color: var(--ring-dark-secondary-color);
|
|
94
|
-
border: none;
|
|
95
|
-
background: transparent;
|
|
96
|
-
|
|
97
91
|
font-size: 0;
|
|
98
92
|
line-height: 0;
|
|
99
|
-
|
|
100
|
-
&:hover,
|
|
101
|
-
&:focus {
|
|
102
|
-
color: var(--ring-link-hover-color);
|
|
103
|
-
}
|
|
104
93
|
}
|
|
105
94
|
|
|
106
95
|
@keyframes show {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { PureComponent, ReactNode } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import Theme from '../global/theme';
|
|
3
4
|
export declare const ANIMATION_TIME = 500;
|
|
4
5
|
/**
|
|
5
6
|
* @name Alert
|
|
@@ -16,6 +17,7 @@ export declare enum AlertType {
|
|
|
16
17
|
LOADING = "loading"
|
|
17
18
|
}
|
|
18
19
|
export interface AlertProps {
|
|
20
|
+
theme: Theme;
|
|
19
21
|
timeout: number;
|
|
20
22
|
onCloseRequest: ((event?: React.MouseEvent<HTMLElement>) => void);
|
|
21
23
|
onClose: (() => void);
|
|
@@ -68,6 +70,7 @@ export default class Alert extends PureComponent<AlertProps, State> {
|
|
|
68
70
|
};
|
|
69
71
|
/** @override */
|
|
70
72
|
static defaultProps: {
|
|
73
|
+
theme: Theme;
|
|
71
74
|
closeable: boolean;
|
|
72
75
|
showWithAnimation: boolean;
|
|
73
76
|
type: AlertType;
|
|
@@ -9,6 +9,8 @@ import Icon, { Color } from '../icon/icon';
|
|
|
9
9
|
import Loader from '../loader-inline/loader-inline';
|
|
10
10
|
import { getRect } from '../global/dom';
|
|
11
11
|
import dataTests from '../global/data-tests';
|
|
12
|
+
import Button from '../button/button';
|
|
13
|
+
import Theme, { ThemeProvider } from '../global/theme';
|
|
12
14
|
import styles from './alert.css';
|
|
13
15
|
export const ANIMATION_TIME = 500;
|
|
14
16
|
/**
|
|
@@ -78,6 +80,7 @@ export default class Alert extends PureComponent {
|
|
|
78
80
|
};
|
|
79
81
|
/** @override */
|
|
80
82
|
static defaultProps = {
|
|
83
|
+
theme: Theme.DARK,
|
|
81
84
|
closeable: true,
|
|
82
85
|
showWithAnimation: true,
|
|
83
86
|
type: AlertType.MESSAGE,
|
|
@@ -152,7 +155,7 @@ export default class Alert extends PureComponent {
|
|
|
152
155
|
return (<Icon glyph={glyph} className={styles.icon} color={TypeToIconColor[this.props.type] || Color.DEFAULT}/>);
|
|
153
156
|
}
|
|
154
157
|
else if (this.props.type === AlertType.LOADING) {
|
|
155
|
-
return (<Loader className={styles.loader}
|
|
158
|
+
return (<Loader className={styles.loader}/>);
|
|
156
159
|
}
|
|
157
160
|
return '';
|
|
158
161
|
}
|
|
@@ -160,7 +163,7 @@ export default class Alert extends PureComponent {
|
|
|
160
163
|
this.node = node;
|
|
161
164
|
};
|
|
162
165
|
render() {
|
|
163
|
-
const { type, inline, isClosing, isShaking, closeButtonClassName, showWithAnimation, className, 'data-test': dataTest } = this.props;
|
|
166
|
+
const { type, inline, isClosing, isShaking, closeButtonClassName, showWithAnimation, className, 'data-test': dataTest, theme } = this.props;
|
|
164
167
|
const classes = classNames(className, {
|
|
165
168
|
[styles.alert]: true,
|
|
166
169
|
[styles.animationOpen]: showWithAnimation,
|
|
@@ -171,15 +174,13 @@ export default class Alert extends PureComponent {
|
|
|
171
174
|
});
|
|
172
175
|
const height = this.state.height;
|
|
173
176
|
const style = height ? { marginBottom: -height } : undefined;
|
|
174
|
-
return (<
|
|
177
|
+
return (<ThemeProvider theme={theme} className={classes} data-test={dataTests('alert', dataTest)} data-test-type={type} style={style} ref={this.storeAlertRef}>
|
|
175
178
|
{this._getIcon()}
|
|
176
179
|
{this._getCaption()}
|
|
177
180
|
{this.props.closeable
|
|
178
|
-
? (<
|
|
179
|
-
<Icon glyph={closeIcon}/>
|
|
180
|
-
</button>)
|
|
181
|
+
? (<Button icon={closeIcon} className={classNames(styles.close, closeButtonClassName)} data-test="alert-close" aria-label="close alert" onClick={this.closeRequest}/>)
|
|
181
182
|
: ''}
|
|
182
|
-
</
|
|
183
|
+
</ThemeProvider>);
|
|
183
184
|
}
|
|
184
185
|
}
|
|
185
186
|
export { default as Container } from './container';
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
@import "../global/variables.css";
|
|
2
2
|
|
|
3
3
|
@value unit from "../global/global.css";
|
|
4
|
+
@value icon from "../button/button.css";
|
|
4
5
|
@value animation-duration: 300ms;
|
|
5
6
|
@value animation-easing: ease-out;
|
|
6
7
|
|
|
7
8
|
.customAlert {
|
|
9
|
+
color: var(--ring-white-text-color);
|
|
8
10
|
background: var(--ring-main-color);
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
.closeButton,
|
|
12
|
-
.closeButton:hover {
|
|
13
|
-
color: var(--ring-
|
|
13
|
+
.closeButton .icon,
|
|
14
|
+
.closeButton:hover .icon {
|
|
15
|
+
color: var(--ring-white-text-color);
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
.closeButton:hover {
|
|
@@ -38,6 +38,7 @@ export interface AuthTranslations {
|
|
|
38
38
|
applyChange: string;
|
|
39
39
|
backendIsNotAvailable: string;
|
|
40
40
|
checkAgain: string;
|
|
41
|
+
tryAgainLabel: string;
|
|
41
42
|
nothingHappensLink: string;
|
|
42
43
|
errorMessage: string;
|
|
43
44
|
}
|
|
@@ -99,6 +100,7 @@ interface AuthDialogParams {
|
|
|
99
100
|
nonInteractive?: boolean;
|
|
100
101
|
error?: Error;
|
|
101
102
|
canCancel?: boolean;
|
|
103
|
+
onTryAgain?: () => Promise<void>;
|
|
102
104
|
}
|
|
103
105
|
interface UserChange {
|
|
104
106
|
userID: number | string | null | undefined;
|
|
@@ -180,7 +182,7 @@ export default class Auth implements HTTPAuth {
|
|
|
180
182
|
updateUser(): Promise<void>;
|
|
181
183
|
_detectUserChange(accessToken: string): Promise<void>;
|
|
182
184
|
_beforeLogout(params?: AuthDialogParams): void;
|
|
183
|
-
_showAuthDialog({ nonInteractive, error, canCancel }?: AuthDialogParams): void;
|
|
185
|
+
_showAuthDialog({ nonInteractive, error, canCancel, onTryAgain }?: AuthDialogParams): void;
|
|
184
186
|
_showUserChangedDialog({ newUser, onApply, onPostpone }: UserChangedDialogParams): void;
|
|
185
187
|
private _extractErrorMessage;
|
|
186
188
|
private _showBackendDownDialog;
|
|
@@ -46,6 +46,7 @@ const DEFAULT_CONFIG = {
|
|
|
46
46
|
login: 'Log in',
|
|
47
47
|
loginTo: 'Log in to %serviceName%',
|
|
48
48
|
cancel: 'Cancel',
|
|
49
|
+
tryAgainLabel: 'Try again',
|
|
49
50
|
postpone: 'Postpone',
|
|
50
51
|
youHaveLoggedInAs: 'You have logged in as another user: %userName%',
|
|
51
52
|
applyChange: 'Apply change',
|
|
@@ -361,22 +362,41 @@ export default class Auth {
|
|
|
361
362
|
return await this._backgroundFlow?.authorize() ?? null;
|
|
362
363
|
}
|
|
363
364
|
catch (error) {
|
|
364
|
-
if (error instanceof Error) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
365
|
+
if (!(error instanceof Error)) {
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
if (this._canShowDialogs()) {
|
|
369
|
+
return new Promise(resolve => {
|
|
370
|
+
const onTryAgain = async () => {
|
|
371
|
+
try {
|
|
372
|
+
const result = await this._backgroundFlow?.authorize();
|
|
373
|
+
resolve(result ?? null);
|
|
374
|
+
}
|
|
375
|
+
catch (retryError) {
|
|
376
|
+
if (retryError instanceof Error) {
|
|
377
|
+
this._showAuthDialog({
|
|
378
|
+
nonInteractive: true,
|
|
379
|
+
error: retryError,
|
|
380
|
+
onTryAgain
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
throw retryError;
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
this._showAuthDialog({
|
|
387
|
+
nonInteractive: true,
|
|
388
|
+
error: error,
|
|
389
|
+
onTryAgain
|
|
390
|
+
});
|
|
391
|
+
});
|
|
376
392
|
}
|
|
377
393
|
else {
|
|
378
|
-
|
|
394
|
+
const authRequest = await this._requestBuilder?.prepareAuthRequest();
|
|
395
|
+
if (authRequest != null) {
|
|
396
|
+
this._redirectCurrentPage(authRequest.url);
|
|
397
|
+
}
|
|
379
398
|
}
|
|
399
|
+
throw new TokenValidator.TokenValidationError(error.message);
|
|
380
400
|
}
|
|
381
401
|
}
|
|
382
402
|
async loadCurrentService() {
|
|
@@ -462,7 +482,7 @@ export default class Auth {
|
|
|
462
482
|
}
|
|
463
483
|
this.logout();
|
|
464
484
|
}
|
|
465
|
-
_showAuthDialog({ nonInteractive, error, canCancel } = {}) {
|
|
485
|
+
_showAuthDialog({ nonInteractive, error, canCancel, onTryAgain } = {}) {
|
|
466
486
|
const { embeddedLogin, onPostponeLogout, translations } = this.config;
|
|
467
487
|
const cancelable = this.user?.guest || canCancel;
|
|
468
488
|
this._createInitDeferred();
|
|
@@ -498,15 +518,21 @@ export default class Auth {
|
|
|
498
518
|
this._initDeferred?.resolve?.();
|
|
499
519
|
}
|
|
500
520
|
};
|
|
521
|
+
const onTryAgainClick = async () => {
|
|
522
|
+
await onTryAgain?.();
|
|
523
|
+
closeDialog();
|
|
524
|
+
};
|
|
501
525
|
const hide = this._authDialogService?.({
|
|
502
526
|
...this._service,
|
|
503
527
|
loginCaption: translations.login,
|
|
504
528
|
loginToCaption: translations.loginTo,
|
|
505
529
|
confirmLabel: translations.login,
|
|
530
|
+
tryAgainLabel: translations.tryAgainLabel,
|
|
506
531
|
cancelLabel: cancelable ? translations.cancel : translations.postpone,
|
|
507
532
|
errorMessage: this._extractErrorMessage(error, true),
|
|
508
533
|
onConfirm,
|
|
509
|
-
onCancel
|
|
534
|
+
onCancel,
|
|
535
|
+
onTryAgain: onTryAgain ? onTryAgainClick : undefined
|
|
510
536
|
});
|
|
511
537
|
const stopTokenListening = this._storage?.onTokenChange(token => {
|
|
512
538
|
if (token) {
|
|
@@ -530,6 +556,7 @@ export default class Auth {
|
|
|
530
556
|
loginCaption: translations.login,
|
|
531
557
|
loginToCaption: translations.loginTo,
|
|
532
558
|
confirmLabel: translations.applyChange,
|
|
559
|
+
tryAgainLabel: translations.tryAgainLabel,
|
|
533
560
|
cancelLabel: translations.postpone,
|
|
534
561
|
onConfirm: () => {
|
|
535
562
|
done();
|
|
@@ -15,8 +15,10 @@ export interface AuthDialogProps {
|
|
|
15
15
|
cancelOnEsc: boolean;
|
|
16
16
|
confirmLabel: string;
|
|
17
17
|
cancelLabel: string;
|
|
18
|
+
tryAgainLabel: string;
|
|
18
19
|
onConfirm: () => void;
|
|
19
20
|
onCancel: () => void;
|
|
21
|
+
onTryAgain?: () => void;
|
|
20
22
|
}
|
|
21
23
|
export default class AuthDialog extends Component<AuthDialogProps> {
|
|
22
24
|
static propTypes: {
|
|
@@ -31,12 +33,15 @@ export default class AuthDialog extends Component<AuthDialogProps> {
|
|
|
31
33
|
cancelOnEsc: PropTypes.Requireable<boolean>;
|
|
32
34
|
confirmLabel: PropTypes.Requireable<string>;
|
|
33
35
|
cancelLabel: PropTypes.Requireable<string>;
|
|
36
|
+
tryAgainLabel: PropTypes.Requireable<string>;
|
|
34
37
|
onConfirm: PropTypes.Requireable<(...args: any[]) => any>;
|
|
35
38
|
onCancel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
39
|
+
onTryAgain: PropTypes.Requireable<(...args: any[]) => any>;
|
|
36
40
|
};
|
|
37
41
|
static defaultProps: {
|
|
38
42
|
loginCaption: string;
|
|
39
43
|
loginToCaption: string;
|
|
44
|
+
tryAgainLabel: string;
|
|
40
45
|
show: boolean;
|
|
41
46
|
cancelOnEsc: boolean;
|
|
42
47
|
confirmLabel: string;
|
|
@@ -44,6 +49,12 @@ export default class AuthDialog extends Component<AuthDialogProps> {
|
|
|
44
49
|
onConfirm: () => void;
|
|
45
50
|
onCancel: () => void;
|
|
46
51
|
};
|
|
52
|
+
state: {
|
|
53
|
+
retrying: boolean;
|
|
54
|
+
};
|
|
55
|
+
componentDidMount(): void;
|
|
56
|
+
componentWillUnmount(): void;
|
|
47
57
|
onEscPress: () => void;
|
|
58
|
+
onRetryPress: () => Promise<void>;
|
|
48
59
|
render(): JSX.Element;
|
|
49
60
|
}
|
|
@@ -19,12 +19,15 @@ export default class AuthDialog extends Component {
|
|
|
19
19
|
cancelOnEsc: PropTypes.bool,
|
|
20
20
|
confirmLabel: PropTypes.string,
|
|
21
21
|
cancelLabel: PropTypes.string,
|
|
22
|
+
tryAgainLabel: PropTypes.string,
|
|
22
23
|
onConfirm: PropTypes.func,
|
|
23
|
-
onCancel: PropTypes.func
|
|
24
|
+
onCancel: PropTypes.func,
|
|
25
|
+
onTryAgain: PropTypes.func
|
|
24
26
|
};
|
|
25
27
|
static defaultProps = {
|
|
26
28
|
loginCaption: 'Log in',
|
|
27
29
|
loginToCaption: 'Log in to %serviceName%',
|
|
30
|
+
tryAgainLabel: 'Try again',
|
|
28
31
|
show: false,
|
|
29
32
|
cancelOnEsc: true,
|
|
30
33
|
confirmLabel: 'Log in',
|
|
@@ -32,13 +35,38 @@ export default class AuthDialog extends Component {
|
|
|
32
35
|
onConfirm: () => { },
|
|
33
36
|
onCancel: () => { }
|
|
34
37
|
};
|
|
38
|
+
state = {
|
|
39
|
+
retrying: false
|
|
40
|
+
};
|
|
41
|
+
componentDidMount() {
|
|
42
|
+
window.addEventListener('online', this.onRetryPress);
|
|
43
|
+
}
|
|
44
|
+
componentWillUnmount() {
|
|
45
|
+
window.removeEventListener('online', this.onRetryPress);
|
|
46
|
+
}
|
|
35
47
|
onEscPress = () => {
|
|
36
48
|
if (this.props.cancelOnEsc) {
|
|
37
49
|
this.props.onCancel();
|
|
38
50
|
}
|
|
39
51
|
};
|
|
52
|
+
onRetryPress = async () => {
|
|
53
|
+
if (!this.props.onTryAgain || this.state.retrying) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
this.setState({ retrying: true });
|
|
57
|
+
try {
|
|
58
|
+
await this.props.onTryAgain();
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
// do nothing, error is handled in onTryAgain
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
this.setState({ retrying: false });
|
|
65
|
+
}
|
|
66
|
+
};
|
|
40
67
|
render() {
|
|
41
|
-
const { show, className, errorMessage, serviceImage, serviceName, loginCaption, loginToCaption, confirmLabel, cancelLabel, onConfirm, onCancel } = this.props;
|
|
68
|
+
const { show, className, errorMessage, serviceImage, serviceName, loginCaption, loginToCaption, confirmLabel, cancelLabel, tryAgainLabel, onConfirm, onCancel, onTryAgain } = this.props;
|
|
69
|
+
const { retrying } = this.state;
|
|
42
70
|
const defaultTitle = serviceName ? loginToCaption : loginCaption;
|
|
43
71
|
const title = (this.props.title || defaultTitle).replace('%serviceName%', serviceName ?? '');
|
|
44
72
|
return (<Dialog label={title} data-test="ring-auth-dialog" className={className} contentClassName={classNames(className, styles.dialog)} onEscPress={this.onEscPress} show={show} trapFocus>
|
|
@@ -50,6 +78,9 @@ export default class AuthDialog extends Component {
|
|
|
50
78
|
<Button primary className={styles.firstButton} data-test="auth-dialog-confirm-button" onClick={onConfirm}>
|
|
51
79
|
{confirmLabel}
|
|
52
80
|
</Button>
|
|
81
|
+
{onTryAgain && (<Button className={styles.button} data-test="auth-dialog-retry-button" onClick={() => this.onRetryPress()} loader={retrying} disabled={retrying}>
|
|
82
|
+
{tryAgainLabel}
|
|
83
|
+
</Button>)}
|
|
53
84
|
<Button className={styles.button} data-test="auth-dialog-cancel-button" onClick={onCancel}>
|
|
54
85
|
{cancelLabel}
|
|
55
86
|
</Button>
|
|
@@ -6,7 +6,7 @@ import angular from 'angular';
|
|
|
6
6
|
import {FOCUSABLE_ELEMENTS} from '../tab-trap/tab-trap';
|
|
7
7
|
|
|
8
8
|
const angularModule = angular.module('Ring.autofocus', []);
|
|
9
|
-
const RING_SELECT_SELECTOR = '[data-test
|
|
9
|
+
const RING_SELECT_SELECTOR = '[data-test*=ring-select__focus]';
|
|
10
10
|
const RING_SELECT = 'rg-select';
|
|
11
11
|
|
|
12
12
|
angularModule.directive('rgAutofocus', function rgAutofocusDirective() {
|
|
@@ -37,7 +37,7 @@ describe('Autofocus Ng', () => {
|
|
|
37
37
|
|
|
38
38
|
it('Should focus on select button', () => {
|
|
39
39
|
element = $compile('<rg-select rg-autofocus="vm.focus" options="item in []"/>')($scope);
|
|
40
|
-
const selectButton = element[0].querySelector('[data-test
|
|
40
|
+
const selectButton = element[0].querySelector('[data-test*=ring-select__focus]');
|
|
41
41
|
|
|
42
42
|
sandbox.spy(selectButton, 'focus');
|
|
43
43
|
|