@m4l/components 0.0.14 → 0.0.15

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.
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { Props } from './types';
3
- export default function Image({ ratio, sx, isSekeleton, width, height, src, ...other }: Props): JSX.Element;
3
+ export declare function Image({ ratio, sx, isSekeleton, width, height, src, ...other }: Props): JSX.Element;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { defaultProps } from './types';
3
- export default function LanguagePopover(props: defaultProps): JSX.Element;
3
+ export declare function LanguagePopover(props: defaultProps): JSX.Element;
@@ -1,7 +1,43 @@
1
- import "react";
2
- import "@mui/material";
3
- import "../../react-lazy-load-image-component.js";
4
- import "@mui/material/styles";
5
- import "../Image/index.js";
6
- import "react/jsx-runtime";
7
- import "@m4l/graphics";
1
+ import { useState } from "react";
2
+ import { Skeleton, IconButton } from "@mui/material";
3
+ import { I as Image } from "../Image/index.js";
4
+ import { useLocales } from "@m4l/graphics";
5
+ import { jsx, Fragment } from "react/jsx-runtime";
6
+ function LanguagePopover(props) {
7
+ const {
8
+ isSkeleton
9
+ } = props;
10
+ const {
11
+ allLang,
12
+ currentLang,
13
+ onChangeLang
14
+ } = useLocales();
15
+ const [open, setOpen] = useState(null);
16
+ const handleOpen = (event) => {
17
+ setOpen(event.currentTarget);
18
+ };
19
+ if (isSkeleton) {
20
+ return /* @__PURE__ */ jsx(Skeleton, {
21
+ variant: "circular",
22
+ width: 20,
23
+ height: 20
24
+ });
25
+ }
26
+ return /* @__PURE__ */ jsx(Fragment, {
27
+ children: /* @__PURE__ */ jsx(IconButton, {
28
+ onClick: handleOpen,
29
+ sx: {
30
+ width: 40,
31
+ height: 40,
32
+ ...open && {
33
+ bgcolor: "action.selected"
34
+ }
35
+ },
36
+ children: /* @__PURE__ */ jsx(Image, {
37
+ src: currentLang.icon,
38
+ alt: currentLang.label
39
+ })
40
+ })
41
+ });
42
+ }
43
+ export { LanguagePopover as L };
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import "@m4l/graphics";
18
18
  export { C as CompanyLogo } from "./components/CompanyLogo/index.js";
19
19
  import "./react-lazy-load-image-component.js";
20
20
  import "@mui/material/styles";
21
- import "./components/Image/index.js";
21
+ export { I as Image } from "./components/Image/index.js";
22
22
  export { D as DataGrid, g as getGridComponentsDictionary } from "./components/DataGrid/index.js";
23
23
  import "react-dnd";
24
24
  import "react-dnd-html5-backend";
@@ -42,6 +42,7 @@ export { D as DateFormatter } from "./components/DataGrid/formatters/DateFormatt
42
42
  export { R as RHFMultiCheckbox } from "./components/hook-form/RHFMultiCheckbox/index.js";
43
43
  export { R as RHFSelect } from "./components/hook-form/RHFSelect.js";
44
44
  export { R as RHFRadioGroup } from "./components/hook-form/RHFRadioGroup.js";
45
+ export { L as LanguagePopover } from "./components/LanguagePopover/index.js";
45
46
  export { L as Loadable } from "./components/Loadable/index.js";
46
47
  export { A as Accordion } from "./components/mui_extended/Accordion/index.js";
47
48
  export { B as BoxIcon } from "./components/mui_extended/BoxIcon/index.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
3
  "private": false,
4
- "version": "0.0.14",
4
+ "version": "0.0.15",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {
7
7
  "dev": "vite",