@jobber/components 4.21.0 → 4.22.1

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var FormatFile = require('../FormatFile-cc6b058c.js');
5
+ var FormatFile = require('../FormatFile-196a73cd.js');
6
6
  require('react');
7
7
  require('classnames');
8
8
  require('filesize');
@@ -26,7 +26,8 @@ require('../Markdown-53a0bfda.js');
26
26
  require('react-markdown');
27
27
  require('../Text-e7ed0974.js');
28
28
  require('../Emphasis-76a10790.js');
29
- require('../Glimmer-f670c24e.js');
29
+ require('../Glimmer-a14ad7fd.js');
30
+ require('../tslib.es6-5b8768b7.js');
30
31
  require('../ProgressBar-5dfc1885.js');
31
32
 
32
33
 
@@ -6,7 +6,7 @@ var getHumanReadableFileSize = require('filesize');
6
6
  var styleInject_es = require('./style-inject.es-9d2f5f4e.js');
7
7
  var Button = require('./Button-7698424c.js');
8
8
  var ConfirmationModal = require('./ConfirmationModal-ba91bd1d.js');
9
- var Glimmer = require('./Glimmer-f670c24e.js');
9
+ var Glimmer = require('./Glimmer-a14ad7fd.js');
10
10
  var Icon = require('./Icon-405a216c.js');
11
11
  var Typography = require('./Typography-fd6f932a.js');
12
12
  var Text = require('./Text-e7ed0974.js');
@@ -6,7 +6,7 @@ var React = require('react');
6
6
  var classnames = require('classnames');
7
7
  var styleInject_es = require('../style-inject.es-9d2f5f4e.js');
8
8
  var LightBox = require('../LightBox-b59ee23b.js');
9
- var FormatFile = require('../FormatFile-cc6b058c.js');
9
+ var FormatFile = require('../FormatFile-196a73cd.js');
10
10
  var Button = require('../Button-7698424c.js');
11
11
  require('framer-motion');
12
12
  require('react-dom');
@@ -25,7 +25,8 @@ require('../Markdown-53a0bfda.js');
25
25
  require('react-markdown');
26
26
  require('../Text-e7ed0974.js');
27
27
  require('../Emphasis-76a10790.js');
28
- require('../Glimmer-f670c24e.js');
28
+ require('../Glimmer-a14ad7fd.js');
29
+ require('../tslib.es6-5b8768b7.js');
29
30
  require('../Icon-405a216c.js');
30
31
  require('@jobber/design');
31
32
  require('../ProgressBar-5dfc1885.js');
@@ -16,6 +16,8 @@ interface GlimmerProps {
16
16
  readonly size?: Sizes;
17
17
  /**
18
18
  * Sets the shape of the glimmer.
19
+ *
20
+ * If you need a specific width, use the `width` prop.
19
21
  */
20
22
  readonly shape?: Shapes;
21
23
  /**
@@ -23,8 +25,19 @@ interface GlimmerProps {
23
25
  * the glimmer is used on smaller spaces.
24
26
  */
25
27
  readonly timing?: Timings;
28
+ /**
29
+ * Use on surfaces with dark backgrounds.
30
+ */
31
+ readonly reverseTheme?: boolean;
32
+ /**
33
+ * Adjust the width of the glimmer in px values.
34
+ */
35
+ readonly width?: number;
26
36
  }
27
37
  export declare const GLIMMER_TEST_ID = "ATL-Glimmer";
38
+ export declare const GLIMMER_HEADER_TEST_ID = "ATL-GlimmerHeader";
39
+ export declare const GLIMMER_TEXT_TEST_ID = "ATL-GlimmerText";
40
+ export declare const GLIMMER_BUTTON_TEST_ID = "ATL-GlimmerButton";
28
41
  /**
29
42
  * **Experimental component! Use at your own risk.**
30
43
  *
@@ -32,5 +45,34 @@ export declare const GLIMMER_TEST_ID = "ATL-Glimmer";
32
45
  *
33
46
  * @experimental
34
47
  */
35
- export declare function Glimmer({ size, shape, timing, }: GlimmerProps): JSX.Element;
48
+ export declare function Glimmer({ size, shape, timing, reverseTheme, width, }: GlimmerProps): JSX.Element;
49
+ export declare namespace Glimmer {
50
+ var Header: ({ level, ...props }: GlimmerHeaderProps) => JSX.Element;
51
+ var Text: ({ width, lines, ...props }: GlimmerTextProps) => JSX.Element;
52
+ var Button: ({ fullWidth, ...props }: GlimmerButtonProps) => JSX.Element;
53
+ }
54
+ interface GlimmerHeaderProps extends Omit<GlimmerProps, "shape" | "size"> {
55
+ /**
56
+ * Adjust the size of the `Glimmer.Header`.
57
+ *
58
+ * @default 3
59
+ */
60
+ readonly level?: 1 | 2 | 3 | 4 | 5;
61
+ }
62
+ interface GlimmerTextProps extends Omit<GlimmerProps, "shape" | "size"> {
63
+ /**
64
+ * Set how many lines shows up.
65
+ *
66
+ * @default 3
67
+ */
68
+ readonly lines?: 1 | 2 | 3;
69
+ }
70
+ interface GlimmerButtonProps extends Omit<GlimmerProps, "shape" | "size"> {
71
+ /**
72
+ * Allow `Glimmer.Button` to go full width.
73
+ *
74
+ * @default false
75
+ */
76
+ readonly fullWidth?: boolean;
77
+ }
36
78
  export {};
@@ -2,10 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var Glimmer = require('../Glimmer-f670c24e.js');
5
+ var Glimmer = require('../Glimmer-a14ad7fd.js');
6
+ require('../tslib.es6-5b8768b7.js');
6
7
  require('react');
7
8
  require('classnames');
8
9
  require('../style-inject.es-9d2f5f4e.js');
10
+ require('../Content-a6590328.js');
9
11
 
10
12
 
11
13
 
@@ -0,0 +1,77 @@
1
+ 'use strict';
2
+
3
+ var tslib_es6 = require('./tslib.es6-5b8768b7.js');
4
+ var React = require('react');
5
+ var classnames = require('classnames');
6
+ var styleInject_es = require('./style-inject.es-9d2f5f4e.js');
7
+ var Content = require('./Content-a6590328.js');
8
+
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
+
11
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
+ var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
13
+
14
+ var css_248z$3 = ".FXzzrJAf890- {\n --glimmer-background: rgba(var(--color-black--rgb) 5%);\n --glimmer-shine: rgba(var(--color-white--rgb), var(--glimmer-shine-opacity));\n --glimmer-shine-opacity: 80%;\n --duration-base: calc(var(--timing-slowest) * 4); /* 2s */\n --duration-fast: calc(var(--duration-base) / 2); /* 1s */\n\n width: 100%;\n height: 100%;\n border-radius: calc(16px / 8);\n border-radius: var(--radius-base);\n background-color: rgba(0 0 0 5%);\n background-color: rgba(0, 0, 0 5%);\n background-color: var(--glimmer-background);\n background-image: linear-gradient(\n 90deg,\n transparent 0px,\n rgba(255, 255, 255, 0.8) calc(16px * 2),\n transparent calc(16px * 4)\n );\n background-image: linear-gradient(\n 90deg,\n transparent 0px,\n rgba(255, 255, 255, 80%) calc(16px * 2),\n transparent calc(16px * 4)\n );\n background-image: linear-gradient(\n 90deg,\n transparent 0px,\n var(--glimmer-shine) var(--space-larger),\n transparent var(--space-extravagant)\n );\n background-repeat: no-repeat;\n background-size: calc(16px * 4) 100%;\n background-size: var(--space-extravagant) 100%;\n -webkit-animation: FXzzrJAf890- 2s infinite linear;\n animation: FXzzrJAf890- 2s infinite linear;\n}@supports (color: rgb(0 0 0 / 0.5)) and (color: hsl(0 0% 0% / 0.5)) {.FXzzrJAf890- {\n --glimmer-background: rgba(var(--color-black--rgb), 5%);\n}\n}\n\n.s9bG0yRJR3A- {\n --glimmer-background: rgba(var(--color-white--rgb) 10%);\n --glimmer-shine-opacity: 25%;\n}\n\n@supports (color: rgb(0 0 0 / 0.5)) and (color: hsl(0 0% 0% / 0.5)) {\n\n.s9bG0yRJR3A- {\n --glimmer-background: rgba(var(--color-white--rgb), 10%);\n}\n}\n\n@-webkit-keyframes FXzzrJAf890- {\n 0%,\n 20% {\n background-position-x: calc((16px * 4) * -1);\n background-position-x: calc(calc(16px * 4) * -1);\n background-position-x: calc(var(--space-extravagant) * -1);\n }\n\n 100% {\n background-position-x: calc(100% + (16px * 4));\n background-position-x: calc(100% + calc(16px * 4));\n background-position-x: calc(100% + var(--space-extravagant));\n }\n}\n\n@keyframes FXzzrJAf890- {\n 0%,\n 20% {\n background-position-x: calc((16px * 4) * -1);\n background-position-x: calc(calc(16px * 4) * -1);\n background-position-x: calc(var(--space-extravagant) * -1);\n }\n\n 100% {\n background-position-x: calc(100% + (16px * 4));\n background-position-x: calc(100% + calc(16px * 4));\n background-position-x: calc(100% + var(--space-extravagant));\n }\n}\n\n.M0X0dxjIyv4- {\n width: 30%;\n max-width: 180px;\n min-width: 120px;\n}\n\n.v2Q1amzd7Ac- {\n display: inline-block;\n width: 100px;\n height: 36px;\n}\n\n._8va--lBgr38- {\n display: block;\n width: 100%;\n min-width: 100px;\n}\n";
15
+ var styles = {"glimmer":"FXzzrJAf890-","reverseTheme":"s9bG0yRJR3A-","header":"M0X0dxjIyv4-","button":"v2Q1amzd7Ac-","buttonFill":"_8va--lBgr38-"};
16
+ styleInject_es.styleInject(css_248z$3);
17
+
18
+ var css_248z$2 = ".siUUG4rZNSk- {\n height: calc(16px / 2);\n height: var(--space-small);\n}\n\n.nFuBXyrhG2Q- {\n height: calc(16px * 1);\n height: var(--space-base);\n}\n\n.oiVEoAqI-fU- {\n height: calc(16px * 1.5);\n height: var(--space-large);\n}\n\n.Tkmo6mSMI9Y- {\n height: calc(16px * 2);\n height: var(--space-larger);\n}\n\n.uVeaD3IhD6o- {\n height: calc(16px * 3);\n height: var(--space-largest);\n}\n\n._6Wak9NLJ3VQ- {\n height: 100%;\n min-width: calc(16px * 1);\n min-width: var(--space-base);\n min-height: calc(16px * 1);\n min-height: var(--space-base);\n}\n";
19
+ var sizes = {"small":"siUUG4rZNSk-","base":"nFuBXyrhG2Q-","large":"oiVEoAqI-fU-","larger":"Tkmo6mSMI9Y-","largest":"uVeaD3IhD6o-","auto":"_6Wak9NLJ3VQ-"};
20
+ styleInject_es.styleInject(css_248z$2);
21
+
22
+ var css_248z$1 = ".enoWbteryXg- {\n width: 100%;\n}\n\n._9qkwCdedX1M- {\n width: 85%;\n}\n\n.XtyJxvcJDFs- {\n width: 70%;\n}\n\n._8unQ0TS1He4-,\n.ameRMYEKfss- {\n width: auto;\n aspect-ratio: 1;\n}\n\n.ameRMYEKfss- {\n border-radius: 100%;\n border-radius: var(--radius-circle);\n}\n";
23
+ var shapes = {"rectangle":"enoWbteryXg-","rectangleShort":"_9qkwCdedX1M-","rectangleShorter":"XtyJxvcJDFs-","square":"_8unQ0TS1He4-","circle":"ameRMYEKfss-"};
24
+ styleInject_es.styleInject(css_248z$1);
25
+
26
+ var css_248z = ".hO0mZ6TeVko- {\n -webkit-animation-duration: var(--duration-base);\n animation-duration: var(--duration-base);\n}\n\n.WXi5-zF8Ll4- {\n -webkit-animation-duration: calc(var(--duration-fast));\n animation-duration: calc(var(--duration-fast));\n}\n";
27
+ var timings = {"base":"hO0mZ6TeVko-","fast":"WXi5-zF8Ll4-"};
28
+ styleInject_es.styleInject(css_248z);
29
+
30
+ const GLIMMER_TEST_ID = "ATL-Glimmer";
31
+ const GLIMMER_HEADER_TEST_ID = "ATL-GlimmerHeader";
32
+ const GLIMMER_TEXT_TEST_ID = "ATL-GlimmerText";
33
+ const GLIMMER_BUTTON_TEST_ID = "ATL-GlimmerButton";
34
+ /**
35
+ * **Experimental component! Use at your own risk.**
36
+ *
37
+ * Foundational component used to build loading states such as Skeleton UI
38
+ *
39
+ * @experimental
40
+ */
41
+ function Glimmer({ size = "base", shape = "rectangle", timing = "base", reverseTheme = false, width, }) {
42
+ const className = classnames__default["default"](styles.glimmer, sizes[size], shapes[shape], timings[timing], { [styles.reverseTheme]: reverseTheme });
43
+ return (React__default["default"].createElement("div", { "aria-busy": "true", className: className, "data-testid": GLIMMER_TEST_ID, style: { width } }));
44
+ }
45
+ Glimmer.Header = function GlimmerHeader(_a) {
46
+ var { level = 3 } = _a, props = tslib_es6.__rest(_a, ["level"]);
47
+ const headerSize = {
48
+ 1: "largest",
49
+ 2: "larger",
50
+ 3: "large",
51
+ 4: "base",
52
+ 5: "small",
53
+ };
54
+ return (React__default["default"].createElement("div", { className: styles.header, "data-testid": GLIMMER_HEADER_TEST_ID },
55
+ React__default["default"].createElement(Glimmer, Object.assign({ size: headerSize[level] }, props))));
56
+ };
57
+ Glimmer.Text = function GlimmerText(_a) {
58
+ var { width, lines = 3 } = _a, props = tslib_es6.__rest(_a, ["width", "lines"]);
59
+ const children = [
60
+ React__default["default"].createElement(Glimmer, Object.assign({ key: "1", size: "small", shape: "rectangleShort" }, props)),
61
+ React__default["default"].createElement(Glimmer, Object.assign({ key: "2", size: "small" }, props)),
62
+ React__default["default"].createElement(Glimmer, Object.assign({ key: "3", size: "small", shape: "rectangleShorter" }, props)),
63
+ ].slice(0, lines);
64
+ return (React__default["default"].createElement("div", { style: { width }, "data-testid": GLIMMER_TEXT_TEST_ID },
65
+ React__default["default"].createElement(Content.Content, { spacing: "small" }, children)));
66
+ };
67
+ Glimmer.Button = function GlimmerButton(_a) {
68
+ var { fullWidth = false } = _a, props = tslib_es6.__rest(_a, ["fullWidth"]);
69
+ const buttonClassNames = classnames__default["default"](styles.button, {
70
+ [styles.buttonFill]: fullWidth,
71
+ });
72
+ return (React__default["default"].createElement("div", { className: buttonClassNames, "data-testid": GLIMMER_BUTTON_TEST_ID },
73
+ React__default["default"].createElement(Glimmer, Object.assign({}, props, { size: "auto" }))));
74
+ };
75
+
76
+ exports.GLIMMER_TEST_ID = GLIMMER_TEST_ID;
77
+ exports.Glimmer = Glimmer;
@@ -24,6 +24,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
24
24
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
25
25
 
26
26
  function InputNumberInternal(props, ref) {
27
+ var _a;
27
28
  const inputRef = React.createRef();
28
29
  React.useImperativeHandle(ref, () => ({
29
30
  blur: () => {
@@ -39,7 +40,19 @@ function InputNumberInternal(props, ref) {
39
40
  }
40
41
  },
41
42
  }));
42
- return (React__default["default"].createElement(FormField.FormField, Object.assign({}, props, { type: "number", inputRef: inputRef, onChange: handleChange, validations: Object.assign(Object.assign({}, props.validations), { validate: getOverLimitMessage }) })));
43
+ return (React__default["default"].createElement(FormField.FormField, Object.assign({}, props, { type: "number", inputRef: inputRef, onChange: handleChange, validations: Object.assign(Object.assign({}, props.validations), { validate: customValidators((_a = props.validations) === null || _a === void 0 ? void 0 : _a.validate) }) })));
44
+ function customValidators(validators) {
45
+ if (validators == null) {
46
+ return getOverLimitMessage;
47
+ }
48
+ else if (typeof validators === "function") {
49
+ return {
50
+ customValidation: validators,
51
+ getOverLimitMessage,
52
+ };
53
+ }
54
+ return Object.assign(Object.assign({}, validators), { getOverLimitMessage });
55
+ }
43
56
  function handleChange(newValue) {
44
57
  props.onChange && props.onChange(newValue);
45
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "4.21.0",
3
+ "version": "4.22.1",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -83,5 +83,5 @@
83
83
  "> 1%",
84
84
  "IE 10"
85
85
  ],
86
- "gitHead": "2059832961a8eec4079a52f0aa5cd5e14fc16155"
86
+ "gitHead": "9ade94dbff4f71a8e934d6ce08b33a759330a280"
87
87
  }
@@ -1,42 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- var classnames = require('classnames');
5
- var styleInject_es = require('./style-inject.es-9d2f5f4e.js');
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
10
- var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
11
-
12
- var css_248z$3 = ".FXzzrJAf890- {\n --duration-base: calc(var(--timing-slowest) * 4); /* 2s */\n --duration-fast: calc(var(--duration-base) / 2); /* 1s */\n\n width: 100%;\n height: 100%;\n border-radius: calc(16px / 8);\n border-radius: var(--radius-base);\n background-color: rgb(244, 244, 244);\n background-color: var(--color-grey--lightest);\n background-image: linear-gradient(\n 90deg,\n rgb(244, 244, 244) 0px,\n rgba(255, 255, 255, 1) calc(16px * 2),\n rgb(244, 244, 244) calc(16px * 4)\n );\n background-image: linear-gradient(\n 90deg,\n var(--color-grey--lightest) 0px,\n var(--color-white) var(--space-larger),\n var(--color-grey--lightest) var(--space-extravagant)\n );\n background-repeat: no-repeat;\n background-size: calc(16px * 4) 100%;\n background-size: var(--space-extravagant) 100%;\n -webkit-animation: FXzzrJAf890- 2s infinite linear;\n animation: FXzzrJAf890- 2s infinite linear;\n}\n\n@-webkit-keyframes FXzzrJAf890- {\n 0%,\n 20% {\n background-position: calc((16px * 4) * -1);\n background-position: calc(calc(16px * 4) * -1);\n background-position: calc(var(--space-extravagant) * -1);\n }\n\n 100% {\n background-position: calc(100% + (16px * 4));\n background-position: calc(100% + calc(16px * 4));\n background-position: calc(100% + var(--space-extravagant));\n }\n}\n\n@keyframes FXzzrJAf890- {\n 0%,\n 20% {\n background-position: calc((16px * 4) * -1);\n background-position: calc(calc(16px * 4) * -1);\n background-position: calc(var(--space-extravagant) * -1);\n }\n\n 100% {\n background-position: calc(100% + (16px * 4));\n background-position: calc(100% + calc(16px * 4));\n background-position: calc(100% + var(--space-extravagant));\n }\n}\n";
13
- var styles = {"glimmer":"FXzzrJAf890-"};
14
- styleInject_es.styleInject(css_248z$3);
15
-
16
- var css_248z$2 = ".siUUG4rZNSk- {\n height: calc(16px / 2);\n height: var(--space-small);\n}\n\n.nFuBXyrhG2Q- {\n height: calc(16px * 1);\n height: var(--space-base);\n}\n\n.oiVEoAqI-fU- {\n height: calc(16px * 1.5);\n height: var(--space-large);\n}\n\n.Tkmo6mSMI9Y- {\n height: calc(16px * 2);\n height: var(--space-larger);\n}\n\n.uVeaD3IhD6o- {\n height: calc(16px * 3);\n height: var(--space-largest);\n}\n\n._6Wak9NLJ3VQ- {\n height: 100%;\n min-width: calc(16px * 1);\n min-width: var(--space-base);\n min-height: calc(16px * 1);\n min-height: var(--space-base);\n}\n";
17
- var sizes = {"small":"siUUG4rZNSk-","base":"nFuBXyrhG2Q-","large":"oiVEoAqI-fU-","larger":"Tkmo6mSMI9Y-","largest":"uVeaD3IhD6o-","auto":"_6Wak9NLJ3VQ-"};
18
- styleInject_es.styleInject(css_248z$2);
19
-
20
- var css_248z$1 = ".enoWbteryXg- {\n width: 100%;\n}\n\n._9qkwCdedX1M- {\n width: 85%;\n}\n\n.XtyJxvcJDFs- {\n width: 70%;\n}\n\n._8unQ0TS1He4-,\n.ameRMYEKfss- {\n width: auto;\n aspect-ratio: 1;\n}\n\n.ameRMYEKfss- {\n border-radius: 100%;\n border-radius: var(--radius-circle);\n}\n";
21
- var shapes = {"rectangle":"enoWbteryXg-","rectangleShort":"_9qkwCdedX1M-","rectangleShorter":"XtyJxvcJDFs-","square":"_8unQ0TS1He4-","circle":"ameRMYEKfss-"};
22
- styleInject_es.styleInject(css_248z$1);
23
-
24
- var css_248z = ".hO0mZ6TeVko- {\n -webkit-animation-duration: var(--duration-base);\n animation-duration: var(--duration-base);\n}\n\n.WXi5-zF8Ll4- {\n -webkit-animation-duration: calc(var(--duration-fast));\n animation-duration: calc(var(--duration-fast));\n}\n";
25
- var timings = {"base":"hO0mZ6TeVko-","fast":"WXi5-zF8Ll4-"};
26
- styleInject_es.styleInject(css_248z);
27
-
28
- const GLIMMER_TEST_ID = "ATL-Glimmer";
29
- /**
30
- * **Experimental component! Use at your own risk.**
31
- *
32
- * Foundational component used to build loading states such as Skeleton UI
33
- *
34
- * @experimental
35
- */
36
- function Glimmer({ size = "base", shape = "rectangle", timing = "base", }) {
37
- const className = classnames__default["default"](styles.glimmer, sizes[size], shapes[shape], timings[timing]);
38
- return (React__default["default"].createElement("div", { "aria-busy": "true", className: className, "data-testid": GLIMMER_TEST_ID }));
39
- }
40
-
41
- exports.GLIMMER_TEST_ID = GLIMMER_TEST_ID;
42
- exports.Glimmer = Glimmer;