@worldcoin/mini-apps-ui-kit-react 0.0.1 → 0.0.3
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.
- package/LICENSE.md +21 -0
- package/README.md +42 -5
- package/dist/_virtual/plugin.js +7 -0
- package/dist/components/Flag/index.d.ts +1 -0
- package/dist/components/Flag/index.js +6 -4
- package/dist/components/PhoneField/PhoneField.d.ts +6 -1
- package/dist/components/PhoneField/PhoneField.js +121 -117
- package/dist/components/PhoneField/constants.d.ts +1 -1
- package/dist/components/PhoneField/constants.js +4 -4
- package/dist/components/PhoneField/index.d.ts +1 -0
- package/dist/components/PhoneField/index.js +3 -1
- package/dist/components/PhoneField/utils.d.ts +1 -0
- package/dist/components/PhoneField/utils.js +20 -11
- package/dist/components/Pill/Pill.js +0 -1
- package/dist/components/RadioGroup/RadioGroup.js +18 -24
- package/dist/components/RadioGroup/RadioGroupItem.js +15 -30
- package/dist/components/Typography/Typography.d.ts +21 -33
- package/dist/components/Typography/Typography.js +15 -15
- package/dist/index.js +41 -37
- package/dist/node_modules/.pnpm/tailwindcss@3.4.17/node_modules/tailwindcss/lib/public/create-plugin.js +24 -19
- package/dist/node_modules/.pnpm/tailwindcss@3.4.17/node_modules/tailwindcss/lib/util/createPlugin.js +31 -25
- package/dist/node_modules/.pnpm/tailwindcss@3.4.17/node_modules/tailwindcss/plugin.js +9 -7
- package/dist/tailwind/index.js +6 -1
- package/package.json +15 -13
- package/public/globals.css +1 -1885
- package/public/SFMono-Regular.otf +0 -0
package/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Tools for Humanity
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
React components UI Kit library for Mini Apps
|
4
4
|
|
5
|
+
> **⚠️ Security Notice**: This library has not been reviewed for security vulnerabilities. Use in production environments is discouraged until a security audit has been completed.
|
6
|
+
|
5
7
|
## Getting Started
|
6
8
|
|
7
9
|
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
@@ -66,13 +68,48 @@ The library uses three fonts:
|
|
66
68
|
Embed the following code in the `<head>` of your html to load the fonts:
|
67
69
|
|
68
70
|
```html
|
69
|
-
<link rel="preconnect" href="https://fonts.googleapis.com"
|
70
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin
|
71
|
-
<link
|
71
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
72
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
73
|
+
<link
|
74
|
+
href="https://fonts.googleapis.com/css2?family=DM+Mono:ital@0;1&family=Rubik:ital,wght@0,300..900;1,300..900&family=Sora:wght@600&display=swap"
|
75
|
+
rel="stylesheet"
|
76
|
+
/>
|
72
77
|
```
|
73
78
|
|
74
79
|
Or use the following code to load the fonts via CSS:
|
75
80
|
|
76
81
|
```css
|
77
|
-
@import url(
|
78
|
-
```
|
82
|
+
@import url("https://fonts.googleapis.com/css2?family=DM+Mono:ital@0;1&family=Rubik:ital,wght@0,300..900;1,300..900&family=Sora:wght@100..800&display=swap");
|
83
|
+
```
|
84
|
+
|
85
|
+
## Importing Styles
|
86
|
+
|
87
|
+
To use the UI Kit components with their proper styling, you need to import the styles in your application. Add the following import statement to your application's entry point (e.g., `app/layout.tsx` for Next.js or `main.tsx` for Vite):
|
88
|
+
|
89
|
+
```typescript
|
90
|
+
import "@worldcoin/mini-apps-ui-kit-react/styles.css";
|
91
|
+
```
|
92
|
+
|
93
|
+
## Import Methods
|
94
|
+
|
95
|
+
The library supports two different import methods:
|
96
|
+
|
97
|
+
### Default Import
|
98
|
+
|
99
|
+
Import components from the main entry point:
|
100
|
+
|
101
|
+
```typescript
|
102
|
+
import { Button } from "@worldcoin/mini-apps-ui-kit-react";
|
103
|
+
```
|
104
|
+
|
105
|
+
This method is simpler but includes all components in your bundle, even if you're not using them.
|
106
|
+
|
107
|
+
### Component-Level Import
|
108
|
+
|
109
|
+
Import components directly from their individual modules:
|
110
|
+
|
111
|
+
```typescript
|
112
|
+
import { Button } from "@worldcoin/mini-apps-ui-kit-react/Button";
|
113
|
+
```
|
114
|
+
|
115
|
+
This method enables tree-shaking and reduces your final bundle size by only including the components you actually use. Recommended for production applications where bundle size is a concern.
|
@@ -1,6 +1,8 @@
|
|
1
|
-
import { Flag as
|
2
|
-
import { LazyFlag as
|
1
|
+
import { Flag as e } from "./Flag.js";
|
2
|
+
import { LazyFlag as t } from "./LazyFlag.js";
|
3
|
+
import { isSupportedCountryCode as f } from "./utils.js";
|
3
4
|
export {
|
4
|
-
|
5
|
-
|
5
|
+
e as Flag,
|
6
|
+
t as LazyFlag,
|
7
|
+
f as isSupportedCountryCode
|
6
8
|
};
|
@@ -8,7 +8,12 @@ export interface PhoneFieldProps extends Omit<InputProps, "onChange" | "startAdo
|
|
8
8
|
/**
|
9
9
|
* Callback triggered when the phone number changes.
|
10
10
|
*/
|
11
|
-
onChange?: (phone: string) => void;
|
11
|
+
onChange?: (phone: string, countryCode: CountryCode) => void;
|
12
|
+
/**
|
13
|
+
* List of countries to display in the country selector.
|
14
|
+
* If not provided, all countries will be displayed.
|
15
|
+
*/
|
16
|
+
countries?: CountryCode[];
|
12
17
|
/**
|
13
18
|
* If true, the dial code will be hidden.
|
14
19
|
* The dial code is still displayed at the start of the input and in the dropdown.
|
@@ -1,108 +1,112 @@
|
|
1
1
|
"use client";
|
2
|
-
import { jsx as o, jsxs as
|
3
|
-
import { DROPDOWN_CONTAINER_STYLES as
|
4
|
-
import { cn as
|
5
|
-
import { Root as
|
6
|
-
import { forwardRef as
|
7
|
-
import { usePhoneInput as le, parseCountry as
|
8
|
-
import { Drawer as
|
9
|
-
import { Input as
|
10
|
-
import { SearchField as
|
11
|
-
import { Typography as
|
12
|
-
import
|
13
|
-
import
|
14
|
-
import {
|
15
|
-
import { getValidatedCountryCode as
|
16
|
-
const
|
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";
|
11
|
+
import { Typography as P } from "../Typography/Typography.js";
|
12
|
+
import L from "./CountryListItem.js";
|
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(
|
17
17
|
({
|
18
|
-
value:
|
19
|
-
onChange:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
18
|
+
value: T,
|
19
|
+
onChange: d,
|
20
|
+
countries: x,
|
21
|
+
placeholder: $ = "Enter phone number",
|
22
|
+
defaultCountryCode: n = "US",
|
23
|
+
hideDialCode: m = !1,
|
24
|
+
disableDialCodePrefill: E = !0,
|
25
|
+
disabled: l = !1,
|
26
|
+
error: b = !1,
|
27
|
+
isValid: V,
|
28
|
+
endAdornment: W,
|
29
|
+
endAdornmentWidth: B,
|
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(
|
33
34
|
{
|
34
|
-
defaultCountry:
|
35
|
-
disableDialCodePrefill:
|
36
|
-
value:
|
37
|
-
countries:
|
35
|
+
defaultCountry: n.toLowerCase(),
|
36
|
+
disableDialCodePrefill: E,
|
37
|
+
value: T,
|
38
|
+
countries: i,
|
38
39
|
onChange: (e) => {
|
39
|
-
|
40
|
+
d == null || d(
|
41
|
+
e.phone,
|
42
|
+
u(e.country.iso2, n)
|
43
|
+
);
|
40
44
|
}
|
41
45
|
}
|
42
|
-
),
|
43
|
-
|
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);
|
44
48
|
const v = (e) => {
|
45
|
-
e == null || e.preventDefault(),
|
49
|
+
e == null || e.preventDefault(), M && requestAnimationFrame(() => {
|
46
50
|
var t;
|
47
|
-
(t =
|
48
|
-
}),
|
49
|
-
},
|
51
|
+
(t = a.current) == null || t.focus();
|
52
|
+
}), f(!1);
|
53
|
+
}, z = (e) => {
|
50
54
|
var r;
|
51
|
-
const t = (r =
|
52
|
-
|
53
|
-
},
|
54
|
-
|
55
|
-
},
|
56
|
-
|
57
|
-
},
|
58
|
-
() =>
|
59
|
-
[
|
55
|
+
const t = (r = N.current) == null ? void 0 : r.contains(e.target);
|
56
|
+
f(!!t);
|
57
|
+
}, A = (e) => {
|
58
|
+
U(e.toLowerCase()), p(!1);
|
59
|
+
}, G = (e) => {
|
60
|
+
S(e.target.value);
|
61
|
+
}, I = F(
|
62
|
+
() => Ce(i, C),
|
63
|
+
[i, C]
|
60
64
|
);
|
61
65
|
return /* @__PURE__ */ o(
|
62
|
-
|
66
|
+
me,
|
63
67
|
{
|
64
|
-
...
|
65
|
-
ref:
|
66
|
-
value:
|
67
|
-
onChange:
|
68
|
-
placeholder:
|
69
|
-
disabled:
|
70
|
-
error:
|
71
|
-
isValid:
|
72
|
-
endAdornment:
|
73
|
-
endAdornmentWidth:
|
74
|
-
startAdornmentWidth:
|
75
|
-
isFocused:
|
76
|
-
startAdornment:
|
77
|
-
|
68
|
+
...j,
|
69
|
+
ref: a,
|
70
|
+
value: q,
|
71
|
+
onChange: H,
|
72
|
+
placeholder: $,
|
73
|
+
disabled: l,
|
74
|
+
error: b,
|
75
|
+
isValid: V,
|
76
|
+
endAdornment: W,
|
77
|
+
endAdornmentWidth: B,
|
78
|
+
startAdornmentWidth: Y,
|
79
|
+
isFocused: h,
|
80
|
+
startAdornment: _ === "drawer" ? /* @__PURE__ */ c(
|
81
|
+
ie,
|
78
82
|
{
|
79
|
-
open:
|
80
|
-
onOpenChange:
|
83
|
+
open: h,
|
84
|
+
onOpenChange: p,
|
81
85
|
onClose: v,
|
82
86
|
onAnimationEnd: (e) => {
|
83
|
-
e &&
|
87
|
+
e && f(!0);
|
84
88
|
},
|
85
89
|
children: [
|
86
|
-
/* @__PURE__ */ o(
|
87
|
-
|
90
|
+
/* @__PURE__ */ o(ce, { asChild: !0, className: "outline-none", children: /* @__PURE__ */ o(
|
91
|
+
R,
|
88
92
|
{
|
89
|
-
disabled:
|
90
|
-
countryCode:
|
91
|
-
hideDialCode:
|
92
|
-
dialCode:
|
93
|
+
disabled: l,
|
94
|
+
countryCode: s,
|
95
|
+
hideDialCode: m,
|
96
|
+
dialCode: D
|
93
97
|
}
|
94
98
|
) }),
|
95
|
-
/* @__PURE__ */ o(
|
96
|
-
/* @__PURE__ */ o(
|
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" }),
|
97
101
|
/* @__PURE__ */ o("div", { className: "px-4 pt-2 pb-4", children: /* @__PURE__ */ o(
|
98
|
-
|
102
|
+
he,
|
99
103
|
{
|
100
104
|
placeholder: "Search name or number",
|
101
|
-
value:
|
102
|
-
onChange:
|
105
|
+
value: C,
|
106
|
+
onChange: G
|
103
107
|
}
|
104
108
|
) }),
|
105
|
-
/* @__PURE__ */
|
109
|
+
/* @__PURE__ */ c(
|
106
110
|
"div",
|
107
111
|
{
|
108
112
|
className: "no-scrollbar mx-auto w-full flex flex-col flex-grow flex-basis-0 overflow-auto p-2",
|
@@ -112,76 +116,76 @@ const fe = te(
|
|
112
116
|
flexBasis: 0
|
113
117
|
},
|
114
118
|
children: [
|
115
|
-
|
116
|
-
const t =
|
119
|
+
I.map((e) => {
|
120
|
+
const t = O(e), r = u(
|
117
121
|
t.iso2,
|
118
|
-
|
122
|
+
n
|
119
123
|
);
|
120
|
-
return /* @__PURE__ */ o(
|
121
|
-
|
124
|
+
return /* @__PURE__ */ o(de, { className: "block w-full", children: /* @__PURE__ */ o(
|
125
|
+
L,
|
122
126
|
{
|
123
127
|
countryCode: r,
|
124
128
|
countryName: t.name,
|
125
|
-
dialCode: `${
|
129
|
+
dialCode: `${g}${t.dialCode}`,
|
126
130
|
onClick: () => {
|
127
|
-
|
131
|
+
A(r), S("");
|
128
132
|
},
|
129
|
-
isSelected:
|
133
|
+
isSelected: s === r
|
130
134
|
}
|
131
135
|
) }, r);
|
132
136
|
}),
|
133
|
-
|
137
|
+
I.length === 0 && /* @__PURE__ */ o(P, { variant: "body", level: 2, className: "text-center", children: "No countries found" })
|
134
138
|
]
|
135
139
|
}
|
136
140
|
)
|
137
141
|
] }) })
|
138
142
|
]
|
139
143
|
}
|
140
|
-
) : /* @__PURE__ */
|
141
|
-
|
144
|
+
) : /* @__PURE__ */ c(
|
145
|
+
Q,
|
142
146
|
{
|
143
|
-
value:
|
144
|
-
open:
|
145
|
-
onOpenChange:
|
146
|
-
onValueChange:
|
147
|
-
disabled:
|
147
|
+
value: s,
|
148
|
+
open: h,
|
149
|
+
onOpenChange: p,
|
150
|
+
onValueChange: A,
|
151
|
+
disabled: l,
|
148
152
|
children: [
|
149
|
-
/* @__PURE__ */ o(
|
150
|
-
|
153
|
+
/* @__PURE__ */ o(Z, { children: /* @__PURE__ */ o(
|
154
|
+
R,
|
151
155
|
{
|
152
|
-
disabled:
|
153
|
-
countryCode:
|
154
|
-
hideDialCode:
|
155
|
-
dialCode:
|
156
|
+
disabled: l,
|
157
|
+
countryCode: s,
|
158
|
+
hideDialCode: m,
|
159
|
+
dialCode: D
|
156
160
|
}
|
157
161
|
) }),
|
158
|
-
/* @__PURE__ */ o(
|
159
|
-
|
162
|
+
/* @__PURE__ */ o(ee, { children: /* @__PURE__ */ o(
|
163
|
+
oe,
|
160
164
|
{
|
161
165
|
ref: (e) => {
|
162
|
-
|
166
|
+
N.current = e, e && a.current && (e.style.width = `${a.current.offsetWidth}px`);
|
163
167
|
},
|
164
168
|
position: "popper",
|
165
|
-
className:
|
169
|
+
className: K(J, "-ml-3 mt-5 w-auto"),
|
166
170
|
onCloseAutoFocus: v,
|
167
|
-
onPointerDown:
|
168
|
-
children: /* @__PURE__ */ o(
|
169
|
-
const t =
|
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(
|
170
174
|
t.iso2,
|
171
|
-
|
175
|
+
n
|
172
176
|
);
|
173
177
|
return /* @__PURE__ */ o(
|
174
|
-
|
178
|
+
re,
|
175
179
|
{
|
176
180
|
value: r,
|
177
181
|
className: "outline-none",
|
178
182
|
children: /* @__PURE__ */ o(
|
179
|
-
|
183
|
+
L,
|
180
184
|
{
|
181
185
|
countryCode: r,
|
182
186
|
countryName: t.name,
|
183
|
-
dialCode: `${
|
184
|
-
isSelected:
|
187
|
+
dialCode: `${g}${t.dialCode}`,
|
188
|
+
isSelected: s === r
|
185
189
|
}
|
186
190
|
)
|
187
191
|
},
|
@@ -197,8 +201,8 @@ const fe = te(
|
|
197
201
|
);
|
198
202
|
}
|
199
203
|
);
|
200
|
-
|
204
|
+
ye.displayName = "PhoneField";
|
201
205
|
export {
|
202
|
-
|
203
|
-
|
206
|
+
ye as PhoneField,
|
207
|
+
ye as default
|
204
208
|
};
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { CountryData } from 'react-international-phone';
|
2
|
-
export declare const
|
2
|
+
export declare const extendedCountryDataList: CountryData[];
|
3
3
|
export declare const DIAL_CODE_PREFIX = "+";
|
4
4
|
export declare const startAdornmentWidthByDialCodeLength: Record<string, number>;
|
@@ -10,10 +10,10 @@ const r = new Set(
|
|
10
10
|
), l = Object.entries(i).filter(([o]) => m.includes(o.toLowerCase())).map(([o, t]) => {
|
11
11
|
const { name: n, phone: a } = t, u = a[0].toString(), C = o.toLowerCase();
|
12
12
|
return [n, C, u];
|
13
|
-
}),
|
13
|
+
}), w = [
|
14
14
|
...c,
|
15
15
|
...l
|
16
|
-
].sort((o, t) => o[0].localeCompare(t[0])), h = "+",
|
16
|
+
].sort((o, t) => o[0].localeCompare(t[0])), h = "+", D = {
|
17
17
|
1: 4.4,
|
18
18
|
2: 5.2,
|
19
19
|
3: 5.8,
|
@@ -21,6 +21,6 @@ const r = new Set(
|
|
21
21
|
};
|
22
22
|
export {
|
23
23
|
h as DIAL_CODE_PREFIX,
|
24
|
-
|
25
|
-
|
24
|
+
w as extendedCountryDataList,
|
25
|
+
D as startAdornmentWidthByDialCodeLength
|
26
26
|
};
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { CountryData } from 'react-international-phone';
|
2
2
|
import { CountryCode } from '../Flag';
|
3
3
|
export declare const getValidatedCountryCode: (code: string, defaultCountryCode: CountryCode) => CountryCode;
|
4
|
+
export declare const getCountryDataListByCodes: (countryCodes: CountryCode[] | undefined) => CountryData[];
|
4
5
|
export declare const filterCountries: (countries: CountryData[], searchText: string) => CountryData[];
|
@@ -1,14 +1,23 @@
|
|
1
1
|
import { parseCountry as a } from "../../node_modules/.pnpm/react-international-phone@4.4.0_react@18.3.1/node_modules/react-international-phone/dist/index.js";
|
2
|
-
import { isSupportedCountryCode as
|
3
|
-
import { DIAL_CODE_PREFIX as
|
4
|
-
const
|
5
|
-
const r =
|
6
|
-
return
|
7
|
-
},
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
import { isSupportedCountryCode as u } from "../Flag/utils.js";
|
3
|
+
import { extendedCountryDataList as s, DIAL_CODE_PREFIX as p } from "./constants.js";
|
4
|
+
const f = (t, e) => {
|
5
|
+
const r = t.toUpperCase();
|
6
|
+
return u(r) ? r : e;
|
7
|
+
}, m = (t) => {
|
8
|
+
if (!(t != null && t.length))
|
9
|
+
return s;
|
10
|
+
const e = new Set(t);
|
11
|
+
return s.filter((r) => {
|
12
|
+
const o = a(r).iso2.toUpperCase();
|
13
|
+
return e.has(o);
|
14
|
+
});
|
15
|
+
}, L = (t, e) => e ? t.filter((r) => {
|
16
|
+
const o = a(r), i = o.name.toLowerCase(), C = `${p}${o.dialCode.toLowerCase()}`, n = e.toLowerCase();
|
17
|
+
return i.includes(n) || C.includes(n);
|
18
|
+
}) : t;
|
11
19
|
export {
|
12
|
-
|
13
|
-
m as
|
20
|
+
L as filterCountries,
|
21
|
+
m as getCountryDataListByCodes,
|
22
|
+
f as getValidatedCountryCode
|
14
23
|
};
|
@@ -6,7 +6,6 @@ import { forwardRef as s } from "react";
|
|
6
6
|
import { cn as m } from "../../lib/utils.js";
|
7
7
|
import { typographyVariants as p } from "../Typography/Typography.js";
|
8
8
|
const f = n(
|
9
|
-
// TODO: Add disabled classes
|
10
9
|
"inline-flex h-9 items-center rounded-full px-4 transition-colors duration-200",
|
11
10
|
{
|
12
11
|
variants: {
|
@@ -1,42 +1,36 @@
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
2
|
-
import { Root as
|
3
|
-
import { cva as
|
4
|
-
import { forwardRef as
|
5
|
-
const
|
2
|
+
import { Root as d } from "../../node_modules/.pnpm/@radix-ui_react-radio-group@1.2.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@_2u6lfd2xt65wmbxn7lgvaxqbmy/node_modules/@radix-ui/react-radio-group/dist/index.js";
|
3
|
+
import { cva as f } from "../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
|
4
|
+
import { forwardRef as n } from "react";
|
5
|
+
const c = f("flex disabled:cursor-not-allowed disabled:opacity-20", {
|
6
6
|
variants: {
|
7
7
|
orientation: {
|
8
8
|
vertical: "flex-col",
|
9
9
|
horizontal: "flex-row"
|
10
|
-
},
|
11
|
-
disabled: {
|
12
|
-
true: "cursor-not-allowed opacity-20",
|
13
|
-
// TODO: rework opacity to match design when it's provided
|
14
|
-
false: ""
|
15
10
|
}
|
16
11
|
},
|
17
12
|
defaultVariants: {
|
18
|
-
orientation: "vertical"
|
19
|
-
disabled: !1
|
13
|
+
orientation: "vertical"
|
20
14
|
}
|
21
|
-
}), m =
|
15
|
+
}), m = n(
|
22
16
|
({
|
23
|
-
defaultValue:
|
24
|
-
onChange:
|
17
|
+
defaultValue: a,
|
18
|
+
onChange: r,
|
25
19
|
orientation: o = "vertical",
|
26
|
-
disabled:
|
27
|
-
name:
|
28
|
-
...
|
20
|
+
disabled: t = !1,
|
21
|
+
name: i,
|
22
|
+
...e
|
29
23
|
}, l) => /* @__PURE__ */ s(
|
30
|
-
|
24
|
+
d,
|
31
25
|
{
|
32
26
|
ref: l,
|
33
|
-
defaultValue:
|
34
|
-
onValueChange:
|
35
|
-
className:
|
36
|
-
disabled:
|
27
|
+
defaultValue: a,
|
28
|
+
onValueChange: r,
|
29
|
+
className: c({ orientation: o }),
|
30
|
+
disabled: t,
|
37
31
|
orientation: o,
|
38
|
-
name:
|
39
|
-
...
|
32
|
+
name: i,
|
33
|
+
...e
|
40
34
|
}
|
41
35
|
)
|
42
36
|
);
|