coveragebook_components 0.10.1.beta.2 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/build/coco/app.css +3968 -3053
  3. data/app/assets/build/coco/app.js +5 -4
  4. data/app/assets/build/coco/book.css +1609 -627
  5. data/app/assets/build/coco/book.js +2 -2
  6. data/app/assets/css/app/tippy.css +1 -1
  7. data/app/assets/css/base.css +0 -4
  8. data/app/assets/css/shared/tippy.css +2 -2
  9. data/app/assets/css/shared/utils/text.css +323 -66
  10. data/app/components/coco/app/blocks/sidebar_nav/item/item.css +3 -3
  11. data/app/components/coco/app/blocks/sidebar_nav/menu/menu.css +3 -3
  12. data/app/components/coco/app/elements/alert/alert.css +7 -7
  13. data/app/components/coco/app/elements/color_picker/color_picker.css +2 -2
  14. data/app/components/coco/app/elements/confirm_panel/confirm_panel.css +1 -1
  15. data/app/components/coco/app/elements/image_picker/image_picker.css +4 -4
  16. data/app/components/coco/app/elements/menu/menu.css +2 -2
  17. data/app/components/coco/app/elements/menu_items/user_profile/user_profile.css +1 -1
  18. data/app/components/coco/app/elements/snackbar/snackbar.css +1 -1
  19. data/app/components/coco/app/layouts/page/page.css +1 -5
  20. data/app/components/coco/app/layouts/page/page.html.erb +3 -9
  21. data/app/components/coco/app/layouts/page/page.rb +18 -3
  22. data/app/components/coco/shared/button/button.css +31 -31
  23. data/app/components/coco/shared/button/button.rb +2 -2
  24. data/app/components/coco/shared/link/link.css +67 -0
  25. data/app/components/coco/shared/link/link.rb +20 -1
  26. data/app/components/coco/shared/prose/prose.css +28 -0
  27. data/app/components/coco/shared/prose/prose.rb +14 -0
  28. data/app/components/coco/shared/spacer/spacer.css +201 -0
  29. data/app/components/coco/shared/spacer/spacer.rb +23 -0
  30. data/app/components/coco/shared/stack/stack.css +4 -0
  31. data/app/components/coco/shared/stack/stack.html.erb +4 -0
  32. data/app/components/coco/shared/stack/stack.rb +47 -0
  33. data/app/helpers/coco/app_helper.rb +1 -1
  34. data/app/helpers/coco/shared_helper.rb +13 -0
  35. data/config/tailwind.base.config.cjs +3 -1
  36. data/config/tokens.cjs +1 -0
  37. data/lib/coco.rb +1 -1
  38. metadata +12 -7
  39. data/app/components/coco/app/elements/link/link.css +0 -70
  40. data/app/components/coco/app/elements/link/link.rb +0 -33
@@ -0,0 +1,47 @@
1
+ module Coco
2
+ class Stack < Coco::Component
3
+ include Concerns::AcceptsOptions
4
+
5
+ accepts_option :spacing, from: Coco::Spacer::SIZES, default: Coco::Spacer::DEFAULT, private: true
6
+ accepts_option :direction, from: %i[vertical], default: :vertical
7
+
8
+ renders_many :items, types: {
9
+ element: ->(tag_name = :div, **kwargs) do
10
+ with_space if items.any? && !ends_with_spacer?
11
+ @_last_item_type = :element
12
+ kwargs[:class] = class_names(kwargs[:class], "stack-item")
13
+ Coco::Tag.new(tag_name, **kwargs)
14
+ end,
15
+
16
+ stack: ->(size = spacing, **kwargs) do
17
+ with_space if items.any? && !ends_with_spacer?
18
+ @_last_item_type = :stack
19
+ kwargs[:class] = class_names(kwargs[:class], "stack-substack")
20
+ Coco::Stack.new(spacing: size, **kwargs)
21
+ end,
22
+
23
+ spacer: ->(size = spacing, **kwargs) do
24
+ @_starts_with_spacer = true if items.none?
25
+ @_last_item_type = :spacer
26
+ kwargs[:class] = class_names(kwargs[:class], "stack-spacer")
27
+ Coco::Spacer.new(size:, **kwargs)
28
+ end
29
+ }
30
+
31
+ def initialize(**)
32
+ @_items = []
33
+ @_starts_with_spacer = false
34
+ @_last_item_type = nil
35
+ end
36
+
37
+ def spacing = get_option_value(:spacing)
38
+
39
+ def starts_with_spacer? = @_starts_with_spacer
40
+
41
+ def ends_with_spacer? = @_last_item_type == :spacer
42
+
43
+ alias_method :with_item, :with_item_element
44
+ alias_method :with_substack, :with_item_stack
45
+ alias_method :with_space, :with_item_spacer
46
+ end
47
+ end
@@ -7,7 +7,7 @@ module Coco
7
7
  (args.size == 1) ? [nil, args.first] : args[0..2].reverse!
8
8
  end
9
9
 
10
- link = Coco::App::Elements::Link.new(href: href, **)
10
+ link = Coco::Link.new(href: href, **)
11
11
  link = link.with_content(content) if !block && content.present?
12
12
 
13
13
  render(link, &block)
@@ -4,6 +4,19 @@ module Coco
4
4
  render Coco::Tag.new(*, **), &block
5
5
  end
6
6
 
7
+ def coco_spacer(size = Coco::Spacer::DEFAULT, **)
8
+ render Coco::Spacer.new(size:, **)
9
+ end
10
+ alias_method :space, :coco_spacer
11
+
12
+ def coco_stack(spacing: Coco::Spacer::DEFAULT, **, &block)
13
+ render Coco::Stack.new(spacing:, **), &block
14
+ end
15
+
16
+ def coco_prose(**, &block)
17
+ render Coco::Prose.new(**), &block
18
+ end
19
+
7
20
  def coco_svg(path = nil, **)
8
21
  render Coco::Svg.new(path: path, **)
9
22
  end
@@ -26,7 +26,9 @@ module.exports = {
26
26
  spin: "spin 1.5s linear infinite",
27
27
  "spin-reverse": "spin 1.5s linear infinite reverse",
28
28
  },
29
- width: {
29
+ spacing: {
30
+ 13: "3.25rem",
31
+ 15: "3.75rem",
30
32
  18: "4.5rem",
31
33
  },
32
34
  customForms: () => ({
data/config/tokens.cjs CHANGED
@@ -171,6 +171,7 @@ const screens = {
171
171
  lg: "992px",
172
172
  xl: "1200px",
173
173
  "2xl": "1400px",
174
+ "3xl": "1600px",
174
175
  max: "1800px",
175
176
  "max-sm": { max: "576px" },
176
177
  "max-md": { max: "768px" },
data/lib/coco.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Coco
2
- VERSION = "0.10.1.beta.2"
2
+ VERSION = "0.11.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coveragebook_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1.beta.2
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Perkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-30 00:00:00.000000000 Z
11
+ date: 2023-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -1522,8 +1522,6 @@ files:
1522
1522
  - app/components/coco/app/elements/layout_picker_button/layout_picker_button.html.erb
1523
1523
  - app/components/coco/app/elements/layout_picker_button/layout_picker_button.js
1524
1524
  - app/components/coco/app/elements/layout_picker_button/layout_picker_button.rb
1525
- - app/components/coco/app/elements/link/link.css
1526
- - app/components/coco/app/elements/link/link.rb
1527
1525
  - app/components/coco/app/elements/menu/menu.css
1528
1526
  - app/components/coco/app/elements/menu/menu.html.erb
1529
1527
  - app/components/coco/app/elements/menu/menu.rb
@@ -1685,6 +1683,13 @@ files:
1685
1683
  - app/components/coco/shared/poll_controller/poll_controller.html.erb
1686
1684
  - app/components/coco/shared/poll_controller/poll_controller.js
1687
1685
  - app/components/coco/shared/poll_controller/poll_controller.rb
1686
+ - app/components/coco/shared/prose/prose.css
1687
+ - app/components/coco/shared/prose/prose.rb
1688
+ - app/components/coco/shared/spacer/spacer.css
1689
+ - app/components/coco/shared/spacer/spacer.rb
1690
+ - app/components/coco/shared/stack/stack.css
1691
+ - app/components/coco/shared/stack/stack.html.erb
1692
+ - app/components/coco/shared/stack/stack.rb
1688
1693
  - app/components/coco/shared/svg/svg.html.erb
1689
1694
  - app/components/coco/shared/svg/svg.rb
1690
1695
  - app/components/coco/tag.rb
@@ -1745,11 +1750,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
1745
1750
  version: 3.2.0
1746
1751
  required_rubygems_version: !ruby/object:Gem::Requirement
1747
1752
  requirements:
1748
- - - ">"
1753
+ - - ">="
1749
1754
  - !ruby/object:Gem::Version
1750
- version: 1.3.1
1755
+ version: '0'
1751
1756
  requirements: []
1752
- rubygems_version: 3.4.17
1757
+ rubygems_version: 3.4.19
1753
1758
  signing_key:
1754
1759
  specification_version: 4
1755
1760
  summary: CoverageBook component library
@@ -1,70 +0,0 @@
1
- @layer components {
2
- [data-coco][data-component="app-link"] {
3
- &[data-theme] {
4
- @apply no-underline hover:underline;
5
- }
6
-
7
- &[data-underline="true"] {
8
- @apply underline;
9
- }
10
-
11
- &[data-underline="false"] {
12
- @apply no-underline;
13
- }
14
-
15
- &[data-theme="primary"] {
16
- @apply app-link-primary;
17
- }
18
-
19
- &[data-theme="positive"] {
20
- @apply app-link-positive;
21
- }
22
-
23
- &[data-theme="negative"] {
24
- @apply app-link-negative;
25
- }
26
-
27
- &[data-theme="warning"] {
28
- @apply app-link-warning;
29
- }
30
-
31
- &[data-theme="info"] {
32
- @apply app-link-info;
33
- }
34
-
35
- &[data-theme="neutral-dark"] {
36
- @apply app-link-neutral-dark;
37
- }
38
-
39
- &[data-theme="neutral-light"] {
40
- @apply app-link-neutral-light;
41
- }
42
- }
43
- }
44
-
45
- @layer utilities {
46
- .app-link-primary,
47
- .app-link-positive {
48
- @apply text-content-primary active:text-green-700;
49
- }
50
-
51
- .app-link-negative {
52
- @apply text-content-negative active:text-red-800;
53
- }
54
-
55
- .app-link-warning {
56
- @apply text-content-warning active:text-amber-800;
57
- }
58
-
59
- .app-link-info {
60
- @apply text-content-info active:text-info-800;
61
- }
62
-
63
- .app-link-neutral-dark {
64
- @apply text-content-dark-1;
65
- }
66
-
67
- .app-link-neutral-light {
68
- @apply text-content-light-1;
69
- }
70
- }
@@ -1,33 +0,0 @@
1
- module Coco
2
- module App
3
- module Elements
4
- class Link < Coco::Link
5
- include Concerns::AcceptsOptions
6
- include Concerns::AcceptsTheme
7
-
8
- THEMES = %W[positive primary warning negative info neutral-dark neutral-light] << nil
9
-
10
- accepts_option :theme, from: THEMES
11
- accepts_option :underline, from: [true, false]
12
-
13
- before_initialize do |kwargs|
14
- if kwargs.key?(:modal)
15
- modal_name = (kwargs[:modal] == true) ? "default" : kwargs[:modal]
16
- kwargs[:data] = kwargs.fetch(:data, {}).merge(coco_modal_data_attributes(modal_name))
17
- kwargs.delete(:modal)
18
- end
19
- if kwargs.key?(:frame)
20
- turbo_data = {turbo: true, turbo_frame: kwargs[:frame]}
21
- kwargs[:data] = kwargs.fetch(:data, {}).merge(turbo_data)
22
- kwargs.delete(:frame)
23
- end
24
- kwargs
25
- end
26
-
27
- class << self
28
- include Coco::SharedHelper
29
- end
30
- end
31
- end
32
- end
33
- end