@scrippsproduct/networks-ui-library 1.1.0-alpha.14 → 1.1.0-alpha.16
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 +1 @@
|
|
|
1
|
-
._date-
|
|
1
|
+
._date-navigation__list_1jjng_1{display:flex;justify-content:flex-start;position:relative;--pointer-position: 0;margin:0 auto;padding:.5rem 1rem 1.5rem;list-style:none;background:transparent}date-navigation{position:relative;padding-block-start:1rem;display:block}date-navigation[data-state=retracting] ._date-navigation__list_1jjng_1{animation-name:_slidein_1jjng_1;animation-duration:.325s;animation-timing-function:cubic-bezier(.18,.1,.09,1.04);animation-fill-mode:forwards;animation-direction:normal}date-navigation[data-state=advancing] ._date-navigation__list_1jjng_1{animation-name:_slideout_1jjng_1;animation-duration:.325s;animation-timing-function:cubic-bezier(.18,.1,.09,1.04);animation-fill-mode:forwards;animation-direction:normal}@media screen and (max-width:60rem){date-navigation{padding-block-start:0}}date-navigation-list{overflow:hidden;display:block}@keyframes _slidein_1jjng_1{0%{transform:translate3d(-20rem,0,0);opacity:.1}50%{opacity:.2}to{transform:translateZ(0);opacity:1}}@keyframes _slideout_1jjng_1{0%{transform:translate3d(20rem,0,0);opacity:1}50%{opacity:.5}to{transform:translateZ(0);opacity:1}}date-navigation-controls{display:contents}._date-navigation__control_1jjng_72{cursor:pointer;scale:1.5;translate:0 1rem;position:absolute;z-index:1;top:50%;transform:translateY(-50%);overflow:hidden;display:flex;align-items:center;justify-content:center;aspect-ratio:1;inline-size:4rem;padding:0;border:1px solid transparent;border-radius:50%;color:#000;text-indent:10ch;background:#fff;transition:opacity .5s ease-in-out}._date-navigation__control_1jjng_72>i>svg{display:block;max-inline-size:100%;block-size:auto;stroke:currentcolor}._date-navigation__control--previous_1jjng_101{inset-inline-start:-2rem;padding-inline-end:5px}._date-navigation__control--next_1jjng_106{inset-inline-end:-2rem;padding-inline-start:5px}._date-navigation__control_1jjng_72[disabled]{cursor:not-allowed;opacity:.4}._date-navigation__item_1jjng_117{--flex-basis: 14.285714%;border-right:1px solid rgba(255,255,255,.4);flex-basis:var(--flex-basis);text-align:center}._date-navigation__item_1jjng_117:last-child{border-width:0}@media screen and (max-width:37.5rem){._date-navigation__item_1jjng_117{--flex-basis: 25%}}._date-navigation__day_1jjng_132{cursor:pointer;border:none;background:transparent}._date-navigation__month-day-break_1jjng_138{display:none}._date-navigation__weekday_1jjng_142,._date-navigation__date_1jjng_143{color:var(--mono-color-100);font-size:1.2rem;text-transform:uppercase;transition:transform .225s ease-out}._date-navigation__weekday_1jjng_142{font-size:2rem}@media screen and (max-width:80rem){._date-navigation__control--previous_1jjng_101{inset-inline-start:-1.4rem}._date-navigation__control--next_1jjng_106{inset-inline-end:-1.2rem}}@media screen and (max-width:71.5rem){._date-navigation__weekday_1jjng_142{font-size:1.4rem}._date-navigation__date_1jjng_143{font-size:1rem}}@media screen and (max-width:60rem){._date-navigation__control_1jjng_72{translate:0 .6rem}._date-navigation__item_1jjng_117{padding-inline:.35rem}}@media screen and (max-width:46.875rem){._date-navigation__control_1jjng_72{scale:.7;translate:0 -1rem}._date-navigation__control--previous_1jjng_101{inset-inline-start:-1.6rem}._date-navigation__control--next_1jjng_106{inset-inline-end:-1.5rem}}@media screen and (max-width:31.25rem){._date-navigation__weekday_1jjng_142{font-size:1rem}._date-navigation__date_1jjng_143{font-size:.8rem;white-space:nowrap}}@media screen and (max-width:25rem){._date-navigation__month-day-break_1jjng_138{display:inline}}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { jsxs as _, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useState as g, useReducer as
|
|
2
|
+
import { useState as g, useReducer as I, useRef as m, useCallback as M, useEffect as p } from "react";
|
|
3
3
|
import { f as l } from "../../format-YhWt2D8M.mjs";
|
|
4
4
|
import { classes as o } from "../../utils/helpers.js";
|
|
5
|
-
import { useScheduleContext as
|
|
6
|
-
import { C as
|
|
5
|
+
import { useScheduleContext as S } from "../ScheduleLayout/useScheduleContext.js";
|
|
6
|
+
import { C as W } from "../../chevron-left-DRvpaLmK.mjs";
|
|
7
7
|
import { C as w } from "../../chevron-right-C8yCnmfx.mjs";
|
|
8
|
-
import '../../assets/DateNavigation.css';const
|
|
9
|
-
"date-navigation__list": "_date-
|
|
10
|
-
"date-navigation__control": "_date-
|
|
11
|
-
"date-navigation__control--previous": "_date-navigation__control--
|
|
12
|
-
"date-navigation__control--next": "_date-navigation__control--
|
|
13
|
-
"date-navigation__item": "_date-
|
|
14
|
-
"date-navigation__day": "_date-
|
|
15
|
-
"date-navigation__month-day-break": "_date-navigation__month-day-
|
|
16
|
-
"date-navigation__weekday": "_date-
|
|
17
|
-
"date-navigation__date": "_date-
|
|
8
|
+
import '../../assets/DateNavigation.css';const a = {
|
|
9
|
+
"date-navigation__list": "_date-navigation__list_1jjng_1",
|
|
10
|
+
"date-navigation__control": "_date-navigation__control_1jjng_72",
|
|
11
|
+
"date-navigation__control--previous": "_date-navigation__control--previous_1jjng_101",
|
|
12
|
+
"date-navigation__control--next": "_date-navigation__control--next_1jjng_106",
|
|
13
|
+
"date-navigation__item": "_date-navigation__item_1jjng_117",
|
|
14
|
+
"date-navigation__day": "_date-navigation__day_1jjng_132",
|
|
15
|
+
"date-navigation__month-day-break": "_date-navigation__month-day-break_1jjng_138",
|
|
16
|
+
"date-navigation__weekday": "_date-navigation__weekday_1jjng_142",
|
|
17
|
+
"date-navigation__date": "_date-navigation__date_1jjng_143"
|
|
18
18
|
};
|
|
19
|
-
function
|
|
19
|
+
function A(n, i) {
|
|
20
20
|
switch (i.type) {
|
|
21
21
|
case "NAVIGATE_TO_WEEK":
|
|
22
|
-
return i.targetWeekIndex > i.currentWeekIndex ? "advancing" : i.targetWeekIndex < i.currentWeekIndex ? "retracting" :
|
|
22
|
+
return i.targetWeekIndex > i.currentWeekIndex ? "advancing" : i.targetWeekIndex < i.currentWeekIndex ? "retracting" : n;
|
|
23
23
|
case "ANIMATION_COMPLETE":
|
|
24
24
|
return "idle";
|
|
25
25
|
default:
|
|
26
|
-
return
|
|
26
|
+
return n;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
const { weeks:
|
|
31
|
-
h({ type: "NAVIGATE_TO_WEEK", currentWeekIndex: r, targetWeekIndex: t }),
|
|
32
|
-
},
|
|
29
|
+
function V() {
|
|
30
|
+
const { weeks: n, setCurrentDate: i } = S(), [r, j] = g(0), [x, b] = g(n[0]), [s, y] = g(n[0][0]), [C, h] = I(A, "idle"), d = m(null), N = m(0), f = m(l(new Date(s.fullDateStr), "yyyy-MM-dd")), k = (t) => {
|
|
31
|
+
h({ type: "NAVIGATE_TO_WEEK", currentWeekIndex: r, targetWeekIndex: t }), j(t);
|
|
32
|
+
}, D = (t) => {
|
|
33
33
|
l(t.date, "yyyy-MM-dd") !== f.current && (f.current = l(t.date, "yyyy-MM-dd"), y(t), i(t.date));
|
|
34
|
-
}, c =
|
|
34
|
+
}, c = M(() => {
|
|
35
35
|
if (d.current === null) return;
|
|
36
36
|
const t = d.current;
|
|
37
37
|
t.addEventListener("animationstart", () => {
|
|
@@ -41,22 +41,22 @@ function P() {
|
|
|
41
41
|
return p(() => {
|
|
42
42
|
d.current !== null && (d.current.removeEventListener("animationend", c), d.current.addEventListener("animationend", c, { once: !0 }));
|
|
43
43
|
}, [c]), p(() => {
|
|
44
|
-
|
|
45
|
-
const t = r ? 0 : 1,
|
|
46
|
-
(v) => l(v.date, "yyyy-MM-dd") ===
|
|
44
|
+
b(n[r]);
|
|
45
|
+
const t = r ? 0 : 1, E = l(s.date, "yyyy-MM-dd"), u = n[t].findIndex(
|
|
46
|
+
(v) => l(v.date, "yyyy-MM-dd") === E
|
|
47
47
|
);
|
|
48
|
-
if (u !== -1 &&
|
|
49
|
-
const v =
|
|
50
|
-
|
|
48
|
+
if (u !== -1 && n[r][u]) {
|
|
49
|
+
const v = n[r][u];
|
|
50
|
+
N.current = u, y(v), i(v.date);
|
|
51
51
|
}
|
|
52
|
-
}, [r,
|
|
52
|
+
}, [r, n, i, s]), /* @__PURE__ */ _("date-navigation", { "data-state": C, children: [
|
|
53
53
|
/* @__PURE__ */ _("date-navigation-controls", { children: [
|
|
54
54
|
/* @__PURE__ */ _(
|
|
55
55
|
"button",
|
|
56
56
|
{
|
|
57
57
|
className: o([
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
a["date-navigation__control"],
|
|
59
|
+
a["date-navigation__control--previous"],
|
|
60
60
|
"date-navigation__control",
|
|
61
61
|
"date-navigation__control--previous"
|
|
62
62
|
]),
|
|
@@ -66,7 +66,7 @@ function P() {
|
|
|
66
66
|
k(0);
|
|
67
67
|
},
|
|
68
68
|
children: [
|
|
69
|
-
/* @__PURE__ */ e("i", { "aria-hidden": "true", children: /* @__PURE__ */ e(
|
|
69
|
+
/* @__PURE__ */ e("i", { "aria-hidden": "true", children: /* @__PURE__ */ e(W, { height: 48, width: 48 }) }),
|
|
70
70
|
/* @__PURE__ */ e("span", { className: "sr-only", children: "Current Week" })
|
|
71
71
|
]
|
|
72
72
|
}
|
|
@@ -75,8 +75,8 @@ function P() {
|
|
|
75
75
|
"button",
|
|
76
76
|
{
|
|
77
77
|
className: o([
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
a["date-navigation__control"],
|
|
79
|
+
a["date-navigation__control--next"],
|
|
80
80
|
"date-navigation__control",
|
|
81
81
|
"date-navigation__control--next"
|
|
82
82
|
]),
|
|
@@ -96,44 +96,44 @@ function P() {
|
|
|
96
96
|
"ul",
|
|
97
97
|
{
|
|
98
98
|
"aria-label": "Date Tabs",
|
|
99
|
-
className: o([
|
|
99
|
+
className: o([a["date-navigation__list"], "date-navigation__list"]),
|
|
100
100
|
ref: d,
|
|
101
101
|
role: "tablist",
|
|
102
|
-
children:
|
|
102
|
+
children: x.map((t) => /* @__PURE__ */ e(
|
|
103
103
|
"li",
|
|
104
104
|
{
|
|
105
|
-
className: [
|
|
105
|
+
className: [a["date-navigation__item"], "date-navigation__item"].join(" "),
|
|
106
106
|
role: "presentation",
|
|
107
107
|
children: /* @__PURE__ */ _(
|
|
108
108
|
"button",
|
|
109
109
|
{
|
|
110
110
|
"aria-controls": `${t.fullDateStr}`,
|
|
111
111
|
"aria-selected": s.fullDateStr === t.fullDateStr,
|
|
112
|
-
className: o([
|
|
112
|
+
className: o([a["date-navigation__day"], "date-navigation__day"]),
|
|
113
113
|
role: "tab",
|
|
114
114
|
type: "button",
|
|
115
115
|
onClick: () => {
|
|
116
|
-
|
|
116
|
+
D(t);
|
|
117
117
|
},
|
|
118
118
|
children: [
|
|
119
119
|
/* @__PURE__ */ e(
|
|
120
120
|
"div",
|
|
121
121
|
{
|
|
122
|
-
className: o([
|
|
122
|
+
className: o([a["date-navigation__weekday"], "date-navigation__weekday"]),
|
|
123
123
|
children: t.dayStr
|
|
124
124
|
}
|
|
125
125
|
),
|
|
126
126
|
/* @__PURE__ */ _(
|
|
127
127
|
"div",
|
|
128
128
|
{
|
|
129
|
-
className: o([
|
|
129
|
+
className: o([a["date-navigation__date"], "date-navigation__date"]),
|
|
130
130
|
children: [
|
|
131
131
|
t.monthStr,
|
|
132
132
|
/* @__PURE__ */ e(
|
|
133
133
|
"br",
|
|
134
134
|
{
|
|
135
135
|
className: o([
|
|
136
|
-
|
|
136
|
+
a["date-navigation__month-day-break"],
|
|
137
137
|
"date-navigation__month-day-break"
|
|
138
138
|
])
|
|
139
139
|
}
|
|
@@ -153,6 +153,6 @@ function P() {
|
|
|
153
153
|
] });
|
|
154
154
|
}
|
|
155
155
|
export {
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
V as DateNavigation,
|
|
157
|
+
V as default
|
|
158
158
|
};
|
package/package.json
CHANGED