@phillips/seldon 1.7.2 → 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.
@@ -1,5 +1,5 @@
1
1
  import { CommonProps } from '../../utils';
2
- export interface ButtonProps extends CommonProps {
2
+ export interface ButtonProps extends CommonProps, Record<string, unknown> {
3
3
  /**
4
4
  * Button contents
5
5
  */
@@ -11,15 +11,15 @@ export interface ButtonProps extends CommonProps {
11
11
  /**
12
12
  * Optional click handler
13
13
  */
14
- onClick?: () => void;
14
+ onClick?: (e: React.MouseEvent<HTMLElement>) => void | unknown;
15
15
  /**
16
16
  * Is this the principal call to action on the page?
17
17
  */
18
- primary?: boolean;
18
+ buttonType?: 'primary' | 'secondary' | 'ghost';
19
19
  /**
20
20
  * How large should the button be?
21
21
  */
22
22
  size?: 'sm' | 'md' | 'lg';
23
23
  }
24
- declare const Button: ({ primary, size, children, iconLast, 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;
25
25
  export default Button;
@@ -1,20 +1,19 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import m from "../../node_modules/classnames/index.js";
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import b from "../../node_modules/classnames/index.js";
3
3
  import { px as t } from "../../utils/index.js";
4
- const c = ({ primary: n = !0, size: s = "md", children: u, iconLast: a = !1, id: o, ...r }) => /* @__PURE__ */ e(
4
+ const f = ({ buttonType: n = "primary", size: a = "md", children: r, iconLast: s = !1, id: o, ...u }) => /* @__PURE__ */ m(
5
5
  "button",
6
6
  {
7
7
  "data-testid": o ? `button-${o}` : "button",
8
8
  id: o,
9
9
  type: "button",
10
- className: m(`${t}-button`, `${t}-button--${s}`, {
11
- [`${t}-button--secondary`]: !n,
12
- [`${t}-button--icon-last`]: a
10
+ className: b(`${t}-button`, `${t}-button--${a}`, `${t}-button--${n}`, {
11
+ [`${t}-button--icon-last`]: s
13
12
  }),
14
- ...r,
15
- children: u
13
+ ...u,
14
+ children: r
16
15
  }
17
16
  );
18
17
  export {
19
- c as default
18
+ f as default
20
19
  };
@@ -1,24 +1,24 @@
1
- import { jsx as e, jsxs as l, Fragment as d } from "react/jsx-runtime";
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: r, onLogout: h, onCreateAccount: c }) => /* @__PURE__ */ e("header", { children: /* @__PURE__ */ l("div", { className: "storybook-header", children: [
4
- /* @__PURE__ */ l("div", { children: [
5
- /* @__PURE__ */ e("svg", { width: "32", height: "32", viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ l("g", { fill: "none", fillRule: "evenodd", children: [
6
- /* @__PURE__ */ e("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__ */ e("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__ */ e("path", { d: "M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z", fill: "#91BAF8" })
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" })
9
9
  ] }) }),
10
- /* @__PURE__ */ e("h1", { children: "Acme" })
10
+ /* @__PURE__ */ l("h1", { children: "Acme" })
11
11
  ] }),
12
- /* @__PURE__ */ e("div", { children: n ? /* @__PURE__ */ l(d, { children: [
13
- /* @__PURE__ */ l("span", { className: "welcome", children: [
12
+ /* @__PURE__ */ l("div", { children: n ? /* @__PURE__ */ e(d, { children: [
13
+ /* @__PURE__ */ e("span", { className: "welcome", children: [
14
14
  "Welcome, ",
15
- /* @__PURE__ */ e("b", { children: n.name }),
15
+ /* @__PURE__ */ l("b", { children: n.name }),
16
16
  "!"
17
17
  ] }),
18
- /* @__PURE__ */ e(i, { size: "sm", onClick: h, children: "Log out" })
19
- ] }) : /* @__PURE__ */ l(d, { children: [
20
- /* @__PURE__ */ e(i, { size: "sm", onClick: r, children: "Log in" }),
21
- /* @__PURE__ */ e(i, { primary: !0, size: "sm", onClick: c, children: "Sign up" })
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" })
22
22
  ] }) })
23
23
  ] }) });
24
24
  export {
@@ -1,58 +1,60 @@
1
- import { jsxs as P, jsx as r } from "react/jsx-runtime";
1
+ import { jsxs as P, jsx as l } from "react/jsx-runtime";
2
2
  import * as R from "react";
3
- import e from "../../node_modules/classnames/index.js";
4
- import { px as t, useNormalizedInputProps as y } from "../../utils/index.js";
3
+ import d from "../../node_modules/classnames/index.js";
4
+ import { px as i, useNormalizedInputProps as y } from "../../utils/index.js";
5
5
  const z = R.forwardRef(
6
6
  ({
7
- className: p,
8
- defaultValue: l,
7
+ className: a,
8
+ defaultValue: r,
9
9
  disabled: u,
10
- hideLabel: d,
11
- id: n,
12
- inline: o,
13
- invalid: m,
14
- invalidText: $,
15
- labelText: c,
16
- onChange: _,
17
- onClick: b,
18
- placeholder: f,
19
- readOnly: a,
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
20
  size: w = "md",
21
21
  type: s = "text",
22
22
  value: x,
23
- warn: h,
24
- warnText: v,
25
- ...I
23
+ warn: v,
24
+ warnText: I,
25
+ ...e
26
26
  }, N) => {
27
- const i = y({ disabled: u, id: n, invalid: m, invalidText: $, readOnly: a, type: s, warn: h, warnText: v }), j = e(`${t}-${s}-input`, `${t}-input`, `${t}-input--${w}`, {
28
- [`${t}-input--inline`]: o,
29
- [`${t}-input--readonly`]: a,
30
- [`${t}-input--disabled`]: i.disabled,
31
- [`${t}-input--invalid`]: i.invalid,
32
- [`${t}-input--warn`]: i.warn,
33
- [`${p}__wrapper`]: p
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
34
35
  });
35
36
  return /* @__PURE__ */ P("div", { className: j, children: [
36
- /* @__PURE__ */ r("label", { htmlFor: n, className: e(`${t}-input__label`, { [`${t}-input__label--hidden`]: d }), children: c }),
37
- /* @__PURE__ */ r(
37
+ /* @__PURE__ */ l("label", { htmlFor: t, className: d(`${i}-input__label`, { [`${i}-input__label--hidden`]: o }), children: _ }),
38
+ /* @__PURE__ */ l(
38
39
  "input",
39
40
  {
40
- className: e(`${t}-input__input`, { className: p }),
41
- "data-testid": n,
42
- defaultValue: l,
43
- disabled: i.disabled,
44
- id: n,
45
- onChange: _,
46
- onClick: b,
47
- placeholder: f,
48
- readOnly: a,
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,
49
51
  ref: N,
50
- type: i.type,
52
+ type: n.type,
51
53
  value: x,
52
- ...I
54
+ ...e
53
55
  }
54
56
  ),
55
- i.validation
57
+ n.validation
56
58
  ] });
57
59
  }
58
60
  );
@@ -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
+ };
@@ -0,0 +1,85 @@
1
+ import * as React from 'react';
2
+ import { ViewingsListCardFormProps } from './ViewingsListCardForm';
3
+ export interface ViewingsListCardProps extends ViewingsListCardFormProps, Record<string, unknown> {
4
+ /**
5
+ * Title of card
6
+ */
7
+ cardTitle?: string;
8
+ /**
9
+ * Optional string to pass for cancel button
10
+ */
11
+ cancelBtnLabel?: string;
12
+ /**
13
+ * Optional string to pass for delete button
14
+ */
15
+ deleteBtnLabel?: string;
16
+ /**
17
+ * Optional string to pass for edit button
18
+ */
19
+ editBtnLabel?: string;
20
+ /**
21
+ * Location of viewing
22
+ */
23
+ editState?: boolean;
24
+ /**
25
+ * Default boolean to determine whether viewing is enabled on site
26
+ */
27
+ enableOnSite?: string;
28
+ /**
29
+ * Label for enable on site toggle
30
+ */
31
+ enableOnSiteToggleLabel?: string;
32
+ /**
33
+ * Location of viewing
34
+ */
35
+ location?: string;
36
+ /**
37
+ * Location of viewing
38
+ */
39
+ locationLabel?: string;
40
+ /**
41
+ * Unique id for component
42
+ */
43
+ id: string;
44
+ /**
45
+ * Validation error message object
46
+ */
47
+ invalidFields?: {
48
+ address1?: string | undefined;
49
+ address1Url?: string | undefined;
50
+ address2?: string | undefined;
51
+ address3?: string | undefined;
52
+ location?: string | undefined;
53
+ previewDates?: string | undefined;
54
+ previewHours1?: string | undefined;
55
+ previewHours2?: string | undefined;
56
+ previewLabelValue?: string | undefined;
57
+ previewOn?: string | undefined;
58
+ viewingLabelValue?: string | undefined;
59
+ viewingDates?: string | undefined;
60
+ viewingHours1?: string | undefined;
61
+ viewingHours2?: string | undefined;
62
+ };
63
+ /**
64
+ * Callback for when Viewings edits are cancelled
65
+ */
66
+ onCancel?: () => void | unknown;
67
+ /**
68
+ * Callback for when Viewings item is deleted
69
+ */
70
+ onDelete?: (id: string) => void | unknown;
71
+ /**
72
+ * Callback for when Viewings item is placed in an editable mode
73
+ */
74
+ onEdit?: () => void | unknown;
75
+ /**
76
+ * Callback for when form is saved/submitted
77
+ */
78
+ onSave?: (e: React.MouseEvent<HTMLElement>) => void | unknown;
79
+ /**
80
+ * Optional string to pass for edit button
81
+ */
82
+ saveBtnLabel?: string;
83
+ }
84
+ declare const ViewingsListCard: ({ address1, address1Label, addressUrl, addressUrlLabel, address2, address2Label, address3, address3Label, cancelBtnLabel, cardTitle, deleteBtnLabel, editBtnLabel, editState, enableOnSite, enableOnSiteToggleLabel, id, invalidFields, location, locationLabel, onCancel, onEdit, onDelete, onSave, previewDates, previewDatesLabel, previewHours1, previewHours1Label, previewHours2, previewHours2Label, previewLabel, previewLabelValue, previewOn, previewToggleLabel, saveBtnLabel, viewingLabel, viewingLabelValue, viewingDates, viewingDatesLabel, viewingHours1, viewingHours1Label, viewingHours2, viewingHours2Label, }: ViewingsListCardProps) => import("react/jsx-runtime").JSX.Element;
85
+ export default ViewingsListCard;
@@ -0,0 +1,162 @@
1
+ import { jsxs as a, jsx as t, Fragment as y } from "react/jsx-runtime";
2
+ import * as r from "react";
3
+ import st from "../../node_modules/classnames/index.js";
4
+ import { px as $ } from "../../utils/index.js";
5
+ import g from "../Input/Input.js";
6
+ import u from "../Button/Button.js";
7
+ import ct from "./ViewingsListCardForm.js";
8
+ const l = `${$}-viewings-list-card`, ft = ({
9
+ address1: C,
10
+ address1Label: E,
11
+ addressUrl: T,
12
+ addressUrlLabel: O,
13
+ address2: w,
14
+ address2Label: d,
15
+ address3: x,
16
+ address3Label: z,
17
+ cancelBtnLabel: L = "CANCEL",
18
+ cardTitle: _ = "Add New Viewing",
19
+ deleteBtnLabel: k = "DELETE",
20
+ editBtnLabel: N = "EDIT",
21
+ editState: o,
22
+ enableOnSite: i = "false",
23
+ enableOnSiteToggleLabel: V = "Enabled on website",
24
+ id: e,
25
+ invalidFields: n,
26
+ location: A,
27
+ locationLabel: I = "Location",
28
+ onCancel: p,
29
+ onEdit: f,
30
+ onDelete: m,
31
+ onSave: h,
32
+ previewDates: S,
33
+ previewDatesLabel: v,
34
+ previewHours1: j,
35
+ previewHours1Label: D,
36
+ previewHours2: R,
37
+ previewHours2Label: q,
38
+ previewLabel: B,
39
+ previewLabelValue: G,
40
+ previewOn: H,
41
+ previewToggleLabel: J,
42
+ saveBtnLabel: K = "SAVE DETAILS",
43
+ viewingLabel: M,
44
+ viewingLabelValue: P,
45
+ viewingDates: Q,
46
+ viewingDatesLabel: U,
47
+ viewingHours1: W,
48
+ viewingHours1Label: X,
49
+ viewingHours2: Y,
50
+ viewingHours2Label: Z
51
+ }) => {
52
+ const [F, tt] = r.useState(i === "true"), c = r.useRef(null);
53
+ r.useEffect(() => {
54
+ o && c.current && c.current.focus();
55
+ }, [o]), r.useEffect(() => {
56
+ var s, b;
57
+ n && c.current && ((b = (s = c.current.closest(".phillips-viewings-list-card")) == null ? void 0 : s.querySelector(".phillips-input--invalid input")) == null || b.focus());
58
+ }, [n]);
59
+ const et = () => {
60
+ typeof p == "function" && p();
61
+ }, nt = () => {
62
+ typeof f == "function" && f();
63
+ }, ot = (s) => {
64
+ typeof h == "function" && h(s);
65
+ };
66
+ return /* @__PURE__ */ a(
67
+ "section",
68
+ {
69
+ "data-testid": `viewings-list-card-${e}`,
70
+ id: e,
71
+ className: st(`${l}`, { [`${l}--edit-state`]: o }),
72
+ children: [
73
+ /* @__PURE__ */ t("h3", { className: `${l}__title`, children: _ }),
74
+ /* @__PURE__ */ t("input", { type: "hidden", name: "id", value: e }),
75
+ /* @__PURE__ */ t(
76
+ g,
77
+ {
78
+ ref: c,
79
+ id: `location-${e}`,
80
+ defaultValue: A,
81
+ labelText: I,
82
+ size: "sm",
83
+ name: "location",
84
+ invalid: n == null ? void 0 : n.location,
85
+ invalidText: n == null ? void 0 : n.location,
86
+ readOnly: !o
87
+ }
88
+ ),
89
+ o ? /* @__PURE__ */ t(
90
+ ct,
91
+ {
92
+ address1: C,
93
+ address1Label: E,
94
+ addressUrl: T,
95
+ addressUrlLabel: O,
96
+ address2: w,
97
+ address2Label: d,
98
+ address3: x,
99
+ address3Label: z,
100
+ id: e,
101
+ invalidFields: n,
102
+ previewDates: S,
103
+ previewDatesLabel: v,
104
+ previewHours1: j,
105
+ previewHours1Label: D,
106
+ previewHours2: R,
107
+ previewHours2Label: q,
108
+ previewLabel: B,
109
+ previewLabelValue: G,
110
+ previewOn: H,
111
+ previewToggleLabel: J,
112
+ viewingLabel: M,
113
+ viewingLabelValue: P,
114
+ viewingDates: Q,
115
+ viewingDatesLabel: U,
116
+ viewingHours1: W,
117
+ viewingHours1Label: X,
118
+ viewingHours2: Y,
119
+ viewingHours2Label: Z
120
+ }
121
+ ) : null,
122
+ /* @__PURE__ */ t(
123
+ g,
124
+ {
125
+ id: `enableOnSite-${e}`,
126
+ type: "toggle",
127
+ defaultChecked: i === "true",
128
+ labelText: V,
129
+ size: "md",
130
+ inline: !0,
131
+ value: "true",
132
+ name: "enableOnSite",
133
+ onChange: () => tt((s) => !s),
134
+ readOnly: !o
135
+ }
136
+ ),
137
+ F ? null : /* @__PURE__ */ t("input", { type: "hidden", name: "enableOnSite", value: "false" }),
138
+ /* @__PURE__ */ t("hr", {}),
139
+ /* @__PURE__ */ t("div", { className: `${l}__btn-group ${$}-button__group`, children: o ? /* @__PURE__ */ a(y, { children: [
140
+ /* @__PURE__ */ t(u, { id: `vlc-save-btn-${e}`, buttonType: "ghost", type: "submit", size: "sm", onClick: ot, children: K }),
141
+ /* @__PURE__ */ t(u, { id: `vlc-cancel-btn-${e}`, buttonType: "ghost", type: "button", size: "sm", onClick: et, children: L })
142
+ ] }) : /* @__PURE__ */ a(y, { children: [
143
+ /* @__PURE__ */ t(u, { id: `vlc-edit-btn-${e}`, buttonType: "ghost", type: "button", size: "sm", onClick: nt, children: N }),
144
+ /* @__PURE__ */ t(
145
+ u,
146
+ {
147
+ id: `vlc-delete-btn-${e}`,
148
+ buttonType: "ghost",
149
+ type: "button",
150
+ size: "sm",
151
+ onClick: () => typeof m == "function" && m(e),
152
+ children: k
153
+ }
154
+ )
155
+ ] }) })
156
+ ]
157
+ }
158
+ );
159
+ };
160
+ export {
161
+ ft as default
162
+ };
@@ -0,0 +1,131 @@
1
+ export interface ViewingsListCardFormProps {
2
+ /**
3
+ * Address1 of viewing
4
+ */
5
+ address1?: string;
6
+ /**
7
+ * Label for address1 input
8
+ */
9
+ address1Label?: string;
10
+ /**
11
+ * URL for a map link to address1
12
+ */
13
+ addressUrl?: string;
14
+ /**
15
+ * Label for address1 url input
16
+ */
17
+ addressUrlLabel?: string;
18
+ /**
19
+ * Address2 of viewing
20
+ */
21
+ address2?: string;
22
+ /**
23
+ * Label for address2 input
24
+ */
25
+ address2Label?: string;
26
+ /**
27
+ * Address3 of viewing
28
+ */
29
+ address3?: string;
30
+ /**
31
+ * Label for address3 input
32
+ */
33
+ address3Label?: string;
34
+ /**
35
+ * Unique id for ViewingListCard component
36
+ */
37
+ id: string;
38
+ /**
39
+ * Validation error message object
40
+ */
41
+ invalidFields?: {
42
+ address1?: string | undefined;
43
+ addressUrl?: string | undefined;
44
+ address2?: string | undefined;
45
+ address3?: string | undefined;
46
+ location?: string | undefined;
47
+ previewDates?: string | undefined;
48
+ previewHours1?: string | undefined;
49
+ previewHours2?: string | undefined;
50
+ previewLabelValue?: string | undefined;
51
+ previewOn?: string | undefined;
52
+ viewingLabelValue?: string | undefined;
53
+ viewingDates?: string | undefined;
54
+ viewingHours1?: string | undefined;
55
+ viewingHours2?: string | undefined;
56
+ };
57
+ /**
58
+ * Label for preview label input
59
+ */
60
+ previewLabel?: string;
61
+ /**
62
+ * Value for preview label input
63
+ */
64
+ previewLabelValue?: string;
65
+ /**
66
+ * How large should the button be?
67
+ */
68
+ previewDates?: string;
69
+ /**
70
+ * Label for preview date input
71
+ */
72
+ previewDatesLabel?: string;
73
+ /**
74
+ * Default value for preview hours input
75
+ */
76
+ previewHours1?: string;
77
+ /**
78
+ * Label for preview Hours1 input
79
+ */
80
+ previewHours1Label?: string;
81
+ /**
82
+ * Default value for preview hours 2 input
83
+ */
84
+ previewHours2?: string;
85
+ /**
86
+ * Label for preview Hours1 input
87
+ */
88
+ previewHours2Label?: string;
89
+ /**
90
+ * How large should the button be?
91
+ */
92
+ previewOn?: string;
93
+ /**
94
+ * Label for preview sectioin toggle
95
+ */
96
+ previewToggleLabel?: string;
97
+ /**
98
+ * Label for viewing label input
99
+ */
100
+ viewingLabel?: string;
101
+ /**
102
+ * Value for viewing label input
103
+ */
104
+ viewingLabelValue?: string;
105
+ /**
106
+ * How large should the button be?
107
+ */
108
+ viewingDates?: string;
109
+ /**
110
+ * Label for viewing date input
111
+ */
112
+ viewingDatesLabel?: string;
113
+ /**
114
+ * Default value for viewing hours input
115
+ */
116
+ viewingHours1?: string;
117
+ /**
118
+ * Label for viewing Hours1 input
119
+ */
120
+ viewingHours1Label?: string;
121
+ /**
122
+ * Default value for viewing hours 2 input
123
+ */
124
+ viewingHours2?: string;
125
+ /**
126
+ * Label for viewing Hours1 input
127
+ */
128
+ viewingHours2Label?: string;
129
+ }
130
+ declare const ViewingsListCardForm: ({ address1, address1Label, addressUrl, addressUrlLabel, address2, address2Label, address3, address3Label, id, invalidFields, previewDates, previewDatesLabel, previewHours1, previewHours1Label, previewHours2, previewHours2Label, previewLabel, previewLabelValue, previewOn, previewToggleLabel, viewingLabel, viewingLabelValue, viewingDates, viewingDatesLabel, viewingHours1, viewingHours1Label, viewingHours2, viewingHours2Label, }: ViewingsListCardFormProps) => import("react/jsx-runtime").JSX.Element;
131
+ export default ViewingsListCardForm;
@@ -0,0 +1,218 @@
1
+ import { jsxs as p, Fragment as Y, jsx as t } from "react/jsx-runtime";
2
+ import Z from "../../node_modules/classnames/index.js";
3
+ import * as x from "react";
4
+ import { px as q } from "../../utils/index.js";
5
+ import u from "../Input/Input.js";
6
+ const T = `${q}-viewings-list-card-form`, M = ({
7
+ address1: b,
8
+ address1Label: f = "Address ('432 Park Ave', ETC)",
9
+ addressUrl: g,
10
+ addressUrlLabel: H = "URL for map link ('http://www.website.com')",
11
+ address2: V,
12
+ address2Label: a = "City, State, Zip ('New York, NY 10019')",
13
+ address3: $,
14
+ address3Label: c = "Country (United States)",
15
+ id: r,
16
+ invalidFields: e,
17
+ previewDates: z,
18
+ previewDatesLabel: h = "Date(s)",
19
+ previewHours1: L,
20
+ previewHours1Label: D = "Hours1",
21
+ previewHours2: C,
22
+ previewHours2Label: O = "Hours2",
23
+ previewLabel: U = "Label ('Preview', 'Opening NIght', etc)",
24
+ previewLabelValue: y,
25
+ previewOn: m = "false",
26
+ previewToggleLabel: S = "Preview/ Reception",
27
+ viewingLabel: k = "Label ('Open to public')",
28
+ viewingLabelValue: N,
29
+ viewingDates: P,
30
+ viewingDatesLabel: _ = "Date(s)",
31
+ viewingHours1: R,
32
+ viewingHours1Label: j = "Hours1",
33
+ viewingHours2: A,
34
+ viewingHours2Label: E = "Hours2"
35
+ }) => {
36
+ const [w, o] = x.useState(m === "true");
37
+ return x.useEffect(() => {
38
+ o(m === "true");
39
+ }, [m]), /* @__PURE__ */ p(Y, { children: [
40
+ /* @__PURE__ */ t(
41
+ u,
42
+ {
43
+ id: `previewOn-${r}`,
44
+ type: "toggle",
45
+ labelText: S,
46
+ size: "md",
47
+ defaultChecked: w,
48
+ inline: !0,
49
+ invalid: e == null ? void 0 : e.previewOn,
50
+ invalidText: e == null ? void 0 : e.previewOn,
51
+ value: !0,
52
+ name: "previewOn",
53
+ onChange: () => o((I) => !I)
54
+ }
55
+ ),
56
+ w ? null : /* @__PURE__ */ t("input", { type: "hidden", name: "previewOn", value: "false" }),
57
+ /* @__PURE__ */ p(
58
+ "div",
59
+ {
60
+ className: Z(`${T}__preview-set`, { [`${T}__preview-set--hidden`]: !w }),
61
+ children: [
62
+ /* @__PURE__ */ t(
63
+ u,
64
+ {
65
+ id: `previewLabel-${r}`,
66
+ name: "previewLabelValue",
67
+ defaultValue: y,
68
+ labelText: U,
69
+ size: "sm",
70
+ invalid: e == null ? void 0 : e.previewLabelValue,
71
+ invalidText: e == null ? void 0 : e.previewLabelValue,
72
+ hidden: !w
73
+ }
74
+ ),
75
+ /* @__PURE__ */ t(
76
+ u,
77
+ {
78
+ id: `previewDates-${r}`,
79
+ name: "previewDates",
80
+ defaultValue: z,
81
+ labelText: h,
82
+ size: "sm",
83
+ invalid: e == null ? void 0 : e.previewDates,
84
+ invalidText: e == null ? void 0 : e.previewDates,
85
+ hidden: !w
86
+ }
87
+ ),
88
+ /* @__PURE__ */ t(
89
+ u,
90
+ {
91
+ id: `previewHours1-${r}`,
92
+ name: "previewHours1",
93
+ defaultValue: L,
94
+ labelText: D,
95
+ size: "sm",
96
+ invalid: e == null ? void 0 : e.previewHours1,
97
+ invalidText: e == null ? void 0 : e.previewHours1,
98
+ hidden: !w
99
+ }
100
+ ),
101
+ /* @__PURE__ */ t(
102
+ u,
103
+ {
104
+ id: `previewHours2-${r}`,
105
+ name: "previewHours2",
106
+ defaultValue: C,
107
+ labelText: O,
108
+ size: "sm",
109
+ invalid: e == null ? void 0 : e.previewHours2,
110
+ invalidText: e == null ? void 0 : e.previewHours2,
111
+ hidden: !w
112
+ }
113
+ )
114
+ ]
115
+ }
116
+ ),
117
+ /* @__PURE__ */ t(
118
+ u,
119
+ {
120
+ id: `viewingLabel-${r}`,
121
+ name: "viewingLabelValue",
122
+ defaultValue: N,
123
+ labelText: k,
124
+ size: "sm",
125
+ invalid: e == null ? void 0 : e.viewingLabelValue,
126
+ invalidText: e == null ? void 0 : e.viewingLabelValue
127
+ }
128
+ ),
129
+ /* @__PURE__ */ t(
130
+ u,
131
+ {
132
+ id: `viewingDates-${r}`,
133
+ name: "viewingDates",
134
+ defaultValue: P,
135
+ labelText: _,
136
+ size: "sm",
137
+ invalid: e == null ? void 0 : e.viewingDates,
138
+ invalidText: e == null ? void 0 : e.viewingDates
139
+ }
140
+ ),
141
+ /* @__PURE__ */ t(
142
+ u,
143
+ {
144
+ id: `viewingHours1-${r}`,
145
+ name: "viewingHours1",
146
+ defaultValue: R,
147
+ labelText: j,
148
+ size: "sm",
149
+ invalid: e == null ? void 0 : e.viewingHours1,
150
+ invalidText: e == null ? void 0 : e.viewingHours1
151
+ }
152
+ ),
153
+ /* @__PURE__ */ t(
154
+ u,
155
+ {
156
+ id: `viewingHours2-${r}`,
157
+ name: "viewingHours2",
158
+ defaultValue: A,
159
+ labelText: E,
160
+ size: "sm",
161
+ invalid: e == null ? void 0 : e.viewingHours2,
162
+ invalidText: e == null ? void 0 : e.viewingHours2
163
+ }
164
+ ),
165
+ /* @__PURE__ */ t(
166
+ u,
167
+ {
168
+ id: `address1-${r}`,
169
+ name: "address1",
170
+ defaultValue: b,
171
+ labelText: f,
172
+ size: "sm",
173
+ invalid: e == null ? void 0 : e.address1,
174
+ invalidText: e == null ? void 0 : e.address1
175
+ }
176
+ ),
177
+ /* @__PURE__ */ t(
178
+ u,
179
+ {
180
+ id: `address2-${r}`,
181
+ name: "address2",
182
+ defaultValue: V,
183
+ labelText: a,
184
+ size: "sm",
185
+ invalid: e == null ? void 0 : e.address2,
186
+ invalidText: e == null ? void 0 : e.address2
187
+ }
188
+ ),
189
+ /* @__PURE__ */ t(
190
+ u,
191
+ {
192
+ id: `address3-${r}`,
193
+ name: "address3",
194
+ defaultValue: $,
195
+ labelText: c,
196
+ size: "sm",
197
+ invalid: e == null ? void 0 : e.address3,
198
+ invalidText: e == null ? void 0 : e.address3
199
+ }
200
+ ),
201
+ /* @__PURE__ */ t(
202
+ u,
203
+ {
204
+ id: `addressUrl-${r}`,
205
+ name: "addressUrl",
206
+ defaultValue: g,
207
+ labelText: H,
208
+ size: "sm",
209
+ type: "url",
210
+ invalid: e == null ? void 0 : e.addressUrl,
211
+ invalidText: e == null ? void 0 : e.addressUrl
212
+ }
213
+ )
214
+ ] });
215
+ };
216
+ export {
217
+ M as default
218
+ };
package/dist/index.d.ts CHANGED
@@ -4,4 +4,6 @@ export { default as Header } from './components/Header/Header';
4
4
  export { default as HeroBanner } from './components/HeroBanner/HeroBanner';
5
5
  export { default as Input } from './components/Input/Input';
6
6
  export { default as Select } from './components/Select/Select';
7
+ export { default as ViewingsList } from './components/ViewingsList/ViewingsList';
8
+ export { default as StatefulViewingsList } from './components/ViewingsList/StatefulViewingsList';
7
9
  export { default as Page } from './pages/Page';
package/dist/index.js CHANGED
@@ -1,16 +1,20 @@
1
- import { default as a } from "./components/Button/Button.js";
2
- import { default as t } from "./components/ErrorBoundary/ErrorBoundary.js";
3
- import { default as u } from "./components/Header/Header.js";
4
- import { default as l } from "./components/HeroBanner/HeroBanner.js";
5
- import { default as m } from "./components/Input/Input.js";
1
+ import { default as r } from "./components/Button/Button.js";
2
+ import { default as o } from "./components/ErrorBoundary/ErrorBoundary.js";
3
+ import { default as s } from "./components/Header/Header.js";
4
+ import { default as d } from "./components/HeroBanner/HeroBanner.js";
5
+ import { default as p } from "./components/Input/Input.js";
6
6
  import { default as x } from "./components/Select/Select.js";
7
- import { default as B } from "./pages/Page.js";
7
+ import { default as i } from "./components/ViewingsList/ViewingsList.js";
8
+ import { default as B } from "./components/ViewingsList/StatefulViewingsList.js";
9
+ import { default as H } from "./pages/Page.js";
8
10
  export {
9
- a as Button,
10
- t as ErrorBoundary,
11
- u as Header,
12
- l as HeroBanner,
13
- m as Input,
14
- B as Page,
15
- x as Select
11
+ r as Button,
12
+ o as ErrorBoundary,
13
+ s as Header,
14
+ d as HeroBanner,
15
+ p as Input,
16
+ H as Page,
17
+ x as Select,
18
+ B as StatefulViewingsList,
19
+ i as ViewingsList
16
20
  };
@@ -60,8 +60,9 @@ body {
60
60
  }
61
61
 
62
62
  @mixin headerText {
63
- color: $primary-black;
64
63
  @include DistinctDisplay();
64
+ color: $primary-black;
65
+ font-weight: 400;
65
66
  }
66
67
 
67
68
  @mixin bodyText {
@@ -5,7 +5,7 @@
5
5
  border: 0;
6
6
  margin: -1px;
7
7
  block-size: 1px;
8
- clip: rect(0, 0, 0, 0);
8
+ clip-path: inset(100%);
9
9
  inline-size: 1px;
10
10
  visibility: inherit;
11
11
  white-space: nowrap;
@@ -33,10 +33,11 @@
33
33
  width: 1em;
34
34
  }
35
35
 
36
- &--secondary {
36
+ &--secondary,
37
+ &--ghost {
37
38
  color: $text-color;
38
39
  background-color: transparent;
39
- box-shadow: rgba(0, 0, 0, 0.5) 0 0 0 1px inset;
40
+ border: 1px solid;
40
41
 
41
42
  &:hover,
42
43
  &:focus {
@@ -52,6 +53,10 @@
52
53
  }
53
54
  }
54
55
 
56
+ &--ghost {
57
+ border-color: transparent;
58
+ }
59
+
55
60
  &.#{$px}-button--icon-last svg {
56
61
  margin-inline-end: unset;
57
62
  margin-inline-start: 0.5rem;
@@ -74,3 +79,10 @@
74
79
  margin: 0;
75
80
  }
76
81
  }
82
+
83
+ .#{$px}-button__group {
84
+ display: flex;
85
+ gap: 0.25rem;
86
+ justify-content: center;
87
+ width: 100%;
88
+ }
@@ -8,9 +8,19 @@ $lg: #{$px}-input--lg;
8
8
  .#{$px}-input {
9
9
  display: flex;
10
10
  flex-direction: column;
11
+ width: 100%;
12
+
13
+ &--hidden {
14
+ @include hidden();
15
+ }
11
16
 
12
17
  &__label {
18
+ color: $keyline-gray;
19
+ font-size: 0.8125rem;
20
+ font-weight: 600;
13
21
  margin-bottom: 0.5rem;
22
+ text-transform: uppercase;
23
+ word-break: break-word;
14
24
 
15
25
  &--hidden {
16
26
  @include hidden();
@@ -18,8 +28,10 @@ $lg: #{$px}-input--lg;
18
28
  }
19
29
 
20
30
  &__input {
21
- accent-color: $pure-black;
22
- border: 3px solid currentColor;
31
+ accent-color: $soft-black;
32
+ border: 1px solid $keyline-gray;
33
+ border-radius: 0.1875rem;
34
+ font-size: 0.8125rem;
23
35
  margin-bottom: 0.5rem;
24
36
  padding: 0.5rem;
25
37
  // width: 100%;
@@ -60,7 +72,7 @@ $lg: #{$px}-input--lg;
60
72
  }
61
73
 
62
74
  .#{$px}-input__label {
63
- max-width: 8.75rem;
75
+ // max-width: 8.75rem;
64
76
  }
65
77
  }
66
78
 
@@ -182,4 +182,11 @@ $lg: #{$px}-input--lg;
182
182
  padding-top: 3.5rem;
183
183
  }
184
184
  }
185
+
186
+ &:has(.#{$px}-input__input:focus) label:before {
187
+ outline: 2px solid AccentColor;
188
+ outline: 2px solid Highlight;
189
+ outline: 2px solid -webkit-focus-ring-color;
190
+ outline-offset: 1px;
191
+ }
185
192
  }
@@ -0,0 +1,55 @@
1
+ @import '../../vars';
2
+ @import '../../_utils';
3
+ @import '../../typography';
4
+
5
+ .#{$px}-viewings-list {
6
+ align-items: center;
7
+ background-color: $off-white;
8
+ display: flex;
9
+ flex-direction: column;
10
+ gap: 2.5rem;
11
+ padding: 1rem;
12
+ width: 38rem;
13
+
14
+ &__title {
15
+ @include headerText;
16
+ }
17
+ }
18
+
19
+ // viewings-list-card-form
20
+ .#{$px}-viewings-list-card {
21
+ align-items: flex-start;
22
+ background-color: $pure-white;
23
+ border: 1px solid;
24
+ display: flex;
25
+ flex-direction: column;
26
+ gap: 1.5rem;
27
+ max-width: 34rem;
28
+ padding: 2rem;
29
+ width: 100%;
30
+
31
+ &__title {
32
+ @include headerText;
33
+ color: $soft-black;
34
+ }
35
+
36
+ &__location {
37
+ font-size: 1.25rem;
38
+ }
39
+
40
+ &-form__preview-set {
41
+ display: flex;
42
+ flex-direction: column;
43
+ gap: 2rem;
44
+ padding-inline-start: 1rem;
45
+ width: 100%;
46
+
47
+ &--hidden {
48
+ @include hidden;
49
+ }
50
+ }
51
+
52
+ hr {
53
+ width: 100%;
54
+ }
55
+ }
@@ -10,5 +10,6 @@
10
10
  @import 'components/HeroBanner/heroBanner';
11
11
  @import 'components/Input/input';
12
12
  @import 'components/Toggle/toggle';
13
+ @import 'components/ViewingsList/viewingsList';
13
14
  // 📑 Pages
14
15
  @import 'pages/page';
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  export declare const px = "phillips";
3
- export declare const noOP: () => void;
3
+ export declare const noOp: () => void;
4
4
  export interface CommonProps {
5
5
  /**
6
6
  * Optional className to be applied to the outer most element
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.7.2",
3
+ "version": "1.8.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",