@carbon/react
Version:
React components for the Carbon Design System
66 lines (64 loc) • 2.39 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 { FormContext } from "../FluidForm/FormContext.js";
import classNames from "classnames";
import "react";
import PropTypes from "prop-types";
import { jsx, jsxs } from "react/jsx-runtime";
import { Calendar } from "@carbon/icons-react";
//#region src/components/FluidDatePicker/FluidDatePicker.Skeleton.tsx
/**
* Copyright IBM Corp. 2016, 2025
*
* 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 FluidDatePickerSkeleton = ({ className, datePickerType = "single", ...other }) => {
const prefix = usePrefix();
const classNames$1 = classNames(className, `${prefix}--form-item ${prefix}--date-picker--fluid__skeleton`, { [`${prefix}--date-picker--fluid__skeleton--range`]: datePickerType === "range" });
return /* @__PURE__ */ jsx(FormContext.Provider, {
value: { isFluid: true },
children: /* @__PURE__ */ jsxs("div", {
className: classNames$1,
...other,
children: [/* @__PURE__ */ jsxs("div", {
className: `${prefix}--date-picker--fluid__skeleton--container`,
children: [
/* @__PURE__ */ jsx("span", { className: `${prefix}--label ${prefix}--skeleton` }),
/* @__PURE__ */ jsx("div", { className: `${prefix}--skeleton ${prefix}--text-input` }),
datePickerType !== "simple" && /* @__PURE__ */ jsx(Calendar, {
className: `${prefix}--date-picker__icon`,
role: "img",
"aria-hidden": "true"
})
]
}), datePickerType === "range" && /* @__PURE__ */ jsxs("div", {
className: `${prefix}--date-picker--fluid__skeleton--container`,
children: [
/* @__PURE__ */ jsx("span", { className: `${prefix}--label ${prefix}--skeleton` }),
/* @__PURE__ */ jsx("div", { className: `${prefix}--skeleton ${prefix}--text-input` }),
/* @__PURE__ */ jsx(Calendar, {
className: `${prefix}--date-picker__icon`,
role: "img",
"aria-hidden": "true"
})
]
})]
})
});
};
FluidDatePickerSkeleton.propTypes = {
className: PropTypes.string,
datePickerType: PropTypes.oneOf([
"simple",
"single",
"range"
])
};
//#endregion
export { FluidDatePickerSkeleton as default };