lostcoords-ui 0.14.1 → 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: 31a2d350b8b17edbaf8d35a06be137d9838dc7c7f974a74cdf971deae872587a
4
- data.tar.gz: 9a8d18e452f6ce14c0dcae506a531c0d1163716f73256a00caca747e5766c395
3
+ metadata.gz: '008101436ed94725f9463034c431ad162a6b4687a30c033e150126ef3dc174c2'
4
+ data.tar.gz: 181b62f179cd3632224768173969c49b66493b1a3dda105eb57d4f0ad3209e7c
5
5
  SHA512:
6
- metadata.gz: d26f83e72eca4a78f711a953d7eaccc579847a5efd75022e3caa309df140897ccc8eb4d181c99592c2e18b874d8f2d8a6c34ab735b477decd01c8891716a1ee0
7
- data.tar.gz: eb92a40b4396e4e78cd1fa6e502c6d7d83e63ecd7735e3e6da1fcb9586e266e4d8093855d13e135b6eb9007a53ce28bd0e8805e9b6314858ec137b89926e159e
6
+ metadata.gz: 455f0485cf9d05d917aaf286a36a2e33f7b30556075ce6863f1a291f0698d6aaab5bc3f4e08785fda7fc407f47e565ac35818bd2dd0928324cf58402ee3deb1c
7
+ data.tar.gz: faa7f621521ee70239c5c00a15a34a83cf487e3e85e929fa3f0d2ea0d30ddcf178efb68e7a20003a258eb8fd1455016a1fae4893085ac0275cc2992f8b052e76
data/README.md CHANGED
@@ -170,6 +170,21 @@ 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
+
173
188
  ## Changes in 0.14.1
174
189
 
175
190
  Two phone fixes, with nothing to edit:
@@ -503,6 +518,10 @@ from its ink and keeps its pressed fill while open. It takes the button's `varia
503
518
  <% end %>
504
519
  ```
505
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
+
506
525
  Use native attributes for application behavior, `class:` to merge additional Tailwind utilities, and
507
526
  theme tokens to restyle the library. `popover: true` renders `popover="auto"`, as a bare `popover`
508
527
  attribute does. `lc_field` yields the input's `id` and validation attributes so
@@ -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,5 +1,5 @@
1
1
  module Lostcoords
2
2
  module Ui
3
- VERSION = "0.14.1"
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.1
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lost Coordinates