@jetbrains/ring-ui 4.1.0-beta.3 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +17 -15
- package/babel.config.js +3 -2
- package/components/alert/alert.js +9 -3
- package/components/alert/alert.test.js +21 -48
- package/components/alert/container.css +1 -1
- package/components/alert/container.test.js +3 -13
- package/components/alert-service/alert-service.examples.css +18 -0
- package/components/alert-service/alert-service.examples.js +21 -0
- package/components/alert-service/alert-service.js +10 -3
- package/components/analytics/analytics__fus-plugin.js +3 -3
- package/components/analytics/analytics__ga-plugin.js +2 -2
- package/components/auth/auth.test.js +14 -7
- package/components/auth/auth__core.js +64 -33
- package/components/auth-dialog/auth-dialog.css +2 -3
- package/components/auth-dialog/auth-dialog.js +4 -1
- package/components/auth-dialog/auth-dialog.test.js +3 -19
- package/components/avatar/avatar.css +4 -1
- package/components/avatar/avatar.examples.js +3 -2
- package/components/avatar/avatar.js +34 -6
- package/components/avatar/avatar.test.js +20 -17
- package/components/avatar/fallback-avatar.js +136 -0
- package/components/avatar-editor-ng/avatar-editor-ng.css +2 -2
- package/components/avatar-editor-ng/avatar-editor-ng.js +2 -1
- package/components/avatar-editor-ng/{avatar-editor-ng.html → avatar-editor-ng__template.js} +2 -2
- package/components/badge/badge.test.js +13 -20
- package/components/button/button.css +2 -2
- package/components/button/button.js +4 -1
- package/components/button/button.test.js +32 -33
- package/components/button-group/button-group.js +1 -1
- package/components/button-group/caption.js +1 -1
- package/components/button-ng/button-ng.js +1 -1
- package/components/button-set-ng/button-set-ng.js +3 -1
- package/components/checkbox/checkbox.css +1 -1
- package/components/code/code.js +2 -5
- package/components/confirm/confirm.js +1 -0
- package/components/confirm-service/confirm-service.js +5 -5
- package/components/content-layout/content-layout.css +1 -1
- package/components/data-list/data-list.css +1 -1
- package/components/date-picker/date-input.js +5 -4
- package/components/date-picker/date-picker.css +34 -22
- package/components/date-picker/date-picker.js +16 -14
- package/components/date-picker/date-popup.js +22 -7
- package/components/date-picker/month-names.js +8 -5
- package/components/date-picker/month.js +6 -2
- package/components/date-picker/weekdays.js +10 -2
- package/components/dialog/dialog.examples.js +3 -1
- package/components/dialog/dialog.js +10 -5
- package/components/dialog/dialog.test.js +1 -1
- package/components/dialog/dialog__body-scroll-preventer.js +51 -31
- package/components/dialog-ng/dialog-ng.js +10 -10
- package/components/dialog-ng/{dialog-ng.html → dialog-ng__template.js} +2 -2
- package/components/dropdown/dropdown.examples.js +36 -1
- package/components/dropdown/dropdown.test.js +2 -2
- package/components/dropdown-menu/dropdown-menu.examples.js +47 -0
- package/components/dropdown-menu/dropdown-menu.js +117 -0
- package/components/dropdown-menu/dropdown-menu.test.js +76 -0
- package/components/error-bubble/error-bubble-legacy.css +1 -1
- package/components/error-bubble/error-bubble.css +1 -1
- package/components/error-bubble/error-bubble.examples.js +1 -1
- package/components/error-page/error-page.css +2 -2
- package/components/footer-ng/footer-ng.js +13 -3
- package/components/form/form.css +2 -2
- package/components/form-ng/form-ng.js +3 -1
- package/components/global/global.css +1 -1
- package/components/global/theme.js +1 -1
- package/components/global/variables.css +8 -1
- package/components/grid/grid.css +10 -9
- package/components/header/header.css +1 -1
- package/components/header/header.examples.js +7 -8
- package/components/header/profile.js +10 -11
- package/components/http/http.js +1 -1
- package/components/icon/icon.css +5 -4
- package/components/input/input-legacy.css +7 -7
- package/components/island/header.js +2 -2
- package/components/island/island.css +8 -3
- package/components/island-legacy/island-legacy.css +3 -1
- package/components/list/list.js +6 -1
- package/components/list/list__custom.js +9 -3
- package/components/list/list__item.js +8 -2
- package/components/list/list__link.js +2 -1
- package/components/loader-inline/loader-inline.css +1 -1
- package/components/loader-screen/loader-screen.css +1 -1
- package/components/message/message.css +1 -1
- package/components/message/message.examples.js +8 -7
- package/components/pager/pager.js +5 -3
- package/components/permissions/permissions.js +1 -1
- package/components/popup/popup.js +1 -1
- package/components/popup/popup.test.js +15 -13
- package/components/progress-bar/progress-bar.css +1 -1
- package/components/progress-bar/progress-bar.examples.js +3 -3
- package/components/progress-bar/progress-bar.js +5 -2
- package/components/progress-bar/progress-bar.test.js +12 -13
- package/components/progress-bar-ng/progress-bar-ng.examples.js +3 -3
- package/components/query-assist/query-assist.css +13 -3
- package/components/query-assist/query-assist.examples.js +3 -4
- package/components/query-assist/query-assist.js +56 -12
- package/components/query-assist/query-assist.test.js +37 -5
- package/components/save-field-ng/save-field-ng.css +0 -3
- package/components/save-field-ng/save-field-ng.js +3 -1
- package/components/save-field-ng/{save-field-ng.html → save-field-ng__template.js} +2 -2
- package/components/select/select.css +12 -7
- package/components/select/select.examples.js +13 -0
- package/components/select/select.js +30 -43
- package/components/select/select.test.js +4 -5
- package/components/select/select__popup.js +1 -0
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.css +1 -1
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.js +1 -1
- package/components/shortcuts-hint-ng/{shortcuts-hint-ng.html → shortcuts-hint-ng__template.js} +2 -2
- package/components/sidebar/sidebar.css +1 -0
- package/components/sidebar-ng/sidebar-ng.js +6 -2
- package/components/sidebar-ng/{sidebar-ng__button.html → sidebar-ng__button-template.js} +2 -2
- package/components/sidebar-ng/{sidebar-ng.html → sidebar-ng__template.js} +2 -2
- package/components/table/header.js +9 -1
- package/components/table/row.js +2 -1
- package/components/table/table.css +2 -1
- package/components/table-legacy/table-legacy.css +2 -2
- package/components/table-legacy/table-legacy__toolbar.css +2 -2
- package/components/table-legacy-ng/table-legacy-ng.js +38 -5
- package/components/table-legacy-ng/table-legacy-ng__pager.js +7 -1
- package/components/tabs/collapsible-tab.js +2 -2
- package/components/tabs/collapsible-tabs.js +5 -9
- package/components/tabs/tab-link.js +4 -2
- package/components/tabs/tabs.css +32 -5
- package/components/tabs-ng/tabs-ng.js +4 -2
- package/components/tabs-ng/{tabs-ng.html → tabs-ng__template.js} +6 -2
- package/components/tag/tag.css +5 -2
- package/components/tag/tag.examples.js +3 -0
- package/components/tag/tag.js +19 -16
- package/components/tags-input/tag-input.examples.js +1 -1
- package/components/tags-input/tags-input.js +5 -2
- package/components/template-ng/template-ng.js +1 -1
- package/components/tooltip/tooltip.js +7 -2
- package/components/user-agreement/user-agreement.css +1 -5
- package/components/user-agreement/user-agreement.examples.js +7 -6
- package/components/user-agreement/user-agreement.js +11 -3
- package/package.json +85 -83
- package/webpack.config.js +14 -10
- package/components/button-set-ng/button-set-ng.html +0 -1
- package/components/footer-ng/footer-ng.html +0 -13
- package/components/form-ng/form-ng__error-bubble.html +0 -3
- package/components/table-legacy-ng/table-legacy-ng.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__column.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__header.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__pager.html +0 -7
- package/components/table-legacy-ng/table-legacy-ng__row.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__title.html +0 -9
- package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -123
- package/dist/_helpers/background-flow.js +0 -232
- package/dist/_helpers/badge.js +0 -3
- package/dist/_helpers/button.js +0 -145
- package/dist/_helpers/clickableLink.js +0 -65
- package/dist/_helpers/data-tests.js +0 -15
- package/dist/_helpers/disable-hover-hoc.js +0 -407
- package/dist/_helpers/dom.js +0 -101
- package/dist/_helpers/get-uid.js +0 -15
- package/dist/_helpers/linear-function.js +0 -17
- package/dist/_helpers/list.js +0 -1327
- package/dist/_helpers/logo.js +0 -36
- package/dist/_helpers/memoize.js +0 -17
- package/dist/_helpers/popup.js +0 -691
- package/dist/_helpers/popup.target.js +0 -27
- package/dist/_helpers/rerender-hoc.js +0 -49
- package/dist/_helpers/schedule-raf.js +0 -31
- package/dist/_helpers/sniffer.js +0 -6
- package/dist/_helpers/theme.js +0 -40
- package/dist/_helpers/url.js +0 -125
- package/dist/alert-service.js +0 -149
- package/dist/alert.js +0 -284
- package/dist/analytics.js +0 -116
- package/dist/auth-dialog-service.js +0 -56
- package/dist/auth-dialog.js +0 -122
- package/dist/auth.js +0 -1744
- package/dist/avatar.js +0 -152
- package/dist/badge.js +0 -52
- package/dist/button-group.js +0 -48
- package/dist/button-set.js +0 -27
- package/dist/button-toolbar.js +0 -30
- package/dist/button.js +0 -12
- package/dist/caret.js +0 -262
- package/dist/checkbox.js +0 -108
- package/dist/confirm-service.js +0 -102
- package/dist/confirm.js +0 -113
- package/dist/content-layout.js +0 -184
- package/dist/contenteditable.js +0 -81
- package/dist/data-list.js +0 -466
- package/dist/date-picker.js +0 -1398
- package/dist/dialog.js +0 -223
- package/dist/dropdown.js +0 -250
- package/dist/error-bubble.js +0 -56
- package/dist/error-message.js +0 -53
- package/dist/footer.js +0 -124
- package/dist/grid.js +0 -148
- package/dist/group.js +0 -34
- package/dist/header.js +0 -658
- package/dist/heading.js +0 -76
- package/dist/http.js +0 -207
- package/dist/hub-source.js +0 -130
- package/dist/icon.js +0 -211
- package/dist/input.js +0 -228
- package/dist/island.js +0 -314
- package/dist/link.js +0 -117
- package/dist/list.js +0 -29
- package/dist/loader-inline.js +0 -165
- package/dist/loader-screen.js +0 -45
- package/dist/loader.js +0 -338
- package/dist/login-dialog.js +0 -173
- package/dist/logo.js +0 -8
- package/dist/message.js +0 -226
- package/dist/old-browsers-message.js +0 -129
- package/dist/pager.js +0 -325
- package/dist/panel.js +0 -34
- package/dist/permissions.js +0 -466
- package/dist/popup-menu.js +0 -93
- package/dist/popup.js +0 -16
- package/dist/progress-bar.js +0 -111
- package/dist/proxy-attrs.js +0 -19
- package/dist/query-assist.js +0 -1081
- package/dist/radio.js +0 -112
- package/dist/select.js +0 -1920
- package/dist/selection.js +0 -213
- package/dist/shortcuts.js +0 -307
- package/dist/storage.js +0 -373
- package/dist/style.css +0 -1
- package/dist/tab-trap.js +0 -174
- package/dist/table.js +0 -903
- package/dist/tabs.js +0 -721
- package/dist/tag.js +0 -187
- package/dist/tags-input.js +0 -440
- package/dist/tags-list.js +0 -91
- package/dist/text.js +0 -38
- package/dist/toggle.js +0 -80
- package/dist/tooltip.js +0 -202
- package/dist/user-card.js +0 -218
package/dist/confirm-service.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { c as _objectSpread2 } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { render } from 'react-dom';
|
|
4
|
-
import Confirm from './confirm.js';
|
|
5
|
-
import 'prop-types';
|
|
6
|
-
import './dialog.js';
|
|
7
|
-
import 'classnames';
|
|
8
|
-
import '@jetbrains/icons/close';
|
|
9
|
-
import './island.js';
|
|
10
|
-
import './_helpers/data-tests.js';
|
|
11
|
-
import './_helpers/linear-function.js';
|
|
12
|
-
import 'element-resize-detector';
|
|
13
|
-
import './_helpers/schedule-raf.js';
|
|
14
|
-
import './_helpers/get-uid.js';
|
|
15
|
-
import './shortcuts.js';
|
|
16
|
-
import 'combokeys';
|
|
17
|
-
import './_helpers/sniffer.js';
|
|
18
|
-
import 'sniffr';
|
|
19
|
-
import './tab-trap.js';
|
|
20
|
-
import './_helpers/dom.js';
|
|
21
|
-
import './_helpers/button.js';
|
|
22
|
-
import 'focus-visible';
|
|
23
|
-
import '@jetbrains/icons/chevron-10px';
|
|
24
|
-
import './icon.js';
|
|
25
|
-
import 'util-deprecate';
|
|
26
|
-
import './_helpers/memoize.js';
|
|
27
|
-
import './_helpers/theme.js';
|
|
28
|
-
import './_helpers/clickableLink.js';
|
|
29
|
-
import './_helpers/popup.target.js';
|
|
30
|
-
import 'scrollbar-width';
|
|
31
|
-
import './panel.js';
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @name Confirm Service
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
const containerElement = document.createElement('div');
|
|
38
|
-
/**
|
|
39
|
-
* Renders Confirm into virtual node to skip maintaining container
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
function renderConfirm(props) {
|
|
43
|
-
render( /*#__PURE__*/React.createElement(Confirm, props), containerElement);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function confirm({
|
|
47
|
-
text,
|
|
48
|
-
description,
|
|
49
|
-
confirmLabel = 'OK',
|
|
50
|
-
rejectLabel = 'Cancel',
|
|
51
|
-
cancelIsDefault,
|
|
52
|
-
onBeforeConfirm
|
|
53
|
-
}) {
|
|
54
|
-
return new Promise((resolve, reject) => {
|
|
55
|
-
const props = {
|
|
56
|
-
text,
|
|
57
|
-
description,
|
|
58
|
-
confirmLabel,
|
|
59
|
-
rejectLabel,
|
|
60
|
-
cancelIsDefault,
|
|
61
|
-
show: true,
|
|
62
|
-
onConfirm: () => {
|
|
63
|
-
if (onBeforeConfirm) {
|
|
64
|
-
renderConfirm(_objectSpread2(_objectSpread2({}, props), {}, {
|
|
65
|
-
inProgress: true
|
|
66
|
-
}));
|
|
67
|
-
return Promise.resolve(onBeforeConfirm()).then(() => {
|
|
68
|
-
renderConfirm({
|
|
69
|
-
show: false
|
|
70
|
-
});
|
|
71
|
-
resolve();
|
|
72
|
-
}).catch(err => {
|
|
73
|
-
renderConfirm({
|
|
74
|
-
show: false
|
|
75
|
-
});
|
|
76
|
-
reject(err);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
renderConfirm({
|
|
81
|
-
show: false
|
|
82
|
-
});
|
|
83
|
-
return resolve();
|
|
84
|
-
},
|
|
85
|
-
onReject: () => {
|
|
86
|
-
renderConfirm({
|
|
87
|
-
show: false
|
|
88
|
-
});
|
|
89
|
-
reject(new Error('Confirm(@jetbrains/ring-ui): null exception'));
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
renderConfirm(props);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
function hideConfirm() {
|
|
96
|
-
renderConfirm({
|
|
97
|
-
show: false
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export default confirm;
|
|
102
|
-
export { containerElement, hideConfirm };
|
package/dist/confirm.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { b as _defineProperty } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { PureComponent } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import Dialog from './dialog.js';
|
|
5
|
-
import { B as Button } from './_helpers/button.js';
|
|
6
|
-
import { Header as HeaderWrapper, Content as ContentWrapper } from './island.js';
|
|
7
|
-
import Panel from './panel.js';
|
|
8
|
-
import 'react-dom';
|
|
9
|
-
import 'classnames';
|
|
10
|
-
import '@jetbrains/icons/close';
|
|
11
|
-
import './_helpers/get-uid.js';
|
|
12
|
-
import './_helpers/data-tests.js';
|
|
13
|
-
import './shortcuts.js';
|
|
14
|
-
import 'combokeys';
|
|
15
|
-
import './_helpers/sniffer.js';
|
|
16
|
-
import 'sniffr';
|
|
17
|
-
import './tab-trap.js';
|
|
18
|
-
import './_helpers/dom.js';
|
|
19
|
-
import './_helpers/popup.target.js';
|
|
20
|
-
import 'scrollbar-width';
|
|
21
|
-
import './_helpers/linear-function.js';
|
|
22
|
-
import 'element-resize-detector';
|
|
23
|
-
import './_helpers/schedule-raf.js';
|
|
24
|
-
import 'focus-visible';
|
|
25
|
-
import '@jetbrains/icons/chevron-10px';
|
|
26
|
-
import './icon.js';
|
|
27
|
-
import 'util-deprecate';
|
|
28
|
-
import './_helpers/memoize.js';
|
|
29
|
-
import './_helpers/theme.js';
|
|
30
|
-
import './_helpers/clickableLink.js';
|
|
31
|
-
|
|
32
|
-
var modules_4c9c3a3a = {"unit":"8px","description":"confirm_description__af54475c"};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @name Confirm
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
class Confirm extends PureComponent {
|
|
39
|
-
constructor(...args) {
|
|
40
|
-
super(...args);
|
|
41
|
-
|
|
42
|
-
_defineProperty(this, "onEscPress", () => {
|
|
43
|
-
if (this.props.rejectOnEsc) {
|
|
44
|
-
this.props.onReject();
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
render() {
|
|
50
|
-
const {
|
|
51
|
-
show,
|
|
52
|
-
className,
|
|
53
|
-
inProgress,
|
|
54
|
-
cancelIsDefault,
|
|
55
|
-
text,
|
|
56
|
-
description,
|
|
57
|
-
confirmLabel,
|
|
58
|
-
rejectLabel,
|
|
59
|
-
onConfirm,
|
|
60
|
-
onReject
|
|
61
|
-
} = this.props;
|
|
62
|
-
return /*#__PURE__*/React.createElement(Dialog, {
|
|
63
|
-
className: className,
|
|
64
|
-
onEscPress: this.onEscPress,
|
|
65
|
-
show: show,
|
|
66
|
-
trapFocus: true,
|
|
67
|
-
"data-test": "ring-confirm"
|
|
68
|
-
}, text && /*#__PURE__*/React.createElement(HeaderWrapper, null, text), /*#__PURE__*/React.createElement(ContentWrapper, null, description && /*#__PURE__*/React.createElement("div", {
|
|
69
|
-
className: modules_4c9c3a3a.description
|
|
70
|
-
}, description)), /*#__PURE__*/React.createElement(Panel, null, /*#__PURE__*/React.createElement(Button, {
|
|
71
|
-
"data-test": "confirm-ok-button",
|
|
72
|
-
primary: !cancelIsDefault,
|
|
73
|
-
loader: inProgress,
|
|
74
|
-
disabled: inProgress,
|
|
75
|
-
onClick: onConfirm
|
|
76
|
-
}, confirmLabel), /*#__PURE__*/React.createElement(Button, {
|
|
77
|
-
"data-test": "confirm-reject-button",
|
|
78
|
-
onClick: onReject,
|
|
79
|
-
disabled: inProgress,
|
|
80
|
-
primary: cancelIsDefault
|
|
81
|
-
}, rejectLabel)));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
_defineProperty(Confirm, "propTypes", {
|
|
87
|
-
className: PropTypes.string,
|
|
88
|
-
text: PropTypes.string,
|
|
89
|
-
description: PropTypes.node,
|
|
90
|
-
show: PropTypes.bool,
|
|
91
|
-
rejectOnEsc: PropTypes.bool,
|
|
92
|
-
inProgress: PropTypes.bool,
|
|
93
|
-
cancelIsDefault: PropTypes.bool,
|
|
94
|
-
confirmLabel: PropTypes.string,
|
|
95
|
-
rejectLabel: PropTypes.string,
|
|
96
|
-
onConfirm: PropTypes.func,
|
|
97
|
-
onReject: PropTypes.func
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
_defineProperty(Confirm, "defaultProps", {
|
|
101
|
-
text: null,
|
|
102
|
-
description: null,
|
|
103
|
-
show: false,
|
|
104
|
-
rejectOnEsc: true,
|
|
105
|
-
inProgress: false,
|
|
106
|
-
cancelIsDefault: false,
|
|
107
|
-
confirmLabel: 'OK',
|
|
108
|
-
rejectLabel: 'Cancel',
|
|
109
|
-
onConfirm: () => {},
|
|
110
|
-
onReject: () => {}
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
export default Confirm;
|
package/dist/content-layout.js
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { b as _defineProperty, _ as _objectWithoutProperties, a as _extends } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { Component, cloneElement } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { Waypoint } from 'react-waypoint';
|
|
6
|
-
|
|
7
|
-
var modules_b8a9dd4f = {"unit":"8px","extra-small-screen-media":"(max-width:639px)","small-screen-media":"(min-width:640px) and (max-width:959px)","sidebarWidth":"240px","contentLayout":"contentLayout_contentLayout__0703f946","contentLayoutContent":"contentLayout_contentLayoutContent__0703f946","sidebarContainer":"contentLayout_sidebarContainer__0703f946","sidebarContainerRight":"contentLayout_sidebarContainerRight__0703f946","sidebar":"contentLayout_sidebar__0703f946","sidebarRight":"contentLayout_sidebarRight__0703f946","sidebarFixedTop":"contentLayout_sidebarFixedTop__0703f946","sidebarFixedBottom":"contentLayout_sidebarFixedBottom__0703f946","bottomMarker":"contentLayout_bottomMarker__0703f946","contentLayoutResponsive":"contentLayout_contentLayoutResponsive__0703f946"};
|
|
8
|
-
|
|
9
|
-
const ABOVE = 'above';
|
|
10
|
-
const INSIDE = 'inside';
|
|
11
|
-
class Sidebar extends Component {
|
|
12
|
-
constructor(...args) {
|
|
13
|
-
super(...args);
|
|
14
|
-
|
|
15
|
-
_defineProperty(this, "state", {
|
|
16
|
-
topIsOutside: true,
|
|
17
|
-
bottomIsOutside: true
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
_defineProperty(this, "handleTopWaypoint", ({
|
|
21
|
-
currentPosition
|
|
22
|
-
}) => {
|
|
23
|
-
this.setState({
|
|
24
|
-
topIsOutside: currentPosition === ABOVE
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
_defineProperty(this, "handleBottomWaypoint", ({
|
|
29
|
-
currentPosition,
|
|
30
|
-
waypointTop
|
|
31
|
-
}) => {
|
|
32
|
-
this.setState({
|
|
33
|
-
sidebarVisibleHeight: waypointTop,
|
|
34
|
-
bottomIsOutside: currentPosition !== INSIDE
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
_defineProperty(this, "sidebarRef", node => {
|
|
39
|
-
this.sidebarNode = node;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
shouldUseFixation() {
|
|
44
|
-
const {
|
|
45
|
-
contentNode
|
|
46
|
-
} = this.props;
|
|
47
|
-
const {
|
|
48
|
-
sidebarNode
|
|
49
|
-
} = this;
|
|
50
|
-
|
|
51
|
-
if (!contentNode || !sidebarNode) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return contentNode.offsetHeight >= sidebarNode.offsetHeight;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
shouldFixateBottom() {
|
|
59
|
-
const {
|
|
60
|
-
topIsOutside,
|
|
61
|
-
bottomIsOutside
|
|
62
|
-
} = this.state;
|
|
63
|
-
return !bottomIsOutside && topIsOutside && this.shouldUseFixation();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
render() {
|
|
67
|
-
const _this$props = this.props,
|
|
68
|
-
{
|
|
69
|
-
right,
|
|
70
|
-
children,
|
|
71
|
-
className,
|
|
72
|
-
containerClassName,
|
|
73
|
-
fixedClassName,
|
|
74
|
-
contentNode
|
|
75
|
-
} = _this$props,
|
|
76
|
-
restProps = _objectWithoutProperties(_this$props, ["right", "children", "className", "containerClassName", "fixedClassName", "contentNode"]);
|
|
77
|
-
|
|
78
|
-
const {
|
|
79
|
-
topIsOutside,
|
|
80
|
-
bottomIsOutside,
|
|
81
|
-
sidebarVisibleHeight
|
|
82
|
-
} = this.state;
|
|
83
|
-
const shouldFixateTop = bottomIsOutside && topIsOutside && this.shouldUseFixation();
|
|
84
|
-
const shouldFixateBottom = this.shouldFixateBottom();
|
|
85
|
-
const containerClasses = classNames(modules_b8a9dd4f.sidebarContainer, containerClassName, {
|
|
86
|
-
[modules_b8a9dd4f.sidebarContainerRight]: right
|
|
87
|
-
});
|
|
88
|
-
const classes = classNames(modules_b8a9dd4f.sidebar, className, {
|
|
89
|
-
[modules_b8a9dd4f.sidebarRight]: right,
|
|
90
|
-
[modules_b8a9dd4f.sidebarFixedTop]: shouldFixateTop,
|
|
91
|
-
[modules_b8a9dd4f.sidebarFixedBottom]: shouldFixateBottom,
|
|
92
|
-
[fixedClassName]: shouldFixateTop || shouldFixateBottom
|
|
93
|
-
});
|
|
94
|
-
const style = {
|
|
95
|
-
maxHeight: shouldFixateBottom && sidebarVisibleHeight ? `${sidebarVisibleHeight}px` : null
|
|
96
|
-
};
|
|
97
|
-
return /*#__PURE__*/React.createElement("aside", {
|
|
98
|
-
className: containerClasses,
|
|
99
|
-
ref: this.sidebarRef
|
|
100
|
-
}, /*#__PURE__*/React.createElement(Waypoint, {
|
|
101
|
-
onEnter: this.handleTopWaypoint,
|
|
102
|
-
onLeave: this.handleTopWaypoint
|
|
103
|
-
}), /*#__PURE__*/React.createElement("div", _extends({}, restProps, {
|
|
104
|
-
style: style,
|
|
105
|
-
className: classes
|
|
106
|
-
}), children), /*#__PURE__*/React.createElement("div", {
|
|
107
|
-
className: modules_b8a9dd4f.bottomMarker
|
|
108
|
-
}, /*#__PURE__*/React.createElement(Waypoint, {
|
|
109
|
-
onEnter: this.handleBottomWaypoint,
|
|
110
|
-
onLeave: this.handleBottomWaypoint
|
|
111
|
-
})));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
_defineProperty(Sidebar, "propTypes", {
|
|
117
|
-
right: PropTypes.bool,
|
|
118
|
-
children: PropTypes.node,
|
|
119
|
-
className: PropTypes.string,
|
|
120
|
-
containerClassName: PropTypes.string,
|
|
121
|
-
fixedClassName: PropTypes.string,
|
|
122
|
-
contentNode: PropTypes.object
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* @name Content Layout
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
class ContentLayout extends Component {
|
|
130
|
-
constructor(...args) {
|
|
131
|
-
super(...args);
|
|
132
|
-
|
|
133
|
-
_defineProperty(this, "state", {});
|
|
134
|
-
|
|
135
|
-
_defineProperty(this, "saveContentNode", contentNode => {
|
|
136
|
-
this.setState({
|
|
137
|
-
contentNode
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
render() {
|
|
143
|
-
const _this$props = this.props,
|
|
144
|
-
{
|
|
145
|
-
children,
|
|
146
|
-
className,
|
|
147
|
-
contentClassName,
|
|
148
|
-
responsive
|
|
149
|
-
} = _this$props,
|
|
150
|
-
restProps = _objectWithoutProperties(_this$props, ["children", "className", "contentClassName", "responsive"]);
|
|
151
|
-
|
|
152
|
-
const classes = classNames(modules_b8a9dd4f.contentLayout, className, {
|
|
153
|
-
[modules_b8a9dd4f.contentLayoutResponsive]: responsive
|
|
154
|
-
});
|
|
155
|
-
const contentClasses = classNames(modules_b8a9dd4f.contentLayoutContent, contentClassName);
|
|
156
|
-
const childrenArray = React.Children.toArray(children);
|
|
157
|
-
const sidebarChild = childrenArray.filter(child => child && child.type === Sidebar)[0];
|
|
158
|
-
const sidebar = sidebarChild && /*#__PURE__*/cloneElement(sidebarChild, {
|
|
159
|
-
contentNode: this.state.contentNode
|
|
160
|
-
});
|
|
161
|
-
const contentChildren = childrenArray.filter(child => child !== sidebarChild);
|
|
162
|
-
return /*#__PURE__*/React.createElement("div", _extends({}, restProps, {
|
|
163
|
-
className: classes
|
|
164
|
-
}), sidebar, /*#__PURE__*/React.createElement("main", {
|
|
165
|
-
className: contentClasses,
|
|
166
|
-
ref: this.saveContentNode
|
|
167
|
-
}, contentChildren));
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
_defineProperty(ContentLayout, "propTypes", {
|
|
173
|
-
children: PropTypes.node,
|
|
174
|
-
className: PropTypes.string,
|
|
175
|
-
contentClassName: PropTypes.string,
|
|
176
|
-
responsive: PropTypes.bool
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
_defineProperty(ContentLayout, "defaultProps", {
|
|
180
|
-
responsive: true
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
export default ContentLayout;
|
|
184
|
-
export { Sidebar };
|
package/dist/contenteditable.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { b as _defineProperty, c as _objectSpread2, _ as _objectWithoutProperties, a as _extends } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { Component } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { renderToStaticMarkup } from 'react-dom/server';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @name ContentEditable
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
function noop() {}
|
|
11
|
-
|
|
12
|
-
const commonPropTypes = {
|
|
13
|
-
disabled: PropTypes.bool,
|
|
14
|
-
tabIndex: PropTypes.number,
|
|
15
|
-
componentDidUpdate: PropTypes.func,
|
|
16
|
-
onComponentUpdate: PropTypes.func,
|
|
17
|
-
className: PropTypes.string,
|
|
18
|
-
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
class ContentEditableBase extends Component {
|
|
22
|
-
shouldComponentUpdate(nextProps) {
|
|
23
|
-
return nextProps.disabled !== this.props.disabled || nextProps.__html !== this.props.__html;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
componentDidUpdate(prevProps, prevState) {
|
|
27
|
-
this.props.onComponentUpdate(prevProps, prevState);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
render() {
|
|
31
|
-
const _this$props = this.props,
|
|
32
|
-
{
|
|
33
|
-
__html,
|
|
34
|
-
onComponentUpdate,
|
|
35
|
-
disabled,
|
|
36
|
-
tabIndex,
|
|
37
|
-
inputRef
|
|
38
|
-
} = _this$props,
|
|
39
|
-
props = _objectWithoutProperties(_this$props, ["__html", "onComponentUpdate", "disabled", "tabIndex", "inputRef"]);
|
|
40
|
-
|
|
41
|
-
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
42
|
-
ref: inputRef,
|
|
43
|
-
disabled: disabled,
|
|
44
|
-
role: "textbox",
|
|
45
|
-
tabIndex: disabled ? null : tabIndex,
|
|
46
|
-
contentEditable: !this.props.disabled,
|
|
47
|
-
dangerouslySetInnerHTML: {
|
|
48
|
-
__html
|
|
49
|
-
}
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
_defineProperty(ContentEditableBase, "propTypes", _objectSpread2(_objectSpread2({}, commonPropTypes), {}, {
|
|
56
|
-
__html: PropTypes.string
|
|
57
|
-
}));
|
|
58
|
-
|
|
59
|
-
_defineProperty(ContentEditableBase, "defaultProps", {
|
|
60
|
-
disabled: false,
|
|
61
|
-
tabIndex: 0,
|
|
62
|
-
onInput: noop,
|
|
63
|
-
onComponentUpdate: noop
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const ContentEditable = (_ref) => {
|
|
67
|
-
let {
|
|
68
|
-
children
|
|
69
|
-
} = _ref,
|
|
70
|
-
props = _objectWithoutProperties(_ref, ["children"]);
|
|
71
|
-
|
|
72
|
-
return /*#__PURE__*/React.createElement(ContentEditableBase, _extends({}, props, {
|
|
73
|
-
__html: renderToStaticMarkup(children)
|
|
74
|
-
}));
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
ContentEditable.propTypes = _objectSpread2(_objectSpread2({}, commonPropTypes), {}, {
|
|
78
|
-
children: PropTypes.node
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
export default ContentEditable;
|