grav-svelte 0.0.92 → 0.0.97

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.
@@ -1,10 +1,14 @@
1
1
  .alert-confirm-button {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ justify-content: center;
2
5
  background-color: #10b981;
3
6
  color: white;
4
7
  font-weight: bold;
5
8
  text-transform: uppercase;
6
9
  font-size: 0.875rem;
7
10
  padding: 0.75rem 1.5rem;
11
+ border: none;
8
12
  border-radius: 0.25rem;
9
13
  cursor: pointer;
10
14
  transition: all 150ms ease-in-out;
@@ -18,12 +22,16 @@
18
22
  }
19
23
 
20
24
  .alert-cancel-button {
25
+ display: inline-flex;
26
+ align-items: center;
27
+ justify-content: center;
21
28
  color: #EF4444;
22
29
  background: transparent;
23
30
  font-weight: bold;
24
31
  text-transform: uppercase;
25
32
  padding: 0.5rem 1.5rem;
26
33
  font-size: 0.875rem;
34
+ border: none;
27
35
  cursor: pointer;
28
36
  transition: all 150ms ease-in-out;
29
37
  }
@@ -33,6 +41,9 @@
33
41
  }
34
42
 
35
43
  .alert-error-button {
44
+ display: inline-flex;
45
+ align-items: center;
46
+ justify-content: center;
36
47
  color: #EF4444;
37
48
  background: transparent;
38
49
  font-weight: bold;
@@ -40,6 +51,7 @@
40
51
  cursor: pointer;
41
52
  padding: 0.5rem 1.5rem;
42
53
  font-size: 1rem;
54
+ border: none;
43
55
  transition: all 150ms ease-in-out;
44
56
  }
45
57
 
@@ -1,258 +1,295 @@
1
1
  .crud-filters-container {
2
- border-radius: 0.5rem;
3
- background-color: var(--grav-crud-color-bg);
4
- width: fit-content;
5
- padding: 0.5rem;
6
- box-shadow: var(--grav-crud-box-shadow);
7
- margin-bottom: 0.5rem;
8
- padding-top: 0.7rem;
9
- width: 100%;
10
-
2
+ border-radius: 0.5rem;
3
+ background-color: var(--grav-crud-color-bg);
4
+ width: fit-content;
5
+ padding: 0.5rem;
6
+ box-shadow: var(--grav-crud-box-shadow);
7
+ margin-bottom: 0.5rem;
8
+ padding-top: 0.7rem;
9
+ width: 100%;
11
10
  }
12
11
 
13
12
  @media (min-width: 640px) {
14
- .crud-filters-container {
15
- margin-bottom: 0.5rem;
16
- margin-top: 0.25rem;
17
- width: fit-content;
18
- }
13
+ .crud-filters-container {
14
+ margin-bottom: 0.5rem;
15
+ margin-top: 0.25rem;
16
+ width: fit-content;
17
+ }
19
18
  }
20
19
 
21
20
  .filters-core {
22
- display: flex;
23
- gap: 0.75rem;
24
- padding: 0.5rem;
21
+ display: flex;
22
+ gap: 0.75rem;
23
+ padding: 0.5rem;
25
24
  }
26
25
 
27
26
  @media (max-width: 640px) {
28
- .filters-core {
29
- display: flex;
30
- flex-direction: column;
31
- gap: 0.75rem;
32
- padding: 0;
33
- }
27
+ .filters-core {
28
+ display: flex;
29
+ flex-direction: column;
30
+ gap: 0.75rem;
31
+ padding: 0;
32
+ }
34
33
  }
35
34
 
36
35
  .filters-header {
37
- display: flex;
38
- align-items: center;
39
- gap: 0.75rem;
36
+ display: flex;
37
+ align-items: center;
38
+ gap: 0.75rem;
40
39
  }
41
40
 
42
41
  .filters-title {
43
- font-family: var(--grav-crud-title-font-family, 'mundial', sans-serif);
44
- font-weight: var(--grav-crud-title-font-weight, 700);
45
- font-size: var(--grav-crud-title-font-size, 1.5rem);
46
- line-height: var(--grav-crud-title-line-height, 1.25);
47
- white-space: nowrap;
48
- max-width: 100%;
49
- color: var(--grav-crud-color-neutral);
42
+ font-family: var(--grav-crud-title-font-family, "mundial", sans-serif);
43
+ font-weight: var(--grav-crud-title-font-weight, 700);
44
+ font-size: var(--grav-crud-title-font-size, 1.5rem);
45
+ line-height: var(--grav-crud-title-line-height, 1.25);
46
+ white-space: nowrap;
47
+ max-width: 100%;
48
+ color: var(--grav-crud-color-neutral);
50
49
  }
51
50
 
52
51
  .filters-actions {
53
- display: flex;
54
- justify-content: center;
55
- align-items: center;
56
- gap: 0.5rem;
57
- margin-top: 0.5rem;
52
+ display: flex;
53
+ align-items: center;
54
+ gap: 0.5rem;
55
+ }
56
+
57
+ .filters-controls .filters-actions {
58
+ justify-content: center;
59
+ margin-top: 0.5rem;
58
60
  }
59
61
 
60
62
  @media (min-width: 640px) {
61
- .filters-actions {
62
- margin-top: 0;
63
- }
63
+ .filters-controls .filters-actions {
64
+ margin-top: 0;
65
+ }
64
66
  }
65
67
 
66
68
  .filters-controls {
67
- display: flex;
68
- align-items: center;
69
-
70
- margin-top: 0.5rem;
69
+ display: flex;
70
+ align-items: center;
71
+
72
+ margin-top: 0.5rem;
71
73
  }
72
74
 
73
75
  @media (min-width: 640px) {
74
- .filters-controls {
75
- margin-top: 0;
76
- }
77
- .filters-actions {
78
- margin-right: 0.5rem;
79
- }
80
-
76
+ .filters-controls {
77
+ margin-top: 0;
78
+ }
79
+ .filters-actions {
80
+ margin-right: 0.5rem;
81
+ }
81
82
  }
82
83
 
83
84
  .tooltip-container {
84
- position: relative;
85
+ position: relative;
85
86
  }
86
87
 
87
88
  .tooltip {
88
- position: absolute;
89
- z-index: 10000;
90
- padding: 0.25rem;
91
- color: white;
92
- font-size: 0.75rem;
93
- background-color: var(--grav-crud-color-icon-hover);
94
- border-radius: var(--grav-crud-tooltip-border-radius, 0.25rem);
95
- top: -1.25rem;
96
- left: -2.5rem;
97
- pointer-events: none;
89
+ position: absolute;
90
+ z-index: 10000;
91
+ padding: 0.25rem;
92
+ color: white;
93
+ font-size: 0.75rem;
94
+ background-color: var(--grav-crud-color-icon-hover);
95
+ border-radius: var(--grav-crud-tooltip-border-radius, 0.25rem);
96
+ top: -1.25rem;
97
+ left: -2.5rem;
98
+ pointer-events: none;
98
99
  }
99
100
 
100
101
  .action-button {
101
- display: flex;
102
- justify-content: center;
103
- align-items: center;
104
- cursor: pointer;
105
- border-width: var(--grav-crud-filter-border-width, 1.5px);
106
- border-style: solid;
107
- border-color: var(--grav-crud-color-neutral);
108
- color: var(--grav-crud-color-neutral);
109
- width: 3rem;
110
- height: 2.5rem;
111
- border-radius: var(--grav-crud-filter-border-radius, 0.5rem);
102
+ display: flex;
103
+ justify-content: center;
104
+ align-items: center;
105
+ cursor: pointer;
106
+ border-width: var(--grav-crud-filter-border-width, 1.5px);
107
+ border-style: solid;
108
+ border-color: var(--grav-crud-color-neutral);
109
+ color: var(--grav-crud-color-neutral);
110
+ width: 3rem;
111
+ height: 2.5rem;
112
+ border-radius: var(--grav-crud-filter-border-radius, 0.5rem);
112
113
  }
113
114
 
114
115
  .filter-group {
115
- display: inline-flex;
116
- gap: 0.5rem;
116
+ display: inline-flex;
117
+ gap: 0.5rem;
117
118
  }
118
119
 
119
120
  @media (min-width: 640px) {
120
- .filter-group {
121
- padding: 0;
122
- gap: 0.5rem;
123
- margin-right: 0.5rem;
124
- }
121
+ .filter-group {
122
+ padding: 0;
123
+ gap: 0.5rem;
124
+ margin-right: 0.5rem;
125
+ }
125
126
  }
126
127
 
127
128
  .filter-button {
128
- display: inline-flex;
129
- align-items: center;
130
- justify-content: center;
131
- cursor: pointer;
132
- height: 2.5rem;
133
- font-family: var(--grav-crud-button-font-family, 'mundial', sans-serif);
134
- font-size: 1.1rem;
135
- font-weight: var(--grav-crud-button-font-weight, 500);
136
- line-height: var(--grav-crud-button-line-height, 1.5);
137
- border-width: var(--grav-crud-filter-border-width, 1.5px);
138
- border-style: solid;
139
- border-color: var(--grav-crud-color-neutral);
140
- color: var(--grav-crud-color-neutral);
141
- border-radius: var(--grav-crud-filter-border-radius, 0.5rem);
142
- padding: 0.75rem 1rem;
129
+ display: inline-flex;
130
+ align-items: center;
131
+ justify-content: center;
132
+ cursor: pointer;
133
+ height: 2.5rem;
134
+ font-family: var(--grav-crud-button-font-family, "mundial", sans-serif);
135
+ font-size: 1.1rem;
136
+ font-weight: var(--grav-crud-button-font-weight, 500);
137
+ line-height: var(--grav-crud-button-line-height, 1.5);
138
+ border-width: var(--grav-crud-filter-border-width, 1.5px);
139
+ border-style: solid;
140
+ border-color: var(--grav-crud-color-neutral);
141
+ color: var(--grav-crud-color-neutral);
142
+ border-radius: var(--grav-crud-filter-border-radius, 0.5rem);
143
+ padding: 0.75rem 1rem;
143
144
  }
144
145
 
145
146
  @media (min-width: 640px) {
146
- .filter-button {
147
- padding: 0.75rem 1rem;
148
- font-size: 1.2rem;
149
- }
147
+ .filter-button {
148
+ padding: 0.75rem 1rem;
149
+ font-size: 1.2rem;
150
+ }
150
151
  }
151
152
 
152
153
  .filter-button-active {
153
- background-color: var(--grav-crud-color-neutral);
154
- color: var(--grav-crud-color-bg);
154
+ background-color: var(--grav-crud-color-neutral);
155
+ color: var(--grav-crud-color-bg);
156
+ }
157
+
158
+ .filter-apply-button {
159
+ display: inline-flex;
160
+ align-items: center;
161
+ justify-content: center;
162
+ cursor: pointer;
163
+ height: 2.5rem;
164
+ font-family: var(--grav-crud-button-font-family, "mundial", sans-serif);
165
+ font-size: 1.1rem;
166
+ font-weight: var(--grav-crud-button-font-weight, 500);
167
+ line-height: var(--grav-crud-button-line-height, 1.5);
168
+ border-width: var(--grav-crud-filter-border-width, 1.5px);
169
+ border-style: solid;
170
+ border-radius: var(--grav-crud-filter-border-radius, 0.5rem);
171
+ padding: 0.75rem 1rem;
172
+ background-color: #6b7280;
173
+ color: white;
174
+ border-color: #6b7280;
175
+ }
176
+
177
+ .filter-apply-button:hover {
178
+ background-color: #4b5563;
179
+ border-color: #4b5563;
155
180
  }
156
181
 
157
- .filters-actions {
158
- display: flex;
159
- justify-content: right;
160
- align-items: center;
182
+ @media (min-width: 640px) {
183
+ .filter-apply-button {
184
+ padding: 0.75rem 1rem;
185
+ font-size: 1.2rem;
186
+ }
187
+ }
188
+
189
+ /* Botones de acción de filtros (Limpiar, Filtrar) - alineados a la derecha */
190
+ .crud-filters-container > .filters-actions {
191
+ justify-content: flex-end;
192
+ margin-top: 0.5rem;
161
193
  }
162
194
 
163
195
  .filter-button-middle {
164
- border-radius: 0;
196
+ border-radius: 0;
165
197
  }
166
198
 
167
199
  .filter-button-right {
168
- border-radius: 0 var(--grav-crud-filter-border-radius, 0.5rem) var(--grav-crud-filter-border-radius, 0.5rem) 0;
200
+ border-radius: 0 var(--grav-crud-filter-border-radius, 0.5rem)
201
+ var(--grav-crud-filter-border-radius, 0.5rem) 0;
169
202
  }
170
203
 
171
204
  .page-size-input {
172
- width: 8rem;
205
+ width: 8rem;
173
206
  }
174
207
 
175
208
  @media (min-width: 640px) {
176
- .page-size-input {
177
- width: 4rem;
178
- }
209
+ .page-size-input {
210
+ width: 4rem;
211
+ }
179
212
  }
180
213
 
181
214
  .apply-filter-button {
182
- display: inline-flex;
183
- height: 3rem;
184
- cursor: pointer;
185
- align-items: center;
186
- padding: 0.75rem 1rem;
187
- font-family: var(--grav-crud-button-font-family, 'mundial', sans-serif);
188
- font-size: var(--grav-crud-button-font-size, 0.875rem);
189
- font-weight: var(--grav-crud-button-font-weight, 500);
190
- line-height: var(--grav-crud-button-line-height, 1.5);
191
- border-width: var(--grav-crud-filter-border-width, 1.5px);
192
- border-style: solid;
193
- border-color: var(--grav-crud-color-neutral);
194
- color: var(--grav-crud-color-neutral);
195
- border-radius: var(--grav-crud-filter-border-radius, 0.5rem);
215
+ display: inline-flex;
216
+ height: 3rem;
217
+ cursor: pointer;
218
+ align-items: center;
219
+ padding: 0.75rem 1rem;
220
+ font-family: var(--grav-crud-button-font-family, "mundial", sans-serif);
221
+ font-size: var(--grav-crud-button-font-size, 0.875rem);
222
+ font-weight: var(--grav-crud-button-font-weight, 500);
223
+ line-height: var(--grav-crud-button-line-height, 1.5);
224
+ border-width: var(--grav-crud-filter-border-width, 1.5px);
225
+ border-style: solid;
226
+ border-color: var(--grav-crud-color-neutral);
227
+ color: var(--grav-crud-color-neutral);
228
+ border-radius: var(--grav-crud-filter-border-radius, 0.5rem);
196
229
  }
197
230
 
198
231
  @media (min-width: 640px) {
199
- .apply-filter-button {
200
- padding: 0.75rem 1rem;
201
- font-size: 0.875rem;
202
- }
232
+ .apply-filter-button {
233
+ padding: 0.75rem 1rem;
234
+ font-size: 0.875rem;
235
+ }
203
236
  }
204
237
 
205
238
  .filters-grid {
206
- display: grid;
207
- grid-template-columns: repeat(1, 1fr);
208
- gap: 0.2rem;
239
+ display: grid;
240
+ grid-template-columns: repeat(1, 1fr);
241
+ gap: 0.2rem;
209
242
  }
210
243
 
211
244
  @media (min-width: 640px) {
212
- .filters-grid {
213
- grid-template-columns: repeat(var(--grid-columns), 1fr);
214
- gap: 0.8rem;
215
- }
245
+ .filters-grid {
246
+ grid-template-columns: repeat(var(--grid-columns), 1fr);
247
+ gap: 0.8rem;
248
+ }
216
249
  }
217
250
 
218
251
  .filter-item {
219
- position: relative;
220
- margin: auto 0;
252
+ position: relative;
253
+ margin: auto 0;
221
254
  }
222
255
 
223
256
  .filter-item-number {
224
- z-index: 50;
257
+ z-index: 50;
225
258
  }
226
259
 
227
260
  .filter-item-datetime {
228
- z-index: 50;
261
+ z-index: 50;
229
262
  }
230
263
 
231
264
  .filter-item-date {
232
- z-index: 50;
265
+ z-index: 50;
233
266
  }
234
267
 
235
268
  .filter-item-bool {
236
- margin: auto 0;
269
+ margin: auto 0;
237
270
  }
238
271
 
239
272
  .loading-spinner {
240
- display: flex;
241
- justify-content: center;
242
- align-items: center;
243
- min-height: 38px;
273
+ display: flex;
274
+ justify-content: center;
275
+ align-items: center;
276
+ min-height: 38px;
244
277
  }
245
278
 
246
279
  .spinner {
247
- width: 20px;
248
- height: 20px;
249
- border: 2px solid #f3f3f3;
250
- border-top: 2px solid #3498db;
251
- border-radius: 50%;
252
- animation: spin 1s linear infinite;
280
+ width: 20px;
281
+ height: 20px;
282
+ border: 2px solid #f3f3f3;
283
+ border-top: 2px solid #3498db;
284
+ border-radius: 50%;
285
+ animation: spin 1s linear infinite;
253
286
  }
254
287
 
255
288
  @keyframes spin {
256
- 0% { transform: rotate(0deg); }
257
- 100% { transform: rotate(360deg); }
258
- }
289
+ 0% {
290
+ transform: rotate(0deg);
291
+ }
292
+ 100% {
293
+ transform: rotate(360deg);
294
+ }
295
+ }
@@ -310,7 +310,7 @@
310
310
  <button
311
311
  type="button"
312
312
  on:click={() => actualizarFiltro()}
313
- class="filter-button"
313
+ class="filter-button filter-apply-button"
314
314
  aria-label="Aplicar filtros"
315
315
  >
316
316
  Filtrar
@@ -69,10 +69,6 @@
69
69
  transition: all 0.2s ease;
70
70
  }
71
71
 
72
- .action-buttons-group:hover {
73
- background-color: rgba(0, 0, 0, 0.05);
74
- }
75
-
76
72
  @media (min-width: 640px) {
77
73
  .action-button {
78
74
  padding: 0.25rem 0.5rem;
@@ -214,6 +214,9 @@
214
214
  }
215
215
 
216
216
  .export-button {
217
+ display: inline-flex;
218
+ align-items: center;
219
+ justify-content: center;
217
220
  text-align: center;
218
221
  cursor: pointer;
219
222
  color: white;
@@ -8,6 +8,9 @@
8
8
  }
9
9
 
10
10
  .pagination-button {
11
+ display: inline-flex;
12
+ align-items: center;
13
+ justify-content: center;
11
14
  cursor: pointer;
12
15
  padding: 0.5rem;
13
16
  border-radius: var(--grav-crud-button-border-radius, 0.5rem);
@@ -40,6 +40,9 @@
40
40
  }
41
41
 
42
42
  .checkbox-button {
43
+ display: inline-flex;
44
+ align-items: center;
45
+ justify-content: center;
43
46
  margin-right: 0.5rem;
44
47
  height: 2.7rem;
45
48
  width: 2.7rem;
@@ -152,6 +152,9 @@
152
152
  }
153
153
 
154
154
  .load-button {
155
+ display: inline-flex;
156
+ align-items: center;
157
+ justify-content: center;
155
158
  padding: 0.5rem 1rem;
156
159
  border: var(--grav-crud-input-border-width) solid
157
160
  var(--grav-crud-color-neutral);
@@ -179,6 +182,9 @@
179
182
  }
180
183
 
181
184
  .remove-button {
185
+ display: inline-flex;
186
+ align-items: center;
187
+ justify-content: center;
182
188
  margin-top: 0.5rem;
183
189
  padding: 0.5rem 1rem;
184
190
  border: var(--grav-crud-input-border-width) solid #dc2626;
@@ -1,93 +1,96 @@
1
1
  .modal-overlay {
2
- overflow-x: hidden;
3
- overflow-y: auto;
4
- position: fixed;
5
- inset: 0;
6
- z-index: 50;
7
- outline: none;
8
- display: flex;
9
- justify-content: center;
10
- align-items: center;
2
+ overflow-x: hidden;
3
+ overflow-y: auto;
4
+ position: fixed;
5
+ inset: 0;
6
+ z-index: 50;
7
+ outline: none;
8
+ display: flex;
9
+ justify-content: center;
10
+ align-items: center;
11
11
  }
12
12
 
13
13
  .modal-content {
14
- border: 0;
15
- position: relative;
16
- display: flex;
17
- flex-direction: column;
18
- background-color: white;
19
- outline: none;
20
- max-height: 90vh;
21
- overflow: hidden;
22
- border-radius: 1rem;
14
+ border: 0;
15
+ position: relative;
16
+ display: flex;
17
+ flex-direction: column;
18
+ background-color: white;
19
+ outline: none;
20
+ max-height: 90vh;
21
+ overflow: hidden;
22
+ border-radius: 1rem;
23
23
  }
24
24
 
25
25
  .modal-content.lg {
26
- width: 100%;
27
- min-height: 100vh;
28
- border-radius: 0;
26
+ width: 100%;
27
+ min-height: 100vh;
28
+ border-radius: 0;
29
29
  }
30
30
 
31
31
  .modal-content.md {
32
- width: 87.5%;
33
- min-height: 80vh;
32
+ width: 87.5%;
33
+ min-height: 80vh;
34
34
  }
35
35
 
36
36
  @media (min-width: 640px) {
37
- .modal-content.md {
38
- width: 75%;
39
- }
37
+ .modal-content.md {
38
+ width: 75%;
39
+ }
40
40
  }
41
41
 
42
42
  .modal-content.sm {
43
- width: 75%;
44
- min-height: 60vh;
43
+ width: 75%;
44
+ min-height: 60vh;
45
45
  }
46
46
 
47
47
  @media (min-width: 640px) {
48
- .modal-content.sm {
49
- width: 33.333333%;
50
- }
48
+ .modal-content.sm {
49
+ width: 33.333333%;
50
+ }
51
51
  }
52
52
 
53
53
  .modal-content.xs {
54
- width: 75%;
55
- min-height: 40vh;
54
+ width: 75%;
55
+ min-height: 40vh;
56
56
  }
57
57
 
58
58
  @media (min-width: 640px) {
59
- .modal-content.xs {
60
- width: 25%;
61
- }
59
+ .modal-content.xs {
60
+ width: 25%;
61
+ }
62
62
  }
63
63
 
64
64
  .modal-header {
65
- display: flex;
66
- align-items: flex-start;
67
- justify-content: space-between;
68
- padding: 1rem;
69
- border-bottom: 1px solid #e2e8f0;
70
- border-top-left-radius: 0.25rem;
71
- border-top-right-radius: 0.25rem;
65
+ display: flex;
66
+ align-items: flex-start;
67
+ justify-content: space-between;
68
+ padding: 1rem;
69
+ border-bottom: 1px solid #e2e8f0;
70
+ border-top-left-radius: 0.25rem;
71
+ border-top-right-radius: 0.25rem;
72
72
  }
73
73
 
74
74
  .modal-title {
75
- font-size: 1.25rem;
76
- font-weight: 600;
75
+ font-size: 1.25rem;
76
+ font-weight: 600;
77
77
  }
78
78
 
79
79
  .modal-close-button {
80
- padding: 0.25rem;
81
- cursor: pointer;
82
- margin-left: auto;
83
- background: transparent;
84
- border: 0;
85
- color: black;
86
- float: right;
87
- font-size: 1.5rem;
88
- line-height: 1;
89
- font-weight: 600;
90
- outline: none;
80
+ display: inline-flex;
81
+ align-items: center;
82
+ justify-content: center;
83
+ padding: 0.25rem;
84
+ cursor: pointer;
85
+ margin-left: auto;
86
+ background: transparent;
87
+ border: 0;
88
+ color: black;
89
+ float: right;
90
+ font-size: 1.5rem;
91
+ line-height: 1;
92
+ font-weight: 600;
93
+ outline: none;
91
94
  }
92
95
 
93
96
  .modal-close-button:hover {
@@ -96,126 +99,135 @@
96
99
  }
97
100
 
98
101
  .modal-close-icon {
99
- height: 1.5rem;
100
- width: 1.5rem;
102
+ height: 1.5rem;
103
+ width: 1.5rem;
101
104
  }
102
105
 
103
106
  .modal-loading {
104
- position: relative;
105
- padding: 1.5rem;
106
- flex: 1;
107
- display: flex;
108
- justify-content: center;
109
- align-items: center;
107
+ position: relative;
108
+ padding: 1.5rem;
109
+ flex: 1;
110
+ display: flex;
111
+ justify-content: center;
112
+ align-items: center;
110
113
  }
111
114
 
112
115
  .modal-loading-spinner {
113
- display: flex;
114
- justify-content: center;
115
- font-size: 2.25rem;
116
- align-items: center;
116
+ display: flex;
117
+ justify-content: center;
118
+ font-size: 2.25rem;
119
+ align-items: center;
117
120
  }
118
121
 
119
122
  .modal-loading-svg {
120
- animation: spin 1s linear infinite;
121
- height: 2rem;
122
- width: 2rem;
123
- color: #10b981;
123
+ animation: spin 1s linear infinite;
124
+ height: 2rem;
125
+ width: 2rem;
126
+ color: #10b981;
124
127
  }
125
128
 
126
129
  .modal-body {
127
- position: relative;
128
- padding: 0.5rem;
129
- flex: 1;
130
- overflow-y: auto;
131
- overflow-x: hidden;
130
+ position: relative;
131
+ padding: 0.5rem;
132
+ flex: 1;
133
+ overflow-y: auto;
134
+ overflow-x: hidden;
132
135
  }
133
136
 
134
137
  @media (min-width: 640px) {
135
- .modal-body {
136
- padding: 1rem;
137
- }
138
+ .modal-body {
139
+ padding: 1rem;
140
+ }
138
141
  }
139
142
 
140
143
  .modal-footer {
141
- display: flex;
142
- align-items: center;
143
- justify-content: flex-end;
144
- padding: 0.75rem;
145
- gap: 0.75rem;
146
- border-top: 1px solid #e2e8f0;
144
+ display: flex;
145
+ align-items: center;
146
+ justify-content: flex-end;
147
+ padding: 0.75rem;
148
+ gap: 0.75rem;
149
+ border-top: 1px solid #e2e8f0;
147
150
  }
148
151
 
149
152
  .modal-save-button {
150
- background-color: #10b981;
151
- cursor: pointer;
152
- color: white;
153
- font-weight: 700;
154
- text-transform: uppercase;
155
- font-size: 0.875rem;
156
- padding: 0.75rem 1.5rem;
157
- border-radius: var(--grav-border-radius-md);
158
- outline: none;
159
- transition: all 0.15s ease-linear;
153
+ display: inline-flex;
154
+ align-items: center;
155
+ justify-content: center;
156
+ background-color: #10b981;
157
+ cursor: pointer;
158
+ color: white;
159
+ font-weight: 700;
160
+ text-transform: uppercase;
161
+ font-size: 0.875rem;
162
+ padding: 0.75rem 1.5rem;
163
+ border: none;
164
+ border-radius: var(--grav-border-radius-md);
165
+ outline: none;
166
+ transition: all 0.15s ease-linear;
160
167
  }
161
168
 
162
169
  .modal-save-button:hover {
163
- background-color: #059669;
170
+ background-color: #059669;
164
171
  }
165
172
 
166
173
  .modal-save-button:active {
167
- background-color: #059669;
174
+ background-color: #059669;
168
175
  }
169
176
 
170
177
  .modal-save-button:disabled {
171
- background-color: #6ee7b7;
172
- cursor: not-allowed;
178
+ background-color: #6ee7b7;
179
+ cursor: not-allowed;
173
180
  }
174
181
 
175
182
  .modal-cancel-button {
176
- cursor: pointer;
177
- color: #ef4444;
178
- font-weight: 700;
179
- text-transform: uppercase;
180
- font-size: 0.875rem;
181
- padding: 0.75rem 1.5rem;
182
- border: 1px solid #ef4444;
183
- border-radius: var(--grav-border-radius-md);
184
- outline: none;
185
- transition: all 0.75s ease-linear;
183
+ display: inline-flex;
184
+ align-items: center;
185
+ justify-content: center;
186
+ background-color: transparent;
187
+ cursor: pointer;
188
+ color: #ef4444;
189
+ font-weight: 700;
190
+ text-transform: uppercase;
191
+ font-size: 0.875rem;
192
+ padding: 0.75rem 1.5rem;
193
+ border: 1px solid #ef4444;
194
+ border-radius: var(--grav-border-radius-md);
195
+ outline: none;
196
+ transition: all 0.75s ease-linear;
186
197
  }
187
198
 
188
199
  .modal-cancel-button:hover {
189
- color: #d13b3b;
190
- border: 1px solid #d13b3b;
200
+ color: #d13b3b;
201
+ border: 1px solid #d13b3b;
191
202
  }
192
203
 
193
204
  .modal-backdrop {
194
- opacity: 0.25;
195
- position: fixed;
196
- inset: 0;
197
- z-index: 40;
198
- background-color: black;
205
+ opacity: 0.25;
206
+ position: fixed;
207
+ inset: 0;
208
+ z-index: 40;
209
+ background-color: black;
199
210
  }
200
211
 
201
212
  /* Modal-specific CSS variables for inputs */
202
213
  .modal-content {
203
- /* Override CRUD variables for modal context */
204
- --grav-crud-color-bg: #ffffff; /* White background for modal inputs */
205
- --grav-crud-color-button: #fe6b91; /* Pink buttons */
206
- --grav-crud-color-neutral: #313131; /* Black text for modal inputs */
207
- --grav-crud-color-light: #f5f5f5; /* Light gray for hover states */
208
- --grav-crud-color-border: #d1d5db; /* Gray borders */
209
- --grav-crud-color-tooltip: #374151; /* Darker gray for tooltips */
210
- --grav-crud-box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
211
- --grav-crud-input-border-width: 1px; /* Ensure border width is defined */
214
+ /* Override CRUD variables for modal context */
215
+ --grav-crud-color-bg: #ffffff; /* White background for modal inputs */
216
+ --grav-crud-color-button: #fe6b91; /* Pink buttons */
217
+ --grav-crud-color-neutral: #313131; /* Black text for modal inputs */
218
+ --grav-crud-color-light: #f5f5f5; /* Light gray for hover states */
219
+ --grav-crud-color-border: #d1d5db; /* Gray borders */
220
+ --grav-crud-color-tooltip: #374151; /* Darker gray for tooltips */
221
+ --grav-crud-box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1),
222
+ 0 1px 2px 0 rgba(0, 0, 0, 0.06);
223
+ --grav-crud-input-border-width: 1px; /* Ensure border width is defined */
212
224
  }
213
225
 
214
226
  @keyframes spin {
215
- from {
216
- transform: rotate(0deg);
217
- }
218
- to {
219
- transform: rotate(360deg);
220
- }
221
- }
227
+ from {
228
+ transform: rotate(0deg);
229
+ }
230
+ to {
231
+ transform: rotate(360deg);
232
+ }
233
+ }
@@ -1,170 +1,166 @@
1
1
  <script lang="ts">
2
- import "./Grav_Modal.css";
2
+ import "./Grav_Modal.css";
3
3
 
4
- // Define size type
5
- type ModalSize = "lg" | "md" | "sm" | "xs";
4
+ // Define size type
5
+ type ModalSize = "lg" | "md" | "sm" | "xs";
6
6
 
7
- // Props interface
8
- interface $$Props {
9
- title?: string;
10
- onClose?: () => void;
11
- onSave?: () => void;
12
- saveButtonText?: string;
13
- cancelButtonText?: string;
14
- saveButtonDisabled?: boolean;
15
- loading?: boolean;
16
- size?: ModalSize;
17
- isVista?: boolean;
18
- }
7
+ // Props interface
8
+ interface $$Props {
9
+ title?: string;
10
+ onClose?: () => void;
11
+ onSave?: () => void;
12
+ saveButtonText?: string;
13
+ cancelButtonText?: string;
14
+ saveButtonDisabled?: boolean;
15
+ loading?: boolean;
16
+ size?: ModalSize;
17
+ isVista?: boolean;
18
+ }
19
19
 
20
- // Default props
21
- export let title = "Modal Title";
22
- export let onClose = () => {};
23
- export let onSave = () => {};
24
- export let saveButtonText = "Guardar";
25
- export let cancelButtonText = "Cancelar";
26
- export let saveButtonDisabled = false;
27
- export let loading = false;
28
- export let size: ModalSize = "lg";
29
- export let isVista = false;
20
+ // Default props
21
+ export let title = "Modal Title";
22
+ export let onClose = () => {};
23
+ export let onSave = () => {};
24
+ export let saveButtonText = "Guardar";
25
+ export let cancelButtonText = "Cancelar";
26
+ export let saveButtonDisabled = false;
27
+ export let loading = false;
28
+ export let size: ModalSize = "lg";
29
+ export let isVista = false;
30
30
 
31
- // Size classes mapping
32
- const sizeClasses: Record<ModalSize, string> = {
33
- lg: "w-full min-h-screen",
34
- md: "sm:w-3/4 w-7/8 min-h-[80vh]",
35
- sm: "sm:w-1/3 w-3/4 min-h-[60vh]",
36
- xs: "sm:w-1/4 w-3/4 min-h-[40vh]",
37
- };
31
+ // Size classes mapping
32
+ const sizeClasses: Record<ModalSize, string> = {
33
+ lg: "w-full min-h-screen",
34
+ md: "sm:w-3/4 w-7/8 min-h-[80vh]",
35
+ sm: "sm:w-1/3 w-3/4 min-h-[60vh]",
36
+ xs: "sm:w-1/4 w-3/4 min-h-[40vh]",
37
+ };
38
38
 
39
- // Get the current size class
40
- $: currentSizeClass = sizeClasses[size];
39
+ // Get the current size class
40
+ $: currentSizeClass = sizeClasses[size];
41
41
 
42
- // Handle keydown event
43
- function handleKeydown(event: KeyboardEvent) {
44
- const target = event.target as HTMLElement;
45
- const isInputElement = target.tagName === "TEXTAREA";
42
+ // Handle keydown event
43
+ function handleKeydown(event: KeyboardEvent) {
44
+ const target = event.target as HTMLElement;
45
+ const isInputElement = target.tagName === "TEXTAREA";
46
46
 
47
- if (
48
- event.key === "Enter" &&
49
- !saveButtonDisabled &&
50
- !loading &&
51
- !isInputElement
52
- ) {
53
- event.preventDefault();
54
- event.stopPropagation();
55
- onSave();
56
- } else if (event.key === "Escape") {
57
- event.preventDefault();
58
- event.stopPropagation();
59
- onClose();
60
- }
47
+ if (
48
+ event.key === "Enter" &&
49
+ !saveButtonDisabled &&
50
+ !loading &&
51
+ !isInputElement
52
+ ) {
53
+ event.preventDefault();
54
+ event.stopPropagation();
55
+ onSave();
56
+ } else if (event.key === "Escape") {
57
+ event.preventDefault();
58
+ event.stopPropagation();
59
+ onClose();
61
60
  }
61
+ }
62
62
 
63
- // Handle click to focus the modal
64
- function handleClick(event: MouseEvent) {
65
- const target = event.target as HTMLElement;
66
- const currentTarget = event.currentTarget as HTMLElement;
63
+ // Handle click to focus the modal
64
+ function handleClick(event: MouseEvent) {
65
+ const target = event.target as HTMLElement;
66
+ const currentTarget = event.currentTarget as HTMLElement;
67
67
 
68
- // Only focus if clicking directly on the modal container
69
- if (target === currentTarget) {
70
- target.focus();
71
- }
68
+ // Only focus if clicking directly on the modal container
69
+ if (target === currentTarget) {
70
+ target.focus();
72
71
  }
72
+ }
73
73
  </script>
74
74
 
75
75
  <!-- svelte-ignore a11y-no-noninteractive-tabindex -->
76
76
  <div
77
- class="modal-overlay"
78
- on:keydown={handleKeydown}
79
- on:click={handleClick}
80
- tabindex="0"
77
+ class="modal-overlay"
78
+ on:keydown={handleKeydown}
79
+ on:click={handleClick}
80
+ tabindex="0"
81
81
  >
82
- <!--content-->
83
- <div class="modal-content {size}">
84
- <!-- Encabezado Modal -->
85
- <div class="modal-header">
86
- <h3 class="modal-title">
87
- {title}
88
- </h3>
89
- <!-- Cerrar Modal -->
90
- <button class="modal-close-button" on:click={onClose}>
91
- <svg
92
- xmlns="http://www.w3.org/2000/svg"
93
- class="modal-close-icon"
94
- fill="none"
95
- viewBox="0 0 24 24"
96
- stroke="currentColor"
97
- stroke-width="2"
98
- >
99
- <path
100
- stroke-linecap="round"
101
- stroke-linejoin="round"
102
- d="M6 18L18 6M6 6l12 12"
103
- />
104
- </svg>
105
- </button>
106
- <!-- /Cerrar Modal -->
107
- </div>
108
- <!-- Encabezado Modal -->
82
+ <!--content-->
83
+ <div class="modal-content {size}">
84
+ <!-- Encabezado Modal -->
85
+ <div class="modal-header">
86
+ <h3 class="modal-title">
87
+ {title}
88
+ </h3>
89
+ <!-- Cerrar Modal -->
90
+ <button class="modal-close-button" on:click={onClose}>
91
+ <svg
92
+ xmlns="http://www.w3.org/2000/svg"
93
+ class="modal-close-icon"
94
+ fill="none"
95
+ viewBox="0 0 24 24"
96
+ stroke="currentColor"
97
+ stroke-width="2"
98
+ >
99
+ <path
100
+ stroke-linecap="round"
101
+ stroke-linejoin="round"
102
+ d="M6 18L18 6M6 6l12 12"
103
+ />
104
+ </svg>
105
+ </button>
106
+ <!-- /Cerrar Modal -->
107
+ </div>
108
+ <!-- Encabezado Modal -->
109
109
 
110
- {#if loading}
111
- <div class="modal-loading">
112
- <div class="modal-loading-spinner">
113
- <svg
114
- class="modal-loading-svg"
115
- xmlns="http://www.w3.org/2000/svg"
116
- fill="none"
117
- viewBox="0 0 24 24"
118
- >
119
- <circle
120
- class="opacity-25"
121
- cx="12"
122
- cy="12"
123
- r="10"
124
- stroke="currentColor"
125
- stroke-width="4"
126
- />
127
- <path
128
- class="opacity-75"
129
- fill="currentColor"
130
- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
131
- />
132
- </svg>
133
- </div>
134
- </div>
135
- {:else}
136
- <!-- Cuerpo Modal -->
137
- <div class="modal-body">
138
- <slot />
139
- </div>
140
- <!-- /Cuerpo Modal -->
110
+ {#if loading}
111
+ <div class="modal-loading">
112
+ <div class="modal-loading-spinner">
113
+ <svg
114
+ class="modal-loading-svg"
115
+ xmlns="http://www.w3.org/2000/svg"
116
+ fill="none"
117
+ viewBox="0 0 24 24"
118
+ >
119
+ <circle
120
+ class="opacity-25"
121
+ cx="12"
122
+ cy="12"
123
+ r="10"
124
+ stroke="currentColor"
125
+ stroke-width="4"
126
+ />
127
+ <path
128
+ class="opacity-75"
129
+ fill="currentColor"
130
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
131
+ />
132
+ </svg>
133
+ </div>
134
+ </div>
135
+ {:else}
136
+ <!-- Cuerpo Modal -->
137
+ <div class="modal-body">
138
+ <slot />
139
+ </div>
140
+ <!-- /Cuerpo Modal -->
141
141
 
142
- {#if !isVista}
143
- <!-- Pie Modal -->
144
- <div class="modal-footer">
145
- <!-- Cerrar Modal -->
146
- <button
147
- class="modal-cancel-button"
148
- type="button"
149
- on:click={onClose}
150
- >
151
- {cancelButtonText}
152
- </button>
153
- <!-- /Cerrar Modal -->
154
- <!-- Btn Guardar -->
155
- <button
156
- class="modal-save-button"
157
- type="button"
158
- on:click={onSave}
159
- disabled={saveButtonDisabled}
160
- >
161
- {saveButtonText}
162
- </button>
163
- <!-- /Btn Guardar -->
164
- </div>
165
- <!-- /Pie Modal -->
166
- {/if}
167
- {/if}
168
- </div>
142
+ {#if !isVista}
143
+ <!-- Pie Modal -->
144
+ <div class="modal-footer">
145
+ <!-- Cerrar Modal -->
146
+ <button class="modal-cancel-button" type="button" on:click={onClose}>
147
+ {cancelButtonText}
148
+ </button>
149
+ <!-- /Cerrar Modal -->
150
+ <!-- Btn Guardar -->
151
+ <button
152
+ class="modal-save-button"
153
+ type="button"
154
+ on:click={onSave}
155
+ disabled={saveButtonDisabled}
156
+ >
157
+ {saveButtonText}
158
+ </button>
159
+ <!-- /Btn Guardar -->
160
+ </div>
161
+ <!-- /Pie Modal -->
162
+ {/if}
163
+ {/if}
164
+ </div>
169
165
  </div>
170
166
  <div class="modal-backdrop" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grav-svelte",
3
- "version": "0.0.92",
3
+ "version": "0.0.97",
4
4
  "description": "A collection of Svelte components",
5
5
  "license": "MIT",
6
6
  "scripts": {