ariadne_view_components 0.0.80.3 → 0.0.81

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/app/assets/javascripts/ariadne_view_components.js +14 -14
  4. data/app/assets/javascripts/ariadne_view_components.js.br +0 -0
  5. data/app/assets/javascripts/ariadne_view_components.js.gz +0 -0
  6. data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
  7. data/app/assets/stylesheets/ariadne_view_components.css +1 -1
  8. data/app/assets/stylesheets/ariadne_view_components.css.br +0 -0
  9. data/app/assets/stylesheets/ariadne_view_components.css.gz +0 -0
  10. data/app/components/ariadne/base_component.rb +5 -1
  11. data/app/components/ariadne/form/checkbox/component.html.erb +21 -5
  12. data/app/components/ariadne/form/checkbox/component.rb +36 -0
  13. data/app/components/ariadne/form/text_field/component.rb +26 -23
  14. data/app/components/ariadne/ui/badge/component.rb +12 -17
  15. data/app/components/ariadne/ui/button/component.rb +1 -0
  16. data/app/components/ariadne/ui/combobox/component.html.erb +5 -17
  17. data/app/components/ariadne/ui/combobox/component.rb +8 -28
  18. data/app/components/ariadne/ui/combobox/component.ts +24 -39
  19. data/app/components/ariadne/ui/list/component.html.erb +28 -4
  20. data/app/components/ariadne/ui/list/component.rb +104 -1
  21. data/app/components/ariadne/ui/list/component.ts +57 -0
  22. data/app/components/ariadne/ui/popover/component.html.erb +4 -4
  23. data/app/components/ariadne/ui/popover/component.rb +3 -1
  24. data/app/components/ariadne/ui/popover/component.ts +1 -1
  25. data/app/components/ariadne/ui/typography/component.rb +14 -0
  26. data/app/frontend/ariadne/stimulus_app.ts +2 -2
  27. data/app/frontend/controllers/{autosubmittable_controller.ts → form_autosubmit_controller.ts} +1 -2
  28. data/app/lib/ariadne/view_component/style_variants.rb +50 -0
  29. data/lib/ariadne/view_components/version.rb +1 -1
  30. metadata +4 -9
  31. data/app/components/ariadne/ui/combobox/item/component.html.erb +0 -9
  32. data/app/components/ariadne/ui/combobox/item/component.rb +0 -61
  33. data/app/components/ariadne/ui/combobox/option/component.html.erb +0 -11
  34. data/app/components/ariadne/ui/combobox/option/component.rb +0 -44
  35. data/app/components/ariadne/ui/list/item/component.html.erb +0 -16
  36. data/app/components/ariadne/ui/list/item/component.rb +0 -17
@@ -1,13 +1,14 @@
1
1
  import {type Placement, autoUpdate, computePosition, flip, offset, shift, size} from '@floating-ui/dom'
2
+ import DetailsMenuElement from '@github/details-menu-element'
2
3
  import {controllerFactory} from '@utils/createController'
3
4
  import {useClickOutside, useMutation} from 'stimulus-use'
4
5
 
5
6
  export default class ComboboxController extends controllerFactory<HTMLDetailsElement>()({
6
7
  targets: {
7
- anchor: null,
8
- options: null,
9
- popover: null,
10
- searchInput: HTMLInputElement,
8
+ wrapper: HTMLDetailsElement,
9
+ button: HTMLElement,
10
+ popover: DetailsMenuElement,
11
+ options: HTMLDivElement,
11
12
  },
12
13
  values: {
13
14
  clamped: Boolean,
@@ -15,35 +16,8 @@ export default class ComboboxController extends controllerFactory<HTMLDetailsEle
15
16
  },
16
17
  }) {
17
18
  private changedIds = new Set<string>()
18
- private clickHandlers: Array<() => void> = []
19
- labels: Array<{el: HTMLLabelElement; searchString: string}>
20
19
  unsubAutoUpdate: (() => void) | undefined
21
20
 
22
- private setupClickHandlers() {
23
- const cb = () => this.toggle()
24
-
25
- for (const fn of this.clickHandlers) {
26
- fn()
27
- }
28
- this.clickHandlers = []
29
-
30
- for (const el of this.anchorTarget.querySelectorAll('button, [tabindex]:not([tabindex="-1"])')) {
31
- el.addEventListener('click', cb)
32
- this.clickHandlers.push(() => el.removeEventListener('click', cb))
33
- }
34
- }
35
-
36
- checkboxClicked(e: Event) {
37
- const target = e.target as HTMLInputElement
38
- const value = target.value
39
- if (this.changedIds.has(value)) {
40
- this.changedIds.delete(value)
41
- } else {
42
- this.changedIds.add(value)
43
- }
44
- this.dispatch('clicked', {detail: value})
45
- }
46
-
47
21
  clickOutside() {
48
22
  this.element.open = false
49
23
  this.setupAutoUpdate()
@@ -51,7 +25,6 @@ export default class ComboboxController extends controllerFactory<HTMLDetailsEle
51
25
  }
52
26
 
53
27
  close() {
54
- if (this.hasSearchInputTarget) this.searchInputTarget.value = ''
55
28
  if (this.changedIds.size > 0) {
56
29
  this.dispatch('changed')
57
30
  this.changedIds.clear()
@@ -62,13 +35,28 @@ export default class ComboboxController extends controllerFactory<HTMLDetailsEle
62
35
  useClickOutside(this)
63
36
  useMutation(this, {childList: true, subtree: true})
64
37
  this.setupAutoUpdate()
65
- this.setupClickHandlers()
38
+ this.setupForm()
66
39
  }
67
40
 
68
41
  disconnect() {
69
42
  this.unsubAutoUpdate?.()
70
43
  }
71
44
 
45
+ setupForm(): void {
46
+ // https://github.com/github/details-menu-element?tab=readme-ov-file#markup
47
+ for (const checkbox of this.popoverTarget.querySelectorAll('input[type="checkbox"]')) {
48
+ checkbox.addEventListener('change', (e: {target: HTMLInputElement}) => {
49
+ const value = e.target as HTMLInputElement
50
+ if (this.changedIds.has(value)) {
51
+ this.changedIds.delete(value)
52
+ } else {
53
+ this.changedIds.add(value)
54
+ }
55
+ this.dispatch('clicked', {detail: value})
56
+ })
57
+ }
58
+ }
59
+
72
60
  setupAutoUpdate(): void {
73
61
  if (!this.element.open) {
74
62
  this.unsubAutoUpdate?.()
@@ -77,19 +65,16 @@ export default class ComboboxController extends controllerFactory<HTMLDetailsEle
77
65
 
78
66
  const updatePopoverPosition = (): void => {
79
67
  const options = this.optionsTarget
80
- const searchInput = this.hasSearchInputTarget ? this.searchInputTarget : null
81
68
  const shouldClamp = this.clampedValue
82
69
 
83
- void computePosition(this.anchorTarget, this.popoverTarget, {
70
+ void computePosition(this.buttonTarget, this.popoverTarget, {
84
71
  middleware: [
85
72
  offset(6),
86
73
  flip(),
87
74
  shift({padding: 6}),
88
75
  size({
89
76
  apply({availableHeight}) {
90
- const inputHeight = searchInput ? searchInput.getBoundingClientRect().height : 0
91
-
92
- let maxHeight = availableHeight - inputHeight - 6
77
+ let maxHeight = availableHeight - 6
93
78
  if (shouldClamp && maxHeight > 400) maxHeight = 400
94
79
 
95
80
  Object.assign(options.style, {
@@ -109,7 +94,7 @@ export default class ComboboxController extends controllerFactory<HTMLDetailsEle
109
94
  }
110
95
 
111
96
  updatePopoverPosition()
112
- this.unsubAutoUpdate = autoUpdate(this.anchorTarget, this.popoverTarget, updatePopoverPosition)
97
+ this.unsubAutoUpdate = autoUpdate(this.buttonTarget, this.popoverTarget, updatePopoverPosition)
113
98
  }
114
99
 
115
100
  toggle(): void {
@@ -1,6 +1,30 @@
1
-
2
- <ol class="ariadne-divide-y ariadne-divide-zinc-100 dark:ariadne-divide-zinc-800">
1
+ <div class="<%= html_attrs[:class] %>" <%= html_attributes %>>
2
+ <% if filter_field? %>
3
+ <div class="ariadne-pb-1.5 ariadne-px-1">
4
+ <%= render filter_field %>
5
+ </div>
6
+ <% end %>
7
+ <div class="<%= style(:items) %>">
8
+ <% links.each do |link| %>
9
+ <div class="" role="menuitem"><%= link %></div>
10
+ <% end %>
11
+ <% checkboxes.each do |checkbox| %>
12
+ <div
13
+ class="<%= style(:item) %>"
14
+ data-<%= stimulus_name %>-target="searchString">
15
+ <div class="ariadne-truncate" role="menuitemcheckbox"><%= checkbox %></div>
16
+ </div>
17
+ <% end %>
3
18
  <% items.each do |item| %>
4
- <li><%= item %></li>
19
+ <div
20
+ <%= 'role="menuitem"' if as_menu %>
21
+ class="<%= style(:item) %>"
22
+ data-<%= stimulus_name %>-target="searchString">
23
+ <div class="relative ariadne-flex ariadne-cursor-default ariadne-select-none ariadne-items-center ariadne-rounded-sm ariadne-px-2 ariadne-py-1.5 ariadne-text-sm ariadne-outline-none ariadne-data-[disabled=true]:pointer-events-none ariadne-data-[selected=true]:bg-accent ariadne-data-[selected=true]:text-accent-foreground data-[disabled=true]:ariadne-opacity-50"><%= item %></div>
24
+ </div>
5
25
  <% end %>
6
- </ol>
26
+ <div class="ariadne-text-center ariadne-hidden" data-<%= stimulus_name %>-target="emptyRoot">
27
+ <span class="ariadne-py-3 ariadne-text-md ariadne-text-zinc-600 dark:ariadne-text-zinc-400"><%= @empty_placeholder %> </span>
28
+ </div>
29
+ </div>
30
+ </div>
@@ -5,7 +5,110 @@ module Ariadne
5
5
  module UI
6
6
  module List
7
7
  class Component < Ariadne::BaseComponent
8
- renders_many :items, Ariadne::UI::List::Item::Component
8
+ option :as_menu, default: proc { false }
9
+
10
+ option :size, default: proc { :md }
11
+
12
+ renders_one :filter_field, lambda { |**options|
13
+ raise ArgumentError, "Must provide text for `empty_placeholder`" if options[:empty_placeholder].blank?
14
+
15
+ @empty_placeholder = options.delete(:empty_placeholder)
16
+
17
+ options.delete(:size)
18
+ options[:theme] = :nude
19
+ options[:width] = :full
20
+ options[:name] = "search"
21
+ options[:label] = ""
22
+
23
+ options[:html_attrs] ||= {}
24
+ options[:html_attrs].merge!({
25
+ autocomplete: "off",
26
+ autofocus: true,
27
+ type: "search",
28
+ data: {
29
+ "#{stimulus_name}-target": "input",
30
+ action: "#{stimulus_name}#handleInput",
31
+ },
32
+ })
33
+
34
+ Ariadne::Form::TextField::Component.new(**options)
35
+ }
36
+
37
+ renders_many :checkboxes, Ariadne::Form::Checkbox::Component
38
+ renders_many :radio_buttons, Ariadne::Form::RadioButton::Component
39
+ renders_many :links, lambda { |**options|
40
+ options[:theme] = :nude
41
+ options[:"data-#{stimulus_name}-target"] = "searchString"
42
+
43
+ options[:html_attrs] ||= {}
44
+ options[:html_attrs][:class] ||= ""
45
+ options[:html_attrs][:class] = "ariadne-truncate ariadne-flex ariadne-gap-0.5 ariadne-items-center ariadne-ps-2 ariadne-pe-1 ariadne-rounded !ariadne-ring-0 hover:ariadne-bg-zinc-100 hover:dark:ariadne-bg-zinc-800 focus-within:ariadne-bg-zinc-100 focus-within:dark:ariadne-bg-zinc-800 ariadne-cursor-pointer #{options[:html_attrs][:class]}"
46
+
47
+ Ariadne::UI::Link::Component.new(**options)
48
+ }
49
+
50
+ renders_many :items, BaseComponent::ACCEPT_ANYTHING
51
+
52
+ accepts_html_attributes do |html_attrs|
53
+ html_attrs[:class] = Ariadne::ViewComponents.tailwind_merger.merge([style, html_attrs[:class]].join(" "))
54
+ html_attrs[:data] = {
55
+ controller: stimulus_name,
56
+ }
57
+ end
58
+
59
+ style do
60
+ base do
61
+ [
62
+ "ariadne-overflow-y-auto",
63
+ ]
64
+ end
65
+
66
+ variants do
67
+ size do
68
+ sm { "ariadne-w-36" }
69
+ md { "ariadne-w-52" }
70
+ lg { "ariadne-w-96" }
71
+ full { "ariadne-w-full" }
72
+ end
73
+ end
74
+ end
75
+
76
+ style :items do
77
+ base do
78
+ [
79
+ "ariadne-flex",
80
+ "ariadne-flex-col",
81
+ "ariadne-grow",
82
+ ]
83
+ end
84
+ end
85
+
86
+ style :item do
87
+ base do
88
+ [
89
+ "ariadne-flex",
90
+ # "ariadne-gap-0.5",
91
+ "ariadne-items-center",
92
+ "ariadne-rounded",
93
+ "!ariadne-ring-0",
94
+ "hover:ariadne-bg-zinc-100",
95
+ "hover:dark:ariadne-bg-zinc-800",
96
+ "focus-within:ariadne-bg-zinc-100",
97
+ "focus-within:dark:ariadne-bg-zinc-800",
98
+ "ariadne-cursor-default",
99
+ "ariadne-select-none",
100
+ "ariadne-items-center",
101
+ "ariadne-rounded-sm",
102
+ "ariadne-px-2",
103
+ # "ariadne-py-1.5",
104
+ "ariadne-text-sm",
105
+ "ariadne-outline-none",
106
+ "ariadne-transition-colors",
107
+ "disabled:ariadne-pointer-events-none",
108
+ "disabled:ariadne-opacity-50",
109
+ ]
110
+ end
111
+ end
9
112
  end
10
113
  end
11
114
  end
@@ -0,0 +1,57 @@
1
+ import {controllerFactory} from '@utils/createController'
2
+ import {useIntersection} from 'stimulus-use'
3
+
4
+ export default class InputFilterController extends controllerFactory()({
5
+ targets: {
6
+ emptyRoot: null,
7
+ input: HTMLInputElement,
8
+ searchString: null,
9
+ },
10
+ }) {
11
+ private items: {el: HTMLElement; searchString: string}[]
12
+
13
+ private handleNewQuery(query: string) {
14
+ let foundSomething = false
15
+
16
+ for (const {el, searchString} of this.items) {
17
+ const contains = searchString.includes(query.trim().toLowerCase())
18
+
19
+ if (!foundSomething && contains) foundSomething = true
20
+
21
+ if (contains) {
22
+ el.classList.remove('ariadne-hidden')
23
+ } else {
24
+ el.classList.add('ariadne-hidden')
25
+ }
26
+ }
27
+
28
+ if (foundSomething) {
29
+ this.emptyRootTarget.classList.add('ariadne-hidden')
30
+ } else {
31
+ this.emptyRootTarget.classList.remove('ariadne-hidden')
32
+ }
33
+ }
34
+
35
+ connect() {
36
+ this.items = this.searchStringTargets.map((el: HTMLElement) => {
37
+ return {
38
+ el,
39
+ searchString: (el.textContent ?? '').trim().toLowerCase(),
40
+ }
41
+ })
42
+ useIntersection(this)
43
+ }
44
+
45
+ appear(entry, observer) {
46
+ this.reset()
47
+ }
48
+
49
+ handleInput() {
50
+ if (this.hasSearchStringTarget) this.handleNewQuery(this.inputTarget.value)
51
+ }
52
+
53
+ reset() {
54
+ this.handleNewQuery('')
55
+ if (this.hasInputTarget) this.inputTarget.value = ''
56
+ }
57
+ }
@@ -1,6 +1,6 @@
1
1
  <div data-controller="<%= @stimulus_controllers %>">
2
- <%= button %>
3
- <div class="<%= html_attrs[:class] %>" <%= html_attributes %>>
4
- <%= content %>
5
- </div>
2
+ <%= button %>
3
+ <div class="<%= html_attrs[:class] %>" <%= html_attributes %>>
4
+ <%= content %>
5
+ </div>
6
6
  </div>
@@ -28,7 +28,7 @@ module Ariadne
28
28
 
29
29
  options[:html_attrs][:data] ||= {}
30
30
  options[:html_attrs][:data] = {
31
- "#{stimulus_name}-target" => ["toggle", html_attrs.fetch(:data, {}).fetch(:target, nil)].compact.join(" "),
31
+ "#{stimulus_name}-target" => ["button", html_attrs.fetch(:data, {}).fetch(:target, nil)].compact.join(" "),
32
32
  }.merge(options[:html_attrs][:data])
33
33
 
34
34
  Ariadne::UI::Button::Component.new(**options)
@@ -38,6 +38,8 @@ module Ariadne
38
38
  html_attrs[:id] ||= target_id
39
39
  html_attrs[:popover] = ""
40
40
 
41
+ html_attrs[:class] = Ariadne::ViewComponents.tailwind_merger.merge([style, html_attrs[:class]].join(" "))
42
+
41
43
  # requires CSS Anchor Positioning
42
44
  # as a `style` to account for future feature where the popover can be moved
43
45
  # html_attrs[:style] = "inset: unset; top: anchor(--popover-#{target_id} bottom); right: anchor(--popover-#{target_id} left, -1rem);"
@@ -24,7 +24,7 @@ export default class PopoverController extends controllerFactory()({
24
24
  placement: this.placementValue,
25
25
  middleware: [offset(5), flip(), shift({padding: 5})],
26
26
  }).then(({x, y}) => {
27
- Object.assign(this.target.style, {
27
+ Object.assign(this.buttonTarget.style, {
28
28
  left: `${x}px`,
29
29
  top: `${y}px`,
30
30
  })
@@ -25,6 +25,8 @@ module Ariadne
25
25
  :h3
26
26
  when :ann
27
27
  :h4
28
+ when :label
29
+ :h5
28
30
  when :lede
29
31
  :p
30
32
  when :code
@@ -110,6 +112,18 @@ module Ariadne
110
112
  ]
111
113
  end
112
114
 
115
+ label do
116
+ [
117
+ "ariadne-justify-between",
118
+ "ariadne-whitespace-nowrap",
119
+ "ariadne-text-sm",
120
+ "ariadne-font-medium",
121
+ "ariadne-uppercase",
122
+ "ariadne-text-zinc-600",
123
+ "dark:ariadne-text-zinc-400",
124
+ ]
125
+ end
126
+
113
127
  code do
114
128
  [
115
129
  "ariadne-relative",
@@ -40,8 +40,8 @@ for (const [path, module] of Object.entries(controllerModules)) {
40
40
  const dirs = path.split('/')
41
41
 
42
42
  // Dropping ../controllers to end up
43
- // with something like "ariadne-component-name"
44
- const name = dirs.slice(2, dirs.length).join('-').replace('.ts', '').replaceAll('_', '-').toLocaleLowerCase()
43
+ // with something like "ariadne-controllername"
44
+ const name = dirs[dirs.length - 1].replace('_controller.ts', '').replaceAll('_', '-').toLocaleLowerCase()
45
45
 
46
46
  application.register(
47
47
  // @tag stimulus-id
@@ -2,8 +2,7 @@ import {Controller} from '@hotwired/stimulus'
2
2
 
3
3
  import {useDebounce} from 'stimulus-use'
4
4
 
5
- // can't use controllerFactory because it seems to conflict with `useDebounce`
6
- export default class AutoSubmittableController extends Controller<HTMLFormElement> {
5
+ export default class FormAutosubmitController extends Controller<HTMLFormElement> {
7
6
  static debounces = ['save']
8
7
  static targets = ['form']
9
8
  declare readonly formTarget: HTMLFormElement
@@ -11,6 +11,56 @@ module Ariadne
11
11
  @default_style_name ||= name.split("::")[-2].underscore.presence || "component"
12
12
  end
13
13
  end
14
+
15
+ extend ActiveSupport::Concern
16
+
17
+ class_methods do
18
+ def accepts_styles_for(*names, **defaults, &block)
19
+ names ||= []
20
+ names << default_style_name
21
+
22
+ names.each do |name|
23
+ style_accessors[name] = {}
24
+ end
25
+
26
+ method_name = :styles
27
+ ivar_name = :"@styles"
28
+
29
+ attr_reader(method_name)
30
+
31
+ mod = Module.new do
32
+ define_method(:initialize) do |**options|
33
+ value = options.delete(method_name)&.to_h || {}
34
+
35
+ super(**options)
36
+ instance_exec(value, &block) if block
37
+ instance_variable_set(ivar_name, value)
38
+ end
39
+ end
40
+
41
+ prepend(mod)
42
+ end
43
+
44
+ # use `accepts_styles` to allow end users to merge their own styles with Ariadne's provided ones
45
+ def accepts_styles(*names, **defaults, &block)
46
+ accepts_styles_for(*names, **defaults, &block)
47
+ end
48
+
49
+ def style_accessors
50
+ @style_accessors ||=
51
+ if superclass.respond_to?(:style_accessors)
52
+ superclass.style_accessors.deep_dup
53
+ else
54
+ {}
55
+ end
56
+ end
57
+ end
58
+
59
+ # merge Araidne style variants with user provided overrides
60
+ def merged_styles(name = self.class.default_style_name, **variants)
61
+ default_styles = self.class.style_config.compile(name.to_sym, **variants)
62
+ Ariadne::ViewComponents.tailwind_merger.merge([default_styles, styles.fetch(name, "")])
63
+ end
14
64
  end
15
65
  end
16
66
  end
@@ -3,6 +3,6 @@
3
3
  # :nocov:
4
4
  module Ariadne
5
5
  module ViewComponents
6
- VERSION = "0.0.80.3"
6
+ VERSION = "0.0.81"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ariadne_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.80.3
4
+ version: 0.0.81
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen J. Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-29 00:00:00.000000000 Z
11
+ date: 2024-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tailwind_merge
@@ -194,10 +194,6 @@ files:
194
194
  - app/components/ariadne/ui/combobox/component.html.erb
195
195
  - app/components/ariadne/ui/combobox/component.rb
196
196
  - app/components/ariadne/ui/combobox/component.ts
197
- - app/components/ariadne/ui/combobox/item/component.html.erb
198
- - app/components/ariadne/ui/combobox/item/component.rb
199
- - app/components/ariadne/ui/combobox/option/component.html.erb
200
- - app/components/ariadne/ui/combobox/option/component.rb
201
197
  - app/components/ariadne/ui/data_table/component.html.erb
202
198
  - app/components/ariadne/ui/data_table/component.rb
203
199
  - app/components/ariadne/ui/dialog/component.html.erb
@@ -213,8 +209,7 @@ files:
213
209
  - app/components/ariadne/ui/link/component.rb
214
210
  - app/components/ariadne/ui/list/component.html.erb
215
211
  - app/components/ariadne/ui/list/component.rb
216
- - app/components/ariadne/ui/list/item/component.html.erb
217
- - app/components/ariadne/ui/list/item/component.rb
212
+ - app/components/ariadne/ui/list/component.ts
218
213
  - app/components/ariadne/ui/overlay/component.html.erb
219
214
  - app/components/ariadne/ui/overlay/component.rb
220
215
  - app/components/ariadne/ui/overlay/component.ts
@@ -238,7 +233,7 @@ files:
238
233
  - app/frontend/ariadne/index.ts
239
234
  - app/frontend/ariadne/stimulus_app.ts
240
235
  - app/frontend/ariadne/theme.ts
241
- - app/frontend/controllers/autosubmittable_controller.ts
236
+ - app/frontend/controllers/form_autosubmit_controller.ts
242
237
  - app/frontend/entrypoints/application.ts
243
238
  - app/frontend/stylesheets/ariadne_view_components.css
244
239
  - app/frontend/stylesheets/scrollbar.css
@@ -1,9 +0,0 @@
1
- <% slot = capture do %>
2
- <span class="ariadne-truncate"><%= label %></span>
3
- <% end %>
4
-
5
- <%= content_tag(
6
- link? ? :a : :button,
7
- slot,
8
- html_attrs,
9
- ) %>
@@ -1,61 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- module Ariadne
5
- module UI
6
- module Combobox
7
- module Item
8
- class Component < Ariadne::BaseComponent
9
- option :label
10
- option :as, default: proc { :link } # :button
11
-
12
- accepts_html_attributes do |html_attrs|
13
- html_attrs[:class] = Ariadne::ViewComponents.tailwind_merger.merge([style(as:), html_attrs[:class]].join(" "))
14
-
15
- # html_attrs["data-input-filter-target"] = "searchString"
16
- if as == :link && !html_attrs[:target]
17
- html_attrs[:target] = "_top"
18
- end
19
- end
20
-
21
- def initialize(**options)
22
- super(**options)
23
- end
24
-
25
- style do
26
- base do
27
- [
28
- "ariadne-flex",
29
- "ariadne-gap-0.5",
30
- "ariadne-items-center",
31
- "ariadne-ps-2",
32
- "ariadne-pe-1",
33
- "ariadne-rounded",
34
- "!ariadne-ring-0",
35
- "hover:ariadne-bg-zinc-100",
36
- "hover:dark:ariadne-bg-zinc-800",
37
- "focus-within:ariadne-bg-zinc-100",
38
- "focus-within:dark:ariadne-bg-zinc-800",
39
- ]
40
- end
41
- variants do
42
- as do
43
- button do
44
- "ariadne-appearance-none ariadne-inline-flex ariadne-w-full"
45
- end
46
-
47
- link do
48
- "ariadne-cursor-pointer"
49
- end
50
- end
51
- end
52
- end
53
-
54
- def link?
55
- as == :link
56
- end
57
- end
58
- end
59
- end
60
- end
61
- end
@@ -1,11 +0,0 @@
1
- <label
2
- tabindex="0"
3
- role="menuitemcheckbox"
4
- class="<%= style %>">
5
- <span class="px-1"><%= option_component %></span>
6
- <span
7
- class="ariadne-truncate <%= text_content ? 'ariadne-px-1' : 'ariadne-inline-flex ariadne-items-center' %>"
8
- data-input-filter-target="searchString">
9
- <%= content %>
10
- </span>
11
- </label>
@@ -1,44 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- module Ariadne
5
- module UI
6
- module Combobox
7
- module Option
8
- class Component < Ariadne::BaseComponent
9
- option :as, default: proc { :link } # :button
10
-
11
- option :type, default: proc { :multiple }
12
- option :text_content, default: proc { true }
13
-
14
- accepts_html_attributes disabled: false,
15
- tabindex: -1,
16
- data: proc {
17
- { action: "#{Ariadne::UI::Combobox::Component.stimulus_name}#checkboxClicked" }
18
- }
19
-
20
- def option_component
21
- cmp = type == :multiple ? Ariadne::Form::Checkbox : Ariadne::Form::Radio
22
- render(cmp::Component.new(html_attrs:))
23
- end
24
-
25
- style do
26
- base do
27
- [
28
- "ariadne-flex",
29
- "ariadne-gap-0.5",
30
- "ariadne-items-center",
31
- "ariadne-rounded",
32
- "!ariadne-ring-0",
33
- "hover:ariadne-bg-zinc-100",
34
- "hover:dark:ariadne-bg-zinc-800",
35
- "focus-within:ariadne-bg-zinc-100",
36
- "focus-within:dark:ariadne-bg-zinc-800",
37
- ]
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end
44
- end
@@ -1,16 +0,0 @@
1
- <div class="ariadne-flex ariadne-gap-3 ariadne-items-center ariadne-py-2">
2
-
3
- <div class="ariadne-shrink-0">
4
- <%= leading_item if leading_item? %>
5
- </div>
6
- <div class="ariadne-overflow-hidden">
7
- <%= cell %>
8
- </div>
9
- <div class="ariadne-grow ariadne-flex ariadne-justify-end">
10
- <%= trailing_item if trailing_item? %>
11
- </div>
12
- <% if trailing_menu? %>
13
-
14
- <% end %>
15
-
16
- </div>