@alfadocs/ui-kit 1.124.0 → 1.125.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.
@@ -2,6 +2,7 @@ import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
2
2
  import { type VariantProps } from 'class-variance-authority';
3
3
  import { ExternalLink, type LucideIcon } from 'lucide-react';
4
4
  import { type SpecialtyListItem } from '../specialty-list/specialty-list';
5
+ import type { CountryCode } from 'libphonenumber-js/min';
5
6
  declare const rootVariants: (props?: ({
6
7
  surface?: "elevated" | "flat" | null | undefined;
7
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -40,11 +41,22 @@ export interface ContactProfileCardProps extends Omit<ComponentPropsWithoutRef<'
40
41
  contentLang?: string;
41
42
  /** Street + postcode + city, with optional lat/lng for the map link. */
42
43
  address?: ContactProfileCardAddress;
43
- /** Phone number, displayed as-is. Compiled into a `tel:` link. */
44
+ /**
45
+ * Phone number. Shown in international format (`+39 070 123 4567`); a number that cannot be read is
46
+ * shown as given. The `tel:` link uses the value as given.
47
+ */
44
48
  phone?: string;
45
49
  /**
46
- * WhatsApp number — digits only (no `+`, no spaces). Compiled into
47
- * a `https://wa.me/<number>` link with an optional pre-filled message.
50
+ * Country of the practice (ISO 3166-1 alpha-2, for example `"IT"`). Used
51
+ * to read a `phone` written without a country code, such as
52
+ * `0701234567`. A number that starts with `+` ignores it.
53
+ */
54
+ phoneCountry?: CountryCode;
55
+ /**
56
+ * WhatsApp number — digits only, starting with the country code (no `+`,
57
+ * no spaces). Compiled into a `https://wa.me/<number>` link with an
58
+ * optional pre-filled message. Shown in international format
59
+ * (`+39 331 234 5678`).
48
60
  */
49
61
  whatsappNumber?: string;
50
62
  /** Optional pre-filled WhatsApp message. Consumer-localised. */
@@ -1,4 +1,4 @@
1
- import { C as _, a as O, b as o, c as r } from "../../_chunks/contact-profile-card-BubJPyRB.js";
1
+ import { C as _, a as O, b as o, c as r } from "../../_chunks/contact-profile-card-Jz2aSh7T.js";
2
2
  export {
3
3
  _ as CONTACT_PROFILE_CARD_ROW_ICONS,
4
4
  O as CONTACT_PROFILE_CARD_ROW_KEYS,
@@ -12,6 +12,8 @@ export type { SafeHtmlProps, SafeHtmlProfile } from './_shared/safe-html';
12
12
  export type { OptionShape } from './_shared/option';
13
13
  export { FATTURAPA_DECIMAL, FATTURAPA_VALUE, compareDecimal, decimalToNumber, divideDecimal, formatDecimal, isDecimalString, multiplyDecimal, numberToDecimal, parseDecimal, rescaleDecimal, sumDecimals, } from './_shared/decimal';
14
14
  export type { DecimalString, ScaledDecimal, DecimalError, DecimalRules, ParseDecimalResult, } from './_shared/decimal';
15
+ export { formatPhoneForDisplay } from './_shared/format-phone';
16
+ export type { FormatPhoneOptions } from './_shared/format-phone';
15
17
  export * from './address-autocomplete';
16
18
  export * from './address-fields';
17
19
  export * from './city-input';
@@ -0,0 +1,20 @@
1
+ import { parsePhoneNumberFromString as l } from "libphonenumber-js/min";
2
+ function u(e, o = {}) {
3
+ const t = e.trim();
4
+ if (!t) return e;
5
+ const { defaultCountry: a, digitsAreInternational: s } = o;
6
+ if (!/^\+?[\d\s().\-/]+$/.test(t)) return e;
7
+ let r = t, n = t.startsWith("+");
8
+ s && /^00\d+$/.test(t) ? (r = `+${t.slice(2)}`, n = !1) : s && /^\d+$/.test(t) && (r = `+${t}`, n = !1);
9
+ try {
10
+ const i = l(r, a);
11
+ if (i && (i.isValid() || n && i.isPossible()))
12
+ return i.formatInternational();
13
+ } catch {
14
+ }
15
+ return e;
16
+ }
17
+ export {
18
+ u as formatPhoneForDisplay
19
+ };
20
+ //# sourceMappingURL=index.js.map