@longline/aqua-ui 1.0.221 → 1.0.223
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/containers/Openable/Openable.d.ts +3 -0
- package/containers/Openable/Openable.js +15 -24
- package/controls/ListView/ColumnsManager/ColumnsManager.js +8 -23
- package/formatters/CountryFormatter/CountryFormatter.d.ts +1 -1
- package/formatters/CountryFormatter/CountryFormatter.js +1 -1
- package/formatters/DivisionFormatter/DivisionFormatter.d.ts +13 -0
- package/formatters/DivisionFormatter/DivisionFormatter.js +18 -0
- package/formatters/DivisionFormatter/DivisionUtil.d.ts +21 -0
- package/formatters/DivisionFormatter/DivisionUtil.js +5044 -0
- package/formatters/DivisionFormatter/index.d.ts +1 -0
- package/formatters/DivisionFormatter/index.js +1 -0
- package/hooks/useOutsideClose/index.d.ts +1 -0
- package/hooks/useOutsideClose/index.js +1 -0
- package/hooks/useOutsideClose/useOutsideClose.d.ts +75 -0
- package/hooks/useOutsideClose/useOutsideClose.js +104 -0
- package/inputs/DateInput/DateInput.js +8 -15
- package/inputs/Dropdown/Dropdown.js +8 -17
- package/inputs/MonthRange/MonthRange.js +10 -21
- package/map/controls/Geocoder/Geocoder.js +8 -17
- package/map/controls/Geocoder/GeocoderEntry.js +2 -2
- package/map/controls/Geocoder/GeocoderList.js +1 -1
- package/modules/CountryDropdown/CountryDropdown.d.ts +7 -0
- package/modules/CountryDropdown/CountryDropdown.js +26 -0
- package/modules/CountryDropdown/index.d.ts +1 -0
- package/modules/CountryDropdown/index.js +1 -0
- package/modules/DivisionDropdown/DivisionDropdown.d.ts +10 -0
- package/modules/DivisionDropdown/DivisionDropdown.js +29 -0
- package/modules/DivisionDropdown/index.d.ts +1 -0
- package/modules/DivisionDropdown/index.js +1 -0
- package/modules/Filter/Filter.js +8 -20
- package/package.json +1 -1
- package/services/Dialog/Dialog.js +13 -17
|
@@ -28,31 +28,20 @@ import * as React from 'react';
|
|
|
28
28
|
import styled from 'styled-components';
|
|
29
29
|
import { createPortal } from 'react-dom';
|
|
30
30
|
import { usePopper } from 'react-popper';
|
|
31
|
+
import { useOutsideClose } from '../../hooks/useOutsideClose';
|
|
31
32
|
var Openable = function (_a) {
|
|
32
|
-
var _b
|
|
33
|
+
var _b;
|
|
34
|
+
var _c = _a.width, width = _c === void 0 ? 250 : _c, props = __rest(_a, ["width"]);
|
|
33
35
|
var toggleRef = React.useRef(null);
|
|
34
36
|
var paneRef = React.useRef(null);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
}, []);
|
|
45
|
-
var handleClickOutside = function (e) {
|
|
46
|
-
var elem = e.target;
|
|
47
|
-
if (toggleRef.current && paneRef.current && !toggleRef.current.contains(elem) && !paneRef.current.contains(elem)) {
|
|
48
|
-
props.onClose();
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
var handleKeyDown = function (e) {
|
|
52
|
-
if (e.key == 'Escape')
|
|
53
|
-
props.onClose();
|
|
54
|
-
};
|
|
55
|
-
var _c = usePopper(toggleRef.current, paneRef.current, {
|
|
37
|
+
useOutsideClose({
|
|
38
|
+
open: props.open,
|
|
39
|
+
refs: [toggleRef, paneRef],
|
|
40
|
+
onClose: props.onClose,
|
|
41
|
+
escapeToClose: true,
|
|
42
|
+
blurToClose: true
|
|
43
|
+
});
|
|
44
|
+
var _d = usePopper(toggleRef.current, paneRef.current, {
|
|
56
45
|
placement: 'bottom-end',
|
|
57
46
|
modifiers: [
|
|
58
47
|
{
|
|
@@ -62,13 +51,15 @@ var Openable = function (_a) {
|
|
|
62
51
|
},
|
|
63
52
|
}
|
|
64
53
|
]
|
|
65
|
-
}), styles =
|
|
54
|
+
}), styles = _d.styles, attributes = _d.attributes, update = _d.update;
|
|
66
55
|
React.useEffect(function () {
|
|
67
56
|
update === null || update === void 0 ? void 0 : update();
|
|
68
57
|
}, [props.open]);
|
|
69
58
|
return (React.createElement("div", { ref: toggleRef },
|
|
70
59
|
props.toggle,
|
|
71
|
-
createPortal(React.createElement(Pane, __assign({ "$open": props.open, "$width": width, style: styles.popper }, attributes.popper, { ref: paneRef }), open && props.content),
|
|
60
|
+
createPortal(React.createElement(Pane, __assign({ "$open": props.open, "$width": width, style: styles.popper }, attributes.popper, { ref: paneRef }), props.open && props.content), // If in fullscreen mode, Openable must portal into fullscreen element,
|
|
61
|
+
// else content will be hidden.
|
|
62
|
+
(_b = document.fullscreenElement) !== null && _b !== void 0 ? _b : document.body)));
|
|
72
63
|
};
|
|
73
64
|
var Pane = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n width: ", "px;\n z-index: 2500;\n"], ["\n display: ", ";\n width: ", "px;\n z-index: 2500;\n"])), function (p) { return p.$open ? 'block' : 'none'; }, function (p) { return p.$width; });
|
|
74
65
|
Openable.displayName = "Openable";
|
|
@@ -20,31 +20,16 @@ import { SourceColumns } from './SourceColumns';
|
|
|
20
20
|
import { OrderColumns } from './OrderColumns';
|
|
21
21
|
import { SecondaryButton } from '../../SecondaryButton';
|
|
22
22
|
import { SVG } from '../../../svg';
|
|
23
|
+
import { useOutsideClose } from '../../../hooks/useOutsideClose';
|
|
23
24
|
var ColumnsManagerBase = function (props) {
|
|
24
25
|
var wrapperRef = React.useRef(null);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// Clean up document-wide mousedown/keydown events when panel unmounts.
|
|
33
|
-
document.removeEventListener('mousedown', handleClickOutside);
|
|
34
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
35
|
-
};
|
|
36
|
-
}, []);
|
|
37
|
-
var handleKeyDown = function (e) {
|
|
38
|
-
if (e.key == 'Escape')
|
|
39
|
-
props.onClose();
|
|
40
|
-
};
|
|
41
|
-
// Handle document-wide mousedown event by closing the panel.
|
|
42
|
-
var handleClickOutside = function (event) {
|
|
43
|
-
var elem = event.target;
|
|
44
|
-
if (wrapperRef.current && !wrapperRef.current.contains(elem)) {
|
|
45
|
-
props.onClose();
|
|
46
|
-
}
|
|
47
|
-
};
|
|
26
|
+
useOutsideClose({
|
|
27
|
+
open: true,
|
|
28
|
+
refs: [wrapperRef],
|
|
29
|
+
onClose: props.onClose,
|
|
30
|
+
escapeToClose: true,
|
|
31
|
+
blurToClose: true
|
|
32
|
+
});
|
|
48
33
|
return (React.createElement("div", { className: props.className, ref: wrapperRef },
|
|
49
34
|
React.createElement(GlassPane, { animated: true, bordered: true },
|
|
50
35
|
React.createElement(Content, null,
|
|
@@ -13,7 +13,7 @@ interface ICountryFormatterProps {
|
|
|
13
13
|
type?: 'flag' | 'name' | 'both';
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* The `
|
|
16
|
+
* The `CountryFormatter` takes a country code or name and produces either
|
|
17
17
|
* an emoji flag, the country name, or both, depending on the `type` prop.
|
|
18
18
|
*/
|
|
19
19
|
declare const CountryFormatter: {
|
|
@@ -6,7 +6,7 @@ import * as React from 'react';
|
|
|
6
6
|
import styled from 'styled-components';
|
|
7
7
|
import { CountryUtil } from './CountryUtil';
|
|
8
8
|
/**
|
|
9
|
-
* The `
|
|
9
|
+
* The `CountryFormatter` takes a country code or name and produces either
|
|
10
10
|
* an emoji flag, the country name, or both, depending on the `type` prop.
|
|
11
11
|
*/
|
|
12
12
|
var CountryFormatter = function (_a) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface IDivisionFormatterProps {
|
|
3
|
+
/**
|
|
4
|
+
* The division code (e.g. "CA-NS") to format.
|
|
5
|
+
*/
|
|
6
|
+
value: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The `DivisionFormatter` takes a country code or name and produces either
|
|
10
|
+
* an emoji flag, the country name, or both, depending on the `type` prop.
|
|
11
|
+
*/
|
|
12
|
+
declare const DivisionFormatter: ({ value }: IDivisionFormatterProps) => React.JSX.Element;
|
|
13
|
+
export { DivisionFormatter };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
import { DivisionUtil } from './DivisionUtil';
|
|
8
|
+
/**
|
|
9
|
+
* The `DivisionFormatter` takes a country code or name and produces either
|
|
10
|
+
* an emoji flag, the country name, or both, depending on the `type` prop.
|
|
11
|
+
*/
|
|
12
|
+
var DivisionFormatter = function (_a) {
|
|
13
|
+
var value = _a.value;
|
|
14
|
+
return React.createElement(Name, null, DivisionUtil.getDivisionName(value));
|
|
15
|
+
};
|
|
16
|
+
var Name = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n text-overflow: ellipsis;\n overflow: hidden; \n"], ["\n text-overflow: ellipsis;\n overflow: hidden; \n"])));
|
|
17
|
+
export { DivisionFormatter };
|
|
18
|
+
var templateObject_1;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface IIsoDivisionsMap {
|
|
2
|
+
[key: string]: string;
|
|
3
|
+
}
|
|
4
|
+
declare class DivisionUtil {
|
|
5
|
+
private static data;
|
|
6
|
+
/**
|
|
7
|
+
* Get all country codes.
|
|
8
|
+
* @returns List of ISO country codes.
|
|
9
|
+
*/
|
|
10
|
+
static getCountries: () => string[];
|
|
11
|
+
/**
|
|
12
|
+
* Given a country code (e.g. `NL`) return its divisions.
|
|
13
|
+
* @param countryCode e.g. `NL`
|
|
14
|
+
* @returns Object with mapping key->name of divisions
|
|
15
|
+
*/
|
|
16
|
+
static getDivisions: (countryCode: string) => IIsoDivisionsMap;
|
|
17
|
+
static getCountryName: (countryCode: string) => string;
|
|
18
|
+
private static divisionDict;
|
|
19
|
+
static getDivisionName: (divisionCode: string) => string;
|
|
20
|
+
}
|
|
21
|
+
export { DivisionUtil };
|