@symply.io/basic-components 1.0.0-alpha.13 → 1.0.0-alpha.16
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/AlertDialog/index.d.ts +0 -1
- package/AlertDialog/index.js +2 -2
- package/Autocomplete/index.d.ts +6 -0
- package/Autocomplete/index.js +38 -0
- package/Autocomplete/types.d.ts +14 -0
- package/Autocomplete/types.js +1 -0
- package/Autocomplete/useInteractions.d.ts +5 -0
- package/Autocomplete/useInteractions.js +9 -0
- package/AutocompleteWithFilter/index.d.ts +6 -0
- package/AutocompleteWithFilter/index.js +54 -0
- package/AutocompleteWithFilter/types.d.ts +15 -0
- package/AutocompleteWithFilter/types.js +1 -0
- package/BasicModal/Content.d.ts +0 -1
- package/BasicModal/Content.js +1 -1
- package/BasicModal/index.d.ts +0 -1
- package/BasicModal/index.js +2 -2
- package/BreadCrumbs/index.d.ts +4 -0
- package/BreadCrumbs/index.js +37 -0
- package/BreadCrumbs/types.d.ts +9 -0
- package/BreadCrumbs/types.js +1 -0
- package/Copyright/index.d.ts +4 -0
- package/Copyright/index.js +25 -0
- package/Copyright/types.d.ts +5 -0
- package/Copyright/types.js +1 -0
- package/DigitInput/index.d.ts +0 -1
- package/DigitInput/index.js +1 -1
- package/DynamicHeaderBar/HeaderBar.js +1 -1
- package/DynamicHeaderBar/HeaderButtons.d.ts +0 -1
- package/DynamicHeaderBar/HeaderButtons.js +5 -5
- package/DynamicHeaderBar/HeaderLine.js +1 -1
- package/DynamicHeaderBar/index.js +2 -2
- package/FormRadioGroup/index.d.ts +0 -1
- package/FormRadioGroup/index.js +3 -3
- package/FormSelector/MultipleSelector.d.ts +0 -1
- package/FormSelector/MultipleSelector.js +2 -2
- package/FormSelector/SimpleSelector.d.ts +0 -1
- package/FormSelector/SimpleSelector.js +2 -2
- package/HelpCaption/index.js +2 -2
- package/LoadingModal/index.d.ts +0 -1
- package/LoadingModal/index.js +1 -1
- package/MenuButtonGroup/MenuItem.d.ts +0 -1
- package/MenuButtonGroup/MenuItem.js +1 -1
- package/MenuButtonGroup/index.js +2 -2
- package/NumberInput/index.js +1 -1
- package/PasswordInput/ConfirmPassword.js +1 -1
- package/PasswordInput/Password.js +2 -2
- package/PhoneNumberInput/index.js +2 -2
- package/README.md +140 -0
- package/TabGroup/index.js +10 -5
- package/TablePagination/Actions.d.ts +3 -0
- package/TablePagination/Actions.js +27 -0
- package/TablePagination/index.d.ts +4 -0
- package/TablePagination/index.js +30 -0
- package/TablePagination/types.d.ts +14 -0
- package/TablePagination/types.js +1 -0
- package/TablePagination/useInteractions.d.ts +14 -0
- package/TablePagination/useInteractions.js +23 -0
- package/TextInput/index.js +13 -3
- package/ToastPrompt/Presentation.js +3 -3
- package/ToastPrompt/index.js +1 -1
- package/VideoPlayerModal/index.d.ts +0 -1
- package/VideoPlayerModal/index.js +2 -2
- package/index.d.ts +10 -0
- package/index.js +10 -0
- package/package.json +8 -2
@@ -36,6 +36,6 @@ function ConfirmPassword(props) {
|
|
36
36
|
}, [value, password]);
|
37
37
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ error: !isMatched, label: label, value: value, variant: variant, margin: margin, disabled: disabled, type: "password", size: "small", helperText: !isMatched && helperText, onChange: function (event) {
|
38
38
|
onChange(event.target.value);
|
39
|
-
}, fullWidth: true, required: true }, rest)
|
39
|
+
}, fullWidth: true, required: true }, rest)) })));
|
40
40
|
}
|
41
41
|
export default ConfirmPassword;
|
@@ -67,10 +67,10 @@ function Password(props) {
|
|
67
67
|
return (_jsx(_Fragment, { children: Object.keys(strategies).map(function (key) {
|
68
68
|
var label = strategies[key].label;
|
69
69
|
return (_jsx(Typography, __assign({ component: "li", variant: "caption", style: { color: helperTextColor[key] } }, { children: label }), key));
|
70
|
-
}) }
|
70
|
+
}) }));
|
71
71
|
}, [helperTextColor, strategies]);
|
72
72
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ error: !isValidPassword || error, helperText: helperText, type: "password", label: "Password", size: "small", margin: "dense", value: value, onChange: function (event) {
|
73
73
|
onChange(event.target.value);
|
74
|
-
}, fullWidth: true, required: true }, rest)
|
74
|
+
}, fullWidth: true, required: true }, rest)) })));
|
75
75
|
}
|
76
76
|
export default Password;
|
@@ -55,8 +55,8 @@ function PhoneInput(props) {
|
|
55
55
|
format: phoneFormat
|
56
56
|
});
|
57
57
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ value: rifm.value, InputProps: {
|
58
|
-
startAdornment: (_jsx(InputAdornment, __assign({ position: "start" }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "+1" })
|
58
|
+
startAdornment: (_jsx(InputAdornment, __assign({ position: "start" }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "+1" })) }))),
|
59
59
|
endAdornment: endAdornment
|
60
|
-
}, onChange: rifm.onChange }, rest)
|
60
|
+
}, onChange: rifm.onChange }, rest)) })));
|
61
61
|
}
|
62
62
|
export default PhoneInput;
|
package/README.md
CHANGED
@@ -12,7 +12,11 @@
|
|
12
12
|
- [License](#license)
|
13
13
|
- [Components](#components)
|
14
14
|
- [AlertDialog](#alertdialog)
|
15
|
+
- [Autocomplete](#autocomplete)
|
16
|
+
- [AutocompleteWithFilter](#autocompletewithfilter)
|
15
17
|
- [BasicModal](#basicmodal)
|
18
|
+
- [BreadCrumbs](#breadcrumbs)
|
19
|
+
- [Copyright](#copyright)
|
16
20
|
- [DigitInput](#digitinput)
|
17
21
|
- [FormRadioGroup](#formradiogroup)
|
18
22
|
- [FormSelector](#formselector)
|
@@ -50,6 +54,17 @@ This project is licensed under the terms of the [MIT license](https://github.com
|
|
50
54
|
|
51
55
|
|
52
56
|
|
57
|
+
<h2>Common Properties</h2>
|
58
|
+
|
59
|
+
All components include these 2 properties to customize the theme
|
60
|
+
|
61
|
+
| Name | Type | Default | Required | Description |
|
62
|
+
| -------------- | ---------------------- | ------- | -------- | ----------------------------- |
|
63
|
+
| primaryColor | CSSProperties["color"] | | false | Primary color for the theme |
|
64
|
+
| secondaryColor | CSSProperties["color"] | | false | Secondary color for the theme |
|
65
|
+
|
66
|
+
|
67
|
+
|
53
68
|
<h2>Components</h2>
|
54
69
|
|
55
70
|
<h3>AlertDialog</h3>
|
@@ -77,6 +92,71 @@ import AlertDialog from '@symply.io/basic-components/AlertDialog';
|
|
77
92
|
|
78
93
|
|
79
94
|
|
95
|
+
<h3>Autocomplete</h3>
|
96
|
+
|
97
|
+
A normal text input enhanced by a panel of suggested options.
|
98
|
+
|
99
|
+
It is extended from `@mui/material/TextField`, so it includes all properties of `@mui/material/TextField`.
|
100
|
+
|
101
|
+
<h5>Import</h5>
|
102
|
+
|
103
|
+
```typescript
|
104
|
+
import { Autocomplete } from '@symply.io/basic-components/';
|
105
|
+
// or
|
106
|
+
import Autocomplete from '@symply.io/basic-components/Autocomplete';
|
107
|
+
```
|
108
|
+
|
109
|
+
<h5>Option Props (IOption)</h5>
|
110
|
+
|
111
|
+
| Name | Type | Default | Required | Description |
|
112
|
+
| ------ | ------- | ------- | -------- | -------------------------- |
|
113
|
+
| label | string | | true | Option label. |
|
114
|
+
| [name] | Unknown | | false | Customized option property |
|
115
|
+
|
116
|
+
<h5>Props</h5>
|
117
|
+
|
118
|
+
| Name | Type | Default | Required | Description |
|
119
|
+
| -------- | ---------------------- | ------- | -------- | ------------------------------------------------------------ |
|
120
|
+
| multiple | bool | false | false | If `true`, `value` must be an array and the menu will support multiple selections. |
|
121
|
+
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: Array<IOption|string>|IOption|string|null) => void`<br/>*value:* The value of the `Input` element. |
|
122
|
+
| options | Array<IOption\|string> | | true | Array of suggestion options. |
|
123
|
+
| value | string | | true | The value of the `Input` element. |
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
<h3>AutocompleteWithFilter</h3>
|
128
|
+
|
129
|
+
A normal text input enhanced by a panel of suggested options and filter.
|
130
|
+
|
131
|
+
It is extended from `@mui/material/TextField`, so it includes all properties of `@mui/material/TextField`.
|
132
|
+
|
133
|
+
<h5>Import</h5>
|
134
|
+
|
135
|
+
```typescript
|
136
|
+
import { AutocompleteWithFilter } from '@symply.io/basic-components/';
|
137
|
+
// or
|
138
|
+
import AutocompleteWithFilter from '@symply.io/basic-components/AutocompleteWithFilter';
|
139
|
+
```
|
140
|
+
|
141
|
+
<h5>Option Props (IOption)</h5>
|
142
|
+
|
143
|
+
| Name | Type | Default | Required | Description |
|
144
|
+
| ------ | ------- | ------- | -------- | -------------------------- |
|
145
|
+
| label | string | | true | Option label. |
|
146
|
+
| [name] | Unknown | | false | Customized option property |
|
147
|
+
|
148
|
+
<h5>Props</h5>
|
149
|
+
|
150
|
+
| Name | Type | Default | Required | Description |
|
151
|
+
| -------------------- | ---------------------- | ------- | -------- | ------------------------------------------------------------ |
|
152
|
+
| disableCloseOnSelect | bool | false | false | If `true`, the popup won't close when a value is selected. |
|
153
|
+
| multiple | bool | false | false | If `true`, `value` must be an array and the menu will support multiple selections. |
|
154
|
+
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: Array<IOption|string>|IOption|string|null) => void`<br/>*value:* The value of the `Input` element. |
|
155
|
+
| options | Array<IOption\|string> | | true | Array of suggestion options. |
|
156
|
+
| value | string | | true | The value of the `Input` element. |
|
157
|
+
|
158
|
+
|
159
|
+
|
80
160
|
<h3>BasicModal</h3>
|
81
161
|
|
82
162
|
Reusable modal component.
|
@@ -111,6 +191,40 @@ import BasicModal from '@symply.io/basic-components/BasicModal';
|
|
111
191
|
|
112
192
|
|
113
193
|
|
194
|
+
<h3>BreadCrumbs</h3>
|
195
|
+
|
196
|
+
A list of links that help a user visualize a page's location within the hierarchical structure of a website, and allow navigation up to any of its "ancestors".
|
197
|
+
|
198
|
+
<h5>Import</h5>
|
199
|
+
|
200
|
+
```typescript
|
201
|
+
import { BreadCrumbs } from '@symply.io/basic-components/';
|
202
|
+
// or
|
203
|
+
import BreadCrumbs from '@symply.io/basic-components/BreadCrumbs';
|
204
|
+
```
|
205
|
+
|
206
|
+
<h5>Props</h5>
|
207
|
+
|
208
|
+
| Name | Type | Default | Required | Description |
|
209
|
+
| ------ | --------------------------------------- | ------- | -------- | ------------------------- |
|
210
|
+
| routes | Array<{ href?: string; label: string }> | | true | All routes of "ancestors" |
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
<h3>Copyright</h3>
|
215
|
+
|
216
|
+
A common component for rendering the copyright
|
217
|
+
|
218
|
+
<h5>Import</h5>
|
219
|
+
|
220
|
+
```typescript
|
221
|
+
import { Copyright } from '@symply.io/basic-components/';
|
222
|
+
// or
|
223
|
+
import Copyright from '@symply.io/basic-components/Copyright';
|
224
|
+
```
|
225
|
+
|
226
|
+
|
227
|
+
|
114
228
|
<h3>DigitInput</h3>
|
115
229
|
|
116
230
|
Input component for digits.
|
@@ -415,6 +529,32 @@ import TabGroup from '@symply.io/basic-components/TabGroup';
|
|
415
529
|
|
416
530
|
|
417
531
|
|
532
|
+
<h3>TablePagination</h3>
|
533
|
+
|
534
|
+
Reusable pagination component for the material table
|
535
|
+
|
536
|
+
<h5>Import</h5>
|
537
|
+
|
538
|
+
```typescript
|
539
|
+
import { TablePagination } from '@symply.io/basic-components/';
|
540
|
+
// or
|
541
|
+
import TablePagination from '@symply.io/basic-components/TablePagination';
|
542
|
+
```
|
543
|
+
|
544
|
+
<h5>Props</h5>
|
545
|
+
|
546
|
+
| Name | Type | Default | Required | Description |
|
547
|
+
| ------------------- | --------------- | ------- | -------- | ------------------------------------------------------------ |
|
548
|
+
| colSpan | number | | true | The number of columns a cell should span. |
|
549
|
+
| count | number | | true | The total count of all data. |
|
550
|
+
| onPageChange | func | | true | Callback fired when the `page` value is changed.<br />**Signature:**<br/>`function(event: MouseEvent<HTMLButtonElement> ) => void,value: number`<br/>*value:* The value of the `page` . |
|
551
|
+
| onRowsPerPageChange | func | | true | Callback fired when the `Select` value is changed.<br />**Signature:**<br/>`function(event: ChangeEvent<HTMLInputElement ` |
|
552
|
+
| page | number | | true | The current page index. |
|
553
|
+
| rowsPerPage | number | | true | How many rows per page. |
|
554
|
+
| rowsPerPageOptions | Array\<number\> | | true | The options for setting how many rows per page. |
|
555
|
+
|
556
|
+
|
557
|
+
|
418
558
|
<h3>TextInput</h3>
|
419
559
|
|
420
560
|
Regular Input component.
|
package/TabGroup/index.js
CHANGED
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
10
10
|
return __assign.apply(this, arguments);
|
11
11
|
};
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
13
|
-
import { useState, forwardRef, useImperativeHandle } from "react";
|
13
|
+
import { useState, useEffect, forwardRef, useImperativeHandle } from "react";
|
14
14
|
import Tab from "@mui/material/Tab";
|
15
15
|
import Tabs from "@mui/material/Tabs";
|
16
16
|
import Typography from "@mui/material/Typography";
|
@@ -18,30 +18,35 @@ import useMediaQuery from "@mui/material/useMediaQuery";
|
|
18
18
|
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
19
19
|
import useCustomTheme from "../useCustomTheme";
|
20
20
|
var TabGroup = forwardRef(function (props, ref) {
|
21
|
-
var tabs = props.tabs, _a = props.textColor, textColor = _a === void 0 ? "primary" : _a, _b = props.variant, variant = _b === void 0 ? "scrollable" : _b, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onTabChange = props.onTabChange,
|
21
|
+
var tabs = props.tabs, _a = props.textColor, textColor = _a === void 0 ? "primary" : _a, _b = props.variant, variant = _b === void 0 ? "scrollable" : _b, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onTabChange = props.onTabChange, outerTabIndex = props.currentTabIndex;
|
22
22
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
23
23
|
var mobileViewport = useMediaQuery(theme.breakpoints.down("md"));
|
24
|
-
var
|
24
|
+
var _c = useState(outerTabIndex || 0), currentTabIndex = _c[0], setCurrentTabIndex = _c[1];
|
25
25
|
var onClick = function (index) {
|
26
26
|
setCurrentTabIndex(index);
|
27
27
|
};
|
28
28
|
useImperativeHandle(ref, function () { return ({
|
29
29
|
tabIndex: currentTabIndex
|
30
30
|
}); });
|
31
|
+
useEffect(function () {
|
32
|
+
if (outerTabIndex !== undefined && outerTabIndex !== currentTabIndex) {
|
33
|
+
setCurrentTabIndex(outerTabIndex);
|
34
|
+
}
|
35
|
+
}, [outerTabIndex, currentTabIndex]);
|
31
36
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tabs, __assign({ value: currentTabIndex, TabIndicatorProps: { hidden: true }, variant: mobileViewport ? "scrollable" : variant, textColor: textColor, onChange: function (_, val) {
|
32
37
|
onClick(val);
|
33
38
|
onTabChange(val);
|
34
39
|
} }, { children: tabs.map(function (tab, index) {
|
35
40
|
var text = tab.text, _a = tab.disabled, disabled = _a === void 0 ? false : _a;
|
36
41
|
var active = currentTabIndex === index;
|
37
|
-
return (_jsx(Tab, { disableFocusRipple: true, disableRipple: true, label: _jsx(Typography, __assign({ variant: "body2" }, { children: text })
|
42
|
+
return (_jsx(Tab, { disableFocusRipple: true, disableRipple: true, label: _jsx(Typography, __assign({ variant: "body2" }, { children: text })), disabled: disabled, sx: {
|
38
43
|
cursor: disabled ? "not-allowed" : "pointer",
|
39
44
|
margin: theme.spacing(0.75, 0.25),
|
40
45
|
background: active ? "#fff" : undefined,
|
41
46
|
borderRadius: active ? theme.spacing(0.5) : undefined,
|
42
47
|
boxShadow: active ? "0px 4px 6px #acc1c2" : undefined
|
43
48
|
} }, index));
|
44
|
-
}) })
|
49
|
+
}) })) })));
|
45
50
|
});
|
46
51
|
export default TabGroup;
|
47
52
|
export * from "./types";
|
@@ -0,0 +1,27 @@
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
2
|
+
__assign = Object.assign || function(t) {
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
+
s = arguments[i];
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
+
t[p] = s[p];
|
7
|
+
}
|
8
|
+
return t;
|
9
|
+
};
|
10
|
+
return __assign.apply(this, arguments);
|
11
|
+
};
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
13
|
+
import Box from "@mui/material/Box";
|
14
|
+
import IconButton from "@mui/material/IconButton";
|
15
|
+
import FirstPageIcon from "@mui/icons-material/FirstPage";
|
16
|
+
import KeyboardArrowLeft from "@mui/icons-material/KeyboardArrowLeft";
|
17
|
+
import KeyboardArrowRight from "@mui/icons-material/KeyboardArrowRight";
|
18
|
+
import LastPageIcon from "@mui/icons-material/LastPage";
|
19
|
+
import useInteractions from "./useInteractions";
|
20
|
+
import useCustomTheme from "../useCustomTheme";
|
21
|
+
function TablePaginationActions(props) {
|
22
|
+
var count = props.count, page = props.page, rowsPerPage = props.rowsPerPage, onPageChange = props.onPageChange;
|
23
|
+
var theme = useCustomTheme();
|
24
|
+
var _a = useInteractions({ count: count, page: page, rowsPerPage: rowsPerPage, onPageChange: onPageChange }), onBackButtonClick = _a.onBackButtonClick, onNextButtonClick = _a.onNextButtonClick, onLastPageButtonClick = _a.onLastPageButtonClick, onFirstPageButtonClick = _a.onFirstPageButtonClick;
|
25
|
+
return (_jsxs(Box, __assign({ sx: { flexShrink: 0, ml: 2.5 } }, { children: [_jsx(IconButton, __assign({ onClick: onFirstPageButtonClick, disabled: page === 0, "aria-label": "first page" }, { children: theme.direction === "rtl" ? _jsx(LastPageIcon, {}) : _jsx(FirstPageIcon, {}) })), _jsx(IconButton, __assign({ onClick: onBackButtonClick, disabled: page === 0, "aria-label": "previous page" }, { children: theme.direction === "rtl" ? (_jsx(KeyboardArrowRight, {})) : (_jsx(KeyboardArrowLeft, {})) })), _jsx(IconButton, __assign({ onClick: onNextButtonClick, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "next page" }, { children: theme.direction === "rtl" ? (_jsx(KeyboardArrowLeft, {})) : (_jsx(KeyboardArrowRight, {})) })), _jsx(IconButton, __assign({ onClick: onLastPageButtonClick, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "last page" }, { children: theme.direction === "rtl" ? _jsx(FirstPageIcon, {}) : _jsx(LastPageIcon, {}) }))] })));
|
26
|
+
}
|
27
|
+
export default TablePaginationActions;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
2
|
+
__assign = Object.assign || function(t) {
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
+
s = arguments[i];
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
+
t[p] = s[p];
|
7
|
+
}
|
8
|
+
return t;
|
9
|
+
};
|
10
|
+
return __assign.apply(this, arguments);
|
11
|
+
};
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
13
|
+
import TableRow from "@mui/material/TableRow";
|
14
|
+
import TableFooter from "@mui/material/TableFooter";
|
15
|
+
import TablePagination from "@mui/material/TablePagination";
|
16
|
+
import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
17
|
+
import TablePaginationActions from "./Actions";
|
18
|
+
import useCustomTheme from "../useCustomTheme";
|
19
|
+
function Pagination(props) {
|
20
|
+
var colSpan = props.colSpan, count = props.count, page = props.page, rowsPerPage = props.rowsPerPage, _a = props.rowsPerPageOptions, rowsPerPageOptions = _a === void 0 ? [5, 10, 20, 30] : _a, onPageChange = props.onPageChange, onRowsPerPageChange = props.onRowsPerPageChange, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor;
|
21
|
+
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
22
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: count && (_jsx(TableFooter, { children: _jsx(TableRow, { children: _jsx(TablePagination, { colSpan: colSpan, count: count, rowsPerPage: rowsPerPage, page: page, SelectProps: {
|
23
|
+
inputProps: {
|
24
|
+
"aria-label": "rows per page",
|
25
|
+
},
|
26
|
+
native: true,
|
27
|
+
}, rowsPerPageOptions: rowsPerPageOptions, onPageChange: onPageChange, onRowsPerPageChange: onRowsPerPageChange, ActionsComponent: TablePaginationActions }) }) })) })));
|
28
|
+
}
|
29
|
+
export default Pagination;
|
30
|
+
export * from "./types";
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { MouseEvent, ChangeEvent, CSSProperties } from "react";
|
2
|
+
export interface TablePaginationActionsProps {
|
3
|
+
count: number;
|
4
|
+
page: number;
|
5
|
+
rowsPerPage: number;
|
6
|
+
onPageChange: (event: MouseEvent<HTMLButtonElement> | null, newPage: number) => void;
|
7
|
+
}
|
8
|
+
export interface TablePaginationProps extends TablePaginationActionsProps {
|
9
|
+
colSpan: number;
|
10
|
+
rowsPerPageOptions?: Array<number>;
|
11
|
+
onRowsPerPageChange: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
12
|
+
primaryColor?: CSSProperties["color"];
|
13
|
+
secondaryColor?: CSSProperties["color"];
|
14
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { MouseEvent } from "react";
|
2
|
+
interface InteractionProps {
|
3
|
+
count: number;
|
4
|
+
page: number;
|
5
|
+
rowsPerPage: number;
|
6
|
+
onPageChange: (event: MouseEvent<HTMLButtonElement> | null, newPage: number) => void;
|
7
|
+
}
|
8
|
+
declare function useInteractions(props: InteractionProps): {
|
9
|
+
onBackButtonClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
10
|
+
onNextButtonClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
11
|
+
onLastPageButtonClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
12
|
+
onFirstPageButtonClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
13
|
+
};
|
14
|
+
export default useInteractions;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { useCallback } from "react";
|
2
|
+
function useInteractions(props) {
|
3
|
+
var count = props.count, page = props.page, rowsPerPage = props.rowsPerPage, onPageChange = props.onPageChange;
|
4
|
+
var onFirstPageButtonClick = useCallback(function (event) {
|
5
|
+
onPageChange(event, 0);
|
6
|
+
}, [onPageChange]);
|
7
|
+
var onBackButtonClick = useCallback(function (event) {
|
8
|
+
onPageChange(event, page - 1);
|
9
|
+
}, [onPageChange, page]);
|
10
|
+
var onNextButtonClick = useCallback(function (event) {
|
11
|
+
onPageChange(event, page + 1);
|
12
|
+
}, [onPageChange, page]);
|
13
|
+
var onLastPageButtonClick = useCallback(function (event) {
|
14
|
+
onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
|
15
|
+
}, [count, onPageChange, rowsPerPage]);
|
16
|
+
return {
|
17
|
+
onBackButtonClick: onBackButtonClick,
|
18
|
+
onNextButtonClick: onNextButtonClick,
|
19
|
+
onLastPageButtonClick: onLastPageButtonClick,
|
20
|
+
onFirstPageButtonClick: onFirstPageButtonClick,
|
21
|
+
};
|
22
|
+
}
|
23
|
+
export default useInteractions;
|
package/TextInput/index.js
CHANGED
@@ -27,12 +27,22 @@ import ThemeProvider from "@mui/material/styles/ThemeProvider";
|
|
27
27
|
import useInteractions from "./useInteractions";
|
28
28
|
import useCustomTheme from "../useCustomTheme";
|
29
29
|
var TextInput = function (props) {
|
30
|
-
var _a = props.type, type = _a === void 0 ? "text" : _a, onChange = props.onChange, value = props.value, _b = props.size, size = _b === void 0 ? "small" : _b, tooltip = props.tooltip, _c = props.maxLength, maxLength = _c === void 0 ? 999 : _c, _d = props.minLength, minLength = _d === void 0 ? 0 : _d, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["type", "onChange", "value", "size", "tooltip", "maxLength", "minLength", "primaryColor", "secondaryColor"]);
|
30
|
+
var _a = props.type, type = _a === void 0 ? "text" : _a, onChange = props.onChange, value = props.value, _b = props.size, size = _b === void 0 ? "small" : _b, tooltip = props.tooltip, _c = props.maxLength, maxLength = _c === void 0 ? 999 : _c, _d = props.minLength, minLength = _d === void 0 ? 0 : _d, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onBlur = props.onBlur, onFocus = props.onFocus, rest = __rest(props, ["type", "onChange", "value", "size", "tooltip", "maxLength", "minLength", "primaryColor", "secondaryColor", "onBlur", "onFocus"]);
|
31
31
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
32
32
|
var _e = useInteractions(), tooltipOpen = _e.tooltipOpen, onOpenTooltip = _e.onOpenTooltip, onCloseTooltip = _e.onCloseTooltip;
|
33
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tooltip, __assign({ title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsx(Field, __assign({ size: size, margin: "dense", type: type, value: value, onFocus:
|
33
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tooltip, __assign({ title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsx(Field, __assign({ size: size, margin: "dense", type: type, value: value, onFocus: function (event) {
|
34
|
+
onOpenTooltip();
|
35
|
+
if (onFocus) {
|
36
|
+
onFocus(event);
|
37
|
+
}
|
38
|
+
}, onBlur: function (event) {
|
39
|
+
onCloseTooltip();
|
40
|
+
if (onBlur) {
|
41
|
+
onBlur(event);
|
42
|
+
}
|
43
|
+
}, onChange: function (event) {
|
34
44
|
event.preventDefault();
|
35
45
|
onChange(event.target.value);
|
36
|
-
}, inputProps: { maxLength: maxLength, minLength: minLength } }, rest)
|
46
|
+
}, inputProps: { maxLength: maxLength, minLength: minLength } }, rest)) })) })));
|
37
47
|
};
|
38
48
|
export default TextInput;
|
@@ -34,7 +34,7 @@ import { green, amber, red, blue } from "@mui/material/colors";
|
|
34
34
|
import useCustomTheme from "../useCustomTheme";
|
35
35
|
var ToastPrompt = function (props) {
|
36
36
|
var _a;
|
37
|
-
var _b = props.open, open = _b === void 0 ? false : _b, _c = props.vertical, vertical = _c === void 0 ? "top" : _c, _d = props.horizontal, horizontal = _d === void 0 ? "center" : _d, _e = props.timeout, timeout = _e === void 0 ? 3000 : _e, onClose = props.onClose, _f = props.transitionDirection, transitionDirection = _f === void 0 ? "down" : _f, _g = props.message, message = _g === void 0 ? "Unknown message" : _g, _h = props.icon, icon = _h === void 0 ? _jsx(_Fragment, {}
|
37
|
+
var _b = props.open, open = _b === void 0 ? false : _b, _c = props.vertical, vertical = _c === void 0 ? "top" : _c, _d = props.horizontal, horizontal = _d === void 0 ? "center" : _d, _e = props.timeout, timeout = _e === void 0 ? 3000 : _e, onClose = props.onClose, _f = props.transitionDirection, transitionDirection = _f === void 0 ? "down" : _f, _g = props.message, message = _g === void 0 ? "Unknown message" : _g, _h = props.icon, icon = _h === void 0 ? _jsx(_Fragment, {}) : _h, _j = props.variant, variant = _j === void 0 ? "info" : _j, other = __rest(props, ["open", "vertical", "horizontal", "timeout", "onClose", "transitionDirection", "message", "icon", "variant"]);
|
38
38
|
var theme = useCustomTheme();
|
39
39
|
var styles = {
|
40
40
|
success: {
|
@@ -51,7 +51,7 @@ var ToastPrompt = function (props) {
|
|
51
51
|
}
|
52
52
|
};
|
53
53
|
var Transition = function (args) {
|
54
|
-
return _jsx(Slide, __assign({}, args, { direction: transitionDirection })
|
54
|
+
return _jsx(Slide, __assign({}, args, { direction: transitionDirection }));
|
55
55
|
};
|
56
56
|
var VariantIcon = {
|
57
57
|
success: SuccessIcon,
|
@@ -76,6 +76,6 @@ var ToastPrompt = function (props) {
|
|
76
76
|
fontSize: 20,
|
77
77
|
opacity: 0.9,
|
78
78
|
marginRight: theme.spacing(1)
|
79
|
-
} }
|
79
|
+
} })) : (_jsx(_Fragment, { children: icon })), message] })) }, other)) }), "".concat(Date.now() * Math.round(Math.random()))) })));
|
80
80
|
};
|
81
81
|
export default ToastPrompt;
|
package/ToastPrompt/index.js
CHANGED
@@ -22,7 +22,7 @@ export var PromptProvider = function (props) {
|
|
22
22
|
var _a = ((toastRef === null || toastRef === void 0 ? void 0 : toastRef.current) || {}).show, show = _a === void 0 ? function () { } : _a;
|
23
23
|
show(type, message, timeout);
|
24
24
|
}
|
25
|
-
return (_jsx(PromptContext.Provider, __assign({ value: { showPrompt: showPrompt } }, { children: _jsxs(_Fragment, { children: [children, _jsx(Logics, __assign({ ref: toastRef }, { children: _jsx(ToastPrompt, {}
|
25
|
+
return (_jsx(PromptContext.Provider, __assign({ value: { showPrompt: showPrompt } }, { children: _jsxs(_Fragment, { children: [children, _jsx(Logics, __assign({ ref: toastRef }, { children: _jsx(ToastPrompt, {}) }))] }) })));
|
26
26
|
};
|
27
27
|
export function usePrompt() {
|
28
28
|
return useContext(PromptContext);
|
@@ -35,9 +35,9 @@ function VideoPlayerModal(props) {
|
|
35
35
|
var url = props.url, _a = props.pip, pip = _a === void 0 ? false : _a, _b = props.open, open = _b === void 0 ? false : _b, title = props.title, onClose = props.onClose, _c = props.extraButtons, extraButtons = _c === void 0 ? [] : _c, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, playerProps = __rest(props, ["url", "pip", "open", "title", "onClose", "extraButtons", "primaryColor", "secondaryColor"]);
|
36
36
|
var theme = useCustomTheme();
|
37
37
|
var fullScreen = useMediaQuery(theme.breakpoints.down("sm"));
|
38
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(Dialog, __assign({ open: open, fullScreen: fullScreen, onClose: onClose, fullWidth: true, maxWidth: "lg", "aria-labelledby": "react-video-dialog" }, { children: [title && _jsx(DialogTitle, { children: title }
|
38
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsxs(Dialog, __assign({ open: open, fullScreen: fullScreen, onClose: onClose, fullWidth: true, maxWidth: "lg", "aria-labelledby": "react-video-dialog" }, { children: [title && _jsx(DialogTitle, { children: title }), _jsx(DialogContent, { children: _jsx(ReactPlayer, __assign({ controls: true, url: url, style: { minHeight: "480px" }, width: "100%", config: {
|
39
39
|
file: { attributes: { disablePictureInPicture: !pip } }
|
40
|
-
} }, playerProps)
|
40
|
+
} }, playerProps)) }), _jsxs(DialogActions, { children: [extraButtons.map(function (buttonProps, index) { return (_jsx(Grid, __assign({ item: true, xs: 12, md: 3, lg: 2 }, { children: _jsx(Button, __assign({}, buttonProps)) }), "extraButton_".concat(index))); }), _jsx(Button, __assign({ variant: "outlined", color: "secondary", onClick: onClose }, { children: "Close" }))] })] })) })));
|
41
41
|
}
|
42
42
|
export default VideoPlayerModal;
|
43
43
|
export * from "./types";
|
package/index.d.ts
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
export * from "./AlertDialog";
|
2
|
+
export * from "./Autocomplete";
|
3
|
+
export * from "./AutocompleteWithFilter";
|
2
4
|
export * from "./BasicModal";
|
5
|
+
export * from "./BreadCrumbs";
|
6
|
+
export * from "./Copyright";
|
3
7
|
export * from "./DigitInput";
|
4
8
|
export * from "./DynamicHeaderBar";
|
5
9
|
export * from "./FormRadioGroup";
|
@@ -11,11 +15,16 @@ export * from "./NumberInput";
|
|
11
15
|
export * from "./PasswordInput";
|
12
16
|
export * from "./PhoneNumberInput";
|
13
17
|
export * from "./TabGroup";
|
18
|
+
export * from "./TablePagination";
|
14
19
|
export * from "./TextInput";
|
15
20
|
export * from "./ToastPrompt";
|
16
21
|
export * from "./VideoPlayerModal";
|
17
22
|
export { default as AlertDialog } from "./AlertDialog";
|
23
|
+
export { default as Autocomplete } from "./Autocomplete";
|
24
|
+
export { default as AutocompleteWithFilter } from "./AutocompleteWithFilter";
|
18
25
|
export { default as BasicModal } from "./BasicModal";
|
26
|
+
export { default as BreadCrumbs } from "./BreadCrumbs";
|
27
|
+
export { default as Copyright } from "./Copyright";
|
19
28
|
export { default as DigitInput } from "./DigitInput";
|
20
29
|
export { default as DynamicHeaderBar } from "./DynamicHeaderBar";
|
21
30
|
export { default as FormRadioGroup } from "./FormRadioGroup";
|
@@ -25,5 +34,6 @@ export { default as MenuButtonGroup } from "./MenuButtonGroup";
|
|
25
34
|
export { default as NumberInput } from "./NumberInput";
|
26
35
|
export { default as PhoneNumberInput } from "./PhoneNumberInput";
|
27
36
|
export { default as TabGroup } from "./TabGroup";
|
37
|
+
export { default as TablePagination } from "./TablePagination";
|
28
38
|
export { default as TextInput } from "./TextInput";
|
29
39
|
export { default as VideoPlayerModal } from "./VideoPlayerModal";
|
package/index.js
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
export * from "./AlertDialog";
|
2
|
+
export * from "./Autocomplete";
|
3
|
+
export * from "./AutocompleteWithFilter";
|
2
4
|
export * from "./BasicModal";
|
5
|
+
export * from "./BreadCrumbs";
|
6
|
+
export * from "./Copyright";
|
3
7
|
export * from "./DigitInput";
|
4
8
|
export * from "./DynamicHeaderBar";
|
5
9
|
export * from "./FormRadioGroup";
|
@@ -11,11 +15,16 @@ export * from "./NumberInput";
|
|
11
15
|
export * from "./PasswordInput";
|
12
16
|
export * from "./PhoneNumberInput";
|
13
17
|
export * from "./TabGroup";
|
18
|
+
export * from "./TablePagination";
|
14
19
|
export * from "./TextInput";
|
15
20
|
export * from "./ToastPrompt";
|
16
21
|
export * from "./VideoPlayerModal";
|
17
22
|
export { default as AlertDialog } from "./AlertDialog";
|
23
|
+
export { default as Autocomplete } from "./Autocomplete";
|
24
|
+
export { default as AutocompleteWithFilter } from "./AutocompleteWithFilter";
|
18
25
|
export { default as BasicModal } from "./BasicModal";
|
26
|
+
export { default as BreadCrumbs } from "./BreadCrumbs";
|
27
|
+
export { default as Copyright } from "./Copyright";
|
19
28
|
export { default as DigitInput } from "./DigitInput";
|
20
29
|
export { default as DynamicHeaderBar } from "./DynamicHeaderBar";
|
21
30
|
export { default as FormRadioGroup } from "./FormRadioGroup";
|
@@ -25,5 +34,6 @@ export { default as MenuButtonGroup } from "./MenuButtonGroup";
|
|
25
34
|
export { default as NumberInput } from "./NumberInput";
|
26
35
|
export { default as PhoneNumberInput } from "./PhoneNumberInput";
|
27
36
|
export { default as TabGroup } from "./TabGroup";
|
37
|
+
export { default as TablePagination } from "./TablePagination";
|
28
38
|
export { default as TextInput } from "./TextInput";
|
29
39
|
export { default as VideoPlayerModal } from "./VideoPlayerModal";
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@symply.io/basic-components",
|
3
|
-
"version": "1.0.0-alpha.
|
3
|
+
"version": "1.0.0-alpha.16",
|
4
4
|
"description": "Basic and reusable components for all frontend of Symply apps",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -44,10 +44,11 @@
|
|
44
44
|
],
|
45
45
|
"devDependencies": {
|
46
46
|
"@types/body-parser": "^1.19.2",
|
47
|
+
"@types/reach__router": "^1.3.10",
|
47
48
|
"@types/react": "^17.0.27",
|
48
49
|
"@types/react-dom": "^17.0.9",
|
49
50
|
"babel-loader": "^8.2.2",
|
50
|
-
"typescript": "
|
51
|
+
"typescript": "~4.6.3"
|
51
52
|
},
|
52
53
|
"dependencies": {
|
53
54
|
"@emotion/react": "^11.7.1",
|
@@ -55,10 +56,15 @@
|
|
55
56
|
"@mui/icons-material": "^5.4.2",
|
56
57
|
"@mui/material": "^5.4.2",
|
57
58
|
"@mui/system": "^5.4.2",
|
59
|
+
"@reach/router": "^1.3.4",
|
58
60
|
"color-alpha": "^1.1.3",
|
59
61
|
"react-player": "^2.9.0",
|
60
62
|
"rifm": "^0.12.1"
|
61
63
|
},
|
64
|
+
"resolutions": {
|
65
|
+
"@types/react": "17.0.27",
|
66
|
+
"@types/react-dom": "17.0.9"
|
67
|
+
},
|
62
68
|
"scripts": {
|
63
69
|
"build": "./node_modules/.bin/tsc"
|
64
70
|
},
|