@phillips/seldon 1.20.0 → 1.21.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.
@@ -1,4 +1,5 @@
1
1
  import { ButtonProps } from '../Button/Button';
2
+ import { SubscriptionState } from './types';
2
3
  export interface SubscribeProps extends React.HTMLAttributes<HTMLFormElement> {
3
4
  /**
4
5
  * Subscribe blurb
@@ -28,6 +29,22 @@ export interface SubscribeProps extends React.HTMLAttributes<HTMLFormElement> {
28
29
  * Subscribe title text
29
30
  */
30
31
  title?: string;
32
+ /**
33
+ * Subscribe loading text
34
+ */
35
+ loadingText?: string;
36
+ /**
37
+ * Subscribe error text
38
+ */
39
+ invalidText?: string;
40
+ /**
41
+ * Subscribe success text
42
+ */
43
+ successText?: string;
44
+ /**
45
+ * Subscribe state for loading or error
46
+ */
47
+ subscriptionState?: SubscriptionState;
31
48
  }
32
49
  /**
33
50
  * ## Overview
@@ -36,5 +53,5 @@ export interface SubscribeProps extends React.HTMLAttributes<HTMLFormElement> {
36
53
  *
37
54
  * [Figma Link](https://www.figma.com/file/npS5ECbNut8hevUkGWSzUN/Site-Furniture-(Navigation)---SP24?node-id=4347%3A4194&mode=dev)
38
55
  */
39
- declare const Subscribe: ({ blurb, buttonText, buttonProps, className, element: Element, id, inputLabelText, inputPlaceholder, title, ...props }: SubscribeProps) => import("react/jsx-runtime").JSX.Element;
56
+ declare const Subscribe: ({ blurb, buttonText, buttonProps, className, element: Element, id, inputLabelText, inputPlaceholder, title, loadingText, invalidText, successText, subscriptionState, ...props }: SubscribeProps) => import("react/jsx-runtime").JSX.Element;
40
57
  export default Subscribe;
@@ -1,42 +1,61 @@
1
- import { jsxs as n, jsx as s } from "react/jsx-runtime";
2
- import p from "../../node_modules/classnames/index.js";
3
- import { px as e } from "../../utils/index.js";
4
- import f from "../Input/Input.js";
5
- import _ from "../Button/Button.js";
6
- const y = ({
7
- blurb: t,
8
- buttonText: i = "Sign Up",
1
+ import { jsxs as N, jsx as t } from "react/jsx-runtime";
2
+ import y from "../../node_modules/classnames/index.js";
3
+ import { px as s } from "../../utils/index.js";
4
+ import v from "../Input/Input.js";
5
+ import w from "../Button/Button.js";
6
+ import { SubscriptionState as j } from "./types.js";
7
+ const D = ({
8
+ blurb: o,
9
+ buttonText: a = "Sign Up",
9
10
  buttonProps: l,
10
- className: m,
11
- element: a = "form",
12
- id: r,
13
- inputLabelText: c = "Email*",
14
- inputPlaceholder: o = "example@email.com",
15
- title: b = "Subscribe to Newsletter",
16
- ...u
17
- }) => /* @__PURE__ */ n(
18
- a,
19
- {
20
- "data-testid": r || "subscribe-form",
21
- id: r,
22
- className: p(`${e}-subscribe`, m),
23
- ...u,
24
- children: [
25
- /* @__PURE__ */ s("h3", { className: `${e}-subscribe__title`, children: b }),
26
- t ? /* @__PURE__ */ s("p", { className: `${e}-subscribe__blurb`, children: t }) : null,
27
- /* @__PURE__ */ s(
28
- f,
29
- {
30
- className: `${e}-subscribe__input`,
31
- type: "email",
32
- placeholder: o,
33
- labelText: c
34
- }
35
- ),
36
- /* @__PURE__ */ s(_, { className: `${e}-subscribe__button ${m}`, buttonType: "secondary", type: "submit", ...l, children: i })
37
- ]
38
- }
39
- );
11
+ className: r,
12
+ element: c = "form",
13
+ id: i,
14
+ inputLabelText: m = "Email*",
15
+ inputPlaceholder: u = "example@email.com",
16
+ title: d = "Subscribe to Newsletter",
17
+ loadingText: b = "Loading...",
18
+ invalidText: n = "",
19
+ successText: p,
20
+ subscriptionState: e = j.Default,
21
+ ...f
22
+ }) => {
23
+ const x = e === "invalid", _ = e === "loading", h = e === "success", $ = e !== "default" ? {
24
+ invalid: n,
25
+ success: p,
26
+ loading: b
27
+ }[e] : "", g = h || _;
28
+ return /* @__PURE__ */ N(
29
+ c,
30
+ {
31
+ "data-testid": i || "subscribe-form",
32
+ id: i,
33
+ className: y(`${s}-subscribe`, r),
34
+ noValidate: !0,
35
+ ...f,
36
+ children: [
37
+ /* @__PURE__ */ t("h3", { className: `${s}-subscribe__title`, children: d }),
38
+ o ? /* @__PURE__ */ t("p", { className: `${s}-subscribe__blurb`, children: o }) : null,
39
+ /* @__PURE__ */ t(
40
+ v,
41
+ {
42
+ className: `${s}-subscribe__input`,
43
+ type: "email",
44
+ name: "email",
45
+ placeholder: u,
46
+ labelText: m,
47
+ invalid: x,
48
+ invalidText: n,
49
+ warn: g,
50
+ warnText: $,
51
+ required: !0
52
+ }
53
+ ),
54
+ /* @__PURE__ */ t(w, { className: `${s}-subscribe__button ${r}`, buttonType: "secondary", type: "submit", ...l, children: a })
55
+ ]
56
+ }
57
+ );
58
+ };
40
59
  export {
41
- y as default
60
+ D as default
42
61
  };
@@ -0,0 +1,6 @@
1
+ export declare enum SubscriptionState {
2
+ Default = "default",
3
+ Loading = "loading",
4
+ Invalid = "invalid",
5
+ Success = "success"
6
+ }
@@ -0,0 +1,4 @@
1
+ var l = /* @__PURE__ */ ((d) => (d.Default = "default", d.Loading = "loading", d.Invalid = "invalid", d.Success = "success", d))(l || {});
2
+ export {
3
+ l as SubscriptionState
4
+ };
@@ -26,12 +26,11 @@
26
26
  }
27
27
  }
28
28
 
29
- &__blurb,
30
- .#{$px}-input__input {
31
- margin-bottom: $spacing-md;
29
+ &__input__wrapper {
30
+ margin-top: $spacing-md;
32
31
  }
33
32
 
34
33
  &__button {
35
- margin: 0 0 $spacing-md;
34
+ margin: $spacing-md 0 $spacing-md;
36
35
  }
37
36
  }
@@ -73,4 +73,13 @@ interface NormalizedProps {
73
73
  export declare function useNormalizedInputProps({ disabled, id, invalid, invalidText, readOnly, type, warn, warnText, }: InputProps): NormalizedProps;
74
74
  export declare const defaultYear: number;
75
75
  export declare const generatePaddingClassName: (padding: PaddingTokens, side?: 'start' | 'end', direction?: 'vertical' | 'horizontal') => string;
76
+ /**
77
+ * Return true if the email is valid, false otherwise.
78
+ *
79
+ * true: some@some.com
80
+ *
81
+ * false: some@some, some@.com, some@some.
82
+
83
+ */
84
+ export declare const emailValidation: (email: string) => boolean;
76
85
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.20.0",
3
+ "version": "1.21.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"
@@ -33,7 +33,7 @@
33
33
  "clean": "rimraf './dist'",
34
34
  "clean:stories": "rimraf './storybook-static'",
35
35
  "format": "prettier . --write",
36
- "lint": "tsc && eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 && npm run lint:styles",
36
+ "lint": "tsc --noEmit && eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 && npm run lint:styles",
37
37
  "lint:styles": "stylelint \"src/**/*.scss\" --fix",
38
38
  "prepare": "husky install"
39
39
  },
@@ -42,19 +42,21 @@
42
42
  "flatpickr": "^4.6.13"
43
43
  },
44
44
  "devDependencies": {
45
+ "@chromatic-com/storybook": "^1.4.0",
45
46
  "@commitlint/cli": "^19.3.0",
46
47
  "@commitlint/config-conventional": "^19.2.2",
47
48
  "@figma/code-connect": "^0.1.2",
48
49
  "@semantic-release/changelog": "^6.0.3",
49
50
  "@semantic-release/git": "^10.0.1",
50
- "@semantic-release/github": "^10.0.3",
51
- "@storybook/addon-essentials": "^7.6.18",
52
- "@storybook/addon-interactions": "^7.6.19",
53
- "@storybook/addon-links": "^7.6.19",
54
- "@storybook/addon-styling": "^1.3.7",
55
- "@storybook/blocks": "^7.6.19",
56
- "@storybook/react": "^7.0.22",
57
- "@storybook/react-vite": "^7.6.19",
51
+ "@semantic-release/github": "^10.0.4",
52
+ "@storybook/addon-essentials": "^8.1.3",
53
+ "@storybook/addon-interactions": "^8.1.1",
54
+ "@storybook/addon-links": "^8.1.1",
55
+ "@storybook/addon-mdx-gfm": "^8.1.3",
56
+ "@storybook/blocks": "^8.1.1",
57
+ "@storybook/react": "^8.1.1",
58
+ "@storybook/react-vite": "^8.1.1",
59
+ "@storybook/theming": "^8.1.3",
58
60
  "@testing-library/jest-dom": "^6.4.5",
59
61
  "@testing-library/react": "^14.0.0",
60
62
  "@testing-library/user-event": "^14.5.2",
@@ -75,13 +77,13 @@
75
77
  "react": "^18.3.1",
76
78
  "react-docgen-typescript": "^2.2.2",
77
79
  "react-dom": "^18.2.0",
78
- "rimraf": "^5.0.5",
80
+ "rimraf": "^5.0.7",
79
81
  "rollup-plugin-copy": "^3.5.0",
80
82
  "rollup-plugin-peer-deps-external": "^2.2.4",
81
- "sass": "^1.77.0",
83
+ "sass": "^1.77.2",
82
84
  "semantic-release": "^23.1.1",
83
- "storybook": "^7.6.19",
84
- "stylelint": "^16.4.0",
85
+ "storybook": "^8.1.1",
86
+ "stylelint": "^16.5.0",
85
87
  "stylelint-config-standard": "^36.0.0",
86
88
  "stylelint-config-standard-scss": "^13.1.0",
87
89
  "stylelint-order": "^6.0.4",