@doist/reactist 11.5.1 → 12.0.2
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 +1336 -1496
- 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 +40 -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 +60 -64
- package/es/new-components/modal/modal.js.map +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/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/password-field.css +1 -1
- package/styles/reactist.css +5 -5
- 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;
|
|
@@ -510,15 +491,17 @@ function Tooltip(_ref) {
|
|
|
510
491
|
|
|
511
492
|
|
|
512
493
|
function handleFocus(event) {
|
|
494
|
+
var _child$props;
|
|
495
|
+
|
|
513
496
|
// If focus is not followed by a key up event, does it mean that it's not
|
|
514
497
|
// an intentional keyboard focus? Not sure but it seems to work.
|
|
515
498
|
// This may be resolved soon in an upcoming version of reakit:
|
|
516
499
|
// https://github.com/reakit/reakit/issues/750
|
|
517
500
|
function handleKeyUp(e) {
|
|
518
|
-
|
|
501
|
+
const eventKey = e.key;
|
|
519
502
|
|
|
520
503
|
if (eventKey !== 'Escape' && eventKey !== 'Enter' && eventKey !== 'Space') {
|
|
521
|
-
|
|
504
|
+
state.show();
|
|
522
505
|
}
|
|
523
506
|
}
|
|
524
507
|
|
|
@@ -526,19 +509,19 @@ function Tooltip(_ref) {
|
|
|
526
509
|
once: true
|
|
527
510
|
}); // Prevent tooltip.show from being called by TooltipReference
|
|
528
511
|
|
|
529
|
-
event.preventDefault();
|
|
530
|
-
|
|
531
|
-
if (typeof child.props.onFocus === 'function') child.props.onFocus(event);
|
|
512
|
+
event.preventDefault();
|
|
513
|
+
child == null ? void 0 : (_child$props = child.props) == null ? void 0 : _child$props.onFocus == null ? void 0 : _child$props.onFocus(event);
|
|
532
514
|
}
|
|
533
515
|
|
|
534
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
516
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(tooltip.TooltipAnchor, _objectSpread2(_objectSpread2({
|
|
517
|
+
state: state
|
|
518
|
+
}, child.props), {}, {
|
|
519
|
+
ref: child.ref,
|
|
538
520
|
onFocus: handleFocus
|
|
539
|
-
}),
|
|
540
|
-
return /*#__PURE__*/React__default.cloneElement(child,
|
|
541
|
-
}),
|
|
521
|
+
}), anchorProps => {
|
|
522
|
+
return /*#__PURE__*/React__default.cloneElement(child, anchorProps);
|
|
523
|
+
}), state.visible ? /*#__PURE__*/React__default.createElement(tooltip.Tooltip, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
524
|
+
state: state,
|
|
542
525
|
className: classNames('reactist_tooltip', className)
|
|
543
526
|
}), typeof content === 'function' ? content() : content) : null);
|
|
544
527
|
}
|
|
@@ -557,18 +540,16 @@ function Tooltip(_ref) {
|
|
|
557
540
|
*/
|
|
558
541
|
|
|
559
542
|
function useDelay() {
|
|
560
|
-
|
|
561
|
-
|
|
543
|
+
const timeoutRef = React__default.useRef();
|
|
544
|
+
const clearTimeouts = React__default.useCallback(function clearTimeouts() {
|
|
562
545
|
if (timeoutRef.current != null) {
|
|
563
546
|
clearTimeout(timeoutRef.current);
|
|
564
547
|
}
|
|
565
548
|
}, []); // Runs clearTimeouts when the component is unmounted
|
|
566
549
|
|
|
567
|
-
React__default.useEffect(
|
|
568
|
-
return clearTimeouts;
|
|
569
|
-
}, [clearTimeouts]);
|
|
550
|
+
React__default.useEffect(() => clearTimeouts, [clearTimeouts]);
|
|
570
551
|
return React__default.useCallback(function delay(fn, delay) {
|
|
571
|
-
return
|
|
552
|
+
return () => {
|
|
572
553
|
clearTimeouts();
|
|
573
554
|
timeoutRef.current = setTimeout(fn, delay);
|
|
574
555
|
};
|
|
@@ -577,9 +558,9 @@ function useDelay() {
|
|
|
577
558
|
|
|
578
559
|
var modules_c7f5018f = {"svg":"_51539197","spinner":"_54fbe2b3","tint":"a0c466ed","fill":"_745b73d3"};
|
|
579
560
|
|
|
580
|
-
function Spinner(
|
|
581
|
-
|
|
582
|
-
|
|
561
|
+
function Spinner({
|
|
562
|
+
size = 24
|
|
563
|
+
}) {
|
|
583
564
|
return /*#__PURE__*/React.createElement("svg", {
|
|
584
565
|
"aria-hidden": true,
|
|
585
566
|
width: size,
|
|
@@ -600,7 +581,7 @@ function Spinner(_ref) {
|
|
|
600
581
|
|
|
601
582
|
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
583
|
|
|
603
|
-
|
|
584
|
+
const _excluded$7 = ["as", "variant", "tone", "size", "disabled", "loading", "tooltip", "tooltipGapSize", "onClick", "exceptionallySetClassName", "children", "startIcon", "endIcon", "icon", "width", "align"];
|
|
604
585
|
|
|
605
586
|
function preventDefault(event) {
|
|
606
587
|
event.preventDefault();
|
|
@@ -614,33 +595,29 @@ function preventDefault(event) {
|
|
|
614
595
|
*/
|
|
615
596
|
|
|
616
597
|
|
|
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, {
|
|
598
|
+
const BaseButton = /*#__PURE__*/polymorphicComponent(function BaseButton(_ref, ref) {
|
|
599
|
+
let {
|
|
600
|
+
as = 'div',
|
|
601
|
+
variant,
|
|
602
|
+
tone = 'normal',
|
|
603
|
+
size = 'normal',
|
|
604
|
+
disabled = false,
|
|
605
|
+
loading = false,
|
|
606
|
+
tooltip,
|
|
607
|
+
tooltipGapSize,
|
|
608
|
+
onClick,
|
|
609
|
+
exceptionallySetClassName,
|
|
610
|
+
children,
|
|
611
|
+
startIcon,
|
|
612
|
+
endIcon,
|
|
613
|
+
icon,
|
|
614
|
+
width = 'auto',
|
|
615
|
+
align
|
|
616
|
+
} = _ref,
|
|
617
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
618
|
+
|
|
619
|
+
const isDisabled = loading || disabled;
|
|
620
|
+
const buttonElement = /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
644
621
|
as: as,
|
|
645
622
|
ref: ref,
|
|
646
623
|
"aria-disabled": isDisabled,
|
|
@@ -659,14 +636,14 @@ var BaseButton = /*#__PURE__*/polymorphicComponent(function BaseButton(_ref, ref
|
|
|
659
636
|
"aria-hidden": true
|
|
660
637
|
}, 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
638
|
|
|
662
|
-
|
|
639
|
+
const tooltipContent = icon ? tooltip != null ? tooltip : props['aria-label'] : tooltip;
|
|
663
640
|
return tooltipContent ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
664
641
|
content: tooltipContent,
|
|
665
642
|
gapSize: tooltipGapSize
|
|
666
643
|
}, buttonElement) : buttonElement;
|
|
667
644
|
});
|
|
668
645
|
|
|
669
|
-
|
|
646
|
+
const _excluded$8 = ["variant", "tone", "size", "type", "disabled", "exceptionallySetClassName"];
|
|
670
647
|
/**
|
|
671
648
|
* A semantic button that also looks like a button, and provides all the necessary visual variants.
|
|
672
649
|
* It follows the [WAI-ARIA Button Pattern](https://www.w3.org/TR/wai-aria-practices/#button).
|
|
@@ -674,20 +651,18 @@ var _excluded$8 = ["variant", "tone", "size", "type", "disabled", "exceptionally
|
|
|
674
651
|
* @see ButtonLink
|
|
675
652
|
*/
|
|
676
653
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
return /*#__PURE__*/React.createElement(BaseButton, Object.assign({}, props, {
|
|
654
|
+
const Button = /*#__PURE__*/React.forwardRef(function Button(_ref, ref) {
|
|
655
|
+
let {
|
|
656
|
+
variant,
|
|
657
|
+
tone = 'normal',
|
|
658
|
+
size = 'normal',
|
|
659
|
+
type = 'button',
|
|
660
|
+
disabled = false,
|
|
661
|
+
exceptionallySetClassName
|
|
662
|
+
} = _ref,
|
|
663
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
664
|
+
|
|
665
|
+
return /*#__PURE__*/React.createElement(BaseButton, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
691
666
|
as: "button",
|
|
692
667
|
ref: ref,
|
|
693
668
|
variant: variant,
|
|
@@ -699,8 +674,8 @@ var Button = /*#__PURE__*/React.forwardRef(function Button(_ref, ref) {
|
|
|
699
674
|
}));
|
|
700
675
|
});
|
|
701
676
|
|
|
702
|
-
|
|
703
|
-
|
|
677
|
+
const _excluded$9 = ["tone"];
|
|
678
|
+
const alertIconForTone = {
|
|
704
679
|
info: AlertInfoIcon,
|
|
705
680
|
positive: AlertPositiveIcon,
|
|
706
681
|
caution: AlertCautionIcon,
|
|
@@ -708,15 +683,17 @@ var alertIconForTone = {
|
|
|
708
683
|
};
|
|
709
684
|
|
|
710
685
|
function AlertIcon(_ref) {
|
|
711
|
-
|
|
712
|
-
|
|
686
|
+
let {
|
|
687
|
+
tone
|
|
688
|
+
} = _ref,
|
|
689
|
+
props = _objectWithoutProperties(_ref, _excluded$9);
|
|
713
690
|
|
|
714
|
-
|
|
715
|
-
return Icon ? /*#__PURE__*/React.createElement(Icon,
|
|
691
|
+
const Icon = alertIconForTone[tone];
|
|
692
|
+
return Icon ? /*#__PURE__*/React.createElement(Icon, _objectSpread2({}, props)) : null;
|
|
716
693
|
}
|
|
717
694
|
|
|
718
695
|
function AlertInfoIcon(props) {
|
|
719
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
696
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
720
697
|
width: "24",
|
|
721
698
|
height: "24",
|
|
722
699
|
fill: "none",
|
|
@@ -730,7 +707,7 @@ function AlertInfoIcon(props) {
|
|
|
730
707
|
}
|
|
731
708
|
|
|
732
709
|
function AlertPositiveIcon(props) {
|
|
733
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
710
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
734
711
|
width: "24",
|
|
735
712
|
height: "24",
|
|
736
713
|
fill: "none",
|
|
@@ -744,7 +721,7 @@ function AlertPositiveIcon(props) {
|
|
|
744
721
|
}
|
|
745
722
|
|
|
746
723
|
function AlertCautionIcon(props) {
|
|
747
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
724
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
748
725
|
width: "24",
|
|
749
726
|
height: "24",
|
|
750
727
|
fill: "none",
|
|
@@ -758,7 +735,7 @@ function AlertCautionIcon(props) {
|
|
|
758
735
|
}
|
|
759
736
|
|
|
760
737
|
function AlertCriticalIcon(props) {
|
|
761
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
738
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
762
739
|
width: "24",
|
|
763
740
|
height: "24",
|
|
764
741
|
fill: "none",
|
|
@@ -772,7 +749,7 @@ function AlertCriticalIcon(props) {
|
|
|
772
749
|
}
|
|
773
750
|
|
|
774
751
|
function CloseIcon(props) {
|
|
775
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
752
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
776
753
|
xmlns: "http://www.w3.org/2000/svg",
|
|
777
754
|
width: "24",
|
|
778
755
|
height: "24"
|
|
@@ -784,12 +761,13 @@ function CloseIcon(props) {
|
|
|
784
761
|
|
|
785
762
|
var modules_6205a58e = {"container":"eb665121","tone-info":"d0373ff9","tone-positive":"bb18dcab","tone-caution":"_0af02331","tone-critical":"f76146f9"};
|
|
786
763
|
|
|
787
|
-
function Alert(
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
764
|
+
function Alert({
|
|
765
|
+
id,
|
|
766
|
+
children,
|
|
767
|
+
tone,
|
|
768
|
+
closeLabel,
|
|
769
|
+
onClose
|
|
770
|
+
}) {
|
|
793
771
|
return /*#__PURE__*/React.createElement(Box, {
|
|
794
772
|
id: id,
|
|
795
773
|
role: "alert",
|
|
@@ -821,8 +799,9 @@ function Alert(_ref) {
|
|
|
821
799
|
})) : null));
|
|
822
800
|
}
|
|
823
801
|
|
|
824
|
-
|
|
825
|
-
|
|
802
|
+
const _excluded$a = ["size", "exceptionallySetClassName"];
|
|
803
|
+
const sizeMapping = {
|
|
804
|
+
xsmall: 16,
|
|
826
805
|
small: 24,
|
|
827
806
|
medium: 36,
|
|
828
807
|
large: 48
|
|
@@ -831,14 +810,15 @@ var sizeMapping = {
|
|
|
831
810
|
function Loading(_ref) {
|
|
832
811
|
var _sizeMapping$size;
|
|
833
812
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
813
|
+
let {
|
|
814
|
+
size = 'small',
|
|
815
|
+
exceptionallySetClassName
|
|
816
|
+
} = _ref,
|
|
817
|
+
props = _objectWithoutProperties(_ref, _excluded$a);
|
|
838
818
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
return /*#__PURE__*/React__default.createElement(Box,
|
|
819
|
+
const numericSize = (_sizeMapping$size = sizeMapping[size]) != null ? _sizeMapping$size : sizeMapping.small;
|
|
820
|
+
const ariaLabel = props['aria-label'] ? props['aria-label'] : !props['aria-labelledby'] ? 'Loading…' : undefined;
|
|
821
|
+
return /*#__PURE__*/React__default.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
842
822
|
"aria-label": ariaLabel,
|
|
843
823
|
className: exceptionallySetClassName,
|
|
844
824
|
display: "flex",
|
|
@@ -853,10 +833,11 @@ function Loading(_ref) {
|
|
|
853
833
|
|
|
854
834
|
var modules_1b547e7e = {"container":"_464500ae","tone-info":"_1abfe147","tone-positive":"_36ce9859","tone-caution":"f92214b7","tone-critical":"be6cf28e"};
|
|
855
835
|
|
|
856
|
-
function Notice(
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
836
|
+
function Notice({
|
|
837
|
+
id,
|
|
838
|
+
children,
|
|
839
|
+
tone
|
|
840
|
+
}) {
|
|
860
841
|
return /*#__PURE__*/React.createElement(Box, {
|
|
861
842
|
id: id,
|
|
862
843
|
role: "alert",
|
|
@@ -876,25 +857,25 @@ function Notice(_ref) {
|
|
|
876
857
|
|
|
877
858
|
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
859
|
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
props =
|
|
860
|
+
const _excluded$b = ["level", "weight", "size", "tone", "children", "lineClamp", "align", "exceptionallySetClassName"];
|
|
861
|
+
const Heading = /*#__PURE__*/React.forwardRef(function Heading(_ref, ref) {
|
|
862
|
+
let {
|
|
863
|
+
level,
|
|
864
|
+
weight = 'regular',
|
|
865
|
+
size,
|
|
866
|
+
tone = 'normal',
|
|
867
|
+
children,
|
|
868
|
+
lineClamp,
|
|
869
|
+
align,
|
|
870
|
+
exceptionallySetClassName
|
|
871
|
+
} = _ref,
|
|
872
|
+
props = _objectWithoutProperties(_ref, _excluded$b);
|
|
892
873
|
|
|
893
874
|
// In TypeScript v4.1, this would be properly recognized without needing the type assertion
|
|
894
875
|
// https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-beta/#template-literal-types
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
return /*#__PURE__*/React.createElement(Box,
|
|
876
|
+
const headingElementName = "h" + level;
|
|
877
|
+
const lineClampMultipleLines = typeof lineClamp === 'string' ? parseInt(lineClamp, 10) > 1 : (lineClamp || 0) > 1;
|
|
878
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
898
879
|
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
880
|
textAlign: align,
|
|
900
881
|
// Prevents emojis from being cut-off
|
|
@@ -905,25 +886,24 @@ var Heading = /*#__PURE__*/React.forwardRef(function Heading(_ref, ref) {
|
|
|
905
886
|
}), children);
|
|
906
887
|
});
|
|
907
888
|
|
|
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, {
|
|
889
|
+
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"};
|
|
890
|
+
|
|
891
|
+
const _excluded$c = ["as", "size", "weight", "tone", "align", "children", "lineClamp", "exceptionallySetClassName"];
|
|
892
|
+
const Text = /*#__PURE__*/polymorphicComponent(function Text(_ref, ref) {
|
|
893
|
+
let {
|
|
894
|
+
as,
|
|
895
|
+
size = 'body',
|
|
896
|
+
weight = 'regular',
|
|
897
|
+
tone = 'normal',
|
|
898
|
+
align,
|
|
899
|
+
children,
|
|
900
|
+
lineClamp,
|
|
901
|
+
exceptionallySetClassName
|
|
902
|
+
} = _ref,
|
|
903
|
+
props = _objectWithoutProperties(_ref, _excluded$c);
|
|
904
|
+
|
|
905
|
+
const lineClampMultipleLines = typeof lineClamp === 'string' ? Number(lineClamp) > 1 : (lineClamp != null ? lineClamp : 1) > 1;
|
|
906
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
927
907
|
as: as,
|
|
928
908
|
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
909
|
textAlign: align,
|
|
@@ -934,7 +914,7 @@ var Text = /*#__PURE__*/polymorphicComponent(function Text(_ref, ref) {
|
|
|
934
914
|
}), children);
|
|
935
915
|
});
|
|
936
916
|
|
|
937
|
-
|
|
917
|
+
const _excluded$d = ["as", "variant", "tone", "size", "exceptionallySetClassName", "openInNewTab"];
|
|
938
918
|
/**
|
|
939
919
|
* A semantic link that looks like a button, exactly matching the `Button` component in all visual
|
|
940
920
|
* aspects.
|
|
@@ -942,20 +922,18 @@ var _excluded$d = ["as", "variant", "tone", "size", "exceptionallySetClassName",
|
|
|
942
922
|
* @see Button
|
|
943
923
|
*/
|
|
944
924
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
return /*#__PURE__*/React.createElement(BaseButton, Object.assign({}, props, {
|
|
925
|
+
const ButtonLink = /*#__PURE__*/polymorphicComponent(function ButtonLink(_ref, ref) {
|
|
926
|
+
let {
|
|
927
|
+
as = 'a',
|
|
928
|
+
variant,
|
|
929
|
+
tone = 'normal',
|
|
930
|
+
size = 'normal',
|
|
931
|
+
exceptionallySetClassName,
|
|
932
|
+
openInNewTab = false
|
|
933
|
+
} = _ref,
|
|
934
|
+
props = _objectWithoutProperties(_ref, _excluded$d);
|
|
935
|
+
|
|
936
|
+
return /*#__PURE__*/React.createElement(BaseButton, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
959
937
|
as: as,
|
|
960
938
|
ref: ref,
|
|
961
939
|
variant: variant,
|
|
@@ -967,18 +945,18 @@ var ButtonLink = /*#__PURE__*/polymorphicComponent(function ButtonLink(_ref, ref
|
|
|
967
945
|
}));
|
|
968
946
|
});
|
|
969
947
|
|
|
970
|
-
var modules_3d05deee = {"container":"
|
|
948
|
+
var modules_3d05deee = {"container":"_232127ef"};
|
|
971
949
|
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
props =
|
|
950
|
+
const _excluded$e = ["as", "openInNewTab", "exceptionallySetClassName"];
|
|
951
|
+
const TextLink = /*#__PURE__*/polymorphicComponent(function TextLink(_ref, ref) {
|
|
952
|
+
let {
|
|
953
|
+
as = 'a',
|
|
954
|
+
openInNewTab = false,
|
|
955
|
+
exceptionallySetClassName
|
|
956
|
+
} = _ref,
|
|
957
|
+
props = _objectWithoutProperties(_ref, _excluded$e);
|
|
980
958
|
|
|
981
|
-
return /*#__PURE__*/React.createElement(Box,
|
|
959
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
982
960
|
as: as,
|
|
983
961
|
display: "inline",
|
|
984
962
|
className: [exceptionallySetClassName, modules_3d05deee.container],
|
|
@@ -988,19 +966,19 @@ var TextLink = /*#__PURE__*/polymorphicComponent(function TextLink(_ref, ref) {
|
|
|
988
966
|
}));
|
|
989
967
|
});
|
|
990
968
|
|
|
991
|
-
|
|
992
|
-
|
|
969
|
+
const _excluded$f = ["checked", "indeterminate", "disabled"];
|
|
970
|
+
const svgPath = {
|
|
993
971
|
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
972
|
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
973
|
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
974
|
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
975
|
};
|
|
998
976
|
|
|
999
|
-
function getPathKey(
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
977
|
+
function getPathKey({
|
|
978
|
+
checked,
|
|
979
|
+
indeterminate,
|
|
980
|
+
disabled
|
|
981
|
+
}) {
|
|
1004
982
|
if (indeterminate) {
|
|
1005
983
|
return 'mixed'; // indeterminate, when true, overrides the checked state
|
|
1006
984
|
}
|
|
@@ -1021,18 +999,20 @@ function getPathKey(_ref) {
|
|
|
1021
999
|
return 'unchecked';
|
|
1022
1000
|
}
|
|
1023
1001
|
|
|
1024
|
-
function CheckboxIcon(
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1002
|
+
function CheckboxIcon(_ref) {
|
|
1003
|
+
let {
|
|
1004
|
+
checked,
|
|
1005
|
+
indeterminate,
|
|
1006
|
+
disabled
|
|
1007
|
+
} = _ref,
|
|
1008
|
+
props = _objectWithoutProperties(_ref, _excluded$f);
|
|
1029
1009
|
|
|
1030
|
-
|
|
1031
|
-
checked
|
|
1032
|
-
indeterminate
|
|
1033
|
-
disabled
|
|
1010
|
+
const pathKey = getPathKey({
|
|
1011
|
+
checked,
|
|
1012
|
+
indeterminate,
|
|
1013
|
+
disabled
|
|
1034
1014
|
});
|
|
1035
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
1015
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
1036
1016
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1037
1017
|
width: "24",
|
|
1038
1018
|
height: "24",
|
|
@@ -1046,18 +1026,20 @@ function CheckboxIcon(_ref2) {
|
|
|
1046
1026
|
|
|
1047
1027
|
var modules_664a6a80 = {"container":"_96c4d12f","disabled":"_5048e2a5","checked":"_42187b48","keyFocused":"_3510166f"};
|
|
1048
1028
|
|
|
1049
|
-
|
|
1050
|
-
|
|
1029
|
+
const _excluded$g = ["label", "disabled", "indeterminate", "defaultChecked", "onChange"];
|
|
1030
|
+
const CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref, ref) {
|
|
1051
1031
|
var _ref2, _props$checked, _props$checked2;
|
|
1052
1032
|
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1033
|
+
let {
|
|
1034
|
+
label,
|
|
1035
|
+
disabled,
|
|
1036
|
+
indeterminate,
|
|
1037
|
+
defaultChecked,
|
|
1038
|
+
onChange
|
|
1039
|
+
} = _ref,
|
|
1040
|
+
props = _objectWithoutProperties(_ref, _excluded$g);
|
|
1059
1041
|
|
|
1060
|
-
|
|
1042
|
+
const isControlledComponent = typeof props.checked === 'boolean';
|
|
1061
1043
|
|
|
1062
1044
|
if (typeof indeterminate === 'boolean' && !isControlledComponent) {
|
|
1063
1045
|
// eslint-disable-next-line no-console
|
|
@@ -1070,17 +1052,11 @@ var CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref, r
|
|
|
1070
1052
|
console.warn('A Checkbox needs a label');
|
|
1071
1053
|
}
|
|
1072
1054
|
|
|
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);
|
|
1055
|
+
const [keyFocused, setKeyFocused] = React.useState(false);
|
|
1056
|
+
const [checkedState, setChecked] = React.useState((_ref2 = (_props$checked = props.checked) != null ? _props$checked : defaultChecked) != null ? _ref2 : false);
|
|
1057
|
+
const isChecked = (_props$checked2 = props.checked) != null ? _props$checked2 : checkedState;
|
|
1058
|
+
const internalRef = React.useRef(null);
|
|
1059
|
+
const combinedRef = ariakitUtils.useForkRef(internalRef, ref);
|
|
1084
1060
|
React.useEffect(function setIndeterminate() {
|
|
1085
1061
|
if (internalRef.current && typeof indeterminate === 'boolean') {
|
|
1086
1062
|
internalRef.current.indeterminate = indeterminate;
|
|
@@ -1091,30 +1067,26 @@ var CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref, r
|
|
|
1091
1067
|
display: "flex",
|
|
1092
1068
|
alignItems: "center",
|
|
1093
1069
|
className: [modules_664a6a80.container, disabled ? modules_664a6a80.disabled : null, isChecked ? modules_664a6a80.checked : null, keyFocused ? modules_664a6a80.keyFocused : null]
|
|
1094
|
-
}, /*#__PURE__*/React.createElement("input",
|
|
1070
|
+
}, /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1095
1071
|
ref: combinedRef,
|
|
1096
1072
|
type: "checkbox",
|
|
1097
1073
|
"aria-checked": indeterminate ? 'mixed' : isChecked,
|
|
1098
1074
|
checked: isChecked,
|
|
1099
1075
|
disabled: disabled,
|
|
1100
|
-
onChange:
|
|
1101
|
-
|
|
1076
|
+
onChange: event => {
|
|
1077
|
+
onChange == null ? void 0 : onChange(event);
|
|
1102
1078
|
|
|
1103
1079
|
if (!event.defaultPrevented) {
|
|
1104
1080
|
setChecked(event.currentTarget.checked);
|
|
1105
1081
|
}
|
|
1106
1082
|
},
|
|
1107
|
-
onBlur:
|
|
1108
|
-
var _props$onBlur;
|
|
1109
|
-
|
|
1083
|
+
onBlur: event => {
|
|
1110
1084
|
setKeyFocused(false);
|
|
1111
|
-
props
|
|
1085
|
+
props == null ? void 0 : props.onBlur == null ? void 0 : props.onBlur(event);
|
|
1112
1086
|
},
|
|
1113
|
-
onKeyUp:
|
|
1114
|
-
var _props$onKeyUp;
|
|
1115
|
-
|
|
1087
|
+
onKeyUp: event => {
|
|
1116
1088
|
setKeyFocused(true);
|
|
1117
|
-
props
|
|
1089
|
+
props == null ? void 0 : props.onKeyUp == null ? void 0 : props.onKeyUp(event);
|
|
1118
1090
|
}
|
|
1119
1091
|
})), /*#__PURE__*/React.createElement(CheckboxIcon, {
|
|
1120
1092
|
checked: isChecked,
|
|
@@ -1124,18 +1096,18 @@ var CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref, r
|
|
|
1124
1096
|
}), label ? /*#__PURE__*/React.createElement(Text, null, label) : null);
|
|
1125
1097
|
});
|
|
1126
1098
|
|
|
1127
|
-
|
|
1099
|
+
let uid = 0;
|
|
1128
1100
|
|
|
1129
1101
|
function uniqueId() {
|
|
1130
1102
|
return uid++;
|
|
1131
1103
|
}
|
|
1132
1104
|
|
|
1133
1105
|
function generateElementId(prefix) {
|
|
1134
|
-
|
|
1106
|
+
const num = uniqueId();
|
|
1135
1107
|
return prefix + "-" + num;
|
|
1136
1108
|
}
|
|
1137
1109
|
function useId(providedId) {
|
|
1138
|
-
|
|
1110
|
+
const ref = React.useRef(providedId != null ? providedId : null);
|
|
1139
1111
|
|
|
1140
1112
|
if (!ref.current) {
|
|
1141
1113
|
ref.current = generateElementId('element');
|
|
@@ -1147,27 +1119,28 @@ function useId(providedId) {
|
|
|
1147
1119
|
var modules_540a88ff = {"container":"ed7d894c","primaryLabel":"_22213081","secondaryLabel":"be8637dd","auxiliaryLabel":"_72b46ad5"};
|
|
1148
1120
|
|
|
1149
1121
|
function FieldHint(props) {
|
|
1150
|
-
return /*#__PURE__*/React.createElement(Text,
|
|
1122
|
+
return /*#__PURE__*/React.createElement(Text, _objectSpread2({
|
|
1151
1123
|
as: "p",
|
|
1152
1124
|
tone: "secondary",
|
|
1153
1125
|
size: "copy"
|
|
1154
1126
|
}, props));
|
|
1155
1127
|
}
|
|
1156
1128
|
|
|
1157
|
-
function BaseField(
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1129
|
+
function BaseField({
|
|
1130
|
+
label,
|
|
1131
|
+
secondaryLabel,
|
|
1132
|
+
auxiliaryLabel,
|
|
1133
|
+
hint,
|
|
1134
|
+
className,
|
|
1135
|
+
children,
|
|
1136
|
+
maxWidth,
|
|
1137
|
+
hidden,
|
|
1138
|
+
'aria-describedby': originalAriaDescribedBy,
|
|
1139
|
+
id: originalId
|
|
1140
|
+
}) {
|
|
1141
|
+
const id = useId(originalId);
|
|
1142
|
+
const hintId = useId();
|
|
1143
|
+
const ariaDescribedBy = originalAriaDescribedBy != null ? originalAriaDescribedBy : hint ? hintId : undefined;
|
|
1171
1144
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
1172
1145
|
space: "small"
|
|
1173
1146
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
@@ -1188,14 +1161,14 @@ function BaseField(_ref) {
|
|
|
1188
1161
|
className: modules_540a88ff.primaryLabel
|
|
1189
1162
|
}, label) : null, secondaryLabel ? /*#__PURE__*/React.createElement("span", {
|
|
1190
1163
|
className: modules_540a88ff.secondaryLabel
|
|
1191
|
-
}, "\
|
|
1164
|
+
}, "\u00A0(", secondaryLabel, ")") : null), auxiliaryLabel ? /*#__PURE__*/React.createElement(Box, {
|
|
1192
1165
|
className: modules_540a88ff.auxiliaryLabel,
|
|
1193
1166
|
paddingLeft: "small"
|
|
1194
1167
|
}, auxiliaryLabel) : null), children(ariaDescribedBy ? {
|
|
1195
|
-
id
|
|
1168
|
+
id,
|
|
1196
1169
|
'aria-describedby': ariaDescribedBy
|
|
1197
1170
|
} : {
|
|
1198
|
-
id
|
|
1171
|
+
id
|
|
1199
1172
|
})), hint ? /*#__PURE__*/React.createElement(FieldHint, {
|
|
1200
1173
|
hidden: hidden,
|
|
1201
1174
|
id: hintId
|
|
@@ -1203,7 +1176,7 @@ function BaseField(_ref) {
|
|
|
1203
1176
|
}
|
|
1204
1177
|
|
|
1205
1178
|
function PasswordVisibleIcon(props) {
|
|
1206
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
1179
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
1207
1180
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1208
1181
|
width: "24",
|
|
1209
1182
|
height: "24"
|
|
@@ -1221,7 +1194,7 @@ function PasswordVisibleIcon(props) {
|
|
|
1221
1194
|
}
|
|
1222
1195
|
|
|
1223
1196
|
function PasswordHiddenIcon(props) {
|
|
1224
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
1197
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
1225
1198
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1226
1199
|
width: "24",
|
|
1227
1200
|
height: "24"
|
|
@@ -1249,34 +1222,30 @@ var modules_3f03ead6 = {"inputWrapper":"_460d581b"};
|
|
|
1249
1222
|
|
|
1250
1223
|
var modules_aaf25250 = {"inputWrapper":"dd9ffeab"};
|
|
1251
1224
|
|
|
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];
|
|
1225
|
+
const _excluded$h = ["label", "secondaryLabel", "auxiliaryLabel", "hint", "maxWidth", "togglePasswordLabel", "hidden", "aria-describedby"];
|
|
1226
|
+
const PasswordField = /*#__PURE__*/React.forwardRef(function PasswordField(_ref, ref) {
|
|
1227
|
+
let {
|
|
1228
|
+
label,
|
|
1229
|
+
secondaryLabel,
|
|
1230
|
+
auxiliaryLabel,
|
|
1231
|
+
hint,
|
|
1232
|
+
maxWidth,
|
|
1233
|
+
togglePasswordLabel = 'Toggle password visibility',
|
|
1234
|
+
hidden,
|
|
1235
|
+
'aria-describedby': ariaDescribedBy
|
|
1236
|
+
} = _ref,
|
|
1237
|
+
props = _objectWithoutProperties(_ref, _excluded$h);
|
|
1238
|
+
|
|
1239
|
+
const id = useId(props.id);
|
|
1240
|
+
const internalRef = React.useRef(null);
|
|
1241
|
+
const inputRef = ariakitUtils.useForkRef(internalRef, ref);
|
|
1242
|
+
const [isPasswordVisible, setPasswordVisible] = React.useState(false);
|
|
1272
1243
|
|
|
1273
1244
|
function togglePasswordVisibility() {
|
|
1274
1245
|
var _internalRef$current;
|
|
1275
1246
|
|
|
1276
|
-
setPasswordVisible(
|
|
1277
|
-
|
|
1278
|
-
});
|
|
1279
|
-
(_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
|
|
1247
|
+
setPasswordVisible(v => !v);
|
|
1248
|
+
(_internalRef$current = internalRef.current) == null ? void 0 : _internalRef$current.focus();
|
|
1280
1249
|
}
|
|
1281
1250
|
|
|
1282
1251
|
return /*#__PURE__*/React.createElement(BaseField, {
|
|
@@ -1288,43 +1257,43 @@ var PasswordField = /*#__PURE__*/React.forwardRef(function PasswordField(_ref, r
|
|
|
1288
1257
|
maxWidth: maxWidth,
|
|
1289
1258
|
hidden: hidden,
|
|
1290
1259
|
"aria-describedby": ariaDescribedBy
|
|
1291
|
-
},
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
}))));
|
|
1311
|
-
});
|
|
1260
|
+
}, extraProps => /*#__PURE__*/React.createElement(Box, {
|
|
1261
|
+
display: "flex",
|
|
1262
|
+
alignItems: "center",
|
|
1263
|
+
className: [modules_3f03ead6.inputWrapper, modules_aaf25250.inputWrapper]
|
|
1264
|
+
}, /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2(_objectSpread2({}, props), extraProps), {}, {
|
|
1265
|
+
ref: inputRef,
|
|
1266
|
+
type: isPasswordVisible ? 'text' : 'password'
|
|
1267
|
+
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
1268
|
+
content: togglePasswordLabel
|
|
1269
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
1270
|
+
type: "button",
|
|
1271
|
+
onClick: togglePasswordVisibility,
|
|
1272
|
+
"aria-label": togglePasswordLabel,
|
|
1273
|
+
tabIndex: -1
|
|
1274
|
+
}, isPasswordVisible ? /*#__PURE__*/React.createElement(PasswordVisibleIcon, {
|
|
1275
|
+
"aria-hidden": true
|
|
1276
|
+
}) : /*#__PURE__*/React.createElement(PasswordHiddenIcon, {
|
|
1277
|
+
"aria-hidden": true
|
|
1278
|
+
})))));
|
|
1312
1279
|
});
|
|
1313
1280
|
|
|
1314
1281
|
var modules_1fa9b208 = {"selectWrapper":"_828e09c5"};
|
|
1315
1282
|
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1283
|
+
const _excluded$i = ["id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "maxWidth", "children", "hidden", "aria-describedby"];
|
|
1284
|
+
const SelectField = /*#__PURE__*/React.forwardRef(function SelectField(_ref, ref) {
|
|
1285
|
+
let {
|
|
1286
|
+
id,
|
|
1287
|
+
label,
|
|
1288
|
+
secondaryLabel,
|
|
1289
|
+
auxiliaryLabel,
|
|
1290
|
+
hint,
|
|
1291
|
+
maxWidth,
|
|
1292
|
+
children,
|
|
1293
|
+
hidden,
|
|
1294
|
+
'aria-describedby': ariaDescribedBy
|
|
1295
|
+
} = _ref,
|
|
1296
|
+
props = _objectWithoutProperties(_ref, _excluded$i);
|
|
1328
1297
|
|
|
1329
1298
|
return /*#__PURE__*/React.createElement(BaseField, {
|
|
1330
1299
|
id: id,
|
|
@@ -1335,19 +1304,17 @@ var SelectField = /*#__PURE__*/React.forwardRef(function SelectField(_ref, ref)
|
|
|
1335
1304
|
maxWidth: maxWidth,
|
|
1336
1305
|
hidden: hidden,
|
|
1337
1306
|
"aria-describedby": ariaDescribedBy
|
|
1338
|
-
},
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
}));
|
|
1346
|
-
});
|
|
1307
|
+
}, extraProps => /*#__PURE__*/React.createElement(Box, {
|
|
1308
|
+
className: modules_1fa9b208.selectWrapper
|
|
1309
|
+
}, /*#__PURE__*/React.createElement("select", _objectSpread2(_objectSpread2(_objectSpread2({}, props), extraProps), {}, {
|
|
1310
|
+
ref: ref
|
|
1311
|
+
}), children), /*#__PURE__*/React.createElement(SelectChevron, {
|
|
1312
|
+
"aria-hidden": true
|
|
1313
|
+
})));
|
|
1347
1314
|
});
|
|
1348
1315
|
|
|
1349
1316
|
function SelectChevron(props) {
|
|
1350
|
-
return /*#__PURE__*/React.createElement("svg",
|
|
1317
|
+
return /*#__PURE__*/React.createElement("svg", _objectSpread2({
|
|
1351
1318
|
width: "16",
|
|
1352
1319
|
height: "16",
|
|
1353
1320
|
fill: "none",
|
|
@@ -1360,38 +1327,32 @@ function SelectChevron(props) {
|
|
|
1360
1327
|
|
|
1361
1328
|
var modules_8e05f7c9 = {"container":"ec63c3f1","disabled":"_7de9c06d","checked":"a37981fc","toggle":"_2a17ac45","label":"_68cc9707","handle":"_91409c7f","keyFocused":"a6490371"};
|
|
1362
1329
|
|
|
1363
|
-
|
|
1364
|
-
|
|
1330
|
+
const _excluded$j = ["label", "hint", "disabled", "hidden", "defaultChecked", "id", "aria-describedby", "aria-label", "aria-labelledby", "onChange"];
|
|
1331
|
+
const SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref) {
|
|
1365
1332
|
var _ref2, _props$checked, _props$checked2;
|
|
1366
1333
|
|
|
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;
|
|
1334
|
+
let {
|
|
1335
|
+
label,
|
|
1336
|
+
hint,
|
|
1337
|
+
disabled = false,
|
|
1338
|
+
hidden,
|
|
1339
|
+
defaultChecked,
|
|
1340
|
+
id: originalId,
|
|
1341
|
+
'aria-describedby': originalAriaDescribedBy,
|
|
1342
|
+
'aria-label': originalAriaLabel,
|
|
1343
|
+
'aria-labelledby': originalAriaLabelledby,
|
|
1344
|
+
onChange
|
|
1345
|
+
} = _ref,
|
|
1346
|
+
props = _objectWithoutProperties(_ref, _excluded$j);
|
|
1347
|
+
|
|
1348
|
+
const id = useId(originalId);
|
|
1349
|
+
const hintId = useId();
|
|
1350
|
+
const ariaDescribedBy = originalAriaDescribedBy != null ? originalAriaDescribedBy : hint ? hintId : undefined;
|
|
1351
|
+
const ariaLabel = originalAriaLabel != null ? originalAriaLabel : undefined;
|
|
1352
|
+
const ariaLabelledBy = originalAriaLabelledby != null ? originalAriaLabelledby : undefined;
|
|
1353
|
+
const [keyFocused, setKeyFocused] = React.useState(false);
|
|
1354
|
+
const [checkedState, setChecked] = React.useState((_ref2 = (_props$checked = props.checked) != null ? _props$checked : defaultChecked) != null ? _ref2 : false);
|
|
1355
|
+
const isChecked = (_props$checked2 = props.checked) != null ? _props$checked2 : checkedState;
|
|
1395
1356
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
1396
1357
|
space: "small",
|
|
1397
1358
|
hidden: hidden
|
|
@@ -1407,7 +1368,7 @@ var SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref)
|
|
|
1407
1368
|
marginRight: "small",
|
|
1408
1369
|
flexShrink: 0,
|
|
1409
1370
|
className: modules_8e05f7c9.toggle
|
|
1410
|
-
}, /*#__PURE__*/React.createElement(HiddenVisually, null, /*#__PURE__*/React.createElement("input",
|
|
1371
|
+
}, /*#__PURE__*/React.createElement(HiddenVisually, null, /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1411
1372
|
id: id,
|
|
1412
1373
|
type: "checkbox",
|
|
1413
1374
|
disabled: disabled,
|
|
@@ -1416,24 +1377,20 @@ var SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref)
|
|
|
1416
1377
|
"aria-labelledby": ariaLabelledBy,
|
|
1417
1378
|
ref: ref,
|
|
1418
1379
|
checked: isChecked,
|
|
1419
|
-
onChange:
|
|
1420
|
-
|
|
1380
|
+
onChange: event => {
|
|
1381
|
+
onChange == null ? void 0 : onChange(event);
|
|
1421
1382
|
|
|
1422
1383
|
if (!event.defaultPrevented) {
|
|
1423
1384
|
setChecked(event.currentTarget.checked);
|
|
1424
1385
|
}
|
|
1425
1386
|
},
|
|
1426
|
-
onBlur:
|
|
1427
|
-
var _props$onBlur;
|
|
1428
|
-
|
|
1387
|
+
onBlur: event => {
|
|
1429
1388
|
setKeyFocused(false);
|
|
1430
|
-
props
|
|
1389
|
+
props == null ? void 0 : props.onBlur == null ? void 0 : props.onBlur(event);
|
|
1431
1390
|
},
|
|
1432
|
-
onKeyUp:
|
|
1433
|
-
var _props$onKeyUp;
|
|
1434
|
-
|
|
1391
|
+
onKeyUp: event => {
|
|
1435
1392
|
setKeyFocused(true);
|
|
1436
|
-
props
|
|
1393
|
+
props == null ? void 0 : props.onKeyUp == null ? void 0 : props.onKeyUp(event);
|
|
1437
1394
|
}
|
|
1438
1395
|
}))), /*#__PURE__*/React.createElement("span", {
|
|
1439
1396
|
className: modules_8e05f7c9.handle
|
|
@@ -1446,16 +1403,18 @@ var SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref)
|
|
|
1446
1403
|
|
|
1447
1404
|
var modules_2728c236 = {"container":"_5a579f96"};
|
|
1448
1405
|
|
|
1449
|
-
|
|
1406
|
+
const _excluded$k = ["id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "maxWidth"];
|
|
1450
1407
|
|
|
1451
1408
|
function TextArea(_ref) {
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1409
|
+
let {
|
|
1410
|
+
id,
|
|
1411
|
+
label,
|
|
1412
|
+
secondaryLabel,
|
|
1413
|
+
auxiliaryLabel,
|
|
1414
|
+
hint,
|
|
1415
|
+
maxWidth
|
|
1416
|
+
} = _ref,
|
|
1417
|
+
props = _objectWithoutProperties(_ref, _excluded$k);
|
|
1459
1418
|
|
|
1460
1419
|
return /*#__PURE__*/React.createElement(BaseField, {
|
|
1461
1420
|
id: id,
|
|
@@ -1465,26 +1424,25 @@ function TextArea(_ref) {
|
|
|
1465
1424
|
hint: hint,
|
|
1466
1425
|
className: modules_2728c236.container,
|
|
1467
1426
|
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);
|
|
1427
|
+
}, extraProps => /*#__PURE__*/React.createElement(Box, {
|
|
1428
|
+
width: "full"
|
|
1429
|
+
}, /*#__PURE__*/React.createElement("textarea", _objectSpread2(_objectSpread2({}, props), extraProps))));
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
const _excluded$l = ["id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "type", "maxWidth", "hidden", "aria-describedby"];
|
|
1433
|
+
const TextField = /*#__PURE__*/React.forwardRef(function TextField(_ref, ref) {
|
|
1434
|
+
let {
|
|
1435
|
+
id,
|
|
1436
|
+
label,
|
|
1437
|
+
secondaryLabel,
|
|
1438
|
+
auxiliaryLabel,
|
|
1439
|
+
hint,
|
|
1440
|
+
type = 'text',
|
|
1441
|
+
maxWidth,
|
|
1442
|
+
hidden,
|
|
1443
|
+
'aria-describedby': ariaDescribedBy
|
|
1444
|
+
} = _ref,
|
|
1445
|
+
props = _objectWithoutProperties(_ref, _excluded$l);
|
|
1488
1446
|
|
|
1489
1447
|
return /*#__PURE__*/React.createElement(BaseField, {
|
|
1490
1448
|
id: id,
|
|
@@ -1495,14 +1453,12 @@ var TextField = /*#__PURE__*/React.forwardRef(function TextField(_ref, ref) {
|
|
|
1495
1453
|
maxWidth: maxWidth,
|
|
1496
1454
|
hidden: hidden,
|
|
1497
1455
|
"aria-describedby": ariaDescribedBy
|
|
1498
|
-
},
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
})));
|
|
1505
|
-
});
|
|
1456
|
+
}, extraProps => /*#__PURE__*/React.createElement(Box, {
|
|
1457
|
+
className: modules_aaf25250.inputWrapper
|
|
1458
|
+
}, /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2(_objectSpread2({}, props), extraProps), {}, {
|
|
1459
|
+
type: type,
|
|
1460
|
+
ref: ref
|
|
1461
|
+
}))));
|
|
1506
1462
|
});
|
|
1507
1463
|
|
|
1508
1464
|
/**
|
|
@@ -1520,52 +1476,52 @@ var TextField = /*#__PURE__*/React.forwardRef(function TextField(_ref, ref) {
|
|
|
1520
1476
|
*/
|
|
1521
1477
|
|
|
1522
1478
|
function usePrevious(value) {
|
|
1523
|
-
|
|
1524
|
-
React.useEffect(
|
|
1479
|
+
const ref = React.useRef(null);
|
|
1480
|
+
React.useEffect(() => {
|
|
1525
1481
|
ref.current = value;
|
|
1526
1482
|
}, [value]);
|
|
1527
1483
|
return ref.current;
|
|
1528
1484
|
}
|
|
1529
1485
|
|
|
1530
|
-
var modules_40c67f5b = {"tab":"
|
|
1486
|
+
var modules_40c67f5b = {"tab":"_15d4bbf4","tab-normal":"ca31866d","tab-primary":"_421272bd","tab-secondary":"acbdf95a","tab-tertiary":"_8c59ab40","tab-plain":"a41904c9"};
|
|
1531
1487
|
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
_excluded5 = ["color", "variant"];
|
|
1537
|
-
var TabsContext = /*#__PURE__*/React.createContext(null);
|
|
1488
|
+
const _excluded$m = ["as", "children", "id", "exceptionallySetClassName"],
|
|
1489
|
+
_excluded2$1 = ["children", "space"],
|
|
1490
|
+
_excluded3 = ["children", "id", "as", "render"];
|
|
1491
|
+
const TabsContext = /*#__PURE__*/React.createContext(null);
|
|
1538
1492
|
/**
|
|
1539
1493
|
* Used to group components that compose a set of tabs. There can only be one active tab within the same `<Tabs>` group.
|
|
1540
1494
|
*/
|
|
1541
1495
|
|
|
1542
|
-
function Tabs(
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1496
|
+
function Tabs({
|
|
1497
|
+
children,
|
|
1498
|
+
selectedId,
|
|
1499
|
+
defaultSelectedId,
|
|
1500
|
+
color = 'primary',
|
|
1501
|
+
variant = 'normal',
|
|
1502
|
+
onSelectedIdChange
|
|
1503
|
+
}) {
|
|
1504
|
+
const tabState = tab.useTabState({
|
|
1505
|
+
selectedId,
|
|
1506
|
+
setSelectedId: onSelectedIdChange
|
|
1551
1507
|
});
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1508
|
+
const previousDefaultSelectedId = usePrevious(defaultSelectedId);
|
|
1509
|
+
const {
|
|
1510
|
+
selectedId: actualSelectedId,
|
|
1511
|
+
select
|
|
1512
|
+
} = tabState;
|
|
1513
|
+
React.useEffect(function selectDefaultTab() {
|
|
1514
|
+
if (!selectedId && defaultSelectedId !== previousDefaultSelectedId && defaultSelectedId !== actualSelectedId && defaultSelectedId !== undefined) {
|
|
1515
|
+
select(defaultSelectedId);
|
|
1558
1516
|
}
|
|
1559
|
-
}, [selectedId, actualSelectedId, select,
|
|
1560
|
-
|
|
1561
|
-
return
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
// eslint-disable-next-line
|
|
1568
|
-
[color, variant].concat(Object.values(tabState)));
|
|
1517
|
+
}, [selectedId, defaultSelectedId, actualSelectedId, select, previousDefaultSelectedId]);
|
|
1518
|
+
const memoizedTabState = React.useMemo(function memoizeTabState() {
|
|
1519
|
+
return {
|
|
1520
|
+
tabState,
|
|
1521
|
+
color,
|
|
1522
|
+
variant
|
|
1523
|
+
};
|
|
1524
|
+
}, [color, variant, tabState]);
|
|
1569
1525
|
return /*#__PURE__*/React.createElement(TabsContext.Provider, {
|
|
1570
1526
|
value: memoizedTabState
|
|
1571
1527
|
}, children);
|
|
@@ -1574,43 +1530,57 @@ function Tabs(_ref) {
|
|
|
1574
1530
|
* Represents the individual tab elements within the group. Each `<Tab>` must have a corresponding `<TabPanel>` component.
|
|
1575
1531
|
*/
|
|
1576
1532
|
|
|
1577
|
-
function Tab(
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1533
|
+
const Tab = /*#__PURE__*/polymorphicComponent(function Tab(_ref, ref) {
|
|
1534
|
+
let {
|
|
1535
|
+
as,
|
|
1536
|
+
children,
|
|
1537
|
+
id,
|
|
1538
|
+
exceptionallySetClassName
|
|
1539
|
+
} = _ref,
|
|
1540
|
+
props = _objectWithoutProperties(_ref, _excluded$m);
|
|
1541
|
+
|
|
1542
|
+
const tabContextValue = React.useContext(TabsContext);
|
|
1581
1543
|
|
|
1582
1544
|
if (!tabContextValue) {
|
|
1583
1545
|
return null;
|
|
1584
1546
|
}
|
|
1585
1547
|
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1548
|
+
const {
|
|
1549
|
+
color,
|
|
1550
|
+
variant,
|
|
1551
|
+
tabState
|
|
1552
|
+
} = tabContextValue;
|
|
1553
|
+
return /*#__PURE__*/React.createElement(tab.Tab, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1554
|
+
as: as,
|
|
1555
|
+
className: classNames(exceptionallySetClassName, modules_40c67f5b.tab, modules_40c67f5b["tab-" + (variant != null ? variant : '')], modules_40c67f5b["tab-" + (color != null ? color : '')]),
|
|
1556
|
+
id: id,
|
|
1557
|
+
state: tabState,
|
|
1558
|
+
ref: ref
|
|
1559
|
+
}), children);
|
|
1560
|
+
});
|
|
1595
1561
|
/**
|
|
1596
1562
|
* A component used to group `<Tab>` elements together.
|
|
1597
1563
|
*/
|
|
1598
1564
|
|
|
1599
|
-
function TabList(
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1565
|
+
function TabList(_ref2) {
|
|
1566
|
+
let {
|
|
1567
|
+
children,
|
|
1568
|
+
space = 'medium'
|
|
1569
|
+
} = _ref2,
|
|
1570
|
+
props = _objectWithoutProperties(_ref2, _excluded2$1);
|
|
1604
1571
|
|
|
1605
|
-
|
|
1572
|
+
const tabContextValue = React.useContext(TabsContext);
|
|
1606
1573
|
|
|
1607
1574
|
if (!tabContextValue) {
|
|
1608
1575
|
return null;
|
|
1609
1576
|
}
|
|
1610
1577
|
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1578
|
+
const {
|
|
1579
|
+
tabState
|
|
1580
|
+
} = tabContextValue;
|
|
1581
|
+
return /*#__PURE__*/React.createElement(tab.TabList, _objectSpread2({
|
|
1582
|
+
state: tabState
|
|
1583
|
+
}, props), /*#__PURE__*/React.createElement(Inline, {
|
|
1614
1584
|
space: space
|
|
1615
1585
|
}, children));
|
|
1616
1586
|
}
|
|
@@ -1618,21 +1588,18 @@ function TabList(_ref3) {
|
|
|
1618
1588
|
* Used to define the content to be rendered when a tab is active. Each `<TabPanel>` must have a corresponding `<Tab>` component.
|
|
1619
1589
|
*/
|
|
1620
1590
|
|
|
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;
|
|
1591
|
+
const TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref3, ref) {
|
|
1592
|
+
let {
|
|
1593
|
+
children,
|
|
1594
|
+
id,
|
|
1595
|
+
as,
|
|
1596
|
+
render = 'always'
|
|
1597
|
+
} = _ref3,
|
|
1598
|
+
props = _objectWithoutProperties(_ref3, _excluded3);
|
|
1599
|
+
|
|
1600
|
+
const tabContextValue = React.useContext(TabsContext);
|
|
1601
|
+
const [tabRendered, setTabRendered] = React.useState(false);
|
|
1602
|
+
const tabIsActive = (tabContextValue == null ? void 0 : tabContextValue.tabState.selectedId) === id;
|
|
1636
1603
|
React.useEffect(function trackTabRenderedState() {
|
|
1637
1604
|
if (!tabRendered && tabIsActive) {
|
|
1638
1605
|
setTabRendered(true);
|
|
@@ -1643,11 +1610,13 @@ var TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref4, ref) {
|
|
|
1643
1610
|
return null;
|
|
1644
1611
|
}
|
|
1645
1612
|
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1613
|
+
const {
|
|
1614
|
+
tabState
|
|
1615
|
+
} = tabContextValue;
|
|
1616
|
+
return /*#__PURE__*/React.createElement(tab.TabPanel, _objectSpread2(_objectSpread2({
|
|
1649
1617
|
tabId: id
|
|
1650
|
-
},
|
|
1618
|
+
}, props), {}, {
|
|
1619
|
+
state: tabState,
|
|
1651
1620
|
as: as,
|
|
1652
1621
|
ref: ref
|
|
1653
1622
|
}), render === 'always' ? children : null, render === 'active' && tabIsActive ? children : null, render === 'lazy' && (tabIsActive || tabRendered) ? children : null);
|
|
@@ -1657,22 +1626,23 @@ var TabPanel = /*#__PURE__*/polymorphicComponent(function TabPanel(_ref4, ref) {
|
|
|
1657
1626
|
* component. Can be placed freely within the main `<Tabs>` component.
|
|
1658
1627
|
*/
|
|
1659
1628
|
|
|
1660
|
-
function TabAwareSlot(
|
|
1661
|
-
|
|
1662
|
-
|
|
1629
|
+
function TabAwareSlot({
|
|
1630
|
+
children
|
|
1631
|
+
}) {
|
|
1632
|
+
const tabContextValue = React.useContext(TabsContext);
|
|
1663
1633
|
return tabContextValue ? children({
|
|
1664
|
-
selectedId: tabContextValue.selectedId
|
|
1634
|
+
selectedId: tabContextValue == null ? void 0 : tabContextValue.tabState.selectedId
|
|
1665
1635
|
}) : null;
|
|
1666
1636
|
}
|
|
1667
1637
|
|
|
1668
1638
|
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
1639
|
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1640
|
+
const _excluded$n = ["isOpen", "onDismiss", "height", "width", "exceptionallySetClassName", "autoFocus", "children"],
|
|
1641
|
+
_excluded2$2 = ["children", "button", "withDivider", "exceptionallySetClassName"],
|
|
1642
|
+
_excluded3$1 = ["exceptionallySetClassName", "children"],
|
|
1643
|
+
_excluded4 = ["exceptionallySetClassName", "withDivider"],
|
|
1644
|
+
_excluded5 = ["children"];
|
|
1645
|
+
const ModalContext = /*#__PURE__*/React.createContext({
|
|
1676
1646
|
onDismiss: undefined,
|
|
1677
1647
|
height: 'fitContent'
|
|
1678
1648
|
});
|
|
@@ -1692,24 +1662,21 @@ function isNotInternalFrame(element) {
|
|
|
1692
1662
|
|
|
1693
1663
|
|
|
1694
1664
|
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]);
|
|
1665
|
+
let {
|
|
1666
|
+
isOpen,
|
|
1667
|
+
onDismiss,
|
|
1668
|
+
height = 'fitContent',
|
|
1669
|
+
width = 'medium',
|
|
1670
|
+
exceptionallySetClassName,
|
|
1671
|
+
autoFocus = true,
|
|
1672
|
+
children
|
|
1673
|
+
} = _ref,
|
|
1674
|
+
props = _objectWithoutProperties(_ref, _excluded$n);
|
|
1675
|
+
|
|
1676
|
+
const contextValue = React.useMemo(() => ({
|
|
1677
|
+
onDismiss,
|
|
1678
|
+
height
|
|
1679
|
+
}), [onDismiss, height]);
|
|
1713
1680
|
return /*#__PURE__*/React.createElement(dialog.DialogOverlay, {
|
|
1714
1681
|
isOpen: isOpen,
|
|
1715
1682
|
onDismiss: onDismiss,
|
|
@@ -1721,7 +1688,7 @@ function Modal(_ref) {
|
|
|
1721
1688
|
autoFocus: autoFocus,
|
|
1722
1689
|
whiteList: isNotInternalFrame,
|
|
1723
1690
|
returnFocus: true
|
|
1724
|
-
}, /*#__PURE__*/React.createElement(dialog.DialogContent,
|
|
1691
|
+
}, /*#__PURE__*/React.createElement(dialog.DialogContent, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1725
1692
|
as: Box,
|
|
1726
1693
|
borderRadius: "full",
|
|
1727
1694
|
background: "default",
|
|
@@ -1743,17 +1710,11 @@ function Modal(_ref) {
|
|
|
1743
1710
|
*/
|
|
1744
1711
|
|
|
1745
1712
|
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
|
-
|
|
1713
|
+
const {
|
|
1714
|
+
onDismiss
|
|
1715
|
+
} = React.useContext(ModalContext);
|
|
1716
|
+
const [includeInTabOrder, setIncludeInTabOrder] = React.useState(false);
|
|
1717
|
+
const [isMounted, setIsMounted] = React.useState(false);
|
|
1757
1718
|
React.useEffect(function skipAutoFocus() {
|
|
1758
1719
|
if (isMounted) {
|
|
1759
1720
|
setIncludeInTabOrder(true);
|
|
@@ -1761,7 +1722,7 @@ function ModalCloseButton(props) {
|
|
|
1761
1722
|
setIsMounted(true);
|
|
1762
1723
|
}
|
|
1763
1724
|
}, [isMounted]);
|
|
1764
|
-
return /*#__PURE__*/React.createElement(Button,
|
|
1725
|
+
return /*#__PURE__*/React.createElement(Button, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1765
1726
|
variant: "quaternary",
|
|
1766
1727
|
onClick: onDismiss,
|
|
1767
1728
|
icon: /*#__PURE__*/React.createElement(CloseIcon, null),
|
|
@@ -1777,15 +1738,15 @@ function ModalCloseButton(props) {
|
|
|
1777
1738
|
*/
|
|
1778
1739
|
|
|
1779
1740
|
function ModalHeader(_ref2) {
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
props =
|
|
1787
|
-
|
|
1788
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box,
|
|
1741
|
+
let {
|
|
1742
|
+
children,
|
|
1743
|
+
button = true,
|
|
1744
|
+
withDivider = false,
|
|
1745
|
+
exceptionallySetClassName
|
|
1746
|
+
} = _ref2,
|
|
1747
|
+
props = _objectWithoutProperties(_ref2, _excluded2$2);
|
|
1748
|
+
|
|
1749
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1789
1750
|
as: "header",
|
|
1790
1751
|
paddingLeft: "large",
|
|
1791
1752
|
paddingRight: button === false || button === null ? 'large' : 'small',
|
|
@@ -1821,14 +1782,16 @@ function ModalHeader(_ref2) {
|
|
|
1821
1782
|
*/
|
|
1822
1783
|
|
|
1823
1784
|
function ModalBody(_ref3) {
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1785
|
+
let {
|
|
1786
|
+
exceptionallySetClassName,
|
|
1787
|
+
children
|
|
1788
|
+
} = _ref3,
|
|
1789
|
+
props = _objectWithoutProperties(_ref3, _excluded3$1);
|
|
1790
|
+
|
|
1791
|
+
const {
|
|
1792
|
+
height
|
|
1793
|
+
} = React.useContext(ModalContext);
|
|
1794
|
+
return /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1832
1795
|
className: exceptionallySetClassName,
|
|
1833
1796
|
flexGrow: height === 'expand' ? 1 : 0,
|
|
1834
1797
|
height: height === 'expand' ? 'full' : undefined,
|
|
@@ -1847,14 +1810,15 @@ function ModalBody(_ref3) {
|
|
|
1847
1810
|
*/
|
|
1848
1811
|
|
|
1849
1812
|
function ModalFooter(_ref4) {
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1813
|
+
let {
|
|
1814
|
+
exceptionallySetClassName,
|
|
1815
|
+
withDivider = false
|
|
1816
|
+
} = _ref4,
|
|
1817
|
+
props = _objectWithoutProperties(_ref4, _excluded4);
|
|
1854
1818
|
|
|
1855
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, withDivider ? /*#__PURE__*/React.createElement(Divider, null) : null, /*#__PURE__*/React.createElement(Box,
|
|
1819
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, withDivider ? /*#__PURE__*/React.createElement(Divider, null) : null, /*#__PURE__*/React.createElement(Box, _objectSpread2(_objectSpread2({
|
|
1856
1820
|
as: "footer"
|
|
1857
|
-
}, props, {
|
|
1821
|
+
}, props), {}, {
|
|
1858
1822
|
className: exceptionallySetClassName,
|
|
1859
1823
|
padding: "large"
|
|
1860
1824
|
})));
|
|
@@ -1865,65 +1829,71 @@ function ModalFooter(_ref4) {
|
|
|
1865
1829
|
*/
|
|
1866
1830
|
|
|
1867
1831
|
function ModalActions(_ref5) {
|
|
1868
|
-
|
|
1869
|
-
|
|
1832
|
+
let {
|
|
1833
|
+
children
|
|
1834
|
+
} = _ref5,
|
|
1835
|
+
props = _objectWithoutProperties(_ref5, _excluded5);
|
|
1870
1836
|
|
|
1871
|
-
return /*#__PURE__*/React.createElement(ModalFooter,
|
|
1837
|
+
return /*#__PURE__*/React.createElement(ModalFooter, _objectSpread2({}, props), /*#__PURE__*/React.createElement(Inline, {
|
|
1872
1838
|
align: "right",
|
|
1873
1839
|
space: "large"
|
|
1874
1840
|
}, children));
|
|
1875
1841
|
}
|
|
1876
1842
|
|
|
1877
1843
|
function getInitials(name) {
|
|
1844
|
+
var _initials;
|
|
1845
|
+
|
|
1878
1846
|
if (!name) {
|
|
1879
1847
|
return '';
|
|
1880
1848
|
}
|
|
1881
1849
|
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
|
1850
|
+
const seed = name.trim().split(' ');
|
|
1851
|
+
const firstInitial = seed[0];
|
|
1852
|
+
const lastInitial = seed[seed.length - 1];
|
|
1853
|
+
let initials = firstInitial == null ? void 0 : firstInitial[0];
|
|
1887
1854
|
|
|
1888
|
-
if (firstInitial
|
|
1855
|
+
if (firstInitial != null && lastInitial != null && initials != null && // Better readable this way.
|
|
1856
|
+
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
|
1857
|
+
firstInitial[0] !== lastInitial[0]) {
|
|
1889
1858
|
initials += lastInitial[0];
|
|
1890
1859
|
}
|
|
1891
1860
|
|
|
1892
|
-
return initials.toUpperCase();
|
|
1861
|
+
return (_initials = initials) == null ? void 0 : _initials.toUpperCase();
|
|
1893
1862
|
}
|
|
1894
1863
|
|
|
1895
1864
|
function emailToIndex(email, maxIndex) {
|
|
1896
|
-
|
|
1897
|
-
|
|
1865
|
+
const seed = email.split('@')[0];
|
|
1866
|
+
const hash = seed ? seed.charCodeAt(0) + seed.charCodeAt(seed.length - 1) || 0 : 0;
|
|
1898
1867
|
return hash % maxIndex;
|
|
1899
1868
|
}
|
|
1900
1869
|
|
|
1901
1870
|
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"};
|
|
1902
1871
|
|
|
1903
|
-
|
|
1904
|
-
|
|
1872
|
+
const _excluded$o = ["user", "avatarUrl", "size", "className", "colorList", "exceptionallySetClassName"];
|
|
1873
|
+
const AVATAR_COLORS = ['#fcc652', '#e9952c', '#e16b2d', '#d84b40', '#e8435a', '#e5198a', '#ad3889', '#86389c', '#a8a8a8', '#98be2f', '#5d9d50', '#5f9f85', '#5bbcb6', '#32a3bf', '#2bafeb', '#2d88c3', '#3863cc', '#5e5e5e'];
|
|
1905
1874
|
|
|
1906
1875
|
function Avatar(_ref) {
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
props =
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1876
|
+
let {
|
|
1877
|
+
user,
|
|
1878
|
+
avatarUrl,
|
|
1879
|
+
size = 'l',
|
|
1880
|
+
className,
|
|
1881
|
+
colorList = AVATAR_COLORS,
|
|
1882
|
+
exceptionallySetClassName
|
|
1883
|
+
} = _ref,
|
|
1884
|
+
props = _objectWithoutProperties(_ref, _excluded$o);
|
|
1885
|
+
|
|
1886
|
+
const userInitials = getInitials(user.name) || getInitials(user.email);
|
|
1887
|
+
const avatarSize = size ? size : 'l';
|
|
1888
|
+
const style = avatarUrl ? {
|
|
1920
1889
|
backgroundImage: "url(" + avatarUrl + ")",
|
|
1921
|
-
textIndent: '-9999px'
|
|
1890
|
+
textIndent: '-9999px' // hide the initials
|
|
1891
|
+
|
|
1922
1892
|
} : {
|
|
1923
1893
|
backgroundColor: colorList[emailToIndex(user.email, colorList.length)]
|
|
1924
1894
|
};
|
|
1925
|
-
|
|
1926
|
-
return /*#__PURE__*/React__default.createElement(Box,
|
|
1895
|
+
const sizeClassName = getClassNames(modules_08f3eeac, 'size', avatarSize);
|
|
1896
|
+
return /*#__PURE__*/React__default.createElement(Box, _objectSpread2({
|
|
1927
1897
|
className: [className, modules_08f3eeac.avatar, sizeClassName, exceptionallySetClassName],
|
|
1928
1898
|
style: style
|
|
1929
1899
|
}, props), userInitials);
|
|
@@ -1931,12 +1901,12 @@ function Avatar(_ref) {
|
|
|
1931
1901
|
|
|
1932
1902
|
Avatar.displayName = 'Avatar';
|
|
1933
1903
|
|
|
1934
|
-
function Checkbox(
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1904
|
+
function Checkbox({
|
|
1905
|
+
label,
|
|
1906
|
+
disabled,
|
|
1907
|
+
checked = false,
|
|
1908
|
+
onChange
|
|
1909
|
+
}) {
|
|
1940
1910
|
return /*#__PURE__*/React__default.createElement("label", {
|
|
1941
1911
|
className: "reactist_checkbox"
|
|
1942
1912
|
}, /*#__PURE__*/React__default.createElement("input", {
|
|
@@ -1944,39 +1914,35 @@ function Checkbox(_ref) {
|
|
|
1944
1914
|
value: label,
|
|
1945
1915
|
checked: checked,
|
|
1946
1916
|
disabled: disabled,
|
|
1947
|
-
onChange: disabled || !onChange ? undefined :
|
|
1948
|
-
return onChange(event.target.checked);
|
|
1949
|
-
},
|
|
1917
|
+
onChange: disabled || !onChange ? undefined : event => onChange(event.target.checked),
|
|
1950
1918
|
type: "checkbox"
|
|
1951
1919
|
}), label);
|
|
1952
1920
|
}
|
|
1953
1921
|
|
|
1954
1922
|
Checkbox.displayName = 'Checkbox';
|
|
1955
1923
|
|
|
1956
|
-
|
|
1924
|
+
const _excluded$p = ["type", "variant", "size", "loading", "disabled", "tooltip", "onClick", "children"];
|
|
1957
1925
|
/**
|
|
1958
1926
|
* @deprecated
|
|
1959
1927
|
*/
|
|
1960
1928
|
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
var className = classNames('reactist_button', variant ? "reactist_button--" + variant : null, size !== 'default' ? "reactist_button--" + size : null, {
|
|
1929
|
+
const Button$1 = /*#__PURE__*/React__default.forwardRef(function Button(_ref, ref) {
|
|
1930
|
+
let {
|
|
1931
|
+
type = 'button',
|
|
1932
|
+
variant,
|
|
1933
|
+
size = 'default',
|
|
1934
|
+
loading = false,
|
|
1935
|
+
disabled = false,
|
|
1936
|
+
tooltip,
|
|
1937
|
+
onClick,
|
|
1938
|
+
children
|
|
1939
|
+
} = _ref,
|
|
1940
|
+
props = _objectWithoutProperties(_ref, _excluded$p);
|
|
1941
|
+
|
|
1942
|
+
const className = classNames('reactist_button', variant ? "reactist_button--" + variant : null, size !== 'default' ? "reactist_button--" + size : null, {
|
|
1977
1943
|
'reactist_button--loading': loading
|
|
1978
1944
|
}, props.className);
|
|
1979
|
-
|
|
1945
|
+
const button = /*#__PURE__*/React__default.createElement("button", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1980
1946
|
ref: ref,
|
|
1981
1947
|
type: type,
|
|
1982
1948
|
className: className,
|
|
@@ -1994,159 +1960,159 @@ Button$1.defaultProps = {
|
|
|
1994
1960
|
disabled: false
|
|
1995
1961
|
};
|
|
1996
1962
|
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
var Box$1 = /*#__PURE__*/function (_React$Component) {
|
|
2000
|
-
_inheritsLoose(Box, _React$Component);
|
|
2001
|
-
|
|
2002
|
-
function Box(props, context) {
|
|
2003
|
-
var _this;
|
|
1963
|
+
const _excluded$q = ["children", "onClick", "tooltip", "className"];
|
|
2004
1964
|
|
|
2005
|
-
|
|
1965
|
+
class Box$1 extends React__default.Component {
|
|
1966
|
+
constructor(props, context) {
|
|
1967
|
+
super(props, context);
|
|
1968
|
+
this._timeout = void 0;
|
|
2006
1969
|
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
if (dropdownDOMNode && !dropdownDOMNode.contains(event.target))
|
|
1970
|
+
this._handleClickOutside = event => {
|
|
1971
|
+
const dropdownDOMNode = ReactDOM.findDOMNode(this);
|
|
1972
|
+
if (dropdownDOMNode && !dropdownDOMNode.contains(event.target)) this._toggleShowBody();else if (!this.props.allowBodyInteractions) {
|
|
2010
1973
|
// won't close when body interactions are allowed
|
|
2011
|
-
|
|
2012
|
-
if (
|
|
2013
|
-
|
|
1974
|
+
this._timeout = setTimeout(() => {
|
|
1975
|
+
if (this.state.showBody) {
|
|
1976
|
+
this._toggleShowBody();
|
|
2014
1977
|
}
|
|
2015
1978
|
}, 100);
|
|
2016
1979
|
}
|
|
2017
1980
|
};
|
|
2018
1981
|
|
|
2019
|
-
|
|
2020
|
-
if (!
|
|
1982
|
+
this._toggleShowBody = () => {
|
|
1983
|
+
if (!this.state.showBody) {
|
|
2021
1984
|
// will show
|
|
2022
|
-
if (
|
|
2023
|
-
document.addEventListener('click',
|
|
1985
|
+
if (this.props.onShowBody) this.props.onShowBody();
|
|
1986
|
+
document.addEventListener('click', this._handleClickOutside, true);
|
|
2024
1987
|
} else {
|
|
2025
1988
|
// will hide
|
|
2026
|
-
if (
|
|
2027
|
-
document.removeEventListener('click',
|
|
1989
|
+
if (this.props.onHideBody) this.props.onHideBody();
|
|
1990
|
+
document.removeEventListener('click', this._handleClickOutside, true);
|
|
2028
1991
|
}
|
|
2029
1992
|
|
|
2030
|
-
|
|
2031
|
-
showBody: !
|
|
1993
|
+
this.setState({
|
|
1994
|
+
showBody: !this.state.showBody
|
|
2032
1995
|
});
|
|
2033
|
-
};
|
|
2034
|
-
|
|
1996
|
+
};
|
|
2035
1997
|
|
|
2036
|
-
|
|
1998
|
+
this._setPosition = body => {
|
|
2037
1999
|
if (body) {
|
|
2038
|
-
|
|
2000
|
+
const scrollingParent = document.getElementById(this.props.scrolling_parent ? this.props.scrolling_parent : '');
|
|
2039
2001
|
|
|
2040
2002
|
if (scrollingParent) {
|
|
2041
|
-
|
|
2003
|
+
const dropdown = ReactDOM.findDOMNode(this);
|
|
2042
2004
|
|
|
2043
2005
|
if (!dropdown) {
|
|
2044
2006
|
return;
|
|
2045
2007
|
}
|
|
2046
2008
|
|
|
2047
|
-
|
|
2048
|
-
|
|
2009
|
+
const dropdownVerticalPosition = ReactDOM.findDOMNode(this).offsetTop;
|
|
2010
|
+
const dropdownTrigger = dropdown.querySelector('.trigger');
|
|
2049
2011
|
|
|
2050
2012
|
if (!dropdownTrigger) {
|
|
2051
2013
|
return;
|
|
2052
2014
|
}
|
|
2053
2015
|
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2016
|
+
const dropdownTriggerHeight = dropdownTrigger.clientHeight;
|
|
2017
|
+
const dropdownBodyHeight = body.clientHeight;
|
|
2018
|
+
const scrollingParentHeight = scrollingParent.clientHeight;
|
|
2019
|
+
const scrollingParentOffset = scrollingParent.scrollTop;
|
|
2020
|
+
const bottomOffset = scrollingParentHeight + scrollingParentOffset - dropdownVerticalPosition - dropdownTriggerHeight;
|
|
2021
|
+
const top = bottomOffset < dropdownBodyHeight;
|
|
2060
2022
|
|
|
2061
|
-
if (top !==
|
|
2062
|
-
|
|
2063
|
-
top
|
|
2023
|
+
if (top !== this.state.top) {
|
|
2024
|
+
this.setState({
|
|
2025
|
+
top
|
|
2064
2026
|
});
|
|
2065
2027
|
}
|
|
2066
2028
|
}
|
|
2067
2029
|
}
|
|
2068
2030
|
};
|
|
2069
2031
|
|
|
2070
|
-
|
|
2032
|
+
this.state = {
|
|
2071
2033
|
showBody: false,
|
|
2072
2034
|
top: props.top || false
|
|
2073
2035
|
};
|
|
2074
|
-
|
|
2075
|
-
return _this;
|
|
2036
|
+
this._timeout = undefined;
|
|
2076
2037
|
}
|
|
2077
2038
|
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
2039
|
+
componentWillUnmount() {
|
|
2081
2040
|
document.removeEventListener('click', this._handleClickOutside, true);
|
|
2082
2041
|
|
|
2083
2042
|
if (this._timeout) {
|
|
2084
2043
|
clearTimeout(this._timeout);
|
|
2085
2044
|
}
|
|
2086
|
-
}
|
|
2045
|
+
}
|
|
2087
2046
|
|
|
2088
|
-
|
|
2047
|
+
_getTriggerComponent() {
|
|
2089
2048
|
var _this$props$children;
|
|
2090
2049
|
|
|
2091
|
-
|
|
2050
|
+
const _trigger = (_this$props$children = this.props.children) == null ? void 0 : _this$props$children[0];
|
|
2092
2051
|
|
|
2093
2052
|
return _trigger ? /*#__PURE__*/React__default.cloneElement(_trigger, {
|
|
2094
2053
|
onClick: this._toggleShowBody
|
|
2095
2054
|
}) : undefined;
|
|
2096
|
-
}
|
|
2055
|
+
} // https://facebook.github.io/react/docs/refs-and-the-dom.html#exposing-dom-refs-to-parent-components
|
|
2056
|
+
|
|
2097
2057
|
|
|
2098
|
-
|
|
2058
|
+
_getBodyComponent() {
|
|
2099
2059
|
if (!this.state.showBody) {
|
|
2100
2060
|
return null;
|
|
2101
2061
|
}
|
|
2102
2062
|
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2063
|
+
const {
|
|
2064
|
+
top
|
|
2065
|
+
} = this.state;
|
|
2066
|
+
const {
|
|
2067
|
+
right = false,
|
|
2068
|
+
children
|
|
2069
|
+
} = this.props;
|
|
2070
|
+
const props = {
|
|
2071
|
+
top,
|
|
2072
|
+
right,
|
|
2111
2073
|
setPosition: this._setPosition
|
|
2112
2074
|
};
|
|
2113
|
-
|
|
2075
|
+
const className = classNames({
|
|
2114
2076
|
body_wrapper: true,
|
|
2115
2077
|
with_arrow: true,
|
|
2116
2078
|
top: top,
|
|
2117
2079
|
bottom: !top
|
|
2118
2080
|
});
|
|
2119
|
-
|
|
2120
|
-
|
|
2081
|
+
const body = children == null ? void 0 : children[1];
|
|
2082
|
+
const contentMarkup = typeof body === 'function' ? body(props) : body ? /*#__PURE__*/React__default.cloneElement(body, props) : undefined;
|
|
2121
2083
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2122
2084
|
className: className,
|
|
2123
2085
|
style: {
|
|
2124
2086
|
position: 'relative'
|
|
2125
2087
|
}
|
|
2126
2088
|
}, contentMarkup);
|
|
2127
|
-
}
|
|
2089
|
+
}
|
|
2128
2090
|
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2091
|
+
render() {
|
|
2092
|
+
const className = classNames('reactist_dropdown', this.props.className);
|
|
2093
|
+
const {
|
|
2094
|
+
top
|
|
2095
|
+
} = this.state;
|
|
2132
2096
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2133
2097
|
style: {
|
|
2134
2098
|
display: 'inline-block'
|
|
2135
2099
|
},
|
|
2136
2100
|
className: className
|
|
2137
2101
|
}, top && this._getBodyComponent(), this._getTriggerComponent(), !top && this._getBodyComponent());
|
|
2138
|
-
}
|
|
2102
|
+
}
|
|
2139
2103
|
|
|
2140
|
-
|
|
2141
|
-
}(React__default.Component);
|
|
2104
|
+
}
|
|
2142
2105
|
|
|
2106
|
+
Box$1.displayName = void 0;
|
|
2143
2107
|
Box$1.displayName = 'Dropdown.Box';
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2108
|
+
const Trigger = /*#__PURE__*/React__default.forwardRef(function Trigger(_ref, ref) {
|
|
2109
|
+
let {
|
|
2110
|
+
children,
|
|
2111
|
+
onClick,
|
|
2112
|
+
tooltip,
|
|
2113
|
+
className
|
|
2114
|
+
} = _ref,
|
|
2115
|
+
props = _objectWithoutProperties(_ref, _excluded$q);
|
|
2150
2116
|
|
|
2151
2117
|
function handleClick(event) {
|
|
2152
2118
|
event.preventDefault();
|
|
@@ -2154,7 +2120,7 @@ var Trigger = /*#__PURE__*/React__default.forwardRef(function Trigger(_ref, ref)
|
|
|
2154
2120
|
if (onClick) onClick(event);
|
|
2155
2121
|
}
|
|
2156
2122
|
|
|
2157
|
-
return /*#__PURE__*/React__default.createElement(Button$1,
|
|
2123
|
+
return /*#__PURE__*/React__default.createElement(Button$1, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2158
2124
|
className: classNames('trigger', className),
|
|
2159
2125
|
onClick: handleClick,
|
|
2160
2126
|
tooltip: tooltip,
|
|
@@ -2163,12 +2129,13 @@ var Trigger = /*#__PURE__*/React__default.forwardRef(function Trigger(_ref, ref)
|
|
|
2163
2129
|
});
|
|
2164
2130
|
Trigger.displayName = 'Dropdown.Trigger';
|
|
2165
2131
|
|
|
2166
|
-
function Body(
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2132
|
+
function Body({
|
|
2133
|
+
top,
|
|
2134
|
+
right,
|
|
2135
|
+
children,
|
|
2136
|
+
setPosition
|
|
2137
|
+
}) {
|
|
2138
|
+
const style = {
|
|
2172
2139
|
position: 'absolute',
|
|
2173
2140
|
right: 0,
|
|
2174
2141
|
top: 0
|
|
@@ -2193,39 +2160,36 @@ function Body(_ref2) {
|
|
|
2193
2160
|
}
|
|
2194
2161
|
|
|
2195
2162
|
Body.displayName = 'Dropdown.Body';
|
|
2196
|
-
|
|
2163
|
+
const Dropdown = {
|
|
2197
2164
|
Box: Box$1,
|
|
2198
|
-
Trigger
|
|
2199
|
-
Body
|
|
2165
|
+
Trigger,
|
|
2166
|
+
Body
|
|
2200
2167
|
};
|
|
2201
2168
|
|
|
2202
|
-
|
|
2169
|
+
const COLORS = ['#606060', '#4A90E2', '#03B3B2', '#008299', '#82BA00', '#D24726', '#AC193D', '#DC4FAD', '#3BD5FB', '#74E8D3', '#FFCC00', '#FB886E', '#CCCCCC'];
|
|
2203
2170
|
|
|
2204
|
-
|
|
2205
|
-
return typeof color !== 'string';
|
|
2206
|
-
};
|
|
2171
|
+
const _isNamedColor = color => typeof color !== 'string';
|
|
2207
2172
|
|
|
2208
|
-
|
|
2209
|
-
|
|
2173
|
+
const _getColor = (colorList, colorIndex) => {
|
|
2174
|
+
const index = colorIndex >= colorList.length ? 0 : colorIndex;
|
|
2210
2175
|
return colorList[index];
|
|
2211
2176
|
};
|
|
2212
2177
|
|
|
2213
|
-
function ColorPicker(
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
colorList = _ref$colorList === void 0 ? COLORS : _ref$colorList;
|
|
2178
|
+
function ColorPicker({
|
|
2179
|
+
color = 0,
|
|
2180
|
+
small,
|
|
2181
|
+
onChange,
|
|
2182
|
+
colorList = COLORS
|
|
2183
|
+
}) {
|
|
2220
2184
|
return /*#__PURE__*/React__default.createElement(Dropdown.Box, {
|
|
2221
2185
|
right: true,
|
|
2222
2186
|
className: "reactist_color_picker"
|
|
2223
|
-
}, /*#__PURE__*/React__default.createElement(Dropdown.Trigger, null,
|
|
2224
|
-
|
|
2187
|
+
}, /*#__PURE__*/React__default.createElement(Dropdown.Trigger, null, (() => {
|
|
2188
|
+
const backgroundColor = _getColor(colorList, color);
|
|
2225
2189
|
|
|
2226
2190
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
2227
2191
|
className: classNames('color_trigger', {
|
|
2228
|
-
small
|
|
2192
|
+
small
|
|
2229
2193
|
}),
|
|
2230
2194
|
style: {
|
|
2231
2195
|
backgroundColor: _isNamedColor(backgroundColor) ? backgroundColor.color : backgroundColor
|
|
@@ -2233,9 +2197,9 @@ function ColorPicker(_ref) {
|
|
|
2233
2197
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
2234
2198
|
className: "color_trigger--inner_ring"
|
|
2235
2199
|
}));
|
|
2236
|
-
}()), /*#__PURE__*/React__default.createElement(Dropdown.Body, null, /*#__PURE__*/React__default.createElement("div", {
|
|
2200
|
+
})()), /*#__PURE__*/React__default.createElement(Dropdown.Body, null, /*#__PURE__*/React__default.createElement("div", {
|
|
2237
2201
|
className: "color_options"
|
|
2238
|
-
}, colorList.reduce(
|
|
2202
|
+
}, colorList.reduce((items, currentColor, currentIndex) => {
|
|
2239
2203
|
items.push( /*#__PURE__*/React__default.createElement(ColorItem, {
|
|
2240
2204
|
isActive: color >= colorList.length ? currentIndex === 0 : currentIndex === color,
|
|
2241
2205
|
key: currentIndex,
|
|
@@ -2250,20 +2214,19 @@ function ColorPicker(_ref) {
|
|
|
2250
2214
|
|
|
2251
2215
|
ColorPicker.displayName = 'ColorPicker';
|
|
2252
2216
|
|
|
2253
|
-
function ColorItem(
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2217
|
+
function ColorItem({
|
|
2218
|
+
color,
|
|
2219
|
+
colorIndex,
|
|
2220
|
+
isActive,
|
|
2221
|
+
onClick,
|
|
2222
|
+
tooltip
|
|
2223
|
+
}) {
|
|
2224
|
+
const item = /*#__PURE__*/React__default.createElement("span", {
|
|
2260
2225
|
className: 'reactist color_item' + (isActive ? ' active' : ''),
|
|
2261
2226
|
style: {
|
|
2262
2227
|
backgroundColor: color
|
|
2263
2228
|
},
|
|
2264
|
-
onClick:
|
|
2265
|
-
return _onClick === null || _onClick === void 0 ? void 0 : _onClick(colorIndex);
|
|
2266
|
-
}
|
|
2229
|
+
onClick: () => onClick == null ? void 0 : onClick(colorIndex)
|
|
2267
2230
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
2268
2231
|
className: "color_item--inner_ring"
|
|
2269
2232
|
}));
|
|
@@ -2274,24 +2237,22 @@ function ColorItem(_ref2) {
|
|
|
2274
2237
|
|
|
2275
2238
|
ColorItem.displayName = 'ColorItem';
|
|
2276
2239
|
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
return /*#__PURE__*/React__default.createElement("input",
|
|
2240
|
+
const Input = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
2241
|
+
const className = classNames('reactist_input', props.className);
|
|
2242
|
+
return /*#__PURE__*/React__default.createElement("input", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2280
2243
|
className: className,
|
|
2281
2244
|
ref: ref
|
|
2282
2245
|
}));
|
|
2283
2246
|
});
|
|
2284
2247
|
Input.displayName = 'Input';
|
|
2285
2248
|
|
|
2286
|
-
|
|
2249
|
+
const _excluded$r = ["children", "className", "translateKey", "isMac"];
|
|
2287
2250
|
// Support for setting up how to translate modifiers globally.
|
|
2288
2251
|
//
|
|
2289
2252
|
|
|
2290
|
-
|
|
2291
|
-
return key;
|
|
2292
|
-
};
|
|
2253
|
+
let globalTranslateKey = key => key;
|
|
2293
2254
|
|
|
2294
|
-
KeyboardShortcut.setTranslateKey =
|
|
2255
|
+
KeyboardShortcut.setTranslateKey = tr => {
|
|
2295
2256
|
globalTranslateKey = tr;
|
|
2296
2257
|
};
|
|
2297
2258
|
|
|
@@ -2335,9 +2296,9 @@ function isSpecialKey(str) {
|
|
|
2335
2296
|
}
|
|
2336
2297
|
|
|
2337
2298
|
function parseKeys(shortcut, isMac, translateKey) {
|
|
2338
|
-
|
|
2299
|
+
const t = isMac ? translateKeyMac : translateKey;
|
|
2339
2300
|
|
|
2340
|
-
|
|
2301
|
+
const _hasModifiers = hasModifiers(shortcut);
|
|
2341
2302
|
|
|
2342
2303
|
function mapIndividualKey(str) {
|
|
2343
2304
|
if (isSpecialKey(str)) {
|
|
@@ -2361,31 +2322,27 @@ function parseKeys(shortcut, isMac, translateKey) {
|
|
|
2361
2322
|
function KeyboardShortcut(_ref) {
|
|
2362
2323
|
var _navigator$platform$t, _navigator$platform;
|
|
2363
2324
|
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
props =
|
|
2325
|
+
let {
|
|
2326
|
+
children,
|
|
2327
|
+
className,
|
|
2328
|
+
translateKey = globalTranslateKey,
|
|
2329
|
+
isMac = (_navigator$platform$t = (_navigator$platform = navigator.platform) == null ? void 0 : _navigator$platform.toUpperCase().includes('MAC')) != null ? _navigator$platform$t : false
|
|
2330
|
+
} = _ref,
|
|
2331
|
+
props = _objectWithoutProperties(_ref, _excluded$r);
|
|
2371
2332
|
|
|
2372
|
-
|
|
2373
|
-
return /*#__PURE__*/React.createElement("span",
|
|
2333
|
+
const shortcuts = typeof children === 'string' ? [children] : children;
|
|
2334
|
+
return /*#__PURE__*/React.createElement("span", _objectSpread2({
|
|
2374
2335
|
className: classNames('reactist_keyboard_shortcut', className, {
|
|
2375
2336
|
'reactist_keyboard_shortcut--macos': isMac
|
|
2376
2337
|
})
|
|
2377
|
-
}, props), shortcuts.map(
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
key: j
|
|
2383
|
-
}, key);
|
|
2384
|
-
})));
|
|
2385
|
-
}));
|
|
2338
|
+
}, props), shortcuts.map((shortcut, i) => /*#__PURE__*/React.createElement(React.Fragment, {
|
|
2339
|
+
key: i
|
|
2340
|
+
}, i === 0 ? null : ', ', /*#__PURE__*/React.createElement("kbd", null, parseKeys(shortcut, isMac, translateKey).map((key, j) => /*#__PURE__*/React.createElement("kbd", {
|
|
2341
|
+
key: j
|
|
2342
|
+
}, key))))));
|
|
2386
2343
|
}
|
|
2387
2344
|
|
|
2388
|
-
|
|
2345
|
+
const SUPPORTED_KEYS = {
|
|
2389
2346
|
ARROW_UP: 'ArrowUp',
|
|
2390
2347
|
ARROW_RIGHT: 'ArrowRight',
|
|
2391
2348
|
ARROW_DOWN: 'ArrowDown',
|
|
@@ -2394,8 +2351,8 @@ var SUPPORTED_KEYS = {
|
|
|
2394
2351
|
BACKSPACE: 'Backspace',
|
|
2395
2352
|
ESCAPE: 'Escape'
|
|
2396
2353
|
};
|
|
2397
|
-
|
|
2398
|
-
resolveByKey
|
|
2354
|
+
const KeyCapturerResolver = {
|
|
2355
|
+
resolveByKey(eventKey) {
|
|
2399
2356
|
switch (eventKey) {
|
|
2400
2357
|
case 'Left': // IE specific
|
|
2401
2358
|
|
|
@@ -2448,7 +2405,8 @@ var KeyCapturerResolver = {
|
|
|
2448
2405
|
}
|
|
2449
2406
|
}
|
|
2450
2407
|
},
|
|
2451
|
-
|
|
2408
|
+
|
|
2409
|
+
resolveByKeyCode(keyCode) {
|
|
2452
2410
|
switch (keyCode) {
|
|
2453
2411
|
case 37:
|
|
2454
2412
|
{
|
|
@@ -2491,8 +2449,9 @@ var KeyCapturerResolver = {
|
|
|
2491
2449
|
}
|
|
2492
2450
|
}
|
|
2493
2451
|
}
|
|
2452
|
+
|
|
2494
2453
|
};
|
|
2495
|
-
|
|
2454
|
+
const keyEventHandlerMapping = {
|
|
2496
2455
|
ArrowUp: 'onArrowUp',
|
|
2497
2456
|
ArrowDown: 'onArrowDown',
|
|
2498
2457
|
ArrowLeft: 'onArrowLeft',
|
|
@@ -2501,7 +2460,7 @@ var keyEventHandlerMapping = {
|
|
|
2501
2460
|
Backspace: 'onBackspace',
|
|
2502
2461
|
Escape: 'onEscape'
|
|
2503
2462
|
};
|
|
2504
|
-
|
|
2463
|
+
const keyPropagatePropMapping = {
|
|
2505
2464
|
ArrowUp: 'propagateArrowUp',
|
|
2506
2465
|
ArrowDown: 'propagateArrowDown',
|
|
2507
2466
|
ArrowLeft: 'propagateArrowLeft',
|
|
@@ -2520,27 +2479,26 @@ var keyPropagatePropMapping = {
|
|
|
2520
2479
|
*/
|
|
2521
2480
|
|
|
2522
2481
|
function KeyCapturer(props) {
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
onCompositionStart: function onCompositionStart() {
|
|
2482
|
+
const {
|
|
2483
|
+
children,
|
|
2484
|
+
eventName = 'onKeyDown'
|
|
2485
|
+
} = props;
|
|
2486
|
+
const composingRef = React.useRef(false);
|
|
2487
|
+
const composingEventHandlers = props.onEnter ? {
|
|
2488
|
+
onCompositionStart: () => {
|
|
2531
2489
|
composingRef.current = true;
|
|
2532
2490
|
},
|
|
2533
|
-
onCompositionEnd:
|
|
2491
|
+
onCompositionEnd: () => {
|
|
2534
2492
|
composingRef.current = false;
|
|
2535
2493
|
}
|
|
2536
2494
|
} : undefined;
|
|
2537
2495
|
|
|
2538
2496
|
function handleKeyEvent(event) {
|
|
2539
2497
|
// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
|
|
2540
|
-
|
|
2498
|
+
const key = event.key !== undefined ? KeyCapturerResolver.resolveByKey(event.key) : KeyCapturerResolver.resolveByKeyCode(event.keyCode);
|
|
2541
2499
|
if (!key) return;
|
|
2542
|
-
|
|
2543
|
-
|
|
2500
|
+
const propagateEvent = props[keyPropagatePropMapping[key]] || false;
|
|
2501
|
+
const eventHandler = props[keyEventHandlerMapping[key]];
|
|
2544
2502
|
|
|
2545
2503
|
if (key === 'Enter' && eventHandler) {
|
|
2546
2504
|
if (composingRef.current || // Safari fires the onCompositionEnd event before the keydown event, so we
|
|
@@ -2561,29 +2519,35 @@ function KeyCapturer(props) {
|
|
|
2561
2519
|
}
|
|
2562
2520
|
}
|
|
2563
2521
|
|
|
2564
|
-
return /*#__PURE__*/React__default.cloneElement(children, _objectSpread2(
|
|
2522
|
+
return /*#__PURE__*/React__default.cloneElement(children, _objectSpread2({
|
|
2523
|
+
[eventName]: handleKeyEvent
|
|
2524
|
+
}, composingEventHandlers));
|
|
2565
2525
|
}
|
|
2566
2526
|
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2527
|
+
const hasEnoughSpace = (windowDimensions, elementDimensions, wrapperDimensions, wrapperPosition, position, gap = 0) => {
|
|
2528
|
+
const {
|
|
2529
|
+
height: windowHeight,
|
|
2530
|
+
width: windowWidth
|
|
2531
|
+
} = windowDimensions;
|
|
2532
|
+
const {
|
|
2533
|
+
height: elementHeight,
|
|
2534
|
+
width: elementWidth
|
|
2535
|
+
} = elementDimensions;
|
|
2536
|
+
const {
|
|
2537
|
+
height: wrapperHeight,
|
|
2538
|
+
width: wrapperWidth
|
|
2539
|
+
} = wrapperDimensions;
|
|
2540
|
+
const {
|
|
2541
|
+
x: wrapperX,
|
|
2542
|
+
y: wrapperY
|
|
2543
|
+
} = wrapperPosition;
|
|
2580
2544
|
|
|
2581
|
-
|
|
2545
|
+
const verticalPosition = _calculateVerticalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
|
|
2582
2546
|
|
|
2583
|
-
|
|
2547
|
+
const horizontalPosition = _calculateHorizontalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
|
|
2584
2548
|
|
|
2585
|
-
|
|
2586
|
-
|
|
2549
|
+
const canPlaceVertically = verticalPosition >= 0 && verticalPosition + elementWidth <= windowWidth;
|
|
2550
|
+
const canPlaceHorizontally = horizontalPosition >= 0 && horizontalPosition + elementHeight <= windowHeight;
|
|
2587
2551
|
|
|
2588
2552
|
if (position === 'top') {
|
|
2589
2553
|
return canPlaceVertically && wrapperY - elementHeight - gap >= 0;
|
|
@@ -2598,77 +2562,57 @@ var hasEnoughSpace = function hasEnoughSpace(windowDimensions, elementDimensions
|
|
|
2598
2562
|
return false;
|
|
2599
2563
|
};
|
|
2600
2564
|
|
|
2601
|
-
|
|
2565
|
+
function _calculateVerticalPosition(wrapperPosition, wrapperDimensions, elementDimensions) {
|
|
2602
2566
|
return wrapperPosition.x + (wrapperDimensions.width - elementDimensions.width) / 2;
|
|
2603
|
-
}
|
|
2567
|
+
}
|
|
2604
2568
|
|
|
2605
|
-
|
|
2569
|
+
function _calculateHorizontalPosition(wrapperPosition, wrapperDimensions, elementDimensions) {
|
|
2606
2570
|
return wrapperPosition.y + (wrapperDimensions.height - elementDimensions.height) / 2;
|
|
2607
|
-
}
|
|
2608
|
-
|
|
2609
|
-
var calculateTopCenterPosition = function calculateTopCenterPosition(wrapperDimensions, wrapperPosition, elementDimensions, gap) {
|
|
2610
|
-
if (gap === void 0) {
|
|
2611
|
-
gap = 0;
|
|
2612
|
-
}
|
|
2571
|
+
}
|
|
2613
2572
|
|
|
2614
|
-
|
|
2573
|
+
const calculateTopCenterPosition = (wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
|
|
2574
|
+
const x = _calculateVerticalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
|
|
2615
2575
|
|
|
2616
|
-
|
|
2576
|
+
const y = wrapperPosition.y - elementDimensions.height - gap;
|
|
2617
2577
|
return {
|
|
2618
|
-
x
|
|
2619
|
-
y
|
|
2578
|
+
x,
|
|
2579
|
+
y
|
|
2620
2580
|
};
|
|
2621
2581
|
};
|
|
2622
2582
|
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
gap = 0;
|
|
2626
|
-
}
|
|
2627
|
-
|
|
2628
|
-
var x = _calculateVerticalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
|
|
2583
|
+
const calculateBottomCenterPosition = (wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
|
|
2584
|
+
const x = _calculateVerticalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
|
|
2629
2585
|
|
|
2630
|
-
|
|
2586
|
+
const y = wrapperPosition.y + wrapperDimensions.height + gap;
|
|
2631
2587
|
return {
|
|
2632
|
-
x
|
|
2633
|
-
y
|
|
2588
|
+
x,
|
|
2589
|
+
y
|
|
2634
2590
|
};
|
|
2635
2591
|
};
|
|
2636
2592
|
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
gap = 0;
|
|
2640
|
-
}
|
|
2641
|
-
|
|
2642
|
-
var x = wrapperPosition.x + wrapperDimensions.width + gap;
|
|
2593
|
+
const calculateRightCenterPosition = (wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
|
|
2594
|
+
const x = wrapperPosition.x + wrapperDimensions.width + gap;
|
|
2643
2595
|
|
|
2644
|
-
|
|
2596
|
+
const y = _calculateHorizontalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
|
|
2645
2597
|
|
|
2646
2598
|
return {
|
|
2647
|
-
x
|
|
2648
|
-
y
|
|
2599
|
+
x,
|
|
2600
|
+
y
|
|
2649
2601
|
};
|
|
2650
2602
|
};
|
|
2651
2603
|
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
gap = 0;
|
|
2655
|
-
}
|
|
2656
|
-
|
|
2657
|
-
var x = wrapperPosition.x - elementDimensions.width - gap;
|
|
2604
|
+
const calculateLeftCenterPosition = (wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
|
|
2605
|
+
const x = wrapperPosition.x - elementDimensions.width - gap;
|
|
2658
2606
|
|
|
2659
|
-
|
|
2607
|
+
const y = _calculateHorizontalPosition(wrapperPosition, wrapperDimensions, elementDimensions);
|
|
2660
2608
|
|
|
2661
2609
|
return {
|
|
2662
|
-
x
|
|
2663
|
-
y
|
|
2610
|
+
x,
|
|
2611
|
+
y
|
|
2664
2612
|
};
|
|
2665
2613
|
};
|
|
2666
2614
|
|
|
2667
|
-
|
|
2668
|
-
if (gap === void 0) {
|
|
2669
|
-
gap = 0;
|
|
2670
|
-
}
|
|
2671
|
-
|
|
2615
|
+
const calculatePosition = (position, wrapperDimensions, wrapperPosition, elementDimensions, gap = 0) => {
|
|
2672
2616
|
if (position === 'top') {
|
|
2673
2617
|
return calculateTopCenterPosition(wrapperDimensions, wrapperPosition, elementDimensions, gap);
|
|
2674
2618
|
} else if (position === 'right') {
|
|
@@ -2682,72 +2626,67 @@ var calculatePosition = function calculatePosition(position, wrapperDimensions,
|
|
|
2682
2626
|
return wrapperPosition;
|
|
2683
2627
|
};
|
|
2684
2628
|
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
var documentEl = document.documentElement;
|
|
2705
|
-
var node = _this.wrapper;
|
|
2706
|
-
var foundParent = false;
|
|
2629
|
+
class Popover extends React__default.Component {
|
|
2630
|
+
constructor(...args) {
|
|
2631
|
+
super(...args);
|
|
2632
|
+
this.popover = void 0;
|
|
2633
|
+
this.wrapper = void 0;
|
|
2634
|
+
|
|
2635
|
+
this._updatePopoverPosition = () => {
|
|
2636
|
+
const {
|
|
2637
|
+
position,
|
|
2638
|
+
allowVaguePositioning,
|
|
2639
|
+
gapSize
|
|
2640
|
+
} = this.props;
|
|
2641
|
+
const wrapperRect = this.wrapper.getBoundingClientRect();
|
|
2642
|
+
const popoverRect = this.popover.getBoundingClientRect(); // Instead of using the documentElement find the nearest absolutely positioned element
|
|
2643
|
+
|
|
2644
|
+
const documentEl = document.documentElement;
|
|
2645
|
+
let node = this.wrapper;
|
|
2646
|
+
let foundParent = false;
|
|
2707
2647
|
|
|
2708
2648
|
while (!foundParent) {
|
|
2709
|
-
|
|
2649
|
+
const styles = getComputedStyle(node);
|
|
2650
|
+
const position = styles.getPropertyValue('position');
|
|
2710
2651
|
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
if (_position === 'absolute' || node === documentEl || !node.parentElement) {
|
|
2652
|
+
if (position === 'absolute' || node === documentEl || !node.parentElement) {
|
|
2714
2653
|
foundParent = true;
|
|
2715
2654
|
} else {
|
|
2716
2655
|
node = node.parentElement;
|
|
2717
2656
|
}
|
|
2718
2657
|
}
|
|
2719
2658
|
|
|
2720
|
-
|
|
2721
|
-
|
|
2659
|
+
const nodeRect = node.getBoundingClientRect();
|
|
2660
|
+
const windowDimensions = {
|
|
2722
2661
|
height: nodeRect.height,
|
|
2723
2662
|
width: nodeRect.width
|
|
2724
2663
|
};
|
|
2725
|
-
|
|
2664
|
+
const popoverDimensions = {
|
|
2726
2665
|
height: popoverRect.height,
|
|
2727
2666
|
width: popoverRect.width
|
|
2728
2667
|
};
|
|
2729
|
-
|
|
2668
|
+
const wrapperDimensions = {
|
|
2730
2669
|
height: wrapperRect.height,
|
|
2731
2670
|
width: wrapperRect.width
|
|
2732
2671
|
};
|
|
2733
|
-
|
|
2672
|
+
const wrapperPositionRelative = {
|
|
2734
2673
|
x: wrapperRect.left - nodeRect.left,
|
|
2735
2674
|
y: wrapperRect.top - nodeRect.top
|
|
2736
2675
|
};
|
|
2737
|
-
|
|
2676
|
+
const wrapperPositionAbsolute = {
|
|
2738
2677
|
x: wrapperRect.left,
|
|
2739
2678
|
y: wrapperRect.top
|
|
2740
2679
|
};
|
|
2741
|
-
|
|
2680
|
+
const positionsToTry = position === 'auto' ? ['top', 'right', 'bottom', 'left', 'top'] : position === 'vertical' ? ['top', 'bottom'] : position === 'horizontal' ? ['left', 'right'] : [position];
|
|
2742
2681
|
|
|
2743
|
-
for (
|
|
2744
|
-
|
|
2745
|
-
|
|
2682
|
+
for (let index = 0; index < positionsToTry.length; index++) {
|
|
2683
|
+
const currentPosition = positionsToTry[index];
|
|
2684
|
+
const enoughSpaceAtPosition = currentPosition != null ? hasEnoughSpace(windowDimensions, popoverDimensions, wrapperDimensions, wrapperPositionRelative, currentPosition, gapSize) : false;
|
|
2746
2685
|
|
|
2747
2686
|
if (enoughSpaceAtPosition || index === positionsToTry.length - 1) {
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2687
|
+
const popoverPosition = currentPosition != null ? calculatePosition(currentPosition, wrapperDimensions, wrapperPositionAbsolute, popoverDimensions, gapSize) : wrapperPositionAbsolute;
|
|
2688
|
+
this.popover.style.top = popoverPosition.y + "px";
|
|
2689
|
+
this.popover.style.left = popoverPosition.x + "px";
|
|
2751
2690
|
/**
|
|
2752
2691
|
* Correct placement if vague positioning is allowed.
|
|
2753
2692
|
* When it's not allowed we "cut off" popovers and display them
|
|
@@ -2757,17 +2696,17 @@ var Popover = /*#__PURE__*/function (_React$Component) {
|
|
|
2757
2696
|
if (allowVaguePositioning) {
|
|
2758
2697
|
// correct horizontally
|
|
2759
2698
|
if (popoverPosition.x < 0) {
|
|
2760
|
-
|
|
2699
|
+
this.popover.style.left = 2 * gapSize + "px";
|
|
2761
2700
|
} // correct vertically
|
|
2762
2701
|
|
|
2763
2702
|
|
|
2764
2703
|
if (popoverPosition.y + popoverDimensions.height > windowDimensions.height) {
|
|
2765
|
-
|
|
2704
|
+
this.popover.style.top = windowDimensions.height - popoverDimensions.height - 2 * gapSize + "px";
|
|
2766
2705
|
}
|
|
2767
2706
|
}
|
|
2768
2707
|
|
|
2769
2708
|
if (currentPosition !== position) {
|
|
2770
|
-
|
|
2709
|
+
this.popover.className = this._getClassNameForPosition(currentPosition);
|
|
2771
2710
|
}
|
|
2772
2711
|
|
|
2773
2712
|
break;
|
|
@@ -2775,13 +2714,14 @@ var Popover = /*#__PURE__*/function (_React$Component) {
|
|
|
2775
2714
|
}
|
|
2776
2715
|
};
|
|
2777
2716
|
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2717
|
+
this._getClassNameForPosition = position => {
|
|
2718
|
+
const {
|
|
2719
|
+
visible,
|
|
2720
|
+
withArrow,
|
|
2721
|
+
arrowClassName
|
|
2722
|
+
} = this.props;
|
|
2723
|
+
const className = classNames('reactist_popover', {
|
|
2724
|
+
visible
|
|
2785
2725
|
});
|
|
2786
2726
|
|
|
2787
2727
|
if (visible && withArrow) {
|
|
@@ -2796,62 +2736,59 @@ var Popover = /*#__PURE__*/function (_React$Component) {
|
|
|
2796
2736
|
return className;
|
|
2797
2737
|
};
|
|
2798
2738
|
|
|
2799
|
-
|
|
2800
|
-
|
|
2739
|
+
this._updatePopoverRef = popover => {
|
|
2740
|
+
this.popover = popover;
|
|
2801
2741
|
|
|
2802
|
-
if (typeof
|
|
2803
|
-
|
|
2742
|
+
if (typeof this.props.popoverRef === 'function') {
|
|
2743
|
+
this.props.popoverRef(popover);
|
|
2804
2744
|
}
|
|
2805
2745
|
};
|
|
2806
2746
|
|
|
2807
|
-
|
|
2808
|
-
|
|
2747
|
+
this._updateWrapperRef = wrapper => {
|
|
2748
|
+
this.wrapper = wrapper;
|
|
2809
2749
|
|
|
2810
|
-
if (typeof
|
|
2811
|
-
|
|
2750
|
+
if (typeof this.props.wrapperRef === 'function') {
|
|
2751
|
+
this.props.wrapperRef(wrapper);
|
|
2812
2752
|
}
|
|
2813
2753
|
};
|
|
2814
|
-
|
|
2815
|
-
return _this;
|
|
2816
2754
|
}
|
|
2817
2755
|
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
2756
|
+
componentDidMount() {
|
|
2821
2757
|
if (this.props.visible) {
|
|
2822
2758
|
this._updatePopoverPosition();
|
|
2823
2759
|
}
|
|
2824
|
-
}
|
|
2760
|
+
}
|
|
2825
2761
|
|
|
2826
|
-
|
|
2762
|
+
componentDidUpdate(prevProps) {
|
|
2827
2763
|
if (this.wrapper && this.props.visible) {
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2764
|
+
const positionChanged = prevProps.position !== this.props.position;
|
|
2765
|
+
const vaguePositioningChanged = prevProps.allowVaguePositioning !== this.props.allowVaguePositioning;
|
|
2766
|
+
const visibilityChanged = prevProps.visible !== this.props.visible;
|
|
2767
|
+
const arrowChanged = prevProps.withArrow !== this.props.withArrow;
|
|
2768
|
+
const gapSizeChanged = prevProps.gapSize !== this.props.gapSize;
|
|
2769
|
+
const contentChanged = prevProps.content !== this.props.content;
|
|
2834
2770
|
|
|
2835
2771
|
if (positionChanged || vaguePositioningChanged || visibilityChanged || arrowChanged || gapSizeChanged || contentChanged) {
|
|
2836
2772
|
this._updatePopoverPosition();
|
|
2837
2773
|
}
|
|
2838
2774
|
}
|
|
2839
|
-
}
|
|
2775
|
+
}
|
|
2840
2776
|
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2777
|
+
render() {
|
|
2778
|
+
const {
|
|
2779
|
+
position,
|
|
2780
|
+
wrapperClassName,
|
|
2781
|
+
popoverClassName,
|
|
2782
|
+
onMouseEnter,
|
|
2783
|
+
onMouseLeave,
|
|
2784
|
+
onClick,
|
|
2785
|
+
trigger,
|
|
2786
|
+
content
|
|
2787
|
+
} = this.props;
|
|
2788
|
+
const popoverClass = position ? this._getClassNameForPosition(position) : '';
|
|
2789
|
+
const popoverContentClass = classNames('reactist_popover__content', popoverClassName);
|
|
2790
|
+
const wrapperClass = classNames('reactist_popover__wrapper', wrapperClassName);
|
|
2791
|
+
const triggerElement = React__default.Children.only(trigger);
|
|
2855
2792
|
|
|
2856
2793
|
function handleTriggerClick(event) {
|
|
2857
2794
|
// @ts-expect-error This is temporary while we revisit the Popover interface
|
|
@@ -2876,24 +2813,26 @@ var Popover = /*#__PURE__*/function (_React$Component) {
|
|
|
2876
2813
|
}, this.props.visible ? /*#__PURE__*/React__default.createElement("span", {
|
|
2877
2814
|
className: popoverContentClass
|
|
2878
2815
|
}, typeof content === 'function' ? content() : content) : null));
|
|
2879
|
-
}
|
|
2816
|
+
}
|
|
2880
2817
|
|
|
2881
|
-
|
|
2882
|
-
}(React__default.Component);
|
|
2818
|
+
}
|
|
2883
2819
|
|
|
2820
|
+
Popover.displayName = void 0;
|
|
2821
|
+
Popover.defaultProps = void 0;
|
|
2884
2822
|
Popover.displayName = 'Popover';
|
|
2885
2823
|
Popover.defaultProps = {
|
|
2886
2824
|
position: 'auto',
|
|
2887
|
-
gapSize: 5
|
|
2825
|
+
gapSize: 5 // default size of the arrow (see `tooltip.less`)
|
|
2826
|
+
|
|
2888
2827
|
};
|
|
2889
2828
|
|
|
2890
|
-
function ProgressBar(
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2829
|
+
function ProgressBar({
|
|
2830
|
+
fillPercentage = 0,
|
|
2831
|
+
className,
|
|
2832
|
+
'aria-valuetext': ariaValuetext
|
|
2833
|
+
}) {
|
|
2834
|
+
const finalClassName = classNames('reactist_progress_bar', className);
|
|
2835
|
+
const width = fillPercentage < 0 ? 0 : fillPercentage > 100 ? 100 : fillPercentage;
|
|
2897
2836
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2898
2837
|
className: finalClassName
|
|
2899
2838
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -2904,44 +2843,39 @@ function ProgressBar(_ref) {
|
|
|
2904
2843
|
}), /*#__PURE__*/React__default.createElement(HiddenVisually, null, /*#__PURE__*/React__default.createElement("progress", {
|
|
2905
2844
|
value: width,
|
|
2906
2845
|
max: 100,
|
|
2907
|
-
"aria-valuetext": ariaValuetext
|
|
2846
|
+
"aria-valuetext": ariaValuetext != null ? ariaValuetext : undefined
|
|
2908
2847
|
})));
|
|
2909
2848
|
}
|
|
2910
2849
|
|
|
2911
2850
|
ProgressBar.displayName = 'ProgressBar';
|
|
2912
2851
|
|
|
2913
|
-
|
|
2852
|
+
const _excluded$s = ["value", "options", "onChange", "disabled", "className", "defaultValue"];
|
|
2914
2853
|
|
|
2915
2854
|
function Select(_ref) {
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
disabled: disabled
|
|
2855
|
+
let {
|
|
2856
|
+
value,
|
|
2857
|
+
options = [],
|
|
2858
|
+
onChange,
|
|
2859
|
+
disabled = true,
|
|
2860
|
+
className = '',
|
|
2861
|
+
defaultValue
|
|
2862
|
+
} = _ref,
|
|
2863
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$s);
|
|
2864
|
+
|
|
2865
|
+
const selectClassName = classNames('reactist_select', {
|
|
2866
|
+
disabled
|
|
2929
2867
|
}, className);
|
|
2930
|
-
return /*#__PURE__*/React__default.createElement("select",
|
|
2868
|
+
return /*#__PURE__*/React__default.createElement("select", _objectSpread2({
|
|
2931
2869
|
className: selectClassName,
|
|
2932
2870
|
value: value,
|
|
2933
|
-
onChange:
|
|
2934
|
-
return _onChange ? _onChange(event.target.value) : undefined;
|
|
2935
|
-
},
|
|
2871
|
+
onChange: event => onChange ? onChange(event.target.value) : undefined,
|
|
2936
2872
|
disabled: disabled,
|
|
2937
2873
|
defaultValue: defaultValue
|
|
2938
|
-
}, otherProps), options
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
}, option.text);
|
|
2944
|
-
}));
|
|
2874
|
+
}, otherProps), options == null ? void 0 : options.map(option => /*#__PURE__*/React__default.createElement("option", {
|
|
2875
|
+
key: option.key || option.value,
|
|
2876
|
+
value: option.value,
|
|
2877
|
+
disabled: option.disabled
|
|
2878
|
+
}, option.text)));
|
|
2945
2879
|
}
|
|
2946
2880
|
|
|
2947
2881
|
Select.displayName = 'Select';
|
|
@@ -2951,36 +2885,27 @@ Select.defaultProps = {
|
|
|
2951
2885
|
};
|
|
2952
2886
|
|
|
2953
2887
|
dayjs.extend(LocalizedFormat);
|
|
2954
|
-
|
|
2888
|
+
const TimeUtils = {
|
|
2955
2889
|
SHORT_FORMAT_CURRENT_YEAR: 'L',
|
|
2956
2890
|
SHORT_FORMAT_PAST_YEAR: 'LL',
|
|
2957
2891
|
LONG_FORMAT: 'LL, LT',
|
|
2958
|
-
timeAgo: function timeAgo(timestamp, config) {
|
|
2959
|
-
if (config === void 0) {
|
|
2960
|
-
config = {};
|
|
2961
|
-
}
|
|
2962
2892
|
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
minutesSuffix = _config$minutesSuffix === void 0 ? 'm' : _config$minutesSuffix,
|
|
2976
|
-
_config$momentsAgo = _config.momentsAgo,
|
|
2977
|
-
momentsAgo = _config$momentsAgo === void 0 ? 'moments ago' : _config$momentsAgo;
|
|
2978
|
-
var now = dayjs();
|
|
2979
|
-
var date = dayjs(timestamp * 1000);
|
|
2893
|
+
timeAgo(timestamp, config = {}) {
|
|
2894
|
+
const {
|
|
2895
|
+
locale = 'en',
|
|
2896
|
+
shortFormatCurrentYear = this.SHORT_FORMAT_CURRENT_YEAR,
|
|
2897
|
+
shortFormatPastYear = this.SHORT_FORMAT_PAST_YEAR,
|
|
2898
|
+
daysSuffix = 'd',
|
|
2899
|
+
hoursSuffix = 'h',
|
|
2900
|
+
minutesSuffix = 'm',
|
|
2901
|
+
momentsAgo = 'moments ago'
|
|
2902
|
+
} = config;
|
|
2903
|
+
const now = dayjs();
|
|
2904
|
+
const date = dayjs(timestamp * 1000);
|
|
2980
2905
|
date.locale(locale);
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2906
|
+
const diffMinutes = now.diff(date, 'minute');
|
|
2907
|
+
const diffHours = now.diff(date, 'hour');
|
|
2908
|
+
const diffDays = now.diff(date, 'day');
|
|
2984
2909
|
|
|
2985
2910
|
if (diffDays > 1) {
|
|
2986
2911
|
if (date.isSame(now, 'year')) {
|
|
@@ -2998,19 +2923,14 @@ var TimeUtils = {
|
|
|
2998
2923
|
return momentsAgo;
|
|
2999
2924
|
}
|
|
3000
2925
|
},
|
|
3001
|
-
formatTime: function formatTime(timestamp, config) {
|
|
3002
|
-
if (config === void 0) {
|
|
3003
|
-
config = {};
|
|
3004
|
-
}
|
|
3005
2926
|
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
var date = dayjs(timestamp * 1000);
|
|
2927
|
+
formatTime(timestamp, config = {}) {
|
|
2928
|
+
const {
|
|
2929
|
+
locale = 'en',
|
|
2930
|
+
shortFormatCurrentYear = this.SHORT_FORMAT_CURRENT_YEAR,
|
|
2931
|
+
shortFormatPastYear = this.SHORT_FORMAT_PAST_YEAR
|
|
2932
|
+
} = config;
|
|
2933
|
+
const date = dayjs(timestamp * 1000);
|
|
3014
2934
|
date.locale(locale);
|
|
3015
2935
|
|
|
3016
2936
|
if (date.isSame(dayjs(), 'year')) {
|
|
@@ -3019,49 +2939,40 @@ var TimeUtils = {
|
|
|
3019
2939
|
return date.format(shortFormatPastYear);
|
|
3020
2940
|
}
|
|
3021
2941
|
},
|
|
3022
|
-
formatTimeLong: function formatTimeLong(timestamp, config) {
|
|
3023
|
-
if (config === void 0) {
|
|
3024
|
-
config = {};
|
|
3025
|
-
}
|
|
3026
2942
|
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
2943
|
+
formatTimeLong(timestamp, config = {}) {
|
|
2944
|
+
const {
|
|
2945
|
+
locale = 'en',
|
|
2946
|
+
longFormat = this.LONG_FORMAT
|
|
2947
|
+
} = config;
|
|
2948
|
+
const date = dayjs(timestamp * 1000);
|
|
3033
2949
|
date.locale(locale);
|
|
3034
2950
|
return date.format(longFormat);
|
|
3035
2951
|
}
|
|
3036
|
-
};
|
|
3037
|
-
|
|
3038
|
-
var DELAY = 60000;
|
|
3039
2952
|
|
|
3040
|
-
|
|
3041
|
-
_inheritsLoose(Time, _React$Component);
|
|
2953
|
+
};
|
|
3042
2954
|
|
|
3043
|
-
|
|
3044
|
-
var _this;
|
|
2955
|
+
const DELAY = 60000;
|
|
3045
2956
|
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
2957
|
+
class Time extends React__default.Component {
|
|
2958
|
+
constructor(props) {
|
|
2959
|
+
super(props);
|
|
2960
|
+
this.refreshInterval = void 0;
|
|
2961
|
+
this.refreshInterval = undefined;
|
|
2962
|
+
this.state = {
|
|
3049
2963
|
hovered: false,
|
|
3050
2964
|
mouseX: undefined,
|
|
3051
2965
|
mouseY: undefined
|
|
3052
2966
|
};
|
|
3053
|
-
return _this;
|
|
3054
2967
|
}
|
|
3055
2968
|
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
2969
|
+
componentDidMount() {
|
|
3059
2970
|
if (this.props.refresh) {
|
|
3060
2971
|
this._refresh();
|
|
3061
2972
|
}
|
|
3062
|
-
}
|
|
2973
|
+
}
|
|
3063
2974
|
|
|
3064
|
-
|
|
2975
|
+
componentDidUpdate(prevProps) {
|
|
3065
2976
|
if (!prevProps.refresh && this.props.refresh) {
|
|
3066
2977
|
this._refresh();
|
|
3067
2978
|
}
|
|
@@ -3071,34 +2982,35 @@ var Time = /*#__PURE__*/function (_React$Component) {
|
|
|
3071
2982
|
clearTimeout(this.refreshInterval);
|
|
3072
2983
|
}
|
|
3073
2984
|
}
|
|
3074
|
-
}
|
|
2985
|
+
}
|
|
3075
2986
|
|
|
3076
|
-
|
|
2987
|
+
componentWillUnmount() {
|
|
3077
2988
|
if (this.refreshInterval) {
|
|
3078
2989
|
clearTimeout(this.refreshInterval);
|
|
3079
2990
|
}
|
|
3080
|
-
}
|
|
2991
|
+
}
|
|
3081
2992
|
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
2993
|
+
_setHovered(hovered, event) {
|
|
2994
|
+
const {
|
|
2995
|
+
mouseX,
|
|
2996
|
+
mouseY
|
|
2997
|
+
} = this.state;
|
|
2998
|
+
const {
|
|
2999
|
+
clientX,
|
|
3000
|
+
clientY
|
|
3001
|
+
} = event;
|
|
3088
3002
|
|
|
3089
3003
|
if (clientX !== mouseX || clientY !== mouseY) {
|
|
3090
3004
|
// mouse has moved
|
|
3091
|
-
this.setState(
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
};
|
|
3097
|
-
});
|
|
3005
|
+
this.setState(() => ({
|
|
3006
|
+
hovered,
|
|
3007
|
+
mouseX: clientX,
|
|
3008
|
+
mouseY: clientY
|
|
3009
|
+
}));
|
|
3098
3010
|
}
|
|
3099
|
-
}
|
|
3011
|
+
}
|
|
3100
3012
|
|
|
3101
|
-
|
|
3013
|
+
_renderTime(config) {
|
|
3102
3014
|
if (!this.props.time) {
|
|
3103
3015
|
return;
|
|
3104
3016
|
}
|
|
@@ -3114,43 +3026,36 @@ var Time = /*#__PURE__*/function (_React$Component) {
|
|
|
3114
3026
|
}
|
|
3115
3027
|
|
|
3116
3028
|
return TimeUtils.timeAgo(this.props.time, config);
|
|
3117
|
-
}
|
|
3118
|
-
|
|
3119
|
-
_proto._refresh = function _refresh() {
|
|
3120
|
-
var _this2 = this;
|
|
3029
|
+
}
|
|
3121
3030
|
|
|
3122
|
-
|
|
3123
|
-
|
|
3031
|
+
_refresh() {
|
|
3032
|
+
this.refreshInterval = setInterval(() => {
|
|
3033
|
+
this.forceUpdate();
|
|
3124
3034
|
}, DELAY);
|
|
3125
|
-
}
|
|
3126
|
-
|
|
3127
|
-
_proto.render = function render() {
|
|
3128
|
-
var _this3 = this;
|
|
3035
|
+
}
|
|
3129
3036
|
|
|
3130
|
-
|
|
3037
|
+
render() {
|
|
3038
|
+
let className = 'reactist_time';
|
|
3131
3039
|
|
|
3132
3040
|
if (this.props.className) {
|
|
3133
3041
|
className = this.props.className;
|
|
3134
3042
|
}
|
|
3135
3043
|
|
|
3136
|
-
|
|
3044
|
+
const timeComponent = this._renderTime(this.props.config);
|
|
3137
3045
|
|
|
3138
3046
|
return /*#__PURE__*/React__default.createElement("time", {
|
|
3139
3047
|
className: className,
|
|
3140
|
-
onMouseEnter:
|
|
3141
|
-
|
|
3142
|
-
},
|
|
3143
|
-
onMouseLeave: function onMouseLeave(event) {
|
|
3144
|
-
return _this3._setHovered(false, event);
|
|
3145
|
-
}
|
|
3048
|
+
onMouseEnter: event => this._setHovered(true, event),
|
|
3049
|
+
onMouseLeave: event => this._setHovered(false, event)
|
|
3146
3050
|
}, this.props.tooltipOnHover ? /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
3147
3051
|
content: this.props.tooltip || this.props.time && TimeUtils.formatTimeLong(this.props.time, this.props.config)
|
|
3148
3052
|
}, /*#__PURE__*/React__default.createElement("span", null, timeComponent)) : timeComponent);
|
|
3149
|
-
}
|
|
3053
|
+
}
|
|
3150
3054
|
|
|
3151
|
-
|
|
3152
|
-
}(React__default.Component);
|
|
3055
|
+
}
|
|
3153
3056
|
|
|
3057
|
+
Time.displayName = void 0;
|
|
3058
|
+
Time.defaultProps = void 0;
|
|
3154
3059
|
Time.displayName = 'Time';
|
|
3155
3060
|
Time.defaultProps = {
|
|
3156
3061
|
expandOnHover: false,
|
|
@@ -3166,67 +3071,65 @@ Time.defaultProps = {
|
|
|
3166
3071
|
}
|
|
3167
3072
|
};
|
|
3168
3073
|
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
}));
|
|
3179
|
-
};
|
|
3074
|
+
const CloseIcon$1 = () => /*#__PURE__*/React__default.createElement("svg", {
|
|
3075
|
+
width: "24",
|
|
3076
|
+
height: "24",
|
|
3077
|
+
viewBox: "0 0 24 24"
|
|
3078
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
3079
|
+
fill: "gray",
|
|
3080
|
+
fillRule: "evenodd",
|
|
3081
|
+
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"
|
|
3082
|
+
}));
|
|
3180
3083
|
|
|
3181
|
-
|
|
3084
|
+
const _excluded$t = ["id", "icon", "title", "subtitle", "children", "customCloseButton", "onClick", "onClose", "closeAltText", "className", "aria-live"];
|
|
3182
3085
|
|
|
3183
3086
|
function Notification(_ref) {
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
rest =
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3087
|
+
let {
|
|
3088
|
+
id,
|
|
3089
|
+
icon,
|
|
3090
|
+
title,
|
|
3091
|
+
subtitle,
|
|
3092
|
+
children,
|
|
3093
|
+
customCloseButton,
|
|
3094
|
+
onClick,
|
|
3095
|
+
onClose,
|
|
3096
|
+
closeAltText = 'Close',
|
|
3097
|
+
className,
|
|
3098
|
+
'aria-live': ariaLive = 'polite'
|
|
3099
|
+
} = _ref,
|
|
3100
|
+
rest = _objectWithoutProperties(_ref, _excluded$t);
|
|
3101
|
+
|
|
3102
|
+
const titleId = title ? id + "-title" : null;
|
|
3103
|
+
const titleIdAttribute = titleId ? {
|
|
3201
3104
|
id: titleId
|
|
3202
3105
|
} : null;
|
|
3203
|
-
|
|
3204
|
-
|
|
3106
|
+
const subtitleId = subtitle ? id + "-subtitle" : null;
|
|
3107
|
+
const subtitleIdAttribute = subtitleId ? {
|
|
3205
3108
|
id: subtitleId
|
|
3206
3109
|
} : null;
|
|
3207
|
-
|
|
3208
|
-
|
|
3110
|
+
const contentId = children ? id + "-content" : null;
|
|
3111
|
+
const contentIdAttribute = children ? {
|
|
3209
3112
|
id: id + "-content"
|
|
3210
3113
|
} : null;
|
|
3211
|
-
|
|
3114
|
+
const ariaLabelledBy = contentId ? {
|
|
3212
3115
|
'aria-labelledby': contentId
|
|
3213
3116
|
} : titleId ? {
|
|
3214
3117
|
'aria-labelledby': titleId
|
|
3215
3118
|
} : null;
|
|
3216
|
-
|
|
3119
|
+
const ariaDescribedBy = subtitleId && !children ? {
|
|
3217
3120
|
'aria-describedby': subtitleId
|
|
3218
3121
|
} : null;
|
|
3219
|
-
|
|
3122
|
+
const notificationContent = /*#__PURE__*/React__default.createElement("div", _objectSpread2({
|
|
3220
3123
|
className: "reactist-notification__content"
|
|
3221
|
-
}, contentIdAttribute), children
|
|
3124
|
+
}, contentIdAttribute), children != null ? children : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title ? /*#__PURE__*/React__default.createElement("h3", _objectSpread2({
|
|
3222
3125
|
className: "reactist-notification__title"
|
|
3223
|
-
}, titleIdAttribute), title) : null, subtitle ? /*#__PURE__*/React__default.createElement("p",
|
|
3126
|
+
}, titleIdAttribute), title) : null, subtitle ? /*#__PURE__*/React__default.createElement("p", _objectSpread2({
|
|
3224
3127
|
className: "reactist-notification__subtitle"
|
|
3225
3128
|
}, subtitleIdAttribute), subtitle) : null));
|
|
3226
|
-
|
|
3129
|
+
const notificationBody = /*#__PURE__*/React__default.createElement("div", {
|
|
3227
3130
|
className: "reactist-notification__icon-content-group"
|
|
3228
|
-
}, icon
|
|
3229
|
-
return /*#__PURE__*/React__default.createElement("div",
|
|
3131
|
+
}, icon != null ? icon : null, notificationContent);
|
|
3132
|
+
return /*#__PURE__*/React__default.createElement("div", _objectSpread2(_objectSpread2(_objectSpread2({
|
|
3230
3133
|
id: id,
|
|
3231
3134
|
role: "alert",
|
|
3232
3135
|
className: classNames('reactist-notification', className, {
|
|
@@ -3234,28 +3137,22 @@ function Notification(_ref) {
|
|
|
3234
3137
|
'reactist-notification--with-close-button': Boolean(onClose)
|
|
3235
3138
|
}),
|
|
3236
3139
|
"aria-live": ariaLive
|
|
3237
|
-
}, ariaLabelledBy, ariaDescribedBy, rest), onClick ? /*#__PURE__*/React__default.createElement("button", {
|
|
3140
|
+
}, ariaLabelledBy), ariaDescribedBy), rest), onClick ? /*#__PURE__*/React__default.createElement("button", {
|
|
3238
3141
|
className: "reactist-notification__button",
|
|
3239
3142
|
onClick: onClick
|
|
3240
3143
|
}, notificationBody) : notificationBody, onClose ? /*#__PURE__*/React__default.createElement("button", {
|
|
3241
3144
|
className: "reactist-notification__close-button",
|
|
3242
3145
|
onClick: onClose,
|
|
3243
3146
|
"aria-label": closeAltText
|
|
3244
|
-
}, customCloseButton
|
|
3245
|
-
}
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
_excluded7 = ["handleItemSelect"],
|
|
3254
|
-
_excluded8 = ["children", "onItemSelect"],
|
|
3255
|
-
_excluded9 = ["handleItemSelect"],
|
|
3256
|
-
_excluded10 = ["label", "children", "exceptionallySetClassName"],
|
|
3257
|
-
_excluded11 = ["handleItemSelect"];
|
|
3258
|
-
var MenuContext = /*#__PURE__*/React.createContext( // Reakit gives us no means to obtain a valid initial/default value of type MenuStateReturn
|
|
3147
|
+
}, customCloseButton != null ? customCloseButton : /*#__PURE__*/React__default.createElement(CloseIcon$1, null)) : null);
|
|
3148
|
+
}
|
|
3149
|
+
|
|
3150
|
+
const _excluded$u = ["children", "onItemSelect"],
|
|
3151
|
+
_excluded2$3 = ["exceptionallySetClassName"],
|
|
3152
|
+
_excluded3$2 = ["exceptionallySetClassName"],
|
|
3153
|
+
_excluded4$1 = ["value", "children", "onSelect", "hideOnSelect", "onClick", "exceptionallySetClassName", "as"],
|
|
3154
|
+
_excluded5$1 = ["label", "children", "exceptionallySetClassName"];
|
|
3155
|
+
const MenuContext = /*#__PURE__*/React.createContext( // Ariakit gives us no means to obtain a valid initial/default value of type MenuStateReturn
|
|
3259
3156
|
// (it is normally obtained by calling useMenuState but we can't call hooks outside components).
|
|
3260
3157
|
// This is however of little consequence since this value is only used if some of the components
|
|
3261
3158
|
// are used outside Menu, something that should not happen and we do not support.
|
|
@@ -3267,22 +3164,24 @@ var MenuContext = /*#__PURE__*/React.createContext( // Reakit gives us no means
|
|
|
3267
3164
|
*/
|
|
3268
3165
|
|
|
3269
3166
|
function Menu(_ref) {
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3167
|
+
let {
|
|
3168
|
+
children,
|
|
3169
|
+
onItemSelect
|
|
3170
|
+
} = _ref,
|
|
3171
|
+
props = _objectWithoutProperties(_ref, _excluded$u);
|
|
3172
|
+
|
|
3173
|
+
const state = Ariakit.useMenuState(_objectSpread2({
|
|
3174
|
+
focusLoop: true,
|
|
3175
|
+
gutter: 8,
|
|
3176
|
+
shift: 8
|
|
3277
3177
|
}, props));
|
|
3278
|
-
|
|
3178
|
+
const handleItemSelect = React.useCallback(function handleItemSelect(value) {
|
|
3279
3179
|
if (onItemSelect) onItemSelect(value);
|
|
3280
3180
|
}, [onItemSelect]);
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
}, [state, handleItemSelect]);
|
|
3181
|
+
const value = React.useMemo(() => ({
|
|
3182
|
+
state,
|
|
3183
|
+
handleItemSelect
|
|
3184
|
+
}), [state, handleItemSelect]);
|
|
3286
3185
|
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
3287
3186
|
value: value
|
|
3288
3187
|
}, children);
|
|
@@ -3292,69 +3191,38 @@ function Menu(_ref) {
|
|
|
3292
3191
|
*/
|
|
3293
3192
|
|
|
3294
3193
|
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
state = _objectWithoutPropertiesLoose(_React$useContext, _excluded3$2);
|
|
3194
|
+
const MenuButton = /*#__PURE__*/polymorphicComponent(function MenuButton(_ref2, ref) {
|
|
3195
|
+
let {
|
|
3196
|
+
exceptionallySetClassName
|
|
3197
|
+
} = _ref2,
|
|
3198
|
+
props = _objectWithoutProperties(_ref2, _excluded2$3);
|
|
3301
3199
|
|
|
3302
|
-
|
|
3200
|
+
const {
|
|
3201
|
+
state
|
|
3202
|
+
} = React.useContext(MenuContext);
|
|
3203
|
+
return /*#__PURE__*/React.createElement(Ariakit.MenuButton, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3204
|
+
state: state,
|
|
3303
3205
|
ref: ref,
|
|
3304
3206
|
className: classNames('reactist_menubutton', exceptionallySetClassName)
|
|
3305
3207
|
}));
|
|
3306
3208
|
});
|
|
3307
|
-
var BACKDROP_STYLE = {
|
|
3308
|
-
width: '100%',
|
|
3309
|
-
height: '100%',
|
|
3310
|
-
position: 'fixed',
|
|
3311
|
-
top: 0,
|
|
3312
|
-
left: 0
|
|
3313
|
-
};
|
|
3314
|
-
/**
|
|
3315
|
-
* Internal component to provide a backdrop/overlay to all menus. This is needed because reakit's
|
|
3316
|
-
* menus do not show an overlay by default.
|
|
3317
|
-
*/
|
|
3318
|
-
|
|
3319
|
-
function MenuBackdrop(_ref3) {
|
|
3320
|
-
var baseId = _ref3.baseId,
|
|
3321
|
-
visible = _ref3.visible,
|
|
3322
|
-
animated = _ref3.animated,
|
|
3323
|
-
animating = _ref3.animating,
|
|
3324
|
-
stopAnimation = _ref3.stopAnimation,
|
|
3325
|
-
modal = _ref3.modal,
|
|
3326
|
-
children = _ref3.children;
|
|
3327
|
-
return /*#__PURE__*/React.createElement(Popover$1.PopoverBackdrop, {
|
|
3328
|
-
baseId: baseId,
|
|
3329
|
-
visible: visible,
|
|
3330
|
-
animated: animated,
|
|
3331
|
-
animating: animating,
|
|
3332
|
-
stopAnimation: stopAnimation,
|
|
3333
|
-
modal: modal,
|
|
3334
|
-
style: BACKDROP_STYLE
|
|
3335
|
-
}, children);
|
|
3336
|
-
}
|
|
3337
3209
|
/**
|
|
3338
3210
|
* The dropdown menu itself, containing a list of menu items.
|
|
3339
3211
|
*/
|
|
3340
3212
|
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
React.
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
(_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();
|
|
3355
|
-
}
|
|
3356
|
-
}, [state.visible, previousVisible, state.unstable_referenceRef]);
|
|
3357
|
-
return state.visible ? /*#__PURE__*/React.createElement(MenuBackdrop, Object.assign({}, state), /*#__PURE__*/React.createElement(Reakit.Menu, Object.assign({}, props, state, {
|
|
3213
|
+
const MenuList = /*#__PURE__*/polymorphicComponent(function MenuList(_ref3, ref) {
|
|
3214
|
+
let {
|
|
3215
|
+
exceptionallySetClassName
|
|
3216
|
+
} = _ref3,
|
|
3217
|
+
props = _objectWithoutProperties(_ref3, _excluded3$2);
|
|
3218
|
+
|
|
3219
|
+
const {
|
|
3220
|
+
state
|
|
3221
|
+
} = React.useContext(MenuContext);
|
|
3222
|
+
return state.visible ? /*#__PURE__*/React.createElement(portal.Portal, {
|
|
3223
|
+
preserveTabOrder: true
|
|
3224
|
+
}, /*#__PURE__*/React.createElement(Ariakit.Menu, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3225
|
+
state: state,
|
|
3358
3226
|
ref: ref,
|
|
3359
3227
|
className: classNames('reactist_menulist', exceptionallySetClassName)
|
|
3360
3228
|
}))) : null;
|
|
@@ -3364,32 +3232,39 @@ var MenuList = /*#__PURE__*/polymorphicComponent(function MenuList(_ref4, ref) {
|
|
|
3364
3232
|
* callback.
|
|
3365
3233
|
*/
|
|
3366
3234
|
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3235
|
+
const MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref4, ref) {
|
|
3236
|
+
let {
|
|
3237
|
+
value,
|
|
3238
|
+
children,
|
|
3239
|
+
onSelect,
|
|
3240
|
+
hideOnSelect = true,
|
|
3241
|
+
onClick,
|
|
3242
|
+
exceptionallySetClassName,
|
|
3243
|
+
as = 'button'
|
|
3244
|
+
} = _ref4,
|
|
3245
|
+
props = _objectWithoutProperties(_ref4, _excluded4$1);
|
|
3246
|
+
|
|
3247
|
+
const {
|
|
3248
|
+
handleItemSelect,
|
|
3249
|
+
state
|
|
3250
|
+
} = React.useContext(MenuContext);
|
|
3251
|
+
const {
|
|
3252
|
+
hide
|
|
3253
|
+
} = state;
|
|
3254
|
+
const handleClick = React.useCallback(function handleClick(event) {
|
|
3255
|
+
onClick == null ? void 0 : onClick(event);
|
|
3256
|
+
const onSelectResult = onSelect && !event.defaultPrevented ? onSelect() : undefined;
|
|
3257
|
+
const shouldClose = onSelectResult !== false && hideOnSelect;
|
|
3386
3258
|
handleItemSelect(value);
|
|
3387
3259
|
if (shouldClose) hide();
|
|
3388
3260
|
}, [onSelect, onClick, handleItemSelect, hideOnSelect, hide, value]);
|
|
3389
|
-
return /*#__PURE__*/React.createElement(
|
|
3261
|
+
return /*#__PURE__*/React.createElement(Ariakit.MenuItem, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3262
|
+
as: as,
|
|
3263
|
+
state: state,
|
|
3390
3264
|
ref: ref,
|
|
3391
3265
|
onClick: handleClick,
|
|
3392
|
-
className: exceptionallySetClassName
|
|
3266
|
+
className: exceptionallySetClassName,
|
|
3267
|
+
hideOnClick: false
|
|
3393
3268
|
}), children);
|
|
3394
3269
|
});
|
|
3395
3270
|
/**
|
|
@@ -3414,35 +3289,32 @@ var MenuItem = /*#__PURE__*/polymorphicComponent(function MenuItem(_ref5, ref) {
|
|
|
3414
3289
|
* opening a sub-menu with the menu items list below it.
|
|
3415
3290
|
*/
|
|
3416
3291
|
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3292
|
+
const SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu({
|
|
3293
|
+
children,
|
|
3294
|
+
onItemSelect
|
|
3295
|
+
}, ref) {
|
|
3296
|
+
const {
|
|
3297
|
+
handleItemSelect: parentMenuItemSelect,
|
|
3298
|
+
state
|
|
3299
|
+
} = React.useContext(MenuContext);
|
|
3300
|
+
const {
|
|
3301
|
+
hide: parentMenuHide
|
|
3302
|
+
} = state;
|
|
3303
|
+
const handleSubItemSelect = React.useCallback(function handleSubItemSelect(value) {
|
|
3428
3304
|
if (onItemSelect) onItemSelect(value);
|
|
3429
3305
|
parentMenuItemSelect(value);
|
|
3430
3306
|
parentMenuHide();
|
|
3431
3307
|
}, [parentMenuHide, parentMenuItemSelect, onItemSelect]);
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
list = _React$Children$toArr[1];
|
|
3436
|
-
|
|
3437
|
-
return /*#__PURE__*/React.createElement(Reakit.MenuItem, Object.assign({}, state, props, {
|
|
3438
|
-
ref: ref
|
|
3439
|
-
}), function (buttonProps) {
|
|
3440
|
-
return /*#__PURE__*/React.createElement(Menu, {
|
|
3441
|
-
onItemSelect: handleSubItemSelect
|
|
3442
|
-
}, /*#__PURE__*/React.cloneElement(button, _objectSpread2(_objectSpread2({}, buttonProps), {}, {
|
|
3443
|
-
className: classNames(buttonProps.className, 'reactist_submenu_button')
|
|
3444
|
-
})), list);
|
|
3308
|
+
const [button, list] = React.Children.toArray(children);
|
|
3309
|
+
const menuProps = Ariakit.useMenuItem({
|
|
3310
|
+
state
|
|
3445
3311
|
});
|
|
3312
|
+
return /*#__PURE__*/React.createElement(Menu, {
|
|
3313
|
+
onItemSelect: handleSubItemSelect
|
|
3314
|
+
}, /*#__PURE__*/React.cloneElement(button, _objectSpread2(_objectSpread2({}, menuProps), {}, {
|
|
3315
|
+
className: classNames(menuProps.className, 'reactist_submenu_button'),
|
|
3316
|
+
ref
|
|
3317
|
+
})), list);
|
|
3446
3318
|
});
|
|
3447
3319
|
/**
|
|
3448
3320
|
* A way to semantically group some menu items.
|
|
@@ -3451,18 +3323,20 @@ var SubMenu = /*#__PURE__*/React.forwardRef(function SubMenu(_ref6, ref) {
|
|
|
3451
3323
|
* before and/or after the group if you so wish.
|
|
3452
3324
|
*/
|
|
3453
3325
|
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
}, props,
|
|
3326
|
+
const MenuGroup = /*#__PURE__*/polymorphicComponent(function MenuGroup(_ref5, ref) {
|
|
3327
|
+
let {
|
|
3328
|
+
label,
|
|
3329
|
+
children,
|
|
3330
|
+
exceptionallySetClassName
|
|
3331
|
+
} = _ref5,
|
|
3332
|
+
props = _objectWithoutProperties(_ref5, _excluded5$1);
|
|
3333
|
+
|
|
3334
|
+
const {
|
|
3335
|
+
state
|
|
3336
|
+
} = React.useContext(MenuContext);
|
|
3337
|
+
return /*#__PURE__*/React.createElement(Ariakit.MenuGroup, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3338
|
+
ref: ref,
|
|
3339
|
+
state: state,
|
|
3466
3340
|
className: exceptionallySetClassName
|
|
3467
3341
|
}), label ? /*#__PURE__*/React.createElement("div", {
|
|
3468
3342
|
role: "presentation",
|
|
@@ -3472,58 +3346,51 @@ var MenuGroup = /*#__PURE__*/polymorphicComponent(function MenuGroud(_ref7, ref)
|
|
|
3472
3346
|
|
|
3473
3347
|
/** @deprecated */
|
|
3474
3348
|
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
function Box() {
|
|
3479
|
-
var _this;
|
|
3480
|
-
|
|
3481
|
-
_this = _React$Component.apply(this, arguments) || this;
|
|
3349
|
+
class Box$2 extends React__default.Component {
|
|
3350
|
+
constructor(...args) {
|
|
3351
|
+
super(...args);
|
|
3482
3352
|
|
|
3483
|
-
|
|
3353
|
+
this._closeModal = () => {
|
|
3484
3354
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3485
|
-
|
|
3355
|
+
const modalElement = document.getElementById('modal_box');
|
|
3486
3356
|
ReactDOM.unmountComponentAtNode(modalElement);
|
|
3487
3357
|
};
|
|
3488
3358
|
|
|
3489
|
-
|
|
3359
|
+
this._handleKeyDown = event => {
|
|
3490
3360
|
if (event.keyCode === 27) {
|
|
3491
3361
|
// ESC
|
|
3492
|
-
|
|
3362
|
+
this._closeModal();
|
|
3493
3363
|
|
|
3494
3364
|
if (event.preventDefault) event.preventDefault();
|
|
3495
3365
|
}
|
|
3496
3366
|
};
|
|
3497
3367
|
|
|
3498
|
-
|
|
3368
|
+
this._handleOverlayClick = event => {
|
|
3499
3369
|
if (event.target instanceof Element && (event.target.id === 'reactist-overlay' || event.target.id === 'reactist-overlay-inner')) {
|
|
3500
|
-
|
|
3370
|
+
this._closeModal();
|
|
3501
3371
|
}
|
|
3502
3372
|
};
|
|
3503
|
-
|
|
3504
|
-
return _this;
|
|
3505
3373
|
}
|
|
3506
3374
|
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
3375
|
+
componentDidMount() {
|
|
3510
3376
|
window.addEventListener('keydown', this._handleKeyDown);
|
|
3511
|
-
}
|
|
3377
|
+
}
|
|
3512
3378
|
|
|
3513
|
-
|
|
3379
|
+
componentWillUnmount() {
|
|
3514
3380
|
window.removeEventListener('keydown', this._handleKeyDown);
|
|
3515
|
-
}
|
|
3381
|
+
}
|
|
3516
3382
|
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3383
|
+
render() {
|
|
3384
|
+
const {
|
|
3385
|
+
large,
|
|
3386
|
+
medium,
|
|
3387
|
+
style,
|
|
3388
|
+
children,
|
|
3389
|
+
closeOnOverlayClick
|
|
3390
|
+
} = this.props;
|
|
3391
|
+
const className = classNames('reactist_modal_box', {
|
|
3392
|
+
large,
|
|
3393
|
+
medium
|
|
3527
3394
|
}, this.props.className);
|
|
3528
3395
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
3529
3396
|
className: "reactist_overlay",
|
|
@@ -3536,11 +3403,12 @@ var Box$2 = /*#__PURE__*/function (_React$Component) {
|
|
|
3536
3403
|
style: style,
|
|
3537
3404
|
className: className
|
|
3538
3405
|
}, children)));
|
|
3539
|
-
}
|
|
3406
|
+
}
|
|
3540
3407
|
|
|
3541
|
-
|
|
3542
|
-
}(React__default.Component);
|
|
3408
|
+
}
|
|
3543
3409
|
|
|
3410
|
+
Box$2.displayName = void 0;
|
|
3411
|
+
Box$2.defaultProps = void 0;
|
|
3544
3412
|
Box$2.displayName = 'Modal.Box';
|
|
3545
3413
|
Box$2.defaultProps = {
|
|
3546
3414
|
large: false,
|
|
@@ -3548,16 +3416,8 @@ Box$2.defaultProps = {
|
|
|
3548
3416
|
};
|
|
3549
3417
|
/** @deprecated */
|
|
3550
3418
|
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
function Header() {
|
|
3555
|
-
return _React$Component2.apply(this, arguments) || this;
|
|
3556
|
-
}
|
|
3557
|
-
|
|
3558
|
-
var _proto2 = Header.prototype;
|
|
3559
|
-
|
|
3560
|
-
_proto2._closeModal = function _closeModal(event) {
|
|
3419
|
+
class Header extends React__default.Component {
|
|
3420
|
+
_closeModal(event) {
|
|
3561
3421
|
event.preventDefault();
|
|
3562
3422
|
|
|
3563
3423
|
if (typeof this.props.beforeClose === 'function') {
|
|
@@ -3565,11 +3425,11 @@ var Header = /*#__PURE__*/function (_React$Component2) {
|
|
|
3565
3425
|
} // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3566
3426
|
|
|
3567
3427
|
|
|
3568
|
-
|
|
3428
|
+
const modalElement = document.getElementById('modal_box');
|
|
3569
3429
|
ReactDOM.unmountComponentAtNode(modalElement);
|
|
3570
|
-
}
|
|
3430
|
+
}
|
|
3571
3431
|
|
|
3572
|
-
|
|
3432
|
+
render() {
|
|
3573
3433
|
return (
|
|
3574
3434
|
/*#__PURE__*/
|
|
3575
3435
|
|
|
@@ -3588,39 +3448,33 @@ var Header = /*#__PURE__*/function (_React$Component2) {
|
|
|
3588
3448
|
/* eslint-enable jsx-a11y/anchor-is-valid */
|
|
3589
3449
|
|
|
3590
3450
|
);
|
|
3591
|
-
}
|
|
3451
|
+
}
|
|
3592
3452
|
|
|
3593
|
-
|
|
3594
|
-
}(React__default.Component);
|
|
3453
|
+
}
|
|
3595
3454
|
|
|
3455
|
+
Header.displayName = void 0;
|
|
3456
|
+
Header.defaultProps = void 0;
|
|
3596
3457
|
Header.displayName = 'Modal.Header';
|
|
3597
3458
|
/** @deprecated */
|
|
3598
3459
|
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
function Body() {
|
|
3603
|
-
return _React$Component3.apply(this, arguments) || this;
|
|
3604
|
-
}
|
|
3605
|
-
|
|
3606
|
-
var _proto3 = Body.prototype;
|
|
3607
|
-
|
|
3608
|
-
_proto3._closeModal = function _closeModal(event) {
|
|
3460
|
+
class Body$1 extends React__default.Component {
|
|
3461
|
+
_closeModal(event) {
|
|
3609
3462
|
event.preventDefault(); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3610
3463
|
|
|
3611
|
-
|
|
3464
|
+
const modalElement = document.getElementById('modal_box');
|
|
3612
3465
|
ReactDOM.unmountComponentAtNode(modalElement);
|
|
3613
|
-
}
|
|
3466
|
+
}
|
|
3614
3467
|
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3468
|
+
render() {
|
|
3469
|
+
const {
|
|
3470
|
+
icon,
|
|
3471
|
+
plain,
|
|
3472
|
+
children,
|
|
3473
|
+
style,
|
|
3474
|
+
showCloseIcon
|
|
3475
|
+
} = this.props;
|
|
3476
|
+
const className = classNames('reactist_modal_box__body', {
|
|
3477
|
+
plain
|
|
3624
3478
|
}, this.props.className);
|
|
3625
3479
|
return (
|
|
3626
3480
|
/*#__PURE__*/
|
|
@@ -3643,49 +3497,38 @@ var Body$1 = /*#__PURE__*/function (_React$Component3) {
|
|
|
3643
3497
|
/* eslint-enable jsx-a11y/anchor-is-valid */
|
|
3644
3498
|
|
|
3645
3499
|
);
|
|
3646
|
-
}
|
|
3500
|
+
}
|
|
3647
3501
|
|
|
3648
|
-
|
|
3649
|
-
}(React__default.Component);
|
|
3502
|
+
}
|
|
3650
3503
|
|
|
3504
|
+
Body$1.displayName = void 0;
|
|
3505
|
+
Body$1.defaultProps = void 0;
|
|
3651
3506
|
Body$1.displayName = 'Modal.Body';
|
|
3652
3507
|
Body$1.defaultProps = {
|
|
3653
3508
|
showCloseIcon: false
|
|
3654
3509
|
};
|
|
3655
3510
|
/** @deprecated */
|
|
3656
3511
|
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
function Actions() {
|
|
3661
|
-
return _React$Component4.apply(this, arguments) || this;
|
|
3662
|
-
}
|
|
3663
|
-
|
|
3664
|
-
var _proto4 = Actions.prototype;
|
|
3665
|
-
|
|
3666
|
-
_proto4._onClick = function _onClick(onClick) {
|
|
3512
|
+
class Actions extends React__default.Component {
|
|
3513
|
+
_onClick(onClick) {
|
|
3667
3514
|
if (onClick) {
|
|
3668
3515
|
onClick();
|
|
3669
3516
|
} // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3670
3517
|
|
|
3671
3518
|
|
|
3672
|
-
|
|
3519
|
+
const modalElement = document.getElementById('modal_box');
|
|
3673
3520
|
ReactDOM.unmountComponentAtNode(modalElement);
|
|
3674
|
-
}
|
|
3675
|
-
|
|
3676
|
-
_proto4.render = function render() {
|
|
3677
|
-
var _this2 = this;
|
|
3521
|
+
}
|
|
3678
3522
|
|
|
3679
|
-
|
|
3523
|
+
render() {
|
|
3524
|
+
const children = React__default.Children.map( // see: https://github.com/microsoft/TypeScript/issues/21699
|
|
3680
3525
|
// @ts-expect-error Children cannot be typed properly yet in React
|
|
3681
|
-
this.props.children,
|
|
3526
|
+
this.props.children, child => {
|
|
3682
3527
|
var _child$props;
|
|
3683
3528
|
|
|
3684
|
-
if (child
|
|
3529
|
+
if (child != null && (_child$props = child.props) != null && _child$props.close) {
|
|
3685
3530
|
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
3686
|
-
onClick:
|
|
3687
|
-
return _this2._onClick(child.props.onClick);
|
|
3688
|
-
}
|
|
3531
|
+
onClick: () => this._onClick(child.props.onClick)
|
|
3689
3532
|
});
|
|
3690
3533
|
} else {
|
|
3691
3534
|
return child ? /*#__PURE__*/React__default.cloneElement(child) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
|
|
@@ -3694,32 +3537,29 @@ var Actions = /*#__PURE__*/function (_React$Component4) {
|
|
|
3694
3537
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
3695
3538
|
className: "reactist_modal_box__actions"
|
|
3696
3539
|
}, children);
|
|
3697
|
-
}
|
|
3540
|
+
}
|
|
3698
3541
|
|
|
3699
|
-
|
|
3700
|
-
}(React__default.Component);
|
|
3542
|
+
}
|
|
3701
3543
|
|
|
3544
|
+
Actions.displayName = void 0;
|
|
3702
3545
|
Actions.displayName = 'Modal.Actions';
|
|
3703
3546
|
|
|
3704
3547
|
var index = {
|
|
3705
3548
|
Box: Box$2,
|
|
3706
|
-
Header
|
|
3549
|
+
Header,
|
|
3707
3550
|
Body: Body$1,
|
|
3708
|
-
Actions
|
|
3551
|
+
Actions
|
|
3709
3552
|
};
|
|
3710
3553
|
|
|
3711
3554
|
/** @deprecated */
|
|
3712
3555
|
|
|
3713
|
-
function Loading$1(
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
3721
|
-
_ref$ariaLabel = _ref['aria-label'],
|
|
3722
|
-
ariaLabel = _ref$ariaLabel === void 0 ? 'Loading' : _ref$ariaLabel;
|
|
3556
|
+
function Loading$1({
|
|
3557
|
+
className,
|
|
3558
|
+
spinnerColor = '#3F82EF',
|
|
3559
|
+
bgColor = '#D9E6FB',
|
|
3560
|
+
size = 24,
|
|
3561
|
+
'aria-label': ariaLabel = 'Loading'
|
|
3562
|
+
}) {
|
|
3723
3563
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
3724
3564
|
className: classNames('reactist_loading', className),
|
|
3725
3565
|
"aria-label": ariaLabel,
|