@bloxwap/hig 0.9.0 → 0.9.1
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/README.md +1 -0
- package/chart/README.md +3 -4
- package/chart/dist/altimeter-burst.d.ts +2 -2
- package/chart/dist/altimeter-burst.js +8 -7
- package/chart/dist/altimeter-chart.d.ts +13 -3
- package/chart/dist/altimeter-chart.js +37 -12
- package/chart/dist/altimeter-core.d.ts +21 -0
- package/chart/dist/altimeter-core.js +13 -0
- package/chart/dist/altimeter-targets.d.ts +3 -2
- package/chart/dist/altimeter-targets.js +7 -7
- package/chart/dist/index.d.ts +2 -2
- package/chart/dist/outcome-chart.d.ts +4 -2
- package/chart/dist/outcome-chart.js +9 -6
- package/chart/dist/outcome-model.d.ts +14 -1
- package/chart/dist/outcome-model.js +12 -4
- package/contracts/README.md +1 -1
- package/feedback/README.md +1 -1
- package/native/README.md +1 -1
- package/native/dist/address-readout.d.ts +9 -0
- package/native/dist/address-readout.js +22 -0
- package/native/dist/blocks.d.ts +2 -1
- package/native/dist/blocks.js +2 -1
- package/native/dist/chart.d.ts +20 -0
- package/native/dist/chart.js +161 -0
- package/native/dist/claim-reward-block.d.ts +22 -0
- package/native/dist/claim-reward-block.js +16 -0
- package/native/dist/confirm-block.d.ts +1 -5
- package/native/dist/confirm-block.js +5 -16
- package/native/dist/deposit-block.js +5 -2
- package/native/dist/gesture-sheet.js +1 -1
- package/native/dist/language-block.js +1 -1
- package/native/dist/manage-position-block.d.ts +7 -0
- package/native/dist/manage-position-block.js +29 -28
- package/native/dist/modal-radius.d.ts +2 -0
- package/native/dist/modal-radius.js +2 -0
- package/native/dist/overlay.d.ts +6 -2
- package/native/dist/overlay.js +7 -5
- package/native/dist/positions-block.d.ts +28 -0
- package/native/dist/positions-block.js +15 -0
- package/native/dist/screen-header.d.ts +3 -1
- package/native/dist/screen-header.js +2 -2
- package/native/dist/status.js +3 -2
- package/native-fonts/README.md +1 -1
- package/og-fonts/README.md +1 -1
- package/package.json +32 -12
- package/react/README.md +1 -1
- package/react/dist/blocks/address-readout.d.ts +9 -0
- package/react/dist/blocks/address-readout.js +16 -0
- package/react/dist/blocks/claim-reward-block.d.ts +22 -0
- package/react/dist/blocks/claim-reward-block.js +10 -0
- package/react/dist/blocks/confirm-block.d.ts +1 -5
- package/react/dist/blocks/confirm-block.js +3 -13
- package/react/dist/blocks/deposit-block.js +5 -2
- package/react/dist/blocks/login-block.d.ts +15 -3
- package/react/dist/blocks/login-block.js +22 -7
- package/react/dist/blocks/manage-position-block.d.ts +7 -0
- package/react/dist/blocks/manage-position-block.js +9 -4
- package/react/dist/blocks/positions-block.d.ts +28 -0
- package/react/dist/blocks/positions-block.js +14 -0
- package/react/dist/blocks.d.ts +2 -1
- package/react/dist/blocks.js +2 -1
- package/react/dist/gesture-sheet.js +6 -2
- package/react/dist/styles.css +170 -37
- package/tokens/README.md +1 -1
- package/native/dist/explainer-block.d.ts +0 -91
- package/native/dist/explainer-block.js +0 -34
- package/react/dist/blocks/explainer-block.d.ts +0 -80
- package/react/dist/blocks/explainer-block.js +0 -20
package/react/dist/styles.css
CHANGED
|
@@ -81,24 +81,41 @@ textarea.hig-input { border-radius:var(--hig-radius-xl,14px);resize:vertical; }
|
|
|
81
81
|
.hig-link { display:inline-flex;align-items:center;min-height:var(--hig-button);min-width:var(--hig-button);color:var(--hig-action);text-decoration:underline;text-underline-offset:4px;overflow-wrap:anywhere; }
|
|
82
82
|
.hig-separator { border:0;height:2px;border-radius:9999px;background:var(--hig-fill-raised);width:100%; }
|
|
83
83
|
.hig-backdrop { position:fixed;inset:0;background:#000b;z-index:40; }
|
|
84
|
+
@media not (prefers-reduced-transparency: reduce) {
|
|
85
|
+
.hig-backdrop { -webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px); }
|
|
86
|
+
}
|
|
84
87
|
/* Centred with physical left: the content carries the provider dir, and inset-inline-start would flip to right:50% in RTL while the translate stays negative. */
|
|
85
|
-
|
|
88
|
+
/* Controls and floating panels share an 8px gutter inside the horizontal safe area. */
|
|
89
|
+
.hig-dialog,.hig-gesture-sheet,.hig-app-modal {
|
|
90
|
+
--hig-panel-left:calc(8px + env(safe-area-inset-left,0px));
|
|
91
|
+
--hig-panel-right:calc(8px + env(safe-area-inset-right,0px));
|
|
92
|
+
}
|
|
93
|
+
.hig-dialog { position:fixed;top:50%;left:calc((100% + var(--hig-panel-left) - var(--hig-panel-right)) / 2);transform:translate(-50%,-50%);max-width:560px;width:calc(100% - var(--hig-panel-left) - var(--hig-panel-right));max-height:calc(100dvh - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));overflow:auto;overscroll-behavior:contain;background:var(--hig-overlay,#111);box-shadow:0 24px 64px #000a;z-index:41;display:flex;flex-direction:column;gap:12px;overflow-wrap:anywhere; }
|
|
94
|
+
/* A panel's outer curve includes the inset to the capsule at its padded edge. */
|
|
95
|
+
.hig-dialog, .hig-alert, .hig-app-modal {
|
|
96
|
+
--hig-modal-padding: 24px;
|
|
97
|
+
--hig-modal-border: 0px;
|
|
98
|
+
--hig-modal-inner-radius: calc(var(--hig-button) / 2);
|
|
99
|
+
padding: var(--hig-modal-padding);
|
|
100
|
+
border-radius: calc(var(--hig-modal-inner-radius) + var(--hig-modal-padding) + var(--hig-modal-border));
|
|
101
|
+
}
|
|
102
|
+
.hig-dialog, .hig-app-modal { border: 0; }
|
|
103
|
+
.hig-alert { --hig-modal-border: 1px; --hig-modal-padding: var(--hig-space-xl,20px); }
|
|
86
104
|
.hig-dialog-title { margin:0;font-size:1.25rem;font-weight:600;line-height:1.3; }
|
|
87
105
|
.hig-dialog-description { margin:0;color:var(--hig-muted);font-size:.875rem;line-height:1.5; }
|
|
88
106
|
.hig-gesture-sheet { position:fixed;z-index:41;display:flex;flex-direction:column;max-height:95dvh;background:var(--hig-overlay,#111);color:var(--hig-text);box-shadow:0 0 64px #000a;outline:none; }
|
|
107
|
+
.hig-gesture-sheet:is([data-vaul-drawer-direction='left'],[data-vaul-drawer-direction='right'])::after { display:none; }
|
|
89
108
|
/* Match the card curve at the sheet edge: 24px card radius plus the 24px content inset. */
|
|
90
|
-
.hig-gesture-sheet[data-vaul-drawer-direction='bottom'] { inset:auto 0
|
|
91
|
-
.hig-gesture-sheet[data-vaul-drawer-direction='top'] { inset:0
|
|
92
|
-
.hig-gesture-sheet[data-vaul-drawer-direction='left'] { inset:0 auto 0
|
|
93
|
-
.hig-gesture-sheet[data-vaul-drawer-direction='right'] { inset:0
|
|
94
|
-
.hig-gesture-sheet[data-hig-content-mode='default'] { overflow:auto;overscroll-behavior:contain;gap:12px;padding:24px; }
|
|
95
|
-
.hig-gesture-sheet[data-hig-content-mode='custom'] { padding:0; }
|
|
109
|
+
.hig-gesture-sheet[data-vaul-drawer-direction='bottom'] { inset:auto var(--hig-panel-right) 0 var(--hig-panel-left);border-radius:48px 48px 0 0; }
|
|
110
|
+
.hig-gesture-sheet[data-vaul-drawer-direction='top'] { inset:0 var(--hig-panel-right) auto var(--hig-panel-left);border-radius:0 0 14px 14px; }
|
|
111
|
+
.hig-gesture-sheet[data-vaul-drawer-direction='left'] { inset:0 auto 0 var(--hig-panel-left);width:min(420px,95vw,calc(100% - var(--hig-panel-left) - var(--hig-panel-right)));max-height:none;border-radius:0 14px 14px 0; }
|
|
112
|
+
.hig-gesture-sheet[data-vaul-drawer-direction='right'] { inset:0 var(--hig-panel-right) 0 auto;width:min(420px,95vw,calc(100% - var(--hig-panel-left) - var(--hig-panel-right)));max-height:none;border-radius:14px 0 0 14px; }
|
|
113
|
+
:is(.hig-gesture-sheet,.hig-gesture-dynamic)[data-hig-content-mode='default'] { overflow:auto;overscroll-behavior:contain;gap:12px;padding:24px; }
|
|
114
|
+
:is(.hig-gesture-sheet,.hig-gesture-dynamic)[data-hig-content-mode='custom'] { padding:0; }
|
|
96
115
|
.hig-gesture-sheet[data-hig-dynamic='true'] { overflow:hidden;gap:0;padding:0; }
|
|
97
116
|
.hig-gesture-views { position:relative;min-width:0; }
|
|
98
117
|
.hig-gesture-view[data-leaving] { position:absolute;inset-block-start:0;inset-inline:0;pointer-events:none; }
|
|
99
118
|
.hig-gesture-dynamic { display:flex;flex-direction:column;flex:none;min-height:0;max-height:inherit; }
|
|
100
|
-
.hig-gesture-dynamic[data-hig-content-mode='default'] { overflow:auto;overscroll-behavior:contain;gap:12px;padding:24px; }
|
|
101
|
-
.hig-gesture-dynamic[data-hig-content-mode='custom'] { padding:0; }
|
|
102
119
|
/* A leaving view is out of flow and can be taller than the view replacing it. It must not make the sheet scrollable for the length of the swap: the content-sized sheet lets it show through to its own animating edge, and no scrollbar is drawn. */
|
|
103
120
|
.hig-gesture-dynamic:has(.hig-gesture-view[data-leaving]) { overflow:visible; }
|
|
104
121
|
:is(.hig-gesture-sheet,.hig-gesture-dynamic):has(.hig-gesture-view[data-leaving]) { scrollbar-width:none; }
|
|
@@ -109,7 +126,12 @@ textarea.hig-input { border-radius:var(--hig-radius-xl,14px);resize:vertical; }
|
|
|
109
126
|
.hig-gesture-sheet:is([data-vaul-drawer-direction='left'],[data-vaul-drawer-direction='right'])[data-hig-content-mode='default']:not([data-hig-dynamic]) { padding-top:calc(24px + env(safe-area-inset-top,0px));padding-bottom:calc(24px + env(safe-area-inset-bottom,0px)); }
|
|
110
127
|
.hig-gesture-sheet[data-vaul-drawer-direction='left'][data-hig-content-mode='default']:not([data-hig-dynamic]) { padding-left:calc(24px + env(safe-area-inset-left,0px)); }
|
|
111
128
|
.hig-gesture-sheet[data-vaul-drawer-direction='right'][data-hig-content-mode='default']:not([data-hig-dynamic]) { padding-right:calc(24px + env(safe-area-inset-right,0px)); }
|
|
129
|
+
.hig-detent-bar { position:sticky;top:0;z-index:3;display:flex;flex:none;justify-content:center;pointer-events:none; }
|
|
130
|
+
.hig-pin :is(.hig-screen-header,.hig-swap-view-header) { position:sticky;top:22px;z-index:2;--hig-blur-top:-46px; }
|
|
131
|
+
.hig-detent-bar::after,.hig-pin :is(.hig-screen-header,.hig-swap-view-header)::after,.hig-app-modal-live-activity .hig-dialog-title::after { content:"";position:absolute;inset:var(--hig-blur-top,-24px) var(--hig-blur-inline,-24px) -12px;z-index:-1;pointer-events:none;background:#111b;backdrop-filter:blur(12px);mask-image:linear-gradient(#000 calc(100% - 16px),transparent); }
|
|
132
|
+
.hig-pin:has(.hig-screen-header,.hig-swap-view-header) .hig-detent-bar::after { content:none; }
|
|
112
133
|
.hig-gesture-handle[data-vaul-handle] { flex:none;align-self:center;width:100px;height:6px;border-radius:9999px;opacity:1;background:var(--hig-action);box-shadow:0 0 12px color-mix(in srgb,var(--hig-action) 60%,transparent),0 12px 48px 12px color-mix(in srgb,var(--hig-action) 12%,transparent);margin-block:4px 12px; }
|
|
134
|
+
.hig-detent-bar > [data-vaul-handle] { pointer-events:auto;margin-block-end:0; }
|
|
113
135
|
.hig-gesture-sheet[data-hig-motion='reduced'],.hig-gesture-backdrop[data-hig-motion='reduced'] { animation:none!important;transition:none!important; }
|
|
114
136
|
.hig-popover { max-width:min(360px,calc(100vw - 32px));max-height:var(--radix-popover-content-available-height,calc(100dvh - 32px));overflow-y:auto;overscroll-behavior:contain;background:var(--hig-nested);color:var(--hig-text);padding:12px;border:1px solid transparent;border-radius:var(--hig-radius-xl,14px);box-shadow:0 8px 24px #0006;line-height:1.5;overflow-wrap:anywhere;z-index:50; }
|
|
115
137
|
.hig-menu { min-width:min(12rem,calc(100vw - 32px));max-height:var(--radix-dropdown-menu-content-available-height,calc(100dvh - 32px));padding:4px; }
|
|
@@ -203,7 +225,8 @@ textarea.hig-input { border-radius:var(--hig-radius-xl,14px);resize:vertical; }
|
|
|
203
225
|
.hig-market-text { display:flex;flex-direction:column;align-items:flex-start;min-width:0;text-align:start; }
|
|
204
226
|
.hig-market-detail { font-size:.875rem;line-height:1.43;font-weight:400;color:var(--hig-muted); }
|
|
205
227
|
.hig-market-trailing { display:flex;align-items:center;justify-content:flex-end;gap:8px;min-width:0; }
|
|
206
|
-
.hig-market-check,.hig-asset-row-check,.hig-list-row-check
|
|
228
|
+
.hig-market-check,.hig-asset-row-check,.hig-list-row-check { flex:none;color:var(--hig-text); }
|
|
229
|
+
.hig-language-check { flex:none;color:var(--hig-positive); }
|
|
207
230
|
.hig-market-row[data-active] { border-radius:var(--hig-radius-xl,14px);background:var(--hig-fill); }
|
|
208
231
|
.hig-market-row[data-disabled] :is(.hig-market-name,.hig-market-price,.hig-market-change,.hig-market-volume,.hig-market-trailing,.hig-market-icon) { opacity:.5; }
|
|
209
232
|
.hig-badge { display:inline-flex;align-items:center;gap:4px;width:fit-content;max-width:100%;min-width:0;padding:4px 10px;border-radius:9999px;background:var(--hig-fill);color:var(--hig-text);line-height:1.5;vertical-align:middle;overflow-wrap:anywhere; }
|
|
@@ -523,7 +546,7 @@ button.hig-swap-receive:active { opacity:.8; }
|
|
|
523
546
|
.hig-swap-view[data-direction='pop'],[dir='rtl'] .hig-swap-view[data-direction='push'] { --hig-swap-from:-24px; }
|
|
524
547
|
@keyframes hig-swap-push { from { opacity:0;transform:translateX(var(--hig-swap-from)); } }
|
|
525
548
|
/* Every block's column: the swap views, the blocks and the AssetsBlock list. */
|
|
526
|
-
.hig-swap-picker,.hig-swap-settings-view,.hig-account-block,.hig-token-card,.hig-manage-position-block,.hig-settings-block,.hig-position-block,.hig-reward-block,.hig-trade-history-list,.hig-trade-detail,.hig-language-block,.hig-assets-block,.hig-assets-list,.hig-confirm,.hig-preset-picker,.hig-
|
|
549
|
+
.hig-swap-picker,.hig-swap-settings-view,.hig-account-block,.hig-token-card,.hig-manage-position-block,.hig-settings-block,.hig-position-block,.hig-reward-block,.hig-trade-history-list,.hig-trade-detail,.hig-language-block,.hig-assets-block,.hig-assets-list,.hig-confirm,.hig-preset-picker,.hig-modal-body { display:flex;flex-direction:column;gap:16px;min-width:0; }
|
|
527
550
|
.hig-swap-view-header { display:flex;align-items:center;gap:4px;min-width:0;margin-inline-start:-8px; }
|
|
528
551
|
.hig-swap-view-title { margin:0;min-width:0;font-size:1.5rem;line-height:1.25;font-weight:700;overflow-wrap:anywhere;outline:none; }
|
|
529
552
|
.hig-swap-back { appearance:none;flex:none;display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--hig-muted);cursor:pointer; }
|
|
@@ -676,13 +699,14 @@ button.hig-asset-row:disabled:active { background:var(--hig-fill); }
|
|
|
676
699
|
.hig-login-block { display:grid;gap:16px; }
|
|
677
700
|
.hig-login-analytics { display:flex;align-items:center; }
|
|
678
701
|
.hig-login-analytics > .hig-switch { margin-inline-start:auto; }
|
|
679
|
-
.hig-login-providers { display:grid;gap:8px; }
|
|
680
|
-
.hig-login-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
}
|
|
702
|
+
.hig-login-providers,.hig-login-extra:not([hidden]) { display:grid;gap:8px; }
|
|
703
|
+
.hig-login-provider { display:grid;grid-template-columns:1fr auto 1fr;padding-inline:10px; }
|
|
704
|
+
.hig-login-provider-label { grid-column:2;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:0;overflow-wrap:anywhere; }
|
|
705
|
+
.hig-login-provider-label > span { display:flex;flex:none; }
|
|
706
|
+
.hig-login-provider > .hig-badge { grid-column:3;justify-self:end;padding:2px 6px;font-size:.6875rem;background:color-mix(in srgb,currentColor 12%,transparent);color:inherit; }
|
|
684
707
|
.hig-login-block > footer { display:flex;flex-wrap:wrap;justify-content:center;gap:16px; }
|
|
685
708
|
.hig-login-block > footer a { color:var(--hig-muted);font-size:.875rem;text-decoration:underline; }
|
|
709
|
+
.hig-deposit-qr { display:grid;place-items:center;width:44px;height:44px;border-radius:10px;background:var(--hig-background); }
|
|
686
710
|
.hig-deposit-icon { display:block;width:44px;height:44px;background:center / contain no-repeat; }
|
|
687
711
|
.hig-deposit-icon[data-method="apple-pay"] { background-image:url("../../tokens/assets/onramps/apple-pay.svg"); }
|
|
688
712
|
.hig-deposit-icon[data-method="cash-app"] { background-image:url("../../tokens/assets/onramps/cashapp.svg"); }
|
|
@@ -736,9 +760,9 @@ button.hig-asset-row:disabled:active { background:var(--hig-fill); }
|
|
|
736
760
|
.hig-reward-promo,.hig-target-prices,.hig-bar-mark { display:flex;flex-direction:column;gap:12px; }
|
|
737
761
|
.hig-reward-promo > p,.hig-reward-footnote { margin:0; }
|
|
738
762
|
.hig-reward-promo-top,.hig-reward-columns { display:flex;align-items:center;justify-content:space-between;gap:12px; }
|
|
739
|
-
.hig-reward-eyebrow,.hig-reward-columns,.hig-screen-eyebrow,.hig-
|
|
763
|
+
.hig-reward-eyebrow,.hig-reward-columns,.hig-screen-eyebrow,.hig-modal-eyebrow { color:var(--hig-muted);font-size:.75rem;line-height:1.33;letter-spacing:.12em;text-transform:uppercase; }
|
|
740
764
|
.hig-reward-eyebrow,.hig-screen-heading { min-width:0; }
|
|
741
|
-
.hig-screen-eyebrow,.hig-
|
|
765
|
+
.hig-screen-eyebrow,.hig-modal-eyebrow { margin:0; }
|
|
742
766
|
.hig-screen-eyebrow { text-align:center; }
|
|
743
767
|
.hig-reward-rules { appearance:none;flex:none;display:inline-flex;align-items:center;justify-content:flex-end;gap:4px;min-height:var(--hig-button);min-width:var(--hig-button);margin-block:-12px;padding:0;border:0;background:none;color:var(--hig-muted);font:inherit;font-weight:500;cursor:pointer;-webkit-tap-highlight-color:transparent; }
|
|
744
768
|
.hig-reward-rules:active { color:var(--hig-text); }
|
|
@@ -999,31 +1023,29 @@ button.hig-list-row:active,a.hig-list-row:active { background:var(--hig-fill-rai
|
|
|
999
1023
|
.hig-confirm-points { display:flex;flex-direction:column;gap:8px;padding-inline-start:20px;list-style:disc;color:var(--hig-muted);line-height:1.5; }
|
|
1000
1024
|
.hig-confirm-tertiary { margin-top:-8px; }
|
|
1001
1025
|
.hig-confirm-tertiary[data-tone='destructive']:not(:disabled) { color:var(--hig-negative); }
|
|
1002
|
-
|
|
1003
|
-
.hig-
|
|
1004
|
-
.hig-
|
|
1005
|
-
.hig-explainer-section { --hig-explainer-tone:var(--hig-text);display:flex;align-items:center;gap:12px;padding:12px;border-radius:16px;background:var(--hig-fill); }
|
|
1026
|
+
.hig-modal-sections,.hig-modal-section > div { display:flex;flex-direction:column;gap:12px;min-width:0; }
|
|
1027
|
+
.hig-modal-section > div { flex:1;gap:4px; }
|
|
1028
|
+
.hig-modal-section { --hig-modal-tone:var(--hig-text);display:flex;align-items:center;gap:12px;padding:12px;border-radius:16px;background:var(--hig-fill); }
|
|
1006
1029
|
/* Icon rows: 20px disc radius + 12px inset. */
|
|
1007
|
-
.hig-
|
|
1008
|
-
.hig-
|
|
1009
|
-
.hig-
|
|
1010
|
-
.hig-
|
|
1011
|
-
.hig-
|
|
1012
|
-
.hig-
|
|
1013
|
-
.hig-
|
|
1014
|
-
.hig-
|
|
1015
|
-
.hig-
|
|
1016
|
-
.hig-
|
|
1017
|
-
.hig-
|
|
1018
|
-
.hig-
|
|
1019
|
-
.hig-
|
|
1030
|
+
.hig-modal-section:has(> .hig-modal-icon) { border-radius:32px;align-items:flex-start; }
|
|
1031
|
+
.hig-modal-section[data-tone] { background:color-mix(in srgb,var(--hig-modal-tone) 10%,transparent); }
|
|
1032
|
+
.hig-modal-section[data-tone='up'] { --hig-modal-tone:var(--hig-up,var(--hig-buy)); }
|
|
1033
|
+
.hig-modal-section[data-tone='down'] { --hig-modal-tone:var(--hig-down,var(--hig-sell)); }
|
|
1034
|
+
.hig-modal-section[data-tone='positive'] { --hig-modal-tone:var(--hig-positive); }
|
|
1035
|
+
.hig-modal-section[data-tone='negative'] { --hig-modal-tone:var(--hig-negative); }
|
|
1036
|
+
.hig-modal-section[data-tone='warning'] { --hig-modal-tone:var(--hig-warning); }
|
|
1037
|
+
.hig-modal-icon { flex:none;display:grid;place-items:center;width:40px;height:40px;border-radius:50%;color:var(--hig-modal-tone);background:color-mix(in srgb,var(--hig-modal-tone) 15%,transparent); }
|
|
1038
|
+
.hig-modal-section h3 { margin:0;font-size:1rem;line-height:1.5;font-weight:700;color:var(--hig-modal-tone); }
|
|
1039
|
+
.hig-modal-section h3 > span { color:var(--hig-muted); }
|
|
1040
|
+
.hig-modal-media { display:flex;flex-direction:column;align-items:center;gap:8px;margin-block:12px; }
|
|
1041
|
+
.hig-modal-text { margin:0;color:var(--hig-muted);font-size:.875rem;line-height:1.43; }
|
|
1042
|
+
.hig-modal-steps { display:flex;flex-direction:column;gap:8px;padding-inline-start:20px; }
|
|
1020
1043
|
.hig-popover[data-tone] { background:color-mix(in srgb,var(--hig-popover-tone) 12%,var(--hig-nested));border-color:color-mix(in srgb,var(--hig-popover-tone) 40%,transparent);box-shadow:0 8px 24px #0006,0 0 24px color-mix(in srgb,var(--hig-popover-tone) 25%,transparent); }
|
|
1021
1044
|
.hig-popover[data-tone='info'] { --hig-popover-tone:var(--hig-info); }
|
|
1022
1045
|
.hig-popover[data-tone='positive'] { --hig-popover-tone:var(--hig-positive); }
|
|
1023
1046
|
.hig-popover[data-tone='warning'] { --hig-popover-tone:var(--hig-warning); }
|
|
1024
1047
|
.hig-popover[data-tone='negative'] { --hig-popover-tone:var(--hig-negative); }
|
|
1025
|
-
.hig-
|
|
1026
|
-
.hig-explainer-action-icon { display:inline-flex; }
|
|
1048
|
+
.hig-modal-hero { display:flex;flex-direction:column;align-items:center; }
|
|
1027
1049
|
.hig-assets-status { flex:none;padding:2px 10px;font:600 .75rem/1.33 var(--hig-font-mono,'Bloxwap Mono',ui-monospace,monospace);letter-spacing:.08em; }
|
|
1028
1050
|
.hig-assets-status[data-countdown] { color:var(--hig-muted);letter-spacing:.02em;font-variant-numeric:tabular-nums; }
|
|
1029
1051
|
.hig-assets-status .hig-number { font-family:inherit; }
|
|
@@ -1057,3 +1079,114 @@ span.hig-press-decoration[data-kind] > * { pointer-events:auto; }
|
|
|
1057
1079
|
@media(prefers-reduced-motion:reduce) { .hig-accordion::details-content { transition:none; } .hig-progress progress:not([value])::-webkit-progress-bar { animation:none; } }
|
|
1058
1080
|
[data-hig-motion='reduced'] .hig-accordion::details-content { transition:none; }
|
|
1059
1081
|
[data-hig-motion='reduced'] .hig-progress progress:not([value])::-webkit-progress-bar { animation:none; }
|
|
1082
|
+
|
|
1083
|
+
.hig-app-modal {
|
|
1084
|
+
box-sizing: border-box;
|
|
1085
|
+
width: calc(100% - var(--hig-panel-left) - var(--hig-panel-right));
|
|
1086
|
+
max-width: 28rem;
|
|
1087
|
+
display: flex;
|
|
1088
|
+
flex-direction: column;
|
|
1089
|
+
gap: 16px;
|
|
1090
|
+
background: var(--hig-overlay,#111);
|
|
1091
|
+
box-shadow: 0 24px 50px #0006;
|
|
1092
|
+
}
|
|
1093
|
+
.hig-app-modal-default, .hig-app-modal-approval, .hig-app-modal-trend, .hig-app-modal-swing {
|
|
1094
|
+
background: radial-gradient(140% 80% at 50% -10%, color-mix(in srgb,var(--hig-action) 14%,transparent),transparent 60%),var(--hig-overlay,#111);
|
|
1095
|
+
}
|
|
1096
|
+
.hig-app-modal-close {
|
|
1097
|
+
position: absolute;
|
|
1098
|
+
inset-block-start: 12px;
|
|
1099
|
+
inset-inline-end: 12px;
|
|
1100
|
+
width: 44px;
|
|
1101
|
+
height: 44px;
|
|
1102
|
+
border-radius: 50%;
|
|
1103
|
+
border: 0;
|
|
1104
|
+
background: transparent;
|
|
1105
|
+
color: var(--hig-muted);
|
|
1106
|
+
font-size: 24px;
|
|
1107
|
+
cursor: pointer;
|
|
1108
|
+
}
|
|
1109
|
+
.hig-app-modal .hig-dialog-title { padding-inline-end: 40px; }
|
|
1110
|
+
:is(.hig-app-modal-trend,.hig-app-modal-swing) .hig-modal-eyebrow, .hig-app-modal-approval .hig-dialog-title, .hig-app-modal-default .hig-dialog-title {
|
|
1111
|
+
font-family: var(--hig-font-mono,monospace);
|
|
1112
|
+
font-size: 11px;
|
|
1113
|
+
font-weight: 800;
|
|
1114
|
+
letter-spacing: .1em;
|
|
1115
|
+
text-transform: uppercase;
|
|
1116
|
+
}
|
|
1117
|
+
:is(.hig-app-modal-trend,.hig-app-modal-swing) .hig-modal-eyebrow, .hig-app-modal-default .hig-dialog-title, .hig-app-modal-approval .hig-dialog-title, .hig-app-modal em,
|
|
1118
|
+
.hig-app-modal-zero, .hig-app-modal-discount { color: var(--hig-action); }
|
|
1119
|
+
.hig-app-modal .hig-modal-hero:has(h2), .hig-app-modal .hig-modal-hero:has(.hig-app-modal-discount) { align-items: flex-start; }
|
|
1120
|
+
.hig-app-modal .hig-modal-hero h2 { margin: 0; font-size: 32px; font-weight: 800; line-height: 1.05; }
|
|
1121
|
+
.hig-app-modal-default .hig-modal-hero h2 { font-size: 40px; }
|
|
1122
|
+
.hig-app-modal em { font-style: normal; }
|
|
1123
|
+
.hig-app-modal-zero { font-size: 120px; line-height: 1; font-weight: 900; text-shadow: 0 0 32px color-mix(in srgb,var(--hig-action) 50%,transparent); }
|
|
1124
|
+
.hig-app-modal-zero, .hig-app-modal-discount { letter-spacing: -.045em; }
|
|
1125
|
+
.hig-app-modal-discount { font-size: 64px; font-weight: 900; line-height: 1; }
|
|
1126
|
+
.hig-app-modal:has(.hig-app-modal-zero) .hig-modal-body > .hig-modal-text { text-align: center; }
|
|
1127
|
+
.hig-app-modal-latency > div { display: flex; gap: 12px; }
|
|
1128
|
+
.hig-app-modal-latency > div { flex-wrap: wrap; justify-content: space-between; margin-top: 12px; }
|
|
1129
|
+
.hig-app-modal-latency b { color: var(--hig-down); }
|
|
1130
|
+
.hig-app-modal-latency i { width: 100%; height: 6px; border-radius: 4px; background: currentColor; color: var(--hig-down); }
|
|
1131
|
+
.hig-app-modal-latency > div + div :is(b,i) { color: var(--hig-action); }
|
|
1132
|
+
.hig-app-modal-latency > div + div i { margin-inline-end: 88%; }
|
|
1133
|
+
.hig-app-modal-donut {
|
|
1134
|
+
display: grid; place-items: center; width: min(200px,100%); aspect-ratio: 1; border-radius: 50%;
|
|
1135
|
+
background: conic-gradient(var(--hig-action) 1deg,var(--hig-border) 1deg);
|
|
1136
|
+
}
|
|
1137
|
+
.hig-app-modal-donut strong { display: grid; place-content: center; width: 72%; aspect-ratio: 1; border-radius: 50%; background: var(--hig-surface); text-align: center; font-size: 32px; }
|
|
1138
|
+
.hig-app-modal-donut small { font: 10px monospace; text-transform: uppercase; }
|
|
1139
|
+
.hig-app-modal-live-activity { max-width:300px; --hig-modal-padding: 12px; gap: 8px; }
|
|
1140
|
+
.hig-live-activity-markets {
|
|
1141
|
+
display: flex;
|
|
1142
|
+
flex-direction: column;
|
|
1143
|
+
gap: 4px;
|
|
1144
|
+
min-height: 0;
|
|
1145
|
+
max-height: min(20rem, 60dvh);
|
|
1146
|
+
overflow-y: auto;
|
|
1147
|
+
overscroll-behavior-y: contain;
|
|
1148
|
+
margin: 0;
|
|
1149
|
+
margin-block-start: -8px;
|
|
1150
|
+
padding: 12px 4px 4px;
|
|
1151
|
+
list-style: none;
|
|
1152
|
+
}
|
|
1153
|
+
.hig-live-activity-markets > li { flex: none; }
|
|
1154
|
+
.hig-app-modal-live-activity > :is(.hig-dialog-title, .hig-button) { flex: none; }
|
|
1155
|
+
.hig-app-modal-live-activity .hig-dialog-title { position: relative; z-index: 1; --hig-blur-top: 0; --hig-blur-inline: 0; padding: 0; text-align: center; font-size: 16px; }
|
|
1156
|
+
|
|
1157
|
+
.hig-app-modal-approval .hig-confirm-actions { display: flex; flex-direction: column-reverse; align-items: center; }
|
|
1158
|
+
.hig-app-modal-approval .hig-confirm-actions > :last-child { width: 100%; }
|
|
1159
|
+
.hig-app-modal-default .hig-modal-steps { list-style: none; padding: 0; text-align: center; }
|
|
1160
|
+
.hig-app-modal-approval .hig-modal-section:has(.hig-app-modal-donut) { padding: 0; background: transparent; }
|
|
1161
|
+
.hig-app-modal-approval .hig-modal-media:has(.hig-app-modal-donut) { margin: 0; }
|
|
1162
|
+
.hig-app-modal-metrics {
|
|
1163
|
+
display: grid;
|
|
1164
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1165
|
+
width: 100%;
|
|
1166
|
+
margin: 12px 0 0;
|
|
1167
|
+
padding-block: 12px;
|
|
1168
|
+
background: var(--hig-nested);
|
|
1169
|
+
}
|
|
1170
|
+
:is(.hig-dialog,.hig-app-modal) :is(.hig-app-modal-metrics, .hig-modal-section, .hig-market-row) { border-radius: var(--hig-modal-inner-radius); }
|
|
1171
|
+
.hig-app-modal-metrics > div { padding-inline: 16px; }
|
|
1172
|
+
.hig-app-modal-metrics > div + div { border-inline-start: 1px solid var(--hig-border); }
|
|
1173
|
+
.hig-app-modal-metrics dt { color: var(--hig-muted); font-size: .8125rem; }
|
|
1174
|
+
.hig-app-modal-metrics dd { margin: 2px 0 0; color: var(--hig-text); font-size: 1.25rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
|
|
1175
|
+
.hig-app-modal-metrics > div + div dd { color: var(--hig-action); }
|
|
1176
|
+
.hig-app-modal-approval:has(.hig-app-modal-donut) .hig-modal-text[data-caveat] { text-align: center; }
|
|
1177
|
+
|
|
1178
|
+
.hig-app-modal-savings > p { margin: 0; font-size: .8125rem; color: var(--hig-muted); }
|
|
1179
|
+
.hig-app-modal-savings .hig-app-modal-metrics { margin-top: 8px; }
|
|
1180
|
+
.hig-app-modal-savings dd { color: var(--hig-action); }
|
|
1181
|
+
|
|
1182
|
+
.hig-app-modal-tournament .hig-app-modal-metrics { margin-block-start: 0; }
|
|
1183
|
+
.hig-app-modal-tournament .hig-field { gap: 6px; }
|
|
1184
|
+
.hig-app-modal-tournament .hig-input { background: var(--hig-nested); }
|
|
1185
|
+
.hig-app-modal-tournament .hig-field p { font-size: .8125rem; }
|
|
1186
|
+
.hig-swing-sample { display:flex;align-items:center;gap:12px;width:100%;max-width:24rem;box-sizing:border-box;padding:8px 8px 8px 16px;border:2px solid var(--hig-up,var(--hig-buy));border-radius:999px;background:var(--hig-background);box-shadow:0 0 20px color-mix(in srgb,var(--hig-up,var(--hig-buy)) 25%,transparent); }
|
|
1187
|
+
.hig-swing-bars { flex:none;display:flex;align-items:flex-end;gap:2px;height:24px; }
|
|
1188
|
+
.hig-swing-bars i { width:3px;border-radius:2px;background:var(--hig-up,var(--hig-buy)); }
|
|
1189
|
+
.hig-swing-bars i:last-child { background:var(--hig-muted); }
|
|
1190
|
+
.hig-swing-sample b,.hig-swing-caption { color:var(--hig-muted); }
|
|
1191
|
+
.hig-swing-direction { margin-inline-start:auto;padding:6px 12px;border-radius:999px;background:color-mix(in srgb,var(--hig-up,var(--hig-buy)) 15%,transparent);color:var(--hig-up,var(--hig-buy));font-size:14px;font-weight:800;white-space:nowrap; }
|
|
1192
|
+
.hig-swing-caption { font-size:12px; }
|
package/tokens/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bloxwap/hig/tokens
|
|
2
2
|
|
|
3
|
-
Version 0.9.
|
|
3
|
+
Version 0.9.1, an entry of `@bloxwap/hig`. See the HIG architecture and platform limitations before adoption.
|
|
4
4
|
|
|
5
5
|
`resolvePrimaryColor('#ff0000')` resolves a custom brand's `action`, `focus`, and
|
|
6
6
|
`onAction` roles. Input is opaque sRGB hex (`#RGB` or `#RRGGBB`); the foreground
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View, type ScrollViewProps } from 'react-native';
|
|
3
|
-
import { type ScreenHeaderControlProps } from './screen-header.js';
|
|
4
|
-
/** The colour of a section: its tint, its icon disc and its heading. */
|
|
5
|
-
export type ExplainerTone = 'up' | 'down' | 'positive' | 'negative' | 'warning';
|
|
6
|
-
/** One titled part of the explanation. Every field is optional, so a section can be a heading and a sentence, an icon row, or host media with a caption. */
|
|
7
|
-
export interface ExplainerSection {
|
|
8
|
-
/** Stable key, also used in the test IDs. */
|
|
9
|
-
id: string;
|
|
10
|
-
/** The section's heading: Up. */
|
|
11
|
-
title?: string;
|
|
12
|
-
/** Muted text after the heading on the same line, such as what the heading means: → Momentum is rising. */
|
|
13
|
-
meaning?: string;
|
|
14
|
-
/** A glyph on the leading edge in a 40dp disc, such as an icon drawn in `useColors()[tone]`. Decorative: hidden from assistive technology. */
|
|
15
|
-
icon?: React.ReactNode;
|
|
16
|
-
/** Tints the section, its disc and its heading. Without it the section sits on the neutral fill. */
|
|
17
|
-
tone?: ExplainerTone;
|
|
18
|
-
/** Host content under the heading and before the body, centred, such as an example card and its caption. */
|
|
19
|
-
media?: React.ReactNode;
|
|
20
|
-
/** The section's text, muted. A string is drawn as Text; anything else as given. */
|
|
21
|
-
body?: React.ReactNode;
|
|
22
|
-
/** A small note at the end of the section. A string is drawn as Text; anything else as given. */
|
|
23
|
-
caveat?: React.ReactNode;
|
|
24
|
-
/** The section's test ID, in place of `<testID>-section-<id>`. */
|
|
25
|
-
testID?: string;
|
|
26
|
-
}
|
|
27
|
-
/** One action at the foot of the block. */
|
|
28
|
-
export interface ExplainerAction {
|
|
29
|
-
label: string;
|
|
30
|
-
onSelect: () => void;
|
|
31
|
-
/** Defaults to `primary` for `primaryAction` and `secondary` for `secondaryAction`. */
|
|
32
|
-
intent?: 'primary' | 'secondary' | 'destructive' | 'ghost';
|
|
33
|
-
disabled?: boolean;
|
|
34
|
-
busy?: boolean;
|
|
35
|
-
/** The button's test ID, in place of `<testID>-primary` or `<testID>-secondary`. */
|
|
36
|
-
testID?: string;
|
|
37
|
-
/** Pressable props for the button (native), such as `{android_disableSound: true}` when the host plays its own sound. HIG keeps its own name, role, state and press. */
|
|
38
|
-
pressProps?: ScreenHeaderControlProps;
|
|
39
|
-
/** A glyph after the label, such as an arrow for an action that opens something outside the app (test ID `<button test ID>-icon`). Decorative: hidden from assistive technology, so the label alone names the button. */
|
|
40
|
-
icon?: React.ReactNode;
|
|
41
|
-
}
|
|
42
|
-
export interface ExplainerBlockProps {
|
|
43
|
-
/** Heading of the header. Leave it out inside a host sheet that draws its own title. */
|
|
44
|
-
title?: string;
|
|
45
|
-
/** A kicker above the title in small muted capitals: Builder fee. With `title` it is centred in the header over the heading (`<testID>-eyebrow`); without one it is the block's first line (`<testID>-eyebrow` too). Host text. */
|
|
46
|
-
eyebrow?: string;
|
|
47
|
-
/** Short host text in a badge beside the title, as `ScreenHeader` `badge` (needs `title`): Demo. */
|
|
48
|
-
badge?: string;
|
|
49
|
-
/** A ref to the header's title (the title and badge as one header with `badge`), for example to move accessibility focus to it when the sheet opens. Needs `title`. */
|
|
50
|
-
titleRef?: React.Ref<React.ComponentRef<typeof View>>;
|
|
51
|
-
/** A large figure or host media centred under the header and before the lead (`<testID>-hero`), such as a 68pt “4% off” or a donut. Drawn as given; the host sets its size and colour, and hides decorative media from assistive technology. */
|
|
52
|
-
hero?: React.ReactNode;
|
|
53
|
-
/** A lead paragraph under the header, muted. A string is drawn as Text; anything else as given. */
|
|
54
|
-
description?: React.ReactNode;
|
|
55
|
-
/** The titled sections, in order. */
|
|
56
|
-
sections?: readonly ExplainerSection[];
|
|
57
|
-
/** Numbered steps after the sections, such as how to finish a task. A string is drawn as Text; anything else as given. */
|
|
58
|
-
steps?: readonly React.ReactNode[];
|
|
59
|
-
/** A small note after the sections and steps. */
|
|
60
|
-
caveat?: React.ReactNode;
|
|
61
|
-
/** Host content after the sections, steps and closing note and before the actions, such as a field, a link or a share card. Drawn as given. */
|
|
62
|
-
children?: React.ReactNode;
|
|
63
|
-
/** The main action: Got it, Copy link. */
|
|
64
|
-
primaryAction?: ExplainerAction;
|
|
65
|
-
/** A second action on the leading side of the main one, the two sharing the row equally: Not now. */
|
|
66
|
-
secondaryAction?: ExplainerAction;
|
|
67
|
-
/** Keeps the provider's feedback off the actions, for a host that plays its own cue. */
|
|
68
|
-
suppressFeedback?: boolean;
|
|
69
|
-
/** Shows Back on the leading edge of the header (needs `title`). */
|
|
70
|
-
onBack?: () => void;
|
|
71
|
-
/** Pressable props for Back, such as `{android_disableSound: true}`. */
|
|
72
|
-
backProps?: ScreenHeaderControlProps;
|
|
73
|
-
/** A control on the trailing edge of the header, such as a Close IconButton. */
|
|
74
|
-
headerAction?: React.ReactNode;
|
|
75
|
-
/** `nativeID` of the title, so a sheet can name itself with `accessibilityLabelledBy` (Android). */
|
|
76
|
-
headingId?: string;
|
|
77
|
-
/** Keeps the header pinned while the rest scrolls: the block becomes its own scroll view with the header as its sticky first child. Needs `title`; place it in a bounded container. */
|
|
78
|
-
stickyHeader?: boolean;
|
|
79
|
-
/** With `stickyHeader`: the header's fill once content is under it. Defaults to the background role; in a sheet pass the sheet's fill. */
|
|
80
|
-
stickyHeaderBackground?: string;
|
|
81
|
-
/** The scroll view used with `stickyHeader`, such as a sheet library's own. */
|
|
82
|
-
scrollComponent?: React.ComponentType<ScrollViewProps>;
|
|
83
|
-
/** Prefix of the test IDs: `<testID>-header`, `-back`, `-title`, `-description`, `-section-<id>` (with `-icon`, `-title`, `-media`, `-body` and `-caveat` after it), `-step-<index>`, `-caveat`, `-actions`, `-secondary` and `-primary`. Defaults to `explainer`. */
|
|
84
|
-
testID?: string;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* How something works, or how to finish a task, as a screen: an optional header, a lead paragraph, titled sections (each with an optional
|
|
88
|
-
* icon and tone, a heading, media, a body and a caveat), numbered steps, a closing note, then one or two actions. Draws the "How Swing
|
|
89
|
-
* works" and "How Trend works" sheets and short task dialogs such as inviting a friend.
|
|
90
|
-
*/
|
|
91
|
-
export declare function ExplainerBlock({ title, eyebrow, badge, titleRef, hero, description, sections, steps, caveat, children, primaryAction, secondaryAction, suppressFeedback, onBack, backProps, headerAction, headingId, stickyHeader, stickyHeaderBackground, scrollComponent, testID }: ExplainerBlockProps): React.JSX.Element;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { withAlpha } from '@bloxwap/hig/tokens';
|
|
4
|
-
import { useColors, useFills, useHIG } from './provider.js';
|
|
5
|
-
import { Text } from './surface.js';
|
|
6
|
-
import * as en from '@bloxwap/hig/contracts/messages';
|
|
7
|
-
import { Button, busyAccessibilityLabel } from './button.js';
|
|
8
|
-
import { ScreenHeader } from './screen-header.js';
|
|
9
|
-
import { StickyHeaderLayout } from './sticky-header.js';
|
|
10
|
-
const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
|
|
11
|
-
/** Test ID parts, which double as the actions' default intents. */
|
|
12
|
-
const primaryPart = 'primary', secondaryPart = 'secondary', descriptionPart = 'description', caveatPart = 'caveat';
|
|
13
|
-
/**
|
|
14
|
-
* How something works, or how to finish a task, as a screen: an optional header, a lead paragraph, titled sections (each with an optional
|
|
15
|
-
* icon and tone, a heading, media, a body and a caveat), numbered steps, a closing note, then one or two actions. Draws the "How Swing
|
|
16
|
-
* works" and "How Trend works" sheets and short task dialogs such as inviting a friend.
|
|
17
|
-
*/
|
|
18
|
-
export function ExplainerBlock({ title, eyebrow, badge, titleRef, hero, description, sections = [], steps = [], caveat, children, primaryAction, secondaryAction, suppressFeedback, onBack, backProps, headerAction, headingId, stickyHeader, stickyHeaderBackground, scrollComponent, testID = 'explainer' }) {
|
|
19
|
-
const colors = useColors(), fills = useFills(), { direction, messages } = useHIG();
|
|
20
|
-
const id = (part) => `${testID}-${part}`;
|
|
21
|
-
const muted = { fontSize: 14, lineHeight: 20, color: colors.muted };
|
|
22
|
-
// Host text is drawn as muted Text; host nodes are drawn as given.
|
|
23
|
-
const prose = (content, part) => typeof content === 'string' || typeof content === 'number' ? _jsx(Text, { testID: id(part), style: muted, children: content }) : _jsx(View, { testID: id(part), children: content });
|
|
24
|
-
const shown = (content) => content != null && content !== false;
|
|
25
|
-
const action = (entry, fallback) => { const button = entry.testID ?? id(fallback); /* With an icon, the label alone names the button (and its busy reading), so a Text glyph is never read into it. */ /* With an icon, the label alone names the button (and its busy reading), so a Text glyph is never read into it. */ const named = shown(entry.icon) ? { accessibilityLabel: entry.busy ? busyAccessibilityLabel(entry.label, messages.busy ?? en.busy) : entry.label } : {}; return _jsxs(Button, { ...entry.pressProps, ...named, testID: button, intent: entry.intent ?? fallback, disabled: entry.disabled, busy: entry.busy, suppressFeedback: suppressFeedback, onPress: entry.onSelect, style: { flex: 1, alignSelf: 'auto' }, children: [entry.label, shown(entry.icon) ? _jsx(View, { ...hidden, testID: `${button}-icon`, children: entry.icon }, 'icon') : null] }); };
|
|
26
|
-
const header = title !== undefined ? _jsx(ScreenHeader, { title: title, eyebrow: eyebrow, badge: badge, titleRef: titleRef, onBack: onBack, backProps: backProps, action: headerAction, headingId: headingId, testID: testID }) : null;
|
|
27
|
-
const body = _jsxs(_Fragment, { children: [header === null && eyebrow ? _jsx(Text, { testID: id('eyebrow'), style: { fontSize: 12, lineHeight: 16, letterSpacing: 1.5, textTransform: 'uppercase', color: colors.muted }, children: eyebrow }) : null, shown(hero) ? _jsx(View, { testID: id('hero'), style: { alignItems: 'center' }, children: hero }) : null, shown(description) ? prose(description, descriptionPart) : null, sections.length > 0 ? _jsx(View, { testID: id('sections'), style: { gap: 12 }, children: sections.map(section => {
|
|
28
|
-
const part = `section-${section.id}`, bodyPart = `${part}-body`, sectionCaveatPart = `${part}-caveat`, tone = section.tone ? colors[section.tone] : undefined;
|
|
29
|
-
return _jsxs(View, { testID: section.testID ?? id(part), style: { direction, flexDirection: 'row', alignItems: section.icon != null ? 'flex-start' : 'center', gap: 12, padding: 12, borderRadius: section.icon != null ? 32 : 16, backgroundColor: tone ? withAlpha(tone, 0.1) : fills.well }, children: [section.icon != null ? _jsx(View, { ...hidden, testID: id(`${part}-icon`), style: { width: 40, height: 40, borderRadius: 20, alignItems: 'center', justifyContent: 'center', backgroundColor: withAlpha(tone ?? colors.text, 0.15) }, children: section.icon }) : null, _jsxs(View, { style: { flex: 1, minWidth: 0, gap: 4 }, children: [section.title !== undefined ? _jsxs(Text, { testID: id(`${part}-title`), accessibilityRole: 'header', style: { fontSize: 16, lineHeight: 24, fontWeight: '700', color: tone ?? colors.text }, children: [section.title, section.meaning ? _jsx(Text, { style: { color: colors.muted }, children: ` ${section.meaning}` }) : null] }) : null, section.media != null ? _jsx(View, { testID: id(`${part}-media`), style: { alignItems: 'center', gap: 8, marginVertical: 12 }, children: section.media }) : null, shown(section.body) ? prose(section.body, bodyPart) : null, shown(section.caveat) ? prose(section.caveat, sectionCaveatPart) : null] })] }, section.id);
|
|
30
|
-
}) }) : null, steps.length > 0 ? _jsx(View, { testID: id('steps'), style: { gap: 8 }, children: steps.map((step, index) => _jsxs(View, { testID: id(`step-${index}`), accessible: typeof step === 'string' || typeof step === 'number', style: { direction, flexDirection: 'row', gap: 8 }, children: [_jsx(Text, { style: { ...muted, minWidth: 16, fontVariant: ['tabular-nums'] }, children: `${index + 1}.` }), typeof step === 'string' || typeof step === 'number' ? _jsx(Text, { style: { ...muted, flexShrink: 1 }, children: step }) : _jsx(View, { style: { flexShrink: 1 }, children: step })] }, index)) }) : null, shown(caveat) ? prose(caveat, caveatPart) : null, children, primaryAction || secondaryAction ? _jsxs(View, { testID: id('actions'), style: { direction, flexDirection: 'row', gap: 8 }, children: [secondaryAction ? action(secondaryAction, secondaryPart) : null, primaryAction ? action(primaryAction, primaryPart) : null] }) : null] });
|
|
31
|
-
if (stickyHeader && header)
|
|
32
|
-
return _jsx(StickyHeaderLayout, { testID: testID, headerTestID: id('sticky-header'), header: header, background: stickyHeaderBackground, scrollComponent: scrollComponent, bodyStyle: { direction, gap: 16, paddingTop: 16 }, children: body });
|
|
33
|
-
return _jsxs(View, { testID: testID, style: { direction, padding: 16, gap: 16 }, children: [header, body] });
|
|
34
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type ScreenHeaderControlProps } from './screen-header.js';
|
|
3
|
-
/** The colour of a section: its tint, its icon disc and its heading. */
|
|
4
|
-
export type ExplainerTone = 'up' | 'down' | 'positive' | 'negative' | 'warning';
|
|
5
|
-
/** One titled part of the explanation. Every field is optional, so a section can be a heading and a sentence, an icon row, or host media with a caption. */
|
|
6
|
-
export interface ExplainerSection {
|
|
7
|
-
/** Stable key, also used in native test IDs. */
|
|
8
|
-
id: string;
|
|
9
|
-
/** The section's heading: Up. */
|
|
10
|
-
title?: string;
|
|
11
|
-
/** Muted text after the heading on the same line, such as what the heading means: → Momentum is rising. */
|
|
12
|
-
meaning?: string;
|
|
13
|
-
/** A glyph on the leading edge in a disc, drawn in `currentColor` (the tone's colour). Decorative: hidden from assistive technology. */
|
|
14
|
-
icon?: React.ReactNode;
|
|
15
|
-
/** Tints the section, its disc and its heading. Without it the section sits on the neutral fill. */
|
|
16
|
-
tone?: ExplainerTone;
|
|
17
|
-
/** Host content under the heading and before the body, centred, such as an example card and its caption. */
|
|
18
|
-
media?: React.ReactNode;
|
|
19
|
-
/** The section's text, muted. */
|
|
20
|
-
body?: React.ReactNode;
|
|
21
|
-
/** A small note at the end of the section, such as what the signal does not promise. */
|
|
22
|
-
caveat?: React.ReactNode;
|
|
23
|
-
/** The section's `data-testid`. */
|
|
24
|
-
testID?: string;
|
|
25
|
-
}
|
|
26
|
-
/** One action at the foot of the block. */
|
|
27
|
-
export interface ExplainerAction {
|
|
28
|
-
label: string;
|
|
29
|
-
onSelect: () => void;
|
|
30
|
-
/** Defaults to `primary` for `primaryAction` and `secondary` for `secondaryAction`. */
|
|
31
|
-
intent?: 'primary' | 'secondary' | 'destructive' | 'ghost';
|
|
32
|
-
disabled?: boolean;
|
|
33
|
-
busy?: boolean;
|
|
34
|
-
/** The button's `data-testid`. */
|
|
35
|
-
testID?: string;
|
|
36
|
-
/** A glyph after the label, such as an arrow for an action that opens something outside the app. Decorative: hidden from assistive technology, so the label alone names the button. */
|
|
37
|
-
icon?: React.ReactNode;
|
|
38
|
-
}
|
|
39
|
-
export interface ExplainerBlockProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
|
|
40
|
-
/** Heading of the header. Leave it out inside a host dialog or sheet that draws its own title. */
|
|
41
|
-
title?: string;
|
|
42
|
-
/** A kicker above the title in small muted capitals: Builder fee. With `title` it is centred in the header over the heading; without one it is the block's first line. Host text. */
|
|
43
|
-
eyebrow?: string;
|
|
44
|
-
/** Short host text in a badge beside the title, as `ScreenHeader` `badge` (needs `title`): Demo. */
|
|
45
|
-
badge?: string;
|
|
46
|
-
/** A large figure or host media centred under the header and before the lead, such as a 68px “4% off” or a donut. Drawn as given; the host sets its size and colour, and hides decorative media from assistive technology. */
|
|
47
|
-
hero?: React.ReactNode;
|
|
48
|
-
/** A lead paragraph under the header, muted. */
|
|
49
|
-
description?: React.ReactNode;
|
|
50
|
-
/** The titled sections, in order. */
|
|
51
|
-
sections?: readonly ExplainerSection[];
|
|
52
|
-
/** Numbered steps after the sections, such as how to finish a task. */
|
|
53
|
-
steps?: readonly React.ReactNode[];
|
|
54
|
-
/** A small note after the sections and steps, such as what the whole explanation does not promise. */
|
|
55
|
-
caveat?: React.ReactNode;
|
|
56
|
-
/** Host content after the sections, steps and closing note and before the actions, such as a field, a link or a share card. Drawn as given. */
|
|
57
|
-
children?: React.ReactNode;
|
|
58
|
-
/** The main action: Got it, Copy link. */
|
|
59
|
-
primaryAction?: ExplainerAction;
|
|
60
|
-
/** A second action on the leading side of the main one, the two sharing the row equally: Not now. */
|
|
61
|
-
secondaryAction?: ExplainerAction;
|
|
62
|
-
/** Keeps the provider's feedback off the actions, for a host that plays its own cue. */
|
|
63
|
-
suppressFeedback?: boolean;
|
|
64
|
-
/** Shows Back on the leading edge of the header (needs `title`). */
|
|
65
|
-
onBack?: () => void;
|
|
66
|
-
/** Attributes for the header's Back `<button>`. */
|
|
67
|
-
backProps?: ScreenHeaderControlProps;
|
|
68
|
-
/** A control on the trailing edge of the header, such as a Close `IconButton`. */
|
|
69
|
-
headerAction?: React.ReactNode;
|
|
70
|
-
/** `id` of the header's heading, so a dialog or sheet can name itself with `aria-labelledby`. */
|
|
71
|
-
headingId?: string;
|
|
72
|
-
/** Pins the header to the top of the nearest scroller. See Pinned headers. */
|
|
73
|
-
stickyHeader?: boolean;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* How something works, or how to finish a task: an optional header, a lead paragraph, titled sections (each with an optional icon and
|
|
77
|
-
* tone, a heading, media, a body and a caveat), numbered steps, a closing note, then one or two actions. Draws the “How Swing works” and
|
|
78
|
-
* “How Trend works” sheets and short task dialogs such as inviting a friend.
|
|
79
|
-
*/
|
|
80
|
-
export declare function ExplainerBlock({ title, eyebrow, badge, hero, description, sections, steps, caveat, children, primaryAction, secondaryAction, suppressFeedback, onBack, backProps, headerAction, headingId, stickyHeader, className, ...rest }: ExplainerBlockProps): React.JSX.Element;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useId } from 'react';
|
|
4
|
-
import { Button } from '../button.js';
|
|
5
|
-
import { ScreenHeader } from './screen-header.js';
|
|
6
|
-
/** The actions' default intents. */
|
|
7
|
-
const primaryIntent = 'primary', secondaryIntent = 'secondary';
|
|
8
|
-
/**
|
|
9
|
-
* How something works, or how to finish a task: an optional header, a lead paragraph, titled sections (each with an optional icon and
|
|
10
|
-
* tone, a heading, media, a body and a caveat), numbered steps, a closing note, then one or two actions. Draws the “How Swing works” and
|
|
11
|
-
* “How Trend works” sheets and short task dialogs such as inviting a friend.
|
|
12
|
-
*/
|
|
13
|
-
export function ExplainerBlock({ title, eyebrow, badge, hero, description, sections = [], steps = [], caveat, children, primaryAction, secondaryAction, suppressFeedback, onBack, backProps, headerAction, headingId, stickyHeader, className, ...rest }) {
|
|
14
|
-
const id = useId();
|
|
15
|
-
const action = (entry, fallback) => _jsxs(Button, { intent: entry.intent ?? fallback, disabled: entry.disabled, busy: entry.busy, suppressFeedback: suppressFeedback, "data-testid": entry.testID, onClick: entry.onSelect, children: [entry.label, entry.icon != null && entry.icon !== false ? _jsx("span", { className: 'hig-explainer-action-icon', "aria-hidden": 'true', children: entry.icon }) : null] });
|
|
16
|
-
return _jsxs("section", { ...rest, className: `hig-explainer${className ? ` ${className}` : ''}`, children: [title !== undefined ? _jsx(ScreenHeader, { title: title, eyebrow: eyebrow, badge: badge, onBack: onBack, backProps: backProps, action: headerAction, headingId: headingId, stickyHeader: stickyHeader }) : eyebrow ? _jsx("p", { className: 'hig-explainer-eyebrow', children: eyebrow }) : null, hero != null && hero !== false && _jsx("div", { className: 'hig-explainer-hero', children: hero }), description != null && description !== false && _jsx("p", { className: 'hig-explainer-text', children: description }), sections.length > 0 && _jsx("div", { className: 'hig-explainer-sections', children: sections.map(section => {
|
|
17
|
-
const heading = section.title !== undefined ? `${id}-${section.id}` : undefined;
|
|
18
|
-
return _jsxs("div", { className: 'hig-explainer-section', "data-tone": section.tone, "data-testid": section.testID, children: [section.icon != null && _jsx("span", { className: 'hig-explainer-icon', "aria-hidden": 'true', children: section.icon }), _jsxs("div", { children: [section.title !== undefined && _jsxs("h3", { id: heading, children: [section.title, section.meaning ? _jsxs(_Fragment, { children: [" ", _jsx("span", { children: section.meaning })] }) : null] }), section.media != null && _jsx("div", { className: 'hig-explainer-media', children: section.media }), section.body != null && section.body !== false && _jsx("div", { className: 'hig-explainer-text', children: section.body }), section.caveat != null && section.caveat !== false && _jsx("p", { className: 'hig-explainer-text', "data-caveat": '', children: section.caveat })] })] }, section.id);
|
|
19
|
-
}) }), steps.length > 0 && _jsx("ol", { className: 'hig-explainer-steps hig-explainer-text', children: steps.map((step, index) => _jsx("li", { children: step }, index)) }), caveat != null && caveat !== false && _jsx("p", { className: 'hig-explainer-text', "data-caveat": '', children: caveat }), children, (primaryAction || secondaryAction) && _jsxs("div", { className: 'hig-confirm-actions', children: [secondaryAction && action(secondaryAction, secondaryIntent), primaryAction && action(primaryAction, primaryIntent)] })] });
|
|
20
|
-
}
|