@lets-events/react 11.0.3 → 11.0.5
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +137 -124
- package/dist/index.mjs +108 -95
- package/package.json +1 -1
- package/src/components/TextField.tsx +63 -55
- package/src/components/TextareaField.tsx +83 -72
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @lets-events/react@11.0.
|
|
2
|
+
> @lets-events/react@11.0.5 build
|
|
3
3
|
> tsup src/index.tsx --format esm,cjs --dts --external react
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.tsx
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist\index.js [22m[
|
|
12
|
-
[32mCJS[39m ⚡️ Build success in
|
|
13
|
-
[32mESM[39m [1mdist\index.mjs [22m[32m275.
|
|
14
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mCJS[39m [1mdist\index.js [22m[32m284.17 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 218ms
|
|
13
|
+
[32mESM[39m [1mdist\index.mjs [22m[32m275.82 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 219ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist\index.d.mts [22m[32m338.
|
|
18
|
-
[32mDTS[39m [1mdist\index.d.ts [22m[32m338.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 3492ms
|
|
17
|
+
[32mDTS[39m [1mdist\index.d.mts [22m[32m338.39 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist\index.d.ts [22m[32m338.39 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -2699,7 +2699,7 @@ type TextFieldSlotProps = Omit<ComponentProps<typeof TextFieldStyled>, "color">
|
|
|
2699
2699
|
};
|
|
2700
2700
|
declare const maskFormat: typeof format;
|
|
2701
2701
|
declare const maskUnformat: typeof unformat;
|
|
2702
|
-
declare const TextField:
|
|
2702
|
+
declare const TextField: react__default.ForwardRefExoticComponent<Omit<TextFieldProps, "ref"> & react__default.RefAttributes<HTMLInputElement>>;
|
|
2703
2703
|
declare function TextFieldSlot({ children, position, onClick, typography, fontWeight, textAlign, ...props }: TextFieldSlotProps): react_jsx_runtime.JSX.Element;
|
|
2704
2704
|
|
|
2705
2705
|
declare const RadioGroupStyled: _stitches_react_types_styled_component.StyledComponent<react.ForwardRefExoticComponent<RadioGroup$1.RootProps & react.RefAttributes<HTMLDivElement>>, {
|
|
@@ -10647,7 +10647,7 @@ type CardProps = ComponentProps<typeof CardStyled> & {
|
|
|
10647
10647
|
};
|
|
10648
10648
|
declare function Card({ asChild, children, ...props }: CardProps): react_jsx_runtime.JSX.Element;
|
|
10649
10649
|
|
|
10650
|
-
declare const TextareaFieldStyle: _stitches_react_types_styled_component.StyledComponent<
|
|
10650
|
+
declare const TextareaFieldStyle: _stitches_react_types_styled_component.StyledComponent<react__default.ForwardRefExoticComponent<_radix_ui_themes.TextAreaProps & react__default.RefAttributes<HTMLTextAreaElement>>, {
|
|
10651
10651
|
typography?: "tooltip" | "displayLarge" | "displayMedium" | "displaySmall" | "headline1" | "headline2" | "headline3" | "headline4" | "headline5" | "headline6" | "headline7" | "headline8" | "bodyXL" | "bodyL" | "bodyM" | "bodyS" | "bodyXS" | "bodyXXS" | "badgeLarge" | "badgeMedium" | "badgeSmall" | "badgeExtraSmall" | "popoversRegular" | "captionLarge" | "captionMedium" | "captionSmall" | "buttonLarge" | "buttonMedium" | "buttonSmall" | "buttonExtraSmall" | "labelLarge" | "labelMedium" | "labelSmall" | "labelExtraSmall" | undefined;
|
|
10652
10652
|
}, {}, _stitches_react_types_css_util.CSS<{}, {
|
|
10653
10653
|
colors: {
|
|
@@ -11022,7 +11022,7 @@ declare const TextareaFieldStyle: _stitches_react_types_styled_component.StyledC
|
|
|
11022
11022
|
type TextareaFieldProps = ComponentProps<typeof TextareaFieldStyle> & {
|
|
11023
11023
|
limit: number;
|
|
11024
11024
|
};
|
|
11025
|
-
declare
|
|
11025
|
+
declare const TextareaField: react__default.ForwardRefExoticComponent<Omit<TextareaFieldProps, "ref"> & react__default.RefAttributes<HTMLTextAreaElement>>;
|
|
11026
11026
|
|
|
11027
11027
|
type ToastType = 'success' | 'error' | 'warning' | 'info';
|
|
11028
11028
|
interface ToastConfig {
|
package/dist/index.d.ts
CHANGED
|
@@ -2699,7 +2699,7 @@ type TextFieldSlotProps = Omit<ComponentProps<typeof TextFieldStyled>, "color">
|
|
|
2699
2699
|
};
|
|
2700
2700
|
declare const maskFormat: typeof format;
|
|
2701
2701
|
declare const maskUnformat: typeof unformat;
|
|
2702
|
-
declare const TextField:
|
|
2702
|
+
declare const TextField: react__default.ForwardRefExoticComponent<Omit<TextFieldProps, "ref"> & react__default.RefAttributes<HTMLInputElement>>;
|
|
2703
2703
|
declare function TextFieldSlot({ children, position, onClick, typography, fontWeight, textAlign, ...props }: TextFieldSlotProps): react_jsx_runtime.JSX.Element;
|
|
2704
2704
|
|
|
2705
2705
|
declare const RadioGroupStyled: _stitches_react_types_styled_component.StyledComponent<react.ForwardRefExoticComponent<RadioGroup$1.RootProps & react.RefAttributes<HTMLDivElement>>, {
|
|
@@ -10647,7 +10647,7 @@ type CardProps = ComponentProps<typeof CardStyled> & {
|
|
|
10647
10647
|
};
|
|
10648
10648
|
declare function Card({ asChild, children, ...props }: CardProps): react_jsx_runtime.JSX.Element;
|
|
10649
10649
|
|
|
10650
|
-
declare const TextareaFieldStyle: _stitches_react_types_styled_component.StyledComponent<
|
|
10650
|
+
declare const TextareaFieldStyle: _stitches_react_types_styled_component.StyledComponent<react__default.ForwardRefExoticComponent<_radix_ui_themes.TextAreaProps & react__default.RefAttributes<HTMLTextAreaElement>>, {
|
|
10651
10651
|
typography?: "tooltip" | "displayLarge" | "displayMedium" | "displaySmall" | "headline1" | "headline2" | "headline3" | "headline4" | "headline5" | "headline6" | "headline7" | "headline8" | "bodyXL" | "bodyL" | "bodyM" | "bodyS" | "bodyXS" | "bodyXXS" | "badgeLarge" | "badgeMedium" | "badgeSmall" | "badgeExtraSmall" | "popoversRegular" | "captionLarge" | "captionMedium" | "captionSmall" | "buttonLarge" | "buttonMedium" | "buttonSmall" | "buttonExtraSmall" | "labelLarge" | "labelMedium" | "labelSmall" | "labelExtraSmall" | undefined;
|
|
10652
10652
|
}, {}, _stitches_react_types_css_util.CSS<{}, {
|
|
10653
10653
|
colors: {
|
|
@@ -11022,7 +11022,7 @@ declare const TextareaFieldStyle: _stitches_react_types_styled_component.StyledC
|
|
|
11022
11022
|
type TextareaFieldProps = ComponentProps<typeof TextareaFieldStyle> & {
|
|
11023
11023
|
limit: number;
|
|
11024
11024
|
};
|
|
11025
|
-
declare
|
|
11025
|
+
declare const TextareaField: react__default.ForwardRefExoticComponent<Omit<TextareaFieldProps, "ref"> & react__default.RefAttributes<HTMLTextAreaElement>>;
|
|
11026
11026
|
|
|
11027
11027
|
type ToastType = 'success' | 'error' | 'warning' | 'info';
|
|
11028
11028
|
interface ToastConfig {
|
package/dist/index.js
CHANGED
|
@@ -2472,6 +2472,7 @@ function Avatar(_a) {
|
|
|
2472
2472
|
}
|
|
2473
2473
|
|
|
2474
2474
|
// src/components/TextField.tsx
|
|
2475
|
+
var import_react2 = __toESM(require("react"));
|
|
2475
2476
|
var import_themes7 = require("@radix-ui/themes");
|
|
2476
2477
|
|
|
2477
2478
|
// src/components/Flex.tsx
|
|
@@ -2599,6 +2600,7 @@ var TextFieldStyled = styled(import_themes7.TextField.Root, {
|
|
|
2599
2600
|
alignItems: "center",
|
|
2600
2601
|
padding: "0 $14",
|
|
2601
2602
|
gap: "$14",
|
|
2603
|
+
backgroundColor: "$dark50",
|
|
2602
2604
|
input: {
|
|
2603
2605
|
order: 1,
|
|
2604
2606
|
outline: "none",
|
|
@@ -2746,71 +2748,73 @@ var InputAddon = styled(TextStyle, {
|
|
|
2746
2748
|
});
|
|
2747
2749
|
var maskFormat = import_mask.format;
|
|
2748
2750
|
var maskUnformat = import_mask.unformat;
|
|
2749
|
-
var TextField = (
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
}
|
|
2793
|
-
}, props), {
|
|
2794
|
-
style: addon ? { borderTopLeftRadius: "0px", borderBottomLeftRadius: "0px" } : void 0,
|
|
2795
|
-
children: [
|
|
2796
|
-
children,
|
|
2797
|
-
isValid2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2798
|
-
TextFieldSlot,
|
|
2799
|
-
{
|
|
2800
|
-
position: "flex-end",
|
|
2801
|
-
name,
|
|
2802
|
-
color,
|
|
2803
|
-
typography,
|
|
2804
|
-
fontWeight,
|
|
2805
|
-
textAlign,
|
|
2806
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon_default, { name: "check" })
|
|
2751
|
+
var TextField = import_react2.default.forwardRef(
|
|
2752
|
+
(_a, fowardedRef) => {
|
|
2753
|
+
var _b = _a, {
|
|
2754
|
+
children,
|
|
2755
|
+
isValid: isValid2,
|
|
2756
|
+
name,
|
|
2757
|
+
color,
|
|
2758
|
+
typography,
|
|
2759
|
+
fontWeight,
|
|
2760
|
+
addon,
|
|
2761
|
+
textAlign = "left",
|
|
2762
|
+
mask
|
|
2763
|
+
} = _b, props = __objRest(_b, [
|
|
2764
|
+
"children",
|
|
2765
|
+
"isValid",
|
|
2766
|
+
"name",
|
|
2767
|
+
"color",
|
|
2768
|
+
"typography",
|
|
2769
|
+
"fontWeight",
|
|
2770
|
+
"addon",
|
|
2771
|
+
"textAlign",
|
|
2772
|
+
"mask"
|
|
2773
|
+
]);
|
|
2774
|
+
const maskRef = mask ? (0, import_mask.useMask)(mask) : void 0;
|
|
2775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Flex2, { gap: "0", css: { width: "100%" }, children: [
|
|
2776
|
+
!!addon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(InputAddon, { typography: "labelSmall", children: addon }),
|
|
2777
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
2778
|
+
TextFieldStyled,
|
|
2779
|
+
__spreadProps(__spreadValues({
|
|
2780
|
+
color,
|
|
2781
|
+
isValid: isValid2,
|
|
2782
|
+
name,
|
|
2783
|
+
typography,
|
|
2784
|
+
fontWeight,
|
|
2785
|
+
textAlign,
|
|
2786
|
+
ref: (r) => {
|
|
2787
|
+
if (!r) return;
|
|
2788
|
+
if (maskRef) maskRef.current = r;
|
|
2789
|
+
if (fowardedRef) {
|
|
2790
|
+
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
2791
|
+
else {
|
|
2792
|
+
fowardedRef.current = r;
|
|
2793
|
+
}
|
|
2807
2794
|
}
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2795
|
+
}
|
|
2796
|
+
}, props), {
|
|
2797
|
+
style: addon ? { borderTopLeftRadius: "0px", borderBottomLeftRadius: "0px" } : void 0,
|
|
2798
|
+
children: [
|
|
2799
|
+
children,
|
|
2800
|
+
isValid2 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2801
|
+
TextFieldSlot,
|
|
2802
|
+
{
|
|
2803
|
+
position: "flex-end",
|
|
2804
|
+
name,
|
|
2805
|
+
color,
|
|
2806
|
+
typography,
|
|
2807
|
+
fontWeight,
|
|
2808
|
+
textAlign,
|
|
2809
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon_default, { name: "check" })
|
|
2810
|
+
}
|
|
2811
|
+
)
|
|
2812
|
+
]
|
|
2813
|
+
})
|
|
2814
|
+
)
|
|
2815
|
+
] });
|
|
2816
|
+
}
|
|
2817
|
+
);
|
|
2814
2818
|
function TextFieldSlot(_a) {
|
|
2815
2819
|
var _b = _a, {
|
|
2816
2820
|
children,
|
|
@@ -3518,7 +3522,7 @@ function DropdownMenuItem(_a) {
|
|
|
3518
3522
|
}
|
|
3519
3523
|
|
|
3520
3524
|
// src/components/Badge.tsx
|
|
3521
|
-
var
|
|
3525
|
+
var import_react3 = __toESM(require("react"));
|
|
3522
3526
|
var import_themes12 = require("@radix-ui/themes");
|
|
3523
3527
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3524
3528
|
var BadgeStyled = styled(import_themes12.Badge, {
|
|
@@ -3625,9 +3629,9 @@ var BadgeStyled = styled(import_themes12.Badge, {
|
|
|
3625
3629
|
});
|
|
3626
3630
|
function Badge(_a) {
|
|
3627
3631
|
var _b = _a, { asChild, children } = _b, props = __objRest(_b, ["asChild", "children"]);
|
|
3628
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BadgeStyled, __spreadProps(__spreadValues({}, props), { children:
|
|
3629
|
-
if (
|
|
3630
|
-
return
|
|
3632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BadgeStyled, __spreadProps(__spreadValues({}, props), { children: import_react3.default.Children.map(children, (child) => {
|
|
3633
|
+
if (import_react3.default.isValidElement(child)) {
|
|
3634
|
+
return import_react3.default.cloneElement(child, { size: props.size });
|
|
3631
3635
|
}
|
|
3632
3636
|
return child;
|
|
3633
3637
|
}) }));
|
|
@@ -3702,12 +3706,12 @@ function Modal(_a) {
|
|
|
3702
3706
|
}
|
|
3703
3707
|
|
|
3704
3708
|
// src/components/Calendar/index.tsx
|
|
3705
|
-
var
|
|
3709
|
+
var import_react5 = require("react");
|
|
3706
3710
|
|
|
3707
3711
|
// src/hooks/useOnClickOutside.tsx
|
|
3708
|
-
var
|
|
3712
|
+
var import_react4 = require("react");
|
|
3709
3713
|
function useOnClickOutside(ref, handler) {
|
|
3710
|
-
(0,
|
|
3714
|
+
(0, import_react4.useEffect)(() => {
|
|
3711
3715
|
const listener = (event) => {
|
|
3712
3716
|
if (!ref.current || ref.current.contains(event.target)) {
|
|
3713
3717
|
return;
|
|
@@ -7844,15 +7848,15 @@ function Calendar(_a) {
|
|
|
7844
7848
|
"setSelected",
|
|
7845
7849
|
"position"
|
|
7846
7850
|
]);
|
|
7847
|
-
const [inputValue, setInputValue] = (0,
|
|
7848
|
-
const [showContainer, setShowCalendar] = (0,
|
|
7849
|
-
const dropdownRef = (0,
|
|
7851
|
+
const [inputValue, setInputValue] = (0, import_react5.useState)("");
|
|
7852
|
+
const [showContainer, setShowCalendar] = (0, import_react5.useState)(false);
|
|
7853
|
+
const dropdownRef = (0, import_react5.useRef)(null);
|
|
7850
7854
|
useOnClickOutside(dropdownRef, () => {
|
|
7851
7855
|
setShowCalendar(false);
|
|
7852
7856
|
});
|
|
7853
7857
|
const today = /* @__PURE__ */ new Date();
|
|
7854
7858
|
const maxDate = addYears(today, 20);
|
|
7855
|
-
(0,
|
|
7859
|
+
(0, import_react5.useEffect)(() => {
|
|
7856
7860
|
if (selected) {
|
|
7857
7861
|
setInputValue(format2(selected, "dd/MM/yyyy"));
|
|
7858
7862
|
} else {
|
|
@@ -7929,7 +7933,7 @@ function Calendar(_a) {
|
|
|
7929
7933
|
}
|
|
7930
7934
|
|
|
7931
7935
|
// src/components/TimePicker.tsx
|
|
7932
|
-
var
|
|
7936
|
+
var import_react6 = require("react");
|
|
7933
7937
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
7934
7938
|
var TimePickerStyled = styled("div", {
|
|
7935
7939
|
position: "relative",
|
|
@@ -8033,14 +8037,14 @@ function TimePicker({
|
|
|
8033
8037
|
setSelected,
|
|
8034
8038
|
position = "bottom"
|
|
8035
8039
|
}) {
|
|
8036
|
-
const [hours, setHours] = (0,
|
|
8037
|
-
const [minutes, setMinutes] = (0,
|
|
8038
|
-
const [rawHours, setRawHours] = (0,
|
|
8039
|
-
const [rawMinutes, setRawMinutes] = (0,
|
|
8040
|
-
const [isOpen, setIsOpen] = (0,
|
|
8041
|
-
const dropdownRef = (0,
|
|
8040
|
+
const [hours, setHours] = (0, import_react6.useState)("00");
|
|
8041
|
+
const [minutes, setMinutes] = (0, import_react6.useState)("00");
|
|
8042
|
+
const [rawHours, setRawHours] = (0, import_react6.useState)("00");
|
|
8043
|
+
const [rawMinutes, setRawMinutes] = (0, import_react6.useState)("00");
|
|
8044
|
+
const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
|
|
8045
|
+
const dropdownRef = (0, import_react6.useRef)(null);
|
|
8042
8046
|
useOnClickOutside(dropdownRef, () => setIsOpen(false));
|
|
8043
|
-
const handleIncrement = (0,
|
|
8047
|
+
const handleIncrement = (0, import_react6.useCallback)(
|
|
8044
8048
|
(type) => {
|
|
8045
8049
|
if (type === "hours") {
|
|
8046
8050
|
const next = (parseInt(hours) + 1) % 24;
|
|
@@ -8054,7 +8058,7 @@ function TimePicker({
|
|
|
8054
8058
|
},
|
|
8055
8059
|
[hours, minutes]
|
|
8056
8060
|
);
|
|
8057
|
-
const handleDecrement = (0,
|
|
8061
|
+
const handleDecrement = (0, import_react6.useCallback)(
|
|
8058
8062
|
(type) => {
|
|
8059
8063
|
if (type === "hours") {
|
|
8060
8064
|
const prev = (parseInt(hours) - 1 + 24) % 24;
|
|
@@ -8576,7 +8580,7 @@ function Switch(props) {
|
|
|
8576
8580
|
}
|
|
8577
8581
|
|
|
8578
8582
|
// src/components/Step.tsx
|
|
8579
|
-
var
|
|
8583
|
+
var import_react7 = __toESM(require("react"));
|
|
8580
8584
|
var import_themes16 = require("@radix-ui/themes");
|
|
8581
8585
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
8582
8586
|
var StepStyled = styled("div", {
|
|
@@ -8692,9 +8696,9 @@ function StepList(_a) {
|
|
|
8692
8696
|
"children",
|
|
8693
8697
|
"currentStep"
|
|
8694
8698
|
]);
|
|
8695
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StepListStyled, __spreadProps(__spreadValues({}, props), { children:
|
|
8696
|
-
if (
|
|
8697
|
-
return
|
|
8699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StepListStyled, __spreadProps(__spreadValues({}, props), { children: import_react7.default.Children.map(children, (child) => {
|
|
8700
|
+
if (import_react7.default.isValidElement(child) && child.type === StepTrigger) {
|
|
8701
|
+
return import_react7.default.cloneElement(child, { currentStep });
|
|
8698
8702
|
}
|
|
8699
8703
|
return child;
|
|
8700
8704
|
}) }));
|
|
@@ -8751,37 +8755,35 @@ function Card(_a) {
|
|
|
8751
8755
|
|
|
8752
8756
|
// src/components/TextareaField.tsx
|
|
8753
8757
|
var import_themes18 = require("@radix-ui/themes");
|
|
8754
|
-
var
|
|
8758
|
+
var import_react8 = __toESM(require("react"));
|
|
8755
8759
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
8756
8760
|
var TextareaFieldStyle = styled(import_themes18.TextArea, {
|
|
8757
8761
|
display: "flex",
|
|
8758
|
-
width: "fit-content",
|
|
8759
8762
|
flex: 1,
|
|
8760
8763
|
textarea: {
|
|
8761
8764
|
width: "100%",
|
|
8762
|
-
minHeight: "3.75rem",
|
|
8763
8765
|
border: "none",
|
|
8764
8766
|
padding: "$12 $14",
|
|
8765
8767
|
fontFamily: "$default",
|
|
8766
|
-
fontSize: "$16",
|
|
8767
8768
|
outline: "none",
|
|
8768
|
-
resize: "vertical"
|
|
8769
|
+
resize: "vertical",
|
|
8770
|
+
height: "auto"
|
|
8769
8771
|
},
|
|
8770
8772
|
variants: {
|
|
8771
8773
|
typography: typographyValues
|
|
8772
8774
|
},
|
|
8773
8775
|
defaultVariants: {
|
|
8774
|
-
typography: "
|
|
8776
|
+
typography: "labelSmall"
|
|
8775
8777
|
}
|
|
8776
8778
|
});
|
|
8777
8779
|
var TextareaContainer = styled("div", {
|
|
8778
|
-
position: "relative",
|
|
8779
8780
|
display: "flex",
|
|
8781
|
+
flexDirection: "column",
|
|
8780
8782
|
overflow: "hidden",
|
|
8781
|
-
|
|
8783
|
+
width: "100%",
|
|
8782
8784
|
border: "1px solid",
|
|
8783
8785
|
borderColor: "$dark300",
|
|
8784
|
-
borderRadius: "$
|
|
8786
|
+
borderRadius: "$sm",
|
|
8785
8787
|
"&:has(textarea:focus)": {
|
|
8786
8788
|
border: "1px solid $brand300"
|
|
8787
8789
|
},
|
|
@@ -8793,14 +8795,12 @@ var TextareaContainer = styled("div", {
|
|
|
8793
8795
|
}
|
|
8794
8796
|
});
|
|
8795
8797
|
var TextareaLimitIndicator = styled("div", {
|
|
8796
|
-
position: "absolute",
|
|
8797
|
-
bottom: 0,
|
|
8798
|
-
left: 0,
|
|
8799
8798
|
padding: "$12 $16",
|
|
8800
8799
|
borderTop: "1px solid $neutral300",
|
|
8801
8800
|
width: "100%",
|
|
8802
8801
|
flex: 1,
|
|
8803
8802
|
display: "flex",
|
|
8803
|
+
backgroundColor: "$dark50",
|
|
8804
8804
|
span: {
|
|
8805
8805
|
backgroundColor: "$neutral200",
|
|
8806
8806
|
color: "$neutral700",
|
|
@@ -8808,38 +8808,51 @@ var TextareaLimitIndicator = styled("div", {
|
|
|
8808
8808
|
padding: "$4"
|
|
8809
8809
|
}
|
|
8810
8810
|
});
|
|
8811
|
-
|
|
8811
|
+
var TextareaField = import_react8.default.forwardRef((_a, fowardedRef) => {
|
|
8812
8812
|
var _b = _a, { maxLength } = _b, props = __objRest(_b, ["maxLength"]);
|
|
8813
|
-
const inputRef = (0,
|
|
8814
|
-
const badgeRef = (0,
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8813
|
+
const inputRef = (0, import_react8.useRef)(null);
|
|
8814
|
+
const badgeRef = (0, import_react8.useRef)(null);
|
|
8815
|
+
const updateCharCountBadge = () => {
|
|
8816
|
+
var _a2, _b2;
|
|
8817
|
+
if (!maxLength || !badgeRef.current) return;
|
|
8818
|
+
const remainingChars = maxLength - ((_b2 = (_a2 = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a2.value.length) != null ? _b2 : 0);
|
|
8819
|
+
badgeRef.current.textContent = String(remainingChars);
|
|
8820
|
+
};
|
|
8821
|
+
const handleInput = (e) => {
|
|
8819
8822
|
var _a2;
|
|
8820
|
-
|
|
8821
|
-
|
|
8823
|
+
updateCharCountBadge();
|
|
8824
|
+
(_a2 = props.onInput) == null ? void 0 : _a2.call(props, e);
|
|
8822
8825
|
};
|
|
8823
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(TextareaContainer, {
|
|
8826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(TextareaContainer, { children: [
|
|
8824
8827
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8825
8828
|
TextareaFieldStyle,
|
|
8826
8829
|
__spreadValues({
|
|
8827
|
-
|
|
8830
|
+
rows: 3,
|
|
8831
|
+
ref: (r) => {
|
|
8832
|
+
if (!r) return;
|
|
8833
|
+
inputRef.current = r;
|
|
8834
|
+
if (fowardedRef) {
|
|
8835
|
+
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
8836
|
+
else {
|
|
8837
|
+
fowardedRef.current = r;
|
|
8838
|
+
}
|
|
8839
|
+
}
|
|
8840
|
+
},
|
|
8828
8841
|
onInput: handleInput,
|
|
8829
8842
|
maxLength
|
|
8830
8843
|
}, props)
|
|
8831
8844
|
),
|
|
8832
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TextareaLimitIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { typography: "badgeMedium", ref: badgeRef, children: maxLength }) })
|
|
8845
|
+
maxLength && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TextareaLimitIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { typography: "badgeMedium", ref: badgeRef, children: maxLength }) })
|
|
8833
8846
|
] });
|
|
8834
|
-
}
|
|
8847
|
+
});
|
|
8835
8848
|
|
|
8836
8849
|
// src/components/Toast/components/ToastItem.tsx
|
|
8837
|
-
var
|
|
8850
|
+
var import_react10 = require("react");
|
|
8838
8851
|
|
|
8839
8852
|
// src/components/Toast/styles/index.ts
|
|
8840
|
-
var
|
|
8853
|
+
var import_react9 = require("@stitches/react");
|
|
8841
8854
|
var ToastPrimitive = __toESM(require("@radix-ui/react-toast"));
|
|
8842
|
-
var slideIn = (0,
|
|
8855
|
+
var slideIn = (0, import_react9.keyframes)({
|
|
8843
8856
|
from: {
|
|
8844
8857
|
transform: "translateX(calc(100% + 25px))",
|
|
8845
8858
|
opacity: 0
|
|
@@ -8849,7 +8862,7 @@ var slideIn = (0, import_react8.keyframes)({
|
|
|
8849
8862
|
opacity: 1
|
|
8850
8863
|
}
|
|
8851
8864
|
});
|
|
8852
|
-
var slideOut = (0,
|
|
8865
|
+
var slideOut = (0, import_react9.keyframes)({
|
|
8853
8866
|
from: {
|
|
8854
8867
|
transform: "translateX(0)",
|
|
8855
8868
|
opacity: 1
|
|
@@ -8859,7 +8872,7 @@ var slideOut = (0, import_react8.keyframes)({
|
|
|
8859
8872
|
opacity: 0
|
|
8860
8873
|
}
|
|
8861
8874
|
});
|
|
8862
|
-
var swipeOut = (0,
|
|
8875
|
+
var swipeOut = (0, import_react9.keyframes)({
|
|
8863
8876
|
from: {
|
|
8864
8877
|
transform: "translateX(var(--radix-toast-swipe-end-x))",
|
|
8865
8878
|
opacity: 1
|
|
@@ -8965,7 +8978,7 @@ function ToastItem({
|
|
|
8965
8978
|
toast,
|
|
8966
8979
|
onRemove
|
|
8967
8980
|
}) {
|
|
8968
|
-
const [open, setOpen] = (0,
|
|
8981
|
+
const [open, setOpen] = (0, import_react10.useState)(true);
|
|
8969
8982
|
const handleOpenChange = (open2) => {
|
|
8970
8983
|
setOpen(open2);
|
|
8971
8984
|
if (!open2) {
|
|
@@ -8989,17 +9002,17 @@ function ToastItem({
|
|
|
8989
9002
|
}
|
|
8990
9003
|
|
|
8991
9004
|
// src/components/Toast/components/ToastProvider.tsx
|
|
8992
|
-
var
|
|
9005
|
+
var import_react11 = require("react");
|
|
8993
9006
|
var ToastPrimitive2 = __toESM(require("@radix-ui/react-toast"));
|
|
8994
9007
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
8995
|
-
var ToastContext = (0,
|
|
9008
|
+
var ToastContext = (0, import_react11.createContext)(null);
|
|
8996
9009
|
function ToastProvider({
|
|
8997
9010
|
children,
|
|
8998
9011
|
defaultDuration = 5e3,
|
|
8999
9012
|
maxToasts = 5,
|
|
9000
9013
|
swipeDirection = "right"
|
|
9001
9014
|
}) {
|
|
9002
|
-
const [toasts, setToasts] = (0,
|
|
9015
|
+
const [toasts, setToasts] = (0, import_react11.useState)([]);
|
|
9003
9016
|
const addToast = (toastData) => {
|
|
9004
9017
|
const id = Math.random().toString(36).substr(2, 9);
|
|
9005
9018
|
const newToast = __spreadProps(__spreadValues({
|
|
@@ -9035,9 +9048,9 @@ function ToastProvider({
|
|
|
9035
9048
|
}
|
|
9036
9049
|
|
|
9037
9050
|
// src/components/Toast/hooks/useToast.ts
|
|
9038
|
-
var
|
|
9051
|
+
var import_react12 = require("react");
|
|
9039
9052
|
var useToast = () => {
|
|
9040
|
-
const context = (0,
|
|
9053
|
+
const context = (0, import_react12.useContext)(ToastContext);
|
|
9041
9054
|
if (!context) {
|
|
9042
9055
|
throw new Error("useToast deve ser usado dentro de um ToastProvider");
|
|
9043
9056
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2386,6 +2386,7 @@ function Avatar(_a) {
|
|
|
2386
2386
|
}
|
|
2387
2387
|
|
|
2388
2388
|
// src/components/TextField.tsx
|
|
2389
|
+
import React from "react";
|
|
2389
2390
|
import { TextField as TextFieldRadix } from "@radix-ui/themes";
|
|
2390
2391
|
|
|
2391
2392
|
// src/components/Flex.tsx
|
|
@@ -2513,6 +2514,7 @@ var TextFieldStyled = styled(TextFieldRadix.Root, {
|
|
|
2513
2514
|
alignItems: "center",
|
|
2514
2515
|
padding: "0 $14",
|
|
2515
2516
|
gap: "$14",
|
|
2517
|
+
backgroundColor: "$dark50",
|
|
2516
2518
|
input: {
|
|
2517
2519
|
order: 1,
|
|
2518
2520
|
outline: "none",
|
|
@@ -2660,71 +2662,73 @@ var InputAddon = styled(TextStyle, {
|
|
|
2660
2662
|
});
|
|
2661
2663
|
var maskFormat = format;
|
|
2662
2664
|
var maskUnformat = unformat;
|
|
2663
|
-
var TextField = (
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
}
|
|
2707
|
-
}, props), {
|
|
2708
|
-
style: addon ? { borderTopLeftRadius: "0px", borderBottomLeftRadius: "0px" } : void 0,
|
|
2709
|
-
children: [
|
|
2710
|
-
children,
|
|
2711
|
-
isValid2 && /* @__PURE__ */ jsx7(
|
|
2712
|
-
TextFieldSlot,
|
|
2713
|
-
{
|
|
2714
|
-
position: "flex-end",
|
|
2715
|
-
name,
|
|
2716
|
-
color,
|
|
2717
|
-
typography,
|
|
2718
|
-
fontWeight,
|
|
2719
|
-
textAlign,
|
|
2720
|
-
children: /* @__PURE__ */ jsx7(Icon_default, { name: "check" })
|
|
2665
|
+
var TextField = React.forwardRef(
|
|
2666
|
+
(_a, fowardedRef) => {
|
|
2667
|
+
var _b = _a, {
|
|
2668
|
+
children,
|
|
2669
|
+
isValid: isValid2,
|
|
2670
|
+
name,
|
|
2671
|
+
color,
|
|
2672
|
+
typography,
|
|
2673
|
+
fontWeight,
|
|
2674
|
+
addon,
|
|
2675
|
+
textAlign = "left",
|
|
2676
|
+
mask
|
|
2677
|
+
} = _b, props = __objRest(_b, [
|
|
2678
|
+
"children",
|
|
2679
|
+
"isValid",
|
|
2680
|
+
"name",
|
|
2681
|
+
"color",
|
|
2682
|
+
"typography",
|
|
2683
|
+
"fontWeight",
|
|
2684
|
+
"addon",
|
|
2685
|
+
"textAlign",
|
|
2686
|
+
"mask"
|
|
2687
|
+
]);
|
|
2688
|
+
const maskRef = mask ? useMask(mask) : void 0;
|
|
2689
|
+
return /* @__PURE__ */ jsxs(Flex2, { gap: "0", css: { width: "100%" }, children: [
|
|
2690
|
+
!!addon && /* @__PURE__ */ jsx7(InputAddon, { typography: "labelSmall", children: addon }),
|
|
2691
|
+
/* @__PURE__ */ jsxs(
|
|
2692
|
+
TextFieldStyled,
|
|
2693
|
+
__spreadProps(__spreadValues({
|
|
2694
|
+
color,
|
|
2695
|
+
isValid: isValid2,
|
|
2696
|
+
name,
|
|
2697
|
+
typography,
|
|
2698
|
+
fontWeight,
|
|
2699
|
+
textAlign,
|
|
2700
|
+
ref: (r) => {
|
|
2701
|
+
if (!r) return;
|
|
2702
|
+
if (maskRef) maskRef.current = r;
|
|
2703
|
+
if (fowardedRef) {
|
|
2704
|
+
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
2705
|
+
else {
|
|
2706
|
+
fowardedRef.current = r;
|
|
2707
|
+
}
|
|
2721
2708
|
}
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2709
|
+
}
|
|
2710
|
+
}, props), {
|
|
2711
|
+
style: addon ? { borderTopLeftRadius: "0px", borderBottomLeftRadius: "0px" } : void 0,
|
|
2712
|
+
children: [
|
|
2713
|
+
children,
|
|
2714
|
+
isValid2 && /* @__PURE__ */ jsx7(
|
|
2715
|
+
TextFieldSlot,
|
|
2716
|
+
{
|
|
2717
|
+
position: "flex-end",
|
|
2718
|
+
name,
|
|
2719
|
+
color,
|
|
2720
|
+
typography,
|
|
2721
|
+
fontWeight,
|
|
2722
|
+
textAlign,
|
|
2723
|
+
children: /* @__PURE__ */ jsx7(Icon_default, { name: "check" })
|
|
2724
|
+
}
|
|
2725
|
+
)
|
|
2726
|
+
]
|
|
2727
|
+
})
|
|
2728
|
+
)
|
|
2729
|
+
] });
|
|
2730
|
+
}
|
|
2731
|
+
);
|
|
2728
2732
|
function TextFieldSlot(_a) {
|
|
2729
2733
|
var _b = _a, {
|
|
2730
2734
|
children,
|
|
@@ -3432,7 +3436,7 @@ function DropdownMenuItem(_a) {
|
|
|
3432
3436
|
}
|
|
3433
3437
|
|
|
3434
3438
|
// src/components/Badge.tsx
|
|
3435
|
-
import
|
|
3439
|
+
import React2 from "react";
|
|
3436
3440
|
import { Badge as BadgeRadix } from "@radix-ui/themes";
|
|
3437
3441
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
3438
3442
|
var BadgeStyled = styled(BadgeRadix, {
|
|
@@ -3539,9 +3543,9 @@ var BadgeStyled = styled(BadgeRadix, {
|
|
|
3539
3543
|
});
|
|
3540
3544
|
function Badge(_a) {
|
|
3541
3545
|
var _b = _a, { asChild, children } = _b, props = __objRest(_b, ["asChild", "children"]);
|
|
3542
|
-
return /* @__PURE__ */ jsx12(BadgeStyled, __spreadProps(__spreadValues({}, props), { children:
|
|
3543
|
-
if (
|
|
3544
|
-
return
|
|
3546
|
+
return /* @__PURE__ */ jsx12(BadgeStyled, __spreadProps(__spreadValues({}, props), { children: React2.Children.map(children, (child) => {
|
|
3547
|
+
if (React2.isValidElement(child)) {
|
|
3548
|
+
return React2.cloneElement(child, { size: props.size });
|
|
3545
3549
|
}
|
|
3546
3550
|
return child;
|
|
3547
3551
|
}) }));
|
|
@@ -8490,7 +8494,7 @@ function Switch(props) {
|
|
|
8490
8494
|
}
|
|
8491
8495
|
|
|
8492
8496
|
// src/components/Step.tsx
|
|
8493
|
-
import
|
|
8497
|
+
import React5 from "react";
|
|
8494
8498
|
import { Box as Box2, Tabs as StepRadix } from "@radix-ui/themes";
|
|
8495
8499
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
8496
8500
|
var StepStyled = styled("div", {
|
|
@@ -8606,9 +8610,9 @@ function StepList(_a) {
|
|
|
8606
8610
|
"children",
|
|
8607
8611
|
"currentStep"
|
|
8608
8612
|
]);
|
|
8609
|
-
return /* @__PURE__ */ jsx18(StepListStyled, __spreadProps(__spreadValues({}, props), { children:
|
|
8610
|
-
if (
|
|
8611
|
-
return
|
|
8613
|
+
return /* @__PURE__ */ jsx18(StepListStyled, __spreadProps(__spreadValues({}, props), { children: React5.Children.map(children, (child) => {
|
|
8614
|
+
if (React5.isValidElement(child) && child.type === StepTrigger) {
|
|
8615
|
+
return React5.cloneElement(child, { currentStep });
|
|
8612
8616
|
}
|
|
8613
8617
|
return child;
|
|
8614
8618
|
}) }));
|
|
@@ -8665,37 +8669,35 @@ function Card(_a) {
|
|
|
8665
8669
|
|
|
8666
8670
|
// src/components/TextareaField.tsx
|
|
8667
8671
|
import { TextArea as TextAreaRadix } from "@radix-ui/themes";
|
|
8668
|
-
import { useRef as useRef3 } from "react";
|
|
8672
|
+
import React6, { useRef as useRef3 } from "react";
|
|
8669
8673
|
import { jsx as jsx20, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
8670
8674
|
var TextareaFieldStyle = styled(TextAreaRadix, {
|
|
8671
8675
|
display: "flex",
|
|
8672
|
-
width: "fit-content",
|
|
8673
8676
|
flex: 1,
|
|
8674
8677
|
textarea: {
|
|
8675
8678
|
width: "100%",
|
|
8676
|
-
minHeight: "3.75rem",
|
|
8677
8679
|
border: "none",
|
|
8678
8680
|
padding: "$12 $14",
|
|
8679
8681
|
fontFamily: "$default",
|
|
8680
|
-
fontSize: "$16",
|
|
8681
8682
|
outline: "none",
|
|
8682
|
-
resize: "vertical"
|
|
8683
|
+
resize: "vertical",
|
|
8684
|
+
height: "auto"
|
|
8683
8685
|
},
|
|
8684
8686
|
variants: {
|
|
8685
8687
|
typography: typographyValues
|
|
8686
8688
|
},
|
|
8687
8689
|
defaultVariants: {
|
|
8688
|
-
typography: "
|
|
8690
|
+
typography: "labelSmall"
|
|
8689
8691
|
}
|
|
8690
8692
|
});
|
|
8691
8693
|
var TextareaContainer = styled("div", {
|
|
8692
|
-
position: "relative",
|
|
8693
8694
|
display: "flex",
|
|
8695
|
+
flexDirection: "column",
|
|
8694
8696
|
overflow: "hidden",
|
|
8695
|
-
|
|
8697
|
+
width: "100%",
|
|
8696
8698
|
border: "1px solid",
|
|
8697
8699
|
borderColor: "$dark300",
|
|
8698
|
-
borderRadius: "$
|
|
8700
|
+
borderRadius: "$sm",
|
|
8699
8701
|
"&:has(textarea:focus)": {
|
|
8700
8702
|
border: "1px solid $brand300"
|
|
8701
8703
|
},
|
|
@@ -8707,14 +8709,12 @@ var TextareaContainer = styled("div", {
|
|
|
8707
8709
|
}
|
|
8708
8710
|
});
|
|
8709
8711
|
var TextareaLimitIndicator = styled("div", {
|
|
8710
|
-
position: "absolute",
|
|
8711
|
-
bottom: 0,
|
|
8712
|
-
left: 0,
|
|
8713
8712
|
padding: "$12 $16",
|
|
8714
8713
|
borderTop: "1px solid $neutral300",
|
|
8715
8714
|
width: "100%",
|
|
8716
8715
|
flex: 1,
|
|
8717
8716
|
display: "flex",
|
|
8717
|
+
backgroundColor: "$dark50",
|
|
8718
8718
|
span: {
|
|
8719
8719
|
backgroundColor: "$neutral200",
|
|
8720
8720
|
color: "$neutral700",
|
|
@@ -8722,30 +8722,43 @@ var TextareaLimitIndicator = styled("div", {
|
|
|
8722
8722
|
padding: "$4"
|
|
8723
8723
|
}
|
|
8724
8724
|
});
|
|
8725
|
-
|
|
8725
|
+
var TextareaField = React6.forwardRef((_a, fowardedRef) => {
|
|
8726
8726
|
var _b = _a, { maxLength } = _b, props = __objRest(_b, ["maxLength"]);
|
|
8727
8727
|
const inputRef = useRef3(null);
|
|
8728
8728
|
const badgeRef = useRef3(null);
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8729
|
+
const updateCharCountBadge = () => {
|
|
8730
|
+
var _a2, _b2;
|
|
8731
|
+
if (!maxLength || !badgeRef.current) return;
|
|
8732
|
+
const remainingChars = maxLength - ((_b2 = (_a2 = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a2.value.length) != null ? _b2 : 0);
|
|
8733
|
+
badgeRef.current.textContent = String(remainingChars);
|
|
8734
|
+
};
|
|
8735
|
+
const handleInput = (e) => {
|
|
8733
8736
|
var _a2;
|
|
8734
|
-
|
|
8735
|
-
|
|
8737
|
+
updateCharCountBadge();
|
|
8738
|
+
(_a2 = props.onInput) == null ? void 0 : _a2.call(props, e);
|
|
8736
8739
|
};
|
|
8737
|
-
return /* @__PURE__ */ jsxs8(TextareaContainer, {
|
|
8740
|
+
return /* @__PURE__ */ jsxs8(TextareaContainer, { children: [
|
|
8738
8741
|
/* @__PURE__ */ jsx20(
|
|
8739
8742
|
TextareaFieldStyle,
|
|
8740
8743
|
__spreadValues({
|
|
8741
|
-
|
|
8744
|
+
rows: 3,
|
|
8745
|
+
ref: (r) => {
|
|
8746
|
+
if (!r) return;
|
|
8747
|
+
inputRef.current = r;
|
|
8748
|
+
if (fowardedRef) {
|
|
8749
|
+
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
8750
|
+
else {
|
|
8751
|
+
fowardedRef.current = r;
|
|
8752
|
+
}
|
|
8753
|
+
}
|
|
8754
|
+
},
|
|
8742
8755
|
onInput: handleInput,
|
|
8743
8756
|
maxLength
|
|
8744
8757
|
}, props)
|
|
8745
8758
|
),
|
|
8746
|
-
/* @__PURE__ */ jsx20(TextareaLimitIndicator, { children: /* @__PURE__ */ jsx20(Text, { typography: "badgeMedium", ref: badgeRef, children: maxLength }) })
|
|
8759
|
+
maxLength && /* @__PURE__ */ jsx20(TextareaLimitIndicator, { children: /* @__PURE__ */ jsx20(Text, { typography: "badgeMedium", ref: badgeRef, children: maxLength }) })
|
|
8747
8760
|
] });
|
|
8748
|
-
}
|
|
8761
|
+
});
|
|
8749
8762
|
|
|
8750
8763
|
// src/components/Toast/components/ToastItem.tsx
|
|
8751
8764
|
import { useState as useState3 } from "react";
|
package/package.json
CHANGED
|
@@ -20,6 +20,7 @@ export const TextFieldStyled = styled(TextFieldRadix.Root, {
|
|
|
20
20
|
alignItems: "center",
|
|
21
21
|
padding: "0 $14",
|
|
22
22
|
gap: "$14",
|
|
23
|
+
backgroundColor: '$dark50',
|
|
23
24
|
input: {
|
|
24
25
|
order: 1,
|
|
25
26
|
outline: "none",
|
|
@@ -202,64 +203,71 @@ const InputAddon = styled(TextStyle, {
|
|
|
202
203
|
export const maskFormat = format;
|
|
203
204
|
export const maskUnformat = unformat;
|
|
204
205
|
|
|
205
|
-
export const TextField = (
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
206
|
+
export const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
|
|
207
|
+
(
|
|
208
|
+
{
|
|
209
|
+
children,
|
|
210
|
+
isValid,
|
|
211
|
+
name,
|
|
212
|
+
color,
|
|
213
|
+
typography,
|
|
214
|
+
fontWeight,
|
|
215
|
+
addon,
|
|
216
|
+
textAlign = "left",
|
|
217
|
+
mask,
|
|
218
|
+
...props
|
|
219
|
+
},
|
|
220
|
+
fowardedRef
|
|
221
|
+
) => {
|
|
222
|
+
const maskRef = mask ? useMask(mask) : undefined;
|
|
219
223
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
224
|
+
return (
|
|
225
|
+
<Flex gap={"0"} css={{ width: "100%" }}>
|
|
226
|
+
{!!addon && <InputAddon typography="labelSmall">{addon}</InputAddon>}
|
|
223
227
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
if (
|
|
236
|
-
|
|
228
|
+
<TextFieldStyled
|
|
229
|
+
color={color}
|
|
230
|
+
isValid={isValid}
|
|
231
|
+
name={name}
|
|
232
|
+
typography={typography}
|
|
233
|
+
fontWeight={fontWeight}
|
|
234
|
+
textAlign={textAlign}
|
|
235
|
+
ref={(r) => {
|
|
236
|
+
if (!r) return;
|
|
237
|
+
if (maskRef) maskRef.current = r;
|
|
238
|
+
|
|
239
|
+
if (fowardedRef) {
|
|
240
|
+
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
241
|
+
else {
|
|
242
|
+
fowardedRef.current = r;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}}
|
|
246
|
+
{...props}
|
|
247
|
+
style={
|
|
248
|
+
addon
|
|
249
|
+
? { borderTopLeftRadius: "0px", borderBottomLeftRadius: "0px" }
|
|
250
|
+
: undefined
|
|
237
251
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
</TextFieldSlot>
|
|
258
|
-
)}
|
|
259
|
-
</TextFieldStyled>
|
|
260
|
-
</Flex>
|
|
261
|
-
);
|
|
262
|
-
};
|
|
252
|
+
>
|
|
253
|
+
{children}
|
|
254
|
+
{isValid && (
|
|
255
|
+
<TextFieldSlot
|
|
256
|
+
position="flex-end"
|
|
257
|
+
name={name}
|
|
258
|
+
color={color as TextFieldSlotProps["color"]}
|
|
259
|
+
typography={typography}
|
|
260
|
+
fontWeight={fontWeight}
|
|
261
|
+
textAlign={textAlign}
|
|
262
|
+
>
|
|
263
|
+
<Icon name="check" />
|
|
264
|
+
</TextFieldSlot>
|
|
265
|
+
)}
|
|
266
|
+
</TextFieldStyled>
|
|
267
|
+
</Flex>
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
);
|
|
263
271
|
|
|
264
272
|
export function TextFieldSlot({
|
|
265
273
|
children,
|
|
@@ -1,101 +1,112 @@
|
|
|
1
|
-
import { TextArea as TextAreaRadix } from
|
|
2
|
-
import { styled } from
|
|
3
|
-
import { ComponentProps, useRef } from
|
|
4
|
-
|
|
5
|
-
import {
|
|
1
|
+
import { TextArea as TextAreaRadix, Flex, Box } from "@radix-ui/themes";
|
|
2
|
+
import { styled } from "../styles";
|
|
3
|
+
import React, { ComponentProps, useRef } from "react";
|
|
4
|
+
|
|
5
|
+
import { typographyValues } from "../types/typographyValues";
|
|
6
|
+
import { Text } from "./Text";
|
|
6
7
|
|
|
7
8
|
export const TextareaFieldStyle = styled(TextAreaRadix, {
|
|
8
|
-
display:
|
|
9
|
-
width: 'fit-content',
|
|
9
|
+
display: "flex",
|
|
10
10
|
flex: 1,
|
|
11
11
|
textarea: {
|
|
12
|
-
width:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
resize: 'vertical',
|
|
12
|
+
width: "100%",
|
|
13
|
+
border: "none",
|
|
14
|
+
padding: "$12 $14",
|
|
15
|
+
fontFamily: "$default",
|
|
16
|
+
outline: "none",
|
|
17
|
+
resize: "vertical",
|
|
18
|
+
height: "auto",
|
|
20
19
|
},
|
|
21
20
|
variants: {
|
|
22
21
|
typography: typographyValues,
|
|
23
22
|
},
|
|
24
23
|
defaultVariants: {
|
|
25
|
-
typography:
|
|
24
|
+
typography: "labelSmall",
|
|
26
25
|
},
|
|
27
|
-
})
|
|
26
|
+
});
|
|
28
27
|
|
|
29
28
|
export type TextareaFieldProps = ComponentProps<typeof TextareaFieldStyle> & {
|
|
30
|
-
limit: number
|
|
31
|
-
}
|
|
29
|
+
limit: number;
|
|
30
|
+
};
|
|
32
31
|
|
|
33
|
-
const TextareaContainer = styled(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
overflow:
|
|
37
|
-
|
|
38
|
-
border:
|
|
39
|
-
borderColor:
|
|
40
|
-
borderRadius:
|
|
32
|
+
const TextareaContainer = styled("div", {
|
|
33
|
+
display: "flex",
|
|
34
|
+
flexDirection: "column",
|
|
35
|
+
overflow: "hidden",
|
|
36
|
+
width: "100%",
|
|
37
|
+
border: "1px solid",
|
|
38
|
+
borderColor: "$dark300",
|
|
39
|
+
borderRadius: "$sm",
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
border:
|
|
41
|
+
"&:has(textarea:focus)": {
|
|
42
|
+
border: "1px solid $brand300",
|
|
44
43
|
},
|
|
45
|
-
|
|
46
|
-
backgroundColor:
|
|
47
|
-
color:
|
|
48
|
-
border:
|
|
49
|
-
cursor:
|
|
44
|
+
"&:has(textarea:disabled)": {
|
|
45
|
+
backgroundColor: "$dark100",
|
|
46
|
+
color: "$dark400",
|
|
47
|
+
border: "1px solid $dark200",
|
|
48
|
+
cursor: "not-allowed",
|
|
50
49
|
},
|
|
51
|
-
})
|
|
50
|
+
});
|
|
52
51
|
|
|
53
|
-
const TextareaLimitIndicator = styled(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
padding: '$12 $16',
|
|
58
|
-
borderTop: '1px solid $neutral300',
|
|
59
|
-
width: '100%',
|
|
52
|
+
const TextareaLimitIndicator = styled("div", {
|
|
53
|
+
padding: "$12 $16",
|
|
54
|
+
borderTop: "1px solid $neutral300",
|
|
55
|
+
width: "100%",
|
|
60
56
|
flex: 1,
|
|
61
|
-
display:
|
|
57
|
+
display: "flex",
|
|
58
|
+
backgroundColor: "$dark50",
|
|
62
59
|
span: {
|
|
63
|
-
backgroundColor:
|
|
64
|
-
color:
|
|
65
|
-
borderRadius:
|
|
66
|
-
padding:
|
|
60
|
+
backgroundColor: "$neutral200",
|
|
61
|
+
color: "$neutral700",
|
|
62
|
+
borderRadius: "$2xs",
|
|
63
|
+
padding: "$4",
|
|
67
64
|
},
|
|
68
|
-
})
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export const TextareaField = React.forwardRef<
|
|
68
|
+
HTMLTextAreaElement,
|
|
69
|
+
TextareaFieldProps
|
|
70
|
+
>(({ maxLength, ...props }, fowardedRef) => {
|
|
71
|
+
const inputRef = useRef<HTMLTextAreaElement>(null);
|
|
72
|
+
const badgeRef = useRef<HTMLSpanElement>(null);
|
|
69
73
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
const updateCharCountBadge = () => {
|
|
75
|
+
if (!maxLength || !badgeRef.current) return;
|
|
76
|
+
const remainingChars = maxLength - (inputRef?.current?.value.length ?? 0);
|
|
77
|
+
badgeRef.current.textContent = String(remainingChars);
|
|
78
|
+
};
|
|
73
79
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
</TextareaContainer>
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
const handleInput = () => {
|
|
82
|
-
const remainingChars = maxLength - (inputRef?.current?.value.length || 0)
|
|
83
|
-
if (badgeRef.current) badgeRef.current.textContent = String(remainingChars)
|
|
84
|
-
}
|
|
80
|
+
const handleInput = (e: React.FormEvent<HTMLTextAreaElement>) => {
|
|
81
|
+
updateCharCountBadge();
|
|
82
|
+
props.onInput?.(e);
|
|
83
|
+
};
|
|
85
84
|
|
|
86
85
|
return (
|
|
87
|
-
<TextareaContainer
|
|
86
|
+
<TextareaContainer>
|
|
88
87
|
<TextareaFieldStyle
|
|
89
|
-
|
|
88
|
+
rows={3}
|
|
89
|
+
ref={(r) => {
|
|
90
|
+
if (!r) return;
|
|
91
|
+
inputRef.current = r;
|
|
92
|
+
if (fowardedRef) {
|
|
93
|
+
if (typeof fowardedRef === "function") fowardedRef(r);
|
|
94
|
+
else {
|
|
95
|
+
fowardedRef.current = r;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}}
|
|
90
99
|
onInput={handleInput}
|
|
91
100
|
maxLength={maxLength}
|
|
92
101
|
{...props}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<
|
|
96
|
-
{
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
/>
|
|
103
|
+
{maxLength && (
|
|
104
|
+
<TextareaLimitIndicator>
|
|
105
|
+
<Text typography={"badgeMedium"} ref={badgeRef}>
|
|
106
|
+
{maxLength}
|
|
107
|
+
</Text>
|
|
108
|
+
</TextareaLimitIndicator>
|
|
109
|
+
)}
|
|
99
110
|
</TextareaContainer>
|
|
100
|
-
)
|
|
101
|
-
}
|
|
111
|
+
);
|
|
112
|
+
});
|