@symply.io/basic-components 1.0.0-beta.1 → 1.0.0-beta.11
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/Autocomplete/index.d.ts +2 -2
- package/Autocomplete/types.d.ts +8 -9
- package/AutocompleteWithFilter/index.d.ts +2 -2
- package/AutocompleteWithFilter/index.js +3 -5
- package/AutocompleteWithFilter/types.d.ts +8 -9
- package/BasicModal/Content.js +5 -5
- package/BasicTable/TableBody.d.ts +4 -0
- package/BasicTable/TableBody.js +50 -0
- package/BasicTable/TableBodyRow.d.ts +3 -0
- package/BasicTable/TableBodyRow.js +43 -0
- package/BasicTable/TableFooter.d.ts +3 -0
- package/BasicTable/TableFooter.js +45 -0
- package/BasicTable/TableHeader.d.ts +3 -0
- package/BasicTable/TableHeader.js +48 -0
- package/BasicTable/index.d.ts +5 -0
- package/BasicTable/index.js +80 -0
- package/BasicTable/types.d.ts +73 -0
- package/BasicTable/types.js +1 -0
- package/BasicTable/useScroll.d.ts +9 -0
- package/BasicTable/useScroll.js +76 -0
- package/BasicTable/useTable.d.ts +47 -0
- package/BasicTable/useTable.js +94 -0
- package/DateInput/FullDateInput/index.d.ts +1 -1
- package/DateInput/FullDateInput/index.js +19 -6
- package/DateInput/FullDateInput/types.d.ts +3 -8
- package/DateInput/MonthDayInput/index.d.ts +1 -1
- package/DateInput/MonthDayInput/index.js +18 -7
- package/DateInput/MonthDayInput/types.d.ts +3 -8
- package/DateInput/MonthYearInput/index.d.ts +1 -1
- package/DateInput/MonthYearInput/index.js +18 -7
- package/DateInput/MonthYearInput/types.d.ts +3 -8
- package/DynamicHeaderBar/HeaderButtons.js +2 -2
- package/DynamicHeaderBar/types.d.ts +3 -0
- package/FeinInput/index.d.ts +1 -1
- package/FeinInput/index.js +5 -3
- package/FeinInput/types.d.ts +1 -1
- package/PasswordInput/Password.d.ts +2 -1
- package/PasswordInput/Password.js +7 -6
- package/PhoneNumberInput/index.d.ts +2 -0
- package/PhoneNumberInput/index.js +14 -3
- package/README.md +75 -15
- package/SocialInput/index.d.ts +1 -1
- package/SocialInput/index.js +5 -4
- package/SocialInput/types.d.ts +1 -1
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
- [Autocomplete](#autocomplete)
|
16
16
|
- [AutocompleteWithFilter](#autocompletewithfilter)
|
17
17
|
- [BasicModal](#basicmodal)
|
18
|
+
- [BasicTable](#basictable)
|
18
19
|
- [BreadCrumbs](#breadcrumbs)
|
19
20
|
- [CheckBox](#checkbox)
|
20
21
|
- [CheckBoxGroup](#checkboxgroup)
|
@@ -201,6 +202,64 @@ import BasicModal from '@symply.io/basic-components/BasicModal';
|
|
201
202
|
|
202
203
|
|
203
204
|
|
205
|
+
<h3>BasicTable</h3>
|
206
|
+
|
207
|
+
Reusable table component
|
208
|
+
|
209
|
+
<h5>Import</h5>
|
210
|
+
|
211
|
+
```tsx
|
212
|
+
import { BasicTable, useTable } from '@symply.io/basic-components';
|
213
|
+
// or
|
214
|
+
import BasicTable, { useTable } from '@symply.io/basic-components/BasicTable';
|
215
|
+
```
|
216
|
+
|
217
|
+
<h5>Column Props (IColumn)</h5>
|
218
|
+
|
219
|
+
| Name | Type | Default | Required | Description |
|
220
|
+
| ----------- | --------------------------- | ------- | -------- | ----------------------------------------------------- |
|
221
|
+
| accessor | string | | true | The key of the column, it should be unique. |
|
222
|
+
| align | "left" \|"center" \|"right" | | false | The alignment of the column. |
|
223
|
+
| Body | ReactElement | | true | The component to render the column body cell. |
|
224
|
+
| canBeFrozen | bool | | false | If true, the column can be frozen |
|
225
|
+
| canSort | bool | | false | If true, the column can be sortable. |
|
226
|
+
| Header | ReactElement | | true | The component to render the column header cell. |
|
227
|
+
| headerTip | string | | false | The tip title text when the mouse is over the header. |
|
228
|
+
| Footer | ReactElement | | false | The component to render the column footer cell. |
|
229
|
+
| minWidth | number | 120 | false | The minimum width of cells. |
|
230
|
+
| width | number | | false | The fixed width of cells. |
|
231
|
+
|
232
|
+
<h5>Hook Props</h5>
|
233
|
+
|
234
|
+
| Name | Type | Default | Required | Description |
|
235
|
+
| ------------- | -------------------------- | ------- | -------- | ------------------------------------------- |
|
236
|
+
| columns | Array\<IColumn\> | | true | table columns |
|
237
|
+
| data | Array<{ [name]: unknown }> | | true | table data/rows |
|
238
|
+
| disableSortBy | bool | | false | If true, the whole table can't be sortable. |
|
239
|
+
| initialState | { sortBy?: SortByProps } | | false | Set the initial states |
|
240
|
+
| onSort | func | | false | The function for sorting rows. |
|
241
|
+
|
242
|
+
<h5>Hook Returns</h5>
|
243
|
+
|
244
|
+
| Name | Type | Description |
|
245
|
+
| ------- | -------------------- | ------------------------- |
|
246
|
+
| headers | Array\<IHeader\> | The cells for the header. |
|
247
|
+
| columns | Array\<IBodyColumn\> | The cells for the body. |
|
248
|
+
| footers | Array\<IFooter> | The cells for the footer. |
|
249
|
+
| rows | Array<IRow\> | The rows for the table. |
|
250
|
+
|
251
|
+
<h5>Component Props</h5>
|
252
|
+
|
253
|
+
| Name | Type | Default | Required | Description |
|
254
|
+
| ---------- | -------------------- | ---------- | -------- | ----------------------------------------- |
|
255
|
+
| headers | Array\<IHeader\> | | true | The cells for the header. (from the hook) |
|
256
|
+
| columns | Array\<IBodyColumn\> | | true | The cells for the body. (from the hook) |
|
257
|
+
| footers | Array\<IFooter> | [] | false | The cells for the footer. (from the hook) |
|
258
|
+
| noDataText | string | 'No Data!' | false | The text when no data rendered. |
|
259
|
+
| rows | Array<IRow\> | | true | The rows for the table. (from the hook) |
|
260
|
+
|
261
|
+
|
262
|
+
|
204
263
|
<h3>BreadCrumbs</h3>
|
205
264
|
|
206
265
|
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".
|
@@ -213,7 +272,7 @@ import { BreadCrumbs } from '@symply.io/basic-components/';
|
|
213
272
|
import BreadCrumbs from '@symply.io/basic-components/BreadCrumbs';
|
214
273
|
```
|
215
274
|
|
216
|
-
<h5>Props</h5>
|
275
|
+
<h5>Props</h5>
|
217
276
|
|
218
277
|
| Name | Type | Default | Required | Description |
|
219
278
|
| ------ | --------------------------------------- | ------- | -------- | ------------------------- |
|
@@ -311,8 +370,8 @@ import FullDateInput from '@symply.io/basic-components/DateInput/FullDateInput';
|
|
311
370
|
| onBlur | func | | false | Callback fired when the `input` is blurred. Notice that the first argument (event) might be undefined. |
|
312
371
|
| 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. |
|
313
372
|
| onFocus | func | | false | Callback fired when the `input` is focused. |
|
373
|
+
| onValidate | func | | false | Customized validation function. |
|
314
374
|
| value | string | | true | The value of the `Input` element. |
|
315
|
-
| verifyFn | func | | false | Customized verification function. |
|
316
375
|
|
317
376
|
<h4>MonthDayInput</h4>
|
318
377
|
|
@@ -339,8 +398,8 @@ import MonthDayInput from '@symply.io/basic-components/DateInput/MonthDayInput';
|
|
339
398
|
| onBlur | func | | false | Callback fired when the `input` is blurred. Notice that the first argument (event) might be undefined. |
|
340
399
|
| 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. |
|
341
400
|
| onFocus | func | | false | Callback fired when the `input` is focused. |
|
401
|
+
| onValidate | func | | false | Customized validation function. |
|
342
402
|
| value | string | | true | The value of the `Input` element. |
|
343
|
-
| verifyFn | func | | false | Customized verification function. |
|
344
403
|
|
345
404
|
<h4>MonthYearInput</h4>
|
346
405
|
|
@@ -367,8 +426,8 @@ import MonthYearInput from '@symply.io/basic-components/DateInput/MonthYearInput
|
|
367
426
|
| onBlur | func | | false | Callback fired when the `input` is blurred. Notice that the first argument (event) might be undefined. |
|
368
427
|
| 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. |
|
369
428
|
| onFocus | func | | false | Callback fired when the `input` is focused. |
|
429
|
+
| onValidate | func | | false | Customized validation function. |
|
370
430
|
| value | string | | true | The value of the `Input` element. |
|
371
|
-
| verifyFn | func | | false | Customized verification function. |
|
372
431
|
|
373
432
|
|
374
433
|
|
@@ -415,11 +474,11 @@ import FeinInput from '@symply.io/basic-components/FeinInput';
|
|
415
474
|
|
416
475
|
<h5>Props</h5>
|
417
476
|
|
418
|
-
| Name
|
419
|
-
|
|
420
|
-
| onChange
|
421
|
-
|
|
422
|
-
|
|
477
|
+
| Name | Type | Default | Required | Description |
|
478
|
+
| ---------- | ------ | ------- | -------- | ------------------------------------------------------------ |
|
479
|
+
| 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. |
|
480
|
+
| onValidate | func | | false | Customized validation function. |
|
481
|
+
| value | string | | true | The value of the `Input` element. |
|
423
482
|
|
424
483
|
|
425
484
|
|
@@ -637,7 +696,7 @@ import { ConfirmPassword } from '@symply.io/basic-components/PasswordInput';
|
|
637
696
|
| Name | Type | Default | Required | Description |
|
638
697
|
| ------------ | -------------------------------------------------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ |
|
639
698
|
| 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. |
|
640
|
-
|
|
699
|
+
| onValidate | 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. |
|
641
700
|
| 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 |
|
642
701
|
| successColor | Color | 'green' | false | The color of component when success. |
|
643
702
|
| value | string | | true | The password value. |
|
@@ -672,6 +731,7 @@ import PhoneNumberInput from '@symply.io/basic-components/PhoneNumberInput';
|
|
672
731
|
| ------------ | ------ | ------- | -------- | ------------------------------------------------------------ |
|
673
732
|
| endAdornment | node | | false | An end adornment element for the `Input` element. |
|
674
733
|
| 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. |
|
734
|
+
| onValidate | func | | false | Customized validation function. |
|
675
735
|
| value | string | | true | The value of the `Input` element. |
|
676
736
|
|
677
737
|
|
@@ -725,11 +785,11 @@ import SocialInput from '@symply.io/basic-components/SocialInput';
|
|
725
785
|
|
726
786
|
<h5>Props</h5>
|
727
787
|
|
728
|
-
| Name
|
729
|
-
|
|
730
|
-
| onChange
|
731
|
-
|
|
732
|
-
|
|
788
|
+
| Name | Type | Default | Required | Description |
|
789
|
+
| ---------- | ------ | ------- | -------- | ------------------------------------------------------------ |
|
790
|
+
| 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. |
|
791
|
+
| onValidate | func | | false | Customized validation function. |
|
792
|
+
| value | string | | true | The value of the `Input` element. |
|
733
793
|
|
734
794
|
|
735
795
|
|
package/SocialInput/index.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { SocialInputProps } from "./types";
|
2
2
|
export declare function SocialInputFormat(str: string): string;
|
3
|
-
export declare function
|
3
|
+
export declare function onValidateSocial(socialString: string): boolean;
|
4
4
|
declare function SocialInput(props: SocialInputProps): JSX.Element;
|
5
5
|
export default SocialInput;
|
6
6
|
export * from "./types";
|
package/SocialInput/index.js
CHANGED
@@ -45,12 +45,12 @@ export function SocialInputFormat(str) {
|
|
45
45
|
}
|
46
46
|
}, "");
|
47
47
|
}
|
48
|
-
export function
|
48
|
+
export function onValidateSocial(socialString) {
|
49
49
|
var reg = /^\d{3}\s?-\s?\d{2}\s?-\s?\d{4}$/g;
|
50
50
|
return reg.test(socialString);
|
51
51
|
}
|
52
52
|
function SocialInput(props) {
|
53
|
-
var value = props.value, _a = props.helperText, helperText = _a === void 0 ? "Please enter a valid SSN" : _a, error = props.error,
|
53
|
+
var value = props.value, _a = props.helperText, helperText = _a === void 0 ? "Please enter a valid SSN" : _a, error = props.error, onChange = props.onChange, onValidate = props.onValidate, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["value", "helperText", "error", "onChange", "onValidate", "primaryColor", "secondaryColor"]);
|
54
54
|
var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
|
55
55
|
var _b = useInteractions({
|
56
56
|
value: value
|
@@ -62,11 +62,12 @@ function SocialInput(props) {
|
|
62
62
|
replace: addMask,
|
63
63
|
format: SocialInputFormat
|
64
64
|
});
|
65
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ helperText: valLength > 0 &&
|
65
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ helperText: valLength > 0 &&
|
66
|
+
(onValidate ? !onValidate(value) : !onValidateSocial(value))
|
66
67
|
? helperText
|
67
68
|
: "", value: rifm.value, onChange: rifm.onChange, type: visible ? "text" : "password", error: error ||
|
68
69
|
(valLength > 0 &&
|
69
|
-
(
|
70
|
+
(onValidate ? !onValidate(value) : !onValidateSocial(value))), InputProps: {
|
70
71
|
endAdornment: (_jsx(InputAdornment, __assign({ position: "end" }, { children: valLength === 9 && (_jsx(IconButton, __assign({ "aria-label": "Toggle SSN visibility", onClick: onSwitching }, { children: visible ? _jsx(Visibility, {}) : _jsx(VisibilityOff, {}) }))) })))
|
71
72
|
}, InputLabelProps: {
|
72
73
|
shrink: true
|
package/SocialInput/types.d.ts
CHANGED
@@ -2,7 +2,7 @@ import { CSSProperties } from "react";
|
|
2
2
|
import { TextFieldProps } from "@mui/material/TextField";
|
3
3
|
export interface SocialInputProps extends Omit<TextFieldProps, "onChange"> {
|
4
4
|
onChange: (value: string) => void;
|
5
|
-
|
5
|
+
onValidate?: (value?: string) => boolean;
|
6
6
|
value: string;
|
7
7
|
primaryColor?: CSSProperties["color"];
|
8
8
|
secondaryColor?: CSSProperties["color"];
|
package/index.d.ts
CHANGED
@@ -2,6 +2,7 @@ export * from "./AlertDialog";
|
|
2
2
|
export * from "./Autocomplete";
|
3
3
|
export * from "./AutocompleteWithFilter";
|
4
4
|
export * from "./BasicModal";
|
5
|
+
export * from "./BasicTable";
|
5
6
|
export * from "./BreadCrumbs";
|
6
7
|
export * from "./CheckBox";
|
7
8
|
export * from "./Copyright";
|
@@ -28,6 +29,7 @@ export { default as AlertDialog } from "./AlertDialog";
|
|
28
29
|
export { default as Autocomplete } from "./Autocomplete";
|
29
30
|
export { default as AutocompleteWithFilter } from "./AutocompleteWithFilter";
|
30
31
|
export { default as BasicModal } from "./BasicModal";
|
32
|
+
export { default as BasicTable } from "./BasicTable";
|
31
33
|
export { default as BreadCrumbs } from "./BreadCrumbs";
|
32
34
|
export { default as Copyright } from "./Copyright";
|
33
35
|
export { default as DigitInput } from "./DigitInput";
|
package/index.js
CHANGED
@@ -2,6 +2,7 @@ export * from "./AlertDialog";
|
|
2
2
|
export * from "./Autocomplete";
|
3
3
|
export * from "./AutocompleteWithFilter";
|
4
4
|
export * from "./BasicModal";
|
5
|
+
export * from "./BasicTable";
|
5
6
|
export * from "./BreadCrumbs";
|
6
7
|
export * from "./CheckBox";
|
7
8
|
export * from "./Copyright";
|
@@ -28,6 +29,7 @@ export { default as AlertDialog } from "./AlertDialog";
|
|
28
29
|
export { default as Autocomplete } from "./Autocomplete";
|
29
30
|
export { default as AutocompleteWithFilter } from "./AutocompleteWithFilter";
|
30
31
|
export { default as BasicModal } from "./BasicModal";
|
32
|
+
export { default as BasicTable } from "./BasicTable";
|
31
33
|
export { default as BreadCrumbs } from "./BreadCrumbs";
|
32
34
|
export { default as Copyright } from "./Copyright";
|
33
35
|
export { default as DigitInput } from "./DigitInput";
|