@carbon/ibm-security
Version:
Carbon for Cloud & Cognitive IBM Security UI components
154 lines (152 loc) • 7.08 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.propTypes = exports.namespace = exports.defaultProps = void 0;
var _propTypes = _interopRequireDefault(require("prop-types"));
var _namespace = require("../../globals/namespace");
/**
* @file Header constants.
* @copyright IBM Security 2018
*/
var defaultProps = exports.defaultProps = {
className: null,
onNotificationClear: function onNotificationClear(notificationId) {
return notificationId;
},
notifications: [],
profile: null,
showEditProfile: true,
showNotifications: true,
totalNotifications: 0
};
var namespace = exports.namespace = (0, _namespace.getComponentNamespace)('header');
var propTypes = exports.propTypes = {
/** @type {string} Extra classes. */
className: _propTypes.default.string,
/** @type {Record<string, any>} An object list of labels. */
labels: _propTypes.default.shape({
/** @type {Record<string, string>} An object list of brand labels. */
brand: _propTypes.default.shape({
/** @type {string} The company. */
company: _propTypes.default.string.isRequired,
/** The domain. */
domain: _propTypes.default.string,
/** @type {string} The product name. */
product: _propTypes.default.string.isRequired
}).isRequired,
/** @type {Record<string, string>} An object list of notifications labels. */
notifications: _propTypes.default.shape({
/** @type {string} The notification button label. */
button: _propTypes.default.string.isRequired,
/** @type {string} The notification clear button label. */
clear: _propTypes.default.string.isRequired,
/** @type {string} The notification button clear all label. */
clear_all: _propTypes.default.string.isRequired,
/** @type {string} The notifications link label. */
link: _propTypes.default.string.isRequired,
/** @type {string} The notifications success label. */
success: _propTypes.default.string.isRequired,
/** @type {string} The notifications today label. */
today: _propTypes.default.string.isRequired,
/** @type {string} The notifications title label. */
title: _propTypes.default.string.isRequired,
/** @type {string} The notification 'via' label. */
via: _propTypes.default.string.isRequired,
/** @type {string} The svg title text for the notification "preferences" icon link. */
preferences: _propTypes.default.string
}).isRequired,
/** @type {Record<string, string>} An object list of profile labels. */
profile: _propTypes.default.shape({
/** @type {string} The account label. */
link: _propTypes.default.string,
/** @type {string} Registration label. */
registration: _propTypes.default.string.isRequired,
/** @type {string} Logging in label. */
sign_in: _propTypes.default.string.isRequired,
/** @type {string} Logging out label. */
sign_out: _propTypes.default.string.isRequired,
/** @type {string} Edit profile label. */
edit_profile: _propTypes.default.string,
/** @type {string} Account label. */
account: _propTypes.default.string
}).isRequired
}).isRequired,
/** @type {Array<Object.*>} An array list of accounts. */
accounts: _propTypes.default.arrayOf(/** @type {Record<string, string>} An object list of accounts. */
_propTypes.default.shape({
/** @type {string} The account id. */
id: _propTypes.default.string.isRequired,
/** @type {string} The account name. */
name: _propTypes.default.string.isRequired
})),
/** @type {Function} The callback when an account is clicked. */
onAccountClick: _propTypes.default.func,
/** @type {Array<Object.*>} An array list of notifications. */
notifications: _propTypes.default.arrayOf(/** @type {Record<string, string>} An object list of notifications. */
_propTypes.default.shape({
/** @type {string} The notification ID. */
id: _propTypes.default.string.isRequired,
/** @type {string} The notification date. */
datetime: _propTypes.default.string.isRequired,
/** @type {string} The notification description. */
description: _propTypes.default.string.isRequired,
/** @type {string} The notification URL. */
href: _propTypes.default.string,
/** @type {string} The notification label. */
label: _propTypes.default.string.isRequired,
/** @type {string} The product name. */
product: _propTypes.default.string.isRequired
}).isRequired),
/** @type {Record<string, string>} An object list of URLs. */
links: _propTypes.default.shape({
/** @type {string} The product URL. */
product: _propTypes.default.string.isRequired,
/** @type {string} The profile URL. */
profile: _propTypes.default.string.isRequired,
/** @type {string} The registration URL. */
registration: _propTypes.default.string.isRequired,
/** @type {string} The URL to sign in. */
sign_in: _propTypes.default.string.isRequired,
/** @type {string} The URL to sign out. */
sign_out: _propTypes.default.string.isRequired,
/** @type {string} The URL to edit profile. */
edit_profile: _propTypes.default.string,
/** @type {string} The preferences href in the notifications popover. */
notifications_preferences: _propTypes.default.string,
/** @type {string} The 'view all' href in the notifications popover. */
notifications_view_all: _propTypes.default.string
}).isRequired,
/** @type {Function} The callback when a notification is cleared. */
onNotificationClear: _propTypes.default.func,
/** @type {Record<object, any>} An object list of profile information. */
profile: _propTypes.default.shape({
/** @type {string} The profile image URL. */
image_url: _propTypes.default.string,
/** @type {string} The profile email. */
email: _propTypes.default.string,
/** @type {accounts} The current user account. */
account: _propTypes.default.shape({
/** @type {string} The account id. */
id: _propTypes.default.string.isRequired,
/** @type {string} The account name. */
name: _propTypes.default.string.isRequired
}),
/** @type {Record<string, string>} An object list of profile names. */
name: _propTypes.default.shape({
/** @type {string} The profile first name. */
first_name: _propTypes.default.string.isRequired,
/** @type {string} The profile surname. */
surname: _propTypes.default.string.isRequired
}).isRequired,
/** Optional description for a profile. */
description: _propTypes.default.node
}),
/** @type {boolean} Whether or not to show the Edit Profile link. */
showEditProfile: _propTypes.default.bool,
/** @type {boolean} Whether or not to show the notifications bell. */
showNotifications: _propTypes.default.bool,
/** @type {number} The total number of unread notifications of the current user. */
totalNotifications: _propTypes.default.number.isRequired
};