@primer/react 38.42.0-rc.23d625bd0 → 38.42.0-rc.29d77833a

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 CHANGED
@@ -6,8 +6,14 @@
6
6
 
7
7
  - [#8513](https://github.com/primer/react/pull/8513) [`1bab81a`](https://github.com/primer/react/commit/1bab81a0eb3f613c8d6b4abd36bd92d0ac6cedc4) Thanks [@tay1orjones](https://github.com/tay1orjones)! - ActionMenu, Overlay: Add `preventFocusOnClose` to let consumers manage focus when an overlay closes.
8
8
 
9
+ - [#8525](https://github.com/primer/react/pull/8525) [`013ab30`](https://github.com/primer/react/commit/013ab3078785ee90afe8a7562576fe0a26001b96) Thanks [@tay1orjones](https://github.com/tay1orjones)! - TextInput and Textarea: Deprecate the `contrast` prop. Omit it to use the default background.
10
+
9
11
  - [#8415](https://github.com/primer/react/pull/8415) [`66a9f31`](https://github.com/primer/react/commit/66a9f31611c642209f66ed68b7d43712b09dbd88) Thanks [@rickyzhangca](https://github.com/rickyzhangca)! - DataTable: Add controlled and uncontrolled row selection.
10
12
 
13
+ ### Patch Changes
14
+
15
+ - [#8508](https://github.com/primer/react/pull/8508) [`f71dce4`](https://github.com/primer/react/commit/f71dce4869dedf4cb8460ed2fa8e18edc0604198) Thanks [@namangoyal176-10](https://github.com/namangoyal176-10)! - FormControl: Prevent duplicate input rendering when layout is horizontal with non-choice inputs
16
+
11
17
  ## 38.41.0
12
18
 
13
19
  ### Minor Changes
@@ -24,7 +24,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
24
24
  import { clsx } from "clsx";
25
25
  var FormControl_default = Object.assign(/* @__PURE__ */ React.forwardRef((t0, ref) => {
26
26
  var _slots$validation, _slots$label;
27
- const $ = c(32);
27
+ const $ = c(23);
28
28
  const { children, disabled: disabledProp, layout: t1, id: idProp, required, className, style } = t0;
29
29
  const layout = t1 === void 0 ? "vertical" : t1;
30
30
  let t2;
@@ -78,87 +78,65 @@ var FormControl_default = Object.assign(/* @__PURE__ */ React.forwardRef((t0, re
78
78
  warning(isRadioInput && childrenWithoutSlots.find(_temp), "An individual radio cannot be a required field.");
79
79
  } else warning(!!slots.leadingVisual, "A leading visual is only rendered for a checkbox or radio form control. If you want to render a leading visual inside of your input, check if your input supports a leading visual.");
80
80
  const isLabelHidden = (_slots$label = slots.label) === null || _slots$label === void 0 ? void 0 : _slots$label.props.visuallyHidden;
81
- const t4 = /*#__PURE__*/ React.isValidElement(InputComponent) ? /*#__PURE__*/ React.cloneElement(InputComponent, {
82
- id,
83
- disabled,
84
- required: required && !isRadioInput,
85
- "aria-describedby": captionId
86
- }) : null;
87
- let t5;
88
- if ($[4] !== childrenWithoutSlots) {
89
- t5 = childrenWithoutSlots.filter(_temp2);
90
- $[4] = childrenWithoutSlots;
91
- $[5] = t5;
92
- } else t5 = $[5];
93
- let t6;
94
- if ($[6] !== t4 || $[7] !== t5) {
95
- t6 = /* @__PURE__ */ jsxs("div", {
96
- className: FormControl_module_css_default.ControlChoiceInputs,
97
- children: [t4, t5]
98
- });
99
- $[6] = t4;
100
- $[7] = t5;
101
- $[8] = t6;
102
- } else t6 = $[8];
103
- let t7;
104
- if ($[9] !== disabled || $[10] !== slots.caption || $[11] !== slots.leadingVisual) {
105
- t7 = slots.leadingVisual ? /* @__PURE__ */ jsx("div", {
81
+ let t4;
82
+ if ($[4] !== disabled || $[5] !== slots.caption || $[6] !== slots.leadingVisual) {
83
+ t4 = slots.leadingVisual ? /* @__PURE__ */ jsx("div", {
106
84
  className: FormControl_module_css_default.LeadingVisual,
107
85
  "data-disabled": disabled ? "" : void 0,
108
86
  "data-has-caption": slots.caption ? "" : void 0,
109
87
  children: slots.leadingVisual
110
88
  }) : null;
111
- $[9] = disabled;
112
- $[10] = slots.caption;
113
- $[11] = slots.leadingVisual;
114
- $[12] = t7;
115
- } else t7 = $[12];
116
- let t8;
117
- if ($[13] !== slots.caption || $[14] !== slots.label) {
118
- t8 = /* @__PURE__ */ jsxs("div", {
89
+ $[4] = disabled;
90
+ $[5] = slots.caption;
91
+ $[6] = slots.leadingVisual;
92
+ $[7] = t4;
93
+ } else t4 = $[7];
94
+ let t5;
95
+ if ($[8] !== slots.caption || $[9] !== slots.label) {
96
+ t5 = /* @__PURE__ */ jsxs("div", {
119
97
  className: FormControl_module_css_default.LabelContainer,
120
98
  children: [slots.label, slots.caption]
121
99
  });
122
- $[13] = slots.caption;
123
- $[14] = slots.label;
124
- $[15] = t8;
125
- } else t8 = $[15];
126
- let t9;
127
- if ($[16] !== t6 || $[17] !== t7 || $[18] !== t8) {
128
- t9 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
129
- t6,
130
- t7,
131
- t8
132
- ] });
133
- $[16] = t6;
134
- $[17] = t7;
135
- $[18] = t8;
136
- $[19] = t9;
137
- } else t9 = $[19];
138
- const InputChildren = t9;
100
+ $[8] = slots.caption;
101
+ $[9] = slots.label;
102
+ $[10] = t5;
103
+ } else t5 = $[10];
104
+ const InputChildren = /* @__PURE__ */ jsxs(Fragment$1, { children: [
105
+ /* @__PURE__ */ jsxs("div", {
106
+ className: FormControl_module_css_default.ControlChoiceInputs,
107
+ children: [/*#__PURE__*/ React.isValidElement(InputComponent) ? /*#__PURE__*/ React.cloneElement(InputComponent, {
108
+ id,
109
+ disabled,
110
+ required: required && !isRadioInput,
111
+ "aria-describedby": captionId
112
+ }) : null, childrenWithoutSlots.filter((child_1) => /*#__PURE__*/ React.isValidElement(child_1) && !expectedInputComponents.some((inputComponent_0) => child_1.type === inputComponent_0 || isSlot(child_1, inputComponent_0)))]
113
+ }),
114
+ t4,
115
+ t5
116
+ ] });
139
117
  const T0 = FormControlContextProvider;
140
- const t10 = !isSelectPanelInput;
141
- let t11;
142
- if ($[20] !== captionId || $[21] !== disabled || $[22] !== id || $[23] !== labelId || $[24] !== required || $[25] !== t10 || $[26] !== validationMessageId) {
143
- t11 = {
118
+ const t6 = !isSelectPanelInput;
119
+ let t7;
120
+ if ($[11] !== captionId || $[12] !== disabled || $[13] !== id || $[14] !== labelId || $[15] !== required || $[16] !== t6 || $[17] !== validationMessageId) {
121
+ t7 = {
144
122
  captionId,
145
123
  disabled,
146
124
  id,
147
125
  required,
148
126
  validationMessageId,
149
- isReferenced: t10,
127
+ isReferenced: t6,
150
128
  labelId
151
129
  };
152
- $[20] = captionId;
153
- $[21] = disabled;
154
- $[22] = id;
155
- $[23] = labelId;
156
- $[24] = required;
157
- $[25] = t10;
158
- $[26] = validationMessageId;
159
- $[27] = t11;
160
- } else t11 = $[27];
161
- const t12 = isChoiceInput || layout === "horizontal" ? /* @__PURE__ */ jsx("div", {
130
+ $[11] = captionId;
131
+ $[12] = disabled;
132
+ $[13] = id;
133
+ $[14] = labelId;
134
+ $[15] = required;
135
+ $[16] = t6;
136
+ $[17] = validationMessageId;
137
+ $[18] = t7;
138
+ } else t7 = $[18];
139
+ const t8 = isChoiceInput || layout === "horizontal" ? /* @__PURE__ */ jsx("div", {
162
140
  ref,
163
141
  "data-has-leading-visual": slots.leadingVisual ? "" : void 0,
164
142
  className: clsx(className, FormControl_module_css_default.ControlHorizontalLayout),
@@ -188,18 +166,18 @@ var FormControl_default = Object.assign(/* @__PURE__ */ React.forwardRef((t0, re
188
166
  slots.caption
189
167
  ]
190
168
  });
191
- let t13;
192
- if ($[28] !== T0 || $[29] !== t11 || $[30] !== t12) {
193
- t13 = /* @__PURE__ */ jsx(T0, {
194
- value: t11,
195
- children: t12
169
+ let t9;
170
+ if ($[19] !== T0 || $[20] !== t7 || $[21] !== t8) {
171
+ t9 = /* @__PURE__ */ jsx(T0, {
172
+ value: t7,
173
+ children: t8
196
174
  });
197
- $[28] = T0;
198
- $[29] = t11;
199
- $[30] = t12;
200
- $[31] = t13;
201
- } else t13 = $[31];
202
- return t13;
175
+ $[19] = T0;
176
+ $[20] = t7;
177
+ $[21] = t8;
178
+ $[22] = t9;
179
+ } else t9 = $[22];
180
+ return t9;
203
181
  }), {
204
182
  __SLOT__: Symbol("FormControl"),
205
183
  Caption: FormControlCaption,
@@ -211,8 +189,5 @@ function _temp(child_0) {
211
189
  var _child_0$props;
212
190
  return /*#__PURE__*/ React.isValidElement(child_0) && ((_child_0$props = child_0.props) === null || _child_0$props === void 0 ? void 0 : _child_0$props.required);
213
191
  }
214
- function _temp2(child_1) {
215
- return /*#__PURE__*/ React.isValidElement(child_1) && ![Checkbox, Radio].some((inputComponent_0) => child_1.type === inputComponent_0 || isSlot(child_1, inputComponent_0));
216
- }
217
192
  //#endregion
218
193
  export { FormControl_default as default };
@@ -25,7 +25,7 @@ type TextareaProps = {
25
25
  */
26
26
  autoSize?: boolean;
27
27
  /**
28
- * apply a high contrast color to background
28
+ * @deprecated Omit this prop to use the default background.
29
29
  */
30
30
  contrast?: boolean;
31
31
  /**
@@ -76,7 +76,7 @@ declare const Textarea: React.ForwardRefExoticComponent<{
76
76
  */
77
77
  autoSize?: boolean;
78
78
  /**
79
- * apply a high contrast color to background
79
+ * @deprecated Omit this prop to use the default background.
80
80
  */
81
81
  contrast?: boolean;
82
82
  /**
@@ -5,6 +5,9 @@ import React, { ComponentProps } from "react";
5
5
  type TextInputSizes = 'small' | 'medium' | 'large';
6
6
  type StyledTextInputBaseWrapperProps = {
7
7
  block?: boolean;
8
+ /**
9
+ * @deprecated Omit this prop to use the default background.
10
+ */
8
11
  contrast?: boolean;
9
12
  disabled?: boolean;
10
13
  hasTrailingAction?: boolean;
@@ -8048,7 +8048,8 @@
8048
8048
  "name": "contrast",
8049
8049
  "type": "boolean",
8050
8050
  "defaultValue": "false",
8051
- "description": "Changes background color to a higher contrast color"
8051
+ "deprecated": true,
8052
+ "description": "Deprecated. Omit this prop to use the default background."
8052
8053
  },
8053
8054
  {
8054
8055
  "name": "size",
@@ -8398,7 +8399,8 @@
8398
8399
  "name": "contrast",
8399
8400
  "type": "boolean",
8400
8401
  "defaultValue": "false",
8401
- "description": "Changes background color to a higher contrast color"
8402
+ "deprecated": true,
8403
+ "description": "Deprecated. Omit this prop to use the default background."
8402
8404
  },
8403
8405
  {
8404
8406
  "name": "validationStatus",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.42.0-rc.23d625bd0",
4
+ "version": "38.42.0-rc.29d77833a",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",