@jobber/components 4.10.1 → 4.11.0
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.
- package/InputPhoneNumber.d.ts +1 -0
- package/InputPhoneNumber.js +17 -0
- package/dist/Autocomplete/index.js +2 -2
- package/dist/DataTable/index.js +2 -2
- package/dist/FormField/FormFieldTypes.d.ts +1 -1
- package/dist/FormField/index.js +1 -1
- package/dist/{FormField-76853659.js → FormField-e033e2cd.js} +11 -6
- package/dist/InputDate/index.js +1 -1
- package/dist/InputEmail/index.js +1 -1
- package/dist/InputNumber/index.js +1 -1
- package/dist/InputPassword/index.js +1 -1
- package/dist/InputPhoneNumber/InputMask.d.ts +38 -0
- package/dist/InputPhoneNumber/InputPhoneNumber.d.ts +12 -0
- package/dist/InputPhoneNumber/index.d.ts +1 -0
- package/dist/InputPhoneNumber/index.js +94 -0
- package/dist/InputText/index.js +2 -2
- package/dist/{InputText-73113193.js → InputText-7dc7beb6.js} +1 -1
- package/dist/InputTime/index.js +1 -1
- package/dist/{Option-26e09990.js → Option-61f34d18.js} +1 -1
- package/dist/Select/index.js +2 -2
- package/package.json +9 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dist/InputPhoneNumber";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true,
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var InputPhoneNumber = require("./dist/InputPhoneNumber");
|
|
8
|
+
|
|
9
|
+
Object.keys(InputPhoneNumber).forEach(function(key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
Object.defineProperty(exports, key, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function get() {
|
|
14
|
+
return InputPhoneNumber[key];
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -13,10 +13,10 @@ var reactPopper = require('react-popper');
|
|
|
13
13
|
var Text = require('../Text-e7ed0974.js');
|
|
14
14
|
var Icon = require('../Icon-405a216c.js');
|
|
15
15
|
var Heading = require('../Heading-a1191b15.js');
|
|
16
|
-
var InputText = require('../InputText-
|
|
16
|
+
var InputText = require('../InputText-7dc7beb6.js');
|
|
17
17
|
require('../Typography-fd6f932a.js');
|
|
18
18
|
require('@jobber/design');
|
|
19
|
-
require('../FormField-
|
|
19
|
+
require('../FormField-e033e2cd.js');
|
|
20
20
|
require('uuid');
|
|
21
21
|
require('react-hook-form');
|
|
22
22
|
require('../Button-69409e46.js');
|
package/dist/DataTable/index.js
CHANGED
|
@@ -8,10 +8,10 @@ var React = require('react');
|
|
|
8
8
|
var jobberHooks = require('@jobber/hooks/useResizeObserver');
|
|
9
9
|
var styleInject_es = require('../style-inject.es-9d2f5f4e.js');
|
|
10
10
|
var tslib_es6 = require('../tslib.es6-5b8768b7.js');
|
|
11
|
-
var Option = require('../Option-
|
|
11
|
+
var Option = require('../Option-61f34d18.js');
|
|
12
12
|
var Button = require('../Button-69409e46.js');
|
|
13
13
|
var Text = require('../Text-e7ed0974.js');
|
|
14
|
-
require('../FormField-
|
|
14
|
+
require('../FormField-e033e2cd.js');
|
|
15
15
|
require('uuid');
|
|
16
16
|
require('react-hook-form');
|
|
17
17
|
require('../Icon-405a216c.js');
|
|
@@ -2,7 +2,7 @@ import { ChangeEvent, ReactNode, RefObject } from "react";
|
|
|
2
2
|
import { RegisterOptions } from "react-hook-form";
|
|
3
3
|
import { XOR } from "ts-xor";
|
|
4
4
|
import { IconNames } from "../Icon";
|
|
5
|
-
export type FormFieldTypes = "text" | "password" | "number" | "time" | "textarea" | "select" | "email";
|
|
5
|
+
export type FormFieldTypes = "text" | "password" | "number" | "time" | "textarea" | "select" | "tel" | "email";
|
|
6
6
|
export type AutocompleteTypes = "one-time-code" | "address-line1" | "address-line2";
|
|
7
7
|
export interface FieldActionsRef {
|
|
8
8
|
setValue(value: string | number): void;
|
package/dist/FormField/index.js
CHANGED
|
@@ -17,8 +17,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
17
17
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
18
18
|
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
19
19
|
|
|
20
|
-
var css_248z = ":root {\n /**\n * These `--public-field` properties are used in other components such\n * as InputGroup, therefore they must stay on :root\n **/\n --public-field--top-left-radius: var(--radius-base);\n --public-field--top-right-radius: var(--radius-base);\n --public-field--bottom-left-radius: var(--radius-base);\n --public-field--bottom-right-radius: var(--radius-base);\n}\n\n/**\n * Wrapper\n **/\n\n.nPGhTEEzsoU- {\n --field--placeholder-color: var(--color-greyBlue--light);\n --field--placeholder-offset: 50%;\n --field--placeholder-transform: -50%;\n\n --field--textAlign: left;\n\n --field--height: var(--space-largest);\n\n --field--padding-top: calc(var(--space-base) - var(--space-smallest));\n --field--padding-bottom: calc(var(--space-base) - var(--space-smallest));\n --field--padding-left: var(--space-base);\n --field--padding-right: var(--space-base);\n\n --field--value-color: var(--color-heading);\n --field--value-lineHeight: calc(var(--base-unit) * 1.25);\n\n --field--border-color: var(--color-border);\n --field--background-color: var(--color-surface);\n\n --field--base-elevation: var(--elevation-base);\n --field--label-elevation: calc(var(--field--base-elevation) + 1);\n --field--postfix-elevation: calc(var(--field--base-elevation) - 1);\n --field--postfix-action-elevation: calc(var(--field--base-elevation) + 2);\n\n display: -ms-flexbox;\n\n display: flex;\n width: 100%;\n height: calc(16px * 3);\n height: var(--field--height);\n border: calc(16px / 16) solid rgb(225, 225, 225);\n border: var(--border-base) solid var(--field--border-color);\n border-radius: calc(16px / 8);\n border-radius: var(--radius-base);\n border-top-right-radius: calc(16px / 8);\n border-top-right-radius: var(--public-field--top-right-radius);\n border-bottom-right-radius: calc(16px / 8);\n border-bottom-right-radius: var(--public-field--bottom-right-radius);\n border-bottom-left-radius: calc(16px / 8);\n border-bottom-left-radius: var(--public-field--bottom-left-radius);\n border-top-left-radius: calc(16px / 8);\n border-top-left-radius: var(--public-field--top-left-radius);\n color: rgb(1, 41, 57);\n color: var(--field--value-color);\n font-size: calc((16px * 1) * 0.875);\n font-size: calc(calc(16px * 1) * 0.875);\n font-size: var(--typography--fontSize-base);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--field--background-color);\n}\n\n.nPGhTEEzsoU- * {\n box-sizing: border-box;\n}\n\n.nPGhTEEzsoU-:focus-within {\n position: relative;\n z-index: var(--field--base-elevation);\n box-shadow: 0px 0px calc(16px / 4) calc(16px / 8)\n rgb(231, 213, 87);\n box-shadow: var(--shadow-focus);\n}\n\n.UIZq8hTmJVU- {\n --field--placeholder-color: var(--color-text--secondary);\n --field--placeholder-offset: var(--space-smallest);\n --field--placeholder-transform: 0;\n}\n\n.nPGhTEEzsoU-.mgPacJ6Z71Y- {\n height: auto;\n min-height: auto;\n}\n\n.gJ-15M615eY-,\n.gJ-15M615eY-:focus-within {\n --field--border-color: var(--color-critical);\n}\n\n._1rsTLm5GwcM- {\n --field--placeholder-color: var(--color-disabled);\n --field--value-color: var(--color-disabled);\n --field--background-color: var(--color-surface--background);\n --field--border-color: var(--color-disabled--secondary);\n}\n\n/* override iOS default styling for disabled input */\n\n._1rsTLm5GwcM- :disabled {\n -webkit-text-fill-color: var(--field--value-color);\n opacity: 1;\n}\n\n.o8D-H-lKfDk- {\n --field--padding-left: calc(var(--space-base) - var(--space-smaller));\n --field--padding-right: calc(var(--space-base) - var(--space-smaller));\n --field--height: calc(var(--space-larger) + var(--space-smaller));\n}\n\n.Ku8sWS0mLew- {\n --field--padding-left: var(--space-large);\n --field--padding-right: var(--space-large);\n --field--height: calc(var(--space-extravagant));\n}\n\n._5Hu2F3cBvng- {\n display: -ms-inline-flexbox;\n display: inline-flex;\n width: auto;\n}\n\n.s1WLQs6ffD8- {\n --field--textAlign: center;\n}\n\n.a2r4QheWYIA- {\n --field--textAlign: right;\n}\n\n/**\n * The custom property --formField-maxLength is getting defined inside the\n * component.\n */\n\n.KdAnXK1gClo- {\n width: calc(\n (16px * var(--formField-maxLength)) + var(--field--padding-left) +\n var(--field--padding-right)\n );\n width: calc(\n (var(--base-unit) * var(--formField-maxLength)) + var(--field--padding-left) +\n var(--field--padding-right)\n );\n}\n\n/**\n * Input Wrapper\n **/\n\n.iQFhpFYnz-8- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex: 1;\n flex: 1;\n position: relative;\n}\n\n/**\n * Input\n **/\n\n.LSHPV7PwOTg- {\n position: relative;\n z-index: var(--field--base-elevation);\n width: 100%;\n padding-top: var(--field--padding-top);\n padding-bottom: var(--field--padding-bottom);\n padding-left: var(--field--padding-left);\n padding-right: var(--field--padding-right);\n border: none;\n border-radius: 0;\n color: inherit;\n font-family: inherit;\n font-size: inherit;\n line-height: var(--field--value-lineHeight);\n text-align: var(--field--textAlign);\n background: transparent;\n -webkit-appearance: none;\n appearance: none;\n}\n\n.LSHPV7PwOTg-:focus {\n outline: none;\n}\n\n.
|
|
21
|
-
var styles = {"wrapper":"nPGhTEEzsoU-","miniLabel":"UIZq8hTmJVU-","textarea":"mgPacJ6Z71Y-","invalid":"gJ-15M615eY-","disabled":"_1rsTLm5GwcM-","small":"o8D-H-lKfDk-","large":"Ku8sWS0mLew-","inline":"_5Hu2F3cBvng-","center":"s1WLQs6ffD8-","right":"a2r4QheWYIA-","maxLength":"KdAnXK1gClo-","inputWrapper":"iQFhpFYnz-8-","
|
|
20
|
+
var css_248z = ":root {\n /**\n * These `--public-field` properties are used in other components such\n * as InputGroup, therefore they must stay on :root\n **/\n --public-field--top-left-radius: var(--radius-base);\n --public-field--top-right-radius: var(--radius-base);\n --public-field--bottom-left-radius: var(--radius-base);\n --public-field--bottom-right-radius: var(--radius-base);\n}\n\n/**\n * Wrapper\n **/\n\n.nPGhTEEzsoU- {\n --field--placeholder-color: var(--color-greyBlue--light);\n --field--placeholder-offset: 50%;\n --field--placeholder-transform: -50%;\n\n --field--textAlign: left;\n\n --field--height: var(--space-largest);\n\n --field--padding-top: calc(var(--space-base) - var(--space-smallest));\n --field--padding-bottom: calc(var(--space-base) - var(--space-smallest));\n --field--padding-left: var(--space-base);\n --field--padding-right: var(--space-base);\n\n --field--value-color: var(--color-heading);\n --field--value-lineHeight: calc(var(--base-unit) * 1.25);\n\n --field--border-color: var(--color-border);\n --field--background-color: var(--color-surface);\n\n --field--base-elevation: var(--elevation-base);\n --field--label-elevation: calc(var(--field--base-elevation) + 1);\n --field--postfix-elevation: calc(var(--field--base-elevation) - 1);\n --field--postfix-action-elevation: calc(var(--field--base-elevation) + 2);\n\n display: -ms-flexbox;\n\n display: flex;\n width: 100%;\n height: calc(16px * 3);\n height: var(--field--height);\n border: calc(16px / 16) solid rgb(225, 225, 225);\n border: var(--border-base) solid var(--field--border-color);\n border-radius: calc(16px / 8);\n border-radius: var(--radius-base);\n border-top-right-radius: calc(16px / 8);\n border-top-right-radius: var(--public-field--top-right-radius);\n border-bottom-right-radius: calc(16px / 8);\n border-bottom-right-radius: var(--public-field--bottom-right-radius);\n border-bottom-left-radius: calc(16px / 8);\n border-bottom-left-radius: var(--public-field--bottom-left-radius);\n border-top-left-radius: calc(16px / 8);\n border-top-left-radius: var(--public-field--top-left-radius);\n color: rgb(1, 41, 57);\n color: var(--field--value-color);\n font-size: calc((16px * 1) * 0.875);\n font-size: calc(calc(16px * 1) * 0.875);\n font-size: var(--typography--fontSize-base);\n background-color: rgba(255, 255, 255, 1);\n background-color: var(--field--background-color);\n}\n\n.nPGhTEEzsoU- * {\n box-sizing: border-box;\n}\n\n.nPGhTEEzsoU-:focus-within {\n position: relative;\n z-index: var(--field--base-elevation);\n box-shadow: 0px 0px calc(16px / 4) calc(16px / 8)\n rgb(231, 213, 87);\n box-shadow: var(--shadow-focus);\n}\n\n.UIZq8hTmJVU- {\n --field--placeholder-color: var(--color-text--secondary);\n --field--placeholder-offset: var(--space-smallest);\n --field--placeholder-transform: 0;\n --field--padding-top: calc(var(--space-base) + var(--space-smaller));\n --field--padding-bottom: var(--space-small);\n}\n\n.nPGhTEEzsoU-.mgPacJ6Z71Y- {\n height: auto;\n min-height: auto;\n}\n\n.gJ-15M615eY-,\n.gJ-15M615eY-:focus-within {\n --field--border-color: var(--color-critical);\n}\n\n._1rsTLm5GwcM- {\n --field--placeholder-color: var(--color-disabled);\n --field--value-color: var(--color-disabled);\n --field--background-color: var(--color-surface--background);\n --field--border-color: var(--color-disabled--secondary);\n}\n\n/* override iOS default styling for disabled input */\n\n._1rsTLm5GwcM- :disabled {\n -webkit-text-fill-color: var(--field--value-color);\n opacity: 1;\n}\n\n.o8D-H-lKfDk- {\n --field--padding-left: calc(var(--space-base) - var(--space-smaller));\n --field--padding-right: calc(var(--space-base) - var(--space-smaller));\n --field--padding-top: var(--space-small);\n --field--padding-bottom: var(--space-small);\n --field--height: calc(var(--space-larger) + var(--space-smaller));\n}\n\n.Ku8sWS0mLew- {\n --field--padding-left: var(--space-large);\n --field--padding-right: var(--space-large);\n --field--height: calc(var(--space-extravagant));\n}\n\n._5Hu2F3cBvng- {\n display: -ms-inline-flexbox;\n display: inline-flex;\n width: auto;\n}\n\n.s1WLQs6ffD8- {\n --field--textAlign: center;\n}\n\n.a2r4QheWYIA- {\n --field--textAlign: right;\n}\n\n/**\n * The custom property --formField-maxLength is getting defined inside the\n * component.\n */\n\n.KdAnXK1gClo- {\n width: calc(\n (16px * var(--formField-maxLength)) + var(--field--padding-left) +\n var(--field--padding-right)\n );\n width: calc(\n (var(--base-unit) * var(--formField-maxLength)) + var(--field--padding-left) +\n var(--field--padding-right)\n );\n}\n\n/**\n * Input Wrapper\n **/\n\n.iQFhpFYnz-8- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex: 1;\n flex: 1;\n position: relative;\n}\n\n.Yo2Wi9dpa-Y- {\n position: relative;\n -ms-flex: 1;\n flex: 1;\n}\n\n/**\n * Input\n **/\n\n.LSHPV7PwOTg- {\n position: relative;\n z-index: var(--field--base-elevation);\n width: 100%;\n height: 100%;\n padding-top: var(--field--padding-top);\n padding-bottom: var(--field--padding-bottom);\n padding-left: var(--field--padding-left);\n padding-right: var(--field--padding-right);\n border: none;\n border-radius: 0;\n color: inherit;\n font-family: inherit;\n font-size: inherit;\n line-height: var(--field--value-lineHeight);\n text-align: var(--field--textAlign);\n background: transparent;\n -webkit-appearance: none;\n appearance: none;\n}\n\n.LSHPV7PwOTg-:focus {\n outline: none;\n}\n\n.mgPacJ6Z71Y- .LSHPV7PwOTg- {\n resize: vertical;\n}\n\n.LSHPV7PwOTg-:-webkit-autofill,\n.LSHPV7PwOTg-:-webkit-autofill:hover,\n.LSHPV7PwOTg-:-webkit-autofill:focus,\n.LSHPV7PwOTg-:-webkit-autofill:active {\n -webkit-box-shadow: 0 0 0 30px rgba(255, 255, 255, 1) inset !important;\n -webkit-box-shadow: 0 0 0 30px var(--color-surface) inset !important;\n}\n\n/**\n * Label\n **/\n\n._3xREbTN5pPg- {\n position: absolute;\n top: var(--field--placeholder-offset);\n z-index: var(--field--label-elevation);\n width: 100%;\n padding-left: var(--field--padding-left);\n padding-right: var(--field--padding-right);\n overflow: hidden;\n color: var(--field--placeholder-color);\n line-height: var(--field--value-lineHeight);\n text-align: var(--field--textAlign);\n text-overflow: ellipsis;\n white-space: nowrap;\n -webkit-transform: translateY(var(--field--placeholder-transform));\n transform: translateY(var(--field--placeholder-transform));\n transition: all 100ms;\n transition: all var(--timing-quick);\n}\n\n.UIZq8hTmJVU- ._3xREbTN5pPg- {\n font-size: calc((16px * 1) * 0.75);\n font-size: calc(calc(16px * 1) * 0.75);\n font-size: var(--typography--fontSize-small);\n}\n\n.mgPacJ6Z71Y- ._3xREbTN5pPg- {\n top: var(--field--padding-top);\n -webkit-transform: translateY(0);\n transform: translateY(0);\n}\n\n.mgPacJ6Z71Y-.UIZq8hTmJVU- ._3xREbTN5pPg- {\n top: calc(16px / 8);\n top: var(--space-smallest);\n}\n\n.o8D-H-lKfDk-.UIZq8hTmJVU- ._3xREbTN5pPg- {\n display: none;\n}\n\n.Ku8sWS0mLew-.UIZq8hTmJVU- ._3xREbTN5pPg- {\n top: calc(16px / 2);\n top: var(--space-small);\n}\n\n/**\n * Postfix\n **/\n\n.VtnAk1HYMMk- {\n position: absolute;\n top: 50%;\n right: calc(16px * 1);\n right: var(--space-base);\n z-index: var(--field--postfix-elevation);\n -webkit-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n\n/**\n * Affix\n **/\n\n.uPLklxvtfJw- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: center;\n justify-content: center;\n margin: 0 calc(var(--field--padding-left) * -1) 0 0;\n padding: 0 var(--field--padding-right) 0 var(--field--padding-left);\n}\n\n@supports (aspect-ratio: 1/1) {\n .uPLklxvtfJw- {\n /*\n * disabling property-no-unknown here as this is a real property\n * that stylelint just doesn't know about. We may be able to remove\n * this when we update our stylelint to not care about IE11.\n */\n /* stylelint-disable-next-line property-no-unknown */\n aspect-ratio: 1/1;\n padding: 0;\n }\n}\n\n.uPLklxvtfJw-.pYqqDvv57JE- {\n margin: 0 0 0 calc(var(--field--padding-right) * -1);\n}\n\n.uPLklxvtfJw-.eI44oQpuVlk- {\n position: relative;\n z-index: var(--field--postfix-action-elevation);\n}\n\n.jO8P2iSHilM- {\n display: -ms-flexbox;\n display: flex;\n margin: 0 calc((var(--field--padding-left) - calc(16px / 8)) * -1) 0 0;\n margin: 0 calc((var(--field--padding-left) - var(--space-smallest)) * -1) 0 0;\n padding: 0 0 0 var(--field--padding-left);\n line-height: var(--field--value-lineHeight);\n -ms-flex-align: center;\n align-items: center;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n}\n\n.jO8P2iSHilM-.pYqqDvv57JE- {\n margin: 0 0 0 calc((var(--field--padding-left) - calc(16px / 8)) * -1);\n margin: 0 0 0 calc((var(--field--padding-left) - var(--space-smallest)) * -1);\n padding: 0 var(--field--padding-left) 0 0;\n}\n\n.UIZq8hTmJVU-:not(.o8D-H-lKfDk-) .jO8P2iSHilM- {\n padding-top: var(--field--padding-top);\n padding-bottom: var(--field--padding-bottom);\n}\n\n._2GfgzNnLOSI- {\n margin-top: calc(16px / 4);\n margin-top: var(--space-smaller);\n}\n";
|
|
21
|
+
var styles = {"wrapper":"nPGhTEEzsoU-","miniLabel":"UIZq8hTmJVU-","textarea":"mgPacJ6Z71Y-","invalid":"gJ-15M615eY-","disabled":"_1rsTLm5GwcM-","small":"o8D-H-lKfDk-","large":"Ku8sWS0mLew-","inline":"_5Hu2F3cBvng-","center":"s1WLQs6ffD8-","right":"a2r4QheWYIA-","maxLength":"KdAnXK1gClo-","inputWrapper":"iQFhpFYnz-8-","childrenWrapper":"Yo2Wi9dpa-Y-","input":"LSHPV7PwOTg-","label":"_3xREbTN5pPg-","postfix":"VtnAk1HYMMk-","affixIcon":"uPLklxvtfJw-","suffix":"pYqqDvv57JE-","hasAction":"eI44oQpuVlk-","affixLabel":"jO8P2iSHilM-","description":"_2GfgzNnLOSI-"};
|
|
22
22
|
styleInject_es.styleInject(css_248z);
|
|
23
23
|
|
|
24
24
|
function AffixLabel({ label, variation = "prefix", labelRef, }) {
|
|
@@ -57,13 +57,14 @@ function FormFieldWrapper({ align, description, descriptionIdentifier, placehold
|
|
|
57
57
|
const wrapperClasses = classnames__default["default"](styles.wrapper, size && styles[size], align && styles[align], {
|
|
58
58
|
[styles.miniLabel]: (placeholder && value !== "") ||
|
|
59
59
|
(placeholder && type === "select") ||
|
|
60
|
-
(placeholder && type === "time")
|
|
60
|
+
(placeholder && type === "time") ||
|
|
61
|
+
// Naively assume that if the the type is tel, it is the InputPhoneNumber
|
|
62
|
+
(placeholder && type === "tel"),
|
|
61
63
|
[styles.textarea]: type === "textarea",
|
|
62
64
|
[styles.invalid]: invalid !== null && invalid !== void 0 ? invalid : error,
|
|
63
65
|
[styles.disabled]: disabled,
|
|
64
66
|
[styles.inline]: inline,
|
|
65
67
|
[styles.maxLength]: maxLength,
|
|
66
|
-
[styles.select]: type === "select",
|
|
67
68
|
});
|
|
68
69
|
const wrapperInlineStyle = {
|
|
69
70
|
["--formField-maxLength"]: maxLength || max,
|
|
@@ -83,7 +84,7 @@ function FormFieldWrapper({ align, description, descriptionIdentifier, placehold
|
|
|
83
84
|
React__default["default"].createElement("div", { className: styles.inputWrapper },
|
|
84
85
|
React__default["default"].createElement("label", { className: styles.label, htmlFor: identifier, style: (prefixRef === null || prefixRef === void 0 ? void 0 : prefixRef.current) || (suffixRef === null || suffixRef === void 0 ? void 0 : suffixRef.current) ? labelStyle : undefined }, placeholder),
|
|
85
86
|
(prefix === null || prefix === void 0 ? void 0 : prefix.label) && React__default["default"].createElement(AffixLabel, Object.assign({}, prefix, { labelRef: prefixRef })),
|
|
86
|
-
children,
|
|
87
|
+
React__default["default"].createElement("div", { className: styles.childrenWrapper }, children),
|
|
87
88
|
(suffix === null || suffix === void 0 ? void 0 : suffix.label) && (React__default["default"].createElement(AffixLabel, Object.assign({}, suffix, { labelRef: suffixRef, variation: "suffix" })))),
|
|
88
89
|
(suffix === null || suffix === void 0 ? void 0 : suffix.icon) && (React__default["default"].createElement(AffixIcon, Object.assign({}, suffix, { variation: "suffix", size: size })))),
|
|
89
90
|
description && !inline && (React__default["default"].createElement(FormFieldDescription, { id: descriptionIdentifier, description: description })),
|
|
@@ -94,6 +95,9 @@ function FormFieldWrapper({ align, description, descriptionIdentifier, placehold
|
|
|
94
95
|
paddingLeft: undefined,
|
|
95
96
|
paddingRight: undefined,
|
|
96
97
|
};
|
|
98
|
+
// Naively assume that if the the type is tel, it is the InputPhoneNumber
|
|
99
|
+
if (type === "tel")
|
|
100
|
+
return newPadding;
|
|
97
101
|
if ((prefixRef === null || prefixRef === void 0 ? void 0 : prefixRef.current) && !hasValue) {
|
|
98
102
|
const { offsetWidth } = prefixRef.current;
|
|
99
103
|
newPadding.paddingLeft = offset(offsetWidth);
|
|
@@ -157,7 +161,8 @@ function FormField(props) {
|
|
|
157
161
|
default:
|
|
158
162
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
159
163
|
React__default["default"].createElement("input", Object.assign({}, textFieldProps, { autoComplete: setAutocomplete(autocomplete), type: type, maxLength: maxLength, max: max, min: min, ref: inputRef })),
|
|
160
|
-
loading && React__default["default"].createElement(FormFieldPostFix, { variation: "spinner" })
|
|
164
|
+
loading && React__default["default"].createElement(FormFieldPostFix, { variation: "spinner" }),
|
|
165
|
+
children));
|
|
161
166
|
}
|
|
162
167
|
}
|
|
163
168
|
function handleChange(event) {
|
package/dist/InputDate/index.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var lodash = require('lodash');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var FormField = require('../FormField-
|
|
7
|
+
var FormField = require('../FormField-e033e2cd.js');
|
|
8
8
|
var DatePicker = require('../DatePicker-5ead9469.js');
|
|
9
9
|
require('../tslib.es6-5b8768b7.js');
|
|
10
10
|
require('uuid');
|
package/dist/InputEmail/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var FormField = require('../FormField-
|
|
6
|
+
var FormField = require('../FormField-e033e2cd.js');
|
|
7
7
|
require('../tslib.es6-5b8768b7.js');
|
|
8
8
|
require('uuid');
|
|
9
9
|
require('react-hook-form');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var FormField = require('../FormField-
|
|
6
|
+
var FormField = require('../FormField-e033e2cd.js');
|
|
7
7
|
require('../tslib.es6-5b8768b7.js');
|
|
8
8
|
require('uuid');
|
|
9
9
|
require('react-hook-form');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var FormField = require('../FormField-
|
|
6
|
+
var FormField = require('../FormField-e033e2cd.js');
|
|
7
7
|
require('../tslib.es6-5b8768b7.js');
|
|
8
8
|
require('uuid');
|
|
9
9
|
require('react-hook-form');
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
|
+
import { FormFieldProps } from "../FormField";
|
|
3
|
+
export interface InputMaskProps {
|
|
4
|
+
/**
|
|
5
|
+
* A string pattern to mask the value. For example:
|
|
6
|
+
*
|
|
7
|
+
* - Phone number: `(***) ***-*****` = `(555) 123-3456`
|
|
8
|
+
* - Hours and minutes: `**:**` = `01:20`
|
|
9
|
+
*
|
|
10
|
+
* By default, a `*` is used to indicate where a value would be in place. To
|
|
11
|
+
* change that, use the `delimiter` prop.
|
|
12
|
+
*/
|
|
13
|
+
readonly pattern: string;
|
|
14
|
+
/**
|
|
15
|
+
* Change the delimiter when you need to have a `*` as a value that the input
|
|
16
|
+
* returns. For example, you want your pattern to have a `*` in it.
|
|
17
|
+
*
|
|
18
|
+
* ```
|
|
19
|
+
* <InputMask pattern="n*n=n" delimiter="n" />
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* It would now replace `n` with the value you type and end up with `1*2=2` if
|
|
23
|
+
* you give a value of `122`.
|
|
24
|
+
*
|
|
25
|
+
* @default "*"
|
|
26
|
+
*/
|
|
27
|
+
readonly delimiter?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Allow/prevent users adding from more value than the desired pattern.
|
|
30
|
+
* For example, your pattern could accept 10 characters. If it's strict, your
|
|
31
|
+
* users can only type 10 characters.
|
|
32
|
+
*
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
readonly strict?: boolean;
|
|
36
|
+
readonly children: ReactElement<FormFieldProps>;
|
|
37
|
+
}
|
|
38
|
+
export declare function InputMask({ children, delimiter, pattern, strict, }: InputMaskProps): React.ReactElement<FormFieldProps, string | React.JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CommonFormFieldProps, FormFieldProps } from "../FormField";
|
|
3
|
+
interface InputPhoneNumberProps extends Omit<CommonFormFieldProps, "align">, Pick<FormFieldProps, "autocomplete" | "onEnter" | "onFocus" | "onBlur" | "validations" | "readonly" | "prefix" | "suffix"> {
|
|
4
|
+
readonly value: string;
|
|
5
|
+
readonly onChange: (value: string) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Shows a "required" validation message when the component is left empty.
|
|
8
|
+
*/
|
|
9
|
+
readonly required?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function InputPhoneNumber({ required, ...props }: InputPhoneNumberProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./InputPhoneNumber";
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib_es6 = require('../tslib.es6-5b8768b7.js');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var styleInject_es = require('../style-inject.es-9d2f5f4e.js');
|
|
8
|
+
var FormField = require('../FormField-e033e2cd.js');
|
|
9
|
+
require('uuid');
|
|
10
|
+
require('react-hook-form');
|
|
11
|
+
require('classnames');
|
|
12
|
+
require('../Button-69409e46.js');
|
|
13
|
+
require('react-router-dom');
|
|
14
|
+
require('../Icon-405a216c.js');
|
|
15
|
+
require('@jobber/design');
|
|
16
|
+
require('../Typography-fd6f932a.js');
|
|
17
|
+
require('../Text-e7ed0974.js');
|
|
18
|
+
require('../InputValidation-bf743417.js');
|
|
19
|
+
require('framer-motion');
|
|
20
|
+
require('../Spinner-9d8fc7ff.js');
|
|
21
|
+
|
|
22
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
|
+
|
|
24
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
|
+
|
|
26
|
+
var css_248z = ".L7WK-i5uaOk- {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n position: absolute;\n top: 0;\n right: 0;\n left: 0;\n z-index: 1;\n z-index: var(--elevation-base);\n height: var(--field--height);\n padding-top: var(--field--padding-top);\n padding-bottom: var(--field--padding-bottom);\n padding-left: var(--field--padding-left);\n padding-right: var(--field--padding-right);\n color: rgb(181, 181, 181);\n color: var(--color-grey);\n font-family: inherit;\n font-size: inherit;\n line-height: var(--field--value-lineHeight);\n pointer-events: none;\n}\n\n.q1wXBupm5Xc- {\n visibility: hidden;\n opacity: 0;\n}\n";
|
|
27
|
+
var styles = {"mask":"L7WK-i5uaOk-","hiddenValue":"q1wXBupm5Xc-"};
|
|
28
|
+
styleInject_es.styleInject(css_248z);
|
|
29
|
+
|
|
30
|
+
function InputMask({ children, delimiter = "*", pattern, strict = true, }) {
|
|
31
|
+
const { value: inputValue, onChange } = children.props;
|
|
32
|
+
const [isMasking, setIsMasking] = React.useState(!inputValue);
|
|
33
|
+
const stringifiedValue = String(inputValue || "");
|
|
34
|
+
const placeholderValue = pattern
|
|
35
|
+
.replace(new RegExp(`\\${delimiter}`, "g"), "_")
|
|
36
|
+
.slice(stringifiedValue.length);
|
|
37
|
+
const inputMask = (React__default["default"].createElement("div", { className: styles.mask, "aria-hidden": "true" },
|
|
38
|
+
React__default["default"].createElement("span", { className: styles.hiddenValue }, stringifiedValue),
|
|
39
|
+
placeholderValue));
|
|
40
|
+
return React.cloneElement(children, {
|
|
41
|
+
onChange: handleChange,
|
|
42
|
+
children: isMasking && inputMask,
|
|
43
|
+
});
|
|
44
|
+
function handleChange(value) {
|
|
45
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(formatValue(value));
|
|
46
|
+
}
|
|
47
|
+
function formatValue(value) {
|
|
48
|
+
const { cleanValueChars, patternChars, specialChars, isOverCharLimit } = getMaskingInfo(value);
|
|
49
|
+
if (!strict && isOverCharLimit) {
|
|
50
|
+
setIsMasking(false);
|
|
51
|
+
return cleanValueChars.join("");
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
setIsMasking(true);
|
|
55
|
+
return patternChars.reduce(getMaskedValue(cleanValueChars, specialChars), "");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function getMaskingInfo(value) {
|
|
59
|
+
const patternChars = pattern.split("");
|
|
60
|
+
const specialChars = patternChars.filter(char => char !== delimiter);
|
|
61
|
+
const cleanValueChars = value
|
|
62
|
+
.split("")
|
|
63
|
+
.filter(char => !specialChars.includes(char))
|
|
64
|
+
// Since this is only used in InputPhoneNumber, we can restrict it to
|
|
65
|
+
// just numbers for now.
|
|
66
|
+
.map(Number)
|
|
67
|
+
.filter(num => !isNaN(num));
|
|
68
|
+
const isOverCharLimit = cleanValueChars.length > patternChars.length - specialChars.length;
|
|
69
|
+
return { cleanValueChars, patternChars, specialChars, isOverCharLimit };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function getMaskedValue(cleanVal, specialChars) {
|
|
73
|
+
return (result, nextCharacter) => {
|
|
74
|
+
if (!cleanVal.length)
|
|
75
|
+
return result;
|
|
76
|
+
if (specialChars.includes(nextCharacter))
|
|
77
|
+
return result + nextCharacter;
|
|
78
|
+
const nextValue = cleanVal.shift();
|
|
79
|
+
return result + nextValue;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function InputPhoneNumber(_a) {
|
|
84
|
+
var { required } = _a, props = tslib_es6.__rest(_a, ["required"]);
|
|
85
|
+
const { placeholder, validations } = props;
|
|
86
|
+
const pattern = "(***) ***-****";
|
|
87
|
+
return (React__default["default"].createElement(InputMask, { pattern: pattern, strict: false },
|
|
88
|
+
React__default["default"].createElement(FormField.FormField, Object.assign({}, props, { type: "tel", validations: Object.assign({ required: {
|
|
89
|
+
value: Boolean(required),
|
|
90
|
+
message: `${placeholder || "This"} is required`,
|
|
91
|
+
} }, validations) }))));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
exports.InputPhoneNumber = InputPhoneNumber;
|
package/dist/InputText/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var InputText = require('../InputText-
|
|
5
|
+
var InputText = require('../InputText-7dc7beb6.js');
|
|
6
6
|
require('react');
|
|
7
|
-
require('../FormField-
|
|
7
|
+
require('../FormField-e033e2cd.js');
|
|
8
8
|
require('../tslib.es6-5b8768b7.js');
|
|
9
9
|
require('uuid');
|
|
10
10
|
require('react-hook-form');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var FormField = require('./FormField-
|
|
4
|
+
var FormField = require('./FormField-e033e2cd.js');
|
|
5
5
|
|
|
6
6
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
7
7
|
|
package/dist/InputTime/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var tslib_es6 = require('../tslib.es6-5b8768b7.js');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var debounce = require('lodash/debounce');
|
|
8
8
|
var temporal = require('@std-proposal/temporal');
|
|
9
|
-
var FormField = require('../FormField-
|
|
9
|
+
var FormField = require('../FormField-e033e2cd.js');
|
|
10
10
|
require('uuid');
|
|
11
11
|
require('react-hook-form');
|
|
12
12
|
require('../style-inject.es-9d2f5f4e.js');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var FormField = require('./FormField-
|
|
4
|
+
var FormField = require('./FormField-e033e2cd.js');
|
|
5
5
|
|
|
6
6
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
7
7
|
|
package/dist/Select/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var Option = require('../Option-
|
|
5
|
+
var Option = require('../Option-61f34d18.js');
|
|
6
6
|
require('react');
|
|
7
|
-
require('../FormField-
|
|
7
|
+
require('../FormField-e033e2cd.js');
|
|
8
8
|
require('../tslib.es6-5b8768b7.js');
|
|
9
9
|
require('uuid');
|
|
10
10
|
require('react-hook-form');
|
package/package.json
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "rollup --config",
|
|
9
|
-
"clean": "rm -rf dist/* tsconfig.tsbuildinfo",
|
|
10
|
-
"prepublishOnly": "ts-node --project ../../tsconfig.bin.json ../../scripts/entryPoints.ts",
|
|
11
9
|
"bootstrap": "npm run clean; npm run build",
|
|
12
|
-
"
|
|
10
|
+
"clean": "rm -rf dist/* tsconfig.tsbuildinfo",
|
|
11
|
+
"entryPoints:build": "ts-node --project ../../tsconfig.bin.json ../../scripts/entryPoints.ts",
|
|
12
|
+
"entryPoints:clean": "npm run entryPoints:build clean",
|
|
13
|
+
"prepack": "npm run entryPoints:build",
|
|
14
|
+
"postpack": "npm run entryPoints:clean",
|
|
15
|
+
"prepublishOnly": "npm run entryPoints:build",
|
|
16
|
+
"postpublish": "npm run entryPoints:clean"
|
|
13
17
|
},
|
|
14
18
|
"files": [
|
|
15
19
|
"*.js",
|
|
@@ -81,5 +85,5 @@
|
|
|
81
85
|
"> 1%",
|
|
82
86
|
"IE 10"
|
|
83
87
|
],
|
|
84
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "685ee1fa3566e323bcf7da1212c9053f124c2c6f"
|
|
85
89
|
}
|