@sonic-equipment/ui 181.0.0 → 182.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 (53) hide show
  1. package/dist/cards/data-card/data-card.d.ts +30 -18
  2. package/dist/cards/data-card/data-card.js +38 -6
  3. package/dist/cards/data-card/data-card.module.css.js +1 -1
  4. package/dist/config.d.ts +1 -0
  5. package/dist/config.js +7 -0
  6. package/dist/exports.d.ts +18 -0
  7. package/dist/header/connected-header.js +1 -1
  8. package/dist/header/header.d.ts +3 -1
  9. package/dist/header/header.js +3 -2
  10. package/dist/icons/glyph/glyphs-chevrons-bold-up-icon.js +7 -0
  11. package/dist/index.js +17 -0
  12. package/dist/intl/translation-id.d.ts +1 -1
  13. package/dist/pages/my-sonic/widgets/components/address-data-card.d.ts +4 -4
  14. package/dist/styles.css +416 -41
  15. package/dist/table/data-table.d.ts +19 -0
  16. package/dist/table/data-table.js +47 -0
  17. package/dist/table/data-table.module.css.js +3 -0
  18. package/dist/table/elements/col.d.ts +7 -0
  19. package/dist/table/elements/col.js +9 -0
  20. package/dist/table/elements/table-column-properties.d.ts +10 -0
  21. package/dist/table/elements/table-context.d.ts +18 -0
  22. package/dist/table/elements/table-context.js +20 -0
  23. package/dist/table/elements/table-provider.d.ts +22 -0
  24. package/dist/table/elements/table-provider.js +59 -0
  25. package/dist/table/elements/table-row-context.d.ts +14 -0
  26. package/dist/table/elements/table-row-context.js +16 -0
  27. package/dist/table/elements/table-row-provider.d.ts +4 -0
  28. package/dist/table/elements/table-row-provider.js +25 -0
  29. package/dist/table/elements/table-sort-button.d.ts +11 -0
  30. package/dist/table/elements/table-sort-button.js +17 -0
  31. package/dist/table/elements/table.d.ts +14 -0
  32. package/dist/table/elements/table.js +23 -0
  33. package/dist/table/elements/table.module.css.js +3 -0
  34. package/dist/table/elements/td.d.ts +6 -0
  35. package/dist/table/elements/td.js +12 -0
  36. package/dist/table/elements/th.d.ts +8 -0
  37. package/dist/table/elements/th.js +12 -0
  38. package/dist/table/elements/tr.d.ts +8 -0
  39. package/dist/table/elements/tr.js +12 -0
  40. package/dist/table/elements/use-table-row.d.ts +1 -0
  41. package/dist/table/elements/use-table-row.js +8 -0
  42. package/dist/table/elements/use-table.d.ts +2 -0
  43. package/dist/table/elements/use-table.js +13 -0
  44. package/dist/table/elements/use-td.d.ts +2 -0
  45. package/dist/table/elements/use-td.js +26 -0
  46. package/dist/table/elements/use-th.d.ts +2 -0
  47. package/dist/table/elements/use-th.js +22 -0
  48. package/dist/table/elements/use-tr.d.ts +2 -0
  49. package/dist/table/elements/use-tr.js +16 -0
  50. package/dist/text/truncated/truncated.d.ts +6 -0
  51. package/dist/text/truncated/truncated.js +9 -0
  52. package/dist/text/truncated/truncated.module.css.js +3 -0
  53. package/package.json +1 -1
package/dist/styles.css CHANGED
@@ -2671,19 +2671,28 @@ html {
2671
2671
  --color: var(--color-brand-red);
2672
2672
  }
2673
2673
 
2674
+ .data-card-module-OMXIh {
2675
+ container-type: inline-size;
2676
+ }
2677
+
2674
2678
  .data-card-module-DMbBO {
2675
2679
  margin-bottom: var(--space-12);
2676
2680
  }
2677
2681
 
2678
2682
  .data-card-module-24uin {
2679
2683
  position: relative;
2680
- width: 100%;
2681
- min-height: 150px;
2682
2684
  border: 1px solid var(--color-brand-medium-gray);
2683
2685
  border-radius: var(--border-radius-32);
2684
- container-type: inline-size;
2686
+ inline-size: 100%;
2687
+ min-block-size: 150px;
2688
+ min-inline-size: 250px;
2685
2689
  }
2686
2690
 
2691
+ .data-card-module-24uin,
2692
+ .data-card-module-24uin * {
2693
+ box-sizing: border-box;
2694
+ }
2695
+
2687
2696
  .data-card-module-24uin .data-card-module-j-RFT {
2688
2697
  position: absolute;
2689
2698
  display: grid;
@@ -2702,6 +2711,7 @@ html {
2702
2711
  .data-card-module-24uin .data-card-module-FVD44 {
2703
2712
  position: absolute;
2704
2713
  display: grid;
2714
+ padding: 0;
2705
2715
  inset: 0;
2706
2716
  place-content: center;
2707
2717
  }
@@ -2710,7 +2720,7 @@ html {
2710
2720
  padding: var(--space-32) var(--space-16) var(--space-16) var(--space-32);
2711
2721
  }
2712
2722
 
2713
- @container (max-width: 414px) {
2723
+ @container (max-width: 314px) {
2714
2724
 
2715
2725
  .data-card-module-24uin .data-card-module-ZefqY {
2716
2726
  padding: var(--space-20) var(--space-16) var(--space-16)
@@ -2721,59 +2731,81 @@ html {
2721
2731
  visibility: hidden;
2722
2732
  }
2723
2733
 
2724
- .data-card-module-24uin .data-card-module-ZefqY .data-card-module-EDbE- {
2725
- display: grid;
2726
- margin: 0;
2727
- gap: var(--space-16);
2728
- grid-template-areas: 'key value';
2729
- grid-template-columns:
2730
- minmax(min-content, max-content)
2731
- minmax(min-content, 1fr);
2732
- line-height: 1;
2734
+ .data-card-module-24uin .data-card-module-EDbE- {
2735
+ display: grid;
2736
+ margin: 0;
2737
+ gap: var(--space-16);
2738
+ grid-template-columns:
2739
+ minmax(min-content, max-content)
2740
+ minmax(min-content, 1fr);
2741
+ line-height: 1;
2742
+ }
2743
+
2744
+ @container (max-width: 314px) {
2745
+
2746
+ .data-card-module-24uin .data-card-module-EDbE- {
2747
+ gap: 0;
2748
+ grid-template-areas: unset;
2749
+ grid-template-columns: 1fr;
2750
+ line-height: 1.5
2751
+ }
2733
2752
  }
2734
2753
 
2735
- @container (max-width: 414px) {
2754
+ .data-card-module-24uin .data-card-module-EDbE- .data-card-module-CjTal {
2755
+ display: block;
2756
+ grid-column: span 2;
2757
+ text-align: center;
2758
+ }
2736
2759
 
2737
- .data-card-module-24uin .data-card-module-ZefqY .data-card-module-EDbE- {
2738
- grid-template-areas: unset;
2739
- grid-template-columns: 1fr
2760
+ .data-card-module-24uin .data-card-module-EDbE- .data-card-module-QixKJ:not(:last-child) {
2761
+ margin-bottom: var(--space-8);
2740
2762
  }
2741
- }
2742
2763
 
2743
- .data-card-module-24uin .data-card-module-ZefqY .data-card-module-EDbE- .data-card-module-FAgmN {
2744
- margin: 0;
2745
- font-weight: var(--font-weight-bold);
2746
- grid-template-areas: 'key';
2747
- text-align: right;
2748
- }
2764
+ .data-card-module-24uin .data-card-module-EDbE- .data-card-module-FAgmN {
2765
+ margin: 0;
2766
+ font-weight: var(--font-weight-bold);
2767
+ text-align: right;
2768
+ }
2749
2769
 
2750
- @container (max-width: 414px) {
2770
+ @container (max-width: 314px) {
2751
2771
 
2752
- .data-card-module-24uin .data-card-module-ZefqY .data-card-module-EDbE- .data-card-module-FAgmN {
2753
- text-align: left
2772
+ .data-card-module-24uin .data-card-module-EDbE- .data-card-module-FAgmN {
2773
+ text-align: left
2774
+ }
2754
2775
  }
2755
- }
2756
2776
 
2757
- .data-card-module-24uin .data-card-module-ZefqY .data-card-module-EDbE- .data-card-module-fcSbu {
2758
- margin: 0;
2759
- font-weight: var(--font-weight-normal);
2760
- grid-template-areas: 'value';
2761
- }
2777
+ .data-card-module-24uin .data-card-module-EDbE- .data-card-module-fcSbu {
2778
+ margin: 0;
2779
+ font-weight: var(--font-weight-normal);
2762
2780
 
2763
- .data-card-module-24uin .data-card-module-ZefqY .data-card-module-Qv5iI {
2764
- display: flex;
2765
- justify-content: flex-end;
2766
- margin-top: var(--space-16);
2767
- gap: var(--space-8);
2781
+ /* grid-area: value; */
2768
2782
  }
2769
2783
 
2770
- @container (max-width: 414px) {
2784
+ @container (max-width: 314px) {
2771
2785
 
2772
- .data-card-module-24uin .data-card-module-ZefqY .data-card-module-Qv5iI {
2773
- flex-direction: column
2786
+ .data-card-module-24uin .data-card-module-EDbE- .data-card-module-fcSbu {
2787
+ margin-bottom: var(--space-8)
2774
2788
  }
2789
+
2790
+ .data-card-module-24uin .data-card-module-EDbE- .data-card-module-fcSbu:last-child {
2791
+ margin-bottom: 0;
2792
+ }
2775
2793
  }
2776
2794
 
2795
+ .data-card-module-24uin .data-card-module-Qv5iI {
2796
+ display: flex;
2797
+ justify-content: flex-end;
2798
+ margin-top: var(--space-16);
2799
+ gap: var(--space-8);
2800
+ }
2801
+
2802
+ @container (max-width: 314px) {
2803
+
2804
+ .data-card-module-24uin .data-card-module-Qv5iI {
2805
+ flex-direction: column
2806
+ }
2807
+ }
2808
+
2777
2809
  .confirmation-dialog-module-Up-BC {
2778
2810
  max-width: 425px;
2779
2811
  }
@@ -7999,6 +8031,349 @@ button.swiper-pagination-bullet {
7999
8031
  --transition-duration: 0.3s;
8000
8032
  }
8001
8033
 
8034
+ .table-module-pevNG {
8035
+ box-sizing: border-box;
8036
+ container-name: table-container;
8037
+ container-type: inline-size;
8038
+ overflow-x: auto;
8039
+ }
8040
+
8041
+ .table-module-k47fT {
8042
+ --columns: 1;
8043
+ --border-color: var(--color-gray-200);
8044
+ --bgcolor-odd: var(--color-white);
8045
+ --bgcolor-even: var(--color-gray-50);
8046
+ --bgcolor-col-selected: rgb(0 0 0 / 5%);
8047
+ --bgcolor-row-selected: rgb(0 0 0 / 10%);
8048
+ --bgcolor-col-highlight: rgb(0 0 0 / 2.5%);
8049
+ --bgcolor-row-highlight: rgb(0 0 0 / 2.5%);
8050
+ --cell-padding: var(--space-12);
8051
+ --grid-columns-default: repeat(var(--columns), minmax(min-content, auto));
8052
+ --shadow: rgb(0 0 0 / 12.5%);
8053
+ --z-column: 10;
8054
+ --z-sticky: 11;
8055
+ --z-selected: 12;
8056
+
8057
+ @property --columns {
8058
+ initial-value: 1;
8059
+ syntax: '<integer>';
8060
+ }
8061
+
8062
+ position: relative;
8063
+ display: grid;
8064
+ box-sizing: border-box;
8065
+ align-content: flex-end;
8066
+ padding: 0;
8067
+ background: var(--color-white);
8068
+ grid-template-columns: var(--grid-columns, var(--grid-columns-default));
8069
+ grid-template-rows:
8070
+ [clmns-start thead-start]
8071
+ auto
8072
+ [thead-end tbody-start]
8073
+ auto
8074
+ [tbody-end clmns-end];
8075
+ line-height: 1.25;
8076
+ max-inline-size: -moz-fit-content;
8077
+ max-inline-size: fit-content;
8078
+
8079
+ /* column highlighting (just 10 columns) */
8080
+ }
8081
+
8082
+ /* columns */
8083
+
8084
+ .table-module-k47fT .table-module-1lgqE {
8085
+ display: grid;
8086
+ grid-column: 1 / -1;
8087
+ grid-row: clmns;
8088
+ grid-template-columns: subgrid;
8089
+ pointer-events: none;
8090
+ }
8091
+
8092
+ .table-module-k47fT .table-module-dISOo {
8093
+ position: relative;
8094
+ z-index: var(--z-column);
8095
+ }
8096
+
8097
+ .table-module-k47fT .table-module-dISOo.table-module-WGz-I {
8098
+ background-blend-mode: multiply;
8099
+ background-color: var(--bgcolor-col-selected);
8100
+ }
8101
+
8102
+ .table-module-k47fT .table-module-dISOo.table-module-PQejy {
8103
+ position: sticky;
8104
+ z-index: var(--z-selected);
8105
+ container-name: sticky-column;
8106
+ /* stylelint-disable-next-line declaration-property-value-no-unknown */
8107
+ container-type: scroll-state;
8108
+ inset-inline: 0;
8109
+ }
8110
+
8111
+ .table-module-k47fT .table-module-dISOo.table-module-PQejy::before,
8112
+ .table-module-k47fT .table-module-dISOo.table-module-PQejy::after {
8113
+ position: absolute;
8114
+ background: linear-gradient(-90deg, var(--shadow) 0%, transparent 100%);
8115
+ content: '';
8116
+ inline-size: var(--space-8);
8117
+ inset-block: 0;
8118
+ opacity: 0;
8119
+ transition: opacity var(--transition-duration-short);
8120
+ }
8121
+
8122
+ @supports not (container-type: scroll-state) {
8123
+
8124
+ .table-module-k47fT .table-module-dISOo.table-module-PQejy::before,
8125
+ .table-module-k47fT .table-module-dISOo.table-module-PQejy::after {
8126
+ background: var(--shadow);
8127
+ inline-size: 1px;
8128
+ opacity: 1
8129
+ }
8130
+ }
8131
+
8132
+ .table-module-k47fT .table-module-dISOo.table-module-PQejy::before {
8133
+ inset-inline: auto 100%;
8134
+ }
8135
+
8136
+ @container sticky-column scroll-state(stuck: inline-end) {
8137
+
8138
+ .table-module-k47fT .table-module-dISOo.table-module-PQejy::before {
8139
+ opacity: 1
8140
+ }
8141
+ }
8142
+
8143
+ .table-module-k47fT .table-module-dISOo.table-module-PQejy::after {
8144
+ inset-inline: 100% auto;
8145
+ rotate: 180deg;
8146
+ }
8147
+
8148
+ @container sticky-column scroll-state(stuck: inline-start) {
8149
+
8150
+ .table-module-k47fT .table-module-dISOo.table-module-PQejy::after {
8151
+ opacity: 1
8152
+ }
8153
+ }
8154
+
8155
+ /* cells */
8156
+
8157
+ .table-module-k47fT .table-module-jRXnY,
8158
+ .table-module-k47fT .table-module-wJwSq {
8159
+ overflow: hidden;
8160
+ box-sizing: border-box;
8161
+ padding: var(--cell-padding);
8162
+ text-wrap: balance;
8163
+ }
8164
+
8165
+ .table-module-k47fT .table-module-jRXnY.table-module-EWdty, .table-module-k47fT .table-module-wJwSq.table-module-EWdty {
8166
+ text-align: start;
8167
+ }
8168
+
8169
+ .table-module-k47fT .table-module-jRXnY.table-module-yJD74, .table-module-k47fT .table-module-wJwSq.table-module-yJD74 {
8170
+ text-align: end;
8171
+ }
8172
+
8173
+ .table-module-k47fT .table-module-jRXnY.table-module-XAdfy, .table-module-k47fT .table-module-wJwSq.table-module-XAdfy {
8174
+ text-align: center;
8175
+ }
8176
+
8177
+ .table-module-k47fT .table-module-jRXnY.table-module-h7qdo, .table-module-k47fT .table-module-wJwSq.table-module-h7qdo {
8178
+ text-wrap: nowrap;
8179
+ }
8180
+
8181
+ .table-module-k47fT .table-module-jRXnY.table-module-PQejy, .table-module-k47fT .table-module-wJwSq.table-module-PQejy {
8182
+ position: sticky;
8183
+ z-index: var(--z-sticky);
8184
+ inset-inline: 0;
8185
+ }
8186
+
8187
+ /* rows */
8188
+
8189
+ .table-module-k47fT .table-module-Nisf1 {
8190
+ display: grid;
8191
+ border-block-end: 1px solid var(--border-color);
8192
+ grid-column: 1 / -1;
8193
+ grid-template-columns: subgrid;
8194
+ grid-template-rows: subgrid;
8195
+ }
8196
+
8197
+ .table-module-k47fT .table-module-Nisf1 .table-module-jRXnY,
8198
+ .table-module-k47fT .table-module-Nisf1 .table-module-wJwSq {
8199
+ background-color: var(--bgcolor-odd);
8200
+ }
8201
+
8202
+ .table-module-k47fT .table-module-Nisf1:nth-child(even) .table-module-jRXnY,
8203
+ .table-module-k47fT .table-module-Nisf1:nth-child(even) .table-module-wJwSq {
8204
+ background-color: var(--bgcolor-even);
8205
+ }
8206
+
8207
+ :has(.table-module-3zZB6) .table-module-k47fT .table-module-Nisf1::after {
8208
+ z-index: var(--z-selected);
8209
+ background-blend-mode: multiply;
8210
+ background-color: var(--bgcolor-row-highlight);
8211
+ content: '';
8212
+ grid-column: 1 / -1;
8213
+ opacity: 0;
8214
+ pointer-events: none;
8215
+ }
8216
+
8217
+ @media (pointer: fine) {
8218
+
8219
+ :has(.table-module-3zZB6) .table-module-k47fT .table-module-Nisf1:hover::after {
8220
+ opacity: 1
8221
+ }
8222
+ }
8223
+
8224
+ .table-module-k47fT .table-module-Nisf1.table-module-WGz-I::after {
8225
+ z-index: var(--z-selected);
8226
+ background-blend-mode: multiply;
8227
+ background-color: var(--bgcolor-row-selected);
8228
+ content: '';
8229
+ grid-column: 1 / -1;
8230
+ opacity: 1;
8231
+ pointer-events: none;
8232
+ }
8233
+
8234
+ .table-module-k47fT .table-module-Nisf1.table-module-qRfjM {
8235
+ cursor: pointer;
8236
+ }
8237
+
8238
+ /* table header */
8239
+
8240
+ .table-module-k47fT .table-module-DK-wn {
8241
+ display: grid;
8242
+ grid-column: 1 / -1;
8243
+ grid-row: thead;
8244
+ grid-template-columns: subgrid;
8245
+ }
8246
+
8247
+ .table-module-k47fT .table-module-DK-wn .table-module-Nisf1 {
8248
+ border-block-start: 0;
8249
+ }
8250
+
8251
+ .table-module-k47fT .table-module-DK-wn .table-module-Nisf1 .table-module-jRXnY,
8252
+ .table-module-k47fT .table-module-DK-wn .table-module-Nisf1 .table-module-wJwSq {
8253
+ background-color: var(--bgcolor-even);
8254
+ font-weight: var(--font-weight-bold);
8255
+ }
8256
+
8257
+ /* table body */
8258
+
8259
+ .table-module-k47fT .table-module-tygZb {
8260
+ display: grid;
8261
+ grid-column: 1 / -1;
8262
+ grid-row: tbody;
8263
+ grid-template-columns: subgrid;
8264
+ }
8265
+
8266
+ /* full width table */
8267
+
8268
+ .table-module-k47fT.table-module-YnmWV {
8269
+ min-inline-size: 100%;
8270
+ }
8271
+
8272
+ .table-module-k47fT.table-module-YnmWV .table-module-skhNZ {
8273
+ text-align: start;
8274
+ }
8275
+
8276
+ /* no text wrap for entire table */
8277
+
8278
+ .table-module-k47fT.table-module-h7qdo .table-module-Nisf1 .table-module-jRXnY,
8279
+ .table-module-k47fT.table-module-h7qdo .table-module-Nisf1 .table-module-wJwSq {
8280
+ text-wrap: nowrap;
8281
+ }
8282
+
8283
+ @media (pointer: fine) {
8284
+
8285
+ .table-module-k47fT.table-module-JEp5f:has(.table-module-DK-wn th:nth-child(1):hover) .table-module-dISOo:nth-child(1),
8286
+ .table-module-k47fT.table-module-JEp5f:has(.table-module-DK-wn th:nth-child(2):hover) .table-module-dISOo:nth-child(2),
8287
+ .table-module-k47fT.table-module-JEp5f:has(.table-module-DK-wn th:nth-child(3):hover) .table-module-dISOo:nth-child(3),
8288
+ .table-module-k47fT.table-module-JEp5f:has(.table-module-DK-wn th:nth-child(4):hover) .table-module-dISOo:nth-child(4),
8289
+ .table-module-k47fT.table-module-JEp5f:has(.table-module-DK-wn th:nth-child(5):hover) .table-module-dISOo:nth-child(5),
8290
+ .table-module-k47fT.table-module-JEp5f:has(.table-module-DK-wn th:nth-child(6):hover) .table-module-dISOo:nth-child(6),
8291
+ .table-module-k47fT.table-module-JEp5f:has(.table-module-DK-wn th:nth-child(7):hover) .table-module-dISOo:nth-child(7),
8292
+ .table-module-k47fT.table-module-JEp5f:has(.table-module-DK-wn th:nth-child(8):hover) .table-module-dISOo:nth-child(8),
8293
+ .table-module-k47fT.table-module-JEp5f:has(.table-module-DK-wn th:nth-child(9):hover) .table-module-dISOo:nth-child(9),
8294
+ .table-module-k47fT.table-module-JEp5f:has(.table-module-DK-wn th:nth-child(10):hover) .table-module-dISOo:nth-child(10) {
8295
+ background-blend-mode: multiply;
8296
+ background-color: var(--bgcolor-col-highlight)
8297
+ }
8298
+ }
8299
+
8300
+ /* table sort buttons */
8301
+
8302
+ .table-module-RtOV- {
8303
+ --icon-space: 24px;
8304
+ --icon-size: 12px;
8305
+ --icon-rotation: 0deg;
8306
+ --icon-visibility: hidden;
8307
+
8308
+ all: unset;
8309
+ display: grid;
8310
+ align-items: baseline;
8311
+ padding: var(--cell-padding);
8312
+ cursor: pointer;
8313
+ grid-template-areas: 'label icon .';
8314
+ grid-template-columns: auto var(--icon-space) 1fr;
8315
+ inline-size: 100%;
8316
+ text-align: start;
8317
+ }
8318
+
8319
+ .table-module-RtOV- .table-module-ukG8s {
8320
+ grid-area: label;
8321
+ }
8322
+
8323
+ .table-module-RtOV- .table-module-QdiLJ {
8324
+ grid-area: icon;
8325
+ justify-self: center;
8326
+ rotate: var(--icon-rotation);
8327
+ visibility: var(--icon-visibility);
8328
+ }
8329
+
8330
+ .table-module-RtOV-.table-module-gWy-a {
8331
+ --icon-visibility: visible;
8332
+ }
8333
+
8334
+ .table-module-RtOV-.table-module-SjJ57 {
8335
+ --icon-rotation: 0deg;
8336
+ }
8337
+
8338
+ .table-module-RtOV-.table-module--p8TF {
8339
+ --icon-rotation: 180deg;
8340
+ }
8341
+
8342
+ .table-module-RtOV-.table-module-XAdfy {
8343
+ grid-template-areas: '. . label icon .';
8344
+ grid-template-columns: 1fr var(--icon-space) auto var(--icon-space) 1fr;
8345
+ text-align: center;
8346
+ }
8347
+
8348
+ .table-module-RtOV-.table-module-yJD74 {
8349
+ grid-template-areas: '. icon label';
8350
+ grid-template-columns: 1fr var(--icon-space) auto;
8351
+ text-align: end;
8352
+ }
8353
+
8354
+ .table-module-DK-wn .table-module-RtOV- {
8355
+ margin: calc(var(--cell-padding) * -1);
8356
+ }
8357
+
8358
+ .truncated-module-bwo1A {
8359
+ display: -webkit-box;
8360
+ text-wrap: balance;
8361
+ }
8362
+
8363
+ .truncated-module-bwo1A.truncated-module-JHMUL {
8364
+ overflow: hidden;
8365
+ -webkit-box-orient: vertical;
8366
+ -webkit-line-clamp: var(--lines, 1);
8367
+ line-clamp: var(--lines, 1);
8368
+ text-overflow: ellipsis;
8369
+ }
8370
+
8371
+ .data-table-module-7CcZR {
8372
+ display: flex;
8373
+ flex-direction: column;
8374
+ gap: var(--space-16);
8375
+ }
8376
+
8002
8377
  :root {
8003
8378
  --toastify-color-light: #fff;
8004
8379
  --toastify-color-dark: #121212;
@@ -0,0 +1,19 @@
1
+ import { TranslationId } from '../intl/translation-id';
2
+ import { TableColumnProperties } from './elements/table-column-properties';
3
+ export interface ColumnBase {
4
+ key: string;
5
+ label: TranslationId;
6
+ props?: TableColumnProperties;
7
+ }
8
+ export interface ColumnRender<T extends object> extends ColumnBase {
9
+ render: (row: T, column: Column<T>, data: T[]) => React.ReactNode;
10
+ }
11
+ export interface ColumnProperty<T extends object> extends ColumnBase {
12
+ propertyName: keyof T;
13
+ }
14
+ export type Column<T extends object> = ColumnProperty<T> | ColumnRender<T>;
15
+ export interface DataTableProps<T extends object> {
16
+ columns?: Column<T>[];
17
+ data: T[];
18
+ }
19
+ export declare function DataTable<T extends object>({ columns: _columns, data, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,47 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
3
+ import { DataCard } from '../cards/data-card/data-card.js';
4
+ import { useIsBreakpoint } from '../shared/hooks/use-is-breakpoint.js';
5
+ import { Table } from './elements/table.js';
6
+ import { TD } from './elements/td.js';
7
+ import { TH } from './elements/th.js';
8
+ import { TR } from './elements/tr.js';
9
+ import styles from './data-table.module.css.js';
10
+
11
+ function DataTable({ columns: _columns, data, }) {
12
+ const isXl = useIsBreakpoint('lg');
13
+ const columns = useMemo(() => {
14
+ if (_columns)
15
+ return _columns;
16
+ const firstItem = data[0];
17
+ if (!firstItem)
18
+ return [];
19
+ const propertyNames = Object.keys(firstItem);
20
+ return propertyNames.map(key => ({
21
+ key,
22
+ label: key,
23
+ propertyName: key,
24
+ }));
25
+ }, [_columns, data]);
26
+ if (data.length === 0 || columns.length === 0)
27
+ return null;
28
+ if (isXl)
29
+ return (jsx(Table, { thead: jsx(TR, { children: columns.map(column => (jsx(TH, { ...column.props, children: column.label }, column.key))) }), children: data.map((item, index) => (
30
+ // eslint-disable-next-line @eslint-react/no-array-index-key
31
+ jsx(TR, { children: columns.map(column => 'render' in column ? (jsx(TD, { children: column.render(item, column, data) }, column.key)) : (jsx(TD, { children: String(item[column.propertyName]) }, column.key))) }, index))) }));
32
+ return (jsx("div", { className: styles['data-card-list'], children: data.map((item, index) => (jsx(DataCard
33
+ // eslint-disable-next-line @eslint-react/no-array-index-key
34
+ , { data: columns.map(column => 'render' in column
35
+ ? {
36
+ key: column.key,
37
+ label: column.label,
38
+ value: column.render(item, column, data),
39
+ }
40
+ : {
41
+ key: column.key,
42
+ label: column.label,
43
+ value: item[column.propertyName],
44
+ }) }, index))) }));
45
+ }
46
+
47
+ export { DataTable };
@@ -0,0 +1,3 @@
1
+ var styles = {"data-card-list":"data-table-module-7CcZR"};
2
+
3
+ export { styles as default };
@@ -0,0 +1,7 @@
1
+ export interface ColProps {
2
+ className?: string;
3
+ selected?: boolean;
4
+ span?: number;
5
+ sticky?: boolean;
6
+ }
7
+ export declare function Col({ className, selected, span, sticky }: ColProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import clsx from 'clsx';
3
+ import styles from './table.module.css.js';
4
+
5
+ function Col({ className, selected, span, sticky }) {
6
+ return (jsx("col", { className: clsx(styles['col'], selected && styles['selected'], sticky && styles['sticky'], className), span: span }));
7
+ }
8
+
9
+ export { Col };
@@ -0,0 +1,10 @@
1
+ export type TableColumnAlignment = 'start' | 'center' | 'end';
2
+ export interface TableColumnProperties {
3
+ align?: TableColumnAlignment;
4
+ colSpan?: number;
5
+ nowrap?: boolean;
6
+ rowSpan?: number;
7
+ selected?: boolean;
8
+ sticky?: boolean;
9
+ truncated?: boolean | number;
10
+ }
@@ -0,0 +1,18 @@
1
+ import { TableColumnProperties } from './table-column-properties';
2
+ export type OnColumnChangedHandler = (columnProps: TableColumnProperties) => void;
3
+ export interface TableContextValue {
4
+ register: {
5
+ cell: (rowIndex: number, onColumnChanged: OnColumnChangedHandler) => {
6
+ deregister: VoidFunction;
7
+ };
8
+ column: (rowIndex: number, props: TableColumnProperties) => {
9
+ deregister: VoidFunction;
10
+ update: OnColumnChangedHandler;
11
+ };
12
+ row: () => {
13
+ deregister: VoidFunction;
14
+ index: number;
15
+ };
16
+ };
17
+ }
18
+ export declare const TableContext: React.Context<TableContextValue>;
@@ -0,0 +1,20 @@
1
+ import { createContext } from 'react';
2
+ import { voidFunction } from '../../shared/model/defaults.js';
3
+
4
+ const TableContext = createContext({
5
+ register: {
6
+ cell: () => ({
7
+ deregister: voidFunction,
8
+ }),
9
+ column: () => ({
10
+ deregister: voidFunction,
11
+ update: voidFunction,
12
+ }),
13
+ row: () => ({
14
+ deregister: voidFunction,
15
+ index: -1,
16
+ }),
17
+ },
18
+ });
19
+
20
+ export { TableContext };
@@ -0,0 +1,22 @@
1
+ import { ReactNode } from 'react';
2
+ import { TableColumnProperties } from './table-column-properties';
3
+ import { OnColumnChangedHandler } from './table-context';
4
+ export interface ColumnInfo {
5
+ index: number;
6
+ props: TableColumnProperties;
7
+ rowIndex: number;
8
+ }
9
+ export interface CellInfo {
10
+ index: number;
11
+ onColumnChanged: OnColumnChangedHandler;
12
+ }
13
+ export interface RowInfo {
14
+ cells: CellInfo[];
15
+ index: number;
16
+ }
17
+ export declare function TableProvider({ children, onColumnsChanged, }: {
18
+ children: ReactNode | ((args: {
19
+ columnInfos: ColumnInfo[];
20
+ }) => ReactNode);
21
+ onColumnsChanged?: (columnInfos: ColumnInfo[]) => void;
22
+ }): import("react/jsx-runtime").JSX.Element;