@carbon/react 1.28.0-rc.0 → 1.29.0-rc.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.
Files changed (73) hide show
  1. package/es/components/Checkbox/Checkbox.d.ts +2 -2
  2. package/es/components/ContainedList/ContainedList.js +48 -3
  3. package/es/components/DataTable/DataTable.js +21 -20
  4. package/es/components/DatePicker/DatePicker.Skeleton.d.ts +30 -0
  5. package/es/components/DatePicker/DatePicker.Skeleton.js +1 -2
  6. package/es/components/DatePicker/DatePicker.d.ts +131 -0
  7. package/es/components/DatePicker/DatePicker.js +16 -12
  8. package/es/components/DatePicker/index.d.ts +10 -0
  9. package/es/components/DatePicker/index.js +1 -0
  10. package/es/components/DatePickerInput/DatePickerInput.d.ts +93 -0
  11. package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -0
  12. package/es/components/ExpandableSearch/ExpandableSearch.js +1 -0
  13. package/es/components/FluidDatePicker/FluidDatePicker.js +1 -0
  14. package/es/components/Heading/index.d.ts +51 -0
  15. package/es/components/Heading/index.js +5 -9
  16. package/es/components/OverflowMenu/OverflowMenu.js +1 -0
  17. package/es/components/StructuredList/StructuredList.Skeleton.js +2 -10
  18. package/es/components/StructuredList/StructuredList.js +2 -2
  19. package/es/components/Theme/index.d.ts +62 -0
  20. package/es/components/Theme/index.js +4 -4
  21. package/es/components/UIShell/HeaderContainer.js +8 -0
  22. package/es/components/UIShell/HeaderMenuButton.d.ts +38 -0
  23. package/es/components/UIShell/HeaderMenuButton.js +7 -12
  24. package/es/components/UIShell/HeaderNavigation.d.ts +24 -0
  25. package/es/components/UIShell/HeaderNavigation.js +8 -13
  26. package/es/components/UIShell/HeaderSideNavItems.d.ts +33 -0
  27. package/es/components/UIShell/HeaderSideNavItems.js +4 -9
  28. package/es/components/UIShell/SideNav.d.ts +21 -0
  29. package/es/components/UIShell/SideNav.js +37 -38
  30. package/es/components/UIShell/SideNavFooter.js +1 -0
  31. package/es/components/UIShell/SideNavHeader.js +1 -0
  32. package/es/components/UIShell/SideNavItems.js +1 -0
  33. package/es/components/UIShell/SideNavMenu.js +1 -0
  34. package/es/index.js +3 -3
  35. package/es/internal/useEvent.js +20 -1
  36. package/es/types/common.d.ts +11 -0
  37. package/lib/components/Checkbox/Checkbox.d.ts +2 -2
  38. package/lib/components/ContainedList/ContainedList.js +48 -3
  39. package/lib/components/DataTable/DataTable.js +21 -20
  40. package/lib/components/DatePicker/DatePicker.Skeleton.d.ts +30 -0
  41. package/lib/components/DatePicker/DatePicker.Skeleton.js +1 -2
  42. package/lib/components/DatePicker/DatePicker.d.ts +131 -0
  43. package/lib/components/DatePicker/DatePicker.js +16 -12
  44. package/lib/components/DatePicker/index.d.ts +10 -0
  45. package/lib/components/DatePicker/index.js +2 -0
  46. package/lib/components/DatePickerInput/DatePickerInput.d.ts +93 -0
  47. package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -0
  48. package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -0
  49. package/lib/components/FluidDatePicker/FluidDatePicker.js +1 -0
  50. package/lib/components/Heading/index.d.ts +51 -0
  51. package/lib/components/Heading/index.js +5 -9
  52. package/lib/components/OverflowMenu/OverflowMenu.js +1 -0
  53. package/lib/components/StructuredList/StructuredList.Skeleton.js +2 -10
  54. package/lib/components/StructuredList/StructuredList.js +2 -2
  55. package/lib/components/Theme/index.d.ts +62 -0
  56. package/lib/components/Theme/index.js +4 -4
  57. package/lib/components/UIShell/HeaderContainer.js +8 -0
  58. package/lib/components/UIShell/HeaderMenuButton.d.ts +38 -0
  59. package/lib/components/UIShell/HeaderMenuButton.js +7 -12
  60. package/lib/components/UIShell/HeaderNavigation.d.ts +24 -0
  61. package/lib/components/UIShell/HeaderNavigation.js +7 -13
  62. package/lib/components/UIShell/HeaderSideNavItems.d.ts +33 -0
  63. package/lib/components/UIShell/HeaderSideNavItems.js +4 -9
  64. package/lib/components/UIShell/SideNav.d.ts +21 -0
  65. package/lib/components/UIShell/SideNav.js +36 -37
  66. package/lib/components/UIShell/SideNavFooter.js +1 -0
  67. package/lib/components/UIShell/SideNavHeader.js +1 -0
  68. package/lib/components/UIShell/SideNavItems.js +1 -0
  69. package/lib/components/UIShell/SideNavMenu.js +1 -0
  70. package/lib/index.js +6 -6
  71. package/lib/internal/useEvent.js +20 -0
  72. package/lib/types/common.d.ts +11 -0
  73. package/package.json +7 -7
@@ -7,6 +7,25 @@
7
7
 
8
8
  import { useRef, useEffect } from 'react';
9
9
 
10
+ function useEvent(elementOrRef, eventName, callback) {
11
+ const savedCallback = useRef(null);
12
+ useEffect(() => {
13
+ savedCallback.current = callback;
14
+ });
15
+ useEffect(() => {
16
+ function handler(event) {
17
+ if (savedCallback.current) {
18
+ savedCallback.current(event);
19
+ }
20
+ }
21
+
22
+ const element = elementOrRef.current ?? elementOrRef;
23
+ element.addEventListener(eventName, handler);
24
+ return () => {
25
+ element.removeEventListener(eventName, handler);
26
+ };
27
+ }, [elementOrRef, eventName]);
28
+ }
10
29
  function useWindowEvent(eventName, callback) {
11
30
  const savedCallback = useRef(null);
12
31
  useEffect(() => {
@@ -26,4 +45,4 @@ function useWindowEvent(eventName, callback) {
26
45
  }, [eventName]);
27
46
  }
28
47
 
29
- export { useWindowEvent };
48
+ export { useEvent, useWindowEvent };
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ export type ReactAttr<T = HTMLElement> = React.HTMLAttributes<T>;
3
+ export type ForwardRefProps<T, P = unknown> = React.PropsWithoutRef<React.PropsWithChildren<P>> & React.RefAttributes<T>;
4
+ export type ForwardRefReturn<T, P = unknown> = React.ForwardRefExoticComponent<ForwardRefProps<T, P>>;
5
+ /**
6
+ * For "as" props. Creates an "as" property that supports native html tags such as 'span', 'a', 'button' as well as custom functional components
7
+ * All native props for the supplied html tag/component are inferred as part of the base component props, allowing us to use props like `href` on an 'a' element ect
8
+ */
9
+ export type PolymorphicProps<Element extends React.ElementType, Props> = Props & Omit<React.ComponentProps<Element>, 'as'> & {
10
+ as?: Element;
11
+ };
@@ -44,7 +44,7 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
44
44
  /**
45
45
  * Provide the text that is displayed when the Checkbox is in an invalid state
46
46
  */
47
- invalidText: React.ReactNode;
47
+ invalidText?: React.ReactNode;
48
48
  /**
49
49
  * Specify whether the Checkbox is currently invalid
50
50
  */
@@ -52,7 +52,7 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
52
52
  /**
53
53
  * Provide the text that is displayed when the Checkbox is in an invalid state
54
54
  */
55
- warnText: React.ReactNode;
55
+ warnText?: React.ReactNode;
56
56
  /**
57
57
  * Provide an optional handler that is called when the internal state of
58
58
  * Checkbox changes. This handler is called with event and state info.
@@ -23,7 +23,49 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
23
23
 
24
24
  const variants = ['on-page', 'disclosed'];
25
25
 
26
+ function filterChildren(children) {
27
+ var _children$type;
28
+
29
+ if (Array.isArray(children)) {
30
+ return children === null || children === void 0 ? void 0 : children.filter(child => {
31
+ var _child$type;
32
+
33
+ return !['Search', 'ExpandableSearch'].includes(child === null || child === void 0 ? void 0 : (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName);
34
+ });
35
+ }
36
+
37
+ if (children && !['Search', 'ExpandableSearch'].includes(children === null || children === void 0 ? void 0 : (_children$type = children.type) === null || _children$type === void 0 ? void 0 : _children$type.displayName)) {
38
+ return children;
39
+ }
40
+
41
+ return null;
42
+ }
43
+
44
+ function renderChildren(children) {
45
+ var _children$type2;
46
+
47
+ if (Array.isArray(children)) {
48
+ children.map((child, index) => {
49
+ var _child$type2;
50
+
51
+ if (index === 0 && ((_child$type2 = child.type) === null || _child$type2 === void 0 ? void 0 : _child$type2.displayName) === 'Search') {
52
+ return child;
53
+ }
54
+
55
+ return child;
56
+ });
57
+ }
58
+
59
+ if (children && ((_children$type2 = children.type) === null || _children$type2 === void 0 ? void 0 : _children$type2.displayName) === 'Search') {
60
+ return children;
61
+ }
62
+
63
+ return children;
64
+ }
65
+
26
66
  function ContainedList(_ref) {
67
+ var _action$type;
68
+
27
69
  let {
28
70
  action,
29
71
  children,
@@ -38,6 +80,9 @@ function ContainedList(_ref) {
38
80
  const classes = cx__default["default"](`${prefix}--contained-list`, {
39
81
  [`${prefix}--contained-list--inset-rulers`]: isInset
40
82
  }, `${prefix}--contained-list--${kind}`, `${prefix}--contained-list--${size}`, className);
83
+ const filteredChildren = filterChildren(children);
84
+ const isActionSearch = ['Search', 'ExpandableSearch'].includes(action === null || action === void 0 ? void 0 : (_action$type = action.type) === null || _action$type === void 0 ? void 0 : _action$type.displayName);
85
+ const renderedChildren = renderChildren(children);
41
86
  return /*#__PURE__*/React__default["default"].createElement("div", {
42
87
  className: classes
43
88
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -45,11 +90,11 @@ function ContainedList(_ref) {
45
90
  }, /*#__PURE__*/React__default["default"].createElement("div", {
46
91
  id: labelId,
47
92
  className: `${prefix}--contained-list__label`
48
- }, label), action && /*#__PURE__*/React__default["default"].createElement("div", {
93
+ }, label), /*#__PURE__*/React__default["default"].createElement("div", {
49
94
  className: `${prefix}--contained-list__action`
50
- }, action)), /*#__PURE__*/React__default["default"].createElement("ul", {
95
+ }, action)), children && /*#__PURE__*/React__default["default"].createElement("ul", {
51
96
  "aria-labelledby": labelId
52
- }, children));
97
+ }, isActionSearch ? filteredChildren : renderedChildren));
53
98
  }
54
99
 
55
100
  ContainedList.propTypes = {
@@ -435,33 +435,34 @@ class DataTable extends React__default["default"].Component {
435
435
 
436
436
  };
437
437
  this.instanceId = getInstanceId();
438
- }
438
+ } // if state needs to be updated then wait for only update after state is finished
439
439
 
440
- componentDidUpdate(prevProps) {
441
- if (prevProps === this.props) {
442
- return;
443
- }
444
440
 
445
- const prevRowIds = prevProps.rows.map(row => row.id);
446
- const rowIds = this.props.rows.map(row => row.id);
441
+ shouldComponentUpdate(nextProps) {
442
+ if (this.props !== nextProps) {
443
+ const nextRowIds = nextProps.rows.map(row => row.id);
444
+ const rowIds = this.props.rows.map(row => row.id);
447
445
 
448
- if (!isEqual__default["default"](prevRowIds, rowIds)) {
449
- this.setState(state => getDerivedStateFromProps["default"](this.props, state));
450
- return;
451
- }
446
+ if (!isEqual__default["default"](nextRowIds, rowIds)) {
447
+ this.setState(state => getDerivedStateFromProps["default"](this.props, state));
448
+ return false;
449
+ }
452
450
 
453
- const prevHeaders = prevProps.headers.map(header => header.key);
454
- const headers = this.props.headers.map(header => header.key);
451
+ const nextHeaders = nextProps.headers.map(header => header.key);
452
+ const headers = this.props.headers.map(header => header.key);
455
453
 
456
- if (!isEqual__default["default"](prevHeaders, headers)) {
457
- this.setState(state => getDerivedStateFromProps["default"](this.props, state));
458
- return;
459
- }
454
+ if (!isEqual__default["default"](nextHeaders, headers)) {
455
+ this.setState(state => getDerivedStateFromProps["default"](this.props, state));
456
+ return false;
457
+ }
460
458
 
461
- if (!isEqual__default["default"](prevProps.rows, this.props.rows)) {
462
- this.setState(state => getDerivedStateFromProps["default"](this.props, state));
463
- return;
459
+ if (!isEqual__default["default"](nextProps.rows, this.props.rows)) {
460
+ this.setState(state => getDerivedStateFromProps["default"](this.props, state));
461
+ return false;
462
+ }
464
463
  }
464
+
465
+ return true;
465
466
  }
466
467
  /**
467
468
  * Get the props associated with the given header. Mostly used for adding in
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import PropTypes from 'prop-types';
8
+ import { type HTMLAttributes } from 'react';
9
+ export interface DatePickerSkeletonProps extends HTMLAttributes<HTMLDivElement> {
10
+ range?: boolean;
11
+ }
12
+ declare const DatePickerSkeleton: {
13
+ ({ range, id, className, ...rest }: DatePickerSkeletonProps): JSX.Element;
14
+ propTypes: {
15
+ /**
16
+ * Specify an optional className to add.
17
+ */
18
+ className: PropTypes.Requireable<string>;
19
+ /**
20
+ * Specify the id to add.
21
+ */
22
+ id: PropTypes.Requireable<string>;
23
+ /**
24
+ * Specify whether the skeleton should be of range date picker.
25
+ */
26
+ range: PropTypes.Requireable<boolean>;
27
+ };
28
+ };
29
+ export default DatePickerSkeleton;
30
+ export { DatePickerSkeleton };
@@ -73,7 +73,6 @@ DatePickerSkeleton.propTypes = {
73
73
  */
74
74
  range: PropTypes__default["default"].bool
75
75
  };
76
- var DatePickerSkeleton$1 = DatePickerSkeleton;
77
76
 
78
77
  exports.DatePickerSkeleton = DatePickerSkeleton;
79
- exports["default"] = DatePickerSkeleton$1;
78
+ exports["default"] = DatePickerSkeleton;
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { ReactNodeLike } from 'prop-types';
8
+ import React, { ChangeEventHandler } from 'react';
9
+ import { ReactAttr } from '../../types/common';
10
+ type ExcludedAttributes = 'value' | 'onChange' | 'locale';
11
+ export type DatePickerTypes = 'simple' | 'single' | 'range';
12
+ export type CalRef = {
13
+ inline: boolean;
14
+ disableMobile: boolean;
15
+ defaultDate: Date;
16
+ closeOnSelect: (evt: React.ChangeEvent<HTMLTextAreaElement>) => void;
17
+ mode: 'simple' | 'single' | 'range';
18
+ allowInput: boolean;
19
+ dateFormat: string;
20
+ locale: string;
21
+ plugins: [];
22
+ clickOpens: any;
23
+ };
24
+ interface DatePickerProps extends Omit<ReactAttr<HTMLDivElement>, ExcludedAttributes> {
25
+ /**
26
+ * flatpickr prop passthrough. Allows the user to enter a date directly
27
+ * into the input field
28
+ */
29
+ allowInput: boolean | undefined;
30
+ /**
31
+ * The DOM element the flatpickr should be inserted into `<body>` by default.
32
+ */
33
+ appendTo: object | undefined;
34
+ /**
35
+ * The child nodes.
36
+ */
37
+ children: React.ReactNode | object;
38
+ /**
39
+ * The CSS class names.
40
+ */
41
+ className: string | undefined;
42
+ /**
43
+ * flatpickr prop passthrough. Controls whether the calendar dropdown closes upon selection.
44
+ */
45
+ closeOnSelect: boolean | undefined;
46
+ /**
47
+ * The date format.
48
+ */
49
+ dateFormat?: string;
50
+ /**
51
+ * The type of the date picker:
52
+ *
53
+ * * `simple` - Without calendar dropdown.
54
+ * * `single` - With calendar dropdown and single date.
55
+ * * `range` - With calendar dropdown and a date range.
56
+ */
57
+ datePickerType?: DatePickerTypes;
58
+ /**
59
+ * The flatpickr `disable` option that allows a user to disable certain dates.
60
+ */
61
+ disable?: string[];
62
+ /**
63
+ * The flatpickr `enable` option that allows a user to enable certain dates.
64
+ */
65
+ enable?: string[];
66
+ /**
67
+ * The flatpickr `inline` option.
68
+ */
69
+ inline: boolean | undefined;
70
+ /**
71
+ * Specify whether or not the control is invalid (Fluid only)
72
+ */
73
+ invalid: boolean | undefined;
74
+ /**
75
+ * Provide the text that is displayed when the control is in error state (Fluid Only)
76
+ */
77
+ invalidText: ReactNodeLike;
78
+ /**
79
+ * `true` to use the light version.
80
+ */
81
+ light: boolean;
82
+ /**
83
+ * The language locale used to format the days of the week, months, and numbers. The full list of supported locales can be found here https://github.com/flatpickr/flatpickr/tree/master/src/l10n
84
+ */
85
+ locale?: string | any | 'ar' | 'at' | 'az' | 'be' | 'bg' | 'bn' | 'bs' | 'cat' | 'cs' | 'cy' | 'da' | 'de' | 'en' | 'eo' | 'es' | 'et' | 'fa' | 'fi' | 'fo' | 'fr' | 'ga' | 'gr' | 'he' | 'hi' | 'hr' | 'hu' | 'id' | 'is' | 'it' | 'ja' | 'ka' | 'km' | 'ko' | 'kz' | 'lt' | 'lv' | 'mk' | 'mn' | 'ms' | 'my' | 'nl' | 'no' | 'pa' | 'pl' | 'pt' | 'ro' | 'ru' | 'si' | 'sk' | 'sl' | 'sq' | 'sr' | 'sv' | 'th' | 'tr' | 'uk' | 'uz' | 'uz_latn' | 'vn' | 'zh_tw' | 'zh' | undefined;
86
+ /**
87
+ * The maximum date that a user can pick to.
88
+ */
89
+ maxDate?: string;
90
+ /**
91
+ * The minimum date that a user can start picking from.
92
+ */
93
+ minDate?: string;
94
+ /**
95
+ * The `change` event handler.
96
+ */
97
+ onChange?: ChangeEventHandler<HTMLSelectElement>;
98
+ /**
99
+ * The `close` event handler.
100
+ */
101
+ onClose?: any;
102
+ /**
103
+ * The `open` event handler.
104
+ */
105
+ onOpen?: ChangeEventHandler<HTMLSelectElement>;
106
+ /**
107
+ * whether the DatePicker is to be readOnly
108
+ * if boolean applies to all inputs
109
+ * if array applies to each input in order
110
+ */
111
+ readOnly?: boolean | [] | any | undefined;
112
+ /**
113
+ * `true` to use the short version.
114
+ */
115
+ short?: boolean;
116
+ /**
117
+ * The value of the date value provided to flatpickr, could
118
+ * be a date, a date number, a date string, an array of dates.
119
+ */
120
+ value?: string | number | (string | number | object)[] | object | undefined;
121
+ /**
122
+ * Specify whether the control is currently in warning state (Fluid only)
123
+ */
124
+ warn?: boolean;
125
+ /**
126
+ * Provide the text that is displayed when the control is in warning state (Fluid only)
127
+ */
128
+ warnText: ReactNodeLike;
129
+ }
130
+ declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLDivElement>>;
131
+ export default DatePicker;
@@ -36,6 +36,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
36
36
  var flatpickr__default = /*#__PURE__*/_interopDefaultLegacy(flatpickr);
37
37
  var l10n__default = /*#__PURE__*/_interopDefaultLegacy(l10n);
38
38
 
39
+ // Weekdays shorthand for english locale
39
40
  l10n__default["default"].en.weekdays.shorthand.forEach((_day, index) => {
40
41
  const currentDay = l10n__default["default"].en.weekdays.shorthand;
41
42
 
@@ -195,26 +196,29 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
195
196
  setHasInput(true);
196
197
  }
197
198
  }, []);
198
- const endInputField = React.useRef(null);
199
199
  const lastStartValue = React.useRef(''); // fix datepicker deleting the selectedDate when the calendar closes
200
200
 
201
201
  const onCalendarClose = (selectedDates, dateStr) => {
202
202
  setTimeout(() => {
203
203
  if (lastStartValue.current && selectedDates[0] && !startInputField.current.value) {
204
+ var _endInputField$curren;
205
+
204
206
  startInputField.current.value = lastStartValue.current;
205
- calendarRef.current.setDate([startInputField.current.value, endInputField.current.value], true, calendarRef.current.config.dateFormat);
207
+ calendarRef.current.setDate([startInputField.current.value, endInputField === null || endInputField === void 0 ? void 0 : (_endInputField$curren = endInputField.current) === null || _endInputField$curren === void 0 ? void 0 : _endInputField$curren.value], true, calendarRef.current.config.dateFormat);
206
208
  }
207
209
 
208
210
  if (onClose) {
209
211
  onClose(calendarRef.current.selectedDates, dateStr, calendarRef.current);
210
212
  }
211
213
  });
212
- };
214
+ }; //const savedOnOpen = useSavedCallback(onOpen);
215
+
213
216
 
217
+ const endInputField = React.useRef(null);
214
218
  const calendarRef = React.useRef(null);
215
- const savedOnChange = useSavedCallback.useSavedCallback(onChange);
219
+ const savedOnChange = useSavedCallback.useSavedCallback(() => onChange);
216
220
  const savedOnClose = useSavedCallback.useSavedCallback(datePickerType === 'range' ? onCalendarClose : onClose);
217
- const savedOnOpen = useSavedCallback.useSavedCallback(onOpen);
221
+ const savedOnOpen = useSavedCallback.useSavedCallback(() => onOpen);
218
222
  const datePickerClasses = cx__default["default"](`${prefix}--date-picker`, {
219
223
  [`${prefix}--date-picker--short`]: short,
220
224
  [`${prefix}--date-picker--light`]: light,
@@ -224,7 +228,7 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
224
228
  [`${prefix}--date-picker--nolabel`]: datePickerType === 'range' && isLabelTextEmpty(children)
225
229
  });
226
230
  const wrapperClasses = cx__default["default"](`${prefix}--form-item`, {
227
- [className]: className
231
+ [String(className)]: className
228
232
  });
229
233
  const childrenWithProps = React__default["default"].Children.toArray(children).map((child, index) => {
230
234
  if (index === 0 && child.type === React__default["default"].createElement(DatePickerInput["default"], child.props).type) {
@@ -280,7 +284,7 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
280
284
  // is provided, we return the default empty disabled array, allowing all dates.
281
285
 
282
286
 
283
- let enableOrDisable = enable ? 'enable' : 'disable';
287
+ const enableOrDisable = enable ? 'enable' : 'disable';
284
288
  let enableOrDisableArr;
285
289
 
286
290
  if (!enable && !disable) {
@@ -294,7 +298,7 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
294
298
  let localeData;
295
299
 
296
300
  if (typeof locale === 'object') {
297
- let location = locale.locale ? locale.locale : 'en';
301
+ const location = locale.locale ? locale.locale : 'en';
298
302
  localeData = { ...l10n__default["default"][location],
299
303
  ...locale
300
304
  };
@@ -308,7 +312,7 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
308
312
  const {
309
313
  current: end
310
314
  } = endInputField;
311
- const calendar = new flatpickr__default["default"](start, {
315
+ const flatpickerconfig = {
312
316
  inline: inline ?? false,
313
317
  disableMobile: true,
314
318
  defaultDate: value,
@@ -352,7 +356,8 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
352
356
  savedOnOpen(...arguments);
353
357
  },
354
358
  onValueUpdate: onHook
355
- });
359
+ };
360
+ const calendar = flatpickr__default["default"](start, flatpickerconfig);
356
361
  calendarRef.current = calendar;
357
362
 
358
363
  function handleArrowDown(event) {
@@ -740,6 +745,5 @@ DatePicker.propTypes = {
740
745
  */
741
746
  warnText: PropTypes__default["default"].node
742
747
  };
743
- var DatePicker$1 = DatePicker;
744
748
 
745
- exports["default"] = DatePicker$1;
749
+ exports["default"] = DatePicker;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import DatePicker from './DatePicker';
8
+ export { default as DatePickerSkeleton, type DatePickerSkeletonProps, } from './DatePicker.Skeleton';
9
+ export default DatePicker;
10
+ export { DatePicker };
@@ -10,8 +10,10 @@
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
12
  var DatePicker = require('./DatePicker.js');
13
+ var DatePicker_Skeleton = require('./DatePicker.Skeleton.js');
13
14
 
14
15
 
15
16
 
16
17
  exports.DatePicker = DatePicker["default"];
17
18
  exports["default"] = DatePicker["default"];
19
+ exports.DatePickerSkeleton = DatePicker_Skeleton["default"];
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { ReactElementLike, ReactNodeArray } from 'prop-types';
8
+ import React from 'react';
9
+ import { ReactAttr } from '../../types/common';
10
+ type ExcludedAttributes = 'value' | 'onChange' | 'locale' | 'children';
11
+ export type ReactNodeLike = ReactElementLike | ReactNodeArray | string | number | boolean | null | undefined;
12
+ export type func = (...args: any[]) => any;
13
+ interface DatePickerInputProps extends Omit<ReactAttr<HTMLDivElement>, ExcludedAttributes> {
14
+ /**
15
+ * The type of the date picker:
16
+ *
17
+ * * `simple` - Without calendar dropdown.
18
+ * * `single` - With calendar dropdown and single date.
19
+ * * `range` - With calendar dropdown and a date range.
20
+ */
21
+ datePickerType?: 'simple' | 'single' | 'range';
22
+ /**
23
+ * Specify whether or not the input should be disabled
24
+ */
25
+ disabled?: boolean;
26
+ /**
27
+ * Provide text that is used alongside the control label for additional help
28
+ */
29
+ helperText?: ReactNodeLike;
30
+ /**
31
+ * Specify if the label should be hidden
32
+ */
33
+ hideLabel?: boolean;
34
+ /**
35
+ * Specify an id that uniquely identifies the `<input>`
36
+ */
37
+ id: string;
38
+ /**
39
+ * Specify whether or not the input should be invalid
40
+ */
41
+ invalid?: boolean;
42
+ /**
43
+ * Specify the text to be rendered when the input is invalid
44
+ */
45
+ invalidText: ReactNodeLike;
46
+ /**
47
+ * Provide the text that will be read by a screen reader when visiting this
48
+ * control
49
+ */
50
+ labelText: ReactNodeLike;
51
+ /**
52
+ * Specify an `onChange` handler that is called whenever a change in the
53
+ * input field has occurred
54
+ */
55
+ onChange?: func;
56
+ /**
57
+ * Provide a function to be called when the input field is clicked
58
+ */
59
+ onClick?: func;
60
+ /**
61
+ * Provide a regular expression that the input value must match
62
+ * TODO:need to be rewritten
63
+ */
64
+ pattern: (props: {
65
+ [key: string]: any;
66
+ }, propName: string, componentName: string) => null | any | Error;
67
+ /**
68
+ * Specify the placeholder text
69
+ */
70
+ placeholder?: string;
71
+ /**
72
+ * whether the DatePicker is to be readOnly
73
+ */
74
+ readOnly?: boolean;
75
+ /**
76
+ * Specify the size of the Date Picker Input. Currently supports either `sm`, `md`, or `lg` as an option.
77
+ */
78
+ size?: 'sm' | 'md' | 'lg';
79
+ /**
80
+ * Specify the type of the `<input>`
81
+ */
82
+ type?: string;
83
+ /**
84
+ * Specify whether the control is currently in warning state
85
+ */
86
+ warn?: boolean;
87
+ /**
88
+ * Provide the text that is displayed when the control is in warning state
89
+ */
90
+ warnText?: ReactNodeLike;
91
+ }
92
+ declare const DatePickerInput: React.ForwardRefExoticComponent<DatePickerInputProps & React.RefAttributes<HTMLDivElement>>;
93
+ export default DatePickerInput;
@@ -9,5 +9,6 @@ import { type SearchProps } from '../Search';
9
9
  declare function ExpandableSearch({ onBlur, onChange, onExpand, onFocus, ...props }: SearchProps): JSX.Element;
10
10
  declare namespace ExpandableSearch {
11
11
  var propTypes: React.WeakValidationMap<SearchProps & React.RefAttributes<HTMLInputElement>> | undefined;
12
+ var displayName: string;
12
13
  }
13
14
  export default ExpandableSearch;
@@ -73,5 +73,6 @@ function ExpandableSearch(_ref) {
73
73
  }
74
74
 
75
75
  ExpandableSearch.propTypes = Search["default"].propTypes;
76
+ ExpandableSearch.displayName = 'ExpandableSearch';
76
77
 
77
78
  exports["default"] = ExpandableSearch;
@@ -14,6 +14,7 @@ var PropTypes = require('prop-types');
14
14
  var React = require('react');
15
15
  var cx = require('classnames');
16
16
  var DatePicker = require('../DatePicker/DatePicker.js');
17
+ require('../DatePicker/DatePicker.Skeleton.js');
17
18
  var usePrefix = require('../../internal/usePrefix.js');
18
19
  var FormContext = require('../FluidForm/FormContext.js');
19
20
 
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import PropTypes from 'prop-types';
8
+ import { type ElementType } from 'react';
9
+ import type { PolymorphicProps } from '../../types/common';
10
+ type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
11
+ type SectionBaseProps = {
12
+ level?: HeadingLevel;
13
+ };
14
+ type SectionProps<E extends ElementType> = PolymorphicProps<E, SectionBaseProps>;
15
+ export declare function Section<E extends ElementType = 'section'>({ as: BaseComponent, level: levelOverride, ...rest }: SectionProps<E>): JSX.Element;
16
+ export declare namespace Section {
17
+ var propTypes: {
18
+ /**
19
+ * Provide an alternative tag or component to use instead of the default
20
+ * <section> element
21
+ */
22
+ as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
23
+ /**
24
+ * Specify the content that will be placed in the component
25
+ */
26
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
27
+ /**
28
+ * Specify a class name for the outermost node of the component
29
+ */
30
+ className: PropTypes.Requireable<string>;
31
+ /**
32
+ * Overrides the level of the section
33
+ */
34
+ level: PropTypes.Requireable<number>;
35
+ };
36
+ }
37
+ type HeadingProps = JSX.IntrinsicElements[`h${HeadingLevel}`];
38
+ export declare function Heading(props: HeadingProps): JSX.Element;
39
+ export declare namespace Heading {
40
+ var propTypes: {
41
+ /**
42
+ * Specify the content that will be placed in the component
43
+ */
44
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
45
+ /**
46
+ * Specify a class name for the outermost node of the component
47
+ */
48
+ className: PropTypes.Requireable<string>;
49
+ };
50
+ }
51
+ export {};