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.
- checksums.yaml +4 -4
- data/app/assets/build/coco/app.css +4433 -3098
- data/app/assets/build/coco/app.js +125 -109
- data/app/assets/build/coco/book.css +1492 -99
- data/app/assets/build/coco/book.js +279 -18
- data/app/assets/css/app/tippy.css +1 -1
- data/app/assets/css/app.css +3 -3
- data/app/assets/css/{base/base.css → base.css} +14 -6
- data/app/assets/css/book.css +2 -2
- data/app/assets/css/{libs → shared}/tippy.css +20 -1
- data/app/assets/css/shared/utils/text.css +143 -0
- data/app/assets/js/app.js +2 -2
- data/app/assets/js/book.js +2 -2
- data/app/assets/js/libs/alpine/directives/dropdown.js +1 -1
- data/app/assets/js/libs/alpine/directives/tooltip.js +1 -1
- data/app/assets/js/shared/components.js +4 -0
- data/app/components/coco/app/blocks/header/header.js +1 -1
- data/app/components/coco/app/blocks/header/header.rb +2 -2
- data/app/components/coco/app/blocks/nav_drawer/nav_drawer.css +4 -0
- data/app/components/coco/app/blocks/nav_drawer/nav_drawer.js +1 -1
- data/app/components/coco/app/blocks/sidebar_nav/item/item.css +3 -3
- data/app/components/coco/app/blocks/sidebar_nav/item/item.js +2 -2
- data/app/components/coco/app/blocks/sidebar_nav/menu/menu.css +3 -3
- data/app/components/coco/app/blocks/sidebar_nav/menu/menu.js +1 -1
- data/app/components/coco/app/blocks/sidebar_nav/navbar/navbar.js +1 -1
- data/app/components/coco/app/blocks/slide_editor/slide_editor.js +1 -1
- data/app/components/coco/app/elements/alert/alert.css +18 -50
- data/app/components/coco/app/elements/alert/alert.html.erb +2 -2
- data/app/components/coco/app/elements/alert/alert.js +1 -1
- data/app/components/coco/app/elements/alert/alert.rb +11 -16
- data/app/components/coco/app/elements/color_picker/color_picker.css +2 -2
- data/app/components/coco/app/elements/color_picker/color_picker.js +1 -1
- data/app/components/coco/app/elements/color_picker_button/color_picker_button.js +1 -1
- data/app/components/coco/app/elements/color_picker_button/color_picker_button.rb +3 -3
- data/app/components/coco/app/elements/confirm_panel/confirm_panel.css +1 -1
- data/app/components/coco/app/elements/confirm_panel/confirm_panel.js +1 -1
- data/app/components/coco/app/elements/image_picker/image_picker.css +4 -4
- data/app/components/coco/app/elements/image_picker/image_picker.js +1 -1
- data/app/components/coco/app/elements/image_picker_button/image_picker_button.js +1 -1
- data/app/components/coco/app/elements/image_picker_button/image_picker_button.rb +3 -3
- data/app/components/coco/app/elements/layout_picker_button/layout_picker_button.js +1 -1
- data/app/components/coco/app/elements/layout_picker_button/layout_picker_button.rb +3 -3
- data/app/components/coco/app/elements/link/link.rb +1 -1
- data/app/components/coco/app/elements/menu/menu.css +5 -5
- data/app/components/coco/app/elements/menu_button/menu_button.js +1 -1
- data/app/components/coco/app/elements/menu_button/menu_button.rb +3 -3
- data/app/components/coco/app/elements/menu_items/user_profile/user_profile.css +1 -1
- data/app/components/coco/app/elements/notice/notice.js +1 -1
- data/app/components/coco/app/elements/seamless_textarea/seamless_textarea.js +1 -1
- data/app/components/coco/app/elements/snackbar/snackbar.css +1 -1
- data/app/components/coco/app/elements/snackbar/snackbar.js +1 -1
- data/app/components/coco/app/elements/stamp/stamp.css +103 -0
- data/app/components/coco/app/elements/stamp/stamp.html.erb +3 -0
- data/app/components/coco/app/elements/stamp/stamp.rb +29 -0
- data/app/components/coco/app/elements/system_banner/system_banner.js +1 -1
- data/app/components/coco/app/elements/toast/toast.js +1 -1
- data/app/components/coco/app/elements/toolbar/toolbar.js +1 -1
- data/app/components/coco/app/elements/toolbar/toolbar.rb +1 -1
- data/app/components/coco/app/fields/button_component.rb +1 -1
- data/app/components/coco/app/fields/submit_component.rb +1 -0
- data/app/components/coco/app/layouts/application/application.css +1 -1
- data/app/components/coco/app/layouts/application/application.js +1 -1
- data/app/components/coco/app/layouts/page/page.css +4 -0
- data/app/components/coco/app/layouts/page/page.html.erb +5 -0
- data/app/components/coco/app/layouts/page/page.js +1 -1
- data/app/components/coco/app/layouts/page/page.rb +4 -0
- data/app/components/coco/{app/elements → shared}/button/button.css +104 -32
- data/app/components/coco/shared/button/button.html.erb +83 -0
- data/app/components/coco/{base → shared}/button/button.js +2 -1
- data/app/components/coco/{base → shared}/button/button.rb +107 -42
- data/app/components/coco/{base → shared}/button/button_dropdown.js +11 -2
- data/app/components/coco/{app/elements → shared}/button_group/button_group.css +1 -1
- data/app/components/coco/{app/elements → shared}/button_group/button_group.js +12 -4
- data/app/components/coco/shared/button_group/button_group.rb +40 -0
- data/app/components/coco/{app/elements → shared}/button_to/button_to.css +1 -1
- data/app/components/coco/shared/button_to/button_to.rb +50 -0
- data/app/components/coco/{base → shared}/dropdown/dropdown.js +1 -1
- data/app/components/coco/{base → shared}/icon/icon.js +1 -1
- data/app/components/coco/{base → shared}/image_uploader/image_uploader.js +1 -1
- data/app/components/coco/{base → shared}/modal/modal.html.erb +2 -2
- data/app/components/coco/{base → shared}/modal/modal.js +3 -3
- data/app/components/coco/{base → shared}/modal/modal.rb +6 -4
- data/app/components/coco/{base → shared}/modal_dialog/modal_dialog.js +1 -1
- data/app/components/coco/{base → shared}/modal_lightbox/modal_lightbox.js +1 -1
- data/app/components/coco/{base → shared}/placeholder/placeholder.html.erb +1 -1
- data/app/components/coco/{base → shared}/placeholder/placeholder.rb +6 -0
- data/app/components/coco/{base → shared}/poll_controller/poll_controller.js +1 -1
- data/app/helpers/coco/app_helper.rb +17 -23
- data/app/helpers/coco/component_helper.rb +1 -1
- data/app/helpers/coco/{base_helper.rb → shared_helper.rb} +26 -3
- data/app/helpers/coco/url_helper.rb +1 -1
- data/config/tailwind.app.config.cjs +1 -1
- data/config/tailwind.book.config.cjs +1 -0
- data/config/tokens.cjs +9 -4
- data/lib/coco/engine.rb +6 -4
- data/lib/coco.rb +1 -1
- data/lib/generators/coco/coco_generator.rb +1 -1
- metadata +77 -80
- data/app/assets/css/base/components/coco.css +0 -14
- data/app/assets/css/base/components/dropdown.css +0 -7
- data/app/assets/css/base/components/tooltip.css +0 -19
- data/app/assets/js/base/components.js +0 -4
- data/app/components/coco/app/blocks/slat/slat.css +0 -9
- data/app/components/coco/app/blocks/slat/slat.rb +0 -13
- data/app/components/coco/app/elements/button/button.rb +0 -87
- data/app/components/coco/app/elements/button_group/button_group.rb +0 -42
- data/app/components/coco/app/elements/button_to/button_to.rb +0 -54
- data/app/components/coco/base/button/button.css +0 -75
- data/app/components/coco/base/button/button.html.erb +0 -71
- /data/app/assets/css/app/{utilities.css → utils.css} +0 -0
- /data/app/assets/css/{base → shared}/utils/colors.css +0 -0
- /data/app/assets/css/{base → shared}/utils/icons.css +0 -0
- /data/app/assets/js/{coco.js → shared/coco.js} +0 -0
- /data/app/components/coco/{base → shared}/avatar/avatar.css +0 -0
- /data/app/components/coco/{base → shared}/avatar/avatar.rb +0 -0
- /data/app/components/coco/{app/elements → shared}/button_group/button_group.html.erb +0 -0
- /data/app/components/coco/{app/elements → shared}/button_to/button_to.html.erb +0 -0
- /data/app/components/coco/{base → shared}/content/content.rb +0 -0
- /data/app/components/coco/{base → shared}/dropdown/dropdown.css +0 -0
- /data/app/components/coco/{base → shared}/dropdown/dropdown.html.erb +0 -0
- /data/app/components/coco/{base → shared}/dropdown/dropdown.rb +0 -0
- /data/app/components/coco/{base → shared}/embeds/youtube/youtube.css +0 -0
- /data/app/components/coco/{base → shared}/embeds/youtube/youtube.html.erb +0 -0
- /data/app/components/coco/{base → shared}/embeds/youtube/youtube.rb +0 -0
- /data/app/components/coco/{base → shared}/icon/icon.css +0 -0
- /data/app/components/coco/{base → shared}/icon/icon.html.erb +0 -0
- /data/app/components/coco/{base → shared}/icon/icon.rb +0 -0
- /data/app/components/coco/{base → shared}/image/image.css +0 -0
- /data/app/components/coco/{base → shared}/image/image.rb +0 -0
- /data/app/components/coco/{base → shared}/image_uploader/image_uploader.css +0 -0
- /data/app/components/coco/{base → shared}/image_uploader/image_uploader.html.erb +0 -0
- /data/app/components/coco/{base → shared}/image_uploader/image_uploader.rb +0 -0
- /data/app/components/coco/{base → shared}/link/link.css +0 -0
- /data/app/components/coco/{base → shared}/link/link.rb +0 -0
- /data/app/components/coco/{base → shared}/modal/modal.css +0 -0
- /data/app/components/coco/{base → shared}/modal_dialog/modal_dialog.css +0 -0
- /data/app/components/coco/{base → shared}/modal_dialog/modal_dialog.html.erb +0 -0
- /data/app/components/coco/{base → shared}/modal_dialog/modal_dialog.rb +0 -0
- /data/app/components/coco/{base → shared}/modal_lightbox/modal_lightbox.css +0 -0
- /data/app/components/coco/{base → shared}/modal_lightbox/modal_lightbox.html.erb +0 -0
- /data/app/components/coco/{base → shared}/modal_lightbox/modal_lightbox.rb +0 -0
- /data/app/components/coco/{base → shared}/pager_link/pager_link.css +0 -0
- /data/app/components/coco/{base → shared}/pager_link/pager_link.html.erb +0 -0
- /data/app/components/coco/{base → shared}/pager_link/pager_link.rb +0 -0
- /data/app/components/coco/{base → shared}/panel/panel.css +0 -0
- /data/app/components/coco/{base → shared}/panel/panel.html.erb +0 -0
- /data/app/components/coco/{base → shared}/panel/panel.rb +0 -0
- /data/app/components/coco/{base → shared}/placeholder/placeholder.css +0 -0
- /data/app/components/coco/{base → shared}/poll_controller/poll_controller.css +0 -0
- /data/app/components/coco/{base → shared}/poll_controller/poll_controller.html.erb +0 -0
- /data/app/components/coco/{base → shared}/poll_controller/poll_controller.rb +0 -0
- /data/app/components/coco/{base → shared}/svg/svg.html.erb +0 -0
- /data/app/components/coco/{base → shared}/svg/svg.rb +0 -0
@@ -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,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
|
@@ -16,7 +16,7 @@ module Coco
|
|
16
16
|
raise "Toolbar already has a `#{alignment}` section defined"
|
17
17
|
end
|
18
18
|
|
19
|
-
component = Coco::
|
19
|
+
component = Coco::ButtonGroup.new(**kwargs, theme: :toolbar, collapsible: true)
|
20
20
|
@sections[alignment] = view_context.render(component, &block)
|
21
21
|
end
|
22
22
|
|
@@ -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
|
-
|
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
|
362
|
+
@apply coco-button-xs;
|
291
363
|
}
|
292
364
|
|
293
365
|
&[data-size="sm"] {
|
294
|
-
@apply
|
366
|
+
@apply coco-button-sm;
|
295
367
|
}
|
296
368
|
|
297
369
|
&[data-size="md"] {
|
298
|
-
@apply
|
370
|
+
@apply coco-button-md;
|
299
371
|
}
|
300
372
|
|
301
373
|
&[data-size="lg"] {
|
302
|
-
@apply
|
374
|
+
@apply coco-button-lg;
|
303
375
|
}
|
304
376
|
|
305
377
|
@media screen(md) {
|
306
378
|
&[data-size-md="xs"] {
|
307
|
-
@apply
|
379
|
+
@apply coco-button-xs;
|
308
380
|
}
|
309
381
|
|
310
382
|
&[data-size-md="sm"] {
|
311
|
-
@apply
|
383
|
+
@apply coco-button-sm;
|
312
384
|
}
|
313
385
|
|
314
386
|
&[data-size-md="md"] {
|
315
|
-
@apply
|
387
|
+
@apply coco-button-md;
|
316
388
|
}
|
317
389
|
|
318
390
|
&[data-size-md="lg"] {
|
319
|
-
@apply
|
391
|
+
@apply coco-button-lg;
|
320
392
|
}
|
321
393
|
}
|
322
394
|
|
323
395
|
@media screen(lg) {
|
324
396
|
&[data-size-lg="xs"] {
|
325
|
-
@apply
|
397
|
+
@apply coco-button-xs;
|
326
398
|
}
|
327
399
|
|
328
400
|
&[data-size-lg="sm"] {
|
329
|
-
@apply
|
401
|
+
@apply coco-button-sm;
|
330
402
|
}
|
331
403
|
|
332
404
|
&[data-size-lg="md"] {
|
333
|
-
@apply
|
405
|
+
@apply coco-button-md;
|
334
406
|
}
|
335
407
|
|
336
408
|
&[data-size-lg="lg"] {
|
337
|
-
@apply
|
409
|
+
@apply coco-button-lg;
|
338
410
|
}
|
339
411
|
}
|
340
412
|
|
341
413
|
@media screen(xl) {
|
342
414
|
&[data-size-xl="xs"] {
|
343
|
-
@apply
|
415
|
+
@apply coco-button-xs;
|
344
416
|
}
|
345
417
|
|
346
418
|
&[data-size-xl="sm"] {
|
347
|
-
@apply
|
419
|
+
@apply coco-button-sm;
|
348
420
|
}
|
349
421
|
|
350
422
|
&[data-size-xl="md"] {
|
351
|
-
@apply
|
423
|
+
@apply coco-button-md;
|
352
424
|
}
|
353
425
|
|
354
426
|
&[data-size-xl="lg"] {
|
355
|
-
@apply
|
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
|
434
|
+
@apply coco-button-xs;
|
363
435
|
}
|
364
436
|
|
365
437
|
&[data-size-xxl="sm"],
|
366
438
|
&[data-size-2xl="sm"] {
|
367
|
-
@apply
|
439
|
+
@apply coco-button-sm;
|
368
440
|
}
|
369
441
|
|
370
442
|
&[data-size-xxl="md"],
|
371
443
|
&[data-size-2xl="md"] {
|
372
|
-
@apply
|
444
|
+
@apply coco-button-md;
|
373
445
|
}
|
374
446
|
|
375
447
|
&[data-size-xxl="lg"],
|
376
448
|
&[data-size-2xl="lg"] {
|
377
|
-
@apply
|
449
|
+
@apply coco-button-lg;
|
378
450
|
}
|
379
451
|
}
|
380
452
|
|
381
453
|
@media screen(max) {
|
382
454
|
&[data-size-max="xs"] {
|
383
|
-
@apply
|
455
|
+
@apply coco-button-xs;
|
384
456
|
}
|
385
457
|
|
386
458
|
&[data-size-max="sm"] {
|
387
|
-
@apply
|
459
|
+
@apply coco-button-sm;
|
388
460
|
}
|
389
461
|
|
390
462
|
&[data-size-max="md"] {
|
391
|
-
@apply
|
463
|
+
@apply coco-button-md;
|
392
464
|
}
|
393
465
|
|
394
466
|
&[data-size-max="lg"] {
|
395
|
-
@apply
|
467
|
+
@apply coco-button-lg;
|
396
468
|
}
|
397
469
|
}
|
398
470
|
}
|
399
471
|
}
|
400
472
|
|
401
473
|
@layer utilities {
|
402
|
-
.
|
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
|
-
.
|
504
|
+
.coco-button-sm {
|
433
505
|
.button-content {
|
434
|
-
@apply
|
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
|
-
.
|
533
|
+
.coco-button-md {
|
462
534
|
.button-content {
|
463
|
-
@apply
|
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
|
-
.
|
562
|
+
.coco-button-lg {
|
491
563
|
.button-content {
|
492
|
-
@apply
|
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
|
});
|