@easypost/easy-ui 1.0.0-alpha.75 → 1.0.0-alpha.76
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/CHANGELOG.md +12 -0
- package/Drawer/index.js +3 -1685
- package/Drawer/index.mjs +1 -1683
- package/Notification/Notification.d.ts +12 -1
- package/Notification/Notification.d.ts.map +1 -1
- package/Notification/NotificationContainer.d.ts.map +1 -1
- package/Notification/NotificationRegion.d.ts +7 -2
- package/Notification/NotificationRegion.d.ts.map +1 -1
- package/Notification/NotificationTransition.d.ts +29 -0
- package/Notification/NotificationTransition.d.ts.map +1 -0
- package/Notification/index.js +1 -1
- package/Notification/index.mjs +1 -1
- package/Provider/index.js +1 -1
- package/Provider/index.mjs +1 -1
- package/__chunks__/CSSTransition-BXyX0mUc.js +1689 -0
- package/__chunks__/CSSTransition-C4FQrt4m.mjs +1690 -0
- package/__chunks__/{Notification-BCS0ugaf.js → Notification-B_dzUkJq.js} +347 -33
- package/__chunks__/{Notification-lg6ggtug.mjs → Notification-C-_hCM1v.mjs} +348 -34
- package/package.json +2 -2
- package/style.css +181 -150
|
@@ -17,21 +17,36 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
20
32
|
import * as React from "react";
|
|
21
|
-
import React__default, { useCallback, useState, useEffect, useRef, useMemo, createContext, useContext } from "react";
|
|
33
|
+
import React__default, { useCallback, useState, useEffect, useRef, isValidElement, cloneElement, Children, useMemo, createContext, useContext } from "react";
|
|
34
|
+
import { $ as $5dc95899b306f630$export$c9058316764c140e } from "./mergeRefs-CCV6itCY.mjs";
|
|
22
35
|
import { C as Close } from "./Close-Cq6Q6MN6.mjs";
|
|
23
36
|
import { C as CheckCircle } from "./CheckCircle-C9h2PNWU.mjs";
|
|
24
37
|
import { d as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, c as $bdb11010cef70236$export$f680877a34711e37, b as $bdb11010cef70236$export$b4cc09c592e8fdb8, a as $8ae05eaa5c114e9c$export$7f54fc3180508a52, $ as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "./mergeProps-DRsiQq2k.mjs";
|
|
25
38
|
import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "./useLocalizedStringFormatter-SC1Py3Uf.mjs";
|
|
26
39
|
import { createPortal } from "react-dom";
|
|
40
|
+
import { q as $507fabe10e71c6fb$export$630ff653c5ada6a9, s as $7215afc6de606d6b$export$de79e2c695e052f3 } from "./useFocusVisible-CQ1e0o7u.mjs";
|
|
41
|
+
import { $ as $9ab94262bd0047c7$export$420e68273165f4ec } from "./useFocusWithin-BgSjulWP.mjs";
|
|
42
|
+
import { $ as $6179b936705e76d3$export$ae780daf29e6d456 } from "./useHover-BBXJy5NT.mjs";
|
|
27
43
|
import { s as shimExports } from "./index-DOQwYO8h.mjs";
|
|
28
44
|
import { I as Icon } from "./Icon-0SN9dbwU.mjs";
|
|
29
45
|
import { T as Text } from "./Text-BYGcKHR7.mjs";
|
|
30
46
|
import { classNames, variationName } from "../utilities/css.mjs";
|
|
31
47
|
import { U as UnstyledButton } from "./UnstyledButton-D0_XmlIu.mjs";
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import { $ as $6179b936705e76d3$export$ae780daf29e6d456 } from "./useHover-BBXJy5NT.mjs";
|
|
48
|
+
import { _ as _inheritsLoose, T as TransitionGroupContext, P as PropTypes, C as CSSTransition } from "./CSSTransition-C4FQrt4m.mjs";
|
|
49
|
+
import { a as _extends, _ as _objectWithoutPropertiesLoose } from "./objectWithoutPropertiesLoose-COdxq1Ge.mjs";
|
|
35
50
|
function $77b352cf12efcf73$export$84726ef35ca2129a(queue) {
|
|
36
51
|
let subscribe = useCallback((fn) => queue.subscribe(fn), [
|
|
37
52
|
queue
|
|
@@ -1089,7 +1104,7 @@ var __spreadValues2 = (a, b) => {
|
|
|
1089
1104
|
}
|
|
1090
1105
|
return a;
|
|
1091
1106
|
};
|
|
1092
|
-
var
|
|
1107
|
+
var __objRest2 = (source, exclude) => {
|
|
1093
1108
|
var target = {};
|
|
1094
1109
|
for (var prop in source) if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop];
|
|
1095
1110
|
if (source != null && __getOwnPropSymbols2) for (var prop of __getOwnPropSymbols2(source)) {
|
|
@@ -1098,7 +1113,7 @@ var __objRest = (source, exclude) => {
|
|
|
1098
1113
|
return target;
|
|
1099
1114
|
};
|
|
1100
1115
|
const CurrencyExchange = (_a) => {
|
|
1101
|
-
var _b = _a, { title, titleId } = _b, props =
|
|
1116
|
+
var _b = _a, { title, titleId } = _b, props = __objRest2(_b, ["title", "titleId"]);
|
|
1102
1117
|
return React.createElement("svg", __spreadValues2({
|
|
1103
1118
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1104
1119
|
viewBox: "0 -960 960 960",
|
|
@@ -1109,19 +1124,249 @@ const CurrencyExchange = (_a) => {
|
|
|
1109
1124
|
d: "M480-60q-117 0-219.65-68.89-102.66-68.88-156.89-166.19v141.23H58.08v-220h220v45.39H136.85q45.61 91.23 142.03 157.15 96.43 65.92 201.12 65.92 75.69 0 142.88-28.26 67.2-28.27 117.73-77.47 50.54-49.19 80.93-115.99 30.38-66.81 32.69-142.89h45.38q-1.92 85.23-35.65 159.85-33.73 74.61-90.46 130.38Q716.77-124 641.19-92 565.61-60 480-60Zm-23.23-142.62v-52.07q-42.31-10.85-72.23-34.85T334-356.46l39.85-14.31q14.3 37.23 44.61 58.46 30.31 21.23 68.16 21.23 39.61 0 68.8-19.88 29.2-19.89 29.2-56.89 0-34.15-23.66-55.88-23.65-21.73-90.27-48.96-62.69-25-91.73-52.46-29.04-27.47-29.04-74.16 0-40.92 28.85-71.15 28.85-30.23 80-37.23v-49.08h43.84v49.08q34.93 3.23 62.16 21.69Q592-667.54 609-635.62L571.38-618Q556-643.69 534-657.31q-22-13.61-52-13.61-40.15 0-64.38 19.92-24.24 19.92-24.24 51.69 0 32.77 22.93 51.39 22.92 18.61 84.77 43 69.77 28.23 98.19 58.3 28.42 30.08 28.42 78.77 0 26.16-9.96 46.77-9.96 20.62-26.85 35.04-16.88 14.42-40.11 22.96-23.23 8.54-50.16 10.39v50.07h-43.84ZM60.39-490q2.69-87.15 36.8-161.96 34.12-74.81 91.23-130.19 57.12-55.39 132.12-86.62Q395.54-900 480-900q115.85 0 219.65 69.08 103.81 69.08 156.89 167.54v-142.77h45.38v220h-220v-45.39h141.23q-44.46-89.3-140.57-156.19-96.12-66.88-202.58-66.88-74.15 0-141.35 27.88-67.19 27.88-117.92 76.69-50.73 48.81-81.69 115.62-30.96 66.8-33.27 144.42H60.39Z"
|
|
1110
1125
|
}));
|
|
1111
1126
|
};
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1127
|
+
function _assertThisInitialized(e) {
|
|
1128
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1129
|
+
return e;
|
|
1130
|
+
}
|
|
1131
|
+
function getChildMapping(children, mapFn) {
|
|
1132
|
+
var mapper = function mapper2(child) {
|
|
1133
|
+
return mapFn && isValidElement(child) ? mapFn(child) : child;
|
|
1134
|
+
};
|
|
1135
|
+
var result = /* @__PURE__ */ Object.create(null);
|
|
1136
|
+
if (children) Children.map(children, function(c) {
|
|
1137
|
+
return c;
|
|
1138
|
+
}).forEach(function(child) {
|
|
1139
|
+
result[child.key] = mapper(child);
|
|
1140
|
+
});
|
|
1141
|
+
return result;
|
|
1142
|
+
}
|
|
1143
|
+
function mergeChildMappings(prev, next) {
|
|
1144
|
+
prev = prev || {};
|
|
1145
|
+
next = next || {};
|
|
1146
|
+
function getValueForKey(key) {
|
|
1147
|
+
return key in next ? next[key] : prev[key];
|
|
1148
|
+
}
|
|
1149
|
+
var nextKeysPending = /* @__PURE__ */ Object.create(null);
|
|
1150
|
+
var pendingKeys = [];
|
|
1151
|
+
for (var prevKey in prev) {
|
|
1152
|
+
if (prevKey in next) {
|
|
1153
|
+
if (pendingKeys.length) {
|
|
1154
|
+
nextKeysPending[prevKey] = pendingKeys;
|
|
1155
|
+
pendingKeys = [];
|
|
1156
|
+
}
|
|
1157
|
+
} else {
|
|
1158
|
+
pendingKeys.push(prevKey);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
var i;
|
|
1162
|
+
var childMapping = {};
|
|
1163
|
+
for (var nextKey in next) {
|
|
1164
|
+
if (nextKeysPending[nextKey]) {
|
|
1165
|
+
for (i = 0; i < nextKeysPending[nextKey].length; i++) {
|
|
1166
|
+
var pendingNextKey = nextKeysPending[nextKey][i];
|
|
1167
|
+
childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
childMapping[nextKey] = getValueForKey(nextKey);
|
|
1171
|
+
}
|
|
1172
|
+
for (i = 0; i < pendingKeys.length; i++) {
|
|
1173
|
+
childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
|
|
1174
|
+
}
|
|
1175
|
+
return childMapping;
|
|
1176
|
+
}
|
|
1177
|
+
function getProp(child, prop, props) {
|
|
1178
|
+
return props[prop] != null ? props[prop] : child.props[prop];
|
|
1179
|
+
}
|
|
1180
|
+
function getInitialChildMapping(props, onExited) {
|
|
1181
|
+
return getChildMapping(props.children, function(child) {
|
|
1182
|
+
return cloneElement(child, {
|
|
1183
|
+
onExited: onExited.bind(null, child),
|
|
1184
|
+
in: true,
|
|
1185
|
+
appear: getProp(child, "appear", props),
|
|
1186
|
+
enter: getProp(child, "enter", props),
|
|
1187
|
+
exit: getProp(child, "exit", props)
|
|
1188
|
+
});
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
function getNextChildMapping(nextProps, prevChildMapping, onExited) {
|
|
1192
|
+
var nextChildMapping = getChildMapping(nextProps.children);
|
|
1193
|
+
var children = mergeChildMappings(prevChildMapping, nextChildMapping);
|
|
1194
|
+
Object.keys(children).forEach(function(key) {
|
|
1195
|
+
var child = children[key];
|
|
1196
|
+
if (!isValidElement(child)) return;
|
|
1197
|
+
var hasPrev = key in prevChildMapping;
|
|
1198
|
+
var hasNext = key in nextChildMapping;
|
|
1199
|
+
var prevChild = prevChildMapping[key];
|
|
1200
|
+
var isLeaving = isValidElement(prevChild) && !prevChild.props.in;
|
|
1201
|
+
if (hasNext && (!hasPrev || isLeaving)) {
|
|
1202
|
+
children[key] = cloneElement(child, {
|
|
1203
|
+
onExited: onExited.bind(null, child),
|
|
1204
|
+
in: true,
|
|
1205
|
+
exit: getProp(child, "exit", nextProps),
|
|
1206
|
+
enter: getProp(child, "enter", nextProps)
|
|
1207
|
+
});
|
|
1208
|
+
} else if (!hasNext && hasPrev && !isLeaving) {
|
|
1209
|
+
children[key] = cloneElement(child, {
|
|
1210
|
+
in: false
|
|
1211
|
+
});
|
|
1212
|
+
} else if (hasNext && hasPrev && isValidElement(prevChild)) {
|
|
1213
|
+
children[key] = cloneElement(child, {
|
|
1214
|
+
onExited: onExited.bind(null, child),
|
|
1215
|
+
in: prevChild.props.in,
|
|
1216
|
+
exit: getProp(child, "exit", nextProps),
|
|
1217
|
+
enter: getProp(child, "enter", nextProps)
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
});
|
|
1221
|
+
return children;
|
|
1222
|
+
}
|
|
1223
|
+
var values = Object.values || function(obj) {
|
|
1224
|
+
return Object.keys(obj).map(function(k) {
|
|
1225
|
+
return obj[k];
|
|
1226
|
+
});
|
|
1227
|
+
};
|
|
1228
|
+
var defaultProps = {
|
|
1229
|
+
component: "div",
|
|
1230
|
+
childFactory: function childFactory(child) {
|
|
1231
|
+
return child;
|
|
1232
|
+
}
|
|
1233
|
+
};
|
|
1234
|
+
var TransitionGroup = /* @__PURE__ */ function(_React$Component) {
|
|
1235
|
+
_inheritsLoose(TransitionGroup2, _React$Component);
|
|
1236
|
+
function TransitionGroup2(props, context) {
|
|
1237
|
+
var _this;
|
|
1238
|
+
_this = _React$Component.call(this, props, context) || this;
|
|
1239
|
+
var handleExited = _this.handleExited.bind(_assertThisInitialized(_this));
|
|
1240
|
+
_this.state = {
|
|
1241
|
+
contextValue: {
|
|
1242
|
+
isMounting: true
|
|
1243
|
+
},
|
|
1244
|
+
handleExited,
|
|
1245
|
+
firstRender: true
|
|
1246
|
+
};
|
|
1247
|
+
return _this;
|
|
1248
|
+
}
|
|
1249
|
+
var _proto = TransitionGroup2.prototype;
|
|
1250
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
1251
|
+
this.mounted = true;
|
|
1252
|
+
this.setState({
|
|
1253
|
+
contextValue: {
|
|
1254
|
+
isMounting: false
|
|
1255
|
+
}
|
|
1256
|
+
});
|
|
1257
|
+
};
|
|
1258
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
1259
|
+
this.mounted = false;
|
|
1260
|
+
};
|
|
1261
|
+
TransitionGroup2.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
|
|
1262
|
+
var prevChildMapping = _ref.children, handleExited = _ref.handleExited, firstRender = _ref.firstRender;
|
|
1263
|
+
return {
|
|
1264
|
+
children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),
|
|
1265
|
+
firstRender: false
|
|
1266
|
+
};
|
|
1267
|
+
};
|
|
1268
|
+
_proto.handleExited = function handleExited(child, node) {
|
|
1269
|
+
var currentChildMapping = getChildMapping(this.props.children);
|
|
1270
|
+
if (child.key in currentChildMapping) return;
|
|
1271
|
+
if (child.props.onExited) {
|
|
1272
|
+
child.props.onExited(node);
|
|
1273
|
+
}
|
|
1274
|
+
if (this.mounted) {
|
|
1275
|
+
this.setState(function(state) {
|
|
1276
|
+
var children = _extends({}, state.children);
|
|
1277
|
+
delete children[child.key];
|
|
1278
|
+
return {
|
|
1279
|
+
children
|
|
1280
|
+
};
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
};
|
|
1284
|
+
_proto.render = function render() {
|
|
1285
|
+
var _this$props = this.props, Component = _this$props.component, childFactory2 = _this$props.childFactory, props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
|
|
1286
|
+
var contextValue = this.state.contextValue;
|
|
1287
|
+
var children = values(this.state.children).map(childFactory2);
|
|
1288
|
+
delete props.appear;
|
|
1289
|
+
delete props.enter;
|
|
1290
|
+
delete props.exit;
|
|
1291
|
+
if (Component === null) {
|
|
1292
|
+
return /* @__PURE__ */ React__default.createElement(TransitionGroupContext.Provider, {
|
|
1293
|
+
value: contextValue
|
|
1294
|
+
}, children);
|
|
1295
|
+
}
|
|
1296
|
+
return /* @__PURE__ */ React__default.createElement(TransitionGroupContext.Provider, {
|
|
1297
|
+
value: contextValue
|
|
1298
|
+
}, /* @__PURE__ */ React__default.createElement(Component, props, children));
|
|
1299
|
+
};
|
|
1300
|
+
return TransitionGroup2;
|
|
1301
|
+
}(React__default.Component);
|
|
1302
|
+
TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
1303
|
+
/**
|
|
1304
|
+
* `<TransitionGroup>` renders a `<div>` by default. You can change this
|
|
1305
|
+
* behavior by providing a `component` prop.
|
|
1306
|
+
* If you use React v16+ and would like to avoid a wrapping `<div>` element
|
|
1307
|
+
* you can pass in `component={null}`. This is useful if the wrapping div
|
|
1308
|
+
* borks your css styles.
|
|
1309
|
+
*/
|
|
1310
|
+
component: PropTypes.any,
|
|
1311
|
+
/**
|
|
1312
|
+
* A set of `<Transition>` components, that are toggled `in` and out as they
|
|
1313
|
+
* leave. the `<TransitionGroup>` will inject specific transition props, so
|
|
1314
|
+
* remember to spread them through if you are wrapping the `<Transition>` as
|
|
1315
|
+
* with our `<Fade>` example.
|
|
1316
|
+
*
|
|
1317
|
+
* While this component is meant for multiple `Transition` or `CSSTransition`
|
|
1318
|
+
* children, sometimes you may want to have a single transition child with
|
|
1319
|
+
* content that you want to be transitioned out and in when you change it
|
|
1320
|
+
* (e.g. routes, images etc.) In that case you can change the `key` prop of
|
|
1321
|
+
* the transition child as you change its content, this will cause
|
|
1322
|
+
* `TransitionGroup` to transition the child out and back in.
|
|
1323
|
+
*/
|
|
1324
|
+
children: PropTypes.node,
|
|
1325
|
+
/**
|
|
1326
|
+
* A convenience prop that enables or disables appear animations
|
|
1327
|
+
* for all children. Note that specifying this will override any defaults set
|
|
1328
|
+
* on individual children Transitions.
|
|
1329
|
+
*/
|
|
1330
|
+
appear: PropTypes.bool,
|
|
1331
|
+
/**
|
|
1332
|
+
* A convenience prop that enables or disables enter animations
|
|
1333
|
+
* for all children. Note that specifying this will override any defaults set
|
|
1334
|
+
* on individual children Transitions.
|
|
1335
|
+
*/
|
|
1336
|
+
enter: PropTypes.bool,
|
|
1337
|
+
/**
|
|
1338
|
+
* A convenience prop that enables or disables exit animations
|
|
1339
|
+
* for all children. Note that specifying this will override any defaults set
|
|
1340
|
+
* on individual children Transitions.
|
|
1341
|
+
*/
|
|
1342
|
+
exit: PropTypes.bool,
|
|
1343
|
+
/**
|
|
1344
|
+
* You may need to apply reactive updates to a child as it is exiting.
|
|
1345
|
+
* This is generally done by using `cloneElement` however in the case of an exiting
|
|
1346
|
+
* child the element has already been removed and not accessible to the consumer.
|
|
1347
|
+
*
|
|
1348
|
+
* If you do need to update a child as it leaves you can provide a `childFactory`
|
|
1349
|
+
* to wrap every child, even the ones that are leaving.
|
|
1350
|
+
*
|
|
1351
|
+
* @type Function(child: ReactElement) -> ReactElement
|
|
1352
|
+
*/
|
|
1353
|
+
childFactory: PropTypes.func
|
|
1354
|
+
} : {};
|
|
1355
|
+
TransitionGroup.defaultProps = defaultProps;
|
|
1356
|
+
const statusPromotional = "_statusPromotional_1xl7t_4";
|
|
1357
|
+
const statusSuccess = "_statusSuccess_1xl7t_9";
|
|
1358
|
+
const statusNeutral = "_statusNeutral_1xl7t_14";
|
|
1359
|
+
const statusWarning = "_statusWarning_1xl7t_19";
|
|
1360
|
+
const statusError = "_statusError_1xl7t_24";
|
|
1361
|
+
const typeToast = "_typeToast_1xl7t_29";
|
|
1362
|
+
const typeAlert = "_typeAlert_1xl7t_33";
|
|
1363
|
+
const Notification$1 = "_Notification_1xl7t_38";
|
|
1364
|
+
const iconText = "_iconText_1xl7t_55";
|
|
1365
|
+
const closeButtonContainer = "_closeButtonContainer_1xl7t_61";
|
|
1366
|
+
const closeButton = "_closeButton_1xl7t_61";
|
|
1367
|
+
const region = "_region_1xl7t_74";
|
|
1368
|
+
const container = "_container_1xl7t_81";
|
|
1369
|
+
const styles$1 = {
|
|
1125
1370
|
statusPromotional,
|
|
1126
1371
|
statusSuccess,
|
|
1127
1372
|
statusNeutral,
|
|
@@ -1131,26 +1376,91 @@ const styles = {
|
|
|
1131
1376
|
typeAlert,
|
|
1132
1377
|
Notification: Notification$1,
|
|
1133
1378
|
iconText,
|
|
1379
|
+
closeButtonContainer,
|
|
1134
1380
|
closeButton,
|
|
1135
1381
|
region,
|
|
1136
1382
|
container
|
|
1137
1383
|
};
|
|
1384
|
+
const appear = "_appear_9o3cj_1";
|
|
1385
|
+
const enter = "_enter_9o3cj_2";
|
|
1386
|
+
const appearActive = "_appearActive_9o3cj_7";
|
|
1387
|
+
const enterActive = "_enterActive_9o3cj_8";
|
|
1388
|
+
const exit = "_exit_9o3cj_14";
|
|
1389
|
+
const exitActive = "_exitActive_9o3cj_22";
|
|
1390
|
+
const styles = {
|
|
1391
|
+
appear,
|
|
1392
|
+
enter,
|
|
1393
|
+
appearActive,
|
|
1394
|
+
enterActive,
|
|
1395
|
+
exit,
|
|
1396
|
+
exitActive
|
|
1397
|
+
};
|
|
1398
|
+
function NotificationTransition(_a) {
|
|
1399
|
+
var _b = _a, { children, transitionKey, onTransitionPendingChange = () => {
|
|
1400
|
+
} } = _b, transitionGroupProps = __objRest(_b, ["children", "transitionKey", "onTransitionPendingChange"]);
|
|
1401
|
+
const nodeRef = React__default.useRef(null);
|
|
1402
|
+
const transitionEndListener = useCallback((done) => {
|
|
1403
|
+
if (nodeRef.current) {
|
|
1404
|
+
nodeRef.current.addEventListener("transitionend", done, false);
|
|
1405
|
+
}
|
|
1406
|
+
}, []);
|
|
1407
|
+
return React__default.createElement(CSSTransition, __spreadProps(__spreadValues({}, transitionGroupProps), {
|
|
1408
|
+
key: transitionKey,
|
|
1409
|
+
appear: true,
|
|
1410
|
+
nodeRef,
|
|
1411
|
+
unmountOnExit: true,
|
|
1412
|
+
addEndListener: transitionEndListener,
|
|
1413
|
+
classNames: {
|
|
1414
|
+
appear: styles.appear,
|
|
1415
|
+
appearActive: styles.appearActive,
|
|
1416
|
+
enter: styles.enter,
|
|
1417
|
+
enterActive: styles.enterActive,
|
|
1418
|
+
exit: styles.exit,
|
|
1419
|
+
exitActive: styles.exitActive
|
|
1420
|
+
},
|
|
1421
|
+
onEnter: () => {
|
|
1422
|
+
onTransitionPendingChange(true);
|
|
1423
|
+
},
|
|
1424
|
+
onExited: () => {
|
|
1425
|
+
onTransitionPendingChange(false);
|
|
1426
|
+
}
|
|
1427
|
+
}), children({
|
|
1428
|
+
nodeRef
|
|
1429
|
+
}));
|
|
1430
|
+
}
|
|
1431
|
+
function useNotificationTransitionTracking() {
|
|
1432
|
+
const [transitionsPending, setTransitionsPending] = useState(0);
|
|
1433
|
+
const onTransitionPendingChange = (isTransitionPending) => {
|
|
1434
|
+
setTransitionsPending((prev) => isTransitionPending ? prev + 1 : prev - 1);
|
|
1435
|
+
};
|
|
1436
|
+
return {
|
|
1437
|
+
isTransitionPending: transitionsPending > 0,
|
|
1438
|
+
onTransitionPendingChange
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1138
1441
|
function NotificationRegion(props) {
|
|
1139
|
-
const { state } = props;
|
|
1442
|
+
const { state, onTransitionPendingChange } = props;
|
|
1140
1443
|
const ref = React__default.useRef(null);
|
|
1141
1444
|
const { regionProps } = $6cc546b19ee7130a$export$b8cbbb20a51697de(props, state, ref);
|
|
1142
1445
|
return React__default.createElement("div", __spreadProps(__spreadValues({}, regionProps), {
|
|
1143
1446
|
ref,
|
|
1144
|
-
className: styles.region
|
|
1145
|
-
}),
|
|
1447
|
+
className: styles$1.region
|
|
1448
|
+
}), React__default.createElement(TransitionGroup, {
|
|
1449
|
+
component: null
|
|
1450
|
+
}, state.visibleToasts.map((toast) => React__default.createElement(NotificationTransition, {
|
|
1146
1451
|
key: toast.key,
|
|
1452
|
+
transitionKey: toast.key,
|
|
1453
|
+
onTransitionPendingChange
|
|
1454
|
+
}, ({ nodeRef }) => React__default.createElement(Notification, {
|
|
1455
|
+
ref: nodeRef,
|
|
1147
1456
|
toast,
|
|
1148
1457
|
state
|
|
1149
|
-
})));
|
|
1458
|
+
})))));
|
|
1150
1459
|
}
|
|
1151
1460
|
function NotificationContainer(props) {
|
|
1152
1461
|
const { getContainer = null, position = "fixed", offset, state } = props;
|
|
1153
|
-
const
|
|
1462
|
+
const { isTransitionPending, onTransitionPendingChange } = useNotificationTransitionTracking();
|
|
1463
|
+
const showNotifications = state.visibleToasts.length > 0 || isTransitionPending;
|
|
1154
1464
|
let requestFailed = false;
|
|
1155
1465
|
let container2 = null;
|
|
1156
1466
|
if (showNotifications && getContainer) {
|
|
@@ -1171,10 +1481,11 @@ function NotificationContainer(props) {
|
|
|
1171
1481
|
};
|
|
1172
1482
|
const containerStyles = __spreadValues(__spreadValues({}, positionStyleProps), positionProps);
|
|
1173
1483
|
return React__default.createElement(React__default.Fragment, null, showNotifications ? createPortal(React__default.createElement("div", {
|
|
1174
|
-
className: styles.container,
|
|
1484
|
+
className: styles$1.container,
|
|
1175
1485
|
style: containerStyles
|
|
1176
1486
|
}, React__default.createElement(NotificationRegion, {
|
|
1177
|
-
state
|
|
1487
|
+
state,
|
|
1488
|
+
onTransitionPendingChange
|
|
1178
1489
|
})), container2 != null ? container2 : document.body) : null);
|
|
1179
1490
|
}
|
|
1180
1491
|
const TOAST_TIMEOUT_DURATION = 4e3;
|
|
@@ -1246,7 +1557,7 @@ function useNotificationState() {
|
|
|
1246
1557
|
closeActiveNotification: () => queue.closeActiveNotification()
|
|
1247
1558
|
});
|
|
1248
1559
|
}
|
|
1249
|
-
|
|
1560
|
+
const Notification = React__default.forwardRef((props, forwardedRef) => {
|
|
1250
1561
|
const ref = useRef(null);
|
|
1251
1562
|
const { state, toast: notification } = props;
|
|
1252
1563
|
const { type = "toast", message, status = "success", hasIcon = true, onDismiss } = notification.content;
|
|
@@ -1264,22 +1575,25 @@ function Notification(props) {
|
|
|
1264
1575
|
onPress: handleDismiss
|
|
1265
1576
|
});
|
|
1266
1577
|
return React__default.createElement("div", __spreadProps(__spreadValues({}, notificationPropsWithAdjustedAriaRole), {
|
|
1267
|
-
ref,
|
|
1268
|
-
className: classNames(styles.Notification, styles[variationName("status", status)], styles[variationName("type", type)])
|
|
1578
|
+
ref: $5dc95899b306f630$export$c9058316764c140e(ref, forwardedRef),
|
|
1579
|
+
className: classNames(styles$1.Notification, styles$1[variationName("status", status)], styles$1[variationName("type", type)])
|
|
1269
1580
|
}), React__default.createElement("div", {
|
|
1270
|
-
className: styles.iconText
|
|
1581
|
+
className: styles$1.iconText
|
|
1271
1582
|
}, hasIcon && React__default.createElement(Icon, {
|
|
1272
1583
|
size: "lg",
|
|
1273
1584
|
symbol: getStatusIcon(status)
|
|
1274
1585
|
}), React__default.createElement("div", __spreadValues({}, titleProps), React__default.createElement(Text, {
|
|
1275
1586
|
weight: "semibold"
|
|
1276
|
-
}, message))), type === "alert" && React__default.createElement(
|
|
1277
|
-
className:
|
|
1587
|
+
}, message))), type === "alert" && React__default.createElement("span", {
|
|
1588
|
+
className: styles$1.closeButtonContainer
|
|
1589
|
+
}, React__default.createElement(UnstyledButton, __spreadProps(__spreadValues({}, closeButtonPropsWithDismiss), {
|
|
1590
|
+
className: styles$1.closeButton
|
|
1278
1591
|
}), React__default.createElement(Icon, {
|
|
1279
1592
|
size: "md",
|
|
1280
1593
|
symbol: Close
|
|
1281
|
-
})));
|
|
1282
|
-
}
|
|
1594
|
+
}))));
|
|
1595
|
+
});
|
|
1596
|
+
Notification.displayName = "Notification";
|
|
1283
1597
|
function getStatusIcon(status) {
|
|
1284
1598
|
switch (status) {
|
|
1285
1599
|
case "promotional":
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easypost/easy-ui",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.76",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"**/*.css"
|
|
6
6
|
],
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@easypost/easy-ui-icons": "1.0.0-alpha.
|
|
8
|
+
"@easypost/easy-ui-icons": "1.0.0-alpha.39",
|
|
9
9
|
"@easypost/easy-ui-tokens": "1.0.0-alpha.15",
|
|
10
10
|
"@react-aria/toast": "^3.0.1",
|
|
11
11
|
"@react-aria/utils": "^3.28.1",
|