lostcoords-ui 0.14.0 → 0.14.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '04927955e774659aeb96601df9709ce28b3da2dbe5a01b825ef40dfcdac4d734'
4
- data.tar.gz: 56effa1904b9810b0dc2962b3f76bdf9fdaabc8217d94343c4ce60d78caaaa6e
3
+ metadata.gz: '008101436ed94725f9463034c431ad162a6b4687a30c033e150126ef3dc174c2'
4
+ data.tar.gz: 181b62f179cd3632224768173969c49b66493b1a3dda105eb57d4f0ad3209e7c
5
5
  SHA512:
6
- metadata.gz: c9d662bdbbe4c811716da94da3994301d8e2be14a7ebed8fa7bc1079c8fe2a3bdb474e921039cc3ee9b059d3d9d8bd5f94d5591f372bcbc45c365d68bb8b9827
7
- data.tar.gz: 550982086a4c06631fefa58593a5706e3e96f40cb297ddc96e3ea7ed6363bf8224625c8e8b1aab278aaf8c232b74dccbc7cb8ec1863fa756455cabaa90efe28a
6
+ metadata.gz: 455f0485cf9d05d917aaf286a36a2e33f7b30556075ce6863f1a291f0698d6aaab5bc3f4e08785fda7fc407f47e565ac35818bd2dd0928324cf58402ee3deb1c
7
+ data.tar.gz: faa7f621521ee70239c5c00a15a34a83cf487e3e85e929fa3f0d2ea0d30ddcf178efb68e7a20003a258eb8fd1455016a1fae4893085ac0275cc2992f8b052e76
data/README.md CHANGED
@@ -170,6 +170,30 @@ Omit `only` to register every library controller. Unknown identifiers raise befo
170
170
  registered, and repeated calls on the same application keep later overrides, so register defaults
171
171
  before application overrides.
172
172
 
173
+ ## Changes in 0.14.2
174
+
175
+ Nothing needs an edit unless you override the disabled look, and one look changes:
176
+
177
+ - **A disabled control marked `aria-busy="true"` keeps its enabled look.** It still can't be pressed and gives
178
+ no hover or press feedback; only its cursor, `progress`, tells. Render a control that waits for its script
179
+ this way and it no longer flashes grey for the moment before the script turns it on. Buttons, icon buttons,
180
+ select and menu triggers, menu options, toggle group items, switches and choice rows all follow it. A
181
+ native checkbox or radio still greys, as the browser draws it. The loading button
182
+ (`lc_button disabled: true, aria: { busy: true }`) now keeps its colours beside its spinner.
183
+ - **`lc-disabled:` and `lc-pending:` style your own controls the same way.** `lc-disabled:` matches a disabled
184
+ control that is not busy, `lc-pending:` one that is, and both compose, as in `has-lc-disabled:opacity-60`. The
185
+ helpers use `lc-disabled:` where they used `disabled:`, so a `class:` override of the disabled look is now
186
+ written `lc-disabled:`.
187
+
188
+ ## Changes in 0.14.1
189
+
190
+ Two phone fixes, with nothing to edit:
191
+
192
+ - **The `lc_search` trigger is a plain icon button on phones**, with no fill until it is hovered, so it
193
+ matches the icon buttons beside it in a bar. From `sm` up it is the same filled pill.
194
+ - **`lc_confirm_sheet` has the ✕ on phones**, at the top start like every other sheet, with the message
195
+ centred in the title bar. It cancels, as Cancel does. Its label is `lostcoords.ui.confirm.close`.
196
+
173
197
  ## Changes in 0.14.0
174
198
 
175
199
  Phone sheets have one look. One option to drop, and the rest needs no edit:
@@ -494,6 +518,10 @@ from its ink and keeps its pressed fill while open. It takes the button's `varia
494
518
  <% end %>
495
519
  ```
496
520
 
521
+ A disabled control that is also `aria-busy="true"` is pending: it keeps its enabled look and a `progress`
522
+ cursor but can't be pressed, so a control waiting for its script or its request doesn't flash grey. Style
523
+ your own controls with the `lc-disabled:` and `lc-pending:` variants, which tell the two apart.
524
+
497
525
  Use native attributes for application behavior, `class:` to merge additional Tailwind utilities, and
498
526
  theme tokens to restyle the library. `popover: true` renders `popover="auto"`, as a bare `popover`
499
527
  attribute does. `lc_field` yields the input's `id` and validation attributes so
@@ -1041,7 +1069,7 @@ from the page the link opens. Inside a paragraph, keep `content:` to phrasing el
1041
1069
 
1042
1070
  ### Search
1043
1071
 
1044
- `lc_search` renders a search trigger, a pill with the ⌘K hint that shrinks to an icon on phones, and
1072
+ `lc_search` renders a search trigger, a pill with the ⌘K hint that is a plain icon button on phones, and
1045
1073
  the full-screen search it opens. Attributes go to the trigger, which is what sits in your layout.
1046
1074
  Build results from `lc_search_group` and `lc_search_result`.
1047
1075
 
@@ -1,4 +1,4 @@
1
- /* lc_search: a pill trigger that opens a full-screen search over a
1
+ /* lc_search: a trigger, a pill from sm up, that opens a full-screen search over a
2
2
  blurred page. The controller animates it open and closed. */
3
3
  @layer components {
4
4
  .lc-search-trigger {
@@ -20,10 +20,12 @@
20
20
  /* The bar grows out of the trigger, so the trigger steps aside while search is open. */
21
21
  [data-slot="search"][data-open] & { opacity: 0; }
22
22
 
23
+ /* On phones it is a plain icon button, like the ones beside it in a bar. */
23
24
  @media (width < 40rem) {
24
25
  justify-content: center;
25
26
  inline-size: var(--spacing-control-sm);
26
27
  padding-inline: 0;
28
+ background: transparent;
27
29
  }
28
30
 
29
31
  @media (width >= 40rem) { inline-size: calc(var(--spacing) * 64); }
@@ -1,3 +1,10 @@
1
+ /* A pending control is disabled with aria-busy="true" while its script loads: it
2
+ keeps its enabled look, so it does not flash grey, and only its cursor tells.
3
+ lc-disabled: styles a disabled control that is not pending; lc-pending: one that is.
4
+ Both compose, as in has-lc-disabled:opacity-60. */
5
+ @custom-variant lc-disabled (&:disabled:not([aria-busy="true"]));
6
+ @custom-variant lc-pending (&:disabled[aria-busy="true"]);
7
+
1
8
  /* A control gives a little as it is pressed, unless it is disabled. */
2
9
  @utility lc-press {
3
10
  @media (prefers-reduced-motion: no-preference) {
@@ -1,10 +1,10 @@
1
1
  module Lostcoords::Ui
2
2
  module ButtonHelper
3
- # Disabled controls drop their variant colours for a faint tint and dim ink, so they read as unavailable on any surface.
3
+ # Disabled controls, unless pending (aria-busy), drop their variant colours for a faint tint and dim ink, so they read as unavailable on any surface.
4
4
  BUTTON_DISABLED =
5
- "disabled:cursor-not-allowed disabled:shadow-none " \
6
- "disabled:[--lc-button-bg:color-mix(in_oklab,var(--foreground)_10%,transparent)] " \
7
- "disabled:text-[color-mix(in_oklab,var(--foreground)_38%,transparent)]"
5
+ "lc-disabled:cursor-not-allowed lc-pending:cursor-progress lc-disabled:shadow-none " \
6
+ "lc-disabled:[--lc-button-bg:color-mix(in_oklab,var(--foreground)_10%,transparent)] " \
7
+ "lc-disabled:text-[color-mix(in_oklab,var(--foreground)_38%,transparent)]"
8
8
 
9
9
  BUTTON_BASE =
10
10
  "inline-flex items-center justify-center gap-related rounded-pill font-sans " \
@@ -58,7 +58,7 @@ module Lostcoords::Ui
58
58
  "font-sans text-base text-start text-foreground whitespace-nowrap no-underline cursor-pointer " \
59
59
  "transition-[background-color,color] duration-(--lc-motion-quick) ease-(--lc-ease-out) " \
60
60
  "not-disabled:hover:bg-(--lc-input-hover) aria-expanded:bg-(--lc-input-hover) " \
61
- "disabled:cursor-not-allowed disabled:text-[color-mix(in_oklab,var(--foreground)_38%,transparent)] " \
61
+ "lc-disabled:cursor-not-allowed lc-pending:cursor-progress lc-disabled:text-[color-mix(in_oklab,var(--foreground)_38%,transparent)] " \
62
62
  "[&_svg]:block [&_svg]:shrink-0 " \
63
63
  "[&>[data-icon=inline-end]]:ms-auto [&>[data-icon=inline-end]]:size-5 [&>[data-icon=inline-end]]:text-muted-foreground " \
64
64
  "motion-safe:[&>[data-icon=inline-end]]:transition-transform motion-safe:[&>[data-icon=inline-end]]:duration-(--lc-motion-quick) " \
@@ -1,9 +1,9 @@
1
1
  module Lostcoords::Ui
2
2
  module ChoiceHelper
3
- CHOICE_BASE = "shrink-0 size-4.5 m-0 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-40"
3
+ CHOICE_BASE = "shrink-0 size-4.5 m-0 cursor-pointer accent-primary lc-disabled:cursor-not-allowed lc-pending:cursor-progress lc-disabled:opacity-40"
4
4
 
5
5
  # The label row centers the control on the first line of text, so a hint wraps under the label.
6
- CHOICE_LABEL = "lc-choice inline-flex min-w-0 items-start gap-related text-body text-foreground cursor-pointer has-disabled:cursor-not-allowed has-disabled:opacity-60"
6
+ CHOICE_LABEL = "lc-choice inline-flex min-w-0 items-start gap-related text-body text-foreground cursor-pointer has-lc-disabled:cursor-not-allowed has-lc-pending:cursor-progress has-lc-disabled:opacity-60"
7
7
 
8
8
  # card: true draws the whole label as a selectable tile, for plan or theme pickers.
9
9
  CHOICE_CARD = "flex w-full rounded-2xl lc-squircle border border-transparent bg-tile p-content " \
@@ -23,7 +23,7 @@ module Lostcoords::Ui
23
23
  end
24
24
 
25
25
  def lc_switch_class(extra: nil)
26
- lc_tw("lc-switch shrink-0 m-0 cursor-pointer disabled:cursor-not-allowed disabled:opacity-40", extra)
26
+ lc_tw("lc-switch shrink-0 m-0 cursor-pointer lc-disabled:cursor-not-allowed lc-pending:cursor-progress lc-disabled:opacity-40", extra)
27
27
  end
28
28
 
29
29
  # A native checkbox. unchecked_value: submits a value when unchecked, like Rails' check_box; pass nil to omit it.
@@ -14,8 +14,8 @@ module Lostcoords::Ui
14
14
  "has-checked:bg-background has-checked:text-foreground " \
15
15
  "aria-[current]:not-aria-[current=false]:bg-background aria-[current]:not-aria-[current=false]:text-foreground " \
16
16
  "transition-[background-color,color,box-shadow,transform] duration-(--lc-motion-quick) ease-(--lc-ease-out) " \
17
- "disabled:cursor-not-allowed disabled:text-[color-mix(in_oklab,var(--foreground)_38%,transparent)] " \
18
- "has-disabled:cursor-not-allowed has-disabled:text-[color-mix(in_oklab,var(--foreground)_38%,transparent)] " \
17
+ "lc-disabled:cursor-not-allowed lc-pending:cursor-progress lc-disabled:text-[color-mix(in_oklab,var(--foreground)_38%,transparent)] " \
18
+ "has-lc-disabled:cursor-not-allowed has-lc-pending:cursor-progress has-lc-disabled:text-[color-mix(in_oklab,var(--foreground)_38%,transparent)] " \
19
19
  "[&_svg]:size-[1.1em] [&_svg]:shrink-0"
20
20
 
21
21
  TOGGLE_GROUP_ITEM_ACTIVE = "lc-toggle-group-item-active bg-background text-foreground hover:text-foreground"
@@ -23,7 +23,7 @@ module Lostcoords::Ui
23
23
  # a menuitemradio does. The global focus halo rings the row while its radio has focus.
24
24
  LIST_ROW_CHOICE =
25
25
  "group/choice flex items-center gap-heading cursor-pointer transition-colors duration-(--lc-motion-quick) " \
26
- "hover:bg-accent has-checked:bg-primary-soft has-checked:font-semibold has-disabled:cursor-not-allowed has-disabled:opacity-45"
26
+ "hover:bg-accent has-checked:bg-primary-soft has-checked:font-semibold has-lc-disabled:cursor-not-allowed has-lc-pending:cursor-progress has-lc-disabled:opacity-45"
27
27
  LIST_ROW_CHOICE_CHECK = "ms-auto size-4 shrink-0 text-primary invisible group-has-checked/choice:visible"
28
28
  LIST_FIELD_ELEMENTS = %i[div fieldset span].freeze
29
29
  LIST_FIELD = "@container px-content py-2.5 transition-colors duration-(--lc-motion-quick) has-[[data-plain]:focus]:bg-accent"
@@ -26,7 +26,7 @@ module Lostcoords::Ui
26
26
  "min-h-control-md px-3 py-1.5 rounded-2xl lc-squircle border-none bg-transparent text-start font-sans text-label text-foreground " \
27
27
  "no-underline cursor-pointer transition-[background-color] duration-120 [--lc-avatar-size:--spacing(7)] " \
28
28
  "hover:bg-accent focus-visible:bg-accent focus-visible:outline-none " \
29
- "disabled:text-muted-foreground disabled:cursor-not-allowed disabled:hover:bg-transparent"
29
+ "lc-disabled:text-muted-foreground lc-disabled:cursor-not-allowed lc-pending:cursor-progress disabled:hover:bg-transparent"
30
30
 
31
31
  MENU_OPTION_TONES = {
32
32
  default: "",
@@ -1,10 +1,12 @@
1
1
  <%# locals: (id:, attributes:) %>
2
- <%= lc_sheet(as: :dialog, **attributes) do %>
3
- <form method="dialog" class="flex flex-col gap-inset p-inset" data-slot="confirm-sheet-content">
4
- <div class="flex flex-col gap-tight max-sm:text-center">
2
+ <%# On phones the message sits in the sheet's title bar, with the ✕ every sheet closes from. It cancels. %>
3
+ <%= lc_sheet(as: :dialog, **attributes) do |sheet| %>
4
+ <form method="dialog" class="flex flex-col gap-inset p-inset max-sm:pt-0" data-slot="confirm-sheet-content">
5
+ <div class="flex flex-col gap-tight max-sm:-mx-inset max-sm:min-h-14 max-sm:justify-center max-sm:px-14 max-sm:py-2 max-sm:text-center" data-slot="confirm-sheet-header">
5
6
  <p id="<%= id %>-message" class="<%= lc_heading_class(size: :subheading) %>" data-slot="confirm-sheet-message"></p>
6
- <p id="<%= id %>-description" class="<%= lc_text_class(size: :small, tone: :muted) %>" data-slot="confirm-sheet-description" hidden></p>
7
+ <p id="<%= id %>-description" class="<%= lc_text_class(size: :small, tone: :muted, extra: "max-sm:text-balance") %>" data-slot="confirm-sheet-description" hidden></p>
7
8
  </div>
9
+ <%= sheet.close lc_t("lostcoords.ui.confirm.close"), size: :sm, type: "submit", value: "cancel", class: "sm:hidden", data: { slot: "confirm-sheet-dismiss" } %>
8
10
  <div class="grid grid-cols-2 gap-related" data-slot="confirm-sheet-actions">
9
11
  <button type="submit" value="cancel" class="<%= lc_button_class(variant: :secondary, block: true) %>" data-slot="confirm-sheet-cancel"><%= lc_t("lostcoords.ui.confirm.cancel") %></button>
10
12
  <button type="submit" value="confirm" class="<%= lc_button_class(variant: :primary, block: true) %>" data-slot="confirm-sheet-accept" data-variant="primary"><%= lc_t("lostcoords.ui.confirm.accept") %></button>
@@ -1,7 +1,7 @@
1
1
  <%# locals: (id:, label:, src:, param:, placeholder:, trigger:, empty:, prompt:, shortcut:, attributes:, content:) %>
2
2
  <div class="contents" data-slot="search" data-controller="lc-search" data-action="turbo:before-cache@document->lc-search#reset" data-lc-search-src-value="<%= src %>" data-lc-search-param-value="<%= param %>" data-lc-search-empty-value="<%= empty %>" data-lc-search-one-value="<%= lc_t("lostcoords.ui.search.results.one", count: "%{count}") %>" data-lc-search-other-value="<%= lc_t("lostcoords.ui.search.results.other", count: "%{count}") %>">
3
3
  <%= tag.button(**attributes) do %>
4
- <%= lc_icon "magnifying-glass", options: { class: "size-4 shrink-0", "aria-hidden": true } %>
4
+ <%= lc_icon "magnifying-glass", options: { class: "size-4 shrink-0 max-sm:size-4.5", "aria-hidden": true } %>
5
5
  <span class="flex-1 truncate text-start max-sm:sr-only"><%= trigger %></span>
6
6
  <% if shortcut %><%= lc_kbd shortcut, class: "hidden bg-transparent px-0 any-pointer-fine:sm:inline", aria: { hidden: true } %><% end %>
7
7
  <% end %>
@@ -15,6 +15,7 @@ en:
15
15
  close: "Close %{title}"
16
16
  confirm:
17
17
  cancel: "Cancel"
18
+ close: "Close"
18
19
  accept: "Confirm"
19
20
  menu:
20
21
  label: "Actions"
@@ -15,6 +15,7 @@ es:
15
15
  close: "Cerrar %{title}"
16
16
  confirm:
17
17
  cancel: "Cancelar"
18
+ close: "Cerrar"
18
19
  accept: "Confirmar"
19
20
  menu:
20
21
  label: "Acciones"
@@ -15,6 +15,7 @@ ja:
15
15
  close: "%{title}を閉じる"
16
16
  confirm:
17
17
  cancel: "キャンセル"
18
+ close: "閉じる"
18
19
  accept: "OK"
19
20
  menu:
20
21
  label: "操作"
@@ -1,5 +1,5 @@
1
1
  module Lostcoords
2
2
  module Ui
3
- VERSION = "0.14.0"
3
+ VERSION = "0.14.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lostcoords-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lost Coordinates