@carbon/react 1.64.0-rc.0 → 1.64.0

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.
@@ -108,6 +108,7 @@ function AccordionItem(_ref) {
108
108
  className: `${prefix}--accordion__title`
109
109
  }, title)), /*#__PURE__*/React__default.createElement("div", {
110
110
  ref: content,
111
+ hidden: !isOpen,
111
112
  className: `${prefix}--accordion__wrapper`,
112
113
  onTransitionEnd: onAnimationEnd
113
114
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -22,7 +22,7 @@ import '../FluidForm/FluidForm.js';
22
22
  import { FormContext } from '../FluidForm/FormContext.js';
23
23
  import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
24
24
  import { match } from '../../internal/keyboard/match.js';
25
- import { Escape, ArrowDown } from '../../internal/keyboard/keys.js';
25
+ import { Escape, ArrowDown, Tab } from '../../internal/keyboard/keys.js';
26
26
 
27
27
  // Weekdays shorthand for english locale
28
28
  l10n.en.weekdays.shorthand.forEach((_day, index) => {
@@ -550,6 +550,21 @@ const DatePicker = /*#__PURE__*/React__default.forwardRef(function DatePicker(_r
550
550
  }
551
551
  }, [value, prefix]); //eslint-disable-line react-hooks/exhaustive-deps
552
552
 
553
+ useEffect(() => {
554
+ if (!calendarRef.current || !startInputField.current) return;
555
+ const handleKeyDown = event => {
556
+ if (match(event, Tab) && !event.shiftKey && document.activeElement === endInputField.current && calendarRef.current.isOpen) {
557
+ calendarRef.current.close();
558
+ // Remove focus from endDate calendar input
559
+ document.activeElement instanceof HTMLElement &&
560
+ // this is to fix the TS warning
561
+ document?.activeElement?.blur();
562
+ onCalendarClose(calendarRef.current.selectedDates, '', calendarRef.current, event);
563
+ }
564
+ };
565
+ document.addEventListener('keydown', handleKeyDown, true);
566
+ return () => document.removeEventListener('keydown', handleKeyDown, true);
567
+ }, [calendarRef, startInputField, endInputField, onCalendarClose]);
553
568
  let fluidError;
554
569
  if (isFluid) {
555
570
  if (invalid) {
@@ -163,9 +163,17 @@ const NumberInput = /*#__PURE__*/React__default.forwardRef(function NumberInput(
163
163
  const Icon = normalizedProps.icon;
164
164
  function handleStepperClick(event, direction) {
165
165
  if (inputRef.current) {
166
- direction === 'up' ? inputRef.current.stepUp() : inputRef.current.stepDown();
166
+ const currentValue = Number(inputRef.current.value);
167
+ let newValue = direction === 'up' ? currentValue + step : currentValue - step;
168
+ if (min !== undefined) {
169
+ newValue = Math.max(newValue, min);
170
+ }
171
+ if (max !== undefined) {
172
+ newValue = Math.min(newValue, max);
173
+ }
174
+ const currentInputValue = inputRef.current ? inputRef.current.value : '';
167
175
  const state = {
168
- value: allowEmpty && inputRef.current.value === '' ? '' : Number(inputRef.current.value),
176
+ value: allowEmpty && currentInputValue === '' && step === 0 ? '' : newValue,
169
177
  direction: direction
170
178
  };
171
179
  setValue(state.value);
@@ -118,6 +118,7 @@ function AccordionItem(_ref) {
118
118
  className: `${prefix}--accordion__title`
119
119
  }, title)), /*#__PURE__*/React__default["default"].createElement("div", {
120
120
  ref: content,
121
+ hidden: !isOpen,
121
122
  className: `${prefix}--accordion__wrapper`,
122
123
  onTransitionEnd: onAnimationEnd
123
124
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -562,6 +562,21 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
562
562
  }
563
563
  }, [value, prefix]); //eslint-disable-line react-hooks/exhaustive-deps
564
564
 
565
+ React.useEffect(() => {
566
+ if (!calendarRef.current || !startInputField.current) return;
567
+ const handleKeyDown = event => {
568
+ if (match.match(event, keys.Tab) && !event.shiftKey && document.activeElement === endInputField.current && calendarRef.current.isOpen) {
569
+ calendarRef.current.close();
570
+ // Remove focus from endDate calendar input
571
+ document.activeElement instanceof HTMLElement &&
572
+ // this is to fix the TS warning
573
+ document?.activeElement?.blur();
574
+ onCalendarClose(calendarRef.current.selectedDates, '', calendarRef.current, event);
575
+ }
576
+ };
577
+ document.addEventListener('keydown', handleKeyDown, true);
578
+ return () => document.removeEventListener('keydown', handleKeyDown, true);
579
+ }, [calendarRef, startInputField, endInputField, onCalendarClose]);
565
580
  let fluidError;
566
581
  if (isFluid) {
567
582
  if (invalid) {
@@ -173,9 +173,17 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
173
173
  const Icon = normalizedProps.icon;
174
174
  function handleStepperClick(event, direction) {
175
175
  if (inputRef.current) {
176
- direction === 'up' ? inputRef.current.stepUp() : inputRef.current.stepDown();
176
+ const currentValue = Number(inputRef.current.value);
177
+ let newValue = direction === 'up' ? currentValue + step : currentValue - step;
178
+ if (min !== undefined) {
179
+ newValue = Math.max(newValue, min);
180
+ }
181
+ if (max !== undefined) {
182
+ newValue = Math.min(newValue, max);
183
+ }
184
+ const currentInputValue = inputRef.current ? inputRef.current.value : '';
177
185
  const state = {
178
- value: allowEmpty && inputRef.current.value === '' ? '' : Number(inputRef.current.value),
186
+ value: allowEmpty && currentInputValue === '' && step === 0 ? '' : newValue,
179
187
  direction: direction
180
188
  };
181
189
  setValue(state.value);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/react",
3
3
  "description": "React components for the Carbon Design System",
4
- "version": "1.64.0-rc.0",
4
+ "version": "1.64.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -49,9 +49,9 @@
49
49
  "dependencies": {
50
50
  "@babel/runtime": "^7.24.7",
51
51
  "@carbon/feature-flags": "^0.21.0",
52
- "@carbon/icons-react": "^11.47.0-rc.0",
52
+ "@carbon/icons-react": "^11.47.0",
53
53
  "@carbon/layout": "^11.24.0",
54
- "@carbon/styles": "^1.63.0-rc.0",
54
+ "@carbon/styles": "^1.63.0",
55
55
  "@floating-ui/react": "^0.26.0",
56
56
  "@ibm/telemetry-js": "^1.5.0",
57
57
  "classnames": "2.5.1",
@@ -81,7 +81,7 @@
81
81
  "@babel/preset-typescript": "^7.24.7",
82
82
  "@carbon/test-utils": "^10.30.0",
83
83
  "@carbon/themes": "^11.38.0",
84
- "@figma/code-connect": "^1.0.2",
84
+ "@figma/code-connect": "^1.0.4",
85
85
  "@rollup/plugin-babel": "^6.0.0",
86
86
  "@rollup/plugin-commonjs": "^26.0.0",
87
87
  "@rollup/plugin-node-resolve": "^15.0.0",
@@ -141,5 +141,5 @@
141
141
  "**/*.scss",
142
142
  "**/*.css"
143
143
  ],
144
- "gitHead": "51d2a214ec7d870b4f807ed08a05031d091bfd46"
144
+ "gitHead": "185c4cf3598df1050c197870455c01775e21c366"
145
145
  }