@easypost/easy-ui 1.0.0-alpha.80 → 1.0.0-alpha.82
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 +18 -0
- package/HostedUILayout/HostedUILayout.d.ts +22 -1
- package/HostedUILayout/HostedUILayout.d.ts.map +1 -1
- package/HostedUILayout/HostedUILayout.stories.d.ts +2 -0
- package/HostedUILayout/HostedUILayout.stories.d.ts.map +1 -1
- package/HostedUILayout/index.js +106 -11
- package/HostedUILayout/index.mjs +92 -13
- package/package.json +2 -2
- package/style.css +19 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @easypost/easy-ui
|
|
2
2
|
|
|
3
|
+
## 1.0.0-alpha.82
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [58b4d44]
|
|
8
|
+
- @easypost/easy-ui-icons@1.0.0-alpha.41
|
|
9
|
+
|
|
10
|
+
## 1.0.0-alpha.81
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 5710284: feat: support test mode and displaying logo for HostedUILayout
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [5710284]
|
|
19
|
+
- @easypost/easy-ui-icons@1.0.0-alpha.40
|
|
20
|
+
|
|
3
21
|
## 1.0.0-alpha.80
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import { HostedUILayoutActionBadge, HostedUILayoutActions, HostedUILayoutButtonAction, HostedUILayoutLinkAction, HostedUILayoutMenuAction } from "./HostedUILayoutActions";
|
|
3
|
+
export type Mode = "test" | "production";
|
|
3
4
|
export type HostedUILayoutProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Displays a prominent message with an icon when in test mode.
|
|
7
|
+
*
|
|
8
|
+
* @default production
|
|
9
|
+
*/
|
|
10
|
+
mode?: Mode;
|
|
11
|
+
/**
|
|
12
|
+
* Controls whether the EasyPost logo displays.
|
|
13
|
+
*
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
shouldDisplayEasyPostLogo?: boolean;
|
|
4
17
|
/** Layout children. */
|
|
5
18
|
children: ReactNode;
|
|
6
19
|
};
|
|
@@ -20,12 +33,20 @@ export type HostedUILayoutContentProps = {
|
|
|
20
33
|
/** Content children. */
|
|
21
34
|
children: ReactNode;
|
|
22
35
|
};
|
|
36
|
+
export type HostedUILayoutContextType = {
|
|
37
|
+
shouldDisplayEasyPostLogo?: boolean;
|
|
38
|
+
mode?: Mode;
|
|
39
|
+
};
|
|
40
|
+
export declare const useHostedUILayout: () => HostedUILayoutContextType;
|
|
23
41
|
/**
|
|
24
42
|
* `HostedUILayout` defines a header and main content area for a HostedUI product page.
|
|
25
43
|
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* `HostedUILayout` can be combined with `MultipageSection` to render a multipage navigational container.
|
|
46
|
+
*
|
|
26
47
|
* @example
|
|
27
48
|
* ```tsx
|
|
28
|
-
* <HostedUILayout>
|
|
49
|
+
* <HostedUILayout mode="test">
|
|
29
50
|
* <HostedUILayout.Header>
|
|
30
51
|
* <HostedUILayout.LogoContainer>
|
|
31
52
|
* <HostedUILayout.Logo>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HostedUILayout.d.ts","sourceRoot":"","sources":["../../src/HostedUILayout/HostedUILayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"HostedUILayout.d.ts","sourceRoot":"","sources":["../../src/HostedUILayout/HostedUILayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;AAM9D,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AAIjC,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,YAAY,CAAC;AAEzC,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,uBAAuB;IACvB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,uBAAuB;IACvB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,8BAA8B;IAC9B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,qBAAqB;IACrB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,wBAAwB;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,IAAI,CAAC,EAAE,IAAI,CAAC;CACb,CAAC;AAKF,eAAO,MAAM,iBAAiB,iCAM7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAexD;yBAfe,cAAc;;;;;;;;;;;AA8B9B,iBAAS,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,qBAU7D;AAED,iBAAS,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,qBAIzD;AAED,iBAAS,2BAA2B,CAAC,KAAK,EAAE,gCAAgC,qBAa3E;AAED,iBAAS,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,qBAG/D"}
|
|
@@ -4,5 +4,7 @@ type Story = StoryObj<typeof HostedUILayout>;
|
|
|
4
4
|
declare const meta: Meta<typeof HostedUILayout>;
|
|
5
5
|
export default meta;
|
|
6
6
|
export declare const StandardContent: Story;
|
|
7
|
+
export declare const TestMode: Story;
|
|
8
|
+
export declare const DisplayEasyPostLogo: Story;
|
|
7
9
|
export declare const WithMultipageSection: Story;
|
|
8
10
|
//# sourceMappingURL=HostedUILayout.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HostedUILayout.stories.d.ts","sourceRoot":"","sources":["../../src/HostedUILayout/HostedUILayout.stories.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAOlD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAC;AAE7C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAUrC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,eAAe,EAAE,KA4B7B,CAAC;
|
|
1
|
+
{"version":3,"file":"HostedUILayout.stories.d.ts","sourceRoot":"","sources":["../../src/HostedUILayout/HostedUILayout.stories.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAOlD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAC;AAE7C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAUrC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,eAAe,EAAE,KA4B7B,CAAC;AACF,eAAO,MAAM,QAAQ,EAAE,KA4BtB,CAAC;AACF,eAAO,MAAM,mBAAmB,EAAE,KA4BjC,CAAC;AAIF,eAAO,MAAM,oBAAoB,EAAE,KAoFlC,CAAC"}
|
package/HostedUILayout/index.js
CHANGED
|
@@ -34,16 +34,70 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
34
34
|
const React = require("react");
|
|
35
35
|
const EasyPostLogo = require("../__chunks__/EasyPostLogo-DQt5KlFX.js");
|
|
36
36
|
const HorizontalStack = require("../__chunks__/HorizontalStack-CXpjASZi.js");
|
|
37
|
-
const
|
|
37
|
+
const Text = require("../__chunks__/Text-B1xglKFU.js");
|
|
38
38
|
const Icon = require("../__chunks__/Icon-W8F9w-jS.js");
|
|
39
|
+
const Button = require("../__chunks__/Button-2GplvjoR.js");
|
|
39
40
|
const Menu = require("../__chunks__/Menu-CivAepFq.js");
|
|
40
|
-
const Text = require("../__chunks__/Text-B1xglKFU.js");
|
|
41
41
|
const utilities_css = require("../utilities/css.js");
|
|
42
42
|
const useFocusRing = require("../__chunks__/useFocusRing-ygRrwBu3.js");
|
|
43
43
|
const mergeProps = require("../__chunks__/mergeProps-d7wJkv71.js");
|
|
44
44
|
const useHover = require("../__chunks__/useHover-BMIowV0x.js");
|
|
45
45
|
const usePress = require("../__chunks__/usePress-Btah4Wrd.js");
|
|
46
46
|
const useLink = require("../__chunks__/useLink-CcRvXaFq.js");
|
|
47
|
+
function _interopNamespaceDefault(e) {
|
|
48
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
49
|
+
if (e) {
|
|
50
|
+
for (const k in e) {
|
|
51
|
+
if (k !== "default") {
|
|
52
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
53
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: () => e[k]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
n.default = e;
|
|
61
|
+
return Object.freeze(n);
|
|
62
|
+
}
|
|
63
|
+
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
64
|
+
var __defProp2 = Object.defineProperty;
|
|
65
|
+
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
66
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
67
|
+
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
68
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
configurable: true,
|
|
71
|
+
writable: true,
|
|
72
|
+
value
|
|
73
|
+
}) : obj[key] = value;
|
|
74
|
+
var __spreadValues2 = (a, b) => {
|
|
75
|
+
for (var prop in b || (b = {})) if (__hasOwnProp2.call(b, prop)) __defNormalProp2(a, prop, b[prop]);
|
|
76
|
+
if (__getOwnPropSymbols2) for (var prop of __getOwnPropSymbols2(b)) {
|
|
77
|
+
if (__propIsEnum2.call(b, prop)) __defNormalProp2(a, prop, b[prop]);
|
|
78
|
+
}
|
|
79
|
+
return a;
|
|
80
|
+
};
|
|
81
|
+
var __objRest2 = (source, exclude) => {
|
|
82
|
+
var target = {};
|
|
83
|
+
for (var prop in source) if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop];
|
|
84
|
+
if (source != null && __getOwnPropSymbols2) for (var prop of __getOwnPropSymbols2(source)) {
|
|
85
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop)) target[prop] = source[prop];
|
|
86
|
+
}
|
|
87
|
+
return target;
|
|
88
|
+
};
|
|
89
|
+
const Experiment = (_a) => {
|
|
90
|
+
var _b = _a, { title, titleId } = _b, props = __objRest2(_b, ["title", "titleId"]);
|
|
91
|
+
return React__namespace.createElement("svg", __spreadValues2({
|
|
92
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
93
|
+
viewBox: "0 -960 960 960",
|
|
94
|
+
"aria-labelledby": titleId
|
|
95
|
+
}, props), title ? React__namespace.createElement("title", {
|
|
96
|
+
id: titleId
|
|
97
|
+
}, title) : null, React__namespace.createElement("path", {
|
|
98
|
+
d: "M179.69-140q-31.76 0-45.15-29.39-13.38-29.38 8.69-53.69l245.69-282.69v-268.84h-56.61q-9.65 0-16.17-6.59-6.52-6.58-6.52-16.3 0-9.73 6.52-16.11 6.52-6.39 16.17-6.39h295.38q9.65 0 16.17 6.58 6.52 6.58 6.52 16.31 0 9.73-6.52 16.11-6.52 6.39-16.17 6.39h-56.61v268.84l245.69 282.69q22.07 24.31 8.69 53.69Q812.07-140 780.31-140H179.69Zm72.7-78.08h455.22L554.15-396.54h-148.3L252.39-218.08Zm-81.62 32.69h618.46L525.69-489.15v-285.46h-91.38v285.46L170.77-185.39ZM480-480Z"
|
|
99
|
+
}));
|
|
100
|
+
};
|
|
47
101
|
const button = "_button_zvh9c_4";
|
|
48
102
|
const focused = "_focused_zvh9c_26";
|
|
49
103
|
const hovered = "_hovered_zvh9c_40";
|
|
@@ -140,27 +194,66 @@ const PressableButton = React.forwardRef((props, ref) => {
|
|
|
140
194
|
}));
|
|
141
195
|
});
|
|
142
196
|
PressableButton.displayName = "PressableButton";
|
|
143
|
-
const HostedUILayout$1 = "
|
|
144
|
-
const logo = "
|
|
145
|
-
const
|
|
146
|
-
const
|
|
197
|
+
const HostedUILayout$1 = "_HostedUILayout_ikal9_4";
|
|
198
|
+
const logo = "_logo_ikal9_15";
|
|
199
|
+
const testModeBanner = "_testModeBanner_ikal9_19";
|
|
200
|
+
const header = "_header_ikal9_27";
|
|
201
|
+
const logoAndActions = "_logoAndActions_ikal9_37";
|
|
202
|
+
const content = "_content_ikal9_45";
|
|
147
203
|
const styles = {
|
|
148
204
|
HostedUILayout: HostedUILayout$1,
|
|
149
205
|
logo,
|
|
206
|
+
testModeBanner,
|
|
150
207
|
header,
|
|
208
|
+
logoAndActions,
|
|
151
209
|
content
|
|
152
210
|
};
|
|
211
|
+
const HostedUILayoutContext = React.createContext(null);
|
|
212
|
+
const useHostedUILayout = () => {
|
|
213
|
+
const context = React.useContext(HostedUILayoutContext);
|
|
214
|
+
if (!context) {
|
|
215
|
+
throw new Error("useHostedUILayout must be used within a HostedUILayout");
|
|
216
|
+
}
|
|
217
|
+
return context;
|
|
218
|
+
};
|
|
153
219
|
function HostedUILayout(props) {
|
|
154
|
-
const { children } = props;
|
|
155
|
-
|
|
220
|
+
const { children, mode = "production", shouldDisplayEasyPostLogo = true } = props;
|
|
221
|
+
const context = React.useMemo(() => {
|
|
222
|
+
return {
|
|
223
|
+
mode,
|
|
224
|
+
shouldDisplayEasyPostLogo
|
|
225
|
+
};
|
|
226
|
+
}, [mode, shouldDisplayEasyPostLogo]);
|
|
227
|
+
return React.createElement(HostedUILayoutContext.Provider, {
|
|
228
|
+
value: context
|
|
229
|
+
}, React.createElement("div", {
|
|
156
230
|
className: styles.HostedUILayout
|
|
157
|
-
}, children);
|
|
231
|
+
}, children));
|
|
232
|
+
}
|
|
233
|
+
function TestModeBanner() {
|
|
234
|
+
return React.createElement("div", {
|
|
235
|
+
className: styles.testModeBanner
|
|
236
|
+
}, React.createElement(HorizontalStack.HorizontalStack, {
|
|
237
|
+
gap: "1",
|
|
238
|
+
blockAlign: "center"
|
|
239
|
+
}, React.createElement(Icon.Icon, {
|
|
240
|
+
symbol: Experiment,
|
|
241
|
+
color: "primary.700",
|
|
242
|
+
size: "lg"
|
|
243
|
+
}), React.createElement(Text.Text, {
|
|
244
|
+
variant: "subtitle1",
|
|
245
|
+
color: "warning.900"
|
|
246
|
+
}, "This Environment is in Test Mode")));
|
|
158
247
|
}
|
|
159
248
|
function HostedUILayoutHeader(props) {
|
|
160
249
|
const { children } = props;
|
|
250
|
+
const { mode } = useHostedUILayout();
|
|
251
|
+
const isTestMode = mode === "test";
|
|
161
252
|
return React.createElement("header", {
|
|
162
253
|
className: styles.header
|
|
163
|
-
},
|
|
254
|
+
}, isTestMode && React.createElement(TestModeBanner, null), React.createElement("div", {
|
|
255
|
+
className: styles.logoAndActions
|
|
256
|
+
}, children));
|
|
164
257
|
}
|
|
165
258
|
function HostedUILayoutLogo(props) {
|
|
166
259
|
const { children } = props;
|
|
@@ -170,12 +263,13 @@ function HostedUILayoutLogo(props) {
|
|
|
170
263
|
}
|
|
171
264
|
function HostedUILayoutLogoContainer(props) {
|
|
172
265
|
const { children } = props;
|
|
266
|
+
const { shouldDisplayEasyPostLogo } = useHostedUILayout();
|
|
173
267
|
return React.createElement(HorizontalStack.HorizontalStack, {
|
|
174
268
|
gap: "1",
|
|
175
269
|
blockAlign: "center",
|
|
176
270
|
align: "start",
|
|
177
271
|
wrap: false
|
|
178
|
-
}, React.createElement(HostedUILayoutLogo, null, React.createElement(EasyPostLogo.EasyPostLogo, null)), children);
|
|
272
|
+
}, shouldDisplayEasyPostLogo && React.createElement(HostedUILayoutLogo, null, React.createElement(EasyPostLogo.EasyPostLogo, null)), children);
|
|
179
273
|
}
|
|
180
274
|
function HostedUILayoutContent(props) {
|
|
181
275
|
const { children } = props;
|
|
@@ -193,3 +287,4 @@ HostedUILayout.LinkAction = HostedUILayoutLinkAction;
|
|
|
193
287
|
HostedUILayout.ButtonAction = HostedUILayoutButtonAction;
|
|
194
288
|
HostedUILayout.Content = HostedUILayoutContent;
|
|
195
289
|
exports.HostedUILayout = HostedUILayout;
|
|
290
|
+
exports.useHostedUILayout = useHostedUILayout;
|
package/HostedUILayout/index.mjs
CHANGED
|
@@ -29,19 +29,57 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import
|
|
32
|
+
import * as React from "react";
|
|
33
|
+
import React__default, { useState, useCallback, forwardRef, useRef, useContext, useMemo } from "react";
|
|
33
34
|
import { E as EasyPostLogo } from "../__chunks__/EasyPostLogo-B3Um5vvS.mjs";
|
|
34
35
|
import { H as HorizontalStack } from "../__chunks__/HorizontalStack-CxE8tPx_.mjs";
|
|
35
|
-
import {
|
|
36
|
+
import { T as Text } from "../__chunks__/Text-CX5GoBTS.mjs";
|
|
36
37
|
import { I as Icon } from "../__chunks__/Icon-0SN9dbwU.mjs";
|
|
38
|
+
import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../__chunks__/Button-BpGjkRZu.mjs";
|
|
37
39
|
import { M as Menu } from "../__chunks__/Menu-CfHK_0Sr.mjs";
|
|
38
|
-
import { T as Text } from "../__chunks__/Text-CX5GoBTS.mjs";
|
|
39
40
|
import { classNames } from "../utilities/css.mjs";
|
|
40
41
|
import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "../__chunks__/useFocusRing-DAMeUI3t.mjs";
|
|
41
42
|
import { $ as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "../__chunks__/mergeProps-CORsYhTp.mjs";
|
|
42
43
|
import { $ as $6179b936705e76d3$export$ae780daf29e6d456 } from "../__chunks__/useHover-CwJuylzq.mjs";
|
|
43
44
|
import { $ as $f6c31cce2adf654f$export$45712eceda6fad21 } from "../__chunks__/usePress-BGHDb_ce.mjs";
|
|
44
45
|
import { $ as $298d61e98472621b$export$dcf14c9974fe2767 } from "../__chunks__/useLink-CxFvWxcs.mjs";
|
|
46
|
+
var __defProp2 = Object.defineProperty;
|
|
47
|
+
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
48
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
49
|
+
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
50
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
configurable: true,
|
|
53
|
+
writable: true,
|
|
54
|
+
value
|
|
55
|
+
}) : obj[key] = value;
|
|
56
|
+
var __spreadValues2 = (a, b) => {
|
|
57
|
+
for (var prop in b || (b = {})) if (__hasOwnProp2.call(b, prop)) __defNormalProp2(a, prop, b[prop]);
|
|
58
|
+
if (__getOwnPropSymbols2) for (var prop of __getOwnPropSymbols2(b)) {
|
|
59
|
+
if (__propIsEnum2.call(b, prop)) __defNormalProp2(a, prop, b[prop]);
|
|
60
|
+
}
|
|
61
|
+
return a;
|
|
62
|
+
};
|
|
63
|
+
var __objRest2 = (source, exclude) => {
|
|
64
|
+
var target = {};
|
|
65
|
+
for (var prop in source) if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop];
|
|
66
|
+
if (source != null && __getOwnPropSymbols2) for (var prop of __getOwnPropSymbols2(source)) {
|
|
67
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop)) target[prop] = source[prop];
|
|
68
|
+
}
|
|
69
|
+
return target;
|
|
70
|
+
};
|
|
71
|
+
const Experiment = (_a) => {
|
|
72
|
+
var _b = _a, { title, titleId } = _b, props = __objRest2(_b, ["title", "titleId"]);
|
|
73
|
+
return React.createElement("svg", __spreadValues2({
|
|
74
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
75
|
+
viewBox: "0 -960 960 960",
|
|
76
|
+
"aria-labelledby": titleId
|
|
77
|
+
}, props), title ? React.createElement("title", {
|
|
78
|
+
id: titleId
|
|
79
|
+
}, title) : null, React.createElement("path", {
|
|
80
|
+
d: "M179.69-140q-31.76 0-45.15-29.39-13.38-29.38 8.69-53.69l245.69-282.69v-268.84h-56.61q-9.65 0-16.17-6.59-6.52-6.58-6.52-16.3 0-9.73 6.52-16.11 6.52-6.39 16.17-6.39h295.38q9.65 0 16.17 6.58 6.52 6.58 6.52 16.31 0 9.73-6.52 16.11-6.52 6.39-16.17 6.39h-56.61v268.84l245.69 282.69q22.07 24.31 8.69 53.69Q812.07-140 780.31-140H179.69Zm72.7-78.08h455.22L554.15-396.54h-148.3L252.39-218.08Zm-81.62 32.69h618.46L525.69-489.15v-285.46h-91.38v285.46L170.77-185.39ZM480-480Z"
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
45
83
|
const button = "_button_zvh9c_4";
|
|
46
84
|
const focused = "_focused_zvh9c_26";
|
|
47
85
|
const hovered = "_hovered_zvh9c_40";
|
|
@@ -138,27 +176,66 @@ const PressableButton = forwardRef((props, ref) => {
|
|
|
138
176
|
}));
|
|
139
177
|
});
|
|
140
178
|
PressableButton.displayName = "PressableButton";
|
|
141
|
-
const HostedUILayout$1 = "
|
|
142
|
-
const logo = "
|
|
143
|
-
const
|
|
144
|
-
const
|
|
179
|
+
const HostedUILayout$1 = "_HostedUILayout_ikal9_4";
|
|
180
|
+
const logo = "_logo_ikal9_15";
|
|
181
|
+
const testModeBanner = "_testModeBanner_ikal9_19";
|
|
182
|
+
const header = "_header_ikal9_27";
|
|
183
|
+
const logoAndActions = "_logoAndActions_ikal9_37";
|
|
184
|
+
const content = "_content_ikal9_45";
|
|
145
185
|
const styles = {
|
|
146
186
|
HostedUILayout: HostedUILayout$1,
|
|
147
187
|
logo,
|
|
188
|
+
testModeBanner,
|
|
148
189
|
header,
|
|
190
|
+
logoAndActions,
|
|
149
191
|
content
|
|
150
192
|
};
|
|
193
|
+
const HostedUILayoutContext = React__default.createContext(null);
|
|
194
|
+
const useHostedUILayout = () => {
|
|
195
|
+
const context = useContext(HostedUILayoutContext);
|
|
196
|
+
if (!context) {
|
|
197
|
+
throw new Error("useHostedUILayout must be used within a HostedUILayout");
|
|
198
|
+
}
|
|
199
|
+
return context;
|
|
200
|
+
};
|
|
151
201
|
function HostedUILayout(props) {
|
|
152
|
-
const { children } = props;
|
|
153
|
-
|
|
202
|
+
const { children, mode = "production", shouldDisplayEasyPostLogo = true } = props;
|
|
203
|
+
const context = useMemo(() => {
|
|
204
|
+
return {
|
|
205
|
+
mode,
|
|
206
|
+
shouldDisplayEasyPostLogo
|
|
207
|
+
};
|
|
208
|
+
}, [mode, shouldDisplayEasyPostLogo]);
|
|
209
|
+
return React__default.createElement(HostedUILayoutContext.Provider, {
|
|
210
|
+
value: context
|
|
211
|
+
}, React__default.createElement("div", {
|
|
154
212
|
className: styles.HostedUILayout
|
|
155
|
-
}, children);
|
|
213
|
+
}, children));
|
|
214
|
+
}
|
|
215
|
+
function TestModeBanner() {
|
|
216
|
+
return React__default.createElement("div", {
|
|
217
|
+
className: styles.testModeBanner
|
|
218
|
+
}, React__default.createElement(HorizontalStack, {
|
|
219
|
+
gap: "1",
|
|
220
|
+
blockAlign: "center"
|
|
221
|
+
}, React__default.createElement(Icon, {
|
|
222
|
+
symbol: Experiment,
|
|
223
|
+
color: "primary.700",
|
|
224
|
+
size: "lg"
|
|
225
|
+
}), React__default.createElement(Text, {
|
|
226
|
+
variant: "subtitle1",
|
|
227
|
+
color: "warning.900"
|
|
228
|
+
}, "This Environment is in Test Mode")));
|
|
156
229
|
}
|
|
157
230
|
function HostedUILayoutHeader(props) {
|
|
158
231
|
const { children } = props;
|
|
232
|
+
const { mode } = useHostedUILayout();
|
|
233
|
+
const isTestMode = mode === "test";
|
|
159
234
|
return React__default.createElement("header", {
|
|
160
235
|
className: styles.header
|
|
161
|
-
},
|
|
236
|
+
}, isTestMode && React__default.createElement(TestModeBanner, null), React__default.createElement("div", {
|
|
237
|
+
className: styles.logoAndActions
|
|
238
|
+
}, children));
|
|
162
239
|
}
|
|
163
240
|
function HostedUILayoutLogo(props) {
|
|
164
241
|
const { children } = props;
|
|
@@ -168,12 +245,13 @@ function HostedUILayoutLogo(props) {
|
|
|
168
245
|
}
|
|
169
246
|
function HostedUILayoutLogoContainer(props) {
|
|
170
247
|
const { children } = props;
|
|
248
|
+
const { shouldDisplayEasyPostLogo } = useHostedUILayout();
|
|
171
249
|
return React__default.createElement(HorizontalStack, {
|
|
172
250
|
gap: "1",
|
|
173
251
|
blockAlign: "center",
|
|
174
252
|
align: "start",
|
|
175
253
|
wrap: false
|
|
176
|
-
}, React__default.createElement(HostedUILayoutLogo, null, React__default.createElement(EasyPostLogo, null)), children);
|
|
254
|
+
}, shouldDisplayEasyPostLogo && React__default.createElement(HostedUILayoutLogo, null, React__default.createElement(EasyPostLogo, null)), children);
|
|
177
255
|
}
|
|
178
256
|
function HostedUILayoutContent(props) {
|
|
179
257
|
const { children } = props;
|
|
@@ -191,5 +269,6 @@ HostedUILayout.LinkAction = HostedUILayoutLinkAction;
|
|
|
191
269
|
HostedUILayout.ButtonAction = HostedUILayoutButtonAction;
|
|
192
270
|
HostedUILayout.Content = HostedUILayoutContent;
|
|
193
271
|
export {
|
|
194
|
-
HostedUILayout
|
|
272
|
+
HostedUILayout,
|
|
273
|
+
useHostedUILayout
|
|
195
274
|
};
|
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.82",
|
|
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.41",
|
|
9
9
|
"@easypost/easy-ui-tokens": "1.0.0-alpha.16",
|
|
10
10
|
"@react-aria/toast": "^3.0.1",
|
|
11
11
|
"@react-aria/utils": "^3.28.2",
|
package/style.css
CHANGED
|
@@ -4839,7 +4839,7 @@ textarea {
|
|
|
4839
4839
|
}/**
|
|
4840
4840
|
* Do not edit directly, this file was auto-generated.
|
|
4841
4841
|
*/
|
|
4842
|
-
.
|
|
4842
|
+
._HostedUILayout_ikal9_4 {
|
|
4843
4843
|
--ezui-c-hostedui-layout-max-width: 1369px;
|
|
4844
4844
|
display: flex;
|
|
4845
4845
|
flex-direction: column;
|
|
@@ -4850,26 +4850,37 @@ textarea {
|
|
|
4850
4850
|
background-position: -40px -90px, calc(100% + 24px) calc(100% + 24px);
|
|
4851
4851
|
}
|
|
4852
4852
|
|
|
4853
|
-
.
|
|
4853
|
+
._logo_ikal9_15 {
|
|
4854
4854
|
display: inline-flex;
|
|
4855
4855
|
}
|
|
4856
4856
|
|
|
4857
|
-
.
|
|
4857
|
+
._testModeBanner_ikal9_19 {
|
|
4858
|
+
width: 100%;
|
|
4859
|
+
background: var(--ezui-color-warning-100);
|
|
4860
|
+
padding: var(--ezui-space-1) var(--ezui-space-2) var(--ezui-space-1) var(--ezui-space-1);
|
|
4861
|
+
border-radius: 0 0 var(--ezui-shape-border-radius-lg) var(--ezui-shape-border-radius-lg);
|
|
4862
|
+
box-shadow: var(--ezui-shadow-level-1);
|
|
4863
|
+
}
|
|
4864
|
+
|
|
4865
|
+
._header_ikal9_27 {
|
|
4858
4866
|
z-index: var(--ezui-z-index-nav);
|
|
4859
4867
|
position: sticky;
|
|
4860
4868
|
top: 0;
|
|
4869
|
+
min-width: 0;
|
|
4870
|
+
background-color: var(--ezui-color-neutral-050);
|
|
4871
|
+
border-bottom: 1px solid var(--ezui-color-neutral-300);
|
|
4872
|
+
padding: 0 var(--ezui-space-3);
|
|
4873
|
+
}
|
|
4874
|
+
|
|
4875
|
+
._logoAndActions_ikal9_37 {
|
|
4861
4876
|
display: flex;
|
|
4862
4877
|
flex-wrap: nowrap;
|
|
4863
4878
|
align-items: center;
|
|
4864
4879
|
justify-content: space-between;
|
|
4865
|
-
min-width: 0;
|
|
4866
|
-
background-color: var(--ezui-color-neutral-050);
|
|
4867
|
-
border-bottom: 1px solid var(--ezui-color-neutral-300);
|
|
4868
4880
|
height: var(--ezui-space-7);
|
|
4869
|
-
padding: 0 var(--ezui-space-3);
|
|
4870
4881
|
}
|
|
4871
4882
|
|
|
4872
|
-
.
|
|
4883
|
+
._content_ikal9_45 {
|
|
4873
4884
|
padding: var(--ezui-space-3);
|
|
4874
4885
|
max-width: var(--ezui-c-hostedui-layout-max-width);
|
|
4875
4886
|
width: 100%;
|