@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.
- package/dist/components/Subscribe/Subscribe.d.ts +18 -1
- package/dist/components/Subscribe/Subscribe.js +58 -39
- package/dist/components/Subscribe/types.d.ts +6 -0
- package/dist/components/Subscribe/types.js +4 -0
- package/dist/scss/components/Subscribe/_subscribe.scss +3 -4
- package/dist/utils/index.d.ts +9 -0
- package/package.json +16 -14
|
@@ -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
|
|
2
|
-
import
|
|
3
|
-
import { px as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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:
|
|
11
|
-
element:
|
|
12
|
-
id:
|
|
13
|
-
inputLabelText:
|
|
14
|
-
inputPlaceholder:
|
|
15
|
-
title:
|
|
16
|
-
...
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
60
|
+
D as default
|
|
42
61
|
};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -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.
|
|
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.
|
|
51
|
-
"@storybook/addon-essentials": "^
|
|
52
|
-
"@storybook/addon-interactions": "^
|
|
53
|
-
"@storybook/addon-links": "^
|
|
54
|
-
"@storybook/addon-
|
|
55
|
-
"@storybook/blocks": "^
|
|
56
|
-
"@storybook/react": "^
|
|
57
|
-
"@storybook/react-vite": "^
|
|
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.
|
|
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.
|
|
83
|
+
"sass": "^1.77.2",
|
|
82
84
|
"semantic-release": "^23.1.1",
|
|
83
|
-
"storybook": "^
|
|
84
|
-
"stylelint": "^16.
|
|
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",
|