@marianmeres/stuic 3.181.0 → 3.183.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 (44) hide show
  1. package/README.md +1 -1
  2. package/dist/components/FieldsBuilder/FieldsBuilder.svelte +101 -150
  3. package/dist/components/FieldsBuilder/FieldsBuilder.svelte.d.ts +10 -1
  4. package/dist/components/FieldsBuilder/README.md +82 -3
  5. package/dist/components/FieldsBuilder/_internal/ColumnsEditor.svelte +624 -0
  6. package/dist/components/FieldsBuilder/_internal/ColumnsEditor.svelte.d.ts +41 -0
  7. package/dist/components/FieldsBuilder/_internal/ExtrasEditor.svelte +174 -0
  8. package/dist/components/FieldsBuilder/_internal/ExtrasEditor.svelte.d.ts +20 -0
  9. package/dist/components/FieldsBuilder/_internal/column-meta.d.ts +27 -0
  10. package/dist/components/FieldsBuilder/_internal/column-meta.js +15 -0
  11. package/dist/components/FieldsBuilder/i18n-sk.js +17 -0
  12. package/dist/components/FieldsBuilder/i18n.d.ts +17 -0
  13. package/dist/components/FieldsBuilder/i18n.js +17 -0
  14. package/dist/components/FieldsBuilder/index.css +20 -0
  15. package/dist/components/FieldsBuilder/index.d.ts +2 -2
  16. package/dist/components/FieldsBuilder/types.d.ts +39 -0
  17. package/dist/components/FieldsBuilder/utils.d.ts +36 -1
  18. package/dist/components/FieldsBuilder/utils.js +180 -55
  19. package/dist/components/Input/FieldAssets.svelte +9 -132
  20. package/dist/components/Input/FieldSingleAsset.svelte +876 -0
  21. package/dist/components/Input/FieldSingleAsset.svelte.d.ts +135 -0
  22. package/dist/components/Input/FieldTable.svelte +907 -0
  23. package/dist/components/Input/FieldTable.svelte.d.ts +98 -0
  24. package/dist/components/Input/README.md +467 -20
  25. package/dist/components/Input/_internal/asset-helpers.d.ts +16 -0
  26. package/dist/components/Input/_internal/asset-helpers.js +46 -0
  27. package/dist/components/Input/_internal/paste-target.d.ts +15 -0
  28. package/dist/components/Input/_internal/paste-target.js +114 -0
  29. package/dist/components/Input/field-single-asset-i18n-sk.d.ts +21 -0
  30. package/dist/components/Input/field-single-asset-i18n-sk.js +49 -0
  31. package/dist/components/Input/field-single-asset-i18n.d.ts +68 -0
  32. package/dist/components/Input/field-single-asset-i18n.js +75 -0
  33. package/dist/components/Input/field-table-i18n-sk.d.ts +21 -0
  34. package/dist/components/Input/field-table-i18n-sk.js +41 -0
  35. package/dist/components/Input/field-table-i18n.d.ts +60 -0
  36. package/dist/components/Input/field-table-i18n.js +66 -0
  37. package/dist/components/Input/field-table-number.d.ts +48 -0
  38. package/dist/components/Input/field-table-number.js +86 -0
  39. package/dist/components/Input/index.css +801 -0
  40. package/dist/components/Input/index.d.ts +7 -0
  41. package/dist/components/Input/index.js +7 -0
  42. package/docs/domains/actions.md +3 -3
  43. package/docs/domains/components.md +45 -38
  44. package/package.json +1 -1
@@ -98,6 +98,46 @@
98
98
  --stuic-field-date-placeholder-text: var(--stuic-input-placeholder);
99
99
  --stuic-field-date-embedded-padding: 0.5rem;
100
100
  --stuic-field-date-dialog-padding: 1rem;
101
+
102
+ /* FieldTable specific (see the FIELD TABLE section at the bottom of this file) */
103
+ --stuic-field-table-border-color: var(--stuic-color-border);
104
+ --stuic-field-table-header-bg: var(--stuic-color-muted);
105
+ --stuic-field-table-header-text: var(--stuic-color-muted-foreground);
106
+ --stuic-field-table-row-divider-color: var(--stuic-color-border);
107
+ --stuic-field-table-cell-padding-x: calc(var(--spacing) * 1.5);
108
+ --stuic-field-table-cell-padding-y: calc(var(--spacing) * 1);
109
+ --stuic-field-table-card-bg: transparent;
110
+ --stuic-field-table-card-gap: calc(var(--spacing) * 2);
111
+ --stuic-field-table-invalid-color: var(--stuic-input-accent-error);
112
+ --stuic-field-table-unit-text: var(--stuic-color-muted-foreground);
113
+ /* `--stuic-field-table-card-radius` is deliberately NOT declared: it is read as a
114
+ fallback argument at the usage site (`--stuic-radius`) — see docs/conventions.md. */
115
+ /* Minimum usable width per cell type in table mode (the table scrolls instead) */
116
+ --stuic-field-table-col-min-text: 10rem;
117
+ --stuic-field-table-col-min-number: 6rem;
118
+ --stuic-field-table-col-min-select: 8rem;
119
+ --stuic-field-table-col-min-checkbox: 3rem;
120
+ --stuic-field-table-col-min-date: 9.5rem;
121
+ --stuic-field-table-col-min-url: 12rem;
122
+
123
+ /* FieldSingleAsset */
124
+ --stuic-field-single-asset-size-sm: 5rem;
125
+ --stuic-field-single-asset-size-md: 8rem;
126
+ --stuic-field-single-asset-size-lg: 12rem;
127
+ --stuic-field-single-asset-wide-ratio: 16 / 9;
128
+ --stuic-field-single-asset-preview-bg: var(--stuic-color-muted);
129
+ --stuic-field-single-asset-preview-border: var(--stuic-color-border);
130
+ --stuic-field-single-asset-preview-border-hover: var(--stuic-color-ring);
131
+ --stuic-field-single-asset-placeholder-text: var(--stuic-color-muted-foreground);
132
+ --stuic-field-single-asset-meta-text: var(--stuic-color-muted-foreground);
133
+ --stuic-field-single-asset-control-bg: rgb(0 0 0 / 0.6);
134
+ --stuic-field-single-asset-control-bg-hover: rgb(0 0 0 / 0.8);
135
+ --stuic-field-single-asset-control-text: #fff;
136
+ --stuic-field-single-asset-overlay-bg: rgb(0 0 0 / 0.4);
137
+ --stuic-field-single-asset-error-color: var(--stuic-input-accent-error);
138
+ /* `--stuic-field-single-asset-size`, `-radius`, `-control-radius`, `-border-width`
139
+ and `-transition` are deliberately NOT declared: they are read as fallback
140
+ arguments at the usage site — see docs/conventions.md. */
101
141
  }
102
142
 
103
143
  @layer components {
@@ -954,3 +994,764 @@
954
994
  overflow-x: auto;
955
995
  }
956
996
  }
997
+
998
+ /* ============================================================================
999
+ FIELD TABLE
1000
+ One DOM for both layouts: a real <table> is the base ("table" mode), and the
1001
+ "stacked" mode restyles it into one card per row (thead gone, each <td> a
1002
+ label + control line, the actions cell moved to the card's top). `auto`
1003
+ picks the mode by a container query on the component's OWN inline size — a
1004
+ size query cannot read a custom property, hence a `data-table-from` attribute
1005
+ on a fixed scale and one block per step (the DescriptionList pattern).
1006
+
1007
+ The stacked block is repeated verbatim per step on purpose: the alternative
1008
+ (a JS ResizeObserver flipping an attribute) would remount nothing either, but
1009
+ paints one frame in the wrong mode and costs an observer per instance.
1010
+
1011
+ Cell controls take their chrome from Tailwind utilities in the component
1012
+ (the `.stuic-input input` base rule outranks any component-layer selector);
1013
+ this file owns layout, headers, cards, min-widths and the messages.
1014
+ ============================================================================ */
1015
+
1016
+ @layer components {
1017
+ .stuic-field-table {
1018
+ padding: calc(var(--spacing) * 2);
1019
+ }
1020
+
1021
+ .stuic-field-table[data-layout="auto"] {
1022
+ /* Named so the queries below can only ever resolve against this element,
1023
+ never against a consumer's own @container ancestor. */
1024
+ container-name: stuic-field-table;
1025
+ container-type: inline-size;
1026
+ }
1027
+
1028
+ /* ---- table mode (base) ---- */
1029
+
1030
+ .stuic-field-table-scroll {
1031
+ overflow-x: auto;
1032
+ scrollbar-width: thin;
1033
+ }
1034
+
1035
+ .stuic-field-table table {
1036
+ width: 100%;
1037
+ border-collapse: collapse;
1038
+ }
1039
+
1040
+ .stuic-field-table th {
1041
+ text-align: start;
1042
+ font-size: var(--text-xs);
1043
+ font-weight: 500;
1044
+ color: var(--stuic-field-table-header-text);
1045
+ background: var(--stuic-field-table-header-bg);
1046
+ padding: var(--stuic-field-table-cell-padding-y)
1047
+ var(--stuic-field-table-cell-padding-x);
1048
+ white-space: nowrap;
1049
+ }
1050
+
1051
+ .stuic-field-table th:first-child {
1052
+ border-start-start-radius: var(
1053
+ --stuic-field-table-header-radius,
1054
+ var(--stuic-radius)
1055
+ );
1056
+ }
1057
+
1058
+ .stuic-field-table th:last-child {
1059
+ border-start-end-radius: var(--stuic-field-table-header-radius, var(--stuic-radius));
1060
+ }
1061
+
1062
+ .stuic-field-table td {
1063
+ padding: var(--stuic-field-table-cell-padding-y)
1064
+ var(--stuic-field-table-cell-padding-x);
1065
+ vertical-align: top;
1066
+ border-top: 1px solid var(--stuic-field-table-row-divider-color);
1067
+ }
1068
+
1069
+ .stuic-field-table tbody tr:first-child td {
1070
+ border-top-color: transparent;
1071
+ }
1072
+
1073
+ /* never squash an input below usable width — the wrapper scrolls instead */
1074
+ .stuic-field-table td[data-type="text"] {
1075
+ min-width: var(--stuic-field-table-col-min-text);
1076
+ }
1077
+ .stuic-field-table td[data-type="number"] {
1078
+ min-width: var(--stuic-field-table-col-min-number);
1079
+ }
1080
+ .stuic-field-table td[data-type="select"] {
1081
+ min-width: var(--stuic-field-table-col-min-select);
1082
+ }
1083
+ .stuic-field-table td[data-type="checkbox"] {
1084
+ min-width: var(--stuic-field-table-col-min-checkbox);
1085
+ }
1086
+ .stuic-field-table td[data-type="date"] {
1087
+ min-width: var(--stuic-field-table-col-min-date);
1088
+ }
1089
+ .stuic-field-table td[data-type="url"] {
1090
+ min-width: var(--stuic-field-table-col-min-url);
1091
+ }
1092
+
1093
+ /* In table mode the <th scope="col"> is the visible heading; the per-cell
1094
+ label stays for the accessible name only ("Qty, row 3"). */
1095
+ .stuic-field-table-cell-label {
1096
+ position: absolute;
1097
+ width: 1px;
1098
+ height: 1px;
1099
+ margin: -1px;
1100
+ padding: 0;
1101
+ overflow: hidden;
1102
+ clip-path: inset(50%);
1103
+ white-space: nowrap;
1104
+ border: 0;
1105
+ }
1106
+
1107
+ .stuic-field-table-row-title {
1108
+ display: none;
1109
+ }
1110
+
1111
+ .stuic-field-table-actions {
1112
+ width: 1%;
1113
+ white-space: nowrap;
1114
+ text-align: end;
1115
+ }
1116
+
1117
+ .stuic-field-table-actions-buttons {
1118
+ display: inline-flex;
1119
+ align-items: center;
1120
+ gap: calc(var(--spacing) * 0.5);
1121
+ }
1122
+
1123
+ /* ---- cells ---- */
1124
+
1125
+ .stuic-field-table-number {
1126
+ display: flex;
1127
+ align-items: center;
1128
+ gap: calc(var(--spacing) * 1.5);
1129
+ }
1130
+
1131
+ .stuic-field-table-unit {
1132
+ color: var(--stuic-field-table-unit-text);
1133
+ font-size: var(--text-xs);
1134
+ white-space: nowrap;
1135
+ }
1136
+
1137
+ .stuic-field-table-checkbox {
1138
+ display: flex;
1139
+ align-items: center;
1140
+ min-height: var(--stuic-input-min-height-sm);
1141
+ }
1142
+
1143
+ .stuic-field-table-readonly {
1144
+ font-size: var(--text-sm);
1145
+ padding-block: var(--stuic-field-table-cell-padding-y);
1146
+ overflow-wrap: anywhere;
1147
+ }
1148
+
1149
+ .stuic-field-table-unknown-row {
1150
+ font-size: var(--text-xs);
1151
+ color: var(--stuic-color-surface-warning-foreground);
1152
+ }
1153
+
1154
+ .stuic-field-table-cell-error {
1155
+ margin-top: calc(var(--spacing) * 1);
1156
+ font-size: var(--text-xs);
1157
+ color: var(--stuic-field-table-invalid-color);
1158
+ }
1159
+
1160
+ /* ---- empty / footer ---- */
1161
+
1162
+ .stuic-field-table-empty {
1163
+ padding: calc(var(--spacing) * 3);
1164
+ text-align: center;
1165
+ font-size: var(--text-sm);
1166
+ opacity: 0.5;
1167
+ }
1168
+
1169
+ .stuic-field-table-footer {
1170
+ display: flex;
1171
+ align-items: center;
1172
+ justify-content: space-between;
1173
+ gap: calc(var(--spacing) * 2);
1174
+ padding-top: calc(var(--spacing) * 2);
1175
+ }
1176
+
1177
+ .stuic-field-table-add {
1178
+ display: inline-flex;
1179
+ align-items: center;
1180
+ gap: calc(var(--spacing) * 1);
1181
+ font-size: var(--text-sm);
1182
+ padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 2)
1183
+ calc(var(--spacing) * 1.5) calc(var(--spacing) * 1.5);
1184
+ border-radius: var(--stuic-field-table-add-radius, var(--stuic-radius-button));
1185
+ background: var(--stuic-color-muted);
1186
+ opacity: 0.75;
1187
+ transition:
1188
+ opacity var(--stuic-transition),
1189
+ background var(--stuic-transition);
1190
+ }
1191
+
1192
+ .stuic-field-table-add:hover:not(:disabled) {
1193
+ opacity: 1;
1194
+ background: var(--stuic-color-muted-hover);
1195
+ }
1196
+
1197
+ .stuic-field-table-add:disabled {
1198
+ opacity: 0.25;
1199
+ cursor: not-allowed;
1200
+ }
1201
+
1202
+ .stuic-field-table-count {
1203
+ font-size: var(--text-xs);
1204
+ color: var(--stuic-color-muted-foreground);
1205
+ font-variant-numeric: tabular-nums;
1206
+ }
1207
+
1208
+ /* ---- stacked mode (static) ---- */
1209
+
1210
+ .stuic-field-table[data-layout="stacked"] thead {
1211
+ display: none;
1212
+ }
1213
+ .stuic-field-table[data-layout="stacked"] table,
1214
+ .stuic-field-table[data-layout="stacked"] tbody,
1215
+ .stuic-field-table[data-layout="stacked"] tr,
1216
+ .stuic-field-table[data-layout="stacked"] td {
1217
+ display: block;
1218
+ min-width: 0;
1219
+ }
1220
+ .stuic-field-table[data-layout="stacked"] tbody {
1221
+ display: flex;
1222
+ flex-direction: column;
1223
+ gap: var(--stuic-field-table-card-gap);
1224
+ }
1225
+ .stuic-field-table[data-layout="stacked"] tr {
1226
+ display: flex;
1227
+ flex-direction: column;
1228
+ gap: calc(var(--spacing) * 2);
1229
+ padding: calc(var(--spacing) * 2.5);
1230
+ border: 1px solid var(--stuic-field-table-border-color);
1231
+ border-radius: var(--stuic-field-table-card-radius, var(--stuic-radius));
1232
+ background: var(--stuic-field-table-card-bg);
1233
+ }
1234
+ .stuic-field-table[data-layout="stacked"] td {
1235
+ display: grid;
1236
+ grid-template-columns: minmax(5rem, 1fr) minmax(0, 2fr);
1237
+ column-gap: calc(var(--spacing) * 3);
1238
+ align-items: center;
1239
+ padding: 0;
1240
+ border-top: 0;
1241
+ }
1242
+ .stuic-field-table[data-layout="stacked"] td[data-degraded] {
1243
+ display: block;
1244
+ }
1245
+ .stuic-field-table[data-layout="stacked"] .stuic-field-table-cell-label {
1246
+ position: static;
1247
+ width: auto;
1248
+ height: auto;
1249
+ margin: 0;
1250
+ overflow: visible;
1251
+ clip-path: none;
1252
+ white-space: normal;
1253
+ font-size: var(--text-xs);
1254
+ font-weight: 500;
1255
+ color: var(--stuic-field-table-header-text);
1256
+ }
1257
+ .stuic-field-table[data-layout="stacked"] .stuic-field-table-cell-error {
1258
+ grid-column: 2;
1259
+ margin-top: 0;
1260
+ }
1261
+ .stuic-field-table[data-layout="stacked"] .stuic-field-table-actions {
1262
+ order: -1;
1263
+ display: flex;
1264
+ align-items: center;
1265
+ justify-content: space-between;
1266
+ width: auto;
1267
+ white-space: normal;
1268
+ padding-bottom: calc(var(--spacing) * 1.5);
1269
+ border-bottom: 1px solid var(--stuic-field-table-row-divider-color);
1270
+ }
1271
+ .stuic-field-table[data-layout="stacked"] .stuic-field-table-row-title {
1272
+ display: inline;
1273
+ font-size: var(--text-sm);
1274
+ font-weight: 500;
1275
+ }
1276
+
1277
+ /* ---- stacked mode by container query (`layout="auto"`) ----
1278
+ The same block as above, once per `tableFrom` step: sm 32rem, md 40rem,
1279
+ lg 48rem, xl 56rem. */
1280
+
1281
+ @container stuic-field-table (width < 32rem) {
1282
+ .stuic-field-table[data-layout="auto"][data-table-from="sm"] thead {
1283
+ display: none;
1284
+ }
1285
+ .stuic-field-table[data-layout="auto"][data-table-from="sm"] table,
1286
+ .stuic-field-table[data-layout="auto"][data-table-from="sm"] tbody,
1287
+ .stuic-field-table[data-layout="auto"][data-table-from="sm"] tr,
1288
+ .stuic-field-table[data-layout="auto"][data-table-from="sm"] td {
1289
+ display: block;
1290
+ min-width: 0;
1291
+ }
1292
+ .stuic-field-table[data-layout="auto"][data-table-from="sm"] tbody {
1293
+ display: flex;
1294
+ flex-direction: column;
1295
+ gap: var(--stuic-field-table-card-gap);
1296
+ }
1297
+ .stuic-field-table[data-layout="auto"][data-table-from="sm"] tr {
1298
+ display: flex;
1299
+ flex-direction: column;
1300
+ gap: calc(var(--spacing) * 2);
1301
+ padding: calc(var(--spacing) * 2.5);
1302
+ border: 1px solid var(--stuic-field-table-border-color);
1303
+ border-radius: var(--stuic-field-table-card-radius, var(--stuic-radius));
1304
+ background: var(--stuic-field-table-card-bg);
1305
+ }
1306
+ .stuic-field-table[data-layout="auto"][data-table-from="sm"] td {
1307
+ display: grid;
1308
+ grid-template-columns: minmax(5rem, 1fr) minmax(0, 2fr);
1309
+ column-gap: calc(var(--spacing) * 3);
1310
+ align-items: center;
1311
+ padding: 0;
1312
+ border-top: 0;
1313
+ }
1314
+ .stuic-field-table[data-layout="auto"][data-table-from="sm"] td[data-degraded] {
1315
+ display: block;
1316
+ }
1317
+ .stuic-field-table[data-layout="auto"][data-table-from="sm"]
1318
+ .stuic-field-table-cell-label {
1319
+ position: static;
1320
+ width: auto;
1321
+ height: auto;
1322
+ margin: 0;
1323
+ overflow: visible;
1324
+ clip-path: none;
1325
+ white-space: normal;
1326
+ font-size: var(--text-xs);
1327
+ font-weight: 500;
1328
+ color: var(--stuic-field-table-header-text);
1329
+ }
1330
+ .stuic-field-table[data-layout="auto"][data-table-from="sm"]
1331
+ .stuic-field-table-cell-error {
1332
+ grid-column: 2;
1333
+ margin-top: 0;
1334
+ }
1335
+ .stuic-field-table[data-layout="auto"][data-table-from="sm"]
1336
+ .stuic-field-table-actions {
1337
+ order: -1;
1338
+ display: flex;
1339
+ align-items: center;
1340
+ justify-content: space-between;
1341
+ width: auto;
1342
+ white-space: normal;
1343
+ padding-bottom: calc(var(--spacing) * 1.5);
1344
+ border-bottom: 1px solid var(--stuic-field-table-row-divider-color);
1345
+ }
1346
+ .stuic-field-table[data-layout="auto"][data-table-from="sm"]
1347
+ .stuic-field-table-row-title {
1348
+ display: inline;
1349
+ font-size: var(--text-sm);
1350
+ font-weight: 500;
1351
+ }
1352
+ }
1353
+
1354
+ @container stuic-field-table (width < 40rem) {
1355
+ .stuic-field-table[data-layout="auto"][data-table-from="md"] thead {
1356
+ display: none;
1357
+ }
1358
+ .stuic-field-table[data-layout="auto"][data-table-from="md"] table,
1359
+ .stuic-field-table[data-layout="auto"][data-table-from="md"] tbody,
1360
+ .stuic-field-table[data-layout="auto"][data-table-from="md"] tr,
1361
+ .stuic-field-table[data-layout="auto"][data-table-from="md"] td {
1362
+ display: block;
1363
+ min-width: 0;
1364
+ }
1365
+ .stuic-field-table[data-layout="auto"][data-table-from="md"] tbody {
1366
+ display: flex;
1367
+ flex-direction: column;
1368
+ gap: var(--stuic-field-table-card-gap);
1369
+ }
1370
+ .stuic-field-table[data-layout="auto"][data-table-from="md"] tr {
1371
+ display: flex;
1372
+ flex-direction: column;
1373
+ gap: calc(var(--spacing) * 2);
1374
+ padding: calc(var(--spacing) * 2.5);
1375
+ border: 1px solid var(--stuic-field-table-border-color);
1376
+ border-radius: var(--stuic-field-table-card-radius, var(--stuic-radius));
1377
+ background: var(--stuic-field-table-card-bg);
1378
+ }
1379
+ .stuic-field-table[data-layout="auto"][data-table-from="md"] td {
1380
+ display: grid;
1381
+ grid-template-columns: minmax(5rem, 1fr) minmax(0, 2fr);
1382
+ column-gap: calc(var(--spacing) * 3);
1383
+ align-items: center;
1384
+ padding: 0;
1385
+ border-top: 0;
1386
+ }
1387
+ .stuic-field-table[data-layout="auto"][data-table-from="md"] td[data-degraded] {
1388
+ display: block;
1389
+ }
1390
+ .stuic-field-table[data-layout="auto"][data-table-from="md"]
1391
+ .stuic-field-table-cell-label {
1392
+ position: static;
1393
+ width: auto;
1394
+ height: auto;
1395
+ margin: 0;
1396
+ overflow: visible;
1397
+ clip-path: none;
1398
+ white-space: normal;
1399
+ font-size: var(--text-xs);
1400
+ font-weight: 500;
1401
+ color: var(--stuic-field-table-header-text);
1402
+ }
1403
+ .stuic-field-table[data-layout="auto"][data-table-from="md"]
1404
+ .stuic-field-table-cell-error {
1405
+ grid-column: 2;
1406
+ margin-top: 0;
1407
+ }
1408
+ .stuic-field-table[data-layout="auto"][data-table-from="md"]
1409
+ .stuic-field-table-actions {
1410
+ order: -1;
1411
+ display: flex;
1412
+ align-items: center;
1413
+ justify-content: space-between;
1414
+ width: auto;
1415
+ white-space: normal;
1416
+ padding-bottom: calc(var(--spacing) * 1.5);
1417
+ border-bottom: 1px solid var(--stuic-field-table-row-divider-color);
1418
+ }
1419
+ .stuic-field-table[data-layout="auto"][data-table-from="md"]
1420
+ .stuic-field-table-row-title {
1421
+ display: inline;
1422
+ font-size: var(--text-sm);
1423
+ font-weight: 500;
1424
+ }
1425
+ }
1426
+
1427
+ @container stuic-field-table (width < 48rem) {
1428
+ .stuic-field-table[data-layout="auto"][data-table-from="lg"] thead {
1429
+ display: none;
1430
+ }
1431
+ .stuic-field-table[data-layout="auto"][data-table-from="lg"] table,
1432
+ .stuic-field-table[data-layout="auto"][data-table-from="lg"] tbody,
1433
+ .stuic-field-table[data-layout="auto"][data-table-from="lg"] tr,
1434
+ .stuic-field-table[data-layout="auto"][data-table-from="lg"] td {
1435
+ display: block;
1436
+ min-width: 0;
1437
+ }
1438
+ .stuic-field-table[data-layout="auto"][data-table-from="lg"] tbody {
1439
+ display: flex;
1440
+ flex-direction: column;
1441
+ gap: var(--stuic-field-table-card-gap);
1442
+ }
1443
+ .stuic-field-table[data-layout="auto"][data-table-from="lg"] tr {
1444
+ display: flex;
1445
+ flex-direction: column;
1446
+ gap: calc(var(--spacing) * 2);
1447
+ padding: calc(var(--spacing) * 2.5);
1448
+ border: 1px solid var(--stuic-field-table-border-color);
1449
+ border-radius: var(--stuic-field-table-card-radius, var(--stuic-radius));
1450
+ background: var(--stuic-field-table-card-bg);
1451
+ }
1452
+ .stuic-field-table[data-layout="auto"][data-table-from="lg"] td {
1453
+ display: grid;
1454
+ grid-template-columns: minmax(5rem, 1fr) minmax(0, 2fr);
1455
+ column-gap: calc(var(--spacing) * 3);
1456
+ align-items: center;
1457
+ padding: 0;
1458
+ border-top: 0;
1459
+ }
1460
+ .stuic-field-table[data-layout="auto"][data-table-from="lg"] td[data-degraded] {
1461
+ display: block;
1462
+ }
1463
+ .stuic-field-table[data-layout="auto"][data-table-from="lg"]
1464
+ .stuic-field-table-cell-label {
1465
+ position: static;
1466
+ width: auto;
1467
+ height: auto;
1468
+ margin: 0;
1469
+ overflow: visible;
1470
+ clip-path: none;
1471
+ white-space: normal;
1472
+ font-size: var(--text-xs);
1473
+ font-weight: 500;
1474
+ color: var(--stuic-field-table-header-text);
1475
+ }
1476
+ .stuic-field-table[data-layout="auto"][data-table-from="lg"]
1477
+ .stuic-field-table-cell-error {
1478
+ grid-column: 2;
1479
+ margin-top: 0;
1480
+ }
1481
+ .stuic-field-table[data-layout="auto"][data-table-from="lg"]
1482
+ .stuic-field-table-actions {
1483
+ order: -1;
1484
+ display: flex;
1485
+ align-items: center;
1486
+ justify-content: space-between;
1487
+ width: auto;
1488
+ white-space: normal;
1489
+ padding-bottom: calc(var(--spacing) * 1.5);
1490
+ border-bottom: 1px solid var(--stuic-field-table-row-divider-color);
1491
+ }
1492
+ .stuic-field-table[data-layout="auto"][data-table-from="lg"]
1493
+ .stuic-field-table-row-title {
1494
+ display: inline;
1495
+ font-size: var(--text-sm);
1496
+ font-weight: 500;
1497
+ }
1498
+ }
1499
+
1500
+ @container stuic-field-table (width < 56rem) {
1501
+ .stuic-field-table[data-layout="auto"][data-table-from="xl"] thead {
1502
+ display: none;
1503
+ }
1504
+ .stuic-field-table[data-layout="auto"][data-table-from="xl"] table,
1505
+ .stuic-field-table[data-layout="auto"][data-table-from="xl"] tbody,
1506
+ .stuic-field-table[data-layout="auto"][data-table-from="xl"] tr,
1507
+ .stuic-field-table[data-layout="auto"][data-table-from="xl"] td {
1508
+ display: block;
1509
+ min-width: 0;
1510
+ }
1511
+ .stuic-field-table[data-layout="auto"][data-table-from="xl"] tbody {
1512
+ display: flex;
1513
+ flex-direction: column;
1514
+ gap: var(--stuic-field-table-card-gap);
1515
+ }
1516
+ .stuic-field-table[data-layout="auto"][data-table-from="xl"] tr {
1517
+ display: flex;
1518
+ flex-direction: column;
1519
+ gap: calc(var(--spacing) * 2);
1520
+ padding: calc(var(--spacing) * 2.5);
1521
+ border: 1px solid var(--stuic-field-table-border-color);
1522
+ border-radius: var(--stuic-field-table-card-radius, var(--stuic-radius));
1523
+ background: var(--stuic-field-table-card-bg);
1524
+ }
1525
+ .stuic-field-table[data-layout="auto"][data-table-from="xl"] td {
1526
+ display: grid;
1527
+ grid-template-columns: minmax(5rem, 1fr) minmax(0, 2fr);
1528
+ column-gap: calc(var(--spacing) * 3);
1529
+ align-items: center;
1530
+ padding: 0;
1531
+ border-top: 0;
1532
+ }
1533
+ .stuic-field-table[data-layout="auto"][data-table-from="xl"] td[data-degraded] {
1534
+ display: block;
1535
+ }
1536
+ .stuic-field-table[data-layout="auto"][data-table-from="xl"]
1537
+ .stuic-field-table-cell-label {
1538
+ position: static;
1539
+ width: auto;
1540
+ height: auto;
1541
+ margin: 0;
1542
+ overflow: visible;
1543
+ clip-path: none;
1544
+ white-space: normal;
1545
+ font-size: var(--text-xs);
1546
+ font-weight: 500;
1547
+ color: var(--stuic-field-table-header-text);
1548
+ }
1549
+ .stuic-field-table[data-layout="auto"][data-table-from="xl"]
1550
+ .stuic-field-table-cell-error {
1551
+ grid-column: 2;
1552
+ margin-top: 0;
1553
+ }
1554
+ .stuic-field-table[data-layout="auto"][data-table-from="xl"]
1555
+ .stuic-field-table-actions {
1556
+ order: -1;
1557
+ display: flex;
1558
+ align-items: center;
1559
+ justify-content: space-between;
1560
+ width: auto;
1561
+ white-space: normal;
1562
+ padding-bottom: calc(var(--spacing) * 1.5);
1563
+ border-bottom: 1px solid var(--stuic-field-table-row-divider-color);
1564
+ }
1565
+ .stuic-field-table[data-layout="auto"][data-table-from="xl"]
1566
+ .stuic-field-table-row-title {
1567
+ display: inline;
1568
+ font-size: var(--text-sm);
1569
+ font-weight: 500;
1570
+ }
1571
+ }
1572
+ }
1573
+
1574
+ /* ============================================================================
1575
+ FIELD SINGLE ASSET
1576
+ One tile (the preview, also the picker + drop target) with hover/focus
1577
+ actions, a meta column, and an inline Undo after a remove. Layout that a
1578
+ theme may want to change lives here; utility classes in the component only
1579
+ handle flex/gap.
1580
+ ============================================================================ */
1581
+ @layer components {
1582
+ .stuic-field-single-asset-tile {
1583
+ --_size: var(
1584
+ --stuic-field-single-asset-size,
1585
+ var(--stuic-field-single-asset-size-md)
1586
+ );
1587
+ height: var(--_size);
1588
+ }
1589
+ .stuic-field-single-asset[data-size="sm"] .stuic-field-single-asset-tile {
1590
+ --_size: var(
1591
+ --stuic-field-single-asset-size,
1592
+ var(--stuic-field-single-asset-size-sm)
1593
+ );
1594
+ }
1595
+ .stuic-field-single-asset[data-size="lg"] .stuic-field-single-asset-tile {
1596
+ --_size: var(
1597
+ --stuic-field-single-asset-size,
1598
+ var(--stuic-field-single-asset-size-lg)
1599
+ );
1600
+ }
1601
+
1602
+ .stuic-field-single-asset-preview {
1603
+ position: relative;
1604
+ display: grid;
1605
+ place-content: center;
1606
+ overflow: hidden;
1607
+ height: 100%;
1608
+ width: auto;
1609
+ max-width: 100%;
1610
+ aspect-ratio: 1 / 1;
1611
+ padding: 0;
1612
+ background: var(--stuic-field-single-asset-preview-bg);
1613
+ color: var(--stuic-field-single-asset-placeholder-text);
1614
+ border-style: solid;
1615
+ border-width: var(--stuic-field-single-asset-border-width, var(--stuic-border-width));
1616
+ border-color: var(--stuic-field-single-asset-preview-border);
1617
+ border-radius: var(--stuic-field-single-asset-radius, var(--stuic-radius));
1618
+ cursor: pointer;
1619
+ transition: border-color
1620
+ var(--stuic-field-single-asset-transition, var(--stuic-transition));
1621
+ }
1622
+ .stuic-field-single-asset[data-shape="circle"] .stuic-field-single-asset-preview {
1623
+ border-radius: 9999px;
1624
+ }
1625
+ .stuic-field-single-asset[data-shape="wide"] .stuic-field-single-asset-preview {
1626
+ aspect-ratio: var(--stuic-field-single-asset-wide-ratio);
1627
+ }
1628
+ .stuic-field-single-asset[data-state="empty"] .stuic-field-single-asset-preview {
1629
+ border-style: dashed;
1630
+ }
1631
+ .stuic-field-single-asset[data-state="error"] .stuic-field-single-asset-preview {
1632
+ border-color: var(--stuic-field-single-asset-error-color);
1633
+ }
1634
+ .stuic-field-single-asset-preview:disabled {
1635
+ cursor: default;
1636
+ }
1637
+ .stuic-field-single-asset[data-state="loading"] .stuic-field-single-asset-preview {
1638
+ cursor: default;
1639
+ border-color: transparent;
1640
+ }
1641
+ .stuic-field-single-asset-preview:not(:disabled):hover {
1642
+ border-color: var(--stuic-field-single-asset-preview-border-hover);
1643
+ }
1644
+ .stuic-field-single-asset-preview:focus-visible {
1645
+ outline: 2px solid var(--stuic-color-ring);
1646
+ outline-offset: 2px;
1647
+ }
1648
+ /* the tile is `disabled` while the field only displays — keep it legible */
1649
+ .stuic-field-single-asset[data-state="filled"]
1650
+ .stuic-field-single-asset-preview:disabled {
1651
+ opacity: 1;
1652
+ }
1653
+
1654
+ .stuic-field-single-asset-img {
1655
+ position: absolute;
1656
+ inset: 0;
1657
+ width: 100%;
1658
+ height: 100%;
1659
+ object-fit: cover;
1660
+ }
1661
+ .stuic-field-single-asset[data-fit="contain"] .stuic-field-single-asset-img {
1662
+ object-fit: contain;
1663
+ padding: calc(var(--spacing) * 2);
1664
+ }
1665
+ .stuic-field-single-asset-icon {
1666
+ display: grid;
1667
+ place-content: center;
1668
+ }
1669
+
1670
+ .stuic-field-single-asset-overlay {
1671
+ position: absolute;
1672
+ inset: 0;
1673
+ display: grid;
1674
+ place-content: center;
1675
+ pointer-events: none;
1676
+ color: #fff;
1677
+ background: var(--stuic-field-single-asset-overlay-bg);
1678
+ }
1679
+ .stuic-field-single-asset-overlay[data-error] {
1680
+ background: color-mix(
1681
+ in oklab,
1682
+ var(--stuic-field-single-asset-error-color) 55%,
1683
+ transparent
1684
+ );
1685
+ }
1686
+
1687
+ /* Actions: hidden until the tile is hovered / focused (or on a failed upload,
1688
+ where Retry / Discard must be findable); pointer events gated the same way so
1689
+ an invisible control never intercepts a click meant for the tile. Keyboard
1690
+ users Tab to them regardless. Touch has no hover: always shown there. */
1691
+ .stuic-field-single-asset-actions {
1692
+ position: absolute;
1693
+ top: calc(var(--spacing) * 1);
1694
+ right: calc(var(--spacing) * 1);
1695
+ display: flex;
1696
+ gap: calc(var(--spacing) * 1);
1697
+ opacity: 0;
1698
+ pointer-events: none;
1699
+ transition: opacity
1700
+ var(--stuic-field-single-asset-transition, var(--stuic-transition));
1701
+ }
1702
+ .stuic-field-single-asset-tile:hover .stuic-field-single-asset-actions,
1703
+ .stuic-field-single-asset-tile:focus-within .stuic-field-single-asset-actions,
1704
+ .stuic-field-single-asset[data-state="error"] .stuic-field-single-asset-actions {
1705
+ opacity: 1;
1706
+ pointer-events: auto;
1707
+ }
1708
+ @media (hover: none) {
1709
+ .stuic-field-single-asset-actions {
1710
+ opacity: 1;
1711
+ pointer-events: auto;
1712
+ }
1713
+ }
1714
+ .stuic-field-single-asset-control {
1715
+ display: grid;
1716
+ place-content: center;
1717
+ padding: calc(var(--spacing) * 1);
1718
+ border-radius: var(
1719
+ --stuic-field-single-asset-control-radius,
1720
+ var(--stuic-radius-button)
1721
+ );
1722
+ background: var(--stuic-field-single-asset-control-bg);
1723
+ color: var(--stuic-field-single-asset-control-text);
1724
+ cursor: pointer;
1725
+ transition: background-color
1726
+ var(--stuic-field-single-asset-transition, var(--stuic-transition));
1727
+ }
1728
+ .stuic-field-single-asset-control:hover {
1729
+ background: var(--stuic-field-single-asset-control-bg-hover);
1730
+ }
1731
+ .stuic-field-single-asset-control:focus-visible {
1732
+ outline: 2px solid var(--stuic-color-ring);
1733
+ outline-offset: 1px;
1734
+ }
1735
+
1736
+ .stuic-field-single-asset-meta {
1737
+ color: var(--stuic-field-single-asset-meta-text);
1738
+ }
1739
+ .stuic-field-single-asset-undo {
1740
+ display: inline-flex;
1741
+ align-items: center;
1742
+ gap: calc(var(--spacing) * 1);
1743
+ margin-left: calc(var(--spacing) * 2);
1744
+ color: var(--stuic-color-foreground);
1745
+ text-decoration: underline;
1746
+ text-underline-offset: 2px;
1747
+ cursor: pointer;
1748
+ }
1749
+ .stuic-field-single-asset-undo:focus-visible {
1750
+ outline: 2px solid var(--stuic-color-ring);
1751
+ outline-offset: 2px;
1752
+ border-radius: var(
1753
+ --stuic-field-single-asset-control-radius,
1754
+ var(--stuic-radius-button)
1755
+ );
1756
+ }
1757
+ }