better_ui 0.11.0 → 0.11.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '00009449be57c0f37a26ec5feaf84aed40f0304cdbbd144fa2bb833aaebafabb'
|
|
4
|
+
data.tar.gz: 863aeaaf75fbb73a6f52daac67df798dfea28da9f4ac5cccdb1497ff8fbaf894
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9702259de8df251e3f4cc363546d56377e2bb16fcb8b866256a13a86e5436cbf8aa05b60266db78374e340a8fc010de94a1c6caa856d53a4c3ea37b9b865940e
|
|
7
|
+
data.tar.gz: 0efe14f92f57900d1e6e7205c5ed9858685f648376ee4126e35bf16b93c6d949fbb1f0cf70d980858d11ce83c7ee944a4010c0651a3ac7dc27ce9061fabe4ec3
|
|
@@ -62,6 +62,116 @@ module BetterUi
|
|
|
62
62
|
xl: "shadow-xl"
|
|
63
63
|
}.freeze
|
|
64
64
|
|
|
65
|
+
# Variant-based CSS class mappings for table components
|
|
66
|
+
# Used for O(1) lookup instead of case/when statements
|
|
67
|
+
VARIANT_STRIPED = {
|
|
68
|
+
primary: "even:bg-primary-50",
|
|
69
|
+
secondary: "even:bg-secondary-50",
|
|
70
|
+
accent: "even:bg-accent-50",
|
|
71
|
+
success: "even:bg-success-50",
|
|
72
|
+
danger: "even:bg-danger-50",
|
|
73
|
+
warning: "even:bg-warning-50",
|
|
74
|
+
info: "even:bg-info-50",
|
|
75
|
+
light: "even:bg-grayscale-50",
|
|
76
|
+
dark: "even:bg-grayscale-700"
|
|
77
|
+
}.freeze
|
|
78
|
+
|
|
79
|
+
VARIANT_HOVERABLE = {
|
|
80
|
+
primary: "hover:bg-primary-100 transition-colors",
|
|
81
|
+
secondary: "hover:bg-secondary-100 transition-colors",
|
|
82
|
+
accent: "hover:bg-accent-100 transition-colors",
|
|
83
|
+
success: "hover:bg-success-100 transition-colors",
|
|
84
|
+
danger: "hover:bg-danger-100 transition-colors",
|
|
85
|
+
warning: "hover:bg-warning-100 transition-colors",
|
|
86
|
+
info: "hover:bg-info-100 transition-colors",
|
|
87
|
+
light: "hover:bg-grayscale-100 transition-colors",
|
|
88
|
+
dark: "hover:bg-grayscale-600 transition-colors"
|
|
89
|
+
}.freeze
|
|
90
|
+
|
|
91
|
+
VARIANT_HIGHLIGHTED = {
|
|
92
|
+
primary: "bg-primary-100",
|
|
93
|
+
secondary: "bg-secondary-100",
|
|
94
|
+
accent: "bg-accent-100",
|
|
95
|
+
success: "bg-success-100",
|
|
96
|
+
danger: "bg-danger-100",
|
|
97
|
+
warning: "bg-warning-100",
|
|
98
|
+
info: "bg-info-100",
|
|
99
|
+
light: "bg-grayscale-100",
|
|
100
|
+
dark: "bg-grayscale-700"
|
|
101
|
+
}.freeze
|
|
102
|
+
|
|
103
|
+
VARIANT_HEADER_BG = {
|
|
104
|
+
primary: "bg-primary-50",
|
|
105
|
+
secondary: "bg-secondary-50",
|
|
106
|
+
accent: "bg-accent-50",
|
|
107
|
+
success: "bg-success-50",
|
|
108
|
+
danger: "bg-danger-50",
|
|
109
|
+
warning: "bg-warning-50",
|
|
110
|
+
info: "bg-info-50",
|
|
111
|
+
light: "bg-grayscale-100",
|
|
112
|
+
dark: "bg-grayscale-800"
|
|
113
|
+
}.freeze
|
|
114
|
+
|
|
115
|
+
VARIANT_HEADER_TEXT = {
|
|
116
|
+
primary: "text-primary-900",
|
|
117
|
+
secondary: "text-secondary-900",
|
|
118
|
+
accent: "text-accent-900",
|
|
119
|
+
success: "text-success-900",
|
|
120
|
+
danger: "text-danger-900",
|
|
121
|
+
warning: "text-warning-900",
|
|
122
|
+
info: "text-info-900",
|
|
123
|
+
light: "text-grayscale-700",
|
|
124
|
+
dark: "text-grayscale-50"
|
|
125
|
+
}.freeze
|
|
126
|
+
|
|
127
|
+
VARIANT_DIVIDE = {
|
|
128
|
+
primary: "divide-y divide-primary-300",
|
|
129
|
+
secondary: "divide-y divide-secondary-300",
|
|
130
|
+
accent: "divide-y divide-accent-300",
|
|
131
|
+
success: "divide-y divide-success-300",
|
|
132
|
+
danger: "divide-y divide-danger-300",
|
|
133
|
+
warning: "divide-y divide-warning-300",
|
|
134
|
+
info: "divide-y divide-info-300",
|
|
135
|
+
light: "divide-y divide-grayscale-300",
|
|
136
|
+
dark: "divide-y divide-grayscale-700"
|
|
137
|
+
}.freeze
|
|
138
|
+
|
|
139
|
+
VARIANT_BODY_DIVIDE = {
|
|
140
|
+
primary: "divide-primary-200",
|
|
141
|
+
secondary: "divide-secondary-200",
|
|
142
|
+
accent: "divide-accent-200",
|
|
143
|
+
success: "divide-success-200",
|
|
144
|
+
danger: "divide-danger-200",
|
|
145
|
+
warning: "divide-warning-200",
|
|
146
|
+
info: "divide-info-200",
|
|
147
|
+
light: "divide-grayscale-200",
|
|
148
|
+
dark: "divide-grayscale-600"
|
|
149
|
+
}.freeze
|
|
150
|
+
|
|
151
|
+
VARIANT_RING = {
|
|
152
|
+
primary: "ring-primary-300",
|
|
153
|
+
secondary: "ring-secondary-300",
|
|
154
|
+
accent: "ring-accent-300",
|
|
155
|
+
success: "ring-success-300",
|
|
156
|
+
danger: "ring-danger-300",
|
|
157
|
+
warning: "ring-warning-300",
|
|
158
|
+
info: "ring-info-300",
|
|
159
|
+
light: "ring-grayscale-300",
|
|
160
|
+
dark: "ring-grayscale-700"
|
|
161
|
+
}.freeze
|
|
162
|
+
|
|
163
|
+
VARIANT_SORT_ICON = {
|
|
164
|
+
primary: "text-primary-700",
|
|
165
|
+
secondary: "text-secondary-700",
|
|
166
|
+
accent: "text-accent-700",
|
|
167
|
+
success: "text-success-700",
|
|
168
|
+
danger: "text-danger-700",
|
|
169
|
+
warning: "text-warning-700",
|
|
170
|
+
info: "text-info-700",
|
|
171
|
+
light: "text-grayscale-500",
|
|
172
|
+
dark: "text-grayscale-300"
|
|
173
|
+
}.freeze
|
|
174
|
+
|
|
65
175
|
private
|
|
66
176
|
|
|
67
177
|
# Normalizes a shadow parameter value.
|
|
@@ -40,48 +40,15 @@ module BetterUi
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def striped_classes
|
|
43
|
-
|
|
44
|
-
case @variant
|
|
45
|
-
when :primary then "even:bg-primary-50"
|
|
46
|
-
when :secondary then "even:bg-secondary-50"
|
|
47
|
-
when :accent then "even:bg-accent-50"
|
|
48
|
-
when :success then "even:bg-success-50"
|
|
49
|
-
when :danger then "even:bg-danger-50"
|
|
50
|
-
when :warning then "even:bg-warning-50"
|
|
51
|
-
when :info then "even:bg-info-50"
|
|
52
|
-
when :light then "even:bg-grayscale-50"
|
|
53
|
-
when :dark then "even:bg-grayscale-700"
|
|
54
|
-
end
|
|
43
|
+
@striped ? VARIANT_STRIPED[@variant] : nil
|
|
55
44
|
end
|
|
56
45
|
|
|
57
46
|
def hoverable_classes
|
|
58
|
-
|
|
59
|
-
case @variant
|
|
60
|
-
when :primary then "hover:bg-primary-100 transition-colors"
|
|
61
|
-
when :secondary then "hover:bg-secondary-100 transition-colors"
|
|
62
|
-
when :accent then "hover:bg-accent-100 transition-colors"
|
|
63
|
-
when :success then "hover:bg-success-100 transition-colors"
|
|
64
|
-
when :danger then "hover:bg-danger-100 transition-colors"
|
|
65
|
-
when :warning then "hover:bg-warning-100 transition-colors"
|
|
66
|
-
when :info then "hover:bg-info-100 transition-colors"
|
|
67
|
-
when :light then "hover:bg-grayscale-100 transition-colors"
|
|
68
|
-
when :dark then "hover:bg-grayscale-600 transition-colors"
|
|
69
|
-
end
|
|
47
|
+
@hoverable ? VARIANT_HOVERABLE[@variant] : nil
|
|
70
48
|
end
|
|
71
49
|
|
|
72
50
|
def highlighted_classes
|
|
73
|
-
|
|
74
|
-
case @variant
|
|
75
|
-
when :primary then "bg-primary-100"
|
|
76
|
-
when :secondary then "bg-secondary-100"
|
|
77
|
-
when :accent then "bg-accent-100"
|
|
78
|
-
when :success then "bg-success-100"
|
|
79
|
-
when :danger then "bg-danger-100"
|
|
80
|
-
when :warning then "bg-warning-100"
|
|
81
|
-
when :info then "bg-info-100"
|
|
82
|
-
when :light then "bg-grayscale-100"
|
|
83
|
-
when :dark then "bg-grayscale-700"
|
|
84
|
-
end
|
|
51
|
+
@highlighted ? VARIANT_HIGHLIGHTED[@variant] : nil
|
|
85
52
|
end
|
|
86
53
|
end
|
|
87
54
|
end
|
|
@@ -155,19 +155,9 @@ module BetterUi
|
|
|
155
155
|
variant_ring_color
|
|
156
156
|
end
|
|
157
157
|
|
|
158
|
-
# Variant ring color for bordered style
|
|
158
|
+
# Variant ring color for bordered style
|
|
159
159
|
def variant_ring_color
|
|
160
|
-
|
|
161
|
-
when :primary then "ring-primary-300"
|
|
162
|
-
when :secondary then "ring-secondary-300"
|
|
163
|
-
when :accent then "ring-accent-300"
|
|
164
|
-
when :success then "ring-success-300"
|
|
165
|
-
when :danger then "ring-danger-300"
|
|
166
|
-
when :warning then "ring-warning-300"
|
|
167
|
-
when :info then "ring-info-300"
|
|
168
|
-
when :light then "ring-grayscale-300"
|
|
169
|
-
when :dark then "ring-grayscale-700"
|
|
170
|
-
end
|
|
160
|
+
VARIANT_RING[@variant]
|
|
171
161
|
end
|
|
172
162
|
|
|
173
163
|
# <table> element classes
|
|
@@ -209,19 +199,9 @@ module BetterUi
|
|
|
209
199
|
])
|
|
210
200
|
end
|
|
211
201
|
|
|
212
|
-
# Variant body divide color
|
|
202
|
+
# Variant body divide color
|
|
213
203
|
def variant_body_divide_color
|
|
214
|
-
|
|
215
|
-
when :primary then "divide-primary-200"
|
|
216
|
-
when :secondary then "divide-secondary-200"
|
|
217
|
-
when :accent then "divide-accent-200"
|
|
218
|
-
when :success then "divide-success-200"
|
|
219
|
-
when :danger then "divide-danger-200"
|
|
220
|
-
when :warning then "divide-warning-200"
|
|
221
|
-
when :info then "divide-info-200"
|
|
222
|
-
when :light then "divide-grayscale-200"
|
|
223
|
-
when :dark then "divide-grayscale-600"
|
|
224
|
-
end
|
|
204
|
+
VARIANT_BODY_DIVIDE[@variant]
|
|
225
205
|
end
|
|
226
206
|
|
|
227
207
|
# <tfoot> classes
|
|
@@ -244,34 +224,14 @@ module BetterUi
|
|
|
244
224
|
])
|
|
245
225
|
end
|
|
246
226
|
|
|
247
|
-
# Variant header background
|
|
227
|
+
# Variant header background
|
|
248
228
|
def variant_header_bg
|
|
249
|
-
|
|
250
|
-
when :primary then "bg-primary-50"
|
|
251
|
-
when :secondary then "bg-secondary-50"
|
|
252
|
-
when :accent then "bg-accent-50"
|
|
253
|
-
when :success then "bg-success-50"
|
|
254
|
-
when :danger then "bg-danger-50"
|
|
255
|
-
when :warning then "bg-warning-50"
|
|
256
|
-
when :info then "bg-info-50"
|
|
257
|
-
when :light then "bg-grayscale-100"
|
|
258
|
-
when :dark then "bg-grayscale-800"
|
|
259
|
-
end
|
|
229
|
+
VARIANT_HEADER_BG[@variant]
|
|
260
230
|
end
|
|
261
231
|
|
|
262
|
-
# Variant header text color
|
|
232
|
+
# Variant header text color
|
|
263
233
|
def variant_header_text
|
|
264
|
-
|
|
265
|
-
when :primary then "text-primary-900"
|
|
266
|
-
when :secondary then "text-secondary-900"
|
|
267
|
-
when :accent then "text-accent-900"
|
|
268
|
-
when :success then "text-success-900"
|
|
269
|
-
when :danger then "text-danger-900"
|
|
270
|
-
when :warning then "text-warning-900"
|
|
271
|
-
when :info then "text-info-900"
|
|
272
|
-
when :light then "text-grayscale-700"
|
|
273
|
-
when :dark then "text-grayscale-50"
|
|
274
|
-
end
|
|
234
|
+
VARIANT_HEADER_TEXT[@variant]
|
|
275
235
|
end
|
|
276
236
|
|
|
277
237
|
# Collection mode: header cell classes
|
|
@@ -328,48 +288,16 @@ module BetterUi
|
|
|
328
288
|
end
|
|
329
289
|
|
|
330
290
|
def collection_striped_classes
|
|
331
|
-
|
|
332
|
-
case @variant
|
|
333
|
-
when :primary then "even:bg-primary-50"
|
|
334
|
-
when :secondary then "even:bg-secondary-50"
|
|
335
|
-
when :accent then "even:bg-accent-50"
|
|
336
|
-
when :success then "even:bg-success-50"
|
|
337
|
-
when :danger then "even:bg-danger-50"
|
|
338
|
-
when :warning then "even:bg-warning-50"
|
|
339
|
-
when :info then "even:bg-info-50"
|
|
340
|
-
when :light then "even:bg-grayscale-50"
|
|
341
|
-
when :dark then "even:bg-grayscale-700"
|
|
342
|
-
end
|
|
291
|
+
@striped ? VARIANT_STRIPED[@variant] : nil
|
|
343
292
|
end
|
|
344
293
|
|
|
345
294
|
def collection_hoverable_classes
|
|
346
|
-
|
|
347
|
-
case @variant
|
|
348
|
-
when :primary then "hover:bg-primary-100 transition-colors"
|
|
349
|
-
when :secondary then "hover:bg-secondary-100 transition-colors"
|
|
350
|
-
when :accent then "hover:bg-accent-100 transition-colors"
|
|
351
|
-
when :success then "hover:bg-success-100 transition-colors"
|
|
352
|
-
when :danger then "hover:bg-danger-100 transition-colors"
|
|
353
|
-
when :warning then "hover:bg-warning-100 transition-colors"
|
|
354
|
-
when :info then "hover:bg-info-100 transition-colors"
|
|
355
|
-
when :light then "hover:bg-grayscale-100 transition-colors"
|
|
356
|
-
when :dark then "hover:bg-grayscale-600 transition-colors"
|
|
357
|
-
end
|
|
295
|
+
@hoverable ? VARIANT_HOVERABLE[@variant] : nil
|
|
358
296
|
end
|
|
359
297
|
|
|
360
298
|
def collection_highlighted_classes(item)
|
|
361
299
|
return nil unless @row_highlighted && item && @row_highlighted.call(item)
|
|
362
|
-
|
|
363
|
-
when :primary then "bg-primary-100"
|
|
364
|
-
when :secondary then "bg-secondary-100"
|
|
365
|
-
when :accent then "bg-accent-100"
|
|
366
|
-
when :success then "bg-success-100"
|
|
367
|
-
when :danger then "bg-danger-100"
|
|
368
|
-
when :warning then "bg-warning-100"
|
|
369
|
-
when :info then "bg-info-100"
|
|
370
|
-
when :light then "bg-grayscale-100"
|
|
371
|
-
when :dark then "bg-grayscale-700"
|
|
372
|
-
end
|
|
300
|
+
VARIANT_HIGHLIGHTED[@variant]
|
|
373
301
|
end
|
|
374
302
|
|
|
375
303
|
# Collection mode: cell classes
|
|
@@ -392,19 +320,9 @@ module BetterUi
|
|
|
392
320
|
nil
|
|
393
321
|
end
|
|
394
322
|
|
|
395
|
-
# Table element divide classes
|
|
323
|
+
# Table element divide classes
|
|
396
324
|
def table_divide_classes
|
|
397
|
-
|
|
398
|
-
when :primary then "divide-y divide-primary-300"
|
|
399
|
-
when :secondary then "divide-y divide-secondary-300"
|
|
400
|
-
when :accent then "divide-y divide-accent-300"
|
|
401
|
-
when :success then "divide-y divide-success-300"
|
|
402
|
-
when :danger then "divide-y divide-danger-300"
|
|
403
|
-
when :warning then "divide-y divide-warning-300"
|
|
404
|
-
when :info then "divide-y divide-info-300"
|
|
405
|
-
when :light then "divide-y divide-grayscale-300"
|
|
406
|
-
when :dark then "divide-y divide-grayscale-700"
|
|
407
|
-
end
|
|
325
|
+
VARIANT_DIVIDE[@variant]
|
|
408
326
|
end
|
|
409
327
|
|
|
410
328
|
# First/last cell extra padding for card indentation
|
|
@@ -460,19 +378,7 @@ module BetterUi
|
|
|
460
378
|
|
|
461
379
|
# Collection mode: sort icon classes
|
|
462
380
|
def collection_sort_icon_classes(column)
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
case @variant
|
|
466
|
-
when :primary then "text-primary-700"
|
|
467
|
-
when :secondary then "text-secondary-700"
|
|
468
|
-
when :accent then "text-accent-700"
|
|
469
|
-
when :success then "text-success-700"
|
|
470
|
-
when :danger then "text-danger-700"
|
|
471
|
-
when :warning then "text-warning-700"
|
|
472
|
-
when :info then "text-info-700"
|
|
473
|
-
when :light then "text-grayscale-500"
|
|
474
|
-
when :dark then "text-grayscale-300"
|
|
475
|
-
end
|
|
381
|
+
effective_sorted?(column) ? VARIANT_SORT_ICON[@variant] : "text-grayscale-400"
|
|
476
382
|
end
|
|
477
383
|
|
|
478
384
|
# Collection mode: whether a column should render a sort link
|
data/lib/better_ui/version.rb
CHANGED