@appcorp/fusion-storybook 0.5.27 → 0.5.31

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 (47) hide show
  1. package/base-modules/admission/context/use-admission-module.js +23 -29
  2. package/base-modules/admission/form.js +5 -19
  3. package/base-modules/admission/validate.d.ts +3 -2
  4. package/base-modules/admission/validate.js +10 -9
  5. package/base-modules/campus/context/use-campus-module.js +1 -2
  6. package/base-modules/campus/form.js +3 -5
  7. package/base-modules/campus/validate.d.ts +2 -2
  8. package/base-modules/campus/validate.js +3 -8
  9. package/base-modules/family/page.js +2 -1
  10. package/base-modules/family-member/context.js +2 -3
  11. package/base-modules/family-member/form.js +5 -8
  12. package/base-modules/family-member/page.js +6 -1
  13. package/base-modules/family-member/validate.d.ts +3 -2
  14. package/base-modules/family-member/validate.js +4 -3
  15. package/base-modules/push-campaign/form.js +13 -5
  16. package/base-modules/school/context.js +4 -6
  17. package/base-modules/school/form.js +2 -5
  18. package/base-modules/school/validate.d.ts +2 -1
  19. package/base-modules/school/validate.js +3 -6
  20. package/base-modules/student-fee/constants.d.ts +1 -0
  21. package/base-modules/student-fee/constants.js +8 -0
  22. package/base-modules/student-fee/misc-1.js +5 -10
  23. package/base-modules/student-profile/context/use-student-profile-module.js +2 -3
  24. package/base-modules/student-profile/form.js +3 -9
  25. package/base-modules/student-profile/validate.d.ts +2 -2
  26. package/base-modules/student-profile/validate.js +3 -9
  27. package/base-modules/teacher/form.js +5 -8
  28. package/base-modules/teacher/page.js +6 -1
  29. package/base-modules/teacher/validate.d.ts +3 -2
  30. package/base-modules/teacher/validate.js +4 -11
  31. package/base-modules/user/context/use-user-module.js +1 -2
  32. package/base-modules/user/form.js +5 -5
  33. package/base-modules/user/page.js +2 -1
  34. package/base-modules/user/validate.d.ts +1 -1
  35. package/base-modules/user/validate.js +2 -5
  36. package/base-modules/workspace/constants.js +1 -1
  37. package/base-modules/workspace/view.js +5 -4
  38. package/components/phone-input.d.ts +21 -0
  39. package/components/phone-input.js +44 -0
  40. package/package.json +4 -1
  41. package/tsconfig.build.tsbuildinfo +1 -1
  42. package/utils/phone-validation.d.ts +15 -0
  43. package/utils/phone-validation.js +35 -0
  44. package/utils/phone.d.ts +25 -0
  45. package/utils/phone.js +145 -0
  46. package/utils/to-e164-phone.d.ts +9 -0
  47. package/utils/to-e164-phone.js +17 -5
@@ -13,13 +13,15 @@ import { Separator } from "@appcorp/shadcn/components/ui/separator";
13
13
  import { Building2, Globe, FileText, Image as LucideImage, CheckCircle2, XCircle, Calendar, CreditCard, Users, BookOpen, GraduationCap, Home, HardDrive, Clock, Shield, } from "lucide-react";
14
14
  import { DATE_FORMATS, formatDate, } from "@react-pakistan/util-functions/general/format-date";
15
15
  import { formatValue } from "@react-pakistan/util-functions/general/format-value";
16
+ import { secretKeys } from "./constants";
16
17
  const APP_DOMAIN = process.env.NEXT_PUBLIC_APP_DOMAIN || "edupilotpro.com";
17
18
  export const WorkspaceView = () => {
18
- var _a, _b;
19
+ var _a, _b, _c;
19
20
  const { state, workspace } = useWorkspaceModule();
20
21
  const t = useTranslations("workspace");
21
22
  const appDomain = APP_DOMAIN;
22
- const planName = ((_a = state.plan) === null || _a === void 0 ? void 0 : _a.name) || ((_b = workspace === null || workspace === void 0 ? void 0 : workspace.plan) === null || _b === void 0 ? void 0 : _b.name) || formatValue(state.planId);
23
+ const visibleSecrets = Object.entries(((_a = state.secrets) !== null && _a !== void 0 ? _a : {})).filter(([key]) => secretKeys.includes(key));
24
+ const planName = ((_b = state.plan) === null || _b === void 0 ? void 0 : _b.name) || ((_c = workspace === null || workspace === void 0 ? void 0 : workspace.plan) === null || _c === void 0 ? void 0 : _c.name) || formatValue(state.planId);
23
25
  const formatCurrency = (amount, currency) => {
24
26
  if (!amount)
25
27
  return "—";
@@ -49,8 +51,7 @@ export const WorkspaceView = () => {
49
51
  e.currentTarget.style.display = "none";
50
52
  } }) })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsxs(Badge, { variant: state.enabled ? "default" : "destructive", className: "gap-1", children: [state.enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), state.enabled
51
53
  ? t("viewStatusEnabled")
52
- : t("viewStatusDisabled")] })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CreditCard, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionPlanBilling") })] }), _jsx(CardDescription, { children: t("viewPlanBillingDescription") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CreditCard, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPlanIdLabel") })] }), _jsx("p", { className: "text-base", children: planName })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPlanStartDateLabel") })] }), _jsx("p", { className: "text-base", children: formatDate(state.planStartDate || "", DATE_FORMATS.LOCALE_DATE) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPlanEndDateLabel") })] }), _jsx("p", { className: "text-base", children: formatDate(state.planEndDate || "", DATE_FORMATS.LOCALE_DATE) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Clock, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldBillingIntervalLabel") })] }), _jsx("p", { className: "text-base", children: formatBillingInterval(state.billingInterval) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CreditCard, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldAgreedPriceLabel") })] }), _jsx("p", { className: "text-base", children: formatCurrency(state.agreedPrice, state.agreedCurrency) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Globe, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCurrencyLabel") })] }), _jsx("p", { className: "text-base", children: formatValue(state.agreedCurrency) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Users, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionUsageStats") })] }), _jsx(CardDescription, { children: t("viewUsageStatsDescription") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-2 gap-6 md:grid-cols-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(GraduationCap, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStudentsLabel") })] }), _jsx("p", { className: "text-primary text-2xl font-bold", children: state.studentsCount })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Users, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldTeachersLabel") })] }), _jsx("p", { className: "text-primary text-2xl font-bold", children: state.teachersCount })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldClassesLabel") })] }), _jsx("p", { className: "text-primary text-2xl font-bold", children: state.classesCount })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCoursesLabel") })] }), _jsx("p", { className: "text-primary text-2xl font-bold", children: state.coursesCount })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Home, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFamiliesLabel") })] }), _jsx("p", { className: "text-primary text-2xl font-bold", children: state.familiesCount })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(HardDrive, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStorageUsedLabel") })] }), _jsx("p", { className: "text-primary text-2xl font-bold", children: formatStorage(state.storageUsedMB) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Shield, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionSecrets") })] }), _jsx(CardDescription, { children: t("viewSecretsDescription") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsx("div", { className: "space-y-4", children: _jsxs("div", { children: [_jsxs("div", { className: "mb-2 flex items-center gap-2", children: [_jsx(Shield, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSecretsJsonLabel") })] }), state.secrets ? (_jsx("div", { className: "space-y-2", children: Object.keys(state.secrets)
53
- .length === 0 ? (_jsx("p", { className: "text-muted-foreground italic", children: t("viewFieldNoSecretsConfigured") })) : (Object.entries(state.secrets).map(([k, v]) => (_jsxs("div", { className: "bg-muted/10 border-border/60 flex items-center justify-between rounded-md border p-3", children: [_jsx("div", { className: "text-foreground text-sm font-medium", children: k }), _jsx("div", { className: "text-foreground/80 text-sm", children: typeof v === "string" && v.length > 0
54
+ : t("viewStatusDisabled")] })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CreditCard, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionPlanBilling") })] }), _jsx(CardDescription, { children: t("viewPlanBillingDescription") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CreditCard, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPlanIdLabel") })] }), _jsx("p", { className: "text-base", children: planName })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPlanStartDateLabel") })] }), _jsx("p", { className: "text-base", children: formatDate(state.planStartDate || "", DATE_FORMATS.LOCALE_DATE) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPlanEndDateLabel") })] }), _jsx("p", { className: "text-base", children: formatDate(state.planEndDate || "", DATE_FORMATS.LOCALE_DATE) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Clock, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldBillingIntervalLabel") })] }), _jsx("p", { className: "text-base", children: formatBillingInterval(state.billingInterval) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CreditCard, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldAgreedPriceLabel") })] }), _jsx("p", { className: "text-base", children: formatCurrency(state.agreedPrice, state.agreedCurrency) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Globe, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCurrencyLabel") })] }), _jsx("p", { className: "text-base", children: formatValue(state.agreedCurrency) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Users, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionUsageStats") })] }), _jsx(CardDescription, { children: t("viewUsageStatsDescription") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-2 gap-6 md:grid-cols-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(GraduationCap, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStudentsLabel") })] }), _jsx("p", { className: "text-primary text-2xl font-bold", children: state.studentsCount })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Users, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldTeachersLabel") })] }), _jsx("p", { className: "text-primary text-2xl font-bold", children: state.teachersCount })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldClassesLabel") })] }), _jsx("p", { className: "text-primary text-2xl font-bold", children: state.classesCount })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCoursesLabel") })] }), _jsx("p", { className: "text-primary text-2xl font-bold", children: state.coursesCount })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Home, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFamiliesLabel") })] }), _jsx("p", { className: "text-primary text-2xl font-bold", children: state.familiesCount })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(HardDrive, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStorageUsedLabel") })] }), _jsx("p", { className: "text-primary text-2xl font-bold", children: formatStorage(state.storageUsedMB) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Shield, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionSecrets") })] }), _jsx(CardDescription, { children: t("viewSecretsDescription") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsx("div", { className: "space-y-4", children: _jsxs("div", { children: [_jsxs("div", { className: "mb-2 flex items-center gap-2", children: [_jsx(Shield, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSecretsJsonLabel") })] }), state.secrets ? (_jsx("div", { className: "space-y-2", children: visibleSecrets.length === 0 ? (_jsx("p", { className: "text-muted-foreground italic", children: t("viewFieldNoSecretsConfigured") })) : (visibleSecrets.map(([k, v]) => (_jsxs("div", { className: "bg-muted/10 border-border/60 flex items-center justify-between rounded-md border p-3", children: [_jsx("div", { className: "text-foreground text-sm font-medium", children: k }), _jsx("div", { className: "text-foreground/80 text-sm", children: typeof v === "string" && v.length > 0
54
55
  ? t("viewFieldSecretConfigured")
55
56
  : "—" })] }, k)))) })) : (_jsx("p", { className: "text-muted-foreground italic", children: t("viewFieldNoSecretsConfigured") })), _jsx("p", { className: "text-muted-foreground mt-2 text-xs", children: t("viewFieldSecretsHelpText") })] }) }) })] })] }));
56
57
  };
@@ -0,0 +1,21 @@
1
+ export interface PhoneInputProps {
2
+ id: string;
3
+ label?: string;
4
+ info?: string;
5
+ error?: string;
6
+ required?: boolean;
7
+ disabled?: boolean;
8
+ /** Full E.164 value, e.g. `+923212434302`. */
9
+ value?: string | null;
10
+ /** Receives the full E.164 value (or `""` when empty). */
11
+ onChange: (value: string) => void;
12
+ /** ISO-2 code, country name, or empty. Defaults to `PK`. */
13
+ defaultCountry?: string | null;
14
+ placeholder?: string;
15
+ className?: string;
16
+ countryAriaLabel?: string;
17
+ countrySearchPlaceholder?: string;
18
+ countryEmptyText?: string;
19
+ testId?: string;
20
+ }
21
+ export declare function PhoneInput({ id, label, info, error, required, disabled, value, onChange, defaultCountry, placeholder, className, countryAriaLabel, countrySearchPlaceholder, countryEmptyText, testId, }: PhoneInputProps): import("react").JSX.Element;
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useMemo, useState } from "react";
4
+ import { Check, ChevronsUpDown } from "lucide-react";
5
+ import { dialCodes } from "@react-pakistan/util-functions/constants/dial-codes";
6
+ import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
7
+ import { EnhancedLabel } from "@appcorp/shadcn/components/enhanced-label";
8
+ import { Button } from "@appcorp/shadcn/components/ui/button";
9
+ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "@appcorp/shadcn/components/ui/command";
10
+ import { Popover, PopoverContent, PopoverTrigger, } from "@appcorp/shadcn/components/ui/popover";
11
+ import { cn } from "@appcorp/shadcn/lib/utils";
12
+ import { countryNameFor, dialCodeFor, flagForCountry, formatNationalNumber, isDialCodeCompatible, joinPhoneValue, splitPhoneValue, toIsoCountry, } from "../utils/phone";
13
+ export function PhoneInput({ id, label, info, error, required = false, disabled = false, value, onChange, defaultCountry, placeholder, className, countryAriaLabel = "Country code", countrySearchPlaceholder = "Search country...", countryEmptyText = "No country found.", testId, }) {
14
+ const fallback = toIsoCountry(defaultCountry);
15
+ const parsed = splitPhoneValue(value, fallback);
16
+ const [selectedCountry, setSelectedCountry] = useState(parsed.country);
17
+ const [open, setOpen] = useState(false);
18
+ const country = selectedCountry && isDialCodeCompatible(value, selectedCountry)
19
+ ? selectedCountry
20
+ : parsed.country;
21
+ const national = parsed.national;
22
+ const countries = useMemo(() => dialCodes
23
+ .map((entry) => (Object.assign(Object.assign({}, entry), { displayName: countryNameFor(entry.code, entry.name), flag: flagForCountry(entry.code) })))
24
+ .sort((a, b) => a.displayName.localeCompare(b.displayName)), []);
25
+ const selectedDial = dialCodeFor(country);
26
+ const displayValue = formatNationalNumber(country, national);
27
+ const handleCountryChange = (nextCountry) => {
28
+ setSelectedCountry(nextCountry);
29
+ setOpen(false);
30
+ onChange(joinPhoneValue(nextCountry, national));
31
+ };
32
+ const handleNationalChange = (input) => {
33
+ if (input.trim().startsWith("+")) {
34
+ const split = splitPhoneValue(input, country);
35
+ setSelectedCountry(split.country);
36
+ onChange(joinPhoneValue(split.country, split.national));
37
+ return;
38
+ }
39
+ const digits = input.replace(/\D/g, "");
40
+ setSelectedCountry(country);
41
+ onChange(joinPhoneValue(country, digits));
42
+ };
43
+ return (_jsxs("div", { className: cn("space-y-2", className), children: [label && (_jsx(EnhancedLabel, { htmlFor: id, required: required, children: label })), _jsxs("div", { className: "flex items-start gap-2", children: [_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "outline", role: "combobox", "aria-expanded": open, "aria-label": countryAriaLabel, disabled: disabled, className: cn("h-9 w-[112px] shrink-0 justify-between px-2 font-normal", error && "border-destructive"), children: [_jsxs("span", { className: "truncate", children: [flagForCountry(country), " ", selectedDial] }), _jsx(ChevronsUpDown, { className: "ml-1 h-4 w-4 shrink-0 opacity-50" })] }) }), _jsx(PopoverContent, { className: "w-[320px] max-w-[calc(100vw-2rem)] p-0", align: "start", children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: countrySearchPlaceholder }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: countryEmptyText }), _jsx(CommandGroup, { children: countries.map((entry) => (_jsxs(CommandItem, { value: `${entry.displayName} ${entry.code} ${entry.dial_code}`, onSelect: () => handleCountryChange(entry.code), children: [_jsx("span", { className: "mr-2", children: entry.flag }), _jsx("span", { className: "flex-1 truncate", children: entry.displayName }), _jsx("span", { className: "text-muted-foreground ml-2", children: entry.dial_code }), _jsx(Check, { className: cn("ml-2 h-4 w-4", country === entry.code ? "opacity-100" : "opacity-0") })] }, entry.code))) })] })] }) })] }), _jsx("div", { className: "min-w-0 flex-1", children: _jsx(EnhancedInput, { id: id, type: "tel", inputMode: "tel", autoComplete: "tel-national", value: displayValue, onChange: (event) => handleNationalChange(event.target.value), error: error, info: info, placeholder: placeholder, disabled: disabled, required: required, testIdWrapper: testId, testIdInput: testId ? `${testId}-input` : undefined }) })] })] }));
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.5.27",
3
+ "version": "0.5.31",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",
@@ -36,6 +36,9 @@
36
36
  "prettier --write"
37
37
  ]
38
38
  },
39
+ "peerDependencies": {
40
+ "libphonenumber-js": "^1.13.0"
41
+ },
39
42
  "devDependencies": {
40
43
  "@appcorp/shadcn": "^2.0.21",
41
44
  "@chromatic-com/storybook": "^5.1.2",