@symply.io/basic-components 1.0.0-beta.1 → 1.0.0-beta.10

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 (47) hide show
  1. package/Autocomplete/index.d.ts +2 -2
  2. package/Autocomplete/types.d.ts +8 -9
  3. package/AutocompleteWithFilter/index.d.ts +2 -2
  4. package/AutocompleteWithFilter/index.js +3 -5
  5. package/AutocompleteWithFilter/types.d.ts +8 -9
  6. package/BasicModal/Content.js +5 -5
  7. package/BasicTable/TableBody.d.ts +4 -0
  8. package/BasicTable/TableBody.js +50 -0
  9. package/BasicTable/TableBodyRow.d.ts +3 -0
  10. package/BasicTable/TableBodyRow.js +42 -0
  11. package/BasicTable/TableFooter.d.ts +3 -0
  12. package/BasicTable/TableFooter.js +44 -0
  13. package/BasicTable/TableHeader.d.ts +3 -0
  14. package/BasicTable/TableHeader.js +47 -0
  15. package/BasicTable/index.d.ts +5 -0
  16. package/BasicTable/index.js +80 -0
  17. package/BasicTable/types.d.ts +72 -0
  18. package/BasicTable/types.js +1 -0
  19. package/BasicTable/useScroll.d.ts +9 -0
  20. package/BasicTable/useScroll.js +76 -0
  21. package/BasicTable/useTable.d.ts +44 -0
  22. package/BasicTable/useTable.js +94 -0
  23. package/DateInput/FullDateInput/index.d.ts +1 -1
  24. package/DateInput/FullDateInput/index.js +19 -6
  25. package/DateInput/FullDateInput/types.d.ts +3 -8
  26. package/DateInput/MonthDayInput/index.d.ts +1 -1
  27. package/DateInput/MonthDayInput/index.js +18 -7
  28. package/DateInput/MonthDayInput/types.d.ts +3 -8
  29. package/DateInput/MonthYearInput/index.d.ts +1 -1
  30. package/DateInput/MonthYearInput/index.js +18 -7
  31. package/DateInput/MonthYearInput/types.d.ts +3 -8
  32. package/DynamicHeaderBar/HeaderButtons.js +2 -2
  33. package/DynamicHeaderBar/types.d.ts +3 -0
  34. package/FeinInput/index.d.ts +1 -1
  35. package/FeinInput/index.js +5 -3
  36. package/FeinInput/types.d.ts +1 -1
  37. package/PasswordInput/Password.d.ts +2 -1
  38. package/PasswordInput/Password.js +7 -6
  39. package/PhoneNumberInput/index.d.ts +2 -0
  40. package/PhoneNumberInput/index.js +14 -3
  41. package/README.md +74 -15
  42. package/SocialInput/index.d.ts +1 -1
  43. package/SocialInput/index.js +5 -4
  44. package/SocialInput/types.d.ts +1 -1
  45. package/index.d.ts +2 -0
  46. package/index.js +2 -0
  47. 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,63 @@ 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
+ | accessor | string | | true | The key of the column, it should be unique. |
220
+ | ----------- | --------------------------- | ------- | -------- | ----------------------------------------------------- |
221
+ | Name | Type | Default | Required | Description |
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
+
231
+ <h5>Hook Props</h5>
232
+
233
+ | columns | Array\<IColumn\> | | true | table columns |
234
+ | ------------- | -------------------------- | ------- | -------- | ------------------------------------------- |
235
+ | Name | Type | Default | Required | Description |
236
+ | data | Array<{ [name]: unknown }> | | true | table data/rows |
237
+ | disableSortBy | bool | | false | If true, the whole table can't be sortable. |
238
+ | initialState | { sortBy?: SortByProps } | | false | Set the initial states |
239
+ | onSort | func | | false | The function for sorting rows. |
240
+
241
+ <h5>Hook Returns</h5>
242
+
243
+ | Name | Type | Description |
244
+ | ------- | -------------------- | ------------------------- |
245
+ | headers | Array\<IHeader\> | The cells for the header. |
246
+ | columns | Array\<IBodyColumn\> | The cells for the body. |
247
+ | footers | Array\<IFooter> | The cells for the footer. |
248
+ | rows | Array<IRow\> | The rows for the table. |
249
+
250
+ <h5>Component Props</h5>
251
+
252
+ | Name | Type | Default | Required | Description |
253
+ | ---------- | -------------------- | ---------- | -------- | ----------------------------------------- |
254
+ | headers | Array\<IHeader\> | | true | The cells for the header. (from the hook) |
255
+ | columns | Array\<IBodyColumn\> | | true | The cells for the body. (from the hook) |
256
+ | footers | Array\<IFooter> | [] | false | The cells for the footer. (from the hook) |
257
+ | noDataText | string | 'No Data!' | false | The text when no data rendered. |
258
+ | rows | Array<IRow\> | | true | The rows for the table. (from the hook) |
259
+
260
+
261
+
204
262
  <h3>BreadCrumbs</h3>
205
263
 
206
264
  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 +271,7 @@ import { BreadCrumbs } from '@symply.io/basic-components/';
213
271
  import BreadCrumbs from '@symply.io/basic-components/BreadCrumbs';
214
272
  ```
215
273
 
216
- <h5>Props</h5>
274
+ <h5>Props</h5>
217
275
 
218
276
  | Name | Type | Default | Required | Description |
219
277
  | ------ | --------------------------------------- | ------- | -------- | ------------------------- |
@@ -311,8 +369,8 @@ import FullDateInput from '@symply.io/basic-components/DateInput/FullDateInput';
311
369
  | onBlur | func | | false | Callback fired when the `input` is blurred. Notice that the first argument (event) might be undefined. |
312
370
  | 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
371
  | onFocus | func | | false | Callback fired when the `input` is focused. |
372
+ | onValidate | func | | false | Customized validation function. |
314
373
  | value | string | | true | The value of the `Input` element. |
315
- | verifyFn | func | | false | Customized verification function. |
316
374
 
317
375
  <h4>MonthDayInput</h4>
318
376
 
@@ -339,8 +397,8 @@ import MonthDayInput from '@symply.io/basic-components/DateInput/MonthDayInput';
339
397
  | onBlur | func | | false | Callback fired when the `input` is blurred. Notice that the first argument (event) might be undefined. |
340
398
  | 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
399
  | onFocus | func | | false | Callback fired when the `input` is focused. |
400
+ | onValidate | func | | false | Customized validation function. |
342
401
  | value | string | | true | The value of the `Input` element. |
343
- | verifyFn | func | | false | Customized verification function. |
344
402
 
345
403
  <h4>MonthYearInput</h4>
346
404
 
@@ -367,8 +425,8 @@ import MonthYearInput from '@symply.io/basic-components/DateInput/MonthYearInput
367
425
  | onBlur | func | | false | Callback fired when the `input` is blurred. Notice that the first argument (event) might be undefined. |
368
426
  | 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
427
  | onFocus | func | | false | Callback fired when the `input` is focused. |
428
+ | onValidate | func | | false | Customized validation function. |
370
429
  | value | string | | true | The value of the `Input` element. |
371
- | verifyFn | func | | false | Customized verification function. |
372
430
 
373
431
 
374
432
 
@@ -415,11 +473,11 @@ import FeinInput from '@symply.io/basic-components/FeinInput';
415
473
 
416
474
  <h5>Props</h5>
417
475
 
418
- | Name | Type | Default | Required | Description |
419
- | -------- | ------ | ------- | -------- | ------------------------------------------------------------ |
420
- | 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. |
421
- | value | string | | true | The value of the `Input` element. |
422
- | verifyFn | func | | false | Customized verification function. |
476
+ | Name | Type | Default | Required | Description |
477
+ | ---------- | ------ | ------- | -------- | ------------------------------------------------------------ |
478
+ | 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. |
479
+ | onValidate | func | | false | Customized validation function. |
480
+ | value | string | | true | The value of the `Input` element. |
423
481
 
424
482
 
425
483
 
@@ -637,7 +695,7 @@ import { ConfirmPassword } from '@symply.io/basic-components/PasswordInput';
637
695
  | Name | Type | Default | Required | Description |
638
696
  | ------------ | -------------------------------------------------- | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ |
639
697
  | 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
- | 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. |
698
+ | 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
699
  | 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
700
  | successColor | Color | 'green' | false | The color of component when success. |
643
701
  | value | string | | true | The password value. |
@@ -672,6 +730,7 @@ import PhoneNumberInput from '@symply.io/basic-components/PhoneNumberInput';
672
730
  | ------------ | ------ | ------- | -------- | ------------------------------------------------------------ |
673
731
  | endAdornment | node | | false | An end adornment element for the `Input` element. |
674
732
  | 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. |
733
+ | onValidate | func | | false | Customized validation function. |
675
734
  | value | string | | true | The value of the `Input` element. |
676
735
 
677
736
 
@@ -725,11 +784,11 @@ import SocialInput from '@symply.io/basic-components/SocialInput';
725
784
 
726
785
  <h5>Props</h5>
727
786
 
728
- | Name | Type | Default | Required | Description |
729
- | -------- | ------ | ------- | -------- | ------------------------------------------------------------ |
730
- | 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. |
731
- | value | string | | true | The value of the `Input` element. |
732
- | verifyFn | func | | false | Customized verification function. |
787
+ | Name | Type | Default | Required | Description |
788
+ | ---------- | ------ | ------- | -------- | ------------------------------------------------------------ |
789
+ | 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. |
790
+ | onValidate | func | | false | Customized validation function. |
791
+ | value | string | | true | The value of the `Input` element. |
733
792
 
734
793
 
735
794
 
@@ -1,6 +1,6 @@
1
1
  import { SocialInputProps } from "./types";
2
2
  export declare function SocialInputFormat(str: string): string;
3
- export declare function verifySocial(socialString: string): boolean;
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";
@@ -45,12 +45,12 @@ export function SocialInputFormat(str) {
45
45
  }
46
46
  }, "");
47
47
  }
48
- export function verifySocial(socialString) {
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, verifyFn = props.verifyFn, onChange = props.onChange, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, rest = __rest(props, ["value", "helperText", "error", "verifyFn", "onChange", "primaryColor", "secondaryColor"]);
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 && (verifyFn ? !verifyFn(value) : !verifySocial(value))
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
- (verifyFn ? !verifyFn(value) : !verifySocial(value))), InputProps: {
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
@@ -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
- verifyFn?: (value?: string) => boolean;
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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.10",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",