velvetkit 0.4.1 → 0.4.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 +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/velvetkit/version.rb +1 -1
- data/registry/app/components/ui/card/action.html.erb +1 -0
- data/registry/app/components/ui/card/action.rb +14 -0
- data/registry/app/components/ui/card/content.html.erb +1 -1
- data/registry/app/components/ui/card/content.rb +4 -2
- data/registry/app/components/ui/card/description.html.erb +1 -1
- data/registry/app/components/ui/card/description.rb +4 -2
- data/registry/app/components/ui/card/footer.html.erb +1 -1
- data/registry/app/components/ui/card/footer.rb +4 -2
- data/registry/app/components/ui/card/header.html.erb +1 -1
- data/registry/app/components/ui/card/header.rb +9 -2
- data/registry/app/components/ui/card/title.html.erb +1 -1
- data/registry/app/components/ui/card/title.rb +4 -2
- data/registry/app/components/ui/card.html.erb +1 -1
- data/registry/app/components/ui/card.rb +49 -3
- data/registry/components.yml +1 -1
- data/registry/test/components/previews/ui/card_preview/edge_to_edge.html.erb +19 -0
- data/registry/test/components/previews/ui/card_preview/image.html.erb +12 -0
- data/registry/test/components/previews/ui/card_preview/just_content.html.erb +10 -0
- data/registry/test/components/previews/ui/card_preview/open_bill.html.erb +18 -0
- data/registry/test/components/previews/ui/card_preview/playground.html.erb +17 -0
- data/registry/test/components/previews/ui/card_preview/settings_form.html.erb +15 -24
- data/registry/test/components/previews/ui/card_preview/sign_in.html.erb +23 -0
- data/registry/test/components/previews/ui/card_preview/small.html.erb +17 -0
- data/registry/test/components/previews/ui/card_preview/spacing.html.erb +13 -0
- data/registry/test/components/previews/ui/card_preview/stats.html.erb +11 -0
- data/registry/test/components/previews/ui/card_preview/team.html.erb +21 -0
- data/registry/test/components/previews/ui/card_preview.rb +42 -28
- data/registry/test/components/ui/card/action_test.rb +19 -0
- data/registry/test/components/ui/card/content_test.rb +1 -11
- data/registry/test/components/ui/card/footer_test.rb +3 -2
- data/registry/test/components/ui/card/header_test.rb +3 -4
- data/registry/test/components/ui/card/title_test.rb +3 -4
- data/registry/test/components/ui/card_test.rb +63 -2
- metadata +14 -5
- data/registry/test/components/previews/ui/card_preview/complete.html.erb +0 -31
- data/registry/test/components/previews/ui/card_preview/default.html.erb +0 -7
- data/registry/test/components/previews/ui/card_preview/with_footer.html.erb +0 -13
- data/registry/test/components/previews/ui/card_preview/with_header.html.erb +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 72694a7eeade1ead01f0db952b0945196c102cbdab7e500988ac98cf286fd4c8
|
|
4
|
+
data.tar.gz: aab42bfc198a73982c20b53754596ff1cf905b9f211479656ab9ecc5cde5d1c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0401f8a0d91f4186852e0f5431efa7ba15ba6578124ba1ab31de40f79df4fb4cf0019b5665d2ad8844f5051a0220b03775a4c3f7a2f9cec49ac6a7af497b7bdd
|
|
7
|
+
data.tar.gz: c0be11bcf1a941922e3b50b8cb813858bf8daf04c8246e44f1d73cc0472b8401808e95f5ea5b0662b626debd85121762e549802f42069d7ee441af142bc04d9b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.2 — 2026-11-09
|
|
4
|
+
|
|
5
|
+
Changes:
|
|
6
|
+
|
|
7
|
+
- `Card` is redesigned: a soft ring instead of a border and shadow, tighter
|
|
8
|
+
padding, a smaller title, and a tinted footer band. It gains
|
|
9
|
+
`header.with_action` for a button or badge at the top right,
|
|
10
|
+
`card.with_image` for a picture edge to edge across the top, `size: :sm`,
|
|
11
|
+
and `spacing:`. The examples are new.
|
|
12
|
+
|
|
13
|
+
Upgrading an app: re-run `velvetkit:add card`. Cards now have 16px of padding
|
|
14
|
+
where they had 24px; `spacing: 6` gets the old padding back. If you colour a
|
|
15
|
+
card's edge with a `border-*` class, use `ring-*` instead, and remove any
|
|
16
|
+
`pt-6` added to the first part of a card, which the card now handles. A card
|
|
17
|
+
with no parts, just a block, keeps its own padding as before.
|
|
18
|
+
|
|
3
19
|
## 0.4.1 — 2026-11-09
|
|
4
20
|
|
|
5
21
|
New components:
|
data/lib/velvetkit/version.rb
CHANGED
|
@@ -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.4.
|
|
7
|
+
VERSION = "0.4.2"
|
|
8
8
|
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= tag.div(**root_attrs) do %><%= content %><% end %>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# What goes at the top right of a card's header: a button, a badge, a link.
|
|
4
|
+
class UI::Card::Action < UI::Base
|
|
5
|
+
def initialize(class: nil, **html_attrs)
|
|
6
|
+
@user_class = binding.local_variable_get(:class)
|
|
7
|
+
@html_attrs = html_attrs
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def root_attrs
|
|
11
|
+
{ **@html_attrs, class: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", @user_class),
|
|
12
|
+
data: { slot: "card-action", **(@html_attrs[:data] || {}) } }
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%= tag.div
|
|
1
|
+
<%= tag.div(**root_attrs) do %><%= content %><% end %>
|
|
@@ -6,7 +6,9 @@ class UI::Card::Content < UI::Base
|
|
|
6
6
|
@html_attrs = html_attrs
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
def
|
|
10
|
-
cn("
|
|
9
|
+
def root_attrs
|
|
10
|
+
{ **@html_attrs, class: cn("px-(--card-spacing)",
|
|
11
|
+
@user_class),
|
|
12
|
+
data: { slot: "card-content", **(@html_attrs[:data] || {}) } }
|
|
11
13
|
end
|
|
12
14
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%= tag.p
|
|
1
|
+
<%= tag.p(**root_attrs) do %><%= content %><% end %>
|
|
@@ -6,7 +6,9 @@ class UI::Card::Description < UI::Base
|
|
|
6
6
|
@html_attrs = html_attrs
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
def
|
|
10
|
-
cn("text-sm text-muted-foreground",
|
|
9
|
+
def root_attrs
|
|
10
|
+
{ **@html_attrs, class: cn("text-sm text-muted-foreground",
|
|
11
|
+
@user_class),
|
|
12
|
+
data: { slot: "card-description", **(@html_attrs[:data] || {}) } }
|
|
11
13
|
end
|
|
12
14
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%= tag.div
|
|
1
|
+
<%= tag.div(**root_attrs) do %><%= content %><% end %>
|
|
@@ -6,7 +6,9 @@ class UI::Card::Footer < UI::Base
|
|
|
6
6
|
@html_attrs = html_attrs
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
def
|
|
10
|
-
cn("flex items-center
|
|
9
|
+
def root_attrs
|
|
10
|
+
{ **@html_attrs, class: cn("flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",
|
|
11
|
+
@user_class),
|
|
12
|
+
data: { slot: "card-footer", **(@html_attrs[:data] || {}) } }
|
|
11
13
|
end
|
|
12
14
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%= tag.div
|
|
1
|
+
<%= tag.div(**root_attrs) do %><% if title? %><%= title %><% end %><% if description? %><%= description %><% end %><% if action? %><%= action %><% end %><%= content %><% end %>
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
class UI::Card::Header < UI::Base
|
|
4
|
+
# Two columns once there's an action, which then spans the title and
|
|
5
|
+
# description rows.
|
|
6
|
+
CLASSES = "grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) " \
|
|
7
|
+
"has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-(--card-spacing)"
|
|
8
|
+
|
|
4
9
|
renders_one :title, UI::Card::Title
|
|
5
10
|
renders_one :description, UI::Card::Description
|
|
11
|
+
renders_one :action, UI::Card::Action
|
|
6
12
|
|
|
7
13
|
def initialize(class: nil, **html_attrs)
|
|
8
14
|
@user_class = binding.local_variable_get(:class)
|
|
9
15
|
@html_attrs = html_attrs
|
|
10
16
|
end
|
|
11
17
|
|
|
12
|
-
def
|
|
13
|
-
|
|
18
|
+
def root_attrs
|
|
19
|
+
{ **@html_attrs, class: cn(CLASSES, @user_class),
|
|
20
|
+
data: { slot: "card-header", **(@html_attrs[:data] || {}) } }
|
|
14
21
|
end
|
|
15
22
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%= tag.h3
|
|
1
|
+
<%= tag.h3(**root_attrs) do %><%= content %><% end %>
|
|
@@ -6,7 +6,9 @@ class UI::Card::Title < UI::Base
|
|
|
6
6
|
@html_attrs = html_attrs
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
def
|
|
10
|
-
cn("text-
|
|
9
|
+
def root_attrs
|
|
10
|
+
{ **@html_attrs, class: cn("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
|
|
11
|
+
@user_class),
|
|
12
|
+
data: { slot: "card-title", **(@html_attrs[:data] || {}) } }
|
|
11
13
|
end
|
|
12
14
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%= tag.div
|
|
1
|
+
<%= tag.div(**root_attrs) do %><%= image if image? %><%= header if header? %><%= card_content if card_content? %><%= footer if footer? %><%= content %><% end %>
|
|
@@ -1,18 +1,64 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
# A surface that groups one thing: a form, a stat, a person, an event.
|
|
4
|
+
#
|
|
5
|
+
# <%= render(UI::Card.new) do |card| %>
|
|
6
|
+
# <% card.with_header do |header| %>
|
|
7
|
+
# <% header.with_title { "Team" } %>
|
|
8
|
+
# <% header.with_description { "Who can see this project." } %>
|
|
9
|
+
# <% header.with_action { render(UI::Button.new(size: :sm)) { "Invite" } } %>
|
|
10
|
+
# <% end %>
|
|
11
|
+
# <% card.with_content { ... } %>
|
|
12
|
+
# <% card.with_footer { ... } %>
|
|
13
|
+
# <% end %>
|
|
14
|
+
#
|
|
15
|
+
# `with_action` sits at the top right of the header. `with_image(src:, alt:)`
|
|
16
|
+
# runs edge to edge across the top. The footer is a tinted band along the
|
|
17
|
+
# bottom.
|
|
18
|
+
#
|
|
19
|
+
# `size: :sm` is tighter, with a smaller title. `spacing:` sets the gap between
|
|
20
|
+
# the parts and their inset, in Tailwind's steps (4 is 16px, 6 is 24px). Inside
|
|
21
|
+
# the card it's the CSS variable --card-spacing, so content can reach the
|
|
22
|
+
# edges with `-mx-(--card-spacing)` and stay lined up with the rest.
|
|
23
|
+
#
|
|
24
|
+
# A card with no parts, just a block, is a bare surface with no padding of its
|
|
25
|
+
# own: `render(UI::Card.new(class: "p-6")) { ... }`.
|
|
26
|
+
#
|
|
27
|
+
# It doesn't clip its contents, so a menu or date picker opened inside isn't
|
|
28
|
+
# cut off at the card's edge.
|
|
3
29
|
class UI::Card < UI::Base
|
|
30
|
+
SPACING = { default: 4, sm: 3 }.freeze
|
|
31
|
+
|
|
32
|
+
# Only once the card has parts. `^=` matches card-header, card-content and
|
|
33
|
+
# so on, as direct children, which a block of the app's own never is.
|
|
34
|
+
# The footer and image reach the card's edge; those two are `!` because
|
|
35
|
+
# Tailwind's order for these variants would otherwise let py win.
|
|
36
|
+
CLASSES = "group/card rounded-xl bg-card text-card-foreground ring-1 ring-foreground/10 " \
|
|
37
|
+
"has-[>[data-slot^=card-]]:flex has-[>[data-slot^=card-]]:flex-col " \
|
|
38
|
+
"has-[>[data-slot^=card-]]:gap-(--card-spacing) has-[>[data-slot^=card-]]:py-(--card-spacing) " \
|
|
39
|
+
"has-[>[data-slot^=card-]]:text-sm has-[>[data-slot=card-footer]]:pb-0! " \
|
|
40
|
+
"has-[>[data-slot=card-image]:first-child]:pt-0!"
|
|
41
|
+
|
|
42
|
+
renders_one :image, lambda { |src:, alt:, class: nil, **attrs|
|
|
43
|
+
UI::Image.new(src: src, alt: alt, rounded: :none, data: { slot: "card-image" },
|
|
44
|
+
class: cn("aspect-video w-full rounded-t-xl object-cover", binding.local_variable_get(:class)), **attrs)
|
|
45
|
+
}
|
|
4
46
|
renders_one :header, UI::Card::Header
|
|
5
47
|
renders_one :card_content, UI::Card::Content
|
|
6
48
|
renders_one :footer, UI::Card::Footer
|
|
7
49
|
|
|
8
50
|
alias_method :with_content, :with_card_content
|
|
9
51
|
|
|
10
|
-
def initialize(class: nil, **html_attrs)
|
|
52
|
+
def initialize(size: :default, spacing: nil, class: nil, **html_attrs)
|
|
53
|
+
@size = SPACING.key?(size.to_sym) ? size.to_sym : :default
|
|
54
|
+
@spacing = spacing || SPACING[@size]
|
|
11
55
|
@user_class = binding.local_variable_get(:class)
|
|
12
56
|
@html_attrs = html_attrs
|
|
13
57
|
end
|
|
14
58
|
|
|
15
|
-
def
|
|
16
|
-
|
|
59
|
+
def root_attrs
|
|
60
|
+
{ **@html_attrs, class: cn(CLASSES, @user_class),
|
|
61
|
+
style: [ "--card-spacing: calc(var(--spacing) * #{@spacing})", @html_attrs[:style] ].compact.join("; "),
|
|
62
|
+
data: { slot: "card", size: @size, **(@html_attrs[:data] || {}) } }
|
|
17
63
|
end
|
|
18
64
|
end
|
data/registry/components.yml
CHANGED
|
@@ -41,7 +41,7 @@ components:
|
|
|
41
41
|
button_to:
|
|
42
42
|
description: A button that submits a one-off form, like Rails' button_to.
|
|
43
43
|
card:
|
|
44
|
-
description: A
|
|
44
|
+
description: A surface for one thing, with a header and action, body, footer and optional image.
|
|
45
45
|
chart:
|
|
46
46
|
description: Line and bar charts, with a legend, tooltips and the numbers as a table, on Chart.js.
|
|
47
47
|
checkbox:
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<%# The negative margins cancel the card's inset and the gap above the footer, so they stay right at any spacing. %>
|
|
2
|
+
<%= render(UI::Card.new(spacing: 6, class: "max-w-md")) do |card| %>
|
|
3
|
+
<% card.with_header do |header| %>
|
|
4
|
+
<% header.with_title { "Terms of service" } %>
|
|
5
|
+
<% header.with_description { "Please read these before carrying on." } %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<% card.with_content do %>
|
|
8
|
+
<div class="-mx-(--card-spacing) -mb-(--card-spacing) max-h-40 space-y-3 overflow-y-auto border-t px-(--card-spacing) py-3 text-muted-foreground" tabindex="0">
|
|
9
|
+
<p>You keep everything you upload. We only use it to run the service for you.</p>
|
|
10
|
+
<p>You can export your data at any time, and when you close your account we delete it within 30 days.</p>
|
|
11
|
+
<p>We'll tell you a month ahead if these terms change, and you can leave before they do.</p>
|
|
12
|
+
<p>Don't use the service to break the law or to get in the way of other people using it.</p>
|
|
13
|
+
</div>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% card.with_footer(class: "justify-end gap-2") do %>
|
|
16
|
+
<%= render(UI::Button.new(variant: :outline, size: :sm)) { "Decline" } %>
|
|
17
|
+
<%= render(UI::Button.new(size: :sm)) { "Accept" } %>
|
|
18
|
+
<% end %>
|
|
19
|
+
<% end %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%= render(UI::Card.new(class: "max-w-sm")) do |card| %>
|
|
2
|
+
<% card.with_image(src: UI::CardPreview.photo("#0f766e", "#1d4ed8"), alt: "Hills under a pale sun") %>
|
|
3
|
+
<% card.with_header do |header| %>
|
|
4
|
+
<% header.with_title { "Coastal walk, Saturday" } %>
|
|
5
|
+
<% header.with_description { "Twelve kilometres along the cliffs, with lunch at the harbour." } %>
|
|
6
|
+
<% header.with_action { render(UI::Badge.new(variant: :secondary, size: :sm)) { "Featured" } } %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% card.with_footer(class: "justify-between") do %>
|
|
9
|
+
<span class="text-muted-foreground">18 going</span>
|
|
10
|
+
<%= render(UI::Button.new(size: :sm)) { "Join" } %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% end %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<div class="grid max-w-sm gap-4">
|
|
2
|
+
<%= render(UI::Card.new) do |card| %>
|
|
3
|
+
<% card.with_content do %>
|
|
4
|
+
<p class="text-muted-foreground">One part: the card's padding still applies.</p>
|
|
5
|
+
<% end %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<%= render(UI::Card.new(class: "p-8 text-center")) do %>
|
|
8
|
+
<p class="text-muted-foreground">No parts, just a block: a bare surface, padded however you like.</p>
|
|
9
|
+
<% end %>
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<%= render(UI::Card.new(size: :sm, class: "max-w-xs")) do |card| %>
|
|
2
|
+
<% card.with_header do |header| %>
|
|
3
|
+
<% header.with_title { "Table 12" } %>
|
|
4
|
+
<% header.with_description { "Opened 19:42 by Priya" } %>
|
|
5
|
+
<% header.with_action { render(UI::Badge.new(variant: :secondary, size: :sm)) { "Open" } } %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<% card.with_content do %>
|
|
8
|
+
<dl class="grid grid-cols-[1fr_auto] gap-y-1 tabular-nums">
|
|
9
|
+
<dt>2 × Masala dosa</dt><dd>₹360.00</dd>
|
|
10
|
+
<dt>1 × Filter coffee</dt><dd>₹70.00</dd>
|
|
11
|
+
<dt class="text-muted-foreground">GST at 5%</dt><dd class="text-muted-foreground">₹21.50</dd>
|
|
12
|
+
</dl>
|
|
13
|
+
<% end %>
|
|
14
|
+
<% card.with_footer(class: "justify-between") do %>
|
|
15
|
+
<span class="font-semibold tabular-nums">₹451.50</span>
|
|
16
|
+
<%= render(UI::Button.new(size: :sm)) { "Charge" } %>
|
|
17
|
+
<% end %>
|
|
18
|
+
<% end %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%= render(UI::Card.new(size: size, spacing: spacing, class: "max-w-sm")) do |card| %>
|
|
2
|
+
<% card.with_image(src: UI::CardPreview.photo("#7c3aed", "#db2777"), alt: "An abstract landscape") if show_image %>
|
|
3
|
+
<% card.with_header do |header| %>
|
|
4
|
+
<% header.with_title { title } %>
|
|
5
|
+
<% header.with_description { description } %>
|
|
6
|
+
<% header.with_action { render(UI::Badge.new(variant: :secondary, size: :sm)) { "New" } } if show_action %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% card.with_content do %>
|
|
9
|
+
<p class="text-muted-foreground">Pick a repository and we'll build it on every push.</p>
|
|
10
|
+
<% end %>
|
|
11
|
+
<% if show_footer %>
|
|
12
|
+
<% card.with_footer(class: "justify-end gap-2") do %>
|
|
13
|
+
<%= render(UI::Button.new(variant: :outline, size: :sm)) { "Cancel" } %>
|
|
14
|
+
<%= render(UI::Button.new(size: :sm)) { "Deploy" } %>
|
|
15
|
+
<% end %>
|
|
16
|
+
<% end %>
|
|
17
|
+
<% end %>
|
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<%
|
|
4
|
-
|
|
5
|
-
<% header.with_description { "Update your account preferences." } %>
|
|
6
|
-
<% end %>
|
|
7
|
-
<% card.with_content do %>
|
|
8
|
-
<div class="space-y-4">
|
|
9
|
-
<div class="space-y-2">
|
|
10
|
-
<%= render(UI::Label.new(for: "name")) { "Display Name" } %>
|
|
11
|
-
<%= render(UI::Input.new(id: "name", placeholder: "Enter your name")) %>
|
|
12
|
-
</div>
|
|
13
|
-
<div class="space-y-2">
|
|
14
|
-
<%= render(UI::Label.new(for: "username")) { "Username" } %>
|
|
15
|
-
<%= render(UI::Input.new(id: "username", placeholder: "@username")) %>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
<% end %>
|
|
19
|
-
<% card.with_footer do %>
|
|
20
|
-
<div class="flex gap-2">
|
|
21
|
-
<%= render(UI::Button.new(variant: :primary, size: :sm)) { "Save Changes" } %>
|
|
22
|
-
</div>
|
|
23
|
-
<% end %>
|
|
1
|
+
<%= render(UI::Card.new(class: "max-w-md")) do |card| %>
|
|
2
|
+
<% card.with_header(class: "border-b") do |header| %>
|
|
3
|
+
<% header.with_title { "Profile" } %>
|
|
4
|
+
<% header.with_description { "This is how others see you." } %>
|
|
24
5
|
<% end %>
|
|
25
|
-
|
|
6
|
+
<% card.with_content do %>
|
|
7
|
+
<div class="grid gap-4">
|
|
8
|
+
<%= render(UI::Input.new(name: "display_name", label: "Display name", value: "Maya Okafor")) %>
|
|
9
|
+
<%= render(UI::Input.new(name: "username", label: "Username", value: "maya", hint: "Letters and numbers only.")) %>
|
|
10
|
+
</div>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% card.with_footer(class: "justify-between") do %>
|
|
13
|
+
<span class="text-muted-foreground">Last saved 2 days ago</span>
|
|
14
|
+
<%= render(UI::Button.new(size: :sm)) { "Save" } %>
|
|
15
|
+
<% end %>
|
|
16
|
+
<% end %>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<%= render(UI::Card.new(class: "max-w-sm")) do |card| %>
|
|
2
|
+
<% card.with_header do |header| %>
|
|
3
|
+
<% header.with_title { "Sign in to your workspace" } %>
|
|
4
|
+
<% header.with_description { "Use your email and password." } %>
|
|
5
|
+
<% header.with_action do %><%= render(UI::Button.new(variant: :link, size: :sm, class: "px-0")) { "Create account" } %><% end %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<% card.with_content do %>
|
|
8
|
+
<div class="grid gap-4">
|
|
9
|
+
<%= render(UI::Input.new(type: :email, name: "email", label: "Email", placeholder: "you@example.com")) %>
|
|
10
|
+
<div class="grid gap-2">
|
|
11
|
+
<div class="flex items-center justify-between">
|
|
12
|
+
<%= render(UI::Label.new(for: "card-password")) { "Password" } %>
|
|
13
|
+
<a href="#" class="text-xs text-muted-foreground underline-offset-4 hover:underline">Forgot it?</a>
|
|
14
|
+
</div>
|
|
15
|
+
<%= render(UI::Input.new(type: :password, name: "password", id: "card-password")) %>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<% end %>
|
|
19
|
+
<% card.with_footer(class: "flex-col gap-2") do %>
|
|
20
|
+
<%= render(UI::Button.new(class: "w-full")) { "Sign in" } %>
|
|
21
|
+
<%= render(UI::Button.new(variant: :outline, class: "w-full")) { "Continue with single sign-on" } %>
|
|
22
|
+
<% end %>
|
|
23
|
+
<% end %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%= render(UI::Card.new(size: :sm, class: "max-w-xs")) do |card| %>
|
|
2
|
+
<% card.with_header do |header| %>
|
|
3
|
+
<% header.with_title { "Weekly digest" } %>
|
|
4
|
+
<% header.with_description { "One email, every Monday morning." } %>
|
|
5
|
+
<% end %>
|
|
6
|
+
<% card.with_content do %>
|
|
7
|
+
<ul class="list-disc space-y-1 ps-4 text-muted-foreground">
|
|
8
|
+
<li>New comments on your projects</li>
|
|
9
|
+
<li>Tasks due this week</li>
|
|
10
|
+
<li>Who joined your team</li>
|
|
11
|
+
</ul>
|
|
12
|
+
<% end %>
|
|
13
|
+
<% card.with_footer(class: "gap-2") do %>
|
|
14
|
+
<%= render(UI::Button.new(size: :sm)) { "Turn on" } %>
|
|
15
|
+
<%= render(UI::Button.new(variant: :ghost, size: :sm)) { "See an example" } %>
|
|
16
|
+
<% end %>
|
|
17
|
+
<% end %>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<div class="grid gap-4 sm:grid-cols-2">
|
|
2
|
+
<% { 4 => "16px, the default", 5 => "20px", 6 => "24px", 8 => "32px" }.each do |spacing, label| %>
|
|
3
|
+
<%= render(UI::Card.new(spacing: spacing)) do |card| %>
|
|
4
|
+
<% card.with_header do |header| %>
|
|
5
|
+
<% header.with_title { "spacing: #{spacing}" } %>
|
|
6
|
+
<% header.with_description { label } %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% card.with_content do %>
|
|
9
|
+
<p class="text-muted-foreground">The gaps between the parts and their inset change together.</p>
|
|
10
|
+
<% end %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% end %>
|
|
13
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<div class="grid gap-4 sm:grid-cols-3">
|
|
2
|
+
<% [ [ "Active users", "8,249", "+12%" ], [ "Open tickets", "37", "-4" ], [ "Storage used", "64%", "+2%" ] ].each do |label, value, change| %>
|
|
3
|
+
<%= render(UI::Card.new) do |card| %>
|
|
4
|
+
<% card.with_header do |header| %>
|
|
5
|
+
<% header.with_description { label } %>
|
|
6
|
+
<% header.with_title(class: "text-2xl font-semibold tabular-nums") { value } %>
|
|
7
|
+
<% header.with_action { render(UI::Badge.new(variant: :outline, size: :sm)) { change } } %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% end %>
|
|
10
|
+
<% end %>
|
|
11
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<%= render(UI::Card.new(class: "max-w-md")) do |card| %>
|
|
2
|
+
<% card.with_header do |header| %>
|
|
3
|
+
<% header.with_title { "Team" } %>
|
|
4
|
+
<% header.with_description { "Who can see this project." } %>
|
|
5
|
+
<% header.with_action { render(UI::Button.new(variant: :outline, size: :sm)) { "Invite" } } %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<% card.with_content do %>
|
|
8
|
+
<ul class="grid gap-3">
|
|
9
|
+
<% [ [ "Maya Okafor", "maya@example.com", "Owner" ], [ "Tomás Reyes", "tomas@example.com", "Editor" ], [ "Li Wei", "li@example.com", "Viewer" ] ].each do |name, email, role| %>
|
|
10
|
+
<li class="flex items-center gap-3">
|
|
11
|
+
<%= render(UI::Avatar.new) { name.split.map(&:first).join } %>
|
|
12
|
+
<div class="min-w-0 flex-1">
|
|
13
|
+
<p class="truncate font-medium"><%= name %></p>
|
|
14
|
+
<p class="truncate text-muted-foreground"><%= email %></p>
|
|
15
|
+
</div>
|
|
16
|
+
<%= render(UI::Badge.new(variant: :secondary, size: :sm)) { role } %>
|
|
17
|
+
</li>
|
|
18
|
+
<% end %>
|
|
19
|
+
</ul>
|
|
20
|
+
<% end %>
|
|
21
|
+
<% end %>
|
|
@@ -1,44 +1,58 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
class UI::CardPreview < ViewComponent::Preview
|
|
4
|
+
# Drawn here so the previews need no image files.
|
|
5
|
+
def self.photo(from, to)
|
|
6
|
+
svg = "<svg xmlns='http://www.w3.org/2000/svg' width='800' height='450'>" \
|
|
7
|
+
"<defs><linearGradient id='g' x2='1' y2='1'><stop stop-color='#{from}'/><stop offset='1' stop-color='#{to}'/>" \
|
|
8
|
+
"</linearGradient></defs><rect width='800' height='450' fill='url(#g)'/>" \
|
|
9
|
+
"<circle cx='620' cy='120' r='70' fill='#fff' fill-opacity='.35'/>" \
|
|
10
|
+
"<path d='M0 450 240 210l150 140 110-90 300 190z' fill='#000' fill-opacity='.18'/></svg>"
|
|
11
|
+
"data:image/svg+xml,#{ERB::Util.url_encode(svg)}"
|
|
12
|
+
end
|
|
13
|
+
|
|
4
14
|
# @label Playground
|
|
5
15
|
# @param title text
|
|
6
16
|
# @param description text
|
|
17
|
+
# @param size select { choices: [default, sm] }
|
|
18
|
+
# @param spacing select { choices: ["", 3, 4, 5, 6, 8] } "Blank follows the size"
|
|
19
|
+
# @param show_action toggle
|
|
20
|
+
# @param show_image toggle
|
|
7
21
|
# @param show_footer toggle
|
|
8
|
-
def playground(title: "Create project", description: "Deploy your new project in one click.",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
end
|
|
14
|
-
card.with_content do
|
|
15
|
-
tag.p(class: "text-sm text-muted-foreground") { "Card body content goes here." }
|
|
16
|
-
end
|
|
17
|
-
if show_footer
|
|
18
|
-
card.with_footer do
|
|
19
|
-
tag.div(class: "flex gap-2") do
|
|
20
|
-
safe_join([
|
|
21
|
-
render(UI::Button.new(variant: :primary, size: :sm)) { "Deploy" },
|
|
22
|
-
render(UI::Button.new(variant: :outline, size: :sm)) { "Cancel" }
|
|
23
|
-
])
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
22
|
+
def playground(title: "Create project", description: "Deploy your new project in one click.", size: :default,
|
|
23
|
+
spacing: "", show_action: true, show_image: false, show_footer: true)
|
|
24
|
+
render_with_template(locals: { title: title, description: description, size: size.to_sym,
|
|
25
|
+
spacing: spacing.presence&.to_i, show_action: show_action,
|
|
26
|
+
show_image: show_image, show_footer: show_footer })
|
|
28
27
|
end
|
|
29
28
|
|
|
30
|
-
# @label
|
|
31
|
-
def
|
|
29
|
+
# @label Sign In
|
|
30
|
+
def sign_in; render_with_template; end
|
|
32
31
|
|
|
33
|
-
# @label
|
|
34
|
-
def
|
|
32
|
+
# @label Small
|
|
33
|
+
def small; render_with_template; end
|
|
35
34
|
|
|
36
|
-
# @label With
|
|
37
|
-
def
|
|
35
|
+
# @label With an Image
|
|
36
|
+
def image; render_with_template; end
|
|
38
37
|
|
|
39
|
-
# @label
|
|
40
|
-
def
|
|
38
|
+
# @label Stats, with a Badge as the Action
|
|
39
|
+
def stats; render_with_template; end
|
|
40
|
+
|
|
41
|
+
# @label Team, with a Button as the Action
|
|
42
|
+
def team; render_with_template; end
|
|
41
43
|
|
|
42
44
|
# @label Settings Form
|
|
43
45
|
def settings_form; render_with_template; end
|
|
46
|
+
|
|
47
|
+
# @label Spacing
|
|
48
|
+
def spacing; render_with_template; end
|
|
49
|
+
|
|
50
|
+
# @label Content to the Edges
|
|
51
|
+
def edge_to_edge; render_with_template; end
|
|
52
|
+
|
|
53
|
+
# @label Just Content
|
|
54
|
+
def just_content; render_with_template; end
|
|
55
|
+
|
|
56
|
+
# @label Open Bill at a Till
|
|
57
|
+
def open_bill; render_with_template; end
|
|
44
58
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
|
|
5
|
+
class UI::Card::ActionTest < ViewComponent::TestCase
|
|
6
|
+
def setup_fixtures(*); end
|
|
7
|
+
def teardown_fixtures(*); end
|
|
8
|
+
|
|
9
|
+
def test_sits_in_the_headers_second_column
|
|
10
|
+
render_inline(UI::Card::Action.new) { "Invite" }
|
|
11
|
+
action = page.find("[data-slot='card-action']", text: "Invite")
|
|
12
|
+
%w[col-start-2 row-span-2 row-start-1 justify-self-end].each { |c| assert_includes action[:class].split, c }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def test_passes_class_and_attributes
|
|
16
|
+
render_inline(UI::Card::Action.new(class: "self-center", id: "a", data: { testid: "t" })) { "x" }
|
|
17
|
+
assert_selector "#a.self-center[data-testid='t'][data-slot='card-action']"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -14,8 +14,7 @@ class UI::Card::ContentTest < ViewComponent::TestCase
|
|
|
14
14
|
def test_default_classes
|
|
15
15
|
render_inline(UI::Card::Content.new) { "x" }
|
|
16
16
|
classes = page.find("div")[:class].split
|
|
17
|
-
assert_includes classes, "
|
|
18
|
-
assert_includes classes, "pt-0"
|
|
17
|
+
assert_includes classes, "px-(--card-spacing)"
|
|
19
18
|
end
|
|
20
19
|
|
|
21
20
|
def test_user_class_override
|
|
@@ -29,13 +28,4 @@ class UI::Card::ContentTest < ViewComponent::TestCase
|
|
|
29
28
|
render_inline(UI::Card::Content.new(id: "my-content", data: { test_id: "c" })) { "x" }
|
|
30
29
|
assert_selector "div#my-content[data-test-id='c']"
|
|
31
30
|
end
|
|
32
|
-
|
|
33
|
-
# Content sits flush under a header, but needs its own top padding when it
|
|
34
|
-
# is the first thing in the card.
|
|
35
|
-
def test_content_first_in_a_card_gets_top_padding
|
|
36
|
-
render_inline(UI::Card::Content.new) { "Body" }
|
|
37
|
-
classes = page.find("div")[:class].split
|
|
38
|
-
assert_includes classes, "pt-0"
|
|
39
|
-
assert_includes classes, "first:pt-6"
|
|
40
|
-
end
|
|
41
31
|
end
|
|
@@ -16,8 +16,9 @@ class UI::Card::FooterTest < ViewComponent::TestCase
|
|
|
16
16
|
classes = page.find("div")[:class].split
|
|
17
17
|
assert_includes classes, "flex"
|
|
18
18
|
assert_includes classes, "items-center"
|
|
19
|
-
assert_includes classes, "p-
|
|
20
|
-
assert_includes classes, "
|
|
19
|
+
assert_includes classes, "p-(--card-spacing)"
|
|
20
|
+
assert_includes classes, "border-t"
|
|
21
|
+
assert_includes classes, "bg-muted/50"
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
def test_user_class_override
|
|
@@ -14,10 +14,9 @@ class UI::Card::HeaderTest < ViewComponent::TestCase
|
|
|
14
14
|
def test_default_classes
|
|
15
15
|
render_inline(UI::Card::Header.new) { "x" }
|
|
16
16
|
classes = page.find("div")[:class].split
|
|
17
|
-
assert_includes classes, "
|
|
18
|
-
assert_includes classes, "
|
|
19
|
-
assert_includes classes, "
|
|
20
|
-
assert_includes classes, "p-6"
|
|
17
|
+
assert_includes classes, "grid"
|
|
18
|
+
assert_includes classes, "gap-1"
|
|
19
|
+
assert_includes classes, "px-(--card-spacing)"
|
|
21
20
|
end
|
|
22
21
|
|
|
23
22
|
def test_renders_with_title_slot
|
|
@@ -14,10 +14,9 @@ class UI::Card::TitleTest < ViewComponent::TestCase
|
|
|
14
14
|
def test_default_classes
|
|
15
15
|
render_inline(UI::Card::Title.new) { "x" }
|
|
16
16
|
classes = page.find("h3")[:class].split
|
|
17
|
-
assert_includes classes, "text-
|
|
18
|
-
assert_includes classes, "font-
|
|
19
|
-
assert_includes classes, "leading-
|
|
20
|
-
assert_includes classes, "tracking-tight"
|
|
17
|
+
assert_includes classes, "text-base"
|
|
18
|
+
assert_includes classes, "font-medium"
|
|
19
|
+
assert_includes classes, "leading-snug"
|
|
21
20
|
end
|
|
22
21
|
|
|
23
22
|
def test_user_class_override
|
|
@@ -15,10 +15,10 @@ class UI::CardTest < ViewComponent::TestCase
|
|
|
15
15
|
render_inline(UI::Card.new) { "x" }
|
|
16
16
|
classes = page.find("div")[:class].split
|
|
17
17
|
assert_includes classes, "rounded-xl"
|
|
18
|
-
assert_includes classes, "
|
|
18
|
+
assert_includes classes, "ring-1"
|
|
19
19
|
assert_includes classes, "bg-card"
|
|
20
20
|
assert_includes classes, "text-card-foreground"
|
|
21
|
-
|
|
21
|
+
assert_not_includes classes, "overflow-hidden"
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def test_renders_with_header_slot
|
|
@@ -64,4 +64,65 @@ class UI::CardTest < ViewComponent::TestCase
|
|
|
64
64
|
render_inline(UI::Card.new(id: "my-card", data: { test_id: "card-x" })) { "x" }
|
|
65
65
|
assert_selector "div#my-card[data-test-id='card-x']"
|
|
66
66
|
end
|
|
67
|
+
|
|
68
|
+
def root = page.find("[data-slot='card']")
|
|
69
|
+
|
|
70
|
+
def test_size_and_spacing
|
|
71
|
+
render_inline(UI::Card.new) { "x" }
|
|
72
|
+
assert_equal "default", root["data-size"]
|
|
73
|
+
assert_includes root[:style], "--card-spacing: calc(var(--spacing) * 4)"
|
|
74
|
+
render_inline(UI::Card.new(size: :sm)) { "x" }
|
|
75
|
+
assert_equal "sm", root["data-size"]
|
|
76
|
+
assert_includes root[:style], "calc(var(--spacing) * 3)"
|
|
77
|
+
render_inline(UI::Card.new(size: :sm, spacing: 8)) { "x" }
|
|
78
|
+
assert_includes root[:style], "calc(var(--spacing) * 8)"
|
|
79
|
+
render_inline(UI::Card.new(size: :nonsense)) { "x" }
|
|
80
|
+
assert_equal "default", root["data-size"]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def test_keeps_the_apps_style_and_data
|
|
84
|
+
render_inline(UI::Card.new(style: "max-width: 10rem", data: { testid: "c" })) { "x" }
|
|
85
|
+
assert_includes root[:style], "max-width: 10rem"
|
|
86
|
+
assert_equal "c", root["data-testid"]
|
|
87
|
+
assert_equal "card", root["data-slot"]
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def test_each_part_is_marked_so_the_card_can_lay_itself_out
|
|
91
|
+
render_inline(UI::Card.new) do |card|
|
|
92
|
+
card.with_header do |header|
|
|
93
|
+
header.with_title { "T" }
|
|
94
|
+
header.with_description { "D" }
|
|
95
|
+
header.with_action { "A" }
|
|
96
|
+
end
|
|
97
|
+
card.with_content { "C" }
|
|
98
|
+
card.with_footer { "F" }
|
|
99
|
+
end
|
|
100
|
+
assert_selector "[data-slot='card'] > [data-slot='card-header'] > h3[data-slot='card-title']", text: "T"
|
|
101
|
+
assert_selector "[data-slot='card-header'] > p[data-slot='card-description']", text: "D"
|
|
102
|
+
assert_selector "[data-slot='card-header'] > [data-slot='card-action']", text: "A"
|
|
103
|
+
assert_selector "[data-slot='card'] > [data-slot='card-content']", text: "C"
|
|
104
|
+
assert_selector "[data-slot='card'] > [data-slot='card-footer']", text: "F"
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def test_image_comes_first_edge_to_edge
|
|
108
|
+
render_inline(UI::Card.new) do |card|
|
|
109
|
+
card.with_header { "H" }
|
|
110
|
+
card.with_image(src: "data:image/gif;base64,R0lGOD", alt: "A hill", class: "aspect-square")
|
|
111
|
+
end
|
|
112
|
+
image = page.find("[data-slot='card'] > img:first-child")
|
|
113
|
+
assert_equal "card-image", image["data-slot"]
|
|
114
|
+
assert_equal "A hill", image[:alt]
|
|
115
|
+
classes = image[:class].split
|
|
116
|
+
assert_includes classes, "rounded-t-xl"
|
|
117
|
+
assert_includes classes, "aspect-square"
|
|
118
|
+
assert_not_includes classes, "aspect-video"
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def test_a_block_with_no_parts_has_no_part_styles_of_its_own
|
|
122
|
+
render_inline(UI::Card.new(class: "p-6")) { "<div>raw</div>".html_safe }
|
|
123
|
+
assert_no_selector "[data-slot='card'] > [data-slot^='card-']"
|
|
124
|
+
assert_includes root[:class].split, "p-6"
|
|
125
|
+
assert_not_includes root[:class].split, "flex"
|
|
126
|
+
assert_not_includes root[:class].split, "text-sm"
|
|
127
|
+
end
|
|
67
128
|
end
|
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.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rathan Kumar
|
|
@@ -95,6 +95,8 @@ files:
|
|
|
95
95
|
- registry/app/components/ui/button_to.rb
|
|
96
96
|
- registry/app/components/ui/card.html.erb
|
|
97
97
|
- registry/app/components/ui/card.rb
|
|
98
|
+
- registry/app/components/ui/card/action.html.erb
|
|
99
|
+
- registry/app/components/ui/card/action.rb
|
|
98
100
|
- registry/app/components/ui/card/content.html.erb
|
|
99
101
|
- registry/app/components/ui/card/content.rb
|
|
100
102
|
- registry/app/components/ui/card/description.html.erb
|
|
@@ -664,11 +666,17 @@ files:
|
|
|
664
666
|
- registry/test/components/previews/ui/button_to_preview/variants.html.erb
|
|
665
667
|
- registry/test/components/previews/ui/button_to_preview/with_icon.html.erb
|
|
666
668
|
- registry/test/components/previews/ui/card_preview.rb
|
|
667
|
-
- registry/test/components/previews/ui/card_preview/
|
|
668
|
-
- registry/test/components/previews/ui/card_preview/
|
|
669
|
+
- registry/test/components/previews/ui/card_preview/edge_to_edge.html.erb
|
|
670
|
+
- registry/test/components/previews/ui/card_preview/image.html.erb
|
|
671
|
+
- registry/test/components/previews/ui/card_preview/just_content.html.erb
|
|
672
|
+
- registry/test/components/previews/ui/card_preview/open_bill.html.erb
|
|
673
|
+
- registry/test/components/previews/ui/card_preview/playground.html.erb
|
|
669
674
|
- registry/test/components/previews/ui/card_preview/settings_form.html.erb
|
|
670
|
-
- registry/test/components/previews/ui/card_preview/
|
|
671
|
-
- registry/test/components/previews/ui/card_preview/
|
|
675
|
+
- registry/test/components/previews/ui/card_preview/sign_in.html.erb
|
|
676
|
+
- registry/test/components/previews/ui/card_preview/small.html.erb
|
|
677
|
+
- registry/test/components/previews/ui/card_preview/spacing.html.erb
|
|
678
|
+
- registry/test/components/previews/ui/card_preview/stats.html.erb
|
|
679
|
+
- registry/test/components/previews/ui/card_preview/team.html.erb
|
|
672
680
|
- registry/test/components/previews/ui/chart_preview.rb
|
|
673
681
|
- registry/test/components/previews/ui/chart_preview/cash_flow.html.erb
|
|
674
682
|
- registry/test/components/previews/ui/chart_preview/donut.html.erb
|
|
@@ -949,6 +957,7 @@ files:
|
|
|
949
957
|
- registry/test/components/ui/breadcrumb_test.rb
|
|
950
958
|
- registry/test/components/ui/button_test.rb
|
|
951
959
|
- registry/test/components/ui/button_to_test.rb
|
|
960
|
+
- registry/test/components/ui/card/action_test.rb
|
|
952
961
|
- registry/test/components/ui/card/content_test.rb
|
|
953
962
|
- registry/test/components/ui/card/description_test.rb
|
|
954
963
|
- registry/test/components/ui/card/footer_test.rb
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<div class="max-w-sm">
|
|
2
|
-
<%= render(UI::Card.new) do |card| %>
|
|
3
|
-
<% card.with_header do |header| %>
|
|
4
|
-
<% header.with_title { "Team Members" } %>
|
|
5
|
-
<% header.with_description { "Manage your team and permissions." } %>
|
|
6
|
-
<% end %>
|
|
7
|
-
<% card.with_content do %>
|
|
8
|
-
<div class="space-y-3">
|
|
9
|
-
<div class="flex items-center gap-3">
|
|
10
|
-
<div class="h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center text-xs font-medium text-primary">JD</div>
|
|
11
|
-
<div>
|
|
12
|
-
<p class="text-sm font-medium">John Doe</p>
|
|
13
|
-
<p class="text-xs text-muted-foreground">Admin</p>
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
<div class="flex items-center gap-3">
|
|
17
|
-
<div class="h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center text-xs font-medium text-primary">AS</div>
|
|
18
|
-
<div>
|
|
19
|
-
<p class="text-sm font-medium">Alice Smith</p>
|
|
20
|
-
<p class="text-xs text-muted-foreground">Editor</p>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
<% end %>
|
|
25
|
-
<% card.with_footer do %>
|
|
26
|
-
<div class="flex gap-2 w-full">
|
|
27
|
-
<%= render(UI::Button.new(variant: :outline, size: :sm, class: "w-full")) { "Invite Member" } %>
|
|
28
|
-
</div>
|
|
29
|
-
<% end %>
|
|
30
|
-
<% end %>
|
|
31
|
-
</div>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<div class="max-w-sm">
|
|
2
|
-
<%= render(UI::Card.new) do |card| %>
|
|
3
|
-
<% card.with_content do %>
|
|
4
|
-
<p class="text-sm text-muted-foreground">Card with body content and a footer containing actions.</p>
|
|
5
|
-
<% end %>
|
|
6
|
-
<% card.with_footer do %>
|
|
7
|
-
<div class="flex gap-2">
|
|
8
|
-
<%= render(UI::Button.new(variant: :primary, size: :sm)) { "Save" } %>
|
|
9
|
-
<%= render(UI::Button.new(variant: :outline, size: :sm)) { "Cancel" } %>
|
|
10
|
-
</div>
|
|
11
|
-
<% end %>
|
|
12
|
-
<% end %>
|
|
13
|
-
</div>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<div class="max-w-sm">
|
|
2
|
-
<%= render(UI::Card.new) do |card| %>
|
|
3
|
-
<% card.with_header do |header| %>
|
|
4
|
-
<% header.with_title { "Notifications" } %>
|
|
5
|
-
<% header.with_description { "Configure how you receive notifications." } %>
|
|
6
|
-
<% end %>
|
|
7
|
-
<% card.with_content do %>
|
|
8
|
-
<p class="text-sm text-muted-foreground">Card with a header containing a title and description.</p>
|
|
9
|
-
<% end %>
|
|
10
|
-
<% end %>
|
|
11
|
-
</div>
|