backpack 0.4.0 → 0.4.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 +4 -4
- data/demo/.yarnrc.yml +4 -0
- data/demo/Gemfile.lock +1 -2
- data/demo/app/views/layouts/backpack.html.erb +2 -4
- data/demo/config/initializers/phlex.rb +9 -0
- data/demo/yarn.lock +1101 -1101
- data/lib/backpack/{components/concerns/classes.rb → classes.rb} +1 -1
- data/lib/backpack/components/badge.rb +1 -1
- data/lib/backpack/components/base.rb +1 -1
- data/lib/backpack/components/breadcrumb.rb +2 -2
- data/lib/backpack/components/button.rb +1 -1
- data/lib/backpack/components/favicon.rb +1 -1
- data/lib/backpack/components/heading.rb +1 -1
- data/lib/backpack/components/icon.rb +1 -1
- data/lib/backpack/components/icon_button/icon_button.css +183 -0
- data/lib/backpack/components/icon_button/icon_button.js +1 -0
- data/lib/backpack/components/icon_button.rb +32 -0
- data/lib/backpack/components/icon_sprite.rb +1 -1
- data/lib/backpack/components/quotation.rb +1 -1
- data/lib/backpack/components/rich_text.rb +1 -1
- data/lib/backpack/components/skip_links.rb +1 -1
- data/lib/backpack/components.rb +2 -4
- data/lib/backpack/{components/concerns/identifier.rb → identifier.rb} +5 -1
- data/lib/backpack/version.rb +1 -1
- data/lib/backpack.rb +5 -4
- data/spec/components/badge_spec.rb +1 -1
- data/spec/components/breadcrumb_spec.rb +1 -1
- data/spec/components/button_spec.rb +3 -3
- data/spec/components/favicon_spec.rb +1 -1
- data/spec/components/heading_spec.rb +1 -1
- data/spec/components/icon_button_spec.rb +58 -0
- data/spec/components/icon_spec.rb +1 -1
- data/spec/components/icon_sprite_spec.rb +1 -1
- data/spec/components/previews/badge_preview/overview.html.erb +8 -5
- data/spec/components/previews/badge_preview.rb +3 -1
- data/spec/components/previews/breadcrumb_preview.rb +3 -1
- data/spec/components/previews/button_preview/overview.html.erb +12 -7
- data/spec/components/previews/button_preview.rb +2 -1
- data/spec/components/previews/heading_preview.rb +3 -1
- data/spec/components/previews/icon_button_preview/overview.html.erb +48 -0
- data/spec/components/previews/icon_button_preview.rb +14 -0
- data/spec/components/previews/icon_preview.rb +3 -1
- data/spec/components/previews/quotation_preview/overview.html.erb +5 -4
- data/spec/components/previews/quotation_preview.rb +3 -1
- data/spec/components/previews/rich_text_preview.rb +3 -1
- data/spec/components/previews/skip_links_preview.rb +3 -1
- data/spec/components/quotation_spec.rb +1 -1
- data/spec/components/rich_text_spec.rb +1 -1
- data/spec/components/skip_links_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/components.rb +8 -0
- data/{lib/backpack → spec/support}/spec_helpers.rb +1 -1
- metadata +13 -20
- data/spec/components/previews/backpack/preview.rb +0 -3
- /data/lib/backpack/{components/concerns/attributes.rb → attributes.rb} +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<% props = Components::IconButton.literal_properties
|
|
2
|
+
icon = "user"
|
|
3
|
+
label = "User" %>
|
|
4
|
+
|
|
5
|
+
<table class="lookbook-table">
|
|
6
|
+
<thead>
|
|
7
|
+
<tr>
|
|
8
|
+
<th>Color</th>
|
|
9
|
+
<% props[:color].type.each do |color| %>
|
|
10
|
+
<th colspan="<%= props[:size].type.to_a.size %>">
|
|
11
|
+
<code><%= color || :default %></code>
|
|
12
|
+
</th>
|
|
13
|
+
<% end %>
|
|
14
|
+
</tr>
|
|
15
|
+
<tr>
|
|
16
|
+
<th>Size</th>
|
|
17
|
+
<% props[:color].type.each do %>
|
|
18
|
+
<% props[:size].type.each do |size| %>
|
|
19
|
+
<th><code><%= size %></code></th>
|
|
20
|
+
<% end %>
|
|
21
|
+
<% end %>
|
|
22
|
+
</tr>
|
|
23
|
+
</thead>
|
|
24
|
+
<tbody>
|
|
25
|
+
<% props[:variant].type.each do |variant| %>
|
|
26
|
+
<tr>
|
|
27
|
+
<th><code><%= variant %></code></th>
|
|
28
|
+
<% props[:color].type.each do |color| %>
|
|
29
|
+
<% props[:size].type.each do |size| %>
|
|
30
|
+
<td>
|
|
31
|
+
<%= render Components::IconButton.new(variant:, size:, color:, icon:, label:) %>
|
|
32
|
+
</td>
|
|
33
|
+
<% end %>
|
|
34
|
+
<% end %>
|
|
35
|
+
</tr>
|
|
36
|
+
<tr>
|
|
37
|
+
<th><code><%= variant %></code>, <code>disabled</code></th>
|
|
38
|
+
<% props[:color].type.each do |color| %>
|
|
39
|
+
<% props[:size].type.each do |size| %>
|
|
40
|
+
<td>
|
|
41
|
+
<%= render Components::IconButton.new(variant:, size:, color:, icon:, disabled: true, label:) %>
|
|
42
|
+
</td>
|
|
43
|
+
<% end %>
|
|
44
|
+
<% end %>
|
|
45
|
+
</tr>
|
|
46
|
+
<% end %>
|
|
47
|
+
</tbody>
|
|
48
|
+
</table>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class IconButtonPreview < Lookbook::Preview
|
|
2
|
+
include Components
|
|
3
|
+
|
|
4
|
+
def overview; end
|
|
5
|
+
|
|
6
|
+
# @param size [Integer] range { min: 1, max: 3, step: 1 }
|
|
7
|
+
# @param variant [Symbol] select { choices: [solid, soft, surface, outline, ghost] }
|
|
8
|
+
# @param color [Symbol] select { choices: [~, green, orange, red] }
|
|
9
|
+
# @param icon [Symbol] select { choices: [arrow-right, user, close] }
|
|
10
|
+
# @param label
|
|
11
|
+
def playground(size: 2, variant: :solid, color: nil, label: "User", icon: :user)
|
|
12
|
+
IconButton(size:, variant:, color:, icon:, label:)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
<%
|
|
2
|
-
|
|
3
|
-
%>
|
|
1
|
+
<% props = Components::Quotation.literal_properties %>
|
|
2
|
+
|
|
4
3
|
<table class="lookbook-table">
|
|
5
4
|
<thead>
|
|
6
5
|
<tr>
|
|
@@ -15,7 +14,9 @@ props = Backpack::Components::Quotation.literal_properties
|
|
|
15
14
|
<tr>
|
|
16
15
|
<th><code><%= size %></code></th>
|
|
17
16
|
<% props[:weight].type.each do |weight| %>
|
|
18
|
-
<td
|
|
17
|
+
<td>
|
|
18
|
+
<%= render Components::Quotation.new(size:, weight:, cite: "Jan Tschichold") { "Perfect typography is certainly the most elusive of all arts. Sculpture in stone alone comes near it in obstinacy." } %>
|
|
19
|
+
</td>
|
|
19
20
|
<% end %>
|
|
20
21
|
</tr>
|
|
21
22
|
<% end %>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe
|
|
3
|
+
describe Components::RichText, type: :component do
|
|
4
4
|
let(:component) { described_class.new(**params) { html } }
|
|
5
5
|
let(:params) { {} }
|
|
6
6
|
let(:html) { "<h1>Hello</h2> <p>World</p>".html_safe }
|
data/spec/spec_helper.rb
CHANGED
|
@@ -13,7 +13,7 @@ RSpec.configure do |config|
|
|
|
13
13
|
c.syntax = :expect
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
config.include
|
|
16
|
+
config.include ComponentSpecHelpers, type: :component
|
|
17
17
|
config.include Capybara::RSpecMatchers, type: :component
|
|
18
18
|
config.include RSpecHtmlMatchers, type: :component
|
|
19
19
|
config.include ComponentMatchers, type: :component
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: backpack
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lucas Heymès
|
|
@@ -67,20 +67,6 @@ dependencies:
|
|
|
67
67
|
- - ">="
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
69
|
version: '0'
|
|
70
|
-
- !ruby/object:Gem::Dependency
|
|
71
|
-
name: zeitwerk
|
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
|
73
|
-
requirements:
|
|
74
|
-
- - "~>"
|
|
75
|
-
- !ruby/object:Gem::Version
|
|
76
|
-
version: '2.7'
|
|
77
|
-
type: :runtime
|
|
78
|
-
prerelease: false
|
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
80
|
-
requirements:
|
|
81
|
-
- - "~>"
|
|
82
|
-
- !ruby/object:Gem::Version
|
|
83
|
-
version: '2.7'
|
|
84
70
|
email:
|
|
85
71
|
- team@etamin.studio
|
|
86
72
|
executables: []
|
|
@@ -561,6 +547,7 @@ files:
|
|
|
561
547
|
- demo/config/initializers/content_security_policy.rb
|
|
562
548
|
- demo/config/initializers/filter_parameter_logging.rb
|
|
563
549
|
- demo/config/initializers/inflections.rb
|
|
550
|
+
- demo/config/initializers/phlex.rb
|
|
564
551
|
- demo/config/locales/en.yml
|
|
565
552
|
- demo/config/puma.rb
|
|
566
553
|
- demo/config/routes.rb
|
|
@@ -584,6 +571,8 @@ files:
|
|
|
584
571
|
- docs/tokens-and-utilities.md.erb
|
|
585
572
|
- figma/Backpack.json
|
|
586
573
|
- lib/backpack.rb
|
|
574
|
+
- lib/backpack/attributes.rb
|
|
575
|
+
- lib/backpack/classes.rb
|
|
587
576
|
- lib/backpack/components.rb
|
|
588
577
|
- lib/backpack/components/badge.rb
|
|
589
578
|
- lib/backpack/components/badge/badge.css
|
|
@@ -595,9 +584,6 @@ files:
|
|
|
595
584
|
- lib/backpack/components/button.rb
|
|
596
585
|
- lib/backpack/components/button/button.css
|
|
597
586
|
- lib/backpack/components/button/button.js
|
|
598
|
-
- lib/backpack/components/concerns/attributes.rb
|
|
599
|
-
- lib/backpack/components/concerns/classes.rb
|
|
600
|
-
- lib/backpack/components/concerns/identifier.rb
|
|
601
587
|
- lib/backpack/components/favicon.rb
|
|
602
588
|
- lib/backpack/components/heading.rb
|
|
603
589
|
- lib/backpack/components/heading/heading.css
|
|
@@ -605,6 +591,9 @@ files:
|
|
|
605
591
|
- lib/backpack/components/icon.rb
|
|
606
592
|
- lib/backpack/components/icon/icon.css
|
|
607
593
|
- lib/backpack/components/icon/icon.js
|
|
594
|
+
- lib/backpack/components/icon_button.rb
|
|
595
|
+
- lib/backpack/components/icon_button/icon_button.css
|
|
596
|
+
- lib/backpack/components/icon_button/icon_button.js
|
|
608
597
|
- lib/backpack/components/icon_sprite.rb
|
|
609
598
|
- lib/backpack/components/quotation.rb
|
|
610
599
|
- lib/backpack/components/quotation/quotation.css
|
|
@@ -615,7 +604,7 @@ files:
|
|
|
615
604
|
- lib/backpack/components/skip_links.rb
|
|
616
605
|
- lib/backpack/components/skip_links/skip_links.css
|
|
617
606
|
- lib/backpack/components/skip_links/skip_links.js
|
|
618
|
-
- lib/backpack/
|
|
607
|
+
- lib/backpack/identifier.rb
|
|
619
608
|
- lib/backpack/stylesheets/application.css
|
|
620
609
|
- lib/backpack/stylesheets/base/_base.css
|
|
621
610
|
- lib/backpack/stylesheets/tokens/_colors.css
|
|
@@ -633,15 +622,17 @@ files:
|
|
|
633
622
|
- spec/components/button_spec.rb
|
|
634
623
|
- spec/components/favicon_spec.rb
|
|
635
624
|
- spec/components/heading_spec.rb
|
|
625
|
+
- spec/components/icon_button_spec.rb
|
|
636
626
|
- spec/components/icon_spec.rb
|
|
637
627
|
- spec/components/icon_sprite_spec.rb
|
|
638
|
-
- spec/components/previews/backpack/preview.rb
|
|
639
628
|
- spec/components/previews/badge_preview.rb
|
|
640
629
|
- spec/components/previews/badge_preview/overview.html.erb
|
|
641
630
|
- spec/components/previews/breadcrumb_preview.rb
|
|
642
631
|
- spec/components/previews/button_preview.rb
|
|
643
632
|
- spec/components/previews/button_preview/overview.html.erb
|
|
644
633
|
- spec/components/previews/heading_preview.rb
|
|
634
|
+
- spec/components/previews/icon_button_preview.rb
|
|
635
|
+
- spec/components/previews/icon_button_preview/overview.html.erb
|
|
645
636
|
- spec/components/previews/icon_preview.rb
|
|
646
637
|
- spec/components/previews/quotation_preview.rb
|
|
647
638
|
- spec/components/previews/quotation_preview/overview.html.erb
|
|
@@ -654,8 +645,10 @@ files:
|
|
|
654
645
|
- spec/fixtures/icons/close.svg
|
|
655
646
|
- spec/fixtures/icons/user.svg
|
|
656
647
|
- spec/spec_helper.rb
|
|
648
|
+
- spec/support/components.rb
|
|
657
649
|
- spec/support/matchers/eq_html.rb
|
|
658
650
|
- spec/support/matchers/include_html.rb
|
|
651
|
+
- spec/support/spec_helpers.rb
|
|
659
652
|
- vendor/normalize.css
|
|
660
653
|
homepage: https://etamin.studio
|
|
661
654
|
licenses: []
|
|
File without changes
|