@octoguide/mui-ui-toolkit 0.1.0 → 0.2.0

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
@@ -1162,11 +1162,17 @@ var CardActions = MuiCardActions;
1162
1162
  Card.displayName = "ToolkitCard";
1163
1163
 
1164
1164
  // src/components/TextField/TextField.tsx
1165
+ import React, { useState } from "react";
1165
1166
  import {
1166
- TextField as MuiTextField
1167
+ TextField as MuiTextField,
1168
+ InputAdornment,
1169
+ IconButton,
1170
+ SvgIcon as SvgIcon2
1167
1171
  } from "@mui/material";
1168
1172
  import { styled as styled3 } from "@mui/material/styles";
1169
1173
  import { jsx as jsx5 } from "react/jsx-runtime";
1174
+ var VisibilityIcon = /* @__PURE__ */ jsx5(SvgIcon2, { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx5("path", { fill: "currentColor", d: "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3" }) });
1175
+ var VisibilityOffIcon = /* @__PURE__ */ jsx5(SvgIcon2, { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx5("path", { fill: "currentColor", d: "M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75C21.27 5.61 17 2.5 12 2.5c-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 5.13 11.35 5 12 5M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27M7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01" }) });
1170
1176
  var StyledTextField = styled3(MuiTextField)(({ theme }) => ({
1171
1177
  // Transition on the entire field when focus changes
1172
1178
  "& .MuiOutlinedInput-root": {
@@ -1176,38 +1182,55 @@ var StyledTextField = styled3(MuiTextField)(({ theme }) => ({
1176
1182
  }
1177
1183
  }
1178
1184
  }));
1179
- function TextField({ error, FormHelperTextProps, inputProps, label, ...props }) {
1180
- if (process.env.NODE_ENV !== "production") {
1181
- if (!label && !props["aria-label"] && !props["aria-labelledby"] && !inputProps?.["aria-label"] && !inputProps?.["aria-labelledby"]) {
1182
- console.warn("[ToolkitTextField] Missing accessible label. Provide `label`, `aria-label`, or `aria-labelledby`.");
1185
+ var TextField = React.forwardRef(
1186
+ function TextField2({ error, FormHelperTextProps, inputProps, label, showPasswordToggle, type, slotProps, ...props }, ref) {
1187
+ const [showPassword, setShowPassword] = useState(false);
1188
+ if (process.env.NODE_ENV !== "production") {
1189
+ if (!label && !props["aria-label"] && !props["aria-labelledby"] && !inputProps?.["aria-label"] && !inputProps?.["aria-labelledby"]) {
1190
+ console.warn("[ToolkitTextField] Missing accessible label. Provide `label`, `aria-label`, or `aria-labelledby`.");
1191
+ }
1183
1192
  }
1193
+ const resolvedType = showPasswordToggle && type === "password" ? showPassword ? "text" : "password" : type;
1194
+ const toggleAdornment = showPasswordToggle && type === "password" ? /* @__PURE__ */ jsx5(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx5(
1195
+ IconButton,
1196
+ {
1197
+ "aria-label": showPassword ? "Hide password" : "Show password",
1198
+ onClick: () => setShowPassword((prev) => !prev),
1199
+ edge: "end",
1200
+ children: showPassword ? VisibilityOffIcon : VisibilityIcon
1201
+ }
1202
+ ) }) : null;
1203
+ const mergedSlotProps = toggleAdornment ? { ...slotProps, input: { endAdornment: toggleAdornment, ...slotProps?.input } } : slotProps;
1204
+ return /* @__PURE__ */ jsx5(
1205
+ StyledTextField,
1206
+ {
1207
+ fullWidth: true,
1208
+ variant: "outlined",
1209
+ label,
1210
+ error,
1211
+ type: resolvedType,
1212
+ inputRef: ref,
1213
+ inputProps,
1214
+ slotProps: mergedSlotProps,
1215
+ FormHelperTextProps: error ? { role: "alert", ...FormHelperTextProps } : FormHelperTextProps,
1216
+ ...props
1217
+ }
1218
+ );
1184
1219
  }
1185
- return /* @__PURE__ */ jsx5(
1186
- StyledTextField,
1187
- {
1188
- fullWidth: true,
1189
- variant: "outlined",
1190
- label,
1191
- error,
1192
- inputProps,
1193
- FormHelperTextProps: error ? { role: "alert", ...FormHelperTextProps } : FormHelperTextProps,
1194
- ...props
1195
- }
1196
- );
1197
- }
1220
+ );
1198
1221
  TextField.displayName = "ToolkitTextField";
1199
1222
 
1200
1223
  // src/components/Alert/Alert.tsx
1201
1224
  import {
1202
1225
  Alert as MuiAlert,
1203
1226
  AlertTitle as MuiAlertTitle,
1204
- SvgIcon as SvgIcon2
1227
+ SvgIcon as SvgIcon3
1205
1228
  } from "@mui/material";
1206
1229
  import { jsx as jsx6 } from "react/jsx-runtime";
1207
- var InfoIcon = /* @__PURE__ */ jsx6(SvgIcon2, { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx6("path", { fill: "currentColor", fillRule: "evenodd", d: "M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2s10 4.477 10 10m-10 5.75a.75.75 0 0 0 .75-.75v-6a.75.75 0 0 0-1.5 0v6c0 .414.336.75.75.75M12 7a1 1 0 1 1 0 2a1 1 0 0 1 0-2", clipRule: "evenodd" }) });
1208
- var SuccessIcon = /* @__PURE__ */ jsx6(SvgIcon2, { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx6("path", { fill: "currentColor", fillRule: "evenodd", d: "M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2s10 4.477 10 10m-5.97-3.03a.75.75 0 0 1 0 1.06l-5 5a.75.75 0 0 1-1.06 0l-2-2a.75.75 0 1 1 1.06-1.06l1.47 1.47l2.235-2.235L14.97 8.97a.75.75 0 0 1 1.06 0", clipRule: "evenodd" }) });
1209
- var WarningIcon = /* @__PURE__ */ jsx6(SvgIcon2, { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx6("path", { fill: "currentColor", fillRule: "evenodd", d: "M5.312 10.762C8.23 5.587 9.689 3 12 3c2.31 0 3.77 2.587 6.688 7.762l.364.644c2.425 4.3 3.638 6.45 2.542 8.022S17.786 21 12.364 21h-.728c-5.422 0-8.134 0-9.23-1.572s.117-3.722 2.542-8.022zM12 7.25a.75.75 0 0 1 .75.75v5a.75.75 0 0 1-1.5 0V8a.75.75 0 0 1 .75-.75M12 17a1 1 0 1 0 0-2a1 1 0 0 0 0 2", clipRule: "evenodd" }) });
1210
- var ErrorIcon = /* @__PURE__ */ jsx6(SvgIcon2, { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx6("path", { fill: "currentColor", fillRule: "evenodd", d: "M7.843 3.802C9.872 2.601 10.886 2 12 2c1.114 0 2.128.6 4.157 1.802l.686.406c2.029 1.202 3.043 1.803 3.6 2.792c.557.99.557 2.19.557 4.594v.812c0 2.403 0 3.605-.557 4.594c-.557.99-1.571 1.59-3.6 2.791l-.686.407C14.128 21.399 13.114 22 12 22c-1.114 0-2.128-.6-4.157-1.802l-.686-.407c-2.029-1.2-3.043-1.802-3.6-2.791C3 16.01 3 14.81 3 12.406v-.812C3 9.19 3 7.989 3.557 7c.557-.99 1.571-1.59 3.6-2.792zM13 16a1 1 0 1 1-2 0a1 1 0 0 1 2 0m-1-9.75a.75.75 0 0 1 .75.75v6a.75.75 0 0 1-1.5 0V7a.75.75 0 0 1 .75-.75", clipRule: "evenodd" }) });
1230
+ var InfoIcon = /* @__PURE__ */ jsx6(SvgIcon3, { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx6("path", { fill: "currentColor", fillRule: "evenodd", d: "M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2s10 4.477 10 10m-10 5.75a.75.75 0 0 0 .75-.75v-6a.75.75 0 0 0-1.5 0v6c0 .414.336.75.75.75M12 7a1 1 0 1 1 0 2a1 1 0 0 1 0-2", clipRule: "evenodd" }) });
1231
+ var SuccessIcon = /* @__PURE__ */ jsx6(SvgIcon3, { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx6("path", { fill: "currentColor", fillRule: "evenodd", d: "M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2s10 4.477 10 10m-5.97-3.03a.75.75 0 0 1 0 1.06l-5 5a.75.75 0 0 1-1.06 0l-2-2a.75.75 0 1 1 1.06-1.06l1.47 1.47l2.235-2.235L14.97 8.97a.75.75 0 0 1 1.06 0", clipRule: "evenodd" }) });
1232
+ var WarningIcon = /* @__PURE__ */ jsx6(SvgIcon3, { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx6("path", { fill: "currentColor", fillRule: "evenodd", d: "M5.312 10.762C8.23 5.587 9.689 3 12 3c2.31 0 3.77 2.587 6.688 7.762l.364.644c2.425 4.3 3.638 6.45 2.542 8.022S17.786 21 12.364 21h-.728c-5.422 0-8.134 0-9.23-1.572s.117-3.722 2.542-8.022zM12 7.25a.75.75 0 0 1 .75.75v5a.75.75 0 0 1-1.5 0V8a.75.75 0 0 1 .75-.75M12 17a1 1 0 1 0 0-2a1 1 0 0 0 0 2", clipRule: "evenodd" }) });
1233
+ var ErrorIcon = /* @__PURE__ */ jsx6(SvgIcon3, { viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx6("path", { fill: "currentColor", fillRule: "evenodd", d: "M7.843 3.802C9.872 2.601 10.886 2 12 2c1.114 0 2.128.6 4.157 1.802l.686.406c2.029 1.202 3.043 1.803 3.6 2.792c.557.99.557 2.19.557 4.594v.812c0 2.403 0 3.605-.557 4.594c-.557.99-1.571 1.59-3.6 2.791l-.686.407C14.128 21.399 13.114 22 12 22c-1.114 0-2.128-.6-4.157-1.802l-.686-.407c-2.029-1.2-3.043-1.802-3.6-2.791C3 16.01 3 14.81 3 12.406v-.812C3 9.19 3 7.989 3.557 7c.557-.99 1.571-1.59 3.6-2.792zM13 16a1 1 0 1 1-2 0a1 1 0 0 1 2 0m-1-9.75a.75.75 0 0 1 .75.75v6a.75.75 0 0 1-1.5 0V7a.75.75 0 0 1 .75-.75", clipRule: "evenodd" }) });
1211
1234
  var defaultIconMapping = {
1212
1235
  info: InfoIcon,
1213
1236
  success: SuccessIcon,
@@ -1307,7 +1330,7 @@ function ToggleButtonGroup(props) {
1307
1330
  ToggleButtonGroup.displayName = "ToolkitToggleButtonGroup";
1308
1331
 
1309
1332
  // src/components/DatePicker/DatePicker.tsx
1310
- import { useState } from "react";
1333
+ import { useState as useState2 } from "react";
1311
1334
  import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
1312
1335
  import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
1313
1336
  import {
@@ -1363,7 +1386,7 @@ import DialogContent from "@mui/material/DialogContent";
1363
1386
  import DialogActions from "@mui/material/DialogActions";
1364
1387
  import Button2 from "@mui/material/Button";
1365
1388
  import Box from "@mui/material/Box";
1366
- import TextField2 from "@mui/material/TextField";
1389
+ import TextField3 from "@mui/material/TextField";
1367
1390
  import { styled as styled6 } from "@mui/material/styles";
1368
1391
  import { Fragment, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
1369
1392
  function DateLocalizationProvider({ children }) {
@@ -1446,8 +1469,8 @@ function DateRangePickerInput({
1446
1469
  endLabel = "End date",
1447
1470
  buttonLabel = "Click me!"
1448
1471
  }) {
1449
- const [open, setOpen] = useState(false);
1450
- const [draft, setDraft] = useState(value);
1472
+ const [open, setOpen] = useState2(false);
1473
+ const [draft, setDraft] = useState2(value);
1451
1474
  const handleOpen = () => {
1452
1475
  setDraft(value);
1453
1476
  setOpen(true);
@@ -1493,9 +1516,9 @@ function DateRangePickerCalendar({
1493
1516
  onChange,
1494
1517
  buttonLabel = "Click me!"
1495
1518
  }) {
1496
- const [open, setOpen] = useState(false);
1497
- const [draft, setDraft] = useState(value);
1498
- const [selecting, setSelecting] = useState("start");
1519
+ const [open, setOpen] = useState2(false);
1520
+ const [draft, setDraft] = useState2(value);
1521
+ const [selecting, setSelecting] = useState2("start");
1499
1522
  const handleOpen = () => {
1500
1523
  setDraft(value);
1501
1524
  setSelecting("start");
@@ -1519,7 +1542,7 @@ function DateRangePickerCalendar({
1519
1542
  /* @__PURE__ */ jsxs2(Dialog, { open, onClose: handleCancel, children: [
1520
1543
  /* @__PURE__ */ jsxs2(DialogContent, { sx: { p: 1 }, children: [
1521
1544
  /* @__PURE__ */ jsx10(Box, { sx: { mb: 1, px: 1 }, children: /* @__PURE__ */ jsx10(
1522
- TextField2,
1545
+ TextField3,
1523
1546
  {
1524
1547
  size: "small",
1525
1548
  label: "Selecting",