stimulus_plumbers_tailwind 0.4.0 → 0.4.3

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.
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "timeline/group"
4
+
5
+ module StimulusPlumbers
6
+ module Themes
7
+ module Tailwind
8
+ module Timeline
9
+ TRACK_VERTICAL = %w[flex flex-col gap-y-10].freeze
10
+ TRACK_HORIZONTAL = %w[flex].freeze
11
+
12
+ TRACK_LINE_VERTICAL = %w[absolute inset-y-0 start-3 w-px bg-(--sp-color-border)].freeze
13
+
14
+ ITEM_VERTICAL = %w[flex gap-x-4 items-start].freeze
15
+ ITEM_HORIZONTAL = %w[relative flex-1].freeze
16
+
17
+ ITEM_INDICATOR_DOT = %w[
18
+ mt-1 flex shrink-0 size-6 items-center justify-center rounded-full z-10
19
+ bg-(--sp-color-bg) ring-4 ring-(--sp-color-bg)
20
+ ].freeze
21
+ ITEM_INDICATOR_DOT_MARK = %w[size-3 rounded-full bg-(--sp-color-indicator)].freeze
22
+
23
+ ITEM_INDICATOR_ICON = %w[
24
+ mt-1 flex shrink-0 size-6 items-center justify-center rounded-full z-10
25
+ bg-(--sp-color-primary) text-(--sp-color-primary-fg)
26
+ ring-4 ring-(--sp-color-bg)
27
+ ].freeze
28
+
29
+ ITEM_INDICATOR_ICON_SLOT = %w[size-(--sp-icon-size-sm) stroke-current].freeze
30
+
31
+ ITEM_INDICATOR_DOT_HORIZONTAL = %w[
32
+ z-10 flex shrink-0 size-6 items-center justify-center rounded-full
33
+ bg-(--sp-color-bg) ring-4 ring-(--sp-color-bg)
34
+ ].freeze
35
+
36
+ ITEM_INDICATOR_ICON_HORIZONTAL = %w[
37
+ z-10 flex shrink-0 size-6 items-center justify-center rounded-full
38
+ bg-(--sp-color-primary) text-(--sp-color-primary-fg)
39
+ ring-4 ring-(--sp-color-bg)
40
+ ].freeze
41
+
42
+ ITEM_CONNECTOR_HORIZONTAL = %w[w-full h-px bg-(--sp-color-border) last:hidden].freeze
43
+ ITEM_CONTENT_HORIZONTAL = %w[mt-3 pe-2].freeze
44
+
45
+ ITEM_TIME = %w[mb-1 block text-sm leading-none text-(--sp-color-muted-fg)].freeze
46
+ ITEM_TIME_BADGE = %w[
47
+ mb-1 inline-block
48
+ bg-(--sp-color-bg-muted) border border-(--sp-color-border)
49
+ text-(--sp-color-fg) text-xs font-medium px-1.5 py-0.5 rounded
50
+ ].freeze
51
+ ITEM_TITLE = %w[mb-1 text-base font-semibold text-(--sp-color-fg)].freeze
52
+ ITEM_HEADING = %w[mb-1].freeze
53
+ ITEM_TRIGGER = %w[
54
+ w-full text-left text-base font-semibold
55
+ text-(--sp-color-fg)
56
+ hover:text-(--sp-color-primary)
57
+ focus-visible:outline-none focus-visible:ring-2
58
+ focus-visible:ring-(--sp-color-primary) focus-visible:rounded-sm
59
+ ].freeze
60
+ ITEM_DESCRIPTION = %w[text-sm text-(--sp-color-muted-fg)].freeze
61
+ ITEM_DETAIL = %w[mt-2 text-sm text-(--sp-color-muted-fg)].freeze
62
+ ITEM_ACTIONS = %w[mt-3 flex flex-wrap items-center gap-2].freeze
63
+
64
+ private
65
+
66
+ def timeline_classes(orientation: :vertical)
67
+ track = orientation.to_sym == :horizontal ? TRACK_HORIZONTAL : TRACK_VERTICAL
68
+ { classes: klasses(track) }
69
+ end
70
+
71
+ def timeline_item_classes(orientation: :vertical)
72
+ item = orientation.to_sym == :horizontal ? ITEM_HORIZONTAL : ITEM_VERTICAL
73
+ { classes: klasses(item) }
74
+ end
75
+
76
+ def timeline_item_indicator_classes(type: :dot, orientation: :vertical)
77
+ base = if orientation.to_sym == :horizontal
78
+ type.to_sym == :icon ? ITEM_INDICATOR_ICON_HORIZONTAL : ITEM_INDICATOR_DOT_HORIZONTAL
79
+ else
80
+ type.to_sym == :icon ? ITEM_INDICATOR_ICON : ITEM_INDICATOR_DOT
81
+ end
82
+ { classes: klasses(base) }
83
+ end
84
+
85
+ def timeline_item_time_classes(type: :default)
86
+ base = type.to_sym == :badge ? ITEM_TIME_BADGE : ITEM_TIME
87
+ { classes: klasses(base) }
88
+ end
89
+
90
+ def timeline_item_title_classes = { classes: klasses(ITEM_TITLE) }
91
+ def timeline_item_heading_classes = { classes: klasses(ITEM_HEADING) }
92
+ def timeline_item_trigger_classes = { classes: klasses(ITEM_TRIGGER) }
93
+ def timeline_item_description_classes = { classes: klasses(ITEM_DESCRIPTION) }
94
+ def timeline_item_detail_classes = { classes: klasses(ITEM_DETAIL) }
95
+ def timeline_item_actions_classes = { classes: klasses(ITEM_ACTIONS) }
96
+ def timeline_item_indicator_dot_classes = { classes: klasses(ITEM_INDICATOR_DOT_MARK) }
97
+ def timeline_item_connector_classes = { classes: klasses(ITEM_CONNECTOR_HORIZONTAL) }
98
+ def timeline_item_content_classes = { classes: klasses(ITEM_CONTENT_HORIZONTAL) }
99
+ def timeline_track_line_classes = { classes: klasses(TRACK_LINE_VERTICAL) }
100
+ def timeline_item_indicator_icon_slot_classes = { classes: klasses(ITEM_INDICATOR_ICON_SLOT) }
101
+ end
102
+ end
103
+ end
104
+ end
@@ -14,6 +14,7 @@ require_relative "tailwind/form/input"
14
14
  require_relative "tailwind/icon"
15
15
  require_relative "tailwind/layout"
16
16
  require_relative "tailwind/link"
17
+ require_relative "tailwind/timeline"
17
18
 
18
19
  module StimulusPlumbers
19
20
  module Themes
@@ -31,6 +32,8 @@ module StimulusPlumbers
31
32
  include Tailwind::Icon
32
33
  include Tailwind::Layout
33
34
  include Tailwind::Link
35
+ include Tailwind::Timeline
36
+ include Tailwind::Timeline::Group
34
37
 
35
38
  private
36
39
 
@@ -7,5 +7,9 @@ module StimulusPlumbersTailwind
7
7
  c.theme.register(:tailwind, StimulusPlumbers::Themes::TailwindTheme)
8
8
  end
9
9
  end
10
+
11
+ rake_tasks do
12
+ load File.join(__dir__, "../tasks/stimulus_plumbers_tailwind.rake")
13
+ end
10
14
  end
11
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StimulusPlumbersTailwind
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.3"
5
5
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :stimulus_plumbers_tailwind do
4
+ desc "Add @source directive for stimulus_plumbers_tailwind into Tailwind CSS entry file"
5
+ task install: :environment do
6
+ require "generators/stimulus_plumbers_tailwind/install/install_generator"
7
+ StimulusPlumbersTailwind::Generators::InstallGenerator.new(
8
+ [], {}, { destination_root: Rails.root.to_s }
9
+ ).invoke_all
10
+ end
11
+ end
12
+
13
+ Rake::Task["assets:precompile"].enhance(["stimulus_plumbers_tailwind:install"]) if Rake::Task.task_defined?("assets:precompile")
14
+
15
+ Rake::Task["tailwindcss:build"].enhance(["stimulus_plumbers_tailwind:install"]) if Rake::Task.task_defined?("tailwindcss:build")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stimulus_plumbers_tailwind
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Chang
@@ -33,6 +33,7 @@ files:
33
33
  - CHANGELOG.md
34
34
  - LICENSE-DEPENDENCIES
35
35
  - README.md
36
+ - lib/generators/stimulus_plumbers_tailwind/install/install_generator.rb
36
37
  - lib/stimulus_plumbers/themes/tailwind/avatar.rb
37
38
  - lib/stimulus_plumbers/themes/tailwind/button.rb
38
39
  - lib/stimulus_plumbers/themes/tailwind/button/group.rb
@@ -698,10 +699,13 @@ files:
698
699
  - lib/stimulus_plumbers/themes/tailwind/layout.rb
699
700
  - lib/stimulus_plumbers/themes/tailwind/link.rb
700
701
  - lib/stimulus_plumbers/themes/tailwind/list.rb
702
+ - lib/stimulus_plumbers/themes/tailwind/timeline.rb
703
+ - lib/stimulus_plumbers/themes/tailwind/timeline/group.rb
701
704
  - lib/stimulus_plumbers/themes/tailwind_theme.rb
702
705
  - lib/stimulus_plumbers_tailwind.rb
703
706
  - lib/stimulus_plumbers_tailwind/engine.rb
704
707
  - lib/stimulus_plumbers_tailwind/version.rb
708
+ - lib/tasks/stimulus_plumbers_tailwind.rake
705
709
  homepage: https://github.com/ryancyq/stimulus-plumbers
706
710
  licenses:
707
711
  - MIT