@scalewing/react 1.71.0 → 1.73.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 (41) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +118 -2
  3. package/dist/components/Box.d.ts +3 -2
  4. package/dist/components/Box.js +3 -2
  5. package/dist/components/ListGroup.d.ts +11 -3
  6. package/dist/components/ListGroup.js +6 -3
  7. package/dist/components/MessageCard.d.ts +43 -0
  8. package/dist/components/MessageCard.js +40 -0
  9. package/dist/components/PersonPicker.d.ts +44 -0
  10. package/dist/components/PersonPicker.js +53 -0
  11. package/dist/components/PinStep.d.ts +52 -0
  12. package/dist/components/PinStep.js +45 -0
  13. package/dist/css/css-action-menu.js +11 -0
  14. package/dist/css/css-button-group-attached.js +6 -1
  15. package/dist/css/css-button-natural-width.d.ts +1 -0
  16. package/dist/css/css-button-natural-width.js +16 -0
  17. package/dist/css/css-button.js +2 -0
  18. package/dist/css/css-list-size.d.ts +3 -0
  19. package/dist/css/css-list-size.js +31 -0
  20. package/dist/css/css-list-tiles-bounded.d.ts +1 -0
  21. package/dist/css/css-list-tiles-bounded.js +74 -0
  22. package/dist/css/css-list-tiles.d.ts +1 -0
  23. package/dist/css/css-list-tiles.js +37 -7
  24. package/dist/css/css-list.d.ts +0 -1
  25. package/dist/css/css-list.js +18 -9
  26. package/dist/css/css-utilities.js +2 -0
  27. package/dist/css/list-row-metrics.d.ts +3 -0
  28. package/dist/css/list-row-metrics.js +18 -0
  29. package/dist/css/spacing-classes.d.ts +1 -1
  30. package/dist/css/spacing-classes.js +1 -0
  31. package/dist/css/stacking.js +2 -1
  32. package/dist/flex-item-classes.d.ts +15 -0
  33. package/dist/flex-item-classes.js +6 -0
  34. package/dist/index.d.ts +6 -1
  35. package/dist/index.js +5 -1
  36. package/dist/list-options.d.ts +13 -5
  37. package/dist/list-options.js +15 -7
  38. package/dist/person-names.d.ts +13 -0
  39. package/dist/person-names.js +18 -0
  40. package/dist/styles.css +87 -15
  41. package/package.json +1 -1
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A name as PersonPicker compares it: decomposed (NFD), its combining marks
3
+ * removed, in lower case, so "Ángel" and "angel" are the same.
4
+ */
5
+ export declare function comparableName(value: string): string;
6
+ /**
7
+ * The people whose name starts with what was typed, ignoring case and
8
+ * accents and the typed words' outer spaces, in the order given. Nothing
9
+ * typed (or only spaces) keeps everyone.
10
+ */
11
+ export declare function peopleStartingWith<Person extends {
12
+ name: string;
13
+ }>(people: readonly Person[], typed: string): Person[];
@@ -0,0 +1,18 @@
1
+ /**
2
+ * A name as PersonPicker compares it: decomposed (NFD), its combining marks
3
+ * removed, in lower case, so "Ángel" and "angel" are the same.
4
+ */
5
+ export function comparableName(value) {
6
+ return value.normalize('NFD').replace(/\p{M}/gu, '').toLocaleLowerCase('en');
7
+ }
8
+ /**
9
+ * The people whose name starts with what was typed, ignoring case and
10
+ * accents and the typed words' outer spaces, in the order given. Nothing
11
+ * typed (or only spaces) keeps everyone.
12
+ */
13
+ export function peopleStartingWith(people, typed) {
14
+ const start = comparableName(typed.trim());
15
+ if (start.length === 0)
16
+ return [...people];
17
+ return people.filter((person) => comparableName(person.name).startsWith(start));
18
+ }
package/dist/styles.css CHANGED
@@ -884,6 +884,7 @@ body {
884
884
  .sw-inline { display: flex; flex-direction: row; align-items: center; min-width: 0; }
885
885
  .sw-wrap { flex-wrap: wrap; }
886
886
  .sw-grow { flex-grow: 1; }
887
+ .sw-no-shrink { flex-shrink: 0; }
887
888
  .sw-full-width { width: 100%; }
888
889
  .sw-container { width: 100%; max-width: var(--sw-container-max); margin-inline: auto; }
889
890
  .sw-container-reading { width: 100%; max-width: var(--sw-reading-max); margin-inline: auto; }
@@ -1051,6 +1052,10 @@ body {
1051
1052
  @media (pointer: coarse) {
1052
1053
  .sw-button { min-height: var(--sw-control-md-min-height); min-width: var(--sw-control-md-min-height); }
1053
1054
  }
1055
+ .sw-button {
1056
+ flex-shrink: 0;
1057
+ max-width: 100%;
1058
+ }
1054
1059
  .sw-button-full {
1055
1060
  width: 100%;
1056
1061
  }
@@ -1085,6 +1090,7 @@ body {
1085
1090
 
1086
1091
  .sw-button-group.sw-button-group-attached > .sw-button {
1087
1092
  border-radius: 0;
1093
+ flex-shrink: 1;
1088
1094
  }
1089
1095
 
1090
1096
  .sw-button-group.sw-button-group-attached > .sw-button ~ .sw-button {
@@ -3123,31 +3129,31 @@ button.sw-date-toggle-day[aria-disabled='true'] {
3123
3129
  max-height: calc(var(--sw-list-max-rows) * (2 * var(--sw-space-3) + 20px + 18px + 1px));
3124
3130
  }
3125
3131
 
3126
- .sw-list-group-scroll.sw-scroll-more-top,
3127
- .sw-list-group-scroll.sw-scroll-more-bottom {
3132
+ .sw-list-group:not(.sw-list-group-tiles) > .sw-list-group-scroll.sw-scroll-more-top,
3133
+ .sw-list-group:not(.sw-list-group-tiles) > .sw-list-group-scroll.sw-scroll-more-bottom {
3128
3134
  background-repeat: no-repeat;
3129
3135
  background-size: 100% var(--sw-space-5);
3130
3136
  }
3131
3137
 
3132
- .sw-list-group-scroll.sw-scroll-more-top {
3138
+ .sw-list-group:not(.sw-list-group-tiles) > .sw-list-group-scroll.sw-scroll-more-top {
3133
3139
  background-image: linear-gradient(to bottom, color-mix(in srgb, var(--sw-color-text) 28%, transparent), transparent);
3134
3140
  background-position: top;
3135
3141
  }
3136
3142
 
3137
- .sw-list-group-scroll.sw-scroll-more-bottom {
3143
+ .sw-list-group:not(.sw-list-group-tiles) > .sw-list-group-scroll.sw-scroll-more-bottom {
3138
3144
  background-image: linear-gradient(to top, color-mix(in srgb, var(--sw-color-text) 28%, transparent), transparent);
3139
3145
  background-position: bottom;
3140
3146
  }
3141
3147
 
3142
- .sw-list-group-scroll.sw-scroll-more-top.sw-scroll-more-bottom {
3148
+ .sw-list-group:not(.sw-list-group-tiles) > .sw-list-group-scroll.sw-scroll-more-top.sw-scroll-more-bottom {
3143
3149
  background-image: linear-gradient(to bottom, color-mix(in srgb, var(--sw-color-text) 28%, transparent), transparent), linear-gradient(to top, color-mix(in srgb, var(--sw-color-text) 28%, transparent), transparent);
3144
3150
  background-position: top, bottom;
3145
3151
  }
3146
3152
 
3147
3153
  @media (forced-colors: active) {
3148
- .sw-list-group-scroll.sw-scroll-more-top,
3149
- .sw-list-group-scroll.sw-scroll-more-bottom,
3150
- .sw-list-group-scroll.sw-scroll-more-top.sw-scroll-more-bottom { background-image: none; }
3154
+ .sw-list-group:not(.sw-list-group-tiles) > .sw-list-group-scroll.sw-scroll-more-top,
3155
+ .sw-list-group:not(.sw-list-group-tiles) > .sw-list-group-scroll.sw-scroll-more-bottom,
3156
+ .sw-list-group:not(.sw-list-group-tiles) > .sw-list-group-scroll.sw-scroll-more-top.sw-scroll-more-bottom { background-image: none; }
3151
3157
  }
3152
3158
 
3153
3159
  @media (forced-colors: active) {
@@ -3385,29 +3391,92 @@ button.sw-date-toggle-day[aria-disabled='true'] {
3385
3391
  white-space: nowrap;
3386
3392
  }
3387
3393
 
3388
- .sw-list-group-tiles > .sw-list {
3394
+ .sw-list-group-lg > .sw-list > .sw-list-item > .sw-list-row,
3395
+ .sw-list-group-lg > .sw-list-group-scroll > .sw-list > .sw-list-item > .sw-list-row,
3396
+ .sw-list-group-lg > .sw-list-group-footer > .sw-list-item > .sw-list-row {
3397
+ align-items: center;
3398
+ min-height: calc(var(--sw-space-8) + var(--sw-space-2));
3399
+ }
3400
+
3401
+ .sw-list-group-tiles > .sw-list,
3402
+ .sw-list-group-tiles > .sw-list-group-scroll > .sw-list {
3389
3403
  display: grid;
3390
3404
  gap: var(--sw-space-3);
3391
3405
  }
3392
3406
 
3393
- .sw-list-group-tiles-2 > .sw-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
3394
- .sw-list-group-tiles-3 > .sw-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
3395
- .sw-list-group-tiles-4 > .sw-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
3407
+ .sw-list-group-tiles-2 > .sw-list,
3408
+ .sw-list-group-tiles-2 > .sw-list-group-scroll > .sw-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
3409
+ .sw-list-group-tiles-3 > .sw-list,
3410
+ .sw-list-group-tiles-3 > .sw-list-group-scroll > .sw-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
3411
+ .sw-list-group-tiles-4 > .sw-list,
3412
+ .sw-list-group-tiles-4 > .sw-list-group-scroll > .sw-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
3396
3413
 
3397
- .sw-list-group-tiles > .sw-list > .sw-list-item {
3414
+ .sw-list-group-tiles > .sw-list > .sw-list-item,
3415
+ .sw-list-group-tiles > .sw-list-group-scroll > .sw-list > .sw-list-item {
3416
+ align-items: stretch;
3398
3417
  background: var(--sw-color-surface);
3399
3418
  border: 1px solid var(--sw-color-border);
3400
3419
  border-radius: var(--sw-radius-md);
3420
+ display: flex;
3401
3421
  min-width: 0;
3402
3422
  overflow: clip;
3403
3423
  }
3404
3424
 
3425
+ .sw-list-group-tiles > .sw-list > .sw-list-item > .sw-list-row,
3426
+ .sw-list-group-tiles > .sw-list-group-scroll > .sw-list > .sw-list-item > .sw-list-row {
3427
+ flex: 1 1 auto;
3428
+ min-width: 0;
3429
+ }
3430
+
3431
+ .sw-list-group-tiles > .sw-list > .sw-list-item > .sw-list-row-action,
3432
+ .sw-list-group-tiles > .sw-list-group-scroll > .sw-list > .sw-list-item > .sw-list-row-action { align-self: center; }
3433
+
3405
3434
  @media not all and (min-width: 48rem) {
3406
- .sw-list-group-tiles > .sw-list { grid-template-columns: minmax(0, 1fr); }
3435
+ .sw-list-group-tiles > .sw-list,
3436
+ .sw-list-group-tiles > .sw-list-group-scroll > .sw-list { grid-template-columns: minmax(0, 1fr); }
3407
3437
  }
3408
3438
 
3409
3439
  @media (forced-colors: active) {
3410
- .sw-list-group-tiles > .sw-list > .sw-list-item { border-color: CanvasText; }
3440
+ .sw-list-group-tiles > .sw-list > .sw-list-item,
3441
+ .sw-list-group-tiles > .sw-list-group-scroll > .sw-list > .sw-list-item { border-color: CanvasText; }
3442
+ }
3443
+
3444
+ .sw-list-group-tiles > .sw-list-group-scroll {
3445
+ max-height: calc(var(--sw-list-max-rows) * (2 * var(--sw-space-3) + 20px + 18px + 2px) + (var(--sw-list-max-rows) - 1) * var(--sw-space-3));
3446
+ scroll-padding-block: max(0px, min(var(--sw-space-5), calc((100% - (2 * var(--sw-space-3) + 20px + 18px + 2px)) / 2)));
3447
+ }
3448
+
3449
+ .sw-list-group-tiles > .sw-list-group-scroll::before,
3450
+ .sw-list-group-tiles > .sw-list-group-scroll::after {
3451
+ content: '';
3452
+ display: block;
3453
+ height: var(--sw-space-5);
3454
+ pointer-events: none;
3455
+ position: sticky;
3456
+ z-index: 1;
3457
+ }
3458
+
3459
+ .sw-list-group-tiles > .sw-list-group-scroll::before {
3460
+ margin-block-end: calc(-1 * var(--sw-space-5));
3461
+ top: 0;
3462
+ }
3463
+
3464
+ .sw-list-group-tiles > .sw-list-group-scroll::after {
3465
+ bottom: 0;
3466
+ margin-block-start: calc(-1 * var(--sw-space-5));
3467
+ }
3468
+
3469
+ .sw-list-group-tiles > .sw-list-group-scroll.sw-scroll-more-top::before { background-image: linear-gradient(to bottom, color-mix(in srgb, var(--sw-color-text) 28%, transparent), transparent); }
3470
+
3471
+ .sw-list-group-tiles > .sw-list-group-scroll.sw-scroll-more-bottom::after { background-image: linear-gradient(to top, color-mix(in srgb, var(--sw-color-text) 28%, transparent), transparent); }
3472
+
3473
+ @media (forced-colors: active) {
3474
+ .sw-list-group-tiles > .sw-list-group-scroll::before,
3475
+ .sw-list-group-tiles > .sw-list-group-scroll::after { display: none; }
3476
+ }
3477
+
3478
+ @media print {
3479
+ .sw-list-group-tiles > .sw-list-group-scroll { max-height: none; }
3411
3480
  }
3412
3481
 
3413
3482
  .sw-fixture-group {
@@ -7638,6 +7707,8 @@ html:has(.sw-site-header-sticky) .sw-docs-layout {
7638
7707
 
7639
7708
  .sw-action-menu {
7640
7709
  display: inline-flex;
7710
+ flex-shrink: 0;
7711
+ max-width: 100%;
7641
7712
  position: relative;
7642
7713
  }
7643
7714
 
@@ -7649,6 +7720,7 @@ html:has(.sw-site-header-sticky) .sw-docs-layout {
7649
7720
  color: var(--sw-color-text);
7650
7721
  cursor: pointer;
7651
7722
  font: inherit;
7723
+ max-width: 100%;
7652
7724
  min-height: var(--sw-control-xs-min-height);
7653
7725
  padding-inline: var(--sw-control-xs-padding-inline);
7654
7726
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalewing/react",
3
- "version": "1.71.0",
3
+ "version": "1.73.0",
4
4
  "description": "Scalewing DOM components and package-owned CSS utilities.",
5
5
  "type": "module",
6
6
  "license": "MIT",