UNPKG

nishant-design-system

Version:
147 lines (145 loc) 4.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SideMenuLink = exports.MENU_NAME_LIST = void 0; var React = _interopRequireWildcard(require("react")); var _classify = _interopRequireDefault(require("../../utils/classify")); var _Icon = require("../Icon"); var _Text = require("../Text"); var _SideMenuLinkModule = _interopRequireDefault(require("./SideMenuLink.module.css")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } const MENU_NAME_LIST = Object.freeze({ dashboard: { title: 'Dashboard', iconName: 'house', iconType: 'duotone', iconSwapOpacity: false }, engage: { title: 'Engage', iconName: 'bullseye-pointer', iconType: 'duotone', iconSwapOpacity: false }, trm: { title: 'TRM', iconName: 'screen-users', iconType: 'duotone', iconSwapOpacity: true }, analytics: { title: 'Analytics', iconName: 'chart-column', iconType: 'duotone', iconSwapOpacity: true }, messaging: { title: 'Messaging', iconName: 'messages', iconType: 'duotone', iconSwapOpacity: true }, chatbot: { title: 'Chatbot', iconName: 'message-bot', iconType: 'duotone', iconSwapOpacity: true }, referrals: { title: 'Referrals', iconName: 'user-check', iconType: 'duotone', iconSwapOpacity: true }, records: { title: 'Records', iconName: 'folder-open', iconType: 'duotone', iconSwapOpacity: true }, bulkCleanup: { title: 'Bulk Cleanup', iconName: 'retweet', iconType: 'duotone', iconSwapOpacity: true }, support: { title: 'Support', iconName: 'headset', iconType: 'duotone', iconSwapOpacity: true }, audit: { title: 'Audit', iconName: 'print-magnifying-glass', iconType: 'duotone', iconSwapOpacity: true }, timeline: { title: 'Timeline', iconName: 'timeline', iconType: 'duotone', iconSwapOpacity: true }, people: { title: 'People', iconName: 'people-group', iconType: 'duotone', iconSwapOpacity: true }, contacts: { title: 'Contacts', iconName: 'address-card', iconType: 'duotone', iconSwapOpacity: true }, contacts2: { title: 'Contacts', iconName: 'calendars', iconType: 'duotone', iconSwapOpacity: true }, contacts3: { title: 'Contacts', iconName: 'browser', iconType: 'duotone', iconSwapOpacity: true } }); exports.MENU_NAME_LIST = MENU_NAME_LIST; const SideMenuLink = /*#__PURE__*/React.forwardRef((_ref, ref) => { let { classNames, pageNameKey, disabled, opened, selectedValue, onChange } = _ref; const selected = selectedValue === pageNameKey; const onChangeHandler = () => { onChange && onChange(pageNameKey); }; return /*#__PURE__*/React.createElement("div", { className: (0, _classify.default)(_SideMenuLinkModule.default.linkWrapper, { [_SideMenuLinkModule.default.selected]: selected, [_SideMenuLinkModule.default.disabled]: disabled, [_SideMenuLinkModule.default.closed]: !opened }, classNames?.wrapper), onClick: onChangeHandler, ref: ref }, pageNameKey && MENU_NAME_LIST[pageNameKey] ? /*#__PURE__*/React.createElement(_Icon.Icon, { type: MENU_NAME_LIST[pageNameKey].iconType, name: MENU_NAME_LIST[pageNameKey].iconName, size: "medium", color: _Text.TEXT_COLORS.inverseSecondary, className: _SideMenuLinkModule.default.menuIcon }) : null, pageNameKey && MENU_NAME_LIST[pageNameKey] && opened ? /*#__PURE__*/React.createElement(_Text.SubTitleSmall, { color: _Text.TEXT_COLORS.inverseSecondary, className: _SideMenuLinkModule.default.menuText }, MENU_NAME_LIST[pageNameKey].title) : null); }); exports.SideMenuLink = SideMenuLink;