@phillips/seldon 1.28.0 → 1.29.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.
@@ -37,6 +37,10 @@ export interface SubscribeProps extends React.HTMLAttributes<HTMLFormElement> {
37
37
  * Subscribe error text
38
38
  */
39
39
  invalidText?: string;
40
+ /**
41
+ * Subscribe invalid text
42
+ */
43
+ errorText?: string;
40
44
  /**
41
45
  * Subscribe success text
42
46
  */
@@ -55,5 +59,5 @@ export interface SubscribeProps extends React.HTMLAttributes<HTMLFormElement> {
55
59
  *
56
60
  * [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-subscribe--overview)
57
61
  */
58
- declare const Subscribe: ({ blurb, buttonText, buttonProps, className, element: Element, inputLabelText, inputPlaceholder, title, loadingText, invalidText, successText, subscriptionState, ...props }: SubscribeProps) => import("react/jsx-runtime").JSX.Element;
62
+ declare const Subscribe: ({ blurb, buttonText, buttonProps, className, element: Element, inputLabelText, inputPlaceholder, title, loadingText, invalidText, errorText, successText, subscriptionState, ...props }: SubscribeProps) => import("react/jsx-runtime").JSX.Element;
59
63
  export default Subscribe;
@@ -1,50 +1,52 @@
1
- import { jsxs as $, jsx as o } from "react/jsx-runtime";
2
- import y from "../../node_modules/classnames/index.js";
3
- import { getCommonProps as C } from "../../utils/index.js";
4
- import v from "../Input/Input.js";
5
- import w from "../Button/Button.js";
6
- import { SubscriptionState as S } from "./types.js";
7
- const D = ({
8
- blurb: t,
1
+ import { jsxs as C, jsx as s } from "react/jsx-runtime";
2
+ import E from "../../node_modules/classnames/index.js";
3
+ import { getCommonProps as I } from "../../utils/index.js";
4
+ import L from "../Input/Input.js";
5
+ import P from "../Button/Button.js";
6
+ import { SubscriptionState as o } from "./types.js";
7
+ const U = ({
8
+ blurb: a,
9
9
  buttonText: i = "Sign Up",
10
10
  buttonProps: m,
11
11
  className: n,
12
- element: r = "form",
13
- inputLabelText: c = "Email*",
14
- inputPlaceholder: d = "example@email.com",
15
- title: u = "Subscribe to Newsletter",
16
- loadingText: p = "Loading...",
17
- invalidText: a = "",
18
- successText: f,
19
- subscriptionState: e = S.Default,
20
- ...l
12
+ element: c = "form",
13
+ inputLabelText: d = "Email*",
14
+ inputPlaceholder: u = "example@email.com",
15
+ title: p = "Subscribe to Newsletter",
16
+ loadingText: f = "Loading...",
17
+ invalidText: x = "",
18
+ errorText: _ = "An error occurred. Please try again.",
19
+ successText: b,
20
+ subscriptionState: e = o.Default,
21
+ ...t
21
22
  }) => {
22
- const { className: s, ...b } = C(l, "Subscribe"), _ = e === "invalid", x = e === "loading", N = e === "success", g = e !== "default" ? {
23
- invalid: a,
24
- success: f,
25
- loading: p
26
- }[e] : "", h = N || x;
27
- return /* @__PURE__ */ $(r, { ...b, className: y(s, n), noValidate: !0, ...l, children: [
28
- /* @__PURE__ */ o("h3", { className: `${s}__title`, children: u }),
29
- t ? /* @__PURE__ */ o("p", { className: `${s}__blurb`, children: t }) : null,
30
- /* @__PURE__ */ o(
31
- v,
23
+ const { className: r, ...g } = I(t, "Subscribe"), N = e === o.Invalid, h = e === o.Loading, v = e === o.Success, y = e === o.Error, $ = {
24
+ invalid: x,
25
+ success: b,
26
+ loading: f,
27
+ error: _
28
+ }, l = e !== o.Default ? $[e] : "", T = v || h, w = N || y;
29
+ return /* @__PURE__ */ C(c, { ...g, className: E(r, n), noValidate: !0, ...t, children: [
30
+ /* @__PURE__ */ s("h3", { className: `${r}__title`, children: p }),
31
+ a ? /* @__PURE__ */ s("p", { className: `${r}__blurb`, children: a }) : null,
32
+ /* @__PURE__ */ s(
33
+ L,
32
34
  {
33
- className: `${s}__input`,
35
+ className: `${r}__input`,
34
36
  type: "email",
35
37
  name: "email",
36
- placeholder: d,
37
- labelText: c,
38
- invalid: _,
39
- invalidText: a,
40
- warn: h,
41
- warnText: g,
38
+ placeholder: u,
39
+ labelText: d,
40
+ invalid: w,
41
+ invalidText: l,
42
+ warn: T,
43
+ warnText: l,
42
44
  required: !0
43
45
  }
44
46
  ),
45
- /* @__PURE__ */ o(w, { className: `${s}__button ${n}`, buttonType: "secondary", type: "submit", ...m, children: i })
47
+ /* @__PURE__ */ s(P, { className: `${r}__button ${n}`, buttonType: "secondary", type: "submit", ...m, children: i })
46
48
  ] });
47
49
  };
48
50
  export {
49
- D as default
51
+ U as default
50
52
  };
@@ -2,5 +2,6 @@ export declare enum SubscriptionState {
2
2
  Default = "default",
3
3
  Loading = "loading",
4
4
  Invalid = "invalid",
5
+ Error = "error",
5
6
  Success = "success"
6
7
  }
@@ -1,4 +1,4 @@
1
- var l = /* @__PURE__ */ ((d) => (d.Default = "default", d.Loading = "loading", d.Invalid = "invalid", d.Success = "success", d))(l || {});
1
+ var d = /* @__PURE__ */ ((r) => (r.Default = "default", r.Loading = "loading", r.Invalid = "invalid", r.Error = "error", r.Success = "success", r))(d || {});
2
2
  export {
3
- l as SubscriptionState
3
+ d as SubscriptionState
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"