@thecb/components 11.0.2 → 11.0.3

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.
package/dist/index.esm.js CHANGED
@@ -6211,6 +6211,43 @@ var wrapIndex = function wrapIndex(index, length) {
6211
6211
  }
6212
6212
  };
6213
6213
 
6214
+ /**
6215
+ * Adjusts a hex color by lightening or darkening it.
6216
+ *
6217
+ * Intended for use when a satisfactory color is not available in the design system.
6218
+ *
6219
+ * @param {string} hex - The original hex color (e.g., "#3498db").
6220
+ * @param {number} percent - The percentage to adjust the color (0-100).
6221
+ * @param {string} action - The action to perform: 'lighten' or 'darken'.
6222
+ * @returns {string} - The adjusted hex color.
6223
+ * @throws {Error} - Throws an error if the action is not 'lighten' or 'darken'.
6224
+ */
6225
+ var adjustHexColor = function adjustHexColor(hex, percent, action) {
6226
+ // Remove hash at the start if present
6227
+ hex = hex.replace(/^\s*#/, "");
6228
+
6229
+ // Parse r, g, b values
6230
+ var r = parseInt(hex.substring(0, 2), 16);
6231
+ var g = parseInt(hex.substring(2, 4), 16);
6232
+ var b = parseInt(hex.substring(4, 6), 16);
6233
+
6234
+ // Adjust RGB values based on the action
6235
+ if (action === "darken") {
6236
+ r = Math.max(0, Math.floor(r * (1 - percent / 100)));
6237
+ g = Math.max(0, Math.floor(g * (1 - percent / 100)));
6238
+ b = Math.max(0, Math.floor(b * (1 - percent / 100)));
6239
+ } else if (action === "lighten") {
6240
+ r = Math.min(255, Math.floor(r + (255 - r) * (percent / 100)));
6241
+ g = Math.min(255, Math.floor(g + (255 - g) * (percent / 100)));
6242
+ b = Math.min(255, Math.floor(b + (255 - b) * (percent / 100)));
6243
+ } else {
6244
+ throw new Error("Action must be either 'lighten' or 'darken'");
6245
+ }
6246
+
6247
+ // Convert back to hex
6248
+ return "#".concat(((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).padStart(6, "0"));
6249
+ };
6250
+
6214
6251
  var general = /*#__PURE__*/Object.freeze({
6215
6252
  __proto__: null,
6216
6253
  noop: noop$1,
@@ -6231,7 +6268,8 @@ var general = /*#__PURE__*/Object.freeze({
6231
6268
  titleCaseWord: titleCaseWord,
6232
6269
  titleCaseString: titleCaseString,
6233
6270
  kebabCaseString: kebabCaseString,
6234
- wrapIndex: wrapIndex
6271
+ wrapIndex: wrapIndex,
6272
+ adjustHexColor: adjustHexColor
6235
6273
  });
6236
6274
 
6237
6275
  var _excluded$1 = ["themeValues", "weight", "color", "textWrap", "extraStyles", "hoverStyles", "onClick", "onKeyPress", "as", "dataQa", "children", "variant"];
@@ -12371,6 +12409,8 @@ var WHITE$1 = WHITE,
12371
12409
  PEACOCK_BLUE$1 = PEACOCK_BLUE,
12372
12410
  MANATEE_GREY$1 = MANATEE_GREY,
12373
12411
  MATISSE_BLUE$1 = MATISSE_BLUE,
12412
+ HINT_GREEN$1 = HINT_GREEN,
12413
+ SEA_GREEN$1 = SEA_GREEN,
12374
12414
  RASPBERRY$1 = RASPBERRY,
12375
12415
  ERROR_COLOR$1 = ERROR_COLOR;
12376
12416
  var LINK_TEXT_DECORATION$1 = LINK_TEXT_DECORATION;
@@ -12385,8 +12425,10 @@ var disabledBorderColor = {
12385
12425
  tertiary: TRANSPARENT$1,
12386
12426
  danger: MANATEE_GREY$1,
12387
12427
  dangerSecondary: MANATEE_GREY$1,
12428
+ whitePrimary: MANATEE_GREY$1,
12388
12429
  whiteSecondary: MANATEE_GREY$1,
12389
- whitePrimary: MANATEE_GREY$1
12430
+ greenPrimary: SEA_GREEN$1,
12431
+ greenSecondary: SEA_GREEN$1
12390
12432
  };
12391
12433
  var disabledColor = {
12392
12434
  primary: WHITE$1,
@@ -12399,8 +12441,10 @@ var disabledColor = {
12399
12441
  tertiary: MANATEE_GREY$1,
12400
12442
  danger: WHITE$1,
12401
12443
  dangerSecondary: MANATEE_GREY$1,
12444
+ whitePrimary: MANATEE_GREY$1,
12402
12445
  whiteSecondary: MANATEE_GREY$1,
12403
- whitePrimary: MANATEE_GREY$1
12446
+ greenPrimary: WHITE$1,
12447
+ greenSecondary: SEA_GREEN$1
12404
12448
  };
12405
12449
  var disabledBackgroundColor = {
12406
12450
  primary: MANATEE_GREY$1,
@@ -12413,8 +12457,10 @@ var disabledBackgroundColor = {
12413
12457
  tertiary: TRANSPARENT$1,
12414
12458
  danger: MANATEE_GREY$1,
12415
12459
  dangerSecondary: TRANSPARENT$1,
12460
+ whitePrimary: TRANSPARENT$1,
12416
12461
  whiteSecondary: TRANSPARENT$1,
12417
- whitePrimary: TRANSPARENT$1
12462
+ greenPrimary: SEA_GREEN$1,
12463
+ greenSecondary: TRANSPARENT$1
12418
12464
  };
12419
12465
  var padding = {
12420
12466
  primary: "0.75rem 1.5rem",
@@ -12427,8 +12473,10 @@ var padding = {
12427
12473
  ghost: "0.65rem 0",
12428
12474
  danger: "0.75rem 1.5rem",
12429
12475
  dangerSecondary: "0.75rem 1.5rem",
12476
+ whitePrimary: "1.125rem 0.75rem",
12430
12477
  whiteSecondary: "0.75rem 2rem",
12431
- whitePrimary: "1.125rem 0.75rem"
12478
+ greenPrimary: "0.75rem 1.5rem",
12479
+ greenSecondary: "0.75rem 1.5rem"
12432
12480
  };
12433
12481
  var color$1 = {
12434
12482
  primary: WHITE$1,
@@ -12441,8 +12489,10 @@ var color$1 = {
12441
12489
  tertiary: MATISSE_BLUE$1,
12442
12490
  danger: WHITE$1,
12443
12491
  dangerSecondary: ERROR_COLOR$1,
12492
+ whitePrimary: WHITE$1,
12444
12493
  whiteSecondary: WHITE$1,
12445
- whitePrimary: WHITE$1
12494
+ greenPrimary: WHITE$1,
12495
+ greenSecondary: SEA_GREEN$1
12446
12496
  };
12447
12497
  var fontSizeVariant = {
12448
12498
  primary: "pS",
@@ -12456,7 +12506,9 @@ var fontSizeVariant = {
12456
12506
  danger: "pS",
12457
12507
  dangerSecondary: "pS",
12458
12508
  whiteSecondary: "pS",
12459
- whitePrimary: "pS"
12509
+ whitePrimary: "pS",
12510
+ greenPrimary: "pS",
12511
+ greenSecondary: "pS"
12460
12512
  };
12461
12513
  var fontWeight = {
12462
12514
  primary: "600",
@@ -12470,7 +12522,9 @@ var fontWeight = {
12470
12522
  danger: "600",
12471
12523
  dangerSecondary: "600",
12472
12524
  whiteSecondary: "600",
12473
- whitePrimary: "600"
12525
+ whitePrimary: "600",
12526
+ greenPrimary: "600",
12527
+ greenSecondary: "600"
12474
12528
  };
12475
12529
  var height = {
12476
12530
  primary: "3rem",
@@ -12483,8 +12537,10 @@ var height = {
12483
12537
  tertiary: "3rem",
12484
12538
  danger: "3rem",
12485
12539
  dangerSecondary: "3rem",
12540
+ whitePrimary: "auto",
12486
12541
  whiteSecondary: "3rem",
12487
- whitePrimary: "auto"
12542
+ greenPrimary: "3rem",
12543
+ greenSecondary: "3rem"
12488
12544
  };
12489
12545
  var minWidth = {
12490
12546
  primary: "130px",
@@ -12497,8 +12553,10 @@ var minWidth = {
12497
12553
  tertiary: "130px",
12498
12554
  danger: "130px",
12499
12555
  dangerSecondary: "157px",
12556
+ whitePrimary: "130px",
12500
12557
  whiteSecondary: "160px",
12501
- whitePrimary: "130px"
12558
+ greenPrimary: "130px",
12559
+ greenSecondary: "130px"
12502
12560
  };
12503
12561
  var textDecoration = {
12504
12562
  primary: "none",
@@ -12511,8 +12569,10 @@ var textDecoration = {
12511
12569
  tertiary: "none",
12512
12570
  danger: "none",
12513
12571
  dangerSecondary: "none",
12572
+ whitePrimary: "none",
12514
12573
  whiteSecondary: "none",
12515
- whitePrimary: "none"
12574
+ greenPrimary: "none",
12575
+ greenSecondary: "none"
12516
12576
  };
12517
12577
  var backgroundColor = {
12518
12578
  primary: MATISSE_BLUE$1,
@@ -12525,8 +12585,10 @@ var backgroundColor = {
12525
12585
  tertiary: TRANSPARENT$1,
12526
12586
  danger: RASPBERRY$1,
12527
12587
  dangerSecondary: TRANSPARENT$1,
12588
+ whitePrimary: TRANSPARENT$1,
12528
12589
  whiteSecondary: TRANSPARENT$1,
12529
- whitePrimary: TRANSPARENT$1
12590
+ greenPrimary: SEA_GREEN$1,
12591
+ greenSecondary: TRANSPARENT$1
12530
12592
  };
12531
12593
  var border = {
12532
12594
  primary: "2px solid " + MATISSE_BLUE$1,
@@ -12539,8 +12601,10 @@ var border = {
12539
12601
  tertiary: "none",
12540
12602
  danger: "2px solid " + RASPBERRY$1,
12541
12603
  dangerSecondary: "2px solid " + ERROR_COLOR$1,
12604
+ whitePrimary: "2px solid " + TRANSPARENT$1,
12542
12605
  whiteSecondary: "2px solid " + WHITE$1,
12543
- whitePrimary: "2px solid " + TRANSPARENT$1
12606
+ greenPrimary: "2px solid " + SEA_GREEN$1,
12607
+ greenSecondary: "2px solid " + SEA_GREEN$1
12544
12608
  };
12545
12609
  var hoverBackgroundColor = {
12546
12610
  primary: SAPPHIRE_BLUE$1,
@@ -12553,8 +12617,10 @@ var hoverBackgroundColor = {
12553
12617
  tertiary: TRANSPARENT$1,
12554
12618
  danger: "#BA002C",
12555
12619
  dangerSecondary: "#FAE7EE",
12620
+ whitePrimary: TRANSPARENT$1,
12556
12621
  whiteSecondary: TRANSPARENT$1,
12557
- whitePrimary: TRANSPARENT$1
12622
+ greenPrimary: adjustHexColor(SEA_GREEN$1, 10, "darken"),
12623
+ greenSecondary: HINT_GREEN$1
12558
12624
  };
12559
12625
  var hoverBorderColor = {
12560
12626
  primary: SAPPHIRE_BLUE$1,
@@ -12567,8 +12633,10 @@ var hoverBorderColor = {
12567
12633
  tertiary: TRANSPARENT$1,
12568
12634
  danger: "#BA002C",
12569
12635
  dangerSecondary: "#B10541",
12636
+ whitePrimary: "2px solid " + TRANSPARENT$1,
12570
12637
  whiteSecondary: "2px solid " + TRANSPARENT$1,
12571
- whitePrimary: "2px solid " + TRANSPARENT$1
12638
+ greenPrimary: SEA_GREEN$1,
12639
+ greenSecondary: SEA_GREEN$1
12572
12640
  };
12573
12641
  var hoverColor = {
12574
12642
  primary: WHITE$1,
@@ -12581,8 +12649,10 @@ var hoverColor = {
12581
12649
  tertiary: SAPPHIRE_BLUE$1,
12582
12650
  danger: WHITE$1,
12583
12651
  dangerSecondary: "#B10541",
12652
+ whitePrimary: WHITE$1,
12584
12653
  whiteSecondary: WHITE$1,
12585
- whitePrimary: WHITE$1
12654
+ greenPrimary: WHITE$1,
12655
+ greenSecondary: SEA_GREEN$1
12586
12656
  };
12587
12657
  var activeBackgroundColor = {
12588
12658
  primary: PEACOCK_BLUE$1,
@@ -12595,8 +12665,10 @@ var activeBackgroundColor = {
12595
12665
  tertiary: TRANSPARENT$1,
12596
12666
  danger: "#870000",
12597
12667
  dangerSecondary: "#FAE7EE",
12668
+ whitePrimary: TRANSPARENT$1,
12598
12669
  whiteSecondary: TRANSPARENT$1,
12599
- whitePrimary: TRANSPARENT$1
12670
+ greenPrimary: adjustHexColor(SEA_GREEN$1, 20, "darken"),
12671
+ greenSecondary: adjustHexColor(HINT_GREEN$1, 5, "darken")
12600
12672
  };
12601
12673
  var activeBorderColor = {
12602
12674
  primary: PEACOCK_BLUE$1,
@@ -12609,8 +12681,10 @@ var activeBorderColor = {
12609
12681
  tertiary: TRANSPARENT$1,
12610
12682
  danger: "#870000",
12611
12683
  dangerSecondary: "#910029",
12684
+ whitePrimary: "2px solid " + TRANSPARENT$1,
12612
12685
  whiteSecondary: "2px solid " + TRANSPARENT$1,
12613
- whitePrimary: "2px solid " + TRANSPARENT$1
12686
+ greenPrimary: SEA_GREEN$1,
12687
+ greenSecondary: SEA_GREEN$1
12614
12688
  };
12615
12689
  var activeColor = {
12616
12690
  primary: WHITE$1,
@@ -12623,8 +12697,10 @@ var activeColor = {
12623
12697
  tertiary: PEACOCK_BLUE$1,
12624
12698
  danger: WHITE$1,
12625
12699
  dangerSecondary: "#910029",
12700
+ whitePrimary: WHITE$1,
12626
12701
  whiteSecondary: WHITE$1,
12627
- whitePrimary: WHITE$1
12702
+ greenPrimary: WHITE$1,
12703
+ greenSecondary: SEA_GREEN$1
12628
12704
  };
12629
12705
  var fallbackValues$1 = {
12630
12706
  padding: padding,
@@ -19337,7 +19413,9 @@ var ArrowDownCircleIconSmall = function ArrowDownCircleIconSmall(_ref) {
19337
19413
 
19338
19414
  var SuccessfulIconMedium = function SuccessfulIconMedium(_ref) {
19339
19415
  var _ref$iconIndex = _ref.iconIndex,
19340
- iconIndex = _ref$iconIndex === void 0 ? 0 : _ref$iconIndex;
19416
+ iconIndex = _ref$iconIndex === void 0 ? 0 : _ref$iconIndex,
19417
+ _ref$fill = _ref.fill,
19418
+ fill = _ref$fill === void 0 ? SEA_GREEN : _ref$fill;
19341
19419
  var mask0ID = "SuccessfulIconMedium-mask0-".concat(iconIndex);
19342
19420
  var mask1ID = "SuccessfulIconMedium-mask1-".concat(iconIndex);
19343
19421
  return /*#__PURE__*/React.createElement("svg", {
@@ -19350,7 +19428,7 @@ var SuccessfulIconMedium = function SuccessfulIconMedium(_ref) {
19350
19428
  cx: "12",
19351
19429
  cy: "12",
19352
19430
  r: "12",
19353
- fill: "#317D4F"
19431
+ fill: fill
19354
19432
  }), /*#__PURE__*/React.createElement("mask", {
19355
19433
  id: mask0ID,
19356
19434
  style: {
@@ -21075,7 +21153,6 @@ function _wrapNativeSuper(Class) {
21075
21153
  }
21076
21154
 
21077
21155
  // based on https://github.com/styled-components/styled-components/blob/fcf6f3804c57a14dd7984dfab7bc06ee2edca044/src/utils/error.js
21078
-
21079
21156
  /**
21080
21157
  * Parse errors.md and turn it into a simple hash of code: message
21081
21158
  * @private
@@ -21160,84 +21237,71 @@ var ERRORS = {
21160
21237
  "77": "remToPx expects a value in \"rem\" but you provided it in \"%s\".\n\n",
21161
21238
  "78": "base must be set in \"px\" or \"%\" but you set it in \"%s\".\n"
21162
21239
  };
21240
+
21163
21241
  /**
21164
21242
  * super basic version of sprintf
21165
21243
  * @private
21166
21244
  */
21167
-
21168
21245
  function format() {
21169
21246
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
21170
21247
  args[_key] = arguments[_key];
21171
21248
  }
21172
-
21173
21249
  var a = args[0];
21174
21250
  var b = [];
21175
21251
  var c;
21176
-
21177
21252
  for (c = 1; c < args.length; c += 1) {
21178
21253
  b.push(args[c]);
21179
21254
  }
21180
-
21181
21255
  b.forEach(function (d) {
21182
21256
  a = a.replace(/%[a-z]/, d);
21183
21257
  });
21184
21258
  return a;
21185
21259
  }
21260
+
21186
21261
  /**
21187
21262
  * Create an error file out of errors.md for development and a simple web link to the full errors
21188
21263
  * in production mode.
21189
21264
  * @private
21190
21265
  */
21191
-
21192
-
21193
21266
  var PolishedError = /*#__PURE__*/function (_Error) {
21194
21267
  _inheritsLoose(PolishedError, _Error);
21195
-
21196
21268
  function PolishedError(code) {
21197
21269
  var _this;
21198
-
21199
21270
  if (process.env.NODE_ENV === 'production') {
21200
21271
  _this = _Error.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + code + " for more information.") || this;
21201
21272
  } else {
21202
21273
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
21203
21274
  args[_key2 - 1] = arguments[_key2];
21204
21275
  }
21205
-
21206
21276
  _this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;
21207
21277
  }
21208
-
21209
21278
  return _assertThisInitialized(_this);
21210
21279
  }
21211
-
21212
21280
  return PolishedError;
21213
21281
  }( /*#__PURE__*/_wrapNativeSuper(Error));
21214
21282
 
21215
21283
  function colorToInt(color) {
21216
21284
  return Math.round(color * 255);
21217
21285
  }
21218
-
21219
21286
  function convertToInt(red, green, blue) {
21220
21287
  return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue);
21221
21288
  }
21222
-
21223
21289
  function hslToRgb(hue, saturation, lightness, convert) {
21224
21290
  if (convert === void 0) {
21225
21291
  convert = convertToInt;
21226
21292
  }
21227
-
21228
21293
  if (saturation === 0) {
21229
21294
  // achromatic
21230
21295
  return convert(lightness, lightness, lightness);
21231
- } // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
21232
-
21296
+ }
21233
21297
 
21298
+ // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
21234
21299
  var huePrime = (hue % 360 + 360) % 360 / 60;
21235
21300
  var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
21236
21301
  var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
21237
21302
  var red = 0;
21238
21303
  var green = 0;
21239
21304
  var blue = 0;
21240
-
21241
21305
  if (huePrime >= 0 && huePrime < 1) {
21242
21306
  red = chroma;
21243
21307
  green = secondComponent;
@@ -21257,7 +21321,6 @@ function hslToRgb(hue, saturation, lightness, convert) {
21257
21321
  red = chroma;
21258
21322
  blue = secondComponent;
21259
21323
  }
21260
-
21261
21324
  var lightnessModification = lightness - chroma / 2;
21262
21325
  var finalRed = red + lightnessModification;
21263
21326
  var finalGreen = green + lightnessModification;
@@ -21415,11 +21478,11 @@ var namedColorMap = {
21415
21478
  yellow: 'ff0',
21416
21479
  yellowgreen: '9acd32'
21417
21480
  };
21481
+
21418
21482
  /**
21419
21483
  * Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
21420
21484
  * @private
21421
21485
  */
21422
-
21423
21486
  function nameToHex(color) {
21424
21487
  if (typeof color !== 'string') return color;
21425
21488
  var normalizedColorName = color.toLowerCase();
@@ -21434,6 +21497,7 @@ var rgbRegex = /^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\
21434
21497
  var rgbaRegex = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
21435
21498
  var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
21436
21499
  var hslaRegex = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
21500
+
21437
21501
  /**
21438
21502
  * Returns an RgbColor or RgbaColor object. This utility function is only useful
21439
21503
  * if want to extract a color component. With the color util `toColorString` you
@@ -21445,14 +21509,11 @@ var hslaRegex = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[
21445
21509
  * // Assigns `{ red: 92, green: 102, blue: 112, alpha: 0.75 }` to color2
21446
21510
  * const color2 = parseToRgb('hsla(210, 10%, 40%, 0.75)');
21447
21511
  */
21448
-
21449
21512
  function parseToRgb(color) {
21450
21513
  if (typeof color !== 'string') {
21451
21514
  throw new PolishedError(3);
21452
21515
  }
21453
-
21454
21516
  var normalizedColor = nameToHex(color);
21455
-
21456
21517
  if (normalizedColor.match(hexRegex)) {
21457
21518
  return {
21458
21519
  red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
@@ -21460,7 +21521,6 @@ function parseToRgb(color) {
21460
21521
  blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16)
21461
21522
  };
21462
21523
  }
21463
-
21464
21524
  if (normalizedColor.match(hexRgbaRegex)) {
21465
21525
  var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
21466
21526
  return {
@@ -21470,7 +21530,6 @@ function parseToRgb(color) {
21470
21530
  alpha: alpha
21471
21531
  };
21472
21532
  }
21473
-
21474
21533
  if (normalizedColor.match(reducedHexRegex)) {
21475
21534
  return {
21476
21535
  red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
@@ -21478,10 +21537,8 @@ function parseToRgb(color) {
21478
21537
  blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16)
21479
21538
  };
21480
21539
  }
21481
-
21482
21540
  if (normalizedColor.match(reducedRgbaHexRegex)) {
21483
21541
  var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2));
21484
-
21485
21542
  return {
21486
21543
  red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
21487
21544
  green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
@@ -21489,9 +21546,7 @@ function parseToRgb(color) {
21489
21546
  alpha: _alpha
21490
21547
  };
21491
21548
  }
21492
-
21493
21549
  var rgbMatched = rgbRegex.exec(normalizedColor);
21494
-
21495
21550
  if (rgbMatched) {
21496
21551
  return {
21497
21552
  red: parseInt("" + rgbMatched[1], 10),
@@ -21499,9 +21554,7 @@ function parseToRgb(color) {
21499
21554
  blue: parseInt("" + rgbMatched[3], 10)
21500
21555
  };
21501
21556
  }
21502
-
21503
21557
  var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
21504
-
21505
21558
  if (rgbaMatched) {
21506
21559
  return {
21507
21560
  red: parseInt("" + rgbaMatched[1], 10),
@@ -21510,44 +21563,32 @@ function parseToRgb(color) {
21510
21563
  alpha: parseFloat("" + rgbaMatched[4]) > 1 ? parseFloat("" + rgbaMatched[4]) / 100 : parseFloat("" + rgbaMatched[4])
21511
21564
  };
21512
21565
  }
21513
-
21514
21566
  var hslMatched = hslRegex.exec(normalizedColor);
21515
-
21516
21567
  if (hslMatched) {
21517
21568
  var hue = parseInt("" + hslMatched[1], 10);
21518
21569
  var saturation = parseInt("" + hslMatched[2], 10) / 100;
21519
21570
  var lightness = parseInt("" + hslMatched[3], 10) / 100;
21520
21571
  var rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")";
21521
21572
  var hslRgbMatched = rgbRegex.exec(rgbColorString);
21522
-
21523
21573
  if (!hslRgbMatched) {
21524
21574
  throw new PolishedError(4, normalizedColor, rgbColorString);
21525
21575
  }
21526
-
21527
21576
  return {
21528
21577
  red: parseInt("" + hslRgbMatched[1], 10),
21529
21578
  green: parseInt("" + hslRgbMatched[2], 10),
21530
21579
  blue: parseInt("" + hslRgbMatched[3], 10)
21531
21580
  };
21532
21581
  }
21533
-
21534
21582
  var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
21535
-
21536
21583
  if (hslaMatched) {
21537
21584
  var _hue = parseInt("" + hslaMatched[1], 10);
21538
-
21539
21585
  var _saturation = parseInt("" + hslaMatched[2], 10) / 100;
21540
-
21541
21586
  var _lightness = parseInt("" + hslaMatched[3], 10) / 100;
21542
-
21543
21587
  var _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")";
21544
-
21545
21588
  var _hslRgbMatched = rgbRegex.exec(_rgbColorString);
21546
-
21547
21589
  if (!_hslRgbMatched) {
21548
21590
  throw new PolishedError(4, normalizedColor, _rgbColorString);
21549
21591
  }
21550
-
21551
21592
  return {
21552
21593
  red: parseInt("" + _hslRgbMatched[1], 10),
21553
21594
  green: parseInt("" + _hslRgbMatched[2], 10),
@@ -21555,10 +21596,82 @@ function parseToRgb(color) {
21555
21596
  alpha: parseFloat("" + hslaMatched[4]) > 1 ? parseFloat("" + hslaMatched[4]) / 100 : parseFloat("" + hslaMatched[4])
21556
21597
  };
21557
21598
  }
21558
-
21559
21599
  throw new PolishedError(5);
21560
21600
  }
21561
21601
 
21602
+ function rgbToHsl(color) {
21603
+ // make sure rgb are contained in a set of [0, 255]
21604
+ var red = color.red / 255;
21605
+ var green = color.green / 255;
21606
+ var blue = color.blue / 255;
21607
+ var max = Math.max(red, green, blue);
21608
+ var min = Math.min(red, green, blue);
21609
+ var lightness = (max + min) / 2;
21610
+ if (max === min) {
21611
+ // achromatic
21612
+ if (color.alpha !== undefined) {
21613
+ return {
21614
+ hue: 0,
21615
+ saturation: 0,
21616
+ lightness: lightness,
21617
+ alpha: color.alpha
21618
+ };
21619
+ } else {
21620
+ return {
21621
+ hue: 0,
21622
+ saturation: 0,
21623
+ lightness: lightness
21624
+ };
21625
+ }
21626
+ }
21627
+ var hue;
21628
+ var delta = max - min;
21629
+ var saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);
21630
+ switch (max) {
21631
+ case red:
21632
+ hue = (green - blue) / delta + (green < blue ? 6 : 0);
21633
+ break;
21634
+ case green:
21635
+ hue = (blue - red) / delta + 2;
21636
+ break;
21637
+ default:
21638
+ // blue case
21639
+ hue = (red - green) / delta + 4;
21640
+ break;
21641
+ }
21642
+ hue *= 60;
21643
+ if (color.alpha !== undefined) {
21644
+ return {
21645
+ hue: hue,
21646
+ saturation: saturation,
21647
+ lightness: lightness,
21648
+ alpha: color.alpha
21649
+ };
21650
+ }
21651
+ return {
21652
+ hue: hue,
21653
+ saturation: saturation,
21654
+ lightness: lightness
21655
+ };
21656
+ }
21657
+
21658
+ /**
21659
+ * Returns an HslColor or HslaColor object. This utility function is only useful
21660
+ * if want to extract a color component. With the color util `toColorString` you
21661
+ * can convert a HslColor or HslaColor object back to a string.
21662
+ *
21663
+ * @example
21664
+ * // Assigns `{ hue: 0, saturation: 1, lightness: 0.5 }` to color1
21665
+ * const color1 = parseToHsl('rgb(255, 0, 0)');
21666
+ * // Assigns `{ hue: 128, saturation: 1, lightness: 0.5, alpha: 0.75 }` to color2
21667
+ * const color2 = parseToHsl('hsla(128, 100%, 50%, 0.75)');
21668
+ */
21669
+ function parseToHsl(color) {
21670
+ // Note: At a later stage we can optimize this function as right now a hsl
21671
+ // color would be parsed converted to rgb values and converted back to hsl.
21672
+ return rgbToHsl(parseToRgb(color));
21673
+ }
21674
+
21562
21675
  /**
21563
21676
  * Reduces hex values if possible e.g. #ff8866 to #f86
21564
21677
  * @private
@@ -21567,10 +21680,8 @@ var reduceHexValue = function reduceHexValue(value) {
21567
21680
  if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
21568
21681
  return "#" + value[1] + value[3] + value[5];
21569
21682
  }
21570
-
21571
21683
  return value;
21572
21684
  };
21573
-
21574
21685
  var reduceHexValue$1 = reduceHexValue;
21575
21686
 
21576
21687
  function numberToHex(value) {
@@ -21578,6 +21689,83 @@ function numberToHex(value) {
21578
21689
  return hex.length === 1 ? "0" + hex : hex;
21579
21690
  }
21580
21691
 
21692
+ function colorToHex(color) {
21693
+ return numberToHex(Math.round(color * 255));
21694
+ }
21695
+ function convertToHex(red, green, blue) {
21696
+ return reduceHexValue$1("#" + colorToHex(red) + colorToHex(green) + colorToHex(blue));
21697
+ }
21698
+ function hslToHex(hue, saturation, lightness) {
21699
+ return hslToRgb(hue, saturation, lightness, convertToHex);
21700
+ }
21701
+
21702
+ /**
21703
+ * Returns a string value for the color. The returned result is the smallest possible hex notation.
21704
+ *
21705
+ * @example
21706
+ * // Styles as object usage
21707
+ * const styles = {
21708
+ * background: hsl(359, 0.75, 0.4),
21709
+ * background: hsl({ hue: 360, saturation: 0.75, lightness: 0.4 }),
21710
+ * }
21711
+ *
21712
+ * // styled-components usage
21713
+ * const div = styled.div`
21714
+ * background: ${hsl(359, 0.75, 0.4)};
21715
+ * background: ${hsl({ hue: 360, saturation: 0.75, lightness: 0.4 })};
21716
+ * `
21717
+ *
21718
+ * // CSS in JS Output
21719
+ *
21720
+ * element {
21721
+ * background: "#b3191c";
21722
+ * background: "#b3191c";
21723
+ * }
21724
+ */
21725
+ function hsl(value, saturation, lightness) {
21726
+ if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number') {
21727
+ return hslToHex(value, saturation, lightness);
21728
+ } else if (typeof value === 'object' && saturation === undefined && lightness === undefined) {
21729
+ return hslToHex(value.hue, value.saturation, value.lightness);
21730
+ }
21731
+ throw new PolishedError(1);
21732
+ }
21733
+
21734
+ /**
21735
+ * Returns a string value for the color. The returned result is the smallest possible rgba or hex notation.
21736
+ *
21737
+ * @example
21738
+ * // Styles as object usage
21739
+ * const styles = {
21740
+ * background: hsla(359, 0.75, 0.4, 0.7),
21741
+ * background: hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0,7 }),
21742
+ * background: hsla(359, 0.75, 0.4, 1),
21743
+ * }
21744
+ *
21745
+ * // styled-components usage
21746
+ * const div = styled.div`
21747
+ * background: ${hsla(359, 0.75, 0.4, 0.7)};
21748
+ * background: ${hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0,7 })};
21749
+ * background: ${hsla(359, 0.75, 0.4, 1)};
21750
+ * `
21751
+ *
21752
+ * // CSS in JS Output
21753
+ *
21754
+ * element {
21755
+ * background: "rgba(179,25,28,0.7)";
21756
+ * background: "rgba(179,25,28,0.7)";
21757
+ * background: "#b3191c";
21758
+ * }
21759
+ */
21760
+ function hsla$1(value, saturation, lightness, alpha) {
21761
+ if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number' && typeof alpha === 'number') {
21762
+ return alpha >= 1 ? hslToHex(value, saturation, lightness) : "rgba(" + hslToRgb(value, saturation, lightness) + "," + alpha + ")";
21763
+ } else if (typeof value === 'object' && saturation === undefined && lightness === undefined && alpha === undefined) {
21764
+ return value.alpha >= 1 ? hslToHex(value.hue, value.saturation, value.lightness) : "rgba(" + hslToRgb(value.hue, value.saturation, value.lightness) + "," + value.alpha + ")";
21765
+ }
21766
+ throw new PolishedError(2);
21767
+ }
21768
+
21581
21769
  /**
21582
21770
  * Returns a string value for the color. The returned result is the smallest possible hex notation.
21583
21771
  *
@@ -21607,7 +21795,6 @@ function rgb(value, green, blue) {
21607
21795
  } else if (typeof value === 'object' && green === undefined && blue === undefined) {
21608
21796
  return reduceHexValue$1("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
21609
21797
  }
21610
-
21611
21798
  throw new PolishedError(6);
21612
21799
  }
21613
21800
 
@@ -21654,10 +21841,62 @@ function rgba$1(firstValue, secondValue, thirdValue, fourthValue) {
21654
21841
  } else if (typeof firstValue === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
21655
21842
  return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
21656
21843
  }
21657
-
21658
21844
  throw new PolishedError(7);
21659
21845
  }
21660
21846
 
21847
+ var isRgb = function isRgb(color) {
21848
+ return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined');
21849
+ };
21850
+ var isRgba$1 = function isRgba(color) {
21851
+ return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && typeof color.alpha === 'number';
21852
+ };
21853
+ var isHsl = function isHsl(color) {
21854
+ return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined');
21855
+ };
21856
+ var isHsla$1 = function isHsla(color) {
21857
+ return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && typeof color.alpha === 'number';
21858
+ };
21859
+
21860
+ /**
21861
+ * Converts a RgbColor, RgbaColor, HslColor or HslaColor object to a color string.
21862
+ * This util is useful in case you only know on runtime which color object is
21863
+ * used. Otherwise we recommend to rely on `rgb`, `rgba`, `hsl` or `hsla`.
21864
+ *
21865
+ * @example
21866
+ * // Styles as object usage
21867
+ * const styles = {
21868
+ * background: toColorString({ red: 255, green: 205, blue: 100 }),
21869
+ * background: toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 }),
21870
+ * background: toColorString({ hue: 240, saturation: 1, lightness: 0.5 }),
21871
+ * background: toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 }),
21872
+ * }
21873
+ *
21874
+ * // styled-components usage
21875
+ * const div = styled.div`
21876
+ * background: ${toColorString({ red: 255, green: 205, blue: 100 })};
21877
+ * background: ${toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 })};
21878
+ * background: ${toColorString({ hue: 240, saturation: 1, lightness: 0.5 })};
21879
+ * background: ${toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 })};
21880
+ * `
21881
+ *
21882
+ * // CSS in JS Output
21883
+ * element {
21884
+ * background: "#ffcd64";
21885
+ * background: "rgba(255,205,100,0.72)";
21886
+ * background: "#00f";
21887
+ * background: "rgba(179,25,25,0.72)";
21888
+ * }
21889
+ */
21890
+
21891
+ function toColorString(color) {
21892
+ if (typeof color !== 'object') throw new PolishedError(8);
21893
+ if (isRgba$1(color)) return rgba$1(color);
21894
+ if (isRgb(color)) return rgb(color);
21895
+ if (isHsla$1(color)) return hsla$1(color);
21896
+ if (isHsl(color)) return hsl(color);
21897
+ throw new PolishedError(8);
21898
+ }
21899
+
21661
21900
  // Type definitions taken from https://github.com/gcanti/flow-static-land/blob/master/src/Fun.js
21662
21901
  // eslint-disable-next-line no-unused-vars
21663
21902
  // eslint-disable-next-line no-unused-vars
@@ -21668,14 +21907,156 @@ function curried(f, length, acc) {
21668
21907
  var combined = acc.concat(Array.prototype.slice.call(arguments));
21669
21908
  return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
21670
21909
  };
21671
- } // eslint-disable-next-line no-redeclare
21672
-
21910
+ }
21673
21911
 
21912
+ // eslint-disable-next-line no-redeclare
21674
21913
  function curry(f) {
21675
21914
  // eslint-disable-line no-redeclare
21676
21915
  return curried(f, f.length, []);
21677
21916
  }
21678
21917
 
21918
+ /**
21919
+ * Changes the hue of the color. Hue is a number between 0 to 360. The first
21920
+ * argument for adjustHue is the amount of degrees the color is rotated around
21921
+ * the color wheel, always producing a positive hue value.
21922
+ *
21923
+ * @example
21924
+ * // Styles as object usage
21925
+ * const styles = {
21926
+ * background: adjustHue(180, '#448'),
21927
+ * background: adjustHue('180', 'rgba(101,100,205,0.7)'),
21928
+ * }
21929
+ *
21930
+ * // styled-components usage
21931
+ * const div = styled.div`
21932
+ * background: ${adjustHue(180, '#448')};
21933
+ * background: ${adjustHue('180', 'rgba(101,100,205,0.7)')};
21934
+ * `
21935
+ *
21936
+ * // CSS in JS Output
21937
+ * element {
21938
+ * background: "#888844";
21939
+ * background: "rgba(136,136,68,0.7)";
21940
+ * }
21941
+ */
21942
+ function adjustHue(degree, color) {
21943
+ if (color === 'transparent') return color;
21944
+ var hslColor = parseToHsl(color);
21945
+ return toColorString(_extends$1({}, hslColor, {
21946
+ hue: hslColor.hue + parseFloat(degree)
21947
+ }));
21948
+ }
21949
+
21950
+ // prettier-ignore
21951
+ var curriedAdjustHue = curry /* ::<number | string, string, string> */(adjustHue);
21952
+
21953
+ function guard(lowerBoundary, upperBoundary, value) {
21954
+ return Math.max(lowerBoundary, Math.min(upperBoundary, value));
21955
+ }
21956
+
21957
+ /**
21958
+ * Returns a string value for the darkened color.
21959
+ *
21960
+ * @example
21961
+ * // Styles as object usage
21962
+ * const styles = {
21963
+ * background: darken(0.2, '#FFCD64'),
21964
+ * background: darken('0.2', 'rgba(255,205,100,0.7)'),
21965
+ * }
21966
+ *
21967
+ * // styled-components usage
21968
+ * const div = styled.div`
21969
+ * background: ${darken(0.2, '#FFCD64')};
21970
+ * background: ${darken('0.2', 'rgba(255,205,100,0.7)')};
21971
+ * `
21972
+ *
21973
+ * // CSS in JS Output
21974
+ *
21975
+ * element {
21976
+ * background: "#ffbd31";
21977
+ * background: "rgba(255,189,49,0.7)";
21978
+ * }
21979
+ */
21980
+ function darken(amount, color) {
21981
+ if (color === 'transparent') return color;
21982
+ var hslColor = parseToHsl(color);
21983
+ return toColorString(_extends$1({}, hslColor, {
21984
+ lightness: guard(0, 1, hslColor.lightness - parseFloat(amount))
21985
+ }));
21986
+ }
21987
+
21988
+ // prettier-ignore
21989
+ var curriedDarken = curry /* ::<number | string, string, string> */(darken);
21990
+
21991
+ /**
21992
+ * Decreases the intensity of a color. Its range is between 0 to 1. The first
21993
+ * argument of the desaturate function is the amount by how much the color
21994
+ * intensity should be decreased.
21995
+ *
21996
+ * @example
21997
+ * // Styles as object usage
21998
+ * const styles = {
21999
+ * background: desaturate(0.2, '#CCCD64'),
22000
+ * background: desaturate('0.2', 'rgba(204,205,100,0.7)'),
22001
+ * }
22002
+ *
22003
+ * // styled-components usage
22004
+ * const div = styled.div`
22005
+ * background: ${desaturate(0.2, '#CCCD64')};
22006
+ * background: ${desaturate('0.2', 'rgba(204,205,100,0.7)')};
22007
+ * `
22008
+ *
22009
+ * // CSS in JS Output
22010
+ * element {
22011
+ * background: "#b8b979";
22012
+ * background: "rgba(184,185,121,0.7)";
22013
+ * }
22014
+ */
22015
+ function desaturate(amount, color) {
22016
+ if (color === 'transparent') return color;
22017
+ var hslColor = parseToHsl(color);
22018
+ return toColorString(_extends$1({}, hslColor, {
22019
+ saturation: guard(0, 1, hslColor.saturation - parseFloat(amount))
22020
+ }));
22021
+ }
22022
+
22023
+ // prettier-ignore
22024
+ var curriedDesaturate = curry /* ::<number | string, string, string> */(desaturate);
22025
+
22026
+ /**
22027
+ * Returns a string value for the lightened color.
22028
+ *
22029
+ * @example
22030
+ * // Styles as object usage
22031
+ * const styles = {
22032
+ * background: lighten(0.2, '#CCCD64'),
22033
+ * background: lighten('0.2', 'rgba(204,205,100,0.7)'),
22034
+ * }
22035
+ *
22036
+ * // styled-components usage
22037
+ * const div = styled.div`
22038
+ * background: ${lighten(0.2, '#FFCD64')};
22039
+ * background: ${lighten('0.2', 'rgba(204,205,100,0.7)')};
22040
+ * `
22041
+ *
22042
+ * // CSS in JS Output
22043
+ *
22044
+ * element {
22045
+ * background: "#e5e6b1";
22046
+ * background: "rgba(229,230,177,0.7)";
22047
+ * }
22048
+ */
22049
+ function lighten(amount, color) {
22050
+ if (color === 'transparent') return color;
22051
+ var hslColor = parseToHsl(color);
22052
+ return toColorString(_extends$1({}, hslColor, {
22053
+ lightness: guard(0, 1, hslColor.lightness + parseFloat(amount))
22054
+ }));
22055
+ }
22056
+
22057
+ // prettier-ignore
22058
+ var curriedLighten = curry /* ::<number | string, string, string> */(lighten);
22059
+
21679
22060
  /**
21680
22061
  * Mixes the two provided colors together by calculating the average of each of the RGB components weighted to the first color by the provided weight.
21681
22062
  *
@@ -21702,25 +22083,21 @@ function curry(f) {
21702
22083
  * background: "rgba(63, 0, 191, 0.75)";
21703
22084
  * }
21704
22085
  */
21705
-
21706
22086
  function mix$1(weight, color, otherColor) {
21707
22087
  if (color === 'transparent') return otherColor;
21708
22088
  if (otherColor === 'transparent') return color;
21709
22089
  if (weight === 0) return otherColor;
21710
22090
  var parsedColor1 = parseToRgb(color);
21711
-
21712
22091
  var color1 = _extends$1({}, parsedColor1, {
21713
22092
  alpha: typeof parsedColor1.alpha === 'number' ? parsedColor1.alpha : 1
21714
22093
  });
21715
-
21716
22094
  var parsedColor2 = parseToRgb(otherColor);
21717
-
21718
22095
  var color2 = _extends$1({}, parsedColor2, {
21719
22096
  alpha: typeof parsedColor2.alpha === 'number' ? parsedColor2.alpha : 1
21720
- }); // The formula is copied from the original Sass implementation:
21721
- // http://sass-lang.com/documentation/Sass/Script/Functions.html#mix-instance_method
21722
-
22097
+ });
21723
22098
 
22099
+ // The formula is copied from the original Sass implementation:
22100
+ // http://sass-lang.com/documentation/Sass/Script/Functions.html#mix-instance_method
21724
22101
  var alphaDelta = color1.alpha - color2.alpha;
21725
22102
  var x = parseFloat(weight) * 2 - 1;
21726
22103
  var y = x * alphaDelta === -1 ? x : x + alphaDelta;
@@ -21734,14 +22111,218 @@ function mix$1(weight, color, otherColor) {
21734
22111
  alpha: color1.alpha * parseFloat(weight) + color2.alpha * (1 - parseFloat(weight))
21735
22112
  };
21736
22113
  return rgba$1(mixedColor);
21737
- } // prettier-ignore
21738
-
22114
+ }
21739
22115
 
21740
- var curriedMix = /*#__PURE__*/curry
21741
- /* ::<number | string, string, string, string> */
21742
- (mix$1);
22116
+ // prettier-ignore
22117
+ var curriedMix = curry /* ::<number | string, string, string, string> */(mix$1);
21743
22118
  var mix$1$1 = curriedMix;
21744
22119
 
22120
+ /**
22121
+ * Increases the opacity of a color. Its range for the amount is between 0 to 1.
22122
+ *
22123
+ *
22124
+ * @example
22125
+ * // Styles as object usage
22126
+ * const styles = {
22127
+ * background: opacify(0.1, 'rgba(255, 255, 255, 0.9)');
22128
+ * background: opacify(0.2, 'hsla(0, 0%, 100%, 0.5)'),
22129
+ * background: opacify('0.5', 'rgba(255, 0, 0, 0.2)'),
22130
+ * }
22131
+ *
22132
+ * // styled-components usage
22133
+ * const div = styled.div`
22134
+ * background: ${opacify(0.1, 'rgba(255, 255, 255, 0.9)')};
22135
+ * background: ${opacify(0.2, 'hsla(0, 0%, 100%, 0.5)')},
22136
+ * background: ${opacify('0.5', 'rgba(255, 0, 0, 0.2)')},
22137
+ * `
22138
+ *
22139
+ * // CSS in JS Output
22140
+ *
22141
+ * element {
22142
+ * background: "#fff";
22143
+ * background: "rgba(255,255,255,0.7)";
22144
+ * background: "rgba(255,0,0,0.7)";
22145
+ * }
22146
+ */
22147
+ function opacify(amount, color) {
22148
+ if (color === 'transparent') return color;
22149
+ var parsedColor = parseToRgb(color);
22150
+ var alpha = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1;
22151
+ var colorWithAlpha = _extends$1({}, parsedColor, {
22152
+ alpha: guard(0, 1, (alpha * 100 + parseFloat(amount) * 100) / 100)
22153
+ });
22154
+ return rgba$1(colorWithAlpha);
22155
+ }
22156
+
22157
+ // prettier-ignore
22158
+ var curriedOpacify = curry /* ::<number | string, string, string> */(opacify);
22159
+
22160
+ /**
22161
+ * Increases the intensity of a color. Its range is between 0 to 1. The first
22162
+ * argument of the saturate function is the amount by how much the color
22163
+ * intensity should be increased.
22164
+ *
22165
+ * @example
22166
+ * // Styles as object usage
22167
+ * const styles = {
22168
+ * background: saturate(0.2, '#CCCD64'),
22169
+ * background: saturate('0.2', 'rgba(204,205,100,0.7)'),
22170
+ * }
22171
+ *
22172
+ * // styled-components usage
22173
+ * const div = styled.div`
22174
+ * background: ${saturate(0.2, '#FFCD64')};
22175
+ * background: ${saturate('0.2', 'rgba(204,205,100,0.7)')};
22176
+ * `
22177
+ *
22178
+ * // CSS in JS Output
22179
+ *
22180
+ * element {
22181
+ * background: "#e0e250";
22182
+ * background: "rgba(224,226,80,0.7)";
22183
+ * }
22184
+ */
22185
+ function saturate(amount, color) {
22186
+ if (color === 'transparent') return color;
22187
+ var hslColor = parseToHsl(color);
22188
+ return toColorString(_extends$1({}, hslColor, {
22189
+ saturation: guard(0, 1, hslColor.saturation + parseFloat(amount))
22190
+ }));
22191
+ }
22192
+
22193
+ // prettier-ignore
22194
+ var curriedSaturate = curry /* ::<number | string, string, string> */(saturate);
22195
+
22196
+ /**
22197
+ * Sets the hue of a color to the provided value. The hue range can be
22198
+ * from 0 and 359.
22199
+ *
22200
+ * @example
22201
+ * // Styles as object usage
22202
+ * const styles = {
22203
+ * background: setHue(42, '#CCCD64'),
22204
+ * background: setHue('244', 'rgba(204,205,100,0.7)'),
22205
+ * }
22206
+ *
22207
+ * // styled-components usage
22208
+ * const div = styled.div`
22209
+ * background: ${setHue(42, '#CCCD64')};
22210
+ * background: ${setHue('244', 'rgba(204,205,100,0.7)')};
22211
+ * `
22212
+ *
22213
+ * // CSS in JS Output
22214
+ * element {
22215
+ * background: "#cdae64";
22216
+ * background: "rgba(107,100,205,0.7)";
22217
+ * }
22218
+ */
22219
+ function setHue(hue, color) {
22220
+ if (color === 'transparent') return color;
22221
+ return toColorString(_extends$1({}, parseToHsl(color), {
22222
+ hue: parseFloat(hue)
22223
+ }));
22224
+ }
22225
+
22226
+ // prettier-ignore
22227
+ var curriedSetHue = curry /* ::<number | string, string, string> */(setHue);
22228
+
22229
+ /**
22230
+ * Sets the lightness of a color to the provided value. The lightness range can be
22231
+ * from 0 and 1.
22232
+ *
22233
+ * @example
22234
+ * // Styles as object usage
22235
+ * const styles = {
22236
+ * background: setLightness(0.2, '#CCCD64'),
22237
+ * background: setLightness('0.75', 'rgba(204,205,100,0.7)'),
22238
+ * }
22239
+ *
22240
+ * // styled-components usage
22241
+ * const div = styled.div`
22242
+ * background: ${setLightness(0.2, '#CCCD64')};
22243
+ * background: ${setLightness('0.75', 'rgba(204,205,100,0.7)')};
22244
+ * `
22245
+ *
22246
+ * // CSS in JS Output
22247
+ * element {
22248
+ * background: "#4d4d19";
22249
+ * background: "rgba(223,224,159,0.7)";
22250
+ * }
22251
+ */
22252
+ function setLightness(lightness, color) {
22253
+ if (color === 'transparent') return color;
22254
+ return toColorString(_extends$1({}, parseToHsl(color), {
22255
+ lightness: parseFloat(lightness)
22256
+ }));
22257
+ }
22258
+
22259
+ // prettier-ignore
22260
+ var curriedSetLightness = curry /* ::<number | string, string, string> */(setLightness);
22261
+
22262
+ /**
22263
+ * Sets the saturation of a color to the provided value. The saturation range can be
22264
+ * from 0 and 1.
22265
+ *
22266
+ * @example
22267
+ * // Styles as object usage
22268
+ * const styles = {
22269
+ * background: setSaturation(0.2, '#CCCD64'),
22270
+ * background: setSaturation('0.75', 'rgba(204,205,100,0.7)'),
22271
+ * }
22272
+ *
22273
+ * // styled-components usage
22274
+ * const div = styled.div`
22275
+ * background: ${setSaturation(0.2, '#CCCD64')};
22276
+ * background: ${setSaturation('0.75', 'rgba(204,205,100,0.7)')};
22277
+ * `
22278
+ *
22279
+ * // CSS in JS Output
22280
+ * element {
22281
+ * background: "#adad84";
22282
+ * background: "rgba(228,229,76,0.7)";
22283
+ * }
22284
+ */
22285
+ function setSaturation(saturation, color) {
22286
+ if (color === 'transparent') return color;
22287
+ return toColorString(_extends$1({}, parseToHsl(color), {
22288
+ saturation: parseFloat(saturation)
22289
+ }));
22290
+ }
22291
+
22292
+ // prettier-ignore
22293
+ var curriedSetSaturation = curry /* ::<number | string, string, string> */(setSaturation);
22294
+
22295
+ /**
22296
+ * Shades a color by mixing it with black. `shade` can produce
22297
+ * hue shifts, where as `darken` manipulates the luminance channel and therefore
22298
+ * doesn't produce hue shifts.
22299
+ *
22300
+ * @example
22301
+ * // Styles as object usage
22302
+ * const styles = {
22303
+ * background: shade(0.25, '#00f')
22304
+ * }
22305
+ *
22306
+ * // styled-components usage
22307
+ * const div = styled.div`
22308
+ * background: ${shade(0.25, '#00f')};
22309
+ * `
22310
+ *
22311
+ * // CSS in JS Output
22312
+ *
22313
+ * element {
22314
+ * background: "#00003f";
22315
+ * }
22316
+ */
22317
+
22318
+ function shade(percentage, color) {
22319
+ if (color === 'transparent') return color;
22320
+ return mix$1$1(parseFloat(percentage), 'rgb(0, 0, 0)', color);
22321
+ }
22322
+
22323
+ // prettier-ignore
22324
+ var curriedShade = curry /* ::<number | string, string, string> */(shade);
22325
+
21745
22326
  /**
21746
22327
  * Tints a color by mixing it with white. `tint` can produce
21747
22328
  * hue shifts, where as `lighten` manipulates the luminance channel and therefore
@@ -21768,14 +22349,52 @@ var mix$1$1 = curriedMix;
21768
22349
  function tint(percentage, color) {
21769
22350
  if (color === 'transparent') return color;
21770
22351
  return mix$1$1(parseFloat(percentage), 'rgb(255, 255, 255)', color);
21771
- } // prettier-ignore
21772
-
22352
+ }
21773
22353
 
21774
- var curriedTint = /*#__PURE__*/curry
21775
- /* ::<number | string, string, string> */
21776
- (tint);
22354
+ // prettier-ignore
22355
+ var curriedTint = curry /* ::<number | string, string, string> */(tint);
21777
22356
  var curriedTint$1 = curriedTint;
21778
22357
 
22358
+ /**
22359
+ * Decreases the opacity of a color. Its range for the amount is between 0 to 1.
22360
+ *
22361
+ *
22362
+ * @example
22363
+ * // Styles as object usage
22364
+ * const styles = {
22365
+ * background: transparentize(0.1, '#fff'),
22366
+ * background: transparentize(0.2, 'hsl(0, 0%, 100%)'),
22367
+ * background: transparentize('0.5', 'rgba(255, 0, 0, 0.8)'),
22368
+ * }
22369
+ *
22370
+ * // styled-components usage
22371
+ * const div = styled.div`
22372
+ * background: ${transparentize(0.1, '#fff')};
22373
+ * background: ${transparentize(0.2, 'hsl(0, 0%, 100%)')};
22374
+ * background: ${transparentize('0.5', 'rgba(255, 0, 0, 0.8)')};
22375
+ * `
22376
+ *
22377
+ * // CSS in JS Output
22378
+ *
22379
+ * element {
22380
+ * background: "rgba(255,255,255,0.9)";
22381
+ * background: "rgba(255,255,255,0.8)";
22382
+ * background: "rgba(255,0,0,0.3)";
22383
+ * }
22384
+ */
22385
+ function transparentize(amount, color) {
22386
+ if (color === 'transparent') return color;
22387
+ var parsedColor = parseToRgb(color);
22388
+ var alpha = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1;
22389
+ var colorWithAlpha = _extends$1({}, parsedColor, {
22390
+ alpha: guard(0, 1, +(alpha * 100 - parseFloat(amount) * 100).toFixed(2) / 100)
22391
+ });
22392
+ return rgba$1(colorWithAlpha);
22393
+ }
22394
+
22395
+ // prettier-ignore
22396
+ var curriedTransparentize = curry /* ::<number | string, string, string> */(transparentize);
22397
+
21779
22398
  var linkColor = MATISSE_BLUE;
21780
22399
  var fallbackValues$8 = {
21781
22400
  linkColor: linkColor
@@ -23094,32 +23713,19 @@ var toIndexedObject = function (it) {
23094
23713
  return indexedObject(requireObjectCoercible(it));
23095
23714
  };
23096
23715
 
23097
- var documentAll = typeof document == 'object' && document.all;
23098
-
23099
23716
  // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
23100
- // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
23101
- var IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined;
23102
-
23103
- var documentAll_1 = {
23104
- all: documentAll,
23105
- IS_HTMLDDA: IS_HTMLDDA
23106
- };
23107
-
23108
- var documentAll$1 = documentAll_1.all;
23717
+ var documentAll = typeof document == 'object' && document.all;
23109
23718
 
23110
23719
  // `IsCallable` abstract operation
23111
23720
  // https://tc39.es/ecma262/#sec-iscallable
23112
- var isCallable = documentAll_1.IS_HTMLDDA ? function (argument) {
23113
- return typeof argument == 'function' || argument === documentAll$1;
23721
+ // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
23722
+ var isCallable = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
23723
+ return typeof argument == 'function' || argument === documentAll;
23114
23724
  } : function (argument) {
23115
23725
  return typeof argument == 'function';
23116
23726
  };
23117
23727
 
23118
- var documentAll$2 = documentAll_1.all;
23119
-
23120
- var isObject = documentAll_1.IS_HTMLDDA ? function (it) {
23121
- return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll$2;
23122
- } : function (it) {
23728
+ var isObject = function (it) {
23123
23729
  return typeof it == 'object' ? it !== null : isCallable(it);
23124
23730
  };
23125
23731
 
@@ -23255,10 +23861,10 @@ var shared = createCommonjsModule(function (module) {
23255
23861
  (module.exports = function (key, value) {
23256
23862
  return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
23257
23863
  })('versions', []).push({
23258
- version: '3.33.3',
23864
+ version: '3.35.1',
23259
23865
  mode: 'global',
23260
- copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
23261
- license: 'https://github.com/zloirock/core-js/blob/v3.33.3/LICENSE',
23866
+ copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
23867
+ license: 'https://github.com/zloirock/core-js/blob/v3.35.1/LICENSE',
23262
23868
  source: 'https://github.com/zloirock/core-js'
23263
23869
  });
23264
23870
  });
@@ -23555,7 +24161,7 @@ var TEMPLATE = String(String).split('String');
23555
24161
 
23556
24162
  var makeBuiltIn = module.exports = function (value, name, options) {
23557
24163
  if (stringSlice($String(name), 0, 7) === 'Symbol(') {
23558
- name = '[' + replace($String(name), /^Symbol\(([^)]*)\)/, '$1') + ']';
24164
+ name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
23559
24165
  }
23560
24166
  if (options && options.getter) name = 'get ' + name;
23561
24167
  if (options && options.setter) name = 'set ' + name;
@@ -23643,7 +24249,8 @@ var min$1 = Math.min;
23643
24249
  // `ToLength` abstract operation
23644
24250
  // https://tc39.es/ecma262/#sec-tolength
23645
24251
  var toLength = function (argument) {
23646
- return argument > 0 ? min$1(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
24252
+ var len = toIntegerOrInfinity(argument);
24253
+ return len > 0 ? min$1(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
23647
24254
  };
23648
24255
 
23649
24256
  // `LengthOfArrayLike` abstract operation
@@ -23803,7 +24410,7 @@ var _export = function (options, source) {
23803
24410
  } else if (STATIC) {
23804
24411
  target = global_1[TARGET] || defineGlobalProperty(TARGET, {});
23805
24412
  } else {
23806
- target = (global_1[TARGET] || {}).prototype;
24413
+ target = global_1[TARGET] && global_1[TARGET].prototype;
23807
24414
  }
23808
24415
  if (target) for (key in source) {
23809
24416
  sourceProperty = source[key];
@@ -24066,11 +24673,15 @@ var functionUncurryThisAccessor = function (object, key, method) {
24066
24673
  } catch (error) { /* empty */ }
24067
24674
  };
24068
24675
 
24676
+ var isPossiblePrototype = function (argument) {
24677
+ return isObject(argument) || argument === null;
24678
+ };
24679
+
24069
24680
  var $String$4 = String;
24070
24681
  var $TypeError$6 = TypeError;
24071
24682
 
24072
24683
  var aPossiblePrototype = function (argument) {
24073
- if (typeof argument == 'object' || isCallable(argument)) return argument;
24684
+ if (isPossiblePrototype(argument)) return argument;
24074
24685
  throw new $TypeError$6("Can't set " + $String$4(argument) + ' as a prototype');
24075
24686
  };
24076
24687