ar-design 0.2.13 → 0.2.14

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.
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import React, { useRef, useState } from "react";
2
+ import React, { useEffect, useRef, useState } from "react";
3
3
  import "../../../assets/css/components/form/switch/styles.css";
4
4
  import Utils from "../../../libs/infrastructure/shared/Utils";
5
5
  const Switch = ({ label, status = "primary", border = { radius: "pill" }, ...attributes }) => {
@@ -9,6 +9,10 @@ const Switch = ({ label, status = "primary", border = { radius: "pill" }, ...att
9
9
  // states
10
10
  const [checked, setChecked] = useState(attributes.checked ?? false);
11
11
  _switchClassName.push(...Utils.GetClassName("filled", checked ? status : "light", border, undefined, undefined, attributes.className));
12
+ // useEffects
13
+ useEffect(() => {
14
+ setChecked(attributes.checked ?? false);
15
+ }, [attributes.checked]);
12
16
  return (React.createElement("div", { className: "ar-switch-wrapper" },
13
17
  React.createElement("label", null,
14
18
  React.createElement("input", { type: "checkbox", ...attributes, checked: checked, size: 0, onChange: (event) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",