@worldcoin/mini-apps-ui-kit-react 1.3.6 → 1.4.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.
Files changed (198) hide show
  1. package/dist/components/CountryDrawer/CountryDrawer.d.ts +6 -1
  2. package/dist/components/CountryDrawer/CountryDrawer.js +49 -34
  3. package/dist/components/CountryDrawer/useCountryFiltering.d.ts +2 -1
  4. package/dist/components/CountryDrawer/useCountryFiltering.js +13 -2
  5. package/dist/components/CountryDrawer/useCountryGrouping.d.ts +4 -2
  6. package/dist/components/CountryDrawer/useCountryGrouping.js +9 -3
  7. package/dist/components/Dialog/Dialog.d.ts +13 -0
  8. package/dist/components/Dialog/Dialog.js +91 -0
  9. package/dist/components/DrawerDialog/DrawerDialog.d.ts +32 -0
  10. package/dist/components/DrawerDialog/DrawerDialog.js +71 -0
  11. package/dist/components/DrawerDialog/index.d.ts +2 -0
  12. package/dist/components/PhoneField/CountryListItem.d.ts +3 -1
  13. package/dist/components/PhoneField/CountryListItem.js +3 -1
  14. package/dist/components/PhoneField/CountrySelectorButton.js +2 -1
  15. package/dist/components/PhoneField/GroupedCountryList.d.ts +4 -1
  16. package/dist/components/PhoneField/GroupedCountryList.js +14 -6
  17. package/dist/components/PhoneField/PhoneField.d.ts +7 -0
  18. package/dist/components/PhoneField/PhoneField.js +4 -0
  19. package/dist/components/PhoneField/utils.d.ts +14 -1
  20. package/dist/components/PhoneField/utils.js +14 -5
  21. package/dist/globals.css +1 -1
  22. package/dist/hooks/use-isomorphic-layout-effect.d.ts +15 -0
  23. package/dist/hooks/use-isomorphic-layout-effect.js +5 -0
  24. package/dist/hooks/use-media-query.d.ts +28 -0
  25. package/dist/hooks/use-media-query.js +40 -0
  26. package/dist/index.d.ts +5 -0
  27. package/dist/index.js +10 -0
  28. package/dist/lib/I18nProvider.d.ts +19 -0
  29. package/dist/lib/I18nProvider.js +37 -0
  30. package/dist/lib/i18n.d.ts +13 -0
  31. package/dist/lib/i18n.js +43 -0
  32. package/dist/lib/locales.d.ts +20 -0
  33. package/dist/lib/locales.js +96 -0
  34. package/dist/locales/af.json.d.ts +258 -0
  35. package/dist/locales/af.json.js +11 -0
  36. package/dist/locales/am.json.d.ts +258 -0
  37. package/dist/locales/am.json.js +11 -0
  38. package/dist/locales/ar.json.d.ts +258 -0
  39. package/dist/locales/ar.json.js +11 -0
  40. package/dist/locales/az.json.d.ts +258 -0
  41. package/dist/locales/az.json.js +11 -0
  42. package/dist/locales/be.json.d.ts +258 -0
  43. package/dist/locales/be.json.js +11 -0
  44. package/dist/locales/bg.json.d.ts +258 -0
  45. package/dist/locales/bg.json.js +11 -0
  46. package/dist/locales/bn.json.d.ts +258 -0
  47. package/dist/locales/bn.json.js +11 -0
  48. package/dist/locales/br.json.d.ts +258 -0
  49. package/dist/locales/br.json.js +11 -0
  50. package/dist/locales/bs.json.d.ts +258 -0
  51. package/dist/locales/bs.json.js +11 -0
  52. package/dist/locales/ca.json.d.ts +258 -0
  53. package/dist/locales/ca.json.js +11 -0
  54. package/dist/locales/cs.json.d.ts +258 -0
  55. package/dist/locales/cs.json.js +11 -0
  56. package/dist/locales/cy.json.d.ts +258 -0
  57. package/dist/locales/cy.json.js +11 -0
  58. package/dist/locales/da.json.d.ts +258 -0
  59. package/dist/locales/da.json.js +11 -0
  60. package/dist/locales/de.json.d.ts +258 -0
  61. package/dist/locales/de.json.js +11 -0
  62. package/dist/locales/dv.json.d.ts +258 -0
  63. package/dist/locales/dv.json.js +11 -0
  64. package/dist/locales/el.json.d.ts +324 -0
  65. package/dist/locales/el.json.js +11 -0
  66. package/dist/locales/en.json.d.ts +258 -0
  67. package/dist/locales/en.json.js +11 -0
  68. package/dist/locales/es.json.d.ts +258 -0
  69. package/dist/locales/es.json.js +11 -0
  70. package/dist/locales/et.json.d.ts +258 -0
  71. package/dist/locales/et.json.js +11 -0
  72. package/dist/locales/eu.json.d.ts +258 -0
  73. package/dist/locales/eu.json.js +11 -0
  74. package/dist/locales/fa.json.d.ts +258 -0
  75. package/dist/locales/fa.json.js +11 -0
  76. package/dist/locales/fi.json.d.ts +258 -0
  77. package/dist/locales/fi.json.js +11 -0
  78. package/dist/locales/fr.json.d.ts +258 -0
  79. package/dist/locales/fr.json.js +11 -0
  80. package/dist/locales/ga.json.d.ts +258 -0
  81. package/dist/locales/ga.json.js +11 -0
  82. package/dist/locales/gl.json.d.ts +258 -0
  83. package/dist/locales/gl.json.js +11 -0
  84. package/dist/locales/ha.json.d.ts +258 -0
  85. package/dist/locales/ha.json.js +11 -0
  86. package/dist/locales/he.json.d.ts +258 -0
  87. package/dist/locales/he.json.js +11 -0
  88. package/dist/locales/hi.json.d.ts +258 -0
  89. package/dist/locales/hi.json.js +11 -0
  90. package/dist/locales/hr.json.d.ts +258 -0
  91. package/dist/locales/hr.json.js +11 -0
  92. package/dist/locales/hu.json.d.ts +258 -0
  93. package/dist/locales/hu.json.js +11 -0
  94. package/dist/locales/hy.json.d.ts +258 -0
  95. package/dist/locales/hy.json.js +11 -0
  96. package/dist/locales/id.json.d.ts +258 -0
  97. package/dist/locales/id.json.js +11 -0
  98. package/dist/locales/index.d.ts +78 -0
  99. package/dist/locales/is.json.d.ts +258 -0
  100. package/dist/locales/is.json.js +11 -0
  101. package/dist/locales/it.json.d.ts +258 -0
  102. package/dist/locales/it.json.js +11 -0
  103. package/dist/locales/ja.json.d.ts +258 -0
  104. package/dist/locales/ja.json.js +11 -0
  105. package/dist/locales/ka.json.d.ts +258 -0
  106. package/dist/locales/ka.json.js +11 -0
  107. package/dist/locales/kk.json.d.ts +258 -0
  108. package/dist/locales/kk.json.js +11 -0
  109. package/dist/locales/km.json.d.ts +258 -0
  110. package/dist/locales/km.json.js +11 -0
  111. package/dist/locales/ko.json.d.ts +258 -0
  112. package/dist/locales/ko.json.js +11 -0
  113. package/dist/locales/ku.json.d.ts +258 -0
  114. package/dist/locales/ku.json.js +11 -0
  115. package/dist/locales/ky.json.d.ts +258 -0
  116. package/dist/locales/ky.json.js +11 -0
  117. package/dist/locales/lt.json.d.ts +258 -0
  118. package/dist/locales/lt.json.js +11 -0
  119. package/dist/locales/lv.json.d.ts +258 -0
  120. package/dist/locales/lv.json.js +11 -0
  121. package/dist/locales/mk.json.d.ts +258 -0
  122. package/dist/locales/mk.json.js +11 -0
  123. package/dist/locales/ml.json.d.ts +258 -0
  124. package/dist/locales/ml.json.js +11 -0
  125. package/dist/locales/mn.json.d.ts +258 -0
  126. package/dist/locales/mn.json.js +11 -0
  127. package/dist/locales/mr.json.d.ts +258 -0
  128. package/dist/locales/mr.json.js +11 -0
  129. package/dist/locales/ms.json.d.ts +258 -0
  130. package/dist/locales/ms.json.js +11 -0
  131. package/dist/locales/mt.json.d.ts +258 -0
  132. package/dist/locales/mt.json.js +11 -0
  133. package/dist/locales/nb.json.d.ts +258 -0
  134. package/dist/locales/nb.json.js +11 -0
  135. package/dist/locales/nl.json.d.ts +273 -0
  136. package/dist/locales/nl.json.js +11 -0
  137. package/dist/locales/nn.json.d.ts +258 -0
  138. package/dist/locales/nn.json.js +11 -0
  139. package/dist/locales/no.json.d.ts +258 -0
  140. package/dist/locales/no.json.js +11 -0
  141. package/dist/locales/pl.json.d.ts +258 -0
  142. package/dist/locales/pl.json.js +11 -0
  143. package/dist/locales/ps.json.d.ts +258 -0
  144. package/dist/locales/ps.json.js +11 -0
  145. package/dist/locales/pt.json.d.ts +258 -0
  146. package/dist/locales/pt.json.js +11 -0
  147. package/dist/locales/ro.json.d.ts +258 -0
  148. package/dist/locales/ro.json.js +11 -0
  149. package/dist/locales/ru.json.d.ts +258 -0
  150. package/dist/locales/ru.json.js +11 -0
  151. package/dist/locales/sd.json.d.ts +258 -0
  152. package/dist/locales/sd.json.js +11 -0
  153. package/dist/locales/sk.json.d.ts +258 -0
  154. package/dist/locales/sk.json.js +11 -0
  155. package/dist/locales/sl.json.d.ts +258 -0
  156. package/dist/locales/sl.json.js +11 -0
  157. package/dist/locales/so.json.d.ts +258 -0
  158. package/dist/locales/so.json.js +11 -0
  159. package/dist/locales/sq.json.d.ts +258 -0
  160. package/dist/locales/sq.json.js +11 -0
  161. package/dist/locales/sr.json.d.ts +258 -0
  162. package/dist/locales/sr.json.js +11 -0
  163. package/dist/locales/sv.json.d.ts +258 -0
  164. package/dist/locales/sv.json.js +11 -0
  165. package/dist/locales/sw.json.d.ts +258 -0
  166. package/dist/locales/sw.json.js +11 -0
  167. package/dist/locales/ta.json.d.ts +258 -0
  168. package/dist/locales/ta.json.js +11 -0
  169. package/dist/locales/tg.json.d.ts +258 -0
  170. package/dist/locales/tg.json.js +11 -0
  171. package/dist/locales/th.json.d.ts +258 -0
  172. package/dist/locales/th.json.js +11 -0
  173. package/dist/locales/tk.json.d.ts +258 -0
  174. package/dist/locales/tk.json.js +11 -0
  175. package/dist/locales/tr.json.d.ts +258 -0
  176. package/dist/locales/tr.json.js +11 -0
  177. package/dist/locales/tt.json.d.ts +258 -0
  178. package/dist/locales/tt.json.js +11 -0
  179. package/dist/locales/types.d.ts +1 -0
  180. package/dist/locales/ug.json.d.ts +258 -0
  181. package/dist/locales/ug.json.js +11 -0
  182. package/dist/locales/uk.json.d.ts +258 -0
  183. package/dist/locales/uk.json.js +11 -0
  184. package/dist/locales/ur.json.d.ts +258 -0
  185. package/dist/locales/ur.json.js +11 -0
  186. package/dist/locales/uz.json.d.ts +258 -0
  187. package/dist/locales/uz.json.js +11 -0
  188. package/dist/locales/vi.json.d.ts +258 -0
  189. package/dist/locales/vi.json.js +11 -0
  190. package/dist/locales/zh.json.d.ts +258 -0
  191. package/dist/locales/zh.json.js +11 -0
  192. package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.js +11 -0
  193. package/dist/node_modules/.pnpm/{@radix-ui_react-dialog@1.1.14_@types_react-dom@18.3.7_@types_react@18.3.23__@types_react@18.3_skdkbhdoafm46nddrsexoqxvsa → @radix-ui_react-dialog@1.1.15_@types_react-dom@18.3.7_@types_react@18.3.23__@types_react@18.3_n6h2mnlo6eeop2x37d75f7xnhe}/node_modules/@radix-ui/react-dialog/dist/index.js +4 -4
  194. package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@18.3.7_@types_react@18.3.23__@types_kg5q3nhutdslurngxomqmbsqyy/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +213 -0
  195. package/dist/node_modules/.pnpm/@radix-ui_react-focus-guards@1.1.3_@types_react@18.3.23_react@18.3.1/node_modules/@radix-ui/react-focus-guards/dist/index.js +30 -0
  196. package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.5_@types_react-dom@18.3.7_@types_react@18.3.23__@types_react@18._qvx2ax5olpxuodjkqaw7d5exbm/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
  197. package/dist/node_modules/.pnpm/vaul@1.1.2_@types_react-dom@18.3.7_@types_react@18.3.23__@types_react@18.3.23_react-dom@18.3._hck6bgtscpcdlplcvchrs7yfhu/node_modules/vaul/dist/index.js +1 -1
  198. package/package.json +392 -1
@@ -1,3 +1,4 @@
1
+ import { Direction } from '../../types/global';
1
2
  import { CountryCode } from '../Flag';
2
3
  interface CountryDrawerProps {
3
4
  /** Currently selected country code */
@@ -14,11 +15,15 @@ interface CountryDrawerProps {
14
15
  title?: string;
15
16
  /** Label text shown in the search field */
16
17
  searchLabel?: string;
18
+ /** The reading direction of the drawer. If omitted, assumes LTR (left-to-right) reading mode. */
19
+ dir?: Direction;
20
+ /** Optional BCP 47 locale to localize country names and search */
21
+ locale?: string;
17
22
  /** Callback fired when a country is selected */
18
23
  onChange: (countryCode: string) => void;
19
24
  /** Optional callback fired when drawer open/close animation completes */
20
25
  onAnimationEnd?: (open: boolean) => void;
21
26
  }
22
- declare function CountryDrawer({ onChange, value, countries, onAnimationEnd, disabled, children, defaultValue, title, searchLabel, }: CountryDrawerProps): import("react/jsx-runtime").JSX.Element;
27
+ declare function CountryDrawer({ onChange, value, countries, locale, onAnimationEnd, disabled, children, defaultValue, title, searchLabel, dir, }: CountryDrawerProps): import("react/jsx-runtime").JSX.Element;
23
28
  export { CountryDrawer };
24
29
  export type { CountryDrawerProps };
@@ -6,7 +6,7 @@ import { XMark } from "../Icons/XMark.js";
6
6
  import { GroupedCountryList } from "../PhoneField/GroupedCountryList.js";
7
7
  import { useCountryFiltering } from "./useCountryFiltering.js";
8
8
  import { useCountryGrouping } from "./useCountryGrouping.js";
9
- import { Drawer, DrawerTrigger, DrawerContent, DrawerTitle, DrawerClose } from "../Drawer/Drawer.js";
9
+ import { DrawerDialog, DrawerDialogTrigger, DrawerDialogContent, DrawerDialogTitle, DrawerDialogClose } from "../DrawerDialog/DrawerDialog.js";
10
10
  import { TopBar } from "../TopBar/TopBar.js";
11
11
  import { Button } from "../Button/Button.js";
12
12
  import { SearchField } from "../SearchField/SearchField.js";
@@ -14,12 +14,14 @@ function CountryDrawer({
14
14
  onChange,
15
15
  value,
16
16
  countries,
17
+ locale = "en",
17
18
  onAnimationEnd,
18
19
  disabled = false,
19
20
  children,
20
21
  defaultValue = "US",
21
22
  title = "Country",
22
- searchLabel
23
+ searchLabel,
24
+ dir
23
25
  }) {
24
26
  const [searchText, setSearchText] = useState("");
25
27
  const [open, setOpen] = useState(false);
@@ -29,47 +31,60 @@ function CountryDrawer({
29
31
  };
30
32
  const filteredCountries = useCountryFiltering({
31
33
  countries,
32
- searchText
34
+ searchText,
35
+ locale
33
36
  });
34
37
  const groupedCountries = useCountryGrouping({
35
38
  countries: filteredCountries,
36
- defaultValue
39
+ defaultValue,
40
+ locale
37
41
  });
38
42
  const handleCountrySelect = (countryCode) => {
39
43
  onChange(countryCode);
40
44
  setSearchText("");
41
45
  setOpen(false);
42
46
  };
43
- return /* @__PURE__ */ jsxs(Drawer, { open, onOpenChange: setOpen, onAnimationEnd, height: "full", children: [
44
- /* @__PURE__ */ jsx(DrawerTrigger, { asChild: true, className: "outline-none", disabled, children }),
45
- /* @__PURE__ */ jsxs(DrawerContent, { children: [
46
- /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(DrawerTitle, { children: title }) }),
47
- /* @__PURE__ */ jsx(
48
- TopBar,
49
- {
50
- title,
51
- startAdornment: /* @__PURE__ */ jsx(DrawerClose, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", size: "icon", children: /* @__PURE__ */ jsx(XMark, {}) }) })
52
- }
53
- ),
54
- /* @__PURE__ */ jsx("div", { className: "p-6 shrink-0", children: /* @__PURE__ */ jsx(
55
- SearchField,
56
- {
57
- ref: searchRef,
58
- value: searchText,
59
- onChange: handleSearchChange,
60
- label: searchLabel
61
- }
62
- ) }),
63
- /* @__PURE__ */ jsx("div", { className: "no-scrollbar w-full overflow-auto px-6 grow", children: /* @__PURE__ */ jsx(
64
- GroupedCountryList,
65
- {
66
- groupedCountries,
67
- onSelect: handleCountrySelect,
68
- value
69
- }
70
- ) })
71
- ] })
72
- ] });
47
+ return /* @__PURE__ */ jsxs(
48
+ DrawerDialog,
49
+ {
50
+ open,
51
+ onOpenChange: setOpen,
52
+ onAnimationEnd,
53
+ height: "full",
54
+ children: [
55
+ /* @__PURE__ */ jsx(DrawerDialogTrigger, { asChild: true, className: "outline-none", disabled, children }),
56
+ /* @__PURE__ */ jsx(DrawerDialogContent, { dialogClassName: "h-[80vh]", dir, children: /* @__PURE__ */ jsxs("div", { children: [
57
+ /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(DrawerDialogTitle, { children: title }) }),
58
+ /* @__PURE__ */ jsx(
59
+ TopBar,
60
+ {
61
+ title,
62
+ startAdornment: /* @__PURE__ */ jsx(DrawerDialogClose, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", size: "icon", children: /* @__PURE__ */ jsx(XMark, {}) }) })
63
+ }
64
+ ),
65
+ /* @__PURE__ */ jsx("div", { className: "p-6 shrink-0", children: /* @__PURE__ */ jsx(
66
+ SearchField,
67
+ {
68
+ ref: searchRef,
69
+ value: searchText,
70
+ onChange: handleSearchChange,
71
+ label: searchLabel
72
+ }
73
+ ) }),
74
+ /* @__PURE__ */ jsx("div", { className: "no-scrollbar w-full overflow-auto px-6 pb-6 grow", children: /* @__PURE__ */ jsx(
75
+ GroupedCountryList,
76
+ {
77
+ groupedCountries,
78
+ onSelect: handleCountrySelect,
79
+ value,
80
+ dir,
81
+ locale
82
+ }
83
+ ) })
84
+ ] }) })
85
+ ]
86
+ }
87
+ );
73
88
  }
74
89
  export {
75
90
  CountryDrawer
@@ -2,6 +2,7 @@ import { CountryCode } from '../Flag';
2
2
  interface UseCountryFilteringProps {
3
3
  countries?: CountryCode[];
4
4
  searchText: string;
5
+ locale: string;
5
6
  }
6
- export declare function useCountryFiltering({ countries, searchText }: UseCountryFilteringProps): import('react-international-phone').CountryData[];
7
+ export declare function useCountryFiltering({ countries, searchText, locale, }: UseCountryFilteringProps): import('react-international-phone').CountryData[];
7
8
  export {};
@@ -1,8 +1,19 @@
1
+ import { useI18n } from "../../lib/I18nProvider.js";
1
2
  import { defaultCountries as R } from "../../node_modules/.pnpm/react-international-phone@4.5.0_react@18.3.1/node_modules/react-international-phone/dist/index.js";
2
3
  import { getCountryDataListByCodes, filterCountries } from "../PhoneField/utils.js";
3
- function useCountryFiltering({ countries, searchText }) {
4
+ function useCountryFiltering({
5
+ countries,
6
+ searchText,
7
+ locale
8
+ }) {
9
+ const i18nStore = useI18n();
4
10
  const richCountries = countries ? getCountryDataListByCodes(countries) : R;
5
- const filteredCountries = filterCountries(richCountries, searchText);
11
+ const filteredCountries = filterCountries({
12
+ countries: richCountries,
13
+ searchText,
14
+ i18nStore,
15
+ locale
16
+ });
6
17
  return filteredCountries;
7
18
  }
8
19
  export {
@@ -1,3 +1,4 @@
1
+ import { CountryData } from 'react-international-phone';
1
2
  import { CountryCode } from '../Flag';
2
3
  interface GroupedCountries {
3
4
  [key: string]: {
@@ -6,8 +7,9 @@ interface GroupedCountries {
6
7
  }[];
7
8
  }
8
9
  interface UseCountryGroupingProps {
9
- countries: any[];
10
+ countries: CountryData[];
10
11
  defaultValue?: CountryCode;
12
+ locale?: string;
11
13
  }
12
- export declare function useCountryGrouping({ countries, defaultValue, }: UseCountryGroupingProps): GroupedCountries;
14
+ export declare function useCountryGrouping({ countries, defaultValue, locale, }: UseCountryGroupingProps): GroupedCountries;
13
15
  export {};
@@ -1,12 +1,18 @@
1
+ import { useI18n } from "../../lib/I18nProvider.js";
1
2
  import { parseCountry as M } from "../../node_modules/.pnpm/react-international-phone@4.5.0_react@18.3.1/node_modules/react-international-phone/dist/index.js";
2
- import { getValidatedCountryCode } from "../PhoneField/utils.js";
3
+ import { normalizeString, getValidatedCountryCode } from "../PhoneField/utils.js";
3
4
  function useCountryGrouping({
4
5
  countries,
5
- defaultValue = "US"
6
+ defaultValue = "US",
7
+ locale = "en"
6
8
  }) {
9
+ const i18nStore = useI18n();
7
10
  const groupedCountries = countries.reduce((acc, country) => {
8
11
  const parsedCountry = M(country);
9
- const firstLetter = parsedCountry.name.charAt(0).toUpperCase();
12
+ const countryName = i18nStore.getName(parsedCountry.iso2, locale);
13
+ const nameToUse = countryName ?? parsedCountry.name;
14
+ const normalizedName = normalizeString(nameToUse);
15
+ const firstLetter = normalizedName.charAt(0).toUpperCase();
10
16
  if (!acc[firstLetter]) {
11
17
  acc[firstLetter] = [];
12
18
  }
@@ -0,0 +1,13 @@
1
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
2
+ import * as React from "react";
3
+ declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
5
+ declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
6
+ declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
7
+ declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
8
+ declare function DialogContent({ className, children, ...props }: React.ComponentProps<typeof DialogPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
9
+ declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
10
+ declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
11
+ declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
12
+ declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
13
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
@@ -0,0 +1,91 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { cn } from "../../lib/utils.js";
4
+ import { Root, Trigger, Content, Title, Close, Portal, Overlay, Description } from "../../node_modules/.pnpm/@radix-ui_react-dialog@1.1.15_@types_react-dom@18.3.7_@types_react@18.3.23__@types_react@18.3_n6h2mnlo6eeop2x37d75f7xnhe/node_modules/@radix-ui/react-dialog/dist/index.js";
5
+ function Dialog({ ...props }) {
6
+ return /* @__PURE__ */ jsx(Root, { "data-slot": "dialog", ...props });
7
+ }
8
+ function DialogTrigger({ ...props }) {
9
+ return /* @__PURE__ */ jsx(Trigger, { "data-slot": "dialog-trigger", ...props });
10
+ }
11
+ function DialogPortal({ ...props }) {
12
+ return /* @__PURE__ */ jsx(Portal, { "data-slot": "dialog-portal", ...props });
13
+ }
14
+ function DialogClose({ ...props }) {
15
+ return /* @__PURE__ */ jsx(Close, { "data-slot": "dialog-close", ...props });
16
+ }
17
+ function DialogOverlay({
18
+ className,
19
+ ...props
20
+ }) {
21
+ return /* @__PURE__ */ jsx(
22
+ Overlay,
23
+ {
24
+ "data-slot": "dialog-overlay",
25
+ className: cn(
26
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-gray-900/40",
27
+ className
28
+ ),
29
+ ...props
30
+ }
31
+ );
32
+ }
33
+ function DialogContent({
34
+ className,
35
+ children,
36
+ ...props
37
+ }) {
38
+ return /* @__PURE__ */ jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
39
+ /* @__PURE__ */ jsx(DialogOverlay, {}),
40
+ /* @__PURE__ */ jsx(
41
+ Content,
42
+ {
43
+ "data-slot": "dialog-content",
44
+ className: cn(
45
+ "bg-gray-0 rounded-[1.75rem] sm:max-w-lg max-h-[80vh] overflow-y-auto",
46
+ "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] origin-center",
47
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-75 data-[state=open]:zoom-in-75 data-[state=closed]:duration-200 data-[state=open]:duration-200",
48
+ className
49
+ ),
50
+ ...props,
51
+ children
52
+ }
53
+ )
54
+ ] });
55
+ }
56
+ function DialogTitle({
57
+ className,
58
+ ...props
59
+ }) {
60
+ return /* @__PURE__ */ jsx(
61
+ Title,
62
+ {
63
+ "data-slot": "dialog-title",
64
+ className: cn("text-lg leading-none font-semibold", className),
65
+ ...props
66
+ }
67
+ );
68
+ }
69
+ function DialogDescription({
70
+ className,
71
+ ...props
72
+ }) {
73
+ return /* @__PURE__ */ jsx(
74
+ Description,
75
+ {
76
+ "data-slot": "dialog-description",
77
+ className: cn("text-muted-foreground text-sm", className),
78
+ ...props
79
+ }
80
+ );
81
+ }
82
+ export {
83
+ Dialog,
84
+ DialogClose,
85
+ DialogContent,
86
+ DialogDescription,
87
+ DialogOverlay,
88
+ DialogPortal,
89
+ DialogTitle,
90
+ DialogTrigger
91
+ };
@@ -0,0 +1,32 @@
1
+ import { DialogOverlay, DialogPortal } from '../Dialog/Dialog';
2
+ import { DrawerCloseProps, DrawerContentProps, DrawerHeaderProps, DrawerProps, DrawerTitleProps, DrawerTriggerProps } from '../Drawer/types';
3
+ import * as React from "react";
4
+ declare const DrawerDialog: {
5
+ (props: DrawerProps): import("react/jsx-runtime").JSX.Element;
6
+ displayName: string;
7
+ };
8
+ declare const DrawerDialogTrigger: React.ForwardRefExoticComponent<DrawerTriggerProps & React.RefAttributes<HTMLButtonElement>>;
9
+ declare const DrawerDialogClose: React.ForwardRefExoticComponent<DrawerCloseProps & React.RefAttributes<HTMLButtonElement>>;
10
+ declare const DrawerDialogContent: React.ForwardRefExoticComponent<DrawerContentProps & {
11
+ dialogClassName?: string;
12
+ } & React.RefAttributes<HTMLDivElement>>;
13
+ declare const DrawerDialogHeader: {
14
+ (props: DrawerHeaderProps): import("react/jsx-runtime").JSX.Element;
15
+ displayName: string;
16
+ };
17
+ declare const DrawerDialogTitle: React.ForwardRefExoticComponent<DrawerTitleProps & React.RefAttributes<HTMLHeadingElement>>;
18
+ declare const DrawerDialogDescription: React.ForwardRefExoticComponent<Omit<import('@radix-ui/react-dialog').DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
19
+ declare const DrawerDialogFooter: {
20
+ (props: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
21
+ displayName: string;
22
+ };
23
+ declare const DrawerDialogOverlay: {
24
+ (props: React.ComponentProps<typeof DialogOverlay>): import("react/jsx-runtime").JSX.Element | null;
25
+ displayName: string;
26
+ };
27
+ declare const DrawerDialogPortal: {
28
+ (props: React.ComponentProps<typeof DialogPortal>): import("react/jsx-runtime").JSX.Element;
29
+ displayName: string;
30
+ };
31
+ export { DrawerDialog, DrawerDialogClose, DrawerDialogContent, DrawerDialogDescription, DrawerDialogFooter, DrawerDialogHeader, DrawerDialogOverlay, DrawerDialogPortal, DrawerDialogTitle, DrawerDialogTrigger, };
32
+ export type { DrawerProps as DrawerDialogProps, DrawerContentProps as DrawerDialogContentProps, DrawerHeaderProps as DrawerDialogHeaderProps, DrawerTitleProps as DrawerDialogTitleProps, DrawerTriggerProps as DrawerDialogTriggerProps, DrawerCloseProps as DrawerDialogCloseProps, };
@@ -0,0 +1,71 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useMediaQuery } from "../../hooks/use-media-query.js";
4
+ import { cn } from "../../lib/utils.js";
5
+ import * as React from "react";
6
+ import { Dialog, DialogTrigger, DialogContent, DialogTitle, DialogClose, DialogDescription } from "../Dialog/Dialog.js";
7
+ import { Drawer, DrawerTrigger, DrawerContent, DrawerTitle, DrawerClose } from "../Drawer/Drawer.js";
8
+ const MOBILE_BREAKPOINT = "(max-width: 768px)";
9
+ const DrawerDialog = (props) => {
10
+ const isMobile = useMediaQuery(MOBILE_BREAKPOINT);
11
+ if (isMobile) {
12
+ return /* @__PURE__ */ jsx(Drawer, { ...props });
13
+ }
14
+ return /* @__PURE__ */ jsx(Dialog, { ...props });
15
+ };
16
+ DrawerDialog.displayName = "DrawerDialog";
17
+ const DrawerDialogTrigger = React.forwardRef((props, ref) => {
18
+ const isMobile = useMediaQuery(MOBILE_BREAKPOINT);
19
+ if (isMobile) {
20
+ return /* @__PURE__ */ jsx(DrawerTrigger, { ...props, ref });
21
+ }
22
+ return /* @__PURE__ */ jsx(DialogTrigger, { ...props, ref });
23
+ });
24
+ DrawerDialogTrigger.displayName = "DrawerDialogTrigger";
25
+ const DrawerDialogClose = React.forwardRef((props, ref) => {
26
+ const isMobile = useMediaQuery(MOBILE_BREAKPOINT);
27
+ if (isMobile) {
28
+ return /* @__PURE__ */ jsx(DrawerClose, { ...props, ref });
29
+ }
30
+ return /* @__PURE__ */ jsx(DialogClose, { ...props, ref });
31
+ });
32
+ DrawerDialogClose.displayName = "DrawerDialogClose";
33
+ const DrawerDialogContent = React.forwardRef((props, ref) => {
34
+ const isMobile = useMediaQuery(MOBILE_BREAKPOINT);
35
+ if (isMobile) {
36
+ return /* @__PURE__ */ jsx(DrawerContent, { ...props, ref });
37
+ }
38
+ return /* @__PURE__ */ jsx(
39
+ DialogContent,
40
+ {
41
+ ...props,
42
+ ref,
43
+ className: cn(props.className, props.dialogClassName)
44
+ }
45
+ );
46
+ });
47
+ DrawerDialogContent.displayName = "DrawerDialogContent";
48
+ const DrawerDialogTitle = React.forwardRef((props, ref) => {
49
+ const isMobile = useMediaQuery(MOBILE_BREAKPOINT);
50
+ if (isMobile) {
51
+ return /* @__PURE__ */ jsx(DrawerTitle, { ...props, ref });
52
+ }
53
+ return /* @__PURE__ */ jsx(DialogTitle, { ...props, ref });
54
+ });
55
+ DrawerDialogTitle.displayName = "DrawerDialogTitle";
56
+ const DrawerDialogDescription = React.forwardRef((props, ref) => {
57
+ const isMobile = useMediaQuery(MOBILE_BREAKPOINT);
58
+ if (isMobile) {
59
+ return null;
60
+ }
61
+ return /* @__PURE__ */ jsx(DialogDescription, { ...props, ref });
62
+ });
63
+ DrawerDialogDescription.displayName = "DrawerDialogDescription";
64
+ export {
65
+ DrawerDialog,
66
+ DrawerDialogClose,
67
+ DrawerDialogContent,
68
+ DrawerDialogDescription,
69
+ DrawerDialogTitle,
70
+ DrawerDialogTrigger
71
+ };
@@ -0,0 +1,2 @@
1
+ export { DrawerDialog, DrawerDialogClose, DrawerDialogContent, DrawerDialogDescription, DrawerDialogFooter, DrawerDialogHeader, DrawerDialogOverlay, DrawerDialogPortal, DrawerDialogTitle, DrawerDialogTrigger, } from './DrawerDialog';
2
+ export type { DrawerDialogProps, DrawerDialogContentProps, DrawerDialogHeaderProps, DrawerDialogTitleProps, DrawerDialogTriggerProps, DrawerDialogCloseProps, } from './DrawerDialog';
@@ -1,12 +1,14 @@
1
+ import { Direction } from '../../types/global';
1
2
  import { CountryCode } from '../Flag';
2
3
  interface CountryListItemProps {
3
4
  countryCode: CountryCode;
4
5
  countryName: string;
5
6
  isSelected?: boolean;
6
7
  onClick?: (value: CountryCode) => void;
8
+ dir?: Direction;
7
9
  }
8
10
  declare const CountryListItem: {
9
- ({ countryCode, countryName, onClick, isSelected, }: CountryListItemProps): import("react/jsx-runtime").JSX.Element;
11
+ ({ countryCode, countryName, onClick, isSelected, dir, }: CountryListItemProps): import("react/jsx-runtime").JSX.Element;
10
12
  displayName: string;
11
13
  };
12
14
  export default CountryListItem;
@@ -5,7 +5,8 @@ const CountryListItem = ({
5
5
  countryCode,
6
6
  countryName,
7
7
  onClick,
8
- isSelected
8
+ isSelected,
9
+ dir
9
10
  }) => {
10
11
  return /* @__PURE__ */ jsxs(
11
12
  "button",
@@ -14,6 +15,7 @@ const CountryListItem = ({
14
15
  "data-country": countryCode,
15
16
  className: "h-[3.75rem] flex items-center w-full gap-2 cursor-pointer",
16
17
  onClick: () => onClick == null ? void 0 : onClick(countryCode),
18
+ dir,
17
19
  ...isSelected && { "data-selected": true },
18
20
  children: [
19
21
  /* @__PURE__ */ jsx(Flag, { countryCode, size: 32 }),
@@ -10,7 +10,7 @@ const triggerVariants = cva(
10
10
  {
11
11
  variants: {
12
12
  disabled: {
13
- true: "cursor-not-allowed opacity-20",
13
+ true: "cursor-not-allowed opacity-20 pointer-events-none",
14
14
  false: ""
15
15
  }
16
16
  },
@@ -28,6 +28,7 @@ const CountrySelectorButton = forwardRef(
28
28
  ...props,
29
29
  className: cn(triggerVariants({ disabled, className })),
30
30
  "data-testid": "country-selector-button",
31
+ "aria-disabled": disabled,
31
32
  children: [
32
33
  /* @__PURE__ */ jsx("div", { className: "mr-2", children: /* @__PURE__ */ jsx(Flag, { countryCode: value, size: 24 }) }),
33
34
  /* @__PURE__ */ jsx(Typography, { variant: "subtitle", level: 3, className: "mr-2", children: label }),
@@ -1,3 +1,4 @@
1
+ import { Direction } from '../../types/global';
1
2
  import { CountryCode } from '../Flag';
2
3
  interface GroupedCountries {
3
4
  [key: string]: {
@@ -9,6 +10,8 @@ interface GroupedCountryListProps {
9
10
  groupedCountries: GroupedCountries;
10
11
  value: CountryCode;
11
12
  onSelect: (countryCode: CountryCode) => void;
13
+ dir?: Direction;
14
+ locale?: string;
12
15
  }
13
- export declare function GroupedCountryList({ groupedCountries, onSelect, value, }: GroupedCountryListProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function GroupedCountryList({ groupedCountries, onSelect, value, dir, locale, }: GroupedCountryListProps): import("react/jsx-runtime").JSX.Element;
14
17
  export {};
@@ -1,4 +1,5 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useI18n } from "../../lib/I18nProvider.js";
2
3
  import { withHaptics } from "../../lib/haptics.js";
3
4
  import { Magnifier } from "../Icons/Magnifier.js";
4
5
  import CountryListItem from "./CountryListItem.js";
@@ -7,23 +8,30 @@ import { DrawerClose } from "../Drawer/Drawer.js";
7
8
  function GroupedCountryList({
8
9
  groupedCountries,
9
10
  onSelect,
10
- value
11
+ value,
12
+ dir,
13
+ locale
11
14
  }) {
15
+ const i18nStore = useI18n();
12
16
  if (Object.keys(groupedCountries).length === 0) {
13
17
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center grow text-gray-400 gap-2 h-full", children: [
14
18
  /* @__PURE__ */ jsx(Magnifier, { className: "size-8" }),
15
19
  /* @__PURE__ */ jsx(Typography, { variant: "body", level: 3, children: "No search results" })
16
20
  ] });
17
21
  }
18
- return /* @__PURE__ */ jsx(Fragment, { children: Object.entries(groupedCountries).sort(([a], [b]) => a.localeCompare(b)).map(([letter, countries]) => /* @__PURE__ */ jsxs("div", { className: "group", children: [
22
+ return /* @__PURE__ */ jsx("div", { dir, children: Object.entries(groupedCountries).sort(([a], [b]) => a.localeCompare(b, locale)).map(([letter, countries]) => /* @__PURE__ */ jsxs("div", { className: "group", children: [
19
23
  /* @__PURE__ */ jsx(Typography, { variant: "subtitle", level: 3, className: "text-gray-400 mb-2", children: letter }),
20
- countries.map((country) => /* @__PURE__ */ jsx(DrawerClose, { asChild: true, children: /* @__PURE__ */ jsx(
24
+ countries.sort((a, b) => a.name.localeCompare(b.name, locale)).map((country) => /* @__PURE__ */ jsx(DrawerClose, { asChild: true, children: /* @__PURE__ */ jsx(
21
25
  CountryListItem,
22
26
  {
23
27
  countryCode: country.countryCode,
24
- countryName: country.name,
28
+ countryName: i18nStore.getName(
29
+ country.countryCode,
30
+ typeof locale === "string" ? locale : (locale == null ? void 0 : locale[0]) ?? "en"
31
+ ) ?? country.name,
25
32
  onClick: withHaptics(onSelect),
26
- isSelected: value === country.countryCode
33
+ isSelected: value === country.countryCode,
34
+ dir
27
35
  }
28
36
  ) }, country.countryCode)),
29
37
  /* @__PURE__ */ jsx("div", { className: "h-[1px] bg-gray-200 my-4 group-last:hidden" })
@@ -1,3 +1,4 @@
1
+ import { Direction } from '../../types/global';
1
2
  import { CountryCode } from '../Flag/types';
2
3
  import { InputProps } from '../Input';
3
4
  interface PhoneFieldProps extends Omit<InputProps, "onChange" | "startAdornment" | "placeholder"> {
@@ -48,6 +49,12 @@ interface PhoneFieldProps extends Omit<InputProps, "onChange" | "startAdornment"
48
49
  * The component should use currentColor to match the Input's styling.
49
50
  */
50
51
  endAdornment?: React.ReactNode;
52
+ /**
53
+ * The reading direction of the phone field. If omitted, inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode.
54
+ */
55
+ dir?: Direction;
56
+ /** Optional BCP 47 locale to localize country names and search */
57
+ locale?: string;
51
58
  }
52
59
  declare const PhoneField: import('react').ForwardRefExoticComponent<PhoneFieldProps & import('react').RefAttributes<HTMLDivElement>>;
53
60
  export { PhoneField };
@@ -23,6 +23,8 @@ const PhoneField = forwardRef(
23
23
  inputMode = "tel",
24
24
  autoCapitalize = "off",
25
25
  autoCorrect = "off",
26
+ dir,
27
+ locale,
26
28
  ...props
27
29
  }, ref) => {
28
30
  const { inputValue, country, inputRef, handlePhoneValueChange, setCountry } = ee(
@@ -80,6 +82,8 @@ const PhoneField = forwardRef(
80
82
  onAnimationEnd: handleDrawerAnimationEnd,
81
83
  onChange: handleCountrySelect,
82
84
  disabled,
85
+ dir,
86
+ locale,
83
87
  children: /* @__PURE__ */ jsx(CountrySelectorButton, { value: selectedCountryCode, label: currentDialCode })
84
88
  }
85
89
  )
@@ -1,5 +1,18 @@
1
+ import { I18nStore } from '../../lib/i18n';
1
2
  import { CountryData } from 'react-international-phone';
2
3
  import { CountryCode } from '../Flag';
4
+ /**
5
+ * Normalizes a string by removing accents and diacritics, then converts to lowercase.
6
+ * This makes string comparison accent-agnostic.
7
+ * @param str - The string to normalize
8
+ * @returns The normalized string in lowercase without accents/diacritics
9
+ */
10
+ export declare const normalizeString: (str: string) => string;
3
11
  export declare const getValidatedCountryCode: (code: string, defaultCountryCode: CountryCode) => CountryCode;
4
12
  export declare const getCountryDataListByCodes: (countryCodes: CountryCode[] | undefined) => CountryData[];
5
- export declare const filterCountries: (countries: CountryData[], searchText: string) => CountryData[];
13
+ export declare const filterCountries: ({ countries, searchText, i18nStore, locale, }: {
14
+ countries: CountryData[];
15
+ searchText: string;
16
+ i18nStore: I18nStore;
17
+ locale: string;
18
+ }) => CountryData[];
@@ -1,6 +1,9 @@
1
1
  import { defaultCountries as R, parseCountry as M } from "../../node_modules/.pnpm/react-international-phone@4.5.0_react@18.3.1/node_modules/react-international-phone/dist/index.js";
2
2
  import { isSupportedCountryCode } from "../Flag/utils.js";
3
3
  import { DIAL_CODE_PREFIX } from "./constants.js";
4
+ const normalizeString = (str) => {
5
+ return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
6
+ };
4
7
  const getValidatedCountryCode = (code, defaultCountryCode) => {
5
8
  const upperCaseCode = code.toUpperCase();
6
9
  return isSupportedCountryCode(upperCaseCode) ? upperCaseCode : defaultCountryCode;
@@ -15,20 +18,26 @@ const getCountryDataListByCodes = (countryCodes) => {
15
18
  return countryCodeSet.has(countryCode);
16
19
  });
17
20
  };
18
- const filterCountries = (countries, searchText) => {
21
+ const filterCountries = ({
22
+ countries,
23
+ searchText,
24
+ i18nStore,
25
+ locale
26
+ }) => {
19
27
  if (!searchText) {
20
28
  return countries;
21
29
  }
30
+ const normalizedSearch = normalizeString(searchText);
22
31
  return countries.filter((country) => {
23
32
  const parsedCountry = M(country);
24
- const countryName = parsedCountry.name.toLowerCase();
33
+ const countryName = i18nStore.getName(parsedCountry.iso2.toLocaleUpperCase(), locale) ?? parsedCountry.name;
25
34
  const dialCode = `${DIAL_CODE_PREFIX}${parsedCountry.dialCode.toLowerCase()}`;
26
- const searchLower = searchText.toLowerCase();
27
- return countryName.includes(searchLower) || dialCode.includes(searchLower);
35
+ return normalizeString(countryName).includes(normalizedSearch) || normalizeString(dialCode).includes(normalizedSearch);
28
36
  });
29
37
  };
30
38
  export {
31
39
  filterCountries,
32
40
  getCountryDataListByCodes,
33
- getValidatedCountryCode
41
+ getValidatedCountryCode,
42
+ normalizeString
34
43
  };