orc-shared 1.2.0 → 1.3.0-dev.3

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.
@@ -156,6 +156,7 @@ var InputBase = function InputBase(_ref) {
156
156
  var endAdornment = inputProps == null ? void 0 : inputProps.get(_InputBaseProps.default.propNames.endAdornment);
157
157
  var metadata = inputProps == null ? void 0 : inputProps.get(_InputBaseProps.default.propNames.metadata);
158
158
  var autoComplete = inputProps == null ? void 0 : inputProps.get(_InputBaseProps.default.propNames.autoComplete);
159
+ var timeoutDelay = (inputProps == null ? void 0 : inputProps.get(_InputBaseProps.default.propNames.timeoutDelay)) || 100;
159
160
  var tooltipText = type === "text" ? value : "";
160
161
 
161
162
  var onClick = function onClick(item) {
@@ -193,7 +194,7 @@ var InputBase = function InputBase(_ref) {
193
194
  if (inputText !== value && inputText != null && window.bypassDebounce !== true) {
194
195
  var timeOutId = setTimeout(function () {
195
196
  return update(inputText, metadata);
196
- }, 100);
197
+ }, timeoutDelay);
197
198
  return function () {
198
199
  return clearTimeout(timeOutId);
199
200
  };
@@ -69,6 +69,8 @@ var InputBaseProps = /*#__PURE__*/function (_ComponentProps) {
69
69
 
70
70
  _this.componentProps.set(_this.constructor.propNames.autoComplete, null);
71
71
 
72
+ _this.componentProps.set(_this.constructor.propNames.timeoutDelay, null);
73
+
72
74
  _this.componentClasses.set(_this.constructor.ruleNames.input, null);
73
75
 
74
76
  _this.componentClasses.set(_this.constructor.ruleNames.errorText, null);
@@ -103,7 +105,8 @@ _defineProperty(InputBaseProps, "propNames", {
103
105
  startAdornment: "startAdornment",
104
106
  endAdornment: "endAdornment",
105
107
  metadata: "metadata",
106
- autoComplete: "autoComplete"
108
+ autoComplete: "autoComplete",
109
+ timeoutDelay: "timeoutDelay"
107
110
  });
108
111
 
109
112
  _defineProperty(InputBaseProps, "ruleNames", {
@@ -295,6 +295,9 @@ var TimePicker = function TimePicker(_ref4) {
295
295
  time = _useState2[0],
296
296
  setTime = _useState2[1];
297
297
 
298
+ (0, _react.useEffect)(function () {
299
+ setTime(parseTime(value || "00:00"));
300
+ }, [value, setTime]);
298
301
  var userTimeZone = (0, _timezoneHelper.getTimeZoneName)();
299
302
  var localizedTimeZoneName = (0, _reactRedux.useSelector)((0, _metadata.namedLookupLocalizedSelector)("customer", "TimeZone", userTimeZone, null));
300
303
 
@@ -365,11 +368,11 @@ var TimePicker = function TimePicker(_ref4) {
365
368
  }, showTimeZone && getTimeZone(requestedTimeZone)));
366
369
  };
367
370
 
368
- __signature__(TimePicker, "useStyles{classes}\nuseState{[time, setTime](parseTime(value || \"00:00\"))}\nuseSelector{localizedTimeZoneName}", function () {
371
+ __signature__(TimePicker, "useStyles{classes}\nuseState{[time, setTime](parseTime(value || \"00:00\"))}\nuseEffect{}\nuseSelector{localizedTimeZoneName}", function () {
369
372
  return [useStyles, _reactRedux.useSelector];
370
373
  });
371
374
 
372
- __signature__(TimePicker, "useStyles{classes}\nuseState{[time, setTime](parseTime(value || \"00:00\"))}\nuseSelector{localizedTimeZoneName}", function () {
375
+ __signature__(TimePicker, "useStyles{classes}\nuseState{[time, setTime](parseTime(value || \"00:00\"))}\nuseEffect{}\nuseSelector{localizedTimeZoneName}", function () {
373
376
  return [useStyles, _reactRedux.useSelector];
374
377
  });
375
378
 
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path fill="#333" fill-rule="evenodd" d="M23.5,3 C23.7761424,3 24,3.22385763 24,3.5 L24,3.5 L24,8.5 C24,8.77614237 23.7761424,9 23.5,9 L23.5,9 L23,9 L23,21.5 C23,21.7454599 22.8231248,21.9496084 22.5898756,21.9919443 L22.5,22 L1.5,22 C1.22385763,22 1,21.7761424 1,21.5 L1,21.5 L1,9 L0.5,9 C0.254540111,9 0.0503916296,8.82312484 0.00805566941,8.58987563 L0,8.5 L0,3.5 C0,3.22385763 0.223857625,3 0.5,3 L0.5,3 Z M22,9 L2,9 L2,21 L22,21 L22,9 Z M15.5,11 C15.7761424,11 16,11.2238576 16,11.5 L16,11.5 L16,13.5 C16,13.7761424 15.7761424,14 15.5,14 L15.5,14 L8.5,14 C8.22385763,14 8,13.7761424 8,13.5 L8,13.5 L8,11.5 C8,11.2238576 8.22385763,11 8.5,11 L8.5,11 Z M15,12 L9,12 L9,13 L15,13 L15,12 Z M23,4 L1,4 L1,8 L23,8 L23,4 Z"/>
3
+ </svg>
@@ -8,6 +8,9 @@
8
8
  <symbol id="icon-app-list" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
9
9
  <path stroke="none" fill-rule="evenodd" d="M21,18 C22.7,18 24,19.3 24,21 C24,22.7 22.7,24 21,24 C19.3,24 18,22.7 18,21 C18,19.3 19.3,18 21,18 Z M3,0 C4.7,0 6,1.3 6,3 C6,4.7 4.7,6 3,6 C1.3,6 0,4.7 0,3 C0,1.3 1.3,0 3,0 Z M12,0 C13.7,0 15,1.3 15,3 C15,4.7 13.7,6 12,6 C10.3,6 9,4.7 9,3 C9,1.3 10.3,0 12,0 Z M21,0 C22.7,0 24,1.3 24,3 C24,4.7 22.7,6 21,6 C19.3,6 18,4.7 18,3 C18,1.3 19.3,0 21,0 Z M3,9 C4.7,9 6,10.3 6,12 C6,13.7 4.7,15 3,15 C1.3,15 0,13.7 0,12 C0,10.3 1.3,9 3,9 Z M12,9 C13.7,9 15,10.3 15,12 C15,13.7 13.7,15 12,15 C10.3,15 9,13.7 9,12 C9,10.3 10.3,9 12,9 Z M21,9 C22.7,9 24,10.3 24,12 C24,13.7 22.7,15 21,15 C19.3,15 18,13.7 18,12 C18,10.3 19.3,9 21,9 Z M3,18 C4.7,18 6,19.3 6,21 C6,22.7 4.7,24 3,24 C1.3,24 0,22.7 0,21 C0,19.3 1.3,18 3,18 Z M12,18 C13.7,18 15,19.3 15,21 C15,22.7 13.7,24 12,24 C10.3,24 9,22.7 9,21 C9,19.3 10.3,18 12,18 Z"/>
10
10
  </symbol>
11
+ <symbol id="icon-archives" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
12
+ <path stroke="none" fill-rule="evenodd" d="M23.5,3 C23.7761424,3 24,3.22385763 24,3.5 L24,3.5 L24,8.5 C24,8.77614237 23.7761424,9 23.5,9 L23.5,9 L23,9 L23,21.5 C23,21.7454599 22.8231248,21.9496084 22.5898756,21.9919443 L22.5,22 L1.5,22 C1.22385763,22 1,21.7761424 1,21.5 L1,21.5 L1,9 L0.5,9 C0.254540111,9 0.0503916296,8.82312484 0.00805566941,8.58987563 L0,8.5 L0,3.5 C0,3.22385763 0.223857625,3 0.5,3 L0.5,3 Z M22,9 L2,9 L2,21 L22,21 L22,9 Z M15.5,11 C15.7761424,11 16,11.2238576 16,11.5 L16,11.5 L16,13.5 C16,13.7761424 15.7761424,14 15.5,14 L15.5,14 L8.5,14 C8.22385763,14 8,13.7761424 8,13.5 L8,13.5 L8,11.5 C8,11.2238576 8.22385763,11 8.5,11 L8.5,11 Z M15,12 L9,12 L9,13 L15,13 L15,12 Z M23,4 L1,4 L1,8 L23,8 L23,4 Z"/>
13
+ </symbol>
11
14
  <symbol id="icon-arrow-large-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 21 21">
12
15
  <path stroke="none" fill-rule="evenodd" d="M8.79069767,17.6511628 C8.69302326,17.6511628 8.59534884,17.6511628 8.49767442,17.5534884 L0.195348837,10.7162791 C0.0976744186,10.6186047 0,10.5209302 0,10.3255814 C0,10.1302326 0.0976744186,10.0325581 0.195348837,9.93488372 L8.49767442,3.09767442 C8.59534884,3 8.79069767,3 8.98604651,3 C9.18139535,3.09767442 9.27906977,3.29302326 9.27906977,3.48837209 L9.27906977,6.90697674 L20.5116279,6.90697674 C20.8046512,6.90697674 21,7.10232558 21,7.39534884 L21,13.255814 C21,13.5488372 20.8046512,13.744186 20.5116279,13.744186 L9.27906977,13.744186 L9.27906977,17.1627907 C9.27906977,17.3581395 9.18139535,17.5534884 8.98604651,17.6511628 C8.88837209,17.6511628 8.88837209,17.6511628 8.79069767,17.6511628 Z M1.26976744,10.3255814 L8.30232558,16.0883721 L8.30232558,13.255814 C8.30232558,12.9627907 8.49767442,12.7674419 8.79069767,12.7674419 L20.0232558,12.7674419 L20.0232558,7.88372093 L8.79069767,7.88372093 C8.49767442,7.88372093 8.30232558,7.68837209 8.30232558,7.39534884 L8.30232558,4.5627907 L1.26976744,10.3255814 Z"/>
13
16
  </symbol>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orc-shared",
3
- "version": "1.2.0",
3
+ "version": "1.3.0-dev.3",
4
4
  "description": "Shared code for Orckestra applications",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
@@ -49,7 +49,7 @@
49
49
  ],
50
50
  "devDependencies": {},
51
51
  "peerDependencies": {
52
- "orc-scripts": "1.3.0"
52
+ "orc-scripts": "1.3.0-dev.2"
53
53
  },
54
54
  "sideEffects": false,
55
55
  "lint-staged": {
@@ -69,6 +69,6 @@
69
69
  }
70
70
  },
71
71
  "dependencies": {
72
- "orc-scripts": "1.3.0"
72
+ "orc-scripts": "1.3.0-dev.2"
73
73
  }
74
74
  }
@@ -99,6 +99,7 @@ const InputBase = ({ inputProps }) => {
99
99
  const endAdornment = inputProps?.get(InputBaseProps.propNames.endAdornment);
100
100
  const metadata = inputProps?.get(InputBaseProps.propNames.metadata);
101
101
  const autoComplete = inputProps?.get(InputBaseProps.propNames.autoComplete);
102
+ const timeoutDelay = inputProps?.get(InputBaseProps.propNames.timeoutDelay) || 100;
102
103
 
103
104
  const tooltipText = type === "text" ? value : "";
104
105
 
@@ -128,7 +129,7 @@ const InputBase = ({ inputProps }) => {
128
129
 
129
130
  React.useEffect(() => {
130
131
  if (inputText !== value && inputText != null && window.bypassDebounce !== true) {
131
- const timeOutId = setTimeout(() => update(inputText, metadata), 100);
132
+ const timeOutId = setTimeout(() => update(inputText, metadata), timeoutDelay);
132
133
  return () => clearTimeout(timeOutId);
133
134
  }
134
135
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -17,6 +17,7 @@ class InputBaseProps extends ComponentProps {
17
17
  endAdornment: "endAdornment",
18
18
  metadata: "metadata",
19
19
  autoComplete: "autoComplete",
20
+ timeoutDelay: "timeoutDelay",
20
21
  };
21
22
 
22
23
  static ruleNames = {
@@ -41,6 +42,7 @@ class InputBaseProps extends ComponentProps {
41
42
  this.componentProps.set(this.constructor.propNames.endAdornment, null);
42
43
  this.componentProps.set(this.constructor.propNames.metadata, null);
43
44
  this.componentProps.set(this.constructor.propNames.autoComplete, null);
45
+ this.componentProps.set(this.constructor.propNames.timeoutDelay, null);
44
46
 
45
47
  this.componentClasses.set(this.constructor.ruleNames.input, null);
46
48
  this.componentClasses.set(this.constructor.ruleNames.errorText, null);
@@ -18,6 +18,7 @@ describe("InputBase Props", () => {
18
18
  "endAdornment",
19
19
  "metadata",
20
20
  "autoComplete",
21
+ "timeoutDelay",
21
22
  ];
22
23
 
23
24
  expect(InputBaseProps.propNames, "to have keys", propNames);
@@ -40,6 +41,7 @@ describe("InputBase Props", () => {
40
41
  "endAdornment",
41
42
  "metadata",
42
43
  "autoComplete",
44
+ "timeoutDelay",
43
45
  ];
44
46
 
45
47
  const ruleNames = ["input", "errorText"];
@@ -1,4 +1,4 @@
1
- import React, { useState } from "react";
1
+ import React, { useState, useEffect } from "react";
2
2
  import { makeStyles } from "@material-ui/core/styles";
3
3
  import Select from "./Select";
4
4
  import SelectProps from "./SelectProps";
@@ -178,7 +178,11 @@ export const MinsSelect = ({ updateTimeOptions, time }) => {
178
178
  const TimePicker = ({ value, onChange, showTimeZone, showAMPM, requestedTimeZone }) => {
179
179
  const classes = useStyles();
180
180
  showAMPM = showAMPM ?? isBrowserUsingAMPM();
181
- const [time, setTime] = useState(parseTime(value || "00:00"));
181
+ const [time, setTime] = useState( parseTime(value || "00:00"));
182
+
183
+ useEffect(() => {
184
+ setTime(parseTime(value || "00:00"));
185
+ }, [value, setTime]);
182
186
 
183
187
  const userTimeZone = getTimeZoneName();
184
188
  const localizedTimeZoneName = useSelector(namedLookupLocalizedSelector("customer", "TimeZone", userTimeZone, null));
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
+ <path fill="#333" fill-rule="evenodd" d="M23.5,3 C23.7761424,3 24,3.22385763 24,3.5 L24,3.5 L24,8.5 C24,8.77614237 23.7761424,9 23.5,9 L23.5,9 L23,9 L23,21.5 C23,21.7454599 22.8231248,21.9496084 22.5898756,21.9919443 L22.5,22 L1.5,22 C1.22385763,22 1,21.7761424 1,21.5 L1,21.5 L1,9 L0.5,9 C0.254540111,9 0.0503916296,8.82312484 0.00805566941,8.58987563 L0,8.5 L0,3.5 C0,3.22385763 0.223857625,3 0.5,3 L0.5,3 Z M22,9 L2,9 L2,21 L22,21 L22,9 Z M15.5,11 C15.7761424,11 16,11.2238576 16,11.5 L16,11.5 L16,13.5 C16,13.7761424 15.7761424,14 15.5,14 L15.5,14 L8.5,14 C8.22385763,14 8,13.7761424 8,13.5 L8,13.5 L8,11.5 C8,11.2238576 8.22385763,11 8.5,11 L8.5,11 Z M15,12 L9,12 L9,13 L15,13 L15,12 Z M23,4 L1,4 L1,8 L23,8 L23,4 Z"/>
3
+ </svg>
@@ -8,6 +8,9 @@
8
8
  <symbol id="icon-app-list" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
9
9
  <path stroke="none" fill-rule="evenodd" d="M21,18 C22.7,18 24,19.3 24,21 C24,22.7 22.7,24 21,24 C19.3,24 18,22.7 18,21 C18,19.3 19.3,18 21,18 Z M3,0 C4.7,0 6,1.3 6,3 C6,4.7 4.7,6 3,6 C1.3,6 0,4.7 0,3 C0,1.3 1.3,0 3,0 Z M12,0 C13.7,0 15,1.3 15,3 C15,4.7 13.7,6 12,6 C10.3,6 9,4.7 9,3 C9,1.3 10.3,0 12,0 Z M21,0 C22.7,0 24,1.3 24,3 C24,4.7 22.7,6 21,6 C19.3,6 18,4.7 18,3 C18,1.3 19.3,0 21,0 Z M3,9 C4.7,9 6,10.3 6,12 C6,13.7 4.7,15 3,15 C1.3,15 0,13.7 0,12 C0,10.3 1.3,9 3,9 Z M12,9 C13.7,9 15,10.3 15,12 C15,13.7 13.7,15 12,15 C10.3,15 9,13.7 9,12 C9,10.3 10.3,9 12,9 Z M21,9 C22.7,9 24,10.3 24,12 C24,13.7 22.7,15 21,15 C19.3,15 18,13.7 18,12 C18,10.3 19.3,9 21,9 Z M3,18 C4.7,18 6,19.3 6,21 C6,22.7 4.7,24 3,24 C1.3,24 0,22.7 0,21 C0,19.3 1.3,18 3,18 Z M12,18 C13.7,18 15,19.3 15,21 C15,22.7 13.7,24 12,24 C10.3,24 9,22.7 9,21 C9,19.3 10.3,18 12,18 Z"/>
10
10
  </symbol>
11
+ <symbol id="icon-archives" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
12
+ <path stroke="none" fill-rule="evenodd" d="M23.5,3 C23.7761424,3 24,3.22385763 24,3.5 L24,3.5 L24,8.5 C24,8.77614237 23.7761424,9 23.5,9 L23.5,9 L23,9 L23,21.5 C23,21.7454599 22.8231248,21.9496084 22.5898756,21.9919443 L22.5,22 L1.5,22 C1.22385763,22 1,21.7761424 1,21.5 L1,21.5 L1,9 L0.5,9 C0.254540111,9 0.0503916296,8.82312484 0.00805566941,8.58987563 L0,8.5 L0,3.5 C0,3.22385763 0.223857625,3 0.5,3 L0.5,3 Z M22,9 L2,9 L2,21 L22,21 L22,9 Z M15.5,11 C15.7761424,11 16,11.2238576 16,11.5 L16,11.5 L16,13.5 C16,13.7761424 15.7761424,14 15.5,14 L15.5,14 L8.5,14 C8.22385763,14 8,13.7761424 8,13.5 L8,13.5 L8,11.5 C8,11.2238576 8.22385763,11 8.5,11 L8.5,11 Z M15,12 L9,12 L9,13 L15,13 L15,12 Z M23,4 L1,4 L1,8 L23,8 L23,4 Z"/>
13
+ </symbol>
11
14
  <symbol id="icon-arrow-large-left" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 21 21">
12
15
  <path stroke="none" fill-rule="evenodd" d="M8.79069767,17.6511628 C8.69302326,17.6511628 8.59534884,17.6511628 8.49767442,17.5534884 L0.195348837,10.7162791 C0.0976744186,10.6186047 0,10.5209302 0,10.3255814 C0,10.1302326 0.0976744186,10.0325581 0.195348837,9.93488372 L8.49767442,3.09767442 C8.59534884,3 8.79069767,3 8.98604651,3 C9.18139535,3.09767442 9.27906977,3.29302326 9.27906977,3.48837209 L9.27906977,6.90697674 L20.5116279,6.90697674 C20.8046512,6.90697674 21,7.10232558 21,7.39534884 L21,13.255814 C21,13.5488372 20.8046512,13.744186 20.5116279,13.744186 L9.27906977,13.744186 L9.27906977,17.1627907 C9.27906977,17.3581395 9.18139535,17.5534884 8.98604651,17.6511628 C8.88837209,17.6511628 8.88837209,17.6511628 8.79069767,17.6511628 Z M1.26976744,10.3255814 L8.30232558,16.0883721 L8.30232558,13.255814 C8.30232558,12.9627907 8.49767442,12.7674419 8.79069767,12.7674419 L20.0232558,12.7674419 L20.0232558,7.88372093 L8.79069767,7.88372093 C8.49767442,7.88372093 8.30232558,7.68837209 8.30232558,7.39534884 L8.30232558,4.5627907 L1.26976744,10.3255814 Z"/>
13
16
  </symbol>