okonomi_ui_kit 0.1.6 → 0.1.8

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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +163 -7
  3. data/app/assets/builds/okonomi_ui_kit/application.tailwind.css +292 -4
  4. data/app/helpers/okonomi_ui_kit/component.rb +81 -0
  5. data/app/helpers/okonomi_ui_kit/components/badge.rb +21 -16
  6. data/app/helpers/okonomi_ui_kit/components/breadcrumbs.rb +69 -0
  7. data/app/helpers/okonomi_ui_kit/components/button_base.rb +56 -0
  8. data/app/helpers/okonomi_ui_kit/components/button_tag.rb +23 -0
  9. data/app/helpers/okonomi_ui_kit/components/button_to.rb +23 -0
  10. data/app/helpers/okonomi_ui_kit/components/code.rb +73 -0
  11. data/app/helpers/okonomi_ui_kit/components/icon.rb +36 -0
  12. data/app/helpers/okonomi_ui_kit/components/link_to.rb +23 -0
  13. data/app/helpers/okonomi_ui_kit/components/page.rb +247 -0
  14. data/app/helpers/okonomi_ui_kit/components/table.rb +207 -0
  15. data/app/helpers/okonomi_ui_kit/components/typography.rb +29 -3
  16. data/app/helpers/okonomi_ui_kit/config.rb +20 -0
  17. data/app/helpers/okonomi_ui_kit/form_builder.rb +2 -2
  18. data/app/helpers/okonomi_ui_kit/t_w_merge.rb +108 -0
  19. data/app/helpers/okonomi_ui_kit/theme.rb +3 -26
  20. data/app/helpers/okonomi_ui_kit/ui_helper.rb +0 -40
  21. data/app/views/okonomi/components/breadcrumbs/_breadcrumbs.html.erb +46 -0
  22. data/app/views/okonomi/components/code/_code.html.erb +1 -0
  23. data/app/views/okonomi/components/icon/_icon.html.erb +38 -0
  24. data/app/views/okonomi/components/page/_page.html.erb +5 -0
  25. data/app/views/okonomi/components/table/_table.html.erb +3 -0
  26. data/app/views/okonomi/forms/tailwind/_upload_field.html.erb +2 -2
  27. data/app/views/okonomi/modals/_confirmation_modal.html.erb +2 -2
  28. data/app/views/okonomi/navigation/_link.html.erb +1 -1
  29. data/lib/okonomi_ui_kit/engine.rb +0 -5
  30. data/lib/okonomi_ui_kit/version.rb +1 -1
  31. metadata +18 -7
  32. data/app/helpers/okonomi_ui_kit/badge_helper.rb +0 -23
  33. data/app/helpers/okonomi_ui_kit/breadcrumbs_helper.rb +0 -60
  34. data/app/helpers/okonomi_ui_kit/icon_helper.rb +0 -39
  35. data/app/helpers/okonomi_ui_kit/page_builder_helper.rb +0 -217
  36. data/app/helpers/okonomi_ui_kit/table_helper.rb +0 -158
@@ -32,6 +32,7 @@
32
32
  --color-yellow-200: oklch(94.5% 0.129 101.54);
33
33
  --color-yellow-400: oklch(85.2% 0.199 91.936);
34
34
  --color-yellow-500: oklch(79.5% 0.184 86.047);
35
+ --color-yellow-600: oklch(68.1% 0.162 75.834);
35
36
  --color-yellow-700: oklch(55.4% 0.135 66.442);
36
37
  --color-yellow-800: oklch(47.6% 0.114 61.907);
37
38
  --color-green-50: oklch(98.2% 0.018 155.826);
@@ -44,6 +45,7 @@
44
45
  --color-green-700: oklch(52.7% 0.154 150.069);
45
46
  --color-green-800: oklch(44.8% 0.119 151.328);
46
47
  --color-green-900: oklch(39.3% 0.095 152.535);
48
+ --color-cyan-600: oklch(60.9% 0.126 221.723);
47
49
  --color-sky-50: oklch(97.7% 0.013 236.62);
48
50
  --color-sky-100: oklch(95.1% 0.026 236.824);
49
51
  --color-sky-200: oklch(90.1% 0.058 230.902);
@@ -118,18 +120,27 @@
118
120
  --text-3xl--line-height: calc(2.25 / 1.875);
119
121
  --text-4xl: 2.25rem;
120
122
  --text-4xl--line-height: calc(2.5 / 2.25);
123
+ --text-5xl: 3rem;
124
+ --text-5xl--line-height: 1;
121
125
  --text-6xl: 3.75rem;
122
126
  --text-6xl--line-height: 1;
127
+ --font-weight-light: 300;
123
128
  --font-weight-normal: 400;
124
129
  --font-weight-medium: 500;
125
130
  --font-weight-semibold: 600;
126
131
  --font-weight-bold: 700;
127
132
  --tracking-tight: -0.025em;
133
+ --tracking-wide: 0.025em;
134
+ --tracking-wider: 0.05em;
135
+ --leading-tight: 1.25;
136
+ --leading-relaxed: 1.625;
128
137
  --radius-sm: 0.25rem;
129
138
  --radius-md: 0.375rem;
130
139
  --radius-lg: 0.5rem;
131
140
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
132
141
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
142
+ --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
143
+ --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
133
144
  --default-transition-duration: 150ms;
134
145
  --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
135
146
  --default-font-family: var(--font-sans);
@@ -371,6 +382,9 @@
371
382
  .left-0 {
372
383
  left: calc(var(--spacing) * 0);
373
384
  }
385
+ .isolate {
386
+ isolation: isolate;
387
+ }
374
388
  .z-10 {
375
389
  z-index: 10;
376
390
  }
@@ -607,6 +621,9 @@
607
621
  .max-w-none {
608
622
  max-width: none;
609
623
  }
624
+ .max-w-prose {
625
+ max-width: 65ch;
626
+ }
610
627
  .max-w-xs {
611
628
  max-width: var(--container-xs);
612
629
  }
@@ -619,6 +636,9 @@
619
636
  .flex-shrink {
620
637
  flex-shrink: 1;
621
638
  }
639
+ .flex-shrink-0 {
640
+ flex-shrink: 0;
641
+ }
622
642
  .shrink-0 {
623
643
  flex-shrink: 0;
624
644
  }
@@ -663,9 +683,18 @@
663
683
  .transform {
664
684
  transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
665
685
  }
686
+ .animate-pulse {
687
+ animation: var(--animate-pulse);
688
+ }
689
+ .cursor-not-allowed {
690
+ cursor: not-allowed;
691
+ }
666
692
  .cursor-pointer {
667
693
  cursor: pointer;
668
694
  }
695
+ .cursor-wait {
696
+ cursor: wait;
697
+ }
669
698
  .resize {
670
699
  resize: both;
671
700
  }
@@ -772,6 +801,13 @@
772
801
  .gap-x-3 {
773
802
  column-gap: calc(var(--spacing) * 3);
774
803
  }
804
+ .-space-x-px {
805
+ :where(& > :not(:last-child)) {
806
+ --tw-space-x-reverse: 0;
807
+ margin-inline-start: calc(-1px * var(--tw-space-x-reverse));
808
+ margin-inline-end: calc(-1px * calc(1 - var(--tw-space-x-reverse)));
809
+ }
810
+ }
775
811
  .space-x-2 {
776
812
  :where(& > :not(:last-child)) {
777
813
  --tw-space-x-reverse: 0;
@@ -779,6 +815,13 @@
779
815
  margin-inline-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)));
780
816
  }
781
817
  }
818
+ .space-x-3 {
819
+ :where(& > :not(:last-child)) {
820
+ --tw-space-x-reverse: 0;
821
+ margin-inline-start: calc(calc(var(--spacing) * 3) * var(--tw-space-x-reverse));
822
+ margin-inline-end: calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-x-reverse)));
823
+ }
824
+ }
782
825
  .space-x-4 {
783
826
  :where(& > :not(:last-child)) {
784
827
  --tw-space-x-reverse: 0;
@@ -845,6 +888,9 @@
845
888
  .rounded-md {
846
889
  border-radius: var(--radius-md);
847
890
  }
891
+ .rounded-none {
892
+ border-radius: 0;
893
+ }
848
894
  .rounded-sm {
849
895
  border-radius: var(--radius-sm);
850
896
  }
@@ -883,6 +929,12 @@
883
929
  .border-blue-200 {
884
930
  border-color: var(--color-blue-200);
885
931
  }
932
+ .border-blue-500 {
933
+ border-color: var(--color-blue-500);
934
+ }
935
+ .border-blue-600 {
936
+ border-color: var(--color-blue-600);
937
+ }
886
938
  .border-danger-600 {
887
939
  border-color: var(--color-danger-600);
888
940
  }
@@ -901,6 +953,9 @@
901
953
  .border-gray-300 {
902
954
  border-color: var(--color-gray-300);
903
955
  }
956
+ .border-gray-500 {
957
+ border-color: var(--color-gray-500);
958
+ }
904
959
  .border-gray-600 {
905
960
  border-color: var(--color-gray-600);
906
961
  }
@@ -955,6 +1010,9 @@
955
1010
  .bg-blue-100 {
956
1011
  background-color: var(--color-blue-100);
957
1012
  }
1013
+ .bg-blue-500 {
1014
+ background-color: var(--color-blue-500);
1015
+ }
958
1016
  .bg-blue-600 {
959
1017
  background-color: var(--color-blue-600);
960
1018
  }
@@ -1087,6 +1145,9 @@
1087
1145
  .py-1 {
1088
1146
  padding-block: calc(var(--spacing) * 1);
1089
1147
  }
1148
+ .py-1\.5 {
1149
+ padding-block: calc(var(--spacing) * 1.5);
1150
+ }
1090
1151
  .py-2 {
1091
1152
  padding-block: calc(var(--spacing) * 2);
1092
1153
  }
@@ -1159,6 +1220,9 @@
1159
1220
  .align-middle {
1160
1221
  vertical-align: middle;
1161
1222
  }
1223
+ .font-mono {
1224
+ font-family: var(--font-mono);
1225
+ }
1162
1226
  .text-2xl {
1163
1227
  font-size: var(--text-2xl);
1164
1228
  line-height: var(--tw-leading, var(--text-2xl--line-height));
@@ -1218,10 +1282,22 @@
1218
1282
  --tw-leading: calc(var(--spacing) * 7);
1219
1283
  line-height: calc(var(--spacing) * 7);
1220
1284
  }
1285
+ .leading-relaxed {
1286
+ --tw-leading: var(--leading-relaxed);
1287
+ line-height: var(--leading-relaxed);
1288
+ }
1289
+ .leading-tight {
1290
+ --tw-leading: var(--leading-tight);
1291
+ line-height: var(--leading-tight);
1292
+ }
1221
1293
  .font-bold {
1222
1294
  --tw-font-weight: var(--font-weight-bold);
1223
1295
  font-weight: var(--font-weight-bold);
1224
1296
  }
1297
+ .font-light {
1298
+ --tw-font-weight: var(--font-weight-light);
1299
+ font-weight: var(--font-weight-light);
1300
+ }
1225
1301
  .font-medium {
1226
1302
  --tw-font-weight: var(--font-weight-medium);
1227
1303
  font-weight: var(--font-weight-medium);
@@ -1234,6 +1310,18 @@
1234
1310
  --tw-font-weight: var(--font-weight-semibold);
1235
1311
  font-weight: var(--font-weight-semibold);
1236
1312
  }
1313
+ .tracking-tight {
1314
+ --tw-tracking: var(--tracking-tight);
1315
+ letter-spacing: var(--tracking-tight);
1316
+ }
1317
+ .tracking-wide {
1318
+ --tw-tracking: var(--tracking-wide);
1319
+ letter-spacing: var(--tracking-wide);
1320
+ }
1321
+ .tracking-wider {
1322
+ --tw-tracking: var(--tracking-wider);
1323
+ letter-spacing: var(--tracking-wider);
1324
+ }
1237
1325
  .whitespace-nowrap {
1238
1326
  white-space: nowrap;
1239
1327
  }
@@ -1249,6 +1337,9 @@
1249
1337
  .text-blue-900 {
1250
1338
  color: var(--color-blue-900);
1251
1339
  }
1340
+ .text-cyan-600 {
1341
+ color: var(--color-cyan-600);
1342
+ }
1252
1343
  .text-danger-400 {
1253
1344
  color: var(--color-danger-400);
1254
1345
  }
@@ -1315,6 +1406,9 @@
1315
1406
  .text-primary-700 {
1316
1407
  color: var(--color-primary-700);
1317
1408
  }
1409
+ .text-purple-600 {
1410
+ color: var(--color-purple-600);
1411
+ }
1318
1412
  .text-red-500 {
1319
1413
  color: var(--color-red-500);
1320
1414
  }
@@ -1345,18 +1439,27 @@
1345
1439
  .text-yellow-500 {
1346
1440
  color: var(--color-yellow-500);
1347
1441
  }
1442
+ .text-yellow-600 {
1443
+ color: var(--color-yellow-600);
1444
+ }
1348
1445
  .text-yellow-700 {
1349
1446
  color: var(--color-yellow-700);
1350
1447
  }
1351
1448
  .text-yellow-800 {
1352
1449
  color: var(--color-yellow-800);
1353
1450
  }
1451
+ .uppercase {
1452
+ text-transform: uppercase;
1453
+ }
1354
1454
  .underline {
1355
1455
  text-decoration-line: underline;
1356
1456
  }
1357
1457
  .opacity-0 {
1358
1458
  opacity: 0%;
1359
1459
  }
1460
+ .opacity-50 {
1461
+ opacity: 50%;
1462
+ }
1360
1463
  .opacity-100 {
1361
1464
  opacity: 100%;
1362
1465
  }
@@ -1368,6 +1471,14 @@
1368
1471
  --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
1369
1472
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1370
1473
  }
1474
+ .shadow-md {
1475
+ --tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
1476
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1477
+ }
1478
+ .shadow-none {
1479
+ --tw-shadow: 0 0 #0000;
1480
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1481
+ }
1371
1482
  .shadow-sm {
1372
1483
  --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
1373
1484
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
@@ -1380,6 +1491,10 @@
1380
1491
  --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
1381
1492
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1382
1493
  }
1494
+ .ring-2 {
1495
+ --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
1496
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1497
+ }
1383
1498
  .ring-black {
1384
1499
  --tw-ring-color: var(--color-black);
1385
1500
  }
@@ -1395,6 +1510,10 @@
1395
1510
  .ring-gray-300 {
1396
1511
  --tw-ring-color: var(--color-gray-300);
1397
1512
  }
1513
+ .ring-offset-2 {
1514
+ --tw-ring-offset-width: 2px;
1515
+ --tw-ring-offset-shadow: var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
1516
+ }
1398
1517
  .outline-hidden {
1399
1518
  --tw-outline-style: none;
1400
1519
  outline-style: none;
@@ -1462,6 +1581,10 @@
1462
1581
  --tw-ease: var(--ease-in);
1463
1582
  transition-timing-function: var(--ease-in);
1464
1583
  }
1584
+ .ease-in-out {
1585
+ --tw-ease: var(--ease-in-out);
1586
+ transition-timing-function: var(--ease-in-out);
1587
+ }
1465
1588
  .ease-out {
1466
1589
  --tw-ease: var(--ease-out);
1467
1590
  transition-timing-function: var(--ease-out);
@@ -1519,6 +1642,14 @@
1519
1642
  }
1520
1643
  }
1521
1644
  }
1645
+ .hover\:border-12 {
1646
+ &:hover {
1647
+ @media (hover: hover) {
1648
+ border-style: var(--tw-border-style);
1649
+ border-width: 12px;
1650
+ }
1651
+ }
1652
+ }
1522
1653
  .hover\:border-gray-300 {
1523
1654
  &:hover {
1524
1655
  @media (hover: hover) {
@@ -1526,6 +1657,20 @@
1526
1657
  }
1527
1658
  }
1528
1659
  }
1660
+ .hover\:bg-blue-500 {
1661
+ &:hover {
1662
+ @media (hover: hover) {
1663
+ background-color: var(--color-blue-500);
1664
+ }
1665
+ }
1666
+ }
1667
+ .hover\:bg-blue-600 {
1668
+ &:hover {
1669
+ @media (hover: hover) {
1670
+ background-color: var(--color-blue-600);
1671
+ }
1672
+ }
1673
+ }
1529
1674
  .hover\:bg-blue-700 {
1530
1675
  &:hover {
1531
1676
  @media (hover: hover) {
@@ -1575,6 +1720,20 @@
1575
1720
  }
1576
1721
  }
1577
1722
  }
1723
+ .hover\:bg-gray-500 {
1724
+ &:hover {
1725
+ @media (hover: hover) {
1726
+ background-color: var(--color-gray-500);
1727
+ }
1728
+ }
1729
+ }
1730
+ .hover\:bg-gray-600 {
1731
+ &:hover {
1732
+ @media (hover: hover) {
1733
+ background-color: var(--color-gray-600);
1734
+ }
1735
+ }
1736
+ }
1578
1737
  .hover\:bg-info-50 {
1579
1738
  &:hover {
1580
1739
  @media (hover: hover) {
@@ -1715,6 +1874,13 @@
1715
1874
  }
1716
1875
  }
1717
1876
  }
1877
+ .hover\:text-white {
1878
+ &:hover {
1879
+ @media (hover: hover) {
1880
+ color: var(--color-white);
1881
+ }
1882
+ }
1883
+ }
1718
1884
  .hover\:underline {
1719
1885
  &:hover {
1720
1886
  @media (hover: hover) {
@@ -2038,6 +2204,16 @@
2038
2204
  letter-spacing: var(--tracking-tight);
2039
2205
  }
2040
2206
  }
2207
+ .sm\:hover\:text-lg {
2208
+ @media (width >= 40rem) {
2209
+ &:hover {
2210
+ @media (hover: hover) {
2211
+ font-size: var(--text-lg);
2212
+ line-height: var(--tw-leading, var(--text-lg--line-height));
2213
+ }
2214
+ }
2215
+ }
2216
+ }
2041
2217
  .md\:col-span-5 {
2042
2218
  @media (width >= 48rem) {
2043
2219
  grid-column: span 5 / span 5;
@@ -2058,6 +2234,11 @@
2058
2234
  grid-template-columns: repeat(2, minmax(0, 1fr));
2059
2235
  }
2060
2236
  }
2237
+ .md\:grid-cols-3 {
2238
+ @media (width >= 48rem) {
2239
+ grid-template-columns: repeat(3, minmax(0, 1fr));
2240
+ }
2241
+ }
2061
2242
  .md\:grid-cols-4 {
2062
2243
  @media (width >= 48rem) {
2063
2244
  grid-template-columns: repeat(4, minmax(0, 1fr));
@@ -2068,6 +2249,12 @@
2068
2249
  grid-template-columns: repeat(10, minmax(0, 1fr));
2069
2250
  }
2070
2251
  }
2252
+ .md\:text-3xl {
2253
+ @media (width >= 48rem) {
2254
+ font-size: var(--text-3xl);
2255
+ line-height: var(--tw-leading, var(--text-3xl--line-height));
2256
+ }
2257
+ }
2071
2258
  .lg\:block {
2072
2259
  @media (width >= 64rem) {
2073
2260
  display: block;
@@ -2098,6 +2285,102 @@
2098
2285
  padding-inline: calc(var(--spacing) * 8);
2099
2286
  }
2100
2287
  }
2288
+ .lg\:text-3xl {
2289
+ @media (width >= 64rem) {
2290
+ font-size: var(--text-3xl);
2291
+ line-height: var(--tw-leading, var(--text-3xl--line-height));
2292
+ }
2293
+ }
2294
+ .lg\:text-4xl {
2295
+ @media (width >= 64rem) {
2296
+ font-size: var(--text-4xl);
2297
+ line-height: var(--tw-leading, var(--text-4xl--line-height));
2298
+ }
2299
+ }
2300
+ .lg\:text-5xl {
2301
+ @media (width >= 64rem) {
2302
+ font-size: var(--text-5xl);
2303
+ line-height: var(--tw-leading, var(--text-5xl--line-height));
2304
+ }
2305
+ }
2306
+ .lg\:text-base {
2307
+ @media (width >= 64rem) {
2308
+ font-size: var(--text-base);
2309
+ line-height: var(--tw-leading, var(--text-base--line-height));
2310
+ }
2311
+ }
2312
+ .lg\:text-lg {
2313
+ @media (width >= 64rem) {
2314
+ font-size: var(--text-lg);
2315
+ line-height: var(--tw-leading, var(--text-lg--line-height));
2316
+ }
2317
+ }
2318
+ .dark\:divide-gray-700 {
2319
+ @media (prefers-color-scheme: dark) {
2320
+ :where(& > :not(:last-child)) {
2321
+ border-color: var(--color-gray-700);
2322
+ }
2323
+ }
2324
+ }
2325
+ .dark\:bg-blue-900 {
2326
+ @media (prefers-color-scheme: dark) {
2327
+ background-color: var(--color-blue-900);
2328
+ }
2329
+ }
2330
+ .dark\:bg-gray-800 {
2331
+ @media (prefers-color-scheme: dark) {
2332
+ background-color: var(--color-gray-800);
2333
+ }
2334
+ }
2335
+ .dark\:bg-gray-900 {
2336
+ @media (prefers-color-scheme: dark) {
2337
+ background-color: var(--color-gray-900);
2338
+ }
2339
+ }
2340
+ .dark\:bg-green-900 {
2341
+ @media (prefers-color-scheme: dark) {
2342
+ background-color: var(--color-green-900);
2343
+ }
2344
+ }
2345
+ .dark\:bg-red-900 {
2346
+ @media (prefers-color-scheme: dark) {
2347
+ background-color: var(--color-red-900);
2348
+ }
2349
+ }
2350
+ .dark\:text-blue-200 {
2351
+ @media (prefers-color-scheme: dark) {
2352
+ color: var(--color-blue-200);
2353
+ }
2354
+ }
2355
+ .dark\:text-gray-100 {
2356
+ @media (prefers-color-scheme: dark) {
2357
+ color: var(--color-gray-100);
2358
+ }
2359
+ }
2360
+ .dark\:text-green-200 {
2361
+ @media (prefers-color-scheme: dark) {
2362
+ color: var(--color-green-200);
2363
+ }
2364
+ }
2365
+ .dark\:text-red-200 {
2366
+ @media (prefers-color-scheme: dark) {
2367
+ color: var(--color-red-200);
2368
+ }
2369
+ }
2370
+ .dark\:ring-1 {
2371
+ @media (prefers-color-scheme: dark) {
2372
+ --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
2373
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
2374
+ }
2375
+ }
2376
+ .dark\:ring-white\/10 {
2377
+ @media (prefers-color-scheme: dark) {
2378
+ --tw-ring-color: color-mix(in srgb, #fff 10%, transparent);
2379
+ @supports (color: color-mix(in lab, red, red)) {
2380
+ --tw-ring-color: color-mix(in oklab, var(--color-white) 10%, transparent);
2381
+ }
2382
+ }
2383
+ }
2101
2384
  }
2102
2385
  @property --tw-translate-x {
2103
2386
  syntax: "*";
@@ -2177,6 +2460,10 @@
2177
2460
  syntax: "*";
2178
2461
  inherits: false;
2179
2462
  }
2463
+ @property --tw-tracking {
2464
+ syntax: "*";
2465
+ inherits: false;
2466
+ }
2180
2467
  @property --tw-shadow {
2181
2468
  syntax: "*";
2182
2469
  inherits: false;
@@ -2308,9 +2595,10 @@
2308
2595
  syntax: "*";
2309
2596
  inherits: false;
2310
2597
  }
2311
- @property --tw-tracking {
2312
- syntax: "*";
2313
- inherits: false;
2598
+ @keyframes pulse {
2599
+ 50% {
2600
+ opacity: 0.5;
2601
+ }
2314
2602
  }
2315
2603
  @layer properties {
2316
2604
  @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
@@ -2332,6 +2620,7 @@
2332
2620
  --tw-border-style: solid;
2333
2621
  --tw-leading: initial;
2334
2622
  --tw-font-weight: initial;
2623
+ --tw-tracking: initial;
2335
2624
  --tw-shadow: 0 0 #0000;
2336
2625
  --tw-shadow-color: initial;
2337
2626
  --tw-shadow-alpha: 100%;
@@ -2362,7 +2651,6 @@
2362
2651
  --tw-drop-shadow-size: initial;
2363
2652
  --tw-duration: initial;
2364
2653
  --tw-ease: initial;
2365
- --tw-tracking: initial;
2366
2654
  }
2367
2655
  }
2368
2656
  }
@@ -14,5 +14,86 @@ module OkonomiUiKit
14
14
  def name
15
15
  self.class.name.demodulize.underscore
16
16
  end
17
+
18
+ def style(*args)
19
+ styles.dig(*args)
20
+ end
21
+
22
+ def styles
23
+ @combined_styles ||= combined_styles
24
+ end
25
+
26
+ def combined_styles
27
+ internal_name = internal_styles_registry.has_key?(theme_name) ? theme_name : :default
28
+ config_name = config_styles_registry.has_key?(theme_name) ? theme_name : :default
29
+
30
+ internal_styles = internal_styles_registry[internal_name] || {}
31
+ config_styles = config_styles_registry[config_name] || {}
32
+
33
+ deep_merge({}, internal_styles, config_styles)
34
+ end
35
+
36
+ def internal_styles_registry
37
+ self.class.internal_styles_registry
38
+ end
39
+
40
+ def config_styles_registry
41
+ self.class.config_styles_registry
42
+ end
43
+
44
+ def theme_name
45
+ :default
46
+ end
47
+
48
+ def self.register_styles(theme = :default, &block)
49
+ styles = block.call if block_given?
50
+
51
+ raise ArgumentError, "Styles must be a Hash" unless styles.is_a?(Hash)
52
+
53
+ internal_styles_registry[theme] = styles if styles.is_a?(Hash)
54
+ end
55
+
56
+ def self.internal_styles_registry
57
+ @internal_styles_registry ||= deep_merge({}, parent_styles_registry)
58
+ end
59
+
60
+ def self.parent_styles_registry
61
+ if superclass.respond_to?(:internal_styles_registry)
62
+ superclass.internal_styles_registry
63
+ else
64
+ {}
65
+ end
66
+ end
67
+
68
+ def self.config_styles_registry
69
+ @config_styles_registry ||= config_classes.reverse.reduce({}) do |hash, klass|
70
+ deep_merge(hash, klass.styles_registry)
71
+ end
72
+ end
73
+
74
+ def self.config_classes
75
+ @config_classes ||= resolve_config_classes
76
+ end
77
+
78
+ def self.resolve_config_classes
79
+ classes = []
80
+ classes << Object.const_get(config_class_name) if config_class?
81
+ classes += superclass.config_classes if superclass <= OkonomiUiKit::Component
82
+
83
+ classes.compact
84
+ end
85
+
86
+ def self.config_class_name
87
+ "OkonomiUiKit::Configs::#{name.demodulize}"
88
+ end
89
+
90
+ def self.config_class?
91
+ Object.const_defined?(config_class_name)
92
+ end
93
+
94
+ def self.deep_merge(*hashes)
95
+ OkonomiUiKit::TWMerge.deep_merge_all(*hashes)
96
+ end
97
+ delegate :deep_merge, to: :class
17
98
  end
18
99
  end
@@ -2,24 +2,29 @@ module OkonomiUiKit
2
2
  module Components
3
3
  class Badge < OkonomiUiKit::Component
4
4
  def render(text, options = {})
5
- severity = options.delete(:severity) || :default
6
- color_classes = case severity.to_sym
7
- when :success
8
- "bg-green-100 text-green-800"
9
- when :danger
10
- "bg-red-100 text-red-800"
11
- when :info
12
- "bg-blue-100 text-blue-800"
13
- when :warning
14
- "bg-yellow-100 text-yellow-800"
15
- else
16
- "bg-gray-100 text-gray-800"
17
- end
5
+ options = options.with_indifferent_access
6
+ severity = (options.delete(:severity) || options.delete(:variant) || :default).to_sym
18
7
 
19
- base_classes = "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium"
20
- full_classes = "#{base_classes} #{color_classes} #{options[:class] || ''}".strip
8
+ classes = [
9
+ style(:base),
10
+ style(:severities, severity) || '',
11
+ options.delete(:class) || ''
12
+ ].reject(&:blank?).join(' ')
21
13
 
22
- view.tag.span(text, class: full_classes, **options.except(:class))
14
+ view.tag.span(text, class: classes, **options)
15
+ end
16
+
17
+ register_styles :default do
18
+ {
19
+ base: "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",
20
+ severities: {
21
+ default: "bg-gray-100 text-gray-800",
22
+ success: "bg-green-100 text-green-800",
23
+ danger: "bg-red-100 text-red-800",
24
+ info: "bg-blue-100 text-blue-800",
25
+ warning: "bg-yellow-100 text-yellow-800"
26
+ }
27
+ }
23
28
  end
24
29
  end
25
30
  end