analytica-frontend-lib 1.0.30 → 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 +87 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +125 -4
- package/dist/index.d.ts +125 -4
- package/dist/index.js +350 -67
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +345 -61
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +87 -0
- package/dist/styles.css.map +1 -1
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -24,6 +24,8 @@ __export(src_exports, {
|
|
|
24
24
|
Badge: () => Badge_default,
|
|
25
25
|
Button: () => Button_default,
|
|
26
26
|
CheckBox: () => CheckBox_default,
|
|
27
|
+
Chips: () => Chips_default,
|
|
28
|
+
Divider: () => Divider_default,
|
|
27
29
|
DropdownMenu: () => DropdownMenu_default,
|
|
28
30
|
DropdownMenuContent: () => MenuContent,
|
|
29
31
|
DropdownMenuItem: () => MenuItem,
|
|
@@ -34,6 +36,7 @@ __export(src_exports, {
|
|
|
34
36
|
IconRoundedButton: () => IconRoundedButton_default,
|
|
35
37
|
Input: () => Input_default,
|
|
36
38
|
NavButton: () => NavButton_default,
|
|
39
|
+
Radio: () => Radio_default,
|
|
37
40
|
SelectionButton: () => SelectionButton_default,
|
|
38
41
|
Table: () => Table_default,
|
|
39
42
|
Text: () => Text_default,
|
|
@@ -808,10 +811,231 @@ var CheckBox = (0, import_react5.forwardRef)(
|
|
|
808
811
|
CheckBox.displayName = "CheckBox";
|
|
809
812
|
var CheckBox_default = CheckBox;
|
|
810
813
|
|
|
811
|
-
// src/components/
|
|
814
|
+
// src/components/Radio/Radio.tsx
|
|
812
815
|
var import_react6 = require("react");
|
|
813
816
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
814
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 = {
|
|
815
1039
|
small: {
|
|
816
1040
|
container: "w-72",
|
|
817
1041
|
// 288px width
|
|
@@ -842,7 +1066,7 @@ var SIZE_CLASSES4 = {
|
|
|
842
1066
|
}
|
|
843
1067
|
};
|
|
844
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";
|
|
845
|
-
var
|
|
1069
|
+
var STATE_CLASSES3 = {
|
|
846
1070
|
default: {
|
|
847
1071
|
base: "border-border-300 bg-background text-text-600",
|
|
848
1072
|
hover: "hover:border-border-400",
|
|
@@ -869,7 +1093,7 @@ var STATE_CLASSES2 = {
|
|
|
869
1093
|
focus: ""
|
|
870
1094
|
}
|
|
871
1095
|
};
|
|
872
|
-
var TextArea = (0,
|
|
1096
|
+
var TextArea = (0, import_react7.forwardRef)(
|
|
873
1097
|
({
|
|
874
1098
|
label,
|
|
875
1099
|
size = "medium",
|
|
@@ -884,9 +1108,9 @@ var TextArea = (0, import_react6.forwardRef)(
|
|
|
884
1108
|
placeholder,
|
|
885
1109
|
...props
|
|
886
1110
|
}, ref) => {
|
|
887
|
-
const generatedId = (0,
|
|
1111
|
+
const generatedId = (0, import_react7.useId)();
|
|
888
1112
|
const inputId = id ?? `textarea-${generatedId}`;
|
|
889
|
-
const [isFocused, setIsFocused] = (0,
|
|
1113
|
+
const [isFocused, setIsFocused] = (0, import_react7.useState)(false);
|
|
890
1114
|
const handleChange = (event) => {
|
|
891
1115
|
onChange?.(event);
|
|
892
1116
|
};
|
|
@@ -902,11 +1126,11 @@ var TextArea = (0, import_react6.forwardRef)(
|
|
|
902
1126
|
if (isFocused && currentState !== "invalid" && currentState !== "disabled") {
|
|
903
1127
|
currentState = "focused";
|
|
904
1128
|
}
|
|
905
|
-
const sizeClasses =
|
|
906
|
-
const stateClasses =
|
|
1129
|
+
const sizeClasses = SIZE_CLASSES5[size];
|
|
1130
|
+
const stateClasses = STATE_CLASSES3[currentState];
|
|
907
1131
|
const textareaClasses = `${BASE_TEXTAREA_CLASSES} ${sizeClasses.textarea} ${stateClasses.base} ${stateClasses.hover} ${stateClasses.focus} ${className}`;
|
|
908
|
-
return /* @__PURE__ */ (0,
|
|
909
|
-
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)(
|
|
910
1134
|
Text_default,
|
|
911
1135
|
{
|
|
912
1136
|
as: "label",
|
|
@@ -918,7 +1142,7 @@ var TextArea = (0, import_react6.forwardRef)(
|
|
|
918
1142
|
children: label
|
|
919
1143
|
}
|
|
920
1144
|
),
|
|
921
|
-
/* @__PURE__ */ (0,
|
|
1145
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
922
1146
|
"textarea",
|
|
923
1147
|
{
|
|
924
1148
|
ref,
|
|
@@ -932,8 +1156,8 @@ var TextArea = (0, import_react6.forwardRef)(
|
|
|
932
1156
|
...props
|
|
933
1157
|
}
|
|
934
1158
|
),
|
|
935
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
936
|
-
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 })
|
|
937
1161
|
] });
|
|
938
1162
|
}
|
|
939
1163
|
);
|
|
@@ -942,7 +1166,7 @@ var TextArea_default = TextArea;
|
|
|
942
1166
|
|
|
943
1167
|
// src/components/Toast/Toast.tsx
|
|
944
1168
|
var import_phosphor_react4 = require("phosphor-react");
|
|
945
|
-
var
|
|
1169
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
946
1170
|
var VARIANT_ACTION_CLASSES4 = {
|
|
947
1171
|
solid: {
|
|
948
1172
|
warning: "bg-warning text-warning-600 border-none focus-visible:outline-none",
|
|
@@ -982,7 +1206,7 @@ var Toast = ({
|
|
|
982
1206
|
};
|
|
983
1207
|
const IconAction = iconMap[action] || iconMap["success"];
|
|
984
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";
|
|
985
|
-
return /* @__PURE__ */ (0,
|
|
1209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
986
1210
|
"div",
|
|
987
1211
|
{
|
|
988
1212
|
role: "alert",
|
|
@@ -991,20 +1215,20 @@ var Toast = ({
|
|
|
991
1215
|
className: `${baseClasses} ${positionClasses[position]} ${variantClasses} ${className}`,
|
|
992
1216
|
...props,
|
|
993
1217
|
children: [
|
|
994
|
-
/* @__PURE__ */ (0,
|
|
995
|
-
/* @__PURE__ */ (0,
|
|
996
|
-
/* @__PURE__ */ (0,
|
|
997
|
-
/* @__PURE__ */ (0,
|
|
998
|
-
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 })
|
|
999
1223
|
] })
|
|
1000
1224
|
] }),
|
|
1001
|
-
/* @__PURE__ */ (0,
|
|
1225
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1002
1226
|
"button",
|
|
1003
1227
|
{
|
|
1004
1228
|
onClick: onClose,
|
|
1005
1229
|
"aria-label": "Dismiss notification",
|
|
1006
1230
|
className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1007
|
-
children: /* @__PURE__ */ (0,
|
|
1231
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_phosphor_react4.X, {})
|
|
1008
1232
|
}
|
|
1009
1233
|
)
|
|
1010
1234
|
]
|
|
@@ -1032,11 +1256,11 @@ var useToastStore = (0, import_zustand.create)((set) => ({
|
|
|
1032
1256
|
var ToastStore_default = useToastStore;
|
|
1033
1257
|
|
|
1034
1258
|
// src/components/Toast/utils/Toaster.tsx
|
|
1035
|
-
var
|
|
1259
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1036
1260
|
var Toaster = () => {
|
|
1037
1261
|
const toasts = ToastStore_default((state) => state.toasts);
|
|
1038
1262
|
const removeToast = ToastStore_default((state) => state.removeToast);
|
|
1039
|
-
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)(
|
|
1040
1264
|
Toast_default,
|
|
1041
1265
|
{
|
|
1042
1266
|
title: toast.title,
|
|
@@ -1051,17 +1275,40 @@ var Toaster = () => {
|
|
|
1051
1275
|
};
|
|
1052
1276
|
var Toaster_default = Toaster;
|
|
1053
1277
|
|
|
1278
|
+
// src/components/Divider/Divider.tsx
|
|
1279
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1280
|
+
var Divider = ({
|
|
1281
|
+
orientation = "horizontal",
|
|
1282
|
+
className = "",
|
|
1283
|
+
...props
|
|
1284
|
+
}) => {
|
|
1285
|
+
const baseClasses = "bg-border-200 border-0";
|
|
1286
|
+
const orientationClasses = {
|
|
1287
|
+
horizontal: "w-full h-px",
|
|
1288
|
+
vertical: "h-full w-px"
|
|
1289
|
+
};
|
|
1290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1291
|
+
"hr",
|
|
1292
|
+
{
|
|
1293
|
+
className: `${baseClasses} ${orientationClasses[orientation]} ${className}`,
|
|
1294
|
+
"aria-orientation": orientation,
|
|
1295
|
+
...props
|
|
1296
|
+
}
|
|
1297
|
+
);
|
|
1298
|
+
};
|
|
1299
|
+
var Divider_default = Divider;
|
|
1300
|
+
|
|
1054
1301
|
// src/components/Input/Input.tsx
|
|
1055
1302
|
var import_phosphor_react5 = require("phosphor-react");
|
|
1056
|
-
var
|
|
1057
|
-
var
|
|
1058
|
-
var
|
|
1303
|
+
var import_react8 = require("react");
|
|
1304
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1305
|
+
var SIZE_CLASSES6 = {
|
|
1059
1306
|
small: "text-sm",
|
|
1060
1307
|
medium: "text-md",
|
|
1061
1308
|
large: "text-lg",
|
|
1062
1309
|
"extra-large": "text-xl"
|
|
1063
1310
|
};
|
|
1064
|
-
var
|
|
1311
|
+
var STATE_CLASSES4 = {
|
|
1065
1312
|
default: "border-border-300 placeholder:text-text-600 hover:border-border-400",
|
|
1066
1313
|
error: "border-2 border-indicator-error placeholder:text-text-600",
|
|
1067
1314
|
disabled: "border-border-300 placeholder:text-text-600 cursor-not-allowed opacity-40",
|
|
@@ -1093,20 +1340,20 @@ var getPasswordToggleConfig = (type, disabled, readOnly, showPassword, iconRight
|
|
|
1093
1340
|
let actualIconRight = iconRight;
|
|
1094
1341
|
let ariaLabel;
|
|
1095
1342
|
if (shouldShowPasswordToggle) {
|
|
1096
|
-
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, {});
|
|
1097
1344
|
ariaLabel = showPassword ? "Ocultar senha" : "Mostrar senha";
|
|
1098
1345
|
}
|
|
1099
1346
|
return { shouldShowPasswordToggle, actualIconRight, ariaLabel };
|
|
1100
1347
|
};
|
|
1101
1348
|
var getCombinedClasses = (actualState, variant) => {
|
|
1102
|
-
const stateClasses =
|
|
1349
|
+
const stateClasses = STATE_CLASSES4[actualState];
|
|
1103
1350
|
const variantClasses = VARIANT_CLASSES[variant];
|
|
1104
1351
|
if (actualState === "error" && variant === "underlined") {
|
|
1105
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";
|
|
1106
1353
|
}
|
|
1107
1354
|
return `${stateClasses} ${variantClasses}`;
|
|
1108
1355
|
};
|
|
1109
|
-
var Input = (0,
|
|
1356
|
+
var Input = (0, import_react8.forwardRef)(
|
|
1110
1357
|
({
|
|
1111
1358
|
label,
|
|
1112
1359
|
helperText,
|
|
@@ -1124,18 +1371,18 @@ var Input = (0, import_react7.forwardRef)(
|
|
|
1124
1371
|
type = "text",
|
|
1125
1372
|
...props
|
|
1126
1373
|
}, ref) => {
|
|
1127
|
-
const [showPassword, setShowPassword] = (0,
|
|
1374
|
+
const [showPassword, setShowPassword] = (0, import_react8.useState)(false);
|
|
1128
1375
|
const isPasswordType = type === "password";
|
|
1129
1376
|
const actualType = isPasswordType && showPassword ? "text" : type;
|
|
1130
1377
|
const actualState = getActualState(disabled, readOnly, errorMessage, state);
|
|
1131
|
-
const sizeClasses =
|
|
1132
|
-
const combinedClasses = (0,
|
|
1378
|
+
const sizeClasses = SIZE_CLASSES6[size];
|
|
1379
|
+
const combinedClasses = (0, import_react8.useMemo)(
|
|
1133
1380
|
() => getCombinedClasses(actualState, variant),
|
|
1134
1381
|
[actualState, variant]
|
|
1135
1382
|
);
|
|
1136
1383
|
const iconSize = getIconSize(size);
|
|
1137
1384
|
const baseClasses = "bg-background w-full py-2 px-3 font-normal text-text-900 focus:outline-primary-950";
|
|
1138
|
-
const generatedId = (0,
|
|
1385
|
+
const generatedId = (0, import_react8.useId)();
|
|
1139
1386
|
const inputId = id ?? `input-${generatedId}`;
|
|
1140
1387
|
const togglePasswordVisibility = () => setShowPassword(!showPassword);
|
|
1141
1388
|
const { shouldShowPasswordToggle, actualIconRight, ariaLabel } = getPasswordToggleConfig(
|
|
@@ -1145,8 +1392,8 @@ var Input = (0, import_react7.forwardRef)(
|
|
|
1145
1392
|
showPassword,
|
|
1146
1393
|
iconRight
|
|
1147
1394
|
);
|
|
1148
|
-
return /* @__PURE__ */ (0,
|
|
1149
|
-
label && /* @__PURE__ */ (0,
|
|
1395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `${containerClassName}`, children: [
|
|
1396
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1150
1397
|
"label",
|
|
1151
1398
|
{
|
|
1152
1399
|
htmlFor: inputId,
|
|
@@ -1154,15 +1401,15 @@ var Input = (0, import_react7.forwardRef)(
|
|
|
1154
1401
|
children: label
|
|
1155
1402
|
}
|
|
1156
1403
|
),
|
|
1157
|
-
/* @__PURE__ */ (0,
|
|
1158
|
-
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)(
|
|
1159
1406
|
"span",
|
|
1160
1407
|
{
|
|
1161
1408
|
className: `${iconSize} text-text-400 flex items-center justify-center`,
|
|
1162
1409
|
children: iconLeft
|
|
1163
1410
|
}
|
|
1164
1411
|
) }),
|
|
1165
|
-
/* @__PURE__ */ (0,
|
|
1412
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1166
1413
|
"input",
|
|
1167
1414
|
{
|
|
1168
1415
|
ref,
|
|
@@ -1175,14 +1422,14 @@ var Input = (0, import_react7.forwardRef)(
|
|
|
1175
1422
|
...props
|
|
1176
1423
|
}
|
|
1177
1424
|
),
|
|
1178
|
-
actualIconRight && (shouldShowPasswordToggle ? /* @__PURE__ */ (0,
|
|
1425
|
+
actualIconRight && (shouldShowPasswordToggle ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1179
1426
|
"button",
|
|
1180
1427
|
{
|
|
1181
1428
|
type: "button",
|
|
1182
1429
|
className: "absolute right-3 top-1/2 transform -translate-y-1/2 cursor-pointer border-0 bg-transparent p-0",
|
|
1183
1430
|
onClick: togglePasswordVisibility,
|
|
1184
1431
|
"aria-label": ariaLabel,
|
|
1185
|
-
children: /* @__PURE__ */ (0,
|
|
1432
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1186
1433
|
"span",
|
|
1187
1434
|
{
|
|
1188
1435
|
className: `${iconSize} text-text-400 flex items-center justify-center hover:text-text-600 transition-colors`,
|
|
@@ -1190,7 +1437,7 @@ var Input = (0, import_react7.forwardRef)(
|
|
|
1190
1437
|
}
|
|
1191
1438
|
)
|
|
1192
1439
|
}
|
|
1193
|
-
) : /* @__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)(
|
|
1194
1441
|
"span",
|
|
1195
1442
|
{
|
|
1196
1443
|
className: `${iconSize} text-text-400 flex items-center justify-center`,
|
|
@@ -1198,10 +1445,10 @@ var Input = (0, import_react7.forwardRef)(
|
|
|
1198
1445
|
}
|
|
1199
1446
|
) }))
|
|
1200
1447
|
] }),
|
|
1201
|
-
/* @__PURE__ */ (0,
|
|
1202
|
-
helperText && /* @__PURE__ */ (0,
|
|
1203
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
1204
|
-
/* @__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 }),
|
|
1205
1452
|
" ",
|
|
1206
1453
|
errorMessage
|
|
1207
1454
|
] })
|
|
@@ -1211,24 +1458,57 @@ var Input = (0, import_react7.forwardRef)(
|
|
|
1211
1458
|
);
|
|
1212
1459
|
var Input_default = Input;
|
|
1213
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
|
+
|
|
1214
1494
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
1215
|
-
var
|
|
1216
|
-
var
|
|
1217
|
-
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)(
|
|
1218
1498
|
void 0
|
|
1219
1499
|
);
|
|
1220
1500
|
var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
1221
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
1501
|
+
const [internalOpen, setInternalOpen] = (0, import_react9.useState)(false);
|
|
1222
1502
|
const isControlled = open !== void 0;
|
|
1223
1503
|
const currentOpen = isControlled ? open : internalOpen;
|
|
1224
|
-
const setOpen = (0,
|
|
1504
|
+
const setOpen = (0, import_react9.useCallback)(
|
|
1225
1505
|
(newOpen) => {
|
|
1226
1506
|
if (onOpenChange) onOpenChange(newOpen);
|
|
1227
1507
|
if (!isControlled) setInternalOpen(newOpen);
|
|
1228
1508
|
},
|
|
1229
1509
|
[isControlled, onOpenChange]
|
|
1230
1510
|
);
|
|
1231
|
-
const menuRef = (0,
|
|
1511
|
+
const menuRef = (0, import_react9.useRef)(null);
|
|
1232
1512
|
const handleArrowDownOrArrowUp = (event) => {
|
|
1233
1513
|
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
1234
1514
|
if (menuContent) {
|
|
@@ -1262,7 +1542,7 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
1262
1542
|
setOpen(false);
|
|
1263
1543
|
}
|
|
1264
1544
|
};
|
|
1265
|
-
(0,
|
|
1545
|
+
(0, import_react9.useEffect)(() => {
|
|
1266
1546
|
if (currentOpen) {
|
|
1267
1547
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1268
1548
|
document.addEventListener("keydown", handleDownkey);
|
|
@@ -1272,18 +1552,18 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
1272
1552
|
document.removeEventListener("keydown", handleDownkey);
|
|
1273
1553
|
};
|
|
1274
1554
|
}, [currentOpen]);
|
|
1275
|
-
const value = (0,
|
|
1555
|
+
const value = (0, import_react9.useMemo)(
|
|
1276
1556
|
() => ({ open: currentOpen, setOpen }),
|
|
1277
1557
|
[currentOpen, setOpen]
|
|
1278
1558
|
);
|
|
1279
|
-
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 }) });
|
|
1280
1560
|
};
|
|
1281
|
-
var DropdownMenuTrigger = (0,
|
|
1282
|
-
const context = (0,
|
|
1561
|
+
var DropdownMenuTrigger = (0, import_react9.forwardRef)(({ className, children, onClick, ...props }, ref) => {
|
|
1562
|
+
const context = (0, import_react9.useContext)(DropdownMenuContext);
|
|
1283
1563
|
if (!context)
|
|
1284
1564
|
throw new Error("DropdownMenuTrigger must be used within a DropdownMenu");
|
|
1285
1565
|
const { open, setOpen } = context;
|
|
1286
|
-
return /* @__PURE__ */ (0,
|
|
1566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1287
1567
|
"button",
|
|
1288
1568
|
{
|
|
1289
1569
|
ref,
|
|
@@ -1315,7 +1595,7 @@ var ALIGN_CLASSES = {
|
|
|
1315
1595
|
center: "left-1/2 -translate-x-1/2",
|
|
1316
1596
|
end: "right-0"
|
|
1317
1597
|
};
|
|
1318
|
-
var MenuLabel = (0,
|
|
1598
|
+
var MenuLabel = (0, import_react9.forwardRef)(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1319
1599
|
"fieldset",
|
|
1320
1600
|
{
|
|
1321
1601
|
ref,
|
|
@@ -1325,7 +1605,7 @@ var MenuLabel = (0, import_react8.forwardRef)(({ className, inset, ...props }, r
|
|
|
1325
1605
|
}
|
|
1326
1606
|
));
|
|
1327
1607
|
MenuLabel.displayName = "MenuLabel";
|
|
1328
|
-
var MenuContent = (0,
|
|
1608
|
+
var MenuContent = (0, import_react9.forwardRef)(
|
|
1329
1609
|
({
|
|
1330
1610
|
className,
|
|
1331
1611
|
align = "start",
|
|
@@ -1334,9 +1614,9 @@ var MenuContent = (0, import_react8.forwardRef)(
|
|
|
1334
1614
|
children,
|
|
1335
1615
|
...props
|
|
1336
1616
|
}, ref) => {
|
|
1337
|
-
const { open } = (0,
|
|
1338
|
-
const [isVisible, setIsVisible] = (0,
|
|
1339
|
-
(0,
|
|
1617
|
+
const { open } = (0, import_react9.useContext)(DropdownMenuContext);
|
|
1618
|
+
const [isVisible, setIsVisible] = (0, import_react9.useState)(open);
|
|
1619
|
+
(0, import_react9.useEffect)(() => {
|
|
1340
1620
|
if (open) {
|
|
1341
1621
|
setIsVisible(true);
|
|
1342
1622
|
} else {
|
|
@@ -1350,7 +1630,7 @@ var MenuContent = (0, import_react8.forwardRef)(
|
|
|
1350
1630
|
const horizontal = ALIGN_CLASSES[align];
|
|
1351
1631
|
return `absolute ${vertical} ${horizontal}`;
|
|
1352
1632
|
};
|
|
1353
|
-
return /* @__PURE__ */ (0,
|
|
1633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1354
1634
|
"div",
|
|
1355
1635
|
{
|
|
1356
1636
|
ref,
|
|
@@ -1374,7 +1654,7 @@ var MenuContent = (0, import_react8.forwardRef)(
|
|
|
1374
1654
|
}
|
|
1375
1655
|
);
|
|
1376
1656
|
MenuContent.displayName = "MenuContent";
|
|
1377
|
-
var MenuItem = (0,
|
|
1657
|
+
var MenuItem = (0, import_react9.forwardRef)(
|
|
1378
1658
|
({
|
|
1379
1659
|
className,
|
|
1380
1660
|
inset,
|
|
@@ -1395,7 +1675,7 @@ var MenuItem = (0, import_react8.forwardRef)(
|
|
|
1395
1675
|
}
|
|
1396
1676
|
onClick?.(e);
|
|
1397
1677
|
};
|
|
1398
|
-
return /* @__PURE__ */ (0,
|
|
1678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1399
1679
|
"div",
|
|
1400
1680
|
{
|
|
1401
1681
|
ref,
|
|
@@ -1425,7 +1705,7 @@ var MenuItem = (0, import_react8.forwardRef)(
|
|
|
1425
1705
|
}
|
|
1426
1706
|
);
|
|
1427
1707
|
MenuItem.displayName = "MenuItem";
|
|
1428
|
-
var MenuSeparator = (0,
|
|
1708
|
+
var MenuSeparator = (0, import_react9.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1429
1709
|
"div",
|
|
1430
1710
|
{
|
|
1431
1711
|
ref,
|
|
@@ -1441,6 +1721,8 @@ var DropdownMenu_default = DropdownMenu;
|
|
|
1441
1721
|
Badge,
|
|
1442
1722
|
Button,
|
|
1443
1723
|
CheckBox,
|
|
1724
|
+
Chips,
|
|
1725
|
+
Divider,
|
|
1444
1726
|
DropdownMenu,
|
|
1445
1727
|
DropdownMenuContent,
|
|
1446
1728
|
DropdownMenuItem,
|
|
@@ -1451,6 +1733,7 @@ var DropdownMenu_default = DropdownMenu;
|
|
|
1451
1733
|
IconRoundedButton,
|
|
1452
1734
|
Input,
|
|
1453
1735
|
NavButton,
|
|
1736
|
+
Radio,
|
|
1454
1737
|
SelectionButton,
|
|
1455
1738
|
Table,
|
|
1456
1739
|
Text,
|