lostcoords-ui 0.7.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 +287 -26
- 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 -4
- data/app/assets/tailwind/lostcoords/ui/search.css +96 -0
- data/app/assets/tailwind/lostcoords/ui/sheet.css +41 -8
- 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 +20 -8
- 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 +105 -16
- 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 +1 -6
- data/app/javascript/lostcoords/ui/controllers/lc_sheet_controller.js +29 -15
- 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 +27 -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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a8f4a7f674aefbf78e3ff41660cda9bd23afe68b1f77fd9683b4200cbab18ce7
|
|
4
|
+
data.tar.gz: f23756106e41ee9caa58beb818311dbe7352e044d969b1f25785b261e5a5179f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2beae0fe5660fc82bdba61e82961a6d09768cf03d7a8fdea2f0defa1805b7b3e6d76556ddbc0a5210e3b70284d453541ed65d9bd86b9e27fc9509267d79a4f67
|
|
7
|
+
data.tar.gz: 4de9907189cb70af9b8445b368da65c34dea9e8dfd9821883503d889355fe4fed22240c169c75d6665960f274644f3753d739b99f30beef888061a0e699dafa8
|
data/README.md
CHANGED
|
@@ -21,7 +21,7 @@ its gem version, so publishing a library update does not upgrade consumers.
|
|
|
21
21
|
## Install
|
|
22
22
|
|
|
23
23
|
```ruby
|
|
24
|
-
gem "lostcoords-ui", "~> 0.
|
|
24
|
+
gem "lostcoords-ui", "~> 0.8.0"
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
The engine adds its rendering helpers to host views, its JavaScript to the asset paths and its pins to
|
|
@@ -74,7 +74,7 @@ Outside Rails, import the same files from `app/assets/tailwind/lostcoords/ui/` i
|
|
|
74
74
|
`base.css` holds the document defaults that `ui.css` adds; skip it when the host owns its base styles.
|
|
75
75
|
`core.css` holds the tokens, buttons, badges, avatars, cards, alerts, form controls, choices,
|
|
76
76
|
toggles, layout, typography and navigation. The opt-in entries are `dialog` (with the phone sheet),
|
|
77
|
-
`menu` (menus and popovers), `toast`, `tooltip`, `collapsible`, `code-block`,
|
|
77
|
+
`menu` (menus and popovers), `toast`, `search`, `tooltip`, `collapsible`, `code-block`,
|
|
78
78
|
`emoji-picker`, `table` and `prose`. A component whose entry is missing renders unstyled.
|
|
79
79
|
|
|
80
80
|
Start one Stimulus application in the host, then register the controllers you use:
|
|
@@ -122,6 +122,7 @@ html[data-theme="dark"] {
|
|
|
122
122
|
| --- | --- | --- |
|
|
123
123
|
| `--background` `--foreground` | white, near black | page and body text |
|
|
124
124
|
| `--card` `--card-foreground` | light gray | cards |
|
|
125
|
+
| `--card-input` `--card-secondary` | `--input`, `--secondary` | fields and secondary buttons inside cards and list rows; set them when `--card` matches either fill |
|
|
125
126
|
| `--popover` `--popover-foreground` | page background | menus, popovers, dialogs |
|
|
126
127
|
| `--primary` `--primary-foreground` | near black, white | primary actions, links, selection, focus |
|
|
127
128
|
| `--secondary` `--secondary-foreground` | gray | secondary buttons |
|
|
@@ -133,6 +134,7 @@ html[data-theme="dark"] {
|
|
|
133
134
|
| `--lc-density` | `1` | the semantic spacing and control heights below |
|
|
134
135
|
| `--lc-inset` | `1.25rem` | padding of cards, dialogs and popovers |
|
|
135
136
|
| `--font-sans` `--font-display` `--font-mono` | system | font families |
|
|
137
|
+
| `--font-eyebrow` | `var(--font-mono)` | eyebrow text; Japanese eyebrows use `--font-sans` |
|
|
136
138
|
|
|
137
139
|
Defaults live in `app/assets/tailwind/lostcoords/ui/theme.css`. `Lostcoords::Ui::TOKENS` lists the
|
|
138
140
|
public colors and fonts. Library-internal settings use the `--lc-` prefix.
|
|
@@ -164,6 +166,7 @@ changes the padding of every card or dialog inside it.
|
|
|
164
166
|
| `text-small` | 14 / 20px | hints and secondary text |
|
|
165
167
|
| `text-label` | 14 / 20px, medium | labels, buttons, menu items |
|
|
166
168
|
| `text-caption` | 12 / 16px | metadata, table headers |
|
|
169
|
+
| `text-eyebrow` | 12 / 16px, medium, uppercase | kickers and column labels |
|
|
167
170
|
|
|
168
171
|
Each role sets size, line height, tracking and weight together. `lc-trim` trims the space above the
|
|
169
172
|
capital letters and below the baseline where the browser supports `text-box`.
|
|
@@ -191,6 +194,36 @@ lazyLoadControllersFrom("controllers", application)
|
|
|
191
194
|
`eagerLoadControllersFrom` also works and downloads all of them on every page. A host file with the
|
|
192
195
|
same name, such as `app/javascript/controllers/lc_dialog_controller.js`, replaces the gem's.
|
|
193
196
|
|
|
197
|
+
## Upgrading from 0.7
|
|
198
|
+
|
|
199
|
+
Everything else in 0.8 is additive. These changes need edits in an app built on 0.7:
|
|
200
|
+
|
|
201
|
+
- **A named `lc_toggle_group` renders native radios.** Before: `lc_toggle_group(name:)` rendered radio
|
|
202
|
+
buttons, a hidden input and the `lc-selection` controller. After: each item is a `label` around an
|
|
203
|
+
`input type=radio` with that name, so listen for the inputs' `change` instead of `lc-selection:change`, and
|
|
204
|
+
mark the selected item with `checked:` or the group's `value:` instead of `selected:`. A group without
|
|
205
|
+
`name:` keeps the radio buttons and `lc-selection:change`; it no longer has an `input` target.
|
|
206
|
+
- **`lc_sheet_data` is gone.** Before: `tag.dialog data: lc_sheet_data({ controller: "picker" }, detents: "large")`.
|
|
207
|
+
After: `lc_sheet tag: :dialog, detents: "large", data: { controller: "picker" }`. `lc_sheet` also renders
|
|
208
|
+
non-dialog sheets, so drop any hand-written `data-controller="lc-sheet"` and handle element too.
|
|
209
|
+
- **The `lc-confirm-dialog` controller is gone.** Before: a pre-rendered confirm `<dialog>` wired to
|
|
210
|
+
`lc-confirm-dialog`. After: render `lc_confirm_sheet` once in the layout and put `data-turbo-confirm` on
|
|
211
|
+
the form, with `data-turbo-confirm-description`, `data-turbo-confirm-accept` and
|
|
212
|
+
`data-turbo-confirm-tone` for its description, label and tone.
|
|
213
|
+
- **A modal `lc_dialog` is 32rem wide on desktop.** Before: `min(92vw, 31rem)`. After: `size: :md`,
|
|
214
|
+
`min(32rem, 100vw - 2rem)`. Pass `size: :sm` (24rem) for a narrower dialog, or set `--lc-dialog-width`.
|
|
215
|
+
- **`lc_dialog` puts your content in a body slot.** Before: the block rendered straight after the header
|
|
216
|
+
inside `[data-slot=dialog-content]`. After: it renders inside `[data-slot=dialog-body]`, which scrolls on
|
|
217
|
+
desktop, and the close button sits in `[data-slot=dialog-actions]`. Update CSS that selects children of
|
|
218
|
+
`dialog-content`.
|
|
219
|
+
- **A swiped-away popover sheet hides itself.** Before: `lc-sheet:dismiss` only notified listeners on a
|
|
220
|
+
non-dialog sheet. After: an open `[popover]` sheet hides unless a listener calls `preventDefault()`.
|
|
221
|
+
- **An unpadded `lc_card` no longer gaps its children.** Before: `lc_card(padding: :none)` stacked its
|
|
222
|
+
children `--lc-inset` apart. After: they meet edge to edge, as rows and empty states in an unpadded card
|
|
223
|
+
expect. Pass `class: "gap-inset"` to keep the old spacing.
|
|
224
|
+
- **`lc_text(size: :label)` is semibold.** Before: weight 500. After: 600, the same as a field label, so
|
|
225
|
+
one label role serves both. Add `class: "font-medium"` where the lighter weight was intended.
|
|
226
|
+
|
|
194
227
|
## Components
|
|
195
228
|
|
|
196
229
|
[Installation and setup](https://ui.lostcoords.com/installation.html) · [Live examples](https://ui.lostcoords.com). Each example renders the same ERB source shown
|
|
@@ -209,22 +242,40 @@ Button hover and press fills mix 94% of the base background with 6% of its foreg
|
|
|
209
242
|
Ghost and icon buttons stay transparent at rest and use the secondary base for that calculation.
|
|
210
243
|
Apps can override `--secondary` for the neutral base, or `--lc-button-bg` and `--lc-button-ink` on individual buttons.
|
|
211
244
|
Inputs use `--input` and `--lc-input-hover`.
|
|
212
|
-
`lc_button_to` preserves Rails' form, HTTP method and CSRF behavior. Block helpers capture ERB content.
|
|
245
|
+
`lc_button_to` preserves Rails' form, HTTP method and CSRF behavior. `lc_icon_button_link_to` and `lc_icon_button_to` are the link and form versions of `lc_icon_button`; a block replaces its icon with custom content. `block: true` makes any button full width. Block helpers capture ERB content.
|
|
213
246
|
Use `icon: "plus"` for a leading Heroicon or `icon_position: :end` for a trailing one. Custom icons and
|
|
214
247
|
spinners use `data-icon="inline-start"` or `data-icon="inline-end"`; buttons adjust that edge's padding.
|
|
248
|
+
`tone: :destructive` recolours any variant for destructive actions: a ghost, outline or secondary
|
|
249
|
+
button keeps its emphasis and takes destructive ink, and a primary button becomes the filled
|
|
250
|
+
`variant: :destructive` surface.
|
|
251
|
+
`lc_select_trigger` is a button that looks like `lc_select`, for buttons that open a menu or picker. Its label
|
|
252
|
+
starts at the inline start and its chevron sits at the inline end and turns while `aria-expanded` is true.
|
|
253
|
+
`lc_split_button` is one pill with two targets: a primary action, a link with `href:`, and a square toggle
|
|
254
|
+
named by `menu_label:` that opens a menu of the block's `lc_menu_option` items. The toggle draws a divider
|
|
255
|
+
from its ink and keeps its pressed fill while open. It takes the button's `variant:`, `tone:`, `size:` and
|
|
256
|
+
`icon:`; `action:`, `toggle:` and `menu:` add attributes to those parts.
|
|
215
257
|
|
|
216
258
|
```erb
|
|
217
259
|
<%= lc_button_to "Archive", project_path(@project), method: :delete, variant: :destructive %>
|
|
260
|
+
<%= lc_button_to "Revoke", api_key_path(@key), method: :delete, variant: :ghost, tone: :destructive %>
|
|
261
|
+
<%= lc_select_trigger "All members", aria: { haspopup: "menu", expanded: false } %>
|
|
262
|
+
<%= lc_split_button "Add expense", id: "add-menu", href: new_expense_path, icon: "plus", menu_label: "More ways to add" do %>
|
|
263
|
+
<%= lc_menu_option "Import a CSV", icon: "arrow-down-tray" %>
|
|
264
|
+
<% end %>
|
|
218
265
|
<%= lc_icon_button "Settings", icon: "cog-6-tooth" %>
|
|
266
|
+
<%= lc_icon_button_link_to "Back", projects_path, icon: "chevron-left" %>
|
|
267
|
+
<%= lc_icon_button_to "Delete", attachment_path(@attachment), icon: "trash", method: :delete %>
|
|
268
|
+
<%= lc_icon_button "Account" do %><%= lc_avatar current_user.initials %><% end %>
|
|
219
269
|
|
|
220
|
-
<%= lc_button
|
|
270
|
+
<%= lc_button block: true, data: { action: "editor#save" }, aria: { busy: true } do %>
|
|
221
271
|
<%= lc_spinner size: :sm %>
|
|
222
272
|
Saving…
|
|
223
273
|
<% end %>
|
|
224
274
|
```
|
|
225
275
|
|
|
226
276
|
Use native attributes for application behavior, `class:` to merge additional Tailwind utilities, and
|
|
227
|
-
theme tokens to restyle the library. `
|
|
277
|
+
theme tokens to restyle the library. `popover: true` renders `popover="auto"`, as a bare `popover`
|
|
278
|
+
attribute does. `lc_field` yields the input's `id` and validation attributes so
|
|
228
279
|
labels, hints and errors stay connected. Linked cards use `lc_card(href: ...)`; cards containing
|
|
229
280
|
buttons or fields remain ordinary containers.
|
|
230
281
|
|
|
@@ -233,19 +284,76 @@ Wrap wide tables in an app-owned horizontal scroll region with an accessible nam
|
|
|
233
284
|
Use `lc_table_class` when an existing table renderer owns the markup.
|
|
234
285
|
|
|
235
286
|
Cards share one API: `lc_card(padding: :md)`, with `:sm` and `:none` for tighter or custom spacing. Padding sizes set `--lc-inset`, so content inside follows the card.
|
|
236
|
-
|
|
287
|
+
Fields and secondary buttons inside cards take `--card-input` and `--card-secondary`, which default to the page fills; set them in the theme when `--card` equals `--input` or `--secondary`, or set `--lc-field-bg` to change fields in one context. Cards provide avatar cutouts and a validation border when they contain errors. Fills that are muted on the page switch so they stay visible on the card: choice tiles, alerts, neutral badges and skeletons take the page background (`--lc-tile-bg`), and toggle group and tab tracks take the accent fill (`--lc-track-bg`). Set either variable to apply the same context to your own muted surface.
|
|
237
288
|
Add `class: "@container"` when a card owns its width and its children use container queries.
|
|
238
289
|
Use `--lc-card-bg`, `--lc-card-border`, `--lc-card-radius` and `--lc-card-shadow` for local appearance overrides.
|
|
239
290
|
|
|
240
|
-
`lc_badge` handles labels, counts and status.
|
|
241
|
-
`lc_icon_badge` handles decorative icon containers,
|
|
291
|
+
`lc_badge` handles labels, counts and status. Pass `shape: :pill` for a fully rounded label such as "You" or an error count.
|
|
292
|
+
`lc_icon_badge` handles decorative icon containers: pass `icon:` for a library icon, or content or a block for an emoji. It takes `shape: :square` or `:circle` and `sm` (26px), `md` (40px), `lg` (48px) or `xl` (56px) sizes.
|
|
293
|
+
`lc_avatar` sizes are `xs` (20px), `sm` (26px), `md` (32px), `lg` (48px), `xl` (96px) and `xxl` (112px).
|
|
294
|
+
Pass `as: :button` when the avatar is itself the control, such as a colour picker's trigger. `lc_avatar_stack`
|
|
295
|
+
takes `row:` attributes for the inner row that overlaps the avatars, such as a controller target.
|
|
296
|
+
Initials and icons scale with the size, including a size set through `--lc-avatar-size` or `--lc-icon-badge-size`;
|
|
297
|
+
set `--lc-avatar-font-scale` or `--lc-icon-badge-font-scale` to change the share, or the `-font-size` variable to pin it.
|
|
242
298
|
Badge, icon badge, Alert and Toast share `neutral`, `primary`, `success`, `warning` and `destructive` tones.
|
|
243
299
|
|
|
244
|
-
`lc_toggle` renders a
|
|
245
|
-
|
|
300
|
+
`lc_toggle` renders a button that flips its own `aria-pressed`; set `aria-pressed` or `aria-expanded` yourself
|
|
301
|
+
and it leaves the state to your controller. `href:` renders a link marked `aria-current` when active, and `name:`
|
|
302
|
+
with `value:` a label around a visually hidden native radio, styled by `:checked`.
|
|
303
|
+
`lc_toggle_group` with `lc_toggle_group_item` holds mutually exclusive choices, and the group decides what its items are.
|
|
304
|
+
With `name:` they are native radios in labels, which bring their own arrows, submitted value and reset; items take
|
|
305
|
+
`value:` and `checked:`, and the group's `value:` checks the matching item. With `as: :nav` they are links in a
|
|
306
|
+
labelled `nav`; items take `href:` and `current:`. Otherwise they are radio buttons whose selection lives in the
|
|
307
|
+
`lc-selection` controller, which dispatches `lc-selection:change`; items take `value:` and `selected:`. An item
|
|
308
|
+
given another kind's arguments raises.
|
|
309
|
+
|
|
310
|
+
```erb
|
|
311
|
+
<%= lc_toggle_group label: "Period", as: :nav do %>
|
|
312
|
+
<%= lc_toggle_group_item "Month", href: stats_path(period: :month), current: true %>
|
|
313
|
+
<%= lc_toggle_group_item "Year", href: stats_path(period: :year) %>
|
|
314
|
+
<% end %>
|
|
315
|
+
<%= lc_toggle_group label: "Billing", name: "billing", value: "monthly" do %>
|
|
316
|
+
<%= lc_toggle_group_item "Monthly", value: "monthly" %>
|
|
317
|
+
<%= lc_toggle_group_item "Annual", value: "annual" %>
|
|
318
|
+
<% end %>
|
|
319
|
+
<%= lc_toggle "Food", aria: { pressed: false }, data: { value: "food" } %>
|
|
320
|
+
```
|
|
321
|
+
|
|
246
322
|
`lc_collapsible` expands content through a native `<details>` element. `lc_alert` renders persistent inline feedback;
|
|
247
323
|
`lc_toast` adds timed dismissal.
|
|
248
324
|
|
|
325
|
+
```erb
|
|
326
|
+
<%= lc_collapsible card: false, indicator: :chevron, summary_class: "rounded-2xl px-3 hover:bg-accent" do |collapsible| %>
|
|
327
|
+
<% collapsible.summary do %><span class="me-auto">Language</span><span>English</span><% end %>
|
|
328
|
+
…
|
|
329
|
+
<% end %>
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
The `summary` part replaces `title:` with your own markup and takes attributes for the `<summary>`.
|
|
333
|
+
`card: false` drops the card surface, `summary_class:` styles the summary (a button class works), and
|
|
334
|
+
`indicator:` is `:marker` (native), `:chevron` (turns as it opens) or `:none`.
|
|
335
|
+
|
|
336
|
+
```erb
|
|
337
|
+
<%= lc_list_section "Security", id: "security", footnote: "Keep one way to sign in." do %>
|
|
338
|
+
<%= lc_list_group do %>
|
|
339
|
+
<%= lc_list_row "Email", subtitle: "ada@example.com", icon: "envelope" do %>
|
|
340
|
+
<%= lc_button "Change", variant: :secondary, size: :sm %>
|
|
341
|
+
<% end %>
|
|
342
|
+
<%= lc_list_row "Alerts", tag: :label do %><%= check_box_tag :alerts, class: lc_switch_class %><% end %>
|
|
343
|
+
<% end %>
|
|
344
|
+
<% end %>
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
`lc_list_group` draws grouped settings rows: each row is its own card-coloured panel, 2px apart, and
|
|
348
|
+
only the group's ends round. Rows are card surfaces, so fields and buttons in them follow
|
|
349
|
+
`--card-input` and `--card-secondary`. `lc_list_row` with a title lays out `icon:` (a name, or your own
|
|
350
|
+
markup such as a logo), the title, `subtitle:` and the block as trailing content; `tag:` makes it a
|
|
351
|
+
`label`, `li`, `details` or `a` (`href:`). Without a title the block is the whole row, and
|
|
352
|
+
`padded: false` leaves the padding to content such as an `lc_list_item` button or summary, which lays
|
|
353
|
+
out the same icon, title and subtitle inside your own element. `lc_list_section` adds the heading and
|
|
354
|
+
footnote; with an `id:`, the heading labels the section. Put a form around `lc_list_group` inside it
|
|
355
|
+
when the rows save together.
|
|
356
|
+
|
|
249
357
|
### Parts and slots
|
|
250
358
|
|
|
251
359
|
Compound components yield a builder, so their parts are scoped and discoverable. A card stacks its
|
|
@@ -281,7 +389,7 @@ signatures and render library controls; `field` adds the label, hint and the att
|
|
|
281
389
|
sets `aria-invalid` on the control. Rails' `field_with_errors` wrapper does not affect the layout.
|
|
282
390
|
|
|
283
391
|
```erb
|
|
284
|
-
<%= lc_form_with model: @project,
|
|
392
|
+
<%= lc_form_with model: @project, gap: :content do |form| %>
|
|
285
393
|
<%= form.field :name, hint: "Shown to members" %>
|
|
286
394
|
<%= form.field :email, as: :email_field %>
|
|
287
395
|
<%= form.switch :public %>
|
|
@@ -289,13 +397,25 @@ sets `aria-invalid` on the control. Rails' `field_with_errors` wrapper does not
|
|
|
289
397
|
<% end %>
|
|
290
398
|
```
|
|
291
399
|
|
|
400
|
+
`gap:` makes the form a stack and `card: true` (with `padding:`) makes the form the card, so neither
|
|
401
|
+
needs a wrapper element. Nested `fields_for` builders render library controls too, and
|
|
402
|
+
`form.check_box :x, role: "switch"` draws a switch inside a label row you build yourself.
|
|
403
|
+
`form.submit` and `form.button` take `lc_button`'s `variant:`, `tone:`, `size:` and `block:`.
|
|
404
|
+
|
|
292
405
|
A symbol `size:` such as `size: :sm` picks the control height; an integer still sets the HTML
|
|
293
|
-
attribute.
|
|
406
|
+
attribute. `form.field … size: :sm` (or `lc_field size: :sm`) is the compact field for dense forms,
|
|
407
|
+
with a caption label. Pass `builder: Lostcoords::Ui::FormBuilder` to `form_with` directly, or call `lc_field`
|
|
294
408
|
with `error: record.errors.full_messages_for(:name)` when you keep your own builder.
|
|
295
409
|
|
|
296
410
|
`lc_checkbox`, `lc_radio` and `lc_switch` render native inputs with a label and optional hint.
|
|
297
411
|
Checkboxes and switches submit an unchecked value like Rails' `check_box`; pass `unchecked_value: nil`
|
|
298
|
-
to omit it. `
|
|
412
|
+
to omit it. A `nil` label renders the bare input, for a row selector the row labels; give it
|
|
413
|
+
`aria: { label: }`. `lc_choice_group` groups them in a fieldset with a legend, hint and error.
|
|
414
|
+
|
|
415
|
+
`lc_fieldset(legend:, id: nil, hint: nil, error: nil, size: :md)` names a group of controls that no single
|
|
416
|
+
label can, such as toggles, a picker or several inputs; with an `id`, its hint and error describe the fieldset,
|
|
417
|
+
and `size: :sm` matches a compact `lc_field`. `lc_choice_group` is `lc_fieldset` with its choices stacked.
|
|
418
|
+
Text that labels something other than one control, such as a list, uses `lc_text size: :label`, the field label's role.
|
|
299
419
|
|
|
300
420
|
### Navigation and overlays
|
|
301
421
|
|
|
@@ -319,7 +439,7 @@ to omit it. `lc_choice_group` groups them in a fieldset with a legend, hint and
|
|
|
319
439
|
|
|
320
440
|
Tabs follow the ARIA tabs pattern with arrow key, Home and End navigation, and dispatch
|
|
321
441
|
`lc-tabs:change`. `orientation: :vertical` stacks the tabs beside their panels and moves with Arrow Up
|
|
322
|
-
and Down; `activation: :manual` moves focus with the arrows and selects with Enter or Space. Tooltips show on hover and keyboard focus, Escape hides them, and they describe
|
|
442
|
+
and Down; `activation: :manual` moves focus with the arrows and selects with Enter or Space; `list:` adds attributes to the tab list. Tooltips show on hover and keyboard focus, Escape hides them, and they describe
|
|
323
443
|
their trigger, in the top layer; keep essential information visible. Description lists stack on phones and use two
|
|
324
444
|
columns from `sm`.
|
|
325
445
|
|
|
@@ -338,8 +458,20 @@ columns from `sm`.
|
|
|
338
458
|
Read the <%= lc_link "guide", guide_path %>.
|
|
339
459
|
```
|
|
340
460
|
|
|
341
|
-
|
|
342
|
-
|
|
461
|
+
```erb
|
|
462
|
+
<%= lc_nav_list label: "Project", layout: :responsive, indicator: true do |nav| %>
|
|
463
|
+
<%= nav.link "Overview", project_path(@project), icon: "document-text", current: true %>
|
|
464
|
+
<%= nav.link "Activity", project_activity_path(@project), icon: "clock" %>
|
|
465
|
+
<% end %>
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
`lc_nav_list` marks the current link with `aria-current="page"`. Its default `layout: :column` is a
|
|
469
|
+
sidebar, where `compact: true` is the quieter style for an "On this page" list and `indent: true`
|
|
470
|
+
nests a link. `layout: :row` lays links in a line, `:dock` stacks each icon above its label in equal
|
|
471
|
+
cells for a phone's bottom bar, and `:responsive` is a dock below `sm` and a row from `sm`; position a
|
|
472
|
+
dock yourself, such as `fixed bottom-0`. `indicator: true` slides one fill to the current link, and
|
|
473
|
+
after a Turbo visit the new list starts the fill where the last one left it. Set `--lc-nav-indicator`
|
|
474
|
+
to change the fill, and pass `layout:` to `lc_nav_link_class` for links you render yourself. `lc_pager` takes `[title, url]`
|
|
343
475
|
for each side and `compact: true` for icon buttons. `lc_link` has `inherit`, `muted` and `primary`
|
|
344
476
|
tones; `lc_link_class` styles links you render yourself. `lc_skip_link` targets `#main` by default.
|
|
345
477
|
Pass `card: true` to `lc_radio` or `lc_checkbox` for selectable tiles; a block adds content, such as a
|
|
@@ -348,10 +480,128 @@ preview, under the label.
|
|
|
348
480
|
This documentation site is built with these components and two copyable blocks: the application
|
|
349
481
|
header and the documentation layout.
|
|
350
482
|
|
|
483
|
+
```erb
|
|
484
|
+
<%= lc_menu id: "member-actions", label: "Actions for #{member.name}", trigger: :icon do %>
|
|
485
|
+
<%= lc_menu_option "Rename", icon: "pencil" %>
|
|
486
|
+
<%= lc_menu_option "Euro", hint: "EUR", leading: tag.span("€"), checked: true %>
|
|
487
|
+
<%= lc_menu_option "Remove", icon: "trash", href: member_path(member), method: :delete, tone: :destructive %>
|
|
488
|
+
<% end %>
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
Menu options take a leading `icon:` or other rendered `leading:` content, which is hidden from
|
|
492
|
+
assistive technology so the label stays the name. Leading visuals share one column across the menu, so
|
|
493
|
+
labels line up with and without them. `hint:` adds a secondary line. `checked: true` or `false` makes
|
|
494
|
+
a `menuitemradio` with a check mark. `checkbox: true` makes a `menuitemcheckbox` that flips its
|
|
495
|
+
`aria-checked` on click, dispatches `lc-menu:check` with `{ checked }`, and leaves the menu open.
|
|
496
|
+
`method:` renders a `button_to` form and passes `params:` and `form:` on.
|
|
497
|
+
`lc_menu` and `lc_popover` take `trigger: false` to render only the panel, named by `label:` (or
|
|
498
|
+
`title:`), when an ancestor hosts the `lc-menu` or `lc-popover` controller and wires its own
|
|
499
|
+
`trigger` targets. With `click->lc-popover#toggleFromRow` on that host, a click anywhere on it that
|
|
500
|
+
misses a control opens the panel; mark other regions `data-lc-menu-ignore`.
|
|
501
|
+
`lc_menu` and `lc_popover` take `trigger: :icon` with `icon:` for a quiet icon button named by `label:`,
|
|
502
|
+
or rendered content such as an avatar for a custom trigger. `trigger_attributes:` adds attributes such as `class:` or `title:` to either.
|
|
503
|
+
For any other trigger, call the yielded part's `trigger` with a block. It receives the attributes that
|
|
504
|
+
wire an element as the trigger (its id, `aria-haspopup`, `aria-expanded`, `aria-controls` and the
|
|
505
|
+
Stimulus target and action), merged with any passed to `trigger`, and the element it renders replaces
|
|
506
|
+
the default button:
|
|
507
|
+
|
|
508
|
+
```erb
|
|
509
|
+
<%= lc_menu id: "member-filter", label: "Member" do |menu| %>
|
|
510
|
+
<% menu.trigger(class: "min-w-44") { |attrs| lc_select_trigger "All members", **attrs } %>
|
|
511
|
+
<%= lc_menu_option "Alex" %>
|
|
512
|
+
<% end %>
|
|
513
|
+
```
|
|
514
|
+
The icon trigger is muted at rest, with full ink and a slightly larger icon on hover, focus and while open.
|
|
515
|
+
`wrapper_attributes:` styles the element that holds the trigger and panel, an `inline-flex` box by default,
|
|
516
|
+
for example `class: "flex min-w-0"` when the trigger fills a grid cell. A `data: { controller: }` there joins the panel's own.
|
|
517
|
+
|
|
351
518
|
`lc_dialog` handles modal content and the mobile sheet layout. Set `detents: "medium large"` or `"large"`
|
|
352
519
|
to choose mobile height stops; the default is `"fit"`. Icon buttons, avatar groups, motion and mobile dialogs
|
|
353
520
|
appear with their parent component examples.
|
|
354
521
|
|
|
522
|
+
`size:` sets the desktop width: `:sm` (24rem), `:md` (32rem, the modal default), `:lg` (40rem) or `:xl`
|
|
523
|
+
(64rem). The size sets `--lc-dialog-width`, which the width reads: widen a dialog in a state with
|
|
524
|
+
`has-[…]:[--lc-dialog-width:64rem]`, or size content with `calc(var(--lc-dialog-width) - 2px)`. On desktop
|
|
525
|
+
the header stays put and the body scrolls. `dialog.actions` adds content to the header, before the close
|
|
526
|
+
button. Pass `trigger: false` when a controller of your own opens the dialog: only the `<dialog>` renders,
|
|
527
|
+
and `close_action:` (default `"lc-dialog#close"`) and `close_label:` wire the close buttons to it. `data:`
|
|
528
|
+
and `aria:` reach the `<dialog>`; `title_attributes:` and `description_attributes:` reach the heading and
|
|
529
|
+
description, for a controller that rewrites them.
|
|
530
|
+
|
|
531
|
+
```erb
|
|
532
|
+
<div data-controller="import">
|
|
533
|
+
<button type="button" data-action="import#open">Import</button>
|
|
534
|
+
<%= lc_dialog id: "import", title: "Import", trigger: false, size: :lg, close_action: "import#close",
|
|
535
|
+
data: { import_target: "dialog" } do |dialog| %>
|
|
536
|
+
…
|
|
537
|
+
<% end %>
|
|
538
|
+
</div>
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
`lc_confirm_sheet` replaces the browser's confirm for `data-turbo-confirm`. Render it once in the layout
|
|
542
|
+
and hand Turbo the gem's function:
|
|
543
|
+
|
|
544
|
+
```js
|
|
545
|
+
import { confirm } from "lostcoords/ui/helpers/confirm"
|
|
546
|
+
Turbo.config.forms.confirm = confirm
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
The sheet shows the message as its title, Cancel and a confirm button. The submitter, then the form, can
|
|
550
|
+
add `data-turbo-confirm-description` (a line under the title) and `data-turbo-confirm-accept` (the confirm
|
|
551
|
+
button's label; without it a short submitter label is used). The confirm button is destructive when either
|
|
552
|
+
has `data-turbo-confirm-tone="destructive"`, or the submitter is an `lc_button_to` with
|
|
553
|
+
`variant: :destructive` or an `lc_menu_option` with `tone: :destructive`. Confirming from an `lc_menu` opens
|
|
554
|
+
the sheet beside the menu on desktop. `ask(message, { description, accept, destructive, anchor })` from the
|
|
555
|
+
same module opens it from your own code and resolves to `true` or `false`.
|
|
556
|
+
|
|
557
|
+
`lc_sheet` renders any other phone sheet, with the `lc-sheet` controller wired. `tag: :dialog` makes a
|
|
558
|
+
modal `<dialog>` sheet, which is what `lc_dialog` and `lc_confirm_sheet` render; with `size:` it gets
|
|
559
|
+
`lc_dialog`'s frame and width without its header, for content that brings its own. The default `tag: :div`
|
|
560
|
+
shows while it is `:popover-open` or carries `[data-open]`, so a native `[popover]` and a FloatingPanel
|
|
561
|
+
picker both work; a div you toggle yourself sets `data-open` and removes it to slide out. From `sm` up
|
|
562
|
+
the div keeps your frame, or `anchored: true` makes it a popover under its trigger inside a positioned
|
|
563
|
+
ancestor. `detents:` takes the same stops as `lc_dialog`, and `handle: true` adds a grab strip above the
|
|
564
|
+
content. A swipe down dispatches `lc-sheet:dismiss`; unless a listener cancels it, an open popover then
|
|
565
|
+
hides.
|
|
566
|
+
|
|
567
|
+
```erb
|
|
568
|
+
<button type="button" popovertarget="filters">Filters</button>
|
|
569
|
+
<%= lc_sheet id: "filters", popover: "auto", class: "sm:w-80 sm:rounded-3xl sm:bg-popover",
|
|
570
|
+
data: { action: "lc-sheet:dismiss->filters#reset" } do %>…<% end %>
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
`lc-popover-shell` gives a native `[popover]` menu the same enter and exit as FloatingPanel panels. Set
|
|
574
|
+
`--lc-popover-from` to change the closed pose and an `origin-*` utility for where it grows from.
|
|
575
|
+
|
|
576
|
+
### Search
|
|
577
|
+
|
|
578
|
+
`lc_search` renders a search trigger, a pill with the ⌘K hint that shrinks to an icon on phones, and
|
|
579
|
+
the full-screen search it opens. Attributes go to the trigger, which is what sits in your layout.
|
|
580
|
+
Build results from `lc_search_group` and `lc_search_result`.
|
|
581
|
+
|
|
582
|
+
```erb
|
|
583
|
+
<%= lc_search label: "Search", src: search_path %>
|
|
584
|
+
|
|
585
|
+
<%# app/views/searches/show.html.erb, rendered without a layout for lc_search's requests %>
|
|
586
|
+
<%= lc_search_group "Projects" do %>
|
|
587
|
+
<% @projects.each do |project| %>
|
|
588
|
+
<%= lc_search_result project.name, project_path(project), detail: project.client, icon: "folder" %>
|
|
589
|
+
<% end %>
|
|
590
|
+
<% end %>
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
With `src:`, each pause in typing requests `src` with the query in `param` (`q` by default) and shows
|
|
594
|
+
the HTML the server answers; that endpoint is yours, as a Turbo Frame's would be. Without
|
|
595
|
+
JavaScript the field submits the same GET, so a full search page still works. Without `src:`, the
|
|
596
|
+
rows rendered in the block are filtered in the browser by their text and `keywords:`. To search
|
|
597
|
+
another way, handle `lc-search:query`, call `preventDefault()` and fill `event.detail.results` with
|
|
598
|
+
the same helpers' markup, cloned from a `<template>`; the docs search does this with MiniSearch.
|
|
599
|
+
|
|
600
|
+
The block also renders what shows before anything is typed. Arrow keys move through the results,
|
|
601
|
+
Enter opens the first one, and choosing a result or pressing Escape closes search and returns focus.
|
|
602
|
+
Groups without a visible result hide, a query with none shows the empty note, and a status region
|
|
603
|
+
announces the count. Pass `shortcut: nil` to drop the page shortcut, and `id:` when a page has two searches.
|
|
604
|
+
|
|
355
605
|
### Keyboard
|
|
356
606
|
|
|
357
607
|
Every interactive component works from the keyboard without extra code:
|
|
@@ -405,6 +655,12 @@ ordered by `--lc-z-popover`, `--lc-z-overlay` and `--lc-z-toast`.
|
|
|
405
655
|
<%= turbo_stream.append "toasts" do %><%= lc_toast "Project saved." %><% end %>
|
|
406
656
|
```
|
|
407
657
|
|
|
658
|
+
The region sits at the bottom-end corner. `placement:` takes `:bottom_end`, `:bottom_center`,
|
|
659
|
+
`:top_end` or `:top_center`, and `mobile_placement:` takes the same values below `sm`, as in
|
|
660
|
+
`lc_toast_region id: "toasts", placement: :bottom_center, mobile_placement: :top_center`. The region
|
|
661
|
+
keeps clear of the safe area; set `--lc-toast-offset` to move it further from the edges, or
|
|
662
|
+
`--lc-toast-offset-top` and `--lc-toast-offset-bottom` for one edge, such as below a sticky header.
|
|
663
|
+
|
|
408
664
|
While a modal dialog or sheet is open the page behind it can't scroll: the body is pinned with
|
|
409
665
|
`position: fixed` and marked `data-modal-scroll-lock="true"`, so `window.scrollY` reads 0 until it
|
|
410
666
|
closes. Scroll-driven chrome, such as a header that fills in once the page scrolls, should keep its
|
|
@@ -496,9 +752,13 @@ spacing between children, including fields. Inline `<code>` elements get a share
|
|
|
496
752
|
```
|
|
497
753
|
|
|
498
754
|
Heading sizes are `display`, `title`, `heading` and `subheading`. Text sizes are `body`, `small`,
|
|
499
|
-
`label` and `
|
|
500
|
-
|
|
501
|
-
|
|
755
|
+
`label`, `caption` and `eyebrow`, with `default` and `muted` tones. `lc_text_class(size: :eyebrow, tone: :muted)`
|
|
756
|
+
styles a kicker or footer column label; under `lang="ja"` it keeps natural case and letter spacing. Pass `trim: true` to trim the text box.
|
|
757
|
+
Stacks and inline groups take the spacing names from [Foundations](#foundations). `lc_stack`, `lc_inline`,
|
|
758
|
+
`lc_text` and `lc_card` take `as:` to render a meaningful element, such as `lc_stack(as: :ul)`, `lc_text(as: :span)` or
|
|
759
|
+
`lc_card(as: :section)`. `lc_section` leaves
|
|
760
|
+
`heading` below its title and `content` between blocks. `lc_section_header` is that heading row on its own,
|
|
761
|
+
for a heading that needs more than a title, such as a lede under it. `lc_container` provides `page`, `reading` and
|
|
502
762
|
`form` widths; only the page container adds gutters. Japanese headings inherit `lang="ja"` and use
|
|
503
763
|
natural letter spacing.
|
|
504
764
|
|
|
@@ -531,6 +791,7 @@ to tune a reading context. Use `not-prose` for embedded components.
|
|
|
531
791
|
|
|
532
792
|
Class helpers remain available for custom markup. The application owns its semantics and behavior.
|
|
533
793
|
`lc_glass_class` supplies translucent surfaces; `lc_tw` merges utilities with the last class winning.
|
|
794
|
+
`lc_glass(shape:, thick:, as:)` renders the surface as an element, such as `lc_glass as: :label` around a search field.
|
|
534
795
|
|
|
535
796
|
```erb
|
|
536
797
|
<nav class="<%= lc_glass_class(shape: :bar) %>" aria-label="Project navigation">
|
|
@@ -545,16 +806,17 @@ Generated by `bin/rails lostcoords:ui:builders`; `bin/lint` checks this list aga
|
|
|
545
806
|
- `lc_avatar_class(size: :md, ink: false, linked: false, extra: nil)` (BadgeHelper)
|
|
546
807
|
- `lc_avatar_stack_class(compact: false, extra: nil)` (BadgeHelper)
|
|
547
808
|
- `lc_avatar_stack_row_class(extra: nil)` (BadgeHelper)
|
|
548
|
-
- `lc_badge_class(tone: :neutral, extra: nil)` (BadgeHelper)
|
|
809
|
+
- `lc_badge_class(tone: :neutral, shape: :rounded, extra: nil)` (BadgeHelper)
|
|
549
810
|
- `lc_toggle_class(active: false, ghost: false, size: :md, extra: nil)` (BadgeHelper)
|
|
550
|
-
- `lc_button_class(variant: :primary, size: :md, block: false, extra: nil)` (ButtonHelper)
|
|
811
|
+
- `lc_button_class(variant: :primary, tone: :default, size: :md, block: false, extra: nil)` (ButtonHelper)
|
|
812
|
+
- `lc_select_trigger_class(size: :md, block: false, extra: nil)` (ButtonHelper)
|
|
551
813
|
- `lc_icon_button_class(shape: :square, size: :md, extra: nil)` (ButtonHelper)
|
|
552
814
|
- `lc_card_class(interactive: false, padding: :md, extra: nil)` (CardHelper)
|
|
553
815
|
- `lc_choice_label_class(card: false, extra: nil)` (ChoiceHelper)
|
|
554
816
|
- `lc_checkbox_class(extra: nil)` (ChoiceHelper)
|
|
555
817
|
- `lc_radio_class(extra: nil)` (ChoiceHelper)
|
|
556
818
|
- `lc_switch_class(extra: nil)` (ChoiceHelper)
|
|
557
|
-
- `lc_dialog_class(kind = :modal, extra: nil)` (DialogHelper)
|
|
819
|
+
- `lc_dialog_class(kind = :modal, size: nil, extra: nil)` (DialogHelper)
|
|
558
820
|
- `lc_emoji_picker_groups` (EmojiPickerHelper)
|
|
559
821
|
- `lc_emoji_picker_count` (EmojiPickerHelper)
|
|
560
822
|
- `lc_emoji_picker_version` (EmojiPickerHelper)
|
|
@@ -572,8 +834,8 @@ Generated by `bin/rails lostcoords:ui:builders`; `bin/lint` checks this list aga
|
|
|
572
834
|
- `lc_input_class(size: :md, extra: nil)` (FormHelper)
|
|
573
835
|
- `lc_select_class(size: :md, extra: nil)` (FormHelper)
|
|
574
836
|
- `lc_textarea_class(extra: nil)` (FormHelper)
|
|
575
|
-
- `lc_field_class(extra: nil)` (FormHelper)
|
|
576
|
-
- `lc_field_label_class(extra: nil)` (FormHelper)
|
|
837
|
+
- `lc_field_class(size: :md, extra: nil)` (FormHelper)
|
|
838
|
+
- `lc_field_label_class(size: :md, extra: nil)` (FormHelper)
|
|
577
839
|
- `lc_glass_class(shape: :bar, thick: false, extra: nil)` (GlassHelper)
|
|
578
840
|
- `lc_stack_class(gap: :content, extra: nil)` (LayoutHelper)
|
|
579
841
|
- `lc_inline_class(gap: :related, extra: nil)` (LayoutHelper)
|
|
@@ -583,9 +845,8 @@ Generated by `bin/rails lostcoords:ui:builders`; `bin/lint` checks this list aga
|
|
|
583
845
|
- `lc_menu_popover_class(align: :end, extra: nil)` (MenuHelper)
|
|
584
846
|
- `lc_menu_option_class(tone: :default, extra: nil)` (MenuHelper)
|
|
585
847
|
- `lc_link_class(tone: :inherit, extra: nil)` (NavigationHelper)
|
|
586
|
-
- `lc_nav_link_class(compact: false, extra: nil)` (NavigationHelper)
|
|
848
|
+
- `lc_nav_link_class(compact: false, layout: :column, extra: nil)` (NavigationHelper)
|
|
587
849
|
- `lc_prose_class(extra: nil)` (ReadingHelper)
|
|
588
|
-
- `lc_sheet_data(data = {}, detents: "fit")` (SheetHelper)
|
|
589
850
|
- `lc_table_class(extra: nil)` (TableHelper)
|
|
590
851
|
- `lc_tw(*classes)` (TailwindHelper)
|
|
591
852
|
- `lc_heading_class(size: :heading, trim: false, extra: nil)` (TypographyHelper)
|
|
@@ -2,14 +2,20 @@
|
|
|
2
2
|
/* Padding comes from --lc-inset, so a card that sets --lc-inset passes the
|
|
3
3
|
same rhythm to everything inside it. */
|
|
4
4
|
|
|
5
|
-
/*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
/* Fills that are muted on the page (choice tiles, alerts, neutral badges,
|
|
6
|
+
skeletons) switch to the page background, and toggle group tracks to the
|
|
7
|
+
accent fill, so they stay visible on the muted card. Fields and secondary
|
|
8
|
+
buttons take --card-input and --card-secondary. List rows are card
|
|
9
|
+
surfaces too. */
|
|
10
|
+
.lc-card, .lc-list-row {
|
|
10
11
|
--lc-tile-bg: var(--background);
|
|
11
12
|
--lc-track-bg: var(--accent);
|
|
13
|
+
--lc-field-bg: var(--card-input);
|
|
14
|
+
--secondary: var(--card-secondary);
|
|
12
15
|
--lc-avatar-cutout: var(--lc-card-bg, var(--card));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lc-card {
|
|
13
19
|
background: var(--lc-card-bg, var(--card));
|
|
14
20
|
color: var(--card-foreground);
|
|
15
21
|
border: var(--lc-card-border, thin solid transparent);
|
|
@@ -35,6 +35,12 @@
|
|
|
35
35
|
&[data-closing]::details-content { block-size: 0; }
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
& > summary > [data-slot="collapsible-indicator"] {
|
|
39
|
+
transition: rotate 320ms var(--lc-ease-out-expo);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&[open]:not([data-closing]) > summary > [data-slot="collapsible-indicator"] { rotate: 180deg; }
|
|
43
|
+
|
|
38
44
|
/* The global reduced-motion reset's *::after does not reach this pseudo. */
|
|
39
45
|
@media (prefers-reduced-motion: reduce) {
|
|
40
46
|
&::details-content { transition-duration: 0.01ms; }
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/* lc_dialog, with the phone sheet (
|
|
1
|
+
/* lc_dialog and lc_confirm_sheet, with the phone sheet (lc_sheet). */
|
|
2
2
|
@import "../sheet.css";
|
|
3
3
|
@import "../dialog.css";
|
|
4
4
|
@source "../../../../../helpers/lostcoords/ui/dialog_helper.rb";
|
|
5
5
|
@source "../../../../../helpers/lostcoords/ui/sheet_helper.rb";
|
|
6
6
|
@source "../../../../../views/lostcoords/ui/components/_lc_dialog.html.erb";
|
|
7
|
+
@source "../../../../../views/lostcoords/ui/components/_lc_confirm_sheet.html.erb";
|
|
7
8
|
@source "../../../../../javascript/lostcoords/ui/controllers/lc_dialog_controller.js";
|
|
8
9
|
@source "../../../../../javascript/lostcoords/ui/controllers/lc_sheet_controller.js";
|
|
9
|
-
@source "../../../../../javascript/lostcoords/ui/controllers/lc_confirm_dialog_controller.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* lc_search, lc_search_group and lc_search_result. */
|
|
2
|
+
@import "../search.css";
|
|
3
|
+
@source "../../../../../helpers/lostcoords/ui/search_helper.rb";
|
|
4
|
+
@source "../../../../../views/lostcoords/ui/components/_lc_search.html.erb";
|
|
5
|
+
@source "../../../../../javascript/lostcoords/ui/controllers/lc_search_controller.js";
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
layout, typography and navigation. Add the opt-in components in ./components/ that
|
|
4
4
|
you render, or import ../components.css for everything. */
|
|
5
5
|
@import "./theme.css";
|
|
6
|
-
@source "../../../../helpers/lostcoords/ui/{badge,button,card,choice,copy_button,description_list,feedback,form,glass,icon,layout,navigation,primitives,render_attributes,structures,tailwind,translation,typography}_helper.rb";
|
|
6
|
+
@source "../../../../helpers/lostcoords/ui/{badge,button,card,choice,copy_button,description_list,feedback,form,glass,icon,layout,list_group,navigation,primitives,render_attributes,structures,tailwind,translation,typography}_helper.rb";
|
|
7
7
|
@source "../../../../javascript/lostcoords/ui/helpers/*.js";
|
|
8
|
-
@source "../../../../javascript/lostcoords/ui/controllers/lc_{copy,kbd,selection,shortcut,tabs,toggle}_controller.js";
|
|
8
|
+
@source "../../../../javascript/lostcoords/ui/controllers/lc_{copy,kbd,nav,selection,shortcut,tabs,toggle}_controller.js";
|
|
9
9
|
@source "../../../../../lib/lostcoords/ui/parts.rb";
|
|
10
10
|
|
|
11
11
|
@import "./glass.css";
|
|
@@ -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,14 +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);
|
|
22
|
+
transform: var(--lc-popover-from, translateY(--spacing(-1)) scale(0.98));
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
}
|