-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathBootstrapFramework.php
789 lines (669 loc) · 28.2 KB
/
BootstrapFramework.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
<?php
namespace Awssat\Tailwindo\Framework;
class BootstrapFramework implements Framework
{
protected $mediaOptions = [
'xs' => 'sm',
'sm' => 'sm',
'md' => 'md',
'lg' => 'lg',
'xl' => 'xl',
'print' => 'print',
];
protected $spacings = [
'0' => '0',
'1' => '1',
'2' => '2',
'3' => '4',
'4' => '6',
'5' => '12',
];
protected $grid = [
'1' => '1/6',
'2' => '1/5',
'3' => '1/4',
'4' => '1/3',
'5' => '2/5',
'6' => '1/2',
'7' => '3/5',
'8' => '2/3',
'9' => '3/4',
'10' => '4/5',
'11' => '5/6',
'12' => 'full',
];
protected $colors = [
'primary' => 'blue-600',
'secondary' => 'gray-600',
'success' => 'green-500',
'danger' => 'red-600',
'warning' => 'yellow-500',
'info' => 'teal-500',
'light' => 'gray-100',
'dark' => 'gray-900',
'white' => 'white',
'muted' => 'gray-700',
];
public function frameworkName(): string
{
return 'Bootstrap';
}
public function supportedVersion(): array
{
/**
* latest versions of Bootstrap/Tailwind during the coding of this file.
*/
return [
'4.4.1', // bootstrap
'1.4.0', //tailwind
];
}
/**
* This is the default css classes to be added to your main css file for compatibility.
*/
public function defaultCSS(): array
{
return [
//https://getbootstrap.com/docs/4.4/content/reboot/
'h1' => '',
//...
'fieldset' => '',
//https://getbootstrap.com/docs/4.4/content/typography/
'del' => '',
//..
'a' => '',
'p' => '',
];
}
/**
* .get all convertible items.
*/
public function get(): \Generator
{
foreach ([
'general',
'grid',
'borders',
'mediaObject',
'colors',
'display',
'sizing',
'flexElements',
'spacing',
'text',
'floats',
'positioning',
'visibility',
'alerts',
'verticalAlignment',
'badges',
'breadcrumb',
'buttons',
'cards',
'dropdowns',
'forms',
'inputGroups',
'listGroups',
'modals',
'navs',
'pagination',
] as $component) {
yield $this->$component();
}
}
protected function general(): array
{
$mainClasses = [
'container-fluid' => 'container max-w-full mx-auto sm:px-4',
'container' => function () {
if ($this->isInLastSearches('jumbotron', 1)) {
return 'container mx-auto max-w-2xl sm:px-4';
}
return 'container mx-auto sm:px-4';
},
//http://getbootstrap.com/docs/4.0/utilities/embed/
'embed-responsive' => '',
'embed-responsive-item' => '',
'embed-responsive-21by9' => '',
'embed-responsive-16by9' => '',
'embed-responsive-4by3' => '',
'embed-responsive-1by1' => '',
// http://getbootstrap.com/docs/4.0/utilities/image-replacement/
'text-hide' => '',
// http://getbootstrap.com/docs/4.0/utilities/screenreaders/
'sr-only' => 'sr-only',
'sr-only-focusable' => 'focus:not-sr-only',
// http://getbootstrap.com/docs/4.0/content/images/
'img-fluid' => 'max-w-full h-auto',
'img-thumbnail' => 'max-w-full h-auto border-1 border-gray-200 rounded p-1',
//http://getbootstrap.com/docs/4.0/content/tables/
'table' => 'w-full max-w-full mb-4 bg-transparent',
'table-sm' => 'p-1',
// 'table-bordered' => '',
// 'table-striped' => '',
'table-responsive' => 'block w-full overflow-auto scrolling-touch',
'table-responsive-{regex_string}' => 'block w-full overflow-auto scrolling-touch',
//http://getbootstrap.com/docs/4.0/content/figures/
'figure' => 'inline-block mb-4',
'figure-img' => 'mb-2 leading-none',
'figure-caption' => 'text-gray-',
'fade' => 'opacity-0',
'show' => 'opacity-100 block', //need to be checked
'disabled' => 'opacity-75',
//http://getbootstrap.com/docs/4.0/components/collapse/
// 'collapse' => 'hidden',
'collapsing' => 'relative h-0 overflow-hidden ', //there should be a h-0
//http://getbootstrap.com/docs/4.0/utilities/close-icon/
'close' => 'absolute top-0 bottom-0 right-0 px-4 py-3',
//http://getbootstrap.com/docs/4.0/components/jumbotron/
'jumbotron' => 'py-8 px-4 md:py-16 md:px-8 mb-8 bg-gray-200 rounded',
'jumbotron-fluid' => 'pr-0 pl-0 rounded-none',
];
$mainClassesEachScreen = [
'container-{screen}' => 'container min-w-{screen} mx-auto sm:px-4',
];
$items = [];
foreach ($mainClasses as $btClass => $twClass) {
$items[$btClass] = $twClass;
}
foreach ($mainClassesEachScreen as $btClass => $twClass) {
foreach ($this->mediaOptions as $btMedia => $twMedia) {
$items[str_replace('{screen}', $btMedia, $btClass)] = str_replace('{screen}', $twMedia, $twClass);
}
}
return $items;
}
protected function grid(): array
{
$items = [
'row' => 'flex flex-wrap ',
'col' => 'relative flex-grow max-w-full flex-1 px-4',
];
//col-(xs|sm|md|lg|xl) = (sm|md|lg|xl):flex-grow
//ml-(xs|sm|md|lg|xl)-auto = (sm|md|lg|xl):mx-auto:ml-auto
//mr-(xs|sm|md|lg|xl)-auto = (sm|md|lg|xl):mx-auto:mr-auto
foreach ($this->mediaOptions as $btMedia => $twMedia) {
$items['col-'.$btMedia] = 'relative '.$twMedia.':flex-grow '.$twMedia.':flex-1';
$items['ml-'.$btMedia.'-auto'] = $twMedia.':ml-auto';
$items['mr-'.$btMedia.'-auto'] = $twMedia.':mr-auto';
//col-btElem
//col-(xs|sm|md|lg|xl)-btElem = (sm|md|lg|xl):w-twElem
//offset-(xs|sm|md|lg|xl)-btElem = (sm|md|lg|xl):mx-auto
foreach ($this->grid as $btElem => $twElem) {
if ($btMedia === 'xs') {
$items['col-'.$btElem] = 'w-'.$twElem;
}
$items['col-'.$btMedia.'-'.$btElem] = $twMedia.':w-'.$twElem.' pr-4 pl-4';
//might work :)
$items['offset-'.$btMedia.'-'.$btElem] = $twMedia.':mx-'.$twElem;
}
}
return $items;
}
protected function mediaObject(): array
{
//http://getbootstrap.com/docs/4.0/layout/media-object/
return [
'media' => 'flex items-start',
'media-body' => 'flex-1',
];
}
protected function borders(): array
{
$items = [];
foreach ([
'top' => 't',
'right' => 'r',
'bottom' => 'b',
'left' => 'l',
] as $btSide => $twSide) {
$items['border-'.$btSide] = 'border-'.$twSide;
$items['border-'.$btSide.'-0'] = 'border-'.$twSide.'-0';
}
foreach ($this->colors as $btColor => $twColor) {
$items['border-'.$btColor] = 'border-'.$twColor;
}
foreach ([
'top' => 't',
'right' => 'r',
'bottom' => 'b',
'left' => 'l',
'circle' => 'full',
'pill' => 'full py-2 px-4',
'0' => 'none',
] as $btStyle => $twStyle) {
$items['rounded-'.$btStyle] = 'rounded-'.$twStyle;
}
return $items;
}
protected function colors(): array
{
$items = [];
foreach ($this->colors as $btColor => $twColor) {
$items['text-'.$btColor] = 'text-'.$twColor;
$items['bg-'.$btColor] = 'bg-'.$twColor;
$items['table-'.$btColor] = 'bg-'.$twColor;
// $items['bg-gradient-'.$btColor] = 'bg-'.$twColor;
}
return $items;
}
protected function display(): array
{
//.d-none
//.d-{sm,md,lg,xl}-none
$items = [];
foreach ([
'none' => 'hidden',
'inline' => 'inline',
'inline-block' => 'inline-block',
'block' => 'block',
'table' => 'table',
'table-cell' => 'table-cell',
'table-row' => 'table-row',
'flex' => 'flex',
'inline-flex' => 'inline-flex',
] as $btElem => $twElem) {
$items['d-'.$btElem] = $twElem;
foreach ($this->mediaOptions as $btMedia => $twMedia) {
$items['d-'.$btMedia.'-'.$btElem] = $twMedia.':'.$twElem;
}
}
return $items;
}
protected function flexElements(): array
{
$items = [];
foreach (array_merge($this->mediaOptions, [''=>'']) as $btMedia => $twMedia) {
foreach (['row', 'row-reverse', 'column', 'column-reverse'] as $key) {
$items['flex'.(empty($btMedia) ? '' : '-').$btMedia.'-'.$key] = (empty($twMedia) ? '' : $twMedia.':').'flex-'.str_replace('column', 'col', $key);
}
foreach (['grow-0', 'grow-1', 'shrink-0', 'shrink-1'] as $key) {
$items['flex'.(empty($btMedia) ? '' : '-').$btMedia.'-'.$key] = (empty($twMedia) ? '' : $twMedia.':').'flex-'.str_replace('-1', '', $key);
}
foreach (['start', 'end', 'center', 'between', 'around'] as $key) {
$items['justify-content'.(empty($btMedia) ? '' : '-').$btMedia.'-'.$key] = (empty($twMedia) ? '' : $twMedia.':').'justify-'.$key;
}
foreach (['start', 'end', 'center', 'stretch', 'baseline'] as $key) {
$items['align-items'.(empty($btMedia) ? '' : '-').$btMedia.'-'.$key] = (empty($twMedia) ? '' : $twMedia.':').'items-'.$key;
}
foreach (['start', 'end', 'center', 'stretch', 'baseline'] as $key) {
$items['align-content'.(empty($btMedia) ? '' : '-').$btMedia.'-'.$key] = (empty($twMedia) ? '' : $twMedia.':').'content-'.$key;
}
foreach (['start', 'end', 'center', 'stretch', 'baseline'] as $key) {
$items['align-self'.(empty($btMedia) ? '' : '-').$btMedia.'-'.$key] = (empty($twMedia) ? '' : $twMedia.':').'self-'.$key;
}
$items['flex'.(empty($btMedia) ? '' : '-').$btMedia.'-wrap'] = (empty($twMedia) ? '' : $twMedia.':').'flex-wrap';
$items['flex'.(empty($btMedia) ? '' : '-').$btMedia.'-wrap-reverse'] = (empty($twMedia) ? '' : $twMedia.':').'flex-wrap-reverse';
$items['flex'.(empty($btMedia) ? '' : '-').$btMedia.'-nowrap'] = (empty($twMedia) ? '' : $twMedia.':').'flex-no-wrap';
$items['flex'.(empty($btMedia) ? '' : '-').$btMedia.'-nowrap'] = (empty($twMedia) ? '' : $twMedia.':').'flex-no-wrap';
if ($btMedia != '') {
$items['order-'.$btMedia.'-{regex_number}'] = $twMedia.':order-{regex_number}';
}
}
return $items;
}
protected function sizing(): array
{
$items = [];
foreach ([
'25' => '1/4',
'50' => '1/2',
'75' => '3/4',
'100' => 'full',
] as $btClass => $twClass) {
$items['w-'.$btClass] = 'w-'.$twClass;
//no percentages in TW for heights except for full
if ($btClass == 100) {
$items['h-'.$btClass] = 'h-'.$twClass;
}
}
$items['mw-100'] = 'max-w-full';
$items['mh-100'] = 'max-h-full';
return $items;
}
protected function spacing(): array
{
$items = [];
$spacingProperties = ['p', 'm'];
foreach ($spacingProperties as $property) {
foreach ($this->spacings as $btSpacing => $twSpacing) {
$items[$property.'-'.$btSpacing] = $property.'-'.$twSpacing;
}
}
foreach ($spacingProperties as $property) {
foreach ($this->mediaOptions as $btMedia => $twMedia) {
foreach ($this->spacings as $btSpacing => $twSpacing) {
$items[$property.'-'.$btMedia.'-'.$btSpacing] = $twMedia.':'.$property.'-'.$twSpacing;
$items[$property.'{regex_string}-'.$btMedia.'-'.$btSpacing] = $twMedia.':'.$property.'{regex_string}-'.$twSpacing;
}
$items[$property.'{regex_string}-'.$btMedia.'-auto'] = $twMedia.':'.$property.'{regex_string}-auto';
}
}
return $items;
}
protected function text(): array
{
$items = [
'text-nowrap' => 'whitespace-nowrap',
'text-truncate' => 'truncate',
'text-lowercase' => 'lowercase',
'text-uppercase' => 'uppercase',
'text-capitalize' => 'capitalize',
'initialism' => '',
'lead' => 'text-xl font-light',
'small' => 'text-xs',
'mark' => '',
'display-1' => 'text-xl',
'display-2' => 'text-2xl',
'display-3' => 'text-3xl',
'display-4' => 'text-4xl',
'h-1' => 'mb-2 font-medium leading-tight text-4xl',
'h-2' => 'mb-2 font-medium leading-tight text-3xl',
'h-3' => 'mb-2 font-medium leading-tight text-2xl',
'h-4' => 'mb-2 font-medium leading-tight text-xl',
'h-5' => 'mb-2 font-medium leading-tight text-lg',
'h-6' => 'mb-2 font-medium leading-tight text-base',
'blockquote' => 'mb-6 text-lg',
'blockquote-footer' => 'block text-gray-',
'font-weight-bold' => 'font-bold',
'font-weight-normal' => 'font-normal',
'font-weight-300' => 'font-light',
'font-italic' => 'italic',
];
foreach (['left', 'right', 'center', 'justify'] as $alignment) {
foreach (array_merge($this->mediaOptions, [''=>'']) as $btMedia => $twMedia) {
$items['text'.(empty($btMedia) ? '' : '-'.$btMedia).'-'.$alignment] = (empty($twMedia) ? '' : $twMedia.':').'text-'.$alignment;
}
}
return $items;
}
protected function floats(): array
{
$items = [];
foreach ($this->mediaOptions as $btMedia => $twMedia) {
foreach (['left', 'right', 'none'] as $alignment) {
$items['float-'.$btMedia.'-'.$alignment] = $twMedia.':float-'.$alignment;
}
}
return $items;
}
protected function positioning(): array
{
$items = [];
foreach ([
'position-static' => 'static',
'position-relative' => 'relative',
'position-absolute' => 'absolute',
'position-fixed' => 'fixed',
'position-sticky' => '',
'fixed-top' => 'top-0',
'fixed-bottom' => 'bottom-0',
] as $btPosition => $twPosition) {
$items[$btPosition] = $twPosition;
}
return $items;
}
protected function verticalAlignment(): array
{
//same
$items = [];
// foreach ([
// 'baseline', 'top', 'middle', 'bottom', 'text-top', 'text-bottom'
// ] as $btAlign=> $twAlign) {
// $items['align-'.$btAlign] = 'align-'.$twAlign;
// }
return $items;
}
protected function visibility(): array
{
//same
return [];
}
protected function alerts()
{
$items = [
'alert' => 'relative px-3 py-3 mb-4 border rounded',
'alert-heading' => '', //color: inherit
'alert-link' => 'font-bold no-underline text-current',
'alert-dismissible' => '',
];
$colors = [
'primary' => 'bg-blue-200 border-blue-300 text-blue-800',
'secondary' => 'bg-gray-300 border-gray-400 text-gray-800',
'success' => 'bg-green-200 border-green-300 text-green-800',
'danger' => 'bg-red-200 border-red-300 text-red-800',
'warning' => 'bg-orange-200 border-orange-300 text-orange-800',
'info' => 'bg-teal-200 border-teal-300 text-teal-800',
'light' => 'bg-white text-gray-600',
'dark' => 'bg-gray-400 border-gray-500 text-gray-900',
];
foreach ($colors as $btColor => $twColor) {
$items['alert-'.$btColor] = $twColor;
}
return $items;
}
protected function badges(): array
{
$items = [
'badge' => 'inline-block p-1 text-center font-semibold text-sm align-baseline leading-none rounded',
'badge-pill' => 'rounded-full py-1 px-3',
];
$colors = [
'primary' => 'bg-blue-500 text-white hover:bg-blue-600',
'secondary' => 'bg-gray-600 text-white hover:bg-gray-700',
'success' => 'bg-green-500 text-white hover:green-600',
'danger' => 'bg-red-600 text-white hover:bg-red-700',
'warning' => 'bg-orange-400 text-black hover:bg-orange-500',
'info' => 'bg-teal-500 text-white hover:bg-teal-600',
'light' => 'bg-gray-100 text-gray-800 hover:bg-gray-200',
'dark' => 'bg-gray-900 text-white',
];
foreach ($colors as $btColor => $twColor) {
$items['badge-'.$btColor] = $twColor;
}
return $items;
}
protected function breadcrumb(): array
{
return [
'breadcrumb' => 'flex flex-wrap list-reset pt-3 pb-3 py-4 px-4 mb-4 bg-gray-200 rounded',
'breadcrumb-item'=> 'inline-block px-2 py-2 text-gray-700',
];
}
protected function buttons(): array
{
$items = [
'btn' => 'inline-block align-middle text-center select-none border font-normal whitespace-no-wrap rounded {tailwindo|py-1 px-3 leading-normal} no-underline',
'btn-group' => 'relative inline-flex align-middle',
'btn-group-vertical' => 'relative inline-flex align-middle flex-col items-start justify-center',
'btn-toolbar' => 'flex flex-wrap justify-start',
'btn-link' => 'font-normal text-blue-700 bg-transparent',
'btn-block' => 'block w-full',
];
foreach ([
'sm' => '{tailwindo|py-1 px-2 leading-tight} text-xs ',
'lg' => '{tailwindo|py-3 px-4 leading-tight} text-xl',
] as $btMedia => $twClasses) {
$items['btn-'.$btMedia] = $twClasses;
$items['btn-group-'.$btMedia] = $twClasses;
}
$colors = [
'primary' => 'bg-blue-600 text-white hover:bg-blue-600',
'secondary' => 'bg-gray-600 text-white hover:bg-gray-700',
'success' => 'bg-green-500 text-white hover:bg-green-600',
'danger' => 'bg-red-600 text-white hover:bg-red-700',
'warning' => 'bg-orange-400 text-black hover:bg-orange-500',
'info' => 'bg-teal-500 text-white hover:bg-teal-600',
'light' => 'bg-gray-100 text-gray-800 hover:bg-gray-200',
'dark' => 'bg-gray-900 text-white hover:bg-gray-900',
];
foreach ($colors as $btColor => $twColor) {
$items['btn-'.$btColor] = $twColor;
$items['btn-outline-'.$btColor] = preg_replace_callback('/(?<!hover:)(text-[^\s]+|bg-[^\s]+)/i', function ($m) {
if (strpos($m[1], 'bg-') !== false) {
$color = str_replace('bg-', '', $m[1]);
return 'text-'.$color.' border-'.$color.' hover:bg-'.$color.' hover:text-white';
} else {
return 'bg-white';
}
}, $twColor);
}
return $items;
}
protected function cards(): array
{
return [
'card-deck' => 'flex flex-row flex-wrap md:flex-no-wrap -mx-1',
'card-group' => 'flex flex-col',
'card' => function () {
if ($this->isInLastSearches('card-deck')) {
return 'relative block md:flex w-full md:min-w-0 md:mx-4 flex-col flex-no-shrink flex-grow rounded break-words border bg-white border-1 border-gray-300';
} else {
return 'relative flex flex-col min-w-0 rounded break-words border bg-white border-1 border-gray-300';
}
},
'card-body' => 'flex-auto p-6',
'card-title' => 'mb-3',
'card-text' => 'mb-0',
'card-subtitle' => '-mt-2 mb-0',
'card-link' => 'ml-6',
'card-header' => 'py-3 px-6 mb-0 bg-gray-200 border-b-1 border-gray-300 text-gray-900',
'card-footer' => 'py-3 px-6 bg-gray-200 border-t-1 border-gray-300',
'card-header-tabs' => 'border-b-0 -ml-2 -mb-3',
'card-header-pills' => '-ml-3 -mr-3',
'card-img-overlay' => 'absolute inset-y-0 inset-x-0 p-6',
'card-img' => 'w-full rounded',
'card-img-top' => 'w-full rounded rounded-t',
'card-img-bottom' => 'w-full rounded rounded-b',
];
}
protected function dropdowns(): array
{
return [
'dropdown' => 'relative',
'dropup' => 'relative',
'dropdown-toggle' => ' inline-block w-0 h-0 ml-1 align border-b-0 border-t-1 border-r-1 border-l-1',
'dropdown-menu' => ' absolute left-0 z-50 float-left hidden list-reset py-2 mt-1 text-base bg-white border border-gray-300 rounded',
'dropdown-divider' => 'h-0 my-2 overflow-hidden border-t-1 border-gray-300',
'dropdown-item' => 'block w-full py-1 px-6 font-normal text-gray-900 whitespace-no-wrap border-0',
'dropdown-header' => 'block py-2 px-6 mb-0 text-sm text-gray-800 whitespace-no-wrap',
];
}
protected function forms(): array
{
return [
'form-group' => 'mb-4',
'form-control' => 'block appearance-none w-full py-1 px-2 mb-1 text-base leading-normal bg-white text-gray-800 border border-gray-200 rounded',
'form-control-lg' => 'py-2 px-4 text-lg leading-normal rounded',
'form-control-sm' => 'py-1 px-2 text-sm leading-normal rounded',
'form-control-file' => 'block appearance-none',
'form-control-range' => 'block appearance-none',
'form-inline' => 'flex items-center',
'col-form-label' => 'pt-2 pb-2 mb-0 leading-normal',
'col-form-label-lg' => 'pt-3 pb-3 mb-0 leading-normal',
'col-form-label-sm' => 'pt-1 pb-1 mb-0 leading-normal',
'col-form-legend' => 'pt-2 pb-2 mb-0 text-base',
'col-form-plaintext' => 'pt-2 pb-2 mb-0 leading-normal bg-transparent border-transparent border-r-0 border-l-0 border-t border-b',
'form-text' => 'block mt-1',
'form-row' => 'flex flex-wrap -mr-1 -ml-1',
'form-check' => 'relative block mb-2',
'form-check-label' => 'text-gray-700 pl-6 mb-0',
'form-check-input' => 'absolute mt-1 -ml-6',
'form-check-inline' => 'inline-block mr-2',
'valid-feedback' => 'hidden mt-1 text-sm text-green',
'valid-tooltip' => 'absolute z-10 hidden w-4 font-normal leading-normal text-white rounded p-2 bg-green-700',
'is-valid' => 'bg-green-700',
'invalid-feedback' => 'hidden mt-1 text-sm text-red',
'invalid-tooltip' => 'absolute z-10 hidden w-4 font-normal leading-normal text-white rounded p-2 bg-red-700',
'is-invalid' => 'bg-red-700',
];
}
protected function inputGroups(): array
{
return [
'input-group' => 'relative flex items-stretch w-full',
'input-group-addon' => 'py-1 px-2 mb-1 text-base font-normal leading-normal text-gray-900 text-center bg-gray-300 border border-4 border-gray-100 rounded',
'input-group-addon-lg' => 'py-2 px-3 mb-0 text-lg',
'input-group-addon-sm' => 'py-3 px-4 mb-0 text-lg',
];
}
protected function listGroups(): array
{
$items = [
'list-group' => 'flex flex-col pl-0 mb-0 border rounded border-gray-300',
'list-group-item-action' => 'w-full',
'list-group-item' => 'relative block py-3 px-6 -mb-px border border-r-0 border-l-0 border-gray-300 no-underline',
'list-group-flush' => '',
];
//TODO
foreach ($this->colors as $btColor => $twColor) {
if ($btColor === 'dark') {
$items['list-group-item-'.$btColor] = 'text-white bg-gray-700';
} elseif ($btColor == 'light') {
$items['list-group-item-'.$btColor] = 'text-black bg-gray-200';
} else {
$items['list-group-item-'.$btColor] = 'bg-'.$twColor.'-200 text-'.$twColor.'-900';
}
}
return $items;
}
protected function modals(): array
{
//TODO
return [];
}
protected function navs(): array
{
$items = [
'nav' => 'flex flex-wrap list-none pl-0 mb-0',
'nav-tabs' => 'border border-t-0 border-r-0 border-l-0 border-b-1 border-gray-200',
'nav-pills' => '',
'nav-fill' => '',
'nav-justified' => '',
];
$items['nav-link'] = function () {
$navLinkClasses = 'inline-block py-2 px-4 no-underline';
if ($this->isInLastSearches('nav-tabs', 5)) {
$navLinkClasses .= ' border border-b-0 mx-1 rounded rounded-t';
} elseif ($this->isInLastSearches('nav-pills', 5)) {
$navLinkClasses .= ' border border-blue bg-blue rounded text-white mx-1';
}
return $navLinkClasses;
};
$items['nav-item'] = function () {
$navItemClasses = '';
if ($this->isInLastSearches('nav-tabs', 5)) {
$navItemClasses .= '-mb-px';
} elseif ($this->isInLastSearches('nav-fill', 5)) {
$navItemClasses .= ' flex-auto text-center';
} elseif ($this->isInLastSearches('nav-justified', 5)) {
$navItemClasses .= ' flex-grow text-center';
}
return $navItemClasses;
};
$items['navbar'] = 'relative flex flex-wrap items-center content-between py-3 px-4';
$items['navbar-brand'] = 'inline-block pt-1 pb-1 mr-4 text-lg whitespace-no-wrap';
$items['navbar-nav'] = 'flex flex-wrap list-reset pl-0 mb-0';
$items['navbar-text'] = 'inline-block pt-2 pb-2';
$items['navbar-dark'] = 'text-white';
$items['navbar-light'] = 'text-black';
$items['navbar-collapse'] = 'flex-grow items-center';
$items['navbar-expand'] = 'flex-no-wrap content-start';
$items['navbar-expand-{regex_string}'] = '';
$items['navbar-toggler'] = 'py-1 px-2 text-md leading-normal bg-transparent border border-transparent rounded';
//for now
$items['collapse'] = 'hidden';
$items['navbar-toggler-icon'] = 'px-5 py-1 border border-gray-600 rounded';
return $items;
}
protected function pagination(): array
{
return [
'pagination' => 'flex list-reset pl-0 rounded',
'pagination-lg' => 'text-xl',
'pagination-sm' => 'text-sm',
'page-link' => 'relative block py-2 px-3 -ml-px leading-normal text-blue bg-white border border-gray-200 no-underline hover:text-blue-800 hover:bg-gray-200',
// 'page-link' => 'relative block py-2 px-3 -ml-px leading-normal text-blue bg-white border border-gray-',
];
}
}