@phillips/seldon 1.149.2 → 1.150.1
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/AddToCalendar/AddToCalendar.js +22 -32
- package/dist/components/AddToCalendar/calendarLinks.js +46 -46
- package/dist/components/AddToCalendar/types.d.ts +1 -1
- package/dist/components/IconButton/IconButton.d.ts +1 -1
- package/dist/components/IconButton/IconButton.js +24 -25
- package/dist/components/IconButton/IconButton.stories.d.ts +1 -1
- package/dist/scss/components/AddToCalendar/_addToCalendar.scss +18 -16
- package/dist/scss/patterns/UserManagement/_userManagement.scss +0 -5
- package/package.json +1 -1
|
@@ -1,37 +1,30 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { getCommonProps as g
|
|
4
|
-
import
|
|
5
|
-
import { TextVariants as
|
|
6
|
-
import
|
|
7
|
-
import { Root as
|
|
8
|
-
import
|
|
1
|
+
import { jsx as e, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as C, useState as h } from "react";
|
|
3
|
+
import { getCommonProps as g } from "../../utils/index.js";
|
|
4
|
+
import u from "../../node_modules/classnames/index.js";
|
|
5
|
+
import { TextVariants as N } from "../Text/types.js";
|
|
6
|
+
import O from "../Text/Text.js";
|
|
7
|
+
import { Root as T, Trigger as x, Portal as I, Content as A, Item as L } from "../../node_modules/@radix-ui/react-dropdown-menu/dist/index.js";
|
|
8
|
+
import P from "../Icon/Icon.js";
|
|
9
9
|
import "../Link/types.js";
|
|
10
|
-
import
|
|
11
|
-
import { generateGoogleCalendarLink as
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
import $ from "../Link/Link.js";
|
|
11
|
+
import { generateGoogleCalendarLink as w, generateOutlookOnlineLink as R, generateYahooCalendarLink as S, generateCalendarFile as j } from "./calendarLinks.js";
|
|
12
|
+
import y from "../IconButton/IconButton.js";
|
|
13
|
+
const G = C(
|
|
14
|
+
({ className: r, event: o, label: s = "Add to calendar", linkElement: d = $, ...n }, m) => {
|
|
15
|
+
const { className: l, ...c } = g(n, "AddToCalendar"), [t, f] = h(!1), k = (a, i) => {
|
|
16
|
+
a === "file" ? j(o) : a === "link" && i && window.open(i, "_blank");
|
|
16
17
|
}, p = [
|
|
17
18
|
{ label: "iCalendar", action: "file" },
|
|
18
|
-
{ label: "Google Calendar", action: "link", link:
|
|
19
|
+
{ label: "Google Calendar", action: "link", link: w(o) },
|
|
19
20
|
{ label: "Outlook", action: "file" },
|
|
20
21
|
{ label: "Outlook Online", action: "link", link: R(o) },
|
|
21
22
|
{ label: "Yahoo Calendar", action: "link", link: S(o) }
|
|
22
23
|
];
|
|
23
|
-
return /* @__PURE__ */ e("div", { ...
|
|
24
|
-
/* @__PURE__ */ e(x, { asChild: !0, children: /* @__PURE__ */ e(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"aria-label": d,
|
|
28
|
-
className: `${s}-icon-button ${s}-icon-button--small ${l}-icon-button`,
|
|
29
|
-
type: "button",
|
|
30
|
-
children: /* @__PURE__ */ e(I, { icon: t ? "CloseX" : "Calendar" })
|
|
31
|
-
}
|
|
32
|
-
) }),
|
|
33
|
-
/* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(
|
|
34
|
-
w,
|
|
24
|
+
return /* @__PURE__ */ e("div", { ...c, className: u(l, r), ...n, ref: m, children: /* @__PURE__ */ b(T, { open: t, onOpenChange: f, children: [
|
|
25
|
+
/* @__PURE__ */ e(x, { asChild: !0, children: /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(P, { icon: t ? "CloseX" : "Calendar", title: s }) }) }),
|
|
26
|
+
/* @__PURE__ */ e(I, { children: /* @__PURE__ */ e(
|
|
27
|
+
A,
|
|
35
28
|
{
|
|
36
29
|
sideOffset: 5,
|
|
37
30
|
align: "start",
|
|
@@ -39,15 +32,12 @@ const G = h(
|
|
|
39
32
|
"data-side": "bottom",
|
|
40
33
|
avoidCollisions: !1,
|
|
41
34
|
className: `${l}-atcb-list`,
|
|
42
|
-
onKeyDown: (a) => {
|
|
43
|
-
a.key === "Tab" && i(!1);
|
|
44
|
-
},
|
|
45
35
|
children: p.map((a) => /* @__PURE__ */ e(
|
|
46
|
-
|
|
36
|
+
L,
|
|
47
37
|
{
|
|
48
38
|
className: `${l}-atcb-item`,
|
|
49
39
|
onSelect: () => k(a.action, a.link),
|
|
50
|
-
children: a.action === "link" ? /* @__PURE__ */ e(
|
|
40
|
+
children: a.action === "link" ? /* @__PURE__ */ e(d, { className: `${l}-atcb-item-link`, href: a.link, children: a.label }) : /* @__PURE__ */ e("button", { className: `${l}-atcb-item-link`, children: /* @__PURE__ */ e(O, { variant: N.body2, children: a.label }) })
|
|
51
41
|
},
|
|
52
42
|
a.label
|
|
53
43
|
))
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
import { createEvent as
|
|
1
|
+
import { createEvent as u } from "../../node_modules/ics/dist/index.js";
|
|
2
2
|
import { isValid as p } from "../../node_modules/date-fns/isValid.js";
|
|
3
|
-
import { toZonedTime as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
3
|
+
import { toZonedTime as m } from "../../node_modules/date-fns-tz/dist/esm/toZonedTime/index.js";
|
|
4
|
+
import { formatDate as a } from "../../node_modules/date-fns/format.js";
|
|
5
|
+
import { addHours as i } from "../../node_modules/date-fns/addHours.js";
|
|
6
|
+
const l = {
|
|
7
7
|
google: "https://calendar.google.com/calendar/u/0/r/eventedit",
|
|
8
8
|
outlook: "https://outlook.office.com/calendar/0/deeplink/compose",
|
|
9
9
|
yahoo: "https://calendar.yahoo.com/"
|
|
10
|
-
},
|
|
10
|
+
}, M = () => {
|
|
11
11
|
try {
|
|
12
12
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
13
13
|
} catch {
|
|
14
14
|
return console.warn("Unable to determine user's timezone. Using UTC as a fallback."), "UTC";
|
|
15
15
|
}
|
|
16
|
-
},
|
|
17
|
-
if (!
|
|
18
|
-
return console.error("Invalid event start date:",
|
|
19
|
-
const e =
|
|
20
|
-
switch (
|
|
16
|
+
}, y = (o) => new URLSearchParams(o), d = (o, t) => {
|
|
17
|
+
if (!t.start || !p(t.start))
|
|
18
|
+
return console.error("Invalid event start date:", t), "#";
|
|
19
|
+
const e = M(), n = m(t.start, o === "google" ? t.timezone : e), r = t.end ? m(t.end, o === "google" ? t.timezone : e) : null;
|
|
20
|
+
switch (o) {
|
|
21
21
|
case "google":
|
|
22
|
-
return
|
|
22
|
+
return H(n, r, t);
|
|
23
23
|
case "outlook":
|
|
24
|
-
return
|
|
24
|
+
return h(n, r, t);
|
|
25
25
|
case "yahoo":
|
|
26
|
-
return
|
|
26
|
+
return k(n, r, t);
|
|
27
27
|
default:
|
|
28
|
-
return console.error("Invalid calendar type:",
|
|
28
|
+
return console.error("Invalid calendar type:", o), "#";
|
|
29
29
|
}
|
|
30
|
-
},
|
|
31
|
-
const n =
|
|
30
|
+
}, H = (o, t, e) => {
|
|
31
|
+
const n = y({
|
|
32
32
|
text: e.title,
|
|
33
|
-
dates: `${
|
|
33
|
+
dates: t ? `${a(o, "yyyyMMdd'T'HHmmss")}/${a(t, "yyyyMMdd'T'HHmmss")}` : `${a(o, "yyyyMMdd'T'HHmmss")}/${a(i(o, 1), "yyyyMMdd'T'HHmmss")}`,
|
|
34
34
|
ctz: e.timezone,
|
|
35
35
|
details: e.description,
|
|
36
36
|
location: e.location
|
|
37
|
-
}), r = new URL(
|
|
37
|
+
}), r = new URL(l.google);
|
|
38
38
|
return r.search = n.toString(), r.toString();
|
|
39
|
-
},
|
|
40
|
-
const n =
|
|
39
|
+
}, h = (o, t, e) => {
|
|
40
|
+
const n = y({
|
|
41
41
|
path: "/calendar/action/compose",
|
|
42
42
|
rru: "addevent",
|
|
43
43
|
subject: e.title,
|
|
44
|
-
startdt:
|
|
45
|
-
enddt:
|
|
44
|
+
startdt: a(o, "yyyy-MM-dd'T'HH:mm:ssXXX"),
|
|
45
|
+
enddt: t ? a(t, "yyyy-MM-dd'T'HH:mm:ssXXX") : a(i(o, 1), "yyyy-MM-dd'T'HH:mm:ssXXX"),
|
|
46
46
|
body: e.description,
|
|
47
47
|
location: e.location,
|
|
48
48
|
allday: "false"
|
|
49
|
-
}), r = new URL(
|
|
49
|
+
}), r = new URL(l.outlook);
|
|
50
50
|
return r.search = n.toString(), r.toString();
|
|
51
|
-
},
|
|
52
|
-
const n = encodeURIComponent(e.title), r = encodeURIComponent(e.description), c = encodeURIComponent(e.location),
|
|
53
|
-
return `${
|
|
54
|
-
},
|
|
55
|
-
if (!
|
|
56
|
-
console.error("Invalid event start date:",
|
|
51
|
+
}, k = (o, t, e) => {
|
|
52
|
+
const n = encodeURIComponent(e.title), r = encodeURIComponent(e.description), c = encodeURIComponent(e.location), s = a(o, "yyyyMMdd'T'HHmmss"), g = t ? a(t, "yyyyMMdd'T'HHmmss") : a(i(o, 1), "yyyyMMdd'T'HHmmss");
|
|
53
|
+
return `${l.yahoo}?v=60&view=d&type=20&title=${n}&st=${s}&et=${g}&desc=${r}&in_loc=${c}`;
|
|
54
|
+
}, R = (o) => d("google", o), $ = (o) => d("outlook", o), X = (o) => d("yahoo", o), b = (o) => {
|
|
55
|
+
if (!o.start) {
|
|
56
|
+
console.error("Invalid event start date:", o);
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
-
const
|
|
60
|
-
|
|
59
|
+
const t = o.end ? o.end : i(o.start, 1);
|
|
60
|
+
u(
|
|
61
61
|
{
|
|
62
|
-
title:
|
|
63
|
-
description:
|
|
62
|
+
title: o.title,
|
|
63
|
+
description: o.description,
|
|
64
64
|
start: [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
o.start.getFullYear(),
|
|
66
|
+
o.start.getMonth() + 1,
|
|
67
|
+
o.start.getDate(),
|
|
68
|
+
o.start.getHours(),
|
|
69
|
+
o.start.getMinutes()
|
|
70
70
|
],
|
|
71
|
-
end: [
|
|
72
|
-
location:
|
|
71
|
+
end: [t.getFullYear(), t.getMonth() + 1, t.getDate(), t.getHours(), t.getMinutes()],
|
|
72
|
+
location: o.location
|
|
73
73
|
},
|
|
74
74
|
(e, n) => {
|
|
75
75
|
if (e)
|
|
76
76
|
console.error("Error creating iCalendar event:", e);
|
|
77
77
|
else {
|
|
78
|
-
const r = new File([n], `${
|
|
79
|
-
|
|
78
|
+
const r = new File([n], `${o.title}.ics`, { type: "text/calendar" }), c = URL.createObjectURL(r), s = document.createElement("a");
|
|
79
|
+
s.href = c, s.download = r.name, document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(c);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
);
|
|
83
83
|
};
|
|
84
84
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
b as generateCalendarFile,
|
|
86
|
+
R as generateGoogleCalendarLink,
|
|
87
87
|
$ as generateOutlookOnlineLink,
|
|
88
|
-
|
|
88
|
+
X as generateYahooCalendarLink
|
|
89
89
|
};
|
|
@@ -26,5 +26,5 @@ export interface IconButtonProps extends Omit<React.HTMLAttributes<HTMLButtonEle
|
|
|
26
26
|
*/
|
|
27
27
|
prefetch?: ButtonProps['prefetch'];
|
|
28
28
|
}
|
|
29
|
-
declare const IconButton: (
|
|
29
|
+
declare const IconButton: import('react').ForwardRefExoticComponent<IconButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
30
30
|
export default IconButton;
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
2
|
import c from "../../node_modules/classnames/index.js";
|
|
3
|
-
import
|
|
4
|
-
import { getCommonProps as
|
|
5
|
-
import { ButtonVariants as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
variant: o =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
3
|
+
import p from "../Button/Button.js";
|
|
4
|
+
import { getCommonProps as i } from "../../utils/index.js";
|
|
5
|
+
import { ButtonVariants as l } from "../Button/types.js";
|
|
6
|
+
import { forwardRef as u } from "react";
|
|
7
|
+
const B = u(
|
|
8
|
+
({ children: r, variant: o = l.primary, isDisabled: s = !1, className: a, ...t }, n) => {
|
|
9
|
+
const { className: m, ...e } = i(t, "IconButton");
|
|
10
|
+
return /* @__PURE__ */ f(
|
|
11
|
+
p,
|
|
12
|
+
{
|
|
13
|
+
...e,
|
|
14
|
+
variant: o,
|
|
15
|
+
className: c(m, `${m}--${o}`, a),
|
|
16
|
+
isDisabled: s,
|
|
17
|
+
ref: n,
|
|
18
|
+
...t,
|
|
19
|
+
children: r
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
B.displayName = "IconButton";
|
|
26
25
|
export {
|
|
27
|
-
|
|
26
|
+
B as default
|
|
28
27
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ButtonVariants } from '../Button/types';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: (
|
|
4
|
+
component: import('react').ForwardRefExoticComponent<import('./IconButton').IconButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
argTypes: {
|
|
6
6
|
variant: {
|
|
7
7
|
options: ButtonVariants[];
|
|
@@ -6,25 +6,26 @@
|
|
|
6
6
|
width: 30px;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
background: none;
|
|
11
|
-
border: none;
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
|
|
9
|
+
.#{$px}-icon-button {
|
|
14
10
|
&:focus-visible {
|
|
15
11
|
border-radius: 5px;
|
|
16
|
-
outline: 1px solid $medium-gray;
|
|
17
12
|
}
|
|
18
13
|
}
|
|
19
14
|
|
|
20
15
|
&-atcb-list {
|
|
21
16
|
background: #fff;
|
|
22
17
|
border: 1px solid#ECEAE7;
|
|
23
|
-
padding: $spacing-sm;
|
|
24
18
|
}
|
|
25
19
|
|
|
26
20
|
&-atcb-item {
|
|
27
|
-
|
|
21
|
+
padding: $spacing-xsm $spacing-sm;
|
|
22
|
+
|
|
23
|
+
&:hover,
|
|
24
|
+
&:focus-visible {
|
|
25
|
+
background-color: $light-gray;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
outline: none;
|
|
28
|
+
}
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
&-atcb-item-link {
|
|
@@ -43,22 +44,23 @@
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
&:hover {
|
|
46
|
-
|
|
47
|
+
border: none;
|
|
48
|
+
outline: none;
|
|
47
49
|
text-decoration: none;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
&:focus-visible {
|
|
51
|
-
color: #000;
|
|
52
|
-
text-decoration: underline;
|
|
53
|
-
text-decoration-thickness: 1px;
|
|
54
|
-
text-underline-offset: $spacing-micro;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
52
|
span {
|
|
58
53
|
@include text($body-size2);
|
|
59
54
|
|
|
60
55
|
font-variation-settings: 'wght' 400;
|
|
61
56
|
text-decoration: none;
|
|
57
|
+
|
|
58
|
+
&:hover,
|
|
59
|
+
&:focus-visible {
|
|
60
|
+
color: #000;
|
|
61
|
+
outline: none;
|
|
62
|
+
text-decoration: none;
|
|
63
|
+
}
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
}
|