lostcoords-ui 0.7.0 → 0.8.1
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 +338 -28
- data/app/assets/tailwind/lostcoords/ui/card.css +14 -6
- 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/dialog.css +17 -0
- data/app/assets/tailwind/lostcoords/ui/emoji-picker.css +2 -1
- 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 +33 -15
- data/app/helpers/lostcoords/ui/button_helper.rb +71 -2
- data/app/helpers/lostcoords/ui/choice_helper.rb +9 -16
- data/app/helpers/lostcoords/ui/collapsible_helper.rb +26 -4
- data/app/helpers/lostcoords/ui/dialog_helper.rb +52 -12
- data/app/helpers/lostcoords/ui/form_helper.rb +30 -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 +95 -0
- data/app/helpers/lostcoords/ui/menu_helper.rb +84 -13
- data/app/helpers/lostcoords/ui/navigation_helper.rb +57 -12
- data/app/helpers/lostcoords/ui/primitives_helper.rb +128 -34
- data/app/helpers/lostcoords/ui/render_attributes_helper.rb +3 -1
- data/app/helpers/lostcoords/ui/search_helper.rb +55 -0
- data/app/helpers/lostcoords/ui/sheet_helper.rb +20 -8
- data/app/helpers/lostcoords/ui/structures_helper.rb +114 -20
- 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 +288 -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 +28 -16
- data/app/views/lostcoords/ui/components/_lc_floating_panel.html.erb +11 -6
- data/app/views/lostcoords/ui/components/_lc_search.html.erb +26 -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 +72 -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: db54a76098cb1b3f4c681f8fb3f6d71c7f471f7591bf207acf3033f08f5a1959
|
|
4
|
+
data.tar.gz: bca0af8ce9fa3ce85af477e2dca0040d47f73fb39a89de668d35dbe675363f75
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2796617e1b75150f50196f739ee940408eabb78d4373451bfccac04c8e8ac0a70133daa8518d03668a0dad03b8e24f9a5a461db338429ec0abaa605d2e1aab3
|
|
7
|
+
data.tar.gz: 48d9fdb18abe90101be6f791965b2ccd9fe628799c4ac882a8dd586f2c8a7a34834a97663df1512d638dfbfcf06f0139a95db4d107837b276af4991ecdce05fa
|
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,53 @@ 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
|
+
## Changes in 0.8.1
|
|
198
|
+
|
|
199
|
+
Nothing needs an edit, but these look different:
|
|
200
|
+
|
|
201
|
+
- **A secondary destructive button has a soft destructive fill.** Before: `variant: :secondary, tone: :destructive`
|
|
202
|
+
kept the neutral secondary fill with destructive ink. After: it fills with the same soft destructive mix a
|
|
203
|
+
destructive ghost button shows on hover, so the tones read solid, soft, then ink only.
|
|
204
|
+
- **Toggles style `aria-checked`.** An `lc_toggle_class` element with `aria-checked="true"` now looks pressed, so
|
|
205
|
+
toggle pills can be the radios of a `variant: :pills` toggle group.
|
|
206
|
+
- **A toggle's fill follows `--lc-field-bg`.** Before: `lc_toggle` always filled with `--input`. After: it reads
|
|
207
|
+
`--lc-field-bg` like fields and the select trigger, so on a card or list row it takes `--card-input`.
|
|
208
|
+
- **The emoji picker's skin-tone menu opens downward.** Before: it opened above its toggle, which sits in the
|
|
209
|
+
picker's top row, so it escaped the picker. After: it opens below the toggle, inside the picker.
|
|
210
|
+
- **A card's destructive edge ignores its closed menus.** Before: a destructive option in a menu or popover
|
|
211
|
+
inside a card (a row's "Remove") tinted the card's edge. After: only the card's own controls and invalid
|
|
212
|
+
fields do.
|
|
213
|
+
|
|
214
|
+
## Upgrading from 0.7
|
|
215
|
+
|
|
216
|
+
Everything else in 0.8 is additive. These changes need edits in an app built on 0.7:
|
|
217
|
+
|
|
218
|
+
- **A named `lc_toggle_group` renders native radios.** Before: `lc_toggle_group(name:)` rendered radio
|
|
219
|
+
buttons, a hidden input and the `lc-selection` controller. After: each item is a `label` around an
|
|
220
|
+
`input type=radio` with that name, so listen for the inputs' `change` instead of `lc-selection:change`, and
|
|
221
|
+
mark the selected item with `checked:` or the group's `value:` instead of `selected:`. A group without
|
|
222
|
+
`name:` keeps the radio buttons and `lc-selection:change`; it no longer has an `input` target.
|
|
223
|
+
- **`lc_sheet_data` is gone.** Before: `tag.dialog data: lc_sheet_data({ controller: "picker" }, detents: "large")`.
|
|
224
|
+
After: `lc_sheet tag: :dialog, detents: "large", data: { controller: "picker" }`. `lc_sheet` also renders
|
|
225
|
+
non-dialog sheets, so drop any hand-written `data-controller="lc-sheet"` and handle element too.
|
|
226
|
+
- **The `lc-confirm-dialog` controller is gone.** Before: a pre-rendered confirm `<dialog>` wired to
|
|
227
|
+
`lc-confirm-dialog`. After: render `lc_confirm_sheet` once in the layout and put `data-turbo-confirm` on
|
|
228
|
+
the form, with `data-turbo-confirm-description`, `data-turbo-confirm-accept` and
|
|
229
|
+
`data-turbo-confirm-tone` for its description, label and tone.
|
|
230
|
+
- **A modal `lc_dialog` is 32rem wide on desktop.** Before: `min(92vw, 31rem)`. After: `size: :md`,
|
|
231
|
+
`min(32rem, 100vw - 2rem)`. Pass `size: :sm` (24rem) for a narrower dialog, or set `--lc-dialog-width`.
|
|
232
|
+
- **`lc_dialog` puts your content in a body slot.** Before: the block rendered straight after the header
|
|
233
|
+
inside `[data-slot=dialog-content]`. After: it renders inside `[data-slot=dialog-body]`, which scrolls on
|
|
234
|
+
desktop, and the close button sits in `[data-slot=dialog-actions]`. Update CSS that selects children of
|
|
235
|
+
`dialog-content`.
|
|
236
|
+
- **A swiped-away popover sheet hides itself.** Before: `lc-sheet:dismiss` only notified listeners on a
|
|
237
|
+
non-dialog sheet. After: an open `[popover]` sheet hides unless a listener calls `preventDefault()`.
|
|
238
|
+
- **An unpadded `lc_card` no longer gaps its children.** Before: `lc_card(padding: :none)` stacked its
|
|
239
|
+
children `--lc-inset` apart. After: they meet edge to edge, as rows and empty states in an unpadded card
|
|
240
|
+
expect. Pass `class: "gap-inset"` to keep the old spacing.
|
|
241
|
+
- **`lc_text(size: :label)` is semibold.** Before: weight 500. After: 600, the same as a field label, so
|
|
242
|
+
one label role serves both. Add `class: "font-medium"` where the lighter weight was intended.
|
|
243
|
+
|
|
194
244
|
## Components
|
|
195
245
|
|
|
196
246
|
[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 +259,44 @@ Button hover and press fills mix 94% of the base background with 6% of its foreg
|
|
|
209
259
|
Ghost and icon buttons stay transparent at rest and use the secondary base for that calculation.
|
|
210
260
|
Apps can override `--secondary` for the neutral base, or `--lc-button-bg` and `--lc-button-ink` on individual buttons.
|
|
211
261
|
Inputs use `--input` and `--lc-input-hover`.
|
|
212
|
-
`lc_button_to` preserves Rails' form, HTTP method and CSRF behavior. Block helpers capture ERB content.
|
|
262
|
+
`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. Icon buttons take `lc_button`'s `variant:` and `tone:` too; the default `:ghost` is the quiet toolbar look. `block: true` makes any button full width. Block helpers capture ERB content.
|
|
213
263
|
Use `icon: "plus"` for a leading Heroicon or `icon_position: :end` for a trailing one. Custom icons and
|
|
214
264
|
spinners use `data-icon="inline-start"` or `data-icon="inline-end"`; buttons adjust that edge's padding.
|
|
265
|
+
`lc_button(expanded_icon: "x-mark")` swaps its content for that icon while `aria-expanded` is true, for a trigger
|
|
266
|
+
that closes what it opened; the content stays as the accessible name.
|
|
267
|
+
`lc_button(as: :span)` renders the look without a control, for a decorative button inside a larger target such as
|
|
268
|
+
a file drop zone's label; give it `aria: { hidden: true }` when the target already names the action.
|
|
269
|
+
`tone: :destructive` recolours any variant for destructive actions and keeps its emphasis: a ghost or
|
|
270
|
+
outline button takes destructive ink, a secondary button a soft destructive fill (the ghost button's hover),
|
|
271
|
+
and a primary button becomes the filled `variant: :destructive` surface.
|
|
272
|
+
`lc_select_trigger` is a button that looks like `lc_select`, for buttons that open a menu or picker. Its label
|
|
273
|
+
starts at the inline start and its chevron sits at the inline end and turns while `aria-expanded` is true.
|
|
274
|
+
`lc_split_button` is one pill with two targets: a primary action, a link with `href:`, and a square toggle
|
|
275
|
+
named by `menu_label:` that opens a menu of the block's `lc_menu_option` items. The toggle draws a divider
|
|
276
|
+
from its ink and keeps its pressed fill while open. It takes the button's `variant:`, `tone:`, `size:` and
|
|
277
|
+
`icon:`; `action:`, `toggle:` and `menu:` add attributes to those parts.
|
|
215
278
|
|
|
216
279
|
```erb
|
|
217
280
|
<%= lc_button_to "Archive", project_path(@project), method: :delete, variant: :destructive %>
|
|
281
|
+
<%= lc_button_to "Revoke", api_key_path(@key), method: :delete, variant: :ghost, tone: :destructive %>
|
|
282
|
+
<%= lc_select_trigger "All members", aria: { haspopup: "menu", expanded: false } %>
|
|
283
|
+
<%= lc_split_button "Add expense", id: "add-menu", href: new_expense_path, icon: "plus", menu_label: "More ways to add" do %>
|
|
284
|
+
<%= lc_menu_option "Import a CSV", icon: "arrow-down-tray" %>
|
|
285
|
+
<% end %>
|
|
218
286
|
<%= lc_icon_button "Settings", icon: "cog-6-tooth" %>
|
|
287
|
+
<%= lc_icon_button_link_to "Back", projects_path, icon: "chevron-left" %>
|
|
288
|
+
<%= lc_icon_button_to "Delete", attachment_path(@attachment), icon: "trash", method: :delete %>
|
|
289
|
+
<%= lc_icon_button "Account" do %><%= lc_avatar current_user.initials %><% end %>
|
|
219
290
|
|
|
220
|
-
<%= lc_button
|
|
291
|
+
<%= lc_button block: true, data: { action: "editor#save" }, aria: { busy: true } do %>
|
|
221
292
|
<%= lc_spinner size: :sm %>
|
|
222
293
|
Saving…
|
|
223
294
|
<% end %>
|
|
224
295
|
```
|
|
225
296
|
|
|
226
297
|
Use native attributes for application behavior, `class:` to merge additional Tailwind utilities, and
|
|
227
|
-
theme tokens to restyle the library. `
|
|
298
|
+
theme tokens to restyle the library. `popover: true` renders `popover="auto"`, as a bare `popover`
|
|
299
|
+
attribute does. `lc_field` yields the input's `id` and validation attributes so
|
|
228
300
|
labels, hints and errors stay connected. Linked cards use `lc_card(href: ...)`; cards containing
|
|
229
301
|
buttons or fields remain ordinary containers.
|
|
230
302
|
|
|
@@ -233,19 +305,98 @@ Wrap wide tables in an app-owned horizontal scroll region with an accessible nam
|
|
|
233
305
|
Use `lc_table_class` when an existing table renderer owns the markup.
|
|
234
306
|
|
|
235
307
|
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
|
-
|
|
308
|
+
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
309
|
Add `class: "@container"` when a card owns its width and its children use container queries.
|
|
238
310
|
Use `--lc-card-bg`, `--lc-card-border`, `--lc-card-radius` and `--lc-card-shadow` for local appearance overrides.
|
|
239
311
|
|
|
240
|
-
`lc_badge` handles labels, counts and status.
|
|
241
|
-
`lc_icon_badge` handles decorative icon containers,
|
|
312
|
+
`lc_badge` handles labels, counts and status. Pass `shape: :pill` for a fully rounded label such as "You" or an error count.
|
|
313
|
+
`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`, `:circle` or `:plain` (no tile and a larger glyph, as at the start of a list row) and `sm` (26px), `md` (40px), `lg` (48px) or `xl` (56px) sizes.
|
|
314
|
+
`lc_avatar` sizes are `xs` (20px), `sm` (26px), `md` (32px), `lg` (48px), `xl` (96px) and `xxl` (112px).
|
|
315
|
+
Between them, both take a step on the spacing scale, as in `size-7`: `lc_avatar` takes `7` (28px) and `11` (44px),
|
|
316
|
+
`lc_icon_badge` takes `6` (24px), `7` (28px) and `11` (44px).
|
|
317
|
+
Pass `as: :button` when the avatar is itself the control, such as a colour picker's trigger. `lc_avatar_stack`
|
|
318
|
+
takes `row:` attributes for the inner row that overlaps the avatars, such as a controller target.
|
|
319
|
+
Initials and icons scale with the size, including a size set through `--lc-avatar-size` or `--lc-icon-badge-size`;
|
|
320
|
+
set `--lc-avatar-font-scale` or `--lc-icon-badge-font-scale` to change the share, or the `-font-size` variable to pin it.
|
|
242
321
|
Badge, icon badge, Alert and Toast share `neutral`, `primary`, `success`, `warning` and `destructive` tones.
|
|
243
322
|
|
|
244
|
-
`lc_toggle` renders a
|
|
245
|
-
|
|
323
|
+
`lc_toggle` renders a button that flips its own `aria-pressed`; set `aria-pressed` or `aria-expanded` yourself
|
|
324
|
+
and it leaves the state to your controller. `href:` renders a link marked `aria-current` when active, and `name:`
|
|
325
|
+
with `value:` a label around a visually hidden native radio, styled by `:checked`.
|
|
326
|
+
`lc_toggle_group` with `lc_toggle_group_item` holds mutually exclusive choices, and the group decides what its items are.
|
|
327
|
+
With `name:` they are native radios in labels, which bring their own arrows, submitted value and reset; items take
|
|
328
|
+
`value:` and `checked:`, and the group's `value:` checks the matching item. With `as: :nav` they are links in a
|
|
329
|
+
labelled `nav`; items take `href:` and `current:`. Otherwise they are radio buttons whose selection lives in the
|
|
330
|
+
`lc-selection` controller, which dispatches `lc-selection:change`; items take `value:` and `selected:`. An item
|
|
331
|
+
given another kind's arguments raises. `variant: :pills` lays any of them out as wrapping toggle pills, sized by `size:`, instead of a segmented track.
|
|
332
|
+
|
|
333
|
+
```erb
|
|
334
|
+
<%= lc_toggle_group label: "Period", as: :nav do %>
|
|
335
|
+
<%= lc_toggle_group_item "Month", href: stats_path(period: :month), current: true %>
|
|
336
|
+
<%= lc_toggle_group_item "Year", href: stats_path(period: :year) %>
|
|
337
|
+
<% end %>
|
|
338
|
+
<%= lc_toggle_group label: "Billing", name: "billing", value: "monthly" do %>
|
|
339
|
+
<%= lc_toggle_group_item "Monthly", value: "monthly" %>
|
|
340
|
+
<%= lc_toggle_group_item "Annual", value: "annual" %>
|
|
341
|
+
<% end %>
|
|
342
|
+
<%= lc_toggle "Food", aria: { pressed: false }, data: { value: "food" } %>
|
|
343
|
+
```
|
|
344
|
+
|
|
246
345
|
`lc_collapsible` expands content through a native `<details>` element. `lc_alert` renders persistent inline feedback;
|
|
247
346
|
`lc_toast` adds timed dismissal.
|
|
248
347
|
|
|
348
|
+
```erb
|
|
349
|
+
<%= lc_collapsible card: false, indicator: :chevron, summary_class: "rounded-2xl px-3 hover:bg-accent" do |collapsible| %>
|
|
350
|
+
<% collapsible.summary do %><span class="me-auto">Language</span><span>English</span><% end %>
|
|
351
|
+
…
|
|
352
|
+
<% end %>
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
The `summary` part replaces `title:` with your own markup and takes attributes for the `<summary>`.
|
|
356
|
+
`card: false` drops the card surface, `summary_class:` adds classes to the summary, `button: { variant:, tone:, size: }`
|
|
357
|
+
makes the summary look like that `lc_button` without the native marker, and `indicator:` is `:marker` (native),
|
|
358
|
+
`:chevron` (turns as it opens) or `:none`.
|
|
359
|
+
|
|
360
|
+
```erb
|
|
361
|
+
<%= lc_list_section "Security", id: "security", footnote: "Keep one way to sign in." do %>
|
|
362
|
+
<%= lc_list_group do %>
|
|
363
|
+
<%= lc_list_row "Email", subtitle: "ada@example.com", icon: "envelope" do %>
|
|
364
|
+
<%= lc_button "Change", variant: :secondary, size: :sm %>
|
|
365
|
+
<% end %>
|
|
366
|
+
<%= lc_list_row "Alerts", tag: :label do %><%= check_box_tag :alerts, class: lc_switch_class %><% end %>
|
|
367
|
+
<% end %>
|
|
368
|
+
<% end %>
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
`lc_list_group` draws grouped settings rows: each row is its own card-coloured panel, 2px apart, and
|
|
372
|
+
only the group's ends round. Rows are card surfaces, so fields and buttons in them follow
|
|
373
|
+
`--card-input` and `--card-secondary`. `lc_list_row` with a title lays out `icon:` (a name, or your own
|
|
374
|
+
markup such as a logo), the title, `subtitle:` and the block as trailing content; `tag:` makes it a
|
|
375
|
+
`label`, `li`, `details` or `a` (`href:`). Without a title the block is the whole row, and
|
|
376
|
+
`padded: false` leaves the padding to content such as an `lc_list_item` button or summary, which lays
|
|
377
|
+
out the same icon, title and subtitle inside your own element. `lc_list_section` adds the heading and
|
|
378
|
+
footnote; with an `id:`, the heading labels the section. Put a form around `lc_list_group` inside it
|
|
379
|
+
when the rows save together.
|
|
380
|
+
|
|
381
|
+
`lc_list_field` is a form row in the same group: a label column, then the block as the control. In a
|
|
382
|
+
narrow row the label folds to its `icon:`, and the text stays the accessible name. `id:` makes the label
|
|
383
|
+
a `<label>` for that control; `tag: :fieldset` names a group of controls, such as chips, with a legend.
|
|
384
|
+
`tag: :span, surface: false` draws the row inside another element, such as a collapsible's summary.
|
|
385
|
+
`lc_input(plain: true)` drops the field's fill, border, padding and height so the text sits in the row,
|
|
386
|
+
which tints while that input has focus. Toggles take `--lc-field-bg` like fields, so on a card or list
|
|
387
|
+
row they use `--card-input`.
|
|
388
|
+
|
|
389
|
+
```erb
|
|
390
|
+
<%= lc_list_group do %>
|
|
391
|
+
<%= lc_list_field "Description", icon: "pencil", id: "description" do %>
|
|
392
|
+
<%= lc_input plain: true, id: "description", name: "description" %>
|
|
393
|
+
<% end %>
|
|
394
|
+
<%= lc_list_field "Paid by", icon: "user", tag: :fieldset do %>
|
|
395
|
+
<div class="flex flex-wrap gap-related"><%= lc_toggle "Ada", size: :sm, aria: { pressed: true } %></div>
|
|
396
|
+
<% end %>
|
|
397
|
+
<% end %>
|
|
398
|
+
```
|
|
399
|
+
|
|
249
400
|
### Parts and slots
|
|
250
401
|
|
|
251
402
|
Compound components yield a builder, so their parts are scoped and discoverable. A card stacks its
|
|
@@ -281,7 +432,7 @@ signatures and render library controls; `field` adds the label, hint and the att
|
|
|
281
432
|
sets `aria-invalid` on the control. Rails' `field_with_errors` wrapper does not affect the layout.
|
|
282
433
|
|
|
283
434
|
```erb
|
|
284
|
-
<%= lc_form_with model: @project,
|
|
435
|
+
<%= lc_form_with model: @project, gap: :content do |form| %>
|
|
285
436
|
<%= form.field :name, hint: "Shown to members" %>
|
|
286
437
|
<%= form.field :email, as: :email_field %>
|
|
287
438
|
<%= form.switch :public %>
|
|
@@ -289,13 +440,25 @@ sets `aria-invalid` on the control. Rails' `field_with_errors` wrapper does not
|
|
|
289
440
|
<% end %>
|
|
290
441
|
```
|
|
291
442
|
|
|
443
|
+
`gap:` makes the form a stack and `card: true` (with `padding:`) makes the form the card, so neither
|
|
444
|
+
needs a wrapper element. Nested `fields_for` builders render library controls too, and
|
|
445
|
+
`form.check_box :x, role: "switch"` draws a switch inside a label row you build yourself.
|
|
446
|
+
`form.submit` and `form.button` take `lc_button`'s `variant:`, `tone:`, `size:` and `block:`.
|
|
447
|
+
|
|
292
448
|
A symbol `size:` such as `size: :sm` picks the control height; an integer still sets the HTML
|
|
293
|
-
attribute.
|
|
449
|
+
attribute. `form.field … size: :sm` (or `lc_field size: :sm`) is the compact field for dense forms,
|
|
450
|
+
with a caption label. Pass `builder: Lostcoords::Ui::FormBuilder` to `form_with` directly, or call `lc_field`
|
|
294
451
|
with `error: record.errors.full_messages_for(:name)` when you keep your own builder.
|
|
295
452
|
|
|
296
453
|
`lc_checkbox`, `lc_radio` and `lc_switch` render native inputs with a label and optional hint.
|
|
297
454
|
Checkboxes and switches submit an unchecked value like Rails' `check_box`; pass `unchecked_value: nil`
|
|
298
|
-
to omit it. `
|
|
455
|
+
to omit it. A `nil` label renders the bare input, for a row selector the row labels; give it
|
|
456
|
+
`aria: { label: }`. `lc_choice_group` groups them in a fieldset with a legend, hint and error.
|
|
457
|
+
|
|
458
|
+
`lc_fieldset(legend:, id: nil, hint: nil, error: nil, size: :md)` names a group of controls that no single
|
|
459
|
+
label can, such as toggles, a picker or several inputs; with an `id`, its hint and error describe the fieldset,
|
|
460
|
+
and `size: :sm` matches a compact `lc_field`. `lc_choice_group` is `lc_fieldset` with its choices stacked.
|
|
461
|
+
Text that labels something other than one control, such as a list, uses `lc_text size: :label`, the field label's role.
|
|
299
462
|
|
|
300
463
|
### Navigation and overlays
|
|
301
464
|
|
|
@@ -319,7 +482,7 @@ to omit it. `lc_choice_group` groups them in a fieldset with a legend, hint and
|
|
|
319
482
|
|
|
320
483
|
Tabs follow the ARIA tabs pattern with arrow key, Home and End navigation, and dispatch
|
|
321
484
|
`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
|
|
485
|
+
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
486
|
their trigger, in the top layer; keep essential information visible. Description lists stack on phones and use two
|
|
324
487
|
columns from `sm`.
|
|
325
488
|
|
|
@@ -338,8 +501,20 @@ columns from `sm`.
|
|
|
338
501
|
Read the <%= lc_link "guide", guide_path %>.
|
|
339
502
|
```
|
|
340
503
|
|
|
341
|
-
|
|
342
|
-
|
|
504
|
+
```erb
|
|
505
|
+
<%= lc_nav_list label: "Project", layout: :responsive, indicator: true do |nav| %>
|
|
506
|
+
<%= nav.link "Overview", project_path(@project), icon: "document-text", current: true %>
|
|
507
|
+
<%= nav.link "Activity", project_activity_path(@project), icon: "clock" %>
|
|
508
|
+
<% end %>
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
`lc_nav_list` marks the current link with `aria-current="page"`. Its default `layout: :column` is a
|
|
512
|
+
sidebar, where `compact: true` is the quieter style for an "On this page" list and `indent: true`
|
|
513
|
+
nests a link. `layout: :row` lays links in a line, `:dock` stacks each icon above its label in equal
|
|
514
|
+
cells for a phone's bottom bar, and `:responsive` is a dock below `sm` and a row from `sm`; position a
|
|
515
|
+
dock yourself, such as `fixed bottom-0`. `indicator: true` slides one fill to the current link, and
|
|
516
|
+
after a Turbo visit the new list starts the fill where the last one left it. Set `--lc-nav-indicator`
|
|
517
|
+
(or `--lc-nav-dock-indicator` for a dock, such as one on glass) to change the fill, and pass `layout:` to `lc_nav_link_class` for links you render yourself. `lc_pager` takes `[title, url]`
|
|
343
518
|
for each side and `compact: true` for icon buttons. `lc_link` has `inherit`, `muted` and `primary`
|
|
344
519
|
tones; `lc_link_class` styles links you render yourself. `lc_skip_link` targets `#main` by default.
|
|
345
520
|
Pass `card: true` to `lc_radio` or `lc_checkbox` for selectable tiles; a block adds content, such as a
|
|
@@ -348,10 +523,134 @@ preview, under the label.
|
|
|
348
523
|
This documentation site is built with these components and two copyable blocks: the application
|
|
349
524
|
header and the documentation layout.
|
|
350
525
|
|
|
526
|
+
```erb
|
|
527
|
+
<%= lc_menu id: "member-actions", label: "Actions for #{member.name}", trigger: :icon do %>
|
|
528
|
+
<%= lc_menu_option "Rename", icon: "pencil" %>
|
|
529
|
+
<%= lc_menu_option "Euro", hint: "EUR", leading: tag.span("€"), checked: true %>
|
|
530
|
+
<%= lc_menu_option "Remove", icon: "trash", href: member_path(member), method: :delete, tone: :destructive %>
|
|
531
|
+
<% end %>
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
Menu options take a leading `icon:` or other rendered `leading:` content, which is hidden from
|
|
535
|
+
assistive technology so the label stays the name. Leading visuals share one column across the menu, so
|
|
536
|
+
labels line up with and without them. `hint:` adds a secondary line. `checked: true` or `false` makes
|
|
537
|
+
a `menuitemradio` with a check mark. `checkbox: true` makes a `menuitemcheckbox` that flips its
|
|
538
|
+
`aria-checked` on click, dispatches `lc-menu:check` with `{ checked }`, and leaves the menu open.
|
|
539
|
+
`method:` renders a `button_to` form and passes `params:` and `form:` on.
|
|
540
|
+
`lc_menu_group(label, id:)` wraps options in a `role="group"` labelled by an eyebrow heading; its
|
|
541
|
+
options stay on the menu's columns.
|
|
542
|
+
`lc_menu` and `lc_popover` take `trigger: false` to render only the panel, named by `label:` (or
|
|
543
|
+
`title:`), when an ancestor hosts the `lc-menu` or `lc-popover` controller and wires its own
|
|
544
|
+
`trigger` targets. With `click->lc-popover#toggleFromRow` on that host, a click anywhere on it that
|
|
545
|
+
misses a control opens the panel; mark other regions `data-lc-menu-ignore`.
|
|
546
|
+
`lc_menu` and `lc_popover` take `trigger: :icon` with `icon:` for a quiet icon button named by `label:`,
|
|
547
|
+
or rendered content such as an avatar for a custom trigger. `trigger_attributes:` adds attributes such as `class:` or `title:` to either.
|
|
548
|
+
For any other trigger, call the yielded part's `trigger` with a block. It receives the attributes that
|
|
549
|
+
wire an element as the trigger (its id, `aria-haspopup`, `aria-expanded`, `aria-controls` and the
|
|
550
|
+
Stimulus target and action), merged with any passed to `trigger`, and the element it renders replaces
|
|
551
|
+
the default button:
|
|
552
|
+
|
|
553
|
+
```erb
|
|
554
|
+
<%= lc_menu id: "member-filter", label: "Member" do |menu| %>
|
|
555
|
+
<% menu.trigger(class: "min-w-44") { |attrs| lc_select_trigger "All members", **attrs } %>
|
|
556
|
+
<%= lc_menu_option "Alex" %>
|
|
557
|
+
<% end %>
|
|
558
|
+
```
|
|
559
|
+
The icon trigger is muted at rest, with full ink and a slightly larger icon on hover, focus and while open.
|
|
560
|
+
`wrapper_attributes:` styles the element that holds the trigger and panel, an `inline-flex` box by default,
|
|
561
|
+
for example `class: "flex min-w-0"` when the trigger fills a grid cell. A `data: { controller: }` there joins the panel's own.
|
|
562
|
+
|
|
351
563
|
`lc_dialog` handles modal content and the mobile sheet layout. Set `detents: "medium large"` or `"large"`
|
|
352
564
|
to choose mobile height stops; the default is `"fit"`. Icon buttons, avatar groups, motion and mobile dialogs
|
|
353
565
|
appear with their parent component examples.
|
|
354
566
|
|
|
567
|
+
`size:` sets the desktop width: `:sm` (24rem), `:md` (32rem, the modal default), `:lg` (40rem) or `:xl`
|
|
568
|
+
(64rem). Content marked `data-dialog-size="xl"` (any size) switches the dialog to that size while it is in
|
|
569
|
+
the dialog, for a step that needs more room. The size sets `--lc-dialog-width`, so content can size itself
|
|
570
|
+
with `calc(var(--lc-dialog-width) - 2px)`. On desktop the header stays put and the body scrolls; an anchored
|
|
571
|
+
dialog stops 1rem above the viewport's bottom edge. `dialog.actions` adds content to the header, before the
|
|
572
|
+
close button. `dialog.trigger { |attrs| … }` renders your own element as the trigger, like `menu.trigger`:
|
|
573
|
+
splat `**attrs` into it to wire it to open the dialog. Pass `trigger: false` when a controller of your own opens the dialog: only the `<dialog>` renders,
|
|
574
|
+
and `close_action:` (default `"lc-dialog#close"`) and `close_label:` wire the close buttons to it. `data:`
|
|
575
|
+
and `aria:` reach the `<dialog>`; `title_attributes:` and `description_attributes:` reach the heading and
|
|
576
|
+
description, for a controller that rewrites them.
|
|
577
|
+
|
|
578
|
+
```erb
|
|
579
|
+
<div data-controller="import">
|
|
580
|
+
<button type="button" data-action="import#open">Import</button>
|
|
581
|
+
<%= lc_dialog id: "import", title: "Import", trigger: false, size: :lg, close_action: "import#close",
|
|
582
|
+
data: { import_target: "dialog" } do |dialog| %>
|
|
583
|
+
…
|
|
584
|
+
<% end %>
|
|
585
|
+
</div>
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
`lc_confirm_sheet` replaces the browser's confirm for `data-turbo-confirm`. Render it once in the layout
|
|
589
|
+
and hand Turbo the gem's function:
|
|
590
|
+
|
|
591
|
+
```js
|
|
592
|
+
import { confirm } from "lostcoords/ui/helpers/confirm"
|
|
593
|
+
Turbo.config.forms.confirm = confirm
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
The sheet shows the message as its title, Cancel and a confirm button. The submitter, then the form, can
|
|
597
|
+
add `data-turbo-confirm-description` (a line under the title) and `data-turbo-confirm-accept` (the confirm
|
|
598
|
+
button's label; without it a short submitter label is used). The confirm button is destructive when either
|
|
599
|
+
has `data-turbo-confirm-tone="destructive"`, or the submitter is an `lc_button_to` with
|
|
600
|
+
`variant: :destructive` or an `lc_menu_option` with `tone: :destructive`. Confirming from an `lc_menu` opens
|
|
601
|
+
the sheet beside the menu on desktop. `ask(message, { description, accept, destructive, anchor })` from the
|
|
602
|
+
same module opens it from your own code and resolves to `true` or `false`.
|
|
603
|
+
|
|
604
|
+
`lc_sheet` renders any other phone sheet, with the `lc-sheet` controller wired. `tag: :dialog` makes a
|
|
605
|
+
modal `<dialog>` sheet, which is what `lc_dialog` and `lc_confirm_sheet` render; with `size:` it gets
|
|
606
|
+
`lc_dialog`'s frame and width without its header, for content that brings its own. The default `tag: :div`
|
|
607
|
+
shows while it is `:popover-open` or carries `[data-open]`, so a native `[popover]` and a FloatingPanel
|
|
608
|
+
picker both work; a div you toggle yourself sets `data-open` and removes it to slide out. From `sm` up
|
|
609
|
+
the div keeps your frame, or `anchored: true` makes it a popover under its trigger inside a positioned
|
|
610
|
+
ancestor. `detents:` takes the same stops as `lc_dialog`, and `handle: true` adds a grab strip above the
|
|
611
|
+
content. A swipe down dispatches `lc-sheet:dismiss`; unless a listener cancels it, an open popover then
|
|
612
|
+
hides.
|
|
613
|
+
|
|
614
|
+
```erb
|
|
615
|
+
<button type="button" popovertarget="filters">Filters</button>
|
|
616
|
+
<%= lc_sheet id: "filters", popover: "auto", class: "sm:w-80 sm:rounded-3xl sm:bg-popover",
|
|
617
|
+
data: { action: "lc-sheet:dismiss->filters#reset" } do %>…<% end %>
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
`lc-popover-shell` gives a native `[popover]` menu the same enter and exit as FloatingPanel panels. Set
|
|
621
|
+
`--lc-popover-from` to change the closed pose and an `origin-*` utility for where it grows from.
|
|
622
|
+
|
|
623
|
+
### Search
|
|
624
|
+
|
|
625
|
+
`lc_search` renders a search trigger, a pill with the ⌘K hint that shrinks to an icon on phones, and
|
|
626
|
+
the full-screen search it opens. Attributes go to the trigger, which is what sits in your layout.
|
|
627
|
+
Build results from `lc_search_group` and `lc_search_result`.
|
|
628
|
+
|
|
629
|
+
```erb
|
|
630
|
+
<%= lc_search label: "Search", src: search_path %>
|
|
631
|
+
|
|
632
|
+
<%# app/views/searches/show.html.erb, rendered without a layout for lc_search's requests %>
|
|
633
|
+
<%= lc_search_group "Projects" do %>
|
|
634
|
+
<% @projects.each do |project| %>
|
|
635
|
+
<%= lc_search_result project.name, project_path(project), detail: project.client, icon: "folder" %>
|
|
636
|
+
<% end %>
|
|
637
|
+
<% end %>
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
With `src:`, each pause in typing requests `src` with the query in `param` (`q` by default) and shows
|
|
641
|
+
the HTML the server answers; that endpoint is yours, as a Turbo Frame's would be. Without
|
|
642
|
+
JavaScript the field submits the same GET, so a full search page still works. Without `src:`, the
|
|
643
|
+
rows rendered in the block are filtered in the browser by their text and `keywords:`. To search
|
|
644
|
+
another way, handle `lc-search:query`, call `preventDefault()` and fill `event.detail.results` with
|
|
645
|
+
the same helpers' markup, cloned from a `<template>`; the docs search does this with MiniSearch.
|
|
646
|
+
|
|
647
|
+
The block also renders what shows before anything is typed. Arrow keys move through the results,
|
|
648
|
+
Enter opens the first one, and choosing a result or pressing Escape closes search and returns focus.
|
|
649
|
+
Groups without a visible result hide, a query with none shows the empty note, and a status region
|
|
650
|
+
announces the count. `empty:` sets that note, with `%{query}` standing for the query, and `prompt:`
|
|
651
|
+
adds a note for when nothing is typed and there is nothing to show. While `src` is answering, the
|
|
652
|
+
panel is `aria-busy` and both notes wait, so they never flash before the results arrive. Pass `shortcut: nil` to drop the page shortcut, and `id:` when a page has two searches.
|
|
653
|
+
|
|
355
654
|
### Keyboard
|
|
356
655
|
|
|
357
656
|
Every interactive component works from the keyboard without extra code:
|
|
@@ -405,6 +704,12 @@ ordered by `--lc-z-popover`, `--lc-z-overlay` and `--lc-z-toast`.
|
|
|
405
704
|
<%= turbo_stream.append "toasts" do %><%= lc_toast "Project saved." %><% end %>
|
|
406
705
|
```
|
|
407
706
|
|
|
707
|
+
The region sits at the bottom-end corner. `placement:` takes `:bottom_end`, `:bottom_center`,
|
|
708
|
+
`:top_end` or `:top_center`, and `mobile_placement:` takes the same values below `sm`, as in
|
|
709
|
+
`lc_toast_region id: "toasts", placement: :bottom_center, mobile_placement: :top_center`. The region
|
|
710
|
+
keeps clear of the safe area; set `--lc-toast-offset` to move it further from the edges, or
|
|
711
|
+
`--lc-toast-offset-top` and `--lc-toast-offset-bottom` for one edge, such as below a sticky header.
|
|
712
|
+
|
|
408
713
|
While a modal dialog or sheet is open the page behind it can't scroll: the body is pinned with
|
|
409
714
|
`position: fixed` and marked `data-modal-scroll-lock="true"`, so `window.scrollY` reads 0 until it
|
|
410
715
|
closes. Scroll-driven chrome, such as a header that fills in once the page scrolls, should keep its
|
|
@@ -496,9 +801,13 @@ spacing between children, including fields. Inline `<code>` elements get a share
|
|
|
496
801
|
```
|
|
497
802
|
|
|
498
803
|
Heading sizes are `display`, `title`, `heading` and `subheading`. Text sizes are `body`, `small`,
|
|
499
|
-
`label` and `
|
|
500
|
-
|
|
501
|
-
|
|
804
|
+
`label`, `caption` and `eyebrow`, with `default` and `muted` tones. `lc_text_class(size: :eyebrow, tone: :muted)`
|
|
805
|
+
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.
|
|
806
|
+
Stacks and inline groups take the spacing names from [Foundations](#foundations). `lc_stack`, `lc_inline`,
|
|
807
|
+
`lc_text` and `lc_card` take `as:` to render a meaningful element, such as `lc_stack(as: :ul)`, `lc_text(as: :span)` or
|
|
808
|
+
`lc_card(as: :section)`. `lc_section` leaves
|
|
809
|
+
`heading` below its title and `content` between blocks. `lc_section_header` is that heading row on its own,
|
|
810
|
+
for a heading that needs more than a title, such as a lede under it. `lc_container` provides `page`, `reading` and
|
|
502
811
|
`form` widths; only the page container adds gutters. Japanese headings inherit `lang="ja"` and use
|
|
503
812
|
natural letter spacing.
|
|
504
813
|
|
|
@@ -531,6 +840,7 @@ to tune a reading context. Use `not-prose` for embedded components.
|
|
|
531
840
|
|
|
532
841
|
Class helpers remain available for custom markup. The application owns its semantics and behavior.
|
|
533
842
|
`lc_glass_class` supplies translucent surfaces; `lc_tw` merges utilities with the last class winning.
|
|
843
|
+
`lc_glass(shape:, thick:, as:)` renders the surface as an element, such as `lc_glass as: :label` around a search field.
|
|
534
844
|
|
|
535
845
|
```erb
|
|
536
846
|
<nav class="<%= lc_glass_class(shape: :bar) %>" aria-label="Project navigation">
|
|
@@ -545,16 +855,17 @@ Generated by `bin/rails lostcoords:ui:builders`; `bin/lint` checks this list aga
|
|
|
545
855
|
- `lc_avatar_class(size: :md, ink: false, linked: false, extra: nil)` (BadgeHelper)
|
|
546
856
|
- `lc_avatar_stack_class(compact: false, extra: nil)` (BadgeHelper)
|
|
547
857
|
- `lc_avatar_stack_row_class(extra: nil)` (BadgeHelper)
|
|
548
|
-
- `lc_badge_class(tone: :neutral, extra: nil)` (BadgeHelper)
|
|
858
|
+
- `lc_badge_class(tone: :neutral, shape: :rounded, extra: nil)` (BadgeHelper)
|
|
549
859
|
- `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)
|
|
551
|
-
- `
|
|
860
|
+
- `lc_button_class(variant: :primary, tone: :default, size: :md, block: false, extra: nil)` (ButtonHelper)
|
|
861
|
+
- `lc_select_trigger_class(size: :md, block: false, extra: nil)` (ButtonHelper)
|
|
862
|
+
- `lc_icon_button_class(shape: :square, size: :md, variant: :ghost, tone: :default, extra: nil)` (ButtonHelper)
|
|
552
863
|
- `lc_card_class(interactive: false, padding: :md, extra: nil)` (CardHelper)
|
|
553
864
|
- `lc_choice_label_class(card: false, extra: nil)` (ChoiceHelper)
|
|
554
865
|
- `lc_checkbox_class(extra: nil)` (ChoiceHelper)
|
|
555
866
|
- `lc_radio_class(extra: nil)` (ChoiceHelper)
|
|
556
867
|
- `lc_switch_class(extra: nil)` (ChoiceHelper)
|
|
557
|
-
- `lc_dialog_class(kind = :modal, extra: nil)` (DialogHelper)
|
|
868
|
+
- `lc_dialog_class(kind = :modal, size: nil, extra: nil)` (DialogHelper)
|
|
558
869
|
- `lc_emoji_picker_groups` (EmojiPickerHelper)
|
|
559
870
|
- `lc_emoji_picker_count` (EmojiPickerHelper)
|
|
560
871
|
- `lc_emoji_picker_version` (EmojiPickerHelper)
|
|
@@ -569,11 +880,11 @@ Generated by `bin/rails lostcoords:ui:builders`; `bin/lint` checks this list aga
|
|
|
569
880
|
- `lc_empty_state_class(extra: nil)` (FeedbackHelper)
|
|
570
881
|
- `lc_toggle_group_class(extra: nil)` (FormHelper)
|
|
571
882
|
- `lc_toggle_group_item_class(active: false, extra: nil)` (FormHelper)
|
|
572
|
-
- `lc_input_class(size: :md, extra: nil)` (FormHelper)
|
|
883
|
+
- `lc_input_class(size: :md, plain: false, extra: nil)` (FormHelper)
|
|
573
884
|
- `lc_select_class(size: :md, extra: nil)` (FormHelper)
|
|
574
885
|
- `lc_textarea_class(extra: nil)` (FormHelper)
|
|
575
|
-
- `lc_field_class(extra: nil)` (FormHelper)
|
|
576
|
-
- `lc_field_label_class(extra: nil)` (FormHelper)
|
|
886
|
+
- `lc_field_class(size: :md, extra: nil)` (FormHelper)
|
|
887
|
+
- `lc_field_label_class(size: :md, extra: nil)` (FormHelper)
|
|
577
888
|
- `lc_glass_class(shape: :bar, thick: false, extra: nil)` (GlassHelper)
|
|
578
889
|
- `lc_stack_class(gap: :content, extra: nil)` (LayoutHelper)
|
|
579
890
|
- `lc_inline_class(gap: :related, extra: nil)` (LayoutHelper)
|
|
@@ -583,9 +894,8 @@ Generated by `bin/rails lostcoords:ui:builders`; `bin/lint` checks this list aga
|
|
|
583
894
|
- `lc_menu_popover_class(align: :end, extra: nil)` (MenuHelper)
|
|
584
895
|
- `lc_menu_option_class(tone: :default, extra: nil)` (MenuHelper)
|
|
585
896
|
- `lc_link_class(tone: :inherit, extra: nil)` (NavigationHelper)
|
|
586
|
-
- `lc_nav_link_class(compact: false, extra: nil)` (NavigationHelper)
|
|
897
|
+
- `lc_nav_link_class(compact: false, layout: :column, extra: nil)` (NavigationHelper)
|
|
587
898
|
- `lc_prose_class(extra: nil)` (ReadingHelper)
|
|
588
|
-
- `lc_sheet_data(data = {}, detents: "fit")` (SheetHelper)
|
|
589
899
|
- `lc_table_class(extra: nil)` (TableHelper)
|
|
590
900
|
- `lc_tw(*classes)` (TailwindHelper)
|
|
591
901
|
- `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);
|
|
@@ -20,7 +26,9 @@
|
|
|
20
26
|
border-color var(--lc-motion-control) var(--lc-ease-out),
|
|
21
27
|
box-shadow var(--lc-motion-control) var(--lc-ease-out);
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
/* A closed menu or popover inside the card (a row's "Remove" option) is
|
|
30
|
+
not the card's own control, so it doesn't tint the edge. */
|
|
31
|
+
&:has(:is([data-tone="destructive"], [aria-invalid="true"]):not([data-slot="menu"] *, [data-slot="popover"] *)) {
|
|
24
32
|
border-color: color-mix(in oklab, var(--destructive) 30%, var(--border));
|
|
25
33
|
}
|
|
26
34
|
}
|
|
@@ -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";
|