coveragebook_components 0.9.1 → 0.10.1.beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/build/coco/app.css +4433 -3098
  3. data/app/assets/build/coco/app.js +125 -109
  4. data/app/assets/build/coco/book.css +1492 -99
  5. data/app/assets/build/coco/book.js +279 -18
  6. data/app/assets/css/app/tippy.css +1 -1
  7. data/app/assets/css/app.css +3 -3
  8. data/app/assets/css/{base/base.css → base.css} +14 -6
  9. data/app/assets/css/book.css +2 -2
  10. data/app/assets/css/{libs → shared}/tippy.css +20 -1
  11. data/app/assets/css/shared/utils/text.css +143 -0
  12. data/app/assets/js/app.js +2 -2
  13. data/app/assets/js/book.js +2 -2
  14. data/app/assets/js/libs/alpine/directives/dropdown.js +1 -1
  15. data/app/assets/js/libs/alpine/directives/tooltip.js +1 -1
  16. data/app/assets/js/shared/components.js +4 -0
  17. data/app/components/coco/app/blocks/header/header.js +1 -1
  18. data/app/components/coco/app/blocks/header/header.rb +2 -2
  19. data/app/components/coco/app/blocks/nav_drawer/nav_drawer.css +4 -0
  20. data/app/components/coco/app/blocks/nav_drawer/nav_drawer.js +1 -1
  21. data/app/components/coco/app/blocks/sidebar_nav/item/item.css +3 -3
  22. data/app/components/coco/app/blocks/sidebar_nav/item/item.js +2 -2
  23. data/app/components/coco/app/blocks/sidebar_nav/menu/menu.css +3 -3
  24. data/app/components/coco/app/blocks/sidebar_nav/menu/menu.js +1 -1
  25. data/app/components/coco/app/blocks/sidebar_nav/navbar/navbar.js +1 -1
  26. data/app/components/coco/app/blocks/slide_editor/slide_editor.js +1 -1
  27. data/app/components/coco/app/elements/alert/alert.css +18 -50
  28. data/app/components/coco/app/elements/alert/alert.html.erb +2 -2
  29. data/app/components/coco/app/elements/alert/alert.js +1 -1
  30. data/app/components/coco/app/elements/alert/alert.rb +11 -16
  31. data/app/components/coco/app/elements/color_picker/color_picker.css +2 -2
  32. data/app/components/coco/app/elements/color_picker/color_picker.js +1 -1
  33. data/app/components/coco/app/elements/color_picker_button/color_picker_button.js +1 -1
  34. data/app/components/coco/app/elements/color_picker_button/color_picker_button.rb +3 -3
  35. data/app/components/coco/app/elements/confirm_panel/confirm_panel.css +1 -1
  36. data/app/components/coco/app/elements/confirm_panel/confirm_panel.js +1 -1
  37. data/app/components/coco/app/elements/image_picker/image_picker.css +4 -4
  38. data/app/components/coco/app/elements/image_picker/image_picker.js +1 -1
  39. data/app/components/coco/app/elements/image_picker_button/image_picker_button.js +1 -1
  40. data/app/components/coco/app/elements/image_picker_button/image_picker_button.rb +3 -3
  41. data/app/components/coco/app/elements/layout_picker_button/layout_picker_button.js +1 -1
  42. data/app/components/coco/app/elements/layout_picker_button/layout_picker_button.rb +3 -3
  43. data/app/components/coco/app/elements/link/link.rb +1 -1
  44. data/app/components/coco/app/elements/menu/menu.css +5 -5
  45. data/app/components/coco/app/elements/menu_button/menu_button.js +1 -1
  46. data/app/components/coco/app/elements/menu_button/menu_button.rb +3 -3
  47. data/app/components/coco/app/elements/menu_items/user_profile/user_profile.css +1 -1
  48. data/app/components/coco/app/elements/notice/notice.js +1 -1
  49. data/app/components/coco/app/elements/seamless_textarea/seamless_textarea.js +1 -1
  50. data/app/components/coco/app/elements/snackbar/snackbar.css +1 -1
  51. data/app/components/coco/app/elements/snackbar/snackbar.js +1 -1
  52. data/app/components/coco/app/elements/stamp/stamp.css +103 -0
  53. data/app/components/coco/app/elements/stamp/stamp.html.erb +3 -0
  54. data/app/components/coco/app/elements/stamp/stamp.rb +29 -0
  55. data/app/components/coco/app/elements/system_banner/system_banner.js +1 -1
  56. data/app/components/coco/app/elements/toast/toast.js +1 -1
  57. data/app/components/coco/app/elements/toolbar/toolbar.js +1 -1
  58. data/app/components/coco/app/elements/toolbar/toolbar.rb +1 -1
  59. data/app/components/coco/app/fields/button_component.rb +1 -1
  60. data/app/components/coco/app/fields/submit_component.rb +1 -0
  61. data/app/components/coco/app/layouts/application/application.css +1 -1
  62. data/app/components/coco/app/layouts/application/application.js +1 -1
  63. data/app/components/coco/app/layouts/page/page.css +4 -0
  64. data/app/components/coco/app/layouts/page/page.html.erb +5 -0
  65. data/app/components/coco/app/layouts/page/page.js +1 -1
  66. data/app/components/coco/app/layouts/page/page.rb +4 -0
  67. data/app/components/coco/{app/elements → shared}/button/button.css +104 -32
  68. data/app/components/coco/shared/button/button.html.erb +83 -0
  69. data/app/components/coco/{base → shared}/button/button.js +2 -1
  70. data/app/components/coco/{base → shared}/button/button.rb +107 -42
  71. data/app/components/coco/{base → shared}/button/button_dropdown.js +11 -2
  72. data/app/components/coco/{app/elements → shared}/button_group/button_group.css +1 -1
  73. data/app/components/coco/{app/elements → shared}/button_group/button_group.js +12 -4
  74. data/app/components/coco/shared/button_group/button_group.rb +40 -0
  75. data/app/components/coco/{app/elements → shared}/button_to/button_to.css +1 -1
  76. data/app/components/coco/shared/button_to/button_to.rb +50 -0
  77. data/app/components/coco/{base → shared}/dropdown/dropdown.js +1 -1
  78. data/app/components/coco/{base → shared}/icon/icon.js +1 -1
  79. data/app/components/coco/{base → shared}/image_uploader/image_uploader.js +1 -1
  80. data/app/components/coco/{base → shared}/modal/modal.html.erb +2 -2
  81. data/app/components/coco/{base → shared}/modal/modal.js +3 -3
  82. data/app/components/coco/{base → shared}/modal/modal.rb +6 -4
  83. data/app/components/coco/{base → shared}/modal_dialog/modal_dialog.js +1 -1
  84. data/app/components/coco/{base → shared}/modal_lightbox/modal_lightbox.js +1 -1
  85. data/app/components/coco/{base → shared}/placeholder/placeholder.html.erb +1 -1
  86. data/app/components/coco/{base → shared}/placeholder/placeholder.rb +6 -0
  87. data/app/components/coco/{base → shared}/poll_controller/poll_controller.js +1 -1
  88. data/app/helpers/coco/app_helper.rb +17 -23
  89. data/app/helpers/coco/component_helper.rb +1 -1
  90. data/app/helpers/coco/{base_helper.rb → shared_helper.rb} +26 -3
  91. data/app/helpers/coco/url_helper.rb +1 -1
  92. data/config/tailwind.app.config.cjs +1 -1
  93. data/config/tailwind.book.config.cjs +1 -0
  94. data/config/tokens.cjs +9 -4
  95. data/lib/coco/engine.rb +6 -4
  96. data/lib/coco.rb +1 -1
  97. data/lib/generators/coco/coco_generator.rb +1 -1
  98. metadata +77 -80
  99. data/app/assets/css/base/components/coco.css +0 -14
  100. data/app/assets/css/base/components/dropdown.css +0 -7
  101. data/app/assets/css/base/components/tooltip.css +0 -19
  102. data/app/assets/js/base/components.js +0 -4
  103. data/app/components/coco/app/blocks/slat/slat.css +0 -9
  104. data/app/components/coco/app/blocks/slat/slat.rb +0 -13
  105. data/app/components/coco/app/elements/button/button.rb +0 -87
  106. data/app/components/coco/app/elements/button_group/button_group.rb +0 -42
  107. data/app/components/coco/app/elements/button_to/button_to.rb +0 -54
  108. data/app/components/coco/base/button/button.css +0 -75
  109. data/app/components/coco/base/button/button.html.erb +0 -71
  110. /data/app/assets/css/app/{utilities.css → utils.css} +0 -0
  111. /data/app/assets/css/{base → shared}/utils/colors.css +0 -0
  112. /data/app/assets/css/{base → shared}/utils/icons.css +0 -0
  113. /data/app/assets/js/{coco.js → shared/coco.js} +0 -0
  114. /data/app/components/coco/{base → shared}/avatar/avatar.css +0 -0
  115. /data/app/components/coco/{base → shared}/avatar/avatar.rb +0 -0
  116. /data/app/components/coco/{app/elements → shared}/button_group/button_group.html.erb +0 -0
  117. /data/app/components/coco/{app/elements → shared}/button_to/button_to.html.erb +0 -0
  118. /data/app/components/coco/{base → shared}/content/content.rb +0 -0
  119. /data/app/components/coco/{base → shared}/dropdown/dropdown.css +0 -0
  120. /data/app/components/coco/{base → shared}/dropdown/dropdown.html.erb +0 -0
  121. /data/app/components/coco/{base → shared}/dropdown/dropdown.rb +0 -0
  122. /data/app/components/coco/{base → shared}/embeds/youtube/youtube.css +0 -0
  123. /data/app/components/coco/{base → shared}/embeds/youtube/youtube.html.erb +0 -0
  124. /data/app/components/coco/{base → shared}/embeds/youtube/youtube.rb +0 -0
  125. /data/app/components/coco/{base → shared}/icon/icon.css +0 -0
  126. /data/app/components/coco/{base → shared}/icon/icon.html.erb +0 -0
  127. /data/app/components/coco/{base → shared}/icon/icon.rb +0 -0
  128. /data/app/components/coco/{base → shared}/image/image.css +0 -0
  129. /data/app/components/coco/{base → shared}/image/image.rb +0 -0
  130. /data/app/components/coco/{base → shared}/image_uploader/image_uploader.css +0 -0
  131. /data/app/components/coco/{base → shared}/image_uploader/image_uploader.html.erb +0 -0
  132. /data/app/components/coco/{base → shared}/image_uploader/image_uploader.rb +0 -0
  133. /data/app/components/coco/{base → shared}/link/link.css +0 -0
  134. /data/app/components/coco/{base → shared}/link/link.rb +0 -0
  135. /data/app/components/coco/{base → shared}/modal/modal.css +0 -0
  136. /data/app/components/coco/{base → shared}/modal_dialog/modal_dialog.css +0 -0
  137. /data/app/components/coco/{base → shared}/modal_dialog/modal_dialog.html.erb +0 -0
  138. /data/app/components/coco/{base → shared}/modal_dialog/modal_dialog.rb +0 -0
  139. /data/app/components/coco/{base → shared}/modal_lightbox/modal_lightbox.css +0 -0
  140. /data/app/components/coco/{base → shared}/modal_lightbox/modal_lightbox.html.erb +0 -0
  141. /data/app/components/coco/{base → shared}/modal_lightbox/modal_lightbox.rb +0 -0
  142. /data/app/components/coco/{base → shared}/pager_link/pager_link.css +0 -0
  143. /data/app/components/coco/{base → shared}/pager_link/pager_link.html.erb +0 -0
  144. /data/app/components/coco/{base → shared}/pager_link/pager_link.rb +0 -0
  145. /data/app/components/coco/{base → shared}/panel/panel.css +0 -0
  146. /data/app/components/coco/{base → shared}/panel/panel.html.erb +0 -0
  147. /data/app/components/coco/{base → shared}/panel/panel.rb +0 -0
  148. /data/app/components/coco/{base → shared}/placeholder/placeholder.css +0 -0
  149. /data/app/components/coco/{base → shared}/poll_controller/poll_controller.css +0 -0
  150. /data/app/components/coco/{base → shared}/poll_controller/poll_controller.html.erb +0 -0
  151. /data/app/components/coco/{base → shared}/poll_controller/poll_controller.rb +0 -0
  152. /data/app/components/coco/{base → shared}/svg/svg.html.erb +0 -0
  153. /data/app/components/coco/{base → shared}/svg/svg.rb +0 -0
@@ -1,4 +1,4 @@
1
- import { CocoComponent } from "@js/coco";
1
+ import { CocoComponent } from "@assets/js/shared/coco";
2
2
 
3
3
  export default CocoComponent("appSnackbar", () => {
4
4
  return {
@@ -0,0 +1,103 @@
1
+ @layer components {
2
+ [data-coco][data-component="app-stamp"] {
3
+ &:not([data-style="compact"]) {
4
+ @apply rounded-full relative;
5
+
6
+ .coco-icon {
7
+ @apply absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2;
8
+ }
9
+
10
+ /* Sizes */
11
+
12
+ &[data-size="xs"] {
13
+ @apply w-6 h-6;
14
+ }
15
+
16
+ &[data-size="sm"] {
17
+ @apply w-7 h-7;
18
+ }
19
+
20
+ &[data-size="md"] {
21
+ @apply w-9 h-9;
22
+ }
23
+
24
+ &[data-size="lg"] {
25
+ @apply w-11 h-11;
26
+ }
27
+ }
28
+
29
+ /* Themes */
30
+
31
+ &[data-theme="positive"] {
32
+ &[data-style="subtle"] {
33
+ @apply bg-green-200 text-content-positive;
34
+ }
35
+
36
+ &[data-style="vivid"] {
37
+ @apply bg-background-positive text-content-light-1;
38
+ }
39
+
40
+ &[data-style="inverse"] {
41
+ @apply bg-green-700 text-content-light-1;
42
+ }
43
+
44
+ &[data-style="compact"] {
45
+ @apply text-content-positive;
46
+ }
47
+ }
48
+
49
+ &[data-theme="negative"] {
50
+ &[data-style="subtle"] {
51
+ @apply bg-red-200 text-content-negative;
52
+ }
53
+
54
+ &[data-style="vivid"] {
55
+ @apply bg-background-negative text-content-light-1;
56
+ }
57
+
58
+ &[data-style="inverse"] {
59
+ @apply bg-red-700 text-content-light-1;
60
+ }
61
+
62
+ &[data-style="compact"] {
63
+ @apply text-content-negative;
64
+ }
65
+ }
66
+
67
+ &[data-theme="warning"] {
68
+ &[data-style="subtle"] {
69
+ @apply bg-amber-100 text-content-warning;
70
+ }
71
+
72
+ &[data-style="vivid"] {
73
+ @apply bg-background-warning text-content-light-1;
74
+ }
75
+
76
+ &[data-style="inverse"] {
77
+ @apply bg-amber-600 text-content-light-1;
78
+ }
79
+
80
+ &[data-style="compact"] {
81
+ @apply text-content-warning;
82
+ }
83
+ }
84
+
85
+ &[data-theme="info"] {
86
+ &[data-style="subtle"] {
87
+ @apply bg-blue-200 text-content-info;
88
+ }
89
+
90
+ &[data-style="vivid"] {
91
+ @apply bg-background-info text-content-light-1;
92
+ }
93
+
94
+ &[data-style="inverse"] {
95
+ @apply bg-blue-700 text-content-light-1;
96
+ }
97
+
98
+ &[data-style="compact"] {
99
+ @apply text-content-info;
100
+ }
101
+ }
102
+ }
103
+ }
@@ -0,0 +1,3 @@
1
+ <%= render component_tag do %>
2
+ <%= coco_icon(icon_name, size: get_option_value(:size)) %>
3
+ <% end %>
@@ -0,0 +1,29 @@
1
+ module Coco
2
+ module App
3
+ module Elements
4
+ class Stamp < Coco::Component
5
+ include Concerns::AcceptsOptions
6
+ include Concerns::AcceptsTheme
7
+
8
+ THEMES = [
9
+ "positive",
10
+ "negative",
11
+ "warning",
12
+ "info"
13
+ ]
14
+
15
+ DEFAULT_THEME = "info"
16
+
17
+ accepts_option :size, from: %i[xs sm md lg], default: :md
18
+ accepts_option :style, from: %i[subtle vivid inverse compact], default: :subtle
19
+ accepts_option :theme, from: THEMES, default: DEFAULT_THEME
20
+
21
+ attr_reader :icon_name
22
+
23
+ def initialize(icon:, **kwargs)
24
+ @icon_name = icon
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,4 +1,4 @@
1
- import { CocoComponent } from "@js/coco";
1
+ import { CocoComponent } from "@assets/js/shared/coco";
2
2
  import Cookies from "js-cookie";
3
3
 
4
4
  export default CocoComponent("appSystemBanner", (opts = {}) => {
@@ -1,4 +1,4 @@
1
- import { CocoComponent } from "@js/coco";
1
+ import { CocoComponent } from "@assets/js/shared/coco";
2
2
 
3
3
  export default CocoComponent("appToast", () => {
4
4
  return {
@@ -1,4 +1,4 @@
1
- import { CocoComponent } from "@js/coco";
1
+ import { CocoComponent } from "@assets/js/shared/coco";
2
2
  import { getComponent } from "@helpers/alpine";
3
3
 
4
4
  export default CocoComponent("appToolbar", () => {
@@ -16,7 +16,7 @@ module Coco
16
16
  raise "Toolbar already has a `#{alignment}` section defined"
17
17
  end
18
18
 
19
- component = Coco::App::Elements::ButtonGroup.new(**kwargs, theme: :toolbar, collapsible: true)
19
+ component = Coco::ButtonGroup.new(**kwargs, theme: :toolbar, collapsible: true)
20
20
  @sections[alignment] = view_context.render(component, &block)
21
21
  end
22
22
 
@@ -3,7 +3,7 @@ module Coco
3
3
  module Fields
4
4
  class ButtonComponent < ViewComponent::Form::ButtonComponent
5
5
  include Concerns::ActsAsFieldWithOptions
6
- include Coco::AppHelper
6
+ include Coco::SharedHelper
7
7
 
8
8
  def call
9
9
  coco_button(**options) do
@@ -3,6 +3,7 @@ module Coco
3
3
  module Fields
4
4
  class SubmitComponent < ViewComponent::Form::SubmitComponent
5
5
  include Concerns::ActsAsFieldWithOptions
6
+ include Coco::SharedHelper
6
7
 
7
8
  def call
8
9
  coco_button(**options, type: :submit) do
@@ -52,7 +52,7 @@
52
52
  }
53
53
 
54
54
  .layout-body {
55
- @apply relative z-0 h-full overflow-y-auto scroll-smooth;
55
+ @apply relative z-0 h-full overflow-y-auto scroll-smooth bg-background-light-2;
56
56
  grid-area: body;
57
57
  }
58
58
 
@@ -1,4 +1,4 @@
1
- import { CocoComponent } from "@js/coco";
1
+ import { CocoComponent } from "@assets/js/shared/coco";
2
2
 
3
3
  export default CocoComponent("appLayout", (opts) => {
4
4
  return {
@@ -4,6 +4,10 @@
4
4
  @apply pt-12 pb-12 px-app w-full;
5
5
  }
6
6
 
7
+ .page-sections {
8
+ @apply space-y-12;
9
+ }
10
+
7
11
  .page-controls {
8
12
  @apply fixed top-1/2 -translate-y-1/2 right-0 flex justify-between;
9
13
 
@@ -6,6 +6,11 @@
6
6
  <% end %>
7
7
  <div class="page-body" data-role="page-body">
8
8
  <div class="page-body-content">
9
+ <% if sections? %>
10
+ <div class="page-sections">
11
+ <%= safe_join(sections) %>
12
+ </div>
13
+ <% end %>
9
14
  <%= content %>
10
15
  </div>
11
16
  </div>
@@ -1,4 +1,4 @@
1
- import { CocoComponent } from "@js/coco";
1
+ import { CocoComponent } from "@assets/js/shared/coco";
2
2
 
3
3
  export default CocoComponent("pageLayout", () => {
4
4
  return {};
@@ -11,6 +11,10 @@ module Coco
11
11
  renders_one :header
12
12
  renders_many :hidden_sections
13
13
 
14
+ renders_many :sections, ->(**kwargs, &block) do
15
+ coco_tag(:section, **kwargs, &block)
16
+ end
17
+
14
18
  renders_one :previous_link, ->(**kwargs) do
15
19
  Coco::PagerLink.new(**kwargs, direction: :previous, class: "page-control-previous")
16
20
  end
@@ -1,5 +1,77 @@
1
1
  @layer components {
2
- [data-coco][data-component="app-button"] {
2
+ .coco-button-wrapper {
3
+ @apply !contents;
4
+ }
5
+
6
+ [data-coco].coco-button {
7
+ @apply flex transition-colors w-auto bg-transparent text-current border border-transparent select-none flex-none no-underline outline-none focus-visible:outline-0;
8
+ width: min-content;
9
+
10
+ .button-inner {
11
+ @apply inline-flex items-center text-center mx-auto gap-2;
12
+ width: fit-content;
13
+ }
14
+
15
+ .button-content {
16
+ @apply whitespace-nowrap relative leading-none inline-flex items-center order-2;
17
+ }
18
+
19
+ .button-state-content {
20
+ @apply contents;
21
+ }
22
+
23
+ .button-icon {
24
+ @apply inline-flex items-center order-1;
25
+ }
26
+
27
+ .button-dropdown {
28
+ @apply contents rounded-md;
29
+ }
30
+
31
+ .button-toggle {
32
+ @apply order-3;
33
+ }
34
+
35
+ /* disabled */
36
+
37
+ &[data-disabled="true"] {
38
+ @apply cursor-not-allowed pointer-events-none;
39
+ }
40
+
41
+ /* loading */
42
+
43
+ &[data-state="loading"] .button-icon {
44
+ @apply animate-spin;
45
+ }
46
+
47
+ /* Fit */
48
+
49
+ &[data-fit="full"] {
50
+ @apply w-full;
51
+ }
52
+
53
+ /* Icons */
54
+
55
+ &[data-icon-position="end"] {
56
+ .button-content {
57
+ @apply order-1;
58
+ }
59
+
60
+ .button-icon {
61
+ @apply order-2;
62
+ }
63
+
64
+ .button-toggle {
65
+ @apply order-3;
66
+ }
67
+ }
68
+
69
+ &.with-icon[data-collapsed="true"] {
70
+ .button-content {
71
+ display: none;
72
+ }
73
+ }
74
+
3
75
  /* Themes */
4
76
 
5
77
  &[data-theme] {
@@ -287,119 +359,119 @@
287
359
  /* Responsive resizing */
288
360
 
289
361
  &[data-size="xs"] {
290
- @apply app-button-xs;
362
+ @apply coco-button-xs;
291
363
  }
292
364
 
293
365
  &[data-size="sm"] {
294
- @apply app-button-sm;
366
+ @apply coco-button-sm;
295
367
  }
296
368
 
297
369
  &[data-size="md"] {
298
- @apply app-button-md;
370
+ @apply coco-button-md;
299
371
  }
300
372
 
301
373
  &[data-size="lg"] {
302
- @apply app-button-lg;
374
+ @apply coco-button-lg;
303
375
  }
304
376
 
305
377
  @media screen(md) {
306
378
  &[data-size-md="xs"] {
307
- @apply app-button-xs;
379
+ @apply coco-button-xs;
308
380
  }
309
381
 
310
382
  &[data-size-md="sm"] {
311
- @apply app-button-sm;
383
+ @apply coco-button-sm;
312
384
  }
313
385
 
314
386
  &[data-size-md="md"] {
315
- @apply app-button-md;
387
+ @apply coco-button-md;
316
388
  }
317
389
 
318
390
  &[data-size-md="lg"] {
319
- @apply app-button-lg;
391
+ @apply coco-button-lg;
320
392
  }
321
393
  }
322
394
 
323
395
  @media screen(lg) {
324
396
  &[data-size-lg="xs"] {
325
- @apply app-button-xs;
397
+ @apply coco-button-xs;
326
398
  }
327
399
 
328
400
  &[data-size-lg="sm"] {
329
- @apply app-button-sm;
401
+ @apply coco-button-sm;
330
402
  }
331
403
 
332
404
  &[data-size-lg="md"] {
333
- @apply app-button-md;
405
+ @apply coco-button-md;
334
406
  }
335
407
 
336
408
  &[data-size-lg="lg"] {
337
- @apply app-button-lg;
409
+ @apply coco-button-lg;
338
410
  }
339
411
  }
340
412
 
341
413
  @media screen(xl) {
342
414
  &[data-size-xl="xs"] {
343
- @apply app-button-xs;
415
+ @apply coco-button-xs;
344
416
  }
345
417
 
346
418
  &[data-size-xl="sm"] {
347
- @apply app-button-sm;
419
+ @apply coco-button-sm;
348
420
  }
349
421
 
350
422
  &[data-size-xl="md"] {
351
- @apply app-button-md;
423
+ @apply coco-button-md;
352
424
  }
353
425
 
354
426
  &[data-size-xl="lg"] {
355
- @apply app-button-lg;
427
+ @apply coco-button-lg;
356
428
  }
357
429
  }
358
430
 
359
431
  @media screen(2xl) {
360
432
  &[data-size-xxl="xs"],
361
433
  &[data-size-2xl="xs"] {
362
- @apply app-button-xs;
434
+ @apply coco-button-xs;
363
435
  }
364
436
 
365
437
  &[data-size-xxl="sm"],
366
438
  &[data-size-2xl="sm"] {
367
- @apply app-button-sm;
439
+ @apply coco-button-sm;
368
440
  }
369
441
 
370
442
  &[data-size-xxl="md"],
371
443
  &[data-size-2xl="md"] {
372
- @apply app-button-md;
444
+ @apply coco-button-md;
373
445
  }
374
446
 
375
447
  &[data-size-xxl="lg"],
376
448
  &[data-size-2xl="lg"] {
377
- @apply app-button-lg;
449
+ @apply coco-button-lg;
378
450
  }
379
451
  }
380
452
 
381
453
  @media screen(max) {
382
454
  &[data-size-max="xs"] {
383
- @apply app-button-xs;
455
+ @apply coco-button-xs;
384
456
  }
385
457
 
386
458
  &[data-size-max="sm"] {
387
- @apply app-button-sm;
459
+ @apply coco-button-sm;
388
460
  }
389
461
 
390
462
  &[data-size-max="md"] {
391
- @apply app-button-md;
463
+ @apply coco-button-md;
392
464
  }
393
465
 
394
466
  &[data-size-max="lg"] {
395
- @apply app-button-lg;
467
+ @apply coco-button-lg;
396
468
  }
397
469
  }
398
470
  }
399
471
  }
400
472
 
401
473
  @layer utilities {
402
- .app-button-xs {
474
+ .coco-button-xs {
403
475
  .button-content {
404
476
  font-size: 14px;
405
477
  line-height: 14px;
@@ -429,9 +501,9 @@
429
501
  }
430
502
  }
431
503
 
432
- .app-button-sm {
504
+ .coco-button-sm {
433
505
  .button-content {
434
- @apply text-label-sm;
506
+ @apply coco-label-sm;
435
507
  }
436
508
 
437
509
  .button-icon [data-component="icon"],
@@ -458,9 +530,9 @@
458
530
  }
459
531
  }
460
532
 
461
- .app-button-md {
533
+ .coco-button-md {
462
534
  .button-content {
463
- @apply text-label-md;
535
+ @apply coco-label-md;
464
536
  }
465
537
 
466
538
  .button-icon [data-component="icon"],
@@ -487,9 +559,9 @@
487
559
  }
488
560
  }
489
561
 
490
- .app-button-lg {
562
+ .coco-button-lg {
491
563
  .button-content {
492
- @apply text-label-lg;
564
+ @apply coco-label-lg;
493
565
  }
494
566
 
495
567
  .button-icon [data-component="icon"],
@@ -0,0 +1,83 @@
1
+ <%= coco_tag(:div, class: "coco-button-wrapper", x: alpine_wrapper_attrs.to_h) do %>
2
+ <%= render component_tag(button_tag,
3
+ class: {
4
+ "coco-button": true,
5
+ "icon-only": icon_only?,
6
+ "with-icon": (icon? && !icon_only?)
7
+ },
8
+ x: {
9
+ data: (x_data("button", alpine_data) unless static?),
10
+ bind: ("root" unless static?),
11
+ "dropdown:trigger": (true if dropdown?),
12
+ "dropdown:anchor": (true if dropdown?),
13
+ "@click": ("#{"checkConfirmation($event);" if confirm?} #{on_click}" if confirm? || on_click.present?)
14
+ }
15
+ ) do %>
16
+ <span class="button-inner">
17
+ <% if static? %>
18
+ <% if icon? %>
19
+ <span class="button-icon">
20
+ <%= icon %>
21
+ </span>
22
+ <% end %>
23
+ <% if button_text.present? %>
24
+ <span class="button-content">
25
+ <%= button_text %>
26
+ </span>
27
+ <% end %>
28
+ <% else %>
29
+ <% states.each do |name, props| %>
30
+ <% if props[:icon].present? %>
31
+ <% if states.many? %>
32
+ <span
33
+ class="button-icon"
34
+ x-ref="<%= name %>Icon"
35
+ x-show="showIcon('<%= name %>')"
36
+ <%= "x-cloak" unless name.to_sym == :default %>>
37
+ <%= props[:icon] %>
38
+ </span>
39
+ <% else %>
40
+ <span class="button-icon" x-ref="defaultIcon">
41
+ <%= props[:icon] %>
42
+ </span>
43
+ <% end %>
44
+ <% end %>
45
+ <% end %>
46
+
47
+ <% unless icon_only? %>
48
+ <% states.each do |name, props| %>
49
+ <% if states.many? %>
50
+ <span
51
+ class="button-content"
52
+ x-ref="<%= name %>Content"
53
+ x-show="showContent('<%= name %>')"
54
+ <%= "x-cloak" unless name.to_sym == :default %>>
55
+ <%= props[:text] %>
56
+ </span>
57
+ <% else %>
58
+ <span class="button-content" x-ref="defaultContent">
59
+ <%= props[:text] %>
60
+ </span>
61
+ <% end %>
62
+ <% end %>
63
+ <% end %>
64
+
65
+ <% if toggle? %>
66
+ <% if toggle_direction == :horizontal %>
67
+ <%= coco_icon(:chevron_right, class: "button-toggle") %>
68
+ <% else %>
69
+ <%= coco_icon(:chevron_down, class: "button-toggle") %>
70
+ <% end %>
71
+ <% end %>
72
+ <% end %>
73
+ </span>
74
+ <% end %>
75
+
76
+ <% if dropdown? %>
77
+ <div x-dropdown:content>
78
+ <div class="button-dropdown">
79
+ <%= dropdown %>
80
+ </div>
81
+ </div>
82
+ <% end %>
83
+ <% end %>
@@ -1,4 +1,4 @@
1
- import { CocoComponent } from "@js/coco.js";
1
+ import { CocoComponent } from "@assets/js/shared/coco.js";
2
2
  import { camelCase } from "lodash";
3
3
 
4
4
  export default CocoComponent("button", (data = {}) => {
@@ -181,6 +181,7 @@ export default CocoComponent("button", (data = {}) => {
181
181
  "x-options": "options",
182
182
  "x-tooltip": "tooltipText",
183
183
  "x-effect": "setTooltipText",
184
+ ":disabled": "disabled",
184
185
  },
185
186
  };
186
187
  });