@itwin/itwinui-react 1.34.0 → 1.35.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/CHANGELOG.md +27 -0
- package/cjs/core/ButtonGroup/ButtonGroup.js +1 -0
- package/cjs/core/Carousel/Carousel.d.ts +68 -0
- package/cjs/core/Carousel/Carousel.js +130 -0
- package/cjs/core/Carousel/CarouselContext.d.ts +37 -0
- package/cjs/core/Carousel/CarouselContext.js +12 -0
- package/cjs/core/Carousel/CarouselDot.d.ts +13 -0
- package/cjs/core/Carousel/CarouselDot.js +46 -0
- package/cjs/core/Carousel/CarouselDotsList.d.ts +32 -0
- package/cjs/core/Carousel/CarouselDotsList.js +132 -0
- package/cjs/core/Carousel/CarouselNavigation.d.ts +15 -0
- package/cjs/core/Carousel/CarouselNavigation.js +88 -0
- package/cjs/core/Carousel/CarouselSlide.d.ts +14 -0
- package/cjs/core/Carousel/CarouselSlide.js +63 -0
- package/cjs/core/Carousel/CarouselSlider.d.ts +5 -0
- package/cjs/core/Carousel/CarouselSlider.js +94 -0
- package/cjs/core/Carousel/index.d.ts +4 -0
- package/cjs/core/Carousel/index.js +10 -0
- package/cjs/core/ComboBox/ComboBox.js +2 -2
- package/cjs/core/DatePicker/DatePicker.d.ts +5 -0
- package/cjs/core/DatePicker/DatePicker.js +38 -13
- package/cjs/core/Modal/Modal.d.ts +5 -0
- package/cjs/core/Modal/Modal.js +11 -9
- package/cjs/core/Modal/ModalContent.d.ts +14 -0
- package/cjs/core/Modal/ModalContent.js +46 -0
- package/cjs/core/Modal/index.d.ts +2 -0
- package/cjs/core/Modal/index.js +3 -1
- package/cjs/core/Table/Table.js +8 -7
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +18 -2
- package/cjs/core/index.d.ts +4 -2
- package/cjs/core/index.js +6 -2
- package/cjs/core/utils/hooks/index.d.ts +1 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useMediaQuery.d.ts +2 -0
- package/cjs/core/utils/hooks/useMediaQuery.js +46 -0
- package/cjs/core/utils/hooks/useTheme.d.ts +5 -0
- package/cjs/core/utils/hooks/useTheme.js +20 -14
- package/esm/core/ButtonGroup/ButtonGroup.js +1 -0
- package/esm/core/Carousel/Carousel.d.ts +68 -0
- package/esm/core/Carousel/Carousel.js +124 -0
- package/esm/core/Carousel/CarouselContext.d.ts +37 -0
- package/esm/core/Carousel/CarouselContext.js +6 -0
- package/esm/core/Carousel/CarouselDot.d.ts +13 -0
- package/esm/core/Carousel/CarouselDot.js +40 -0
- package/esm/core/Carousel/CarouselDotsList.d.ts +32 -0
- package/esm/core/Carousel/CarouselDotsList.js +126 -0
- package/esm/core/Carousel/CarouselNavigation.d.ts +15 -0
- package/esm/core/Carousel/CarouselNavigation.js +82 -0
- package/esm/core/Carousel/CarouselSlide.d.ts +14 -0
- package/esm/core/Carousel/CarouselSlide.js +57 -0
- package/esm/core/Carousel/CarouselSlider.d.ts +5 -0
- package/esm/core/Carousel/CarouselSlider.js +88 -0
- package/esm/core/Carousel/index.d.ts +4 -0
- package/esm/core/Carousel/index.js +6 -0
- package/esm/core/ComboBox/ComboBox.js +2 -2
- package/esm/core/DatePicker/DatePicker.d.ts +5 -0
- package/esm/core/DatePicker/DatePicker.js +38 -13
- package/esm/core/Modal/Modal.d.ts +5 -0
- package/esm/core/Modal/Modal.js +11 -9
- package/esm/core/Modal/ModalContent.d.ts +14 -0
- package/esm/core/Modal/ModalContent.js +39 -0
- package/esm/core/Modal/index.d.ts +2 -0
- package/esm/core/Modal/index.js +1 -0
- package/esm/core/Table/Table.js +8 -7
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +18 -2
- package/esm/core/index.d.ts +4 -2
- package/esm/core/index.js +2 -1
- package/esm/core/utils/hooks/index.d.ts +1 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useMediaQuery.d.ts +2 -0
- package/esm/core/utils/hooks/useMediaQuery.js +39 -0
- package/esm/core/utils/hooks/useTheme.d.ts +5 -0
- package/esm/core/utils/hooks/useTheme.js +20 -14
- package/package.json +3 -2
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
/*---------------------------------------------------------------------------------------------
|
|
24
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
|
+
*--------------------------------------------------------------------------------------------*/
|
|
27
|
+
import React from 'react';
|
|
28
|
+
import cx from 'classnames';
|
|
29
|
+
import { CarouselContext } from './CarouselContext';
|
|
30
|
+
import { IconButton } from '../Buttons';
|
|
31
|
+
import { CarouselDotsList } from './CarouselDotsList';
|
|
32
|
+
import SvgChevronLeft from '@itwin/itwinui-icons-react/cjs/icons/ChevronLeft';
|
|
33
|
+
import SvgChevronRight from '@itwin/itwinui-icons-react/cjs/icons/ChevronRight';
|
|
34
|
+
/** Button for switching to previous slide */
|
|
35
|
+
var PreviousButton = React.forwardRef(function (props, ref) {
|
|
36
|
+
var context = React.useContext(CarouselContext);
|
|
37
|
+
if (!context) {
|
|
38
|
+
throw new Error('CarouselNavigation should be used inside Carousel');
|
|
39
|
+
}
|
|
40
|
+
var slideCount = context.slideCount, setCurrentIndex = context.setCurrentIndex, keysPressed = context.keysPressed, scrollInstantly = context.scrollInstantly;
|
|
41
|
+
return (React.createElement(IconButton, __assign({ styleType: 'borderless', size: 'small', tabIndex: -1, "data-pressed": keysPressed['ArrowLeft'] || undefined, ref: ref }, props, { onClick: function (e) {
|
|
42
|
+
var _a;
|
|
43
|
+
if (e.detail > 3) {
|
|
44
|
+
scrollInstantly.current = true;
|
|
45
|
+
}
|
|
46
|
+
setCurrentIndex(function (old) { return (slideCount + old - 1) % slideCount; });
|
|
47
|
+
(_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
48
|
+
} }),
|
|
49
|
+
React.createElement(SvgChevronLeft, null)));
|
|
50
|
+
});
|
|
51
|
+
/** Button for switching to next slide */
|
|
52
|
+
var NextButton = React.forwardRef(function (props, ref) {
|
|
53
|
+
var context = React.useContext(CarouselContext);
|
|
54
|
+
if (!context) {
|
|
55
|
+
throw new Error('CarouselNavigation should be used inside Carousel');
|
|
56
|
+
}
|
|
57
|
+
var slideCount = context.slideCount, setCurrentIndex = context.setCurrentIndex, keysPressed = context.keysPressed, scrollInstantly = context.scrollInstantly;
|
|
58
|
+
return (React.createElement(IconButton, __assign({ styleType: 'borderless', size: 'small', tabIndex: -1, "data-pressed": keysPressed['ArrowRight'] || undefined, ref: ref }, props, { onClick: function (e) {
|
|
59
|
+
var _a;
|
|
60
|
+
if (e.detail > 3) {
|
|
61
|
+
scrollInstantly.current = true;
|
|
62
|
+
}
|
|
63
|
+
setCurrentIndex(function (old) { return (slideCount + old + 1) % slideCount; });
|
|
64
|
+
(_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
65
|
+
} }),
|
|
66
|
+
React.createElement(SvgChevronRight, null)));
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* The `CarouselNavigation` component by default consists of the `PreviousButton` and `NextButton`
|
|
70
|
+
* shown on the left and right, and the `CarouselDotsList` component shown in the middle.
|
|
71
|
+
*
|
|
72
|
+
* `children` can be specified to override what is shown in this navigation section.
|
|
73
|
+
*/
|
|
74
|
+
export var CarouselNavigation = Object.assign(React.forwardRef(function (props, ref) {
|
|
75
|
+
var className = props.className, children = props.children, rest = __rest(props, ["className", "children"]);
|
|
76
|
+
return (React.createElement("nav", __assign({ className: cx('iui-carousel-navigation', className), ref: ref }, rest), children !== null && children !== void 0 ? children : (React.createElement(React.Fragment, null,
|
|
77
|
+
React.createElement("div", { className: 'iui-carousel-navigation-left' },
|
|
78
|
+
React.createElement(PreviousButton, null)),
|
|
79
|
+
React.createElement(CarouselDotsList, null),
|
|
80
|
+
React.createElement("div", { className: 'iui-carousel-navigation-right' },
|
|
81
|
+
React.createElement(NextButton, null))))));
|
|
82
|
+
}), { PreviousButton: PreviousButton, NextButton: NextButton });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `CarouselSlide` is used for the actual slide content. The content can be specified through `children`.
|
|
4
|
+
*
|
|
5
|
+
* It is recommended that the slide content bring its own dimensions (esp. height) and that
|
|
6
|
+
* the dimensions should be the same for all slides.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CarouselSlide: React.ForwardRefExoticComponent<{
|
|
9
|
+
/**
|
|
10
|
+
* Index of the current slide.
|
|
11
|
+
* Does not need to be manually specified because it will be set in parent (`CarouselSlider`).
|
|
12
|
+
*/
|
|
13
|
+
index?: number | undefined;
|
|
14
|
+
} & Pick<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof React.LiHTMLAttributes<HTMLLIElement>> & React.RefAttributes<HTMLLIElement>>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
/*---------------------------------------------------------------------------------------------
|
|
24
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
|
+
*--------------------------------------------------------------------------------------------*/
|
|
27
|
+
import React from 'react';
|
|
28
|
+
import cx from 'classnames';
|
|
29
|
+
import { useIntersection, useMergedRefs } from '../utils';
|
|
30
|
+
import { CarouselContext } from './CarouselContext';
|
|
31
|
+
/**
|
|
32
|
+
* `CarouselSlide` is used for the actual slide content. The content can be specified through `children`.
|
|
33
|
+
*
|
|
34
|
+
* It is recommended that the slide content bring its own dimensions (esp. height) and that
|
|
35
|
+
* the dimensions should be the same for all slides.
|
|
36
|
+
*/
|
|
37
|
+
export var CarouselSlide = React.forwardRef(function (props, ref) {
|
|
38
|
+
var index = props.index, className = props.className, children = props.children, rest = __rest(props, ["index", "className", "children"]);
|
|
39
|
+
var context = React.useContext(CarouselContext);
|
|
40
|
+
if (!context || index == null) {
|
|
41
|
+
throw new Error('CarouselSlide must be used within Carousel');
|
|
42
|
+
}
|
|
43
|
+
var currentIndex = context.currentIndex, isManuallyUpdating = context.isManuallyUpdating, setCurrentIndex = context.setCurrentIndex;
|
|
44
|
+
var updateActiveIndexOnScroll = React.useCallback(function () {
|
|
45
|
+
// only update index if scroll was triggered by browser
|
|
46
|
+
if (!isManuallyUpdating.current && currentIndex !== index) {
|
|
47
|
+
setCurrentIndex(index);
|
|
48
|
+
}
|
|
49
|
+
// when manual scroll completes, reset the state of `isManuallyUpdating` so that it's ready for future actions
|
|
50
|
+
if (currentIndex === index) {
|
|
51
|
+
isManuallyUpdating.current = false;
|
|
52
|
+
}
|
|
53
|
+
}, [currentIndex, index, isManuallyUpdating, setCurrentIndex]);
|
|
54
|
+
var intersectionRef = useIntersection(updateActiveIndexOnScroll, { threshold: 0.5 }, false);
|
|
55
|
+
var refs = useMergedRefs(intersectionRef, ref);
|
|
56
|
+
return (React.createElement("li", __assign({ className: cx('iui-carousel-slider-item', className), role: 'tabpanel', "aria-roledescription": 'slide', ref: refs }, rest), children));
|
|
57
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `CarouselSlider` is the scrollable list that should consist of `CarouselSlide` components.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CarouselSlider: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "key" | keyof React.OlHTMLAttributes<HTMLOListElement>> & React.RefAttributes<HTMLOListElement>>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
/*---------------------------------------------------------------------------------------------
|
|
24
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
|
+
*--------------------------------------------------------------------------------------------*/
|
|
27
|
+
import React from 'react';
|
|
28
|
+
import cx from 'classnames';
|
|
29
|
+
import { CarouselContext } from './CarouselContext';
|
|
30
|
+
import { getWindow, useMergedRefs, useResizeObserver } from '../utils';
|
|
31
|
+
/**
|
|
32
|
+
* `CarouselSlider` is the scrollable list that should consist of `CarouselSlide` components.
|
|
33
|
+
*/
|
|
34
|
+
export var CarouselSlider = React.forwardRef(function (props, ref) {
|
|
35
|
+
var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
|
|
36
|
+
var context = React.useContext(CarouselContext);
|
|
37
|
+
if (!context) {
|
|
38
|
+
throw new Error('CarouselSlider must be used within Carousel');
|
|
39
|
+
}
|
|
40
|
+
var currentIndex = context.currentIndex, setSlideCount = context.setSlideCount, idPrefix = context.idPrefix, isManuallyUpdating = context.isManuallyUpdating, scrollInstantly = context.scrollInstantly;
|
|
41
|
+
var items = React.useMemo(function () {
|
|
42
|
+
var _a;
|
|
43
|
+
return (_a = React.Children.map(children, function (child, index) {
|
|
44
|
+
return React.isValidElement(child)
|
|
45
|
+
? React.cloneElement(child, {
|
|
46
|
+
id: idPrefix + "--slide-" + index,
|
|
47
|
+
index: index,
|
|
48
|
+
})
|
|
49
|
+
: child;
|
|
50
|
+
})) !== null && _a !== void 0 ? _a : [];
|
|
51
|
+
}, [children, idPrefix]);
|
|
52
|
+
React.useLayoutEffect(function () {
|
|
53
|
+
setSlideCount(items.length);
|
|
54
|
+
}, [items.length, setSlideCount]);
|
|
55
|
+
var _a = React.useState(), width = _a[0], setWidth = _a[1];
|
|
56
|
+
var resizeRef = useResizeObserver(function (_a) {
|
|
57
|
+
var width = _a.width;
|
|
58
|
+
return setWidth(width);
|
|
59
|
+
})[0];
|
|
60
|
+
var sliderRef = React.useRef(null);
|
|
61
|
+
var refs = useMergedRefs(sliderRef, resizeRef, ref);
|
|
62
|
+
var justMounted = React.useRef(true);
|
|
63
|
+
var previousWidth = React.useRef();
|
|
64
|
+
React.useLayoutEffect(function () {
|
|
65
|
+
var _a, _b, _c;
|
|
66
|
+
var slideToShow = (_a = sliderRef.current) === null || _a === void 0 ? void 0 : _a.children.item(currentIndex);
|
|
67
|
+
if (!sliderRef.current ||
|
|
68
|
+
!slideToShow ||
|
|
69
|
+
(!isManuallyUpdating.current && previousWidth.current === width)) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
// instant scroll on first mount
|
|
73
|
+
if (justMounted.current) {
|
|
74
|
+
scrollInstantly.current = true;
|
|
75
|
+
justMounted.current = false;
|
|
76
|
+
}
|
|
77
|
+
var motionOk = (_c = (_b = getWindow()) === null || _b === void 0 ? void 0 : _b.matchMedia('(prefers-reduced-motion: no-preference)')) === null || _c === void 0 ? void 0 : _c.matches;
|
|
78
|
+
sliderRef.current.scrollTo({
|
|
79
|
+
left: slideToShow.offsetLeft - sliderRef.current.offsetLeft,
|
|
80
|
+
behavior: (scrollInstantly.current || !motionOk
|
|
81
|
+
? 'instant'
|
|
82
|
+
: 'smooth'), // scrollTo accepts 'instant' but ScrollBehavior type is wrong
|
|
83
|
+
});
|
|
84
|
+
scrollInstantly.current = false;
|
|
85
|
+
previousWidth.current = width;
|
|
86
|
+
}, [currentIndex, isManuallyUpdating, scrollInstantly, width]);
|
|
87
|
+
return (React.createElement("ol", __assign({ "aria-live": 'polite', className: cx('iui-carousel-slider', className), ref: refs }, rest), items));
|
|
88
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
export { Carousel } from './Carousel';
|
|
6
|
+
export default './Carousel';
|
|
@@ -294,9 +294,9 @@ export var ComboBox = function (props) {
|
|
|
294
294
|
}
|
|
295
295
|
(_a = dropdownMenuProps === null || dropdownMenuProps === void 0 ? void 0 : dropdownMenuProps.onHide) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, instance);
|
|
296
296
|
} }),
|
|
297
|
-
React.createElement(Input, __assign({ ref: inputRef, onKeyDown: onKeyDown, onFocus: function () { return setIsOpen(true); },
|
|
297
|
+
React.createElement(Input, __assign({ ref: inputRef, onKeyDown: onKeyDown, onFocus: function () { return setIsOpen(true); }, value: inputValue, "aria-activedescendant": isOpen && focusedIndex > -1
|
|
298
298
|
? getOptionId(focusedIndex)
|
|
299
|
-
: undefined, role: 'combobox', "aria-controls": isOpen ? id + "-list" : undefined, "aria-autocomplete": 'list', spellCheck: false, autoCapitalize: 'none', autoCorrect: 'off' }, inputProps))),
|
|
299
|
+
: undefined, role: 'combobox', "aria-controls": isOpen ? id + "-list" : undefined, "aria-autocomplete": 'list', spellCheck: false, autoCapitalize: 'none', autoCorrect: 'off' }, inputProps, { onChange: onInput }))),
|
|
300
300
|
React.createElement("span", { ref: toggleButtonRef, className: cx('iui-end-icon', {
|
|
301
301
|
'iui-actionable': !(inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled),
|
|
302
302
|
'iui-disabled': inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled,
|
|
@@ -36,6 +36,11 @@ export declare type DatePickerProps = {
|
|
|
36
36
|
* @default false
|
|
37
37
|
*/
|
|
38
38
|
showTime?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Show additional buttons to select year.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
showYearSelection?: boolean;
|
|
39
44
|
} & Omit<TimePickerProps, 'date' | 'onChange' | 'setFocusHour'>;
|
|
40
45
|
/**
|
|
41
46
|
* Date picker component
|
|
@@ -26,6 +26,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
26
26
|
*--------------------------------------------------------------------------------------------*/
|
|
27
27
|
import SvgChevronLeft from '@itwin/itwinui-icons-react/cjs/icons/ChevronLeft';
|
|
28
28
|
import SvgChevronRight from '@itwin/itwinui-icons-react/cjs/icons/ChevronRight';
|
|
29
|
+
import SvgChevronLeftDouble from '@itwin/itwinui-icons-react/cjs/icons/ChevronLeftDouble';
|
|
30
|
+
import SvgChevronRightDouble from '@itwin/itwinui-icons-react/cjs/icons/ChevronRightDouble';
|
|
29
31
|
import cx from 'classnames';
|
|
30
32
|
import React from 'react';
|
|
31
33
|
import { useTheme } from '../utils';
|
|
@@ -120,15 +122,15 @@ export var generateLocalizedStrings = function (locale) {
|
|
|
120
122
|
*/
|
|
121
123
|
export var DatePicker = function (props) {
|
|
122
124
|
var _a, _b, _c;
|
|
123
|
-
var date = props.date, onChange = props.onChange, localizedNames = props.localizedNames, className = props.className, style = props.style, _d = props.setFocus, setFocus = _d === void 0 ? false : _d, _e = props.showTime, showTime = _e === void 0 ? false : _e, _f = props.use12Hours, use12Hours = _f === void 0 ? false : _f, precision = props.precision, hourStep = props.hourStep, minuteStep = props.minuteStep, secondStep = props.secondStep, rest = __rest(props, ["date", "onChange", "localizedNames", "className", "style", "setFocus", "showTime", "use12Hours", "precision", "hourStep", "minuteStep", "secondStep"]);
|
|
125
|
+
var date = props.date, onChange = props.onChange, localizedNames = props.localizedNames, className = props.className, style = props.style, _d = props.setFocus, setFocus = _d === void 0 ? false : _d, _e = props.showTime, showTime = _e === void 0 ? false : _e, _f = props.use12Hours, use12Hours = _f === void 0 ? false : _f, precision = props.precision, hourStep = props.hourStep, minuteStep = props.minuteStep, secondStep = props.secondStep, _g = props.showYearSelection, showYearSelection = _g === void 0 ? false : _g, rest = __rest(props, ["date", "onChange", "localizedNames", "className", "style", "setFocus", "showTime", "use12Hours", "precision", "hourStep", "minuteStep", "secondStep", "showYearSelection"]);
|
|
124
126
|
useTheme();
|
|
125
127
|
var monthNames = (_a = localizedNames === null || localizedNames === void 0 ? void 0 : localizedNames.months) !== null && _a !== void 0 ? _a : defaultMonths;
|
|
126
128
|
var shortDays = (_b = localizedNames === null || localizedNames === void 0 ? void 0 : localizedNames.shortDays) !== null && _b !== void 0 ? _b : defaultShortDays;
|
|
127
129
|
var longDays = (_c = localizedNames === null || localizedNames === void 0 ? void 0 : localizedNames.days) !== null && _c !== void 0 ? _c : defaultLongDays;
|
|
128
|
-
var
|
|
129
|
-
var
|
|
130
|
-
var
|
|
131
|
-
var
|
|
130
|
+
var _h = React.useState(date), selectedDay = _h[0], setSelectedDay = _h[1];
|
|
131
|
+
var _j = React.useState(selectedDay !== null && selectedDay !== void 0 ? selectedDay : new Date()), focusedDay = _j[0], setFocusedDay = _j[1];
|
|
132
|
+
var _k = React.useState(selectedDay ? selectedDay.getMonth() : new Date().getMonth()), displayedMonthIndex = _k[0], setDisplayedMonthIndex = _k[1];
|
|
133
|
+
var _l = React.useState(selectedDay ? selectedDay.getFullYear() : new Date().getFullYear()), displayedYear = _l[0], setDisplayedYear = _l[1];
|
|
132
134
|
// Used to focus days only when days are changed
|
|
133
135
|
// e.g. without this, when changing months day would be focused
|
|
134
136
|
var needFocus = React.useRef(setFocus);
|
|
@@ -174,6 +176,16 @@ export var DatePicker = function (props) {
|
|
|
174
176
|
var newDate = new Date(newYear, newMonth, currentDate.getDate(), currentDate.getHours(), currentDate.getMinutes(), currentDate.getSeconds());
|
|
175
177
|
return newDate;
|
|
176
178
|
};
|
|
179
|
+
var handleMoveToPreviousYear = function () {
|
|
180
|
+
var newYear = displayedYear - 1;
|
|
181
|
+
setMonthAndYear(displayedMonthIndex, newYear);
|
|
182
|
+
setFocusedDay(getNewFocusedDate(newYear, displayedMonthIndex));
|
|
183
|
+
};
|
|
184
|
+
var handleMoveToNextYear = function () {
|
|
185
|
+
var newYear = displayedYear + 1;
|
|
186
|
+
setMonthAndYear(displayedMonthIndex, newYear);
|
|
187
|
+
setFocusedDay(getNewFocusedDate(newYear, displayedMonthIndex));
|
|
188
|
+
};
|
|
177
189
|
var handleMoveToPreviousMonth = function () {
|
|
178
190
|
var newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;
|
|
179
191
|
var newYear = displayedMonthIndex !== 0 ? displayedYear : displayedYear - 1;
|
|
@@ -246,26 +258,39 @@ export var DatePicker = function (props) {
|
|
|
246
258
|
break;
|
|
247
259
|
}
|
|
248
260
|
};
|
|
261
|
+
var getDayClass = function (day) {
|
|
262
|
+
if (day.getMonth() !== displayedMonthIndex) {
|
|
263
|
+
return 'iui-calendar-day-outside-month';
|
|
264
|
+
}
|
|
265
|
+
var dayClass = 'iui-calendar-day';
|
|
266
|
+
if (isSameDay(day, selectedDay)) {
|
|
267
|
+
dayClass += '-selected';
|
|
268
|
+
}
|
|
269
|
+
if (isSameDay(day, new Date())) {
|
|
270
|
+
dayClass += '-today';
|
|
271
|
+
}
|
|
272
|
+
return dayClass;
|
|
273
|
+
};
|
|
249
274
|
return (React.createElement("div", __assign({ className: cx('iui-date-picker', className), style: style }, rest),
|
|
250
275
|
React.createElement("div", null,
|
|
251
276
|
React.createElement("div", { className: 'iui-calendar-month-year' },
|
|
252
|
-
React.createElement(IconButton, { styleType: 'borderless', onClick:
|
|
277
|
+
showYearSelection && (React.createElement(IconButton, { styleType: 'borderless', onClick: handleMoveToPreviousYear, "aria-label": 'Previous year', size: 'small' },
|
|
278
|
+
React.createElement(SvgChevronLeftDouble, null))),
|
|
279
|
+
React.createElement(IconButton, { styleType: 'borderless', onClick: handleMoveToPreviousMonth, "aria-label": 'Previous month', size: 'small' },
|
|
253
280
|
React.createElement(SvgChevronLeft, null)),
|
|
254
281
|
React.createElement("span", { "aria-live": 'polite' },
|
|
255
282
|
React.createElement("span", { className: 'iui-calendar-month', title: monthNames[displayedMonthIndex] }, monthNames[displayedMonthIndex]),
|
|
256
283
|
"\u00A0",
|
|
257
284
|
displayedYear),
|
|
258
|
-
React.createElement(IconButton, { styleType: 'borderless', onClick: handleMoveToNextMonth, "aria-label": 'Next month' },
|
|
259
|
-
React.createElement(SvgChevronRight, null))
|
|
285
|
+
React.createElement(IconButton, { styleType: 'borderless', onClick: handleMoveToNextMonth, "aria-label": 'Next month', size: 'small' },
|
|
286
|
+
React.createElement(SvgChevronRight, null)),
|
|
287
|
+
showYearSelection && (React.createElement(IconButton, { styleType: 'borderless', onClick: handleMoveToNextYear, "aria-label": 'Next year', size: 'small' },
|
|
288
|
+
React.createElement(SvgChevronRightDouble, null)))),
|
|
260
289
|
React.createElement("div", { className: 'iui-calendar-weekdays' }, shortDays.map(function (day, index) { return (React.createElement("div", { key: day, title: longDays[index] }, day)); })),
|
|
261
290
|
React.createElement("div", { onKeyDown: handleCalendarKeyDown, role: 'listbox' }, weeks.map(function (weekDays, weekIndex) {
|
|
262
291
|
return (React.createElement("div", { key: "week-" + displayedMonthIndex + "-" + weekIndex, className: 'iui-calendar-week' }, weekDays.map(function (weekDay, dayIndex) {
|
|
263
292
|
var dateValue = weekDay.getDate();
|
|
264
|
-
return (React.createElement("div", { key: "day-" + displayedMonthIndex + "-" + dayIndex, className:
|
|
265
|
-
'iui-outside-month': weekDay.getMonth() !== displayedMonthIndex,
|
|
266
|
-
'iui-today': isSameDay(weekDay, new Date()),
|
|
267
|
-
'iui-selected': isSameDay(weekDay, selectedDay),
|
|
268
|
-
}), onClick: function () { return onDayClick(weekDay); }, role: 'option', tabIndex: isSameDay(weekDay, focusedDay) ? 0 : -1, ref: function (element) {
|
|
293
|
+
return (React.createElement("div", { key: "day-" + displayedMonthIndex + "-" + dayIndex, className: getDayClass(weekDay), onClick: function () { return onDayClick(weekDay); }, role: 'option', tabIndex: isSameDay(weekDay, focusedDay) ? 0 : -1, ref: function (element) {
|
|
269
294
|
return isSameDay(weekDay, focusedDay) &&
|
|
270
295
|
needFocus.current &&
|
|
271
296
|
(element === null || element === void 0 ? void 0 : element.focus());
|
package/esm/core/Modal/Modal.js
CHANGED
|
@@ -31,6 +31,7 @@ import SvgClose from '@itwin/itwinui-icons-react/cjs/icons/Close';
|
|
|
31
31
|
import { useTheme, getContainer, getDocument, FocusTrap, } from '../utils';
|
|
32
32
|
import '@itwin/itwinui-css/css/modal.css';
|
|
33
33
|
import { IconButton } from '../Buttons/IconButton';
|
|
34
|
+
import { CSSTransition } from 'react-transition-group';
|
|
34
35
|
/**
|
|
35
36
|
* Modal component which can wrap any content.
|
|
36
37
|
* @example
|
|
@@ -53,7 +54,7 @@ import { IconButton } from '../Buttons/IconButton';
|
|
|
53
54
|
* </Modal>
|
|
54
55
|
*/
|
|
55
56
|
export var Modal = function (props) {
|
|
56
|
-
var _a = props.isOpen, isOpen = _a === void 0 ? false : _a, _b = props.isDismissible, isDismissible = _b === void 0 ? true : _b, _c = props.closeOnEsc, closeOnEsc = _c === void 0 ? true : _c, _d = props.closeOnExternalClick, closeOnExternalClick = _d === void 0 ? true : _d, onClose = props.onClose, title = props.title, onKeyDown = props.onKeyDown, id = props.id, className = props.className, style = props.style, children = props.children, _e = props.modalRootId, modalRootId =
|
|
57
|
+
var _a = props.isOpen, isOpen = _a === void 0 ? false : _a, _b = props.isDismissible, isDismissible = _b === void 0 ? true : _b, _c = props.closeOnEsc, closeOnEsc = _c === void 0 ? true : _c, _d = props.closeOnExternalClick, closeOnExternalClick = _d === void 0 ? true : _d, onClose = props.onClose, title = props.title, onKeyDown = props.onKeyDown, id = props.id, className = props.className, style = props.style, children = props.children, _e = props.styleType, styleType = _e === void 0 ? 'default' : _e, _f = props.modalRootId, modalRootId = _f === void 0 ? 'iui-react-portal-container' : _f, _g = props.ownerDocument, ownerDocument = _g === void 0 ? getDocument() : _g, rest = __rest(props, ["isOpen", "isDismissible", "closeOnEsc", "closeOnExternalClick", "onClose", "title", "onKeyDown", "id", "className", "style", "children", "styleType", "modalRootId", "ownerDocument"]);
|
|
57
58
|
useTheme();
|
|
58
59
|
var container = getContainer(modalRootId, ownerDocument);
|
|
59
60
|
var overlayRef = React.useRef(null);
|
|
@@ -111,13 +112,14 @@ export var Modal = function (props) {
|
|
|
111
112
|
onClose(event);
|
|
112
113
|
}
|
|
113
114
|
};
|
|
114
|
-
return !!container ? (ReactDOM.createPortal(
|
|
115
|
-
React.createElement(
|
|
116
|
-
React.createElement("div", { className: 'iui-modal-
|
|
117
|
-
React.createElement("div", { className: 'iui-
|
|
118
|
-
React.createElement("div", { className: 'iui-title' },
|
|
119
|
-
|
|
120
|
-
React.createElement(
|
|
121
|
-
|
|
115
|
+
return !!container ? (ReactDOM.createPortal(React.createElement(CSSTransition, { in: isOpen, classNames: 'iui-modal-animation', timeout: { exit: 600 }, unmountOnExit: true },
|
|
116
|
+
React.createElement(FocusTrap, null,
|
|
117
|
+
React.createElement("div", __assign({ className: cx('iui-modal', { 'iui-modal-full-page': styleType === 'fullPage' }, { 'iui-modal-visible': isOpen }, className), tabIndex: -1, onKeyDown: handleKeyDown, ref: overlayRef, onMouseDown: handleMouseDown }, rest),
|
|
118
|
+
React.createElement("div", { className: 'iui-modal-dialog', id: id, style: style, role: 'dialog', "aria-modal": 'true' },
|
|
119
|
+
React.createElement("div", { className: 'iui-title-bar' },
|
|
120
|
+
React.createElement("div", { className: 'iui-title' }, title),
|
|
121
|
+
isDismissible && (React.createElement(IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close' },
|
|
122
|
+
React.createElement(SvgClose, null)))),
|
|
123
|
+
children)))), container)) : (React.createElement(React.Fragment, null));
|
|
122
124
|
};
|
|
123
125
|
export default Modal;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CommonProps } from '../utils';
|
|
3
|
+
import '@itwin/itwinui-css/css/modal.css';
|
|
4
|
+
export declare type ModalContentProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Main content in the `Modal`.
|
|
7
|
+
*/
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
} & Omit<CommonProps, 'title'>;
|
|
10
|
+
/**
|
|
11
|
+
* Container for content in `Modal`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const ModalContent: (props: ModalContentProps) => JSX.Element;
|
|
14
|
+
export default ModalContent;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
/*---------------------------------------------------------------------------------------------
|
|
24
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
|
+
*--------------------------------------------------------------------------------------------*/
|
|
27
|
+
import React from 'react';
|
|
28
|
+
import cx from 'classnames';
|
|
29
|
+
import { useTheme } from '../utils';
|
|
30
|
+
import '@itwin/itwinui-css/css/modal.css';
|
|
31
|
+
/**
|
|
32
|
+
* Container for content in `Modal`.
|
|
33
|
+
*/
|
|
34
|
+
export var ModalContent = function (props) {
|
|
35
|
+
var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
|
|
36
|
+
useTheme();
|
|
37
|
+
return (React.createElement("div", __assign({ className: cx('iui-modal-content', className) }, rest), children));
|
|
38
|
+
};
|
|
39
|
+
export default ModalContent;
|
|
@@ -2,5 +2,7 @@ export { Modal } from './Modal';
|
|
|
2
2
|
export type { ModalProps } from './Modal';
|
|
3
3
|
export { ModalButtonBar } from './ModalButtonBar';
|
|
4
4
|
export type { ModalButtonBarProps } from './ModalButtonBar';
|
|
5
|
+
export { ModalContent } from './ModalContent';
|
|
6
|
+
export type { ModalContentProps } from './ModalContent';
|
|
5
7
|
declare const _default: "./Modal";
|
|
6
8
|
export default _default;
|
package/esm/core/Modal/index.js
CHANGED
package/esm/core/Table/Table.js
CHANGED
|
@@ -228,11 +228,12 @@ export var Table = function (props) {
|
|
|
228
228
|
});
|
|
229
229
|
var headerRef = React.useRef(null);
|
|
230
230
|
var bodyRef = React.useRef(null);
|
|
231
|
-
var getPreparedRow = React.useCallback(function (
|
|
231
|
+
var getPreparedRow = React.useCallback(function (index) {
|
|
232
|
+
var row = page[index];
|
|
232
233
|
prepareRow(row);
|
|
233
|
-
return (React.createElement(TableRowMemoized, { row: row, rowProps: rowProps, isLast:
|
|
234
|
+
return (React.createElement(TableRowMemoized, { row: row, rowProps: rowProps, isLast: index === page.length - 1, onRowInViewport: onRowInViewportRef, onBottomReached: onBottomReachedRef, intersectionMargin: intersectionMargin, state: state, key: row.getRowProps().key, onClick: onRowClickHandler, subComponent: subComponent, isDisabled: !!(isRowDisabled === null || isRowDisabled === void 0 ? void 0 : isRowDisabled(row.original)), tableHasSubRows: hasAnySubRows, tableInstance: instance, expanderCell: expanderCell }));
|
|
234
235
|
}, [
|
|
235
|
-
|
|
236
|
+
page,
|
|
236
237
|
expanderCell,
|
|
237
238
|
hasAnySubRows,
|
|
238
239
|
instance,
|
|
@@ -244,7 +245,7 @@ export var Table = function (props) {
|
|
|
244
245
|
state,
|
|
245
246
|
subComponent,
|
|
246
247
|
]);
|
|
247
|
-
var virtualizedItemRenderer = React.useCallback(function (index) { return getPreparedRow(
|
|
248
|
+
var virtualizedItemRenderer = React.useCallback(function (index) { return getPreparedRow(index); }, [getPreparedRow]);
|
|
248
249
|
return (React.createElement(React.Fragment, null,
|
|
249
250
|
React.createElement("div", __assign({ ref: function (element) {
|
|
250
251
|
setOwnerDocument(element === null || element === void 0 ? void 0 : element.ownerDocument);
|
|
@@ -268,8 +269,8 @@ export var Table = function (props) {
|
|
|
268
269
|
}
|
|
269
270
|
} }),
|
|
270
271
|
column.render('Header'),
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
(data.length !== 0 || areFiltersSet) && (React.createElement(FilterToggle, { column: column, ownerDocument: ownerDocument })),
|
|
273
|
+
data.length !== 0 && column.canSort && (React.createElement("div", { className: 'iui-cell-end-icon' }, column.isSorted && column.isSortedDesc ? (React.createElement(SvgSortUp, { className: 'iui-icon iui-sort', "aria-hidden": true })) : (React.createElement(SvgSortDown, { className: 'iui-icon iui-sort', "aria-hidden": true })))),
|
|
273
274
|
isResizable &&
|
|
274
275
|
column.isResizerVisible &&
|
|
275
276
|
index !== headerGroup.headers.length - 1 && (React.createElement("div", __assign({}, column.getResizerProps(), { className: 'iui-resizer' }),
|
|
@@ -287,7 +288,7 @@ export var Table = function (props) {
|
|
|
287
288
|
headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
|
|
288
289
|
}
|
|
289
290
|
}, tabIndex: -1 }),
|
|
290
|
-
data.length !== 0 && (React.createElement(React.Fragment, null, enableVirtualization ? (React.createElement(VirtualScroll, { itemsLength: page.length, itemRenderer: virtualizedItemRenderer })) : (page.map(function (
|
|
291
|
+
data.length !== 0 && (React.createElement(React.Fragment, null, enableVirtualization ? (React.createElement(VirtualScroll, { itemsLength: page.length, itemRenderer: virtualizedItemRenderer })) : (page.map(function (_, index) { return getPreparedRow(index); })))),
|
|
291
292
|
isLoading && data.length === 0 && (React.createElement("div", { className: 'iui-table-empty' },
|
|
292
293
|
React.createElement(ProgressRadial, { indeterminate: true }))),
|
|
293
294
|
isLoading && data.length !== 0 && (React.createElement("div", { className: 'iui-row' },
|
|
@@ -44,14 +44,30 @@ export var DateRangeFilter = function (props) {
|
|
|
44
44
|
useTheme();
|
|
45
45
|
var translatedStrings = __assign(__assign({}, defaultStrings), translatedLabels);
|
|
46
46
|
var _h = React.useState(((_a = column.filterValue) === null || _a === void 0 ? void 0 : _a[0]) ? new Date((_b = column.filterValue) === null || _b === void 0 ? void 0 : _b[0]) : undefined), from = _h[0], setFrom = _h[1];
|
|
47
|
+
var onFromChange = React.useCallback(function (date) {
|
|
48
|
+
setFrom(function (prevDate) {
|
|
49
|
+
if (prevDate || !date) {
|
|
50
|
+
return date;
|
|
51
|
+
}
|
|
52
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0);
|
|
53
|
+
});
|
|
54
|
+
}, []);
|
|
47
55
|
var _j = React.useState(((_c = column.filterValue) === null || _c === void 0 ? void 0 : _c[1]) ? new Date((_d = column.filterValue) === null || _d === void 0 ? void 0 : _d[1]) : undefined), to = _j[0], setTo = _j[1];
|
|
56
|
+
var onToChange = React.useCallback(function (date) {
|
|
57
|
+
setTo(function (prevDate) {
|
|
58
|
+
if (prevDate || !date) {
|
|
59
|
+
return date;
|
|
60
|
+
}
|
|
61
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59, 999);
|
|
62
|
+
});
|
|
63
|
+
}, []);
|
|
48
64
|
var onKeyDown = function (event) {
|
|
49
65
|
if (event.key === 'Enter') {
|
|
50
66
|
setFilter([from, to]);
|
|
51
67
|
}
|
|
52
68
|
};
|
|
53
69
|
return (React.createElement(BaseFilter, null,
|
|
54
|
-
React.createElement(DatePickerInput, { label: translatedStrings.from, date: from, onChange:
|
|
55
|
-
React.createElement(DatePickerInput, { label: translatedStrings.to, date: to, onChange:
|
|
70
|
+
React.createElement(DatePickerInput, { label: translatedStrings.from, date: from, onChange: onFromChange, formatDate: formatDate, parseInput: parseInput, onKeyDown: onKeyDown, placeholder: placeholder, setFocus: true }),
|
|
71
|
+
React.createElement(DatePickerInput, { label: translatedStrings.to, date: to, onChange: onToChange, formatDate: formatDate, parseInput: parseInput, onKeyDown: onKeyDown, placeholder: placeholder }),
|
|
56
72
|
React.createElement(FilterButtonBar, { setFilter: function () { return setFilter([from, to]); }, clearFilter: clearFilter, translatedLabels: translatedLabels })));
|
|
57
73
|
};
|
package/esm/core/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export { Button, DropdownButton, IconButton, IdeasButton, SplitButton, } from '.
|
|
|
8
8
|
export type { ButtonProps, DropdownButtonProps, IconButtonProps, IdeasButtonProps, SplitButtonProps, } from './Buttons';
|
|
9
9
|
export { ButtonGroup } from './ButtonGroup';
|
|
10
10
|
export type { ButtonGroupProps } from './ButtonGroup';
|
|
11
|
+
export { Carousel } from './Carousel';
|
|
12
|
+
export type { CarouselProps } from './Carousel';
|
|
11
13
|
export { Checkbox } from './Checkbox';
|
|
12
14
|
export type { CheckboxProps } from './Checkbox';
|
|
13
15
|
export { ColorPicker, ColorSwatch, ColorBuilder, ColorInputPanel, ColorPalette, } from './ColorPicker';
|
|
@@ -48,8 +50,8 @@ export { LabeledTextarea } from './LabeledTextarea';
|
|
|
48
50
|
export type { LabeledTextareaProps } from './LabeledTextarea';
|
|
49
51
|
export { Menu, MenuItem, MenuDivider, MenuExtraContent } from './Menu';
|
|
50
52
|
export type { MenuProps, MenuItemProps, MenuDividerProps, MenuExtraContentProps, } from './Menu';
|
|
51
|
-
export { Modal, ModalButtonBar } from './Modal';
|
|
52
|
-
export type { ModalProps, ModalButtonBarProps } from './Modal';
|
|
53
|
+
export { Modal, ModalButtonBar, ModalContent } from './Modal';
|
|
54
|
+
export type { ModalProps, ModalButtonBarProps, ModalContentProps, } from './Modal';
|
|
53
55
|
export { ProgressLinear, ProgressRadial } from './ProgressIndicators';
|
|
54
56
|
export type { ProgressLinearProps, ProgressRadialProps, } from './ProgressIndicators';
|
|
55
57
|
export { Radio } from './Radio';
|