@sonic-equipment/ui 204.0.0 → 205.0.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 (49) hide show
  1. package/dist/cards/table-card/table-card.d.ts +12 -0
  2. package/dist/cards/table-card/table-card.js +14 -0
  3. package/dist/cards/table-card/table-card.module.css.js +3 -0
  4. package/dist/exports.d.ts +7 -3
  5. package/dist/filters/pagination/pagination.js +1 -1
  6. package/dist/forms/fields/search-field/search-field.js +1 -1
  7. package/dist/forms/fields/text-field/text-field.d.ts +1 -0
  8. package/dist/forms/fields/text-field/text-field.js +2 -2
  9. package/dist/icons/solid/solid-edit-icon.js +8 -0
  10. package/dist/index.js +10 -6
  11. package/dist/intl/translation-id.d.ts +1 -1
  12. package/dist/pages/checkout/cart-page/cart-page.js +1 -1
  13. package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +1 -1
  14. package/dist/pages/checkout/payment-page/components/payment.js +2 -2
  15. package/dist/pages/checkout/shipping-page/hooks/use-patch-shipping-details.js +1 -1
  16. package/dist/pages/my-sonic/actions/create-ship-to-address/connected-create-ship-to-address-form.js +6 -6
  17. package/dist/pages/my-sonic/pages/order-history/order-history.js +4 -1
  18. package/dist/pages/my-sonic/widgets/connected-address-book-widget.d.ts +1 -0
  19. package/dist/pages/my-sonic/widgets/connected-address-book-widget.js +166 -0
  20. package/dist/pages/my-sonic/widgets/connected-address-book-widget.module.css.js +3 -0
  21. package/dist/shared/api/{storefront → bff}/hooks/cart/use-patch-cart.d.ts +2 -2
  22. package/dist/shared/api/{storefront → bff}/hooks/cart/use-patch-cart.js +1 -1
  23. package/dist/shared/api/{storefront → bff}/hooks/cart/use-place-order.d.ts +2 -2
  24. package/dist/shared/api/{storefront → bff}/hooks/cart/use-place-order.js +1 -1
  25. package/dist/shared/api/{storefront → bff}/hooks/cart/use-save-cart-for-later.d.ts +1 -1
  26. package/dist/shared/api/{storefront → bff}/hooks/cart/use-save-cart-for-later.js +1 -1
  27. package/dist/shared/api/bff/services/bff-service.d.ts +12 -0
  28. package/dist/shared/api/bff/services/bff-service.js +43 -1
  29. package/dist/shared/api/storefront/hooks/customer/use-fetch-paged-ship-to-addresses.d.ts +8 -0
  30. package/dist/shared/api/storefront/hooks/customer/use-fetch-paged-ship-to-addresses.js +13 -0
  31. package/dist/shared/api/storefront/hooks/orders/use-fetch-orders.d.ts +1 -2
  32. package/dist/shared/api/storefront/model/storefront.model.d.ts +8 -0
  33. package/dist/shared/api/storefront/services/cart-service.d.ts +1 -12
  34. package/dist/shared/api/storefront/services/cart-service.js +1 -43
  35. package/dist/shared/api/storefront/services/customer-service.d.ts +9 -1
  36. package/dist/shared/api/storefront/services/customer-service.js +19 -1
  37. package/dist/shared/api/storefront/services/order-service.d.ts +1 -5
  38. package/dist/shared/utils/children-to-text.d.ts +2 -0
  39. package/dist/shared/utils/children-to-text.js +18 -0
  40. package/dist/styles.css +259 -26
  41. package/dist/table/data-table.d.ts +3 -1
  42. package/dist/table/data-table.js +2 -2
  43. package/dist/table/elements/table.module.css.js +1 -1
  44. package/dist/table/elements/td.js +2 -2
  45. package/dist/table/elements/th.js +2 -2
  46. package/dist/table/elements/types.d.ts +1 -0
  47. package/dist/table/elements/use-td.js +1 -0
  48. package/dist/text/truncated/truncated.js +3 -1
  49. package/package.json +1 -1
package/dist/styles.css CHANGED
@@ -1896,6 +1896,10 @@ html {
1896
1896
  padding-inline: var(--space-24);
1897
1897
  }
1898
1898
 
1899
+ .pagination-module-k4OgY button[disabled], .pagination-module-oq89A button[disabled] {
1900
+ pointer-events: none;
1901
+ }
1902
+
1899
1903
  .pagination-module-k4OgY button svg, .pagination-module-oq89A button svg {
1900
1904
  width: 12px;
1901
1905
  height: 12px;
@@ -3467,6 +3471,141 @@ html {
3467
3471
  }
3468
3472
  }
3469
3473
 
3474
+ .table-card-module-8spto {
3475
+ --gap-row: var(--space-12);
3476
+ --gap-col: var(--space-12);
3477
+ --height-title: 22px;
3478
+ --shadow: rgb(0 0 0 / 12.5%);
3479
+ --sticky-z-index: 10;
3480
+ --sticky-top: var(--header-bottom, 0px);
3481
+ --sticky-title-top: calc(var(--sticky-top, 0px) + var(--gap-row));
3482
+ --sticky-actions-top: calc(
3483
+ var(--sticky-top, 0px) + var(--gap-row) * 2 + var(--height-title)
3484
+ );
3485
+
3486
+ display: grid;
3487
+ container-type: inline-size;
3488
+ gap: var(--gap-row) var(--gap-col);
3489
+ grid-template:
3490
+ [card-start bar-start] repeat(2, minmax(0, min-content))
3491
+ [bar-end] auto minmax(0, min-content)
3492
+ [card-end] /
3493
+ [card-start bar-start] 1fr [card-end bar-end];
3494
+ grid-template-areas:
3495
+ 'title'
3496
+ 'actions'
3497
+ 'data'
3498
+ 'paging';
3499
+ }
3500
+
3501
+ @container (min-width: 636px) {.table-card-module-8spto {
3502
+ --sticky-actions-top: calc(var(--sticky-top, 0px) + var(--gap-row));
3503
+
3504
+ grid-template:
3505
+ [card-start bar-start] minmax(0, min-content) [bar-end] auto minmax(
3506
+ 0,
3507
+ min-content
3508
+ )
3509
+ [card-end] /
3510
+ [card-start bar-start] 1fr minmax(0, max-content) [card-end bar-end];
3511
+ grid-template-areas:
3512
+ 'title actions'
3513
+ 'data data'
3514
+ 'paging paging'
3515
+ }
3516
+ }
3517
+
3518
+ .table-card-module-8spto .table-card-module-RCFdp {
3519
+ z-index: 2;
3520
+ display: grid;
3521
+ align-content: end;
3522
+ grid-area: title;
3523
+ }
3524
+
3525
+ .table-card-module-8spto .table-card-module-dFDCi {
3526
+ display: grid;
3527
+ grid-column: card;
3528
+ grid-row: card;
3529
+ grid-template-columns: subgrid;
3530
+ grid-template-rows: subgrid;
3531
+ }
3532
+
3533
+ .table-card-module-8spto .table-card-module-dFDCi .table-card-module-Gk7io {
3534
+ display: grid;
3535
+ padding: var(--space-16);
3536
+ color: var(--color-brand-red);
3537
+ grid-area: data;
3538
+ place-content: center;
3539
+ }
3540
+
3541
+ .table-card-module-8spto .table-card-module-dFDCi .table-card-module-lBFsJ {
3542
+ display: grid;
3543
+ padding: var(--space-16);
3544
+ grid-area: data;
3545
+ place-content: center;
3546
+ }
3547
+
3548
+ .table-card-module-8spto .table-card-module-dFDCi .table-card-module-5iT-f {
3549
+ display: grid;
3550
+ grid-area: data;
3551
+ }
3552
+
3553
+ .table-card-module-8spto .table-card-module-dFDCi .table-card-module-q5yPF {
3554
+ display: flex;
3555
+ flex-direction: row;
3556
+ align-items: center;
3557
+ align-self: end;
3558
+ justify-content: space-between;
3559
+ gap: var(--space-8);
3560
+ grid-area: actions;
3561
+ }
3562
+
3563
+ .table-card-module-8spto .table-card-module-dFDCi .table-card-module-cZW-k {
3564
+ grid-area: paging;
3565
+ }
3566
+
3567
+ .table-card-module-8spto.table-card-module-aPwB9 .table-card-module-RCFdp {
3568
+ position: sticky;
3569
+ z-index: var(--sticky-z-index);
3570
+ inset-block-start: var(--sticky-title-top);
3571
+ }
3572
+
3573
+ .table-card-module-8spto.table-card-module-aPwB9 .table-card-module-q5yPF {
3574
+ position: sticky;
3575
+ z-index: var(--sticky-z-index);
3576
+ inset-block-start: var(--sticky-actions-top);
3577
+ }
3578
+
3579
+ /* white bar behind sticky elements */
3580
+
3581
+ .table-card-module-8spto.table-card-module-aPwB9 .table-card-module-4Vwgi {
3582
+ position: sticky;
3583
+ z-index: calc(var(--sticky-z-index) - 1);
3584
+ background-color: var(--color-white);
3585
+ /* stylelint-disable-next-line declaration-property-value-no-unknown */
3586
+ container-type: scroll-state;
3587
+ grid-area: bar;
3588
+ inset-block: var(--sticky-top, 0);
3589
+ margin-block: calc(var(--gap-row) * -1);
3590
+ }
3591
+
3592
+ .table-card-module-8spto.table-card-module-aPwB9 .table-card-module-4Vwgi::after {
3593
+ position: absolute;
3594
+ background: linear-gradient(180deg, var(--shadow) 0%, transparent 100%);
3595
+ block-size: var(--space-8);
3596
+ content: '';
3597
+ inset: 100% 0 auto;
3598
+ opacity: 0;
3599
+ transition: opacity var(--transition-duration-short);
3600
+ }
3601
+
3602
+ @container scroll-state(stuck: block-start) {
3603
+
3604
+ .table-card-module-8spto.table-card-module-aPwB9 .table-card-module-4Vwgi::after {
3605
+ opacity: 1
3606
+ }
3607
+ }
3608
+
3470
3609
  @keyframes product-overview-grid-module-r-wvY {
3471
3610
  99.999% {
3472
3611
  opacity: 0;
@@ -6784,11 +6923,12 @@ button.swiper-pagination-bullet {
6784
6923
  display: grid;
6785
6924
  container-type: inline-size;
6786
6925
  gap: 24px 18px;
6787
- grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
6926
+ grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
6788
6927
  }
6789
6928
 
6790
6929
  .widget-grid-module-GdtqD .widget-grid-module-y2wM2 {
6791
6930
  display: grid;
6931
+ container-type: inline-size;
6792
6932
  }
6793
6933
 
6794
6934
  .widget-grid-module-GdtqD .widget-grid-module-y2wM2.widget-grid-module-Pladu {
@@ -6805,7 +6945,7 @@ button.swiper-pagination-bullet {
6805
6945
 
6806
6946
  .dynamic-loading-overlay-module-CAecM {
6807
6947
  --content-opacity: 0.35;
6808
- --indicator-min-size: 176px;
6948
+ --indicator-min-size: 90px;
6809
6949
  --intersected-height: 0px;
6810
6950
  --transition-duration: var(--transition-duration-short);
6811
6951
  --transition-delay: var(--transition-duration-short);
@@ -6827,7 +6967,6 @@ button.swiper-pagination-bullet {
6827
6967
  position: sticky;
6828
6968
  z-index: 2;
6829
6969
  box-sizing: border-box;
6830
- block-size: var(--intersected-height);
6831
6970
  grid-column: 1;
6832
6971
  grid-row: 1;
6833
6972
  inset: 0;
@@ -6853,6 +6992,7 @@ button.swiper-pagination-bullet {
6853
6992
  }
6854
6993
 
6855
6994
  .dynamic-loading-overlay-module-CAecM.dynamic-loading-overlay-module-3bed- .dynamic-loading-overlay-module-lhL5i {
6995
+ block-size: var(--intersected-height);
6856
6996
  opacity: 1;
6857
6997
  transition-delay: var(--transition-delay);
6858
6998
  visibility: visible;
@@ -8028,15 +8168,11 @@ button.swiper-pagination-bullet {
8028
8168
  }
8029
8169
 
8030
8170
  .table-module-pevNG {
8031
- position: relative;
8032
- box-sizing: border-box;
8033
- container-name: table-container;
8034
- container-type: inline-size;
8035
- overflow-x: auto;
8036
- }
8171
+ @property --columns {
8172
+ initial-value: 1;
8173
+ syntax: '<integer>';
8174
+ }
8037
8175
 
8038
- .table-module-k47fT {
8039
- --columns: 1;
8040
8176
  --border-color: var(--color-gray-200);
8041
8177
  --bgcolor-odd: var(--color-white);
8042
8178
  --bgcolor-even: var(--color-gray-50);
@@ -8045,22 +8181,75 @@ button.swiper-pagination-bullet {
8045
8181
  --bgcolor-col-highlight: rgb(0 0 0 / 2.5%);
8046
8182
  --bgcolor-row-highlight: rgb(0 0 0 / 2.5%);
8047
8183
  --cell-padding: var(--space-12);
8048
- --grid-columns-default: repeat(var(--columns), minmax(min-content, auto));
8184
+ --cell-padding-narrow: var(--space-8);
8049
8185
  --shadow: rgb(0 0 0 / 12.5%);
8050
8186
  --z-column: 10;
8051
8187
  --z-sticky: 11;
8052
8188
  --z-selected: 12;
8189
+ --ghost-gradient-z-index: 10;
8190
+ --ghost-gradient-size: 32px;
8053
8191
 
8054
- @property --columns {
8055
- initial-value: 1;
8056
- syntax: '<integer>';
8192
+ position: relative;
8193
+ display: grid;
8194
+ box-sizing: border-box;
8195
+ /* stylelint-disable-next-line declaration-property-value-no-unknown */
8196
+ container-type: inline-size scroll-state;
8197
+ overflow-x: auto;
8198
+ }
8199
+
8200
+ /* scrolling overflow ghost gradients */
8201
+ .table-module-pevNG::before,
8202
+ .table-module-pevNG::after {
8203
+ position: sticky;
8204
+ z-index: var(--ghost-gradient-z-index);
8205
+ content: '';
8206
+ grid-column: 1;
8207
+ grid-row: 1;
8208
+ inset: 0;
8209
+ opacity: 0;
8210
+ pointer-events: none;
8211
+ transition: opacity var(--transition-duration-short);
8057
8212
  }
8213
+ /* ghost gradient start */
8214
+ .table-module-pevNG::before {
8215
+ background: linear-gradient(
8216
+ 90deg,
8217
+ #fff 0%,
8218
+ transparent var(--ghost-gradient-size)
8219
+ );
8220
+ }
8221
+ @container scroll-state(scrollable: inline-start) {
8222
+ .table-module-pevNG::before {
8223
+ opacity: 1
8224
+ }
8225
+ }
8226
+ /* ghost gradient end */
8227
+ .table-module-pevNG::after {
8228
+ background: linear-gradient(
8229
+ 90deg,
8230
+ transparent calc(100% - var(--ghost-gradient-size)),
8231
+ #fff 100%
8232
+ );
8233
+ }
8234
+ @container scroll-state(scrollable: inline-end) {
8235
+ .table-module-pevNG::after {
8236
+ opacity: 1
8237
+ }
8238
+ }
8239
+
8240
+ /* table */
8241
+
8242
+ .table-module-k47fT {
8243
+ --columns: 1;
8244
+ --grid-columns-default: repeat(var(--columns), minmax(min-content, auto));
8058
8245
 
8059
8246
  position: relative;
8060
8247
  display: grid;
8061
8248
  box-sizing: border-box;
8062
8249
  padding: 0;
8063
8250
  background: var(--color-white);
8251
+ grid-column: 1;
8252
+ grid-row: 1;
8064
8253
  grid-template-columns: var(--grid-columns, var(--grid-columns-default));
8065
8254
  grid-template-rows:
8066
8255
  [clmns-start thead-start]
@@ -8101,6 +8290,8 @@ button.swiper-pagination-bullet {
8101
8290
  /* stylelint-disable-next-line declaration-property-value-no-unknown */
8102
8291
  container-type: scroll-state;
8103
8292
  inset-inline: 0;
8293
+
8294
+ /* drop shadows on the sides */
8104
8295
  }
8105
8296
 
8106
8297
  .table-module-k47fT .table-module-dISOo.table-module-PQejy::before,
@@ -8137,6 +8328,11 @@ button.swiper-pagination-bullet {
8137
8328
  }
8138
8329
  }
8139
8330
 
8331
+ .table-module-k47fT .table-module-dISOo.table-module-PQejy:first-child::before,
8332
+ .table-module-k47fT .table-module-dISOo.table-module-PQejy:last-child::after {
8333
+ content: none;
8334
+ }
8335
+
8140
8336
  /* cells */
8141
8337
 
8142
8338
  .table-module-k47fT .table-module-jRXnY,
@@ -8158,6 +8354,10 @@ button.swiper-pagination-bullet {
8158
8354
  inset-inline: 0;
8159
8355
  }
8160
8356
 
8357
+ .table-module-k47fT .table-module-jRXnY.table-module-QHBAG, .table-module-k47fT .table-module-wJwSq.table-module-QHBAG {
8358
+ padding: var(--cell-padding) var(--cell-padding-narrow);
8359
+ }
8360
+
8161
8361
  .table-module-k47fT thead th {
8162
8362
  position: relative;
8163
8363
  }
@@ -8185,7 +8385,6 @@ button.swiper-pagination-bullet {
8185
8385
 
8186
8386
  .table-module-k47fT .table-module-Nisf1 {
8187
8387
  display: grid;
8188
- border-block-end: 1px solid var(--border-color);
8189
8388
  grid-column: 1 / -1;
8190
8389
  grid-template-columns: subgrid;
8191
8390
  grid-template-rows: subgrid;
@@ -8194,6 +8393,7 @@ button.swiper-pagination-bullet {
8194
8393
  .table-module-k47fT .table-module-Nisf1 .table-module-jRXnY,
8195
8394
  .table-module-k47fT .table-module-Nisf1 .table-module-wJwSq {
8196
8395
  background-color: var(--bgcolor-odd);
8396
+ border-block-end: 1px solid var(--border-color);
8197
8397
  }
8198
8398
 
8199
8399
  .table-module-k47fT .table-module-Nisf1:nth-child(even) .table-module-jRXnY,
@@ -8350,7 +8550,7 @@ button.swiper-pagination-bullet {
8350
8550
 
8351
8551
  .truncated-module-bwo1A {
8352
8552
  display: -webkit-box;
8353
- text-wrap: auto;
8553
+ text-wrap: pretty;
8354
8554
  }
8355
8555
 
8356
8556
  .truncated-module-bwo1A.truncated-module-JHMUL {
@@ -8377,16 +8577,15 @@ button.swiper-pagination-bullet {
8377
8577
  .order-history-module-LrkiZ {
8378
8578
  --gap-col: var(--space-8);
8379
8579
  --gap-row: var(--space-8);
8380
- --z-index-sticky: 10;
8381
- --sticky-top: var(--header-bottom, 0);
8580
+ --sticky-z-index: 10;
8581
+ --sticky-top: var(--header-bottom, 0px);
8382
8582
  --shadow: rgb(0 0 0 / 12.5%);
8383
8583
 
8384
8584
  display: grid;
8385
8585
  gap: var(--gap-row) var(--gap-col);
8386
- grid-template: [bar-start] auto [bar-end] repeat(
8387
- 3,
8388
- auto
8389
- ) / [bar-start] 1fr [bar-end];
8586
+ grid-template:
8587
+ [bar-start] auto [bar-end] repeat(3, auto)
8588
+ / [bar-start] 1fr [bar-end];
8390
8589
  grid-template-areas:
8391
8590
  'search'
8392
8591
  'filter'
@@ -8424,7 +8623,7 @@ button.swiper-pagination-bullet {
8424
8623
 
8425
8624
  .order-history-module-LrkiZ .order-history-module-Y18m7 {
8426
8625
  position: sticky;
8427
- z-index: var(--z-index-sticky);
8626
+ z-index: var(--sticky-z-index);
8428
8627
  grid-area: search;
8429
8628
  inset-block-start: calc(var(--sticky-top, 0) + var(--gap-row));
8430
8629
  }
@@ -8439,7 +8638,7 @@ button.swiper-pagination-bullet {
8439
8638
 
8440
8639
  .order-history-module-LrkiZ .order-history-module-tBrZG {
8441
8640
  position: sticky;
8442
- z-index: var(--z-index-sticky);
8641
+ z-index: var(--sticky-z-index);
8443
8642
  inset-block-start: calc(var(--sticky-top) + var(--gap-row))
8444
8643
  }
8445
8644
  }
@@ -8466,7 +8665,7 @@ button.swiper-pagination-bullet {
8466
8665
 
8467
8666
  .order-history-module-LrkiZ .order-history-module-98Tvf {
8468
8667
  position: sticky;
8469
- z-index: calc(var(--z-index-sticky) - 1);
8668
+ z-index: calc(var(--sticky-z-index) - 1);
8470
8669
  margin: calc(var(--gap-row) * -1)
8471
8670
  calc(var(--page-container-padding-inline) * -1);
8472
8671
  background-color: var(--color-white);
@@ -8500,6 +8699,40 @@ button.swiper-pagination-bullet {
8500
8699
  }
8501
8700
  }
8502
8701
 
8702
+ .connected-address-book-widget-module-Xd9WN {
8703
+ --height-actions: 42px;
8704
+ --height-title: 22px;
8705
+ }
8706
+
8707
+ .connected-address-book-widget-module-Xd9WN .connected-address-book-widget-module-9mOgI {
8708
+ --scroll-margin-block-start: calc(
8709
+ var(--header-bottom, 0px) + var(--space-12) * 3 + var(--height-actions) +
8710
+ var(--height-title)
8711
+ );
8712
+
8713
+ scroll-margin-block-start: var(--scroll-margin-block-start, 0);
8714
+ }
8715
+
8716
+ @container (min-width: 636px) {
8717
+
8718
+ .connected-address-book-widget-module-Xd9WN .connected-address-book-widget-module-9mOgI {
8719
+ --scroll-margin-block-start: calc(
8720
+ var(--header-bottom, 0px) + var(--space-12) * 2 + var(--height-actions)
8721
+ )
8722
+ }
8723
+ }
8724
+
8725
+ .connected-address-book-widget-module-Xd9WN .connected-address-book-widget-module-g9kHi {
8726
+ block-size: 1em;
8727
+ inline-size: 1em;
8728
+ margin-inline-end: -8px;
8729
+ vertical-align: -0.2em;
8730
+ }
8731
+
8732
+ .connected-address-book-widget-module-Xd9WN .connected-address-book-widget-module-3ir-C {
8733
+ flex-grow: 1;
8734
+ }
8735
+
8503
8736
  .product-details-page-layout-module-pPtZX {
8504
8737
  display: flex;
8505
8738
  flex-direction: column;
@@ -4,6 +4,7 @@ import { SortDirection, SortHanlder, SortOptions, TableColumnProperties } from '
4
4
  export interface Column<T extends object> {
5
5
  header: {
6
6
  isHidden?: boolean;
7
+ isNarrow?: boolean;
7
8
  label: TranslationId;
8
9
  render?: (column: Column<T>, data: T[]) => React.ReactNode;
9
10
  } | {
@@ -24,12 +25,13 @@ export interface Column<T extends object> {
24
25
  };
25
26
  }
26
27
  export interface Action<T extends object> {
28
+ href?: (item: T) => string;
27
29
  icon?: ReactNode;
28
30
  isEnabled?: (item: T) => boolean;
29
31
  isPrimary?: boolean;
30
32
  key: string;
31
33
  label: TranslationId;
32
- onAction: (item: T) => void;
34
+ onAction?: (item: T) => void;
33
35
  }
34
36
  export interface DataTableProps<T extends object> {
35
37
  actions?: Action<T>[];
@@ -79,11 +79,11 @@ function DataTable({ actions, columns: _columns, data, onSort: _onSort, }) {
79
79
  : undefined;
80
80
  if (actionKey && !action)
81
81
  throw new Error(`Action "${actionKey}" not found`);
82
- return 'render' in column.value ? (jsx(TD, { children: column.value.render(item, column, data) }, column.key)) : 'propertyName' in column.value ? (jsx(TD, { children: String(item[column.value.propertyName]) }, column.key)) : 'action' in column.value ? (jsx(TD, { children: action && (jsx(Link, { hasUnderline: true, color: "secondary", isDisabled: action.isEnabled ? !action.isEnabled(item) : false, onClick: () => action.onAction(item), children: t(action.label) })) }, column.key)) : null;
82
+ return 'render' in column.value ? (jsx(TD, { children: column.value.render(item, column, data) }, column.key)) : 'propertyName' in column.value ? (jsx(TD, { children: String(item[column.value.propertyName]) }, column.key)) : 'action' in column.value ? (jsx(TD, { children: action && (jsx(Link, { hasUnderline: true, color: "secondary", href: action.href?.(item), isDisabled: action.isEnabled ? !action.isEnabled(item) : false, onClick: () => action.onAction?.(item), children: t(action.label) })) }, column.key)) : null;
83
83
  }) }, index))) }) }));
84
84
  return (jsx("div", { className: styles['data-card-list'], children: data.map((item, index) => (jsx(DataCard
85
85
  // eslint-disable-next-line @eslint-react/no-array-index-key
86
- , { actions: actions?.map(action => (jsx(Button, { color: action.isPrimary ? 'primary' : 'secondary', isDisabled: action.isEnabled ? !action.isEnabled(item) : false, onClick: () => action.onAction(item), size: "sm", variant: action.isPrimary ? undefined : 'outline', children: t(action.label) }, action.key))), data: columns
86
+ , { actions: actions?.map(action => (jsx(Button, { color: action.isPrimary ? 'primary' : 'secondary', href: action.href?.(item), isDisabled: action.isEnabled ? !action.isEnabled(item) : false, onClick: () => action.onAction?.(item), size: "sm", variant: action.isPrimary ? undefined : 'outline', children: t(action.label) }, action.key))), data: columns
87
87
  .map(column => 'render' in column.value
88
88
  ? {
89
89
  key: column.key,
@@ -1,3 +1,3 @@
1
- var styles = {"table-container":"table-module-pevNG","table":"table-module-k47fT","colgroup":"table-module-1lgqE","col":"table-module-dISOo","selected":"table-module-WGz-I","sticky":"table-module-PQejy","th":"table-module-jRXnY","td":"table-module-wJwSq","nowrap":"table-module-h7qdo","start":"table-module-EWdty","end":"table-module-yJD74","center":"table-module-XAdfy","tr":"table-module-Nisf1","hl-row":"table-module-3zZB6","clickable":"table-module-qRfjM","thead":"table-module-DK-wn","tbody":"table-module-tygZb","stretch":"table-module-YnmWV","caption":"table-module-skhNZ","hl-col":"table-module-JEp5f","sortable":"table-module-hyPmy","table-sort-button":"table-module-RtOV-","label":"table-module-ukG8s","icon":"table-module-QdiLJ","active":"table-module-gWy-a","asc":"table-module-9AwNp","desc":"table-module-aYS8r"};
1
+ var styles = {"table-container":"table-module-pevNG","table":"table-module-k47fT","colgroup":"table-module-1lgqE","col":"table-module-dISOo","selected":"table-module-WGz-I","sticky":"table-module-PQejy","th":"table-module-jRXnY","td":"table-module-wJwSq","nowrap":"table-module-h7qdo","narrow":"table-module-QHBAG","start":"table-module-EWdty","end":"table-module-yJD74","center":"table-module-XAdfy","tr":"table-module-Nisf1","hl-row":"table-module-3zZB6","clickable":"table-module-qRfjM","thead":"table-module-DK-wn","tbody":"table-module-tygZb","stretch":"table-module-YnmWV","caption":"table-module-skhNZ","hl-col":"table-module-JEp5f","sortable":"table-module-hyPmy","table-sort-button":"table-module-RtOV-","label":"table-module-ukG8s","icon":"table-module-QdiLJ","active":"table-module-gWy-a","asc":"table-module-9AwNp","desc":"table-module-aYS8r"};
2
2
 
3
3
  export { styles as default };
@@ -6,8 +6,8 @@ import { useTD } from './use-td.js';
6
6
  import styles from './table.module.css.js';
7
7
 
8
8
  function TD(props) {
9
- const { align = 'start', children, className, colSpan, nowrap, rowSpan, sticky, truncated, } = useTD(props);
10
- return (jsx("td", { className: clsx(styles['td'], styles[align], nowrap && styles['nowrap'], sticky && styles['sticky'], className), colSpan: colSpan, rowSpan: rowSpan, children: truncated ? (jsx(Truncated, { lines: typeof truncated === 'number' ? truncated : undefined, children: children })) : (children) }));
9
+ const { align = 'start', children, className, colSpan, isNarrow, nowrap, rowSpan, sticky, truncated, } = useTD(props);
10
+ return (jsx("td", { className: clsx(styles['td'], styles[align], nowrap && styles['nowrap'], sticky && styles['sticky'], isNarrow && styles['narrow'], className), colSpan: colSpan, rowSpan: rowSpan, children: truncated ? (jsx(Truncated, { lines: typeof truncated === 'number' ? truncated : undefined, children: children })) : (children) }));
11
11
  }
12
12
 
13
13
  export { TD };
@@ -5,8 +5,8 @@ import { useTH } from './use-th.js';
5
5
  import styles from './table.module.css.js';
6
6
 
7
7
  function TH(props) {
8
- const { align = 'start', 'aria-sort': ariaSort, children, className, colSpan, nowrap, rowSpan, scope, sortable, sticky, } = useTH(props);
9
- return (jsx("th", { "aria-sort": ariaSort, className: clsx(styles['th'], styles[align], nowrap && styles['nowrap'], sticky && styles['sticky'], sortable && styles['sortable'], className), colSpan: colSpan, rowSpan: rowSpan, scope: scope, children: children }));
8
+ const { align = 'start', 'aria-sort': ariaSort, children, className, colSpan, isNarrow, nowrap, rowSpan, scope, sortable, sticky, } = useTH(props);
9
+ return (jsx("th", { "aria-sort": ariaSort, className: clsx(styles['th'], styles[align], nowrap && styles['nowrap'], sticky && styles['sticky'], sortable && styles['sortable'], isNarrow && styles['narrow'], className), colSpan: colSpan, rowSpan: rowSpan, scope: scope, children: children }));
10
10
  }
11
11
 
12
12
  export { TH };
@@ -15,6 +15,7 @@ export interface TableColumnProperties {
15
15
  align?: TableColumnAlignment;
16
16
  colSpan?: number;
17
17
  cssColumn?: string;
18
+ isNarrow?: boolean;
18
19
  nowrap?: boolean;
19
20
  rowSpan?: number;
20
21
  selected?: boolean;
@@ -16,6 +16,7 @@ function useTD(props) {
16
16
  ...props,
17
17
  align: columnProps?.align ?? props.align ?? 'start',
18
18
  colSpan: columnProps?.colSpan ?? props.colSpan ?? 1,
19
+ isNarrow: columnProps?.isNarrow ?? props.isNarrow ?? false,
19
20
  nowrap: columnProps?.nowrap ?? props.nowrap ?? false,
20
21
  rowSpan: columnProps?.rowSpan ?? props.rowSpan ?? 1,
21
22
  selected: columnProps?.selected ?? props.selected ?? false,
@@ -1,10 +1,12 @@
1
1
  "use client";
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import clsx from 'clsx';
4
+ import { childrenToText } from '../../shared/utils/children-to-text.js';
4
5
  import styles from './truncated.module.css.js';
5
6
 
6
7
  function Truncated({ active = true, children, lines = 1, }) {
7
- return (jsx("div", { className: clsx(styles['truncated'], active && styles['active']), style: { '--lines': lines }, title: children?.toString(), children: children }));
8
+ const title = childrenToText(children);
9
+ return (jsx("div", { className: clsx(styles['truncated'], active && styles['active']), style: { '--lines': lines }, title: title, children: children }));
8
10
  }
9
11
 
10
12
  export { Truncated };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "204.0.0",
3
+ "version": "205.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {