motionary 6.7.0 → 6.9.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 +38 -0
- package/bin/usa-codemod-7.mjs +91 -0
- package/dist/chunks/{base-DchG4q_S.js → base-D5MHqeDd.js} +2 -2
- package/dist/chunks/{base-DchG4q_S.js.map → base-D5MHqeDd.js.map} +1 -1
- package/dist/chunks/{core-DVyTlo9Q.js → core-DyJu5r5a.js} +2 -2
- package/dist/chunks/{core-DVyTlo9Q.js.map → core-DyJu5r5a.js.map} +1 -1
- package/dist/chunks/{core-D2vF8kZb.js → core-ZGo4hOEk.js} +2 -2
- package/dist/chunks/{core-D2vF8kZb.js.map → core-ZGo4hOEk.js.map} +1 -1
- package/dist/chunks/{fx-DUMVKSvg.js → fx-DlGRMJ-Z.js} +2 -2
- package/dist/chunks/{fx-DUMVKSvg.js.map → fx-DlGRMJ-Z.js.map} +1 -1
- package/dist/chunks/{gpu-BBRLgEzM.cjs → gpu-C2D4T9Q-.cjs} +9 -2
- package/dist/chunks/gpu-C2D4T9Q-.cjs.map +1 -0
- package/dist/chunks/{gpu-CsP2ZB3x.js → gpu-DPhMkJq6.js} +10 -4
- package/dist/chunks/gpu-DPhMkJq6.js.map +1 -0
- package/dist/chunks/player-DH3TIz-t.js +516 -0
- package/dist/chunks/player-DH3TIz-t.js.map +1 -0
- package/dist/chunks/player-PS6_FzNw.cjs +525 -0
- package/dist/chunks/player-PS6_FzNw.cjs.map +1 -0
- package/dist/chunks/{registry-D23neB4M.js → registry-CTLWeg-J.js} +2 -2
- package/dist/chunks/{registry-D23neB4M.js.map → registry-CTLWeg-J.js.map} +1 -1
- package/dist/chunks/{spring-BhoT09Qb.js → spring-B-9MZOrW.js} +2 -2
- package/dist/chunks/{spring-BhoT09Qb.js.map → spring-B-9MZOrW.js.map} +1 -1
- package/dist/chunks/{variants-C_hv_s23.js → variants-CoZn3k_5.js} +2 -2
- package/dist/chunks/{variants-C_hv_s23.js.map → variants-CoZn3k_5.js.map} +1 -1
- package/dist/components/a11y.js +2 -2
- package/dist/components/angular.js +7 -7
- package/dist/components/background.js +2 -2
- package/dist/components/bridge.js +1 -1
- package/dist/components/cards.js +2 -2
- package/dist/components/click.js +3 -3
- package/dist/components/depth.js +3 -3
- package/dist/components/effects.cjs +13 -522
- package/dist/components/effects.cjs.map +1 -1
- package/dist/components/effects.js +7 -515
- package/dist/components/effects.js.map +1 -1
- package/dist/components/feedback.js +1 -1
- package/dist/components/fx-3d.cjs +8 -2
- package/dist/components/fx-3d.cjs.map +1 -1
- package/dist/components/fx-3d.d.cts +3 -1
- package/dist/components/fx-3d.d.ts +3 -1
- package/dist/components/fx-3d.js +9 -4
- package/dist/components/fx-3d.js.map +1 -1
- package/dist/components/fx-focus.cjs +125 -0
- package/dist/components/fx-focus.cjs.map +1 -0
- package/dist/components/fx-focus.d.cts +65 -0
- package/dist/components/fx-focus.d.ts +65 -0
- package/dist/components/fx-focus.js +122 -0
- package/dist/components/fx-focus.js.map +1 -0
- package/dist/components/fx-gpu.cjs +3 -2
- package/dist/components/fx-gpu.cjs.map +1 -1
- package/dist/components/fx-gpu.d.cts +3 -1
- package/dist/components/fx-gpu.d.ts +3 -1
- package/dist/components/fx-gpu.js +3 -3
- package/dist/components/fx-light.cjs +8 -2
- package/dist/components/fx-light.cjs.map +1 -1
- package/dist/components/fx-light.d.cts +3 -1
- package/dist/components/fx-light.d.ts +3 -1
- package/dist/components/fx-light.js +9 -4
- package/dist/components/fx-light.js.map +1 -1
- package/dist/components/fx-morph.cjs +8 -2
- package/dist/components/fx-morph.cjs.map +1 -1
- package/dist/components/fx-morph.d.cts +3 -1
- package/dist/components/fx-morph.d.ts +3 -1
- package/dist/components/fx-morph.js +9 -4
- package/dist/components/fx-morph.js.map +1 -1
- package/dist/components/fx-physics.cjs +350 -0
- package/dist/components/fx-physics.cjs.map +1 -0
- package/dist/components/fx-physics.d.cts +94 -0
- package/dist/components/fx-physics.d.ts +94 -0
- package/dist/components/fx-physics.js +345 -0
- package/dist/components/fx-physics.js.map +1 -0
- package/dist/components/fx-text.cjs +8 -2
- package/dist/components/fx-text.cjs.map +1 -1
- package/dist/components/fx-text.d.cts +3 -1
- package/dist/components/fx-text.d.ts +3 -1
- package/dist/components/fx-text.js +9 -4
- package/dist/components/fx-text.js.map +1 -1
- package/dist/components/fx-transitions.cjs +8 -2
- package/dist/components/fx-transitions.cjs.map +1 -1
- package/dist/components/fx-transitions.d.cts +3 -1
- package/dist/components/fx-transitions.d.ts +3 -1
- package/dist/components/fx-transitions.js +10 -5
- package/dist/components/fx-transitions.js.map +1 -1
- package/dist/components/fx-weather.cjs +271 -0
- package/dist/components/fx-weather.cjs.map +1 -0
- package/dist/components/fx-weather.d.cts +72 -0
- package/dist/components/fx-weather.d.ts +72 -0
- package/dist/components/fx-weather.js +266 -0
- package/dist/components/fx-weather.js.map +1 -0
- package/dist/components/fx.js +5 -5
- package/dist/components/fx2.cjs +49 -10
- package/dist/components/fx2.cjs.map +1 -1
- package/dist/components/fx2.d.cts +181 -4
- package/dist/components/fx2.d.ts +181 -4
- package/dist/components/fx2.js +42 -22
- package/dist/components/fx2.js.map +1 -1
- package/dist/components/gesture.js +4 -4
- package/dist/components/interaction.cjs +1 -0
- package/dist/components/interaction.cjs.map +1 -1
- package/dist/components/interaction.js +2 -1
- package/dist/components/interaction.js.map +1 -1
- package/dist/components/layout.js +1 -1
- package/dist/components/lite.cjs +2 -0
- package/dist/components/lite.cjs.map +1 -1
- package/dist/components/lite.js +2 -0
- package/dist/components/lite.js.map +1 -1
- package/dist/components/marketplace.cjs +82 -0
- package/dist/components/marketplace.cjs.map +1 -0
- package/dist/components/marketplace.d.cts +108 -0
- package/dist/components/marketplace.d.ts +108 -0
- package/dist/components/marketplace.js +77 -0
- package/dist/components/marketplace.js.map +1 -0
- package/dist/components/packs.js +1 -1
- package/dist/components/page.js +3 -3
- package/dist/components/perf.js +2 -2
- package/dist/components/physics.js +3 -3
- package/dist/components/reveal.js +1 -1
- package/dist/components/solid.js +7 -7
- package/dist/components/svelte.js +7 -7
- package/dist/components/svg.js +1 -1
- package/dist/components/text.js +2 -2
- package/dist/components/timeline.js +3 -3
- package/dist/components/transitions.js +1 -1
- package/dist/components/ui.cjs +1 -0
- package/dist/components/ui.cjs.map +1 -1
- package/dist/components/ui.js +5 -4
- package/dist/components/ui.js.map +1 -1
- package/dist/components/vue.js +7 -7
- package/dist/components/webgl.js +1 -1
- package/dist/components/widgets.cjs +1189 -45
- package/dist/components/widgets.cjs.map +1 -1
- package/dist/components/widgets.d.cts +177 -2
- package/dist/components/widgets.d.ts +177 -2
- package/dist/components/widgets.js +1179 -48
- package/dist/components/widgets.js.map +1 -1
- package/dist/components.js +9 -9
- package/dist/components.umd.js +2 -2
- package/dist/components.umd.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/docs/ROADMAP.md +2 -2
- package/docs/components.md +55 -0
- package/docs/deprecations.md +4 -0
- package/docs/upgrading-7.md +33 -0
- package/package.json +43 -2
- package/dist/chunks/gpu-BBRLgEzM.cjs.map +0 -1
- package/dist/chunks/gpu-CsP2ZB3x.js.map +0 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { y as defineElement } from '../chunks/base-
|
|
2
|
-
import { d as springEasing } from '../chunks/spring-
|
|
1
|
+
import { y as defineElement } from '../chunks/base-D5MHqeDd.js';
|
|
2
|
+
import { d as springEasing } from '../chunks/spring-B-9MZOrW.js';
|
|
3
|
+
import { A as ANIMATION_FORMAT, c as createPlayer } from '../chunks/player-DH3TIz-t.js';
|
|
4
|
+
import '../chunks/registry-CTLWeg-J.js';
|
|
5
|
+
import '../chunks/core-DyJu5r5a.js';
|
|
6
|
+
import './tokens.js';
|
|
3
7
|
|
|
4
8
|
/** Helpers shared by the 6.x widgets (`motionary/components/widgets`). */
|
|
5
9
|
const clampN = (v, a, b) => Math.min(b, Math.max(a, v));
|
|
@@ -36,7 +40,7 @@ function arrowIndex(e, i, n, vertical = false) {
|
|
|
36
40
|
return -1;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
var css$
|
|
43
|
+
var css$t = "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
44
|
|
|
41
45
|
const CAROUSEL_EFFECTS = ['slide', 'fade', 'scale', 'cards'];
|
|
42
46
|
function defineCarousel(tag = 'usa-carousel') {
|
|
@@ -225,10 +229,10 @@ function defineCarousel(tag = 'usa-carousel') {
|
|
|
225
229
|
}
|
|
226
230
|
}
|
|
227
231
|
return UsaCarousel;
|
|
228
|
-
}, { id: 'carousel', text: css$
|
|
232
|
+
}, { id: 'carousel', text: css$t });
|
|
229
233
|
}
|
|
230
234
|
|
|
231
|
-
var css$
|
|
235
|
+
var css$s = "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
236
|
|
|
233
237
|
const TAB_INDICATORS = ['pill', 'underline', 'glow', 'gooey'];
|
|
234
238
|
function defineTabBar(tag = 'usa-tab-bar') {
|
|
@@ -341,10 +345,10 @@ function defineTabBar(tag = 'usa-tab-bar') {
|
|
|
341
345
|
}
|
|
342
346
|
}
|
|
343
347
|
return UsaTabBar;
|
|
344
|
-
}, { id: 'tab-bar', text: css$
|
|
348
|
+
}, { id: 'tab-bar', text: css$s });
|
|
345
349
|
}
|
|
346
350
|
|
|
347
|
-
var css$
|
|
351
|
+
var css$r = "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
352
|
|
|
349
353
|
function defineDisclosure(tag = 'usa-disclosure') {
|
|
350
354
|
return defineElement(tag, (Base) => {
|
|
@@ -412,10 +416,10 @@ function defineDisclosure(tag = 'usa-disclosure') {
|
|
|
412
416
|
}
|
|
413
417
|
}
|
|
414
418
|
return UsaDisclosure;
|
|
415
|
-
}, { id: 'disclosure', text: css$
|
|
419
|
+
}, { id: 'disclosure', text: css$r });
|
|
416
420
|
}
|
|
417
421
|
|
|
418
|
-
var css$
|
|
422
|
+
var css$q = "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
423
|
|
|
420
424
|
function defineStories(tag = 'usa-stories') {
|
|
421
425
|
return defineElement(tag, (Base) => {
|
|
@@ -548,10 +552,10 @@ function defineStories(tag = 'usa-stories') {
|
|
|
548
552
|
}
|
|
549
553
|
}
|
|
550
554
|
return UsaStories;
|
|
551
|
-
}, { id: 'stories', text: css$
|
|
555
|
+
}, { id: 'stories', text: css$q });
|
|
552
556
|
}
|
|
553
557
|
|
|
554
|
-
var css$
|
|
558
|
+
var css$p = "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
559
|
|
|
556
560
|
const MODAL_EFFECTS = ['scale', 'slide-up', 'flip', 'origin'];
|
|
557
561
|
const SHEET_SIDES = ['right', 'left', 'bottom', 'top'];
|
|
@@ -778,12 +782,12 @@ function defineOverlay(tag, kind) {
|
|
|
778
782
|
}
|
|
779
783
|
}
|
|
780
784
|
return UsaOverlay;
|
|
781
|
-
}, { id: 'overlay', text: css$
|
|
785
|
+
}, { id: 'overlay', text: css$p });
|
|
782
786
|
}
|
|
783
787
|
const defineModal = (tag = 'usa-modal') => defineOverlay(tag, 'modal');
|
|
784
788
|
const defineSheet = (tag = 'usa-sheet') => defineOverlay(tag, 'sheet');
|
|
785
789
|
|
|
786
|
-
var css$
|
|
790
|
+
var css$o = "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
791
|
|
|
788
792
|
const TOAST_POSITIONS = ['bottom-right', 'bottom-left', 'bottom-center', 'top-right', 'top-left', 'top-center'];
|
|
789
793
|
const ICONS = { info: 'ℹ', success: '✓', warning: '!', error: '✕' };
|
|
@@ -954,7 +958,7 @@ function defineToastStack(tag = 'usa-toast-stack') {
|
|
|
954
958
|
}
|
|
955
959
|
}
|
|
956
960
|
return UsaToastStack;
|
|
957
|
-
}, { id: 'toast', text: css$
|
|
961
|
+
}, { id: 'toast', text: css$o });
|
|
958
962
|
}
|
|
959
963
|
/** Show a toast on the first `<usa-toast-stack>` of the page (one is created when missing). */
|
|
960
964
|
function stackToast(input, stack) {
|
|
@@ -982,7 +986,7 @@ function installToastTriggers() {
|
|
|
982
986
|
});
|
|
983
987
|
}
|
|
984
988
|
|
|
985
|
-
var css$
|
|
989
|
+
var css$n = "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
990
|
|
|
987
991
|
const MENU_EFFECTS = ['scale', 'fold', 'slide'];
|
|
988
992
|
function defineMenu(tag = 'usa-menu') {
|
|
@@ -1121,10 +1125,10 @@ function defineMenu(tag = 'usa-menu') {
|
|
|
1121
1125
|
}
|
|
1122
1126
|
}
|
|
1123
1127
|
return UsaMenu;
|
|
1124
|
-
}, { id: 'menu', text: css$
|
|
1128
|
+
}, { id: 'menu', text: css$n });
|
|
1125
1129
|
}
|
|
1126
1130
|
|
|
1127
|
-
var css$
|
|
1131
|
+
var css$m = "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
1132
|
|
|
1129
1133
|
const PROGRESS_VARIANTS = ['ring', 'bar', 'semi'];
|
|
1130
1134
|
const NS = 'http://www.w3.org/2000/svg';
|
|
@@ -1264,7 +1268,7 @@ function defineProgressRing(tag = 'usa-progress-ring') {
|
|
|
1264
1268
|
}
|
|
1265
1269
|
}
|
|
1266
1270
|
return UsaProgressRing;
|
|
1267
|
-
}, { id: 'meters', text: css$
|
|
1271
|
+
}, { id: 'meters', text: css$m });
|
|
1268
1272
|
}
|
|
1269
1273
|
function defineOdometer(tag = 'usa-odometer') {
|
|
1270
1274
|
return defineElement(tag, (Base) => {
|
|
@@ -1374,10 +1378,10 @@ function defineOdometer(tag = 'usa-odometer') {
|
|
|
1374
1378
|
}
|
|
1375
1379
|
}
|
|
1376
1380
|
return UsaOdometer;
|
|
1377
|
-
}, { id: 'meters', text: css$
|
|
1381
|
+
}, { id: 'meters', text: css$m });
|
|
1378
1382
|
}
|
|
1379
1383
|
|
|
1380
|
-
var css$
|
|
1384
|
+
var css$l = "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
1385
|
|
|
1382
1386
|
const SKELETON_VARIANTS = ['wave', 'pulse', 'glow'];
|
|
1383
1387
|
function defineSkeletonReveal(tag = 'usa-skeleton-reveal') {
|
|
@@ -1492,10 +1496,10 @@ function defineSkeletonReveal(tag = 'usa-skeleton-reveal') {
|
|
|
1492
1496
|
}
|
|
1493
1497
|
}
|
|
1494
1498
|
return UsaSkeletonReveal;
|
|
1495
|
-
}, { id: 'skeleton-reveal', text: css$
|
|
1499
|
+
}, { id: 'skeleton-reveal', text: css$l });
|
|
1496
1500
|
}
|
|
1497
1501
|
|
|
1498
|
-
var css$
|
|
1502
|
+
var css$k = "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
1503
|
|
|
1500
1504
|
const PATHS = {
|
|
1501
1505
|
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,10 +1623,10 @@ function defineStarRating(tag = 'usa-star-rating') {
|
|
|
1619
1623
|
}
|
|
1620
1624
|
}
|
|
1621
1625
|
return UsaStarRating;
|
|
1622
|
-
}, { id: 'star-rating', text: css$
|
|
1626
|
+
}, { id: 'star-rating', text: css$k });
|
|
1623
1627
|
}
|
|
1624
1628
|
|
|
1625
|
-
var css$
|
|
1629
|
+
var css$j = "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
1630
|
|
|
1627
1631
|
function defineMilestones(tag = 'usa-milestones') {
|
|
1628
1632
|
return defineElement(tag, (Base) => {
|
|
@@ -1710,10 +1714,10 @@ function defineMilestones(tag = 'usa-milestones') {
|
|
|
1710
1714
|
}
|
|
1711
1715
|
}
|
|
1712
1716
|
return UsaMilestones;
|
|
1713
|
-
}, { id: 'milestones', text: css$
|
|
1717
|
+
}, { id: 'milestones', text: css$j });
|
|
1714
1718
|
}
|
|
1715
1719
|
|
|
1716
|
-
var css$
|
|
1720
|
+
var css$i = "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
1721
|
|
|
1718
1722
|
function defineMasonryFlow(tag = 'usa-masonry-flow') {
|
|
1719
1723
|
return defineElement(tag, (Base) => {
|
|
@@ -1834,10 +1838,10 @@ function defineMasonryFlow(tag = 'usa-masonry-flow') {
|
|
|
1834
1838
|
}
|
|
1835
1839
|
}
|
|
1836
1840
|
return UsaMasonryFlow;
|
|
1837
|
-
}, { id: 'masonry-flow', text: css$
|
|
1841
|
+
}, { id: 'masonry-flow', text: css$i });
|
|
1838
1842
|
}
|
|
1839
1843
|
|
|
1840
|
-
var css$
|
|
1844
|
+
var css$h = "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
1845
|
|
|
1842
1846
|
function defineCompare(tag = 'usa-compare') {
|
|
1843
1847
|
return defineElement(tag, (Base) => {
|
|
@@ -1961,10 +1965,10 @@ function defineCompare(tag = 'usa-compare') {
|
|
|
1961
1965
|
}
|
|
1962
1966
|
}
|
|
1963
1967
|
return UsaCompare;
|
|
1964
|
-
}, { id: 'compare', text: css$
|
|
1968
|
+
}, { id: 'compare', text: css$h });
|
|
1965
1969
|
}
|
|
1966
1970
|
|
|
1967
|
-
var css$
|
|
1971
|
+
var css$g = "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
1972
|
|
|
1969
1973
|
function defineCubeGallery(tag = 'usa-cube-gallery') {
|
|
1970
1974
|
return defineElement(tag, (Base) => {
|
|
@@ -2097,10 +2101,10 @@ function defineCubeGallery(tag = 'usa-cube-gallery') {
|
|
|
2097
2101
|
}
|
|
2098
2102
|
}
|
|
2099
2103
|
return UsaCubeGallery;
|
|
2100
|
-
}, { id: 'cube-gallery', text: css$
|
|
2104
|
+
}, { id: 'cube-gallery', text: css$g });
|
|
2101
2105
|
}
|
|
2102
2106
|
|
|
2103
|
-
var css$
|
|
2107
|
+
var css$f = "usa-dock{display:inline-flex;align-items:flex-end;gap:var(--usa-dock-gap,8px);padding:8px 10px;border-radius:20px;background:var(--usa-dock-bg,rgba(255,255,255,.55));-webkit-backdrop-filter:blur(14px) saturate(1.6);backdrop-filter:blur(14px) saturate(1.6);box-shadow:0 10px 30px -10px rgba(0,0,0,.35),inset 0 0 0 1px rgba(255,255,255,.45);--usa-dock-size:44px}usa-dock[data-orientation=\"vertical\"]{flex-direction:column;align-items:flex-start}.usa-dock-item{--usa-dock-s:1;position:relative;display:grid;place-items:center;flex:none;width:calc(var(--usa-dock-size) * var(--usa-dock-s));height:calc(var(--usa-dock-size) * var(--usa-dock-s));border:0;padding:0;border-radius:calc(var(--usa-dock-size) * .26 * var(--usa-dock-s));background:var(--usa-dock-item,linear-gradient(135deg,#7c5cff,#22d3ee));color:#fff;font-size:calc(var(--usa-dock-size) * .5 * var(--usa-dock-s));text-decoration:none;cursor:pointer;transition:width .12s ease-out,height .12s ease-out,font-size .12s ease-out,border-radius .12s;box-shadow:0 4px 10px rgba(0,0,0,.18)}.usa-dock-item:focus-visible{outline:2px solid #7c5cff;outline-offset:3px}.usa-dock-item[data-label]::after{content:attr(data-label);position:absolute;bottom:calc(100% + 8px);left:50%;transform:translateX(-50%) translateY(4px);padding:3px 8px;border-radius:6px;background:rgba(17,24,39,.9);color:#fff;font:500 12px/1.3 system-ui,sans-serif;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s,transform .15s}.usa-dock-item[data-near]::after,.usa-dock-item:focus-visible::after{opacity:1;transform:translateX(-50%)}usa-dock[data-orientation=\"vertical\"] .usa-dock-item[data-label]::after{bottom:auto;left:calc(100% + 8px);top:50%;transform:translateY(-50%)}@media (prefers-reduced-motion:reduce){.usa-dock-item{transition:none}}";
|
|
2104
2108
|
|
|
2105
2109
|
function defineDock(tag = 'usa-dock') {
|
|
2106
2110
|
return defineElement(tag, (Base) => {
|
|
@@ -2168,10 +2172,10 @@ function defineDock(tag = 'usa-dock') {
|
|
|
2168
2172
|
}
|
|
2169
2173
|
}
|
|
2170
2174
|
return UsaDock;
|
|
2171
|
-
}, { id: 'dock', text: css$
|
|
2175
|
+
}, { id: 'dock', text: css$f });
|
|
2172
2176
|
}
|
|
2173
2177
|
|
|
2174
|
-
var css$
|
|
2178
|
+
var css$e = "usa-nav-morph{position:relative;display:flex;gap:4px;align-items:center;isolation:isolate;--usa-nm-color:#7c5cff;flex-wrap:nowrap;max-width:100%;overflow-x:auto;scrollbar-width:none}usa-nav-morph::-webkit-scrollbar{display:none}usa-nav-morph>:not(.usa-nm-ink){position:relative;z-index:1;flex:none;padding:8px 12px;border-radius:10px;color:inherit;text-decoration:none;font-weight:600;white-space:nowrap;transition:color .25s;outline-offset:2px}.usa-nm-ink{position:absolute;left:0;z-index:0;width:0;pointer-events:none;background:var(--usa-nm-color)}usa-nav-morph[data-indicator=\"underline\"] .usa-nm-ink{bottom:0;height:3px;border-radius:3px}usa-nav-morph[data-indicator=\"pill\"] .usa-nm-ink,usa-nav-morph[data-indicator=\"blob\"] .usa-nm-ink{top:0;bottom:0;border-radius:10px;opacity:.16}usa-nav-morph[data-indicator=\"blob\"] .usa-nm-ink{border-radius:999px;opacity:.2}usa-nav-morph[data-indicator=\"dot\"] .usa-nm-ink{bottom:0;height:6px;background:radial-gradient(circle,var(--usa-nm-color) 3px,transparent 3.5px)}usa-nav-morph>[aria-current=\"page\"]{color:var(--usa-nm-color)}";
|
|
2175
2179
|
|
|
2176
2180
|
const NAV_INDICATORS = ['underline', 'pill', 'blob', 'dot'];
|
|
2177
2181
|
function defineNavMorph(tag = 'usa-nav-morph') {
|
|
@@ -2275,10 +2279,10 @@ function defineNavMorph(tag = 'usa-nav-morph') {
|
|
|
2275
2279
|
}
|
|
2276
2280
|
}
|
|
2277
2281
|
return UsaNavMorph;
|
|
2278
|
-
}, { id: 'nav-morph', text: css$
|
|
2282
|
+
}, { id: 'nav-morph', text: css$e });
|
|
2279
2283
|
}
|
|
2280
2284
|
|
|
2281
|
-
var css$
|
|
2285
|
+
var css$d = "usa-menu-toggle{display:inline-grid;place-items:center;width:var(--usa-mt-size,44px);height:var(--usa-mt-size,44px);border-radius:12px;cursor:pointer;color:inherit;-webkit-tap-highlight-color:transparent;outline-offset:2px;--usa-mt-ease:cubic-bezier(.65,.05,.36,1)}usa-menu-toggle:hover{background:rgba(127,127,127,.12)}.usa-mt-box{position:relative;width:24px;height:18px}.usa-mt-bar{position:absolute;left:0;width:100%;height:2.5px;border-radius:2px;background:currentColor;transform-origin:50% 50%}.usa-mt-bar:nth-child(1){top:0}.usa-mt-bar:nth-child(2){top:7.75px}.usa-mt-bar:nth-child(3){bottom:0}usa-menu-toggle[data-animate] .usa-mt-bar{transition:transform .38s var(--usa-mt-ease),opacity .2s,top .38s var(--usa-mt-ease),bottom .38s var(--usa-mt-ease),width .38s var(--usa-mt-ease)}usa-menu-toggle[data-animate] .usa-mt-box{transition:transform .38s var(--usa-mt-ease)}usa-menu-toggle[data-variant=\"cross\"][data-open] .usa-mt-bar:nth-child(1),usa-menu-toggle[data-variant=\"plus-x\"][data-open] .usa-mt-bar:nth-child(1){top:7.75px;transform:rotate(45deg)}usa-menu-toggle[data-variant=\"cross\"][data-open] .usa-mt-bar:nth-child(2),usa-menu-toggle[data-variant=\"plus-x\"][data-open] .usa-mt-bar:nth-child(2){opacity:0;transform:scaleX(.2)}usa-menu-toggle[data-variant=\"cross\"][data-open] .usa-mt-bar:nth-child(3),usa-menu-toggle[data-variant=\"plus-x\"][data-open] .usa-mt-bar:nth-child(3){bottom:7.75px;transform:rotate(-45deg)}usa-menu-toggle[data-variant=\"plus-x\"][data-open] .usa-mt-box{transform:rotate(180deg)}usa-menu-toggle[data-variant=\"arrow\"][data-open] .usa-mt-bar:nth-child(1){width:55%;transform:translate(-2px,3.5px) rotate(-40deg)}usa-menu-toggle[data-variant=\"arrow\"][data-open] .usa-mt-bar:nth-child(3){width:55%;transform:translate(-2px,-3.5px) rotate(40deg)}usa-menu-toggle[data-variant=\"arrow\"][data-open] .usa-mt-box{transform:rotate(180deg)}usa-menu-toggle[data-variant=\"minus\"][data-open] .usa-mt-bar:nth-child(1){top:7.75px}usa-menu-toggle[data-variant=\"minus\"][data-open] .usa-mt-bar:nth-child(3){bottom:7.75px}";
|
|
2282
2286
|
|
|
2283
2287
|
const TOGGLE_VARIANTS = ['cross', 'arrow', 'minus', 'plus-x'];
|
|
2284
2288
|
function defineMenuToggle(tag = 'usa-menu-toggle') {
|
|
@@ -2351,10 +2355,10 @@ function defineMenuToggle(tag = 'usa-menu-toggle') {
|
|
|
2351
2355
|
}
|
|
2352
2356
|
}
|
|
2353
2357
|
return UsaMenuToggle;
|
|
2354
|
-
}, { id: 'menu-toggle', text: css$
|
|
2358
|
+
}, { id: 'menu-toggle', text: css$d });
|
|
2355
2359
|
}
|
|
2356
2360
|
|
|
2357
|
-
var css$
|
|
2361
|
+
var css$c = "usa-tip{position:relative;display:inline-block}.usa-tip-bubble{position:absolute;left:0;top:0;z-index:60;box-sizing:border-box;max-width:min(260px,calc(100vw - 16px));width:max-content;padding:7px 11px;border-radius:9px;background:var(--usa-tip-bg,#111827);color:var(--usa-tip-fg,#f9fafb);font:500 13px/1.4 system-ui,sans-serif;box-shadow:0 10px 26px -8px rgba(0,0,0,.4);text-align:left;white-space:normal}.usa-tip-bubble[hidden]{display:none}.usa-tip-bubble[data-placement=\"top\"]{transform-origin:50% 100%}.usa-tip-bubble[data-placement=\"bottom\"]{transform-origin:50% 0}.usa-tip-bubble[data-placement=\"left\"]{transform-origin:100% 50%}.usa-tip-bubble[data-placement=\"right\"]{transform-origin:0 50%}.usa-tip-arrow{position:absolute;width:10px;height:10px;background:inherit;transform:rotate(45deg)}.usa-tip-bubble[data-placement=\"top\"] .usa-tip-arrow{bottom:-4px;left:calc(50% - 5px + var(--usa-tip-shift,0px))}.usa-tip-bubble[data-placement=\"bottom\"] .usa-tip-arrow{top:-4px;left:calc(50% - 5px + var(--usa-tip-shift,0px))}.usa-tip-bubble[data-placement=\"left\"] .usa-tip-arrow{right:-4px;top:calc(50% - 5px)}.usa-tip-bubble[data-placement=\"right\"] .usa-tip-arrow{left:-4px;top:calc(50% - 5px)}";
|
|
2358
2362
|
|
|
2359
2363
|
const TIP_PLACEMENTS = ['top', 'bottom', 'left', 'right'];
|
|
2360
2364
|
const FLIP = { top: 'bottom', bottom: 'top', left: 'right', right: 'left' };
|
|
@@ -2486,10 +2490,10 @@ function defineTip(tag = 'usa-tip') {
|
|
|
2486
2490
|
}
|
|
2487
2491
|
}
|
|
2488
2492
|
return UsaTip;
|
|
2489
|
-
}, { id: 'tip', text: css$
|
|
2493
|
+
}, { id: 'tip', text: css$c });
|
|
2490
2494
|
}
|
|
2491
2495
|
|
|
2492
|
-
var css$
|
|
2496
|
+
var css$b = "usa-stepper{--usa-st-c:#7c5cff;--usa-st-size:30px;position:relative;display:flex;justify-content:space-between;gap:8px;padding:0;counter-reset:s;max-width:100%}usa-stepper[data-orientation=\"vertical\"]{flex-direction:column;gap:22px}.usa-st-rail{position:absolute;left:calc(var(--usa-st-size)/2);right:calc(var(--usa-st-size)/2);top:calc(var(--usa-st-size)/2 - 2px);height:4px;border-radius:4px;background:rgba(127,127,127,.25);pointer-events:none}usa-stepper[data-orientation=\"vertical\"] .usa-st-rail{left:calc(var(--usa-st-size)/2 - 2px);right:auto;top:calc(var(--usa-st-size)/2);bottom:calc(var(--usa-st-size)/2);width:4px;height:auto}.usa-st-fill{position:absolute;inset:0;border-radius:inherit;background:var(--usa-st-c);transform-origin:0 0;transform:scaleX(calc(var(--usa-st-p,0%) / 100%));transition:transform .55s cubic-bezier(.6,.05,.3,1)}usa-stepper[data-orientation=\"vertical\"] .usa-st-fill{transform:scaleY(calc(var(--usa-st-p,0%) / 100%))}.usa-st-step{position:relative;z-index:1;display:flex;flex-direction:column;align-items:center;gap:6px;min-width:0;font:600 12px/1.25 system-ui,sans-serif;text-align:center;color:rgba(127,127,127,.95)}usa-stepper[data-orientation=\"vertical\"] .usa-st-step{flex-direction:row;text-align:left}.usa-st-step[data-current],.usa-st-step[data-done]{color:inherit}.usa-st-dot{position:relative;display:grid;place-items:center;flex:none;width:var(--usa-st-size);height:var(--usa-st-size);border-radius:50%;background:var(--usa-st-bg,#fff);box-shadow:inset 0 0 0 2px rgba(127,127,127,.4);color:#666;font-weight:700;transition:background .3s,box-shadow .3s,color .3s}.usa-st-step[data-current] .usa-st-dot{box-shadow:inset 0 0 0 2px var(--usa-st-c);color:var(--usa-st-c)}.usa-st-step[data-done] .usa-st-dot{background:var(--usa-st-c);box-shadow:none;color:#fff}.usa-st-check{position:absolute;width:60%;height:60%;fill:none;stroke:#fff;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:20;stroke-dashoffset:20;opacity:0}.usa-st-step[data-done] .usa-st-check{stroke-dashoffset:0;opacity:1}.usa-st-step[data-done] .usa-st-num{opacity:0}.usa-st-step[data-clickable],usa-stepper[clickable] .usa-st-step{cursor:pointer}@media (prefers-reduced-motion:reduce){.usa-st-fill,.usa-st-dot{transition:none}}";
|
|
2493
2497
|
|
|
2494
2498
|
function defineStepper(tag = 'usa-stepper') {
|
|
2495
2499
|
return defineElement(tag, (Base) => {
|
|
@@ -2586,10 +2590,10 @@ function defineStepper(tag = 'usa-stepper') {
|
|
|
2586
2590
|
}
|
|
2587
2591
|
}
|
|
2588
2592
|
return UsaStepper;
|
|
2589
|
-
}, { id: 'stepper', text: css$
|
|
2593
|
+
}, { id: 'stepper', text: css$b });
|
|
2590
2594
|
}
|
|
2591
2595
|
|
|
2592
|
-
var css$
|
|
2596
|
+
var css$a = "usa-pagination{--usa-pg-c:#7c5cff;display:inline-flex;align-items:center;gap:4px;max-width:100%;font:600 14px/1 system-ui,sans-serif}.usa-pg-list{position:relative;display:inline-flex;align-items:center;gap:2px;isolation:isolate}.usa-pg-ink{position:absolute;left:0;top:0;height:100%;width:0;border-radius:10px;background:var(--usa-pg-c);z-index:-1;transition:width .3s}.usa-pg-btn{display:grid;place-items:center;min-width:34px;height:34px;padding:0 6px;border:0;border-radius:10px;background:none;color:inherit;font:inherit;cursor:pointer;transition:color .25s,background .2s}.usa-pg-btn:hover:not(:disabled):not([aria-current]){background:rgba(127,127,127,.14)}.usa-pg-btn[aria-current=\"page\"]{color:#fff}.usa-pg-btn:disabled{opacity:.35;cursor:default}.usa-pg-btn:focus-visible{outline:2px solid var(--usa-pg-c);outline-offset:2px}.usa-pg-gap{min-width:20px;text-align:center;opacity:.6}@media (max-width:420px){.usa-pg-btn{min-width:28px;height:30px;padding:0 3px}}@media (prefers-reduced-motion:reduce){.usa-pg-ink{transition:none}}";
|
|
2593
2597
|
|
|
2594
2598
|
/** The visible page list: numbers and `'…'` gaps (1-based). */
|
|
2595
2599
|
function pageWindow(page, total, siblings = 1) {
|
|
@@ -2711,10 +2715,10 @@ function definePagination(tag = 'usa-pagination') {
|
|
|
2711
2715
|
}
|
|
2712
2716
|
}
|
|
2713
2717
|
return UsaPagination;
|
|
2714
|
-
}, { id: 'pagination', text: css$
|
|
2718
|
+
}, { id: 'pagination', text: css$a });
|
|
2715
2719
|
}
|
|
2716
2720
|
|
|
2717
|
-
var css$
|
|
2721
|
+
var css$9 = "usa-segmented{--usa-seg-c:#7c5cff;position:relative;display:inline-flex;align-items:stretch;padding:3px;border-radius:12px;background:rgba(127,127,127,.16);isolation:isolate;max-width:100%;font:600 13px/1 system-ui,sans-serif}.usa-seg-thumb{position:absolute;top:3px;bottom:3px;left:3px;z-index:-1;border-radius:9px;background:var(--usa-seg-thumb,#fff);box-shadow:0 2px 8px rgba(0,0,0,.18),0 0 0 .5px rgba(0,0,0,.05);transform-origin:50% 50%}usa-segmented[data-variant=\"pill\"]{border-radius:999px}usa-segmented[data-variant=\"pill\"] .usa-seg-thumb{border-radius:999px;background:var(--usa-seg-c)}usa-segmented[data-variant=\"pill\"] .usa-seg-item[data-selected]{color:#fff}usa-segmented[data-variant=\"outline\"]{background:none;box-shadow:inset 0 0 0 1.5px rgba(127,127,127,.35)}usa-segmented[data-variant=\"outline\"] .usa-seg-thumb{background:none;box-shadow:inset 0 0 0 2px var(--usa-seg-c)}.usa-seg-item{flex:1 1 0;min-width:0;padding:8px 14px;border:0;border-radius:9px;background:none;color:inherit;font:inherit;white-space:nowrap;cursor:pointer;opacity:.7;transition:opacity .2s,transform .25s cubic-bezier(.3,1.4,.5,1),color .2s}.usa-seg-item[data-selected]{opacity:1;transform:scale(1.04)}.usa-seg-item:focus-visible{outline:2px solid var(--usa-seg-c);outline-offset:1px}@media (max-width:420px){.usa-seg-item{padding:8px 9px}}@media (prefers-reduced-motion:reduce){.usa-seg-item{transition:none}}";
|
|
2718
2722
|
|
|
2719
2723
|
const SEGMENTED_VARIANTS = ['ios', 'pill', 'outline'];
|
|
2720
2724
|
function defineSegmented(tag = 'usa-segmented') {
|
|
@@ -2808,10 +2812,10 @@ function defineSegmented(tag = 'usa-segmented') {
|
|
|
2808
2812
|
}
|
|
2809
2813
|
}
|
|
2810
2814
|
return UsaSegmented;
|
|
2811
|
-
}, { id: 'segmented', text: css$
|
|
2815
|
+
}, { id: 'segmented', text: css$9 });
|
|
2812
2816
|
}
|
|
2813
2817
|
|
|
2814
|
-
var css = "usa-switch{--usa-sw-c:#34c759;--usa-sw-w:52px;--usa-sw-h:30px;display:inline-flex;align-items:center;gap:8px;cursor:pointer;-webkit-tap-highlight-color:transparent;vertical-align:middle;outline-offset:3px;border-radius:999px}usa-switch[disabled]{opacity:.45;cursor:not-allowed}.usa-sw-track{position:relative;flex:none;width:var(--usa-sw-w);height:var(--usa-sw-h);border-radius:999px;background:rgba(127,127,127,.35);overflow:hidden;transition:background .3s}.usa-sw-fill{position:absolute;inset:0;border-radius:999px;background:var(--usa-sw-c);transform:scale(0);transform-origin:calc(var(--usa-sw-h)/2) 50%;transition:transform .35s cubic-bezier(.4,0,.2,1)}usa-switch[data-on] .usa-sw-fill{transform:scale(1)}.usa-sw-thumb{position:absolute;top:3px;left:3px;width:calc(var(--usa-sw-h) - 6px);height:calc(var(--usa-sw-h) - 6px);border-radius:999px;background:#fff;box-shadow:0 2px 6px rgba(0,0,0,.25);transition:left .32s cubic-bezier(.3,1.25,.5,1),width .2s ease,background .3s,box-shadow .3s}usa-switch[data-on] .usa-sw-thumb{left:calc(var(--usa-sw-w) - var(--usa-sw-h) + 3px)}usa-switch[data-variant=\"ios\"][data-press] .usa-sw-thumb{width:calc(var(--usa-sw-h) + 2px)}usa-switch[data-variant=\"ios\"][data-press][data-on] .usa-sw-thumb{left:calc(var(--usa-sw-w) - var(--usa-sw-h) - 5px)}usa-switch[data-variant=\"daynight\"]{--usa-sw-w:64px;--usa-sw-h:32px}usa-switch[data-variant=\"daynight\"] .usa-sw-track{background:linear-gradient(#7dd3fc,#38bdf8)}usa-switch[data-variant=\"daynight\"] .usa-sw-fill{background:linear-gradient(#1e1b4b,#312e81);transform:none;opacity:0;transition:opacity .45s}usa-switch[data-variant=\"daynight\"][data-on] .usa-sw-fill{opacity:1}usa-switch[data-variant=\"daynight\"] .usa-sw-thumb{background:radial-gradient(circle at 40% 40%,#fde68a,#f59e0b);box-shadow:0 0 10px #fbbf24}usa-switch[data-variant=\"daynight\"][data-on] .usa-sw-thumb{background:radial-gradient(circle at 65% 35%,transparent 5px,#e5e7eb 5.5px);box-shadow:0 0 8px rgba(255,255,255,.5)}usa-switch[data-variant=\"daynight\"] .usa-sw-deco{position:absolute;inset:0;background:radial-gradient(circle,#fff 1px,transparent 1.5px) 12px 8px/14px 11px;opacity:0;transform:translateY(6px);transition:opacity .4s,transform .5s}usa-switch[data-variant=\"daynight\"][data-on] .usa-sw-deco{opacity:.9;transform:none}usa-switch[data-variant=\"bounce\"] .usa-sw-thumb{transition:left .28s cubic-bezier(.5,0,.75,0)}usa-switch[data-variant=\"liquid\"] .usa-sw-fill{background:linear-gradient(90deg,#22d3ee,#7c5cff)}usa-switch[data-variant=\"liquid\"] .usa-sw-thumb{transition:left .5s cubic-bezier(.68,-.4,.27,1.4)}usa-switch:focus-visible .usa-sw-track{box-shadow:0 0 0 3px rgba(124,92,255,.5)}@media (prefers-reduced-motion:reduce){.usa-sw-thumb,.usa-sw-fill,.usa-sw-deco,.usa-sw-track{transition:none!important}}";
|
|
2818
|
+
var css$8 = "usa-switch{--usa-sw-c:#34c759;--usa-sw-w:52px;--usa-sw-h:30px;display:inline-flex;align-items:center;gap:8px;cursor:pointer;-webkit-tap-highlight-color:transparent;vertical-align:middle;outline-offset:3px;border-radius:999px}usa-switch[disabled]{opacity:.45;cursor:not-allowed}.usa-sw-track{position:relative;flex:none;width:var(--usa-sw-w);height:var(--usa-sw-h);border-radius:999px;background:rgba(127,127,127,.35);overflow:hidden;transition:background .3s}.usa-sw-fill{position:absolute;inset:0;border-radius:999px;background:var(--usa-sw-c);transform:scale(0);transform-origin:calc(var(--usa-sw-h)/2) 50%;transition:transform .35s cubic-bezier(.4,0,.2,1)}usa-switch[data-on] .usa-sw-fill{transform:scale(1)}.usa-sw-thumb{position:absolute;top:3px;left:3px;width:calc(var(--usa-sw-h) - 6px);height:calc(var(--usa-sw-h) - 6px);border-radius:999px;background:#fff;box-shadow:0 2px 6px rgba(0,0,0,.25);transition:left .32s cubic-bezier(.3,1.25,.5,1),width .2s ease,background .3s,box-shadow .3s}usa-switch[data-on] .usa-sw-thumb{left:calc(var(--usa-sw-w) - var(--usa-sw-h) + 3px)}usa-switch[data-variant=\"ios\"][data-press] .usa-sw-thumb{width:calc(var(--usa-sw-h) + 2px)}usa-switch[data-variant=\"ios\"][data-press][data-on] .usa-sw-thumb{left:calc(var(--usa-sw-w) - var(--usa-sw-h) - 5px)}usa-switch[data-variant=\"daynight\"]{--usa-sw-w:64px;--usa-sw-h:32px}usa-switch[data-variant=\"daynight\"] .usa-sw-track{background:linear-gradient(#7dd3fc,#38bdf8)}usa-switch[data-variant=\"daynight\"] .usa-sw-fill{background:linear-gradient(#1e1b4b,#312e81);transform:none;opacity:0;transition:opacity .45s}usa-switch[data-variant=\"daynight\"][data-on] .usa-sw-fill{opacity:1}usa-switch[data-variant=\"daynight\"] .usa-sw-thumb{background:radial-gradient(circle at 40% 40%,#fde68a,#f59e0b);box-shadow:0 0 10px #fbbf24}usa-switch[data-variant=\"daynight\"][data-on] .usa-sw-thumb{background:radial-gradient(circle at 65% 35%,transparent 5px,#e5e7eb 5.5px);box-shadow:0 0 8px rgba(255,255,255,.5)}usa-switch[data-variant=\"daynight\"] .usa-sw-deco{position:absolute;inset:0;background:radial-gradient(circle,#fff 1px,transparent 1.5px) 12px 8px/14px 11px;opacity:0;transform:translateY(6px);transition:opacity .4s,transform .5s}usa-switch[data-variant=\"daynight\"][data-on] .usa-sw-deco{opacity:.9;transform:none}usa-switch[data-variant=\"bounce\"] .usa-sw-thumb{transition:left .28s cubic-bezier(.5,0,.75,0)}usa-switch[data-variant=\"liquid\"] .usa-sw-fill{background:linear-gradient(90deg,#22d3ee,#7c5cff)}usa-switch[data-variant=\"liquid\"] .usa-sw-thumb{transition:left .5s cubic-bezier(.68,-.4,.27,1.4)}usa-switch:focus-visible .usa-sw-track{box-shadow:0 0 0 3px rgba(124,92,255,.5)}@media (prefers-reduced-motion:reduce){.usa-sw-thumb,.usa-sw-fill,.usa-sw-deco,.usa-sw-track{transition:none!important}}";
|
|
2815
2819
|
|
|
2816
2820
|
const SWITCH_VARIANTS = ['ios', 'daynight', 'bounce', 'liquid'];
|
|
2817
2821
|
function defineSwitch(tag = 'usa-switch') {
|
|
@@ -2899,7 +2903,1132 @@ function defineSwitch(tag = 'usa-switch') {
|
|
|
2899
2903
|
}
|
|
2900
2904
|
}
|
|
2901
2905
|
return UsaSwitch;
|
|
2902
|
-
}, { id: 'switch', text: css });
|
|
2906
|
+
}, { id: 'switch', text: css$8 });
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
var css$7 = "usa-kanban{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(140px,1fr);gap:12px;max-width:100%;overflow-x:auto;padding:4px;font:500 13px/1.35 system-ui,sans-serif}.usa-kb-col{display:flex;flex-direction:column;gap:8px;min-height:80px;padding:10px;border-radius:14px;background:rgba(127,127,127,.12);margin:0;list-style:none}.usa-kb-col>h1,.usa-kb-col>h2,.usa-kb-col>h3,.usa-kb-col>h4{margin:0 0 2px;font-size:12px;letter-spacing:.06em;text-transform:uppercase;opacity:.7}.usa-kb-card{padding:10px 12px;border-radius:10px;background:var(--usa-kb-card,#fff);color:#111;box-shadow:0 1px 3px rgba(0,0,0,.14);cursor:grab;touch-action:none;user-select:none;outline-offset:2px}.usa-kb-card:focus-visible{outline:2px solid #7c5cff}.usa-kb-lifted{cursor:grabbing;box-shadow:0 18px 30px -8px rgba(0,0,0,.35);transition:transform .12s}.usa-kb-held{outline:2px dashed #7c5cff;transform:scale(1.03)}.usa-kb-ph{border-radius:10px;border:2px dashed rgba(124,92,255,.5);background:rgba(124,92,255,.08)}.usa-kb-live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}@media (prefers-reduced-motion:reduce){.usa-kb-lifted,.usa-kb-held{transition:none;transform:none!important}}";
|
|
2910
|
+
|
|
2911
|
+
function defineKanban(tag = 'usa-kanban') {
|
|
2912
|
+
return defineElement(tag, (Base) => {
|
|
2913
|
+
class UsaKanban extends Base {
|
|
2914
|
+
constructor() {
|
|
2915
|
+
super(...arguments);
|
|
2916
|
+
this._cols = [];
|
|
2917
|
+
this._live = null;
|
|
2918
|
+
this._held = null;
|
|
2919
|
+
}
|
|
2920
|
+
get columns() {
|
|
2921
|
+
return this._cols;
|
|
2922
|
+
}
|
|
2923
|
+
cardsOf(col) {
|
|
2924
|
+
return Array.from(col.children).filter((c) => c instanceof HTMLElement && (c.hasAttribute('data-card') || c.localName === 'li'));
|
|
2925
|
+
}
|
|
2926
|
+
mount() {
|
|
2927
|
+
this._cols = ownChildren(this);
|
|
2928
|
+
this.setAttribute('role', 'group');
|
|
2929
|
+
if (!this.hasAttribute('aria-label'))
|
|
2930
|
+
this.setAttribute('aria-label', this.str('label', 'Board'));
|
|
2931
|
+
if (!this.querySelector(':scope > .usa-kb-live')) {
|
|
2932
|
+
const l = document.createElement('span');
|
|
2933
|
+
l.className = 'usa-kb-live';
|
|
2934
|
+
l.setAttribute('data-usa-part', '');
|
|
2935
|
+
l.setAttribute('aria-live', 'polite');
|
|
2936
|
+
this.appendChild(l);
|
|
2937
|
+
}
|
|
2938
|
+
this._live = this.querySelector('.usa-kb-live');
|
|
2939
|
+
this._cols.forEach((col) => {
|
|
2940
|
+
col.classList.add('usa-kb-col');
|
|
2941
|
+
col.setAttribute('role', 'list');
|
|
2942
|
+
const title = col.dataset.title || col.querySelector('h1,h2,h3,h4,h5,h6')?.textContent?.trim() || '';
|
|
2943
|
+
if (title)
|
|
2944
|
+
col.setAttribute('aria-label', title);
|
|
2945
|
+
this.cardsOf(col).forEach((c) => this.prepCard(c));
|
|
2946
|
+
});
|
|
2947
|
+
this.listen(this, 'pointerdown', (e) => this.drag(e));
|
|
2948
|
+
this.listen(this, 'keydown', (e) => this.key(e));
|
|
2949
|
+
}
|
|
2950
|
+
prepCard(c) {
|
|
2951
|
+
c.classList.add('usa-kb-card');
|
|
2952
|
+
c.setAttribute('role', 'listitem');
|
|
2953
|
+
if (!c.hasAttribute('tabindex'))
|
|
2954
|
+
c.tabIndex = 0;
|
|
2955
|
+
c.setAttribute('aria-roledescription', 'draggable card');
|
|
2956
|
+
}
|
|
2957
|
+
say(msg) {
|
|
2958
|
+
if (this._live)
|
|
2959
|
+
this._live.textContent = msg;
|
|
2960
|
+
}
|
|
2961
|
+
colName(col) {
|
|
2962
|
+
return col.getAttribute('aria-label') || `column ${this._cols.indexOf(col) + 1}`;
|
|
2963
|
+
}
|
|
2964
|
+
/** FLIP: run `change`, then glide every card from its old box. */
|
|
2965
|
+
flip(change) {
|
|
2966
|
+
const cards = this._cols.flatMap((c) => this.cardsOf(c));
|
|
2967
|
+
const before = new Map(cards.map((c) => [c, c.getBoundingClientRect()]));
|
|
2968
|
+
change();
|
|
2969
|
+
if (this.reduced)
|
|
2970
|
+
return;
|
|
2971
|
+
for (const c of cards) {
|
|
2972
|
+
const a = before.get(c);
|
|
2973
|
+
const b = c.getBoundingClientRect();
|
|
2974
|
+
const dx = a.left - b.left;
|
|
2975
|
+
const dy = a.top - b.top;
|
|
2976
|
+
if ((dx || dy) && c !== this._held)
|
|
2977
|
+
this.motion(c, [{ transform: `translate(${dx}px,${dy}px)` }, { transform: 'none' }], { duration: 260, easing: 'cubic-bezier(.2,.8,.2,1)' });
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
move(card, to, index) {
|
|
2981
|
+
const from = card.parentElement;
|
|
2982
|
+
const list = this.cardsOf(to).filter((c) => c !== card);
|
|
2983
|
+
const i = Math.max(0, Math.min(list.length, index));
|
|
2984
|
+
this.flip(() => {
|
|
2985
|
+
const ref = list[i] || null;
|
|
2986
|
+
if (ref)
|
|
2987
|
+
to.insertBefore(card, ref);
|
|
2988
|
+
else
|
|
2989
|
+
to.appendChild(card);
|
|
2990
|
+
});
|
|
2991
|
+
this.emit('move', { card, from, to, index: i });
|
|
2992
|
+
}
|
|
2993
|
+
drag(e) {
|
|
2994
|
+
const card = e.target.closest?.('.usa-kb-card');
|
|
2995
|
+
if (!card || !this.contains(card) || e.button > 0)
|
|
2996
|
+
return;
|
|
2997
|
+
const r = card.getBoundingClientRect();
|
|
2998
|
+
const ox = e.clientX - r.left;
|
|
2999
|
+
const oy = e.clientY - r.top;
|
|
3000
|
+
let started = false;
|
|
3001
|
+
let lastX = e.clientX;
|
|
3002
|
+
const ghost = card;
|
|
3003
|
+
const ph = document.createElement('div');
|
|
3004
|
+
ph.className = 'usa-kb-ph';
|
|
3005
|
+
ph.setAttribute('data-usa-part', '');
|
|
3006
|
+
const onMove = (ev) => {
|
|
3007
|
+
if (!started) {
|
|
3008
|
+
if (Math.hypot(ev.clientX - e.clientX, ev.clientY - e.clientY) < 6)
|
|
3009
|
+
return;
|
|
3010
|
+
started = true;
|
|
3011
|
+
ph.style.height = r.height + 'px';
|
|
3012
|
+
card.parentElement.insertBefore(ph, card);
|
|
3013
|
+
ghost.classList.add('usa-kb-lifted');
|
|
3014
|
+
ghost.style.width = r.width + 'px';
|
|
3015
|
+
ghost.style.position = 'fixed';
|
|
3016
|
+
ghost.style.zIndex = '1000';
|
|
3017
|
+
ghost.style.pointerEvents = 'none';
|
|
3018
|
+
}
|
|
3019
|
+
ev.preventDefault();
|
|
3020
|
+
const tilt = this.reduced ? 0 : Math.max(-8, Math.min(8, (ev.clientX - lastX) * 0.8));
|
|
3021
|
+
lastX = ev.clientX;
|
|
3022
|
+
ghost.style.left = ev.clientX - ox + 'px';
|
|
3023
|
+
ghost.style.top = ev.clientY - oy + 'px';
|
|
3024
|
+
ghost.style.transform = `rotate(${tilt}deg) scale(${this.reduced ? 1 : 1.04})`;
|
|
3025
|
+
const col = this._cols.find((c) => {
|
|
3026
|
+
const b = c.getBoundingClientRect();
|
|
3027
|
+
return ev.clientX >= b.left && ev.clientX <= b.right;
|
|
3028
|
+
});
|
|
3029
|
+
if (!col)
|
|
3030
|
+
return;
|
|
3031
|
+
const cards = this.cardsOf(col).filter((c) => c !== card);
|
|
3032
|
+
const at = cards.find((c) => {
|
|
3033
|
+
const b = c.getBoundingClientRect();
|
|
3034
|
+
return ev.clientY < b.top + b.height / 2;
|
|
3035
|
+
});
|
|
3036
|
+
if (ph.parentElement !== col || ph.nextElementSibling !== (at || null))
|
|
3037
|
+
this.flip(() => (at ? col.insertBefore(ph, at) : col.appendChild(ph)));
|
|
3038
|
+
};
|
|
3039
|
+
const onUp = () => {
|
|
3040
|
+
window.removeEventListener('pointermove', onMove);
|
|
3041
|
+
window.removeEventListener('pointerup', onUp);
|
|
3042
|
+
window.removeEventListener('pointercancel', onUp);
|
|
3043
|
+
if (!started)
|
|
3044
|
+
return;
|
|
3045
|
+
const to = ph.parentElement;
|
|
3046
|
+
const index = this.cardsOf(to).filter((c) => c !== card).indexOf(ph.nextElementSibling);
|
|
3047
|
+
const from = card.parentElement;
|
|
3048
|
+
const g = ghost.getBoundingClientRect();
|
|
3049
|
+
to.insertBefore(card, ph);
|
|
3050
|
+
ph.remove();
|
|
3051
|
+
ghost.classList.remove('usa-kb-lifted');
|
|
3052
|
+
ghost.style.cssText = '';
|
|
3053
|
+
const b = card.getBoundingClientRect();
|
|
3054
|
+
if (!this.reduced)
|
|
3055
|
+
this.motion(card, [{ transform: `translate(${g.left - b.left}px,${g.top - b.top}px) rotate(3deg)` }, { transform: 'none' }], { duration: 240, easing: 'cubic-bezier(.2,.9,.3,1.2)' });
|
|
3056
|
+
const list = this.cardsOf(to);
|
|
3057
|
+
this.emit('move', { card, from, to, index: index < 0 ? list.indexOf(card) : list.indexOf(card) });
|
|
3058
|
+
this.say(`Moved to ${this.colName(to)}, position ${list.indexOf(card) + 1}`);
|
|
3059
|
+
};
|
|
3060
|
+
window.addEventListener('pointermove', onMove, { passive: false });
|
|
3061
|
+
window.addEventListener('pointerup', onUp);
|
|
3062
|
+
window.addEventListener('pointercancel', onUp);
|
|
3063
|
+
}
|
|
3064
|
+
key(e) {
|
|
3065
|
+
const card = e.target.closest?.('.usa-kb-card');
|
|
3066
|
+
if (!card)
|
|
3067
|
+
return;
|
|
3068
|
+
if (e.key === ' ' || e.key === 'Enter') {
|
|
3069
|
+
e.preventDefault();
|
|
3070
|
+
if (this._held === card) {
|
|
3071
|
+
card.removeAttribute('aria-grabbed');
|
|
3072
|
+
card.classList.remove('usa-kb-held');
|
|
3073
|
+
this._held = null;
|
|
3074
|
+
this.say(`Dropped in ${this.colName(card.parentElement)}`);
|
|
3075
|
+
}
|
|
3076
|
+
else {
|
|
3077
|
+
this._held = card;
|
|
3078
|
+
card.setAttribute('aria-grabbed', 'true');
|
|
3079
|
+
card.classList.add('usa-kb-held');
|
|
3080
|
+
this.say('Picked up. Use arrow keys to move, Space to drop.');
|
|
3081
|
+
}
|
|
3082
|
+
return;
|
|
3083
|
+
}
|
|
3084
|
+
if (e.key === 'Escape' && this._held) {
|
|
3085
|
+
this._held.classList.remove('usa-kb-held');
|
|
3086
|
+
this._held.removeAttribute('aria-grabbed');
|
|
3087
|
+
this._held = null;
|
|
3088
|
+
return;
|
|
3089
|
+
}
|
|
3090
|
+
if (this._held !== card)
|
|
3091
|
+
return;
|
|
3092
|
+
const col = card.parentElement;
|
|
3093
|
+
const ci = this._cols.indexOf(col);
|
|
3094
|
+
const idx = this.cardsOf(col).indexOf(card);
|
|
3095
|
+
let to = col;
|
|
3096
|
+
let i = idx;
|
|
3097
|
+
if (e.key === 'ArrowLeft' && ci > 0)
|
|
3098
|
+
(to = this._cols[ci - 1]), (i = Math.min(idx, this.cardsOf(to).length));
|
|
3099
|
+
else if (e.key === 'ArrowRight' && ci < this._cols.length - 1)
|
|
3100
|
+
(to = this._cols[ci + 1]), (i = Math.min(idx, this.cardsOf(to).length));
|
|
3101
|
+
else if (e.key === 'ArrowUp')
|
|
3102
|
+
i = Math.max(0, idx - 1);
|
|
3103
|
+
else if (e.key === 'ArrowDown')
|
|
3104
|
+
i = idx + 1;
|
|
3105
|
+
else
|
|
3106
|
+
return;
|
|
3107
|
+
e.preventDefault();
|
|
3108
|
+
this.move(card, to, i);
|
|
3109
|
+
card.focus();
|
|
3110
|
+
this.say(`${this.colName(to)}, position ${this.cardsOf(to).indexOf(card) + 1}`);
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
return UsaKanban;
|
|
3114
|
+
}, { id: 'kanban', text: css$7 });
|
|
3115
|
+
}
|
|
3116
|
+
|
|
3117
|
+
var css$6 = "usa-swipe-deck{position:relative;display:grid;width:var(--usa-sd-w,240px);max-width:100%;height:var(--usa-sd-h,300px);touch-action:pan-y;outline-offset:6px;border-radius:18px}.usa-sd-card{grid-area:1/1;position:relative;display:grid;place-items:center;border-radius:18px;background:var(--usa-sd-bg,linear-gradient(160deg,#7c5cff,#22d3ee));color:#fff;font:800 22px/1.2 system-ui,sans-serif;box-shadow:0 12px 28px -10px rgba(0,0,0,.4);transition:transform .3s cubic-bezier(.3,1.3,.5,1),opacity .3s;user-select:none;cursor:grab;overflow:hidden;touch-action:none}.usa-sd-card.usa-sd-dragging{transition:none;cursor:grabbing}.usa-sd-stamp{position:absolute;top:18px;padding:4px 10px;border:3px solid currentColor;border-radius:8px;font:900 20px/1 system-ui,sans-serif;letter-spacing:.1em;opacity:0;pointer-events:none}.usa-sd-like{left:16px;color:#4ade80;transform:rotate(-14deg)}.usa-sd-nope{right:16px;color:#f87171;transform:rotate(14deg)}@media (prefers-reduced-motion:reduce){.usa-sd-card{transition:none}}";
|
|
3118
|
+
|
|
3119
|
+
function defineSwipeDeck(tag = 'usa-swipe-deck') {
|
|
3120
|
+
return defineElement(tag, (Base) => {
|
|
3121
|
+
class UsaSwipeDeck extends Base {
|
|
3122
|
+
constructor() {
|
|
3123
|
+
super(...arguments);
|
|
3124
|
+
this._cards = [];
|
|
3125
|
+
this._gone = [];
|
|
3126
|
+
}
|
|
3127
|
+
get cards() {
|
|
3128
|
+
return this._cards.filter((c) => !this._gone.includes(c));
|
|
3129
|
+
}
|
|
3130
|
+
get top() {
|
|
3131
|
+
return this.cards[0] || null;
|
|
3132
|
+
}
|
|
3133
|
+
mount() {
|
|
3134
|
+
this._cards = ownChildren(this);
|
|
3135
|
+
this._gone = [];
|
|
3136
|
+
this.setAttribute('role', 'region');
|
|
3137
|
+
this.setAttribute('aria-roledescription', 'card deck');
|
|
3138
|
+
if (!this.hasAttribute('aria-label'))
|
|
3139
|
+
this.setAttribute('aria-label', this.str('label', 'Cards'));
|
|
3140
|
+
if (!this.hasAttribute('tabindex'))
|
|
3141
|
+
this.tabIndex = 0;
|
|
3142
|
+
this._cards.forEach((c) => {
|
|
3143
|
+
c.classList.add('usa-sd-card');
|
|
3144
|
+
if (!c.querySelector(':scope > .usa-sd-stamp')) {
|
|
3145
|
+
c.insertAdjacentHTML('beforeend', '<span class="usa-sd-stamp usa-sd-like" data-usa-part aria-hidden="true">LIKE</span><span class="usa-sd-stamp usa-sd-nope" data-usa-part aria-hidden="true">NOPE</span>');
|
|
3146
|
+
}
|
|
3147
|
+
});
|
|
3148
|
+
this.layout();
|
|
3149
|
+
this.listen(this, 'pointerdown', (e) => this.drag(e));
|
|
3150
|
+
this.listen(this, 'keydown', (e) => {
|
|
3151
|
+
if (e.key === 'ArrowRight')
|
|
3152
|
+
this.like();
|
|
3153
|
+
else if (e.key === 'ArrowLeft')
|
|
3154
|
+
this.nope();
|
|
3155
|
+
else if (e.key === 'Backspace' || (e.key === 'z' && (e.ctrlKey || e.metaKey)))
|
|
3156
|
+
this.undo();
|
|
3157
|
+
else
|
|
3158
|
+
return;
|
|
3159
|
+
e.preventDefault();
|
|
3160
|
+
});
|
|
3161
|
+
}
|
|
3162
|
+
layout() {
|
|
3163
|
+
this.cards.forEach((c, i) => {
|
|
3164
|
+
c.style.zIndex = String(100 - i);
|
|
3165
|
+
c.style.transform = i ? `translateY(${Math.min(i, 2) * 10}px) scale(${1 - Math.min(i, 2) * 0.05})` : '';
|
|
3166
|
+
c.style.opacity = i > 2 ? '0' : '1';
|
|
3167
|
+
c.toggleAttribute('data-top', i === 0);
|
|
3168
|
+
c.setAttribute('aria-hidden', String(i !== 0));
|
|
3169
|
+
});
|
|
3170
|
+
this._cards.filter((c) => this._gone.includes(c)).forEach((c) => (c.style.visibility = 'hidden'));
|
|
3171
|
+
}
|
|
3172
|
+
stamp(c, dx) {
|
|
3173
|
+
const k = Math.min(1, Math.abs(dx) / Math.max(40, this.num('threshold', 110)));
|
|
3174
|
+
c.querySelector('.usa-sd-like')?.style.setProperty('opacity', dx > 0 ? k.toFixed(2) : '0');
|
|
3175
|
+
c.querySelector('.usa-sd-nope')?.style.setProperty('opacity', dx < 0 ? k.toFixed(2) : '0');
|
|
3176
|
+
}
|
|
3177
|
+
fly(dir, dx = 0, dy = 0) {
|
|
3178
|
+
const c = this.top;
|
|
3179
|
+
if (!c)
|
|
3180
|
+
return;
|
|
3181
|
+
const index = this._cards.indexOf(c);
|
|
3182
|
+
this._gone.push(c);
|
|
3183
|
+
const sign = dir === 'right' ? 1 : -1;
|
|
3184
|
+
const w = this.getBoundingClientRect().width || 300;
|
|
3185
|
+
const done = () => {
|
|
3186
|
+
c.style.visibility = 'hidden';
|
|
3187
|
+
this.stamp(c, 0);
|
|
3188
|
+
};
|
|
3189
|
+
const a = this.reduced
|
|
3190
|
+
? this.motion(c, [{ opacity: 1 }, { opacity: 0 }], { duration: 200, fill: 'forwards' })
|
|
3191
|
+
: this.motion(c, [{ transform: `translate(${dx}px,${dy}px) rotate(${dx * 0.06}deg)` }, { transform: `translate(${sign * w * 1.5}px,${dy + 60}px) rotate(${sign * 30}deg)`, opacity: 0.6 }], { duration: 420, easing: 'cubic-bezier(.3,.6,.4,1)', fill: 'forwards' });
|
|
3192
|
+
if (a)
|
|
3193
|
+
a.finished.then(done, done);
|
|
3194
|
+
else
|
|
3195
|
+
done();
|
|
3196
|
+
this.layout();
|
|
3197
|
+
const next = this.top;
|
|
3198
|
+
if (next && !this.reduced)
|
|
3199
|
+
this.motion(next, [{ transform: 'translateY(10px) scale(.95)' }, { transform: 'none' }], { duration: 300, easing: 'cubic-bezier(.3,1.3,.5,1)' });
|
|
3200
|
+
this.emit('swipe', { card: c, dir, index });
|
|
3201
|
+
if (!this.top)
|
|
3202
|
+
this.emit('empty', {});
|
|
3203
|
+
}
|
|
3204
|
+
like() {
|
|
3205
|
+
this.fly('right');
|
|
3206
|
+
}
|
|
3207
|
+
nope() {
|
|
3208
|
+
this.fly('left');
|
|
3209
|
+
}
|
|
3210
|
+
undo() {
|
|
3211
|
+
const c = this._gone.pop();
|
|
3212
|
+
if (!c)
|
|
3213
|
+
return;
|
|
3214
|
+
c.getAnimations?.().forEach((a) => a.cancel());
|
|
3215
|
+
c.style.visibility = '';
|
|
3216
|
+
this.layout();
|
|
3217
|
+
if (!this.reduced)
|
|
3218
|
+
this.motion(c, [{ transform: 'translate(-120%,40px) rotate(-25deg)', opacity: 0 }, { transform: 'none', opacity: 1 }], { duration: 380, easing: 'cubic-bezier(.2,.9,.3,1.1)' });
|
|
3219
|
+
}
|
|
3220
|
+
drag(e) {
|
|
3221
|
+
const c = this.top;
|
|
3222
|
+
if (!c || !c.contains(e.target) || e.button > 0)
|
|
3223
|
+
return;
|
|
3224
|
+
const x0 = e.clientX;
|
|
3225
|
+
const y0 = e.clientY;
|
|
3226
|
+
const t0 = performance.now();
|
|
3227
|
+
let dx = 0;
|
|
3228
|
+
let dy = 0;
|
|
3229
|
+
c.setPointerCapture?.(e.pointerId);
|
|
3230
|
+
c.classList.add('usa-sd-dragging');
|
|
3231
|
+
const move = (ev) => {
|
|
3232
|
+
dx = ev.clientX - x0;
|
|
3233
|
+
dy = ev.clientY - y0;
|
|
3234
|
+
c.style.transform = `translate(${dx}px,${dy}px) rotate(${this.reduced ? 0 : dx * 0.06}deg)`;
|
|
3235
|
+
this.stamp(c, dx);
|
|
3236
|
+
};
|
|
3237
|
+
const up = () => {
|
|
3238
|
+
c.removeEventListener('pointermove', move);
|
|
3239
|
+
c.removeEventListener('pointerup', up);
|
|
3240
|
+
c.removeEventListener('pointercancel', up);
|
|
3241
|
+
c.classList.remove('usa-sd-dragging');
|
|
3242
|
+
const v = Math.abs(dx) / Math.max(1, performance.now() - t0);
|
|
3243
|
+
if (Math.abs(dx) > this.num('threshold', 110) || (v > 0.6 && Math.abs(dx) > 30))
|
|
3244
|
+
this.fly(dx > 0 ? 'right' : 'left', dx, dy);
|
|
3245
|
+
else {
|
|
3246
|
+
const from = c.style.transform;
|
|
3247
|
+
c.style.transform = '';
|
|
3248
|
+
this.stamp(c, 0);
|
|
3249
|
+
if (!this.reduced && from)
|
|
3250
|
+
this.motion(c, [{ transform: from }, { transform: 'none' }], { duration: 420, easing: 'cubic-bezier(.3,1.5,.5,1)' });
|
|
3251
|
+
}
|
|
3252
|
+
};
|
|
3253
|
+
c.addEventListener('pointermove', move);
|
|
3254
|
+
c.addEventListener('pointerup', up);
|
|
3255
|
+
c.addEventListener('pointercancel', up);
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
return UsaSwipeDeck;
|
|
3259
|
+
}, { id: 'swipe-deck', text: css$6 });
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3262
|
+
var css$5 = "usa-weather-card{--usa-wc-sky:linear-gradient(160deg,#38bdf8,#0ea5e9);position:relative;display:grid;grid-template-columns:auto 1fr;align-items:center;gap:14px;width:var(--usa-wc-w,260px);max-width:100%;padding:16px 18px;border-radius:20px;background:var(--usa-wc-sky);color:#fff;overflow:hidden;font:500 13px/1.3 system-ui,sans-serif;box-shadow:0 12px 30px -12px rgba(2,6,23,.5);transition:background .6s}usa-weather-card[data-condition=\"cloudy\"]{--usa-wc-sky:linear-gradient(160deg,#94a3b8,#64748b)}usa-weather-card[data-condition=\"rain\"]{--usa-wc-sky:linear-gradient(160deg,#475569,#1e3a8a)}usa-weather-card[data-condition=\"snow\"]{--usa-wc-sky:linear-gradient(160deg,#cbd5e1,#60a5fa);color:#0f172a}usa-weather-card[data-condition=\"storm\"]{--usa-wc-sky:linear-gradient(160deg,#1e293b,#312e81)}usa-weather-card[data-condition=\"fog\"]{--usa-wc-sky:linear-gradient(160deg,#9ca3af,#d1d5db);color:#1f2937}usa-weather-card[data-condition=\"night\"]{--usa-wc-sky:linear-gradient(160deg,#0f172a,#1e1b4b)}.usa-wc-scene{position:relative;width:76px;height:64px}.usa-wc-icon{position:absolute;inset:0}.usa-wc-icon *{position:absolute;display:block}.usa-wc-text{display:flex;flex-direction:column;gap:2px;min-width:0}.usa-wc-temp{font:800 34px/1 system-ui,sans-serif;font-variant-numeric:tabular-nums}.usa-wc-place{opacity:.8;font-size:12px}.usa-wc-sun{left:14px;top:8px;width:46px;height:46px;border-radius:50%;background:radial-gradient(circle,#fde047 55%,transparent 56%);animation:usa-wc-spin 14s linear infinite}.usa-wc-sun::before{content:\"\";position:absolute;inset:-8px;border-radius:50%;background:repeating-conic-gradient(#fde047 0 8deg,transparent 8deg 30deg);-webkit-mask:radial-gradient(circle,transparent 58%,#000 60%,#000 70%,transparent 72%);mask:radial-gradient(circle,transparent 58%,#000 60%,#000 70%,transparent 72%)}.usa-wc-moon{left:18px;top:6px;width:40px;height:40px;border-radius:50%;box-shadow:-10px 6px 0 2px #f1f5f9;transform:rotate(-20deg)}.usa-wc-star{width:3px;height:3px;border-radius:50%;background:#fff;left:calc(8px + var(--i) * 14px);top:calc(40px + (var(--i) * 7px) % 20px);animation:usa-wc-tw 1.8s calc(var(--i) * .35s) ease-in-out infinite alternate}.usa-wc-cloud{left:8px;top:14px;width:56px;height:22px;border-radius:12px;background:#f1f5f9;animation:usa-wc-drift 4s ease-in-out infinite alternate}.usa-wc-cloud::before{content:\"\";position:absolute;left:12px;top:-12px;width:26px;height:26px;border-radius:50%;background:inherit}.usa-wc-c2{left:22px;top:6px;transform:scale(.7);opacity:.75;animation-delay:-2s}.usa-wc-dark{background:#94a3b8}.usa-wc-drop{left:calc(16px + var(--i) * 8px);top:38px;width:2px;height:9px;border-radius:2px;background:#bfdbfe;animation:usa-wc-fall .9s calc(var(--i) * .17s) linear infinite}.usa-wc-flake{left:calc(14px + var(--i) * 9px);top:38px;width:6px;height:6px;border-radius:50%;background:#fff;animation:usa-wc-snow 2.4s calc(var(--i) * .4s) linear infinite}.usa-wc-bolt{left:30px;top:30px;width:14px;height:26px;background:#fde047;clip-path:polygon(40% 0,100% 0,60% 45%,100% 45%,20% 100%,40% 55%,0 55%);animation:usa-wc-bolt 4s ease-in-out infinite}.usa-wc-fogband{left:4px;top:calc(14px + var(--i) * 14px);width:66px;height:6px;border-radius:6px;background:rgba(255,255,255,.85);animation:usa-wc-drift calc(3s + var(--i) * .8s) ease-in-out infinite alternate}@keyframes usa-wc-spin{to{transform:rotate(360deg)}}@keyframes usa-wc-tw{from{opacity:.2}to{opacity:1}}@keyframes usa-wc-drift{from{translate:-4px 0}to{translate:6px 0}}@keyframes usa-wc-fall{from{translate:0 0;opacity:1}to{translate:-3px 22px;opacity:0}}@keyframes usa-wc-snow{from{translate:0 0;opacity:1}50%{translate:4px 12px}to{translate:-2px 24px;opacity:0}}@keyframes usa-wc-bolt{0%,86%,100%{opacity:.35}90%{opacity:1}}@media (prefers-reduced-motion:reduce){usa-weather-card *{animation:none!important}}";
|
|
3263
|
+
|
|
3264
|
+
const WEATHER_CONDITIONS = ['clear', 'cloudy', 'rain', 'snow', 'storm', 'fog', 'night'];
|
|
3265
|
+
const LABEL = { clear: 'Clear', cloudy: 'Cloudy', rain: 'Rain', snow: 'Snow', storm: 'Thunderstorm', fog: 'Fog', night: 'Clear night' };
|
|
3266
|
+
const icon = (c) => {
|
|
3267
|
+
const drops = (cls, n) => Array.from({ length: n }, (_, i) => `<i class="${cls}" style="--i:${i}"></i>`).join('');
|
|
3268
|
+
switch (c) {
|
|
3269
|
+
case 'clear':
|
|
3270
|
+
return '<span class="usa-wc-sun"></span>';
|
|
3271
|
+
case 'night':
|
|
3272
|
+
return `<span class="usa-wc-moon"></span>${drops('usa-wc-star', 5)}`;
|
|
3273
|
+
case 'cloudy':
|
|
3274
|
+
return '<span class="usa-wc-cloud usa-wc-c2"></span><span class="usa-wc-cloud"></span>';
|
|
3275
|
+
case 'rain':
|
|
3276
|
+
return `<span class="usa-wc-cloud"></span>${drops('usa-wc-drop', 6)}`;
|
|
3277
|
+
case 'snow':
|
|
3278
|
+
return `<span class="usa-wc-cloud"></span>${drops('usa-wc-flake', 6)}`;
|
|
3279
|
+
case 'storm':
|
|
3280
|
+
return `<span class="usa-wc-cloud usa-wc-dark"></span><span class="usa-wc-bolt"></span>${drops('usa-wc-drop', 4)}`;
|
|
3281
|
+
default:
|
|
3282
|
+
return `${drops('usa-wc-fogband', 3)}`;
|
|
3283
|
+
}
|
|
3284
|
+
};
|
|
3285
|
+
function defineWeatherCard(tag = 'usa-weather-card') {
|
|
3286
|
+
return defineElement(tag, (Base) => {
|
|
3287
|
+
class UsaWeatherCard extends Base {
|
|
3288
|
+
static get observedAttributes() {
|
|
3289
|
+
return ['condition', 'temp', 'place', 'unit', 'label'];
|
|
3290
|
+
}
|
|
3291
|
+
get condition() {
|
|
3292
|
+
return this.dataset.condition || 'clear';
|
|
3293
|
+
}
|
|
3294
|
+
set condition(v) {
|
|
3295
|
+
this.setAttribute('condition', v);
|
|
3296
|
+
}
|
|
3297
|
+
mount() {
|
|
3298
|
+
const c = this.str('condition', 'clear');
|
|
3299
|
+
const cond = WEATHER_CONDITIONS.includes(c) ? c : 'clear';
|
|
3300
|
+
const changed = this.dataset.condition && this.dataset.condition !== cond;
|
|
3301
|
+
this.dataset.condition = cond;
|
|
3302
|
+
const temp = this.num('temp', NaN);
|
|
3303
|
+
const unit = this.str('unit', '°');
|
|
3304
|
+
const label = this.str('label', LABEL[cond]);
|
|
3305
|
+
const place = this.str('place', '');
|
|
3306
|
+
this.setAttribute('role', 'group');
|
|
3307
|
+
this.setAttribute('aria-label', [label, Number.isFinite(temp) ? `${Math.round(temp)}${unit}` : '', place].filter(Boolean).join(', '));
|
|
3308
|
+
this.querySelectorAll(':scope > [data-usa-part]').forEach((n) => n.remove());
|
|
3309
|
+
const scene = document.createElement('div');
|
|
3310
|
+
scene.className = 'usa-wc-scene';
|
|
3311
|
+
scene.setAttribute('aria-hidden', 'true');
|
|
3312
|
+
scene.setAttribute('data-usa-part', '');
|
|
3313
|
+
scene.innerHTML = `<span class="usa-wc-icon">${icon(cond)}</span>`;
|
|
3314
|
+
const text = document.createElement('div');
|
|
3315
|
+
text.className = 'usa-wc-text';
|
|
3316
|
+
text.setAttribute('data-usa-part', '');
|
|
3317
|
+
text.setAttribute('aria-hidden', 'true');
|
|
3318
|
+
text.innerHTML = `<b class="usa-wc-temp">${Number.isFinite(temp) ? Math.round(temp) + unit : ''}</b><span class="usa-wc-label"></span><span class="usa-wc-place"></span>`;
|
|
3319
|
+
text.querySelector('.usa-wc-label').textContent = label;
|
|
3320
|
+
text.querySelector('.usa-wc-place').textContent = place;
|
|
3321
|
+
this.prepend(scene, text);
|
|
3322
|
+
if (this.reduced)
|
|
3323
|
+
return;
|
|
3324
|
+
if (changed)
|
|
3325
|
+
this.motion(scene, [{ opacity: 0, transform: 'scale(.9)' }, { opacity: 1, transform: 'none' }], { duration: 420, easing: 'ease-out' });
|
|
3326
|
+
if (Number.isFinite(temp) && typeof requestAnimationFrame === 'function') {
|
|
3327
|
+
const el = text.querySelector('.usa-wc-temp');
|
|
3328
|
+
const t0 = performance.now();
|
|
3329
|
+
const from = Math.round(temp) - Math.min(12, Math.abs(Math.round(temp)) + 6);
|
|
3330
|
+
let raf = 0;
|
|
3331
|
+
const f = (now) => {
|
|
3332
|
+
const k = Math.min(1, (now - t0) / 900);
|
|
3333
|
+
el.textContent = Math.round(from + (Math.round(temp) - from) * (1 - Math.pow(1 - k, 3))) + unit;
|
|
3334
|
+
if (k < 1)
|
|
3335
|
+
raf = requestAnimationFrame(f);
|
|
3336
|
+
};
|
|
3337
|
+
raf = requestAnimationFrame(f);
|
|
3338
|
+
this.onCleanup(() => cancelAnimationFrame(raf));
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3342
|
+
return UsaWeatherCard;
|
|
3343
|
+
}, { id: 'weather-card', text: css$5 });
|
|
3344
|
+
}
|
|
3345
|
+
|
|
3346
|
+
var css$4 = "usa-pull-cord{--usa-pc-color:#cbd5e1;--usa-pc-light:#fde68a;position:relative;display:inline-flex;flex-direction:column;align-items:center;width:90px;height:190px;cursor:pointer;touch-action:none;user-select:none;outline-offset:4px;border-radius:12px}.usa-pc-lamp{position:relative;width:76px;height:38px;border-radius:38px 38px 6px 6px;background:linear-gradient(#475569,#334155);box-shadow:0 0 0 rgba(253,230,138,0);transition:box-shadow .35s,background .35s}.usa-pc-lamp::after{content:\"\";position:absolute;left:50%;bottom:-10px;width:22px;height:12px;margin-left:-11px;border-radius:0 0 12px 12px;background:#64748b;transition:background .35s,box-shadow .35s}usa-pull-cord[data-on] .usa-pc-lamp{background:linear-gradient(#f59e0b,#d97706);box-shadow:0 30px 60px 10px rgba(253,230,138,.55)}usa-pull-cord[data-on] .usa-pc-lamp::after{background:var(--usa-pc-light);box-shadow:0 0 22px 8px var(--usa-pc-light)}.usa-pc-svg{width:80px;height:150px;margin-top:-2px;overflow:visible}.usa-pc-cord{fill:none;stroke:var(--usa-pc-color);stroke-width:2.2;stroke-linecap:round}.usa-pc-knob{fill:#e2e8f0;stroke:#94a3b8;stroke-width:1.5}usa-pull-cord[data-on] .usa-pc-knob{fill:var(--usa-pc-light)}@media (prefers-reduced-motion:reduce){.usa-pc-lamp,.usa-pc-lamp::after{transition:none}}";
|
|
3347
|
+
|
|
3348
|
+
function definePullCord(tag = 'usa-pull-cord') {
|
|
3349
|
+
return defineElement(tag, (Base) => {
|
|
3350
|
+
class UsaPullCord extends Base {
|
|
3351
|
+
constructor() {
|
|
3352
|
+
super(...arguments);
|
|
3353
|
+
this._on = false;
|
|
3354
|
+
this._raf = 0;
|
|
3355
|
+
this._x = 0;
|
|
3356
|
+
this._y = 0;
|
|
3357
|
+
this._vx = 0;
|
|
3358
|
+
this._vy = 0;
|
|
3359
|
+
}
|
|
3360
|
+
get on() {
|
|
3361
|
+
return this._on;
|
|
3362
|
+
}
|
|
3363
|
+
set on(v) {
|
|
3364
|
+
this.toggle(!!v, false);
|
|
3365
|
+
}
|
|
3366
|
+
mount() {
|
|
3367
|
+
this.querySelectorAll(':scope > [data-usa-part]').forEach((n) => n.remove());
|
|
3368
|
+
this.insertAdjacentHTML('afterbegin', '<span class="usa-pc-lamp" data-usa-part aria-hidden="true"></span><svg class="usa-pc-svg" data-usa-part aria-hidden="true" viewBox="-40 0 80 150"><path class="usa-pc-cord" d="M0 0 L0 90"/><circle class="usa-pc-knob" cx="0" cy="96" r="7"/></svg>');
|
|
3369
|
+
this.setAttribute('role', 'switch');
|
|
3370
|
+
if (!this.hasAttribute('tabindex'))
|
|
3371
|
+
this.tabIndex = 0;
|
|
3372
|
+
if (!this.hasAttribute('aria-label'))
|
|
3373
|
+
this.setAttribute('aria-label', this.str('label', 'Light'));
|
|
3374
|
+
this._on = this.flag('on');
|
|
3375
|
+
this.sync();
|
|
3376
|
+
this.draw();
|
|
3377
|
+
this.listen(this, 'keydown', (e) => {
|
|
3378
|
+
if (e.key === ' ' || e.key === 'Enter') {
|
|
3379
|
+
e.preventDefault();
|
|
3380
|
+
this.pull();
|
|
3381
|
+
}
|
|
3382
|
+
});
|
|
3383
|
+
this.listen(this, 'pointerdown', (e) => this.drag(e));
|
|
3384
|
+
this.onCleanup(() => this._raf && cancelAnimationFrame(this._raf));
|
|
3385
|
+
}
|
|
3386
|
+
sync() {
|
|
3387
|
+
this.setAttribute('aria-checked', String(this._on));
|
|
3388
|
+
this.toggleAttribute('data-on', this._on);
|
|
3389
|
+
}
|
|
3390
|
+
draw() {
|
|
3391
|
+
const cord = this.querySelector('.usa-pc-cord');
|
|
3392
|
+
const knob = this.querySelector('.usa-pc-knob');
|
|
3393
|
+
const ex = this._x;
|
|
3394
|
+
const ey = 90 + this._y;
|
|
3395
|
+
cord?.setAttribute('d', `M0 0 Q${(ex * 0.5).toFixed(1)} ${(ey * 0.55).toFixed(1)} ${ex.toFixed(1)} ${ey.toFixed(1)}`);
|
|
3396
|
+
knob?.setAttribute('cx', ex.toFixed(1));
|
|
3397
|
+
knob?.setAttribute('cy', (ey + 6).toFixed(1));
|
|
3398
|
+
}
|
|
3399
|
+
/** Damped spring back to rest. */
|
|
3400
|
+
release() {
|
|
3401
|
+
if (this.reduced || typeof requestAnimationFrame !== 'function') {
|
|
3402
|
+
this._x = this._y = 0;
|
|
3403
|
+
this.draw();
|
|
3404
|
+
return;
|
|
3405
|
+
}
|
|
3406
|
+
let last = 0;
|
|
3407
|
+
const f = (now) => {
|
|
3408
|
+
const dt = last ? Math.min(0.033, (now - last) / 1000) : 1 / 60;
|
|
3409
|
+
last = now;
|
|
3410
|
+
this._vx += (-120 * this._x - 3 * this._vx) * dt;
|
|
3411
|
+
this._vy += (-260 * this._y - 9 * this._vy) * dt;
|
|
3412
|
+
this._x += this._vx * dt;
|
|
3413
|
+
this._y += this._vy * dt;
|
|
3414
|
+
this.draw();
|
|
3415
|
+
if (Math.abs(this._x) + Math.abs(this._y) + Math.abs(this._vx) + Math.abs(this._vy) > 0.05)
|
|
3416
|
+
this._raf = requestAnimationFrame(f);
|
|
3417
|
+
else
|
|
3418
|
+
((this._raf = 0), (this._x = this._y = this._vx = this._vy = 0), this.draw());
|
|
3419
|
+
};
|
|
3420
|
+
if (!this._raf)
|
|
3421
|
+
this._raf = requestAnimationFrame(f);
|
|
3422
|
+
}
|
|
3423
|
+
/** Pull once (keyboard / click): tug the cord and toggle. */
|
|
3424
|
+
pull() {
|
|
3425
|
+
this._y = 26;
|
|
3426
|
+
this._vx = (Math.random() - 0.5) * 60;
|
|
3427
|
+
this.draw();
|
|
3428
|
+
this.toggle(undefined, true);
|
|
3429
|
+
this.release();
|
|
3430
|
+
}
|
|
3431
|
+
drag(e) {
|
|
3432
|
+
if (e.button > 0)
|
|
3433
|
+
return;
|
|
3434
|
+
const y0 = e.clientY;
|
|
3435
|
+
const x0 = e.clientX;
|
|
3436
|
+
let moved = false;
|
|
3437
|
+
if (this._raf)
|
|
3438
|
+
(cancelAnimationFrame(this._raf), (this._raf = 0));
|
|
3439
|
+
const move = (ev) => {
|
|
3440
|
+
moved = moved || Math.abs(ev.clientY - y0) > 4;
|
|
3441
|
+
this._y = Math.max(0, Math.min(50, ev.clientY - y0));
|
|
3442
|
+
this._x = Math.max(-30, Math.min(30, (ev.clientX - x0) * 0.6));
|
|
3443
|
+
this.draw();
|
|
3444
|
+
};
|
|
3445
|
+
const up = () => {
|
|
3446
|
+
window.removeEventListener('pointermove', move);
|
|
3447
|
+
window.removeEventListener('pointerup', up);
|
|
3448
|
+
window.removeEventListener('pointercancel', up);
|
|
3449
|
+
if (!moved)
|
|
3450
|
+
return this.pull();
|
|
3451
|
+
if (this._y >= this.num('threshold', 24))
|
|
3452
|
+
this.toggle(undefined, true);
|
|
3453
|
+
this._vy = -this._y * 2;
|
|
3454
|
+
this.release();
|
|
3455
|
+
};
|
|
3456
|
+
window.addEventListener('pointermove', move);
|
|
3457
|
+
window.addEventListener('pointerup', up);
|
|
3458
|
+
window.addEventListener('pointercancel', up);
|
|
3459
|
+
}
|
|
3460
|
+
toggle(force, user = false) {
|
|
3461
|
+
const next = typeof force === 'boolean' ? force : !this._on;
|
|
3462
|
+
if (next === this._on)
|
|
3463
|
+
return;
|
|
3464
|
+
this._on = next;
|
|
3465
|
+
this.toggleAttribute('on', next);
|
|
3466
|
+
this.sync();
|
|
3467
|
+
const lamp = this.querySelector('.usa-pc-lamp');
|
|
3468
|
+
if (user && lamp && !this.reduced)
|
|
3469
|
+
this.motion(lamp, [{ transform: 'translateY(0)' }, { transform: 'translateY(3px)', offset: 0.3 }, { transform: 'translateY(0)' }], { duration: 300, easing: 'ease-out' });
|
|
3470
|
+
if (user)
|
|
3471
|
+
this.emit('change', { on: next });
|
|
3472
|
+
}
|
|
3473
|
+
}
|
|
3474
|
+
return UsaPullCord;
|
|
3475
|
+
}, { id: 'pull-cord', text: css$4 });
|
|
3476
|
+
}
|
|
3477
|
+
|
|
3478
|
+
var css$3 = "usa-date-picker{--usa-dp-c:#7c5cff;display:inline-block;width:var(--usa-dp-w,280px);max-width:100%;padding:12px;border-radius:16px;background:var(--usa-dp-bg,#fff);color:#111827;box-shadow:0 10px 30px -12px rgba(0,0,0,.3);font:500 13px/1 system-ui,sans-serif;user-select:none}.usa-dp-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.usa-dp-title{font-weight:700;font-size:14px}.usa-dp-nav{width:30px;height:30px;border:0;border-radius:8px;background:none;color:inherit;font-size:18px;cursor:pointer}.usa-dp-nav:hover{background:rgba(127,127,127,.14)}.usa-dp-viewport{overflow:hidden}.usa-dp-row{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}.usa-dp-dow{margin-bottom:4px;font-size:11px;opacity:.55;text-align:center}.usa-dp-day{position:relative;display:grid;place-items:center;aspect-ratio:1;border-radius:50%;cursor:pointer;font-variant-numeric:tabular-nums;outline:none;transition:background .2s,color .2s}.usa-dp-day:hover{background:rgba(124,92,255,.12)}.usa-dp-day[data-out]{opacity:.35}.usa-dp-day[data-today]{box-shadow:inset 0 0 0 1.5px var(--usa-dp-c)}.usa-dp-day[aria-selected=\"true\"]{background:var(--usa-dp-c);color:#fff}.usa-dp-day[aria-disabled]{opacity:.2;cursor:not-allowed;text-decoration:line-through}.usa-dp-day:focus-visible{box-shadow:0 0 0 2px #fff,0 0 0 4px var(--usa-dp-c)}@media (prefers-reduced-motion:reduce){.usa-dp-day{transition:none}}";
|
|
3479
|
+
|
|
3480
|
+
const iso = (d) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
|
|
3481
|
+
/** Parse `YYYY-MM-DD` as a local date (or null). */
|
|
3482
|
+
function parseISODate(s) {
|
|
3483
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s || '');
|
|
3484
|
+
if (!m)
|
|
3485
|
+
return null;
|
|
3486
|
+
const d = new Date(+m[1], +m[2] - 1, +m[3]);
|
|
3487
|
+
return d.getMonth() === +m[2] - 1 ? d : null;
|
|
3488
|
+
}
|
|
3489
|
+
/** The 6×7 day grid of a month (first row starts on `firstDay`). */
|
|
3490
|
+
function monthGrid(year, month, firstDay = 1) {
|
|
3491
|
+
const first = new Date(year, month, 1);
|
|
3492
|
+
const off = (first.getDay() - firstDay + 7) % 7;
|
|
3493
|
+
return Array.from({ length: 42 }, (_, i) => new Date(year, month, 1 - off + i));
|
|
3494
|
+
}
|
|
3495
|
+
function defineDatePicker(tag = 'usa-date-picker') {
|
|
3496
|
+
return defineElement(tag, (Base) => {
|
|
3497
|
+
class UsaDatePicker extends Base {
|
|
3498
|
+
constructor() {
|
|
3499
|
+
super(...arguments);
|
|
3500
|
+
this._value = null;
|
|
3501
|
+
this._view = new Date();
|
|
3502
|
+
this._focus = new Date();
|
|
3503
|
+
}
|
|
3504
|
+
static get observedAttributes() {
|
|
3505
|
+
return ['min', 'max', 'first-day', 'locale'];
|
|
3506
|
+
}
|
|
3507
|
+
get value() {
|
|
3508
|
+
return this._value ? iso(this._value) : '';
|
|
3509
|
+
}
|
|
3510
|
+
set value(v) {
|
|
3511
|
+
const d = parseISODate(v);
|
|
3512
|
+
this._value = d;
|
|
3513
|
+
if (d)
|
|
3514
|
+
(this._view = new Date(d.getFullYear(), d.getMonth(), 1)), (this._focus = d);
|
|
3515
|
+
if (this.isConnected)
|
|
3516
|
+
this.render(0);
|
|
3517
|
+
}
|
|
3518
|
+
get month() {
|
|
3519
|
+
return iso(this._view).slice(0, 7);
|
|
3520
|
+
}
|
|
3521
|
+
mount() {
|
|
3522
|
+
const v = parseISODate(this.getAttribute('value'));
|
|
3523
|
+
if (v)
|
|
3524
|
+
(this._value = v), (this._focus = v);
|
|
3525
|
+
else
|
|
3526
|
+
this._focus = this._value || new Date();
|
|
3527
|
+
this._view = new Date(this._focus.getFullYear(), this._focus.getMonth(), 1);
|
|
3528
|
+
this.querySelectorAll(':scope > [data-usa-part]').forEach((n) => n.remove());
|
|
3529
|
+
this.insertAdjacentHTML('afterbegin', '<div class="usa-dp-head" data-usa-part><button type="button" class="usa-dp-nav" data-d="-1" aria-label="Previous month">‹</button><span class="usa-dp-title" aria-live="polite"></span><button type="button" class="usa-dp-nav" data-d="1" aria-label="Next month">›</button></div><div class="usa-dp-viewport" data-usa-part><div class="usa-dp-grid" role="grid"></div></div>');
|
|
3530
|
+
this.listen(this, 'click', (e) => {
|
|
3531
|
+
const t = e.target;
|
|
3532
|
+
const nav = t.closest?.('.usa-dp-nav');
|
|
3533
|
+
if (nav)
|
|
3534
|
+
return this.showMonth(Number(nav.dataset.d));
|
|
3535
|
+
const day = t.closest?.('[data-date]');
|
|
3536
|
+
if (day && !day.hasAttribute('aria-disabled'))
|
|
3537
|
+
this.pick(parseISODate(day.dataset.date));
|
|
3538
|
+
});
|
|
3539
|
+
this.listen(this, 'keydown', (e) => this.key(e));
|
|
3540
|
+
this.render(0);
|
|
3541
|
+
}
|
|
3542
|
+
inRange(d) {
|
|
3543
|
+
const lo = parseISODate(this.getAttribute('min'));
|
|
3544
|
+
const hi = parseISODate(this.getAttribute('max'));
|
|
3545
|
+
return (!lo || d >= lo) && (!hi || d <= hi);
|
|
3546
|
+
}
|
|
3547
|
+
render(dir, focus = false) {
|
|
3548
|
+
const grid = this.querySelector('.usa-dp-grid');
|
|
3549
|
+
if (!grid)
|
|
3550
|
+
return;
|
|
3551
|
+
const loc = this.str('locale', '') || undefined;
|
|
3552
|
+
const fd = this.num('first-day', 1);
|
|
3553
|
+
const title = this.querySelector('.usa-dp-title');
|
|
3554
|
+
title.textContent = this._view.toLocaleDateString(loc, { month: 'long', year: 'numeric' });
|
|
3555
|
+
const days = monthGrid(this._view.getFullYear(), this._view.getMonth(), fd);
|
|
3556
|
+
const names = days.slice(0, 7).map((d) => d.toLocaleDateString(loc, { weekday: 'narrow' }));
|
|
3557
|
+
const today = iso(new Date());
|
|
3558
|
+
const sel = this.value;
|
|
3559
|
+
const foc = iso(this._focus);
|
|
3560
|
+
let html = `<div role="row" class="usa-dp-row usa-dp-dow">${names.map((n) => `<span role="columnheader">${n}</span>`).join('')}</div>`;
|
|
3561
|
+
for (let r = 0; r < 6; r++) {
|
|
3562
|
+
html += '<div role="row" class="usa-dp-row">';
|
|
3563
|
+
for (const d of days.slice(r * 7, r * 7 + 7)) {
|
|
3564
|
+
const k = iso(d);
|
|
3565
|
+
const out = d.getMonth() !== this._view.getMonth();
|
|
3566
|
+
const dis = !this.inRange(d);
|
|
3567
|
+
html += `<span role="gridcell" class="usa-dp-day" data-date="${k}"${out ? ' data-out' : ''}${k === today ? ' data-today' : ''} aria-selected="${k === sel}"${dis ? ' aria-disabled="true"' : ''} tabindex="${k === foc ? 0 : -1}" aria-label="${d.toLocaleDateString(loc, { day: 'numeric', month: 'long', year: 'numeric' })}">${d.getDate()}</span>`;
|
|
3568
|
+
}
|
|
3569
|
+
html += '</div>';
|
|
3570
|
+
}
|
|
3571
|
+
grid.innerHTML = html;
|
|
3572
|
+
if (focus)
|
|
3573
|
+
grid.querySelector(`[data-date="${foc}"]`)?.focus();
|
|
3574
|
+
if (dir && !this.reduced)
|
|
3575
|
+
this.motion(grid, [{ transform: `translateX(${dir * 30}%)`, opacity: 0 }, { transform: 'none', opacity: 1 }], { duration: 320, easing: 'cubic-bezier(.2,.8,.2,1)' });
|
|
3576
|
+
}
|
|
3577
|
+
showMonth(delta) {
|
|
3578
|
+
this._view = new Date(this._view.getFullYear(), this._view.getMonth() + delta, 1);
|
|
3579
|
+
this._focus = new Date(this._view);
|
|
3580
|
+
this.render(Math.sign(delta));
|
|
3581
|
+
}
|
|
3582
|
+
pick(d) {
|
|
3583
|
+
if (!this.inRange(d))
|
|
3584
|
+
return;
|
|
3585
|
+
this._value = d;
|
|
3586
|
+
this._focus = d;
|
|
3587
|
+
const dir = d.getMonth() !== this._view.getMonth() || d.getFullYear() !== this._view.getFullYear() ? (d > this._view ? 1 : -1) : 0;
|
|
3588
|
+
if (dir)
|
|
3589
|
+
this._view = new Date(d.getFullYear(), d.getMonth(), 1);
|
|
3590
|
+
this.setAttribute('value', iso(d));
|
|
3591
|
+
this.render(dir, true);
|
|
3592
|
+
const cell = this.querySelector(`[data-date="${iso(d)}"]`);
|
|
3593
|
+
if (cell && !this.reduced)
|
|
3594
|
+
this.motion(cell, [{ transform: 'scale(.6)' }, { transform: 'scale(1.15)', offset: 0.6 }, { transform: 'scale(1)' }], { duration: 380, easing: 'ease-out' });
|
|
3595
|
+
this.emit('change', { value: iso(d), date: d });
|
|
3596
|
+
}
|
|
3597
|
+
key(e) {
|
|
3598
|
+
if (!e.target.closest?.('[data-date]'))
|
|
3599
|
+
return;
|
|
3600
|
+
const f = new Date(this._focus);
|
|
3601
|
+
const step = {
|
|
3602
|
+
ArrowLeft: () => f.setDate(f.getDate() - 1),
|
|
3603
|
+
ArrowRight: () => f.setDate(f.getDate() + 1),
|
|
3604
|
+
ArrowUp: () => f.setDate(f.getDate() - 7),
|
|
3605
|
+
ArrowDown: () => f.setDate(f.getDate() + 7),
|
|
3606
|
+
PageUp: () => f.setMonth(f.getMonth() - 1),
|
|
3607
|
+
PageDown: () => f.setMonth(f.getMonth() + 1),
|
|
3608
|
+
Home: () => f.setDate(f.getDate() - ((f.getDay() - this.num('first-day', 1) + 7) % 7)),
|
|
3609
|
+
End: () => f.setDate(f.getDate() + 6 - ((f.getDay() - this.num('first-day', 1) + 7) % 7)),
|
|
3610
|
+
};
|
|
3611
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
3612
|
+
e.preventDefault();
|
|
3613
|
+
return this.pick(this._focus);
|
|
3614
|
+
}
|
|
3615
|
+
if (!step[e.key])
|
|
3616
|
+
return;
|
|
3617
|
+
e.preventDefault();
|
|
3618
|
+
step[e.key]();
|
|
3619
|
+
const dir = f.getMonth() !== this._view.getMonth() ? (f > this._view ? 1 : -1) : 0;
|
|
3620
|
+
this._focus = f;
|
|
3621
|
+
if (dir)
|
|
3622
|
+
this._view = new Date(f.getFullYear(), f.getMonth(), 1);
|
|
3623
|
+
this.render(dir, true);
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
return UsaDatePicker;
|
|
3627
|
+
}, { id: 'date-picker', text: css$3 });
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
var css$2 = "usa-color-picker{display:inline-flex;flex-direction:column;gap:10px;width:var(--usa-cp-w,240px);max-width:100%;padding:12px;border-radius:16px;background:var(--usa-cp-bg,#fff);box-shadow:0 10px 30px -12px rgba(0,0,0,.3)}.usa-cp-sv{position:relative;height:140px;border-radius:10px;background:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,hsl(var(--usa-cp-h) 100% 50%));cursor:crosshair;touch-action:none;outline-offset:2px}.usa-cp-thumb{position:absolute;left:var(--usa-cp-x);top:var(--usa-cp-y);width:18px;height:18px;margin:-9px 0 0 -9px;border-radius:50%;background:var(--usa-cp-color);box-shadow:0 0 0 3px #fff,0 2px 6px rgba(0,0,0,.4);pointer-events:none;transition:left .18s cubic-bezier(.3,1.4,.5,1),top .18s cubic-bezier(.3,1.4,.5,1),transform .2s}[data-drag]>.usa-cp-thumb{transition:none;transform:scale(1.2)}.usa-cp-row{display:flex;align-items:center;gap:10px}.usa-cp-chip{flex:none;width:30px;height:30px;border-radius:50%;background:var(--usa-cp-color);box-shadow:inset 0 0 0 1px rgba(0,0,0,.1)}.usa-cp-hue{position:relative;flex:1;height:14px;border-radius:7px;background:linear-gradient(90deg,red,#ff0,lime,cyan,blue,#f0f,red);cursor:pointer;touch-action:none;outline-offset:2px}.usa-cp-hue .usa-cp-thumb{left:var(--usa-cp-hx);top:50%;background:hsl(var(--usa-cp-h) 100% 50%)}.usa-cp-swatches{display:flex;flex-wrap:wrap;gap:6px}.usa-cp-sw{width:22px;height:22px;border:0;border-radius:50%;cursor:pointer;box-shadow:inset 0 0 0 1px rgba(0,0,0,.12)}.usa-cp-sv:focus-visible,.usa-cp-hue:focus-visible,.usa-cp-sw:focus-visible{outline:2px solid #7c5cff}@media (prefers-reduced-motion:reduce){.usa-cp-thumb{transition:none}}";
|
|
3631
|
+
|
|
3632
|
+
/** HSV (h 0–360, s / v 0–1) → `#rrggbb`. */
|
|
3633
|
+
function hsvToHex(h, s, v) {
|
|
3634
|
+
const f = (n) => {
|
|
3635
|
+
const k = (n + h / 60) % 6;
|
|
3636
|
+
return Math.round((v - v * s * Math.max(0, Math.min(k, 4 - k, 1))) * 255);
|
|
3637
|
+
};
|
|
3638
|
+
return '#' + [f(5), f(3), f(1)].map((x) => x.toString(16).padStart(2, '0')).join('');
|
|
3639
|
+
}
|
|
3640
|
+
/** `#rrggbb` → HSV (or null). */
|
|
3641
|
+
function hexToHsv(hex) {
|
|
3642
|
+
const m = /^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(hex.trim());
|
|
3643
|
+
if (!m)
|
|
3644
|
+
return null;
|
|
3645
|
+
const [r, g, b] = [m[1], m[2], m[3]].map((x) => parseInt(x, 16) / 255);
|
|
3646
|
+
const mx = Math.max(r, g, b);
|
|
3647
|
+
const d = mx - Math.min(r, g, b);
|
|
3648
|
+
let h = 0;
|
|
3649
|
+
if (d)
|
|
3650
|
+
h = mx === r ? ((g - b) / d) % 6 : mx === g ? (b - r) / d + 2 : (r - g) / d + 4;
|
|
3651
|
+
return [(h * 60 + 360) % 360, mx ? d / mx : 0, mx];
|
|
3652
|
+
}
|
|
3653
|
+
function defineColorPicker(tag = 'usa-color-picker') {
|
|
3654
|
+
return defineElement(tag, (Base) => {
|
|
3655
|
+
class UsaColorPicker extends Base {
|
|
3656
|
+
constructor() {
|
|
3657
|
+
super(...arguments);
|
|
3658
|
+
this._h = 260;
|
|
3659
|
+
this._s = 0.64;
|
|
3660
|
+
this._v = 1;
|
|
3661
|
+
}
|
|
3662
|
+
static get observedAttributes() {
|
|
3663
|
+
return ['swatches'];
|
|
3664
|
+
}
|
|
3665
|
+
get value() {
|
|
3666
|
+
return hsvToHex(this._h, this._s, this._v);
|
|
3667
|
+
}
|
|
3668
|
+
set value(v) {
|
|
3669
|
+
const hsv = hexToHsv(v);
|
|
3670
|
+
if (!hsv)
|
|
3671
|
+
return;
|
|
3672
|
+
[this._h, this._s, this._v] = hsv;
|
|
3673
|
+
this.paint(true);
|
|
3674
|
+
}
|
|
3675
|
+
mount() {
|
|
3676
|
+
const hsv = hexToHsv(this.str('value', '#7c5cff'));
|
|
3677
|
+
if (hsv)
|
|
3678
|
+
[this._h, this._s, this._v] = hsv;
|
|
3679
|
+
this.querySelectorAll(':scope > [data-usa-part]').forEach((n) => n.remove());
|
|
3680
|
+
const sw = this.str('swatches', '').split(',').map((s) => s.trim()).filter((s) => hexToHsv(s));
|
|
3681
|
+
this.insertAdjacentHTML('afterbegin', `<div class="usa-cp-sv" data-usa-part role="slider" tabindex="0" aria-label="Saturation and brightness"><span class="usa-cp-thumb"></span></div><div class="usa-cp-row" data-usa-part><span class="usa-cp-chip" aria-hidden="true"></span><div class="usa-cp-hue" role="slider" tabindex="0" aria-label="Hue" aria-valuemin="0" aria-valuemax="360"><span class="usa-cp-thumb"></span></div></div>${sw.length ? `<div class="usa-cp-swatches" data-usa-part>${sw.map((c) => `<button type="button" class="usa-cp-sw" style="background:${c}" data-c="${c}" aria-label="${c}"></button>`).join('')}</div>` : ''}`);
|
|
3682
|
+
const sv = this.querySelector('.usa-cp-sv');
|
|
3683
|
+
const hue = this.querySelector('.usa-cp-hue');
|
|
3684
|
+
this.drag(sv, (x, y) => ((this._s = x), (this._v = 1 - y)));
|
|
3685
|
+
this.drag(hue, (x) => (this._h = x * 360));
|
|
3686
|
+
this.listen(sv, 'keydown', (e) => this.keys(e, (d, ax) => (ax ? (this._v = clampN(this._v - d, 0, 1)) : (this._s = clampN(this._s + d, 0, 1)))));
|
|
3687
|
+
this.listen(hue, 'keydown', (e) => this.keys(e, (d) => (this._h = (this._h + d * 360 + 360) % 360)));
|
|
3688
|
+
this.listen(this, 'click', (e) => {
|
|
3689
|
+
const b = e.target.closest?.('.usa-cp-sw');
|
|
3690
|
+
if (!b)
|
|
3691
|
+
return;
|
|
3692
|
+
this.value = b.dataset.c;
|
|
3693
|
+
if (!this.reduced)
|
|
3694
|
+
this.motion(b, [{ transform: 'scale(1)' }, { transform: 'scale(1.35)', offset: 0.4 }, { transform: 'scale(1)' }], { duration: 360, easing: 'cubic-bezier(.3,1.5,.5,1)' });
|
|
3695
|
+
this.emit('change', { value: this.value });
|
|
3696
|
+
});
|
|
3697
|
+
this.paint(false);
|
|
3698
|
+
}
|
|
3699
|
+
keys(e, fn) {
|
|
3700
|
+
const k = e.shiftKey ? 0.1 : 0.01;
|
|
3701
|
+
const map = { ArrowLeft: [-k, false], ArrowRight: [k, false], ArrowUp: [-k, true], ArrowDown: [k, true] };
|
|
3702
|
+
const m = map[e.key];
|
|
3703
|
+
if (!m)
|
|
3704
|
+
return;
|
|
3705
|
+
e.preventDefault();
|
|
3706
|
+
fn(m[0], m[1]);
|
|
3707
|
+
this.paint(false);
|
|
3708
|
+
this.emit('change', { value: this.value });
|
|
3709
|
+
}
|
|
3710
|
+
drag(area, fn) {
|
|
3711
|
+
const at = (e) => {
|
|
3712
|
+
const r = area.getBoundingClientRect();
|
|
3713
|
+
fn(clampN((e.clientX - r.left) / (r.width || 1), 0, 1), clampN((e.clientY - r.top) / (r.height || 1), 0, 1));
|
|
3714
|
+
this.paint(false);
|
|
3715
|
+
this.emit('input', { value: this.value });
|
|
3716
|
+
};
|
|
3717
|
+
this.listen(area, 'pointerdown', (e) => {
|
|
3718
|
+
area.setPointerCapture?.(e.pointerId);
|
|
3719
|
+
area.toggleAttribute('data-drag', true);
|
|
3720
|
+
at(e);
|
|
3721
|
+
const move = (ev) => at(ev);
|
|
3722
|
+
const up = () => {
|
|
3723
|
+
area.removeAttribute('data-drag');
|
|
3724
|
+
area.removeEventListener('pointermove', move);
|
|
3725
|
+
area.removeEventListener('pointerup', up);
|
|
3726
|
+
this.emit('change', { value: this.value });
|
|
3727
|
+
};
|
|
3728
|
+
area.addEventListener('pointermove', move);
|
|
3729
|
+
area.addEventListener('pointerup', up);
|
|
3730
|
+
});
|
|
3731
|
+
}
|
|
3732
|
+
paint(morph) {
|
|
3733
|
+
const c = this.value;
|
|
3734
|
+
this.style.setProperty('--usa-cp-h', String(Math.round(this._h)));
|
|
3735
|
+
this.style.setProperty('--usa-cp-color', c);
|
|
3736
|
+
this.style.setProperty('--usa-cp-x', (this._s * 100).toFixed(2) + '%');
|
|
3737
|
+
this.style.setProperty('--usa-cp-y', ((1 - this._v) * 100).toFixed(2) + '%');
|
|
3738
|
+
this.style.setProperty('--usa-cp-hx', ((this._h / 360) * 100).toFixed(2) + '%');
|
|
3739
|
+
const sv = this.querySelector('.usa-cp-sv');
|
|
3740
|
+
sv?.setAttribute('aria-valuetext', `saturation ${Math.round(this._s * 100)}%, brightness ${Math.round(this._v * 100)}%`);
|
|
3741
|
+
const hue = this.querySelector('.usa-cp-hue');
|
|
3742
|
+
hue?.setAttribute('aria-valuenow', String(Math.round(this._h)));
|
|
3743
|
+
this.setAttribute('value', c);
|
|
3744
|
+
const chip = this.querySelector('.usa-cp-chip');
|
|
3745
|
+
if (morph && chip && !this.reduced)
|
|
3746
|
+
this.motion(chip, [{ borderRadius: '50%', transform: 'scale(.7) rotate(-20deg)' }, { borderRadius: '30%', transform: 'scale(1.1)', offset: 0.6 }, { borderRadius: '50%', transform: 'none' }], { duration: 420, easing: 'ease-out' });
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
return UsaColorPicker;
|
|
3750
|
+
}, { id: 'color-picker', text: css$2 });
|
|
3751
|
+
}
|
|
3752
|
+
|
|
3753
|
+
var css$1 = "usa-file-drop{--usa-fd-c:#7c5cff;display:flex;flex-direction:column;gap:10px;width:var(--usa-fd-w,300px);max-width:100%;font:500 13px/1.3 system-ui,sans-serif}.usa-fd-zone{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-height:120px;padding:16px;border-radius:16px;background:rgba(124,92,255,.06);cursor:pointer;text-align:center;outline-offset:3px;transition:background .25s,transform .25s}.usa-fd-ants{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none}.usa-fd-ants rect{fill:none;stroke:rgba(124,92,255,.55);stroke-width:2;stroke-dasharray:8 6}usa-file-drop[data-over] .usa-fd-zone{background:rgba(124,92,255,.14);transform:scale(1.02)}usa-file-drop[data-over] .usa-fd-ants rect{stroke:var(--usa-fd-c);animation:usa-fd-march .6s linear infinite}.usa-fd-icon{font-size:30px;color:var(--usa-fd-c);transition:transform .3s cubic-bezier(.3,1.5,.5,1)}usa-file-drop[data-over] .usa-fd-icon{transform:translateY(-8px) scale(1.15)}.usa-fd-zone:focus-visible{outline:2px solid var(--usa-fd-c)}.usa-fd-list{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;list-style:none}.usa-fd-item{--usa-fd-p:0;position:relative;display:grid;grid-template-columns:1fr auto 18px;align-items:center;gap:4px 8px;padding:8px 10px;border-radius:10px;background:rgba(127,127,127,.1)}.usa-fd-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}.usa-fd-size{opacity:.6;font-size:12px}.usa-fd-bar{grid-column:1/3;height:4px;border-radius:4px;background:rgba(127,127,127,.25);overflow:hidden}.usa-fd-fill{display:block;height:100%;background:var(--usa-fd-c);transform-origin:0 50%;transform:scaleX(var(--usa-fd-p));transition:transform .2s}.usa-fd-check{grid-row:1/3;grid-column:3;width:18px;height:18px;fill:none;stroke:#22c55e;stroke-width:2.4;stroke-linecap:round;stroke-dasharray:20;stroke-dashoffset:20;transition:stroke-dashoffset .4s}.usa-fd-item[data-done] .usa-fd-check{stroke-dashoffset:0}@keyframes usa-fd-march{to{stroke-dashoffset:-14}}@media (prefers-reduced-motion:reduce){usa-file-drop *{animation:none!important;transition:none!important}usa-file-drop[data-over] .usa-fd-zone,usa-file-drop[data-over] .usa-fd-icon{transform:none}}";
|
|
3754
|
+
|
|
3755
|
+
const size = (n) => (n < 1024 ? `${n} B` : n < 1048576 ? `${(n / 1024).toFixed(1)} KB` : `${(n / 1048576).toFixed(1)} MB`);
|
|
3756
|
+
function defineFileDrop(tag = 'usa-file-drop') {
|
|
3757
|
+
return defineElement(tag, (Base) => {
|
|
3758
|
+
class UsaFileDrop extends Base {
|
|
3759
|
+
constructor() {
|
|
3760
|
+
super(...arguments);
|
|
3761
|
+
this._files = [];
|
|
3762
|
+
this._depth = 0;
|
|
3763
|
+
}
|
|
3764
|
+
get files() {
|
|
3765
|
+
return this._files.slice();
|
|
3766
|
+
}
|
|
3767
|
+
mount() {
|
|
3768
|
+
this.querySelectorAll(':scope > [data-usa-part]').forEach((n) => n.remove());
|
|
3769
|
+
const label = this.str('label', 'Drop files here or browse');
|
|
3770
|
+
this.insertAdjacentHTML('afterbegin', `<div class="usa-fd-zone" data-usa-part role="button" tabindex="0"><svg class="usa-fd-ants" aria-hidden="true"><rect x="1" y="1" width="calc(100% - 2px)" height="calc(100% - 2px)" rx="14"/></svg><span class="usa-fd-icon" aria-hidden="true">⇪</span><span class="usa-fd-label"></span><input type="file" hidden></div><ul class="usa-fd-list" data-usa-part aria-live="polite"></ul>`);
|
|
3771
|
+
const zone = this.querySelector('.usa-fd-zone');
|
|
3772
|
+
zone.querySelector('.usa-fd-label').textContent = label;
|
|
3773
|
+
zone.setAttribute('aria-label', label);
|
|
3774
|
+
const input = zone.querySelector('input');
|
|
3775
|
+
if (this.str('accept', ''))
|
|
3776
|
+
input.accept = this.str('accept', '');
|
|
3777
|
+
input.multiple = this.flag('multiple');
|
|
3778
|
+
this.listen(zone, 'click', (e) => e.target !== input && input.click());
|
|
3779
|
+
this.listen(zone, 'keydown', (e) => {
|
|
3780
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
3781
|
+
e.preventDefault();
|
|
3782
|
+
input.click();
|
|
3783
|
+
}
|
|
3784
|
+
});
|
|
3785
|
+
this.listen(input, 'change', () => input.files && this.addFiles(input.files));
|
|
3786
|
+
this.listen(zone, 'dragenter', (e) => {
|
|
3787
|
+
e.preventDefault();
|
|
3788
|
+
this._depth++;
|
|
3789
|
+
this.toggleAttribute('data-over', true);
|
|
3790
|
+
});
|
|
3791
|
+
this.listen(zone, 'dragover', (e) => e.preventDefault());
|
|
3792
|
+
this.listen(zone, 'dragleave', () => {
|
|
3793
|
+
this._depth = Math.max(0, this._depth - 1);
|
|
3794
|
+
if (!this._depth)
|
|
3795
|
+
this.removeAttribute('data-over');
|
|
3796
|
+
});
|
|
3797
|
+
this.listen(zone, 'drop', (e) => {
|
|
3798
|
+
e.preventDefault();
|
|
3799
|
+
this._depth = 0;
|
|
3800
|
+
this.removeAttribute('data-over');
|
|
3801
|
+
if (e.dataTransfer?.files?.length)
|
|
3802
|
+
this.addFiles(e.dataTransfer.files);
|
|
3803
|
+
});
|
|
3804
|
+
}
|
|
3805
|
+
addFiles(list) {
|
|
3806
|
+
const ul = this.querySelector('.usa-fd-list');
|
|
3807
|
+
const files = Array.from(list).slice(0, this.flag('multiple') ? undefined : 1);
|
|
3808
|
+
if (!this.flag('multiple'))
|
|
3809
|
+
this.clear();
|
|
3810
|
+
const start = this._files.length;
|
|
3811
|
+
files.forEach((f, i) => {
|
|
3812
|
+
this._files.push(f);
|
|
3813
|
+
const li = document.createElement('li');
|
|
3814
|
+
li.className = 'usa-fd-item';
|
|
3815
|
+
li.innerHTML = '<span class="usa-fd-name"></span><span class="usa-fd-size"></span><span class="usa-fd-bar"><span class="usa-fd-fill"></span></span><svg class="usa-fd-check" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8.5l3.2 3L13 4.8"/></svg>';
|
|
3816
|
+
li.querySelector('.usa-fd-name').textContent = f.name;
|
|
3817
|
+
li.querySelector('.usa-fd-size').textContent = size(f.size);
|
|
3818
|
+
li.setAttribute('aria-label', `${f.name}, ${size(f.size)}`);
|
|
3819
|
+
ul.appendChild(li);
|
|
3820
|
+
if (!this.reduced)
|
|
3821
|
+
this.motion(li, [{ transform: 'translateY(-28px) scale(.85)', opacity: 0 }, { transform: 'none', opacity: 1 }], { duration: 380, delay: i * 70, easing: 'cubic-bezier(.2,.9,.3,1.2)', fill: 'backwards' });
|
|
3822
|
+
});
|
|
3823
|
+
this.emit('files', { files });
|
|
3824
|
+
if (this.flag('simulate'))
|
|
3825
|
+
files.forEach((_, i) => this.simulate(start + i));
|
|
3826
|
+
}
|
|
3827
|
+
simulate(i) {
|
|
3828
|
+
let p = 0;
|
|
3829
|
+
const tick = () => {
|
|
3830
|
+
if (!this.isConnected)
|
|
3831
|
+
return;
|
|
3832
|
+
p = Math.min(1, p + 0.12 + Math.random() * 0.15);
|
|
3833
|
+
this.setProgress(i, p);
|
|
3834
|
+
if (p < 1)
|
|
3835
|
+
setTimeout(tick, 160);
|
|
3836
|
+
};
|
|
3837
|
+
setTimeout(tick, 200);
|
|
3838
|
+
}
|
|
3839
|
+
setProgress(index, value) {
|
|
3840
|
+
const li = this.querySelectorAll('.usa-fd-item')[index];
|
|
3841
|
+
if (!li)
|
|
3842
|
+
return;
|
|
3843
|
+
const v = Math.max(0, Math.min(1, value));
|
|
3844
|
+
li.style.setProperty('--usa-fd-p', String(v));
|
|
3845
|
+
li.toggleAttribute('data-done', v >= 1);
|
|
3846
|
+
li.setAttribute('aria-label', `${this._files[index]?.name || ''}, ${Math.round(v * 100)}%`);
|
|
3847
|
+
}
|
|
3848
|
+
clear() {
|
|
3849
|
+
this._files = [];
|
|
3850
|
+
this.querySelector('.usa-fd-list')?.replaceChildren();
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3853
|
+
return UsaFileDrop;
|
|
3854
|
+
}, { id: 'file-drop', text: css$1 });
|
|
3855
|
+
}
|
|
3856
|
+
|
|
3857
|
+
var css = "usa-keyframe-editor{--usa-ke-c:#7c5cff;--usa-ke-head:100%;display:flex;flex-direction:column;gap:8px;width:var(--usa-ke-w,100%);max-width:100%;padding:10px;border-radius:14px;background:var(--usa-ke-bg,#0f172a);color:#e2e8f0;font:500 12px/1.2 system-ui,sans-serif}.usa-ke-bar{display:flex;align-items:center;gap:8px}.usa-ke-play{width:30px;height:30px;border:0;border-radius:50%;background:var(--usa-ke-c);color:#fff;cursor:pointer}.usa-ke-scrub{flex:1;min-width:0;accent-color:var(--usa-ke-c)}.usa-ke-time{min-width:58px;text-align:right;font-variant-numeric:tabular-nums;opacity:.8}.usa-ke-tracks{position:relative;display:flex;flex-direction:column;gap:4px}.usa-ke-tracks::after{content:\"\";position:absolute;top:0;bottom:0;left:calc(64px + (100% - 64px) * var(--usa-ke-head) / 100%);width:2px;background:#f43f5e;pointer-events:none}.usa-ke-row{display:grid;grid-template-columns:64px 1fr;align-items:center}.usa-ke-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-right:6px;opacity:.85}.usa-ke-lane{position:relative;height:22px;border-radius:6px;background:rgba(148,163,184,.14)}.usa-ke-clip{position:absolute;top:2px;bottom:2px;border-radius:5px;background:linear-gradient(90deg,var(--usa-ke-c),#22d3ee);cursor:grab;touch-action:none;outline-offset:2px;transition:left .2s,width .2s}.usa-ke-clip[data-drag]{cursor:grabbing;transition:none;box-shadow:0 4px 12px rgba(0,0,0,.4)}.usa-ke-clip:focus-visible{outline:2px solid #fff}.usa-ke-grip{position:absolute;right:0;top:0;bottom:0;width:8px;border-radius:0 5px 5px 0;background:rgba(255,255,255,.35);cursor:ew-resize}@media (prefers-reduced-motion:reduce){.usa-ke-clip{transition:none}}";
|
|
3858
|
+
|
|
3859
|
+
const DEFAULT = {
|
|
3860
|
+
format: ANIMATION_FORMAT,
|
|
3861
|
+
version: 1,
|
|
3862
|
+
name: 'Untitled',
|
|
3863
|
+
tracks: [
|
|
3864
|
+
{ target: ':scope > :nth-child(1)', start: 0, duration: 600, preset: 'fade-up', label: 'Title' },
|
|
3865
|
+
{ target: ':scope > :nth-child(2)', start: 300, duration: 600, preset: 'scale', label: 'Card' },
|
|
3866
|
+
{ target: ':scope > :nth-child(3)', start: 700, duration: 500, preset: 'fade-up', label: 'Button' },
|
|
3867
|
+
],
|
|
3868
|
+
};
|
|
3869
|
+
function defineKeyframeEditor(tag = 'usa-keyframe-editor') {
|
|
3870
|
+
return defineElement(tag, (Base) => {
|
|
3871
|
+
class UsaKeyframeEditor extends Base {
|
|
3872
|
+
constructor() {
|
|
3873
|
+
super(...arguments);
|
|
3874
|
+
this._anim = JSON.parse(JSON.stringify(DEFAULT));
|
|
3875
|
+
this._player = null;
|
|
3876
|
+
}
|
|
3877
|
+
get animation() {
|
|
3878
|
+
return this.toJSON();
|
|
3879
|
+
}
|
|
3880
|
+
set animation(v) {
|
|
3881
|
+
try {
|
|
3882
|
+
const a = typeof v === 'string' ? JSON.parse(v) : v;
|
|
3883
|
+
if (a && Array.isArray(a.tracks))
|
|
3884
|
+
this._anim = { format: ANIMATION_FORMAT, version: 1, ...JSON.parse(JSON.stringify(a)) };
|
|
3885
|
+
}
|
|
3886
|
+
catch {
|
|
3887
|
+
return;
|
|
3888
|
+
}
|
|
3889
|
+
if (this.isConnected)
|
|
3890
|
+
this.render();
|
|
3891
|
+
}
|
|
3892
|
+
toJSON() {
|
|
3893
|
+
return JSON.parse(JSON.stringify({ ...this._anim, duration: this.total() }));
|
|
3894
|
+
}
|
|
3895
|
+
total() {
|
|
3896
|
+
return Math.max(500, ...this._anim.tracks.map((t) => (t.start || 0) + (t.duration || 0)));
|
|
3897
|
+
}
|
|
3898
|
+
mount() {
|
|
3899
|
+
const src = this.querySelector(':scope > script[type="application/json"]');
|
|
3900
|
+
if (src?.textContent)
|
|
3901
|
+
this.animation = src.textContent;
|
|
3902
|
+
this.querySelectorAll(':scope > [data-usa-part]').forEach((n) => n.remove());
|
|
3903
|
+
this.insertAdjacentHTML('afterbegin', '<div class="usa-ke-bar" data-usa-part><button type="button" class="usa-ke-play" aria-label="Play">▶</button><input class="usa-ke-scrub" type="range" min="0" max="1000" value="1000" aria-label="Playhead"><output class="usa-ke-time">0 ms</output></div><div class="usa-ke-tracks" data-usa-part role="list"></div>');
|
|
3904
|
+
this.listen(this.querySelector('.usa-ke-play'), 'click', () => this.play());
|
|
3905
|
+
this.listen(this.querySelector('.usa-ke-scrub'), 'input', (e) => this.seek((Number(e.target.value) / 1000) * this.total()));
|
|
3906
|
+
this.render();
|
|
3907
|
+
}
|
|
3908
|
+
target() {
|
|
3909
|
+
const id = this.str('for', '');
|
|
3910
|
+
return id ? document.getElementById(id) : null;
|
|
3911
|
+
}
|
|
3912
|
+
rebuild() {
|
|
3913
|
+
this._player?.destroy?.();
|
|
3914
|
+
this._player = null;
|
|
3915
|
+
const t = this.target();
|
|
3916
|
+
if (t)
|
|
3917
|
+
this._player = createPlayer(t, this.toJSON(), { autoplay: false });
|
|
3918
|
+
}
|
|
3919
|
+
render() {
|
|
3920
|
+
const box = this.querySelector('.usa-ke-tracks');
|
|
3921
|
+
if (!box)
|
|
3922
|
+
return;
|
|
3923
|
+
const total = this.total();
|
|
3924
|
+
box.innerHTML = '';
|
|
3925
|
+
this._anim.tracks.forEach((t, i) => {
|
|
3926
|
+
const row = document.createElement('div');
|
|
3927
|
+
row.className = 'usa-ke-row';
|
|
3928
|
+
row.setAttribute('role', 'listitem');
|
|
3929
|
+
row.innerHTML = `<span class="usa-ke-label"></span><span class="usa-ke-lane"><span class="usa-ke-clip" tabindex="0" role="slider" aria-valuemin="0" aria-valuemax="${total}"><span class="usa-ke-grip" aria-hidden="true"></span></span></span>`;
|
|
3930
|
+
row.querySelector('.usa-ke-label').textContent = t.label || t.preset || t.effect || `Track ${i + 1}`;
|
|
3931
|
+
const clip = row.querySelector('.usa-ke-clip');
|
|
3932
|
+
clip.style.left = `${((t.start || 0) / total) * 100}%`;
|
|
3933
|
+
clip.style.width = `${Math.max(2, ((t.duration || 300) / total) * 100)}%`;
|
|
3934
|
+
clip.setAttribute('aria-valuenow', String(t.start || 0));
|
|
3935
|
+
clip.setAttribute('aria-label', `${row.querySelector('.usa-ke-label').textContent}: start ${t.start || 0} ms, ${t.duration || 0} ms`);
|
|
3936
|
+
clip.dataset.i = String(i);
|
|
3937
|
+
this.wire(clip, i);
|
|
3938
|
+
box.appendChild(row);
|
|
3939
|
+
});
|
|
3940
|
+
this.rebuild();
|
|
3941
|
+
}
|
|
3942
|
+
update(i, start, duration) {
|
|
3943
|
+
const t = this._anim.tracks[i];
|
|
3944
|
+
t.start = Math.max(0, Math.round(start / 10) * 10);
|
|
3945
|
+
t.duration = Math.max(50, Math.round(duration / 10) * 10);
|
|
3946
|
+
this.render();
|
|
3947
|
+
this.querySelector(`.usa-ke-clip[data-i="${i}"]`)?.focus();
|
|
3948
|
+
this.emit('change', { animation: this.toJSON() });
|
|
3949
|
+
}
|
|
3950
|
+
wire(clip, i) {
|
|
3951
|
+
clip.addEventListener('keydown', (e) => {
|
|
3952
|
+
const t = this._anim.tracks[i];
|
|
3953
|
+
const d = e.key === 'ArrowRight' ? 50 : e.key === 'ArrowLeft' ? -50 : 0;
|
|
3954
|
+
if (!d)
|
|
3955
|
+
return;
|
|
3956
|
+
e.preventDefault();
|
|
3957
|
+
if (e.shiftKey)
|
|
3958
|
+
this.update(i, t.start || 0, (t.duration || 300) + d);
|
|
3959
|
+
else
|
|
3960
|
+
this.update(i, (t.start || 0) + d, t.duration || 300);
|
|
3961
|
+
});
|
|
3962
|
+
clip.addEventListener('pointerdown', (e) => {
|
|
3963
|
+
const lane = clip.parentElement;
|
|
3964
|
+
const w = lane.getBoundingClientRect().width || 1;
|
|
3965
|
+
const total = this.total();
|
|
3966
|
+
const t = this._anim.tracks[i];
|
|
3967
|
+
const s0 = t.start || 0;
|
|
3968
|
+
const d0 = t.duration || 300;
|
|
3969
|
+
const resize = e.target.classList.contains('usa-ke-grip');
|
|
3970
|
+
const x0 = e.clientX;
|
|
3971
|
+
clip.setPointerCapture?.(e.pointerId);
|
|
3972
|
+
clip.toggleAttribute('data-drag', true);
|
|
3973
|
+
const move = (ev) => {
|
|
3974
|
+
const dms = ((ev.clientX - x0) / w) * total;
|
|
3975
|
+
if (resize)
|
|
3976
|
+
clip.style.width = `${(Math.max(50, d0 + dms) / total) * 100}%`;
|
|
3977
|
+
else
|
|
3978
|
+
clip.style.left = `${(Math.max(0, s0 + dms) / total) * 100}%`;
|
|
3979
|
+
};
|
|
3980
|
+
const up = (ev) => {
|
|
3981
|
+
clip.removeEventListener('pointermove', move);
|
|
3982
|
+
clip.removeEventListener('pointerup', up);
|
|
3983
|
+
clip.removeAttribute('data-drag');
|
|
3984
|
+
const dms = ((ev.clientX - x0) / w) * total;
|
|
3985
|
+
if (Math.abs(ev.clientX - x0) < 2)
|
|
3986
|
+
return;
|
|
3987
|
+
if (resize)
|
|
3988
|
+
this.update(i, s0, d0 + dms);
|
|
3989
|
+
else
|
|
3990
|
+
this.update(i, s0 + dms, d0);
|
|
3991
|
+
};
|
|
3992
|
+
clip.addEventListener('pointermove', move);
|
|
3993
|
+
clip.addEventListener('pointerup', up);
|
|
3994
|
+
});
|
|
3995
|
+
}
|
|
3996
|
+
seek(ms) {
|
|
3997
|
+
const total = this.total();
|
|
3998
|
+
const v = Math.max(0, Math.min(total, ms));
|
|
3999
|
+
this._player?.seek?.(v);
|
|
4000
|
+
const out = this.querySelector('.usa-ke-time');
|
|
4001
|
+
if (out)
|
|
4002
|
+
out.textContent = `${Math.round(v)} ms`;
|
|
4003
|
+
this.style.setProperty('--usa-ke-head', `${(v / total) * 100}%`);
|
|
4004
|
+
}
|
|
4005
|
+
play() {
|
|
4006
|
+
if (!this._player)
|
|
4007
|
+
this.rebuild();
|
|
4008
|
+
if (this.reduced)
|
|
4009
|
+
return this.seek(this.total());
|
|
4010
|
+
this._player?.seek?.(0);
|
|
4011
|
+
this._player?.play?.();
|
|
4012
|
+
const t0 = performance.now();
|
|
4013
|
+
const total = this.total();
|
|
4014
|
+
const scrub = this.querySelector('.usa-ke-scrub');
|
|
4015
|
+
const f = () => {
|
|
4016
|
+
const ms = Math.min(total, performance.now() - t0);
|
|
4017
|
+
if (scrub)
|
|
4018
|
+
scrub.value = String(Math.round((ms / total) * 1000));
|
|
4019
|
+
this.style.setProperty('--usa-ke-head', `${(ms / total) * 100}%`);
|
|
4020
|
+
const out = this.querySelector('.usa-ke-time');
|
|
4021
|
+
if (out)
|
|
4022
|
+
out.textContent = `${Math.round(ms)} ms`;
|
|
4023
|
+
if (ms < total && this.isConnected)
|
|
4024
|
+
requestAnimationFrame(f);
|
|
4025
|
+
};
|
|
4026
|
+
if (typeof requestAnimationFrame === 'function')
|
|
4027
|
+
requestAnimationFrame(f);
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
return UsaKeyframeEditor;
|
|
4031
|
+
}, { id: 'keyframe-editor', text: css });
|
|
2903
4032
|
}
|
|
2904
4033
|
|
|
2905
4034
|
/**
|
|
@@ -2922,6 +4051,8 @@ const WIDGETS = {
|
|
|
2922
4051
|
'6.5': { 'usa-milestones': defineMilestones, 'usa-masonry-flow': defineMasonryFlow, 'usa-compare': defineCompare, 'usa-cube-gallery': defineCubeGallery },
|
|
2923
4052
|
'6.6': { 'usa-dock': defineDock, 'usa-nav-morph': defineNavMorph, 'usa-menu-toggle': defineMenuToggle, 'usa-tip': defineTip },
|
|
2924
4053
|
'6.7': { 'usa-stepper': defineStepper, 'usa-pagination': definePagination, 'usa-segmented': defineSegmented, 'usa-switch': defineSwitch },
|
|
4054
|
+
'6.8': { 'usa-kanban': defineKanban, 'usa-swipe-deck': defineSwipeDeck, 'usa-weather-card': defineWeatherCard, 'usa-pull-cord': definePullCord },
|
|
4055
|
+
'6.9': { 'usa-date-picker': defineDatePicker, 'usa-color-picker': defineColorPicker, 'usa-file-drop': defineFileDrop, 'usa-keyframe-editor': defineKeyframeEditor },
|
|
2925
4056
|
};
|
|
2926
4057
|
/** Every widget tag, in release order. */
|
|
2927
4058
|
const WIDGET_TAGS = Object.values(WIDGETS).flatMap((g) => Object.keys(g));
|
|
@@ -2933,5 +4064,5 @@ function defineWidgets(release) {
|
|
|
2933
4064
|
fn(tag);
|
|
2934
4065
|
}
|
|
2935
4066
|
|
|
2936
|
-
export { CAROUSEL_EFFECTS, MENU_EFFECTS, MODAL_EFFECTS, NAV_INDICATORS, PROGRESS_VARIANTS, SEGMENTED_VARIANTS, SHEET_SIDES, SKELETON_VARIANTS, SWITCH_VARIANTS, TAB_INDICATORS, TIP_PLACEMENTS, TOAST_POSITIONS, TOGGLE_VARIANTS, WIDGETS, WIDGET_TAGS, defineCarousel, defineCompare, defineCubeGallery, defineDisclosure, defineDock, defineMasonryFlow, defineMenu, defineMenuToggle, defineMilestones, defineModal, defineNavMorph, defineOdometer, definePagination, defineProgressRing, defineSegmented, defineSheet, defineSkeletonReveal, defineStarRating, defineStepper, defineStories, defineSwitch, defineTabBar, defineTip, defineToastStack, defineWidgets, pageWindow, stackToast };
|
|
4067
|
+
export { CAROUSEL_EFFECTS, MENU_EFFECTS, MODAL_EFFECTS, NAV_INDICATORS, PROGRESS_VARIANTS, SEGMENTED_VARIANTS, SHEET_SIDES, SKELETON_VARIANTS, SWITCH_VARIANTS, TAB_INDICATORS, TIP_PLACEMENTS, TOAST_POSITIONS, TOGGLE_VARIANTS, WEATHER_CONDITIONS, WIDGETS, WIDGET_TAGS, defineCarousel, defineColorPicker, defineCompare, defineCubeGallery, defineDatePicker, defineDisclosure, defineDock, defineFileDrop, defineKanban, defineKeyframeEditor, defineMasonryFlow, defineMenu, defineMenuToggle, defineMilestones, defineModal, defineNavMorph, defineOdometer, definePagination, defineProgressRing, definePullCord, defineSegmented, defineSheet, defineSkeletonReveal, defineStarRating, defineStepper, defineStories, defineSwipeDeck, defineSwitch, defineTabBar, defineTip, defineToastStack, defineWeatherCard, defineWidgets, hexToHsv, hsvToHex, monthGrid, pageWindow, parseISODate, stackToast };
|
|
2937
4068
|
//# sourceMappingURL=widgets.js.map
|