@ikatec/nebula-react 1.0.8 → 1.0.10
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 +4 -16
- package/dist/index.d.ts +4 -16
- package/dist/index.js +18 -7
- package/dist/index.mjs +18 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -15,7 +15,6 @@ import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
|
15
15
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
16
16
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
17
17
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
18
|
-
import * as RPNInput from 'react-phone-number-input';
|
|
19
18
|
|
|
20
19
|
declare enum buttonVariantEnum {
|
|
21
20
|
primary = "\n bg-button-primary-background-default\n hover:bg-button-primary-background-hover\n active:bg-button-primary-background-active\n focus:bg-button-primary-background-focus\n focus:ring-button-primary-border-focus\n text-button-primary-text\n ",
|
|
@@ -491,23 +490,12 @@ interface CaptionProps extends HTMLAttributes<HTMLTableCaptionElement> {
|
|
|
491
490
|
declare const Caption: React__default.ForwardRefExoticComponent<CaptionProps & React__default.RefAttributes<HTMLTableCaptionElement>>;
|
|
492
491
|
interface LinkProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
493
492
|
size?: 'md' | 'sm';
|
|
493
|
+
asChild?: boolean;
|
|
494
|
+
children: ReactNode;
|
|
494
495
|
}
|
|
495
|
-
declare const Link: React__default.ForwardRefExoticComponent<
|
|
496
|
-
[K: string]: any;
|
|
497
|
-
} & {
|
|
498
|
-
component?: (props: LinkProps) => ReactNode;
|
|
499
|
-
}, "ref"> & React__default.RefAttributes<HTMLAnchorElement>>;
|
|
496
|
+
declare const Link: React__default.ForwardRefExoticComponent<LinkProps & React__default.RefAttributes<HTMLAnchorElement>>;
|
|
500
497
|
|
|
501
|
-
|
|
502
|
-
value: string;
|
|
503
|
-
onChange: (value: string) => void;
|
|
504
|
-
className?: string;
|
|
505
|
-
disabled?: boolean;
|
|
506
|
-
placeholder?: string;
|
|
507
|
-
isError?: boolean;
|
|
508
|
-
defaultCountry?: RPNInput.Country;
|
|
509
|
-
};
|
|
510
|
-
declare function InputPhone({ value, onChange, className, disabled, isError, defaultCountry, ...props }: InputPhoneProps): react_jsx_runtime.JSX.Element;
|
|
498
|
+
declare function InputPhone(): react_jsx_runtime.JSX.Element;
|
|
511
499
|
|
|
512
500
|
interface SkeletonProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
513
501
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
|
15
15
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
16
16
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
17
17
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
18
|
-
import * as RPNInput from 'react-phone-number-input';
|
|
19
18
|
|
|
20
19
|
declare enum buttonVariantEnum {
|
|
21
20
|
primary = "\n bg-button-primary-background-default\n hover:bg-button-primary-background-hover\n active:bg-button-primary-background-active\n focus:bg-button-primary-background-focus\n focus:ring-button-primary-border-focus\n text-button-primary-text\n ",
|
|
@@ -491,23 +490,12 @@ interface CaptionProps extends HTMLAttributes<HTMLTableCaptionElement> {
|
|
|
491
490
|
declare const Caption: React__default.ForwardRefExoticComponent<CaptionProps & React__default.RefAttributes<HTMLTableCaptionElement>>;
|
|
492
491
|
interface LinkProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
493
492
|
size?: 'md' | 'sm';
|
|
493
|
+
asChild?: boolean;
|
|
494
|
+
children: ReactNode;
|
|
494
495
|
}
|
|
495
|
-
declare const Link: React__default.ForwardRefExoticComponent<
|
|
496
|
-
[K: string]: any;
|
|
497
|
-
} & {
|
|
498
|
-
component?: (props: LinkProps) => ReactNode;
|
|
499
|
-
}, "ref"> & React__default.RefAttributes<HTMLAnchorElement>>;
|
|
496
|
+
declare const Link: React__default.ForwardRefExoticComponent<LinkProps & React__default.RefAttributes<HTMLAnchorElement>>;
|
|
500
497
|
|
|
501
|
-
|
|
502
|
-
value: string;
|
|
503
|
-
onChange: (value: string) => void;
|
|
504
|
-
className?: string;
|
|
505
|
-
disabled?: boolean;
|
|
506
|
-
placeholder?: string;
|
|
507
|
-
isError?: boolean;
|
|
508
|
-
defaultCountry?: RPNInput.Country;
|
|
509
|
-
};
|
|
510
|
-
declare function InputPhone({ value, onChange, className, disabled, isError, defaultCountry, ...props }: InputPhoneProps): react_jsx_runtime.JSX.Element;
|
|
498
|
+
declare function InputPhone(): react_jsx_runtime.JSX.Element;
|
|
511
499
|
|
|
512
500
|
interface SkeletonProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
513
501
|
}
|
package/dist/index.js
CHANGED
|
@@ -3552,14 +3552,14 @@ var FlagComponent = ({ country, countryName }) => {
|
|
|
3552
3552
|
};
|
|
3553
3553
|
var PhoneInput = React8__namespace.default.forwardRef(({ className, ...props }, ref) => {
|
|
3554
3554
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nebula-ds flex items-center justify-center rounded-e-[20px] w-full", children: [
|
|
3555
|
-
/* @__PURE__ */ jsxRuntime.jsx(Separator2, { orientation: "vertical", className: "nebula-ds w-[
|
|
3555
|
+
/* @__PURE__ */ jsxRuntime.jsx(Separator2, { orientation: "vertical", className: "nebula-ds w-[1px] h-5 z-10" }),
|
|
3556
3556
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3557
3557
|
InputText,
|
|
3558
3558
|
{
|
|
3559
3559
|
"data-slot": "phone-input",
|
|
3560
3560
|
ref,
|
|
3561
3561
|
className: cn(
|
|
3562
|
-
"-ms-px rounded-s-none shadow-none focus-visible:z-10 ring-0 focus:ring-0 border-0 w-full",
|
|
3562
|
+
"-ms-px rounded-s-none shadow-none focus-visible:z-10 ring-0 focus:ring-0 border-0 w-full h-auto",
|
|
3563
3563
|
className
|
|
3564
3564
|
),
|
|
3565
3565
|
...props
|
|
@@ -3577,12 +3577,23 @@ function InputPhone({
|
|
|
3577
3577
|
defaultCountry = "BR",
|
|
3578
3578
|
...props
|
|
3579
3579
|
}) {
|
|
3580
|
-
const
|
|
3580
|
+
const countryCode = defaultCountry ? RPNInput__namespace.getCountryCallingCode(defaultCountry) : null;
|
|
3581
|
+
const valueCorrection = React8__namespace.default.useMemo(() => {
|
|
3582
|
+
if (!value || !countryCode) return "";
|
|
3583
|
+
const stringValue = value.toString().trim();
|
|
3584
|
+
if (stringValue.startsWith("+")) {
|
|
3585
|
+
return stringValue;
|
|
3586
|
+
}
|
|
3587
|
+
if (stringValue.startsWith(countryCode)) {
|
|
3588
|
+
return `+${stringValue}`;
|
|
3589
|
+
}
|
|
3590
|
+
return `+${countryCode}${stringValue}`;
|
|
3591
|
+
}, [value, countryCode]);
|
|
3581
3592
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3582
3593
|
RPNInput__namespace.default,
|
|
3583
3594
|
{
|
|
3584
3595
|
className: cn(
|
|
3585
|
-
"flex w-full bg-inputText-background-default rounded-[20px] border border-inputText-border-default focus-within:ring-[3px] focus-within:ring-inputText-border-focus focus-within:border-inputText-border-focus",
|
|
3596
|
+
"flex w-full h-10 bg-inputText-background-default rounded-[20px] border border-inputText-border-default focus-within:ring-[3px] focus-within:ring-inputText-border-focus focus-within:border-inputText-border-focus",
|
|
3586
3597
|
{ "bg-inputText-background-disabled": disabled },
|
|
3587
3598
|
{
|
|
3588
3599
|
"text-inputText-icon-danger border-inputText-border-danger focus-within:border-inputText-border-danger focus-within:ring-button-danger-border-focus": isError
|
|
@@ -3594,11 +3605,11 @@ function InputPhone({
|
|
|
3594
3605
|
countrySelectComponent: CountrySelect,
|
|
3595
3606
|
inputComponent: PhoneInput,
|
|
3596
3607
|
disabled,
|
|
3597
|
-
value: valueCorrection
|
|
3608
|
+
value: valueCorrection,
|
|
3598
3609
|
onChange: (newValue) => onChange(newValue ?? ""),
|
|
3599
|
-
countryCallingCodeEditable: true,
|
|
3600
|
-
initialValueFormat: "national",
|
|
3601
3610
|
defaultCountry,
|
|
3611
|
+
countryCallingCodeEditable: true,
|
|
3612
|
+
international: true,
|
|
3602
3613
|
...props
|
|
3603
3614
|
}
|
|
3604
3615
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -3512,14 +3512,14 @@ var FlagComponent = ({ country, countryName }) => {
|
|
|
3512
3512
|
};
|
|
3513
3513
|
var PhoneInput = React8__default.forwardRef(({ className, ...props }, ref) => {
|
|
3514
3514
|
return /* @__PURE__ */ jsxs("div", { className: "nebula-ds flex items-center justify-center rounded-e-[20px] w-full", children: [
|
|
3515
|
-
/* @__PURE__ */ jsx(Separator2, { orientation: "vertical", className: "nebula-ds w-[
|
|
3515
|
+
/* @__PURE__ */ jsx(Separator2, { orientation: "vertical", className: "nebula-ds w-[1px] h-5 z-10" }),
|
|
3516
3516
|
/* @__PURE__ */ jsx(
|
|
3517
3517
|
InputText,
|
|
3518
3518
|
{
|
|
3519
3519
|
"data-slot": "phone-input",
|
|
3520
3520
|
ref,
|
|
3521
3521
|
className: cn(
|
|
3522
|
-
"-ms-px rounded-s-none shadow-none focus-visible:z-10 ring-0 focus:ring-0 border-0 w-full",
|
|
3522
|
+
"-ms-px rounded-s-none shadow-none focus-visible:z-10 ring-0 focus:ring-0 border-0 w-full h-auto",
|
|
3523
3523
|
className
|
|
3524
3524
|
),
|
|
3525
3525
|
...props
|
|
@@ -3537,12 +3537,23 @@ function InputPhone({
|
|
|
3537
3537
|
defaultCountry = "BR",
|
|
3538
3538
|
...props
|
|
3539
3539
|
}) {
|
|
3540
|
-
const
|
|
3540
|
+
const countryCode = defaultCountry ? RPNInput.getCountryCallingCode(defaultCountry) : null;
|
|
3541
|
+
const valueCorrection = React8__default.useMemo(() => {
|
|
3542
|
+
if (!value || !countryCode) return "";
|
|
3543
|
+
const stringValue = value.toString().trim();
|
|
3544
|
+
if (stringValue.startsWith("+")) {
|
|
3545
|
+
return stringValue;
|
|
3546
|
+
}
|
|
3547
|
+
if (stringValue.startsWith(countryCode)) {
|
|
3548
|
+
return `+${stringValue}`;
|
|
3549
|
+
}
|
|
3550
|
+
return `+${countryCode}${stringValue}`;
|
|
3551
|
+
}, [value, countryCode]);
|
|
3541
3552
|
return /* @__PURE__ */ jsx(
|
|
3542
3553
|
RPNInput.default,
|
|
3543
3554
|
{
|
|
3544
3555
|
className: cn(
|
|
3545
|
-
"flex w-full bg-inputText-background-default rounded-[20px] border border-inputText-border-default focus-within:ring-[3px] focus-within:ring-inputText-border-focus focus-within:border-inputText-border-focus",
|
|
3556
|
+
"flex w-full h-10 bg-inputText-background-default rounded-[20px] border border-inputText-border-default focus-within:ring-[3px] focus-within:ring-inputText-border-focus focus-within:border-inputText-border-focus",
|
|
3546
3557
|
{ "bg-inputText-background-disabled": disabled },
|
|
3547
3558
|
{
|
|
3548
3559
|
"text-inputText-icon-danger border-inputText-border-danger focus-within:border-inputText-border-danger focus-within:ring-button-danger-border-focus": isError
|
|
@@ -3554,11 +3565,11 @@ function InputPhone({
|
|
|
3554
3565
|
countrySelectComponent: CountrySelect,
|
|
3555
3566
|
inputComponent: PhoneInput,
|
|
3556
3567
|
disabled,
|
|
3557
|
-
value: valueCorrection
|
|
3568
|
+
value: valueCorrection,
|
|
3558
3569
|
onChange: (newValue) => onChange(newValue ?? ""),
|
|
3559
|
-
countryCallingCodeEditable: true,
|
|
3560
|
-
initialValueFormat: "national",
|
|
3561
3570
|
defaultCountry,
|
|
3571
|
+
countryCallingCodeEditable: true,
|
|
3572
|
+
international: true,
|
|
3562
3573
|
...props
|
|
3563
3574
|
}
|
|
3564
3575
|
);
|