@enact/sandstone
Version:
Large-screen/TV support library for Enact, containing a variety of UI components.
84 lines (83 loc) • 2.46 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _kind = _interopRequireDefault(require("@enact/core/kind"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* An item for the TabLayout.
*
* Configures the tab title and icon.
*
* @class Tab
* @memberof sandstone/TabLayout
* @ui
* @public
*/var Tab = (0, _kind["default"])({
name: 'Tab',
propTypes: /** @lends sandstone/TabLayout.Tab.prototype */{
/**
* Title of the tab.
*
* @type {String}
* @required
* @public
*/
title: _propTypes["default"].string.isRequired,
/**
* The contents to show when the tab is selected.
*
* @type {Node}
* @public
*/
children: _propTypes["default"].node,
/**
* The icon content of the tab.
*
* @see {@link ui/Icon.IconBase.children}
* @type {String|Object}
* @public
*/
icon: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object]),
/**
* Called when a tab is clicked.
*
* @type {Function}
* @public
*/
onTabClick: _propTypes["default"].func,
/**
* Configuration props for a {@link sandstone/Sprite.Sprite|Sprite} icon.
*
* All props on {@link sandstone/Sprite.Sprite|Sprite} are supported here. By default,
* `stopped` will be set to `false` when the tab is focused and `true` otherwise. To
* override, pass `stopped` in this object.
*
* @see {@link sandstone/Sprite.Sprite}
* @type {Object}
* @public
*/
sprite: _propTypes["default"].object,
/**
* Key for the tab.
*
* Note: `TabLayout` automatically generates a key based on the title and icon combination.
* If this combination is not unique for all items, `tabKey` must be specified to make each
* tab have a unique (and persistent) key.
*
* @type {String|Number}
* @required
* @public
*/
tabKey: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
},
render: function render() {
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
children: "Tab is only to be used in TabLayout!"
});
}
});
var _default = exports["default"] = Tab;