@phillips/seldon 1.42.1 → 1.43.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,13 +1,13 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as m, jsx as t, Fragment as $ } from "react/jsx-runtime";
|
|
2
2
|
import * as a from "react";
|
|
3
3
|
import mt from "../../node_modules/classnames/index.js";
|
|
4
|
-
import { px as
|
|
4
|
+
import { px as u } from "../../utils/index.js";
|
|
5
5
|
import y from "../Input/Input.js";
|
|
6
6
|
import c from "../Button/Button.js";
|
|
7
7
|
import { ButtonVariants as l } from "../Button/types.js";
|
|
8
8
|
import ft from "./ViewingsListCardForm.js";
|
|
9
|
-
const i = `${
|
|
10
|
-
address1:
|
|
9
|
+
const i = `${u}-viewings-list-card`, dt = ({
|
|
10
|
+
address1: d,
|
|
11
11
|
address1Label: C,
|
|
12
12
|
addressUrl: O,
|
|
13
13
|
addressUrlLabel: w,
|
|
@@ -19,8 +19,8 @@ const i = `${d}-viewings-list-card`, $t = ({
|
|
|
19
19
|
cardTitle: T = "Add New Viewing",
|
|
20
20
|
deleteBtnLabel: V = "DELETE",
|
|
21
21
|
editBtnLabel: _ = "EDIT",
|
|
22
|
-
isEditState:
|
|
23
|
-
enableOnSite:
|
|
22
|
+
isEditState: o,
|
|
23
|
+
enableOnSite: f = "false",
|
|
24
24
|
enableOnSiteToggleLabel: k = "Enabled on website",
|
|
25
25
|
email: I,
|
|
26
26
|
emailLabel: N = "Email",
|
|
@@ -32,10 +32,10 @@ const i = `${d}-viewings-list-card`, $t = ({
|
|
|
32
32
|
invalidFields: n,
|
|
33
33
|
location: R,
|
|
34
34
|
locationLabel: q = "Location",
|
|
35
|
-
onCancel:
|
|
36
|
-
onEdit:
|
|
37
|
-
onDelete:
|
|
38
|
-
onSave:
|
|
35
|
+
onCancel: p,
|
|
36
|
+
onEdit: h,
|
|
37
|
+
onDelete: b,
|
|
38
|
+
onSave: g,
|
|
39
39
|
previewDates: G,
|
|
40
40
|
previewDatesLabel: H,
|
|
41
41
|
previewHours1: J,
|
|
@@ -52,37 +52,37 @@ const i = `${d}-viewings-list-card`, $t = ({
|
|
|
52
52
|
viewingDates: tt,
|
|
53
53
|
viewingDatesLabel: et,
|
|
54
54
|
viewingHours1: nt,
|
|
55
|
-
viewingHours1Label:
|
|
56
|
-
viewingHours2:
|
|
57
|
-
viewingHours2Label:
|
|
55
|
+
viewingHours1Label: ot,
|
|
56
|
+
viewingHours2: rt,
|
|
57
|
+
viewingHours2Label: st
|
|
58
58
|
}) => {
|
|
59
|
-
const [at, ct] = a.useState(
|
|
59
|
+
const [at, ct] = a.useState(f === "true"), s = a.useRef(null);
|
|
60
60
|
a.useEffect(() => {
|
|
61
|
-
|
|
62
|
-
}, [
|
|
63
|
-
var
|
|
64
|
-
n &&
|
|
61
|
+
o && s.current && s.current.focus();
|
|
62
|
+
}, [o]), a.useEffect(() => {
|
|
63
|
+
var r, E;
|
|
64
|
+
n && s.current && ((E = (r = s.current.closest(`.${u}-viewings-list-card`)) == null ? void 0 : r.querySelector(`.${u}-input--invalid input`)) == null || E.focus());
|
|
65
65
|
}, [n]);
|
|
66
66
|
const lt = () => {
|
|
67
|
-
typeof f == "function" && f();
|
|
68
|
-
}, it = () => {
|
|
69
67
|
typeof p == "function" && p();
|
|
70
|
-
},
|
|
71
|
-
typeof
|
|
68
|
+
}, it = () => {
|
|
69
|
+
typeof h == "function" && h();
|
|
70
|
+
}, ut = (r) => {
|
|
71
|
+
typeof g == "function" && g(r);
|
|
72
72
|
};
|
|
73
|
-
return /* @__PURE__ */
|
|
73
|
+
return /* @__PURE__ */ m(
|
|
74
74
|
"section",
|
|
75
75
|
{
|
|
76
76
|
"data-testid": `viewings-list-card-${e}`,
|
|
77
77
|
id: e,
|
|
78
|
-
className: mt(`${i}`, { [`${i}--edit-state`]:
|
|
78
|
+
className: mt(`${i}`, { [`${i}--edit-state`]: o }),
|
|
79
79
|
children: [
|
|
80
80
|
/* @__PURE__ */ t("h3", { className: `${i}__title`, children: T }),
|
|
81
81
|
/* @__PURE__ */ t("input", { type: "hidden", name: "id", value: e }),
|
|
82
82
|
/* @__PURE__ */ t(
|
|
83
83
|
y,
|
|
84
84
|
{
|
|
85
|
-
ref:
|
|
85
|
+
ref: s,
|
|
86
86
|
id: `location-${e}`,
|
|
87
87
|
defaultValue: R,
|
|
88
88
|
labelText: q,
|
|
@@ -90,13 +90,13 @@ const i = `${d}-viewings-list-card`, $t = ({
|
|
|
90
90
|
name: "location",
|
|
91
91
|
invalid: n == null ? void 0 : n.location,
|
|
92
92
|
invalidText: n == null ? void 0 : n.location,
|
|
93
|
-
readOnly: !
|
|
93
|
+
readOnly: !o
|
|
94
94
|
}
|
|
95
95
|
),
|
|
96
|
-
|
|
96
|
+
o ? /* @__PURE__ */ t(
|
|
97
97
|
ft,
|
|
98
98
|
{
|
|
99
|
-
address1:
|
|
99
|
+
address1: d,
|
|
100
100
|
address1Label: C,
|
|
101
101
|
addressUrl: O,
|
|
102
102
|
addressUrlLabel: w,
|
|
@@ -127,9 +127,9 @@ const i = `${d}-viewings-list-card`, $t = ({
|
|
|
127
127
|
viewingDates: tt,
|
|
128
128
|
viewingDatesLabel: et,
|
|
129
129
|
viewingHours1: nt,
|
|
130
|
-
viewingHours1Label:
|
|
131
|
-
viewingHours2:
|
|
132
|
-
viewingHours2Label:
|
|
130
|
+
viewingHours1Label: ot,
|
|
131
|
+
viewingHours2: rt,
|
|
132
|
+
viewingHours2Label: st
|
|
133
133
|
}
|
|
134
134
|
) : null,
|
|
135
135
|
/* @__PURE__ */ t(
|
|
@@ -137,19 +137,19 @@ const i = `${d}-viewings-list-card`, $t = ({
|
|
|
137
137
|
{
|
|
138
138
|
id: `enableOnSite-${e}`,
|
|
139
139
|
type: "toggle",
|
|
140
|
-
defaultChecked:
|
|
140
|
+
defaultChecked: f === "true",
|
|
141
141
|
labelText: k,
|
|
142
142
|
size: "md",
|
|
143
143
|
inline: !0,
|
|
144
144
|
value: "true",
|
|
145
145
|
name: "enableOnSite",
|
|
146
|
-
onChange: () => ct((
|
|
147
|
-
readOnly: !
|
|
146
|
+
onChange: () => ct((r) => !r),
|
|
147
|
+
readOnly: !o
|
|
148
148
|
}
|
|
149
149
|
),
|
|
150
150
|
at ? null : /* @__PURE__ */ t("input", { type: "hidden", name: "enableOnSite", value: "false" }),
|
|
151
151
|
/* @__PURE__ */ t("hr", {}),
|
|
152
|
-
/* @__PURE__ */ t("div", { className: `${i}__btn-group ${
|
|
152
|
+
/* @__PURE__ */ t("div", { className: `${i}__btn-group ${u}-button__group`, children: o ? /* @__PURE__ */ m($, { children: [
|
|
153
153
|
/* @__PURE__ */ t(
|
|
154
154
|
c,
|
|
155
155
|
{
|
|
@@ -172,7 +172,7 @@ const i = `${d}-viewings-list-card`, $t = ({
|
|
|
172
172
|
children: L
|
|
173
173
|
}
|
|
174
174
|
)
|
|
175
|
-
] }) : /* @__PURE__ */
|
|
175
|
+
] }) : /* @__PURE__ */ m($, { children: [
|
|
176
176
|
/* @__PURE__ */ t(
|
|
177
177
|
c,
|
|
178
178
|
{
|
|
@@ -191,7 +191,7 @@ const i = `${d}-viewings-list-card`, $t = ({
|
|
|
191
191
|
variant: l.ghost,
|
|
192
192
|
type: "button",
|
|
193
193
|
size: "sm",
|
|
194
|
-
onClick: () => typeof
|
|
194
|
+
onClick: () => typeof b == "function" && b(e),
|
|
195
195
|
children: V
|
|
196
196
|
}
|
|
197
197
|
)
|
|
@@ -201,5 +201,5 @@ const i = `${d}-viewings-list-card`, $t = ({
|
|
|
201
201
|
);
|
|
202
202
|
};
|
|
203
203
|
export {
|
|
204
|
-
|
|
204
|
+
dt as default
|
|
205
205
|
};
|
package/dist/scss/_vars.scss
CHANGED
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import { kebabCase as d } from "../node_modules/change-case/dist/index.js";
|
|
3
3
|
import * as u from "react";
|
|
4
|
-
const
|
|
4
|
+
const s = "seldon", x = ({ id: e, ...n }, a) => {
|
|
5
5
|
const t = d(a);
|
|
6
6
|
return {
|
|
7
7
|
...n,
|
|
8
8
|
"data-testid": e ? `${t}-${e}` : `${t}`,
|
|
9
|
-
className: `${
|
|
9
|
+
className: `${s}-${t}`
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
var
|
|
12
|
+
var $ = /* @__PURE__ */ ((e) => (e.xs = "xs", e.sm = "sm", e.md = "md", e.lg = "lg", e.xl = "xl", e.xxl = "xxl", e))($ || {});
|
|
13
13
|
const v = () => {
|
|
14
14
|
};
|
|
15
15
|
function g({
|
|
@@ -18,7 +18,7 @@ function g({
|
|
|
18
18
|
invalid: a = !1,
|
|
19
19
|
invalidText: t = "invalid",
|
|
20
20
|
readOnly: r = !1,
|
|
21
|
-
type:
|
|
21
|
+
type: i,
|
|
22
22
|
warn: l = !1,
|
|
23
23
|
warnText: c
|
|
24
24
|
}) {
|
|
@@ -26,14 +26,14 @@ function g({
|
|
|
26
26
|
disabled: !r && e,
|
|
27
27
|
invalid: !r && !e && a,
|
|
28
28
|
invalidId: `${n}-error-msg`,
|
|
29
|
-
type:
|
|
29
|
+
type: i === "toggle" ? "checkbox" : i,
|
|
30
30
|
warn: !r && !e && !a && l,
|
|
31
31
|
warnId: `${n}-warn-msg`,
|
|
32
32
|
validation: null
|
|
33
33
|
};
|
|
34
|
-
return o.invalid && (o.validation = /* @__PURE__ */ m("div", { className: `${
|
|
34
|
+
return o.invalid && (o.validation = /* @__PURE__ */ m("div", { className: `${s}-input__validation ${s}-${i}-input--invalid`, id: o.invalidId, children: t })), o.warn && (o.validation = /* @__PURE__ */ m("div", { className: `${s}-input__validation ${s}-${i}-input--warn`, id: o.warnId, children: c })), o;
|
|
35
35
|
}
|
|
36
|
-
const C = (/* @__PURE__ */ new Date()).getFullYear(), w = (e, n = "end", a = "vertical") => `${
|
|
36
|
+
const C = (/* @__PURE__ */ new Date()).getFullYear(), w = (e, n = "end", a = "vertical") => `${s}-padding-${a}-${e}-${n}`, h = (e) => /(.+)@(.+){2,}\.(.+){2,}/i.test(e), I = function(e, n, a = !1) {
|
|
37
37
|
const t = u.Children.toArray(e).filter((r) => r && r.type === n && !a ? r : r && r.type !== n && a);
|
|
38
38
|
return t.length > 0 ? t : null;
|
|
39
39
|
}, N = (e) => {
|
|
@@ -41,7 +41,7 @@ const C = (/* @__PURE__ */ new Date()).getFullYear(), w = (e, n = "end", a = "ve
|
|
|
41
41
|
return `${n[0]}?${r}`;
|
|
42
42
|
};
|
|
43
43
|
export {
|
|
44
|
-
|
|
44
|
+
$ as PaddingTokens,
|
|
45
45
|
C as defaultYear,
|
|
46
46
|
h as emailValidation,
|
|
47
47
|
N as encodeURLSearchParams,
|
|
@@ -49,6 +49,6 @@ export {
|
|
|
49
49
|
w as generatePaddingClassName,
|
|
50
50
|
x as getCommonProps,
|
|
51
51
|
v as noOp,
|
|
52
|
-
|
|
52
|
+
s as px,
|
|
53
53
|
g as useNormalizedInputProps
|
|
54
54
|
};
|