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

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.
@@ -7,5 +7,6 @@ export interface PhoneInputProps {
7
7
  endAdornment?: InputProps["endAdornment"];
8
8
  onChange: (val: string) => void;
9
9
  }
10
+ export declare function phoneFormat(str: string): string;
10
11
  declare function PhoneInput(props: TextInputProps & PhoneInputProps): JSX.Element;
11
12
  export default PhoneInput;
@@ -26,19 +26,34 @@ import Typography from "@mui/material/Typography";
26
26
  import InputAdornment from "@mui/material/InputAdornment";
27
27
  import TextField from "@mui/material/TextField";
28
28
  import useInteractions from "./useInteractions";
29
+ export function phoneFormat(str) {
30
+ var digits = (str.match(/\d+/g) || []).join("");
31
+ var chars = digits.split("");
32
+ return chars.reduce(function (prev, curr, index) {
33
+ if (index === 3) {
34
+ return "".concat(prev, ") ").concat(curr);
35
+ }
36
+ else if (index === 6) {
37
+ return "".concat(prev, "-").concat(curr);
38
+ }
39
+ else {
40
+ return "".concat(prev).concat(curr);
41
+ }
42
+ }, "(");
43
+ }
29
44
  function PhoneInput(props) {
30
45
  var value = props.value, endAdornment = props.endAdornment, onChange = props.onChange, rest = __rest(props, ["value", "endAdornment", "onChange"]);
31
- var _a = useInteractions({ value: value }), addMask = _a.addMask, phoneFormat = _a.phoneFormat;
46
+ var addMask = useInteractions({ value: value }).addMask;
32
47
  var rifm = useRifm({
33
48
  mask: true,
34
49
  value: String(value),
35
50
  onChange: onChange,
36
51
  replace: addMask,
37
- format: phoneFormat,
52
+ format: phoneFormat
38
53
  });
39
54
  return (_jsx(TextField, __assign({ value: rifm.value, InputProps: {
40
55
  startAdornment: (_jsx(InputAdornment, __assign({ position: "start" }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "+1" }), void 0) }), void 0)),
41
- endAdornment: endAdornment,
56
+ endAdornment: endAdornment
42
57
  }, onChange: rifm.onChange }, rest), void 0));
43
58
  }
44
59
  export default PhoneInput;
@@ -4,6 +4,5 @@ interface InteractionProps {
4
4
  declare function useInteractions(props: InteractionProps): {
5
5
  valLength: number;
6
6
  addMask: (str: string) => string;
7
- phoneFormat: (str: string) => string;
8
7
  };
9
8
  export default useInteractions;
@@ -1,19 +1,6 @@
1
1
  import { useCallback, useMemo } from "react";
2
2
  function useInteractions(props) {
3
3
  var value = props.value;
4
- var phoneFormat = useCallback(function (str) {
5
- var digits = (str.match(/\d+/g) || []).join("");
6
- var chars = digits.split("");
7
- return chars.reduce(function (prev, curr, index) {
8
- if (index === 3) {
9
- return "".concat(prev, ") ").concat(curr);
10
- }
11
- if (index === 6) {
12
- return "".concat(prev, "-").concat(curr);
13
- }
14
- return "".concat(prev).concat(curr);
15
- }, "(");
16
- }, []);
17
4
  var addMask = useCallback(function (str) {
18
5
  var digits = (str.match(/\d+/g) || []).join("");
19
6
  var areaCode = digits.slice(0, 3).padEnd(3, "_");
@@ -25,6 +12,6 @@ function useInteractions(props) {
25
12
  var digitsArr = String(value).match(/\d/g);
26
13
  return digitsArr ? digitsArr.length : 0;
27
14
  }, [value]);
28
- return { valLength: valLength, addMask: addMask, phoneFormat: phoneFormat };
15
+ return { valLength: valLength, addMask: addMask };
29
16
  }
30
17
  export default useInteractions;
package/README.md CHANGED
@@ -23,6 +23,7 @@
23
23
  - [PasswordInput](#passwordinput)
24
24
  - [PhoneNumberInput](#phonenumberinput)
25
25
  - [TabGroup](#tabgroup)
26
+ - [TextInput](#textinput)
26
27
  - [ToastPrompt](#toastprompt)
27
28
  - [VideoPlayerModal](#videoplayermodal)
28
29
  - [Changelog](#changelog)
@@ -33,7 +34,7 @@
33
34
 
34
35
  It is available as an [npm package](https://www.npmjs.com/package/@symply.io/basic-components).
35
36
 
36
- ```bash
37
+ ```shell
37
38
  // with npm
38
39
  npm install @symply.io/basic-components
39
40
 
@@ -58,9 +59,9 @@ Diglog component for alerts or confirmations.
58
59
  <h5>Import</h5>
59
60
 
60
61
  ```typescript
61
- import { AlertDialog } from '@symply.io/symply-basic-components';
62
+ import { AlertDialog } from '@symply.io/basic-components/';
62
63
  // or
63
- import AlertDialog from '@symply.io/symply-basic-components/AlertDialog';
64
+ import AlertDialog from '@symply.io/basic-components/AlertDialog';
64
65
  ```
65
66
 
66
67
  <h5>Props</h5>
@@ -83,9 +84,9 @@ Reusable modal component.
83
84
  <h5>Import</h5>
84
85
 
85
86
  ```typescript
86
- import { BasicModal } from '@symply.io/symply-basic-components';
87
+ import { BasicModal } from '@symply.io/basic-components/';
87
88
  // or
88
- import BasicModal from '@symply.io/symply-basic-components/BasicModal';
89
+ import BasicModal from '@symply.io/basic-components/BasicModal';
89
90
  ```
90
91
 
91
92
  <h5>Props</h5>
@@ -119,9 +120,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
119
120
  <h5>Import</h5>
120
121
 
121
122
  ```typescript
122
- import { DigitInput } from '@symply.io/symply-basic-components';
123
+ import { DigitInput } from '@symply.io/basic-components/';
123
124
  // or
124
- import DigitInput from '@symply.io/symply-basic-components/DigitInput';
125
+ import DigitInput from '@symply.io/basic-components/DigitInput';
125
126
  ```
126
127
 
127
128
  <h5>Props</h5>
@@ -144,9 +145,9 @@ Radio Group allow the user to select one option from a set.
144
145
  <h5>Import</h5>
145
146
 
146
147
  ```typescript
147
- import { FormRadioGroup } from '@symply.io/symply-basic-components';
148
+ import { FormRadioGroup } from '@symply.io/basic-components/';
148
149
  // or
149
- import FormRadioGroup from '@symply.io/symply-basic-components/FormRadioGroup';
150
+ import FormRadioGroup from '@symply.io/basic-components/FormRadioGroup';
150
151
  ```
151
152
 
152
153
  <h5>Radio Option Props</h5>
@@ -179,9 +180,9 @@ Selector components are used for collecting user provided information from a lis
179
180
 
180
181
  ```typescript
181
182
  // Simple Selector
182
- import { SimpleSelector } from '@symply.io/symply-basic-components/FormSelector';
183
+ import { SimpleSelector } from '@symply.io/basic-components/FormSelector';
183
184
  // Multiple Selector
184
- import { MultipleSelector } from '@symply.io/symply-basic-components/FormRadioGroup';
185
+ import { MultipleSelector } from '@symply.io/basic-components/FormRadioGroup';
185
186
  ```
186
187
 
187
188
  <h5>Selector Option Props</h5>
@@ -230,9 +231,9 @@ You can use it to add a hint/help paragraph.
230
231
  <h5>Import</h5>
231
232
 
232
233
  ```typescript
233
- import { HelpCaption } from '@symply.io/symply-basic-components';
234
+ import { HelpCaption } from '@symply.io/basic-components/';
234
235
  // or
235
- import HelpCaption from '@symply.io/symply-basic-components/HelpCaption';
236
+ import HelpCaption from '@symply.io/basic-components/HelpCaption';
236
237
  ```
237
238
 
238
239
  <h5>Props</h5>
@@ -254,9 +255,9 @@ A modal for loading.
254
255
  <h5>Import</h5>
255
256
 
256
257
  ```typescript
257
- import { LoadingModal } from '@symply.io/symply-basic-components';
258
+ import { LoadingModal } from '@symply.io/basic-components/';
258
259
  // or
259
- import LoadingModal from '@symply.io/symply-basic-components/LoadingModal';
260
+ import LoadingModal from '@symply.io/basic-components/LoadingModal';
260
261
  ```
261
262
 
262
263
  <h5>Props</h5>
@@ -278,9 +279,9 @@ A button with menu options.
278
279
  <h5>Import</h5>
279
280
 
280
281
  ```typescript
281
- import { MenuButtonGroup } from '@symply.io/symply-basic-components';
282
+ import { MenuButtonGroup } from '@symply.io/basic-components/';
282
283
  // or
283
- import MenuButtonGroup from '@symply.io/symply-basic-components/MenuButtonGroup';
284
+ import MenuButtonGroup from '@symply.io/basic-components/MenuButtonGroup';
284
285
  ```
285
286
 
286
287
  <h5>Menu Button Props</h5>
@@ -315,9 +316,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
315
316
  <h5>Import</h5>
316
317
 
317
318
  ```typescript
318
- import { NumberInput } from '@symply.io/symply-basic-components';
319
+ import { NumberInput } from '@symply.io/basic-components/';
319
320
  // or
320
- import NumberInput from '@symply.io/symply-basic-components/NumberInput';
321
+ import NumberInput from '@symply.io/basic-components/NumberInput';
321
322
  ```
322
323
 
323
324
  <h5>Props</h5>
@@ -343,9 +344,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
343
344
 
344
345
  ```typescript
345
346
  // Password
346
- import { Password } from '@symply.io/symply-basic-components/PasswordInput';
347
+ import { Password } from '@symply.io/basic-components/PasswordInput';
347
348
  // Confirm Password
348
- import { ConfirmPassword } from '@symply.io/symply-basic-components/PasswordInput';
349
+ import { ConfirmPassword } from '@symply.io/basic-components/PasswordInput';
349
350
  ```
350
351
 
351
352
  <h5>Password Props</h5>
@@ -377,9 +378,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
377
378
  <h5>Import</h5>
378
379
 
379
380
  ```typescript
380
- import { PhoneNumberInput } from '@symply.io/symply-basic-components';
381
+ import { PhoneNumberInput } from '@symply.io/basic-components/';
381
382
  // or
382
- import PhoneNumberInput from '@symply.io/symply-basic-components/PhoneNumberInput';
383
+ import PhoneNumberInput from '@symply.io/basic-components/PhoneNumberInput';
383
384
  ```
384
385
 
385
386
  <h5>Props</h5>
@@ -399,9 +400,9 @@ Tabs group.
399
400
  <h5>Import</h5>
400
401
 
401
402
  ```typescript
402
- import { TabGroup } from '@symply.io/symply-basic-components';
403
+ import { TabGroup } from '@symply.io/basic-components/';
403
404
  // or
404
- import TabGroup from '@symply.io/symply-basic-components/TabGroup';
405
+ import TabGroup from '@symply.io/basic-components/TabGroup';
405
406
  ```
406
407
 
407
408
  <h5>Props</h5>
@@ -425,9 +426,9 @@ It is extended from `@mui/material/TextField`, so it includes all properties of
425
426
  <h5>Import</h5>
426
427
 
427
428
  ```typescript
428
- import { TextInput } from '@symply.io/symply-basic-components';
429
+ import { TextInput } from '@symply.io/basic-components/';
429
430
  // or
430
- import TextInput from '@symply.io/symply-basic-components/TextInput';
431
+ import TextInput from '@symply.io/basic-components/TextInput';
431
432
  ```
432
433
 
433
434
  <h5>Props</h5>
@@ -449,7 +450,7 @@ Global prompt component.
449
450
  <h5>Import</h5>
450
451
 
451
452
  ```typescript
452
- import { usePrompt } from '@symply.io/symply-basic-components';
453
+ import { usePrompt } from '@symply.io/basic-components';
453
454
  ```
454
455
 
455
456
  <h5>Usage</h5>
@@ -474,9 +475,9 @@ A modal for playing videos.
474
475
  <h5>Import</h5>
475
476
 
476
477
  ```typescript
477
- import { VideoPlayerModal } from '@symply.io/symply-basic-components';
478
+ import { VideoPlayerModal } from '@symply.io/basic-components/';
478
479
  // or
479
- import VideoPlayerModal from '@symply.io/symply-basic-components/VideoPlayerModal';
480
+ import VideoPlayerModal from '@symply.io/basic-components/VideoPlayerModal';
480
481
  ```
481
482
 
482
483
  <h5>Props</h5>
@@ -495,5 +496,5 @@ import VideoPlayerModal from '@symply.io/symply-basic-components/VideoPlayerModa
495
496
 
496
497
  <h2>Changelog</h2>
497
498
 
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
+ 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
500
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.5",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",