@plexui/react-native 0.2.9 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ // Generated by scripts/build-icons.mjs. Do not edit.
2
+ import { createIcon } from "../../components/Icon/createIcon";
3
+ export default createIcon("LayoutGrid", "0 0 24 24", [["path", { "d": "M4 4V9H9V4H4ZM11 9C11 10.1046 10.1046 11 9 11H4C2.89543 11 2 10.1046 2 9V4C2 2.89543 2.89543 2 4 2H9C10.1046 2 11 2.89543 11 4V9Z", "fill": 0 }], ["path", { "d": "M15 4V9H20V4H15ZM22 9C22 10.1046 21.1046 11 20 11H15C13.89543 11 13 10.1046 13 9V4C13 2.89543 13.89543 2 15 2H20C21.1046 2 22 2.89543 22 4V9Z", "fill": 0 }], ["path", { "d": "M4 15V20H9V15H4ZM11 20C11 21.1046 10.1046 22 9 22H4C2.89543 22 2 21.1046 2 20V15C2 13.89543 2.89543 13 4 13H9C10.1046 13 11 13.89543 11 15V20Z", "fill": 0 }], ["path", { "d": "M15 15V20H20V15H15ZM22 20C22 21.1046 21.1046 22 20 22H15C13.89543 22 13 21.1046 13 20V15C13 13.89543 13.89543 13 15 13H20C21.1046 13 22 13.89543 22 15V20Z", "fill": 0 }]]);
@@ -311,6 +311,7 @@ export { default as Keyboard } from "./Keyboard";
311
311
  export { default as KeyboardShortcut } from "./KeyboardShortcut";
312
312
  export { default as Language } from "./Language";
313
313
  export { default as Latency } from "./Latency";
314
+ export { default as LayoutGrid } from "./LayoutGrid";
314
315
  export { default as LayoutList } from "./LayoutList";
315
316
  export { default as LightMode } from "./LightMode";
316
317
  export { default as Lightbulb } from "./Lightbulb";
package/dist/es/index.js CHANGED
@@ -23,6 +23,7 @@ export { FloatingLabelInput } from "./components/FloatingLabelInput/FloatingLabe
23
23
  export { InputGroup, } from "./components/InputGroup/InputGroup";
24
24
  export { TagInput } from "./components/TagInput/TagInput";
25
25
  export { OTPInput } from "./components/OTPInput/OTPInput";
26
+ export { PhoneInput } from "./components/PhoneInput/PhoneInput";
26
27
  export { Select } from "./components/Select/Select";
27
28
  export { Menu } from "./components/Menu/Menu";
28
29
  export { ContextMenu } from "./components/ContextMenu/ContextMenu";
@@ -0,0 +1,53 @@
1
+ import { type ReactNode } from "react";
2
+ import { type StyleProp, type ViewStyle } from "react-native";
3
+ import { type CountryCode, type PhoneDetails } from "./phone";
4
+ export type { CountryCode, PhoneDetails };
5
+ export type PhoneInputProps = {
6
+ /** The number in E.164 (`+447700900123`), or the digits typed so far after the code; "" when empty. */
7
+ value?: string;
8
+ defaultValue?: string;
9
+ /** Called on each change with the value in E.164 and what the field knows about it (its region, validity). */
10
+ onChange?: (value: string, details: PhoneDetails) => void;
11
+ /** The region the number is typed in. */
12
+ country?: CountryCode;
13
+ /** @default the device's region (its locale's), else "US" */
14
+ defaultCountry?: CountryCode;
15
+ /** Called when the region changes: picked from the list, or named by a pasted international number. */
16
+ onCountryChange?: (country: CountryCode) => void;
17
+ /** The regions the list offers. @default every region with a calling code */
18
+ countries?: readonly CountryCode[];
19
+ /** The locale of the regions' names (Intl.DisplayNames; English where the engine has none). @default the device's */
20
+ locale?: string;
21
+ /** Groups the digits as the region writes them, while they are typed at the end. @default false on iOS (Settings' Add Phone Number shows the digits as typed), true on Android */
22
+ formatting?: boolean;
23
+ /** Flags before the regions' names in the list. @default false */
24
+ flags?: boolean;
25
+ /** The number field's placeholder and name. @default "Phone number" */
26
+ label?: string;
27
+ /** The region row's name and the list's title. @default "Country or Region" */
28
+ countryLabel?: string;
29
+ /** The list's search placeholder. @default "Search" */
30
+ searchPlaceholder?: string;
31
+ /** iOS: the group's header over the two rows. */
32
+ header?: ReactNode;
33
+ /** Words under the field (iOS: the group's footer). */
34
+ description?: ReactNode;
35
+ /** An error under the field; it marks the field invalid. */
36
+ errorMessage?: string;
37
+ invalid?: boolean;
38
+ disabled?: boolean;
39
+ autoFocus?: boolean;
40
+ onBlur?: () => void;
41
+ onSubmitEditing?: () => void;
42
+ returnKeyType?: "done" | "next" | "go" | "send";
43
+ testID?: string;
44
+ style?: StyleProp<ViewStyle>;
45
+ };
46
+ /**
47
+ * A phone number field: the region and the number, as iOS's Add Phone Number (Settings): one group of two rows, the
48
+ * region's code and name with a chevron, which opens the list of regions, then the number alone; on Android Material's
49
+ * region dropdown field over the number's outlined field. The value is E.164; a pasted or autofilled international
50
+ * number picks its region, a national trunk prefix (the UK's 0) is dropped from the value, and the field takes no more
51
+ * digits than the region's longest number (libphonenumber's metadata).
52
+ */
53
+ export declare function PhoneInput({ value: valueProp, defaultValue, onChange, country: countryProp, defaultCountry, onCountryChange, countries, locale, formatting, flags, label, countryLabel, searchPlaceholder, header, description, errorMessage, invalid, disabled, autoFocus, onBlur, onSubmitEditing, returnKeyType, testID, style, }: PhoneInputProps): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const COUNTRY_NAMES: Record<string, string>;
@@ -0,0 +1,51 @@
1
+ import { type CountryCode } from "libphonenumber-js/min";
2
+ export type { CountryCode };
3
+ /** What the field knows about its number, beside its value. */
4
+ export type PhoneDetails = {
5
+ /** The number in E.164 (`+447700900123`); while it is typed, the digits so far after the code (`+44770`); "" when empty. */
6
+ value: string;
7
+ /** The region the number is read in: the picked one, or the one a pasted international number names. */
8
+ country: CountryCode;
9
+ /** The number as the field shows it, without the code. */
10
+ text: string;
11
+ /** The number's length fits its region (it could be dialled). */
12
+ possible: boolean;
13
+ /** The number fits its region's lengths and leading digits. */
14
+ valid: boolean;
15
+ };
16
+ /** Every region with a calling code, as ISO 3166-1 alpha-2. */
17
+ export declare const ALL_COUNTRIES: readonly CountryCode[];
18
+ /** The calling code of a region, with its plus: `+44`. */
19
+ export declare function dialCode(country: CountryCode): string;
20
+ /** The regions that share a calling code, its main region first (+1: the US, then Canada and the Caribbean). */
21
+ export declare function countriesForCode(code: string): CountryCode[];
22
+ /** Whether a string is a region the metadata knows. */
23
+ export declare function isCountry(value: unknown): value is CountryCode;
24
+ /** A region's name in the locale (Intl.DisplayNames), in English where the engine has no Intl.DisplayNames. */
25
+ export declare function countryName(country: CountryCode, locale?: string): string;
26
+ /** The flag of a region, as its two regional indicator symbols. */
27
+ export declare function countryFlag(country: CountryCode): string;
28
+ /** The device's region, from the locale the engine runs in (`en-GB` → GB); undefined when the locale names none. */
29
+ export declare function deviceCountry(): CountryCode | undefined;
30
+ /** Folds a name for search: lower case, no accents (`Côte d’Ivoire` → `cote d’ivoire`). */
31
+ export declare function fold(text: string): string;
32
+ /** Whether a region answers a search: by its name (any word's start), its ISO code or its calling code (`44`, `+44`). */
33
+ export declare function matchesCountry(country: CountryCode, name: string, query: string): boolean;
34
+ /** The digits of a text, in order. */
35
+ export declare function digitsOf(text: string): string;
36
+ /** The number's details for its national digits in a region; `format` groups the digits as the region writes them. */
37
+ export declare function readNational(digits: string, country: CountryCode, format: boolean): PhoneDetails;
38
+ /** Whether national digits are longer than any number of the region (the field takes no more). */
39
+ export declare function tooLong(digits: string, country: CountryCode): boolean;
40
+ /** Whether a value in E.164 is longer than any number of its region. */
41
+ export declare function tooLongValue(value: string): boolean;
42
+ /**
43
+ * What the number field holds after a change: a typed national number in the picked region, or a pasted or autofilled
44
+ * international one (`+44 7700 900123`, `0044…`), whose code picks the region (the picked region stays when it shares
45
+ * the code and the number fits it: +1 in Canada) and is dropped from the field.
46
+ */
47
+ export declare function readInput(text: string, country: CountryCode, format: boolean): PhoneDetails;
48
+ /** The field's details for a value in E.164 (or the digits so far after a code), read in a region. */
49
+ export declare function readValue(value: string | undefined, country: CountryCode, format: boolean): PhoneDetails;
50
+ /** The caret's place after `count` digits in a formatted text (just after the count-th digit). */
51
+ export declare function caretAfterDigits(text: string, count: number): number;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("../..").IconComponent;
2
+ export default _default;
@@ -309,6 +309,7 @@ export { default as Keyboard } from "./Keyboard";
309
309
  export { default as KeyboardShortcut } from "./KeyboardShortcut";
310
310
  export { default as Language } from "./Language";
311
311
  export { default as Latency } from "./Latency";
312
+ export { default as LayoutGrid } from "./LayoutGrid";
312
313
  export { default as LayoutList } from "./LayoutList";
313
314
  export { default as LightMode } from "./LightMode";
314
315
  export { default as Lightbulb } from "./Lightbulb";
@@ -22,6 +22,7 @@ export { FloatingLabelInput, type FloatingLabelInputProps } from "./components/F
22
22
  export { InputGroup, type InputGroupAddonAlign, type InputGroupAddonProps, type InputGroupButtonProps, type InputGroupInputProps, type InputGroupProps, type InputGroupTextareaProps, type InputGroupTextProps, } from "./components/InputGroup/InputGroup";
23
23
  export { TagInput, type Tag, type TagInputProps } from "./components/TagInput/TagInput";
24
24
  export { OTPInput, type OTPInputProps } from "./components/OTPInput/OTPInput";
25
+ export { PhoneInput, type CountryCode, type PhoneDetails, type PhoneInputProps } from "./components/PhoneInput/PhoneInput";
25
26
  export { Select, type SelectOption, type SelectProps } from "./components/Select/Select";
26
27
  export { Menu, type MenuContentProps, type MenuItemProps, type MenuProps } from "./components/Menu/Menu";
27
28
  export { ContextMenu, type ContextMenuContentProps, type ContextMenuProps } from "./components/ContextMenu/ContextMenu";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/react-native",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "Plex UI components for React Native and Expo: iOS 26 and Material 3, on the shared @plexui/styles tokens",
5
5
  "license": "MIT",
6
6
  "homepage": "https://plexui.com",
@@ -84,7 +84,8 @@
84
84
  "test": "npm run typecheck && npm run lint && npm run test:web --prefix example"
85
85
  },
86
86
  "dependencies": {
87
- "@plexui/styles": "^0.17.4"
87
+ "@plexui/styles": "^0.17.4",
88
+ "libphonenumber-js": "^1.13.17"
88
89
  },
89
90
  "peerDependencies": {
90
91
  "expo-blur": ">=15",