@scalewing/react 1.27.0 → 1.28.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +60 -2
  3. package/dist/components/DenominationGrid.d.ts +4 -1
  4. package/dist/components/DenominationGrid.js +8 -3
  5. package/dist/components/Dialog.d.ts +28 -4
  6. package/dist/components/Dialog.js +20 -2
  7. package/dist/components/Notice.d.ts +69 -0
  8. package/dist/components/Notice.js +48 -0
  9. package/dist/components/Progress.d.ts +3 -1
  10. package/dist/components/Progress.js +4 -0
  11. package/dist/components/Toast.d.ts +20 -4
  12. package/dist/components/Toast.js +44 -21
  13. package/dist/components/denomination-grid/DenominationStrip.d.ts +5 -2
  14. package/dist/components/denomination-grid/DenominationStrip.js +2 -2
  15. package/dist/components/denomination-grid/DenominationTiles.d.ts +5 -2
  16. package/dist/components/denomination-grid/DenominationTiles.js +2 -2
  17. package/dist/components/denomination-grid/types.d.ts +9 -0
  18. package/dist/components/dialog/DialogFooter.d.ts +14 -0
  19. package/dist/components/dialog/DialogFooter.js +11 -0
  20. package/dist/components/dialog/DialogTitle.d.ts +11 -4
  21. package/dist/components/dialog/DialogTitle.js +8 -6
  22. package/dist/components/toast/ToastContent.d.ts +22 -0
  23. package/dist/components/toast/ToastContent.js +21 -0
  24. package/dist/components/toast/use-toast-hold.d.ts +28 -0
  25. package/dist/components/toast/use-toast-hold.js +53 -0
  26. package/dist/components/toast/use-toast-timer.d.ts +15 -0
  27. package/dist/components/toast/use-toast-timer.js +34 -0
  28. package/dist/css/css-components.js +9 -0
  29. package/dist/css/css-denomination-grid.js +4 -0
  30. package/dist/css/css-denomination-label.d.ts +10 -0
  31. package/dist/css/css-denomination-label.js +36 -0
  32. package/dist/css/css-dialog-frame.d.ts +2 -0
  33. package/dist/css/css-dialog-frame.js +83 -0
  34. package/dist/css/css-dialog.js +20 -4
  35. package/dist/css/css-notice.d.ts +22 -0
  36. package/dist/css/css-notice.js +168 -0
  37. package/dist/css/css-progress.d.ts +3 -0
  38. package/dist/css/css-progress.js +13 -6
  39. package/dist/css/css-toast-card.d.ts +5 -0
  40. package/dist/css/css-toast-card.js +122 -0
  41. package/dist/css/css-variables.js +1 -0
  42. package/dist/css/stylesheet.js +6 -0
  43. package/dist/index.d.ts +6 -5
  44. package/dist/index.js +5 -4
  45. package/dist/styles.css +299 -1
  46. package/package.json +1 -1
package/dist/styles.css CHANGED
@@ -48,6 +48,7 @@
48
48
  --sw-container-max: 72rem;
49
49
  --sw-dialog-max: 32rem;
50
50
  --sw-dialog-max-lg: 56rem;
51
+ --sw-dialog-max-xl: 65rem;
51
52
  --sw-select-max: 16rem;
52
53
  --sw-split-min: 14rem;
53
54
  --sw-split-size: 22rem;
@@ -112,6 +113,7 @@
112
113
  --sw-container-max: 72rem;
113
114
  --sw-dialog-max: 32rem;
114
115
  --sw-dialog-max-lg: 56rem;
116
+ --sw-dialog-max-xl: 65rem;
115
117
  --sw-select-max: 16rem;
116
118
  --sw-split-min: 14rem;
117
119
  --sw-split-size: 22rem;
@@ -2182,6 +2184,10 @@ body {
2182
2184
  max-width: min(var(--sw-dialog-max-lg), calc(100vw - var(--sw-space-8)));
2183
2185
  }
2184
2186
 
2187
+ .sw-dialog-xl {
2188
+ max-width: min(var(--sw-dialog-max-xl), calc(100vw - var(--sw-space-8)));
2189
+ }
2190
+
2185
2191
  @media not all and (min-width: 48rem) {
2186
2192
  .sw-dialog-sheet-below-md {
2187
2193
  border-radius: var(--sw-radius-lg) var(--sw-radius-lg) 0 0;
@@ -2198,6 +2204,12 @@ body {
2198
2204
  .sw-dialog-sheet-below-md[open] {
2199
2205
  animation: sw-dialog-sheet-in var(--sw-motion-default) var(--sw-motion-easing);
2200
2206
  }
2207
+
2208
+ .sw-dialog-sheet-below-md .sw-dialog-footer {
2209
+ bottom: calc(-1 * (var(--sw-space-5) + env(safe-area-inset-bottom, 0px)));
2210
+ margin-bottom: calc(-1 * (var(--sw-space-5) + env(safe-area-inset-bottom, 0px)));
2211
+ padding-bottom: calc(var(--sw-space-3) + env(safe-area-inset-bottom, 0px));
2212
+ }
2201
2213
  }
2202
2214
 
2203
2215
  @keyframes sw-dialog-sheet-in {
@@ -2223,7 +2235,8 @@ body {
2223
2235
  gap: var(--sw-space-2);
2224
2236
  }
2225
2237
 
2226
- .sw-dialog-header > :first-child {
2238
+ .sw-dialog-header > :is(h2, h3),
2239
+ .sw-dialog-titles {
2227
2240
  flex: 1 1 auto;
2228
2241
  min-width: 0;
2229
2242
  }
@@ -2270,6 +2283,64 @@ body {
2270
2283
  .sw-dialog-close-glyph::before { transform: rotate(45deg); }
2271
2284
  .sw-dialog-close-glyph::after { transform: rotate(-45deg); }
2272
2285
 
2286
+ .sw-dialog-header-framed {
2287
+ align-items: center;
2288
+ gap: var(--sw-space-3);
2289
+ }
2290
+
2291
+ .sw-dialog-icon {
2292
+ display: inline-flex;
2293
+ flex: none;
2294
+ }
2295
+
2296
+ .sw-dialog-description { margin: 0; }
2297
+
2298
+ .sw-dialog-footer {
2299
+ align-items: center;
2300
+ background: var(--sw-color-surface);
2301
+ border-top: 1px solid var(--sw-color-border);
2302
+ /* Sticky insets count from the scrollport's padding edge: step past the
2303
+ dialog's own padding to sit on its bottom edge. */
2304
+ bottom: calc(-1 * var(--sw-space-5));
2305
+ box-sizing: border-box;
2306
+ display: flex;
2307
+ flex-wrap: wrap;
2308
+ gap: var(--sw-space-2) var(--sw-space-4);
2309
+ margin: 0 calc(-1 * var(--sw-space-5)) calc(-1 * var(--sw-space-5));
2310
+ padding: var(--sw-space-3) var(--sw-space-5);
2311
+ position: sticky;
2312
+ }
2313
+
2314
+ .sw-dialog-footer-status {
2315
+ align-items: center;
2316
+ display: flex;
2317
+ flex: 1 1 auto;
2318
+ min-width: 0;
2319
+ }
2320
+
2321
+ /* With no summary the live region stays in the dialog, so a first figure
2322
+ is still announced, but it takes no room in the footer. */
2323
+ .sw-dialog-footer-status:empty {
2324
+ clip-path: inset(50%);
2325
+ height: 1px;
2326
+ overflow: hidden;
2327
+ position: absolute;
2328
+ width: 1px;
2329
+ }
2330
+
2331
+ .sw-dialog-footer-actions {
2332
+ display: flex;
2333
+ flex: 0 1 auto;
2334
+ flex-wrap: wrap;
2335
+ gap: var(--sw-space-2);
2336
+ justify-content: flex-end;
2337
+ margin-inline-start: auto;
2338
+ }
2339
+
2340
+ @media (forced-colors: active) {
2341
+ .sw-dialog-footer { border-top-color: CanvasText; }
2342
+ }
2343
+
2273
2344
  .sw-accordion {
2274
2345
  background: var(--sw-glass-fill);
2275
2346
  border: 1px solid var(--sw-glass-border);
@@ -2893,6 +2964,7 @@ body {
2893
2964
 
2894
2965
  .sw-progress-accent { --sw-progress-color: var(--sw-color-accent); }
2895
2966
  .sw-progress-success { --sw-progress-color: var(--sw-color-success); }
2967
+ .sw-progress-warning { --sw-progress-color: var(--sw-color-warning); }
2896
2968
  .sw-progress-danger { --sw-progress-color: var(--sw-color-danger); }
2897
2969
 
2898
2970
  .sw-progress-heading {
@@ -2943,6 +3015,117 @@ body {
2943
3015
  .sw-progress-bar::-moz-progress-bar { background: Highlight; }
2944
3016
  }
2945
3017
 
3018
+ .sw-notice-info { --sw-notice-fill: var(--sw-color-accentSubtle); --sw-notice-ink: color-mix(in srgb, var(--sw-color-accent) 70%, var(--sw-color-text)); }
3019
+ .sw-notice-success { --sw-notice-fill: color-mix(in srgb, var(--sw-color-success) 10%, var(--sw-color-surface)); --sw-notice-ink: color-mix(in srgb, var(--sw-color-success) 70%, var(--sw-color-text)); }
3020
+ .sw-notice-warning { --sw-notice-fill: color-mix(in srgb, var(--sw-color-warning) 10%, var(--sw-color-surface)); --sw-notice-ink: color-mix(in srgb, var(--sw-color-warning) 70%, var(--sw-color-text)); }
3021
+ .sw-notice-danger { --sw-notice-fill: color-mix(in srgb, var(--sw-color-danger) 10%, var(--sw-color-surface)); --sw-notice-ink: color-mix(in srgb, var(--sw-color-danger) 70%, var(--sw-color-text)); }
3022
+
3023
+ .sw-notice {
3024
+ align-items: flex-start;
3025
+ background: var(--sw-notice-fill);
3026
+ border-radius: var(--sw-radius-sm);
3027
+ box-sizing: border-box;
3028
+ color: var(--sw-notice-ink);
3029
+ column-gap: var(--sw-space-2);
3030
+ display: flex;
3031
+ flex-wrap: wrap;
3032
+ font-family: var(--sw-font-sans);
3033
+ font-size: 15px;
3034
+ letter-spacing: -0.2px;
3035
+ line-height: 20px;
3036
+ min-width: 0;
3037
+ padding: var(--sw-space-2) var(--sw-space-3);
3038
+ row-gap: var(--sw-space-2);
3039
+ /* Muted words of a control inside (a field's or a checkbox's
3040
+ description) take the ink, which keeps 4.5:1 on the fill. */
3041
+ --sw-color-muted: var(--sw-notice-ink);
3042
+ }
3043
+
3044
+ .sw-notice-icon {
3045
+ display: inline-flex;
3046
+ flex: none;
3047
+ min-height: 20px;
3048
+ align-items: center;
3049
+ }
3050
+
3051
+ .sw-notice-content {
3052
+ align-items: baseline;
3053
+ column-gap: var(--sw-space-2);
3054
+ display: flex;
3055
+ flex: 1 1 16rem;
3056
+ flex-wrap: wrap;
3057
+ min-width: 0;
3058
+ row-gap: var(--sw-space-1);
3059
+ }
3060
+
3061
+ .sw-notice-stacked {
3062
+ align-items: stretch;
3063
+ flex-direction: column;
3064
+ row-gap: var(--sw-space-2);
3065
+ }
3066
+
3067
+ .sw-notice-title {
3068
+ font-weight: 600;
3069
+ min-width: 0;
3070
+ }
3071
+
3072
+ .sw-notice-body {
3073
+ flex: 1 1 auto;
3074
+ font-weight: 400;
3075
+ min-width: 0;
3076
+ }
3077
+
3078
+ .sw-notice-action {
3079
+ align-items: center;
3080
+ align-self: flex-start;
3081
+ display: inline-flex;
3082
+ flex: none;
3083
+ min-height: 20px;
3084
+ }
3085
+
3086
+ /* A small Button keeps the note one text line tall: it overhangs the
3087
+ padding evenly instead of growing the row. */
3088
+ .sw-notice-action > .sw-button {
3089
+ margin-block: calc((20px - var(--sw-control-sm-min-height)) / 2);
3090
+ }
3091
+
3092
+ /* A band across the page's full width, such as an environment strip
3093
+ above the app header: square, the xs control height, caption type,
3094
+ its words centered on one line that wraps on a phone. A glyph or an
3095
+ action stays on the words' row (no wrap): the words wrap instead. */
3096
+ .sw-notice-band {
3097
+ align-items: center;
3098
+ border-radius: 0;
3099
+ flex-wrap: nowrap;
3100
+ font-size: 13px;
3101
+ justify-content: center;
3102
+ letter-spacing: -0.08px;
3103
+ line-height: 18px;
3104
+ min-height: var(--sw-control-xs-min-height);
3105
+ padding: var(--sw-space-1) var(--sw-space-4);
3106
+ text-align: center;
3107
+ width: 100%;
3108
+ }
3109
+
3110
+ .sw-notice-band .sw-notice-content {
3111
+ flex: 0 1 auto;
3112
+ justify-content: center;
3113
+ }
3114
+
3115
+ .sw-notice-band .sw-notice-icon,
3116
+ .sw-notice-band .sw-notice-action { min-height: 18px; }
3117
+
3118
+ .sw-notice-band .sw-notice-action { align-self: center; }
3119
+
3120
+ .sw-notice-band .sw-notice-action > .sw-button {
3121
+ margin-block: calc((18px - var(--sw-control-sm-min-height)) / 2);
3122
+ }
3123
+
3124
+ @media (forced-colors: active) {
3125
+ .sw-notice { border: 1px solid CanvasText; }
3126
+ .sw-notice-band { border-width: 0 0 1px; }
3127
+ }
3128
+
2946
3129
  .sw-tooltip-anchor {
2947
3130
  display: inline-flex;
2948
3131
  position: relative;
@@ -3727,6 +3910,28 @@ body {
3727
3910
  .sw-denomination-strip-aligned .sw-denomination-total-head { width: 0; }
3728
3911
  }
3729
3912
 
3913
+ .sw-denomination-labels-plain .sw-denomination-label {
3914
+ border-inline-start: 0;
3915
+ color: var(--sw-color-text);
3916
+ }
3917
+
3918
+ /* The total under a phone's label keeps its row's tone. */
3919
+ .sw-denomination-labels-plain .sw-denomination-total-inline { color: var(--sw-denomination-tone); }
3920
+
3921
+ .sw-denomination-strip.sw-denomination-labels-plain .sw-denomination-label {
3922
+ padding-inline-start: var(--sw-space-2);
3923
+ }
3924
+
3925
+ .sw-denomination-strip.sw-denomination-labels-plain .sw-denomination-label::before { content: none; }
3926
+
3927
+ @media not all and (min-width: 48rem) {
3928
+ .sw-denomination-strip.sw-denomination-labels-plain .sw-denomination-label { padding-inline-start: var(--sw-space-1); }
3929
+ }
3930
+
3931
+ @media (forced-colors: active) {
3932
+ .sw-denomination-labels-plain .sw-denomination-label { color: CanvasText; }
3933
+ }
3934
+
3730
3935
  @media (forced-colors: active) {
3731
3936
  .sw-denomination-label { border-inline-start-color: CanvasText; color: CanvasText; }
3732
3937
  .sw-denomination-strip .sw-denomination-label::before { background: CanvasText; forced-color-adjust: none; }
@@ -4292,6 +4497,99 @@ body {
4292
4497
  }
4293
4498
  }
4294
4499
 
4500
+ .sw-toast-title {
4501
+ display: block;
4502
+ font-size: 15px;
4503
+ font-weight: 600;
4504
+ letter-spacing: -0.2px;
4505
+ line-height: 20px;
4506
+ }
4507
+
4508
+ .sw-toast-detail {
4509
+ color: var(--sw-color-muted);
4510
+ font-size: 15px;
4511
+ font-weight: 400;
4512
+ letter-spacing: -0.2px;
4513
+ line-height: 20px;
4514
+ }
4515
+
4516
+ .sw-toast-row:has(.sw-toast-title) { align-items: flex-start; }
4517
+
4518
+ .sw-toast-row .sw-toast-body { flex: 1 1 auto; }
4519
+
4520
+ .sw-button.sw-toast-action {
4521
+ flex: none;
4522
+ margin-block: calc((20px - var(--sw-control-sm-min-height)) / 2);
4523
+ }
4524
+
4525
+ .sw-toast-interactive { pointer-events: auto; }
4526
+
4527
+ .sw-toast-top-end {
4528
+ bottom: auto;
4529
+ left: auto;
4530
+ max-width: min(var(--sw-dialog-max), calc(100% - var(--sw-space-4) - var(--sw-space-4)));
4531
+ right: max(var(--sw-space-4), env(safe-area-inset-right, 0px));
4532
+ top: max(var(--sw-space-4), env(safe-area-inset-top, 0px));
4533
+ translate: none;
4534
+ }
4535
+
4536
+ .sw-toast-top-end:dir(rtl) {
4537
+ left: max(var(--sw-space-4), env(safe-area-inset-left, 0px));
4538
+ right: auto;
4539
+ }
4540
+
4541
+ .sw-toast-top-end:popover-open {
4542
+ animation: sw-toast-drop var(--sw-motion-default) var(--sw-motion-easing);
4543
+ }
4544
+
4545
+ @keyframes sw-toast-drop {
4546
+ from {
4547
+ opacity: 0;
4548
+ translate: 0 calc(-1 * var(--sw-space-3));
4549
+ }
4550
+ to {
4551
+ opacity: 1;
4552
+ translate: none;
4553
+ }
4554
+ }
4555
+
4556
+ .sw-toast-remaining {
4557
+ background: var(--sw-color-border);
4558
+ border-radius: var(--sw-radius-pill);
4559
+ display: block;
4560
+ height: var(--sw-space-1);
4561
+ margin-top: var(--sw-space-2);
4562
+ overflow: hidden;
4563
+ position: relative;
4564
+ }
4565
+
4566
+ .sw-toast-remaining::after {
4567
+ animation: sw-toast-remaining var(--sw-toast-duration, 0ms) linear forwards;
4568
+ background: var(--sw-toast-tone, var(--sw-color-accent));
4569
+ content: '';
4570
+ inset: 0;
4571
+ position: absolute;
4572
+ transform-origin: left center;
4573
+ }
4574
+
4575
+ .sw-toast-remaining:dir(rtl)::after { transform-origin: right center; }
4576
+
4577
+ .sw-toast-paused .sw-toast-remaining::after { animation-play-state: paused; }
4578
+
4579
+ @keyframes sw-toast-remaining {
4580
+ from { transform: scaleX(1); }
4581
+ to { transform: scaleX(0); }
4582
+ }
4583
+
4584
+ @media (prefers-reduced-motion: reduce) {
4585
+ .sw-toast-top-end:popover-open { animation: none; }
4586
+ }
4587
+
4588
+ @media (forced-colors: active) {
4589
+ .sw-toast-remaining { background: Canvas; border: 1px solid CanvasText; }
4590
+ .sw-toast-remaining::after { background: CanvasText; }
4591
+ }
4592
+
4295
4593
  @media (min-width: 48rem) {
4296
4594
  .sw-hide-from-md { display: none; }
4297
4595
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalewing/react",
3
- "version": "1.27.0",
3
+ "version": "1.28.0",
4
4
  "description": "Scalewing DOM components and package-owned CSS utilities.",
5
5
  "type": "module",
6
6
  "license": "MIT",