@jetbrains/ring-ui 7.0.0-beta.8 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +36 -25
- 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.d.ts +1 -2
- package/components/collapse/collapse-content.js +25 -14
- 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.d.ts +4 -2
- package/components/global/theme.js +14 -12
- 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.css +1 -1
- package/components/icon/icon.js +7 -9
- package/components/icon/icon__svg.js +6 -6
- package/components/input/input.css +1 -1
- 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 -7
- 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 +8 -6
- 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 +2 -10
- 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 +7 -7
- 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.d.ts +4 -1
- package/components/tooltip/tooltip.js +19 -10
- 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 +66 -58
- 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
|
@@ -3,13 +3,12 @@ import './form.css';
|
|
|
3
3
|
import '../input-size/input-size.css';
|
|
4
4
|
import '../error-bubble/error-bubble-legacy.css';
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
export default {
|
|
8
7
|
title: 'Style-only/Form',
|
|
9
8
|
|
|
10
9
|
parameters: {
|
|
11
|
-
notes: 'Helps create forms with various types of controls.'
|
|
12
|
-
}
|
|
10
|
+
notes: 'Helps create forms with various types of controls.',
|
|
11
|
+
},
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
export const basic = () => (
|
|
@@ -18,117 +17,100 @@ export const basic = () => (
|
|
|
18
17
|
<span className="ring-form__title">Form Title</span>
|
|
19
18
|
|
|
20
19
|
<div className="ring-form__group">
|
|
21
|
-
<label htmlFor="ring-form-1" className="ring-form__label">
|
|
22
|
-
Input
|
|
20
|
+
<label htmlFor="ring-form-1" className="ring-form__label">
|
|
21
|
+
Full-Width Input
|
|
22
|
+
</label>
|
|
23
23
|
<div className="ring-form__control">
|
|
24
|
-
<input className="ring-input" id="ring-form-1" type="text"/>
|
|
24
|
+
<input className="ring-input" id="ring-form-1" type="text" />
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
27
27
|
|
|
28
28
|
<div className="ring-form__group">
|
|
29
|
-
<label htmlFor="ring-form-2" className="ring-form__label">
|
|
29
|
+
<label htmlFor="ring-form-2" className="ring-form__label">
|
|
30
|
+
Medium Input
|
|
31
|
+
</label>
|
|
30
32
|
<div className="ring-form__control">
|
|
31
|
-
<input
|
|
32
|
-
className="ring-input ring-input-size_m"
|
|
33
|
-
id="ring-form-2"
|
|
34
|
-
type="text"
|
|
35
|
-
/>
|
|
33
|
+
<input className="ring-input ring-input-size_m" id="ring-form-2" type="text" />
|
|
36
34
|
</div>
|
|
37
35
|
</div>
|
|
38
36
|
|
|
39
37
|
<div className="ring-form__group">
|
|
40
|
-
<label htmlFor="ring-form-3" className="ring-form__label">
|
|
38
|
+
<label htmlFor="ring-form-3" className="ring-form__label">
|
|
39
|
+
Medium Input & Error
|
|
40
|
+
</label>
|
|
41
41
|
<div className="ring-form__control">
|
|
42
|
-
<input
|
|
43
|
-
className="ring-input ring-input_error ring-input-size_m"
|
|
44
|
-
id="ring-form-3"
|
|
45
|
-
type="text"
|
|
46
|
-
/>
|
|
42
|
+
<input className="ring-input ring-input_error ring-input-size_m" id="ring-form-3" type="text" />
|
|
47
43
|
<div className="ring-error-bubble active">Error bubble</div>
|
|
48
44
|
</div>
|
|
49
45
|
</div>
|
|
50
46
|
|
|
51
47
|
<div className="ring-form__group">
|
|
52
|
-
<label htmlFor="ring-form-4" className="ring-form__label">
|
|
48
|
+
<label htmlFor="ring-form-4" className="ring-form__label">
|
|
49
|
+
Long Input
|
|
50
|
+
</label>
|
|
53
51
|
<div className="ring-form__control">
|
|
54
|
-
<input
|
|
55
|
-
|
|
56
|
-
id="ring-form-4"
|
|
57
|
-
type="text"
|
|
58
|
-
/>
|
|
59
|
-
<div className="ring-error-bubble active">Error bubble for a long
|
|
60
|
-
control
|
|
61
|
-
</div>
|
|
52
|
+
<input className="ring-input ring-input-size_l" id="ring-form-4" type="text" />
|
|
53
|
+
<div className="ring-error-bubble active">Error bubble for a long control</div>
|
|
62
54
|
</div>
|
|
63
55
|
</div>
|
|
64
56
|
|
|
65
57
|
<div className="ring-form__group">
|
|
66
|
-
<label htmlFor="ring-form-5" className="ring-form__label">
|
|
67
|
-
Control
|
|
58
|
+
<label htmlFor="ring-form-5" className="ring-form__label">
|
|
59
|
+
Full-Width Control
|
|
60
|
+
</label>
|
|
68
61
|
<div className="ring-form__control">
|
|
69
|
-
<input className="ring-input" id="ring-form-5" type="text"/>
|
|
70
|
-
<div className="ring-error-bubble active">Error bubble for a full-width
|
|
71
|
-
control
|
|
72
|
-
</div>
|
|
62
|
+
<input className="ring-input" id="ring-form-5" type="text" />
|
|
63
|
+
<div className="ring-error-bubble active">Error bubble for a full-width control</div>
|
|
73
64
|
</div>
|
|
74
65
|
</div>
|
|
75
66
|
|
|
76
67
|
<div className="ring-form__group">
|
|
77
|
-
<label htmlFor="ring-form-7" className="ring-form__label">
|
|
68
|
+
<label htmlFor="ring-form-7" className="ring-form__label">
|
|
69
|
+
Textarea
|
|
70
|
+
</label>
|
|
78
71
|
<div className="ring-form__control">
|
|
79
|
-
<textarea
|
|
80
|
-
className="ring-input ring-input-size_m"
|
|
81
|
-
id="ring-form-7"
|
|
82
|
-
/>
|
|
72
|
+
<textarea className="ring-input ring-input-size_m" id="ring-form-7" />
|
|
83
73
|
</div>
|
|
84
74
|
</div>
|
|
85
75
|
|
|
86
76
|
<div className="ring-form__group">
|
|
87
|
-
<label htmlFor="ring-form-8" className="ring-form__label">
|
|
88
|
-
Textarea
|
|
77
|
+
<label htmlFor="ring-form-8" className="ring-form__label">
|
|
78
|
+
Long Textarea
|
|
79
|
+
</label>
|
|
89
80
|
<div className="ring-form__control">
|
|
90
|
-
<textarea
|
|
91
|
-
className="ring-input ring-input-size_l"
|
|
92
|
-
id="ring-form-8"
|
|
93
|
-
/>
|
|
81
|
+
<textarea className="ring-input ring-input-size_l" id="ring-form-8" />
|
|
94
82
|
</div>
|
|
95
83
|
</div>
|
|
96
84
|
|
|
97
85
|
<div className="ring-form__group">
|
|
98
|
-
<label htmlFor="ring-form-9" className="ring-form__label">
|
|
99
|
-
Textarea
|
|
86
|
+
<label htmlFor="ring-form-9" className="ring-form__label">
|
|
87
|
+
Full-Width Textarea
|
|
88
|
+
</label>
|
|
100
89
|
<div className="ring-form__control">
|
|
101
|
-
<textarea className="ring-input" id="ring-form-9"/>
|
|
90
|
+
<textarea className="ring-input" id="ring-form-9" />
|
|
102
91
|
</div>
|
|
103
92
|
</div>
|
|
104
93
|
|
|
105
94
|
<div className="ring-form__group">
|
|
106
|
-
<label htmlFor="ring-form-11" className="ring-form__label">
|
|
107
|
-
a small container
|
|
95
|
+
<label htmlFor="ring-form-11" className="ring-form__label">
|
|
96
|
+
Input in a small container
|
|
97
|
+
</label>
|
|
108
98
|
<div className="ring-form__control ring-form__control_small">
|
|
109
|
-
<input
|
|
110
|
-
className="ring-input ring-input-size_m"
|
|
111
|
-
id="ring-form-11"
|
|
112
|
-
type="text"
|
|
113
|
-
/>
|
|
99
|
+
<input className="ring-input ring-input-size_m" id="ring-form-11" type="text" />
|
|
114
100
|
</div>
|
|
115
101
|
</div>
|
|
116
102
|
|
|
117
103
|
<div className="ring-form__group">
|
|
118
|
-
<label htmlFor="ring-form-12" className="ring-form__label">
|
|
119
|
-
a small container
|
|
104
|
+
<label htmlFor="ring-form-12" className="ring-form__label">
|
|
105
|
+
Textarea in a small container
|
|
106
|
+
</label>
|
|
120
107
|
<div className="ring-form__control ring-form__control_small">
|
|
121
|
-
<textarea
|
|
122
|
-
className="ring-input ring-input-size_m"
|
|
123
|
-
id="ring-form-12"
|
|
124
|
-
/>
|
|
108
|
+
<textarea className="ring-input ring-input-size_m" id="ring-form-12" />
|
|
125
109
|
</div>
|
|
126
110
|
</div>
|
|
127
111
|
|
|
128
112
|
<div className="ring-form__footer">
|
|
129
|
-
<rg-button mode="primary">Save</rg-button>
|
|
130
|
-
{' '}
|
|
131
|
-
<rg-button>Cancel</rg-button>
|
|
113
|
+
<rg-button mode="primary">Save</rg-button> <rg-button>Cancel</rg-button>
|
|
132
114
|
</div>
|
|
133
115
|
</form>
|
|
134
116
|
</div>
|
|
@@ -5,9 +5,7 @@ export default function createStatefulContext(initialValue, name = '') {
|
|
|
5
5
|
function Provider({ children }) {
|
|
6
6
|
const [value, update] = useState(initialValue);
|
|
7
7
|
return (<ValueContext.Provider value={value}>
|
|
8
|
-
<UpdateContext.Provider value={update}>
|
|
9
|
-
{children}
|
|
10
|
-
</UpdateContext.Provider>
|
|
8
|
+
<UpdateContext.Provider value={update}>{children}</UpdateContext.Provider>
|
|
11
9
|
</ValueContext.Provider>);
|
|
12
10
|
}
|
|
13
11
|
Provider.displayName = `${name}Provider`;
|
|
@@ -29,6 +27,6 @@ export default function createStatefulContext(initialValue, name = '') {
|
|
|
29
27
|
UpdateContext,
|
|
30
28
|
Provider,
|
|
31
29
|
useUpdate,
|
|
32
|
-
Updater: memo(Updater)
|
|
30
|
+
Updater: memo(Updater),
|
|
33
31
|
};
|
|
34
32
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
function expandMap(attrsMap) {
|
|
2
|
-
return Object.entries(attrsMap).
|
|
3
|
-
reduce((result, [key, value]) => (value ? [...result, key] : result), []);
|
|
2
|
+
return Object.entries(attrsMap).reduce((result, [key, value]) => (value ? [...result, key] : result), []);
|
|
4
3
|
}
|
|
5
4
|
export default function joinDataTestAttributes(...attrs) {
|
|
6
|
-
return attrs
|
|
7
|
-
reduce((result, attr) => {
|
|
5
|
+
return attrs
|
|
6
|
+
.reduce((result, attr) => {
|
|
8
7
|
if (!attr) {
|
|
9
8
|
return result;
|
|
10
9
|
}
|
|
@@ -12,6 +11,6 @@ export default function joinDataTestAttributes(...attrs) {
|
|
|
12
11
|
return [...result, ...expandMap(attr)];
|
|
13
12
|
}
|
|
14
13
|
return [...result, attr];
|
|
15
|
-
}, [])
|
|
16
|
-
join(' ');
|
|
14
|
+
}, [])
|
|
15
|
+
.join(' ');
|
|
17
16
|
}
|
package/components/global/dom.js
CHANGED
|
@@ -10,7 +10,7 @@ export function isMounted(node) {
|
|
|
10
10
|
}
|
|
11
11
|
const rectStub = { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
|
12
12
|
export function getRect(node) {
|
|
13
|
-
if (node instanceof Range || node != null && isMounted(node)) {
|
|
13
|
+
if (node instanceof Range || (node != null && isMounted(node))) {
|
|
14
14
|
const { top, right, bottom, left, width, height } = node.getBoundingClientRect();
|
|
15
15
|
return { top, right, bottom, left, width, height };
|
|
16
16
|
}
|
|
@@ -32,18 +32,16 @@ export function isNodeInVisiblePartOfPage(node) {
|
|
|
32
32
|
return !(bottom < 0 || right < 0 || getWindowHeight() - top < 0 || getWindowWidth() - left < 0);
|
|
33
33
|
}
|
|
34
34
|
export function getDocumentScrollTop() {
|
|
35
|
-
return (document.documentElement && document.documentElement.scrollTop) ||
|
|
36
|
-
document.body.scrollTop;
|
|
35
|
+
return (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;
|
|
37
36
|
}
|
|
38
37
|
export function getDocumentScrollLeft() {
|
|
39
|
-
return (document.documentElement && document.documentElement.scrollLeft) ||
|
|
40
|
-
document.body.scrollLeft;
|
|
38
|
+
return (document.documentElement && document.documentElement.scrollLeft) || document.body.scrollLeft;
|
|
41
39
|
}
|
|
42
40
|
export const applyMethodToClasses = (method) => (classList, classes = '') => {
|
|
43
|
-
classes
|
|
44
|
-
split(/\s+/g)
|
|
45
|
-
filter(className => !!className)
|
|
46
|
-
forEach(className => classList[method](className));
|
|
41
|
+
classes
|
|
42
|
+
.split(/\s+/g)
|
|
43
|
+
.filter(className => !!className)
|
|
44
|
+
.forEach(className => classList[method](className));
|
|
47
45
|
};
|
|
48
46
|
export const addClasses = applyMethodToClasses('add');
|
|
49
47
|
export const removeClasses = applyMethodToClasses('remove');
|
|
@@ -56,8 +54,7 @@ export function setRootStyleProperties(properties = {}) {
|
|
|
56
54
|
}
|
|
57
55
|
export function resetRootStyleProperties(properties = {}) {
|
|
58
56
|
const rootStyle = document.documentElement.style;
|
|
59
|
-
Object.keys(properties).
|
|
60
|
-
forEach(key => rootStyle.removeProperty(key));
|
|
57
|
+
Object.keys(properties).forEach(key => rootStyle.removeProperty(key));
|
|
61
58
|
}
|
|
62
59
|
export class Listeners {
|
|
63
60
|
_all = new Set();
|
|
@@ -3,10 +3,10 @@ import { createComposedRef } from './composeRefs';
|
|
|
3
3
|
export default function focusSensorHOC(ComposedComponent) {
|
|
4
4
|
class FocusSensor extends Component {
|
|
5
5
|
state = {
|
|
6
|
-
focused: this.props.focused
|
|
6
|
+
focused: this.props.focused,
|
|
7
7
|
};
|
|
8
8
|
componentDidMount() {
|
|
9
|
-
const { props: { autofocus, scrollOnTableFocus }, node } = this;
|
|
9
|
+
const { props: { autofocus, scrollOnTableFocus }, node, } = this;
|
|
10
10
|
node?.setAttribute('tabindex', '0');
|
|
11
11
|
if (node != null) {
|
|
12
12
|
node.style.outline = 'none';
|
|
@@ -50,11 +50,10 @@ export default function focusSensorHOC(ComposedComponent) {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
onBlurCapture = ({ target }) => {
|
|
53
|
-
const { state: { focused }, node } = this;
|
|
53
|
+
const { state: { focused }, node, } = this;
|
|
54
54
|
if (focused) {
|
|
55
55
|
setTimeout(() => {
|
|
56
|
-
const blurred = target instanceof Node &&
|
|
57
|
-
node?.contains(target) && !node.contains(document.activeElement);
|
|
56
|
+
const blurred = target instanceof Node && node?.contains(target) && !node.contains(document.activeElement);
|
|
58
57
|
if (blurred) {
|
|
59
58
|
this.setState({ focused: false });
|
|
60
59
|
this.props.onBlur?.();
|
|
@@ -80,7 +79,7 @@ export default function focusSensorHOC(ComposedComponent) {
|
|
|
80
79
|
autofocus: false,
|
|
81
80
|
scrollOnTableFocus: true,
|
|
82
81
|
onFocus: () => { },
|
|
83
|
-
onBlur: () => { }
|
|
82
|
+
onBlur: () => { },
|
|
84
83
|
};
|
|
85
84
|
return FocusSensor;
|
|
86
85
|
}
|
|
@@ -13,7 +13,7 @@ export default function fuzzyHighlight(needle, haystack, caseSensitive = false)
|
|
|
13
13
|
}
|
|
14
14
|
highlight += haystack.slice(prevMatch.to);
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return { matched, matches, highlight };
|
|
17
17
|
};
|
|
18
18
|
const hlen = hstck.length;
|
|
19
19
|
const nlen = ndl.length;
|
|
@@ -10,7 +10,7 @@ const normalizeKey = {
|
|
|
10
10
|
Menu: 'ContextMenu',
|
|
11
11
|
Apps: 'ContextMenu',
|
|
12
12
|
Scroll: 'ScrollLock',
|
|
13
|
-
MozPrintableKey: 'Unidentified'
|
|
13
|
+
MozPrintableKey: 'Unidentified',
|
|
14
14
|
};
|
|
15
15
|
const translateToKey = {
|
|
16
16
|
8: 'Backspace',
|
|
@@ -48,7 +48,7 @@ const translateToKey = {
|
|
|
48
48
|
123: 'F12',
|
|
49
49
|
144: 'NumLock',
|
|
50
50
|
145: 'ScrollLock',
|
|
51
|
-
224: 'Meta'
|
|
51
|
+
224: 'Meta',
|
|
52
52
|
};
|
|
53
53
|
const ENTER = 13;
|
|
54
54
|
const SPACE = 32;
|
|
@@ -86,9 +86,6 @@
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
/* Note: footer also has top margin which isn't taken into account here */
|
|
90
|
-
@value footer-height: calc(var(--ring-unit) * 8);
|
|
91
|
-
|
|
92
89
|
/* Media breakpoints (minimal values) */
|
|
93
90
|
@value breakpoint-small: 640px;
|
|
94
91
|
@value breakpoint-middle: 960px;
|
|
@@ -20,11 +20,7 @@ export default function normalizeIndent(string) {
|
|
|
20
20
|
lines.pop();
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
const indents = lines.
|
|
24
|
-
filter(line => nonemptyRE.test(line)).
|
|
25
|
-
map(line => line.match(indentRE)?.[0].length ?? 0);
|
|
23
|
+
const indents = lines.filter(line => nonemptyRE.test(line)).map(line => line.match(indentRE)?.[0].length ?? 0);
|
|
26
24
|
const minIndent = Math.min(...indents);
|
|
27
|
-
return lines.
|
|
28
|
-
map(line => line.slice(minIndent)).
|
|
29
|
-
join('\n');
|
|
25
|
+
return lines.map(line => line.slice(minIndent)).join('\n');
|
|
30
26
|
}
|
|
@@ -6,8 +6,7 @@ export default class Renderer extends Component {
|
|
|
6
6
|
if (!node || !nodes || !nodes.length) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
-
Array.from(this.props.nodes).
|
|
10
|
-
forEach(nodeToRender => node.appendChild(nodeToRender));
|
|
9
|
+
Array.from(this.props.nodes).forEach(nodeToRender => node.appendChild(nodeToRender));
|
|
11
10
|
}
|
|
12
11
|
node;
|
|
13
12
|
nodeRef = (node) => {
|
|
@@ -15,6 +14,6 @@ export default class Renderer extends Component {
|
|
|
15
14
|
};
|
|
16
15
|
render() {
|
|
17
16
|
const { className } = this.props;
|
|
18
|
-
return
|
|
17
|
+
return <div className={className} ref={this.nodeRef}/>;
|
|
19
18
|
}
|
|
20
19
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes, ReactElement } from 'react';
|
|
1
|
+
import { HTMLAttributes, ReactElement, FunctionComponent } from 'react';
|
|
2
2
|
declare enum Theme {
|
|
3
3
|
AUTO = "auto",
|
|
4
4
|
LIGHT = "light",
|
|
@@ -16,10 +16,12 @@ export interface WithThemeClassesProps {
|
|
|
16
16
|
}
|
|
17
17
|
export declare function WithThemeClasses({ theme, children }: WithThemeClassesProps): ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
18
18
|
export declare function applyTheme(theme: Theme.DARK | Theme.LIGHT, container: HTMLElement): void;
|
|
19
|
+
type WrapperType = FunctionComponent<HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>>;
|
|
19
20
|
export interface ThemeProviderProps extends HTMLAttributes<HTMLDivElement> {
|
|
20
21
|
theme?: Theme;
|
|
21
22
|
passToPopups?: boolean;
|
|
23
|
+
WrapperComponent?: WrapperType;
|
|
22
24
|
target?: HTMLElement;
|
|
23
25
|
}
|
|
24
|
-
export declare const ThemeProvider: import("react").ForwardRefExoticComponent<ThemeProviderProps & import("react").RefAttributes<
|
|
26
|
+
export declare const ThemeProvider: import("react").ForwardRefExoticComponent<ThemeProviderProps & import("react").RefAttributes<HTMLElement>>;
|
|
25
27
|
export default Theme;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMemo, useState, useEffect, forwardRef, useContext, createContext } from 'react';
|
|
1
|
+
import { useMemo, useState, useEffect, forwardRef, useContext, createContext, } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import { PopupTarget, PopupTargetContext } from '../popup/popup.target';
|
|
@@ -30,7 +30,7 @@ export function useThemeClasses(theme) {
|
|
|
30
30
|
return classNames({
|
|
31
31
|
[styles.dark]: resolvedTheme === Theme.DARK,
|
|
32
32
|
[GLOBAL_DARK_CLASS_NAME]: resolvedTheme === Theme.DARK,
|
|
33
|
-
[defaultStyles.light]: resolvedTheme === Theme.LIGHT
|
|
33
|
+
[defaultStyles.light]: resolvedTheme === Theme.LIGHT,
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
export function WithThemeClasses({ theme, children }) {
|
|
@@ -49,7 +49,10 @@ export function applyTheme(theme, container) {
|
|
|
49
49
|
container.classList.add(defaultStyles.light);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
const DefaultWrapper = forwardRef(function Wrapper(props, ref) {
|
|
53
|
+
return <div {...props} ref={ref}/>;
|
|
54
|
+
});
|
|
55
|
+
export const ThemeProvider = forwardRef(function ThemeProvider({ theme = Theme.AUTO, className, passToPopups, children, WrapperComponent = DefaultWrapper, target, ...restProps }, ref) {
|
|
53
56
|
const systemTheme = useTheme();
|
|
54
57
|
const resolvedTheme = theme === Theme.AUTO ? systemTheme : theme;
|
|
55
58
|
const id = useMemo(() => getUID('popups-with-theme-'), []);
|
|
@@ -62,15 +65,14 @@ export const ThemeProvider = forwardRef(function ThemeProvider({ theme = Theme.A
|
|
|
62
65
|
const themeClasses = useThemeClasses(theme);
|
|
63
66
|
const parentTarget = useContext(PopupTargetContext);
|
|
64
67
|
return (<ThemeContext.Provider value={themeValue}>
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
</div>
|
|
68
|
+
<WrapperComponent ref={ref} className={target != null ? undefined : classNames(className, themeClasses)} {...restProps}>
|
|
69
|
+
{passToPopups ? (<PopupTarget id={id}>
|
|
70
|
+
{popupTarget => (<>
|
|
71
|
+
{children}
|
|
72
|
+
{createPortal(<div className={themeClasses}>{popupTarget}</div>, (parentTarget && getPopupContainer(parentTarget)) || document.body)}
|
|
73
|
+
</>)}
|
|
74
|
+
</PopupTarget>) : (children)}
|
|
75
|
+
</WrapperComponent>
|
|
74
76
|
</ThemeContext.Provider>);
|
|
75
77
|
});
|
|
76
78
|
export default Theme;
|
package/components/global/url.js
CHANGED
|
@@ -101,15 +101,12 @@ export function parseQueryString(queryString) {
|
|
|
101
101
|
}
|
|
102
102
|
let matchedQueryPair;
|
|
103
103
|
while ((matchedQueryPair = queryParameterPairRE.exec(queryString)) != null) {
|
|
104
|
-
urlParams[decode(matchedQueryPair[FIRST_PAIR_ELEMENT])] =
|
|
105
|
-
decode(matchedQueryPair[SECOND_PAIR_ELEMENT]);
|
|
104
|
+
urlParams[decode(matchedQueryPair[FIRST_PAIR_ELEMENT])] = decode(matchedQueryPair[SECOND_PAIR_ELEMENT]);
|
|
106
105
|
}
|
|
107
106
|
return urlParams;
|
|
108
107
|
}
|
|
109
108
|
function customEncodeURIComponent(str) {
|
|
110
|
-
return encodeURIComponent(String(str)).
|
|
111
|
-
replace(/%2C/g, ',').
|
|
112
|
-
replace(/%24/g, '$');
|
|
109
|
+
return encodeURIComponent(String(str)).replace(/%2C/g, ',').replace(/%24/g, '$');
|
|
113
110
|
}
|
|
114
111
|
/**
|
|
115
112
|
* Takes a URL as input and a params object.
|
|
@@ -120,14 +117,17 @@ function customEncodeURIComponent(str) {
|
|
|
120
117
|
*/
|
|
121
118
|
export function encodeURL(url, params) {
|
|
122
119
|
const equalsSign = '=';
|
|
123
|
-
const firstSeparator =
|
|
120
|
+
const firstSeparator = url.indexOf('?') === -1 ? '?' : '&';
|
|
124
121
|
let res = url;
|
|
125
122
|
let k;
|
|
126
123
|
let i = 0;
|
|
127
124
|
for (k in params) {
|
|
128
125
|
if (params.hasOwnProperty(k) && params[k] != null) {
|
|
129
|
-
res +=
|
|
130
|
-
|
|
126
|
+
res +=
|
|
127
|
+
(i++ === 0 ? firstSeparator : '&') +
|
|
128
|
+
customEncodeURIComponent(k) +
|
|
129
|
+
equalsSign +
|
|
130
|
+
customEncodeURIComponent(params[k]);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
return res;
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
--ring-popup-shadow: 0 2px 8px var(--ring-popup-shadow-color), 0 1px 2px var(--ring-popup-secondary-shadow-color);
|
|
57
57
|
--ring-dialog-shadow: 0 4px 24px var(--ring-popup-shadow-color), 0 2px 6px var(--ring-popup-secondary-shadow-color);
|
|
58
58
|
|
|
59
|
-
|
|
60
59
|
/* Text */
|
|
61
60
|
--ring-search-components: 112, 156, 245;
|
|
62
61
|
--ring-search-color: rgb(var(--ring-search-components)); /* #709CF5 */
|
|
@@ -165,13 +164,7 @@
|
|
|
165
164
|
--ring-ease: 0.3s ease-out;
|
|
166
165
|
--ring-fast-ease: 0.15s ease-out;
|
|
167
166
|
--ring-font-family: system-ui, Arial, sans-serif;
|
|
168
|
-
--ring-font-family-monospace:
|
|
169
|
-
Menlo,
|
|
170
|
-
"Bitstream Vera Sans Mono",
|
|
171
|
-
"Ubuntu Mono",
|
|
172
|
-
Consolas,
|
|
173
|
-
"Courier New",
|
|
174
|
-
Courier,
|
|
167
|
+
--ring-font-family-monospace: Menlo, "Bitstream Vera Sans Mono", "Ubuntu Mono", Consolas, "Courier New", Courier,
|
|
175
168
|
monospace;
|
|
176
169
|
--ring-font-weight-bold: 600;
|
|
177
170
|
|
|
@@ -110,7 +110,6 @@
|
|
|
110
110
|
--ring-added-subtle-background-components: 37, 54, 39;
|
|
111
111
|
--ring-added-subtle-background-color: rgb(var(--ring-added-subtle-background-components)); /* #253627 */
|
|
112
112
|
|
|
113
|
-
|
|
114
113
|
/* Code */
|
|
115
114
|
--ring-code-background-components: 30, 31, 34;
|
|
116
115
|
--ring-code-background-color: rgb(var(--ring-code-background-components)); /* #1E1F22 */
|
package/components/grid/col.js
CHANGED
|
@@ -9,7 +9,7 @@ const classMap = {
|
|
|
9
9
|
xsOffset: 'col-xs-offset',
|
|
10
10
|
smOffset: 'col-sm-offset',
|
|
11
11
|
mdOffset: 'col-md-offset',
|
|
12
|
-
lgOffset: 'col-lg-offset'
|
|
12
|
+
lgOffset: 'col-lg-offset',
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* Converts props like "xs=9 xsOffset={2}" to classes "col-xs-9 col-xs-offset-2"
|
|
@@ -17,17 +17,17 @@ const classMap = {
|
|
|
17
17
|
* @returns {Array} result classnames
|
|
18
18
|
*/
|
|
19
19
|
function getClassNames(props) {
|
|
20
|
-
return Object.entries(props)
|
|
21
|
-
filter(([key]) => classMap[key])
|
|
22
|
-
map(([key, value]) => styles[Number.isInteger(value) ? `${classMap[key]}-${value}` : classMap[key]]);
|
|
20
|
+
return Object.entries(props)
|
|
21
|
+
.filter(([key]) => classMap[key])
|
|
22
|
+
.map(([key, value]) => styles[Number.isInteger(value) ? `${classMap[key]}-${value}` : classMap[key]]);
|
|
23
23
|
}
|
|
24
24
|
export default class Col extends Component {
|
|
25
25
|
render() {
|
|
26
26
|
const { children, className, reverse, ...restProps } = this.props;
|
|
27
27
|
const classes = classNames(styles.col, className, getClassNames(restProps), {
|
|
28
|
-
[styles.reverse]: reverse
|
|
28
|
+
[styles.reverse]: reverse,
|
|
29
29
|
});
|
|
30
|
-
return (<div className={classes}>
|
|
30
|
+
return (<div className={classes} data-test="ring-grid-column">
|
|
31
31
|
{children}
|
|
32
32
|
</div>);
|
|
33
33
|
}
|