@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
|
@@ -13,13 +13,16 @@
|
|
|
13
13
|
margin-bottom: 8px;
|
|
14
14
|
|
|
15
15
|
color: var(--ring-heading-color);
|
|
16
|
+
}
|
|
16
17
|
|
|
18
|
+
@nest h1& {
|
|
17
19
|
font-size: 24px;
|
|
18
20
|
line-height: 28px;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
@nest h2& {
|
|
22
|
-
font-
|
|
24
|
+
font-size: 20px;
|
|
25
|
+
line-height: 24px;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
@nest h3& {
|
package/components/icon/icon.css
CHANGED
|
@@ -2,62 +2,76 @@
|
|
|
2
2
|
@import "../button/button.css";
|
|
3
3
|
|
|
4
4
|
@value unit from "../global/global.css";
|
|
5
|
-
@value iconOffset: calc(unit * 3 - 2px);
|
|
6
5
|
|
|
7
|
-
.
|
|
8
|
-
|
|
6
|
+
.outerContainer {
|
|
7
|
+
--ring-input-icon-offset: calc(unit * 2.5);
|
|
8
|
+
--ring-input-padding-inline: unit;
|
|
9
|
+
}
|
|
9
10
|
|
|
11
|
+
.borderless {
|
|
12
|
+
--ring-input-padding-inline: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.container {
|
|
10
16
|
position: relative;
|
|
11
17
|
|
|
12
18
|
box-sizing: border-box;
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
|
|
20
|
+
font-size: var(--ring-font-size);
|
|
21
|
+
line-height: var(--ring-line-height);
|
|
15
22
|
|
|
16
23
|
& * {
|
|
17
24
|
box-sizing: border-box;
|
|
18
25
|
}
|
|
19
26
|
}
|
|
20
27
|
|
|
21
|
-
.compact {
|
|
22
|
-
min-height: calc(unit * 4);
|
|
23
|
-
padding: 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
28
|
.input {
|
|
29
|
+
--ring-input-padding-start: var(--ring-input-padding-inline);
|
|
30
|
+
--ring-input-padding-end: var(--ring-input-padding-inline);
|
|
31
|
+
|
|
27
32
|
width: 100%;
|
|
28
|
-
|
|
29
|
-
padding:
|
|
33
|
+
padding-top: var(--ring-input-padding-block);
|
|
34
|
+
padding-right: var(--ring-input-padding-end);
|
|
35
|
+
padding-bottom: var(--ring-input-padding-block);
|
|
36
|
+
padding-left: var(--ring-input-padding-start);
|
|
37
|
+
|
|
38
|
+
transition: border-color var(--ring-ease);
|
|
30
39
|
|
|
31
|
-
|
|
40
|
+
color: var(--ring-text-color);
|
|
41
|
+
border: 1px solid var(--ring-borders-color);
|
|
42
|
+
border-radius: var(--ring-border-radius);
|
|
32
43
|
outline: none;
|
|
33
44
|
background: transparent;
|
|
34
45
|
|
|
35
46
|
font: inherit;
|
|
36
|
-
caret-color: var(--ring-main-color);
|
|
37
47
|
|
|
38
|
-
|
|
39
|
-
padding-right: calc(unit * 3);
|
|
48
|
+
caret-color: var(--ring-main-color);
|
|
40
49
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
50
|
+
@nest [dir=rtl] & {
|
|
51
|
+
padding-right: var(--ring-input-padding-start);
|
|
52
|
+
padding-left: var(--ring-input-padding-end);
|
|
45
53
|
}
|
|
46
54
|
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
&:hover {
|
|
56
|
+
transition: none;
|
|
57
|
+
|
|
58
|
+
border-color: var(--ring-border-hover-color);
|
|
49
59
|
}
|
|
50
60
|
|
|
51
|
-
@nest .
|
|
52
|
-
color: var(--ring-
|
|
61
|
+
@nest .error & {
|
|
62
|
+
border-color: var(--ring-icon-error-color);
|
|
53
63
|
}
|
|
54
64
|
|
|
55
|
-
|
|
56
|
-
|
|
65
|
+
&:focus {
|
|
66
|
+
transition: none;
|
|
67
|
+
|
|
68
|
+
border-color: var(--ring-main-color);
|
|
57
69
|
}
|
|
58
70
|
|
|
59
71
|
&[disabled] {
|
|
60
72
|
color: var(--ring-disabled-color);
|
|
73
|
+
border-color: var(--ring-border-disabled-color);
|
|
74
|
+
background-color: var(--ring-disabled-background-color);
|
|
61
75
|
|
|
62
76
|
-webkit-text-fill-color: var(--ring-disabled-color); /* Required for Safari, see RG-2063 for details */
|
|
63
77
|
}
|
|
@@ -73,59 +87,51 @@
|
|
|
73
87
|
transition: background-color 50000s ease-in-out 0s;
|
|
74
88
|
}
|
|
75
89
|
}
|
|
76
|
-
|
|
77
|
-
/* if you need a cross, pass onClear prop */
|
|
78
|
-
&::-ms-clear {
|
|
79
|
-
display: none;
|
|
80
|
-
}
|
|
81
90
|
}
|
|
82
91
|
|
|
83
|
-
.
|
|
84
|
-
|
|
85
|
-
padding-left: iconOffset;
|
|
86
|
-
|
|
87
|
-
@nest [dir=rtl] & {
|
|
88
|
-
padding-right: iconOffset;
|
|
89
|
-
padding-left: 0;
|
|
90
|
-
}
|
|
92
|
+
.borderless .input {
|
|
93
|
+
border-color: transparent;
|
|
91
94
|
}
|
|
92
95
|
|
|
93
|
-
.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
position: absolute;
|
|
97
|
-
top: 17px;
|
|
98
|
-
|
|
99
|
-
line-height: calc(unit * 4);
|
|
96
|
+
.withIcon .input {
|
|
97
|
+
--ring-input-padding-start: calc(var(--ring-input-padding-inline) + var(--ring-input-icon-offset));
|
|
98
|
+
}
|
|
100
99
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
100
|
+
.clearable .input {
|
|
101
|
+
--ring-input-padding-end: calc(var(--ring-input-padding-inline) + var(--ring-input-icon-offset));
|
|
104
102
|
}
|
|
105
103
|
|
|
106
104
|
.icon {
|
|
107
|
-
|
|
105
|
+
position: absolute;
|
|
106
|
+
top: calc(var(--ring-input-padding-block) + 1px);
|
|
107
|
+
left: var(--ring-input-padding-inline);
|
|
108
108
|
|
|
109
|
-
color: var(--ring-icon-color);
|
|
109
|
+
color: var(--ring-icon-secondary-color);
|
|
110
110
|
|
|
111
111
|
@nest [dir=rtl] & {
|
|
112
|
-
right:
|
|
112
|
+
right: unit;
|
|
113
113
|
left: auto;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
.clear {
|
|
118
|
-
|
|
118
|
+
position: absolute;
|
|
119
|
+
top: calc(var(--ring-input-padding-block) + 1px);
|
|
120
|
+
right: var(--ring-input-padding-inline);
|
|
121
|
+
|
|
122
|
+
height: auto;
|
|
119
123
|
|
|
120
124
|
padding-right: 0;
|
|
121
125
|
|
|
126
|
+
line-height: inherit;
|
|
127
|
+
|
|
122
128
|
@nest .empty & {
|
|
123
129
|
display: none;
|
|
124
130
|
}
|
|
125
131
|
|
|
126
132
|
@nest [dir=rtl] & {
|
|
127
133
|
right: auto;
|
|
128
|
-
left:
|
|
134
|
+
left: unit;
|
|
129
135
|
}
|
|
130
136
|
}
|
|
131
137
|
|
|
@@ -133,119 +139,31 @@ textarea.input {
|
|
|
133
139
|
overflow: hidden;
|
|
134
140
|
|
|
135
141
|
box-sizing: border-box;
|
|
136
|
-
padding-top: unit;
|
|
137
142
|
|
|
138
143
|
resize: none;
|
|
139
144
|
}
|
|
140
145
|
|
|
141
146
|
.label {
|
|
142
|
-
|
|
143
|
-
top: calc(unit * 3 - 1px);
|
|
144
|
-
left: 0;
|
|
145
|
-
|
|
146
|
-
transition: transform var(--ring-fast-ease), color var(--ring-fast-ease);
|
|
147
|
-
transform-origin: top left;
|
|
148
|
-
pointer-events: none;
|
|
149
|
-
|
|
150
|
-
@nest .light & {
|
|
151
|
-
color: var(--ring-secondary-color);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
@nest .dark & {
|
|
155
|
-
color: var(--ring-dark-secondary-color);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.input:focus ~ .label,
|
|
160
|
-
.container.active > .label,
|
|
161
|
-
.container:not(.empty) > .label {
|
|
162
|
-
transform: translateY(calc(unit * -2.5)) scale(calc(12 / 13));
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.noLabel ::placeholder,
|
|
166
|
-
.input:focus::placeholder {
|
|
167
|
-
transition: color var(--ring-fast-ease);
|
|
168
|
-
}
|
|
147
|
+
display: block;
|
|
169
148
|
|
|
170
|
-
|
|
171
|
-
.light :focus::placeholder {
|
|
172
|
-
color: var(--ring-disabled-color);
|
|
173
|
-
}
|
|
149
|
+
margin-bottom: calc(unit / 2);
|
|
174
150
|
|
|
175
|
-
/* stylelint-disable-next-line selector-max-specificity */
|
|
176
|
-
.dark.noLabel ::placeholder,
|
|
177
|
-
/* stylelint-disable-next-line selector-max-specificity */
|
|
178
|
-
.dark :focus::placeholder {
|
|
179
151
|
color: var(--ring-secondary-color);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.input:focus ~ .label {
|
|
183
|
-
color: var(--ring-main-color);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.error > :focus ~ .label {
|
|
187
|
-
color: var(--ring-error-color);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.underline {
|
|
191
|
-
height: 1px;
|
|
192
|
-
|
|
193
|
-
border-bottom-width: 1px;
|
|
194
|
-
border-bottom-style: solid;
|
|
195
|
-
|
|
196
|
-
@nest .light & {
|
|
197
|
-
border-color: var(--ring-borders-color);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
@nest .dark & {
|
|
201
|
-
border-color: var(--ring-dark-borders-color);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.input[disabled] ~ .underline {
|
|
206
|
-
border-bottom-style: dashed;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.focusUnderline,
|
|
210
|
-
.errorUnderline {
|
|
211
|
-
width: 100%;
|
|
212
|
-
height: 2px;
|
|
213
152
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
.focusUnderline {
|
|
219
|
-
margin-top: -1px;
|
|
220
|
-
|
|
221
|
-
background: var(--ring-main-color);
|
|
153
|
+
font-size: var(--ring-font-size-smaller);
|
|
154
|
+
line-height: var(--ring-line-height-lowest);
|
|
222
155
|
}
|
|
223
156
|
|
|
224
|
-
.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
background: var(--ring-icon-error-color);
|
|
228
|
-
|
|
229
|
-
@nest .dark & {
|
|
230
|
-
background: var(--ring-error-color);
|
|
231
|
-
}
|
|
157
|
+
.disabledLabel {
|
|
158
|
+
color: var(--ring-disabled-color);
|
|
232
159
|
}
|
|
233
160
|
|
|
234
|
-
.input
|
|
235
|
-
|
|
236
|
-
.error > .errorUnderline {
|
|
237
|
-
transition: transform 0.15s ease-out;
|
|
238
|
-
transform: scaleX(1);
|
|
161
|
+
.input::placeholder {
|
|
162
|
+
color: var(--ring-disabled-color);
|
|
239
163
|
}
|
|
240
164
|
|
|
241
165
|
.errorText {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
box-sizing: border-box;
|
|
245
|
-
height: 0;
|
|
246
|
-
padding: calc(unit / 2) 0 unit;
|
|
247
|
-
|
|
248
|
-
transition: height 0.3s ease-out;
|
|
166
|
+
margin-top: calc(unit / 2);
|
|
249
167
|
|
|
250
168
|
color: var(--ring-error-color);
|
|
251
169
|
|
|
@@ -268,3 +186,15 @@ textarea.input {
|
|
|
268
186
|
.sizeFULL {
|
|
269
187
|
width: 100%;
|
|
270
188
|
}
|
|
189
|
+
|
|
190
|
+
.heightS {
|
|
191
|
+
--ring-input-padding-block: 1px;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.heightM {
|
|
195
|
+
--ring-input-padding-block: 3px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.heightL {
|
|
199
|
+
--ring-input-padding-block: 5px;
|
|
200
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { PureComponent, Ref, ComponentType, InputHTMLAttributes, TextareaHTMLAttributes, ReactNode
|
|
2
|
-
import
|
|
1
|
+
import React, { PureComponent, Ref, ComponentType, InputHTMLAttributes, TextareaHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { ControlsHeight } from '../global/controls-height';
|
|
3
3
|
declare function noop(): void;
|
|
4
4
|
/**
|
|
5
5
|
* @name Input
|
|
@@ -11,20 +11,20 @@ declare enum Size {
|
|
|
11
11
|
L = "L",
|
|
12
12
|
FULL = "FULL"
|
|
13
13
|
}
|
|
14
|
-
export interface InputBaseProps
|
|
14
|
+
export interface InputBaseProps {
|
|
15
15
|
size: Size;
|
|
16
16
|
enableShortcuts: boolean | string[];
|
|
17
|
-
renderUnderline: (underlineRef: Ref<HTMLDivElement>, errorText: ReactNode) => ReactNode;
|
|
18
17
|
children?: string | undefined;
|
|
19
18
|
inputClassName?: string | null | undefined;
|
|
20
19
|
label?: ReactNode;
|
|
21
20
|
active?: boolean | null | undefined;
|
|
22
|
-
|
|
23
|
-
error?: string | null | undefined;
|
|
21
|
+
error?: ReactNode | null | undefined;
|
|
24
22
|
borderless?: boolean | null | undefined;
|
|
25
23
|
onClear?: ((e: React.MouseEvent<HTMLButtonElement>) => void) | null | undefined;
|
|
26
24
|
loading?: boolean | null | undefined;
|
|
27
25
|
icon?: string | ComponentType | null | undefined;
|
|
26
|
+
height?: ControlsHeight | undefined;
|
|
27
|
+
afterInput?: ReactNode;
|
|
28
28
|
}
|
|
29
29
|
declare type Override<D, S> = Omit<D, keyof S> & S;
|
|
30
30
|
export declare type InputSpecificProps = Override<InputHTMLAttributes<HTMLInputElement>, InputBaseProps> & {
|
|
@@ -42,32 +42,28 @@ export declare class Input extends PureComponent<InputProps> {
|
|
|
42
42
|
onChange: typeof noop;
|
|
43
43
|
inputRef: typeof noop;
|
|
44
44
|
enableShortcuts: string[];
|
|
45
|
-
renderUnderline: (underlineRef: Ref<HTMLDivElement>, errorText: ReactNode) => JSX.Element;
|
|
46
45
|
};
|
|
47
46
|
state: {
|
|
48
47
|
empty: boolean;
|
|
49
48
|
};
|
|
50
49
|
componentDidMount(): void;
|
|
51
50
|
componentDidUpdate(): void;
|
|
51
|
+
componentWillUnmount(): void;
|
|
52
|
+
static contextType: React.Context<ControlsHeight>;
|
|
53
|
+
frame?: number;
|
|
52
54
|
input?: HTMLInputElement | HTMLTextAreaElement | null;
|
|
53
|
-
underlineNode?: HTMLElement | null;
|
|
54
55
|
id: string;
|
|
55
56
|
getId(): string;
|
|
56
57
|
checkValue(): void;
|
|
57
58
|
stretch(el: HTMLElement | null | undefined): void;
|
|
58
59
|
adapt(): void;
|
|
59
|
-
underlineRef: (el: HTMLDivElement | null) => void;
|
|
60
60
|
inputRef: (el: HTMLInputElement | HTMLTextAreaElement | null) => void;
|
|
61
61
|
clear: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
62
62
|
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
63
63
|
handleTextareaChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
64
64
|
render(): JSX.Element;
|
|
65
65
|
}
|
|
66
|
-
export declare type ContainerProps<P> =
|
|
67
|
-
declare type
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
};
|
|
71
|
-
export declare type InputAttrs = ComponentProps<typeof ThemedInput>;
|
|
72
|
-
export default ThemedInput;
|
|
73
|
-
export { Size, Theme };
|
|
66
|
+
export declare type ContainerProps<P extends InputProps> = JSX.LibraryManagedAttributes<typeof Input, P>;
|
|
67
|
+
export declare type InputAttrs = ContainerProps<InputProps>;
|
|
68
|
+
export default Input;
|
|
69
|
+
export { Size };
|
|
@@ -2,12 +2,12 @@ import React, { PureComponent } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import closeIcon from '@jetbrains/icons/close';
|
|
5
|
-
import Theme, { withTheme } from '../global/theme';
|
|
6
5
|
import { refObject } from '../global/prop-types';
|
|
7
6
|
import Button from '../button/button';
|
|
8
7
|
import getUID from '../global/get-uid';
|
|
9
8
|
import Icon from '../icon/icon';
|
|
10
9
|
import composeRefs from '../global/composeRefs';
|
|
10
|
+
import { ControlsHeightContext } from '../global/controls-height';
|
|
11
11
|
import styles from './input.css';
|
|
12
12
|
function noop() { }
|
|
13
13
|
/**
|
|
@@ -26,20 +26,25 @@ export class Input extends PureComponent {
|
|
|
26
26
|
size: Size.M,
|
|
27
27
|
onChange: noop,
|
|
28
28
|
inputRef: noop,
|
|
29
|
-
enableShortcuts: ['esc']
|
|
30
|
-
renderUnderline: (underlineRef, errorText) => (<div className={styles.errorText} ref={underlineRef}>{errorText}</div>)
|
|
29
|
+
enableShortcuts: ['esc']
|
|
31
30
|
};
|
|
32
31
|
state = {
|
|
33
32
|
empty: true
|
|
34
33
|
};
|
|
35
34
|
componentDidMount() {
|
|
36
|
-
this.adapt();
|
|
35
|
+
this.frame = requestAnimationFrame(() => this.adapt());
|
|
37
36
|
}
|
|
38
37
|
componentDidUpdate() {
|
|
39
38
|
this.adapt();
|
|
40
39
|
}
|
|
40
|
+
componentWillUnmount() {
|
|
41
|
+
if (this.frame != null) {
|
|
42
|
+
cancelAnimationFrame(this.frame);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
static contextType = ControlsHeightContext;
|
|
46
|
+
frame;
|
|
41
47
|
input;
|
|
42
|
-
underlineNode;
|
|
43
48
|
id = getUID('ring-input-');
|
|
44
49
|
getId() {
|
|
45
50
|
return this.props.id || this.id;
|
|
@@ -57,15 +62,11 @@ export class Input extends PureComponent {
|
|
|
57
62
|
if (!el || !el.style) {
|
|
58
63
|
return;
|
|
59
64
|
}
|
|
60
|
-
el.style.height = `${el.scrollHeight}px`;
|
|
65
|
+
el.style.height = `${el.scrollHeight + 2}px`;
|
|
61
66
|
}
|
|
62
67
|
adapt() {
|
|
63
68
|
this.checkValue();
|
|
64
|
-
this.stretch(this.underlineNode);
|
|
65
69
|
}
|
|
66
|
-
underlineRef = (el) => {
|
|
67
|
-
this.underlineNode = el;
|
|
68
|
-
};
|
|
69
70
|
inputRef = (el) => {
|
|
70
71
|
this.input = el;
|
|
71
72
|
};
|
|
@@ -87,13 +88,12 @@ export class Input extends PureComponent {
|
|
|
87
88
|
render() {
|
|
88
89
|
const {
|
|
89
90
|
// Modifiers
|
|
90
|
-
|
|
91
|
+
size, active, multiline, borderless,
|
|
91
92
|
// Props
|
|
92
|
-
label, error, className, inputClassName, children, value, onClear, disabled, inputRef, onChange, enableShortcuts, id, placeholder, icon,
|
|
93
|
-
const minimizeMargins = compact || borderless;
|
|
93
|
+
label, error, className, inputClassName, children, value, onClear, disabled, inputRef, onChange, enableShortcuts, id, placeholder, icon, height = this.context, afterInput, ...restProps } = this.props;
|
|
94
94
|
const { empty } = this.state;
|
|
95
95
|
const clearable = !!onClear;
|
|
96
|
-
const classes = classNames(styles.
|
|
96
|
+
const classes = classNames(className, styles.outerContainer, [styles[`size${size}`]], [styles[`height${height}`]], {
|
|
97
97
|
'ring-js-shortcuts': enableShortcuts === true,
|
|
98
98
|
[styles.active]: active,
|
|
99
99
|
[styles.error]: error != null,
|
|
@@ -101,7 +101,7 @@ export class Input extends PureComponent {
|
|
|
101
101
|
[styles.noLabel]: !this.props.label,
|
|
102
102
|
[styles.withIcon]: icon != null,
|
|
103
103
|
[styles.clearable]: clearable,
|
|
104
|
-
[styles.
|
|
104
|
+
[styles.borderless]: borderless
|
|
105
105
|
});
|
|
106
106
|
const inputClasses = classNames(styles.input, inputClassName);
|
|
107
107
|
const text = value != null ? value : children;
|
|
@@ -116,23 +116,23 @@ export class Input extends PureComponent {
|
|
|
116
116
|
'data-enabled-shortcuts': Array.isArray(enableShortcuts) ? enableShortcuts.join(',') : null
|
|
117
117
|
};
|
|
118
118
|
return (<div className={classes} data-test="ring-input">
|
|
119
|
-
{
|
|
120
|
-
|
|
119
|
+
{label && (<label htmlFor={this.getId()} className={classNames(styles.label, {
|
|
120
|
+
[styles.disabledLabel]: disabled
|
|
121
|
+
})}>{label}</label>)}
|
|
122
|
+
<div className={styles.container}>
|
|
123
|
+
{icon && <Icon glyph={icon} className={styles.icon}/>}
|
|
124
|
+
{multiline
|
|
121
125
|
? (<textarea onChange={this.handleTextareaChange} rows={1} {...commonProps} {...restProps}/>)
|
|
122
126
|
: (<input onChange={this.handleInputChange} {...commonProps} {...restProps}/>)}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
{
|
|
127
|
-
{!borderless && <div className={styles.focusUnderline}/>}
|
|
128
|
-
{!minimizeMargins && <div className={styles.errorUnderline}/>}
|
|
129
|
-
{!minimizeMargins && renderUnderline(this.underlineRef, error)}
|
|
127
|
+
{clearable && !disabled && (<Button title="Clear input" data-test="ring-input-clear" className={styles.clear} icon={closeIcon} onClick={this.clear}/>)}
|
|
128
|
+
{afterInput}
|
|
129
|
+
</div>
|
|
130
|
+
{error && <div className={styles.errorText}>{error}</div>}
|
|
130
131
|
</div>);
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
134
|
Input.propTypes = {
|
|
134
135
|
value: PropTypes.string,
|
|
135
|
-
theme: PropTypes.oneOf(Object.values(Theme)),
|
|
136
136
|
className: PropTypes.string,
|
|
137
137
|
inputClassName: PropTypes.string,
|
|
138
138
|
size: PropTypes.oneOf(Object.values(Size)).isRequired,
|
|
@@ -140,8 +140,6 @@ Input.propTypes = {
|
|
|
140
140
|
active: PropTypes.bool,
|
|
141
141
|
error: PropTypes.string,
|
|
142
142
|
multiline: PropTypes.bool,
|
|
143
|
-
borderless: PropTypes.bool,
|
|
144
|
-
compact: PropTypes.bool,
|
|
145
143
|
onChange: PropTypes.func,
|
|
146
144
|
onClear: PropTypes.func,
|
|
147
145
|
inputRef: PropTypes.oneOfType([
|
|
@@ -157,9 +155,7 @@ Input.propTypes = {
|
|
|
157
155
|
disabled: PropTypes.bool,
|
|
158
156
|
id: PropTypes.string,
|
|
159
157
|
placeholder: PropTypes.string,
|
|
160
|
-
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType])
|
|
161
|
-
renderUnderline: PropTypes.func
|
|
158
|
+
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType])
|
|
162
159
|
};
|
|
163
|
-
|
|
164
|
-
export
|
|
165
|
-
export { Size, Theme };
|
|
160
|
+
export default Input;
|
|
161
|
+
export { Size };
|