Skip to content

Commit 13421cb

Browse files
authored
Merge branch 'main' into switch
2 parents 096d5d5 + 3ee3442 commit 13421cb

24 files changed

+365
-84
lines changed

Gemfile.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ GIT
1414

1515
GIT
1616
remote: https://github.com/ruby-ui/ruby_ui.git
17-
revision: 8909f0ecdd9ade28b01d76946e9d7438849b5856
17+
revision: aa983e83f1ece8a3f62c4e816c07d2a2f17b6b90
1818
branch: main
1919
specs:
20-
ruby_ui (1.0.0.pre.alpha.4)
20+
ruby_ui (1.0.0.beta1)
2121

2222
GEM
2323
remote: https://rubygems.org/

README.md

-56
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,6 @@ Rails need a plug n play system for creating streamlined ui components.
22

33
Phlex looks fun and fast, so I thought I'd start creating ui components with it.
44

5-
Here is the list of components that are being built. For reference, see here https://ui.shadcn.com/docs/components/accordion
6-
7-
✅ Accordion
8-
✅ Alert
9-
✅ Alert Dialog
10-
✅ Aspect Ratio
11-
✅ Avatar
12-
✅ Badge
13-
✅ Button
14-
✅ Calendar
15-
✅ Card
16-
✅ Checkbox
17-
✅ Checkbox Group
18-
✅ Codeblock
19-
✅ Collapsible
20-
⚪️ Combobox
21-
✅ Command
22-
⚪️ Context Menu
23-
⚪️ Data Table
24-
✅ Date Picker
25-
✅ Dialog
26-
✅ Dropdown Menu
27-
⚪️ Form
28-
✅ Hover Card
29-
✅ Input
30-
✅ Label
31-
✅ Link
32-
⚪️ Menubar
33-
⚪️ Navigation Menu
34-
✅ Pagination
35-
✅ Popover
36-
⚪️ Progress
37-
⚪️ Radio Group
38-
⚪️ Scroll Area
39-
⚪️ Select
40-
⚪️ Separator
41-
✅ Sheet
42-
⚪️ Skeleton
43-
⚪️ Slider
44-
⚪️ Switch
45-
⚪️ Table
46-
✅ Tabs
47-
✅ Textarea
48-
⚪️ Toast
49-
⚪️ Toggle
50-
✅ Tooltip
51-
✅ Typography
52-
535
## Contributing - Local Development Setup
546

557
### Install the Gem Locally
@@ -60,14 +12,6 @@ To contribute to this project, it's recommended to install the gem locally and p
6012
gem "ruby_ui", path: "../ruby_ui"
6113
```
6214

63-
### Link the JavaScript Package
64-
65-
Similarly, link the rbui-js package locally using yarn:
66-
67-
```bash
68-
yarn add ../ruby_ui
69-
```
70-
7115
## Working with Components
7216

7317
### Component Development Workflow

app/assets/.DS_Store

6 KB
Binary file not shown.

app/assets/images/logo.svg

+30-7
Loading

app/assets/images/logo_dark.svg

+30-7
Loading

app/components/ruby_ui/alert.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def colors
2727
end
2828

2929
def default_attrs
30-
base_classes = "backdrop-blur relative w-full ring-1 ring-inset rounded-lg px-4 py-4 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg~*]:pl-8"
30+
base_classes = "backdrop-blur relative w-full ring-1 ring-inset rounded-lg px-4 py-4 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:start-4 [&>svg]:top-4 [&>svg~*]:ps-8"
3131
{
3232
class: [base_classes, colors]
3333
}

app/components/ruby_ui/alert_dialog/alert_dialog_footer.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def view_template(&)
1010

1111
def default_attrs
1212
{
13-
class: "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2"
13+
class: "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 rtl:space-x-reverse"
1414
}
1515
end
1616
end

app/components/ruby_ui/alert_dialog/alert_dialog_header.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def view_template(&)
1010

1111
def default_attrs
1212
{
13-
class: "flex flex-col space-y-2 text-center sm:text-left"
13+
class: "flex flex-col space-y-2 text-center sm:text-left rtl:sm:text-right"
1414
}
1515
end
1616
end

app/components/ruby_ui/breadcrumb.rb

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# frozen_string_literal: true
2+
3+
module RubyUI
4+
class Breadcrumb < Base
5+
def view_template(&)
6+
nav(**attrs, &)
7+
end
8+
9+
private
10+
11+
def default_attrs
12+
{
13+
aria: {label: "breadcrumb"}
14+
}
15+
end
16+
end
17+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# frozen_string_literal: true
2+
3+
module RubyUI
4+
class BreadcrumbEllipsis < Base
5+
def view_template(&)
6+
span(**attrs) do
7+
icon
8+
span(class: "sr-only") { "More" }
9+
end
10+
end
11+
12+
private
13+
14+
def icon
15+
svg(
16+
xmlns: "http://www.w3.org/2000/svg",
17+
class: "w-4 h-4",
18+
viewbox: "0 0 24 24",
19+
fill: "none",
20+
stroke: "currentColor",
21+
stroke_width: "2",
22+
stroke_linecap: "round",
23+
stroke_linejoin: "round"
24+
) do |s|
25+
s.circle(cx: "12", cy: "12", r: "1")
26+
s.circle(cx: "19", cy: "12", r: "1")
27+
s.circle(cx: "5", cy: "12", r: "1")
28+
end
29+
end
30+
31+
def default_attrs
32+
{
33+
aria: {hidden: true},
34+
class: "flex h-9 w-9 items-center justify-center",
35+
role: "presentation"
36+
}
37+
end
38+
end
39+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# frozen_string_literal: true
2+
3+
module RubyUI
4+
class BreadcrumbItem < Base
5+
def view_template(&)
6+
li(**attrs, &)
7+
end
8+
9+
private
10+
11+
def default_attrs
12+
{
13+
class: "inline-flex items-center gap-1.5"
14+
}
15+
end
16+
end
17+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# frozen_string_literal: true
2+
3+
module RubyUI
4+
class BreadcrumbLink < Base
5+
def initialize(href: "#", **attrs)
6+
@href = href
7+
super(**attrs)
8+
end
9+
10+
def view_template(&)
11+
a(href: @href, **attrs, &)
12+
end
13+
14+
private
15+
16+
def default_attrs
17+
{
18+
class: "transition-colors hover:text-foreground"
19+
}
20+
end
21+
end
22+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# frozen_string_literal: true
2+
3+
module RubyUI
4+
class BreadcrumbList < Base
5+
def view_template(&)
6+
ol(**attrs, &)
7+
end
8+
9+
private
10+
11+
def default_attrs
12+
{
13+
class: "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5"
14+
}
15+
end
16+
end
17+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# frozen_string_literal: true
2+
3+
module RubyUI
4+
class BreadcrumbPage < Base
5+
def view_template(&)
6+
span(**attrs, &)
7+
end
8+
9+
private
10+
11+
def default_attrs
12+
{
13+
aria: {disabled: true, current: "page"},
14+
class: "font-normal text-foreground",
15+
role: "link"
16+
}
17+
end
18+
end
19+
end

0 commit comments

Comments
 (0)