lostcoords-ui 0.14.1 → 0.14.3

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: 27c237af634ec60537ff964703faf62608340f24f83d6ee9224f80c0b9649620
4
+ data.tar.gz: 7cf3f448f87b9ed7ec8bb6d670378c59d0320fa673ba7badc64bb9dcbf9f6f7e
5
5
  SHA512:
6
- metadata.gz: d26f83e72eca4a78f711a953d7eaccc579847a5efd75022e3caa309df140897ccc8eb4d181c99592c2e18b874d8f2d8a6c34ab735b477decd01c8891716a1ee0
7
- data.tar.gz: eb92a40b4396e4e78cd1fa6e502c6d7d83e63ecd7735e3e6da1fcb9586e266e4d8093855d13e135b6eb9007a53ce28bd0e8805e9b6314858ec137b89926e159e
6
+ metadata.gz: 1fab12510a1d750e90711815773c613aeaed71eea35d679894a6370b22aaebadee9b84e665894136444f8b43f7668f7e1d632f5abc808767a23c73fe177ba6c4
7
+ data.tar.gz: b2c5ac6c41c1d8eeebc05d5de53e6c358d20b5ee0882c11c7cebedc4bb8e1bc56fc96ba08a62157a1e1b48a742540b467a4063d23826761585c63ce6d0b09fe0
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.3
174
+
175
+ Nothing needs an edit, and one look changes:
176
+
177
+ - **An unchecked switch has a visible track on any surface.** It drew its track with `--input`, so on a host
178
+ whose cards share the field fill it showed only its thumb. The track is now `--lc-switch-track`, a
179
+ translucent foreground tint that shows on the page, a card or any other fill, in both themes. Set it to
180
+ restyle the track; checked switches still fill with `--primary`.
181
+
182
+ ## Changes in 0.14.2
183
+
184
+ Nothing needs an edit unless you override the disabled look, and one look changes:
185
+
186
+ - **A disabled control marked `aria-busy="true"` keeps its enabled look.** It still can't be pressed and gives
187
+ no hover or press feedback; only its cursor, `progress`, tells. Render a control that waits for its script
188
+ this way and it no longer flashes grey for the moment before the script turns it on. Buttons, icon buttons,
189
+ select and menu triggers, menu options, toggle group items, switches and choice rows all follow it. A
190
+ native checkbox or radio still greys, as the browser draws it. The loading button
191
+ (`lc_button disabled: true, aria: { busy: true }`) now keeps its colours beside its spinner.
192
+ - **`lc-disabled:` and `lc-pending:` style your own controls the same way.** `lc-disabled:` matches a disabled
193
+ control that is not busy, `lc-pending:` one that is, and both compose, as in `has-lc-disabled:opacity-60`. The
194
+ helpers use `lc-disabled:` where they used `disabled:`, so a `class:` override of the disabled look is now
195
+ written `lc-disabled:`.
196
+
173
197
  ## Changes in 0.14.1
174
198
 
175
199
  Two phone fixes, with nothing to edit:
@@ -503,6 +527,10 @@ from its ink and keeps its pressed fill while open. It takes the button's `varia
503
527
  <% end %>
504
528
  ```
505
529
 
530
+ A disabled control that is also `aria-busy="true"` is pending: it keeps its enabled look and a `progress`
531
+ cursor but can't be pressed, so a control waiting for its script or its request doesn't flash grey. Style
532
+ your own controls with the `lc-disabled:` and `lc-pending:` variants, which tell the two apart.
533
+
506
534
  Use native attributes for application behavior, `class:` to merge additional Tailwind utilities, and
507
535
  theme tokens to restyle the library. `popover: true` renders `popover="auto"`, as a bare `popover`
508
536
  attribute does. `lc_field` yields the input's `id` and validation attributes so
@@ -8,7 +8,7 @@
8
8
  inline-size: calc(var(--spacing) * 9);
9
9
  block-size: calc(var(--spacing) * 5.5);
10
10
  border-radius: var(--radius-pill);
11
- background-color: var(--input);
11
+ background-color: var(--lc-switch-track);
12
12
  background-image: radial-gradient(circle closest-side, var(--lc-switch-thumb) calc(100% - var(--spacing) * 0.375), transparent 100%);
13
13
  background-size: calc(var(--spacing) * 5.5) calc(var(--spacing) * 5.5);
14
14
  background-repeat: no-repeat;
@@ -204,6 +204,10 @@
204
204
  --lc-scrim-veil: color-mix(in oklab, var(--background) 35%, transparent);
205
205
  --lc-input-hover: color-mix(in oklab, var(--foreground) 13%, var(--accent));
206
206
 
207
+ /* The unchecked switch track is a translucent tint, not a fill, so it shows on the page,
208
+ a card or any host surface, even one that matches --input. */
209
+ --lc-switch-track: color-mix(in oklab, var(--foreground) 20%, transparent);
210
+
207
211
  --lc-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
208
212
  --lc-shadow:
209
213
  0 1px 3px rgb(0 0 0 / 0.05),
@@ -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.3"
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.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lost Coordinates