@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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +86 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -810,6 +810,7 @@ interface InputDynamicProps<T extends FieldValues = FieldValues> {
|
|
|
810
810
|
rows?: number;
|
|
811
811
|
min?: number | string;
|
|
812
812
|
max?: number | string;
|
|
813
|
+
onlyCountries?: string[];
|
|
813
814
|
step?: number | string;
|
|
814
815
|
isMultiSelect?: boolean;
|
|
815
816
|
selectScrollbarColor?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -810,6 +810,7 @@ interface InputDynamicProps<T extends FieldValues = FieldValues> {
|
|
|
810
810
|
rows?: number;
|
|
811
811
|
min?: number | string;
|
|
812
812
|
max?: number | string;
|
|
813
|
+
onlyCountries?: string[];
|
|
813
814
|
step?: number | string;
|
|
814
815
|
isMultiSelect?: boolean;
|
|
815
816
|
selectScrollbarColor?: string;
|
package/dist/index.js
CHANGED
|
@@ -3133,6 +3133,7 @@ var InputDynamic = ({
|
|
|
3133
3133
|
hasError = false,
|
|
3134
3134
|
autoComplete,
|
|
3135
3135
|
onInput,
|
|
3136
|
+
onlyCountries,
|
|
3136
3137
|
contentAfter,
|
|
3137
3138
|
onChange,
|
|
3138
3139
|
language = "id",
|
|
@@ -3349,7 +3350,8 @@ var InputDynamic = ({
|
|
|
3349
3350
|
const getPhoneAppearanceClass = () => {
|
|
3350
3351
|
if (appearance === "underline") return styles.phoneInputUnderline;
|
|
3351
3352
|
if (appearance === "filled-darker") return styles.phoneInputFilledDarker;
|
|
3352
|
-
if (appearance === "filled-lighter")
|
|
3353
|
+
if (appearance === "filled-lighter")
|
|
3354
|
+
return styles.phoneInputFilledLighter;
|
|
3353
3355
|
return "";
|
|
3354
3356
|
};
|
|
3355
3357
|
const phoneAppearanceClass = getPhoneAppearanceClass();
|
|
@@ -3382,9 +3384,21 @@ var InputDynamic = ({
|
|
|
3382
3384
|
const fontSizeValuePhoneInput = size == "small" ? reactComponents.tokens.fontSizeBase200 : size === "medium" ? reactComponents.tokens.fontSizeBase300 : reactComponents.tokens.fontSizeBase400;
|
|
3383
3385
|
const phoneInputSizeStyle = {
|
|
3384
3386
|
fontSize: fontSizeValuePhoneInput,
|
|
3385
|
-
...size === "small" && {
|
|
3386
|
-
|
|
3387
|
-
|
|
3387
|
+
...size === "small" && {
|
|
3388
|
+
minHeight: "26px",
|
|
3389
|
+
height: "26px",
|
|
3390
|
+
padding: `0 ${reactComponents.tokens.spacingHorizontalS} 0 48px`
|
|
3391
|
+
},
|
|
3392
|
+
...size === "medium" && {
|
|
3393
|
+
minHeight: "34px",
|
|
3394
|
+
height: "34px",
|
|
3395
|
+
padding: `${reactComponents.tokens.spacingVerticalXXS} ${reactComponents.tokens.spacingHorizontalS} ${reactComponents.tokens.spacingVerticalXXS} 48px`
|
|
3396
|
+
},
|
|
3397
|
+
...size === "large" && {
|
|
3398
|
+
minHeight: "40px",
|
|
3399
|
+
height: "40px",
|
|
3400
|
+
padding: `${reactComponents.tokens.spacingVerticalXS} ${reactComponents.tokens.spacingHorizontalS} ${reactComponents.tokens.spacingVerticalXS} 48px`
|
|
3401
|
+
}
|
|
3388
3402
|
};
|
|
3389
3403
|
if (type === "emailOrPhone") {
|
|
3390
3404
|
updateEmailOrPhoneType(field.value);
|
|
@@ -3421,7 +3435,11 @@ var InputDynamic = ({
|
|
|
3421
3435
|
"div",
|
|
3422
3436
|
{
|
|
3423
3437
|
ref: emailOrPhoneInputRef,
|
|
3424
|
-
className: reactComponents.mergeClasses(
|
|
3438
|
+
className: reactComponents.mergeClasses(
|
|
3439
|
+
styles.phoneInputWrapper,
|
|
3440
|
+
phoneAppearanceClass,
|
|
3441
|
+
error ? styles.phoneInputError : ""
|
|
3442
|
+
),
|
|
3425
3443
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3426
3444
|
PhoneInput,
|
|
3427
3445
|
{
|
|
@@ -3524,7 +3542,11 @@ var InputDynamic = ({
|
|
|
3524
3542
|
"div",
|
|
3525
3543
|
{
|
|
3526
3544
|
ref: phoneInputRef,
|
|
3527
|
-
className: reactComponents.mergeClasses(
|
|
3545
|
+
className: reactComponents.mergeClasses(
|
|
3546
|
+
styles.phoneInputWrapper,
|
|
3547
|
+
phoneAppearanceClass,
|
|
3548
|
+
error ? styles.phoneInputError : ""
|
|
3549
|
+
),
|
|
3528
3550
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3529
3551
|
PhoneInput,
|
|
3530
3552
|
{
|
|
@@ -3659,7 +3681,9 @@ var InputDynamic = ({
|
|
|
3659
3681
|
autoCapitalize: "off",
|
|
3660
3682
|
spellCheck: "false"
|
|
3661
3683
|
},
|
|
3662
|
-
value: (options && options.length > 0 ? options : COUNTRIES).find(
|
|
3684
|
+
value: (options && options.length > 0 ? options : COUNTRIES).find(
|
|
3685
|
+
(country) => country.value === field.value
|
|
3686
|
+
) || null,
|
|
3663
3687
|
onChange: (selectedOption) => {
|
|
3664
3688
|
field.onChange(selectedOption ? selectedOption.value : "");
|
|
3665
3689
|
if (onChange) {
|
|
@@ -3710,24 +3734,33 @@ var InputDynamic = ({
|
|
|
3710
3734
|
return stringVal;
|
|
3711
3735
|
};
|
|
3712
3736
|
const cleanedFieldValue = cleanPhoneValue(field.value || "");
|
|
3737
|
+
const phoneInputProps = {};
|
|
3738
|
+
if (onlyCountries) {
|
|
3739
|
+
phoneInputProps.onlyCountries = onlyCountries;
|
|
3740
|
+
}
|
|
3713
3741
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3714
3742
|
"div",
|
|
3715
3743
|
{
|
|
3716
|
-
className: reactComponents.mergeClasses(
|
|
3744
|
+
className: reactComponents.mergeClasses(
|
|
3745
|
+
styles.phoneInputWrapper,
|
|
3746
|
+
phoneAppearanceClass,
|
|
3747
|
+
error ? styles.phoneInputError : ""
|
|
3748
|
+
),
|
|
3717
3749
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3718
3750
|
PhoneInput,
|
|
3719
3751
|
{
|
|
3752
|
+
...phoneInputProps,
|
|
3720
3753
|
country: defaultCountry.toLowerCase(),
|
|
3721
|
-
|
|
3754
|
+
disabled,
|
|
3755
|
+
disableSearchIcon: true,
|
|
3756
|
+
enableSearch: true,
|
|
3757
|
+
inputStyle: phoneInputSizeStyle,
|
|
3722
3758
|
onChange: (value, data) => {
|
|
3723
3759
|
const cleanedValue = cleanPhoneValue(value || "");
|
|
3724
3760
|
field.onChange(cleanedValue);
|
|
3725
3761
|
},
|
|
3726
3762
|
placeholder: placeholder || mergedLabels.phoneDefaultPlaceholder,
|
|
3727
|
-
|
|
3728
|
-
enableSearch: true,
|
|
3729
|
-
disableSearchIcon: true,
|
|
3730
|
-
inputStyle: phoneInputSizeStyle
|
|
3763
|
+
value: cleanedFieldValue
|
|
3731
3764
|
}
|
|
3732
3765
|
)
|
|
3733
3766
|
}
|
|
@@ -4078,7 +4111,9 @@ var InputDynamic = ({
|
|
|
4078
4111
|
if (!stringValue) return true;
|
|
4079
4112
|
const detectedType = detectEmailOrPhoneStrict(stringValue);
|
|
4080
4113
|
if (detectedType === "email") {
|
|
4081
|
-
if (!/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i.test(
|
|
4114
|
+
if (!/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i.test(
|
|
4115
|
+
stringValue
|
|
4116
|
+
)) {
|
|
4082
4117
|
return mergedLabels.invalidEmailFormatError;
|
|
4083
4118
|
}
|
|
4084
4119
|
} else if (detectedType === "phone") {
|
|
@@ -4107,7 +4142,9 @@ var InputDynamic = ({
|
|
|
4107
4142
|
if (!stringValue) return true;
|
|
4108
4143
|
const detectedType = detectIdentityType(stringValue);
|
|
4109
4144
|
if (detectedType === "email") {
|
|
4110
|
-
if (!/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i.test(
|
|
4145
|
+
if (!/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/i.test(
|
|
4146
|
+
stringValue
|
|
4147
|
+
)) {
|
|
4111
4148
|
return mergedLabels.invalidEmailFormatError;
|
|
4112
4149
|
}
|
|
4113
4150
|
} else if (detectedType === "phone") {
|
|
@@ -4154,29 +4191,40 @@ var InputDynamic = ({
|
|
|
4154
4191
|
}
|
|
4155
4192
|
),
|
|
4156
4193
|
renderInput(field, error?.message),
|
|
4157
|
-
helperText && !error && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
{
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4194
|
+
helperText && !error && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4195
|
+
"div",
|
|
4196
|
+
{
|
|
4197
|
+
style: {
|
|
4198
|
+
display: "flex",
|
|
4199
|
+
alignItems: "flex-start",
|
|
4200
|
+
gap: "4px",
|
|
4201
|
+
marginTop: "4px"
|
|
4202
|
+
},
|
|
4203
|
+
children: [
|
|
4204
|
+
helperIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4205
|
+
react.Icon,
|
|
4206
|
+
{
|
|
4207
|
+
icon: helperIcon,
|
|
4208
|
+
style: {
|
|
4209
|
+
color: reactComponents.tokens.colorNeutralForeground3,
|
|
4210
|
+
flexShrink: 0
|
|
4211
|
+
},
|
|
4212
|
+
width: 16,
|
|
4213
|
+
height: 16
|
|
4214
|
+
}
|
|
4215
|
+
),
|
|
4216
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4217
|
+
reactComponents.Text,
|
|
4218
|
+
{
|
|
4219
|
+
size: 200,
|
|
4220
|
+
style: { textAlign: "left" },
|
|
4221
|
+
className: styles.helperText,
|
|
4222
|
+
children: helperText
|
|
4223
|
+
}
|
|
4224
|
+
)
|
|
4225
|
+
]
|
|
4226
|
+
}
|
|
4227
|
+
)
|
|
4180
4228
|
]
|
|
4181
4229
|
}
|
|
4182
4230
|
)
|