@fluid-app/portal-sdk 0.1.447 → 0.1.449

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.
@@ -1,6 +1,6 @@
1
1
  require("./chunk-9hOWP6kD.cjs");
2
2
  require("./ContactsTranslationBridge-BvkMkPED.cjs");
3
- const require_ContactsScreen = require("./ContactsScreen-BMnHQQQj.cjs");
3
+ const require_ContactsScreen = require("./ContactsScreen-CBXOEkvz.cjs");
4
4
  require("./static-dict-adapter-Dk_ZWOUI.cjs");
5
5
  require("./translation-api-context-factory-DkXq_vPq.cjs");
6
6
  require("./task-composer-form-oKkUtTAg.cjs");
@@ -16,6 +16,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
16
16
  let zod = require("zod");
17
17
  let lucide_react = require("lucide-react");
18
18
  let react_hook_form = require("react-hook-form");
19
+ let _fluid_app_ui_components_components_MobileBottomSheet = require("@fluid-app/ui-components/components/MobileBottomSheet");
19
20
  let _fluid_app_ui_components_components_Combobox = require("@fluid-app/ui-components/components/Combobox");
20
21
  //#region ../../platform/api-client-core/src/parse-api-errors.ts
21
22
  /**
@@ -484,6 +485,22 @@ var Sub2 = ContextMenuSub$1;
484
485
  var SubTrigger2 = ContextMenuSubTrigger$1;
485
486
  var SubContent2 = ContextMenuSubContent$1;
486
487
  //#endregion
488
+ //#region ../react/src/shell/use-mobile.ts
489
+ const MOBILE_BREAKPOINT$1 = 768;
490
+ function useIsMobile$1() {
491
+ const [isMobile, setIsMobile] = (0, react.useState)(false);
492
+ (0, react.useEffect)(() => {
493
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT$1 - 1}px)`);
494
+ const onChange = () => {
495
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT$1);
496
+ };
497
+ mql.addEventListener("change", onChange);
498
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT$1);
499
+ return () => mql.removeEventListener("change", onChange);
500
+ }, []);
501
+ return isMobile;
502
+ }
503
+ //#endregion
487
504
  //#region ../../contacts/ui/src/portal/hooks/groups/invalidate-contact-caches.ts
488
505
  function invalidateContactCaches(queryClient) {
489
506
  queryClient.invalidateQueries({ queryKey: require_task_composer_form.CONTACTS_QUERY_KEYS.all("contacts") });
@@ -1496,6 +1513,7 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1496
1513
  }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.SelectContent, {
1497
1514
  position: "popper",
1498
1515
  sideOffset: 4,
1516
+ className: "z-[1060]",
1499
1517
  children: effectiveStatusOptions.map((opt) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.SelectItem, {
1500
1518
  value: opt.value,
1501
1519
  children: opt.name
@@ -1591,7 +1609,8 @@ const ContactDetailsForm = ({ className, countries = DEFAULT_COUNTRIES, renderAv
1591
1609
  })),
1592
1610
  value: field.value ?? "",
1593
1611
  onValueChange: field.onChange,
1594
- placeholder: t("placeholder_country")
1612
+ placeholder: t("placeholder_country"),
1613
+ zIndex: 1060
1595
1614
  }) }),
1596
1615
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.FormMessage, {})
1597
1616
  ] })
@@ -4868,7 +4887,8 @@ const CREATE_DEFAULT_VALUES = {
4868
4887
  metadata: {},
4869
4888
  affiliate: {}
4870
4889
  };
4871
- function ContactCreateView({ onNavigate, onCreateContact }) {
4890
+ function ContactCreateView({ onNavigate, onCreateContact, asSheet = false }) {
4891
+ const { t } = require_task_composer_form.useContactsTranslation();
4872
4892
  const formRef = (0, react.useRef)(null);
4873
4893
  const { locale } = require_static_dict_adapter.useActiveLocale();
4874
4894
  const countriesAdapter = require_ContactsTranslationBridge.useCountriesApi();
@@ -4901,13 +4921,42 @@ function ContactCreateView({ onNavigate, onCreateContact }) {
4901
4921
  if (affiliate && Object.keys(affiliate).length > 0) payload.affiliate = affiliate;
4902
4922
  mutate(payload);
4903
4923
  }, () => {}), [methods, mutate]);
4924
+ const handleNavigateToList = (0, react.useCallback)(() => {
4925
+ onNavigate({
4926
+ view: "browse",
4927
+ selectedContactId: null
4928
+ });
4929
+ }, [onNavigate]);
4930
+ if (asSheet) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_fluid_app_ui_components_components_MobileBottomSheet.MobileBottomSheet, {
4931
+ open: true,
4932
+ onOpenChange: (nextOpen) => {
4933
+ if (!nextOpen) handleNavigateToList();
4934
+ },
4935
+ title: t("breadcrumb_new"),
4936
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_hook_form.FormProvider, {
4937
+ ...methods,
4938
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
4939
+ ref: formRef,
4940
+ onSubmit,
4941
+ className: "space-y-6 px-2 pb-2",
4942
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContactDetailsForm, { countries: countryOptions }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4943
+ className: "flex justify-end gap-2",
4944
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
4945
+ type: "button",
4946
+ variant: "outline",
4947
+ onClick: handleNavigateToList,
4948
+ children: t("cancel")
4949
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Button, {
4950
+ type: "submit",
4951
+ disabled: mutation.isPending,
4952
+ children: mutation.isPending ? t("adding") : t("add_contact")
4953
+ })]
4954
+ })]
4955
+ })
4956
+ })
4957
+ });
4904
4958
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContactCreateScreen, {
4905
- onNavigateToList: (0, react.useCallback)(() => {
4906
- onNavigate({
4907
- view: "browse",
4908
- selectedContactId: null
4909
- });
4910
- }, [onNavigate]),
4959
+ onNavigateToList: handleNavigateToList,
4911
4960
  onSubmit: () => formRef.current?.requestSubmit(),
4912
4961
  isPending: mutation.isPending,
4913
4962
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_hook_form.FormProvider, {
@@ -4927,6 +4976,7 @@ function ContactCreateView({ onNavigate, onCreateContact }) {
4927
4976
  function ContactsScreen({ onContactSelect, onCreateContact, background, textColor, accentColor, padding, borderRadius, defaultViewMode, ...divProps }) {
4928
4977
  const { currentSlug, navigate } = require_AppNavigationContext.useAppNavigation();
4929
4978
  const subPage = currentSlug.split("/")[1];
4979
+ const isMobile = useIsMobile$1();
4930
4980
  const [nav, setNav] = (0, react.useState)({
4931
4981
  view: "browse",
4932
4982
  selectedContactId: null
@@ -4950,6 +5000,10 @@ function ContactsScreen({ onContactSelect, onCreateContact, background, textColo
4950
5000
  const handleManageGroups = (0, react.useCallback)(() => {
4951
5001
  navigate("contacts/manage-groups");
4952
5002
  }, [navigate]);
5003
+ const handleCreateNavigate = (0, react.useCallback)((state) => {
5004
+ setNav(state);
5005
+ if (state.view === "browse" && state.selectedContactId) setHighlightContactId(state.selectedContactId);
5006
+ }, []);
4953
5007
  const [createGroupOpen, setCreateGroupOpen] = (0, react.useState)(false);
4954
5008
  const [highlightGroupName, setHighlightGroupName] = (0, react.useState)(null);
4955
5009
  (0, react.useEffect)(() => {
@@ -4972,21 +5026,22 @@ function ContactsScreen({ onContactSelect, onCreateContact, background, textColo
4972
5026
  });
4973
5027
  navigate("contacts");
4974
5028
  }
4975
- }) : nav.view === "new" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContactCreateView, {
4976
- onNavigate: (state) => {
4977
- setNav(state);
4978
- if (state.view === "browse" && state.selectedContactId) setHighlightContactId(state.selectedContactId);
4979
- },
5029
+ }) : nav.view === "new" && !isMobile ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContactCreateView, {
5030
+ onNavigate: handleCreateNavigate,
4980
5031
  onCreateContact
4981
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContactBrowseView, {
4982
- selectedContactId: nav.selectedContactId,
5032
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContactBrowseView, {
5033
+ selectedContactId: nav.view === "browse" ? nav.selectedContactId : null,
4983
5034
  highlightContactId,
4984
5035
  onSelect: handleSelect,
4985
5036
  onAdd: handleAdd,
4986
5037
  onManageGroups: handleManageGroups,
4987
5038
  onCreateGroup: handleCreateGroup,
4988
5039
  highlightGroupName
4989
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GroupDialog, {
5040
+ }), nav.view === "new" && isMobile ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContactCreateView, {
5041
+ asSheet: true,
5042
+ onNavigate: handleCreateNavigate,
5043
+ onCreateContact
5044
+ }) : null] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GroupDialog, {
4990
5045
  mode: "create",
4991
5046
  open: createGroupOpen,
4992
5047
  onOpenChange: (open) => setCreateGroupOpen(open),
@@ -5018,5 +5073,11 @@ Object.defineProperty(exports, "contactsScreenPropertySchema", {
5018
5073
  return contactsScreenPropertySchema;
5019
5074
  }
5020
5075
  });
5076
+ Object.defineProperty(exports, "useIsMobile", {
5077
+ enumerable: true,
5078
+ get: function() {
5079
+ return useIsMobile$1;
5080
+ }
5081
+ });
5021
5082
 
5022
- //# sourceMappingURL=ContactsScreen-BMnHQQQj.cjs.map
5083
+ //# sourceMappingURL=ContactsScreen-CBXOEkvz.cjs.map