@vidispine/vdt-materialui 26.1.0 → 26.2.0-pre.2

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 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),S=require("react"),i=require("@material-ui/core"),h=e=>({root:{paddingTop:e.spacing(1),paddingBottom:e.spacing(1)},TextField:{},Button:{borderRadius:0}});function v({classes:e,itemSearchDocument:n,onSaveSearch:s,onSuccess:c=()=>{},onError:o=()=>{},nameText:u="New Saved Search",saveText:l="Save"}){const[t,d]=S.useState(""),m=a=>{if(a.preventDefault(),!t){o("No Name specified");return}s({metadata:{title:t.trim()},itemSearchDocument:n}).then(c).catch(o)};return r.jsxs("form",{className:e.root,onSubmit:m,children:[r.jsx(i.InputBase,{className:e.TextField,onChange:a=>d(a.target.value),fullWidth:!0,placeholder:u}),r.jsx(i.Button,{className:e.Button,disabled:!t||t.trim()==="",fullWidth:!0,color:"primary",variant:"contained",disableElevation:!0,type:"submit",children:l})]})}const p=i.withStyles(h,{name:"VdtSaveSearchForm"})(v);exports.default=p;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),u=require("react"),r=require("@material-ui/core"),p=e=>({root:{paddingTop:e.spacing(1),paddingBottom:e.spacing(1)},TextField:{},Button:{borderRadius:0}});function g({classes:e,itemSearchDocument:l,onSaveSearch:d,onSuccess:m=()=>{},onError:n=()=>{},nameText:S="New Saved Search",saveText:h="Save"}){const[t,v]=u.useState(""),[c,i]=u.useState(!1),f=s=>{if(s.preventDefault(),!t){n("No Name specified");return}i(!0),d({metadata:{title:t.trim()},itemSearchDocument:l}).then(o=>{i(!1),m(o)}).catch(o=>{i(!1),n(o)})};return a.jsxs("form",{className:e.root,onSubmit:f,children:[a.jsx(r.InputBase,{className:e.TextField,onChange:s=>v(s.target.value),fullWidth:!0,placeholder:S}),a.jsx(r.Button,{className:e.Button,disabled:!t||t.trim()===""||c,fullWidth:!0,color:"primary",variant:"contained",disableElevation:!0,type:"submit",children:c?a.jsx(r.CircularProgress,{size:24,color:"inherit"}):h})]})}const N=r.withStyles(p,{name:"VdtSaveSearchForm"})(g);exports.default=N;
@@ -1,7 +1,7 @@
1
- import { jsxs as u, jsx as o } from "react/jsx-runtime";
2
- import { useState as p } from "react";
3
- import { withStyles as S, InputBase as h, Button as f } from "@material-ui/core";
4
- const v = (e) => ({
1
+ import { jsxs as f, jsx as i } from "react/jsx-runtime";
2
+ import { useState as l } from "react";
3
+ import { withStyles as v, InputBase as g, Button as N, CircularProgress as b } from "@material-ui/core";
4
+ const x = (e) => ({
5
5
  root: {
6
6
  paddingTop: e.spacing(1),
7
7
  paddingBottom: e.spacing(1)
@@ -11,53 +11,57 @@ const v = (e) => ({
11
11
  borderRadius: 0
12
12
  }
13
13
  });
14
- function N({
14
+ function B({
15
15
  classes: e,
16
- itemSearchDocument: i,
17
- onSaveSearch: n,
16
+ itemSearchDocument: c,
17
+ onSaveSearch: d,
18
18
  onSuccess: m = () => {
19
19
  },
20
- onError: r = () => {
20
+ onError: s = () => {
21
21
  },
22
- nameText: c = "New Saved Search",
23
- saveText: d = "Save"
22
+ nameText: u = "New Saved Search",
23
+ saveText: h = "Save"
24
24
  }) {
25
- const [t, s] = p(""), l = (a) => {
26
- if (a.preventDefault(), !t) {
27
- r("No Name specified");
25
+ const [t, p] = l(""), [n, a] = l(!1), S = (r) => {
26
+ if (r.preventDefault(), !t) {
27
+ s("No Name specified");
28
28
  return;
29
29
  }
30
- n({
30
+ a(!0), d({
31
31
  metadata: { title: t.trim() },
32
- itemSearchDocument: i
33
- }).then(m).catch(r);
32
+ itemSearchDocument: c
33
+ }).then((o) => {
34
+ a(!1), m(o);
35
+ }).catch((o) => {
36
+ a(!1), s(o);
37
+ });
34
38
  };
35
- return /* @__PURE__ */ u("form", { className: e.root, onSubmit: l, children: [
36
- /* @__PURE__ */ o(
37
- h,
39
+ return /* @__PURE__ */ f("form", { className: e.root, onSubmit: S, children: [
40
+ /* @__PURE__ */ i(
41
+ g,
38
42
  {
39
43
  className: e.TextField,
40
- onChange: (a) => s(a.target.value),
44
+ onChange: (r) => p(r.target.value),
41
45
  fullWidth: !0,
42
- placeholder: c
46
+ placeholder: u
43
47
  }
44
48
  ),
45
- /* @__PURE__ */ o(
46
- f,
49
+ /* @__PURE__ */ i(
50
+ N,
47
51
  {
48
52
  className: e.Button,
49
- disabled: !t || t.trim() === "",
53
+ disabled: !t || t.trim() === "" || n,
50
54
  fullWidth: !0,
51
55
  color: "primary",
52
56
  variant: "contained",
53
57
  disableElevation: !0,
54
58
  type: "submit",
55
- children: d
59
+ children: n ? /* @__PURE__ */ i(b, { size: 24, color: "inherit" }) : h
56
60
  }
57
61
  )
58
62
  ] });
59
63
  }
60
- const B = S(v, { name: "VdtSaveSearchForm" })(N);
64
+ const j = v(x, { name: "VdtSaveSearchForm" })(B);
61
65
  export {
62
- B as default
66
+ j as default
63
67
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vidispine/vdt-materialui",
3
- "version": "26.1.0",
3
+ "version": "26.2.0-pre.2",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -36,11 +36,11 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@babel/runtime": "7.26.10",
39
- "@vidispine/proptypes": "26.1.0",
40
- "@vidispine/vdt-api": "26.1.0",
41
- "@vidispine/vdt-js": "26.1.0",
42
- "@vidispine/vdt-react": "26.1.0",
43
- "@vidispine/vdt-videojs-react": "26.1.0",
39
+ "@vidispine/proptypes": "26.2.0-pre.2",
40
+ "@vidispine/vdt-api": "26.2.0-pre.2",
41
+ "@vidispine/vdt-js": "26.2.0-pre.2",
42
+ "@vidispine/vdt-react": "26.2.0-pre.2",
43
+ "@vidispine/vdt-videojs-react": "26.2.0-pre.2",
44
44
  "clsx": "1.2.1",
45
45
  "filesize": "10.1.0",
46
46
  "final-form": "4.20.10",
@@ -74,11 +74,11 @@
74
74
  "@material-ui/icons": "4.11.3",
75
75
  "@material-ui/lab": "4.0.0-alpha.61",
76
76
  "@types/jest": "29.5.11",
77
- "@vidispine/eslint-config-mdx": "26.1.0",
78
- "@vidispine/eslint-config-react": "26.1.0",
79
- "@vidispine/eslint-config-storybook": "26.1.0",
80
- "@vidispine/prettier-config": "26.1.0",
81
- "@vidispine/proptypes": "26.1.0",
77
+ "@vidispine/eslint-config-mdx": "26.2.0-pre.2",
78
+ "@vidispine/eslint-config-react": "26.2.0-pre.2",
79
+ "@vidispine/eslint-config-storybook": "26.2.0-pre.2",
80
+ "@vidispine/prettier-config": "26.2.0-pre.2",
81
+ "@vidispine/proptypes": "26.2.0-pre.2",
82
82
  "@vitejs/plugin-react": "4.2.1",
83
83
  "@wojtekmaj/enzyme-adapter-react-17": "0.8.0",
84
84
  "axios": "1.13.5",