@7shifts/sous-chef 3.52.0-beta.0 → 3.52.0-beta.2

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.
@@ -5721,6 +5721,9 @@ var DataTable = {
5721
5721
  emptyStateTitle: "No results found",
5722
5722
  emptyStateCaption: "Try adding a new item to the list or adjust your search terms."
5723
5723
  };
5724
+ var PhoneField = {
5725
+ malformedPhoneNumber: "Malformed phone number. Please enter a valid phone number."
5726
+ };
5724
5727
  var en = {
5725
5728
  PaginationControls: PaginationControls,
5726
5729
  AsyncSelectField: AsyncSelectField,
@@ -5728,7 +5731,8 @@ var en = {
5728
5731
  HintModal: HintModal,
5729
5732
  Calendar: Calendar,
5730
5733
  Card: Card,
5731
- DataTable: DataTable
5734
+ DataTable: DataTable,
5735
+ PhoneField: PhoneField
5732
5736
  };
5733
5737
 
5734
5738
  var initialValue = {
@@ -12121,33 +12125,14 @@ var usePhoneFieldControllers = function usePhoneFieldControllers(_ref) {
12121
12125
  error = _ref.error,
12122
12126
  onMenuInputFocus = _ref.onMenuInputFocus,
12123
12127
  defaultCountry = _ref.defaultCountry;
12128
+ var __ = useTranslation('PhoneField');
12129
+ var errorMessage = __('malformedPhoneNumber');
12124
12130
  var _useFormContext = useFormContext(),
12125
12131
  formik = _useFormContext.formik;
12126
12132
  var id = useFieldId({
12127
12133
  name: name,
12128
12134
  id: inputId
12129
12135
  });
12130
- var controllers = {
12131
- id: id,
12132
- error: error,
12133
- value: value,
12134
- onChange: function onChange(option) {
12135
- if (_onChange) {
12136
- _onChange(option);
12137
- }
12138
- if (_onChange && onMenuInputFocus) {
12139
- onMenuInputFocus(false);
12140
- }
12141
- },
12142
- onBlur: function onBlur(option) {
12143
- if (_onBlur) {
12144
- _onBlur(option);
12145
- }
12146
- if (_onBlur && onMenuInputFocus) {
12147
- onMenuInputFocus(false);
12148
- }
12149
- }
12150
- };
12151
12136
  var formikState = getFormikState(name, formik);
12152
12137
  var phoneFieldValue = formik && formikState && !value ? formikState.value : value;
12153
12138
  var _useProviderConfig = useProviderConfig(),
@@ -12162,6 +12147,13 @@ var usePhoneFieldControllers = function usePhoneFieldControllers(_ref) {
12162
12147
  try {
12163
12148
  var phone = parsePhoneNumber(value);
12164
12149
  var formatedPhone = new AsYouType(phone.country).input(value.replace('+' + phone.countryCallingCode, ''));
12150
+ if (!phone.country) {
12151
+ return {
12152
+ country: defaultCountry || country,
12153
+ phone: formatedPhone,
12154
+ parsingError: errorMessage
12155
+ };
12156
+ }
12165
12157
  return {
12166
12158
  country: phone.country,
12167
12159
  phone: formatedPhone
@@ -12169,7 +12161,8 @@ var usePhoneFieldControllers = function usePhoneFieldControllers(_ref) {
12169
12161
  } catch (error) {
12170
12162
  return {
12171
12163
  country: defaultCountry || country,
12172
- phone: value
12164
+ phone: value,
12165
+ parsingError: errorMessage
12173
12166
  };
12174
12167
  }
12175
12168
  };
@@ -12178,9 +12171,30 @@ var usePhoneFieldControllers = function usePhoneFieldControllers(_ref) {
12178
12171
  }),
12179
12172
  meta = _useState[0],
12180
12173
  setMeta = _useState[1];
12174
+ var controllers = {
12175
+ id: id,
12176
+ error: error || meta.parsingError,
12177
+ value: value,
12178
+ onChange: function onChange(option) {
12179
+ if (_onChange) {
12180
+ _onChange(option);
12181
+ }
12182
+ if (_onChange && onMenuInputFocus) {
12183
+ onMenuInputFocus(false);
12184
+ }
12185
+ },
12186
+ onBlur: function onBlur(option) {
12187
+ if (_onBlur) {
12188
+ _onBlur(option);
12189
+ }
12190
+ if (_onBlur && onMenuInputFocus) {
12191
+ onMenuInputFocus(false);
12192
+ }
12193
+ }
12194
+ };
12181
12195
  if (formik && formikState) {
12182
12196
  controllers = _extends({}, controllers, {
12183
- error: error ? controllers.error : formikState.error,
12197
+ error: error || meta.parsingError ? controllers.error : formikState.error,
12184
12198
  value: value ? controllers.value : formikState.value,
12185
12199
  onChange: function onChange(option) {
12186
12200
  if (_onChange) {
@@ -13050,7 +13064,7 @@ var CountrySelector = function CountrySelector(_ref) {
13050
13064
  };
13051
13065
 
13052
13066
  var _excluded$2M = ["disabledCountry"];
13053
- var PhoneField = function PhoneField(_ref) {
13067
+ var PhoneField$1 = function PhoneField(_ref) {
13054
13068
  var _classNames;
13055
13069
  var _ref$disabledCountry = _ref.disabledCountry,
13056
13070
  disabledCountry = _ref$disabledCountry === void 0 ? false : _ref$disabledCountry,
@@ -13461,5 +13475,5 @@ var EmptyState = function EmptyState(props) {
13461
13475
  return emptyStateContainer;
13462
13476
  };
13463
13477
 
13464
- export { Accordion, ActionList, ActionListItem, AsyncSelectField$1 as AsyncSelectField, Avatar, Badge, Bold, BreadcrumbItem, Breadcrumbs, Button, COLORS, Calendar$1 as Calendar, CalloutCard, Card$1 as Card, CheckboxField, Chip, CircularProgress, CurrencyField, DataTable$1 as DataTable, DataTableCell, DataTableEditableCell, DataTableRow, DateField, DateFilter, DateRangeField, Dropdown, DropdownList, DropdownListDivider, DropdownListItem, EmptyState, Form, FormFeedback, FormFooter, FormRow, FormSection, HintModal$1 as HintModal, IconAnalytics, IconArrowDown, IconArrowDownWideShort, IconArrowLeft, IconArrowRight, IconArrowToTop, IconArrowTurnDownRight, IconArrowUp, IconAward, IconAwful, IconAwfulMonochromatic, IconBad, IconBadMonochromatic, IconBalanceScale, IconBalanceScaleLeft, IconBan, IconBarsH, IconBarsV, IconBell, IconBirthdayCake, IconBold, IconBolt, IconBook, IconBriefcase, IconBullseyeArrow, IconCalculator, IconCalendar, IconCalendarAlt, IconCalendarCheck, IconCalendarDay, IconCalendarExclamation, IconCalendarStar, IconCalendarTomorrow, IconCamera, IconCameraSlash, IconCashRegister, IconChartBar, IconCheck, IconCheckCircleIncomplete, IconChevronDown, IconChevronLeft, IconChevronRight, IconChevronUp, IconClipboardList, IconClock, IconCog, IconComment, IconCommentLines, IconCopy, IconCreditCard, IconCreditCardPlus, IconDecent, IconDecentMonochromatic, IconDownload, IconEdit, IconEllipsisV, IconEnvelope, IconEnvelopeOpenDollar, IconExclaimation, IconExclaimationTriangle, IconExpand, IconExternalLink, IconEye, IconEyeSlash, IconFile, IconFilePdf, IconFlag, IconFourDotsCircle, IconFourSquares, IconGavel, IconGif, IconGift, IconGood, IconGoodMonochromatic, IconGreat, IconGreatMonochromatic, IconGrinBeam, IconGripVertical, IconHandshake, IconHatChef, IconImage, IconInfoCircle, IconIslandTropical, IconItalic, IconLaptopSearch, IconLink, IconList, IconListOI as IconListOi, IconLock, IconMagicSolid, IconMapMarker, IconMegaphone, IconMessages, IconMinus, IconMinusCircle, IconMoneyBill, IconMugSaucerSolid, IconNotesMedical, IconOvertime, IconPaperPlane, IconPaperPlaneClock, IconPaperclip, IconPencil, IconPercentage, IconPhone, IconPlateUtensils, IconPlug, IconPlus, IconPrint, IconQuestionCircle, IconRepeat, IconReply, IconRocket, IconSearch, IconSignOut, IconSitemap, IconSlidersH, IconSort, IconStar, IconStarSolid, IconStickyNoteLines, IconStopwatch, IconStrikethrough, IconSync, IconSyncExclaimation, IconTable, IconTachometer, IconTimes, IconTimesOctagon, IconTrash, IconUnderline, IconUndo, IconUniversity, IconUnlock, IconUserComputer, IconUserFriends, IconUserLight, IconUserPlus, IconUserSearch, IconUserSlash, IconUserSolid, IconUserTag, IconUserTie, IconUsers, IconVideo, IconVolume, IconVolumeMute, IconWrench, Inline, InlineBanner, Italic, Link, Modal, ModalBody, ModalFooter, MultiSelectField, Page, PaginationControls$1 as PaginationControls, PasswordField, Paywall, PercentageField, PersistentBanner, PhoneField, Pill, PillSelectField, ProgressBar, RadioGroupBoxOption, RadioGroupField, RadioGroupOption, SIZE_25_PERCENT, SIZE_33_PERCENT, SIZE_50_PERCENT, SIZE_66_PERCENT, SIZE_75_PERCENT, SegmentedControl, SelectField$1 as SelectField, Skeleton, SousChefProvider, Spinner, Stack, Text, TextAreaField, TextField, TimeField, TimeRangeField, Toggle, ToolbarSelect, Tooltip, Underline, WeekField, ZINDEX, toast, useDataTableContext };
13478
+ export { Accordion, ActionList, ActionListItem, AsyncSelectField$1 as AsyncSelectField, Avatar, Badge, Bold, BreadcrumbItem, Breadcrumbs, Button, COLORS, Calendar$1 as Calendar, CalloutCard, Card$1 as Card, CheckboxField, Chip, CircularProgress, CurrencyField, DataTable$1 as DataTable, DataTableCell, DataTableEditableCell, DataTableRow, DateField, DateFilter, DateRangeField, Dropdown, DropdownList, DropdownListDivider, DropdownListItem, EmptyState, Form, FormFeedback, FormFooter, FormRow, FormSection, HintModal$1 as HintModal, IconAnalytics, IconArrowDown, IconArrowDownWideShort, IconArrowLeft, IconArrowRight, IconArrowToTop, IconArrowTurnDownRight, IconArrowUp, IconAward, IconAwful, IconAwfulMonochromatic, IconBad, IconBadMonochromatic, IconBalanceScale, IconBalanceScaleLeft, IconBan, IconBarsH, IconBarsV, IconBell, IconBirthdayCake, IconBold, IconBolt, IconBook, IconBriefcase, IconBullseyeArrow, IconCalculator, IconCalendar, IconCalendarAlt, IconCalendarCheck, IconCalendarDay, IconCalendarExclamation, IconCalendarStar, IconCalendarTomorrow, IconCamera, IconCameraSlash, IconCashRegister, IconChartBar, IconCheck, IconCheckCircleIncomplete, IconChevronDown, IconChevronLeft, IconChevronRight, IconChevronUp, IconClipboardList, IconClock, IconCog, IconComment, IconCommentLines, IconCopy, IconCreditCard, IconCreditCardPlus, IconDecent, IconDecentMonochromatic, IconDownload, IconEdit, IconEllipsisV, IconEnvelope, IconEnvelopeOpenDollar, IconExclaimation, IconExclaimationTriangle, IconExpand, IconExternalLink, IconEye, IconEyeSlash, IconFile, IconFilePdf, IconFlag, IconFourDotsCircle, IconFourSquares, IconGavel, IconGif, IconGift, IconGood, IconGoodMonochromatic, IconGreat, IconGreatMonochromatic, IconGrinBeam, IconGripVertical, IconHandshake, IconHatChef, IconImage, IconInfoCircle, IconIslandTropical, IconItalic, IconLaptopSearch, IconLink, IconList, IconListOI as IconListOi, IconLock, IconMagicSolid, IconMapMarker, IconMegaphone, IconMessages, IconMinus, IconMinusCircle, IconMoneyBill, IconMugSaucerSolid, IconNotesMedical, IconOvertime, IconPaperPlane, IconPaperPlaneClock, IconPaperclip, IconPencil, IconPercentage, IconPhone, IconPlateUtensils, IconPlug, IconPlus, IconPrint, IconQuestionCircle, IconRepeat, IconReply, IconRocket, IconSearch, IconSignOut, IconSitemap, IconSlidersH, IconSort, IconStar, IconStarSolid, IconStickyNoteLines, IconStopwatch, IconStrikethrough, IconSync, IconSyncExclaimation, IconTable, IconTachometer, IconTimes, IconTimesOctagon, IconTrash, IconUnderline, IconUndo, IconUniversity, IconUnlock, IconUserComputer, IconUserFriends, IconUserLight, IconUserPlus, IconUserSearch, IconUserSlash, IconUserSolid, IconUserTag, IconUserTie, IconUsers, IconVideo, IconVolume, IconVolumeMute, IconWrench, Inline, InlineBanner, Italic, Link, Modal, ModalBody, ModalFooter, MultiSelectField, Page, PaginationControls$1 as PaginationControls, PasswordField, Paywall, PercentageField, PersistentBanner, PhoneField$1 as PhoneField, Pill, PillSelectField, ProgressBar, RadioGroupBoxOption, RadioGroupField, RadioGroupOption, SIZE_25_PERCENT, SIZE_33_PERCENT, SIZE_50_PERCENT, SIZE_66_PERCENT, SIZE_75_PERCENT, SegmentedControl, SelectField$1 as SelectField, Skeleton, SousChefProvider, Spinner, Stack, Text, TextAreaField, TextField, TimeField, TimeRangeField, Toggle, ToolbarSelect, Tooltip, Underline, WeekField, ZINDEX, toast, useDataTableContext };
13465
13479
  //# sourceMappingURL=index.modern.js.map