ublo-lib 1.0.3 → 1.0.6

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.
@@ -10,7 +10,7 @@ import * as Messages from "./messages";
10
10
  import * as Data from "./data";
11
11
  import * as Validation from "./validation";
12
12
  import * as API from "./api";
13
- import css from "./contact-form.module.css";
13
+ import css from "./gesco-contact-form.module.css";
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
16
 
@@ -0,0 +1,57 @@
1
+ import * as React from "react";
2
+ import classnames from "classnames";
3
+ import styles from "./index.module.css";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ import { Fragment as _Fragment } from "react/jsx-runtime";
7
+
8
+ const Loader = () => _jsx("div", {
9
+ className: styles.loader
10
+ });
11
+
12
+ const PackagesSelector = ({
13
+ onSubmit,
14
+ resort,
15
+ selected
16
+ }) => {
17
+ const [packages, setPackages] = React.useState();
18
+ React.useEffect(() => {
19
+ const getPackages = async () => {
20
+ const result = await fetch(`https://services.msem.tech/api/package/list/LBM?resort=${resort}`);
21
+ const json = await result.json();
22
+ setPackages(json);
23
+ };
24
+
25
+ getPackages();
26
+ return () => setPackages(undefined);
27
+ }, [resort]);
28
+ return _jsxs("div", {
29
+ className: styles.root,
30
+ children: [_jsx("div", {
31
+ className: styles.title,
32
+ children: "S\xE9lectionnez le package \xE0 associer \xE0 cette section."
33
+ }), !packages && _jsx(Loader, {}), packages && _jsx(_Fragment, {
34
+ children: _jsx("div", {
35
+ className: styles.inner,
36
+ children: packages.map((item, i) => {
37
+ const {
38
+ id,
39
+ name
40
+ } = item;
41
+ const classes = classnames(styles.item, {
42
+ [styles.itemSelected]: selected && parseInt(selected) === id
43
+ });
44
+ return _jsxs("button", {
45
+ className: classes,
46
+ onClick: () => onSubmit(id),
47
+ children: [_jsxs("b", {
48
+ children: ["#", id]
49
+ }), " ", name]
50
+ }, i);
51
+ })
52
+ })
53
+ })]
54
+ });
55
+ };
56
+
57
+ export default PackagesSelector;
@@ -0,0 +1,76 @@
1
+ .root {
2
+ position: relative;
3
+ width: 400px;
4
+ max-width: 100%;
5
+ height: 300px;
6
+ max-height: 100%;
7
+ display: flex;
8
+ flex-direction: column;
9
+ }
10
+
11
+ .title {
12
+ flex: 0 0 auto;
13
+ }
14
+
15
+ .inner {
16
+ flex: 1 1 100%;
17
+ position: relative;
18
+ display: flex;
19
+ flex-direction: column;
20
+ padding-top: 10px;
21
+ overflow: auto;
22
+ }
23
+
24
+ .inner::-webkit-scrollbar {
25
+ width: 5px;
26
+ background-color: rgba(#000, 0.05);
27
+ }
28
+
29
+ .inner::-webkit-scrollbar-track {
30
+ background-color: rgba(#000, 0.05);
31
+ }
32
+
33
+ .inner::-webkit-scrollbar-thumb {
34
+ background-color: #484848;
35
+ }
36
+
37
+ .item {
38
+ margin: 5px 0;
39
+ padding: 10px;
40
+ text-align: left;
41
+ background-color: #f5f5f5;
42
+ border-radius: 8px;
43
+ cursor: pointer;
44
+ }
45
+
46
+ .itemSelected {
47
+ color: #fff;
48
+ background-color: var(--cms-primary-color, #004cc2);
49
+ }
50
+
51
+ .loader {
52
+ position: absolute;
53
+ top: 0;
54
+ left: 0;
55
+ width: 100%;
56
+ height: 100%;
57
+ display: flex;
58
+ align-items: center;
59
+ justify-content: center;
60
+ }
61
+ .loader::after {
62
+ content: "";
63
+ width: 42px;
64
+ height: 42px;
65
+ border: 4px solid #f5f5f5;
66
+ border-bottom-color: var(--cms-primary-color, #004cc2);
67
+ box-sizing: border-box;
68
+ border-radius: 50%;
69
+ animation: packages-loader-spining 640ms ease-in-out infinite;
70
+ }
71
+
72
+ @keyframes packages-loader-spining {
73
+ 100% {
74
+ transform: rotate(360deg);
75
+ }
76
+ }
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { useUbloContext } from "ublo/with-ublo";
3
- import PackagesSelector from "../packages-selector";
3
+ import PackagesSelector from "../components/packages-selector";
4
4
  import { loadJS } from "../utils/load-js";
5
5
  import { openMseM } from "../utils/msem-widget";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -1 +1 @@
1
- export { default, EDITING, CONNECTED } from "./msem-widget-linker";
1
+ export { default, EDITING, CONNECTED } from "./msem-linker";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "peerDependencies": {
5
5
  "react": "^18.2.0",
6
6
  "react-dom": "^18.2.0",