lostcoords-ui 0.6.0 → 0.8.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.
- checksums.yaml +4 -4
- data/README.md +296 -27
- data/app/assets/tailwind/lostcoords/ui/card.css +11 -5
- data/app/assets/tailwind/lostcoords/ui/collapsible.css +6 -0
- data/app/assets/tailwind/lostcoords/ui/components/dialog.css +2 -2
- data/app/assets/tailwind/lostcoords/ui/components/search.css +5 -0
- data/app/assets/tailwind/lostcoords/ui/components.css +1 -0
- data/app/assets/tailwind/lostcoords/ui/core.css +2 -2
- data/app/assets/tailwind/lostcoords/ui/popover.css +6 -56
- data/app/assets/tailwind/lostcoords/ui/search.css +96 -0
- data/app/assets/tailwind/lostcoords/ui/sheet.css +42 -69
- data/app/assets/tailwind/lostcoords/ui/theme.css +18 -0
- data/app/assets/tailwind/lostcoords/ui/toast.css +34 -4
- data/app/assets/tailwind/lostcoords/ui/typography.css +10 -0
- data/app/helpers/lostcoords/ui/badge_helper.rb +20 -12
- data/app/helpers/lostcoords/ui/button_helper.rb +63 -1
- data/app/helpers/lostcoords/ui/choice_helper.rb +9 -16
- data/app/helpers/lostcoords/ui/collapsible_helper.rb +23 -4
- data/app/helpers/lostcoords/ui/dialog_helper.rb +46 -11
- data/app/helpers/lostcoords/ui/form_helper.rb +23 -10
- data/app/helpers/lostcoords/ui/glass_helper.rb +6 -0
- data/app/helpers/lostcoords/ui/layout_helper.rb +13 -5
- data/app/helpers/lostcoords/ui/list_group_helper.rb +65 -0
- data/app/helpers/lostcoords/ui/menu_helper.rb +73 -13
- data/app/helpers/lostcoords/ui/navigation_helper.rb +57 -12
- data/app/helpers/lostcoords/ui/primitives_helper.rb +112 -34
- data/app/helpers/lostcoords/ui/render_attributes_helper.rb +2 -0
- data/app/helpers/lostcoords/ui/search_helper.rb +51 -0
- data/app/helpers/lostcoords/ui/sheet_helper.rb +20 -8
- data/app/helpers/lostcoords/ui/structures_helper.rb +106 -15
- data/app/helpers/lostcoords/ui/tailwind_helper.rb +1 -1
- data/app/helpers/lostcoords/ui/toast_helper.rb +11 -4
- data/app/helpers/lostcoords/ui/typography_helper.rb +5 -3
- data/app/javascript/lostcoords/ui/controllers/lc_menu_controller.js +5 -6
- data/app/javascript/lostcoords/ui/controllers/lc_nav_controller.js +79 -0
- data/app/javascript/lostcoords/ui/controllers/lc_search_controller.js +264 -0
- data/app/javascript/lostcoords/ui/controllers/lc_selection_controller.js +3 -8
- data/app/javascript/lostcoords/ui/controllers/lc_sheet_controller.js +42 -16
- data/app/javascript/lostcoords/ui/helpers/confirm.js +57 -0
- data/app/javascript/lostcoords/ui/helpers/floating_panel.js +9 -0
- data/app/javascript/lostcoords/ui/index.js +4 -2
- data/app/views/lostcoords/ui/components/_lc_collapsible.html.erb +3 -3
- data/app/views/lostcoords/ui/components/_lc_confirm_sheet.html.erb +14 -0
- data/app/views/lostcoords/ui/components/_lc_dialog.html.erb +24 -16
- data/app/views/lostcoords/ui/components/_lc_floating_panel.html.erb +11 -6
- data/app/views/lostcoords/ui/components/_lc_search.html.erb +25 -0
- data/config/locales/en.yml +11 -0
- data/config/locales/es.yml +11 -0
- data/config/locales/ja.yml +11 -0
- data/lib/lostcoords/ui/builders.rb +1 -1
- data/lib/lostcoords/ui/form_builder.rb +59 -12
- data/lib/lostcoords/ui/parts.rb +65 -8
- data/lib/lostcoords/ui/tokens.rb +3 -1
- data/lib/lostcoords/ui/version.rb +1 -1
- metadata +10 -2
- data/app/javascript/lostcoords/ui/controllers/lc_confirm_dialog_controller.js +0 -39
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/* Closed is the exit pose, so closing animates too; allow-discrete holds
|
|
2
|
-
display/overlay until it ends. FloatingPanel
|
|
2
|
+
display/overlay until it ends. Open is FloatingPanel's [data-open] or a
|
|
3
|
+
native [popover]'s :popover-open. --lc-popover-from sets the closed pose;
|
|
4
|
+
origin-* utilities set where it grows from. */
|
|
3
5
|
@utility lc-popover-shell {
|
|
4
6
|
opacity: 0;
|
|
5
|
-
transform: translateY(--spacing(-1)) scale(0.98);
|
|
7
|
+
transform: var(--lc-popover-from, translateY(--spacing(-1)) scale(0.98));
|
|
6
8
|
pointer-events: none;
|
|
7
9
|
transition:
|
|
8
10
|
opacity 160ms var(--lc-ease-out-expo),
|
|
@@ -10,66 +12,14 @@
|
|
|
10
12
|
display 160ms allow-discrete,
|
|
11
13
|
overlay 160ms allow-discrete;
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
&:is([data-open], :popover-open) {
|
|
14
16
|
opacity: 1;
|
|
15
17
|
transform: translateY(0) scale(1);
|
|
16
18
|
pointer-events: auto;
|
|
17
19
|
|
|
18
20
|
@starting-style {
|
|
19
21
|
opacity: 0;
|
|
20
|
-
transform: translateY(--spacing(-1)) scale(0.98);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@layer components {
|
|
26
|
-
/* Desktop: the .lc-sheet becomes an anchored popover instead of a bottom sheet. */
|
|
27
|
-
@media (width >= 40rem) {
|
|
28
|
-
.lc-sheet--anchored {
|
|
29
|
-
@apply lc-popover-shell;
|
|
30
|
-
|
|
31
|
-
display: none;
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
position: absolute;
|
|
34
|
-
inset-block: calc(100% + --spacing(2)) auto;
|
|
35
|
-
inset-inline: auto 0;
|
|
36
|
-
inline-size: min(24rem, calc(100vw - --spacing(8)));
|
|
37
|
-
max-block-size: min(28rem, calc(100vh - --spacing(24)));
|
|
38
|
-
padding-block-end: 0;
|
|
39
|
-
border-radius: var(--radius-3xl);
|
|
40
|
-
pointer-events: auto;
|
|
41
|
-
|
|
42
|
-
&[data-open] {
|
|
43
|
-
display: flex;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/* Enter/exit for small overlays, whichever way they open: a [hidden] toggle
|
|
49
|
-
(amount calculator, colour picker), the Popover API (phone nav menus) or a
|
|
50
|
-
modal <dialog>. The closed state is the exit pose, so close animates too;
|
|
51
|
-
allow-discrete holds display/overlay until it ends. --lc-pop-y sets the
|
|
52
|
-
direction: popovers drop from their trigger, dialogs rise. */
|
|
53
|
-
.lc-popover-pop {
|
|
54
|
-
--lc-pop-from: translateY(var(--lc-pop-y, -0.25rem)) scale(0.96);
|
|
55
|
-
|
|
56
|
-
transform-origin: var(--lc-pop-origin, top);
|
|
57
|
-
transition:
|
|
58
|
-
opacity 160ms var(--lc-ease-out-expo),
|
|
59
|
-
transform 240ms var(--lc-ease-out-expo),
|
|
60
|
-
display 240ms allow-discrete,
|
|
61
|
-
overlay 240ms allow-discrete;
|
|
62
|
-
|
|
63
|
-
&:is([hidden], [popover]:not(:popover-open), dialog:not([open])) {
|
|
64
|
-
opacity: 0;
|
|
65
|
-
transform: var(--lc-pop-from);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
&:is(:not([hidden], [popover], dialog), :popover-open, dialog[open]) {
|
|
69
|
-
@starting-style {
|
|
70
|
-
opacity: 0;
|
|
71
|
-
transform: var(--lc-pop-from);
|
|
72
|
-
}
|
|
22
|
+
transform: var(--lc-popover-from, translateY(--spacing(-1)) scale(0.98));
|
|
73
23
|
}
|
|
74
24
|
}
|
|
75
25
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* lc_search: a pill trigger that opens a full-screen search over a
|
|
2
|
+
blurred page. The controller animates it open and closed. */
|
|
3
|
+
@layer components {
|
|
4
|
+
.lc-search-trigger {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: var(--spacing-related);
|
|
8
|
+
min-block-size: var(--spacing-control-sm);
|
|
9
|
+
padding-inline: var(--spacing-heading);
|
|
10
|
+
border: 0;
|
|
11
|
+
border-radius: var(--radius-pill);
|
|
12
|
+
background: var(--muted);
|
|
13
|
+
color: var(--muted-foreground);
|
|
14
|
+
font-size: var(--text-label);
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
transition: background-color var(--lc-motion-control), color var(--lc-motion-control);
|
|
17
|
+
|
|
18
|
+
&:hover { background: var(--accent); color: var(--foreground); }
|
|
19
|
+
|
|
20
|
+
/* The bar grows out of the trigger, so the trigger steps aside while search is open. */
|
|
21
|
+
[data-slot="search"][data-open] & { opacity: 0; }
|
|
22
|
+
|
|
23
|
+
@media (width < 40rem) {
|
|
24
|
+
justify-content: center;
|
|
25
|
+
inline-size: var(--spacing-control-sm);
|
|
26
|
+
padding-inline: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@media (width >= 40rem) { inline-size: calc(var(--spacing) * 64); }
|
|
30
|
+
@media (width >= 80rem) { inline-size: calc(var(--spacing) * 84); }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.lc-search {
|
|
34
|
+
position: fixed;
|
|
35
|
+
inset: 0;
|
|
36
|
+
inline-size: 100%;
|
|
37
|
+
max-inline-size: none;
|
|
38
|
+
block-size: 100%;
|
|
39
|
+
max-block-size: none;
|
|
40
|
+
margin: 0;
|
|
41
|
+
padding: 0;
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
border: 0;
|
|
44
|
+
background: transparent;
|
|
45
|
+
color: var(--foreground);
|
|
46
|
+
|
|
47
|
+
/* Safari drops custom properties inside -webkit-backdrop-filter, so the blur is literal. */
|
|
48
|
+
&::backdrop {
|
|
49
|
+
background: var(--lc-scrim-veil);
|
|
50
|
+
-webkit-backdrop-filter: blur(20px) saturate(160%);
|
|
51
|
+
backdrop-filter: blur(20px) saturate(160%);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
55
|
+
&::backdrop {
|
|
56
|
+
background: var(--background);
|
|
57
|
+
-webkit-backdrop-filter: none;
|
|
58
|
+
backdrop-filter: none;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Rows and groups carry display utilities, which outrank this layer unless it is important. */
|
|
63
|
+
[hidden] { display: none !important; }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.lc-search-stack {
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
gap: var(--spacing-heading);
|
|
70
|
+
inline-size: min(calc(var(--spacing) * 160), calc(100% - var(--spacing) * 6));
|
|
71
|
+
block-size: 100%;
|
|
72
|
+
margin-inline: auto;
|
|
73
|
+
padding-block:
|
|
74
|
+
max(var(--spacing-heading), env(safe-area-inset-top))
|
|
75
|
+
max(var(--spacing-heading), env(safe-area-inset-bottom));
|
|
76
|
+
|
|
77
|
+
@media (width >= 40rem) { padding-block-start: 14vh; }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.lc-search-input::-webkit-search-cancel-button {
|
|
81
|
+
/* stylelint-disable-next-line property-no-vendor-prefix -- The clear button has an accessible label. */
|
|
82
|
+
-webkit-appearance: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.lc-search-panel {
|
|
86
|
+
--lc-glass-fill: color-mix(in oklab, var(--background) 82%, transparent);
|
|
87
|
+
|
|
88
|
+
@media (width >= 40rem) { max-block-size: min(60dvh, calc(var(--spacing) * 136)); }
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.lc-search-result {
|
|
92
|
+
color: var(--foreground);
|
|
93
|
+
|
|
94
|
+
&:is(:hover, :focus-visible) { background: color-mix(in oklab, var(--foreground) 6%, transparent); }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -1,67 +1,10 @@
|
|
|
1
1
|
@layer components {
|
|
2
2
|
@media (width < 40rem) {
|
|
3
|
-
.lc-sheet {
|
|
4
|
-
position: fixed;
|
|
5
|
-
|
|
6
|
-
/* Anchored from the top edge at the screen height it opened at
|
|
7
|
-
(lc-sheet), then lifted by its own height. In-app browsers
|
|
8
|
-
(Brave, Chrome) resize the page under the keyboard; anything hung
|
|
9
|
-
from the bottom edge jumps a frame as they do, but the top holds. */
|
|
10
|
-
inset: var(--lc-sheet-floor, 100dvh) 0 auto;
|
|
11
|
-
translate: 0 -100%;
|
|
12
|
-
margin: 0;
|
|
13
|
-
inline-size: 100%;
|
|
14
|
-
max-block-size: calc(var(--lc-sheet-floor, 100dvh) * 0.9);
|
|
15
|
-
overflow-y: auto;
|
|
16
|
-
overscroll-behavior: contain;
|
|
17
|
-
padding-block-end: max(env(safe-area-inset-bottom), 1rem);
|
|
18
|
-
border: 1px solid var(--lc-glass-edge);
|
|
19
|
-
border-start-start-radius: var(--radius-3xl);
|
|
20
|
-
border-start-end-radius: var(--radius-3xl);
|
|
21
|
-
|
|
22
|
-
/* Published as a variable, not just applied, because the sticky chrome
|
|
23
|
-
that rides on top of the sheet — the grabber bar, the pinned action
|
|
24
|
-
row — has to paint the *same* surface or it reads as a seam. In dark
|
|
25
|
-
mode the sheet is a lightened paper-2/paper-3 mix while --background is
|
|
26
|
-
0.045 lightness darker, which is exactly the band you could see. */
|
|
27
|
-
--lc-sheet-bg: var(--background);
|
|
28
|
-
@supports (background: light-dark(white, black)) {
|
|
29
|
-
--lc-sheet-bg: light-dark(var(--background), color-mix(in oklab, var(--muted) 92%, var(--accent)));
|
|
30
|
-
}
|
|
31
|
-
background: var(--lc-sheet-bg);
|
|
32
|
-
color: var(--foreground);
|
|
33
|
-
box-shadow: 0 -12px 40px -12px color-mix(in oklab, var(--foreground) 45%, transparent);
|
|
34
|
-
transform: translateY(var(--lc-sheet-offscreen));
|
|
35
|
-
transition:
|
|
36
|
-
transform var(--lc-sheet-duration) var(--lc-ease-sheet),
|
|
37
|
-
display var(--lc-sheet-duration) allow-discrete,
|
|
38
|
-
overlay var(--lc-sheet-duration) allow-discrete;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/* Popover-API reveal (currency): top layer drives display, so showPopover()/
|
|
42
|
-
hidePopover() animate the slide both ways, with a native ::backdrop. */
|
|
43
|
-
.lc-sheet[popover] { display: none; flex-direction: column; max-block-size: min(calc(var(--lc-sheet-floor, 100svh) * 0.72), 34rem); }
|
|
44
|
-
.lc-sheet[popover]:popover-open {
|
|
45
|
-
display: flex;
|
|
46
|
-
transform: translateY(0);
|
|
47
|
-
|
|
48
|
-
@starting-style { transform: translateY(var(--lc-sheet-offscreen)); }
|
|
49
|
-
}
|
|
50
|
-
.lc-sheet[popover]::backdrop {
|
|
51
|
-
background: var(--lc-scrim);
|
|
52
|
-
backdrop-filter: blur(2px);
|
|
53
|
-
opacity: 0;
|
|
54
|
-
transition:
|
|
55
|
-
opacity var(--lc-sheet-duration) var(--lc-ease-sheet),
|
|
56
|
-
display var(--lc-sheet-duration) allow-discrete,
|
|
57
|
-
overlay var(--lc-sheet-duration) allow-discrete;
|
|
58
|
-
|
|
59
|
-
@media (prefers-reduced-motion: reduce) { transition: none; }
|
|
60
|
-
}
|
|
61
|
-
.lc-sheet[popover]:popover-open::backdrop { opacity: 1; @starting-style { opacity: 0; } }
|
|
62
|
-
|
|
63
3
|
/* UIKit's 36×5 grabber. */
|
|
64
|
-
:is(
|
|
4
|
+
:is(
|
|
5
|
+
[data-lc-sheet-target~="handle"],
|
|
6
|
+
:is(dialog[data-controller~="lc-sheet"], .lc-sheet):not(:has([data-lc-sheet-target~="handle"]))
|
|
7
|
+
)::before {
|
|
65
8
|
content: "";
|
|
66
9
|
display: block;
|
|
67
10
|
inline-size: 2.25rem;
|
|
@@ -70,15 +13,37 @@
|
|
|
70
13
|
background: color-mix(in oklab, var(--muted-foreground) 45%, transparent);
|
|
71
14
|
}
|
|
72
15
|
}
|
|
16
|
+
|
|
17
|
+
/* From sm up an anchored sheet is a popover under its trigger, opened by a
|
|
18
|
+
FloatingPanel ([data-open]); the positioned ancestor is the caller's. */
|
|
19
|
+
@media (width >= 40rem) {
|
|
20
|
+
.lc-sheet-anchored {
|
|
21
|
+
@apply lc-popover-shell;
|
|
22
|
+
|
|
23
|
+
display: none;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
position: absolute;
|
|
26
|
+
inset-block: calc(100% + --spacing(2)) auto;
|
|
27
|
+
inset-inline: auto 0;
|
|
28
|
+
z-index: var(--lc-z-popover);
|
|
29
|
+
inline-size: min(24rem, calc(100vw - --spacing(8)));
|
|
30
|
+
max-block-size: min(28rem, calc(100vh - --spacing(24)));
|
|
31
|
+
border-radius: var(--radius-3xl);
|
|
32
|
+
|
|
33
|
+
&[data-open] { display: flex; }
|
|
34
|
+
}
|
|
35
|
+
}
|
|
73
36
|
}
|
|
74
37
|
|
|
75
38
|
@layer modules {
|
|
76
|
-
/* Phones: every modal dialog is an iOS sheet (lc-sheet)
|
|
77
|
-
inset with all corners round while it is short,
|
|
78
|
-
edges as it reaches the large detent: --lc-sheet-p
|
|
79
|
-
Lives in this layer so it out-ranks a
|
|
39
|
+
/* Phones: every modal dialog is an iOS sheet (lc-sheet), and so is any
|
|
40
|
+
.lc-sheet panel. It floats inset with all corners round while it is short,
|
|
41
|
+
and docks to the screen edges as it reaches the large detent: --lc-sheet-p
|
|
42
|
+
runs 0 → 1 between them. Lives in this layer so it out-ranks a panel's own
|
|
43
|
+
frame. A dialog is open while [open]; a .lc-sheet while :popover-open or
|
|
44
|
+
[data-open]. */
|
|
80
45
|
@media (width < 40rem) {
|
|
81
|
-
dialog[data-controller~="lc-sheet"] {
|
|
46
|
+
:is(dialog[data-controller~="lc-sheet"], .lc-sheet) {
|
|
82
47
|
--lc-sheet-p: 0;
|
|
83
48
|
--lc-sheet-inset: 0.5rem;
|
|
84
49
|
--lc-sheet-radius: 2.25rem;
|
|
@@ -87,7 +52,7 @@
|
|
|
87
52
|
|
|
88
53
|
position: fixed;
|
|
89
54
|
|
|
90
|
-
/* Anchored from the top edge
|
|
55
|
+
/* Anchored from the top edge: the keyboard covers it and
|
|
91
56
|
nothing moves. */
|
|
92
57
|
inset: calc(var(--lc-sheet-floor, 100dvh) - var(--lc-sheet-gap)) 0 auto;
|
|
93
58
|
translate: 0 -100%;
|
|
@@ -114,7 +79,7 @@
|
|
|
114
79
|
display var(--lc-sheet-duration) allow-discrete,
|
|
115
80
|
overlay var(--lc-sheet-duration) allow-discrete;
|
|
116
81
|
|
|
117
|
-
|
|
82
|
+
&:is([open], :popover-open, .lc-sheet[data-open]) {
|
|
118
83
|
transform: none;
|
|
119
84
|
|
|
120
85
|
@starting-style { transform: translateY(var(--lc-sheet-offscreen)); }
|
|
@@ -138,7 +103,7 @@
|
|
|
138
103
|
overlay var(--lc-sheet-duration) allow-discrete;
|
|
139
104
|
}
|
|
140
105
|
|
|
141
|
-
|
|
106
|
+
&:is([open], :popover-open)::backdrop {
|
|
142
107
|
opacity: 1;
|
|
143
108
|
|
|
144
109
|
@starting-style { opacity: 0; }
|
|
@@ -149,6 +114,14 @@
|
|
|
149
114
|
}
|
|
150
115
|
}
|
|
151
116
|
|
|
117
|
+
.lc-sheet {
|
|
118
|
+
z-index: var(--lc-z-overlay);
|
|
119
|
+
display: none;
|
|
120
|
+
flex-direction: column;
|
|
121
|
+
|
|
122
|
+
&:is(:popover-open, [data-open]) { display: flex; }
|
|
123
|
+
}
|
|
124
|
+
|
|
152
125
|
/* Behind a large sheet the page shrinks back and rounds off, over black,
|
|
153
126
|
as UIKit's page sheet does; lc-sheet drives the variables. */
|
|
154
127
|
html[data-lc-sheet-page] {
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
|
|
71
71
|
@theme {
|
|
72
72
|
--font-display: var(--font-sans);
|
|
73
|
+
--font-eyebrow: var(--font-mono);
|
|
73
74
|
--font-japanese: "Hiragino Sans", "Yu Gothic", "YuGothic", "Meiryo", ui-sans-serif, system-ui, sans-serif;
|
|
74
75
|
|
|
75
76
|
/* Type roles. Each sets size, line height, tracking and weight together. */
|
|
@@ -98,6 +99,10 @@
|
|
|
98
99
|
--text-label--font-weight: 500;
|
|
99
100
|
--text-caption: 0.75rem;
|
|
100
101
|
--text-caption--line-height: 1rem;
|
|
102
|
+
--text-eyebrow: 0.75rem;
|
|
103
|
+
--text-eyebrow--line-height: 1rem;
|
|
104
|
+
--text-eyebrow--letter-spacing: 0.1em;
|
|
105
|
+
--text-eyebrow--font-weight: 500;
|
|
101
106
|
|
|
102
107
|
--container-page: 75rem;
|
|
103
108
|
--container-reading: 65ch;
|
|
@@ -136,6 +141,10 @@
|
|
|
136
141
|
--lc-z-overlay: 60;
|
|
137
142
|
--lc-z-toast: 70;
|
|
138
143
|
|
|
144
|
+
/* Distance from the screen edge to the toast region, on top of the safe area.
|
|
145
|
+
--lc-toast-offset-top and --lc-toast-offset-bottom override one edge. */
|
|
146
|
+
--lc-toast-offset: var(--lc-gutter);
|
|
147
|
+
|
|
139
148
|
--background: oklch(100% 0 0deg);
|
|
140
149
|
--foreground: oklch(23.1% 0 0deg);
|
|
141
150
|
|
|
@@ -148,6 +157,11 @@
|
|
|
148
157
|
--primary-foreground: #fff;
|
|
149
158
|
--secondary: var(--accent);
|
|
150
159
|
--secondary-foreground: var(--foreground);
|
|
160
|
+
|
|
161
|
+
/* Fields and secondary buttons inside a card. Point them at another fill when --card
|
|
162
|
+
matches --input or --secondary, or they vanish on cards. */
|
|
163
|
+
--card-input: var(--input);
|
|
164
|
+
--card-secondary: var(--secondary);
|
|
151
165
|
--muted: oklch(97.6% 0 0deg);
|
|
152
166
|
--muted-foreground: oklch(48% 0 0deg);
|
|
153
167
|
--accent: oklch(95.2% 0 0deg);
|
|
@@ -161,6 +175,9 @@
|
|
|
161
175
|
--lc-scrim: color-mix(in oklab, var(--foreground) 55%, transparent);
|
|
162
176
|
--lc-scrim-soft: color-mix(in oklab, var(--foreground) 12%, transparent);
|
|
163
177
|
--lc-scrim-sheet: rgb(0 0 0 / 0.28);
|
|
178
|
+
|
|
179
|
+
/* Behind full-screen search: a light veil, so the blurred page still shows through. */
|
|
180
|
+
--lc-scrim-veil: color-mix(in oklab, var(--background) 35%, transparent);
|
|
164
181
|
--lc-input-hover: color-mix(in oklab, var(--foreground) 13%, var(--accent));
|
|
165
182
|
|
|
166
183
|
--lc-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
|
|
@@ -211,6 +228,7 @@
|
|
|
211
228
|
|
|
212
229
|
--lc-scrim: rgb(0 0 0 / 0.6);
|
|
213
230
|
--lc-scrim-soft: rgb(0 0 0 / 0.32);
|
|
231
|
+
--lc-scrim-veil: rgb(0 0 0 / 0.4);
|
|
214
232
|
|
|
215
233
|
--lc-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.2);
|
|
216
234
|
--lc-shadow:
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
@layer components {
|
|
2
2
|
/* lc-toast-region opens it as a popover; these rules also override the
|
|
3
|
-
popover defaults, which would centre it and hide it while closed.
|
|
3
|
+
popover defaults, which would centre it and hide it while closed. A
|
|
4
|
+
mobile placement sets every edge, so it fully replaces the desktop one. */
|
|
4
5
|
.lc-toast-region {
|
|
6
|
+
--_lc-toast-top: calc(var(--lc-toast-offset-top, var(--lc-toast-offset)) + env(safe-area-inset-top));
|
|
7
|
+
--_lc-toast-bottom: calc(var(--lc-toast-offset-bottom, var(--lc-toast-offset)) + env(safe-area-inset-bottom));
|
|
8
|
+
|
|
5
9
|
position: fixed;
|
|
6
|
-
inset: auto var(--
|
|
10
|
+
inset-block: auto var(--_lc-toast-bottom);
|
|
11
|
+
inset-inline: auto var(--lc-toast-offset);
|
|
7
12
|
z-index: var(--lc-z-toast);
|
|
8
13
|
display: flex;
|
|
9
14
|
flex-direction: column;
|
|
10
15
|
align-items: flex-end;
|
|
11
16
|
gap: var(--spacing-related);
|
|
12
|
-
|
|
17
|
+
inline-size: fit-content;
|
|
18
|
+
max-inline-size: calc(100vw - var(--lc-toast-offset) * 2);
|
|
13
19
|
margin: 0;
|
|
14
20
|
padding: 0;
|
|
15
21
|
overflow: visible;
|
|
@@ -17,7 +23,31 @@
|
|
|
17
23
|
background: none;
|
|
18
24
|
color: inherit;
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
&[data-placement^="top"] { inset-block: var(--_lc-toast-top) auto; }
|
|
27
|
+
|
|
28
|
+
&[data-placement$="center"] {
|
|
29
|
+
inset-inline: var(--lc-toast-offset);
|
|
30
|
+
margin-inline: auto;
|
|
31
|
+
align-items: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media (width < 40rem) {
|
|
35
|
+
&[data-mobile-placement^="top"] { inset-block: var(--_lc-toast-top) auto; }
|
|
36
|
+
&[data-mobile-placement^="bottom"] { inset-block: auto var(--_lc-toast-bottom); }
|
|
37
|
+
|
|
38
|
+
&[data-mobile-placement$="center"] {
|
|
39
|
+
inset-inline: var(--lc-toast-offset);
|
|
40
|
+
margin-inline: auto;
|
|
41
|
+
align-items: center;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&[data-mobile-placement$="end"] {
|
|
45
|
+
inset-inline: auto var(--lc-toast-offset);
|
|
46
|
+
margin-inline: 0;
|
|
47
|
+
align-items: flex-end;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
21
51
|
&:empty { display: none; }
|
|
22
52
|
}
|
|
23
53
|
}
|
|
@@ -12,6 +12,16 @@
|
|
|
12
12
|
overflow-wrap: anywhere;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
:where(.lc-eyebrow) {
|
|
16
|
+
font-family: var(--font-eyebrow);
|
|
17
|
+
text-transform: uppercase;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:where(.lc-eyebrow):lang(ja) {
|
|
21
|
+
font-family: var(--font-sans);
|
|
22
|
+
text-transform: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
15
25
|
/* Type role utilities read --tw-tracking first, so this wins over their tracking. */
|
|
16
26
|
:where(.lc-heading, .lc-text):lang(ja) {
|
|
17
27
|
--tw-tracking: 0;
|
|
@@ -4,14 +4,15 @@ module Lostcoords::Ui
|
|
|
4
4
|
"lc-icon-badge grid place-items-center shrink-0 " \
|
|
5
5
|
"size-[var(--lc-icon-badge-size,var(--lc-icon-badge-size-default,--spacing(10)))] " \
|
|
6
6
|
"[border:var(--lc-icon-badge-border,1px_solid_transparent)] " \
|
|
7
|
-
"text-[length:var(--lc-icon-badge-font-size,var(--lc-icon-badge-
|
|
7
|
+
"text-[length:var(--lc-icon-badge-font-size,calc(var(--lc-icon-badge-size,var(--lc-icon-badge-size-default,--spacing(10)))*var(--lc-icon-badge-font-scale,var(--lc-icon-badge-font-scale-default,0.45))))] leading-none"
|
|
8
8
|
|
|
9
|
-
# Sizes set the
|
|
9
|
+
# Sizes set the defaults, so a context that pins --lc-icon-badge-size still wins and the emoji
|
|
10
|
+
# or icon follows it. --lc-icon-badge-font-scale sets the glyph's share of the badge.
|
|
10
11
|
ICON_BADGE_SIZES = {
|
|
11
|
-
sm: "[--lc-icon-badge-size-default:--spacing(6.5)] [--lc-icon-badge-font-
|
|
12
|
+
sm: "[--lc-icon-badge-size-default:--spacing(6.5)] [--lc-icon-badge-font-scale-default:0.5]",
|
|
12
13
|
md: "",
|
|
13
|
-
lg: "[--lc-icon-badge-size-default:--spacing(12)] [--lc-icon-badge-font-
|
|
14
|
-
xl: "[--lc-icon-badge-size-default:--spacing(14)] [--lc-icon-badge-font-
|
|
14
|
+
lg: "[--lc-icon-badge-size-default:--spacing(12)] [--lc-icon-badge-font-scale-default:0.5]",
|
|
15
|
+
xl: "[--lc-icon-badge-size-default:--spacing(14)] [--lc-icon-badge-font-scale-default:0.5]"
|
|
15
16
|
}.freeze
|
|
16
17
|
|
|
17
18
|
ICON_BADGE_SHAPES = { square: "lc-squircle rounded-2xl", circle: "rounded-full" }.freeze
|
|
@@ -19,16 +20,19 @@ module Lostcoords::Ui
|
|
|
19
20
|
AVATAR_BASE =
|
|
20
21
|
"lc-avatar grid place-items-center shrink-0 rounded-full font-medium tracking-[var(--lc-avatar-tracking,0.05em)] " \
|
|
21
22
|
"size-[var(--lc-avatar-size,var(--lc-avatar-size-default,--spacing(8)))] " \
|
|
22
|
-
"text-[length:var(--lc-avatar-font-size,var(--lc-avatar-
|
|
23
|
+
"text-[length:var(--lc-avatar-font-size,calc(var(--lc-avatar-size,var(--lc-avatar-size-default,--spacing(8)))*var(--lc-avatar-font-scale,var(--lc-avatar-font-scale-default,0.375))))] " \
|
|
23
24
|
"text-[color:var(--lc-avatar-color,var(--primary-foreground))] " \
|
|
24
25
|
"border-[length:var(--lc-avatar-border,0px)] border-[color:var(--lc-avatar-cutout,var(--background))]"
|
|
25
26
|
|
|
26
|
-
# Sizes set the
|
|
27
|
+
# Sizes set the defaults, so a context that pins --lc-avatar-size (a stack, a dialog) still wins
|
|
28
|
+
# and the initials follow it. --lc-avatar-font-scale sets their share of the avatar.
|
|
27
29
|
AVATAR_SIZES = {
|
|
30
|
+
xs: "[--lc-avatar-size-default:--spacing(5)] [--lc-avatar-font-scale-default:0.4]",
|
|
31
|
+
sm: "[--lc-avatar-size-default:--spacing(6.5)] [--lc-avatar-font-scale-default:0.385]",
|
|
28
32
|
md: "",
|
|
29
|
-
lg: "[--lc-avatar-size-default:--spacing(12)] [--lc-avatar-font-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
lg: "[--lc-avatar-size-default:--spacing(12)] [--lc-avatar-font-scale-default:0.333]",
|
|
34
|
+
xl: "[--lc-avatar-size-default:--spacing(24)] [--lc-avatar-font-scale-default:0.208]",
|
|
35
|
+
xxl: "[--lc-avatar-size-default:--spacing(28)] [--lc-avatar-font-scale-default:0.25]"
|
|
32
36
|
}.freeze
|
|
33
37
|
|
|
34
38
|
AVATAR_INK = "[--lc-avatar-color:var(--foreground)]"
|
|
@@ -65,6 +69,8 @@ module Lostcoords::Ui
|
|
|
65
69
|
primary: "bg-primary-soft text-primary"
|
|
66
70
|
}.freeze
|
|
67
71
|
|
|
72
|
+
BADGE_SHAPES = { rounded: "", pill: "rounded-full px-2.5" }.freeze
|
|
73
|
+
|
|
68
74
|
TOGGLE_BASE =
|
|
69
75
|
"inline-flex items-center justify-center gap-related rounded-pill " \
|
|
70
76
|
"border border-transparent bg-input " \
|
|
@@ -75,6 +81,7 @@ module Lostcoords::Ui
|
|
|
75
81
|
"aria-[current]:not-aria-[current=false]:bg-primary-soft aria-[current]:not-aria-[current=false]:border-primary " \
|
|
76
82
|
"aria-[current]:not-aria-[current=false]:text-primary aria-[current]:not-aria-[current=false]:shadow-none " \
|
|
77
83
|
"has-checked:bg-primary-soft has-checked:border-primary has-checked:text-primary has-checked:shadow-none " \
|
|
84
|
+
"aria-expanded:bg-primary-soft aria-expanded:border-primary aria-expanded:text-primary aria-expanded:shadow-none " \
|
|
78
85
|
"[&_svg]:size-[1.1em] [&_svg]:shrink-0"
|
|
79
86
|
|
|
80
87
|
TOGGLE_ACTIVE = "bg-primary-soft border-primary text-primary hover:text-primary shadow-none"
|
|
@@ -101,9 +108,10 @@ module Lostcoords::Ui
|
|
|
101
108
|
lc_tw(AVATAR_STACK_ROW, extra)
|
|
102
109
|
end
|
|
103
110
|
|
|
104
|
-
def lc_badge_class(tone: :neutral, extra: nil)
|
|
111
|
+
def lc_badge_class(tone: :neutral, shape: :rounded, extra: nil)
|
|
105
112
|
tone = lc_option!(:tone, tone, BADGE_TONES.keys)
|
|
106
|
-
|
|
113
|
+
shape = lc_option!(:shape, shape, BADGE_SHAPES.keys)
|
|
114
|
+
lc_tw(BADGE_BASE, BADGE_SHAPES.fetch(shape), BADGE_TONES.fetch(tone), extra)
|
|
107
115
|
end
|
|
108
116
|
|
|
109
117
|
def lc_toggle_class(active: false, ghost: false, size: :md, extra: nil)
|
|
@@ -33,6 +33,53 @@ module Lostcoords::Ui
|
|
|
33
33
|
destructive: "border border-transparent [--lc-button-bg:color-mix(in_oklab,var(--destructive)_60%,black)] [--lc-button-ink:#fff] bg-(--lc-button-bg) text-(--lc-button-ink) #{BUTTON_HOVER}"
|
|
34
34
|
}.freeze
|
|
35
35
|
|
|
36
|
+
BUTTON_DESTRUCTIVE_INK = "text-destructive [--lc-button-ink:var(--destructive)]"
|
|
37
|
+
|
|
38
|
+
# A tone recolours a variant without changing its emphasis, so a destructive action can stay quiet.
|
|
39
|
+
BUTTON_TONES = {
|
|
40
|
+
default: BUTTON_VARIANTS.transform_values { "" },
|
|
41
|
+
destructive: {
|
|
42
|
+
primary: "[--lc-button-bg:color-mix(in_oklab,var(--destructive)_60%,black)] [--lc-button-ink:#fff]",
|
|
43
|
+
secondary: BUTTON_DESTRUCTIVE_INK,
|
|
44
|
+
outline: "#{BUTTON_DESTRUCTIVE_INK} border-[color-mix(in_oklab,var(--destructive)_32%,var(--border))]",
|
|
45
|
+
glass: BUTTON_DESTRUCTIVE_INK,
|
|
46
|
+
ghost: "#{BUTTON_DESTRUCTIVE_INK} [--lc-button-bg:color-mix(in_oklab,var(--destructive)_12%,var(--background))]",
|
|
47
|
+
destructive: ""
|
|
48
|
+
}
|
|
49
|
+
}.freeze
|
|
50
|
+
|
|
51
|
+
SELECT_TRIGGER_BASE =
|
|
52
|
+
"inline-flex items-center justify-start gap-related min-w-0 max-w-full ps-4 pe-3 " \
|
|
53
|
+
"rounded-pill border border-transparent bg-(--lc-field-bg,var(--input)) " \
|
|
54
|
+
"font-sans text-base text-start text-foreground whitespace-nowrap no-underline cursor-pointer " \
|
|
55
|
+
"transition-[background-color,color] duration-(--lc-motion-quick) ease-(--lc-ease-out) " \
|
|
56
|
+
"not-disabled:hover:bg-(--lc-input-hover) aria-expanded:bg-(--lc-input-hover) " \
|
|
57
|
+
"disabled:cursor-not-allowed disabled:text-[color-mix(in_oklab,var(--foreground)_38%,transparent)] " \
|
|
58
|
+
"[&_svg]:block [&_svg]:shrink-0 " \
|
|
59
|
+
"[&>[data-icon=inline-end]]:ms-auto [&>[data-icon=inline-end]]:size-5 [&>[data-icon=inline-end]]:text-muted-foreground " \
|
|
60
|
+
"motion-safe:[&>[data-icon=inline-end]]:transition-transform motion-safe:[&>[data-icon=inline-end]]:duration-(--lc-motion-quick) " \
|
|
61
|
+
"aria-expanded:[&>[data-icon=inline-end]]:rotate-180"
|
|
62
|
+
|
|
63
|
+
SPLIT_BUTTON_BASE = "relative inline-flex max-w-full min-w-0 items-stretch"
|
|
64
|
+
|
|
65
|
+
SPLIT_BUTTON_ACTION = "min-w-0 flex-1 rounded-e-none border-e-0"
|
|
66
|
+
|
|
67
|
+
# The two halves press as one pill, so neither lifts on its own.
|
|
68
|
+
SPLIT_BUTTON_PART = "motion-safe:not-disabled:hover:translate-y-0 motion-safe:not-disabled:active:translate-y-0"
|
|
69
|
+
|
|
70
|
+
SPLIT_BUTTON_TOGGLE =
|
|
71
|
+
"shrink-0 px-0 rounded-s-none aria-expanded:bg-[color-mix(in_oklab,var(--lc-button-bg,var(--secondary))_94%,var(--lc-button-ink,var(--foreground)))] [&_svg]:size-4 " \
|
|
72
|
+
"motion-safe:[&_svg]:transition-transform motion-safe:[&_svg]:duration-(--lc-motion-quick) aria-expanded:[&_svg]:rotate-180"
|
|
73
|
+
|
|
74
|
+
SPLIT_BUTTON_TOGGLE_WIDTHS = {
|
|
75
|
+
sm: "w-control-sm",
|
|
76
|
+
md: "w-control-md",
|
|
77
|
+
lg: "w-control-lg"
|
|
78
|
+
}.freeze
|
|
79
|
+
|
|
80
|
+
# Outline halves already share a visible edge; filled and transparent halves draw one from their ink.
|
|
81
|
+
SPLIT_BUTTON_DIVIDER = "border-s border-s-[color-mix(in_oklab,currentColor_24%,transparent)]"
|
|
82
|
+
|
|
36
83
|
ICON_BUTTON_BASE =
|
|
37
84
|
"lc-press inline-grid place-items-center shrink-0 border-0 bg-transparent " \
|
|
38
85
|
"text-muted-foreground cursor-pointer no-underline " \
|
|
@@ -52,19 +99,34 @@ module Lostcoords::Ui
|
|
|
52
99
|
lg: "size-control-lg [&_svg]:size-6"
|
|
53
100
|
}.freeze
|
|
54
101
|
|
|
55
|
-
|
|
102
|
+
# A row action that stays out of the way until it is hovered, focused or open.
|
|
103
|
+
ICON_BUTTON_QUIET =
|
|
104
|
+
"focus-visible:text-foreground aria-expanded:text-foreground " \
|
|
105
|
+
"motion-safe:[&_svg]:transition-transform motion-safe:[&_svg]:duration-(--lc-motion-control) motion-safe:[&_svg]:ease-(--lc-ease-out-expo) " \
|
|
106
|
+
"motion-safe:not-disabled:hover:[&_svg]:scale-125 motion-safe:focus-visible:[&_svg]:scale-125 motion-safe:aria-expanded:[&_svg]:scale-125"
|
|
107
|
+
|
|
108
|
+
def lc_button_class(variant: :primary, tone: :default, size: :md, block: false, extra: nil)
|
|
56
109
|
variant = lc_option!(:variant, variant, BUTTON_VARIANTS.keys)
|
|
110
|
+
tone = lc_option!(:tone, tone, BUTTON_TONES.keys)
|
|
57
111
|
size = lc_option!(:size, size, BUTTON_SIZES.keys)
|
|
58
112
|
lc_tw(
|
|
59
113
|
BUTTON_BASE,
|
|
60
114
|
BUTTON_SIZES.fetch(size),
|
|
61
115
|
(lc_glass_class(shape: :bar) if variant == :glass),
|
|
62
116
|
BUTTON_VARIANTS.fetch(variant),
|
|
117
|
+
BUTTON_TONES.fetch(tone).fetch(variant),
|
|
63
118
|
("w-full" if block),
|
|
64
119
|
extra
|
|
65
120
|
)
|
|
66
121
|
end
|
|
67
122
|
|
|
123
|
+
# A button that reads as a select: start-aligned content and a trailing chevron that turns while
|
|
124
|
+
# aria-expanded is true. Use it for buttons that open a menu or picker.
|
|
125
|
+
def lc_select_trigger_class(size: :md, block: false, extra: nil)
|
|
126
|
+
size = lc_option!(:size, size, TailwindHelper::CONTROL_SIZES.keys)
|
|
127
|
+
lc_tw(SELECT_TRIGGER_BASE, TailwindHelper::CONTROL_SIZES.fetch(size), ("w-full" if block), extra)
|
|
128
|
+
end
|
|
129
|
+
|
|
68
130
|
def lc_icon_button_class(shape: :square, size: :md, extra: nil)
|
|
69
131
|
shape = lc_option!(:shape, shape, ICON_BUTTON_SHAPES.keys)
|
|
70
132
|
size = lc_option!(:size, size, ICON_BUTTON_SIZES.keys)
|