@symply.io/basic-components 1.0.0-alpha.2 → 1.0.0-alpha.20

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.
Files changed (99) hide show
  1. package/AlertDialog/index.d.ts +0 -1
  2. package/AlertDialog/index.js +10 -9
  3. package/AlertDialog/types.d.ts +3 -1
  4. package/Autocomplete/index.d.ts +4 -0
  5. package/Autocomplete/index.js +38 -0
  6. package/Autocomplete/types.d.ts +15 -0
  7. package/Autocomplete/types.js +1 -0
  8. package/Autocomplete/useInteractions.d.ts +5 -0
  9. package/Autocomplete/useInteractions.js +9 -0
  10. package/AutocompleteWithFilter/index.d.ts +4 -0
  11. package/AutocompleteWithFilter/index.js +54 -0
  12. package/AutocompleteWithFilter/types.d.ts +16 -0
  13. package/AutocompleteWithFilter/types.js +1 -0
  14. package/BasicModal/Content.d.ts +0 -1
  15. package/BasicModal/Content.js +1 -1
  16. package/BasicModal/index.d.ts +0 -1
  17. package/BasicModal/index.js +16 -18
  18. package/BasicModal/types.d.ts +3 -1
  19. package/BreadCrumbs/index.d.ts +4 -0
  20. package/BreadCrumbs/index.js +37 -0
  21. package/BreadCrumbs/types.d.ts +9 -0
  22. package/BreadCrumbs/types.js +1 -0
  23. package/CheckBox/CheckBox.d.ts +3 -0
  24. package/CheckBox/CheckBox.js +36 -0
  25. package/CheckBox/CheckBoxGroup.d.ts +3 -0
  26. package/CheckBox/CheckBoxGroup.js +30 -0
  27. package/CheckBox/index.d.ts +3 -0
  28. package/CheckBox/index.js +3 -0
  29. package/CheckBox/types.d.ts +12 -0
  30. package/CheckBox/types.js +1 -0
  31. package/Copyright/index.d.ts +4 -0
  32. package/Copyright/index.js +25 -0
  33. package/Copyright/types.d.ts +5 -0
  34. package/Copyright/types.js +1 -0
  35. package/DigitInput/index.d.ts +1 -4
  36. package/DigitInput/index.js +7 -4
  37. package/DigitInput/types.d.ts +5 -1
  38. package/DynamicHeaderBar/HeaderBar.d.ts +2 -0
  39. package/DynamicHeaderBar/HeaderBar.js +7 -6
  40. package/DynamicHeaderBar/HeaderButtons.d.ts +0 -1
  41. package/DynamicHeaderBar/HeaderButtons.js +20 -19
  42. package/DynamicHeaderBar/HeaderLine.js +4 -4
  43. package/DynamicHeaderBar/index.js +2 -2
  44. package/FeinInput/index.d.ts +6 -0
  45. package/FeinInput/index.js +73 -0
  46. package/FeinInput/types.d.ts +9 -0
  47. package/FeinInput/types.js +1 -0
  48. package/FeinInput/useInteractions.d.ts +8 -0
  49. package/FeinInput/useInteractions.js +16 -0
  50. package/FormRadioGroup/index.d.ts +0 -1
  51. package/FormRadioGroup/index.js +15 -12
  52. package/FormRadioGroup/types.d.ts +3 -0
  53. package/FormSelector/MultipleSelector.d.ts +0 -1
  54. package/FormSelector/MultipleSelector.js +25 -11
  55. package/FormSelector/SimpleSelector.d.ts +0 -1
  56. package/FormSelector/SimpleSelector.js +25 -11
  57. package/FormSelector/types.d.ts +7 -8
  58. package/HelpCaption/index.d.ts +3 -1
  59. package/HelpCaption/index.js +15 -14
  60. package/LoadingModal/index.d.ts +0 -1
  61. package/LoadingModal/index.js +8 -5
  62. package/LoadingModal/types.d.ts +3 -0
  63. package/MenuButtonGroup/MenuItem.d.ts +1 -3
  64. package/MenuButtonGroup/MenuItem.js +5 -3
  65. package/MenuButtonGroup/index.d.ts +3 -1
  66. package/MenuButtonGroup/index.js +9 -6
  67. package/NumberInput/index.d.ts +5 -4
  68. package/NumberInput/index.js +8 -5
  69. package/PasswordInput/ConfirmPassword.d.ts +5 -4
  70. package/PasswordInput/ConfirmPassword.js +10 -7
  71. package/PasswordInput/Password.d.ts +5 -4
  72. package/PasswordInput/Password.js +18 -10
  73. package/PhoneNumberInput/index.d.ts +6 -4
  74. package/PhoneNumberInput/index.js +25 -7
  75. package/PhoneNumberInput/useInteractions.d.ts +0 -1
  76. package/PhoneNumberInput/useInteractions.js +1 -14
  77. package/README.md +261 -45
  78. package/TabGroup/index.js +26 -20
  79. package/TabGroup/types.d.ts +3 -0
  80. package/TablePagination/Actions.d.ts +3 -0
  81. package/TablePagination/Actions.js +27 -0
  82. package/TablePagination/index.d.ts +4 -0
  83. package/TablePagination/index.js +30 -0
  84. package/TablePagination/types.d.ts +14 -0
  85. package/TablePagination/types.js +1 -0
  86. package/TablePagination/useInteractions.d.ts +14 -0
  87. package/TablePagination/useInteractions.js +23 -0
  88. package/TextInput/index.d.ts +5 -4
  89. package/TextInput/index.js +18 -5
  90. package/ToastPrompt/Presentation.js +28 -27
  91. package/ToastPrompt/index.js +1 -1
  92. package/VideoPlayerModal/index.d.ts +1 -3
  93. package/VideoPlayerModal/index.js +8 -7
  94. package/VideoPlayerModal/types.d.ts +5 -1
  95. package/index.d.ts +13 -0
  96. package/index.js +13 -0
  97. package/package.json +9 -2
  98. package/useCustomTheme.d.ts +6 -0
  99. package/useCustomTheme.js +51 -0
package/README.md CHANGED
@@ -12,8 +12,15 @@
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
+ - [CheckBox](#checkbox)
20
+ - [CheckBoxGroup](#checkboxgroup)
21
+ - [Copyright](#copyright)
16
22
  - [DigitInput](#digitinput)
23
+ - [FeinInput](#feininput)
17
24
  - [FormRadioGroup](#formradiogroup)
18
25
  - [FormSelector](#formselector)
19
26
  - [HelpCaption](#helpcaption)
@@ -23,6 +30,8 @@
23
30
  - [PasswordInput](#passwordinput)
24
31
  - [PhoneNumberInput](#phonenumberinput)
25
32
  - [TabGroup](#tabgroup)
33
+ - [TablePagination](#tablepagination)
34
+ - [TextInput](#textinput)
26
35
  - [ToastPrompt](#toastprompt)
27
36
  - [VideoPlayerModal](#videoplayermodal)
28
37
  - [Changelog](#changelog)
@@ -33,7 +42,7 @@
33
42
 
34
43
  It is available as an [npm package](https://www.npmjs.com/package/@symply.io/basic-components).
35
44
 
36
- ```bash
45
+ ```shell
37
46
  // with npm
38
47
  npm install @symply.io/basic-components
39
48
 
@@ -45,7 +54,18 @@ yarn add @symply.io/basic-components
45
54
 
46
55
  <h2>License</h2>
47
56
 
48
- This project is licensed under the terms of the [MIT license](https://github.com/rinxun/symply-basic-components/blob/main/LICENSE).
57
+ This project is licensed under the terms of the [MIT license](https://github.com/baseline-software/symply-basic-components/blob/main/LICENSE).
58
+
59
+
60
+
61
+ <h2>Common Properties</h2>
62
+
63
+ All components include these 2 properties to customize the theme
64
+
65
+ | Name | Type | Default | Required | Description |
66
+ | -------------- | ---------------------- | ------- | -------- | ----------------------------- |
67
+ | primaryColor | CSSProperties["color"] | | false | Primary color for the theme |
68
+ | secondaryColor | CSSProperties["color"] | | false | Secondary color for the theme |
49
69
 
50
70
 
51
71
 
@@ -58,9 +78,9 @@ Diglog component for alerts or confirmations.
58
78
  <h5>Import</h5>
59
79
 
60
80
  ```typescript
61
- import { AlertDialog } from '@symply.io/symply-basic-components';
81
+ import { AlertDialog } from '@symply.io/basic-components/';
62
82
  // or
63
- import AlertDialog from '@symply.io/symply-basic-components/AlertDialog';
83
+ import AlertDialog from '@symply.io/basic-components/AlertDialog';
64
84
  ```
65
85
 
66
86
  <h5>Props</h5>
@@ -76,6 +96,71 @@ import AlertDialog from '@symply.io/symply-basic-components/AlertDialog';
76
96
 
77
97
 
78
98
 
99
+ <h3>Autocomplete</h3>
100
+
101
+ A normal text input enhanced by a panel of suggested options.
102
+
103
+ It is extended from `@mui/material/TextField`, so it includes all properties of `@mui/material/TextField`.
104
+
105
+ <h5>Import</h5>
106
+
107
+ ```typescript
108
+ import { Autocomplete } from '@symply.io/basic-components/';
109
+ // or
110
+ import Autocomplete from '@symply.io/basic-components/Autocomplete';
111
+ ```
112
+
113
+ <h5>Option Props (IOption)</h5>
114
+
115
+ | Name | Type | Default | Required | Description |
116
+ | ------ | ------- | ------- | -------- | -------------------------- |
117
+ | label | string | | true | Option label. |
118
+ | [name] | Unknown | | false | Customized option property |
119
+
120
+ <h5>Props</h5>
121
+
122
+ | Name | Type | Default | Required | Description |
123
+ | -------- | ---------------------- | ------- | -------- | ------------------------------------------------------------ |
124
+ | multiple | bool | false | false | If `true`, `value` must be an array and the menu will support multiple selections. |
125
+ | 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. |
126
+ | options | Array<IOption\|string> | | true | Array of suggestion options. |
127
+ | value | string | | true | The value of the `Input` element. |
128
+
129
+
130
+
131
+ <h3>AutocompleteWithFilter</h3>
132
+
133
+ A normal text input enhanced by a panel of suggested options and filter.
134
+
135
+ It is extended from `@mui/material/TextField`, so it includes all properties of `@mui/material/TextField`.
136
+
137
+ <h5>Import</h5>
138
+
139
+ ```typescript
140
+ import { AutocompleteWithFilter } from '@symply.io/basic-components/';
141
+ // or
142
+ import AutocompleteWithFilter from '@symply.io/basic-components/AutocompleteWithFilter';
143
+ ```
144
+
145
+ <h5>Option Props (IOption)</h5>
146
+
147
+ | Name | Type | Default | Required | Description |
148
+ | ------ | ------- | ------- | -------- | -------------------------- |
149
+ | label | string | | true | Option label. |
150
+ | [name] | Unknown | | false | Customized option property |
151
+
152
+ <h5>Props</h5>
153
+
154
+ | Name | Type | Default | Required | Description |
155
+ | -------------------- | ---------------------- | ------- | -------- | ------------------------------------------------------------ |
156
+ | disableCloseOnSelect | bool | false | false | If `true`, the popup won't close when a value is selected. |
157
+ | multiple | bool | false | false | If `true`, `value` must be an array and the menu will support multiple selections. |
158
+ | 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. |
159
+ | options | Array<IOption\|string> | | true | Array of suggestion options. |
160
+ | value | string | | true | The value of the `Input` element. |
161
+
162
+
163
+
79
164
  <h3>BasicModal</h3>
80
165
 
81
166
  Reusable modal component.
@@ -83,9 +168,9 @@ Reusable modal component.
83
168
  <h5>Import</h5>
84
169
 
85
170
  ```typescript
86
- import { BasicModal } from '@symply.io/symply-basic-components';
171
+ import { BasicModal } from '@symply.io/basic-components/';
87
172
  // or
88
- import BasicModal from '@symply.io/symply-basic-components/BasicModal';
173
+ import BasicModal from '@symply.io/basic-components/BasicModal';
89
174
  ```
90
175
 
91
176
  <h5>Props</h5>
@@ -110,6 +195,89 @@ import BasicModal from '@symply.io/symply-basic-components/BasicModal';
110
195
 
111
196
 
112
197
 
198
+ <h3>BreadCrumbs</h3>
199
+
200
+ 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".
201
+
202
+ <h5>Import</h5>
203
+
204
+ ```typescript
205
+ import { BreadCrumbs } from '@symply.io/basic-components/';
206
+ // or
207
+ import BreadCrumbs from '@symply.io/basic-components/BreadCrumbs';
208
+ ```
209
+
210
+ <h5>Props</h5>
211
+
212
+ | Name | Type | Default | Required | Description |
213
+ | ------ | --------------------------------------- | ------- | -------- | ------------------------- |
214
+ | routes | Array<{ href?: string; label: string }> | | true | All routes of "ancestors" |
215
+
216
+
217
+
218
+ <h3>CheckBox</h3>
219
+
220
+ Checkboxes allow the user to select one or more items from a set.
221
+
222
+ It is extended from `@mui/material/Checkbox`, so it includes all properties of `@mui/material/Checkbox`.
223
+
224
+ <h5>Import</h5>
225
+
226
+ ```typescript
227
+ import { CheckBox } from '@symply.io/basic-components/';
228
+ // or
229
+ import { CheckBox } from '@symply.io/basic-components/CheckBox';
230
+ // or
231
+ import CheckBox from '@symply.io/basic-components/CheckBox/CheckBox';
232
+ ```
233
+
234
+ <h5>Props</h5>
235
+
236
+ | Name | Type | Default | Required | Description |
237
+ | -------- | ------------------- | ------- | -------- | ------------------------------------------------------------ |
238
+ | label | string \| ReactNode | | true | The label of the checkbox. |
239
+ | onChange | func | | true | Callback fired when the `checkbox` value is changed.<br />**Signature:**<br/>`function(value: boolean) => void`<br/>*value:* The value of the `checkbox` element. |
240
+
241
+
242
+
243
+ <h3>CheckBoxGroup</h3>
244
+
245
+ Checkboxes allow the user to select one or more items from a set for a group.
246
+
247
+ It is extended from `@mui/material/FormGroup`, so it includes all properties of `@mui/material/FormGroup`.
248
+
249
+ <h5>Import</h5>
250
+
251
+ ```typescript
252
+ import { CheckBoxGroup } from '@symply.io/basic-components/';
253
+ // or
254
+ import { CheckBoxGroup } from '@symply.io/basic-components/CheckBox';
255
+ // or
256
+ import CheckBoxGroup from '@symply.io/basic-components/CheckBox/CheckBoxGroup';
257
+ ```
258
+
259
+ <h5>Props</h5>
260
+
261
+ | Name | Type | Default | Required | Description |
262
+ | ---------- | ---------------------- | ------- | -------- | ------------------------------------------------------------ |
263
+ | Checkboxes | Array\<CheckBoxProps\> | | true | The array of checkboxes.<br />See the property of [CheckBox](#checkbox) |
264
+
265
+
266
+
267
+ <h3>Copyright</h3>
268
+
269
+ A common component for rendering the copyright
270
+
271
+ <h5>Import</h5>
272
+
273
+ ```typescript
274
+ import { Copyright } from '@symply.io/basic-components/';
275
+ // or
276
+ import Copyright from '@symply.io/basic-components/Copyright';
277
+ ```
278
+
279
+
280
+
113
281
  <h3>DigitInput</h3>
114
282
 
115
283
  Input component for digits.
@@ -119,9 +287,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
119
287
  <h5>Import</h5>
120
288
 
121
289
  ```typescript
122
- import { DigitInput } from '@symply.io/symply-basic-components';
290
+ import { DigitInput } from '@symply.io/basic-components/';
123
291
  // or
124
- import DigitInput from '@symply.io/symply-basic-components/DigitInput';
292
+ import DigitInput from '@symply.io/basic-components/DigitInput';
125
293
  ```
126
294
 
127
295
  <h5>Props</h5>
@@ -137,6 +305,30 @@ import DigitInput from '@symply.io/symply-basic-components/DigitInput';
137
305
 
138
306
 
139
307
 
308
+ <h3>FeinInput</h3>
309
+
310
+ Input component for FEIN.
311
+
312
+ It is extended from `@mui/material/TextField`, so it includes all properties of `@mui/material/TextField`.
313
+
314
+ <h5>Import</h5>
315
+
316
+ ```typescript
317
+ import { FeinInput } from '@symply.io/basic-components/';
318
+ // or
319
+ import FeinInput from '@symply.io/basic-components/FeinInput';
320
+ ```
321
+
322
+ <h5>Props</h5>
323
+
324
+ | Name | Type | Default | Required | Description |
325
+ | -------- | ------ | ------- | -------- | ------------------------------------------------------------ |
326
+ | 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. |
327
+ | value | string | | true | The value of the `Input` element. |
328
+ | verifyFn | func | | false | Customized verification function. |
329
+
330
+
331
+
140
332
  <h3>FormRadioGroup</h3>
141
333
 
142
334
  Radio Group allow the user to select one option from a set.
@@ -144,9 +336,9 @@ Radio Group allow the user to select one option from a set.
144
336
  <h5>Import</h5>
145
337
 
146
338
  ```typescript
147
- import { FormRadioGroup } from '@symply.io/symply-basic-components';
339
+ import { FormRadioGroup } from '@symply.io/basic-components/';
148
340
  // or
149
- import FormRadioGroup from '@symply.io/symply-basic-components/FormRadioGroup';
341
+ import FormRadioGroup from '@symply.io/basic-components/FormRadioGroup';
150
342
  ```
151
343
 
152
344
  <h5>Radio Option Props</h5>
@@ -164,7 +356,7 @@ import FormRadioGroup from '@symply.io/symply-basic-components/FormRadioGroup';
164
356
  | color | 'primary' \| 'secondary' \| 'success' \| 'error' \| 'info' \| 'warning' | 'primary' | false | The main color of the component. |
165
357
  | disabled | bool | false | false | If `true`, the component is disabled. |
166
358
  | 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. |
359
+ | onChange | func | | true | Callback fired when the `Radio` value is changed.<br />**Signature:**<br/>`function(value: string|number|boolean) => void`<br/>*value:* The value of the `Radio` element. |
168
360
  | options | Array\<IRadioOption\> | | true | The radio options. See the **Radio Option Props** above. |
169
361
  | value | string \| number \| bool | | true | The value of the `Radio` element. |
170
362
  | tooltip | string | | false | A tooltip for the `Radio` element. |
@@ -179,9 +371,9 @@ Selector components are used for collecting user provided information from a lis
179
371
 
180
372
  ```typescript
181
373
  // Simple Selector
182
- import { SimpleSelector } from '@symply.io/symply-basic-components/FormSelector';
374
+ import { SimpleSelector } from '@symply.io/basic-components/FormSelector';
183
375
  // Multiple Selector
184
- import { MultipleSelector } from '@symply.io/symply-basic-components/FormRadioGroup';
376
+ import { MultipleSelector } from '@symply.io/basic-components/FormRadioGroup';
185
377
  ```
186
378
 
187
379
  <h5>Selector Option Props</h5>
@@ -194,18 +386,16 @@ import { MultipleSelector } from '@symply.io/symply-basic-components/FormRadioGr
194
386
 
195
387
  <h5>Base Props</h5>
196
388
 
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. |
389
+ It is extended from `@mui/material/FormControl`, so it includes all properties of `@mui/material/FormControl`.
390
+
391
+ | Name | Type | Default | Required | Description |
392
+ | -------------- | --------------------- | ------- | -------- | ----------------------------------------------------------- |
393
+ | helperText | string | | false | The helper text of the `Select` element. |
394
+ | label | string | | false | The label of `Select` element. |
395
+ | multiple | bool | false | false | If `true`, you can select more than 1 option. |
396
+ | options | Array\<IRadioOption\> | | true | The radio options. See the **Selector Option Props** above. |
397
+ | showHelperText | bool | false | False | If `true`, show the helper text. |
398
+ | tooltip | string | | false | A tooltip for the `Select` element. |
209
399
 
210
400
  <h5>Simple Selector Props</h5> Extended from the Base Props
211
401
 
@@ -230,9 +420,9 @@ You can use it to add a hint/help paragraph.
230
420
  <h5>Import</h5>
231
421
 
232
422
  ```typescript
233
- import { HelpCaption } from '@symply.io/symply-basic-components';
423
+ import { HelpCaption } from '@symply.io/basic-components/';
234
424
  // or
235
- import HelpCaption from '@symply.io/symply-basic-components/HelpCaption';
425
+ import HelpCaption from '@symply.io/basic-components/HelpCaption';
236
426
  ```
237
427
 
238
428
  <h5>Props</h5>
@@ -254,9 +444,9 @@ A modal for loading.
254
444
  <h5>Import</h5>
255
445
 
256
446
  ```typescript
257
- import { LoadingModal } from '@symply.io/symply-basic-components';
447
+ import { LoadingModal } from '@symply.io/basic-components/';
258
448
  // or
259
- import LoadingModal from '@symply.io/symply-basic-components/LoadingModal';
449
+ import LoadingModal from '@symply.io/basic-components/LoadingModal';
260
450
  ```
261
451
 
262
452
  <h5>Props</h5>
@@ -278,9 +468,9 @@ A button with menu options.
278
468
  <h5>Import</h5>
279
469
 
280
470
  ```typescript
281
- import { MenuButtonGroup } from '@symply.io/symply-basic-components';
471
+ import { MenuButtonGroup } from '@symply.io/basic-components/';
282
472
  // or
283
- import MenuButtonGroup from '@symply.io/symply-basic-components/MenuButtonGroup';
473
+ import MenuButtonGroup from '@symply.io/basic-components/MenuButtonGroup';
284
474
  ```
285
475
 
286
476
  <h5>Menu Button Props</h5>
@@ -315,9 +505,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
315
505
  <h5>Import</h5>
316
506
 
317
507
  ```typescript
318
- import { NumberInput } from '@symply.io/symply-basic-components';
508
+ import { NumberInput } from '@symply.io/basic-components/';
319
509
  // or
320
- import NumberInput from '@symply.io/symply-basic-components/NumberInput';
510
+ import NumberInput from '@symply.io/basic-components/NumberInput';
321
511
  ```
322
512
 
323
513
  <h5>Props</h5>
@@ -343,9 +533,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
343
533
 
344
534
  ```typescript
345
535
  // Password
346
- import { Password } from '@symply.io/symply-basic-components/PasswordInput';
536
+ import { Password } from '@symply.io/basic-components/PasswordInput';
347
537
  // Confirm Password
348
- import { ConfirmPassword } from '@symply.io/symply-basic-components/PasswordInput';
538
+ import { ConfirmPassword } from '@symply.io/basic-components/PasswordInput';
349
539
  ```
350
540
 
351
541
  <h5>Password Props</h5>
@@ -377,9 +567,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
377
567
  <h5>Import</h5>
378
568
 
379
569
  ```typescript
380
- import { PhoneNumberInput } from '@symply.io/symply-basic-components';
570
+ import { PhoneNumberInput } from '@symply.io/basic-components/';
381
571
  // or
382
- import PhoneNumberInput from '@symply.io/symply-basic-components/PhoneNumberInput';
572
+ import PhoneNumberInput from '@symply.io/basic-components/PhoneNumberInput';
383
573
  ```
384
574
 
385
575
  <h5>Props</h5>
@@ -399,9 +589,9 @@ Tabs group.
399
589
  <h5>Import</h5>
400
590
 
401
591
  ```typescript
402
- import { TabGroup } from '@symply.io/symply-basic-components';
592
+ import { TabGroup } from '@symply.io/basic-components/';
403
593
  // or
404
- import TabGroup from '@symply.io/symply-basic-components/TabGroup';
594
+ import TabGroup from '@symply.io/basic-components/TabGroup';
405
595
  ```
406
596
 
407
597
  <h5>Props</h5>
@@ -416,6 +606,32 @@ import TabGroup from '@symply.io/symply-basic-components/TabGroup';
416
606
 
417
607
 
418
608
 
609
+ <h3>TablePagination</h3>
610
+
611
+ Reusable pagination component for the material table
612
+
613
+ <h5>Import</h5>
614
+
615
+ ```typescript
616
+ import { TablePagination } from '@symply.io/basic-components/';
617
+ // or
618
+ import TablePagination from '@symply.io/basic-components/TablePagination';
619
+ ```
620
+
621
+ <h5>Props</h5>
622
+
623
+ | Name | Type | Default | Required | Description |
624
+ | ------------------- | --------------- | ------- | -------- | ------------------------------------------------------------ |
625
+ | colSpan | number | | true | The number of columns a cell should span. |
626
+ | count | number | | true | The total count of all data. |
627
+ | 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` . |
628
+ | onRowsPerPageChange | func | | true | Callback fired when the `Select` value is changed.<br />**Signature:**<br/>`function(event: ChangeEvent<HTMLInputElement ` |
629
+ | page | number | | true | The current page index. |
630
+ | rowsPerPage | number | | true | How many rows per page. |
631
+ | rowsPerPageOptions | Array\<number\> | | true | The options for setting how many rows per page. |
632
+
633
+
634
+
419
635
  <h3>TextInput</h3>
420
636
 
421
637
  Regular Input component.
@@ -425,9 +641,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
425
641
  <h5>Import</h5>
426
642
 
427
643
  ```typescript
428
- import { TextInput } from '@symply.io/symply-basic-components';
644
+ import { TextInput } from '@symply.io/basic-components/';
429
645
  // or
430
- import TextInput from '@symply.io/symply-basic-components/TextInput';
646
+ import TextInput from '@symply.io/basic-components/TextInput';
431
647
  ```
432
648
 
433
649
  <h5>Props</h5>
@@ -449,7 +665,7 @@ Global prompt component.
449
665
  <h5>Import</h5>
450
666
 
451
667
  ```typescript
452
- import { usePrompt } from '@symply.io/symply-basic-components';
668
+ import { usePrompt } from '@symply.io/basic-components';
453
669
  ```
454
670
 
455
671
  <h5>Usage</h5>
@@ -474,9 +690,9 @@ A modal for playing videos.
474
690
  <h5>Import</h5>
475
691
 
476
692
  ```typescript
477
- import { VideoPlayerModal } from '@symply.io/symply-basic-components';
693
+ import { VideoPlayerModal } from '@symply.io/basic-components/';
478
694
  // or
479
- import VideoPlayerModal from '@symply.io/symply-basic-components/VideoPlayerModal';
695
+ import VideoPlayerModal from '@symply.io/basic-components/VideoPlayerModal';
480
696
  ```
481
697
 
482
698
  <h5>Props</h5>
@@ -495,5 +711,5 @@ import VideoPlayerModal from '@symply.io/symply-basic-components/VideoPlayerModa
495
711
 
496
712
  <h2>Changelog</h2>
497
713
 
498
- If you have recently updated, please read the [changelog](https://github.com/rinxun/symply-basic-components/releases) for details of what has changed.
714
+ If you have recently updated, please read the [changelog](https://github.com/baseline-software/symply-basic-components/releases) for details of what has changed.
499
715
 
package/TabGroup/index.js CHANGED
@@ -10,37 +10,43 @@ 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";
17
17
  import useMediaQuery from "@mui/material/useMediaQuery";
18
- import useTheme from "@mui/material/styles/useTheme";
18
+ import ThemeProvider from "@mui/material/styles/ThemeProvider";
19
+ import useCustomTheme from "../useCustomTheme";
19
20
  var TabGroup = forwardRef(function (props, ref) {
20
- var theme = useTheme();
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
+ var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
21
23
  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 _c = useState(outerTabIndex || 0), currentTabIndex = _c[0], setCurrentTabIndex = _c[1];
24
25
  var onClick = function (index) {
25
26
  setCurrentTabIndex(index);
26
27
  };
27
28
  useImperativeHandle(ref, function () { return ({
28
- tabIndex: currentTabIndex,
29
+ tabIndex: currentTabIndex
29
30
  }); });
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));
31
+ useEffect(function () {
32
+ if (outerTabIndex !== undefined && outerTabIndex !== currentTabIndex) {
33
+ setCurrentTabIndex(outerTabIndex);
34
+ }
35
+ }, [outerTabIndex, currentTabIndex]);
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) {
37
+ onClick(val);
38
+ onTabChange(val);
39
+ } }, { children: tabs.map(function (tab, index) {
40
+ var text = tab.text, _a = tab.disabled, disabled = _a === void 0 ? false : _a;
41
+ var active = currentTabIndex === index;
42
+ return (_jsx(Tab, { disableFocusRipple: true, disableRipple: true, label: _jsx(Typography, __assign({ variant: "body2" }, { children: text })), disabled: disabled, sx: {
43
+ cursor: disabled ? "not-allowed" : "pointer",
44
+ margin: theme.spacing(0.75, 0.25),
45
+ background: active ? "#fff" : undefined,
46
+ borderRadius: active ? theme.spacing(0.5) : undefined,
47
+ boxShadow: active ? "0px 4px 6px #acc1c2" : undefined
48
+ } }, index));
49
+ }) })) })));
44
50
  });
45
51
  export default TabGroup;
46
52
  export * from "./types";
@@ -1,3 +1,4 @@
1
+ import { CSSProperties } from "react";
1
2
  import { TabsProps } from "@mui/material/Tabs";
2
3
  export interface TabGroupProps {
3
4
  textColor?: TabsProps["textColor"];
@@ -7,5 +8,7 @@ export interface TabGroupProps {
7
8
  }>;
8
9
  variant?: TabsProps["variant"];
9
10
  currentTabIndex?: number;
11
+ primaryColor?: CSSProperties["color"];
12
+ secondaryColor?: CSSProperties["color"];
10
13
  onTabChange: (index: number) => void;
11
14
  }
@@ -0,0 +1,3 @@
1
+ import { TablePaginationActionsProps } from "./types";
2
+ declare function TablePaginationActions(props: TablePaginationActionsProps): JSX.Element;
3
+ export default TablePaginationActions;
@@ -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,4 @@
1
+ import { TablePaginationProps } from "./types";
2
+ declare function Pagination(props: TablePaginationProps): JSX.Element;
3
+ export default Pagination;
4
+ export * from "./types";
@@ -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";