@phillips/seldon 1.35.0 → 1.36.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,14 +1,14 @@
|
|
|
1
1
|
import { jsxs as P, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import * as R from "react";
|
|
3
|
-
import
|
|
3
|
+
import t from "../../node_modules/classnames/index.js";
|
|
4
4
|
import { px as i, useNormalizedInputProps as y } from "../../utils/index.js";
|
|
5
5
|
const z = R.forwardRef(
|
|
6
6
|
({
|
|
7
|
-
className:
|
|
7
|
+
className: p,
|
|
8
8
|
defaultValue: r,
|
|
9
9
|
disabled: u,
|
|
10
10
|
hideLabel: o,
|
|
11
|
-
id:
|
|
11
|
+
id: a,
|
|
12
12
|
inline: m,
|
|
13
13
|
invalid: $,
|
|
14
14
|
invalidText: c,
|
|
@@ -16,45 +16,45 @@ const z = R.forwardRef(
|
|
|
16
16
|
onChange: b,
|
|
17
17
|
onClick: f,
|
|
18
18
|
placeholder: h,
|
|
19
|
-
readOnly:
|
|
20
|
-
size:
|
|
19
|
+
readOnly: e,
|
|
20
|
+
size: v = "md",
|
|
21
21
|
type: s = "text",
|
|
22
|
-
value:
|
|
23
|
-
warn:
|
|
24
|
-
warnText:
|
|
25
|
-
...
|
|
26
|
-
},
|
|
27
|
-
const n = y({ disabled: u, id:
|
|
22
|
+
value: w,
|
|
23
|
+
warn: x,
|
|
24
|
+
warnText: N,
|
|
25
|
+
...d
|
|
26
|
+
}, I) => {
|
|
27
|
+
const n = y({ disabled: u, id: a, invalid: $, invalidText: c, readOnly: e, type: s, warn: x, warnText: N }), j = t(`${i}-${s}-input`, `${i}-input`, `${i}-input--${v}`, {
|
|
28
28
|
[`${i}-input--inline`]: m,
|
|
29
|
-
[`${i}-input--readonly`]:
|
|
29
|
+
[`${i}-input--readonly`]: e,
|
|
30
30
|
[`${i}-input--disabled`]: n.disabled,
|
|
31
31
|
[`${i}-input--invalid`]: n.invalid,
|
|
32
32
|
[`${i}-input--warn`]: n.warn,
|
|
33
|
-
[`${
|
|
34
|
-
[`${i}-input--hidden`]:
|
|
33
|
+
[`${p}__wrapper`]: p,
|
|
34
|
+
[`${i}-input--hidden`]: d.hidden
|
|
35
35
|
});
|
|
36
36
|
return /* @__PURE__ */ P("div", { className: j, children: [
|
|
37
|
-
/* @__PURE__ */ l("label", { htmlFor:
|
|
37
|
+
/* @__PURE__ */ l("label", { htmlFor: a, className: t(`${i}-input__label`, { [`${i}-input__label--hidden`]: o }), children: _ }),
|
|
38
38
|
/* @__PURE__ */ l(
|
|
39
39
|
"input",
|
|
40
40
|
{
|
|
41
|
-
className:
|
|
42
|
-
"data-testid":
|
|
41
|
+
className: t(`${i}-input__input`, { className: p }),
|
|
42
|
+
"data-testid": a,
|
|
43
43
|
defaultValue: r,
|
|
44
44
|
disabled: n.disabled,
|
|
45
|
-
id:
|
|
46
|
-
name:
|
|
45
|
+
id: a,
|
|
46
|
+
name: d.name,
|
|
47
47
|
onChange: b,
|
|
48
48
|
onClick: f,
|
|
49
49
|
placeholder: h,
|
|
50
|
-
readOnly:
|
|
51
|
-
ref:
|
|
50
|
+
readOnly: e,
|
|
51
|
+
ref: I,
|
|
52
52
|
type: n.type,
|
|
53
|
-
value:
|
|
54
|
-
...
|
|
53
|
+
value: w,
|
|
54
|
+
...d
|
|
55
55
|
}
|
|
56
56
|
),
|
|
57
|
-
n.validation
|
|
57
|
+
n.validation ? n.validation : /* @__PURE__ */ l("p", { className: t(`${i}-input__validation`), children: " " })
|
|
58
58
|
] });
|
|
59
59
|
}
|
|
60
60
|
);
|
|
@@ -45,6 +45,10 @@ export interface SubscribeProps extends React.HTMLAttributes<HTMLFormElement> {
|
|
|
45
45
|
* Subscribe success text
|
|
46
46
|
*/
|
|
47
47
|
successText?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Subscribe privacy text
|
|
50
|
+
*/
|
|
51
|
+
privacyText?: string;
|
|
48
52
|
/**
|
|
49
53
|
* Subscribe state for loading or error
|
|
50
54
|
*/
|
|
@@ -59,5 +63,5 @@ export interface SubscribeProps extends React.HTMLAttributes<HTMLFormElement> {
|
|
|
59
63
|
*
|
|
60
64
|
* [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-subscribe--overview)
|
|
61
65
|
*/
|
|
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;
|
|
66
|
+
declare const Subscribe: ({ blurb, buttonText, buttonProps, className, element: Element, inputLabelText, inputPlaceholder, title, loadingText, invalidText, errorText, successText, privacyText, subscriptionState, ...props }: SubscribeProps) => import("react/jsx-runtime").JSX.Element;
|
|
63
67
|
export default Subscribe;
|
|
@@ -1,62 +1,65 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { getCommonProps as
|
|
4
|
-
import
|
|
1
|
+
import { jsxs as B, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import C from "../../node_modules/classnames/index.js";
|
|
3
|
+
import { getCommonProps as I } from "../../utils/index.js";
|
|
4
|
+
import L from "../Input/Input.js";
|
|
5
5
|
import S from "../Button/Button.js";
|
|
6
|
-
import { SubscriptionState as
|
|
6
|
+
import { SubscriptionState as o } from "./types.js";
|
|
7
7
|
import { ButtonVariants as T } from "../Button/types.js";
|
|
8
|
-
const
|
|
9
|
-
blurb:
|
|
10
|
-
buttonText:
|
|
11
|
-
buttonProps:
|
|
12
|
-
className:
|
|
13
|
-
element:
|
|
14
|
-
inputLabelText:
|
|
15
|
-
inputPlaceholder:
|
|
16
|
-
title:
|
|
17
|
-
loadingText:
|
|
18
|
-
invalidText:
|
|
19
|
-
errorText:
|
|
20
|
-
successText:
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
const z = ({
|
|
9
|
+
blurb: s,
|
|
10
|
+
buttonText: t = "Sign Up",
|
|
11
|
+
buttonProps: c,
|
|
12
|
+
className: a,
|
|
13
|
+
element: d = "form",
|
|
14
|
+
inputLabelText: u = "Enter Your Email Address To Sign Up*",
|
|
15
|
+
inputPlaceholder: p = "example@email.com",
|
|
16
|
+
title: f = "Never Miss A Moment",
|
|
17
|
+
loadingText: g = "Loading...",
|
|
18
|
+
invalidText: _ = "",
|
|
19
|
+
errorText: h = "An error occurred. Please try again.",
|
|
20
|
+
successText: v,
|
|
21
|
+
privacyText: i = "By signing up, you agree to receive email communications from Phillips.",
|
|
22
|
+
subscriptionState: e = o.Default,
|
|
23
|
+
...l
|
|
23
24
|
}) => {
|
|
24
|
-
const { className:
|
|
25
|
-
invalid:
|
|
26
|
-
success:
|
|
27
|
-
loading:
|
|
28
|
-
error:
|
|
29
|
-
},
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
|
|
25
|
+
const { className: r, ...x } = I(l, "Subscribe"), N = e === o.Invalid, y = e === o.Loading, $ = e === o.Success, b = e === o.Error, E = {
|
|
26
|
+
invalid: _,
|
|
27
|
+
success: v,
|
|
28
|
+
loading: g,
|
|
29
|
+
error: h
|
|
30
|
+
}, m = e !== o.Default ? E[e] : "", P = $ || y, A = N || b;
|
|
31
|
+
return /* @__PURE__ */ B(d, { ...x, className: C(r, a), noValidate: !0, ...l, children: [
|
|
32
|
+
/* @__PURE__ */ n("h3", { className: `${r}__title`, children: f }),
|
|
33
|
+
s ? /* @__PURE__ */ n("p", { className: `${r}__blurb`, children: s }) : null,
|
|
34
|
+
/* @__PURE__ */ n(
|
|
35
|
+
L,
|
|
35
36
|
{
|
|
36
|
-
className: `${
|
|
37
|
+
className: `${r}__input`,
|
|
37
38
|
type: "email",
|
|
38
39
|
name: "email",
|
|
39
|
-
placeholder:
|
|
40
|
-
labelText:
|
|
41
|
-
invalid:
|
|
42
|
-
invalidText:
|
|
43
|
-
warn:
|
|
44
|
-
warnText:
|
|
40
|
+
placeholder: p,
|
|
41
|
+
labelText: u,
|
|
42
|
+
invalid: A,
|
|
43
|
+
invalidText: m,
|
|
44
|
+
warn: P,
|
|
45
|
+
warnText: m,
|
|
45
46
|
required: !0
|
|
46
47
|
}
|
|
47
48
|
),
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ n(
|
|
49
50
|
S,
|
|
50
51
|
{
|
|
51
|
-
className: `${
|
|
52
|
+
className: `${r}__button ${a}`,
|
|
52
53
|
variant: T.secondary,
|
|
54
|
+
size: "sm",
|
|
53
55
|
type: "submit",
|
|
54
|
-
...
|
|
55
|
-
children:
|
|
56
|
+
...c,
|
|
57
|
+
children: t
|
|
56
58
|
}
|
|
57
|
-
)
|
|
59
|
+
),
|
|
60
|
+
i ? /* @__PURE__ */ n("p", { className: `${r}__privacy`, children: i }) : null
|
|
58
61
|
] });
|
|
59
62
|
};
|
|
60
63
|
export {
|
|
61
|
-
|
|
64
|
+
z as default
|
|
62
65
|
};
|
|
@@ -15,11 +15,10 @@ $lg: #{$px}-input--lg;
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
&__label {
|
|
18
|
-
color: $
|
|
19
|
-
font-size: 0.
|
|
18
|
+
color: $pure-black;
|
|
19
|
+
font-size: 0.75rem;
|
|
20
20
|
font-weight: 600;
|
|
21
21
|
margin-bottom: 0.5rem;
|
|
22
|
-
text-transform: uppercase;
|
|
23
22
|
word-break: break-word;
|
|
24
23
|
|
|
25
24
|
&--hidden {
|
|
@@ -105,6 +104,10 @@ $lg: #{$px}-input--lg;
|
|
|
105
104
|
&--invalid {
|
|
106
105
|
color: $error-red;
|
|
107
106
|
|
|
107
|
+
label {
|
|
108
|
+
color: $error-red;
|
|
109
|
+
}
|
|
110
|
+
|
|
108
111
|
.#{$px}-input__input,
|
|
109
112
|
.#{$px}-input__input::placeholder,
|
|
110
113
|
.#{$px}-input__validation {
|
|
@@ -127,7 +130,6 @@ $lg: #{$px}-input--lg;
|
|
|
127
130
|
.#{$px}-input__validation {
|
|
128
131
|
animation: reveal 0.45s linear forwards;
|
|
129
132
|
padding-bottom: 0.5rem;
|
|
130
|
-
padding-left: 2rem;
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
|
|
@@ -4,27 +4,19 @@
|
|
|
4
4
|
@import '../../typography';
|
|
5
5
|
|
|
6
6
|
.#{$px}-subscribe {
|
|
7
|
-
max-width:
|
|
7
|
+
max-width: 600px;
|
|
8
8
|
width: 100%;
|
|
9
9
|
|
|
10
10
|
&__title {
|
|
11
11
|
@include text($heading3);
|
|
12
12
|
|
|
13
13
|
margin-bottom: $spacing-xsm;
|
|
14
|
-
text-align: center;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
&__blurb {
|
|
18
17
|
@include text($body2);
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@include media($size-sm) {
|
|
24
|
-
&__title,
|
|
25
|
-
&__blurb {
|
|
26
|
-
text-align: left;
|
|
27
|
-
}
|
|
19
|
+
color: $pure-black;
|
|
28
20
|
}
|
|
29
21
|
|
|
30
22
|
&__input__wrapper {
|
|
@@ -32,6 +24,23 @@
|
|
|
32
24
|
}
|
|
33
25
|
|
|
34
26
|
&__button {
|
|
35
|
-
margin: $spacing-
|
|
27
|
+
margin: $spacing-sm 0 $spacing-md;
|
|
28
|
+
width: 100%;
|
|
29
|
+
|
|
30
|
+
@include media($size-sm) {
|
|
31
|
+
width: 240px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&__privacy {
|
|
36
|
+
@include text($body3);
|
|
37
|
+
|
|
38
|
+
color: $pure-black;
|
|
39
|
+
font-size: 0.75rem;
|
|
40
|
+
margin-top: $spacing-sm;
|
|
41
|
+
|
|
42
|
+
@include media($size-sm) {
|
|
43
|
+
margin-top: $spacing-xl;
|
|
44
|
+
}
|
|
36
45
|
}
|
|
37
46
|
}
|