@apliteni/apliteni-ui 0.174.0 → 0.175.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.
@@ -1153,9 +1153,14 @@ a chosen or dropped file through `onFile` and renders the `file` you provide. **
1153
1153
  `status` is uploading**, so the kit never reports success unless you claim it. **A status the
1154
1154
  row draws includes a circled mark and a word**, because colour alone does not show status. When
1155
1155
  `progress` is provided, the track shows the status instead. `Remove` and `Retry` appear only
1156
- when you provide `onRemove` and `onRetry`. **No tier ever takes a second line:** the name
1157
- truncates its stem but keeps its extension. The full name is in a `title`. **One layout serves
1158
- every width.** **The drop target is painted only while a file is over the region. It covers
1156
+ when you provide `onRemove` and `onRetry`. **A file keeps the resting row's 32px height:** the
1157
+ name, the size, and the status or the track stand on one line, and `Remove` ends it. The track
1158
+ fills the free room on the line. The name gives way first: it truncates its stem but keeps its
1159
+ extension, and the full name is in a `title`. **One layout serves every width.** In a row of
1160
+ 352px or less, the size leaves the line, and a screen reader still reads it. A refused file
1161
+ shows its reason on the name's line. When the full name and the reason do not fit there, the
1162
+ reason moves under the name and the row grows by one line, to 61px. In a parent that sizes to its
1163
+ content, `FileDrop` is 420px wide, or narrower when the parent has less room. **The drop target is painted only while a file is over the region. It covers
1159
1164
  that region instead of joining it**, so the row stays in place while the reader aims. Children
1160
1165
  render above the row inside the same region. This lets one panel, or a whole page, become the
1161
1166
  target. A disabled drop never calls `preventDefault` on `dragover`, so it does not declare
@@ -10,9 +10,9 @@
10
10
 
11
11
  **Do:** Put an Upload button and “PDF or CSV, up to 10 MB” on one line above the list they feed.
12
12
 
13
- **Don't:** Draw a tall dashed box with a glyph, an invitation and a button stacked inside it.
13
+ **Don't:** Draw a tall dashed box that stacks a glyph, an invitation and a button.
14
14
 
15
- **Except:** A page that exists to receive one file may use the field-sized picker, which has its own label. An empty page may show a dashed drop area until the first file arrives.
15
+ **Except:** A page that only receives one file may use the labelled field-sized picker. An empty page may show a dashed drop area until the first file arrives.
16
16
 
17
17
  ## Paint the target only while a file is over it
18
18
 
@@ -22,7 +22,7 @@
22
22
 
23
23
  **Why:** A target drawn before there is a file to catch covers content the reader still needs.
24
24
 
25
- **Do:** Cover the panel that accepts the file the moment the file crosses it.
25
+ **Do:** Cover the accepting panel as the file crosses it.
26
26
 
27
27
  **Don't:** Cover the whole window when one panel accepts the file.
28
28
 
@@ -32,25 +32,29 @@
32
32
 
33
33
  <!-- rule: in-the-row -->
34
34
 
35
- **Rule:** After the drop, the file's name, size and progress take the place the button was in, with remove on the name's line.
35
+ **Rule:** After the drop, the file's name, size and progress stand on one line where the button was, and remove ends it.
36
36
 
37
- **Why:** A row that changes in place keeps the page still during the upload.
37
+ **Why:** A row that keeps its height keeps the page still during the upload.
38
38
 
39
- **Do:** Put remove at the end of the name's line, the size under it, and the progress track below both.
39
+ **Do:** Put the name, the size and a track filling the free room on one line, then remove.
40
40
 
41
- **Don't:** Push the list down with a progress card, or open a dialog over the page.
41
+ **Don't:** Put the size or track under the name, or push the list down with a progress card.
42
+
43
+ **Except:** A narrow row drops the size, and cuts the name first but keeps its extension.
42
44
 
43
45
  ## Fail in place
44
46
 
45
47
  <!-- rule: failure -->
46
48
 
47
- **Rule:** A refused file keeps its place, says what it did wrong under its name, and offers Retry beside Remove.
49
+ **Rule:** A refused file keeps its place, says what went wrong on its name's line, and offers Retry beside Remove.
48
50
 
49
51
  **Why:** A row that drops the file sends the reader back to choosing one.
50
52
 
51
- **Do:** Keep the name on its line and say “Larger than 10 MB” under it, with Retry.
53
+ **Do:** Say “Larger than 10 MB” beside the name, with Retry.
54
+
55
+ **Except:** A reason that does not fit beside the name moves under it.
52
56
 
53
- **Don't:** Replace the row with “Upload failed”, losing both the file and the retry.
57
+ **Don't:** Replace the row with “Upload failed”, losing the file and the retry.
54
58
 
55
59
  ## Offer a button, not only a drag
56
60
 
@@ -60,7 +64,7 @@
60
64
 
61
65
  **Why:** A keyboard cannot drag a file.
62
66
 
63
- **Do:** Make the Upload button the control, reachable by keyboard and showing the focus ring.
67
+ **Do:** Make Upload the control, reachable by keyboard, with the focus ring.
64
68
 
65
69
  **Don't:** Write “Drag a file here” with nothing to press.
66
70
 
@@ -72,7 +76,7 @@
72
76
 
73
77
  **Why:** Repeated limits teach the reader to skip them.
74
78
 
75
- **Do:** Write “PDF or CSV, up to 10 MB” beside the button, and let a failure say what this file did wrong.
79
+ **Do:** Write “PDF or CSV, up to 10 MB” beside the button, and let a failure name this file's fault.
76
80
 
77
81
  **Don't:** Repeat the limits under the button, in a tooltip and again in the error.
78
82
 
@@ -86,4 +90,4 @@
86
90
 
87
91
  **Do:** Take a statement into the row under the statements it joins.
88
92
 
89
- **Don't:** Open a dialog for one file that the row behind it could have taken.
93
+ **Don't:** Open a dialog for one file the row could take.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apliteni/apliteni-ui",
3
- "version": "0.174.0",
3
+ "version": "0.175.0",
4
4
  "workspaces": [
5
5
  "react"
6
6
  ],
@@ -915,6 +915,10 @@
915
915
  .ui-drop {
916
916
  position: relative;
917
917
  }
918
+ .ui-drop:not(.ui-drop--area) {
919
+ display: grid;
920
+ grid-template-columns: minmax(0, 1fr);
921
+ }
918
922
  .ui-drop > * + .ui-drop__row {
919
923
  margin-top: var(--space-3);
920
924
  }
@@ -927,27 +931,36 @@
927
931
  font-size: var(--text-sm);
928
932
  color: var(--text);
929
933
  overflow-wrap: anywhere;
934
+ container-type: inline-size;
935
+ contain-intrinsic-inline-size: var(--panel-md);
930
936
  }
931
937
  .ui-drop__note {
932
938
  margin: 0;
933
939
  }
934
940
  .ui-drop__file {
935
- display: grid;
941
+ display: flex;
936
942
  flex: 1 1 auto;
937
- gap: var(--space-2);
943
+ align-items: flex-start;
944
+ gap: var(--space-3);
938
945
  min-width: 0;
939
946
  }
940
947
  .ui-drop__line {
941
948
  display: flex;
949
+ flex: 1 1 0;
942
950
  flex-wrap: nowrap;
943
951
  align-items: center;
944
- gap: var(--space-3);
952
+ gap: var(--space-2) var(--space-3);
945
953
  min-width: 0;
946
954
  }
955
+ .ui-drop__file--failed .ui-drop__line {
956
+ flex-wrap: wrap;
957
+ }
947
958
  .ui-drop__name {
948
959
  display: flex;
949
- flex: 1 1 auto;
960
+ flex: 0 999 auto;
961
+ align-items: center;
950
962
  min-width: var(--space-10);
963
+ min-height: var(--space-8);
951
964
  color: var(--strong);
952
965
  font-weight: var(--weight-medium);
953
966
  }
@@ -958,13 +971,7 @@
958
971
  }
959
972
  .ui-drop__ext {
960
973
  flex: none;
961
- }
962
- .ui-drop__facts {
963
- display: flex;
964
- flex-wrap: nowrap;
965
- align-items: center;
966
- gap: var(--space-3);
967
- min-width: 0;
974
+ white-space: nowrap;
968
975
  }
969
976
  .ui-drop__size {
970
977
  flex: none;
@@ -977,12 +984,27 @@
977
984
  flex: 0 1 auto;
978
985
  min-width: 0;
979
986
  }
987
+ @container (width <= 352px) {
988
+ .ui-drop__size {
989
+ position: absolute;
990
+ width: 1px;
991
+ height: 1px;
992
+ padding: 0;
993
+ overflow: hidden;
994
+ clip-path: inset(50%);
995
+ white-space: nowrap;
996
+ }
997
+ }
980
998
  .ui-drop__state {
981
999
  display: inline-flex;
982
- flex: 0 1 auto;
1000
+ flex: none;
983
1001
  align-items: center;
984
1002
  gap: var(--space-2);
985
1003
  min-width: 0;
1004
+ max-width: calc(100% - var(--space-10) - var(--space-3));
1005
+ }
1006
+ .ui-drop__file--failed .ui-drop__state {
1007
+ max-width: 100cqw;
986
1008
  }
987
1009
  .ui-drop__state svg {
988
1010
  width: 16px;
@@ -1002,7 +1024,8 @@
1002
1024
  }
1003
1025
  .ui-drop__bar {
1004
1026
  display: block;
1005
- width: 100%;
1027
+ flex: 1 1 0;
1028
+ min-width: var(--space-12);
1006
1029
  height: 6px;
1007
1030
  border-radius: var(--radius-pill);
1008
1031
  background: var(--surface-2);
@@ -4291,46 +4291,44 @@ function FileDrop({
4291
4291
  /* @__PURE__ */ jsx36("span", { className: "ui-drop__stem", children: stem }),
4292
4292
  /* @__PURE__ */ jsx36("span", { className: "ui-drop__ext", children: ext })
4293
4293
  ] }),
4294
- (onRemove || status === "error" && onRetry) && /* @__PURE__ */ jsxs32("span", { className: "ui-drop__actions", children: [
4295
- status === "error" && onRetry && /* @__PURE__ */ jsx36(Button, { size: "sm", icon: "refresh", onClick: onRetry, disabled, children: retryLabel }),
4296
- onRemove && /* @__PURE__ */ jsx36(
4297
- Button,
4298
- {
4299
- variant: "ghost",
4300
- size: "sm",
4301
- onClick: onRemove,
4302
- disabled,
4303
- children: removeLabel
4304
- }
4305
- )
4306
- ] })
4307
- ] }),
4308
- (showSize || showWord) && /* @__PURE__ */ jsxs32(
4309
- "div",
4310
- {
4311
- className: cx7("ui-drop__facts", status === "error" && "ui-drop__error"),
4312
- role: status === "error" ? "alert" : void 0,
4313
- children: [
4314
- showSize && /* @__PURE__ */ jsx36("span", { className: "ui-drop__size", children: file.size }),
4315
- showWord && /* @__PURE__ */ jsxs32("span", { className: "ui-drop__state", children: [
4294
+ showSize && /* @__PURE__ */ jsx36("span", { className: "ui-drop__size", children: file.size }),
4295
+ showWord && /* @__PURE__ */ jsxs32(
4296
+ "span",
4297
+ {
4298
+ className: cx7("ui-drop__state", status === "error" && "ui-drop__error"),
4299
+ role: status === "error" ? "alert" : void 0,
4300
+ children: [
4316
4301
  /* @__PURE__ */ jsx36(Icon, { name: MARKS[status] }),
4317
4302
  /* @__PURE__ */ jsx36("span", { className: "ui-drop__word", title: word, children: word })
4318
- ] })
4319
- ]
4320
- }
4321
- ),
4322
- hasBar && /* @__PURE__ */ jsx36(
4323
- "span",
4324
- {
4325
- className: "ui-drop__bar",
4326
- role: "progressbar",
4327
- "aria-label": `${word} ${file.name}`,
4328
- "aria-valuenow": file.progress,
4329
- "aria-valuemin": 0,
4330
- "aria-valuemax": 100,
4331
- children: /* @__PURE__ */ jsx36("span", { style: { width: `${file.progress}%` } })
4332
- }
4333
- )
4303
+ ]
4304
+ }
4305
+ ),
4306
+ hasBar && /* @__PURE__ */ jsx36(
4307
+ "span",
4308
+ {
4309
+ className: "ui-drop__bar",
4310
+ role: "progressbar",
4311
+ "aria-label": `${word} ${file.name}`,
4312
+ "aria-valuenow": file.progress,
4313
+ "aria-valuemin": 0,
4314
+ "aria-valuemax": 100,
4315
+ children: /* @__PURE__ */ jsx36("span", { style: { width: `${file.progress}%` } })
4316
+ }
4317
+ )
4318
+ ] }),
4319
+ (onRemove || status === "error" && onRetry) && /* @__PURE__ */ jsxs32("span", { className: "ui-drop__actions", children: [
4320
+ status === "error" && onRetry && /* @__PURE__ */ jsx36(Button, { size: "sm", icon: "refresh", onClick: onRetry, disabled, children: retryLabel }),
4321
+ onRemove && /* @__PURE__ */ jsx36(
4322
+ Button,
4323
+ {
4324
+ variant: "ghost",
4325
+ size: "sm",
4326
+ onClick: onRemove,
4327
+ disabled,
4328
+ children: removeLabel
4329
+ }
4330
+ )
4331
+ ] })
4334
4332
  ] }) : /* @__PURE__ */ jsxs32(Fragment17, { children: [
4335
4333
  /* @__PURE__ */ jsx36(
4336
4334
  Button,
@@ -2,6 +2,11 @@
2
2
  * why: docs/components.md#react-file-drop */
3
3
  .ui-drop { position: relative; }
4
4
 
5
+ /* The row is a size container, so its content gives it no width. In a parent
6
+ that sizes to its content, the drop takes the row's stated width at most,
7
+ and less when the parent has less room. */
8
+ .ui-drop:not(.ui-drop--area) { display: grid; grid-template-columns: minmax(0, 1fr); }
9
+
5
10
  /* What the region accepts the file for, above the control. */
6
11
  .ui-drop > * + .ui-drop__row { margin-top: var(--space-3); }
7
12
 
@@ -16,46 +21,69 @@
16
21
  font-size: var(--text-sm);
17
22
  color: var(--text);
18
23
  overflow-wrap: anywhere;
24
+ /* The size query below reads the row's own width, not the window's. */
25
+ container-type: inline-size;
26
+ /* The width the row asks of a parent that sizes to its content: wider than
27
+ the size's 352px step, so a lone row still shows the size. */
28
+ contain-intrinsic-inline-size: var(--panel-md);
19
29
  }
20
30
 
21
31
  .ui-drop__note { margin: 0; }
22
32
 
23
- /* The file in hand is a stack, not a line: the name owns the top tier, what the
24
- page has a rule about sits under it, and the track runs the width below both.
25
- One line asked to carry all three truncates the name to nothing at 320. */
26
- .ui-drop__file { display: grid; flex: 1 1 auto; gap: var(--space-2); min-width: 0; }
33
+ /* The file in hand is one line at the resting row's height: the name, then what
34
+ the page has a rule about, then the actions. A file arriving moves nothing
35
+ under the row. */
36
+ .ui-drop__file { display: flex; flex: 1 1 auto; align-items: flex-start; gap: var(--space-3); min-width: 0; }
37
+
38
+ /* The name's line: the name, the size, and the status or the track. It never
39
+ wraps while the file uploads, so the name gives way by truncating. */
40
+ .ui-drop__line { display: flex; flex: 1 1 0; flex-wrap: nowrap; align-items: center; gap: var(--space-2) var(--space-3); min-width: 0; }
27
41
 
28
- /* The name tier. Never wraps: the actions stay on the name's line at every
29
- width, and the name gives way to them by truncating. */
30
- .ui-drop__line { display: flex; flex-wrap: nowrap; align-items: center; gap: var(--space-3); min-width: 0; }
42
+ /* A refused file's reason stands on the name's line while the full name and the
43
+ reason fit beside each other. When they do not, the reason takes a line of its
44
+ own under the name, and only then does the row grow. */
45
+ .ui-drop__file--failed .ui-drop__line { flex-wrap: wrap; }
31
46
 
32
47
  /* The extension is the half that says what kind of file this is, so the stem
33
- gives way and the tail never does — `frankfurt-settlement-state….pdf`, the
34
- way Finder, Drive and Dropbox cut a name. */
35
- .ui-drop__name { display: flex; flex: 1 1 auto; min-width: var(--space-10); color: var(--strong); font-weight: var(--weight-medium); }
48
+ gives way and the tail never does: `frankfurt-settlement-state….pdf`, the
49
+ way Finder, Drive and Dropbox cut a name. The name gives way before anything
50
+ else on its line, and it is as tall as the actions, so the actions close the
51
+ name's line when the reason sits under it. */
52
+ .ui-drop__name { display: flex; flex: 0 999 auto; align-items: center; min-width: var(--space-10); min-height: var(--space-8); color: var(--strong); font-weight: var(--weight-medium); }
36
53
  .ui-drop__stem { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
37
- .ui-drop__ext { flex: none; }
54
+ .ui-drop__ext { flex: none; white-space: nowrap; }
38
55
 
39
- /* The facts tier: the size while it uploads, the message when it fails. Never
40
- wraps either — a second tier of text here would be a third tier on the row. */
41
- .ui-drop__facts { display: flex; flex-wrap: nowrap; align-items: center; gap: var(--space-3); min-width: 0; }
42
56
  .ui-drop__size { flex: none; white-space: nowrap; }
43
57
  .ui-drop__word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; min-width: 0; }
44
58
 
59
+ /* At a row of 352px or less, the size would cut the name to a few letters, so
60
+ it leaves the line. A screen reader still reads it, in the row's order. */
61
+ @container (width <= 352px) {
62
+ .ui-drop__size { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
63
+ }
64
+
45
65
  /* A status the track does not already draw is a circled mark and a word,
46
- because colour alone is not a status. */
47
- .ui-drop__state { display: inline-flex; flex: 0 1 auto; align-items: center; gap: var(--space-2); min-width: 0; }
66
+ because colour alone is not a status. It keeps its width while the name can
67
+ still give way, so it never shrinks first: it is cut only past the name's
68
+ own floor and the gap beside it. */
69
+ .ui-drop__state { display: inline-flex; flex: none; align-items: center; gap: var(--space-2); min-width: 0; max-width: calc(100% - var(--space-10) - var(--space-3)); }
70
+
71
+ /* A reason under the name has the row to itself, so it runs under the actions
72
+ too, as wide as the row. */
73
+ .ui-drop__file--failed .ui-drop__state { max-width: 100cqw; }
48
74
  .ui-drop__state svg { width: 16px; height: 16px; flex: none; stroke-width: 2.4; }
49
75
  .ui-drop__error { color: var(--pink); }
50
76
 
51
77
  /* Closes the name's line on the edge the content ends on, in every state. */
52
78
  .ui-drop__actions { display: flex; flex: none; align-items: stretch; gap: var(--space-2); margin-left: auto; } /* stretch: a small button sizes to its content, so a glyph and a bare label differ by 1px. #768 */
53
79
 
54
- /* The width of the row it reports on, so 40% reads as 40% rather than as a dash.
80
+ /* The track fills the room the name and the size leave on the line, and keeps
81
+ a length that still reads as a share of a whole when the name is cut.
55
82
  The ground is the kit's token for sunken tracks; --surface-3 was invisible. */
56
83
  .ui-drop__bar {
57
84
  display: block;
58
- width: 100%;
85
+ flex: 1 1 0;
86
+ min-width: var(--space-12);
59
87
  height: 6px;
60
88
  border-radius: var(--radius-pill);
61
89
  background: var(--surface-2); /* code-bg: inherit — a progress track holds no focus target. */