shadcn_phlexcomponents 0.1.0
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 +7 -0
- data/README.md +39 -0
- data/Rakefile +12 -0
- data/app/assets/tailwind/tailwindcss-animate.css +318 -0
- data/app/assets/tailwind/vanilla-calendar-pro.css +461 -0
- data/app/javascript/controllers/accordion_controller.js +133 -0
- data/app/javascript/controllers/alert_dialog_controller.js +157 -0
- data/app/javascript/controllers/avatar_controller.js +15 -0
- data/app/javascript/controllers/checkbox_controller.js +28 -0
- data/app/javascript/controllers/collapsible_controller.js +35 -0
- data/app/javascript/controllers/combobox_controller.js +291 -0
- data/app/javascript/controllers/datepicker_controller.js +47 -0
- data/app/javascript/controllers/dialog_controller.js +159 -0
- data/app/javascript/controllers/dropdown_menu_controller.js +193 -0
- data/app/javascript/controllers/hover_card_controller.js +135 -0
- data/app/javascript/controllers/loading_button_controller.js +15 -0
- data/app/javascript/controllers/popover_controller.js +124 -0
- data/app/javascript/controllers/progress_controller.js +14 -0
- data/app/javascript/controllers/radio_group_controller.js +90 -0
- data/app/javascript/controllers/select_controller.js +294 -0
- data/app/javascript/controllers/sheet_controller.js +159 -0
- data/app/javascript/controllers/sidebar_controller.js +36 -0
- data/app/javascript/controllers/sidebar_trigger_controller.js +15 -0
- data/app/javascript/controllers/switch_controller.js +24 -0
- data/app/javascript/controllers/tabs_controller.js +73 -0
- data/app/javascript/controllers/theme_switcher_controller.js +32 -0
- data/app/javascript/controllers/toast_container_controller.js +22 -0
- data/app/javascript/controllers/toast_controller.js +45 -0
- data/app/javascript/controllers/tooltip_controller.js +135 -0
- data/lib/components/accordion.rb +38 -0
- data/lib/components/accordion_content.rb +28 -0
- data/lib/components/accordion_item.rb +26 -0
- data/lib/components/accordion_trigger.rb +45 -0
- data/lib/components/alert.rb +40 -0
- data/lib/components/alert_description.rb +11 -0
- data/lib/components/alert_dialog.rb +60 -0
- data/lib/components/alert_dialog_action.rb +22 -0
- data/lib/components/alert_dialog_action_to.rb +37 -0
- data/lib/components/alert_dialog_cancel.rb +22 -0
- data/lib/components/alert_dialog_content.rb +40 -0
- data/lib/components/alert_dialog_description.rb +22 -0
- data/lib/components/alert_dialog_footer.rb +11 -0
- data/lib/components/alert_dialog_header.rb +11 -0
- data/lib/components/alert_dialog_title.rb +22 -0
- data/lib/components/alert_dialog_trigger.rb +50 -0
- data/lib/components/alert_title.rb +11 -0
- data/lib/components/aspect_ratio.rb +19 -0
- data/lib/components/avatar.rb +31 -0
- data/lib/components/avatar_fallback.rb +21 -0
- data/lib/components/avatar_image.rb +20 -0
- data/lib/components/badge.rb +36 -0
- data/lib/components/base.rb +108 -0
- data/lib/components/breadcrumb.rb +51 -0
- data/lib/components/breadcrumb_ellipsis.rb +23 -0
- data/lib/components/breadcrumb_item.rb +11 -0
- data/lib/components/breadcrumb_link.rb +7 -0
- data/lib/components/breadcrumb_page.rb +21 -0
- data/lib/components/breadcrumb_separator.rb +26 -0
- data/lib/components/button.rb +53 -0
- data/lib/components/card.rb +31 -0
- data/lib/components/card_content.rb +11 -0
- data/lib/components/card_description.rb +11 -0
- data/lib/components/card_footer.rb +11 -0
- data/lib/components/card_header.rb +11 -0
- data/lib/components/card_title.rb +11 -0
- data/lib/components/checkbox.rb +65 -0
- data/lib/components/checkbox_group.rb +48 -0
- data/lib/components/collapsible.rb +32 -0
- data/lib/components/collapsible_content.rb +25 -0
- data/lib/components/collapsible_trigger.rb +50 -0
- data/lib/components/datepicker.rb +38 -0
- data/lib/components/dialog.rb +52 -0
- data/lib/components/dialog_close.rb +42 -0
- data/lib/components/dialog_content.rb +54 -0
- data/lib/components/dialog_description.rb +22 -0
- data/lib/components/dialog_footer.rb +11 -0
- data/lib/components/dialog_header.rb +11 -0
- data/lib/components/dialog_title.rb +22 -0
- data/lib/components/dialog_trigger.rb +50 -0
- data/lib/components/dropdown_menu.rb +50 -0
- data/lib/components/dropdown_menu_content.rb +49 -0
- data/lib/components/dropdown_menu_item.rb +57 -0
- data/lib/components/dropdown_menu_item_to.rb +25 -0
- data/lib/components/dropdown_menu_label.rb +12 -0
- data/lib/components/dropdown_menu_separator.rb +20 -0
- data/lib/components/dropdown_menu_trigger.rb +58 -0
- data/lib/components/hover_card.rb +33 -0
- data/lib/components/hover_card_content.rb +36 -0
- data/lib/components/hover_card_trigger.rb +50 -0
- data/lib/components/input.rb +32 -0
- data/lib/components/label.rb +15 -0
- data/lib/components/link.rb +26 -0
- data/lib/components/loading_button.rb +21 -0
- data/lib/components/pagination.rb +38 -0
- data/lib/components/pagination_ellipsis.rb +24 -0
- data/lib/components/pagination_link.rb +34 -0
- data/lib/components/pagination_next.rb +32 -0
- data/lib/components/pagination_previous.rb +32 -0
- data/lib/components/popover.rb +35 -0
- data/lib/components/popover_content.rb +37 -0
- data/lib/components/popover_trigger.rb +52 -0
- data/lib/components/progress.rb +37 -0
- data/lib/components/radio_group.rb +62 -0
- data/lib/components/radio_group_item.rb +66 -0
- data/lib/components/select.rb +189 -0
- data/lib/components/select_content.rb +59 -0
- data/lib/components/select_group.rb +23 -0
- data/lib/components/select_item.rb +58 -0
- data/lib/components/select_label.rb +23 -0
- data/lib/components/select_trigger.rb +54 -0
- data/lib/components/separator.rb +29 -0
- data/lib/components/sheet.rb +53 -0
- data/lib/components/sheet_close.rb +42 -0
- data/lib/components/sheet_content.rb +67 -0
- data/lib/components/sheet_description.rb +22 -0
- data/lib/components/sheet_footer.rb +11 -0
- data/lib/components/sheet_header.rb +11 -0
- data/lib/components/sheet_title.rb +22 -0
- data/lib/components/sheet_trigger.rb +50 -0
- data/lib/components/sidebar.rb +103 -0
- data/lib/components/sidebar_container.rb +11 -0
- data/lib/components/sidebar_content.rb +11 -0
- data/lib/components/sidebar_footer.rb +11 -0
- data/lib/components/sidebar_group.rb +11 -0
- data/lib/components/sidebar_group_content.rb +11 -0
- data/lib/components/sidebar_group_label.rb +16 -0
- data/lib/components/sidebar_header.rb +11 -0
- data/lib/components/sidebar_inset.rb +15 -0
- data/lib/components/sidebar_menu.rb +11 -0
- data/lib/components/sidebar_menu_button.rb +61 -0
- data/lib/components/sidebar_menu_item.rb +9 -0
- data/lib/components/sidebar_menu_sub.rb +14 -0
- data/lib/components/sidebar_menu_sub_button.rb +48 -0
- data/lib/components/sidebar_menu_sub_item.rb +9 -0
- data/lib/components/sidebar_trigger.rb +40 -0
- data/lib/components/skeleton.rb +11 -0
- data/lib/components/switch.rb +65 -0
- data/lib/components/table.rb +73 -0
- data/lib/components/table_body.rb +11 -0
- data/lib/components/table_caption.rb +11 -0
- data/lib/components/table_cell.rb +11 -0
- data/lib/components/table_footer.rb +11 -0
- data/lib/components/table_head.rb +14 -0
- data/lib/components/table_header.rb +11 -0
- data/lib/components/table_row.rb +11 -0
- data/lib/components/tabs.rb +38 -0
- data/lib/components/tabs_content.rb +35 -0
- data/lib/components/tabs_list.rb +23 -0
- data/lib/components/tabs_trigger.rb +45 -0
- data/lib/components/textarea.rb +28 -0
- data/lib/components/theme_switcher.rb +21 -0
- data/lib/components/toast.rb +100 -0
- data/lib/components/toast_action.rb +38 -0
- data/lib/components/toast_action_to.rb +25 -0
- data/lib/components/toast_container.rb +44 -0
- data/lib/components/toast_content.rb +11 -0
- data/lib/components/toast_description.rb +11 -0
- data/lib/components/toast_title.rb +11 -0
- data/lib/components/tooltip.rb +34 -0
- data/lib/components/tooltip_content.rb +42 -0
- data/lib/components/tooltip_trigger.rb +50 -0
- data/lib/install/install_shadcn_phlexcomponents.rb +12 -0
- data/lib/shadcn_phlexcomponents/alias.rb +132 -0
- data/lib/shadcn_phlexcomponents/engine.rb +11 -0
- data/lib/shadcn_phlexcomponents/version.rb +5 -0
- data/lib/shadcn_phlexcomponents.rb +9 -0
- data/lib/tasks/install.rake +10 -0
- metadata +264 -0
@@ -0,0 +1,461 @@
|
|
1
|
+
/* Layout */
|
2
|
+
[data-vc='calendar'] {
|
3
|
+
@apply relative border box-border min-w-[272px] flex flex-col p-3 rounded-xl opacity-100 transition-opacity;
|
4
|
+
}
|
5
|
+
|
6
|
+
[data-vc='calendar']:focus-visible,
|
7
|
+
[data-vc='calendar'] button:focus-visible,
|
8
|
+
[data-vc='calendar'] [tabindex='0']:focus-visible {
|
9
|
+
@apply outline outline-1 -outline-offset-1 rounded-md;
|
10
|
+
}
|
11
|
+
|
12
|
+
[data-vc='calendar'][data-vc-type='multiple'] [data-vc='dates'] {
|
13
|
+
@apply grow-0;
|
14
|
+
}
|
15
|
+
|
16
|
+
[data-vc='calendar'][data-vc-calendar-hidden] {
|
17
|
+
@apply opacity-0 pointer-events-none [&_*]:!pointer-events-none;
|
18
|
+
}
|
19
|
+
|
20
|
+
[data-vc='calendar'][data-vc-input] {
|
21
|
+
@apply absolute;
|
22
|
+
}
|
23
|
+
|
24
|
+
[data-vc='calendar'][data-vc-input][data-vc-position='bottom'] {
|
25
|
+
@apply mt-1;
|
26
|
+
}
|
27
|
+
|
28
|
+
[data-vc='calendar'][data-vc-input][data-vc-position='top'] {
|
29
|
+
@apply -mt-1;
|
30
|
+
}
|
31
|
+
|
32
|
+
[data-vc='controls'] {
|
33
|
+
@apply absolute z-20 left-0 right-0 -top-1 flex justify-between items-center pt-5 px-4 pointer-events-none box-content;
|
34
|
+
}
|
35
|
+
|
36
|
+
[data-vc-arrow] {
|
37
|
+
@apply inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm;
|
38
|
+
@apply font-medium ring-offset-background transition-colors focus-visible:outline-none;
|
39
|
+
@apply focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none;
|
40
|
+
@apply disabled:opacity-50 h-7 w-7 p-0 opacity-50 hover:opacity-100 cursor-pointer pointer-events-auto;
|
41
|
+
}
|
42
|
+
|
43
|
+
[data-vc-arrow='prev']:before {
|
44
|
+
@apply bg-accent-foreground h-7 w-7;
|
45
|
+
mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-left-icon lucide-chevron-left"><path d="m15 18-6-6 6-6"/></svg>');
|
46
|
+
mask-repeat: no-repeat;
|
47
|
+
position: absolute;
|
48
|
+
content: '';
|
49
|
+
mask-size: auto 16px;
|
50
|
+
mask-position: center;
|
51
|
+
}
|
52
|
+
|
53
|
+
[data-vc-arrow='next']:before {
|
54
|
+
@apply bg-accent-foreground h-7 w-7;
|
55
|
+
mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right-icon lucide-chevron-right"><path d="m9 18 6-6-6-6"/></svg>');
|
56
|
+
mask-repeat: no-repeat;
|
57
|
+
position: absolute;
|
58
|
+
content: '';
|
59
|
+
mask-size: auto 16px;
|
60
|
+
mask-position: center;
|
61
|
+
}
|
62
|
+
|
63
|
+
[data-vc='grid'] {
|
64
|
+
@apply flex flex-wrap gap-7 grow;
|
65
|
+
}
|
66
|
+
|
67
|
+
[data-vc='grid'][data-vc-grid='hidden'] [data-vc='column'] {
|
68
|
+
@apply opacity-30 pointer-events-none;
|
69
|
+
}
|
70
|
+
|
71
|
+
[data-vc='grid'][data-vc-grid='hidden']
|
72
|
+
[data-vc='column'][data-vc-column='month'],
|
73
|
+
[data-vc='grid'][data-vc-grid='hidden']
|
74
|
+
[data-vc='column'][data-vc-column='year'] {
|
75
|
+
@apply opacity-100 pointer-events-auto;
|
76
|
+
}
|
77
|
+
|
78
|
+
[data-vc='column'] {
|
79
|
+
@apply min-w-[240px] flex flex-col grow;
|
80
|
+
}
|
81
|
+
|
82
|
+
[data-vc='header'] {
|
83
|
+
@apply relative flex items-center mb-3;
|
84
|
+
}
|
85
|
+
|
86
|
+
[data-vc-header='content'] {
|
87
|
+
@apply grid grid-flow-col auto-cols-max items-center justify-center px-4 whitespace-pre-wrap grow;
|
88
|
+
}
|
89
|
+
|
90
|
+
[data-vc='month'],
|
91
|
+
[data-vc='year'] {
|
92
|
+
@apply text-base font-bold cursor-pointer rounded p-1 border-0 bg-transparent disabled:pointer-events-none;
|
93
|
+
}
|
94
|
+
|
95
|
+
[data-vc='wrapper'] {
|
96
|
+
@apply flex grow;
|
97
|
+
}
|
98
|
+
|
99
|
+
[data-vc='content'] {
|
100
|
+
@apply flex flex-col grow;
|
101
|
+
}
|
102
|
+
|
103
|
+
[data-vc='months'] {
|
104
|
+
@apply grid gap-y-4 gap-x-1 grid-cols-4 items-center grow;
|
105
|
+
}
|
106
|
+
|
107
|
+
[data-vc='years'] {
|
108
|
+
@apply grid gap-y-4 gap-x-1 grid-cols-5 items-center grow;
|
109
|
+
}
|
110
|
+
|
111
|
+
[data-vc-months-month],
|
112
|
+
[data-vc-years-year] {
|
113
|
+
@apply flex items-center justify-center h-10 text-center text-xs font-semibold p-1 rounded-md border-0 break-all cursor-pointer disabled:pointer-events-none;
|
114
|
+
}
|
115
|
+
|
116
|
+
[data-vc-week='numbers'] {
|
117
|
+
@apply flex flex-col;
|
118
|
+
}
|
119
|
+
|
120
|
+
[data-vc-week-numbers='title'] {
|
121
|
+
@apply text-xs font-bold flex items-center justify-center mb-2;
|
122
|
+
}
|
123
|
+
|
124
|
+
[data-vc-week-numbers='content'] {
|
125
|
+
@apply grid grid-flow-row items-center justify-items-center gap-y-1;
|
126
|
+
}
|
127
|
+
|
128
|
+
[data-vc-week-number] {
|
129
|
+
@apply text-xs font-semibold w-full min-h-[1.875rem] min-w-[1.875rem] flex items-center justify-center cursor-pointer bg-transparent border-none p-0 m-0;
|
130
|
+
}
|
131
|
+
|
132
|
+
[data-vc='week'] {
|
133
|
+
@apply grid grid-cols-[repeat(7,_1fr)] justify-items-center mb-2;
|
134
|
+
}
|
135
|
+
|
136
|
+
[data-vc-week-day] {
|
137
|
+
@apply text-xs font-bold w-full min-w-[1.875rem] flex items-center justify-center bg-transparent border-none p-0 m-0;
|
138
|
+
}
|
139
|
+
|
140
|
+
button[data-vc-week-day] {
|
141
|
+
@apply cursor-pointer;
|
142
|
+
}
|
143
|
+
|
144
|
+
[data-vc='dates'] {
|
145
|
+
@apply grid grid-cols-[repeat(7,_1fr)] justify-items-center items-center grow pointer-events-none;
|
146
|
+
}
|
147
|
+
|
148
|
+
[data-vc='dates'][data-vc-dates-disabled] [data-vc-date-btn] {
|
149
|
+
@apply cursor-default;
|
150
|
+
}
|
151
|
+
|
152
|
+
[data-vc-date] {
|
153
|
+
@apply relative w-full flex items-center justify-center py-0.5 pointer-events-auto;
|
154
|
+
}
|
155
|
+
|
156
|
+
[data-vc-date][data-vc-date-disabled],
|
157
|
+
[data-vc-date][data-vc-date-disabled] [data-vc-date-btn],
|
158
|
+
[data-vc-date]:not(:has([data-vc-date-btn])) {
|
159
|
+
@apply pointer-events-none;
|
160
|
+
}
|
161
|
+
|
162
|
+
[data-vc-date][data-vc-date-hover] [data-vc-date-btn] {
|
163
|
+
@apply rounded-none;
|
164
|
+
}
|
165
|
+
|
166
|
+
[data-vc-date][data-vc-date-hover='first'] [data-vc-date-btn] {
|
167
|
+
@apply rounded-r-none rounded-l-md;
|
168
|
+
}
|
169
|
+
|
170
|
+
[data-vc-date][data-vc-date-hover='last'] [data-vc-date-btn] {
|
171
|
+
@apply rounded-l-none rounded-r-md;
|
172
|
+
}
|
173
|
+
|
174
|
+
[data-vc-date][data-vc-date-hover='first-and-last'] [data-vc-date-btn] {
|
175
|
+
@apply rounded-md;
|
176
|
+
}
|
177
|
+
|
178
|
+
[data-vc-date][data-vc-date-hover='first'][data-vc-date-selected]
|
179
|
+
[data-vc-date-btn] {
|
180
|
+
@apply rounded-l-md;
|
181
|
+
}
|
182
|
+
|
183
|
+
[data-vc-date][data-vc-date-hover='last'][data-vc-date-selected]
|
184
|
+
[data-vc-date-btn] {
|
185
|
+
@apply rounded-r-md;
|
186
|
+
}
|
187
|
+
|
188
|
+
[data-vc-date][data-vc-date-selected='first'] [data-vc-date-btn] {
|
189
|
+
@apply rounded-r-none rounded-l-md;
|
190
|
+
}
|
191
|
+
|
192
|
+
[data-vc-date][data-vc-date-selected='last'] [data-vc-date-btn] {
|
193
|
+
@apply rounded-l-none rounded-r-md;
|
194
|
+
}
|
195
|
+
|
196
|
+
[data-vc-date][data-vc-date-selected='first-and-last'] [data-vc-date-btn] {
|
197
|
+
@apply rounded-l-md rounded-r-md;
|
198
|
+
}
|
199
|
+
|
200
|
+
[data-vc-date][data-vc-date-selected='middle'] [data-vc-date-btn] {
|
201
|
+
@apply rounded-none;
|
202
|
+
}
|
203
|
+
|
204
|
+
[data-vc-date][data-vc-date-disabled]
|
205
|
+
+ [data-vc-date-selected]
|
206
|
+
[data-vc-date-btn],
|
207
|
+
[data-vc-date][data-vc-date-disabled]
|
208
|
+
+ [data-vc-date-hover]
|
209
|
+
[data-vc-date-btn] {
|
210
|
+
@apply rounded-l-md;
|
211
|
+
}
|
212
|
+
|
213
|
+
[data-vc-date][data-vc-date-hover]:has(+ [data-vc-date-disabled])
|
214
|
+
[data-vc-date-btn],
|
215
|
+
[data-vc-date][data-vc-date-selected]:has(+ [data-vc-date-disabled])
|
216
|
+
[data-vc-date-btn] {
|
217
|
+
@apply rounded-r-md;
|
218
|
+
}
|
219
|
+
|
220
|
+
[data-vc-date-btn]:focus-visible + [data-vc-date-popup],
|
221
|
+
[data-vc-date-btn]:hover + [data-vc-date-popup],
|
222
|
+
[data-vc-date-popup]:focus-visible,
|
223
|
+
[data-vc-date-popup]:hover {
|
224
|
+
@apply opacity-100 pointer-events-auto;
|
225
|
+
}
|
226
|
+
|
227
|
+
[data-vc-date-btn] {
|
228
|
+
@apply inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm;
|
229
|
+
@apply ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2;
|
230
|
+
@apply focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none;
|
231
|
+
@apply disabled:opacity-50 h-9 w-9 p-0 font-normal aria-selected:opacity-100 cursor-pointer;
|
232
|
+
}
|
233
|
+
|
234
|
+
[data-vc-date][data-vc-date-today] [data-vc-date-btn] {
|
235
|
+
@apply font-bold;
|
236
|
+
}
|
237
|
+
|
238
|
+
[data-vc-date-popup] {
|
239
|
+
@apply absolute z-20 -translate-x-1/2 min-w-20 max-w-36 py-1 px-2 text-xs font-normal rounded-md transition-opacity duration-75 opacity-0 pointer-events-none hover:opacity-100 hover:pointer-events-auto;
|
240
|
+
}
|
241
|
+
|
242
|
+
[data-vc-date-range-tooltip] {
|
243
|
+
@apply absolute z-30 max-w-36 py-1 px-2 text-xs font-normal rounded-md pointer-events-none -translate-x-1/2 -translate-y-full;
|
244
|
+
}
|
245
|
+
|
246
|
+
[data-vc-date-range-tooltip='hidden'] {
|
247
|
+
@apply opacity-0;
|
248
|
+
}
|
249
|
+
|
250
|
+
[data-vc-date-range-tooltip='visible'] {
|
251
|
+
@apply opacity-100;
|
252
|
+
}
|
253
|
+
|
254
|
+
[data-vc='time'] {
|
255
|
+
@apply grid grid-cols-[auto_1fr] gap-3 border-solid border-t border-b-0 border-l-0 border-r-0 pt-3 mt-3;
|
256
|
+
}
|
257
|
+
|
258
|
+
[data-vc-time='content'] {
|
259
|
+
@apply grid grid-flow-col items-center;
|
260
|
+
}
|
261
|
+
|
262
|
+
[data-vc-time-input='hour'] {
|
263
|
+
@apply relative w-7 mr-[0.35rem] after:content-[':'] after:block after:absolute after:-right-[5px] after:top-1/2 after:mt-[calc(-50%_+_1px)];
|
264
|
+
}
|
265
|
+
|
266
|
+
[data-vc-time-input='minute'] {
|
267
|
+
@apply w-7;
|
268
|
+
}
|
269
|
+
|
270
|
+
[data-vc-time-input='hour'] input,
|
271
|
+
[data-vc-time-input='minute'] input {
|
272
|
+
@apply box-border relative block text-lg leading-[1.125rem] font-semibold text-center w-full p-[0.125rem] m-0 border-0 rounded disabled:cursor-default disabled:hover:bg-transparent focus-visible:outline-1 focus-visible:outline;
|
273
|
+
}
|
274
|
+
|
275
|
+
[data-vc-time='keeping'] {
|
276
|
+
@apply ml-[1px] cursor-pointer text-[0.69rem] w-[22px] rounded mt-1 disabled:cursor-default disabled:hover:bg-transparent focus-visible:outline-1 focus-visible:outline bg-transparent border-0 p-0;
|
277
|
+
}
|
278
|
+
|
279
|
+
[data-vc-time='ranges'] {
|
280
|
+
@apply grid grid-flow-row;
|
281
|
+
}
|
282
|
+
|
283
|
+
[data-vc-time-range] {
|
284
|
+
@apply text-[0] relative z-10 before:left-0 after:right-0;
|
285
|
+
}
|
286
|
+
|
287
|
+
[data-vc-time-range]::before,
|
288
|
+
[data-vc-time-range]::after {
|
289
|
+
content: '';
|
290
|
+
transform: translateY(-50%);
|
291
|
+
@apply w-[1px] h-2 absolute z-10 pointer-events-none top-1/2;
|
292
|
+
}
|
293
|
+
|
294
|
+
[data-vc-time-range] input {
|
295
|
+
@apply w-full relative appearance-none h-5 cursor-pointer m-0 outline-0;
|
296
|
+
}
|
297
|
+
|
298
|
+
[data-vc-time-range] input::-webkit-slider-thumb {
|
299
|
+
@apply appearance-none -mt-2 relative z-20 box-border border border-solid h-4 w-3 shadow-none rounded cursor-pointer;
|
300
|
+
}
|
301
|
+
|
302
|
+
[data-vc-time-range] input::-moz-range-thumb {
|
303
|
+
@apply relative z-20 box-border border border-solid h-4 w-3 shadow-none rounded cursor-pointer;
|
304
|
+
}
|
305
|
+
|
306
|
+
[data-vc-time-range] input::-webkit-slider-runnable-track {
|
307
|
+
@apply box-border w-full h-[1px] mt-[1px] cursor-pointer shadow-none;
|
308
|
+
}
|
309
|
+
|
310
|
+
[data-vc-time-range] input::-moz-range-track {
|
311
|
+
@apply box-border w-full h-[1px] mt-[1px] cursor-pointer shadow-none;
|
312
|
+
}
|
313
|
+
|
314
|
+
/* Theme */
|
315
|
+
.vc {
|
316
|
+
@apply bg-popover text-popover-foreground;
|
317
|
+
}
|
318
|
+
|
319
|
+
.vc[data-vc-input] {
|
320
|
+
@apply shadow-[0_9px_20px_rgba(0,0,0,.1)];
|
321
|
+
}
|
322
|
+
|
323
|
+
.vc:focus-visible,
|
324
|
+
.vc button:focus-visible,
|
325
|
+
.vc [tabindex='0']:focus-visible {
|
326
|
+
@apply outline-orange-300;
|
327
|
+
}
|
328
|
+
|
329
|
+
.vc-arrow {
|
330
|
+
@apply border border-input hover:bg-accent hover:text-accent-foreground bg-transparent;
|
331
|
+
}
|
332
|
+
|
333
|
+
.vc-month,
|
334
|
+
.vc-year {
|
335
|
+
@apply inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium rounded-md transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 cursor-pointer text-sm hover:bg-accent hover:text-accent-foreground h-9 px-3;
|
336
|
+
}
|
337
|
+
|
338
|
+
.vc-months__month,
|
339
|
+
.vc-years__year {
|
340
|
+
@apply hover:bg-accent hover:text-accent-foreground disabled:opacity-80;
|
341
|
+
}
|
342
|
+
|
343
|
+
.vc-months__month[data-vc-months-month-selected],
|
344
|
+
.vc-years__year[data-vc-years-year-selected] {
|
345
|
+
@apply bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground;
|
346
|
+
}
|
347
|
+
|
348
|
+
.vc-week__day {
|
349
|
+
@apply text-muted-foreground font-normal;
|
350
|
+
}
|
351
|
+
|
352
|
+
.vc-date[data-vc-date-selected='middle'][data-vc-date-selected] .vc-date__btn {
|
353
|
+
@apply bg-primary/20 hover:bg-primary/20 text-accent-foreground;
|
354
|
+
}
|
355
|
+
|
356
|
+
.vc-date__btn {
|
357
|
+
@apply hover:bg-accent hover:text-accent-foreground;
|
358
|
+
}
|
359
|
+
|
360
|
+
.vc-date[data-vc-date-today] .vc-date__btn {
|
361
|
+
@apply bg-accent text-accent-foreground font-bold;
|
362
|
+
}
|
363
|
+
|
364
|
+
.vc-date[data-vc-date-today][data-vc-date-month='prev'] .vc-date__btn,
|
365
|
+
.vc-date[data-vc-date-today][data-vc-date-month='next'] .vc-date__btn {
|
366
|
+
@apply text-muted-foreground;
|
367
|
+
}
|
368
|
+
|
369
|
+
.vc-date[data-vc-date-month='prev'] .vc-date__btn,
|
370
|
+
.vc-date[data-vc-date-month='next'] .vc-date__btn {
|
371
|
+
@apply text-muted-foreground hover:bg-accent hover:text-accent-foreground;
|
372
|
+
}
|
373
|
+
|
374
|
+
.vc-date[data-vc-date-disabled] .vc-date__btn {
|
375
|
+
@apply text-muted-foreground opacity-60;
|
376
|
+
}
|
377
|
+
|
378
|
+
.vc-date[data-vc-date-hover] .vc-date__btn {
|
379
|
+
@apply bg-accent;
|
380
|
+
}
|
381
|
+
|
382
|
+
.vc-date[data-vc-date-selected] .vc-date__btn {
|
383
|
+
@apply bg-primary text-primary-foreground;
|
384
|
+
}
|
385
|
+
|
386
|
+
.vc-date[data-vc-date-hover='last'] .vc-date__btn,
|
387
|
+
.vc-date[data-vc-date-hover='first'] .vc-date__btn {
|
388
|
+
@apply bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground;
|
389
|
+
}
|
390
|
+
|
391
|
+
.vc-date__popup {
|
392
|
+
@apply text-white bg-slate-800 shadow-[inset_0_0_0_1px_rgb(255_255_255_/_0.05)];
|
393
|
+
}
|
394
|
+
|
395
|
+
.vc-date-range-tooltip {
|
396
|
+
@apply text-slate-400 bg-slate-800 shadow-[inset_0_0_0_1px_rgb(255_255_255_/_0.05)];
|
397
|
+
}
|
398
|
+
|
399
|
+
.vc-time {
|
400
|
+
@apply border-slate-800;
|
401
|
+
}
|
402
|
+
|
403
|
+
.vc-time__hour,
|
404
|
+
.vc-time__minute {
|
405
|
+
@apply after:text-white;
|
406
|
+
}
|
407
|
+
|
408
|
+
.vc-time__hour input,
|
409
|
+
.vc-time__minute input {
|
410
|
+
@apply text-white bg-slate-900 hover:bg-slate-700 focus-visible:outline-orange-300;
|
411
|
+
}
|
412
|
+
|
413
|
+
.vc-time__hour input[data-vc-input-focus],
|
414
|
+
.vc-time__minute input[data-vc-input-focus] {
|
415
|
+
@apply bg-slate-700;
|
416
|
+
}
|
417
|
+
|
418
|
+
.vc-time__keeping {
|
419
|
+
@apply text-slate-500 hover:bg-slate-700 hover:text-slate-400 focus-visible:outline-orange-300;
|
420
|
+
}
|
421
|
+
|
422
|
+
.vc-time__range input {
|
423
|
+
@apply bg-slate-900;
|
424
|
+
}
|
425
|
+
|
426
|
+
.vc-time__range::before,
|
427
|
+
.vc-time__range::after {
|
428
|
+
@apply bg-slate-600;
|
429
|
+
}
|
430
|
+
|
431
|
+
.vc-time__range:hover input::-webkit-slider-thumb {
|
432
|
+
@apply border-slate-400;
|
433
|
+
}
|
434
|
+
|
435
|
+
.vc-time__range:hover input::-moz-range-thumb {
|
436
|
+
@apply border-slate-400;
|
437
|
+
}
|
438
|
+
|
439
|
+
.vc-time__range input:focus-visible::-webkit-slider-thumb {
|
440
|
+
@apply border-orange-300;
|
441
|
+
}
|
442
|
+
|
443
|
+
.vc-time__range input:focus-visible::-moz-range-thumb {
|
444
|
+
@apply border-orange-300;
|
445
|
+
}
|
446
|
+
|
447
|
+
.vc-time__range input::-webkit-slider-thumb {
|
448
|
+
@apply border-slate-600 bg-slate-800;
|
449
|
+
}
|
450
|
+
|
451
|
+
.vc-time__range input::-moz-range-thumb {
|
452
|
+
@apply border-slate-600 bg-slate-800;
|
453
|
+
}
|
454
|
+
|
455
|
+
.vc-time__range input::-webkit-slider-runnable-track {
|
456
|
+
@apply bg-slate-600;
|
457
|
+
}
|
458
|
+
|
459
|
+
.vc-time__range input::-moz-range-track {
|
460
|
+
@apply bg-slate-600;
|
461
|
+
}
|
@@ -0,0 +1,133 @@
|
|
1
|
+
import { Controller } from '@hotwired/stimulus'
|
2
|
+
|
3
|
+
export default class extends Controller {
|
4
|
+
static targets = ['trigger', 'content', 'item']
|
5
|
+
|
6
|
+
connect() {
|
7
|
+
this.triggers = this.triggerTargets.filter((t) => !t.disabled)
|
8
|
+
this.multiple = this.element.dataset.multiple === 'true'
|
9
|
+
const value = JSON.parse(this.element.dataset.value)
|
10
|
+
|
11
|
+
this.itemTargets.forEach((i) => {
|
12
|
+
if (value.includes(i.dataset.value)) {
|
13
|
+
this.openItem(i)
|
14
|
+
} else {
|
15
|
+
this.closeItem(i)
|
16
|
+
}
|
17
|
+
})
|
18
|
+
|
19
|
+
setTimeout(() => {
|
20
|
+
this.contentTargets.forEach((c) => {
|
21
|
+
this.setContentHeight(c)
|
22
|
+
})
|
23
|
+
}, 200)
|
24
|
+
}
|
25
|
+
|
26
|
+
setContentHeight(element) {
|
27
|
+
const height = this.getContentHeight(element)
|
28
|
+
element.style.setProperty('--accordion-content-height', `${height}px`)
|
29
|
+
}
|
30
|
+
|
31
|
+
getContentHeight(element) {
|
32
|
+
// Store the original styles we need to modify
|
33
|
+
const originalStyles = {
|
34
|
+
display: element.style.display,
|
35
|
+
visibility: element.style.visibility,
|
36
|
+
position: element.style.position,
|
37
|
+
}
|
38
|
+
|
39
|
+
// Make the element visible but not displayed
|
40
|
+
element.style.display = 'block' // or whatever is appropriate (flex, inline, etc.)
|
41
|
+
element.style.visibility = 'hidden'
|
42
|
+
element.style.position = 'absolute'
|
43
|
+
|
44
|
+
// Get the height
|
45
|
+
const height = element.offsetHeight
|
46
|
+
|
47
|
+
// Restore the original styles
|
48
|
+
element.style.display = originalStyles.display
|
49
|
+
element.style.visibility = originalStyles.visibility
|
50
|
+
element.style.position = originalStyles.position
|
51
|
+
|
52
|
+
return height
|
53
|
+
}
|
54
|
+
|
55
|
+
toggleItem(event) {
|
56
|
+
const trigger = event.currentTarget || event.target
|
57
|
+
|
58
|
+
const item = trigger.closest(
|
59
|
+
'[data-shadcn-phlexcomponents--accordion-target="item"]',
|
60
|
+
)
|
61
|
+
|
62
|
+
if (item.dataset.state === 'open') {
|
63
|
+
this.closeItem(item)
|
64
|
+
} else {
|
65
|
+
this.openItem(item)
|
66
|
+
}
|
67
|
+
|
68
|
+
if (!this.multiple) {
|
69
|
+
this.itemTargets.forEach((i) => {
|
70
|
+
if (i !== item) {
|
71
|
+
this.closeItem(i)
|
72
|
+
}
|
73
|
+
})
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
openItem(item) {
|
78
|
+
const button = item.querySelector(
|
79
|
+
'[data-shadcn-phlexcomponents--accordion-target="trigger"]',
|
80
|
+
)
|
81
|
+
const content = item.querySelector(
|
82
|
+
'[data-shadcn-phlexcomponents--accordion-target="content"]',
|
83
|
+
)
|
84
|
+
|
85
|
+
item.dataset.state = 'open'
|
86
|
+
button.ariaExpanded = true
|
87
|
+
button.dataset.state = 'open'
|
88
|
+
content.dataset.state = 'open'
|
89
|
+
content.classList.remove('hidden')
|
90
|
+
}
|
91
|
+
|
92
|
+
closeItem(item) {
|
93
|
+
const button = item.querySelector(
|
94
|
+
'[data-shadcn-phlexcomponents--accordion-target="trigger"]',
|
95
|
+
)
|
96
|
+
const content = item.querySelector(
|
97
|
+
'[data-shadcn-phlexcomponents--accordion-target="content"]',
|
98
|
+
)
|
99
|
+
|
100
|
+
item.dataset.state = 'closed'
|
101
|
+
button.ariaExpanded = false
|
102
|
+
button.dataset.state = 'closed'
|
103
|
+
content.dataset.state = 'closed'
|
104
|
+
|
105
|
+
setTimeout(() => {
|
106
|
+
content.classList.add('hidden')
|
107
|
+
}, 150)
|
108
|
+
}
|
109
|
+
|
110
|
+
focusNext(event) {
|
111
|
+
const trigger = event.currentTarget || event.target
|
112
|
+
const index = this.triggers.indexOf(trigger)
|
113
|
+
let nextIndex = index + 1
|
114
|
+
|
115
|
+
if (index === this.triggers.length - 1) {
|
116
|
+
nextIndex = 0
|
117
|
+
}
|
118
|
+
|
119
|
+
this.triggers[nextIndex].focus()
|
120
|
+
}
|
121
|
+
|
122
|
+
focusPrev(event) {
|
123
|
+
const trigger = event.currentTarget || event.target
|
124
|
+
const index = this.triggers.indexOf(trigger)
|
125
|
+
let prevIndex = index - 1
|
126
|
+
|
127
|
+
if (index === 0) {
|
128
|
+
prevIndex = this.triggers.length - 1
|
129
|
+
}
|
130
|
+
|
131
|
+
this.triggers[prevIndex].focus()
|
132
|
+
}
|
133
|
+
}
|