@phillips/seldon 1.7.1 → 1.8.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/Button/Button.d.ts +13 -19
- package/dist/components/Button/Button.js +12 -18
- package/dist/components/Header/Header.js +15 -33
- package/dist/components/HeroBanner/HeroBanner.d.ts +6 -6
- package/dist/components/HeroBanner/HeroBanner.js +1 -9
- package/dist/components/Input/Input.js +59 -60
- package/dist/components/Select/Select.js +45 -48
- package/dist/components/ViewingsList/StatefulViewingsList.d.ts +27 -0
- package/dist/components/ViewingsList/StatefulViewingsList.js +33 -0
- package/dist/components/ViewingsList/ViewingsList.d.ts +60 -0
- package/dist/components/ViewingsList/ViewingsList.js +54 -0
- package/dist/components/ViewingsList/ViewingsListCard.d.ts +85 -0
- package/dist/components/ViewingsList/ViewingsListCard.js +162 -0
- package/dist/components/ViewingsList/ViewingsListCardForm.d.ts +131 -0
- package/dist/components/ViewingsList/ViewingsListCardForm.js +218 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +17 -13
- package/dist/scss/_reset.scss +20 -5
- package/dist/scss/_typography.scss +22 -12
- package/dist/scss/_utils.scss +2 -2
- package/dist/scss/_vars.scss +1 -4
- package/dist/scss/components/Button/_button.scss +48 -6
- package/dist/scss/components/DatePicker/_datePicker.scss +3 -4
- package/dist/scss/components/Header/_header.scss +1 -1
- package/dist/scss/components/HeroBanner/_heroBanner.scss +81 -81
- package/dist/scss/components/Input/_input.scss +17 -5
- package/dist/scss/components/Toggle/_toggle.scss +26 -13
- package/dist/scss/components/ViewingsList/_viewingsList.scss +55 -0
- package/dist/scss/pages/_page.scss +1 -1
- package/dist/scss/styles.scss +2 -1
- package/dist/utils/index.d.ts +11 -1
- package/dist/utils/index.js +1 -15
- package/package.json +7 -4
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import { CommonProps } from '../../utils';
|
|
2
|
+
export interface ButtonProps extends CommonProps, Record<string, unknown> {
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* Button contents
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
+
children: React.ReactNode;
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* True if button comes after text
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
+
iconLast?: boolean;
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* Optional click handler
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
+
onClick?: (e: React.MouseEvent<HTMLElement>) => void | unknown;
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* Is this the principal call to action on the page?
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Unique id for component
|
|
20
|
-
*/
|
|
21
|
-
id?: string;
|
|
18
|
+
buttonType?: 'primary' | 'secondary' | 'ghost';
|
|
22
19
|
/**
|
|
23
|
-
*
|
|
20
|
+
* How large should the button be?
|
|
24
21
|
*/
|
|
25
|
-
|
|
22
|
+
size?: 'sm' | 'md' | 'lg';
|
|
26
23
|
}
|
|
27
|
-
|
|
28
|
-
* Primary UI component for user interaction
|
|
29
|
-
*/
|
|
30
|
-
declare const Button: ({ primary, size, backgroundColor, children, id, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare const Button: ({ buttonType, size, children, iconLast, id, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
25
|
export default Button;
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { px as
|
|
4
|
-
const
|
|
5
|
-
primary: n = !0,
|
|
6
|
-
size: r = "md",
|
|
7
|
-
backgroundColor: s,
|
|
8
|
-
children: u,
|
|
9
|
-
id: t,
|
|
10
|
-
...e
|
|
11
|
-
}) => /* @__PURE__ */ a(
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import b from "../../node_modules/classnames/index.js";
|
|
3
|
+
import { px as t } from "../../utils/index.js";
|
|
4
|
+
const f = ({ buttonType: n = "primary", size: a = "md", children: r, iconLast: s = !1, id: o, ...u }) => /* @__PURE__ */ m(
|
|
12
5
|
"button",
|
|
13
6
|
{
|
|
14
|
-
"data-testid":
|
|
15
|
-
id:
|
|
7
|
+
"data-testid": o ? `button-${o}` : "button",
|
|
8
|
+
id: o,
|
|
16
9
|
type: "button",
|
|
17
|
-
className:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
className: b(`${t}-button`, `${t}-button--${a}`, `${t}-button--${n}`, {
|
|
11
|
+
[`${t}-button--icon-last`]: s
|
|
12
|
+
}),
|
|
13
|
+
...u,
|
|
14
|
+
children: r
|
|
21
15
|
}
|
|
22
16
|
);
|
|
23
17
|
export {
|
|
24
|
-
|
|
18
|
+
f as default
|
|
25
19
|
};
|
|
@@ -1,42 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as l, jsxs as e, Fragment as d } from "react/jsx-runtime";
|
|
2
2
|
import i from "../Button/Button.js";
|
|
3
|
-
const a = ({ user: n, onLogin:
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
/* @__PURE__ */
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
d: "M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z",
|
|
10
|
-
fill: "#FFF"
|
|
11
|
-
}
|
|
12
|
-
),
|
|
13
|
-
/* @__PURE__ */ e(
|
|
14
|
-
"path",
|
|
15
|
-
{
|
|
16
|
-
d: "M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z",
|
|
17
|
-
fill: "#555AB9"
|
|
18
|
-
}
|
|
19
|
-
),
|
|
20
|
-
/* @__PURE__ */ e(
|
|
21
|
-
"path",
|
|
22
|
-
{
|
|
23
|
-
d: "M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z",
|
|
24
|
-
fill: "#91BAF8"
|
|
25
|
-
}
|
|
26
|
-
)
|
|
3
|
+
const a = ({ user: n, onLogin: h, onLogout: r, onCreateAccount: c }) => /* @__PURE__ */ l("header", { children: /* @__PURE__ */ e("div", { className: "storybook-header", children: [
|
|
4
|
+
/* @__PURE__ */ e("div", { children: [
|
|
5
|
+
/* @__PURE__ */ l("svg", { width: "32", height: "32", viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ e("g", { fill: "none", fillRule: "evenodd", children: [
|
|
6
|
+
/* @__PURE__ */ l("path", { d: "M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z", fill: "#FFF" }),
|
|
7
|
+
/* @__PURE__ */ l("path", { d: "M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z", fill: "#555AB9" }),
|
|
8
|
+
/* @__PURE__ */ l("path", { d: "M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z", fill: "#91BAF8" })
|
|
27
9
|
] }) }),
|
|
28
|
-
/* @__PURE__ */
|
|
10
|
+
/* @__PURE__ */ l("h1", { children: "Acme" })
|
|
29
11
|
] }),
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
12
|
+
/* @__PURE__ */ l("div", { children: n ? /* @__PURE__ */ e(d, { children: [
|
|
13
|
+
/* @__PURE__ */ e("span", { className: "welcome", children: [
|
|
32
14
|
"Welcome, ",
|
|
33
|
-
/* @__PURE__ */
|
|
15
|
+
/* @__PURE__ */ l("b", { children: n.name }),
|
|
34
16
|
"!"
|
|
35
17
|
] }),
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
] }) : /* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
18
|
+
/* @__PURE__ */ l(i, { size: "sm", onClick: r, children: "Log out" })
|
|
19
|
+
] }) : /* @__PURE__ */ e(d, { children: [
|
|
20
|
+
/* @__PURE__ */ l(i, { size: "sm", onClick: h, children: "Log in" }),
|
|
21
|
+
/* @__PURE__ */ l(i, { size: "sm", onClick: c, children: "Sign up" })
|
|
40
22
|
] }) })
|
|
41
23
|
] }) });
|
|
42
24
|
export {
|
|
@@ -16,16 +16,16 @@ interface HeroBannerProps {
|
|
|
16
16
|
*/
|
|
17
17
|
subHeadText?: string;
|
|
18
18
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
* Is there an association related to this sale?
|
|
20
|
+
*/
|
|
21
21
|
association?: string;
|
|
22
22
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
* What background image or color to use
|
|
24
|
+
*/
|
|
25
25
|
background?: string;
|
|
26
26
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
* Unique id for component testing
|
|
28
|
+
*/
|
|
29
29
|
id?: string;
|
|
30
30
|
}
|
|
31
31
|
declare const HeroBanner: ({ prehead, date, headerText, subHeadText, association, background, id }: HeroBannerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { jsx as n, jsxs as s } from "react/jsx-runtime";
|
|
2
2
|
import { px as t } from "../../utils/index.js";
|
|
3
|
-
const r = `${t}-hero-banner`, m = ({
|
|
4
|
-
prehead: e,
|
|
5
|
-
date: l,
|
|
6
|
-
headerText: o,
|
|
7
|
-
subHeadText: c,
|
|
8
|
-
association: h,
|
|
9
|
-
background: p,
|
|
10
|
-
id: a
|
|
11
|
-
}) => /* @__PURE__ */ n(
|
|
3
|
+
const r = `${t}-hero-banner`, m = ({ prehead: e, date: l, headerText: o, subHeadText: c, association: h, background: p, id: a }) => /* @__PURE__ */ n(
|
|
12
4
|
"header",
|
|
13
5
|
{
|
|
14
6
|
"data-testid": a ? `hero-banner-${a}` : "hero-banner",
|
|
@@ -1,64 +1,63 @@
|
|
|
1
|
-
import { jsxs as P, jsx as
|
|
1
|
+
import { jsxs as P, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import * as R from "react";
|
|
3
|
-
import
|
|
4
|
-
import { px as
|
|
5
|
-
const z = R.forwardRef(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
[`${
|
|
32
|
-
[`${
|
|
33
|
-
[`${
|
|
34
|
-
[`${
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
});
|
|
3
|
+
import d from "../../node_modules/classnames/index.js";
|
|
4
|
+
import { px as i, useNormalizedInputProps as y } from "../../utils/index.js";
|
|
5
|
+
const z = R.forwardRef(
|
|
6
|
+
({
|
|
7
|
+
className: a,
|
|
8
|
+
defaultValue: r,
|
|
9
|
+
disabled: u,
|
|
10
|
+
hideLabel: o,
|
|
11
|
+
id: t,
|
|
12
|
+
inline: m,
|
|
13
|
+
invalid: $,
|
|
14
|
+
invalidText: c,
|
|
15
|
+
labelText: _,
|
|
16
|
+
onChange: b,
|
|
17
|
+
onClick: f,
|
|
18
|
+
placeholder: h,
|
|
19
|
+
readOnly: p,
|
|
20
|
+
size: w = "md",
|
|
21
|
+
type: s = "text",
|
|
22
|
+
value: x,
|
|
23
|
+
warn: v,
|
|
24
|
+
warnText: I,
|
|
25
|
+
...e
|
|
26
|
+
}, N) => {
|
|
27
|
+
const n = y({ disabled: u, id: t, invalid: $, invalidText: c, readOnly: p, type: s, warn: v, warnText: I }), j = d(`${i}-${s}-input`, `${i}-input`, `${i}-input--${w}`, {
|
|
28
|
+
[`${i}-input--inline`]: m,
|
|
29
|
+
[`${i}-input--readonly`]: p,
|
|
30
|
+
[`${i}-input--disabled`]: n.disabled,
|
|
31
|
+
[`${i}-input--invalid`]: n.invalid,
|
|
32
|
+
[`${i}-input--warn`]: n.warn,
|
|
33
|
+
[`${a}__wrapper`]: a,
|
|
34
|
+
[`${i}-input--hidden`]: e.hidden
|
|
35
|
+
});
|
|
36
|
+
return /* @__PURE__ */ P("div", { className: j, children: [
|
|
37
|
+
/* @__PURE__ */ l("label", { htmlFor: t, className: d(`${i}-input__label`, { [`${i}-input__label--hidden`]: o }), children: _ }),
|
|
38
|
+
/* @__PURE__ */ l(
|
|
39
|
+
"input",
|
|
40
|
+
{
|
|
41
|
+
className: d(`${i}-input__input`, { className: a }),
|
|
42
|
+
"data-testid": t,
|
|
43
|
+
defaultValue: r,
|
|
44
|
+
disabled: n.disabled,
|
|
45
|
+
id: t,
|
|
46
|
+
name: e.name,
|
|
47
|
+
onChange: b,
|
|
48
|
+
onClick: f,
|
|
49
|
+
placeholder: h,
|
|
50
|
+
readOnly: p,
|
|
51
|
+
ref: N,
|
|
52
|
+
type: n.type,
|
|
53
|
+
value: x,
|
|
54
|
+
...e
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
n.validation
|
|
58
|
+
] });
|
|
59
|
+
}
|
|
60
|
+
);
|
|
62
61
|
z.displayName = "Input";
|
|
63
62
|
export {
|
|
64
63
|
z as default
|
|
@@ -2,60 +2,57 @@ import { jsxs as R, jsx as l } from "react/jsx-runtime";
|
|
|
2
2
|
import * as y from "react";
|
|
3
3
|
import a from "../../node_modules/classnames/index.js";
|
|
4
4
|
import { px as t, useNormalizedInputProps as z } from "../../utils/index.js";
|
|
5
|
-
const S = y.forwardRef(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
`${t}-${s}-input`,
|
|
27
|
-
`${t}-input`,
|
|
28
|
-
`${t}-input--${w}`,
|
|
29
|
-
{
|
|
5
|
+
const S = y.forwardRef(
|
|
6
|
+
({
|
|
7
|
+
children: r,
|
|
8
|
+
className: n,
|
|
9
|
+
defaultValue: o,
|
|
10
|
+
disabled: d,
|
|
11
|
+
hideLabel: u,
|
|
12
|
+
id: e,
|
|
13
|
+
inline: m,
|
|
14
|
+
invalid: $,
|
|
15
|
+
invalidText: c,
|
|
16
|
+
labelText: _,
|
|
17
|
+
onChange: b,
|
|
18
|
+
onClick: f,
|
|
19
|
+
readOnly: p,
|
|
20
|
+
size: w = "md",
|
|
21
|
+
value: h,
|
|
22
|
+
warn: v,
|
|
23
|
+
warnText: x,
|
|
24
|
+
...j
|
|
25
|
+
}, N) => {
|
|
26
|
+
const s = "select", i = z({ disabled: d, id: e, invalid: $, invalidText: c, readOnly: p, type: s, warn: v, warnText: x }), P = a(`${t}-${s}-input`, `${t}-input`, `${t}-input--${w}`, {
|
|
30
27
|
[`${t}-input--inline`]: m,
|
|
31
28
|
[`${t}-input--readonly`]: p,
|
|
32
29
|
[`${t}-input--disabled`]: i.disabled,
|
|
33
30
|
[`${t}-input--invalid`]: i.invalid,
|
|
34
31
|
[`${t}-input--warn`]: i.warn,
|
|
35
32
|
[`${n}__wrapper`]: n
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
33
|
+
});
|
|
34
|
+
return /* @__PURE__ */ R("div", { className: P, children: [
|
|
35
|
+
/* @__PURE__ */ l("label", { htmlFor: e, className: a(`${t}-input__label`, { [`${t}-input__label--hidden`]: u }), children: _ }),
|
|
36
|
+
/* @__PURE__ */ l(
|
|
37
|
+
"select",
|
|
38
|
+
{
|
|
39
|
+
className: a(`${t}-input__input`, { className: n }),
|
|
40
|
+
"data-testid": e,
|
|
41
|
+
defaultValue: o,
|
|
42
|
+
disabled: i.disabled,
|
|
43
|
+
id: e,
|
|
44
|
+
onChange: b,
|
|
45
|
+
onClick: f,
|
|
46
|
+
ref: N,
|
|
47
|
+
value: h,
|
|
48
|
+
...j,
|
|
49
|
+
children: r
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
i.validation
|
|
53
|
+
] });
|
|
54
|
+
}
|
|
55
|
+
);
|
|
59
56
|
export {
|
|
60
57
|
S as default
|
|
61
58
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ViewingsListCardProps } from './ViewingsListCard';
|
|
3
|
+
import { I18nObject } from './ViewingsList';
|
|
4
|
+
export interface StatefulViewingsListProps extends Record<string, unknown> {
|
|
5
|
+
/**
|
|
6
|
+
* Existing viewings to populate the list
|
|
7
|
+
*/
|
|
8
|
+
defaultViewing?: ViewingsListCardProps[];
|
|
9
|
+
/**
|
|
10
|
+
* Optional strings to pass for the form and button labels
|
|
11
|
+
*/
|
|
12
|
+
i18n?: I18nObject;
|
|
13
|
+
/**
|
|
14
|
+
* Optional validations script to be ran when Viewing list is updated and saved
|
|
15
|
+
*/
|
|
16
|
+
validate?: ((e: ViewingsListCardProps) => object | undefined) | (() => object);
|
|
17
|
+
/**
|
|
18
|
+
* Method for removing a viewing from the list
|
|
19
|
+
*/
|
|
20
|
+
onDelete?: (id: string) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Method used to persist changes to a particular view
|
|
23
|
+
*/
|
|
24
|
+
onSave: (e: React.MouseEvent<HTMLElement>, cb: React.Dispatch<React.SetStateAction<ViewingsListCardProps[]>>, validateCb: (e: ViewingsListCardProps) => object | undefined) => boolean;
|
|
25
|
+
}
|
|
26
|
+
declare const StatefulViewingsList: ({ defaultViewing, i18n, validate, onDelete, onSave, ...props }: StatefulViewingsListProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export default StatefulViewingsList;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import * as u from "react";
|
|
3
|
+
import c from "./ViewingsList.js";
|
|
4
|
+
const S = ({
|
|
5
|
+
defaultViewing: o,
|
|
6
|
+
i18n: d,
|
|
7
|
+
validate: a = () => {
|
|
8
|
+
},
|
|
9
|
+
onDelete: l = () => {
|
|
10
|
+
},
|
|
11
|
+
onSave: s,
|
|
12
|
+
...r
|
|
13
|
+
}) => {
|
|
14
|
+
const [f, n] = u.useState(o);
|
|
15
|
+
return /* @__PURE__ */ m(
|
|
16
|
+
c,
|
|
17
|
+
{
|
|
18
|
+
...r,
|
|
19
|
+
i18n: d,
|
|
20
|
+
viewings: f,
|
|
21
|
+
onDelete: (t) => {
|
|
22
|
+
n((e) => e == null ? void 0 : e.filter((i) => i.id !== t)), l(t);
|
|
23
|
+
},
|
|
24
|
+
onAdd: (t) => {
|
|
25
|
+
n((e) => e ? [...e, { id: t }] : [{ id: t }]);
|
|
26
|
+
},
|
|
27
|
+
onSave: (t) => s(t, n, a)
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
S as default
|
|
33
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ViewingsListCardProps } from './ViewingsListCard';
|
|
3
|
+
export interface I18nObject {
|
|
4
|
+
address1Label?: string;
|
|
5
|
+
addressUrlLabel?: string;
|
|
6
|
+
address2Label?: string;
|
|
7
|
+
address3Label?: string;
|
|
8
|
+
addViewingsBtnLabel?: string;
|
|
9
|
+
cancelBtnLabel?: string;
|
|
10
|
+
deleteBtnLabel?: string;
|
|
11
|
+
editBtnLabel?: string;
|
|
12
|
+
enableOnSiteToggleLabel?: string;
|
|
13
|
+
locationLabel?: string;
|
|
14
|
+
previewDatesLabel?: string;
|
|
15
|
+
previewHours1Label?: string;
|
|
16
|
+
previewHours2Label?: string;
|
|
17
|
+
previewLabel?: string;
|
|
18
|
+
previewToggleLabel?: string;
|
|
19
|
+
saveBtnLabel?: string;
|
|
20
|
+
viewingLabel?: string;
|
|
21
|
+
viewingDatesLabel?: string;
|
|
22
|
+
viewingHours1Label?: string;
|
|
23
|
+
viewingHours2Label?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ViewingsListProps {
|
|
26
|
+
/**
|
|
27
|
+
* String for Viewing cards that gets nuber appended. EX: 'Title {x}`
|
|
28
|
+
*/
|
|
29
|
+
cardTitle?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Unique id for component
|
|
32
|
+
*/
|
|
33
|
+
id?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Optional strings to pass for the form and button labels
|
|
36
|
+
*/
|
|
37
|
+
i18n?: I18nObject;
|
|
38
|
+
/**
|
|
39
|
+
* Title for Viewings list
|
|
40
|
+
*/
|
|
41
|
+
title?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Array of viewings objects
|
|
44
|
+
*/
|
|
45
|
+
viewings?: ViewingsListCardProps[] | [];
|
|
46
|
+
/**
|
|
47
|
+
* Method for removing a viewing from the list
|
|
48
|
+
*/
|
|
49
|
+
onAdd?: (id: string) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Method for removing a viewing from the list
|
|
52
|
+
*/
|
|
53
|
+
onDelete?: (id: string) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Method used to persist changes to a particular view
|
|
56
|
+
*/
|
|
57
|
+
onSave: (e: React.MouseEvent<HTMLElement>) => boolean;
|
|
58
|
+
}
|
|
59
|
+
declare const ViewingsList: ({ cardTitle, id, i18n, onAdd, onDelete, onSave, title, viewings, }: ViewingsListProps) => import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
export default ViewingsList;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsxs as B, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import p from "../../node_modules/classnames/index.js";
|
|
4
|
+
import { px as $ } from "../../utils/index.js";
|
|
5
|
+
import M from "./ViewingsListCard.js";
|
|
6
|
+
import R from "../Button/Button.js";
|
|
7
|
+
const S = () => Math.floor(Math.random() * 100) + Date.now(), z = ({
|
|
8
|
+
cardTitle: O = "Viewing Details",
|
|
9
|
+
id: f,
|
|
10
|
+
i18n: r = {},
|
|
11
|
+
onAdd: m,
|
|
12
|
+
onDelete: e,
|
|
13
|
+
onSave: D,
|
|
14
|
+
title: x,
|
|
15
|
+
viewings: i
|
|
16
|
+
}) => {
|
|
17
|
+
const [a, h] = d.useState(i), [c, o] = d.useState(""), [s, u] = d.useState();
|
|
18
|
+
d.useEffect(() => {
|
|
19
|
+
h(i);
|
|
20
|
+
}, [i]);
|
|
21
|
+
const { addViewingsBtnLabel: C = "ADD VIEWINGS" } = r, E = () => {
|
|
22
|
+
const t = `${S()}${a ? "-" + a.length : ""}`;
|
|
23
|
+
o(t), u(t), m && m(t);
|
|
24
|
+
}, N = (t) => {
|
|
25
|
+
o(""), typeof e == "function" && e(t);
|
|
26
|
+
}, y = (t) => {
|
|
27
|
+
o(t), u(a == null ? void 0 : a.find((n) => n.id === t));
|
|
28
|
+
}, b = (t) => {
|
|
29
|
+
D(t) && o("");
|
|
30
|
+
}, j = () => {
|
|
31
|
+
typeof s == "string" ? typeof e == "function" && e(s) : c === (s == null ? void 0 : s.id) && h((t) => t == null ? void 0 : t.map((n) => n.id === s.id ? s : n)), o("");
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ B("div", { className: p(`${$}-viewings-list`), id: f, children: [
|
|
34
|
+
/* @__PURE__ */ l("h2", { className: p(`${$}-viewings-list__title`), children: x }),
|
|
35
|
+
a == null ? void 0 : a.map((t, n) => /* @__PURE__ */ l(
|
|
36
|
+
M,
|
|
37
|
+
{
|
|
38
|
+
...t,
|
|
39
|
+
...r,
|
|
40
|
+
cardTitle: t.location ? `${O} ${n + 1}` : void 0,
|
|
41
|
+
editState: c === t.id,
|
|
42
|
+
onCancel: j,
|
|
43
|
+
onDelete: N,
|
|
44
|
+
onEdit: () => y(t.id),
|
|
45
|
+
onSave: b
|
|
46
|
+
},
|
|
47
|
+
`${t.id}`
|
|
48
|
+
)),
|
|
49
|
+
/* @__PURE__ */ l(R, { id: `viewings-list-add-btn-${f || S()}`, size: "sm", onClick: E, children: C })
|
|
50
|
+
] }, c);
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
z as default
|
|
54
|
+
};
|