UNPKG

@enact/sandstone

Version:

Large-screen/TV support library for Enact, containing a variety of UI components.

99 lines (95 loc) 2.91 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Panel = void 0; exports.PanelBase = PanelBase; exports["default"] = void 0; var _Slottable = _interopRequireDefault(require("@enact/ui/Slottable")); var _react = require("react"); var _PanelsRouter = require("../internal/Panels/PanelsRouter"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } /** * Panel that sets the children, footer, subtitle, and title for * {@link sandstone/WizardPanels.WizardPanels|WizardPanels}. * * @class PanelBase * @memberof sandstone/WizardPanels * @ui * @private */ function PanelBase(_ref) { var ariaLabel = _ref['aria-label'], children = _ref.children, footer = _ref.footer, nextButton = _ref.nextButton, prevButton = _ref.prevButton, subtitle = _ref.subtitle, title = _ref.title; var set = (0, _react.useContext)(_PanelsRouter.PanelsContext); (0, _react.useEffect)(function () { if (set) { set({ 'aria-label': ariaLabel, children: children, footer: footer, nextButton: nextButton, prevButton: prevButton, subtitle: subtitle, title: title }); } }, [ariaLabel, children, footer, nextButton, prevButton, subtitle, set, title]); return null; } /** * Panel that sets the children, footer, subtitle, and title for * {@link sandstone/WizardPanels.WizardPanels|WizardPanels}. * * @class Panel * @memberof sandstone/WizardPanels * @ui * @public */ var Panel = exports.Panel = (0, _Slottable["default"])({ slots: ['footer', 'subtitle', 'title'] }, PanelBase); /** * The button to use in place of the standard next button. * * This prop accepts a component (e.g. `Button`), a component instance or a boolean value. * * If `false`, the button will not show. If set to a component, or `true`, the button will * show. This will override the setting of * {@link sandstone/WizardPanels.WizardPanelsBase.nextButtonVisibility|nextButtonVisibility}. * * Example: * ``` * nextButton={<Button icon="closex" aria-label="Quit">Close</Button>} * ``` * * @name nextButton * @memberof sandstone/WizardPanels.Panel.prototype * @type {Boolean|Component} * @public */ /** * The button to use in place of the standard prev button. * * This prop accepts a component (e.g. `Button`), a component instance or a boolean value. * * If `false`, the button will not show. If set to a component, or `true`, the button will * show. This will override the setting of * {@link sandstone/WizardPanels.WizardPanelsBase.prevButtonVisibility|prevButtonVisibility}. * * Example: * ``` * prevButton={<Button icon="closex" aria-label="Back">Back</Button>} * ``` * * @name PrevButton * @memberof sandstone/WizardPanels.Panel.prototype * @type {Boolean|Component} * @public */ var _default = exports["default"] = Panel;