techsbcn-storybook 0.8.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/fields/SelectFieldComponent/SelectAsyncField.d.ts +1 -0
- package/dist/components/tables/SearchComponent/SearchComponent.d.ts +1 -0
- package/dist/components/wrappers/MainWrapperComponent/MainWrapperComponent.d.ts +1 -1
- package/dist/components/wrappers/TabsComponent/TabsComponent.d.ts +17 -0
- package/dist/index.d.ts +1 -0
- package/dist/techsbcn-storybook.cjs.development.js +75 -14
- package/dist/techsbcn-storybook.cjs.development.js.map +1 -1
- package/dist/techsbcn-storybook.cjs.production.min.js +1 -1
- package/dist/techsbcn-storybook.cjs.production.min.js.map +1 -1
- package/dist/techsbcn-storybook.esm.js +76 -16
- package/dist/techsbcn-storybook.esm.js.map +1 -1
- package/package.json +2 -1
- package/src/components/fields/SelectFieldComponent/SelectAsyncField.tsx +6 -0
- package/src/components/tables/SearchComponent/SearchComponent.tsx +11 -5
- package/src/components/tables/TableComponent/TableComponent.tsx +1 -1
- package/src/components/wrappers/MainWrapperComponent/MainWrapperComponent.scss +2 -5
- package/src/components/wrappers/MainWrapperComponent/MainWrapperComponent.tsx +13 -9
- package/src/components/wrappers/TabsComponent/TabsComponent.scss +22 -0
- package/src/components/wrappers/TabsComponent/TabsComponent.tsx +49 -0
- package/src/index.tsx +1 -0
- package/src/stories/Fields/Fields.stories.tsx +9 -0
- package/src/stories/MainWrapper/MainWrapper.stories.tsx +69 -0
- package/src/styles/Globals.scss +3 -0
|
@@ -10,6 +10,7 @@ interface SelectAsyncFieldProps {
|
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
onChange?: (value: number, name: string) => void;
|
|
12
12
|
onChangeValue?: (value: number) => void;
|
|
13
|
+
onChangeOption?: (value: number, label: string) => void;
|
|
13
14
|
searchPromise: (filters: SearchFilters) => Promise<any>;
|
|
14
15
|
invalid?: boolean;
|
|
15
16
|
isClearable?: boolean;
|
|
@@ -4,7 +4,7 @@ import './MainWrapperComponent.scss';
|
|
|
4
4
|
interface MainWrapperComponentProps {
|
|
5
5
|
loading?: boolean;
|
|
6
6
|
loadingChildren?: boolean;
|
|
7
|
-
headerProps
|
|
7
|
+
headerProps?: SearchComponentProps;
|
|
8
8
|
divider?: boolean;
|
|
9
9
|
}
|
|
10
10
|
export declare const MainWrapperComponent: React.FC<MainWrapperComponentProps>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './TabsComponent.scss';
|
|
3
|
+
interface TabsComponentProps {
|
|
4
|
+
tabActive: number;
|
|
5
|
+
tabs: TabLabel[];
|
|
6
|
+
tabsComponent: TabComponent[];
|
|
7
|
+
}
|
|
8
|
+
interface TabLabel {
|
|
9
|
+
label: string;
|
|
10
|
+
value: number;
|
|
11
|
+
}
|
|
12
|
+
interface TabComponent {
|
|
13
|
+
component: React.ReactNode;
|
|
14
|
+
value: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const TabsComponent: React.FC<TabsComponentProps>;
|
|
17
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -16,3 +16,4 @@ export * from './components/forms/LoginForm';
|
|
|
16
16
|
export * from './components/forms/ChangePasswordForm';
|
|
17
17
|
export * from './components/forms/ResetPasswordForm';
|
|
18
18
|
export * from './components/modals/ModalComponent';
|
|
19
|
+
export * from './components/wrappers/TabsComponent/TabsComponent';
|
|
@@ -16,6 +16,7 @@ var reactSelectAsyncPaginate = require('react-select-async-paginate');
|
|
|
16
16
|
var yup = require('yup');
|
|
17
17
|
var reactHookForm = require('react-hook-form');
|
|
18
18
|
var yup$1 = require('@hookform/resolvers/yup');
|
|
19
|
+
var lab = require('@mui/lab');
|
|
19
20
|
|
|
20
21
|
function styleInject(css, ref) {
|
|
21
22
|
if ( ref === void 0 ) ref = {};
|
|
@@ -130,17 +131,17 @@ var SearchComponent = function SearchComponent(props) {
|
|
|
130
131
|
className: "search-component " + props.className
|
|
131
132
|
}, React__default.createElement(material.Grid, {
|
|
132
133
|
container: true,
|
|
133
|
-
spacing: 2,
|
|
134
134
|
alignItems: "center"
|
|
135
135
|
}, React__default.createElement(material.Grid, {
|
|
136
136
|
item: true,
|
|
137
|
-
xs:
|
|
137
|
+
xs: props.actions ? 6 : 12,
|
|
138
|
+
md: 4
|
|
138
139
|
}, React__default.createElement(material.Box, {
|
|
139
|
-
|
|
140
|
-
className:
|
|
140
|
+
px: 1,
|
|
141
|
+
className: (props.enableAfter ? 'main-background-color-after' : '') + " title"
|
|
141
142
|
}, props.title)), props.actions && React__default.createElement(material.Grid, {
|
|
142
143
|
item: true,
|
|
143
|
-
xs:
|
|
144
|
+
xs: props.title ? 6 : 12,
|
|
144
145
|
sx: {
|
|
145
146
|
display: {
|
|
146
147
|
xs: 'block',
|
|
@@ -198,6 +199,12 @@ var SearchComponent = function SearchComponent(props) {
|
|
|
198
199
|
alignItems: "center"
|
|
199
200
|
}, React__default.createElement(material.Box, {
|
|
200
201
|
ml: "auto",
|
|
202
|
+
sx: (props.searchBar || props.filters) && {
|
|
203
|
+
mt: {
|
|
204
|
+
xs: 2,
|
|
205
|
+
md: 0
|
|
206
|
+
}
|
|
207
|
+
},
|
|
201
208
|
display: "flex",
|
|
202
209
|
width: "100%"
|
|
203
210
|
}, props.searchBar, props.filters && React__default.createElement(material.Box, {
|
|
@@ -232,7 +239,7 @@ var SearchComponent = function SearchComponent(props) {
|
|
|
232
239
|
})))));
|
|
233
240
|
};
|
|
234
241
|
|
|
235
|
-
var css_248z$2 = ".main-wrapper-component {\n background-color: white;\n box-shadow: 0 1px 20px 0 rgba(69, 90, 100, 0.08);\n}\n.main-wrapper-component .
|
|
242
|
+
var css_248z$2 = ".main-wrapper-component {\n background-color: white;\n box-shadow: 0 1px 20px 0 rgba(69, 90, 100, 0.08);\n}\n.main-wrapper-component .main-background-color-after {\n position: relative;\n}\n.main-wrapper-component .main-background-color-after:after {\n content: \"\";\n position: absolute;\n left: -17px;\n top: -4px;\n width: 4px;\n height: 30px;\n}\n.main-wrapper-component .wrapper-actions .btn-action {\n cursor: pointer;\n}\n.main-wrapper-component .wrapper-actions .btn-action .MuiButton-root {\n width: max-content;\n}\n.main-wrapper-component .wrapper-actions .btn-action svg {\n font-size: 40px;\n}";
|
|
236
243
|
styleInject(css_248z$2);
|
|
237
244
|
|
|
238
245
|
var MainWrapperComponent = function MainWrapperComponent(props) {
|
|
@@ -241,18 +248,28 @@ var MainWrapperComponent = function MainWrapperComponent(props) {
|
|
|
241
248
|
py: 2
|
|
242
249
|
}, props.loading ? React__default.createElement(_.Box, {
|
|
243
250
|
display: "flex",
|
|
244
|
-
|
|
251
|
+
justifyContent: "center",
|
|
245
252
|
px: 2
|
|
246
|
-
}, React__default.createElement(_.CircularProgress,
|
|
247
|
-
|
|
253
|
+
}, React__default.createElement(_.CircularProgress, {
|
|
254
|
+
className: "circular-progress-main-color"
|
|
255
|
+
})) : React__default.createElement(React__default.Fragment, null, props.headerProps && React__default.createElement(_.Box, {
|
|
256
|
+
mb: props.divider ? 1 : 0,
|
|
248
257
|
px: 2
|
|
249
|
-
}, React__default.createElement(SearchComponent, Object.assign({}, props.headerProps
|
|
258
|
+
}, React__default.createElement(SearchComponent, Object.assign({}, props.headerProps, {
|
|
259
|
+
enableAfter: true
|
|
260
|
+
}))), props.divider && React__default.createElement(_.Divider, null), props.children && !props.loadingChildren ? React__default.createElement(_.Box, {
|
|
261
|
+
pt: props.headerProps ? 2 : 0,
|
|
250
262
|
px: 2
|
|
251
|
-
},
|
|
263
|
+
}, React__default.createElement(_.Box, {
|
|
264
|
+
className: "" + (props.headerProps ? '' : 'main-background-color-after')
|
|
265
|
+
}, props.children)) : props.loadingChildren ? React__default.createElement(_.Box, {
|
|
252
266
|
display: "flex",
|
|
253
|
-
|
|
267
|
+
justifyContent: "center",
|
|
268
|
+
pt: props.headerProps ? 2 : 0,
|
|
254
269
|
px: 2
|
|
255
|
-
}, React__default.createElement(_.CircularProgress,
|
|
270
|
+
}, React__default.createElement(_.CircularProgress, {
|
|
271
|
+
className: "circular-progress-main-color"
|
|
272
|
+
})) : React__default.createElement(React__default.Fragment, null)));
|
|
256
273
|
};
|
|
257
274
|
|
|
258
275
|
var css_248z$3 = ".table-component .paper-container {\n box-shadow: none;\n background-color: transparent !important;\n}\n.table-component .paper-container .checkbox-cell .MuiCheckbox-root {\n padding: 0 !important;\n}\n.table-component .paper-container .checkbox-cell .MuiCheckbox-root:hover {\n background-color: transparent !important;\n}\n.table-component .paper-container .checkbox-cell .Mui-checked {\n color: rgba(0, 0, 0, 0.54) !important;\n}\n.table-component .paper-container .checkbox-cell .MuiCheckbox-indeterminate {\n color: #212529 !important;\n}\n.table-component .paper-container .table-container {\n max-height: 68vh;\n border-bottom: 1px solid black;\n}\n.table-component .paper-container .table-container .table-column:first-child {\n border-radius: 5px 0 0 5px;\n}\n.table-component .paper-container .table-container .table-column:last-child {\n border-right: none !important;\n border-radius: 0 5px 5px 0;\n}\n.table-component .paper-container .table-container .table-column {\n font-weight: bold;\n font-size: 1rem !important;\n padding: 10px !important;\n border-top: 1px solid #e0e0e0;\n border-right: 1px solid #e0e0e0;\n border-bottom: 2px solid #e0e0e0;\n}\n.table-component .paper-container .table-container .table-column .table-header-cell {\n color: black;\n padding: 0px 10px 0px 10px !important;\n}\n.table-component .paper-container .table-container .table-rows.row-click {\n cursor: pointer;\n}\n.table-component .paper-container .table-container .table-rows.row-click:hover {\n background-color: rgba(0, 0, 0, 0.04);\n}\n.table-component .paper-container .table-container .table-rows .MuiTableCell-root {\n padding: 6px !important;\n overflow: hidden;\n}\n.table-component .paper-container .table-container .table-rows .img-table {\n width: 100%;\n height: 110px;\n}\n.table-component .paper-container .table-container .table-rows .img-table img {\n object-fit: contain;\n}\n.table-component .paper-container .table-container .table-rows .actions {\n float: right;\n}\n.table-component .paper-container .table-container .table-rows .btn-action {\n color: rgba(0, 0, 0, 0.54);\n display: inline-block;\n text-decoration: none;\n font-size: 1.6em !important;\n padding: 0px 7px;\n cursor: pointer;\n}\n.table-component .paper-container .MuiTable-root.loading {\n opacity: 0.5;\n}\n.table-component .paper-container .MuiTable-root.loading .MuiCircularProgress-root {\n width: 80px !important;\n height: 80px !important;\n position: absolute;\n left: 0;\n right: 0;\n top: 5px;\n margin: auto;\n color: grey;\n}\n.table-component .paper-container .MuiTablePagination-root {\n overflow: unset;\n}\n.table-component .paper-container .MuiTablePagination-root .MuiToolbar-root {\n justify-content: center !important;\n flex-wrap: wrap;\n padding: 0px !important;\n}\n.table-component .paper-container .MuiTablePagination-root .MuiTablePagination-spacer {\n flex: 0 !important;\n}\n.table-component .paper-container .MuiTablePagination-root .pagination .MuiPaginationItem-page {\n border-radius: 0px;\n margin: 1px;\n color: white !important;\n background-color: #3f4d67;\n}\n.table-component .paper-container .MuiTablePagination-root .pagination .MuiPaginationItem-page.Mui-selected {\n background-color: #3299C7;\n}\n.table-component .paper-container .MuiTablePagination-root .pagination li button {\n padding: 14px;\n}\n.table-component .paper-container .MuiTablePagination-root .pagination li:nth-child(2) .MuiPaginationItem-page {\n border-radius: 5px 0 0 5px !important;\n}\n.table-component .paper-container .MuiTablePagination-root .pagination li:nth-last-child(2) .MuiPaginationItem-page {\n border-radius: 0 5px 5px 0 !important;\n}\n@media (max-width: 992px) {\n .table-component .paper-container .table-container {\n max-height: 60vh;\n border-top: 1px solid #cccccc;\n }\n .table-component .paper-container .table-container .MuiTable-root {\n border-collapse: collapse !important;\n }\n .table-component .paper-container .table-container .MuiTableHead-root {\n display: none !important;\n }\n .table-component .paper-container .table-container .table-rows {\n border-bottom: 2px solid #cccccc;\n }\n .table-component .paper-container .table-container .table-rows .MuiTableCell-root {\n width: 100%;\n border-bottom: none !important;\n }\n .table-component .paper-container .table-container .table-rows .MuiTableCell-root .label-cell {\n font-size: 1rem;\n vertical-align: top;\n width: 50%;\n height: auto;\n }\n .table-component .paper-container .table-container .table-rows .MuiTableCell-root .label-cell + div {\n display: inline-block;\n }\n .table-component .paper-container .table-container .table-rows .table-cell {\n display: inline-block !important;\n }\n .table-component .paper-container .table-container .table-rows .format-value {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n width: 50%;\n max-width: 300px;\n }\n}";
|
|
@@ -460,7 +477,9 @@ var TableComponent = function TableComponent(props) {
|
|
|
460
477
|
overflow: 'inherit !important',
|
|
461
478
|
height: props.rows.length > 0 ? 'auto' : '80px'
|
|
462
479
|
}
|
|
463
|
-
}, React__default.createElement(_.CircularProgress,
|
|
480
|
+
}, React__default.createElement(_.CircularProgress, {
|
|
481
|
+
className: "circular-progress-main-color"
|
|
482
|
+
}))), props.rows && props.rows.length > 0 ? props.rows.map(function (row, index) {
|
|
464
483
|
var rowColor = props.rowsColorColumn && ObjectbyString(row, props.rowsColorColumn.columnName) === props.rowsColorColumn.columnValue ? "row-color-" + props.rowsColorColumn.columnValue : '';
|
|
465
484
|
return React__default.createElement(_.TableRow, {
|
|
466
485
|
className: "table-rows " + rowColor + " " + (props.onClickRow ? 'row-click' : ''),
|
|
@@ -1907,6 +1926,11 @@ var SelectAsyncField = function SelectAsyncField(props) {
|
|
|
1907
1926
|
props.onChangeValue && props.onChangeValue(option && option.length > 0 ? option.map(function (o) {
|
|
1908
1927
|
return o.value;
|
|
1909
1928
|
}) : option ? option.value : option);
|
|
1929
|
+
props.onChangeOption && props.onChangeOption(option && option.length > 0 ? option.map(function (o) {
|
|
1930
|
+
return o.value;
|
|
1931
|
+
}) : option ? option.value : option, option && option.length > 0 ? option.map(function (o) {
|
|
1932
|
+
return o.label;
|
|
1933
|
+
}) : option ? option.label : option);
|
|
1910
1934
|
},
|
|
1911
1935
|
selectRef: props.inputRef,
|
|
1912
1936
|
isDisabled: props.disabled,
|
|
@@ -2233,6 +2257,42 @@ ModalComponent.defaultProps = {
|
|
|
2233
2257
|
dividers: true
|
|
2234
2258
|
};
|
|
2235
2259
|
|
|
2260
|
+
var css_248z$d = ".tabs-component .Mui-selected {\n color: white !important;\n border: none !important;\n background-color: #3299C7;\n}\n.tabs-component .MuiTabs-indicator {\n display: none;\n}\n.tabs-component .MuiTab-root {\n margin: 2px 2px 0px;\n border: 1px solid #00000038;\n border-bottom: none;\n border-radius: 5% 5% 0% 0%;\n color: rgba(0, 0, 0, 0.54);\n}\n.tabs-component .MuiTabPanel-root {\n border: 1px solid #00000038;\n margin: 0px 2px 0px;\n border-radius: 0% 5px 5px 5px;\n}";
|
|
2261
|
+
styleInject(css_248z$d);
|
|
2262
|
+
|
|
2263
|
+
var TabsComponent = function TabsComponent(props) {
|
|
2264
|
+
var _React$useState = React__default.useState(props.tabActive.toString()),
|
|
2265
|
+
value = _React$useState[0],
|
|
2266
|
+
setValue = _React$useState[1];
|
|
2267
|
+
|
|
2268
|
+
var handleChange = function handleChange(_event, newValue) {
|
|
2269
|
+
setValue(newValue);
|
|
2270
|
+
};
|
|
2271
|
+
|
|
2272
|
+
return React__default.createElement(MainWrapperComponent, null, React__default.createElement(material.Box, {
|
|
2273
|
+
className: "tabs-component"
|
|
2274
|
+
}, React__default.createElement(lab.TabContext, {
|
|
2275
|
+
value: value
|
|
2276
|
+
}, React__default.createElement(lab.TabList, {
|
|
2277
|
+
onChange: handleChange
|
|
2278
|
+
}, props.tabs.sort(function (a, b) {
|
|
2279
|
+
return a.value - b.value;
|
|
2280
|
+
}).map(function (tabLabel) {
|
|
2281
|
+
return React__default.createElement(material.Tab, {
|
|
2282
|
+
key: tabLabel.value,
|
|
2283
|
+
label: tabLabel.label,
|
|
2284
|
+
value: tabLabel.value.toString()
|
|
2285
|
+
});
|
|
2286
|
+
})), props.tabsComponent.sort(function (a, b) {
|
|
2287
|
+
return a.value - b.value;
|
|
2288
|
+
}).map(function (tabComponent) {
|
|
2289
|
+
return React__default.createElement(lab.TabPanel, {
|
|
2290
|
+
key: tabComponent.value,
|
|
2291
|
+
value: tabComponent.value.toString()
|
|
2292
|
+
}, tabComponent.component);
|
|
2293
|
+
}))));
|
|
2294
|
+
};
|
|
2295
|
+
|
|
2236
2296
|
exports.AppHeader = AppHeader;
|
|
2237
2297
|
exports.AppSidebar = AppSidebar;
|
|
2238
2298
|
exports.ButtonComponent = ButtonComponent;
|
|
@@ -2248,6 +2308,7 @@ exports.SearchComponent = SearchComponent;
|
|
|
2248
2308
|
exports.SelectAsyncField = SelectAsyncField;
|
|
2249
2309
|
exports.SelectField = SelectField;
|
|
2250
2310
|
exports.TableComponent = TableComponent;
|
|
2311
|
+
exports.TabsComponent = TabsComponent;
|
|
2251
2312
|
exports.TextFieldComponent = TextFieldComponent;
|
|
2252
2313
|
exports.UserInfo = UserInfo;
|
|
2253
2314
|
exports.VerticalNav = VerticalNav;
|