UNPKG

@carbon/ibm-products

Version:
118 lines (116 loc) 4.38 kB
/** * Copyright IBM Corp. 2020, 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 require_runtime = require("../../../_virtual/_rolldown/runtime.js"); const require_index = require("../../../node_modules/classnames/index.js"); const require_settings = require("../../../settings.js"); const require_devtools = require("../../../global/js/utils/devtools.js"); const require_EmptyStateContent = require("../EmptyStateContent.js"); const require_EmptyState = require("../EmptyState.js"); const require_NotFoundIllustration = require("../assets/NotFoundIllustration.js"); let react = require("react"); react = require_runtime.__toESM(react); let prop_types = require("prop-types"); prop_types = require_runtime.__toESM(prop_types); let _carbon_react = require("@carbon/react"); //#region src/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.tsx /** * Copyright IBM Corp. 2020, 2024 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ var import_classnames = /* @__PURE__ */ require_runtime.__toESM(require_index.default); const blockClass = `${require_settings.pkg.prefix}--empty-state`; const componentName = "NotFoundEmptyState"; /** * The `EmptyState` component follows the Carbon guidelines for empty states with some added specifications around illustration usage. For additional usage guidelines and documentation please refer to the links above. */ const NotFoundEmptyState = react.default.forwardRef(({ action, className, illustrationPosition = require_EmptyState.defaults.position, illustrationTheme, illustrationDescription, link, size = require_EmptyState.defaults.size, headingAs, subtitle, title, ...rest }, ref) => { return /* @__PURE__ */ react.default.createElement("div", { ...rest, className: (0, import_classnames.default)(blockClass, className, `${blockClass}-position--${illustrationPosition}`, `${blockClass}-type--notFound`), ref, ...require_devtools.getDevtoolsProps(componentName) }, /* @__PURE__ */ react.default.createElement(require_NotFoundIllustration.NotFoundIllustration, { theme: illustrationTheme, size, alt: illustrationDescription || title }), /* @__PURE__ */ react.default.createElement(require_EmptyStateContent.EmptyStateContent, { action, link, size, headingAs, subtitle, title: title || "" })); }); NotFoundEmptyState.displayName = componentName; NotFoundEmptyState.propTypes = { /** * Empty state action button */ action: prop_types.default.shape({ /**@ts-ignore*/ ..._carbon_react.Button.propTypes, kind: prop_types.default.oneOf([ "primary", "secondary", "tertiary" ]), renderIcon: prop_types.default.oneOfType([prop_types.default.func, prop_types.default.object]), /**@ts-ignore*/ onClick: _carbon_react.Button.propTypes.onClick, text: prop_types.default.string }), /** * Provide an optional class to be applied to the containing node. */ className: prop_types.default.string, /** * Empty state headingAs allows you to customize the type of heading element */ headingAs: prop_types.default.elementType, /** * The alt text for empty state svg images. If not provided , title will be used. */ illustrationDescription: prop_types.default.string, /** * Designates the position of the illustration relative to the content */ illustrationPosition: prop_types.default.oneOf([ "top", "right", "bottom", "left" ]), /** * Empty state illustration theme variations. * To ensure you use the correct themed illustrations, you can conditionally specify light or dark * based on your app's current theme value. Example: * `illustrationTheme={appTheme === ('carbon--g100' || 'carbon--g90') ? 'dark' : 'light'}` */ illustrationTheme: prop_types.default.oneOf(["light", "dark"]), /** * Empty state link object */ /**@ts-ignore*/ link: prop_types.default.any, /** * Empty state size */ size: prop_types.default.oneOf(["lg", "sm"]), /** * Empty state subtitle */ subtitle: prop_types.default.oneOfType([prop_types.default.string, prop_types.default.node]), /** * Empty state title */ title: prop_types.default.oneOfType([prop_types.default.string, prop_types.default.node]).isRequired }; //#endregion exports.NotFoundEmptyState = NotFoundEmptyState;