css-zero 0.0.49 → 0.0.51
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/typography.css +1 -1
- data/lib/css_zero/version.rb +1 -1
- data/lib/generators/css_zero/add/USAGE +1 -1
- data/lib/generators/css_zero/add/resources.yml +8 -0
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/button.css +4 -4
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/command.css +6 -7
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/input.css +1 -2
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/menu.css +1 -5
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/tabs.css +2 -1
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/tom-select.css +411 -0
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/zcombobox.css +100 -0
- data/lib/generators/css_zero/add/templates/app/assets/stylesheets/ztrix.css +170 -0
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/combobox_controller.js +48 -0
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/copyable_input_controller.js +11 -1
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/filter_controller.js +14 -2
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/list_controller.js +79 -0
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/menu_controller.js +23 -24
- data/lib/generators/css_zero/add/templates/app/javascript/controllers/tabs_controller.js +22 -9
- data/lib/generators/css_zero/install/install_generator.rb +0 -24
- metadata +7 -5
- data/lib/generators/css_zero/install/templates/app/javascript/helpers/cookie_helpers.js +0 -18
- data/lib/generators/css_zero/install/templates/app/javascript/helpers/timing_helpers.js +0 -39
- data/lib/generators/css_zero/install/templates/app/javascript/initializers/index.js +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7b5b639f94e6c5d8362049f9496337a8663596c34ba69fc2fab9937237ad52f
|
4
|
+
data.tar.gz: 0e7b620c61ff7d92478bf8a72aa5def5d38c794fb09751c0187132cffbd00a78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0967b454d96821399b2447aea998d65726f179e80d5da8e1ec4a25df13fdf17b0fd33f7c3889e996418d909a86403ddde7771a1e1b77a83af925ee5b481f69bf'
|
7
|
+
data.tar.gz: 60449d04636f9cd001f7415aec961bcdd05e81249bcd990900ce1c850d92fc8d0d755c16027377cf146e468165888d5bfd1f3c5134275260808fab4b0045daee
|
data/lib/css_zero/version.rb
CHANGED
@@ -2,7 +2,7 @@ Description:
|
|
2
2
|
This will add components into your project.
|
3
3
|
|
4
4
|
Components:
|
5
|
-
accordion alert avatar badge breadcrumb button card carousel check_all command collapsible dialog dropdown flash form fullscreen hotkey input input_concerns layouts lightbox local_time pagination progress prose sheet skeleton switch table tabs upload_preview toggle web_share
|
5
|
+
accordion alert avatar badge breadcrumb button card carousel combobox check_all command collapsible dialog dropdown flash form fullscreen hotkey input input_concerns layouts lightbox local_time pagination progress prose sheet skeleton switch table tabs trix upload_preview toggle web_share
|
6
6
|
|
7
7
|
Example:
|
8
8
|
bin/rails generate css_zero:add [components...]
|
@@ -20,11 +20,17 @@ carousel:
|
|
20
20
|
- app/javascript/controllers/carousel_controller.js
|
21
21
|
- app/assets/images/arrow-left.svg
|
22
22
|
- app/assets/images/arrow-right.svg
|
23
|
+
combobox:
|
24
|
+
- app/assets/stylesheets/tom-select.css
|
25
|
+
- app/assets/stylesheets/zcombobox.css
|
26
|
+
- app/javascript/controllers/combobox_controller.js
|
27
|
+
- app/assets/images/select-arrow.svg
|
23
28
|
check_all:
|
24
29
|
- app/javascript/controllers/check_all_controller.js
|
25
30
|
command:
|
26
31
|
- app/assets/stylesheets/command.css
|
27
32
|
- app/javascript/controllers/filter_controller.js
|
33
|
+
- app/javascript/controllers/list_controller.js
|
28
34
|
- app/assets/images/search.svg
|
29
35
|
collapsible:
|
30
36
|
- app/javascript/controllers/collapsible_controller.js
|
@@ -95,6 +101,8 @@ table:
|
|
95
101
|
tabs:
|
96
102
|
- app/assets/stylesheets/tabs.css
|
97
103
|
- app/javascript/controllers/tabs_controller.js
|
104
|
+
trix:
|
105
|
+
- app/assets/stylesheets/ztrix.css
|
98
106
|
upload_preview:
|
99
107
|
- app/javascript/controllers/upload_preview_controller.js
|
100
108
|
- app/assets/images/default-picture.webp
|
@@ -20,9 +20,9 @@
|
|
20
20
|
}
|
21
21
|
|
22
22
|
&:hover {
|
23
|
-
--hover-color: var(--btn-background, var(--color-bg));
|
24
|
-
--hover-color
|
25
|
-
background-color:
|
23
|
+
--hover-color-from: var(--btn-background, var(--color-bg));
|
24
|
+
--hover-color: oklch(from var(--hover-color-from) calc(l * .96) c h);
|
25
|
+
background-color: var(--btn-hover-color, var(--hover-color));
|
26
26
|
}
|
27
27
|
|
28
28
|
&:focus-visible {
|
@@ -69,7 +69,7 @@
|
|
69
69
|
.btn--plain {
|
70
70
|
--btn-background: transparent;
|
71
71
|
--btn-border-color: transparent;
|
72
|
-
--btn-hover-
|
72
|
+
--btn-hover-color: transparent;
|
73
73
|
--btn-padding: 0;
|
74
74
|
}
|
75
75
|
|
@@ -19,8 +19,11 @@
|
|
19
19
|
overflow-y: auto;
|
20
20
|
}
|
21
21
|
|
22
|
-
.command__group {
|
22
|
+
.command__group:not(:first-child) {
|
23
23
|
border-block-start-width: var(--border);
|
24
|
+
}
|
25
|
+
|
26
|
+
.command__group {
|
24
27
|
display: flex;
|
25
28
|
flex-direction: column;
|
26
29
|
padding: var(--size-1);
|
@@ -42,16 +45,12 @@
|
|
42
45
|
.command__item {
|
43
46
|
--btn-border-color: transparent;
|
44
47
|
--btn-font-weight: var(--font-normal);
|
45
|
-
--btn-hover-
|
48
|
+
--btn-hover-color: var(--color-secondary);
|
46
49
|
--btn-justify-content: start;
|
47
50
|
--btn-outline-size: 0;
|
48
51
|
--btn-padding: var(--size-1_5) var(--size-2);
|
49
52
|
|
50
|
-
|
51
|
-
--btn-background: var(--color-secondary);
|
52
|
-
}
|
53
|
-
|
54
|
-
&:focus-visible {
|
53
|
+
&[aria-selected=true] {
|
55
54
|
--btn-background: var(--color-secondary);
|
56
55
|
}
|
57
56
|
}
|
@@ -23,15 +23,11 @@
|
|
23
23
|
.menu__item {
|
24
24
|
--btn-border-color: transparent;
|
25
25
|
--btn-font-weight: var(--font-normal);
|
26
|
-
--btn-hover-
|
26
|
+
--btn-hover-color: var(--color-secondary);
|
27
27
|
--btn-justify-content: start;
|
28
28
|
--btn-outline-size: 0;
|
29
29
|
--btn-padding: var(--size-1_5) var(--size-2);
|
30
30
|
|
31
|
-
&:hover {
|
32
|
-
--btn-background: var(--color-secondary);
|
33
|
-
}
|
34
|
-
|
35
31
|
&:focus-visible {
|
36
32
|
--btn-background: var(--color-secondary);
|
37
33
|
}
|
@@ -11,10 +11,11 @@
|
|
11
11
|
.btn--tab {
|
12
12
|
--btn-background: transparent;
|
13
13
|
--btn-border-color: transparent;
|
14
|
-
--btn-hover-
|
14
|
+
--btn-hover-color: transparent;
|
15
15
|
--btn-inline-size: var(--size-full);
|
16
16
|
|
17
17
|
&[aria-selected=true] {
|
18
18
|
--btn-background: var(--color-bg);
|
19
|
+
--btn-hover-color: var(--color-bg);
|
19
20
|
}
|
20
21
|
}
|
@@ -0,0 +1,411 @@
|
|
1
|
+
/**
|
2
|
+
* tom-select.css (v2.3.1)
|
3
|
+
* Copyright (c) contributors
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
6
|
+
* file except in compliance with the License. You may obtain a copy of the License at:
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
*
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
* ANY KIND, either express or implied. See the License for the specific language
|
12
|
+
* governing permissions and limitations under the License.
|
13
|
+
*
|
14
|
+
*/
|
15
|
+
.ts-control {
|
16
|
+
border: 1px solid #d0d0d0;
|
17
|
+
padding: 8px 8px;
|
18
|
+
width: 100%;
|
19
|
+
overflow: hidden;
|
20
|
+
position: relative;
|
21
|
+
z-index: 1;
|
22
|
+
box-sizing: border-box;
|
23
|
+
box-shadow: none;
|
24
|
+
border-radius: 3px;
|
25
|
+
display: flex;
|
26
|
+
flex-wrap: wrap;
|
27
|
+
}
|
28
|
+
.ts-wrapper.multi.has-items .ts-control {
|
29
|
+
padding: calc(8px - 2px - 0) 8px calc(8px - 2px - 3px - 0);
|
30
|
+
}
|
31
|
+
.full .ts-control {
|
32
|
+
background-color: #fff;
|
33
|
+
}
|
34
|
+
.disabled .ts-control, .disabled .ts-control * {
|
35
|
+
cursor: default !important;
|
36
|
+
}
|
37
|
+
.focus .ts-control {
|
38
|
+
box-shadow: none;
|
39
|
+
}
|
40
|
+
.ts-control > * {
|
41
|
+
vertical-align: baseline;
|
42
|
+
display: inline-block;
|
43
|
+
}
|
44
|
+
.ts-wrapper.multi .ts-control > div {
|
45
|
+
cursor: pointer;
|
46
|
+
margin: 0 3px 3px 0;
|
47
|
+
padding: 2px 6px;
|
48
|
+
background: #f2f2f2;
|
49
|
+
color: #303030;
|
50
|
+
border: 0 solid #d0d0d0;
|
51
|
+
}
|
52
|
+
.ts-wrapper.multi .ts-control > div.active {
|
53
|
+
background: #e8e8e8;
|
54
|
+
color: #303030;
|
55
|
+
border: 0 solid #cacaca;
|
56
|
+
}
|
57
|
+
.ts-wrapper.multi.disabled .ts-control > div, .ts-wrapper.multi.disabled .ts-control > div.active {
|
58
|
+
color: #7d7d7d;
|
59
|
+
background: white;
|
60
|
+
border: 0 solid white;
|
61
|
+
}
|
62
|
+
.ts-control > input {
|
63
|
+
flex: 1 1 auto;
|
64
|
+
min-width: 7rem;
|
65
|
+
display: inline-block !important;
|
66
|
+
padding: 0 !important;
|
67
|
+
min-height: 0 !important;
|
68
|
+
max-height: none !important;
|
69
|
+
max-width: 100% !important;
|
70
|
+
margin: 0 !important;
|
71
|
+
text-indent: 0 !important;
|
72
|
+
border: 0 none !important;
|
73
|
+
background: none !important;
|
74
|
+
line-height: inherit !important;
|
75
|
+
-webkit-user-select: auto !important;
|
76
|
+
-moz-user-select: auto !important;
|
77
|
+
-ms-user-select: auto !important;
|
78
|
+
user-select: auto !important;
|
79
|
+
box-shadow: none !important;
|
80
|
+
}
|
81
|
+
.ts-control > input::-ms-clear {
|
82
|
+
display: none;
|
83
|
+
}
|
84
|
+
.ts-control > input:focus {
|
85
|
+
outline: none !important;
|
86
|
+
}
|
87
|
+
.has-items .ts-control > input {
|
88
|
+
margin: 0 4px !important;
|
89
|
+
}
|
90
|
+
.ts-control.rtl {
|
91
|
+
text-align: right;
|
92
|
+
}
|
93
|
+
.ts-control.rtl.single .ts-control:after {
|
94
|
+
left: 15px;
|
95
|
+
right: auto;
|
96
|
+
}
|
97
|
+
.ts-control.rtl .ts-control > input {
|
98
|
+
margin: 0 4px 0 -2px !important;
|
99
|
+
}
|
100
|
+
.disabled .ts-control {
|
101
|
+
opacity: 0.5;
|
102
|
+
background-color: #fafafa;
|
103
|
+
}
|
104
|
+
.input-hidden .ts-control > input {
|
105
|
+
opacity: 0;
|
106
|
+
position: absolute;
|
107
|
+
left: -10000px;
|
108
|
+
}
|
109
|
+
|
110
|
+
.ts-dropdown {
|
111
|
+
position: absolute;
|
112
|
+
top: 100%;
|
113
|
+
left: 0;
|
114
|
+
width: 100%;
|
115
|
+
z-index: 10;
|
116
|
+
border: 1px solid #d0d0d0;
|
117
|
+
background: #fff;
|
118
|
+
margin: 0.25rem 0 0;
|
119
|
+
border-top: 0 none;
|
120
|
+
box-sizing: border-box;
|
121
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
122
|
+
border-radius: 0 0 3px 3px;
|
123
|
+
}
|
124
|
+
.ts-dropdown [data-selectable] {
|
125
|
+
cursor: pointer;
|
126
|
+
overflow: hidden;
|
127
|
+
}
|
128
|
+
.ts-dropdown [data-selectable] .highlight {
|
129
|
+
background: rgba(125, 168, 208, 0.2);
|
130
|
+
border-radius: 1px;
|
131
|
+
}
|
132
|
+
.ts-dropdown .option,
|
133
|
+
.ts-dropdown .optgroup-header,
|
134
|
+
.ts-dropdown .no-results,
|
135
|
+
.ts-dropdown .create {
|
136
|
+
padding: 5px 8px;
|
137
|
+
}
|
138
|
+
.ts-dropdown .option, .ts-dropdown [data-disabled], .ts-dropdown [data-disabled] [data-selectable].option {
|
139
|
+
cursor: inherit;
|
140
|
+
opacity: 0.5;
|
141
|
+
}
|
142
|
+
.ts-dropdown [data-selectable].option {
|
143
|
+
opacity: 1;
|
144
|
+
cursor: pointer;
|
145
|
+
}
|
146
|
+
.ts-dropdown .optgroup:first-child .optgroup-header {
|
147
|
+
border-top: 0 none;
|
148
|
+
}
|
149
|
+
.ts-dropdown .optgroup-header {
|
150
|
+
color: #303030;
|
151
|
+
background: #fff;
|
152
|
+
cursor: default;
|
153
|
+
}
|
154
|
+
.ts-dropdown .active {
|
155
|
+
background-color: #f5fafd;
|
156
|
+
color: #495c68;
|
157
|
+
}
|
158
|
+
.ts-dropdown .active.create {
|
159
|
+
color: #495c68;
|
160
|
+
}
|
161
|
+
.ts-dropdown .create {
|
162
|
+
color: rgba(48, 48, 48, 0.5);
|
163
|
+
}
|
164
|
+
.ts-dropdown .spinner {
|
165
|
+
display: inline-block;
|
166
|
+
width: 30px;
|
167
|
+
height: 30px;
|
168
|
+
margin: 5px 8px;
|
169
|
+
}
|
170
|
+
.ts-dropdown .spinner::after {
|
171
|
+
content: " ";
|
172
|
+
display: block;
|
173
|
+
width: 24px;
|
174
|
+
height: 24px;
|
175
|
+
margin: 3px;
|
176
|
+
border-radius: 50%;
|
177
|
+
border: 5px solid #d0d0d0;
|
178
|
+
border-color: #d0d0d0 transparent #d0d0d0 transparent;
|
179
|
+
animation: lds-dual-ring 1.2s linear infinite;
|
180
|
+
}
|
181
|
+
@keyframes lds-dual-ring {
|
182
|
+
0% {
|
183
|
+
transform: rotate(0deg);
|
184
|
+
}
|
185
|
+
100% {
|
186
|
+
transform: rotate(360deg);
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
.ts-dropdown-content {
|
191
|
+
overflow: hidden auto;
|
192
|
+
max-height: 200px;
|
193
|
+
scroll-behavior: smooth;
|
194
|
+
}
|
195
|
+
|
196
|
+
.ts-wrapper.plugin-drag_drop .ts-dragging {
|
197
|
+
color: transparent !important;
|
198
|
+
}
|
199
|
+
.ts-wrapper.plugin-drag_drop .ts-dragging > * {
|
200
|
+
visibility: hidden !important;
|
201
|
+
}
|
202
|
+
|
203
|
+
.plugin-checkbox_options:not(.rtl) .option input {
|
204
|
+
margin-right: 0.5rem;
|
205
|
+
}
|
206
|
+
|
207
|
+
.plugin-checkbox_options.rtl .option input {
|
208
|
+
margin-left: 0.5rem;
|
209
|
+
}
|
210
|
+
|
211
|
+
/* stylelint-disable function-name-case */
|
212
|
+
.plugin-clear_button {
|
213
|
+
--ts-pr-clear-button: 1em;
|
214
|
+
}
|
215
|
+
.plugin-clear_button .clear-button {
|
216
|
+
opacity: 0;
|
217
|
+
position: absolute;
|
218
|
+
top: 50%;
|
219
|
+
transform: translateY(-50%);
|
220
|
+
right: calc(8px - 6px);
|
221
|
+
margin-right: 0 !important;
|
222
|
+
background: transparent !important;
|
223
|
+
transition: opacity 0.5s;
|
224
|
+
cursor: pointer;
|
225
|
+
}
|
226
|
+
.plugin-clear_button.form-select .clear-button, .plugin-clear_button.single .clear-button {
|
227
|
+
right: max(var(--ts-pr-caret), 8px);
|
228
|
+
}
|
229
|
+
.plugin-clear_button.focus.has-items .clear-button, .plugin-clear_button:not(.disabled):hover.has-items .clear-button {
|
230
|
+
opacity: 1;
|
231
|
+
}
|
232
|
+
|
233
|
+
.ts-wrapper .dropdown-header {
|
234
|
+
position: relative;
|
235
|
+
padding: 10px 8px;
|
236
|
+
border-bottom: 1px solid #d0d0d0;
|
237
|
+
background: color-mix(#fff, #d0d0d0, 85%);
|
238
|
+
border-radius: 3px 3px 0 0;
|
239
|
+
}
|
240
|
+
.ts-wrapper .dropdown-header-close {
|
241
|
+
position: absolute;
|
242
|
+
right: 8px;
|
243
|
+
top: 50%;
|
244
|
+
color: #303030;
|
245
|
+
opacity: 0.4;
|
246
|
+
margin-top: -12px;
|
247
|
+
line-height: 20px;
|
248
|
+
font-size: 20px !important;
|
249
|
+
}
|
250
|
+
.ts-wrapper .dropdown-header-close:hover {
|
251
|
+
color: black;
|
252
|
+
}
|
253
|
+
|
254
|
+
.plugin-dropdown_input.focus.dropdown-active .ts-control {
|
255
|
+
box-shadow: none;
|
256
|
+
border: 1px solid #d0d0d0;
|
257
|
+
}
|
258
|
+
.plugin-dropdown_input .dropdown-input {
|
259
|
+
border: 1px solid #d0d0d0;
|
260
|
+
border-width: 0 0 1px;
|
261
|
+
display: block;
|
262
|
+
padding: 8px 8px;
|
263
|
+
box-shadow: none;
|
264
|
+
width: 100%;
|
265
|
+
background: transparent;
|
266
|
+
}
|
267
|
+
.plugin-dropdown_input .items-placeholder {
|
268
|
+
border: 0 none !important;
|
269
|
+
box-shadow: none !important;
|
270
|
+
width: 100%;
|
271
|
+
}
|
272
|
+
.plugin-dropdown_input.has-items .items-placeholder, .plugin-dropdown_input.dropdown-active .items-placeholder {
|
273
|
+
display: none !important;
|
274
|
+
}
|
275
|
+
|
276
|
+
.ts-wrapper.plugin-input_autogrow.has-items .ts-control > input {
|
277
|
+
min-width: 0;
|
278
|
+
}
|
279
|
+
.ts-wrapper.plugin-input_autogrow.has-items.focus .ts-control > input {
|
280
|
+
flex: none;
|
281
|
+
min-width: 4px;
|
282
|
+
}
|
283
|
+
.ts-wrapper.plugin-input_autogrow.has-items.focus .ts-control > input::-ms-input-placeholder {
|
284
|
+
color: transparent;
|
285
|
+
}
|
286
|
+
.ts-wrapper.plugin-input_autogrow.has-items.focus .ts-control > input::placeholder {
|
287
|
+
color: transparent;
|
288
|
+
}
|
289
|
+
|
290
|
+
.ts-dropdown.plugin-optgroup_columns .ts-dropdown-content {
|
291
|
+
display: flex;
|
292
|
+
}
|
293
|
+
.ts-dropdown.plugin-optgroup_columns .optgroup {
|
294
|
+
border-right: 1px solid #f2f2f2;
|
295
|
+
border-top: 0 none;
|
296
|
+
flex-grow: 1;
|
297
|
+
flex-basis: 0;
|
298
|
+
min-width: 0;
|
299
|
+
}
|
300
|
+
.ts-dropdown.plugin-optgroup_columns .optgroup:last-child {
|
301
|
+
border-right: 0 none;
|
302
|
+
}
|
303
|
+
.ts-dropdown.plugin-optgroup_columns .optgroup::before {
|
304
|
+
display: none;
|
305
|
+
}
|
306
|
+
.ts-dropdown.plugin-optgroup_columns .optgroup-header {
|
307
|
+
border-top: 0 none;
|
308
|
+
}
|
309
|
+
|
310
|
+
.ts-wrapper.plugin-remove_button .item {
|
311
|
+
display: inline-flex;
|
312
|
+
align-items: center;
|
313
|
+
}
|
314
|
+
.ts-wrapper.plugin-remove_button .item .remove {
|
315
|
+
color: inherit;
|
316
|
+
text-decoration: none;
|
317
|
+
vertical-align: middle;
|
318
|
+
display: inline-block;
|
319
|
+
padding: 0 6px;
|
320
|
+
border-radius: 0 2px 2px 0;
|
321
|
+
box-sizing: border-box;
|
322
|
+
}
|
323
|
+
.ts-wrapper.plugin-remove_button .item .remove:hover {
|
324
|
+
background: rgba(0, 0, 0, 0.05);
|
325
|
+
}
|
326
|
+
.ts-wrapper.plugin-remove_button.disabled .item .remove:hover {
|
327
|
+
background: none;
|
328
|
+
}
|
329
|
+
.ts-wrapper.plugin-remove_button .remove-single {
|
330
|
+
position: absolute;
|
331
|
+
right: 0;
|
332
|
+
top: 0;
|
333
|
+
font-size: 23px;
|
334
|
+
}
|
335
|
+
|
336
|
+
.ts-wrapper.plugin-remove_button:not(.rtl) .item {
|
337
|
+
padding-right: 0 !important;
|
338
|
+
}
|
339
|
+
.ts-wrapper.plugin-remove_button:not(.rtl) .item .remove {
|
340
|
+
border-left: 1px solid #d0d0d0;
|
341
|
+
margin-left: 6px;
|
342
|
+
}
|
343
|
+
.ts-wrapper.plugin-remove_button:not(.rtl) .item.active .remove {
|
344
|
+
border-left-color: #cacaca;
|
345
|
+
}
|
346
|
+
.ts-wrapper.plugin-remove_button:not(.rtl).disabled .item .remove {
|
347
|
+
border-left-color: white;
|
348
|
+
}
|
349
|
+
|
350
|
+
.ts-wrapper.plugin-remove_button.rtl .item {
|
351
|
+
padding-left: 0 !important;
|
352
|
+
}
|
353
|
+
.ts-wrapper.plugin-remove_button.rtl .item .remove {
|
354
|
+
border-right: 1px solid #d0d0d0;
|
355
|
+
margin-right: 6px;
|
356
|
+
}
|
357
|
+
.ts-wrapper.plugin-remove_button.rtl .item.active .remove {
|
358
|
+
border-right-color: #cacaca;
|
359
|
+
}
|
360
|
+
.ts-wrapper.plugin-remove_button.rtl.disabled .item .remove {
|
361
|
+
border-right-color: white;
|
362
|
+
}
|
363
|
+
|
364
|
+
:root {
|
365
|
+
--ts-pr-clear-button: 0;
|
366
|
+
--ts-pr-caret: 0;
|
367
|
+
--ts-pr-min: .75rem;
|
368
|
+
}
|
369
|
+
|
370
|
+
.ts-wrapper.single .ts-control, .ts-wrapper.single .ts-control input {
|
371
|
+
cursor: pointer;
|
372
|
+
}
|
373
|
+
|
374
|
+
.ts-control:not(.rtl) {
|
375
|
+
padding-right: max(var(--ts-pr-min), var(--ts-pr-clear-button) + var(--ts-pr-caret)) !important;
|
376
|
+
}
|
377
|
+
|
378
|
+
.ts-control.rtl {
|
379
|
+
padding-left: max(var(--ts-pr-min), var(--ts-pr-clear-button) + var(--ts-pr-caret)) !important;
|
380
|
+
}
|
381
|
+
|
382
|
+
.ts-wrapper {
|
383
|
+
position: relative;
|
384
|
+
}
|
385
|
+
|
386
|
+
.ts-dropdown,
|
387
|
+
.ts-control,
|
388
|
+
.ts-control input {
|
389
|
+
color: #303030;
|
390
|
+
font-family: inherit;
|
391
|
+
font-size: 13px;
|
392
|
+
line-height: 18px;
|
393
|
+
}
|
394
|
+
|
395
|
+
.ts-control,
|
396
|
+
.ts-wrapper.single.input-active .ts-control {
|
397
|
+
background: #fff;
|
398
|
+
cursor: text;
|
399
|
+
}
|
400
|
+
|
401
|
+
.ts-hidden-accessible {
|
402
|
+
border: 0 !important;
|
403
|
+
clip: rect(0 0 0 0) !important;
|
404
|
+
-webkit-clip-path: inset(50%) !important;
|
405
|
+
clip-path: inset(50%) !important;
|
406
|
+
overflow: hidden !important;
|
407
|
+
padding: 0 !important;
|
408
|
+
position: absolute !important;
|
409
|
+
width: 1px !important;
|
410
|
+
white-space: nowrap !important;
|
411
|
+
}
|
@@ -0,0 +1,100 @@
|
|
1
|
+
.ts-control {
|
2
|
+
align-items: center;
|
3
|
+
background-color: var(--color-bg);
|
4
|
+
border: 1px solid var(--color-border);
|
5
|
+
border-radius: var(--rounded-md);
|
6
|
+
min-block-size: var(--size-10);
|
7
|
+
color: var(--color-text);
|
8
|
+
display: flex;
|
9
|
+
font-size: var(--text-sm);
|
10
|
+
font-weight: var(--font-medium);
|
11
|
+
gap: var(--size-1);
|
12
|
+
line-height: inherit;
|
13
|
+
padding: var(--size-1_5) var(--size-2);
|
14
|
+
|
15
|
+
> input {
|
16
|
+
color: inherit; font-size: inherit;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
.ts-dropdown {
|
21
|
+
background-color: var(--color-bg);
|
22
|
+
border: 1px solid var(--color-border);
|
23
|
+
border-radius: var(--rounded-md);
|
24
|
+
box-shadow: var(--shadow-md);
|
25
|
+
color: var(--color-text);
|
26
|
+
font-size: var(--text-sm);
|
27
|
+
line-height: inherit;
|
28
|
+
|
29
|
+
.ts-dropdown-content:not(:has(.optgroup)) {
|
30
|
+
padding: var(--size-1);
|
31
|
+
}
|
32
|
+
|
33
|
+
.optgroup:not(:first-child) {
|
34
|
+
border-block-start-width: var(--border);
|
35
|
+
}
|
36
|
+
|
37
|
+
.optgroup {
|
38
|
+
padding: var(--size-1);
|
39
|
+
}
|
40
|
+
|
41
|
+
.optgroup-header {
|
42
|
+
color: var(--color-text-subtle);
|
43
|
+
font-size: var(--text-xs);
|
44
|
+
padding: var(--size-1_5) var(--size-2);
|
45
|
+
}
|
46
|
+
|
47
|
+
.create {
|
48
|
+
padding: var(--size-1_5) var(--size-2);
|
49
|
+
}
|
50
|
+
|
51
|
+
.option {
|
52
|
+
border: 1px solid transparent;
|
53
|
+
border-radius: var(--rounded-md);
|
54
|
+
padding: var(--size-1_5) var(--size-2);
|
55
|
+
}
|
56
|
+
|
57
|
+
.active {
|
58
|
+
background-color: var(--color-secondary);
|
59
|
+
color: inherit !important;
|
60
|
+
}
|
61
|
+
|
62
|
+
.highlight {
|
63
|
+
background-color: transparent !important;
|
64
|
+
}
|
65
|
+
|
66
|
+
.spinner {
|
67
|
+
margin: var(--size-1_5) 0 0;
|
68
|
+
}
|
69
|
+
|
70
|
+
.spinner::after {
|
71
|
+
border-block-color: var(--color-border-dark);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
.ts-wrapper.single .ts-control {
|
76
|
+
background-color: var(--color-bg) !important;
|
77
|
+
background-image: url("select-arrow.svg") !important;
|
78
|
+
background-position: center right var(--size-2) !important;
|
79
|
+
background-repeat: no-repeat !important;
|
80
|
+
background-size: var(--size-4) auto !important;
|
81
|
+
}
|
82
|
+
|
83
|
+
.ts-wrapper.multi .ts-control > .item {
|
84
|
+
background: var(--color-secondary);
|
85
|
+
border-radius: var(--rounded-md);
|
86
|
+
color: inherit;
|
87
|
+
margin: 0;
|
88
|
+
}
|
89
|
+
|
90
|
+
.disabled .ts-control {
|
91
|
+
opacity: var(--opacity-50);
|
92
|
+
}
|
93
|
+
|
94
|
+
.disabled .ts-control * {
|
95
|
+
cursor: not-allowed !important;
|
96
|
+
}
|
97
|
+
|
98
|
+
.invalid .ts-control {
|
99
|
+
border-color: var(--color-negative);
|
100
|
+
}
|
@@ -0,0 +1,170 @@
|
|
1
|
+
trix-toolbar {
|
2
|
+
inset-block-start: 0;
|
3
|
+
position: sticky;
|
4
|
+
|
5
|
+
.trix-button-row {
|
6
|
+
background-color: var(--color-bg);
|
7
|
+
border-block-width: 1px;
|
8
|
+
padding-block: var(--size-1_5);
|
9
|
+
gap: 1px;
|
10
|
+
}
|
11
|
+
|
12
|
+
.trix-button-group {
|
13
|
+
border: 0 !important;
|
14
|
+
margin: 0 !important;
|
15
|
+
gap: 1px;
|
16
|
+
}
|
17
|
+
|
18
|
+
.trix-button {
|
19
|
+
background-color: var(--color-bg);
|
20
|
+
border: 0 !important;
|
21
|
+
border-radius: var(--rounded-md);
|
22
|
+
color: var(--color-text);
|
23
|
+
|
24
|
+
&.trix-active {
|
25
|
+
background-color: var(--color-secondary);
|
26
|
+
}
|
27
|
+
|
28
|
+
&.trix-button--icon::before {
|
29
|
+
filter: var(--color-filter-text);
|
30
|
+
opacity: 1;
|
31
|
+
}
|
32
|
+
|
33
|
+
&.trix-button--icon:disabled::before {
|
34
|
+
opacity: 0.125;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
.trix-dialog {
|
39
|
+
background-color: var(--color-border-light);
|
40
|
+
border: 1px solid var(--color-border);
|
41
|
+
border-radius: var(--rounded-md);
|
42
|
+
margin: var(--size-1);
|
43
|
+
box-shadow: var(--shadow-md);
|
44
|
+
}
|
45
|
+
|
46
|
+
.trix-input--dialog {
|
47
|
+
border-color: var(--color-border);
|
48
|
+
background-color: var(--color-bg);
|
49
|
+
margin: 0;
|
50
|
+
}
|
51
|
+
|
52
|
+
.trix-button--dialog {
|
53
|
+
margin-inline-start: var(--size-1_5);
|
54
|
+
background-color: var(--color-primary);
|
55
|
+
color: var(--color-text-reversed);
|
56
|
+
}
|
57
|
+
|
58
|
+
@media (max-width: 768px) {
|
59
|
+
.trix-button-group--history-tools { display: none; }
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
trix-editor {
|
64
|
+
border: 0;
|
65
|
+
min-block-size: var(--size-72);
|
66
|
+
padding-block: var(--size-6) var(--size-2);
|
67
|
+
|
68
|
+
&:empty:not(:focus)::before {
|
69
|
+
color: color-mix(in srgb, currentColor 50%, transparent);
|
70
|
+
}
|
71
|
+
|
72
|
+
[data-trix-mutable].attachment img,
|
73
|
+
[data-trix-mutable].attachment--content,
|
74
|
+
[data-trix-mutable].attachment--file {
|
75
|
+
box-shadow: 0 0 0 2px var(--color-selected-dark);
|
76
|
+
}
|
77
|
+
|
78
|
+
.attachment__metadata {
|
79
|
+
background-color: var(--color-border-light);
|
80
|
+
color: var(--color-text);
|
81
|
+
}
|
82
|
+
|
83
|
+
&:focus-visible {
|
84
|
+
outline: 0;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
.trix-content {
|
89
|
+
& {
|
90
|
+
line-height: var(--leading-7);
|
91
|
+
}
|
92
|
+
|
93
|
+
a {
|
94
|
+
color: var(--color-link);
|
95
|
+
text-decoration: underline;
|
96
|
+
}
|
97
|
+
|
98
|
+
h1 {
|
99
|
+
font-size: var(--text-2xl);
|
100
|
+
font-weight: var(--font-semibold);
|
101
|
+
line-height: var(--leading-8);
|
102
|
+
margin-block-end: var(--size-6);
|
103
|
+
}
|
104
|
+
|
105
|
+
blockquote {
|
106
|
+
border-inline-start: 2px solid var(--color-border);
|
107
|
+
font-style: italic;
|
108
|
+
margin: 0;
|
109
|
+
padding-inline-start: var(--size-6);
|
110
|
+
padding-inline-end: 0;
|
111
|
+
}
|
112
|
+
|
113
|
+
pre {
|
114
|
+
background-color: var(--color-border-light);
|
115
|
+
border-radius: var(--rounded-lg);
|
116
|
+
font-family: var(--font-monospace-code);
|
117
|
+
font-size: var(--text-sm);
|
118
|
+
line-height: var(--leading-5);
|
119
|
+
padding: var(--size-4);
|
120
|
+
}
|
121
|
+
|
122
|
+
ul {
|
123
|
+
list-style-type: disc;
|
124
|
+
margin-inline-start: var(--size-6);
|
125
|
+
}
|
126
|
+
|
127
|
+
ol {
|
128
|
+
list-style-type: decimal;
|
129
|
+
margin-inline-start: var(--size-6);
|
130
|
+
}
|
131
|
+
|
132
|
+
li {
|
133
|
+
margin: 0;
|
134
|
+
}
|
135
|
+
|
136
|
+
img {
|
137
|
+
display: inline;
|
138
|
+
}
|
139
|
+
|
140
|
+
action-text-attachment {
|
141
|
+
display: contents;
|
142
|
+
}
|
143
|
+
|
144
|
+
.attachment:not(.attachment--file) {
|
145
|
+
.attachment__caption { display: none; }
|
146
|
+
}
|
147
|
+
|
148
|
+
.attachment--file {
|
149
|
+
color: var(--color--text);
|
150
|
+
border: 1px solid var(--color-border);
|
151
|
+
}
|
152
|
+
|
153
|
+
.attachment__progress {
|
154
|
+
background-color: var(--color-border-light);
|
155
|
+
border-radius: var(--rounded-full);
|
156
|
+
overflow: hidden;
|
157
|
+
|
158
|
+
&::-webkit-progress-bar {
|
159
|
+
background-color: var(--color-border-light);
|
160
|
+
}
|
161
|
+
|
162
|
+
&::-webkit-progress-value {
|
163
|
+
background-color: var(--color-primary);
|
164
|
+
}
|
165
|
+
|
166
|
+
&::-moz-progress-bar {
|
167
|
+
background-color: var(--color-primary);
|
168
|
+
}
|
169
|
+
}
|
170
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
import { get } from "@rails/request.js"
|
3
|
+
import TomSelect from "tom-select"
|
4
|
+
|
5
|
+
export default class extends Controller {
|
6
|
+
static values = { url: String, create: { type: String, default: "Add" }, noResults: { type: String, default: "No results found" } }
|
7
|
+
|
8
|
+
initialize() {
|
9
|
+
this.load = this.load.bind(this)
|
10
|
+
}
|
11
|
+
|
12
|
+
connect() {
|
13
|
+
if (this.element.nodeName === "INPUT") {
|
14
|
+
this.tomSelect = new TomSelect(this.element, this.#inputSettings)
|
15
|
+
} else {
|
16
|
+
this.tomSelect = new TomSelect(this.element, this.#selectSettings)
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
disconnect() {
|
21
|
+
this.tomSelect.destroy()
|
22
|
+
}
|
23
|
+
|
24
|
+
async load(query, callback) {
|
25
|
+
const response = await get(this.urlValue, { responseKind: "json", query: { q: query } })
|
26
|
+
const jsonResponse = await response.json
|
27
|
+
callback(jsonResponse)
|
28
|
+
}
|
29
|
+
|
30
|
+
get #inputSettings() {
|
31
|
+
return { render: this.#render, load: (this.hasUrlValue && this.load), persist: false, createOnBlur: true, create: true }
|
32
|
+
}
|
33
|
+
|
34
|
+
get #selectSettings() {
|
35
|
+
return { render: this.#render, load: (this.hasUrlValue && this.load) }
|
36
|
+
}
|
37
|
+
|
38
|
+
get #render() {
|
39
|
+
return {
|
40
|
+
option_create: (data, escape) => {
|
41
|
+
return `<div class="create">${this.createValue} <b>${escape(data.input)}</b>...</div>`
|
42
|
+
},
|
43
|
+
no_results: () => {
|
44
|
+
return `<div class="no-results">${this.noResultsValue}</div>`
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
data/lib/generators/css_zero/add/templates/app/javascript/controllers/copyable_input_controller.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
|
-
import { debounce } from "helpers/timing_helpers"
|
3
2
|
|
4
3
|
export default class extends Controller {
|
5
4
|
static targets = [ "input", "copyIcon", "successIcon" ]
|
@@ -36,3 +35,14 @@ export default class extends Controller {
|
|
36
35
|
this.successIconTarget.hidden = !this.copiedValue
|
37
36
|
}
|
38
37
|
}
|
38
|
+
|
39
|
+
// Helpers
|
40
|
+
|
41
|
+
function debounce(fn, delay = 1000) {
|
42
|
+
let timeoutId = null
|
43
|
+
|
44
|
+
return (...args) => {
|
45
|
+
clearTimeout(timeoutId)
|
46
|
+
timeoutId = setTimeout(() => fn.apply(this, args), delay)
|
47
|
+
}
|
48
|
+
}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
2
|
-
import { debounce } from "helpers/timing_helpers"
|
3
2
|
|
4
3
|
export default class extends Controller {
|
5
4
|
static targets = [ "list" ]
|
@@ -27,16 +26,29 @@ export default class extends Controller {
|
|
27
26
|
}
|
28
27
|
|
29
28
|
#selectMatches(value) {
|
30
|
-
this.listTarget.querySelectorAll(`[data-value
|
29
|
+
this.listTarget.querySelectorAll(`[data-value*="${value.toLowerCase()}"]`).forEach((element) => {
|
31
30
|
element.classList.add(this.selectedClass)
|
32
31
|
})
|
33
32
|
}
|
34
33
|
|
35
34
|
#activate() {
|
36
35
|
this.listTarget.classList.add(this.activeClass)
|
36
|
+
this.dispatch("after")
|
37
37
|
}
|
38
38
|
|
39
39
|
#deactivate() {
|
40
40
|
this.listTarget.classList.remove(this.activeClass)
|
41
|
+
this.dispatch("after")
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
// Helpers
|
46
|
+
|
47
|
+
function debounce(fn, delay = 1000) {
|
48
|
+
let timeoutId = null
|
49
|
+
|
50
|
+
return (...args) => {
|
51
|
+
clearTimeout(timeoutId)
|
52
|
+
timeoutId = setTimeout(() => fn.apply(this, args), delay)
|
41
53
|
}
|
42
54
|
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
|
+
|
3
|
+
export default class extends Controller {
|
4
|
+
static targets = [ "option" ]
|
5
|
+
static values = { index: Number }
|
6
|
+
|
7
|
+
connect() {
|
8
|
+
this.#removeTabstops()
|
9
|
+
this.#selectFirstOption()
|
10
|
+
}
|
11
|
+
|
12
|
+
reset() {
|
13
|
+
this.indexValue = 0
|
14
|
+
this.#selectCurrentOption()
|
15
|
+
}
|
16
|
+
|
17
|
+
navigate(event) {
|
18
|
+
switch (event.key) {
|
19
|
+
case "ArrowUp":
|
20
|
+
event.preventDefault()
|
21
|
+
this.#prev()
|
22
|
+
break
|
23
|
+
case "ArrowDown":
|
24
|
+
event.preventDefault()
|
25
|
+
this.#next()
|
26
|
+
break
|
27
|
+
case "Enter":
|
28
|
+
event.preventDefault()
|
29
|
+
this.#clickSelected()
|
30
|
+
break
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
#prev() {
|
35
|
+
if (this.indexValue > 0) {
|
36
|
+
this.indexValue--
|
37
|
+
this.#selectCurrentOption()
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
#next() {
|
42
|
+
if (this.indexValue < this.#lastIndex) {
|
43
|
+
this.indexValue++
|
44
|
+
this.#selectCurrentOption()
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
#clickSelected() {
|
49
|
+
this.#visibleOptions[this.indexValue]?.click()
|
50
|
+
}
|
51
|
+
|
52
|
+
#removeTabstops() {
|
53
|
+
this.optionTargets.forEach(e => e.tabIndex = -1)
|
54
|
+
}
|
55
|
+
|
56
|
+
#selectFirstOption() {
|
57
|
+
this.optionTargets.forEach((element, index) => {
|
58
|
+
element.ariaSelected = index === 0
|
59
|
+
})
|
60
|
+
}
|
61
|
+
|
62
|
+
#selectCurrentOption() {
|
63
|
+
this.optionTargets.forEach((element, index) => {
|
64
|
+
element.ariaSelected = false
|
65
|
+
})
|
66
|
+
|
67
|
+
this.#visibleOptions.forEach((element, index) => {
|
68
|
+
element.ariaSelected = index === this.indexValue
|
69
|
+
})
|
70
|
+
}
|
71
|
+
|
72
|
+
get #visibleOptions() {
|
73
|
+
return this.optionTargets.filter(e => e.offsetParent != null)
|
74
|
+
}
|
75
|
+
|
76
|
+
get #lastIndex() {
|
77
|
+
return this.#visibleOptions.length -1
|
78
|
+
}
|
79
|
+
}
|
@@ -4,43 +4,42 @@ export default class extends Controller {
|
|
4
4
|
static targets = [ "item" ]
|
5
5
|
static values = { index: Number }
|
6
6
|
|
7
|
-
#observer
|
8
|
-
|
9
|
-
initialize() {
|
10
|
-
this.#observer = new IntersectionObserver(this.#resetOnVisible.bind(this))
|
11
|
-
}
|
12
|
-
|
13
7
|
connect() {
|
14
|
-
this.#
|
8
|
+
this.#updateTabstops()
|
15
9
|
}
|
16
10
|
|
17
|
-
|
18
|
-
this
|
19
|
-
|
20
|
-
|
21
|
-
indexValueChanged(index, previousIndex) {
|
22
|
-
this.#updateTabstops(previousIndex !== undefined)
|
11
|
+
reset() {
|
12
|
+
this.indexValue = 0
|
13
|
+
this.#updateTabstops()
|
23
14
|
}
|
24
15
|
|
25
16
|
prev() {
|
26
|
-
this.indexValue > 0
|
17
|
+
if (this.indexValue > 0) {
|
18
|
+
this.indexValue--
|
19
|
+
this.#updateTabstops()
|
20
|
+
this.#focusCurrentItem()
|
21
|
+
}
|
27
22
|
}
|
28
23
|
|
29
24
|
next() {
|
30
|
-
this.indexValue < this
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
25
|
+
if (this.indexValue < this.#lastIndex) {
|
26
|
+
this.indexValue++
|
27
|
+
this.#updateTabstops()
|
28
|
+
this.#focusCurrentItem()
|
29
|
+
}
|
35
30
|
}
|
36
31
|
|
37
|
-
#updateTabstops(
|
32
|
+
#updateTabstops() {
|
38
33
|
this.itemTargets.forEach((element, index) => {
|
39
|
-
element.tabIndex = index
|
34
|
+
element.tabIndex = index === this.indexValue ? 0 : -1
|
40
35
|
})
|
36
|
+
}
|
41
37
|
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
#focusCurrentItem() {
|
39
|
+
this.itemTargets[this.indexValue].focus()
|
40
|
+
}
|
41
|
+
|
42
|
+
get #lastIndex() {
|
43
|
+
return this.itemTargets.length -1
|
45
44
|
}
|
46
45
|
}
|
@@ -4,34 +4,47 @@ export default class extends Controller {
|
|
4
4
|
static targets = [ "button", "tab" ]
|
5
5
|
static values = { index: Number }
|
6
6
|
|
7
|
-
|
8
|
-
this.#showCurrentTab(
|
7
|
+
connect() {
|
8
|
+
this.#showCurrentTab()
|
9
9
|
}
|
10
10
|
|
11
11
|
select({ target }) {
|
12
12
|
this.indexValue = this.buttonTargets.indexOf(target)
|
13
|
+
this.#showCurrentTab()
|
13
14
|
}
|
14
15
|
|
15
16
|
prev() {
|
16
|
-
this.indexValue > 0
|
17
|
+
if (this.indexValue > 0) {
|
18
|
+
this.indexValue--
|
19
|
+
this.#showCurrentTab()
|
20
|
+
this.#focusCurrentButton()
|
21
|
+
}
|
17
22
|
}
|
18
23
|
|
19
24
|
next() {
|
20
|
-
this.indexValue < this
|
25
|
+
if (this.indexValue < this.#lastIndex) {
|
26
|
+
this.indexValue++
|
27
|
+
this.#showCurrentTab()
|
28
|
+
this.#focusCurrentButton()
|
29
|
+
}
|
21
30
|
}
|
22
31
|
|
23
32
|
#showCurrentTab(shouldFocus) {
|
24
33
|
this.buttonTargets.forEach((element, index) => {
|
25
|
-
element.ariaSelected = index
|
26
|
-
element.tabIndex
|
34
|
+
element.ariaSelected = index === this.indexValue
|
35
|
+
element.tabIndex = index === this.indexValue ? 0 : -1
|
27
36
|
})
|
28
37
|
|
29
38
|
this.tabTargets.forEach((element, index) => {
|
30
39
|
element.hidden = index !== this.indexValue
|
31
40
|
})
|
41
|
+
}
|
32
42
|
|
33
|
-
|
34
|
-
|
35
|
-
|
43
|
+
#focusCurrentButton() {
|
44
|
+
this.buttonTargets[this.indexValue].focus()
|
45
|
+
}
|
46
|
+
|
47
|
+
get #lastIndex() {
|
48
|
+
return this.tabTargets.length -1
|
36
49
|
}
|
37
50
|
}
|
@@ -6,28 +6,4 @@ class CssZero::InstallGenerator < Rails::Generators::Base
|
|
6
6
|
def copy_base_css
|
7
7
|
copy_file "app/assets/stylesheets/base.css"
|
8
8
|
end
|
9
|
-
|
10
|
-
def copy_javascript_helpers
|
11
|
-
directory "app/javascript/helpers"
|
12
|
-
end
|
13
|
-
|
14
|
-
def pin_javascript_helpers
|
15
|
-
return unless install_with_importmap?
|
16
|
-
append_to_file "config/importmap.rb", %(pin_all_from "app/javascript/helpers", under: "helpers"\n)
|
17
|
-
end
|
18
|
-
|
19
|
-
def copy_javascript_initializers
|
20
|
-
copy_file "app/javascript/initializers/index.js"
|
21
|
-
end
|
22
|
-
|
23
|
-
def pin_javascript_initializers
|
24
|
-
return unless install_with_importmap?
|
25
|
-
append_to_file "config/importmap.rb", %(pin_all_from "app/javascript/initializers", under: "initializers"\n)
|
26
|
-
append_to_file "app/javascript/application.js", %(import "initializers"\n)
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
def install_with_importmap?
|
31
|
-
Rails.root.join("config/importmap.rb").exist?
|
32
|
-
end
|
33
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: css-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.51
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lázaro Nixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: lazaronixon@hotmail.com
|
@@ -80,11 +80,15 @@ files:
|
|
80
80
|
- lib/generators/css_zero/add/templates/app/assets/stylesheets/table.css
|
81
81
|
- lib/generators/css_zero/add/templates/app/assets/stylesheets/tabs.css
|
82
82
|
- lib/generators/css_zero/add/templates/app/assets/stylesheets/toggle.css
|
83
|
+
- lib/generators/css_zero/add/templates/app/assets/stylesheets/tom-select.css
|
84
|
+
- lib/generators/css_zero/add/templates/app/assets/stylesheets/zcombobox.css
|
85
|
+
- lib/generators/css_zero/add/templates/app/assets/stylesheets/ztrix.css
|
83
86
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/autoselect_controller.js
|
84
87
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/carousel_controller.js
|
85
88
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/check_all_controller.js
|
86
89
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/clearable_input_controller.js
|
87
90
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/collapsible_controller.js
|
91
|
+
- lib/generators/css_zero/add/templates/app/javascript/controllers/combobox_controller.js
|
88
92
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/copyable_input_controller.js
|
89
93
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/dialog_controller.js
|
90
94
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/element_removal_controller.js
|
@@ -93,6 +97,7 @@ files:
|
|
93
97
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/fullscreen_controller.js
|
94
98
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/hotkey_controller.js
|
95
99
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/lightbox_controller.js
|
100
|
+
- lib/generators/css_zero/add/templates/app/javascript/controllers/list_controller.js
|
96
101
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/local_time_controller.js
|
97
102
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/menu_controller.js
|
98
103
|
- lib/generators/css_zero/add/templates/app/javascript/controllers/popover_controller.js
|
@@ -103,9 +108,6 @@ files:
|
|
103
108
|
- lib/generators/css_zero/install/USAGE
|
104
109
|
- lib/generators/css_zero/install/install_generator.rb
|
105
110
|
- lib/generators/css_zero/install/templates/app/assets/stylesheets/base.css
|
106
|
-
- lib/generators/css_zero/install/templates/app/javascript/helpers/cookie_helpers.js
|
107
|
-
- lib/generators/css_zero/install/templates/app/javascript/helpers/timing_helpers.js
|
108
|
-
- lib/generators/css_zero/install/templates/app/javascript/initializers/index.js
|
109
111
|
homepage: https://github.com/lazaronixon/css-zero
|
110
112
|
licenses:
|
111
113
|
- MIT
|
@@ -1,18 +0,0 @@
|
|
1
|
-
export function getCookie(name) {
|
2
|
-
const cookies = document.cookie ? document.cookie.split("; ") : []
|
3
|
-
const prefix = `${encodeURIComponent(name)}=`
|
4
|
-
const cookie = cookies.find(cookie => cookie.startsWith(prefix))
|
5
|
-
|
6
|
-
if (cookie) {
|
7
|
-
const value = cookie.split("=").slice(1).join("=")
|
8
|
-
return value ? decodeURIComponent(value) : undefined
|
9
|
-
}
|
10
|
-
}
|
11
|
-
|
12
|
-
export function setCookie(name, value) {
|
13
|
-
const twentyYears = 20 * 365 * 24 * 60 * 60 * 1000
|
14
|
-
const body = [ name, value ].map(encodeURIComponent).join("=")
|
15
|
-
const expires = new Date(Date.now() + twentyYears).toUTCString()
|
16
|
-
const cookie = `${body}; path=/; expires=${expires}`
|
17
|
-
document.cookie = cookie
|
18
|
-
}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
export function throttle(fn, delay = 1000) {
|
2
|
-
let timeoutId = null
|
3
|
-
|
4
|
-
return (...args) => {
|
5
|
-
if (!timeoutId) {
|
6
|
-
fn(...args)
|
7
|
-
timeoutId = setTimeout(() => timeoutId = null, delay)
|
8
|
-
}
|
9
|
-
}
|
10
|
-
}
|
11
|
-
|
12
|
-
export function debounce(fn, delay = 1000) {
|
13
|
-
let timeoutId = null
|
14
|
-
|
15
|
-
return (...args) => {
|
16
|
-
clearTimeout(timeoutId)
|
17
|
-
timeoutId = setTimeout(() => fn.apply(this, args), delay)
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
export function nextEventLoopTick() {
|
22
|
-
return delay(0)
|
23
|
-
}
|
24
|
-
|
25
|
-
export function onNextEventLoopTick(callback) {
|
26
|
-
setTimeout(callback, 0)
|
27
|
-
}
|
28
|
-
|
29
|
-
export function nextFrame() {
|
30
|
-
return new Promise(requestAnimationFrame)
|
31
|
-
}
|
32
|
-
|
33
|
-
export function nextEventNamed(eventName, element = window) {
|
34
|
-
return new Promise(resolve => element.addEventListener(eventName, resolve, { once: true }))
|
35
|
-
}
|
36
|
-
|
37
|
-
export function delay(ms) {
|
38
|
-
return new Promise(resolve => setTimeout(resolve, ms))
|
39
|
-
}
|