@threekit-tools/treble 0.0.81 → 0.0.84
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/dist/Treble/Treble.d.ts +11 -5
- package/dist/Treble/Treble.js +41 -12
- package/dist/Treble/index.d.ts +2 -2
- package/dist/Treble/index.js +7 -3
- package/dist/Treble/{Snapshots.d.ts → snapshots.d.ts} +4 -9
- package/dist/Treble/snapshots.js +247 -0
- package/dist/Treble/{Wishlist.d.ts → wishlist.d.ts} +2 -6
- package/dist/Treble/wishlist.js +135 -0
- package/dist/api/catalog.js +6 -6
- package/dist/api/configurations.js +3 -3
- package/dist/api/datatables.js +5 -5
- package/dist/api/index.js +5 -1
- package/dist/api/orders.d.ts +5 -7
- package/dist/api/orders.js +12 -12
- package/dist/api/price.js +2 -2
- package/dist/api/products.js +2 -2
- package/dist/components/Accordion/index.js +6 -7
- package/dist/components/AttributeTitle/index.d.ts +0 -9
- package/dist/components/AttributeTitle/index.js +0 -9
- package/dist/components/AttributeValue/index.d.ts +0 -6
- package/dist/components/AttributeValue/index.js +2 -8
- package/dist/components/Button/index.d.ts +0 -27
- package/dist/components/Button/index.js +0 -27
- package/dist/components/Cards/index.d.ts +2 -55
- package/dist/components/Cards/index.js +3 -60
- package/dist/components/Drawer/index.js +7 -16
- package/dist/components/Dropdown/index.d.ts +2 -59
- package/dist/components/Dropdown/index.js +11 -72
- package/dist/components/FlatForm/index.d.ts +0 -21
- package/dist/components/FlatForm/index.js +10 -25
- package/dist/components/Modal/index.js +2 -15
- package/dist/components/Player/index.d.ts +1 -1
- package/dist/components/PortalToArOverlay/index.js +5 -1
- package/dist/components/PortalToElement/index.js +0 -8
- package/dist/components/ProductDescription/index.d.ts +0 -6
- package/dist/components/ProductDescription/index.js +0 -6
- package/dist/components/ProductName/index.d.ts +0 -9
- package/dist/components/ProductName/index.js +0 -9
- package/dist/components/Share/index.d.ts +0 -12
- package/dist/components/Share/index.js +2 -14
- package/dist/components/Snapshots/index.d.ts +0 -8
- package/dist/components/Snapshots/index.js +2 -10
- package/dist/components/Strips/index.d.ts +2 -55
- package/dist/components/Strips/index.js +3 -60
- package/dist/components/Swatch/index.d.ts +2 -64
- package/dist/components/Swatch/index.js +3 -69
- package/dist/components/Switch/index.d.ts +2 -34
- package/dist/components/Switch/index.js +2 -38
- package/dist/components/Tabs/index.js +5 -1
- package/dist/components/TextInput/index.d.ts +2 -1
- package/dist/components/TextInput/index.js +2 -3
- package/dist/components/ThreekitProvider/index.js +5 -1
- package/dist/components/Tiles/index.d.ts +2 -29
- package/dist/components/Tiles/index.js +3 -33
- package/dist/components/TilesGroup/index.d.ts +2 -26
- package/dist/components/TilesGroup/index.js +3 -30
- package/dist/components/TotalPrice/index.d.ts +0 -6
- package/dist/components/TotalPrice/index.js +0 -6
- package/dist/components/TrebleApp/index.js +5 -1
- package/dist/components/Upload/index.d.ts +2 -1
- package/dist/components/Upload/index.js +21 -17
- package/dist/components/UploadArea/index.d.ts +2 -1
- package/dist/components/UploadArea/index.js +18 -15
- package/dist/components/Wishlist/index.d.ts +0 -3
- package/dist/components/Wishlist/index.js +12 -10
- package/dist/components/Zoom/index.d.ts +0 -17
- package/dist/components/Zoom/index.js +5 -21
- package/dist/components/formComponents.d.ts +12 -0
- package/dist/components/formComponents.js +10 -8
- package/dist/components/message/index.d.ts +0 -9
- package/dist/components/message/index.js +4 -31
- package/dist/connection.js +2 -2
- package/dist/constants.d.ts +0 -49
- package/dist/constants.js +1 -59
- package/dist/hooks/useAttribute/index.d.ts +1 -1
- package/dist/hooks/useAttribute/index.js +6 -6
- package/dist/hooks/useConfigurationLoader/index.js +5 -5
- package/dist/hooks/useNestedConfigurator/index.js +2 -2
- package/dist/hooks/useShare/index.js +3 -3
- package/dist/hooks/useSingleAnimation/index.js +20 -25
- package/dist/http/datatables.js +0 -1
- package/dist/http/index.js +5 -1
- package/dist/http/orders.d.ts +6 -8
- package/dist/icons/Spinner.js +5 -1
- package/dist/icons/index.d.ts +0 -41
- package/dist/icons/index.js +0 -42
- package/dist/index.d.ts +42 -3
- package/dist/index.js +84 -26
- package/dist/store/attributes.d.ts +0 -12
- package/dist/store/attributes.js +2 -15
- package/dist/store/index.d.ts +1 -1
- package/dist/store/price.d.ts +0 -12
- package/dist/store/price.js +2 -16
- package/dist/store/product.d.ts +6 -21
- package/dist/store/product.js +26 -38
- package/dist/store/translations.d.ts +1 -13
- package/dist/store/translations.js +2 -12
- package/dist/store/treble.d.ts +1 -16
- package/dist/store/treble.js +31 -66
- package/dist/store/wishlist.d.ts +0 -12
- package/dist/store/wishlist.js +4 -17
- package/dist/types.d.ts +118 -65
- package/dist/types.js +54 -0
- package/dist/utils.d.ts +10 -10
- package/dist/utils.js +8 -16
- package/package.json +16 -4
- package/dist/Treble/Snapshots.js +0 -251
- package/dist/Treble/Wishlist.js +0 -136
- package/dist/hooks/useImageEditor/index.d.ts +0 -14
- package/dist/hooks/useImageEditor/index.js +0 -320
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { ATTRIBUTE_TYPES } from '../../types';
|
|
3
4
|
import { IFormComponentProps, IOptionShared } from '../containers/formInputContainer';
|
|
4
5
|
export interface ITiles extends IFormComponentProps<IOptionShared> {
|
|
5
6
|
columns?: number;
|
|
@@ -7,46 +8,18 @@ export interface ITiles extends IFormComponentProps<IOptionShared> {
|
|
|
7
8
|
export declare const Tiles: {
|
|
8
9
|
(props: ITiles): JSX.Element;
|
|
9
10
|
propTypes: {
|
|
10
|
-
/**
|
|
11
|
-
* Is the attribute name on the initialized asset that we are
|
|
12
|
-
* using this component for. If the attribute prop is used,
|
|
13
|
-
* the component will ignore the props for: `value`, `options`, `onClick`.
|
|
14
|
-
*/
|
|
15
11
|
attribute: PropTypes.Requireable<string>;
|
|
16
|
-
/**
|
|
17
|
-
* Used to add a title to the input
|
|
18
|
-
*/
|
|
19
12
|
title: PropTypes.Requireable<string>;
|
|
20
|
-
/**
|
|
21
|
-
* Used to provide a custom description for the input component
|
|
22
|
-
*/
|
|
23
13
|
description: PropTypes.Requireable<string>;
|
|
24
|
-
/**
|
|
25
|
-
* Selected value from the option set. Should match the 'value' property
|
|
26
|
-
* of one of the items in the options array.
|
|
27
|
-
*/
|
|
28
14
|
value: PropTypes.Requireable<string>;
|
|
29
|
-
/**
|
|
30
|
-
* Handles the user seletion by passing the value of the selected
|
|
31
|
-
* option as the argument into the onClick callback.
|
|
32
|
-
*/
|
|
33
15
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
|
-
/**
|
|
35
|
-
* The options set to be displayed for the user
|
|
36
|
-
*/
|
|
37
16
|
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
38
17
|
name: PropTypes.Requireable<string>;
|
|
39
18
|
description: PropTypes.Requireable<string>;
|
|
40
19
|
value: PropTypes.Requireable<string>;
|
|
41
20
|
disabled: PropTypes.Requireable<boolean>;
|
|
42
21
|
}> | null | undefined)[]>;
|
|
43
|
-
/**
|
|
44
|
-
* Used to add a custom class name to each of the components html elements
|
|
45
|
-
*/
|
|
46
22
|
className: PropTypes.Requireable<string>;
|
|
47
|
-
/**
|
|
48
|
-
* Defines how many columns to organize the tiles into.
|
|
49
|
-
*/
|
|
50
23
|
columns: PropTypes.Requireable<number>;
|
|
51
24
|
};
|
|
52
25
|
defaultProps: {
|
|
@@ -60,7 +33,7 @@ export declare const Tiles: {
|
|
|
60
33
|
onClick: undefined;
|
|
61
34
|
};
|
|
62
35
|
componentName: string;
|
|
63
|
-
compatibleAttributes: Set<
|
|
36
|
+
compatibleAttributes: Set<ATTRIBUTE_TYPES>;
|
|
64
37
|
};
|
|
65
38
|
declare const _default: (props: ITiles) => JSX.Element | null;
|
|
66
39
|
export default _default;
|
|
@@ -11,7 +11,7 @@ var FormComponentDescription_1 = __importDefault(require("../FormComponentDescri
|
|
|
11
11
|
var tiles_styles_1 = require("./tiles.styles");
|
|
12
12
|
var shared_styles_1 = require("../shared.styles");
|
|
13
13
|
var utils_1 = require("../../utils");
|
|
14
|
-
var
|
|
14
|
+
var types_1 = require("../../types");
|
|
15
15
|
var formInputContainer_1 = __importDefault(require("../containers/formInputContainer"));
|
|
16
16
|
var Tiles = function (props) {
|
|
17
17
|
var _a = Object.assign({ columns: 2 }, props), title = _a.title, description = _a.description, options = _a.options, customClassName = _a.className, columns = _a.columns;
|
|
@@ -28,55 +28,25 @@ var Tiles = function (props) {
|
|
|
28
28
|
};
|
|
29
29
|
exports.Tiles = Tiles;
|
|
30
30
|
exports.Tiles.propTypes = {
|
|
31
|
-
/**
|
|
32
|
-
* Is the attribute name on the initialized asset that we are
|
|
33
|
-
* using this component for. If the attribute prop is used,
|
|
34
|
-
* the component will ignore the props for: `value`, `options`, `onClick`.
|
|
35
|
-
*/
|
|
36
31
|
attribute: prop_types_1.default.string,
|
|
37
|
-
/**
|
|
38
|
-
* Used to add a title to the input
|
|
39
|
-
*/
|
|
40
32
|
title: prop_types_1.default.string,
|
|
41
|
-
/**
|
|
42
|
-
* Used to provide a custom description for the input component
|
|
43
|
-
*/
|
|
44
33
|
description: prop_types_1.default.string,
|
|
45
|
-
/**
|
|
46
|
-
* Selected value from the option set. Should match the 'value' property
|
|
47
|
-
* of one of the items in the options array.
|
|
48
|
-
*/
|
|
49
34
|
value: prop_types_1.default.string,
|
|
50
|
-
/**
|
|
51
|
-
* Handles the user seletion by passing the value of the selected
|
|
52
|
-
* option as the argument into the onClick callback.
|
|
53
|
-
*/
|
|
54
35
|
onClick: prop_types_1.default.func,
|
|
55
|
-
/**
|
|
56
|
-
* The options set to be displayed for the user
|
|
57
|
-
*/
|
|
58
36
|
options: prop_types_1.default.arrayOf(prop_types_1.default.shape({
|
|
59
37
|
name: prop_types_1.default.string,
|
|
60
38
|
description: prop_types_1.default.string,
|
|
61
39
|
value: prop_types_1.default.string,
|
|
62
40
|
disabled: prop_types_1.default.bool,
|
|
63
41
|
})),
|
|
64
|
-
/**
|
|
65
|
-
* Used to add a custom class name to each of the components html elements
|
|
66
|
-
*/
|
|
67
42
|
className: prop_types_1.default.string,
|
|
68
|
-
/**
|
|
69
|
-
* Defines how many columns to organize the tiles into.
|
|
70
|
-
*/
|
|
71
43
|
columns: prop_types_1.default.number,
|
|
72
44
|
};
|
|
73
45
|
exports.Tiles.defaultProps = {
|
|
74
46
|
description: undefined,
|
|
75
47
|
className: undefined,
|
|
76
48
|
columns: 2,
|
|
77
|
-
// Default use
|
|
78
49
|
attribute: undefined,
|
|
79
|
-
// Custom use
|
|
80
50
|
title: undefined,
|
|
81
51
|
value: undefined,
|
|
82
52
|
options: undefined,
|
|
@@ -84,7 +54,7 @@ exports.Tiles.defaultProps = {
|
|
|
84
54
|
};
|
|
85
55
|
exports.Tiles.componentName = 'tiles';
|
|
86
56
|
exports.Tiles.compatibleAttributes = new Set([
|
|
87
|
-
|
|
88
|
-
|
|
57
|
+
types_1.ATTRIBUTE_TYPES.ASSET,
|
|
58
|
+
types_1.ATTRIBUTE_TYPES.STRING,
|
|
89
59
|
]);
|
|
90
60
|
exports.default = (0, formInputContainer_1.default)(exports.Tiles);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { ATTRIBUTE_TYPES } from '../../types';
|
|
3
4
|
import { IFormComponentProps, IOptionShared } from '../containers/formInputContainer';
|
|
4
5
|
export interface ITilesGroup extends IFormComponentProps<IOptionShared> {
|
|
5
6
|
columns?: number;
|
|
@@ -7,42 +8,17 @@ export interface ITilesGroup extends IFormComponentProps<IOptionShared> {
|
|
|
7
8
|
export declare const TilesGroup: {
|
|
8
9
|
(props: ITilesGroup): JSX.Element;
|
|
9
10
|
propTypes: {
|
|
10
|
-
/**
|
|
11
|
-
* Is the attribute name on the initialized asset that we are
|
|
12
|
-
* using this component for. If the attribute prop is used,
|
|
13
|
-
* the component will ignore the props for: `value`, `options`, `onClick`.
|
|
14
|
-
*/
|
|
15
11
|
attribute: PropTypes.Requireable<string>;
|
|
16
|
-
/**
|
|
17
|
-
* Used to add a title to the input
|
|
18
|
-
*/
|
|
19
12
|
title: PropTypes.Requireable<string>;
|
|
20
|
-
/**
|
|
21
|
-
* Used to provide a custom description for the input component
|
|
22
|
-
*/
|
|
23
13
|
description: PropTypes.Requireable<string>;
|
|
24
|
-
/**
|
|
25
|
-
* Selected value from the option set. Should match the 'value' property
|
|
26
|
-
* of one of the items in the options array.
|
|
27
|
-
*/
|
|
28
14
|
value: PropTypes.Requireable<string>;
|
|
29
|
-
/**
|
|
30
|
-
* Handles the user seletion by passing the value of the selected
|
|
31
|
-
* option as the argument into the onClick callback.
|
|
32
|
-
*/
|
|
33
15
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
|
-
/**
|
|
35
|
-
* The options set to be displayed for the user
|
|
36
|
-
*/
|
|
37
16
|
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
38
17
|
name: PropTypes.Requireable<string>;
|
|
39
18
|
description: PropTypes.Requireable<string>;
|
|
40
19
|
value: PropTypes.Requireable<string>;
|
|
41
20
|
disabled: PropTypes.Requireable<boolean>;
|
|
42
21
|
}> | null | undefined)[]>;
|
|
43
|
-
/**
|
|
44
|
-
* Used to add a custom class name to each of the components html elements
|
|
45
|
-
*/
|
|
46
22
|
className: PropTypes.Requireable<string>;
|
|
47
23
|
};
|
|
48
24
|
defaultProps: {
|
|
@@ -55,7 +31,7 @@ export declare const TilesGroup: {
|
|
|
55
31
|
onClick: undefined;
|
|
56
32
|
};
|
|
57
33
|
componentName: string;
|
|
58
|
-
compatibleAttributes: Set<
|
|
34
|
+
compatibleAttributes: Set<ATTRIBUTE_TYPES>;
|
|
59
35
|
};
|
|
60
36
|
declare const _default: (props: ITilesGroup) => JSX.Element | null;
|
|
61
37
|
export default _default;
|
|
@@ -11,7 +11,7 @@ var FormComponentDescription_1 = __importDefault(require("../FormComponentDescri
|
|
|
11
11
|
var tilesGroup_styles_1 = require("./tilesGroup.styles");
|
|
12
12
|
var shared_styles_1 = require("../shared.styles");
|
|
13
13
|
var utils_1 = require("../../utils");
|
|
14
|
-
var
|
|
14
|
+
var types_1 = require("../../types");
|
|
15
15
|
var formInputContainer_1 = __importDefault(require("../containers/formInputContainer"));
|
|
16
16
|
var TilesGroup = function (props) {
|
|
17
17
|
var _a = Object.assign({ stretch: true }, props), stretch = _a.stretch, title = _a.title, description = _a.description, options = _a.options, customClassName = _a.className;
|
|
@@ -28,50 +28,23 @@ var TilesGroup = function (props) {
|
|
|
28
28
|
};
|
|
29
29
|
exports.TilesGroup = TilesGroup;
|
|
30
30
|
exports.TilesGroup.propTypes = {
|
|
31
|
-
/**
|
|
32
|
-
* Is the attribute name on the initialized asset that we are
|
|
33
|
-
* using this component for. If the attribute prop is used,
|
|
34
|
-
* the component will ignore the props for: `value`, `options`, `onClick`.
|
|
35
|
-
*/
|
|
36
31
|
attribute: prop_types_1.default.string,
|
|
37
|
-
/**
|
|
38
|
-
* Used to add a title to the input
|
|
39
|
-
*/
|
|
40
32
|
title: prop_types_1.default.string,
|
|
41
|
-
/**
|
|
42
|
-
* Used to provide a custom description for the input component
|
|
43
|
-
*/
|
|
44
33
|
description: prop_types_1.default.string,
|
|
45
|
-
/**
|
|
46
|
-
* Selected value from the option set. Should match the 'value' property
|
|
47
|
-
* of one of the items in the options array.
|
|
48
|
-
*/
|
|
49
34
|
value: prop_types_1.default.string,
|
|
50
|
-
/**
|
|
51
|
-
* Handles the user seletion by passing the value of the selected
|
|
52
|
-
* option as the argument into the onClick callback.
|
|
53
|
-
*/
|
|
54
35
|
onClick: prop_types_1.default.func,
|
|
55
|
-
/**
|
|
56
|
-
* The options set to be displayed for the user
|
|
57
|
-
*/
|
|
58
36
|
options: prop_types_1.default.arrayOf(prop_types_1.default.shape({
|
|
59
37
|
name: prop_types_1.default.string,
|
|
60
38
|
description: prop_types_1.default.string,
|
|
61
39
|
value: prop_types_1.default.string,
|
|
62
40
|
disabled: prop_types_1.default.bool,
|
|
63
41
|
})),
|
|
64
|
-
/**
|
|
65
|
-
* Used to add a custom class name to each of the components html elements
|
|
66
|
-
*/
|
|
67
42
|
className: prop_types_1.default.string,
|
|
68
43
|
};
|
|
69
44
|
exports.TilesGroup.defaultProps = {
|
|
70
45
|
description: undefined,
|
|
71
46
|
className: undefined,
|
|
72
|
-
// Default use
|
|
73
47
|
attribute: undefined,
|
|
74
|
-
// Custom use
|
|
75
48
|
title: undefined,
|
|
76
49
|
value: undefined,
|
|
77
50
|
options: undefined,
|
|
@@ -79,7 +52,7 @@ exports.TilesGroup.defaultProps = {
|
|
|
79
52
|
};
|
|
80
53
|
exports.TilesGroup.componentName = 'tiles-group';
|
|
81
54
|
exports.TilesGroup.compatibleAttributes = new Set([
|
|
82
|
-
|
|
83
|
-
|
|
55
|
+
types_1.ATTRIBUTE_TYPES.ASSET,
|
|
56
|
+
types_1.ATTRIBUTE_TYPES.STRING,
|
|
84
57
|
]);
|
|
85
58
|
exports.default = (0, formInputContainer_1.default)(exports.TilesGroup);
|
|
@@ -7,13 +7,7 @@ interface IPrice {
|
|
|
7
7
|
export declare const TotalPriceComponent: {
|
|
8
8
|
(props: IPrice): JSX.Element;
|
|
9
9
|
propTypes: {
|
|
10
|
-
/**
|
|
11
|
-
* The price displayed to the user
|
|
12
|
-
*/
|
|
13
10
|
price: PropTypes.Requireable<string>;
|
|
14
|
-
/**
|
|
15
|
-
* Custom classNames applied to the HTML Element to apply custom CSS styling.
|
|
16
|
-
*/
|
|
17
11
|
className: PropTypes.Requireable<string>;
|
|
18
12
|
};
|
|
19
13
|
defaultProps: {
|
|
@@ -27,13 +27,7 @@ var TotalPrice = function (props) {
|
|
|
27
27
|
};
|
|
28
28
|
exports.TotalPrice = TotalPrice;
|
|
29
29
|
exports.TotalPriceComponent.propTypes = {
|
|
30
|
-
/**
|
|
31
|
-
* The price displayed to the user
|
|
32
|
-
*/
|
|
33
30
|
price: prop_types_1.default.string,
|
|
34
|
-
/**
|
|
35
|
-
* Custom classNames applied to the HTML Element to apply custom CSS styling.
|
|
36
|
-
*/
|
|
37
31
|
className: prop_types_1.default.string,
|
|
38
32
|
};
|
|
39
33
|
exports.TotalPriceComponent.defaultProps = {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ATTRIBUTE_TYPES } from '../../types';
|
|
2
3
|
import { IFormComponentProps, IOptionShared } from '../containers/formInputContainer';
|
|
3
4
|
export interface IUpload extends Pick<IFormComponentProps<IOptionShared>, 'title' | 'description' | 'className' | 'value'> {
|
|
4
5
|
onChange: (file: File | undefined) => Promise<void>;
|
|
@@ -6,7 +7,7 @@ export interface IUpload extends Pick<IFormComponentProps<IOptionShared>, 'title
|
|
|
6
7
|
export declare const Upload: {
|
|
7
8
|
(props: IUpload): JSX.Element;
|
|
8
9
|
componentName: string;
|
|
9
|
-
compatibleAttributes: Set<
|
|
10
|
+
compatibleAttributes: Set<ATTRIBUTE_TYPES>;
|
|
10
11
|
};
|
|
11
12
|
declare const _default: (props: IUpload) => JSX.Element | null;
|
|
12
13
|
export default _default;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -60,18 +64,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
60
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
65
|
exports.Upload = void 0;
|
|
62
66
|
var react_1 = __importStar(require("react"));
|
|
63
|
-
var constants_1 = require("../../constants");
|
|
64
67
|
var FormComponentTitle_1 = __importDefault(require("../FormComponentTitle"));
|
|
65
68
|
var FormComponentDescription_1 = __importDefault(require("../FormComponentDescription"));
|
|
66
69
|
var shared_styles_1 = require("../shared.styles");
|
|
70
|
+
var types_1 = require("../../types");
|
|
67
71
|
var utils_1 = require("../../utils");
|
|
68
|
-
var
|
|
72
|
+
var Spinner_1 = __importDefault(require("../../icons/Spinner"));
|
|
73
|
+
var Add_1 = __importDefault(require("../../icons/Add"));
|
|
74
|
+
var Delete_1 = __importDefault(require("../../icons/Delete"));
|
|
69
75
|
var formInputContainer_1 = __importDefault(require("../containers/formInputContainer"));
|
|
70
76
|
var upload_styles_1 = require("./upload.styles");
|
|
71
77
|
var Upload = function (props) {
|
|
72
|
-
var _a, _b;
|
|
73
78
|
var title = props.title, description = props.description, value = props.value, onChange = props.onChange, customClassName = props.className;
|
|
74
|
-
var
|
|
79
|
+
var _a = (0, react_1.useState)(false), isUploading = _a[0], setIsUploading = _a[1];
|
|
75
80
|
var inputRef = (0, react_1.useRef)(null);
|
|
76
81
|
var imgRef = (0, react_1.useRef)(null);
|
|
77
82
|
var cls = (0, utils_1.generateInputClassName)('upload', customClassName, title);
|
|
@@ -89,41 +94,40 @@ var Upload = function (props) {
|
|
|
89
94
|
switch (_a.label) {
|
|
90
95
|
case 0:
|
|
91
96
|
setIsUploading(true);
|
|
92
|
-
return [4
|
|
97
|
+
return [4, onChange(file)];
|
|
93
98
|
case 1:
|
|
94
99
|
_a.sent();
|
|
95
100
|
setIsUploading(false);
|
|
96
101
|
if (!file)
|
|
97
|
-
return [2
|
|
102
|
+
return [2];
|
|
98
103
|
reader = new FileReader();
|
|
99
104
|
reader.onload = function () {
|
|
100
105
|
if (!imgRef.current)
|
|
101
106
|
return;
|
|
102
|
-
// @ts-ignore
|
|
103
107
|
imgRef.current.src = reader.result;
|
|
104
108
|
};
|
|
105
109
|
reader.readAsDataURL(file);
|
|
106
|
-
return [2
|
|
110
|
+
return [2];
|
|
107
111
|
}
|
|
108
112
|
});
|
|
109
113
|
}); };
|
|
110
114
|
return (react_1.default.createElement(shared_styles_1.FormComponentWrapper, null,
|
|
111
115
|
react_1.default.createElement(FormComponentTitle_1.default, { title: title, className: cls }),
|
|
112
116
|
react_1.default.createElement(FormComponentDescription_1.default, { description: description, className: cls }),
|
|
113
|
-
react_1.default.createElement(upload_styles_1.UploadWrapper, { className: cls, uploaded: !!(!isUploading && (
|
|
117
|
+
react_1.default.createElement(upload_styles_1.UploadWrapper, { className: cls, uploaded: !!(!isUploading && (value === null || value === void 0 ? void 0 : value.length)) },
|
|
114
118
|
react_1.default.createElement("input", { type: "file", ref: inputRef, onChange: function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
|
115
119
|
var _a;
|
|
116
120
|
return __generator(this, function (_b) {
|
|
117
121
|
if (!((_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0]) || !onChange)
|
|
118
|
-
return [2
|
|
122
|
+
return [2];
|
|
119
123
|
handleUpload(e.target.files[0]);
|
|
120
|
-
return [2
|
|
124
|
+
return [2];
|
|
121
125
|
});
|
|
122
126
|
}); } }),
|
|
123
127
|
react_1.default.createElement("button", { type: "button", onClick: handleClick }, isUploading ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
124
128
|
react_1.default.createElement(upload_styles_1.IconWrapper, null,
|
|
125
|
-
react_1.default.createElement(
|
|
126
|
-
react_1.default.createElement("div", null, "Uploading..."))) : (
|
|
129
|
+
react_1.default.createElement(Spinner_1.default, { size: "28px" })),
|
|
130
|
+
react_1.default.createElement("div", null, "Uploading..."))) : (value === null || value === void 0 ? void 0 : value.length) ? (react_1.default.createElement(upload_styles_1.ImageWrapper, null,
|
|
127
131
|
react_1.default.createElement("div", null,
|
|
128
132
|
react_1.default.createElement("img", { ref: imgRef, src: "#" })),
|
|
129
133
|
react_1.default.createElement(upload_styles_1.ImageActionArea, null,
|
|
@@ -131,12 +135,12 @@ var Upload = function (props) {
|
|
|
131
135
|
handleUpload(undefined);
|
|
132
136
|
e.stopPropagation();
|
|
133
137
|
} },
|
|
134
|
-
react_1.default.createElement(
|
|
138
|
+
react_1.default.createElement(Delete_1.default, null))))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
135
139
|
react_1.default.createElement(upload_styles_1.IconWrapper, null,
|
|
136
|
-
react_1.default.createElement(
|
|
140
|
+
react_1.default.createElement(Add_1.default, null)),
|
|
137
141
|
react_1.default.createElement("div", null, "Upload")))))));
|
|
138
142
|
};
|
|
139
143
|
exports.Upload = Upload;
|
|
140
144
|
exports.Upload.componentName = 'upload';
|
|
141
|
-
exports.Upload.compatibleAttributes = new Set([
|
|
145
|
+
exports.Upload.compatibleAttributes = new Set([types_1.ATTRIBUTE_TYPES.ASSET]);
|
|
142
146
|
exports.default = (0, formInputContainer_1.default)(exports.Upload);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ATTRIBUTE_TYPES } from '../../types';
|
|
2
3
|
import { IFormComponentProps, IOptionShared } from '../containers/formInputContainer';
|
|
3
4
|
export interface IUpload extends Pick<IFormComponentProps<IOptionShared>, 'title' | 'description' | 'className' | 'value'> {
|
|
4
5
|
onChange: (file: File) => Promise<void>;
|
|
@@ -6,7 +7,7 @@ export interface IUpload extends Pick<IFormComponentProps<IOptionShared>, 'title
|
|
|
6
7
|
export declare const UploadArea: {
|
|
7
8
|
(props: IUpload): JSX.Element;
|
|
8
9
|
componentName: string;
|
|
9
|
-
compatibleAttributes: Set<
|
|
10
|
+
compatibleAttributes: Set<ATTRIBUTE_TYPES>;
|
|
10
11
|
};
|
|
11
12
|
declare const _default: (props: IUpload) => JSX.Element | null;
|
|
12
13
|
export default _default;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -60,19 +64,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
60
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
65
|
exports.UploadArea = void 0;
|
|
62
66
|
var react_1 = __importStar(require("react"));
|
|
63
|
-
var constants_1 = require("../../constants");
|
|
64
67
|
var FormComponentTitle_1 = __importDefault(require("../FormComponentTitle"));
|
|
65
68
|
var FormComponentDescription_1 = __importDefault(require("../FormComponentDescription"));
|
|
66
69
|
var shared_styles_1 = require("../shared.styles");
|
|
70
|
+
var types_1 = require("../../types");
|
|
67
71
|
var utils_1 = require("../../utils");
|
|
68
|
-
var
|
|
72
|
+
var Spinner_1 = __importDefault(require("../../icons/Spinner"));
|
|
73
|
+
var Image_1 = __importDefault(require("../../icons/Image"));
|
|
69
74
|
var formInputContainer_1 = __importDefault(require("../containers/formInputContainer"));
|
|
70
75
|
var uploadArea_styles_1 = require("./uploadArea.styles");
|
|
71
76
|
var UploadArea = function (props) {
|
|
72
|
-
var _a;
|
|
73
77
|
var title = props.title, description = props.description, value = props.value, onChange = props.onChange, customClassName = props.className;
|
|
74
|
-
var
|
|
75
|
-
var
|
|
78
|
+
var _a = (0, react_1.useState)(false), isUploading = _a[0], setIsUploading = _a[1];
|
|
79
|
+
var _b = (0, react_1.useState)(undefined), filename = _b[0], setFilename = _b[1];
|
|
76
80
|
var inputRef = (0, react_1.useRef)(null);
|
|
77
81
|
var imgRef = (0, react_1.useRef)(null);
|
|
78
82
|
var cls = (0, utils_1.generateInputClassName)('upload', customClassName, title);
|
|
@@ -88,7 +92,7 @@ var UploadArea = function (props) {
|
|
|
88
92
|
switch (_a.label) {
|
|
89
93
|
case 0:
|
|
90
94
|
setIsUploading(true);
|
|
91
|
-
return [4
|
|
95
|
+
return [4, onChange(file)];
|
|
92
96
|
case 1:
|
|
93
97
|
_a.sent();
|
|
94
98
|
setIsUploading(false);
|
|
@@ -97,11 +101,10 @@ var UploadArea = function (props) {
|
|
|
97
101
|
reader.onload = function () {
|
|
98
102
|
if (!imgRef.current)
|
|
99
103
|
return;
|
|
100
|
-
// @ts-ignore
|
|
101
104
|
imgRef.current.src = reader.result;
|
|
102
105
|
};
|
|
103
106
|
reader.readAsDataURL(file);
|
|
104
|
-
return [2
|
|
107
|
+
return [2];
|
|
105
108
|
}
|
|
106
109
|
});
|
|
107
110
|
}); };
|
|
@@ -113,26 +116,26 @@ var UploadArea = function (props) {
|
|
|
113
116
|
var _a;
|
|
114
117
|
return __generator(this, function (_b) {
|
|
115
118
|
if (!((_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0]) || !onChange)
|
|
116
|
-
return [2
|
|
119
|
+
return [2];
|
|
117
120
|
handleUpload(e.target.files[0]);
|
|
118
|
-
return [2
|
|
121
|
+
return [2];
|
|
119
122
|
});
|
|
120
123
|
}); } }),
|
|
121
124
|
react_1.default.createElement("button", { type: "button", onClick: handleClick }, isUploading ? (react_1.default.createElement(uploadArea_styles_1.UploadingWrapper, null,
|
|
122
125
|
react_1.default.createElement("div", null,
|
|
123
|
-
react_1.default.createElement(
|
|
124
|
-
react_1.default.createElement("div", null, "Uploading..."))) : (
|
|
126
|
+
react_1.default.createElement(Spinner_1.default, { size: "28px" })),
|
|
127
|
+
react_1.default.createElement("div", null, "Uploading..."))) : (value === null || value === void 0 ? void 0 : value.length) ? (react_1.default.createElement(uploadArea_styles_1.UploadingWrapper, null,
|
|
125
128
|
react_1.default.createElement("div", null,
|
|
126
129
|
react_1.default.createElement("img", { ref: imgRef, src: "#" })),
|
|
127
130
|
react_1.default.createElement("div", null,
|
|
128
131
|
react_1.default.createElement("div", null, filename),
|
|
129
132
|
react_1.default.createElement("div", null, "Upload another file.")))) : (react_1.default.createElement("div", null,
|
|
130
133
|
react_1.default.createElement("div", null,
|
|
131
|
-
react_1.default.createElement(
|
|
134
|
+
react_1.default.createElement(Image_1.default, null)),
|
|
132
135
|
react_1.default.createElement("div", null, "Click to upload"),
|
|
133
136
|
react_1.default.createElement("div", null, "Supported file types: PNG, JPEG, SVG")))))));
|
|
134
137
|
};
|
|
135
138
|
exports.UploadArea = UploadArea;
|
|
136
139
|
exports.UploadArea.componentName = 'upload-area';
|
|
137
|
-
exports.UploadArea.compatibleAttributes = new Set([
|
|
140
|
+
exports.UploadArea.compatibleAttributes = new Set([types_1.ATTRIBUTE_TYPES.ASSET]);
|
|
138
141
|
exports.default = (0, formInputContainer_1.default)(exports.UploadArea);
|
|
@@ -19,9 +19,6 @@ export declare const WishlistButton: (props: WidgetButtonProps) => JSX.Element;
|
|
|
19
19
|
export declare const Wishlist: {
|
|
20
20
|
(props: WishlistProps): JSX.Element | null;
|
|
21
21
|
propTypes: {
|
|
22
|
-
/**
|
|
23
|
-
* Custom classNames applied to the HTML Element to apply custom CSS styling.
|
|
24
|
-
*/
|
|
25
22
|
className: PropTypes.Requireable<string>;
|
|
26
23
|
};
|
|
27
24
|
defaultProps: {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -61,7 +65,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
61
65
|
exports.Wishlist = exports.WishlistButton = exports.AddWishlistButton = void 0;
|
|
62
66
|
var react_1 = __importStar(require("react"));
|
|
63
67
|
var prop_types_1 = __importDefault(require("prop-types"));
|
|
64
|
-
var
|
|
68
|
+
var Heart_1 = __importDefault(require("../../icons/Heart"));
|
|
69
|
+
var Wishlist_1 = __importDefault(require("../../icons/Wishlist"));
|
|
65
70
|
var Button_1 = require("../Button");
|
|
66
71
|
var Drawer_1 = __importDefault(require("../Drawer"));
|
|
67
72
|
var shared_styles_1 = require("../shared.styles");
|
|
@@ -71,12 +76,12 @@ var wishlist_styles_1 = require("./wishlist.styles");
|
|
|
71
76
|
var useWishlist_1 = __importDefault(require("../../hooks/useWishlist"));
|
|
72
77
|
var AddWishlistButton = function (props) {
|
|
73
78
|
var title = props.title, type = props.type, shape = props.shape, className = props.className, onClick = props.onClick;
|
|
74
|
-
return (react_1.default.createElement(Button_1.Button, { title: title, icon:
|
|
79
|
+
return (react_1.default.createElement(Button_1.Button, { title: title, icon: Heart_1.default.iconName, className: className, onClick: onClick, type: type, shape: shape }));
|
|
75
80
|
};
|
|
76
81
|
exports.AddWishlistButton = AddWishlistButton;
|
|
77
82
|
var WishlistButton = function (props) {
|
|
78
83
|
var title = props.title, type = props.type, shape = props.shape, className = props.className, onClick = props.onClick;
|
|
79
|
-
return (react_1.default.createElement(Button_1.Button, { title: title, icon:
|
|
84
|
+
return (react_1.default.createElement(Button_1.Button, { title: title, icon: Wishlist_1.default.iconName, className: className, onClick: onClick, type: type, shape: shape }));
|
|
80
85
|
};
|
|
81
86
|
exports.WishlistButton = WishlistButton;
|
|
82
87
|
var Wishlist = function (props) {
|
|
@@ -91,11 +96,11 @@ var Wishlist = function (props) {
|
|
|
91
96
|
var handleAddToWishlist = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
92
97
|
return __generator(this, function (_a) {
|
|
93
98
|
switch (_a.label) {
|
|
94
|
-
case 0: return [4
|
|
99
|
+
case 0: return [4, addToWishlist()];
|
|
95
100
|
case 1:
|
|
96
101
|
_a.sent();
|
|
97
102
|
setShowWishlist(true);
|
|
98
|
-
return [2
|
|
103
|
+
return [2];
|
|
99
104
|
}
|
|
100
105
|
});
|
|
101
106
|
}); };
|
|
@@ -111,9 +116,6 @@ var Wishlist = function (props) {
|
|
|
111
116
|
};
|
|
112
117
|
exports.Wishlist = Wishlist;
|
|
113
118
|
exports.Wishlist.propTypes = {
|
|
114
|
-
/**
|
|
115
|
-
* Custom classNames applied to the HTML Element to apply custom CSS styling.
|
|
116
|
-
*/
|
|
117
119
|
className: prop_types_1.default.string,
|
|
118
120
|
};
|
|
119
121
|
exports.Wishlist.defaultProps = {
|
|
@@ -122,5 +124,5 @@ exports.Wishlist.defaultProps = {
|
|
|
122
124
|
type: 'threekit',
|
|
123
125
|
};
|
|
124
126
|
exports.Wishlist.componentName = 'wishlist';
|
|
125
|
-
exports.Wishlist.Icon =
|
|
127
|
+
exports.Wishlist.Icon = Wishlist_1.default;
|
|
126
128
|
exports.default = exports.Wishlist;
|
|
@@ -15,27 +15,10 @@ export declare const ZoomInComponent: (props: ZoomComponentProps) => JSX.Element
|
|
|
15
15
|
export declare const Zoom: {
|
|
16
16
|
(props: ZoomProps): JSX.Element;
|
|
17
17
|
propTypes: {
|
|
18
|
-
/**
|
|
19
|
-
* The number of steps, for both zoom-in and out, that we want to increment the zoom by.
|
|
20
|
-
*/
|
|
21
18
|
step: PropTypes.Requireable<number>;
|
|
22
|
-
/**
|
|
23
|
-
* Used to the set the orientation/alignment of the buttons.
|
|
24
|
-
*/
|
|
25
19
|
orientation: PropTypes.Requireable<string>;
|
|
26
|
-
/**
|
|
27
|
-
* Custom classNames applied to the HTML Element to apply custom CSS styling.
|
|
28
|
-
*/
|
|
29
20
|
className: PropTypes.Requireable<string>;
|
|
30
|
-
/**
|
|
31
|
-
* The presentational type of the input component. Options
|
|
32
|
-
* include: `hollow`, `standard`, `accent`, `primary`
|
|
33
|
-
*/
|
|
34
21
|
type: PropTypes.Requireable<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Used to set the shape of the Widget button. Options
|
|
37
|
-
* include: `square`, `round`
|
|
38
|
-
*/
|
|
39
22
|
shape: PropTypes.Requireable<string>;
|
|
40
23
|
};
|
|
41
24
|
defaultProps: {
|