@jobber/components 4.2.0 → 4.2.2-mike-pre.9

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,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { CivilDate } from "@std-proposal/temporal";
2
+ import { AtlantisTemporalPlainDateTime } from "../InputTime";
3
3
  /**
4
4
  * Options for deciding how much information is shown to the user
5
5
  * days, hours, minutes, seconds
@@ -11,7 +11,7 @@ interface CountdownProps {
11
11
  * Civil Time of time is to be displayed.
12
12
  * In the case of `date` a `string` should be in ISO 8601 format
13
13
  */
14
- readonly date: CivilDate | Date | number | string;
14
+ readonly date: AtlantisTemporalPlainDateTime | Date | number | string;
15
15
  /**
16
16
  * Whether or not to present the unit of time to the user, or just the raw numbers.
17
17
  */
@@ -3,8 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
- var temporal = require('@std-proposal/temporal');
7
6
  var ReactCountdown = require('react-countdown');
7
+ var polyfill = require('@js-temporal/polyfill');
8
+ var temporal = require('@std-proposal/temporal');
8
9
 
9
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
11
 
@@ -18,7 +19,8 @@ function computeTimeUnit(remainder, unit) {
18
19
  function Countdown({ date: inputDate, onComplete, showUnits, granularity = "dhms", }) {
19
20
  const date = React.useMemo(() => {
20
21
  let initDate;
21
- if (inputDate instanceof temporal.CivilDate) {
22
+ if (inputDate instanceof polyfill.Temporal.PlainDateTime ||
23
+ inputDate instanceof temporal.CivilDate) {
22
24
  initDate = new Date(inputDate.year, inputDate.month - 1, inputDate.day);
23
25
  }
24
26
  else {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var DatePicker = require('../DatePicker-e085dff4.js');
5
+ var DatePicker = require('../DatePicker-90d542d7.js');
6
6
  require('react');
7
7
  require('classnames');
8
8
  require('react-datepicker');
@@ -37,7 +37,10 @@ function InternalActivator(props, ref) {
37
37
  if (activator) {
38
38
  if (React.isValidElement(activator)) {
39
39
  const isAComponent = typeof activator.type === "function";
40
- return React.cloneElement(activator, Object.assign(Object.assign(Object.assign({}, newActivatorProps), (isAComponent && { fullWidth: fullWidth })), { ref }));
40
+ return React.cloneElement(activator, Object.assign(Object.assign(Object.assign({}, newActivatorProps), (isAComponent && { fullWidth: fullWidth })), {
41
+ // @ts-expect-error - Issue with react types not including `ref` in
42
+ // cloneElement. https://github.com/DefinitelyTyped/DefinitelyTyped/issues/40888
43
+ ref }));
41
44
  }
42
45
  else {
43
46
  return activator(props);
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
+ var jobberHooks = require('@jobber/hooks');
6
7
  var styleInject_es = require('../style-inject.es-9d2f5f4e.js');
7
- var Heading = require('../Heading-8c6e4e0b.js');
8
8
  var Icon = require('../Icon-405a216c.js');
9
- require('../Typography-dd9717e7.js');
10
- require('classnames');
9
+ var Typography = require('../Typography-dd9717e7.js');
11
10
  require('@jobber/design');
11
+ require('classnames');
12
12
 
13
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
14
 
@@ -21,13 +21,15 @@ styleInject_es.styleInject(css_248z);
21
21
  function Disclosure({ children, title, defaultOpen = false, }) {
22
22
  const [isOpen, setOpen] = React.useState(defaultOpen);
23
23
  const [isMounted, setMount] = React.useState(false);
24
+ const [titleRef, { exactWidth }] = jobberHooks.useResizeObserver();
25
+ const isBelowBreakpoint = exactWidth && exactWidth < jobberHooks.Breakpoints.small;
24
26
  React.useEffect(() => {
25
27
  setMount(true);
26
28
  }, []);
27
29
  return (React__default["default"].createElement("details", { open: isOpen, onToggle: onToggle, className: styles.details },
28
30
  React__default["default"].createElement("summary", { className: styles.summary },
29
- React__default["default"].createElement("div", { className: styles.summaryWrap },
30
- React__default["default"].createElement(Heading.Heading, { level: 4 }, title),
31
+ React__default["default"].createElement("div", { className: styles.summaryWrap, ref: titleRef },
32
+ React__default["default"].createElement(Typography.Typography, { element: "h4", size: isBelowBreakpoint ? "base" : "large", fontWeight: "bold", textColor: "heading" }, title),
31
33
  React__default["default"].createElement("span", { className: styles.arrowIconWrapper },
32
34
  React__default["default"].createElement(Icon.Icon, { size: "large", name: "arrowDown", color: "green" })))),
33
35
  React__default["default"].createElement("span", { className: styles.content }, children)));
@@ -1,12 +1,12 @@
1
1
  /// <reference types="react" />
2
- import { CivilDate } from "@std-proposal/temporal";
2
+ import { AtlantisTemporalPlainDateTime } from "../InputTime";
3
3
  interface FormatDateProps {
4
4
  /**
5
5
  * Date to be formatted.
6
6
  *
7
7
  * A `string` should be an ISO 8601 format date string.
8
8
  */
9
- readonly date: CivilDate | Date | string;
9
+ readonly date: AtlantisTemporalPlainDateTime | Date | string;
10
10
  }
11
11
  export declare function FormatDate({ date: inputDate }: FormatDateProps): JSX.Element;
12
12
  export declare function strFormatDate(date: Date): string;
@@ -1,12 +1,12 @@
1
1
  /// <reference types="react" />
2
- import { CivilDateTime } from "@std-proposal/temporal";
2
+ import { AtlantisTemporalPlainDateTime } from "../InputTime";
3
3
  interface FormatRelativeDateTimeProps {
4
4
  /**
5
5
  * Date to be displayed.
6
6
  *
7
7
  * A `string` should be an ISO 8601 format date string.
8
8
  */
9
- readonly date: CivilDateTime | Date | string;
9
+ readonly date: AtlantisTemporalPlainDateTime | Date | string;
10
10
  }
11
11
  export declare function FormatRelativeDateTime({ date: inputDate, }: FormatRelativeDateTimeProps): JSX.Element;
12
12
  export {};
@@ -1,12 +1,12 @@
1
1
  /// <reference types="react" />
2
- import { CivilTime } from "@std-proposal/temporal";
2
+ import { AtlantisTemporalPlainTime } from "../InputTime";
3
3
  interface FormatTimeProps {
4
4
  /**
5
5
  * Civil Time of time to be displayed.
6
6
  *
7
7
  * A `string` should be an ISO 8601 format date string.
8
8
  */
9
- readonly time: CivilTime | Date | string;
9
+ readonly time: AtlantisTemporalPlainTime | Date | string;
10
10
  /**
11
11
  * Optionally specify clock format. If `undefined` system format will be respected.
12
12
  */
@@ -6,7 +6,7 @@ var tslib_es6 = require('../tslib.es6-5b8768b7.js');
6
6
  var React = require('react');
7
7
  var styleInject_es = require('../style-inject.es-9d2f5f4e.js');
8
8
  var Avatar = require('../Avatar-01c5ba8b.js');
9
- var InputFile = require('../InputFile-e7c15211.js');
9
+ var InputFile = require('../InputFile-4932c979.js');
10
10
  var ProgressBar = require('../ProgressBar-d3178aa9.js');
11
11
  var Button = require('../Button-186ef2c1.js');
12
12
  require('classnames');
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var lodash = require('lodash');
6
6
  var React = require('react');
7
7
  var FormField = require('../FormField-e1c3af82.js');
8
- var DatePicker = require('../DatePicker-e085dff4.js');
8
+ var DatePicker = require('../DatePicker-90d542d7.js');
9
9
  require('../tslib.es6-5b8768b7.js');
10
10
  require('uuid');
11
11
  require('react-hook-form');
@@ -22,6 +22,10 @@ export interface FileUpload {
22
22
  * - `1` represents a complete upload.
23
23
  */
24
24
  readonly progress: number;
25
+ /**
26
+ * Base URL where file was sent as a POST. This is the same URL as what's returned in getUploadParams.
27
+ */
28
+ readonly uploadUrl: string;
25
29
  /**
26
30
  * The data url of the file.
27
31
  */
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var InputFile = require('../InputFile-e7c15211.js');
5
+ var InputFile = require('../InputFile-4932c979.js');
6
6
  require('../tslib.es6-5b8768b7.js');
7
7
  require('react');
8
8
  require('classnames');
@@ -52,7 +52,7 @@ function InputFile({ variation = "dropzone", size = "base", buttonLabel: provide
52
52
  function uploadFile(file) {
53
53
  return tslib_es6.__awaiter(this, void 0, void 0, function* () {
54
54
  const { url, key = uuid.v1(), fields = {}, httpMethod = "POST", } = yield getUploadParams(file);
55
- const fileUpload = getFileUpload(file, key);
55
+ const fileUpload = Object.assign(Object.assign({}, getFileUpload(file, key)), { uploadUrl: url });
56
56
  onUploadStart && onUploadStart(Object.assign({}, fileUpload));
57
57
  const handleUploadProgress = (progressEvent) => {
58
58
  onUploadProgress &&
@@ -1,18 +1,21 @@
1
- import { CivilTime } from "@std-proposal/temporal";
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import { CivilDate, CivilTime } from "@std-proposal/temporal";
2
3
  import { CommonFormFieldProps, FormFieldProps } from "../FormField";
4
+ export type AtlantisTemporalPlainDateTime = Temporal.PlainDateTime | CivilDate;
5
+ export type AtlantisTemporalPlainTime = Temporal.PlainTime | CivilTime;
3
6
  export interface InputTimeProps extends Pick<CommonFormFieldProps, "align" | "description" | "disabled" | "invalid" | "inline" | "loading" | "name" | "onValidation" | "placeholder" | "size">, Pick<FormFieldProps, "maxLength" | "readonly" | "autocomplete" | "max" | "min" | "onEnter" | "onFocus" | "onBlur" | "inputRef" | "validations"> {
4
7
  /**
5
8
  * Intial value of the input. Only use this when you need to prepopulate the
6
9
  * field with a data that is not controlled by the components state. If a
7
10
  * state is controlling the value, use the `value` prop instead.
8
11
  */
9
- readonly defaultValue?: CivilTime;
12
+ readonly defaultValue?: AtlantisTemporalPlainTime;
10
13
  /**
11
14
  * Set the component to the given value.
12
15
  */
13
- readonly value?: CivilTime;
16
+ readonly value?: AtlantisTemporalPlainTime;
14
17
  /**
15
18
  * Function called when user changes input value.
16
19
  */
17
- onChange?(newValue?: CivilTime): void;
20
+ onChange?(newValue?: AtlantisTemporalPlainTime): void;
18
21
  }
@@ -1,3 +1,3 @@
1
- import { CivilTime } from "@std-proposal/temporal";
2
- export declare function civilTimeToHTMLTime(civilTime?: CivilTime): string;
3
- export declare function htmlTimeToCivilTime(timeString: string): CivilTime | undefined;
1
+ import { AtlantisTemporalPlainTime } from "./InputTimeProps";
2
+ export declare function civilTimeToHTMLTime(civilTime?: AtlantisTemporalPlainTime): string;
3
+ export declare function htmlTimeToCivilTime(timeString: string): AtlantisTemporalPlainTime | undefined;
@@ -1 +1,2 @@
1
1
  export { InputTime } from "./InputTime";
2
+ export type { AtlantisTemporalPlainDateTime, AtlantisTemporalPlainTime, } from "./InputTimeProps";
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var tslib_es6 = require('../tslib.es6-5b8768b7.js');
6
6
  var React = require('react');
7
7
  var debounce = require('lodash/debounce');
8
- var temporal = require('@std-proposal/temporal');
8
+ var polyfill = require('@js-temporal/polyfill');
9
9
  var FormField = require('../FormField-e1c3af82.js');
10
10
  require('uuid');
11
11
  require('react-hook-form');
@@ -729,7 +729,7 @@ function civilTimeToHTMLTime(civilTime) {
729
729
  }
730
730
  function htmlTimeToCivilTime(timeString) {
731
731
  try {
732
- return temporal.CivilTime.fromString(timeString + ":00.000000000");
732
+ return polyfill.Temporal.PlainTime.from(timeString + ":00.000000000");
733
733
  }
734
734
  catch (_a) {
735
735
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "4.2.0",
3
+ "version": "4.2.2-mike-pre.9+6621108b",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,11 +17,12 @@
17
17
  "dist/*"
18
18
  ],
19
19
  "dependencies": {
20
- "@jobber/design": "*",
21
- "@jobber/formatters": "*",
22
- "@jobber/hooks": "*",
20
+ "@jobber/design": "^0.30.1-mike-pre.15+6621108b",
21
+ "@jobber/formatters": "^0.2.2",
22
+ "@jobber/hooks": "^2.0.2",
23
+ "@js-temporal/polyfill": "^0.4.3",
23
24
  "@popperjs/core": "^2.0.6",
24
- "@std-proposal/temporal": "0.0.1",
25
+ "@std-proposal/temporal": "^0.0.1",
25
26
  "@tanstack/react-table": "8.5.13",
26
27
  "@types/color": "^3.0.1",
27
28
  "@types/lodash": "^4.14.136",
@@ -82,5 +83,5 @@
82
83
  "> 1%",
83
84
  "IE 10"
84
85
  ],
85
- "gitHead": "cec99526eed6bae69f3f0899d601e4984844a283"
86
+ "gitHead": "6621108be0b93a4f4f4c627c883a9382d4b32a3d"
86
87
  }
package/rollup.config.js CHANGED
@@ -51,6 +51,7 @@ export default {
51
51
  "react-popper",
52
52
  "react-datepicker",
53
53
  "react-dropzone",
54
+ "react-dom/client",
54
55
  "axios",
55
56
  "filesize",
56
57
  "color",
@@ -59,10 +60,12 @@ export default {
59
60
  "lodash",
60
61
  "uuid",
61
62
  "lodash/debounce",
63
+ "@js-temporal/polyfill",
62
64
  "@std-proposal/temporal",
63
65
  "@use-it/event-listener",
64
66
  "@jobber/design",
65
67
  "@jobber/formatters",
66
68
  "@jobber/hooks",
69
+ "@tanstack/react-table",
67
70
  ],
68
71
  };