@carbon/react 1.113.0 → 1.114.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.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +962 -962
- package/es/components/Card/Card.d.ts +48 -0
- package/es/components/Card/Card.js +148 -0
- package/es/components/Card/Card.types.d.ts +88 -0
- package/es/components/Card/CardAction.d.ts +37 -0
- package/es/components/Card/CardAction.js +32 -0
- package/es/components/Card/CardActions.d.ts +30 -0
- package/es/components/Card/CardActions.js +93 -0
- package/es/components/Card/CardBody.d.ts +11 -0
- package/es/components/Card/CardBody.js +34 -0
- package/es/components/Card/CardContext.d.ts +17 -0
- package/es/components/Card/CardContext.js +31 -0
- package/es/components/Card/CardFooter.d.ts +11 -0
- package/es/components/Card/CardFooter.js +34 -0
- package/es/components/Card/CardHeader.d.ts +11 -0
- package/es/components/Card/CardHeader.js +44 -0
- package/es/components/Card/CardHeaderMedia.d.ts +21 -0
- package/es/components/Card/CardHeaderMedia.js +24 -0
- package/es/components/Card/CardMedia.d.ts +35 -0
- package/es/components/Card/CardMedia.js +42 -0
- package/es/components/Card/CardTitle.d.ts +72 -0
- package/es/components/Card/CardTitle.js +86 -0
- package/es/components/Card/CardTitleMedia.d.ts +23 -0
- package/es/components/Card/CardTitleMedia.js +36 -0
- package/es/components/Card/_story-assets/data.d.ts +6 -0
- package/es/components/Card/_story-assets/options.d.ts +47 -0
- package/es/components/Card/index.d.ts +8 -0
- package/es/components/Card/index.js +33 -0
- package/es/components/Checkbox/Checkbox.js +1 -1
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/ComboBox/ComboBox.js +2 -2
- package/es/components/ComboButton/index.js +1 -1
- package/es/components/ComposedModal/ComposedModal.js +1 -1
- package/es/components/DatePicker/DatePicker.d.ts +10 -0
- package/es/components/DatePicker/DatePicker.js +7 -6
- package/es/components/DatePicker/next/components/Calendar.d.ts +40 -0
- package/es/components/DatePicker/next/components/Calendar.js +181 -0
- package/es/components/DatePicker/next/components/DatePicker.d.ts +86 -0
- package/es/components/DatePicker/next/components/DatePicker.js +147 -0
- package/es/components/DatePicker/next/components/DatePickerInput.d.ts +143 -0
- package/es/components/DatePicker/next/components/DatePickerInput.js +124 -0
- package/es/components/DatePicker/next/components/DatePickerSkeleton.d.ts +22 -0
- package/es/components/DatePicker/next/components/DatePickerSkeleton.js +32 -0
- package/es/components/DatePicker/next/hooks/useDatePicker.d.ts +144 -0
- package/es/components/DatePicker/next/hooks/useDatePicker.js +286 -0
- package/es/components/DatePicker/next/index.d.ts +12 -0
- package/es/components/DatePicker/next/index.js +19 -0
- package/es/components/DatePickerInput/DatePickerInput.js +1 -1
- package/es/components/Dropdown/Dropdown.js +2 -2
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -1
- package/es/components/MenuButton/index.js +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +2 -2
- package/es/components/MultiSelect/MultiSelect.js +2 -2
- package/es/components/NumberInput/NumberInput.js +2 -2
- package/es/components/OverflowMenu/next/index.js +1 -1
- package/es/components/RadioButton/RadioButton.js +1 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es/components/Select/Select.js +1 -1
- package/es/components/Tag/SelectableTag.js +1 -1
- package/es/components/TextArea/TextArea.js +1 -1
- package/es/components/TextInput/TextInput.js +1 -1
- package/es/index.d.ts +2 -0
- package/es/index.js +7 -5
- package/es/internal/checkForOverflow.d.ts +5 -0
- package/es/internal/useFocus.d.ts +23 -0
- package/es/internal/usePrefersReducedMotion.d.ts +11 -0
- package/es/internal/useSidePanelPresence.d.ts +21 -0
- package/lib/components/Card/Card.d.ts +48 -0
- package/lib/components/Card/Card.js +161 -0
- package/lib/components/Card/Card.types.d.ts +88 -0
- package/lib/components/Card/CardAction.d.ts +37 -0
- package/lib/components/Card/CardAction.js +41 -0
- package/lib/components/Card/CardActions.d.ts +30 -0
- package/lib/components/Card/CardActions.js +96 -0
- package/lib/components/Card/CardBody.d.ts +11 -0
- package/lib/components/Card/CardBody.js +37 -0
- package/lib/components/Card/CardContext.d.ts +17 -0
- package/lib/components/Card/CardContext.js +32 -0
- package/lib/components/Card/CardFooter.d.ts +11 -0
- package/lib/components/Card/CardFooter.js +37 -0
- package/lib/components/Card/CardHeader.d.ts +11 -0
- package/lib/components/Card/CardHeader.js +47 -0
- package/lib/components/Card/CardHeaderMedia.d.ts +21 -0
- package/lib/components/Card/CardHeaderMedia.js +33 -0
- package/lib/components/Card/CardMedia.d.ts +35 -0
- package/lib/components/Card/CardMedia.js +51 -0
- package/lib/components/Card/CardTitle.d.ts +72 -0
- package/lib/components/Card/CardTitle.js +89 -0
- package/lib/components/Card/CardTitleMedia.d.ts +23 -0
- package/lib/components/Card/CardTitleMedia.js +39 -0
- package/lib/components/Card/_story-assets/data.d.ts +6 -0
- package/lib/components/Card/_story-assets/options.d.ts +47 -0
- package/lib/components/Card/index.d.ts +8 -0
- package/lib/components/Card/index.js +48 -0
- package/lib/components/Checkbox/Checkbox.js +1 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/ComboBox/ComboBox.js +2 -2
- package/lib/components/ComboButton/index.js +1 -1
- package/lib/components/ComposedModal/ComposedModal.js +1 -1
- package/lib/components/DatePicker/DatePicker.d.ts +10 -0
- package/lib/components/DatePicker/DatePicker.js +7 -6
- package/lib/components/DatePicker/next/components/Calendar.d.ts +40 -0
- package/lib/components/DatePicker/next/components/Calendar.js +184 -0
- package/lib/components/DatePicker/next/components/DatePicker.d.ts +86 -0
- package/lib/components/DatePicker/next/components/DatePicker.js +150 -0
- package/lib/components/DatePicker/next/components/DatePickerInput.d.ts +143 -0
- package/lib/components/DatePicker/next/components/DatePickerInput.js +127 -0
- package/lib/components/DatePicker/next/components/DatePickerSkeleton.d.ts +22 -0
- package/lib/components/DatePicker/next/components/DatePickerSkeleton.js +41 -0
- package/lib/components/DatePicker/next/hooks/useDatePicker.d.ts +144 -0
- package/lib/components/DatePicker/next/hooks/useDatePicker.js +286 -0
- package/lib/components/DatePicker/next/index.d.ts +12 -0
- package/lib/components/DatePicker/next/index.js +27 -0
- package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
- package/lib/components/Dropdown/Dropdown.js +2 -2
- package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -1
- package/lib/components/MenuButton/index.js +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -2
- package/lib/components/MultiSelect/MultiSelect.js +2 -2
- package/lib/components/NumberInput/NumberInput.js +2 -2
- package/lib/components/OverflowMenu/next/index.js +1 -1
- package/lib/components/RadioButton/RadioButton.js +1 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/lib/components/Select/Select.js +1 -1
- package/lib/components/Tag/SelectableTag.js +1 -1
- package/lib/components/TextArea/TextArea.js +1 -1
- package/lib/components/TextInput/TextInput.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +59 -45
- package/lib/internal/checkForOverflow.d.ts +5 -0
- package/lib/internal/useFocus.d.ts +23 -0
- package/lib/internal/usePrefersReducedMotion.d.ts +11 -0
- package/lib/internal/useSidePanelPresence.d.ts +21 -0
- package/package.json +11 -11
- package/scss/components/action-set/_action-set.scss +9 -0
- package/scss/components/action-set/_index.scss +9 -0
- package/scss/components/resizer/_index.scss +9 -0
- package/scss/components/resizer/_resizer.scss +9 -0
- package/scss/components/side-panel/_index.scss +9 -0
- package/scss/components/side-panel/_side-panel.scss +9 -0
- package/scss/components/truncated-text/_index.scss +9 -0
- package/scss/components/truncated-text/_truncated-text.scss +9 -0
- package/telemetry.yml +57 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
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
|
+
|
|
8
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
|
|
9
|
+
const require_usePrefix = require("../../internal/usePrefix.js");
|
|
10
|
+
let react = require("react");
|
|
11
|
+
react = require_runtime.__toESM(react);
|
|
12
|
+
let classnames = require("classnames");
|
|
13
|
+
classnames = require_runtime.__toESM(classnames);
|
|
14
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
15
|
+
//#region src/components/Card/CardTitleMedia.tsx
|
|
16
|
+
/**
|
|
17
|
+
* Copyright IBM Corp. 2026
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
20
|
+
* LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/
|
|
22
|
+
const componentName = "CardTitleMedia";
|
|
23
|
+
/**
|
|
24
|
+
* CardTitleMedia provides a media slot positioned to the left of the card title.
|
|
25
|
+
* The media slot adapts to the heading area height (min 48px, max 64px) and stays
|
|
26
|
+
* top-aligned when the title wraps to multiple lines.
|
|
27
|
+
*/
|
|
28
|
+
const CardTitleMedia = (0, react.forwardRef)(({ className, children, ...rest }, ref) => {
|
|
29
|
+
const titleMediaClasses = (0, classnames.default)(`${require_usePrefix.usePrefix()}--card__title-media`, className);
|
|
30
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
31
|
+
...rest,
|
|
32
|
+
ref,
|
|
33
|
+
className: titleMediaClasses,
|
|
34
|
+
children
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
CardTitleMedia.displayName = componentName;
|
|
38
|
+
//#endregion
|
|
39
|
+
exports.CardTitleMedia = CardTitleMedia;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let height: string;
|
|
3
|
+
namespace grid {
|
|
4
|
+
namespace x {
|
|
5
|
+
let enabled: boolean;
|
|
6
|
+
}
|
|
7
|
+
namespace y {
|
|
8
|
+
let enabled_1: boolean;
|
|
9
|
+
export { enabled_1 as enabled };
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
namespace axes {
|
|
13
|
+
namespace bottom {
|
|
14
|
+
let visible: boolean;
|
|
15
|
+
let title: string;
|
|
16
|
+
let mapsTo: string;
|
|
17
|
+
let scaleType: string;
|
|
18
|
+
}
|
|
19
|
+
namespace left {
|
|
20
|
+
let visible_1: boolean;
|
|
21
|
+
export { visible_1 as visible };
|
|
22
|
+
let mapsTo_1: string;
|
|
23
|
+
export { mapsTo_1 as mapsTo };
|
|
24
|
+
let scaleType_1: string;
|
|
25
|
+
export { scaleType_1 as scaleType };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
namespace color {
|
|
29
|
+
namespace gradient {
|
|
30
|
+
let enabled_2: boolean;
|
|
31
|
+
export { enabled_2 as enabled };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
namespace points {
|
|
35
|
+
let enabled_3: boolean;
|
|
36
|
+
export { enabled_3 as enabled };
|
|
37
|
+
}
|
|
38
|
+
namespace legend {
|
|
39
|
+
let enabled_4: boolean;
|
|
40
|
+
export { enabled_4 as enabled };
|
|
41
|
+
}
|
|
42
|
+
namespace toolbar {
|
|
43
|
+
let enabled_5: boolean;
|
|
44
|
+
export { enabled_5 as enabled };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
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
|
+
export { Card, CardHeader, CardBody, CardFooter, CardHeaderMedia, CardMedia, CardTitle, CardTitleMedia, CardActions, CardAction, } from './Card';
|
|
8
|
+
export type { CardProps, CardHeaderProps, CardBodyProps, CardFooterProps, CardHeaderMediaProps, CardMediaProps, CardTitleProps, CardTitleMediaProps, CardActionsProps, CardActionProps, } from './Card';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
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
|
+
|
|
8
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
|
|
9
|
+
const require_CardHeader = require("./CardHeader.js");
|
|
10
|
+
const require_CardBody = require("./CardBody.js");
|
|
11
|
+
const require_CardFooter = require("./CardFooter.js");
|
|
12
|
+
const require_CardHeaderMedia = require("./CardHeaderMedia.js");
|
|
13
|
+
const require_CardMedia = require("./CardMedia.js");
|
|
14
|
+
const require_CardTitle = require("./CardTitle.js");
|
|
15
|
+
const require_CardTitleMedia = require("./CardTitleMedia.js");
|
|
16
|
+
const require_CardActions = require("./CardActions.js");
|
|
17
|
+
const require_CardAction = require("./CardAction.js");
|
|
18
|
+
const require_Card = require("./Card.js");
|
|
19
|
+
//#region src/components/Card/index.ts
|
|
20
|
+
var Card_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
21
|
+
Card: () => require_Card.Card,
|
|
22
|
+
CardAction: () => require_CardAction.CardAction,
|
|
23
|
+
CardActions: () => require_CardActions.CardActions,
|
|
24
|
+
CardBody: () => require_CardBody.CardBody,
|
|
25
|
+
CardFooter: () => require_CardFooter.CardFooter,
|
|
26
|
+
CardHeader: () => require_CardHeader.CardHeader,
|
|
27
|
+
CardHeaderMedia: () => require_CardHeaderMedia.CardHeaderMedia,
|
|
28
|
+
CardMedia: () => require_CardMedia.CardMedia,
|
|
29
|
+
CardTitle: () => require_CardTitle.CardTitle,
|
|
30
|
+
CardTitleMedia: () => require_CardTitleMedia.CardTitleMedia
|
|
31
|
+
});
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.Card = require_Card.Card;
|
|
34
|
+
exports.CardAction = require_CardAction.CardAction;
|
|
35
|
+
exports.CardActions = require_CardActions.CardActions;
|
|
36
|
+
exports.CardBody = require_CardBody.CardBody;
|
|
37
|
+
exports.CardFooter = require_CardFooter.CardFooter;
|
|
38
|
+
exports.CardHeader = require_CardHeader.CardHeader;
|
|
39
|
+
exports.CardHeaderMedia = require_CardHeaderMedia.CardHeaderMedia;
|
|
40
|
+
exports.CardMedia = require_CardMedia.CardMedia;
|
|
41
|
+
exports.CardTitle = require_CardTitle.CardTitle;
|
|
42
|
+
exports.CardTitleMedia = require_CardTitleMedia.CardTitleMedia;
|
|
43
|
+
Object.defineProperty(exports, "Card_exports", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function() {
|
|
46
|
+
return Card_exports;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
@@ -12,9 +12,9 @@ const require_Text = require("../Text/Text.js");
|
|
|
12
12
|
const require_useId = require("../../internal/useId.js");
|
|
13
13
|
const require_deprecate = require("../../prop-types/deprecate.js");
|
|
14
14
|
const require_utils = require("../../internal/utils.js");
|
|
15
|
+
const require_index = require("../AILabel/index.js");
|
|
15
16
|
const require_hasHelperText = require("../../internal/hasHelperText.js");
|
|
16
17
|
const require_useNormalizedInputProps = require("../../internal/useNormalizedInputProps.js");
|
|
17
|
-
const require_index = require("../AILabel/index.js");
|
|
18
18
|
let react = require("react");
|
|
19
19
|
react = require_runtime.__toESM(react);
|
|
20
20
|
let classnames = require("classnames");
|
|
@@ -10,9 +10,9 @@ const require_usePrefix = require("../../internal/usePrefix.js");
|
|
|
10
10
|
const require_useId = require("../../internal/useId.js");
|
|
11
11
|
const require_deprecate = require("../../prop-types/deprecate.js");
|
|
12
12
|
const require_utils = require("../../internal/utils.js");
|
|
13
|
+
const require_index = require("../AILabel/index.js");
|
|
13
14
|
const require_hasHelperText = require("../../internal/hasHelperText.js");
|
|
14
15
|
const require_useNormalizedInputProps = require("../../internal/useNormalizedInputProps.js");
|
|
15
|
-
const require_index = require("../AILabel/index.js");
|
|
16
16
|
const require_Checkbox = require("../Checkbox/Checkbox.js");
|
|
17
17
|
let react = require("react");
|
|
18
18
|
react = require_runtime.__toESM(react);
|
|
@@ -16,14 +16,14 @@ const require_defaultItemToString = require("../../internal/defaultItemToString.
|
|
|
16
16
|
const require_isItemDisabled = require("../../internal/isItemDisabled.js");
|
|
17
17
|
const require_utils = require("../../internal/utils.js");
|
|
18
18
|
const require_index = require("../FeatureFlags/index.js");
|
|
19
|
-
const require_useNormalizedInputProps = require("../../internal/useNormalizedInputProps.js");
|
|
20
19
|
const require_index$1 = require("../AILabel/index.js");
|
|
20
|
+
const require_mergeRefs = require("../../tools/mergeRefs.js");
|
|
21
|
+
const require_useNormalizedInputProps = require("../../internal/useNormalizedInputProps.js");
|
|
21
22
|
const require_ListBoxPropTypes = require("../ListBox/ListBoxPropTypes.js");
|
|
22
23
|
const require_FormContext = require("../FluidForm/FormContext.js");
|
|
23
24
|
const require_index$2 = require("../ListBox/index.js");
|
|
24
25
|
const require_ListBoxSelection = require("../ListBox/next/ListBoxSelection.js");
|
|
25
26
|
const require_ListBoxTrigger = require("../ListBox/next/ListBoxTrigger.js");
|
|
26
|
-
const require_mergeRefs = require("../../tools/mergeRefs.js");
|
|
27
27
|
let react = require("react");
|
|
28
28
|
react = require_runtime.__toESM(react);
|
|
29
29
|
let classnames = require("classnames");
|
|
@@ -14,8 +14,8 @@ const require_mapPopoverAlign = require("../../tools/mapPopoverAlign.js");
|
|
|
14
14
|
const require_index = require("../FeatureFlags/index.js");
|
|
15
15
|
const require_index$1 = require("../IconButton/index.js");
|
|
16
16
|
const require_index$2 = require("../Button/index.js");
|
|
17
|
-
const require_mergeRefs = require("../../tools/mergeRefs.js");
|
|
18
17
|
const require_Menu = require("../Menu/Menu.js");
|
|
18
|
+
const require_mergeRefs = require("../../tools/mergeRefs.js");
|
|
19
19
|
const require_useAttachedMenu = require("../../internal/useAttachedMenu.js");
|
|
20
20
|
let react = require("react");
|
|
21
21
|
react = require_runtime.__toESM(react);
|
|
@@ -15,9 +15,9 @@ const require_deprecate = require("../../prop-types/deprecate.js");
|
|
|
15
15
|
const require_utils = require("../../internal/utils.js");
|
|
16
16
|
const require_index = require("../FeatureFlags/index.js");
|
|
17
17
|
const require_index$1 = require("../AILabel/index.js");
|
|
18
|
+
const require_mergeRefs = require("../../tools/mergeRefs.js");
|
|
18
19
|
const require_useResizeObserver = require("../../internal/useResizeObserver.js");
|
|
19
20
|
const require_events = require("../../tools/events.js");
|
|
20
|
-
const require_mergeRefs = require("../../tools/mergeRefs.js");
|
|
21
21
|
const require_index$2 = require("../Layer/index.js");
|
|
22
22
|
const require_ComposedModalContext = require("./ComposedModalContext.js");
|
|
23
23
|
const require_ModalHeader = require("./ModalHeader.js");
|
|
@@ -19,6 +19,8 @@ export interface DatePickerProps {
|
|
|
19
19
|
allowInput?: boolean;
|
|
20
20
|
/**
|
|
21
21
|
* The DOM element the flatpickr should be inserted into `<body>` by default.
|
|
22
|
+
*
|
|
23
|
+
* @deprecated This prop will be removed in the next major release, please see `preview__DatePicker` which does not flatpickr.
|
|
22
24
|
*/
|
|
23
25
|
appendTo?: HTMLElement;
|
|
24
26
|
/**
|
|
@@ -47,14 +49,20 @@ export interface DatePickerProps {
|
|
|
47
49
|
datePickerType?: DatePickerTypes;
|
|
48
50
|
/**
|
|
49
51
|
* The flatpickr `disable` option that allows a user to disable certain dates.
|
|
52
|
+
*
|
|
53
|
+
* @deprecated This prop will be removed in the next major release, please see `preview__DatePicker` which does not flatpickr
|
|
50
54
|
*/
|
|
51
55
|
disable?: DateLimit<DateOption>[];
|
|
52
56
|
/**
|
|
53
57
|
* The flatpickr `enable` option that allows a user to enable certain dates.
|
|
58
|
+
*
|
|
59
|
+
* @deprecated This prop will be removed in the next major release, please see `preview__DatePicker` which does not flatpickr
|
|
54
60
|
*/
|
|
55
61
|
enable?: DateLimit<DateOption>[];
|
|
56
62
|
/**
|
|
57
63
|
* The flatpickr `inline` option.
|
|
64
|
+
*
|
|
65
|
+
* @deprecated This prop will be removed in the next major release, please see `preview__DatePicker` which does not flatpickr
|
|
58
66
|
*/
|
|
59
67
|
inline?: boolean;
|
|
60
68
|
/**
|
|
@@ -91,6 +99,8 @@ export interface DatePickerProps {
|
|
|
91
99
|
onOpen?: flatpickr.Options.Hook;
|
|
92
100
|
/**
|
|
93
101
|
* flatpickr prop passthrough. Controls how dates are parsed.
|
|
102
|
+
*
|
|
103
|
+
* @deprecated This prop will be removed in the next major release, please see `preview__DatePicker` which does not flatpickr
|
|
94
104
|
*/
|
|
95
105
|
parseDate?: (date: string) => Date | false;
|
|
96
106
|
/**
|
|
@@ -25,11 +25,11 @@ classnames = require_runtime.__toESM(classnames);
|
|
|
25
25
|
let prop_types = require("prop-types");
|
|
26
26
|
prop_types = require_runtime.__toESM(prop_types);
|
|
27
27
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
let _carbon_utilities = require("@carbon/utilities");
|
|
28
29
|
let flatpickr = require("flatpickr");
|
|
29
30
|
flatpickr = require_runtime.__toESM(flatpickr);
|
|
30
31
|
let flatpickr_dist_l10n_index = require("flatpickr/dist/l10n/index");
|
|
31
32
|
flatpickr_dist_l10n_index = require_runtime.__toESM(flatpickr_dist_l10n_index);
|
|
32
|
-
let _carbon_utilities = require("@carbon/utilities");
|
|
33
33
|
//#region src/components/DatePicker/DatePicker.tsx
|
|
34
34
|
/**
|
|
35
35
|
* Copyright IBM Corp. 2016, 2026
|
|
@@ -46,6 +46,7 @@ function initializeWeekdayShorthand() {
|
|
|
46
46
|
}
|
|
47
47
|
const forEach = Array.prototype.forEach;
|
|
48
48
|
const defaultAriaDateFormat = "l, F j, Y";
|
|
49
|
+
const flatpickrDeprecation = (prop) => `The \`${prop}\` prop is deprecated and will be removed in the next major release. Please use the new \`preview__DatePicker\` component which doesn't use it — if that blocks you, tell us why: https://github.com/carbon-design-system/carbon/issues.`;
|
|
49
50
|
/**
|
|
50
51
|
* @param {number} monthNumber The month number.
|
|
51
52
|
* @param {boolean} shorthand `true` to use shorthand month.
|
|
@@ -461,7 +462,7 @@ DatePicker.propTypes = {
|
|
|
461
462
|
/**
|
|
462
463
|
* The DOM element the Flatpicker should be inserted into. `<body>` by default.
|
|
463
464
|
*/
|
|
464
|
-
appendTo: prop_types.default.object,
|
|
465
|
+
appendTo: require_deprecate.deprecate(prop_types.default.object, flatpickrDeprecation("appendTo")),
|
|
465
466
|
/**
|
|
466
467
|
* The child nodes.
|
|
467
468
|
*/
|
|
@@ -493,15 +494,15 @@ DatePicker.propTypes = {
|
|
|
493
494
|
/**
|
|
494
495
|
* The flatpickr `disable` option that allows a user to disable certain dates.
|
|
495
496
|
*/
|
|
496
|
-
disable: prop_types.default.array,
|
|
497
|
+
disable: require_deprecate.deprecate(prop_types.default.array, flatpickrDeprecation("disable")),
|
|
497
498
|
/**
|
|
498
499
|
* The flatpickr `enable` option that allows a user to enable certain dates.
|
|
499
500
|
*/
|
|
500
|
-
enable: prop_types.default.array,
|
|
501
|
+
enable: require_deprecate.deprecate(prop_types.default.array, flatpickrDeprecation("enable")),
|
|
501
502
|
/**
|
|
502
503
|
* The flatpickr `inline` option.
|
|
503
504
|
*/
|
|
504
|
-
inline: prop_types.default.bool,
|
|
505
|
+
inline: require_deprecate.deprecate(prop_types.default.bool, flatpickrDeprecation("inline")),
|
|
505
506
|
/**
|
|
506
507
|
* Specify whether or not the control is invalid (Fluid only)
|
|
507
508
|
*/
|
|
@@ -540,7 +541,7 @@ DatePicker.propTypes = {
|
|
|
540
541
|
/**
|
|
541
542
|
* flatpickr prop passthrough. Controls how dates are parsed.
|
|
542
543
|
*/
|
|
543
|
-
parseDate: prop_types.default.func,
|
|
544
|
+
parseDate: require_deprecate.deprecate(prop_types.default.func, flatpickrDeprecation("parseDate")),
|
|
544
545
|
/**
|
|
545
546
|
* whether the DatePicker is to be readOnly
|
|
546
547
|
* if boolean applies to all inputs
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
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 type { DatePickerContext } from '@carbon/utilities/date-picker';
|
|
8
|
+
/**
|
|
9
|
+
* Calendar component props
|
|
10
|
+
*/
|
|
11
|
+
export interface CalendarProps {
|
|
12
|
+
/**
|
|
13
|
+
* State machine context
|
|
14
|
+
*/
|
|
15
|
+
context: DatePickerContext;
|
|
16
|
+
/**
|
|
17
|
+
* Date selection handler
|
|
18
|
+
*/
|
|
19
|
+
onDateSelect: (date: Temporal.PlainDate) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Navigation handler
|
|
22
|
+
*/
|
|
23
|
+
onNavigate: (eventType: string) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Additional CSS class names
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* BCP 47 locale tag used to localize month and weekday labels
|
|
30
|
+
*/
|
|
31
|
+
locale?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Calendar component
|
|
35
|
+
* Renders a calendar grid for date selection
|
|
36
|
+
*/
|
|
37
|
+
export declare function Calendar({ context, onDateSelect, onNavigate, className, locale, }: CalendarProps): import("react/jsx-runtime").JSX.Element | null;
|
|
38
|
+
export declare namespace Calendar {
|
|
39
|
+
var displayName: string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
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
|
+
|
|
8
|
+
const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
|
|
9
|
+
const require_usePrefix = require("../../../../internal/usePrefix.js");
|
|
10
|
+
let react = require("react");
|
|
11
|
+
react = require_runtime.__toESM(react);
|
|
12
|
+
let classnames = require("classnames");
|
|
13
|
+
classnames = require_runtime.__toESM(classnames);
|
|
14
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
15
|
+
let _carbon_utilities_date_picker = require("@carbon/utilities/date-picker");
|
|
16
|
+
//#region src/components/DatePicker/next/components/Calendar.tsx
|
|
17
|
+
/**
|
|
18
|
+
* Copyright IBM Corp. 2026
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
21
|
+
* LICENSE file in the root directory of this source tree.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Calendar component
|
|
25
|
+
* Renders a calendar grid for date selection
|
|
26
|
+
*/
|
|
27
|
+
function Calendar({ context, onDateSelect, onNavigate, className, locale = "en" }) {
|
|
28
|
+
const prefix = require_usePrefix.usePrefix();
|
|
29
|
+
const { viewDate, startDate, endDate, minDate, maxDate, focusedDate, mode } = context;
|
|
30
|
+
const [hoveredDate, setHoveredDate] = (0, react.useState)(null);
|
|
31
|
+
const calendarGrid = (0, react.useMemo)(() => {
|
|
32
|
+
if (!viewDate) return [];
|
|
33
|
+
return (0, _carbon_utilities_date_picker.generateCalendarGrid)(viewDate, minDate, maxDate);
|
|
34
|
+
}, [
|
|
35
|
+
viewDate,
|
|
36
|
+
minDate,
|
|
37
|
+
maxDate
|
|
38
|
+
]);
|
|
39
|
+
const handlePrevMonth = (0, react.useCallback)(() => {
|
|
40
|
+
onNavigate("PREV_MONTH");
|
|
41
|
+
}, [onNavigate]);
|
|
42
|
+
const handleNextMonth = (0, react.useCallback)(() => {
|
|
43
|
+
onNavigate("NEXT_MONTH");
|
|
44
|
+
}, [onNavigate]);
|
|
45
|
+
const handleDateClick = (0, react.useCallback)((date, isDisabled) => {
|
|
46
|
+
if (!isDisabled) onDateSelect(date);
|
|
47
|
+
}, [onDateSelect]);
|
|
48
|
+
const isDateSelected = (0, react.useCallback)((date) => {
|
|
49
|
+
if (!startDate) return false;
|
|
50
|
+
if (Temporal.PlainDate.compare(date, startDate) === 0) return true;
|
|
51
|
+
if (endDate && Temporal.PlainDate.compare(date, endDate) === 0) return true;
|
|
52
|
+
return false;
|
|
53
|
+
}, [startDate, endDate]);
|
|
54
|
+
const isDateInRange = (0, react.useCallback)((date) => {
|
|
55
|
+
if (mode !== "range" || !startDate) return false;
|
|
56
|
+
if (endDate) return Temporal.PlainDate.compare(date, startDate) > 0 && Temporal.PlainDate.compare(date, endDate) < 0;
|
|
57
|
+
const previewDate = hoveredDate || focusedDate;
|
|
58
|
+
if (previewDate) {
|
|
59
|
+
if (minDate && Temporal.PlainDate.compare(previewDate, minDate) < 0 || maxDate && Temporal.PlainDate.compare(previewDate, maxDate) > 0) return false;
|
|
60
|
+
const earlierDate = Temporal.PlainDate.compare(startDate, previewDate) < 0 ? startDate : previewDate;
|
|
61
|
+
const laterDate = Temporal.PlainDate.compare(startDate, previewDate) < 0 ? previewDate : startDate;
|
|
62
|
+
return Temporal.PlainDate.compare(date, earlierDate) > 0 && Temporal.PlainDate.compare(date, laterDate) < 0;
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
}, [
|
|
66
|
+
mode,
|
|
67
|
+
startDate,
|
|
68
|
+
endDate,
|
|
69
|
+
hoveredDate,
|
|
70
|
+
focusedDate,
|
|
71
|
+
minDate,
|
|
72
|
+
maxDate
|
|
73
|
+
]);
|
|
74
|
+
const isDateFocused = (0, react.useCallback)((date) => {
|
|
75
|
+
if (!focusedDate) return false;
|
|
76
|
+
return Temporal.PlainDate.compare(date, focusedDate) === 0;
|
|
77
|
+
}, [focusedDate]);
|
|
78
|
+
if (!viewDate) return null;
|
|
79
|
+
const calendarClasses = (0, classnames.default)(`${prefix}--date-picker__calendar`, className);
|
|
80
|
+
const monthYear = (0, _carbon_utilities_date_picker.getMonthYearLabel)(viewDate, locale);
|
|
81
|
+
const weekdayLabels = (0, _carbon_utilities_date_picker.getWeekdayLabels)(locale);
|
|
82
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
83
|
+
className: calendarClasses,
|
|
84
|
+
role: "grid",
|
|
85
|
+
"aria-label": "Calendar",
|
|
86
|
+
tabIndex: 0,
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
89
|
+
className: `${prefix}--date-picker__month`,
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
92
|
+
type: "button",
|
|
93
|
+
className: `${prefix}--date-picker__month-nav`,
|
|
94
|
+
onClick: handlePrevMonth,
|
|
95
|
+
"aria-label": "Previous month",
|
|
96
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
97
|
+
focusable: "false",
|
|
98
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
99
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
100
|
+
fill: "currentColor",
|
|
101
|
+
width: "16",
|
|
102
|
+
height: "16",
|
|
103
|
+
viewBox: "0 0 16 16",
|
|
104
|
+
"aria-hidden": "true",
|
|
105
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
106
|
+
d: "M11 8l-5 5-.7-.7L9.6 8 5.3 3.7 6 3z",
|
|
107
|
+
transform: "rotate(180 8 8)"
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
112
|
+
className: `${prefix}--date-picker__current-month`,
|
|
113
|
+
children: monthYear
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
116
|
+
type: "button",
|
|
117
|
+
className: `${prefix}--date-picker__month-nav`,
|
|
118
|
+
onClick: handleNextMonth,
|
|
119
|
+
"aria-label": "Next month",
|
|
120
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
121
|
+
focusable: "false",
|
|
122
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
123
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
124
|
+
fill: "currentColor",
|
|
125
|
+
width: "16",
|
|
126
|
+
height: "16",
|
|
127
|
+
viewBox: "0 0 16 16",
|
|
128
|
+
"aria-hidden": "true",
|
|
129
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M11 8l-5 5-.7-.7L9.6 8 5.3 3.7 6 3z" })
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
}),
|
|
134
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
135
|
+
className: `${prefix}--date-picker__weekdays`,
|
|
136
|
+
children: weekdayLabels.map((day, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
137
|
+
className: `${prefix}--date-picker__weekday`,
|
|
138
|
+
title: day,
|
|
139
|
+
children: day
|
|
140
|
+
}, index))
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
143
|
+
className: `${prefix}--date-picker__days`,
|
|
144
|
+
children: calendarGrid.flat().map((dayCell, index) => {
|
|
145
|
+
const { date, isCurrentMonth, isDisabled, isToday } = dayCell;
|
|
146
|
+
const selected = isDateSelected(date);
|
|
147
|
+
const inRange = isDateInRange(date);
|
|
148
|
+
const focused = isDateFocused(date);
|
|
149
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
150
|
+
type: "button",
|
|
151
|
+
className: (0, classnames.default)(`${prefix}--date-picker__day`, {
|
|
152
|
+
today: isToday,
|
|
153
|
+
selected,
|
|
154
|
+
inRange,
|
|
155
|
+
prevMonthDay: !isCurrentMonth && date.month < viewDate.month,
|
|
156
|
+
nextMonthDay: !isCurrentMonth && date.month > viewDate.month,
|
|
157
|
+
disabled: isDisabled,
|
|
158
|
+
focused
|
|
159
|
+
}),
|
|
160
|
+
onMouseDown: (event) => {
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
},
|
|
163
|
+
onMouseEnter: () => {
|
|
164
|
+
if (mode === "range" && startDate && !endDate) setHoveredDate(date);
|
|
165
|
+
},
|
|
166
|
+
onMouseLeave: () => {
|
|
167
|
+
setHoveredDate(null);
|
|
168
|
+
},
|
|
169
|
+
onClick: () => handleDateClick(date, isDisabled),
|
|
170
|
+
disabled: isDisabled,
|
|
171
|
+
"aria-label": (0, _carbon_utilities_date_picker.getFullDateLabel)(date, locale),
|
|
172
|
+
"aria-pressed": selected || void 0,
|
|
173
|
+
"aria-current": isToday ? "date" : void 0,
|
|
174
|
+
tabIndex: focused ? 0 : -1,
|
|
175
|
+
children: date.day
|
|
176
|
+
}, index);
|
|
177
|
+
})
|
|
178
|
+
})
|
|
179
|
+
]
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
Calendar.displayName = "Calendar";
|
|
183
|
+
//#endregion
|
|
184
|
+
exports.Calendar = Calendar;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2026
|
|
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 React from 'react';
|
|
8
|
+
/**
|
|
9
|
+
* DatePicker component props
|
|
10
|
+
* Maintains 100% backwards compatibility with Carbon React v11 API
|
|
11
|
+
*/
|
|
12
|
+
export interface DatePickerProps {
|
|
13
|
+
/**
|
|
14
|
+
* The type of date picker
|
|
15
|
+
*/
|
|
16
|
+
datePickerType?: 'simple' | 'single' | 'range';
|
|
17
|
+
/**
|
|
18
|
+
* The date format string
|
|
19
|
+
*/
|
|
20
|
+
dateFormat?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Minimum selectable date (mm/dd/yyyy format)
|
|
23
|
+
*/
|
|
24
|
+
minDate?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Maximum selectable date (mm/dd/yyyy format)
|
|
27
|
+
*/
|
|
28
|
+
maxDate?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Locale for date formatting
|
|
31
|
+
*/
|
|
32
|
+
locale?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Whether the picker is read-only
|
|
35
|
+
*/
|
|
36
|
+
readOnly?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether to use the light variant
|
|
39
|
+
*/
|
|
40
|
+
light?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to use the short variant
|
|
43
|
+
*/
|
|
44
|
+
short?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to allow manual input
|
|
47
|
+
*/
|
|
48
|
+
allowInput?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether to close calendar on date selection
|
|
51
|
+
*/
|
|
52
|
+
closeOnSelect?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Change handler - receives array of Date objects
|
|
55
|
+
*/
|
|
56
|
+
onChange?: (dates: Date[]) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Close handler
|
|
59
|
+
*/
|
|
60
|
+
onClose?: () => void;
|
|
61
|
+
/**
|
|
62
|
+
* Open handler
|
|
63
|
+
*/
|
|
64
|
+
onOpen?: () => void;
|
|
65
|
+
/**
|
|
66
|
+
* Additional CSS class names
|
|
67
|
+
*/
|
|
68
|
+
className?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Children (DatePickerInput components)
|
|
71
|
+
*/
|
|
72
|
+
children?: React.ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Initial value
|
|
75
|
+
*/
|
|
76
|
+
value?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* DatePicker component
|
|
80
|
+
* Main wrapper component that orchestrates date picker functionality
|
|
81
|
+
* Maintains 100% backwards compatibility with Carbon React v11
|
|
82
|
+
*/
|
|
83
|
+
export declare function DatePicker({ datePickerType, dateFormat, minDate, maxDate, locale, readOnly, light, short, allowInput, closeOnSelect, onChange, onClose, onOpen, className, children, value, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
84
|
+
export declare namespace DatePicker {
|
|
85
|
+
var displayName: string;
|
|
86
|
+
}
|