m9sh 0.2.1 → 0.2.2
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/.idea/hotcdn.iml +30 -0
- data/.mise.toml +2 -2
- data/app/assets/config/manifest.js +4 -0
- data/app/assets/images/icons/activity.svg +3 -0
- data/app/assets/images/icons/bell.svg +4 -0
- data/app/assets/images/icons/book.svg +4 -0
- data/app/assets/images/icons/chevron-down.svg +3 -0
- data/app/assets/images/icons/chevron-left.svg +3 -0
- data/app/assets/images/icons/chevron-right.svg +3 -0
- data/app/assets/images/icons/credit-card.svg +4 -0
- data/app/assets/images/icons/dollar-sign.svg +3 -0
- data/app/assets/images/icons/edit.svg +4 -0
- data/app/assets/images/icons/github.svg +3 -0
- data/app/assets/images/icons/home.svg +4 -0
- data/app/assets/images/icons/info.svg +5 -0
- data/app/assets/images/icons/layout.svg +6 -0
- data/app/assets/images/icons/logout.svg +5 -0
- data/app/assets/images/icons/menu.svg +5 -0
- data/app/assets/images/icons/moon.svg +3 -0
- data/app/assets/images/icons/paintbrush.svg +6 -0
- data/app/assets/images/icons/search.svg +4 -0
- data/app/assets/images/icons/settings.svg +4 -0
- data/app/assets/images/icons/sun.svg +11 -0
- data/app/assets/images/icons/user.svg +4 -0
- data/app/assets/images/icons/users.svg +5 -0
- data/app/assets/stylesheets/tailwind.css +1180 -0
- data/app/components/backdrop_component.rb +103 -0
- data/app/components/docs/code_block_component.rb +56 -0
- data/app/components/docs/component_api_component.rb +16 -0
- data/app/components/docs/component_examples_component.rb +16 -0
- data/app/components/docs/component_header_component.html.erb +8 -0
- data/app/components/docs/component_header_component.rb +14 -0
- data/app/components/docs/component_installation_component.html.erb +15 -0
- data/app/components/docs/component_installation_component.rb +13 -0
- data/app/components/docs/component_page_component.html.erb +9 -0
- data/app/components/docs/component_page_component.rb +19 -0
- data/app/components/docs/component_preview_component.rb +318 -0
- data/app/components/docs/component_usage_component.rb +18 -0
- data/app/components/docs/prop_table_component.rb +64 -0
- data/app/controllers/application_controller.rb +3 -0
- data/app/controllers/blocks_controller.rb +51 -0
- data/app/controllers/docs_controller.rb +162 -0
- data/app/controllers/showcase_controller.rb +42 -0
- data/app/helpers/blocks_helper.rb +343 -0
- data/app/helpers/docs_helper.rb +3807 -0
- data/app/helpers/m9sh/toast_helper.rb +46 -0
- data/app/helpers/m9sh_helper.rb +343 -0
- data/app/javascript/application.js +3 -0
- data/app/javascript/controllers/application.js +9 -0
- data/app/javascript/controllers/backdrop_controller.js +137 -0
- data/app/javascript/controllers/color_customizer_controller.js +569 -0
- data/app/javascript/controllers/color_theme_controller.js +120 -0
- data/app/javascript/controllers/docs/component_preview_controller.js +149 -0
- data/app/javascript/controllers/docs/copy_button_controller.js +20 -0
- data/app/javascript/controllers/index.js +6 -0
- data/app/javascript/controllers/theme_controller.js +23 -0
- data/app/views/blocks/_sidebar.html.erb +31 -0
- data/app/views/blocks/_toc.html.erb +29 -0
- data/app/views/blocks/examples/dashboard-01.html.erb +180 -0
- data/app/views/blocks/examples/dashboard-02.html.erb +190 -0
- data/app/views/blocks/examples/dashboard-03.html.erb +210 -0
- data/app/views/blocks/examples/settings-01.html.erb +220 -0
- data/app/views/blocks/examples/settings-02.html.erb +231 -0
- data/app/views/blocks/examples/settings-03.html.erb +340 -0
- data/app/views/blocks/index.html.erb +65 -0
- data/app/views/docs/_sidebar.html.erb +47 -0
- data/app/views/docs/_toc.html.erb +19 -0
- data/app/views/docs/about.html.erb +68 -0
- data/app/views/docs/components/accordion.html.erb +196 -0
- data/app/views/docs/components/alert.html.erb +272 -0
- data/app/views/docs/components/alert_dialog.html.erb +232 -0
- data/app/views/docs/components/avatar.html.erb +207 -0
- data/app/views/docs/components/badge.html.erb +145 -0
- data/app/views/docs/components/breadcrumb.html.erb +264 -0
- data/app/views/docs/components/button.html.erb +229 -0
- data/app/views/docs/components/card.html.erb +378 -0
- data/app/views/docs/components/checkbox.html.erb +212 -0
- data/app/views/docs/components/collapsible.html.erb +252 -0
- data/app/views/docs/components/dialog.html.erb +323 -0
- data/app/views/docs/components/dropdown_menu.html.erb +289 -0
- data/app/views/docs/components/hover_card.html.erb +220 -0
- data/app/views/docs/components/input.html.erb +254 -0
- data/app/views/docs/components/label.html.erb +128 -0
- data/app/views/docs/components/main.html.erb +352 -0
- data/app/views/docs/components/navbar.html.erb +394 -0
- data/app/views/docs/components/navigation_menu.html.erb +226 -0
- data/app/views/docs/components/popover.html.erb +267 -0
- data/app/views/docs/components/progress.html.erb +107 -0
- data/app/views/docs/components/radio_group.html.erb +209 -0
- data/app/views/docs/components/select.html.erb +260 -0
- data/app/views/docs/components/separator.html.erb +162 -0
- data/app/views/docs/components/sheet.html.erb +270 -0
- data/app/views/docs/components/sidebar.html.erb +597 -0
- data/app/views/docs/components/skeleton.html.erb +150 -0
- data/app/views/docs/components/slider.html.erb +218 -0
- data/app/views/docs/components/spinner.html.erb +132 -0
- data/app/views/docs/components/switch.html.erb +148 -0
- data/app/views/docs/components/table.html.erb +259 -0
- data/app/views/docs/components/tabs.html.erb +225 -0
- data/app/views/docs/components/textarea.html.erb +239 -0
- data/app/views/docs/components/theme_toggle.html.erb +135 -0
- data/app/views/docs/components/toast.html.erb +205 -0
- data/app/views/docs/components/toaster.html.erb +227 -0
- data/app/views/docs/components/toggle.html.erb +154 -0
- data/app/views/docs/components/tooltip.html.erb +216 -0
- data/app/views/docs/components/typography.html.erb +180 -0
- data/app/views/docs/index.html.erb +143 -0
- data/app/views/docs/installation.html.erb +155 -0
- data/app/views/docs/simple_test.html.erb +13 -0
- data/app/views/docs/test_accordion.html.erb +14 -0
- data/app/views/docs/usage.html.erb +272 -0
- data/app/views/layouts/application.html.erb +107 -0
- data/app/views/layouts/backdrop.html.erb +77 -0
- data/app/views/shared/_app_navbar.html.erb +240 -0
- data/app/views/shared/_navbar.html.erb +69 -0
- data/app/views/showcase/v2/_components_grid.html.erb +38 -0
- data/app/views/showcase/v2/_features.html.erb +59 -0
- data/app/views/showcase/v2/_forms.html.erb +195 -0
- data/app/views/showcase/v2/_hero.html.erb +55 -0
- data/app/views/showcase/v2/_metrics.html.erb +107 -0
- data/app/views/showcase/v2.html.erb +18 -0
- data/lib/m9sh/version.rb +1 -1
- data/m9sh.gemspec +1 -1
- metadata +120 -1
@@ -0,0 +1,196 @@
|
|
1
|
+
<%= render Docs::ComponentPageComponent.new(title: "Accordion") do |page| %>
|
2
|
+
<% page.with_header(
|
3
|
+
name: "Accordion",
|
4
|
+
description: "A vertically stacked set of interactive headings that each reveal a section of content."
|
5
|
+
) %>
|
6
|
+
|
7
|
+
<% page.with_installation(component_name: "accordion") %>
|
8
|
+
|
9
|
+
<% page.with_usage do %>
|
10
|
+
<%= render Docs::CodeBlockComponent.new(
|
11
|
+
code: accordion_usage_code,
|
12
|
+
language: "erb"
|
13
|
+
) %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<% page.with_examples do %>
|
17
|
+
<!-- Default Example -->
|
18
|
+
<% accordion_html = capture do %>
|
19
|
+
<div class="w-full max-w-md">
|
20
|
+
<% accordion = M9sh::AccordionComponent.new(type: "single", collapsible: true) %>
|
21
|
+
<% accordion.with_item(value: "item-1") do |item| %>
|
22
|
+
<% item.with_trigger do %>
|
23
|
+
Is it accessible?
|
24
|
+
<% end %>
|
25
|
+
<% item.with_body do %>
|
26
|
+
Yes. It adheres to the WAI-ARIA design pattern.
|
27
|
+
<% end %>
|
28
|
+
<% end %>
|
29
|
+
|
30
|
+
<% accordion.with_item(value: "item-2") do |item| %>
|
31
|
+
<% item.with_trigger do %>
|
32
|
+
Is it styled?
|
33
|
+
<% end %>
|
34
|
+
<% item.with_body do %>
|
35
|
+
Yes. It comes with default styles that matches the other components' aesthetic.
|
36
|
+
<% end %>
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
<% accordion.with_item(value: "item-3") do |item| %>
|
40
|
+
<% item.with_trigger do %>
|
41
|
+
Is it animated?
|
42
|
+
<% end %>
|
43
|
+
<% item.with_body do %>
|
44
|
+
Yes. It's animated by default with smooth height transitions.
|
45
|
+
<% end %>
|
46
|
+
<% end %>
|
47
|
+
<%= render accordion %>
|
48
|
+
</div>
|
49
|
+
<% end %>
|
50
|
+
|
51
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
52
|
+
title: "Default",
|
53
|
+
preview_content: accordion_html,
|
54
|
+
code: accordion_example_code,
|
55
|
+
ai_command: accordion_example_code
|
56
|
+
) %>
|
57
|
+
|
58
|
+
<!-- Multiple Open Example -->
|
59
|
+
<% multiple_accordion_html = capture do %>
|
60
|
+
<div class="w-full max-w-md">
|
61
|
+
<% accordion = M9sh::AccordionComponent.new(type: "multiple") %>
|
62
|
+
<% accordion.with_item(value: "item-1") do |item| %>
|
63
|
+
<% item.with_trigger do %>
|
64
|
+
First Question
|
65
|
+
<% end %>
|
66
|
+
<% item.with_body do %>
|
67
|
+
This accordion allows multiple items to be open at the same time.
|
68
|
+
<% end %>
|
69
|
+
<% end %>
|
70
|
+
|
71
|
+
<% accordion.with_item(value: "item-2") do |item| %>
|
72
|
+
<% item.with_trigger do %>
|
73
|
+
Second Question
|
74
|
+
<% end %>
|
75
|
+
<% item.with_body do %>
|
76
|
+
Try opening this item while the first one is open!
|
77
|
+
<% end %>
|
78
|
+
<% end %>
|
79
|
+
|
80
|
+
<% accordion.with_item(value: "item-3") do |item| %>
|
81
|
+
<% item.with_trigger do %>
|
82
|
+
Third Question
|
83
|
+
<% end %>
|
84
|
+
<% item.with_body do %>
|
85
|
+
Both items above can stay open while you open this one.
|
86
|
+
<% end %>
|
87
|
+
<% end %>
|
88
|
+
<%= render accordion %>
|
89
|
+
</div>
|
90
|
+
<% end %>
|
91
|
+
|
92
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
93
|
+
title: "Multiple items open",
|
94
|
+
preview_content: multiple_accordion_html,
|
95
|
+
code: accordion_multiple_code,
|
96
|
+
ai_command: accordion_multiple_code
|
97
|
+
) %>
|
98
|
+
|
99
|
+
<!-- Default Value Example -->
|
100
|
+
<% default_accordion_html = capture do %>
|
101
|
+
<div class="w-full max-w-md">
|
102
|
+
<% accordion = M9sh::AccordionComponent.new(type: "single", default_value: "item-2") %>
|
103
|
+
<% accordion.with_item(value: "item-1") do |item| %>
|
104
|
+
<% item.with_trigger do %>
|
105
|
+
First Item
|
106
|
+
<% end %>
|
107
|
+
<% item.with_body do %>
|
108
|
+
This item is closed by default.
|
109
|
+
<% end %>
|
110
|
+
<% end %>
|
111
|
+
|
112
|
+
<% accordion.with_item(value: "item-2") do |item| %>
|
113
|
+
<% item.with_trigger do %>
|
114
|
+
Second Item (Default Open)
|
115
|
+
<% end %>
|
116
|
+
<% item.with_body do %>
|
117
|
+
This item is open by default because we set default_value: "item-2".
|
118
|
+
<% end %>
|
119
|
+
<% end %>
|
120
|
+
|
121
|
+
<% accordion.with_item(value: "item-3") do |item| %>
|
122
|
+
<% item.with_trigger do %>
|
123
|
+
Third Item
|
124
|
+
<% end %>
|
125
|
+
<% item.with_body do %>
|
126
|
+
This item is also closed by default.
|
127
|
+
<% end %>
|
128
|
+
<% end %>
|
129
|
+
<%= render accordion %>
|
130
|
+
</div>
|
131
|
+
<% end %>
|
132
|
+
|
133
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
134
|
+
title: "Default open item",
|
135
|
+
preview_content: default_accordion_html,
|
136
|
+
code: accordion_default_value_code,
|
137
|
+
ai_command: accordion_default_value_code
|
138
|
+
) %>
|
139
|
+
<% end %>
|
140
|
+
|
141
|
+
<% page.with_api do %>
|
142
|
+
<h3 class="text-lg font-semibold">Accordion</h3>
|
143
|
+
<%= render Docs::PropTableComponent.new(
|
144
|
+
props: [
|
145
|
+
{
|
146
|
+
name: "type",
|
147
|
+
type: "String",
|
148
|
+
default: '"single"',
|
149
|
+
description: 'Controls whether one or multiple items can be open. Options: "single" or "multiple"'
|
150
|
+
},
|
151
|
+
{
|
152
|
+
name: "collapsible",
|
153
|
+
type: "Boolean",
|
154
|
+
default: "true",
|
155
|
+
description: "When type is 'single', allows closing the open item by clicking it again"
|
156
|
+
},
|
157
|
+
{
|
158
|
+
name: "default_value",
|
159
|
+
type: "String",
|
160
|
+
default: "nil",
|
161
|
+
description: "The value of the item to open by default"
|
162
|
+
}
|
163
|
+
]
|
164
|
+
) %>
|
165
|
+
|
166
|
+
<h3 class="text-lg font-semibold mt-6">Item</h3>
|
167
|
+
<%= render Docs::PropTableComponent.new(
|
168
|
+
props: [
|
169
|
+
{
|
170
|
+
name: "value",
|
171
|
+
type: "String",
|
172
|
+
default: nil,
|
173
|
+
description: "A unique value for the item (required)"
|
174
|
+
}
|
175
|
+
]
|
176
|
+
) %>
|
177
|
+
|
178
|
+
<h3 class="text-lg font-semibold mt-6">Slots</h3>
|
179
|
+
<%= render Docs::PropTableComponent.new(
|
180
|
+
props: [
|
181
|
+
{
|
182
|
+
name: "trigger",
|
183
|
+
type: "Slot",
|
184
|
+
default: nil,
|
185
|
+
description: "The button that toggles the item"
|
186
|
+
},
|
187
|
+
{
|
188
|
+
name: "body",
|
189
|
+
type: "Slot",
|
190
|
+
default: nil,
|
191
|
+
description: "The content that expands/collapses"
|
192
|
+
}
|
193
|
+
]
|
194
|
+
) %>
|
195
|
+
<% end %>
|
196
|
+
<% end %>
|
@@ -0,0 +1,272 @@
|
|
1
|
+
<%= render Docs::ComponentPageComponent.new(title: "Alert") do |page| %>
|
2
|
+
<% page.with_header(
|
3
|
+
name: "Alert",
|
4
|
+
description: "Displays a callout for user attention with optional icon, title, and description."
|
5
|
+
) %>
|
6
|
+
|
7
|
+
<% page.with_installation(component_name: "alert") %>
|
8
|
+
|
9
|
+
<% page.with_usage do %>
|
10
|
+
<%= render Docs::CodeBlockComponent.new(
|
11
|
+
code: alert_usage_code,
|
12
|
+
language: "erb"
|
13
|
+
) %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<% page.with_examples do %>
|
17
|
+
<!-- Default Example -->
|
18
|
+
<% default_alert_html = capture do %>
|
19
|
+
<%= render M9sh::AlertComponent.new do |alert| %>
|
20
|
+
<% alert.with_title do %>
|
21
|
+
Heads up!
|
22
|
+
<% end %>
|
23
|
+
<% alert.with_description do %>
|
24
|
+
You can add components to your app using the CLI.
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
30
|
+
title: "Default",
|
31
|
+
preview_content: default_alert_html,
|
32
|
+
code: alert_default_code,
|
33
|
+
ai_command: alert_default_code
|
34
|
+
) %>
|
35
|
+
|
36
|
+
<!-- Destructive Example -->
|
37
|
+
<% destructive_alert_html = capture do %>
|
38
|
+
<%= render M9sh::AlertComponent.new(variant: :destructive) do |alert| %>
|
39
|
+
<% alert.with_title do %>
|
40
|
+
Error
|
41
|
+
<% end %>
|
42
|
+
<% alert.with_description do %>
|
43
|
+
Your session has expired. Please log in again.
|
44
|
+
<% end %>
|
45
|
+
<% end %>
|
46
|
+
<% end %>
|
47
|
+
|
48
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
49
|
+
title: "Destructive",
|
50
|
+
preview_content: destructive_alert_html,
|
51
|
+
code: alert_destructive_code,
|
52
|
+
ai_command: alert_destructive_code
|
53
|
+
) %>
|
54
|
+
|
55
|
+
<!-- With Icon Example -->
|
56
|
+
<% with_icon_alert_html = capture do %>
|
57
|
+
<%= render M9sh::AlertComponent.new do |alert| %>
|
58
|
+
<% alert.with_icon do %>
|
59
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
60
|
+
<circle cx="12" cy="12" r="10"/>
|
61
|
+
<line x1="12" y1="16" x2="12" y2="12"/>
|
62
|
+
<line x1="12" y1="8" x2="12.01" y2="8"/>
|
63
|
+
</svg>
|
64
|
+
<% end %>
|
65
|
+
<% alert.with_title do %>
|
66
|
+
Important Notice
|
67
|
+
<% end %>
|
68
|
+
<% alert.with_description do %>
|
69
|
+
This is an alert with an icon for better visual communication.
|
70
|
+
<% end %>
|
71
|
+
<% end %>
|
72
|
+
<% end %>
|
73
|
+
|
74
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
75
|
+
title: "With Icon",
|
76
|
+
preview_content: with_icon_alert_html,
|
77
|
+
code: alert_with_icon_code,
|
78
|
+
ai_command: alert_with_icon_code
|
79
|
+
) %>
|
80
|
+
|
81
|
+
<!-- Destructive With Icon Example -->
|
82
|
+
<% destructive_with_icon_html = capture do %>
|
83
|
+
<%= render M9sh::AlertComponent.new(variant: :destructive) do |alert| %>
|
84
|
+
<% alert.with_icon do %>
|
85
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
86
|
+
<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/>
|
87
|
+
<line x1="12" y1="9" x2="12" y2="13"/>
|
88
|
+
<line x1="12" y1="17" x2="12.01" y2="17"/>
|
89
|
+
</svg>
|
90
|
+
<% end %>
|
91
|
+
<% alert.with_title do %>
|
92
|
+
Warning
|
93
|
+
<% end %>
|
94
|
+
<% alert.with_description do %>
|
95
|
+
This action cannot be undone. This will permanently delete your account and remove your data from our servers.
|
96
|
+
<% end %>
|
97
|
+
<% end %>
|
98
|
+
<% end %>
|
99
|
+
|
100
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
101
|
+
title: "Destructive With Icon",
|
102
|
+
preview_content: destructive_with_icon_html,
|
103
|
+
code: nil,
|
104
|
+
ai_command: nil
|
105
|
+
) %>
|
106
|
+
|
107
|
+
<!-- Title Only Example -->
|
108
|
+
<% title_only_html = capture do %>
|
109
|
+
<div class="space-y-4">
|
110
|
+
<%= render M9sh::AlertComponent.new do |alert| %>
|
111
|
+
<% alert.with_icon do %>
|
112
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
113
|
+
<path d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z"/>
|
114
|
+
<path d="m9 12 2 2 4-4"/>
|
115
|
+
</svg>
|
116
|
+
<% end %>
|
117
|
+
<% alert.with_title do %>
|
118
|
+
Your message has been sent successfully!
|
119
|
+
<% end %>
|
120
|
+
<% end %>
|
121
|
+
|
122
|
+
<%= render M9sh::AlertComponent.new(variant: :destructive) do |alert| %>
|
123
|
+
<% alert.with_icon do %>
|
124
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
125
|
+
<circle cx="12" cy="12" r="10"/>
|
126
|
+
<line x1="15" y1="9" x2="9" y2="15"/>
|
127
|
+
<line x1="9" y1="9" x2="15" y2="15"/>
|
128
|
+
</svg>
|
129
|
+
<% end %>
|
130
|
+
<% alert.with_title do %>
|
131
|
+
Unable to process your request.
|
132
|
+
<% end %>
|
133
|
+
<% end %>
|
134
|
+
</div>
|
135
|
+
<% end %>
|
136
|
+
|
137
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
138
|
+
title: "Title Only",
|
139
|
+
preview_content: title_only_html,
|
140
|
+
code: nil,
|
141
|
+
ai_command: nil
|
142
|
+
) %>
|
143
|
+
|
144
|
+
<!-- Description Only Example -->
|
145
|
+
<% description_only_html = capture do %>
|
146
|
+
<%= render M9sh::AlertComponent.new do |alert| %>
|
147
|
+
<% alert.with_icon do %>
|
148
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
149
|
+
<path d="M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2z"/>
|
150
|
+
<circle cx="12" cy="12" r="3"/>
|
151
|
+
</svg>
|
152
|
+
<% end %>
|
153
|
+
<% alert.with_description do %>
|
154
|
+
This is a simple alert with only an icon and description text, no title.
|
155
|
+
<% end %>
|
156
|
+
<% end %>
|
157
|
+
<% end %>
|
158
|
+
|
159
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
160
|
+
title: "Description Only",
|
161
|
+
preview_content: description_only_html,
|
162
|
+
code: nil,
|
163
|
+
ai_command: nil
|
164
|
+
) %>
|
165
|
+
|
166
|
+
<!-- Multiple Alerts Example -->
|
167
|
+
<% multiple_alerts_html = capture do %>
|
168
|
+
<div class="space-y-4">
|
169
|
+
<%= render M9sh::AlertComponent.new do |alert| %>
|
170
|
+
<% alert.with_icon do %>
|
171
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
172
|
+
<circle cx="12" cy="12" r="10"/>
|
173
|
+
<line x1="12" y1="16" x2="12" y2="12"/>
|
174
|
+
<line x1="12" y1="8" x2="12.01" y2="8"/>
|
175
|
+
</svg>
|
176
|
+
<% end %>
|
177
|
+
<% alert.with_title do %>
|
178
|
+
System Maintenance
|
179
|
+
<% end %>
|
180
|
+
<% alert.with_description do %>
|
181
|
+
We will be performing scheduled maintenance on Sunday, October 15th from 2:00 AM to 6:00 AM EST.
|
182
|
+
<% end %>
|
183
|
+
<% end %>
|
184
|
+
|
185
|
+
<%= render M9sh::AlertComponent.new(variant: :destructive) do |alert| %>
|
186
|
+
<% alert.with_icon do %>
|
187
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
188
|
+
<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/>
|
189
|
+
<line x1="12" y1="9" x2="12" y2="13"/>
|
190
|
+
<line x1="12" y1="17" x2="12.01" y2="17"/>
|
191
|
+
</svg>
|
192
|
+
<% end %>
|
193
|
+
<% alert.with_title do %>
|
194
|
+
Action Required
|
195
|
+
<% end %>
|
196
|
+
<% alert.with_description do %>
|
197
|
+
Your payment method is about to expire. Please update your billing information to avoid service interruption.
|
198
|
+
<% end %>
|
199
|
+
<% end %>
|
200
|
+
|
201
|
+
<%= render M9sh::AlertComponent.new do |alert| %>
|
202
|
+
<% alert.with_icon do %>
|
203
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
204
|
+
<path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"/>
|
205
|
+
</svg>
|
206
|
+
<% end %>
|
207
|
+
<% alert.with_title do %>
|
208
|
+
New Feature Available
|
209
|
+
<% end %>
|
210
|
+
<% alert.with_description do %>
|
211
|
+
Check out our new dark mode! You can enable it in your account settings under Appearance.
|
212
|
+
<% end %>
|
213
|
+
<% end %>
|
214
|
+
</div>
|
215
|
+
<% end %>
|
216
|
+
|
217
|
+
<%= render Docs::ComponentPreviewComponent.new(
|
218
|
+
title: "Multiple Alerts",
|
219
|
+
preview_content: multiple_alerts_html,
|
220
|
+
code: nil,
|
221
|
+
ai_command: nil
|
222
|
+
) %>
|
223
|
+
<% end %>
|
224
|
+
|
225
|
+
<% page.with_api do %>
|
226
|
+
<h3 class="text-lg font-semibold">Alert Component Props</h3>
|
227
|
+
<%= render Docs::PropTableComponent.new(
|
228
|
+
props: [
|
229
|
+
{
|
230
|
+
name: "variant",
|
231
|
+
type: "Symbol",
|
232
|
+
default: ":default",
|
233
|
+
description: "The visual style variant. Options: :default, :destructive"
|
234
|
+
}
|
235
|
+
]
|
236
|
+
) %>
|
237
|
+
|
238
|
+
<h3 class="text-lg font-semibold mt-6">Alert Slots</h3>
|
239
|
+
<%= render Docs::PropTableComponent.new(
|
240
|
+
props: [
|
241
|
+
{
|
242
|
+
name: "icon",
|
243
|
+
type: "Slot",
|
244
|
+
default: nil,
|
245
|
+
description: "Optional icon to display at the start of the alert (usually an SVG)"
|
246
|
+
},
|
247
|
+
{
|
248
|
+
name: "title",
|
249
|
+
type: "Slot",
|
250
|
+
default: nil,
|
251
|
+
description: "The title/heading of the alert"
|
252
|
+
},
|
253
|
+
{
|
254
|
+
name: "description",
|
255
|
+
type: "Slot",
|
256
|
+
default: nil,
|
257
|
+
description: "The description/body text of the alert"
|
258
|
+
}
|
259
|
+
]
|
260
|
+
) %>
|
261
|
+
|
262
|
+
<div class="mt-6 space-y-2">
|
263
|
+
<h3 class="text-lg font-semibold">Notes</h3>
|
264
|
+
<ul class="list-disc list-inside text-sm text-muted-foreground space-y-1">
|
265
|
+
<li>The alert automatically adjusts its layout based on whether an icon is present</li>
|
266
|
+
<li>All slots are optional - you can use any combination of icon, title, and description</li>
|
267
|
+
<li>The destructive variant is useful for error messages and critical warnings</li>
|
268
|
+
<li>The component includes proper ARIA role="alert" for accessibility</li>
|
269
|
+
</ul>
|
270
|
+
</div>
|
271
|
+
<% end %>
|
272
|
+
<% end %>
|