@easypost/easy-ui 1.0.0-alpha.109 → 1.0.0-alpha.110

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.
@@ -0,0 +1,32 @@
1
+ import React, { ReactNode } from "react";
2
+ import { IconSymbol } from "../types";
3
+ export declare const DEFAULT_VARIANT = "danger";
4
+ export declare const DEFAULT_PLACEMENT = "top right";
5
+ export type AlertBadgeVariant = "primary" | "secondary" | "success" | "danger";
6
+ export type AlertBadgePlacement = "top right" | "bottom right";
7
+ export type AlertBadgeProps = {
8
+ /** AlertBadge placement
9
+ * @default top right
10
+ */
11
+ placement?: AlertBadgePlacement;
12
+ /** AlertBadge icon (IconSymbol)
13
+ * @default undefined
14
+ */
15
+ icon?: IconSymbol;
16
+ /**
17
+ * Accessible label for the AlertBadge.
18
+ * @default Alert Badge
19
+ */
20
+ accessibilityLabel?: string;
21
+ /**
22
+ * AlertBadge variant.
23
+ * @default danger
24
+ */
25
+ variant?: AlertBadgeVariant;
26
+ /** AlertBadge attachment target. */
27
+ children: ReactNode;
28
+ /** Show/hide AlertBadge. */
29
+ show: boolean;
30
+ };
31
+ export declare function AlertBadge(props: AlertBadgeProps): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
32
+ //# sourceMappingURL=AlertBadge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertBadge.d.ts","sourceRoot":"","sources":["../../src/AlertBadge/AlertBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAKtC,eAAO,MAAM,eAAe,WAAW,CAAC;AAExC,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE/E,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,cAAc,CAAC;AAE/D,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAEhC;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAE5B,oCAAoC;IACpC,QAAQ,EAAE,SAAS,CAAC;IAEpB,6BAA6B;IAC7B,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,gGA+BhD"}
@@ -0,0 +1,10 @@
1
+ import { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { AlertBadge } from "./AlertBadge";
3
+ type Story = StoryObj<typeof AlertBadge>;
4
+ declare const meta: Meta<typeof AlertBadge>;
5
+ export default meta;
6
+ export declare const Variants: Story;
7
+ export declare const Placement: Story;
8
+ export declare const Icon: Story;
9
+ export declare const WithTooltip: Story;
10
+ //# sourceMappingURL=AlertBadge.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertBadge.stories.d.ts","sourceRoot":"","sources":["../../src/AlertBadge/AlertBadge.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMvD,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AAK3D,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAC;AAQzC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAiBjC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,QAAQ,EAAE,KAkBtB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KA+BvB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAclB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAoBzB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AlertBadge.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertBadge.test.d.ts","sourceRoot":"","sources":["../../src/AlertBadge/AlertBadge.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./AlertBadge";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/AlertBadge/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const React = require("react");
4
+ const Icon = require("../__chunks__/Icon-W8F9w-jS.js");
5
+ const Text = require("../__chunks__/Text-CSESKR_s.js");
6
+ const utilities_css = require("../utilities/css.js");
7
+ const container = "_container_7b7g9_4";
8
+ const root = "_root_7b7g9_9";
9
+ const badge = "_badge_7b7g9_13";
10
+ const bottom = "_bottom_7b7g9_24";
11
+ const top = "_top_7b7g9_28";
12
+ const right = "_right_7b7g9_32";
13
+ const variantPrimary = "_variantPrimary_7b7g9_36";
14
+ const variantSecondary = "_variantSecondary_7b7g9_41";
15
+ const variantSuccess = "_variantSuccess_7b7g9_46";
16
+ const variantDanger = "_variantDanger_7b7g9_51";
17
+ const styles = {
18
+ container,
19
+ root,
20
+ badge,
21
+ bottom,
22
+ top,
23
+ right,
24
+ variantPrimary,
25
+ variantSecondary,
26
+ variantSuccess,
27
+ variantDanger
28
+ };
29
+ const DEFAULT_VARIANT = "danger";
30
+ const DEFAULT_PLACEMENT = "top right";
31
+ function AlertBadge(props) {
32
+ const { accessibilityLabel = "Alert Badge", placement = DEFAULT_PLACEMENT, variant = DEFAULT_VARIANT, icon, show, children } = props;
33
+ const className = utilities_css.classNames(styles.root, styles[utilities_css.variationName("variant", variant)], ...placement.split(" ").map((position) => styles[position]));
34
+ if (!show) {
35
+ return children;
36
+ }
37
+ return React.createElement("span", {
38
+ className: styles.container
39
+ }, children, React.createElement("span", {
40
+ className
41
+ }, React.createElement(Text.Text, {
42
+ visuallyHidden: true
43
+ }, accessibilityLabel), React.createElement("span", {
44
+ className: styles.badge,
45
+ role: "status"
46
+ }, icon && React.createElement(Icon.Icon, {
47
+ symbol: icon,
48
+ size: "2xs"
49
+ }))));
50
+ }
51
+ exports.AlertBadge = AlertBadge;
52
+ exports.DEFAULT_PLACEMENT = DEFAULT_PLACEMENT;
53
+ exports.DEFAULT_VARIANT = DEFAULT_VARIANT;
@@ -0,0 +1,53 @@
1
+ import React__default from "react";
2
+ import { I as Icon } from "../__chunks__/Icon-0SN9dbwU.mjs";
3
+ import { T as Text } from "../__chunks__/Text-YOL3isF4.mjs";
4
+ import { classNames, variationName } from "../utilities/css.mjs";
5
+ const container = "_container_7b7g9_4";
6
+ const root = "_root_7b7g9_9";
7
+ const badge = "_badge_7b7g9_13";
8
+ const bottom = "_bottom_7b7g9_24";
9
+ const top = "_top_7b7g9_28";
10
+ const right = "_right_7b7g9_32";
11
+ const variantPrimary = "_variantPrimary_7b7g9_36";
12
+ const variantSecondary = "_variantSecondary_7b7g9_41";
13
+ const variantSuccess = "_variantSuccess_7b7g9_46";
14
+ const variantDanger = "_variantDanger_7b7g9_51";
15
+ const styles = {
16
+ container,
17
+ root,
18
+ badge,
19
+ bottom,
20
+ top,
21
+ right,
22
+ variantPrimary,
23
+ variantSecondary,
24
+ variantSuccess,
25
+ variantDanger
26
+ };
27
+ const DEFAULT_VARIANT = "danger";
28
+ const DEFAULT_PLACEMENT = "top right";
29
+ function AlertBadge(props) {
30
+ const { accessibilityLabel = "Alert Badge", placement = DEFAULT_PLACEMENT, variant = DEFAULT_VARIANT, icon, show, children } = props;
31
+ const className = classNames(styles.root, styles[variationName("variant", variant)], ...placement.split(" ").map((position) => styles[position]));
32
+ if (!show) {
33
+ return children;
34
+ }
35
+ return React__default.createElement("span", {
36
+ className: styles.container
37
+ }, children, React__default.createElement("span", {
38
+ className
39
+ }, React__default.createElement(Text, {
40
+ visuallyHidden: true
41
+ }, accessibilityLabel), React__default.createElement("span", {
42
+ className: styles.badge,
43
+ role: "status"
44
+ }, icon && React__default.createElement(Icon, {
45
+ symbol: icon,
46
+ size: "2xs"
47
+ }))));
48
+ }
49
+ export {
50
+ AlertBadge,
51
+ DEFAULT_PLACEMENT,
52
+ DEFAULT_VARIANT
53
+ };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @easypost/easy-ui
2
2
 
3
+ ## 1.0.0-alpha.110
4
+
5
+ ### Minor Changes
6
+
7
+ - 0fa20fa: feat: Add AlertBadge
8
+
3
9
  ## 1.0.0-alpha.109
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easypost/easy-ui",
3
- "version": "1.0.0-alpha.109",
3
+ "version": "1.0.0-alpha.110",
4
4
  "sideEffects": [
5
5
  "**/*.css"
6
6
  ],
package/style.css CHANGED
@@ -4258,6 +4258,59 @@ textarea {
4258
4258
  }/**
4259
4259
  * Do not edit directly, this file was auto-generated.
4260
4260
  */
4261
+ ._container_7b7g9_4 {
4262
+ position: relative;
4263
+ display: inline-block;
4264
+ }
4265
+
4266
+ ._root_7b7g9_9 {
4267
+ position: absolute;
4268
+ }
4269
+
4270
+ ._badge_7b7g9_13 {
4271
+ border-radius: 50%;
4272
+ display: flex;
4273
+ justify-content: center;
4274
+ align-items: center;
4275
+ width: var(--ezui-space-2);
4276
+ height: var(--ezui-space-2);
4277
+ background: var(--ezui-c-alert-badge-badge-color-background);
4278
+ color: var(--ezui-c-alert-badge-badge-color-text);
4279
+ }
4280
+
4281
+ ._bottom_7b7g9_24 {
4282
+ bottom: calc(var(--ezui-space-1) * -1);
4283
+ }
4284
+
4285
+ ._top_7b7g9_28 {
4286
+ top: calc(var(--ezui-space-1) * -1);
4287
+ }
4288
+
4289
+ ._right_7b7g9_32 {
4290
+ right: calc(var(--ezui-space-1) * -1);
4291
+ }
4292
+
4293
+ ._variantPrimary_7b7g9_36 {
4294
+ --ezui-c-alert-badge-badge-color-background: var(--ezui-color-primary-500);
4295
+ --ezui-c-alert-badge-badge-color-text: var(--ezui-color-neutral-000);
4296
+ }
4297
+
4298
+ ._variantSecondary_7b7g9_41 {
4299
+ --ezui-c-alert-badge-badge-color-background: var(--ezui-color-secondary-500);
4300
+ --ezui-c-alert-badge-badge-color-text: var(--ezui-color-neutral-000);
4301
+ }
4302
+
4303
+ ._variantSuccess_7b7g9_46 {
4304
+ --ezui-c-alert-badge-badge-color-background: var(--ezui-color-positive-500);
4305
+ --ezui-c-alert-badge-badge-color-text: var(--ezui-color-primary-800);
4306
+ }
4307
+
4308
+ ._variantDanger_7b7g9_51 {
4309
+ --ezui-c-alert-badge-badge-color-background: var(--ezui-color-negative-600);
4310
+ --ezui-c-alert-badge-badge-color-text: var(--ezui-color-neutral-000);
4311
+ }/**
4312
+ * Do not edit directly, this file was auto-generated.
4313
+ */
4261
4314
  ._underlay_10bf4_4 {
4262
4315
  position: fixed;
4263
4316
  inset: 0;