analytica-frontend-lib 1.0.31 → 1.0.32
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/TextArea/index.d.mts +4 -3
- package/dist/TextArea/index.d.ts +4 -3
- package/dist/TextArea/index.js.map +1 -1
- package/dist/TextArea/index.mjs.map +1 -1
- package/dist/index.css +72 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +96 -3
- package/dist/index.d.ts +96 -3
- package/dist/index.js +327 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +323 -63
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +72 -0
- package/dist/styles.css.map +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(src_exports, {
|
|
|
24
24
|
Badge: () => Badge_default,
|
|
25
25
|
Button: () => Button_default,
|
|
26
26
|
CheckBox: () => CheckBox_default,
|
|
27
|
+
Chips: () => Chips_default,
|
|
27
28
|
Divider: () => Divider_default,
|
|
28
29
|
DropdownMenu: () => DropdownMenu_default,
|
|
29
30
|
DropdownMenuContent: () => MenuContent,
|
|
@@ -35,6 +36,7 @@ __export(src_exports, {
|
|
|
35
36
|
IconRoundedButton: () => IconRoundedButton_default,
|
|
36
37
|
Input: () => Input_default,
|
|
37
38
|
NavButton: () => NavButton_default,
|
|
39
|
+
Radio: () => Radio_default,
|
|
38
40
|
SelectionButton: () => SelectionButton_default,
|
|
39
41
|
Table: () => Table_default,
|
|
40
42
|
Text: () => Text_default,
|
|
@@ -809,10 +811,231 @@ var CheckBox = (0, import_react5.forwardRef)(
|
|
|
809
811
|
CheckBox.displayName = "CheckBox";
|
|
810
812
|
var CheckBox_default = CheckBox;
|
|
811
813
|
|
|
812
|
-
// src/components/
|
|
814
|
+
// src/components/Radio/Radio.tsx
|
|
813
815
|
var import_react6 = require("react");
|
|
814
816
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
815
817
|
var SIZE_CLASSES4 = {
|
|
818
|
+
small: {
|
|
819
|
+
radio: "w-5 h-5",
|
|
820
|
+
// 20px x 20px
|
|
821
|
+
textSize: "sm",
|
|
822
|
+
spacing: "gap-1.5",
|
|
823
|
+
// 6px
|
|
824
|
+
borderWidth: "border-2",
|
|
825
|
+
dotSize: "w-1.5 h-1.5",
|
|
826
|
+
// 6px inner dot
|
|
827
|
+
labelHeight: "h-5"
|
|
828
|
+
},
|
|
829
|
+
medium: {
|
|
830
|
+
radio: "w-6 h-6",
|
|
831
|
+
// 24px x 24px
|
|
832
|
+
textSize: "md",
|
|
833
|
+
spacing: "gap-2",
|
|
834
|
+
// 8px
|
|
835
|
+
borderWidth: "border-2",
|
|
836
|
+
dotSize: "w-2 h-2",
|
|
837
|
+
// 8px inner dot
|
|
838
|
+
labelHeight: "h-6"
|
|
839
|
+
},
|
|
840
|
+
large: {
|
|
841
|
+
radio: "w-7 h-7",
|
|
842
|
+
// 28px x 28px
|
|
843
|
+
textSize: "lg",
|
|
844
|
+
spacing: "gap-2",
|
|
845
|
+
// 8px
|
|
846
|
+
borderWidth: "border-2",
|
|
847
|
+
// 2px border (consistent with others)
|
|
848
|
+
dotSize: "w-2.5 h-2.5",
|
|
849
|
+
// 10px inner dot
|
|
850
|
+
labelHeight: "h-7"
|
|
851
|
+
},
|
|
852
|
+
extraLarge: {
|
|
853
|
+
radio: "w-8 h-8",
|
|
854
|
+
// 32px x 32px (larger than large)
|
|
855
|
+
textSize: "xl",
|
|
856
|
+
spacing: "gap-3",
|
|
857
|
+
// 12px
|
|
858
|
+
borderWidth: "border-2",
|
|
859
|
+
// 2px border (consistent with others)
|
|
860
|
+
dotSize: "w-3 h-3",
|
|
861
|
+
// 12px inner dot
|
|
862
|
+
labelHeight: "h-8"
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
var BASE_RADIO_CLASSES = "rounded-full border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
|
|
866
|
+
var STATE_CLASSES2 = {
|
|
867
|
+
default: {
|
|
868
|
+
unchecked: "border-border-400 bg-background hover:border-border-500",
|
|
869
|
+
checked: "border-primary-950 bg-background hover:border-primary-800"
|
|
870
|
+
},
|
|
871
|
+
hovered: {
|
|
872
|
+
unchecked: "border-border-500 bg-background",
|
|
873
|
+
// #8C8D8D hover state for unchecked
|
|
874
|
+
checked: "border-info-700 bg-background"
|
|
875
|
+
// Adjust checked border for hover
|
|
876
|
+
},
|
|
877
|
+
focused: {
|
|
878
|
+
unchecked: "border-border-400 bg-background",
|
|
879
|
+
// #A5A3A3 for unchecked radio
|
|
880
|
+
checked: "border-primary-950 bg-background"
|
|
881
|
+
// #124393 for checked radio
|
|
882
|
+
},
|
|
883
|
+
invalid: {
|
|
884
|
+
unchecked: "border-border-400 bg-background",
|
|
885
|
+
// #A5A3A3 for unchecked radio
|
|
886
|
+
checked: "border-primary-950 bg-background"
|
|
887
|
+
// #124393 for checked radio
|
|
888
|
+
},
|
|
889
|
+
disabled: {
|
|
890
|
+
unchecked: "border-border-400 bg-background cursor-not-allowed",
|
|
891
|
+
// #A5A3A3 for unchecked radio
|
|
892
|
+
checked: "border-primary-950 bg-background cursor-not-allowed"
|
|
893
|
+
// #124393 for checked radio
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
var DOT_CLASSES = {
|
|
897
|
+
default: "bg-primary-950",
|
|
898
|
+
hovered: "bg-info-700",
|
|
899
|
+
// #1C61B2 hover state for checked dot
|
|
900
|
+
focused: "bg-primary-950",
|
|
901
|
+
// #124393 for focused checked dot
|
|
902
|
+
invalid: "bg-primary-950",
|
|
903
|
+
// #124393 for invalid checked dot
|
|
904
|
+
disabled: "bg-primary-950"
|
|
905
|
+
// #124393 for disabled checked dot
|
|
906
|
+
};
|
|
907
|
+
var Radio = (0, import_react6.forwardRef)(
|
|
908
|
+
({
|
|
909
|
+
label,
|
|
910
|
+
size = "medium",
|
|
911
|
+
state = "default",
|
|
912
|
+
errorMessage,
|
|
913
|
+
helperText,
|
|
914
|
+
className = "",
|
|
915
|
+
labelClassName = "",
|
|
916
|
+
checked: checkedProp,
|
|
917
|
+
defaultChecked = false,
|
|
918
|
+
disabled,
|
|
919
|
+
id,
|
|
920
|
+
name,
|
|
921
|
+
value,
|
|
922
|
+
onChange,
|
|
923
|
+
...props
|
|
924
|
+
}, ref) => {
|
|
925
|
+
const generatedId = (0, import_react6.useId)();
|
|
926
|
+
const inputId = id ?? `radio-${generatedId}`;
|
|
927
|
+
const [internalChecked, setInternalChecked] = (0, import_react6.useState)(defaultChecked);
|
|
928
|
+
const isControlled = checkedProp !== void 0;
|
|
929
|
+
const checked = isControlled ? checkedProp : internalChecked;
|
|
930
|
+
const handleChange = (event) => {
|
|
931
|
+
const newChecked = event.target.checked;
|
|
932
|
+
if (!isControlled) {
|
|
933
|
+
setInternalChecked(newChecked);
|
|
934
|
+
}
|
|
935
|
+
onChange?.(event);
|
|
936
|
+
};
|
|
937
|
+
const currentState = disabled ? "disabled" : state;
|
|
938
|
+
const sizeClasses = SIZE_CLASSES4[size];
|
|
939
|
+
const actualRadioSize = sizeClasses.radio;
|
|
940
|
+
const actualDotSize = sizeClasses.dotSize;
|
|
941
|
+
const radioVariant = checked ? "checked" : "unchecked";
|
|
942
|
+
const stylingClasses = STATE_CLASSES2[currentState][radioVariant];
|
|
943
|
+
const getBorderWidth = () => {
|
|
944
|
+
if (currentState === "focused") {
|
|
945
|
+
return "border-2";
|
|
946
|
+
}
|
|
947
|
+
return sizeClasses.borderWidth;
|
|
948
|
+
};
|
|
949
|
+
const borderWidthClass = getBorderWidth();
|
|
950
|
+
const radioClasses = `${BASE_RADIO_CLASSES} ${actualRadioSize} ${borderWidthClass} ${stylingClasses} ${className}`;
|
|
951
|
+
const dotClasses = `${actualDotSize} rounded-full ${DOT_CLASSES[currentState]} transition-all duration-200`;
|
|
952
|
+
const isWrapperNeeded = currentState === "focused" || currentState === "invalid";
|
|
953
|
+
const wrapperBorderColor = currentState === "focused" ? "border-indicator-info" : "border-indicator-error";
|
|
954
|
+
const getTextColor = () => {
|
|
955
|
+
if (currentState === "disabled") {
|
|
956
|
+
return checked ? "text-text-900" : "text-text-600";
|
|
957
|
+
}
|
|
958
|
+
if (currentState === "focused") {
|
|
959
|
+
return "text-text-900";
|
|
960
|
+
}
|
|
961
|
+
return checked ? "text-text-900" : "text-text-600";
|
|
962
|
+
};
|
|
963
|
+
const getCursorClass = () => {
|
|
964
|
+
return currentState === "disabled" ? "cursor-not-allowed" : "cursor-pointer";
|
|
965
|
+
};
|
|
966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col", children: [
|
|
967
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
968
|
+
"div",
|
|
969
|
+
{
|
|
970
|
+
className: `flex flex-row items-center ${isWrapperNeeded ? `p-1 border-2 ${wrapperBorderColor} rounded-lg gap-1.5` : sizeClasses.spacing} ${disabled ? "opacity-40" : ""}`,
|
|
971
|
+
children: [
|
|
972
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
973
|
+
"input",
|
|
974
|
+
{
|
|
975
|
+
ref,
|
|
976
|
+
type: "radio",
|
|
977
|
+
id: inputId,
|
|
978
|
+
checked,
|
|
979
|
+
disabled,
|
|
980
|
+
name,
|
|
981
|
+
value,
|
|
982
|
+
onChange: handleChange,
|
|
983
|
+
className: "sr-only",
|
|
984
|
+
...props
|
|
985
|
+
}
|
|
986
|
+
),
|
|
987
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: inputId, className: radioClasses, children: checked && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: dotClasses }) }),
|
|
988
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
989
|
+
"div",
|
|
990
|
+
{
|
|
991
|
+
className: `flex flex-row items-center ${sizeClasses.labelHeight}`,
|
|
992
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
993
|
+
Text_default,
|
|
994
|
+
{
|
|
995
|
+
as: "label",
|
|
996
|
+
htmlFor: inputId,
|
|
997
|
+
size: sizeClasses.textSize,
|
|
998
|
+
weight: "normal",
|
|
999
|
+
className: `${getCursorClass()} select-none leading-normal flex items-center font-roboto ${labelClassName}`,
|
|
1000
|
+
color: getTextColor(),
|
|
1001
|
+
children: label
|
|
1002
|
+
}
|
|
1003
|
+
)
|
|
1004
|
+
}
|
|
1005
|
+
)
|
|
1006
|
+
]
|
|
1007
|
+
}
|
|
1008
|
+
),
|
|
1009
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1010
|
+
Text_default,
|
|
1011
|
+
{
|
|
1012
|
+
size: "sm",
|
|
1013
|
+
weight: "normal",
|
|
1014
|
+
className: "mt-1.5",
|
|
1015
|
+
color: "text-error-600",
|
|
1016
|
+
children: errorMessage
|
|
1017
|
+
}
|
|
1018
|
+
),
|
|
1019
|
+
helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1020
|
+
Text_default,
|
|
1021
|
+
{
|
|
1022
|
+
size: "sm",
|
|
1023
|
+
weight: "normal",
|
|
1024
|
+
className: "mt-1.5",
|
|
1025
|
+
color: "text-text-500",
|
|
1026
|
+
children: helperText
|
|
1027
|
+
}
|
|
1028
|
+
)
|
|
1029
|
+
] });
|
|
1030
|
+
}
|
|
1031
|
+
);
|
|
1032
|
+
Radio.displayName = "Radio";
|
|
1033
|
+
var Radio_default = Radio;
|
|
1034
|
+
|
|
1035
|
+
// src/components/TextArea/TextArea.tsx
|
|
1036
|
+
var import_react7 = require("react");
|
|
1037
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1038
|
+
var SIZE_CLASSES5 = {
|
|
816
1039
|
small: {
|
|
817
1040
|
container: "w-72",
|
|
818
1041
|
// 288px width
|
|
@@ -843,7 +1066,7 @@ var SIZE_CLASSES4 = {
|
|
|
843
1066
|
}
|
|
844
1067
|
};
|
|
845
1068
|
var BASE_TEXTAREA_CLASSES = "w-full box-border p-3 bg-background border border-solid rounded-[4px] resize-none focus:outline-none font-roboto font-normal leading-[150%] placeholder:text-text-600 transition-all duration-200";
|
|
846
|
-
var
|
|
1069
|
+
var STATE_CLASSES3 = {
|
|
847
1070
|
default: {
|
|
848
1071
|
base: "border-border-300 bg-background text-text-600",
|
|
849
1072
|
hover: "hover:border-border-400",
|
|
@@ -870,7 +1093,7 @@ var STATE_CLASSES2 = {
|
|
|
870
1093
|
focus: ""
|
|
871
1094
|
}
|
|
872
1095
|
};
|
|
873
|
-
var TextArea = (0,
|
|
1096
|
+
var TextArea = (0, import_react7.forwardRef)(
|
|
874
1097
|
({
|
|
875
1098
|
label,
|
|
876
1099
|
size = "medium",
|
|
@@ -885,9 +1108,9 @@ var TextArea = (0, import_react6.forwardRef)(
|
|
|
885
1108
|
placeholder,
|
|
886
1109
|
...props
|
|
887
1110
|
}, ref) => {
|
|
888
|
-
const generatedId = (0,
|
|
1111
|
+
const generatedId = (0, import_react7.useId)();
|
|
889
1112
|
const inputId = id ?? `textarea-${generatedId}`;
|
|
890
|
-
const [isFocused, setIsFocused] = (0,
|
|
1113
|
+
const [isFocused, setIsFocused] = (0, import_react7.useState)(false);
|
|
891
1114
|
const handleChange = (event) => {
|
|
892
1115
|
onChange?.(event);
|
|
893
1116
|
};
|
|
@@ -903,11 +1126,11 @@ var TextArea = (0, import_react6.forwardRef)(
|
|
|
903
1126
|
if (isFocused && currentState !== "invalid" && currentState !== "disabled") {
|
|
904
1127
|
currentState = "focused";
|
|
905
1128
|
}
|
|
906
|
-
const sizeClasses =
|
|
907
|
-
const stateClasses =
|
|
1129
|
+
const sizeClasses = SIZE_CLASSES5[size];
|
|
1130
|
+
const stateClasses = STATE_CLASSES3[currentState];
|
|
908
1131
|
const textareaClasses = `${BASE_TEXTAREA_CLASSES} ${sizeClasses.textarea} ${stateClasses.base} ${stateClasses.hover} ${stateClasses.focus} ${className}`;
|
|
909
|
-
return /* @__PURE__ */ (0,
|
|
910
|
-
label && /* @__PURE__ */ (0,
|
|
1132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `flex flex-col ${sizeClasses.container}`, children: [
|
|
1133
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
911
1134
|
Text_default,
|
|
912
1135
|
{
|
|
913
1136
|
as: "label",
|
|
@@ -919,7 +1142,7 @@ var TextArea = (0, import_react6.forwardRef)(
|
|
|
919
1142
|
children: label
|
|
920
1143
|
}
|
|
921
1144
|
),
|
|
922
|
-
/* @__PURE__ */ (0,
|
|
1145
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
923
1146
|
"textarea",
|
|
924
1147
|
{
|
|
925
1148
|
ref,
|
|
@@ -933,8 +1156,8 @@ var TextArea = (0, import_react6.forwardRef)(
|
|
|
933
1156
|
...props
|
|
934
1157
|
}
|
|
935
1158
|
),
|
|
936
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
937
|
-
helperMessage && !errorMessage && /* @__PURE__ */ (0,
|
|
1159
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text_default, { size: "sm", weight: "normal", className: "mt-1.5 text-error-600", children: errorMessage }),
|
|
1160
|
+
helperMessage && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text_default, { size: "sm", weight: "normal", className: "mt-1.5 text-text-500", children: helperMessage })
|
|
938
1161
|
] });
|
|
939
1162
|
}
|
|
940
1163
|
);
|
|
@@ -943,7 +1166,7 @@ var TextArea_default = TextArea;
|
|
|
943
1166
|
|
|
944
1167
|
// src/components/Toast/Toast.tsx
|
|
945
1168
|
var import_phosphor_react4 = require("phosphor-react");
|
|
946
|
-
var
|
|
1169
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
947
1170
|
var VARIANT_ACTION_CLASSES4 = {
|
|
948
1171
|
solid: {
|
|
949
1172
|
warning: "bg-warning text-warning-600 border-none focus-visible:outline-none",
|
|
@@ -983,7 +1206,7 @@ var Toast = ({
|
|
|
983
1206
|
};
|
|
984
1207
|
const IconAction = iconMap[action] || iconMap["success"];
|
|
985
1208
|
const baseClasses = "max-w-[390px] w-full flex flex-row items-start justify-between shadow-lg rounded-lg border p-4 gap-6 group";
|
|
986
|
-
return /* @__PURE__ */ (0,
|
|
1209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
987
1210
|
"div",
|
|
988
1211
|
{
|
|
989
1212
|
role: "alert",
|
|
@@ -992,20 +1215,20 @@ var Toast = ({
|
|
|
992
1215
|
className: `${baseClasses} ${positionClasses[position]} ${variantClasses} ${className}`,
|
|
993
1216
|
...props,
|
|
994
1217
|
children: [
|
|
995
|
-
/* @__PURE__ */ (0,
|
|
996
|
-
/* @__PURE__ */ (0,
|
|
997
|
-
/* @__PURE__ */ (0,
|
|
998
|
-
/* @__PURE__ */ (0,
|
|
999
|
-
description && /* @__PURE__ */ (0,
|
|
1218
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-row items-start gap-3", children: [
|
|
1219
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "mt-1", "data-testid": `toast-icon-${action}`, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IconAction, {}) }),
|
|
1220
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col items-start justify-start", children: [
|
|
1221
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "font-semibold text-md", children: title }),
|
|
1222
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-md text-text-900", children: description })
|
|
1000
1223
|
] })
|
|
1001
1224
|
] }),
|
|
1002
|
-
/* @__PURE__ */ (0,
|
|
1225
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1003
1226
|
"button",
|
|
1004
1227
|
{
|
|
1005
1228
|
onClick: onClose,
|
|
1006
1229
|
"aria-label": "Dismiss notification",
|
|
1007
1230
|
className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1008
|
-
children: /* @__PURE__ */ (0,
|
|
1231
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react4.X, {})
|
|
1009
1232
|
}
|
|
1010
1233
|
)
|
|
1011
1234
|
]
|
|
@@ -1033,11 +1256,11 @@ var useToastStore = (0, import_zustand.create)((set) => ({
|
|
|
1033
1256
|
var ToastStore_default = useToastStore;
|
|
1034
1257
|
|
|
1035
1258
|
// src/components/Toast/utils/Toaster.tsx
|
|
1036
|
-
var
|
|
1259
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1037
1260
|
var Toaster = () => {
|
|
1038
1261
|
const toasts = ToastStore_default((state) => state.toasts);
|
|
1039
1262
|
const removeToast = ToastStore_default((state) => state.removeToast);
|
|
1040
|
-
return /* @__PURE__ */ (0,
|
|
1263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1041
1264
|
Toast_default,
|
|
1042
1265
|
{
|
|
1043
1266
|
title: toast.title,
|
|
@@ -1053,7 +1276,7 @@ var Toaster = () => {
|
|
|
1053
1276
|
var Toaster_default = Toaster;
|
|
1054
1277
|
|
|
1055
1278
|
// src/components/Divider/Divider.tsx
|
|
1056
|
-
var
|
|
1279
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1057
1280
|
var Divider = ({
|
|
1058
1281
|
orientation = "horizontal",
|
|
1059
1282
|
className = "",
|
|
@@ -1064,7 +1287,7 @@ var Divider = ({
|
|
|
1064
1287
|
horizontal: "w-full h-px",
|
|
1065
1288
|
vertical: "h-full w-px"
|
|
1066
1289
|
};
|
|
1067
|
-
return /* @__PURE__ */ (0,
|
|
1290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1068
1291
|
"hr",
|
|
1069
1292
|
{
|
|
1070
1293
|
className: `${baseClasses} ${orientationClasses[orientation]} ${className}`,
|
|
@@ -1077,15 +1300,15 @@ var Divider_default = Divider;
|
|
|
1077
1300
|
|
|
1078
1301
|
// src/components/Input/Input.tsx
|
|
1079
1302
|
var import_phosphor_react5 = require("phosphor-react");
|
|
1080
|
-
var
|
|
1081
|
-
var
|
|
1082
|
-
var
|
|
1303
|
+
var import_react8 = require("react");
|
|
1304
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1305
|
+
var SIZE_CLASSES6 = {
|
|
1083
1306
|
small: "text-sm",
|
|
1084
1307
|
medium: "text-md",
|
|
1085
1308
|
large: "text-lg",
|
|
1086
1309
|
"extra-large": "text-xl"
|
|
1087
1310
|
};
|
|
1088
|
-
var
|
|
1311
|
+
var STATE_CLASSES4 = {
|
|
1089
1312
|
default: "border-border-300 placeholder:text-text-600 hover:border-border-400",
|
|
1090
1313
|
error: "border-2 border-indicator-error placeholder:text-text-600",
|
|
1091
1314
|
disabled: "border-border-300 placeholder:text-text-600 cursor-not-allowed opacity-40",
|
|
@@ -1117,20 +1340,20 @@ var getPasswordToggleConfig = (type, disabled, readOnly, showPassword, iconRight
|
|
|
1117
1340
|
let actualIconRight = iconRight;
|
|
1118
1341
|
let ariaLabel;
|
|
1119
1342
|
if (shouldShowPasswordToggle) {
|
|
1120
|
-
actualIconRight = showPassword ? /* @__PURE__ */ (0,
|
|
1343
|
+
actualIconRight = showPassword ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react5.EyeSlash, {}) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react5.Eye, {});
|
|
1121
1344
|
ariaLabel = showPassword ? "Ocultar senha" : "Mostrar senha";
|
|
1122
1345
|
}
|
|
1123
1346
|
return { shouldShowPasswordToggle, actualIconRight, ariaLabel };
|
|
1124
1347
|
};
|
|
1125
1348
|
var getCombinedClasses = (actualState, variant) => {
|
|
1126
|
-
const stateClasses =
|
|
1349
|
+
const stateClasses = STATE_CLASSES4[actualState];
|
|
1127
1350
|
const variantClasses = VARIANT_CLASSES[variant];
|
|
1128
1351
|
if (actualState === "error" && variant === "underlined") {
|
|
1129
1352
|
return "border-0 border-b-2 border-indicator-error rounded-none bg-transparent focus:outline-none focus:border-primary-950 placeholder:text-text-600";
|
|
1130
1353
|
}
|
|
1131
1354
|
return `${stateClasses} ${variantClasses}`;
|
|
1132
1355
|
};
|
|
1133
|
-
var Input = (0,
|
|
1356
|
+
var Input = (0, import_react8.forwardRef)(
|
|
1134
1357
|
({
|
|
1135
1358
|
label,
|
|
1136
1359
|
helperText,
|
|
@@ -1148,18 +1371,18 @@ var Input = (0, import_react7.forwardRef)(
|
|
|
1148
1371
|
type = "text",
|
|
1149
1372
|
...props
|
|
1150
1373
|
}, ref) => {
|
|
1151
|
-
const [showPassword, setShowPassword] = (0,
|
|
1374
|
+
const [showPassword, setShowPassword] = (0, import_react8.useState)(false);
|
|
1152
1375
|
const isPasswordType = type === "password";
|
|
1153
1376
|
const actualType = isPasswordType && showPassword ? "text" : type;
|
|
1154
1377
|
const actualState = getActualState(disabled, readOnly, errorMessage, state);
|
|
1155
|
-
const sizeClasses =
|
|
1156
|
-
const combinedClasses = (0,
|
|
1378
|
+
const sizeClasses = SIZE_CLASSES6[size];
|
|
1379
|
+
const combinedClasses = (0, import_react8.useMemo)(
|
|
1157
1380
|
() => getCombinedClasses(actualState, variant),
|
|
1158
1381
|
[actualState, variant]
|
|
1159
1382
|
);
|
|
1160
1383
|
const iconSize = getIconSize(size);
|
|
1161
1384
|
const baseClasses = "bg-background w-full py-2 px-3 font-normal text-text-900 focus:outline-primary-950";
|
|
1162
|
-
const generatedId = (0,
|
|
1385
|
+
const generatedId = (0, import_react8.useId)();
|
|
1163
1386
|
const inputId = id ?? `input-${generatedId}`;
|
|
1164
1387
|
const togglePasswordVisibility = () => setShowPassword(!showPassword);
|
|
1165
1388
|
const { shouldShowPasswordToggle, actualIconRight, ariaLabel } = getPasswordToggleConfig(
|
|
@@ -1169,8 +1392,8 @@ var Input = (0, import_react7.forwardRef)(
|
|
|
1169
1392
|
showPassword,
|
|
1170
1393
|
iconRight
|
|
1171
1394
|
);
|
|
1172
|
-
return /* @__PURE__ */ (0,
|
|
1173
|
-
label && /* @__PURE__ */ (0,
|
|
1395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `${containerClassName}`, children: [
|
|
1396
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1174
1397
|
"label",
|
|
1175
1398
|
{
|
|
1176
1399
|
htmlFor: inputId,
|
|
@@ -1178,15 +1401,15 @@ var Input = (0, import_react7.forwardRef)(
|
|
|
1178
1401
|
children: label
|
|
1179
1402
|
}
|
|
1180
1403
|
),
|
|
1181
|
-
/* @__PURE__ */ (0,
|
|
1182
|
-
iconLeft && /* @__PURE__ */ (0,
|
|
1404
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "relative", children: [
|
|
1405
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "absolute left-3 top-1/2 transform -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1183
1406
|
"span",
|
|
1184
1407
|
{
|
|
1185
1408
|
className: `${iconSize} text-text-400 flex items-center justify-center`,
|
|
1186
1409
|
children: iconLeft
|
|
1187
1410
|
}
|
|
1188
1411
|
) }),
|
|
1189
|
-
/* @__PURE__ */ (0,
|
|
1412
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1190
1413
|
"input",
|
|
1191
1414
|
{
|
|
1192
1415
|
ref,
|
|
@@ -1199,14 +1422,14 @@ var Input = (0, import_react7.forwardRef)(
|
|
|
1199
1422
|
...props
|
|
1200
1423
|
}
|
|
1201
1424
|
),
|
|
1202
|
-
actualIconRight && (shouldShowPasswordToggle ? /* @__PURE__ */ (0,
|
|
1425
|
+
actualIconRight && (shouldShowPasswordToggle ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1203
1426
|
"button",
|
|
1204
1427
|
{
|
|
1205
1428
|
type: "button",
|
|
1206
1429
|
className: "absolute right-3 top-1/2 transform -translate-y-1/2 cursor-pointer border-0 bg-transparent p-0",
|
|
1207
1430
|
onClick: togglePasswordVisibility,
|
|
1208
1431
|
"aria-label": ariaLabel,
|
|
1209
|
-
children: /* @__PURE__ */ (0,
|
|
1432
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1210
1433
|
"span",
|
|
1211
1434
|
{
|
|
1212
1435
|
className: `${iconSize} text-text-400 flex items-center justify-center hover:text-text-600 transition-colors`,
|
|
@@ -1214,7 +1437,7 @@ var Input = (0, import_react7.forwardRef)(
|
|
|
1214
1437
|
}
|
|
1215
1438
|
)
|
|
1216
1439
|
}
|
|
1217
|
-
) : /* @__PURE__ */ (0,
|
|
1440
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1218
1441
|
"span",
|
|
1219
1442
|
{
|
|
1220
1443
|
className: `${iconSize} text-text-400 flex items-center justify-center`,
|
|
@@ -1222,10 +1445,10 @@ var Input = (0, import_react7.forwardRef)(
|
|
|
1222
1445
|
}
|
|
1223
1446
|
) }))
|
|
1224
1447
|
] }),
|
|
1225
|
-
/* @__PURE__ */ (0,
|
|
1226
|
-
helperText && /* @__PURE__ */ (0,
|
|
1227
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
1228
|
-
/* @__PURE__ */ (0,
|
|
1448
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "mt-1.5 gap-1.5", children: [
|
|
1449
|
+
helperText && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-sm text-text-500", children: helperText }),
|
|
1450
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "flex gap-1 items-center text-sm text-indicator-error", children: [
|
|
1451
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_phosphor_react5.WarningCircle, { size: 16 }),
|
|
1229
1452
|
" ",
|
|
1230
1453
|
errorMessage
|
|
1231
1454
|
] })
|
|
@@ -1235,24 +1458,57 @@ var Input = (0, import_react7.forwardRef)(
|
|
|
1235
1458
|
);
|
|
1236
1459
|
var Input_default = Input;
|
|
1237
1460
|
|
|
1461
|
+
// src/components/Chips/Chips.tsx
|
|
1462
|
+
var import_phosphor_react6 = require("phosphor-react");
|
|
1463
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1464
|
+
var STATE_CLASSES5 = {
|
|
1465
|
+
default: "bg-background text-text-950 border border-border-100 hover:bg-secondary-50 hover:border-border-300",
|
|
1466
|
+
selected: "bg-info-background text-primary-950 border-2 border-primary-950 hover:bg-secondary-50 focus-visible:border-0"
|
|
1467
|
+
};
|
|
1468
|
+
var Chips = ({
|
|
1469
|
+
children,
|
|
1470
|
+
selected = false,
|
|
1471
|
+
className = "",
|
|
1472
|
+
disabled,
|
|
1473
|
+
type = "button",
|
|
1474
|
+
...props
|
|
1475
|
+
}) => {
|
|
1476
|
+
const stateClasses = selected ? STATE_CLASSES5.selected : STATE_CLASSES5.default;
|
|
1477
|
+
const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-normal text-sm px-4 py-2 gap-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-primary-600 disabled:opacity-40 disabled:cursor-not-allowed";
|
|
1478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1479
|
+
"button",
|
|
1480
|
+
{
|
|
1481
|
+
className: `${baseClasses} ${stateClasses} ${className}`,
|
|
1482
|
+
disabled,
|
|
1483
|
+
type,
|
|
1484
|
+
...props,
|
|
1485
|
+
children: [
|
|
1486
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: `flex items-center`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_phosphor_react6.Check, { weight: "bold", size: 16 }) }),
|
|
1487
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex-1", children })
|
|
1488
|
+
]
|
|
1489
|
+
}
|
|
1490
|
+
);
|
|
1491
|
+
};
|
|
1492
|
+
var Chips_default = Chips;
|
|
1493
|
+
|
|
1238
1494
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
1239
|
-
var
|
|
1240
|
-
var
|
|
1241
|
-
var DropdownMenuContext = (0,
|
|
1495
|
+
var import_react9 = require("react");
|
|
1496
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1497
|
+
var DropdownMenuContext = (0, import_react9.createContext)(
|
|
1242
1498
|
void 0
|
|
1243
1499
|
);
|
|
1244
1500
|
var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
1245
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
1501
|
+
const [internalOpen, setInternalOpen] = (0, import_react9.useState)(false);
|
|
1246
1502
|
const isControlled = open !== void 0;
|
|
1247
1503
|
const currentOpen = isControlled ? open : internalOpen;
|
|
1248
|
-
const setOpen = (0,
|
|
1504
|
+
const setOpen = (0, import_react9.useCallback)(
|
|
1249
1505
|
(newOpen) => {
|
|
1250
1506
|
if (onOpenChange) onOpenChange(newOpen);
|
|
1251
1507
|
if (!isControlled) setInternalOpen(newOpen);
|
|
1252
1508
|
},
|
|
1253
1509
|
[isControlled, onOpenChange]
|
|
1254
1510
|
);
|
|
1255
|
-
const menuRef = (0,
|
|
1511
|
+
const menuRef = (0, import_react9.useRef)(null);
|
|
1256
1512
|
const handleArrowDownOrArrowUp = (event) => {
|
|
1257
1513
|
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
1258
1514
|
if (menuContent) {
|
|
@@ -1286,7 +1542,7 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
1286
1542
|
setOpen(false);
|
|
1287
1543
|
}
|
|
1288
1544
|
};
|
|
1289
|
-
(0,
|
|
1545
|
+
(0, import_react9.useEffect)(() => {
|
|
1290
1546
|
if (currentOpen) {
|
|
1291
1547
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1292
1548
|
document.addEventListener("keydown", handleDownkey);
|
|
@@ -1296,18 +1552,18 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
1296
1552
|
document.removeEventListener("keydown", handleDownkey);
|
|
1297
1553
|
};
|
|
1298
1554
|
}, [currentOpen]);
|
|
1299
|
-
const value = (0,
|
|
1555
|
+
const value = (0, import_react9.useMemo)(
|
|
1300
1556
|
() => ({ open: currentOpen, setOpen }),
|
|
1301
1557
|
[currentOpen, setOpen]
|
|
1302
1558
|
);
|
|
1303
|
-
return /* @__PURE__ */ (0,
|
|
1559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "relative", ref: menuRef, children }) });
|
|
1304
1560
|
};
|
|
1305
|
-
var DropdownMenuTrigger = (0,
|
|
1306
|
-
const context = (0,
|
|
1561
|
+
var DropdownMenuTrigger = (0, import_react9.forwardRef)(({ className, children, onClick, ...props }, ref) => {
|
|
1562
|
+
const context = (0, import_react9.useContext)(DropdownMenuContext);
|
|
1307
1563
|
if (!context)
|
|
1308
1564
|
throw new Error("DropdownMenuTrigger must be used within a DropdownMenu");
|
|
1309
1565
|
const { open, setOpen } = context;
|
|
1310
|
-
return /* @__PURE__ */ (0,
|
|
1566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1311
1567
|
"button",
|
|
1312
1568
|
{
|
|
1313
1569
|
ref,
|
|
@@ -1339,7 +1595,7 @@ var ALIGN_CLASSES = {
|
|
|
1339
1595
|
center: "left-1/2 -translate-x-1/2",
|
|
1340
1596
|
end: "right-0"
|
|
1341
1597
|
};
|
|
1342
|
-
var MenuLabel = (0,
|
|
1598
|
+
var MenuLabel = (0, import_react9.forwardRef)(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1343
1599
|
"fieldset",
|
|
1344
1600
|
{
|
|
1345
1601
|
ref,
|
|
@@ -1349,7 +1605,7 @@ var MenuLabel = (0, import_react8.forwardRef)(({ className, inset, ...props }, r
|
|
|
1349
1605
|
}
|
|
1350
1606
|
));
|
|
1351
1607
|
MenuLabel.displayName = "MenuLabel";
|
|
1352
|
-
var MenuContent = (0,
|
|
1608
|
+
var MenuContent = (0, import_react9.forwardRef)(
|
|
1353
1609
|
({
|
|
1354
1610
|
className,
|
|
1355
1611
|
align = "start",
|
|
@@ -1358,9 +1614,9 @@ var MenuContent = (0, import_react8.forwardRef)(
|
|
|
1358
1614
|
children,
|
|
1359
1615
|
...props
|
|
1360
1616
|
}, ref) => {
|
|
1361
|
-
const { open } = (0,
|
|
1362
|
-
const [isVisible, setIsVisible] = (0,
|
|
1363
|
-
(0,
|
|
1617
|
+
const { open } = (0, import_react9.useContext)(DropdownMenuContext);
|
|
1618
|
+
const [isVisible, setIsVisible] = (0, import_react9.useState)(open);
|
|
1619
|
+
(0, import_react9.useEffect)(() => {
|
|
1364
1620
|
if (open) {
|
|
1365
1621
|
setIsVisible(true);
|
|
1366
1622
|
} else {
|
|
@@ -1374,7 +1630,7 @@ var MenuContent = (0, import_react8.forwardRef)(
|
|
|
1374
1630
|
const horizontal = ALIGN_CLASSES[align];
|
|
1375
1631
|
return `absolute ${vertical} ${horizontal}`;
|
|
1376
1632
|
};
|
|
1377
|
-
return /* @__PURE__ */ (0,
|
|
1633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1378
1634
|
"div",
|
|
1379
1635
|
{
|
|
1380
1636
|
ref,
|
|
@@ -1398,7 +1654,7 @@ var MenuContent = (0, import_react8.forwardRef)(
|
|
|
1398
1654
|
}
|
|
1399
1655
|
);
|
|
1400
1656
|
MenuContent.displayName = "MenuContent";
|
|
1401
|
-
var MenuItem = (0,
|
|
1657
|
+
var MenuItem = (0, import_react9.forwardRef)(
|
|
1402
1658
|
({
|
|
1403
1659
|
className,
|
|
1404
1660
|
inset,
|
|
@@ -1419,7 +1675,7 @@ var MenuItem = (0, import_react8.forwardRef)(
|
|
|
1419
1675
|
}
|
|
1420
1676
|
onClick?.(e);
|
|
1421
1677
|
};
|
|
1422
|
-
return /* @__PURE__ */ (0,
|
|
1678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1423
1679
|
"div",
|
|
1424
1680
|
{
|
|
1425
1681
|
ref,
|
|
@@ -1449,7 +1705,7 @@ var MenuItem = (0, import_react8.forwardRef)(
|
|
|
1449
1705
|
}
|
|
1450
1706
|
);
|
|
1451
1707
|
MenuItem.displayName = "MenuItem";
|
|
1452
|
-
var MenuSeparator = (0,
|
|
1708
|
+
var MenuSeparator = (0, import_react9.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1453
1709
|
"div",
|
|
1454
1710
|
{
|
|
1455
1711
|
ref,
|
|
@@ -1465,6 +1721,7 @@ var DropdownMenu_default = DropdownMenu;
|
|
|
1465
1721
|
Badge,
|
|
1466
1722
|
Button,
|
|
1467
1723
|
CheckBox,
|
|
1724
|
+
Chips,
|
|
1468
1725
|
Divider,
|
|
1469
1726
|
DropdownMenu,
|
|
1470
1727
|
DropdownMenuContent,
|
|
@@ -1476,6 +1733,7 @@ var DropdownMenu_default = DropdownMenu;
|
|
|
1476
1733
|
IconRoundedButton,
|
|
1477
1734
|
Input,
|
|
1478
1735
|
NavButton,
|
|
1736
|
+
Radio,
|
|
1479
1737
|
SelectionButton,
|
|
1480
1738
|
Table,
|
|
1481
1739
|
Text,
|