velvetkit 0.5.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c2f8866e70934ca1e0f3ed6bb6d2d4925d7b84c11a5b8aaab89f5f3d48a69e7
4
- data.tar.gz: 26320e37c7048700ebedcbbb2188cd739a3574b58fb1a624008ad5ee36d432ee
3
+ metadata.gz: 9a598255d821f68fb0ab11f28b32e1f60aaf51ee752ac22f39aca95fc7e2e2fb
4
+ data.tar.gz: 12c189b8e5e1f6f76b240ad79e8c63e4644668eb8881ca311f7fb35d0a349627
5
5
  SHA512:
6
- metadata.gz: 1ac2dc774e3a3cf2593bec85d15c703b54e83d36216e24cc00cea5300a714db01ef08ee52abf8a6a4b63b97c4601b024c12abaa29a202e8252bd10a23204c381
7
- data.tar.gz: 1b7c9127670e0382ddc16ef189905b8c18e7d3af126026dc8638d1b152eaea073c27d67e2844620802e70d29d60cab08fa099ae4f7943cc9f99347281639a9f4
6
+ metadata.gz: 9eb743aa4315865dfaa72f1727e826522c74ff7025c3370ba5e5514b06d0d179787454a85ac9bd1de1539527ef1947ab9ab186cea36a5bc58953ad87a315ee89
7
+ data.tar.gz: be5fdad891a582556befbe4e5593f6a30cd2a847e984ad7b8b54d48075e7b6b4e4764bf40ec1567236eb37c7c1ebbfc4bfbfed3e861db197ae4248f73881fbdb
data/CHANGELOG.md CHANGED
@@ -2,22 +2,47 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.5.1 — 2026-11-15
6
+
7
+ Changes:
8
+
9
+ - Fix: the focus ring shows on click again, as well as on Tab. 0.5.0 moved
10
+ it to `:focus-visible`, so a click on a button, link, tab, menu item,
11
+ checkbox, radio, switch, sidebar link or gallery button drew no ring. (#95)
12
+ - Docs: an Upgrading guide at /docs/upgrading takes an app from 0.4 to 0.5
13
+ in one place: one `velvetkit:add` for every changed component, and the
14
+ sidebar's `collapsible:` and `state:` with before and after code. (#98)
15
+ - Docs: every guide and chart page is also Markdown, at the same address
16
+ with `.md`, and llms.txt links them. The upgrading guide and the release
17
+ notes can be copied as Markdown or opened in Claude or ChatGPT, and
18
+ llms-full.txt ends with both. (#100)
19
+
20
+ Upgrading an app: re-run `velvetkit:add` for `base`, `button`, `link`,
21
+ `badge`, `tabs`, `accordion`, `menu`, `checkbox`, `radio_group`, `switch`,
22
+ `sidebar` and `gallery`.
23
+
24
+ ## 0.5.0 — 2026-11-15
25
+
5
26
  New components:
6
27
 
7
28
  - `Carousel`: a row of cards that swipes and scrolls sideways, each stopping
8
29
  at the edge, with previous and next buttons that show only while there's
9
30
  more to see that way.
10
31
  - `SelectionBar`: "3 selected", a button to clear them and the actions for
11
- all of them at once, over a `Table` with `selection:` or any list whose
32
+ all of them at once, over a table with `selection:` or any list whose
12
33
  boxes it can count. It keeps "select all" in step, Shift-click chooses a
13
34
  run, and Escape clears. An "all" box inside a `data-selection-group`
14
35
  chooses just that group, such as a day's photos.
15
36
  - `Scrubber`: a rail down the side of a long list for jumping through it by
16
37
  date, with years marked, the date under the pointer, dragging like a
17
38
  scrollbar, and one tab stop whose arrow keys move between the marks.
39
+ - `Fieldset`: a group of controls under one legend, with a hint and an error
40
+ message for the group.
18
41
 
19
42
  Changes:
20
43
 
44
+ - `RadioGroup` and `ToggleGroup` take `legend:`, `hint:` and `error:`,
45
+ through the new `Fieldset`. (#87)
21
46
  - `Sidebar` is a drawer on phones, opened by the same trigger, with a
22
47
  backdrop, Escape, and focus moved in and back. It sticks to the top and
23
48
  fits the wrapper's height, so a bar above the app no longer pushes its
@@ -42,39 +67,36 @@ Changes:
42
67
  - Buttons, links, tabs, menu items, checkboxes, radios and switches show
43
68
  their focus ring for the keyboard only (`:focus-visible`), not after a
44
69
  mouse click. Text fields keep theirs on click.
45
- - Fix: a collapsed `inset` or `floating` sidebar is wide enough for its
46
- icons; they were clipped by the panel's padding.
47
- - Fix: a class given to `Sidebar::Inset` replaces the one it clashes with
48
- (`bg-transparent` for its background, `shadow-none` for its shadow). Both
49
- used to land on the element and the inset's own often won.
50
-
51
- Upgrading an app: re-run `velvetkit:add` for `sidebar`, `table`, `gallery`,
52
- `chart` and `checkbox`. A sidebar that passed `collapsible: :icon` to start
53
- collapsed now passes `state: :collapsed`; `collapsible: :none` now means it
54
- can't collapse. The choice is kept in a cookie, not `localStorage`. The
55
- sidebar is no longer `position: fixed`, so a `transform` added to keep it
56
- inside a box can go; give the wrapper a height instead
57
- (`class: "h-[calc(100svh-3rem)]"`). Phones get the drawer, so a sheet that
58
- stood in for it can go too.
59
-
60
70
  - Docs: two more examples. Helio, a dashboard at /examples/dashboard, is the
61
71
  admin side of a software company: customers to search, filter, sort,
62
72
  choose and act on in bulk, a page for each with its invoices, activity
63
73
  and notes, and an overview whose numbers change with the period. Pinhole,
64
74
  a photo library at /examples/photos, has highlights, photos by day, a date
65
75
  scrubber, albums, an archive and a bin, and a viewer with an info panel.
66
-
67
76
  - Docs: an Examples page, linked from the header, shows apps built with
68
77
  VelvetKit. The first, Daily Goods, is a shop you can use at
69
78
  /examples/store: a front page with categories, reviews and a newsletter
70
79
  signup, filters (price, rating, colour, features) and sorting, a cart, and
71
80
  a page for each product with photos, details and reviews, all without a
72
81
  page reload. A sign-in flow is on the way.
73
-
82
+ - Fix: a collapsed `inset` or `floating` sidebar is wide enough for its
83
+ icons; they were clipped by the panel's padding.
84
+ - Fix: a class given to `Sidebar::Inset` replaces the one it clashes with
85
+ (`bg-transparent` for its background, `shadow-none` for its shadow). Both
86
+ used to land on the element and the inset's own often won.
74
87
  - Fix: `Select` puts `aria-label` and `aria-labelledby` on its visible button.
75
88
  They went on the hidden native select, which left the dropdown with no name
76
89
  for screen readers. (#80)
77
90
 
91
+ Upgrading an app: re-run `velvetkit:add` for `sidebar`, `table`, `gallery`,
92
+ `chart` and `checkbox`. A sidebar that passed `collapsible: :icon` to start
93
+ collapsed now passes `state: :collapsed`; `collapsible: :none` now means it
94
+ can't collapse. The choice is kept in a cookie, not `localStorage`. The
95
+ sidebar is no longer `position: fixed`, so a `transform` added to keep it
96
+ inside a box can go; give the wrapper a height instead
97
+ (`class: "h-[calc(100svh-3rem)]"`). Phones get the drawer, so a sheet that
98
+ stood in for it can go too.
99
+
78
100
  Upgrading an app: `RadioGroup` and `ToggleGroup` now render through the new
79
101
  `Fieldset`, so re-run `velvetkit:add radio_group toggle_group` to get it with
80
102
  them. Without `legend:`, `hint:` or `error:` they render as before.
@@ -4,5 +4,5 @@ module Velvetkit
4
4
  # Not the released version: the release workflow takes that from the tag
5
5
  # (v0.3.0 publishes 0.3.0) and writes it here on the runner only, so this
6
6
  # file can stay behind. See .github/workflows/release.yml.
7
- VERSION = "0.5.0"
7
+ VERSION = "0.5.1"
8
8
  end
@@ -11,7 +11,7 @@ class UI::Accordion::Trigger < UI::Base
11
11
  def classes
12
12
  cn(
13
13
  "group flex w-full items-center gap-3 py-2 text-sm font-medium transition-all hover:underline text-left text-primary",
14
- "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 rounded",
14
+ "focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 rounded",
15
15
  "disabled:pointer-events-none disabled:opacity-50",
16
16
  UI::Base::FOCUS_RING,
17
17
  @user_class
@@ -2,7 +2,7 @@
2
2
 
3
3
  class UI::Badge < UI::Base
4
4
  variants(
5
- base: "inline-flex items-center justify-center gap-1 rounded-full font-medium whitespace-nowrap border border-transparent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1",
5
+ base: "inline-flex items-center justify-center gap-1 rounded-full font-medium whitespace-nowrap border border-transparent transition-colors focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1",
6
6
  variants: {
7
7
  variant: {
8
8
  default: "bg-primary text-primary-foreground hover:bg-primary/80",
@@ -9,8 +9,8 @@ class UI::Base < ViewComponent::Base
9
9
  # includes it in its variant `base:` string. It shows on click as well as on
10
10
  # Tab, and animates in. (The docs site keeps it on the clicked link across
11
11
  # page visits, so a visit doesn't cut the animation off.)
12
- FOCUS_RING = "transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-primary " \
13
- "focus-visible:ring-offset-1 ring-offset-background"
12
+ FOCUS_RING = "transition-all focus:outline-none focus:ring-2 focus:ring-primary " \
13
+ "focus:ring-offset-1 ring-offset-background"
14
14
 
15
15
  class_attribute :variant_config,
16
16
  instance_writer: false,
@@ -21,7 +21,7 @@ class UI::Button < UI::Base
21
21
  variants: {
22
22
  variant: {
23
23
  default: "bg-primary text-primary-foreground hover:bg-primary/90",
24
- destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive",
24
+ destructive: "bg-destructive text-white hover:bg-destructive/90 focus:ring-destructive",
25
25
  outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground " \
26
26
  "disabled:border-input!",
27
27
  secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
@@ -7,7 +7,7 @@ class UI::Checkbox < UI::Base
7
7
  base: "peer appearance-none shrink-0 border border-input bg-background " \
8
8
  "transition-all " \
9
9
  "checked:bg-primary checked:border-primary indeterminate:bg-primary indeterminate:border-primary " \
10
- "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 " \
10
+ "focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 " \
11
11
  "ring-offset-background",
12
12
  variants: {
13
13
  size: {
@@ -113,7 +113,7 @@ class UI::Checkbox < UI::Base
113
113
  def classes
114
114
  cn(
115
115
  variant_classes(size: @size),
116
- { "border-destructive aria-invalid:focus-visible:ring-destructive" => wrapper.error? },
116
+ { "border-destructive aria-invalid:focus:ring-destructive" => wrapper.error? },
117
117
  @user_class
118
118
  )
119
119
  end
@@ -59,7 +59,7 @@ class UI::Gallery < UI::Base
59
59
  # Always light on the dark backdrop, whatever the page's theme, ring included.
60
60
  # The border keeps them in sight on a dark page, where the backdrop is black too.
61
61
  OVERLAY_BUTTON = "rounded-full border border-white/25 bg-black/60 text-white hover:bg-black/80 hover:text-white " \
62
- "focus-visible:ring-white disabled:bg-black/60! disabled:text-white/50!"
62
+ "focus:ring-white disabled:bg-black/60! disabled:text-white/50!"
63
63
 
64
64
  renders_many :images, UI::Gallery::Image
65
65
 
@@ -85,8 +85,8 @@ class UI::Gallery < UI::Base
85
85
  def trigger(index, class: nil, **html_attrs, &block)
86
86
  image = images[index]
87
87
  tag.button(type: "button", **html_attrs,
88
- class: cn("group/trigger relative block cursor-zoom-in overflow-hidden focus:outline-none focus-visible:ring-2 " \
89
- "focus-visible:ring-primary focus-visible:ring-offset-2 ring-offset-background",
88
+ class: cn("group/trigger relative block cursor-zoom-in overflow-hidden focus:outline-none focus:ring-2 " \
89
+ "focus:ring-primary focus:ring-offset-2 ring-offset-background",
90
90
  binding.local_variable_get(:class)),
91
91
  aria: { label: phrase(t("ui.gallery.open", default: "Open %{alt}"), alt: image&.alt), haspopup: "dialog" },
92
92
  data: { action: "ui--gallery#open", "ui--gallery-index-param": index, "ui--gallery-target": "trigger" }) do
@@ -126,7 +126,7 @@ class UI::Gallery < UI::Base
126
126
  # One tab stop for the strip: the image showing. The rest are out of sight.
127
127
  { type: "button", tabindex: index.zero? ? 0 : -1,
128
128
  class: cn("group/slide relative block size-full rounded-lg transition-all focus:outline-none",
129
- "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary", hover_zoom? ? "cursor-crosshair" : "cursor-zoom-in"),
129
+ "focus:ring-2 focus:ring-inset focus:ring-primary", hover_zoom? ? "cursor-crosshair" : "cursor-zoom-in"),
130
130
  aria: { label: phrase(t("ui.gallery.zoom", default: "Zoom image %{current}: %{alt}"), current: index + 1, alt: image.alt),
131
131
  haspopup: "dialog" },
132
132
  data: { action: slide_action, "ui--gallery-index-param": index } }
@@ -14,7 +14,7 @@ class UI::Link < UI::Base
14
14
  variant: {
15
15
  link: "text-primary underline-offset-4 hover:underline",
16
16
  default: "bg-primary text-primary-foreground hover:bg-primary/90",
17
- destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive",
17
+ destructive: "bg-destructive text-white hover:bg-destructive/90 focus:ring-destructive",
18
18
  outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
19
19
  secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
20
20
  ghost: "hover:bg-accent hover:text-accent-foreground"
@@ -5,7 +5,7 @@ class UI::Menu::Item < UI::Base
5
5
  base:
6
6
  "relative flex cursor-default select-none items-center gap-2 rounded w-full px-2 py-1 text-sm whitespace-nowrap border-0 bg-transparent outline-none transition-colors " \
7
7
  "hover:bg-accent hover:text-accent-foreground " \
8
- "focus:bg-accent focus:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 " \
8
+ "focus:bg-accent focus:text-accent-foreground focus:ring-2 focus:ring-ring focus:ring-offset-1 " \
9
9
  "aria-checked:bg-accent aria-checked:text-accent-foreground aria-checked:font-medium " \
10
10
  "data-[disabled]:pointer-events-none data-[disabled]:opacity-50 transition-all",
11
11
  variants: {
@@ -5,7 +5,7 @@ class UI::RadioGroup::Item < UI::Base
5
5
  base: "peer appearance-none shrink-0 rounded-full border border-input bg-background " \
6
6
  "transition-all " \
7
7
  "checked:bg-primary checked:border-primary " \
8
- "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 " \
8
+ "focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 " \
9
9
  "ring-offset-background",
10
10
  variants: {
11
11
  size: {
@@ -10,7 +10,7 @@ class UI::Sidebar::GroupLabel < ViewComponent::Base
10
10
  @system_args[:data][:sidebar] = "group-label"
11
11
 
12
12
  @system_args[:class] = class_names(
13
- "text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
13
+ "text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
14
14
  "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
15
15
  @system_args[:class]
16
16
  )
@@ -33,7 +33,7 @@ class UI::Sidebar::MenuButton < UI::Base
33
33
 
34
34
  @system_args[:class] = cn(
35
35
  "peer/menu-button flex w-full items-center gap-2 overflow-hidden text-left text-sm outline-hidden ring-sidebar-ring " \
36
- "transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 " \
36
+ "transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus:ring-2 " \
37
37
  "active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 " \
38
38
  "group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 " \
39
39
  "data-[active=true]:font-semibold data-[active=true]:text-sidebar-primary data-[active=true]:[&>svg]:stroke-current " \
@@ -42,7 +42,7 @@ class UI::Sidebar::MenuItem < UI::Base
42
42
  aria: { expanded: sub_menu.open?.to_s, controls: sub_menu_id,
43
43
  label: t("ui.sidebar.toggle_sub", name: sub_menu.name, default: "Show the links under %{name}") },
44
44
  class: "absolute end-1 top-1 flex size-6 items-center justify-center rounded-md text-sidebar-foreground/70 outline-hidden " \
45
- "ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 " \
45
+ "ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus:ring-2 " \
46
46
  "group-data-[collapsible=icon]:hidden group-has-[>[data-shape=pill]]/menu-item:top-2 " \
47
47
  "[&[aria-expanded=true]>svg]:rotate-90 [&>svg]:transition-transform motion-reduce:[&>svg]:transition-none" }
48
48
  end
@@ -50,7 +50,7 @@ class UI::Sidebar::MenuSub < UI::Base
50
50
  link_to(item.path, aria: { current: ("page" if item.active) },
51
51
  data: { active: item.active.to_s },
52
52
  class: "flex h-7 min-w-0 items-center gap-2 rounded-md px-2 text-sm text-sidebar-foreground/80 outline-hidden " \
53
- "ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 " \
53
+ "ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus:ring-2 " \
54
54
  "data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground " \
55
55
  "[&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0") do
56
56
  capture(&item.content)
@@ -11,8 +11,8 @@ class UI::Switch < UI::Base
11
11
  base: "absolute inset-0 rounded-full " \
12
12
  "bg-input peer-checked:bg-primary " \
13
13
  "transition-all duration-200 " \
14
- "peer-focus:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-primary " \
15
- "peer-focus-visible:ring-offset-1 ring-offset-background " \
14
+ "peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-primary " \
15
+ "peer-focus:ring-offset-1 ring-offset-background " \
16
16
  "peer-disabled:cursor-not-allowed",
17
17
  variants: {
18
18
  size: {
@@ -4,7 +4,7 @@ class UI::Tabs::Trigger < UI::Base
4
4
  variants(
5
5
  base: "inline-flex items-center justify-center gap-2 whitespace-nowrap " \
6
6
  "font-medium transition-all " \
7
- "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1 " \
7
+ "focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 " \
8
8
  "disabled:pointer-events-none disabled:bg-muted! disabled:text-muted-foreground!",
9
9
  variants: {
10
10
  variant: {
@@ -95,4 +95,31 @@ class UI::BaseTest < ViewComponent::TestCase
95
95
  btn = page.find("button")
96
96
  refute_includes btn[:class], "border-2"
97
97
  end
98
+
99
+ # The ring on click is VelvetKit's signature (AGENTS.md, "Focus rings"):
100
+ # 0.5.0 moved it to :focus-visible by mistake and 0.5.1 put it back. If this
101
+ # fails, don't rewrite it to match; ask the maintainer first.
102
+ def test_the_focus_ring_shows_on_click
103
+ assert_includes UI::Base::FOCUS_RING, "focus:ring-2"
104
+ assert_includes UI::Base::FOCUS_RING, "focus:ring-primary"
105
+ refute_match(/focus-visible:ring/, UI::Base::FOCUS_RING)
106
+ end
107
+
108
+ # Components whose ring is keyboard-only, each a deliberate choice made
109
+ # before 0.5. A new one needs the maintainer's sign-off, then a place here.
110
+ KEYBOARD_ONLY_RINGS = %w[
111
+ input_group/addon navigation_menu/item navigation_menu/link scrubber
112
+ session_tabs/tab slider stepper/step
113
+ ].freeze
114
+
115
+ def test_no_other_component_has_a_keyboard_only_ring
116
+ # Beside base.rb, wherever the kit is (the namespaced run renames ui/).
117
+ root = File.dirname(Object.const_source_location(UI::Base.name).first)
118
+ keyboard_only = Dir.glob("**/*.{rb,html.erb}", base: root).select do |file|
119
+ File.read(File.join(root, file)).match?(/focus-visible:ring/)
120
+ end.map { _1.sub(/\.(rb|html\.erb)\z/, "") }.uniq.sort
121
+
122
+ assert_equal KEYBOARD_ONLY_RINGS.sort, keyboard_only,
123
+ "The focus ring shows on click as well as on Tab (AGENTS.md). Ask the maintainer before using :focus-visible."
124
+ end
98
125
  end
@@ -23,8 +23,8 @@ class UI::ButtonTest < ViewComponent::TestCase
23
23
  assert_includes classes, "bg-destructive"
24
24
  refute_includes classes, "bg-primary"
25
25
  # destructive variant overrides the default focus ring color
26
- assert_includes classes, "focus-visible:ring-destructive"
27
- refute_includes classes, "focus-visible:ring-primary"
26
+ assert_includes classes, "focus:ring-destructive"
27
+ refute_includes classes, "focus:ring-primary"
28
28
  end
29
29
 
30
30
  def test_renders_outline_variant
@@ -49,6 +49,9 @@ class UI::ConfirmDialogTest < ViewComponent::TestCase
49
49
  def test_labels_come_from_i18n
50
50
  # Built from the dotted scope so the namespaced run stores it under its own scope.
51
51
  labels = "ui.confirm_dialog".split(".").reverse.inject({ confirm: "OK", cancel: "Never mind" }) { |h, k| { k => h } }
52
+ # Load the locale files first: I18n loads them on its first lookup, which
53
+ # would put the kit's own labels back over these when this test runs first.
54
+ I18n.backend.eager_load!
52
55
  I18n.backend.store_translations(:en, labels)
53
56
  render_inline(UI::ConfirmDialog.new)
54
57
  assert_equal "OK", dialog["data-ui--confirm-dialog-confirm-label-value"]
@@ -175,14 +175,14 @@ class UI::GalleryTest < ViewComponent::TestCase
175
175
 
176
176
  def test_buttons_keep_the_kits_focus_ring
177
177
  render_gallery
178
- assert_selector "button[aria-label='Show image 1'].focus-visible\\:ring-primary"
179
- assert_selector "button[aria-label='Next image'].focus-visible\\:ring-primary", count: 1, visible: :all
178
+ assert_selector "button[aria-label='Show image 1'].focus\\:ring-primary"
179
+ assert_selector "button[aria-label='Next image'].focus\\:ring-primary", count: 1, visible: :all
180
180
  end
181
181
 
182
182
  def test_overlay_buttons_ring_in_white_to_show_on_the_dark_backdrop
183
183
  render_gallery
184
- assert_selector "dialog button[aria-label='Next image'].focus-visible\\:ring-white", visible: :all
185
- assert_selector "dialog button[aria-label='Close'].focus-visible\\:ring-white", visible: :all
184
+ assert_selector "dialog button[aria-label='Next image'].focus\\:ring-white", visible: :all
185
+ assert_selector "dialog button[aria-label='Close'].focus\\:ring-white", visible: :all
186
186
  end
187
187
 
188
188
  def test_class_and_html_attributes_pass_through
@@ -43,7 +43,7 @@ class UI::LinkTest < ViewComponent::TestCase
43
43
  link = page.find("a", text: "Delete")
44
44
  classes = link[:class].split
45
45
  assert_includes classes, "bg-destructive"
46
- assert_includes classes, "focus-visible:ring-destructive"
46
+ assert_includes classes, "focus:ring-destructive"
47
47
  end
48
48
 
49
49
  def test_size_sm
@@ -47,7 +47,7 @@ class UI::NumberInputTest < ViewComponent::TestCase
47
47
 
48
48
  def test_buttons_keep_the_kits_focus_ring
49
49
  render_input
50
- assert_selector "button.focus-visible\\:ring-2.focus-visible\\:ring-primary.focus\\:z-10", count: 2
50
+ assert_selector "button.focus\\:ring-2.focus\\:ring-primary.focus\\:z-10", count: 2
51
51
  assert_no_selector "button.focus\\:ring-0"
52
52
  assert_no_selector "[data-slot='input-group'].overflow-hidden"
53
53
  end
@@ -87,12 +87,12 @@ class UI::SwitchTest < ViewComponent::TestCase
87
87
  def test_track_span_has_focus_ring_via_peer_focus_visible
88
88
  render_inline(UI::Switch.new(name: "notify"))
89
89
  track = page.all("span", visible: :all).find { |s|
90
- s[:class].to_s.include?("peer-focus-visible:ring-2")
90
+ s[:class].to_s.include?("peer-focus:ring-2")
91
91
  }
92
- assert track, "track span with peer-focus-visible:ring-2 should exist"
92
+ assert track, "track span with peer-focus:ring-2 should exist"
93
93
  classes = track[:class].split
94
- assert_includes classes, "peer-focus-visible:ring-primary"
95
- assert_includes classes, "peer-focus-visible:ring-offset-1"
94
+ assert_includes classes, "peer-focus:ring-primary"
95
+ assert_includes classes, "peer-focus:ring-offset-1"
96
96
  end
97
97
 
98
98
  # ── Thumb ────────────────────────────────────────────────────────────────────
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: velvetkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rathan Kumar