@jetbrains/ring-ui-built 7.0.106 → 7.0.108
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/components/_helpers/date-picker.js +1 -1
- package/components/_helpers/theme.js +15 -14
- package/components/alert-service/alert-service.d.ts +2 -2
- package/components/alert-service/alert-service.js +2 -2
- package/components/auth/auth-core.js +1 -0
- package/components/auth/auth.js +1 -0
- package/components/auth/iframe-flow.js +1 -0
- package/components/auth/token-validator.js +1 -0
- package/components/auth-dialog/auth-dialog.js +1 -0
- package/components/auth-dialog-service/auth-dialog-service.js +1 -0
- package/components/avatar/avatar.js +1 -0
- package/components/avatar-stack/avatar-stack.js +1 -0
- package/components/banner/banner.js +1 -0
- package/components/button-group/button-group.js +18 -1
- package/components/components/util-stories.js +3 -0
- package/components/confirm/confirm.js +1 -0
- package/components/confirm-service/confirm-service.js +1 -0
- package/components/data-list/data-list.js +1 -0
- package/components/data-list/selection.js +1 -0
- package/components/date-picker/animate-date.d.ts +1 -0
- package/components/date-picker/animate-date.js +39 -0
- package/components/date-picker/consts.d.ts +21 -4
- package/components/date-picker/consts.js +18 -1
- package/components/date-picker/date-picker.d.ts +48 -1
- package/components/date-picker/date-picker.js +44 -17
- package/components/date-picker/date-popup.d.ts +3 -9
- package/components/date-picker/date-popup.js +59 -72
- package/components/date-picker/day.js +24 -15
- package/components/date-picker/month-names.js +76 -72
- package/components/date-picker/month-slider.d.ts +5 -20
- package/components/date-picker/month-slider.js +129 -47
- package/components/date-picker/month.d.ts +4 -0
- package/components/date-picker/month.js +81 -76
- package/components/date-picker/months.js +75 -191
- package/components/date-picker/scroll-arith.d.ts +35 -0
- package/components/date-picker/scroll-arith.js +74 -0
- package/components/date-picker/use-intersection-observer.d.ts +6 -0
- package/components/date-picker/use-intersection-observer.js +93 -0
- package/components/date-picker/use-scroll-behavior.d.ts +8 -0
- package/components/date-picker/use-scroll-behavior.js +223 -0
- package/components/date-picker/weekdays.js +3 -0
- package/components/date-picker/years.d.ts +1 -18
- package/components/date-picker/years.js +259 -78
- package/components/dialog/dialog.js +1 -0
- package/components/dropdown-menu/dropdown-menu.js +1 -0
- package/components/editable-heading/editable-heading.js +1 -0
- package/components/error-bubble/error-bubble.js +1 -0
- package/components/footer/footer.d.ts +1 -1
- package/components/global/dom.d.ts +1 -1
- package/components/global/dom.js +1 -1
- package/components/header/header.js +1 -0
- package/components/header/profile.js +1 -0
- package/components/header/services.js +1 -0
- package/components/header/smart-profile.js +1 -0
- package/components/header/smart-services.js +1 -0
- package/components/heading/heading.d.ts +4 -4
- package/components/list/list-item.js +1 -0
- package/components/list/list-users-groups-source.js +1 -0
- package/components/list/list.js +1 -0
- package/components/login-dialog/login-dialog.js +1 -0
- package/components/login-dialog/service.js +1 -0
- package/components/message/message.js +1 -0
- package/components/old-browsers-message/old-browsers-message-stop.js +1 -0
- package/components/old-browsers-message/old-browsers-message.js +1 -0
- package/components/old-browsers-message/white-list.js +3 -2
- package/components/pager/pager.js +1 -0
- package/components/popup/popup.js +1 -0
- package/components/popup/position-css.js +1 -0
- package/components/popup/position.js +1 -0
- package/components/popup-menu/popup-menu.js +1 -0
- package/components/query-assist/query-assist-suggestions.js +1 -0
- package/components/query-assist/query-assist.js +1 -0
- package/components/select/select-filter.js +1 -0
- package/components/select/select-popup.js +1 -0
- package/components/select/select.js +1 -0
- package/components/shortcuts/core.js +1 -0
- package/components/shortcuts/shortcuts-hoc.js +1 -0
- package/components/shortcuts/shortcuts.js +1 -0
- package/components/slider/slider.js +1 -0
- package/components/style.css +1 -1
- package/components/table/disable-hover-hoc.js +1 -0
- package/components/table/multitable.js +1 -0
- package/components/table/row-with-focus-sensor.js +1 -0
- package/components/table/row.js +1 -0
- package/components/table/simple-table.js +1 -0
- package/components/table/smart-table.js +1 -0
- package/components/table/table.js +1 -0
- package/components/tabs/collapsible-more.js +1 -0
- package/components/tabs/collapsible-tabs.js +1 -0
- package/components/tabs/dumb-tabs.d.ts +1 -0
- package/components/tabs/dumb-tabs.js +3 -1
- package/components/tabs/smart-tabs.js +1 -0
- package/components/tabs/tabs.js +1 -0
- package/components/tags-input/tags-input.js +1 -0
- package/components/tooltip/tooltip.js +1 -0
- package/components/user-agreement/service.js +1 -0
- package/components/user-agreement/user-agreement.js +1 -0
- package/components/user-card/card.js +1 -0
- package/components/user-card/smart-user-card-tooltip.js +1 -0
- package/components/user-card/tooltip.js +1 -0
- package/components/user-card/user-card.js +1 -0
- package/components/util-stories.d.ts +1 -0
- package/package.json +3 -3
- package/typings.d.ts +5 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var styles = {"container":"ring-date-picker-container","hoverable":"ring-date-picker-hoverable","datePicker":"ring-date-picker-datePicker","inline":"ring-date-picker-inline","sizeS":"ring-date-picker-sizeS","sizeM":"ring-date-picker-sizeM","sizeL":"ring-date-picker-sizeL","sizeFULL":"ring-date-picker-sizeFULL","sizeAUTO":"ring-date-picker-sizeAUTO","displayDate":"ring-date-picker-displayDate","displayRange":"ring-date-picker-displayRange","clear":"ring-date-picker-clear","datePopup":"ring-date-picker-datePopup","filterWrapper":"ring-date-picker-filterWrapper ring-select-popup-filterWrapper","filter":"ring-date-picker-filter ring-select-popup-filter","calendarIcon":"ring-date-picker-calendarIcon","anchor":"ring-date-picker-anchor","anchorContent":"ring-date-picker-anchorContent","chevronDownIcon":"ring-date-picker-chevronDownIcon","fromInput":"ring-date-picker-fromInput","fromInputWithDivider":"ring-date-picker-fromInputWithDivider","toInput":"ring-date-picker-toInput","dateInput":"ring-date-picker-dateInput","timeInputWithDivider":"ring-date-picker-timeInputWithDivider","weekdays":"ring-date-picker-weekdays","weekday":"ring-date-picker-weekday","weekend":"ring-date-picker-weekend","calendar":"ring-date-picker-calendar","months":"ring-date-picker-months","
|
|
1
|
+
var styles = {"container":"ring-date-picker-container","hoverable":"ring-date-picker-hoverable","datePicker":"ring-date-picker-datePicker","inline":"ring-date-picker-inline","sizeS":"ring-date-picker-sizeS","sizeM":"ring-date-picker-sizeM","sizeL":"ring-date-picker-sizeL","sizeFULL":"ring-date-picker-sizeFULL","sizeAUTO":"ring-date-picker-sizeAUTO","displayDate":"ring-date-picker-displayDate","displayRange":"ring-date-picker-displayRange","clear":"ring-date-picker-clear","datePopup":"ring-date-picker-datePopup","filterWrapper":"ring-date-picker-filterWrapper ring-select-popup-filterWrapper","filter":"ring-date-picker-filter ring-select-popup-filter","calendarIcon":"ring-date-picker-calendarIcon","anchor":"ring-date-picker-anchor","anchorContent":"ring-date-picker-anchorContent","chevronDownIcon":"ring-date-picker-chevronDownIcon","fromInput":"ring-date-picker-fromInput","fromInputWithDivider":"ring-date-picker-fromInputWithDivider","toInput":"ring-date-picker-toInput","dateInput":"ring-date-picker-dateInput","timeInputWithDivider":"ring-date-picker-timeInputWithDivider","weekdays":"ring-date-picker-weekdays","weekday":"ring-date-picker-weekday","weekend":"ring-date-picker-weekend","calendar":"ring-date-picker-calendar","months":"ring-date-picker-months","month":"ring-date-picker-month","monthTitle":"ring-date-picker-monthTitle","day":"ring-date-picker-day ring-global-resetButton","between":"ring-date-picker-between","activeBetween":"ring-date-picker-activeBetween","current":"ring-date-picker-current","active":"ring-date-picker-active","disabled":"ring-date-picker-disabled","from":"ring-date-picker-from","to":"ring-date-picker-to","Day1":"ring-date-picker-Day1","spread":"ring-date-picker-spread","activeSpread":"ring-date-picker-activeSpread","first":"ring-date-picker-first","Day2":"ring-date-picker-Day2","Day5":"ring-date-picker-Day5","Day6":"ring-date-picker-Day6","Day7":"ring-date-picker-Day7","empty":"ring-date-picker-empty","today":"ring-date-picker-today","year":"ring-date-picker-year ring-date-picker-hoverable ring-global-resetButton","monthNames":"ring-date-picker-monthNames","monthName":"ring-date-picker-monthName ring-date-picker-hoverable ring-global-resetButton","monthSlider":"ring-date-picker-monthSlider ring-global-resetButton","dragging":"ring-date-picker-dragging","range":"ring-date-picker-range","years":"ring-date-picker-years","currentYear":"ring-date-picker-currentYear"};
|
|
2
2
|
|
|
3
3
|
export { styles as s };
|
|
@@ -17,16 +17,17 @@ const ThemeContext = /*#__PURE__*/createContext({
|
|
|
17
17
|
theme: Theme.LIGHT
|
|
18
18
|
});
|
|
19
19
|
const GLOBAL_DARK_CLASS_NAME = 'ring-ui-theme-dark';
|
|
20
|
-
const darkMatcher = window.matchMedia('(prefers-color-scheme: dark)');
|
|
20
|
+
const darkMatcher = typeof window !== 'undefined' ? window.matchMedia('(prefers-color-scheme: dark)') : undefined;
|
|
21
21
|
function useTheme() {
|
|
22
|
+
var _darkMatcher$matches;
|
|
22
23
|
const $ = c(3);
|
|
23
|
-
if ($[0] !== "
|
|
24
|
+
if ($[0] !== "4a3ee1675c0bca0c5645fa43dba8f8678ee294b7ae46bb66959a11f3f15923aa") {
|
|
24
25
|
for (let $i = 0; $i < 3; $i += 1) {
|
|
25
26
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
26
27
|
}
|
|
27
|
-
$[0] = "
|
|
28
|
+
$[0] = "4a3ee1675c0bca0c5645fa43dba8f8678ee294b7ae46bb66959a11f3f15923aa";
|
|
28
29
|
}
|
|
29
|
-
const [dark, setDark] = useState(darkMatcher
|
|
30
|
+
const [dark, setDark] = useState((_darkMatcher$matches = darkMatcher?.matches) !== null && _darkMatcher$matches !== void 0 ? _darkMatcher$matches : false);
|
|
30
31
|
let t0;
|
|
31
32
|
let t1;
|
|
32
33
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
@@ -47,11 +48,11 @@ function useTheme() {
|
|
|
47
48
|
}
|
|
48
49
|
function useThemeClasses(theme) {
|
|
49
50
|
const $ = c(5);
|
|
50
|
-
if ($[0] !== "
|
|
51
|
+
if ($[0] !== "4a3ee1675c0bca0c5645fa43dba8f8678ee294b7ae46bb66959a11f3f15923aa") {
|
|
51
52
|
for (let $i = 0; $i < 5; $i += 1) {
|
|
52
53
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
53
54
|
}
|
|
54
|
-
$[0] = "
|
|
55
|
+
$[0] = "4a3ee1675c0bca0c5645fa43dba8f8678ee294b7ae46bb66959a11f3f15923aa";
|
|
55
56
|
}
|
|
56
57
|
const systemTheme = useTheme();
|
|
57
58
|
const resolvedTheme = theme === Theme.AUTO ? systemTheme : theme;
|
|
@@ -76,11 +77,11 @@ function useThemeClasses(theme) {
|
|
|
76
77
|
}
|
|
77
78
|
function WithThemeClasses(t0) {
|
|
78
79
|
const $ = c(4);
|
|
79
|
-
if ($[0] !== "
|
|
80
|
+
if ($[0] !== "4a3ee1675c0bca0c5645fa43dba8f8678ee294b7ae46bb66959a11f3f15923aa") {
|
|
80
81
|
for (let $i = 0; $i < 4; $i += 1) {
|
|
81
82
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
82
83
|
}
|
|
83
|
-
$[0] = "
|
|
84
|
+
$[0] = "4a3ee1675c0bca0c5645fa43dba8f8678ee294b7ae46bb66959a11f3f15923aa";
|
|
84
85
|
}
|
|
85
86
|
const {
|
|
86
87
|
theme,
|
|
@@ -111,11 +112,11 @@ function applyTheme(theme, container) {
|
|
|
111
112
|
}
|
|
112
113
|
const DefaultWrapper = /*#__PURE__*/forwardRef(function Wrapper(props, ref) {
|
|
113
114
|
const $ = c(4);
|
|
114
|
-
if ($[0] !== "
|
|
115
|
+
if ($[0] !== "4a3ee1675c0bca0c5645fa43dba8f8678ee294b7ae46bb66959a11f3f15923aa") {
|
|
115
116
|
for (let $i = 0; $i < 4; $i += 1) {
|
|
116
117
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
117
118
|
}
|
|
118
|
-
$[0] = "
|
|
119
|
+
$[0] = "4a3ee1675c0bca0c5645fa43dba8f8678ee294b7ae46bb66959a11f3f15923aa";
|
|
119
120
|
}
|
|
120
121
|
let t0;
|
|
121
122
|
if ($[1] !== props || $[2] !== ref) {
|
|
@@ -133,11 +134,11 @@ const DefaultWrapper = /*#__PURE__*/forwardRef(function Wrapper(props, ref) {
|
|
|
133
134
|
});
|
|
134
135
|
function ThemeProviderInner(t0) {
|
|
135
136
|
const $ = c(30);
|
|
136
|
-
if ($[0] !== "
|
|
137
|
+
if ($[0] !== "4a3ee1675c0bca0c5645fa43dba8f8678ee294b7ae46bb66959a11f3f15923aa") {
|
|
137
138
|
for (let $i = 0; $i < 30; $i += 1) {
|
|
138
139
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
139
140
|
}
|
|
140
|
-
$[0] = "
|
|
141
|
+
$[0] = "4a3ee1675c0bca0c5645fa43dba8f8678ee294b7ae46bb66959a11f3f15923aa";
|
|
141
142
|
}
|
|
142
143
|
let children;
|
|
143
144
|
let className;
|
|
@@ -256,11 +257,11 @@ function ThemeProviderInner(t0) {
|
|
|
256
257
|
}
|
|
257
258
|
const ThemeProvider = /*#__PURE__*/forwardRef(function ThemeProvider(props, ref) {
|
|
258
259
|
const $ = c(4);
|
|
259
|
-
if ($[0] !== "
|
|
260
|
+
if ($[0] !== "4a3ee1675c0bca0c5645fa43dba8f8678ee294b7ae46bb66959a11f3f15923aa") {
|
|
260
261
|
for (let $i = 0; $i < 4; $i += 1) {
|
|
261
262
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
262
263
|
}
|
|
263
|
-
$[0] = "
|
|
264
|
+
$[0] = "4a3ee1675c0bca0c5645fa43dba8f8678ee294b7ae46bb66959a11f3f15923aa";
|
|
264
265
|
}
|
|
265
266
|
let t0;
|
|
266
267
|
if ($[1] !== props || $[2] !== ref) {
|
|
@@ -12,8 +12,8 @@ export declare const DEFAULT_ALERT_TIMEOUT = 10000;
|
|
|
12
12
|
export declare class AlertService {
|
|
13
13
|
defaultTimeout: number;
|
|
14
14
|
showingAlerts: AlertItem[];
|
|
15
|
-
containerElement: HTMLDivElement;
|
|
16
|
-
reactRoot: import("react-dom/client").Root;
|
|
15
|
+
containerElement: HTMLDivElement | undefined;
|
|
16
|
+
reactRoot: import("react-dom/client").Root | undefined;
|
|
17
17
|
_getShowingAlerts(): AlertItem[];
|
|
18
18
|
renderAlertContainer(alerts: readonly AlertItem[]): import("react").JSX.Element;
|
|
19
19
|
/**
|
|
@@ -36,8 +36,8 @@ class AlertService {
|
|
|
36
36
|
defaultTimeout = DEFAULT_ALERT_TIMEOUT;
|
|
37
37
|
// This alerts are stored in inverse order (last shown is first in array)
|
|
38
38
|
showingAlerts = [];
|
|
39
|
-
containerElement = document.createElement('div');
|
|
40
|
-
reactRoot = createRoot(this.containerElement);
|
|
39
|
+
containerElement = typeof document !== 'undefined' ? document.createElement('div') : undefined;
|
|
40
|
+
reactRoot = this.containerElement && createRoot(this.containerElement);
|
|
41
41
|
_getShowingAlerts() {
|
|
42
42
|
return [...this.showingAlerts];
|
|
43
43
|
}
|
package/components/auth/auth.js
CHANGED
|
@@ -37,6 +37,7 @@ import 'react-dom';
|
|
|
37
37
|
import '../link/link.js';
|
|
38
38
|
import '../_helpers/link.js';
|
|
39
39
|
import '../group/group.js';
|
|
40
|
+
import 'core-js/modules/es.array.includes.js';
|
|
40
41
|
import '../global/listeners.js';
|
|
41
42
|
import '../http/http.js';
|
|
42
43
|
import '../global/promise-with-timeout.js';
|
|
@@ -25,6 +25,7 @@ import '../global/schedule-raf.js';
|
|
|
25
25
|
import '../global/get-uid.js';
|
|
26
26
|
import '../shortcuts/shortcuts.js';
|
|
27
27
|
import '../shortcuts/core.js';
|
|
28
|
+
import 'core-js/modules/es.array.includes.js';
|
|
28
29
|
import 'combokeys';
|
|
29
30
|
import '../global/sniffer.js';
|
|
30
31
|
import 'sniffr';
|
|
@@ -19,6 +19,7 @@ import '../island/header.js';
|
|
|
19
19
|
import '../global/get-uid.js';
|
|
20
20
|
import '../shortcuts/shortcuts.js';
|
|
21
21
|
import '../shortcuts/core.js';
|
|
22
|
+
import 'core-js/modules/es.array.includes.js';
|
|
22
23
|
import 'combokeys';
|
|
23
24
|
import '../global/sniffer.js';
|
|
24
25
|
import 'sniffr';
|
|
@@ -22,6 +22,7 @@ import '../island/header.js';
|
|
|
22
22
|
import '../global/get-uid.js';
|
|
23
23
|
import '../shortcuts/shortcuts.js';
|
|
24
24
|
import '../shortcuts/core.js';
|
|
25
|
+
import 'core-js/modules/es.array.includes.js';
|
|
25
26
|
import 'combokeys';
|
|
26
27
|
import '../global/sniffer.js';
|
|
27
28
|
import 'sniffr';
|
|
@@ -7,6 +7,7 @@ import { f as fontSizes } from '../_helpers/avatar-info.js';
|
|
|
7
7
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
8
|
import { Size } from '../avatar/avatar-size.js';
|
|
9
9
|
import '../list/list.js';
|
|
10
|
+
import 'core-js/modules/es.array.includes.js';
|
|
10
11
|
import 'react-virtualized/dist/es/List';
|
|
11
12
|
import 'react-virtualized/dist/es/AutoSizer';
|
|
12
13
|
import 'react-virtualized/dist/es/WindowScroller';
|
|
@@ -24,6 +24,7 @@ import '../global/schedule-raf.js';
|
|
|
24
24
|
import '../global/dom.js';
|
|
25
25
|
import '../shortcuts/shortcuts.js';
|
|
26
26
|
import '../shortcuts/core.js';
|
|
27
|
+
import 'core-js/modules/es.array.includes.js';
|
|
27
28
|
import 'combokeys';
|
|
28
29
|
import '../global/sniffer.js';
|
|
29
30
|
import 'sniffr';
|
|
@@ -8,6 +8,23 @@ export { C as Caption } from '../_helpers/caption.js';
|
|
|
8
8
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
9
9
|
import 'react-compiler-runtime';
|
|
10
10
|
|
|
11
|
+
function allChildrenDisabled(children) {
|
|
12
|
+
if (!children || typeof children !== 'object') return false;
|
|
13
|
+
if ('props' in children) {
|
|
14
|
+
const {
|
|
15
|
+
props
|
|
16
|
+
} = children;
|
|
17
|
+
if ('disabled' in props) {
|
|
18
|
+
return !!props.disabled;
|
|
19
|
+
}
|
|
20
|
+
return allChildrenDisabled(props.children);
|
|
21
|
+
}
|
|
22
|
+
const real = Children.toArray(children);
|
|
23
|
+
return real.length > 0 && real.every(allChildrenDisabled);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @name Button Group
|
|
27
|
+
*/
|
|
11
28
|
class ButtonGroup extends PureComponent {
|
|
12
29
|
render() {
|
|
13
30
|
const {
|
|
@@ -19,7 +36,7 @@ class ButtonGroup extends PureComponent {
|
|
|
19
36
|
...restProps
|
|
20
37
|
} = this.props;
|
|
21
38
|
const classes = classNames(split ? styles.split : styles.buttonGroup, className, {
|
|
22
|
-
[styles.disabled]:
|
|
39
|
+
[styles.disabled]: allChildrenDisabled(this.props.children)
|
|
23
40
|
});
|
|
24
41
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
25
42
|
children: [label && /*#__PURE__*/jsx(ControlLabel, {
|
|
@@ -19,6 +19,7 @@ import '../global/schedule-raf.js';
|
|
|
19
19
|
import '../global/get-uid.js';
|
|
20
20
|
import '../shortcuts/shortcuts.js';
|
|
21
21
|
import '../shortcuts/core.js';
|
|
22
|
+
import 'core-js/modules/es.array.includes.js';
|
|
22
23
|
import 'combokeys';
|
|
23
24
|
import '../global/sniffer.js';
|
|
24
25
|
import 'sniffr';
|
|
@@ -20,6 +20,7 @@ import '../global/schedule-raf.js';
|
|
|
20
20
|
import '../global/get-uid.js';
|
|
21
21
|
import '../shortcuts/shortcuts.js';
|
|
22
22
|
import '../shortcuts/core.js';
|
|
23
|
+
import 'core-js/modules/es.array.includes.js';
|
|
23
24
|
import 'combokeys';
|
|
24
25
|
import '../global/sniffer.js';
|
|
25
26
|
import 'sniffr';
|
|
@@ -11,6 +11,7 @@ import { s as styles } from '../_helpers/title.js';
|
|
|
11
11
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
12
12
|
import '../global/compose-refs.js';
|
|
13
13
|
import 'memoize-one';
|
|
14
|
+
import 'core-js/modules/es.array.includes.js';
|
|
14
15
|
import '../shortcuts/core.js';
|
|
15
16
|
import 'combokeys';
|
|
16
17
|
import '../global/sniffer.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function animateDate(initial: number | Date, target: number | Date, onUpdate: (date: Date) => void, durationMs?: number): () => void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { dateAnimationDuration } from './consts.js';
|
|
2
|
+
import 'date-fns/add';
|
|
3
|
+
import '../global/sniffer.js';
|
|
4
|
+
import 'sniffr';
|
|
5
|
+
|
|
6
|
+
// Animate via an ascending fragment of a sine wave
|
|
7
|
+
// eslint-disable-next-line prettier/prettier, no-magic-numbers
|
|
8
|
+
const xFrom = -0.5 * Math.PI / 2;
|
|
9
|
+
const xTo = Math.PI / 2;
|
|
10
|
+
const yFrom = Math.sin(xFrom);
|
|
11
|
+
const yTo = Math.sin(xTo);
|
|
12
|
+
function animateDate(initial, target, onUpdate, durationMs = dateAnimationDuration) {
|
|
13
|
+
let requestId = null;
|
|
14
|
+
const startTime = performance.now();
|
|
15
|
+
function frame(now) {
|
|
16
|
+
const durationFraction = (now - startTime) / durationMs;
|
|
17
|
+
// eslint-disable-next-line no-magic-numbers
|
|
18
|
+
if (durationFraction >= 0.97) {
|
|
19
|
+
onUpdate(new Date(target));
|
|
20
|
+
requestId = null;
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const x = xFrom + (xTo - xFrom) * durationFraction;
|
|
24
|
+
const y = Math.sin(x);
|
|
25
|
+
const yFraction = (y - yFrom) / (yTo - yFrom);
|
|
26
|
+
const date = Number(initial) + (Number(target) - Number(initial)) * yFraction;
|
|
27
|
+
onUpdate(new Date(date));
|
|
28
|
+
requestId = requestAnimationFrame(frame);
|
|
29
|
+
}
|
|
30
|
+
requestId = requestAnimationFrame(frame);
|
|
31
|
+
return () => {
|
|
32
|
+
if (requestId != null) {
|
|
33
|
+
cancelAnimationFrame(requestId);
|
|
34
|
+
requestId = null;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { animateDate };
|
|
@@ -55,11 +55,15 @@ export interface RangeSpecificPopupProps {
|
|
|
55
55
|
range: true;
|
|
56
56
|
onChange: (change: DatePickerChange) => void;
|
|
57
57
|
}
|
|
58
|
+
export interface ScrollDate {
|
|
59
|
+
date: number | Date;
|
|
60
|
+
source: 'monthsScroll' | 'yearsScroll' | 'other';
|
|
61
|
+
}
|
|
58
62
|
export interface DatePopupState {
|
|
59
63
|
active: Field;
|
|
60
64
|
text: string | null;
|
|
61
65
|
hoverDate: Date | null;
|
|
62
|
-
scrollDate:
|
|
66
|
+
scrollDate: ScrollDate | null;
|
|
63
67
|
}
|
|
64
68
|
export interface DatePopupBaseProps {
|
|
65
69
|
date?: Date | number | string | null | undefined;
|
|
@@ -87,14 +91,27 @@ export interface Dates {
|
|
|
87
91
|
}
|
|
88
92
|
export interface CalendarProps extends Omit<DatePopupBaseProps, 'date' | 'from' | 'to' | 'time'>, Dates {
|
|
89
93
|
activeDate: Date | null;
|
|
90
|
-
scrollDate:
|
|
94
|
+
scrollDate: ScrollDate;
|
|
91
95
|
currentRange: [Date, Date] | null;
|
|
92
96
|
activeRange: [Date, Date] | null;
|
|
93
|
-
|
|
94
|
-
onScrollChange: (date: number) => void;
|
|
97
|
+
setScrollDate: (scrollDate: ScrollDate) => void;
|
|
95
98
|
}
|
|
96
99
|
export interface MonthsProps extends CalendarProps {
|
|
97
100
|
onSelect: (date: Date) => void;
|
|
98
101
|
onHover: (date: Date) => void;
|
|
99
102
|
}
|
|
100
103
|
export type Field = 'date' | 'time' | 'from' | 'to';
|
|
104
|
+
/**
|
|
105
|
+
* Safari on iPhone doesn't allow setting scrollTop while a scroll is in progress.
|
|
106
|
+
* If you do, the browser will overwrite it during the next scroll event.
|
|
107
|
+
* This behavior occurs both during inertia scrolling and when the user is actively scrolling with a finger.
|
|
108
|
+
*
|
|
109
|
+
* In this environment, we:
|
|
110
|
+
* 1) only re-render when the scroll position is within a few pixels of the edge, and
|
|
111
|
+
* 2) only act after scrolling has ended.
|
|
112
|
+
*/
|
|
113
|
+
export declare const isSafariOnIPhone: boolean;
|
|
114
|
+
export declare const scrollerReRenderDelayIPhone = 100;
|
|
115
|
+
export declare const calendarSyncOnYearScrollUpdateDelay: number;
|
|
116
|
+
export declare const dateAnimationDuration = 150;
|
|
117
|
+
export declare const yearsAnimationDuration = 200;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { add } from 'date-fns/add';
|
|
2
|
+
import sniffr from '../global/sniffer.js';
|
|
3
|
+
import 'sniffr';
|
|
2
4
|
|
|
3
5
|
const unit = 8; // px;
|
|
4
6
|
const units = {
|
|
@@ -50,5 +52,20 @@ function getDayNumInWeek(locale, day) {
|
|
|
50
52
|
const weekDays = shiftWeekArray(Object.values(weekdays), getWeekStartsOn(locale));
|
|
51
53
|
return weekDays.indexOf(day);
|
|
52
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Safari on iPhone doesn't allow setting scrollTop while a scroll is in progress.
|
|
57
|
+
* If you do, the browser will overwrite it during the next scroll event.
|
|
58
|
+
* This behavior occurs both during inertia scrolling and when the user is actively scrolling with a finger.
|
|
59
|
+
*
|
|
60
|
+
* In this environment, we:
|
|
61
|
+
* 1) only re-render when the scroll position is within a few pixels of the edge, and
|
|
62
|
+
* 2) only act after scrolling has ended.
|
|
63
|
+
*/
|
|
64
|
+
const isSafariOnIPhone = sniffr.browser.name === 'safari' && sniffr.device.name === 'iphone';
|
|
65
|
+
const scrollerReRenderDelayIPhone = 100;
|
|
66
|
+
// eslint-disable-next-line no-magic-numbers
|
|
67
|
+
const calendarSyncOnYearScrollUpdateDelay = isSafariOnIPhone ? 130 : 100;
|
|
68
|
+
const dateAnimationDuration = 150;
|
|
69
|
+
const yearsAnimationDuration = 200;
|
|
53
70
|
|
|
54
|
-
export { DOUBLE, FIFTH_DAY, HALF, MIDDLE_DAY, WEEK, YEAR, units as default, getDayNumInWeek, getWeekStartsOn, parseTime, shiftWeekArray, weekdays, yearDuration, yearScrollSpeed };
|
|
71
|
+
export { DOUBLE, FIFTH_DAY, HALF, MIDDLE_DAY, WEEK, YEAR, calendarSyncOnYearScrollUpdateDelay, dateAnimationDuration, units as default, getDayNumInWeek, getWeekStartsOn, isSafariOnIPhone, parseTime, scrollerReRenderDelayIPhone, shiftWeekArray, weekdays, yearDuration, yearScrollSpeed, yearsAnimationDuration };
|
|
@@ -12,11 +12,29 @@ export interface DatePickerTranslations extends Partial<DateInputTranslations> {
|
|
|
12
12
|
setPeriod: string;
|
|
13
13
|
}
|
|
14
14
|
export type DatePickerProps = Omit<DatePopupProps, 'translations' | 'parseDateInput' | 'onComplete' | 'hidden'> & {
|
|
15
|
+
/**
|
|
16
|
+
* Class name added to the root element of the control that activates the popup.
|
|
17
|
+
*/
|
|
15
18
|
className: string;
|
|
19
|
+
/**
|
|
20
|
+
* Adds a "Clear" button to the popup, which resets `date` (or `from` and `to`) to `null` when clicked.
|
|
21
|
+
*/
|
|
16
22
|
clear: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Displays the popup trigger as text, similar to a link, instead of a button.
|
|
25
|
+
*/
|
|
17
26
|
inline: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Class name added to the root element of the popup.
|
|
29
|
+
*/
|
|
18
30
|
popupClassName?: string | null | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Additional props for the Dropdown component. See **Components/Dropdown**.
|
|
33
|
+
*/
|
|
19
34
|
dropdownProps?: Partial<DropdownAttrs>;
|
|
35
|
+
/**
|
|
36
|
+
* Object with custom popup text values.
|
|
37
|
+
*/
|
|
20
38
|
translations?: DatePickerTranslations | null | undefined;
|
|
21
39
|
displayMonthFormat: (date: Date, locale: Locale | undefined) => string;
|
|
22
40
|
displayDayFormat: (date: Date, locale: Locale | undefined) => string;
|
|
@@ -27,11 +45,40 @@ export type DatePickerProps = Omit<DatePopupProps, 'translations' | 'parseDateIn
|
|
|
27
45
|
rangePlaceholder?: string;
|
|
28
46
|
disabled?: boolean | null | undefined;
|
|
29
47
|
parseDateInput: (input: string | null | undefined) => Date | null;
|
|
48
|
+
/**
|
|
49
|
+
* Horizontal size of the popup trigger control. Only applies when `inline` is `false`.
|
|
50
|
+
*/
|
|
30
51
|
size?: Size;
|
|
31
52
|
buttonAttributes?: Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'aria-label'>;
|
|
32
53
|
};
|
|
33
54
|
/**
|
|
34
|
-
*
|
|
55
|
+
* Date Picker lets users select a date, a date and time, or a date range.
|
|
56
|
+
* In the simplest mode, with a single unbounded date, the component needs only two props:
|
|
57
|
+
*
|
|
58
|
+
* - `date` to set the current date, and
|
|
59
|
+
* - `onChange` to be invoked when the user selects the date.
|
|
60
|
+
*
|
|
61
|
+
* To limit the selected date, use one or both of the following props:
|
|
62
|
+
*
|
|
63
|
+
* - `minDate`
|
|
64
|
+
* - `maxDate`
|
|
65
|
+
*
|
|
66
|
+
* To enable time input, use the `withTime` prop.
|
|
67
|
+
*
|
|
68
|
+
* To enable range selection, use the `range` prop. In this mode, use the following props
|
|
69
|
+
* instead of `date`:
|
|
70
|
+
*
|
|
71
|
+
* - `from`
|
|
72
|
+
* - `to`
|
|
73
|
+
*
|
|
74
|
+
* By default, the control that activates the popup is rendered as a button. If you want
|
|
75
|
+
* text instead, similar to a link, use the `inline` prop.
|
|
76
|
+
*
|
|
77
|
+
* The component supports internationalization. For example, in the `en-US` locale,
|
|
78
|
+
* the calendar starts on Sunday.
|
|
79
|
+
*
|
|
80
|
+
* There are also multiple ways to provide custom text and placeholders. See the props
|
|
81
|
+
* interfaces for details.
|
|
35
82
|
*/
|
|
36
83
|
export default class DatePicker extends PureComponent<DatePickerProps> {
|
|
37
84
|
static defaultProps: DatePickerProps;
|
|
@@ -28,6 +28,7 @@ import '../global/schedule-raf.js';
|
|
|
28
28
|
import '../global/dom.js';
|
|
29
29
|
import '../shortcuts/shortcuts.js';
|
|
30
30
|
import '../shortcuts/core.js';
|
|
31
|
+
import 'core-js/modules/es.array.includes.js';
|
|
31
32
|
import 'combokeys';
|
|
32
33
|
import '../global/sniffer.js';
|
|
33
34
|
import 'sniffr';
|
|
@@ -62,40 +63,40 @@ import 'date-fns';
|
|
|
62
63
|
import './date-input.js';
|
|
63
64
|
import './months.js';
|
|
64
65
|
import 'date-fns/addMonths';
|
|
65
|
-
import 'date-fns/getDay';
|
|
66
|
-
import 'date-fns/getDaysInMonth';
|
|
67
66
|
import 'date-fns/startOfMonth';
|
|
68
|
-
import 'date-fns/subMonths';
|
|
69
|
-
import 'date-fns/endOfMonth';
|
|
70
|
-
import '../global/linear-function.js';
|
|
71
|
-
import '../global/use-event-callback.js';
|
|
72
67
|
import './month.js';
|
|
73
|
-
import 'date-fns/
|
|
74
|
-
import 'date-fns/setDay';
|
|
68
|
+
import 'date-fns/getDay';
|
|
75
69
|
import './day.js';
|
|
70
|
+
import 'date-fns/addDays';
|
|
76
71
|
import 'date-fns/getDate';
|
|
77
72
|
import 'date-fns/isToday';
|
|
78
73
|
import './consts.js';
|
|
79
74
|
import 'date-fns/add';
|
|
80
|
-
import './
|
|
81
|
-
import '
|
|
82
|
-
import '
|
|
83
|
-
import '
|
|
84
|
-
import 'date-fns/addYears';
|
|
85
|
-
import 'date-fns/subYears';
|
|
75
|
+
import './use-intersection-observer.js';
|
|
76
|
+
import './scroll-arith.js';
|
|
77
|
+
import './use-scroll-behavior.js';
|
|
78
|
+
import '../global/use-event-callback.js';
|
|
86
79
|
import './years.js';
|
|
80
|
+
import 'date-fns/addYears';
|
|
87
81
|
import 'date-fns/getYear';
|
|
88
82
|
import 'date-fns/isThisYear';
|
|
89
83
|
import 'date-fns/setYear';
|
|
84
|
+
import 'date-fns/startOfYear';
|
|
85
|
+
import './animate-date.js';
|
|
90
86
|
import './weekdays.js';
|
|
87
|
+
import 'date-fns/setDay';
|
|
88
|
+
import './month-names.js';
|
|
89
|
+
import 'date-fns/isThisMonth';
|
|
90
|
+
import '../global/linear-function.js';
|
|
91
|
+
import './month-slider.js';
|
|
91
92
|
|
|
92
93
|
const PopupComponent = t0 => {
|
|
93
94
|
const $ = c(20);
|
|
94
|
-
if ($[0] !== "
|
|
95
|
+
if ($[0] !== "6c0fae779955e7446a1909ff7858d48071c9f49aa4bbd93c41f2fade36c29627") {
|
|
95
96
|
for (let $i = 0; $i < 20; $i += 1) {
|
|
96
97
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
97
98
|
}
|
|
98
|
-
$[0] = "
|
|
99
|
+
$[0] = "6c0fae779955e7446a1909ff7858d48071c9f49aa4bbd93c41f2fade36c29627";
|
|
99
100
|
}
|
|
100
101
|
let className;
|
|
101
102
|
let datePopupProps;
|
|
@@ -176,7 +177,33 @@ const PopupComponent = t0 => {
|
|
|
176
177
|
return t4;
|
|
177
178
|
};
|
|
178
179
|
/**
|
|
179
|
-
*
|
|
180
|
+
* Date Picker lets users select a date, a date and time, or a date range.
|
|
181
|
+
* In the simplest mode, with a single unbounded date, the component needs only two props:
|
|
182
|
+
*
|
|
183
|
+
* - `date` to set the current date, and
|
|
184
|
+
* - `onChange` to be invoked when the user selects the date.
|
|
185
|
+
*
|
|
186
|
+
* To limit the selected date, use one or both of the following props:
|
|
187
|
+
*
|
|
188
|
+
* - `minDate`
|
|
189
|
+
* - `maxDate`
|
|
190
|
+
*
|
|
191
|
+
* To enable time input, use the `withTime` prop.
|
|
192
|
+
*
|
|
193
|
+
* To enable range selection, use the `range` prop. In this mode, use the following props
|
|
194
|
+
* instead of `date`:
|
|
195
|
+
*
|
|
196
|
+
* - `from`
|
|
197
|
+
* - `to`
|
|
198
|
+
*
|
|
199
|
+
* By default, the control that activates the popup is rendered as a button. If you want
|
|
200
|
+
* text instead, similar to a link, use the `inline` prop.
|
|
201
|
+
*
|
|
202
|
+
* The component supports internationalization. For example, in the `en-US` locale,
|
|
203
|
+
* the calendar starts on Sunday.
|
|
204
|
+
*
|
|
205
|
+
* There are also multiple ways to provide custom text and placeholders. See the props
|
|
206
|
+
* interfaces for details.
|
|
180
207
|
*/
|
|
181
208
|
class DatePicker extends PureComponent {
|
|
182
209
|
static defaultProps = {
|
|
@@ -1,34 +1,28 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { type DatePickerChange, type DatePopupBaseProps, type DateSpecificPopupProps, type DatePopupState, type RangeSpecificPopupProps, type TimeSpecificPopupProps, type Field } from './consts';
|
|
3
|
+
import { type DatePickerChange, type DatePopupBaseProps, type DateSpecificPopupProps, type DatePopupState, type RangeSpecificPopupProps, type TimeSpecificPopupProps, type Field, type ScrollDate } from './consts';
|
|
4
4
|
export type DatePopupProps = DatePopupBaseProps & (DateSpecificPopupProps | TimeSpecificPopupProps | RangeSpecificPopupProps);
|
|
5
5
|
export default class DatePopup extends Component<DatePopupProps, DatePopupState> {
|
|
6
|
-
static sameDay(next: Date | number | null, prev: Date | number | null): boolean;
|
|
7
6
|
static defaultProps: {
|
|
8
7
|
onChange(): void;
|
|
9
8
|
};
|
|
10
9
|
constructor(props: DatePopupProps);
|
|
11
|
-
componentDidMount(): void;
|
|
12
10
|
componentDidUpdate(prevProps: DatePopupBaseProps, prevState: DatePopupState): void;
|
|
13
11
|
componentWillUnmount(): void;
|
|
14
|
-
private
|
|
15
|
-
private _scrollTS?;
|
|
12
|
+
private animationCleanup;
|
|
16
13
|
isInTimeMode: () => boolean;
|
|
17
14
|
componentRef: React.RefObject<HTMLDivElement | null>;
|
|
18
|
-
handleWheel: (e: WheelEvent) => void;
|
|
19
15
|
parse(text: string | null | undefined, type: 'time'): string;
|
|
20
16
|
parse(text: Date | number | string | null | undefined, type?: 'date' | 'from' | 'to'): Date;
|
|
21
17
|
select(changes: DatePickerChange): void;
|
|
22
18
|
confirm(name: Field): void;
|
|
23
19
|
isValidDate: (parsedText: Date) => boolean;
|
|
24
|
-
scheduleScroll: () => void;
|
|
25
|
-
scrollTo: (scrollDate: number) => void;
|
|
26
20
|
hoverHandler: (hoverDate: Date) => void;
|
|
27
21
|
handleActivate: (arg: Field) => () => void;
|
|
28
22
|
handleInput: (text: string, name: Field) => void;
|
|
29
23
|
handleConfirm: (arg: Field) => () => void;
|
|
30
24
|
selectHandler: (date: Date) => void;
|
|
31
|
-
|
|
25
|
+
setScrollDate: (scrollDate: ScrollDate) => void;
|
|
32
26
|
onClear: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
33
27
|
render(): React.JSX.Element;
|
|
34
28
|
}
|