@longline/aqua-ui 1.0.339 → 1.0.340
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/Anchor/Anchor.d.ts +5 -0
- package/containers/Anchor/Anchor.js +20 -8
- package/containers/Dock/Dock.d.ts +5 -0
- package/containers/Dock/Dock.js +1 -1
- package/containers/Dock/Dockable.d.ts +5 -0
- package/containers/Dock/Dockable.js +20 -12
- package/containers/DragBar/DragBar.d.ts +5 -0
- package/containers/DragBar/DragBar.js +16 -5
- package/containers/Form/Field.d.ts +0 -3
- package/containers/Form/Field.js +3 -6
- package/containers/Form/Form.js +5 -36
- package/containers/Form/Validation.d.ts +1 -1
- package/containers/Form/Validation.js +6 -6
- package/containers/Form/context/FormContext.d.ts +1 -2
- package/containers/Form/context/useForm.d.ts +1 -1
- package/containers/Form/elements/BoxWrapper.js +2 -0
- package/containers/GlassPane/GlassPane.d.ts +7 -2
- package/containers/GlassPane/GlassPane.js +3 -3
- package/containers/InfoBox/InfoBox.d.ts +5 -0
- package/containers/InfoBox/InfoBox.js +1 -1
- package/containers/List/List.d.ts +5 -0
- package/containers/List/List.js +1 -1
- package/containers/List/ListCell.d.ts +5 -0
- package/containers/List/ListCell.js +1 -1
- package/containers/List/ListRow.d.ts +7 -2
- package/containers/List/ListRow.js +1 -1
- package/containers/Message/Error.d.ts +2 -0
- package/containers/Message/Error.js +1 -1
- package/containers/Message/Message.d.ts +5 -0
- package/containers/Message/Message.js +1 -1
- package/containers/Message/NoData.d.ts +2 -0
- package/containers/Message/NoData.js +1 -1
- package/containers/Message/NoFilteredData.d.ts +2 -0
- package/containers/Message/NoFilteredData.js +1 -1
- package/containers/Openable/Openable.d.ts +5 -0
- package/containers/Openable/Openable.js +8 -8
- package/containers/PublicRoute/PublicRoute.d.ts +9 -1
- package/containers/PublicRoute/PublicRoute.js +3 -7
- package/containers/Tabs/Pane.d.ts +5 -0
- package/containers/Tabs/Pane.js +3 -3
- package/containers/Tabs/Tabs.d.ts +5 -0
- package/containers/Tabs/Tabs.js +3 -3
- package/controls/Chip/Chip.d.ts +15 -3
- package/controls/Chip/Chip.js +7 -6
- package/controls/CircularProgress/CircularProgress.d.ts +11 -0
- package/controls/CircularProgress/CircularProgress.js +19 -11
- package/controls/Dropzone/Dropzone.d.ts +11 -1
- package/controls/Dropzone/Dropzone.js +18 -7
- package/controls/Fab/Fab.d.ts +14 -6
- package/controls/Fab/Fab.js +7 -20
- package/controls/Ghost/Ghost.js +3 -3
- package/controls/Gradient/Gradient.d.ts +5 -0
- package/controls/Gradient/Gradient.js +7 -4
- package/controls/Histogram/Histogram.d.ts +8 -2
- package/controls/Histogram/Histogram.js +9 -9
- package/controls/Histogram/HistogramBar.d.ts +2 -2
- package/controls/Icon/Icon.d.ts +10 -4
- package/controls/Icon/Icon.js +23 -6
- package/controls/Key/Key.d.ts +5 -0
- package/controls/Key/Key.js +2 -5
- package/controls/LinearChart/LinearChart.d.ts +9 -0
- package/controls/LinearChart/LinearChart.js +11 -6
- package/controls/ListButton/ListButton.d.ts +46 -3
- package/controls/ListButton/ListButton.js +70 -9
- package/controls/ListView/ColumnsManager/ColumnDraggable.js +11 -5
- package/controls/ListView/ColumnsManager/SourceColumns.js +1 -1
- package/controls/ListView/IListViewProps.d.ts +9 -2
- package/controls/ListView/ListView.js +13 -12
- package/controls/ListView/defaults.d.ts +3 -0
- package/controls/ListView/defaults.js +6 -0
- package/controls/ListView/elements/Body.d.ts +1 -1
- package/controls/ListView/elements/Body.js +23 -12
- package/controls/ListView/elements/Ghost.js +3 -2
- package/controls/ListView/elements/Header.js +3 -2
- package/controls/ListView/elements/HeaderCell.js +3 -3
- package/controls/ListView/elements/Table.js +16 -10
- package/controls/Mouse/Mouse.d.ts +6 -4
- package/controls/Mouse/Mouse.js +15 -8
- package/controls/PrimaryButton/PrimaryButton.d.ts +9 -3
- package/controls/PrimaryButton/PrimaryButton.js +5 -5
- package/controls/Progress/Progress.d.ts +9 -0
- package/controls/Progress/Progress.js +12 -8
- package/controls/SecondaryButton/SecondaryButton.d.ts +8 -3
- package/controls/SecondaryButton/SecondaryButton.js +1 -1
- package/controls/SpeechRecognizer/EditorRegistry.js +1 -2
- package/controls/SpeechRecognizer/SpeechRecognizer.d.ts +9 -1
- package/controls/SpeechRecognizer/SpeechRecognizer.js +16 -9
- package/controls/TabBar/TabBar.d.ts +5 -0
- package/controls/TabBar/TabBar.js +14 -6
- package/controls/TabBar/Underliner.js +1 -1
- package/controls/TertiaryButton/TertiaryButton.d.ts +9 -3
- package/controls/TertiaryButton/TertiaryButton.js +5 -3
- package/controls/ToggleButton/ToggleButton.d.ts +8 -2
- package/controls/ToggleButton/ToggleButton.js +1 -1
- package/controls/View/View.d.ts +5 -0
- package/controls/View/View.js +1 -1
- package/formatters/CountryFormatter/CountryFormatter.d.ts +3 -2
- package/formatters/CountryFormatter/CountryUtil.d.ts +3 -3
- package/formatters/DateTimeFormatter/DateTimeFormatter.d.ts +11 -10
- package/formatters/DateTimeFormatter/elements/Custom.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/DistanceDate.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/LongDate.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/LongDateTime.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/LongTime.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/Month.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/ShortDate.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/ShortDateTime.d.ts +1 -1
- package/formatters/DateTimeFormatter/elements/ShortTime.d.ts +1 -1
- package/formatters/DivisionFormatter/DivisionFormatter.d.ts +2 -2
- package/formatters/DivisionFormatter/DivisionFormatter.js +1 -1
- package/formatters/DivisionFormatter/DivisionUtil.d.ts +1 -1
- package/formatters/DivisionFormatter/DivisionUtil.js +5 -3
- package/formatters/FilesizeFormatter/FilesizeFormatter.d.ts +3 -3
- package/formatters/GIS/CoordinateFormatter.d.ts +2 -2
- package/formatters/GIS/LatitudeFormatter.d.ts +2 -2
- package/formatters/GIS/LongitudeFormatter.d.ts +2 -2
- package/formatters/HumanFormatter/HumanFormatter.d.ts +3 -3
- package/formatters/NumberFormatter/NumberFormatter.d.ts +3 -3
- package/formatters/PhoneFormatter/PhoneFormatter.d.ts +3 -3
- package/formatters/StringFormatter/StringFormatter.d.ts +3 -3
- package/formatters/StringFormatter/StringFormatter.js +1 -4
- package/helper/DMS.d.ts +1 -1
- package/helper/DMS.js +2 -2
- package/hooks/useOutsideClose/useOutsideClose.js +20 -11
- package/hooks/useSpeechAIRecorder/useSpeechAIRecorder.js +10 -7
- package/index.js +1 -0
- package/inputs/DateInput/Body.d.ts +2 -2
- package/inputs/DateInput/Body.js +11 -7
- package/inputs/DateInput/Calendar.d.ts +1 -1
- package/inputs/DateInput/Calendar.js +3 -5
- package/inputs/DateInput/DateInput.d.ts +11 -3
- package/inputs/DateInput/DateInput.js +11 -3
- package/inputs/DateInput/Day.d.ts +1 -1
- package/inputs/DateInput/InfiniteList.js +6 -3
- package/inputs/DateInput/Navbar.js +3 -2
- package/inputs/DateInput/NumericInput.js +3 -0
- package/inputs/DateInput/Selector.d.ts +1 -1
- package/inputs/DateInput/Selector.js +9 -6
- package/inputs/Dropdown/Body.d.ts +2 -2
- package/inputs/Dropdown/Column.d.ts +1 -1
- package/inputs/Dropdown/Dropdown.d.ts +5 -0
- package/inputs/Dropdown/Dropdown.js +36 -63
- package/inputs/Dropdown/Pill.js +1 -1
- package/inputs/Dropdown/Selection.js +1 -1
- package/inputs/Editor/Editor.d.ts +5 -0
- package/inputs/Editor/Editor.js +16 -6
- package/inputs/Editor/buttons/SpeechAIButton.js +2 -0
- package/inputs/Editor/buttons/TextAIButton.d.ts +0 -13
- package/inputs/Editor/buttons/TextAIButton.js +30 -14
- package/inputs/Editor/buttons/TextAIMenu.js +1 -1
- package/inputs/Editor/menu/MenuBar.d.ts +1 -1
- package/inputs/Editor/menu/MenuBar.js +1 -1
- package/inputs/Editor/menu/MenuButton.js +1 -1
- package/inputs/Input/Clear.js +1 -1
- package/inputs/Input/Input.d.ts +5 -0
- package/inputs/Input/Input.js +8 -6
- package/inputs/Input/InputWrapper.d.ts +2 -0
- package/inputs/Input/InputWrapper.js +1 -1
- package/inputs/Input/Reveal.js +1 -1
- package/inputs/MonthRange/Body.d.ts +1 -1
- package/inputs/MonthRange/Calendar.d.ts +2 -2
- package/inputs/MonthRange/Calendar.js +6 -9
- package/inputs/MonthRange/MonthRange.d.ts +7 -1
- package/inputs/MonthRange/MonthRange.js +14 -6
- package/inputs/MonthRange/Selector.d.ts +1 -1
- package/inputs/MonthRange/Selector.js +12 -11
- package/inputs/PhoneInput/PhoneInput.d.ts +5 -0
- package/inputs/PhoneInput/PhoneInput.js +2 -2
- package/inputs/Selector/Selector.d.ts +5 -0
- package/inputs/Selector/Selector.js +4 -1
- package/inputs/Slider/Slider.d.ts +75 -22
- package/inputs/Slider/Slider.js +104 -22
- package/inputs/Textarea/Textarea.d.ts +5 -5
- package/inputs/Textarea/Textarea.js +3 -2
- package/map/Map/Map.d.ts +2 -2
- package/map/Map/Map.js +20 -14
- package/map/PositionsManager/PositionBox.js +7 -3
- package/map/PositionsManager/PositionsManager.js +33 -13
- package/map/controls/CompassButton/CompassButton.js +1 -1
- package/map/controls/FullscreenButton/FullscreenButton.js +1 -1
- package/map/controls/Geocoder/Geocoder.js +28 -14
- package/map/controls/Geocoder/GeocoderApi.js +2 -0
- package/map/controls/Geocoder/GeocoderSelector.js +1 -1
- package/map/controls/Graticule/Graticule.js +1 -5
- package/map/controls/MapLoader/MapLoader.js +1 -1
- package/map/controls/ScaleControl/ScaleControl.js +1 -1
- package/map/controls/ZoomInButton/ZoomInButton.js +1 -1
- package/map/controls/ZoomOutButton/ZoomOutButton.d.ts +1 -1
- package/map/controls/ZoomOutButton/ZoomOutButton.js +2 -2
- package/map/controls/base/MapButton/MapButton.d.ts +8 -2
- package/map/controls/base/MapButton/MapButton.js +11 -2
- package/map/controls/base/MapControl/MapControl.d.ts +5 -0
- package/map/controls/base/MapControl/MapControl.js +10 -7
- package/map/layers/ClusterLayer/ClusterLayer.d.ts +1 -1
- package/map/layers/ClusterLayer/ClusterLayer.js +7 -3
- package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer.js +8 -4
- package/map/layers/IdwBlendLayer/IdwBlendLayer.js +9 -4
- package/map/layers/IdwLayer/IdwLayer.d.ts +2 -1
- package/map/layers/IdwLayer/IdwLayer.js +271 -215
- package/map/layers/InterpolationLayer/ContoursFragmentShader.d.ts +1 -1
- package/map/layers/InterpolationLayer/ContoursFragmentShader.js +1 -1
- package/map/layers/InterpolationLayer/InterpolationLayer.d.ts +4 -3
- package/map/layers/InterpolationLayer/InterpolationLayer.js +362 -275
- package/map/layers/ParticlesLayer/ParticlesLayer.d.ts +8 -7
- package/map/layers/ParticlesLayer/ParticlesLayer.js +528 -404
- package/map/markers/ClusterMarker/ClusterMarker.d.ts +6 -1
- package/map/markers/ClusterMarker/ClusterMarker.js +15 -6
- package/map/markers/RiskMarker/RiskMarker.d.ts +5 -1
- package/map/markers/RiskMarker/RiskMarker.js +4 -4
- package/modules/CountryDropdown/CountryDropdown.js +10 -1
- package/modules/Filter/Filter.d.ts +5 -0
- package/modules/Filter/Filter.js +10 -6
- package/modules/Globe/Globe.d.ts +5 -0
- package/modules/Globe/Globe.js +4 -4
- package/modules/MainMenu/Item.d.ts +9 -2
- package/modules/MainMenu/Item.js +8 -5
- package/modules/MainMenu/MainMenu.d.ts +5 -0
- package/modules/MainMenu/MainMenu.js +1 -1
- package/modules/ParticleGlobe/GL.d.ts +1 -1
- package/modules/ParticleGlobe/ParticleGlobe.d.ts +5 -0
- package/modules/ParticleGlobe/ParticleGlobe.js +69 -40
- package/modules/Public/Public.d.ts +5 -0
- package/modules/Public/Public.js +3 -3
- package/package.json +1 -1
- package/services/Auth/Auth.js +13 -7
- package/services/Auth/AuthContext.js +9 -1
- package/services/Dialog/Dialog.d.ts +7 -2
- package/services/Dialog/Dialog.js +7 -6
- package/services/Dialog/DialogWindow.d.ts +3 -1
- package/services/Dialog/DialogWindow.js +1 -1
- package/services/Dialog/XhrDialog.d.ts +1 -1
- package/services/Toast/Toast.js +5 -3
- package/services/Toast/ToastContainer.js +3 -1
- package/services/Toast/ToastContext.d.ts +1 -1
- package/services/Toast/ToastProvider.js +2 -0
- package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer copy.d.ts +0 -35
- package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer copy.js +0 -176
- package/modules/Root/Content.d.ts +0 -16
- package/modules/Root/Content.js +0 -25
- package/modules/Root/Overlay.d.ts +0 -23
- package/modules/Root/Overlay.js +0 -33
- package/modules/Root/Root.d.ts +0 -10
- package/modules/Root/Root.js +0 -46
- package/modules/Root/Shader.d.ts +0 -15
- package/modules/Root/Shader.js +0 -24
- package/modules/Root/Sidebar.d.ts +0 -13
- package/modules/Root/Sidebar.js +0 -24
- package/modules/Root/index.d.ts +0 -1
- package/modules/Root/index.js +0 -1
- package/modules/Root/stories/SampleContent.d.ts +0 -7
- package/modules/Root/stories/SampleContent.js +0 -44
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface IPhoneFormatterProps {
|
|
3
3
|
/**
|
|
4
|
-
* Phone number in E.164 format, e.g. `"+351910306792"`.
|
|
4
|
+
* Phone number in E.164 format, e.g. `"+351910306792"`. `null` renders nothing.
|
|
5
5
|
*/
|
|
6
|
-
value: string;
|
|
6
|
+
value: string | null;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Displays a phone number alongside the flag of the country its international
|
|
@@ -18,7 +18,7 @@ interface IPhoneFormatterProps {
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
declare const PhoneFormatter: {
|
|
21
|
-
({ value }: IPhoneFormatterProps): React.JSX.Element;
|
|
21
|
+
({ value }: IPhoneFormatterProps): React.JSX.Element | null;
|
|
22
22
|
displayName: string;
|
|
23
23
|
};
|
|
24
24
|
export { PhoneFormatter };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface IStringFormatterProps {
|
|
3
|
-
/** String to format */
|
|
4
|
-
value: string;
|
|
3
|
+
/** String to format. `null` renders nothing. */
|
|
4
|
+
value: string | null;
|
|
5
5
|
/** Type of formatting */
|
|
6
6
|
type: 'capitalize' | 'capitalizeWords' | 'upper' | 'lower' | 'reverse' | 'snake' | 'kebab';
|
|
7
7
|
}
|
|
@@ -32,7 +32,7 @@ interface IStringFormatterProps {
|
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
declare const StringFormatter: {
|
|
35
|
-
({ value, type }: IStringFormatterProps): React.JSX.Element;
|
|
35
|
+
({ value, type }: IStringFormatterProps): React.JSX.Element | null;
|
|
36
36
|
displayName: string;
|
|
37
37
|
};
|
|
38
38
|
export { StringFormatter, IStringFormatterProps };
|
|
@@ -10,10 +10,7 @@ var capitalize = function (str) {
|
|
|
10
10
|
var capitalizeWords = function (str) {
|
|
11
11
|
return str
|
|
12
12
|
.split(/\s+/)
|
|
13
|
-
.map(
|
|
14
|
-
var _a = Array.from(word), first = _a[0], rest = _a.slice(1);
|
|
15
|
-
return first.toLocaleUpperCase() + rest.join('');
|
|
16
|
-
})
|
|
13
|
+
.map(capitalize)
|
|
17
14
|
.join(' ');
|
|
18
15
|
};
|
|
19
16
|
/** Formatters map */
|
package/helper/DMS.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ declare class DMS {
|
|
|
27
27
|
* // Returns: "(no coordinates)" (out of range)
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
static toDMSString(value: number | string, defaultStr: string, max: number, positive: string, negative: string): string;
|
|
30
|
+
static toDMSString(value: number | string | null, defaultStr: string, max: number, positive: string, negative: string): string;
|
|
31
31
|
/**
|
|
32
32
|
* Convert a decimal latitude or longitude value to degrees,
|
|
33
33
|
* minutes, and seconds.
|
package/helper/DMS.js
CHANGED
|
@@ -30,8 +30,8 @@ var DMS = /** @class */ (function () {
|
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
DMS.toDMSString = function (value, defaultStr, max, positive, negative) {
|
|
33
|
-
// Convert value to number if it is a string
|
|
34
|
-
var num = typeof value === 'number' ? value : parseFloat(value);
|
|
33
|
+
// Convert value to number if it is a string; null falls through to NaN.
|
|
34
|
+
var num = typeof value === 'number' ? value : (value == null ? NaN : parseFloat(value));
|
|
35
35
|
// Return default string if value is not a number or out of range:
|
|
36
36
|
if (isNaN(num) || num < -max || num > max)
|
|
37
37
|
return defaultStr;
|
|
@@ -48,6 +48,13 @@ import * as React from "react";
|
|
|
48
48
|
*/
|
|
49
49
|
function useOutsideClose(_a) {
|
|
50
50
|
var open = _a.open, refs = _a.refs, onClose = _a.onClose, _b = _a.escapeToClose, escapeToClose = _b === void 0 ? false : _b, _c = _a.blurToClose, blurToClose = _c === void 0 ? false : _c;
|
|
51
|
+
// Keep the latest refs/onClose in refs so the listener effect doesn't depend
|
|
52
|
+
// on them. Consumers typically pass an inline refs array and inline onClose,
|
|
53
|
+
// which would otherwise re-attach the document listeners on every render.
|
|
54
|
+
var refsRef = React.useRef(refs);
|
|
55
|
+
refsRef.current = refs;
|
|
56
|
+
var onCloseRef = React.useRef(onClose);
|
|
57
|
+
onCloseRef.current = onClose;
|
|
51
58
|
// Events get added to the component only when it opens, and removed
|
|
52
59
|
// when it closes. This way, components aren't listening for document-wide
|
|
53
60
|
// events when they're closed.
|
|
@@ -55,30 +62,32 @@ function useOutsideClose(_a) {
|
|
|
55
62
|
// If component isn't open, then do nothing:
|
|
56
63
|
if (!open)
|
|
57
64
|
return undefined;
|
|
58
|
-
// When the HTML document gets clicked, see if the click is inside one of
|
|
59
|
-
// the HTML elements that were passed in. If so, do nothing.
|
|
60
|
-
// these elements, close the component.
|
|
65
|
+
// When the HTML document gets clicked, see if the click is inside one of
|
|
66
|
+
// the HTML elements that were passed in. If so, do nothing. If outside
|
|
67
|
+
// these elements, close the component.
|
|
61
68
|
var handleClick = function (e) {
|
|
62
69
|
var target = e.target;
|
|
63
|
-
var clickedInside =
|
|
70
|
+
var clickedInside = refsRef.current.some(function (ref) { return ref.current && ref.current.contains(target); });
|
|
64
71
|
if (!clickedInside) {
|
|
65
|
-
|
|
72
|
+
onCloseRef.current();
|
|
66
73
|
}
|
|
67
74
|
};
|
|
68
75
|
// When the ESC key is pressed (and this feature has been enabled),
|
|
69
76
|
// close the component.
|
|
70
77
|
var handleKeyDown = function (e) {
|
|
71
78
|
if (escapeToClose && e.key === "Escape") {
|
|
72
|
-
|
|
79
|
+
onCloseRef.current();
|
|
73
80
|
}
|
|
74
81
|
};
|
|
82
|
+
// On focusout, relatedTarget is the element receiving focus. Close if focus
|
|
83
|
+
// is moving outside all refs (or is being lost entirely).
|
|
75
84
|
var handleBlur = function (e) {
|
|
76
85
|
if (!blurToClose)
|
|
77
86
|
return;
|
|
78
87
|
var target = e.relatedTarget; // where focus is going
|
|
79
|
-
var focusedInside =
|
|
88
|
+
var focusedInside = refsRef.current.some(function (ref) { return ref.current && target && ref.current.contains(target); });
|
|
80
89
|
if (!focusedInside) {
|
|
81
|
-
|
|
90
|
+
onCloseRef.current();
|
|
82
91
|
}
|
|
83
92
|
};
|
|
84
93
|
// Add event listeners:
|
|
@@ -87,7 +96,7 @@ function useOutsideClose(_a) {
|
|
|
87
96
|
document.addEventListener("keydown", handleKeyDown);
|
|
88
97
|
}
|
|
89
98
|
if (blurToClose) {
|
|
90
|
-
document.addEventListener("
|
|
99
|
+
document.addEventListener("focusout", handleBlur); // focusout bubbles
|
|
91
100
|
}
|
|
92
101
|
// Remove event listeners:
|
|
93
102
|
return function () {
|
|
@@ -96,9 +105,9 @@ function useOutsideClose(_a) {
|
|
|
96
105
|
document.removeEventListener("keydown", handleKeyDown);
|
|
97
106
|
}
|
|
98
107
|
if (blurToClose) {
|
|
99
|
-
document.removeEventListener("
|
|
108
|
+
document.removeEventListener("focusout", handleBlur);
|
|
100
109
|
}
|
|
101
110
|
};
|
|
102
|
-
}, [open,
|
|
111
|
+
}, [open, escapeToClose, blurToClose]);
|
|
103
112
|
}
|
|
104
113
|
export { useOutsideClose };
|
|
@@ -44,7 +44,7 @@ import { SpeechManager } from './SpeechManager';
|
|
|
44
44
|
// code in a template string, compile that into a blob, and then use that
|
|
45
45
|
// instead. This way, no separate JS file needs to be deployed with AquaUI.
|
|
46
46
|
//
|
|
47
|
-
var moduleScript = /* js */ "\nconst MAX_16BIT_INT = 32767\nclass AudioProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n\n // Input is browser sample rate (typically 48000 Hz in Firefox)\n // This variable is globally available inside the AudioWorkletProcessor\n // scope.\n this.inputSampleRate = sampleRate;\n
|
|
47
|
+
var moduleScript = /* js */ "\nconst MAX_16BIT_INT = 32767\nclass AudioProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n\n // Input is browser sample rate (typically 48000 Hz in Firefox)\n // This variable is globally available inside the AudioWorkletProcessor\n // scope.\n this.inputSampleRate = sampleRate;\n this.targetSampleRate = 16000;\n this.ratio = this.inputSampleRate / this.targetSampleRate;\n\n // Buffer of input samples for resampling\n this.buffer = [];\n\n // Number of samples per output chunk\n this.chunkSize = 1600; // ~100ms at 16kHz\n }\n\n /**\n * Resample the input buffer to the target sample rate using linear interpolation.\n */\n resample(inputBuffer) {\n const outputLength = Math.floor(inputBuffer.length / this.ratio);\n const output = new Float32Array(outputLength);\n\n for (let i = 0; i < outputLength; i++) {\n const idx = i * this.ratio;\n const idxInt = Math.floor(idx);\n const idxFrac = idx - idxInt;\n\n const sample1 = inputBuffer[idxInt] || 0;\n const sample2 = inputBuffer[idxInt + 1] || 0;\n output[i] = sample1 + (sample2 - sample1) * idxFrac;\n }\n\n return output;\n }\n\n /**\n * Converts Float32 PCM [-1, 1] to 16-bit signed PCM\n */\n floatTo16BitPCM(float32Array) {\n const int16Array = new Int16Array(float32Array.length);\n for (let i = 0; i < float32Array.length; i++) {\n let s = Math.max(-1, Math.min(1, float32Array[i]));\n int16Array[i] = s < 0 ? s * 0x8000 : s * 0x7FFF;\n }\n return int16Array;\n }\n\n /**\n * Called automatically by browser on each audio frame (128 samples per channel).\n */\n process(inputs, outputs, parameters) {\n try {\n const input = inputs[0];\n if (!input || input.length === 0) return true;\n\n // Read from mono channel\n const channelData = input[0];\n this.buffer.push(...channelData);\n\n // Only process if we have enough input to produce a full output chunk\n const neededInputSamples = this.chunkSize * this.ratio;\n if (this.buffer.length >= neededInputSamples) {\n const inputForChunk = this.buffer.slice(0, neededInputSamples);\n const resampled = this.resample(inputForChunk);\n const pcm = this.floatTo16BitPCM(resampled);\n\n this.port.postMessage({ audio_data: pcm }); // Send Int16Array to main thread\n\n // Remove consumed input samples\n this.buffer = this.buffer.slice(neededInputSamples);\n }\n\n return true; // Keep processor alive\n } catch (error) {\n console.error(error)\n return false\n }\n }\n}\n\nregisterProcessor('audio-processor', AudioProcessor);\n";
|
|
48
48
|
/**
|
|
49
49
|
* useSpeechAIRecorder
|
|
50
50
|
*
|
|
@@ -132,6 +132,7 @@ var useSpeechAIRecorder = function (url, onTranscript, authToken) {
|
|
|
132
132
|
return [4 /*yield*/, audioContext.audioWorklet.addModule(scriptUrl)];
|
|
133
133
|
case 2:
|
|
134
134
|
_a.sent();
|
|
135
|
+
URL.revokeObjectURL(scriptUrl);
|
|
135
136
|
node = new AudioWorkletNode(audioContext, 'audio-processor');
|
|
136
137
|
source.connect(node);
|
|
137
138
|
node.connect(audioContext.destination); // Required to keep node alive in some browsers
|
|
@@ -225,7 +226,6 @@ var useSpeechAIRecorder = function (url, onTranscript, authToken) {
|
|
|
225
226
|
}
|
|
226
227
|
// Turn off any other speech recording through the SpeechManager singleton.
|
|
227
228
|
// Register this stream as the current one.
|
|
228
|
-
console.log("START SESSION");
|
|
229
229
|
SpeechManager.startNewSession(function () {
|
|
230
230
|
cleanup();
|
|
231
231
|
});
|
|
@@ -246,7 +246,6 @@ var useSpeechAIRecorder = function (url, onTranscript, authToken) {
|
|
|
246
246
|
turnsRef.current = {};
|
|
247
247
|
// WebSocket connection established
|
|
248
248
|
ws.onopen = function () {
|
|
249
|
-
console.log('WebSocket connected.');
|
|
250
249
|
// Start recording and streaming chunks
|
|
251
250
|
startRecording(function (audioChunk) {
|
|
252
251
|
if (ws.readyState === WebSocket.OPEN) {
|
|
@@ -261,7 +260,13 @@ var useSpeechAIRecorder = function (url, onTranscript, authToken) {
|
|
|
261
260
|
};
|
|
262
261
|
// Handle messages from AssemblyAI
|
|
263
262
|
ws.onmessage = function (event) {
|
|
264
|
-
var msg
|
|
263
|
+
var msg;
|
|
264
|
+
try {
|
|
265
|
+
msg = JSON.parse(event.data);
|
|
266
|
+
}
|
|
267
|
+
catch (_a) {
|
|
268
|
+
return; // Ignore non-JSON / binary frames.
|
|
269
|
+
}
|
|
265
270
|
if (msg.type === 'Turn') {
|
|
266
271
|
var turn_order = msg.turn_order, transcript = msg.transcript;
|
|
267
272
|
turnsRef.current[turn_order] = transcript;
|
|
@@ -276,9 +281,7 @@ var useSpeechAIRecorder = function (url, onTranscript, authToken) {
|
|
|
276
281
|
ws.onerror = function (err) {
|
|
277
282
|
console.error('WebSocket error:', err);
|
|
278
283
|
};
|
|
279
|
-
ws.onclose = function () {
|
|
280
|
-
console.log('WebSocket closed.');
|
|
281
|
-
};
|
|
284
|
+
ws.onclose = function () { };
|
|
282
285
|
return [2 /*return*/];
|
|
283
286
|
}
|
|
284
287
|
});
|
package/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -5,7 +5,7 @@ interface IProps {
|
|
|
5
5
|
/**
|
|
6
6
|
* Current value.
|
|
7
7
|
*/
|
|
8
|
-
value: Date;
|
|
8
|
+
value: Date | null;
|
|
9
9
|
/**
|
|
10
10
|
* Is control currently open?
|
|
11
11
|
*/
|
|
@@ -27,6 +27,6 @@ interface IProps {
|
|
|
27
27
|
attributes: any;
|
|
28
28
|
}
|
|
29
29
|
declare const Body: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<IProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
30
|
-
ref?: React.
|
|
30
|
+
ref?: React.RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null | undefined;
|
|
31
31
|
}, never>> & string & Omit<React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLDivElement>>, keyof React.Component<any, {}, any>>;
|
|
32
32
|
export { Body };
|
package/inputs/DateInput/Body.js
CHANGED
|
@@ -34,23 +34,27 @@ var BodyBase = React.forwardRef(function (props, ref) {
|
|
|
34
34
|
var handleDayClick = function (date) {
|
|
35
35
|
props.onSelect(date);
|
|
36
36
|
};
|
|
37
|
-
//
|
|
37
|
+
//
|
|
38
38
|
// Moves current view by specified number of months.
|
|
39
|
-
//
|
|
39
|
+
//
|
|
40
40
|
var handleMove = function (months) {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
var d = new Date(date);
|
|
42
|
+
d.setMonth(d.getMonth() + months);
|
|
43
|
+
setDate(d);
|
|
43
44
|
};
|
|
44
45
|
var handlePrevYear = function () { return handleMove(-12); };
|
|
45
46
|
var handleNextYear = function () { return handleMove(12); };
|
|
46
47
|
var handlePrevMonth = function () { return handleMove(-1); };
|
|
47
48
|
var handleNextMonth = function () { return handleMove(1); };
|
|
48
49
|
var handleMonth = function (month) {
|
|
49
|
-
date
|
|
50
|
-
|
|
50
|
+
var d = new Date(date);
|
|
51
|
+
d.setMonth(month);
|
|
52
|
+
setDate(d);
|
|
51
53
|
};
|
|
52
54
|
var handleYear = function (year) {
|
|
53
|
-
date
|
|
55
|
+
var d = new Date(date);
|
|
56
|
+
d.setFullYear(year);
|
|
57
|
+
setDate(d);
|
|
54
58
|
};
|
|
55
59
|
return (React.createElement("div", __assign({ style: props.styles.popper }, props.attributes.popper, { className: props.className, tabIndex: -1, ref: ref, onMouseDown: function (e) { return e.stopPropagation(); } }),
|
|
56
60
|
React.createElement(Navbar, { date: date, onPrevYear: handlePrevYear, onNextYear: handleNextYear, onPrevMonth: handlePrevMonth, onNextMonth: handleNextMonth, onMonth: handleMonth, onYear: handleYear }),
|
|
@@ -5,7 +5,7 @@ interface IProps {
|
|
|
5
5
|
/** Current date. Will be highlighted. */
|
|
6
6
|
date: Date;
|
|
7
7
|
/** Selected date. Will be highlighted. */
|
|
8
|
-
selectedDate: Date;
|
|
8
|
+
selectedDate: Date | null;
|
|
9
9
|
/** If set, don't allow picking days beyond today. */
|
|
10
10
|
nofuture?: boolean;
|
|
11
11
|
/** Fired when a date is clicked. */
|
|
@@ -7,6 +7,7 @@ import * as React from 'react';
|
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { Day } from './Day';
|
|
9
9
|
var CalendarBase = function (props) {
|
|
10
|
+
var _a;
|
|
10
11
|
// Returns true if two dates are equal.
|
|
11
12
|
var isDateEqual = function (d1, d2) {
|
|
12
13
|
return (d1.getFullYear() === d2.getFullYear() &&
|
|
@@ -26,10 +27,7 @@ var CalendarBase = function (props) {
|
|
|
26
27
|
start.setDate(start.getDate() - 1);
|
|
27
28
|
}
|
|
28
29
|
// Create a date for the last day of the month.
|
|
29
|
-
var
|
|
30
|
-
if (month > 12)
|
|
31
|
-
month = 1;
|
|
32
|
-
var end = new Date(props.date.getFullYear(), month, 0);
|
|
30
|
+
var end = new Date(props.date.getFullYear(), props.date.getMonth() + 1, 0);
|
|
33
31
|
// Move forward until it's a Sunday.
|
|
34
32
|
while (end.getDay() !== 0) {
|
|
35
33
|
end.setDate(end.getDate() + 1);
|
|
@@ -45,7 +43,7 @@ var CalendarBase = function (props) {
|
|
|
45
43
|
// Build array of days.
|
|
46
44
|
var days = [];
|
|
47
45
|
while (start.getTime() < end.getTime()) {
|
|
48
|
-
days.push(React.createElement(Day, { key: start.getTime(), grey: start.getMonth() != props.date.getMonth() || (props.nofuture && start > today), selected: props.selectedDate && isDateEqual(props.selectedDate, start), today: isDateEqual(today, start), day: start.getDate(), onClick: (!props.nofuture || start <= today) ? handleClick.bind(_this, new Date(start.getTime())) :
|
|
46
|
+
days.push(React.createElement(Day, { key: start.getTime(), grey: start.getMonth() != props.date.getMonth() || (((_a = props.nofuture) !== null && _a !== void 0 ? _a : false) && start > today), selected: !!props.selectedDate && isDateEqual(props.selectedDate, start), today: isDateEqual(today, start), day: start.getDate(), onClick: (!props.nofuture || start <= today) ? handleClick.bind(_this, new Date(start.getTime())) : undefined }));
|
|
49
47
|
start.setDate(start.getDate() + 1);
|
|
50
48
|
}
|
|
51
49
|
return (React.createElement("div", { "data-testid": "Calendar", className: props.className },
|
|
@@ -58,13 +58,21 @@ interface IDateInputProps extends ITestable {
|
|
|
58
58
|
*/
|
|
59
59
|
noTabIndex?: boolean;
|
|
60
60
|
/**
|
|
61
|
-
* Listeners are notified whenever the user interacts with the Input.
|
|
61
|
+
* Listeners are notified whenever the user interacts with the Input. The new
|
|
62
|
+
* value is passed (a `Date`, or `null` when cleared).
|
|
62
63
|
*/
|
|
63
|
-
onChange?: (value:
|
|
64
|
+
onChange?: (value: Date | null) => void;
|
|
64
65
|
/**
|
|
65
|
-
* Listeners are notified when the Input receives focus
|
|
66
|
+
* Listeners are notified when the Input receives focus (from outside the
|
|
67
|
+
* component; internal focus moves between the day/month/year fields do not
|
|
68
|
+
* re-fire it).
|
|
66
69
|
*/
|
|
67
70
|
onFocus?: () => void;
|
|
71
|
+
/**
|
|
72
|
+
* Optional inline styles applied to the outer element, for one-off overrides
|
|
73
|
+
* of the default styling.
|
|
74
|
+
*/
|
|
75
|
+
style?: React.CSSProperties;
|
|
68
76
|
}
|
|
69
77
|
declare const DateInput: {
|
|
70
78
|
({ direction, noTabIndex, disabled, transparent, fluid, error, clearable, nofuture, ...props }: IDateInputProps): React.JSX.Element;
|
|
@@ -41,7 +41,7 @@ var DateInputBase = function (props) {
|
|
|
41
41
|
return def;
|
|
42
42
|
if (str instanceof Date)
|
|
43
43
|
return str;
|
|
44
|
-
var date = new Date(
|
|
44
|
+
var date = new Date(str);
|
|
45
45
|
if (isNaN(date.getDate()))
|
|
46
46
|
return def;
|
|
47
47
|
return date;
|
|
@@ -91,6 +91,14 @@ var DateInputBase = function (props) {
|
|
|
91
91
|
if (e.key == 'Escape' && open)
|
|
92
92
|
setOpen(false);
|
|
93
93
|
};
|
|
94
|
+
var handleFocus = function (e) {
|
|
95
|
+
if (!props.onFocus)
|
|
96
|
+
return;
|
|
97
|
+
// Only notify when focus enters from outside the component, not when it
|
|
98
|
+
// moves between the internal day/month/year fields.
|
|
99
|
+
if (!e.currentTarget.contains(e.relatedTarget))
|
|
100
|
+
props.onFocus();
|
|
101
|
+
};
|
|
94
102
|
var _c = usePopper(wrapperRef.current, bodyRef.current, {
|
|
95
103
|
placement: props.direction == 'down' ? 'bottom-start' : 'top-start',
|
|
96
104
|
modifiers: [
|
|
@@ -102,8 +110,8 @@ var DateInputBase = function (props) {
|
|
|
102
110
|
}
|
|
103
111
|
]
|
|
104
112
|
}), styles = _c.styles, attributes = _c.attributes, update = _c.update;
|
|
105
|
-
return (React.createElement("div", { "data-testid": props['data-testid'] || "DateInput", tabIndex: -1, className: props.className, onKeyDown: handleKeyDown, ref: wrapperRef },
|
|
106
|
-
React.createElement(Selector, { value: value, disabled: props.disabled, ghost: props.ghost, transparent: props.transparent, error: props.error, clearable: props.clearable, noTabIndex: props.noTabIndex, onChange: handleChange, onClear: (!props.disabled && props.clearable && value != null) ? function () { return handleChange(null); } :
|
|
113
|
+
return (React.createElement("div", { "data-testid": props['data-testid'] || "DateInput", tabIndex: -1, className: props.className, style: props.style, onKeyDown: handleKeyDown, onFocus: handleFocus, ref: wrapperRef },
|
|
114
|
+
React.createElement(Selector, { value: value, disabled: props.disabled, ghost: props.ghost, transparent: props.transparent, error: props.error, clearable: props.clearable, noTabIndex: props.noTabIndex, onChange: handleChange, onClear: (!props.disabled && props.clearable && value != null) ? function () { return handleChange(null); } : undefined, onCalendar: handleToggle }),
|
|
107
115
|
createPortal(React.createElement(Body, { ref: bodyRef, value: value, open: open, transparent: props.transparent, nofuture: props.nofuture, onSelect: handleSelect, styles: styles, attributes: attributes }), document.body)));
|
|
108
116
|
};
|
|
109
117
|
var DateInputStyled = styled(DateInputBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n // DateInput has a minimum width.\n width: 250px;\n // A fluid DateInput occupies full horizontal width.\n ", " \n"], ["\n position: relative;\n // DateInput has a minimum width.\n width: 250px;\n // A fluid DateInput occupies full horizontal width.\n ", " \n"])), function (p) { return p.fluid && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["width: 100%;"], ["width: 100%;"]))); });
|
|
@@ -22,7 +22,7 @@ interface IProps {
|
|
|
22
22
|
* Triggered when Day is clicked. If this property is not set,
|
|
23
23
|
* then the Day will have no hover circle.
|
|
24
24
|
*/
|
|
25
|
-
onClick?: () => void;
|
|
25
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* A `Day` is a day on the calendar. It is rendered with
|
|
@@ -32,10 +32,13 @@ var InfiniteListBase = function (props) {
|
|
|
32
32
|
// Create an initial list of start-10...start+10:
|
|
33
33
|
var _a = React.useState(function () { return makeValues(props.value); }), values = _a[0], setValues = _a[1];
|
|
34
34
|
React.useEffect(function () {
|
|
35
|
-
|
|
35
|
+
var _a;
|
|
36
|
+
(_a = initialElementRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: 'instant', block: 'center' });
|
|
36
37
|
observer.current = new IntersectionObserver(intersect, { root: listRef.current, rootMargin: '0px', threshold: 0.5 });
|
|
37
38
|
}, []);
|
|
38
39
|
var intersect = function (entries, observer) {
|
|
40
|
+
if (!listRef.current)
|
|
41
|
+
return;
|
|
39
42
|
if (entries.length > 0 && entries[0].isIntersecting) {
|
|
40
43
|
// Is this the first element in the list?
|
|
41
44
|
var isFirst = listRef.current.firstChild == entries[0].target;
|
|
@@ -63,14 +66,14 @@ var InfiniteListBase = function (props) {
|
|
|
63
66
|
};
|
|
64
67
|
React.useEffect(function () {
|
|
65
68
|
// If values have changed, then start observing new top and bottom element:
|
|
66
|
-
if (observer.current) {
|
|
69
|
+
if (observer.current && listRef.current) {
|
|
67
70
|
observer.current.disconnect();
|
|
68
71
|
observer.current.observe(listRef.current.children[0]);
|
|
69
72
|
observer.current.observe(listRef.current.children[RANGE * 2]);
|
|
70
73
|
}
|
|
71
74
|
}, [values]);
|
|
72
75
|
return (React.createElement("div", { className: props.className, ref: listRef }, values.map(function (n) {
|
|
73
|
-
return React.createElement(Item, {
|
|
76
|
+
return React.createElement(Item, { key: n, "$active": props.value === n, ref: n == props.value ? initialElementRef : null, onClick: function () { return props.onClick(n); } }, n);
|
|
74
77
|
})));
|
|
75
78
|
};
|
|
76
79
|
var Item = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject([" \n height: 42px;\n padding-left: 28px;\n padding-right: 28px;\n display: flex;\n align-items: center;\n cursor: pointer;\n font: ", ";\n &:hover {\n background-color: ", ";\n } \n ", "\n &:active {\n background-color: rgb(from ", " r g b / 65%) !important;\n color: ", ";\n }\n"], [" \n height: 42px;\n padding-left: 28px;\n padding-right: 28px;\n display: flex;\n align-items: center;\n cursor: pointer;\n font: ", ";\n &:hover {\n background-color: ", ";\n } \n ", "\n &:active {\n background-color: rgb(from ", " r g b / 65%) !important;\n color: ", ";\n }\n"])), function (p) { return p.theme.font.bodyMedium; }, function (p) { return p.theme.colors.neutral[80]; }, function (p) { return p.$active && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: rgb(from ", " r g b / 45%) !important;\n color: ", ";\n "], ["\n background-color: rgb(from ", " r g b / 45%) !important;\n color: ", ";\n "])), function (p) { return p.theme.colors.primary[2]; }, function (p) { return p.theme.colors.neutral[100]; }); }, function (p) { return p.theme.colors.primary[2]; }, function (p) { return p.theme.colors.neutral[100]; });
|
|
@@ -9,11 +9,12 @@ import { SimpleList } from './SimpleList';
|
|
|
9
9
|
import { InfiniteList } from './InfiniteList';
|
|
10
10
|
var NavbarBase = function (props) {
|
|
11
11
|
var _a = React.useState(null), mode = _a[0], setMode = _a[1];
|
|
12
|
-
// Listen for document-wide keypress.
|
|
12
|
+
// Listen for document-wide keypress. Re-bind only when mode changes (the
|
|
13
|
+
// handler closes over mode), rather than on every render.
|
|
13
14
|
React.useEffect(function () {
|
|
14
15
|
document.addEventListener('keydown', handleKeyDown);
|
|
15
16
|
return function () { return document.removeEventListener('keydown', handleKeyDown); };
|
|
16
|
-
});
|
|
17
|
+
}, [mode]);
|
|
17
18
|
// Close nav if ESC is pressed.
|
|
18
19
|
var handleKeyDown = function (e) {
|
|
19
20
|
if (e.key == 'Escape' && mode != null) {
|
|
@@ -17,6 +17,9 @@ import * as React from 'react';
|
|
|
17
17
|
import styled from 'styled-components';
|
|
18
18
|
var NumericInputBase = React.forwardRef(function (props, ref) {
|
|
19
19
|
var handleKeyDown = function (e) {
|
|
20
|
+
// Allow keyboard shortcuts (copy/paste/select-all, etc.).
|
|
21
|
+
if (e.ctrlKey || e.metaKey)
|
|
22
|
+
return;
|
|
20
23
|
if (['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes(e.key))
|
|
21
24
|
return;
|
|
22
25
|
if (e.key == 'Backspace')
|
|
@@ -29,6 +29,7 @@ var Selector = function (props) {
|
|
|
29
29
|
// click on Save) arrives before React's effect phase — losing the
|
|
30
30
|
// most-recent keystroke.
|
|
31
31
|
var emit = function (d, m, y) {
|
|
32
|
+
var _a;
|
|
32
33
|
var numDay = parseInt(d);
|
|
33
34
|
var numMonth = parseInt(m);
|
|
34
35
|
var numYear = parseInt(y);
|
|
@@ -37,22 +38,24 @@ var Selector = function (props) {
|
|
|
37
38
|
var date = new Date(numYear, numMonth - 1, numDay);
|
|
38
39
|
// Overwrite year, because Date.new converts 0-99 to 1900-1999.
|
|
39
40
|
date.setFullYear(numYear);
|
|
40
|
-
props.onChange(date);
|
|
41
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, date);
|
|
41
42
|
};
|
|
42
43
|
var handleDayChange = function (v) { setDay(v); emit(v, month, year); };
|
|
43
44
|
var handleMonthChange = function (v) { setMonth(v); emit(day, v, year); };
|
|
44
45
|
var handleYearChange = function (v) { setYear(v); emit(day, month, v); };
|
|
45
46
|
// Move focus to month input.
|
|
46
47
|
var focusMonth = function () {
|
|
47
|
-
|
|
48
|
-
monthRef.current.
|
|
48
|
+
var _a, _b;
|
|
49
|
+
(_a = monthRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
50
|
+
(_b = monthRef.current) === null || _b === void 0 ? void 0 : _b.select();
|
|
49
51
|
};
|
|
50
52
|
// Move focus to year input.
|
|
51
53
|
var focusYear = function () {
|
|
52
|
-
|
|
53
|
-
yearRef.current.
|
|
54
|
+
var _a, _b;
|
|
55
|
+
(_a = yearRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
56
|
+
(_b = yearRef.current) === null || _b === void 0 ? void 0 : _b.select();
|
|
54
57
|
};
|
|
55
|
-
return (React.createElement(InputWrapper, { fluid: true, error: props.error, disabled: props.disabled, ghost: props.ghost, transparent: props.transparent, onClear: (props.clearable && props.value) ? props.onClear :
|
|
58
|
+
return (React.createElement(InputWrapper, { fluid: true, error: props.error, disabled: props.disabled, ghost: props.ghost, transparent: props.transparent, onClear: (props.clearable && props.value) ? props.onClear : undefined, icon: { url: SVG.Icons.Calendar, color: theme.colors.primary[3], onClick: props.onCalendar }, iconPosition: 'right' },
|
|
56
59
|
React.createElement(NumericInput, { disabled: props.disabled, width: 38, maxLength: 2, placeholder: "dd", value: day, onChange: handleDayChange, onBlur: focusMonth }),
|
|
57
60
|
"/",
|
|
58
61
|
React.createElement(NumericInput, { disabled: props.disabled, width: 38, maxLength: 2, placeholder: "mm", value: month, onChange: handleMonthChange, ref: monthRef, onBlur: focusYear }),
|
|
@@ -13,7 +13,7 @@ interface IProps {
|
|
|
13
13
|
/** Search callback (optional) */
|
|
14
14
|
onSearch?: (q: string) => void;
|
|
15
15
|
/** Current search value */
|
|
16
|
-
search?: string;
|
|
16
|
+
search?: string | null;
|
|
17
17
|
/** If set, list items will be extra tall. */
|
|
18
18
|
tall?: boolean;
|
|
19
19
|
/** Minimum body width for narrow dropdowns. */
|
|
@@ -22,6 +22,6 @@ interface IProps {
|
|
|
22
22
|
attributes: any;
|
|
23
23
|
}
|
|
24
24
|
declare const Body: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<IProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
25
|
-
ref?: React.
|
|
25
|
+
ref?: React.RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null | undefined;
|
|
26
26
|
}, never>> & string & Omit<React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLDivElement>>, keyof React.Component<any, {}, any>>;
|
|
27
27
|
export { Body };
|
|
@@ -113,6 +113,11 @@ interface IDropdownProps extends ITestable {
|
|
|
113
113
|
* is closed.
|
|
114
114
|
*/
|
|
115
115
|
onClose?: () => void;
|
|
116
|
+
/**
|
|
117
|
+
* Optional inline styles applied to the outer element, for one-off overrides
|
|
118
|
+
* of the default styling.
|
|
119
|
+
*/
|
|
120
|
+
style?: React.CSSProperties;
|
|
116
121
|
}
|
|
117
122
|
/**
|
|
118
123
|
* A `Dropdown` is a replacement for `<select>` (select). It opens upwards or
|