@embedreach/components 0.1.93 → 0.1.94

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.
@@ -13208,6 +13208,308 @@ const toShadcnFormat = (color2) => {
13208
13208
  return color2;
13209
13209
  }
13210
13210
  };
13211
+ const tailwindToHsl = (tailwindClass) => {
13212
+ if (tailwindClass === "bg-black") return rgbToShadcnHsl(0, 0, 0);
13213
+ if (tailwindClass === "bg-white") return rgbToShadcnHsl(255, 255, 255);
13214
+ const match2 = tailwindClass.match(/^bg-([a-z]+)-(\d{2,3})$/);
13215
+ if (!match2) {
13216
+ throw new Error(`Invalid tailwind color class: ${tailwindClass}`);
13217
+ }
13218
+ const [, color2, shade] = match2;
13219
+ const colorMap = {
13220
+ red: {
13221
+ "50": [254, 242, 242],
13222
+ "100": [254, 226, 226],
13223
+ "200": [254, 202, 202],
13224
+ "300": [252, 165, 165],
13225
+ "400": [248, 113, 113],
13226
+ "500": [239, 68, 68],
13227
+ "600": [220, 38, 38],
13228
+ "700": [185, 28, 28],
13229
+ "800": [153, 27, 27],
13230
+ "900": [127, 29, 29],
13231
+ "950": [69, 10, 10]
13232
+ },
13233
+ orange: {
13234
+ "50": [255, 247, 237],
13235
+ "100": [255, 237, 213],
13236
+ "200": [254, 215, 170],
13237
+ "300": [253, 186, 116],
13238
+ "400": [251, 146, 60],
13239
+ "500": [249, 115, 22],
13240
+ "600": [234, 88, 12],
13241
+ "700": [194, 65, 12],
13242
+ "800": [154, 52, 18],
13243
+ "900": [124, 45, 18],
13244
+ "950": [67, 20, 7]
13245
+ },
13246
+ amber: {
13247
+ "50": [255, 251, 235],
13248
+ "100": [254, 243, 199],
13249
+ "200": [253, 230, 138],
13250
+ "300": [252, 211, 77],
13251
+ "400": [251, 191, 36],
13252
+ "500": [245, 158, 11],
13253
+ "600": [217, 119, 6],
13254
+ "700": [180, 83, 9],
13255
+ "800": [146, 64, 14],
13256
+ "900": [120, 53, 15],
13257
+ "950": [69, 26, 3]
13258
+ },
13259
+ yellow: {
13260
+ "50": [254, 252, 232],
13261
+ "100": [254, 249, 195],
13262
+ "200": [254, 240, 138],
13263
+ "300": [253, 224, 71],
13264
+ "400": [250, 204, 21],
13265
+ "500": [234, 179, 8],
13266
+ "600": [202, 138, 4],
13267
+ "700": [161, 98, 7],
13268
+ "800": [133, 77, 14],
13269
+ "900": [113, 63, 18],
13270
+ "950": [66, 32, 6]
13271
+ },
13272
+ lime: {
13273
+ "50": [247, 254, 231],
13274
+ "100": [236, 252, 203],
13275
+ "200": [217, 249, 157],
13276
+ "300": [190, 242, 100],
13277
+ "400": [163, 230, 53],
13278
+ "500": [132, 204, 22],
13279
+ "600": [101, 163, 13],
13280
+ "700": [77, 124, 15],
13281
+ "800": [63, 98, 18],
13282
+ "900": [54, 83, 20],
13283
+ "950": [26, 46, 5]
13284
+ },
13285
+ green: {
13286
+ "50": [240, 253, 244],
13287
+ "100": [220, 252, 231],
13288
+ "200": [187, 247, 208],
13289
+ "300": [134, 239, 172],
13290
+ "400": [74, 222, 128],
13291
+ "500": [34, 197, 94],
13292
+ "600": [22, 163, 74],
13293
+ "700": [21, 128, 61],
13294
+ "800": [22, 101, 52],
13295
+ "900": [20, 83, 45],
13296
+ "950": [5, 46, 22]
13297
+ },
13298
+ emerald: {
13299
+ "50": [236, 253, 245],
13300
+ "100": [209, 250, 229],
13301
+ "200": [167, 243, 208],
13302
+ "300": [110, 231, 183],
13303
+ "400": [52, 211, 153],
13304
+ "500": [16, 185, 129],
13305
+ "600": [5, 150, 105],
13306
+ "700": [4, 120, 87],
13307
+ "800": [6, 95, 70],
13308
+ "900": [6, 78, 59],
13309
+ "950": [2, 44, 34]
13310
+ },
13311
+ teal: {
13312
+ "50": [240, 253, 250],
13313
+ "100": [204, 251, 241],
13314
+ "200": [153, 246, 228],
13315
+ "300": [94, 234, 212],
13316
+ "400": [45, 212, 191],
13317
+ "500": [20, 184, 166],
13318
+ "600": [13, 148, 136],
13319
+ "700": [15, 118, 110],
13320
+ "800": [17, 94, 89],
13321
+ "900": [19, 78, 74],
13322
+ "950": [4, 47, 46]
13323
+ },
13324
+ cyan: {
13325
+ "50": [236, 254, 255],
13326
+ "100": [207, 250, 254],
13327
+ "200": [165, 243, 252],
13328
+ "300": [103, 232, 249],
13329
+ "400": [34, 211, 238],
13330
+ "500": [6, 182, 212],
13331
+ "600": [8, 145, 178],
13332
+ "700": [14, 116, 144],
13333
+ "800": [21, 94, 117],
13334
+ "900": [22, 78, 99],
13335
+ "950": [8, 51, 68]
13336
+ },
13337
+ sky: {
13338
+ "50": [240, 249, 255],
13339
+ "100": [224, 242, 254],
13340
+ "200": [186, 230, 253],
13341
+ "300": [125, 211, 252],
13342
+ "400": [56, 189, 248],
13343
+ "500": [14, 165, 233],
13344
+ "600": [2, 132, 199],
13345
+ "700": [3, 105, 161],
13346
+ "800": [7, 89, 133],
13347
+ "900": [12, 74, 110],
13348
+ "950": [8, 47, 73]
13349
+ },
13350
+ blue: {
13351
+ "50": [239, 246, 255],
13352
+ "100": [219, 234, 254],
13353
+ "200": [191, 219, 254],
13354
+ "300": [147, 197, 253],
13355
+ "400": [96, 165, 250],
13356
+ "500": [59, 130, 246],
13357
+ "600": [37, 99, 235],
13358
+ "700": [29, 78, 216],
13359
+ "800": [30, 64, 175],
13360
+ "900": [30, 58, 138],
13361
+ "950": [23, 37, 84]
13362
+ },
13363
+ indigo: {
13364
+ "50": [238, 242, 255],
13365
+ "100": [224, 231, 255],
13366
+ "200": [199, 210, 254],
13367
+ "300": [165, 180, 252],
13368
+ "400": [129, 140, 248],
13369
+ "500": [99, 102, 241],
13370
+ "600": [79, 70, 229],
13371
+ "700": [67, 56, 202],
13372
+ "800": [55, 48, 163],
13373
+ "900": [49, 46, 129],
13374
+ "950": [30, 27, 75]
13375
+ },
13376
+ violet: {
13377
+ "50": [245, 243, 255],
13378
+ "100": [237, 233, 254],
13379
+ "200": [221, 214, 254],
13380
+ "300": [196, 181, 253],
13381
+ "400": [167, 139, 250],
13382
+ "500": [139, 92, 246],
13383
+ "600": [124, 58, 237],
13384
+ "700": [109, 40, 217],
13385
+ "800": [91, 33, 182],
13386
+ "900": [76, 29, 149],
13387
+ "950": [46, 16, 101]
13388
+ },
13389
+ purple: {
13390
+ "50": [250, 245, 255],
13391
+ "100": [243, 232, 255],
13392
+ "200": [233, 213, 255],
13393
+ "300": [216, 180, 254],
13394
+ "400": [192, 132, 252],
13395
+ "500": [168, 85, 247],
13396
+ "600": [147, 51, 234],
13397
+ "700": [126, 34, 206],
13398
+ "800": [107, 33, 168],
13399
+ "900": [88, 28, 135],
13400
+ "950": [59, 7, 100]
13401
+ },
13402
+ fuchsia: {
13403
+ "50": [253, 244, 255],
13404
+ "100": [250, 232, 255],
13405
+ "200": [245, 208, 254],
13406
+ "300": [240, 171, 252],
13407
+ "400": [232, 121, 249],
13408
+ "500": [217, 70, 239],
13409
+ "600": [192, 38, 211],
13410
+ "700": [162, 28, 175],
13411
+ "800": [134, 25, 143],
13412
+ "900": [112, 26, 117],
13413
+ "950": [74, 4, 78]
13414
+ },
13415
+ pink: {
13416
+ "50": [253, 242, 248],
13417
+ "100": [252, 231, 243],
13418
+ "200": [251, 207, 232],
13419
+ "300": [249, 168, 212],
13420
+ "400": [244, 114, 182],
13421
+ "500": [236, 72, 153],
13422
+ "600": [219, 39, 119],
13423
+ "700": [190, 24, 93],
13424
+ "800": [157, 23, 77],
13425
+ "900": [131, 24, 67],
13426
+ "950": [80, 7, 36]
13427
+ },
13428
+ rose: {
13429
+ "50": [255, 241, 242],
13430
+ "100": [255, 228, 230],
13431
+ "200": [254, 205, 211],
13432
+ "300": [253, 164, 175],
13433
+ "400": [251, 113, 133],
13434
+ "500": [244, 63, 94],
13435
+ "600": [225, 29, 72],
13436
+ "700": [190, 18, 60],
13437
+ "800": [159, 18, 57],
13438
+ "900": [136, 19, 55],
13439
+ "950": [76, 5, 25]
13440
+ },
13441
+ slate: {
13442
+ "50": [248, 250, 252],
13443
+ "100": [241, 245, 249],
13444
+ "200": [226, 232, 240],
13445
+ "300": [203, 213, 225],
13446
+ "400": [148, 163, 184],
13447
+ "500": [100, 116, 139],
13448
+ "600": [71, 85, 105],
13449
+ "700": [51, 65, 85],
13450
+ "800": [30, 41, 59],
13451
+ "900": [15, 23, 42],
13452
+ "950": [2, 6, 23]
13453
+ },
13454
+ gray: {
13455
+ "50": [249, 250, 251],
13456
+ "100": [243, 244, 246],
13457
+ "200": [229, 231, 235],
13458
+ "300": [209, 213, 219],
13459
+ "400": [156, 163, 175],
13460
+ "500": [107, 114, 128],
13461
+ "600": [75, 85, 99],
13462
+ "700": [55, 65, 81],
13463
+ "800": [31, 41, 55],
13464
+ "900": [17, 24, 39],
13465
+ "950": [3, 7, 18]
13466
+ },
13467
+ zinc: {
13468
+ "50": [250, 250, 250],
13469
+ "100": [244, 244, 245],
13470
+ "200": [228, 228, 231],
13471
+ "300": [212, 212, 216],
13472
+ "400": [161, 161, 170],
13473
+ "500": [113, 113, 122],
13474
+ "600": [82, 82, 91],
13475
+ "700": [63, 63, 70],
13476
+ "800": [39, 39, 42],
13477
+ "900": [24, 24, 27],
13478
+ "950": [9, 9, 11]
13479
+ },
13480
+ neutral: {
13481
+ "50": [250, 250, 250],
13482
+ "100": [245, 245, 245],
13483
+ "200": [229, 229, 229],
13484
+ "300": [212, 212, 212],
13485
+ "400": [163, 163, 163],
13486
+ "500": [115, 115, 115],
13487
+ "600": [82, 82, 82],
13488
+ "700": [64, 64, 64],
13489
+ "800": [38, 38, 38],
13490
+ "900": [23, 23, 23],
13491
+ "950": [10, 10, 10]
13492
+ },
13493
+ stone: {
13494
+ "50": [250, 250, 249],
13495
+ "100": [245, 245, 244],
13496
+ "200": [231, 229, 228],
13497
+ "300": [214, 211, 209],
13498
+ "400": [168, 162, 158],
13499
+ "500": [120, 113, 108],
13500
+ "600": [87, 83, 78],
13501
+ "700": [68, 64, 60],
13502
+ "800": [41, 37, 36],
13503
+ "900": [28, 25, 23],
13504
+ "950": [12, 10, 9]
13505
+ }
13506
+ };
13507
+ if (!colorMap[color2] || !colorMap[color2][shade]) {
13508
+ throw new Error(`Unsupported color or shade: ${tailwindClass}`);
13509
+ }
13510
+ const [r2, g2, b3] = colorMap[color2][shade];
13511
+ return rgbToShadcnHsl(r2, g2, b3);
13512
+ };
13211
13513
  const applyThemeStyles = (styles2) => {
13212
13514
  const existingStyles = document.getElementById("reach-theme-styles");
13213
13515
  if (existingStyles) {
@@ -13224,13 +13526,10 @@ const applyThemeStyles = (styles2) => {
13224
13526
  if (key === "radius" || key === "font-body" || key === "font-heading") {
13225
13527
  finalValue = userValue;
13226
13528
  } else if (isValidColor(userValue)) {
13227
- const isTailwindClass = /^bg-/.test(userValue.trim());
13529
+ const isTailwindClass = /^bg-/.test(userValue.trim()) && userValue.trim() !== "bg-inherit" && userValue.trim() !== "bg-current" && userValue.trim() !== "bg-transparent";
13228
13530
  if (isTailwindClass) {
13229
- const rootElement = document.querySelector("[data-reach-root]");
13230
- if (rootElement) {
13231
- rootElement.classList.add(userValue.trim());
13232
- }
13233
- finalValue = defaultValue;
13531
+ const className2 = userValue.replace(/['"]/g, "").trim();
13532
+ finalValue = tailwindToHsl(className2);
13234
13533
  } else {
13235
13534
  try {
13236
13535
  finalValue = toShadcnFormat(userValue);