@nypl/design-system-react-components 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2662,6 +2662,18 @@ var getAriaAttrs = function getAriaAttrs(_ref) {
2662
2662
  }
2663
2663
  return ariaAttributes;
2664
2664
  };
2665
+ /** Convert a hex color value to an rgb or rgba value */
2666
+ var hexToRGB = function hexToRGB(hex, alpha) {
2667
+ var shortHex = hex.length === 4;
2668
+ var rSlice = shortHex ? hex.slice(1, 2).repeat(2) : hex.slice(1, 3),
2669
+ gSlice = shortHex ? hex.slice(2, 3).repeat(2) : hex.slice(3, 5),
2670
+ bSlice = shortHex ? hex.slice(3, 4).repeat(2) : hex.slice(5, 7);
2671
+ var r = parseInt(rSlice, 16),
2672
+ g = parseInt(gSlice, 16),
2673
+ b = parseInt(bSlice, 16);
2674
+ var rgb = r + ", " + g + ", " + b;
2675
+ return alpha ? "rgba(" + rgb + "," + alpha + ")" : "rgb(" + rgb + ")";
2676
+ };
2665
2677
 
2666
2678
  var _excluded$12 = ["isIndeterminate", "isChecked"],
2667
2679
  _excluded2$2 = ["className", "invalidText", "helperText", "id", "isChecked", "isDisabled", "isIndeterminate", "isInvalid", "isRequired", "labelText", "name", "onChange", "showHelperInvalidText", "showLabel", "value"];
@@ -3544,7 +3556,7 @@ var Label = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props, ref) {
3544
3556
  }, rest), children, isRequired && React__default.createElement("span", null, requiredLabelText ? " (" + requiredLabelText + ")" : " (Required)"));
3545
3557
  }));
3546
3558
 
3547
- var _excluded$19 = ["className", "defaultValue", "helperText", "id", "invalidText", "isClearable", "isDisabled", "isInvalid", "isRequired", "labelText", "max", "maxLength", "min", "name", "onChange", "onClick", "onFocus", "placeholder", "showHelperInvalidText", "showLabel", "showRequiredLabel", "requiredLabelText", "step", "textInputType", "type", "value"];
3559
+ var _excluded$19 = ["className", "defaultValue", "helperText", "id", "invalidText", "isClearable", "isClearableCallback", "isDisabled", "isInvalid", "isRequired", "labelText", "max", "maxLength", "min", "name", "onChange", "onClick", "onFocus", "placeholder", "showHelperInvalidText", "showLabel", "showRequiredLabel", "requiredLabelText", "step", "textInputType", "type", "value"];
3548
3560
  // Only used internally.
3549
3561
  var TextInputFormats = {
3550
3562
  email: "jdoe@domain.com",
@@ -3568,6 +3580,7 @@ var TextInput = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props, re
3568
3580
  invalidText = props.invalidText,
3569
3581
  _props$isClearable = props.isClearable,
3570
3582
  isClearable = _props$isClearable === void 0 ? false : _props$isClearable,
3583
+ isClearableCallback = props.isClearableCallback,
3571
3584
  _props$isDisabled = props.isDisabled,
3572
3585
  isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
3573
3586
  _props$isInvalid = props.isInvalid,
@@ -3626,6 +3639,7 @@ var TextInput = /*#__PURE__*/chakra( /*#__PURE__*/forwardRef(function (props, re
3626
3639
  });
3627
3640
  var onClearClick = function onClearClick() {
3628
3641
  setFinalValue("");
3642
+ isClearableCallback && isClearableCallback();
3629
3643
  // Set focus back to the input element.
3630
3644
  finalRef.current.focus();
3631
3645
  };
@@ -4256,6 +4270,8 @@ var grayMedium = "#BDBDBD";
4256
4270
  var grayLightCool = "#E9E9E9";
4257
4271
  var grayxLightCool = "#F5F5F5";
4258
4272
  var grayxxLightCool = "#FAFAFA";
4273
+ var linkPrimary = "#0576D3";
4274
+ var linkSecondary = "#004B98";
4259
4275
  var brandPrimary = "#C60917";
4260
4276
  var brandSecondary = "#760000";
4261
4277
  var brandObj = {
@@ -4279,8 +4295,9 @@ var colors = {
4279
4295
  },
4280
4296
  focus: "#4181F1",
4281
4297
  link: {
4282
- primary: "#0576D3",
4283
- secondary: "#004B98"
4298
+ primary: linkPrimary,
4299
+ "primary-05": /*#__PURE__*/hexToRGB(linkPrimary, 0.05),
4300
+ secondary: linkSecondary
4284
4301
  },
4285
4302
  status: {
4286
4303
  primary: "#F9E08E",
@@ -4881,7 +4898,7 @@ var secondary = function secondary(_ref2) {
4881
4898
  color: "ui.link.primary"
4882
4899
  }, generalSizeValues(buttonSize), {
4883
4900
  _hover: {
4884
- bg: "ui.bg.default",
4901
+ bg: "ui.link.primary-05",
4885
4902
  borderColor: "ui.link.secondary",
4886
4903
  color: "ui.link.secondary"
4887
4904
  },
@@ -5503,7 +5520,14 @@ var select = {
5503
5520
  },
5504
5521
  _active: selectTextInputFocusStyles,
5505
5522
  _disabled: /*#__PURE__*/_extends({}, selectTextInputDisabledStyles),
5506
- _focus: selectTextInputFocusStyles,
5523
+ _focus: /*#__PURE__*/_extends({}, selectTextInputFocusStyles, {
5524
+ // When the select is focused, the icon should be on top of the dropdown.
5525
+ // This should only be done when focused, otherswise the icon will render
5526
+ // above any other elements on the page.
5527
+ "+ .chakra-select__icon-wrapper": {
5528
+ zIndex: "9999"
5529
+ }
5530
+ }),
5507
5531
  _invalid: {
5508
5532
  border: "1px solid",
5509
5533
  borderColor: "ui.error.primary",
@@ -5515,12 +5539,6 @@ var Select = {
5515
5539
  baseStyle: function baseStyle(_ref) {
5516
5540
  var labelPosition = _ref.labelPosition;
5517
5541
  return {
5518
- // The backgroundColor set to "ui.white" hides the arrow SVG icon when
5519
- // the component is focused. The background is added for dark mode and
5520
- // so we need to add specific selector.
5521
- ".chakra-select__icon-wrapper": {
5522
- zIndex: "9999"
5523
- },
5524
5542
  inline: {
5525
5543
  display: {
5526
5544
  md: "flex"