@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.
- package/CHANGELOG.md +14 -0
- package/dist/components/TextInput/TextInput.d.ts +2 -0
- package/dist/design-system-react-components.cjs.development.js +29 -11
- package/dist/design-system-react-components.cjs.development.js.map +1 -1
- package/dist/design-system-react-components.cjs.production.min.js +1 -1
- package/dist/design-system-react-components.cjs.production.min.js.map +1 -1
- package/dist/design-system-react-components.esm.js +29 -11
- package/dist/design-system-react-components.esm.js.map +1 -1
- package/dist/theme/components/select.d.ts +3 -3
- package/dist/utils/utils.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,20 @@ Currently, this repo is in Prerelease. When it is released, this project will ad
|
|
|
8
8
|
|
|
9
9
|
## Prerelease
|
|
10
10
|
|
|
11
|
+
## 1.3.1 (December 15, 2022)
|
|
12
|
+
|
|
13
|
+
### Adds
|
|
14
|
+
|
|
15
|
+
- Adds the optional `isClearableCallback` prop to the `TextInput` component. This prop works with the `isClearable` prop and the passed function is invoked when the "clear" button is clicked. This is most helpful for controlled `TextInput` component implementations.
|
|
16
|
+
|
|
17
|
+
## Updates
|
|
18
|
+
|
|
19
|
+
- Updates the background color for the `hover` state in the `secondary` variant of the `Button` component.
|
|
20
|
+
|
|
21
|
+
### Fixes
|
|
22
|
+
|
|
23
|
+
- Fixes the z-index value of the SVG icon in the `Select` component so it does not render above other elements on a consuming application's page.
|
|
24
|
+
|
|
11
25
|
## 1.3.0 (December 8, 2022)
|
|
12
26
|
|
|
13
27
|
This release is exactly the same as the `1.3.0-rc` release candidate published on December 2, 2022. The `rc` release was reviewed and validated.
|
|
@@ -24,6 +24,8 @@ export interface InputProps {
|
|
|
24
24
|
invalidText?: HelperErrorTextType;
|
|
25
25
|
/** Adds a button to clear existing text in the input field. */
|
|
26
26
|
isClearable?: boolean;
|
|
27
|
+
/** The callback function that is called when the clear button is clicked. */
|
|
28
|
+
isClearableCallback?: () => void;
|
|
27
29
|
/** Adds the `disabled` and `aria-disabled` prop to the input when true */
|
|
28
30
|
isDisabled?: boolean;
|
|
29
31
|
/** Adds errored styling to the input/textarea and helper text elements */
|
|
@@ -2668,6 +2668,18 @@ var getAriaAttrs = function getAriaAttrs(_ref) {
|
|
|
2668
2668
|
}
|
|
2669
2669
|
return ariaAttributes;
|
|
2670
2670
|
};
|
|
2671
|
+
/** Convert a hex color value to an rgb or rgba value */
|
|
2672
|
+
var hexToRGB = function hexToRGB(hex, alpha) {
|
|
2673
|
+
var shortHex = hex.length === 4;
|
|
2674
|
+
var rSlice = shortHex ? hex.slice(1, 2).repeat(2) : hex.slice(1, 3),
|
|
2675
|
+
gSlice = shortHex ? hex.slice(2, 3).repeat(2) : hex.slice(3, 5),
|
|
2676
|
+
bSlice = shortHex ? hex.slice(3, 4).repeat(2) : hex.slice(5, 7);
|
|
2677
|
+
var r = parseInt(rSlice, 16),
|
|
2678
|
+
g = parseInt(gSlice, 16),
|
|
2679
|
+
b = parseInt(bSlice, 16);
|
|
2680
|
+
var rgb = r + ", " + g + ", " + b;
|
|
2681
|
+
return alpha ? "rgba(" + rgb + "," + alpha + ")" : "rgb(" + rgb + ")";
|
|
2682
|
+
};
|
|
2671
2683
|
|
|
2672
2684
|
var _excluded$12 = ["isIndeterminate", "isChecked"],
|
|
2673
2685
|
_excluded2$2 = ["className", "invalidText", "helperText", "id", "isChecked", "isDisabled", "isIndeterminate", "isInvalid", "isRequired", "labelText", "name", "onChange", "showHelperInvalidText", "showLabel", "value"];
|
|
@@ -3550,7 +3562,7 @@ var Label = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(function (p
|
|
|
3550
3562
|
}, rest), children, isRequired && React__default.createElement("span", null, requiredLabelText ? " (" + requiredLabelText + ")" : " (Required)"));
|
|
3551
3563
|
}));
|
|
3552
3564
|
|
|
3553
|
-
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"];
|
|
3565
|
+
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"];
|
|
3554
3566
|
// Only used internally.
|
|
3555
3567
|
var TextInputFormats = {
|
|
3556
3568
|
email: "jdoe@domain.com",
|
|
@@ -3574,6 +3586,7 @@ var TextInput = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(functio
|
|
|
3574
3586
|
invalidText = props.invalidText,
|
|
3575
3587
|
_props$isClearable = props.isClearable,
|
|
3576
3588
|
isClearable = _props$isClearable === void 0 ? false : _props$isClearable,
|
|
3589
|
+
isClearableCallback = props.isClearableCallback,
|
|
3577
3590
|
_props$isDisabled = props.isDisabled,
|
|
3578
3591
|
isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
|
|
3579
3592
|
_props$isInvalid = props.isInvalid,
|
|
@@ -3632,6 +3645,7 @@ var TextInput = /*#__PURE__*/react.chakra( /*#__PURE__*/React.forwardRef(functio
|
|
|
3632
3645
|
});
|
|
3633
3646
|
var onClearClick = function onClearClick() {
|
|
3634
3647
|
setFinalValue("");
|
|
3648
|
+
isClearableCallback && isClearableCallback();
|
|
3635
3649
|
// Set focus back to the input element.
|
|
3636
3650
|
finalRef.current.focus();
|
|
3637
3651
|
};
|
|
@@ -4262,6 +4276,8 @@ var grayMedium = "#BDBDBD";
|
|
|
4262
4276
|
var grayLightCool = "#E9E9E9";
|
|
4263
4277
|
var grayxLightCool = "#F5F5F5";
|
|
4264
4278
|
var grayxxLightCool = "#FAFAFA";
|
|
4279
|
+
var linkPrimary = "#0576D3";
|
|
4280
|
+
var linkSecondary = "#004B98";
|
|
4265
4281
|
var brandPrimary = "#C60917";
|
|
4266
4282
|
var brandSecondary = "#760000";
|
|
4267
4283
|
var brandObj = {
|
|
@@ -4285,8 +4301,9 @@ var colors = {
|
|
|
4285
4301
|
},
|
|
4286
4302
|
focus: "#4181F1",
|
|
4287
4303
|
link: {
|
|
4288
|
-
primary:
|
|
4289
|
-
|
|
4304
|
+
primary: linkPrimary,
|
|
4305
|
+
"primary-05": /*#__PURE__*/hexToRGB(linkPrimary, 0.05),
|
|
4306
|
+
secondary: linkSecondary
|
|
4290
4307
|
},
|
|
4291
4308
|
status: {
|
|
4292
4309
|
primary: "#F9E08E",
|
|
@@ -4887,7 +4904,7 @@ var secondary = function secondary(_ref2) {
|
|
|
4887
4904
|
color: "ui.link.primary"
|
|
4888
4905
|
}, generalSizeValues(buttonSize), {
|
|
4889
4906
|
_hover: {
|
|
4890
|
-
bg: "ui.
|
|
4907
|
+
bg: "ui.link.primary-05",
|
|
4891
4908
|
borderColor: "ui.link.secondary",
|
|
4892
4909
|
color: "ui.link.secondary"
|
|
4893
4910
|
},
|
|
@@ -5509,7 +5526,14 @@ var select = {
|
|
|
5509
5526
|
},
|
|
5510
5527
|
_active: selectTextInputFocusStyles,
|
|
5511
5528
|
_disabled: /*#__PURE__*/_extends({}, selectTextInputDisabledStyles),
|
|
5512
|
-
_focus: selectTextInputFocusStyles,
|
|
5529
|
+
_focus: /*#__PURE__*/_extends({}, selectTextInputFocusStyles, {
|
|
5530
|
+
// When the select is focused, the icon should be on top of the dropdown.
|
|
5531
|
+
// This should only be done when focused, otherswise the icon will render
|
|
5532
|
+
// above any other elements on the page.
|
|
5533
|
+
"+ .chakra-select__icon-wrapper": {
|
|
5534
|
+
zIndex: "9999"
|
|
5535
|
+
}
|
|
5536
|
+
}),
|
|
5513
5537
|
_invalid: {
|
|
5514
5538
|
border: "1px solid",
|
|
5515
5539
|
borderColor: "ui.error.primary",
|
|
@@ -5521,12 +5545,6 @@ var Select = {
|
|
|
5521
5545
|
baseStyle: function baseStyle(_ref) {
|
|
5522
5546
|
var labelPosition = _ref.labelPosition;
|
|
5523
5547
|
return {
|
|
5524
|
-
// The backgroundColor set to "ui.white" hides the arrow SVG icon when
|
|
5525
|
-
// the component is focused. The background is added for dark mode and
|
|
5526
|
-
// so we need to add specific selector.
|
|
5527
|
-
".chakra-select__icon-wrapper": {
|
|
5528
|
-
zIndex: "9999"
|
|
5529
|
-
},
|
|
5530
5548
|
inline: {
|
|
5531
5549
|
display: {
|
|
5532
5550
|
md: "flex"
|