@carbon/react
Version:
React components for the Carbon Design System
54 lines (52 loc) • 1.83 kB
JavaScript
/**
* Copyright IBM Corp. 2016, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import { usePrefix } from "../../internal/usePrefix.js";
import classNames from "classnames";
import "react";
import PropTypes from "prop-types";
import { jsx, jsxs } from "react/jsx-runtime";
//#region src/components/DatePicker/DatePicker.Skeleton.tsx
/**
* Copyright IBM Corp. 2016, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const DatePickerSkeleton = ({ range, id, hideLabel, className, ...rest }) => {
const prefix = usePrefix();
const dateInput = /* @__PURE__ */ jsxs("div", {
className: `${prefix}--date-picker-container`,
children: [!hideLabel && /* @__PURE__ */ jsx("span", {
className: `${prefix}--label`,
id
}), /* @__PURE__ */ jsx("div", { className: `${prefix}--date-picker__input ${prefix}--skeleton` })]
});
if (range) return /* @__PURE__ */ jsx("div", {
className: `${prefix}--form-item`,
children: /* @__PURE__ */ jsxs("div", {
className: classNames(`${prefix}--date-picker`, `${prefix}--date-picker--range`, `${prefix}--skeleton`, className),
...rest,
children: [dateInput, dateInput]
})
});
return /* @__PURE__ */ jsx("div", {
className: `${prefix}--form-item`,
children: /* @__PURE__ */ jsx("div", {
className: classNames(`${prefix}--date-picker`, `${prefix}--date-picker--short`, `${prefix}--date-picker--simple`, `${prefix}--skeleton`, className),
...rest,
children: dateInput
})
});
};
DatePickerSkeleton.propTypes = {
className: PropTypes.string,
hideLabel: PropTypes.bool,
id: PropTypes.string,
range: PropTypes.bool
};
//#endregion
export { DatePickerSkeleton as default };