@transferwise/components 0.0.0-experimental-bcea1dd → 0.0.0-experimental-1168b1c
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/build/Calendar/Calendar.js +47 -8
- package/build/Calendar/Calendar.js.map +1 -1
- package/build/Calendar/Calendar.messages.js +3 -0
- package/build/Calendar/Calendar.messages.js.map +1 -1
- package/build/Calendar/Calendar.messages.mjs +3 -0
- package/build/Calendar/Calendar.messages.mjs.map +1 -1
- package/build/Calendar/Calendar.mjs +48 -9
- package/build/Calendar/Calendar.mjs.map +1 -1
- package/build/Calendar/DayCalendar/DayCalendar.js +4 -0
- package/build/Calendar/DayCalendar/DayCalendar.js.map +1 -1
- package/build/Calendar/DayCalendar/DayCalendar.mjs +4 -0
- package/build/Calendar/DayCalendar/DayCalendar.mjs.map +1 -1
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.js +30 -18
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.js.map +1 -1
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.mjs +30 -18
- package/build/Calendar/DayCalendar/Table/DayCalendarTable.mjs.map +1 -1
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.js +1 -1
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.js.map +1 -1
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.mjs +1 -1
- package/build/Calendar/MonthCalendar/Table/MonthCalendarTable.mjs.map +1 -1
- package/build/Calendar/{tableLink → TableLink}/TableLink.js +23 -11
- package/build/Calendar/TableLink/TableLink.js.map +1 -0
- package/build/Calendar/{tableLink → TableLink}/TableLink.mjs +23 -11
- package/build/Calendar/TableLink/TableLink.mjs.map +1 -0
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.js +1 -1
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.js.map +1 -1
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.mjs +1 -1
- package/build/Calendar/YearCalendar/Table/YearCalendarTable.mjs.map +1 -1
- package/build/DateLookup/DateLookup.js +14 -4
- package/build/DateLookup/DateLookup.js.map +1 -1
- package/build/DateLookup/DateLookup.mjs +14 -4
- package/build/DateLookup/DateLookup.mjs.map +1 -1
- package/build/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.js +33 -0
- package/build/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.js.map +1 -0
- package/build/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.mjs +31 -0
- package/build/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.mjs.map +1 -0
- package/build/common/DateUtils/isDateDisabled/isDateDisabled.js +40 -0
- package/build/common/DateUtils/isDateDisabled/isDateDisabled.js.map +1 -0
- package/build/common/DateUtils/isDateDisabled/isDateDisabled.mjs +38 -0
- package/build/common/DateUtils/isDateDisabled/isDateDisabled.mjs.map +1 -0
- package/build/i18n/en.json +1 -0
- package/build/i18n/en.json.js +1 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +1 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/index.js +2 -4
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -2
- package/build/index.mjs.map +1 -1
- package/build/main.css +114 -76
- package/build/styles/Calendar/Calendar.css +104 -35
- package/build/styles/Calendar/TableLink/TableLink.css +109 -0
- package/build/styles/main.css +114 -76
- package/build/types/Body/Body.d.ts +2 -2
- package/build/types/Calendar/Calendar.d.ts +4 -2
- package/build/types/Calendar/Calendar.d.ts.map +1 -1
- package/build/types/Calendar/Calendar.messages.d.ts +5 -0
- package/build/types/Calendar/Calendar.messages.d.ts.map +1 -1
- package/build/types/Calendar/Calendar.types.d.ts +19 -0
- package/build/types/Calendar/Calendar.types.d.ts.map +1 -0
- package/build/types/Calendar/DayCalendar/DayCalendar.d.ts +4 -1
- package/build/types/Calendar/DayCalendar/DayCalendar.d.ts.map +1 -1
- package/build/types/Calendar/DayCalendar/Table/DayCalendarTable.d.ts +3 -0
- package/build/types/Calendar/DayCalendar/Table/DayCalendarTable.d.ts.map +1 -1
- package/build/types/Calendar/{tableLink → TableLink}/TableLink.d.ts +2 -1
- package/build/types/Calendar/TableLink/TableLink.d.ts.map +1 -0
- package/build/types/Calendar/TableLink/index.d.ts.map +1 -0
- package/build/types/Calendar/index.d.ts +1 -0
- package/build/types/Calendar/index.d.ts.map +1 -1
- package/build/types/DateLookup/DateLookup.d.ts +5 -2
- package/build/types/DateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/DateLookup/index.d.ts +1 -0
- package/build/types/DateLookup/index.d.ts.map +1 -1
- package/build/types/IconButton/IconButton.d.ts +1 -1
- package/build/types/Title/Title.d.ts +2 -2
- package/build/types/Upload/Steps/UploadImageStep/UploadImageStep.d.ts +1 -1
- package/build/types/UploadInput/UploadItem/UploadItemLink.d.ts +1 -1
- package/build/types/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.d.ts +3 -0
- package/build/types/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.d.ts.map +1 -0
- package/build/types/common/DateUtils/index.d.ts +2 -0
- package/build/types/common/DateUtils/index.d.ts.map +1 -1
- package/build/types/common/DateUtils/isDateDisabled/isDateDisabled.d.ts +3 -0
- package/build/types/common/DateUtils/isDateDisabled/isDateDisabled.d.ts.map +1 -0
- package/build/types/index.d.ts +2 -4
- package/build/types/index.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +2 -0
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/Calendar/Calendar.css +104 -35
- package/src/Calendar/Calendar.disabledDates.test.tsx +197 -0
- package/src/Calendar/Calendar.less +5 -35
- package/src/Calendar/Calendar.messages.ts +5 -0
- package/src/Calendar/Calendar.test.tsx +9 -9
- package/src/Calendar/Calendar.tsx +61 -9
- package/src/Calendar/Calendar.types.ts +22 -0
- package/src/Calendar/DayCalendar/DayCalendar.tsx +17 -1
- package/src/Calendar/DayCalendar/Table/DayCalendarTable.tsx +42 -26
- package/src/Calendar/MonthCalendar/Table/MonthCalendarTable.tsx +1 -1
- package/src/Calendar/TableLink/TableLink.css +109 -0
- package/src/Calendar/TableLink/TableLink.less +60 -0
- package/src/Calendar/{tableLink → TableLink}/TableLink.tsx +24 -14
- package/src/Calendar/YearCalendar/Table/YearCalendarTable.tsx +1 -1
- package/src/Calendar/_stories/Calendar.accessibility.docs.mdx +112 -0
- package/src/Calendar/_stories/Calendar.story.tsx +55 -1
- package/src/Calendar/index.ts +7 -0
- package/src/DateLookup/DateLookup.disabledDates.test.tsx +120 -0
- package/src/DateLookup/DateLookup.test.tsx +1 -1
- package/src/DateLookup/DateLookup.tsx +11 -4
- package/src/DateLookup/_stories/DateLookup.accessibility.docs.mdx +100 -0
- package/src/DateLookup/_stories/DateLookup.story.tsx +59 -1
- package/src/DateLookup/index.ts +6 -0
- package/src/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.test.ts +98 -0
- package/src/common/DateUtils/hasDisabledDatesInMonth/hasDisabledDatesInMonth.ts +45 -0
- package/src/common/DateUtils/index.ts +2 -0
- package/src/common/DateUtils/isDateDisabled/isDateDisabled.test.ts +159 -0
- package/src/common/DateUtils/isDateDisabled/isDateDisabled.ts +59 -0
- package/src/i18n/en.json +1 -0
- package/src/index.ts +2 -4
- package/src/main.css +114 -76
- package/src/main.less +0 -1
- package/build/Calendar/tableLink/TableLink.js.map +0 -1
- package/build/Calendar/tableLink/TableLink.mjs.map +0 -1
- package/build/Markup/Markup.js +0 -136
- package/build/Markup/Markup.js.map +0 -1
- package/build/Markup/Markup.mjs +0 -131
- package/build/Markup/Markup.mjs.map +0 -1
- package/build/Markup/constants.js +0 -36
- package/build/Markup/constants.js.map +0 -1
- package/build/Markup/constants.mjs +0 -29
- package/build/Markup/constants.mjs.map +0 -1
- package/build/Markup/utils/parseMarkup.js +0 -226
- package/build/Markup/utils/parseMarkup.js.map +0 -1
- package/build/Markup/utils/parseMarkup.mjs +0 -223
- package/build/Markup/utils/parseMarkup.mjs.map +0 -1
- package/build/Markup/utils/sanitise.js +0 -91
- package/build/Markup/utils/sanitise.js.map +0 -1
- package/build/Markup/utils/sanitise.mjs +0 -89
- package/build/Markup/utils/sanitise.mjs.map +0 -1
- package/build/styles/Markup/Markup.css +0 -28
- package/build/styles/Markup/_stories/Vulnerability/Vulnerability.css +0 -70
- package/build/types/Calendar/tableLink/TableLink.d.ts.map +0 -1
- package/build/types/Calendar/tableLink/index.d.ts.map +0 -1
- package/build/types/Markup/Markup.d.ts +0 -18
- package/build/types/Markup/Markup.d.ts.map +0 -1
- package/build/types/Markup/Markup.types.d.ts +0 -68
- package/build/types/Markup/Markup.types.d.ts.map +0 -1
- package/build/types/Markup/_stories/Vulnerability/Vulnerability.d.ts +0 -12
- package/build/types/Markup/_stories/Vulnerability/Vulnerability.d.ts.map +0 -1
- package/build/types/Markup/constants.d.ts +0 -20
- package/build/types/Markup/constants.d.ts.map +0 -1
- package/build/types/Markup/index.d.ts +0 -3
- package/build/types/Markup/index.d.ts.map +0 -1
- package/build/types/Markup/utils/parseMarkup.d.ts +0 -6
- package/build/types/Markup/utils/parseMarkup.d.ts.map +0 -1
- package/build/types/Markup/utils/sanitise.d.ts +0 -2
- package/build/types/Markup/utils/sanitise.d.ts.map +0 -1
- package/src/Markup/Markup.css +0 -28
- package/src/Markup/Markup.injection.test.tsx +0 -152
- package/src/Markup/Markup.less +0 -29
- package/src/Markup/Markup.test.tsx +0 -405
- package/src/Markup/Markup.tsx +0 -165
- package/src/Markup/Markup.types.ts +0 -53
- package/src/Markup/_stories/Markup.docs.mdx +0 -75
- package/src/Markup/_stories/Markup.security.docs.mdx +0 -256
- package/src/Markup/_stories/Markup.story.tsx +0 -227
- package/src/Markup/_stories/Vulnerability/Vulnerability.css +0 -70
- package/src/Markup/_stories/Vulnerability/Vulnerability.tsx +0 -30
- package/src/Markup/constants.ts +0 -41
- package/src/Markup/index.ts +0 -2
- package/src/Markup/utils/parseMarkup.test.ts +0 -658
- package/src/Markup/utils/parseMarkup.ts +0 -228
- package/src/Markup/utils/sanitise.test.ts +0 -375
- package/src/Markup/utils/sanitise.ts +0 -107
- /package/build/types/Calendar/{tableLink → TableLink}/index.d.ts +0 -0
- /package/src/Calendar/{tableLink → TableLink}/index.ts +0 -0
|
@@ -22,6 +22,7 @@ declare function customRender(ui: ReactElement, { locale, messages, ...renderOpt
|
|
|
22
22
|
"neptune.DateLookup.goTo20YearView": string;
|
|
23
23
|
"neptune.DateLookup.month": string;
|
|
24
24
|
"neptune.DateLookup.next": string;
|
|
25
|
+
"neptune.DateLookup.notAvailable": string;
|
|
25
26
|
"neptune.DateLookup.previous": string;
|
|
26
27
|
"neptune.DateLookup.selected": string;
|
|
27
28
|
"neptune.DateLookup.twentyYears": string;
|
|
@@ -110,6 +111,7 @@ declare function customRenderHook(callback: () => unknown, { locale, messages }?
|
|
|
110
111
|
"neptune.DateLookup.goTo20YearView": string;
|
|
111
112
|
"neptune.DateLookup.month": string;
|
|
112
113
|
"neptune.DateLookup.next": string;
|
|
114
|
+
"neptune.DateLookup.notAvailable": string;
|
|
113
115
|
"neptune.DateLookup.previous": string;
|
|
114
116
|
"neptune.DateLookup.selected": string;
|
|
115
117
|
"neptune.DateLookup.twentyYears": string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAc,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAMxD;;;;GAIG;AACH,iBAAS,YAAY,CACnB,EAAE,EAAE,YAAY,EAChB,EAAE,MAAuB,EAAE,QAAa,EAAE,GAAG,aAAa,EAAE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAc,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAMxD;;;;GAIG;AACH,iBAAS,YAAY,CACnB,EAAE,EAAE,YAAY,EAChB,EAAE,MAAuB,EAAE,QAAa,EAAE,GAAG,aAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,GAChE,UAAU,CAAC,OAAO,MAAM,CAAC,CAK3B;AAED;;;GAGG;AACH,iBAAS,gBAAgB,CACvB,QAAQ,EAAE,MAAM,OAAO,EACvB,EAAE,MAAuB,EAAE,QAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,uEAKhD;AAED,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,gBAAgB,IAAI,UAAU,EAAE,SAAS,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-1168b1c",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
"storybook-addon-tag-badges": "^3.1.0",
|
|
93
93
|
"storybook-addon-test-codegen": "^3.0.1",
|
|
94
94
|
"@transferwise/less-config": "3.1.2",
|
|
95
|
-
"@wise/
|
|
96
|
-
"@wise/
|
|
95
|
+
"@wise/components-theming": "1.10.3",
|
|
96
|
+
"@wise/wds-configs": "0.0.0"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"@transferwise/icons": "^3 || ^4",
|
|
@@ -1,32 +1,6 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
table-layout: fixed;
|
|
5
|
-
border: none;
|
|
6
|
-
background-color: inherit;
|
|
7
|
-
}
|
|
8
|
-
.tw-date-lookup-calendar thead {
|
|
9
|
-
background-color: transparent;
|
|
10
|
-
background-color: initial;
|
|
11
|
-
}
|
|
12
|
-
.tw-date-lookup-calendar > tbody > tr > td.weekend button {
|
|
13
|
-
color: #5d7079;
|
|
14
|
-
color: var(--color-content-secondary);
|
|
15
|
-
}
|
|
16
|
-
.tw-date-lookup-calendar > tbody > tr > td {
|
|
17
|
-
border: none;
|
|
18
|
-
padding: 4px;
|
|
19
|
-
padding: var(--size-4);
|
|
20
|
-
}
|
|
21
|
-
@media (max-width: 320px) {
|
|
22
|
-
.tw-date-lookup-calendar > tbody > tr > td {
|
|
23
|
-
padding: 0;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
.tw-date-lookup-calendar > tbody > tr > td:has(.tw-date-lookup-day-option) {
|
|
27
|
-
padding: 1px;
|
|
28
|
-
}
|
|
29
|
-
.tw-date-lookup-calendar > tbody > tr > td button {
|
|
1
|
+
.wds-Calendar__option--day,
|
|
2
|
+
.wds-Calendar__option--month,
|
|
3
|
+
.wds-Calendar__option--year {
|
|
30
4
|
width: 100%;
|
|
31
5
|
padding: 4px 0;
|
|
32
6
|
padding: var(--size-4) 0;
|
|
@@ -42,11 +16,78 @@
|
|
|
42
16
|
color: var(--color-content-primary);
|
|
43
17
|
}
|
|
44
18
|
@media (max-width: 320px) {
|
|
45
|
-
.
|
|
19
|
+
.wds-Calendar__option--day,
|
|
20
|
+
.wds-Calendar__option--month,
|
|
21
|
+
.wds-Calendar__option--year {
|
|
46
22
|
padding: 0;
|
|
47
23
|
}
|
|
48
24
|
}
|
|
49
|
-
.
|
|
25
|
+
.wds-Calendar__option--day.disabled,
|
|
26
|
+
.wds-Calendar__option--month.disabled,
|
|
27
|
+
.wds-Calendar__option--year.disabled,
|
|
28
|
+
.wds-Calendar__option--day[aria-disabled="true"],
|
|
29
|
+
.wds-Calendar__option--month[aria-disabled="true"],
|
|
30
|
+
.wds-Calendar__option--year[aria-disabled="true"] {
|
|
31
|
+
--ring-outline-color: var(--color-sentiment-content-primary);
|
|
32
|
+
color: #768e9c;
|
|
33
|
+
color: var(--color-content-tertiary);
|
|
34
|
+
cursor: not-allowed;
|
|
35
|
+
}
|
|
36
|
+
.wds-Calendar__option--day.disabled:hover,
|
|
37
|
+
.wds-Calendar__option--month.disabled:hover,
|
|
38
|
+
.wds-Calendar__option--year.disabled:hover,
|
|
39
|
+
.wds-Calendar__option--day[aria-disabled="true"]:hover,
|
|
40
|
+
.wds-Calendar__option--month[aria-disabled="true"]:hover,
|
|
41
|
+
.wds-Calendar__option--year[aria-disabled="true"]:hover,
|
|
42
|
+
.wds-Calendar__option--day.disabled:focus,
|
|
43
|
+
.wds-Calendar__option--month.disabled:focus,
|
|
44
|
+
.wds-Calendar__option--year.disabled:focus,
|
|
45
|
+
.wds-Calendar__option--day[aria-disabled="true"]:focus,
|
|
46
|
+
.wds-Calendar__option--month[aria-disabled="true"]:focus,
|
|
47
|
+
.wds-Calendar__option--year[aria-disabled="true"]:focus {
|
|
48
|
+
background-color: var(--color-sentiment-background-surface);
|
|
49
|
+
color: var(--color-sentiment-content-primary);
|
|
50
|
+
filter: initial;
|
|
51
|
+
opacity: 1;
|
|
52
|
+
opacity: initial;
|
|
53
|
+
}
|
|
54
|
+
.wds-Calendar__option--day.disabled.active,
|
|
55
|
+
.wds-Calendar__option--month.disabled.active,
|
|
56
|
+
.wds-Calendar__option--year.disabled.active,
|
|
57
|
+
.wds-Calendar__option--day[aria-disabled="true"].active,
|
|
58
|
+
.wds-Calendar__option--month[aria-disabled="true"].active,
|
|
59
|
+
.wds-Calendar__option--year[aria-disabled="true"].active,
|
|
60
|
+
.wds-Calendar__option--day.disabled.active:hover,
|
|
61
|
+
.wds-Calendar__option--month.disabled.active:hover,
|
|
62
|
+
.wds-Calendar__option--year.disabled.active:hover,
|
|
63
|
+
.wds-Calendar__option--day[aria-disabled="true"].active:hover,
|
|
64
|
+
.wds-Calendar__option--month[aria-disabled="true"].active:hover,
|
|
65
|
+
.wds-Calendar__option--year[aria-disabled="true"].active:hover,
|
|
66
|
+
.wds-Calendar__option--day.disabled.active:active,
|
|
67
|
+
.wds-Calendar__option--month.disabled.active:active,
|
|
68
|
+
.wds-Calendar__option--year.disabled.active:active,
|
|
69
|
+
.wds-Calendar__option--day[aria-disabled="true"].active:active,
|
|
70
|
+
.wds-Calendar__option--month[aria-disabled="true"].active:active,
|
|
71
|
+
.wds-Calendar__option--year[aria-disabled="true"].active:active,
|
|
72
|
+
.wds-Calendar__option--day.disabled.active:focus,
|
|
73
|
+
.wds-Calendar__option--month.disabled.active:focus,
|
|
74
|
+
.wds-Calendar__option--year.disabled.active:focus,
|
|
75
|
+
.wds-Calendar__option--day[aria-disabled="true"].active:focus,
|
|
76
|
+
.wds-Calendar__option--month[aria-disabled="true"].active:focus,
|
|
77
|
+
.wds-Calendar__option--year[aria-disabled="true"].active:focus {
|
|
78
|
+
background-color: var(--color-sentiment-interactive-primary);
|
|
79
|
+
color: var(--color-sentiment-interactive-secondary);
|
|
80
|
+
}
|
|
81
|
+
.wds-Calendar__option--day.disabled.today,
|
|
82
|
+
.wds-Calendar__option--month.disabled.today,
|
|
83
|
+
.wds-Calendar__option--year.disabled.today,
|
|
84
|
+
.wds-Calendar__option--day[aria-disabled="true"].today,
|
|
85
|
+
.wds-Calendar__option--month[aria-disabled="true"].today,
|
|
86
|
+
.wds-Calendar__option--year[aria-disabled="true"].today {
|
|
87
|
+
text-decoration-color: #768e9c;
|
|
88
|
+
text-decoration-color: var(--color-content-tertiary);
|
|
89
|
+
}
|
|
90
|
+
.wds-Calendar__option--day {
|
|
50
91
|
height: 40px;
|
|
51
92
|
height: var(--size-40);
|
|
52
93
|
border-radius: 9999px;
|
|
@@ -60,17 +101,45 @@
|
|
|
60
101
|
align-items: center;
|
|
61
102
|
justify-content: center;
|
|
62
103
|
}
|
|
63
|
-
.
|
|
104
|
+
.wds-Calendar__option--day.today {
|
|
64
105
|
-webkit-text-decoration: underline;
|
|
65
106
|
text-decoration: underline;
|
|
66
107
|
text-decoration-thickness: 2px;
|
|
67
108
|
text-underline-offset: 4px;
|
|
68
109
|
}
|
|
69
|
-
.tw-date-lookup-calendar
|
|
70
|
-
|
|
110
|
+
.tw-date-lookup-calendar {
|
|
111
|
+
min-width: 300px;
|
|
112
|
+
text-align: center;
|
|
113
|
+
table-layout: fixed;
|
|
114
|
+
border: none;
|
|
115
|
+
background-color: inherit;
|
|
116
|
+
}
|
|
117
|
+
.tw-date-lookup-calendar thead {
|
|
118
|
+
background-color: transparent;
|
|
119
|
+
background-color: initial;
|
|
120
|
+
}
|
|
121
|
+
.tw-date-lookup-calendar > tbody > tr > td.weekend button {
|
|
122
|
+
color: #5d7079;
|
|
123
|
+
color: var(--color-content-secondary);
|
|
124
|
+
}
|
|
125
|
+
.tw-date-lookup-calendar > tbody > tr > td {
|
|
126
|
+
border: none;
|
|
127
|
+
padding: 4px;
|
|
128
|
+
padding: var(--size-4);
|
|
129
|
+
}
|
|
130
|
+
@media (max-width: 320px) {
|
|
131
|
+
.tw-date-lookup-calendar > tbody > tr > td {
|
|
132
|
+
padding: 0;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
.tw-date-lookup-calendar > tbody > tr > td:has(.wds-Calendar__option--day) {
|
|
136
|
+
padding: 1px;
|
|
137
|
+
}
|
|
138
|
+
.tw-date-lookup-calendar > tbody > tr > td:not(.disabled):not(:disabled) button.show-focus:not(.disabled):not([aria-disabled="true"]),
|
|
139
|
+
.tw-date-lookup-calendar > tbody > tr > td:hover button:not(.disabled):not(:disabled):not([aria-disabled="true"]) {
|
|
71
140
|
background-color: var(--color-background-screen-hover);
|
|
72
141
|
}
|
|
73
|
-
.tw-date-lookup-calendar > tbody > tr > td:not(.disabled):not(:disabled) button.active {
|
|
142
|
+
.tw-date-lookup-calendar > tbody > tr > td:not(.disabled):not(:disabled) button.active:not([aria-disabled="true"]) {
|
|
74
143
|
background-color: var(--color-interactive-primary);
|
|
75
144
|
color: var(--color-interactive-contrast);
|
|
76
145
|
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { mockMatchMedia, render, screen, userEvent } from '../test-utils';
|
|
2
|
+
import Calendar from './Calendar';
|
|
3
|
+
import type { DisabledRules } from './Calendar.types';
|
|
4
|
+
|
|
5
|
+
mockMatchMedia();
|
|
6
|
+
|
|
7
|
+
const user = userEvent.setup();
|
|
8
|
+
|
|
9
|
+
// 2024-07-01 is a Monday
|
|
10
|
+
const initialValue = new Date(2024, 6, 1);
|
|
11
|
+
|
|
12
|
+
const weekendRules: DisabledRules = {
|
|
13
|
+
weekdays: ['sat', 'sun'],
|
|
14
|
+
reason: 'We are closed on weekends.',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const bankHolidayRules: DisabledRules = {
|
|
18
|
+
dates: [new Date(2024, 6, 4), new Date(2024, 6, 11)],
|
|
19
|
+
reason: 'The service is unavailable on bank holidays.',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const rangeRules: DisabledRules = {
|
|
23
|
+
ranges: [{ start: new Date(2024, 6, 15), end: new Date(2024, 6, 19) }],
|
|
24
|
+
reason: 'Scheduled maintenance.',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
describe('Calendar - disabled dates', () => {
|
|
28
|
+
describe('rendering disabled state', () => {
|
|
29
|
+
it('renders disabled weekday cells with aria-disabled', () => {
|
|
30
|
+
render(<Calendar value={initialValue} disabledRules={weekendRules} onChange={jest.fn()} />);
|
|
31
|
+
|
|
32
|
+
// 2024-07-06 is Saturday
|
|
33
|
+
const saturday = screen.getByLabelText(/^6 July 2024/u);
|
|
34
|
+
expect(saturday).toHaveAttribute('aria-disabled', 'true');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('renders enabled weekday cells without aria-disabled', () => {
|
|
38
|
+
render(<Calendar value={initialValue} disabledRules={weekendRules} onChange={jest.fn()} />);
|
|
39
|
+
|
|
40
|
+
// 2024-07-01 is Monday
|
|
41
|
+
const monday = screen.getByLabelText(/^1 July 2024.*selected/iu);
|
|
42
|
+
expect(monday).not.toHaveAttribute('aria-disabled');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('renders disabled specific date cells with aria-disabled', () => {
|
|
46
|
+
render(
|
|
47
|
+
<Calendar value={initialValue} disabledRules={bankHolidayRules} onChange={jest.fn()} />,
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const holiday = screen.getByLabelText(/^4 July 2024/u);
|
|
51
|
+
expect(holiday).toHaveAttribute('aria-disabled', 'true');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('renders disabled range cells with aria-disabled', () => {
|
|
55
|
+
render(<Calendar value={initialValue} disabledRules={rangeRules} onChange={jest.fn()} />);
|
|
56
|
+
|
|
57
|
+
const rangeDate = screen.getByLabelText(/16 July 2024/u);
|
|
58
|
+
expect(rangeDate).toHaveAttribute('aria-disabled', 'true');
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe('click interaction', () => {
|
|
63
|
+
it('fires onChange with isEnabled: false when clicking a disabled date', async () => {
|
|
64
|
+
const handleChange = jest.fn();
|
|
65
|
+
const handleSelect = jest.fn();
|
|
66
|
+
render(
|
|
67
|
+
<Calendar
|
|
68
|
+
value={initialValue}
|
|
69
|
+
disabledRules={bankHolidayRules}
|
|
70
|
+
onChange={handleChange}
|
|
71
|
+
onSelect={handleSelect}
|
|
72
|
+
/>,
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const holiday = screen.getByLabelText(/^4 July 2024/u);
|
|
76
|
+
await user.click(holiday);
|
|
77
|
+
|
|
78
|
+
expect(handleChange).toHaveBeenCalledWith(new Date(2024, 6, 4), { isEnabled: false });
|
|
79
|
+
expect(handleSelect).not.toHaveBeenCalled();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('fires onChange and onSelect when clicking an enabled date', async () => {
|
|
83
|
+
const handleChange = jest.fn();
|
|
84
|
+
const handleSelect = jest.fn();
|
|
85
|
+
render(
|
|
86
|
+
<Calendar
|
|
87
|
+
value={initialValue}
|
|
88
|
+
disabledRules={bankHolidayRules}
|
|
89
|
+
onChange={handleChange}
|
|
90
|
+
onSelect={handleSelect}
|
|
91
|
+
/>,
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const enabledDate = screen.getByLabelText(/^3 July 2024/u);
|
|
95
|
+
await user.click(enabledDate);
|
|
96
|
+
|
|
97
|
+
expect(handleChange).toHaveBeenCalledWith(new Date(2024, 6, 3), { isEnabled: true });
|
|
98
|
+
expect(handleSelect).toHaveBeenCalledWith(new Date(2024, 6, 3));
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
describe('keyboard navigation', () => {
|
|
103
|
+
it('does NOT skip disabled dates and fires onChange with isEnabled: false', async () => {
|
|
104
|
+
const handleChange = jest.fn();
|
|
105
|
+
render(
|
|
106
|
+
<Calendar
|
|
107
|
+
value={new Date(2024, 6, 5)}
|
|
108
|
+
disabledRules={weekendRules}
|
|
109
|
+
onChange={handleChange}
|
|
110
|
+
/>,
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
await user.click(screen.getByRole('button', { name: /selected day/iu }));
|
|
114
|
+
// ArrowRight from July 5 (Friday) should go to July 6 (Saturday = disabled)
|
|
115
|
+
await user.keyboard('{ArrowRight}');
|
|
116
|
+
|
|
117
|
+
expect(handleChange).toHaveBeenCalledWith(new Date(2024, 6, 6), { isEnabled: false });
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('fires onChange with isEnabled: true when navigating to an enabled date', async () => {
|
|
121
|
+
const handleChange = jest.fn();
|
|
122
|
+
render(
|
|
123
|
+
<Calendar
|
|
124
|
+
value={new Date(2024, 6, 1)}
|
|
125
|
+
disabledRules={weekendRules}
|
|
126
|
+
onChange={handleChange}
|
|
127
|
+
/>,
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
await user.click(screen.getByRole('button', { name: /selected day/iu }));
|
|
131
|
+
// ArrowRight from July 1 (Monday) → July 2 (Tuesday = enabled)
|
|
132
|
+
await user.keyboard('{ArrowRight}');
|
|
133
|
+
|
|
134
|
+
expect(handleChange).toHaveBeenCalledWith(new Date(2024, 6, 2), { isEnabled: true });
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
describe('InlinePrompt', () => {
|
|
139
|
+
it('renders reason text when month has disabled dates', () => {
|
|
140
|
+
render(<Calendar value={initialValue} disabledRules={weekendRules} onChange={jest.fn()} />);
|
|
141
|
+
|
|
142
|
+
expect(screen.getByText('We are closed on weekends.')).toBeInTheDocument();
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('does not render when no disabledRules provided', () => {
|
|
146
|
+
render(<Calendar value={initialValue} onChange={jest.fn()} />);
|
|
147
|
+
|
|
148
|
+
expect(screen.queryByText(/closed/iu)).not.toBeInTheDocument();
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('renders with neutral sentiment by default', () => {
|
|
152
|
+
const { container } = render(
|
|
153
|
+
<Calendar value={initialValue} disabledRules={weekendRules} onChange={jest.fn()} />,
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
const prompt = container.querySelector('.wds-inline-prompt');
|
|
157
|
+
expect(prompt).toBeInTheDocument();
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('does not render in month view', async () => {
|
|
161
|
+
render(<Calendar value={initialValue} disabledRules={weekendRules} onChange={jest.fn()} />);
|
|
162
|
+
|
|
163
|
+
await user.click(screen.getByRole('button', { name: /year view/iu }));
|
|
164
|
+
await user.keyboard(' ');
|
|
165
|
+
|
|
166
|
+
expect(screen.queryByText('We are closed on weekends.')).not.toBeInTheDocument();
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
describe('accessibility', () => {
|
|
171
|
+
it('disabled cells announce "not available" in aria-label', () => {
|
|
172
|
+
render(<Calendar value={initialValue} disabledRules={weekendRules} onChange={jest.fn()} />);
|
|
173
|
+
|
|
174
|
+
const saturday = screen.getByLabelText(/6 July 2024.*not available/iu);
|
|
175
|
+
expect(saturday).toBeInTheDocument();
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('disabled cells have aria-describedby pointing to the reason prompt', () => {
|
|
179
|
+
render(<Calendar value={initialValue} disabledRules={weekendRules} onChange={jest.fn()} />);
|
|
180
|
+
|
|
181
|
+
const saturday = screen.getByLabelText(/6 July 2024.*not available/iu);
|
|
182
|
+
expect(saturday).toHaveAttribute('aria-describedby');
|
|
183
|
+
|
|
184
|
+
const describedById = saturday.getAttribute('aria-describedby')!;
|
|
185
|
+
const promptElement = document.getElementById(describedById);
|
|
186
|
+
expect(promptElement).toBeInTheDocument();
|
|
187
|
+
expect(promptElement).toHaveTextContent('We are closed on weekends.');
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it('enabled cells do NOT have aria-describedby', () => {
|
|
191
|
+
render(<Calendar value={initialValue} disabledRules={weekendRules} onChange={jest.fn()} />);
|
|
192
|
+
|
|
193
|
+
const monday = screen.getByLabelText(/^1 July 2024.*selected/iu);
|
|
194
|
+
expect(monday).not.toHaveAttribute('aria-describedby');
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import (reference) "./../styles/variables/neptune-tokens.less";
|
|
2
|
+
@import "./TableLink/TableLink.less";
|
|
2
3
|
|
|
3
4
|
.tw-date-lookup-calendar {
|
|
4
5
|
min-width: 300px;
|
|
@@ -21,47 +22,16 @@
|
|
|
21
22
|
padding: 0;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
&:has(.
|
|
25
|
+
&:has(.wds-Calendar__option--day) {
|
|
25
26
|
padding: 1px;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
button
|
|
29
|
-
|
|
30
|
-
padding: var(--size-4) 0;
|
|
31
|
-
@media (--screen-400-zoom) {
|
|
32
|
-
padding: 0;
|
|
33
|
-
}
|
|
34
|
-
color: var(--color-content-accent);
|
|
35
|
-
border: transparent;
|
|
36
|
-
border-radius: var(--radius-small);
|
|
37
|
-
background-color: transparent;
|
|
38
|
-
font-weight: var(--font-weight-semi-bold);
|
|
39
|
-
color: var(--color-content-primary);
|
|
40
|
-
|
|
41
|
-
&.tw-date-lookup-day-option {
|
|
42
|
-
height: var(--size-40);
|
|
43
|
-
border-radius: var(--radius-full);
|
|
44
|
-
line-height: var(--size-40);
|
|
45
|
-
width: var(--size-40);
|
|
46
|
-
padding: 0;
|
|
47
|
-
display: inline-flex;
|
|
48
|
-
align-items: center;
|
|
49
|
-
justify-content: center;
|
|
50
|
-
|
|
51
|
-
&.today {
|
|
52
|
-
text-decoration: underline;
|
|
53
|
-
text-decoration-thickness: 2px;
|
|
54
|
-
text-underline-offset: 4px;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&:not(.disabled, :disabled) button.show-focus,
|
|
60
|
-
&:hover button:not(.disabled, :disabled) {
|
|
29
|
+
&:not(.disabled, :disabled) button.show-focus:not(.disabled, [aria-disabled="true"]),
|
|
30
|
+
&:hover button:not(.disabled, :disabled, [aria-disabled="true"]) {
|
|
61
31
|
background-color: var(--color-background-screen-hover);
|
|
62
32
|
}
|
|
63
33
|
|
|
64
|
-
&:not(.disabled, :disabled) button.active {
|
|
34
|
+
&:not(.disabled, :disabled) button.active:not([aria-disabled="true"]) {
|
|
65
35
|
background-color: var(--color-interactive-primary);
|
|
66
36
|
color: var(--color-interactive-contrast);
|
|
67
37
|
}
|
|
@@ -36,6 +36,11 @@ export default defineMessages({
|
|
|
36
36
|
defaultMessage: 'selected',
|
|
37
37
|
description: 'Description of the selected day/month/year',
|
|
38
38
|
},
|
|
39
|
+
notAvailable: {
|
|
40
|
+
id: 'neptune.DateLookup.notAvailable',
|
|
41
|
+
defaultMessage: 'not available',
|
|
42
|
+
description: 'Announces that a date is disabled/unavailable',
|
|
43
|
+
},
|
|
39
44
|
goTo20YearView: {
|
|
40
45
|
id: 'neptune.DateLookup.goTo20YearView',
|
|
41
46
|
defaultMessage: 'Go to 20 year view',
|
|
@@ -23,7 +23,7 @@ describe('Calendar', () => {
|
|
|
23
23
|
|
|
24
24
|
const expected = new Date(initialValue);
|
|
25
25
|
expected.setDate(initialValue.getDate() + step);
|
|
26
|
-
expect(handleChange).toHaveBeenCalledWith(expected);
|
|
26
|
+
expect(handleChange).toHaveBeenCalledWith(expected, { isEnabled: true });
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
it('selects a day on click', async () => {
|
|
@@ -32,18 +32,18 @@ describe('Calendar', () => {
|
|
|
32
32
|
|
|
33
33
|
await user.click(screen.getByText('15'));
|
|
34
34
|
|
|
35
|
-
expect(handleChange).toHaveBeenCalledWith(new Date(2000, 0, 15));
|
|
35
|
+
expect(handleChange).toHaveBeenCalledWith(new Date(2000, 0, 15), { isEnabled: true });
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
it('
|
|
38
|
+
it('fires both onChange and onSelect when clicking a day', async () => {
|
|
39
39
|
const handleChange = jest.fn();
|
|
40
40
|
const handleSelect = jest.fn();
|
|
41
41
|
render(<Calendar value={initialValue} onChange={handleChange} onSelect={handleSelect} />);
|
|
42
42
|
|
|
43
43
|
await user.click(screen.getByText('15'));
|
|
44
44
|
|
|
45
|
+
expect(handleChange).toHaveBeenCalledWith(new Date(2000, 0, 15), { isEnabled: true });
|
|
45
46
|
expect(handleSelect).toHaveBeenCalledWith(new Date(2000, 0, 15));
|
|
46
|
-
expect(handleChange).not.toHaveBeenCalled();
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -62,7 +62,7 @@ describe('Calendar', () => {
|
|
|
62
62
|
|
|
63
63
|
const expected = new Date(initialValue);
|
|
64
64
|
expected.setFullYear(initialValue.getFullYear() + step);
|
|
65
|
-
expect(handleChange).toHaveBeenCalledWith(expected);
|
|
65
|
+
expect(handleChange).toHaveBeenCalledWith(expected, { isEnabled: true });
|
|
66
66
|
});
|
|
67
67
|
});
|
|
68
68
|
|
|
@@ -82,7 +82,7 @@ describe('Calendar', () => {
|
|
|
82
82
|
|
|
83
83
|
const expected = new Date(initialValue);
|
|
84
84
|
expected.setMonth(initialValue.getMonth() + step);
|
|
85
|
-
expect(handleChange).toHaveBeenCalledWith(expected);
|
|
85
|
+
expect(handleChange).toHaveBeenCalledWith(expected, { isEnabled: true });
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
88
|
|
|
@@ -96,7 +96,7 @@ describe('Calendar', () => {
|
|
|
96
96
|
await user.click(screen.getByRole('button', { name: /selected day/iu }));
|
|
97
97
|
await user.keyboard('{ArrowLeft}{ArrowLeft}');
|
|
98
98
|
|
|
99
|
-
expect(handleChange).toHaveBeenLastCalledWith(min);
|
|
99
|
+
expect(handleChange).toHaveBeenLastCalledWith(min, { isEnabled: true });
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
it('limits navigation to max value', async () => {
|
|
@@ -108,7 +108,7 @@ describe('Calendar', () => {
|
|
|
108
108
|
await user.click(screen.getByRole('button', { name: /selected day/iu }));
|
|
109
109
|
await user.keyboard('{ArrowRight}{ArrowRight}');
|
|
110
110
|
|
|
111
|
-
expect(handleChange).toHaveBeenLastCalledWith(max);
|
|
111
|
+
expect(handleChange).toHaveBeenLastCalledWith(max, { isEnabled: true });
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
it('clamps value to range when value is outside min/max', () => {
|
|
@@ -117,7 +117,7 @@ describe('Calendar', () => {
|
|
|
117
117
|
const handleChange = jest.fn();
|
|
118
118
|
render(<Calendar value={initialValue} min={min} max={max} onChange={handleChange} />);
|
|
119
119
|
|
|
120
|
-
expect(handleChange).toHaveBeenCalledWith(min);
|
|
120
|
+
expect(handleChange).toHaveBeenCalledWith(min, { isEnabled: true });
|
|
121
121
|
});
|
|
122
122
|
});
|
|
123
123
|
|