loco_motion-rails 0.0.7 → 0.0.8
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/README.md +45 -1
- data/app/components/daisy/actions/button_component.rb +109 -8
- data/app/components/daisy/actions/dropdown_component.html.haml +5 -5
- data/app/components/daisy/actions/dropdown_component.rb +94 -25
- data/app/components/daisy/actions/modal_component.html.haml +3 -2
- data/app/components/daisy/actions/modal_component.rb +94 -45
- data/app/components/daisy/actions/swap_component.rb +114 -5
- data/app/components/daisy/actions/theme_controller_component.html.haml +1 -1
- data/app/components/daisy/actions/theme_controller_component.rb +36 -1
- data/app/components/daisy/data_display/accordion_component.rb +79 -3
- data/app/components/daisy/data_display/avatar_component.rb +36 -16
- data/app/components/daisy/data_display/badge_component.rb +35 -5
- data/app/components/daisy/data_display/card_component.html.haml +5 -13
- data/app/components/daisy/data_display/card_component.rb +74 -39
- data/app/components/daisy/data_display/carousel_component.rb +38 -0
- data/app/components/daisy/data_display/chat_component.rb +40 -10
- data/app/components/daisy/data_display/collapse_component.rb +58 -1
- data/app/components/daisy/data_display/countdown_component.rb +49 -0
- data/app/components/daisy/data_display/diff_component.rb +37 -0
- data/app/components/daisy/data_display/figure_component.rb +49 -0
- data/app/components/daisy/data_display/kbd_component.rb +50 -2
- data/app/components/daisy/data_display/stat_component.rb +64 -6
- data/app/components/daisy/data_display/table_component.rb +99 -34
- data/app/components/daisy/data_display/timeline_component.rb +45 -0
- data/app/components/daisy/data_display/timeline_event_component.rb +39 -1
- data/app/components/daisy/feedback/alert_component.rb +46 -1
- data/app/components/daisy/feedback/loading_component.rb +39 -0
- data/app/components/daisy/feedback/progress_component.rb +39 -1
- data/app/components/daisy/feedback/radial_progress_component.rb +44 -1
- data/app/components/daisy/feedback/skeleton_component.rb +44 -0
- data/app/components/daisy/feedback/toast_component.rb +36 -0
- data/app/components/daisy/feedback/tooltip_component.rb +46 -10
- data/app/components/daisy/layout/artboard_component.rb +48 -0
- data/app/components/daisy/layout/divider_component.rb +50 -10
- data/app/components/daisy/layout/drawer_component.rb +62 -17
- data/app/components/daisy/layout/footer_component.rb +51 -11
- data/app/components/daisy/layout/hero_component.rb +67 -5
- data/app/components/daisy/layout/indicator_component.rb +55 -8
- data/app/components/daisy/layout/join_component.rb +71 -0
- data/app/components/daisy/layout/stack_component.rb +59 -0
- data/app/components/daisy/mockup/browser_component.rb +78 -0
- data/app/components/daisy/mockup/code_component.rb +144 -0
- data/app/components/daisy/mockup/device_component.rb +81 -0
- data/app/components/daisy/mockup/frame_component.rb +62 -0
- data/app/components/daisy/navigation/bottom_nav_component.rb +81 -2
- data/app/components/daisy/navigation/breadcrumbs_component.rb +40 -3
- data/app/components/daisy/navigation/link_component.rb +31 -6
- data/app/components/daisy/navigation/menu_component.rb +52 -20
- data/app/components/daisy/navigation/navbar_component.html.haml +1 -1
- data/app/components/daisy/navigation/navbar_component.rb +63 -2
- data/app/components/daisy/navigation/steps_component.rb +76 -0
- data/app/components/daisy/navigation/tabs_component.rb +110 -7
- data/app/components/hero/icon_component.rb +40 -0
- data/lib/daisy.rb +5 -0
- data/lib/loco_motion/helpers.rb +7 -0
- data/lib/loco_motion/version.rb +5 -0
- metadata +25 -5
@@ -1,3 +1,27 @@
|
|
1
|
+
#
|
2
|
+
# A component for rendering individual events within a timeline. Each event can
|
3
|
+
# have three sections: start (typically a date or time), middle (an icon or
|
4
|
+
# marker), and end (the event description).
|
5
|
+
#
|
6
|
+
# @part start The container for the start content (e.g., date/time).
|
7
|
+
# @part middle The container for the middle content.
|
8
|
+
# @part middle_icon Container for a simple icon when not using custom middle
|
9
|
+
# content.
|
10
|
+
# @part end The container for the end content (e.g., description).
|
11
|
+
# @part separator The line connecting this event to the next one.
|
12
|
+
#
|
13
|
+
# @slot start Custom content for the start section. You can also provide
|
14
|
+
# simple text via the start option.
|
15
|
+
#
|
16
|
+
# @slot middle Custom content for the middle section. You can also provide
|
17
|
+
# simple text via the middle option, or an icon via the middle_icon option.
|
18
|
+
#
|
19
|
+
# @slot end Custom content for the end section. You can also provide simple
|
20
|
+
# text via the end option.
|
21
|
+
#
|
22
|
+
# @note The middle and middle_icon options are mutually exclusive. If both are
|
23
|
+
# provided, middle takes precedence.
|
24
|
+
#
|
1
25
|
class Daisy::DataDisplay::TimelineEventComponent < LocoMotion::BaseComponent
|
2
26
|
renders_one :start, LocoMotion::BasicComponent.build(css: "timeline-start")
|
3
27
|
renders_one :middle, LocoMotion::BasicComponent.build(css: "timeline-middle")
|
@@ -6,7 +30,21 @@ class Daisy::DataDisplay::TimelineEventComponent < LocoMotion::BaseComponent
|
|
6
30
|
define_parts :start, :middle, :middle_icon, :end, :separator
|
7
31
|
|
8
32
|
#
|
9
|
-
#
|
33
|
+
# Creates a new timeline event component.
|
34
|
+
#
|
35
|
+
# @param kws [Hash] The keyword arguments for the component.
|
36
|
+
#
|
37
|
+
# @option kws [String] :start Text to display in the start section. You can
|
38
|
+
# also provide custom content using the start slot.
|
39
|
+
#
|
40
|
+
# @option kws [String] :middle Text to display in the middle section. You
|
41
|
+
# can also provide custom content using the middle slot.
|
42
|
+
#
|
43
|
+
# @option kws [String] :middle_icon Name of a heroicon to display in the
|
44
|
+
# middle section. Ignored if middle is provided.
|
45
|
+
#
|
46
|
+
# @option kws [String] :end Text to display in the end section. You can
|
47
|
+
# also provide custom content using the end slot.
|
10
48
|
#
|
11
49
|
def initialize(*args, **kws, &block)
|
12
50
|
super(*args, **kws, &block)
|
@@ -1,9 +1,54 @@
|
|
1
1
|
#
|
2
|
-
# The AlertComponent displays an important message to users.
|
2
|
+
# The AlertComponent displays an important message to users. It can be used to
|
3
|
+
# show information, success messages, warnings, or errors. Alerts can include
|
4
|
+
# an optional icon at the start and customizable content.
|
5
|
+
#
|
6
|
+
# @part icon [Heroicon] An optional icon displayed at the start of
|
7
|
+
# the alert. Uses the Heroicon system.
|
8
|
+
#
|
9
|
+
# @part content_wrapper [HTML] A wrapper for the main content of the alert.
|
10
|
+
# This allows for proper spacing and alignment with the icon.
|
11
|
+
#
|
12
|
+
# @loco_example Basic Alert
|
13
|
+
# = daisy_alert do
|
14
|
+
# This is a standard alert message.
|
15
|
+
#
|
16
|
+
# @loco_example Alert with Icon
|
17
|
+
# = daisy_alert(icon: "information-circle", icon_html: { variant: :outline }) do
|
18
|
+
# Here's some important information!
|
19
|
+
#
|
20
|
+
# @loco_example Alert Types
|
21
|
+
# = daisy_alert(icon: "information-circle", css: "alert-info", icon_html: { variant: :outline }) do
|
22
|
+
# Information alert.
|
23
|
+
#
|
24
|
+
# = daisy_alert(icon: "check-circle", css: "alert-success", icon_html: { variant: :outline }) do
|
25
|
+
# Success alert.
|
26
|
+
#
|
27
|
+
# = daisy_alert(icon: "exclamation-triangle", css: "alert-warning", icon_html: { variant: :outline }) do
|
28
|
+
# Warning alert.
|
29
|
+
#
|
30
|
+
# = daisy_alert(icon: "exclamation-circle", css: "alert-error", icon_html: { variant: :outline }) do
|
31
|
+
# Error alert.
|
3
32
|
#
|
4
33
|
class Daisy::Feedback::AlertComponent < LocoMotion::BaseComponent
|
5
34
|
define_parts :icon, :content_wrapper
|
6
35
|
|
36
|
+
#
|
37
|
+
# Creates a new Alert component.
|
38
|
+
#
|
39
|
+
# @param args [Array] Positional arguments passed to the parent class.
|
40
|
+
# @param kws [Hash] Keyword arguments for customizing the alert.
|
41
|
+
#
|
42
|
+
# @option kws icon [String] The name of the Heroicon to display at the
|
43
|
+
# start of the alert.
|
44
|
+
#
|
45
|
+
# @option kws icon_html [Hash] Additional HTML attributes for the icon
|
46
|
+
# element. Options include `variant: :outline` or `variant: :solid`.
|
47
|
+
#
|
48
|
+
# @option kws css [String] Additional CSS classes for the alert. Use
|
49
|
+
# `alert-info`, `alert-success`, `alert-warning`, or `alert-error` for
|
50
|
+
# different alert types.
|
51
|
+
#
|
7
52
|
def initialize(*args, **kws, &block)
|
8
53
|
super
|
9
54
|
|
@@ -1,6 +1,45 @@
|
|
1
|
+
#
|
2
|
+
# The LoadingComponent displays an animated indicator to show that a process is
|
3
|
+
# running in the background. It supports multiple animation styles and can be
|
4
|
+
# customized with different colors and sizes.
|
5
|
+
#
|
6
|
+
# Includes the {LocoMotion::Concerns::TippableComponent} module to enable easy
|
7
|
+
# tooltip addition.
|
8
|
+
#
|
9
|
+
# @loco_example Basic Loading Spinners
|
10
|
+
# = daisy_loading(css: "loading-spinner text-primary")
|
11
|
+
# = daisy_loading(css: "loading-dots text-secondary")
|
12
|
+
# = daisy_loading(css: "loading-ring text-accent")
|
13
|
+
#
|
14
|
+
# @loco_example Other Loading Styles
|
15
|
+
# = daisy_loader(css: "loading-ball text-info")
|
16
|
+
# = daisy_loader(css: "loading-bars text-success")
|
17
|
+
# = daisy_loader(css: "loading-infinity text-error")
|
18
|
+
#
|
19
|
+
# @note The helper method is also aliased as `daisy_loader` for better
|
20
|
+
# readability, but CSS classes must still use the `loading-*` prefix.
|
21
|
+
#
|
1
22
|
class Daisy::Feedback::LoadingComponent < LocoMotion::BaseComponent
|
2
23
|
prepend LocoMotion::Concerns::TippableComponent
|
3
24
|
|
25
|
+
#
|
26
|
+
# Creates a new Loading component.
|
27
|
+
#
|
28
|
+
# @param args [Array] Positional arguments passed to the parent class.
|
29
|
+
# @param kws [Hash] Keyword arguments for customizing the loader.
|
30
|
+
#
|
31
|
+
# @option kws css [String] Additional CSS classes for the loader. Available
|
32
|
+
# styles include: `loading-spinner`, `loading-dots`, `loading-ring`,
|
33
|
+
# `loading-ball`, `loading-bars`, and `loading-infinity`. Can be combined
|
34
|
+
# with color classes like `text-primary` or `text-success`.
|
35
|
+
#
|
36
|
+
# @option kws tip [String] Optional tooltip text to display when hovering
|
37
|
+
# over the loader. Added by the TippableComponent module.
|
38
|
+
#
|
39
|
+
def initialize(*args, **kws, &block)
|
40
|
+
super
|
41
|
+
end
|
42
|
+
|
4
43
|
def before_render
|
5
44
|
add_css(:component, "loading")
|
6
45
|
end
|
@@ -1,5 +1,44 @@
|
|
1
|
+
#
|
2
|
+
# The ProgressComponent displays a horizontal bar that indicates the completion
|
3
|
+
# status of a process. It can show determinate progress with a specific value
|
4
|
+
# or indeterminate progress with an animated bar.
|
5
|
+
#
|
6
|
+
# The component renders as an HTML `<progress>` element and supports various
|
7
|
+
# colors and styles through CSS classes.
|
8
|
+
#
|
9
|
+
# @loco_example Basic Progress Bars
|
10
|
+
# = daisy_progress(value: 25)
|
11
|
+
# = daisy_progress(css: "progress-primary", value: 50)
|
12
|
+
# = daisy_progress(css: "progress-secondary", value: 75)
|
13
|
+
# = daisy_progress(css: "progress-accent", value: 100)
|
14
|
+
#
|
15
|
+
# @loco_example Indeterminate Progress Bars
|
16
|
+
# = daisy_progress(css: "progress-info")
|
17
|
+
# = daisy_progress(css: "progress-success ![animation-delay:250ms]")
|
18
|
+
# = daisy_progress(css: "progress-warning ![animation-delay:500ms]")
|
19
|
+
# = daisy_progress(css: "progress-error ![animation-delay:750ms]")
|
20
|
+
#
|
1
21
|
class Daisy::Feedback::ProgressComponent < LocoMotion::BaseComponent
|
2
22
|
|
23
|
+
#
|
24
|
+
# Creates a new Progress component.
|
25
|
+
#
|
26
|
+
# @param args [Array] Positional arguments passed to the parent class.
|
27
|
+
# @param kws [Hash] Keyword arguments for customizing the progress bar.
|
28
|
+
#
|
29
|
+
# @option kws value [Integer, nil] The current progress value. Set to `nil`
|
30
|
+
# for an indeterminate progress bar that animates continuously. Defaults
|
31
|
+
# to `nil`.
|
32
|
+
#
|
33
|
+
# @option kws max [Integer] The maximum value for the progress bar.
|
34
|
+
# Defaults to `100` to easily work with percentage values.
|
35
|
+
#
|
36
|
+
# @option kws css [String] Additional CSS classes for the progress bar.
|
37
|
+
# Available styles include: `progress-primary`, `progress-secondary`,
|
38
|
+
# `progress-accent`, `progress-info`, `progress-success`,
|
39
|
+
# `progress-warning`, and `progress-error`. Can be combined with utility
|
40
|
+
# classes like `![animation-delay:250ms]` for staggered animations.
|
41
|
+
#
|
3
42
|
def initialize(*args, **kws, &block)
|
4
43
|
super
|
5
44
|
|
@@ -16,5 +55,4 @@ class Daisy::Feedback::ProgressComponent < LocoMotion::BaseComponent
|
|
16
55
|
def call
|
17
56
|
part(:component)
|
18
57
|
end
|
19
|
-
|
20
58
|
end
|
@@ -1,5 +1,49 @@
|
|
1
|
+
#
|
2
|
+
# The RadialProgressComponent displays a circular progress indicator that can be
|
3
|
+
# customized with different sizes, thicknesses, and colors. The component can
|
4
|
+
# also contain content within its circular display.
|
5
|
+
#
|
6
|
+
# The progress is always displayed as a percentage (0-100) due to the way the
|
7
|
+
# component is rendered using CSS custom properties.
|
8
|
+
#
|
9
|
+
# @loco_example Basic Usage
|
10
|
+
# = daisy_radial(value: 66) do
|
11
|
+
# 66%
|
12
|
+
#
|
13
|
+
# @loco_example With Icons
|
14
|
+
# = daisy_radial(value: 68) do
|
15
|
+
# = hero_icon("beaker", css: "size-8 text-purple-500")
|
16
|
+
#
|
17
|
+
# = daisy_radial(value: 52, css: "text-success") do
|
18
|
+
# 52%
|
19
|
+
#
|
20
|
+
# @loco_example Custom Size and Styling
|
21
|
+
# = daisy_radial(value: 19, size: "15rem", thickness: "4px",
|
22
|
+
# css: "bg-primary text-primary-content text-3xl") do
|
23
|
+
# 19%
|
24
|
+
#
|
1
25
|
class Daisy::Feedback::RadialProgressComponent < LocoMotion::BaseComponent
|
2
26
|
|
27
|
+
#
|
28
|
+
# Creates a new Radial Progress component.
|
29
|
+
#
|
30
|
+
# @param args [Array] Positional arguments passed to the parent class.
|
31
|
+
# @param kws [Hash] Keyword arguments for customizing the radial progress.
|
32
|
+
#
|
33
|
+
# @option kws value [Integer] The current progress value as a
|
34
|
+
# percentage (0-100). Required for the progress to be displayed.
|
35
|
+
#
|
36
|
+
# @option kws size [String] The size of the radial progress component.
|
37
|
+
# Must include CSS units (e.g., "5rem", "100px"). Defaults to "5rem".
|
38
|
+
#
|
39
|
+
# @option kws thickness [String] The thickness of the progress ring. Must
|
40
|
+
# include CSS units (e.g., "4px", "0.5rem"). Defaults to one-tenth of
|
41
|
+
# the size.
|
42
|
+
#
|
43
|
+
# @option kws css [String] Additional CSS classes for styling. Common
|
44
|
+
# options include color classes like `text-success` or `text-error`,
|
45
|
+
# background colors like `bg-primary`, and text sizing like `text-3xl`.
|
46
|
+
#
|
3
47
|
def initialize(*args, **kws, &block)
|
4
48
|
super
|
5
49
|
|
@@ -26,4 +70,3 @@ class Daisy::Feedback::RadialProgressComponent < LocoMotion::BaseComponent
|
|
26
70
|
end
|
27
71
|
|
28
72
|
end
|
29
|
-
|
@@ -1,4 +1,48 @@
|
|
1
|
+
#
|
2
|
+
# The SkeletonComponent creates loading placeholder elements that mimic the
|
3
|
+
# shape and size of content that is being loaded. This provides users with a
|
4
|
+
# visual indication of the content's layout before it arrives, reducing
|
5
|
+
# perceived loading times and improving user experience.
|
6
|
+
#
|
7
|
+
# Skeletons can be used in two ways:
|
8
|
+
# 1. As standalone shapes with custom dimensions.
|
9
|
+
# 2. As a modifier class on existing components to create component-specific
|
10
|
+
# loading states.
|
11
|
+
#
|
12
|
+
# @loco_example Basic Shapes
|
13
|
+
# = daisy_skeleton(css: "w-24 h-24 rounded-full")
|
14
|
+
# = daisy_skeleton(css: "w-36 h-20")
|
15
|
+
# = daisy_skeleton(css: "w-48 h-5")
|
16
|
+
#
|
17
|
+
# @loco_example Component Loading States
|
18
|
+
# = daisy_badge(css: "badge-lg skeleton text-slate-400") do
|
19
|
+
# Loading...
|
20
|
+
#
|
21
|
+
# = daisy_button(css: "skeleton text-transparent") do
|
22
|
+
# Loading...
|
23
|
+
#
|
24
|
+
# = daisy_alert(css: "skeleton")
|
25
|
+
#
|
26
|
+
# = daisy_chat do |chat|
|
27
|
+
# - chat.with_avatar(wrapper_css: "skeleton")
|
28
|
+
# - chat.with_bubble(css: "skeleton text-transparent") do
|
29
|
+
# Loading...
|
30
|
+
#
|
1
31
|
class Daisy::Feedback::SkeletonComponent < LocoMotion::BaseComponent
|
32
|
+
#
|
33
|
+
# Creates a new Skeleton component.
|
34
|
+
#
|
35
|
+
# @param args [Array] Positional arguments passed to the parent class.
|
36
|
+
# @param kws [Hash] Keyword arguments for customizing the skeleton.
|
37
|
+
#
|
38
|
+
# @option kws css [String] Additional CSS classes for styling. Common
|
39
|
+
# options include:
|
40
|
+
# - Dimensions: `w-24`, `h-20`
|
41
|
+
# - Shapes: `rounded-full`, `rounded-lg`
|
42
|
+
# - Colors: `bg-base-200`
|
43
|
+
# When using with other components, combine with `text-transparent` to
|
44
|
+
# hide placeholder text.
|
45
|
+
#
|
2
46
|
def before_render
|
3
47
|
add_css(:component, "skeleton")
|
4
48
|
end
|
@@ -1,4 +1,40 @@
|
|
1
|
+
#
|
2
|
+
# The ToastComponent provides a container for displaying non-critical messages
|
3
|
+
# to users, typically positioned at the edges of the viewport. Toasts are
|
4
|
+
# commonly used for temporary notifications, success messages, or error alerts
|
5
|
+
# that don't require immediate user action.
|
6
|
+
#
|
7
|
+
# @note Currently, this component only handles positioning. JavaScript
|
8
|
+
# functionality for showing/hiding toasts will be implemented in a future
|
9
|
+
# Stimulus ToastController.
|
10
|
+
#
|
11
|
+
# @loco_example Basic Toast with Alert
|
12
|
+
# = daisy_toast do
|
13
|
+
# = daisy_alert(icon: "check-circle", css: "alert-success text-white") do
|
14
|
+
# Yay! Something went well!
|
15
|
+
#
|
16
|
+
# @loco_example Multiple Alerts in Toast
|
17
|
+
# = daisy_toast do
|
18
|
+
# = daisy_alert(icon: "check-circle", css: "alert-success text-white") do
|
19
|
+
# Operation successful!
|
20
|
+
#
|
21
|
+
# = daisy_alert(icon: "exclamation-circle", css: "alert-error text-white") do
|
22
|
+
# An error occurred.
|
23
|
+
#
|
1
24
|
class Daisy::Feedback::ToastComponent < LocoMotion::BaseComponent
|
25
|
+
#
|
26
|
+
# Creates a new Toast component.
|
27
|
+
#
|
28
|
+
# @param args [Array] Positional arguments passed to the parent class.
|
29
|
+
# @param kws [Hash] Keyword arguments for customizing the toast.
|
30
|
+
#
|
31
|
+
# @option kws css [String] Additional CSS classes for styling. By default,
|
32
|
+
# toasts are positioned in the bottom-right corner of the viewport.
|
33
|
+
# Common options include:
|
34
|
+
# - Position modifiers: `toast-top`, `toast-bottom`, `toast-center`,
|
35
|
+
# `toast-start`, `toast-end`
|
36
|
+
# - Stack order: `z-50`
|
37
|
+
#
|
2
38
|
def before_render
|
3
39
|
add_css(:component, "toast")
|
4
40
|
end
|
@@ -1,20 +1,56 @@
|
|
1
1
|
#
|
2
|
-
#
|
2
|
+
# The TooltipComponent displays informative text when users hover over an
|
3
|
+
# element. It can be used in two ways:
|
4
|
+
# 1. As a wrapper component around any HTML content.
|
5
|
+
# 2. Through the TippableComponent concern, which many components include.
|
6
|
+
#
|
7
|
+
# This component is also aliased as `daisy_tip` for convenience.
|
3
8
|
#
|
4
9
|
# @loco_example Basic Usage
|
5
|
-
# =
|
6
|
-
# %span
|
10
|
+
# = daisy_tip "Helpful information" do
|
11
|
+
# %span Need help?
|
12
|
+
#
|
13
|
+
# = daisy_tip "Delete this item", css: "tooltip-error" do
|
14
|
+
# = hero_icon("trash", css: "size-5 text-error")
|
15
|
+
#
|
16
|
+
# @loco_example Positioned Tips
|
17
|
+
# = daisy_tip "Opens settings menu", css: "tooltip-left" do
|
18
|
+
# = daisy_button(title: "Settings", icon: "cog-6-tooth")
|
19
|
+
#
|
20
|
+
# = daisy_tip "View user profile", css: "tooltip-bottom tooltip-info" do
|
21
|
+
# = daisy_avatar(src: image_path("avatars/user.jpg"))
|
22
|
+
#
|
23
|
+
# @loco_example Component Integration
|
24
|
+
# = daisy_button(title: "Save Changes",
|
25
|
+
# css: "btn-primary",
|
26
|
+
# tip: "Save your current progress")
|
27
|
+
#
|
28
|
+
# = daisy_chat do |chat|
|
29
|
+
# - chat.with_avatar(css: "tooltip-left tooltip-info",
|
30
|
+
# tip: "Online",
|
31
|
+
# src: image_path("avatars/user.jpg"))
|
32
|
+
# - chat.with_bubble do
|
33
|
+
# Hello!
|
7
34
|
#
|
8
35
|
class Daisy::Feedback::TooltipComponent < LocoMotion::BaseComponent
|
9
36
|
|
10
37
|
#
|
11
|
-
#
|
38
|
+
# Creates a new Tooltip component.
|
39
|
+
#
|
40
|
+
# @param args [Array] If provided, the first argument is used as the `tip`
|
41
|
+
# text.
|
42
|
+
# @param kws [Hash] Keyword arguments for customizing the tooltip.
|
12
43
|
#
|
13
|
-
# @
|
14
|
-
#
|
44
|
+
# @option kws tip [String] The text to display in the tooltip. Can be
|
45
|
+
# passed as the first positional argument or as a keyword argument.
|
15
46
|
#
|
16
|
-
# @option kws
|
17
|
-
#
|
47
|
+
# @option kws css [String] Additional CSS classes for styling. Common
|
48
|
+
# options include:
|
49
|
+
# - Position modifiers: `tooltip-top`, `tooltip-bottom`,
|
50
|
+
# `tooltip-left`, `tooltip-right`
|
51
|
+
# - Colors: `tooltip-primary`, `tooltip-secondary`, `tooltip-accent`,
|
52
|
+
# `tooltip-info`, `tooltip-success`, `tooltip-warning`, `tooltip-error`
|
53
|
+
# - Open state: `tooltip-open`
|
18
54
|
#
|
19
55
|
def initialize(*args, **kws, &block)
|
20
56
|
super
|
@@ -24,7 +60,7 @@ class Daisy::Feedback::TooltipComponent < LocoMotion::BaseComponent
|
|
24
60
|
end
|
25
61
|
|
26
62
|
#
|
27
|
-
# Sets up the
|
63
|
+
# Sets up the component's CSS and HTML attributes.
|
28
64
|
#
|
29
65
|
def before_render
|
30
66
|
add_css(:component, "tooltip")
|
@@ -32,7 +68,7 @@ class Daisy::Feedback::TooltipComponent < LocoMotion::BaseComponent
|
|
32
68
|
end
|
33
69
|
|
34
70
|
#
|
35
|
-
# Renders the component and
|
71
|
+
# Renders the component and its content (inline).
|
36
72
|
#
|
37
73
|
def call
|
38
74
|
part(:component) { content }
|
@@ -1,9 +1,57 @@
|
|
1
|
+
#
|
2
|
+
# The ArtboardComponent provides a fixed-size container that mimics mobile
|
3
|
+
# device screens. It's particularly useful for:
|
4
|
+
# - Prototyping mobile interfaces.
|
5
|
+
# - Displaying responsive design examples.
|
6
|
+
# - Creating device-specific mockups.
|
7
|
+
#
|
8
|
+
# The component includes preset sizes for common mobile devices and supports
|
9
|
+
# both portrait and landscape orientations.
|
10
|
+
#
|
11
|
+
# @loco_example Portrait Mode
|
12
|
+
# = daisy_artboard(css: "phone-4") do
|
13
|
+
# = daisy_hero do
|
14
|
+
# iPhone 13 (375×812)
|
15
|
+
#
|
16
|
+
# @loco_example Landscape Mode
|
17
|
+
# = daisy_artboard(css: "phone-4 artboard-horizontal") do
|
18
|
+
# = daisy_hero do
|
19
|
+
# iPhone 13 (812×375)
|
20
|
+
#
|
21
|
+
# @loco_example Custom Demo Style
|
22
|
+
# = daisy_artboard(css: "phone-1 artboard-demo") do
|
23
|
+
# iPhone SE (320×568)
|
24
|
+
#
|
1
25
|
class Daisy::Layout::ArtboardComponent < LocoMotion::BaseComponent
|
2
26
|
|
27
|
+
#
|
28
|
+
# Creates a new Artboard component.
|
29
|
+
#
|
30
|
+
# @param args [Array] Positional arguments passed to the parent class.
|
31
|
+
# @param kws [Hash] Keyword arguments for customizing the artboard.
|
32
|
+
#
|
33
|
+
# @option kws css [String] Additional CSS classes for styling. Common
|
34
|
+
# options include:
|
35
|
+
# - Device sizes: `phone-1` (320×568), `phone-2` (375×667),
|
36
|
+
# `phone-3` (414×736), `phone-4` (375×812), `phone-5` (414×896),
|
37
|
+
# `phone-6` (320×1024)
|
38
|
+
# - Orientation: `artboard-horizontal` for landscape mode
|
39
|
+
# - Demo style: `artboard-demo` for visible borders and background
|
40
|
+
#
|
41
|
+
def initialize(*args, **kws, &block)
|
42
|
+
super
|
43
|
+
end
|
44
|
+
|
45
|
+
#
|
46
|
+
# Sets up the component's CSS classes.
|
47
|
+
#
|
3
48
|
def before_render
|
4
49
|
add_css(:component, "artboard")
|
5
50
|
end
|
6
51
|
|
52
|
+
#
|
53
|
+
# Renders the component and its content.
|
54
|
+
#
|
7
55
|
def call
|
8
56
|
part(:component) { content }
|
9
57
|
end
|
@@ -1,29 +1,69 @@
|
|
1
1
|
#
|
2
|
-
# The
|
3
|
-
#
|
2
|
+
# The DividerComponent creates a visual separator between content sections,
|
3
|
+
# either horizontally or vertically. It can include optional text or content
|
4
|
+
# in the center and supports various colors to match your theme.
|
4
5
|
#
|
5
|
-
#
|
6
|
+
# Common use cases include:
|
7
|
+
# - Separating sections of a page.
|
8
|
+
# - Creating visual breaks between cards or content blocks.
|
9
|
+
# - Providing alternative options with "OR" text.
|
10
|
+
# - Organizing form sections.
|
11
|
+
#
|
12
|
+
# @loco_example Basic Dividers
|
6
13
|
# = daisy_divider
|
7
14
|
#
|
8
|
-
# @loco_example With Text
|
9
15
|
# = daisy_divider do
|
10
|
-
#
|
16
|
+
# OR
|
17
|
+
#
|
18
|
+
# @loco_example Vertical Dividers
|
19
|
+
# .flex.grow
|
20
|
+
# = daisy_card(css: "h-48") do
|
21
|
+
# Left Content
|
22
|
+
#
|
23
|
+
# = daisy_divider(css: "divider-horizontal") do
|
24
|
+
# OR
|
25
|
+
#
|
26
|
+
# = daisy_card(css: "h-48") do
|
27
|
+
# Right Content
|
28
|
+
#
|
29
|
+
# @loco_example Colored Dividers
|
30
|
+
# = daisy_divider(css: "divider-primary") do
|
31
|
+
# Primary
|
32
|
+
#
|
33
|
+
# = daisy_divider(css: "divider-accent") do
|
34
|
+
# Accent
|
11
35
|
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
# Accent Divider
|
36
|
+
# = daisy_divider(css: "divider-success") do
|
37
|
+
# Success
|
15
38
|
#
|
16
39
|
class Daisy::Layout::DividerComponent < LocoMotion::BaseComponent
|
17
40
|
|
18
41
|
#
|
19
|
-
#
|
42
|
+
# Creates a new Divider component.
|
43
|
+
#
|
44
|
+
# @param args [Array] Positional arguments passed to the parent class.
|
45
|
+
# @param kws [Hash] Keyword arguments for customizing the divider.
|
46
|
+
#
|
47
|
+
# @option kws css [String] Additional CSS classes for styling. Common
|
48
|
+
# options include:
|
49
|
+
# - Orientation: `divider-horizontal` for vertical divider
|
50
|
+
# - Colors: `divider-neutral`, `divider-primary`, `divider-secondary`,
|
51
|
+
# `divider-accent`, `divider-info`, `divider-success`,
|
52
|
+
# `divider-warning`, `divider-error`
|
53
|
+
#
|
54
|
+
def initialize(*args, **kws, &block)
|
55
|
+
super
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# Sets up the component's CSS classes.
|
20
60
|
#
|
21
61
|
def before_render
|
22
62
|
add_css(:component, "divider")
|
23
63
|
end
|
24
64
|
|
25
65
|
#
|
26
|
-
#
|
66
|
+
# Renders the component and its content.
|
27
67
|
#
|
28
68
|
def call
|
29
69
|
part(:component) { content }
|
@@ -1,23 +1,60 @@
|
|
1
1
|
#
|
2
|
-
# The DrawerComponent
|
2
|
+
# The DrawerComponent provides a sliding sidebar panel that can be toggled
|
3
|
+
# open and closed. It's commonly used for:
|
4
|
+
# - Navigation menus
|
5
|
+
# - Filter panels
|
6
|
+
# - Additional information panels
|
7
|
+
# - Mobile-friendly navigation
|
3
8
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# @part content_wrapper [LocoMotion::BaseComponent] The wrapper for the page
|
7
|
-
# content.
|
8
|
-
# @part overlay [LocoMotion::BaseComponent] The overlay that covers the page
|
9
|
-
# when the sidebar is open.
|
9
|
+
# The drawer includes an overlay that covers the main content when open and
|
10
|
+
# can be configured to slide in from either the left or right side.
|
10
11
|
#
|
11
|
-
# @
|
12
|
-
#
|
12
|
+
# @part input [LocoMotion::BaseComponent] The input checkbox that
|
13
|
+
# toggles the sidebar visibility.
|
13
14
|
#
|
14
|
-
# @
|
15
|
+
# @part content_wrapper [LocoMotion::BaseComponent] The wrapper for the main
|
16
|
+
# page content that remains visible when the drawer is closed.
|
17
|
+
#
|
18
|
+
# @part overlay [LocoMotion::BaseComponent] The semi-transparent
|
19
|
+
# overlay that covers the main content when the drawer is open. Clicking it
|
20
|
+
# closes the drawer.
|
21
|
+
#
|
22
|
+
# @slot sidebar [Daisy::Layout::DrawerSidebarComponent] The sidebar
|
23
|
+
# panel that slides in when the drawer is opened. Contains the overlay
|
24
|
+
# within itself.
|
25
|
+
#
|
26
|
+
# @loco_example Basic Left Drawer
|
15
27
|
# = daisy_drawer do |drawer|
|
16
28
|
# - drawer.with_sidebar do
|
17
29
|
# .bg-base-100.p-4.w-40
|
18
|
-
#
|
30
|
+
# Menu Items
|
31
|
+
#
|
32
|
+
# = daisy_button(tag_name: "label",
|
33
|
+
# css: "btn btn-primary",
|
34
|
+
# title: "Open Menu",
|
35
|
+
# html: { for: drawer.id })
|
36
|
+
#
|
37
|
+
# @loco_example Right Drawer
|
38
|
+
# = daisy_drawer(css: "drawer-end") do |drawer|
|
39
|
+
# - drawer.with_sidebar do
|
40
|
+
# .bg-base-100.p-4.w-40
|
41
|
+
# Filter Options
|
42
|
+
#
|
43
|
+
# = daisy_button(tag_name: "label",
|
44
|
+
# css: "btn btn-secondary",
|
45
|
+
# title: "Show Filters",
|
46
|
+
# html: { for: drawer.id })
|
19
47
|
#
|
20
|
-
#
|
48
|
+
# @loco_example Styled Drawer
|
49
|
+
# = daisy_drawer do |drawer|
|
50
|
+
# - drawer.with_sidebar do
|
51
|
+
# .bg-base-200.p-4.w-80.h-full
|
52
|
+
# .flex.justify-between.items-center.mb-4
|
53
|
+
# %h2.text-xl Settings
|
54
|
+
# = daisy_button(tag_name: "label",
|
55
|
+
# css: "btn btn-ghost btn-circle",
|
56
|
+
# icon: "x-mark",
|
57
|
+
# html: { for: drawer.id })
|
21
58
|
#
|
22
59
|
class Daisy::Layout::DrawerComponent < LocoMotion::BaseComponent
|
23
60
|
#
|
@@ -26,14 +63,14 @@ class Daisy::Layout::DrawerComponent < LocoMotion::BaseComponent
|
|
26
63
|
#
|
27
64
|
class Daisy::Layout::DrawerSidebarComponent < LocoMotion::BaseComponent
|
28
65
|
#
|
29
|
-
#
|
66
|
+
# Sets up the component's CSS classes.
|
30
67
|
#
|
31
68
|
def before_render
|
32
69
|
add_css(:component, "drawer-side")
|
33
70
|
end
|
34
71
|
|
35
72
|
#
|
36
|
-
#
|
73
|
+
# Renders the sidebar, the overlay, and its content.
|
37
74
|
#
|
38
75
|
def call
|
39
76
|
part(:component) do
|
@@ -55,10 +92,18 @@ class Daisy::Layout::DrawerComponent < LocoMotion::BaseComponent
|
|
55
92
|
attr_reader :id
|
56
93
|
|
57
94
|
#
|
58
|
-
#
|
95
|
+
# Creates a new Drawer component.
|
96
|
+
#
|
97
|
+
# @param kws [Hash] Keyword arguments for customizing the drawer.
|
98
|
+
#
|
99
|
+
# @option kws id [String] The ID of the drawer. Defaults to a random UUID.
|
100
|
+
# This is used to connect the toggle button with the drawer.
|
59
101
|
#
|
60
|
-
# @
|
61
|
-
#
|
102
|
+
# @option kws css [String] Additional CSS classes for styling. Common
|
103
|
+
# options include:
|
104
|
+
# - Position: `drawer-end` to slide from right instead of left
|
105
|
+
# - Responsive: `lg:drawer-open` to keep drawer open on large screens
|
106
|
+
# - Z-index: `z-[100]` to control stacking order
|
62
107
|
#
|
63
108
|
def initialize(**kws)
|
64
109
|
super
|