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.css +91 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +56 -2
- package/dist/index.d.ts +56 -2
- package/dist/index.js +208 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +206 -16
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +91 -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
|
+
Divider: () => Divider_default,
|
|
27
28
|
DropdownMenu: () => DropdownMenu_default,
|
|
28
29
|
DropdownMenuContent: () => MenuContent,
|
|
29
30
|
DropdownMenuItem: () => MenuItem,
|
|
@@ -32,6 +33,7 @@ __export(src_exports, {
|
|
|
32
33
|
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
33
34
|
IconButton: () => IconButton_default,
|
|
34
35
|
IconRoundedButton: () => IconRoundedButton_default,
|
|
36
|
+
Input: () => Input_default,
|
|
35
37
|
NavButton: () => NavButton_default,
|
|
36
38
|
SelectionButton: () => SelectionButton_default,
|
|
37
39
|
Table: () => Table_default,
|
|
@@ -1050,24 +1052,207 @@ var Toaster = () => {
|
|
|
1050
1052
|
};
|
|
1051
1053
|
var Toaster_default = Toaster;
|
|
1052
1054
|
|
|
1053
|
-
// src/components/
|
|
1054
|
-
var import_react7 = require("react");
|
|
1055
|
+
// src/components/Divider/Divider.tsx
|
|
1055
1056
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1056
|
-
var
|
|
1057
|
+
var Divider = ({
|
|
1058
|
+
orientation = "horizontal",
|
|
1059
|
+
className = "",
|
|
1060
|
+
...props
|
|
1061
|
+
}) => {
|
|
1062
|
+
const baseClasses = "bg-border-200 border-0";
|
|
1063
|
+
const orientationClasses = {
|
|
1064
|
+
horizontal: "w-full h-px",
|
|
1065
|
+
vertical: "h-full w-px"
|
|
1066
|
+
};
|
|
1067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1068
|
+
"hr",
|
|
1069
|
+
{
|
|
1070
|
+
className: `${baseClasses} ${orientationClasses[orientation]} ${className}`,
|
|
1071
|
+
"aria-orientation": orientation,
|
|
1072
|
+
...props
|
|
1073
|
+
}
|
|
1074
|
+
);
|
|
1075
|
+
};
|
|
1076
|
+
var Divider_default = Divider;
|
|
1077
|
+
|
|
1078
|
+
// src/components/Input/Input.tsx
|
|
1079
|
+
var import_phosphor_react5 = require("phosphor-react");
|
|
1080
|
+
var import_react7 = require("react");
|
|
1081
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1082
|
+
var SIZE_CLASSES5 = {
|
|
1083
|
+
small: "text-sm",
|
|
1084
|
+
medium: "text-md",
|
|
1085
|
+
large: "text-lg",
|
|
1086
|
+
"extra-large": "text-xl"
|
|
1087
|
+
};
|
|
1088
|
+
var STATE_CLASSES3 = {
|
|
1089
|
+
default: "border-border-300 placeholder:text-text-600 hover:border-border-400",
|
|
1090
|
+
error: "border-2 border-indicator-error placeholder:text-text-600",
|
|
1091
|
+
disabled: "border-border-300 placeholder:text-text-600 cursor-not-allowed opacity-40",
|
|
1092
|
+
"read-only": "border-border-300 !text-text-600 cursor-default focus:outline-none bg-background-50"
|
|
1093
|
+
};
|
|
1094
|
+
var VARIANT_CLASSES = {
|
|
1095
|
+
outlined: "border rounded-lg",
|
|
1096
|
+
underlined: "border-0 border-b rounded-none bg-transparent focus:outline-none focus:border-primary-950 focus:border-b-2",
|
|
1097
|
+
rounded: "border rounded-full"
|
|
1098
|
+
};
|
|
1099
|
+
var getActualState = (disabled, readOnly, errorMessage, state) => {
|
|
1100
|
+
if (disabled) return "disabled";
|
|
1101
|
+
if (readOnly) return "read-only";
|
|
1102
|
+
if (errorMessage) return "error";
|
|
1103
|
+
return state || "default";
|
|
1104
|
+
};
|
|
1105
|
+
var getIconSize = (size) => {
|
|
1106
|
+
const iconSizeClasses = {
|
|
1107
|
+
small: "w-4 h-4",
|
|
1108
|
+
medium: "w-5 h-5",
|
|
1109
|
+
large: "w-6 h-6",
|
|
1110
|
+
"extra-large": "w-7 h-7"
|
|
1111
|
+
};
|
|
1112
|
+
return iconSizeClasses[size] || iconSizeClasses.medium;
|
|
1113
|
+
};
|
|
1114
|
+
var getPasswordToggleConfig = (type, disabled, readOnly, showPassword, iconRight) => {
|
|
1115
|
+
const isPasswordType = type === "password";
|
|
1116
|
+
const shouldShowPasswordToggle = isPasswordType && !disabled && !readOnly;
|
|
1117
|
+
let actualIconRight = iconRight;
|
|
1118
|
+
let ariaLabel;
|
|
1119
|
+
if (shouldShowPasswordToggle) {
|
|
1120
|
+
actualIconRight = showPassword ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_phosphor_react5.EyeSlash, {}) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_phosphor_react5.Eye, {});
|
|
1121
|
+
ariaLabel = showPassword ? "Ocultar senha" : "Mostrar senha";
|
|
1122
|
+
}
|
|
1123
|
+
return { shouldShowPasswordToggle, actualIconRight, ariaLabel };
|
|
1124
|
+
};
|
|
1125
|
+
var getCombinedClasses = (actualState, variant) => {
|
|
1126
|
+
const stateClasses = STATE_CLASSES3[actualState];
|
|
1127
|
+
const variantClasses = VARIANT_CLASSES[variant];
|
|
1128
|
+
if (actualState === "error" && variant === "underlined") {
|
|
1129
|
+
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
|
+
}
|
|
1131
|
+
return `${stateClasses} ${variantClasses}`;
|
|
1132
|
+
};
|
|
1133
|
+
var Input = (0, import_react7.forwardRef)(
|
|
1134
|
+
({
|
|
1135
|
+
label,
|
|
1136
|
+
helperText,
|
|
1137
|
+
errorMessage,
|
|
1138
|
+
size = "medium",
|
|
1139
|
+
variant = "outlined",
|
|
1140
|
+
state = "default",
|
|
1141
|
+
iconLeft,
|
|
1142
|
+
iconRight,
|
|
1143
|
+
className = "",
|
|
1144
|
+
containerClassName = "",
|
|
1145
|
+
disabled,
|
|
1146
|
+
readOnly,
|
|
1147
|
+
id,
|
|
1148
|
+
type = "text",
|
|
1149
|
+
...props
|
|
1150
|
+
}, ref) => {
|
|
1151
|
+
const [showPassword, setShowPassword] = (0, import_react7.useState)(false);
|
|
1152
|
+
const isPasswordType = type === "password";
|
|
1153
|
+
const actualType = isPasswordType && showPassword ? "text" : type;
|
|
1154
|
+
const actualState = getActualState(disabled, readOnly, errorMessage, state);
|
|
1155
|
+
const sizeClasses = SIZE_CLASSES5[size];
|
|
1156
|
+
const combinedClasses = (0, import_react7.useMemo)(
|
|
1157
|
+
() => getCombinedClasses(actualState, variant),
|
|
1158
|
+
[actualState, variant]
|
|
1159
|
+
);
|
|
1160
|
+
const iconSize = getIconSize(size);
|
|
1161
|
+
const baseClasses = "bg-background w-full py-2 px-3 font-normal text-text-900 focus:outline-primary-950";
|
|
1162
|
+
const generatedId = (0, import_react7.useId)();
|
|
1163
|
+
const inputId = id ?? `input-${generatedId}`;
|
|
1164
|
+
const togglePasswordVisibility = () => setShowPassword(!showPassword);
|
|
1165
|
+
const { shouldShowPasswordToggle, actualIconRight, ariaLabel } = getPasswordToggleConfig(
|
|
1166
|
+
type,
|
|
1167
|
+
disabled,
|
|
1168
|
+
readOnly,
|
|
1169
|
+
showPassword,
|
|
1170
|
+
iconRight
|
|
1171
|
+
);
|
|
1172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `${containerClassName}`, children: [
|
|
1173
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1174
|
+
"label",
|
|
1175
|
+
{
|
|
1176
|
+
htmlFor: inputId,
|
|
1177
|
+
className: `block font-bold text-text-900 mb-1.5 ${sizeClasses}`,
|
|
1178
|
+
children: label
|
|
1179
|
+
}
|
|
1180
|
+
),
|
|
1181
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative", children: [
|
|
1182
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "absolute left-3 top-1/2 transform -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1183
|
+
"span",
|
|
1184
|
+
{
|
|
1185
|
+
className: `${iconSize} text-text-400 flex items-center justify-center`,
|
|
1186
|
+
children: iconLeft
|
|
1187
|
+
}
|
|
1188
|
+
) }),
|
|
1189
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1190
|
+
"input",
|
|
1191
|
+
{
|
|
1192
|
+
ref,
|
|
1193
|
+
id: inputId,
|
|
1194
|
+
type: actualType,
|
|
1195
|
+
className: `${baseClasses} ${sizeClasses} ${combinedClasses} ${iconLeft ? "pl-10" : ""} ${actualIconRight ? "pr-10" : ""} ${className}`,
|
|
1196
|
+
disabled,
|
|
1197
|
+
readOnly,
|
|
1198
|
+
"aria-invalid": actualState === "error" ? "true" : void 0,
|
|
1199
|
+
...props
|
|
1200
|
+
}
|
|
1201
|
+
),
|
|
1202
|
+
actualIconRight && (shouldShowPasswordToggle ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1203
|
+
"button",
|
|
1204
|
+
{
|
|
1205
|
+
type: "button",
|
|
1206
|
+
className: "absolute right-3 top-1/2 transform -translate-y-1/2 cursor-pointer border-0 bg-transparent p-0",
|
|
1207
|
+
onClick: togglePasswordVisibility,
|
|
1208
|
+
"aria-label": ariaLabel,
|
|
1209
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1210
|
+
"span",
|
|
1211
|
+
{
|
|
1212
|
+
className: `${iconSize} text-text-400 flex items-center justify-center hover:text-text-600 transition-colors`,
|
|
1213
|
+
children: actualIconRight
|
|
1214
|
+
}
|
|
1215
|
+
)
|
|
1216
|
+
}
|
|
1217
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1218
|
+
"span",
|
|
1219
|
+
{
|
|
1220
|
+
className: `${iconSize} text-text-400 flex items-center justify-center`,
|
|
1221
|
+
children: actualIconRight
|
|
1222
|
+
}
|
|
1223
|
+
) }))
|
|
1224
|
+
] }),
|
|
1225
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "mt-1.5 gap-1.5", children: [
|
|
1226
|
+
helperText && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-sm text-text-500", children: helperText }),
|
|
1227
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "flex gap-1 items-center text-sm text-indicator-error", children: [
|
|
1228
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_phosphor_react5.WarningCircle, { size: 16 }),
|
|
1229
|
+
" ",
|
|
1230
|
+
errorMessage
|
|
1231
|
+
] })
|
|
1232
|
+
] })
|
|
1233
|
+
] });
|
|
1234
|
+
}
|
|
1235
|
+
);
|
|
1236
|
+
var Input_default = Input;
|
|
1237
|
+
|
|
1238
|
+
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
1239
|
+
var import_react8 = require("react");
|
|
1240
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1241
|
+
var DropdownMenuContext = (0, import_react8.createContext)(
|
|
1057
1242
|
void 0
|
|
1058
1243
|
);
|
|
1059
1244
|
var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
1060
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
1245
|
+
const [internalOpen, setInternalOpen] = (0, import_react8.useState)(false);
|
|
1061
1246
|
const isControlled = open !== void 0;
|
|
1062
1247
|
const currentOpen = isControlled ? open : internalOpen;
|
|
1063
|
-
const setOpen = (0,
|
|
1248
|
+
const setOpen = (0, import_react8.useCallback)(
|
|
1064
1249
|
(newOpen) => {
|
|
1065
1250
|
if (onOpenChange) onOpenChange(newOpen);
|
|
1066
1251
|
if (!isControlled) setInternalOpen(newOpen);
|
|
1067
1252
|
},
|
|
1068
1253
|
[isControlled, onOpenChange]
|
|
1069
1254
|
);
|
|
1070
|
-
const menuRef = (0,
|
|
1255
|
+
const menuRef = (0, import_react8.useRef)(null);
|
|
1071
1256
|
const handleArrowDownOrArrowUp = (event) => {
|
|
1072
1257
|
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
1073
1258
|
if (menuContent) {
|
|
@@ -1101,7 +1286,7 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
1101
1286
|
setOpen(false);
|
|
1102
1287
|
}
|
|
1103
1288
|
};
|
|
1104
|
-
(0,
|
|
1289
|
+
(0, import_react8.useEffect)(() => {
|
|
1105
1290
|
if (currentOpen) {
|
|
1106
1291
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1107
1292
|
document.addEventListener("keydown", handleDownkey);
|
|
@@ -1111,18 +1296,18 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
1111
1296
|
document.removeEventListener("keydown", handleDownkey);
|
|
1112
1297
|
};
|
|
1113
1298
|
}, [currentOpen]);
|
|
1114
|
-
const value = (0,
|
|
1299
|
+
const value = (0, import_react8.useMemo)(
|
|
1115
1300
|
() => ({ open: currentOpen, setOpen }),
|
|
1116
1301
|
[currentOpen, setOpen]
|
|
1117
1302
|
);
|
|
1118
|
-
return /* @__PURE__ */ (0,
|
|
1303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownMenuContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "relative", ref: menuRef, children }) });
|
|
1119
1304
|
};
|
|
1120
|
-
var DropdownMenuTrigger = (0,
|
|
1121
|
-
const context = (0,
|
|
1305
|
+
var DropdownMenuTrigger = (0, import_react8.forwardRef)(({ className, children, onClick, ...props }, ref) => {
|
|
1306
|
+
const context = (0, import_react8.useContext)(DropdownMenuContext);
|
|
1122
1307
|
if (!context)
|
|
1123
1308
|
throw new Error("DropdownMenuTrigger must be used within a DropdownMenu");
|
|
1124
1309
|
const { open, setOpen } = context;
|
|
1125
|
-
return /* @__PURE__ */ (0,
|
|
1310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1126
1311
|
"button",
|
|
1127
1312
|
{
|
|
1128
1313
|
ref,
|
|
@@ -1154,7 +1339,7 @@ var ALIGN_CLASSES = {
|
|
|
1154
1339
|
center: "left-1/2 -translate-x-1/2",
|
|
1155
1340
|
end: "right-0"
|
|
1156
1341
|
};
|
|
1157
|
-
var MenuLabel = (0,
|
|
1342
|
+
var MenuLabel = (0, import_react8.forwardRef)(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1158
1343
|
"fieldset",
|
|
1159
1344
|
{
|
|
1160
1345
|
ref,
|
|
@@ -1164,7 +1349,7 @@ var MenuLabel = (0, import_react7.forwardRef)(({ className, inset, ...props }, r
|
|
|
1164
1349
|
}
|
|
1165
1350
|
));
|
|
1166
1351
|
MenuLabel.displayName = "MenuLabel";
|
|
1167
|
-
var MenuContent = (0,
|
|
1352
|
+
var MenuContent = (0, import_react8.forwardRef)(
|
|
1168
1353
|
({
|
|
1169
1354
|
className,
|
|
1170
1355
|
align = "start",
|
|
@@ -1173,9 +1358,9 @@ var MenuContent = (0, import_react7.forwardRef)(
|
|
|
1173
1358
|
children,
|
|
1174
1359
|
...props
|
|
1175
1360
|
}, ref) => {
|
|
1176
|
-
const { open } = (0,
|
|
1177
|
-
const [isVisible, setIsVisible] = (0,
|
|
1178
|
-
(0,
|
|
1361
|
+
const { open } = (0, import_react8.useContext)(DropdownMenuContext);
|
|
1362
|
+
const [isVisible, setIsVisible] = (0, import_react8.useState)(open);
|
|
1363
|
+
(0, import_react8.useEffect)(() => {
|
|
1179
1364
|
if (open) {
|
|
1180
1365
|
setIsVisible(true);
|
|
1181
1366
|
} else {
|
|
@@ -1189,7 +1374,7 @@ var MenuContent = (0, import_react7.forwardRef)(
|
|
|
1189
1374
|
const horizontal = ALIGN_CLASSES[align];
|
|
1190
1375
|
return `absolute ${vertical} ${horizontal}`;
|
|
1191
1376
|
};
|
|
1192
|
-
return /* @__PURE__ */ (0,
|
|
1377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1193
1378
|
"div",
|
|
1194
1379
|
{
|
|
1195
1380
|
ref,
|
|
@@ -1213,7 +1398,7 @@ var MenuContent = (0, import_react7.forwardRef)(
|
|
|
1213
1398
|
}
|
|
1214
1399
|
);
|
|
1215
1400
|
MenuContent.displayName = "MenuContent";
|
|
1216
|
-
var MenuItem = (0,
|
|
1401
|
+
var MenuItem = (0, import_react8.forwardRef)(
|
|
1217
1402
|
({
|
|
1218
1403
|
className,
|
|
1219
1404
|
inset,
|
|
@@ -1234,7 +1419,7 @@ var MenuItem = (0, import_react7.forwardRef)(
|
|
|
1234
1419
|
}
|
|
1235
1420
|
onClick?.(e);
|
|
1236
1421
|
};
|
|
1237
|
-
return /* @__PURE__ */ (0,
|
|
1422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1238
1423
|
"div",
|
|
1239
1424
|
{
|
|
1240
1425
|
ref,
|
|
@@ -1264,7 +1449,7 @@ var MenuItem = (0, import_react7.forwardRef)(
|
|
|
1264
1449
|
}
|
|
1265
1450
|
);
|
|
1266
1451
|
MenuItem.displayName = "MenuItem";
|
|
1267
|
-
var MenuSeparator = (0,
|
|
1452
|
+
var MenuSeparator = (0, import_react8.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1268
1453
|
"div",
|
|
1269
1454
|
{
|
|
1270
1455
|
ref,
|
|
@@ -1280,6 +1465,7 @@ var DropdownMenu_default = DropdownMenu;
|
|
|
1280
1465
|
Badge,
|
|
1281
1466
|
Button,
|
|
1282
1467
|
CheckBox,
|
|
1468
|
+
Divider,
|
|
1283
1469
|
DropdownMenu,
|
|
1284
1470
|
DropdownMenuContent,
|
|
1285
1471
|
DropdownMenuItem,
|
|
@@ -1288,6 +1474,7 @@ var DropdownMenu_default = DropdownMenu;
|
|
|
1288
1474
|
DropdownMenuTrigger,
|
|
1289
1475
|
IconButton,
|
|
1290
1476
|
IconRoundedButton,
|
|
1477
|
+
Input,
|
|
1291
1478
|
NavButton,
|
|
1292
1479
|
SelectionButton,
|
|
1293
1480
|
Table,
|