@jetbrains/ring-ui 7.0.0-beta.9 → 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 +31 -24
- package/components/button/button.js +9 -9
- package/components/button/button__classes.d.ts +1 -1
- package/components/button/button__classes.js +3 -4
- package/components/button-group/button-group.css +25 -13
- package/components/button-group/caption.js +1 -1
- package/components/button-toolbar/button-toolbar.d.ts +1 -1
- package/components/button-toolbar/button-toolbar.js +2 -2
- package/components/caret/caret.js +8 -8
- package/components/checkbox/checkbox.css +8 -5
- package/components/checkbox/checkbox.js +1 -1
- package/components/clipboard/clipboard-fallback.js +2 -6
- package/components/clipboard/clipboard.js +5 -5
- package/components/code/code.d.ts +1 -1
- package/components/code/code.js +2 -2
- package/components/code/highlight.css +3 -1
- package/components/collapse/collapse-content.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.js +9 -10
- package/components/global/url.js +8 -8
- package/components/global/variables.css +1 -8
- package/components/global/variables_dark.css +0 -1
- package/components/grid/col.js +6 -6
- package/components/grid/grid.css +174 -173
- package/components/grid/grid.js +1 -1
- package/components/grid/row.js +13 -6
- package/components/group/group.js +1 -1
- package/components/header/header-icon.js +2 -2
- package/components/header/header.css +19 -15
- package/components/header/header.js +3 -5
- package/components/header/links.js +1 -1
- package/components/header/logo.js +1 -1
- package/components/header/profile.d.ts +2 -2
- package/components/header/profile.js +9 -9
- package/components/header/services-link.js +1 -1
- package/components/header/services.js +4 -5
- package/components/header/smart-profile.js +4 -3
- package/components/header/smart-services.js +9 -5
- package/components/header/tray.js +1 -1
- package/components/heading/heading.css +0 -1
- package/components/heading/heading.js +2 -2
- package/components/http/http.d.ts +3 -3
- package/components/http/http.js +25 -29
- package/components/http/http.mock.js +9 -6
- package/components/hub-source/hub-source.js +5 -7
- package/components/hub-source/hub-source__user.js +1 -1
- package/components/hub-source/hub-source__users-groups.js +6 -7
- package/components/i18n/README.md +3 -4
- package/components/i18n/i18n-context.js +2 -4
- package/components/icon/icon.js +7 -9
- package/components/icon/icon__svg.js +6 -6
- package/components/input/input.js +11 -14
- package/components/input-size/input-size.stories.js +42 -22
- package/components/island/adaptive-island-hoc.js +1 -1
- package/components/island/content.js +4 -6
- package/components/island/header.js +8 -10
- package/components/island/island.css +5 -5
- package/components/island/island.js +1 -1
- package/components/link/clickableLink.js +3 -1
- package/components/link/link.js +5 -3
- package/components/list/consts.js +1 -1
- package/components/list/list.d.ts +1 -1
- package/components/list/list.js +35 -57
- package/components/list/list__custom.js +3 -5
- package/components/list/list__hint.js +3 -1
- package/components/list/list__item.js +11 -9
- package/components/list/list__link.js +1 -1
- package/components/list/list__separator.js +2 -2
- package/components/list/list__title.js +7 -3
- package/components/list/list__users-groups-source.js +6 -8
- package/components/loader/loader.js +1 -1
- package/components/loader/loader__core.js +5 -5
- package/components/loader-inline/loader-inline.css +0 -3
- package/components/loader-inline/loader-inline.js +5 -7
- package/components/loader-screen/loader-screen.js +1 -1
- package/components/login-dialog/login-dialog.js +4 -4
- package/components/login-dialog/service.js +5 -5
- package/components/markdown/markdown.css +6 -6
- package/components/markdown/markdown.d.ts +2 -2
- package/components/markdown/markdown.js +4 -6
- package/components/message/message.css +2 -1
- package/components/message/message.js +30 -21
- package/components/old-browsers-message/old-browsers-message.js +2 -2
- package/components/old-browsers-message/white-list.js +2 -3
- package/components/pager/pager.js +28 -29
- package/components/permissions/permissions.js +8 -13
- package/components/permissions/permissions__cache.js +6 -7
- package/components/popup/popup.consts.js +8 -2
- package/components/popup/popup.js +27 -33
- package/components/popup/popup.target.js +4 -4
- package/components/popup/position.js +21 -28
- package/components/popup-menu/popup-menu.js +1 -1
- package/components/progress-bar/progress-bar.css +10 -8
- package/components/progress-bar/progress-bar.d.ts +2 -2
- package/components/progress-bar/progress-bar.js +2 -2
- package/components/query-assist/query-assist.css +0 -3
- package/components/query-assist/query-assist.js +73 -84
- package/components/query-assist/query-assist__suggestions.js +10 -9
- package/components/radio/radio.css +6 -2
- package/components/radio/radio.js +1 -3
- package/components/scrollable-section/scrollable-section.css +5 -6
- package/components/scrollable-section/scrollable-section.js +1 -1
- package/components/select/select.css +5 -5
- package/components/select/select.d.ts +1 -1
- package/components/select/select.js +96 -110
- package/components/select/select__filter.js +1 -1
- package/components/select/select__popup.js +40 -51
- package/components/shortcuts/core.js +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 +1 -2
- package/components/table/header.js +10 -12
- package/components/table/multitable.js +5 -3
- package/components/table/row.d.ts +0 -1
- package/components/table/row.js +20 -27
- package/components/table/selection-adapter.js +1 -1
- package/components/table/selection-shortcuts-hoc.js +2 -2
- package/components/table/selection.d.ts +2 -3
- package/components/table/selection.js +4 -5
- package/components/table/simple-table.js +4 -4
- package/components/table/smart-table.js +5 -5
- package/components/table/table.css +8 -9
- package/components/table/table.d.ts +0 -1
- package/components/table/table.js +22 -23
- package/components/table/table.stories.json +45 -16
- package/components/tabs/collapsible-more.d.ts +1 -1
- package/components/tabs/collapsible-more.js +13 -16
- package/components/tabs/collapsible-tab.js +2 -2
- package/components/tabs/collapsible-tabs.d.ts +2 -2
- package/components/tabs/collapsible-tabs.js +13 -22
- package/components/tabs/dumb-tabs.js +6 -9
- package/components/tabs/smart-tabs.js +4 -4
- package/components/tabs/tab-link.js +1 -3
- package/components/tabs/tabs.css +7 -9
- package/components/tag/tag.css +6 -6
- package/components/tag/tag.d.ts +1 -1
- package/components/tag/tag.js +9 -12
- package/components/tags-input/tags-input.js +15 -19
- package/components/tags-list/tags-list.d.ts +2 -2
- package/components/tags-list/tags-list.js +6 -5
- package/components/text/text.js +5 -3
- package/components/toggle/toggle.css +12 -10
- package/components/toggle/toggle.d.ts +2 -2
- package/components/toggle/toggle.js +4 -3
- package/components/tooltip/tooltip.js +13 -8
- package/components/user-agreement/service.js +15 -13
- package/components/user-agreement/user-agreement.js +3 -5
- package/components/user-card/card.js +10 -9
- package/components/user-card/smart-user-card-tooltip.js +5 -7
- package/components/user-card/tooltip.js +4 -4
- package/components/user-card/user-card.css +4 -0
- package/jslint-xml.js +20 -19
- package/package.json +59 -50
- package/postcss.config.js +3 -4
- package/typings.d.ts +2 -4
- package/webpack.config.js +20 -25
- package/components/badge/badge.css +0 -42
- package/components/badge/badge.d.ts +0 -14
- package/components/badge/badge.js +0 -29
- package/components/island-legacy/content-legacy.d.ts +0 -5
- package/components/island-legacy/content-legacy.js +0 -12
- package/components/island-legacy/header-legacy.d.ts +0 -5
- package/components/island-legacy/header-legacy.js +0 -14
- package/components/island-legacy/island-legacy.css +0 -98
- package/components/island-legacy/island-legacy.d.ts +0 -7
- package/components/island-legacy/island-legacy.js +0 -14
- package/components/table-legacy/table-legacy.css +0 -346
- package/components/table-legacy/table-legacy__toolbar.css +0 -25
|
@@ -18,7 +18,7 @@ class MonthName extends PureComponent {
|
|
|
18
18
|
render() {
|
|
19
19
|
const { month, locale } = this.props;
|
|
20
20
|
return (<button type="button" className={classNames(styles.monthName, {
|
|
21
|
-
[styles.today]: isThisMonth(month)
|
|
21
|
+
[styles.today]: isThisMonth(month),
|
|
22
22
|
})} onClick={this.handleClick}>
|
|
23
23
|
{format(month, 'LLL', { locale })}
|
|
24
24
|
</button>);
|
|
@@ -35,16 +35,14 @@ export default function MonthNames(props) {
|
|
|
35
35
|
let top = 0;
|
|
36
36
|
let bottom = 0;
|
|
37
37
|
if (props.currentRange) {
|
|
38
|
-
[top, bottom] = props.currentRange.
|
|
39
|
-
map(date => Math.floor(pxToDate.x(Number(date))));
|
|
38
|
+
[top, bottom] = props.currentRange.map(date => Math.floor(pxToDate.x(Number(date))));
|
|
40
39
|
}
|
|
41
40
|
return (<div className={styles.monthNames}>
|
|
42
41
|
{months.map(month => (<MonthName key={+month} month={month} onScrollChange={props.onScrollChange} locale={locale}/>))}
|
|
43
|
-
{props.currentRange &&
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}}/>)}
|
|
42
|
+
{props.currentRange && (<div className={styles.range} style={{
|
|
43
|
+
top: top - 1,
|
|
44
|
+
height: bottom + 1 - (top - 1),
|
|
45
|
+
}}/>)}
|
|
48
46
|
<MonthSlider {...props} pxToDate={pxToDate}/>
|
|
49
47
|
</div>);
|
|
50
48
|
}
|
|
@@ -9,7 +9,7 @@ import styles from './date-picker.css';
|
|
|
9
9
|
const COVERYEARS = 3;
|
|
10
10
|
export default class MonthSlider extends PureComponent {
|
|
11
11
|
state = {
|
|
12
|
-
dragging: false
|
|
12
|
+
dragging: false,
|
|
13
13
|
};
|
|
14
14
|
componentDidUpdate(prevProps, prevState) {
|
|
15
15
|
if (this.state.dragging && !prevState.dragging) {
|
|
@@ -40,7 +40,7 @@ export default class MonthSlider extends PureComponent {
|
|
|
40
40
|
const classes = classNames(styles.monthSlider, { [styles.dragging]: this.state.dragging });
|
|
41
41
|
return (<div>
|
|
42
42
|
{years.map(date => (<button type="button" key={+date} className={classes} style={{
|
|
43
|
-
top: Math.floor(this.props.pxToDate.x(Number(date)) - units.cellSize)
|
|
43
|
+
top: Math.floor(this.props.pxToDate.x(Number(date)) - units.cellSize),
|
|
44
44
|
}} onMouseDown={this.onMouseDown}/>))}
|
|
45
45
|
</div>);
|
|
46
46
|
}
|
|
@@ -21,9 +21,7 @@ export default function Month(props) {
|
|
|
21
21
|
day = addDays(day, 1);
|
|
22
22
|
}
|
|
23
23
|
return (<div className={styles.month}>
|
|
24
|
-
<span className={styles.monthTitle}>
|
|
25
|
-
{format(props.month, 'LLLL', { locale })}
|
|
26
|
-
</span>
|
|
24
|
+
<span className={styles.monthTitle}>{format(props.month, 'LLLL', { locale })}</span>
|
|
27
25
|
{days.map(date => (<Day {...props} day={date} empty={date < start} key={+date}/>))}
|
|
28
26
|
</div>);
|
|
29
27
|
}
|
|
@@ -61,10 +61,7 @@ export default function Months(props) {
|
|
|
61
61
|
date = pxToDate.y(offset) + (dy - offset) * scrollSpeed(months[1]);
|
|
62
62
|
}
|
|
63
63
|
else if (dy > bottomOffset) {
|
|
64
|
-
date =
|
|
65
|
-
pxToDate.y(bottomOffset) +
|
|
66
|
-
(dy - bottomOffset) *
|
|
67
|
-
scrollSpeed(months[MONTHSBACK + 1]);
|
|
64
|
+
date = pxToDate.y(bottomOffset) + (dy - bottomOffset) * scrollSpeed(months[MONTHSBACK + 1]);
|
|
68
65
|
}
|
|
69
66
|
else {
|
|
70
67
|
date = pxToDate.y(dy);
|
|
@@ -86,8 +83,7 @@ export default function Months(props) {
|
|
|
86
83
|
}, [handleWheel]);
|
|
87
84
|
return (<div className={styles.months} ref={componentRef}>
|
|
88
85
|
<div style={{
|
|
89
|
-
top: Math.
|
|
90
|
-
floor(calHeight * HALF - monthHeight(months[0]) - monthHeight(months[1]) + offset)
|
|
86
|
+
top: Math.floor(calHeight * HALF - monthHeight(months[0]) - monthHeight(months[1]) + offset),
|
|
91
87
|
}} className={styles.days}>
|
|
92
88
|
{months.map(date => (<Month {...props} month={date} key={+date}/>))}
|
|
93
89
|
</div>
|
|
@@ -6,12 +6,11 @@ import { startOfDay } from 'date-fns/startOfDay';
|
|
|
6
6
|
import { getWeekStartsOn, shiftWeekArray, weekdays } from './consts';
|
|
7
7
|
import styles from './date-picker.css';
|
|
8
8
|
export default function Weekdays(props) {
|
|
9
|
-
const days = shiftWeekArray(Object.values(weekdays), getWeekStartsOn(props.locale)).
|
|
10
|
-
map(value => startOfDay(setDay(new Date(), value)));
|
|
9
|
+
const days = shiftWeekArray(Object.values(weekdays), getWeekStartsOn(props.locale)).map(value => startOfDay(setDay(new Date(), value)));
|
|
11
10
|
const { locale } = props;
|
|
12
11
|
return (<div className={styles.weekdays}>
|
|
13
12
|
{days.map(day => (<span className={classNames(styles.weekday, {
|
|
14
|
-
[styles.weekend]: [weekdays.SA, weekdays.SU].includes(getDay(day))
|
|
13
|
+
[styles.weekend]: [weekdays.SA, weekdays.SU].includes(getDay(day)),
|
|
15
14
|
})} key={+day}>
|
|
16
15
|
{format(day, 'EEEEEE', { locale })}
|
|
17
16
|
</span>))}
|
|
@@ -46,7 +46,7 @@ export default class Years extends PureComponent {
|
|
|
46
46
|
e.preventDefault();
|
|
47
47
|
const newScrollDate = linearFunction(0, Number(date), yearDuration / yearHeight).y(e.deltaY);
|
|
48
48
|
this.setState({
|
|
49
|
-
scrollDate: newScrollDate
|
|
49
|
+
scrollDate: newScrollDate,
|
|
50
50
|
});
|
|
51
51
|
if (scrollTO) {
|
|
52
52
|
window.clearTimeout(scrollTO);
|
|
@@ -66,11 +66,11 @@ export default class Years extends PureComponent {
|
|
|
66
66
|
const pxToDate = linearFunction(0, Number(years[0]), yearDuration / yearHeight);
|
|
67
67
|
return (<div className={styles.years} ref={this.componentRef} style={{
|
|
68
68
|
transition: this.stoppedScrolling ? 'top .2s ease-out 0s' : 'none',
|
|
69
|
-
top: Math.floor(calHeight * HALF - pxToDate.x(Number(date)))
|
|
69
|
+
top: Math.floor(calHeight * HALF - pxToDate.x(Number(date))),
|
|
70
70
|
}}>
|
|
71
71
|
{years.map(item => (<button type="button" key={+item} className={classNames(styles.year, {
|
|
72
72
|
[styles.currentYear]: isSameYear(item, date),
|
|
73
|
-
[styles.today]: isThisYear(item)
|
|
73
|
+
[styles.today]: isThisYear(item),
|
|
74
74
|
})} onClick={function handleClick() {
|
|
75
75
|
onScrollChange(Number(setYear(scrollDate, getYear(item))));
|
|
76
76
|
}}>
|
|
@@ -20,6 +20,7 @@ export interface DialogProps extends Partial<TabTrapProps> {
|
|
|
20
20
|
dense?: boolean | null | undefined;
|
|
21
21
|
native?: boolean;
|
|
22
22
|
modal?: boolean;
|
|
23
|
+
preventBodyScroll?: boolean;
|
|
23
24
|
}
|
|
24
25
|
export default class Dialog extends PureComponent<DialogProps> {
|
|
25
26
|
static defaultProps: Partial<DialogProps>;
|
|
@@ -28,10 +28,11 @@ export default class Dialog extends PureComponent {
|
|
|
28
28
|
shortcutOptions: { modal: false },
|
|
29
29
|
trapFocus: false,
|
|
30
30
|
autoFocusFirst: true,
|
|
31
|
-
modal: true
|
|
31
|
+
modal: true,
|
|
32
|
+
preventBodyScroll: true,
|
|
32
33
|
};
|
|
33
34
|
state = {
|
|
34
|
-
shortcutsScope: getUID('ring-dialog-')
|
|
35
|
+
shortcutsScope: getUID('ring-dialog-'),
|
|
35
36
|
};
|
|
36
37
|
componentDidMount() {
|
|
37
38
|
const { show, native } = this.props;
|
|
@@ -72,6 +73,9 @@ export default class Dialog extends PureComponent {
|
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
toggleScrollPreventer() {
|
|
76
|
+
if (!this.props.preventBodyScroll) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
75
79
|
if (this.props.show) {
|
|
76
80
|
this.scrollPreventer.prevent();
|
|
77
81
|
}
|
|
@@ -95,7 +99,7 @@ export default class Dialog extends PureComponent {
|
|
|
95
99
|
}
|
|
96
100
|
};
|
|
97
101
|
return {
|
|
98
|
-
esc: onEscape
|
|
102
|
+
esc: onEscape,
|
|
99
103
|
};
|
|
100
104
|
};
|
|
101
105
|
dialog;
|
|
@@ -104,7 +108,7 @@ export default class Dialog extends PureComponent {
|
|
|
104
108
|
};
|
|
105
109
|
nativeDialog = createRef();
|
|
106
110
|
render() {
|
|
107
|
-
const { show, showCloseButton, onOverlayClick, onCloseAttempt, onEscPress, onCloseClick, children, className, contentClassName, trapFocus, 'data-test': dataTest, closeButtonInside, portalTarget, label, closeButtonTitle, dense, shortcutOptions, native, modal, ...restProps } = this.props;
|
|
111
|
+
const { show, showCloseButton, onOverlayClick, onCloseAttempt, onEscPress, onCloseClick, children, className, contentClassName, trapFocus, 'data-test': dataTest, closeButtonInside, portalTarget, label, closeButtonTitle, dense, shortcutOptions, native, modal, preventBodyScroll, ...restProps } = this.props;
|
|
108
112
|
const classes = classNames(styles.container, className);
|
|
109
113
|
const shortcutsMap = this.getShortcutsMap();
|
|
110
114
|
const content = (<>
|
|
@@ -115,26 +119,29 @@ export default class Dialog extends PureComponent {
|
|
|
115
119
|
<div className={styles.innerContainer}>
|
|
116
120
|
<AdaptiveIsland className={classNames(styles.content, contentClassName, { [styles.dense]: dense })} data-test="ring-dialog" role="dialog" aria-label={label}>
|
|
117
121
|
{children}
|
|
118
|
-
{showCloseButton &&
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
})} iconClassName={styles.closeIcon} onClick={this.onCloseClick} title={closeButtonTitle} aria-label={closeButtonTitle || 'close dialog'}/>)}
|
|
122
|
+
{showCloseButton && (<Button icon={closeIcon} data-test="ring-dialog-close-button" className={classNames(styles.closeButton, {
|
|
123
|
+
[styles.closeButtonOutside]: !closeButtonInside,
|
|
124
|
+
[styles.closeButtonInside]: closeButtonInside,
|
|
125
|
+
})} iconClassName={styles.closeIcon} onClick={this.onCloseClick} title={closeButtonTitle} aria-label={closeButtonTitle || 'close dialog'}/>)}
|
|
123
126
|
</AdaptiveIsland>
|
|
124
127
|
</div>
|
|
125
128
|
</>);
|
|
126
129
|
if (native) {
|
|
127
130
|
return (<dialog className={classNames(styles.nativeDialog, className)} ref={this.nativeDialog}>
|
|
128
131
|
<PopupTarget id={this.uid} className={styles.popupTarget}>
|
|
129
|
-
{target => <>
|
|
132
|
+
{target => (<>
|
|
133
|
+
{content}
|
|
134
|
+
{target}
|
|
135
|
+
</>)}
|
|
130
136
|
</PopupTarget>
|
|
131
137
|
</dialog>);
|
|
132
138
|
}
|
|
133
|
-
return show &&
|
|
134
|
-
|
|
139
|
+
return (show &&
|
|
140
|
+
createPortal(<PopupTarget id={this.uid} className={styles.popupTarget}>
|
|
141
|
+
{target => (<TabTrap trapDisabled={!trapFocus} data-test={dataTests('ring-dialog-container', dataTest)} ref={this.dialogRef} className={classes} role="presentation" {...restProps}>
|
|
135
142
|
{content}
|
|
136
143
|
{target}
|
|
137
144
|
</TabTrap>)}
|
|
138
|
-
|
|
145
|
+
</PopupTarget>, portalTarget instanceof HTMLElement ? portalTarget : document.body));
|
|
139
146
|
}
|
|
140
147
|
}
|
|
@@ -37,7 +37,7 @@ export const preventerFactory = (key) => {
|
|
|
37
37
|
const preventerKey = key || Math.random();
|
|
38
38
|
return {
|
|
39
39
|
prevent: () => prevent(preventerKey),
|
|
40
|
-
reset: () => reset(preventerKey)
|
|
40
|
+
reset: () => reset(preventerKey),
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
export default preventerFactory('default-preventer');
|
|
@@ -26,8 +26,8 @@ export interface DropdownProps extends Omit<HTMLAttributes<HTMLElement>, 'childr
|
|
|
26
26
|
hoverMode: boolean;
|
|
27
27
|
hoverShowTimeOut: number;
|
|
28
28
|
hoverHideTimeOut: number;
|
|
29
|
-
onShow: (
|
|
30
|
-
onHide: (
|
|
29
|
+
onShow: () => void;
|
|
30
|
+
onHide: () => void;
|
|
31
31
|
activeClassName?: string | null | undefined;
|
|
32
32
|
'data-test'?: string | null | undefined;
|
|
33
33
|
}
|
|
@@ -19,11 +19,11 @@ export default class Dropdown extends Component {
|
|
|
19
19
|
onShow: () => { },
|
|
20
20
|
onHide: () => { },
|
|
21
21
|
onMouseEnter: () => { },
|
|
22
|
-
onMouseLeave: () => { }
|
|
22
|
+
onMouseLeave: () => { },
|
|
23
23
|
};
|
|
24
24
|
state = {
|
|
25
25
|
show: this.props.initShown,
|
|
26
|
-
pinned: false
|
|
26
|
+
pinned: false,
|
|
27
27
|
};
|
|
28
28
|
onClick = () => {
|
|
29
29
|
if (this.props.disabled) {
|
|
@@ -99,13 +99,13 @@ export default class Dropdown extends Component {
|
|
|
99
99
|
const { show, pinned } = this.state;
|
|
100
100
|
const { initShown, onShow, onHide, hoverShowTimeOut, hoverHideTimeOut, children, anchor, className, activeClassName, hoverMode, clickMode, 'data-test': dataTest, disabled, ...restProps } = this.props;
|
|
101
101
|
const classes = classNames(styles.dropdown, className, {
|
|
102
|
-
[activeClassName ?? '']: activeClassName != null && show
|
|
102
|
+
[activeClassName ?? '']: activeClassName != null && show,
|
|
103
103
|
});
|
|
104
104
|
let anchorElement;
|
|
105
105
|
const active = hoverMode ? pinned : show;
|
|
106
106
|
switch (typeof anchor) {
|
|
107
107
|
case 'string':
|
|
108
|
-
anchorElement =
|
|
108
|
+
anchorElement = <Anchor active={active}>{anchor}</Anchor>;
|
|
109
109
|
break;
|
|
110
110
|
case 'function':
|
|
111
111
|
anchorElement = anchor({ active: show, pinned });
|
|
@@ -123,7 +123,7 @@ export default class Dropdown extends Component {
|
|
|
123
123
|
onCloseAttempt: this.onChildCloseAttempt,
|
|
124
124
|
onMouseDown: hoverMode ? this.handlePopupInteraction : undefined,
|
|
125
125
|
onContextMenu: hoverMode ? this.handlePopupInteraction : undefined,
|
|
126
|
-
dontCloseOnAnchorClick: true
|
|
126
|
+
dontCloseOnAnchorClick: true,
|
|
127
127
|
};
|
|
128
128
|
return (<div data-test={dataTests('ring-dropdown', dataTest)} {...restProps} onClick={clickMode ? this.onClick : undefined}
|
|
129
129
|
// anchorElement should be a `button` or an `a`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef, useMemo, cloneElement } from 'react';
|
|
1
|
+
import { forwardRef, useMemo, cloneElement, } from 'react';
|
|
2
2
|
import List, { ActiveItemContext } from '../list/list';
|
|
3
3
|
import Dropdown from '../dropdown/dropdown';
|
|
4
4
|
import PopupMenu from '../popup-menu/popup-menu';
|
|
@@ -10,20 +10,20 @@ function DropdownAnchorWrapper({ anchor, pinned, active, activeListItemId, listI
|
|
|
10
10
|
const anchorAriaProps = useMemo(() => ({
|
|
11
11
|
...(listId ? { 'aria-haspopup': true } : {}),
|
|
12
12
|
...(activeListItemId ? { 'aria-activedescendant': activeListItemId, 'aria-owns': listId } : {}),
|
|
13
|
-
...(active ? { 'aria-expanded': true } : {})
|
|
13
|
+
...(active ? { 'aria-expanded': true } : {}),
|
|
14
14
|
}), [active, activeListItemId, listId]);
|
|
15
15
|
const anchorProps = useMemo(() => ({ active, pinned, ...restProps, ...anchorAriaProps }), [pinned, active, restProps, anchorAriaProps]);
|
|
16
16
|
const anchorComponentProps = useMemo(() => ({ ...anchorProps, pinned: `${anchorProps.pinned}` }), [anchorProps]);
|
|
17
17
|
if (typeof anchor === 'string') {
|
|
18
|
-
return
|
|
18
|
+
return <Anchor {...anchorComponentProps}>{anchor}</Anchor>;
|
|
19
19
|
}
|
|
20
20
|
if (typeof anchor === 'function') {
|
|
21
|
-
return anchor(
|
|
21
|
+
return anchor({ active, pinned, ...restProps }, anchorAriaProps);
|
|
22
22
|
}
|
|
23
23
|
if (!isArray(anchor)) {
|
|
24
24
|
return cloneElement(anchor, typeof anchor.type === 'string' ? anchorAriaProps : anchorComponentProps);
|
|
25
25
|
}
|
|
26
|
-
return
|
|
26
|
+
return <div {...anchorAriaProps}>{anchor}</div>;
|
|
27
27
|
}
|
|
28
28
|
const DropdownMenu = forwardRef(function DropdownMenu({ id, anchor, ariaLabel, data, onSelect, menuProps, ...restDropdownProps }, forwardedRef) {
|
|
29
29
|
const listId = useMemo(() => id || getUID('dropdown-menu-list'), [id]);
|
|
@@ -146,10 +146,13 @@
|
|
|
146
146
|
content: "";
|
|
147
147
|
pointer-events: none;
|
|
148
148
|
|
|
149
|
-
background: linear-gradient(
|
|
149
|
+
background: linear-gradient(
|
|
150
|
+
to bottom,
|
|
151
|
+
rgba(var(--ring-content-background-components), 0),
|
|
152
|
+
rgba(var(--ring-content-background-components), 1)
|
|
153
|
+
);
|
|
150
154
|
}
|
|
151
155
|
|
|
152
|
-
|
|
153
156
|
.textareaWrapper {
|
|
154
157
|
position: relative;
|
|
155
158
|
|
|
@@ -14,7 +14,7 @@ function noop() { }
|
|
|
14
14
|
export const EditableHeading = (props) => {
|
|
15
15
|
const { level = Levels.H1, className, headingClassName, inputClassName, children, isEditing = false, isSavingPossible = false, isSaving = false, embedded = false, size = Size.L, onEdit = noop, onSave = noop, onCancel = noop, autoFocus = true, 'data-test': dataTest, error, disabled, multiline = false, renderMenu = () => null, onFocus, onBlur, onChange, onScroll, maxInputRows, translations = {
|
|
16
16
|
save: 'Save',
|
|
17
|
-
cancel: 'Cancel'
|
|
17
|
+
cancel: 'Cancel',
|
|
18
18
|
}, ...restProps } = props;
|
|
19
19
|
const [shortcutsScope] = React.useState(getUID('ring-editable-heading-'));
|
|
20
20
|
const [isInFocus, setIsInFocus] = React.useState(false);
|
|
@@ -43,7 +43,7 @@ export const EditableHeading = (props) => {
|
|
|
43
43
|
[styles.error]: hasError,
|
|
44
44
|
[styles.disabled]: disabled,
|
|
45
45
|
[styles.multiline]: multiline,
|
|
46
|
-
[styles.selectionMode]: isInSelectionMode
|
|
46
|
+
[styles.selectionMode]: isInSelectionMode,
|
|
47
47
|
});
|
|
48
48
|
const headingClasses = classNames(styles.heading, headingClassName, styles[`size${size}`]);
|
|
49
49
|
const inputClasses = classNames('ring-js-shortcuts', styles.input, styles.textarea, { [styles.textareaNotOverflow]: !isOverflow }, inputStyles[`size${size}`], styles[`level${level}`], inputClassName);
|
|
@@ -112,31 +112,33 @@ export const EditableHeading = (props) => {
|
|
|
112
112
|
}, [onMouseMove, onMouseUp]);
|
|
113
113
|
return (<>
|
|
114
114
|
<div className={classes}>
|
|
115
|
-
{!disabled && isEditing
|
|
116
|
-
|
|
117
|
-
<Shortcuts map={shortcutsMap} scope={shortcutsScope} disabled={isShortcutsDisabled}/>
|
|
115
|
+
{!disabled && isEditing ? (<>
|
|
116
|
+
<Shortcuts map={shortcutsMap} scope={shortcutsScope} disabled={isShortcutsDisabled}/>
|
|
118
117
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
</button>)}
|
|
118
|
+
{!multiline ? (<input className={inputClasses} value={children} autoFocus={autoFocus} data-test={dataTest} disabled={isSaving} onChange={onChange} {...restProps} onFocus={onInputFocus} onBlur={onInputBlur}/>) : (<div className={classNames(styles.textareaWrapper, inputStyles[`size${size}`])}>
|
|
119
|
+
<textarea ref={textAreaRef} className={inputClasses} value={children} autoFocus={autoFocus} data-test={dataTest} disabled={isSaving} onChange={onInputChange} {...restProps} onFocus={onInputFocus} onBlur={onInputBlur} onScroll={onInputScroll} style={{ maxHeight: maxInputRows ? `${maxInputRows}lh` : '' }}/>
|
|
120
|
+
{!isScrolledToBottom && <div className={styles.textareaFade}/>}
|
|
121
|
+
</div>)}
|
|
122
|
+
</>) : (<button type="button" className={styles.headingWrapperButton} onMouseDown={onHeadingMouseDown}>
|
|
123
|
+
<Heading className={headingClasses} level={level} data-test={dataTest}>
|
|
124
|
+
{children}
|
|
125
|
+
</Heading>
|
|
126
|
+
</button>)}
|
|
129
127
|
|
|
130
|
-
{!isEditing &&
|
|
128
|
+
{!isEditing && renderMenu()}
|
|
131
129
|
|
|
132
130
|
{isEditing && !embedded && (<>
|
|
133
|
-
<Button className={styles.button} primary disabled={isSaveDisabled} loader={isSaving} onClick={onSave}>
|
|
131
|
+
<Button className={styles.button} primary disabled={isSaveDisabled} loader={isSaving} onClick={onSave}>
|
|
132
|
+
{translations.save}
|
|
133
|
+
</Button>
|
|
134
134
|
|
|
135
|
-
<Button className={styles.button} disabled={isCancelDisabled} onClick={onCancel}>
|
|
135
|
+
<Button className={styles.button} disabled={isCancelDisabled} onClick={onCancel}>
|
|
136
|
+
{translations.cancel}
|
|
137
|
+
</Button>
|
|
136
138
|
</>)}
|
|
137
139
|
</div>
|
|
138
140
|
|
|
139
|
-
{isEditing && error &&
|
|
141
|
+
{isEditing && error && <div className={classNames(styles.errorText, inputStyles[`size${size}`])}>{error}</div>}
|
|
140
142
|
</>);
|
|
141
143
|
};
|
|
142
144
|
export default React.memo(EditableHeading);
|
|
@@ -10,7 +10,7 @@ export default class ErrorBubble extends PureComponent {
|
|
|
10
10
|
render() {
|
|
11
11
|
const { children, className, ...restProps } = this.props;
|
|
12
12
|
const errorBubbleClasses = classNames(styles.errorBubble, className);
|
|
13
|
-
return (<div className={styles.errorBubbleWrapper}>
|
|
13
|
+
return (<div className={styles.errorBubbleWrapper} data-test="ring-error-bubble-wrapper">
|
|
14
14
|
{Children.map(children, (child) => cloneElement(child, { ...child.props, ...restProps }))}
|
|
15
15
|
{restProps.error && (<Popup trapFocus={false} className={styles.errorBubblePopup} hidden={false} attached={false} directions={[Directions.RIGHT_CENTER, Directions.RIGHT_BOTTOM, Directions.RIGHT_TOP]}>
|
|
16
16
|
<div className={errorBubbleClasses} data-test="ring-error-bubble">
|
|
@@ -12,14 +12,12 @@ export default class ErrorMessage extends Component {
|
|
|
12
12
|
const { className, icon, code, message, description, children, 'data-test': dataTest } = this.props;
|
|
13
13
|
const classes = classNames(styles.errorMessage, className);
|
|
14
14
|
return (<div className={classes} data-test={dataTests('ring-error-message', dataTest)}>
|
|
15
|
-
{icon &&
|
|
15
|
+
{icon && <Icon className={styles.icon} glyph={icon} size={Size.Size64} suppressSizeWarning/>}
|
|
16
16
|
<div className={styles.content}>
|
|
17
17
|
<div className={styles.title} data-test="ring-error-message-title">
|
|
18
18
|
{code && `${code}:`} {message}
|
|
19
19
|
</div>
|
|
20
|
-
{description &&
|
|
21
|
-
{description}
|
|
22
|
-
</div>)}
|
|
20
|
+
{description && <div className={styles.description}>{description}</div>}
|
|
23
21
|
{children}
|
|
24
22
|
</div>
|
|
25
23
|
</div>);
|
|
@@ -9,12 +9,10 @@ const FooterColumn = memo(function FooterColumn({ position, children }) {
|
|
|
9
9
|
const classes = classNames({
|
|
10
10
|
[styles.columnLeft]: position === 'left',
|
|
11
11
|
[styles.columnCenter]: position === 'center',
|
|
12
|
-
[styles.columnRight]: position === 'right'
|
|
12
|
+
[styles.columnRight]: position === 'right',
|
|
13
13
|
});
|
|
14
14
|
return (<div className={classes}>
|
|
15
|
-
<ul className={styles.columnItem}>
|
|
16
|
-
{children}
|
|
17
|
-
</ul>
|
|
15
|
+
<ul className={styles.columnItem}>{children}</ul>
|
|
18
16
|
</div>);
|
|
19
17
|
});
|
|
20
18
|
/**
|
|
@@ -23,7 +21,7 @@ const FooterColumn = memo(function FooterColumn({ position, children }) {
|
|
|
23
21
|
* @returns {string}
|
|
24
22
|
*/
|
|
25
23
|
export function copyright(year) {
|
|
26
|
-
const currentYear =
|
|
24
|
+
const currentYear = new Date().getUTCFullYear();
|
|
27
25
|
const ndash = '–';
|
|
28
26
|
let ret = 'Copyright © ';
|
|
29
27
|
if (year >= currentYear) {
|
|
@@ -47,13 +45,13 @@ const FooterLine = memo(function FooterLine(props) {
|
|
|
47
45
|
}
|
|
48
46
|
const element = (item.copyright ? copyright(item.copyright) : '') + (item.label || item);
|
|
49
47
|
if (item.url) {
|
|
50
|
-
return (<Link href={item.url} target={item.target} key={item.url + item.title} title={item.title}>
|
|
48
|
+
return (<Link href={item.url} target={item.target} key={item.url + item.title} title={item.title}>
|
|
49
|
+
{element}
|
|
50
|
+
</Link>);
|
|
51
51
|
}
|
|
52
52
|
return element;
|
|
53
53
|
}
|
|
54
|
-
return
|
|
55
|
-
{items.map(renderItem)}
|
|
56
|
-
</li>);
|
|
54
|
+
return <li className={styles.line}>{items.map(renderItem)}</li>;
|
|
57
55
|
});
|
|
58
56
|
const Footer = memo(function Footer({ floating, className, left, center, right }) {
|
|
59
57
|
function content(elements, position) {
|
|
@@ -67,12 +65,10 @@ const Footer = memo(function Footer({ floating, className, left, center, right }
|
|
|
67
65
|
</FooterColumn>);
|
|
68
66
|
}
|
|
69
67
|
const classes = classNames(styles.footer, className, {
|
|
70
|
-
[styles.footerFloating]: floating
|
|
68
|
+
[styles.footerFloating]: floating,
|
|
71
69
|
});
|
|
72
|
-
return (<footer className={classes} data-test="ring-footer">
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
content(right, 'right')
|
|
76
|
-
]}</footer>);
|
|
70
|
+
return (<footer className={classes} data-test="ring-footer">
|
|
71
|
+
{[content(left, 'left'), content(center, 'center'), content(right, 'right')]}
|
|
72
|
+
</footer>);
|
|
77
73
|
});
|
|
78
74
|
export default Footer;
|