baseui 14.0.0 → 15.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/accordion.js +4 -4
- package/accordion/panel.d.ts +1 -1
- package/accordion/styled-components.js +1 -1
- package/accordion/types.d.ts +1 -1
- package/app-nav-bar/mobile-menu.js +3 -1
- package/banner/banner.js +3 -1
- package/banner/types.d.ts +2 -1
- package/bottom-navigation/bottom-navigation.js +3 -1
- package/bottom-navigation/selector.js +1 -1
- package/bottom-navigation/styled-components.js +1 -1
- package/button/button.d.ts +1 -3
- package/button/button.js +6 -2
- package/button/styled-components.d.ts +1 -0
- package/button/styled-components.js +61 -4
- package/button/types.d.ts +15 -3
- package/button-timed/button-timed.js +4 -5
- package/button-timed/styled-components.js +5 -3
- package/button-timed/types.d.ts +1 -1
- package/data-table/column-categorical.js +2 -2
- package/data-table/locale.d.ts +2 -0
- package/data-table/locale.js +2 -1
- package/data-table/stateful-container.js +1 -1
- package/data-table/stateful-data-table.js +7 -3
- package/data-table/types.d.ts +2 -0
- package/datepicker/day.js +2 -4
- package/datepicker/utils/date-helpers.d.ts +1 -0
- package/datepicker/utils/date-helpers.js +3 -0
- package/dialog/dialog.d.ts +1 -1
- package/dialog/dialog.js +38 -56
- package/dialog/styled-components.d.ts +2 -2
- package/dialog/styled-components.js +56 -24
- package/dialog/types.d.ts +5 -2
- package/file-uploader/constants.d.ts +16 -0
- package/file-uploader/constants.js +30 -0
- package/file-uploader/file-uploader.d.ts +2 -2
- package/file-uploader/file-uploader.js +387 -117
- package/file-uploader/index.d.ts +1 -1
- package/file-uploader/index.js +67 -18
- package/file-uploader/locale.d.ts +10 -10
- package/file-uploader/locale.js +5 -5
- package/file-uploader/styled-components.d.ts +13 -6
- package/file-uploader/styled-components.js +261 -64
- package/file-uploader/types.d.ts +47 -32
- package/file-uploader/utils.d.ts +5 -0
- package/file-uploader/utils.js +45 -0
- package/file-uploader-basic/file-uploader-basic.d.ts +10 -0
- package/file-uploader-basic/file-uploader-basic.js +175 -0
- package/file-uploader-basic/index.d.ts +4 -0
- package/file-uploader-basic/index.js +71 -0
- package/file-uploader-basic/locale.d.ts +15 -0
- package/file-uploader-basic/locale.js +21 -0
- package/file-uploader-basic/styled-components.d.ts +7 -0
- package/file-uploader-basic/styled-components.js +83 -0
- package/file-uploader-basic/types.d.ts +41 -0
- package/form-control/form-control.js +38 -3
- package/form-control/styled-components.d.ts +2 -0
- package/form-control/styled-components.js +22 -2
- package/form-control/types.d.ts +4 -0
- package/icon/circle-check-filled.d.ts +9 -0
- package/icon/circle-check-filled.js +50 -0
- package/icon/circle-exclamation-point-filled.d.ts +9 -0
- package/icon/circle-exclamation-point-filled.js +50 -0
- package/icon/hide.js +1 -1
- package/icon/icon-exports.d.ts +4 -0
- package/icon/icon-exports.js +28 -0
- package/icon/paperclip-filled.d.ts +9 -0
- package/icon/paperclip-filled.js +50 -0
- package/icon/show.js +1 -1
- package/icon/trash-can-filled.d.ts +9 -0
- package/{button-docked/button-docked.js → icon/trash-can-filled.js} +35 -16
- package/locale/en_US.js +14 -12
- package/locale/es_AR.js +9 -1
- package/locale/index.d.ts +3 -0
- package/locale/index.js +2 -0
- package/locale/tr_TR.js +9 -1
- package/locale/types.d.ts +2 -0
- package/message-card/message-card.js +2 -2
- package/message-card/utils.js +8 -3
- package/modal/modal-button.d.ts +1 -3
- package/package.json +5 -3
- package/payment-card/custom-cards.config.d.ts +1 -11
- package/payment-card/payment-card.js +1 -3
- package/phone-input/base-country-picker.js +2 -2
- package/phone-input/country-picker.js +0 -10
- package/progress-bar/progressbar-rounded.js +1 -1
- package/progress-bar/styled-components.js +8 -6
- package/rating/styled-components.js +3 -2
- package/rating/svg-icons.d.ts +5 -5
- package/rating/svg-icons.js +20 -20
- package/select/multi-value.js +1 -1
- package/snackbar/index.d.ts +1 -0
- package/snackbar/snackbar-context.d.ts +1 -2
- package/snackbar/snackbar-context.js +27 -21
- package/spinner/index.d.ts +4 -2
- package/stepper/stepper.js +28 -27
- package/styles/__mocks__/styled.js +0 -2
- package/styles/as-primary-export-hoc.js +0 -2
- package/styles/styled.js +0 -2
- package/styles/types.d.ts +7 -3
- package/tabs-motion/tabs.js +2 -2
- package/tag/constants.d.ts +5 -4
- package/tag/constants.js +7 -6
- package/tag/index.d.ts +1 -1
- package/tag/index.js +7 -7
- package/tag/styled-components.d.ts +1 -1
- package/tag/styled-components.js +137 -124
- package/tag/tag.js +2 -2
- package/tag/types.d.ts +9 -8
- package/tag/types.js +2 -2
- package/themes/dark-theme/color-component-tokens.d.ts +2 -2
- package/themes/dark-theme/color-component-tokens.js +279 -275
- package/themes/dark-theme/color-foundation-tokens.d.ts +3 -0
- package/themes/dark-theme/{color-tokens.js → color-foundation-tokens.js} +11 -14
- package/themes/dark-theme/color-semantic-tokens.d.ts +2 -2
- package/themes/dark-theme/color-semantic-tokens.js +52 -58
- package/themes/dark-theme/create-dark-theme.d.ts +1 -1
- package/themes/dark-theme/create-dark-theme.js +12 -32
- package/themes/dark-theme/dark-theme.js +4 -4
- package/themes/dark-theme/primitives.js +2 -2
- package/themes/light-theme/color-component-tokens.d.ts +2 -2
- package/themes/light-theme/color-component-tokens.js +287 -282
- package/themes/light-theme/color-foundation-tokens.d.ts +3 -0
- package/themes/light-theme/{color-tokens.js → color-foundation-tokens.js} +10 -13
- package/themes/light-theme/color-semantic-tokens.d.ts +2 -2
- package/themes/light-theme/color-semantic-tokens.js +50 -53
- package/themes/light-theme/create-light-theme.d.ts +1 -1
- package/themes/light-theme/create-light-theme.js +12 -32
- package/themes/light-theme/light-theme.js +4 -4
- package/themes/light-theme/primitives.js +2 -2
- package/themes/types.d.ts +74 -13
- package/themes/utils.d.ts +1 -1
- package/themes/utils.js +4 -4
- package/tile/tile-group.js +2 -2
- package/timezonepicker/update-tzdata.js +0 -1
- package/tokens/color-primitive-tokens.d.ts +5 -0
- package/tokens/color-primitive-tokens.js +301 -0
- package/tokens/index.d.ts +5 -4
- package/tokens/index.js +25 -3
- package/tokens/types.d.ts +170 -1
- package/button-docked/button-docked.d.ts +0 -4
- package/button-docked/index.d.ts +0 -3
- package/button-docked/index.js +0 -40
- package/button-docked/styled-components.d.ts +0 -5
- package/button-docked/styled-components.js +0 -55
- package/button-docked/types.d.ts +0 -14
- package/themes/dark-theme/color-tokens.d.ts +0 -3
- package/themes/light-theme/color-tokens.d.ts +0 -3
- package/tokens/colors.d.ts +0 -3
- package/tokens/colors.js +0 -125
- /package/{button-docked → file-uploader-basic}/types.js +0 -0
package/dialog/dialog.js
CHANGED
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactFocusLock = _interopRequireDefault(require("react-focus-lock"));
|
|
9
|
+
var _layer = require("../layer");
|
|
8
10
|
var _index = require("../styles/index");
|
|
9
11
|
var _overrides = require("../helpers/overrides");
|
|
10
12
|
var _buttonDock = require("../button-dock");
|
|
@@ -12,6 +14,7 @@ var _button = require("../button");
|
|
|
12
14
|
var _icon = require("../icon");
|
|
13
15
|
var _styledComponents = require("./styled-components");
|
|
14
16
|
var _constants = require("./constants");
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
20
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /*
|
|
@@ -31,22 +34,26 @@ function renderArtwork(artwork) {
|
|
|
31
34
|
}
|
|
32
35
|
const DefaultDismissButton = props => {
|
|
33
36
|
const overrides = {
|
|
37
|
+
...props.overrides,
|
|
34
38
|
BaseButton: {
|
|
39
|
+
...props.overrides?.BaseButton,
|
|
35
40
|
style: {
|
|
36
41
|
position: 'absolute',
|
|
37
42
|
top: '16px',
|
|
38
43
|
right: '8px',
|
|
39
44
|
// this will be tokenized in the future
|
|
40
45
|
backgroundColor: 'rgba(255, 255, 255, 0.6)',
|
|
41
|
-
zIndex: 1
|
|
46
|
+
zIndex: 1,
|
|
47
|
+
...props.overrides?.BaseButton?.style
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
};
|
|
45
51
|
return /*#__PURE__*/_react.default.createElement(_button.Button, _extends({
|
|
46
52
|
kind: _button.KIND.secondary,
|
|
47
|
-
shape: _button.SHAPE.circle
|
|
53
|
+
shape: _button.SHAPE.circle
|
|
54
|
+
}, props, {
|
|
48
55
|
overrides: overrides
|
|
49
|
-
}
|
|
56
|
+
}), /*#__PURE__*/_react.default.createElement(_icon.Delete, {
|
|
50
57
|
size: 36
|
|
51
58
|
}));
|
|
52
59
|
};
|
|
@@ -69,7 +76,7 @@ const Dialog = ({
|
|
|
69
76
|
artwork,
|
|
70
77
|
buttonDock,
|
|
71
78
|
children,
|
|
72
|
-
|
|
79
|
+
onDismiss,
|
|
73
80
|
showDismissButton = true,
|
|
74
81
|
hasOverlay = true,
|
|
75
82
|
heading,
|
|
@@ -77,33 +84,21 @@ const Dialog = ({
|
|
|
77
84
|
overrides = {},
|
|
78
85
|
placement = _constants.PLACEMENT.center,
|
|
79
86
|
numHeadingLines = 2,
|
|
80
|
-
size = _constants.SIZE.xSmall
|
|
87
|
+
size = _constants.SIZE.xSmall,
|
|
88
|
+
autoFocus = true
|
|
81
89
|
}) => {
|
|
82
90
|
const [Root, rootProps] = (0, _overrides.getOverrides)(overrides.Root, _styledComponents.StyledRoot);
|
|
83
91
|
const [ScrollContainer, scrollContainerProps] = (0, _overrides.getOverrides)(overrides.ScrollContainer, _styledComponents.StyledScrollContainer);
|
|
84
92
|
const [Heading, headingProps] = (0, _overrides.getOverrides)(overrides.Heading, _styledComponents.StyledHeading);
|
|
93
|
+
const [Overlay, overlayProps] = (0, _overrides.getOverrides)(overrides.Overlay, _styledComponents.StyledOverlay);
|
|
85
94
|
const [Body, bodyProps] = (0, _overrides.getOverrides)(overrides.Body, _styledComponents.StyledBody);
|
|
86
95
|
const [ButtonDock, buttonDockProps] = (0, _overrides.getOverrides)(overrides.ButtonDock, DefaultButtonDock);
|
|
87
96
|
const [DismissButton, dismissButtonProps] = (0, _overrides.getOverrides)(overrides.DismissButton, DefaultDismissButton);
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
// controls the dialog's open/close state
|
|
91
|
-
_react.default.useEffect(() => {
|
|
92
|
-
if (isOpen) {
|
|
93
|
-
if (hasOverlay) {
|
|
94
|
-
dialogRef.current?.showModal();
|
|
95
|
-
document.body.style.overflow = 'hidden';
|
|
96
|
-
} else {
|
|
97
|
-
dialogRef.current?.show();
|
|
98
|
-
}
|
|
99
|
-
} else {
|
|
100
|
-
dialogRef.current?.close();
|
|
101
|
-
}
|
|
102
|
-
}, [isOpen, hasOverlay]);
|
|
97
|
+
const overlayRef = (0, _react.useRef)(null);
|
|
103
98
|
|
|
104
99
|
// prevents background scrolling when the dialog is open and has an overlay
|
|
105
|
-
const originalOverflowRef = _react.
|
|
106
|
-
_react.
|
|
100
|
+
const originalOverflowRef = (0, _react.useRef)(typeof document !== 'undefined' ? document?.body?.style?.overflow : '');
|
|
101
|
+
(0, _react.useEffect)(() => {
|
|
107
102
|
const originalOverflow = originalOverflowRef.current;
|
|
108
103
|
if (isOpen && hasOverlay) {
|
|
109
104
|
document.body.style.overflow = 'hidden';
|
|
@@ -115,46 +110,33 @@ const Dialog = ({
|
|
|
115
110
|
};
|
|
116
111
|
}, [isOpen, hasOverlay]);
|
|
117
112
|
function handleOutsideClick(e) {
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
handleDismiss();
|
|
113
|
+
if (e.target && e.target instanceof HTMLElement && e.target.contains(overlayRef.current) && onDismiss) {
|
|
114
|
+
onDismiss();
|
|
121
115
|
}
|
|
122
116
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
if (e.key === 'Escape') {
|
|
126
|
-
handleDismiss();
|
|
127
|
-
}
|
|
117
|
+
function handleEscape() {
|
|
118
|
+
onDismiss && onDismiss();
|
|
128
119
|
}
|
|
129
|
-
_react.default.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
clearTimeout(timer);
|
|
139
|
-
document.removeEventListener('click', handleOutsideClick);
|
|
140
|
-
document.removeEventListener('keydown', handleEscapeKey);
|
|
141
|
-
};
|
|
142
|
-
} else {
|
|
143
|
-
document.removeEventListener('click', handleOutsideClick);
|
|
144
|
-
document.removeEventListener('keydown', handleEscapeKey);
|
|
145
|
-
}
|
|
146
|
-
}, [isOpen]);
|
|
147
|
-
return /*#__PURE__*/_react.default.createElement(Root, _extends({
|
|
148
|
-
ref: dialogRef,
|
|
149
|
-
$isOpen: isOpen,
|
|
120
|
+
return isOpen ? /*#__PURE__*/_react.default.createElement(_layer.Layer, {
|
|
121
|
+
onDocumentClick: handleOutsideClick,
|
|
122
|
+
onEscape: handleEscape
|
|
123
|
+
}, hasOverlay && /*#__PURE__*/_react.default.createElement(Overlay, _extends({
|
|
124
|
+
ref: overlayRef
|
|
125
|
+
}, overlayProps)), /*#__PURE__*/_react.default.createElement(_reactFocusLock.default, {
|
|
126
|
+
returnFocus: true,
|
|
127
|
+
autoFocus: autoFocus
|
|
128
|
+
}, /*#__PURE__*/_react.default.createElement(Root, _extends({
|
|
150
129
|
$size: size,
|
|
151
|
-
$placement: placement
|
|
152
|
-
|
|
153
|
-
|
|
130
|
+
$placement: placement,
|
|
131
|
+
role: "dialog",
|
|
132
|
+
"aria-labelledby": "dialog-title"
|
|
133
|
+
}, rootProps), onDismiss && showDismissButton && /*#__PURE__*/_react.default.createElement(DismissButton, _extends({
|
|
134
|
+
onClick: () => onDismiss()
|
|
154
135
|
}, dismissButtonProps)), /*#__PURE__*/_react.default.createElement(ScrollContainer, _extends({}, scrollContainerProps, {
|
|
155
136
|
tabIndex: 0
|
|
156
137
|
}), renderArtwork(artwork), /*#__PURE__*/_react.default.createElement(Heading, _extends({
|
|
157
|
-
$numHeadingLines: numHeadingLines
|
|
158
|
-
|
|
138
|
+
$numHeadingLines: numHeadingLines,
|
|
139
|
+
id: "dialog-title"
|
|
140
|
+
}, headingProps), heading), /*#__PURE__*/_react.default.createElement(Body, bodyProps, children)), buttonDock && /*#__PURE__*/_react.default.createElement(ButtonDock, _extends({}, buttonDock, buttonDockProps))))) : null;
|
|
159
141
|
};
|
|
160
142
|
var _default = exports.default = Dialog;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Size, Placement } from './types';
|
|
2
|
-
export declare const StyledRoot: import("styletron-react").StyletronComponent<"
|
|
2
|
+
export declare const StyledRoot: import("styletron-react").StyletronComponent<"div", {
|
|
3
3
|
$size: Size;
|
|
4
4
|
$placement: Placement;
|
|
5
|
-
$isOpen: boolean;
|
|
6
5
|
}>;
|
|
6
|
+
export declare const StyledOverlay: import("styletron-react").StyletronComponent<"div", {}>;
|
|
7
7
|
export declare const StyledScrollContainer: import("styletron-react").StyletronComponent<"div", {}>;
|
|
8
8
|
export declare const StyledHeading: import("styletron-react").StyletronComponent<"div", {
|
|
9
9
|
$numHeadingLines: number;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.StyledScrollContainer = exports.StyledRoot = exports.StyledHeading = exports.StyledBody = void 0;
|
|
6
|
+
exports.StyledScrollContainer = exports.StyledRoot = exports.StyledOverlay = exports.StyledHeading = exports.StyledBody = void 0;
|
|
7
7
|
var _styles = require("../styles");
|
|
8
8
|
var _constants = require("./constants");
|
|
9
9
|
/*
|
|
@@ -70,21 +70,48 @@ const getPlacementStyles = (placement, gutter) => {
|
|
|
70
70
|
return defaultStyles;
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
+
const getAnimationStyles = placement => {
|
|
74
|
+
const transformValuesByPlacement = {
|
|
75
|
+
[_constants.PLACEMENT.topLeft]: ['translateY(16px)', 'translateY(0px)'],
|
|
76
|
+
[_constants.PLACEMENT.topCenter]: ['translateX(-50%) translateY(16px)', 'translateX(-50%) translateY(0px)'],
|
|
77
|
+
[_constants.PLACEMENT.topRight]: ['translateY(16px)', 'translateY(0px)'],
|
|
78
|
+
[_constants.PLACEMENT.bottomLeft]: ['translateY(16px)', 'translateY(0px)'],
|
|
79
|
+
[_constants.PLACEMENT.bottomCenter]: ['translateX(-50%) translateY(16px)', 'translateX(-50%) translateY(0px)'],
|
|
80
|
+
[_constants.PLACEMENT.bottomRight]: ['translateY(16px)', 'translateY(0px)'],
|
|
81
|
+
[_constants.PLACEMENT.center]: ['translateX(-50%) translateY(calc(-50% + 16px))', 'translateX(-50%) translateY(-50%)']
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
animationDuration: '400ms',
|
|
85
|
+
animationTimingFunction: 'cubic-bezier(0.22, 1, 0.36, 1)',
|
|
86
|
+
animationName: {
|
|
87
|
+
from: {
|
|
88
|
+
opacity: 0,
|
|
89
|
+
transform: transformValuesByPlacement[placement][0]
|
|
90
|
+
},
|
|
91
|
+
to: {
|
|
92
|
+
opacity: 1,
|
|
93
|
+
transform: transformValuesByPlacement[placement][1]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
};
|
|
73
98
|
const DIALOG_WIDTHS = {
|
|
74
99
|
[_constants.SIZE.xSmall]: '480px',
|
|
75
100
|
[_constants.SIZE.small]: '640px',
|
|
76
101
|
[_constants.SIZE.medium]: '800px',
|
|
77
102
|
[_constants.SIZE.large]: '100%'
|
|
78
103
|
};
|
|
79
|
-
const StyledRoot = exports.StyledRoot = (0, _styles.styled)('
|
|
104
|
+
const StyledRoot = exports.StyledRoot = (0, _styles.styled)('div', ({
|
|
80
105
|
$theme,
|
|
81
106
|
$size,
|
|
82
|
-
$placement = _constants.PLACEMENT.center
|
|
83
|
-
$isOpen
|
|
107
|
+
$placement = _constants.PLACEMENT.center
|
|
84
108
|
}) => {
|
|
85
109
|
const narrowViewportGutter = '16px';
|
|
86
110
|
const wideViewportGutter = '40px';
|
|
87
111
|
return {
|
|
112
|
+
display: 'flex',
|
|
113
|
+
flexDirection: 'column',
|
|
114
|
+
alignItems: 'center',
|
|
88
115
|
position: 'fixed',
|
|
89
116
|
maxHeight: `calc(100vh - (2 * ${wideViewportGutter}))`,
|
|
90
117
|
maxWidth: `calc(100% - (2 * ${wideViewportGutter}))`,
|
|
@@ -96,33 +123,38 @@ const StyledRoot = exports.StyledRoot = (0, _styles.styled)('dialog', ({
|
|
|
96
123
|
border: 'none',
|
|
97
124
|
width: DIALOG_WIDTHS[$size],
|
|
98
125
|
...getPlacementStyles($placement, wideViewportGutter),
|
|
126
|
+
...getAnimationStyles($placement),
|
|
99
127
|
'@media (max-width: 599px)': {
|
|
100
128
|
width: `calc(100% - (2 * ${narrowViewportGutter}))`,
|
|
101
129
|
maxWidth: 'none',
|
|
102
|
-
...getPlacementStyles(_constants.PLACEMENT.bottomCenter, narrowViewportGutter)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
backgroundColor: $theme.colors.backgroundOverlay
|
|
106
|
-
},
|
|
107
|
-
// Dialog style resets
|
|
108
|
-
marginTop: '0px',
|
|
109
|
-
marginRight: '0px',
|
|
110
|
-
marginBottom: '0px',
|
|
111
|
-
marginLeft: '0px',
|
|
112
|
-
paddingTop: '0px',
|
|
113
|
-
paddingRight: '0px',
|
|
114
|
-
paddingBottom: '0px',
|
|
115
|
-
paddingLeft: '0px',
|
|
116
|
-
// modifying the default `display` value for a closed dialog element causes unexpected behavior
|
|
117
|
-
...($isOpen ? {
|
|
118
|
-
display: 'flex',
|
|
119
|
-
flexDirection: 'column',
|
|
120
|
-
alignItems: 'center'
|
|
121
|
-
} : {})
|
|
130
|
+
...getPlacementStyles(_constants.PLACEMENT.bottomCenter, narrowViewportGutter),
|
|
131
|
+
...getAnimationStyles(_constants.PLACEMENT.bottomCenter)
|
|
132
|
+
}
|
|
122
133
|
};
|
|
123
134
|
});
|
|
124
135
|
StyledRoot.displayName = "StyledRoot";
|
|
125
136
|
StyledRoot.displayName = 'StyledRoot';
|
|
137
|
+
const StyledOverlay = exports.StyledOverlay = (0, _styles.styled)('div', ({
|
|
138
|
+
$theme
|
|
139
|
+
}) => ({
|
|
140
|
+
position: 'fixed',
|
|
141
|
+
top: 0,
|
|
142
|
+
left: 0,
|
|
143
|
+
width: '100%',
|
|
144
|
+
height: '100%',
|
|
145
|
+
backgroundColor: $theme.colors.backgroundOverlay,
|
|
146
|
+
animationDuration: '100ms',
|
|
147
|
+
animationName: {
|
|
148
|
+
from: {
|
|
149
|
+
opacity: 0
|
|
150
|
+
},
|
|
151
|
+
to: {
|
|
152
|
+
opacity: 1
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}));
|
|
156
|
+
StyledOverlay.displayName = "StyledOverlay";
|
|
157
|
+
StyledOverlay.displayName = 'StyledOverlay';
|
|
126
158
|
const StyledScrollContainer = exports.StyledScrollContainer = (0, _styles.styled)('div', () => {
|
|
127
159
|
return {
|
|
128
160
|
flex: 1,
|
package/dialog/types.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { ButtonDockProps } from '../button-dock';
|
|
|
5
5
|
import type { SIZE, PLACEMENT } from './constants';
|
|
6
6
|
export type DialogOverrides = {
|
|
7
7
|
Root?: Override;
|
|
8
|
+
Overlay?: Override;
|
|
8
9
|
ScrollContainer?: Override;
|
|
9
10
|
Heading?: Override;
|
|
10
11
|
Body?: Override;
|
|
@@ -21,8 +22,8 @@ export type DialogProps = {
|
|
|
21
22
|
/** The contents of the body of Dialog */
|
|
22
23
|
children?: React.ReactNode | (() => React.ReactNode);
|
|
23
24
|
/** Determine if and how dialog can be dismissed */
|
|
24
|
-
|
|
25
|
-
/** Should Dialog include a dedicated X button to dismiss the dialog. Ignored if
|
|
25
|
+
onDismiss?: () => void | null;
|
|
26
|
+
/** Should Dialog include a dedicated X button to dismiss the dialog. Ignored if onDismiss is not supplied. */
|
|
26
27
|
showDismissButton?: boolean;
|
|
27
28
|
/** Determines whether the background behind the Dialog is dimmed when Dialog is open */
|
|
28
29
|
hasOverlay?: boolean;
|
|
@@ -34,4 +35,6 @@ export type DialogProps = {
|
|
|
34
35
|
/** Determines where on the screen the dialog appears when open */
|
|
35
36
|
placement?: Placement;
|
|
36
37
|
size?: Size;
|
|
38
|
+
/** If true, focus will shift to the first interactive element within the modal */
|
|
39
|
+
autoFocus?: boolean;
|
|
37
40
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Theme } from '../styles';
|
|
2
|
+
export declare const FILE_STATUS: {
|
|
3
|
+
readonly added: "added";
|
|
4
|
+
readonly error: "error";
|
|
5
|
+
readonly processed: "processed";
|
|
6
|
+
};
|
|
7
|
+
export declare const FILE_STATUS_TO_COLOR_MAP: ($theme: Theme) => {
|
|
8
|
+
added: string;
|
|
9
|
+
error: string;
|
|
10
|
+
processed: string;
|
|
11
|
+
};
|
|
12
|
+
export declare enum ARIA_LIVE_ELEMENT_ID {
|
|
13
|
+
ADDITION = "file-uploader-addition",
|
|
14
|
+
REMOVAL = "file-uploader-removal"
|
|
15
|
+
}
|
|
16
|
+
export declare const ARIA_LIVE_TIMEOUT_MS = 5000;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FILE_STATUS_TO_COLOR_MAP = exports.FILE_STATUS = exports.ARIA_LIVE_TIMEOUT_MS = exports.ARIA_LIVE_ELEMENT_ID = void 0;
|
|
7
|
+
/*
|
|
8
|
+
Copyright (c) Uber Technologies, Inc.
|
|
9
|
+
|
|
10
|
+
This source code is licensed under the MIT license found in the
|
|
11
|
+
LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const FILE_STATUS = exports.FILE_STATUS = {
|
|
15
|
+
added: 'added',
|
|
16
|
+
error: 'error',
|
|
17
|
+
processed: 'processed'
|
|
18
|
+
};
|
|
19
|
+
const FILE_STATUS_TO_COLOR_MAP = $theme => ({
|
|
20
|
+
[FILE_STATUS.added]: $theme.colors.accent,
|
|
21
|
+
[FILE_STATUS.error]: $theme.colors.negative,
|
|
22
|
+
[FILE_STATUS.processed]: $theme.colors.positive
|
|
23
|
+
});
|
|
24
|
+
exports.FILE_STATUS_TO_COLOR_MAP = FILE_STATUS_TO_COLOR_MAP;
|
|
25
|
+
let ARIA_LIVE_ELEMENT_ID = exports.ARIA_LIVE_ELEMENT_ID = /*#__PURE__*/function (ARIA_LIVE_ELEMENT_ID) {
|
|
26
|
+
ARIA_LIVE_ELEMENT_ID["ADDITION"] = "file-uploader-addition";
|
|
27
|
+
ARIA_LIVE_ELEMENT_ID["REMOVAL"] = "file-uploader-removal";
|
|
28
|
+
return ARIA_LIVE_ELEMENT_ID;
|
|
29
|
+
}({});
|
|
30
|
+
const ARIA_LIVE_TIMEOUT_MS = exports.ARIA_LIVE_TIMEOUT_MS = 5000;
|
|
@@ -3,8 +3,8 @@ import type { FileUploaderProps } from './types';
|
|
|
3
3
|
declare function FileUploader(props: FileUploaderProps): React.JSX.Element;
|
|
4
4
|
declare namespace FileUploader {
|
|
5
5
|
var defaultProps: {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
fileRows: any[];
|
|
7
|
+
setFileRows: () => void;
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
export default FileUploader;
|