@servicetitan/form 19.3.0 → 20.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/color-picker/color-palette.js +49 -55
- package/dist/color-picker/color-palette.js.map +1 -1
- package/dist/color-picker/color-picker.js +11 -34
- package/dist/color-picker/color-picker.js.map +1 -1
- package/dist/color-picker/index.js +2 -14
- package/dist/color-picker/index.js.map +1 -1
- package/dist/date-range-picker/date-range-picker.d.ts +3 -1
- package/dist/date-range-picker/date-range-picker.d.ts.map +1 -1
- package/dist/date-range-picker/date-range-picker.js +40 -52
- package/dist/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/date-range-picker/date-range-picker.module.css +16 -0
- package/dist/date-range-picker/index.js +1 -13
- package/dist/date-range-picker/index.js.map +1 -1
- package/dist/date-range.js +1 -2
- package/dist/demo/color-picker.js +11 -14
- package/dist/demo/color-picker.js.map +1 -1
- package/dist/demo/date-range-picker.js +9 -12
- package/dist/demo/date-range-picker.js.map +1 -1
- package/dist/demo/dropdown-state.js +25 -29
- package/dist/demo/dropdown-state.js.map +1 -1
- package/dist/demo/file-uploader.js +10 -13
- package/dist/demo/file-uploader.js.map +1 -1
- package/dist/demo/index.js +8 -20
- package/dist/demo/index.js.map +1 -1
- package/dist/demo/input-date-mask.js +9 -12
- package/dist/demo/input-date-mask.js.map +1 -1
- package/dist/demo/number-input.js +9 -12
- package/dist/demo/number-input.js.map +1 -1
- package/dist/demo/original-number-input.js +9 -12
- package/dist/demo/original-number-input.js.map +1 -1
- package/dist/demo/phone-number-input.js +4 -7
- package/dist/demo/phone-number-input.js.map +1 -1
- package/dist/dropdown-state.js +25 -32
- package/dist/dropdown-state.js.map +1 -1
- package/dist/file-uploader/config.js +4 -8
- package/dist/file-uploader/config.js.map +1 -1
- package/dist/file-uploader/file-uploader.js +26 -29
- package/dist/file-uploader/file-uploader.js.map +1 -1
- package/dist/file-uploader/index.js +2 -7
- package/dist/file-uploader/index.js.map +1 -1
- package/dist/file-uploader/uploader.js +3 -7
- package/dist/file-uploader/uploader.js.map +1 -1
- package/dist/form-helpers.js +29 -48
- package/dist/form-helpers.js.map +1 -1
- package/dist/form-state-error-banner/form-state-error-banner.js +8 -11
- package/dist/form-state-error-banner/form-state-error-banner.js.map +1 -1
- package/dist/form-state-error-banner/index.js +1 -13
- package/dist/form-state-error-banner/index.js.map +1 -1
- package/dist/form-validators.js +8 -11
- package/dist/form-validators.js.map +1 -1
- package/dist/index.js +14 -26
- package/dist/index.js.map +1 -1
- package/dist/input-date-mask/index.js +1 -13
- package/dist/input-date-mask/index.js.map +1 -1
- package/dist/input-date-mask/input-date-mask.js +19 -44
- package/dist/input-date-mask/input-date-mask.js.map +1 -1
- package/dist/label/index.js +1 -13
- package/dist/label/index.js.map +1 -1
- package/dist/label/label.js +5 -31
- package/dist/label/label.js.map +1 -1
- package/dist/masked-input.js +5 -12
- package/dist/masked-input.js.map +1 -1
- package/dist/number-input/common-interfaces.js +1 -2
- package/dist/number-input/get-formatted-string.js +2 -6
- package/dist/number-input/get-formatted-string.js.map +1 -1
- package/dist/number-input/index.js +1 -13
- package/dist/number-input/index.js.map +1 -1
- package/dist/number-input/number-input.js +22 -29
- package/dist/number-input/number-input.js.map +1 -1
- package/dist/number-input/process-value.js +2 -6
- package/dist/number-input/process-value.js.map +1 -1
- package/dist/original-number-input/index.js +1 -13
- package/dist/original-number-input/index.js.map +1 -1
- package/dist/original-number-input/ordinal-number-input.js +16 -22
- package/dist/original-number-input/ordinal-number-input.js.map +1 -1
- package/dist/persistent-form-state/domain-storage.js +1 -5
- package/dist/persistent-form-state/domain-storage.js.map +1 -1
- package/dist/persistent-form-state/in-memory-storage.js +2 -6
- package/dist/persistent-form-state/in-memory-storage.js.map +1 -1
- package/dist/persistent-form-state/index.js +1 -13
- package/dist/persistent-form-state/index.js.map +1 -1
- package/dist/persistent-form-state/persistent-form-state.js +13 -17
- package/dist/persistent-form-state/persistent-form-state.js.map +1 -1
- package/dist/phone-number-input/index.js +1 -13
- package/dist/phone-number-input/index.js.map +1 -1
- package/dist/phone-number-input/phone-number-input.js +6 -12
- package/dist/phone-number-input/phone-number-input.js.map +1 -1
- package/package.json +19 -18
- package/src/date-range-picker/date-range-picker.module.css +16 -0
- package/src/date-range-picker/date-range-picker.module.css.d.ts +1 -0
- package/src/date-range-picker/date-range-picker.tsx +17 -9
@@ -1,68 +1,62 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.colorPalette = void 0;
|
7
|
-
const tokens_1 = __importDefault(require("@servicetitan/tokens"));
|
8
|
-
const design_system_1 = require("@servicetitan/design-system");
|
9
|
-
exports.colorPalette = [
|
1
|
+
import tokens from '@servicetitan/tokens';
|
2
|
+
import { rgbToHex } from '@servicetitan/design-system';
|
3
|
+
export const colorPalette = [
|
10
4
|
[
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
5
|
+
tokens.colorRed200,
|
6
|
+
tokens.colorOrange200,
|
7
|
+
tokens.colorYellow200,
|
8
|
+
tokens.colorGreen200,
|
9
|
+
tokens.colorCyan200,
|
10
|
+
tokens.colorBlue200,
|
11
|
+
tokens.colorMagenta200,
|
12
|
+
tokens.colorPurple200,
|
13
|
+
tokens.colorNeutral60,
|
20
14
|
],
|
21
15
|
[
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
16
|
+
tokens.colorRed300,
|
17
|
+
tokens.colorOrange300,
|
18
|
+
tokens.colorYellow300,
|
19
|
+
tokens.colorGreen300,
|
20
|
+
tokens.colorCyan300,
|
21
|
+
tokens.colorBlue300,
|
22
|
+
tokens.colorMagenta300,
|
23
|
+
tokens.colorPurple300,
|
24
|
+
tokens.colorNeutral70,
|
31
25
|
],
|
32
26
|
[
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
27
|
+
tokens.colorRed400,
|
28
|
+
tokens.colorOrange400,
|
29
|
+
tokens.colorYellow400,
|
30
|
+
tokens.colorGreen400,
|
31
|
+
tokens.colorCyan400,
|
32
|
+
tokens.colorBlue400,
|
33
|
+
tokens.colorMagenta400,
|
34
|
+
tokens.colorPurple400,
|
35
|
+
tokens.colorNeutral90,
|
42
36
|
],
|
43
37
|
[
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
38
|
+
tokens.colorRed500,
|
39
|
+
tokens.colorOrange500,
|
40
|
+
tokens.colorYellow500,
|
41
|
+
tokens.colorGreen500,
|
42
|
+
tokens.colorCyan500,
|
43
|
+
tokens.colorBlue500,
|
44
|
+
tokens.colorMagenta500,
|
45
|
+
tokens.colorPurple500,
|
46
|
+
tokens.colorNeutral200,
|
53
47
|
],
|
54
48
|
[
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
49
|
+
tokens.colorRed600,
|
50
|
+
tokens.colorOrange600,
|
51
|
+
tokens.colorYellow600,
|
52
|
+
tokens.colorGreen600,
|
53
|
+
tokens.colorCyan600,
|
54
|
+
tokens.colorBlue600,
|
55
|
+
tokens.colorMagenta600,
|
56
|
+
tokens.colorPurple600,
|
57
|
+
tokens.colorNeutral400,
|
64
58
|
],
|
65
59
|
]
|
66
60
|
.flat()
|
67
|
-
.map(color =>
|
61
|
+
.map(color => rgbToHex(color).toLowerCase());
|
68
62
|
//# sourceMappingURL=color-palette.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"color-palette.js","sourceRoot":"","sources":["../../src/color-picker/color-palette.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"color-palette.js","sourceRoot":"","sources":["../../src/color-picker/color-palette.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,M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Ae;KACzB;CACJ;KACI,IAAI,EAAE;KACN,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC"}
|
@@ -1,39 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
-
}) : function(o, v) {
|
12
|
-
o["default"] = v;
|
13
|
-
});
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
-
if (mod && mod.__esModule) return mod;
|
16
|
-
var result = {};
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
-
__setModuleDefault(result, mod);
|
19
|
-
return result;
|
20
|
-
};
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
22
|
-
exports.ColorPicker = void 0;
|
23
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
24
|
-
const react_1 = require("react");
|
25
|
-
const design_system_1 = require("@servicetitan/design-system");
|
26
|
-
const color_palette_1 = require("./color-palette");
|
27
|
-
const Styles = __importStar(require("./color-picker.module.css"));
|
28
|
-
const ColorPicker = ({ label, colors = color_palette_1.colorPalette, value, preview: Preview, onChange, }) => {
|
29
|
-
const ref = (0, react_1.useRef)(null);
|
30
|
-
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
31
|
-
const handleClickOutside = (0, react_1.useCallback)((event) => {
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useRef, useState, useCallback, useEffect } from 'react';
|
3
|
+
import { Popover, BodyText, Card, ColorPicker as AnvilColorPicker, } from '@servicetitan/design-system';
|
4
|
+
import { colorPalette } from './color-palette';
|
5
|
+
import * as Styles from './color-picker.module.css';
|
6
|
+
export const ColorPicker = ({ label, colors = colorPalette, value, preview: Preview, onChange, }) => {
|
7
|
+
const ref = useRef(null);
|
8
|
+
const [isOpen, setIsOpen] = useState(false);
|
9
|
+
const handleClickOutside = useCallback((event) => {
|
32
10
|
if (ref.current && !ref.current.contains(event.target)) {
|
33
11
|
setIsOpen(false);
|
34
12
|
}
|
35
13
|
}, []);
|
36
|
-
|
14
|
+
useEffect(() => {
|
37
15
|
document.addEventListener('mousedown', handleClickOutside);
|
38
16
|
return () => {
|
39
17
|
document.removeEventListener('mousedown', handleClickOutside);
|
@@ -42,7 +20,6 @@ const ColorPicker = ({ label, colors = color_palette_1.colorPalette, value, prev
|
|
42
20
|
const handleTriggerClick = () => {
|
43
21
|
setIsOpen(isOpen => !isOpen);
|
44
22
|
};
|
45
|
-
return ((
|
23
|
+
return (_jsx("div", Object.assign({ ref: ref, className: "d-f" }, { children: _jsxs(Popover, Object.assign({ trigger: _jsx("div", { style: { background: value }, onClick: handleTriggerClick, className: Styles.colorPicker }, void 0), open: isOpen, direction: "rb", popoverContentClassName: "p-3", className: Styles.colorPickerPopover }, { children: [_jsx(BodyText, Object.assign({ size: "medium", className: "m-b-1" }, { children: label }), void 0), _jsx(Card, Object.assign({ padding: "thin" }, { children: _jsx(AnvilColorPicker, { colors: colors, value: value === null || value === void 0 ? void 0 : value.toLowerCase(), onChange: onChange }, void 0) }), void 0), Preview && _jsx(Preview, { color: value }, void 0)] }), void 0) }), void 0));
|
46
24
|
};
|
47
|
-
exports.ColorPicker = ColorPicker;
|
48
25
|
//# sourceMappingURL=color-picker.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"color-picker.js","sourceRoot":"","sources":["../../src/color-picker/color-picker.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"color-picker.js","sourceRoot":"","sources":["../../src/color-picker/color-picker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AAEpF,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EAAE,KAAK,EAAE,EAC5B,OAAO,EAAE,kBAAkB,EAC3B,SAAS,EAAE,MAAM,CAAC,WAAW,WAC/B,EAEN,IAAI,EAAE,MAAM,EACZ,SAAS,EAAC,IAAI,EACd,uBAAuB,EAAC,KAAK,EAC7B,SAAS,EAAE,MAAM,CAAC,kBAAkB,iBAEpC,KAAC,QAAQ,kBAAC,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,OAAO,gBACpC,KAAK,YACC,EACX,KAAC,IAAI,kBAAC,OAAO,EAAC,MAAM,gBAChB,KAAC,gBAAgB,IACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,EAAE,EAC3B,QAAQ,EAAE,QAAQ,WACpB,YACC,EACN,OAAO,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,KAAK,WAAI,aAC/B,YACR,CACT,CAAC;AACN,CAAC,CAAC"}
|
@@ -1,15 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
-
}) : (function(o, m, k, k2) {
|
6
|
-
if (k2 === undefined) k2 = k;
|
7
|
-
o[k2] = m[k];
|
8
|
-
}));
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
11
|
-
};
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
13
|
-
__exportStar(require("./color-picker"), exports);
|
14
|
-
__exportStar(require("./color-palette"), exports);
|
1
|
+
export * from './color-picker';
|
2
|
+
export * from './color-palette';
|
15
3
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/color-picker/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/color-picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
|
@@ -28,10 +28,12 @@ export declare class DateRangePicker extends Component<DateRangePickerProps> {
|
|
28
28
|
isFocused: boolean;
|
29
29
|
showDatePicker: boolean;
|
30
30
|
isIconClicked: boolean;
|
31
|
+
isDateRangePickerClicked: boolean;
|
31
32
|
constructor(props: DateRangePickerProps);
|
32
33
|
handleRef: (wrapElem: HTMLDivElement) => void;
|
33
34
|
toggleShow(show?: boolean): void;
|
34
|
-
|
35
|
+
handleClickGlobal: (evt: Event) => void;
|
36
|
+
handleClickDateRangePicker: () => void;
|
35
37
|
handleClickIcon: () => void;
|
36
38
|
componentDidMount(): void;
|
37
39
|
componentWillUnmount(): void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"date-range-picker.d.ts","sourceRoot":"","sources":["../../src/date-range-picker/date-range-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAEH,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,EACb,MAAM,kCAAkC,CAAC;AAO1C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IACzC,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,eAAe,CAAC,EAAE,IAAI,CAAC;IACvB,eAAe,CAAC,EAAE,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE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,WAAW,qBAad;IAED,IAAI,SAAS,qBAYZ;CACJ"}
|
@@ -1,47 +1,22 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
-
}) : (function(o, m, k, k2) {
|
6
|
-
if (k2 === undefined) k2 = k;
|
7
|
-
o[k2] = m[k];
|
8
|
-
}));
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
-
}) : function(o, v) {
|
12
|
-
o["default"] = v;
|
13
|
-
});
|
14
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
15
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
16
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
17
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
18
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
19
6
|
};
|
20
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
21
|
-
if (mod && mod.__esModule) return mod;
|
22
|
-
var result = {};
|
23
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
24
|
-
__setModuleDefault(result, mod);
|
25
|
-
return result;
|
26
|
-
};
|
27
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
28
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
29
9
|
};
|
30
|
-
|
31
|
-
|
32
|
-
};
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
const mobx_react_1 = require("mobx-react");
|
41
|
-
const classnames_1 = __importDefault(require("classnames"));
|
42
|
-
const moment_1 = __importDefault(require("moment"));
|
43
|
-
const Styles = __importStar(require("./date-range-picker.module.css"));
|
44
|
-
let DateRangePicker = class DateRangePicker extends react_1.Component {
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
11
|
+
import { Component } from 'react';
|
12
|
+
import { DateRangePicker as DateRangePickerKendo, } from '@progress/kendo-react-dateinputs';
|
13
|
+
import { Icon, InputDateMask, Stack } from '@servicetitan/design-system';
|
14
|
+
import { observable, action, makeObservable } from 'mobx';
|
15
|
+
import { observer } from 'mobx-react';
|
16
|
+
import classnames from 'classnames';
|
17
|
+
import moment from 'moment';
|
18
|
+
import * as Styles from './date-range-picker.module.css';
|
19
|
+
let DateRangePicker = class DateRangePicker extends Component {
|
45
20
|
constructor(props) {
|
46
21
|
super(props);
|
47
22
|
// `HTMLDivElement` leads to issues with Node/SSR
|
@@ -69,6 +44,12 @@ let DateRangePicker = class DateRangePicker extends react_1.Component {
|
|
69
44
|
writable: true,
|
70
45
|
value: false
|
71
46
|
});
|
47
|
+
Object.defineProperty(this, "isDateRangePickerClicked", {
|
48
|
+
enumerable: true,
|
49
|
+
configurable: true,
|
50
|
+
writable: true,
|
51
|
+
value: false
|
52
|
+
});
|
72
53
|
Object.defineProperty(this, "handleRef", {
|
73
54
|
enumerable: true,
|
74
55
|
configurable: true,
|
@@ -77,7 +58,7 @@ let DateRangePicker = class DateRangePicker extends react_1.Component {
|
|
77
58
|
this.wrapElem = wrapElem;
|
78
59
|
}
|
79
60
|
});
|
80
|
-
Object.defineProperty(this, "
|
61
|
+
Object.defineProperty(this, "handleClickGlobal", {
|
81
62
|
enumerable: true,
|
82
63
|
configurable: true,
|
83
64
|
writable: true,
|
@@ -86,7 +67,7 @@ let DateRangePicker = class DateRangePicker extends react_1.Component {
|
|
86
67
|
return;
|
87
68
|
}
|
88
69
|
const isPrevFocused = this.isFocused;
|
89
|
-
this.isFocused = this.
|
70
|
+
this.isFocused = this.isDateRangePickerClicked;
|
90
71
|
if (!this.isFocused && isPrevFocused) {
|
91
72
|
// click outside
|
92
73
|
this.props.field.enableAutoValidationAndValidate();
|
@@ -97,6 +78,15 @@ let DateRangePicker = class DateRangePicker extends react_1.Component {
|
|
97
78
|
this.props.field.disableAutoValidation();
|
98
79
|
}
|
99
80
|
this.isIconClicked = false;
|
81
|
+
this.isDateRangePickerClicked = false;
|
82
|
+
}
|
83
|
+
});
|
84
|
+
Object.defineProperty(this, "handleClickDateRangePicker", {
|
85
|
+
enumerable: true,
|
86
|
+
configurable: true,
|
87
|
+
writable: true,
|
88
|
+
value: () => {
|
89
|
+
this.isDateRangePickerClicked = true;
|
100
90
|
}
|
101
91
|
});
|
102
92
|
Object.defineProperty(this, "handleClickIcon", {
|
@@ -164,29 +154,27 @@ let DateRangePicker = class DateRangePicker extends react_1.Component {
|
|
164
154
|
this.props.field.onChange({ from: values[0] || undefined, to: values[1] || undefined });
|
165
155
|
}
|
166
156
|
});
|
167
|
-
|
157
|
+
makeObservable(this);
|
168
158
|
}
|
169
159
|
toggleShow(show) {
|
170
160
|
this.showDatePicker = show !== undefined ? show : !this.showDatePicker;
|
171
161
|
}
|
172
162
|
componentDidMount() {
|
173
|
-
window.addEventListener('
|
174
|
-
window.addEventListener('click', this.handleFocus);
|
163
|
+
window.addEventListener('click', this.handleClickGlobal);
|
175
164
|
}
|
176
165
|
componentWillUnmount() {
|
177
|
-
window.removeEventListener('
|
178
|
-
window.removeEventListener('click', this.handleFocus);
|
166
|
+
window.removeEventListener('click', this.handleClickGlobal);
|
179
167
|
}
|
180
168
|
render() {
|
181
169
|
var _a, _b;
|
182
170
|
const { hasError } = this.props.field;
|
183
171
|
const { 'qa-testing': qaTestingLocator, placeHolder, inputFormat, className, calendarComponent, headerTitleComponent, cellComponent, minDate, maxDate, calendarMinDate, calendarMaxDate, topView, bottomView, horizontalAlign, disabled = false, small, maskChar, } = this.props;
|
184
172
|
const value = this.props.field.value ? this.props.field.value : {};
|
185
|
-
const horizontalAlignClass = (
|
173
|
+
const horizontalAlignClass = classnames({
|
186
174
|
[Styles.popupCenter]: horizontalAlign === 'center',
|
187
175
|
[Styles.popupRight]: horizontalAlign === 'right',
|
188
176
|
});
|
189
|
-
return ((
|
177
|
+
return (_jsxs("div", Object.assign({ className: classnames(Styles.dateRangePicker, className), ref: this.handleRef, onClick: this.handleClickDateRangePicker }, { children: [_jsx(DateRangePickerKendo, { className: Styles.dateRangePickerKendo, calendarSettings: {
|
190
178
|
min: minDate !== null && minDate !== void 0 ? minDate : calendarMinDate,
|
191
179
|
max: maxDate !== null && maxDate !== void 0 ? maxDate : calendarMaxDate,
|
192
180
|
topView,
|
@@ -202,10 +190,10 @@ let DateRangePicker = class DateRangePicker extends react_1.Component {
|
|
202
190
|
tabIndex: -1,
|
203
191
|
}, endDateInputSettings: {
|
204
192
|
tabIndex: -1,
|
205
|
-
}, show: this.showDatePicker, value: { start: (_a = value.from) !== null && _a !== void 0 ? _a : null, end: (_b = value.to) !== null && _b !== void 0 ? _b : null }, onChange: this.handleChange, min: minDate, max: maxDate, calendar: calendarComponent }, void 0), (
|
193
|
+
}, show: this.showDatePicker, value: { start: (_a = value.from) !== null && _a !== void 0 ? _a : null, end: (_b = value.to) !== null && _b !== void 0 ? _b : null }, onChange: this.handleChange, min: minDate, max: maxDate, calendar: calendarComponent }, void 0), _jsxs(Stack, Object.assign({ alignItems: "center", className: "flex-grow-1" }, { children: [_jsx(Stack.Item, Object.assign({ fill: true }, { children: _jsx(InputDateMask, { shortLabel: _jsx(Icon, { name: "today", className: classnames(Styles.icon, `${qaTestingLocator}-icon-from`), onClick: this.handleClickIcon }, void 0), placeholder: placeHolder, value: value.from, onChange: this.handleFromChange, error: hasError, disabled: disabled, "qa-testing": `${qaTestingLocator}-from`, dateFormat: inputFormat, minDate: minDate, maxDate: this.maxFromDate, small: small, maskChar: maskChar }, void 0) }), void 0), _jsx(Icon, { name: "arrow_forward", className: Styles.endLabel }, void 0), _jsx(Stack.Item, Object.assign({ fill: true }, { children: _jsx(InputDateMask, { shortLabel: _jsx(Icon, { name: "today", className: classnames(Styles.icon, `${qaTestingLocator}-icon-to`), onClick: this.handleClickIcon }, void 0), placeholder: placeHolder, value: value.to, onChange: this.handleToChange, error: hasError, disabled: disabled, "qa-testing": `${qaTestingLocator}-to`, dateFormat: inputFormat, minDate: this.minToDate, maxDate: maxDate, small: small, maskChar: maskChar }, void 0) }), void 0)] }), void 0), _jsx("input", { hidden: true, "qa-testing": qaTestingLocator, onChange: this.handleHiddenInputChange }, void 0)] }), void 0));
|
206
194
|
}
|
207
195
|
formatDate(date, inputFormat = 'L') {
|
208
|
-
return date ? (
|
196
|
+
return date ? moment(date).format(inputFormat) : '';
|
209
197
|
}
|
210
198
|
get maxFromDate() {
|
211
199
|
const { disableRangeValidation, maxDate, field } = this.props;
|
@@ -231,26 +219,26 @@ let DateRangePicker = class DateRangePicker extends react_1.Component {
|
|
231
219
|
}
|
232
220
|
};
|
233
221
|
__decorate([
|
234
|
-
|
222
|
+
observable,
|
235
223
|
__metadata("design:type", Object)
|
236
224
|
], DateRangePicker.prototype, "wrapElem", void 0);
|
237
225
|
__decorate([
|
238
|
-
|
226
|
+
observable,
|
239
227
|
__metadata("design:type", Object)
|
240
228
|
], DateRangePicker.prototype, "showDatePicker", void 0);
|
241
229
|
__decorate([
|
242
|
-
|
230
|
+
action,
|
243
231
|
__metadata("design:type", Object)
|
244
232
|
], DateRangePicker.prototype, "handleRef", void 0);
|
245
233
|
__decorate([
|
246
|
-
|
234
|
+
action,
|
247
235
|
__metadata("design:type", Function),
|
248
236
|
__metadata("design:paramtypes", [Boolean]),
|
249
237
|
__metadata("design:returntype", void 0)
|
250
238
|
], DateRangePicker.prototype, "toggleShow", null);
|
251
239
|
DateRangePicker = __decorate([
|
252
|
-
|
240
|
+
observer,
|
253
241
|
__metadata("design:paramtypes", [Object])
|
254
242
|
], DateRangePicker);
|
255
|
-
|
243
|
+
export { DateRangePicker };
|
256
244
|
//# sourceMappingURL=date-range-picker.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"date-range-picker.js","sourceRoot":"","sources":["../../src/date-range-picker/date-range-picker.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"date-range-picker.js","sourceRoot":"","sources":["../../src/date-range-picker/date-range-picker.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAiB,SAAS,EAAkB,MAAM,OAAO,CAAC;AACjE,OAAO,EACH,eAAe,IAAI,oBAAoB,GAM1C,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,MAAM,MAAM,gCAAgC,CAAC;AA2BzD,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,SAA+B;IAQhE,YAAY,KAA2B;QACnC,KAAK,CAAC,KAAK,CAAC,CAAC;QARjB,iDAAiD;QACrC;;;;;WAAoC;QAChD;;;;mBAAY,KAAK;WAAC;QACN;;;;mBAAiB,KAAK;WAAC;QACnC;;;;mBAAgB,KAAK;WAAC;QACtB;;;;mBAA2B,KAAK;WAAC;QAQjC;;;;mBAAY,CAAC,QAAwB,EAAE,EAAE;gBACrC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC7B,CAAC;WAAC;QAOF;;;;mBAAoB,CAAC,GAAU,EAAE,EAAE;gBAC/B,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,YAAY,IAAI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AAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;SAC1C;QAED,OAAO,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,IAAI,CAAC;IAC3B,CAAC;CACJ,CAAA;AArQe;IAAX,UAAU;;iDAAqC;AAEpC;IAAX,UAAU;;uDAAwB;AAUnC;IADC,MAAM;;kDAGL;AAGF;IADC,MAAM;;;;iDAGN;AArBQ,eAAe;IAD3B,QAAQ;;GACI,eAAe,CAuQ3B;SAvQY,eAAe"}
|
@@ -4,6 +4,22 @@
|
|
4
4
|
min-width: 14em;
|
5
5
|
}
|
6
6
|
|
7
|
+
/*
|
8
|
+
* in case when date-range-picker is inside kendo table, calendar gets excessive paggings
|
9
|
+
* `padding: calc(8px - (calc(1.4285714286em + 10px + 0px) - 1.4285714286em)/ 2) 12px;`
|
10
|
+
*/
|
11
|
+
.date-range-picker :global(td) {
|
12
|
+
padding: var(--spacing-0) !important;
|
13
|
+
}
|
14
|
+
|
15
|
+
/*
|
16
|
+
* Anvil sets `pointer-events: none;` for icons that prohibits click event
|
17
|
+
*/
|
18
|
+
.date-range-picker .icon {
|
19
|
+
pointer-events: auto !important;
|
20
|
+
cursor: pointer !important;
|
21
|
+
}
|
22
|
+
|
7
23
|
.date-range-picker .date-range-picker-kendo {
|
8
24
|
width: 0;
|
9
25
|
white-space: nowrap;
|
@@ -1,14 +1,2 @@
|
|
1
|
-
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
-
}) : (function(o, m, k, k2) {
|
6
|
-
if (k2 === undefined) k2 = k;
|
7
|
-
o[k2] = m[k];
|
8
|
-
}));
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
11
|
-
};
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
13
|
-
__exportStar(require("./date-range-picker"), exports);
|
1
|
+
export * from './date-range-picker';
|
14
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/date-range-picker/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/date-range-picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
package/dist/date-range.js
CHANGED
@@ -1,19 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
const
|
8
|
-
const __1 = require("..");
|
9
|
-
const formstate_1 = require("formstate");
|
10
|
-
const Preview = ({ color, label }) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(design_system_1.Text, Object.assign({ size: 2, className: "m-t-3 m-b-1" }, { children: "Preview" }), void 0), (0, jsx_runtime_1.jsx)(design_system_1.Card, Object.assign({ light: true, padding: "none" }, { children: (0, jsx_runtime_1.jsx)(design_system_1.Tag, Object.assign({ color: color, className: "m-1-i" }, { children: label }), void 0) }), void 0)] }, void 0));
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Fragment, useRef, useMemo } from 'react';
|
3
|
+
import { observer } from 'mobx-react';
|
4
|
+
import { Text, Card, Tag } from '@servicetitan/design-system';
|
5
|
+
import { ColorPicker } from '..';
|
6
|
+
import { FieldState } from 'formstate';
|
7
|
+
const Preview = ({ color, label }) => (_jsxs(Fragment, { children: [_jsx(Text, Object.assign({ size: 2, className: "m-t-3 m-b-1" }, { children: "Preview" }), void 0), _jsx(Card, Object.assign({ light: true, padding: "none" }, { children: _jsx(Tag, Object.assign({ color: color, className: "m-1-i" }, { children: label }), void 0) }), void 0)] }, void 0));
|
11
8
|
function useColorField(initial) {
|
12
|
-
return
|
9
|
+
return useRef(new FieldState(initial)).current;
|
13
10
|
}
|
14
|
-
|
11
|
+
export const ColorPickerExample = observer(() => {
|
15
12
|
const defaultField = useColorField(undefined);
|
16
|
-
const preview =
|
17
|
-
return ((
|
13
|
+
const preview = useMemo(() => ({ color }) => _jsx(Preview, { label: "Confirmed Appointment", color: color }, void 0), []);
|
14
|
+
return (_jsxs(Fragment, { children: [_jsx(Text, Object.assign({ size: 4, className: "m-b-half" }, { children: "Default" }), void 0), _jsx(ColorPicker, { label: "Tag Color", value: defaultField.value, onChange: defaultField.onChange, preview: preview }, void 0)] }, void 0));
|
18
15
|
});
|
19
16
|
//# sourceMappingURL=color-picker.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"color-picker.js","sourceRoot":"","sources":["../../src/demo/color-picker.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"color-picker.js","sourceRoot":"","sources":["../../src/demo/color-picker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAM,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,WAAW,EAA2B,MAAM,IAAI,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAMvC,MAAM,OAAO,GAAqB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACpD,MAAC,QAAQ,eACL,KAAC,IAAI,kBAAC,IAAI,EAAE,CAAC,EAAE,SAAS,EAAC,aAAa,qCAE/B,EACP,KAAC,IAAI,kBAAC,KAAK,QAAC,OAAO,EAAC,MAAM,gBACtB,KAAC,GAAG,kBAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,OAAO,gBAC/B,KAAK,YACJ,YACH,YACA,CACd,CAAC;AAEF,SAAS,aAAa,CAA+B,OAAU;IAC3D,OAAO,MAAM,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AACnD,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAO,QAAQ,CAAC,GAAG,EAAE;IAChD,MAAM,YAAY,GAAG,aAAa,CAAqB,SAAS,CAAC,CAAC;IAElE,MAAM,OAAO,GAAgC,OAAO,CAChD,GAAG,EAAE,CACD,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACV,KAAC,OAAO,IAAC,KAAK,EAAC,uBAAuB,EAAC,KAAK,EAAE,KAAK,WAAI,EAC/D,EAAE,CACL,CAAC;IAEF,OAAO,CACH,MAAC,QAAQ,eACL,KAAC,IAAI,kBAAC,IAAI,EAAE,CAAC,EAAE,SAAS,EAAC,UAAU,qCAE5B,EACP,KAAC,WAAW,IACR,KAAK,EAAC,WAAW,EACjB,KAAK,EAAE,YAAY,CAAC,KAAK,EACzB,QAAQ,EAAE,YAAY,CAAC,QAAQ,EAC/B,OAAO,EAAE,OAAO,WAClB,YACK,CACd,CAAC;AACN,CAAC,CAAC,CAAC"}
|
@@ -1,17 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
const design_system_1 = require("@servicetitan/design-system");
|
8
|
-
const __1 = require("..");
|
9
|
-
const formstate_1 = require("formstate");
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Fragment, useRef } from 'react';
|
3
|
+
import { observer } from 'mobx-react';
|
4
|
+
import { Text } from '@servicetitan/design-system';
|
5
|
+
import { DateRangePicker } from '..';
|
6
|
+
import { FieldState } from 'formstate';
|
10
7
|
function useDateRangeField(initial) {
|
11
|
-
return
|
8
|
+
return useRef(new FieldState(initial)).current;
|
12
9
|
}
|
13
|
-
|
10
|
+
export const DateRangePickerExample = observer(() => {
|
14
11
|
const defaultField = useDateRangeField(undefined);
|
15
|
-
return ((
|
12
|
+
return (_jsxs(Fragment, { children: [_jsx(Text, Object.assign({ size: 4, className: "m-b-half" }, { children: "Default" }), void 0), _jsx(DateRangePicker, { maskChar: "X", field: defaultField, "qa-testing": "qa-date-range-picker", horizontalAlign: "right", small: true }, void 0)] }, void 0));
|
16
13
|
});
|
17
14
|
//# sourceMappingURL=date-range-picker.js.map
|