UNPKG

infinity-forge

Version:
78 lines 4.85 kB
"use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SelectWorkSpace = SelectWorkSpace; var jsx_runtime_1 = require("react/jsx-runtime"); var system_1 = require("../../../../system/index.js"); var ui_1 = require("../../../../ui/index.js"); var custom_styles_1 = require("./custom-styles.js"); var S = __importStar(require("./styles.js")); function SelectWorkSpace(_a) { var workspaces = _a.workspaces; if (!(workspaces === null || workspaces === void 0 ? void 0 : workspaces.list) || workspaces.list.length === 0) { return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}); } function Item(_a) { var _b, _c; var data = _a.data, props = __rest(_a, ["data"]); var isOption = (_c = (_b = props === null || props === void 0 ? void 0 : props.innerProps) === null || _b === void 0 ? void 0 : _b.id) === null || _c === void 0 ? void 0 : _c.includes('option'); var optionIsActive = isOption && workspaces.activeWorkspace === data.value; return ((0, jsx_runtime_1.jsxs)(S.Item, __assign({ className: "item ".concat(optionIsActive ? "active" : "") }, props.innerProps, { "$isOption": isOption, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'content_option', children: [(data === null || data === void 0 ? void 0 : data.img) && (0, jsx_runtime_1.jsx)(system_1.Avatar, { className: 'avatar', image: data.img }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: 'font-14-regular title_workspace', children: data === null || data === void 0 ? void 0 : data.label }), (data === null || data === void 0 ? void 0 : data.subtitle) && (0, jsx_runtime_1.jsx)("span", { className: 'font-12-regular subtitle', style: { color: isOption ? "#828282" : "#fff" }, children: data.subtitle })] })] }), isOption && (0, jsx_runtime_1.jsx)("div", { className: 'active_workspace', children: (0, jsx_runtime_1.jsx)("div", {}) })] }))); } return ((0, jsx_runtime_1.jsx)(S.SelectWorkSpace, { children: (0, jsx_runtime_1.jsx)(ui_1.FormHandler, { onChangeForm: (workspaces === null || workspaces === void 0 ? void 0 : workspaces.onChangeWorkSpace) && { callbackResult: workspaces.onChangeWorkSpace }, initialData: { workspace: workspaces.activeWorkspace }, children: (0, jsx_runtime_1.jsx)(ui_1.Select, { name: 'workspace', menuPlacement: 'auto', options: workspaces.list, onlyOneValue: true, customStlyes: custom_styles_1.customStyles, CustomOption: Item, isSearchable: false, placeholder: 'Selecione a empresa', value: workspaces.activeWorkspace }) }) })); } //# sourceMappingURL=component.js.map