analytica-frontend-lib 1.0.29 → 1.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1013,23 +1013,211 @@ var Toaster = () => {
1013
1013
  };
1014
1014
  var Toaster_default = Toaster;
1015
1015
 
1016
+ // src/components/Divider/Divider.tsx
1017
+ import { jsx as jsx14 } from "react/jsx-runtime";
1018
+ var Divider = ({
1019
+ orientation = "horizontal",
1020
+ className = "",
1021
+ ...props
1022
+ }) => {
1023
+ const baseClasses = "bg-border-200 border-0";
1024
+ const orientationClasses = {
1025
+ horizontal: "w-full h-px",
1026
+ vertical: "h-full w-px"
1027
+ };
1028
+ return /* @__PURE__ */ jsx14(
1029
+ "hr",
1030
+ {
1031
+ className: `${baseClasses} ${orientationClasses[orientation]} ${className}`,
1032
+ "aria-orientation": orientation,
1033
+ ...props
1034
+ }
1035
+ );
1036
+ };
1037
+ var Divider_default = Divider;
1038
+
1039
+ // src/components/Input/Input.tsx
1040
+ import { WarningCircle as WarningCircle3, Eye, EyeSlash } from "phosphor-react";
1041
+ import {
1042
+ forwardRef as forwardRef7,
1043
+ useState as useState3,
1044
+ useId as useId3,
1045
+ useMemo
1046
+ } from "react";
1047
+ import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
1048
+ var SIZE_CLASSES5 = {
1049
+ small: "text-sm",
1050
+ medium: "text-md",
1051
+ large: "text-lg",
1052
+ "extra-large": "text-xl"
1053
+ };
1054
+ var STATE_CLASSES3 = {
1055
+ default: "border-border-300 placeholder:text-text-600 hover:border-border-400",
1056
+ error: "border-2 border-indicator-error placeholder:text-text-600",
1057
+ disabled: "border-border-300 placeholder:text-text-600 cursor-not-allowed opacity-40",
1058
+ "read-only": "border-border-300 !text-text-600 cursor-default focus:outline-none bg-background-50"
1059
+ };
1060
+ var VARIANT_CLASSES = {
1061
+ outlined: "border rounded-lg",
1062
+ underlined: "border-0 border-b rounded-none bg-transparent focus:outline-none focus:border-primary-950 focus:border-b-2",
1063
+ rounded: "border rounded-full"
1064
+ };
1065
+ var getActualState = (disabled, readOnly, errorMessage, state) => {
1066
+ if (disabled) return "disabled";
1067
+ if (readOnly) return "read-only";
1068
+ if (errorMessage) return "error";
1069
+ return state || "default";
1070
+ };
1071
+ var getIconSize = (size) => {
1072
+ const iconSizeClasses = {
1073
+ small: "w-4 h-4",
1074
+ medium: "w-5 h-5",
1075
+ large: "w-6 h-6",
1076
+ "extra-large": "w-7 h-7"
1077
+ };
1078
+ return iconSizeClasses[size] || iconSizeClasses.medium;
1079
+ };
1080
+ var getPasswordToggleConfig = (type, disabled, readOnly, showPassword, iconRight) => {
1081
+ const isPasswordType = type === "password";
1082
+ const shouldShowPasswordToggle = isPasswordType && !disabled && !readOnly;
1083
+ let actualIconRight = iconRight;
1084
+ let ariaLabel;
1085
+ if (shouldShowPasswordToggle) {
1086
+ actualIconRight = showPassword ? /* @__PURE__ */ jsx15(EyeSlash, {}) : /* @__PURE__ */ jsx15(Eye, {});
1087
+ ariaLabel = showPassword ? "Ocultar senha" : "Mostrar senha";
1088
+ }
1089
+ return { shouldShowPasswordToggle, actualIconRight, ariaLabel };
1090
+ };
1091
+ var getCombinedClasses = (actualState, variant) => {
1092
+ const stateClasses = STATE_CLASSES3[actualState];
1093
+ const variantClasses = VARIANT_CLASSES[variant];
1094
+ if (actualState === "error" && variant === "underlined") {
1095
+ return "border-0 border-b-2 border-indicator-error rounded-none bg-transparent focus:outline-none focus:border-primary-950 placeholder:text-text-600";
1096
+ }
1097
+ return `${stateClasses} ${variantClasses}`;
1098
+ };
1099
+ var Input = forwardRef7(
1100
+ ({
1101
+ label,
1102
+ helperText,
1103
+ errorMessage,
1104
+ size = "medium",
1105
+ variant = "outlined",
1106
+ state = "default",
1107
+ iconLeft,
1108
+ iconRight,
1109
+ className = "",
1110
+ containerClassName = "",
1111
+ disabled,
1112
+ readOnly,
1113
+ id,
1114
+ type = "text",
1115
+ ...props
1116
+ }, ref) => {
1117
+ const [showPassword, setShowPassword] = useState3(false);
1118
+ const isPasswordType = type === "password";
1119
+ const actualType = isPasswordType && showPassword ? "text" : type;
1120
+ const actualState = getActualState(disabled, readOnly, errorMessage, state);
1121
+ const sizeClasses = SIZE_CLASSES5[size];
1122
+ const combinedClasses = useMemo(
1123
+ () => getCombinedClasses(actualState, variant),
1124
+ [actualState, variant]
1125
+ );
1126
+ const iconSize = getIconSize(size);
1127
+ const baseClasses = "bg-background w-full py-2 px-3 font-normal text-text-900 focus:outline-primary-950";
1128
+ const generatedId = useId3();
1129
+ const inputId = id ?? `input-${generatedId}`;
1130
+ const togglePasswordVisibility = () => setShowPassword(!showPassword);
1131
+ const { shouldShowPasswordToggle, actualIconRight, ariaLabel } = getPasswordToggleConfig(
1132
+ type,
1133
+ disabled,
1134
+ readOnly,
1135
+ showPassword,
1136
+ iconRight
1137
+ );
1138
+ return /* @__PURE__ */ jsxs10("div", { className: `${containerClassName}`, children: [
1139
+ label && /* @__PURE__ */ jsx15(
1140
+ "label",
1141
+ {
1142
+ htmlFor: inputId,
1143
+ className: `block font-bold text-text-900 mb-1.5 ${sizeClasses}`,
1144
+ children: label
1145
+ }
1146
+ ),
1147
+ /* @__PURE__ */ jsxs10("div", { className: "relative", children: [
1148
+ iconLeft && /* @__PURE__ */ jsx15("div", { className: "absolute left-3 top-1/2 transform -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ jsx15(
1149
+ "span",
1150
+ {
1151
+ className: `${iconSize} text-text-400 flex items-center justify-center`,
1152
+ children: iconLeft
1153
+ }
1154
+ ) }),
1155
+ /* @__PURE__ */ jsx15(
1156
+ "input",
1157
+ {
1158
+ ref,
1159
+ id: inputId,
1160
+ type: actualType,
1161
+ className: `${baseClasses} ${sizeClasses} ${combinedClasses} ${iconLeft ? "pl-10" : ""} ${actualIconRight ? "pr-10" : ""} ${className}`,
1162
+ disabled,
1163
+ readOnly,
1164
+ "aria-invalid": actualState === "error" ? "true" : void 0,
1165
+ ...props
1166
+ }
1167
+ ),
1168
+ actualIconRight && (shouldShowPasswordToggle ? /* @__PURE__ */ jsx15(
1169
+ "button",
1170
+ {
1171
+ type: "button",
1172
+ className: "absolute right-3 top-1/2 transform -translate-y-1/2 cursor-pointer border-0 bg-transparent p-0",
1173
+ onClick: togglePasswordVisibility,
1174
+ "aria-label": ariaLabel,
1175
+ children: /* @__PURE__ */ jsx15(
1176
+ "span",
1177
+ {
1178
+ className: `${iconSize} text-text-400 flex items-center justify-center hover:text-text-600 transition-colors`,
1179
+ children: actualIconRight
1180
+ }
1181
+ )
1182
+ }
1183
+ ) : /* @__PURE__ */ jsx15("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ jsx15(
1184
+ "span",
1185
+ {
1186
+ className: `${iconSize} text-text-400 flex items-center justify-center`,
1187
+ children: actualIconRight
1188
+ }
1189
+ ) }))
1190
+ ] }),
1191
+ /* @__PURE__ */ jsxs10("div", { className: "mt-1.5 gap-1.5", children: [
1192
+ helperText && /* @__PURE__ */ jsx15("p", { className: "text-sm text-text-500", children: helperText }),
1193
+ errorMessage && /* @__PURE__ */ jsxs10("p", { className: "flex gap-1 items-center text-sm text-indicator-error", children: [
1194
+ /* @__PURE__ */ jsx15(WarningCircle3, { size: 16 }),
1195
+ " ",
1196
+ errorMessage
1197
+ ] })
1198
+ ] })
1199
+ ] });
1200
+ }
1201
+ );
1202
+ var Input_default = Input;
1203
+
1016
1204
  // src/components/DropdownMenu/DropdownMenu.tsx
1017
1205
  import {
1018
1206
  createContext,
1019
- useState as useState3,
1207
+ useState as useState4,
1020
1208
  useCallback,
1021
1209
  useContext,
1022
- forwardRef as forwardRef7,
1210
+ forwardRef as forwardRef8,
1023
1211
  useEffect,
1024
1212
  useRef,
1025
- useMemo
1213
+ useMemo as useMemo2
1026
1214
  } from "react";
1027
- import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
1215
+ import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
1028
1216
  var DropdownMenuContext = createContext(
1029
1217
  void 0
1030
1218
  );
1031
1219
  var DropdownMenu = ({ children, open, onOpenChange }) => {
1032
- const [internalOpen, setInternalOpen] = useState3(false);
1220
+ const [internalOpen, setInternalOpen] = useState4(false);
1033
1221
  const isControlled = open !== void 0;
1034
1222
  const currentOpen = isControlled ? open : internalOpen;
1035
1223
  const setOpen = useCallback(
@@ -1083,18 +1271,18 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
1083
1271
  document.removeEventListener("keydown", handleDownkey);
1084
1272
  };
1085
1273
  }, [currentOpen]);
1086
- const value = useMemo(
1274
+ const value = useMemo2(
1087
1275
  () => ({ open: currentOpen, setOpen }),
1088
1276
  [currentOpen, setOpen]
1089
1277
  );
1090
- return /* @__PURE__ */ jsx14(DropdownMenuContext.Provider, { value, children: /* @__PURE__ */ jsx14("div", { className: "relative", ref: menuRef, children }) });
1278
+ return /* @__PURE__ */ jsx16(DropdownMenuContext.Provider, { value, children: /* @__PURE__ */ jsx16("div", { className: "relative", ref: menuRef, children }) });
1091
1279
  };
1092
- var DropdownMenuTrigger = forwardRef7(({ className, children, onClick, ...props }, ref) => {
1280
+ var DropdownMenuTrigger = forwardRef8(({ className, children, onClick, ...props }, ref) => {
1093
1281
  const context = useContext(DropdownMenuContext);
1094
1282
  if (!context)
1095
1283
  throw new Error("DropdownMenuTrigger must be used within a DropdownMenu");
1096
1284
  const { open, setOpen } = context;
1097
- return /* @__PURE__ */ jsx14(
1285
+ return /* @__PURE__ */ jsx16(
1098
1286
  "button",
1099
1287
  {
1100
1288
  ref,
@@ -1126,7 +1314,7 @@ var ALIGN_CLASSES = {
1126
1314
  center: "left-1/2 -translate-x-1/2",
1127
1315
  end: "right-0"
1128
1316
  };
1129
- var MenuLabel = forwardRef7(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx14(
1317
+ var MenuLabel = forwardRef8(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx16(
1130
1318
  "fieldset",
1131
1319
  {
1132
1320
  ref,
@@ -1136,7 +1324,7 @@ var MenuLabel = forwardRef7(({ className, inset, ...props }, ref) => /* @__PURE_
1136
1324
  }
1137
1325
  ));
1138
1326
  MenuLabel.displayName = "MenuLabel";
1139
- var MenuContent = forwardRef7(
1327
+ var MenuContent = forwardRef8(
1140
1328
  ({
1141
1329
  className,
1142
1330
  align = "start",
@@ -1146,7 +1334,7 @@ var MenuContent = forwardRef7(
1146
1334
  ...props
1147
1335
  }, ref) => {
1148
1336
  const { open } = useContext(DropdownMenuContext);
1149
- const [isVisible, setIsVisible] = useState3(open);
1337
+ const [isVisible, setIsVisible] = useState4(open);
1150
1338
  useEffect(() => {
1151
1339
  if (open) {
1152
1340
  setIsVisible(true);
@@ -1161,7 +1349,7 @@ var MenuContent = forwardRef7(
1161
1349
  const horizontal = ALIGN_CLASSES[align];
1162
1350
  return `absolute ${vertical} ${horizontal}`;
1163
1351
  };
1164
- return /* @__PURE__ */ jsx14(
1352
+ return /* @__PURE__ */ jsx16(
1165
1353
  "div",
1166
1354
  {
1167
1355
  ref,
@@ -1185,7 +1373,7 @@ var MenuContent = forwardRef7(
1185
1373
  }
1186
1374
  );
1187
1375
  MenuContent.displayName = "MenuContent";
1188
- var MenuItem = forwardRef7(
1376
+ var MenuItem = forwardRef8(
1189
1377
  ({
1190
1378
  className,
1191
1379
  inset,
@@ -1206,7 +1394,7 @@ var MenuItem = forwardRef7(
1206
1394
  }
1207
1395
  onClick?.(e);
1208
1396
  };
1209
- return /* @__PURE__ */ jsxs10(
1397
+ return /* @__PURE__ */ jsxs11(
1210
1398
  "div",
1211
1399
  {
1212
1400
  ref,
@@ -1236,7 +1424,7 @@ var MenuItem = forwardRef7(
1236
1424
  }
1237
1425
  );
1238
1426
  MenuItem.displayName = "MenuItem";
1239
- var MenuSeparator = forwardRef7(({ className, ...props }, ref) => /* @__PURE__ */ jsx14(
1427
+ var MenuSeparator = forwardRef8(({ className, ...props }, ref) => /* @__PURE__ */ jsx16(
1240
1428
  "div",
1241
1429
  {
1242
1430
  ref,
@@ -1251,6 +1439,7 @@ export {
1251
1439
  Badge_default as Badge,
1252
1440
  Button_default as Button,
1253
1441
  CheckBox_default as CheckBox,
1442
+ Divider_default as Divider,
1254
1443
  DropdownMenu_default as DropdownMenu,
1255
1444
  MenuContent as DropdownMenuContent,
1256
1445
  MenuItem as DropdownMenuItem,
@@ -1259,6 +1448,7 @@ export {
1259
1448
  DropdownMenuTrigger,
1260
1449
  IconButton_default as IconButton,
1261
1450
  IconRoundedButton_default as IconRoundedButton,
1451
+ Input_default as Input,
1262
1452
  NavButton_default as NavButton,
1263
1453
  SelectionButton_default as SelectionButton,
1264
1454
  Table_default as Table,