mayak-common-library 0.0.33 → 0.0.34

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
@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
  import React__default, { FC, PropsWithChildren, ReactElement } from 'react';
5
5
  import { IconButtonProps } from '@mui/material/IconButton/IconButton';
6
6
  import { SelectProps } from '@mui/material/Select/Select';
7
- import { ChipProps } from '@mui/material';
7
+ import { ChipProps, ToggleButtonGroupProps } from '@mui/material';
8
8
  import { BadgeProps } from '@mui/material/Badge/Badge';
9
9
  import { AvatarProps } from '@mui/material/Avatar/Avatar';
10
10
  import { TypographyOwnProps } from '@mui/material/Typography';
@@ -201,4 +201,29 @@ interface ListItemProps {
201
201
  }
202
202
  declare const ListItem: FC<ListItemProps>;
203
203
 
204
- export { AppBar, ArticleCard, Autocomplete, CustomAvatar as Avatar, CustomBadge as Badge, BigNumber, Button, CategoryCard, CustomChip as Chip, FromToInput, Greet, IconButton, ImageContainer, CustomInput as Input, JobCard, List, ListItem, CustomMenuItem as MenuItem, PhoneInput, Providers, CustomRadio as Radio, CustomRadioGroup as RadioGroup, RealtorCard, RealtyCard, CustomSelect as Select, SelectPro, CustomSlider as Slider, CustomSwitch as Switch, TeamPersonCard, Text, TextBlock, TitleBlock };
204
+ type Values = {
205
+ value: string | number[];
206
+ title: string;
207
+ }[];
208
+
209
+ type FormValues = {
210
+ type: string;
211
+ place: string;
212
+ room: [];
213
+ price: string;
214
+ districts: string[];
215
+ town: string[];
216
+ searchText: string;
217
+ };
218
+
219
+ interface ToggleButtonsMultipleProps extends ToggleButtonGroupProps {
220
+ values: Values;
221
+ textView?: boolean;
222
+ collapseOnClick?: boolean;
223
+ collapseParent?: () => void;
224
+ label?: string;
225
+ flexDirection?: "row" | "col";
226
+ }
227
+ declare const ToggleButtonsMultiple: FC<ToggleButtonsMultipleProps & UseControllerProps<FormValues>>;
228
+
229
+ export { AppBar, ArticleCard, Autocomplete, CustomAvatar as Avatar, CustomBadge as Badge, BigNumber, Button, CategoryCard, CustomChip as Chip, FromToInput, Greet, IconButton, ImageContainer, CustomInput as Input, JobCard, List, ListItem, CustomMenuItem as MenuItem, PhoneInput, Providers, CustomRadio as Radio, CustomRadioGroup as RadioGroup, RealtorCard, RealtyCard, CustomSelect as Select, SelectPro, CustomSlider as Slider, CustomSwitch as Switch, TeamPersonCard, Text, TextBlock, TitleBlock, ToggleButtonsMultiple as ToggleButton };
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
  import React__default, { FC, PropsWithChildren, ReactElement } from 'react';
5
5
  import { IconButtonProps } from '@mui/material/IconButton/IconButton';
6
6
  import { SelectProps } from '@mui/material/Select/Select';
7
- import { ChipProps } from '@mui/material';
7
+ import { ChipProps, ToggleButtonGroupProps } from '@mui/material';
8
8
  import { BadgeProps } from '@mui/material/Badge/Badge';
9
9
  import { AvatarProps } from '@mui/material/Avatar/Avatar';
10
10
  import { TypographyOwnProps } from '@mui/material/Typography';
@@ -201,4 +201,29 @@ interface ListItemProps {
201
201
  }
202
202
  declare const ListItem: FC<ListItemProps>;
203
203
 
204
- export { AppBar, ArticleCard, Autocomplete, CustomAvatar as Avatar, CustomBadge as Badge, BigNumber, Button, CategoryCard, CustomChip as Chip, FromToInput, Greet, IconButton, ImageContainer, CustomInput as Input, JobCard, List, ListItem, CustomMenuItem as MenuItem, PhoneInput, Providers, CustomRadio as Radio, CustomRadioGroup as RadioGroup, RealtorCard, RealtyCard, CustomSelect as Select, SelectPro, CustomSlider as Slider, CustomSwitch as Switch, TeamPersonCard, Text, TextBlock, TitleBlock };
204
+ type Values = {
205
+ value: string | number[];
206
+ title: string;
207
+ }[];
208
+
209
+ type FormValues = {
210
+ type: string;
211
+ place: string;
212
+ room: [];
213
+ price: string;
214
+ districts: string[];
215
+ town: string[];
216
+ searchText: string;
217
+ };
218
+
219
+ interface ToggleButtonsMultipleProps extends ToggleButtonGroupProps {
220
+ values: Values;
221
+ textView?: boolean;
222
+ collapseOnClick?: boolean;
223
+ collapseParent?: () => void;
224
+ label?: string;
225
+ flexDirection?: "row" | "col";
226
+ }
227
+ declare const ToggleButtonsMultiple: FC<ToggleButtonsMultipleProps & UseControllerProps<FormValues>>;
228
+
229
+ export { AppBar, ArticleCard, Autocomplete, CustomAvatar as Avatar, CustomBadge as Badge, BigNumber, Button, CategoryCard, CustomChip as Chip, FromToInput, Greet, IconButton, ImageContainer, CustomInput as Input, JobCard, List, ListItem, CustomMenuItem as MenuItem, PhoneInput, Providers, CustomRadio as Radio, CustomRadioGroup as RadioGroup, RealtorCard, RealtyCard, CustomSelect as Select, SelectPro, CustomSlider as Slider, CustomSwitch as Switch, TeamPersonCard, Text, TextBlock, TitleBlock, ToggleButtonsMultiple as ToggleButton };
package/dist/index.js CHANGED
@@ -91,7 +91,8 @@ __export(src_exports, {
91
91
  TeamPersonCard: () => TeamPersonCard_default,
92
92
  Text: () => Text_default,
93
93
  TextBlock: () => TextBlock_default,
94
- TitleBlock: () => TitleBlock_default
94
+ TitleBlock: () => TitleBlock_default,
95
+ ToggleButton: () => ToggleButton_default
95
96
  });
96
97
  module.exports = __toCommonJS(src_exports);
97
98
 
@@ -335,7 +336,7 @@ var SelectPro = ({
335
336
  disableRipple: true,
336
337
  fullWidth: true,
337
338
  sx: {
338
- height: small ? "34px" : "49px",
339
+ height: small ? "34px" : "38px",
339
340
  padding: small ? "0 10px 0 6px" : "0 20px 0 19px"
340
341
  },
341
342
  className: `border rounded-none border-solid normal-case text-accent-dark hover:bg-white ${open ? "!border-transparent bg-white" : ""} ${colorBorder ? "border-accent-beige flex-row-reverse justify-end gap-x-2" : "justify-between border-accent-dark"}`,
@@ -1201,6 +1202,100 @@ var ListItem = ({ icon, title, bold, onClick }) => {
1201
1202
  ) });
1202
1203
  };
1203
1204
  var ListItem_default = ListItem;
1205
+
1206
+ // src/components/ToggleButton/ToggleButton.tsx
1207
+ var import_ToggleButton = __toESM(require("@mui/material/ToggleButton"));
1208
+ var import_material27 = require("@mui/material");
1209
+ var import_react_hook_form2 = require("react-hook-form");
1210
+ var import_Typography8 = __toESM(require("@mui/material/Typography"));
1211
+ var import_ToggleButtonGroup = __toESM(require("@mui/material/ToggleButtonGroup"));
1212
+ var import_jsx_runtime44 = require("react/jsx-runtime");
1213
+ var StyledToggleButtonGroup = (0, import_material27.styled)(
1214
+ import_ToggleButtonGroup.default
1215
+ )(({ theme: theme2, flexDirection }) => ({
1216
+ [`& .${import_ToggleButtonGroup.toggleButtonGroupClasses.grouped}`]: {
1217
+ // marginRight: theme.spacing(1.3),
1218
+ marginRight: flexDirection === "col" ? "unset" : theme2.spacing(1),
1219
+ marginBottom: flexDirection === "col" ? theme2.spacing(1) : "unset",
1220
+ // marginBottom: theme.spacing(1.3),
1221
+ // spacing: theme.spacing(1.3),
1222
+ width: "fit-content"
1223
+ // border: 0,
1224
+ // borderRadius: theme.shape.borderRadius,
1225
+ // [`&.${toggleButtonGroupClasses.disabled}`]: {
1226
+ // border: 0,
1227
+ // },
1228
+ },
1229
+ [`& .${import_ToggleButtonGroup.toggleButtonGroupClasses.lastButton}`]: {
1230
+ marginBottom: "unset",
1231
+ marginRight: "unset"
1232
+ },
1233
+ [`& .${import_ToggleButtonGroup.toggleButtonGroupClasses.middleButton},& .${import_ToggleButtonGroup.toggleButtonGroupClasses.lastButton}`]: {
1234
+ // marginLeft: -1,
1235
+ // borderLeft: "1px solid transparent",
1236
+ marginLeft: "unset",
1237
+ borderLeft: "unset"
1238
+ }
1239
+ }));
1240
+ var ToggleButton = (0, import_material27.styled)(import_ToggleButton.default)(() => ({
1241
+ "&.Mui-selected, &.Mui-selected:hover": {
1242
+ backgroundColor: "#C8BCA1 !important"
1243
+ // marginLeft: "-1px !important",
1244
+ // borderLeft: "1px solid transparent !important",
1245
+ }
1246
+ }));
1247
+ var CustomToggleButton = (props) => {
1248
+ const _a = props, { children, textView } = _a, rest = __objRest(_a, ["children", "textView"]);
1249
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
1250
+ ToggleButton,
1251
+ __spreadProps(__spreadValues({}, rest), {
1252
+ disableRipple: true,
1253
+ className: `rounded-none border-none min-w-10 h-9 normal-case py-1.5 px-2.5 ${textView ? "justify-start bg-transparent hover:bg-transparent h-6 p-0" : " bg-accent-silver "}`,
1254
+ children
1255
+ })
1256
+ );
1257
+ };
1258
+ var ToggleButtonsMultiple = (props) => {
1259
+ const {
1260
+ values,
1261
+ textView = false,
1262
+ exclusive,
1263
+ collapseOnClick = false,
1264
+ label,
1265
+ collapseParent,
1266
+ flexDirection = "row"
1267
+ } = props;
1268
+ const { field } = (0, import_react_hook_form2.useController)(props);
1269
+ const handleFormat = (_event, newFormats) => {
1270
+ console.log(newFormats);
1271
+ if (newFormats !== null) field.onChange(newFormats);
1272
+ if (collapseOnClick && collapseParent) collapseParent();
1273
+ };
1274
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material27.Stack, { children: [
1275
+ label ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_Typography8.default, { className: "text-accent-silver-2 text-sm", children: label }) : null,
1276
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
1277
+ StyledToggleButtonGroup,
1278
+ __spreadProps(__spreadValues({}, field), {
1279
+ flexDirection,
1280
+ exclusive,
1281
+ value: field.value,
1282
+ onChange: handleFormat,
1283
+ "aria-label": "text formatting",
1284
+ className: `flex flex-${flexDirection} ${textView ? "gap-1 flex-nowrap flex-col" : " flex-wrap"}`,
1285
+ children: values.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
1286
+ CustomToggleButton,
1287
+ {
1288
+ value: option.value,
1289
+ textView,
1290
+ children: option.title
1291
+ },
1292
+ index
1293
+ ))
1294
+ })
1295
+ )
1296
+ ] });
1297
+ };
1298
+ var ToggleButton_default = ToggleButtonsMultiple;
1204
1299
  // Annotate the CommonJS export names for ESM import in node:
1205
1300
  0 && (module.exports = {
1206
1301
  AppBar,
@@ -1235,5 +1330,6 @@ var ListItem_default = ListItem;
1235
1330
  TeamPersonCard,
1236
1331
  Text,
1237
1332
  TextBlock,
1238
- TitleBlock
1333
+ TitleBlock,
1334
+ ToggleButton
1239
1335
  });
package/dist/index.mjs CHANGED
@@ -280,7 +280,7 @@ var SelectPro = ({
280
280
  disableRipple: true,
281
281
  fullWidth: true,
282
282
  sx: {
283
- height: small ? "34px" : "49px",
283
+ height: small ? "34px" : "38px",
284
284
  padding: small ? "0 10px 0 6px" : "0 20px 0 19px"
285
285
  },
286
286
  className: `border rounded-none border-solid normal-case text-accent-dark hover:bg-white ${open ? "!border-transparent bg-white" : ""} ${colorBorder ? "border-accent-beige flex-row-reverse justify-end gap-x-2" : "justify-between border-accent-dark"}`,
@@ -1154,6 +1154,105 @@ var ListItem = ({ icon, title, bold, onClick }) => {
1154
1154
  ) });
1155
1155
  };
1156
1156
  var ListItem_default = ListItem;
1157
+
1158
+ // src/components/ToggleButton/ToggleButton.tsx
1159
+ import MuiToggleButton from "@mui/material/ToggleButton";
1160
+ import {
1161
+ Stack as Stack5,
1162
+ styled as styled9
1163
+ } from "@mui/material";
1164
+ import { useController as useController2 } from "react-hook-form";
1165
+ import Typography17 from "@mui/material/Typography";
1166
+ import ToggleButtonGroup, {
1167
+ toggleButtonGroupClasses
1168
+ } from "@mui/material/ToggleButtonGroup";
1169
+ import { jsx as jsx43, jsxs as jsxs18 } from "react/jsx-runtime";
1170
+ var StyledToggleButtonGroup = styled9(
1171
+ ToggleButtonGroup
1172
+ )(({ theme: theme2, flexDirection }) => ({
1173
+ [`& .${toggleButtonGroupClasses.grouped}`]: {
1174
+ // marginRight: theme.spacing(1.3),
1175
+ marginRight: flexDirection === "col" ? "unset" : theme2.spacing(1),
1176
+ marginBottom: flexDirection === "col" ? theme2.spacing(1) : "unset",
1177
+ // marginBottom: theme.spacing(1.3),
1178
+ // spacing: theme.spacing(1.3),
1179
+ width: "fit-content"
1180
+ // border: 0,
1181
+ // borderRadius: theme.shape.borderRadius,
1182
+ // [`&.${toggleButtonGroupClasses.disabled}`]: {
1183
+ // border: 0,
1184
+ // },
1185
+ },
1186
+ [`& .${toggleButtonGroupClasses.lastButton}`]: {
1187
+ marginBottom: "unset",
1188
+ marginRight: "unset"
1189
+ },
1190
+ [`& .${toggleButtonGroupClasses.middleButton},& .${toggleButtonGroupClasses.lastButton}`]: {
1191
+ // marginLeft: -1,
1192
+ // borderLeft: "1px solid transparent",
1193
+ marginLeft: "unset",
1194
+ borderLeft: "unset"
1195
+ }
1196
+ }));
1197
+ var ToggleButton = styled9(MuiToggleButton)(() => ({
1198
+ "&.Mui-selected, &.Mui-selected:hover": {
1199
+ backgroundColor: "#C8BCA1 !important"
1200
+ // marginLeft: "-1px !important",
1201
+ // borderLeft: "1px solid transparent !important",
1202
+ }
1203
+ }));
1204
+ var CustomToggleButton = (props) => {
1205
+ const _a = props, { children, textView } = _a, rest = __objRest(_a, ["children", "textView"]);
1206
+ return /* @__PURE__ */ jsx43(
1207
+ ToggleButton,
1208
+ __spreadProps(__spreadValues({}, rest), {
1209
+ disableRipple: true,
1210
+ className: `rounded-none border-none min-w-10 h-9 normal-case py-1.5 px-2.5 ${textView ? "justify-start bg-transparent hover:bg-transparent h-6 p-0" : " bg-accent-silver "}`,
1211
+ children
1212
+ })
1213
+ );
1214
+ };
1215
+ var ToggleButtonsMultiple = (props) => {
1216
+ const {
1217
+ values,
1218
+ textView = false,
1219
+ exclusive,
1220
+ collapseOnClick = false,
1221
+ label,
1222
+ collapseParent,
1223
+ flexDirection = "row"
1224
+ } = props;
1225
+ const { field } = useController2(props);
1226
+ const handleFormat = (_event, newFormats) => {
1227
+ console.log(newFormats);
1228
+ if (newFormats !== null) field.onChange(newFormats);
1229
+ if (collapseOnClick && collapseParent) collapseParent();
1230
+ };
1231
+ return /* @__PURE__ */ jsxs18(Stack5, { children: [
1232
+ label ? /* @__PURE__ */ jsx43(Typography17, { className: "text-accent-silver-2 text-sm", children: label }) : null,
1233
+ /* @__PURE__ */ jsx43(
1234
+ StyledToggleButtonGroup,
1235
+ __spreadProps(__spreadValues({}, field), {
1236
+ flexDirection,
1237
+ exclusive,
1238
+ value: field.value,
1239
+ onChange: handleFormat,
1240
+ "aria-label": "text formatting",
1241
+ className: `flex flex-${flexDirection} ${textView ? "gap-1 flex-nowrap flex-col" : " flex-wrap"}`,
1242
+ children: values.map((option, index) => /* @__PURE__ */ jsx43(
1243
+ CustomToggleButton,
1244
+ {
1245
+ value: option.value,
1246
+ textView,
1247
+ children: option.title
1248
+ },
1249
+ index
1250
+ ))
1251
+ })
1252
+ )
1253
+ ] });
1254
+ };
1255
+ var ToggleButton_default = ToggleButtonsMultiple;
1157
1256
  export {
1158
1257
  AppBar_default as AppBar,
1159
1258
  ArticleCard_default as ArticleCard,
@@ -1187,5 +1286,6 @@ export {
1187
1286
  TeamPersonCard_default as TeamPersonCard,
1188
1287
  Text_default as Text,
1189
1288
  TextBlock_default as TextBlock,
1190
- TitleBlock_default as TitleBlock
1289
+ TitleBlock_default as TitleBlock,
1290
+ ToggleButton_default as ToggleButton
1191
1291
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mayak-common-library",
3
- "version": "0.0.33",
3
+ "version": "0.0.34",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",