ar-design 0.3.70 → 0.3.71

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.
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import "../../../assets/css/components/form/input/styles.css";
3
3
  import IProps from "./IProps";
4
4
  import Otp from "./otp/Otp";
5
- import Num from "./num";
5
+ import Num from "./num/Num";
6
6
  interface InputCompound extends React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLInputElement>> {
7
7
  Number: typeof Num;
8
8
  Otp: typeof Otp;
@@ -5,7 +5,7 @@ import Button from "../button";
5
5
  import Utils from "../../../libs/infrastructure/shared/Utils";
6
6
  import { ARIcon } from "../../icons";
7
7
  import Otp from "./otp/Otp";
8
- import Num from "./num";
8
+ import Num from "./num/Num";
9
9
  const BaseInput = forwardRef(({ variant = "outlined", color = "light", icon, border = { radius: "sm" }, button, addon, upperCase, validation, ...attributes }, ref) => {
10
10
  // refs
11
11
  const _innerRef = useRef(null);
@@ -18,9 +18,10 @@ const Otp = ({ character, onChange, ...attributes }) => {
18
18
  if (!_inputs.current[index + 1]) {
19
19
  _inputs.current[character - 1]?.focus();
20
20
  _inputs.current[character - 1]?.select();
21
- return;
22
21
  }
23
- _inputs.current[index + 1]?.focus();
22
+ else {
23
+ _inputs.current[index + 1]?.focus();
24
+ }
24
25
  }
25
26
  onChange?.({
26
27
  ...event,
@@ -47,6 +48,18 @@ const Otp = ({ character, onChange, ...attributes }) => {
47
48
  const input = _inputs.current[i];
48
49
  if (input) {
49
50
  input.value = chars[i];
51
+ _value.current = { ..._value.current, [i]: chars[i] };
52
+ onChange?.({
53
+ ...event,
54
+ target: {
55
+ ...event.currentTarget,
56
+ name: attributes.name ?? "",
57
+ value: Object.keys(_value.current)
58
+ .sort((a, b) => Number(a) - Number(b))
59
+ .map((key) => _value.current[Number(key)])
60
+ .join(""),
61
+ },
62
+ });
50
63
  input.focus();
51
64
  }
52
65
  i++;
package/dist/index.d.ts CHANGED
@@ -5,7 +5,6 @@ import ButtonGroup from "./components/form/button-group";
5
5
  import Checkbox from "./components/form/checkbox";
6
6
  import DatePicker from "./components/form/date-picker";
7
7
  import Input from "./components/form/input";
8
- import InputTag from "./components/form/input-tag";
9
8
  import Radio from "./components/form/radio";
10
9
  import Select from "./components/form/select";
11
10
  import Switch from "./components/form/switch";
@@ -34,4 +33,4 @@ import Pagination from "./components/navigation/pagination";
34
33
  import Steps from "./components/navigation/steps";
35
34
  import Grid from "./components/data-display/grid-system";
36
35
  import Layout from "./components/layout";
37
- export { Button, ButtonAction, ButtonGroup, Checkbox, DatePicker, Input, InputTag, Radio, Select, Switch, TextEditor, Upload, Card, Chip, Diagram, Divider, DnD, KanbanBoard, Paper, SyntaxHighlighter, Table, Tabs, Typography, Alert, Drawer, Modal, Popover, Progress, Tooltip, Breadcrumb, Menu, Pagination, Steps, Grid, Layout, };
36
+ export { Button, ButtonAction, ButtonGroup, Checkbox, DatePicker, Input, Radio, Select, Switch, TextEditor, Upload, Card, Chip, Diagram, Divider, DnD, KanbanBoard, Paper, SyntaxHighlighter, Table, Tabs, Typography, Alert, Drawer, Modal, Popover, Progress, Tooltip, Breadcrumb, Menu, Pagination, Steps, Grid, Layout, };
package/dist/index.js CHANGED
@@ -6,7 +6,6 @@ import ButtonGroup from "./components/form/button-group";
6
6
  import Checkbox from "./components/form/checkbox";
7
7
  import DatePicker from "./components/form/date-picker";
8
8
  import Input from "./components/form/input";
9
- import InputTag from "./components/form/input-tag";
10
9
  import Radio from "./components/form/radio";
11
10
  import Select from "./components/form/select";
12
11
  import Switch from "./components/form/switch";
@@ -41,7 +40,7 @@ import Grid from "./components/data-display/grid-system";
41
40
  import Layout from "./components/layout";
42
41
  export {
43
42
  // Form Elements
44
- Button, ButtonAction, ButtonGroup, Checkbox, DatePicker, Input, InputTag, Radio, Select, Switch, TextEditor, Upload,
43
+ Button, ButtonAction, ButtonGroup, Checkbox, DatePicker, Input, Radio, Select, Switch, TextEditor, Upload,
45
44
  // Data Display
46
45
  Card, Chip, Diagram, Divider, DnD, KanbanBoard, Paper, SyntaxHighlighter, Table, Tabs, Typography,
47
46
  // Feedback
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.3.70",
3
+ "version": "0.3.71",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,4 +0,0 @@
1
- import { IBorder, IIcon, IStatus, IUpperCase, IValidation, IVariant } from "../../../libs/types/IGlobalProps";
2
- interface IProps extends IVariant, IStatus, IBorder, IIcon, IUpperCase, IValidation, Omit<React.InputHTMLAttributes<HTMLInputElement>, "children" | "color"> {
3
- }
4
- export default IProps;
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import IProps from "./IProps";
3
- declare const InputTag: React.FC<IProps>;
4
- export default InputTag;
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- import Input from "../input";
3
- const InputTag = ({ ...attributes }) => {
4
- return React.createElement(Input, { ...attributes });
5
- };
6
- export default InputTag;