shadcn_phlexcomponents 0.1.17 → 0.1.19
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 +321 -23
- data/app/javascript/controllers/accordion_controller.js +1 -0
- data/app/javascript/controllers/alert_dialog_controller.js +1 -0
- data/app/javascript/controllers/avatar_controller.js +1 -0
- data/app/javascript/controllers/checkbox_controller.js +1 -0
- data/app/javascript/controllers/collapsible_controller.js +1 -0
- data/app/javascript/controllers/combobox_controller.js +1 -1
- data/app/javascript/controllers/command_controller.js +1 -0
- data/app/javascript/controllers/date_picker_controller.js +21 -5
- data/app/javascript/controllers/date_range_picker_controller.js +1 -0
- data/app/javascript/controllers/dialog_controller.js +1 -0
- data/app/javascript/controllers/dropdown_menu_controller.js +1 -0
- data/app/javascript/controllers/dropdown_menu_sub_controller.js +1 -0
- data/app/javascript/controllers/form_field_controller.js +1 -0
- data/app/javascript/controllers/hover_card_controller.js +1 -0
- data/app/javascript/controllers/loading_button_controller.js +1 -0
- data/app/javascript/controllers/popover_controller.js +1 -0
- data/app/javascript/controllers/progress_controller.js +1 -0
- data/app/javascript/controllers/radio_group_controller.js +1 -0
- data/app/javascript/controllers/select_controller.js +1 -0
- data/app/javascript/controllers/slider_controller.js +1 -0
- data/app/javascript/controllers/switch_controller.js +1 -0
- data/app/javascript/controllers/tabs_controller.js +1 -0
- data/app/javascript/controllers/theme_switcher_controller.js +1 -0
- data/app/javascript/controllers/toast_container_controller.js +1 -0
- data/app/javascript/controllers/toast_controller.js +1 -0
- data/app/javascript/controllers/toggle_controller.js +1 -0
- data/app/javascript/controllers/toggle_group_controller.js +1 -0
- data/app/javascript/controllers/tooltip_controller.js +2 -1
- data/app/javascript/shadcn_phlexcomponents.js +27 -60
- data/app/javascript/utils/command.js +0 -2
- data/app/javascript/utils/floating_ui.js +10 -17
- data/app/stylesheets/date_picker.css +1 -1
- data/app/stylesheets/shadcn_phlexcomponents.css +173 -0
- data/app/typescript/controllers/accordion_controller.ts +2 -0
- data/app/typescript/controllers/alert_dialog_controller.ts +2 -0
- data/app/typescript/controllers/avatar_controller.ts +2 -0
- data/app/typescript/controllers/checkbox_controller.ts +2 -0
- data/app/typescript/controllers/collapsible_controller.ts +2 -0
- data/app/typescript/controllers/combobox_controller.ts +2 -1
- data/app/typescript/controllers/command_controller.ts +2 -0
- data/app/typescript/controllers/date_picker_controller.ts +27 -7
- data/app/typescript/controllers/date_range_picker_controller.ts +2 -0
- data/app/typescript/controllers/dialog_controller.ts +2 -0
- data/app/typescript/controllers/dropdown_menu_controller.ts +2 -0
- data/app/typescript/controllers/dropdown_menu_sub_controller.ts +2 -0
- data/app/typescript/controllers/form_field_controller.ts +2 -0
- data/app/typescript/controllers/hover_card_controller.ts +2 -0
- data/app/typescript/controllers/loading_button_controller.ts +2 -0
- data/app/typescript/controllers/popover_controller.ts +2 -0
- data/app/typescript/controllers/progress_controller.ts +2 -0
- data/app/typescript/controllers/radio_group_controller.ts +2 -0
- data/app/typescript/controllers/select_controller.ts +2 -0
- data/app/typescript/controllers/slider_controller.ts +2 -0
- data/app/typescript/controllers/switch_controller.ts +2 -0
- data/app/typescript/controllers/tabs_controller.ts +2 -0
- data/app/typescript/controllers/theme_switcher_controller.ts +2 -0
- data/app/typescript/controllers/toast_container_controller.ts +2 -0
- data/app/typescript/controllers/toast_controller.ts +2 -0
- data/app/typescript/controllers/toggle_controller.ts +2 -0
- data/app/typescript/controllers/toggle_group_controller.ts +2 -0
- data/app/typescript/controllers/tooltip_controller.ts +3 -1
- data/app/typescript/shadcn_phlexcomponents.ts +27 -61
- data/app/typescript/utils/command.ts +0 -2
- data/app/typescript/utils/floating_ui.ts +11 -20
- data/app/typescript/utils/index.ts +1 -1
- data/lib/install/upgrade_shadcn_phlexcomponents.rb +28 -0
- data/lib/shadcn_phlexcomponents/components/accordion.rb +56 -13
- data/lib/shadcn_phlexcomponents/components/alert.rb +35 -16
- data/lib/shadcn_phlexcomponents/components/alert_dialog.rb +58 -18
- data/lib/shadcn_phlexcomponents/components/aspect_ratio.rb +33 -2
- data/lib/shadcn_phlexcomponents/components/avatar.rb +24 -7
- data/lib/shadcn_phlexcomponents/components/badge.rb +23 -18
- data/lib/shadcn_phlexcomponents/components/base.rb +2 -2
- data/lib/shadcn_phlexcomponents/components/breadcrumb.rb +46 -6
- data/lib/shadcn_phlexcomponents/components/button.rb +32 -27
- data/lib/shadcn_phlexcomponents/components/card.rb +59 -10
- data/lib/shadcn_phlexcomponents/components/checkbox.rb +51 -30
- data/lib/shadcn_phlexcomponents/components/checkbox_group.rb +24 -4
- data/lib/shadcn_phlexcomponents/components/combobox.rb +224 -81
- data/lib/shadcn_phlexcomponents/components/command.rb +167 -63
- data/lib/shadcn_phlexcomponents/components/date_picker.rb +140 -48
- data/lib/shadcn_phlexcomponents/components/date_range_picker.rb +26 -44
- data/lib/shadcn_phlexcomponents/components/dialog.rb +86 -32
- data/lib/shadcn_phlexcomponents/components/dropdown_menu.rb +74 -25
- data/lib/shadcn_phlexcomponents/components/dropdown_menu_sub.rb +52 -24
- data/lib/shadcn_phlexcomponents/components/form/form_checkbox.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_checkbox_group.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_combobox.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_date_picker.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_date_range_picker.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_error.rb +8 -1
- data/lib/shadcn_phlexcomponents/components/form/form_helpers.rb +3 -2
- data/lib/shadcn_phlexcomponents/components/form/form_hint.rb +8 -1
- data/lib/shadcn_phlexcomponents/components/form/form_input.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_radio_group.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_select.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_slider.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_switch.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form/form_textarea.rb +1 -1
- data/lib/shadcn_phlexcomponents/components/form.rb +22 -6
- data/lib/shadcn_phlexcomponents/components/hover_card.rb +48 -18
- data/lib/shadcn_phlexcomponents/components/input.rb +13 -8
- data/lib/shadcn_phlexcomponents/components/label.rb +9 -4
- data/lib/shadcn_phlexcomponents/components/link.rb +8 -1
- data/lib/shadcn_phlexcomponents/components/pagination.rb +34 -6
- data/lib/shadcn_phlexcomponents/components/popover.rb +43 -13
- data/lib/shadcn_phlexcomponents/components/progress.rb +37 -6
- data/lib/shadcn_phlexcomponents/components/radio_group.rb +41 -15
- data/lib/shadcn_phlexcomponents/components/select.rb +99 -42
- data/lib/shadcn_phlexcomponents/components/separator.rb +9 -4
- data/lib/shadcn_phlexcomponents/components/sheet.rb +94 -28
- data/lib/shadcn_phlexcomponents/components/skeleton.rb +8 -1
- data/lib/shadcn_phlexcomponents/components/switch.rb +45 -17
- data/lib/shadcn_phlexcomponents/components/table.rb +84 -17
- data/lib/shadcn_phlexcomponents/components/tabs.rb +36 -12
- data/lib/shadcn_phlexcomponents/components/textarea.rb +12 -7
- data/lib/shadcn_phlexcomponents/components/toast.rb +46 -20
- data/lib/shadcn_phlexcomponents/components/toast_container.rb +19 -14
- data/lib/shadcn_phlexcomponents/components/toggle.rb +29 -24
- data/lib/shadcn_phlexcomponents/components/tooltip.rb +49 -14
- data/lib/shadcn_phlexcomponents/configuration.rb +46 -0
- data/lib/shadcn_phlexcomponents/initializers/shadcn_phlexcomponents.rb +28 -0
- data/lib/shadcn_phlexcomponents/version.rb +1 -1
- data/lib/shadcn_phlexcomponents.rb +12 -1
- data/lib/tasks/upgrade.rake +10 -0
- metadata +16 -14
- data/app/typescript/controllers/sidebar_controller.ts +0 -39
- data/app/typescript/controllers/sidebar_trigger_controller.ts +0 -21
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
module ShadcnPhlexcomponents
|
4
4
|
class Combobox < Base
|
5
|
-
class_variants(
|
5
|
+
class_variants(
|
6
|
+
**(
|
7
|
+
ShadcnPhlexcomponents.configuration.combobox&.dig(:root) ||
|
8
|
+
{
|
9
|
+
base: "w-full",
|
10
|
+
}
|
11
|
+
),
|
12
|
+
)
|
6
13
|
|
7
14
|
def initialize(
|
8
15
|
id: nil,
|
@@ -48,8 +55,8 @@ module ShadcnPhlexcomponents
|
|
48
55
|
search_error_text: @search_error_text,
|
49
56
|
search_empty_text: @search_empty_text,
|
50
57
|
search_placeholder_text: @search_placeholder_text,
|
51
|
-
aria_id: @aria_id,
|
52
|
-
**attributes,
|
58
|
+
aria_id: @aria_id,
|
59
|
+
**attributes,
|
53
60
|
&
|
54
61
|
)
|
55
62
|
end
|
@@ -82,11 +89,11 @@ module ShadcnPhlexcomponents
|
|
82
89
|
)
|
83
90
|
|
84
91
|
ComboboxContent(
|
85
|
-
aria_id: @aria_id,
|
86
|
-
include_blank: @include_blank,
|
87
|
-
search_error_text: @search_error_text,
|
92
|
+
aria_id: @aria_id,
|
93
|
+
include_blank: @include_blank,
|
94
|
+
search_error_text: @search_error_text,
|
88
95
|
search_empty_text: @search_empty_text,
|
89
|
-
search_placeholder_text: @search_placeholder_text
|
96
|
+
search_placeholder_text: @search_placeholder_text,
|
90
97
|
) do
|
91
98
|
collection.each do |item|
|
92
99
|
value = item.public_send(value_method)
|
@@ -124,15 +131,20 @@ module ShadcnPhlexcomponents
|
|
124
131
|
|
125
132
|
class ComboboxTrigger < Base
|
126
133
|
class_variants(
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
134
|
+
**(
|
135
|
+
ShadcnPhlexcomponents.configuration.combobox&.dig(:trigger) ||
|
136
|
+
{
|
137
|
+
base: <<~HEREDOC,
|
138
|
+
border-input [&_svg:not([class*='text-'])]:text-muted-foreground
|
139
|
+
focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40
|
140
|
+
aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex items-center
|
141
|
+
justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs
|
142
|
+
transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50
|
143
|
+
h-9 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4
|
144
|
+
data-[placeholder]:data-[has-value=false]:text-muted-foreground w-full disabled:dark:hover:bg-input/30
|
145
|
+
HEREDOC
|
146
|
+
}
|
147
|
+
),
|
136
148
|
)
|
137
149
|
|
138
150
|
def initialize(id: nil, value: nil, placeholder: nil, aria_id: nil, **attributes)
|
@@ -145,9 +157,7 @@ module ShadcnPhlexcomponents
|
|
145
157
|
|
146
158
|
def view_template
|
147
159
|
button(**@attributes) do
|
148
|
-
|
149
|
-
@value || @placeholder
|
150
|
-
end
|
160
|
+
ComboboxTriggerText(value: @value, placeholder: @placeholder)
|
151
161
|
|
152
162
|
icon("chevron-down", class: "size-4 opacity-50 text-foreground")
|
153
163
|
end
|
@@ -178,21 +188,26 @@ module ShadcnPhlexcomponents
|
|
178
188
|
|
179
189
|
class ComboboxContent < Base
|
180
190
|
class_variants(
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
191
|
+
**(
|
192
|
+
ShadcnPhlexcomponents.configuration.combobox&.dig(:content) ||
|
193
|
+
{
|
194
|
+
base: <<~HEREDOC,
|
195
|
+
bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out
|
196
|
+
data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95
|
197
|
+
data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2
|
198
|
+
data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50
|
199
|
+
min-w-[8rem] origin-(--radix-popper-transform-origin)
|
200
|
+
rounded-md border shadow-md pointer-events-auto outline-none
|
201
|
+
HEREDOC
|
202
|
+
}
|
203
|
+
),
|
189
204
|
)
|
190
205
|
|
191
206
|
def initialize(
|
192
|
-
include_blank: false,
|
193
|
-
side: :bottom,
|
194
|
-
align: :center,
|
195
|
-
aria_id: nil,
|
207
|
+
include_blank: false,
|
208
|
+
side: :bottom,
|
209
|
+
align: :center,
|
210
|
+
aria_id: nil,
|
196
211
|
search_error_text: nil,
|
197
212
|
search_empty_text: nil,
|
198
213
|
search_placeholder_text: nil,
|
@@ -209,16 +224,12 @@ module ShadcnPhlexcomponents
|
|
209
224
|
end
|
210
225
|
|
211
226
|
def view_template(&)
|
212
|
-
|
213
|
-
style: { display: "none" },
|
214
|
-
class: "fixed top-0 left-0 w-max z-50",
|
215
|
-
data: { combobox_target: "contentContainer" },
|
216
|
-
) do
|
227
|
+
ComboboxContentContainer do
|
217
228
|
div(**@attributes) do
|
218
229
|
template do
|
219
230
|
ComboboxGroup do
|
220
231
|
ComboboxLabel { "" }
|
221
|
-
end
|
232
|
+
end
|
222
233
|
end
|
223
234
|
|
224
235
|
label(
|
@@ -227,33 +238,12 @@ module ShadcnPhlexcomponents
|
|
227
238
|
for: "#{@aria_id}-search",
|
228
239
|
) { @search_placeholder_text }
|
229
240
|
|
230
|
-
|
241
|
+
ComboboxSearchInputContainer do
|
231
242
|
icon("search", class: "size-4 shrink-0 opacity-50")
|
232
|
-
|
233
|
-
input(
|
234
|
-
class: "placeholder:text-muted-foreground flex w-full rounded-md bg-transparent py-3 text-sm
|
235
|
-
outline-hidden disabled:cursor-not-allowed disabled:opacity-50 h-9",
|
236
|
-
id: "#{@aria_id}-search",
|
237
|
-
placeholder: @search_placeholder_text,
|
238
|
-
type: :text,
|
239
|
-
autocomplete: "off",
|
240
|
-
autocorrect: "off",
|
241
|
-
role: "combobox",
|
242
|
-
spellcheck: "false",
|
243
|
-
aria: {
|
244
|
-
autocomplete: "list",
|
245
|
-
expanded: "false",
|
246
|
-
controls: "#{@aria_id}-list",
|
247
|
-
labelledby: "#{@aria_id}-search-label",
|
248
|
-
},
|
249
|
-
data: {
|
250
|
-
combobox_target: "searchInput",
|
251
|
-
action: "keydown->combobox#inputKeydown input->combobox#search",
|
252
|
-
},
|
253
|
-
)
|
243
|
+
ComboboxSearchInput(aria_id: @aria_id, search_placeholder_text: @search_placeholder_text)
|
254
244
|
end
|
255
245
|
|
256
|
-
|
246
|
+
ComboboxListContainer do
|
257
247
|
ComboboxText(target: "empty") { @search_empty_text }
|
258
248
|
ComboboxText(target: "error") { @search_error_text }
|
259
249
|
ComboboxText(target: "loading") do
|
@@ -303,13 +293,14 @@ module ShadcnPhlexcomponents
|
|
303
293
|
|
304
294
|
class ComboboxLabel < Base
|
305
295
|
class_variants(
|
306
|
-
|
296
|
+
**(
|
297
|
+
ShadcnPhlexcomponents.configuration.combobox&.dig(:label) ||
|
298
|
+
{
|
299
|
+
base: "text-muted-foreground px-2 py-1.5 text-xs",
|
300
|
+
}
|
301
|
+
),
|
307
302
|
)
|
308
303
|
|
309
|
-
def initialize(**attributes)
|
310
|
-
super(**attributes)
|
311
|
-
end
|
312
|
-
|
313
304
|
def view_template(&)
|
314
305
|
div(**@attributes, &)
|
315
306
|
end
|
@@ -317,13 +308,18 @@ module ShadcnPhlexcomponents
|
|
317
308
|
|
318
309
|
class ComboboxItem < Base
|
319
310
|
class_variants(
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
311
|
+
**(
|
312
|
+
ShadcnPhlexcomponents.configuration.combobox&.dig(:item) ||
|
313
|
+
{
|
314
|
+
base: <<~HEREDOC,
|
315
|
+
data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground
|
316
|
+
relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm
|
317
|
+
outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50
|
318
|
+
[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4
|
319
|
+
*:[span]:last:items-center *:[span]:last:gap-2 group/item
|
320
|
+
HEREDOC
|
321
|
+
}
|
322
|
+
),
|
327
323
|
)
|
328
324
|
|
329
325
|
def initialize(value: nil, disabled: false, aria_id: nil, **attributes)
|
@@ -373,10 +369,6 @@ module ShadcnPhlexcomponents
|
|
373
369
|
super(**attributes)
|
374
370
|
end
|
375
371
|
|
376
|
-
def view_template(&)
|
377
|
-
div(**@attributes, &)
|
378
|
-
end
|
379
|
-
|
380
372
|
def default_attributes
|
381
373
|
{
|
382
374
|
role: "group",
|
@@ -388,11 +380,22 @@ module ShadcnPhlexcomponents
|
|
388
380
|
},
|
389
381
|
}
|
390
382
|
end
|
383
|
+
|
384
|
+
def view_template(&)
|
385
|
+
div(**@attributes, &)
|
386
|
+
end
|
391
387
|
end
|
392
388
|
|
393
389
|
class ComboboxText < Base
|
394
|
-
class_variants(
|
395
|
-
|
390
|
+
class_variants(
|
391
|
+
**(
|
392
|
+
ShadcnPhlexcomponents.configuration.combobox&.dig(:text) ||
|
393
|
+
{
|
394
|
+
base: "py-6 text-center text-sm hidden",
|
395
|
+
}
|
396
|
+
),
|
397
|
+
)
|
398
|
+
|
396
399
|
def initialize(target:, **attributes)
|
397
400
|
@target = target
|
398
401
|
super(**attributes)
|
@@ -411,14 +414,154 @@ module ShadcnPhlexcomponents
|
|
411
414
|
end
|
412
415
|
|
413
416
|
class ComboboxSeparator < Base
|
414
|
-
class_variants(
|
417
|
+
class_variants(
|
418
|
+
**(
|
419
|
+
ShadcnPhlexcomponents.configuration.combobox&.dig(:separator) ||
|
420
|
+
{
|
421
|
+
base: "bg-border pointer-events-none -mx-1 my-1 h-px",
|
422
|
+
}
|
423
|
+
),
|
424
|
+
)
|
425
|
+
|
426
|
+
def default_attributes
|
427
|
+
{ aria: { hidden: "true" } }
|
428
|
+
end
|
415
429
|
|
416
430
|
def view_template(&)
|
417
431
|
div(**@attributes, &)
|
418
432
|
end
|
433
|
+
end
|
434
|
+
|
435
|
+
class ComboboxTriggerText < Base
|
436
|
+
class_variants(
|
437
|
+
**(
|
438
|
+
ShadcnPhlexcomponents.configuration.combobox&.dig(:trigger_text) ||
|
439
|
+
{
|
440
|
+
base: "pointer-events-none line-clamp-1 flex items-center gap-2",
|
441
|
+
}
|
442
|
+
),
|
443
|
+
)
|
444
|
+
|
445
|
+
def initialize(value: nil, placeholder: nil, **attributes)
|
446
|
+
@value = value
|
447
|
+
@placeholder = placeholder
|
448
|
+
super(**attributes)
|
449
|
+
end
|
419
450
|
|
420
451
|
def default_attributes
|
421
|
-
{
|
452
|
+
{ data: { combobox_target: "triggerText" } }
|
453
|
+
end
|
454
|
+
|
455
|
+
def view_template(&)
|
456
|
+
span(**@attributes) do
|
457
|
+
@value || @placeholder
|
458
|
+
end
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
class ComboboxContentContainer < Base
|
463
|
+
class_variants(
|
464
|
+
**(
|
465
|
+
ShadcnPhlexcomponents.configuration.combobox&.dig(:content_container) ||
|
466
|
+
{
|
467
|
+
base: "fixed top-0 left-0 w-max z-50",
|
468
|
+
}
|
469
|
+
),
|
470
|
+
)
|
471
|
+
|
472
|
+
def default_attributes
|
473
|
+
{
|
474
|
+
style: { display: "none" },
|
475
|
+
data: { combobox_target: "contentContainer" },
|
476
|
+
}
|
477
|
+
end
|
478
|
+
|
479
|
+
def view_template(&)
|
480
|
+
div(**@attributes, &)
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
484
|
+
class ComboboxSearchInputContainer < Base
|
485
|
+
class_variants(
|
486
|
+
**(
|
487
|
+
ShadcnPhlexcomponents.configuration.combobox&.dig(:search_input_container) ||
|
488
|
+
{
|
489
|
+
base: "flex h-9 items-center gap-2 border-b px-3",
|
490
|
+
}
|
491
|
+
),
|
492
|
+
)
|
493
|
+
|
494
|
+
def view_template(&)
|
495
|
+
div(**@attributes, &)
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
class ComboboxSearchInput < Base
|
500
|
+
class_variants(
|
501
|
+
**(
|
502
|
+
ShadcnPhlexcomponents.configuration.combobox&.dig(:search_input) ||
|
503
|
+
{
|
504
|
+
base: "placeholder:text-muted-foreground flex w-full rounded-md bg-transparent py-3 text-sm
|
505
|
+
outline-hidden disabled:cursor-not-allowed disabled:opacity-50 h-9",
|
506
|
+
}
|
507
|
+
),
|
508
|
+
)
|
509
|
+
|
510
|
+
def initialize(aria_id: nil, search_placeholder_text: nil, **attributes)
|
511
|
+
@aria_id = aria_id
|
512
|
+
@search_placeholder_text = search_placeholder_text
|
513
|
+
super(**attributes)
|
514
|
+
end
|
515
|
+
|
516
|
+
def default_attributes
|
517
|
+
{
|
518
|
+
id: "#{@aria_id}-search",
|
519
|
+
placeholder: @search_placeholder_text,
|
520
|
+
type: :text,
|
521
|
+
autocomplete: "off",
|
522
|
+
autocorrect: "off",
|
523
|
+
role: "combobox",
|
524
|
+
spellcheck: "false",
|
525
|
+
aria: {
|
526
|
+
autocomplete: "list",
|
527
|
+
expanded: "false",
|
528
|
+
controls: "#{@aria_id}-list",
|
529
|
+
labelledby: "#{@aria_id}-search-label",
|
530
|
+
},
|
531
|
+
data: {
|
532
|
+
combobox_target: "searchInput",
|
533
|
+
action: "keydown->combobox#inputKeydown input->combobox#search",
|
534
|
+
},
|
535
|
+
}
|
536
|
+
end
|
537
|
+
|
538
|
+
def view_template
|
539
|
+
input(**@attributes)
|
540
|
+
end
|
541
|
+
end
|
542
|
+
|
543
|
+
class ComboboxListContainer < Base
|
544
|
+
class_variants(
|
545
|
+
**(
|
546
|
+
ShadcnPhlexcomponents.configuration.combobox&.dig(:list_container) ||
|
547
|
+
{
|
548
|
+
base: "p-1 max-h-80 overflow-y-auto",
|
549
|
+
}
|
550
|
+
),
|
551
|
+
)
|
552
|
+
|
553
|
+
def initialize(aria_id: nil, search_placeholder_text: nil, **attributes)
|
554
|
+
@aria_id = aria_id
|
555
|
+
@search_placeholder_text = search_placeholder_text
|
556
|
+
super(**attributes)
|
557
|
+
end
|
558
|
+
|
559
|
+
def default_attributes
|
560
|
+
{ data: { combobox_target: "listContainer" } }
|
561
|
+
end
|
562
|
+
|
563
|
+
def view_template(&)
|
564
|
+
div(**@attributes, &)
|
422
565
|
end
|
423
566
|
end
|
424
567
|
end
|