@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
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import angular from 'angular';
|
|
5
5
|
|
|
6
|
+
import buttonSetStyles from '../button-set/button-set.css';
|
|
7
|
+
|
|
6
8
|
const angularModule = angular.module('Ring.button-set', []);
|
|
7
9
|
|
|
8
10
|
function rgButtonSet() {
|
|
@@ -11,7 +13,7 @@ function rgButtonSet() {
|
|
|
11
13
|
replace: true,
|
|
12
14
|
scope: false,
|
|
13
15
|
transclude: true,
|
|
14
|
-
template:
|
|
16
|
+
template: `<div class="${buttonSetStyles.buttonSet}" ng-transclude></div>`
|
|
15
17
|
};
|
|
16
18
|
}
|
|
17
19
|
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
/* stylelint-disable-next-line selector-max-specificity */
|
|
90
90
|
&:checked + .cell,
|
|
91
91
|
&:indeterminate[checked] + .cell,
|
|
92
|
-
&:indeterminate[data-checked=true] + .cell {
|
|
92
|
+
&:indeterminate[data-checked="true"] + .cell {
|
|
93
93
|
border-color: var(--ring-border-hover-color);
|
|
94
94
|
background-color: var(--ring-selected-background-color);
|
|
95
95
|
}
|
package/components/code/code.js
CHANGED
|
@@ -14,11 +14,8 @@ function noop() {}
|
|
|
14
14
|
|
|
15
15
|
const registerLanguage = memoize(async language => {
|
|
16
16
|
const languageExports = await import(
|
|
17
|
-
/* webpackChunkName: "highlight-[request]"
|
|
18
|
-
|
|
19
|
-
// can't migrate to @babel/eslint-parser yet: https://github.com/babel/babel/issues/11975
|
|
20
|
-
// eslint-disable-next-line prefer-template
|
|
21
|
-
'highlight.js/lib/languages/' + language
|
|
17
|
+
/* webpackChunkName: "highlight-[request]" */
|
|
18
|
+
`highlight.js/lib/languages/${language}`
|
|
22
19
|
);
|
|
23
20
|
highlight.registerLanguage(language, languageExports.default);
|
|
24
21
|
});
|
|
@@ -38,20 +38,20 @@ export default function confirm({
|
|
|
38
38
|
renderConfirm({...props, inProgress: true});
|
|
39
39
|
return Promise.resolve(onBeforeConfirm()).
|
|
40
40
|
then(() => {
|
|
41
|
-
renderConfirm({show: false});
|
|
41
|
+
renderConfirm({...props, show: false});
|
|
42
42
|
resolve();
|
|
43
43
|
}).
|
|
44
44
|
catch(err => {
|
|
45
|
-
renderConfirm({show: false});
|
|
45
|
+
renderConfirm({...props, show: false});
|
|
46
46
|
reject(err);
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
renderConfirm({show: false});
|
|
49
|
+
renderConfirm({...props, show: false});
|
|
50
50
|
return resolve();
|
|
51
51
|
},
|
|
52
52
|
|
|
53
53
|
onReject: () => {
|
|
54
|
-
renderConfirm({show: false});
|
|
54
|
+
renderConfirm({...props, show: false});
|
|
55
55
|
reject(new Error('Confirm(@jetbrains/ring-ui): null exception'));
|
|
56
56
|
}
|
|
57
57
|
};
|
|
@@ -61,5 +61,5 @@ export default function confirm({
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export function hideConfirm() {
|
|
64
|
-
renderConfirm({show: false});
|
|
64
|
+
renderConfirm({text: '', show: false});
|
|
65
65
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@import "../global/variables.css";
|
|
2
2
|
|
|
3
|
-
@value unit, extra-small-screen-media, small-screen-media from
|
|
3
|
+
@value unit, extra-small-screen-media, small-screen-media from "../global/global.css";
|
|
4
4
|
@value sidebarWidth: calc(unit * 30);
|
|
5
5
|
|
|
6
6
|
.contentLayout {
|
|
@@ -25,7 +25,8 @@ export default class DateInput extends React.PureComponent {
|
|
|
25
25
|
onInput: PropTypes.func,
|
|
26
26
|
onActivate: PropTypes.func,
|
|
27
27
|
onConfirm: PropTypes.func,
|
|
28
|
-
onClear: PropTypes.func
|
|
28
|
+
onClear: PropTypes.func,
|
|
29
|
+
locale: PropTypes.object
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
static defaultProps = {
|
|
@@ -78,16 +79,16 @@ export default class DateInput extends React.PureComponent {
|
|
|
78
79
|
time, name, hoverDate,
|
|
79
80
|
date, displayFormat, translations,
|
|
80
81
|
onActivate, onClear,
|
|
81
|
-
fromPlaceholder, toPlaceholder, timePlaceholder
|
|
82
|
+
fromPlaceholder, toPlaceholder, timePlaceholder, locale
|
|
82
83
|
} = this.props;
|
|
83
84
|
|
|
84
85
|
let displayText = '';
|
|
85
86
|
if (active && hoverDate) {
|
|
86
|
-
displayText = displayFormat(hoverDate);
|
|
87
|
+
displayText = displayFormat(hoverDate, locale);
|
|
87
88
|
} else if (active && text != null) {
|
|
88
89
|
displayText = text;
|
|
89
90
|
} else if (date) {
|
|
90
|
-
displayText = displayFormat(date);
|
|
91
|
+
displayText = displayFormat(date, locale);
|
|
91
92
|
} else if (name === 'time') {
|
|
92
93
|
displayText = time || '';
|
|
93
94
|
}
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
position: absolute;
|
|
97
97
|
right: unit;
|
|
98
98
|
|
|
99
|
-
content:
|
|
99
|
+
content: "—";
|
|
100
100
|
|
|
101
101
|
line-height: calc(4 * unit - 2px);
|
|
102
102
|
}
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
position: absolute;
|
|
124
124
|
left: calc(-1 * unit);
|
|
125
125
|
|
|
126
|
-
content:
|
|
126
|
+
content: ",";
|
|
127
127
|
|
|
128
128
|
line-height: calc(4 * unit - 3px);
|
|
129
129
|
}
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
color: var(--ring-secondary-color);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
.weekday {
|
|
139
|
+
.weekday.weekday {
|
|
140
140
|
display: inline-block;
|
|
141
141
|
|
|
142
142
|
width: cellSize;
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
text-transform: capitalize;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
.weekend {
|
|
148
|
+
.weekend.weekend {
|
|
149
149
|
color: var(--ring-error-color);
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
box-shadow: 0 -1px var(--ring-line-color);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
.months {
|
|
163
|
+
.months.months {
|
|
164
164
|
position: absolute;
|
|
165
165
|
top: 0;
|
|
166
166
|
right: yearWidth;
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
left: 0;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
.month {
|
|
176
|
+
.month.month {
|
|
177
177
|
display: flex;
|
|
178
178
|
flex-wrap: wrap;
|
|
179
179
|
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
margin: calc(unit * 2);
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
.month > * {
|
|
184
|
+
.month.month > * {
|
|
185
185
|
flex-shrink: 0;
|
|
186
186
|
|
|
187
187
|
height: cellSize;
|
|
@@ -198,6 +198,8 @@
|
|
|
198
198
|
|
|
199
199
|
text-align: left;
|
|
200
200
|
|
|
201
|
+
text-transform: capitalize;
|
|
202
|
+
|
|
201
203
|
font-weight: bold;
|
|
202
204
|
|
|
203
205
|
@supports (flex-basis: 1px) {
|
|
@@ -209,7 +211,9 @@
|
|
|
209
211
|
|
|
210
212
|
.day {
|
|
211
213
|
composes: resetButton;
|
|
214
|
+
}
|
|
212
215
|
|
|
216
|
+
.day.day {
|
|
213
217
|
position: relative;
|
|
214
218
|
|
|
215
219
|
flex-basis: cellSize;
|
|
@@ -226,25 +230,25 @@
|
|
|
226
230
|
}
|
|
227
231
|
}
|
|
228
232
|
|
|
229
|
-
.between {
|
|
233
|
+
.between.between {
|
|
230
234
|
transition: none;
|
|
231
235
|
|
|
232
236
|
background-color: var(--ring-selected-background-color);
|
|
233
237
|
}
|
|
234
238
|
|
|
235
|
-
.activeBetween {
|
|
239
|
+
.activeBetween.activeBetween {
|
|
236
240
|
transition: none;
|
|
237
241
|
|
|
238
242
|
background-color: var(--ring-date-picker-hover-color);
|
|
239
243
|
}
|
|
240
244
|
|
|
241
|
-
.current {
|
|
245
|
+
.current.current {
|
|
242
246
|
color: var(--ring-dark-text-color);
|
|
243
247
|
border-radius: var(--ring-border-radius);
|
|
244
248
|
background-color: var(--ring-main-color);
|
|
245
249
|
}
|
|
246
250
|
|
|
247
|
-
.active {
|
|
251
|
+
.active.active {
|
|
248
252
|
transition: none;
|
|
249
253
|
|
|
250
254
|
color: var(--ring-link-hover-color);
|
|
@@ -252,17 +256,17 @@
|
|
|
252
256
|
background-color: var(--ring-date-picker-hover-color);
|
|
253
257
|
}
|
|
254
258
|
|
|
255
|
-
.disabled {
|
|
259
|
+
.disabled.disabled {
|
|
256
260
|
cursor: not-allowed;
|
|
257
261
|
|
|
258
262
|
color: var(--ring-disabled-color);
|
|
259
263
|
}
|
|
260
264
|
|
|
261
|
-
.from {
|
|
265
|
+
.from.from {
|
|
262
266
|
border-radius: var(--ring-border-radius) 0 0 var(--ring-border-radius);
|
|
263
267
|
}
|
|
264
268
|
|
|
265
|
-
.to {
|
|
269
|
+
.to.to {
|
|
266
270
|
border-radius: 0 var(--ring-border-radius) var(--ring-border-radius) 0;
|
|
267
271
|
}
|
|
268
272
|
|
|
@@ -280,7 +284,7 @@
|
|
|
280
284
|
width: calc(unit * 2);
|
|
281
285
|
height: 100%;
|
|
282
286
|
|
|
283
|
-
content:
|
|
287
|
+
content: "";
|
|
284
288
|
transition: background-color var(--ring-ease);
|
|
285
289
|
}
|
|
286
290
|
|
|
@@ -323,7 +327,7 @@
|
|
|
323
327
|
width: calc(unit * 23);
|
|
324
328
|
height: calc(unit * 8);
|
|
325
329
|
|
|
326
|
-
content:
|
|
330
|
+
content: "";
|
|
327
331
|
transition: background-color var(--ring-ease);
|
|
328
332
|
}
|
|
329
333
|
|
|
@@ -355,7 +359,7 @@
|
|
|
355
359
|
width: calc(unit * 2);
|
|
356
360
|
height: 100%;
|
|
357
361
|
|
|
358
|
-
content:
|
|
362
|
+
content: "";
|
|
359
363
|
transition: background-color var(--ring-ease);
|
|
360
364
|
}
|
|
361
365
|
}
|
|
@@ -390,13 +394,13 @@
|
|
|
390
394
|
}
|
|
391
395
|
}
|
|
392
396
|
|
|
393
|
-
.empty {
|
|
397
|
+
.empty.empty {
|
|
394
398
|
pointer-events: none;
|
|
395
399
|
|
|
396
400
|
opacity: 0;
|
|
397
401
|
}
|
|
398
402
|
|
|
399
|
-
.today {
|
|
403
|
+
.today.today {
|
|
400
404
|
position: relative;
|
|
401
405
|
|
|
402
406
|
font-weight: bold;
|
|
@@ -407,7 +411,7 @@
|
|
|
407
411
|
top: 0;
|
|
408
412
|
left: calc(unit * 0.5);
|
|
409
413
|
|
|
410
|
-
content:
|
|
414
|
+
content: "•";
|
|
411
415
|
|
|
412
416
|
font-size: var(--ring-font-size-smaller);
|
|
413
417
|
}
|
|
@@ -441,7 +445,9 @@
|
|
|
441
445
|
.monthName {
|
|
442
446
|
composes: hoverable;
|
|
443
447
|
composes: resetButton;
|
|
448
|
+
}
|
|
444
449
|
|
|
450
|
+
.monthName.monthName {
|
|
445
451
|
position: relative;
|
|
446
452
|
|
|
447
453
|
width: 100%;
|
|
@@ -449,12 +455,16 @@
|
|
|
449
455
|
height: cellSize;
|
|
450
456
|
padding-left: calc(unit * 1.5);
|
|
451
457
|
|
|
458
|
+
text-transform: capitalize;
|
|
459
|
+
|
|
452
460
|
line-height: cellSize;
|
|
453
461
|
}
|
|
454
462
|
|
|
455
463
|
.monthSlider {
|
|
456
464
|
composes: resetButton;
|
|
465
|
+
}
|
|
457
466
|
|
|
467
|
+
.monthSlider.monthSlider {
|
|
458
468
|
position: absolute;
|
|
459
469
|
z-index: var(--ring-fixed-z-index);
|
|
460
470
|
right: 0;
|
|
@@ -474,7 +484,7 @@
|
|
|
474
484
|
opacity: 0.3;
|
|
475
485
|
}
|
|
476
486
|
|
|
477
|
-
.dragging
|
|
487
|
+
.dragging {
|
|
478
488
|
cursor: grabbing;
|
|
479
489
|
|
|
480
490
|
opacity: 0.35;
|
|
@@ -505,7 +515,9 @@
|
|
|
505
515
|
.year {
|
|
506
516
|
composes: hoverable;
|
|
507
517
|
composes: resetButton;
|
|
518
|
+
}
|
|
508
519
|
|
|
520
|
+
.year.year {
|
|
509
521
|
position: relative;
|
|
510
522
|
|
|
511
523
|
width: 100%;
|
|
@@ -519,7 +531,7 @@
|
|
|
519
531
|
line-height: yearHeight;
|
|
520
532
|
}
|
|
521
533
|
|
|
522
|
-
.currentYear {
|
|
534
|
+
.currentYear.currentYear {
|
|
523
535
|
cursor: auto;
|
|
524
536
|
transition: none;
|
|
525
537
|
|
|
@@ -90,7 +90,8 @@ export default class DatePicker extends PureComponent {
|
|
|
90
90
|
disabled: PropTypes.bool,
|
|
91
91
|
minDate: dateType,
|
|
92
92
|
maxDate: dateType,
|
|
93
|
-
translations: PropTypes.object
|
|
93
|
+
translations: PropTypes.object,
|
|
94
|
+
locale: PropTypes.object
|
|
94
95
|
};
|
|
95
96
|
|
|
96
97
|
static defaultProps = {
|
|
@@ -101,10 +102,10 @@ export default class DatePicker extends PureComponent {
|
|
|
101
102
|
from: null,
|
|
102
103
|
to: null,
|
|
103
104
|
clear: false,
|
|
104
|
-
displayFormat: date => (date ? formatDate(date, 'd MMM yyyy') : ''),
|
|
105
|
-
displayMonthFormat: date => (date ? formatDate(date, 'd MMM') : ''),
|
|
106
|
-
displayDayFormat: date => (date ? formatDate(date, 'd') : ''),
|
|
107
|
-
displayTimeFormat: date => (date ? formatDate(date, 'HH:mm') : ''),
|
|
105
|
+
displayFormat: (date, locale) => (date ? formatDate(date, 'd MMM yyyy', {locale}) : ''),
|
|
106
|
+
displayMonthFormat: (date, locale) => (date ? formatDate(date, 'd MMM', {locale}) : ''),
|
|
107
|
+
displayDayFormat: (date, locale) => (date ? formatDate(date, 'd', {locale}) : ''),
|
|
108
|
+
displayTimeFormat: (date, locale) => (date ? formatDate(date, 'HH:mm', {locale}) : ''),
|
|
108
109
|
datePlaceholder: 'Set a date',
|
|
109
110
|
dateTimePlaceholder: 'Set date and time',
|
|
110
111
|
rangePlaceholder: 'Set a period',
|
|
@@ -194,7 +195,8 @@ export default class DatePicker extends PureComponent {
|
|
|
194
195
|
displayFormat,
|
|
195
196
|
displayMonthFormat,
|
|
196
197
|
displayDayFormat,
|
|
197
|
-
translations
|
|
198
|
+
translations,
|
|
199
|
+
locale
|
|
198
200
|
} = this.props;
|
|
199
201
|
|
|
200
202
|
const date = this.parse(this.props.date);
|
|
@@ -204,27 +206,27 @@ export default class DatePicker extends PureComponent {
|
|
|
204
206
|
|
|
205
207
|
let text;
|
|
206
208
|
if (!range && !withTime) {
|
|
207
|
-
text = date ? displayFormat(date) : datePlaceholder || translations.setDate;
|
|
209
|
+
text = date ? displayFormat(date, locale) : datePlaceholder || translations.setDate;
|
|
208
210
|
} else if (!range && withTime) {
|
|
209
211
|
if (!date && !time) {
|
|
210
212
|
text = dateTimePlaceholder || translations.setDateTime;
|
|
211
213
|
} else {
|
|
212
|
-
text = `${date && displayFormat(date) || '—'}, ${time || '—'}`;
|
|
214
|
+
text = `${date && displayFormat(date, locale) || '—'}, ${time || '—'}`;
|
|
213
215
|
}
|
|
214
216
|
} else if (!from && !to) {
|
|
215
217
|
text = rangePlaceholder || translations.setPeriod;
|
|
216
218
|
} else if (!to) {
|
|
217
|
-
text = `${displayFormat(from)} —`;
|
|
219
|
+
text = `${displayFormat(from, locale)} —`;
|
|
218
220
|
} else if (!from) {
|
|
219
|
-
text = `— ${displayFormat(to)}`;
|
|
221
|
+
text = `— ${displayFormat(to, locale)}`;
|
|
220
222
|
} else if (!isSameYear(from, to)) {
|
|
221
|
-
text = `${displayFormat(from)} — ${displayFormat(to)}`;
|
|
223
|
+
text = `${displayFormat(from, locale)} — ${displayFormat(to, locale)}`;
|
|
222
224
|
} else if (!isSameMonth(from, to)) {
|
|
223
|
-
text = `${displayMonthFormat(from)} — ${displayFormat(to)}`;
|
|
225
|
+
text = `${displayMonthFormat(from, locale)} — ${displayFormat(to, locale)}`;
|
|
224
226
|
} else if (!isSameDay(from, to)) {
|
|
225
|
-
text = `${displayDayFormat(from)} — ${displayFormat(to)}`;
|
|
227
|
+
text = `${displayDayFormat(from, locale)} — ${displayFormat(to, locale)}`;
|
|
226
228
|
} else {
|
|
227
|
-
text = `${displayFormat(to)}`;
|
|
229
|
+
text = `${displayFormat(to, locale)}`;
|
|
228
230
|
}
|
|
229
231
|
|
|
230
232
|
return text;
|
|
@@ -47,7 +47,8 @@ export default class DatePopup extends Component {
|
|
|
47
47
|
hidden: PropTypes.bool,
|
|
48
48
|
fromPlaceholder: PropTypes.string,
|
|
49
49
|
toPlaceholder: PropTypes.string,
|
|
50
|
-
timePlaceholder: PropTypes.string
|
|
50
|
+
timePlaceholder: PropTypes.string,
|
|
51
|
+
locale: PropTypes.object
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
static defaultProps = {
|
|
@@ -77,7 +78,7 @@ export default class DatePopup extends Component {
|
|
|
77
78
|
|
|
78
79
|
componentDidMount() {
|
|
79
80
|
if (this.componentRef.current) {
|
|
80
|
-
this.componentRef.current.addEventListener('wheel', this.handleWheel);
|
|
81
|
+
this.componentRef.current.addEventListener('wheel', this.handleWheel, {passive: true});
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
|
|
@@ -278,15 +279,26 @@ export default class DatePopup extends Component {
|
|
|
278
279
|
handleScroll = scrollDate => this.setState({scrollDate});
|
|
279
280
|
|
|
280
281
|
onClear = e => {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
let changes;
|
|
283
|
+
|
|
284
|
+
if (this.props.range) {
|
|
285
|
+
changes = {
|
|
286
|
+
from: null,
|
|
287
|
+
to: null
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
} else {
|
|
291
|
+
changes = {
|
|
292
|
+
date: null
|
|
293
|
+
};
|
|
294
|
+
}
|
|
284
295
|
|
|
296
|
+
this.select(changes);
|
|
285
297
|
this.props.onClear(e);
|
|
286
298
|
};
|
|
287
299
|
|
|
288
300
|
render() {
|
|
289
|
-
const {range, hidden, withTime, time} = this.props;
|
|
301
|
+
const {range, hidden, withTime, time, locale} = this.props;
|
|
290
302
|
const parsedDate = this.parse(this.props.date, 'date');
|
|
291
303
|
const parsedTo = this.parse(this.props.to, 'to');
|
|
292
304
|
|
|
@@ -380,6 +392,7 @@ export default class DatePopup extends Component {
|
|
|
380
392
|
onInput={this.handleInput}
|
|
381
393
|
onConfirm={this.handleConfirm(name)}
|
|
382
394
|
onClear={onClear}
|
|
395
|
+
locale={locale}
|
|
383
396
|
/>
|
|
384
397
|
);
|
|
385
398
|
})}
|
|
@@ -402,12 +415,13 @@ export default class DatePopup extends Component {
|
|
|
402
415
|
onInput={this.handleInput}
|
|
403
416
|
onConfirm={this.handleConfirm('time')}
|
|
404
417
|
onClear={clearable && this.onClear || undefined}
|
|
418
|
+
locale={locale}
|
|
405
419
|
/>
|
|
406
420
|
)
|
|
407
421
|
: ('')
|
|
408
422
|
}
|
|
409
423
|
</div>
|
|
410
|
-
<Weekdays/>
|
|
424
|
+
<Weekdays locale={locale}/>
|
|
411
425
|
<div
|
|
412
426
|
className={styles.calendar}
|
|
413
427
|
>
|
|
@@ -415,6 +429,7 @@ export default class DatePopup extends Component {
|
|
|
415
429
|
{...calendarProps}
|
|
416
430
|
onHover={this.hoverHandler}
|
|
417
431
|
onSelect={this.selectHandler}
|
|
432
|
+
locale={locale}
|
|
418
433
|
/>
|
|
419
434
|
<Years {...calendarProps}/>
|
|
420
435
|
</div>
|
|
@@ -21,7 +21,7 @@ class MonthName extends PureComponent {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
render() {
|
|
24
|
-
const {month} = this.props;
|
|
24
|
+
const {month, locale} = this.props;
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
27
|
<button
|
|
@@ -34,7 +34,7 @@ class MonthName extends PureComponent {
|
|
|
34
34
|
)}
|
|
35
35
|
onClick={this.handleClick}
|
|
36
36
|
>
|
|
37
|
-
{format(month, '
|
|
37
|
+
{format(month, 'LLL', {locale})}
|
|
38
38
|
</button>
|
|
39
39
|
);
|
|
40
40
|
}
|
|
@@ -42,11 +42,12 @@ class MonthName extends PureComponent {
|
|
|
42
42
|
|
|
43
43
|
MonthName.propTypes = {
|
|
44
44
|
month: dateType,
|
|
45
|
-
onScrollChange: PropTypes.func
|
|
45
|
+
onScrollChange: PropTypes.func,
|
|
46
|
+
locale: PropTypes.string
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
export default function MonthNames(props) {
|
|
49
|
-
const {scrollDate} = props;
|
|
50
|
+
const {scrollDate, locale} = props;
|
|
50
51
|
const months = [];
|
|
51
52
|
for (let i = 0; i < YEAR; i++) {
|
|
52
53
|
const middleDay = set(scrollDate, {month: i, date: MIDDLE_DAY});
|
|
@@ -73,6 +74,7 @@ export default function MonthNames(props) {
|
|
|
73
74
|
key={+month}
|
|
74
75
|
month={month}
|
|
75
76
|
onScrollChange={props.onScrollChange}
|
|
77
|
+
locale={locale}
|
|
76
78
|
/>
|
|
77
79
|
))}
|
|
78
80
|
{props.currentRange &&
|
|
@@ -97,5 +99,6 @@ export default function MonthNames(props) {
|
|
|
97
99
|
MonthNames.propTypes = {
|
|
98
100
|
scrollDate: dateType,
|
|
99
101
|
onScrollChange: PropTypes.func,
|
|
100
|
-
currentRange: PropTypes.arrayOf(dateType)
|
|
102
|
+
currentRange: PropTypes.arrayOf(dateType),
|
|
103
|
+
locale: PropTypes.string
|
|
101
104
|
};
|
|
@@ -5,6 +5,8 @@ import format from 'date-fns/format';
|
|
|
5
5
|
import getDay from 'date-fns/getDay';
|
|
6
6
|
import setDay from 'date-fns/setDay';
|
|
7
7
|
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
|
|
8
10
|
import Day from './day';
|
|
9
11
|
import {dateType, WEEK, weekdays} from './consts';
|
|
10
12
|
import styles from './date-picker.css';
|
|
@@ -12,6 +14,7 @@ import styles from './date-picker.css';
|
|
|
12
14
|
export default function Month(props) {
|
|
13
15
|
const start = props.month;
|
|
14
16
|
const end = endOfMonth(start);
|
|
17
|
+
const {locale} = props;
|
|
15
18
|
|
|
16
19
|
// pad with empty cells starting from last friday
|
|
17
20
|
const weekday = getDay(start);
|
|
@@ -25,7 +28,7 @@ export default function Month(props) {
|
|
|
25
28
|
return (
|
|
26
29
|
<div className={styles.month}>
|
|
27
30
|
<span className={styles.monthTitle}>
|
|
28
|
-
{format(props.month, '
|
|
31
|
+
{format(props.month, 'LLLL', {locale})}
|
|
29
32
|
</span>
|
|
30
33
|
{days.map(date => (
|
|
31
34
|
<Day
|
|
@@ -40,5 +43,6 @@ export default function Month(props) {
|
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
Month.propTypes = {
|
|
43
|
-
month: dateType
|
|
46
|
+
month: dateType,
|
|
47
|
+
locale: PropTypes.string
|
|
44
48
|
};
|
|
@@ -5,13 +5,17 @@ import format from 'date-fns/format';
|
|
|
5
5
|
import setDay from 'date-fns/setDay';
|
|
6
6
|
import startOfDay from 'date-fns/startOfDay';
|
|
7
7
|
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
|
|
8
10
|
import {weekdays} from './consts';
|
|
9
11
|
import styles from './date-picker.css';
|
|
10
12
|
|
|
11
|
-
export default function Weekdays() {
|
|
13
|
+
export default function Weekdays(props) {
|
|
12
14
|
const days = Object.keys(weekdays).
|
|
13
15
|
map(key => startOfDay(setDay(new Date(), weekdays[key])));
|
|
14
16
|
|
|
17
|
+
const {locale} = props;
|
|
18
|
+
|
|
15
19
|
return (
|
|
16
20
|
<div className={styles.weekdays}>
|
|
17
21
|
{days.map(day => (
|
|
@@ -24,9 +28,13 @@ export default function Weekdays() {
|
|
|
24
28
|
)}
|
|
25
29
|
key={+day}
|
|
26
30
|
>
|
|
27
|
-
{format(day, 'EEEEEE')}
|
|
31
|
+
{format(day, 'EEEEEE', {locale})}
|
|
28
32
|
</span>
|
|
29
33
|
))}
|
|
30
34
|
</div>
|
|
31
35
|
);
|
|
32
36
|
}
|
|
37
|
+
|
|
38
|
+
Weekdays.propTypes = {
|
|
39
|
+
locale: PropTypes.string
|
|
40
|
+
};
|
|
@@ -55,6 +55,7 @@ export const basic = ({onAction}) => {
|
|
|
55
55
|
</Group>
|
|
56
56
|
|
|
57
57
|
<Dialog
|
|
58
|
+
label="Dialog"
|
|
58
59
|
show={show}
|
|
59
60
|
onCloseAttempt={this.cancelDialog}
|
|
60
61
|
trapFocus
|
|
@@ -124,6 +125,7 @@ export const withScroll = ({onAction}) => {
|
|
|
124
125
|
</div>
|
|
125
126
|
|
|
126
127
|
<Dialog
|
|
128
|
+
label="Dialog"
|
|
127
129
|
show={this.state.show}
|
|
128
130
|
onCloseAttempt={this.cancelDialog}
|
|
129
131
|
trapFocus
|
|
@@ -167,7 +169,7 @@ export const WithOverflowScrollOnHtml = () => {
|
|
|
167
169
|
<div className="container">
|
|
168
170
|
<div>Scroll down</div>
|
|
169
171
|
<Button className="button" onClick={() => setOpen(true)}>Show dialog</Button>
|
|
170
|
-
<Dialog show={open} onCloseAttempt={() => setOpen(false)}>
|
|
172
|
+
<Dialog label="Dialog" show={open} onCloseAttempt={() => setOpen(false)}>
|
|
171
173
|
<Header>Dialog title</Header>
|
|
172
174
|
</Dialog>
|
|
173
175
|
</div>
|