@symply.io/basic-components 1.0.0-alpha.1
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/.gitignore +15 -0
- package/AlertDialog/index.d.ts +5 -0
- package/AlertDialog/index.js +47 -0
- package/AlertDialog/types.d.ts +11 -0
- package/AlertDialog/types.js +1 -0
- package/BasicModal/Content.d.ts +4 -0
- package/BasicModal/Content.js +37 -0
- package/BasicModal/index.d.ts +5 -0
- package/BasicModal/index.js +54 -0
- package/BasicModal/types.d.ts +22 -0
- package/BasicModal/types.js +1 -0
- package/DigitInput/index.d.ts +7 -0
- package/DigitInput/index.js +35 -0
- package/DigitInput/types.d.ts +9 -0
- package/DigitInput/types.js +1 -0
- package/DigitInput/useInteractions.d.ts +11 -0
- package/DigitInput/useInteractions.js +24 -0
- package/DynamicHeaderBar/HeaderBar.d.ts +13 -0
- package/DynamicHeaderBar/HeaderBar.js +31 -0
- package/DynamicHeaderBar/HeaderButtons.d.ts +7 -0
- package/DynamicHeaderBar/HeaderButtons.js +43 -0
- package/DynamicHeaderBar/HeaderLine.d.ts +6 -0
- package/DynamicHeaderBar/HeaderLine.js +12 -0
- package/DynamicHeaderBar/index.d.ts +21 -0
- package/DynamicHeaderBar/index.js +57 -0
- package/DynamicHeaderBar/types.d.ts +33 -0
- package/DynamicHeaderBar/types.js +6 -0
- package/FormRadioGroup/index.d.ts +5 -0
- package/FormRadioGroup/index.js +35 -0
- package/FormRadioGroup/types.d.ts +16 -0
- package/FormRadioGroup/types.js +1 -0
- package/FormSelector/MultipleSelector.d.ts +4 -0
- package/FormSelector/MultipleSelector.js +34 -0
- package/FormSelector/SimpleSelector.d.ts +4 -0
- package/FormSelector/SimpleSelector.js +34 -0
- package/FormSelector/index.d.ts +3 -0
- package/FormSelector/index.js +3 -0
- package/FormSelector/types.d.ts +27 -0
- package/FormSelector/types.js +1 -0
- package/FormSelector/useInteractions.d.ts +6 -0
- package/FormSelector/useInteractions.js +12 -0
- package/HelpCaption/index.d.ts +10 -0
- package/HelpCaption/index.js +34 -0
- package/HelpCaption/useInteractions.d.ts +6 -0
- package/HelpCaption/useInteractions.js +12 -0
- package/LICENSE +21 -0
- package/LoadingModal/index.d.ts +5 -0
- package/LoadingModal/index.js +27 -0
- package/LoadingModal/types.d.ts +8 -0
- package/LoadingModal/types.js +1 -0
- package/MenuButtonGroup/MenuItem.d.ts +12 -0
- package/MenuButtonGroup/MenuItem.js +21 -0
- package/MenuButtonGroup/index.d.ts +13 -0
- package/MenuButtonGroup/index.js +100 -0
- package/NumberInput/index.d.ts +13 -0
- package/NumberInput/index.js +38 -0
- package/NumberInput/useInteractions.d.ts +17 -0
- package/NumberInput/useInteractions.js +54 -0
- package/PasswordInput/ConfirmPassword.d.ts +10 -0
- package/PasswordInput/ConfirmPassword.js +38 -0
- package/PasswordInput/Password.d.ts +18 -0
- package/PasswordInput/Password.js +68 -0
- package/PasswordInput/index.d.ts +4 -0
- package/PasswordInput/index.js +4 -0
- package/PhoneNumberInput/index.d.ts +11 -0
- package/PhoneNumberInput/index.js +44 -0
- package/PhoneNumberInput/useInteractions.d.ts +9 -0
- package/PhoneNumberInput/useInteractions.js +30 -0
- package/README.md +499 -0
- package/TabGroup/index.d.ts +5 -0
- package/TabGroup/index.js +46 -0
- package/TabGroup/types.d.ts +11 -0
- package/TabGroup/types.js +1 -0
- package/TextInput/index.d.ts +12 -0
- package/TextInput/index.js +35 -0
- package/TextInput/useInteractions.d.ts +6 -0
- package/TextInput/useInteractions.js +12 -0
- package/ToastPrompt/Logics.d.ts +12 -0
- package/ToastPrompt/Logics.js +37 -0
- package/ToastPrompt/Presentation.d.ts +16 -0
- package/ToastPrompt/Presentation.js +80 -0
- package/ToastPrompt/index.d.ts +13 -0
- package/ToastPrompt/index.js +29 -0
- package/VideoPlayerModal/index.d.ts +6 -0
- package/VideoPlayerModal/index.js +42 -0
- package/VideoPlayerModal/types.d.ts +8 -0
- package/VideoPlayerModal/types.js +1 -0
- package/index.d.ts +29 -0
- package/index.js +29 -0
- package/package.json +74 -0
package/README.md
ADDED
@@ -0,0 +1,499 @@
|
|
1
|
+
<h1 align="center">Symply Basic Components</h1>
|
2
|
+
|
3
|
+
<p align="center">Basic and reusable components for all frontend of Symply apps.</p>
|
4
|
+
|
5
|
+
<p align="center">Built with <a href="https://mui.com/">Material UI v5</a>.</p>
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+
<h2>Quick Guide</h2>
|
10
|
+
|
11
|
+
- [Installation](#installation)
|
12
|
+
- [License](#license)
|
13
|
+
- [Components](#components)
|
14
|
+
- [AlertDialog](#alertdialog)
|
15
|
+
- [BasicModal](#basicmodal)
|
16
|
+
- [DigitInput](#digitinput)
|
17
|
+
- [FormRadioGroup](#formradiogroup)
|
18
|
+
- [FormSelector](#formselector)
|
19
|
+
- [HelpCaption](#helpcaption)
|
20
|
+
- [LoadingModal](#loadingmodal)
|
21
|
+
- [MenuButtonGroup](#menubuttongroup)
|
22
|
+
- [NumberInput](#numberinput)
|
23
|
+
- [PasswordInput](#passwordinput)
|
24
|
+
- [PhoneNumberInput](#phonenumberinput)
|
25
|
+
- [TabGroup](#tabgroup)
|
26
|
+
- [ToastPrompt](#toastprompt)
|
27
|
+
- [VideoPlayerModal](#videoplayermodal)
|
28
|
+
- [Changelog](#changelog)
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
<h2>Installation</h2>
|
33
|
+
|
34
|
+
`symply-basic-components` is available as an [npm package](https://www.npmjs.com/package/@symply.io/symply-basic-components).
|
35
|
+
|
36
|
+
```bash
|
37
|
+
// with npm
|
38
|
+
npm install @symply.io/symply-basic-components
|
39
|
+
|
40
|
+
// with yarn
|
41
|
+
yarn add @symply.io/symply-basic-components
|
42
|
+
```
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
<h2>License</h2>
|
47
|
+
|
48
|
+
This project is licensed under the terms of the [MIT license](https://github.com/rinxun/symply-basic-components/blob/main/LICENSE).
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
<h2>Components</h2>
|
53
|
+
|
54
|
+
<h3>AlertDialog</h3>
|
55
|
+
|
56
|
+
Diglog component for alerts or confirmations.
|
57
|
+
|
58
|
+
<h5>Import</h5>
|
59
|
+
|
60
|
+
```typescript
|
61
|
+
import { AlertDialog } from '@symply.io/symply-basic-components';
|
62
|
+
// or
|
63
|
+
import AlertDialog from '@symply.io/symply-basic-components/AlertDialog';
|
64
|
+
```
|
65
|
+
|
66
|
+
<h5>Props</h5>
|
67
|
+
|
68
|
+
| Name | Type | Default | Required | Description |
|
69
|
+
| ------------- | --------------------------------------------- | ------- | -------- | ------------------------------------------------------------ |
|
70
|
+
| children | node | | true | Dialog content. |
|
71
|
+
| DialogButtons | element | | false | Customized dialog action buttons. |
|
72
|
+
| maxWidth | 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| false | 'md' | false | Determine the max-width of the dialog. The dialog width grows with the size of the screen. Set to `false` to disable `maxWidth`. |
|
73
|
+
| onClose | func | | true | Callback fired when the component requests to be closed.<br />**Signature:**<br/>`function() => void` |
|
74
|
+
| open | bool | false | true | If `true`, the component is shown. |
|
75
|
+
| title | string | 'Info' | false | Dialog title |
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<h3>BasicModal</h3>
|
80
|
+
|
81
|
+
Reusable modal component.
|
82
|
+
|
83
|
+
<h5>Import</h5>
|
84
|
+
|
85
|
+
```typescript
|
86
|
+
import { BasicModal } from '@symply.io/symply-basic-components';
|
87
|
+
// or
|
88
|
+
import BasicModal from '@symply.io/symply-basic-components/BasicModal';
|
89
|
+
```
|
90
|
+
|
91
|
+
<h5>Props</h5>
|
92
|
+
|
93
|
+
| Name | Type | Default | Required | Description |
|
94
|
+
| ----------------------- | ------------------------------------------------------------ | --------- | -------- | ------------------------------------------------------------ |
|
95
|
+
| cancelText | string | 'Cancel' | false | The text of the cancel button. |
|
96
|
+
| children | node | | true | The content of the component. |
|
97
|
+
| color | 'primary' \| 'secondary' \| 'success' \| 'error' \| 'info' \| 'warning' \| undefined | 'primary' | false | The main color of the component. |
|
98
|
+
| desc | string | | false | Some descriptions you want to add, similar to a subtitle. |
|
99
|
+
| disabled | bool | false | false | If `true`, the submit button would be disabled. |
|
100
|
+
| hideBottomButtons | bool | false | false | If `true`, hide all action buttons at the bottom of the modal. |
|
101
|
+
| loading | bool | false | false | If `true`, the submit and cancel buttons would be disabled. |
|
102
|
+
| maxWidth | 'xs' \|'sm' \|'md' \|'lg' \|'xl' | 'sm' | false | Determine the max-width of the dialog. The dialog width grows with the size of the screen. Set to `false` to disable `maxWidth`. |
|
103
|
+
| noForm | bool | false | False | If `true`, put the content and action buttons out of a form element. |
|
104
|
+
| onClose | func | | true | Callback fired when the cancel button requests to be clicked.<br />**Signature:**<br/>`function() => void` |
|
105
|
+
| onSubmit | func | | true | Callback fired when the submit button requests to be clicked.<br />**Signature:**<br/>`function() => void` |
|
106
|
+
| open | bool | false | true | If `true`, the component is shown. |
|
107
|
+
| showTopRightCloseButton | bool | false | false | If `true`, show a close icon button at the top right of the modal. |
|
108
|
+
| submitText | string | ‘Save’ | false | The text of the submit button. |
|
109
|
+
| title | string | | true | The title of the component, to show at the top left. |
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
<h3>DigitInput</h3>
|
114
|
+
|
115
|
+
Input component for digits.
|
116
|
+
|
117
|
+
It is extended from `@mui/material/TextField`, so it includes all properties of `@mui/material/TextField`.
|
118
|
+
|
119
|
+
<h5>Import</h5>
|
120
|
+
|
121
|
+
```typescript
|
122
|
+
import { DigitInput } from '@symply.io/symply-basic-components';
|
123
|
+
// or
|
124
|
+
import DigitInput from '@symply.io/symply-basic-components/DigitInput';
|
125
|
+
```
|
126
|
+
|
127
|
+
<h5>Props</h5>
|
128
|
+
|
129
|
+
| Name | Type | Default | Required | Description |
|
130
|
+
| ------------ | ------ | ------- | -------- | ------------------------------------------------------------ |
|
131
|
+
| endAdornment | node | | false | An end adornment element for the `Input` element. |
|
132
|
+
| maxLength | number | 999 | false | The max length of the `Input` element you can type in. |
|
133
|
+
| minLength | number | 0 | false | The min length of the `Input` element you should type in. |
|
134
|
+
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
135
|
+
| value | string | | true | The value of the `Input` element. |
|
136
|
+
| tooltip | string | | false | A tooltip for the `Input` element. |
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
<h3>FormRadioGroup</h3>
|
141
|
+
|
142
|
+
Radio Group allow the user to select one option from a set.
|
143
|
+
|
144
|
+
<h5>Import</h5>
|
145
|
+
|
146
|
+
```typescript
|
147
|
+
import { FormRadioGroup } from '@symply.io/symply-basic-components';
|
148
|
+
// or
|
149
|
+
import FormRadioGroup from '@symply.io/symply-basic-components/FormRadioGroup';
|
150
|
+
```
|
151
|
+
|
152
|
+
<h5>Radio Option Props</h5>
|
153
|
+
|
154
|
+
| Name | Type | Default | Required | Description |
|
155
|
+
| -------- | ------------------------ | ------- | -------- | ---------------------------------------- |
|
156
|
+
| disabled | bool | false | false | If `true`, the opiton would be disabled. |
|
157
|
+
| label | string | | true | The label of the option. |
|
158
|
+
| value | string \| number \| bool | | true | The value of the option. |
|
159
|
+
|
160
|
+
<h5>Props</h5>
|
161
|
+
|
162
|
+
| Name | Type | Default | Required | Description |
|
163
|
+
| --------- | ------------------------------------------------------------ | --------- | -------- | ------------------------------------------------------------ |
|
164
|
+
| color | 'primary' \| 'secondary' \| 'success' \| 'error' \| 'info' \| 'warning' | 'primary' | false | The main color of the component. |
|
165
|
+
| disabled | bool | false | false | If `true`, the component is disabled. |
|
166
|
+
| formLabel | string | | false | The label of the `Radio` element. |
|
167
|
+
| onChange | func | | true | Callback fired when the `Radio` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Radio` element. |
|
168
|
+
| options | Array\<IRadioOption\> | | true | The radio options. See the **Radio Option Props** above. |
|
169
|
+
| value | string \| number \| bool | | true | The value of the `Radio` element. |
|
170
|
+
| tooltip | string | | false | A tooltip for the `Radio` element. |
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
<h3>FormSelector</h3>
|
175
|
+
|
176
|
+
Selector components are used for collecting user provided information from a list of options.
|
177
|
+
|
178
|
+
<h5>Import</h5>
|
179
|
+
|
180
|
+
```typescript
|
181
|
+
// Simple Selector
|
182
|
+
import { SimpleSelector } from '@symply.io/symply-basic-components/FormSelector';
|
183
|
+
// Multiple Selector
|
184
|
+
import { MultipleSelector } from '@symply.io/symply-basic-components/FormRadioGroup';
|
185
|
+
```
|
186
|
+
|
187
|
+
<h5>Selector Option Props</h5>
|
188
|
+
|
189
|
+
| Name | Type | Default | Required | Description |
|
190
|
+
| -------- | ------------------------ | ------- | -------- | ---------------------------------------- |
|
191
|
+
| disabled | bool | false | false | If `true`, the opiton would be disabled. |
|
192
|
+
| label | string | | true | The label of the option. |
|
193
|
+
| value | string \| number \| bool | | true | The value of the option. |
|
194
|
+
|
195
|
+
<h5>Base Props</h5>
|
196
|
+
|
197
|
+
| Name | Type | Default | Required | Description |
|
198
|
+
| -------------- | ------------------------------------- | ---------- | -------- | ----------------------------------------------------------- |
|
199
|
+
| disabled | bool | false | false | If `true`, the component is disabled. |
|
200
|
+
| error | bool | false | false | If `true`, the component would be shown with red color. |
|
201
|
+
| helperText | string | | false | The helper text of the `Select` element. |
|
202
|
+
| label | string | | false | The label of `Select` element. |
|
203
|
+
| multiple | bool | false | false | If `true`, you can select more than 1 option. |
|
204
|
+
| name | string | | false | The name of the `Select` element. |
|
205
|
+
| options | Array\<IRadioOption\> | | true | The radio options. See the **Selector Option Props** above. |
|
206
|
+
| showHelperText | bool | false | False | If `true`, show the helper text. |
|
207
|
+
| tooltip | string | | false | A tooltip for the `Select` element. |
|
208
|
+
| variant | 'filled' \| 'contained' \| 'outlined' | 'outlined' | false | The variant of the `Select` element. |
|
209
|
+
|
210
|
+
<h5>Simple Selector Props</h5> Extended from the Base Props
|
211
|
+
|
212
|
+
| Name | Type | Default | Required | Description |
|
213
|
+
| -------- | ---------------- | ------- | -------- | ------------------------------------------------------------ |
|
214
|
+
| onChange | func | | true | Callback fired when the `Select` value is changed.<br />**Signature:**<br/>`function(value: string | number) => void`<br/>*value:* The value of the `Select` element. |
|
215
|
+
| value | number \| string | | True | The value of the `Select` element. |
|
216
|
+
|
217
|
+
<h5>Multiple Selector Props</h5> Extended from the Base Props
|
218
|
+
|
219
|
+
| Name | Type | Default | Required | Description |
|
220
|
+
| -------- | ---------------------------------- | ------- | -------- | ------------------------------------------------------------ |
|
221
|
+
| onChange | func | | true | Callback fired when the `Select` value is changed.<br />**Signature:**<br/>`function(value: Array<number> | Array<string>) => void`<br/>*value:* The value of the `Select` element. |
|
222
|
+
| value | Array\<number\> \| Array\<string\> | | | The value of the `Select` element. |
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
<h3>HelpCaption</h3>
|
227
|
+
|
228
|
+
You can use it to add a hint/help paragraph.
|
229
|
+
|
230
|
+
<h5>Import</h5>
|
231
|
+
|
232
|
+
```typescript
|
233
|
+
import { HelpCaption } from '@symply.io/symply-basic-components';
|
234
|
+
// or
|
235
|
+
import HelpCaption from '@symply.io/symply-basic-components/HelpCaption';
|
236
|
+
```
|
237
|
+
|
238
|
+
<h5>Props</h5>
|
239
|
+
|
240
|
+
| Name | Type | Default | Required | Description |
|
241
|
+
| ----------- | -------------------- | --------- | -------- | ------------------------------------------------------------ |
|
242
|
+
| linkText | string | | false | The text of the help link. |
|
243
|
+
| linkType | 'WEBPAGE' \| 'VIDEO' | 'WEBPAGE' | false | The type of the help link. |
|
244
|
+
| linkUrl | string | | false | The url of the help link. If `undefined` then the help link would not be shown. |
|
245
|
+
| mainCaption | string | | true | The primary text of the caption. |
|
246
|
+
| subCaption | string | | false | The secondary text of the caption. |
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
<h3>LoadingModal</h3>
|
251
|
+
|
252
|
+
A modal for loading.
|
253
|
+
|
254
|
+
<h5>Import</h5>
|
255
|
+
|
256
|
+
```typescript
|
257
|
+
import { LoadingModal } from '@symply.io/symply-basic-components';
|
258
|
+
// or
|
259
|
+
import LoadingModal from '@symply.io/symply-basic-components/LoadingModal';
|
260
|
+
```
|
261
|
+
|
262
|
+
<h5>Props</h5>
|
263
|
+
|
264
|
+
| Name | Type | Default | Required | Description |
|
265
|
+
| ----------- | ------------------------------------------------------------ | ------------ | -------- | ------------------------------------------------------------ |
|
266
|
+
| direction | 'column' \| 'column-reverse' \| 'column' \| 'column-reverse' | 'column' | false | Defines the `flex-direction` style property. It is applied for all screen sizes. |
|
267
|
+
| open | bool | false | true | If `true`, the component is shown. |
|
268
|
+
| percent | number | 0 | false | The percent value of the progress. |
|
269
|
+
| text | string | 'Loading...' | false | The prompt text of the component. |
|
270
|
+
| showProgess | boolean | false | false | If `true`, the percent of the progress is shown. |
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
<h3>MenuButtonGroup</h3>
|
275
|
+
|
276
|
+
A button with menu options.
|
277
|
+
|
278
|
+
<h5>Import</h5>
|
279
|
+
|
280
|
+
```typescript
|
281
|
+
import { MenuButtonGroup } from '@symply.io/symply-basic-components';
|
282
|
+
// or
|
283
|
+
import MenuButtonGroup from '@symply.io/symply-basic-components/MenuButtonGroup';
|
284
|
+
```
|
285
|
+
|
286
|
+
<h5>Menu Button Props</h5>
|
287
|
+
|
288
|
+
| Name | Type | Default | Required | Description |
|
289
|
+
| ---------- | ------ | ------- | -------- | ------------------------------------------------------------ |
|
290
|
+
| buttonIcon | node | | false | A start adornment of the button |
|
291
|
+
| buttonText | string | | true | The text of the menu button |
|
292
|
+
| disabled | bool | | | |
|
293
|
+
| onClick | func | | true | Callback fired when the menu button click.<br />**Signature:**<br/>`function(event: MouseEvent) => void` |
|
294
|
+
|
295
|
+
|
296
|
+
<h5>Props</h5>
|
297
|
+
|
298
|
+
| Name | Type | Default | Required | Description |
|
299
|
+
| ---------- | ------------------------------------------------------------ | ---------- | -------- | -------------------------------------------------- |
|
300
|
+
| color | 'primary' \|'secondary' \|'success' \|'error' \|'info' \|'warning' | 'primary' | false | The main color of the component. |
|
301
|
+
| buttonText | string | | true | The text of the main button. |
|
302
|
+
| size | 'small' \| 'medium' \| 'large' | | false | The size of the main button. |
|
303
|
+
| disabled | bool | | false | If `true`, the button is disabled. |
|
304
|
+
| variant | 'text' \|'contained' \|'outlined' | 'outlined' | false | The variant of the main button. |
|
305
|
+
| buttons | Array\<ButtonItemProps\> | | true | Menu buttons. See the **Menu Button Props** above. |
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
<h3>NumberInput</h3>
|
310
|
+
|
311
|
+
Input component for Number.
|
312
|
+
|
313
|
+
It is extended from `@mui/material/TextField`, so it includes all properties of `@mui/material/TextField`.
|
314
|
+
|
315
|
+
<h5>Import</h5>
|
316
|
+
|
317
|
+
```typescript
|
318
|
+
import { NumberInput } from '@symply.io/symply-basic-components';
|
319
|
+
// or
|
320
|
+
import NumberInput from '@symply.io/symply-basic-components/NumberInput';
|
321
|
+
```
|
322
|
+
|
323
|
+
<h5>Props</h5>
|
324
|
+
|
325
|
+
| Name | Type | Default | Required | Description |
|
326
|
+
| ----------- | ------ | ----------- | -------- | ------------------------------------------------------------ |
|
327
|
+
| integerOnly | bool | | false | If `true`, not allow to type a decimal value. |
|
328
|
+
| maxValue | number | 2^53 − 1 | false | The max value of the `Input` element you can type in. |
|
329
|
+
| minValue | Number | −(2^53 − 1) | false | The min value of the `Input` element you should type in. |
|
330
|
+
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
331
|
+
| tooltip | string | | false | A tooltip for the `Input` element. |
|
332
|
+
| value | string | | true | The value of the `Input` element. |
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
<h3>PasswordInput</h3>
|
337
|
+
|
338
|
+
Input component for Password and Confirm Password.
|
339
|
+
|
340
|
+
It is extended from `@mui/material/TextField`, so it includes all properties of `@mui/material/TextField`.
|
341
|
+
|
342
|
+
<h5>Import</h5>
|
343
|
+
|
344
|
+
```typescript
|
345
|
+
// Password
|
346
|
+
import { Password } from '@symply.io/symply-basic-components/PasswordInput';
|
347
|
+
// Confirm Password
|
348
|
+
import { ConfirmPassword } from '@symply.io/symply-basic-components/PasswordInput';
|
349
|
+
```
|
350
|
+
|
351
|
+
<h5>Password Props</h5>
|
352
|
+
|
353
|
+
| Name | Type | Default | Required | Description |
|
354
|
+
| ------------ | -------------------------------------------------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ |
|
355
|
+
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
356
|
+
| onVerify | func | | false | Customized verify function when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
357
|
+
| strategies | { [key: string]: { label: string, regex: RegExp }} | {<br />uppercaseLetter: { label: "1 Uppercase Letter", regex: /[A-Z]+/ },<br />lowercaseLetter: { label: "1 Lowercase Letter", regex: /[a-z]+/ },<br />specialCharacter: { label: "1 Special Character", regex: /[!"#$%&'()*+,-./:;<=>?@[\]^_`{}~]/ },<br />number: { label: "1 Number", regex: /\d+/ },<br />minimum8: { label: "Minimum 8 characters", regex: /.{8,}/ }<br />} | false | The strategies of the password |
|
358
|
+
| successColor | Color | 'green' | false | The color of component when success. |
|
359
|
+
| value | string | | true | The password value. |
|
360
|
+
|
361
|
+
<h5>Confirm Password Props</h5>
|
362
|
+
|
363
|
+
| Name | Type | Default | Required | Description |
|
364
|
+
| -------- | ------ | ------- | -------- | ------------------------------------------------------------ |
|
365
|
+
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
366
|
+
| password | string | | true | The password value |
|
367
|
+
| value | string | | true | The confirm password value. |
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
<h3>PhoneNumberInput</h3>
|
372
|
+
|
373
|
+
Input component for US phone number.
|
374
|
+
|
375
|
+
It is extended from `@mui/material/TextField`, so it includes all properties of `@mui/material/TextField`.
|
376
|
+
|
377
|
+
<h5>Import</h5>
|
378
|
+
|
379
|
+
```typescript
|
380
|
+
import { PhoneNumberInput } from '@symply.io/symply-basic-components';
|
381
|
+
// or
|
382
|
+
import PhoneNumberInput from '@symply.io/symply-basic-components/PhoneNumberInput';
|
383
|
+
```
|
384
|
+
|
385
|
+
<h5>Props</h5>
|
386
|
+
|
387
|
+
| Name | Type | Default | Required | Description |
|
388
|
+
| ------------ | ------ | ------- | -------- | ------------------------------------------------------------ |
|
389
|
+
| endAdornment | node | | false | An end adornment element for the `Input` element. |
|
390
|
+
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
391
|
+
| value | string | | true | The value of the `Input` element. |
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
<h3>TabGroup</h3>
|
396
|
+
|
397
|
+
Tabs group.
|
398
|
+
|
399
|
+
<h5>Import</h5>
|
400
|
+
|
401
|
+
```typescript
|
402
|
+
import { TabGroup } from '@symply.io/symply-basic-components';
|
403
|
+
// or
|
404
|
+
import TabGroup from '@symply.io/symply-basic-components/TabGroup';
|
405
|
+
```
|
406
|
+
|
407
|
+
<h5>Props</h5>
|
408
|
+
|
409
|
+
| Name | Type | Default | Required | Description |
|
410
|
+
| --------------- | --------------------------------------------- | ------------ | -------- | ------------------------------------------------------------ |
|
411
|
+
| currentTabIndex | number | 0 | false | the tab index from the higher component |
|
412
|
+
| onTabChange | func | | true | Callback fired when the `Tab` is changed.<br />**Signature:**<br/>`function(index: number) => void`<br/>*index:* The selected index of the `Tab` element. |
|
413
|
+
| tabs | Array\<{ text: string; disabled?: boolean }\> | | true | All tab items. |
|
414
|
+
| textColor | 'primary' \| 'secondary' | 'primary' | false | The color of the tab text. |
|
415
|
+
| variant | 'standard' \| 'scrollable' \| 'fullWidth' | 'scrollable' | false | Determines additional display behavior of the tabs |
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
<h3>TextInput</h3>
|
420
|
+
|
421
|
+
Regular Input component.
|
422
|
+
|
423
|
+
It is extended from `@mui/material/TextField`, so it includes all properties of `@mui/material/TextField`.
|
424
|
+
|
425
|
+
<h5>Import</h5>
|
426
|
+
|
427
|
+
```typescript
|
428
|
+
import { TextInput } from '@symply.io/symply-basic-components';
|
429
|
+
// or
|
430
|
+
import TextInput from '@symply.io/symply-basic-components/TextInput';
|
431
|
+
```
|
432
|
+
|
433
|
+
<h5>Props</h5>
|
434
|
+
|
435
|
+
| Name | Type | Default | Required | Description |
|
436
|
+
| --------- | ------ | ------- | -------- | ------------------------------------------------------------ |
|
437
|
+
| maxLength | number | 999 | false | The max length of the `Input` element you can type in. |
|
438
|
+
| minLength | number | 0 | false | The min length of the `Input` element you should type in. |
|
439
|
+
| onChange | func | | true | Callback fired when the `Input` value is changed.<br />**Signature:**<br/>`function(value: string) => void`<br/>*value:* The value of the `Input` element. |
|
440
|
+
| tooltip | string | | false | A tooltip for the `Input` element. |
|
441
|
+
| value | string | | true | The value of the `Input` element. |
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
<h3>ToastPrompt</h3>
|
446
|
+
|
447
|
+
Global prompt component.
|
448
|
+
|
449
|
+
<h5>Import</h5>
|
450
|
+
|
451
|
+
```typescript
|
452
|
+
import { usePrompt } from '@symply.io/symply-basic-components';
|
453
|
+
```
|
454
|
+
|
455
|
+
<h5>Usage</h5>
|
456
|
+
```typescript
|
457
|
+
const { showPrompt } = usePrompt();
|
458
|
+
```
|
459
|
+
|
460
|
+
<h5>Props</h5>
|
461
|
+
|
462
|
+
| Name | Type | Default | Required | Description |
|
463
|
+
| ------- | ------------------------------------------- | ------- | -------- | ------------------------------------------------------------ |
|
464
|
+
| message | string \| 400 | | true | The prompt message you want to show. |
|
465
|
+
| timeout | number | 3500 | false | The number of milliseconds to wait before automatically calling the `onClose` function. |
|
466
|
+
| type | 'success' \| 'warning' \| 'info' \| 'error' | | true | The type of prompt. |
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
<h3>VideoPlayerModal</h3>
|
471
|
+
|
472
|
+
A modal for playing videos.
|
473
|
+
|
474
|
+
<h5>Import</h5>
|
475
|
+
|
476
|
+
```typescript
|
477
|
+
import { VideoPlayerModal } from '@symply.io/symply-basic-components';
|
478
|
+
// or
|
479
|
+
import VideoPlayerModal from '@symply.io/symply-basic-components/VideoPlayerModal';
|
480
|
+
```
|
481
|
+
|
482
|
+
<h5>Props</h5>
|
483
|
+
|
484
|
+
| Name | Type | Default | Required | Description |
|
485
|
+
| ------------ | -------------------- | ------- | -------- | ------------------------------------------------------------ |
|
486
|
+
| extraButtons | Array\<ButtonProps\> | | false | Extra buttons next to the Close button at the bottom. |
|
487
|
+
| onClose | func | | true | Callback fired when the cancel button requests to be clicked.<br />**Signature:**<br/>`function() => void` |
|
488
|
+
| open | bool | | true | If `true`, the component is shown. |
|
489
|
+
| pip | bool | | false | If `true`, the video can be played in picture |
|
490
|
+
| title | string | | false | Modal title, it would be shown at the top left. |
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
<h2>Changelog</h2>
|
497
|
+
|
498
|
+
If you have recently updated, please read the [changelog](https://github.com/rinxun/symply-basic-components/releases) for details of what has changed.
|
499
|
+
|
@@ -0,0 +1,46 @@
|
|
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 { useState, forwardRef, useImperativeHandle } from "react";
|
14
|
+
import Tab from "@mui/material/Tab";
|
15
|
+
import Tabs from "@mui/material/Tabs";
|
16
|
+
import Typography from "@mui/material/Typography";
|
17
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
18
|
+
import useTheme from "@mui/material/styles/useTheme";
|
19
|
+
var TabGroup = forwardRef(function (props, ref) {
|
20
|
+
var theme = useTheme();
|
21
|
+
var mobileViewport = useMediaQuery(theme.breakpoints.down("md"));
|
22
|
+
var tabs = props.tabs, _a = props.textColor, textColor = _a === void 0 ? "primary" : _a, _b = props.variant, variant = _b === void 0 ? "scrollable" : _b, onTabChange = props.onTabChange, _c = props.currentTabIndex, outerTabIndex = _c === void 0 ? 0 : _c;
|
23
|
+
var _d = useState(outerTabIndex), currentTabIndex = _d[0], setCurrentTabIndex = _d[1];
|
24
|
+
var onClick = function (index) {
|
25
|
+
setCurrentTabIndex(index);
|
26
|
+
};
|
27
|
+
useImperativeHandle(ref, function () { return ({
|
28
|
+
tabIndex: currentTabIndex,
|
29
|
+
}); });
|
30
|
+
return (_jsx(Tabs, __assign({ value: currentTabIndex, TabIndicatorProps: { hidden: true }, variant: mobileViewport ? "scrollable" : variant, textColor: textColor, onChange: function (_, val) {
|
31
|
+
onClick(val);
|
32
|
+
onTabChange(val);
|
33
|
+
} }, { children: tabs.map(function (tab, index) {
|
34
|
+
var text = tab.text, _a = tab.disabled, disabled = _a === void 0 ? false : _a;
|
35
|
+
var active = currentTabIndex === index;
|
36
|
+
return (_jsx(Tab, { disableFocusRipple: true, disableRipple: true, label: _jsx(Typography, __assign({ variant: "body2" }, { children: text }), void 0), disabled: disabled, sx: {
|
37
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
38
|
+
margin: theme.spacing(0.75, 0.25),
|
39
|
+
background: active ? "#fff" : undefined,
|
40
|
+
borderRadius: active ? theme.spacing(0.5) : undefined,
|
41
|
+
boxShadow: active ? "0px 4px 6px #acc1c2" : undefined,
|
42
|
+
} }, index));
|
43
|
+
}) }), void 0));
|
44
|
+
});
|
45
|
+
export default TabGroup;
|
46
|
+
export * from "./types";
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { TabsProps } from "@mui/material/Tabs";
|
2
|
+
export interface TabGroupProps {
|
3
|
+
textColor?: TabsProps["textColor"];
|
4
|
+
tabs: Array<{
|
5
|
+
text: string;
|
6
|
+
disabled?: boolean;
|
7
|
+
}>;
|
8
|
+
variant?: TabsProps["variant"];
|
9
|
+
currentTabIndex?: number;
|
10
|
+
onTabChange: (index: number) => void;
|
11
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { TextFieldProps } from "@mui/material/TextField";
|
3
|
+
declare type TextProps = Omit<TextFieldProps, "onChange">;
|
4
|
+
export interface TextInputProps {
|
5
|
+
onChange: (value: string) => void;
|
6
|
+
value: string;
|
7
|
+
tooltip?: TextFieldProps;
|
8
|
+
maxLength?: number;
|
9
|
+
minLength?: number;
|
10
|
+
}
|
11
|
+
declare const TextInput: (props: TextInputProps & TextProps) => JSX.Element;
|
12
|
+
export default TextInput;
|
@@ -0,0 +1,35 @@
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
+
var t = {};
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
+
t[p] = s[p];
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
+
t[p[i]] = s[p[i]];
|
20
|
+
}
|
21
|
+
return t;
|
22
|
+
};
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
24
|
+
import Tooltip from "@mui/material/Tooltip";
|
25
|
+
import Field from "@mui/material/TextField";
|
26
|
+
import useInteractions from "./useInteractions";
|
27
|
+
var TextInput = function (props) {
|
28
|
+
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, rest = __rest(props, ["type", "onChange", "value", "size", "tooltip", "maxLength", "minLength"]);
|
29
|
+
var _e = useInteractions(), tooltipOpen = _e.tooltipOpen, onOpenTooltip = _e.onOpenTooltip, onCloseTooltip = _e.onCloseTooltip;
|
30
|
+
return (_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: onOpenTooltip, onBlur: onCloseTooltip, onChange: function (event) {
|
31
|
+
event.preventDefault();
|
32
|
+
onChange(event.target.value);
|
33
|
+
}, inputProps: { maxLength: maxLength, minLength: minLength } }, rest), void 0) }), void 0));
|
34
|
+
};
|
35
|
+
export default TextInput;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { useState, useCallback } from 'react';
|
2
|
+
function useInteractions() {
|
3
|
+
var _a = useState(false), tooltipOpen = _a[0], setTooltipOpen = _a[1];
|
4
|
+
var onOpenTooltip = useCallback(function () {
|
5
|
+
setTooltipOpen(true);
|
6
|
+
}, []);
|
7
|
+
var onCloseTooltip = useCallback(function () {
|
8
|
+
setTooltipOpen(false);
|
9
|
+
}, []);
|
10
|
+
return { tooltipOpen: tooltipOpen, onOpenTooltip: onOpenTooltip, onCloseTooltip: onCloseTooltip };
|
11
|
+
}
|
12
|
+
export default useInteractions;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
interface LogicsProps {
|
3
|
+
children: React.ReactNode | undefined;
|
4
|
+
}
|
5
|
+
export interface PromptPropsType {
|
6
|
+
open: boolean;
|
7
|
+
message: string | number;
|
8
|
+
variant: "success" | "warning" | "error" | "info" | undefined;
|
9
|
+
timeout: number;
|
10
|
+
}
|
11
|
+
declare const Logics: import("react").ForwardRefExoticComponent<LogicsProps & import("react").RefAttributes<unknown>>;
|
12
|
+
export default Logics;
|