@symply.io/basic-components 1.0.0-alpha.9 → 1.0.0-bata.7

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 (140) hide show
  1. package/AlertDialog/index.d.ts +0 -1
  2. package/AlertDialog/index.js +2 -2
  3. package/Autocomplete/index.d.ts +4 -0
  4. package/Autocomplete/index.js +38 -0
  5. package/Autocomplete/types.d.ts +14 -0
  6. package/Autocomplete/types.js +1 -0
  7. package/Autocomplete/useInteractions.d.ts +5 -0
  8. package/Autocomplete/useInteractions.js +9 -0
  9. package/AutocompleteWithFilter/index.d.ts +4 -0
  10. package/AutocompleteWithFilter/index.js +52 -0
  11. package/AutocompleteWithFilter/types.d.ts +15 -0
  12. package/AutocompleteWithFilter/types.js +1 -0
  13. package/BasicModal/Content.d.ts +0 -1
  14. package/BasicModal/Content.js +6 -6
  15. package/BasicModal/index.d.ts +0 -1
  16. package/BasicModal/index.js +3 -6
  17. package/BasicTable/TableBody.d.ts +4 -0
  18. package/BasicTable/TableBody.js +51 -0
  19. package/BasicTable/TableBodyRow.d.ts +3 -0
  20. package/BasicTable/TableBodyRow.js +42 -0
  21. package/BasicTable/TableFooter.d.ts +3 -0
  22. package/BasicTable/TableFooter.js +44 -0
  23. package/BasicTable/TableHeader.d.ts +3 -0
  24. package/BasicTable/TableHeader.js +47 -0
  25. package/BasicTable/index.d.ts +5 -0
  26. package/BasicTable/index.js +88 -0
  27. package/BasicTable/types.d.ts +70 -0
  28. package/BasicTable/types.js +1 -0
  29. package/BasicTable/useScroll.d.ts +9 -0
  30. package/BasicTable/useScroll.js +76 -0
  31. package/BasicTable/useTable.d.ts +38 -0
  32. package/BasicTable/useTable.js +94 -0
  33. package/BreadCrumbs/index.d.ts +4 -0
  34. package/BreadCrumbs/index.js +37 -0
  35. package/BreadCrumbs/types.d.ts +9 -0
  36. package/BreadCrumbs/types.js +1 -0
  37. package/CheckBox/CheckBox.d.ts +3 -0
  38. package/CheckBox/CheckBox.js +36 -0
  39. package/CheckBox/CheckBoxGroup.d.ts +3 -0
  40. package/CheckBox/CheckBoxGroup.js +30 -0
  41. package/CheckBox/index.d.ts +3 -0
  42. package/CheckBox/index.js +3 -0
  43. package/CheckBox/types.d.ts +12 -0
  44. package/CheckBox/types.js +1 -0
  45. package/Copyright/index.d.ts +4 -0
  46. package/Copyright/index.js +25 -0
  47. package/Copyright/types.d.ts +5 -0
  48. package/Copyright/types.js +1 -0
  49. package/DateInput/FullDateInput/index.d.ts +5 -0
  50. package/DateInput/FullDateInput/index.js +79 -0
  51. package/DateInput/FullDateInput/types.d.ts +9 -0
  52. package/DateInput/FullDateInput/types.js +1 -0
  53. package/DateInput/FullDateInput/useInteractions.d.ts +8 -0
  54. package/DateInput/FullDateInput/useInteractions.js +20 -0
  55. package/DateInput/MonthDayInput/index.d.ts +5 -0
  56. package/DateInput/MonthDayInput/index.js +65 -0
  57. package/DateInput/MonthDayInput/types.d.ts +9 -0
  58. package/DateInput/MonthDayInput/types.js +1 -0
  59. package/DateInput/MonthDayInput/useInteractions.d.ts +8 -0
  60. package/DateInput/MonthDayInput/useInteractions.js +19 -0
  61. package/DateInput/MonthYearInput/index.d.ts +5 -0
  62. package/DateInput/MonthYearInput/index.js +66 -0
  63. package/DateInput/MonthYearInput/types.d.ts +9 -0
  64. package/DateInput/MonthYearInput/types.js +1 -0
  65. package/DateInput/MonthYearInput/useInteractions.d.ts +8 -0
  66. package/DateInput/MonthYearInput/useInteractions.js +19 -0
  67. package/DateInput/index.d.ts +6 -0
  68. package/DateInput/index.js +6 -0
  69. package/DigitInput/index.d.ts +1 -4
  70. package/DigitInput/index.js +3 -3
  71. package/DigitInput/types.d.ts +2 -1
  72. package/DynamicHeaderBar/HeaderBar.js +1 -1
  73. package/DynamicHeaderBar/HeaderButtons.d.ts +0 -1
  74. package/DynamicHeaderBar/HeaderButtons.js +6 -6
  75. package/DynamicHeaderBar/HeaderLine.js +1 -1
  76. package/DynamicHeaderBar/index.js +2 -2
  77. package/DynamicHeaderBar/types.d.ts +3 -0
  78. package/FeinInput/index.d.ts +6 -0
  79. package/FeinInput/index.js +75 -0
  80. package/FeinInput/types.d.ts +9 -0
  81. package/FeinInput/types.js +1 -0
  82. package/FeinInput/useInteractions.d.ts +8 -0
  83. package/FeinInput/useInteractions.js +16 -0
  84. package/FormRadioGroup/index.d.ts +0 -1
  85. package/FormRadioGroup/index.js +3 -3
  86. package/FormSelector/MultipleSelector.d.ts +1 -3
  87. package/FormSelector/MultipleSelector.js +2 -2
  88. package/FormSelector/SimpleSelector.d.ts +1 -3
  89. package/FormSelector/SimpleSelector.js +2 -2
  90. package/FormSelector/types.d.ts +2 -1
  91. package/HelpCaption/index.js +2 -2
  92. package/LoadingModal/index.d.ts +0 -1
  93. package/LoadingModal/index.js +1 -1
  94. package/MenuButtonGroup/MenuItem.d.ts +0 -1
  95. package/MenuButtonGroup/MenuItem.js +1 -1
  96. package/MenuButtonGroup/index.js +2 -2
  97. package/NumberInput/index.d.ts +2 -3
  98. package/NumberInput/index.js +1 -1
  99. package/PasswordInput/ConfirmPassword.d.ts +2 -3
  100. package/PasswordInput/ConfirmPassword.js +1 -1
  101. package/PasswordInput/Password.d.ts +5 -5
  102. package/PasswordInput/Password.js +9 -8
  103. package/PhoneNumberInput/index.d.ts +4 -3
  104. package/PhoneNumberInput/index.js +15 -4
  105. package/README.md +428 -3
  106. package/Sidebar/SidebarItem.d.ts +3 -0
  107. package/Sidebar/SidebarItem.js +62 -0
  108. package/Sidebar/SidebarItemsGroup.d.ts +5 -0
  109. package/Sidebar/SidebarItemsGroup.js +38 -0
  110. package/Sidebar/SidebarLink.d.ts +3 -0
  111. package/Sidebar/SidebarLink.js +37 -0
  112. package/Sidebar/index.d.ts +7 -0
  113. package/Sidebar/index.js +30 -0
  114. package/Sidebar/types.d.ts +31 -0
  115. package/Sidebar/types.js +1 -0
  116. package/SocialInput/index.d.ts +6 -0
  117. package/SocialInput/index.js +77 -0
  118. package/SocialInput/types.d.ts +9 -0
  119. package/SocialInput/types.js +1 -0
  120. package/SocialInput/useInteractions.d.ts +10 -0
  121. package/SocialInput/useInteractions.js +26 -0
  122. package/TabGroup/index.js +10 -5
  123. package/TablePagination/Actions.d.ts +3 -0
  124. package/TablePagination/Actions.js +27 -0
  125. package/TablePagination/index.d.ts +4 -0
  126. package/TablePagination/index.js +30 -0
  127. package/TablePagination/types.d.ts +14 -0
  128. package/TablePagination/types.js +1 -0
  129. package/TablePagination/useInteractions.d.ts +14 -0
  130. package/TablePagination/useInteractions.js +23 -0
  131. package/TextInput/index.d.ts +2 -3
  132. package/TextInput/index.js +13 -3
  133. package/ToastPrompt/Presentation.js +3 -3
  134. package/ToastPrompt/index.js +1 -1
  135. package/VideoPlayerModal/index.d.ts +1 -3
  136. package/VideoPlayerModal/index.js +2 -2
  137. package/VideoPlayerModal/types.d.ts +2 -1
  138. package/index.d.ts +20 -0
  139. package/index.js +20 -0
  140. package/package.json +8 -2
@@ -36,6 +36,6 @@ function NumberInput(props) {
36
36
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Tooltip, __assign({ title: tooltip !== null && tooltip !== void 0 ? tooltip : "", open: !!tooltip && tooltipOpen }, { children: _jsx(Field, __assign({ size: size, margin: "dense", type: "number", value: value === undefined || value === null ? "" : value, onFocus: onOpenTooltip, onBlur: function () {
37
37
  onCloseTooltip();
38
38
  handleBlur();
39
- }, onChange: handleChange, error: error || exceedError, helperText: helperText || (exceedError ? EXCEED_ERROR : "") }, rest), void 0) }), void 0) }), void 0));
39
+ }, onChange: handleChange, error: error || exceedError, helperText: helperText || (exceedError ? EXCEED_ERROR : "") }, rest)) })) })));
40
40
  }
41
41
  export default NumberInput;
@@ -1,12 +1,11 @@
1
1
  import { CSSProperties } from "react";
2
2
  import { TextFieldProps } from "@mui/material/TextField";
3
- declare type TextInputProps = Omit<TextFieldProps, "onChange">;
4
- export interface ConfirmPasswordProps {
3
+ export interface ConfirmPasswordProps extends Omit<TextFieldProps, "onChange"> {
5
4
  password: string;
6
5
  value: string;
7
6
  primaryColor?: CSSProperties["color"];
8
7
  secondaryColor?: CSSProperties["color"];
9
8
  onChange: (value: string) => void;
10
9
  }
11
- declare function ConfirmPassword(props: ConfirmPasswordProps & TextInputProps): JSX.Element;
10
+ declare function ConfirmPassword(props: ConfirmPasswordProps): JSX.Element;
12
11
  export default ConfirmPassword;
@@ -36,6 +36,6 @@ function ConfirmPassword(props) {
36
36
  }, [value, password]);
37
37
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ error: !isMatched, label: label, value: value, variant: variant, margin: margin, disabled: disabled, type: "password", size: "small", helperText: !isMatched && helperText, onChange: function (event) {
38
38
  onChange(event.target.value);
39
- }, fullWidth: true, required: true }, rest), void 0) }), void 0));
39
+ }, fullWidth: true, required: true }, rest)) })));
40
40
  }
41
41
  export default ConfirmPassword;
@@ -1,20 +1,20 @@
1
1
  import { CSSProperties } from "react";
2
2
  import { TextFieldProps } from "@mui/material/TextField";
3
- declare type TextInputProps = Omit<TextFieldProps, "onChange">;
4
3
  export interface PasswordStrategyProps {
5
4
  [key: string]: {
6
5
  label: string;
7
6
  regex: RegExp;
8
7
  };
9
8
  }
10
- export interface PasswordProps {
11
- strategies: PasswordStrategyProps;
9
+ export interface PasswordProps extends Omit<TextFieldProps, "onChange"> {
10
+ strategies?: PasswordStrategyProps;
12
11
  value: string;
13
12
  successColor?: CSSProperties["color"];
14
13
  primaryColor?: CSSProperties["color"];
15
14
  secondaryColor?: CSSProperties["color"];
16
15
  onChange: (value: string) => void;
17
- onVerify?: (value: string) => boolean;
16
+ onValidate?: (value: string) => boolean;
18
17
  }
19
- declare function Password(props: PasswordProps & TextInputProps): JSX.Element;
18
+ export declare function onValidatePassword(password: string): boolean;
19
+ declare function Password(props: PasswordProps): JSX.Element;
20
20
  export default Password;
@@ -26,6 +26,10 @@ import TextField from "@mui/material/TextField";
26
26
  import Typography from "@mui/material/Typography";
27
27
  import ThemeProvider from "@mui/material/styles/ThemeProvider";
28
28
  import useCustomTheme from "../useCustomTheme";
29
+ export function onValidatePassword(password) {
30
+ var reg = /^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~])([!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~a-zA-z0-9]{8,})$/;
31
+ return reg.test(password);
32
+ }
29
33
  function Password(props) {
30
34
  var _a = props.strategies, strategies = _a === void 0 ? {
31
35
  uppercaseLetter: { label: "1 Uppercase Letter", regex: /[A-Z]+/ },
@@ -36,17 +40,14 @@ function Password(props) {
36
40
  },
37
41
  number: { label: "1 Number", regex: /\d+/ },
38
42
  minimum8: { label: "Minimum 8 characters", regex: /.{8,}/ }
39
- } : _a, _b = props.successColor, successColor = _b === void 0 ? "green" : _b, value = props.value, error = props.error, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, _c = props.onVerify, onVerify = _c === void 0 ? function (password) {
40
- var reg = /^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~])([!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~a-zA-z0-9]{8,})$/;
41
- return reg.test(password);
42
- } : _c, onChange = props.onChange, rest = __rest(props, ["strategies", "successColor", "value", "error", "primaryColor", "secondaryColor", "onVerify", "onChange"]);
43
+ } : _a, _b = props.successColor, successColor = _b === void 0 ? "green" : _b, value = props.value, error = props.error, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onValidate = props.onValidate, onChange = props.onChange, rest = __rest(props, ["strategies", "successColor", "value", "error", "primaryColor", "secondaryColor", "onValidate", "onChange"]);
43
44
  var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
44
45
  var isValidPassword = useMemo(function () {
45
46
  if ((value === null || value === void 0 ? void 0 : value.length) > 0) {
46
- return onVerify(value);
47
+ return onValidate ? onValidate(value) : onValidatePassword(value);
47
48
  }
48
49
  return true;
49
- }, [value, onVerify]);
50
+ }, [value, onValidate, onValidatePassword]);
50
51
  var helperTextColor = useMemo(function () {
51
52
  var textColors = Object.keys(strategies).reduce(function (temp, key) {
52
53
  var regex = strategies[key].regex;
@@ -67,10 +68,10 @@ function Password(props) {
67
68
  return (_jsx(_Fragment, { children: Object.keys(strategies).map(function (key) {
68
69
  var label = strategies[key].label;
69
70
  return (_jsx(Typography, __assign({ component: "li", variant: "caption", style: { color: helperTextColor[key] } }, { children: label }), key));
70
- }) }, void 0));
71
+ }) }));
71
72
  }, [helperTextColor, strategies]);
72
73
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ error: !isValidPassword || error, helperText: helperText, type: "password", label: "Password", size: "small", margin: "dense", value: value, onChange: function (event) {
73
74
  onChange(event.target.value);
74
- }, fullWidth: true, required: true }, rest), void 0) }), void 0));
75
+ }, fullWidth: true, required: true }, rest)) })));
75
76
  }
76
77
  export default Password;
@@ -1,14 +1,15 @@
1
1
  import { CSSProperties } from "react";
2
2
  import { InputProps } from "@mui/material/Input";
3
3
  import { TextFieldProps } from "@mui/material/TextField";
4
- declare type TextInputProps = Omit<TextFieldProps, "onChange">;
5
- export interface PhoneInputProps {
4
+ export interface PhoneInputProps extends Omit<TextFieldProps, "onChange"> {
6
5
  value: string;
7
6
  endAdornment?: InputProps["endAdornment"];
8
7
  primaryColor?: CSSProperties["color"];
9
8
  secondaryColor?: CSSProperties["color"];
10
9
  onChange: (val: string) => void;
10
+ onValidate?: (val: string) => boolean;
11
11
  }
12
+ export declare function onValidatePhone(str: string): boolean;
12
13
  export declare function phoneFormat(str: string): string;
13
- declare function PhoneInput(props: TextInputProps & PhoneInputProps): JSX.Element;
14
+ declare function PhoneInput(props: PhoneInputProps): JSX.Element;
14
15
  export default PhoneInput;
@@ -28,6 +28,10 @@ import TextField from "@mui/material/TextField";
28
28
  import ThemeProvider from "@mui/material/styles/ThemeProvider";
29
29
  import useInteractions from "./useInteractions";
30
30
  import useCustomTheme from "../useCustomTheme";
31
+ export function onValidatePhone(str) {
32
+ var reg = /^\(\d{3}\)\s?\d{3}\s?-\s?\d{4}$/g;
33
+ return reg.test(str);
34
+ }
31
35
  export function phoneFormat(str) {
32
36
  var digits = (str.match(/\d+/g) || []).join("");
33
37
  var chars = digits.split("");
@@ -44,9 +48,9 @@ export function phoneFormat(str) {
44
48
  }, "(");
45
49
  }
46
50
  function PhoneInput(props) {
47
- var value = props.value, endAdornment = props.endAdornment, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, onChange = props.onChange, rest = __rest(props, ["value", "endAdornment", "primaryColor", "secondaryColor", "onChange"]);
51
+ var value = props.value, error = props.error, endAdornment = props.endAdornment, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, _a = props.helperText, helperText = _a === void 0 ? "Please enter a valid phone number" : _a, onChange = props.onChange, onValidate = props.onValidate, rest = __rest(props, ["value", "error", "endAdornment", "primaryColor", "secondaryColor", "helperText", "onChange", "onValidate"]);
48
52
  var theme = useCustomTheme({ primaryColor: primaryColor, secondaryColor: secondaryColor });
49
- var addMask = useInteractions({ value: value }).addMask;
53
+ var _b = useInteractions({ value: value }), valLength = _b.valLength, addMask = _b.addMask;
50
54
  var rifm = useRifm({
51
55
  mask: true,
52
56
  value: String(value),
@@ -55,8 +59,15 @@ function PhoneInput(props) {
55
59
  format: phoneFormat
56
60
  });
57
61
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(TextField, __assign({ value: rifm.value, InputProps: {
58
- startAdornment: (_jsx(InputAdornment, __assign({ position: "start" }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "+1" }), void 0) }), void 0)),
62
+ startAdornment: (_jsx(InputAdornment, __assign({ position: "start" }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "+1" })) }))),
59
63
  endAdornment: endAdornment
60
- }, onChange: rifm.onChange }, rest), void 0) }), void 0));
64
+ }, onChange: rifm.onChange, helperText: valLength > 0 &&
65
+ (onValidate ? !onValidate(rifm.value) : !onValidatePhone(rifm.value))
66
+ ? helperText
67
+ : "", error: error ||
68
+ (valLength > 0 &&
69
+ (onValidate
70
+ ? !onValidate(rifm.value)
71
+ : !onValidatePhone(rifm.value))) }, rest)) })));
61
72
  }
62
73
  export default PhoneInput;