use-scroll-animate 6.4.0 → 6.5.0
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/CHANGELOG.md +14 -0
- package/dist/components/fx-3d.cjs +236 -0
- package/dist/components/fx-3d.cjs.map +1 -0
- package/dist/components/fx-3d.d.cts +67 -0
- package/dist/components/fx-3d.d.ts +67 -0
- package/dist/components/fx-3d.js +233 -0
- package/dist/components/fx-3d.js.map +1 -0
- package/dist/components/fx2.cjs +5 -0
- package/dist/components/fx2.cjs.map +1 -1
- package/dist/components/fx2.d.cts +24 -1
- package/dist/components/fx2.d.ts +24 -1
- package/dist/components/fx2.js +4 -1
- package/dist/components/fx2.js.map +1 -1
- package/dist/components/widgets.cjs +504 -21
- package/dist/components/widgets.cjs.map +1 -1
- package/dist/components/widgets.d.cts +67 -2
- package/dist/components/widgets.d.ts +67 -2
- package/dist/components/widgets.js +501 -22
- package/dist/components/widgets.js.map +1 -1
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/docs/ROADMAP.md +1 -1
- package/docs/components.md +26 -0
- package/package.json +11 -1
|
@@ -36,7 +36,7 @@ function arrowIndex(e, i, n, vertical = false) {
|
|
|
36
36
|
return -1;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
var css$
|
|
39
|
+
var css$d = "usa-carousel{display:block;position:relative;--usa-carousel-dur:520ms;--usa-carousel-ease:cubic-bezier(.22,1,.36,1);overflow:hidden;border-radius:var(--usa-radius,14px);touch-action:pan-y}.usa-carousel-viewport{position:relative;overflow:hidden;height:100%;min-height:inherit}.usa-carousel-track{display:flex;height:100%;transition:transform var(--usa-carousel-dur) var(--usa-carousel-ease);will-change:transform}.usa-carousel-track>*{flex:0 0 100%;min-width:0;box-sizing:border-box}usa-carousel:not([data-effect=\"slide\"]) .usa-carousel-track{display:grid}usa-carousel:not([data-effect=\"slide\"]) .usa-carousel-track>*{grid-area:1/1;transition:opacity var(--usa-carousel-dur) ease,transform var(--usa-carousel-dur) var(--usa-carousel-ease),filter var(--usa-carousel-dur) ease}usa-carousel[data-effect=\"cards\"] .usa-carousel-viewport{perspective:900px}usa-carousel[data-dragging] .usa-carousel-track,usa-carousel[data-dragging] .usa-carousel-track>*{transition:none}.usa-carousel-nav{position:absolute;top:50%;translate:0 -50%;z-index:2;width:36px;height:36px;border-radius:50%;border:0;background:rgba(255,255,255,.85);color:#111;font:600 18px/1 system-ui;cursor:pointer;display:grid;place-items:center;box-shadow:0 4px 14px rgba(0,0,0,.18);transition:transform .2s}.usa-carousel-nav:hover{transform:scale(1.08)}.usa-carousel-nav:focus-visible{outline:2px solid #7c5cff;outline-offset:2px}.usa-carousel-prev{left:10px}.usa-carousel-next{right:10px}.usa-carousel-dots{position:absolute;left:0;right:0;bottom:10px;display:flex;justify-content:center;gap:6px;z-index:2}.usa-carousel-dot{width:8px;height:8px;padding:0;border:0;border-radius:99px;background:rgba(255,255,255,.55);cursor:pointer;transition:width .35s var(--usa-carousel-ease),background .35s}.usa-carousel-dot[aria-current=\"true\"]{width:22px;background:#fff}@media (prefers-reduced-motion:reduce){usa-carousel .usa-carousel-track,usa-carousel .usa-carousel-track>*,.usa-carousel-dot{transition:none!important}}usa-carousel[data-reduced] .usa-carousel-track,usa-carousel[data-reduced] .usa-carousel-track>*{transition:none!important}";
|
|
40
40
|
|
|
41
41
|
const CAROUSEL_EFFECTS = ['slide', 'fade', 'scale', 'cards'];
|
|
42
42
|
function defineCarousel(tag = 'usa-carousel') {
|
|
@@ -225,10 +225,10 @@ function defineCarousel(tag = 'usa-carousel') {
|
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
return UsaCarousel;
|
|
228
|
-
}, { id: 'carousel', text: css$
|
|
228
|
+
}, { id: 'carousel', text: css$d });
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
var css$
|
|
231
|
+
var css$c = "usa-tab-bar{display:block;--usa-tab-accent:#7c5cff;--usa-tab-ease:cubic-bezier(.22,1,.36,1)}.usa-tab-bar-list{position:relative;display:flex;gap:4px;padding:4px;border-radius:12px;background:rgba(127,127,127,.12);isolation:isolate;overflow-x:auto;scrollbar-width:none}.usa-tab-bar-list::-webkit-scrollbar{display:none}.usa-tab-bar-list>[role=\"tab\"]{position:relative;z-index:1;flex:1 0 auto;border:0;background:none;color:inherit;font:inherit;font-weight:600;padding:8px 14px;border-radius:9px;cursor:pointer;opacity:.7;transition:opacity .25s,color .25s;white-space:nowrap}.usa-tab-bar-list>[role=\"tab\"][aria-selected=\"true\"]{opacity:1}.usa-tab-bar-list>[role=\"tab\"]:focus-visible{outline:2px solid var(--usa-tab-accent);outline-offset:1px}.usa-tab-bar-ink{position:absolute;z-index:0;left:0;top:4px;bottom:4px;width:0;border-radius:9px;background:var(--usa-tab-accent);pointer-events:none}usa-tab-bar[data-indicator=\"pill\"] [aria-selected=\"true\"]{color:#fff}usa-tab-bar[data-indicator=\"underline\"] .usa-tab-bar-list{background:none;border-bottom:1px solid rgba(127,127,127,.25);border-radius:0}usa-tab-bar[data-indicator=\"underline\"] .usa-tab-bar-ink{top:auto;bottom:0;height:3px;border-radius:3px}usa-tab-bar[data-indicator=\"glow\"] .usa-tab-bar-ink{background:transparent;box-shadow:0 0 0 2px var(--usa-tab-accent),0 0 18px var(--usa-tab-accent)}usa-tab-bar[data-indicator=\"gooey\"] .usa-tab-bar-ink{filter:blur(.5px);border-radius:999px}usa-tab-bar[data-indicator=\"gooey\"] [aria-selected=\"true\"]{color:#fff}.usa-tab-bar-panel{padding:14px 2px}.usa-tab-bar-panel[hidden]{display:none}";
|
|
232
232
|
|
|
233
233
|
const TAB_INDICATORS = ['pill', 'underline', 'glow', 'gooey'];
|
|
234
234
|
function defineTabBar(tag = 'usa-tab-bar') {
|
|
@@ -341,10 +341,10 @@ function defineTabBar(tag = 'usa-tab-bar') {
|
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
return UsaTabBar;
|
|
344
|
-
}, { id: 'tab-bar', text: css$
|
|
344
|
+
}, { id: 'tab-bar', text: css$c });
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
-
var css$
|
|
347
|
+
var css$b = "usa-disclosure{display:block;--usa-disclosure-accent:#7c5cff}usa-disclosure>details{border-bottom:1px solid rgba(127,127,127,.25);overflow:hidden}usa-disclosure>details>summary{list-style:none;cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 4px;font-weight:600}usa-disclosure>details>summary::-webkit-details-marker{display:none}usa-disclosure>details>summary::after{content:\"\";flex:none;width:9px;height:9px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;rotate:45deg;translate:0 -3px;transition:rotate .35s cubic-bezier(.34,1.56,.64,1),translate .35s}usa-disclosure>details[open]>summary::after{rotate:225deg;translate:0 2px}usa-disclosure>details>summary:focus-visible{outline:2px solid var(--usa-disclosure-accent);outline-offset:2px;border-radius:6px}usa-disclosure>details>:not(summary){padding:0 4px 12px}usa-disclosure[variant=\"cards\"]>details{border:1px solid rgba(127,127,127,.25);border-radius:12px;margin-bottom:8px;padding:0 10px;transition:box-shadow .3s,border-color .3s}usa-disclosure[variant=\"cards\"]>details[open]{border-color:var(--usa-disclosure-accent);box-shadow:0 8px 24px rgba(124,92,255,.16)}@media (prefers-reduced-motion:reduce){usa-disclosure>details>summary::after{transition:none}}";
|
|
348
348
|
|
|
349
349
|
function defineDisclosure(tag = 'usa-disclosure') {
|
|
350
350
|
return defineElement(tag, (Base) => {
|
|
@@ -412,10 +412,10 @@ function defineDisclosure(tag = 'usa-disclosure') {
|
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
414
|
return UsaDisclosure;
|
|
415
|
-
}, { id: 'disclosure', text: css$
|
|
415
|
+
}, { id: 'disclosure', text: css$b });
|
|
416
416
|
}
|
|
417
417
|
|
|
418
|
-
var css$
|
|
418
|
+
var css$a = "usa-stories{display:block;position:relative;overflow:hidden;border-radius:var(--usa-radius,16px);background:#111;color:#fff;aspect-ratio:9/14;max-height:520px;user-select:none;-webkit-user-select:none;touch-action:manipulation}usa-stories>:not([data-usa-part]){position:absolute;inset:0;opacity:0;transition:opacity .35s ease,transform .5s cubic-bezier(.22,1,.36,1);transform:scale(1.04);pointer-events:none;box-sizing:border-box}usa-stories>[data-active]:not([data-usa-part]){opacity:1;transform:none;pointer-events:auto}usa-stories>img:not([data-usa-part]){width:100%;height:100%;object-fit:cover}.usa-stories-bars{position:absolute;z-index:3;top:8px;left:8px;right:48px;display:flex;gap:4px}.usa-stories-bar{flex:1;height:3px;border-radius:3px;background:rgba(255,255,255,.35);overflow:hidden}.usa-stories-bar>i{display:block;height:100%;width:100%;background:#fff;transform-origin:left;transform:scaleX(0)}.usa-stories-bar[data-done]>i{transform:scaleX(1)}.usa-stories-toggle{position:absolute;z-index:3;top:2px;right:6px;width:36px;height:30px;border:0;background:none;color:#fff;font:700 14px/1 system-ui;cursor:pointer;border-radius:8px}.usa-stories-toggle:focus-visible{outline:2px solid #fff}@media (prefers-reduced-motion:reduce){usa-stories>*{transition:none!important;transform:none!important}}";
|
|
419
419
|
|
|
420
420
|
function defineStories(tag = 'usa-stories') {
|
|
421
421
|
return defineElement(tag, (Base) => {
|
|
@@ -548,10 +548,10 @@ function defineStories(tag = 'usa-stories') {
|
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
550
|
return UsaStories;
|
|
551
|
-
}, { id: 'stories', text: css$
|
|
551
|
+
}, { id: 'stories', text: css$a });
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
-
var css$
|
|
554
|
+
var css$9 = "usa-modal,usa-sheet{display:contents}.usa-ov{border:0;padding:0;margin:auto;color:inherit;background:transparent;max-width:min(92vw,520px);max-height:88vh;overflow:visible}.usa-ov::backdrop{background:rgba(10,12,20,.45);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.usa-ov-body{box-sizing:border-box;background:var(--usa-ov-bg,#fff);color:var(--usa-ov-fg,#111827);border-radius:var(--usa-ov-radius,18px);padding:var(--usa-ov-pad,22px);box-shadow:0 30px 80px -20px rgba(0,0,0,.45);max-height:88vh;overflow:auto}.usa-sheet-panel{margin:0;max-width:none;max-height:none}usa-sheet[data-side=\"right\"] .usa-sheet-panel{inset:0 0 0 auto;height:100%;width:min(88vw,var(--usa-sheet-size,380px))}usa-sheet[data-side=\"left\"] .usa-sheet-panel{inset:0 auto 0 0;height:100%;width:min(88vw,var(--usa-sheet-size,380px))}usa-sheet[data-side=\"bottom\"] .usa-sheet-panel{inset:auto 0 0 0;width:100%;max-height:85vh}usa-sheet[data-side=\"top\"] .usa-sheet-panel{inset:0 0 auto 0;width:100%;max-height:85vh}usa-sheet .usa-ov-body{height:100%;max-height:inherit;border-radius:0}usa-sheet[data-side=\"bottom\"] .usa-ov-body{border-radius:var(--usa-ov-radius,18px) var(--usa-ov-radius,18px) 0 0;height:auto;max-height:85vh;touch-action:none}usa-sheet[data-side=\"top\"] .usa-ov-body{border-radius:0 0 var(--usa-ov-radius,18px) var(--usa-ov-radius,18px);height:auto}.usa-ov-grab{width:44px;height:5px;border-radius:3px;background:rgba(127,127,127,.45);margin:-8px auto 14px;cursor:grab}@media (prefers-color-scheme:dark){.usa-ov-body{background:var(--usa-ov-bg,#171a23);color:var(--usa-ov-fg,#e5e7eb)}}";
|
|
555
555
|
|
|
556
556
|
const MODAL_EFFECTS = ['scale', 'slide-up', 'flip', 'origin'];
|
|
557
557
|
const SHEET_SIDES = ['right', 'left', 'bottom', 'top'];
|
|
@@ -778,12 +778,12 @@ function defineOverlay(tag, kind) {
|
|
|
778
778
|
}
|
|
779
779
|
}
|
|
780
780
|
return UsaOverlay;
|
|
781
|
-
}, { id: 'overlay', text: css$
|
|
781
|
+
}, { id: 'overlay', text: css$9 });
|
|
782
782
|
}
|
|
783
783
|
const defineModal = (tag = 'usa-modal') => defineOverlay(tag, 'modal');
|
|
784
784
|
const defineSheet = (tag = 'usa-sheet') => defineOverlay(tag, 'sheet');
|
|
785
785
|
|
|
786
|
-
var css$
|
|
786
|
+
var css$8 = "usa-toast-stack{position:fixed;z-index:2147482000;width:min(360px,calc(100vw - 24px));pointer-events:none;--usa-tstack-bg:#111827;--usa-tstack-fg:#f9fafb}usa-toast-stack[contained]{position:absolute;width:min(360px,calc(100% - 24px))}usa-toast-stack[data-position^=\"bottom\"]{bottom:12px}usa-toast-stack[data-position^=\"top\"]{top:12px}usa-toast-stack[data-position$=\"right\"]{right:12px}usa-toast-stack[data-position$=\"left\"]{left:12px}usa-toast-stack[data-position$=\"center\"]{left:50%;transform:translateX(-50%)}.usa-tstack-list{position:relative;list-style:none;margin:0;padding:0;min-height:1px;transition:height .3s}.usa-tstack{position:absolute;left:0;right:0;display:flex;align-items:center;gap:10px;box-sizing:border-box;padding:12px 12px 12px 14px;border-radius:14px;background:var(--usa-tstack-bg);color:var(--usa-tstack-fg);box-shadow:0 12px 32px -10px rgba(0,0,0,.45);font:500 14px/1.35 system-ui,sans-serif;pointer-events:auto;touch-action:pan-y;transition:transform .38s cubic-bezier(.22,1,.36,1),opacity .3s;user-select:none}usa-toast-stack[data-position^=\"bottom\"] .usa-tstack{bottom:0;transform-origin:50% 100%}usa-toast-stack[data-position^=\"top\"] .usa-tstack{top:0;transform-origin:50% 0}.usa-tstack-icon{flex:none;display:grid;place-items:center;width:22px;height:22px;border-radius:50%;font-size:13px;font-weight:800;background:#3b82f6;color:#fff}.usa-tstack-success .usa-tstack-icon{background:#22c55e}.usa-tstack-warning .usa-tstack-icon{background:#f59e0b}.usa-tstack-error .usa-tstack-icon{background:#ef4444}.usa-tstack-text{flex:1;min-width:0;display:flex;flex-direction:column}.usa-tstack-text strong{font-weight:700}.usa-tstack-action{border:0;border-radius:8px;padding:6px 10px;background:rgba(255,255,255,.14);color:inherit;font:600 13px system-ui,sans-serif;cursor:pointer}.usa-tstack-close{border:0;background:none;color:inherit;opacity:.6;font-size:18px;line-height:1;cursor:pointer;padding:2px 4px}.usa-tstack-close:hover{opacity:1}@media (prefers-reduced-motion:reduce){.usa-tstack,.usa-tstack-list{transition:none}}";
|
|
787
787
|
|
|
788
788
|
const TOAST_POSITIONS = ['bottom-right', 'bottom-left', 'bottom-center', 'top-right', 'top-left', 'top-center'];
|
|
789
789
|
const ICONS = { info: 'ℹ', success: '✓', warning: '!', error: '✕' };
|
|
@@ -954,7 +954,7 @@ function defineToastStack(tag = 'usa-toast-stack') {
|
|
|
954
954
|
}
|
|
955
955
|
}
|
|
956
956
|
return UsaToastStack;
|
|
957
|
-
}, { id: 'toast', text: css$
|
|
957
|
+
}, { id: 'toast', text: css$8 });
|
|
958
958
|
}
|
|
959
959
|
/** Show a toast on the first `<usa-toast-stack>` of the page (one is created when missing). */
|
|
960
960
|
function stackToast(input, stack) {
|
|
@@ -982,7 +982,7 @@ function installToastTriggers() {
|
|
|
982
982
|
});
|
|
983
983
|
}
|
|
984
984
|
|
|
985
|
-
var css$
|
|
985
|
+
var css$7 = "usa-menu{position:relative;display:inline-block}.usa-menu-list{position:absolute;z-index:50;min-width:180px;max-width:min(280px,90vw);box-sizing:border-box;padding:6px;border-radius:12px;background:var(--usa-menu-bg,#fff);color:var(--usa-menu-fg,#111827);box-shadow:0 18px 44px -12px rgba(0,0,0,.35),0 0 0 1px rgba(127,127,127,.15);display:flex;flex-direction:column;gap:2px;text-align:left}.usa-menu-list[hidden]{display:none}usa-menu[data-placement^=\"bottom\"] .usa-menu-list{top:calc(100% + 6px)}usa-menu[data-placement^=\"top\"] .usa-menu-list{bottom:calc(100% + 6px)}usa-menu[data-placement$=\"start\"] .usa-menu-list{left:0;transform-origin:0 0}usa-menu[data-placement$=\"end\"] .usa-menu-list{right:0;transform-origin:100% 0}usa-menu[data-placement=\"top-start\"] .usa-menu-list{transform-origin:0 100%}usa-menu[data-placement=\"top-end\"] .usa-menu-list{transform-origin:100% 100%}.usa-menu-list>[role=\"menuitem\"]{display:flex;align-items:center;gap:8px;width:100%;box-sizing:border-box;border:0;background:none;color:inherit;font:500 14px/1.3 system-ui,sans-serif;text-align:left;text-decoration:none;padding:8px 10px;border-radius:8px;cursor:pointer}.usa-menu-list>[role=\"menuitem\"]:hover,.usa-menu-list>[role=\"menuitem\"]:focus-visible{background:var(--usa-menu-hover,rgba(124,92,255,.14));outline:none}.usa-menu-list>hr{border:0;border-top:1px solid rgba(127,127,127,.2);margin:4px 2px}@media (prefers-color-scheme:dark){.usa-menu-list{background:var(--usa-menu-bg,#1d2130);color:var(--usa-menu-fg,#e5e7eb)}}";
|
|
986
986
|
|
|
987
987
|
const MENU_EFFECTS = ['scale', 'fold', 'slide'];
|
|
988
988
|
function defineMenu(tag = 'usa-menu') {
|
|
@@ -1121,10 +1121,10 @@ function defineMenu(tag = 'usa-menu') {
|
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
1123
1123
|
return UsaMenu;
|
|
1124
|
-
}, { id: 'menu', text: css$
|
|
1124
|
+
}, { id: 'menu', text: css$7 });
|
|
1125
1125
|
}
|
|
1126
1126
|
|
|
1127
|
-
var css$
|
|
1127
|
+
var css$6 = "usa-progress-ring{position:relative;display:inline-block;vertical-align:middle;width:var(--usa-pr-size,120px);aspect-ratio:1;--usa-pr-color:#7c5cff;--usa-pr-track:rgba(127,127,127,.18);--usa-pr-width:9;font:700 calc(var(--usa-pr-size,120px)*.2)/1 system-ui,sans-serif;font-variant-numeric:tabular-nums}usa-progress-ring[data-variant=\"semi\"]{aspect-ratio:100/56}.usa-pr-label{position:absolute;inset:0;display:grid;place-items:center}usa-progress-ring[data-variant=\"semi\"] .usa-pr-label{place-items:end center}usa-progress-ring[data-variant=\"bar\"]{display:inline-flex;width:var(--usa-pr-size,100%);aspect-ratio:auto;gap:10px;align-items:center;font-size:14px}usa-progress-ring[data-variant=\"bar\"]>.usa-pr-track{flex:1 1 auto;min-width:40px}usa-progress-ring[data-variant=\"bar\"] .usa-pr-label{position:static;display:inline}usa-progress-ring .usa-pr-svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}.usa-pr-svg path{fill:none;stroke-width:var(--usa-pr-width);stroke-linecap:round}.usa-pr-svg .usa-pr-track{stroke:var(--usa-pr-track)}.usa-pr-svg .usa-pr-arc{stroke:var(--usa-pr-color)}usa-progress-ring[data-variant=\"semi\"] .usa-pr-label{padding-bottom:2%}.usa-pr-track:is(div){height:10px;border-radius:999px;background:var(--usa-pr-track);overflow:hidden}.usa-pr-fill{height:100%;border-radius:inherit;background:var(--usa-pr-color);transform-origin:0 50%;transform:scaleX(0)}usa-progress-ring[data-indeterminate] .usa-pr-svg{animation:usa-pr-spin 1.1s linear infinite}usa-progress-ring[data-indeterminate] .usa-pr-fill{width:35%;transform:none!important;animation:usa-pr-slide 1.3s ease-in-out infinite}@keyframes usa-pr-spin{to{transform:rotate(360deg)}}@keyframes usa-pr-slide{from{margin-left:-35%}to{margin-left:100%}}usa-odometer{display:inline-flex;align-items:flex-end;font-variant-numeric:tabular-nums;line-height:1.15}.usa-odo-row{display:inline-flex;align-items:flex-end}.usa-odo-col{display:inline-block;height:1.15em;overflow:hidden;-webkit-mask-image:linear-gradient(transparent,#000 18%,#000 82%,transparent);mask-image:linear-gradient(transparent,#000 18%,#000 82%,transparent)}.usa-odo-strip{display:block;white-space:pre;line-height:1.15em;text-align:center}.usa-odo-sym{display:inline-block;height:1.15em}@media (prefers-reduced-motion:reduce){usa-progress-ring[data-indeterminate] .usa-pr-svg,usa-progress-ring[data-indeterminate] .usa-pr-fill{animation-duration:4s}}";
|
|
1128
1128
|
|
|
1129
1129
|
const PROGRESS_VARIANTS = ['ring', 'bar', 'semi'];
|
|
1130
1130
|
const NS = 'http://www.w3.org/2000/svg';
|
|
@@ -1264,7 +1264,7 @@ function defineProgressRing(tag = 'usa-progress-ring') {
|
|
|
1264
1264
|
}
|
|
1265
1265
|
}
|
|
1266
1266
|
return UsaProgressRing;
|
|
1267
|
-
}, { id: 'meters', text: css$
|
|
1267
|
+
}, { id: 'meters', text: css$6 });
|
|
1268
1268
|
}
|
|
1269
1269
|
function defineOdometer(tag = 'usa-odometer') {
|
|
1270
1270
|
return defineElement(tag, (Base) => {
|
|
@@ -1374,10 +1374,10 @@ function defineOdometer(tag = 'usa-odometer') {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
}
|
|
1376
1376
|
return UsaOdometer;
|
|
1377
|
-
}, { id: 'meters', text: css$
|
|
1377
|
+
}, { id: 'meters', text: css$6 });
|
|
1378
1378
|
}
|
|
1379
1379
|
|
|
1380
|
-
var css$
|
|
1380
|
+
var css$5 = "usa-skeleton-reveal{position:relative;display:block;--usa-sk-base:rgba(127,127,127,.16);--usa-sk-hi:rgba(255,255,255,.55)}usa-skeleton-reveal[data-loading]>:not(.usa-sk-layer){visibility:hidden}.usa-sk-layer{position:absolute;inset:0;pointer-events:none}.usa-sk-box{position:absolute;border-radius:6px;background:var(--usa-sk-base);overflow:hidden}usa-skeleton-reveal[data-variant=\"wave\"] .usa-sk-box{background:linear-gradient(100deg,var(--usa-sk-base) 30%,var(--usa-sk-hi) 50%,var(--usa-sk-base) 70%) var(--usa-sk-x,0) 0/var(--usa-sk-w,600px) 100% no-repeat,var(--usa-sk-base);animation:usa-sk-wave 1.4s linear infinite}usa-skeleton-reveal[data-variant=\"pulse\"] .usa-sk-box{animation:usa-sk-pulse 1.2s ease-in-out infinite alternate}usa-skeleton-reveal[data-variant=\"glow\"] .usa-sk-box{animation:usa-sk-glow 1.6s ease-in-out infinite alternate}@keyframes usa-sk-wave{from{background-position:calc(var(--usa-sk-x,0px) - var(--usa-sk-w,600px)) 0,0 0}to{background-position:calc(var(--usa-sk-x,0px) + var(--usa-sk-w,600px)) 0,0 0}}@keyframes usa-sk-pulse{from{opacity:1}to{opacity:.45}}@keyframes usa-sk-glow{from{box-shadow:0 0 0 rgba(124,92,255,0)}to{box-shadow:0 0 14px rgba(124,92,255,.45);background:rgba(124,92,255,.22)}}@media (prefers-color-scheme:dark){usa-skeleton-reveal{--usa-sk-hi:rgba(255,255,255,.16)}}@media (prefers-reduced-motion:reduce){.usa-sk-box{animation:none!important}}";
|
|
1381
1381
|
|
|
1382
1382
|
const SKELETON_VARIANTS = ['wave', 'pulse', 'glow'];
|
|
1383
1383
|
function defineSkeletonReveal(tag = 'usa-skeleton-reveal') {
|
|
@@ -1492,10 +1492,10 @@ function defineSkeletonReveal(tag = 'usa-skeleton-reveal') {
|
|
|
1492
1492
|
}
|
|
1493
1493
|
}
|
|
1494
1494
|
return UsaSkeletonReveal;
|
|
1495
|
-
}, { id: 'skeleton-reveal', text: css$
|
|
1495
|
+
}, { id: 'skeleton-reveal', text: css$5 });
|
|
1496
1496
|
}
|
|
1497
1497
|
|
|
1498
|
-
var css = "usa-star-rating{display:inline-flex;gap:var(--usa-star-gap,4px);--usa-star-size:28px;--usa-star-on:#fbbf24;--usa-star-off:rgba(127,127,127,.28);cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent;border-radius:8px}usa-star-rating[readonly]{cursor:default}usa-star-rating:focus-visible{outline:2px solid var(--usa-star-on);outline-offset:4px}.usa-star{position:relative;display:inline-block;width:var(--usa-star-size);height:var(--usa-star-size);--usa-star-fill:0%}.usa-star svg{display:block;width:100%;height:100%;overflow:visible;stroke:none}.usa-star-bg{fill:var(--usa-star-off)}.usa-star-fg{position:absolute;left:0;top:0;bottom:0;width:var(--usa-star-fill);overflow:hidden;transition:width .18s ease-out}.usa-star-fg svg{width:var(--usa-star-size);height:var(--usa-star-size);fill:var(--usa-star-on);filter:drop-shadow(0 1px 3px rgba(251,191,36,.45))}usa-star-rating[data-preview] .usa-star-fg{opacity:.8}.usa-star-spark{position:absolute;left:50%;top:50%;width:6px;height:6px;border-radius:50%;background:var(--usa-star-on);pointer-events:none}@media (prefers-reduced-motion:reduce){.usa-star-fg{transition:none}}";
|
|
1498
|
+
var css$4 = "usa-star-rating{display:inline-flex;gap:var(--usa-star-gap,4px);--usa-star-size:28px;--usa-star-on:#fbbf24;--usa-star-off:rgba(127,127,127,.28);cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent;border-radius:8px}usa-star-rating[readonly]{cursor:default}usa-star-rating:focus-visible{outline:2px solid var(--usa-star-on);outline-offset:4px}.usa-star{position:relative;display:inline-block;width:var(--usa-star-size);height:var(--usa-star-size);--usa-star-fill:0%}.usa-star svg{display:block;width:100%;height:100%;overflow:visible;stroke:none}.usa-star-bg{fill:var(--usa-star-off)}.usa-star-fg{position:absolute;left:0;top:0;bottom:0;width:var(--usa-star-fill);overflow:hidden;transition:width .18s ease-out}.usa-star-fg svg{width:var(--usa-star-size);height:var(--usa-star-size);fill:var(--usa-star-on);filter:drop-shadow(0 1px 3px rgba(251,191,36,.45))}usa-star-rating[data-preview] .usa-star-fg{opacity:.8}.usa-star-spark{position:absolute;left:50%;top:50%;width:6px;height:6px;border-radius:50%;background:var(--usa-star-on);pointer-events:none}@media (prefers-reduced-motion:reduce){.usa-star-fg{transition:none}}";
|
|
1499
1499
|
|
|
1500
1500
|
const PATHS = {
|
|
1501
1501
|
star: 'M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3l-5.9 3.3 1.3-6.6L2.5 9.4l6.6-.8z',
|
|
@@ -1619,7 +1619,485 @@ function defineStarRating(tag = 'usa-star-rating') {
|
|
|
1619
1619
|
}
|
|
1620
1620
|
}
|
|
1621
1621
|
return UsaStarRating;
|
|
1622
|
-
}, { id: 'star-rating', text: css });
|
|
1622
|
+
}, { id: 'star-rating', text: css$4 });
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
var css$3 = "usa-milestones{position:relative;display:block;--usa-ms-color:#7c5cff;--usa-ms-rail:rgba(127,127,127,.22);--usa-ms-gap:28px;padding:4px 0}.usa-ms-rail{position:absolute;top:0;bottom:0;left:50%;width:3px;margin-left:-1.5px;border-radius:3px;background:var(--usa-ms-rail);overflow:hidden}.usa-ms-fill{position:absolute;inset:0;background:linear-gradient(var(--usa-ms-color),#22d3ee);transform-origin:50% 0;transform:scaleY(0)}.usa-ms-item{position:relative;box-sizing:border-box;width:50%;padding:0 var(--usa-ms-gap) var(--usa-ms-gap);text-align:left}.usa-ms-item[data-side=\"right\"]{margin-left:50%}.usa-ms-item[data-side=\"left\"]{text-align:right}.usa-ms-dot{position:absolute;top:4px;width:14px;height:14px;border-radius:50%;background:var(--usa-ms-color);box-shadow:0 0 0 4px color-mix(in srgb,var(--usa-ms-color) 22%,transparent);transform:scale(0)}.usa-ms-item[data-reached] .usa-ms-dot{transform:none}.usa-ms-item[data-side=\"right\"] .usa-ms-dot{left:-7px}.usa-ms-item[data-side=\"left\"] .usa-ms-dot{right:-7px}.usa-ms-date{display:block;font-size:.8em;font-weight:700;letter-spacing:.04em;color:var(--usa-ms-color);margin-bottom:2px}.usa-ms-item:not([data-reached])>:not(.usa-ms-dot){opacity:0}usa-milestones[data-layout=\"left\"] .usa-ms-rail{left:7px}usa-milestones[data-layout=\"left\"] .usa-ms-item{width:auto;margin-left:0;padding-left:calc(var(--usa-ms-gap) + 8px);text-align:left}usa-milestones[data-layout=\"left\"] .usa-ms-dot{left:1px;right:auto}@media (max-width:640px){usa-milestones .usa-ms-rail{left:7px}usa-milestones .usa-ms-item{width:auto;margin-left:0;padding-left:calc(var(--usa-ms-gap) + 8px);text-align:left}usa-milestones .usa-ms-item .usa-ms-dot{left:1px;right:auto}}";
|
|
1626
|
+
|
|
1627
|
+
function defineMilestones(tag = 'usa-milestones') {
|
|
1628
|
+
return defineElement(tag, (Base) => {
|
|
1629
|
+
class UsaMilestones extends Base {
|
|
1630
|
+
constructor() {
|
|
1631
|
+
super(...arguments);
|
|
1632
|
+
this._items = [];
|
|
1633
|
+
this._fill = null;
|
|
1634
|
+
this._reached = -1;
|
|
1635
|
+
this._raf = 0;
|
|
1636
|
+
}
|
|
1637
|
+
static get observedAttributes() {
|
|
1638
|
+
return ['layout'];
|
|
1639
|
+
}
|
|
1640
|
+
get reached() {
|
|
1641
|
+
return this._reached;
|
|
1642
|
+
}
|
|
1643
|
+
mount() {
|
|
1644
|
+
this.dataset.layout = this.str('layout', 'alternate') === 'left' ? 'left' : 'alternate';
|
|
1645
|
+
this.setAttribute('role', this.getAttribute('role') || 'list');
|
|
1646
|
+
this.querySelectorAll(':scope > .usa-ms-rail').forEach((n) => n.remove());
|
|
1647
|
+
const rail = part('div', 'usa-ms-rail', { 'aria-hidden': 'true' });
|
|
1648
|
+
this._fill = part('div', 'usa-ms-fill');
|
|
1649
|
+
rail.append(this._fill);
|
|
1650
|
+
this.prepend(rail);
|
|
1651
|
+
this._items = ownChildren(this, '[data-usa-part],.usa-ms-rail');
|
|
1652
|
+
this._items.forEach((it, i) => {
|
|
1653
|
+
it.classList.add('usa-ms-item');
|
|
1654
|
+
it.setAttribute('role', 'listitem');
|
|
1655
|
+
it.dataset.side = this.dataset.layout === 'left' || i % 2 === 0 ? 'right' : 'left';
|
|
1656
|
+
if (!it.querySelector(':scope > .usa-ms-dot'))
|
|
1657
|
+
it.prepend(part('span', 'usa-ms-dot', { 'aria-hidden': 'true' }));
|
|
1658
|
+
const date = it.dataset.date;
|
|
1659
|
+
if (date && !it.querySelector(':scope > .usa-ms-date'))
|
|
1660
|
+
it.querySelector(':scope > .usa-ms-dot').after(part('span', 'usa-ms-date', {}, ''));
|
|
1661
|
+
const d = it.querySelector(':scope > .usa-ms-date');
|
|
1662
|
+
if (d && date)
|
|
1663
|
+
d.textContent = date;
|
|
1664
|
+
});
|
|
1665
|
+
this._reached = -1;
|
|
1666
|
+
if (this.reduced) {
|
|
1667
|
+
this._fill.style.transform = 'scaleY(1)';
|
|
1668
|
+
this._items.forEach((it) => it.setAttribute('data-reached', ''));
|
|
1669
|
+
this._reached = this._items.length - 1;
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
const on = () => {
|
|
1673
|
+
if (!this._raf)
|
|
1674
|
+
this._raf = typeof requestAnimationFrame === 'function' ? requestAnimationFrame(() => this.update()) : (this.update(), 0);
|
|
1675
|
+
};
|
|
1676
|
+
this.listen(window, 'scroll', on, { passive: true });
|
|
1677
|
+
this.listen(window, 'resize', on);
|
|
1678
|
+
this.onCleanup(() => {
|
|
1679
|
+
if (this._raf && typeof cancelAnimationFrame === 'function')
|
|
1680
|
+
cancelAnimationFrame(this._raf);
|
|
1681
|
+
});
|
|
1682
|
+
this.update();
|
|
1683
|
+
}
|
|
1684
|
+
/** Fill the rail up to the viewport's 60 % line and reveal the milestones it passed. */
|
|
1685
|
+
update() {
|
|
1686
|
+
this._raf = 0;
|
|
1687
|
+
const r = this.getBoundingClientRect();
|
|
1688
|
+
const vh = (typeof window !== 'undefined' && window.innerHeight) || 800;
|
|
1689
|
+
const line = vh * 0.6;
|
|
1690
|
+
const p = r.height ? Math.min(1, Math.max(0, (line - r.top) / r.height)) : 0;
|
|
1691
|
+
if (this._fill)
|
|
1692
|
+
this._fill.style.transform = `scaleY(${p.toFixed(4)})`;
|
|
1693
|
+
this._items.forEach((it, i) => {
|
|
1694
|
+
if (it.hasAttribute('data-reached'))
|
|
1695
|
+
return;
|
|
1696
|
+
const top = it.getBoundingClientRect().top;
|
|
1697
|
+
if (top < line || p >= 1) {
|
|
1698
|
+
it.setAttribute('data-reached', '');
|
|
1699
|
+
const card = Array.from(it.children).filter((c) => !c.matches('.usa-ms-dot,.usa-ms-date'));
|
|
1700
|
+
const dot = it.querySelector(':scope > .usa-ms-dot');
|
|
1701
|
+
if (dot)
|
|
1702
|
+
this.motion(dot, [{ transform: 'scale(0)' }, { transform: 'scale(1.5)', offset: 0.6 }, { transform: 'scale(1)' }], { duration: 420, easing: 'cubic-bezier(.3,1.4,.5,1)' });
|
|
1703
|
+
const dx = it.dataset.side === 'left' ? -28 : 28;
|
|
1704
|
+
card.forEach((c, k) => this.motion(c, [{ opacity: 0, transform: `translateX(${dx}px)` }, { opacity: 1, transform: 'none' }], { duration: 520, delay: 80 + k * 60, easing: 'cubic-bezier(.22,1,.36,1)', fill: 'backwards' }));
|
|
1705
|
+
if (i > this._reached)
|
|
1706
|
+
this._reached = i;
|
|
1707
|
+
this.emit('reach', { index: i });
|
|
1708
|
+
}
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
return UsaMilestones;
|
|
1713
|
+
}, { id: 'milestones', text: css$3 });
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
var css$2 = "usa-masonry-flow{position:relative;display:block;width:100%}usa-masonry-flow>*{position:absolute;left:0;top:0;box-sizing:border-box;margin:0;will-change:transform}usa-masonry-flow>[data-hidden]:not([data-leaving]){display:none}usa-masonry-flow>[data-leaving]{pointer-events:none}";
|
|
1717
|
+
|
|
1718
|
+
function defineMasonryFlow(tag = 'usa-masonry-flow') {
|
|
1719
|
+
return defineElement(tag, (Base) => {
|
|
1720
|
+
class UsaMasonryFlow extends Base {
|
|
1721
|
+
constructor() {
|
|
1722
|
+
super(...arguments);
|
|
1723
|
+
this._cols = 1;
|
|
1724
|
+
this._pos = new Map();
|
|
1725
|
+
this._busy = false;
|
|
1726
|
+
}
|
|
1727
|
+
static get observedAttributes() {
|
|
1728
|
+
return ['min', 'gap'];
|
|
1729
|
+
}
|
|
1730
|
+
get columns() {
|
|
1731
|
+
return this._cols;
|
|
1732
|
+
}
|
|
1733
|
+
items() {
|
|
1734
|
+
return ownChildren(this);
|
|
1735
|
+
}
|
|
1736
|
+
mount() {
|
|
1737
|
+
this.layout(false);
|
|
1738
|
+
if (typeof ResizeObserver === 'function') {
|
|
1739
|
+
let w = this.clientWidth;
|
|
1740
|
+
const ro = new ResizeObserver(() => {
|
|
1741
|
+
if (Math.abs(this.clientWidth - w) < 2)
|
|
1742
|
+
return;
|
|
1743
|
+
w = this.clientWidth;
|
|
1744
|
+
this.layout(true);
|
|
1745
|
+
});
|
|
1746
|
+
ro.observe(this);
|
|
1747
|
+
this.onCleanup(() => ro.disconnect());
|
|
1748
|
+
}
|
|
1749
|
+
if (typeof MutationObserver === 'function') {
|
|
1750
|
+
const mo = new MutationObserver(() => !this._busy && this.layout(true));
|
|
1751
|
+
mo.observe(this, { childList: true });
|
|
1752
|
+
this.onCleanup(() => mo.disconnect());
|
|
1753
|
+
}
|
|
1754
|
+
// images change heights when they load
|
|
1755
|
+
this.listen(this, 'load', () => this.layout(false), { capture: true });
|
|
1756
|
+
}
|
|
1757
|
+
layout(animate = true) {
|
|
1758
|
+
const gap = Math.max(0, this.num('gap', 12));
|
|
1759
|
+
const min = Math.max(60, this.num('min', 160));
|
|
1760
|
+
const W = this.clientWidth || 1;
|
|
1761
|
+
const cols = Math.max(1, Math.floor((W + gap) / (min + gap)));
|
|
1762
|
+
const cw = (W - gap * (cols - 1)) / cols;
|
|
1763
|
+
const heights = new Array(cols).fill(0);
|
|
1764
|
+
const all = this.items();
|
|
1765
|
+
for (const it of all) {
|
|
1766
|
+
const hidden = it.hasAttribute('data-hidden');
|
|
1767
|
+
it.style.width = `${cw}px`;
|
|
1768
|
+
if (hidden)
|
|
1769
|
+
continue;
|
|
1770
|
+
const c = heights.indexOf(Math.min(...heights));
|
|
1771
|
+
const x = c * (cw + gap);
|
|
1772
|
+
const y = heights[c];
|
|
1773
|
+
heights[c] += (it.offsetHeight || 0) + gap;
|
|
1774
|
+
const old = this._pos.get(it);
|
|
1775
|
+
it.style.transform = `translate(${x.toFixed(1)}px,${y.toFixed(1)}px)`;
|
|
1776
|
+
if (animate && !this.reduced && old && (old[0] !== x || old[1] !== y)) {
|
|
1777
|
+
this.motion(it, [{ transform: `translate(${old[0].toFixed(1)}px,${old[1].toFixed(1)}px)` }, { transform: `translate(${x.toFixed(1)}px,${y.toFixed(1)}px)` }], { duration: 520, easing: 'cubic-bezier(.22,1,.36,1)' });
|
|
1778
|
+
}
|
|
1779
|
+
else if (animate && !this.reduced && !old) {
|
|
1780
|
+
this.motion(it, [{ opacity: 0, transform: `translate(${x.toFixed(1)}px,${(y + 20).toFixed(1)}px) scale(.9)` }, { opacity: 1, transform: `translate(${x.toFixed(1)}px,${y.toFixed(1)}px)` }], { duration: 420, easing: 'cubic-bezier(.22,1,.36,1)' });
|
|
1781
|
+
}
|
|
1782
|
+
this._pos.set(it, [x, y]);
|
|
1783
|
+
}
|
|
1784
|
+
for (const k of Array.from(this._pos.keys()))
|
|
1785
|
+
if (!all.includes(k) || k.hasAttribute('data-hidden'))
|
|
1786
|
+
this._pos.delete(k);
|
|
1787
|
+
this.style.height = `${Math.max(0, Math.max(...heights) - gap)}px`;
|
|
1788
|
+
const changed = cols !== this._cols;
|
|
1789
|
+
this._cols = cols;
|
|
1790
|
+
if (changed || animate)
|
|
1791
|
+
this.emit('layout', { columns: cols });
|
|
1792
|
+
}
|
|
1793
|
+
filter(fn) {
|
|
1794
|
+
const test = typeof fn === 'string' ? (el) => el.matches(fn) : fn || (() => true);
|
|
1795
|
+
for (const it of this.items()) {
|
|
1796
|
+
const show = test(it);
|
|
1797
|
+
const was = !it.hasAttribute('data-hidden');
|
|
1798
|
+
if (show === was)
|
|
1799
|
+
continue;
|
|
1800
|
+
if (show)
|
|
1801
|
+
it.removeAttribute('data-hidden');
|
|
1802
|
+
else if (this.reduced)
|
|
1803
|
+
it.setAttribute('data-hidden', '');
|
|
1804
|
+
else {
|
|
1805
|
+
const tf = it.style.transform;
|
|
1806
|
+
const a = this.motion(it, [{ opacity: 1, transform: tf }, { opacity: 0, transform: `${tf} scale(.6)` }], { duration: 260, easing: 'ease-in' });
|
|
1807
|
+
it.setAttribute('data-hidden', '');
|
|
1808
|
+
if (a) {
|
|
1809
|
+
it.setAttribute('data-leaving', '');
|
|
1810
|
+
const rm = () => it.removeAttribute('data-leaving');
|
|
1811
|
+
a.finished.then(rm, rm);
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
this.layout(true);
|
|
1816
|
+
}
|
|
1817
|
+
reorder(list) {
|
|
1818
|
+
this._busy = true;
|
|
1819
|
+
for (const it of list)
|
|
1820
|
+
this.append(it);
|
|
1821
|
+
this._busy = false;
|
|
1822
|
+
this.layout(true);
|
|
1823
|
+
}
|
|
1824
|
+
shuffle() {
|
|
1825
|
+
const list = this.items();
|
|
1826
|
+
for (let i = list.length - 1; i > 0; i--) {
|
|
1827
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
1828
|
+
[list[i], list[j]] = [list[j], list[i]];
|
|
1829
|
+
}
|
|
1830
|
+
this.reorder(list);
|
|
1831
|
+
}
|
|
1832
|
+
sort(compare) {
|
|
1833
|
+
this.reorder(this.items().sort(compare));
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
return UsaMasonryFlow;
|
|
1837
|
+
}, { id: 'masonry-flow', text: css$2 });
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
var css$1 = "usa-compare{position:relative;display:grid;overflow:hidden;border-radius:var(--usa-cmp-radius,14px);user-select:none;touch-action:pan-y;cursor:ew-resize;--usa-cmp-line:#fff;outline-offset:3px}usa-compare[data-orientation=\"vertical\"]{touch-action:pan-x;cursor:ns-resize}usa-compare>.usa-cmp-before,usa-compare>.usa-cmp-after{grid-area:1/1;display:block;width:100%;height:100%;object-fit:cover;pointer-events:none}.usa-cmp-handle{position:absolute;top:0;bottom:0;left:50%;width:0;z-index:2;pointer-events:none}.usa-cmp-handle::before{content:\"\";position:absolute;top:0;bottom:0;left:-1.5px;width:3px;background:var(--usa-cmp-line);box-shadow:0 0 8px rgba(0,0,0,.35)}usa-compare[data-orientation=\"vertical\"] .usa-cmp-handle{top:50%;bottom:auto;left:0;right:0;width:auto;height:0}usa-compare[data-orientation=\"vertical\"] .usa-cmp-handle::before{left:0;right:0;top:-1.5px;width:auto;height:3px}.usa-cmp-knob{position:absolute;top:50%;left:0;display:grid;place-items:center;width:40px;height:40px;margin:-20px 0 0 -20px;border-radius:50%;background:var(--usa-cmp-line);color:#111827;box-shadow:0 6px 18px rgba(0,0,0,.35);pointer-events:auto;cursor:grab;transition:transform .2s}usa-compare[data-orientation=\"vertical\"] .usa-cmp-knob{left:50%;top:0;transform:rotate(90deg)}usa-compare:active .usa-cmp-knob{transform:scale(.92)}usa-compare[data-orientation=\"vertical\"]:active .usa-cmp-knob{transform:rotate(90deg) scale(.92)}.usa-cmp-label{position:absolute;top:10px;z-index:1;padding:3px 9px;border-radius:999px;background:rgba(0,0,0,.55);color:#fff;font:600 12px/1.4 system-ui,sans-serif;pointer-events:none}.usa-cmp-label-b{left:10px}.usa-cmp-label-a{right:10px}";
|
|
1841
|
+
|
|
1842
|
+
function defineCompare(tag = 'usa-compare') {
|
|
1843
|
+
return defineElement(tag, (Base) => {
|
|
1844
|
+
class UsaCompare extends Base {
|
|
1845
|
+
constructor() {
|
|
1846
|
+
super(...arguments);
|
|
1847
|
+
this._p = 50;
|
|
1848
|
+
this._after = null;
|
|
1849
|
+
this._handle = null;
|
|
1850
|
+
}
|
|
1851
|
+
static get observedAttributes() {
|
|
1852
|
+
return ['orientation', 'labels'];
|
|
1853
|
+
}
|
|
1854
|
+
get position() {
|
|
1855
|
+
return this._p;
|
|
1856
|
+
}
|
|
1857
|
+
set position(v) {
|
|
1858
|
+
this.set(v, false);
|
|
1859
|
+
}
|
|
1860
|
+
get vertical() {
|
|
1861
|
+
return this.str('orientation', 'horizontal') === 'vertical';
|
|
1862
|
+
}
|
|
1863
|
+
mount() {
|
|
1864
|
+
this.querySelectorAll(':scope > [data-usa-part]').forEach((n) => n.remove());
|
|
1865
|
+
const [before, after] = ownChildren(this);
|
|
1866
|
+
this.dataset.orientation = this.vertical ? 'vertical' : 'horizontal';
|
|
1867
|
+
before?.classList.add('usa-cmp-before');
|
|
1868
|
+
after?.classList.add('usa-cmp-after');
|
|
1869
|
+
this._after = after || null;
|
|
1870
|
+
const [lb, la] = this.str('labels', '').split(',').map((s) => s.trim());
|
|
1871
|
+
if (lb)
|
|
1872
|
+
this.append(Object.assign(part('span', 'usa-cmp-label usa-cmp-label-b', { 'aria-hidden': 'true' }), { textContent: lb }));
|
|
1873
|
+
if (la)
|
|
1874
|
+
this.append(Object.assign(part('span', 'usa-cmp-label usa-cmp-label-a', { 'aria-hidden': 'true' }), { textContent: la }));
|
|
1875
|
+
const h = part('span', 'usa-cmp-handle', { 'aria-hidden': 'true' }, '<span class="usa-cmp-knob"><svg viewBox="0 0 24 24" width="18" height="18"><path d="M9 6l-6 6 6 6M15 6l6 6-6 6" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg></span>');
|
|
1876
|
+
this.append(h);
|
|
1877
|
+
this._handle = h;
|
|
1878
|
+
this.setAttribute('role', 'slider');
|
|
1879
|
+
this.tabIndex = 0;
|
|
1880
|
+
this.setAttribute('aria-valuemin', '0');
|
|
1881
|
+
this.setAttribute('aria-valuemax', '100');
|
|
1882
|
+
this.setAttribute('aria-orientation', this.vertical ? 'vertical' : 'horizontal');
|
|
1883
|
+
if (!this.hasAttribute('aria-label'))
|
|
1884
|
+
this.setAttribute('aria-label', this.str('label', 'Compare before and after'));
|
|
1885
|
+
this.set(this.num('position', 50), false);
|
|
1886
|
+
let drag = false;
|
|
1887
|
+
const at = (e) => {
|
|
1888
|
+
const r = this.getBoundingClientRect();
|
|
1889
|
+
return this.vertical ? ((e.clientY - r.top) / (r.height || 1)) * 100 : ((e.clientX - r.left) / (r.width || 1)) * 100;
|
|
1890
|
+
};
|
|
1891
|
+
this.listen(this, 'pointerdown', (e) => {
|
|
1892
|
+
drag = true;
|
|
1893
|
+
this.setPointerCapture?.(e.pointerId);
|
|
1894
|
+
this.set(at(e), true, !e.target.closest('.usa-cmp-handle'));
|
|
1895
|
+
});
|
|
1896
|
+
this.listen(this, 'pointermove', (e) => {
|
|
1897
|
+
if (drag || this.flag('hover'))
|
|
1898
|
+
this.set(at(e), true);
|
|
1899
|
+
});
|
|
1900
|
+
const up = () => (drag = false);
|
|
1901
|
+
this.listen(this, 'pointerup', up);
|
|
1902
|
+
this.listen(this, 'pointercancel', up);
|
|
1903
|
+
this.listen(this, 'keydown', (e) => {
|
|
1904
|
+
const map = { ArrowLeft: -2, ArrowDown: -2, ArrowRight: 2, ArrowUp: 2, PageDown: -10, PageUp: 10 };
|
|
1905
|
+
if (this.vertical)
|
|
1906
|
+
Object.assign(map, { ArrowDown: 2, ArrowUp: -2 });
|
|
1907
|
+
if (e.key === 'Home')
|
|
1908
|
+
this.set(0, true);
|
|
1909
|
+
else if (e.key === 'End')
|
|
1910
|
+
this.set(100, true);
|
|
1911
|
+
else if (e.key in map)
|
|
1912
|
+
this.set(this._p + map[e.key], true);
|
|
1913
|
+
else
|
|
1914
|
+
return;
|
|
1915
|
+
e.preventDefault();
|
|
1916
|
+
});
|
|
1917
|
+
if (this.flag('intro') && !this.reduced) {
|
|
1918
|
+
let played = false;
|
|
1919
|
+
this.inView((v) => {
|
|
1920
|
+
if (!v || played)
|
|
1921
|
+
return;
|
|
1922
|
+
played = true;
|
|
1923
|
+
const end = this._p;
|
|
1924
|
+
const t0 = performance.now();
|
|
1925
|
+
const step = (now) => {
|
|
1926
|
+
const k = Math.min(1, (now - t0) / 1400);
|
|
1927
|
+
this.paint(end + Math.sin(k * Math.PI * 2) * 22 * (1 - k));
|
|
1928
|
+
if (k < 1 && typeof requestAnimationFrame === 'function')
|
|
1929
|
+
requestAnimationFrame(step);
|
|
1930
|
+
else
|
|
1931
|
+
this.paint(end);
|
|
1932
|
+
};
|
|
1933
|
+
if (typeof requestAnimationFrame === 'function')
|
|
1934
|
+
requestAnimationFrame(step);
|
|
1935
|
+
}, { threshold: 0.5 });
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
paint(p) {
|
|
1939
|
+
const v = clampN(p, 0, 100);
|
|
1940
|
+
if (this._after)
|
|
1941
|
+
this._after.style.clipPath = this.vertical ? `inset(${v}% 0 0 0)` : `inset(0 0 0 ${v}%)`;
|
|
1942
|
+
if (this._handle)
|
|
1943
|
+
this._handle.style[this.vertical ? 'top' : 'left'] = `${v}%`;
|
|
1944
|
+
this.style.setProperty('--usa-cmp', `${v}%`);
|
|
1945
|
+
}
|
|
1946
|
+
set(p, user, ease = false) {
|
|
1947
|
+
const v = Math.round(clampN(p, 0, 100) * 10) / 10;
|
|
1948
|
+
const from = this._p;
|
|
1949
|
+
this._p = v;
|
|
1950
|
+
this.setAttribute('aria-valuenow', String(Math.round(v)));
|
|
1951
|
+
this.setAttribute('aria-valuetext', `${Math.round(v)}%`);
|
|
1952
|
+
if (ease && !this.reduced && this._after && this._handle) {
|
|
1953
|
+
const prop = this.vertical ? 'top' : 'left';
|
|
1954
|
+
const clip = (x) => (this.vertical ? `inset(${x}% 0 0 0)` : `inset(0 0 0 ${x}%)`);
|
|
1955
|
+
this.motion(this._after, [{ clipPath: clip(from) }, { clipPath: clip(v) }], { duration: 320, easing: 'cubic-bezier(.22,1,.36,1)' });
|
|
1956
|
+
this.motion(this._handle, [{ [prop]: `${from}%` }, { [prop]: `${v}%` }], { duration: 320, easing: 'cubic-bezier(.22,1,.36,1)' });
|
|
1957
|
+
}
|
|
1958
|
+
this.paint(v);
|
|
1959
|
+
if (user && from !== v)
|
|
1960
|
+
this.emit('change', { position: v });
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
return UsaCompare;
|
|
1964
|
+
}, { id: 'compare', text: css$1 });
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
var css = "usa-cube-gallery{position:relative;display:block;aspect-ratio:4/3;perspective:1100px;outline-offset:4px}.usa-cube-stage{position:absolute;inset:0;transform-style:preserve-3d;touch-action:pan-y}.usa-cube-face{position:absolute;inset:0;box-sizing:border-box;margin:0;backface-visibility:hidden;display:none;overflow:hidden;border-radius:var(--usa-cube-radius,14px)}.usa-cube-face[data-active]{display:block}.usa-cube-face>img{width:100%;height:100%;object-fit:cover;display:block}.usa-cube-btn{position:absolute;top:50%;z-index:2;width:34px;height:34px;margin-top:-17px;border:0;border-radius:50%;background:rgba(255,255,255,.85);color:#111827;font:700 20px/1 system-ui,sans-serif;cursor:pointer;box-shadow:0 4px 12px rgba(0,0,0,.25)}.usa-cube-prev{left:8px}.usa-cube-next{right:8px}.usa-cube-btn:focus-visible{outline:2px solid #7c5cff;outline-offset:2px}";
|
|
1968
|
+
|
|
1969
|
+
function defineCubeGallery(tag = 'usa-cube-gallery') {
|
|
1970
|
+
return defineElement(tag, (Base) => {
|
|
1971
|
+
class UsaCubeGallery extends Base {
|
|
1972
|
+
constructor() {
|
|
1973
|
+
super(...arguments);
|
|
1974
|
+
this._slides = [];
|
|
1975
|
+
this._i = 0;
|
|
1976
|
+
this._stage = null;
|
|
1977
|
+
this._busy = false;
|
|
1978
|
+
this._timer = 0;
|
|
1979
|
+
}
|
|
1980
|
+
static get observedAttributes() {
|
|
1981
|
+
return ['axis', 'autoplay'];
|
|
1982
|
+
}
|
|
1983
|
+
get index() {
|
|
1984
|
+
return this._i;
|
|
1985
|
+
}
|
|
1986
|
+
mount() {
|
|
1987
|
+
this.querySelectorAll(':scope > [data-usa-part]').forEach((n) => n.remove());
|
|
1988
|
+
this._slides = ownChildren(this);
|
|
1989
|
+
this.dataset.axis = this.str('axis', 'y') === 'x' ? 'x' : 'y';
|
|
1990
|
+
this.setAttribute('role', 'region');
|
|
1991
|
+
this.setAttribute('aria-roledescription', 'carousel');
|
|
1992
|
+
if (!this.hasAttribute('aria-label'))
|
|
1993
|
+
this.setAttribute('aria-label', this.str('label', 'Gallery'));
|
|
1994
|
+
this.tabIndex = 0;
|
|
1995
|
+
const stage = part('div', 'usa-cube-stage');
|
|
1996
|
+
this._slides.forEach((s, i) => {
|
|
1997
|
+
s.classList.add('usa-cube-face');
|
|
1998
|
+
s.setAttribute('role', 'group');
|
|
1999
|
+
s.setAttribute('aria-roledescription', 'slide');
|
|
2000
|
+
s.setAttribute('aria-label', `${i + 1} of ${this._slides.length}`);
|
|
2001
|
+
stage.append(s);
|
|
2002
|
+
});
|
|
2003
|
+
this.append(stage);
|
|
2004
|
+
this._stage = stage;
|
|
2005
|
+
const prev = part('button', 'usa-cube-btn usa-cube-prev', { type: 'button', 'aria-label': 'Previous slide' }, '‹');
|
|
2006
|
+
const next = part('button', 'usa-cube-btn usa-cube-next', { type: 'button', 'aria-label': 'Next slide' }, '›');
|
|
2007
|
+
this.append(prev, next);
|
|
2008
|
+
this.listen(prev, 'click', () => this.prev());
|
|
2009
|
+
this.listen(next, 'click', () => this.next());
|
|
2010
|
+
this.listen(this, 'keydown', (e) => {
|
|
2011
|
+
if (e.target !== this)
|
|
2012
|
+
return;
|
|
2013
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowDown')
|
|
2014
|
+
this.next();
|
|
2015
|
+
else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp')
|
|
2016
|
+
this.prev();
|
|
2017
|
+
else
|
|
2018
|
+
return;
|
|
2019
|
+
e.preventDefault();
|
|
2020
|
+
});
|
|
2021
|
+
let x0 = NaN;
|
|
2022
|
+
this.listen(stage, 'pointerdown', (e) => (x0 = this.dataset.axis === 'x' ? e.clientY : e.clientX));
|
|
2023
|
+
this.listen(stage, 'pointerup', (e) => {
|
|
2024
|
+
if (Number.isNaN(x0))
|
|
2025
|
+
return;
|
|
2026
|
+
const d = (this.dataset.axis === 'x' ? e.clientY : e.clientX) - x0;
|
|
2027
|
+
x0 = NaN;
|
|
2028
|
+
if (Math.abs(d) > 40)
|
|
2029
|
+
(d < 0 ? this.next() : this.prev());
|
|
2030
|
+
});
|
|
2031
|
+
this._i = Math.min(this._i, Math.max(0, this._slides.length - 1));
|
|
2032
|
+
this.show();
|
|
2033
|
+
const ms = this.num('autoplay', 0);
|
|
2034
|
+
if (ms > 0 && !this.reduced) {
|
|
2035
|
+
let hold = false;
|
|
2036
|
+
let vis = true;
|
|
2037
|
+
const pause = (v) => (hold = v);
|
|
2038
|
+
this.listen(this, 'pointerenter', () => pause(true));
|
|
2039
|
+
this.listen(this, 'pointerleave', () => pause(false));
|
|
2040
|
+
this.listen(this, 'focusin', () => pause(true));
|
|
2041
|
+
this.listen(this, 'focusout', () => pause(false));
|
|
2042
|
+
this.inView((v) => (vis = v));
|
|
2043
|
+
this._timer = setInterval(() => !hold && vis && this.next(), Math.max(1200, ms));
|
|
2044
|
+
this.onCleanup(() => this._timer && clearInterval(this._timer));
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
show() {
|
|
2048
|
+
this._slides.forEach((s, k) => {
|
|
2049
|
+
const on = k === this._i;
|
|
2050
|
+
s.toggleAttribute('data-active', on);
|
|
2051
|
+
s.inert = !on;
|
|
2052
|
+
s.style.transform = '';
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
goTo(i) {
|
|
2056
|
+
const n = this._slides.length;
|
|
2057
|
+
if (!n || this._busy)
|
|
2058
|
+
return;
|
|
2059
|
+
const to = ((i % n) + n) % n;
|
|
2060
|
+
if (to === this._i)
|
|
2061
|
+
return;
|
|
2062
|
+
const from = this._i;
|
|
2063
|
+
const dir = (to > from && !(from === 0 && to === n - 1)) || (from === n - 1 && to === 0) ? 1 : -1;
|
|
2064
|
+
const a = this._slides[from];
|
|
2065
|
+
const b = this._slides[to];
|
|
2066
|
+
this._i = to;
|
|
2067
|
+
this.emit('change', { index: to, from });
|
|
2068
|
+
if (this.reduced || !this._stage) {
|
|
2069
|
+
this.show();
|
|
2070
|
+
this.motion(b, [{ opacity: 0 }, { opacity: 1 }], { duration: 200 });
|
|
2071
|
+
return;
|
|
2072
|
+
}
|
|
2073
|
+
// b waits on the adjacent face; the stage turns by 90°
|
|
2074
|
+
const ax = this.dataset.axis === 'x' ? 'X' : 'Y';
|
|
2075
|
+
const half = `${(((ax === 'Y' ? this.offsetWidth : this.offsetHeight) || 280) / 2).toFixed(1)}px`;
|
|
2076
|
+
const faceB = ax === 'Y' ? `rotateY(${dir * 90}deg) translateZ(${half})` : `rotateX(${-dir * 90}deg) translateZ(${half})`;
|
|
2077
|
+
b.setAttribute('data-active', '');
|
|
2078
|
+
b.style.transform = faceB;
|
|
2079
|
+
a.style.transform = `translateZ(${half})`;
|
|
2080
|
+
this._busy = true;
|
|
2081
|
+
const turn = ax === 'Y' ? `rotateY(${-dir * 90}deg)` : `rotateX(${dir * 90}deg)`;
|
|
2082
|
+
const anim = this.motion(this._stage, [{ transform: `translateZ(-${half}) rotate${ax}(0deg)` }, { transform: `translateZ(-${half}) ${turn}` }], { duration: 780, easing: 'cubic-bezier(.65,.05,.3,1)' });
|
|
2083
|
+
const end = () => {
|
|
2084
|
+
this._busy = false;
|
|
2085
|
+
this.show();
|
|
2086
|
+
};
|
|
2087
|
+
if (anim)
|
|
2088
|
+
anim.finished.then(end, end);
|
|
2089
|
+
else
|
|
2090
|
+
end();
|
|
2091
|
+
}
|
|
2092
|
+
next() {
|
|
2093
|
+
this.goTo(this._i + 1);
|
|
2094
|
+
}
|
|
2095
|
+
prev() {
|
|
2096
|
+
this.goTo(this._i - 1);
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
return UsaCubeGallery;
|
|
2100
|
+
}, { id: 'cube-gallery', text: css });
|
|
1623
2101
|
}
|
|
1624
2102
|
|
|
1625
2103
|
/**
|
|
@@ -1639,6 +2117,7 @@ const WIDGETS = {
|
|
|
1639
2117
|
'6.2': { 'usa-carousel': defineCarousel, 'usa-tab-bar': defineTabBar, 'usa-disclosure': defineDisclosure, 'usa-stories': defineStories },
|
|
1640
2118
|
'6.3': { 'usa-toast-stack': defineToastStack, 'usa-modal': defineModal, 'usa-sheet': defineSheet, 'usa-menu': defineMenu },
|
|
1641
2119
|
'6.4': { 'usa-progress-ring': defineProgressRing, 'usa-odometer': defineOdometer, 'usa-skeleton-reveal': defineSkeletonReveal, 'usa-star-rating': defineStarRating },
|
|
2120
|
+
'6.5': { 'usa-milestones': defineMilestones, 'usa-masonry-flow': defineMasonryFlow, 'usa-compare': defineCompare, 'usa-cube-gallery': defineCubeGallery },
|
|
1642
2121
|
};
|
|
1643
2122
|
/** Every widget tag, in release order. */
|
|
1644
2123
|
const WIDGET_TAGS = Object.values(WIDGETS).flatMap((g) => Object.keys(g));
|
|
@@ -1650,5 +2129,5 @@ function defineWidgets(release) {
|
|
|
1650
2129
|
fn(tag);
|
|
1651
2130
|
}
|
|
1652
2131
|
|
|
1653
|
-
export { CAROUSEL_EFFECTS, MENU_EFFECTS, MODAL_EFFECTS, PROGRESS_VARIANTS, SHEET_SIDES, SKELETON_VARIANTS, TAB_INDICATORS, TOAST_POSITIONS, WIDGETS, WIDGET_TAGS, defineCarousel, defineDisclosure, defineMenu, defineModal, defineOdometer, defineProgressRing, defineSheet, defineSkeletonReveal, defineStarRating, defineStories, defineTabBar, defineToastStack, defineWidgets, stackToast };
|
|
2132
|
+
export { CAROUSEL_EFFECTS, MENU_EFFECTS, MODAL_EFFECTS, PROGRESS_VARIANTS, SHEET_SIDES, SKELETON_VARIANTS, TAB_INDICATORS, TOAST_POSITIONS, WIDGETS, WIDGET_TAGS, defineCarousel, defineCompare, defineCubeGallery, defineDisclosure, defineMasonryFlow, defineMenu, defineMilestones, defineModal, defineOdometer, defineProgressRing, defineSheet, defineSkeletonReveal, defineStarRating, defineStories, defineTabBar, defineToastStack, defineWidgets, stackToast };
|
|
1654
2133
|
//# sourceMappingURL=widgets.js.map
|