mayak-common-library 0.0.46 → 0.0.48

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.d.mts CHANGED
@@ -16,7 +16,7 @@ import { SliderProps } from '@mui/material/Slider/Slider';
16
16
  import { MenuItemProps } from '@mui/material/MenuItem/MenuItem';
17
17
  import { InputProps } from '@mui/material/Input';
18
18
  import { PatternFormatProps } from 'react-number-format/types/types';
19
- import { UseControllerProps } from 'react-hook-form';
19
+ import { UseControllerProps, FieldValues } from 'react-hook-form';
20
20
  export { default as MapIcon } from '@/icons/map-search.svg';
21
21
  import { ListProps } from '@mui/material/List/List';
22
22
  import { CheckboxProps } from '@mui/material/Checkbox';
@@ -53,6 +53,7 @@ interface SelectProProps {
53
53
  fullWidth?: boolean;
54
54
  freeChildWidth?: boolean;
55
55
  isOpen?: boolean;
56
+ intermediateChild?: ReactElement;
56
57
  }
57
58
  declare const SelectPro: FC<PropsWithChildren & SelectProProps>;
58
59
 
@@ -215,7 +216,7 @@ type Values = {
215
216
  title: string;
216
217
  }[];
217
218
 
218
- interface ToggleButtonsMultipleProps<T> extends ToggleButtonGroupProps$1 {
219
+ interface ToggleButtonsMultipleProps extends ToggleButtonGroupProps$1 {
219
220
  values: Values;
220
221
  textView?: boolean;
221
222
  collapseOnClick?: boolean;
@@ -223,7 +224,7 @@ interface ToggleButtonsMultipleProps<T> extends ToggleButtonGroupProps$1 {
223
224
  label?: string;
224
225
  flexDirection?: "row" | "col";
225
226
  }
226
- declare const ToggleButtonsWithLabel: <T extends object>(props: ToggleButtonsMultipleProps<T> & UseControllerProps<T>) => react_jsx_runtime.JSX.Element;
227
+ declare const ToggleButtonsWithLabel: <T extends FieldValues>(props: ToggleButtonsMultipleProps & UseControllerProps<T>) => react_jsx_runtime.JSX.Element;
227
228
 
228
229
  declare const ToggleButton: FC<ToggleButtonProps & {
229
230
  textView?: boolean;
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@ import { SliderProps } from '@mui/material/Slider/Slider';
16
16
  import { MenuItemProps } from '@mui/material/MenuItem/MenuItem';
17
17
  import { InputProps } from '@mui/material/Input';
18
18
  import { PatternFormatProps } from 'react-number-format/types/types';
19
- import { UseControllerProps } from 'react-hook-form';
19
+ import { UseControllerProps, FieldValues } from 'react-hook-form';
20
20
  export { default as MapIcon } from '@/icons/map-search.svg';
21
21
  import { ListProps } from '@mui/material/List/List';
22
22
  import { CheckboxProps } from '@mui/material/Checkbox';
@@ -53,6 +53,7 @@ interface SelectProProps {
53
53
  fullWidth?: boolean;
54
54
  freeChildWidth?: boolean;
55
55
  isOpen?: boolean;
56
+ intermediateChild?: ReactElement;
56
57
  }
57
58
  declare const SelectPro: FC<PropsWithChildren & SelectProProps>;
58
59
 
@@ -215,7 +216,7 @@ type Values = {
215
216
  title: string;
216
217
  }[];
217
218
 
218
- interface ToggleButtonsMultipleProps<T> extends ToggleButtonGroupProps$1 {
219
+ interface ToggleButtonsMultipleProps extends ToggleButtonGroupProps$1 {
219
220
  values: Values;
220
221
  textView?: boolean;
221
222
  collapseOnClick?: boolean;
@@ -223,7 +224,7 @@ interface ToggleButtonsMultipleProps<T> extends ToggleButtonGroupProps$1 {
223
224
  label?: string;
224
225
  flexDirection?: "row" | "col";
225
226
  }
226
- declare const ToggleButtonsWithLabel: <T extends object>(props: ToggleButtonsMultipleProps<T> & UseControllerProps<T>) => react_jsx_runtime.JSX.Element;
227
+ declare const ToggleButtonsWithLabel: <T extends FieldValues>(props: ToggleButtonsMultipleProps & UseControllerProps<T>) => react_jsx_runtime.JSX.Element;
227
228
 
228
229
  declare const ToggleButton: FC<ToggleButtonProps & {
229
230
  textView?: boolean;
package/dist/index.js CHANGED
@@ -303,7 +303,8 @@ var SelectPro = ({
303
303
  small = false,
304
304
  fullWidth = false,
305
305
  freeChildWidth = false,
306
- isOpen
306
+ isOpen,
307
+ intermediateChild
307
308
  }) => {
308
309
  const [btn, setAnchorEl] = (0, import_react2.useState)(null);
309
310
  const [open, setOpen] = (0, import_react2.useState)(false);
@@ -368,39 +369,38 @@ var SelectPro = ({
368
369
  ]
369
370
  }
370
371
  ),
371
- btn ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
372
+ btn ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
372
373
  import_material4.Paper,
373
374
  {
374
375
  sx: {
375
376
  position: "absolute",
376
- // width: "min-content",
377
- width: freeChildWidth ? "fit-content" : !fullContainerWidth && btn ? (
378
- // ? "fit-content" //(btn as HTMLButtonElement).offsetWidth
379
- btn.offsetWidth
380
- ) : "100%",
377
+ width: freeChildWidth ? "fit-content" : !fullContainerWidth && btn ? btn.offsetWidth : "100%",
381
378
  left: fullContainerWidth ? 0 : "initial",
382
379
  right: fullContainerWidth ? 0 : "initial",
383
380
  top: overButton ? 0 : "initial"
384
381
  },
385
- className: `select ${open ? "select--open" : "select--close"} z-50 rounded-none shadow-sm`,
386
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material4.Box, { className: `flex flex-col py-3 px-4 gap-2`, children: [
387
- overButton ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
388
- IconButton_default,
389
- {
390
- className: "bg-accent-silver p-1 self-end absolute",
391
- onClick: handleClose,
392
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(close_default, {})
393
- }
394
- ) : null,
395
- childTitle ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
396
- import_material4.Typography,
397
- {
398
- className: "text-sm font-normal text-accent-silver-2",
399
- children: childTitle
400
- }
401
- ) : null,
402
- childrenWithHandleChange
403
- ] })
382
+ className: `select ${open ? "select--open" : "select--close"} z-50 rounded-none shadow-none ${intermediateChild ? "mt-[1px]" : "m-0"}`,
383
+ children: [
384
+ intermediateChild ? intermediateChild : null,
385
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_material4.Box, { className: `flex flex-col py-3 px-4 gap-2 shadow-sm`, children: [
386
+ overButton ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
387
+ IconButton_default,
388
+ {
389
+ className: "bg-accent-silver p-1 self-end absolute",
390
+ onClick: handleClose,
391
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(close_default, {})
392
+ }
393
+ ) : null,
394
+ childTitle ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
395
+ import_material4.Typography,
396
+ {
397
+ className: "text-sm font-normal text-accent-silver-2",
398
+ children: childTitle
399
+ }
400
+ ) : null,
401
+ childrenWithHandleChange
402
+ ] })
403
+ ]
404
404
  }
405
405
  ) : null
406
406
  ] }) });
@@ -413,7 +413,8 @@ var import_jsx_runtime9 = require("react/jsx-runtime");
413
413
  var StyledChip = (0, import_material5.styled)(import_material5.Chip)(({ theme: theme2 }) => ({
414
414
  borderRadius: theme2.shape.borderRadius,
415
415
  ".MuiChip-label": { padding: 0 },
416
- ".MuiChip-icon": { margin: "0 6px 0 0" }
416
+ ".MuiChip-icon": { margin: "0 6px 0 0" },
417
+ ".MuiChip-deleteIcon": { margin: "0 0 0 10px" }
417
418
  }));
418
419
  var ChipViews = {
419
420
  black: "bg-accent-dark text-accent-white py-1.5 px-4",
@@ -425,9 +426,11 @@ var CustomChip = (props) => {
425
426
  const _a = props, { view } = _a, rest = __objRest(_a, ["view"]);
426
427
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
427
428
  StyledChip,
428
- __spreadValues({
429
- className: `rounded-none w-fit h-fit px-2.5 py-0 text-14 ${ChipViews[view]}`
430
- }, rest)
429
+ __spreadProps(__spreadValues({
430
+ className: `rounded-none w-fit px-2.5 py-0 text-14 h-[28px] ${ChipViews[view]}`
431
+ }, rest), {
432
+ deleteIcon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(close_default, {})
433
+ })
431
434
  );
432
435
  };
433
436
  var Chip_default = CustomChip;
@@ -662,6 +665,10 @@ var SearchInput = (props) => {
662
665
  props.onClick(event);
663
666
  }
664
667
  };
668
+ const inputClasses = `
669
+ w-full border rounded-none border-solid normal-case text-accent-dark px-5 h-[38px] gap-x-2 hover:bg-white
670
+ ${collapse ? "bg-white border-transparent" : "border-accent-beige"}
671
+ `;
665
672
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
666
673
  import_material12.Input,
667
674
  __spreadProps(__spreadValues({
@@ -671,7 +678,7 @@ var SearchInput = (props) => {
671
678
  startAdornment: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material12.Stack, { direction: "row", alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_material12.InputAdornment, { position: "start", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(search_default, {}) }) }),
672
679
  disableUnderline: true,
673
680
  placeholder: "\u041F\u043E\u0448\u0443\u043A \u043F\u043E \u0440\u0430\u0439\u043E\u043D\u0443, \u0432\u0443\u043B\u0438\u0446\u0456, \u0416\u041A",
674
- className: `w-full border rounded-none border-solid normal-case text-accent-dark gap-x-2 !px-5 h-[38px] ${collapse ? "bg-white !border-transparent" : "!border-accent-beige"} hover:bg-white`
681
+ className: inputClasses
675
682
  })
676
683
  );
677
684
  };
@@ -1323,7 +1330,6 @@ var ToggleButtonsWithLabel = (props) => {
1323
1330
  } = props;
1324
1331
  const { field } = (0, import_react_hook_form3.useController)(props);
1325
1332
  const handleFormat = (_event, newFormats) => {
1326
- console.log(newFormats);
1327
1333
  if (newFormats !== null) field.onChange(newFormats);
1328
1334
  if (collapseOnClick && collapseParent) collapseParent();
1329
1335
  };
@@ -1360,7 +1366,7 @@ var BpCheckedIcon = (0, import_material31.styled)(BpIcon)({
1360
1366
  width: 16,
1361
1367
  height: 16,
1362
1368
  display: "flex",
1363
- alignItems: "center",
1369
+ // alignItems: "center",
1364
1370
  justifyContent: "center",
1365
1371
  content: `url("data:image/svg+xml,%3Csvg width='12' height='9' viewBox='0 0 12 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 3.66667L4.82353 8L11 1' stroke='%23343434' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")`
1366
1372
  }
@@ -1371,7 +1377,7 @@ var CustomCheckbox = (props) => {
1371
1377
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
1372
1378
  import_material31.FormControlLabel,
1373
1379
  __spreadProps(__spreadValues({
1374
- className: `w-fit bg-accent-silver px-3 py-0.5 ml-0 ${toggleView ? "gap-0" : "gap-x-1"} ${(checkboxProps == null ? void 0 : checkboxProps.checked) && toggleView && "!bg-accent-beige"}`,
1380
+ className: `w-fit bg-accent-silver px-3 py-0.5 ml-0 h-[28px] ${toggleView ? "gap-0" : "gap-x-1"} ${(checkboxProps == null ? void 0 : checkboxProps.checked) && toggleView && "!bg-accent-beige"}`,
1375
1381
  control: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
1376
1382
  import_Checkbox.default,
1377
1383
  __spreadProps(__spreadValues({}, checkboxProps), {
package/dist/index.mjs CHANGED
@@ -243,7 +243,8 @@ var SelectPro = ({
243
243
  small = false,
244
244
  fullWidth = false,
245
245
  freeChildWidth = false,
246
- isOpen
246
+ isOpen,
247
+ intermediateChild
247
248
  }) => {
248
249
  const [btn, setAnchorEl] = useState2(null);
249
250
  const [open, setOpen] = useState2(false);
@@ -308,39 +309,38 @@ var SelectPro = ({
308
309
  ]
309
310
  }
310
311
  ),
311
- btn ? /* @__PURE__ */ jsx7(
312
+ btn ? /* @__PURE__ */ jsxs3(
312
313
  Paper,
313
314
  {
314
315
  sx: {
315
316
  position: "absolute",
316
- // width: "min-content",
317
- width: freeChildWidth ? "fit-content" : !fullContainerWidth && btn ? (
318
- // ? "fit-content" //(btn as HTMLButtonElement).offsetWidth
319
- btn.offsetWidth
320
- ) : "100%",
317
+ width: freeChildWidth ? "fit-content" : !fullContainerWidth && btn ? btn.offsetWidth : "100%",
321
318
  left: fullContainerWidth ? 0 : "initial",
322
319
  right: fullContainerWidth ? 0 : "initial",
323
320
  top: overButton ? 0 : "initial"
324
321
  },
325
- className: `select ${open ? "select--open" : "select--close"} z-50 rounded-none shadow-sm`,
326
- children: /* @__PURE__ */ jsxs3(Box, { className: `flex flex-col py-3 px-4 gap-2`, children: [
327
- overButton ? /* @__PURE__ */ jsx7(
328
- IconButton_default,
329
- {
330
- className: "bg-accent-silver p-1 self-end absolute",
331
- onClick: handleClose,
332
- children: /* @__PURE__ */ jsx7(close_default, {})
333
- }
334
- ) : null,
335
- childTitle ? /* @__PURE__ */ jsx7(
336
- Typography2,
337
- {
338
- className: "text-sm font-normal text-accent-silver-2",
339
- children: childTitle
340
- }
341
- ) : null,
342
- childrenWithHandleChange
343
- ] })
322
+ className: `select ${open ? "select--open" : "select--close"} z-50 rounded-none shadow-none ${intermediateChild ? "mt-[1px]" : "m-0"}`,
323
+ children: [
324
+ intermediateChild ? intermediateChild : null,
325
+ /* @__PURE__ */ jsxs3(Box, { className: `flex flex-col py-3 px-4 gap-2 shadow-sm`, children: [
326
+ overButton ? /* @__PURE__ */ jsx7(
327
+ IconButton_default,
328
+ {
329
+ className: "bg-accent-silver p-1 self-end absolute",
330
+ onClick: handleClose,
331
+ children: /* @__PURE__ */ jsx7(close_default, {})
332
+ }
333
+ ) : null,
334
+ childTitle ? /* @__PURE__ */ jsx7(
335
+ Typography2,
336
+ {
337
+ className: "text-sm font-normal text-accent-silver-2",
338
+ children: childTitle
339
+ }
340
+ ) : null,
341
+ childrenWithHandleChange
342
+ ] })
343
+ ]
344
344
  }
345
345
  ) : null
346
346
  ] }) });
@@ -353,7 +353,8 @@ import { jsx as jsx8 } from "react/jsx-runtime";
353
353
  var StyledChip = styled4(Chip)(({ theme: theme2 }) => ({
354
354
  borderRadius: theme2.shape.borderRadius,
355
355
  ".MuiChip-label": { padding: 0 },
356
- ".MuiChip-icon": { margin: "0 6px 0 0" }
356
+ ".MuiChip-icon": { margin: "0 6px 0 0" },
357
+ ".MuiChip-deleteIcon": { margin: "0 0 0 10px" }
357
358
  }));
358
359
  var ChipViews = {
359
360
  black: "bg-accent-dark text-accent-white py-1.5 px-4",
@@ -365,9 +366,11 @@ var CustomChip = (props) => {
365
366
  const _a = props, { view } = _a, rest = __objRest(_a, ["view"]);
366
367
  return /* @__PURE__ */ jsx8(
367
368
  StyledChip,
368
- __spreadValues({
369
- className: `rounded-none w-fit h-fit px-2.5 py-0 text-14 ${ChipViews[view]}`
370
- }, rest)
369
+ __spreadProps(__spreadValues({
370
+ className: `rounded-none w-fit px-2.5 py-0 text-14 h-[28px] ${ChipViews[view]}`
371
+ }, rest), {
372
+ deleteIcon: /* @__PURE__ */ jsx8(close_default, {})
373
+ })
371
374
  );
372
375
  };
373
376
  var Chip_default = CustomChip;
@@ -602,6 +605,10 @@ var SearchInput = (props) => {
602
605
  props.onClick(event);
603
606
  }
604
607
  };
608
+ const inputClasses = `
609
+ w-full border rounded-none border-solid normal-case text-accent-dark px-5 h-[38px] gap-x-2 hover:bg-white
610
+ ${collapse ? "bg-white border-transparent" : "border-accent-beige"}
611
+ `;
605
612
  return /* @__PURE__ */ jsx20(
606
613
  Input2,
607
614
  __spreadProps(__spreadValues({
@@ -611,7 +618,7 @@ var SearchInput = (props) => {
611
618
  startAdornment: /* @__PURE__ */ jsx20(Stack3, { direction: "row", alignItems: "center", children: /* @__PURE__ */ jsx20(InputAdornment2, { position: "start", children: /* @__PURE__ */ jsx20(search_default, {}) }) }),
612
619
  disableUnderline: true,
613
620
  placeholder: "\u041F\u043E\u0448\u0443\u043A \u043F\u043E \u0440\u0430\u0439\u043E\u043D\u0443, \u0432\u0443\u043B\u0438\u0446\u0456, \u0416\u041A",
614
- className: `w-full border rounded-none border-solid normal-case text-accent-dark gap-x-2 !px-5 h-[38px] ${collapse ? "bg-white !border-transparent" : "!border-accent-beige"} hover:bg-white`
621
+ className: inputClasses
615
622
  })
616
623
  );
617
624
  };
@@ -1187,7 +1194,9 @@ var ListItem_default = ListItem;
1187
1194
 
1188
1195
  // src/components/ToggleButton/ToggleButtonsWithLabel.tsx
1189
1196
  import { Stack as Stack6 } from "@mui/material";
1190
- import { useController as useController3 } from "react-hook-form";
1197
+ import {
1198
+ useController as useController3
1199
+ } from "react-hook-form";
1191
1200
  import Typography17 from "@mui/material/Typography";
1192
1201
 
1193
1202
  // src/components/ToggleButton/ToggleButtonGroup.tsx
@@ -1275,7 +1284,6 @@ var ToggleButtonsWithLabel = (props) => {
1275
1284
  } = props;
1276
1285
  const { field } = useController3(props);
1277
1286
  const handleFormat = (_event, newFormats) => {
1278
- console.log(newFormats);
1279
1287
  if (newFormats !== null) field.onChange(newFormats);
1280
1288
  if (collapseOnClick && collapseParent) collapseParent();
1281
1289
  };
@@ -1312,7 +1320,7 @@ var BpCheckedIcon = styled11(BpIcon)({
1312
1320
  width: 16,
1313
1321
  height: 16,
1314
1322
  display: "flex",
1315
- alignItems: "center",
1323
+ // alignItems: "center",
1316
1324
  justifyContent: "center",
1317
1325
  content: `url("data:image/svg+xml,%3Csvg width='12' height='9' viewBox='0 0 12 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 3.66667L4.82353 8L11 1' stroke='%23343434' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")`
1318
1326
  }
@@ -1323,7 +1331,7 @@ var CustomCheckbox = (props) => {
1323
1331
  return /* @__PURE__ */ jsx47(
1324
1332
  FormControlLabel2,
1325
1333
  __spreadProps(__spreadValues({
1326
- className: `w-fit bg-accent-silver px-3 py-0.5 ml-0 ${toggleView ? "gap-0" : "gap-x-1"} ${(checkboxProps == null ? void 0 : checkboxProps.checked) && toggleView && "!bg-accent-beige"}`,
1334
+ className: `w-fit bg-accent-silver px-3 py-0.5 ml-0 h-[28px] ${toggleView ? "gap-0" : "gap-x-1"} ${(checkboxProps == null ? void 0 : checkboxProps.checked) && toggleView && "!bg-accent-beige"}`,
1327
1335
  control: /* @__PURE__ */ jsx47(
1328
1336
  Checkbox,
1329
1337
  __spreadProps(__spreadValues({}, checkboxProps), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mayak-common-library",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",