@worldcoin/mini-apps-ui-kit-react 0.0.8 → 1.0.0-canary.0
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/README.md +8 -17
- package/dist/components/AlertDialog/AlertDialog.js +94 -0
- package/dist/components/AlertDialog/index.d.ts +1 -0
- package/dist/components/AlertDialog/index.js +13 -0
- package/dist/components/AlertDialog/types.d.ts +172 -0
- package/dist/components/AlertDialog/types.js +1 -0
- package/dist/components/AlertDialog/use-alert-dialog.d.ts +6 -0
- package/dist/components/AlertDialog/use-alert-dialog.js +11 -0
- package/dist/components/BottomBar/BottomBar.d.ts +13 -0
- package/dist/components/BottomBar/BottomBar.js +21 -0
- package/dist/components/BottomBar/index.d.ts +1 -0
- package/dist/components/BottomBar/index.js +4 -0
- package/dist/components/BulletList/BulletList.d.ts +10 -0
- package/dist/components/BulletList/BulletList.js +11 -0
- package/dist/components/BulletList/index.d.ts +1 -0
- package/dist/components/BulletList/index.js +4 -0
- package/dist/components/BulletListItem/BulletListItem.d.ts +7 -0
- package/dist/components/BulletListItem/BulletListItem.js +23 -0
- package/dist/components/BulletListItem/index.d.ts +1 -0
- package/dist/components/BulletListItem/index.js +4 -0
- package/dist/components/BulletPoint/BulletPoint.d.ts +6 -0
- package/dist/components/BulletPoint/BulletPoint.js +22 -0
- package/dist/components/BulletPoint/index.d.ts +1 -0
- package/dist/components/BulletPoint/index.js +1 -0
- package/dist/components/Button/Button.d.ts +10 -22
- package/dist/components/Button/Button.js +40 -72
- package/dist/components/Checkbox/Checkbox.d.ts +24 -4
- package/dist/components/Checkbox/Checkbox.js +5 -5
- package/dist/components/Chip/Chip.d.ts +2 -1
- package/dist/components/Chip/Chip.js +14 -8
- package/dist/components/ClearButton/Clear.js +14 -14
- package/dist/components/ClearButton/ClearButton.js +11 -11
- package/dist/components/ColorPicker/ColorPicker.js +14 -14
- package/dist/components/CountryDrawer/CountryDrawer.d.ts +12 -0
- package/dist/components/CountryDrawer/CountryDrawer.js +63 -0
- package/dist/components/CountryDrawer/index.d.ts +1 -0
- package/dist/components/CountryDrawer/index.js +4 -0
- package/dist/components/CountryDrawer/useCountryFiltering.d.ts +7 -0
- package/dist/components/CountryDrawer/useCountryFiltering.js +9 -0
- package/dist/components/CountryDrawer/useCountryGrouping.d.ts +13 -0
- package/dist/components/CountryDrawer/useCountryGrouping.js +17 -0
- package/dist/components/Drawer/Drawer.d.ts +28 -6
- package/dist/components/Drawer/Drawer.js +67 -28
- package/dist/components/Drawer/index.js +6 -4
- package/dist/components/Drawer/types.d.ts +167 -0
- package/dist/components/Drawer/types.js +1 -0
- package/dist/components/Drawer/use-drawer.d.ts +8 -0
- package/dist/components/Drawer/use-drawer.js +11 -0
- package/dist/components/Flag/LazyFlag.js +1 -1
- package/dist/components/Flag/flag-components/eu.d.ts +3 -0
- package/dist/components/Flag/flag-components/eu.js +83 -0
- package/dist/components/Flag/flag-components/index.d.ts +1 -0
- package/dist/components/Flag/flag-components/index.js +56 -54
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Icons/ArrowDown.js +26 -0
- package/dist/components/Icons/Eye.d.ts +8 -0
- package/dist/components/Icons/Eye.js +40 -0
- package/dist/components/Icons/EyeClosed.d.ts +8 -0
- package/dist/components/Icons/EyeClosed.js +60 -0
- package/dist/components/Icons/Fail.d.ts +8 -0
- package/dist/components/Icons/Fail.js +82 -0
- package/dist/components/Icons/MagicWand.d.ts +8 -0
- package/dist/components/Icons/MagicWand.js +60 -0
- package/dist/components/Icons/Magnifier.d.ts +1 -1
- package/dist/components/Icons/Magnifier.js +20 -11
- package/dist/components/Icons/Success.d.ts +8 -0
- package/dist/components/Icons/Success.js +82 -0
- package/dist/components/Icons/Tick.js +6 -7
- package/dist/components/Icons/XMark.d.ts +8 -0
- package/dist/components/Icons/XMark.js +27 -0
- package/dist/components/Input/Input.d.ts +26 -2
- package/dist/components/Input/Input.js +116 -51
- package/dist/components/ListItem/ListItem.d.ts +17 -6
- package/dist/components/ListItem/ListItem.js +29 -22
- package/dist/components/Marble/Marble.d.ts +2 -0
- package/dist/components/Marble/Marble.js +23 -0
- package/dist/components/Marble/index.d.ts +1 -0
- package/dist/components/Marble/index.js +4 -0
- package/dist/components/NumberPad/Delete.d.ts +1 -8
- package/dist/components/NumberPad/Delete.js +9 -10
- package/dist/components/NumberPad/NumberPad.js +30 -24
- package/dist/components/OTPField/OTPField.js +8 -8
- package/dist/components/PasswordField/PasswordField.d.ts +13 -0
- package/dist/components/PasswordField/PasswordField.js +45 -0
- package/dist/components/PasswordField/index.d.ts +1 -0
- package/dist/components/PasswordField/index.js +4 -0
- package/dist/components/PasteButton/PasteButton.d.ts +1 -1
- package/dist/components/PasteButton/PasteButton.js +21 -17
- package/dist/components/PhoneField/CountryListItem.d.ts +3 -4
- package/dist/components/PhoneField/CountryListItem.js +21 -25
- package/dist/components/PhoneField/CountrySelectorButton.d.ts +3 -4
- package/dist/components/PhoneField/CountrySelectorButton.js +17 -17
- package/dist/components/PhoneField/GroupedCountryList.d.ts +14 -0
- package/dist/components/PhoneField/GroupedCountryList.js +30 -0
- package/dist/components/PhoneField/PhoneField.d.ts +3 -14
- package/dist/components/PhoneField/PhoneField.js +71 -197
- package/dist/components/PhoneField/constants.js +4 -4
- package/dist/components/Pill/Pill.js +7 -7
- package/dist/components/Progress/Progress.d.ts +14 -0
- package/dist/components/Progress/Progress.js +31 -0
- package/dist/components/Progress/index.d.ts +1 -0
- package/dist/components/Progress/index.js +4 -0
- package/dist/components/RadioGroup/RadioGroupItem.js +1 -1
- package/dist/components/SearchField/SearchField.d.ts +6 -1
- package/dist/components/SearchField/SearchField.js +39 -35
- package/dist/components/Select/Select.js +46 -76
- package/dist/components/{Button → Spinner}/Spinner.d.ts +2 -2
- package/dist/components/Spinner/Spinner.js +36 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Spinner/index.js +4 -0
- package/dist/components/Switch/Switch.js +1 -1
- package/dist/components/Tabs/Tabs.d.ts +11 -0
- package/dist/components/Tabs/Tabs.js +58 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Tabs/index.js +5 -0
- package/dist/components/Tabs/types.d.ts +53 -0
- package/dist/components/Tabs/types.js +1 -0
- package/dist/components/TextArea/TextArea.d.ts +25 -0
- package/dist/components/TextArea/TextArea.js +54 -0
- package/dist/components/TextArea/index.d.ts +1 -0
- package/dist/components/TextArea/index.js +4 -0
- package/dist/components/Toast/Toast.d.ts +9 -0
- package/dist/components/Toast/Toast.js +51 -0
- package/dist/components/Toast/Toaster.d.ts +3 -0
- package/dist/components/Toast/Toaster.js +14 -0
- package/dist/components/Toast/index.d.ts +3 -0
- package/dist/components/Toast/index.js +12 -0
- package/dist/components/Toast/use-toast.d.ts +51 -0
- package/dist/components/Toast/use-toast.js +101 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +5 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +28 -0
- package/dist/components/ToggleGroup/index.d.ts +1 -0
- package/dist/components/ToggleGroup/index.js +5 -0
- package/dist/components/ToggleGroup/types.d.ts +101 -0
- package/dist/components/ToggleGroup/types.js +1 -0
- package/dist/components/Token/Token.d.ts +4 -0
- package/dist/components/Token/Token.js +12 -7
- package/dist/components/Token/icons/btc.d.ts +2 -2
- package/dist/components/Token/icons/btc.js +13 -58
- package/dist/components/Token/icons/dai.d.ts +3 -0
- package/dist/components/Token/icons/dai.js +27 -0
- package/dist/components/Token/icons/eth.d.ts +2 -2
- package/dist/components/Token/icons/eth.js +11 -58
- package/dist/components/Token/icons/index.d.ts +2 -0
- package/dist/components/Token/icons/index.js +8 -4
- package/dist/components/Token/icons/types.d.ts +7 -0
- package/dist/components/Token/icons/types.js +1 -0
- package/dist/components/Token/icons/usdc.d.ts +2 -2
- package/dist/components/Token/icons/usdc.js +16 -56
- package/dist/components/Token/icons/usdt.d.ts +3 -0
- package/dist/components/Token/icons/usdt.js +27 -0
- package/dist/components/Token/icons/utils.d.ts +9 -0
- package/dist/components/Token/icons/utils.js +11 -0
- package/dist/components/Token/icons/wld.d.ts +2 -2
- package/dist/components/Token/icons/wld.js +10 -41
- package/dist/components/TopBar/TopBar.d.ts +11 -0
- package/dist/components/TopBar/TopBar.js +23 -0
- package/dist/components/TopBar/index.d.ts +1 -0
- package/dist/components/TopBar/index.js +4 -0
- package/dist/components/Typography/Typography.d.ts +12 -8
- package/dist/components/Typography/Typography.js +72 -60
- package/dist/components/WalletAddressField/WalletAddressField.d.ts +23 -0
- package/dist/components/WalletAddressField/WalletAddressField.js +81 -0
- package/dist/components/WalletAddressField/index.d.ts +1 -0
- package/dist/components/WalletAddressField/index.js +4 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +91 -45
- package/dist/lib/constants/dropdownStyles.d.ts +1 -1
- package/dist/lib/constants/dropdownStyles.js +2 -2
- package/dist/node_modules/.pnpm/@radix-ui_react-collection@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@1_tagbd57u5fsqga6qdjecsll7fm/node_modules/@radix-ui/react-collection/dist/index.js +49 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.5_@types_react-dom@18.3.5_@types_react@18.3.18__@types__nitdfoqpcbroetgllwgz3is5ai/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +131 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.4_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18.3._ulc3jfxcmrz2rfz7bui53djdtu/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.0.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18_sejcxqoscaweil2bvgwwavaoha/node_modules/@radix-ui/react-primitive/dist/index.js +35 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-progress@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18._wpsg2ubedou6txnsnvgmus4txq/node_modules/@radix-ui/react-progress/dist/index.js +86 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-roving-focus@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react_ki7uy4u3diz5446cqygvbjwuge/node_modules/@radix-ui/react-roving-focus/dist/index.js +181 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.1.2_@types_react@18.3.18_react@18.3.1/node_modules/@radix-ui/react-slot/dist/index.js +44 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-toast@1.2.6_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18.3.1_mux33mveszkw5z6iia6acnivvy/node_modules/@radix-ui/react-toast/dist/index.js +448 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-toggle-group@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react_3smwloudr6a3igss4kifyxcwju/node_modules/@radix-ui/react-toggle-group/dist/index.js +137 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-toggle@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_react@18.3._yiv2ptaqcv244n5f7zfldmgupm/node_modules/@radix-ui/react-toggle/dist/index.js +31 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-visually-hidden@1.1.2_@types_react-dom@18.3.5_@types_react@18.3.18__@types_re_omyrydx3gc2oidaiqb4gsovieq/node_modules/@radix-ui/react-visually-hidden/dist/index.js +30 -0
- package/dist/tailwind/index.d.ts +41 -25
- package/dist/tailwind/index.js +128 -85
- package/package.json +73 -1
- package/public/fonts/TWKLausanne-350.woff +0 -0
- package/public/fonts/TWKLausanne-350Italic.woff +0 -0
- package/public/fonts/TWKLausanne-500.woff +0 -0
- package/public/fonts/TWKLausanne-500Italic.woff +0 -0
- package/public/fonts/TWKLausanne-600.woff +0 -0
- package/public/fonts/TWKLausanne-600Italic.woff +0 -0
- package/public/globals.css +1 -1
- package/public/images/marbles/marble1.png +0 -0
- package/public/images/marbles/marble2.png +0 -0
- package/public/images/marbles/marble3.svg +36 -0
- package/dist/components/Button/Spinner.js +0 -36
- package/dist/components/PhoneField/ArrowDown.js +0 -27
- package/dist/components/Select/ArrowDown.d.ts +0 -2
- package/dist/components/Select/ArrowDown.js +0 -27
- /package/dist/components/{PhoneField → Icons}/ArrowDown.d.ts +0 -0
@@ -1,8 +1,10 @@
|
|
1
1
|
"use client";
|
2
|
-
import { jsx as
|
2
|
+
import { jsx as l } from "react/jsx-runtime";
|
3
|
+
import { cn as c } from "../../lib/utils.js";
|
3
4
|
import { useLongPress as d } from "../../node_modules/.pnpm/@uidotdev_usehooks@2.4.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@uidotdev/usehooks/index.js";
|
4
|
-
import {
|
5
|
-
|
5
|
+
import { typographyVariants as m } from "../Typography/Typography.js";
|
6
|
+
import { Delete as v } from "./Delete.js";
|
7
|
+
const f = [
|
6
8
|
{ value: "1" },
|
7
9
|
{ value: "2" },
|
8
10
|
{ value: "3" },
|
@@ -14,45 +16,49 @@ const m = [
|
|
14
16
|
{ value: "9" },
|
15
17
|
{ value: "." },
|
16
18
|
{ value: "0" },
|
17
|
-
{ value: "del", label: /* @__PURE__ */
|
18
|
-
],
|
19
|
-
value:
|
20
|
-
onChange:
|
19
|
+
{ value: "del", label: /* @__PURE__ */ l(v, { className: "size-6" }) }
|
20
|
+
], h = ({
|
21
|
+
value: r = "",
|
22
|
+
onChange: s,
|
21
23
|
disabled: a = !1,
|
22
|
-
onLongDeletePress:
|
24
|
+
onLongDeletePress: t = () => {
|
23
25
|
},
|
24
|
-
longPressOptions:
|
26
|
+
longPressOptions: n = {
|
25
27
|
threshold: 1500
|
26
28
|
}
|
27
29
|
}) => {
|
28
|
-
|
29
|
-
const
|
30
|
-
if (!(!
|
30
|
+
r !== "" && isNaN(Number(r)) && console.error("NumberPad value must be a valid number or empty string");
|
31
|
+
const o = (e) => {
|
32
|
+
if (!(!s || a))
|
31
33
|
if (e === "del")
|
32
|
-
r
|
34
|
+
s(r.slice(0, -1));
|
33
35
|
else {
|
34
|
-
if (e === "." &&
|
36
|
+
if (e === "." && r.includes("."))
|
35
37
|
return;
|
36
38
|
{
|
37
|
-
const
|
38
|
-
isNaN(Number(
|
39
|
+
const i = r + e;
|
40
|
+
(e === "." || !isNaN(Number(i))) && s(i);
|
39
41
|
}
|
40
42
|
}
|
41
|
-
},
|
42
|
-
return /* @__PURE__ */
|
43
|
+
}, u = d(t, n);
|
44
|
+
return /* @__PURE__ */ l("div", { className: "grid grid-cols-3 grid-rows-4 gap-1 w-full", children: f.map((e) => /* @__PURE__ */ l(
|
43
45
|
"button",
|
44
46
|
{
|
45
47
|
type: "button",
|
46
|
-
onClick: () =>
|
48
|
+
onClick: () => o(e.value),
|
47
49
|
disabled: a,
|
48
|
-
className:
|
49
|
-
|
50
|
-
|
50
|
+
className: c(
|
51
|
+
m({ variant: "heading", level: 3 }),
|
52
|
+
"h-12 min-w-28 flex items-center justify-center select-none group",
|
53
|
+
"disabled:text-gray-300 disabled:cursor-not-allowed disabled:active:bg-transparent"
|
54
|
+
),
|
55
|
+
...e.value === "del" ? u : {},
|
56
|
+
children: /* @__PURE__ */ l("span", { className: "duration-200 transition-colors size-12 flex items-center justify-center rounded-full group-active:bg-gray-50", children: e.label || e.value })
|
51
57
|
},
|
52
58
|
e.value
|
53
59
|
)) });
|
54
60
|
};
|
55
61
|
export {
|
56
|
-
|
57
|
-
|
62
|
+
h as NumberPad,
|
63
|
+
h as default
|
58
64
|
};
|
@@ -14,25 +14,25 @@ const R = {
|
|
14
14
|
chars: "text",
|
15
15
|
digitsAndChars: "text"
|
16
16
|
}, O = x.forwardRef(
|
17
|
-
({ maxLength:
|
17
|
+
({ maxLength: a = 6, error: r, children: N, mode: i = "digits", pattern: n, ...s }, e) => /* @__PURE__ */ t(
|
18
18
|
f,
|
19
19
|
{
|
20
20
|
ref: e,
|
21
|
-
...
|
22
|
-
maxLength:
|
23
|
-
inputMode: E[
|
24
|
-
pattern:
|
25
|
-
containerClassName: "flex items-center gap-
|
21
|
+
...s,
|
22
|
+
maxLength: a,
|
23
|
+
inputMode: E[i],
|
24
|
+
pattern: n || R[i],
|
25
|
+
containerClassName: "flex items-center gap-2 has-[:disabled]:opacity-50",
|
26
26
|
render: ({ slots: o }) => /* @__PURE__ */ t(p, { children: o.map(({ isActive: d, char: c }, m) => /* @__PURE__ */ t(
|
27
27
|
"div",
|
28
28
|
{
|
29
29
|
ref: e,
|
30
30
|
role: "textbox",
|
31
31
|
className: l(
|
32
|
-
y({ error:
|
32
|
+
y({ error: r }),
|
33
33
|
_({ variant: "body", level: 2 }),
|
34
34
|
"w-12 h-[4.25rem] rounded-lg flex items-center justify-center",
|
35
|
-
d && "z-10 bg-gray-0
|
35
|
+
(d || r) && "z-10 bg-gray-0"
|
36
36
|
),
|
37
37
|
children: c
|
38
38
|
},
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { InputProps } from '../Input';
|
2
|
+
export interface PasswordFieldProps extends Omit<InputProps, "startAdornment" | "startAdornmentWidth"> {
|
3
|
+
/**
|
4
|
+
* If true, the input will display in an error state with error styling
|
5
|
+
*/
|
6
|
+
error?: boolean;
|
7
|
+
/**
|
8
|
+
* If true, the input will display in a valid state with success styling
|
9
|
+
*/
|
10
|
+
isValid?: boolean;
|
11
|
+
}
|
12
|
+
export declare const PasswordField: import('react').ForwardRefExoticComponent<PasswordFieldProps & import('react').RefAttributes<HTMLInputElement>>;
|
13
|
+
export default PasswordField;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
"use client";
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
3
|
+
import { forwardRef as l, useState as w } from "react";
|
4
|
+
import { Eye as u } from "../Icons/Eye.js";
|
5
|
+
import { EyeClosed as c } from "../Icons/EyeClosed.js";
|
6
|
+
import { Input as h } from "../Input/Input.js";
|
7
|
+
const y = l(
|
8
|
+
({
|
9
|
+
isValid: t,
|
10
|
+
disabled: r,
|
11
|
+
type: A = "password",
|
12
|
+
autoComplete: d = "current-password",
|
13
|
+
spellCheck: n = "false",
|
14
|
+
inputMode: s = "text",
|
15
|
+
autoCapitalize: m = "off",
|
16
|
+
autoCorrect: p = "off",
|
17
|
+
endAdornment: P,
|
18
|
+
endAdornmentWidth: x,
|
19
|
+
...a
|
20
|
+
}, f) => {
|
21
|
+
const [e, i] = w(!1);
|
22
|
+
return /* @__PURE__ */ o(
|
23
|
+
h,
|
24
|
+
{
|
25
|
+
...a,
|
26
|
+
ref: f,
|
27
|
+
isValid: t,
|
28
|
+
disabled: r,
|
29
|
+
endAdornmentWidth: 2.4,
|
30
|
+
endAdornment: /* @__PURE__ */ o("button", { type: "button", onClick: () => i(!e), children: e ? /* @__PURE__ */ o(c, {}) : /* @__PURE__ */ o(u, {}) }),
|
31
|
+
type: e ? "text" : "password",
|
32
|
+
autoComplete: d,
|
33
|
+
spellCheck: n,
|
34
|
+
inputMode: s,
|
35
|
+
autoCapitalize: m,
|
36
|
+
autoCorrect: p
|
37
|
+
}
|
38
|
+
);
|
39
|
+
}
|
40
|
+
);
|
41
|
+
y.displayName = "PasswordField";
|
42
|
+
export {
|
43
|
+
y as PasswordField,
|
44
|
+
y as default
|
45
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './PasswordField';
|
@@ -15,6 +15,6 @@ interface PasteButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>,
|
|
15
15
|
*/
|
16
16
|
onPaste?: (value: string) => void;
|
17
17
|
}
|
18
|
-
export declare const PASTE_BUTTON_WIDTH =
|
18
|
+
export declare const PASTE_BUTTON_WIDTH = 5;
|
19
19
|
declare const PasteButton: React.ForwardRefExoticComponent<PasteButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
20
20
|
export default PasteButton;
|
@@ -1,37 +1,41 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import * as
|
3
|
-
import { cn as
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
2
|
+
import * as d from "react";
|
3
|
+
import { cn as m } from "../../lib/utils.js";
|
4
|
+
import { MagicWand as u } from "../Icons/MagicWand.js";
|
5
|
+
import { Typography as p } from "../Typography/Typography.js";
|
6
|
+
const T = 5, f = d.forwardRef(
|
7
|
+
({ children: x, inputRef: r, label: o = "Paste", className: n, onPaste: a, ...c }, l) => {
|
7
8
|
const i = async () => {
|
8
9
|
try {
|
9
10
|
if (r && "current" in r && r.current) {
|
10
11
|
const t = await navigator.clipboard.readText();
|
11
|
-
r.current.value = t,
|
12
|
+
r.current.value = t, a == null || a(t);
|
12
13
|
}
|
13
14
|
} catch (t) {
|
14
15
|
console.error("Failed to read clipboard:", t);
|
15
16
|
}
|
16
17
|
};
|
17
|
-
return /* @__PURE__ */
|
18
|
+
return /* @__PURE__ */ s(
|
18
19
|
"button",
|
19
20
|
{
|
20
21
|
type: "button",
|
21
|
-
ref:
|
22
|
-
className:
|
23
|
-
|
24
|
-
"flex h-full w-full items-center justify-center
|
22
|
+
ref: l,
|
23
|
+
className: m(
|
24
|
+
n,
|
25
|
+
"flex h-full w-full items-center justify-center px-4 gap-1 text-gray-900 transition duration-300 bg-transparent disabled:cursor-not-allowed"
|
25
26
|
),
|
26
27
|
onClick: i,
|
27
|
-
...
|
28
|
-
children:
|
28
|
+
...c,
|
29
|
+
children: [
|
30
|
+
/* @__PURE__ */ e(p, { variant: "subtitle", level: 3, children: o }),
|
31
|
+
/* @__PURE__ */ e(u, {})
|
32
|
+
]
|
29
33
|
}
|
30
34
|
);
|
31
35
|
}
|
32
36
|
);
|
33
|
-
|
37
|
+
f.displayName = "PasteButton";
|
34
38
|
export {
|
35
|
-
|
36
|
-
|
39
|
+
T as PASTE_BUTTON_WIDTH,
|
40
|
+
f as default
|
37
41
|
};
|
@@ -2,12 +2,11 @@ import { CountryCode } from '../Flag';
|
|
2
2
|
interface CountryListItemProps {
|
3
3
|
countryCode: CountryCode;
|
4
4
|
countryName: string;
|
5
|
-
|
6
|
-
|
7
|
-
onClick?: () => void;
|
5
|
+
isSelected?: boolean;
|
6
|
+
onClick?: (value: CountryCode) => void;
|
8
7
|
}
|
9
8
|
declare const CountryListItem: {
|
10
|
-
({ countryCode, countryName,
|
9
|
+
({ countryCode, countryName, onClick, isSelected, }: CountryListItemProps): import("react/jsx-runtime").JSX.Element;
|
11
10
|
displayName: string;
|
12
11
|
};
|
13
12
|
export default CountryListItem;
|
@@ -1,35 +1,31 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import
|
3
|
-
import {
|
4
|
-
import "../
|
5
|
-
import { Typography as a } from "../Typography/Typography.js";
|
1
|
+
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
2
|
+
import "../Flag/Flag.js";
|
3
|
+
import { LazyFlag as m } from "../Flag/LazyFlag.js";
|
4
|
+
import { Typography as l } from "../Typography/Typography.js";
|
6
5
|
const p = ({
|
7
|
-
countryCode:
|
8
|
-
countryName:
|
9
|
-
|
10
|
-
isSelected: s
|
11
|
-
|
12
|
-
|
13
|
-
"div",
|
6
|
+
countryCode: t,
|
7
|
+
countryName: a,
|
8
|
+
onClick: e,
|
9
|
+
isSelected: s
|
10
|
+
}) => /* @__PURE__ */ i(
|
11
|
+
"button",
|
14
12
|
{
|
15
|
-
"
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
onClick: i,
|
13
|
+
type: "button",
|
14
|
+
"data-country": t,
|
15
|
+
className: "h-[3.75rem] flex items-center w-full gap-2 cursor-pointer",
|
16
|
+
onClick: () => e == null ? void 0 : e(t),
|
17
|
+
...s && { "data-selected": !0 },
|
21
18
|
children: [
|
22
|
-
/* @__PURE__ */
|
23
|
-
/* @__PURE__ */
|
24
|
-
|
19
|
+
/* @__PURE__ */ r(m, { countryCode: t, size: 32 }),
|
20
|
+
/* @__PURE__ */ r(
|
21
|
+
l,
|
25
22
|
{
|
26
|
-
variant: "
|
23
|
+
variant: "subtitle",
|
27
24
|
level: 2,
|
28
25
|
className: "mx-2 overflow-hidden text-ellipsis whitespace-nowrap",
|
29
|
-
children:
|
26
|
+
children: a
|
30
27
|
}
|
31
|
-
)
|
32
|
-
/* @__PURE__ */ e(a, { variant: "body", level: 2, className: "ml-auto", children: o })
|
28
|
+
)
|
33
29
|
]
|
34
30
|
}
|
35
31
|
);
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import { CountryCode } from '../Flag';
|
2
2
|
interface CountrySelectorButtonProps extends React.HTMLAttributes<HTMLDivElement> {
|
3
|
-
disabled
|
4
|
-
|
5
|
-
|
6
|
-
dialCode: string;
|
3
|
+
disabled?: boolean;
|
4
|
+
value: CountryCode;
|
5
|
+
label: string;
|
7
6
|
}
|
8
7
|
declare const CountrySelectorButton: import('react').ForwardRefExoticComponent<CountrySelectorButtonProps & import('react').RefAttributes<HTMLDivElement>>;
|
9
8
|
export default CountrySelectorButton;
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { cn as
|
3
|
-
import { cva as
|
4
|
-
import { forwardRef as
|
5
|
-
import { Flag as
|
1
|
+
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
2
|
+
import { cn as l } from "../../lib/utils.js";
|
3
|
+
import { cva as m } from "../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
|
4
|
+
import { forwardRef as c } from "react";
|
5
|
+
import { Flag as d } from "../Flag/Flag.js";
|
6
6
|
import "../Flag/LazyFlag.js";
|
7
|
+
import { ArrowDown as u } from "../Icons/ArrowDown.js";
|
7
8
|
import { Typography as f } from "../Typography/Typography.js";
|
8
|
-
|
9
|
-
|
10
|
-
"flex items-center bg-transparent border-none focus:outline-none cursor-pointer",
|
9
|
+
const p = m(
|
10
|
+
"flex items-center bg-transparent focus:outline-none cursor-pointer text-gray-900",
|
11
11
|
{
|
12
12
|
variants: {
|
13
13
|
disabled: {
|
@@ -19,23 +19,23 @@ const y = c(
|
|
19
19
|
disabled: !1
|
20
20
|
}
|
21
21
|
}
|
22
|
-
),
|
23
|
-
({ disabled: t, className:
|
22
|
+
), y = c(
|
23
|
+
({ disabled: t, className: o, value: e, label: a, ...s }, i) => /* @__PURE__ */ n(
|
24
24
|
"div",
|
25
25
|
{
|
26
26
|
ref: i,
|
27
|
-
...
|
28
|
-
className:
|
27
|
+
...s,
|
28
|
+
className: l(p({ disabled: t, className: o })),
|
29
29
|
"data-testid": "country-selector-button",
|
30
30
|
children: [
|
31
|
-
/* @__PURE__ */ r("div", { className: "
|
32
|
-
|
33
|
-
/* @__PURE__ */ r(
|
31
|
+
/* @__PURE__ */ r("div", { className: "mr-2", children: /* @__PURE__ */ r(d, { countryCode: e, size: 24 }) }),
|
32
|
+
/* @__PURE__ */ r(f, { variant: "subtitle", level: 3, className: "mr-2", children: a }),
|
33
|
+
/* @__PURE__ */ r(u, {})
|
34
34
|
]
|
35
35
|
}
|
36
36
|
)
|
37
37
|
);
|
38
|
-
|
38
|
+
y.displayName = "CountrySelectorButton";
|
39
39
|
export {
|
40
|
-
|
40
|
+
y as default
|
41
41
|
};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { CountryCode } from '../Flag';
|
2
|
+
interface GroupedCountries {
|
3
|
+
[key: string]: {
|
4
|
+
countryCode: CountryCode;
|
5
|
+
name: string;
|
6
|
+
}[];
|
7
|
+
}
|
8
|
+
interface GroupedCountryListProps {
|
9
|
+
groupedCountries: GroupedCountries;
|
10
|
+
value: CountryCode;
|
11
|
+
onSelect: (countryCode: CountryCode) => void;
|
12
|
+
}
|
13
|
+
export declare function GroupedCountryList({ groupedCountries, onSelect, value, }: GroupedCountryListProps): import("react/jsx-runtime").JSX.Element;
|
14
|
+
export {};
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { jsxs as i, jsx as e, Fragment as n } from "react/jsx-runtime";
|
2
|
+
import { DrawerClose as c } from "../Drawer/Drawer.js";
|
3
|
+
import { Magnifier as d } from "../Icons/Magnifier.js";
|
4
|
+
import { Typography as l } from "../Typography/Typography.js";
|
5
|
+
import p from "./CountryListItem.js";
|
6
|
+
function C({
|
7
|
+
groupedCountries: o,
|
8
|
+
onSelect: s,
|
9
|
+
value: m
|
10
|
+
}) {
|
11
|
+
return Object.keys(o).length === 0 ? /* @__PURE__ */ i("div", { className: "flex flex-col items-center justify-center grow text-gray-400 gap-2 h-full", children: [
|
12
|
+
/* @__PURE__ */ e(d, { className: "size-8" }),
|
13
|
+
/* @__PURE__ */ e(l, { variant: "body", level: 3, children: "No search results" })
|
14
|
+
] }) : /* @__PURE__ */ e(n, { children: Object.entries(o).sort(([r], [a]) => r.localeCompare(a)).map(([r, a]) => /* @__PURE__ */ i("div", { className: "group", children: [
|
15
|
+
/* @__PURE__ */ e(l, { variant: "subtitle", level: 3, className: "text-gray-400 mb-2", children: r }),
|
16
|
+
a.map((t) => /* @__PURE__ */ e(c, { asChild: !0, children: /* @__PURE__ */ e(
|
17
|
+
p,
|
18
|
+
{
|
19
|
+
countryCode: t.countryCode,
|
20
|
+
countryName: t.name,
|
21
|
+
onClick: s,
|
22
|
+
isSelected: m === t.countryCode
|
23
|
+
}
|
24
|
+
) }, t.countryCode)),
|
25
|
+
/* @__PURE__ */ e("div", { className: "h-[1px] bg-gray-200 my-4 group-last:hidden" })
|
26
|
+
] }, r)) });
|
27
|
+
}
|
28
|
+
export {
|
29
|
+
C as GroupedCountryList
|
30
|
+
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { CountryCode } from '../Flag/Flag';
|
2
2
|
import { InputProps } from '../Input';
|
3
|
-
export interface PhoneFieldProps extends Omit<InputProps, "onChange" | "startAdornment" | "startAdornmentWidth"> {
|
3
|
+
export interface PhoneFieldProps extends Omit<InputProps, "onChange" | "startAdornment" | "startAdornmentWidth" | "placeholder"> {
|
4
4
|
/**
|
5
5
|
* Current phone number value.
|
6
6
|
*/
|
@@ -14,12 +14,6 @@ export interface PhoneFieldProps extends Omit<InputProps, "onChange" | "startAdo
|
|
14
14
|
* If not provided, all countries will be displayed.
|
15
15
|
*/
|
16
16
|
countries?: CountryCode[];
|
17
|
-
/**
|
18
|
-
* If true, the dial code will be hidden.
|
19
|
-
* The dial code is still displayed at the start of the input and in the dropdown.
|
20
|
-
* @default false
|
21
|
-
*/
|
22
|
-
hideDialCode?: boolean;
|
23
17
|
/**
|
24
18
|
* Disable dial code prefill on initialization.
|
25
19
|
* Dial code prefill works only when empty phone value have been provided.
|
@@ -35,9 +29,9 @@ export interface PhoneFieldProps extends Omit<InputProps, "onChange" | "startAdo
|
|
35
29
|
*/
|
36
30
|
isValid?: boolean;
|
37
31
|
/**
|
38
|
-
* The
|
32
|
+
* The label text to display
|
39
33
|
*/
|
40
|
-
|
34
|
+
label?: string;
|
41
35
|
/**
|
42
36
|
* When true, prevents the user from interacting with phone field.
|
43
37
|
* @default false
|
@@ -59,11 +53,6 @@ export interface PhoneFieldProps extends Omit<InputProps, "onChange" | "startAdo
|
|
59
53
|
* @default 1.25
|
60
54
|
*/
|
61
55
|
endAdornmentWidth?: number;
|
62
|
-
/**
|
63
|
-
* Display mode for the country selector: "dropdown" for desktop or "drawer" for mobile.
|
64
|
-
* @default "dropdown"
|
65
|
-
*/
|
66
|
-
countrySelectorMode?: "dropdown" | "drawer";
|
67
56
|
}
|
68
57
|
export declare const PhoneField: import('react').ForwardRefExoticComponent<PhoneFieldProps & import('react').RefAttributes<HTMLDivElement>>;
|
69
58
|
export default PhoneField;
|