@doist/reactist 11.5.0 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/reactist.cjs.development.js +1344 -1499
- package/dist/reactist.cjs.development.js.map +1 -1
- package/dist/reactist.cjs.production.min.js +1 -1
- package/dist/reactist.cjs.production.min.js.map +1 -1
- package/es/_virtual/_rollupPluginBabelHelpers.js +18 -21
- package/es/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/es/components/checkbox/checkbox.js +7 -9
- package/es/components/checkbox/checkbox.js.map +1 -1
- package/es/components/color-picker/color-picker.js +24 -28
- package/es/components/color-picker/color-picker.js.map +1 -1
- package/es/components/deprecated-button/deprecated-button.js +16 -18
- package/es/components/deprecated-button/deprecated-button.js.map +1 -1
- package/es/components/deprecated-loading/deprecated-loading.js +7 -10
- package/es/components/deprecated-loading/deprecated-loading.js.map +1 -1
- package/es/components/deprecated-modal/deprecated-modal.js +69 -101
- package/es/components/deprecated-modal/deprecated-modal.js.map +1 -1
- package/es/components/deprecated-modal/index.js +4 -4
- package/es/components/deprecated-modal/index.js.map +1 -1
- package/es/components/dropdown/dropdown.js +86 -85
- package/es/components/dropdown/dropdown.js.map +1 -1
- package/es/components/icons/CloseIcon.svg.js +9 -11
- package/es/components/icons/CloseIcon.svg.js.map +1 -1
- package/es/components/input/input.js +4 -3
- package/es/components/input/input.js.map +1 -1
- package/es/components/key-capturer/key-capturer.js +22 -19
- package/es/components/key-capturer/key-capturer.js.map +1 -1
- package/es/components/keyboard-shortcut/keyboard-shortcut.js +20 -26
- package/es/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
- package/es/components/menu/menu.js +112 -142
- package/es/components/menu/menu.js.map +1 -1
- package/es/components/notification/notification.js +32 -32
- package/es/components/notification/notification.js.map +1 -1
- package/es/components/popover/popover.js +85 -91
- package/es/components/popover/popover.js.map +1 -1
- package/es/components/popover/positioning-utils.js +49 -65
- package/es/components/popover/positioning-utils.js.map +1 -1
- package/es/components/progress-bar/progress-bar.js +8 -8
- package/es/components/progress-bar/progress-bar.js.map +1 -1
- package/es/components/select/select.js +20 -25
- package/es/components/select/select.js.map +1 -1
- package/es/components/time/time-utils.js +30 -47
- package/es/components/time/time-utils.js.map +1 -1
- package/es/components/time/time.js +43 -56
- package/es/components/time/time.js.map +1 -1
- package/es/components/tooltip/tooltip.js +43 -46
- package/es/components/tooltip/tooltip.js.map +1 -1
- package/es/hooks/use-previous/use-previous.js +2 -2
- package/es/hooks/use-previous/use-previous.js.map +1 -1
- package/es/new-components/alert/alert.js +7 -6
- package/es/new-components/alert/alert.js.map +1 -1
- package/es/new-components/avatar/avatar.js +19 -18
- package/es/new-components/avatar/avatar.js.map +1 -1
- package/es/new-components/avatar/utils.js +12 -9
- package/es/new-components/avatar/utils.js.map +1 -1
- package/es/new-components/base-button/base-button.js +25 -29
- package/es/new-components/base-button/base-button.js.map +1 -1
- package/es/new-components/base-field/base-field.js +20 -18
- package/es/new-components/base-field/base-field.js.map +1 -1
- package/es/new-components/box/box.js +51 -52
- package/es/new-components/box/box.js.map +1 -1
- package/es/new-components/button/button.js +13 -15
- package/es/new-components/button/button.js.map +1 -1
- package/es/new-components/button-link/button-link.js +13 -15
- package/es/new-components/button-link/button-link.js.map +1 -1
- package/es/new-components/checkbox-field/checkbox-field.js +25 -33
- package/es/new-components/checkbox-field/checkbox-field.js.map +1 -1
- package/es/new-components/checkbox-field/checkbox-icon.js +21 -19
- package/es/new-components/checkbox-field/checkbox-icon.js.map +1 -1
- package/es/new-components/columns/columns.js +24 -27
- package/es/new-components/columns/columns.js.map +1 -1
- package/es/new-components/common-helpers.js +3 -3
- package/es/new-components/common-helpers.js.map +1 -1
- package/es/new-components/divider/divider.js +7 -6
- package/es/new-components/divider/divider.js.map +1 -1
- package/es/new-components/heading/heading.js +17 -17
- package/es/new-components/heading/heading.js.map +1 -1
- package/es/new-components/hidden/hidden.js +14 -13
- package/es/new-components/hidden/hidden.js.map +1 -1
- package/es/new-components/hidden-visually/hidden-visually.js +3 -2
- package/es/new-components/hidden-visually/hidden-visually.js.map +1 -1
- package/es/new-components/icons/alert-icon.js +13 -11
- package/es/new-components/icons/alert-icon.js.map +1 -1
- package/es/new-components/icons/close-icon.js +2 -1
- package/es/new-components/icons/close-icon.js.map +1 -1
- package/es/new-components/icons/password-hidden-icon.js +2 -1
- package/es/new-components/icons/password-hidden-icon.js.map +1 -1
- package/es/new-components/icons/password-visible-icon.js +2 -1
- package/es/new-components/icons/password-visible-icon.js.map +1 -1
- package/es/new-components/inline/inline.js +15 -19
- package/es/new-components/inline/inline.js.map +1 -1
- package/es/new-components/loading/loading.js +12 -10
- package/es/new-components/loading/loading.js.map +1 -1
- package/es/new-components/modal/modal.js +64 -66
- package/es/new-components/modal/modal.js.map +1 -1
- package/es/new-components/modal/modal.module.css.js +1 -1
- package/es/new-components/notice/notice.js +5 -4
- package/es/new-components/notice/notice.js.map +1 -1
- package/es/new-components/password-field/password-field.js +40 -46
- package/es/new-components/password-field/password-field.js.map +1 -1
- package/es/new-components/responsive-props.js +5 -5
- package/es/new-components/responsive-props.js.map +1 -1
- package/es/new-components/select-field/select-field.js +23 -23
- package/es/new-components/select-field/select-field.js.map +1 -1
- package/es/new-components/spinner/spinner.js +3 -3
- package/es/new-components/spinner/spinner.js.map +1 -1
- package/es/new-components/stack/stack.js +18 -22
- package/es/new-components/stack/stack.js.map +1 -1
- package/es/new-components/switch-field/switch-field.js +31 -41
- package/es/new-components/switch-field/switch-field.js.map +1 -1
- package/es/new-components/tabs/tabs.js +92 -78
- package/es/new-components/tabs/tabs.js.map +1 -1
- package/es/new-components/tabs/tabs.module.css.js +1 -1
- package/es/new-components/text/text.js +16 -17
- package/es/new-components/text/text.js.map +1 -1
- package/es/new-components/text/text.module.css.js +1 -1
- package/es/new-components/text-area/text-area.js +14 -14
- package/es/new-components/text-area/text-area.js.map +1 -1
- package/es/new-components/text-field/text-field.js +21 -22
- package/es/new-components/text-field/text-field.js.map +1 -1
- package/es/new-components/text-link/text-link.js +10 -10
- package/es/new-components/text-link/text-link.js.map +1 -1
- package/es/new-components/text-link/text-link.module.css.js +1 -1
- package/es/utils/polymorphism.js.map +1 -1
- package/lib/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/lib/components/checkbox/checkbox.js +1 -1
- package/lib/components/checkbox/checkbox.js.map +1 -1
- package/lib/components/color-picker/color-picker.js +1 -1
- package/lib/components/color-picker/color-picker.js.map +1 -1
- package/lib/components/deprecated-button/deprecated-button.d.ts +3 -3
- package/lib/components/deprecated-button/deprecated-button.js +1 -1
- package/lib/components/deprecated-button/deprecated-button.js.map +1 -1
- package/lib/components/deprecated-loading/deprecated-loading.js +1 -1
- package/lib/components/deprecated-loading/deprecated-loading.js.map +1 -1
- package/lib/components/deprecated-modal/deprecated-modal.d.ts +2 -2
- package/lib/components/deprecated-modal/deprecated-modal.js +1 -1
- package/lib/components/deprecated-modal/deprecated-modal.js.map +1 -1
- package/lib/components/deprecated-modal/index.js.map +1 -1
- package/lib/components/dropdown/dropdown.d.ts +5 -2
- package/lib/components/dropdown/dropdown.js +1 -1
- package/lib/components/dropdown/dropdown.js.map +1 -1
- package/lib/components/icons/CloseIcon.svg.js +1 -1
- package/lib/components/icons/CloseIcon.svg.js.map +1 -1
- package/lib/components/input/input.js +1 -1
- package/lib/components/input/input.js.map +1 -1
- package/lib/components/key-capturer/key-capturer.d.ts +1 -1
- package/lib/components/key-capturer/key-capturer.js +1 -1
- package/lib/components/key-capturer/key-capturer.js.map +1 -1
- package/lib/components/keyboard-shortcut/keyboard-shortcut.js +1 -1
- package/lib/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
- package/lib/components/menu/menu.d.ts +7 -7
- package/lib/components/menu/menu.js +1 -1
- package/lib/components/menu/menu.js.map +1 -1
- package/lib/components/notification/notification.js +1 -1
- package/lib/components/notification/notification.js.map +1 -1
- package/lib/components/popover/popover.d.ts +1 -1
- package/lib/components/popover/popover.js +1 -1
- package/lib/components/popover/popover.js.map +1 -1
- package/lib/components/popover/positioning-utils.js +1 -1
- package/lib/components/popover/positioning-utils.js.map +1 -1
- package/lib/components/progress-bar/progress-bar.js +1 -1
- package/lib/components/progress-bar/progress-bar.js.map +1 -1
- package/lib/components/select/select.js +1 -1
- package/lib/components/select/select.js.map +1 -1
- package/lib/components/time/time-utils.js +1 -1
- package/lib/components/time/time-utils.js.map +1 -1
- package/lib/components/time/time.js +1 -1
- package/lib/components/time/time.js.map +1 -1
- package/lib/components/tooltip/index.d.ts +1 -2
- package/lib/components/tooltip/tooltip.d.ts +3 -3
- package/lib/components/tooltip/tooltip.js +1 -1
- package/lib/components/tooltip/tooltip.js.map +1 -1
- package/lib/hooks/use-previous/use-previous.js +1 -1
- package/lib/hooks/use-previous/use-previous.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/new-components/alert/alert.d.ts +1 -1
- package/lib/new-components/alert/alert.js +1 -1
- package/lib/new-components/alert/alert.js.map +1 -1
- package/lib/new-components/avatar/avatar.js +1 -1
- package/lib/new-components/avatar/avatar.js.map +1 -1
- package/lib/new-components/avatar/utils.d.ts +1 -1
- package/lib/new-components/avatar/utils.js +1 -1
- package/lib/new-components/avatar/utils.js.map +1 -1
- package/lib/new-components/base-button/base-button.js +1 -1
- package/lib/new-components/base-button/base-button.js.map +1 -1
- package/lib/new-components/base-field/base-field.d.ts +1 -1
- package/lib/new-components/base-field/base-field.js +1 -1
- package/lib/new-components/base-field/base-field.js.map +1 -1
- package/lib/new-components/box/box.js +1 -1
- package/lib/new-components/box/box.js.map +1 -1
- package/lib/new-components/button/button.d.ts +1 -58
- package/lib/new-components/button/button.js +1 -1
- package/lib/new-components/button/button.js.map +1 -1
- package/lib/new-components/button-link/button-link.js +1 -1
- package/lib/new-components/button-link/button-link.js.map +1 -1
- package/lib/new-components/checkbox-field/checkbox-field.d.ts +1 -1
- package/lib/new-components/checkbox-field/checkbox-field.js +1 -1
- package/lib/new-components/checkbox-field/checkbox-field.js.map +1 -1
- package/lib/new-components/checkbox-field/checkbox-icon.js +1 -1
- package/lib/new-components/checkbox-field/checkbox-icon.js.map +1 -1
- package/lib/new-components/columns/columns.js +1 -1
- package/lib/new-components/columns/columns.js.map +1 -1
- package/lib/new-components/common-helpers.js +1 -1
- package/lib/new-components/common-helpers.js.map +1 -1
- package/lib/new-components/common-types.d.ts +2 -2
- package/lib/new-components/divider/divider.js +1 -1
- package/lib/new-components/divider/divider.js.map +1 -1
- package/lib/new-components/heading/heading.d.ts +2 -2
- package/lib/new-components/heading/heading.js +1 -1
- package/lib/new-components/heading/heading.js.map +1 -1
- package/lib/new-components/hidden/hidden.js +1 -1
- package/lib/new-components/hidden/hidden.js.map +1 -1
- package/lib/new-components/hidden-visually/hidden-visually.js +1 -1
- package/lib/new-components/hidden-visually/hidden-visually.js.map +1 -1
- package/lib/new-components/icons/alert-icon.d.ts +1 -1
- package/lib/new-components/icons/alert-icon.js +1 -1
- package/lib/new-components/icons/alert-icon.js.map +1 -1
- package/lib/new-components/icons/close-icon.js +1 -1
- package/lib/new-components/icons/close-icon.js.map +1 -1
- package/lib/new-components/icons/password-hidden-icon.js +1 -1
- package/lib/new-components/icons/password-hidden-icon.js.map +1 -1
- package/lib/new-components/icons/password-visible-icon.js +1 -1
- package/lib/new-components/icons/password-visible-icon.js.map +1 -1
- package/lib/new-components/inline/inline.js +1 -1
- package/lib/new-components/inline/inline.js.map +1 -1
- package/lib/new-components/loading/loading.d.ts +1 -1
- package/lib/new-components/loading/loading.js +1 -1
- package/lib/new-components/loading/loading.js.map +1 -1
- package/lib/new-components/modal/modal.js +1 -1
- package/lib/new-components/modal/modal.js.map +1 -1
- package/lib/new-components/modal/modal.module.css.js +1 -1
- package/lib/new-components/notice/notice.d.ts +1 -1
- package/lib/new-components/notice/notice.js +1 -1
- package/lib/new-components/notice/notice.js.map +1 -1
- package/lib/new-components/password-field/password-field.d.ts +1 -1
- package/lib/new-components/password-field/password-field.js +1 -1
- package/lib/new-components/password-field/password-field.js.map +1 -1
- package/lib/new-components/responsive-props.d.ts +1 -1
- package/lib/new-components/responsive-props.js +1 -1
- package/lib/new-components/responsive-props.js.map +1 -1
- package/lib/new-components/select-field/select-field.d.ts +1 -1
- package/lib/new-components/select-field/select-field.js +1 -1
- package/lib/new-components/select-field/select-field.js.map +1 -1
- package/lib/new-components/spinner/spinner.js +1 -1
- package/lib/new-components/spinner/spinner.js.map +1 -1
- package/lib/new-components/stack/stack.js +1 -1
- package/lib/new-components/stack/stack.js.map +1 -1
- package/lib/new-components/switch-field/switch-field.d.ts +1 -1
- package/lib/new-components/switch-field/switch-field.js +1 -1
- package/lib/new-components/switch-field/switch-field.js.map +1 -1
- package/lib/new-components/tabs/tabs.d.ts +13 -3
- package/lib/new-components/tabs/tabs.js +1 -1
- package/lib/new-components/tabs/tabs.js.map +1 -1
- package/lib/new-components/tabs/tabs.module.css.js +1 -1
- package/lib/new-components/test-helpers.d.ts +4 -3
- package/lib/new-components/text/text.js +1 -1
- package/lib/new-components/text/text.js.map +1 -1
- package/lib/new-components/text/text.module.css.js +1 -1
- package/lib/new-components/text-area/text-area.js +1 -1
- package/lib/new-components/text-area/text-area.js.map +1 -1
- package/lib/new-components/text-field/text-field.d.ts +1 -1
- package/lib/new-components/text-field/text-field.js +1 -1
- package/lib/new-components/text-field/text-field.js.map +1 -1
- package/lib/new-components/text-link/text-link.js +1 -1
- package/lib/new-components/text-link/text-link.js.map +1 -1
- package/lib/new-components/text-link/text-link.module.css.js +1 -1
- package/lib/utils/polymorphism.js.map +1 -1
- package/package.json +45 -38
- package/styles/base-field.css +1 -1
- package/styles/checkbox-field.css +1 -1
- package/styles/menu.css +1 -1
- package/styles/modal.css +1 -1
- package/styles/modal.module.css.css +1 -1
- package/styles/password-field.css +1 -1
- package/styles/reactist.css +6 -6
- package/styles/select-field.css +1 -1
- package/styles/switch-field.css +1 -1
- package/styles/tabs.css +1 -1
- package/styles/tabs.module.css.css +1 -1
- package/styles/text-area.css +1 -1
- package/styles/text-field.css +1 -1
- package/styles/text-link.css +1 -1
- package/styles/text-link.module.css.css +1 -1
- package/styles/text.css +1 -1
- package/styles/text.module.css.css +1 -1
|
@@ -8,16 +8,16 @@ var React = require('react');
|
|
|
8
8
|
var React__default = _interopDefault(React);
|
|
9
9
|
var classNames = _interopDefault(require('classnames'));
|
|
10
10
|
var flattenChildren = _interopDefault(require('react-keyed-flatten-children'));
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
11
|
+
var tooltip = require('ariakit/tooltip');
|
|
12
|
+
var ariakitUtils = require('ariakit-utils');
|
|
13
|
+
var tab = require('ariakit/tab');
|
|
14
14
|
var dialog = require('@reach/dialog');
|
|
15
15
|
var FocusLock = _interopDefault(require('react-focus-lock'));
|
|
16
16
|
var ReactDOM = _interopDefault(require('react-dom'));
|
|
17
17
|
var dayjs = _interopDefault(require('dayjs'));
|
|
18
18
|
var LocalizedFormat = _interopDefault(require('dayjs/plugin/localizedFormat'));
|
|
19
|
-
var
|
|
20
|
-
var
|
|
19
|
+
var Ariakit = require('ariakit/menu');
|
|
20
|
+
var portal = require('ariakit/portal');
|
|
21
21
|
|
|
22
22
|
function ownKeys(object, enumerableOnly) {
|
|
23
23
|
var keys = Object.keys(object);
|
|
@@ -72,22 +72,6 @@ function _defineProperty(obj, key, value) {
|
|
|
72
72
|
return obj;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
function _inheritsLoose(subClass, superClass) {
|
|
76
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
77
|
-
subClass.prototype.constructor = subClass;
|
|
78
|
-
|
|
79
|
-
_setPrototypeOf(subClass, superClass);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function _setPrototypeOf(o, p) {
|
|
83
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
84
|
-
o.__proto__ = p;
|
|
85
|
-
return o;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
return _setPrototypeOf(o, p);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
75
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
92
76
|
if (source == null) return {};
|
|
93
77
|
var target = {};
|
|
@@ -103,12 +87,25 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
103
87
|
return target;
|
|
104
88
|
}
|
|
105
89
|
|
|
106
|
-
function
|
|
107
|
-
if (
|
|
108
|
-
|
|
90
|
+
function _objectWithoutProperties(source, excluded) {
|
|
91
|
+
if (source == null) return {};
|
|
92
|
+
|
|
93
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
94
|
+
|
|
95
|
+
var key, i;
|
|
96
|
+
|
|
97
|
+
if (Object.getOwnPropertySymbols) {
|
|
98
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
99
|
+
|
|
100
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
101
|
+
key = sourceSymbolKeys[i];
|
|
102
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
103
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
104
|
+
target[key] = source[key];
|
|
105
|
+
}
|
|
109
106
|
}
|
|
110
107
|
|
|
111
|
-
return
|
|
108
|
+
return target;
|
|
112
109
|
}
|
|
113
110
|
|
|
114
111
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -147,7 +144,7 @@ function getClassNames(styles, property, value) {
|
|
|
147
144
|
return null;
|
|
148
145
|
}
|
|
149
146
|
|
|
150
|
-
|
|
147
|
+
const classList = [];
|
|
151
148
|
|
|
152
149
|
if (typeof value === 'string') {
|
|
153
150
|
classList.push(styles[property + "-" + value]);
|
|
@@ -160,9 +157,9 @@ function getClassNames(styles, property, value) {
|
|
|
160
157
|
if ( !classList.every(Boolean)) {
|
|
161
158
|
// eslint-disable-next-line no-console
|
|
162
159
|
console.warn('Not all generated class names were found', {
|
|
163
|
-
property
|
|
164
|
-
value
|
|
165
|
-
classList
|
|
160
|
+
property,
|
|
161
|
+
value,
|
|
162
|
+
classList
|
|
166
163
|
});
|
|
167
164
|
}
|
|
168
165
|
|
|
@@ -204,81 +201,81 @@ var modules_131405ac = {"marginTop-xsmall":"c7813d79","marginTop-small":"d3449da
|
|
|
204
201
|
|
|
205
202
|
var modules_89b7671c = {"minWidth-0":"_68ab48ca","minWidth-xsmall":"_6fa2b565","minWidth-small":"dd50fabd","minWidth-medium":"e7e2c808","minWidth-large":"_6abbe25e","minWidth-xlarge":"_54f479ac","maxWidth-xsmall":"_148492bc","maxWidth-small":"bd023b96","maxWidth-medium":"e102903f","maxWidth-large":"_0e8d76d7","maxWidth-xlarge":"_47a031d0","maxWidth-full":"cd4c8183","width-0":"_5f5959e8","width-full":"_8c75067a","width-auto":"_56a651f6","width-maxContent":"_26f87bb8","width-minContent":"_07a6ab44","width-fitContent":"a87016fa","width-xsmall":"_1a972e50","width-small":"c96d8261","width-medium":"f3829d42","width-large":"_2caef228","width-xlarge":"_069e1491"};
|
|
206
203
|
|
|
207
|
-
|
|
208
|
-
|
|
204
|
+
const _excluded = ["as", "position", "display", "flexDirection", "flexWrap", "flexGrow", "flexShrink", "alignItems", "justifyContent", "alignSelf", "overflow", "width", "height", "background", "border", "borderRadius", "minWidth", "maxWidth", "textAlign", "padding", "paddingY", "paddingX", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "margin", "marginY", "marginX", "marginTop", "marginRight", "marginBottom", "marginLeft", "className", "children"];
|
|
205
|
+
const Box = /*#__PURE__*/polymorphicComponent(function Box(_ref, ref) {
|
|
209
206
|
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
|
|
210
207
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
var omitFlex = !display || typeof display === 'string' && display !== 'flex' && display !== 'inlineFlex';
|
|
208
|
+
let {
|
|
209
|
+
as: component = 'div',
|
|
210
|
+
position = 'static',
|
|
211
|
+
display,
|
|
212
|
+
flexDirection = 'row',
|
|
213
|
+
flexWrap,
|
|
214
|
+
flexGrow,
|
|
215
|
+
flexShrink,
|
|
216
|
+
alignItems,
|
|
217
|
+
justifyContent,
|
|
218
|
+
alignSelf,
|
|
219
|
+
overflow,
|
|
220
|
+
width,
|
|
221
|
+
height,
|
|
222
|
+
background,
|
|
223
|
+
border,
|
|
224
|
+
borderRadius,
|
|
225
|
+
minWidth,
|
|
226
|
+
maxWidth,
|
|
227
|
+
textAlign,
|
|
228
|
+
padding,
|
|
229
|
+
paddingY,
|
|
230
|
+
paddingX,
|
|
231
|
+
paddingTop,
|
|
232
|
+
paddingRight,
|
|
233
|
+
paddingBottom,
|
|
234
|
+
paddingLeft,
|
|
235
|
+
margin,
|
|
236
|
+
marginY,
|
|
237
|
+
marginX,
|
|
238
|
+
marginTop,
|
|
239
|
+
marginRight,
|
|
240
|
+
marginBottom,
|
|
241
|
+
marginLeft,
|
|
242
|
+
className,
|
|
243
|
+
children
|
|
244
|
+
} = _ref,
|
|
245
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
246
|
+
|
|
247
|
+
const resolvedPaddingTop = (_ref2 = paddingTop != null ? paddingTop : paddingY) != null ? _ref2 : padding;
|
|
248
|
+
const resolvedPaddingRight = (_ref3 = paddingRight != null ? paddingRight : paddingX) != null ? _ref3 : padding;
|
|
249
|
+
const resolvedPaddingBottom = (_ref4 = paddingBottom != null ? paddingBottom : paddingY) != null ? _ref4 : padding;
|
|
250
|
+
const resolvedPaddingLeft = (_ref5 = paddingLeft != null ? paddingLeft : paddingX) != null ? _ref5 : padding;
|
|
251
|
+
const resolvedMarginTop = (_ref6 = marginTop != null ? marginTop : marginY) != null ? _ref6 : margin;
|
|
252
|
+
const resolvedMarginRight = (_ref7 = marginRight != null ? marginRight : marginX) != null ? _ref7 : margin;
|
|
253
|
+
const resolvedMarginBottom = (_ref8 = marginBottom != null ? marginBottom : marginY) != null ? _ref8 : margin;
|
|
254
|
+
const resolvedMarginLeft = (_ref9 = marginLeft != null ? marginLeft : marginX) != null ? _ref9 : margin;
|
|
255
|
+
const omitFlex = !display || typeof display === 'string' && display !== 'flex' && display !== 'inlineFlex';
|
|
260
256
|
return /*#__PURE__*/React.createElement(component, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
261
257
|
className: classNames(className, modules_54d944f2.box, display ? getClassNames(modules_54d944f2, 'display', display) : null, position !== 'static' ? getClassNames(modules_54d944f2, 'position', position) : null, minWidth != null ? getClassNames(modules_89b7671c, 'minWidth', String(minWidth)) : null, getClassNames(modules_89b7671c, 'maxWidth', maxWidth), getClassNames(modules_54d944f2, 'textAlign', textAlign), // padding
|
|
262
258
|
getClassNames(modules_b537a8ee, 'paddingTop', resolvedPaddingTop), getClassNames(modules_b537a8ee, 'paddingRight', resolvedPaddingRight), getClassNames(modules_b537a8ee, 'paddingBottom', resolvedPaddingBottom), getClassNames(modules_b537a8ee, 'paddingLeft', resolvedPaddingLeft), // margin
|
|
263
259
|
getClassNames(modules_131405ac, 'marginTop', resolvedMarginTop), getClassNames(modules_131405ac, 'marginRight', resolvedMarginRight), getClassNames(modules_131405ac, 'marginBottom', resolvedMarginBottom), getClassNames(modules_131405ac, 'marginLeft', resolvedMarginLeft), // flex props
|
|
264
260
|
omitFlex ? null : getClassNames(modules_54d944f2, 'flexDirection', flexDirection), omitFlex ? null : getClassNames(modules_54d944f2, 'flexWrap', flexWrap), omitFlex ? null : getClassNames(modules_54d944f2, 'alignItems', alignItems), omitFlex ? null : getClassNames(modules_54d944f2, 'justifyContent', justifyContent), alignSelf != null ? getClassNames(modules_54d944f2, 'alignSelf', alignSelf) : null, flexShrink != null ? getClassNames(modules_54d944f2, 'flexShrink', String(flexShrink)) : null, flexGrow != null ? getClassNames(modules_54d944f2, 'flexGrow', String(flexGrow)) : null, // other props
|
|
265
261
|
getClassNames(modules_54d944f2, 'overflow', overflow), width != null ? getClassNames(modules_89b7671c, 'width', String(width)) : null, getClassNames(modules_54d944f2, 'height', height), getClassNames(modules_54d944f2, 'bg', background), borderRadius !== 'none' ? getClassNames(modules_54d944f2, 'borderRadius', borderRadius) : null, border !== 'none' ? getClassNames(modules_54d944f2, 'border', border) : null) || undefined,
|
|
266
|
-
ref
|
|
262
|
+
ref
|
|
267
263
|
}), children);
|
|
268
264
|
});
|
|
269
265
|
|
|
270
266
|
var modules_67f2d07a = {"space-xsmall":"_6f59c771","column":"_91e05f0f","space-small":"_5a55af26","space-medium":"fa261310","space-large":"_6ebd4e46","space-xlarge":"_55ce4aea","space-xxlarge":"_04c9c3ac","tablet-space-xsmall":"ab76d8cd","tablet-space-small":"_14629bfb","tablet-space-medium":"_5b4e39ea","tablet-space-large":"ba270182","tablet-space-xlarge":"b96e7ec7","tablet-space-xxlarge":"d276612c","desktop-space-xsmall":"d7a73106","desktop-space-small":"_8f5e0e9e","desktop-space-medium":"_3a168411","desktop-space-large":"_0abcc12e","desktop-space-xlarge":"e0bafc60","desktop-space-xxlarge":"d2df9afd","columnWidth-auto":"b18d0b47","columnWidth-1-2":"_102a6b27","columnWidth-1-3":"_829872fe","columnWidth-2-3":"cf5aef9a","columnWidth-1-4":"_931bf714","columnWidth-3-4":"b0303130","columnWidth-1-5":"f6589a6f","columnWidth-2-5":"_2823aed9","columnWidth-3-5":"d00ba3bb","columnWidth-4-5":"_338f2d7c","tablet-tablet-space-xsmall":"_06582234"};
|
|
271
267
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
268
|
+
const _excluded$1 = ["width", "children", "exceptionallySetClassName"],
|
|
269
|
+
_excluded2 = ["space", "align", "alignY", "collapseBelow", "children", "exceptionallySetClassName"];
|
|
270
|
+
const Column = /*#__PURE__*/polymorphicComponent(function Column(_ref, ref) {
|
|
271
|
+
let {
|
|
272
|
+
width = 'auto',
|
|
273
|
+
children,
|
|
274
|
+
exceptionallySetClassName
|
|
275
|
+
} = _ref,
|
|
276
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
277
|
+
|
|
278
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
282
279
|
className: [exceptionallySetClassName, modules_67f2d07a.column, width !== 'content' ? getClassNames(modules_67f2d07a, 'columnWidth', width.replace('/', '-')) : null],
|
|
283
280
|
minWidth: 0,
|
|
284
281
|
width: width !== 'content' ? 'full' : undefined,
|
|
@@ -287,18 +284,18 @@ var Column = /*#__PURE__*/polymorphicComponent(function Column(_ref, ref) {
|
|
|
287
284
|
ref: ref
|
|
288
285
|
}), children);
|
|
289
286
|
});
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
props =
|
|
300
|
-
|
|
301
|
-
return /*#__PURE__*/React.createElement(Box,
|
|
287
|
+
const Columns = /*#__PURE__*/polymorphicComponent(function Columns(_ref2, ref) {
|
|
288
|
+
let {
|
|
289
|
+
space,
|
|
290
|
+
align = 'left',
|
|
291
|
+
alignY = 'top',
|
|
292
|
+
collapseBelow,
|
|
293
|
+
children,
|
|
294
|
+
exceptionallySetClassName
|
|
295
|
+
} = _ref2,
|
|
296
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
297
|
+
|
|
298
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
302
299
|
className: [exceptionallySetClassName, getClassNames(modules_67f2d07a, 'space', space)],
|
|
303
300
|
display: "flex",
|
|
304
301
|
flexDirection: collapseBelow === 'desktop' ? {
|
|
@@ -309,26 +306,23 @@ var Columns = /*#__PURE__*/polymorphicComponent(function Columns(_ref2, ref) {
|
|
|
309
306
|
mobile: 'column',
|
|
310
307
|
tablet: 'row'
|
|
311
308
|
} : 'row',
|
|
312
|
-
alignItems: mapResponsiveProp(alignY,
|
|
313
|
-
|
|
314
|
-
}),
|
|
315
|
-
justifyContent: mapResponsiveProp(align, function (align) {
|
|
316
|
-
return align === 'left' ? 'flexStart' : align === 'right' ? 'flexEnd' : align;
|
|
317
|
-
}),
|
|
309
|
+
alignItems: mapResponsiveProp(alignY, alignY => alignY === 'top' ? 'flexStart' : alignY === 'bottom' ? 'flexEnd' : alignY),
|
|
310
|
+
justifyContent: mapResponsiveProp(align, align => align === 'left' ? 'flexStart' : align === 'right' ? 'flexEnd' : align),
|
|
318
311
|
ref: ref
|
|
319
312
|
}), children);
|
|
320
313
|
});
|
|
321
314
|
|
|
322
315
|
var modules_c742c4d7 = {"weight-primary":"_3f3a401c","weight-secondary":"_03b05b70","weight-tertiary":"b6f67ff8"};
|
|
323
316
|
|
|
324
|
-
|
|
317
|
+
const _excluded$2 = ["weight"];
|
|
325
318
|
|
|
326
319
|
function Divider(_ref) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
320
|
+
let {
|
|
321
|
+
weight = 'tertiary'
|
|
322
|
+
} = _ref,
|
|
323
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
330
324
|
|
|
331
|
-
return /*#__PURE__*/React.createElement(Box,
|
|
325
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2({
|
|
332
326
|
as: "hr",
|
|
333
327
|
className: getClassNames(modules_c742c4d7, 'weight', weight)
|
|
334
328
|
}, props));
|
|
@@ -336,69 +330,61 @@ function Divider(_ref) {
|
|
|
336
330
|
|
|
337
331
|
var modules_da5d5c21 = {"space-xsmall":"_6b1279e0","space-small":"_0d82c42d","space-medium":"_556714e1","space-large":"e90b43fb","space-xlarge":"a9c34345","space-xxlarge":"aa102efe","tablet-space-xsmall":"_34d16157","tablet-space-small":"c7e0e54f","tablet-space-medium":"_7f2a4e4b","tablet-space-large":"ae256487","tablet-space-xlarge":"e88be0f7","tablet-space-xxlarge":"dc7bcb18","desktop-space-xsmall":"_853f3012","desktop-space-small":"_3bfaf758","desktop-space-medium":"_36462a93","desktop-space-large":"e73081b7","desktop-space-xlarge":"e22ec9dd","desktop-space-xxlarge":"_4a20bd12"};
|
|
338
332
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
props =
|
|
350
|
-
|
|
351
|
-
return /*#__PURE__*/React.createElement(Box,
|
|
333
|
+
const _excluded$3 = ["as", "space", "align", "alignY", "children", "exceptionallySetClassName"];
|
|
334
|
+
const Inline = /*#__PURE__*/polymorphicComponent(function Inline(_ref, ref) {
|
|
335
|
+
let {
|
|
336
|
+
as,
|
|
337
|
+
space,
|
|
338
|
+
align = 'left',
|
|
339
|
+
alignY = 'center',
|
|
340
|
+
children,
|
|
341
|
+
exceptionallySetClassName
|
|
342
|
+
} = _ref,
|
|
343
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
344
|
+
|
|
345
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
352
346
|
as: as,
|
|
353
347
|
display: "flex",
|
|
354
348
|
flexWrap: "wrap",
|
|
355
349
|
className: [exceptionallySetClassName, getClassNames(modules_da5d5c21, 'space', space)],
|
|
356
350
|
ref: ref,
|
|
357
|
-
alignItems: mapResponsiveProp(alignY,
|
|
358
|
-
|
|
359
|
-
}),
|
|
360
|
-
justifyContent: mapResponsiveProp(align, function (align) {
|
|
361
|
-
return align === 'left' ? 'flexStart' : align === 'right' ? 'flexEnd' : 'center';
|
|
362
|
-
})
|
|
351
|
+
alignItems: mapResponsiveProp(alignY, alignY => alignY === 'top' ? 'flexStart' : alignY === 'bottom' ? 'flexEnd' : 'center'),
|
|
352
|
+
justifyContent: mapResponsiveProp(align, align => align === 'left' ? 'flexStart' : align === 'right' ? 'flexEnd' : 'center')
|
|
363
353
|
}), children);
|
|
364
354
|
});
|
|
365
355
|
|
|
366
356
|
var modules_3af3b7ac = {"space-xsmall":"_7b475ead","space-small":"_5641699f","space-medium":"_1a1c63e4","space-large":"_560f80a0","space-xlarge":"_84ffebbc","space-xxlarge":"b60a65cb","tablet-space-xsmall":"d808f5c3","tablet-space-small":"a51c76b3","tablet-space-medium":"_7185a7aa","tablet-space-large":"af82e610","tablet-space-xlarge":"_88b4ff46","tablet-space-xxlarge":"_9de15321","desktop-space-xsmall":"_6fb32d20","desktop-space-small":"_07ee315a","desktop-space-medium":"a270d7ec","desktop-space-large":"ea6ebb29","desktop-space-xlarge":"_35b36178","desktop-space-xxlarge":"_56c7dc23"};
|
|
367
357
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
props =
|
|
379
|
-
|
|
380
|
-
|
|
358
|
+
const _excluded$4 = ["as", "space", "align", "dividers", "children", "exceptionallySetClassName"];
|
|
359
|
+
const Stack = /*#__PURE__*/polymorphicComponent(function Stack(_ref, ref) {
|
|
360
|
+
let {
|
|
361
|
+
as,
|
|
362
|
+
space,
|
|
363
|
+
align = 'start',
|
|
364
|
+
dividers = 'none',
|
|
365
|
+
children,
|
|
366
|
+
exceptionallySetClassName
|
|
367
|
+
} = _ref,
|
|
368
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
369
|
+
|
|
370
|
+
const alignProps = align === 'start' ? undefined : {
|
|
381
371
|
width: 'full',
|
|
382
372
|
flexDirection: 'column',
|
|
383
373
|
display: 'flex',
|
|
384
|
-
alignItems: mapResponsiveProp(align,
|
|
385
|
-
return align === 'start' ? 'flexStart' : align === 'end' ? 'flexEnd' : 'center';
|
|
386
|
-
})
|
|
374
|
+
alignItems: mapResponsiveProp(align, align => align === 'start' ? 'flexStart' : align === 'end' ? 'flexEnd' : 'center')
|
|
387
375
|
};
|
|
388
|
-
return /*#__PURE__*/React.createElement(Box,
|
|
376
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2(_objectSpread2({}, props), alignProps), {}, {
|
|
389
377
|
as: as,
|
|
390
378
|
className: [exceptionallySetClassName, getClassNames(modules_3af3b7ac, 'space', space)],
|
|
391
379
|
ref: ref
|
|
392
|
-
}), dividers !== 'none' ? React.Children.map(flattenChildren(children),
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}), child) : child;
|
|
396
|
-
}) : children);
|
|
380
|
+
}), dividers !== 'none' ? React.Children.map(flattenChildren(children), (child, index) => index > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
|
|
381
|
+
weight: dividers
|
|
382
|
+
}), child) : child) : children);
|
|
397
383
|
});
|
|
398
384
|
|
|
399
385
|
var modules_4689e97e = {"hiddenOnPrint":"_0e595dea"};
|
|
400
386
|
|
|
401
|
-
|
|
387
|
+
const _excluded$5 = ["display", "children", "exceptionallySetClassName"];
|
|
402
388
|
/**
|
|
403
389
|
* A component that allows to specify how to hide itself on certain responsive screen sizes, or on
|
|
404
390
|
* print media.
|
|
@@ -408,17 +394,18 @@ var _excluded$5 = ["display", "children", "exceptionallySetClassName"];
|
|
|
408
394
|
* technologies.
|
|
409
395
|
*/
|
|
410
396
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
397
|
+
const Hidden = /*#__PURE__*/polymorphicComponent(function Hidden(_ref, ref) {
|
|
398
|
+
let {
|
|
399
|
+
display = 'block',
|
|
400
|
+
children,
|
|
401
|
+
exceptionallySetClassName
|
|
402
|
+
} = _ref,
|
|
403
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
417
404
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
405
|
+
const hiddenOnPrint = 'print' in props && props.print;
|
|
406
|
+
const hiddenOnDesktop = ('above' in props);
|
|
407
|
+
const hiddenOnMobile = ('below' in props);
|
|
408
|
+
const hiddenOnTablet = 'below' in props && props.below === 'desktop' || 'above' in props && props.above === 'mobile';
|
|
422
409
|
|
|
423
410
|
if (hiddenOnDesktop && hiddenOnMobile) {
|
|
424
411
|
// eslint-disable-next-line no-console
|
|
@@ -434,7 +421,7 @@ var Hidden = /*#__PURE__*/polymorphicComponent(function Hidden(_ref, ref) {
|
|
|
434
421
|
if ('above' in props) delete props['above'];
|
|
435
422
|
if ('below' in props) delete props['below'];
|
|
436
423
|
if ('print' in props) delete props['print'];
|
|
437
|
-
return /*#__PURE__*/React.createElement(Box,
|
|
424
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
438
425
|
ref: ref,
|
|
439
426
|
className: [exceptionallySetClassName, hiddenOnPrint ? modules_4689e97e.hiddenOnPrint : null],
|
|
440
427
|
display: hiddenOnDesktop && hiddenOnMobile ? 'none' : {
|
|
@@ -453,8 +440,8 @@ var modules_61c16c43 = {"hiddenVisually":"_618235b7"};
|
|
|
453
440
|
* @see Hidden for fully hiding content, and only under certain conditions.
|
|
454
441
|
*/
|
|
455
442
|
|
|
456
|
-
|
|
457
|
-
return /*#__PURE__*/React.createElement(Box,
|
|
443
|
+
const HiddenVisually = /*#__PURE__*/polymorphicComponent(function HiddenVisually(props, ref) {
|
|
444
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
458
445
|
ref: ref,
|
|
459
446
|
position: "absolute",
|
|
460
447
|
overflow: "hidden",
|
|
@@ -462,41 +449,35 @@ var HiddenVisually = /*#__PURE__*/polymorphicComponent(function HiddenVisually(p
|
|
|
462
449
|
}));
|
|
463
450
|
});
|
|
464
451
|
|
|
465
|
-
|
|
452
|
+
const _excluded$6 = ["children", "content", "position", "gapSize", "className"];
|
|
466
453
|
|
|
467
|
-
|
|
468
|
-
|
|
454
|
+
const SHOW_DELAY = 500;
|
|
455
|
+
const HIDE_DELAY = 100;
|
|
469
456
|
|
|
470
457
|
function useDelayedTooltipState(initialState) {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
return React__default.useMemo(
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}, SHOW_DELAY),
|
|
478
|
-
hide: delay(function () {
|
|
479
|
-
return tooltipState.hide();
|
|
480
|
-
}, HIDE_DELAY)
|
|
481
|
-
});
|
|
482
|
-
}, [delay, tooltipState]);
|
|
458
|
+
const tooltipState = tooltip.useTooltipState(initialState);
|
|
459
|
+
const delay = useDelay();
|
|
460
|
+
return React__default.useMemo(() => _objectSpread2(_objectSpread2({}, tooltipState), {}, {
|
|
461
|
+
show: delay(() => tooltipState.show(), SHOW_DELAY),
|
|
462
|
+
hide: delay(() => tooltipState.hide(), HIDE_DELAY)
|
|
463
|
+
}), [delay, tooltipState]);
|
|
483
464
|
}
|
|
484
465
|
|
|
485
466
|
function Tooltip(_ref) {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
props =
|
|
494
|
-
|
|
495
|
-
|
|
467
|
+
let {
|
|
468
|
+
children,
|
|
469
|
+
content,
|
|
470
|
+
position = 'top',
|
|
471
|
+
gapSize = 3,
|
|
472
|
+
className
|
|
473
|
+
} = _ref,
|
|
474
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
475
|
+
|
|
476
|
+
const state = useDelayedTooltipState({
|
|
496
477
|
placement: position,
|
|
497
478
|
gutter: gapSize
|
|
498
479
|
});
|
|
499
|
-
|
|
480
|
+
const child = React__default.Children.only(children);
|
|
500
481
|
|
|
501
482
|
if (!content) {
|
|
502
483
|
return child;
|
|
@@ -515,10 +496,10 @@ function Tooltip(_ref) {
|
|
|
515
496
|
// This may be resolved soon in an upcoming version of reakit:
|
|
516
497
|
// https://github.com/reakit/reakit/issues/750
|
|
517
498
|
function handleKeyUp(e) {
|
|
518
|
-
|
|
499
|
+
const eventKey = e.key;
|
|
519
500
|
|
|
520
501
|
if (eventKey !== 'Escape' && eventKey !== 'Enter' && eventKey !== 'Space') {
|
|
521
|
-
|
|
502
|
+
state.show();
|
|
522
503
|
}
|
|
523
504
|
}
|
|
524
505
|
|
|
@@ -526,19 +507,24 @@ function Tooltip(_ref) {
|
|
|
526
507
|
once: true
|
|
527
508
|
}); // Prevent tooltip.show from being called by TooltipReference
|
|
528
509
|
|
|
529
|
-
event.preventDefault();
|
|
530
|
-
|
|
531
|
-
if (typeof child.props.onFocus === 'function') child.props.onFocus(event);
|
|
510
|
+
event.preventDefault();
|
|
511
|
+
child.props.onFocus == null ? void 0 : child.props.onFocus(event);
|
|
532
512
|
}
|
|
533
513
|
|
|
534
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(
|
|
535
|
-
|
|
536
|
-
ref: child.ref
|
|
537
|
-
}, child.props, {
|
|
514
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(tooltip.TooltipAnchor, {
|
|
515
|
+
state: state,
|
|
538
516
|
onFocus: handleFocus
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
|
|
517
|
+
}, anchorProps => {
|
|
518
|
+
const {
|
|
519
|
+
onFocus,
|
|
520
|
+
onBlur
|
|
521
|
+
} = anchorProps;
|
|
522
|
+
return /*#__PURE__*/React__default.cloneElement(child, _objectSpread2(_objectSpread2(_objectSpread2({}, anchorProps), child.props), {}, {
|
|
523
|
+
onFocus,
|
|
524
|
+
onBlur
|
|
525
|
+
}));
|
|
526
|
+
}), state.visible ? /*#__PURE__*/React__default.createElement(tooltip.Tooltip, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
527
|
+
state: state,
|
|
542
528
|
className: classNames('reactist_tooltip', className)
|
|
543
529
|
}), typeof content === 'function' ? content() : content) : null);
|
|
544
530
|
}
|
|
@@ -557,18 +543,16 @@ function Tooltip(_ref) {
|
|
|
557
543
|
*/
|
|
558
544
|
|
|
559
545
|
function useDelay() {
|
|
560
|
-
|
|
561
|
-
|
|
546
|
+
const timeoutRef = React__default.useRef();
|
|
547
|
+
const clearTimeouts = React__default.useCallback(function clearTimeouts() {
|
|
562
548
|
if (timeoutRef.current != null) {
|
|
563
549
|
clearTimeout(timeoutRef.current);
|
|
564
550
|
}
|
|
565
551
|
}, []); // Runs clearTimeouts when the component is unmounted
|
|
566
552
|
|
|
567
|
-
React__default.useEffect(
|
|
568
|
-
return clearTimeouts;
|
|
569
|
-
}, [clearTimeouts]);
|
|
553
|
+
React__default.useEffect(() => clearTimeouts, [clearTimeouts]);
|
|
570
554
|
return React__default.useCallback(function delay(fn, delay) {
|
|
571
|
-
return
|
|
555
|
+
return () => {
|
|
572
556
|
clearTimeouts();
|
|
573
557
|
timeoutRef.current = setTimeout(fn, delay);
|
|
574
558
|
};
|
|
@@ -577,9 +561,9 @@ function useDelay() {
|
|
|
577
561
|
|
|
578
562
|
var modules_c7f5018f = {"svg":"_51539197","spinner":"_54fbe2b3","tint":"a0c466ed","fill":"_745b73d3"};
|
|
579
563
|
|
|
580
|
-
function Spinner(
|
|
581
|
-
|
|
582
|
-
|
|
564
|
+
function Spinner({
|
|
565
|
+
size = 24
|
|
566
|
+
}) {
|
|
583
567
|
return /*#__PURE__*/React.createElement("svg", {
|
|
584
568
|
"aria-hidden": true,
|
|
585
569
|
width: size,
|
|
@@ -600,7 +584,7 @@ function Spinner(_ref) {
|
|
|
600
584
|
|
|
601
585
|
var modules_b9569bce = {"baseButton":"_7a2031d6","label":"_09c23660","align-start":"dd82f17a","align-center":"_8a9315ae","align-end":"_6acb4219","size-small":"_1e48abcb","size-normal":"_949f7858","size-large":"_34ac3da9","disabled":"_7e5800ce","iconButton":"_1bdc5d38","startIcon":"_270d7bdf","endIcon":"_471c6e23","variant-primary":"a878a9a4","variant-secondary":"_81c213d2","variant-tertiary":"_12f96f70","variant-quaternary":"_8c546508","tone-destructive":"_441a7e3a"};
|
|
602
586
|
|
|
603
|
-
|
|
587
|
+
const _excluded$7 = ["as", "variant", "tone", "size", "disabled", "loading", "tooltip", "tooltipGapSize", "onClick", "exceptionallySetClassName", "children", "startIcon", "endIcon", "icon", "width", "align"];
|
|
604
588
|
|
|
605
589
|
function preventDefault(event) {
|
|
606
590
|
event.preventDefault();
|
|
@@ -614,33 +598,29 @@ function preventDefault(event) {
|
|
|
614
598
|
*/
|
|
615
599
|
|
|
616
600
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
641
|
-
|
|
642
|
-
var isDisabled = loading || disabled;
|
|
643
|
-
var buttonElement = /*#__PURE__*/React.createElement(Box, Object.assign({}, props, {
|
|
601
|
+
const BaseButton = /*#__PURE__*/polymorphicComponent(function BaseButton(_ref, ref) {
|
|
602
|
+
let {
|
|
603
|
+
as = 'div',
|
|
604
|
+
variant,
|
|
605
|
+
tone = 'normal',
|
|
606
|
+
size = 'normal',
|
|
607
|
+
disabled = false,
|
|
608
|
+
loading = false,
|
|
609
|
+
tooltip,
|
|
610
|
+
tooltipGapSize,
|
|
611
|
+
onClick,
|
|
612
|
+
exceptionallySetClassName,
|
|
613
|
+
children,
|
|
614
|
+
startIcon,
|
|
615
|
+
endIcon,
|
|
616
|
+
icon,
|
|
617
|
+
width = 'auto',
|
|
618
|
+
align
|
|
619
|
+
} = _ref,
|
|
620
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
621
|
+
|
|
622
|
+
const isDisabled = loading || disabled;
|
|
623
|
+
const buttonElement = /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
644
624
|
as: as,
|
|
645
625
|
ref: ref,
|
|
646
626
|
"aria-disabled": isDisabled,
|
|
@@ -659,14 +639,14 @@ var BaseButton = /*#__PURE__*/polymorphicComponent(function BaseButton(_ref, ref
|
|
|
659
639
|
"aria-hidden": true
|
|
660
640
|
}, loading ? /*#__PURE__*/React.createElement(Spinner, null) : endIcon) : null)); // If it's an icon-only button, make sure it uses the aria-label as tooltip if no tooltip was provided
|
|
661
641
|
|
|
662
|
-
|
|
642
|
+
const tooltipContent = icon ? tooltip != null ? tooltip : props['aria-label'] : tooltip;
|
|
663
643
|
return tooltipContent ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
664
644
|
content: tooltipContent,
|
|
665
645
|
gapSize: tooltipGapSize
|
|
666
646
|
}, buttonElement) : buttonElement;
|
|
667
647
|
});
|
|
668
648
|
|
|
669
|
-
|
|
649
|
+
const _excluded$8 = ["variant", "tone", "size", "type", "disabled", "exceptionallySetClassName"];
|
|
670
650
|
/**
|
|
671
651
|
* A semantic button that also looks like a button, and provides all the necessary visual variants.
|
|
672
652
|
* It follows the [WAI-ARIA Button Pattern](https://www.w3.org/TR/wai-aria-practices/#button).
|
|
@@ -674,20 +654,18 @@ var _excluded$8 = ["variant", "tone", "size", "type", "disabled", "exceptionally
|
|
|
674
654
|
* @see ButtonLink
|
|
675
655
|
*/
|
|
676
656
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
return /*#__PURE__*/React.createElement(BaseButton, Object.assign({}, props, {
|
|
657
|
+
const Button = /*#__PURE__*/React.forwardRef(function Button(_ref, ref) {
|
|
658
|
+
let {
|
|
659
|
+
variant,
|
|
660
|
+
tone = 'normal',
|
|
661
|
+
size = 'normal',
|
|
662
|
+
type = 'button',
|
|
663
|
+
disabled = false,
|
|
664
|
+
exceptionallySetClassName
|
|
665
|
+
} = _ref,
|
|
666
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
667
|
+
|
|
668
|
+
return /*#__PURE__*/React.createElement(BaseButton, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
691
669
|
as: "button",
|
|
692
670
|
ref: ref,
|
|
693
671
|
variant: variant,
|
|
@@ -699,8 +677,8 @@ var Button = /*#__PURE__*/React.forwardRef(function Button(_ref, ref) {
|
|
|
699
677
|
}));
|
|
700
678
|
});
|
|
701
679
|
|
|
702
|
-
|
|
703
|
-
|
|
680
|
+
const _excluded$9 = ["tone"];
|
|
681
|
+
const alertIconForTone = {
|
|
704
682
|
info: AlertInfoIcon,
|
|
705
683
|
positive: AlertPositiveIcon,
|
|
706
684
|
caution: AlertCautionIcon,
|
|
@@ -708,15 +686,17 @@ var alertIconForTone = {
|
|
|
708
686
|
};
|
|
709
687
|
|
|
710
688
|
function AlertIcon(_ref) {
|
|
711
|
-
|
|
712
|
-
|
|
689
|
+
let {
|
|
690
|
+
tone
|
|
691
|
+
} = _ref,
|
|
692
|
+
props = _objectWithoutProperties(_ref, _excluded$9);
|
|
713
693
|
|
|
714
|
-
|
|
715
|
-
return Icon ? /*#__PURE__*/React.createElement(Icon,
|
|
694
|
+
const Icon = alertIconForTone[tone];
|
|
695
|
+
return Icon ? /*#__PURE__*/React.createElement(Icon, _objectSpread2({}, props)) : null;
|
|
716
696
|
}
|
|
717
697
|
|
|
718
698
|
function AlertInfoIcon(props) {
|
|
719
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
699
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
720
700
|
width: "24",
|
|
721
701
|
height: "24",
|
|
722
702
|
fill: "none",
|
|
@@ -730,7 +710,7 @@ function AlertInfoIcon(props) {
|
|
|
730
710
|
}
|
|
731
711
|
|
|
732
712
|
function AlertPositiveIcon(props) {
|
|
733
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
713
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
734
714
|
width: "24",
|
|
735
715
|
height: "24",
|
|
736
716
|
fill: "none",
|
|
@@ -744,7 +724,7 @@ function AlertPositiveIcon(props) {
|
|
|
744
724
|
}
|
|
745
725
|
|
|
746
726
|
function AlertCautionIcon(props) {
|
|
747
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
727
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
748
728
|
width: "24",
|
|
749
729
|
height: "24",
|
|
750
730
|
fill: "none",
|
|
@@ -758,7 +738,7 @@ function AlertCautionIcon(props) {
|
|
|
758
738
|
}
|
|
759
739
|
|
|
760
740
|
function AlertCriticalIcon(props) {
|
|
761
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
741
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
762
742
|
width: "24",
|
|
763
743
|
height: "24",
|
|
764
744
|
fill: "none",
|
|
@@ -772,7 +752,7 @@ function AlertCriticalIcon(props) {
|
|
|
772
752
|
}
|
|
773
753
|
|
|
774
754
|
function CloseIcon(props) {
|
|
775
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
755
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
776
756
|
xmlns: "http://www.w3.org/2000/svg",
|
|
777
757
|
width: "24",
|
|
778
758
|
height: "24"
|
|
@@ -784,12 +764,13 @@ function CloseIcon(props) {
|
|
|
784
764
|
|
|
785
765
|
var modules_6205a58e = {"container":"eb665121","tone-info":"d0373ff9","tone-positive":"bb18dcab","tone-caution":"_0af02331","tone-critical":"f76146f9"};
|
|
786
766
|
|
|
787
|
-
function Alert(
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
767
|
+
function Alert({
|
|
768
|
+
id,
|
|
769
|
+
children,
|
|
770
|
+
tone,
|
|
771
|
+
closeLabel,
|
|
772
|
+
onClose
|
|
773
|
+
}) {
|
|
793
774
|
return /*#__PURE__*/React.createElement(Box, {
|
|
794
775
|
id: id,
|
|
795
776
|
role: "alert",
|
|
@@ -821,8 +802,9 @@ function Alert(_ref) {
|
|
|
821
802
|
})) : null));
|
|
822
803
|
}
|
|
823
804
|
|
|
824
|
-
|
|
825
|
-
|
|
805
|
+
const _excluded$a = ["size", "exceptionallySetClassName"];
|
|
806
|
+
const sizeMapping = {
|
|
807
|
+
xsmall: 16,
|
|
826
808
|
small: 24,
|
|
827
809
|
medium: 36,
|
|
828
810
|
large: 48
|
|
@@ -831,14 +813,15 @@ var sizeMapping = {
|
|
|
831
813
|
function Loading(_ref) {
|
|
832
814
|
var _sizeMapping$size;
|
|
833
815
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
816
|
+
let {
|
|
817
|
+
size = 'small',
|
|
818
|
+
exceptionallySetClassName
|
|
819
|
+
} = _ref,
|
|
820
|
+
props = _objectWithoutProperties(_ref, _excluded$a);
|
|
838
821
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
return /*#__PURE__*/React__default.createElement(Box,
|
|
822
|
+
const numericSize = (_sizeMapping$size = sizeMapping[size]) != null ? _sizeMapping$size : sizeMapping.small;
|
|
823
|
+
const ariaLabel = props['aria-label'] ? props['aria-label'] : !props['aria-labelledby'] ? 'Loading…' : undefined;
|
|
824
|
+
return /*#__PURE__*/React__default.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
842
825
|
"aria-label": ariaLabel,
|
|
843
826
|
className: exceptionallySetClassName,
|
|
844
827
|
display: "flex",
|
|
@@ -853,10 +836,11 @@ function Loading(_ref) {
|
|
|
853
836
|
|
|
854
837
|
var modules_1b547e7e = {"container":"_464500ae","tone-info":"_1abfe147","tone-positive":"_36ce9859","tone-caution":"f92214b7","tone-critical":"be6cf28e"};
|
|
855
838
|
|
|
856
|
-
function Notice(
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
839
|
+
function Notice({
|
|
840
|
+
id,
|
|
841
|
+
children,
|
|
842
|
+
tone
|
|
843
|
+
}) {
|
|
860
844
|
return /*#__PURE__*/React.createElement(Box, {
|
|
861
845
|
id: id,
|
|
862
846
|
role: "alert",
|
|
@@ -876,25 +860,25 @@ function Notice(_ref) {
|
|
|
876
860
|
|
|
877
861
|
var modules_949d2ff4 = {"heading":"_71a1610c","weight-light":"_63750f40","tone-secondary":"_9ce984cf","tone-danger":"_1acad35e","size-largest":"_3da27a00","size-larger":"df220733","size-smaller":"eb373739","lineClampMultipleLines":"f53cfd2b","lineClamp-1":"e4819fc9","lineClamp-2":"a0ed6177","lineClamp-3":"_180d433e","lineClamp-4":"_40826ad9","lineClamp-5":"_5999b247"};
|
|
878
862
|
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
props =
|
|
863
|
+
const _excluded$b = ["level", "weight", "size", "tone", "children", "lineClamp", "align", "exceptionallySetClassName"];
|
|
864
|
+
const Heading = /*#__PURE__*/React.forwardRef(function Heading(_ref, ref) {
|
|
865
|
+
let {
|
|
866
|
+
level,
|
|
867
|
+
weight = 'regular',
|
|
868
|
+
size,
|
|
869
|
+
tone = 'normal',
|
|
870
|
+
children,
|
|
871
|
+
lineClamp,
|
|
872
|
+
align,
|
|
873
|
+
exceptionallySetClassName
|
|
874
|
+
} = _ref,
|
|
875
|
+
props = _objectWithoutProperties(_ref, _excluded$b);
|
|
892
876
|
|
|
893
877
|
// In TypeScript v4.1, this would be properly recognized without needing the type assertion
|
|
894
878
|
// https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-beta/#template-literal-types
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
return /*#__PURE__*/React.createElement(Box,
|
|
879
|
+
const headingElementName = "h" + level;
|
|
880
|
+
const lineClampMultipleLines = typeof lineClamp === 'string' ? parseInt(lineClamp, 10) > 1 : (lineClamp || 0) > 1;
|
|
881
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
898
882
|
className: [exceptionallySetClassName, modules_949d2ff4.heading, weight !== 'regular' ? getClassNames(modules_949d2ff4, 'weight', weight) : null, tone !== 'normal' ? getClassNames(modules_949d2ff4, 'tone', tone) : null, getClassNames(modules_949d2ff4, 'size', size), lineClampMultipleLines ? modules_949d2ff4.lineClampMultipleLines : null, lineClamp ? getClassNames(modules_949d2ff4, 'lineClamp', lineClamp.toString()) : null],
|
|
899
883
|
textAlign: align,
|
|
900
884
|
// Prevents emojis from being cut-off
|
|
@@ -905,25 +889,24 @@ var Heading = /*#__PURE__*/React.forwardRef(function Heading(_ref, ref) {
|
|
|
905
889
|
}), children);
|
|
906
890
|
});
|
|
907
891
|
|
|
908
|
-
var modules_a9637dd3 = {"text":"
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
return /*#__PURE__*/React.createElement(Box, Object.assign({}, props, {
|
|
892
|
+
var modules_a9637dd3 = {"text":"_2282cb83","size-caption":"_087a8179","size-copy":"a4423c2a","size-subtitle":"_03365a63","weight-semibold":"_5213e4ab","weight-bold":"_3d58c8f2","tone-secondary":"_892a359a","tone-danger":"f9cb5d8a","tone-positive":"fcedb234","lineClampMultipleLines":"_765949c1","lineClamp-1":"c3e4800e","lineClamp-2":"b25b652b","lineClamp-3":"bb13d214","lineClamp-4":"_6db1928e","lineClamp-5":"e9944c1d"};
|
|
893
|
+
|
|
894
|
+
const _excluded$c = ["as", "size", "weight", "tone", "align", "children", "lineClamp", "exceptionallySetClassName"];
|
|
895
|
+
const Text = /*#__PURE__*/polymorphicComponent(function Text(_ref, ref) {
|
|
896
|
+
let {
|
|
897
|
+
as,
|
|
898
|
+
size = 'body',
|
|
899
|
+
weight = 'regular',
|
|
900
|
+
tone = 'normal',
|
|
901
|
+
align,
|
|
902
|
+
children,
|
|
903
|
+
lineClamp,
|
|
904
|
+
exceptionallySetClassName
|
|
905
|
+
} = _ref,
|
|
906
|
+
props = _objectWithoutProperties(_ref, _excluded$c);
|
|
907
|
+
|
|
908
|
+
const lineClampMultipleLines = typeof lineClamp === 'string' ? Number(lineClamp) > 1 : (lineClamp != null ? lineClamp : 1) > 1;
|
|
909
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
927
910
|
as: as,
|
|
928
911
|
className: [exceptionallySetClassName, modules_a9637dd3.text, size !== 'body' ? getClassNames(modules_a9637dd3, 'size', size) : null, weight !== 'regular' ? getClassNames(modules_a9637dd3, 'weight', weight) : null, tone !== 'normal' ? getClassNames(modules_a9637dd3, 'tone', tone) : null, lineClampMultipleLines ? modules_a9637dd3.lineClampMultipleLines : null, lineClamp ? getClassNames(modules_a9637dd3, 'lineClamp', lineClamp.toString()) : null],
|
|
929
912
|
textAlign: align,
|
|
@@ -934,7 +917,7 @@ var Text = /*#__PURE__*/polymorphicComponent(function Text(_ref, ref) {
|
|
|
934
917
|
}), children);
|
|
935
918
|
});
|
|
936
919
|
|
|
937
|
-
|
|
920
|
+
const _excluded$d = ["as", "variant", "tone", "size", "exceptionallySetClassName", "openInNewTab"];
|
|
938
921
|
/**
|
|
939
922
|
* A semantic link that looks like a button, exactly matching the `Button` component in all visual
|
|
940
923
|
* aspects.
|
|
@@ -942,20 +925,18 @@ var _excluded$d = ["as", "variant", "tone", "size", "exceptionallySetClassName",
|
|
|
942
925
|
* @see Button
|
|
943
926
|
*/
|
|
944
927
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
return /*#__PURE__*/React.createElement(BaseButton, Object.assign({}, props, {
|
|
928
|
+
const ButtonLink = /*#__PURE__*/polymorphicComponent(function ButtonLink(_ref, ref) {
|
|
929
|
+
let {
|
|
930
|
+
as = 'a',
|
|
931
|
+
variant,
|
|
932
|
+
tone = 'normal',
|
|
933
|
+
size = 'normal',
|
|
934
|
+
exceptionallySetClassName,
|
|
935
|
+
openInNewTab = false
|
|
936
|
+
} = _ref,
|
|
937
|
+
props = _objectWithoutProperties(_ref, _excluded$d);
|
|
938
|
+
|
|
939
|
+
return /*#__PURE__*/React.createElement(BaseButton, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
959
940
|
as: as,
|
|
960
941
|
ref: ref,
|
|
961
942
|
variant: variant,
|
|
@@ -967,18 +948,18 @@ var ButtonLink = /*#__PURE__*/polymorphicComponent(function ButtonLink(_ref, ref
|
|
|
967
948
|
}));
|
|
968
949
|
});
|
|
969
950
|
|
|
970
|
-
var modules_3d05deee = {"container":"
|
|
951
|
+
var modules_3d05deee = {"container":"_232127ef"};
|
|
971
952
|
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
props =
|
|
953
|
+
const _excluded$e = ["as", "openInNewTab", "exceptionallySetClassName"];
|
|
954
|
+
const TextLink = /*#__PURE__*/polymorphicComponent(function TextLink(_ref, ref) {
|
|
955
|
+
let {
|
|
956
|
+
as = 'a',
|
|
957
|
+
openInNewTab = false,
|
|
958
|
+
exceptionallySetClassName
|
|
959
|
+
} = _ref,
|
|
960
|
+
props = _objectWithoutProperties(_ref, _excluded$e);
|
|
980
961
|
|
|
981
|
-
return /*#__PURE__*/React.createElement(Box,
|
|
962
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
982
963
|
as: as,
|
|
983
964
|
display: "inline",
|
|
984
965
|
className: [exceptionallySetClassName, modules_3d05deee.container],
|
|
@@ -988,19 +969,19 @@ var TextLink = /*#__PURE__*/polymorphicComponent(function TextLink(_ref, ref) {
|
|
|
988
969
|
}));
|
|
989
970
|
});
|
|
990
971
|
|
|
991
|
-
|
|
992
|
-
|
|
972
|
+
const _excluded$f = ["checked", "indeterminate", "disabled"];
|
|
973
|
+
const svgPath = {
|
|
993
974
|
checked: 'M18 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h12zm-2.457 4.293l-5.293 5.293-1.793-1.793a1 1 0 1 0-1.414 1.414l2.5 2.5a1 1 0 0 0 1.414 0l6-6a1 1 0 1 0-1.414-1.414z',
|
|
994
975
|
unchecked: 'M18 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h12zm0 1H6a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1z',
|
|
995
976
|
mixed: 'M18 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h12zm-2 7H8a1 1 0 0 0 0 2h8a1 1 0 0 0 0-2z',
|
|
996
977
|
filled: 'M6 4H18C19.1046 4 20 4.89543 20 6V18C20 19.1046 19.1046 20 18 20H6C4.89543 20 4 19.1046 4 18V6C4 4.89543 4.89543 4 6 4Z'
|
|
997
978
|
};
|
|
998
979
|
|
|
999
|
-
function getPathKey(
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
980
|
+
function getPathKey({
|
|
981
|
+
checked,
|
|
982
|
+
indeterminate,
|
|
983
|
+
disabled
|
|
984
|
+
}) {
|
|
1004
985
|
if (indeterminate) {
|
|
1005
986
|
return 'mixed'; // indeterminate, when true, overrides the checked state
|
|
1006
987
|
}
|
|
@@ -1021,18 +1002,20 @@ function getPathKey(_ref) {
|
|
|
1021
1002
|
return 'unchecked';
|
|
1022
1003
|
}
|
|
1023
1004
|
|
|
1024
|
-
function CheckboxIcon(
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1005
|
+
function CheckboxIcon(_ref) {
|
|
1006
|
+
let {
|
|
1007
|
+
checked,
|
|
1008
|
+
indeterminate,
|
|
1009
|
+
disabled
|
|
1010
|
+
} = _ref,
|
|
1011
|
+
props = _objectWithoutProperties(_ref, _excluded$f);
|
|
1029
1012
|
|
|
1030
|
-
|
|
1031
|
-
checked
|
|
1032
|
-
indeterminate
|
|
1033
|
-
disabled
|
|
1013
|
+
const pathKey = getPathKey({
|
|
1014
|
+
checked,
|
|
1015
|
+
indeterminate,
|
|
1016
|
+
disabled
|
|
1034
1017
|
});
|
|
1035
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
1018
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
1036
1019
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1037
1020
|
width: "24",
|
|
1038
1021
|
height: "24",
|
|
@@ -1046,18 +1029,20 @@ function CheckboxIcon(_ref2) {
|
|
|
1046
1029
|
|
|
1047
1030
|
var modules_664a6a80 = {"container":"_96c4d12f","disabled":"_5048e2a5","checked":"_42187b48","keyFocused":"_3510166f"};
|
|
1048
1031
|
|
|
1049
|
-
|
|
1050
|
-
|
|
1032
|
+
const _excluded$g = ["label", "disabled", "indeterminate", "defaultChecked", "onChange"];
|
|
1033
|
+
const CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref, ref) {
|
|
1051
1034
|
var _ref2, _props$checked, _props$checked2;
|
|
1052
1035
|
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1036
|
+
let {
|
|
1037
|
+
label,
|
|
1038
|
+
disabled,
|
|
1039
|
+
indeterminate,
|
|
1040
|
+
defaultChecked,
|
|
1041
|
+
onChange
|
|
1042
|
+
} = _ref,
|
|
1043
|
+
props = _objectWithoutProperties(_ref, _excluded$g);
|
|
1059
1044
|
|
|
1060
|
-
|
|
1045
|
+
const isControlledComponent = typeof props.checked === 'boolean';
|
|
1061
1046
|
|
|
1062
1047
|
if (typeof indeterminate === 'boolean' && !isControlledComponent) {
|
|
1063
1048
|
// eslint-disable-next-line no-console
|
|
@@ -1070,17 +1055,11 @@ var CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref, r
|
|
|
1070
1055
|
console.warn('A Checkbox needs a label');
|
|
1071
1056
|
}
|
|
1072
1057
|
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
checkedState = _React$useState2[0],
|
|
1079
|
-
setChecked = _React$useState2[1];
|
|
1080
|
-
|
|
1081
|
-
var isChecked = (_props$checked2 = props.checked) !== null && _props$checked2 !== void 0 ? _props$checked2 : checkedState;
|
|
1082
|
-
var internalRef = React.useRef(null);
|
|
1083
|
-
var combinedRef = reakitUtils.useForkRef(internalRef, ref);
|
|
1058
|
+
const [keyFocused, setKeyFocused] = React.useState(false);
|
|
1059
|
+
const [checkedState, setChecked] = React.useState((_ref2 = (_props$checked = props.checked) != null ? _props$checked : defaultChecked) != null ? _ref2 : false);
|
|
1060
|
+
const isChecked = (_props$checked2 = props.checked) != null ? _props$checked2 : checkedState;
|
|
1061
|
+
const internalRef = React.useRef(null);
|
|
1062
|
+
const combinedRef = ariakitUtils.useForkRef(internalRef, ref);
|
|
1084
1063
|
React.useEffect(function setIndeterminate() {
|
|
1085
1064
|
if (internalRef.current && typeof indeterminate === 'boolean') {
|
|
1086
1065
|
internalRef.current.indeterminate = indeterminate;
|
|
@@ -1091,30 +1070,26 @@ var CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref, r
|
|
|
1091
1070
|
display: "flex",
|
|
1092
1071
|
alignItems: "center",
|
|
1093
1072
|
className: [modules_664a6a80.container, disabled ? modules_664a6a80.disabled : null, isChecked ? modules_664a6a80.checked : null, keyFocused ? modules_664a6a80.keyFocused : null]
|
|
1094
|
-
}, /*#__PURE__*/React.createElement("input",
|
|
1073
|
+
}, /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1095
1074
|
ref: combinedRef,
|
|
1096
1075
|
type: "checkbox",
|
|
1097
1076
|
"aria-checked": indeterminate ? 'mixed' : isChecked,
|
|
1098
1077
|
checked: isChecked,
|
|
1099
1078
|
disabled: disabled,
|
|
1100
|
-
onChange:
|
|
1101
|
-
|
|
1079
|
+
onChange: event => {
|
|
1080
|
+
onChange == null ? void 0 : onChange(event);
|
|
1102
1081
|
|
|
1103
1082
|
if (!event.defaultPrevented) {
|
|
1104
1083
|
setChecked(event.currentTarget.checked);
|
|
1105
1084
|
}
|
|
1106
1085
|
},
|
|
1107
|
-
onBlur:
|
|
1108
|
-
var _props$onBlur;
|
|
1109
|
-
|
|
1086
|
+
onBlur: event => {
|
|
1110
1087
|
setKeyFocused(false);
|
|
1111
|
-
props
|
|
1088
|
+
props == null ? void 0 : props.onBlur == null ? void 0 : props.onBlur(event);
|
|
1112
1089
|
},
|
|
1113
|
-
onKeyUp:
|
|
1114
|
-
var _props$onKeyUp;
|
|
1115
|
-
|
|
1090
|
+
onKeyUp: event => {
|
|
1116
1091
|
setKeyFocused(true);
|
|
1117
|
-
props
|
|
1092
|
+
props == null ? void 0 : props.onKeyUp == null ? void 0 : props.onKeyUp(event);
|
|
1118
1093
|
}
|
|
1119
1094
|
})), /*#__PURE__*/React.createElement(CheckboxIcon, {
|
|
1120
1095
|
checked: isChecked,
|
|
@@ -1124,18 +1099,18 @@ var CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref, r
|
|
|
1124
1099
|
}), label ? /*#__PURE__*/React.createElement(Text, null, label) : null);
|
|
1125
1100
|
});
|
|
1126
1101
|
|
|
1127
|
-
|
|
1102
|
+
let uid = 0;
|
|
1128
1103
|
|
|
1129
1104
|
function uniqueId() {
|
|
1130
1105
|
return uid++;
|
|
1131
1106
|
}
|
|
1132
1107
|
|
|
1133
1108
|
function generateElementId(prefix) {
|
|
1134
|
-
|
|
1109
|
+
const num = uniqueId();
|
|
1135
1110
|
return prefix + "-" + num;
|
|
1136
1111
|
}
|
|
1137
1112
|
function useId(providedId) {
|
|
1138
|
-
|
|
1113
|
+
const ref = React.useRef(providedId != null ? providedId : null);
|
|
1139
1114
|
|
|
1140
1115
|
if (!ref.current) {
|
|
1141
1116
|
ref.current = generateElementId('element');
|
|
@@ -1147,27 +1122,28 @@ function useId(providedId) {
|
|
|
1147
1122
|
var modules_540a88ff = {"container":"ed7d894c","primaryLabel":"_22213081","secondaryLabel":"be8637dd","auxiliaryLabel":"_72b46ad5"};
|
|
1148
1123
|
|
|
1149
1124
|
function FieldHint(props) {
|
|
1150
|
-
return /*#__PURE__*/React.createElement(Text,
|
|
1125
|
+
return /*#__PURE__*/React.createElement(Text, _objectSpread2({
|
|
1151
1126
|
as: "p",
|
|
1152
1127
|
tone: "secondary",
|
|
1153
1128
|
size: "copy"
|
|
1154
1129
|
}, props));
|
|
1155
1130
|
}
|
|
1156
1131
|
|
|
1157
|
-
function BaseField(
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1132
|
+
function BaseField({
|
|
1133
|
+
label,
|
|
1134
|
+
secondaryLabel,
|
|
1135
|
+
auxiliaryLabel,
|
|
1136
|
+
hint,
|
|
1137
|
+
className,
|
|
1138
|
+
children,
|
|
1139
|
+
maxWidth,
|
|
1140
|
+
hidden,
|
|
1141
|
+
'aria-describedby': originalAriaDescribedBy,
|
|
1142
|
+
id: originalId
|
|
1143
|
+
}) {
|
|
1144
|
+
const id = useId(originalId);
|
|
1145
|
+
const hintId = useId();
|
|
1146
|
+
const ariaDescribedBy = originalAriaDescribedBy != null ? originalAriaDescribedBy : hint ? hintId : undefined;
|
|
1171
1147
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
1172
1148
|
space: "small"
|
|
1173
1149
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
@@ -1188,14 +1164,14 @@ function BaseField(_ref) {
|
|
|
1188
1164
|
className: modules_540a88ff.primaryLabel
|
|
1189
1165
|
}, label) : null, secondaryLabel ? /*#__PURE__*/React.createElement("span", {
|
|
1190
1166
|
className: modules_540a88ff.secondaryLabel
|
|
1191
|
-
}, "\
|
|
1167
|
+
}, "\u00A0(", secondaryLabel, ")") : null), auxiliaryLabel ? /*#__PURE__*/React.createElement(Box, {
|
|
1192
1168
|
className: modules_540a88ff.auxiliaryLabel,
|
|
1193
1169
|
paddingLeft: "small"
|
|
1194
1170
|
}, auxiliaryLabel) : null), children(ariaDescribedBy ? {
|
|
1195
|
-
id
|
|
1171
|
+
id,
|
|
1196
1172
|
'aria-describedby': ariaDescribedBy
|
|
1197
1173
|
} : {
|
|
1198
|
-
id
|
|
1174
|
+
id
|
|
1199
1175
|
})), hint ? /*#__PURE__*/React.createElement(FieldHint, {
|
|
1200
1176
|
hidden: hidden,
|
|
1201
1177
|
id: hintId
|
|
@@ -1203,7 +1179,7 @@ function BaseField(_ref) {
|
|
|
1203
1179
|
}
|
|
1204
1180
|
|
|
1205
1181
|
function PasswordVisibleIcon(props) {
|
|
1206
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
1182
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
1207
1183
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1208
1184
|
width: "24",
|
|
1209
1185
|
height: "24"
|
|
@@ -1221,7 +1197,7 @@ function PasswordVisibleIcon(props) {
|
|
|
1221
1197
|
}
|
|
1222
1198
|
|
|
1223
1199
|
function PasswordHiddenIcon(props) {
|
|
1224
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
1200
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
1225
1201
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1226
1202
|
width: "24",
|
|
1227
1203
|
height: "24"
|
|
@@ -1249,34 +1225,30 @@ var modules_3f03ead6 = {"inputWrapper":"_460d581b"};
|
|
|
1249
1225
|
|
|
1250
1226
|
var modules_aaf25250 = {"inputWrapper":"dd9ffeab"};
|
|
1251
1227
|
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
isPasswordVisible = _React$useState[0],
|
|
1271
|
-
setPasswordVisible = _React$useState[1];
|
|
1228
|
+
const _excluded$h = ["label", "secondaryLabel", "auxiliaryLabel", "hint", "maxWidth", "togglePasswordLabel", "hidden", "aria-describedby"];
|
|
1229
|
+
const PasswordField = /*#__PURE__*/React.forwardRef(function PasswordField(_ref, ref) {
|
|
1230
|
+
let {
|
|
1231
|
+
label,
|
|
1232
|
+
secondaryLabel,
|
|
1233
|
+
auxiliaryLabel,
|
|
1234
|
+
hint,
|
|
1235
|
+
maxWidth,
|
|
1236
|
+
togglePasswordLabel = 'Toggle password visibility',
|
|
1237
|
+
hidden,
|
|
1238
|
+
'aria-describedby': ariaDescribedBy
|
|
1239
|
+
} = _ref,
|
|
1240
|
+
props = _objectWithoutProperties(_ref, _excluded$h);
|
|
1241
|
+
|
|
1242
|
+
const id = useId(props.id);
|
|
1243
|
+
const internalRef = React.useRef(null);
|
|
1244
|
+
const inputRef = ariakitUtils.useForkRef(internalRef, ref);
|
|
1245
|
+
const [isPasswordVisible, setPasswordVisible] = React.useState(false);
|
|
1272
1246
|
|
|
1273
1247
|
function togglePasswordVisibility() {
|
|
1274
1248
|
var _internalRef$current;
|
|
1275
1249
|
|
|
1276
|
-
setPasswordVisible(
|
|
1277
|
-
|
|
1278
|
-
});
|
|
1279
|
-
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
|
|
1250
|
+
setPasswordVisible(v => !v);
|
|
1251
|
+
(_internalRef$current = internalRef.current) == null ? void 0 : _internalRef$current.focus();
|
|
1280
1252
|
}
|
|
1281
1253
|
|
|
1282
1254
|
return /*#__PURE__*/React.createElement(BaseField, {
|
|
@@ -1288,43 +1260,43 @@ var PasswordField = /*#__PURE__*/React.forwardRef(function PasswordField(_ref, r
|
|
|
1288
1260
|
maxWidth: maxWidth,
|
|
1289
1261
|
hidden: hidden,
|
|
1290
1262
|
"aria-describedby": ariaDescribedBy
|
|
1291
|
-
},
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
}))));
|
|
1311
|
-
});
|
|
1263
|
+
}, extraProps => /*#__PURE__*/React.createElement(Box, {
|
|
1264
|
+
display: "flex",
|
|
1265
|
+
alignItems: "center",
|
|
1266
|
+
className: [modules_3f03ead6.inputWrapper, modules_aaf25250.inputWrapper]
|
|
1267
|
+
}, /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2(_objectSpread2({}, props), extraProps), {}, {
|
|
1268
|
+
ref: inputRef,
|
|
1269
|
+
type: isPasswordVisible ? 'text' : 'password'
|
|
1270
|
+
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
1271
|
+
content: togglePasswordLabel
|
|
1272
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
1273
|
+
type: "button",
|
|
1274
|
+
onClick: togglePasswordVisibility,
|
|
1275
|
+
"aria-label": togglePasswordLabel,
|
|
1276
|
+
tabIndex: -1
|
|
1277
|
+
}, isPasswordVisible ? /*#__PURE__*/React.createElement(PasswordVisibleIcon, {
|
|
1278
|
+
"aria-hidden": true
|
|
1279
|
+
}) : /*#__PURE__*/React.createElement(PasswordHiddenIcon, {
|
|
1280
|
+
"aria-hidden": true
|
|
1281
|
+
})))));
|
|
1312
1282
|
});
|
|
1313
1283
|
|
|
1314
1284
|
var modules_1fa9b208 = {"selectWrapper":"_828e09c5"};
|
|
1315
1285
|
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1286
|
+
const _excluded$i = ["id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "maxWidth", "children", "hidden", "aria-describedby"];
|
|
1287
|
+
const SelectField = /*#__PURE__*/React.forwardRef(function SelectField(_ref, ref) {
|
|
1288
|
+
let {
|
|
1289
|
+
id,
|
|
1290
|
+
label,
|
|
1291
|
+
secondaryLabel,
|
|
1292
|
+
auxiliaryLabel,
|
|
1293
|
+
hint,
|
|
1294
|
+
maxWidth,
|
|
1295
|
+
children,
|
|
1296
|
+
hidden,
|
|
1297
|
+
'aria-describedby': ariaDescribedBy
|
|
1298
|
+
} = _ref,
|
|
1299
|
+
props = _objectWithoutProperties(_ref, _excluded$i);
|
|
1328
1300
|
|
|
1329
1301
|
return /*#__PURE__*/React.createElement(BaseField, {
|
|
1330
1302
|
id: id,
|
|
@@ -1335,19 +1307,17 @@ var SelectField = /*#__PURE__*/React.forwardRef(function SelectField(_ref, ref)
|
|
|
1335
1307
|
maxWidth: maxWidth,
|
|
1336
1308
|
hidden: hidden,
|
|
1337
1309
|
"aria-describedby": ariaDescribedBy
|
|
1338
|
-
},
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
}));
|
|
1346
|
-
});
|
|
1310
|
+
}, extraProps => /*#__PURE__*/React.createElement(Box, {
|
|
1311
|
+
className: modules_1fa9b208.selectWrapper
|
|
1312
|
+
}, /*#__PURE__*/React.createElement("select", _objectSpread2(_objectSpread2(_objectSpread2({}, props), extraProps), {}, {
|
|
1313
|
+
ref: ref
|
|
1314
|
+
}), children), /*#__PURE__*/React.createElement(SelectChevron, {
|
|
1315
|
+
"aria-hidden": true
|
|
1316
|
+
})));
|
|
1347
1317
|
});
|
|
1348
1318
|
|
|
1349
1319
|
function SelectChevron(props) {
|
|
1350
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
1320
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
1351
1321
|
width: "16",
|
|
1352
1322
|
height: "16",
|
|
1353
1323
|
fill: "none",
|
|
@@ -1360,38 +1330,32 @@ function SelectChevron(props) {
|
|
|
1360
1330
|
|
|
1361
1331
|
var modules_8e05f7c9 = {"container":"ec63c3f1","disabled":"_7de9c06d","checked":"a37981fc","toggle":"_2a17ac45","label":"_68cc9707","handle":"_91409c7f","keyFocused":"a6490371"};
|
|
1362
1332
|
|
|
1363
|
-
|
|
1364
|
-
|
|
1333
|
+
const _excluded$j = ["label", "hint", "disabled", "hidden", "defaultChecked", "id", "aria-describedby", "aria-label", "aria-labelledby", "onChange"];
|
|
1334
|
+
const SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref) {
|
|
1365
1335
|
var _ref2, _props$checked, _props$checked2;
|
|
1366
1336
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
var _React$useState2 = React.useState((_ref2 = (_props$checked = props.checked) !== null && _props$checked !== void 0 ? _props$checked : defaultChecked) !== null && _ref2 !== void 0 ? _ref2 : false),
|
|
1391
|
-
checkedState = _React$useState2[0],
|
|
1392
|
-
setChecked = _React$useState2[1];
|
|
1393
|
-
|
|
1394
|
-
var isChecked = (_props$checked2 = props.checked) !== null && _props$checked2 !== void 0 ? _props$checked2 : checkedState;
|
|
1337
|
+
let {
|
|
1338
|
+
label,
|
|
1339
|
+
hint,
|
|
1340
|
+
disabled = false,
|
|
1341
|
+
hidden,
|
|
1342
|
+
defaultChecked,
|
|
1343
|
+
id: originalId,
|
|
1344
|
+
'aria-describedby': originalAriaDescribedBy,
|
|
1345
|
+
'aria-label': originalAriaLabel,
|
|
1346
|
+
'aria-labelledby': originalAriaLabelledby,
|
|
1347
|
+
onChange
|
|
1348
|
+
} = _ref,
|
|
1349
|
+
props = _objectWithoutProperties(_ref, _excluded$j);
|
|
1350
|
+
|
|
1351
|
+
const id = useId(originalId);
|
|
1352
|
+
const hintId = useId();
|
|
1353
|
+
const ariaDescribedBy = originalAriaDescribedBy != null ? originalAriaDescribedBy : hint ? hintId : undefined;
|
|
1354
|
+
const ariaLabel = originalAriaLabel != null ? originalAriaLabel : undefined;
|
|
1355
|
+
const ariaLabelledBy = originalAriaLabelledby != null ? originalAriaLabelledby : undefined;
|
|
1356
|
+
const [keyFocused, setKeyFocused] = React.useState(false);
|
|
1357
|
+
const [checkedState, setChecked] = React.useState((_ref2 = (_props$checked = props.checked) != null ? _props$checked : defaultChecked) != null ? _ref2 : false);
|
|
1358
|
+
const isChecked = (_props$checked2 = props.checked) != null ? _props$checked2 : checkedState;
|
|
1395
1359
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
1396
1360
|
space: "small",
|
|
1397
1361
|
hidden: hidden
|
|
@@ -1407,7 +1371,7 @@ var SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref)
|
|
|
1407
1371
|
marginRight: "small",
|
|
1408
1372
|
flexShrink: 0,
|
|
1409
1373
|
className: modules_8e05f7c9.toggle
|
|
1410
|
-
}, /*#__PURE__*/React.createElement(HiddenVisually, null, /*#__PURE__*/React.createElement("input",
|
|
1374
|
+
}, /*#__PURE__*/React.createElement(HiddenVisually, null, /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1411
1375
|
id: id,
|
|
1412
1376
|
type: "checkbox",
|
|
1413
1377
|
disabled: disabled,
|
|
@@ -1416,24 +1380,20 @@ var SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref)
|
|
|
1416
1380
|
"aria-labelledby": ariaLabelledBy,
|
|
1417
1381
|
ref: ref,
|
|
1418
1382
|
checked: isChecked,
|
|
1419
|
-
onChange:
|
|
1420
|
-
|
|
1383
|
+
onChange: event => {
|
|
1384
|
+
onChange == null ? void 0 : onChange(event);
|
|
1421
1385
|
|
|
1422
1386
|
if (!event.defaultPrevented) {
|
|
1423
1387
|
setChecked(event.currentTarget.checked);
|
|
1424
1388
|
}
|
|
1425
1389
|
},
|
|
1426
|
-
onBlur:
|
|
1427
|
-
var _props$onBlur;
|
|
1428
|
-
|
|
1390
|
+
onBlur: event => {
|
|
1429
1391
|
setKeyFocused(false);
|
|
1430
|
-
props
|
|
1392
|
+
props == null ? void 0 : props.onBlur == null ? void 0 : props.onBlur(event);
|
|
1431
1393
|
},
|
|
1432
|
-
onKeyUp:
|
|
1433
|
-
var _props$onKeyUp;
|
|
1434
|
-
|
|
1394
|
+
onKeyUp: event => {
|
|
1435
1395
|
setKeyFocused(true);
|
|
1436
|
-
props
|
|
1396
|
+
props == null ? void 0 : props.onKeyUp == null ? void 0 : props.onKeyUp(event);
|
|
1437
1397
|
}
|
|
1438
1398
|
}))), /*#__PURE__*/React.createElement("span", {
|
|
1439
1399
|
className: modules_8e05f7c9.handle
|
|
@@ -1446,16 +1406,18 @@ var SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref)
|
|
|
1446
1406
|
|
|
1447
1407
|
var modules_2728c236 = {"container":"_5a579f96"};
|
|
1448
1408
|
|
|
1449
|
-
|
|
1409
|
+
const _excluded$k = ["id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "maxWidth"];
|
|
1450
1410
|
|
|
1451
1411
|
function TextArea(_ref) {
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1412
|
+
let {
|
|
1413
|
+
id,
|
|
1414
|
+
label,
|
|
1415
|
+
secondaryLabel,
|
|
1416
|
+
auxiliaryLabel,
|
|
1417
|
+
hint,
|
|
1418
|
+
maxWidth
|
|
1419
|
+
} = _ref,
|
|
1420
|
+
props = _objectWithoutProperties(_ref, _excluded$k);
|
|
1459
1421
|
|
|
1460
1422
|
return /*#__PURE__*/React.createElement(BaseField, {
|
|
1461
1423
|
id: id,
|
|
@@ -1465,26 +1427,25 @@ function TextArea(_ref) {
|
|
|
1465
1427
|
hint: hint,
|
|
1466
1428
|
className: modules_2728c236.container,
|
|
1467
1429
|
maxWidth: maxWidth
|
|
1468
|
-
},
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
|
1430
|
+
}, extraProps => /*#__PURE__*/React.createElement(Box, {
|
|
1431
|
+
width: "full"
|
|
1432
|
+
}, /*#__PURE__*/React.createElement("textarea", _objectSpread2(_objectSpread2({}, props), extraProps))));
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
const _excluded$l = ["id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "type", "maxWidth", "hidden", "aria-describedby"];
|
|
1436
|
+
const TextField = /*#__PURE__*/React.forwardRef(function TextField(_ref, ref) {
|
|
1437
|
+
let {
|
|
1438
|
+
id,
|
|
1439
|
+
label,
|
|
1440
|
+
secondaryLabel,
|
|
1441
|
+
auxiliaryLabel,
|
|
1442
|
+
hint,
|
|
1443
|
+
type = 'text',
|
|
1444
|
+
maxWidth,
|
|
1445
|
+
hidden,
|
|
1446
|
+
'aria-describedby': ariaDescribedBy
|
|
1447
|
+
} = _ref,
|
|
1448
|
+
props = _objectWithoutProperties(_ref, _excluded$l);
|
|
1488
1449
|
|
|
1489
1450
|
return /*#__PURE__*/React.createElement(BaseField, {
|
|
1490
1451
|
id: id,
|
|
@@ -1495,14 +1456,12 @@ var TextField = /*#__PURE__*/React.forwardRef(function TextField(_ref, ref) {
|
|
|
1495
1456
|
maxWidth: maxWidth,
|
|
1496
1457
|
hidden: hidden,
|
|
1497
1458
|
"aria-describedby": ariaDescribedBy
|
|
1498
|
-
},
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
})));
|
|
1505
|
-
});
|
|
1459
|
+
}, extraProps => /*#__PURE__*/React.createElement(Box, {
|
|
1460
|
+
className: modules_aaf25250.inputWrapper
|
|
1461
|
+
}, /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2(_objectSpread2({}, props), extraProps), {}, {
|
|
1462
|
+
type: type,
|
|
1463
|
+
ref: ref
|
|
1464
|
+
}))));
|
|
1506
1465
|
});
|
|
1507
1466
|
|
|
1508
1467
|
/**
|
|
@@ -1520,52 +1479,52 @@ var TextField = /*#__PURE__*/React.forwardRef(function TextField(_ref, ref) {
|
|
|
1520
1479
|
*/
|
|
1521
1480
|
|
|
1522
1481
|
function usePrevious(value) {
|
|
1523
|
-
|
|
1524
|
-
React.useEffect(
|
|
1482
|
+
const ref = React.useRef(null);
|
|
1483
|
+
React.useEffect(() => {
|
|
1525
1484
|
ref.current = value;
|
|
1526
1485
|
}, [value]);
|
|
1527
1486
|
return ref.current;
|
|
1528
1487
|
}
|
|
1529
1488
|
|
|
1530
|
-
var modules_40c67f5b = {"tab":"
|
|
1489
|
+
var modules_40c67f5b = {"tab":"_15d4bbf4","tab-normal":"ca31866d","tab-primary":"_421272bd","tab-secondary":"acbdf95a","tab-tertiary":"_8c59ab40","tab-plain":"a41904c9"};
|
|
1531
1490
|
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
_excluded5 = ["color", "variant"];
|
|
1537
|
-
var TabsContext = /*#__PURE__*/React.createContext(null);
|
|
1491
|
+
const _excluded$m = ["as", "children", "id", "exceptionallySetClassName"],
|
|
1492
|
+
_excluded2$1 = ["children", "space"],
|
|
1493
|
+
_excluded3 = ["children", "id", "as", "render"];
|
|
1494
|
+
const TabsContext = /*#__PURE__*/React.createContext(null);
|
|
1538
1495
|
/**
|
|
1539
1496
|
* Used to group components that compose a set of tabs. There can only be one active tab within the same `<Tabs>` group.
|
|
1540
1497
|
*/
|
|
1541
1498
|
|
|
1542
|
-
function Tabs(
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1499
|
+
function Tabs({
|
|
1500
|
+
children,
|
|
1501
|
+
selectedId,
|
|
1502
|
+
defaultSelectedId,
|
|
1503
|
+
color = 'primary',
|
|
1504
|
+
variant = 'normal',
|
|
1505
|
+
onSelectedIdChange
|
|
1506
|
+
}) {
|
|
1507
|
+
const tabState = tab.useTabState({
|
|
1508
|
+
selectedId,
|
|
1509
|
+
setSelectedId: onSelectedIdChange
|
|
1551
1510
|
});
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1511
|
+
const previousDefaultSelectedId = usePrevious(defaultSelectedId);
|
|
1512
|
+
const {
|
|
1513
|
+
selectedId: actualSelectedId,
|
|
1514
|
+
select
|
|
1515
|
+
} = tabState;
|
|
1516
|
+
React.useEffect(function selectDefaultTab() {
|
|
1517
|
+
if (!selectedId && defaultSelectedId !== previousDefaultSelectedId && defaultSelectedId !== actualSelectedId && defaultSelectedId !== undefined) {
|
|
1518
|
+
select(defaultSelectedId);
|
|
1558
1519
|
}
|
|
1559
|
-
}, [selectedId, actualSelectedId, select,
|
|
1560
|
-
|
|
1561
|
-
return
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
// eslint-disable-next-line
|
|
1568
|
-
[color, variant].concat(Object.values(tabState)));
|
|
1520
|
+
}, [selectedId, defaultSelectedId, actualSelectedId, select, previousDefaultSelectedId]);
|
|
1521
|
+
const memoizedTabState = React.useMemo(function memoizeTabState() {
|
|
1522
|
+
return {
|
|
1523
|
+
tabState,
|
|
1524
|
+
color,
|
|
1525
|
+
variant
|
|
1526
|
+
};
|
|
1527
|
+
}, [color, variant, tabState]);
|
|
1569
1528
|
return /*#__PURE__*/React.createElement(TabsContext.Provider, {
|
|
1570
1529
|
value: memoizedTabState
|
|
1571
1530
|
}, children);
|
|
@@ -1574,43 +1533,57 @@ function Tabs(_ref) {
|
|
|
1574
1533
|
* Represents the individual tab elements within the group. Each `<Tab>` must have a corresponding `<TabPanel>` component.
|
|
1575
1534
|
*/
|
|
1576
1535
|
|
|
1577
|
-
function Tab(
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1536
|
+
const Tab = /*#__PURE__*/polymorphicComponent(function Tab(_ref, ref) {
|
|
1537
|
+
let {
|
|
1538
|
+
as,
|
|
1539
|
+
children,
|
|
1540
|
+
id,
|
|
1541
|
+
exceptionallySetClassName
|
|
1542
|
+
} = _ref,
|
|
1543
|
+
props = _objectWithoutProperties(_ref, _excluded$m);
|
|
1544
|
+
|
|
1545
|
+
const tabContextValue = React.useContext(TabsContext);
|
|
1581
1546
|
|
|
1582
1547
|
if (!tabContextValue) {
|
|
1583
1548
|
return null;
|
|
1584
1549
|
}
|
|
1585
1550
|
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1551
|
+
const {
|
|
1552
|
+
color,
|
|
1553
|
+
variant,
|
|
1554
|
+
tabState
|
|
1555
|
+
} = tabContextValue;
|
|
1556
|
+
return /*#__PURE__*/React.createElement(tab.Tab, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1557
|
+
as: as,
|
|
1558
|
+
className: classNames(exceptionallySetClassName, modules_40c67f5b.tab, modules_40c67f5b["tab-" + (variant != null ? variant : '')], modules_40c67f5b["tab-" + (color != null ? color : '')]),
|
|
1559
|
+
id: id,
|
|
1560
|
+
state: tabState,
|
|
1561
|
+
ref: ref
|
|
1562
|
+
}), children);
|
|
1563
|
+
});
|
|
1595
1564
|
/**
|
|
1596
1565
|
* A component used to group `<Tab>` elements together.
|
|
1597
1566
|
*/
|
|
1598
1567
|
|
|
1599
|
-
function TabList(
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1568
|
+
function TabList(_ref2) {
|
|
1569
|
+
let {
|
|
1570
|
+
children,
|
|
1571
|
+
space = 'medium'
|
|
1572
|
+
} = _ref2,
|
|
1573
|
+
props = _objectWithoutProperties(_ref2, _excluded2$1);
|
|
1604
1574
|
|
|
1605
|
-
|
|
1575
|
+
const tabContextValue = React.useContext(TabsContext);
|
|
1606
1576
|
|
|
1607
1577
|
if (!tabContextValue) {
|
|
1608
1578
|
return null;
|
|
1609
1579
|
}
|
|
1610
1580
|
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1581
|
+
const {
|
|
1582
|
+
tabState
|
|
1583
|
+
} = tabContextValue;
|
|
1584
|
+
return /*#__PURE__*/React.createElement(tab.TabList, _objectSpread2({
|
|
1585
|
+
state: tabState
|
|
1586
|
+
}, props), /*#__PURE__*/React.createElement(Inline, {
|
|
1614
1587
|
space: space
|
|
1615
1588
|
}, children));
|
|
1616
1589
|
}
|
|
@@ -1618,21 +1591,18 @@ function TabList(_ref3) {
|
|
|
1618
1591
|
* Used to define the content to be rendered when a tab is active. Each `<TabPanel>` must have a corresponding `<Tab>` component.
|
|
1619
1592
|
*/
|
|
1620
1593
|
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
setTabRendered = _React$useState[1];
|
|
1634
|
-
|
|
1635
|
-
var tabIsActive = (tabContextValue === null || tabContextValue === void 0 ? void 0 : tabContextValue.selectedId) === id;
|
|
1594
|
+
const TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref3, ref) {
|
|
1595
|
+
let {
|
|
1596
|
+
children,
|
|
1597
|
+
id,
|
|
1598
|
+
as,
|
|
1599
|
+
render = 'always'
|
|
1600
|
+
} = _ref3,
|
|
1601
|
+
props = _objectWithoutProperties(_ref3, _excluded3);
|
|
1602
|
+
|
|
1603
|
+
const tabContextValue = React.useContext(TabsContext);
|
|
1604
|
+
const [tabRendered, setTabRendered] = React.useState(false);
|
|
1605
|
+
const tabIsActive = (tabContextValue == null ? void 0 : tabContextValue.tabState.selectedId) === id;
|
|
1636
1606
|
React.useEffect(function trackTabRenderedState() {
|
|
1637
1607
|
if (!tabRendered && tabIsActive) {
|
|
1638
1608
|
setTabRendered(true);
|
|
@@ -1643,11 +1613,13 @@ var TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref4, ref) {
|
|
|
1643
1613
|
return null;
|
|
1644
1614
|
}
|
|
1645
1615
|
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1616
|
+
const {
|
|
1617
|
+
tabState
|
|
1618
|
+
} = tabContextValue;
|
|
1619
|
+
return /*#__PURE__*/React.createElement(tab.TabPanel, _objectSpread2(_objectSpread2({
|
|
1649
1620
|
tabId: id
|
|
1650
|
-
},
|
|
1621
|
+
}, props), {}, {
|
|
1622
|
+
state: tabState,
|
|
1651
1623
|
as: as,
|
|
1652
1624
|
ref: ref
|
|
1653
1625
|
}), render === 'always' ? children : null, render === 'active' && tabIsActive ? children : null, render === 'lazy' && (tabIsActive || tabRendered) ? children : null);
|
|
@@ -1657,22 +1629,23 @@ var TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref4, ref) {
|
|
|
1657
1629
|
* component. Can be placed freely within the main `<Tabs>` component.
|
|
1658
1630
|
*/
|
|
1659
1631
|
|
|
1660
|
-
function TabAwareSlot(
|
|
1661
|
-
|
|
1662
|
-
|
|
1632
|
+
function TabAwareSlot({
|
|
1633
|
+
children
|
|
1634
|
+
}) {
|
|
1635
|
+
const tabContextValue = React.useContext(TabsContext);
|
|
1663
1636
|
return tabContextValue ? children({
|
|
1664
|
-
selectedId: tabContextValue.selectedId
|
|
1637
|
+
selectedId: tabContextValue == null ? void 0 : tabContextValue.tabState.selectedId
|
|
1665
1638
|
}) : null;
|
|
1666
1639
|
}
|
|
1667
1640
|
|
|
1668
|
-
var modules_8f59d13b = {"reach-portal":"
|
|
1641
|
+
var modules_8f59d13b = {"reach-portal":"_37bef8d8","fadein":"_77f9687f","fitContent":"bcc4e0a5","container":"d4832c2d","full":"b0c3b021","large":"_573d6aa5","medium":"_8550d996","small":"_43bb18f5","xlarge":"_57b4159d","overlay":"cb63f300","expand":"e741893e","buttonContainer":"bb1ce281","headerContent":"c5ef989c"};
|
|
1669
1642
|
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1643
|
+
const _excluded$n = ["isOpen", "onDismiss", "height", "width", "exceptionallySetClassName", "autoFocus", "children"],
|
|
1644
|
+
_excluded2$2 = ["children", "button", "withDivider", "exceptionallySetClassName"],
|
|
1645
|
+
_excluded3$1 = ["exceptionallySetClassName", "children"],
|
|
1646
|
+
_excluded4 = ["exceptionallySetClassName", "withDivider"],
|
|
1647
|
+
_excluded5 = ["children"];
|
|
1648
|
+
const ModalContext = /*#__PURE__*/React.createContext({
|
|
1676
1649
|
onDismiss: undefined,
|
|
1677
1650
|
height: 'fitContent'
|
|
1678
1651
|
});
|
|
@@ -1692,24 +1665,21 @@ function isNotInternalFrame(element) {
|
|
|
1692
1665
|
|
|
1693
1666
|
|
|
1694
1667
|
function Modal(_ref) {
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
height: height
|
|
1711
|
-
};
|
|
1712
|
-
}, [onDismiss, height]);
|
|
1668
|
+
let {
|
|
1669
|
+
isOpen,
|
|
1670
|
+
onDismiss,
|
|
1671
|
+
height = 'fitContent',
|
|
1672
|
+
width = 'medium',
|
|
1673
|
+
exceptionallySetClassName,
|
|
1674
|
+
autoFocus = true,
|
|
1675
|
+
children
|
|
1676
|
+
} = _ref,
|
|
1677
|
+
props = _objectWithoutProperties(_ref, _excluded$n);
|
|
1678
|
+
|
|
1679
|
+
const contextValue = React.useMemo(() => ({
|
|
1680
|
+
onDismiss,
|
|
1681
|
+
height
|
|
1682
|
+
}), [onDismiss, height]);
|
|
1713
1683
|
return /*#__PURE__*/React.createElement(dialog.DialogOverlay, {
|
|
1714
1684
|
isOpen: isOpen,
|
|
1715
1685
|
onDismiss: onDismiss,
|
|
@@ -1721,7 +1691,7 @@ function Modal(_ref) {
|
|
|
1721
1691
|
autoFocus: autoFocus,
|
|
1722
1692
|
whiteList: isNotInternalFrame,
|
|
1723
1693
|
returnFocus: true
|
|
1724
|
-
}, /*#__PURE__*/React.createElement(dialog.DialogContent,
|
|
1694
|
+
}, /*#__PURE__*/React.createElement(dialog.DialogContent, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1725
1695
|
as: Box,
|
|
1726
1696
|
borderRadius: "full",
|
|
1727
1697
|
background: "default",
|
|
@@ -1743,17 +1713,11 @@ function Modal(_ref) {
|
|
|
1743
1713
|
*/
|
|
1744
1714
|
|
|
1745
1715
|
function ModalCloseButton(props) {
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
setIncludeInTabOrder = _React$useState[1];
|
|
1752
|
-
|
|
1753
|
-
var _React$useState2 = React.useState(false),
|
|
1754
|
-
isMounted = _React$useState2[0],
|
|
1755
|
-
setIsMounted = _React$useState2[1];
|
|
1756
|
-
|
|
1716
|
+
const {
|
|
1717
|
+
onDismiss
|
|
1718
|
+
} = React.useContext(ModalContext);
|
|
1719
|
+
const [includeInTabOrder, setIncludeInTabOrder] = React.useState(false);
|
|
1720
|
+
const [isMounted, setIsMounted] = React.useState(false);
|
|
1757
1721
|
React.useEffect(function skipAutoFocus() {
|
|
1758
1722
|
if (isMounted) {
|
|
1759
1723
|
setIncludeInTabOrder(true);
|
|
@@ -1761,7 +1725,7 @@ function ModalCloseButton(props) {
|
|
|
1761
1725
|
setIsMounted(true);
|
|
1762
1726
|
}
|
|
1763
1727
|
}, [isMounted]);
|
|
1764
|
-
return /*#__PURE__*/React.createElement(Button,
|
|
1728
|
+
return /*#__PURE__*/React.createElement(Button, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1765
1729
|
variant: "quaternary",
|
|
1766
1730
|
onClick: onDismiss,
|
|
1767
1731
|
icon: /*#__PURE__*/React.createElement(CloseIcon, null),
|
|
@@ -1777,18 +1741,18 @@ function ModalCloseButton(props) {
|
|
|
1777
1741
|
*/
|
|
1778
1742
|
|
|
1779
1743
|
function ModalHeader(_ref2) {
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
props =
|
|
1787
|
-
|
|
1788
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box,
|
|
1744
|
+
let {
|
|
1745
|
+
children,
|
|
1746
|
+
button = true,
|
|
1747
|
+
withDivider = false,
|
|
1748
|
+
exceptionallySetClassName
|
|
1749
|
+
} = _ref2,
|
|
1750
|
+
props = _objectWithoutProperties(_ref2, _excluded2$2);
|
|
1751
|
+
|
|
1752
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1789
1753
|
as: "header",
|
|
1790
1754
|
paddingLeft: "large",
|
|
1791
|
-
paddingRight:
|
|
1755
|
+
paddingRight: button === false || button === null ? 'large' : 'small',
|
|
1792
1756
|
paddingY: "small",
|
|
1793
1757
|
className: exceptionallySetClassName
|
|
1794
1758
|
}), /*#__PURE__*/React.createElement(Columns, {
|
|
@@ -1796,7 +1760,9 @@ function ModalHeader(_ref2) {
|
|
|
1796
1760
|
alignY: "center"
|
|
1797
1761
|
}, /*#__PURE__*/React.createElement(Column, {
|
|
1798
1762
|
width: "auto"
|
|
1799
|
-
}, children), button === false || button === null ?
|
|
1763
|
+
}, children), button === false || button === null ? /*#__PURE__*/React.createElement("div", {
|
|
1764
|
+
className: modules_8f59d13b.headerContent
|
|
1765
|
+
}) : /*#__PURE__*/React.createElement(Column, {
|
|
1800
1766
|
width: "content",
|
|
1801
1767
|
exceptionallySetClassName: modules_8f59d13b.buttonContainer,
|
|
1802
1768
|
"data-testid": "button-container"
|
|
@@ -1819,14 +1785,16 @@ function ModalHeader(_ref2) {
|
|
|
1819
1785
|
*/
|
|
1820
1786
|
|
|
1821
1787
|
function ModalBody(_ref3) {
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1788
|
+
let {
|
|
1789
|
+
exceptionallySetClassName,
|
|
1790
|
+
children
|
|
1791
|
+
} = _ref3,
|
|
1792
|
+
props = _objectWithoutProperties(_ref3, _excluded3$1);
|
|
1793
|
+
|
|
1794
|
+
const {
|
|
1795
|
+
height
|
|
1796
|
+
} = React.useContext(ModalContext);
|
|
1797
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1830
1798
|
className: exceptionallySetClassName,
|
|
1831
1799
|
flexGrow: height === 'expand' ? 1 : 0,
|
|
1832
1800
|
height: height === 'expand' ? 'full' : undefined,
|
|
@@ -1845,14 +1813,15 @@ function ModalBody(_ref3) {
|
|
|
1845
1813
|
*/
|
|
1846
1814
|
|
|
1847
1815
|
function ModalFooter(_ref4) {
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1816
|
+
let {
|
|
1817
|
+
exceptionallySetClassName,
|
|
1818
|
+
withDivider = false
|
|
1819
|
+
} = _ref4,
|
|
1820
|
+
props = _objectWithoutProperties(_ref4, _excluded4);
|
|
1852
1821
|
|
|
1853
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, withDivider ? /*#__PURE__*/React.createElement(Divider, null) : null, /*#__PURE__*/React.createElement(Box,
|
|
1822
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, withDivider ? /*#__PURE__*/React.createElement(Divider, null) : null, /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({
|
|
1854
1823
|
as: "footer"
|
|
1855
|
-
}, props, {
|
|
1824
|
+
}, props), {}, {
|
|
1856
1825
|
className: exceptionallySetClassName,
|
|
1857
1826
|
padding: "large"
|
|
1858
1827
|
})));
|
|
@@ -1863,65 +1832,71 @@ function ModalFooter(_ref4) {
|
|
|
1863
1832
|
*/
|
|
1864
1833
|
|
|
1865
1834
|
function ModalActions(_ref5) {
|
|
1866
|
-
|
|
1867
|
-
|
|
1835
|
+
let {
|
|
1836
|
+
children
|
|
1837
|
+
} = _ref5,
|
|
1838
|
+
props = _objectWithoutProperties(_ref5, _excluded5);
|
|
1868
1839
|
|
|
1869
|
-
return /*#__PURE__*/React.createElement(ModalFooter,
|
|
1840
|
+
return /*#__PURE__*/React.createElement(ModalFooter, _objectSpread2({}, props), /*#__PURE__*/React.createElement(Inline, {
|
|
1870
1841
|
align: "right",
|
|
1871
1842
|
space: "large"
|
|
1872
1843
|
}, children));
|
|
1873
1844
|
}
|
|
1874
1845
|
|
|
1875
1846
|
function getInitials(name) {
|
|
1847
|
+
var _initials;
|
|
1848
|
+
|
|
1876
1849
|
if (!name) {
|
|
1877
1850
|
return '';
|
|
1878
1851
|
}
|
|
1879
1852
|
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
|
1853
|
+
const seed = name.trim().split(' ');
|
|
1854
|
+
const firstInitial = seed[0];
|
|
1855
|
+
const lastInitial = seed[seed.length - 1];
|
|
1856
|
+
let initials = firstInitial == null ? void 0 : firstInitial[0];
|
|
1885
1857
|
|
|
1886
|
-
if (firstInitial
|
|
1858
|
+
if (firstInitial != null && lastInitial != null && initials != null && // Better readable this way.
|
|
1859
|
+
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
|
1860
|
+
firstInitial[0] !== lastInitial[0]) {
|
|
1887
1861
|
initials += lastInitial[0];
|
|
1888
1862
|
}
|
|
1889
1863
|
|
|
1890
|
-
return initials.toUpperCase();
|
|
1864
|
+
return (_initials = initials) == null ? void 0 : _initials.toUpperCase();
|
|
1891
1865
|
}
|
|
1892
1866
|
|
|
1893
1867
|
function emailToIndex(email, maxIndex) {
|
|
1894
|
-
|
|
1895
|
-
|
|
1868
|
+
const seed = email.split('@')[0];
|
|
1869
|
+
const hash = seed ? seed.charCodeAt(0) + seed.charCodeAt(seed.length - 1) || 0 : 0;
|
|
1896
1870
|
return hash % maxIndex;
|
|
1897
1871
|
}
|
|
1898
1872
|
|
|
1899
1873
|
var modules_08f3eeac = {"avatar":"_38a1be89","size-xxs":"d32e92ae","size-xs":"_0667d719","size-s":"cf529fcf","size-m":"_6e268eab","size-l":"d64c62cf","size-xl":"_44fb77de","size-xxl":"_01f85e0e","size-xxxl":"_41a5fe19","tablet-size-xxs":"_6ab1577d","tablet-size-xs":"b52a4963","tablet-size-s":"_714a8419","tablet-size-m":"_81cd4d51","tablet-size-l":"bf0a4edb","tablet-size-xl":"e4f0dabd","tablet-size-xxl":"_67ea065d","tablet-size-xxxl":"_2af7f76f","desktop-size-xxs":"_759081dc","desktop-size-xs":"_8290d1c1","desktop-size-s":"_48ea172d","desktop-size-m":"_758f6641","desktop-size-l":"f9ada088","desktop-size-xl":"d3bb7470","desktop-size-xxl":"_9a312ee3","desktop-size-xxxl":"a1d30c23"};
|
|
1900
1874
|
|
|
1901
|
-
|
|
1902
|
-
|
|
1875
|
+
const _excluded$o = ["user", "avatarUrl", "size", "className", "colorList", "exceptionallySetClassName"];
|
|
1876
|
+
const AVATAR_COLORS = ['#fcc652', '#e9952c', '#e16b2d', '#d84b40', '#e8435a', '#e5198a', '#ad3889', '#86389c', '#a8a8a8', '#98be2f', '#5d9d50', '#5f9f85', '#5bbcb6', '#32a3bf', '#2bafeb', '#2d88c3', '#3863cc', '#5e5e5e'];
|
|
1903
1877
|
|
|
1904
1878
|
function Avatar(_ref) {
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
props =
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1879
|
+
let {
|
|
1880
|
+
user,
|
|
1881
|
+
avatarUrl,
|
|
1882
|
+
size = 'l',
|
|
1883
|
+
className,
|
|
1884
|
+
colorList = AVATAR_COLORS,
|
|
1885
|
+
exceptionallySetClassName
|
|
1886
|
+
} = _ref,
|
|
1887
|
+
props = _objectWithoutProperties(_ref, _excluded$o);
|
|
1888
|
+
|
|
1889
|
+
const userInitials = getInitials(user.name) || getInitials(user.email);
|
|
1890
|
+
const avatarSize = size ? size : 'l';
|
|
1891
|
+
const style = avatarUrl ? {
|
|
1918
1892
|
backgroundImage: "url(" + avatarUrl + ")",
|
|
1919
|
-
textIndent: '-9999px'
|
|
1893
|
+
textIndent: '-9999px' // hide the initials
|
|
1894
|
+
|
|
1920
1895
|
} : {
|
|
1921
1896
|
backgroundColor: colorList[emailToIndex(user.email, colorList.length)]
|
|
1922
1897
|
};
|
|
1923
|
-
|
|
1924
|
-
return /*#__PURE__*/React__default.createElement(Box,
|
|
1898
|
+
const sizeClassName = getClassNames(modules_08f3eeac, 'size', avatarSize);
|
|
1899
|
+
return /*#__PURE__*/React__default.createElement(Box, _objectSpread2({
|
|
1925
1900
|
className: [className, modules_08f3eeac.avatar, sizeClassName, exceptionallySetClassName],
|
|
1926
1901
|
style: style
|
|
1927
1902
|
}, props), userInitials);
|
|
@@ -1929,12 +1904,12 @@ function Avatar(_ref) {
|
|
|
1929
1904
|
|
|
1930
1905
|
Avatar.displayName = 'Avatar';
|
|
1931
1906
|
|
|
1932
|
-
function Checkbox(
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1907
|
+
function Checkbox({
|
|
1908
|
+
label,
|
|
1909
|
+
disabled,
|
|
1910
|
+
checked = false,
|
|
1911
|
+
onChange
|
|
1912
|
+
}) {
|
|
1938
1913
|
return /*#__PURE__*/React__default.createElement("label", {
|
|
1939
1914
|
className: "reactist_checkbox"
|
|
1940
1915
|
}, /*#__PURE__*/React__default.createElement("input", {
|
|
@@ -1942,39 +1917,35 @@ function Checkbox(_ref) {
|
|
|
1942
1917
|
value: label,
|
|
1943
1918
|
checked: checked,
|
|
1944
1919
|
disabled: disabled,
|
|
1945
|
-
onChange: disabled || !onChange ? undefined :
|
|
1946
|
-
return onChange(event.target.checked);
|
|
1947
|
-
},
|
|
1920
|
+
onChange: disabled || !onChange ? undefined : event => onChange(event.target.checked),
|
|
1948
1921
|
type: "checkbox"
|
|
1949
1922
|
}), label);
|
|
1950
1923
|
}
|
|
1951
1924
|
|
|
1952
1925
|
Checkbox.displayName = 'Checkbox';
|
|
1953
1926
|
|
|
1954
|
-
|
|
1927
|
+
const _excluded$p = ["type", "variant", "size", "loading", "disabled", "tooltip", "onClick", "children"];
|
|
1955
1928
|
/**
|
|
1956
1929
|
* @deprecated
|
|
1957
1930
|
*/
|
|
1958
1931
|
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
var className = classNames('reactist_button', variant ? "reactist_button--" + variant : null, size !== 'default' ? "reactist_button--" + size : null, {
|
|
1932
|
+
const Button$1 = /*#__PURE__*/React__default.forwardRef(function Button(_ref, ref) {
|
|
1933
|
+
let {
|
|
1934
|
+
type = 'button',
|
|
1935
|
+
variant,
|
|
1936
|
+
size = 'default',
|
|
1937
|
+
loading = false,
|
|
1938
|
+
disabled = false,
|
|
1939
|
+
tooltip,
|
|
1940
|
+
onClick,
|
|
1941
|
+
children
|
|
1942
|
+
} = _ref,
|
|
1943
|
+
props = _objectWithoutProperties(_ref, _excluded$p);
|
|
1944
|
+
|
|
1945
|
+
const className = classNames('reactist_button', variant ? "reactist_button--" + variant : null, size !== 'default' ? "reactist_button--" + size : null, {
|
|
1975
1946
|
'reactist_button--loading': loading
|
|
1976
1947
|
}, props.className);
|
|
1977
|
-
|
|
1948
|
+
const button = /*#__PURE__*/React__default.createElement("button", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1978
1949
|
ref: ref,
|
|
1979
1950
|
type: type,
|
|
1980
1951
|
className: className,
|
|
@@ -1992,159 +1963,159 @@ Button$1.defaultProps = {
|
|
|
1992
1963
|
disabled: false
|
|
1993
1964
|
};
|
|
1994
1965
|
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
var Box$1 = /*#__PURE__*/function (_React$Component) {
|
|
1998
|
-
_inheritsLoose(Box, _React$Component);
|
|
1999
|
-
|
|
2000
|
-
function Box(props, context) {
|
|
2001
|
-
var _this;
|
|
1966
|
+
const _excluded$q = ["children", "onClick", "tooltip", "className"];
|
|
2002
1967
|
|
|
2003
|
-
|
|
1968
|
+
class Box$1 extends React__default.Component {
|
|
1969
|
+
constructor(props, context) {
|
|
1970
|
+
super(props, context);
|
|
1971
|
+
this._timeout = void 0;
|
|
2004
1972
|
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
if (dropdownDOMNode && !dropdownDOMNode.contains(event.target))
|
|
1973
|
+
this._handleClickOutside = event => {
|
|
1974
|
+
const dropdownDOMNode = ReactDOM.findDOMNode(this);
|
|
1975
|
+
if (dropdownDOMNode && !dropdownDOMNode.contains(event.target)) this._toggleShowBody();else if (!this.props.allowBodyInteractions) {
|
|
2008
1976
|
// won't close when body interactions are allowed
|
|
2009
|
-
|
|
2010
|
-
if (
|
|
2011
|
-
|
|
1977
|
+
this._timeout = setTimeout(() => {
|
|
1978
|
+
if (this.state.showBody) {
|
|
1979
|
+
this._toggleShowBody();
|
|
2012
1980
|
}
|
|
2013
1981
|
}, 100);
|
|
2014
1982
|
}
|
|
2015
1983
|
};
|
|
2016
1984
|
|
|
2017
|
-
|
|
2018
|
-
if (!
|
|
1985
|
+
this._toggleShowBody = () => {
|
|
1986
|
+
if (!this.state.showBody) {
|
|
2019
1987
|
// will show
|
|
2020
|
-
if (
|
|
2021
|
-
document.addEventListener('click',
|
|
1988
|
+
if (this.props.onShowBody) this.props.onShowBody();
|
|
1989
|
+
document.addEventListener('click', this._handleClickOutside, true);
|
|
2022
1990
|
} else {
|
|
2023
1991
|
// will hide
|
|
2024
|
-
if (
|
|
2025
|
-
document.removeEventListener('click',
|
|
1992
|
+
if (this.props.onHideBody) this.props.onHideBody();
|
|
1993
|
+
document.removeEventListener('click', this._handleClickOutside, true);
|
|
2026
1994
|
}
|
|
2027
1995
|
|
|
2028
|
-
|
|
2029
|
-
showBody: !
|
|
1996
|
+
this.setState({
|
|
1997
|
+
showBody: !this.state.showBody
|
|
2030
1998
|
});
|
|
2031
|
-
};
|
|
2032
|
-
|
|
1999
|
+
};
|
|
2033
2000
|
|
|
2034
|
-
|
|
2001
|
+
this._setPosition = body => {
|
|
2035
2002
|
if (body) {
|
|
2036
|
-
|
|
2003
|
+
const scrollingParent = document.getElementById(this.props.scrolling_parent ? this.props.scrolling_parent : '');
|
|
2037
2004
|
|
|
2038
2005
|
if (scrollingParent) {
|
|
2039
|
-
|
|
2006
|
+
const dropdown = ReactDOM.findDOMNode(this);
|
|
2040
2007
|
|
|
2041
2008
|
if (!dropdown) {
|
|
2042
2009
|
return;
|
|
2043
2010
|
}
|
|
2044
2011
|
|
|
2045
|
-
|
|
2046
|
-
|
|
2012
|
+
const dropdownVerticalPosition = ReactDOM.findDOMNode(this).offsetTop;
|
|
2013
|
+
const dropdownTrigger = dropdown.querySelector('.trigger');
|
|
2047
2014
|
|
|
2048
2015
|
if (!dropdownTrigger) {
|
|
2049
2016
|
return;
|
|
2050
2017
|
}
|
|
2051
2018
|
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2019
|
+
const dropdownTriggerHeight = dropdownTrigger.clientHeight;
|
|
2020
|
+
const dropdownBodyHeight = body.clientHeight;
|
|
2021
|
+
const scrollingParentHeight = scrollingParent.clientHeight;
|
|
2022
|
+
const scrollingParentOffset = scrollingParent.scrollTop;
|
|
2023
|
+
const bottomOffset = scrollingParentHeight + scrollingParentOffset - dropdownVerticalPosition - dropdownTriggerHeight;
|
|
2024
|
+
const top = bottomOffset < dropdownBodyHeight;
|
|
2058
2025
|
|
|
2059
|
-
if (top !==
|
|
2060
|
-
|
|
2061
|
-
top
|
|
2026
|
+
if (top !== this.state.top) {
|
|
2027
|
+
this.setState({
|
|
2028
|
+
top
|
|
2062
2029
|
});
|
|
2063
2030
|
}
|
|
2064
2031
|
}
|
|
2065
2032
|
}
|
|
2066
2033
|
};
|
|
2067
2034
|
|
|
2068
|
-
|
|
2035
|
+
this.state = {
|
|
2069
2036
|
showBody: false,
|
|
2070
2037
|
top: props.top || false
|
|
2071
2038
|
};
|
|
2072
|
-
|
|
2073
|
-
return _this;
|
|
2039
|
+
this._timeout = undefined;
|
|
2074
2040
|
}
|
|
2075
2041
|
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
2042
|
+
componentWillUnmount() {
|
|
2079
2043
|
document.removeEventListener('click', this._handleClickOutside, true);
|
|
2080
2044
|
|
|
2081
2045
|
if (this._timeout) {
|
|
2082
2046
|
clearTimeout(this._timeout);
|
|
2083
2047
|
}
|
|
2084
|
-
}
|
|
2048
|
+
}
|
|
2085
2049
|
|
|
2086
|
-
|
|
2050
|
+
_getTriggerComponent() {
|
|
2087
2051
|
var _this$props$children;
|
|
2088
2052
|
|
|
2089
|
-
|
|
2053
|
+
const _trigger = (_this$props$children = this.props.children) == null ? void 0 : _this$props$children[0];
|
|
2090
2054
|
|
|
2091
2055
|
return _trigger ? /*#__PURE__*/React__default.cloneElement(_trigger, {
|
|
2092
2056
|
onClick: this._toggleShowBody
|
|
2093
2057
|
}) : undefined;
|
|
2094
|
-
}
|
|
2058
|
+
} // https://facebook.github.io/react/docs/refs-and-the-dom.html#exposing-dom-refs-to-parent-components
|
|
2059
|
+
|
|
2095
2060
|
|
|
2096
|
-
|
|
2061
|
+
_getBodyComponent() {
|
|
2097
2062
|
if (!this.state.showBody) {
|
|
2098
2063
|
return null;
|
|
2099
2064
|
}
|
|
2100
2065
|
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2066
|
+
const {
|
|
2067
|
+
top
|
|
2068
|
+
} = this.state;
|
|
2069
|
+
const {
|
|
2070
|
+
right = false,
|
|
2071
|
+
children
|
|
2072
|
+
} = this.props;
|
|
2073
|
+
const props = {
|
|
2074
|
+
top,
|
|
2075
|
+
right,
|
|
2109
2076
|
setPosition: this._setPosition
|
|
2110
2077
|
};
|
|
2111
|
-
|
|
2078
|
+
const className = classNames({
|
|
2112
2079
|
body_wrapper: true,
|
|
2113
2080
|
with_arrow: true,
|
|
2114
2081
|
top: top,
|
|
2115
2082
|
bottom: !top
|
|
2116
2083
|
});
|
|
2117
|
-
|
|
2118
|
-
|
|
2084
|
+
const body = children == null ? void 0 : children[1];
|
|
2085
|
+
const contentMarkup = typeof body === 'function' ? body(props) : body ? /*#__PURE__*/React__default.cloneElement(body, props) : undefined;
|
|
2119
2086
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2120
2087
|
className: className,
|
|
2121
2088
|
style: {
|
|
2122
2089
|
position: 'relative'
|
|
2123
2090
|
}
|
|
2124
2091
|
}, contentMarkup);
|
|
2125
|
-
}
|
|
2092
|
+
}
|
|
2126
2093
|
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2094
|
+
render() {
|
|
2095
|
+
const className = classNames('reactist_dropdown', this.props.className);
|
|
2096
|
+
const {
|
|
2097
|
+
top
|
|
2098
|
+
} = this.state;
|
|
2130
2099
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2131
2100
|
style: {
|
|
2132
2101
|
display: 'inline-block'
|
|
2133
2102
|
},
|
|
2134
2103
|
className: className
|
|
2135
2104
|
}, top && this._getBodyComponent(), this._getTriggerComponent(), !top && this._getBodyComponent());
|
|
2136
|
-
}
|
|
2105
|
+
}
|
|
2137
2106
|
|
|
2138
|
-
|
|
2139
|
-
}(React__default.Component);
|
|
2107
|
+
}
|
|
2140
2108
|
|
|
2109
|
+
Box$1.displayName = void 0;
|
|
2141
2110
|
Box$1.displayName = 'Dropdown.Box';
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2111
|
+
const Trigger = /*#__PURE__*/React__default.forwardRef(function Trigger(_ref, ref) {
|
|
2112
|
+
let {
|
|
2113
|
+
children,
|
|
2114
|
+
onClick,
|
|
2115
|
+
tooltip,
|
|
2116
|
+
className
|
|
2117
|
+
} = _ref,
|
|
2118
|
+
props = _objectWithoutProperties(_ref, _excluded$q);
|
|
2148
2119
|
|
|
2149
2120
|
function handleClick(event) {
|
|
2150
2121
|
event.preventDefault();
|
|
@@ -2152,7 +2123,7 @@ var Trigger = /*#__PURE__*/React__default.forwardRef(function Trigger(_ref, ref)
|
|
|
2152
2123
|
if (onClick) onClick(event);
|
|
2153
2124
|
}
|
|
2154
2125
|
|
|
2155
|
-
return /*#__PURE__*/React__default.createElement(Button$1,
|
|
2126
|
+
return /*#__PURE__*/React__default.createElement(Button$1, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2156
2127
|
className: classNames('trigger', className),
|
|
2157
2128
|
onClick: handleClick,
|
|
2158
2129
|
tooltip: tooltip,
|
|
@@ -2161,12 +2132,13 @@ var Trigger = /*#__PURE__*/React__default.forwardRef(function Trigger(_ref, ref)
|
|
|
2161
2132
|
});
|
|
2162
2133
|
Trigger.displayName = 'Dropdown.Trigger';
|
|
2163
2134
|
|
|
2164
|
-
function Body(
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2135
|
+
function Body({
|
|
2136
|
+
top,
|
|
2137
|
+
right,
|
|
2138
|
+
children,
|
|
2139
|
+
setPosition
|
|
2140
|
+
}) {
|
|
2141
|
+
const style = {
|
|
2170
2142
|
position: 'absolute',
|
|
2171
2143
|
right: 0,
|
|
2172
2144
|
top: 0
|
|
@@ -2191,39 +2163,36 @@ function Body(_ref2) {
|
|
|
2191
2163
|
}
|
|
2192
2164
|
|
|
2193
2165
|
Body.displayName = 'Dropdown.Body';
|
|
2194
|
-
|
|
2166
|
+
const Dropdown = {
|
|
2195
2167
|
Box: Box$1,
|
|
2196
|
-
Trigger
|
|
2197
|
-
Body
|
|
2168
|
+
Trigger,
|
|
2169
|
+
Body
|
|
2198
2170
|
};
|
|
2199
2171
|
|
|
2200
|
-
|
|
2172
|
+
const COLORS = ['#606060', '#4A90E2', '#03B3B2', '#008299', '#82BA00', '#D24726', '#AC193D', '#DC4FAD', '#3BD5FB', '#74E8D3', '#FFCC00', '#FB886E', '#CCCCCC'];
|
|
2201
2173
|
|
|
2202
|
-
|
|
2203
|
-
return typeof color !== 'string';
|
|
2204
|
-
};
|
|
2174
|
+
const _isNamedColor = color => typeof color !== 'string';
|
|
2205
2175
|
|
|
2206
|
-
|
|
2207
|
-
|
|
2176
|
+
const _getColor = (colorList, colorIndex) => {
|
|
2177
|
+
const index = colorIndex >= colorList.length ? 0 : colorIndex;
|
|
2208
2178
|
return colorList[index];
|
|
2209
2179
|
};
|
|
2210
2180
|
|
|
2211
|
-
function ColorPicker(
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
colorList = _ref$colorList === void 0 ? COLORS : _ref$colorList;
|
|
2181
|
+
function ColorPicker({
|
|
2182
|
+
color = 0,
|
|
2183
|
+
small,
|
|
2184
|
+
onChange,
|
|
2185
|
+
colorList = COLORS
|
|
2186
|
+
}) {
|
|
2218
2187
|
return /*#__PURE__*/React__default.createElement(Dropdown.Box, {
|
|
2219
2188
|
right: true,
|
|
2220
2189
|
className: "reactist_color_picker"
|
|
2221
|
-
}, /*#__PURE__*/React__default.createElement(Dropdown.Trigger, null,
|
|
2222
|
-
|
|
2190
|
+
}, /*#__PURE__*/React__default.createElement(Dropdown.Trigger, null, (() => {
|
|
2191
|
+
const backgroundColor = _getColor(colorList, color);
|
|
2223
2192
|
|
|
2224
2193
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
2225
2194
|
className: classNames('color_trigger', {
|
|
2226
|
-
small
|
|
2195
|
+
small
|
|
2227
2196
|
}),
|
|
2228
2197
|
style: {
|
|
2229
2198
|
backgroundColor: _isNamedColor(backgroundColor) ? backgroundColor.color : backgroundColor
|
|
@@ -2231,9 +2200,9 @@ function ColorPicker(_ref) {
|
|
|
2231
2200
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
2232
2201
|
className: "color_trigger--inner_ring"
|
|
2233
2202
|
}));
|
|
2234
|
-
}()), /*#__PURE__*/React__default.createElement(Dropdown.Body, null, /*#__PURE__*/React__default.createElement("div", {
|
|
2203
|
+
})()), /*#__PURE__*/React__default.createElement(Dropdown.Body, null, /*#__PURE__*/React__default.createElement("div", {
|
|
2235
2204
|
className: "color_options"
|
|
2236
|
-
}, colorList.reduce(
|
|
2205
|
+
}, colorList.reduce((items, currentColor, currentIndex) => {
|
|
2237
2206
|
items.push( /*#__PURE__*/React__default.createElement(ColorItem, {
|
|
2238
2207
|
isActive: color >= colorList.length ? currentIndex === 0 : currentIndex === color,
|
|
2239
2208
|
key: currentIndex,
|
|
@@ -2248,20 +2217,19 @@ function ColorPicker(_ref) {
|
|
|
2248
2217
|
|
|
2249
2218
|
ColorPicker.displayName = 'ColorPicker';
|
|
2250
2219
|
|
|
2251
|
-
function ColorItem(
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2220
|
+
function ColorItem({
|
|
2221
|
+
color,
|
|
2222
|
+
colorIndex,
|
|
2223
|
+
isActive,
|
|
2224
|
+
onClick,
|
|
2225
|
+
tooltip
|
|
2226
|
+
}) {
|
|
2227
|
+
const item = /*#__PURE__*/React__default.createElement("span", {
|
|
2258
2228
|
className: 'reactist color_item' + (isActive ? ' active' : ''),
|
|
2259
2229
|
style: {
|
|
2260
2230
|
backgroundColor: color
|
|
2261
2231
|
},
|
|
2262
|
-
onClick:
|
|
2263
|
-
return _onClick === null || _onClick === void 0 ? void 0 : _onClick(colorIndex);
|
|
2264
|
-
}
|
|
2232
|
+
onClick: () => onClick == null ? void 0 : onClick(colorIndex)
|
|
2265
2233
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
2266
2234
|
className: "color_item--inner_ring"
|
|
2267
2235
|
}));
|
|
@@ -2272,24 +2240,22 @@ function ColorItem(_ref2) {
|
|
|
2272
2240
|
|
|
2273
2241
|
ColorItem.displayName = 'ColorItem';
|
|
2274
2242
|
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
return /*#__PURE__*/React__default.createElement("input",
|
|
2243
|
+
const Input = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
2244
|
+
const className = classNames('reactist_input', props.className);
|
|
2245
|
+
return /*#__PURE__*/React__default.createElement("input", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2278
2246
|
className: className,
|
|
2279
2247
|
ref: ref
|
|
2280
2248
|
}));
|
|
2281
2249
|
});
|
|
2282
2250
|
Input.displayName = 'Input';
|
|
2283
2251
|
|
|
2284
|
-
|
|
2252
|
+
const _excluded$r = ["children", "className", "translateKey", "isMac"];
|
|
2285
2253
|
// Support for setting up how to translate modifiers globally.
|
|
2286
2254
|
//
|
|
2287
2255
|
|
|
2288
|
-
|
|
2289
|
-
return key;
|
|
2290
|
-
};
|
|
2256
|
+
let globalTranslateKey = key => key;
|
|
2291
2257
|
|
|
2292
|
-
KeyboardShortcut.setTranslateKey =
|
|
2258
|
+
KeyboardShortcut.setTranslateKey = tr => {
|
|
2293
2259
|
globalTranslateKey = tr;
|
|
2294
2260
|
};
|
|
2295
2261
|
|
|
@@ -2333,9 +2299,9 @@ function isSpecialKey(str) {
|
|
|
2333
2299
|
}
|
|
2334
2300
|
|
|
2335
2301
|
function parseKeys(shortcut, isMac, translateKey) {
|
|
2336
|
-
|
|
2302
|
+
const t = isMac ? translateKeyMac : translateKey;
|
|
2337
2303
|
|
|
2338
|
-
|
|
2304
|
+
const _hasModifiers = hasModifiers(shortcut);
|
|
2339
2305
|
|
|
2340
2306
|
function mapIndividualKey(str) {
|
|
2341
2307
|
if (isSpecialKey(str)) {
|
|
@@ -2359,31 +2325,27 @@ function parseKeys(shortcut, isMac, translateKey) {
|
|
|
2359
2325
|
function KeyboardShortcut(_ref) {
|
|
2360
2326
|
var _navigator$platform$t, _navigator$platform;
|
|
2361
2327
|
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
props =
|
|
2328
|
+
let {
|
|
2329
|
+
children,
|
|
2330
|
+
className,
|
|
2331
|
+
translateKey = globalTranslateKey,
|
|
2332
|
+
isMac = (_navigator$platform$t = (_navigator$platform = navigator.platform) == null ? void 0 : _navigator$platform.toUpperCase().includes('MAC')) != null ? _navigator$platform$t : false
|
|
2333
|
+
} = _ref,
|
|
2334
|
+
props = _objectWithoutProperties(_ref, _excluded$r);
|
|
2369
2335
|
|
|
2370
|
-
|
|
2371
|
-
return /*#__PURE__*/React.createElement("span",
|
|
2336
|
+
const shortcuts = typeof children === 'string' ? [children] : children;
|
|
2337
|
+
return /*#__PURE__*/React.createElement("span", _objectSpread2({
|
|
2372
2338
|
className: classNames('reactist_keyboard_shortcut', className, {
|
|
2373
2339
|
'reactist_keyboard_shortcut--macos': isMac
|
|
2374
2340
|
})
|
|
2375
|
-
}, props), shortcuts.map(
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
key: j
|
|
2381
|
-
}, key);
|
|
2382
|
-
})));
|
|
2383
|
-
}));
|
|
2341
|
+
}, props), shortcuts.map((shortcut, i) => /*#__PURE__*/React.createElement(React.Fragment, {
|
|
2342
|
+
key: i
|
|
2343
|
+
}, i === 0 ? null : ', ', /*#__PURE__*/React.createElement("kbd", null, parseKeys(shortcut, isMac, translateKey).map((key, j) => /*#__PURE__*/React.createElement("kbd", {
|
|
2344
|
+
key: j
|
|
2345
|
+
}, key))))));
|
|
2384
2346
|
}
|
|
2385
2347
|
|
|
2386
|
-
|
|
2348
|
+
const SUPPORTED_KEYS = {
|
|
2387
2349
|
ARROW_UP: 'ArrowUp',
|
|
2388
2350
|
ARROW_RIGHT: 'ArrowRight',
|
|
2389
2351
|
ARROW_DOWN: 'ArrowDown',
|
|
@@ -2392,8 +2354,8 @@ var SUPPORTED_KEYS = {
|
|
|
2392
2354
|
BACKSPACE: 'Backspace',
|
|
2393
2355
|
ESCAPE: 'Escape'
|
|
2394
2356
|
};
|
|
2395
|
-
|
|
2396
|
-
resolveByKey
|
|
2357
|
+
const KeyCapturerResolver = {
|
|
2358
|
+
resolveByKey(eventKey) {
|
|
2397
2359
|
switch (eventKey) {
|
|
2398
2360
|
case 'Left': // IE specific
|
|
2399
2361
|
|
|
@@ -2446,7 +2408,8 @@ var KeyCapturerResolver = {
|
|
|
2446
2408
|
}
|
|
2447
2409
|
}
|
|
2448
2410
|
},
|
|
2449
|
-
|
|
2411
|
+
|
|
2412
|
+
resolveByKeyCode(keyCode) {
|
|
2450
2413
|
switch (keyCode) {
|
|
2451
2414
|
case 37:
|
|
2452
2415
|
{
|
|
@@ -2489,8 +2452,9 @@ var KeyCapturerResolver = {
|
|
|
2489
2452
|
}
|
|
2490
2453
|
}
|
|
2491
2454
|
}
|
|
2455
|
+
|
|
2492
2456
|
};
|
|
2493
|
-
|
|
2457
|
+
const keyEventHandlerMapping = {
|
|
2494
2458
|
ArrowUp: 'onArrowUp',
|
|
2495
2459
|
ArrowDown: 'onArrowDown',
|
|
2496
2460
|
ArrowLeft: 'onArrowLeft',
|
|
@@ -2499,7 +2463,7 @@ var keyEventHandlerMapping = {
|
|
|
2499
2463
|
Backspace: 'onBackspace',
|
|
2500
2464
|
Escape: 'onEscape'
|
|
2501
2465
|
};
|
|
2502
|
-
|
|
2466
|
+
const keyPropagatePropMapping = {
|
|
2503
2467
|
ArrowUp: 'propagateArrowUp',
|
|
2504
2468
|
ArrowDown: 'propagateArrowDown',
|
|
2505
2469
|
ArrowLeft: 'propagateArrowLeft',
|
|
@@ -2518,27 +2482,26 @@ var keyPropagatePropMapping = {
|
|
|
2518
2482
|
*/
|
|
2519
2483
|
|
|
2520
2484
|
function KeyCapturer(props) {
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
onCompositionStart: function onCompositionStart() {
|
|
2485
|
+
const {
|
|
2486
|
+
children,
|
|
2487
|
+
eventName = 'onKeyDown'
|
|
2488
|
+
} = props;
|
|
2489
|
+
const composingRef = React.useRef(false);
|
|
2490
|
+
const composingEventHandlers = props.onEnter ? {
|
|
2491
|
+
onCompositionStart: () => {
|
|
2529
2492
|
composingRef.current = true;
|
|
2530
2493
|
},
|
|
2531
|
-
onCompositionEnd:
|
|
2494
|
+
onCompositionEnd: () => {
|
|
2532
2495
|
composingRef.current = false;
|
|
2533
2496
|
}
|
|
2534
2497
|
} : undefined;
|
|
2535
2498
|
|
|
2536
2499
|
function handleKeyEvent(event) {
|
|
2537
2500
|
// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
|
|
2538
|
-
|
|
2501
|
+
const key = event.key !== undefined ? KeyCapturerResolver.resolveByKey(event.key) : KeyCapturerResolver.resolveByKeyCode(event.keyCode);
|
|
2539
2502
|
if (!key) return;
|
|
2540
|
-
|
|
2541
|
-
|
|
2503
|
+
const propagateEvent = props[keyPropagatePropMapping[key]] || false;
|
|
2504
|
+
const eventHandler = props[keyEventHandlerMapping[key]];
|
|
2542
2505
|
|
|
2543
2506
|
if (key === 'Enter' && eventHandler) {
|
|
2544
2507
|
if (composingRef.current || // Safari fires the onCompositionEnd event before the keydown event, so we
|
|
@@ -2559,29 +2522,35 @@ function KeyCapturer(props) {
|
|
|
2559
2522
|
}
|
|
2560
2523
|
}
|
|
2561
2524
|
|
|
2562
|
-
return /*#__PURE__*/React__default.cloneElement(children, _objectSpread2(
|
|
2525
|
+
return /*#__PURE__*/React__default.cloneElement(children, _objectSpread2({
|
|
2526
|
+
[eventName]: handleKeyEvent
|
|
2527
|
+
}, composingEventHandlers));
|
|
2563
2528
|
}
|
|
2564
2529
|
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2530
|
+
const hasEnoughSpace = (windowDimensions, elementDimensions, wrapperDimensions, wrapperPosition, position, gap = 0) => {
|
|
2531
|
+
const {
|
|
2532
|
+
height: windowHeight,
|
|
2533
|
+
width: windowWidth
|
|
2534
|
+
} = windowDimensions;
|
|
2535
|
+
const {
|
|
2536
|
+
height: elementHeight,
|
|
2537
|
+
width: elementWidth
|
|
2538
|
+
} = elementDimensions;
|
|
2539
|
+
const {
|
|
2540
|
+
height: wrapperHeight,
|
|
2541
|
+
width: wrapperWidth
|
|
2542
|
+
} = wrapperDimensions;
|
|
2543
|
+
const {
|
|
2544
|
+
x: wrapperX,
|
|
2545
|
+
y: wrapperY
|
|
2546
|
+
} = wrapperPosition;
|
|
2578
2547
|
|
|
2579
|
-
|
|
2548
|
+
const verticalPosition = _calculateVerticalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
|
|
2580
2549
|
|
|
2581
|
-
|
|
2550
|
+
const horizontalPosition = _calculateHorizontalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
|
|
2582
2551
|
|
|
2583
|
-
|
|
2584
|
-
|
|
2552
|
+
const canPlaceVertically = verticalPosition >= 0 && verticalPosition + elementWidth <= windowWidth;
|
|
2553
|
+
const canPlaceHorizontally = horizontalPosition >= 0 && horizontalPosition + elementHeight <= windowHeight;
|
|
2585
2554
|
|
|
2586
2555
|
if (position === 'top') {
|
|
2587
2556
|
return canPlaceVertically && wrapperY - elementHeight - gap >= 0;
|
|
@@ -2596,77 +2565,57 @@ var hasEnoughSpace = function hasEnoughSpace(windowDimensions, elementDimensions
|
|
|
2596
2565
|
return false;
|
|
2597
2566
|
};
|
|
2598
2567
|
|
|
2599
|
-
|
|
2568
|
+
function _calculateVerticalPosition(wrapperPosition, wrapperDimensions, elementDimensions) {
|
|
2600
2569
|
return wrapperPosition.x + (wrapperDimensions.width - elementDimensions.width) / 2;
|
|
2601
|
-
}
|
|
2570
|
+
}
|
|
2602
2571
|
|
|
2603
|
-
|
|
2572
|
+
function _calculateHorizontalPosition(wrapperPosition, wrapperDimensions, elementDimensions) {
|
|
2604
2573
|
return wrapperPosition.y + (wrapperDimensions.height - elementDimensions.height) / 2;
|
|
2605
|
-
}
|
|
2606
|
-
|
|
2607
|
-
var calculateTopCenterPosition = function calculateTopCenterPosition(wrapperDimensions, wrapperPosition, elementDimensions, gap) {
|
|
2608
|
-
if (gap === void 0) {
|
|
2609
|
-
gap = 0;
|
|
2610
|
-
}
|
|
2574
|
+
}
|
|
2611
2575
|
|
|
2612
|
-
|
|
2576
|
+
const calculateTopCenterPosition = (wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
|
|
2577
|
+
const x = _calculateVerticalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
|
|
2613
2578
|
|
|
2614
|
-
|
|
2579
|
+
const y = wrapperPosition.y - elementDimensions.height - gap;
|
|
2615
2580
|
return {
|
|
2616
|
-
x
|
|
2617
|
-
y
|
|
2581
|
+
x,
|
|
2582
|
+
y
|
|
2618
2583
|
};
|
|
2619
2584
|
};
|
|
2620
2585
|
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
gap = 0;
|
|
2624
|
-
}
|
|
2625
|
-
|
|
2626
|
-
var x = _calculateVerticalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
|
|
2586
|
+
const calculateBottomCenterPosition = (wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
|
|
2587
|
+
const x = _calculateVerticalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
|
|
2627
2588
|
|
|
2628
|
-
|
|
2589
|
+
const y = wrapperPosition.y + wrapperDimensions.height + gap;
|
|
2629
2590
|
return {
|
|
2630
|
-
x
|
|
2631
|
-
y
|
|
2591
|
+
x,
|
|
2592
|
+
y
|
|
2632
2593
|
};
|
|
2633
2594
|
};
|
|
2634
2595
|
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
gap = 0;
|
|
2638
|
-
}
|
|
2639
|
-
|
|
2640
|
-
var x = wrapperPosition.x + wrapperDimensions.width + gap;
|
|
2596
|
+
const calculateRightCenterPosition = (wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
|
|
2597
|
+
const x = wrapperPosition.x + wrapperDimensions.width + gap;
|
|
2641
2598
|
|
|
2642
|
-
|
|
2599
|
+
const y = _calculateHorizontalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
|
|
2643
2600
|
|
|
2644
2601
|
return {
|
|
2645
|
-
x
|
|
2646
|
-
y
|
|
2602
|
+
x,
|
|
2603
|
+
y
|
|
2647
2604
|
};
|
|
2648
2605
|
};
|
|
2649
2606
|
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
gap = 0;
|
|
2653
|
-
}
|
|
2654
|
-
|
|
2655
|
-
var x = wrapperPosition.x - elementDimensions.width - gap;
|
|
2607
|
+
const calculateLeftCenterPosition = (wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
|
|
2608
|
+
const x = wrapperPosition.x - elementDimensions.width - gap;
|
|
2656
2609
|
|
|
2657
|
-
|
|
2610
|
+
const y = _calculateHorizontalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
|
|
2658
2611
|
|
|
2659
2612
|
return {
|
|
2660
|
-
x
|
|
2661
|
-
y
|
|
2613
|
+
x,
|
|
2614
|
+
y
|
|
2662
2615
|
};
|
|
2663
2616
|
};
|
|
2664
2617
|
|
|
2665
|
-
|
|
2666
|
-
if (gap === void 0) {
|
|
2667
|
-
gap = 0;
|
|
2668
|
-
}
|
|
2669
|
-
|
|
2618
|
+
const calculatePosition = (position, wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
|
|
2670
2619
|
if (position === 'top') {
|
|
2671
2620
|
return calculateTopCenterPosition(wrapperDimensions, wrapperPosition, elementDimensions, gap);
|
|
2672
2621
|
} else if (position === 'right') {
|
|
@@ -2680,72 +2629,67 @@ var calculatePosition = function calculatePosition(position, wrapperDimensions,
|
|
|
2680
2629
|
return wrapperPosition;
|
|
2681
2630
|
};
|
|
2682
2631
|
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
var documentEl = document.documentElement;
|
|
2703
|
-
var node = _this.wrapper;
|
|
2704
|
-
var foundParent = false;
|
|
2632
|
+
class Popover extends React__default.Component {
|
|
2633
|
+
constructor(...args) {
|
|
2634
|
+
super(...args);
|
|
2635
|
+
this.popover = void 0;
|
|
2636
|
+
this.wrapper = void 0;
|
|
2637
|
+
|
|
2638
|
+
this._updatePopoverPosition = () => {
|
|
2639
|
+
const {
|
|
2640
|
+
position,
|
|
2641
|
+
allowVaguePositioning,
|
|
2642
|
+
gapSize
|
|
2643
|
+
} = this.props;
|
|
2644
|
+
const wrapperRect = this.wrapper.getBoundingClientRect();
|
|
2645
|
+
const popoverRect = this.popover.getBoundingClientRect(); // Instead of using the documentElement find the nearest absolutely positioned element
|
|
2646
|
+
|
|
2647
|
+
const documentEl = document.documentElement;
|
|
2648
|
+
let node = this.wrapper;
|
|
2649
|
+
let foundParent = false;
|
|
2705
2650
|
|
|
2706
2651
|
while (!foundParent) {
|
|
2707
|
-
|
|
2652
|
+
const styles = getComputedStyle(node);
|
|
2653
|
+
const position = styles.getPropertyValue('position');
|
|
2708
2654
|
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
if (_position === 'absolute' || node === documentEl || !node.parentElement) {
|
|
2655
|
+
if (position === 'absolute' || node === documentEl || !node.parentElement) {
|
|
2712
2656
|
foundParent = true;
|
|
2713
2657
|
} else {
|
|
2714
2658
|
node = node.parentElement;
|
|
2715
2659
|
}
|
|
2716
2660
|
}
|
|
2717
2661
|
|
|
2718
|
-
|
|
2719
|
-
|
|
2662
|
+
const nodeRect = node.getBoundingClientRect();
|
|
2663
|
+
const windowDimensions = {
|
|
2720
2664
|
height: nodeRect.height,
|
|
2721
2665
|
width: nodeRect.width
|
|
2722
2666
|
};
|
|
2723
|
-
|
|
2667
|
+
const popoverDimensions = {
|
|
2724
2668
|
height: popoverRect.height,
|
|
2725
2669
|
width: popoverRect.width
|
|
2726
2670
|
};
|
|
2727
|
-
|
|
2671
|
+
const wrapperDimensions = {
|
|
2728
2672
|
height: wrapperRect.height,
|
|
2729
2673
|
width: wrapperRect.width
|
|
2730
2674
|
};
|
|
2731
|
-
|
|
2675
|
+
const wrapperPositionRelative = {
|
|
2732
2676
|
x: wrapperRect.left - nodeRect.left,
|
|
2733
2677
|
y: wrapperRect.top - nodeRect.top
|
|
2734
2678
|
};
|
|
2735
|
-
|
|
2679
|
+
const wrapperPositionAbsolute = {
|
|
2736
2680
|
x: wrapperRect.left,
|
|
2737
2681
|
y: wrapperRect.top
|
|
2738
2682
|
};
|
|
2739
|
-
|
|
2683
|
+
const positionsToTry = position === 'auto' ? ['top', 'right', 'bottom', 'left', 'top'] : position === 'vertical' ? ['top', 'bottom'] : position === 'horizontal' ? ['left', 'right'] : [position];
|
|
2740
2684
|
|
|
2741
|
-
for (
|
|
2742
|
-
|
|
2743
|
-
|
|
2685
|
+
for (let index = 0; index < positionsToTry.length; index++) {
|
|
2686
|
+
const currentPosition = positionsToTry[index];
|
|
2687
|
+
const enoughSpaceAtPosition = currentPosition != null ? hasEnoughSpace(windowDimensions, popoverDimensions, wrapperDimensions, wrapperPositionRelative, currentPosition, gapSize) : false;
|
|
2744
2688
|
|
|
2745
2689
|
if (enoughSpaceAtPosition || index === positionsToTry.length - 1) {
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2690
|
+
const popoverPosition = currentPosition != null ? calculatePosition(currentPosition, wrapperDimensions, wrapperPositionAbsolute, popoverDimensions, gapSize) : wrapperPositionAbsolute;
|
|
2691
|
+
this.popover.style.top = popoverPosition.y + "px";
|
|
2692
|
+
this.popover.style.left = popoverPosition.x + "px";
|
|
2749
2693
|
/**
|
|
2750
2694
|
* Correct placement if vague positioning is allowed.
|
|
2751
2695
|
* When it's not allowed we "cut off" popovers and display them
|
|
@@ -2755,17 +2699,17 @@ var Popover = /*#__PURE__*/function (_React$Component) {
|
|
|
2755
2699
|
if (allowVaguePositioning) {
|
|
2756
2700
|
// correct horizontally
|
|
2757
2701
|
if (popoverPosition.x < 0) {
|
|
2758
|
-
|
|
2702
|
+
this.popover.style.left = 2 * gapSize + "px";
|
|
2759
2703
|
} // correct vertically
|
|
2760
2704
|
|
|
2761
2705
|
|
|
2762
2706
|
if (popoverPosition.y + popoverDimensions.height > windowDimensions.height) {
|
|
2763
|
-
|
|
2707
|
+
this.popover.style.top = windowDimensions.height - popoverDimensions.height - 2 * gapSize + "px";
|
|
2764
2708
|
}
|
|
2765
2709
|
}
|
|
2766
2710
|
|
|
2767
2711
|
if (currentPosition !== position) {
|
|
2768
|
-
|
|
2712
|
+
this.popover.className = this._getClassNameForPosition(currentPosition);
|
|
2769
2713
|
}
|
|
2770
2714
|
|
|
2771
2715
|
break;
|
|
@@ -2773,13 +2717,14 @@ var Popover = /*#__PURE__*/function (_React$Component) {
|
|
|
2773
2717
|
}
|
|
2774
2718
|
};
|
|
2775
2719
|
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2720
|
+
this._getClassNameForPosition = position => {
|
|
2721
|
+
const {
|
|
2722
|
+
visible,
|
|
2723
|
+
withArrow,
|
|
2724
|
+
arrowClassName
|
|
2725
|
+
} = this.props;
|
|
2726
|
+
const className = classNames('reactist_popover', {
|
|
2727
|
+
visible
|
|
2783
2728
|
});
|
|
2784
2729
|
|
|
2785
2730
|
if (visible && withArrow) {
|
|
@@ -2794,62 +2739,59 @@ var Popover = /*#__PURE__*/function (_React$Component) {
|
|
|
2794
2739
|
return className;
|
|
2795
2740
|
};
|
|
2796
2741
|
|
|
2797
|
-
|
|
2798
|
-
|
|
2742
|
+
this._updatePopoverRef = popover => {
|
|
2743
|
+
this.popover = popover;
|
|
2799
2744
|
|
|
2800
|
-
if (typeof
|
|
2801
|
-
|
|
2745
|
+
if (typeof this.props.popoverRef === 'function') {
|
|
2746
|
+
this.props.popoverRef(popover);
|
|
2802
2747
|
}
|
|
2803
2748
|
};
|
|
2804
2749
|
|
|
2805
|
-
|
|
2806
|
-
|
|
2750
|
+
this._updateWrapperRef = wrapper => {
|
|
2751
|
+
this.wrapper = wrapper;
|
|
2807
2752
|
|
|
2808
|
-
if (typeof
|
|
2809
|
-
|
|
2753
|
+
if (typeof this.props.wrapperRef === 'function') {
|
|
2754
|
+
this.props.wrapperRef(wrapper);
|
|
2810
2755
|
}
|
|
2811
2756
|
};
|
|
2812
|
-
|
|
2813
|
-
return _this;
|
|
2814
2757
|
}
|
|
2815
2758
|
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
2759
|
+
componentDidMount() {
|
|
2819
2760
|
if (this.props.visible) {
|
|
2820
2761
|
this._updatePopoverPosition();
|
|
2821
2762
|
}
|
|
2822
|
-
}
|
|
2763
|
+
}
|
|
2823
2764
|
|
|
2824
|
-
|
|
2765
|
+
componentDidUpdate(prevProps) {
|
|
2825
2766
|
if (this.wrapper && this.props.visible) {
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2767
|
+
const positionChanged = prevProps.position !== this.props.position;
|
|
2768
|
+
const vaguePositioningChanged = prevProps.allowVaguePositioning !== this.props.allowVaguePositioning;
|
|
2769
|
+
const visibilityChanged = prevProps.visible !== this.props.visible;
|
|
2770
|
+
const arrowChanged = prevProps.withArrow !== this.props.withArrow;
|
|
2771
|
+
const gapSizeChanged = prevProps.gapSize !== this.props.gapSize;
|
|
2772
|
+
const contentChanged = prevProps.content !== this.props.content;
|
|
2832
2773
|
|
|
2833
2774
|
if (positionChanged || vaguePositioningChanged || visibilityChanged || arrowChanged || gapSizeChanged || contentChanged) {
|
|
2834
2775
|
this._updatePopoverPosition();
|
|
2835
2776
|
}
|
|
2836
2777
|
}
|
|
2837
|
-
}
|
|
2778
|
+
}
|
|
2838
2779
|
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2780
|
+
render() {
|
|
2781
|
+
const {
|
|
2782
|
+
position,
|
|
2783
|
+
wrapperClassName,
|
|
2784
|
+
popoverClassName,
|
|
2785
|
+
onMouseEnter,
|
|
2786
|
+
onMouseLeave,
|
|
2787
|
+
onClick,
|
|
2788
|
+
trigger,
|
|
2789
|
+
content
|
|
2790
|
+
} = this.props;
|
|
2791
|
+
const popoverClass = position ? this._getClassNameForPosition(position) : '';
|
|
2792
|
+
const popoverContentClass = classNames('reactist_popover__content', popoverClassName);
|
|
2793
|
+
const wrapperClass = classNames('reactist_popover__wrapper', wrapperClassName);
|
|
2794
|
+
const triggerElement = React__default.Children.only(trigger);
|
|
2853
2795
|
|
|
2854
2796
|
function handleTriggerClick(event) {
|
|
2855
2797
|
// @ts-expect-error This is temporary while we revisit the Popover interface
|
|
@@ -2874,24 +2816,26 @@ var Popover = /*#__PURE__*/function (_React$Component) {
|
|
|
2874
2816
|
}, this.props.visible ? /*#__PURE__*/React__default.createElement("span", {
|
|
2875
2817
|
className: popoverContentClass
|
|
2876
2818
|
}, typeof content === 'function' ? content() : content) : null));
|
|
2877
|
-
}
|
|
2819
|
+
}
|
|
2878
2820
|
|
|
2879
|
-
|
|
2880
|
-
}(React__default.Component);
|
|
2821
|
+
}
|
|
2881
2822
|
|
|
2823
|
+
Popover.displayName = void 0;
|
|
2824
|
+
Popover.defaultProps = void 0;
|
|
2882
2825
|
Popover.displayName = 'Popover';
|
|
2883
2826
|
Popover.defaultProps = {
|
|
2884
2827
|
position: 'auto',
|
|
2885
|
-
gapSize: 5
|
|
2828
|
+
gapSize: 5 // default size of the arrow (see `tooltip.less`)
|
|
2829
|
+
|
|
2886
2830
|
};
|
|
2887
2831
|
|
|
2888
|
-
function ProgressBar(
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2832
|
+
function ProgressBar({
|
|
2833
|
+
fillPercentage = 0,
|
|
2834
|
+
className,
|
|
2835
|
+
'aria-valuetext': ariaValuetext
|
|
2836
|
+
}) {
|
|
2837
|
+
const finalClassName = classNames('reactist_progress_bar', className);
|
|
2838
|
+
const width = fillPercentage < 0 ? 0 : fillPercentage > 100 ? 100 : fillPercentage;
|
|
2895
2839
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2896
2840
|
className: finalClassName
|
|
2897
2841
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -2902,44 +2846,39 @@ function ProgressBar(_ref) {
|
|
|
2902
2846
|
}), /*#__PURE__*/React__default.createElement(HiddenVisually, null, /*#__PURE__*/React__default.createElement("progress", {
|
|
2903
2847
|
value: width,
|
|
2904
2848
|
max: 100,
|
|
2905
|
-
"aria-valuetext": ariaValuetext
|
|
2849
|
+
"aria-valuetext": ariaValuetext != null ? ariaValuetext : undefined
|
|
2906
2850
|
})));
|
|
2907
2851
|
}
|
|
2908
2852
|
|
|
2909
2853
|
ProgressBar.displayName = 'ProgressBar';
|
|
2910
2854
|
|
|
2911
|
-
|
|
2855
|
+
const _excluded$s = ["value", "options", "onChange", "disabled", "className", "defaultValue"];
|
|
2912
2856
|
|
|
2913
2857
|
function Select(_ref) {
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
disabled: disabled
|
|
2858
|
+
let {
|
|
2859
|
+
value,
|
|
2860
|
+
options = [],
|
|
2861
|
+
onChange,
|
|
2862
|
+
disabled = true,
|
|
2863
|
+
className = '',
|
|
2864
|
+
defaultValue
|
|
2865
|
+
} = _ref,
|
|
2866
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$s);
|
|
2867
|
+
|
|
2868
|
+
const selectClassName = classNames('reactist_select', {
|
|
2869
|
+
disabled
|
|
2927
2870
|
}, className);
|
|
2928
|
-
return /*#__PURE__*/React__default.createElement("select",
|
|
2871
|
+
return /*#__PURE__*/React__default.createElement("select", _objectSpread2({
|
|
2929
2872
|
className: selectClassName,
|
|
2930
2873
|
value: value,
|
|
2931
|
-
onChange:
|
|
2932
|
-
return _onChange ? _onChange(event.target.value) : undefined;
|
|
2933
|
-
},
|
|
2874
|
+
onChange: event => onChange ? onChange(event.target.value) : undefined,
|
|
2934
2875
|
disabled: disabled,
|
|
2935
2876
|
defaultValue: defaultValue
|
|
2936
|
-
}, otherProps), options
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
}, option.text);
|
|
2942
|
-
}));
|
|
2877
|
+
}, otherProps), options == null ? void 0 : options.map(option => /*#__PURE__*/React__default.createElement("option", {
|
|
2878
|
+
key: option.key || option.value,
|
|
2879
|
+
value: option.value,
|
|
2880
|
+
disabled: option.disabled
|
|
2881
|
+
}, option.text)));
|
|
2943
2882
|
}
|
|
2944
2883
|
|
|
2945
2884
|
Select.displayName = 'Select';
|
|
@@ -2949,36 +2888,27 @@ Select.defaultProps = {
|
|
|
2949
2888
|
};
|
|
2950
2889
|
|
|
2951
2890
|
dayjs.extend(LocalizedFormat);
|
|
2952
|
-
|
|
2891
|
+
const TimeUtils = {
|
|
2953
2892
|
SHORT_FORMAT_CURRENT_YEAR: 'L',
|
|
2954
2893
|
SHORT_FORMAT_PAST_YEAR: 'LL',
|
|
2955
2894
|
LONG_FORMAT: 'LL, LT',
|
|
2956
|
-
timeAgo: function timeAgo(timestamp, config) {
|
|
2957
|
-
if (config === void 0) {
|
|
2958
|
-
config = {};
|
|
2959
|
-
}
|
|
2960
2895
|
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
minutesSuffix = _config$minutesSuffix === void 0 ? 'm' : _config$minutesSuffix,
|
|
2974
|
-
_config$momentsAgo = _config.momentsAgo,
|
|
2975
|
-
momentsAgo = _config$momentsAgo === void 0 ? 'moments ago' : _config$momentsAgo;
|
|
2976
|
-
var now = dayjs();
|
|
2977
|
-
var date = dayjs(timestamp * 1000);
|
|
2896
|
+
timeAgo(timestamp, config = {}) {
|
|
2897
|
+
const {
|
|
2898
|
+
locale = 'en',
|
|
2899
|
+
shortFormatCurrentYear = this.SHORT_FORMAT_CURRENT_YEAR,
|
|
2900
|
+
shortFormatPastYear = this.SHORT_FORMAT_PAST_YEAR,
|
|
2901
|
+
daysSuffix = 'd',
|
|
2902
|
+
hoursSuffix = 'h',
|
|
2903
|
+
minutesSuffix = 'm',
|
|
2904
|
+
momentsAgo = 'moments ago'
|
|
2905
|
+
} = config;
|
|
2906
|
+
const now = dayjs();
|
|
2907
|
+
const date = dayjs(timestamp * 1000);
|
|
2978
2908
|
date.locale(locale);
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2909
|
+
const diffMinutes = now.diff(date, 'minute');
|
|
2910
|
+
const diffHours = now.diff(date, 'hour');
|
|
2911
|
+
const diffDays = now.diff(date, 'day');
|
|
2982
2912
|
|
|
2983
2913
|
if (diffDays > 1) {
|
|
2984
2914
|
if (date.isSame(now, 'year')) {
|
|
@@ -2996,19 +2926,14 @@ var TimeUtils = {
|
|
|
2996
2926
|
return momentsAgo;
|
|
2997
2927
|
}
|
|
2998
2928
|
},
|
|
2999
|
-
formatTime: function formatTime(timestamp, config) {
|
|
3000
|
-
if (config === void 0) {
|
|
3001
|
-
config = {};
|
|
3002
|
-
}
|
|
3003
2929
|
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
var date = dayjs(timestamp * 1000);
|
|
2930
|
+
formatTime(timestamp, config = {}) {
|
|
2931
|
+
const {
|
|
2932
|
+
locale = 'en',
|
|
2933
|
+
shortFormatCurrentYear = this.SHORT_FORMAT_CURRENT_YEAR,
|
|
2934
|
+
shortFormatPastYear = this.SHORT_FORMAT_PAST_YEAR
|
|
2935
|
+
} = config;
|
|
2936
|
+
const date = dayjs(timestamp * 1000);
|
|
3012
2937
|
date.locale(locale);
|
|
3013
2938
|
|
|
3014
2939
|
if (date.isSame(dayjs(), 'year')) {
|
|
@@ -3017,49 +2942,40 @@ var TimeUtils = {
|
|
|
3017
2942
|
return date.format(shortFormatPastYear);
|
|
3018
2943
|
}
|
|
3019
2944
|
},
|
|
3020
|
-
formatTimeLong: function formatTimeLong(timestamp, config) {
|
|
3021
|
-
if (config === void 0) {
|
|
3022
|
-
config = {};
|
|
3023
|
-
}
|
|
3024
2945
|
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
2946
|
+
formatTimeLong(timestamp, config = {}) {
|
|
2947
|
+
const {
|
|
2948
|
+
locale = 'en',
|
|
2949
|
+
longFormat = this.LONG_FORMAT
|
|
2950
|
+
} = config;
|
|
2951
|
+
const date = dayjs(timestamp * 1000);
|
|
3031
2952
|
date.locale(locale);
|
|
3032
2953
|
return date.format(longFormat);
|
|
3033
2954
|
}
|
|
3034
|
-
};
|
|
3035
|
-
|
|
3036
|
-
var DELAY = 60000;
|
|
3037
2955
|
|
|
3038
|
-
|
|
3039
|
-
_inheritsLoose(Time, _React$Component);
|
|
2956
|
+
};
|
|
3040
2957
|
|
|
3041
|
-
|
|
3042
|
-
var _this;
|
|
2958
|
+
const DELAY = 60000;
|
|
3043
2959
|
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
2960
|
+
class Time extends React__default.Component {
|
|
2961
|
+
constructor(props) {
|
|
2962
|
+
super(props);
|
|
2963
|
+
this.refreshInterval = void 0;
|
|
2964
|
+
this.refreshInterval = undefined;
|
|
2965
|
+
this.state = {
|
|
3047
2966
|
hovered: false,
|
|
3048
2967
|
mouseX: undefined,
|
|
3049
2968
|
mouseY: undefined
|
|
3050
2969
|
};
|
|
3051
|
-
return _this;
|
|
3052
2970
|
}
|
|
3053
2971
|
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
2972
|
+
componentDidMount() {
|
|
3057
2973
|
if (this.props.refresh) {
|
|
3058
2974
|
this._refresh();
|
|
3059
2975
|
}
|
|
3060
|
-
}
|
|
2976
|
+
}
|
|
3061
2977
|
|
|
3062
|
-
|
|
2978
|
+
componentDidUpdate(prevProps) {
|
|
3063
2979
|
if (!prevProps.refresh && this.props.refresh) {
|
|
3064
2980
|
this._refresh();
|
|
3065
2981
|
}
|
|
@@ -3069,34 +2985,35 @@ var Time = /*#__PURE__*/function (_React$Component) {
|
|
|
3069
2985
|
clearTimeout(this.refreshInterval);
|
|
3070
2986
|
}
|
|
3071
2987
|
}
|
|
3072
|
-
}
|
|
2988
|
+
}
|
|
3073
2989
|
|
|
3074
|
-
|
|
2990
|
+
componentWillUnmount() {
|
|
3075
2991
|
if (this.refreshInterval) {
|
|
3076
2992
|
clearTimeout(this.refreshInterval);
|
|
3077
2993
|
}
|
|
3078
|
-
}
|
|
2994
|
+
}
|
|
3079
2995
|
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
2996
|
+
_setHovered(hovered, event) {
|
|
2997
|
+
const {
|
|
2998
|
+
mouseX,
|
|
2999
|
+
mouseY
|
|
3000
|
+
} = this.state;
|
|
3001
|
+
const {
|
|
3002
|
+
clientX,
|
|
3003
|
+
clientY
|
|
3004
|
+
} = event;
|
|
3086
3005
|
|
|
3087
3006
|
if (clientX !== mouseX || clientY !== mouseY) {
|
|
3088
3007
|
// mouse has moved
|
|
3089
|
-
this.setState(
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
};
|
|
3095
|
-
});
|
|
3008
|
+
this.setState(() => ({
|
|
3009
|
+
hovered,
|
|
3010
|
+
mouseX: clientX,
|
|
3011
|
+
mouseY: clientY
|
|
3012
|
+
}));
|
|
3096
3013
|
}
|
|
3097
|
-
}
|
|
3014
|
+
}
|
|
3098
3015
|
|
|
3099
|
-
|
|
3016
|
+
_renderTime(config) {
|
|
3100
3017
|
if (!this.props.time) {
|
|
3101
3018
|
return;
|
|
3102
3019
|
}
|
|
@@ -3112,43 +3029,36 @@ var Time = /*#__PURE__*/function (_React$Component) {
|
|
|
3112
3029
|
}
|
|
3113
3030
|
|
|
3114
3031
|
return TimeUtils.timeAgo(this.props.time, config);
|
|
3115
|
-
}
|
|
3116
|
-
|
|
3117
|
-
_proto._refresh = function _refresh() {
|
|
3118
|
-
var _this2 = this;
|
|
3032
|
+
}
|
|
3119
3033
|
|
|
3120
|
-
|
|
3121
|
-
|
|
3034
|
+
_refresh() {
|
|
3035
|
+
this.refreshInterval = setInterval(() => {
|
|
3036
|
+
this.forceUpdate();
|
|
3122
3037
|
}, DELAY);
|
|
3123
|
-
}
|
|
3124
|
-
|
|
3125
|
-
_proto.render = function render() {
|
|
3126
|
-
var _this3 = this;
|
|
3038
|
+
}
|
|
3127
3039
|
|
|
3128
|
-
|
|
3040
|
+
render() {
|
|
3041
|
+
let className = 'reactist_time';
|
|
3129
3042
|
|
|
3130
3043
|
if (this.props.className) {
|
|
3131
3044
|
className = this.props.className;
|
|
3132
3045
|
}
|
|
3133
3046
|
|
|
3134
|
-
|
|
3047
|
+
const timeComponent = this._renderTime(this.props.config);
|
|
3135
3048
|
|
|
3136
3049
|
return /*#__PURE__*/React__default.createElement("time", {
|
|
3137
3050
|
className: className,
|
|
3138
|
-
onMouseEnter:
|
|
3139
|
-
|
|
3140
|
-
},
|
|
3141
|
-
onMouseLeave: function onMouseLeave(event) {
|
|
3142
|
-
return _this3._setHovered(false, event);
|
|
3143
|
-
}
|
|
3051
|
+
onMouseEnter: event => this._setHovered(true, event),
|
|
3052
|
+
onMouseLeave: event => this._setHovered(false, event)
|
|
3144
3053
|
}, this.props.tooltipOnHover ? /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
3145
3054
|
content: this.props.tooltip || this.props.time && TimeUtils.formatTimeLong(this.props.time, this.props.config)
|
|
3146
3055
|
}, /*#__PURE__*/React__default.createElement("span", null, timeComponent)) : timeComponent);
|
|
3147
|
-
}
|
|
3056
|
+
}
|
|
3148
3057
|
|
|
3149
|
-
|
|
3150
|
-
}(React__default.Component);
|
|
3058
|
+
}
|
|
3151
3059
|
|
|
3060
|
+
Time.displayName = void 0;
|
|
3061
|
+
Time.defaultProps = void 0;
|
|
3152
3062
|
Time.displayName = 'Time';
|
|
3153
3063
|
Time.defaultProps = {
|
|
3154
3064
|
expandOnHover: false,
|
|
@@ -3164,67 +3074,65 @@ Time.defaultProps = {
|
|
|
3164
3074
|
}
|
|
3165
3075
|
};
|
|
3166
3076
|
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
}));
|
|
3177
|
-
};
|
|
3077
|
+
const CloseIcon$1 = () => /*#__PURE__*/React__default.createElement("svg", {
|
|
3078
|
+
width: "24",
|
|
3079
|
+
height: "24",
|
|
3080
|
+
viewBox: "0 0 24 24"
|
|
3081
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
3082
|
+
fill: "gray",
|
|
3083
|
+
fillRule: "evenodd",
|
|
3084
|
+
d: "M11.293 12L5.146 5.854a.5.5 0 1 1 .708-.708L12 11.293l6.146-6.147a.5.5 0 0 1 .708.708L12.707 12l6.147 6.146a.5.5 0 0 1-.708.708L12 12.707l-6.146 6.147a.5.5 0 0 1-.708-.708L11.293 12z"
|
|
3085
|
+
}));
|
|
3178
3086
|
|
|
3179
|
-
|
|
3087
|
+
const _excluded$t = ["id", "icon", "title", "subtitle", "children", "customCloseButton", "onClick", "onClose", "closeAltText", "className", "aria-live"];
|
|
3180
3088
|
|
|
3181
3089
|
function Notification(_ref) {
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
rest =
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3090
|
+
let {
|
|
3091
|
+
id,
|
|
3092
|
+
icon,
|
|
3093
|
+
title,
|
|
3094
|
+
subtitle,
|
|
3095
|
+
children,
|
|
3096
|
+
customCloseButton,
|
|
3097
|
+
onClick,
|
|
3098
|
+
onClose,
|
|
3099
|
+
closeAltText = 'Close',
|
|
3100
|
+
className,
|
|
3101
|
+
'aria-live': ariaLive = 'polite'
|
|
3102
|
+
} = _ref,
|
|
3103
|
+
rest = _objectWithoutProperties(_ref, _excluded$t);
|
|
3104
|
+
|
|
3105
|
+
const titleId = title ? id + "-title" : null;
|
|
3106
|
+
const titleIdAttribute = titleId ? {
|
|
3199
3107
|
id: titleId
|
|
3200
3108
|
} : null;
|
|
3201
|
-
|
|
3202
|
-
|
|
3109
|
+
const subtitleId = subtitle ? id + "-subtitle" : null;
|
|
3110
|
+
const subtitleIdAttribute = subtitleId ? {
|
|
3203
3111
|
id: subtitleId
|
|
3204
3112
|
} : null;
|
|
3205
|
-
|
|
3206
|
-
|
|
3113
|
+
const contentId = children ? id + "-content" : null;
|
|
3114
|
+
const contentIdAttribute = children ? {
|
|
3207
3115
|
id: id + "-content"
|
|
3208
3116
|
} : null;
|
|
3209
|
-
|
|
3117
|
+
const ariaLabelledBy = contentId ? {
|
|
3210
3118
|
'aria-labelledby': contentId
|
|
3211
3119
|
} : titleId ? {
|
|
3212
3120
|
'aria-labelledby': titleId
|
|
3213
3121
|
} : null;
|
|
3214
|
-
|
|
3122
|
+
const ariaDescribedBy = subtitleId && !children ? {
|
|
3215
3123
|
'aria-describedby': subtitleId
|
|
3216
3124
|
} : null;
|
|
3217
|
-
|
|
3125
|
+
const notificationContent = /*#__PURE__*/React__default.createElement("div", _objectSpread2({
|
|
3218
3126
|
className: "reactist-notification__content"
|
|
3219
|
-
}, contentIdAttribute), children
|
|
3127
|
+
}, contentIdAttribute), children != null ? children : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title ? /*#__PURE__*/React__default.createElement("h3", _objectSpread2({
|
|
3220
3128
|
className: "reactist-notification__title"
|
|
3221
|
-
}, titleIdAttribute), title) : null, subtitle ? /*#__PURE__*/React__default.createElement("p",
|
|
3129
|
+
}, titleIdAttribute), title) : null, subtitle ? /*#__PURE__*/React__default.createElement("p", _objectSpread2({
|
|
3222
3130
|
className: "reactist-notification__subtitle"
|
|
3223
3131
|
}, subtitleIdAttribute), subtitle) : null));
|
|
3224
|
-
|
|
3132
|
+
const notificationBody = /*#__PURE__*/React__default.createElement("div", {
|
|
3225
3133
|
className: "reactist-notification__icon-content-group"
|
|
3226
|
-
}, icon
|
|
3227
|
-
return /*#__PURE__*/React__default.createElement("div",
|
|
3134
|
+
}, icon != null ? icon : null, notificationContent);
|
|
3135
|
+
return /*#__PURE__*/React__default.createElement("div", _objectSpread2(_objectSpread2(_objectSpread2({
|
|
3228
3136
|
id: id,
|
|
3229
3137
|
role: "alert",
|
|
3230
3138
|
className: classNames('reactist-notification', className, {
|
|
@@ -3232,28 +3140,22 @@ function Notification(_ref) {
|
|
|
3232
3140
|
'reactist-notification--with-close-button': Boolean(onClose)
|
|
3233
3141
|
}),
|
|
3234
3142
|
"aria-live": ariaLive
|
|
3235
|
-
}, ariaLabelledBy, ariaDescribedBy, rest), onClick ? /*#__PURE__*/React__default.createElement("button", {
|
|
3143
|
+
}, ariaLabelledBy), ariaDescribedBy), rest), onClick ? /*#__PURE__*/React__default.createElement("button", {
|
|
3236
3144
|
className: "reactist-notification__button",
|
|
3237
3145
|
onClick: onClick
|
|
3238
3146
|
}, notificationBody) : notificationBody, onClose ? /*#__PURE__*/React__default.createElement("button", {
|
|
3239
3147
|
className: "reactist-notification__close-button",
|
|
3240
3148
|
onClick: onClose,
|
|
3241
3149
|
"aria-label": closeAltText
|
|
3242
|
-
}, customCloseButton
|
|
3243
|
-
}
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
_excluded7 = ["handleItemSelect"],
|
|
3252
|
-
_excluded8 = ["children", "onItemSelect"],
|
|
3253
|
-
_excluded9 = ["handleItemSelect"],
|
|
3254
|
-
_excluded10 = ["label", "children", "exceptionallySetClassName"],
|
|
3255
|
-
_excluded11 = ["handleItemSelect"];
|
|
3256
|
-
var MenuContext = /*#__PURE__*/React.createContext( // Reakit gives us no means to obtain a valid initial/default value of type MenuStateReturn
|
|
3150
|
+
}, customCloseButton != null ? customCloseButton : /*#__PURE__*/React__default.createElement(CloseIcon$1, null)) : null);
|
|
3151
|
+
}
|
|
3152
|
+
|
|
3153
|
+
const _excluded$u = ["children", "onItemSelect"],
|
|
3154
|
+
_excluded2$3 = ["exceptionallySetClassName"],
|
|
3155
|
+
_excluded3$2 = ["exceptionallySetClassName"],
|
|
3156
|
+
_excluded4$1 = ["value", "children", "onSelect", "hideOnSelect", "onClick", "exceptionallySetClassName", "as"],
|
|
3157
|
+
_excluded5$1 = ["label", "children", "exceptionallySetClassName"];
|
|
3158
|
+
const MenuContext = /*#__PURE__*/React.createContext( // Ariakit gives us no means to obtain a valid initial/default value of type MenuStateReturn
|
|
3257
3159
|
// (it is normally obtained by calling useMenuState but we can't call hooks outside components).
|
|
3258
3160
|
// This is however of little consequence since this value is only used if some of the components
|
|
3259
3161
|
// are used outside Menu, something that should not happen and we do not support.
|
|
@@ -3265,22 +3167,24 @@ var MenuContext = /*#__PURE__*/React.createContext( // Reakit gives us no means
|
|
|
3265
3167
|
*/
|
|
3266
3168
|
|
|
3267
3169
|
function Menu(_ref) {
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3170
|
+
let {
|
|
3171
|
+
children,
|
|
3172
|
+
onItemSelect
|
|
3173
|
+
} = _ref,
|
|
3174
|
+
props = _objectWithoutProperties(_ref, _excluded$u);
|
|
3175
|
+
|
|
3176
|
+
const state = Ariakit.useMenuState(_objectSpread2({
|
|
3177
|
+
focusLoop: true,
|
|
3178
|
+
gutter: 8,
|
|
3179
|
+
shift: 8
|
|
3275
3180
|
}, props));
|
|
3276
|
-
|
|
3181
|
+
const handleItemSelect = React.useCallback(function handleItemSelect(value) {
|
|
3277
3182
|
if (onItemSelect) onItemSelect(value);
|
|
3278
3183
|
}, [onItemSelect]);
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
}, [state, handleItemSelect]);
|
|
3184
|
+
const value = React.useMemo(() => ({
|
|
3185
|
+
state,
|
|
3186
|
+
handleItemSelect
|
|
3187
|
+
}), [state, handleItemSelect]);
|
|
3284
3188
|
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
3285
3189
|
value: value
|
|
3286
3190
|
}, children);
|
|
@@ -3290,69 +3194,38 @@ function Menu(_ref) {
|
|
|
3290
3194
|
*/
|
|
3291
3195
|
|
|
3292
3196
|
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
state = _objectWithoutPropertiesLoose(_React$useContext, _excluded3$2);
|
|
3197
|
+
const MenuButton = /*#__PURE__*/polymorphicComponent(function MenuButton(_ref2, ref) {
|
|
3198
|
+
let {
|
|
3199
|
+
exceptionallySetClassName
|
|
3200
|
+
} = _ref2,
|
|
3201
|
+
props = _objectWithoutProperties(_ref2, _excluded2$3);
|
|
3299
3202
|
|
|
3300
|
-
|
|
3203
|
+
const {
|
|
3204
|
+
state
|
|
3205
|
+
} = React.useContext(MenuContext);
|
|
3206
|
+
return /*#__PURE__*/React.createElement(Ariakit.MenuButton, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3207
|
+
state: state,
|
|
3301
3208
|
ref: ref,
|
|
3302
3209
|
className: classNames('reactist_menubutton', exceptionallySetClassName)
|
|
3303
3210
|
}));
|
|
3304
3211
|
});
|
|
3305
|
-
var BACKDROP_STYLE = {
|
|
3306
|
-
width: '100%',
|
|
3307
|
-
height: '100%',
|
|
3308
|
-
position: 'fixed',
|
|
3309
|
-
top: 0,
|
|
3310
|
-
left: 0
|
|
3311
|
-
};
|
|
3312
|
-
/**
|
|
3313
|
-
* Internal component to provide a backdrop/overlay to all menus. This is needed because reakit's
|
|
3314
|
-
* menus do not show an overlay by default.
|
|
3315
|
-
*/
|
|
3316
|
-
|
|
3317
|
-
function MenuBackdrop(_ref3) {
|
|
3318
|
-
var baseId = _ref3.baseId,
|
|
3319
|
-
visible = _ref3.visible,
|
|
3320
|
-
animated = _ref3.animated,
|
|
3321
|
-
animating = _ref3.animating,
|
|
3322
|
-
stopAnimation = _ref3.stopAnimation,
|
|
3323
|
-
modal = _ref3.modal,
|
|
3324
|
-
children = _ref3.children;
|
|
3325
|
-
return /*#__PURE__*/React.createElement(Popover$1.PopoverBackdrop, {
|
|
3326
|
-
baseId: baseId,
|
|
3327
|
-
visible: visible,
|
|
3328
|
-
animated: animated,
|
|
3329
|
-
animating: animating,
|
|
3330
|
-
stopAnimation: stopAnimation,
|
|
3331
|
-
modal: modal,
|
|
3332
|
-
style: BACKDROP_STYLE
|
|
3333
|
-
}, children);
|
|
3334
|
-
}
|
|
3335
3212
|
/**
|
|
3336
3213
|
* The dropdown menu itself, containing a list of menu items.
|
|
3337
3214
|
*/
|
|
3338
3215
|
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
React.
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
(_state$unstable_refer = state.unstable_referenceRef) === null || _state$unstable_refer === void 0 ? void 0 : (_state$unstable_refer2 = _state$unstable_refer.current) === null || _state$unstable_refer2 === void 0 ? void 0 : _state$unstable_refer2.focus();
|
|
3353
|
-
}
|
|
3354
|
-
}, [state.visible, previousVisible, state.unstable_referenceRef]);
|
|
3355
|
-
return state.visible ? /*#__PURE__*/React.createElement(MenuBackdrop, Object.assign({}, state), /*#__PURE__*/React.createElement(Reakit.Menu, Object.assign({}, props, state, {
|
|
3216
|
+
const MenuList = /*#__PURE__*/polymorphicComponent(function MenuList(_ref3, ref) {
|
|
3217
|
+
let {
|
|
3218
|
+
exceptionallySetClassName
|
|
3219
|
+
} = _ref3,
|
|
3220
|
+
props = _objectWithoutProperties(_ref3, _excluded3$2);
|
|
3221
|
+
|
|
3222
|
+
const {
|
|
3223
|
+
state
|
|
3224
|
+
} = React.useContext(MenuContext);
|
|
3225
|
+
return state.visible ? /*#__PURE__*/React.createElement(portal.Portal, {
|
|
3226
|
+
preserveTabOrder: true
|
|
3227
|
+
}, /*#__PURE__*/React.createElement(Ariakit.Menu, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3228
|
+
state: state,
|
|
3356
3229
|
ref: ref,
|
|
3357
3230
|
className: classNames('reactist_menulist', exceptionallySetClassName)
|
|
3358
3231
|
}))) : null;
|
|
@@ -3362,32 +3235,39 @@ var MenuList = /*#__PURE__*/polymorphicComponent(function MenuList(_ref4, ref) {
|
|
|
3362
3235
|
* callback.
|
|
3363
3236
|
*/
|
|
3364
3237
|
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3238
|
+
const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref4, ref) {
|
|
3239
|
+
let {
|
|
3240
|
+
value,
|
|
3241
|
+
children,
|
|
3242
|
+
onSelect,
|
|
3243
|
+
hideOnSelect = true,
|
|
3244
|
+
onClick,
|
|
3245
|
+
exceptionallySetClassName,
|
|
3246
|
+
as = 'button'
|
|
3247
|
+
} = _ref4,
|
|
3248
|
+
props = _objectWithoutProperties(_ref4, _excluded4$1);
|
|
3249
|
+
|
|
3250
|
+
const {
|
|
3251
|
+
handleItemSelect,
|
|
3252
|
+
state
|
|
3253
|
+
} = React.useContext(MenuContext);
|
|
3254
|
+
const {
|
|
3255
|
+
hide
|
|
3256
|
+
} = state;
|
|
3257
|
+
const handleClick = React.useCallback(function handleClick(event) {
|
|
3258
|
+
onClick == null ? void 0 : onClick(event);
|
|
3259
|
+
const onSelectResult = onSelect && !event.defaultPrevented ? onSelect() : undefined;
|
|
3260
|
+
const shouldClose = onSelectResult !== false && hideOnSelect;
|
|
3384
3261
|
handleItemSelect(value);
|
|
3385
3262
|
if (shouldClose) hide();
|
|
3386
3263
|
}, [onSelect, onClick, handleItemSelect, hideOnSelect, hide, value]);
|
|
3387
|
-
return /*#__PURE__*/React.createElement(
|
|
3264
|
+
return /*#__PURE__*/React.createElement(Ariakit.MenuItem, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3265
|
+
as: as,
|
|
3266
|
+
state: state,
|
|
3388
3267
|
ref: ref,
|
|
3389
3268
|
onClick: handleClick,
|
|
3390
|
-
className: exceptionallySetClassName
|
|
3269
|
+
className: exceptionallySetClassName,
|
|
3270
|
+
hideOnClick: false
|
|
3391
3271
|
}), children);
|
|
3392
3272
|
});
|
|
3393
3273
|
/**
|
|
@@ -3412,35 +3292,32 @@ var MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref5, ref) {
|
|
|
3412
3292
|
* opening a sub-menu with the menu items list below it.
|
|
3413
3293
|
*/
|
|
3414
3294
|
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3295
|
+
const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
|
|
3296
|
+
children,
|
|
3297
|
+
onItemSelect
|
|
3298
|
+
}, ref) {
|
|
3299
|
+
const {
|
|
3300
|
+
handleItemSelect: parentMenuItemSelect,
|
|
3301
|
+
state
|
|
3302
|
+
} = React.useContext(MenuContext);
|
|
3303
|
+
const {
|
|
3304
|
+
hide: parentMenuHide
|
|
3305
|
+
} = state;
|
|
3306
|
+
const handleSubItemSelect = React.useCallback(function handleSubItemSelect(value) {
|
|
3426
3307
|
if (onItemSelect) onItemSelect(value);
|
|
3427
3308
|
parentMenuItemSelect(value);
|
|
3428
3309
|
parentMenuHide();
|
|
3429
3310
|
}, [parentMenuHide, parentMenuItemSelect, onItemSelect]);
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
list = _React$Children$toArr[1];
|
|
3434
|
-
|
|
3435
|
-
return /*#__PURE__*/React.createElement(Reakit.MenuItem, Object.assign({}, state, props, {
|
|
3436
|
-
ref: ref
|
|
3437
|
-
}), function (buttonProps) {
|
|
3438
|
-
return /*#__PURE__*/React.createElement(Menu, {
|
|
3439
|
-
onItemSelect: handleSubItemSelect
|
|
3440
|
-
}, /*#__PURE__*/React.cloneElement(button, _objectSpread2(_objectSpread2({}, buttonProps), {}, {
|
|
3441
|
-
className: classNames(buttonProps.className, 'reactist_submenu_button')
|
|
3442
|
-
})), list);
|
|
3311
|
+
const [button, list] = React.Children.toArray(children);
|
|
3312
|
+
const menuProps = Ariakit.useMenuItem({
|
|
3313
|
+
state
|
|
3443
3314
|
});
|
|
3315
|
+
return /*#__PURE__*/React.createElement(Menu, {
|
|
3316
|
+
onItemSelect: handleSubItemSelect
|
|
3317
|
+
}, /*#__PURE__*/React.cloneElement(button, _objectSpread2(_objectSpread2({}, menuProps), {}, {
|
|
3318
|
+
className: classNames(menuProps.className, 'reactist_submenu_button'),
|
|
3319
|
+
ref
|
|
3320
|
+
})), list);
|
|
3444
3321
|
});
|
|
3445
3322
|
/**
|
|
3446
3323
|
* A way to semantically group some menu items.
|
|
@@ -3449,18 +3326,20 @@ var SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu(_ref6, ref) {
|
|
|
3449
3326
|
* before and/or after the group if you so wish.
|
|
3450
3327
|
*/
|
|
3451
3328
|
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
}, props,
|
|
3329
|
+
const MenuGroup = /*#__PURE__*/polymorphicComponent(function MenuGroup(_ref5, ref) {
|
|
3330
|
+
let {
|
|
3331
|
+
label,
|
|
3332
|
+
children,
|
|
3333
|
+
exceptionallySetClassName
|
|
3334
|
+
} = _ref5,
|
|
3335
|
+
props = _objectWithoutProperties(_ref5, _excluded5$1);
|
|
3336
|
+
|
|
3337
|
+
const {
|
|
3338
|
+
state
|
|
3339
|
+
} = React.useContext(MenuContext);
|
|
3340
|
+
return /*#__PURE__*/React.createElement(Ariakit.MenuGroup, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3341
|
+
ref: ref,
|
|
3342
|
+
state: state,
|
|
3464
3343
|
className: exceptionallySetClassName
|
|
3465
3344
|
}), label ? /*#__PURE__*/React.createElement("div", {
|
|
3466
3345
|
role: "presentation",
|
|
@@ -3470,58 +3349,51 @@ var MenuGroup = /*#__PURE__*/polymorphicComponent(function MenuGroud(_ref7, ref)
|
|
|
3470
3349
|
|
|
3471
3350
|
/** @deprecated */
|
|
3472
3351
|
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
function Box() {
|
|
3477
|
-
var _this;
|
|
3478
|
-
|
|
3479
|
-
_this = _React$Component.apply(this, arguments) || this;
|
|
3352
|
+
class Box$2 extends React__default.Component {
|
|
3353
|
+
constructor(...args) {
|
|
3354
|
+
super(...args);
|
|
3480
3355
|
|
|
3481
|
-
|
|
3356
|
+
this._closeModal = () => {
|
|
3482
3357
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3483
|
-
|
|
3358
|
+
const modalElement = document.getElementById('modal_box');
|
|
3484
3359
|
ReactDOM.unmountComponentAtNode(modalElement);
|
|
3485
3360
|
};
|
|
3486
3361
|
|
|
3487
|
-
|
|
3362
|
+
this._handleKeyDown = event => {
|
|
3488
3363
|
if (event.keyCode === 27) {
|
|
3489
3364
|
// ESC
|
|
3490
|
-
|
|
3365
|
+
this._closeModal();
|
|
3491
3366
|
|
|
3492
3367
|
if (event.preventDefault) event.preventDefault();
|
|
3493
3368
|
}
|
|
3494
3369
|
};
|
|
3495
3370
|
|
|
3496
|
-
|
|
3371
|
+
this._handleOverlayClick = event => {
|
|
3497
3372
|
if (event.target instanceof Element && (event.target.id === 'reactist-overlay' || event.target.id === 'reactist-overlay-inner')) {
|
|
3498
|
-
|
|
3373
|
+
this._closeModal();
|
|
3499
3374
|
}
|
|
3500
3375
|
};
|
|
3501
|
-
|
|
3502
|
-
return _this;
|
|
3503
3376
|
}
|
|
3504
3377
|
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
3378
|
+
componentDidMount() {
|
|
3508
3379
|
window.addEventListener('keydown', this._handleKeyDown);
|
|
3509
|
-
}
|
|
3380
|
+
}
|
|
3510
3381
|
|
|
3511
|
-
|
|
3382
|
+
componentWillUnmount() {
|
|
3512
3383
|
window.removeEventListener('keydown', this._handleKeyDown);
|
|
3513
|
-
}
|
|
3384
|
+
}
|
|
3514
3385
|
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3386
|
+
render() {
|
|
3387
|
+
const {
|
|
3388
|
+
large,
|
|
3389
|
+
medium,
|
|
3390
|
+
style,
|
|
3391
|
+
children,
|
|
3392
|
+
closeOnOverlayClick
|
|
3393
|
+
} = this.props;
|
|
3394
|
+
const className = classNames('reactist_modal_box', {
|
|
3395
|
+
large,
|
|
3396
|
+
medium
|
|
3525
3397
|
}, this.props.className);
|
|
3526
3398
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
3527
3399
|
className: "reactist_overlay",
|
|
@@ -3534,11 +3406,12 @@ var Box$2 = /*#__PURE__*/function (_React$Component) {
|
|
|
3534
3406
|
style: style,
|
|
3535
3407
|
className: className
|
|
3536
3408
|
}, children)));
|
|
3537
|
-
}
|
|
3409
|
+
}
|
|
3538
3410
|
|
|
3539
|
-
|
|
3540
|
-
}(React__default.Component);
|
|
3411
|
+
}
|
|
3541
3412
|
|
|
3413
|
+
Box$2.displayName = void 0;
|
|
3414
|
+
Box$2.defaultProps = void 0;
|
|
3542
3415
|
Box$2.displayName = 'Modal.Box';
|
|
3543
3416
|
Box$2.defaultProps = {
|
|
3544
3417
|
large: false,
|
|
@@ -3546,16 +3419,8 @@ Box$2.defaultProps = {
|
|
|
3546
3419
|
};
|
|
3547
3420
|
/** @deprecated */
|
|
3548
3421
|
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
function Header() {
|
|
3553
|
-
return _React$Component2.apply(this, arguments) || this;
|
|
3554
|
-
}
|
|
3555
|
-
|
|
3556
|
-
var _proto2 = Header.prototype;
|
|
3557
|
-
|
|
3558
|
-
_proto2._closeModal = function _closeModal(event) {
|
|
3422
|
+
class Header extends React__default.Component {
|
|
3423
|
+
_closeModal(event) {
|
|
3559
3424
|
event.preventDefault();
|
|
3560
3425
|
|
|
3561
3426
|
if (typeof this.props.beforeClose === 'function') {
|
|
@@ -3563,11 +3428,11 @@ var Header = /*#__PURE__*/function (_React$Component2) {
|
|
|
3563
3428
|
} // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3564
3429
|
|
|
3565
3430
|
|
|
3566
|
-
|
|
3431
|
+
const modalElement = document.getElementById('modal_box');
|
|
3567
3432
|
ReactDOM.unmountComponentAtNode(modalElement);
|
|
3568
|
-
}
|
|
3433
|
+
}
|
|
3569
3434
|
|
|
3570
|
-
|
|
3435
|
+
render() {
|
|
3571
3436
|
return (
|
|
3572
3437
|
/*#__PURE__*/
|
|
3573
3438
|
|
|
@@ -3586,39 +3451,33 @@ var Header = /*#__PURE__*/function (_React$Component2) {
|
|
|
3586
3451
|
/* eslint-enable jsx-a11y/anchor-is-valid */
|
|
3587
3452
|
|
|
3588
3453
|
);
|
|
3589
|
-
}
|
|
3454
|
+
}
|
|
3590
3455
|
|
|
3591
|
-
|
|
3592
|
-
}(React__default.Component);
|
|
3456
|
+
}
|
|
3593
3457
|
|
|
3458
|
+
Header.displayName = void 0;
|
|
3459
|
+
Header.defaultProps = void 0;
|
|
3594
3460
|
Header.displayName = 'Modal.Header';
|
|
3595
3461
|
/** @deprecated */
|
|
3596
3462
|
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
function Body() {
|
|
3601
|
-
return _React$Component3.apply(this, arguments) || this;
|
|
3602
|
-
}
|
|
3603
|
-
|
|
3604
|
-
var _proto3 = Body.prototype;
|
|
3605
|
-
|
|
3606
|
-
_proto3._closeModal = function _closeModal(event) {
|
|
3463
|
+
class Body$1 extends React__default.Component {
|
|
3464
|
+
_closeModal(event) {
|
|
3607
3465
|
event.preventDefault(); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3608
3466
|
|
|
3609
|
-
|
|
3467
|
+
const modalElement = document.getElementById('modal_box');
|
|
3610
3468
|
ReactDOM.unmountComponentAtNode(modalElement);
|
|
3611
|
-
}
|
|
3469
|
+
}
|
|
3612
3470
|
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3471
|
+
render() {
|
|
3472
|
+
const {
|
|
3473
|
+
icon,
|
|
3474
|
+
plain,
|
|
3475
|
+
children,
|
|
3476
|
+
style,
|
|
3477
|
+
showCloseIcon
|
|
3478
|
+
} = this.props;
|
|
3479
|
+
const className = classNames('reactist_modal_box__body', {
|
|
3480
|
+
plain
|
|
3622
3481
|
}, this.props.className);
|
|
3623
3482
|
return (
|
|
3624
3483
|
/*#__PURE__*/
|
|
@@ -3641,49 +3500,38 @@ var Body$1 = /*#__PURE__*/function (_React$Component3) {
|
|
|
3641
3500
|
/* eslint-enable jsx-a11y/anchor-is-valid */
|
|
3642
3501
|
|
|
3643
3502
|
);
|
|
3644
|
-
}
|
|
3503
|
+
}
|
|
3645
3504
|
|
|
3646
|
-
|
|
3647
|
-
}(React__default.Component);
|
|
3505
|
+
}
|
|
3648
3506
|
|
|
3507
|
+
Body$1.displayName = void 0;
|
|
3508
|
+
Body$1.defaultProps = void 0;
|
|
3649
3509
|
Body$1.displayName = 'Modal.Body';
|
|
3650
3510
|
Body$1.defaultProps = {
|
|
3651
3511
|
showCloseIcon: false
|
|
3652
3512
|
};
|
|
3653
3513
|
/** @deprecated */
|
|
3654
3514
|
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
function Actions() {
|
|
3659
|
-
return _React$Component4.apply(this, arguments) || this;
|
|
3660
|
-
}
|
|
3661
|
-
|
|
3662
|
-
var _proto4 = Actions.prototype;
|
|
3663
|
-
|
|
3664
|
-
_proto4._onClick = function _onClick(onClick) {
|
|
3515
|
+
class Actions extends React__default.Component {
|
|
3516
|
+
_onClick(onClick) {
|
|
3665
3517
|
if (onClick) {
|
|
3666
3518
|
onClick();
|
|
3667
3519
|
} // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3668
3520
|
|
|
3669
3521
|
|
|
3670
|
-
|
|
3522
|
+
const modalElement = document.getElementById('modal_box');
|
|
3671
3523
|
ReactDOM.unmountComponentAtNode(modalElement);
|
|
3672
|
-
}
|
|
3673
|
-
|
|
3674
|
-
_proto4.render = function render() {
|
|
3675
|
-
var _this2 = this;
|
|
3524
|
+
}
|
|
3676
3525
|
|
|
3677
|
-
|
|
3526
|
+
render() {
|
|
3527
|
+
const children = React__default.Children.map( // see: https://github.com/microsoft/TypeScript/issues/21699
|
|
3678
3528
|
// @ts-expect-error Children cannot be typed properly yet in React
|
|
3679
|
-
this.props.children,
|
|
3529
|
+
this.props.children, child => {
|
|
3680
3530
|
var _child$props;
|
|
3681
3531
|
|
|
3682
|
-
if (child
|
|
3532
|
+
if (child != null && (_child$props = child.props) != null && _child$props.close) {
|
|
3683
3533
|
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
3684
|
-
onClick:
|
|
3685
|
-
return _this2._onClick(child.props.onClick);
|
|
3686
|
-
}
|
|
3534
|
+
onClick: () => this._onClick(child.props.onClick)
|
|
3687
3535
|
});
|
|
3688
3536
|
} else {
|
|
3689
3537
|
return child ? /*#__PURE__*/React__default.cloneElement(child) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
|
|
@@ -3692,32 +3540,29 @@ var Actions = /*#__PURE__*/function (_React$Component4) {
|
|
|
3692
3540
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
3693
3541
|
className: "reactist_modal_box__actions"
|
|
3694
3542
|
}, children);
|
|
3695
|
-
}
|
|
3543
|
+
}
|
|
3696
3544
|
|
|
3697
|
-
|
|
3698
|
-
}(React__default.Component);
|
|
3545
|
+
}
|
|
3699
3546
|
|
|
3547
|
+
Actions.displayName = void 0;
|
|
3700
3548
|
Actions.displayName = 'Modal.Actions';
|
|
3701
3549
|
|
|
3702
3550
|
var index = {
|
|
3703
3551
|
Box: Box$2,
|
|
3704
|
-
Header
|
|
3552
|
+
Header,
|
|
3705
3553
|
Body: Body$1,
|
|
3706
|
-
Actions
|
|
3554
|
+
Actions
|
|
3707
3555
|
};
|
|
3708
3556
|
|
|
3709
3557
|
/** @deprecated */
|
|
3710
3558
|
|
|
3711
|
-
function Loading$1(
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
3719
|
-
_ref$ariaLabel = _ref['aria-label'],
|
|
3720
|
-
ariaLabel = _ref$ariaLabel === void 0 ? 'Loading' : _ref$ariaLabel;
|
|
3559
|
+
function Loading$1({
|
|
3560
|
+
className,
|
|
3561
|
+
spinnerColor = '#3F82EF',
|
|
3562
|
+
bgColor = '#D9E6FB',
|
|
3563
|
+
size = 24,
|
|
3564
|
+
'aria-label': ariaLabel = 'Loading'
|
|
3565
|
+
}) {
|
|
3721
3566
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
3722
3567
|
className: classNames('reactist_loading', className),
|
|
3723
3568
|
"aria-label": ariaLabel,
|