From 37a90dd41190828992c85c9880337baeb23615f7 Mon Sep 17 00:00:00 2001 From: Nick Lyons Date: Thu, 22 Feb 2024 11:16:19 -0500 Subject: [PATCH] Updated uswds assets with gulp --- assets/img/lib/uswds/icon-dot-gov.svg | 2 +- assets/img/lib/uswds/sprite.svg | 2 +- assets/img/lib/uswds/us_flag_small.png | Bin 545 -> 244 bytes .../uswds/usa-icons/accessible_forward.svg | 2 +- .../lib/uswds/usa-icons/account_balance.svg | 2 +- .../img/lib/uswds/usa-icons/account_box.svg | 2 +- .../lib/uswds/usa-icons/account_circle.svg | 2 +- assets/img/lib/uswds/usa-icons/alarm.svg | 2 +- .../lib/uswds/usa-icons/alternate_email.svg | 2 +- .../img/lib/uswds/usa-icons/announcement.svg | 2 +- .../lib/uswds/usa-icons/arrow_drop_down.svg | 2 +- .../img/lib/uswds/usa-icons/arrow_drop_up.svg | 2 +- .../img/lib/uswds/usa-icons/arrow_forward.svg | 2 +- assets/img/lib/uswds/usa-icons/assessment.svg | 2 +- assets/img/lib/uswds/usa-icons/backpack.svg | 2 +- assets/img/lib/uswds/usa-icons/bathtub.svg | 2 +- assets/img/lib/uswds/usa-icons/bookmark.svg | 2 +- assets/img/lib/uswds/usa-icons/bug_report.svg | 2 +- assets/img/lib/uswds/usa-icons/build.svg | 2 +- .../lib/uswds/usa-icons/calendar_today.svg | 2 +- assets/img/lib/uswds/usa-icons/campaign.svg | 2 +- assets/img/lib/uswds/usa-icons/cancel.svg | 2 +- assets/img/lib/uswds/usa-icons/chat.svg | 2 +- assets/img/lib/uswds/usa-icons/check.svg | 2 +- .../img/lib/uswds/usa-icons/check_circle.svg | 2 +- .../uswds/usa-icons/check_circle_outline.svg | 2 +- .../img/lib/uswds/usa-icons/clean_hands.svg | 2 +- assets/img/lib/uswds/usa-icons/close.svg | 2 +- .../lib/uswds/usa-icons/closed_caption.svg | 2 +- assets/img/lib/uswds/usa-icons/cloud.svg | 2 +- assets/img/lib/uswds/usa-icons/comment.svg | 2 +- .../img/lib/uswds/usa-icons/contact_page.svg | 2 +- .../img/lib/uswds/usa-icons/coronavirus.svg | 2 +- assets/img/lib/uswds/usa-icons/deck.svg | 2 +- assets/img/lib/uswds/usa-icons/delete.svg | 2 +- .../lib/uswds/usa-icons/device_thermostat.svg | 2 +- assets/img/lib/uswds/usa-icons/directions.svg | 2 +- .../lib/uswds/usa-icons/directions_bus.svg | 2 +- .../lib/uswds/usa-icons/directions_car.svg | 2 +- .../lib/uswds/usa-icons/directions_walk.svg | 2 +- .../img/lib/uswds/usa-icons/do_not_touch.svg | 2 +- assets/img/lib/uswds/usa-icons/edit.svg | 2 +- .../img/lib/uswds/usa-icons/emoji_events.svg | 2 +- .../img/lib/uswds/usa-icons/error_outline.svg | 2 +- assets/img/lib/uswds/usa-icons/event.svg | 2 +- .../img/lib/uswds/usa-icons/expand_less.svg | 2 +- .../img/lib/uswds/usa-icons/expand_more.svg | 2 +- .../img/lib/uswds/usa-icons/fast_forward.svg | 2 +- .../img/lib/uswds/usa-icons/fast_rewind.svg | 2 +- assets/img/lib/uswds/usa-icons/fax.svg | 2 +- .../img/lib/uswds/usa-icons/file_download.svg | 2 +- .../img/lib/uswds/usa-icons/file_present.svg | 2 +- .../img/lib/uswds/usa-icons/file_upload.svg | 2 +- assets/img/lib/uswds/usa-icons/filter_alt.svg | 2 +- .../img/lib/uswds/usa-icons/fingerprint.svg | 2 +- assets/img/lib/uswds/usa-icons/first_page.svg | 2 +- assets/img/lib/uswds/usa-icons/flag.svg | 2 +- assets/img/lib/uswds/usa-icons/flickr.svg | 2 +- assets/img/lib/uswds/usa-icons/folder.svg | 2 +- .../img/lib/uswds/usa-icons/format_quote.svg | 2 +- assets/img/lib/uswds/usa-icons/forum.svg | 2 +- assets/img/lib/uswds/usa-icons/grid_view.svg | 2 +- assets/img/lib/uswds/usa-icons/group_add.svg | 2 +- assets/img/lib/uswds/usa-icons/groups.svg | 2 +- assets/img/lib/uswds/usa-icons/history.svg | 2 +- assets/img/lib/uswds/usa-icons/home.svg | 2 +- assets/img/lib/uswds/usa-icons/hotel.svg | 2 +- assets/img/lib/uswds/usa-icons/image.svg | 2 +- assets/img/lib/uswds/usa-icons/info.svg | 2 +- assets/img/lib/uswds/usa-icons/instagram.svg | 2 +- assets/img/lib/uswds/usa-icons/keyboard.svg | 2 +- assets/img/lib/uswds/usa-icons/label.svg | 2 +- assets/img/lib/uswds/usa-icons/language.svg | 2 +- assets/img/lib/uswds/usa-icons/last_page.svg | 2 +- assets/img/lib/uswds/usa-icons/lightbulb.svg | 2 +- assets/img/lib/uswds/usa-icons/link.svg | 2 +- assets/img/lib/uswds/usa-icons/link_off.svg | 2 +- assets/img/lib/uswds/usa-icons/list.svg | 2 +- assets/img/lib/uswds/usa-icons/local_cafe.svg | 2 +- .../uswds/usa-icons/local_fire_department.svg | 2 +- .../lib/uswds/usa-icons/local_gas_station.svg | 2 +- .../uswds/usa-icons/local_grocery_store.svg | 2 +- .../lib/uswds/usa-icons/local_hospital.svg | 2 +- .../uswds/usa-icons/local_laundry_service.svg | 2 +- .../img/lib/uswds/usa-icons/local_library.svg | 2 +- .../img/lib/uswds/usa-icons/local_offer.svg | 2 +- .../lib/uswds/usa-icons/local_pharmacy.svg | 2 +- .../img/lib/uswds/usa-icons/local_police.svg | 2 +- assets/img/lib/uswds/usa-icons/local_taxi.svg | 2 +- .../img/lib/uswds/usa-icons/location_on.svg | 2 +- assets/img/lib/uswds/usa-icons/lock.svg | 2 +- assets/img/lib/uswds/usa-icons/lock_open.svg | 2 +- assets/img/lib/uswds/usa-icons/logout.svg | 2 +- assets/img/lib/uswds/usa-icons/mail.svg | 2 +- assets/img/lib/uswds/usa-icons/map.svg | 2 +- assets/img/lib/uswds/usa-icons/masks.svg | 2 +- .../lib/uswds/usa-icons/medical_services.svg | 2 +- .../img/lib/uswds/usa-icons/military_tech.svg | 2 +- .../lib/uswds/usa-icons/navigate_before.svg | 2 +- .../img/lib/uswds/usa-icons/navigate_next.svg | 2 +- assets/img/lib/uswds/usa-icons/near_me.svg | 2 +- .../img/lib/uswds/usa-icons/notifications.svg | 2 +- .../uswds/usa-icons/notifications_active.svg | 2 +- .../lib/uswds/usa-icons/notifications_off.svg | 2 +- assets/img/lib/uswds/usa-icons/park.svg | 2 +- assets/img/lib/uswds/usa-icons/people.svg | 2 +- assets/img/lib/uswds/usa-icons/person.svg | 2 +- assets/img/lib/uswds/usa-icons/phone.svg | 2 +- .../img/lib/uswds/usa-icons/photo_camera.svg | 2 +- assets/img/lib/uswds/usa-icons/print.svg | 2 +- assets/img/lib/uswds/usa-icons/public.svg | 2 +- assets/img/lib/uswds/usa-icons/push_pin.svg | 2 +- assets/img/lib/uswds/usa-icons/report.svg | 2 +- assets/img/lib/uswds/usa-icons/restaurant.svg | 2 +- assets/img/lib/uswds/usa-icons/sanitizer.svg | 2 +- assets/img/lib/uswds/usa-icons/save_alt.svg | 2 +- assets/img/lib/uswds/usa-icons/schedule.svg | 2 +- assets/img/lib/uswds/usa-icons/school.svg | 2 +- assets/img/lib/uswds/usa-icons/science.svg | 2 +- assets/img/lib/uswds/usa-icons/send.svg | 2 +- .../usa-icons/sentiment_dissatisfied.svg | 2 +- .../lib/uswds/usa-icons/sentiment_neutral.svg | 2 +- .../uswds/usa-icons/sentiment_satisfied.svg | 2 +- .../usa-icons/sentiment_satisfied_alt.svg | 2 +- .../usa-icons/sentiment_very_dissatisfied.svg | 2 +- assets/img/lib/uswds/usa-icons/settings.svg | 2 +- assets/img/lib/uswds/usa-icons/share.svg | 2 +- assets/img/lib/uswds/usa-icons/shield.svg | 2 +- .../lib/uswds/usa-icons/shopping_basket.svg | 2 +- assets/img/lib/uswds/usa-icons/soap.svg | 2 +- .../lib/uswds/usa-icons/social_distance.svg | 2 +- assets/img/lib/uswds/usa-icons/star.svg | 2 +- assets/img/lib/uswds/usa-icons/store.svg | 2 +- .../lib/uswds/usa-icons/thumb_down_alt.svg | 2 +- .../img/lib/uswds/usa-icons/thumb_up_alt.svg | 2 +- assets/img/lib/uswds/usa-icons/timer.svg | 2 +- assets/img/lib/uswds/usa-icons/toggle_off.svg | 2 +- assets/img/lib/uswds/usa-icons/toggle_on.svg | 2 +- assets/img/lib/uswds/usa-icons/topic.svg | 2 +- .../img/lib/uswds/usa-icons/trending_down.svg | 2 +- .../img/lib/uswds/usa-icons/trending_up.svg | 2 +- assets/img/lib/uswds/usa-icons/twitter.svg | 2 +- assets/img/lib/uswds/usa-icons/update.svg | 2 +- .../img/lib/uswds/usa-icons/upload_file.svg | 2 +- assets/img/lib/uswds/usa-icons/verified.svg | 2 +- .../img/lib/uswds/usa-icons/verified_user.svg | 2 +- assets/img/lib/uswds/usa-icons/visibility.svg | 2 +- .../lib/uswds/usa-icons/visibility_off.svg | 2 +- assets/img/lib/uswds/usa-icons/volume_off.svg | 2 +- assets/img/lib/uswds/usa-icons/wash.svg | 2 +- assets/img/lib/uswds/usa-icons/youtube.svg | 2 +- assets/img/lib/uswds/usa-icons/zoom_in.svg | 2 +- assets/js/lib/uswds/uswds-init.min.js.map | 2 +- assets/js/lib/uswds/uswds.js | 7468 +++++++++-------- assets/js/lib/uswds/uswds.min.js | 86 +- assets/js/lib/uswds/uswds.min.js.map | 2 +- 156 files changed, 4104 insertions(+), 3756 deletions(-) diff --git a/assets/img/lib/uswds/icon-dot-gov.svg b/assets/img/lib/uswds/icon-dot-gov.svg index 3bf0478..3dac7cd 100644 --- a/assets/img/lib/uswds/icon-dot-gov.svg +++ b/assets/img/lib/uswds/icon-dot-gov.svg @@ -1 +1 @@ -icon-dot-gov \ No newline at end of file +icon-dot-gov \ No newline at end of file diff --git a/assets/img/lib/uswds/sprite.svg b/assets/img/lib/uswds/sprite.svg index 694c9a0..4670218 100644 --- a/assets/img/lib/uswds/sprite.svg +++ b/assets/img/lib/uswds/sprite.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/us_flag_small.png b/assets/img/lib/uswds/us_flag_small.png index 7d61cd6c4c38b69f815536e62a9b90235a579620..75350bab32cc00cf706324a48f375589228aae54 100644 GIT binary patch delta 228 zcmZ3;@`Z7NL_G^L0|SG4;o>tuim^Dz-HBn{IhmJ0j&y)ei0l9V{~tIg+_ncI`P+8# zx9sHQOg70GZ2m8WP_sx0bKH zQhoiE$Lc4B{ehcS8I=bgO_g&uc_)~5aSdbQ`_jJHSGx?AOiqb32yqZ{d6YA zd>Kpav?NBgsKqxp8!NB>Q&wj=mg$um^FGC?g4v64ok8lqynb%|O7`-j4EJX2Wd7K? co$(>Fijb|vLDs|1fo@{(boFyt=akR{0GHoby|K#ggvm>&U>cv7h@-A}f$@ks9Hd=IhI#1!QwDFt%qh zumD+%Kr98s3=B*QnBXD~3z*?-9gw7D^si$;#Zx?8978f#-_G>)V>aYzO*T0l*Lbc? znjt!m!M$;_X#KT69lCQE#8%k4iSq<4Rl7ggV|L_{K$Y^RJNks5Th@6VJEtF>_}_T* zUWr2{s**xmH}EZLpa1=6?VG)SmxhM4@0p)6d8VI*w_2^2oI~~t(|5j+V~lQMS1Gwt^lZzGdJ&U(;`|r0oD84e z`#oPaY5Uv>v;DqvR4{OTc^U2OP-N(C&N^oUOL)!+(FZNv=Fc0OH~f;b*kPmoa+MlPH$fx zuy(5M*W0#C-%5?;c*FKdFF196?fseB%>8~gvrg_Qs@?5=fLUOUw8 \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/account_balance.svg b/assets/img/lib/uswds/usa-icons/account_balance.svg index dbfc7b5..923f730 100644 --- a/assets/img/lib/uswds/usa-icons/account_balance.svg +++ b/assets/img/lib/uswds/usa-icons/account_balance.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/account_box.svg b/assets/img/lib/uswds/usa-icons/account_box.svg index 3875711..e74d64c 100644 --- a/assets/img/lib/uswds/usa-icons/account_box.svg +++ b/assets/img/lib/uswds/usa-icons/account_box.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/account_circle.svg b/assets/img/lib/uswds/usa-icons/account_circle.svg index 97f171e..7ba7670 100644 --- a/assets/img/lib/uswds/usa-icons/account_circle.svg +++ b/assets/img/lib/uswds/usa-icons/account_circle.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/alarm.svg b/assets/img/lib/uswds/usa-icons/alarm.svg index da87b0b..ec1cfbd 100644 --- a/assets/img/lib/uswds/usa-icons/alarm.svg +++ b/assets/img/lib/uswds/usa-icons/alarm.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/alternate_email.svg b/assets/img/lib/uswds/usa-icons/alternate_email.svg index d7c2a9e..d66771b 100644 --- a/assets/img/lib/uswds/usa-icons/alternate_email.svg +++ b/assets/img/lib/uswds/usa-icons/alternate_email.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/announcement.svg b/assets/img/lib/uswds/usa-icons/announcement.svg index 6fe3f65..fd7463c 100644 --- a/assets/img/lib/uswds/usa-icons/announcement.svg +++ b/assets/img/lib/uswds/usa-icons/announcement.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/arrow_drop_down.svg b/assets/img/lib/uswds/usa-icons/arrow_drop_down.svg index eb674c7..1c2f14e 100644 --- a/assets/img/lib/uswds/usa-icons/arrow_drop_down.svg +++ b/assets/img/lib/uswds/usa-icons/arrow_drop_down.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/arrow_drop_up.svg b/assets/img/lib/uswds/usa-icons/arrow_drop_up.svg index 047b26d..32782e6 100644 --- a/assets/img/lib/uswds/usa-icons/arrow_drop_up.svg +++ b/assets/img/lib/uswds/usa-icons/arrow_drop_up.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/arrow_forward.svg b/assets/img/lib/uswds/usa-icons/arrow_forward.svg index f8e01f0..453d0c7 100644 --- a/assets/img/lib/uswds/usa-icons/arrow_forward.svg +++ b/assets/img/lib/uswds/usa-icons/arrow_forward.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/assessment.svg b/assets/img/lib/uswds/usa-icons/assessment.svg index 79a203c..cc7768b 100644 --- a/assets/img/lib/uswds/usa-icons/assessment.svg +++ b/assets/img/lib/uswds/usa-icons/assessment.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/backpack.svg b/assets/img/lib/uswds/usa-icons/backpack.svg index 70107b2..1f7260c 100644 --- a/assets/img/lib/uswds/usa-icons/backpack.svg +++ b/assets/img/lib/uswds/usa-icons/backpack.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/bathtub.svg b/assets/img/lib/uswds/usa-icons/bathtub.svg index 9d68351..4ca3908 100644 --- a/assets/img/lib/uswds/usa-icons/bathtub.svg +++ b/assets/img/lib/uswds/usa-icons/bathtub.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/bookmark.svg b/assets/img/lib/uswds/usa-icons/bookmark.svg index 812bffe..1d507a6 100644 --- a/assets/img/lib/uswds/usa-icons/bookmark.svg +++ b/assets/img/lib/uswds/usa-icons/bookmark.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/bug_report.svg b/assets/img/lib/uswds/usa-icons/bug_report.svg index bb2f0cc..daa8b32 100644 --- a/assets/img/lib/uswds/usa-icons/bug_report.svg +++ b/assets/img/lib/uswds/usa-icons/bug_report.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/build.svg b/assets/img/lib/uswds/usa-icons/build.svg index 8f86dd7..26ead66 100644 --- a/assets/img/lib/uswds/usa-icons/build.svg +++ b/assets/img/lib/uswds/usa-icons/build.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/calendar_today.svg b/assets/img/lib/uswds/usa-icons/calendar_today.svg index ff50b1c..9c40555 100644 --- a/assets/img/lib/uswds/usa-icons/calendar_today.svg +++ b/assets/img/lib/uswds/usa-icons/calendar_today.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/campaign.svg b/assets/img/lib/uswds/usa-icons/campaign.svg index 7729d99..5543378 100644 --- a/assets/img/lib/uswds/usa-icons/campaign.svg +++ b/assets/img/lib/uswds/usa-icons/campaign.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/cancel.svg b/assets/img/lib/uswds/usa-icons/cancel.svg index 57e4934..d6e55da 100644 --- a/assets/img/lib/uswds/usa-icons/cancel.svg +++ b/assets/img/lib/uswds/usa-icons/cancel.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/chat.svg b/assets/img/lib/uswds/usa-icons/chat.svg index 44cb248..1c68f72 100644 --- a/assets/img/lib/uswds/usa-icons/chat.svg +++ b/assets/img/lib/uswds/usa-icons/chat.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/check.svg b/assets/img/lib/uswds/usa-icons/check.svg index 5e3f01e..8676ca3 100644 --- a/assets/img/lib/uswds/usa-icons/check.svg +++ b/assets/img/lib/uswds/usa-icons/check.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/check_circle.svg b/assets/img/lib/uswds/usa-icons/check_circle.svg index da63d36..1775c86 100644 --- a/assets/img/lib/uswds/usa-icons/check_circle.svg +++ b/assets/img/lib/uswds/usa-icons/check_circle.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/check_circle_outline.svg b/assets/img/lib/uswds/usa-icons/check_circle_outline.svg index da63d36..5621f73 100644 --- a/assets/img/lib/uswds/usa-icons/check_circle_outline.svg +++ b/assets/img/lib/uswds/usa-icons/check_circle_outline.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/clean_hands.svg b/assets/img/lib/uswds/usa-icons/clean_hands.svg index 72e8df4..5e03fa5 100644 --- a/assets/img/lib/uswds/usa-icons/clean_hands.svg +++ b/assets/img/lib/uswds/usa-icons/clean_hands.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/close.svg b/assets/img/lib/uswds/usa-icons/close.svg index f8d2e82..c3f7c2f 100644 --- a/assets/img/lib/uswds/usa-icons/close.svg +++ b/assets/img/lib/uswds/usa-icons/close.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/closed_caption.svg b/assets/img/lib/uswds/usa-icons/closed_caption.svg index ff6bbc0..1c59819 100644 --- a/assets/img/lib/uswds/usa-icons/closed_caption.svg +++ b/assets/img/lib/uswds/usa-icons/closed_caption.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/cloud.svg b/assets/img/lib/uswds/usa-icons/cloud.svg index 1e365ca..a055f2c 100644 --- a/assets/img/lib/uswds/usa-icons/cloud.svg +++ b/assets/img/lib/uswds/usa-icons/cloud.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/comment.svg b/assets/img/lib/uswds/usa-icons/comment.svg index 0840de5..db645e8 100644 --- a/assets/img/lib/uswds/usa-icons/comment.svg +++ b/assets/img/lib/uswds/usa-icons/comment.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/contact_page.svg b/assets/img/lib/uswds/usa-icons/contact_page.svg index eb74771..2f2a807 100644 --- a/assets/img/lib/uswds/usa-icons/contact_page.svg +++ b/assets/img/lib/uswds/usa-icons/contact_page.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/coronavirus.svg b/assets/img/lib/uswds/usa-icons/coronavirus.svg index 490d231..cbfb0d7 100644 --- a/assets/img/lib/uswds/usa-icons/coronavirus.svg +++ b/assets/img/lib/uswds/usa-icons/coronavirus.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/deck.svg b/assets/img/lib/uswds/usa-icons/deck.svg index 106bed2..7fe3137 100644 --- a/assets/img/lib/uswds/usa-icons/deck.svg +++ b/assets/img/lib/uswds/usa-icons/deck.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/delete.svg b/assets/img/lib/uswds/usa-icons/delete.svg index 14508a2..0969a4d 100644 --- a/assets/img/lib/uswds/usa-icons/delete.svg +++ b/assets/img/lib/uswds/usa-icons/delete.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/device_thermostat.svg b/assets/img/lib/uswds/usa-icons/device_thermostat.svg index 4611d9f..f66abea 100644 --- a/assets/img/lib/uswds/usa-icons/device_thermostat.svg +++ b/assets/img/lib/uswds/usa-icons/device_thermostat.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/directions.svg b/assets/img/lib/uswds/usa-icons/directions.svg index dd86550..9ae0683 100644 --- a/assets/img/lib/uswds/usa-icons/directions.svg +++ b/assets/img/lib/uswds/usa-icons/directions.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/directions_bus.svg b/assets/img/lib/uswds/usa-icons/directions_bus.svg index ff65dcd..ade3c4d 100644 --- a/assets/img/lib/uswds/usa-icons/directions_bus.svg +++ b/assets/img/lib/uswds/usa-icons/directions_bus.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/directions_car.svg b/assets/img/lib/uswds/usa-icons/directions_car.svg index b3c9756..7cd866c 100644 --- a/assets/img/lib/uswds/usa-icons/directions_car.svg +++ b/assets/img/lib/uswds/usa-icons/directions_car.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/directions_walk.svg b/assets/img/lib/uswds/usa-icons/directions_walk.svg index f7d40ce..aef2e9e 100644 --- a/assets/img/lib/uswds/usa-icons/directions_walk.svg +++ b/assets/img/lib/uswds/usa-icons/directions_walk.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/do_not_touch.svg b/assets/img/lib/uswds/usa-icons/do_not_touch.svg index 3ee9311..979964e 100644 --- a/assets/img/lib/uswds/usa-icons/do_not_touch.svg +++ b/assets/img/lib/uswds/usa-icons/do_not_touch.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/edit.svg b/assets/img/lib/uswds/usa-icons/edit.svg index 01f34c7..a2841f9 100644 --- a/assets/img/lib/uswds/usa-icons/edit.svg +++ b/assets/img/lib/uswds/usa-icons/edit.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/emoji_events.svg b/assets/img/lib/uswds/usa-icons/emoji_events.svg index c257dd9..95af5b3 100644 --- a/assets/img/lib/uswds/usa-icons/emoji_events.svg +++ b/assets/img/lib/uswds/usa-icons/emoji_events.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/error_outline.svg b/assets/img/lib/uswds/usa-icons/error_outline.svg index 04e2223..ad877f3 100644 --- a/assets/img/lib/uswds/usa-icons/error_outline.svg +++ b/assets/img/lib/uswds/usa-icons/error_outline.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/event.svg b/assets/img/lib/uswds/usa-icons/event.svg index c304439..ba09a17 100644 --- a/assets/img/lib/uswds/usa-icons/event.svg +++ b/assets/img/lib/uswds/usa-icons/event.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/expand_less.svg b/assets/img/lib/uswds/usa-icons/expand_less.svg index f5729bf..5398524 100644 --- a/assets/img/lib/uswds/usa-icons/expand_less.svg +++ b/assets/img/lib/uswds/usa-icons/expand_less.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/expand_more.svg b/assets/img/lib/uswds/usa-icons/expand_more.svg index beb1bc3..4428af0 100644 --- a/assets/img/lib/uswds/usa-icons/expand_more.svg +++ b/assets/img/lib/uswds/usa-icons/expand_more.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/fast_forward.svg b/assets/img/lib/uswds/usa-icons/fast_forward.svg index d2b1e17..0b8eb5c 100644 --- a/assets/img/lib/uswds/usa-icons/fast_forward.svg +++ b/assets/img/lib/uswds/usa-icons/fast_forward.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/fast_rewind.svg b/assets/img/lib/uswds/usa-icons/fast_rewind.svg index d912469..18c2140 100644 --- a/assets/img/lib/uswds/usa-icons/fast_rewind.svg +++ b/assets/img/lib/uswds/usa-icons/fast_rewind.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/fax.svg b/assets/img/lib/uswds/usa-icons/fax.svg index 45fe070..5b5e193 100644 --- a/assets/img/lib/uswds/usa-icons/fax.svg +++ b/assets/img/lib/uswds/usa-icons/fax.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/file_download.svg b/assets/img/lib/uswds/usa-icons/file_download.svg index 08f35d7..ef421c3 100644 --- a/assets/img/lib/uswds/usa-icons/file_download.svg +++ b/assets/img/lib/uswds/usa-icons/file_download.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/file_present.svg b/assets/img/lib/uswds/usa-icons/file_present.svg index af66fce..fc1ec9f 100644 --- a/assets/img/lib/uswds/usa-icons/file_present.svg +++ b/assets/img/lib/uswds/usa-icons/file_present.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/file_upload.svg b/assets/img/lib/uswds/usa-icons/file_upload.svg index afe6e55..0fe9aad 100644 --- a/assets/img/lib/uswds/usa-icons/file_upload.svg +++ b/assets/img/lib/uswds/usa-icons/file_upload.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/filter_alt.svg b/assets/img/lib/uswds/usa-icons/filter_alt.svg index e4cff47..6dab644 100644 --- a/assets/img/lib/uswds/usa-icons/filter_alt.svg +++ b/assets/img/lib/uswds/usa-icons/filter_alt.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/fingerprint.svg b/assets/img/lib/uswds/usa-icons/fingerprint.svg index 08d9c66..31e2b19 100644 --- a/assets/img/lib/uswds/usa-icons/fingerprint.svg +++ b/assets/img/lib/uswds/usa-icons/fingerprint.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/first_page.svg b/assets/img/lib/uswds/usa-icons/first_page.svg index 3175d47..81a0845 100644 --- a/assets/img/lib/uswds/usa-icons/first_page.svg +++ b/assets/img/lib/uswds/usa-icons/first_page.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/flag.svg b/assets/img/lib/uswds/usa-icons/flag.svg index 9185149..6740057 100644 --- a/assets/img/lib/uswds/usa-icons/flag.svg +++ b/assets/img/lib/uswds/usa-icons/flag.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/flickr.svg b/assets/img/lib/uswds/usa-icons/flickr.svg index 91c40cf..0a43db6 100644 --- a/assets/img/lib/uswds/usa-icons/flickr.svg +++ b/assets/img/lib/uswds/usa-icons/flickr.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/folder.svg b/assets/img/lib/uswds/usa-icons/folder.svg index 931189a..e70b01c 100644 --- a/assets/img/lib/uswds/usa-icons/folder.svg +++ b/assets/img/lib/uswds/usa-icons/folder.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/format_quote.svg b/assets/img/lib/uswds/usa-icons/format_quote.svg index c8d7c2f..9d8fa8b 100644 --- a/assets/img/lib/uswds/usa-icons/format_quote.svg +++ b/assets/img/lib/uswds/usa-icons/format_quote.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/forum.svg b/assets/img/lib/uswds/usa-icons/forum.svg index 1579800..8c958d9 100644 --- a/assets/img/lib/uswds/usa-icons/forum.svg +++ b/assets/img/lib/uswds/usa-icons/forum.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/grid_view.svg b/assets/img/lib/uswds/usa-icons/grid_view.svg index 62eb89b..b732680 100644 --- a/assets/img/lib/uswds/usa-icons/grid_view.svg +++ b/assets/img/lib/uswds/usa-icons/grid_view.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/group_add.svg b/assets/img/lib/uswds/usa-icons/group_add.svg index efe62c9..91c0c2a 100644 --- a/assets/img/lib/uswds/usa-icons/group_add.svg +++ b/assets/img/lib/uswds/usa-icons/group_add.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/groups.svg b/assets/img/lib/uswds/usa-icons/groups.svg index 06dc894..a899f54 100644 --- a/assets/img/lib/uswds/usa-icons/groups.svg +++ b/assets/img/lib/uswds/usa-icons/groups.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/history.svg b/assets/img/lib/uswds/usa-icons/history.svg index d0640a0..f8f018c 100644 --- a/assets/img/lib/uswds/usa-icons/history.svg +++ b/assets/img/lib/uswds/usa-icons/history.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/home.svg b/assets/img/lib/uswds/usa-icons/home.svg index ce53d76..6bd84cf 100644 --- a/assets/img/lib/uswds/usa-icons/home.svg +++ b/assets/img/lib/uswds/usa-icons/home.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/hotel.svg b/assets/img/lib/uswds/usa-icons/hotel.svg index 438d7e0..f1cca2c 100644 --- a/assets/img/lib/uswds/usa-icons/hotel.svg +++ b/assets/img/lib/uswds/usa-icons/hotel.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/image.svg b/assets/img/lib/uswds/usa-icons/image.svg index 5400d38..6ccc16a 100644 --- a/assets/img/lib/uswds/usa-icons/image.svg +++ b/assets/img/lib/uswds/usa-icons/image.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/info.svg b/assets/img/lib/uswds/usa-icons/info.svg index 576ffd9..22ef137 100644 --- a/assets/img/lib/uswds/usa-icons/info.svg +++ b/assets/img/lib/uswds/usa-icons/info.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/instagram.svg b/assets/img/lib/uswds/usa-icons/instagram.svg index b051add..578e517 100644 --- a/assets/img/lib/uswds/usa-icons/instagram.svg +++ b/assets/img/lib/uswds/usa-icons/instagram.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/keyboard.svg b/assets/img/lib/uswds/usa-icons/keyboard.svg index b90ab42..acbf11c 100644 --- a/assets/img/lib/uswds/usa-icons/keyboard.svg +++ b/assets/img/lib/uswds/usa-icons/keyboard.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/label.svg b/assets/img/lib/uswds/usa-icons/label.svg index aca61dc..e0f42a3 100644 --- a/assets/img/lib/uswds/usa-icons/label.svg +++ b/assets/img/lib/uswds/usa-icons/label.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/language.svg b/assets/img/lib/uswds/usa-icons/language.svg index ef46d3d..d696664 100644 --- a/assets/img/lib/uswds/usa-icons/language.svg +++ b/assets/img/lib/uswds/usa-icons/language.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/last_page.svg b/assets/img/lib/uswds/usa-icons/last_page.svg index 9fdf18b..49fd298 100644 --- a/assets/img/lib/uswds/usa-icons/last_page.svg +++ b/assets/img/lib/uswds/usa-icons/last_page.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/lightbulb.svg b/assets/img/lib/uswds/usa-icons/lightbulb.svg index db99d24..5f0ad4e 100644 --- a/assets/img/lib/uswds/usa-icons/lightbulb.svg +++ b/assets/img/lib/uswds/usa-icons/lightbulb.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/link.svg b/assets/img/lib/uswds/usa-icons/link.svg index b4351f2..f39e2a7 100644 --- a/assets/img/lib/uswds/usa-icons/link.svg +++ b/assets/img/lib/uswds/usa-icons/link.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/link_off.svg b/assets/img/lib/uswds/usa-icons/link_off.svg index ae8e780..0ea3587 100644 --- a/assets/img/lib/uswds/usa-icons/link_off.svg +++ b/assets/img/lib/uswds/usa-icons/link_off.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/list.svg b/assets/img/lib/uswds/usa-icons/list.svg index c04a35d..f280e6a 100644 --- a/assets/img/lib/uswds/usa-icons/list.svg +++ b/assets/img/lib/uswds/usa-icons/list.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/local_cafe.svg b/assets/img/lib/uswds/usa-icons/local_cafe.svg index 00fe1b2..5994e0c 100644 --- a/assets/img/lib/uswds/usa-icons/local_cafe.svg +++ b/assets/img/lib/uswds/usa-icons/local_cafe.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/local_fire_department.svg b/assets/img/lib/uswds/usa-icons/local_fire_department.svg index bb28bc6..cfac515 100644 --- a/assets/img/lib/uswds/usa-icons/local_fire_department.svg +++ b/assets/img/lib/uswds/usa-icons/local_fire_department.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/local_gas_station.svg b/assets/img/lib/uswds/usa-icons/local_gas_station.svg index 70ae444..237219f 100644 --- a/assets/img/lib/uswds/usa-icons/local_gas_station.svg +++ b/assets/img/lib/uswds/usa-icons/local_gas_station.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/local_grocery_store.svg b/assets/img/lib/uswds/usa-icons/local_grocery_store.svg index edec280..52e5ea8 100644 --- a/assets/img/lib/uswds/usa-icons/local_grocery_store.svg +++ b/assets/img/lib/uswds/usa-icons/local_grocery_store.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/local_hospital.svg b/assets/img/lib/uswds/usa-icons/local_hospital.svg index 6a3c9c9..85da4ff 100644 --- a/assets/img/lib/uswds/usa-icons/local_hospital.svg +++ b/assets/img/lib/uswds/usa-icons/local_hospital.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/local_laundry_service.svg b/assets/img/lib/uswds/usa-icons/local_laundry_service.svg index 5381eca..6511137 100644 --- a/assets/img/lib/uswds/usa-icons/local_laundry_service.svg +++ b/assets/img/lib/uswds/usa-icons/local_laundry_service.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/local_library.svg b/assets/img/lib/uswds/usa-icons/local_library.svg index b50a4fe..5fa5109 100644 --- a/assets/img/lib/uswds/usa-icons/local_library.svg +++ b/assets/img/lib/uswds/usa-icons/local_library.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/local_offer.svg b/assets/img/lib/uswds/usa-icons/local_offer.svg index 14de292..5a897a7 100644 --- a/assets/img/lib/uswds/usa-icons/local_offer.svg +++ b/assets/img/lib/uswds/usa-icons/local_offer.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/local_pharmacy.svg b/assets/img/lib/uswds/usa-icons/local_pharmacy.svg index f3d4887..7272010 100644 --- a/assets/img/lib/uswds/usa-icons/local_pharmacy.svg +++ b/assets/img/lib/uswds/usa-icons/local_pharmacy.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/local_police.svg b/assets/img/lib/uswds/usa-icons/local_police.svg index 7512ce8..5e6f8dd 100644 --- a/assets/img/lib/uswds/usa-icons/local_police.svg +++ b/assets/img/lib/uswds/usa-icons/local_police.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/local_taxi.svg b/assets/img/lib/uswds/usa-icons/local_taxi.svg index 15a9249..e3559e9 100644 --- a/assets/img/lib/uswds/usa-icons/local_taxi.svg +++ b/assets/img/lib/uswds/usa-icons/local_taxi.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/location_on.svg b/assets/img/lib/uswds/usa-icons/location_on.svg index e5200d0..35655db 100644 --- a/assets/img/lib/uswds/usa-icons/location_on.svg +++ b/assets/img/lib/uswds/usa-icons/location_on.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/lock.svg b/assets/img/lib/uswds/usa-icons/lock.svg index 3c2fe36..2154a2c 100644 --- a/assets/img/lib/uswds/usa-icons/lock.svg +++ b/assets/img/lib/uswds/usa-icons/lock.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/lock_open.svg b/assets/img/lib/uswds/usa-icons/lock_open.svg index eeced3f..4481b0e 100644 --- a/assets/img/lib/uswds/usa-icons/lock_open.svg +++ b/assets/img/lib/uswds/usa-icons/lock_open.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/logout.svg b/assets/img/lib/uswds/usa-icons/logout.svg index 00e0ad3..d4e7414 100644 --- a/assets/img/lib/uswds/usa-icons/logout.svg +++ b/assets/img/lib/uswds/usa-icons/logout.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/mail.svg b/assets/img/lib/uswds/usa-icons/mail.svg index f3809a5..876dbcd 100644 --- a/assets/img/lib/uswds/usa-icons/mail.svg +++ b/assets/img/lib/uswds/usa-icons/mail.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/map.svg b/assets/img/lib/uswds/usa-icons/map.svg index 543599e..93a3e16 100644 --- a/assets/img/lib/uswds/usa-icons/map.svg +++ b/assets/img/lib/uswds/usa-icons/map.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/masks.svg b/assets/img/lib/uswds/usa-icons/masks.svg index 468cdd4..f64f2a4 100644 --- a/assets/img/lib/uswds/usa-icons/masks.svg +++ b/assets/img/lib/uswds/usa-icons/masks.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/medical_services.svg b/assets/img/lib/uswds/usa-icons/medical_services.svg index 403df09..6c17315 100644 --- a/assets/img/lib/uswds/usa-icons/medical_services.svg +++ b/assets/img/lib/uswds/usa-icons/medical_services.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/military_tech.svg b/assets/img/lib/uswds/usa-icons/military_tech.svg index 7c45768..9b8989c 100644 --- a/assets/img/lib/uswds/usa-icons/military_tech.svg +++ b/assets/img/lib/uswds/usa-icons/military_tech.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/navigate_before.svg b/assets/img/lib/uswds/usa-icons/navigate_before.svg index a83937a..e119372 100644 --- a/assets/img/lib/uswds/usa-icons/navigate_before.svg +++ b/assets/img/lib/uswds/usa-icons/navigate_before.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/navigate_next.svg b/assets/img/lib/uswds/usa-icons/navigate_next.svg index fd72ba1..7d1129b 100644 --- a/assets/img/lib/uswds/usa-icons/navigate_next.svg +++ b/assets/img/lib/uswds/usa-icons/navigate_next.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/near_me.svg b/assets/img/lib/uswds/usa-icons/near_me.svg index d9f5e9d..e9ebc79 100644 --- a/assets/img/lib/uswds/usa-icons/near_me.svg +++ b/assets/img/lib/uswds/usa-icons/near_me.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/notifications.svg b/assets/img/lib/uswds/usa-icons/notifications.svg index f7c6893..3f3e328 100644 --- a/assets/img/lib/uswds/usa-icons/notifications.svg +++ b/assets/img/lib/uswds/usa-icons/notifications.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/notifications_active.svg b/assets/img/lib/uswds/usa-icons/notifications_active.svg index 58fcd88..7418d67 100644 --- a/assets/img/lib/uswds/usa-icons/notifications_active.svg +++ b/assets/img/lib/uswds/usa-icons/notifications_active.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/notifications_off.svg b/assets/img/lib/uswds/usa-icons/notifications_off.svg index 3fad4f9..39a5900 100644 --- a/assets/img/lib/uswds/usa-icons/notifications_off.svg +++ b/assets/img/lib/uswds/usa-icons/notifications_off.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/park.svg b/assets/img/lib/uswds/usa-icons/park.svg index b1e7c1f..fb6e898 100644 --- a/assets/img/lib/uswds/usa-icons/park.svg +++ b/assets/img/lib/uswds/usa-icons/park.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/people.svg b/assets/img/lib/uswds/usa-icons/people.svg index 7fa6132..bd9a133 100644 --- a/assets/img/lib/uswds/usa-icons/people.svg +++ b/assets/img/lib/uswds/usa-icons/people.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/person.svg b/assets/img/lib/uswds/usa-icons/person.svg index f320356..e22d151 100644 --- a/assets/img/lib/uswds/usa-icons/person.svg +++ b/assets/img/lib/uswds/usa-icons/person.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/phone.svg b/assets/img/lib/uswds/usa-icons/phone.svg index 1225cfb..5908b6a 100644 --- a/assets/img/lib/uswds/usa-icons/phone.svg +++ b/assets/img/lib/uswds/usa-icons/phone.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/photo_camera.svg b/assets/img/lib/uswds/usa-icons/photo_camera.svg index 79c6aa3..2024fbc 100644 --- a/assets/img/lib/uswds/usa-icons/photo_camera.svg +++ b/assets/img/lib/uswds/usa-icons/photo_camera.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/print.svg b/assets/img/lib/uswds/usa-icons/print.svg index 7cfc6e9..6128bd8 100644 --- a/assets/img/lib/uswds/usa-icons/print.svg +++ b/assets/img/lib/uswds/usa-icons/print.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/public.svg b/assets/img/lib/uswds/usa-icons/public.svg index a428c06..6356e73 100644 --- a/assets/img/lib/uswds/usa-icons/public.svg +++ b/assets/img/lib/uswds/usa-icons/public.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/push_pin.svg b/assets/img/lib/uswds/usa-icons/push_pin.svg index 91e3e61..568580e 100644 --- a/assets/img/lib/uswds/usa-icons/push_pin.svg +++ b/assets/img/lib/uswds/usa-icons/push_pin.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/report.svg b/assets/img/lib/uswds/usa-icons/report.svg index 57f3829..d09adbb 100644 --- a/assets/img/lib/uswds/usa-icons/report.svg +++ b/assets/img/lib/uswds/usa-icons/report.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/restaurant.svg b/assets/img/lib/uswds/usa-icons/restaurant.svg index b41debb..70830b0 100644 --- a/assets/img/lib/uswds/usa-icons/restaurant.svg +++ b/assets/img/lib/uswds/usa-icons/restaurant.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/sanitizer.svg b/assets/img/lib/uswds/usa-icons/sanitizer.svg index d1e6c26..dda2fda 100644 --- a/assets/img/lib/uswds/usa-icons/sanitizer.svg +++ b/assets/img/lib/uswds/usa-icons/sanitizer.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/save_alt.svg b/assets/img/lib/uswds/usa-icons/save_alt.svg index 9bfded0..81abe3c 100644 --- a/assets/img/lib/uswds/usa-icons/save_alt.svg +++ b/assets/img/lib/uswds/usa-icons/save_alt.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/schedule.svg b/assets/img/lib/uswds/usa-icons/schedule.svg index fac5f2e..7d0fa77 100644 --- a/assets/img/lib/uswds/usa-icons/schedule.svg +++ b/assets/img/lib/uswds/usa-icons/schedule.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/school.svg b/assets/img/lib/uswds/usa-icons/school.svg index 08795a5..e43f801 100644 --- a/assets/img/lib/uswds/usa-icons/school.svg +++ b/assets/img/lib/uswds/usa-icons/school.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/science.svg b/assets/img/lib/uswds/usa-icons/science.svg index a7ba4bc..5fc5854 100644 --- a/assets/img/lib/uswds/usa-icons/science.svg +++ b/assets/img/lib/uswds/usa-icons/science.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/send.svg b/assets/img/lib/uswds/usa-icons/send.svg index e542fc6..b678678 100644 --- a/assets/img/lib/uswds/usa-icons/send.svg +++ b/assets/img/lib/uswds/usa-icons/send.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/sentiment_dissatisfied.svg b/assets/img/lib/uswds/usa-icons/sentiment_dissatisfied.svg index 9aa43d0..4f09ab1 100644 --- a/assets/img/lib/uswds/usa-icons/sentiment_dissatisfied.svg +++ b/assets/img/lib/uswds/usa-icons/sentiment_dissatisfied.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/sentiment_neutral.svg b/assets/img/lib/uswds/usa-icons/sentiment_neutral.svg index f4e174b..73690cc 100644 --- a/assets/img/lib/uswds/usa-icons/sentiment_neutral.svg +++ b/assets/img/lib/uswds/usa-icons/sentiment_neutral.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/sentiment_satisfied.svg b/assets/img/lib/uswds/usa-icons/sentiment_satisfied.svg index 95f8f3c..56f0ded 100644 --- a/assets/img/lib/uswds/usa-icons/sentiment_satisfied.svg +++ b/assets/img/lib/uswds/usa-icons/sentiment_satisfied.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/sentiment_satisfied_alt.svg b/assets/img/lib/uswds/usa-icons/sentiment_satisfied_alt.svg index 424cfee..4ab7ba9 100644 --- a/assets/img/lib/uswds/usa-icons/sentiment_satisfied_alt.svg +++ b/assets/img/lib/uswds/usa-icons/sentiment_satisfied_alt.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/sentiment_very_dissatisfied.svg b/assets/img/lib/uswds/usa-icons/sentiment_very_dissatisfied.svg index bf93595..7d4f065 100644 --- a/assets/img/lib/uswds/usa-icons/sentiment_very_dissatisfied.svg +++ b/assets/img/lib/uswds/usa-icons/sentiment_very_dissatisfied.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/settings.svg b/assets/img/lib/uswds/usa-icons/settings.svg index b36758c..f255a58 100644 --- a/assets/img/lib/uswds/usa-icons/settings.svg +++ b/assets/img/lib/uswds/usa-icons/settings.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/share.svg b/assets/img/lib/uswds/usa-icons/share.svg index b3295db..ed3e530 100644 --- a/assets/img/lib/uswds/usa-icons/share.svg +++ b/assets/img/lib/uswds/usa-icons/share.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/shield.svg b/assets/img/lib/uswds/usa-icons/shield.svg index 1263c43..b842df3 100644 --- a/assets/img/lib/uswds/usa-icons/shield.svg +++ b/assets/img/lib/uswds/usa-icons/shield.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/shopping_basket.svg b/assets/img/lib/uswds/usa-icons/shopping_basket.svg index 67ec519..bc41fa0 100644 --- a/assets/img/lib/uswds/usa-icons/shopping_basket.svg +++ b/assets/img/lib/uswds/usa-icons/shopping_basket.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/soap.svg b/assets/img/lib/uswds/usa-icons/soap.svg index 4c83604..285ade8 100644 --- a/assets/img/lib/uswds/usa-icons/soap.svg +++ b/assets/img/lib/uswds/usa-icons/soap.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/social_distance.svg b/assets/img/lib/uswds/usa-icons/social_distance.svg index 1731f46..612dc84 100644 --- a/assets/img/lib/uswds/usa-icons/social_distance.svg +++ b/assets/img/lib/uswds/usa-icons/social_distance.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/star.svg b/assets/img/lib/uswds/usa-icons/star.svg index 8d6975d..caf1ac5 100644 --- a/assets/img/lib/uswds/usa-icons/star.svg +++ b/assets/img/lib/uswds/usa-icons/star.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/store.svg b/assets/img/lib/uswds/usa-icons/store.svg index e6db3fb..2b06cc5 100644 --- a/assets/img/lib/uswds/usa-icons/store.svg +++ b/assets/img/lib/uswds/usa-icons/store.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/thumb_down_alt.svg b/assets/img/lib/uswds/usa-icons/thumb_down_alt.svg index 91d3c8e..2f3b84c 100644 --- a/assets/img/lib/uswds/usa-icons/thumb_down_alt.svg +++ b/assets/img/lib/uswds/usa-icons/thumb_down_alt.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/thumb_up_alt.svg b/assets/img/lib/uswds/usa-icons/thumb_up_alt.svg index 9dbd080..82d1a63 100644 --- a/assets/img/lib/uswds/usa-icons/thumb_up_alt.svg +++ b/assets/img/lib/uswds/usa-icons/thumb_up_alt.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/timer.svg b/assets/img/lib/uswds/usa-icons/timer.svg index 8ed624b..ae67cc8 100644 --- a/assets/img/lib/uswds/usa-icons/timer.svg +++ b/assets/img/lib/uswds/usa-icons/timer.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/toggle_off.svg b/assets/img/lib/uswds/usa-icons/toggle_off.svg index c499243..35cb604 100644 --- a/assets/img/lib/uswds/usa-icons/toggle_off.svg +++ b/assets/img/lib/uswds/usa-icons/toggle_off.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/toggle_on.svg b/assets/img/lib/uswds/usa-icons/toggle_on.svg index f6c30bc..2ec91bb 100644 --- a/assets/img/lib/uswds/usa-icons/toggle_on.svg +++ b/assets/img/lib/uswds/usa-icons/toggle_on.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/topic.svg b/assets/img/lib/uswds/usa-icons/topic.svg index 636acd9..caf4e78 100644 --- a/assets/img/lib/uswds/usa-icons/topic.svg +++ b/assets/img/lib/uswds/usa-icons/topic.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/trending_down.svg b/assets/img/lib/uswds/usa-icons/trending_down.svg index a13f98e..8ba84ae 100644 --- a/assets/img/lib/uswds/usa-icons/trending_down.svg +++ b/assets/img/lib/uswds/usa-icons/trending_down.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/trending_up.svg b/assets/img/lib/uswds/usa-icons/trending_up.svg index ade0e49..d49f43c 100644 --- a/assets/img/lib/uswds/usa-icons/trending_up.svg +++ b/assets/img/lib/uswds/usa-icons/trending_up.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/twitter.svg b/assets/img/lib/uswds/usa-icons/twitter.svg index a502f95..a51804d 100644 --- a/assets/img/lib/uswds/usa-icons/twitter.svg +++ b/assets/img/lib/uswds/usa-icons/twitter.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/update.svg b/assets/img/lib/uswds/usa-icons/update.svg index f7cca4a..2e02f70 100644 --- a/assets/img/lib/uswds/usa-icons/update.svg +++ b/assets/img/lib/uswds/usa-icons/update.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/upload_file.svg b/assets/img/lib/uswds/usa-icons/upload_file.svg index c53e623..cd4b6e6 100644 --- a/assets/img/lib/uswds/usa-icons/upload_file.svg +++ b/assets/img/lib/uswds/usa-icons/upload_file.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/verified.svg b/assets/img/lib/uswds/usa-icons/verified.svg index b49edc6..d26a7b2 100644 --- a/assets/img/lib/uswds/usa-icons/verified.svg +++ b/assets/img/lib/uswds/usa-icons/verified.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/verified_user.svg b/assets/img/lib/uswds/usa-icons/verified_user.svg index 52607ad..451df89 100644 --- a/assets/img/lib/uswds/usa-icons/verified_user.svg +++ b/assets/img/lib/uswds/usa-icons/verified_user.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/visibility.svg b/assets/img/lib/uswds/usa-icons/visibility.svg index 5e1383d..5c700e3 100644 --- a/assets/img/lib/uswds/usa-icons/visibility.svg +++ b/assets/img/lib/uswds/usa-icons/visibility.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/visibility_off.svg b/assets/img/lib/uswds/usa-icons/visibility_off.svg index c82d65c..9f804ec 100644 --- a/assets/img/lib/uswds/usa-icons/visibility_off.svg +++ b/assets/img/lib/uswds/usa-icons/visibility_off.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/volume_off.svg b/assets/img/lib/uswds/usa-icons/volume_off.svg index 3dcc78e..dc8b1bd 100644 --- a/assets/img/lib/uswds/usa-icons/volume_off.svg +++ b/assets/img/lib/uswds/usa-icons/volume_off.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/wash.svg b/assets/img/lib/uswds/usa-icons/wash.svg index 142d4aa..848078e 100644 --- a/assets/img/lib/uswds/usa-icons/wash.svg +++ b/assets/img/lib/uswds/usa-icons/wash.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/youtube.svg b/assets/img/lib/uswds/usa-icons/youtube.svg index 555ed9f..f9905bd 100644 --- a/assets/img/lib/uswds/usa-icons/youtube.svg +++ b/assets/img/lib/uswds/usa-icons/youtube.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/lib/uswds/usa-icons/zoom_in.svg b/assets/img/lib/uswds/usa-icons/zoom_in.svg index 7295707..0c257ee 100644 --- a/assets/img/lib/uswds/usa-icons/zoom_in.svg +++ b/assets/img/lib/uswds/usa-icons/zoom_in.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/js/lib/uswds/uswds-init.min.js.map b/assets/js/lib/uswds/uswds-init.min.js.map index 4e47a0c..fc182f3 100644 --- a/assets/js/lib/uswds/uswds-init.min.js.map +++ b/assets/js/lib/uswds/uswds-init.min.js.map @@ -1 +1 @@ -{"version":3,"file":"uswds-init.min.js","sources":["uswds-init.js"],"sourcesContent":["/* eslint-disable no-var */\n(function uswdsInit() {\n \"use strict\";\n\n var loadingClass = \"usa-js-loading\";\n var fallback;\n\n document.documentElement.classList.add(loadingClass);\n function revertClass() {\n document.documentElement.classList.remove(loadingClass);\n }\n\n fallback = setTimeout(revertClass, 8000);\n\n function verifyLoaded() {\n if (window.uswdsPresent) {\n clearTimeout(fallback);\n revertClass();\n window.removeEventListener(\"load\", verifyLoaded, true);\n }\n }\n\n window.addEventListener(\"load\", verifyLoaded, true);\n})();\n"],"names":["fallback","loadingClass","revertClass","document","documentElement","classList","remove","add","setTimeout","window","addEventListener","verifyLoaded","uswdsPresent","clearTimeout","removeEventListener"],"mappings":"CACA,wBAGE,IACIA,EADAC,EAAe,iBAInB,SAASC,IACPC,SAASC,gBAAgBC,UAAUC,OAAOL,GAF5CE,SAASC,gBAAgBC,UAAUE,IAAIN,GAKvCD,EAAWQ,WAAWN,EAAa,KAUnCO,OAAOC,iBAAiB,OARxB,SAASC,IACHF,OAAOG,eACTC,aAAab,GACbE,IACAO,OAAOK,oBAAoB,OAAQH,GAAc,MAIP,GArBhD"} \ No newline at end of file +{"version":3,"file":"uswds-init.min.js","sources":["uswds-init.js"],"sourcesContent":["/* eslint-disable no-var */\n(function uswdsInit() {\n \"use strict\";\n\n var loadingClass = \"usa-js-loading\";\n var fallback;\n\n document.documentElement.classList.add(loadingClass);\n function revertClass() {\n document.documentElement.classList.remove(loadingClass);\n }\n\n fallback = setTimeout(revertClass, 8000);\n\n function verifyLoaded() {\n if (window.uswdsPresent) {\n clearTimeout(fallback);\n revertClass();\n window.removeEventListener(\"load\", verifyLoaded, true);\n }\n }\n\n window.addEventListener(\"load\", verifyLoaded, true);\n})();\n"],"names":["fallback","loadingClass","revertClass","document","documentElement","classList","remove","add","setTimeout","window","addEventListener","verifyLoaded","uswdsPresent","clearTimeout","removeEventListener"],"mappings":"AACA,CAAA,WACE,aAEA,IACIA,EADAC,EAAe,iBAInB,SAASC,IACPC,SAASC,gBAAgBC,UAAUC,OAAOL,CAAY,CACxD,CAHAE,SAASC,gBAAgBC,UAAUE,IAAIN,CAAY,EAKnDD,EAAWQ,WAAWN,EAAa,GAAI,EAUvCO,OAAOC,iBAAiB,OARxB,SAASC,IACHF,OAAOG,eACTC,aAAab,CAAQ,EACrBE,EAAY,EACZO,OAAOK,oBAAoB,OAAQH,EAAc,CAAA,CAAI,EAEzD,EAE8C,CAAA,CAAI,CACnD,EAAE"} \ No newline at end of file diff --git a/assets/js/lib/uswds/uswds.js b/assets/js/lib/uswds/uswds.js index 72ae5bc..a1b638d 100644 --- a/assets/js/lib/uswds/uswds.js +++ b/assets/js/lib/uswds/uswds.js @@ -3,20 +3,17 @@ /* * classList.js: Cross-browser full element.classList implementation. - * 2014-07-23 + * 1.1.20170427 * * By Eli Grey, http://eligrey.com - * Public Domain. - * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. + * License: Dedicated to the public domain. + * See https://github.com/eligrey/classList.js/blob/master/LICENSE.md */ /*global self, document, DOMException */ -/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js*/ +/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */ -/* Copied from MDN: - * https://developer.mozilla.org/en-US/docs/Web/API/Element/classList - */ if ("document" in window.self) { // Full polyfill for browsers with no classList support // Including IE < Edge missing SVGElement.classList @@ -25,152 +22,131 @@ if ("document" in window.self) { "use strict"; if (!('Element' in view)) return; - var classListProp = "classList", - protoProp = "prototype", - elemCtrProto = view.Element[protoProp], - objCtr = Object, - strTrim = String[protoProp].trim || function () { - return this.replace(/^\s+|\s+$/g, ""); - }, - arrIndexOf = Array[protoProp].indexOf || function (item) { - var i = 0, + protoProp = "prototype", + elemCtrProto = view.Element[protoProp], + objCtr = Object, + strTrim = String[protoProp].trim || function () { + return this.replace(/^\s+|\s+$/g, ""); + }, + arrIndexOf = Array[protoProp].indexOf || function (item) { + var i = 0, len = this.length; - - for (; i < len; i++) { - if (i in this && this[i] === item) { - return i; + for (; i < len; i++) { + if (i in this && this[i] === item) { + return i; + } } + return -1; } - - return -1; - } // Vendors: please allow content code to instantiate DOMExceptions - , - DOMEx = function DOMEx(type, message) { - this.name = type; - this.code = DOMException[type]; - this.message = message; - }, - checkTokenAndGetIndex = function checkTokenAndGetIndex(classList, token) { - if (token === "") { - throw new DOMEx("SYNTAX_ERR", "An invalid or illegal string was specified"); - } - - if (/\s/.test(token)) { - throw new DOMEx("INVALID_CHARACTER_ERR", "String contains an invalid character"); - } - - return arrIndexOf.call(classList, token); - }, - ClassList = function ClassList(elem) { - var trimmedClasses = strTrim.call(elem.getAttribute("class") || ""), + // Vendors: please allow content code to instantiate DOMExceptions + , + DOMEx = function (type, message) { + this.name = type; + this.code = DOMException[type]; + this.message = message; + }, + checkTokenAndGetIndex = function (classList, token) { + if (token === "") { + throw new DOMEx("SYNTAX_ERR", "An invalid or illegal string was specified"); + } + if (/\s/.test(token)) { + throw new DOMEx("INVALID_CHARACTER_ERR", "String contains an invalid character"); + } + return arrIndexOf.call(classList, token); + }, + ClassList = function (elem) { + var trimmedClasses = strTrim.call(elem.getAttribute("class") || ""), classes = trimmedClasses ? trimmedClasses.split(/\s+/) : [], i = 0, len = classes.length; - - for (; i < len; i++) { - this.push(classes[i]); - } - - this._updateClassName = function () { - elem.setAttribute("class", this.toString()); + for (; i < len; i++) { + this.push(classes[i]); + } + this._updateClassName = function () { + elem.setAttribute("class", this.toString()); + }; + }, + classListProto = ClassList[protoProp] = [], + classListGetter = function () { + return new ClassList(this); }; - }, - classListProto = ClassList[protoProp] = [], - classListGetter = function classListGetter() { - return new ClassList(this); - }; // Most DOMException implementations don't allow calling DOMException's toString() + // Most DOMException implementations don't allow calling DOMException's toString() // on non-DOMExceptions. Error's toString() is sufficient here. - - DOMEx[protoProp] = Error[protoProp]; - classListProto.item = function (i) { return this[i] || null; }; - classListProto.contains = function (token) { token += ""; return checkTokenAndGetIndex(this, token) !== -1; }; - classListProto.add = function () { var tokens = arguments, - i = 0, - l = tokens.length, - token, - updated = false; - + i = 0, + l = tokens.length, + token, + updated = false; do { token = tokens[i] + ""; - if (checkTokenAndGetIndex(this, token) === -1) { this.push(token); updated = true; } } while (++i < l); - if (updated) { this._updateClassName(); } }; - classListProto.remove = function () { var tokens = arguments, - i = 0, - l = tokens.length, - token, - updated = false, - index; - + i = 0, + l = tokens.length, + token, + updated = false, + index; do { token = tokens[i] + ""; index = checkTokenAndGetIndex(this, token); - while (index !== -1) { this.splice(index, 1); updated = true; index = checkTokenAndGetIndex(this, token); } } while (++i < l); - if (updated) { this._updateClassName(); } }; - classListProto.toggle = function (token, force) { token += ""; var result = this.contains(token), - method = result ? force !== true && "remove" : force !== false && "add"; - + method = result ? force !== true && "remove" : force !== false && "add"; if (method) { this[method](token); } - if (force === true || force === false) { return force; } else { return !result; } }; - classListProto.toString = function () { return this.join(" "); }; - if (objCtr.defineProperty) { var classListPropDesc = { get: classListGetter, enumerable: true, configurable: true }; - try { objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); } catch (ex) { // IE 8 doesn't support enumerable:true - if (ex.number === -0x7FF5EC54) { + // adding undefined to fight this issue https://github.com/eligrey/classList.js/issues/36 + // modernie IE8-MSW7 machine has IE8 8.0.6001.18702 and is affected + if (ex.number === undefined || ex.number === -0x7FF5EC54) { classListPropDesc.enumerable = false; objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); } @@ -179,126 +155,88 @@ if ("document" in window.self) { elemCtrProto.__defineGetter__(classListProp, classListGetter); } })(window.self); - } else { - // There is full or partial native classList support, so just check if we need - // to normalize the add/remove and toggle APIs. - (function () { - "use strict"; - - var testElement = document.createElement("_"); - testElement.classList.add("c1", "c2"); // Polyfill for IE 10/11 and Firefox <26, where classList.add and - // classList.remove exist but support only one argument at a time. - - if (!testElement.classList.contains("c2")) { - var createMethod = function createMethod(method) { - var original = DOMTokenList.prototype[method]; - - DOMTokenList.prototype[method] = function (token) { - var i, - len = arguments.length; - - for (i = 0; i < len; i++) { - token = arguments[i]; - original.call(this, token); - } - }; - }; + } - createMethod('add'); - createMethod('remove'); - } + // There is full or partial native classList support, so just check if we need + // to normalize the add/remove and toggle APIs. - testElement.classList.toggle("c3", false); // Polyfill for IE 10 and Firefox <24, where classList.toggle does not - // support the second argument. + (function () { + "use strict"; - if (testElement.classList.contains("c3")) { - var _toggle = DOMTokenList.prototype.toggle; + var testElement = document.createElement("_"); + testElement.classList.add("c1", "c2"); - DOMTokenList.prototype.toggle = function (token, force) { - if (1 in arguments && !this.contains(token) === !force) { - return force; - } else { - return _toggle.call(this, token); + // Polyfill for IE 10/11 and Firefox <26, where classList.add and + // classList.remove exist but support only one argument at a time. + if (!testElement.classList.contains("c2")) { + var createMethod = function (method) { + var original = DOMTokenList.prototype[method]; + DOMTokenList.prototype[method] = function (token) { + var i, + len = arguments.length; + for (i = 0; i < len; i++) { + token = arguments[i]; + original.call(this, token); } }; - } - - testElement = null; - })(); - } + }; + createMethod('add'); + createMethod('remove'); + } + testElement.classList.toggle("c3", false); + + // Polyfill for IE 10 and Firefox <24, where classList.toggle does not + // support the second argument. + if (testElement.classList.contains("c3")) { + var _toggle = DOMTokenList.prototype.toggle; + DOMTokenList.prototype.toggle = function (token, force) { + if (1 in arguments && !this.contains(token) === !force) { + return force; + } else { + return _toggle.call(this, token); + } + }; + } + testElement = null; + })(); } },{}],2:[function(require,module,exports){ "use strict"; -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - -/*! - * domready (c) Dustin Diaz 2014 - License MIT - */ -!function (name, definition) { - if (typeof module != 'undefined') module.exports = definition();else if (typeof define == 'function' && _typeof(define.amd) == 'object') define(definition);else this[name] = definition(); -}('domready', function () { - var fns = [], - _listener, - doc = document, - hack = doc.documentElement.doScroll, - domContentLoaded = 'DOMContentLoaded', - loaded = (hack ? /^loaded|^c/ : /^loaded|^i|^c/).test(doc.readyState); - - if (!loaded) doc.addEventListener(domContentLoaded, _listener = function listener() { - doc.removeEventListener(domContentLoaded, _listener); - loaded = 1; - - while (_listener = fns.shift()) { - _listener(); - } - }); - return function (fn) { - loaded ? setTimeout(fn, 0) : fns.push(fn); - }; -}); - -},{}],3:[function(require,module,exports){ -"use strict"; - // element-closest | CC0-1.0 | github.com/jonathantneal/closest + (function (ElementProto) { if (typeof ElementProto.matches !== 'function') { ElementProto.matches = ElementProto.msMatchesSelector || ElementProto.mozMatchesSelector || ElementProto.webkitMatchesSelector || function matches(selector) { var element = this; var elements = (element.document || element.ownerDocument).querySelectorAll(selector); var index = 0; - while (elements[index] && elements[index] !== element) { ++index; } - return Boolean(elements[index]); }; } - if (typeof ElementProto.closest !== 'function') { ElementProto.closest = function closest(selector) { var element = this; - while (element && element.nodeType === 1) { if (element.matches(selector)) { return element; } - element = element.parentNode; } - return null; }; } })(window.Element.prototype); -},{}],4:[function(require,module,exports){ +},{}],3:[function(require,module,exports){ "use strict"; /* global define, KeyboardEvent, module */ + (function () { var keyboardeventKeyPolyfill = { polyfill: polyfill, @@ -371,43 +309,38 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" = 250: 'Play', 251: 'ZoomOut' } - }; // Function keys (F1-24). + }; + // Function keys (F1-24). var i; - for (i = 1; i < 25; i++) { keyboardeventKeyPolyfill.keys[111 + i] = 'F' + i; - } // Printable ASCII characters. - + } + // Printable ASCII characters. var letter = ''; - for (i = 65; i < 91; i++) { letter = String.fromCharCode(i); keyboardeventKeyPolyfill.keys[i] = [letter.toLowerCase(), letter.toUpperCase()]; } - function polyfill() { if (!('KeyboardEvent' in window) || 'key' in KeyboardEvent.prototype) { return false; - } // Polyfill `key` on `KeyboardEvent`. - + } + // Polyfill `key` on `KeyboardEvent`. var proto = { - get: function get(x) { + get: function (x) { var key = keyboardeventKeyPolyfill.keys[this.which || this.keyCode]; - if (Array.isArray(key)) { key = key[+this.shiftKey]; } - return key; } }; Object.defineProperty(KeyboardEvent.prototype, 'key', proto); return proto; } - if (typeof define === 'function' && define.amd) { define('keyboardevent-key-polyfill', keyboardeventKeyPolyfill); } else if (typeof exports !== 'undefined' && typeof module !== 'undefined') { @@ -417,92 +350,79 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" = } })(); -},{}],5:[function(require,module,exports){ +},{}],4:[function(require,module,exports){ /* object-assign (c) Sindre Sorhus @license MIT */ + 'use strict'; -/* eslint-disable no-unused-vars */ +/* eslint-disable no-unused-vars */ var getOwnPropertySymbols = Object.getOwnPropertySymbols; var hasOwnProperty = Object.prototype.hasOwnProperty; var propIsEnumerable = Object.prototype.propertyIsEnumerable; - function toObject(val) { if (val === null || val === undefined) { throw new TypeError('Object.assign cannot be called with null or undefined'); } - return Object(val); } - function shouldUseNative() { try { if (!Object.assign) { return false; - } // Detect buggy property enumeration order in older V8 versions. - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + } + // Detect buggy property enumeration order in older V8 versions. + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { return false; - } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - + } + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test2 = {}; - for (var i = 0; i < 10; i++) { test2['_' + String.fromCharCode(i)] = i; } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { return test2[n]; }); - if (order2.join('') !== '0123456789') { return false; - } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - + } + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test3 = {}; 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { test3[letter] = letter; }); - if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { return false; } - return true; } catch (err) { // We don't expect any of the above to throw, but better to be safe. return false; } } - module.exports = shouldUseNative() ? Object.assign : function (target, source) { var from; var to = toObject(target); var symbols; - for (var s = 1; s < arguments.length; s++) { from = Object(arguments[s]); - for (var key in from) { if (hasOwnProperty.call(from, key)) { to[key] = from[key]; } } - if (getOwnPropertySymbols) { symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { if (propIsEnumerable.call(from, symbols[i])) { to[symbols[i]] = from[symbols[i]]; @@ -510,48 +430,36 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { } } } - return to; }; -},{}],6:[function(require,module,exports){ +},{}],5:[function(require,module,exports){ "use strict"; -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - -var assign = require('object-assign'); - -var delegate = require('../delegate'); - -var delegateAll = require('../delegateAll'); - -var DELEGATE_PATTERN = /^(.+):delegate\((.+)\)$/; -var SPACE = ' '; - -var getListeners = function getListeners(type, handler) { +const assign = require('object-assign'); +const delegate = require('../delegate'); +const delegateAll = require('../delegateAll'); +const DELEGATE_PATTERN = /^(.+):delegate\((.+)\)$/; +const SPACE = ' '; +const getListeners = function (type, handler) { var match = type.match(DELEGATE_PATTERN); var selector; - if (match) { type = match[1]; selector = match[2]; } - var options; - - if (_typeof(handler) === 'object') { + if (typeof handler === 'object') { options = { capture: popKey(handler, 'capture'), passive: popKey(handler, 'passive') }; } - var listener = { selector: selector, - delegate: _typeof(handler) === 'object' ? delegateAll(handler) : selector ? delegate(selector, handler) : handler, + delegate: typeof handler === 'object' ? delegateAll(handler) : selector ? delegate(selector, handler) : handler, options: options }; - if (type.indexOf(SPACE) > -1) { return type.split(SPACE).map(function (_type) { return assign({ @@ -563,15 +471,13 @@ var getListeners = function getListeners(type, handler) { return [listener]; } }; - -var popKey = function popKey(obj, key) { +var popKey = function (obj, key) { var value = obj[key]; delete obj[key]; return value; }; - module.exports = function behavior(events, props) { - var listeners = Object.keys(events).reduce(function (memo, type) { + const listeners = Object.keys(events).reduce(function (memo, type) { var listeners = getListeners(type, events[type]); return memo.concat(listeners); }, []); @@ -589,7 +495,7 @@ module.exports = function behavior(events, props) { }, props); }; -},{"../delegate":8,"../delegateAll":9,"object-assign":5}],7:[function(require,module,exports){ +},{"../delegate":7,"../delegateAll":8,"object-assign":4}],6:[function(require,module,exports){ "use strict"; module.exports = function compose(functions) { @@ -600,48 +506,43 @@ module.exports = function compose(functions) { }; }; -},{}],8:[function(require,module,exports){ +},{}],7:[function(require,module,exports){ "use strict"; // polyfill Element.prototype.closest require('element-closest'); - module.exports = function delegate(selector, fn) { return function delegation(event) { var target = event.target.closest(selector); - if (target) { return fn.call(target, event); } }; }; -},{"element-closest":3}],9:[function(require,module,exports){ +},{"element-closest":2}],8:[function(require,module,exports){ "use strict"; -var delegate = require('../delegate'); - -var compose = require('../compose'); - -var SPLAT = '*'; - +const delegate = require('../delegate'); +const compose = require('../compose'); +const SPLAT = '*'; module.exports = function delegateAll(selectors) { - var keys = Object.keys(selectors); // XXX optimization: if there is only one handler and it applies to + const keys = Object.keys(selectors); + + // XXX optimization: if there is only one handler and it applies to // all elements (the "*" CSS selector), then just return that // handler - if (keys.length === 1 && keys[0] === SPLAT) { return selectors[SPLAT]; } - - var delegates = keys.reduce(function (memo, selector) { + const delegates = keys.reduce(function (memo, selector) { memo.push(delegate(selector, selectors[selector])); return memo; }, []); return compose(delegates); }; -},{"../compose":7,"../delegate":8}],10:[function(require,module,exports){ +},{"../compose":6,"../delegate":7}],9:[function(require,module,exports){ "use strict"; module.exports = function ignore(element, fn) { @@ -652,7 +553,7 @@ module.exports = function ignore(element, fn) { }; }; -},{}],11:[function(require,module,exports){ +},{}],10:[function(require,module,exports){ "use strict"; module.exports = { @@ -663,25 +564,23 @@ module.exports = { keymap: require('./keymap') }; -},{"./behavior":6,"./delegate":8,"./delegateAll":9,"./ignore":10,"./keymap":12}],12:[function(require,module,exports){ +},{"./behavior":5,"./delegate":7,"./delegateAll":8,"./ignore":9,"./keymap":11}],11:[function(require,module,exports){ "use strict"; -require('keyboardevent-key-polyfill'); // these are the only relevant modifiers supported on all platforms, +require('keyboardevent-key-polyfill'); + +// these are the only relevant modifiers supported on all platforms, // according to MDN: // - - -var MODIFIERS = { +const MODIFIERS = { 'Alt': 'altKey', 'Control': 'ctrlKey', 'Ctrl': 'ctrlKey', 'Shift': 'shiftKey' }; -var MODIFIER_SEPARATOR = '+'; - -var getEventKey = function getEventKey(event, hasModifiers) { +const MODIFIER_SEPARATOR = '+'; +const getEventKey = function (event, hasModifiers) { var key = event.key; - if (hasModifiers) { for (var modifier in MODIFIERS) { if (event[MODIFIERS[modifier]] === true) { @@ -689,12 +588,10 @@ var getEventKey = function getEventKey(event, hasModifiers) { } } } - return key; }; - module.exports = function keymap(keys) { - var hasModifiers = Object.keys(keys).some(function (key) { + const hasModifiers = Object.keys(keys).some(function (key) { return key.indexOf(MODIFIER_SEPARATOR) > -1; }); return function (event) { @@ -703,15 +600,13 @@ module.exports = function keymap(keys) { if (_key in keys) { result = keys[key].call(this, event); } - return result; }, undefined); }; }; - module.exports.MODIFIERS = MODIFIERS; -},{"keyboardevent-key-polyfill":4}],13:[function(require,module,exports){ +},{"keyboardevent-key-polyfill":3}],12:[function(require,module,exports){ "use strict"; module.exports = function once(listener, options) { @@ -719,15 +614,12 @@ module.exports = function once(listener, options) { e.currentTarget.removeEventListener(e.type, wrapped, options); return listener.call(this, e); }; - return wrapped; }; -},{}],14:[function(require,module,exports){ +},{}],13:[function(require,module,exports){ 'use strict'; -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - var RE_TRIM = /(^\s+)|(\s+$)/g; var RE_SPLIT = /\s+/; var trim = String.prototype.trim ? function (str) { @@ -735,100 +627,86 @@ var trim = String.prototype.trim ? function (str) { } : function (str) { return str.replace(RE_TRIM, ''); }; - -var queryById = function queryById(id) { +var queryById = function (id) { return this.querySelector('[id="' + id.replace(/"/g, '\\"') + '"]'); }; - module.exports = function resolveIds(ids, doc) { if (typeof ids !== 'string') { - throw new Error('Expected a string but got ' + _typeof(ids)); + throw new Error('Expected a string but got ' + typeof ids); } - if (!doc) { doc = window.document; } - var getElementById = doc.getElementById ? doc.getElementById.bind(doc) : queryById.bind(doc); - ids = trim(ids).split(RE_SPLIT); // XXX we can short-circuit here because trimming and splitting a + ids = trim(ids).split(RE_SPLIT); + + // XXX we can short-circuit here because trimming and splitting a // string of just whitespace produces an array containing a single, // empty string - if (ids.length === 1 && ids[0] === '') { return []; } - return ids.map(function (id) { var el = getElementById(id); - if (!el) { throw new Error('no element with id: "' + id + '"'); } - return el; }); }; -},{}],15:[function(require,module,exports){ +},{}],14:[function(require,module,exports){ "use strict"; -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var behavior = require("../../uswds-core/src/js/utils/behavior"); - -var toggleFormInput = require("../../uswds-core/src/js/utils/toggle-form-input"); - -var _require = require("../../uswds-core/src/js/events"), - CLICK = _require.CLICK; - -var _require2 = require("../../uswds-core/src/js/config"), - PREFIX = _require2.prefix; - -var LINK = ".".concat(PREFIX, "-show-password, .").concat(PREFIX, "-show-multipassword"); - +const behavior = require("../../uswds-core/src/js/utils/behavior"); +const toggleFormInput = require("../../uswds-core/src/js/utils/toggle-form-input"); +const { + CLICK +} = require("../../uswds-core/src/js/events"); +const { + prefix: PREFIX +} = require("../../uswds-core/src/js/config"); +const LINK = `.${PREFIX}-show-password`; function toggle(event) { event.preventDefault(); toggleFormInput(this); } +module.exports = behavior({ + [CLICK]: { + [LINK]: toggle + } +}); -module.exports = behavior(_defineProperty({}, CLICK, _defineProperty({}, LINK, toggle))); - -},{"../../uswds-core/src/js/config":33,"../../uswds-core/src/js/events":34,"../../uswds-core/src/js/utils/behavior":43,"../../uswds-core/src/js/utils/toggle-form-input":52}],16:[function(require,module,exports){ +},{"../../uswds-core/src/js/config":36,"../../uswds-core/src/js/events":37,"../../uswds-core/src/js/utils/behavior":46,"../../uswds-core/src/js/utils/toggle-form-input":56}],15:[function(require,module,exports){ "use strict"; -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var select = require("../../uswds-core/src/js/utils/select"); - -var behavior = require("../../uswds-core/src/js/utils/behavior"); - -var toggle = require("../../uswds-core/src/js/utils/toggle"); - -var isElementInViewport = require("../../uswds-core/src/js/utils/is-in-viewport"); - -var _require = require("../../uswds-core/src/js/events"), - CLICK = _require.CLICK; - -var _require2 = require("../../uswds-core/src/js/config"), - PREFIX = _require2.prefix; +const select = require("../../uswds-core/src/js/utils/select"); +const behavior = require("../../uswds-core/src/js/utils/behavior"); +const toggle = require("../../uswds-core/src/js/utils/toggle"); +const isElementInViewport = require("../../uswds-core/src/js/utils/is-in-viewport"); +const { + CLICK +} = require("../../uswds-core/src/js/events"); +const { + prefix: PREFIX +} = require("../../uswds-core/src/js/config"); +const ACCORDION = `.${PREFIX}-accordion, .${PREFIX}-accordion--bordered`; +const BANNER_BUTTON = `.${PREFIX}-banner__button`; +const BUTTON = `.${PREFIX}-accordion__button[aria-controls]:not(${BANNER_BUTTON})`; +const EXPANDED = "aria-expanded"; +const MULTISELECTABLE = "data-allow-multiple"; -var ACCORDION = ".".concat(PREFIX, "-accordion, .").concat(PREFIX, "-accordion--bordered"); -var BUTTON = ".".concat(PREFIX, "-accordion__button[aria-controls]"); -var EXPANDED = "aria-expanded"; -var MULTISELECTABLE = "data-allow-multiple"; /** * Get an Array of button elements belonging directly to the given * accordion element. * @param {HTMLElement} accordion * @return {array} */ - -var getAccordionButtons = function getAccordionButtons(accordion) { - var buttons = select(BUTTON, accordion); - return buttons.filter(function (button) { - return button.closest(ACCORDION) === accordion; - }); +const getAccordionButtons = accordion => { + const buttons = select(BUTTON, accordion); + return buttons.filter(button => button.closest(ACCORDION) === accordion); }; + /** * Toggle a button's "pressed" state, optionally providing a target * state. @@ -838,66 +716,57 @@ var getAccordionButtons = function getAccordionButtons(accordion) { * state will be toggled (from false to true, and vice-versa). * @return {boolean} the resulting state */ - - -var toggleButton = function toggleButton(button, expanded) { - var accordion = button.closest(ACCORDION); - var safeExpanded = expanded; - +const toggleButton = (button, expanded) => { + const accordion = button.closest(ACCORDION); + let safeExpanded = expanded; if (!accordion) { - throw new Error("".concat(BUTTON, " is missing outer ").concat(ACCORDION)); + throw new Error(`${BUTTON} is missing outer ${ACCORDION}`); } + safeExpanded = toggle(button, expanded); - safeExpanded = toggle(button, expanded); // XXX multiselectable is opt-in, to preserve legacy behavior - - var multiselectable = accordion.hasAttribute(MULTISELECTABLE); - + // XXX multiselectable is opt-in, to preserve legacy behavior + const multiselectable = accordion.hasAttribute(MULTISELECTABLE); if (safeExpanded && !multiselectable) { - getAccordionButtons(accordion).forEach(function (other) { + getAccordionButtons(accordion).forEach(other => { if (other !== button) { toggle(other, false); } }); } }; + /** * @param {HTMLButtonElement} button * @return {boolean} true */ +const showButton = button => toggleButton(button, true); - -var showButton = function showButton(button) { - return toggleButton(button, true); -}; /** * @param {HTMLButtonElement} button * @return {boolean} false */ - - -var hideButton = function hideButton(button) { - return toggleButton(button, false); -}; - -var accordion = behavior(_defineProperty({}, CLICK, _defineProperty({}, BUTTON, function (event) { - event.preventDefault(); - toggleButton(this); - - if (this.getAttribute(EXPANDED) === "true") { - // We were just expanded, but if another accordion was also just - // collapsed, we may no longer be in the viewport. This ensures - // that we are still visible, so the user isn't confused. - if (!isElementInViewport(this)) this.scrollIntoView(); - } -})), { - init: function init(root) { - select(BUTTON, root).forEach(function (button) { - var expanded = button.getAttribute(EXPANDED) === "true"; +const hideButton = button => toggleButton(button, false); +const accordion = behavior({ + [CLICK]: { + [BUTTON]() { + toggleButton(this); + if (this.getAttribute(EXPANDED) === "true") { + // We were just expanded, but if another accordion was also just + // collapsed, we may no longer be in the viewport. This ensures + // that we are still visible, so the user isn't confused. + if (!isElementInViewport(this)) this.scrollIntoView(); + } + } + } +}, { + init(root) { + select(BUTTON, root).forEach(button => { + const expanded = button.getAttribute(EXPANDED) === "true"; toggleButton(button, expanded); }); }, - ACCORDION: ACCORDION, - BUTTON: BUTTON, + ACCORDION, + BUTTON, show: showButton, hide: hideButton, toggle: toggleButton, @@ -905,221 +774,301 @@ var accordion = behavior(_defineProperty({}, CLICK, _defineProperty({}, BUTTON, }); module.exports = accordion; -},{"../../uswds-core/src/js/config":33,"../../uswds-core/src/js/events":34,"../../uswds-core/src/js/utils/behavior":43,"../../uswds-core/src/js/utils/is-in-viewport":45,"../../uswds-core/src/js/utils/select":50,"../../uswds-core/src/js/utils/toggle":53}],17:[function(require,module,exports){ +},{"../../uswds-core/src/js/config":36,"../../uswds-core/src/js/events":37,"../../uswds-core/src/js/utils/behavior":46,"../../uswds-core/src/js/utils/is-in-viewport":49,"../../uswds-core/src/js/utils/select":54,"../../uswds-core/src/js/utils/toggle":57}],16:[function(require,module,exports){ "use strict"; -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var behavior = require("../../uswds-core/src/js/utils/behavior"); - -var _require = require("../../uswds-core/src/js/events"), - CLICK = _require.CLICK; - -var _require2 = require("../../uswds-core/src/js/config"), - PREFIX = _require2.prefix; - -var HEADER = ".".concat(PREFIX, "-banner__header"); -var EXPANDED_CLASS = "".concat(PREFIX, "-banner__header--expanded"); +const behavior = require("../../uswds-core/src/js/utils/behavior"); +const select = require("../../uswds-core/src/js/utils/select"); +const { + CLICK +} = require("../../uswds-core/src/js/events"); +const { + prefix: PREFIX +} = require("../../uswds-core/src/js/config"); +const toggle = require("../../uswds-core/src/js/utils/toggle"); +const HEADER = `.${PREFIX}-banner__header`; +const EXPANDED_CLASS = `${PREFIX}-banner__header--expanded`; +const BANNER_BUTTON = `${HEADER} [aria-controls]`; -var toggleBanner = function toggleEl(event) { +/** + * Toggle Banner display and class. + * @param {Event} event + */ +const toggleBanner = function toggleEl(event) { event.preventDefault(); + const trigger = event.target.closest(BANNER_BUTTON); + toggle(trigger); this.closest(HEADER).classList.toggle(EXPANDED_CLASS); }; +module.exports = behavior({ + [CLICK]: { + [BANNER_BUTTON]: toggleBanner + } +}, { + init(root) { + select(BANNER_BUTTON, root).forEach(button => { + const expanded = button.getAttribute(EXPANDED_CLASS) === "true"; + toggle(button, expanded); + }); + } +}); -module.exports = behavior(_defineProperty({}, CLICK, _defineProperty({}, "".concat(HEADER, " [aria-controls]"), toggleBanner))); - -},{"../../uswds-core/src/js/config":33,"../../uswds-core/src/js/events":34,"../../uswds-core/src/js/utils/behavior":43}],18:[function(require,module,exports){ +},{"../../uswds-core/src/js/config":36,"../../uswds-core/src/js/events":37,"../../uswds-core/src/js/utils/behavior":46,"../../uswds-core/src/js/utils/select":54,"../../uswds-core/src/js/utils/toggle":57}],17:[function(require,module,exports){ "use strict"; -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var select = require("../../uswds-core/src/js/utils/select"); - -var behavior = require("../../uswds-core/src/js/utils/behavior"); - -var _require = require("../../uswds-core/src/js/config"), - PREFIX = _require.prefix; +const keymap = require("receptor/keymap"); +const behavior = require("../../uswds-core/src/js/utils/behavior"); +const ANCHOR_BUTTON = `a[class*="usa-button"]`; +const toggleButton = event => { + event.preventDefault(); + event.target.click(); +}; +const anchorButton = behavior({ + keydown: { + [ANCHOR_BUTTON]: keymap({ + " ": toggleButton + }) + } +}); +module.exports = anchorButton; -var CHARACTER_COUNT = ".".concat(PREFIX, "-character-count"); -var INPUT = ".".concat(PREFIX, "-character-count__field"); -var MESSAGE = ".".concat(PREFIX, "-character-count__message"); -var VALIDATION_MESSAGE = "The content is too long."; -var MESSAGE_INVALID_CLASS = "".concat(PREFIX, "-character-count__message--invalid"); -/** - * The elements within the character count. - * @typedef {Object} CharacterCountElements - * @property {HTMLDivElement} characterCountEl - * @property {HTMLSpanElement} messageEl - */ +},{"../../uswds-core/src/js/utils/behavior":46,"receptor/keymap":11}],18:[function(require,module,exports){ +"use strict"; -/** - * Returns the root and message element - * for an character count input +const select = require("../../uswds-core/src/js/utils/select"); +const behavior = require("../../uswds-core/src/js/utils/behavior"); +const debounce = require("../../uswds-core/src/js/utils/debounce"); +const { + prefix: PREFIX +} = require("../../uswds-core/src/js/config"); +const CHARACTER_COUNT_CLASS = `${PREFIX}-character-count`; +const CHARACTER_COUNT = `.${CHARACTER_COUNT_CLASS}`; +const INPUT = `.${PREFIX}-character-count__field`; +const MESSAGE = `.${PREFIX}-character-count__message`; +const VALIDATION_MESSAGE = "The content is too long."; +const MESSAGE_INVALID_CLASS = `${PREFIX}-character-count__status--invalid`; +const STATUS_MESSAGE_CLASS = `${CHARACTER_COUNT_CLASS}__status`; +const STATUS_MESSAGE_SR_ONLY_CLASS = `${CHARACTER_COUNT_CLASS}__sr-status`; +const STATUS_MESSAGE = `.${STATUS_MESSAGE_CLASS}`; +const STATUS_MESSAGE_SR_ONLY = `.${STATUS_MESSAGE_SR_ONLY_CLASS}`; +const DEFAULT_STATUS_LABEL = `characters allowed`; + +/** + * Returns the root and message element for an character count input * * @param {HTMLInputElement|HTMLTextAreaElement} inputEl The character count input element * @returns {CharacterCountElements} elements The root and message element. */ - -var getCharacterCountElements = function getCharacterCountElements(inputEl) { - var characterCountEl = inputEl.closest(CHARACTER_COUNT); - +const getCharacterCountElements = inputEl => { + const characterCountEl = inputEl.closest(CHARACTER_COUNT); if (!characterCountEl) { - throw new Error("".concat(INPUT, " is missing outer ").concat(CHARACTER_COUNT)); + throw new Error(`${INPUT} is missing outer ${CHARACTER_COUNT}`); } - - var messageEl = characterCountEl.querySelector(MESSAGE); - + const messageEl = characterCountEl.querySelector(MESSAGE); if (!messageEl) { - throw new Error("".concat(CHARACTER_COUNT, " is missing inner ").concat(MESSAGE)); + throw new Error(`${CHARACTER_COUNT} is missing inner ${MESSAGE}`); } - return { - characterCountEl: characterCountEl, - messageEl: messageEl + characterCountEl, + messageEl }; }; + /** - * Update the character count component + * Move maxlength attribute to a data attribute on usa-character-count * * @param {HTMLInputElement|HTMLTextAreaElement} inputEl The character count input element */ - - -var updateCountMessage = function updateCountMessage(inputEl) { - var _getCharacterCountEle = getCharacterCountElements(inputEl), - characterCountEl = _getCharacterCountEle.characterCountEl, - messageEl = _getCharacterCountEle.messageEl; - - var maxlength = parseInt(characterCountEl.getAttribute("data-maxlength"), 10); +const setDataLength = inputEl => { + const { + characterCountEl + } = getCharacterCountElements(inputEl); + const maxlength = inputEl.getAttribute("maxlength"); if (!maxlength) return; - var newMessage = ""; - var currentLength = inputEl.value.length; - var isOverLimit = currentLength && currentLength > maxlength; + inputEl.removeAttribute("maxlength"); + characterCountEl.setAttribute("data-maxlength", maxlength); +}; +/** + * Create and append status messages for visual and screen readers + * + * @param {HTMLDivElement} characterCountEl - Div with `.usa-character-count` class + * @description Create two status messages for number of characters left; + * one visual status and another for screen readers + */ +const createStatusMessages = characterCountEl => { + const statusMessage = document.createElement("div"); + const srStatusMessage = document.createElement("div"); + const maxLength = characterCountEl.dataset.maxlength; + const defaultMessage = `${maxLength} ${DEFAULT_STATUS_LABEL}`; + statusMessage.classList.add(`${STATUS_MESSAGE_CLASS}`, "usa-hint"); + srStatusMessage.classList.add(`${STATUS_MESSAGE_SR_ONLY_CLASS}`, "usa-sr-only"); + statusMessage.setAttribute("aria-hidden", true); + srStatusMessage.setAttribute("aria-live", "polite"); + statusMessage.textContent = defaultMessage; + srStatusMessage.textContent = defaultMessage; + characterCountEl.append(statusMessage, srStatusMessage); +}; + +/** + * Returns message with how many characters are left + * + * @param {number} currentLength - The number of characters used + * @param {number} maxLength - The total number of characters allowed + * @returns {string} A string description of how many characters are left + */ +const getCountMessage = (currentLength, maxLength) => { + let newMessage = ""; if (currentLength === 0) { - newMessage = "".concat(maxlength, " characters allowed"); + newMessage = `${maxLength} ${DEFAULT_STATUS_LABEL}`; } else { - var difference = Math.abs(maxlength - currentLength); - var characters = "character".concat(difference === 1 ? "" : "s"); - var guidance = isOverLimit ? "over limit" : "left"; - newMessage = "".concat(difference, " ").concat(characters, " ").concat(guidance); + const difference = Math.abs(maxLength - currentLength); + const characters = `character${difference === 1 ? "" : "s"}`; + const guidance = currentLength > maxLength ? "over limit" : "left"; + newMessage = `${difference} ${characters} ${guidance}`; } + return newMessage; +}; - messageEl.classList.toggle(MESSAGE_INVALID_CLASS, isOverLimit); - messageEl.textContent = newMessage; +/** + * Updates the character count status for screen readers after a 1000ms delay. + * + * @param {HTMLElement} msgEl - The screen reader status message element + * @param {string} statusMessage - A string of the current character status + */ +const srUpdateStatus = debounce((msgEl, statusMessage) => { + const srStatusMessage = msgEl; + srStatusMessage.textContent = statusMessage; +}, 1000); +/** + * Update the character count component + * + * @description On input, it will update visual status, screenreader + * status and update input validation (if over character length) + * @param {HTMLInputElement|HTMLTextAreaElement} inputEl The character count input element + */ +const updateCountMessage = inputEl => { + const { + characterCountEl + } = getCharacterCountElements(inputEl); + const currentLength = inputEl.value.length; + const maxLength = parseInt(characterCountEl.getAttribute("data-maxlength"), 10); + const statusMessage = characterCountEl.querySelector(STATUS_MESSAGE); + const srStatusMessage = characterCountEl.querySelector(STATUS_MESSAGE_SR_ONLY); + const currentStatusMessage = getCountMessage(currentLength, maxLength); + if (!maxLength) return; + const isOverLimit = currentLength && currentLength > maxLength; + statusMessage.textContent = currentStatusMessage; + srUpdateStatus(srStatusMessage, currentStatusMessage); if (isOverLimit && !inputEl.validationMessage) { inputEl.setCustomValidity(VALIDATION_MESSAGE); } - if (!isOverLimit && inputEl.validationMessage === VALIDATION_MESSAGE) { inputEl.setCustomValidity(""); } + statusMessage.classList.toggle(MESSAGE_INVALID_CLASS, isOverLimit); }; + /** - * Setup the character count component + * Initialize component * - * @param {HTMLInputElement|HTMLTextAreaElement} inputEl The character count input element + * @description On init this function will create elements and update any + * attributes so it can tell the user how many characters are left. + * @param {HTMLInputElement|HTMLTextAreaElement} inputEl the components input */ +const enhanceCharacterCount = inputEl => { + const { + characterCountEl, + messageEl + } = getCharacterCountElements(inputEl); - -var setupAttributes = function setupAttributes(inputEl) { - var _getCharacterCountEle2 = getCharacterCountElements(inputEl), - characterCountEl = _getCharacterCountEle2.characterCountEl; - - var maxlength = inputEl.getAttribute("maxlength"); - if (!maxlength) return; - inputEl.removeAttribute("maxlength"); - characterCountEl.setAttribute("data-maxlength", maxlength); + // Hide hint and remove aria-live for backwards compatibility + messageEl.classList.add("usa-sr-only"); + messageEl.removeAttribute("aria-live"); + setDataLength(inputEl); + createStatusMessages(characterCountEl); }; - -var characterCount = behavior({ - input: _defineProperty({}, INPUT, function () { - updateCountMessage(this); - }) +const characterCount = behavior({ + input: { + [INPUT]() { + updateCountMessage(this); + } + } }, { - init: function init(root) { - select(INPUT, root).forEach(function (input) { - setupAttributes(input); - updateCountMessage(input); - }); + init(root) { + select(INPUT, root).forEach(input => enhanceCharacterCount(input)); }, - MESSAGE_INVALID_CLASS: MESSAGE_INVALID_CLASS, - VALIDATION_MESSAGE: VALIDATION_MESSAGE + MESSAGE_INVALID_CLASS, + VALIDATION_MESSAGE, + STATUS_MESSAGE_CLASS, + STATUS_MESSAGE_SR_ONLY_CLASS, + DEFAULT_STATUS_LABEL, + createStatusMessages, + getCountMessage, + updateCountMessage }); module.exports = characterCount; -},{"../../uswds-core/src/js/config":33,"../../uswds-core/src/js/utils/behavior":43,"../../uswds-core/src/js/utils/select":50}],19:[function(require,module,exports){ +},{"../../uswds-core/src/js/config":36,"../../uswds-core/src/js/utils/behavior":46,"../../uswds-core/src/js/utils/debounce":47,"../../uswds-core/src/js/utils/select":54}],19:[function(require,module,exports){ "use strict"; -var _templateObject, _templateObject2, _CLICK, _keydown, _behavior; - -function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var keymap = require("receptor/keymap"); +const keymap = require("receptor/keymap"); +const selectOrMatches = require("../../uswds-core/src/js/utils/select-or-matches"); +const behavior = require("../../uswds-core/src/js/utils/behavior"); +const Sanitizer = require("../../uswds-core/src/js/utils/sanitizer"); +const { + prefix: PREFIX +} = require("../../uswds-core/src/js/config"); +const { + CLICK +} = require("../../uswds-core/src/js/events"); +const COMBO_BOX_CLASS = `${PREFIX}-combo-box`; +const COMBO_BOX_PRISTINE_CLASS = `${COMBO_BOX_CLASS}--pristine`; +const SELECT_CLASS = `${COMBO_BOX_CLASS}__select`; +const INPUT_CLASS = `${COMBO_BOX_CLASS}__input`; +const CLEAR_INPUT_BUTTON_CLASS = `${COMBO_BOX_CLASS}__clear-input`; +const CLEAR_INPUT_BUTTON_WRAPPER_CLASS = `${CLEAR_INPUT_BUTTON_CLASS}__wrapper`; +const INPUT_BUTTON_SEPARATOR_CLASS = `${COMBO_BOX_CLASS}__input-button-separator`; +const TOGGLE_LIST_BUTTON_CLASS = `${COMBO_BOX_CLASS}__toggle-list`; +const TOGGLE_LIST_BUTTON_WRAPPER_CLASS = `${TOGGLE_LIST_BUTTON_CLASS}__wrapper`; +const LIST_CLASS = `${COMBO_BOX_CLASS}__list`; +const LIST_OPTION_CLASS = `${COMBO_BOX_CLASS}__list-option`; +const LIST_OPTION_FOCUSED_CLASS = `${LIST_OPTION_CLASS}--focused`; +const LIST_OPTION_SELECTED_CLASS = `${LIST_OPTION_CLASS}--selected`; +const STATUS_CLASS = `${COMBO_BOX_CLASS}__status`; +const COMBO_BOX = `.${COMBO_BOX_CLASS}`; +const SELECT = `.${SELECT_CLASS}`; +const INPUT = `.${INPUT_CLASS}`; +const CLEAR_INPUT_BUTTON = `.${CLEAR_INPUT_BUTTON_CLASS}`; +const TOGGLE_LIST_BUTTON = `.${TOGGLE_LIST_BUTTON_CLASS}`; +const LIST = `.${LIST_CLASS}`; +const LIST_OPTION = `.${LIST_OPTION_CLASS}`; +const LIST_OPTION_FOCUSED = `.${LIST_OPTION_FOCUSED_CLASS}`; +const LIST_OPTION_SELECTED = `.${LIST_OPTION_SELECTED_CLASS}`; +const STATUS = `.${STATUS_CLASS}`; +const DEFAULT_FILTER = ".*{{query}}.*"; +const noop = () => {}; -var selectOrMatches = require("../../uswds-core/src/js/utils/select-or-matches"); - -var behavior = require("../../uswds-core/src/js/utils/behavior"); - -var Sanitizer = require("../../uswds-core/src/js/utils/sanitizer"); - -var _require = require("../../uswds-core/src/js/config"), - PREFIX = _require.prefix; - -var _require2 = require("../../uswds-core/src/js/events"), - CLICK = _require2.CLICK; - -var COMBO_BOX_CLASS = "".concat(PREFIX, "-combo-box"); -var COMBO_BOX_PRISTINE_CLASS = "".concat(COMBO_BOX_CLASS, "--pristine"); -var SELECT_CLASS = "".concat(COMBO_BOX_CLASS, "__select"); -var INPUT_CLASS = "".concat(COMBO_BOX_CLASS, "__input"); -var CLEAR_INPUT_BUTTON_CLASS = "".concat(COMBO_BOX_CLASS, "__clear-input"); -var CLEAR_INPUT_BUTTON_WRAPPER_CLASS = "".concat(CLEAR_INPUT_BUTTON_CLASS, "__wrapper"); -var INPUT_BUTTON_SEPARATOR_CLASS = "".concat(COMBO_BOX_CLASS, "__input-button-separator"); -var TOGGLE_LIST_BUTTON_CLASS = "".concat(COMBO_BOX_CLASS, "__toggle-list"); -var TOGGLE_LIST_BUTTON_WRAPPER_CLASS = "".concat(TOGGLE_LIST_BUTTON_CLASS, "__wrapper"); -var LIST_CLASS = "".concat(COMBO_BOX_CLASS, "__list"); -var LIST_OPTION_CLASS = "".concat(COMBO_BOX_CLASS, "__list-option"); -var LIST_OPTION_FOCUSED_CLASS = "".concat(LIST_OPTION_CLASS, "--focused"); -var LIST_OPTION_SELECTED_CLASS = "".concat(LIST_OPTION_CLASS, "--selected"); -var STATUS_CLASS = "".concat(COMBO_BOX_CLASS, "__status"); -var COMBO_BOX = ".".concat(COMBO_BOX_CLASS); -var SELECT = ".".concat(SELECT_CLASS); -var INPUT = ".".concat(INPUT_CLASS); -var CLEAR_INPUT_BUTTON = ".".concat(CLEAR_INPUT_BUTTON_CLASS); -var TOGGLE_LIST_BUTTON = ".".concat(TOGGLE_LIST_BUTTON_CLASS); -var LIST = ".".concat(LIST_CLASS); -var LIST_OPTION = ".".concat(LIST_OPTION_CLASS); -var LIST_OPTION_FOCUSED = ".".concat(LIST_OPTION_FOCUSED_CLASS); -var LIST_OPTION_SELECTED = ".".concat(LIST_OPTION_SELECTED_CLASS); -var STATUS = ".".concat(STATUS_CLASS); -var DEFAULT_FILTER = ".*{{query}}.*"; - -var noop = function noop() {}; /** * set the value of the element and dispatch a change event * * @param {HTMLInputElement|HTMLSelectElement} el The element to update * @param {string} value The new value of the element */ - - -var changeElementValue = function changeElementValue(el) { - var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; - var elementToChange = el; +const changeElementValue = (el, value = "") => { + const elementToChange = el; elementToChange.value = value; - var event = new CustomEvent("change", { + const event = new CustomEvent("change", { bubbles: true, cancelable: true, detail: { - value: value + value } }); elementToChange.dispatchEvent(event); }; + /** * The elements within the combo box. * @typedef {Object} ComboBoxContext @@ -1143,145 +1092,154 @@ var changeElementValue = function changeElementValue(el) { * @param {HTMLElement} el the element within the combo box * @returns {ComboBoxContext} elements */ - - -var getComboBoxContext = function getComboBoxContext(el) { - var comboBoxEl = el.closest(COMBO_BOX); - +const getComboBoxContext = el => { + const comboBoxEl = el.closest(COMBO_BOX); if (!comboBoxEl) { - throw new Error("Element is missing outer ".concat(COMBO_BOX)); - } - - var selectEl = comboBoxEl.querySelector(SELECT); - var inputEl = comboBoxEl.querySelector(INPUT); - var listEl = comboBoxEl.querySelector(LIST); - var statusEl = comboBoxEl.querySelector(STATUS); - var focusedOptionEl = comboBoxEl.querySelector(LIST_OPTION_FOCUSED); - var selectedOptionEl = comboBoxEl.querySelector(LIST_OPTION_SELECTED); - var toggleListBtnEl = comboBoxEl.querySelector(TOGGLE_LIST_BUTTON); - var clearInputBtnEl = comboBoxEl.querySelector(CLEAR_INPUT_BUTTON); - var isPristine = comboBoxEl.classList.contains(COMBO_BOX_PRISTINE_CLASS); - var disableFiltering = comboBoxEl.dataset.disableFiltering === "true"; + throw new Error(`Element is missing outer ${COMBO_BOX}`); + } + const selectEl = comboBoxEl.querySelector(SELECT); + const inputEl = comboBoxEl.querySelector(INPUT); + const listEl = comboBoxEl.querySelector(LIST); + const statusEl = comboBoxEl.querySelector(STATUS); + const focusedOptionEl = comboBoxEl.querySelector(LIST_OPTION_FOCUSED); + const selectedOptionEl = comboBoxEl.querySelector(LIST_OPTION_SELECTED); + const toggleListBtnEl = comboBoxEl.querySelector(TOGGLE_LIST_BUTTON); + const clearInputBtnEl = comboBoxEl.querySelector(CLEAR_INPUT_BUTTON); + const isPristine = comboBoxEl.classList.contains(COMBO_BOX_PRISTINE_CLASS); + const disableFiltering = comboBoxEl.dataset.disableFiltering === "true"; return { - comboBoxEl: comboBoxEl, - selectEl: selectEl, - inputEl: inputEl, - listEl: listEl, - statusEl: statusEl, - focusedOptionEl: focusedOptionEl, - selectedOptionEl: selectedOptionEl, - toggleListBtnEl: toggleListBtnEl, - clearInputBtnEl: clearInputBtnEl, - isPristine: isPristine, - disableFiltering: disableFiltering + comboBoxEl, + selectEl, + inputEl, + listEl, + statusEl, + focusedOptionEl, + selectedOptionEl, + toggleListBtnEl, + clearInputBtnEl, + isPristine, + disableFiltering }; }; + /** * Disable the combo-box component * * @param {HTMLInputElement} el An element within the combo box component */ - - -var disable = function disable(el) { - var _getComboBoxContext = getComboBoxContext(el), - inputEl = _getComboBoxContext.inputEl, - toggleListBtnEl = _getComboBoxContext.toggleListBtnEl, - clearInputBtnEl = _getComboBoxContext.clearInputBtnEl; - +const disable = el => { + const { + inputEl, + toggleListBtnEl, + clearInputBtnEl + } = getComboBoxContext(el); clearInputBtnEl.hidden = true; clearInputBtnEl.disabled = true; toggleListBtnEl.disabled = true; inputEl.disabled = true; }; + /** - * Enable the combo-box component + * Check for aria-disabled on initialization * * @param {HTMLInputElement} el An element within the combo box component */ +const ariaDisable = el => { + const { + inputEl, + toggleListBtnEl, + clearInputBtnEl + } = getComboBoxContext(el); + clearInputBtnEl.hidden = true; + clearInputBtnEl.setAttribute("aria-disabled", true); + toggleListBtnEl.setAttribute("aria-disabled", true); + inputEl.setAttribute("aria-disabled", true); +}; - -var enable = function enable(el) { - var _getComboBoxContext2 = getComboBoxContext(el), - inputEl = _getComboBoxContext2.inputEl, - toggleListBtnEl = _getComboBoxContext2.toggleListBtnEl, - clearInputBtnEl = _getComboBoxContext2.clearInputBtnEl; - +/** + * Enable the combo-box component + * + * @param {HTMLInputElement} el An element within the combo box component + */ +const enable = el => { + const { + inputEl, + toggleListBtnEl, + clearInputBtnEl + } = getComboBoxContext(el); clearInputBtnEl.hidden = false; clearInputBtnEl.disabled = false; toggleListBtnEl.disabled = false; inputEl.disabled = false; }; + /** * Enhance a select element into a combo box component. * * @param {HTMLElement} _comboBoxEl The initial element of the combo box component */ - - -var enhanceComboBox = function enhanceComboBox(_comboBoxEl) { - var comboBoxEl = _comboBoxEl.closest(COMBO_BOX); - +const enhanceComboBox = _comboBoxEl => { + const comboBoxEl = _comboBoxEl.closest(COMBO_BOX); if (comboBoxEl.dataset.enhanced) return; - var selectEl = comboBoxEl.querySelector("select"); - + const selectEl = comboBoxEl.querySelector("select"); if (!selectEl) { - throw new Error("".concat(COMBO_BOX, " is missing inner select")); - } - - var selectId = selectEl.id; - var selectLabel = document.querySelector("label[for=\"".concat(selectId, "\"]")); - var listId = "".concat(selectId, "--list"); - var listIdLabel = "".concat(selectId, "-label"); - var assistiveHintID = "".concat(selectId, "--assistiveHint"); - var additionalAttributes = []; - var defaultValue = comboBoxEl.dataset.defaultValue; - var placeholder = comboBoxEl.dataset.placeholder; - var selectedOption; - + throw new Error(`${COMBO_BOX} is missing inner select`); + } + const selectId = selectEl.id; + const selectLabel = document.querySelector(`label[for="${selectId}"]`); + const listId = `${selectId}--list`; + const listIdLabel = `${selectId}-label`; + const assistiveHintID = `${selectId}--assistiveHint`; + const additionalAttributes = []; + const { + defaultValue + } = comboBoxEl.dataset; + const { + placeholder + } = comboBoxEl.dataset; + let selectedOption; if (placeholder) { additionalAttributes.push({ - placeholder: placeholder + placeholder }); } - if (defaultValue) { - for (var i = 0, len = selectEl.options.length; i < len; i += 1) { - var optionEl = selectEl.options[i]; - + for (let i = 0, len = selectEl.options.length; i < len; i += 1) { + const optionEl = selectEl.options[i]; if (optionEl.value === defaultValue) { selectedOption = optionEl; break; } } } + /** * Throw error if combobox is missing a label or label is missing * `for` attribute. Otherwise, set the ID to match the
    aria-labelledby */ - - - if (!selectLabel || !selectLabel.matches("label[for=\"".concat(selectId, "\"]"))) { - throw new Error("".concat(COMBO_BOX, " for ").concat(selectId, " is either missing a label or a \"for\" attribute")); + if (!selectLabel || !selectLabel.matches(`label[for="${selectId}"]`)) { + throw new Error(`${COMBO_BOX} for ${selectId} is either missing a label or a "for" attribute`); } else { selectLabel.setAttribute("id", listIdLabel); } - selectLabel.setAttribute("id", listIdLabel); selectEl.setAttribute("aria-hidden", "true"); selectEl.setAttribute("tabindex", "-1"); selectEl.classList.add("usa-sr-only", SELECT_CLASS); selectEl.id = ""; selectEl.value = ""; - ["required", "aria-label", "aria-labelledby"].forEach(function (name) { + ["required", "aria-label", "aria-labelledby"].forEach(name => { if (selectEl.hasAttribute(name)) { - var value = selectEl.getAttribute(name); - additionalAttributes.push(_defineProperty({}, name, value)); + const value = selectEl.getAttribute(name); + additionalAttributes.push({ + [name]: value + }); selectEl.removeAttribute(name); } - }); // sanitize doesn't like functions in template literals + }); - var input = document.createElement("input"); + // sanitize doesn't like functions in template literals + const input = document.createElement("input"); input.setAttribute("id", selectId); input.setAttribute("aria-owns", listId); input.setAttribute("aria-controls", listId); @@ -1293,31 +1251,51 @@ var enhanceComboBox = function enhanceComboBox(_comboBoxEl) { input.setAttribute("class", INPUT_CLASS); input.setAttribute("type", "text"); input.setAttribute("role", "combobox"); - additionalAttributes.forEach(function (attr) { - return Object.keys(attr).forEach(function (key) { - var value = Sanitizer.escapeHTML(_templateObject || (_templateObject = _taggedTemplateLiteral(["", ""])), attr[key]); - input.setAttribute(key, value); - }); - }); + additionalAttributes.forEach(attr => Object.keys(attr).forEach(key => { + const value = Sanitizer.escapeHTML`${attr[key]}`; + input.setAttribute(key, value); + })); comboBoxEl.insertAdjacentElement("beforeend", input); - comboBoxEl.insertAdjacentHTML("beforeend", Sanitizer.escapeHTML(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n \n \n \n  \n \n \n \n
\n
\n \n When autocomplete results are available use up and down arrows to review and enter to select.\n Touch device users, explore by touch or with swipe gestures.\n "])), CLEAR_INPUT_BUTTON_WRAPPER_CLASS, CLEAR_INPUT_BUTTON_CLASS, INPUT_BUTTON_SEPARATOR_CLASS, TOGGLE_LIST_BUTTON_WRAPPER_CLASS, TOGGLE_LIST_BUTTON_CLASS, listId, LIST_CLASS, listIdLabel, STATUS_CLASS, assistiveHintID)); - + comboBoxEl.insertAdjacentHTML("beforeend", Sanitizer.escapeHTML` + + + +   + + + + +
+ + When autocomplete results are available use up and down arrows to review and enter to select. + Touch device users, explore by touch or with swipe gestures. + `); if (selectedOption) { - var _getComboBoxContext3 = getComboBoxContext(comboBoxEl), - inputEl = _getComboBoxContext3.inputEl; - + const { + inputEl + } = getComboBoxContext(comboBoxEl); changeElementValue(selectEl, selectedOption.value); changeElementValue(inputEl, selectedOption.text); comboBoxEl.classList.add(COMBO_BOX_PRISTINE_CLASS); } - if (selectEl.disabled) { disable(comboBoxEl); selectEl.disabled = false; } - + if (selectEl.hasAttribute("aria-disabled")) { + ariaDisable(comboBoxEl); + selectEl.removeAttribute("aria-disabled"); + } comboBoxEl.dataset.enhanced = "true"; }; + /** * Manage the focused element within the list options when * navigating via keyboard. @@ -1328,44 +1306,36 @@ var enhanceComboBox = function enhanceComboBox(_comboBoxEl) { * @param {boolean} options.skipFocus skip focus of highlighted item * @param {boolean} options.preventScroll should skip procedure to scroll to element */ - - -var highlightOption = function highlightOption(el, nextEl) { - var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, - skipFocus = _ref.skipFocus, - preventScroll = _ref.preventScroll; - - var _getComboBoxContext4 = getComboBoxContext(el), - inputEl = _getComboBoxContext4.inputEl, - listEl = _getComboBoxContext4.listEl, - focusedOptionEl = _getComboBoxContext4.focusedOptionEl; - +const highlightOption = (el, nextEl, { + skipFocus, + preventScroll +} = {}) => { + const { + inputEl, + listEl, + focusedOptionEl + } = getComboBoxContext(el); if (focusedOptionEl) { focusedOptionEl.classList.remove(LIST_OPTION_FOCUSED_CLASS); focusedOptionEl.setAttribute("tabIndex", "-1"); } - if (nextEl) { inputEl.setAttribute("aria-activedescendant", nextEl.id); nextEl.setAttribute("tabIndex", "0"); nextEl.classList.add(LIST_OPTION_FOCUSED_CLASS); - if (!preventScroll) { - var optionBottom = nextEl.offsetTop + nextEl.offsetHeight; - var currentBottom = listEl.scrollTop + listEl.offsetHeight; - + const optionBottom = nextEl.offsetTop + nextEl.offsetHeight; + const currentBottom = listEl.scrollTop + listEl.offsetHeight; if (optionBottom > currentBottom) { listEl.scrollTop = optionBottom - listEl.offsetHeight; } - if (nextEl.offsetTop < listEl.scrollTop) { listEl.scrollTop = nextEl.offsetTop; } } - if (!skipFocus) { nextEl.focus({ - preventScroll: preventScroll + preventScroll }); } } else { @@ -1373,6 +1343,7 @@ var highlightOption = function highlightOption(el, nextEl) { inputEl.focus(); } }; + /** * Generate a dynamic regular expression based off of a replaceable and possibly filtered value. * @@ -1380,97 +1351,76 @@ var highlightOption = function highlightOption(el, nextEl) { * @param {string} query The value to use in the regular expression * @param {object} extras An object of regular expressions to replace and filter the query */ - - -var generateDynamicRegExp = function generateDynamicRegExp(filter) { - var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; - var extras = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - var escapeRegExp = function escapeRegExp(text) { - return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); - }; - - var find = filter.replace(/{{(.*?)}}/g, function (m, $1) { - var key = $1.trim(); - var queryFilter = extras[key]; - +const generateDynamicRegExp = (filter, query = "", extras = {}) => { + const escapeRegExp = text => text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); + let find = filter.replace(/{{(.*?)}}/g, (m, $1) => { + const key = $1.trim(); + const queryFilter = extras[key]; if (key !== "query" && queryFilter) { - var matcher = new RegExp(queryFilter, "i"); - var matches = query.match(matcher); - + const matcher = new RegExp(queryFilter, "i"); + const matches = query.match(matcher); if (matches) { return escapeRegExp(matches[1]); } - return ""; } - return escapeRegExp(query); }); - find = "^(?:".concat(find, ")$"); + find = `^(?:${find})$`; return new RegExp(find, "i"); }; + /** * Display the option list of a combo box component. * * @param {HTMLElement} el An element within the combo box component */ - - -var displayList = function displayList(el) { - var _getComboBoxContext5 = getComboBoxContext(el), - comboBoxEl = _getComboBoxContext5.comboBoxEl, - selectEl = _getComboBoxContext5.selectEl, - inputEl = _getComboBoxContext5.inputEl, - listEl = _getComboBoxContext5.listEl, - statusEl = _getComboBoxContext5.statusEl, - isPristine = _getComboBoxContext5.isPristine, - disableFiltering = _getComboBoxContext5.disableFiltering; - - var selectedItemId; - var firstFoundId; - var listOptionBaseId = "".concat(listEl.id, "--option-"); - var inputValue = (inputEl.value || "").toLowerCase(); - var filter = comboBoxEl.dataset.filter || DEFAULT_FILTER; - var regex = generateDynamicRegExp(filter, inputValue, comboBoxEl.dataset); - var options = []; - - for (var i = 0, len = selectEl.options.length; i < len; i += 1) { - var optionEl = selectEl.options[i]; - var optionId = "".concat(listOptionBaseId).concat(options.length); - +const displayList = el => { + const { + comboBoxEl, + selectEl, + inputEl, + listEl, + statusEl, + isPristine, + disableFiltering + } = getComboBoxContext(el); + let selectedItemId; + let firstFoundId; + const listOptionBaseId = `${listEl.id}--option-`; + const inputValue = (inputEl.value || "").toLowerCase(); + const filter = comboBoxEl.dataset.filter || DEFAULT_FILTER; + const regex = generateDynamicRegExp(filter, inputValue, comboBoxEl.dataset); + const options = []; + for (let i = 0, len = selectEl.options.length; i < len; i += 1) { + const optionEl = selectEl.options[i]; + const optionId = `${listOptionBaseId}${options.length}`; if (optionEl.value && (disableFiltering || isPristine || !inputValue || regex.test(optionEl.text))) { if (selectEl.value && optionEl.value === selectEl.value) { selectedItemId = optionId; } - if (disableFiltering && !firstFoundId && regex.test(optionEl.text)) { firstFoundId = optionId; } - options.push(optionEl); } } - - var numOptions = options.length; - var optionHtml = options.map(function (option, index) { - var optionId = "".concat(listOptionBaseId).concat(index); - var classes = [LIST_OPTION_CLASS]; - var tabindex = "-1"; - var ariaSelected = "false"; - + const numOptions = options.length; + const optionHtml = options.map((option, index) => { + const optionId = `${listOptionBaseId}${index}`; + const classes = [LIST_OPTION_CLASS]; + let tabindex = "-1"; + let ariaSelected = "false"; if (optionId === selectedItemId) { classes.push(LIST_OPTION_SELECTED_CLASS, LIST_OPTION_FOCUSED_CLASS); tabindex = "0"; ariaSelected = "true"; } - if (!selectedItemId && index === 0) { classes.push(LIST_OPTION_FOCUSED_CLASS); tabindex = "0"; } - - var li = document.createElement("li"); + const li = document.createElement("li"); li.setAttribute("aria-setsize", options.length); li.setAttribute("aria-posinset", index + 1); li.setAttribute("aria-selected", ariaSelected); @@ -1482,137 +1432,122 @@ var displayList = function displayList(el) { li.textContent = option.text; return li; }); - var noResults = document.createElement("li"); - noResults.setAttribute("class", "".concat(LIST_OPTION_CLASS, "--no-results")); + const noResults = document.createElement("li"); + noResults.setAttribute("class", `${LIST_OPTION_CLASS}--no-results`); noResults.textContent = "No results found"; listEl.hidden = false; - if (numOptions) { listEl.innerHTML = ""; - optionHtml.forEach(function (item) { - return listEl.insertAdjacentElement("beforeend", item); - }); + optionHtml.forEach(item => listEl.insertAdjacentElement("beforeend", item)); } else { listEl.innerHTML = ""; listEl.insertAdjacentElement("beforeend", noResults); } - inputEl.setAttribute("aria-expanded", "true"); - statusEl.textContent = numOptions ? "".concat(numOptions, " result").concat(numOptions > 1 ? "s" : "", " available.") : "No results."; - var itemToFocus; - + statusEl.textContent = numOptions ? `${numOptions} result${numOptions > 1 ? "s" : ""} available.` : "No results."; + let itemToFocus; if (isPristine && selectedItemId) { - itemToFocus = listEl.querySelector("#".concat(selectedItemId)); + itemToFocus = listEl.querySelector(`#${selectedItemId}`); } else if (disableFiltering && firstFoundId) { - itemToFocus = listEl.querySelector("#".concat(firstFoundId)); + itemToFocus = listEl.querySelector(`#${firstFoundId}`); } - if (itemToFocus) { highlightOption(listEl, itemToFocus, { skipFocus: true }); } }; + /** * Hide the option list of a combo box component. * * @param {HTMLElement} el An element within the combo box component */ - - -var hideList = function hideList(el) { - var _getComboBoxContext6 = getComboBoxContext(el), - inputEl = _getComboBoxContext6.inputEl, - listEl = _getComboBoxContext6.listEl, - statusEl = _getComboBoxContext6.statusEl, - focusedOptionEl = _getComboBoxContext6.focusedOptionEl; - +const hideList = el => { + const { + inputEl, + listEl, + statusEl, + focusedOptionEl + } = getComboBoxContext(el); statusEl.innerHTML = ""; inputEl.setAttribute("aria-expanded", "false"); inputEl.setAttribute("aria-activedescendant", ""); - if (focusedOptionEl) { focusedOptionEl.classList.remove(LIST_OPTION_FOCUSED_CLASS); } - listEl.scrollTop = 0; listEl.hidden = true; }; + /** * Select an option list of the combo box component. * * @param {HTMLElement} listOptionEl The list option being selected */ - - -var selectItem = function selectItem(listOptionEl) { - var _getComboBoxContext7 = getComboBoxContext(listOptionEl), - comboBoxEl = _getComboBoxContext7.comboBoxEl, - selectEl = _getComboBoxContext7.selectEl, - inputEl = _getComboBoxContext7.inputEl; - +const selectItem = listOptionEl => { + const { + comboBoxEl, + selectEl, + inputEl + } = getComboBoxContext(listOptionEl); changeElementValue(selectEl, listOptionEl.dataset.value); changeElementValue(inputEl, listOptionEl.textContent); comboBoxEl.classList.add(COMBO_BOX_PRISTINE_CLASS); hideList(comboBoxEl); inputEl.focus(); }; + /** * Clear the input of the combo box * * @param {HTMLButtonElement} clearButtonEl The clear input button */ - - -var clearInput = function clearInput(clearButtonEl) { - var _getComboBoxContext8 = getComboBoxContext(clearButtonEl), - comboBoxEl = _getComboBoxContext8.comboBoxEl, - listEl = _getComboBoxContext8.listEl, - selectEl = _getComboBoxContext8.selectEl, - inputEl = _getComboBoxContext8.inputEl; - - var listShown = !listEl.hidden; +const clearInput = clearButtonEl => { + const { + comboBoxEl, + listEl, + selectEl, + inputEl + } = getComboBoxContext(clearButtonEl); + const listShown = !listEl.hidden; if (selectEl.value) changeElementValue(selectEl); if (inputEl.value) changeElementValue(inputEl); comboBoxEl.classList.remove(COMBO_BOX_PRISTINE_CLASS); if (listShown) displayList(comboBoxEl); inputEl.focus(); }; + /** * Reset the select based off of currently set select value * * @param {HTMLElement} el An element within the combo box component */ - - -var resetSelection = function resetSelection(el) { - var _getComboBoxContext9 = getComboBoxContext(el), - comboBoxEl = _getComboBoxContext9.comboBoxEl, - selectEl = _getComboBoxContext9.selectEl, - inputEl = _getComboBoxContext9.inputEl; - - var selectValue = selectEl.value; - var inputValue = (inputEl.value || "").toLowerCase(); - +const resetSelection = el => { + const { + comboBoxEl, + selectEl, + inputEl + } = getComboBoxContext(el); + const selectValue = selectEl.value; + const inputValue = (inputEl.value || "").toLowerCase(); if (selectValue) { - for (var i = 0, len = selectEl.options.length; i < len; i += 1) { - var optionEl = selectEl.options[i]; - + for (let i = 0, len = selectEl.options.length; i < len; i += 1) { + const optionEl = selectEl.options[i]; if (optionEl.value === selectValue) { if (inputValue !== optionEl.text) { changeElementValue(inputEl, optionEl.text); } - comboBoxEl.classList.add(COMBO_BOX_PRISTINE_CLASS); return; } } } - if (inputValue) { changeElementValue(inputEl); } }; + /** * Select an option list of the combo box component based off of * having a current focused list option or @@ -1621,22 +1556,18 @@ var resetSelection = function resetSelection(el) { * * @param {HTMLElement} el An element within the combo box component */ - - -var completeSelection = function completeSelection(el) { - var _getComboBoxContext10 = getComboBoxContext(el), - comboBoxEl = _getComboBoxContext10.comboBoxEl, - selectEl = _getComboBoxContext10.selectEl, - inputEl = _getComboBoxContext10.inputEl, - statusEl = _getComboBoxContext10.statusEl; - +const completeSelection = el => { + const { + comboBoxEl, + selectEl, + inputEl, + statusEl + } = getComboBoxContext(el); statusEl.textContent = ""; - var inputValue = (inputEl.value || "").toLowerCase(); - + const inputValue = (inputEl.value || "").toLowerCase(); if (inputValue) { - for (var i = 0, len = selectEl.options.length; i < len; i += 1) { - var optionEl = selectEl.options[i]; - + for (let i = 0, len = selectEl.options.length; i < len; i += 1) { + const optionEl = selectEl.options[i]; if (optionEl.text.toLowerCase() === inputValue) { changeElementValue(selectEl, optionEl.value); changeElementValue(inputEl, optionEl.text); @@ -1645,372 +1576,338 @@ var completeSelection = function completeSelection(el) { } } } - resetSelection(comboBoxEl); }; + /** * Handle the escape event within the combo box component. * * @param {KeyboardEvent} event An event within the combo box component */ - - -var handleEscape = function handleEscape(event) { - var _getComboBoxContext11 = getComboBoxContext(event.target), - comboBoxEl = _getComboBoxContext11.comboBoxEl, - inputEl = _getComboBoxContext11.inputEl; - +const handleEscape = event => { + const { + comboBoxEl, + inputEl + } = getComboBoxContext(event.target); hideList(comboBoxEl); resetSelection(comboBoxEl); inputEl.focus(); }; + /** * Handle the down event within the combo box component. * * @param {KeyboardEvent} event An event within the combo box component */ - - -var handleDownFromInput = function handleDownFromInput(event) { - var _getComboBoxContext12 = getComboBoxContext(event.target), - comboBoxEl = _getComboBoxContext12.comboBoxEl, - listEl = _getComboBoxContext12.listEl; - +const handleDownFromInput = event => { + const { + comboBoxEl, + listEl + } = getComboBoxContext(event.target); if (listEl.hidden) { displayList(comboBoxEl); } - - var nextOptionEl = listEl.querySelector(LIST_OPTION_FOCUSED) || listEl.querySelector(LIST_OPTION); - + const nextOptionEl = listEl.querySelector(LIST_OPTION_FOCUSED) || listEl.querySelector(LIST_OPTION); if (nextOptionEl) { highlightOption(comboBoxEl, nextOptionEl); } - event.preventDefault(); }; + /** * Handle the enter event from an input element within the combo box component. * * @param {KeyboardEvent} event An event within the combo box component */ - - -var handleEnterFromInput = function handleEnterFromInput(event) { - var _getComboBoxContext13 = getComboBoxContext(event.target), - comboBoxEl = _getComboBoxContext13.comboBoxEl, - listEl = _getComboBoxContext13.listEl; - - var listShown = !listEl.hidden; +const handleEnterFromInput = event => { + const { + comboBoxEl, + listEl + } = getComboBoxContext(event.target); + const listShown = !listEl.hidden; completeSelection(comboBoxEl); - if (listShown) { hideList(comboBoxEl); } - event.preventDefault(); }; + /** * Handle the down event within the combo box component. * * @param {KeyboardEvent} event An event within the combo box component */ - - -var handleDownFromListOption = function handleDownFromListOption(event) { - var focusedOptionEl = event.target; - var nextOptionEl = focusedOptionEl.nextSibling; - +const handleDownFromListOption = event => { + const focusedOptionEl = event.target; + const nextOptionEl = focusedOptionEl.nextSibling; if (nextOptionEl) { highlightOption(focusedOptionEl, nextOptionEl); } - event.preventDefault(); }; + /** - * Handle the tab event from an list option element within the combo box component. + * Handle the space event from an list option element within the combo box component. * * @param {KeyboardEvent} event An event within the combo box component */ - - -var handleTabFromListOption = function handleTabFromListOption(event) { +const handleSpaceFromListOption = event => { selectItem(event.target); event.preventDefault(); }; + /** * Handle the enter event from list option within the combo box component. * * @param {KeyboardEvent} event An event within the combo box component */ - - -var handleEnterFromListOption = function handleEnterFromListOption(event) { +const handleEnterFromListOption = event => { selectItem(event.target); event.preventDefault(); }; + /** * Handle the up event from list option within the combo box component. * * @param {KeyboardEvent} event An event within the combo box component */ - - -var handleUpFromListOption = function handleUpFromListOption(event) { - var _getComboBoxContext14 = getComboBoxContext(event.target), - comboBoxEl = _getComboBoxContext14.comboBoxEl, - listEl = _getComboBoxContext14.listEl, - focusedOptionEl = _getComboBoxContext14.focusedOptionEl; - - var nextOptionEl = focusedOptionEl && focusedOptionEl.previousSibling; - var listShown = !listEl.hidden; +const handleUpFromListOption = event => { + const { + comboBoxEl, + listEl, + focusedOptionEl + } = getComboBoxContext(event.target); + const nextOptionEl = focusedOptionEl && focusedOptionEl.previousSibling; + const listShown = !listEl.hidden; highlightOption(comboBoxEl, nextOptionEl); - if (listShown) { event.preventDefault(); } - if (!nextOptionEl) { hideList(comboBoxEl); } }; + /** * Select list option on the mouseover event. * * @param {MouseEvent} event The mouseover event * @param {HTMLLIElement} listOptionEl An element within the combo box component */ - - -var handleMouseover = function handleMouseover(listOptionEl) { - var isCurrentlyFocused = listOptionEl.classList.contains(LIST_OPTION_FOCUSED_CLASS); +const handleMouseover = listOptionEl => { + const isCurrentlyFocused = listOptionEl.classList.contains(LIST_OPTION_FOCUSED_CLASS); if (isCurrentlyFocused) return; highlightOption(listOptionEl, listOptionEl, { preventScroll: true }); }; + /** * Toggle the list when the button is clicked * * @param {HTMLElement} el An element within the combo box component */ - - -var toggleList = function toggleList(el) { - var _getComboBoxContext15 = getComboBoxContext(el), - comboBoxEl = _getComboBoxContext15.comboBoxEl, - listEl = _getComboBoxContext15.listEl, - inputEl = _getComboBoxContext15.inputEl; - +const toggleList = el => { + const { + comboBoxEl, + listEl, + inputEl + } = getComboBoxContext(el); if (listEl.hidden) { displayList(comboBoxEl); } else { hideList(comboBoxEl); } - inputEl.focus(); }; + /** * Handle click from input * * @param {HTMLInputElement} el An element within the combo box component */ - - -var handleClickFromInput = function handleClickFromInput(el) { - var _getComboBoxContext16 = getComboBoxContext(el), - comboBoxEl = _getComboBoxContext16.comboBoxEl, - listEl = _getComboBoxContext16.listEl; - +const handleClickFromInput = el => { + const { + comboBoxEl, + listEl + } = getComboBoxContext(el); if (listEl.hidden) { displayList(comboBoxEl); } }; - -var comboBox = behavior((_behavior = {}, _defineProperty(_behavior, CLICK, (_CLICK = {}, _defineProperty(_CLICK, INPUT, function () { - if (this.disabled) return; - handleClickFromInput(this); -}), _defineProperty(_CLICK, TOGGLE_LIST_BUTTON, function () { - if (this.disabled) return; - toggleList(this); -}), _defineProperty(_CLICK, LIST_OPTION, function () { - if (this.disabled) return; - selectItem(this); -}), _defineProperty(_CLICK, CLEAR_INPUT_BUTTON, function () { - if (this.disabled) return; - clearInput(this); -}), _CLICK)), _defineProperty(_behavior, "focusout", _defineProperty({}, COMBO_BOX, function (event) { - if (!this.contains(event.relatedTarget)) { - resetSelection(this); - hideList(this); - } -})), _defineProperty(_behavior, "keydown", (_keydown = {}, _defineProperty(_keydown, COMBO_BOX, keymap({ - Escape: handleEscape -})), _defineProperty(_keydown, INPUT, keymap({ - Enter: handleEnterFromInput, - ArrowDown: handleDownFromInput, - Down: handleDownFromInput -})), _defineProperty(_keydown, LIST_OPTION, keymap({ - ArrowUp: handleUpFromListOption, - Up: handleUpFromListOption, - ArrowDown: handleDownFromListOption, - Down: handleDownFromListOption, - Enter: handleEnterFromListOption, - Tab: handleTabFromListOption, - "Shift+Tab": noop -})), _keydown)), _defineProperty(_behavior, "input", _defineProperty({}, INPUT, function () { - var comboBoxEl = this.closest(COMBO_BOX); - comboBoxEl.classList.remove(COMBO_BOX_PRISTINE_CLASS); - displayList(this); -})), _defineProperty(_behavior, "mouseover", _defineProperty({}, LIST_OPTION, function () { - handleMouseover(this); -})), _behavior), { - init: function init(root) { - selectOrMatches(COMBO_BOX, root).forEach(function (comboBoxEl) { +const comboBox = behavior({ + [CLICK]: { + [INPUT]() { + if (this.disabled) return; + handleClickFromInput(this); + }, + [TOGGLE_LIST_BUTTON]() { + if (this.disabled) return; + toggleList(this); + }, + [LIST_OPTION]() { + if (this.disabled) return; + selectItem(this); + }, + [CLEAR_INPUT_BUTTON]() { + if (this.disabled) return; + clearInput(this); + } + }, + focusout: { + [COMBO_BOX](event) { + if (!this.contains(event.relatedTarget)) { + resetSelection(this); + hideList(this); + } + } + }, + keydown: { + [COMBO_BOX]: keymap({ + Escape: handleEscape + }), + [INPUT]: keymap({ + Enter: handleEnterFromInput, + ArrowDown: handleDownFromInput, + Down: handleDownFromInput + }), + [LIST_OPTION]: keymap({ + ArrowUp: handleUpFromListOption, + Up: handleUpFromListOption, + ArrowDown: handleDownFromListOption, + Down: handleDownFromListOption, + Enter: handleEnterFromListOption, + " ": handleSpaceFromListOption, + "Shift+Tab": noop + }) + }, + input: { + [INPUT]() { + const comboBoxEl = this.closest(COMBO_BOX); + comboBoxEl.classList.remove(COMBO_BOX_PRISTINE_CLASS); + displayList(this); + } + }, + mouseover: { + [LIST_OPTION]() { + handleMouseover(this); + } + } +}, { + init(root) { + selectOrMatches(COMBO_BOX, root).forEach(comboBoxEl => { enhanceComboBox(comboBoxEl); }); }, - getComboBoxContext: getComboBoxContext, - enhanceComboBox: enhanceComboBox, - generateDynamicRegExp: generateDynamicRegExp, - disable: disable, - enable: enable, - displayList: displayList, - hideList: hideList, - COMBO_BOX_CLASS: COMBO_BOX_CLASS + getComboBoxContext, + enhanceComboBox, + generateDynamicRegExp, + disable, + enable, + displayList, + hideList, + COMBO_BOX_CLASS }); module.exports = comboBox; -},{"../../uswds-core/src/js/config":33,"../../uswds-core/src/js/events":34,"../../uswds-core/src/js/utils/behavior":43,"../../uswds-core/src/js/utils/sanitizer":47,"../../uswds-core/src/js/utils/select-or-matches":49,"receptor/keymap":12}],20:[function(require,module,exports){ +},{"../../uswds-core/src/js/config":36,"../../uswds-core/src/js/events":37,"../../uswds-core/src/js/utils/behavior":46,"../../uswds-core/src/js/utils/sanitizer":51,"../../uswds-core/src/js/utils/select-or-matches":53,"receptor/keymap":11}],20:[function(require,module,exports){ "use strict"; -var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _CLICK, _keydown, _focusout, _datePickerEvents; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -var keymap = require("receptor/keymap"); - -var behavior = require("../../uswds-core/src/js/utils/behavior"); - -var select = require("../../uswds-core/src/js/utils/select"); - -var selectOrMatches = require("../../uswds-core/src/js/utils/select-or-matches"); - -var _require = require("../../uswds-core/src/js/config"), - PREFIX = _require.prefix; - -var _require2 = require("../../uswds-core/src/js/events"), - CLICK = _require2.CLICK; - -var activeElement = require("../../uswds-core/src/js/utils/active-element"); - -var isIosDevice = require("../../uswds-core/src/js/utils/is-ios-device"); - -var Sanitizer = require("../../uswds-core/src/js/utils/sanitizer"); - -var DATE_PICKER_CLASS = "".concat(PREFIX, "-date-picker"); -var DATE_PICKER_WRAPPER_CLASS = "".concat(DATE_PICKER_CLASS, "__wrapper"); -var DATE_PICKER_INITIALIZED_CLASS = "".concat(DATE_PICKER_CLASS, "--initialized"); -var DATE_PICKER_ACTIVE_CLASS = "".concat(DATE_PICKER_CLASS, "--active"); -var DATE_PICKER_INTERNAL_INPUT_CLASS = "".concat(DATE_PICKER_CLASS, "__internal-input"); -var DATE_PICKER_EXTERNAL_INPUT_CLASS = "".concat(DATE_PICKER_CLASS, "__external-input"); -var DATE_PICKER_BUTTON_CLASS = "".concat(DATE_PICKER_CLASS, "__button"); -var DATE_PICKER_CALENDAR_CLASS = "".concat(DATE_PICKER_CLASS, "__calendar"); -var DATE_PICKER_STATUS_CLASS = "".concat(DATE_PICKER_CLASS, "__status"); -var CALENDAR_DATE_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__date"); -var CALENDAR_DATE_FOCUSED_CLASS = "".concat(CALENDAR_DATE_CLASS, "--focused"); -var CALENDAR_DATE_SELECTED_CLASS = "".concat(CALENDAR_DATE_CLASS, "--selected"); -var CALENDAR_DATE_PREVIOUS_MONTH_CLASS = "".concat(CALENDAR_DATE_CLASS, "--previous-month"); -var CALENDAR_DATE_CURRENT_MONTH_CLASS = "".concat(CALENDAR_DATE_CLASS, "--current-month"); -var CALENDAR_DATE_NEXT_MONTH_CLASS = "".concat(CALENDAR_DATE_CLASS, "--next-month"); -var CALENDAR_DATE_RANGE_DATE_CLASS = "".concat(CALENDAR_DATE_CLASS, "--range-date"); -var CALENDAR_DATE_TODAY_CLASS = "".concat(CALENDAR_DATE_CLASS, "--today"); -var CALENDAR_DATE_RANGE_DATE_START_CLASS = "".concat(CALENDAR_DATE_CLASS, "--range-date-start"); -var CALENDAR_DATE_RANGE_DATE_END_CLASS = "".concat(CALENDAR_DATE_CLASS, "--range-date-end"); -var CALENDAR_DATE_WITHIN_RANGE_CLASS = "".concat(CALENDAR_DATE_CLASS, "--within-range"); -var CALENDAR_PREVIOUS_YEAR_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__previous-year"); -var CALENDAR_PREVIOUS_MONTH_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__previous-month"); -var CALENDAR_NEXT_YEAR_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__next-year"); -var CALENDAR_NEXT_MONTH_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__next-month"); -var CALENDAR_MONTH_SELECTION_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__month-selection"); -var CALENDAR_YEAR_SELECTION_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__year-selection"); -var CALENDAR_MONTH_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__month"); -var CALENDAR_MONTH_FOCUSED_CLASS = "".concat(CALENDAR_MONTH_CLASS, "--focused"); -var CALENDAR_MONTH_SELECTED_CLASS = "".concat(CALENDAR_MONTH_CLASS, "--selected"); -var CALENDAR_YEAR_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__year"); -var CALENDAR_YEAR_FOCUSED_CLASS = "".concat(CALENDAR_YEAR_CLASS, "--focused"); -var CALENDAR_YEAR_SELECTED_CLASS = "".concat(CALENDAR_YEAR_CLASS, "--selected"); -var CALENDAR_PREVIOUS_YEAR_CHUNK_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__previous-year-chunk"); -var CALENDAR_NEXT_YEAR_CHUNK_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__next-year-chunk"); -var CALENDAR_DATE_PICKER_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__date-picker"); -var CALENDAR_MONTH_PICKER_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__month-picker"); -var CALENDAR_YEAR_PICKER_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__year-picker"); -var CALENDAR_TABLE_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__table"); -var CALENDAR_ROW_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__row"); -var CALENDAR_CELL_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__cell"); -var CALENDAR_CELL_CENTER_ITEMS_CLASS = "".concat(CALENDAR_CELL_CLASS, "--center-items"); -var CALENDAR_MONTH_LABEL_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__month-label"); -var CALENDAR_DAY_OF_WEEK_CLASS = "".concat(DATE_PICKER_CALENDAR_CLASS, "__day-of-week"); -var DATE_PICKER = ".".concat(DATE_PICKER_CLASS); -var DATE_PICKER_BUTTON = ".".concat(DATE_PICKER_BUTTON_CLASS); -var DATE_PICKER_INTERNAL_INPUT = ".".concat(DATE_PICKER_INTERNAL_INPUT_CLASS); -var DATE_PICKER_EXTERNAL_INPUT = ".".concat(DATE_PICKER_EXTERNAL_INPUT_CLASS); -var DATE_PICKER_CALENDAR = ".".concat(DATE_PICKER_CALENDAR_CLASS); -var DATE_PICKER_STATUS = ".".concat(DATE_PICKER_STATUS_CLASS); -var CALENDAR_DATE = ".".concat(CALENDAR_DATE_CLASS); -var CALENDAR_DATE_FOCUSED = ".".concat(CALENDAR_DATE_FOCUSED_CLASS); -var CALENDAR_DATE_CURRENT_MONTH = ".".concat(CALENDAR_DATE_CURRENT_MONTH_CLASS); -var CALENDAR_PREVIOUS_YEAR = ".".concat(CALENDAR_PREVIOUS_YEAR_CLASS); -var CALENDAR_PREVIOUS_MONTH = ".".concat(CALENDAR_PREVIOUS_MONTH_CLASS); -var CALENDAR_NEXT_YEAR = ".".concat(CALENDAR_NEXT_YEAR_CLASS); -var CALENDAR_NEXT_MONTH = ".".concat(CALENDAR_NEXT_MONTH_CLASS); -var CALENDAR_YEAR_SELECTION = ".".concat(CALENDAR_YEAR_SELECTION_CLASS); -var CALENDAR_MONTH_SELECTION = ".".concat(CALENDAR_MONTH_SELECTION_CLASS); -var CALENDAR_MONTH = ".".concat(CALENDAR_MONTH_CLASS); -var CALENDAR_YEAR = ".".concat(CALENDAR_YEAR_CLASS); -var CALENDAR_PREVIOUS_YEAR_CHUNK = ".".concat(CALENDAR_PREVIOUS_YEAR_CHUNK_CLASS); -var CALENDAR_NEXT_YEAR_CHUNK = ".".concat(CALENDAR_NEXT_YEAR_CHUNK_CLASS); -var CALENDAR_DATE_PICKER = ".".concat(CALENDAR_DATE_PICKER_CLASS); -var CALENDAR_MONTH_PICKER = ".".concat(CALENDAR_MONTH_PICKER_CLASS); -var CALENDAR_YEAR_PICKER = ".".concat(CALENDAR_YEAR_PICKER_CLASS); -var CALENDAR_MONTH_FOCUSED = ".".concat(CALENDAR_MONTH_FOCUSED_CLASS); -var CALENDAR_YEAR_FOCUSED = ".".concat(CALENDAR_YEAR_FOCUSED_CLASS); -var VALIDATION_MESSAGE = "Please enter a valid date"; -var MONTH_LABELS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; -var DAY_OF_WEEK_LABELS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; -var ENTER_KEYCODE = 13; -var YEAR_CHUNK = 12; -var DEFAULT_MIN_DATE = "0000-01-01"; -var DEFAULT_EXTERNAL_DATE_FORMAT = "MM/DD/YYYY"; -var INTERNAL_DATE_FORMAT = "YYYY-MM-DD"; -var NOT_DISABLED_SELECTOR = ":not([disabled])"; - -var processFocusableSelectors = function processFocusableSelectors() { - for (var _len = arguments.length, selectors = new Array(_len), _key = 0; _key < _len; _key++) { - selectors[_key] = arguments[_key]; - } - - return selectors.map(function (query) { - return query + NOT_DISABLED_SELECTOR; - }).join(", "); -}; - -var DATE_PICKER_FOCUSABLE = processFocusableSelectors(CALENDAR_PREVIOUS_YEAR, CALENDAR_PREVIOUS_MONTH, CALENDAR_YEAR_SELECTION, CALENDAR_MONTH_SELECTION, CALENDAR_NEXT_YEAR, CALENDAR_NEXT_MONTH, CALENDAR_DATE_FOCUSED); -var MONTH_PICKER_FOCUSABLE = processFocusableSelectors(CALENDAR_MONTH_FOCUSED); -var YEAR_PICKER_FOCUSABLE = processFocusableSelectors(CALENDAR_PREVIOUS_YEAR_CHUNK, CALENDAR_NEXT_YEAR_CHUNK, CALENDAR_YEAR_FOCUSED); // #region Date Manipulation Functions +const keymap = require("receptor/keymap"); +const behavior = require("../../uswds-core/src/js/utils/behavior"); +const select = require("../../uswds-core/src/js/utils/select"); +const selectOrMatches = require("../../uswds-core/src/js/utils/select-or-matches"); +const { + prefix: PREFIX +} = require("../../uswds-core/src/js/config"); +const { + CLICK +} = require("../../uswds-core/src/js/events"); +const activeElement = require("../../uswds-core/src/js/utils/active-element"); +const isIosDevice = require("../../uswds-core/src/js/utils/is-ios-device"); +const Sanitizer = require("../../uswds-core/src/js/utils/sanitizer"); +const DATE_PICKER_CLASS = `${PREFIX}-date-picker`; +const DATE_PICKER_WRAPPER_CLASS = `${DATE_PICKER_CLASS}__wrapper`; +const DATE_PICKER_INITIALIZED_CLASS = `${DATE_PICKER_CLASS}--initialized`; +const DATE_PICKER_ACTIVE_CLASS = `${DATE_PICKER_CLASS}--active`; +const DATE_PICKER_INTERNAL_INPUT_CLASS = `${DATE_PICKER_CLASS}__internal-input`; +const DATE_PICKER_EXTERNAL_INPUT_CLASS = `${DATE_PICKER_CLASS}__external-input`; +const DATE_PICKER_BUTTON_CLASS = `${DATE_PICKER_CLASS}__button`; +const DATE_PICKER_CALENDAR_CLASS = `${DATE_PICKER_CLASS}__calendar`; +const DATE_PICKER_STATUS_CLASS = `${DATE_PICKER_CLASS}__status`; +const CALENDAR_DATE_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__date`; +const CALENDAR_DATE_FOCUSED_CLASS = `${CALENDAR_DATE_CLASS}--focused`; +const CALENDAR_DATE_SELECTED_CLASS = `${CALENDAR_DATE_CLASS}--selected`; +const CALENDAR_DATE_PREVIOUS_MONTH_CLASS = `${CALENDAR_DATE_CLASS}--previous-month`; +const CALENDAR_DATE_CURRENT_MONTH_CLASS = `${CALENDAR_DATE_CLASS}--current-month`; +const CALENDAR_DATE_NEXT_MONTH_CLASS = `${CALENDAR_DATE_CLASS}--next-month`; +const CALENDAR_DATE_RANGE_DATE_CLASS = `${CALENDAR_DATE_CLASS}--range-date`; +const CALENDAR_DATE_TODAY_CLASS = `${CALENDAR_DATE_CLASS}--today`; +const CALENDAR_DATE_RANGE_DATE_START_CLASS = `${CALENDAR_DATE_CLASS}--range-date-start`; +const CALENDAR_DATE_RANGE_DATE_END_CLASS = `${CALENDAR_DATE_CLASS}--range-date-end`; +const CALENDAR_DATE_WITHIN_RANGE_CLASS = `${CALENDAR_DATE_CLASS}--within-range`; +const CALENDAR_PREVIOUS_YEAR_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__previous-year`; +const CALENDAR_PREVIOUS_MONTH_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__previous-month`; +const CALENDAR_NEXT_YEAR_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__next-year`; +const CALENDAR_NEXT_MONTH_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__next-month`; +const CALENDAR_MONTH_SELECTION_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__month-selection`; +const CALENDAR_YEAR_SELECTION_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__year-selection`; +const CALENDAR_MONTH_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__month`; +const CALENDAR_MONTH_FOCUSED_CLASS = `${CALENDAR_MONTH_CLASS}--focused`; +const CALENDAR_MONTH_SELECTED_CLASS = `${CALENDAR_MONTH_CLASS}--selected`; +const CALENDAR_YEAR_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__year`; +const CALENDAR_YEAR_FOCUSED_CLASS = `${CALENDAR_YEAR_CLASS}--focused`; +const CALENDAR_YEAR_SELECTED_CLASS = `${CALENDAR_YEAR_CLASS}--selected`; +const CALENDAR_PREVIOUS_YEAR_CHUNK_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__previous-year-chunk`; +const CALENDAR_NEXT_YEAR_CHUNK_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__next-year-chunk`; +const CALENDAR_DATE_PICKER_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__date-picker`; +const CALENDAR_MONTH_PICKER_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__month-picker`; +const CALENDAR_YEAR_PICKER_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__year-picker`; +const CALENDAR_TABLE_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__table`; +const CALENDAR_ROW_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__row`; +const CALENDAR_CELL_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__cell`; +const CALENDAR_CELL_CENTER_ITEMS_CLASS = `${CALENDAR_CELL_CLASS}--center-items`; +const CALENDAR_MONTH_LABEL_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__month-label`; +const CALENDAR_DAY_OF_WEEK_CLASS = `${DATE_PICKER_CALENDAR_CLASS}__day-of-week`; +const DATE_PICKER = `.${DATE_PICKER_CLASS}`; +const DATE_PICKER_BUTTON = `.${DATE_PICKER_BUTTON_CLASS}`; +const DATE_PICKER_INTERNAL_INPUT = `.${DATE_PICKER_INTERNAL_INPUT_CLASS}`; +const DATE_PICKER_EXTERNAL_INPUT = `.${DATE_PICKER_EXTERNAL_INPUT_CLASS}`; +const DATE_PICKER_CALENDAR = `.${DATE_PICKER_CALENDAR_CLASS}`; +const DATE_PICKER_STATUS = `.${DATE_PICKER_STATUS_CLASS}`; +const CALENDAR_DATE = `.${CALENDAR_DATE_CLASS}`; +const CALENDAR_DATE_FOCUSED = `.${CALENDAR_DATE_FOCUSED_CLASS}`; +const CALENDAR_DATE_CURRENT_MONTH = `.${CALENDAR_DATE_CURRENT_MONTH_CLASS}`; +const CALENDAR_PREVIOUS_YEAR = `.${CALENDAR_PREVIOUS_YEAR_CLASS}`; +const CALENDAR_PREVIOUS_MONTH = `.${CALENDAR_PREVIOUS_MONTH_CLASS}`; +const CALENDAR_NEXT_YEAR = `.${CALENDAR_NEXT_YEAR_CLASS}`; +const CALENDAR_NEXT_MONTH = `.${CALENDAR_NEXT_MONTH_CLASS}`; +const CALENDAR_YEAR_SELECTION = `.${CALENDAR_YEAR_SELECTION_CLASS}`; +const CALENDAR_MONTH_SELECTION = `.${CALENDAR_MONTH_SELECTION_CLASS}`; +const CALENDAR_MONTH = `.${CALENDAR_MONTH_CLASS}`; +const CALENDAR_YEAR = `.${CALENDAR_YEAR_CLASS}`; +const CALENDAR_PREVIOUS_YEAR_CHUNK = `.${CALENDAR_PREVIOUS_YEAR_CHUNK_CLASS}`; +const CALENDAR_NEXT_YEAR_CHUNK = `.${CALENDAR_NEXT_YEAR_CHUNK_CLASS}`; +const CALENDAR_DATE_PICKER = `.${CALENDAR_DATE_PICKER_CLASS}`; +const CALENDAR_MONTH_PICKER = `.${CALENDAR_MONTH_PICKER_CLASS}`; +const CALENDAR_YEAR_PICKER = `.${CALENDAR_YEAR_PICKER_CLASS}`; +const CALENDAR_MONTH_FOCUSED = `.${CALENDAR_MONTH_FOCUSED_CLASS}`; +const CALENDAR_YEAR_FOCUSED = `.${CALENDAR_YEAR_FOCUSED_CLASS}`; +const VALIDATION_MESSAGE = "Please enter a valid date"; +const MONTH_LABELS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; +const DAY_OF_WEEK_LABELS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; +const ENTER_KEYCODE = 13; +const YEAR_CHUNK = 12; +const DEFAULT_MIN_DATE = "0000-01-01"; +const DEFAULT_EXTERNAL_DATE_FORMAT = "MM/DD/YYYY"; +const INTERNAL_DATE_FORMAT = "YYYY-MM-DD"; +const NOT_DISABLED_SELECTOR = ":not([disabled])"; +const processFocusableSelectors = (...selectors) => selectors.map(query => query + NOT_DISABLED_SELECTOR).join(", "); +const DATE_PICKER_FOCUSABLE = processFocusableSelectors(CALENDAR_PREVIOUS_YEAR, CALENDAR_PREVIOUS_MONTH, CALENDAR_YEAR_SELECTION, CALENDAR_MONTH_SELECTION, CALENDAR_NEXT_YEAR, CALENDAR_NEXT_MONTH, CALENDAR_DATE_FOCUSED); +const MONTH_PICKER_FOCUSABLE = processFocusableSelectors(CALENDAR_MONTH_FOCUSED); +const YEAR_PICKER_FOCUSABLE = processFocusableSelectors(CALENDAR_PREVIOUS_YEAR_CHUNK, CALENDAR_NEXT_YEAR_CHUNK, CALENDAR_YEAR_FOCUSED); + +// #region Date Manipulation Functions /** * Keep date within month. Month would only be over by 1 to 3 days @@ -2019,14 +1916,13 @@ var YEAR_PICKER_FOCUSABLE = processFocusableSelectors(CALENDAR_PREVIOUS_YEAR_CHU * @param {number} month the correct month * @returns {Date} the date, corrected if needed */ - -var keepDateWithinMonth = function keepDateWithinMonth(dateToCheck, month) { +const keepDateWithinMonth = (dateToCheck, month) => { if (month !== dateToCheck.getMonth()) { dateToCheck.setDate(0); } - return dateToCheck; }; + /** * Set date from month day year * @@ -2035,53 +1931,49 @@ var keepDateWithinMonth = function keepDateWithinMonth(dateToCheck, month) { * @param {number} date the date to set * @returns {Date} the set date */ - - -var setDate = function setDate(year, month, date) { - var newDate = new Date(0); +const setDate = (year, month, date) => { + const newDate = new Date(0); newDate.setFullYear(year, month, date); return newDate; }; + /** * todays date * * @returns {Date} todays date */ - - -var today = function today() { - var newDate = new Date(); - var day = newDate.getDate(); - var month = newDate.getMonth(); - var year = newDate.getFullYear(); +const today = () => { + const newDate = new Date(); + const day = newDate.getDate(); + const month = newDate.getMonth(); + const year = newDate.getFullYear(); return setDate(year, month, day); }; + /** * Set date to first day of the month * * @param {number} date the date to adjust * @returns {Date} the adjusted date */ - - -var startOfMonth = function startOfMonth(date) { - var newDate = new Date(0); +const startOfMonth = date => { + const newDate = new Date(0); newDate.setFullYear(date.getFullYear(), date.getMonth(), 1); return newDate; }; + /** * Set date to last day of the month * * @param {number} date the date to adjust * @returns {Date} the adjusted date */ - - -var lastDayOfMonth = function lastDayOfMonth(date) { - var newDate = new Date(0); +const lastDayOfMonth = date => { + const newDate = new Date(0); newDate.setFullYear(date.getFullYear(), date.getMonth() + 1, 0); return newDate; }; + /** * Add days to date * @@ -2089,13 +1981,12 @@ var lastDayOfMonth = function lastDayOfMonth(date) { * @param {number} numDays the difference in days * @returns {Date} the adjusted date */ - - -var addDays = function addDays(_date, numDays) { - var newDate = new Date(_date.getTime()); +const addDays = (_date, numDays) => { + const newDate = new Date(_date.getTime()); newDate.setDate(newDate.getDate() + numDays); return newDate; }; + /** * Subtract days from date * @@ -2103,11 +1994,8 @@ var addDays = function addDays(_date, numDays) { * @param {number} numDays the difference in days * @returns {Date} the adjusted date */ +const subDays = (_date, numDays) => addDays(_date, -numDays); - -var subDays = function subDays(_date, numDays) { - return addDays(_date, -numDays); -}; /** * Add weeks to date * @@ -2115,11 +2003,8 @@ var subDays = function subDays(_date, numDays) { * @param {number} numWeeks the difference in weeks * @returns {Date} the adjusted date */ +const addWeeks = (_date, numWeeks) => addDays(_date, numWeeks * 7); - -var addWeeks = function addWeeks(_date, numWeeks) { - return addDays(_date, numWeeks * 7); -}; /** * Subtract weeks from date * @@ -2127,24 +2012,19 @@ var addWeeks = function addWeeks(_date, numWeeks) { * @param {number} numWeeks the difference in weeks * @returns {Date} the adjusted date */ +const subWeeks = (_date, numWeeks) => addWeeks(_date, -numWeeks); - -var subWeeks = function subWeeks(_date, numWeeks) { - return addWeeks(_date, -numWeeks); -}; /** * Set date to the start of the week (Sunday) * * @param {Date} _date the date to adjust * @returns {Date} the adjusted date */ - - -var startOfWeek = function startOfWeek(_date) { - var dayOfWeek = _date.getDay(); - +const startOfWeek = _date => { + const dayOfWeek = _date.getDay(); return subDays(_date, dayOfWeek); }; + /** * Set date to the end of the week (Saturday) * @@ -2152,13 +2032,11 @@ var startOfWeek = function startOfWeek(_date) { * @param {number} numWeeks the difference in weeks * @returns {Date} the adjusted date */ - - -var endOfWeek = function endOfWeek(_date) { - var dayOfWeek = _date.getDay(); - +const endOfWeek = _date => { + const dayOfWeek = _date.getDay(); return addDays(_date, 6 - dayOfWeek); }; + /** * Add months to date and keep date within month * @@ -2166,15 +2044,14 @@ var endOfWeek = function endOfWeek(_date) { * @param {number} numMonths the difference in months * @returns {Date} the adjusted date */ - - -var addMonths = function addMonths(_date, numMonths) { - var newDate = new Date(_date.getTime()); - var dateMonth = (newDate.getMonth() + 12 + numMonths) % 12; +const addMonths = (_date, numMonths) => { + const newDate = new Date(_date.getTime()); + const dateMonth = (newDate.getMonth() + 12 + numMonths) % 12; newDate.setMonth(newDate.getMonth() + numMonths); keepDateWithinMonth(newDate, dateMonth); return newDate; }; + /** * Subtract months from date * @@ -2182,11 +2059,8 @@ var addMonths = function addMonths(_date, numMonths) { * @param {number} numMonths the difference in months * @returns {Date} the adjusted date */ +const subMonths = (_date, numMonths) => addMonths(_date, -numMonths); - -var subMonths = function subMonths(_date, numMonths) { - return addMonths(_date, -numMonths); -}; /** * Add years to date and keep date within month * @@ -2194,11 +2068,8 @@ var subMonths = function subMonths(_date, numMonths) { * @param {number} numYears the difference in years * @returns {Date} the adjusted date */ +const addYears = (_date, numYears) => addMonths(_date, numYears * 12); - -var addYears = function addYears(_date, numYears) { - return addMonths(_date, numYears * 12); -}; /** * Subtract years from date * @@ -2206,11 +2077,8 @@ var addYears = function addYears(_date, numYears) { * @param {number} numYears the difference in years * @returns {Date} the adjusted date */ +const subYears = (_date, numYears) => addYears(_date, -numYears); - -var subYears = function subYears(_date, numYears) { - return addYears(_date, -numYears); -}; /** * Set months of date * @@ -2218,14 +2086,13 @@ var subYears = function subYears(_date, numYears) { * @param {number} month zero-indexed month to set * @returns {Date} the adjusted date */ - - -var setMonth = function setMonth(_date, month) { - var newDate = new Date(_date.getTime()); +const setMonth = (_date, month) => { + const newDate = new Date(_date.getTime()); newDate.setMonth(month); keepDateWithinMonth(newDate, month); return newDate; }; + /** * Set year of date * @@ -2233,15 +2100,14 @@ var setMonth = function setMonth(_date, month) { * @param {number} year the year to set * @returns {Date} the adjusted date */ - - -var setYear = function setYear(_date, year) { - var newDate = new Date(_date.getTime()); - var month = newDate.getMonth(); +const setYear = (_date, year) => { + const newDate = new Date(_date.getTime()); + const month = newDate.getMonth(); newDate.setFullYear(year); keepDateWithinMonth(newDate, month); return newDate; }; + /** * Return the earliest date * @@ -2249,17 +2115,14 @@ var setYear = function setYear(_date, year) { * @param {Date} dateB date to compare * @returns {Date} the earliest date */ - - -var min = function min(dateA, dateB) { - var newDate = dateA; - +const min = (dateA, dateB) => { + let newDate = dateA; if (dateB < dateA) { newDate = dateB; } - return new Date(newDate.getTime()); }; + /** * Return the latest date * @@ -2267,17 +2130,14 @@ var min = function min(dateA, dateB) { * @param {Date} dateB date to compare * @returns {Date} the latest date */ - - -var max = function max(dateA, dateB) { - var newDate = dateA; - +const max = (dateA, dateB) => { + let newDate = dateA; if (dateB > dateA) { newDate = dateB; } - return new Date(newDate.getTime()); }; + /** * Check if dates are the in the same year * @@ -2285,11 +2145,8 @@ var max = function max(dateA, dateB) { * @param {Date} dateB date to compare * @returns {boolean} are dates in the same year */ +const isSameYear = (dateA, dateB) => dateA && dateB && dateA.getFullYear() === dateB.getFullYear(); - -var isSameYear = function isSameYear(dateA, dateB) { - return dateA && dateB && dateA.getFullYear() === dateB.getFullYear(); -}; /** * Check if dates are the in the same month * @@ -2297,11 +2154,8 @@ var isSameYear = function isSameYear(dateA, dateB) { * @param {Date} dateB date to compare * @returns {boolean} are dates in the same month */ +const isSameMonth = (dateA, dateB) => isSameYear(dateA, dateB) && dateA.getMonth() === dateB.getMonth(); - -var isSameMonth = function isSameMonth(dateA, dateB) { - return isSameYear(dateA, dateB) && dateA.getMonth() === dateB.getMonth(); -}; /** * Check if dates are the same date * @@ -2309,11 +2163,8 @@ var isSameMonth = function isSameMonth(dateA, dateB) { * @param {Date} dateA the date to compare * @returns {boolean} are dates the same date */ +const isSameDay = (dateA, dateB) => isSameMonth(dateA, dateB) && dateA.getDate() === dateB.getDate(); - -var isSameDay = function isSameDay(dateA, dateB) { - return isSameMonth(dateA, dateB) && dateA.getDate() === dateB.getDate(); -}; /** * return a new date within minimum and maximum date * @@ -2322,19 +2173,16 @@ var isSameDay = function isSameDay(dateA, dateB) { * @param {Date} maxDate maximum date to allow * @returns {Date} the date between min and max */ - - -var keepDateBetweenMinAndMax = function keepDateBetweenMinAndMax(date, minDate, maxDate) { - var newDate = date; - +const keepDateBetweenMinAndMax = (date, minDate, maxDate) => { + let newDate = date; if (date < minDate) { newDate = minDate; } else if (maxDate && date > maxDate) { newDate = maxDate; } - return new Date(newDate.getTime()); }; + /** * Check if dates is valid. * @@ -2343,11 +2191,8 @@ var keepDateBetweenMinAndMax = function keepDateBetweenMinAndMax(date, minDate, * @param {Date} maxDate maximum date to allow * @return {boolean} is there a day within the month within min and max dates */ +const isDateWithinMinAndMax = (date, minDate, maxDate) => date >= minDate && (!maxDate || date <= maxDate); - -var isDateWithinMinAndMax = function isDateWithinMinAndMax(date, minDate, maxDate) { - return date >= minDate && (!maxDate || date <= maxDate); -}; /** * Check if dates month is invalid. * @@ -2356,11 +2201,8 @@ var isDateWithinMinAndMax = function isDateWithinMinAndMax(date, minDate, maxDat * @param {Date} maxDate maximum date to allow * @return {boolean} is the month outside min or max dates */ +const isDatesMonthOutsideMinOrMax = (date, minDate, maxDate) => lastDayOfMonth(date) < minDate || maxDate && startOfMonth(date) > maxDate; - -var isDatesMonthOutsideMinOrMax = function isDatesMonthOutsideMinOrMax(date, minDate, maxDate) { - return lastDayOfMonth(date) < minDate || maxDate && startOfMonth(date) > maxDate; -}; /** * Check if dates year is invalid. * @@ -2369,11 +2211,8 @@ var isDatesMonthOutsideMinOrMax = function isDatesMonthOutsideMinOrMax(date, min * @param {Date} maxDate maximum date to allow * @return {boolean} is the month outside min or max dates */ +const isDatesYearOutsideMinOrMax = (date, minDate, maxDate) => lastDayOfMonth(setMonth(date, 11)) < minDate || maxDate && startOfMonth(setMonth(date, 0)) > maxDate; - -var isDatesYearOutsideMinOrMax = function isDatesYearOutsideMinOrMax(date, minDate, maxDate) { - return lastDayOfMonth(setMonth(date, 11)) < minDate || maxDate && startOfMonth(setMonth(date, 0)) > maxDate; -}; /** * Parse a date with format M-D-YY * @@ -2382,92 +2221,63 @@ var isDatesYearOutsideMinOrMax = function isDatesYearOutsideMinOrMax(date, minDa * @param {boolean} adjustDate should the date be adjusted * @returns {Date} the parsed date */ - - -var parseDateString = function parseDateString(dateString) { - var dateFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : INTERNAL_DATE_FORMAT; - var adjustDate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var date; - var month; - var day; - var year; - var parsed; - +const parseDateString = (dateString, dateFormat = INTERNAL_DATE_FORMAT, adjustDate = false) => { + let date; + let month; + let day; + let year; + let parsed; if (dateString) { - var monthStr; - var dayStr; - var yearStr; - + let monthStr; + let dayStr; + let yearStr; if (dateFormat === DEFAULT_EXTERNAL_DATE_FORMAT) { - var _dateString$split = dateString.split("/"); - - var _dateString$split2 = _slicedToArray(_dateString$split, 3); - - monthStr = _dateString$split2[0]; - dayStr = _dateString$split2[1]; - yearStr = _dateString$split2[2]; + [monthStr, dayStr, yearStr] = dateString.split("/"); } else { - var _dateString$split3 = dateString.split("-"); - - var _dateString$split4 = _slicedToArray(_dateString$split3, 3); - - yearStr = _dateString$split4[0]; - monthStr = _dateString$split4[1]; - dayStr = _dateString$split4[2]; + [yearStr, monthStr, dayStr] = dateString.split("-"); } - if (yearStr) { parsed = parseInt(yearStr, 10); - if (!Number.isNaN(parsed)) { year = parsed; - if (adjustDate) { year = Math.max(0, year); - if (yearStr.length < 3) { - var currentYear = today().getFullYear(); - var currentYearStub = currentYear - currentYear % Math.pow(10, yearStr.length); + const currentYear = today().getFullYear(); + const currentYearStub = currentYear - currentYear % 10 ** yearStr.length; year = currentYearStub + parsed; } } } } - if (monthStr) { parsed = parseInt(monthStr, 10); - if (!Number.isNaN(parsed)) { month = parsed; - if (adjustDate) { month = Math.max(1, month); month = Math.min(12, month); } } } - if (month && dayStr && year != null) { parsed = parseInt(dayStr, 10); - if (!Number.isNaN(parsed)) { day = parsed; - if (adjustDate) { - var lastDayOfTheMonth = setDate(year, month, 0).getDate(); + const lastDayOfTheMonth = setDate(year, month, 0).getDate(); day = Math.max(1, day); day = Math.min(lastDayOfTheMonth, day); } } } - if (month && day && year != null) { date = setDate(year, month - 1, day); } } - return date; }; + /** * Format a date to format MM-DD-YYYY * @@ -2475,25 +2285,18 @@ var parseDateString = function parseDateString(dateString) { * @param {string} dateFormat the format of the date string * @returns {string} the formatted date string */ - - -var formatDate = function formatDate(date) { - var dateFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : INTERNAL_DATE_FORMAT; - - var padZeros = function padZeros(value, length) { - return "0000".concat(value).slice(-length); - }; - - var month = date.getMonth() + 1; - var day = date.getDate(); - var year = date.getFullYear(); - +const formatDate = (date, dateFormat = INTERNAL_DATE_FORMAT) => { + const padZeros = (value, length) => `0000${value}`.slice(-length); + const month = date.getMonth() + 1; + const day = date.getDate(); + const year = date.getFullYear(); if (dateFormat === DEFAULT_EXTERNAL_DATE_FORMAT) { return [padZeros(month, 2), padZeros(day, 2), padZeros(year, 4)].join("/"); } - return [padZeros(year, 4), padZeros(month, 2), padZeros(day, 2)].join("-"); -}; // #endregion Date Manipulation Functions +}; + +// #endregion Date Manipulation Functions /** * Create a grid string from an array of html strings @@ -2502,65 +2305,53 @@ var formatDate = function formatDate(date) { * @param {number} rowSize the length of a row * @returns {string} the grid string */ - - -var listToGridHtml = function listToGridHtml(htmlArray, rowSize) { - var grid = []; - var row = []; - var i = 0; - - var _loop = function _loop() { +const listToGridHtml = (htmlArray, rowSize) => { + const grid = []; + let row = []; + let i = 0; + while (i < htmlArray.length) { row = []; - var tr = document.createElement("tr"); - + const tr = document.createElement("tr"); while (i < htmlArray.length && row.length < rowSize) { - var td = document.createElement("td"); + const td = document.createElement("td"); td.insertAdjacentElement("beforeend", htmlArray[i]); row.push(td); i += 1; } - - row.forEach(function (element) { + row.forEach(element => { tr.insertAdjacentElement("beforeend", element); }); grid.push(tr); - }; - - while (i < htmlArray.length) { - _loop(); } - return grid; }; - -var createTableBody = function createTableBody(grid) { - var tableBody = document.createElement("tbody"); - grid.forEach(function (element) { +const createTableBody = grid => { + const tableBody = document.createElement("tbody"); + grid.forEach(element => { tableBody.insertAdjacentElement("beforeend", element); }); return tableBody; }; + /** * set the value of the element and dispatch a change event * * @param {HTMLInputElement} el The element to update * @param {string} value The new value of the element */ - - -var changeElementValue = function changeElementValue(el) { - var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; - var elementToChange = el; +const changeElementValue = (el, value = "") => { + const elementToChange = el; elementToChange.value = value; - var event = new CustomEvent("change", { + const event = new CustomEvent("change", { bubbles: true, cancelable: true, detail: { - value: value + value } }); elementToChange.dispatchEvent(event); }; + /** * The properties and elements within the date picker. * @typedef {Object} DatePickerContext @@ -2585,226 +2376,214 @@ var changeElementValue = function changeElementValue(el) { * @param {HTMLElement} el the element within the date picker * @returns {DatePickerContext} elements */ - - -var getDatePickerContext = function getDatePickerContext(el) { - var datePickerEl = el.closest(DATE_PICKER); - +const getDatePickerContext = el => { + const datePickerEl = el.closest(DATE_PICKER); if (!datePickerEl) { - throw new Error("Element is missing outer ".concat(DATE_PICKER)); - } - - var internalInputEl = datePickerEl.querySelector(DATE_PICKER_INTERNAL_INPUT); - var externalInputEl = datePickerEl.querySelector(DATE_PICKER_EXTERNAL_INPUT); - var calendarEl = datePickerEl.querySelector(DATE_PICKER_CALENDAR); - var toggleBtnEl = datePickerEl.querySelector(DATE_PICKER_BUTTON); - var statusEl = datePickerEl.querySelector(DATE_PICKER_STATUS); - var firstYearChunkEl = datePickerEl.querySelector(CALENDAR_YEAR); - var inputDate = parseDateString(externalInputEl.value, DEFAULT_EXTERNAL_DATE_FORMAT, true); - var selectedDate = parseDateString(internalInputEl.value); - var calendarDate = parseDateString(calendarEl.dataset.value); - var minDate = parseDateString(datePickerEl.dataset.minDate); - var maxDate = parseDateString(datePickerEl.dataset.maxDate); - var rangeDate = parseDateString(datePickerEl.dataset.rangeDate); - var defaultDate = parseDateString(datePickerEl.dataset.defaultDate); - + throw new Error(`Element is missing outer ${DATE_PICKER}`); + } + const internalInputEl = datePickerEl.querySelector(DATE_PICKER_INTERNAL_INPUT); + const externalInputEl = datePickerEl.querySelector(DATE_PICKER_EXTERNAL_INPUT); + const calendarEl = datePickerEl.querySelector(DATE_PICKER_CALENDAR); + const toggleBtnEl = datePickerEl.querySelector(DATE_PICKER_BUTTON); + const statusEl = datePickerEl.querySelector(DATE_PICKER_STATUS); + const firstYearChunkEl = datePickerEl.querySelector(CALENDAR_YEAR); + const inputDate = parseDateString(externalInputEl.value, DEFAULT_EXTERNAL_DATE_FORMAT, true); + const selectedDate = parseDateString(internalInputEl.value); + const calendarDate = parseDateString(calendarEl.dataset.value); + const minDate = parseDateString(datePickerEl.dataset.minDate); + const maxDate = parseDateString(datePickerEl.dataset.maxDate); + const rangeDate = parseDateString(datePickerEl.dataset.rangeDate); + const defaultDate = parseDateString(datePickerEl.dataset.defaultDate); if (minDate && maxDate && minDate > maxDate) { throw new Error("Minimum date cannot be after maximum date"); } - return { - calendarDate: calendarDate, - minDate: minDate, - toggleBtnEl: toggleBtnEl, - selectedDate: selectedDate, - maxDate: maxDate, - firstYearChunkEl: firstYearChunkEl, - datePickerEl: datePickerEl, - inputDate: inputDate, - internalInputEl: internalInputEl, - externalInputEl: externalInputEl, - calendarEl: calendarEl, - rangeDate: rangeDate, - defaultDate: defaultDate, - statusEl: statusEl + calendarDate, + minDate, + toggleBtnEl, + selectedDate, + maxDate, + firstYearChunkEl, + datePickerEl, + inputDate, + internalInputEl, + externalInputEl, + calendarEl, + rangeDate, + defaultDate, + statusEl }; }; + /** * Disable the date picker component * * @param {HTMLElement} el An element within the date picker component */ - - -var disable = function disable(el) { - var _getDatePickerContext = getDatePickerContext(el), - externalInputEl = _getDatePickerContext.externalInputEl, - toggleBtnEl = _getDatePickerContext.toggleBtnEl; - +const disable = el => { + const { + externalInputEl, + toggleBtnEl + } = getDatePickerContext(el); toggleBtnEl.disabled = true; externalInputEl.disabled = true; }; + /** - * Enable the date picker component + * Check for aria-disabled on initialization * * @param {HTMLElement} el An element within the date picker component */ +const ariaDisable = el => { + const { + externalInputEl, + toggleBtnEl + } = getDatePickerContext(el); + toggleBtnEl.setAttribute("aria-disabled", true); + externalInputEl.setAttribute("aria-disabled", true); +}; - -var enable = function enable(el) { - var _getDatePickerContext2 = getDatePickerContext(el), - externalInputEl = _getDatePickerContext2.externalInputEl, - toggleBtnEl = _getDatePickerContext2.toggleBtnEl; - +/** + * Enable the date picker component + * + * @param {HTMLElement} el An element within the date picker component + */ +const enable = el => { + const { + externalInputEl, + toggleBtnEl + } = getDatePickerContext(el); toggleBtnEl.disabled = false; externalInputEl.disabled = false; -}; // #region Validation +}; + +// #region Validation /** * Validate the value in the input as a valid date of format M/D/YYYY * * @param {HTMLElement} el An element within the date picker component */ - - -var isDateInputInvalid = function isDateInputInvalid(el) { - var _getDatePickerContext3 = getDatePickerContext(el), - externalInputEl = _getDatePickerContext3.externalInputEl, - minDate = _getDatePickerContext3.minDate, - maxDate = _getDatePickerContext3.maxDate; - - var dateString = externalInputEl.value; - var isInvalid = false; - +const isDateInputInvalid = el => { + const { + externalInputEl, + minDate, + maxDate + } = getDatePickerContext(el); + const dateString = externalInputEl.value; + let isInvalid = false; if (dateString) { isInvalid = true; - var dateStringParts = dateString.split("/"); - - var _dateStringParts$map = dateStringParts.map(function (str) { - var value; - var parsed = parseInt(str, 10); + const dateStringParts = dateString.split("/"); + const [month, day, year] = dateStringParts.map(str => { + let value; + const parsed = parseInt(str, 10); if (!Number.isNaN(parsed)) value = parsed; return value; - }), - _dateStringParts$map2 = _slicedToArray(_dateStringParts$map, 3), - month = _dateStringParts$map2[0], - day = _dateStringParts$map2[1], - year = _dateStringParts$map2[2]; - + }); if (month && day && year != null) { - var checkDate = setDate(year, month - 1, day); - + const checkDate = setDate(year, month - 1, day); if (checkDate.getMonth() === month - 1 && checkDate.getDate() === day && checkDate.getFullYear() === year && dateStringParts[2].length === 4 && isDateWithinMinAndMax(checkDate, minDate, maxDate)) { isInvalid = false; } } } - return isInvalid; }; + /** * Validate the value in the input as a valid date of format M/D/YYYY * * @param {HTMLElement} el An element within the date picker component */ - - -var validateDateInput = function validateDateInput(el) { - var _getDatePickerContext4 = getDatePickerContext(el), - externalInputEl = _getDatePickerContext4.externalInputEl; - - var isInvalid = isDateInputInvalid(externalInputEl); - +const validateDateInput = el => { + const { + externalInputEl + } = getDatePickerContext(el); + const isInvalid = isDateInputInvalid(externalInputEl); if (isInvalid && !externalInputEl.validationMessage) { externalInputEl.setCustomValidity(VALIDATION_MESSAGE); } - if (!isInvalid && externalInputEl.validationMessage === VALIDATION_MESSAGE) { externalInputEl.setCustomValidity(""); } -}; // #endregion Validation +}; + +// #endregion Validation /** * Enable the date picker component * * @param {HTMLElement} el An element within the date picker component */ - - -var reconcileInputValues = function reconcileInputValues(el) { - var _getDatePickerContext5 = getDatePickerContext(el), - internalInputEl = _getDatePickerContext5.internalInputEl, - inputDate = _getDatePickerContext5.inputDate; - - var newValue = ""; - +const reconcileInputValues = el => { + const { + internalInputEl, + inputDate + } = getDatePickerContext(el); + let newValue = ""; if (inputDate && !isDateInputInvalid(el)) { newValue = formatDate(inputDate); } - if (internalInputEl.value !== newValue) { changeElementValue(internalInputEl, newValue); } }; + /** * Select the value of the date picker inputs. * * @param {HTMLButtonElement} el An element within the date picker component * @param {string} dateString The date string to update in YYYY-MM-DD format */ - - -var setCalendarValue = function setCalendarValue(el, dateString) { - var parsedDate = parseDateString(dateString); - +const setCalendarValue = (el, dateString) => { + const parsedDate = parseDateString(dateString); if (parsedDate) { - var formattedDate = formatDate(parsedDate, DEFAULT_EXTERNAL_DATE_FORMAT); - - var _getDatePickerContext6 = getDatePickerContext(el), - datePickerEl = _getDatePickerContext6.datePickerEl, - internalInputEl = _getDatePickerContext6.internalInputEl, - externalInputEl = _getDatePickerContext6.externalInputEl; - + const formattedDate = formatDate(parsedDate, DEFAULT_EXTERNAL_DATE_FORMAT); + const { + datePickerEl, + internalInputEl, + externalInputEl + } = getDatePickerContext(el); changeElementValue(internalInputEl, dateString); changeElementValue(externalInputEl, formattedDate); validateDateInput(datePickerEl); } }; + /** * Enhance an input with the date picker elements * * @param {HTMLElement} el The initial wrapping element of the date picker component */ - - -var enhanceDatePicker = function enhanceDatePicker(el) { - var datePickerEl = el.closest(DATE_PICKER); - var defaultValue = datePickerEl.dataset.defaultValue; - var internalInputEl = datePickerEl.querySelector("input"); - +const enhanceDatePicker = el => { + const datePickerEl = el.closest(DATE_PICKER); + const { + defaultValue + } = datePickerEl.dataset; + const internalInputEl = datePickerEl.querySelector(`input`); if (!internalInputEl) { - throw new Error("".concat(DATE_PICKER, " is missing inner input")); + throw new Error(`${DATE_PICKER} is missing inner input`); } - if (internalInputEl.value) { internalInputEl.value = ""; } - - var minDate = parseDateString(datePickerEl.dataset.minDate || internalInputEl.getAttribute("min")); + const minDate = parseDateString(datePickerEl.dataset.minDate || internalInputEl.getAttribute("min")); datePickerEl.dataset.minDate = minDate ? formatDate(minDate) : DEFAULT_MIN_DATE; - var maxDate = parseDateString(datePickerEl.dataset.maxDate || internalInputEl.getAttribute("max")); - + const maxDate = parseDateString(datePickerEl.dataset.maxDate || internalInputEl.getAttribute("max")); if (maxDate) { datePickerEl.dataset.maxDate = formatDate(maxDate); } - - var calendarWrapper = document.createElement("div"); + const calendarWrapper = document.createElement("div"); calendarWrapper.classList.add(DATE_PICKER_WRAPPER_CLASS); - var externalInputEl = internalInputEl.cloneNode(); + const externalInputEl = internalInputEl.cloneNode(); externalInputEl.classList.add(DATE_PICKER_EXTERNAL_INPUT_CLASS); externalInputEl.type = "text"; calendarWrapper.appendChild(externalInputEl); - calendarWrapper.insertAdjacentHTML("beforeend", Sanitizer.escapeHTML(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n \n \n
"])), DATE_PICKER_BUTTON_CLASS, DATE_PICKER_CALENDAR_CLASS, DATE_PICKER_STATUS_CLASS)); + calendarWrapper.insertAdjacentHTML("beforeend", Sanitizer.escapeHTML` + + +
`); internalInputEl.setAttribute("aria-hidden", "true"); internalInputEl.setAttribute("tabindex", "-1"); internalInputEl.style.display = "none"; @@ -2814,16 +2593,20 @@ var enhanceDatePicker = function enhanceDatePicker(el) { internalInputEl.required = false; datePickerEl.appendChild(calendarWrapper); datePickerEl.classList.add(DATE_PICKER_INITIALIZED_CLASS); - if (defaultValue) { setCalendarValue(datePickerEl, defaultValue); } - if (internalInputEl.disabled) { disable(datePickerEl); internalInputEl.disabled = false; } -}; // #region Calendar - Date Selection View + if (internalInputEl.hasAttribute("aria-disabled")) { + ariaDisable(datePickerEl); + internalInputEl.removeAttribute("aria-disabled"); + } +}; + +// #region Calendar - Date Selection View /** * render the calendar. @@ -2832,94 +2615,80 @@ var enhanceDatePicker = function enhanceDatePicker(el) { * @param {Date} _dateToDisplay a date to render on the calendar * @returns {HTMLElement} a reference to the new calendar element */ - - -var renderCalendar = function renderCalendar(el, _dateToDisplay) { - var _getDatePickerContext7 = getDatePickerContext(el), - datePickerEl = _getDatePickerContext7.datePickerEl, - calendarEl = _getDatePickerContext7.calendarEl, - statusEl = _getDatePickerContext7.statusEl, - selectedDate = _getDatePickerContext7.selectedDate, - maxDate = _getDatePickerContext7.maxDate, - minDate = _getDatePickerContext7.minDate, - rangeDate = _getDatePickerContext7.rangeDate; - - var todaysDate = today(); - var dateToDisplay = _dateToDisplay || todaysDate; - var calendarWasHidden = calendarEl.hidden; - var focusedDate = addDays(dateToDisplay, 0); - var focusedMonth = dateToDisplay.getMonth(); - var focusedYear = dateToDisplay.getFullYear(); - var prevMonth = subMonths(dateToDisplay, 1); - var nextMonth = addMonths(dateToDisplay, 1); - var currentFormattedDate = formatDate(dateToDisplay); - var firstOfMonth = startOfMonth(dateToDisplay); - var prevButtonsDisabled = isSameMonth(dateToDisplay, minDate); - var nextButtonsDisabled = isSameMonth(dateToDisplay, maxDate); - var rangeConclusionDate = selectedDate || dateToDisplay; - var rangeStartDate = rangeDate && min(rangeConclusionDate, rangeDate); - var rangeEndDate = rangeDate && max(rangeConclusionDate, rangeDate); - var withinRangeStartDate = rangeDate && addDays(rangeStartDate, 1); - var withinRangeEndDate = rangeDate && subDays(rangeEndDate, 1); - var monthLabel = MONTH_LABELS[focusedMonth]; - - var generateDateHtml = function generateDateHtml(dateToRender) { - var classes = [CALENDAR_DATE_CLASS]; - var day = dateToRender.getDate(); - var month = dateToRender.getMonth(); - var year = dateToRender.getFullYear(); - var dayOfWeek = dateToRender.getDay(); - var formattedDate = formatDate(dateToRender); - var tabindex = "-1"; - var isDisabled = !isDateWithinMinAndMax(dateToRender, minDate, maxDate); - var isSelected = isSameDay(dateToRender, selectedDate); - +const renderCalendar = (el, _dateToDisplay) => { + const { + datePickerEl, + calendarEl, + statusEl, + selectedDate, + maxDate, + minDate, + rangeDate + } = getDatePickerContext(el); + const todaysDate = today(); + let dateToDisplay = _dateToDisplay || todaysDate; + const calendarWasHidden = calendarEl.hidden; + const focusedDate = addDays(dateToDisplay, 0); + const focusedMonth = dateToDisplay.getMonth(); + const focusedYear = dateToDisplay.getFullYear(); + const prevMonth = subMonths(dateToDisplay, 1); + const nextMonth = addMonths(dateToDisplay, 1); + const currentFormattedDate = formatDate(dateToDisplay); + const firstOfMonth = startOfMonth(dateToDisplay); + const prevButtonsDisabled = isSameMonth(dateToDisplay, minDate); + const nextButtonsDisabled = isSameMonth(dateToDisplay, maxDate); + const rangeConclusionDate = selectedDate || dateToDisplay; + const rangeStartDate = rangeDate && min(rangeConclusionDate, rangeDate); + const rangeEndDate = rangeDate && max(rangeConclusionDate, rangeDate); + const withinRangeStartDate = rangeDate && addDays(rangeStartDate, 1); + const withinRangeEndDate = rangeDate && subDays(rangeEndDate, 1); + const monthLabel = MONTH_LABELS[focusedMonth]; + const generateDateHtml = dateToRender => { + const classes = [CALENDAR_DATE_CLASS]; + const day = dateToRender.getDate(); + const month = dateToRender.getMonth(); + const year = dateToRender.getFullYear(); + const dayOfWeek = dateToRender.getDay(); + const formattedDate = formatDate(dateToRender); + let tabindex = "-1"; + const isDisabled = !isDateWithinMinAndMax(dateToRender, minDate, maxDate); + const isSelected = isSameDay(dateToRender, selectedDate); if (isSameMonth(dateToRender, prevMonth)) { classes.push(CALENDAR_DATE_PREVIOUS_MONTH_CLASS); } - if (isSameMonth(dateToRender, focusedDate)) { classes.push(CALENDAR_DATE_CURRENT_MONTH_CLASS); } - if (isSameMonth(dateToRender, nextMonth)) { classes.push(CALENDAR_DATE_NEXT_MONTH_CLASS); } - if (isSelected) { classes.push(CALENDAR_DATE_SELECTED_CLASS); } - if (isSameDay(dateToRender, todaysDate)) { classes.push(CALENDAR_DATE_TODAY_CLASS); } - if (rangeDate) { if (isSameDay(dateToRender, rangeDate)) { classes.push(CALENDAR_DATE_RANGE_DATE_CLASS); } - if (isSameDay(dateToRender, rangeStartDate)) { classes.push(CALENDAR_DATE_RANGE_DATE_START_CLASS); } - if (isSameDay(dateToRender, rangeEndDate)) { classes.push(CALENDAR_DATE_RANGE_DATE_END_CLASS); } - if (isDateWithinMinAndMax(dateToRender, withinRangeStartDate, withinRangeEndDate)) { classes.push(CALENDAR_DATE_WITHIN_RANGE_CLASS); } } - if (isSameDay(dateToRender, focusedDate)) { tabindex = "0"; classes.push(CALENDAR_DATE_FOCUSED_CLASS); } - - var monthStr = MONTH_LABELS[month]; - var dayStr = DAY_OF_WEEK_LABELS[dayOfWeek]; - var btn = document.createElement("button"); + const monthStr = MONTH_LABELS[month]; + const dayStr = DAY_OF_WEEK_LABELS[dayOfWeek]; + const btn = document.createElement("button"); btn.setAttribute("type", "button"); btn.setAttribute("tabindex", tabindex); btn.setAttribute("class", classes.join(" ")); @@ -2927,40 +2696,82 @@ var renderCalendar = function renderCalendar(el, _dateToDisplay) { btn.setAttribute("data-month", month + 1); btn.setAttribute("data-year", year); btn.setAttribute("data-value", formattedDate); - btn.setAttribute("aria-label", Sanitizer.escapeHTML(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["", " ", " ", " ", ""])), day, monthStr, year, dayStr)); + btn.setAttribute("aria-label", Sanitizer.escapeHTML`${day} ${monthStr} ${year} ${dayStr}`); btn.setAttribute("aria-selected", isSelected ? "true" : "false"); - if (isDisabled === true) { btn.disabled = true; } - btn.textContent = day; return btn; - }; // set date to first rendered day - + }; + // set date to first rendered day dateToDisplay = startOfWeek(firstOfMonth); - var days = []; - + const days = []; while (days.length < 28 || dateToDisplay.getMonth() === focusedMonth || days.length % 7 !== 0) { days.push(generateDateHtml(dateToDisplay)); dateToDisplay = addDays(dateToDisplay, 1); } - - var datesGrid = listToGridHtml(days, 7); - var newCalendar = calendarEl.cloneNode(); + const datesGrid = listToGridHtml(days, 7); + const newCalendar = calendarEl.cloneNode(); newCalendar.dataset.value = currentFormattedDate; - newCalendar.style.top = "".concat(datePickerEl.offsetHeight, "px"); + newCalendar.style.top = `${datePickerEl.offsetHeight}px`; newCalendar.hidden = false; - newCalendar.innerHTML = Sanitizer.escapeHTML(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n
\n
\n
\n \n
\n
\n \n
\n
\n ", "\n ", "\n
\n
\n \n
\n
\n \n
\n
\n
\n "])), CALENDAR_DATE_PICKER_CLASS, CALENDAR_ROW_CLASS, CALENDAR_CELL_CLASS, CALENDAR_CELL_CENTER_ITEMS_CLASS, CALENDAR_PREVIOUS_YEAR_CLASS, prevButtonsDisabled ? "disabled=\"disabled\"" : "", CALENDAR_CELL_CLASS, CALENDAR_CELL_CENTER_ITEMS_CLASS, CALENDAR_PREVIOUS_MONTH_CLASS, prevButtonsDisabled ? "disabled=\"disabled\"" : "", CALENDAR_CELL_CLASS, CALENDAR_MONTH_LABEL_CLASS, CALENDAR_MONTH_SELECTION_CLASS, monthLabel, monthLabel, CALENDAR_YEAR_SELECTION_CLASS, focusedYear, focusedYear, CALENDAR_CELL_CLASS, CALENDAR_CELL_CENTER_ITEMS_CLASS, CALENDAR_NEXT_MONTH_CLASS, nextButtonsDisabled ? "disabled=\"disabled\"" : "", CALENDAR_CELL_CLASS, CALENDAR_CELL_CENTER_ITEMS_CLASS, CALENDAR_NEXT_YEAR_CLASS, nextButtonsDisabled ? "disabled=\"disabled\"" : ""); - var table = document.createElement("table"); + newCalendar.innerHTML = Sanitizer.escapeHTML` +
+
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+
+ `; + const table = document.createElement("table"); table.setAttribute("class", CALENDAR_TABLE_CLASS); - table.setAttribute("role", "presentation"); - var tableHead = document.createElement("thead"); + const tableHead = document.createElement("thead"); table.insertAdjacentElement("beforeend", tableHead); - var tableHeadRow = document.createElement("tr"); + const tableHeadRow = document.createElement("tr"); tableHead.insertAdjacentElement("beforeend", tableHeadRow); - var daysOfWeek = { + const daysOfWeek = { Sunday: "S", Monday: "M", Tuesday: "T", @@ -2969,315 +2780,286 @@ var renderCalendar = function renderCalendar(el, _dateToDisplay) { Friday: "Fr", Saturday: "S" }; - Object.keys(daysOfWeek).forEach(function (key) { - var th = document.createElement("th"); + Object.keys(daysOfWeek).forEach(key => { + const th = document.createElement("th"); th.setAttribute("class", CALENDAR_DAY_OF_WEEK_CLASS); - th.setAttribute("scope", "presentation"); + th.setAttribute("scope", "col"); th.setAttribute("aria-label", key); th.textContent = daysOfWeek[key]; tableHeadRow.insertAdjacentElement("beforeend", th); }); - var tableBody = createTableBody(datesGrid); - table.insertAdjacentElement("beforeend", tableBody); // Container for Years, Months, and Days + const tableBody = createTableBody(datesGrid); + table.insertAdjacentElement("beforeend", tableBody); - var datePickerCalendarContainer = newCalendar.querySelector(CALENDAR_DATE_PICKER); + // Container for Years, Months, and Days + const datePickerCalendarContainer = newCalendar.querySelector(CALENDAR_DATE_PICKER); datePickerCalendarContainer.insertAdjacentElement("beforeend", table); calendarEl.parentNode.replaceChild(newCalendar, calendarEl); datePickerEl.classList.add(DATE_PICKER_ACTIVE_CLASS); - var statuses = []; - + const statuses = []; if (isSameDay(selectedDate, focusedDate)) { statuses.push("Selected date"); } - if (calendarWasHidden) { statuses.push("You can navigate by day using left and right arrows", "Weeks by using up and down arrows", "Months by using page up and page down keys", "Years by using shift plus page up and shift plus page down", "Home and end keys navigate to the beginning and end of a week"); statusEl.textContent = ""; } else { - statuses.push("".concat(monthLabel, " ").concat(focusedYear)); + statuses.push(`${monthLabel} ${focusedYear}`); } - statusEl.textContent = statuses.join(". "); return newCalendar; }; + /** * Navigate back one year and display the calendar. * * @param {HTMLButtonElement} _buttonEl An element within the date picker component */ - - -var displayPreviousYear = function displayPreviousYear(_buttonEl) { +const displayPreviousYear = _buttonEl => { if (_buttonEl.disabled) return; - - var _getDatePickerContext8 = getDatePickerContext(_buttonEl), - calendarEl = _getDatePickerContext8.calendarEl, - calendarDate = _getDatePickerContext8.calendarDate, - minDate = _getDatePickerContext8.minDate, - maxDate = _getDatePickerContext8.maxDate; - - var date = subYears(calendarDate, 1); + const { + calendarEl, + calendarDate, + minDate, + maxDate + } = getDatePickerContext(_buttonEl); + let date = subYears(calendarDate, 1); date = keepDateBetweenMinAndMax(date, minDate, maxDate); - var newCalendar = renderCalendar(calendarEl, date); - var nextToFocus = newCalendar.querySelector(CALENDAR_PREVIOUS_YEAR); - + const newCalendar = renderCalendar(calendarEl, date); + let nextToFocus = newCalendar.querySelector(CALENDAR_PREVIOUS_YEAR); if (nextToFocus.disabled) { nextToFocus = newCalendar.querySelector(CALENDAR_DATE_PICKER); } - nextToFocus.focus(); }; + /** * Navigate back one month and display the calendar. * * @param {HTMLButtonElement} _buttonEl An element within the date picker component */ - - -var displayPreviousMonth = function displayPreviousMonth(_buttonEl) { +const displayPreviousMonth = _buttonEl => { if (_buttonEl.disabled) return; - - var _getDatePickerContext9 = getDatePickerContext(_buttonEl), - calendarEl = _getDatePickerContext9.calendarEl, - calendarDate = _getDatePickerContext9.calendarDate, - minDate = _getDatePickerContext9.minDate, - maxDate = _getDatePickerContext9.maxDate; - - var date = subMonths(calendarDate, 1); + const { + calendarEl, + calendarDate, + minDate, + maxDate + } = getDatePickerContext(_buttonEl); + let date = subMonths(calendarDate, 1); date = keepDateBetweenMinAndMax(date, minDate, maxDate); - var newCalendar = renderCalendar(calendarEl, date); - var nextToFocus = newCalendar.querySelector(CALENDAR_PREVIOUS_MONTH); - + const newCalendar = renderCalendar(calendarEl, date); + let nextToFocus = newCalendar.querySelector(CALENDAR_PREVIOUS_MONTH); if (nextToFocus.disabled) { nextToFocus = newCalendar.querySelector(CALENDAR_DATE_PICKER); } - nextToFocus.focus(); }; + /** * Navigate forward one month and display the calendar. * * @param {HTMLButtonElement} _buttonEl An element within the date picker component */ - - -var displayNextMonth = function displayNextMonth(_buttonEl) { +const displayNextMonth = _buttonEl => { if (_buttonEl.disabled) return; - - var _getDatePickerContext10 = getDatePickerContext(_buttonEl), - calendarEl = _getDatePickerContext10.calendarEl, - calendarDate = _getDatePickerContext10.calendarDate, - minDate = _getDatePickerContext10.minDate, - maxDate = _getDatePickerContext10.maxDate; - - var date = addMonths(calendarDate, 1); + const { + calendarEl, + calendarDate, + minDate, + maxDate + } = getDatePickerContext(_buttonEl); + let date = addMonths(calendarDate, 1); date = keepDateBetweenMinAndMax(date, minDate, maxDate); - var newCalendar = renderCalendar(calendarEl, date); - var nextToFocus = newCalendar.querySelector(CALENDAR_NEXT_MONTH); - + const newCalendar = renderCalendar(calendarEl, date); + let nextToFocus = newCalendar.querySelector(CALENDAR_NEXT_MONTH); if (nextToFocus.disabled) { nextToFocus = newCalendar.querySelector(CALENDAR_DATE_PICKER); } - nextToFocus.focus(); }; + /** * Navigate forward one year and display the calendar. * * @param {HTMLButtonElement} _buttonEl An element within the date picker component */ - - -var displayNextYear = function displayNextYear(_buttonEl) { +const displayNextYear = _buttonEl => { if (_buttonEl.disabled) return; - - var _getDatePickerContext11 = getDatePickerContext(_buttonEl), - calendarEl = _getDatePickerContext11.calendarEl, - calendarDate = _getDatePickerContext11.calendarDate, - minDate = _getDatePickerContext11.minDate, - maxDate = _getDatePickerContext11.maxDate; - - var date = addYears(calendarDate, 1); + const { + calendarEl, + calendarDate, + minDate, + maxDate + } = getDatePickerContext(_buttonEl); + let date = addYears(calendarDate, 1); date = keepDateBetweenMinAndMax(date, minDate, maxDate); - var newCalendar = renderCalendar(calendarEl, date); - var nextToFocus = newCalendar.querySelector(CALENDAR_NEXT_YEAR); - + const newCalendar = renderCalendar(calendarEl, date); + let nextToFocus = newCalendar.querySelector(CALENDAR_NEXT_YEAR); if (nextToFocus.disabled) { nextToFocus = newCalendar.querySelector(CALENDAR_DATE_PICKER); } - nextToFocus.focus(); }; + /** * Hide the calendar of a date picker component. * * @param {HTMLElement} el An element within the date picker component */ - - -var hideCalendar = function hideCalendar(el) { - var _getDatePickerContext12 = getDatePickerContext(el), - datePickerEl = _getDatePickerContext12.datePickerEl, - calendarEl = _getDatePickerContext12.calendarEl, - statusEl = _getDatePickerContext12.statusEl; - +const hideCalendar = el => { + const { + datePickerEl, + calendarEl, + statusEl + } = getDatePickerContext(el); datePickerEl.classList.remove(DATE_PICKER_ACTIVE_CLASS); calendarEl.hidden = true; statusEl.textContent = ""; }; + /** * Select a date within the date picker component. * * @param {HTMLButtonElement} calendarDateEl A date element within the date picker component */ - - -var selectDate = function selectDate(calendarDateEl) { +const selectDate = calendarDateEl => { if (calendarDateEl.disabled) return; - - var _getDatePickerContext13 = getDatePickerContext(calendarDateEl), - datePickerEl = _getDatePickerContext13.datePickerEl, - externalInputEl = _getDatePickerContext13.externalInputEl; - + const { + datePickerEl, + externalInputEl + } = getDatePickerContext(calendarDateEl); setCalendarValue(calendarDateEl, calendarDateEl.dataset.value); hideCalendar(datePickerEl); externalInputEl.focus(); }; + /** * Toggle the calendar. * * @param {HTMLButtonElement} el An element within the date picker component */ - - -var toggleCalendar = function toggleCalendar(el) { +const toggleCalendar = el => { if (el.disabled) return; - - var _getDatePickerContext14 = getDatePickerContext(el), - calendarEl = _getDatePickerContext14.calendarEl, - inputDate = _getDatePickerContext14.inputDate, - minDate = _getDatePickerContext14.minDate, - maxDate = _getDatePickerContext14.maxDate, - defaultDate = _getDatePickerContext14.defaultDate; - + const { + calendarEl, + inputDate, + minDate, + maxDate, + defaultDate + } = getDatePickerContext(el); if (calendarEl.hidden) { - var dateToDisplay = keepDateBetweenMinAndMax(inputDate || defaultDate || today(), minDate, maxDate); - var newCalendar = renderCalendar(calendarEl, dateToDisplay); + const dateToDisplay = keepDateBetweenMinAndMax(inputDate || defaultDate || today(), minDate, maxDate); + const newCalendar = renderCalendar(calendarEl, dateToDisplay); newCalendar.querySelector(CALENDAR_DATE_FOCUSED).focus(); } else { hideCalendar(el); } }; + /** * Update the calendar when visible. * * @param {HTMLElement} el an element within the date picker */ - - -var updateCalendarIfVisible = function updateCalendarIfVisible(el) { - var _getDatePickerContext15 = getDatePickerContext(el), - calendarEl = _getDatePickerContext15.calendarEl, - inputDate = _getDatePickerContext15.inputDate, - minDate = _getDatePickerContext15.minDate, - maxDate = _getDatePickerContext15.maxDate; - - var calendarShown = !calendarEl.hidden; - +const updateCalendarIfVisible = el => { + const { + calendarEl, + inputDate, + minDate, + maxDate + } = getDatePickerContext(el); + const calendarShown = !calendarEl.hidden; if (calendarShown && inputDate) { - var dateToDisplay = keepDateBetweenMinAndMax(inputDate, minDate, maxDate); + const dateToDisplay = keepDateBetweenMinAndMax(inputDate, minDate, maxDate); renderCalendar(calendarEl, dateToDisplay); } -}; // #endregion Calendar - Date Selection View -// #region Calendar - Month Selection View +}; + +// #endregion Calendar - Date Selection View +// #region Calendar - Month Selection View /** * Display the month selection screen in the date picker. * * @param {HTMLButtonElement} el An element within the date picker component * @returns {HTMLElement} a reference to the new calendar element */ - - -var displayMonthSelection = function displayMonthSelection(el, monthToDisplay) { - var _getDatePickerContext16 = getDatePickerContext(el), - calendarEl = _getDatePickerContext16.calendarEl, - statusEl = _getDatePickerContext16.statusEl, - calendarDate = _getDatePickerContext16.calendarDate, - minDate = _getDatePickerContext16.minDate, - maxDate = _getDatePickerContext16.maxDate; - - var selectedMonth = calendarDate.getMonth(); - var focusedMonth = monthToDisplay == null ? selectedMonth : monthToDisplay; - var months = MONTH_LABELS.map(function (month, index) { - var monthToCheck = setMonth(calendarDate, index); - var isDisabled = isDatesMonthOutsideMinOrMax(monthToCheck, minDate, maxDate); - var tabindex = "-1"; - var classes = [CALENDAR_MONTH_CLASS]; - var isSelected = index === selectedMonth; - +const displayMonthSelection = (el, monthToDisplay) => { + const { + calendarEl, + statusEl, + calendarDate, + minDate, + maxDate + } = getDatePickerContext(el); + const selectedMonth = calendarDate.getMonth(); + const focusedMonth = monthToDisplay == null ? selectedMonth : monthToDisplay; + const months = MONTH_LABELS.map((month, index) => { + const monthToCheck = setMonth(calendarDate, index); + const isDisabled = isDatesMonthOutsideMinOrMax(monthToCheck, minDate, maxDate); + let tabindex = "-1"; + const classes = [CALENDAR_MONTH_CLASS]; + const isSelected = index === selectedMonth; if (index === focusedMonth) { tabindex = "0"; classes.push(CALENDAR_MONTH_FOCUSED_CLASS); } - if (isSelected) { classes.push(CALENDAR_MONTH_SELECTED_CLASS); } - - var btn = document.createElement("button"); + const btn = document.createElement("button"); btn.setAttribute("type", "button"); btn.setAttribute("tabindex", tabindex); btn.setAttribute("class", classes.join(" ")); btn.setAttribute("data-value", index); btn.setAttribute("data-label", month); btn.setAttribute("aria-selected", isSelected ? "true" : "false"); - if (isDisabled === true) { btn.disabled = true; } - btn.textContent = month; return btn; }); - var monthsHtml = document.createElement("div"); + const monthsHtml = document.createElement("div"); monthsHtml.setAttribute("tabindex", "-1"); monthsHtml.setAttribute("class", CALENDAR_MONTH_PICKER_CLASS); - var table = document.createElement("table"); + const table = document.createElement("table"); table.setAttribute("class", CALENDAR_TABLE_CLASS); table.setAttribute("role", "presentation"); - var monthsGrid = listToGridHtml(months, 3); - var tableBody = createTableBody(monthsGrid); + const monthsGrid = listToGridHtml(months, 3); + const tableBody = createTableBody(monthsGrid); table.insertAdjacentElement("beforeend", tableBody); monthsHtml.insertAdjacentElement("beforeend", table); - var newCalendar = calendarEl.cloneNode(); + const newCalendar = calendarEl.cloneNode(); newCalendar.insertAdjacentElement("beforeend", monthsHtml); calendarEl.parentNode.replaceChild(newCalendar, calendarEl); statusEl.textContent = "Select a month."; return newCalendar; }; + /** * Select a month in the date picker component. * * @param {HTMLButtonElement} monthEl An month element within the date picker component */ - - -var selectMonth = function selectMonth(monthEl) { +const selectMonth = monthEl => { if (monthEl.disabled) return; - - var _getDatePickerContext17 = getDatePickerContext(monthEl), - calendarEl = _getDatePickerContext17.calendarEl, - calendarDate = _getDatePickerContext17.calendarDate, - minDate = _getDatePickerContext17.minDate, - maxDate = _getDatePickerContext17.maxDate; - - var selectedMonth = parseInt(monthEl.dataset.value, 10); - var date = setMonth(calendarDate, selectedMonth); + const { + calendarEl, + calendarDate, + minDate, + maxDate + } = getDatePickerContext(monthEl); + const selectedMonth = parseInt(monthEl.dataset.value, 10); + let date = setMonth(calendarDate, selectedMonth); date = keepDateBetweenMinAndMax(date, minDate, maxDate); - var newCalendar = renderCalendar(calendarEl, date); + const newCalendar = renderCalendar(calendarEl, date); newCalendar.querySelector(CALENDAR_DATE_FOCUSED).focus(); -}; // #endregion Calendar - Month Selection View +}; + +// #endregion Calendar - Month Selection View + // #region Calendar - Year Selection View /** @@ -3287,211 +3069,207 @@ var selectMonth = function selectMonth(monthEl) { * @param {number} yearToDisplay year to display in year selection * @returns {HTMLElement} a reference to the new calendar element */ - - -var displayYearSelection = function displayYearSelection(el, yearToDisplay) { - var _getDatePickerContext18 = getDatePickerContext(el), - calendarEl = _getDatePickerContext18.calendarEl, - statusEl = _getDatePickerContext18.statusEl, - calendarDate = _getDatePickerContext18.calendarDate, - minDate = _getDatePickerContext18.minDate, - maxDate = _getDatePickerContext18.maxDate; - - var selectedYear = calendarDate.getFullYear(); - var focusedYear = yearToDisplay == null ? selectedYear : yearToDisplay; - var yearToChunk = focusedYear; +const displayYearSelection = (el, yearToDisplay) => { + const { + calendarEl, + statusEl, + calendarDate, + minDate, + maxDate + } = getDatePickerContext(el); + const selectedYear = calendarDate.getFullYear(); + const focusedYear = yearToDisplay == null ? selectedYear : yearToDisplay; + let yearToChunk = focusedYear; yearToChunk -= yearToChunk % YEAR_CHUNK; yearToChunk = Math.max(0, yearToChunk); - var prevYearChunkDisabled = isDatesYearOutsideMinOrMax(setYear(calendarDate, yearToChunk - 1), minDate, maxDate); - var nextYearChunkDisabled = isDatesYearOutsideMinOrMax(setYear(calendarDate, yearToChunk + YEAR_CHUNK), minDate, maxDate); - var years = []; - var yearIndex = yearToChunk; - + const prevYearChunkDisabled = isDatesYearOutsideMinOrMax(setYear(calendarDate, yearToChunk - 1), minDate, maxDate); + const nextYearChunkDisabled = isDatesYearOutsideMinOrMax(setYear(calendarDate, yearToChunk + YEAR_CHUNK), minDate, maxDate); + const years = []; + let yearIndex = yearToChunk; while (years.length < YEAR_CHUNK) { - var isDisabled = isDatesYearOutsideMinOrMax(setYear(calendarDate, yearIndex), minDate, maxDate); - var tabindex = "-1"; - var classes = [CALENDAR_YEAR_CLASS]; - var isSelected = yearIndex === selectedYear; - + const isDisabled = isDatesYearOutsideMinOrMax(setYear(calendarDate, yearIndex), minDate, maxDate); + let tabindex = "-1"; + const classes = [CALENDAR_YEAR_CLASS]; + const isSelected = yearIndex === selectedYear; if (yearIndex === focusedYear) { tabindex = "0"; classes.push(CALENDAR_YEAR_FOCUSED_CLASS); } - if (isSelected) { classes.push(CALENDAR_YEAR_SELECTED_CLASS); } - - var btn = document.createElement("button"); + const btn = document.createElement("button"); btn.setAttribute("type", "button"); btn.setAttribute("tabindex", tabindex); btn.setAttribute("class", classes.join(" ")); btn.setAttribute("data-value", yearIndex); btn.setAttribute("aria-selected", isSelected ? "true" : "false"); - if (isDisabled === true) { btn.disabled = true; } - btn.textContent = yearIndex; years.push(btn); yearIndex += 1; } + const newCalendar = calendarEl.cloneNode(); - var newCalendar = calendarEl.cloneNode(); // create the years calendar wrapper - - var yearsCalendarWrapper = document.createElement("div"); + // create the years calendar wrapper + const yearsCalendarWrapper = document.createElement("div"); yearsCalendarWrapper.setAttribute("tabindex", "-1"); - yearsCalendarWrapper.setAttribute("class", CALENDAR_YEAR_PICKER_CLASS); // create table parent + yearsCalendarWrapper.setAttribute("class", CALENDAR_YEAR_PICKER_CLASS); - var yearsTableParent = document.createElement("table"); - yearsTableParent.setAttribute("role", "presentation"); - yearsTableParent.setAttribute("class", CALENDAR_TABLE_CLASS); // create table body and table row + // create table parent + const yearsTableParent = document.createElement("table"); + yearsTableParent.setAttribute("class", CALENDAR_TABLE_CLASS); - var yearsHTMLTableBody = document.createElement("tbody"); - var yearsHTMLTableBodyRow = document.createElement("tr"); // create previous button + // create table body and table row + const yearsHTMLTableBody = document.createElement("tbody"); + const yearsHTMLTableBodyRow = document.createElement("tr"); - var previousYearsBtn = document.createElement("button"); + // create previous button + const previousYearsBtn = document.createElement("button"); previousYearsBtn.setAttribute("type", "button"); previousYearsBtn.setAttribute("class", CALENDAR_PREVIOUS_YEAR_CHUNK_CLASS); - previousYearsBtn.setAttribute("aria-label", "Navigate back ".concat(YEAR_CHUNK, " years")); - + previousYearsBtn.setAttribute("aria-label", `Navigate back ${YEAR_CHUNK} years`); if (prevYearChunkDisabled === true) { previousYearsBtn.disabled = true; } + previousYearsBtn.innerHTML = Sanitizer.escapeHTML` `; - previousYearsBtn.innerHTML = Sanitizer.escapeHTML(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral([" "]))); // create next button - - var nextYearsBtn = document.createElement("button"); + // create next button + const nextYearsBtn = document.createElement("button"); nextYearsBtn.setAttribute("type", "button"); nextYearsBtn.setAttribute("class", CALENDAR_NEXT_YEAR_CHUNK_CLASS); - nextYearsBtn.setAttribute("aria-label", "Navigate forward ".concat(YEAR_CHUNK, " years")); - + nextYearsBtn.setAttribute("aria-label", `Navigate forward ${YEAR_CHUNK} years`); if (nextYearChunkDisabled === true) { nextYearsBtn.disabled = true; } + nextYearsBtn.innerHTML = Sanitizer.escapeHTML` `; - nextYearsBtn.innerHTML = Sanitizer.escapeHTML(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral([" "]))); // create the actual years table - - var yearsTable = document.createElement("table"); + // create the actual years table + const yearsTable = document.createElement("table"); yearsTable.setAttribute("class", CALENDAR_TABLE_CLASS); - yearsTable.setAttribute("role", "presentation"); // create the years child table + yearsTable.setAttribute("role", "presentation"); - var yearsGrid = listToGridHtml(years, 3); - var yearsTableBody = createTableBody(yearsGrid); // append the grid to the years child table + // create the years child table + const yearsGrid = listToGridHtml(years, 3); + const yearsTableBody = createTableBody(yearsGrid); - yearsTable.insertAdjacentElement("beforeend", yearsTableBody); // create the prev button td and append the prev button + // append the grid to the years child table + yearsTable.insertAdjacentElement("beforeend", yearsTableBody); - var yearsHTMLTableBodyDetailPrev = document.createElement("td"); - yearsHTMLTableBodyDetailPrev.insertAdjacentElement("beforeend", previousYearsBtn); // create the years td and append the years child table + // create the prev button td and append the prev button + const yearsHTMLTableBodyDetailPrev = document.createElement("td"); + yearsHTMLTableBodyDetailPrev.insertAdjacentElement("beforeend", previousYearsBtn); - var yearsHTMLTableBodyYearsDetail = document.createElement("td"); + // create the years td and append the years child table + const yearsHTMLTableBodyYearsDetail = document.createElement("td"); yearsHTMLTableBodyYearsDetail.setAttribute("colspan", "3"); - yearsHTMLTableBodyYearsDetail.insertAdjacentElement("beforeend", yearsTable); // create the next button td and append the next button + yearsHTMLTableBodyYearsDetail.insertAdjacentElement("beforeend", yearsTable); - var yearsHTMLTableBodyDetailNext = document.createElement("td"); - yearsHTMLTableBodyDetailNext.insertAdjacentElement("beforeend", nextYearsBtn); // append the three td to the years child table row + // create the next button td and append the next button + const yearsHTMLTableBodyDetailNext = document.createElement("td"); + yearsHTMLTableBodyDetailNext.insertAdjacentElement("beforeend", nextYearsBtn); + // append the three td to the years child table row yearsHTMLTableBodyRow.insertAdjacentElement("beforeend", yearsHTMLTableBodyDetailPrev); yearsHTMLTableBodyRow.insertAdjacentElement("beforeend", yearsHTMLTableBodyYearsDetail); - yearsHTMLTableBodyRow.insertAdjacentElement("beforeend", yearsHTMLTableBodyDetailNext); // append the table row to the years child table body + yearsHTMLTableBodyRow.insertAdjacentElement("beforeend", yearsHTMLTableBodyDetailNext); - yearsHTMLTableBody.insertAdjacentElement("beforeend", yearsHTMLTableBodyRow); // append the years table body to the years parent table + // append the table row to the years child table body + yearsHTMLTableBody.insertAdjacentElement("beforeend", yearsHTMLTableBodyRow); - yearsTableParent.insertAdjacentElement("beforeend", yearsHTMLTableBody); // append the parent table to the calendar wrapper + // append the years table body to the years parent table + yearsTableParent.insertAdjacentElement("beforeend", yearsHTMLTableBody); - yearsCalendarWrapper.insertAdjacentElement("beforeend", yearsTableParent); // append the years calender to the new calendar + // append the parent table to the calendar wrapper + yearsCalendarWrapper.insertAdjacentElement("beforeend", yearsTableParent); - newCalendar.insertAdjacentElement("beforeend", yearsCalendarWrapper); // replace calendar + // append the years calender to the new calendar + newCalendar.insertAdjacentElement("beforeend", yearsCalendarWrapper); + // replace calendar calendarEl.parentNode.replaceChild(newCalendar, calendarEl); - statusEl.textContent = Sanitizer.escapeHTML(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["Showing years ", " to ", ". Select a year."])), yearToChunk, yearToChunk + YEAR_CHUNK - 1); + statusEl.textContent = Sanitizer.escapeHTML`Showing years ${yearToChunk} to ${yearToChunk + YEAR_CHUNK - 1}. Select a year.`; return newCalendar; }; + /** * Navigate back by years and display the year selection screen. * * @param {HTMLButtonElement} el An element within the date picker component */ - - -var displayPreviousYearChunk = function displayPreviousYearChunk(el) { +const displayPreviousYearChunk = el => { if (el.disabled) return; - - var _getDatePickerContext19 = getDatePickerContext(el), - calendarEl = _getDatePickerContext19.calendarEl, - calendarDate = _getDatePickerContext19.calendarDate, - minDate = _getDatePickerContext19.minDate, - maxDate = _getDatePickerContext19.maxDate; - - var yearEl = calendarEl.querySelector(CALENDAR_YEAR_FOCUSED); - var selectedYear = parseInt(yearEl.textContent, 10); - var adjustedYear = selectedYear - YEAR_CHUNK; + const { + calendarEl, + calendarDate, + minDate, + maxDate + } = getDatePickerContext(el); + const yearEl = calendarEl.querySelector(CALENDAR_YEAR_FOCUSED); + const selectedYear = parseInt(yearEl.textContent, 10); + let adjustedYear = selectedYear - YEAR_CHUNK; adjustedYear = Math.max(0, adjustedYear); - var date = setYear(calendarDate, adjustedYear); - var cappedDate = keepDateBetweenMinAndMax(date, minDate, maxDate); - var newCalendar = displayYearSelection(calendarEl, cappedDate.getFullYear()); - var nextToFocus = newCalendar.querySelector(CALENDAR_PREVIOUS_YEAR_CHUNK); - + const date = setYear(calendarDate, adjustedYear); + const cappedDate = keepDateBetweenMinAndMax(date, minDate, maxDate); + const newCalendar = displayYearSelection(calendarEl, cappedDate.getFullYear()); + let nextToFocus = newCalendar.querySelector(CALENDAR_PREVIOUS_YEAR_CHUNK); if (nextToFocus.disabled) { nextToFocus = newCalendar.querySelector(CALENDAR_YEAR_PICKER); } - nextToFocus.focus(); }; + /** * Navigate forward by years and display the year selection screen. * * @param {HTMLButtonElement} el An element within the date picker component */ - - -var displayNextYearChunk = function displayNextYearChunk(el) { +const displayNextYearChunk = el => { if (el.disabled) return; - - var _getDatePickerContext20 = getDatePickerContext(el), - calendarEl = _getDatePickerContext20.calendarEl, - calendarDate = _getDatePickerContext20.calendarDate, - minDate = _getDatePickerContext20.minDate, - maxDate = _getDatePickerContext20.maxDate; - - var yearEl = calendarEl.querySelector(CALENDAR_YEAR_FOCUSED); - var selectedYear = parseInt(yearEl.textContent, 10); - var adjustedYear = selectedYear + YEAR_CHUNK; + const { + calendarEl, + calendarDate, + minDate, + maxDate + } = getDatePickerContext(el); + const yearEl = calendarEl.querySelector(CALENDAR_YEAR_FOCUSED); + const selectedYear = parseInt(yearEl.textContent, 10); + let adjustedYear = selectedYear + YEAR_CHUNK; adjustedYear = Math.max(0, adjustedYear); - var date = setYear(calendarDate, adjustedYear); - var cappedDate = keepDateBetweenMinAndMax(date, minDate, maxDate); - var newCalendar = displayYearSelection(calendarEl, cappedDate.getFullYear()); - var nextToFocus = newCalendar.querySelector(CALENDAR_NEXT_YEAR_CHUNK); - + const date = setYear(calendarDate, adjustedYear); + const cappedDate = keepDateBetweenMinAndMax(date, minDate, maxDate); + const newCalendar = displayYearSelection(calendarEl, cappedDate.getFullYear()); + let nextToFocus = newCalendar.querySelector(CALENDAR_NEXT_YEAR_CHUNK); if (nextToFocus.disabled) { nextToFocus = newCalendar.querySelector(CALENDAR_YEAR_PICKER); } - nextToFocus.focus(); }; + /** * Select a year in the date picker component. * * @param {HTMLButtonElement} yearEl A year element within the date picker component */ - - -var selectYear = function selectYear(yearEl) { +const selectYear = yearEl => { if (yearEl.disabled) return; - - var _getDatePickerContext21 = getDatePickerContext(yearEl), - calendarEl = _getDatePickerContext21.calendarEl, - calendarDate = _getDatePickerContext21.calendarDate, - minDate = _getDatePickerContext21.minDate, - maxDate = _getDatePickerContext21.maxDate; - - var selectedYear = parseInt(yearEl.innerHTML, 10); - var date = setYear(calendarDate, selectedYear); + const { + calendarEl, + calendarDate, + minDate, + maxDate + } = getDatePickerContext(yearEl); + const selectedYear = parseInt(yearEl.innerHTML, 10); + let date = setYear(calendarDate, selectedYear); date = keepDateBetweenMinAndMax(date, minDate, maxDate); - var newCalendar = renderCalendar(calendarEl, date); + const newCalendar = renderCalendar(calendarEl, date); newCalendar.querySelector(CALENDAR_DATE_FOCUSED).focus(); -}; // #endregion Calendar - Year Selection View +}; + +// #endregion Calendar - Year Selection View + // #region Calendar Event Handling /** @@ -3499,17 +3277,18 @@ var selectYear = function selectYear(yearEl) { * * @param {KeyboardEvent} event the keydown event */ - - -var handleEscapeFromCalendar = function handleEscapeFromCalendar(event) { - var _getDatePickerContext22 = getDatePickerContext(event.target), - datePickerEl = _getDatePickerContext22.datePickerEl, - externalInputEl = _getDatePickerContext22.externalInputEl; - +const handleEscapeFromCalendar = event => { + const { + datePickerEl, + externalInputEl + } = getDatePickerContext(event.target); hideCalendar(datePickerEl); externalInputEl.focus(); event.preventDefault(); -}; // #endregion Calendar Event Handling +}; + +// #endregion Calendar Event Handling + // #region Calendar Date Event Handling /** @@ -3517,135 +3296,111 @@ var handleEscapeFromCalendar = function handleEscapeFromCalendar(event) { * * @param {function} adjustDateFn function that returns the adjusted date */ +const adjustCalendar = adjustDateFn => event => { + const { + calendarEl, + calendarDate, + minDate, + maxDate + } = getDatePickerContext(event.target); + const date = adjustDateFn(calendarDate); + const cappedDate = keepDateBetweenMinAndMax(date, minDate, maxDate); + if (!isSameDay(calendarDate, cappedDate)) { + const newCalendar = renderCalendar(calendarEl, cappedDate); + newCalendar.querySelector(CALENDAR_DATE_FOCUSED).focus(); + } + event.preventDefault(); +}; +/** + * Navigate back one week and display the calendar. + * + * @param {KeyboardEvent} event the keydown event + */ +const handleUpFromDate = adjustCalendar(date => subWeeks(date, 1)); -var adjustCalendar = function adjustCalendar(adjustDateFn) { - return function (event) { - var _getDatePickerContext23 = getDatePickerContext(event.target), - calendarEl = _getDatePickerContext23.calendarEl, - calendarDate = _getDatePickerContext23.calendarDate, - minDate = _getDatePickerContext23.minDate, - maxDate = _getDatePickerContext23.maxDate; - - var date = adjustDateFn(calendarDate); - var cappedDate = keepDateBetweenMinAndMax(date, minDate, maxDate); - - if (!isSameDay(calendarDate, cappedDate)) { - var newCalendar = renderCalendar(calendarEl, cappedDate); - newCalendar.querySelector(CALENDAR_DATE_FOCUSED).focus(); - } - - event.preventDefault(); - }; -}; -/** - * Navigate back one week and display the calendar. - * - * @param {KeyboardEvent} event the keydown event - */ - - -var handleUpFromDate = adjustCalendar(function (date) { - return subWeeks(date, 1); -}); /** * Navigate forward one week and display the calendar. * * @param {KeyboardEvent} event the keydown event */ +const handleDownFromDate = adjustCalendar(date => addWeeks(date, 1)); -var handleDownFromDate = adjustCalendar(function (date) { - return addWeeks(date, 1); -}); /** * Navigate back one day and display the calendar. * * @param {KeyboardEvent} event the keydown event */ +const handleLeftFromDate = adjustCalendar(date => subDays(date, 1)); -var handleLeftFromDate = adjustCalendar(function (date) { - return subDays(date, 1); -}); /** * Navigate forward one day and display the calendar. * * @param {KeyboardEvent} event the keydown event */ +const handleRightFromDate = adjustCalendar(date => addDays(date, 1)); -var handleRightFromDate = adjustCalendar(function (date) { - return addDays(date, 1); -}); /** * Navigate to the start of the week and display the calendar. * * @param {KeyboardEvent} event the keydown event */ +const handleHomeFromDate = adjustCalendar(date => startOfWeek(date)); -var handleHomeFromDate = adjustCalendar(function (date) { - return startOfWeek(date); -}); /** * Navigate to the end of the week and display the calendar. * * @param {KeyboardEvent} event the keydown event */ +const handleEndFromDate = adjustCalendar(date => endOfWeek(date)); -var handleEndFromDate = adjustCalendar(function (date) { - return endOfWeek(date); -}); /** * Navigate forward one month and display the calendar. * * @param {KeyboardEvent} event the keydown event */ +const handlePageDownFromDate = adjustCalendar(date => addMonths(date, 1)); -var handlePageDownFromDate = adjustCalendar(function (date) { - return addMonths(date, 1); -}); /** * Navigate back one month and display the calendar. * * @param {KeyboardEvent} event the keydown event */ +const handlePageUpFromDate = adjustCalendar(date => subMonths(date, 1)); -var handlePageUpFromDate = adjustCalendar(function (date) { - return subMonths(date, 1); -}); /** * Navigate forward one year and display the calendar. * * @param {KeyboardEvent} event the keydown event */ +const handleShiftPageDownFromDate = adjustCalendar(date => addYears(date, 1)); -var handleShiftPageDownFromDate = adjustCalendar(function (date) { - return addYears(date, 1); -}); /** * Navigate back one year and display the calendar. * * @param {KeyboardEvent} event the keydown event */ +const handleShiftPageUpFromDate = adjustCalendar(date => subYears(date, 1)); -var handleShiftPageUpFromDate = adjustCalendar(function (date) { - return subYears(date, 1); -}); /** * display the calendar for the mouseover date. * * @param {MouseEvent} event The mouseover event * @param {HTMLButtonElement} dateEl A date element within the date picker component */ - -var handleMouseoverFromDate = function handleMouseoverFromDate(dateEl) { +const handleMouseoverFromDate = dateEl => { if (dateEl.disabled) return; - var calendarEl = dateEl.closest(DATE_PICKER_CALENDAR); - var currentCalendarDate = calendarEl.dataset.value; - var hoverDate = dateEl.dataset.value; + const calendarEl = dateEl.closest(DATE_PICKER_CALENDAR); + const currentCalendarDate = calendarEl.dataset.value; + const hoverDate = dateEl.dataset.value; if (hoverDate === currentCalendarDate) return; - var dateToDisplay = parseDateString(hoverDate); - var newCalendar = renderCalendar(calendarEl, dateToDisplay); + const dateToDisplay = parseDateString(hoverDate); + const newCalendar = renderCalendar(calendarEl, dateToDisplay); newCalendar.querySelector(CALENDAR_DATE_FOCUSED).focus(); -}; // #endregion Calendar Date Event Handling +}; + +// #endregion Calendar Date Event Handling + // #region Calendar Month Event Handling /** @@ -3653,120 +3408,99 @@ var handleMouseoverFromDate = function handleMouseoverFromDate(dateEl) { * * @param {function} adjustMonthFn function that returns the adjusted month */ - - -var adjustMonthSelectionScreen = function adjustMonthSelectionScreen(adjustMonthFn) { - return function (event) { - var monthEl = event.target; - var selectedMonth = parseInt(monthEl.dataset.value, 10); - - var _getDatePickerContext24 = getDatePickerContext(monthEl), - calendarEl = _getDatePickerContext24.calendarEl, - calendarDate = _getDatePickerContext24.calendarDate, - minDate = _getDatePickerContext24.minDate, - maxDate = _getDatePickerContext24.maxDate; - - var currentDate = setMonth(calendarDate, selectedMonth); - var adjustedMonth = adjustMonthFn(selectedMonth); - adjustedMonth = Math.max(0, Math.min(11, adjustedMonth)); - var date = setMonth(calendarDate, adjustedMonth); - var cappedDate = keepDateBetweenMinAndMax(date, minDate, maxDate); - - if (!isSameMonth(currentDate, cappedDate)) { - var newCalendar = displayMonthSelection(calendarEl, cappedDate.getMonth()); - newCalendar.querySelector(CALENDAR_MONTH_FOCUSED).focus(); - } - - event.preventDefault(); - }; +const adjustMonthSelectionScreen = adjustMonthFn => event => { + const monthEl = event.target; + const selectedMonth = parseInt(monthEl.dataset.value, 10); + const { + calendarEl, + calendarDate, + minDate, + maxDate + } = getDatePickerContext(monthEl); + const currentDate = setMonth(calendarDate, selectedMonth); + let adjustedMonth = adjustMonthFn(selectedMonth); + adjustedMonth = Math.max(0, Math.min(11, adjustedMonth)); + const date = setMonth(calendarDate, adjustedMonth); + const cappedDate = keepDateBetweenMinAndMax(date, minDate, maxDate); + if (!isSameMonth(currentDate, cappedDate)) { + const newCalendar = displayMonthSelection(calendarEl, cappedDate.getMonth()); + newCalendar.querySelector(CALENDAR_MONTH_FOCUSED).focus(); + } + event.preventDefault(); }; + /** * Navigate back three months and display the month selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handleUpFromMonth = adjustMonthSelectionScreen(month => month - 3); - -var handleUpFromMonth = adjustMonthSelectionScreen(function (month) { - return month - 3; -}); /** * Navigate forward three months and display the month selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handleDownFromMonth = adjustMonthSelectionScreen(month => month + 3); -var handleDownFromMonth = adjustMonthSelectionScreen(function (month) { - return month + 3; -}); /** * Navigate back one month and display the month selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handleLeftFromMonth = adjustMonthSelectionScreen(month => month - 1); -var handleLeftFromMonth = adjustMonthSelectionScreen(function (month) { - return month - 1; -}); /** * Navigate forward one month and display the month selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handleRightFromMonth = adjustMonthSelectionScreen(month => month + 1); -var handleRightFromMonth = adjustMonthSelectionScreen(function (month) { - return month + 1; -}); /** * Navigate to the start of the row of months and display the month selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handleHomeFromMonth = adjustMonthSelectionScreen(month => month - month % 3); -var handleHomeFromMonth = adjustMonthSelectionScreen(function (month) { - return month - month % 3; -}); /** * Navigate to the end of the row of months and display the month selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handleEndFromMonth = adjustMonthSelectionScreen(month => month + 2 - month % 3); -var handleEndFromMonth = adjustMonthSelectionScreen(function (month) { - return month + 2 - month % 3; -}); /** * Navigate to the last month (December) and display the month selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handlePageDownFromMonth = adjustMonthSelectionScreen(() => 11); -var handlePageDownFromMonth = adjustMonthSelectionScreen(function () { - return 11; -}); /** * Navigate to the first month (January) and display the month selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handlePageUpFromMonth = adjustMonthSelectionScreen(() => 0); -var handlePageUpFromMonth = adjustMonthSelectionScreen(function () { - return 0; -}); /** * update the focus on a month when the mouse moves. * * @param {MouseEvent} event The mouseover event * @param {HTMLButtonElement} monthEl A month element within the date picker component */ - -var handleMouseoverFromMonth = function handleMouseoverFromMonth(monthEl) { +const handleMouseoverFromMonth = monthEl => { if (monthEl.disabled) return; if (monthEl.classList.contains(CALENDAR_MONTH_FOCUSED_CLASS)) return; - var focusMonth = parseInt(monthEl.dataset.value, 10); - var newCalendar = displayMonthSelection(monthEl, focusMonth); + const focusMonth = parseInt(monthEl.dataset.value, 10); + const newCalendar = displayMonthSelection(monthEl, focusMonth); newCalendar.querySelector(CALENDAR_MONTH_FOCUSED).focus(); -}; // #endregion Calendar Month Event Handling +}; + +// #endregion Calendar Month Event Handling + // #region Calendar Year Event Handling /** @@ -3774,165 +3508,142 @@ var handleMouseoverFromMonth = function handleMouseoverFromMonth(monthEl) { * * @param {function} adjustYearFn function that returns the adjusted year */ - - -var adjustYearSelectionScreen = function adjustYearSelectionScreen(adjustYearFn) { - return function (event) { - var yearEl = event.target; - var selectedYear = parseInt(yearEl.dataset.value, 10); - - var _getDatePickerContext25 = getDatePickerContext(yearEl), - calendarEl = _getDatePickerContext25.calendarEl, - calendarDate = _getDatePickerContext25.calendarDate, - minDate = _getDatePickerContext25.minDate, - maxDate = _getDatePickerContext25.maxDate; - - var currentDate = setYear(calendarDate, selectedYear); - var adjustedYear = adjustYearFn(selectedYear); - adjustedYear = Math.max(0, adjustedYear); - var date = setYear(calendarDate, adjustedYear); - var cappedDate = keepDateBetweenMinAndMax(date, minDate, maxDate); - - if (!isSameYear(currentDate, cappedDate)) { - var newCalendar = displayYearSelection(calendarEl, cappedDate.getFullYear()); - newCalendar.querySelector(CALENDAR_YEAR_FOCUSED).focus(); - } - - event.preventDefault(); - }; +const adjustYearSelectionScreen = adjustYearFn => event => { + const yearEl = event.target; + const selectedYear = parseInt(yearEl.dataset.value, 10); + const { + calendarEl, + calendarDate, + minDate, + maxDate + } = getDatePickerContext(yearEl); + const currentDate = setYear(calendarDate, selectedYear); + let adjustedYear = adjustYearFn(selectedYear); + adjustedYear = Math.max(0, adjustedYear); + const date = setYear(calendarDate, adjustedYear); + const cappedDate = keepDateBetweenMinAndMax(date, minDate, maxDate); + if (!isSameYear(currentDate, cappedDate)) { + const newCalendar = displayYearSelection(calendarEl, cappedDate.getFullYear()); + newCalendar.querySelector(CALENDAR_YEAR_FOCUSED).focus(); + } + event.preventDefault(); }; + /** * Navigate back three years and display the year selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handleUpFromYear = adjustYearSelectionScreen(year => year - 3); - -var handleUpFromYear = adjustYearSelectionScreen(function (year) { - return year - 3; -}); /** * Navigate forward three years and display the year selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handleDownFromYear = adjustYearSelectionScreen(year => year + 3); -var handleDownFromYear = adjustYearSelectionScreen(function (year) { - return year + 3; -}); /** * Navigate back one year and display the year selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handleLeftFromYear = adjustYearSelectionScreen(year => year - 1); -var handleLeftFromYear = adjustYearSelectionScreen(function (year) { - return year - 1; -}); /** * Navigate forward one year and display the year selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handleRightFromYear = adjustYearSelectionScreen(year => year + 1); -var handleRightFromYear = adjustYearSelectionScreen(function (year) { - return year + 1; -}); /** * Navigate to the start of the row of years and display the year selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handleHomeFromYear = adjustYearSelectionScreen(year => year - year % 3); -var handleHomeFromYear = adjustYearSelectionScreen(function (year) { - return year - year % 3; -}); /** * Navigate to the end of the row of years and display the year selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handleEndFromYear = adjustYearSelectionScreen(year => year + 2 - year % 3); -var handleEndFromYear = adjustYearSelectionScreen(function (year) { - return year + 2 - year % 3; -}); /** * Navigate to back 12 years and display the year selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handlePageUpFromYear = adjustYearSelectionScreen(year => year - YEAR_CHUNK); -var handlePageUpFromYear = adjustYearSelectionScreen(function (year) { - return year - YEAR_CHUNK; -}); /** * Navigate forward 12 years and display the year selection screen. * * @param {KeyboardEvent} event the keydown event */ +const handlePageDownFromYear = adjustYearSelectionScreen(year => year + YEAR_CHUNK); -var handlePageDownFromYear = adjustYearSelectionScreen(function (year) { - return year + YEAR_CHUNK; -}); /** * update the focus on a year when the mouse moves. * * @param {MouseEvent} event The mouseover event * @param {HTMLButtonElement} dateEl A year element within the date picker component */ - -var handleMouseoverFromYear = function handleMouseoverFromYear(yearEl) { +const handleMouseoverFromYear = yearEl => { if (yearEl.disabled) return; if (yearEl.classList.contains(CALENDAR_YEAR_FOCUSED_CLASS)) return; - var focusYear = parseInt(yearEl.dataset.value, 10); - var newCalendar = displayYearSelection(yearEl, focusYear); + const focusYear = parseInt(yearEl.dataset.value, 10); + const newCalendar = displayYearSelection(yearEl, focusYear); newCalendar.querySelector(CALENDAR_YEAR_FOCUSED).focus(); -}; // #endregion Calendar Year Event Handling -// #region Focus Handling Event Handling +}; + +// #endregion Calendar Year Event Handling +// #region Focus Handling Event Handling -var tabHandler = function tabHandler(focusable) { - var getFocusableContext = function getFocusableContext(el) { - var _getDatePickerContext26 = getDatePickerContext(el), - calendarEl = _getDatePickerContext26.calendarEl; - - var focusableElements = select(focusable, calendarEl); - var firstTabIndex = 0; - var lastTabIndex = focusableElements.length - 1; - var firstTabStop = focusableElements[firstTabIndex]; - var lastTabStop = focusableElements[lastTabIndex]; - var focusIndex = focusableElements.indexOf(activeElement()); - var isLastTab = focusIndex === lastTabIndex; - var isFirstTab = focusIndex === firstTabIndex; - var isNotFound = focusIndex === -1; +const tabHandler = focusable => { + const getFocusableContext = el => { + const { + calendarEl + } = getDatePickerContext(el); + const focusableElements = select(focusable, calendarEl); + const firstTabIndex = 0; + const lastTabIndex = focusableElements.length - 1; + const firstTabStop = focusableElements[firstTabIndex]; + const lastTabStop = focusableElements[lastTabIndex]; + const focusIndex = focusableElements.indexOf(activeElement()); + const isLastTab = focusIndex === lastTabIndex; + const isFirstTab = focusIndex === firstTabIndex; + const isNotFound = focusIndex === -1; return { - focusableElements: focusableElements, - isNotFound: isNotFound, - firstTabStop: firstTabStop, - isFirstTab: isFirstTab, - lastTabStop: lastTabStop, - isLastTab: isLastTab + focusableElements, + isNotFound, + firstTabStop, + isFirstTab, + lastTabStop, + isLastTab }; }; - return { - tabAhead: function tabAhead(event) { - var _getFocusableContext = getFocusableContext(event.target), - firstTabStop = _getFocusableContext.firstTabStop, - isLastTab = _getFocusableContext.isLastTab, - isNotFound = _getFocusableContext.isNotFound; - + tabAhead(event) { + const { + firstTabStop, + isLastTab, + isNotFound + } = getFocusableContext(event.target); if (isLastTab || isNotFound) { event.preventDefault(); firstTabStop.focus(); } }, - tabBack: function tabBack(event) { - var _getFocusableContext2 = getFocusableContext(event.target), - lastTabStop = _getFocusableContext2.lastTabStop, - isFirstTab = _getFocusableContext2.isFirstTab, - isNotFound = _getFocusableContext2.isNotFound; - + tabBack(event) { + const { + lastTabStop, + isFirstTab, + isNotFound + } = getFocusableContext(event.target); if (isFirstTab || isNotFound) { event.preventDefault(); lastTabStop.focus(); @@ -3940,189 +3651,211 @@ var tabHandler = function tabHandler(focusable) { } }; }; +const datePickerTabEventHandler = tabHandler(DATE_PICKER_FOCUSABLE); +const monthPickerTabEventHandler = tabHandler(MONTH_PICKER_FOCUSABLE); +const yearPickerTabEventHandler = tabHandler(YEAR_PICKER_FOCUSABLE); -var datePickerTabEventHandler = tabHandler(DATE_PICKER_FOCUSABLE); -var monthPickerTabEventHandler = tabHandler(MONTH_PICKER_FOCUSABLE); -var yearPickerTabEventHandler = tabHandler(YEAR_PICKER_FOCUSABLE); // #endregion Focus Handling Event Handling -// #region Date Picker Event Delegation Registration / Component +// #endregion Focus Handling Event Handling -var datePickerEvents = (_datePickerEvents = {}, _defineProperty(_datePickerEvents, CLICK, (_CLICK = {}, _defineProperty(_CLICK, DATE_PICKER_BUTTON, function () { - toggleCalendar(this); -}), _defineProperty(_CLICK, CALENDAR_DATE, function () { - selectDate(this); -}), _defineProperty(_CLICK, CALENDAR_MONTH, function () { - selectMonth(this); -}), _defineProperty(_CLICK, CALENDAR_YEAR, function () { - selectYear(this); -}), _defineProperty(_CLICK, CALENDAR_PREVIOUS_MONTH, function () { - displayPreviousMonth(this); -}), _defineProperty(_CLICK, CALENDAR_NEXT_MONTH, function () { - displayNextMonth(this); -}), _defineProperty(_CLICK, CALENDAR_PREVIOUS_YEAR, function () { - displayPreviousYear(this); -}), _defineProperty(_CLICK, CALENDAR_NEXT_YEAR, function () { - displayNextYear(this); -}), _defineProperty(_CLICK, CALENDAR_PREVIOUS_YEAR_CHUNK, function () { - displayPreviousYearChunk(this); -}), _defineProperty(_CLICK, CALENDAR_NEXT_YEAR_CHUNK, function () { - displayNextYearChunk(this); -}), _defineProperty(_CLICK, CALENDAR_MONTH_SELECTION, function () { - var newCalendar = displayMonthSelection(this); - newCalendar.querySelector(CALENDAR_MONTH_FOCUSED).focus(); -}), _defineProperty(_CLICK, CALENDAR_YEAR_SELECTION, function () { - var newCalendar = displayYearSelection(this); - newCalendar.querySelector(CALENDAR_YEAR_FOCUSED).focus(); -}), _CLICK)), _defineProperty(_datePickerEvents, "keyup", _defineProperty({}, DATE_PICKER_CALENDAR, function (event) { - var keydown = this.dataset.keydownKeyCode; +// #region Date Picker Event Delegation Registration / Component - if ("".concat(event.keyCode) !== keydown) { - event.preventDefault(); +const datePickerEvents = { + [CLICK]: { + [DATE_PICKER_BUTTON]() { + toggleCalendar(this); + }, + [CALENDAR_DATE]() { + selectDate(this); + }, + [CALENDAR_MONTH]() { + selectMonth(this); + }, + [CALENDAR_YEAR]() { + selectYear(this); + }, + [CALENDAR_PREVIOUS_MONTH]() { + displayPreviousMonth(this); + }, + [CALENDAR_NEXT_MONTH]() { + displayNextMonth(this); + }, + [CALENDAR_PREVIOUS_YEAR]() { + displayPreviousYear(this); + }, + [CALENDAR_NEXT_YEAR]() { + displayNextYear(this); + }, + [CALENDAR_PREVIOUS_YEAR_CHUNK]() { + displayPreviousYearChunk(this); + }, + [CALENDAR_NEXT_YEAR_CHUNK]() { + displayNextYearChunk(this); + }, + [CALENDAR_MONTH_SELECTION]() { + const newCalendar = displayMonthSelection(this); + newCalendar.querySelector(CALENDAR_MONTH_FOCUSED).focus(); + }, + [CALENDAR_YEAR_SELECTION]() { + const newCalendar = displayYearSelection(this); + newCalendar.querySelector(CALENDAR_YEAR_FOCUSED).focus(); + } + }, + keyup: { + [DATE_PICKER_CALENDAR](event) { + const keydown = this.dataset.keydownKeyCode; + if (`${event.keyCode}` !== keydown) { + event.preventDefault(); + } + } + }, + keydown: { + [DATE_PICKER_EXTERNAL_INPUT](event) { + if (event.keyCode === ENTER_KEYCODE) { + validateDateInput(this); + } + }, + [CALENDAR_DATE]: keymap({ + Up: handleUpFromDate, + ArrowUp: handleUpFromDate, + Down: handleDownFromDate, + ArrowDown: handleDownFromDate, + Left: handleLeftFromDate, + ArrowLeft: handleLeftFromDate, + Right: handleRightFromDate, + ArrowRight: handleRightFromDate, + Home: handleHomeFromDate, + End: handleEndFromDate, + PageDown: handlePageDownFromDate, + PageUp: handlePageUpFromDate, + "Shift+PageDown": handleShiftPageDownFromDate, + "Shift+PageUp": handleShiftPageUpFromDate, + Tab: datePickerTabEventHandler.tabAhead + }), + [CALENDAR_DATE_PICKER]: keymap({ + Tab: datePickerTabEventHandler.tabAhead, + "Shift+Tab": datePickerTabEventHandler.tabBack + }), + [CALENDAR_MONTH]: keymap({ + Up: handleUpFromMonth, + ArrowUp: handleUpFromMonth, + Down: handleDownFromMonth, + ArrowDown: handleDownFromMonth, + Left: handleLeftFromMonth, + ArrowLeft: handleLeftFromMonth, + Right: handleRightFromMonth, + ArrowRight: handleRightFromMonth, + Home: handleHomeFromMonth, + End: handleEndFromMonth, + PageDown: handlePageDownFromMonth, + PageUp: handlePageUpFromMonth + }), + [CALENDAR_MONTH_PICKER]: keymap({ + Tab: monthPickerTabEventHandler.tabAhead, + "Shift+Tab": monthPickerTabEventHandler.tabBack + }), + [CALENDAR_YEAR]: keymap({ + Up: handleUpFromYear, + ArrowUp: handleUpFromYear, + Down: handleDownFromYear, + ArrowDown: handleDownFromYear, + Left: handleLeftFromYear, + ArrowLeft: handleLeftFromYear, + Right: handleRightFromYear, + ArrowRight: handleRightFromYear, + Home: handleHomeFromYear, + End: handleEndFromYear, + PageDown: handlePageDownFromYear, + PageUp: handlePageUpFromYear + }), + [CALENDAR_YEAR_PICKER]: keymap({ + Tab: yearPickerTabEventHandler.tabAhead, + "Shift+Tab": yearPickerTabEventHandler.tabBack + }), + [DATE_PICKER_CALENDAR](event) { + this.dataset.keydownKeyCode = event.keyCode; + }, + [DATE_PICKER](event) { + const keyMap = keymap({ + Escape: handleEscapeFromCalendar + }); + keyMap(event); + } + }, + focusout: { + [DATE_PICKER_EXTERNAL_INPUT]() { + validateDateInput(this); + }, + [DATE_PICKER](event) { + if (!this.contains(event.relatedTarget)) { + hideCalendar(this); + } + } + }, + input: { + [DATE_PICKER_EXTERNAL_INPUT]() { + reconcileInputValues(this); + updateCalendarIfVisible(this); + } } -})), _defineProperty(_datePickerEvents, "keydown", (_keydown = {}, _defineProperty(_keydown, DATE_PICKER_EXTERNAL_INPUT, function (event) { - if (event.keyCode === ENTER_KEYCODE) { - validateDateInput(this); - } -}), _defineProperty(_keydown, CALENDAR_DATE, keymap({ - Up: handleUpFromDate, - ArrowUp: handleUpFromDate, - Down: handleDownFromDate, - ArrowDown: handleDownFromDate, - Left: handleLeftFromDate, - ArrowLeft: handleLeftFromDate, - Right: handleRightFromDate, - ArrowRight: handleRightFromDate, - Home: handleHomeFromDate, - End: handleEndFromDate, - PageDown: handlePageDownFromDate, - PageUp: handlePageUpFromDate, - "Shift+PageDown": handleShiftPageDownFromDate, - "Shift+PageUp": handleShiftPageUpFromDate, - Tab: datePickerTabEventHandler.tabAhead -})), _defineProperty(_keydown, CALENDAR_DATE_PICKER, keymap({ - Tab: datePickerTabEventHandler.tabAhead, - "Shift+Tab": datePickerTabEventHandler.tabBack -})), _defineProperty(_keydown, CALENDAR_MONTH, keymap({ - Up: handleUpFromMonth, - ArrowUp: handleUpFromMonth, - Down: handleDownFromMonth, - ArrowDown: handleDownFromMonth, - Left: handleLeftFromMonth, - ArrowLeft: handleLeftFromMonth, - Right: handleRightFromMonth, - ArrowRight: handleRightFromMonth, - Home: handleHomeFromMonth, - End: handleEndFromMonth, - PageDown: handlePageDownFromMonth, - PageUp: handlePageUpFromMonth -})), _defineProperty(_keydown, CALENDAR_MONTH_PICKER, keymap({ - Tab: monthPickerTabEventHandler.tabAhead, - "Shift+Tab": monthPickerTabEventHandler.tabBack -})), _defineProperty(_keydown, CALENDAR_YEAR, keymap({ - Up: handleUpFromYear, - ArrowUp: handleUpFromYear, - Down: handleDownFromYear, - ArrowDown: handleDownFromYear, - Left: handleLeftFromYear, - ArrowLeft: handleLeftFromYear, - Right: handleRightFromYear, - ArrowRight: handleRightFromYear, - Home: handleHomeFromYear, - End: handleEndFromYear, - PageDown: handlePageDownFromYear, - PageUp: handlePageUpFromYear -})), _defineProperty(_keydown, CALENDAR_YEAR_PICKER, keymap({ - Tab: yearPickerTabEventHandler.tabAhead, - "Shift+Tab": yearPickerTabEventHandler.tabBack -})), _defineProperty(_keydown, DATE_PICKER_CALENDAR, function (event) { - this.dataset.keydownKeyCode = event.keyCode; -}), _defineProperty(_keydown, DATE_PICKER, function (event) { - var keyMap = keymap({ - Escape: handleEscapeFromCalendar - }); - keyMap(event); -}), _keydown)), _defineProperty(_datePickerEvents, "focusout", (_focusout = {}, _defineProperty(_focusout, DATE_PICKER_EXTERNAL_INPUT, function () { - validateDateInput(this); -}), _defineProperty(_focusout, DATE_PICKER, function (event) { - if (!this.contains(event.relatedTarget)) { - hideCalendar(this); - } -}), _focusout)), _defineProperty(_datePickerEvents, "input", _defineProperty({}, DATE_PICKER_EXTERNAL_INPUT, function () { - reconcileInputValues(this); - updateCalendarIfVisible(this); -})), _datePickerEvents); - +}; if (!isIosDevice()) { - var _datePickerEvents$mou; - - datePickerEvents.mouseover = (_datePickerEvents$mou = {}, _defineProperty(_datePickerEvents$mou, CALENDAR_DATE_CURRENT_MONTH, function () { - handleMouseoverFromDate(this); - }), _defineProperty(_datePickerEvents$mou, CALENDAR_MONTH, function () { - handleMouseoverFromMonth(this); - }), _defineProperty(_datePickerEvents$mou, CALENDAR_YEAR, function () { - handleMouseoverFromYear(this); - }), _datePickerEvents$mou); + datePickerEvents.mouseover = { + [CALENDAR_DATE_CURRENT_MONTH]() { + handleMouseoverFromDate(this); + }, + [CALENDAR_MONTH]() { + handleMouseoverFromMonth(this); + }, + [CALENDAR_YEAR]() { + handleMouseoverFromYear(this); + } + }; } - -var datePicker = behavior(datePickerEvents, { - init: function init(root) { - selectOrMatches(DATE_PICKER, root).forEach(function (datePickerEl) { +const datePicker = behavior(datePickerEvents, { + init(root) { + selectOrMatches(DATE_PICKER, root).forEach(datePickerEl => { enhanceDatePicker(datePickerEl); }); }, - getDatePickerContext: getDatePickerContext, - disable: disable, - enable: enable, - isDateInputInvalid: isDateInputInvalid, - setCalendarValue: setCalendarValue, - validateDateInput: validateDateInput, - renderCalendar: renderCalendar, - updateCalendarIfVisible: updateCalendarIfVisible -}); // #endregion Date Picker Event Delegation Registration / Component + getDatePickerContext, + disable, + ariaDisable, + enable, + isDateInputInvalid, + setCalendarValue, + validateDateInput, + renderCalendar, + updateCalendarIfVisible +}); + +// #endregion Date Picker Event Delegation Registration / Component module.exports = datePicker; -},{"../../uswds-core/src/js/config":33,"../../uswds-core/src/js/events":34,"../../uswds-core/src/js/utils/active-element":42,"../../uswds-core/src/js/utils/behavior":43,"../../uswds-core/src/js/utils/is-ios-device":46,"../../uswds-core/src/js/utils/sanitizer":47,"../../uswds-core/src/js/utils/select":50,"../../uswds-core/src/js/utils/select-or-matches":49,"receptor/keymap":12}],21:[function(require,module,exports){ +},{"../../uswds-core/src/js/config":36,"../../uswds-core/src/js/events":37,"../../uswds-core/src/js/utils/active-element":45,"../../uswds-core/src/js/utils/behavior":46,"../../uswds-core/src/js/utils/is-ios-device":50,"../../uswds-core/src/js/utils/sanitizer":51,"../../uswds-core/src/js/utils/select":54,"../../uswds-core/src/js/utils/select-or-matches":53,"receptor/keymap":11}],21:[function(require,module,exports){ "use strict"; -var _inputChange; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } +const behavior = require("../../uswds-core/src/js/utils/behavior"); +const select = require("../../uswds-core/src/js/utils/select"); +const selectOrMatches = require("../../uswds-core/src/js/utils/select-or-matches"); +const { + prefix: PREFIX +} = require("../../uswds-core/src/js/config"); +const { + getDatePickerContext, + isDateInputInvalid, + updateCalendarIfVisible +} = require("../../usa-date-picker/src/index"); +const DATE_PICKER_CLASS = `${PREFIX}-date-picker`; +const DATE_RANGE_PICKER_CLASS = `${PREFIX}-date-range-picker`; +const DATE_RANGE_PICKER_RANGE_START_CLASS = `${DATE_RANGE_PICKER_CLASS}__range-start`; +const DATE_RANGE_PICKER_RANGE_END_CLASS = `${DATE_RANGE_PICKER_CLASS}__range-end`; +const DATE_PICKER = `.${DATE_PICKER_CLASS}`; +const DATE_RANGE_PICKER = `.${DATE_RANGE_PICKER_CLASS}`; +const DATE_RANGE_PICKER_RANGE_START = `.${DATE_RANGE_PICKER_RANGE_START_CLASS}`; +const DATE_RANGE_PICKER_RANGE_END = `.${DATE_RANGE_PICKER_RANGE_END_CLASS}`; +const DEFAULT_MIN_DATE = "0000-01-01"; -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -var behavior = require("../../uswds-core/src/js/utils/behavior"); - -var select = require("../../uswds-core/src/js/utils/select"); - -var selectOrMatches = require("../../uswds-core/src/js/utils/select-or-matches"); - -var _require = require("../../uswds-core/src/js/config"), - PREFIX = _require.prefix; - -var _require2 = require("../../usa-date-picker/src/index"), - getDatePickerContext = _require2.getDatePickerContext, - isDateInputInvalid = _require2.isDateInputInvalid, - updateCalendarIfVisible = _require2.updateCalendarIfVisible; - -var DATE_PICKER_CLASS = "".concat(PREFIX, "-date-picker"); -var DATE_RANGE_PICKER_CLASS = "".concat(PREFIX, "-date-range-picker"); -var DATE_RANGE_PICKER_RANGE_START_CLASS = "".concat(DATE_RANGE_PICKER_CLASS, "__range-start"); -var DATE_RANGE_PICKER_RANGE_END_CLASS = "".concat(DATE_RANGE_PICKER_CLASS, "__range-end"); -var DATE_PICKER = ".".concat(DATE_PICKER_CLASS); -var DATE_RANGE_PICKER = ".".concat(DATE_RANGE_PICKER_CLASS); -var DATE_RANGE_PICKER_RANGE_START = ".".concat(DATE_RANGE_PICKER_RANGE_START_CLASS); -var DATE_RANGE_PICKER_RANGE_END = ".".concat(DATE_RANGE_PICKER_RANGE_END_CLASS); -var DEFAULT_MIN_DATE = "0000-01-01"; /** * The properties and elements within the date range picker. * @typedef {Object} DateRangePickerContext @@ -4138,40 +3871,35 @@ var DEFAULT_MIN_DATE = "0000-01-01"; * @param {HTMLElement} el the element within the date picker * @returns {DateRangePickerContext} elements */ - -var getDateRangePickerContext = function getDateRangePickerContext(el) { - var dateRangePickerEl = el.closest(DATE_RANGE_PICKER); - +const getDateRangePickerContext = el => { + const dateRangePickerEl = el.closest(DATE_RANGE_PICKER); if (!dateRangePickerEl) { - throw new Error("Element is missing outer ".concat(DATE_RANGE_PICKER)); + throw new Error(`Element is missing outer ${DATE_RANGE_PICKER}`); } - - var rangeStartEl = dateRangePickerEl.querySelector(DATE_RANGE_PICKER_RANGE_START); - var rangeEndEl = dateRangePickerEl.querySelector(DATE_RANGE_PICKER_RANGE_END); + const rangeStartEl = dateRangePickerEl.querySelector(DATE_RANGE_PICKER_RANGE_START); + const rangeEndEl = dateRangePickerEl.querySelector(DATE_RANGE_PICKER_RANGE_END); return { - dateRangePickerEl: dateRangePickerEl, - rangeStartEl: rangeStartEl, - rangeEndEl: rangeEndEl + dateRangePickerEl, + rangeStartEl, + rangeEndEl }; }; + /** * handle update from range start date picker * * @param {HTMLElement} el an element within the date range picker */ - - -var handleRangeStartUpdate = function handleRangeStartUpdate(el) { - var _getDateRangePickerCo = getDateRangePickerContext(el), - dateRangePickerEl = _getDateRangePickerCo.dateRangePickerEl, - rangeStartEl = _getDateRangePickerCo.rangeStartEl, - rangeEndEl = _getDateRangePickerCo.rangeEndEl; - - var _getDatePickerContext = getDatePickerContext(rangeStartEl), - internalInputEl = _getDatePickerContext.internalInputEl; - - var updatedDate = internalInputEl.value; - +const handleRangeStartUpdate = el => { + const { + dateRangePickerEl, + rangeStartEl, + rangeEndEl + } = getDateRangePickerContext(el); + const { + internalInputEl + } = getDatePickerContext(rangeStartEl); + const updatedDate = internalInputEl.value; if (updatedDate && !isDateInputInvalid(internalInputEl)) { rangeEndEl.dataset.minDate = updatedDate; rangeEndEl.dataset.rangeDate = updatedDate; @@ -4181,27 +3909,24 @@ var handleRangeStartUpdate = function handleRangeStartUpdate(el) { rangeEndEl.dataset.rangeDate = ""; rangeEndEl.dataset.defaultDate = ""; } - updateCalendarIfVisible(rangeEndEl); }; + /** * handle update from range start date picker * * @param {HTMLElement} el an element within the date range picker */ - - -var handleRangeEndUpdate = function handleRangeEndUpdate(el) { - var _getDateRangePickerCo2 = getDateRangePickerContext(el), - dateRangePickerEl = _getDateRangePickerCo2.dateRangePickerEl, - rangeStartEl = _getDateRangePickerCo2.rangeStartEl, - rangeEndEl = _getDateRangePickerCo2.rangeEndEl; - - var _getDatePickerContext2 = getDatePickerContext(rangeEndEl), - internalInputEl = _getDatePickerContext2.internalInputEl; - - var updatedDate = internalInputEl.value; - +const handleRangeEndUpdate = el => { + const { + dateRangePickerEl, + rangeStartEl, + rangeEndEl + } = getDateRangePickerContext(el); + const { + internalInputEl + } = getDatePickerContext(rangeEndEl); + const updatedDate = internalInputEl.value; if (updatedDate && !isDateInputInvalid(internalInputEl)) { rangeStartEl.dataset.maxDate = updatedDate; rangeStartEl.dataset.rangeDate = updatedDate; @@ -4211,109 +3936,97 @@ var handleRangeEndUpdate = function handleRangeEndUpdate(el) { rangeStartEl.dataset.rangeDate = ""; rangeStartEl.dataset.defaultDate = ""; } - updateCalendarIfVisible(rangeStartEl); }; + /** * Enhance an input with the date picker elements * * @param {HTMLElement} el The initial wrapping element of the date range picker component */ - - -var enhanceDateRangePicker = function enhanceDateRangePicker(el) { - var dateRangePickerEl = el.closest(DATE_RANGE_PICKER); - - var _select = select(DATE_PICKER, dateRangePickerEl), - _select2 = _slicedToArray(_select, 2), - rangeStart = _select2[0], - rangeEnd = _select2[1]; - +const enhanceDateRangePicker = el => { + const dateRangePickerEl = el.closest(DATE_RANGE_PICKER); + const [rangeStart, rangeEnd] = select(DATE_PICKER, dateRangePickerEl); if (!rangeStart) { - throw new Error("".concat(DATE_RANGE_PICKER, " is missing inner two '").concat(DATE_PICKER, "' elements")); + throw new Error(`${DATE_RANGE_PICKER} is missing inner two '${DATE_PICKER}' elements`); } - if (!rangeEnd) { - throw new Error("".concat(DATE_RANGE_PICKER, " is missing second '").concat(DATE_PICKER, "' element")); + throw new Error(`${DATE_RANGE_PICKER} is missing second '${DATE_PICKER}' element`); } - rangeStart.classList.add(DATE_RANGE_PICKER_RANGE_START_CLASS); rangeEnd.classList.add(DATE_RANGE_PICKER_RANGE_END_CLASS); - if (!dateRangePickerEl.dataset.minDate) { dateRangePickerEl.dataset.minDate = DEFAULT_MIN_DATE; } - - var minDate = dateRangePickerEl.dataset.minDate; + const { + minDate + } = dateRangePickerEl.dataset; rangeStart.dataset.minDate = minDate; rangeEnd.dataset.minDate = minDate; - var maxDate = dateRangePickerEl.dataset.maxDate; - + const { + maxDate + } = dateRangePickerEl.dataset; if (maxDate) { rangeStart.dataset.maxDate = maxDate; rangeEnd.dataset.maxDate = maxDate; } - handleRangeStartUpdate(dateRangePickerEl); handleRangeEndUpdate(dateRangePickerEl); }; - -var dateRangePicker = behavior({ - "input change": (_inputChange = {}, _defineProperty(_inputChange, DATE_RANGE_PICKER_RANGE_START, function () { - handleRangeStartUpdate(this); - }), _defineProperty(_inputChange, DATE_RANGE_PICKER_RANGE_END, function () { - handleRangeEndUpdate(this); - }), _inputChange) +const dateRangePicker = behavior({ + "input change": { + [DATE_RANGE_PICKER_RANGE_START]() { + handleRangeStartUpdate(this); + }, + [DATE_RANGE_PICKER_RANGE_END]() { + handleRangeEndUpdate(this); + } + } }, { - init: function init(root) { - selectOrMatches(DATE_RANGE_PICKER, root).forEach(function (dateRangePickerEl) { + init(root) { + selectOrMatches(DATE_RANGE_PICKER, root).forEach(dateRangePickerEl => { enhanceDateRangePicker(dateRangePickerEl); }); } }); module.exports = dateRangePicker; -},{"../../usa-date-picker/src/index":20,"../../uswds-core/src/js/config":33,"../../uswds-core/src/js/utils/behavior":43,"../../uswds-core/src/js/utils/select":50,"../../uswds-core/src/js/utils/select-or-matches":49}],22:[function(require,module,exports){ +},{"../../usa-date-picker/src/index":20,"../../uswds-core/src/js/config":36,"../../uswds-core/src/js/utils/behavior":46,"../../uswds-core/src/js/utils/select":54,"../../uswds-core/src/js/utils/select-or-matches":53}],22:[function(require,module,exports){ "use strict"; -var _templateObject, _templateObject2, _templateObject3, _templateObject4; - -function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } - -var selectOrMatches = require("../../uswds-core/src/js/utils/select-or-matches"); - -var behavior = require("../../uswds-core/src/js/utils/behavior"); - -var Sanitizer = require("../../uswds-core/src/js/utils/sanitizer"); - -var _require = require("../../uswds-core/src/js/config"), - PREFIX = _require.prefix; - -var DROPZONE_CLASS = "".concat(PREFIX, "-file-input"); -var DROPZONE = ".".concat(DROPZONE_CLASS); -var INPUT_CLASS = "".concat(PREFIX, "-file-input__input"); -var TARGET_CLASS = "".concat(PREFIX, "-file-input__target"); -var INPUT = ".".concat(INPUT_CLASS); -var BOX_CLASS = "".concat(PREFIX, "-file-input__box"); -var INSTRUCTIONS_CLASS = "".concat(PREFIX, "-file-input__instructions"); -var PREVIEW_CLASS = "".concat(PREFIX, "-file-input__preview"); -var PREVIEW_HEADING_CLASS = "".concat(PREFIX, "-file-input__preview-heading"); -var DISABLED_CLASS = "".concat(PREFIX, "-file-input--disabled"); -var CHOOSE_CLASS = "".concat(PREFIX, "-file-input__choose"); -var ACCEPTED_FILE_MESSAGE_CLASS = "".concat(PREFIX, "-file-input__accepted-files-message"); -var DRAG_TEXT_CLASS = "".concat(PREFIX, "-file-input__drag-text"); -var DRAG_CLASS = "".concat(PREFIX, "-file-input--drag"); -var LOADING_CLASS = "is-loading"; -var HIDDEN_CLASS = "display-none"; -var INVALID_FILE_CLASS = "has-invalid-file"; -var GENERIC_PREVIEW_CLASS_NAME = "".concat(PREFIX, "-file-input__preview-image"); -var GENERIC_PREVIEW_CLASS = "".concat(GENERIC_PREVIEW_CLASS_NAME, "--generic"); -var PDF_PREVIEW_CLASS = "".concat(GENERIC_PREVIEW_CLASS_NAME, "--pdf"); -var WORD_PREVIEW_CLASS = "".concat(GENERIC_PREVIEW_CLASS_NAME, "--word"); -var VIDEO_PREVIEW_CLASS = "".concat(GENERIC_PREVIEW_CLASS_NAME, "--video"); -var EXCEL_PREVIEW_CLASS = "".concat(GENERIC_PREVIEW_CLASS_NAME, "--excel"); -var SPACER_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"; -var TYPE_IS_VALID = Boolean(true); // logic gate for change listener +const selectOrMatches = require("../../uswds-core/src/js/utils/select-or-matches"); +const behavior = require("../../uswds-core/src/js/utils/behavior"); +const Sanitizer = require("../../uswds-core/src/js/utils/sanitizer"); +const { + prefix: PREFIX +} = require("../../uswds-core/src/js/config"); +const DROPZONE_CLASS = `${PREFIX}-file-input`; +const DROPZONE = `.${DROPZONE_CLASS}`; +const INPUT_CLASS = `${PREFIX}-file-input__input`; +const TARGET_CLASS = `${PREFIX}-file-input__target`; +const INPUT = `.${INPUT_CLASS}`; +const BOX_CLASS = `${PREFIX}-file-input__box`; +const INSTRUCTIONS_CLASS = `${PREFIX}-file-input__instructions`; +const PREVIEW_CLASS = `${PREFIX}-file-input__preview`; +const PREVIEW_HEADING_CLASS = `${PREFIX}-file-input__preview-heading`; +const DISABLED_CLASS = `${PREFIX}-file-input--disabled`; +const CHOOSE_CLASS = `${PREFIX}-file-input__choose`; +const ACCEPTED_FILE_MESSAGE_CLASS = `${PREFIX}-file-input__accepted-files-message`; +const DRAG_TEXT_CLASS = `${PREFIX}-file-input__drag-text`; +const DRAG_CLASS = `${PREFIX}-file-input--drag`; +const LOADING_CLASS = "is-loading"; +const INVALID_FILE_CLASS = "has-invalid-file"; +const GENERIC_PREVIEW_CLASS_NAME = `${PREFIX}-file-input__preview-image`; +const GENERIC_PREVIEW_CLASS = `${GENERIC_PREVIEW_CLASS_NAME}--generic`; +const PDF_PREVIEW_CLASS = `${GENERIC_PREVIEW_CLASS_NAME}--pdf`; +const WORD_PREVIEW_CLASS = `${GENERIC_PREVIEW_CLASS_NAME}--word`; +const VIDEO_PREVIEW_CLASS = `${GENERIC_PREVIEW_CLASS_NAME}--video`; +const EXCEL_PREVIEW_CLASS = `${GENERIC_PREVIEW_CLASS_NAME}--excel`; +const SR_ONLY_CLASS = `${PREFIX}-sr-only`; +const SPACER_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"; +let TYPE_IS_VALID = Boolean(true); // logic gate for change listener +let DEFAULT_ARIA_LABEL_TEXT = ""; +let DEFAULT_FILE_STATUS_TEXT = ""; /** * The properties and elements within the file input. @@ -4329,281 +4042,380 @@ var TYPE_IS_VALID = Boolean(true); // logic gate for change listener * @param {HTMLElement} el the element within the file input * @returns {FileInputContext} elements */ - -var getFileInputContext = function getFileInputContext(el) { - var dropZoneEl = el.closest(DROPZONE); - +const getFileInputContext = el => { + const dropZoneEl = el.closest(DROPZONE); if (!dropZoneEl) { - throw new Error("Element is missing outer ".concat(DROPZONE)); + throw new Error(`Element is missing outer ${DROPZONE}`); } - - var inputEl = dropZoneEl.querySelector(INPUT); + const inputEl = dropZoneEl.querySelector(INPUT); return { - dropZoneEl: dropZoneEl, - inputEl: inputEl + dropZoneEl, + inputEl }; }; + /** * Disable the file input component * * @param {HTMLElement} el An element within the file input component */ - - -var disable = function disable(el) { - var _getFileInputContext = getFileInputContext(el), - dropZoneEl = _getFileInputContext.dropZoneEl, - inputEl = _getFileInputContext.inputEl; - +const disable = el => { + const { + dropZoneEl, + inputEl + } = getFileInputContext(el); inputEl.disabled = true; dropZoneEl.classList.add(DISABLED_CLASS); - dropZoneEl.setAttribute("aria-disabled", "true"); }; + /** - * Enable the file input component + * Set aria-disabled attribute to file input component * * @param {HTMLElement} el An element within the file input component */ +const ariaDisable = el => { + const { + dropZoneEl + } = getFileInputContext(el); + dropZoneEl.classList.add(DISABLED_CLASS); +}; - -var enable = function enable(el) { - var _getFileInputContext2 = getFileInputContext(el), - dropZoneEl = _getFileInputContext2.dropZoneEl, - inputEl = _getFileInputContext2.inputEl; - +/** + * Enable the file input component + * + * @param {HTMLElement} el An element within the file input component + */ +const enable = el => { + const { + dropZoneEl, + inputEl + } = getFileInputContext(el); inputEl.disabled = false; dropZoneEl.classList.remove(DISABLED_CLASS); dropZoneEl.removeAttribute("aria-disabled"); }; + /** * * @param {String} s special characters * @returns {String} replaces specified values */ - - -var replaceName = function replaceName(s) { - var c = s.charCodeAt(0); +const replaceName = s => { + const c = s.charCodeAt(0); if (c === 32) return "-"; - if (c >= 65 && c <= 90) return "img_".concat(s.toLowerCase()); - return "__".concat(("000", c.toString(16)).slice(-4)); + if (c >= 65 && c <= 90) return `img_${s.toLowerCase()}`; + return `__${("000", c.toString(16)).slice(-4)}`; }; + /** * Creates an ID name for each file that strips all invalid characters. * @param {String} name - name of the file added to file input (searchvalue) * @returns {String} same characters as the name with invalid chars removed (newvalue) */ +const makeSafeForID = name => name.replace(/[^a-z0-9]/g, replaceName); +// Takes a generated safe ID and creates a unique ID. +const createUniqueID = name => `${name}-${Math.floor(Date.now().toString() / 1000)}`; -var makeSafeForID = function makeSafeForID(name) { - return name.replace(/[^a-z0-9]/g, replaceName); -}; // Takes a generated safe ID and creates a unique ID. - - -var createUniqueID = function createUniqueID(name) { - return "".concat(name, "-").concat(Math.floor(Date.now().toString() / 1000)); -}; /** - * Builds full file input component - * @param {HTMLElement} fileInputEl - original file input on page - * @returns {HTMLElement|HTMLElement} - Instructions, target area div + * Determines if the singular or plural item label should be used + * Determination is based on the presence of the `multiple` attribute + * + * @param {HTMLInputElement} fileInputEl - The input element. + * @returns {HTMLDivElement} The singular or plural version of "item" */ +const getItemsLabel = fileInputEl => { + const acceptsMultiple = fileInputEl.hasAttribute("multiple"); + const itemsLabel = acceptsMultiple ? "files" : "file"; + return itemsLabel; +}; +/** + * Scaffold the file input component with a parent wrapper and + * Create a target area overlay for drag and drop functionality + * + * @param {HTMLInputElement} fileInputEl - The input element. + * @returns {HTMLDivElement} The drag and drop target area. + */ +const createTargetArea = fileInputEl => { + const fileInputParent = document.createElement("div"); + const dropTarget = document.createElement("div"); + const box = document.createElement("div"); -var buildFileInput = function buildFileInput(fileInputEl) { - var acceptsMultiple = fileInputEl.hasAttribute("multiple"); - var fileInputParent = document.createElement("div"); - var dropTarget = document.createElement("div"); - var box = document.createElement("div"); - var instructions = document.createElement("div"); - var disabled = fileInputEl.hasAttribute("disabled"); - var defaultAriaLabel; // Adds class names and other attributes - + // Adds class names and other attributes fileInputEl.classList.remove(DROPZONE_CLASS); fileInputEl.classList.add(INPUT_CLASS); fileInputParent.classList.add(DROPZONE_CLASS); box.classList.add(BOX_CLASS); - instructions.classList.add(INSTRUCTIONS_CLASS); - instructions.setAttribute("aria-hidden", "true"); - dropTarget.classList.add(TARGET_CLASS); // Encourage screenreader to read out aria changes immediately following upload status change - - fileInputEl.setAttribute("aria-live", "polite"); // Adds child elements to the DOM + dropTarget.classList.add(TARGET_CLASS); + // Adds child elements to the DOM + dropTarget.prepend(box); fileInputEl.parentNode.insertBefore(dropTarget, fileInputEl); fileInputEl.parentNode.insertBefore(fileInputParent, dropTarget); dropTarget.appendChild(fileInputEl); fileInputParent.appendChild(dropTarget); - fileInputEl.parentNode.insertBefore(instructions, fileInputEl); - fileInputEl.parentNode.insertBefore(box, fileInputEl); // Disabled styling + return dropTarget; +}; - if (disabled) { - disable(fileInputEl); - } // Sets instruction test and aria-label based on whether or not multiple files are accepted +/** + * Build the visible element with default interaction instructions. + * + * @param {HTMLInputElement} fileInputEl - The input element. + * @returns {HTMLDivElement} The container for visible interaction instructions. + */ +const createVisibleInstructions = fileInputEl => { + const fileInputParent = fileInputEl.closest(DROPZONE); + const itemsLabel = getItemsLabel(fileInputEl); + const instructions = document.createElement("div"); + const dragText = `Drag ${itemsLabel} here or`; + const chooseText = "choose from folder"; + // Create instructions text for aria-label + DEFAULT_ARIA_LABEL_TEXT = `${dragText} ${chooseText}`; - if (acceptsMultiple) { - defaultAriaLabel = "No files selected"; - instructions.innerHTML = Sanitizer.escapeHTML(_templateObject || (_templateObject = _taggedTemplateLiteral(["Drag files here or choose from folder"])), DRAG_TEXT_CLASS, CHOOSE_CLASS); - fileInputEl.setAttribute("aria-label", defaultAriaLabel); - fileInputEl.setAttribute("data-default-aria-label", defaultAriaLabel); - } else { - defaultAriaLabel = "No file selected"; - instructions.innerHTML = Sanitizer.escapeHTML(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["Drag file here or choose from folder"])), DRAG_TEXT_CLASS, CHOOSE_CLASS); - fileInputEl.setAttribute("aria-label", defaultAriaLabel); - fileInputEl.setAttribute("data-default-aria-label", defaultAriaLabel); - } // IE11 and Edge do not support drop files on file inputs, so we've removed text that indicates that + // Adds class names and other attributes + instructions.classList.add(INSTRUCTIONS_CLASS); + instructions.setAttribute("aria-hidden", "true"); + + // Add initial instructions for input usage + fileInputEl.setAttribute("aria-label", DEFAULT_ARIA_LABEL_TEXT); + instructions.innerHTML = Sanitizer.escapeHTML`${dragText} ${chooseText}`; + // Add the instructions element to the DOM + fileInputEl.parentNode.insertBefore(instructions, fileInputEl); + // IE11 and Edge do not support drop files on file inputs, so we've removed text that indicates that if (/rv:11.0/i.test(navigator.userAgent) || /Edge\/\d./i.test(navigator.userAgent)) { - fileInputParent.querySelector(".".concat(DRAG_TEXT_CLASS)).outerHTML = ""; + fileInputParent.querySelector(`.${DRAG_TEXT_CLASS}`).outerHTML = ""; } + return instructions; +}; + +/** + * Build a screen reader-only message element that contains file status updates and + * Create and set the default file status message + * + * @param {HTMLInputElement} fileInputEl - The input element. + */ +const createSROnlyStatus = fileInputEl => { + const statusEl = document.createElement("div"); + const itemsLabel = getItemsLabel(fileInputEl); + const fileInputParent = fileInputEl.closest(DROPZONE); + const fileInputTarget = fileInputEl.closest(`.${TARGET_CLASS}`); + DEFAULT_FILE_STATUS_TEXT = `No ${itemsLabel} selected.`; + // Adds class names and other attributes + statusEl.classList.add(SR_ONLY_CLASS); + statusEl.setAttribute("aria-live", "polite"); + + // Add initial file status message + statusEl.textContent = DEFAULT_FILE_STATUS_TEXT; + + // Add the status element to the DOM + fileInputParent.insertBefore(statusEl, fileInputTarget); +}; + +/** + * Scaffold the component with all required elements + * + * @param {HTMLInputElement} fileInputEl - The original input element. + */ +const enhanceFileInput = fileInputEl => { + const isInputDisabled = fileInputEl.hasAttribute("aria-disabled") || fileInputEl.hasAttribute("disabled"); + const dropTarget = createTargetArea(fileInputEl); + const instructions = createVisibleInstructions(fileInputEl); + const { + dropZoneEl + } = getFileInputContext(fileInputEl); + if (isInputDisabled) { + dropZoneEl.classList.add(DISABLED_CLASS); + } else { + createSROnlyStatus(fileInputEl); + } return { - instructions: instructions, - dropTarget: dropTarget + instructions, + dropTarget }; }; + /** - * Removes image previews, we want to start with a clean list every time files are added to the file input - * @param {HTMLElement} dropTarget - target area div that encases the input - * @param {HTMLElement} instructions - text to inform users to drag or select files + * Removes image previews + * We want to start with a clean list every time files are added to the file input + * + * @param {HTMLDivElement} dropTarget - The drag and drop target area. + * @param {HTMLDivElement} instructions - The container for visible interaction instructions. */ +const removeOldPreviews = (dropTarget, instructions) => { + const filePreviews = dropTarget.querySelectorAll(`.${PREVIEW_CLASS}`); + const currentPreviewHeading = dropTarget.querySelector(`.${PREVIEW_HEADING_CLASS}`); + const currentErrorMessage = dropTarget.querySelector(`.${ACCEPTED_FILE_MESSAGE_CLASS}`); - -var removeOldPreviews = function removeOldPreviews(dropTarget, instructions, inputAriaLabel) { - var filePreviews = dropTarget.querySelectorAll(".".concat(PREVIEW_CLASS)); - var fileInputElement = dropTarget.querySelector(INPUT); - var currentPreviewHeading = dropTarget.querySelector(".".concat(PREVIEW_HEADING_CLASS)); - var currentErrorMessage = dropTarget.querySelector(".".concat(ACCEPTED_FILE_MESSAGE_CLASS)); /** * finds the parent of the passed node and removes the child * @param {HTMLElement} node */ - - var removeImages = function removeImages(node) { + const removeImages = node => { node.parentNode.removeChild(node); - }; // Remove the heading above the previews - + }; + // Remove the heading above the previews if (currentPreviewHeading) { currentPreviewHeading.outerHTML = ""; - } // Remove existing error messages - + } + // Remove existing error messages if (currentErrorMessage) { currentErrorMessage.outerHTML = ""; dropTarget.classList.remove(INVALID_FILE_CLASS); - } // Get rid of existing previews if they exist, show instructions - + } + // Get rid of existing previews if they exist, show instructions if (filePreviews !== null) { if (instructions) { - instructions.classList.remove(HIDDEN_CLASS); + instructions.removeAttribute("hidden"); } - - fileInputElement.setAttribute("aria-label", inputAriaLabel); Array.prototype.forEach.call(filePreviews, removeImages); } }; + /** - * When new files are applied to file input, this function generates previews - * and removes old ones. - * @param {event} e - * @param {HTMLElement} fileInputEl - file input element - * @param {HTMLElement} instructions - text to inform users to drag or select files - * @param {HTMLElement} dropTarget - target area div that encases the input + * Update the screen reader-only status message after interaction + * + * @param {HTMLDivElement} statusElement - The screen reader-only container for file status updates. + * @param {Object} fileNames - The selected files found in the fileList object. + * @param {Array} fileStore - The array of uploaded file names created from the fileNames object. */ +const updateStatusMessage = (statusElement, fileNames, fileStore) => { + const statusEl = statusElement; + let statusMessage = DEFAULT_FILE_STATUS_TEXT; + // If files added, update the status message with file name(s) + if (fileNames.length === 1) { + statusMessage = `You have selected the file: ${fileStore}`; + } else if (fileNames.length > 1) { + statusMessage = `You have selected ${fileNames.length} files: ${fileStore.join(", ")}`; + } -var handleChange = function handleChange(e, fileInputEl, instructions, dropTarget) { - var fileNames = e.target.files; - var filePreviewsHeading = document.createElement("div"); - var inputAriaLabel = fileInputEl.dataset.defaultAriaLabel; - var fileStore = []; // First, get rid of existing previews + // Add delay to encourage screen reader readout + setTimeout(() => { + statusEl.textContent = statusMessage; + }, 1000); +}; - removeOldPreviews(dropTarget, instructions, inputAriaLabel); // Then, iterate through files list and: - // 1. Add selected file list names to aria-label - // 2. Create previews +/** + * Show the preview heading, hide the initial instructions and + * Update the aria-label with new instructions text + * + * @param {HTMLInputElement} fileInputEl - The input element. + * @param {Object} fileNames - The selected files found in the fileList object. + */ +const addPreviewHeading = (fileInputEl, fileNames) => { + const filePreviewsHeading = document.createElement("div"); + const dropTarget = fileInputEl.closest(`.${TARGET_CLASS}`); + const instructions = dropTarget.querySelector(`.${INSTRUCTIONS_CLASS}`); + let changeItemText = "Change file"; + let previewHeadingText = ""; + if (fileNames.length === 1) { + previewHeadingText = Sanitizer.escapeHTML`Selected file ${changeItemText}`; + } else if (fileNames.length > 1) { + changeItemText = "Change files"; + previewHeadingText = Sanitizer.escapeHTML`${fileNames.length} files selected ${changeItemText}`; + } - var _loop = function _loop(i) { - var reader = new FileReader(); - var fileName = fileNames[i].name; // Push updated file names into the store array + // Hides null state content and sets preview heading + instructions.setAttribute("hidden", "true"); + filePreviewsHeading.classList.add(PREVIEW_HEADING_CLASS); + filePreviewsHeading.innerHTML = previewHeadingText; + dropTarget.insertBefore(filePreviewsHeading, instructions); - fileStore.push(fileName); // read out the store array via aria-label, wording options vary based on file count + // Update aria label to match the visible action text + fileInputEl.setAttribute("aria-label", changeItemText); +}; - if (i === 0) { - fileInputEl.setAttribute("aria-label", "You have selected the file: ".concat(fileName)); - } else if (i >= 1) { - fileInputEl.setAttribute("aria-label", "You have selected ".concat(fileNames.length, " files: ").concat(fileStore.join(", "))); - } // Starts with a loading image while preview is created +/** + * When new files are applied to file input, this function generates previews + * and removes old ones. + * + * @param {event} e + * @param {HTMLInputElement} fileInputEl - The input element. + * @param {HTMLDivElement} instructions - The container for visible interaction instructions. + * @param {HTMLDivElement} dropTarget - The drag and drop target area. + */ +const handleChange = (e, fileInputEl, instructions, dropTarget) => { + const fileNames = e.target.files; + const inputParent = dropTarget.closest(`.${DROPZONE_CLASS}`); + const statusElement = inputParent.querySelector(`.${SR_ONLY_CLASS}`); + const fileStore = []; - reader.onloadstart = function createLoadingImage() { - var imageId = createUniqueID(makeSafeForID(fileName)); - instructions.insertAdjacentHTML("afterend", Sanitizer.escapeHTML(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["
\n \"\"", "\n
"])), PREVIEW_CLASS, imageId, SPACER_GIF, GENERIC_PREVIEW_CLASS_NAME, LOADING_CLASS, fileName)); - }; // Not all files will be able to generate previews. In case this happens, we provide several types "generic previews" based on the file extension. + // First, get rid of existing previews + removeOldPreviews(dropTarget, instructions); + // Then, iterate through files list and create previews + for (let i = 0; i < fileNames.length; i += 1) { + const reader = new FileReader(); + const fileName = fileNames[i].name; + let imageId; - reader.onloadend = function createFilePreview() { - var imageId = createUniqueID(makeSafeForID(fileName)); - var previewImage = document.getElementById(imageId); + // Push updated file names into the store array + fileStore.push(fileName); + // Starts with a loading image while preview is created + reader.onloadstart = function createLoadingImage() { + imageId = createUniqueID(makeSafeForID(fileName)); + instructions.insertAdjacentHTML("afterend", Sanitizer.escapeHTML`