@apliteni/apliteni-ui 0.159.0 → 0.161.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.
- package/docs/components.md +33 -1
- package/guidelines/dense-tables.md +2 -2
- package/package.json +1 -1
- package/react/dist/index.d.ts +8 -1
- package/react/dist/index.js +284 -140
- package/src/styles/button.css +79 -5
- package/src/styles/table.css +41 -26
package/src/styles/button.css
CHANGED
|
@@ -3,8 +3,18 @@
|
|
|
3
3
|
* (sizes: xs / sm / md / lg, [icon], [disabled], [aria-busy])
|
|
4
4
|
* ========================================================================== */
|
|
5
5
|
|
|
6
|
+
:root {
|
|
7
|
+
/* The md padding and edge. The button and --btn-height-md both read them. */
|
|
8
|
+
--btn-pad-y-md: 9px;
|
|
9
|
+
--btn-edge-width: 1px;
|
|
10
|
+
/* The outer height of an md button: one line of --text-sm, the md padding and
|
|
11
|
+
the edge on each side. A part that takes a button's place uses it, so the
|
|
12
|
+
row keeps its height. */
|
|
13
|
+
--btn-height-md: calc(var(--text-sm) * var(--leading-tight) + 2 * var(--btn-pad-y-md) + 2 * var(--btn-edge-width));
|
|
14
|
+
}
|
|
15
|
+
|
|
6
16
|
.ui-btn {
|
|
7
|
-
--btn-pad-y:
|
|
17
|
+
--btn-pad-y: var(--btn-pad-y-md);
|
|
8
18
|
--btn-pad-x: 17px;
|
|
9
19
|
--btn-font: var(--text-sm);
|
|
10
20
|
|
|
@@ -18,10 +28,11 @@
|
|
|
18
28
|
line-height: var(--leading-tight);
|
|
19
29
|
border-radius: var(--radius-sm);
|
|
20
30
|
padding: var(--btn-pad-y) var(--btn-pad-x);
|
|
31
|
+
min-height: var(--btn-height-md);
|
|
21
32
|
cursor: pointer;
|
|
22
33
|
/* Light needs a stronger line here: --border on this fill measures 1.047:1.
|
|
23
34
|
why: docs/foundations.md#elevation */
|
|
24
|
-
border:
|
|
35
|
+
border: var(--btn-edge-width) solid var(--control-edge);
|
|
25
36
|
background: var(--surface); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */
|
|
26
37
|
color: var(--text);
|
|
27
38
|
white-space: nowrap;
|
|
@@ -86,21 +97,23 @@
|
|
|
86
97
|
}
|
|
87
98
|
|
|
88
99
|
.ui-btn--danger { color: var(--text); }
|
|
89
|
-
.ui-btn--danger:hover, .ui-btn--danger:focus-visible {
|
|
100
|
+
.ui-btn--danger:hover, .ui-btn--danger:focus-visible, .ui-btn--danger[data-holding] {
|
|
90
101
|
color: var(--pink);
|
|
91
102
|
border-color: var(--pink);
|
|
92
103
|
background: color-mix(in srgb, var(--pink) 10%, transparent); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */
|
|
93
104
|
}
|
|
105
|
+
/* A pointer hold is also a hover, so the held edge outranks the accent hover edge. */
|
|
106
|
+
.ui-btn.ui-btn--danger[data-holding]:hover { border-color: var(--pink); }
|
|
94
107
|
|
|
95
108
|
/* -- Sizes -------------------------------------------------------------- */
|
|
96
109
|
/* why: docs/components.md#extra-small-buttons */
|
|
97
110
|
.ui-btn--xs { --btn-pad-y: 4.5px; --btn-pad-x: 8px; --btn-font: var(--text-xs); min-width: 24px; min-height: 24px; }
|
|
98
111
|
.ui-btn--xs svg { width: 13px; height: 13px; stroke-width: 2.8; }
|
|
99
|
-
.ui-btn--sm { --btn-pad-y: 6px; --btn-pad-x: 12px; --btn-font: calc(var(--text-sm) - 0.5px); }
|
|
112
|
+
.ui-btn--sm { --btn-pad-y: 6px; --btn-pad-x: 12px; --btn-font: calc(var(--text-sm) - 0.5px); min-height: 0; }
|
|
100
113
|
.ui-btn--lg { --btn-pad-y: 13px; --btn-pad-x: 24px; --btn-font: var(--text-md); border-radius: var(--radius-md); }
|
|
101
114
|
|
|
102
115
|
/* Icon-only */
|
|
103
|
-
.ui-btn--icon { --btn-pad-y:
|
|
116
|
+
.ui-btn--icon { --btn-pad-y: var(--btn-pad-y-md); padding: var(--btn-pad-y-md); border-radius: var(--radius-sm); }
|
|
104
117
|
.ui-btn--icon.ui-btn--xs { --btn-pad-y: 4.5px; padding: 4.5px; }
|
|
105
118
|
.ui-btn--icon.ui-btn--sm { --btn-pad-y: 6px; padding: 6px; }
|
|
106
119
|
|
|
@@ -258,4 +271,65 @@
|
|
|
258
271
|
.ui-btn__dots i { animation: none; }
|
|
259
272
|
}
|
|
260
273
|
|
|
274
|
+
/* -- Hold to confirm ---------------------------------------------------- */
|
|
275
|
+
/* why: docs/components.md#hold-to-confirm */
|
|
276
|
+
.ui-btn[data-hold] {
|
|
277
|
+
touch-action: none;
|
|
278
|
+
user-select: none;
|
|
279
|
+
-webkit-user-select: none;
|
|
280
|
+
-webkit-touch-callout: none;
|
|
281
|
+
}
|
|
282
|
+
/* The fill is the press, so the button itself does not also sink. */
|
|
283
|
+
.ui-btn[data-hold]:active { transform: none; }
|
|
284
|
+
/* A copy of the content in the filled paint, cut from the start edge by --hold. */
|
|
285
|
+
.ui-btn__hold-fill {
|
|
286
|
+
position: absolute;
|
|
287
|
+
inset: 0;
|
|
288
|
+
display: flex;
|
|
289
|
+
align-items: center;
|
|
290
|
+
justify-content: center;
|
|
291
|
+
gap: inherit;
|
|
292
|
+
padding: inherit;
|
|
293
|
+
border-radius: inherit;
|
|
294
|
+
pointer-events: none;
|
|
295
|
+
clip-path: inset(0 calc(100% - var(--hold, 0) * 100%) 0 0);
|
|
296
|
+
transition: clip-path var(--dur-med) var(--ease-out);
|
|
297
|
+
}
|
|
298
|
+
[dir="rtl"] .ui-btn__hold-fill { clip-path: inset(0 0 0 calc(100% - var(--hold, 0) * 100%)); }
|
|
299
|
+
/* While held, the script moves the fill each frame or each step. */
|
|
300
|
+
.ui-btn[data-holding] .ui-btn__hold-fill { transition: none; }
|
|
301
|
+
.ui-btn--primary[data-holding] {
|
|
302
|
+
background: color-mix(in srgb, var(--accent) 14%, var(--surface)); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */
|
|
303
|
+
border-color: var(--accent);
|
|
304
|
+
color: var(--strong);
|
|
305
|
+
filter: none;
|
|
306
|
+
}
|
|
307
|
+
/* In light --accent is --accent-strong, so the filled primary is its resting paint. */
|
|
308
|
+
.ui-btn--primary .ui-btn__hold-fill {
|
|
309
|
+
background: var(--accent); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */
|
|
310
|
+
color: var(--accent-contrast);
|
|
311
|
+
}
|
|
312
|
+
/* White ink falls below the text floor on the lighter dark-theme accents. */
|
|
313
|
+
/* Dark is also the theme with no data-theme at all. */
|
|
314
|
+
:where(:root:not([data-theme="light"])) .ui-btn--primary .ui-btn__hold-fill { color: var(--signal-contrast); }
|
|
315
|
+
/* Quiet at rest: the pink fill shows only while the reader hovers, focuses, holds or lets it drain. */
|
|
316
|
+
.ui-btn--danger:is(:hover, :focus-visible, [data-holding], [data-hold-drain]) .ui-btn__hold-fill {
|
|
317
|
+
background: var(--pink); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */
|
|
318
|
+
color: var(--danger-contrast);
|
|
319
|
+
}
|
|
320
|
+
/* Over the button, so a row of buttons keeps its height and the button does not move. */
|
|
321
|
+
.ui-btn__hold-hint {
|
|
322
|
+
position: absolute;
|
|
323
|
+
bottom: calc(100% + var(--space-2));
|
|
324
|
+
left: 50%;
|
|
325
|
+
translate: -50% 0;
|
|
326
|
+
font-size: var(--text-sm);
|
|
327
|
+
font-weight: var(--weight-normal);
|
|
328
|
+
line-height: var(--leading-tight);
|
|
329
|
+
color: var(--text);
|
|
330
|
+
pointer-events: none;
|
|
331
|
+
visibility: hidden;
|
|
332
|
+
}
|
|
333
|
+
.ui-btn[data-hold-hint] .ui-btn__hold-hint { visibility: visible; }
|
|
334
|
+
|
|
261
335
|
@keyframes ui-spin { to { transform: rotate(360deg); } }
|
package/src/styles/table.css
CHANGED
|
@@ -58,30 +58,32 @@
|
|
|
58
58
|
.ui-table tr.is-dead td { /* muted-ink: state — revoked row */ color: var(--muted); }
|
|
59
59
|
.ui-table tbody tr { transition: background var(--dur-fast) var(--ease); }
|
|
60
60
|
|
|
61
|
-
/* Row hover:
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
61
|
+
/* Row hover: a rounded fill across the full table width. The separate border model with
|
|
62
|
+
* zero spacing lets the row ends round. The table has no side padding, so the end cells
|
|
63
|
+
* hold the room: --space-2 inside the fill at each end, header and body alike, so a
|
|
64
|
+
* column and its header share one edge. A pinned column sticks at the frame's edge with
|
|
65
|
+
* that room inside it (#736). The dense and compact variants and an end action cell
|
|
66
|
+
* keep the same room. Zebra keeps the original full-bleed tint
|
|
67
|
+
* (finance ledger) and is excluded here; its hover rule is below. why: #773 */
|
|
66
68
|
.ui-table--hover:not(.ui-table--zebra) {
|
|
67
69
|
border-collapse: separate;
|
|
68
70
|
border-spacing: 0;
|
|
69
|
-
padding: 0 var(--space-2);
|
|
70
71
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
.ui-table--hover
|
|
74
|
-
.ui-table--hover
|
|
75
|
-
.ui-table--hover:not(.ui-table--zebra) tbody tr:hover td:first-child {
|
|
72
|
+
:where(.ui-table--hover:not(.ui-table--zebra)) :is(th, td):not(.ui-table__act):first-child { padding-left: var(--space-2); }
|
|
73
|
+
:where(.ui-table--hover:not(.ui-table--zebra)) :is(th, td):not(.ui-table__act):last-child { padding-right: var(--space-2); }
|
|
74
|
+
:where(.ui-table--hover:not(.ui-table--zebra)) td.ui-table__act:last-child { padding-right: var(--space-2); }
|
|
75
|
+
.ui-table--hover:not(.ui-table--zebra) tbody tr:hover > :is(td, th):first-child {
|
|
76
76
|
border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }
|
|
77
|
-
.ui-table--hover:not(.ui-table--zebra) tbody tr:hover td:last-child {
|
|
77
|
+
.ui-table--hover:not(.ui-table--zebra) tbody tr:hover > :is(td, th):last-child {
|
|
78
78
|
border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
|
|
79
|
-
/*
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
/* A row line that met a round corner crossed it. A hovered row drops the line below it,
|
|
80
|
+
the row before it drops the line above it, and the header drops its line over the
|
|
81
|
+
first row. why: #773 */
|
|
82
|
+
.ui-table--hover:not(.ui-table--zebra) tbody tr:hover > :is(td, th),
|
|
83
|
+
.ui-table--hover:not(.ui-table--zebra) tbody tr:has(+ tr:hover) > :is(td, th),
|
|
84
|
+
.ui-table--hover:not(.ui-table--zebra) thead:has(+ tbody > tr:first-child:hover) > tr > th {
|
|
85
|
+
border-bottom-color: transparent;
|
|
86
|
+
}
|
|
85
87
|
|
|
86
88
|
/* Data-table modifiers, composable: .ui-table--dense --zebra --hover.
|
|
87
89
|
* --dense --space-3 across, --space-2 down — one step in from the base table
|
|
@@ -194,9 +196,13 @@
|
|
|
194
196
|
}
|
|
195
197
|
/* The last cell gave up its end gap above, so the link it holds gives up the same. */
|
|
196
198
|
.ui-table td.ui-table__linked:where(:last-child) > :is(a:not([class]), a.ui-identity):only-child { padding-right: 0; }
|
|
197
|
-
|
|
199
|
+
/* A hover table's end cells hold the room inside the fill, so a linked end cell's link does. */
|
|
200
|
+
:where(.ui-table--hover:not(.ui-table--zebra)) td.ui-table__linked:first-child > :is(a:not([class]), a.ui-identity):only-child { padding-left: var(--space-2); }
|
|
201
|
+
:where(.ui-table--hover:not(.ui-table--zebra)) td.ui-table__linked:last-child > :is(a:not([class]), a.ui-identity):only-child { padding-right: var(--space-2); }
|
|
198
202
|
.ui-table--dense td.ui-table__linked > :is(a:not([class]), a.ui-identity):only-child { padding: var(--space-2) var(--space-3); }
|
|
199
203
|
.ui-table--compact td.ui-table__linked > :is(a:not([class]), a.ui-identity):only-child { padding: var(--space-1) var(--space-3); }
|
|
204
|
+
:where(.ui-table--hover:not(.ui-table--zebra)):is(.ui-table--dense, .ui-table--compact) td.ui-table__linked:first-child > :is(a:not([class]), a.ui-identity):only-child { padding-left: var(--space-2); }
|
|
205
|
+
:where(.ui-table--hover:not(.ui-table--zebra)):is(.ui-table--dense, .ui-table--compact) td.ui-table__linked:last-child > :is(a:not([class]), a.ui-identity):only-child { padding-right: var(--space-2); }
|
|
200
206
|
/* Zebra insets the row's END cells only, so the fill does too: a marked identity behind a
|
|
201
207
|
selection column is a middle cell, and a step it never gave up would move its name. */
|
|
202
208
|
.ui-table--zebra td.ui-table__linked:first-child > :is(a:not([class]), a.ui-identity):only-child { padding-left: var(--space-3); }
|
|
@@ -305,23 +311,32 @@
|
|
|
305
311
|
.ui-card > .ui-table-scroll:has(> .ui-table--dense) {
|
|
306
312
|
margin-inline: calc(-1 * var(--space-4));
|
|
307
313
|
}
|
|
308
|
-
/* A hover table
|
|
309
|
-
straight in a card started 8px inside the card's text edge. #757 */
|
|
310
|
-
.ui-card > .ui-table-scroll > .ui-table--dense,
|
|
314
|
+
/* A hover table holds 8px at its ends, so a dense one hangs out by that much. why: #773 */
|
|
311
315
|
.ui-card > .ui-table--dense.ui-table--hover:not(.ui-table--zebra) {
|
|
312
|
-
|
|
316
|
+
width: calc(100% + 2 * var(--space-2));
|
|
317
|
+
margin-inline: calc(-1 * var(--space-2));
|
|
318
|
+
}
|
|
319
|
+
.ui-card--fit > .ui-table--dense.ui-table--hover:not(.ui-table--zebra) {
|
|
320
|
+
width: auto;
|
|
321
|
+
max-width: calc(100% + 2 * var(--space-2));
|
|
313
322
|
}
|
|
314
|
-
/* A hover table's
|
|
315
|
-
frame hangs out by that much and the first column meets the title.
|
|
316
|
-
|
|
323
|
+
/* A hover table's 8px end-cell room plus the frame's 4px band is one --space-3, so the
|
|
324
|
+
frame hangs out by that much and the first column meets the title. A dense zebra hover
|
|
325
|
+
table keeps the dense bleed. why: #736, #773 */
|
|
326
|
+
.ui-card > .ui-table-scroll:has(> .ui-table--hover:not(.ui-table--dense.ui-table--zebra)) {
|
|
317
327
|
margin-inline: calc(-1 * var(--space-3));
|
|
318
328
|
}
|
|
319
329
|
.ui-table td.ui-table__num { text-align: right; }
|
|
320
330
|
.ui-table--compact td,
|
|
321
331
|
.ui-table--compact :is(tbody, tfoot) th { padding: var(--space-1) var(--space-3); font-size: var(--text-sm); line-height: var(--leading-snug); height: 33px; }
|
|
322
332
|
.ui-table--compact th { padding: var(--space-2) var(--space-3); }
|
|
333
|
+
.ui-table--compact th:first-child,
|
|
334
|
+
.ui-table--compact td:first-child { padding-left: var(--space-3); }
|
|
323
335
|
.ui-table--compact th:last-child,
|
|
324
336
|
.ui-table--compact td:last-child { padding-right: var(--space-3); }
|
|
337
|
+
/* A hover table holds --space-2 inside the fill at each end, and dense and compact too. why: #773 */
|
|
338
|
+
:where(.ui-table--hover:not(.ui-table--zebra)):is(.ui-table--dense, .ui-table--compact) :is(th, td):first-child { padding-left: var(--space-2); }
|
|
339
|
+
:where(.ui-table--hover:not(.ui-table--zebra)):is(.ui-table--dense, .ui-table--compact) :is(th, td):last-child { padding-right: var(--space-2); }
|
|
325
340
|
/* Columns past the box's edge, said in paint. Two shades, one per side, under two
|
|
326
341
|
cover layers that ride the content: `local` moves a cover with the scroll, so
|
|
327
342
|
reaching an end slides that cover over its shade. A cover is solid for its first
|