@codezee/sixtify-brahma 0.2.89 → 0.2.91

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codezee/sixtify-brahma",
3
- "version": "0.2.89",
3
+ "version": "0.2.91",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/hardikranpariya/sixtify-brahma.git"
@@ -1 +1 @@
1
- {"version":3,"file":"FilePreview.d.ts","sourceRoot":"","sources":["../../../../src/FormFields/FileUpload/Dialogs/FilePreview.tsx"],"names":[],"mappings":"AA0BA,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,uBAAuB,oCAAqC,CAAC;AAE1E,eAAO,MAAM,qBAAqB,mBAAoB,CAAC;AAEvD,eAAO,MAAM,qBAAqB,4BAA6B,CAAC;AAEhE,eAAO,MAAM,uBAAuB,4BAA6B,CAAC;AASlE,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,OAAO,CAET;AAED,eAAO,MAAM,WAAW,GAAI,4BAA4B,gBAAgB,4CAkQvE,CAAC"}
1
+ {"version":3,"file":"FilePreview.d.ts","sourceRoot":"","sources":["../../../../src/FormFields/FileUpload/Dialogs/FilePreview.tsx"],"names":[],"mappings":"AAwBA,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,uBAAuB,oCAAqC,CAAC;AAE1E,eAAO,MAAM,qBAAqB,mBAAoB,CAAC;AAEvD,eAAO,MAAM,qBAAqB,4BAA6B,CAAC;AAEhE,eAAO,MAAM,uBAAuB,4BAA6B,CAAC;AASlE,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,OAAO,CAET;AAED,eAAO,MAAM,WAAW,GAAI,4BAA4B,gBAAgB,4CAkQvE,CAAC"}
@@ -9,12 +9,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
9
9
  const ZoomInOutlined_1 = __importDefault(require("@mui/icons-material/ZoomInOutlined"));
10
10
  const ZoomOutOutlined_1 = __importDefault(require("@mui/icons-material/ZoomOutOutlined"));
11
11
  const material_1 = require("@mui/material");
12
- const image_1 = __importDefault(require("next/image"));
13
12
  const react_1 = require("react");
14
13
  const Button_1 = require("../../../Button");
15
14
  const Layouts_1 = require("../../../Layouts");
16
15
  const PadBox_1 = require("../../../PadBox");
17
- const utils_1 = require("../../../utils");
18
16
  exports.SUPPORTED_IMAGE_FORMATS = [".png", ".jpg", ".jpeg"];
19
17
  exports.SUPPORTED_PDF_FORMATS = [".pdf"];
20
18
  exports.SUPPORTED_DOC_FORMATS = [".doc", ".docx"];
@@ -29,7 +27,6 @@ function isFileType(url, extensions) {
29
27
  return extensions.some((ext) => url.toLowerCase().endsWith(ext));
30
28
  }
31
29
  const FilePreview = ({ fileName, resetTrigger }) => {
32
- const isValidUrl = (0, utils_1.isImageDomainValid)(fileName);
33
30
  const [isDragging, setIsDragging] = (0, react_1.useState)(false);
34
31
  const [position, setPosition] = (0, react_1.useState)({ x: 0, y: 0 });
35
32
  const [startPos, setStartPos] = (0, react_1.useState)({ x: 0, y: 0 });
@@ -113,25 +110,25 @@ const FilePreview = ({ fileName, resetTrigger }) => {
113
110
  if (isFileType(fileName, exports.SUPPORTED_PDF_FORMATS)) {
114
111
  return ((0, jsx_runtime_1.jsx)(Layouts_1.FilePreviewContainer, { children: (0, jsx_runtime_1.jsx)("iframe", { src: `${fileName}#toolbar=0`, style: { width: "100%", height: "100%" } }) }));
115
112
  }
116
- if (isFileType(fileName, exports.SUPPORTED_IMAGE_FORMATS) && isValidUrl) {
113
+ if (isFileType(fileName, exports.SUPPORTED_IMAGE_FORMATS)) {
117
114
  return ((0, jsx_runtime_1.jsxs)(Layouts_1.FilePreviewContainer, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { flexDirection: "row", alignItems: "center", justifyContent: "center", gap: "10px", sx: {
118
115
  position: "absolute",
119
116
  top: 10,
120
117
  right: 66,
121
118
  zIndex: 10,
122
- }, children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { sx: {
119
+ }, children: [zoomLevel !== 1 && ((0, jsx_runtime_1.jsx)(Button_1.Button, { sx: {
123
120
  backgroundColor: slate[900],
124
121
  minWidth: "42px",
125
122
  height: "42px",
126
- }, onClick: () => updateZoomLevel(-0.3), children: (0, jsx_runtime_1.jsx)(ZoomOutOutlined_1.default, {}) }), (0, jsx_runtime_1.jsx)(Button_1.Button, { sx: {
123
+ }, onClick: () => resetZoomLevel(), children: "Reset" })), (0, jsx_runtime_1.jsx)(Button_1.Button, { sx: {
127
124
  backgroundColor: slate[900],
128
125
  minWidth: "42px",
129
126
  height: "42px",
130
- }, onClick: () => updateZoomLevel(0.3), children: (0, jsx_runtime_1.jsx)(ZoomInOutlined_1.default, {}) }), zoomLevel !== 1 && ((0, jsx_runtime_1.jsx)(Button_1.Button, { sx: {
127
+ }, onClick: () => updateZoomLevel(-0.3), children: (0, jsx_runtime_1.jsx)(ZoomOutOutlined_1.default, {}) }), (0, jsx_runtime_1.jsx)(Button_1.Button, { sx: {
131
128
  backgroundColor: slate[900],
132
129
  minWidth: "42px",
133
130
  height: "42px",
134
- }, onClick: () => resetZoomLevel(), children: "Reset" }))] }), (0, jsx_runtime_1.jsx)(material_1.Box, { ref: imageContainerRef, style: {
131
+ }, onClick: () => updateZoomLevel(0.3), children: (0, jsx_runtime_1.jsx)(ZoomInOutlined_1.default, {}) })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { ref: imageContainerRef, style: {
135
132
  position: "relative",
136
133
  width: "100%",
137
134
  height: "100%",
@@ -139,7 +136,10 @@ const FilePreview = ({ fileName, resetTrigger }) => {
139
136
  transform: `scale(${zoomLevel}) translate(${positionX / zoomLevel}px, ${positionY / zoomLevel}px)`,
140
137
  transformOrigin: "center center",
141
138
  transition: isDragging ? "none" : "transform 0.2s ease-in-out",
142
- }, onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: endDrag, onMouseLeave: endDrag, onWheel: handleWheel, onDoubleClick: handleDoubleClick, children: (0, jsx_runtime_1.jsx)(image_1.default, { src: fileName, alt: "Attachment", fill: true, style: {
139
+ }, onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: endDrag, onMouseLeave: endDrag, onWheel: handleWheel, onDoubleClick: handleDoubleClick, children: (0, jsx_runtime_1.jsx)("img", { src: fileName, alt: "Attachment", style: {
140
+ position: "absolute",
141
+ width: "100%",
142
+ height: "100%",
143
143
  objectFit: "contain",
144
144
  userSelect: "none",
145
145
  pointerEvents: "none",
@@ -24,6 +24,7 @@ export type SelectProps<P extends FieldValues> = UseControllerProps<P> & Omit<Mu
24
24
  renderOption?: (option: SelectOption, selected: boolean) => JSX.Element;
25
25
  maxDisplayItems?: number;
26
26
  disableClearable?: boolean;
27
+ setOnFinalChange?: boolean;
27
28
  };
28
- export declare function Select<P extends FieldValues>({ control, defaultValue, name, required, multiple, disabled, options, rules, loading, helperText, error, placeholder, isShowSelectAll, isShowAvatar, onAction, renderOption, maxLimit, maxDisplayItems, disableClearable, ...restProps }: SelectProps<P>): import("react/jsx-runtime").JSX.Element;
29
+ export declare function Select<P extends FieldValues>({ control, defaultValue, name, required, multiple, disabled, options, rules, loading, helperText, error, placeholder, isShowSelectAll, isShowAvatar, onAction, renderOption, maxLimit, maxDisplayItems, disableClearable, setOnFinalChange, ...restProps }: SelectProps<P>): import("react/jsx-runtime").JSX.Element;
29
30
  //# sourceMappingURL=Select.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/FormFields/Select/Select.tsx"],"names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AC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,KAAK,GAAG,CAAC,OAAO,CAAC;IACxE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEJ,wBAAgB,MAAM,CAAC,CAAC,SAAS,WAAW,EAAE,EAC5C,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,QAAgB,EAChB,QAAgB,EAChB,QAAgB,EAChB,OAAY,EACZ,KAAK,EACL,OAAe,EACf,UAAU,EACV,KAAK,EACL,WAAgB,EAChB,eAAsB,EACtB,YAAoB,EACpB,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,eAAmB,EACnB,gBAA0C,EAC1C,gBAAwB,EACxB,GAAG,SAAS,EACb,EAAE,WAAW,CAAC,CAAC,CAAC,2CAwXhB"}
@@ -11,7 +11,7 @@ const Actions_1 = require("../../Actions");
11
11
  const Toast_1 = require("../../Toast");
12
12
  const CheckBox_styled_1 = require("../CheckBox/CheckBox.styled");
13
13
  const Select_styled_1 = require("./Select.styled");
14
- function Select({ control, defaultValue, name, required = false, multiple = false, disabled = false, options = [], rules, loading = false, helperText, error, placeholder = "", isShowSelectAll = true, isShowAvatar = false, onAction, renderOption, maxLimit, maxDisplayItems = 2, disableClearable = required ? true : false, ...restProps }) {
14
+ function Select({ control, defaultValue, name, required = false, multiple = false, disabled = false, options = [], rules, loading = false, helperText, error, placeholder = "", isShowSelectAll = true, isShowAvatar = false, onAction, renderOption, maxLimit, maxDisplayItems = 2, disableClearable = required ? true : false, setOnFinalChange = false, ...restProps }) {
15
15
  const { field: { onChange, value, ...restField }, } = (0, react_hook_form_1.useController)({
16
16
  name,
17
17
  control,
@@ -21,6 +21,8 @@ function Select({ control, defaultValue, name, required = false, multiple = fals
21
21
  const { t } = (0, react_i18next_1.useTranslation)();
22
22
  const theme = (0, material_1.useTheme)();
23
23
  const { slate } = theme.palette.app.color;
24
+ const [pendingValue, setPendingValue] = (0, react_1.useState)(null);
25
+ const hasPendingChange = (0, react_1.useRef)(false);
24
26
  const handleSelectAll = (isSelected) => {
25
27
  if (isSelected) {
26
28
  const allValues = options
@@ -90,10 +92,19 @@ function Select({ control, defaultValue, name, required = false, multiple = fals
90
92
  transform: "scale(1)",
91
93
  } }));
92
94
  }
95
+ // eslint-disable-next-line sonarjs/function-return-type
96
+ const getDisplayValue = () => {
97
+ return setOnFinalChange && hasPendingChange.current ? pendingValue : value;
98
+ };
93
99
  const renderMenuItems = () => {
94
100
  const items = [];
101
+ const displayValue = getDisplayValue();
95
102
  if (multiple && isShowSelectAll && options.length > 0) {
96
- items.push((0, jsx_runtime_1.jsxs)(material_1.MenuItem, { value: "select-all", children: [(0, jsx_runtime_1.jsx)(material_1.Checkbox, { icon: (0, jsx_runtime_1.jsx)(CheckBox_styled_1.BoxStyled, { size: "small" }), checkedIcon: (0, jsx_runtime_1.jsx)(CheckBox_styled_1.CheckStyled, { size: "small" }), indeterminate: !isAllSelected && Array.isArray(value) && value.length > 0, checked: isAllSelected, sx: { marginRight: 1 } }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: "Select All" })] }, "select-all"));
103
+ items.push((0, jsx_runtime_1.jsxs)(material_1.MenuItem, { value: "select-all", children: [(0, jsx_runtime_1.jsx)(material_1.Checkbox, { icon: (0, jsx_runtime_1.jsx)(CheckBox_styled_1.BoxStyled, { size: "small" }), checkedIcon: (0, jsx_runtime_1.jsx)(CheckBox_styled_1.CheckStyled, { size: "small" }), indeterminate: Array.isArray(displayValue) &&
104
+ displayValue.length > 0 &&
105
+ displayValue.length <
106
+ options.filter(({ disabled }) => !disabled).length, checked: Array.isArray(displayValue) &&
107
+ displayValue.length === options.filter((o) => !o.disabled).length, sx: { marginRight: 1 } }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: "Select All" })] }, "select-all"));
97
108
  items.push((0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { margin: "0px !important" } }, "divider-select-all"));
98
109
  }
99
110
  Object.entries(groupedOptions).forEach(([groupName, groupOptions]) => {
@@ -102,33 +113,56 @@ function Select({ control, defaultValue, name, required = false, multiple = fals
102
113
  }
103
114
  groupOptions.forEach((option) => {
104
115
  const isSelected = multiple
105
- ? Array.isArray(value) && value.includes(option.value)
106
- : value === option.value;
116
+ ? Array.isArray(displayValue) && displayValue.includes(option.value)
117
+ : displayValue === option.value;
107
118
  items.push((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: option.value, disabled: option.disabled, children: renderOption ? (renderOption(option, isSelected)) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [multiple && ((0, jsx_runtime_1.jsx)(material_1.Checkbox, { icon: (0, jsx_runtime_1.jsx)(CheckBox_styled_1.BoxStyled, { size: "small" }), checkedIcon: (0, jsx_runtime_1.jsx)(CheckBox_styled_1.CheckStyled, { size: "small" }), checked: isSelected, sx: { marginRight: 1 } })), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [isShowAvatar && option.avatar && ((0, jsx_runtime_1.jsx)(material_1.Avatar, { src: option.avatar, alt: option.label, sx: { width: 24, height: 24 } })), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: option.label })] })] })) }, option.value));
108
119
  });
109
120
  });
110
121
  return items;
111
122
  };
112
- return ((0, jsx_runtime_1.jsx)(material_1.Stack, { gap: "10px", children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", gap: "10px", alignItems: "start", children: [(0, jsx_runtime_1.jsxs)(Select_styled_1.StyledFormControl, { fullWidth: true, error: error, disabled: disabled, required: required, children: [(0, jsx_runtime_1.jsx)(material_1.Select, { ...restField, ...restProps, multiple: multiple, value: value || (multiple ? [] : ""), onChange: (event) => {
123
+ return ((0, jsx_runtime_1.jsx)(material_1.Stack, { gap: "10px", children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", gap: "10px", alignItems: "start", children: [(0, jsx_runtime_1.jsxs)(Select_styled_1.StyledFormControl, { fullWidth: true, error: error, disabled: disabled, required: required, children: [(0, jsx_runtime_1.jsx)(material_1.Select, { ...restField, ...restProps, multiple: multiple, value: getDisplayValue() ?? (multiple ? [] : ""),
124
+ // eslint-disable-next-line sonarjs/cognitive-complexity
125
+ onChange: (event) => {
113
126
  const newValue = event.target.value;
114
- if (multiple && Array.isArray(newValue)) {
115
- // Handle Select All
116
- const isSelectAllIncluded = newValue.includes("select-all");
117
- if (isSelectAllIncluded) {
118
- handleSelectAll(!isAllSelected);
119
- return;
127
+ if (setOnFinalChange) {
128
+ hasPendingChange.current = true;
129
+ if (multiple &&
130
+ Array.isArray(newValue) &&
131
+ newValue.includes("select-all")) {
132
+ setPendingValue(Array.isArray(pendingValue) &&
133
+ pendingValue.length ===
134
+ options.filter(({ disabled }) => !disabled).length
135
+ ? []
136
+ : options
137
+ .filter(({ disabled }) => !disabled)
138
+ .map(({ value }) => value));
120
139
  }
121
- if (maxLimit && newValue.length > maxLimit) {
122
- Toast_1.toasts.error({
123
- title: t("common.select.limitExceed", { maxLimit }),
124
- });
125
- return;
140
+ else {
141
+ setPendingValue(newValue);
126
142
  }
127
- onChange(newValue);
128
143
  }
129
144
  else {
145
+ if (multiple && Array.isArray(newValue)) {
146
+ const isSelectAllIncluded = newValue.includes("select-all");
147
+ if (isSelectAllIncluded) {
148
+ handleSelectAll(!isAllSelected);
149
+ return;
150
+ }
151
+ if (maxLimit && newValue.length > maxLimit) {
152
+ Toast_1.toasts.error({
153
+ title: t("common.select.limitExceed", { maxLimit }),
154
+ });
155
+ return;
156
+ }
157
+ }
130
158
  onChange(newValue);
131
159
  }
160
+ }, onClose: () => {
161
+ if (setOnFinalChange && hasPendingChange.current) {
162
+ onChange(pendingValue);
163
+ hasPendingChange.current = false;
164
+ setPendingValue(null);
165
+ }
132
166
  }, renderValue: restProps.renderValue ?? renderValue,
133
167
  // eslint-disable-next-line sonarjs/no-unstable-nested-components
134
168
  IconComponent: (props) => ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
@@ -2,5 +2,4 @@ export type SupportedFileType = "image/png" | "image/jpeg" | "image/jpg" | "appl
2
2
  export declare const SUPPORTED_FILE_TYPES: SupportedFileType[];
3
3
  export declare const isFileSizeValid: (file: File, maxSizeMB: number) => boolean;
4
4
  export declare const isFileTypeValid: (file: File, fileTypes: SupportedFileType[]) => boolean;
5
- export declare function isImageDomainValid(url: string): boolean;
6
5
  //# sourceMappingURL=file.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/utils/file.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GACzB,WAAW,GACX,YAAY,GACZ,WAAW,GACX,iBAAiB,GACjB,iBAAiB,GACjB,oBAAoB,GACpB,8BAA8B,GAC9B,yEAAyE,GACzE,mEAAmE,GACnE,0BAA0B,CAAC;AAE/B,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,EAWnD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,IAAI,EAAE,WAAW,MAAM,YAI5D,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,IAAI,EAAE,WAAW,iBAAiB,EAAE,YAEzE,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,WAI7C"}
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/utils/file.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GACzB,WAAW,GACX,YAAY,GACZ,WAAW,GACX,iBAAiB,GACjB,iBAAiB,GACjB,oBAAoB,GACpB,8BAA8B,GAC9B,yEAAyE,GACzE,mEAAmE,GACnE,0BAA0B,CAAC;AAE/B,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,EAWnD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,IAAI,EAAE,WAAW,MAAM,YAI5D,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,IAAI,EAAE,WAAW,iBAAiB,EAAE,YAEzE,CAAC"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isFileTypeValid = exports.isFileSizeValid = exports.SUPPORTED_FILE_TYPES = void 0;
4
- exports.isImageDomainValid = isImageDomainValid;
5
4
  exports.SUPPORTED_FILE_TYPES = [
6
5
  "image/png",
7
6
  "image/jpeg",
@@ -23,7 +22,3 @@ const isFileTypeValid = (file, fileTypes) => {
23
22
  return fileTypes.includes(file.type);
24
23
  };
25
24
  exports.isFileTypeValid = isFileTypeValid;
26
- function isImageDomainValid(url) {
27
- const parsedUrl = new URL(url);
28
- return parsedUrl.hostname === "sixtify.s3.amazonaws.com";
29
- }
@@ -1,5 +1,8 @@
1
1
  export type Layout = "mobile" | "tablet" | "desktop";
2
2
  export declare function useGetDeviceType(): {
3
3
  layout: Layout;
4
+ isMobile: boolean;
5
+ isTablet: boolean;
6
+ isDesktop: boolean;
4
7
  };
5
8
  //# sourceMappingURL=useGetDeviceType.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useGetDeviceType.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useGetDeviceType.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErD,wBAAgB,gBAAgB,IAAI;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAgBrD"}
1
+ {"version":3,"file":"useGetDeviceType.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useGetDeviceType.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErD,wBAAgB,gBAAgB,IAAI;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB,CAsBA"}
@@ -10,11 +10,15 @@ function useGetDeviceType() {
10
10
  const theme = (0, styles_1.useTheme)();
11
11
  const isMobile = (0, useMediaQuery_1.default)(theme.breakpoints.down("sm")); // <600px
12
12
  const isTablet = (0, useMediaQuery_1.default)(theme.breakpoints.between("sm", "md")); // 600–900px
13
- if (isMobile) {
14
- return { layout: "mobile" };
15
- }
16
- if (isTablet) {
17
- return { layout: "tablet" };
18
- }
19
- return { layout: "desktop" };
13
+ const isDesktop = (0, useMediaQuery_1.default)(theme.breakpoints.up("md")); // >900px
14
+ const getLayout = () => {
15
+ if (isMobile) {
16
+ return "mobile";
17
+ }
18
+ if (isTablet) {
19
+ return "tablet";
20
+ }
21
+ return "desktop";
22
+ };
23
+ return { layout: getLayout(), isMobile, isTablet, isDesktop };
20
24
  }