@asdp/ferryui 0.1.22-dev.9209 → 0.1.22-dev.9233

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.
package/dist/index.mjs CHANGED
@@ -3124,6 +3124,7 @@ var InputDynamic = ({
3124
3124
  hasError = false,
3125
3125
  autoComplete,
3126
3126
  onInput,
3127
+ onlyCountries,
3127
3128
  contentAfter,
3128
3129
  onChange,
3129
3130
  language = "id",
@@ -3340,7 +3341,8 @@ var InputDynamic = ({
3340
3341
  const getPhoneAppearanceClass = () => {
3341
3342
  if (appearance === "underline") return styles.phoneInputUnderline;
3342
3343
  if (appearance === "filled-darker") return styles.phoneInputFilledDarker;
3343
- if (appearance === "filled-lighter") return styles.phoneInputFilledLighter;
3344
+ if (appearance === "filled-lighter")
3345
+ return styles.phoneInputFilledLighter;
3344
3346
  return "";
3345
3347
  };
3346
3348
  const phoneAppearanceClass = getPhoneAppearanceClass();
@@ -3373,9 +3375,21 @@ var InputDynamic = ({
3373
3375
  const fontSizeValuePhoneInput = size == "small" ? tokens.fontSizeBase200 : size === "medium" ? tokens.fontSizeBase300 : tokens.fontSizeBase400;
3374
3376
  const phoneInputSizeStyle = {
3375
3377
  fontSize: fontSizeValuePhoneInput,
3376
- ...size === "small" && { minHeight: "26px", height: "26px", padding: `0 ${tokens.spacingHorizontalS} 0 48px` },
3377
- ...size === "medium" && { minHeight: "34px", height: "34px", padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS} ${tokens.spacingVerticalXXS} 48px` },
3378
- ...size === "large" && { minHeight: "40px", height: "40px", padding: `${tokens.spacingVerticalXS} ${tokens.spacingHorizontalS} ${tokens.spacingVerticalXS} 48px` }
3378
+ ...size === "small" && {
3379
+ minHeight: "26px",
3380
+ height: "26px",
3381
+ padding: `0 ${tokens.spacingHorizontalS} 0 48px`
3382
+ },
3383
+ ...size === "medium" && {
3384
+ minHeight: "34px",
3385
+ height: "34px",
3386
+ padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS} ${tokens.spacingVerticalXXS} 48px`
3387
+ },
3388
+ ...size === "large" && {
3389
+ minHeight: "40px",
3390
+ height: "40px",
3391
+ padding: `${tokens.spacingVerticalXS} ${tokens.spacingHorizontalS} ${tokens.spacingVerticalXS} 48px`
3392
+ }
3379
3393
  };
3380
3394
  if (type === "emailOrPhone") {
3381
3395
  updateEmailOrPhoneType(field.value);
@@ -3412,7 +3426,11 @@ var InputDynamic = ({
3412
3426
  "div",
3413
3427
  {
3414
3428
  ref: emailOrPhoneInputRef,
3415
- className: mergeClasses(styles.phoneInputWrapper, phoneAppearanceClass, error ? styles.phoneInputError : ""),
3429
+ className: mergeClasses(
3430
+ styles.phoneInputWrapper,
3431
+ phoneAppearanceClass,
3432
+ error ? styles.phoneInputError : ""
3433
+ ),
3416
3434
  children: /* @__PURE__ */ jsx(
3417
3435
  PhoneInput,
3418
3436
  {
@@ -3515,7 +3533,11 @@ var InputDynamic = ({
3515
3533
  "div",
3516
3534
  {
3517
3535
  ref: phoneInputRef,
3518
- className: mergeClasses(styles.phoneInputWrapper, phoneAppearanceClass, error ? styles.phoneInputError : ""),
3536
+ className: mergeClasses(
3537
+ styles.phoneInputWrapper,
3538
+ phoneAppearanceClass,
3539
+ error ? styles.phoneInputError : ""
3540
+ ),
3519
3541
  children: /* @__PURE__ */ jsx(
3520
3542
  PhoneInput,
3521
3543
  {
@@ -3650,7 +3672,9 @@ var InputDynamic = ({
3650
3672
  autoCapitalize: "off",
3651
3673
  spellCheck: "false"
3652
3674
  },
3653
- value: (options && options.length > 0 ? options : COUNTRIES).find((country) => country.value === field.value) || null,
3675
+ value: (options && options.length > 0 ? options : COUNTRIES).find(
3676
+ (country) => country.value === field.value
3677
+ ) || null,
3654
3678
  onChange: (selectedOption) => {
3655
3679
  field.onChange(selectedOption ? selectedOption.value : "");
3656
3680
  if (onChange) {
@@ -3701,24 +3725,33 @@ var InputDynamic = ({
3701
3725
  return stringVal;
3702
3726
  };
3703
3727
  const cleanedFieldValue = cleanPhoneValue(field.value || "");
3728
+ const phoneInputProps = {};
3729
+ if (onlyCountries) {
3730
+ phoneInputProps.onlyCountries = onlyCountries;
3731
+ }
3704
3732
  return /* @__PURE__ */ jsx(
3705
3733
  "div",
3706
3734
  {
3707
- className: mergeClasses(styles.phoneInputWrapper, phoneAppearanceClass, error ? styles.phoneInputError : ""),
3735
+ className: mergeClasses(
3736
+ styles.phoneInputWrapper,
3737
+ phoneAppearanceClass,
3738
+ error ? styles.phoneInputError : ""
3739
+ ),
3708
3740
  children: /* @__PURE__ */ jsx(
3709
3741
  PhoneInput,
3710
3742
  {
3743
+ ...phoneInputProps,
3711
3744
  country: defaultCountry.toLowerCase(),
3712
- value: cleanedFieldValue,
3745
+ disabled,
3746
+ disableSearchIcon: true,
3747
+ enableSearch: true,
3748
+ inputStyle: phoneInputSizeStyle,
3713
3749
  onChange: (value, data) => {
3714
3750
  const cleanedValue = cleanPhoneValue(value || "");
3715
3751
  field.onChange(cleanedValue);
3716
3752
  },
3717
3753
  placeholder: placeholder || mergedLabels.phoneDefaultPlaceholder,
3718
- disabled,
3719
- enableSearch: true,
3720
- disableSearchIcon: true,
3721
- inputStyle: phoneInputSizeStyle
3754
+ value: cleanedFieldValue
3722
3755
  }
3723
3756
  )
3724
3757
  }
@@ -4069,7 +4102,9 @@ var InputDynamic = ({
4069
4102
  if (!stringValue) return true;
4070
4103
  const detectedType = detectEmailOrPhoneStrict(stringValue);
4071
4104
  if (detectedType === "email") {
4072
- if (!/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i.test(stringValue)) {
4105
+ if (!/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i.test(
4106
+ stringValue
4107
+ )) {
4073
4108
  return mergedLabels.invalidEmailFormatError;
4074
4109
  }
4075
4110
  } else if (detectedType === "phone") {
@@ -4098,7 +4133,9 @@ var InputDynamic = ({
4098
4133
  if (!stringValue) return true;
4099
4134
  const detectedType = detectIdentityType(stringValue);
4100
4135
  if (detectedType === "email") {
4101
- if (!/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i.test(stringValue)) {
4136
+ if (!/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i.test(
4137
+ stringValue
4138
+ )) {
4102
4139
  return mergedLabels.invalidEmailFormatError;
4103
4140
  }
4104
4141
  } else if (detectedType === "phone") {
@@ -4145,29 +4182,40 @@ var InputDynamic = ({
4145
4182
  }
4146
4183
  ),
4147
4184
  renderInput(field, error?.message),
4148
- helperText && !error && /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-start", gap: "4px", marginTop: "4px" }, children: [
4149
- helperIcon && /* @__PURE__ */ jsx(
4150
- Icon,
4151
- {
4152
- icon: helperIcon,
4153
- style: {
4154
- color: tokens.colorNeutralForeground3,
4155
- flexShrink: 0
4156
- },
4157
- width: 16,
4158
- height: 16
4159
- }
4160
- ),
4161
- /* @__PURE__ */ jsx(
4162
- Text,
4163
- {
4164
- size: 200,
4165
- style: { textAlign: "left" },
4166
- className: styles.helperText,
4167
- children: helperText
4168
- }
4169
- )
4170
- ] })
4185
+ helperText && !error && /* @__PURE__ */ jsxs(
4186
+ "div",
4187
+ {
4188
+ style: {
4189
+ display: "flex",
4190
+ alignItems: "flex-start",
4191
+ gap: "4px",
4192
+ marginTop: "4px"
4193
+ },
4194
+ children: [
4195
+ helperIcon && /* @__PURE__ */ jsx(
4196
+ Icon,
4197
+ {
4198
+ icon: helperIcon,
4199
+ style: {
4200
+ color: tokens.colorNeutralForeground3,
4201
+ flexShrink: 0
4202
+ },
4203
+ width: 16,
4204
+ height: 16
4205
+ }
4206
+ ),
4207
+ /* @__PURE__ */ jsx(
4208
+ Text,
4209
+ {
4210
+ size: 200,
4211
+ style: { textAlign: "left" },
4212
+ className: styles.helperText,
4213
+ children: helperText
4214
+ }
4215
+ )
4216
+ ]
4217
+ }
4218
+ )
4171
4219
  ]
4172
4220
  }
4173
4221
  )