@ogds/elements 1.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/UswdsTheme.js +11 -0
- package/.storybook/blocks/SiteNote.jsx +5 -0
- package/.storybook/main.js +38 -0
- package/.storybook/manager.js +6 -0
- package/.storybook/preview.js +37 -0
- package/.storybook/test-runner.js +23 -0
- package/README.md +201 -0
- package/build/css/breakpoints.css +15 -0
- package/build/css/colors.css +490 -0
- package/build/css/spacing.css +16 -0
- package/build/scss/_breakpoints.scss +12 -0
- package/build/scss/_colors.scss +487 -0
- package/build/scss/_spacing.scss +13 -0
- package/dist/components/frameworks/react/OgdsAccordion.d.ts +69 -0
- package/dist/components/frameworks/react/OgdsAccordion.js +22 -0
- package/dist/components/frameworks/react/OgdsAccordionToggle.d.ts +60 -0
- package/dist/components/frameworks/react/OgdsAccordionToggle.js +23 -0
- package/dist/components/frameworks/react/UsaBanner.d.ts +82 -0
- package/dist/components/frameworks/react/UsaBanner.js +25 -0
- package/dist/components/frameworks/react/UsaLink.d.ts +60 -0
- package/dist/components/frameworks/react/UsaLink.js +21 -0
- package/dist/components/frameworks/react/index.d.ts +4 -0
- package/dist/components/frameworks/react/index.js +4 -0
- package/dist/components/frameworks/react/react-utils.js +34 -0
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +6 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/usa-banner/index.d.ts +82 -0
- package/dist/components/usa-banner/usa-banner.spec.d.ts +0 -0
- package/dist/components/usa-banner/usa-banner.stories.d.ts +95 -0
- package/dist/components/usa-banner.cjs +95 -0
- package/dist/components/usa-banner.cjs.map +1 -0
- package/dist/components/usa-banner.js +189 -0
- package/dist/components/usa-banner.js.map +1 -0
- package/dist/components/usa-header/index.d.ts +6 -0
- package/dist/components/usa-link/index.d.ts +30 -0
- package/dist/components/usa-link/usa-link.spec.d.ts +0 -0
- package/dist/components/usa-link.cjs +5 -0
- package/dist/components/usa-link.cjs.map +1 -0
- package/dist/components/usa-link.js +32 -0
- package/dist/components/usa-link.js.map +1 -0
- package/dist/core/OgdsElement.d.ts +3 -0
- package/dist/index-7kIMQwBw.cjs +1 -0
- package/dist/index-7kIMQwBw.cjs.map +1 -0
- package/dist/index-BrHk1-6T.js +10 -0
- package/dist/index-BrHk1-6T.js.map +1 -0
- package/dist/types/custom-element-jsx.d.ts +175 -0
- package/dist/types/custom-element-solidjs.d.ts +185 -0
- package/dist/types/custom-element-svelte.d.ts +157 -0
- package/dist/types/custom-element-vuejs.d.ts +127 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.test.d.ts +1 -0
- package/package.json +119 -0
- package/src/components/index.ts +5 -0
- package/src/components/ogds-accordion/.claude/settings.local.json +7 -0
- package/src/components/ogds-accordion/docs.mdx +90 -0
- package/src/components/ogds-accordion/index.ts +132 -0
- package/src/components/ogds-accordion/ogds-accordion.css +99 -0
- package/src/components/ogds-accordion/ogds-accordion.spec.ts +175 -0
- package/src/components/ogds-accordion/ogds-accordion.stories.ts +77 -0
- package/src/components/ogds-accordion-toggle/index.ts +80 -0
- package/src/components/usa-banner/docs.mdx +108 -0
- package/src/components/usa-banner/index.ts +290 -0
- package/src/components/usa-banner/usa-banner.css +511 -0
- package/src/components/usa-banner/usa-banner.spec.ts +76 -0
- package/src/components/usa-banner/usa-banner.stories.ts +136 -0
- package/src/components/usa-header/index.ts +50 -0
- package/src/components/usa-header/usa-header.css +1 -0
- package/src/components/usa-link/index.ts +66 -0
- package/src/components/usa-link/usa-link.css +24 -0
- package/src/components/usa-link/usa-link.spec.ts +50 -0
- package/src/core/colors.css +8 -0
- package/src/core/fonts.css +213 -0
- package/src/core/index.css +2 -0
- package/src/core/token-styles.ts +26 -0
- package/src/declaration.d.ts +75 -0
- package/src/shared/icons/accessibility_new.svg +1 -0
- package/src/shared/icons/accessible_forward.svg +1 -0
- package/src/shared/icons/account_balance.svg +1 -0
- package/src/shared/icons/account_box.svg +1 -0
- package/src/shared/icons/account_circle.svg +1 -0
- package/src/shared/icons/add.svg +1 -0
- package/src/shared/icons/add_circle.svg +1 -0
- package/src/shared/icons/add_circle_outline.svg +1 -0
- package/src/shared/icons/alarm.svg +1 -0
- package/src/shared/icons/alternate_email.svg +1 -0
- package/src/shared/icons/announcement.svg +1 -0
- package/src/shared/icons/api.svg +1 -0
- package/src/shared/icons/arrow_back.svg +1 -0
- package/src/shared/icons/arrow_downward.svg +1 -0
- package/src/shared/icons/arrow_drop_down.svg +1 -0
- package/src/shared/icons/arrow_drop_up.svg +1 -0
- package/src/shared/icons/arrow_forward.svg +1 -0
- package/src/shared/icons/arrow_upward.svg +1 -0
- package/src/shared/icons/assessment.svg +1 -0
- package/src/shared/icons/attach_file.svg +1 -0
- package/src/shared/icons/attach_money.svg +1 -0
- package/src/shared/icons/autorenew.svg +1 -0
- package/src/shared/icons/backpack.svg +1 -0
- package/src/shared/icons/bathtub.svg +1 -0
- package/src/shared/icons/bedding.svg +1 -0
- package/src/shared/icons/bookmark.svg +1 -0
- package/src/shared/icons/bug_report.svg +1 -0
- package/src/shared/icons/build.svg +1 -0
- package/src/shared/icons/calendar_today.svg +1 -0
- package/src/shared/icons/campaign.svg +1 -0
- package/src/shared/icons/camping.svg +1 -0
- package/src/shared/icons/cancel.svg +1 -0
- package/src/shared/icons/chat.svg +1 -0
- package/src/shared/icons/check.svg +1 -0
- package/src/shared/icons/check_box_outline_blank.svg +1 -0
- package/src/shared/icons/check_circle.svg +1 -0
- package/src/shared/icons/check_circle_outline.svg +1 -0
- package/src/shared/icons/checkroom.svg +1 -0
- package/src/shared/icons/chevron_left.svg +1 -0
- package/src/shared/icons/chevron_right.svg +1 -0
- package/src/shared/icons/clean_hands.svg +1 -0
- package/src/shared/icons/close.svg +1 -0
- package/src/shared/icons/closed_caption.svg +1 -0
- package/src/shared/icons/clothes.svg +1 -0
- package/src/shared/icons/cloud.svg +1 -0
- package/src/shared/icons/code.svg +1 -0
- package/src/shared/icons/comment.svg +1 -0
- package/src/shared/icons/connect_without_contact.svg +1 -0
- package/src/shared/icons/construction.svg +1 -0
- package/src/shared/icons/construction_worker.svg +1 -0
- package/src/shared/icons/contact_page.svg +1 -0
- package/src/shared/icons/content_copy.svg +1 -0
- package/src/shared/icons/coronavirus.svg +1 -0
- package/src/shared/icons/credit_card.svg +1 -0
- package/src/shared/icons/deck.svg +1 -0
- package/src/shared/icons/delete.svg +1 -0
- package/src/shared/icons/device_thermostat.svg +1 -0
- package/src/shared/icons/directions.svg +1 -0
- package/src/shared/icons/directions_bike.svg +1 -0
- package/src/shared/icons/directions_bus.svg +1 -0
- package/src/shared/icons/directions_car.svg +1 -0
- package/src/shared/icons/directions_walk.svg +1 -0
- package/src/shared/icons/do_not_disturb.svg +1 -0
- package/src/shared/icons/do_not_touch.svg +1 -0
- package/src/shared/icons/drag_handle.svg +1 -0
- package/src/shared/icons/eco.svg +1 -0
- package/src/shared/icons/edit.svg +1 -0
- package/src/shared/icons/electrical_services.svg +1 -0
- package/src/shared/icons/emoji_events.svg +1 -0
- package/src/shared/icons/error.svg +1 -0
- package/src/shared/icons/error_outline.svg +1 -0
- package/src/shared/icons/event.svg +1 -0
- package/src/shared/icons/expand_less.svg +1 -0
- package/src/shared/icons/expand_more.svg +1 -0
- package/src/shared/icons/facebook.svg +1 -0
- package/src/shared/icons/fast_forward.svg +1 -0
- package/src/shared/icons/fast_rewind.svg +1 -0
- package/src/shared/icons/favorite.svg +1 -0
- package/src/shared/icons/favorite_border.svg +1 -0
- package/src/shared/icons/fax.svg +1 -0
- package/src/shared/icons/file_download.svg +1 -0
- package/src/shared/icons/file_present.svg +1 -0
- package/src/shared/icons/file_upload.svg +1 -0
- package/src/shared/icons/filter_alt.svg +1 -0
- package/src/shared/icons/filter_list.svg +1 -0
- package/src/shared/icons/fingerprint.svg +1 -0
- package/src/shared/icons/first_page.svg +1 -0
- package/src/shared/icons/flag.svg +1 -0
- package/src/shared/icons/flickr.svg +1 -0
- package/src/shared/icons/flight.svg +1 -0
- package/src/shared/icons/flooding.svg +1 -0
- package/src/shared/icons/folder.svg +1 -0
- package/src/shared/icons/folder_open.svg +1 -0
- package/src/shared/icons/format_quote.svg +1 -0
- package/src/shared/icons/format_size.svg +1 -0
- package/src/shared/icons/forum.svg +1 -0
- package/src/shared/icons/github.svg +1 -0
- package/src/shared/icons/grid_view.svg +1 -0
- package/src/shared/icons/group_add.svg +1 -0
- package/src/shared/icons/groups.svg +1 -0
- package/src/shared/icons/hearing.svg +1 -0
- package/src/shared/icons/help.svg +1 -0
- package/src/shared/icons/help_outline.svg +1 -0
- package/src/shared/icons/highlight_off.svg +1 -0
- package/src/shared/icons/history.svg +1 -0
- package/src/shared/icons/home.svg +1 -0
- package/src/shared/icons/hospital.svg +1 -0
- package/src/shared/icons/hotel.svg +1 -0
- package/src/shared/icons/hourglass_empty.svg +1 -0
- package/src/shared/icons/hurricane.svg +1 -0
- package/src/shared/icons/identification.svg +1 -0
- package/src/shared/icons/image.svg +1 -0
- package/src/shared/icons/info.svg +1 -0
- package/src/shared/icons/info_outline.svg +1 -0
- package/src/shared/icons/insights.svg +1 -0
- package/src/shared/icons/instagram.svg +1 -0
- package/src/shared/icons/keyboard.svg +1 -0
- package/src/shared/icons/label.svg +1 -0
- package/src/shared/icons/language.svg +1 -0
- package/src/shared/icons/last_page.svg +1 -0
- package/src/shared/icons/launch.svg +1 -0
- package/src/shared/icons/lightbulb.svg +1 -0
- package/src/shared/icons/lightbulb_outline.svg +1 -0
- package/src/shared/icons/link.svg +1 -0
- package/src/shared/icons/link_off.svg +1 -0
- package/src/shared/icons/linkedin.svg +1 -0
- package/src/shared/icons/list.svg +1 -0
- package/src/shared/icons/local_cafe.svg +1 -0
- package/src/shared/icons/local_fire_department.svg +1 -0
- package/src/shared/icons/local_gas_station.svg +1 -0
- package/src/shared/icons/local_grocery_store.svg +1 -0
- package/src/shared/icons/local_hospital.svg +1 -0
- package/src/shared/icons/local_laundry_service.svg +1 -0
- package/src/shared/icons/local_library.svg +1 -0
- package/src/shared/icons/local_offer.svg +1 -0
- package/src/shared/icons/local_parking.svg +1 -0
- package/src/shared/icons/local_pharmacy.svg +1 -0
- package/src/shared/icons/local_police.svg +1 -0
- package/src/shared/icons/local_taxi.svg +1 -0
- package/src/shared/icons/location_city.svg +1 -0
- package/src/shared/icons/location_on.svg +1 -0
- package/src/shared/icons/lock.svg +1 -0
- package/src/shared/icons/lock_open.svg +1 -0
- package/src/shared/icons/lock_outline.svg +1 -0
- package/src/shared/icons/login.svg +1 -0
- package/src/shared/icons/logout.svg +1 -0
- package/src/shared/icons/loop.svg +1 -0
- package/src/shared/icons/mail.svg +1 -0
- package/src/shared/icons/mail_outline.svg +1 -0
- package/src/shared/icons/map.svg +1 -0
- package/src/shared/icons/masks.svg +1 -0
- package/src/shared/icons/medical_services.svg +1 -0
- package/src/shared/icons/menu.svg +1 -0
- package/src/shared/icons/military_tech.svg +1 -0
- package/src/shared/icons/more_horiz.svg +1 -0
- package/src/shared/icons/more_vert.svg +1 -0
- package/src/shared/icons/my_location.svg +1 -0
- package/src/shared/icons/navigate_before.svg +1 -0
- package/src/shared/icons/navigate_far_before.svg +1 -0
- package/src/shared/icons/navigate_far_next.svg +1 -0
- package/src/shared/icons/navigate_next.svg +1 -0
- package/src/shared/icons/near_me.svg +1 -0
- package/src/shared/icons/notifications.svg +1 -0
- package/src/shared/icons/notifications_active.svg +1 -0
- package/src/shared/icons/notifications_none.svg +1 -0
- package/src/shared/icons/notifications_off.svg +1 -0
- package/src/shared/icons/park.svg +1 -0
- package/src/shared/icons/people.svg +1 -0
- package/src/shared/icons/person.svg +1 -0
- package/src/shared/icons/pets.svg +1 -0
- package/src/shared/icons/phone.svg +1 -0
- package/src/shared/icons/photo_camera.svg +1 -0
- package/src/shared/icons/print.svg +1 -0
- package/src/shared/icons/priority_high.svg +1 -0
- package/src/shared/icons/public.svg +1 -0
- package/src/shared/icons/push_pin.svg +1 -0
- package/src/shared/icons/radio_button_unchecked.svg +1 -0
- package/src/shared/icons/rain.svg +1 -0
- package/src/shared/icons/reduce_capacity.svg +1 -0
- package/src/shared/icons/remove.svg +1 -0
- package/src/shared/icons/remove_circle.svg +1 -0
- package/src/shared/icons/report.svg +1 -0
- package/src/shared/icons/restaurant.svg +1 -0
- package/src/shared/icons/rss_feed.svg +1 -0
- package/src/shared/icons/safety_divider.svg +1 -0
- package/src/shared/icons/sanitizer.svg +1 -0
- package/src/shared/icons/save_alt.svg +1 -0
- package/src/shared/icons/schedule.svg +1 -0
- package/src/shared/icons/school.svg +1 -0
- package/src/shared/icons/science.svg +1 -0
- package/src/shared/icons/search.svg +1 -0
- package/src/shared/icons/security.svg +1 -0
- package/src/shared/icons/send.svg +1 -0
- package/src/shared/icons/sentiment_dissatisfied.svg +1 -0
- package/src/shared/icons/sentiment_neutral.svg +1 -0
- package/src/shared/icons/sentiment_satisfied.svg +1 -0
- package/src/shared/icons/sentiment_satisfied_alt.svg +1 -0
- package/src/shared/icons/sentiment_very_dissatisfied.svg +1 -0
- package/src/shared/icons/settings.svg +1 -0
- package/src/shared/icons/severe_weather.svg +1 -0
- package/src/shared/icons/share.svg +1 -0
- package/src/shared/icons/shield.svg +1 -0
- package/src/shared/icons/shopping_basket.svg +1 -0
- package/src/shared/icons/snow.svg +1 -0
- package/src/shared/icons/soap.svg +1 -0
- package/src/shared/icons/social_distance.svg +1 -0
- package/src/shared/icons/sort_arrow.svg +1 -0
- package/src/shared/icons/spellcheck.svg +1 -0
- package/src/shared/icons/star.svg +1 -0
- package/src/shared/icons/star_half.svg +1 -0
- package/src/shared/icons/star_outline.svg +1 -0
- package/src/shared/icons/store.svg +1 -0
- package/src/shared/icons/support.svg +1 -0
- package/src/shared/icons/support_agent.svg +1 -0
- package/src/shared/icons/text_fields.svg +1 -0
- package/src/shared/icons/thumb_down_alt.svg +1 -0
- package/src/shared/icons/thumb_up_alt.svg +1 -0
- package/src/shared/icons/timer.svg +1 -0
- package/src/shared/icons/toggle_off.svg +1 -0
- package/src/shared/icons/toggle_on.svg +1 -0
- package/src/shared/icons/topic.svg +1 -0
- package/src/shared/icons/tornado.svg +1 -0
- package/src/shared/icons/translate.svg +1 -0
- package/src/shared/icons/trending_down.svg +1 -0
- package/src/shared/icons/trending_up.svg +1 -0
- package/src/shared/icons/twitter.svg +1 -0
- package/src/shared/icons/undo.svg +1 -0
- package/src/shared/icons/unfold_less.svg +1 -0
- package/src/shared/icons/unfold_more.svg +1 -0
- package/src/shared/icons/update.svg +1 -0
- package/src/shared/icons/upload_file.svg +1 -0
- package/src/shared/icons/verified.svg +1 -0
- package/src/shared/icons/verified_user.svg +1 -0
- package/src/shared/icons/visibility.svg +1 -0
- package/src/shared/icons/visibility_off.svg +1 -0
- package/src/shared/icons/volume_off.svg +1 -0
- package/src/shared/icons/warning.svg +1 -0
- package/src/shared/icons/wash.svg +1 -0
- package/src/shared/icons/wifi.svg +1 -0
- package/src/shared/icons/work.svg +1 -0
- package/src/shared/icons/x.svg +1 -0
- package/src/shared/icons/youtube.svg +1 -0
- package/src/shared/icons/zoom_in.svg +1 -0
- package/src/shared/icons/zoom_out.svg +1 -0
- package/src/shared/icons/zoom_out_map.svg +1 -0
- package/src/utils/index.test.ts +34 -0
- package/src/utils/index.ts +8 -0
- package/src/vite-env.d.ts +17 -0
- package/storybook/contributing.mdx +115 -0
- package/storybook/framework-guidance.mdx +96 -0
- package/storybook/index.css +70 -0
- package/storybook/readme.mdx +6 -0
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
/** Component tokens */
|
|
3
|
+
--ogds-banner-background-color: var(--ogds-color-base-lightest, #f0f0f0);
|
|
4
|
+
--ogds-banner-button-close-background-color: var(
|
|
5
|
+
--ogds-color-base-lighter,
|
|
6
|
+
#dfe1e2
|
|
7
|
+
);
|
|
8
|
+
--ogds-banner-focus-outline-color: var(--ogds-color-blue-vivid-40, #2491ff);
|
|
9
|
+
--ogds-banner-font-family:
|
|
10
|
+
system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
|
|
11
|
+
Arial, sans-serif;
|
|
12
|
+
--ogds-banner-font-size-xs: 0.75rem;
|
|
13
|
+
--ogds-banner-font-size-sm: 0.875rem;
|
|
14
|
+
--ogds-banner-font-size-base: 0.94rem;
|
|
15
|
+
--ogds-banner-icon-gov-color: var(--ogds-color-blue-50, #2378c3);
|
|
16
|
+
--ogds-banner-icon-https-color: var(--ogds-color-green-vivid-40, #719f2a);
|
|
17
|
+
--ogds-banner-line-height-sm: 1.2;
|
|
18
|
+
--ogds-banner-line-height-base: 1.6;
|
|
19
|
+
--ogds-banner-link-color: var(--ogds-color-blue-vivid-60, #005ea2);
|
|
20
|
+
--ogds-banner-link-hover-color: var(--ogds-color-blue-warm-vivid-70, #1a4480);
|
|
21
|
+
--ogds-banner-max-width: var(--ogds-breakpoint-desktop);
|
|
22
|
+
--ogds-banner-text-color: var(--ogds-color-base-darkest, #1b1b1b);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Icons
|
|
26
|
+
* Note: icons that are part of the USWDS icon library and imported from
|
|
27
|
+
* svgs have their import and associated variables defined in the component's
|
|
28
|
+
* index.ts file where the `unsafeCSS` function is used to generate the appropriate
|
|
29
|
+
* data URI. The variable definition below is an exception since it is an ad-hoc
|
|
30
|
+
* icon that is not part of the USWDS icon library.
|
|
31
|
+
*/
|
|
32
|
+
--ogds-icon-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='52' height='64' viewBox='0 0 52 64' class='usa-banner__lock-image' role='img' aria-labelledby='banner-lock-description-default' focusable='false'%3E%3Ctitle id='banner-lock-title-default'%3ELock%3C/title%3E%3Cdesc id='banner-lock-description-default'%3ELocked padlock icon%3C/desc%3E%3Cpath fill='%23000000' fill-rule='evenodd' d='M26 0c10.493 0 19 8.507 19 19v9h3a4 4 0 0 1 4 4v28a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V32a4 4 0 0 1 4-4h3v-9C7 8.507 15.507 0 26 0zm0 8c-5.979 0-10.843 4.77-10.996 10.712L15 19v9h22v-9c0-6.075-4.925-11-11-11z'%3E%3C/path%3E%3C/svg%3E");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
* {
|
|
36
|
+
box-sizing: border-box;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
section {
|
|
40
|
+
background-color: var(--ogds-banner-background-color);
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
font-family: var(--ogds-banner-font-family);
|
|
43
|
+
font-size: var(--ogds-banner-font-size-xs);
|
|
44
|
+
text-align: start;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
section *,
|
|
48
|
+
section *::before,
|
|
49
|
+
section *::after {
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@media (width >= 40em) {
|
|
54
|
+
section {
|
|
55
|
+
font-size: var(--ogds-banner-font-size-xs);
|
|
56
|
+
padding-block-end: 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
section .usa-accordion {
|
|
61
|
+
font-family: inherit;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
section .grid-row {
|
|
65
|
+
display: grid;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* This creates a responsive grid where:
|
|
69
|
+
* - Columns auto-fit based on available space
|
|
70
|
+
* - Each column has a minimum width that's the smaller of 100% or half the tablet breakpoint (20rem)
|
|
71
|
+
* - Columns can grow to fill remaining space (1fr)
|
|
72
|
+
*/
|
|
73
|
+
grid-template-columns: repeat(
|
|
74
|
+
auto-fit,
|
|
75
|
+
minmax(min(100%, calc(var(--ogds-breakpoint-tablet) / 2)), 1fr)
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@media (width >= 40em) {
|
|
80
|
+
section .grid-row {
|
|
81
|
+
gap: var(--ogds-spacing-2);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@media (width >= 64em) {
|
|
86
|
+
section .grid-row {
|
|
87
|
+
gap: calc(var(--ogds-spacing-05) / 2);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.grid-col-auto {
|
|
92
|
+
flex: 0 1 auto;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.grid-col-fill {
|
|
96
|
+
flex: 1 1 0;
|
|
97
|
+
max-width: 100%;
|
|
98
|
+
min-width: 1px;
|
|
99
|
+
width: auto;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@media (width >= 40em) {
|
|
103
|
+
.tablet\:grid-col-auto {
|
|
104
|
+
flex: 0 1 auto;
|
|
105
|
+
max-width: 100%;
|
|
106
|
+
width: auto;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
section .tablet\:grid-col-6 {
|
|
111
|
+
flex: 0 0 auto;
|
|
112
|
+
gap: var(--ogds-spacing-1);
|
|
113
|
+
width: 100%;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
header,
|
|
117
|
+
.content {
|
|
118
|
+
color: var(--ogds-banner-text-color);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.content {
|
|
122
|
+
font-size: var(--ogds-banner-font-size-base);
|
|
123
|
+
line-height: var(--ogds-banner-line-height-base);
|
|
124
|
+
margin-inline: auto;
|
|
125
|
+
max-width: var(--ogds-banner-max-width);
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
padding-block-end: var(--ogds-spacing-2);
|
|
128
|
+
padding-block-start: var(--ogds-spacing-05);
|
|
129
|
+
padding-inline: var(--ogds-spacing-1);
|
|
130
|
+
width: 100%;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@media (width >= 40em) {
|
|
134
|
+
.content {
|
|
135
|
+
padding-block: var(--ogds-spacing-3);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@media (width >= 64em) {
|
|
140
|
+
.content {
|
|
141
|
+
padding-inline: var(--ogds-spacing-4);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.content p:first-child {
|
|
146
|
+
margin: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.inner {
|
|
150
|
+
align-items: flex-start;
|
|
151
|
+
display: flex;
|
|
152
|
+
flex-wrap: nowrap;
|
|
153
|
+
margin-inline: auto;
|
|
154
|
+
max-width: var(--ogds-banner-max-width);
|
|
155
|
+
padding-inline-end: var(--ogds-spacing-05);
|
|
156
|
+
padding-inline-start: var(--ogds-spacing-2);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@media (width >= 40em) {
|
|
160
|
+
.inner {
|
|
161
|
+
align-items: center;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@media (width >= 64em) {
|
|
166
|
+
.inner {
|
|
167
|
+
padding-inline: var(--ogds-spacing-4);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
header {
|
|
172
|
+
font-size: var(--ogds-banner-font-size-xs);
|
|
173
|
+
font-weight: 400;
|
|
174
|
+
min-height: var(--ogds-size-touch-target);
|
|
175
|
+
padding-block: var(--ogds-spacing-1);
|
|
176
|
+
position: relative;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
@media (width >= 40em) {
|
|
180
|
+
header {
|
|
181
|
+
min-height: 0;
|
|
182
|
+
padding-block: var(--ogds-spacing-05);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.header-text {
|
|
187
|
+
font-size: var(--ogds-banner-font-size-xs);
|
|
188
|
+
line-height: var(--ogds-banner-line-height-sm);
|
|
189
|
+
margin-block: 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.header-flag {
|
|
193
|
+
float: left;
|
|
194
|
+
margin-inline-end: var(--ogds-spacing-1);
|
|
195
|
+
padding-block-start: 0;
|
|
196
|
+
width: var(--ogds-spacing-2);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.header-action {
|
|
200
|
+
background: none;
|
|
201
|
+
border: none;
|
|
202
|
+
color: var(--ogds-banner-link-color);
|
|
203
|
+
cursor: pointer;
|
|
204
|
+
font: inherit;
|
|
205
|
+
line-height: var(--ogds-banner-line-height-sm);
|
|
206
|
+
margin-block-end: 0;
|
|
207
|
+
margin-block-start: 2px;
|
|
208
|
+
padding: 0;
|
|
209
|
+
text-decoration: underline;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.header-action:hover {
|
|
213
|
+
color: var(--ogds-banner-link-hover-color);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.header-action::after {
|
|
217
|
+
background-color: currentColor;
|
|
218
|
+
content: "";
|
|
219
|
+
display: inline-block;
|
|
220
|
+
height: 1rem;
|
|
221
|
+
mask-image: var(--ogds-icon-expand-more);
|
|
222
|
+
mask-position: center;
|
|
223
|
+
mask-repeat: no-repeat;
|
|
224
|
+
mask-size: 1rem 1rem;
|
|
225
|
+
vertical-align: middle;
|
|
226
|
+
width: 1rem;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.expanded .header-action {
|
|
230
|
+
display: none;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@media (width >= 40em) {
|
|
234
|
+
.header-action {
|
|
235
|
+
display: none;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
@media (forced-colors: active) {
|
|
240
|
+
.header-action {
|
|
241
|
+
color: LinkText;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.header-action::after {
|
|
245
|
+
background-color: ButtonText;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
header.expanded {
|
|
250
|
+
padding-inline-end: calc(
|
|
251
|
+
var(--ogds-size-touch-target) + var(--ogds-spacing-1)
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
@media (width >= 40em) {
|
|
256
|
+
header.expanded {
|
|
257
|
+
display: block;
|
|
258
|
+
font-size: var(--ogds-banner-font-size-sm);
|
|
259
|
+
font-weight: 400;
|
|
260
|
+
min-height: 0;
|
|
261
|
+
padding-inline-end: 0;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
header.expanded .inner {
|
|
266
|
+
margin-inline-start: 0;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
@media (width >= 40em) {
|
|
270
|
+
header.expanded .inner {
|
|
271
|
+
margin-inline-start: auto;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
header.expanded .header-action {
|
|
276
|
+
display: none;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
button {
|
|
280
|
+
background: none;
|
|
281
|
+
border: none;
|
|
282
|
+
bottom: 0;
|
|
283
|
+
color: var(--ogds-banner-link-color);
|
|
284
|
+
cursor: pointer;
|
|
285
|
+
display: block;
|
|
286
|
+
font: inherit;
|
|
287
|
+
font-size: var(--ogds-banner-font-size-xs);
|
|
288
|
+
height: auto;
|
|
289
|
+
left: 0;
|
|
290
|
+
line-height: var(--ogds-banner-line-height-sm);
|
|
291
|
+
outline: inherit;
|
|
292
|
+
padding: 0;
|
|
293
|
+
padding-block-start: 0;
|
|
294
|
+
padding-inline-start: 0;
|
|
295
|
+
position: absolute;
|
|
296
|
+
text-decoration: none;
|
|
297
|
+
top: 0;
|
|
298
|
+
width: auto;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
button:hover {
|
|
302
|
+
color: var(--ogds-banner-link-hover-color);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
@media (width <= 39.99em) {
|
|
306
|
+
button {
|
|
307
|
+
width: 100%;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
button:enabled:focus {
|
|
311
|
+
outline-offset: -0.25rem;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
button:not([disabled]):focus {
|
|
316
|
+
outline: var(--ogds-spacing-05) solid var(--ogds-banner-focus-outline-color);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
@media (width >= 40em) {
|
|
320
|
+
button {
|
|
321
|
+
bottom: auto;
|
|
322
|
+
display: inline;
|
|
323
|
+
left: auto;
|
|
324
|
+
margin-inline-start: var(--ogds-spacing-1);
|
|
325
|
+
position: relative;
|
|
326
|
+
top: auto;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
button::after {
|
|
330
|
+
background-color: currentColor;
|
|
331
|
+
content: "";
|
|
332
|
+
display: inline-block;
|
|
333
|
+
height: 1rem;
|
|
334
|
+
margin-block: 0;
|
|
335
|
+
mask-image: var(--ogds-icon-expand-more);
|
|
336
|
+
mask-position: center;
|
|
337
|
+
mask-repeat: no-repeat;
|
|
338
|
+
mask-size: contain;
|
|
339
|
+
position: absolute;
|
|
340
|
+
right: -18px;
|
|
341
|
+
top: 0;
|
|
342
|
+
width: 1rem;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
button:hover {
|
|
346
|
+
text-decoration: none;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
@media (forced-colors: active) {
|
|
351
|
+
button::after,
|
|
352
|
+
button:hover::after {
|
|
353
|
+
background-color: ButtonText;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
button[aria-expanded="false"],
|
|
358
|
+
button[aria-expanded="false"]:hover,
|
|
359
|
+
button[aria-expanded="true"],
|
|
360
|
+
button[aria-expanded="true"]:hover {
|
|
361
|
+
background-image: none;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
@media (forced-colors: active) {
|
|
365
|
+
button[aria-expanded="false"]::before,
|
|
366
|
+
button[aria-expanded="false"]:hover::before,
|
|
367
|
+
button[aria-expanded="true"]::before,
|
|
368
|
+
button[aria-expanded="true"]:hover::before {
|
|
369
|
+
content: none;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
@media (width <= 39.99em) {
|
|
374
|
+
button[aria-expanded="true"]::before {
|
|
375
|
+
background-color: var(--ogds-banner-button-close-background-color);
|
|
376
|
+
bottom: 0;
|
|
377
|
+
content: "";
|
|
378
|
+
display: block;
|
|
379
|
+
height: var(--ogds-size-touch-target);
|
|
380
|
+
position: absolute;
|
|
381
|
+
right: 0;
|
|
382
|
+
top: 0;
|
|
383
|
+
width: var(--ogds-size-touch-target);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
button[aria-expanded="true"]::after {
|
|
387
|
+
background-color: var(--ogds-banner-link-color);
|
|
388
|
+
bottom: 0;
|
|
389
|
+
content: "";
|
|
390
|
+
display: block;
|
|
391
|
+
height: var(--ogds-size-touch-target);
|
|
392
|
+
mask-image: var(--ogds-icon-close);
|
|
393
|
+
mask-position: center;
|
|
394
|
+
mask-repeat: no-repeat;
|
|
395
|
+
mask-size: 1.5rem 1.5rem;
|
|
396
|
+
position: absolute;
|
|
397
|
+
right: 0;
|
|
398
|
+
top: 0;
|
|
399
|
+
width: var(--ogds-size-touch-target);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
@media (width >= 40em) {
|
|
404
|
+
button[aria-expanded="true"] {
|
|
405
|
+
height: auto;
|
|
406
|
+
padding: 0;
|
|
407
|
+
position: relative;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
button[aria-expanded="true"]::after,
|
|
411
|
+
button[aria-expanded="true"]:hover::after {
|
|
412
|
+
mask-image: var(--ogds-icon-expand-less);
|
|
413
|
+
position: absolute;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
@media (forced-colors: active) {
|
|
418
|
+
button[aria-expanded="true"]::after,
|
|
419
|
+
button[aria-expanded="true"]:hover::after {
|
|
420
|
+
background-color: ButtonText;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.button-text {
|
|
425
|
+
left: -999em;
|
|
426
|
+
position: absolute;
|
|
427
|
+
right: auto;
|
|
428
|
+
text-decoration: underline;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
@media (width >= 40em) {
|
|
432
|
+
.button-text {
|
|
433
|
+
display: inline;
|
|
434
|
+
left: auto;
|
|
435
|
+
position: static;
|
|
436
|
+
right: auto;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
@media (forced-colors: active) {
|
|
441
|
+
.button-text {
|
|
442
|
+
color: LinkText;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.guidance {
|
|
447
|
+
align-items: flex-start;
|
|
448
|
+
display: flex;
|
|
449
|
+
max-width: 62ex;
|
|
450
|
+
padding-block-start: var(--ogds-spacing-2);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
@media (width <= 39.99em) {
|
|
454
|
+
.guidance {
|
|
455
|
+
padding-inline-end: 0.75rem;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
@media (width >= 40em) {
|
|
460
|
+
.guidance {
|
|
461
|
+
padding-block-start: 0;
|
|
462
|
+
padding-inline-end: var(--ogds-spacing-1);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.icon {
|
|
467
|
+
width: var(--ogds-spacing-5);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.icon-lock,
|
|
471
|
+
::slotted(.usa-banner__icon-lock) {
|
|
472
|
+
background-color: currentColor;
|
|
473
|
+
background-position: center;
|
|
474
|
+
background-repeat: no-repeat;
|
|
475
|
+
background-size: cover;
|
|
476
|
+
display: inline-block;
|
|
477
|
+
height: 1.5ex;
|
|
478
|
+
mask-image: var(--ogds-icon-lock);
|
|
479
|
+
mask-position: center;
|
|
480
|
+
mask-repeat: no-repeat;
|
|
481
|
+
mask-size: cover;
|
|
482
|
+
width: 1.21875ex;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.icon-gov,
|
|
486
|
+
.icon-https {
|
|
487
|
+
padding-inline-start: calc(var(--ogds-spacing-5) + var(--ogds-spacing-1));
|
|
488
|
+
position: relative;
|
|
489
|
+
|
|
490
|
+
&::before {
|
|
491
|
+
content: "";
|
|
492
|
+
display: inline-block;
|
|
493
|
+
height: var(--ogds-spacing-5);
|
|
494
|
+
left: 0;
|
|
495
|
+
mask-repeat: no-repeat;
|
|
496
|
+
mask-size: contain;
|
|
497
|
+
position: absolute;
|
|
498
|
+
top: 0;
|
|
499
|
+
width: var(--ogds-spacing-5);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.icon-gov::before {
|
|
504
|
+
background-color: var(--ogds-banner-icon-gov-color);
|
|
505
|
+
mask-image: var(--ogds-icon-gov);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.icon-https::before {
|
|
509
|
+
background-color: var(--ogds-banner-icon-https-color);
|
|
510
|
+
mask-image: var(--ogds-icon-https);
|
|
511
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import "./index.js";
|
|
4
|
+
|
|
5
|
+
function getInsideBanner(): ShadowRoot {
|
|
6
|
+
const banner = document.body.querySelector("usa-banner");
|
|
7
|
+
if (!banner) {
|
|
8
|
+
throw new Error("USA Banner element not found");
|
|
9
|
+
}
|
|
10
|
+
if (!banner.shadowRoot) {
|
|
11
|
+
throw new Error("USA Banner shadowRoot not found");
|
|
12
|
+
}
|
|
13
|
+
return banner.shadowRoot;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getBannerButton(): HTMLButtonElement {
|
|
17
|
+
const button = getInsideBanner().querySelector(".usa-accordion__button");
|
|
18
|
+
if (!button) {
|
|
19
|
+
throw new Error("Banner button not found");
|
|
20
|
+
}
|
|
21
|
+
return button as HTMLButtonElement;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
describe("USA Banner component", async () => {
|
|
25
|
+
beforeEach(async () => {
|
|
26
|
+
document.body.innerHTML = "<usa-banner></usa-banner>";
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("renders correctly", () => {
|
|
30
|
+
expect(getInsideBanner().textContent).toContain(
|
|
31
|
+
"An official website of the United States government",
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("uses gov TLD by default", () => {
|
|
36
|
+
expect(getInsideBanner().querySelector(".content")?.textContent).toContain(
|
|
37
|
+
".gov",
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("initializes closed", () => {
|
|
42
|
+
expect(getBannerButton().ariaExpanded).toBe("false");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("expands on button click", async () => {
|
|
46
|
+
const bannerButton = getBannerButton();
|
|
47
|
+
|
|
48
|
+
await bannerButton.click();
|
|
49
|
+
|
|
50
|
+
expect(bannerButton.ariaExpanded).toBe("true");
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe("Spanish variant", async () => {
|
|
55
|
+
beforeEach(async () => {
|
|
56
|
+
document.body.innerHTML = `<usa-banner lang="es"></usa-banner>`;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("renders correctly", () => {
|
|
60
|
+
expect(getInsideBanner().textContent).toContain(
|
|
61
|
+
"Un sitio oficial del Gobierno de Estados Unidos",
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
describe("MIL variant", async () => {
|
|
67
|
+
beforeEach(async () => {
|
|
68
|
+
document.body.innerHTML = `<usa-banner tld="mil"></usa-banner>`;
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("renders correctly", () => {
|
|
72
|
+
expect(getInsideBanner().querySelector(".content")?.textContent).toContain(
|
|
73
|
+
".mil",
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import "./index";
|
|
2
|
+
import ComponentDocs from "./docs.mdx";
|
|
3
|
+
import { expect, userEvent, waitFor } from "storybook/test";
|
|
4
|
+
import { within } from "shadow-dom-testing-library";
|
|
5
|
+
import { getStorybookHelpers } from "@wc-toolkit/storybook-helpers";
|
|
6
|
+
import type { Args, ArgTypes } from "storybook/internal/csf";
|
|
7
|
+
|
|
8
|
+
const { argTypes, args, template } = getStorybookHelpers("usa-banner");
|
|
9
|
+
|
|
10
|
+
const filteredArgTypes = (argTypes: ArgTypes) => {
|
|
11
|
+
const filtered: ArgTypes = {};
|
|
12
|
+
|
|
13
|
+
for (const [key, value] of Object.entries(argTypes)) {
|
|
14
|
+
// Disable methods and isOpen
|
|
15
|
+
if (value.table?.category === "methods" || key === "isOpen") {
|
|
16
|
+
filtered[key] = {
|
|
17
|
+
...value,
|
|
18
|
+
table: {
|
|
19
|
+
...value.table,
|
|
20
|
+
disable: true,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
} else {
|
|
24
|
+
filtered[key] = value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return filtered;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
title: "Components/Banner",
|
|
33
|
+
component: "usa-banner",
|
|
34
|
+
tags: ["beta"],
|
|
35
|
+
args: {
|
|
36
|
+
...args,
|
|
37
|
+
label: "",
|
|
38
|
+
tld: "gov",
|
|
39
|
+
lang: "en",
|
|
40
|
+
},
|
|
41
|
+
parameters: {
|
|
42
|
+
docs: {
|
|
43
|
+
page: ComponentDocs,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
argTypes: filteredArgTypes(argTypes),
|
|
47
|
+
render: (args: Args) => template(args),
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const Default = {};
|
|
51
|
+
|
|
52
|
+
export const CustomContent = {
|
|
53
|
+
argTypes: {
|
|
54
|
+
tld: { table: { disable: true } },
|
|
55
|
+
lang: { table: { disable: true } },
|
|
56
|
+
},
|
|
57
|
+
args: {
|
|
58
|
+
label: "Un site Web officiel du gouvernement américain",
|
|
59
|
+
/**
|
|
60
|
+
* The `getStorybookHelpers` function from @wc-toolkit/storybook-helpers`
|
|
61
|
+
* automatically appends the `slot` attribute to avoid collisions with other props.
|
|
62
|
+
*
|
|
63
|
+
* To set the content for this story, the key should have the suffix `-slot`,
|
|
64
|
+
* even though the slot name in the component is `banner-text`, `banner-action`, etc.
|
|
65
|
+
*/
|
|
66
|
+
"banner-text-slot": "Un site Web officiel du gouvernement américain",
|
|
67
|
+
"banner-action-slot": "Voici comment vous le savez",
|
|
68
|
+
"domain-heading-slot": "Les sites Web officiels utilisent .gov",
|
|
69
|
+
"domain-text-slot":
|
|
70
|
+
"Un site Web .gov appartient à une organisation gouvernementale officielle aux États-Unis.",
|
|
71
|
+
"https-heading-slot": "Les sites Web .gov sécurisés utilisent HTTPS",
|
|
72
|
+
"https-text-slot": `Un <strong>verrou</strong> ( <span class="usa-banner__icon-lock" role="img" aria-label="Icône de cadenas verrouillé"></span> ) ou <strong>https://</strong> signifie que vous êtes connecté(e) en toute sécurité au site Web .gov. Assurez-vous de ne partager des informations sensibles que sur des sites Web officiels et sécurisés.`,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const Mil = {
|
|
77
|
+
args: {
|
|
78
|
+
tld: "mil",
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const EspañolGov = {
|
|
83
|
+
args: {
|
|
84
|
+
lang: "es",
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const EspañolMil = {
|
|
89
|
+
args: {
|
|
90
|
+
lang: "es",
|
|
91
|
+
tld: "mil",
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const CustomThemeExample = {
|
|
96
|
+
parameters: {
|
|
97
|
+
docs: {
|
|
98
|
+
disable: true,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
args: {
|
|
102
|
+
"--ogds-banner-background-color": "#0f191c", // blue-cool-90
|
|
103
|
+
"--ogds-banner-button-close-background-color": "#002d3f", // blue-cool-80-vivid
|
|
104
|
+
"--ogds-banner-focus-outline-color": "#52daf2", // cyan-20-vivid
|
|
105
|
+
"--ogds-banner-font-family":
|
|
106
|
+
"ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace",
|
|
107
|
+
"--ogds-banner-link-hover-color": "#c3ebfa", // blue-cool-10-vivid
|
|
108
|
+
"--ogds-banner-text-color": "#ffffff",
|
|
109
|
+
"--ogds-banner-link-color": "#97d4ea", // blue-cool-20-vivid
|
|
110
|
+
"--ogds-banner-icon-gov-color": "#29e1cb", // mint-cool-20-vivid
|
|
111
|
+
"--ogds-banner-icon-https-color": "#29e1cb", // mint-cool-20-vivid
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const ToggleBannerTest = {
|
|
116
|
+
parameters: {
|
|
117
|
+
docs: {
|
|
118
|
+
disable: true,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
122
|
+
const canvas = within(canvasElement);
|
|
123
|
+
const button = canvas.getByShadowRole("button");
|
|
124
|
+
const dotGovText = canvas.getByShadowText("Official websites use .gov");
|
|
125
|
+
|
|
126
|
+
await userEvent.click(button);
|
|
127
|
+
await waitFor(() => {
|
|
128
|
+
expect(dotGovText).toBeVisible();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
await userEvent.click(button);
|
|
132
|
+
await waitFor(() => {
|
|
133
|
+
expect(dotGovText).not.toBeVisible();
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
};
|