@worldcoin/mini-apps-ui-kit-react 1.3.3 → 1.3.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.
@@ -0,0 +1,40 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../lib/utils.js";
3
+ function Eye({ className }) {
4
+ return /* @__PURE__ */ jsxs(
5
+ "svg",
6
+ {
7
+ width: "24",
8
+ height: "24",
9
+ viewBox: "0 0 24 24",
10
+ fill: "none",
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ className: cn("size-6", className),
13
+ children: [
14
+ /* @__PURE__ */ jsx(
15
+ "path",
16
+ {
17
+ d: "M3 13C6.6 5 17.4 5 21 13",
18
+ stroke: "currentColor",
19
+ strokeWidth: "1.5",
20
+ strokeLinecap: "square",
21
+ strokeLinejoin: "round"
22
+ }
23
+ ),
24
+ /* @__PURE__ */ jsx(
25
+ "path",
26
+ {
27
+ d: "M12 17C10.3431 17 9 15.6569 9 14C9 12.3431 10.3431 11 12 11C13.6569 11 15 12.3431 15 14C15 15.6569 13.6569 17 12 17Z",
28
+ stroke: "currentColor",
29
+ strokeWidth: "1.5",
30
+ strokeLinecap: "square",
31
+ strokeLinejoin: "round"
32
+ }
33
+ )
34
+ ]
35
+ }
36
+ );
37
+ }
38
+ export {
39
+ Eye
40
+ };
@@ -0,0 +1,60 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { cn } from "../../lib/utils.js";
3
+ function EyeClosed({ className }) {
4
+ return /* @__PURE__ */ jsxs(
5
+ "svg",
6
+ {
7
+ width: "24",
8
+ height: "24",
9
+ viewBox: "0 0 24 24",
10
+ fill: "none",
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ className: cn("size-6", className),
13
+ children: [
14
+ /* @__PURE__ */ jsx(
15
+ "path",
16
+ {
17
+ d: "M19.5001 16L17.0249 12.6038",
18
+ stroke: "currentColor",
19
+ strokeWidth: "1.5",
20
+ strokeLinecap: "round",
21
+ strokeLinejoin: "round"
22
+ }
23
+ ),
24
+ /* @__PURE__ */ jsx(
25
+ "path",
26
+ {
27
+ d: "M12 17.5V14",
28
+ stroke: "currentColor",
29
+ strokeWidth: "1.5",
30
+ strokeLinecap: "round",
31
+ strokeLinejoin: "round"
32
+ }
33
+ ),
34
+ /* @__PURE__ */ jsx(
35
+ "path",
36
+ {
37
+ d: "M4.5 16L6.96895 12.6124",
38
+ stroke: "currentColor",
39
+ strokeWidth: "1.5",
40
+ strokeLinecap: "round",
41
+ strokeLinejoin: "round"
42
+ }
43
+ ),
44
+ /* @__PURE__ */ jsx(
45
+ "path",
46
+ {
47
+ d: "M3 8C6.6 16 17.4 16 21 8",
48
+ stroke: "currentColor",
49
+ strokeWidth: "1.5",
50
+ strokeLinecap: "round",
51
+ strokeLinejoin: "round"
52
+ }
53
+ )
54
+ ]
55
+ }
56
+ );
57
+ }
58
+ export {
59
+ EyeClosed
60
+ };
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import haptics from "../../lib/haptics.js";
4
+ import { forwardRef, useState } from "react";
5
+ import { Eye } from "../Icons/Eye.js";
6
+ import { EyeClosed } from "../Icons/EyeClosed.js";
7
+ import { Input } from "../Input/Input.js";
8
+ const PasswordField = forwardRef(
9
+ ({
10
+ isValid,
11
+ disabled,
12
+ type = "password",
13
+ autoComplete = "current-password",
14
+ spellCheck = "false",
15
+ inputMode = "text",
16
+ autoCapitalize = "off",
17
+ autoCorrect = "off",
18
+ ...props
19
+ }, ref) => {
20
+ const [showPassword, setShowPassword] = useState(false);
21
+ return /* @__PURE__ */ jsx(
22
+ Input,
23
+ {
24
+ ...props,
25
+ ref,
26
+ isValid,
27
+ disabled,
28
+ endAdornment: /* @__PURE__ */ jsx(
29
+ "button",
30
+ {
31
+ type: "button",
32
+ onClick: () => {
33
+ setShowPassword(!showPassword);
34
+ haptics.impact("light");
35
+ },
36
+ children: showPassword ? /* @__PURE__ */ jsx(EyeClosed, {}) : /* @__PURE__ */ jsx(Eye, {})
37
+ }
38
+ ),
39
+ type: showPassword ? "text" : "password",
40
+ autoComplete,
41
+ spellCheck,
42
+ inputMode,
43
+ autoCapitalize,
44
+ autoCorrect
45
+ }
46
+ );
47
+ }
48
+ );
49
+ PasswordField.displayName = "PasswordField";
50
+ export {
51
+ PasswordField
52
+ };
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import React__default from "react";
3
4
  import { cn } from "../../lib/utils.js";
@@ -1,7 +1,29 @@
1
+ "use client";
2
+ import { useState, useEffect } from "react";
3
+ const defaultSafeAreaInsets = {
4
+ top: 0,
5
+ right: 0,
6
+ bottom: 0,
7
+ left: 0
8
+ };
1
9
  function useSafeAreaInsets() {
2
- var _a, _b;
3
- const safeAreaInsets = (_b = (_a = window == null ? void 0 : window.MiniKit) == null ? void 0 : _a.deviceProperties) == null ? void 0 : _b.safeAreaInsets;
4
- return safeAreaInsets ?? { top: 0, right: 0, bottom: 0, left: 0 };
10
+ const [safeAreaInsets, setSafeAreaInsets] = useState(() => {
11
+ var _a, _b;
12
+ if (typeof window !== "undefined") {
13
+ return ((_b = (_a = window == null ? void 0 : window.MiniKit) == null ? void 0 : _a.deviceProperties) == null ? void 0 : _b.safeAreaInsets) ?? defaultSafeAreaInsets;
14
+ }
15
+ return defaultSafeAreaInsets;
16
+ });
17
+ useEffect(() => {
18
+ var _a, _b;
19
+ if (typeof window !== "undefined") {
20
+ const insets = (_b = (_a = window == null ? void 0 : window.MiniKit) == null ? void 0 : _a.deviceProperties) == null ? void 0 : _b.safeAreaInsets;
21
+ if (insets && JSON.stringify(insets) !== JSON.stringify(safeAreaInsets)) {
22
+ setSafeAreaInsets(insets);
23
+ }
24
+ }
25
+ }, [safeAreaInsets]);
26
+ return safeAreaInsets;
5
27
  }
6
28
  export {
7
29
  useSafeAreaInsets
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export { Input } from './components/Input';
11
11
  export { ListItem } from './components/ListItem';
12
12
  export { NumberPad } from './components/NumberPad';
13
13
  export { OTPField } from './components/OTPField';
14
+ export { PasswordField } from './components/PasswordField';
14
15
  export { Pill } from './components/Pill';
15
16
  export { RadioGroup, RadioGroupItem } from './components/RadioGroup';
16
17
  export { Select } from './components/Select';
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@ import { Input } from "./components/Input/Input.js";
11
11
  import { ListItem } from "./components/ListItem/ListItem.js";
12
12
  import { NumberPad } from "./components/NumberPad/NumberPad.js";
13
13
  import { OTPField } from "./components/OTPField/OTPField.js";
14
+ import { PasswordField } from "./components/PasswordField/PasswordField.js";
14
15
  import { Pill } from "./components/Pill/Pill.js";
15
16
  import { RadioGroup } from "./components/RadioGroup/RadioGroup.js";
16
17
  import { RadioGroupItem } from "./components/RadioGroup/RadioGroupItem.js";
@@ -78,6 +79,7 @@ export {
78
79
  Marble,
79
80
  NumberPad,
80
81
  OTPField,
82
+ PasswordField,
81
83
  PhoneField,
82
84
  Pill,
83
85
  Progress,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worldcoin/mini-apps-ui-kit-react",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",