@worldcoin/mini-apps-ui-kit-react 0.0.5 → 0.0.6

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,19 +1,19 @@
1
1
  "use client";
2
- import { jsx as o, jsxs as c } from "react/jsx-runtime";
3
- import { DROPDOWN_CONTAINER_STYLES as J } from "../../lib/constants/dropdownStyles.js";
4
- import { cn as K } from "../../lib/utils.js";
5
- import { Root as Q, Trigger as Z, Portal as ee, Content as oe, Viewport as te, Item as re } from "../../node_modules/.pnpm/@radix-ui_react-select@2.1.4_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18.3._atdh45n5c7sked5b6tbwgdz7re/node_modules/@radix-ui/react-select/dist/index.js";
6
- import { forwardRef as ne, useRef as ae, useState as w, useMemo as F, useImperativeHandle as se } from "react";
7
- import { usePhoneInput as le, parseCountry as O } from "../../node_modules/.pnpm/react-international-phone@4.4.0_react@18.3.1/node_modules/react-international-phone/dist/index.js";
8
- import { Drawer as ie, DrawerTrigger as ce, DrawerContent as ue, DrawerClose as de } from "../Drawer/Drawer.js";
9
- import { Input as me } from "../Input/Input.js";
10
- import { SearchField as he } from "../SearchField/SearchField.js";
2
+ import { jsx as t, jsxs as c } from "react/jsx-runtime";
3
+ import { DROPDOWN_CONTAINER_STYLES as te } from "../../lib/constants/dropdownStyles.js";
4
+ import { cn as oe } from "../../lib/utils.js";
5
+ import { Root as re, Trigger as ne, Portal as ae, Content as le, Viewport as se, Item as ie } from "../../node_modules/.pnpm/@radix-ui_react-select@2.1.4_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18.3._atdh45n5c7sked5b6tbwgdz7re/node_modules/@radix-ui/react-select/dist/index.js";
6
+ import { forwardRef as ce, useRef as ue, useState as w, useMemo as F, useImperativeHandle as de } from "react";
7
+ import { usePhoneInput as me, parseCountry as O } from "../../node_modules/.pnpm/react-international-phone@4.4.0_react@18.3.1/node_modules/react-international-phone/dist/index.js";
8
+ import { Drawer as he, DrawerTrigger as fe, DrawerContent as pe, DrawerClose as Ce } from "../Drawer/Drawer.js";
9
+ import { Input as ye } from "../Input/Input.js";
10
+ import { SearchField as we } from "../SearchField/SearchField.js";
11
11
  import { Typography as P } from "../Typography/Typography.js";
12
12
  import L from "./CountryListItem.js";
13
13
  import R from "./CountrySelectorButton.js";
14
- import { DIAL_CODE_PREFIX as g, startAdornmentWidthByDialCodeLength as pe } from "./constants.js";
15
- import { getCountryDataListByCodes as fe, getValidatedCountryCode as u, filterCountries as Ce } from "./utils.js";
16
- const ye = ne(
14
+ import { DIAL_CODE_PREFIX as g, startAdornmentWidthByDialCodeLength as ge } from "./constants.js";
15
+ import { getCountryDataListByCodes as xe, getValidatedCountryCode as u, filterCountries as Ne } from "./utils.js";
16
+ const Se = ce(
17
17
  ({
18
18
  value: T,
19
19
  onChange: d,
@@ -22,15 +22,20 @@ const ye = ne(
22
22
  defaultCountryCode: n = "US",
23
23
  hideDialCode: m = !1,
24
24
  disableDialCodePrefill: E = !0,
25
- disabled: l = !1,
25
+ disabled: s = !1,
26
26
  error: b = !1,
27
27
  isValid: V,
28
28
  endAdornment: W,
29
29
  endAdornmentWidth: B,
30
30
  countrySelectorMode: _ = "dropdown",
31
- ...j
32
- }, k) => {
33
- const N = ae(null), [h, p] = w(!1), [M, f] = w(!1), [C, S] = w(""), i = F(() => fe(x), [x]), { inputValue: q, country: y, inputRef: a, handlePhoneValueChange: H, setCountry: U } = le(
31
+ type: j = "tel",
32
+ inputMode: k = "tel",
33
+ autoComplete: M = "tel",
34
+ autoCapitalize: q = "off",
35
+ autoCorrect: H = "off",
36
+ ...U
37
+ }, X) => {
38
+ const N = ue(null), [h, f] = w(!1), [Y, p] = w(!1), [C, S] = w(""), i = F(() => xe(x), [x]), { inputValue: z, country: y, inputRef: a, handlePhoneValueChange: G, setCountry: J } = me(
34
39
  {
35
40
  defaultCountry: n.toLowerCase(),
36
41
  disableDialCodePrefill: E,
@@ -43,67 +48,72 @@ const ye = ne(
43
48
  );
44
49
  }
45
50
  }
46
- ), s = u(y.iso2, n), X = 2.8, D = `${g}${y.dialCode}`, Y = m ? X : pe[y.dialCode.length];
47
- se(k, () => a.current);
51
+ ), l = u(y.iso2, n), K = 2.8, D = `${g}${y.dialCode}`, Q = m ? K : ge[y.dialCode.length];
52
+ de(X, () => a.current);
48
53
  const v = (e) => {
49
- e == null || e.preventDefault(), M && requestAnimationFrame(() => {
50
- var t;
51
- (t = a.current) == null || t.focus();
52
- }), f(!1);
53
- }, z = (e) => {
54
+ e == null || e.preventDefault(), Y && requestAnimationFrame(() => {
55
+ var o;
56
+ (o = a.current) == null || o.focus();
57
+ }), p(!1);
58
+ }, Z = (e) => {
54
59
  var r;
55
- const t = (r = N.current) == null ? void 0 : r.contains(e.target);
56
- f(!!t);
60
+ const o = (r = N.current) == null ? void 0 : r.contains(e.target);
61
+ p(!!o);
57
62
  }, A = (e) => {
58
- U(e.toLowerCase()), p(!1);
59
- }, G = (e) => {
63
+ J(e.toLowerCase()), f(!1);
64
+ }, ee = (e) => {
60
65
  S(e.target.value);
61
66
  }, I = F(
62
- () => Ce(i, C),
67
+ () => Ne(i, C),
63
68
  [i, C]
64
69
  );
65
- return /* @__PURE__ */ o(
66
- me,
70
+ return /* @__PURE__ */ t(
71
+ ye,
67
72
  {
68
- ...j,
73
+ ...U,
69
74
  ref: a,
70
- value: q,
71
- onChange: H,
75
+ type: j,
76
+ inputMode: k,
77
+ autoComplete: M,
78
+ autoCapitalize: q,
79
+ autoCorrect: H,
80
+ value: z,
81
+ onChange: G,
72
82
  placeholder: $,
73
- disabled: l,
83
+ disabled: s,
74
84
  error: b,
75
85
  isValid: V,
76
86
  endAdornment: W,
77
87
  endAdornmentWidth: B,
78
- startAdornmentWidth: Y,
88
+ startAdornmentWidth: Q,
79
89
  isFocused: h,
80
90
  startAdornment: _ === "drawer" ? /* @__PURE__ */ c(
81
- ie,
91
+ he,
82
92
  {
83
93
  open: h,
84
- onOpenChange: p,
94
+ onOpenChange: f,
85
95
  onClose: v,
86
96
  onAnimationEnd: (e) => {
87
- e && f(!0);
97
+ e && p(!0);
88
98
  },
89
99
  children: [
90
- /* @__PURE__ */ o(ce, { asChild: !0, className: "outline-none", children: /* @__PURE__ */ o(
100
+ /* @__PURE__ */ t(fe, { asChild: !0, className: "outline-none", children: /* @__PURE__ */ t(
91
101
  R,
92
102
  {
93
- disabled: l,
94
- countryCode: s,
103
+ disabled: s,
104
+ countryCode: l,
95
105
  hideDialCode: m,
96
106
  dialCode: D
97
107
  }
98
108
  ) }),
99
- /* @__PURE__ */ o(ue, { className: "h-[96%]", children: /* @__PURE__ */ c("div", { className: "max-w-md w-full mx-auto flex flex-col flex-grow", children: [
100
- /* @__PURE__ */ o(P, { variant: "subtitle", level: 2, className: "px-4 py-2", children: "Select country" }),
101
- /* @__PURE__ */ o("div", { className: "px-4 pt-2 pb-4", children: /* @__PURE__ */ o(
102
- he,
109
+ /* @__PURE__ */ t(pe, { className: "h-[96%]", children: /* @__PURE__ */ c("div", { className: "max-w-md w-full mx-auto flex flex-col flex-grow", children: [
110
+ /* @__PURE__ */ t(P, { variant: "subtitle", level: 2, className: "px-4 py-2", children: "Select country" }),
111
+ /* @__PURE__ */ t("div", { className: "px-4 pt-2 pb-4", children: /* @__PURE__ */ t(
112
+ we,
103
113
  {
104
114
  placeholder: "Search name or number",
105
115
  value: C,
106
- onChange: G
116
+ onChange: ee
107
117
  }
108
118
  ) }),
109
119
  /* @__PURE__ */ c(
@@ -117,24 +127,24 @@ const ye = ne(
117
127
  },
118
128
  children: [
119
129
  I.map((e) => {
120
- const t = O(e), r = u(
121
- t.iso2,
130
+ const o = O(e), r = u(
131
+ o.iso2,
122
132
  n
123
133
  );
124
- return /* @__PURE__ */ o(de, { className: "block w-full", children: /* @__PURE__ */ o(
134
+ return /* @__PURE__ */ t(Ce, { className: "block w-full", children: /* @__PURE__ */ t(
125
135
  L,
126
136
  {
127
137
  countryCode: r,
128
- countryName: t.name,
129
- dialCode: `${g}${t.dialCode}`,
138
+ countryName: o.name,
139
+ dialCode: `${g}${o.dialCode}`,
130
140
  onClick: () => {
131
141
  A(r), S("");
132
142
  },
133
- isSelected: s === r
143
+ isSelected: l === r
134
144
  }
135
145
  ) }, r);
136
146
  }),
137
- I.length === 0 && /* @__PURE__ */ o(P, { variant: "body", level: 2, className: "text-center", children: "No countries found" })
147
+ I.length === 0 && /* @__PURE__ */ t(P, { variant: "body", level: 2, className: "text-center", children: "No countries found" })
138
148
  ]
139
149
  }
140
150
  )
@@ -142,50 +152,50 @@ const ye = ne(
142
152
  ]
143
153
  }
144
154
  ) : /* @__PURE__ */ c(
145
- Q,
155
+ re,
146
156
  {
147
- value: s,
157
+ value: l,
148
158
  open: h,
149
- onOpenChange: p,
159
+ onOpenChange: f,
150
160
  onValueChange: A,
151
- disabled: l,
161
+ disabled: s,
152
162
  children: [
153
- /* @__PURE__ */ o(Z, { children: /* @__PURE__ */ o(
163
+ /* @__PURE__ */ t(ne, { children: /* @__PURE__ */ t(
154
164
  R,
155
165
  {
156
- disabled: l,
157
- countryCode: s,
166
+ disabled: s,
167
+ countryCode: l,
158
168
  hideDialCode: m,
159
169
  dialCode: D
160
170
  }
161
171
  ) }),
162
- /* @__PURE__ */ o(ee, { children: /* @__PURE__ */ o(
163
- oe,
172
+ /* @__PURE__ */ t(ae, { children: /* @__PURE__ */ t(
173
+ le,
164
174
  {
165
175
  ref: (e) => {
166
176
  N.current = e, e && a.current && (e.style.width = `${a.current.offsetWidth}px`);
167
177
  },
168
178
  position: "popper",
169
- className: K(J, "-ml-3 mt-5 w-auto"),
179
+ className: oe(te, "-ml-3 mt-5 w-auto"),
170
180
  onCloseAutoFocus: v,
171
- onPointerDown: z,
172
- children: /* @__PURE__ */ o(te, { className: "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] p-2", children: i.map((e) => {
173
- const t = O(e), r = u(
174
- t.iso2,
181
+ onPointerDown: Z,
182
+ children: /* @__PURE__ */ t(se, { className: "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] p-2", children: i.map((e) => {
183
+ const o = O(e), r = u(
184
+ o.iso2,
175
185
  n
176
186
  );
177
- return /* @__PURE__ */ o(
178
- re,
187
+ return /* @__PURE__ */ t(
188
+ ie,
179
189
  {
180
190
  value: r,
181
191
  className: "outline-none",
182
- children: /* @__PURE__ */ o(
192
+ children: /* @__PURE__ */ t(
183
193
  L,
184
194
  {
185
195
  countryCode: r,
186
- countryName: t.name,
187
- dialCode: `${g}${t.dialCode}`,
188
- isSelected: s === r
196
+ countryName: o.name,
197
+ dialCode: `${g}${o.dialCode}`,
198
+ isSelected: l === r
189
199
  }
190
200
  )
191
201
  },
@@ -201,8 +211,8 @@ const ye = ne(
201
211
  );
202
212
  }
203
213
  );
204
- ye.displayName = "PhoneField";
214
+ Se.displayName = "PhoneField";
205
215
  export {
206
- ye as PhoneField,
207
- ye as default
216
+ Se as PhoneField,
217
+ Se as default
208
218
  };
@@ -7,16 +7,16 @@ export interface TypographyProps extends React.HTMLAttributes<HTMLElement> {
7
7
  as?: "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | "small" | "strong" | "div" | "em";
8
8
  }
9
9
  export interface TypographyNumberProps extends TypographyProps {
10
- variant: "number";
11
- level: 1 | 2 | 3 | 4 | 5 | 6;
10
+ variant?: "number";
11
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
12
12
  }
13
13
  export interface TypographySubtitleBodyMonoProps extends TypographyProps {
14
- variant: "subtitle" | "body" | "mono";
15
- level: 1 | 2 | 3 | 4;
14
+ variant?: "subtitle" | "body" | "mono";
15
+ level?: 1 | 2 | 3 | 4;
16
16
  }
17
17
  export interface TypographyHeadingProps extends TypographyProps {
18
- variant: "heading";
19
- level: 1 | 2 | 3;
18
+ variant?: "heading";
19
+ level?: 1 | 2 | 3;
20
20
  }
21
21
  export type TypographyComponentProps = TypographyNumberProps | TypographySubtitleBodyMonoProps | TypographyHeadingProps;
22
22
  export declare const typographyVariants: (props?: ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worldcoin/mini-apps-ui-kit-react",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",