@threekit-tools/treble 0.0.82 → 0.0.85-next-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/Treble/Treble.d.ts +15 -6
  2. package/dist/Treble/Treble.js +58 -20
  3. package/dist/Treble/index.d.ts +2 -2
  4. package/dist/Treble/index.js +2 -2
  5. package/dist/Treble/{Snapshots.d.ts → snapshots.d.ts} +4 -9
  6. package/dist/Treble/snapshots.js +247 -0
  7. package/dist/Treble/{Wishlist.d.ts → wishlist.d.ts} +2 -6
  8. package/dist/Treble/wishlist.js +135 -0
  9. package/dist/api/catalog.js +6 -6
  10. package/dist/api/configurations.d.ts +2 -0
  11. package/dist/api/configurations.js +7 -5
  12. package/dist/api/datatables.js +5 -5
  13. package/dist/api/files.d.ts +1 -0
  14. package/dist/api/files.js +63 -0
  15. package/dist/api/index.d.ts +2 -0
  16. package/dist/api/index.js +2 -0
  17. package/dist/api/orders.d.ts +5 -7
  18. package/dist/api/orders.js +12 -12
  19. package/dist/api/price.js +2 -2
  20. package/dist/api/products.js +2 -2
  21. package/dist/components/Accordion/index.js +1 -6
  22. package/dist/components/AttributeTitle/index.d.ts +0 -9
  23. package/dist/components/AttributeTitle/index.js +0 -9
  24. package/dist/components/AttributeValue/index.d.ts +0 -6
  25. package/dist/components/AttributeValue/index.js +2 -8
  26. package/dist/components/Button/index.d.ts +0 -27
  27. package/dist/components/Button/index.js +0 -27
  28. package/dist/components/Cards/index.d.ts +2 -55
  29. package/dist/components/Cards/index.js +3 -60
  30. package/dist/components/Drawer/index.js +0 -13
  31. package/dist/components/Dropdown/index.d.ts +2 -59
  32. package/dist/components/Dropdown/index.js +4 -69
  33. package/dist/components/FlatForm/index.d.ts +0 -21
  34. package/dist/components/FlatForm/index.js +5 -24
  35. package/dist/components/Modal/index.js +0 -13
  36. package/dist/components/Player/index.d.ts +1 -1
  37. package/dist/components/PortalToElement/index.js +0 -8
  38. package/dist/components/ProductDescription/index.d.ts +0 -6
  39. package/dist/components/ProductDescription/index.js +0 -6
  40. package/dist/components/ProductName/index.d.ts +0 -9
  41. package/dist/components/ProductName/index.js +0 -9
  42. package/dist/components/Share/index.d.ts +4 -12
  43. package/dist/components/Share/index.js +143 -21
  44. package/dist/components/Share/share.styles.d.ts +9 -0
  45. package/dist/components/Share/share.styles.js +23 -0
  46. package/dist/components/Snapshots/index.d.ts +0 -8
  47. package/dist/components/Snapshots/index.js +0 -8
  48. package/dist/components/Strips/index.d.ts +2 -55
  49. package/dist/components/Strips/index.js +3 -60
  50. package/dist/components/Swatch/index.d.ts +2 -64
  51. package/dist/components/Swatch/index.js +3 -69
  52. package/dist/components/Switch/index.d.ts +2 -34
  53. package/dist/components/Switch/index.js +2 -38
  54. package/dist/components/TextInput/index.d.ts +2 -1
  55. package/dist/components/TextInput/index.js +2 -3
  56. package/dist/components/Tiles/index.d.ts +2 -29
  57. package/dist/components/Tiles/index.js +3 -33
  58. package/dist/components/TilesGroup/index.d.ts +2 -26
  59. package/dist/components/TilesGroup/index.js +3 -30
  60. package/dist/components/TotalPrice/index.d.ts +0 -6
  61. package/dist/components/TotalPrice/index.js +0 -6
  62. package/dist/components/Upload/index.d.ts +2 -1
  63. package/dist/components/Upload/index.js +7 -8
  64. package/dist/components/UploadArea/index.d.ts +2 -1
  65. package/dist/components/UploadArea/index.js +6 -7
  66. package/dist/components/Wishlist/index.d.ts +1 -4
  67. package/dist/components/Wishlist/index.js +2 -5
  68. package/dist/components/Zoom/index.d.ts +1 -18
  69. package/dist/components/Zoom/index.js +0 -17
  70. package/dist/components/formComponents.d.ts +12 -0
  71. package/dist/components/formComponents.js +5 -7
  72. package/dist/components/message/index.d.ts +0 -9
  73. package/dist/components/message/index.js +0 -9
  74. package/dist/connection.js +2 -2
  75. package/dist/constants.d.ts +0 -49
  76. package/dist/constants.js +1 -59
  77. package/dist/hooks/useAttribute/index.js +6 -6
  78. package/dist/hooks/useConfigurationLoader/index.js +5 -5
  79. package/dist/hooks/useNestedConfigurator/index.js +2 -2
  80. package/dist/hooks/useShare/index.js +3 -3
  81. package/dist/hooks/useSingleAnimation/index.js +20 -25
  82. package/dist/http/configurations.d.ts +1 -0
  83. package/dist/http/datatables.js +0 -1
  84. package/dist/http/files.d.ts +21 -0
  85. package/dist/http/files.js +26 -0
  86. package/dist/http/index.d.ts +2 -0
  87. package/dist/http/index.js +2 -0
  88. package/dist/http/orders.d.ts +6 -8
  89. package/dist/icons/index.d.ts +0 -41
  90. package/dist/icons/index.js +0 -42
  91. package/dist/index.d.ts +42 -3
  92. package/dist/index.js +84 -30
  93. package/dist/store/attributes.d.ts +0 -12
  94. package/dist/store/attributes.js +2 -15
  95. package/dist/store/price.d.ts +0 -12
  96. package/dist/store/price.js +2 -16
  97. package/dist/store/product.d.ts +2 -17
  98. package/dist/store/product.js +26 -38
  99. package/dist/store/translations.d.ts +0 -12
  100. package/dist/store/translations.js +2 -12
  101. package/dist/store/treble.d.ts +1 -15
  102. package/dist/store/treble.js +34 -68
  103. package/dist/store/wishlist.d.ts +0 -12
  104. package/dist/store/wishlist.js +4 -17
  105. package/dist/types.d.ts +73 -58
  106. package/dist/types.js +54 -0
  107. package/dist/utils.d.ts +2 -2
  108. package/dist/utils.js +8 -16
  109. package/package.json +20 -4
  110. package/dist/Treble/Snapshots.js +0 -251
  111. package/dist/Treble/Wishlist.js +0 -136
@@ -1,45 +1,166 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
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);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __generator = (this && this.__generator) || function (thisArg, body) {
35
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
+ function verb(n) { return function (v) { return step([n, v]); }; }
38
+ function step(op) {
39
+ if (f) throw new TypeError("Generator is already executing.");
40
+ while (_) try {
41
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
+ if (y = 0, t) op = [op[0] & 2, t.value];
43
+ switch (op[0]) {
44
+ case 0: case 1: t = op; break;
45
+ case 4: _.label++; return { value: op[1], done: false };
46
+ case 5: _.label++; y = op[1]; op = [0]; continue;
47
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
+ default:
49
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
+ if (t[2]) _.ops.pop();
54
+ _.trys.pop(); continue;
55
+ }
56
+ op = body.call(thisArg, _);
57
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
+ }
60
+ };
2
61
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
62
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
63
  };
5
64
  Object.defineProperty(exports, "__esModule", { value: true });
6
65
  exports.Share = void 0;
7
- var react_1 = __importDefault(require("react"));
66
+ var react_1 = __importStar(require("react"));
8
67
  var prop_types_1 = __importDefault(require("prop-types"));
9
68
  var Button_1 = __importDefault(require("../Button"));
69
+ var message_1 = __importDefault(require("../message"));
10
70
  var Share_1 = __importDefault(require("../../icons/Share"));
11
71
  var useThreekitInitStatus_1 = __importDefault(require("../../hooks/useThreekitInitStatus"));
12
- var useShare_1 = __importDefault(require("../../hooks/useShare"));
13
72
  var utils_1 = require("../../utils");
73
+ var share_styles_1 = require("./share.styles");
14
74
  var Share = function (props) {
15
- var _a = Object.assign({ type: 'threekit', shape: 'round', message: 'Link copied!' }, props), shape = _a.shape, type = _a.type, className = _a.className, message = _a.message;
75
+ var _a = Object.assign({
76
+ type: 'threekit',
77
+ shape: 'round',
78
+ message: 'Link copied!',
79
+ position: 'bottom-right',
80
+ saveSceneGraphState: false,
81
+ }, props), shape = _a.shape, type = _a.type, className = _a.className, msg = _a.message, position = _a.position, saveSceneGraphState = _a.saveSceneGraphState;
16
82
  var hasLoaded = (0, useThreekitInitStatus_1.default)();
17
- var handleShare = (0, useShare_1.default)();
18
- if (!hasLoaded || !handleShare)
83
+ var _b = (0, react_1.useState)(false), show = _b[0], setShow = _b[1];
84
+ var _c = (0, react_1.useState)(null), resumeUrl = _c[0], setResumeUrl = _c[1];
85
+ var resumeUrlElRef = (0, react_1.useRef)(null);
86
+ var shareButtonRef = (0, react_1.useRef)(null);
87
+ var shareContentRef = (0, react_1.useRef)(null);
88
+ (0, react_1.useEffect)(function () {
89
+ var handleClickOutside = function (e) {
90
+ var _a, _b;
91
+ if (!e)
92
+ return;
93
+ if (!((_a = shareButtonRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) &&
94
+ !((_b = shareContentRef.current) === null || _b === void 0 ? void 0 : _b.contains(e.target))) {
95
+ setShow(false);
96
+ e.stopPropagation();
97
+ }
98
+ };
99
+ document.addEventListener('mousedown', handleClickOutside);
100
+ return function () {
101
+ document.removeEventListener('mousedown', handleClickOutside);
102
+ };
103
+ }, [show, shareButtonRef, shareContentRef]);
104
+ if (!hasLoaded)
19
105
  return null;
20
106
  var cls = (0, utils_1.generateWidgetClassName)('share', className);
21
- var handleClick = function () {
22
- handleShare(message);
23
- };
24
- return (react_1.default.createElement(Button_1.default, { className: cls, shape: shape, type: type, icon: Share_1.default.iconName, onClick: handleClick }));
107
+ var handleClick = function () { return __awaiter(void 0, void 0, void 0, function () {
108
+ var configuration, e_1;
109
+ return __generator(this, function (_a) {
110
+ switch (_a.label) {
111
+ case 0:
112
+ if (show) {
113
+ setResumeUrl(null);
114
+ setShow(!show);
115
+ return [2];
116
+ }
117
+ return [4, window.threekit.treble.saveConfiguration({
118
+ saveSceneGraphState: saveSceneGraphState,
119
+ })];
120
+ case 1:
121
+ configuration = _a.sent();
122
+ _a.label = 2;
123
+ case 2:
124
+ _a.trys.push([2, 4, , 5]);
125
+ return [4, navigator.clipboard.writeText(configuration.resumableUrl)];
126
+ case 3:
127
+ _a.sent();
128
+ if (msg === null || msg === void 0 ? void 0 : msg.length)
129
+ message_1.default.info(msg);
130
+ return [3, 5];
131
+ case 4:
132
+ e_1 = _a.sent();
133
+ setResumeUrl(configuration.resumableUrl);
134
+ setShow(!show);
135
+ return [3, 5];
136
+ case 5: return [2];
137
+ }
138
+ });
139
+ }); };
140
+ var handleClickCopy = function () { return __awaiter(void 0, void 0, void 0, function () {
141
+ var _a;
142
+ return __generator(this, function (_b) {
143
+ if (!((_a = resumeUrlElRef.current) === null || _a === void 0 ? void 0 : _a.value))
144
+ return [2];
145
+ navigator.clipboard.writeText(resumeUrlElRef.current.value);
146
+ if (msg === null || msg === void 0 ? void 0 : msg.length)
147
+ message_1.default.info(msg);
148
+ return [2];
149
+ });
150
+ }); };
151
+ return (react_1.default.createElement(share_styles_1.Wrapper, { ref: shareButtonRef },
152
+ react_1.default.createElement(Button_1.default, { className: cls, shape: shape, type: type, icon: Share_1.default.iconName, onClick: handleClick }),
153
+ show ? (react_1.default.createElement(share_styles_1.ShareWrapper, { position: position },
154
+ react_1.default.createElement(share_styles_1.Content, { ref: shareContentRef },
155
+ react_1.default.createElement("input", { type: "text", ref: resumeUrlElRef, value: resumeUrl || '', onChange: function () { } }),
156
+ react_1.default.createElement("button", { type: "button", onClick: handleClickCopy }, "copy link")),
157
+ react_1.default.createElement(share_styles_1.Caret, null))) : null));
25
158
  };
26
159
  exports.Share = Share;
27
160
  exports.Share.propTypes = {
28
161
  className: prop_types_1.default.string,
29
- /**
30
- * The presentational type of the input component. Options
31
- * include: `hollow`, `standard`, `accent`, `primary`
32
- */
33
162
  type: prop_types_1.default.string,
34
- /**
35
- * Used to set the shape of the Widget button. Options
36
- * include: `square`, `round`
37
- */
38
163
  shape: prop_types_1.default.string,
39
- /**
40
- * Used to set an overwrite of the message presented to the user
41
- * when the share URL has been successfully copied.
42
- */
43
164
  message: prop_types_1.default.string,
44
165
  };
45
166
  exports.Share.defaultProps = {
@@ -47,5 +168,6 @@ exports.Share.defaultProps = {
47
168
  shape: 'round',
48
169
  type: 'threekit',
49
170
  message: 'Link copied!',
171
+ saveSceneGraphState: false,
50
172
  };
51
173
  exports.default = exports.Share;
@@ -0,0 +1,9 @@
1
+ export declare type Positions = 'top-right' | 'bottom-right' | 'bottom-left' | 'top-left';
2
+ interface PositionProps {
3
+ position: Positions;
4
+ }
5
+ export declare const Wrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
6
+ export declare const Content: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
+ export declare const Caret: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
8
+ export declare const ShareWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, PositionProps, never>;
9
+ export {};
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ShareWrapper = exports.Caret = exports.Content = exports.Wrapper = void 0;
11
+ var styled_components_1 = __importDefault(require("styled-components"));
12
+ exports.Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 40px;\n width: 40px;\n position: relative;\n"], ["\n height: 40px;\n width: 40px;\n position: relative;\n"])));
13
+ var ShareWrapperStyles = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n"], ["\n position: relative;\n"])));
14
+ exports.Content = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: 24px 18px;\n border-radius: 4px;\n background: rgba(0, 0, 0, 0.9);\n color: white;\n font-size: 16px;\n width: 290px;\n\n display: flex;\n flex-direction: row;\n justify-content: center;\n\n input {\n background: #555555;\n color: #ffffff;\n border: none;\n outline: none;\n padding: 9px;\n border-radius: 4px;\n font-size: 13px;\n text-overflow: ellipsis;\n width: 180px;\n }\n\n button {\n color: #2a94f5;\n font-size: 13px;\n background: none;\n outline: none;\n border: none;\n cursor: pointer;\n }\n"], ["\n padding: 24px 18px;\n border-radius: 4px;\n background: rgba(0, 0, 0, 0.9);\n color: white;\n font-size: 16px;\n width: 290px;\n\n display: flex;\n flex-direction: row;\n justify-content: center;\n\n input {\n background: #555555;\n color: #ffffff;\n border: none;\n outline: none;\n padding: 9px;\n border-radius: 4px;\n font-size: 13px;\n text-overflow: ellipsis;\n width: 180px;\n }\n\n button {\n color: #2a94f5;\n font-size: 13px;\n background: none;\n outline: none;\n border: none;\n cursor: pointer;\n }\n"])));
15
+ exports.Caret = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 0;\n height: 0;\n border-left: 10px solid transparent;\n border-right: 10px solid transparent;\n border-top: 8px solid rgba(0, 0, 0, 0.9);\n\n position: absolute;\n"], ["\n width: 0;\n height: 0;\n border-left: 10px solid transparent;\n border-right: 10px solid transparent;\n border-top: 8px solid rgba(0, 0, 0, 0.9);\n\n position: absolute;\n"])));
16
+ exports.ShareWrapper = (0, styled_components_1.default)(ShareWrapperStyles)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n top: ", ";\n left: ", ";\n transform: ", ";\n\n ", " {\n left: ", ";\n top: ", ";\n\n transform: ", ";\n }\n"], ["\n top: ", ";\n left: ", ";\n transform: ", ";\n\n ", " {\n left: ", ";\n top: ", ";\n\n transform: ", ";\n }\n"])), function (props) { return (props.position.includes('top') ? '14px' : '-100%'); }, function (props) { return (props.position.includes('right') ? '-250px' : 'auto'); }, function (props) {
17
+ return props.position.includes('top')
18
+ ? ''
19
+ : 'translateY(calc(0px - 14px - 100%))';
20
+ }, exports.Caret, function (props) { return (props.position.includes('right') ? '260px' : '10px'); }, function (props) { return (props.position.includes('top') ? '0' : 'auto'); }, function (props) {
21
+ return props.position.includes('top') ? 'translateY(-100%) scaleY(-1)' : '';
22
+ });
23
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
@@ -13,15 +13,7 @@ export declare const Snapshots: {
13
13
  (props: SnapshotProps): JSX.Element | null;
14
14
  propTypes: {
15
15
  className: PropTypes.Requireable<string>;
16
- /**
17
- * The presentational type of the input component. Options
18
- * include: `hollow`, `standard`, `accent`, `primary`
19
- */
20
16
  type: PropTypes.Requireable<string>;
21
- /**
22
- * Used to set the shape of the Widget button. Options
23
- * include: `square`, `round`
24
- */
25
17
  shape: PropTypes.Requireable<string>;
26
18
  };
27
19
  defaultProps: {
@@ -24,15 +24,7 @@ var Snapshots = function (props) {
24
24
  exports.Snapshots = Snapshots;
25
25
  exports.Snapshots.propTypes = {
26
26
  className: prop_types_1.default.string,
27
- /**
28
- * The presentational type of the input component. Options
29
- * include: `hollow`, `standard`, `accent`, `primary`
30
- */
31
27
  type: prop_types_1.default.string,
32
- /**
33
- * Used to set the shape of the Widget button. Options
34
- * include: `square`, `round`
35
- */
36
28
  shape: prop_types_1.default.string,
37
29
  };
38
30
  exports.Snapshots.defaultProps = {
@@ -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, IOption } from '../containers/formInputContainer';
4
5
  export interface IStrips extends IFormComponentProps<IOption> {
5
6
  showThumbnail?: boolean;
@@ -9,33 +10,11 @@ export interface IStrips extends IFormComponentProps<IOption> {
9
10
  export declare const Strips: {
10
11
  (props: IStrips): JSX.Element;
11
12
  propTypes: {
12
- /**
13
- * Is the attribute name on the initialized asset that we are
14
- * using this component for. If the attribute prop is used,
15
- * the component will ignore the props for: `value`, `options`, `onClick`.
16
- */
17
13
  attribute: PropTypes.Requireable<string>;
18
- /**
19
- * Used to add a title to the input
20
- */
21
14
  title: PropTypes.Requireable<string>;
22
- /**
23
- * Used to provide a custom description for the input component
24
- */
25
15
  description: PropTypes.Requireable<string>;
26
- /**
27
- * Selected value from the option set. Should match the 'value' property
28
- * of one of the items in the options array.
29
- */
30
16
  value: PropTypes.Requireable<string>;
31
- /**
32
- * Handles the user seletion by passing the value of the selected
33
- * option as the argument into the onClick callback.
34
- */
35
17
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
36
- /**
37
- * The options set to be displayed for the user
38
- */
39
18
  options: PropTypes.Requireable<(PropTypes.InferProps<{
40
19
  name: PropTypes.Requireable<string>;
41
20
  description: PropTypes.Requireable<string>;
@@ -44,44 +23,12 @@ export declare const Strips: {
44
23
  color: PropTypes.Requireable<string>;
45
24
  disabled: PropTypes.Requireable<boolean>;
46
25
  }> | null | undefined)[]>;
47
- /**
48
- * Used to add a custom class name to each of the components html elements
49
- */
50
26
  className: PropTypes.Requireable<string>;
51
- /**
52
- * By default the thumbnail (image/color value) is soruced from the `_thumbnail`
53
- * metadata key in the option's Catalog Item. This metadata key can be overwritten
54
- * by passing in the prefered key value to the **thumbnailFromMetadata** prop.
55
- */
56
27
  metadataKeyThumbnail: PropTypes.Requireable<string>;
57
- /**
58
- * By default the description is soruced from the `_description` metadata
59
- * key in the option's Catalog Item. This metadata key can be overwritten
60
- * by passing in the prefered key value to the **metadataKeyDescription**
61
- * prop.
62
- */
63
28
  metadataKeyDescription: PropTypes.Requireable<string>;
64
- /**
65
- * By default the price of an item is soruced from the pricebook entry for
66
- * the option's Catalog Item. The price can alternatively be soruced from
67
- * the option's Catalog Item metadata, by specifying the key under which the
68
- * price can be found as the **metadataKeyPrice** prop.
69
- */
70
29
  metadataKeyPrice: PropTypes.Requireable<string>;
71
- /**
72
- * A boolean to set whether or all the Cards should display thumbnails
73
- * for the options.
74
- */
75
30
  showThumbnail: PropTypes.Requireable<boolean>;
76
- /**
77
- * A boolean to set whether or all the Cards should display the description
78
- * for the options.
79
- */
80
31
  showDescription: PropTypes.Requireable<boolean>;
81
- /**
82
- * A boolean to set whether or all the Cards should display the price
83
- * for the options/
84
- */
85
32
  showPrice: PropTypes.Requireable<boolean>;
86
33
  };
87
34
  defaultProps: {
@@ -100,7 +47,7 @@ export declare const Strips: {
100
47
  onClick: undefined;
101
48
  };
102
49
  componentName: string;
103
- compatibleAttributes: Set<string>;
50
+ compatibleAttributes: Set<ATTRIBUTE_TYPES>;
104
51
  };
105
52
  declare const _default: (props: IStrips) => JSX.Element | null;
106
53
  export default _default;
@@ -11,7 +11,7 @@ var FormComponentDescription_1 = __importDefault(require("../FormComponentDescri
11
11
  var strips_styles_1 = require("./strips.styles");
12
12
  var shared_styles_1 = require("../shared.styles");
13
13
  var utils_1 = require("../../utils");
14
- var constants_1 = require("../../constants");
14
+ var types_1 = require("../../types");
15
15
  var formInputContainer_1 = __importDefault(require("../containers/formInputContainer"));
16
16
  var Thumbnail = function (props) {
17
17
  var imageUrl = props.imageUrl, color = props.color, name = props.name, className = props.className;
@@ -62,33 +62,11 @@ var Strips = function (props) {
62
62
  };
63
63
  exports.Strips = Strips;
64
64
  exports.Strips.propTypes = {
65
- /**
66
- * Is the attribute name on the initialized asset that we are
67
- * using this component for. If the attribute prop is used,
68
- * the component will ignore the props for: `value`, `options`, `onClick`.
69
- */
70
65
  attribute: prop_types_1.default.string,
71
- /**
72
- * Used to add a title to the input
73
- */
74
66
  title: prop_types_1.default.string,
75
- /**
76
- * Used to provide a custom description for the input component
77
- */
78
67
  description: prop_types_1.default.string,
79
- /**
80
- * Selected value from the option set. Should match the 'value' property
81
- * of one of the items in the options array.
82
- */
83
68
  value: prop_types_1.default.string,
84
- /**
85
- * Handles the user seletion by passing the value of the selected
86
- * option as the argument into the onClick callback.
87
- */
88
69
  onClick: prop_types_1.default.func,
89
- /**
90
- * The options set to be displayed for the user
91
- */
92
70
  options: prop_types_1.default.arrayOf(prop_types_1.default.shape({
93
71
  name: prop_types_1.default.string,
94
72
  description: prop_types_1.default.string,
@@ -97,59 +75,24 @@ exports.Strips.propTypes = {
97
75
  color: prop_types_1.default.string,
98
76
  disabled: prop_types_1.default.bool,
99
77
  })),
100
- /**
101
- * Used to add a custom class name to each of the components html elements
102
- */
103
78
  className: prop_types_1.default.string,
104
- /**
105
- * By default the thumbnail (image/color value) is soruced from the `_thumbnail`
106
- * metadata key in the option's Catalog Item. This metadata key can be overwritten
107
- * by passing in the prefered key value to the **thumbnailFromMetadata** prop.
108
- */
109
79
  metadataKeyThumbnail: prop_types_1.default.string,
110
- /**
111
- * By default the description is soruced from the `_description` metadata
112
- * key in the option's Catalog Item. This metadata key can be overwritten
113
- * by passing in the prefered key value to the **metadataKeyDescription**
114
- * prop.
115
- */
116
80
  metadataKeyDescription: prop_types_1.default.string,
117
- /**
118
- * By default the price of an item is soruced from the pricebook entry for
119
- * the option's Catalog Item. The price can alternatively be soruced from
120
- * the option's Catalog Item metadata, by specifying the key under which the
121
- * price can be found as the **metadataKeyPrice** prop.
122
- */
123
81
  metadataKeyPrice: prop_types_1.default.string,
124
- /**
125
- * A boolean to set whether or all the Cards should display thumbnails
126
- * for the options.
127
- */
128
82
  showThumbnail: prop_types_1.default.bool,
129
- /**
130
- * A boolean to set whether or all the Cards should display the description
131
- * for the options.
132
- */
133
83
  showDescription: prop_types_1.default.bool,
134
- /**
135
- * A boolean to set whether or all the Cards should display the price
136
- * for the options/
137
- */
138
84
  showPrice: prop_types_1.default.bool,
139
85
  };
140
86
  exports.Strips.defaultProps = {
141
87
  description: undefined,
142
88
  className: undefined,
143
- // Default use
144
89
  attribute: undefined,
145
- // Default user overrides
146
90
  metadataKeyThumbnail: undefined,
147
91
  metadataKeyDescription: undefined,
148
92
  metadataKeyPrice: undefined,
149
93
  showThumbnail: true,
150
94
  showPrice: true,
151
95
  showDescription: true,
152
- // Custom use
153
96
  title: undefined,
154
97
  value: undefined,
155
98
  options: undefined,
@@ -157,7 +100,7 @@ exports.Strips.defaultProps = {
157
100
  };
158
101
  exports.Strips.componentName = 'strips';
159
102
  exports.Strips.compatibleAttributes = new Set([
160
- constants_1.ATTRIBUTE_TYPES.asset,
161
- constants_1.ATTRIBUTE_TYPES.string,
103
+ types_1.ATTRIBUTE_TYPES.ASSET,
104
+ types_1.ATTRIBUTE_TYPES.STRING,
162
105
  ]);
163
106
  exports.default = (0, formInputContainer_1.default)(exports.Strips);
@@ -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, IOption } from '../containers/formInputContainer';
4
5
  export interface ISwatch extends IFormComponentProps<IOption> {
5
6
  showThumbnail?: boolean;
@@ -10,44 +11,13 @@ export interface ISwatch extends IFormComponentProps<IOption> {
10
11
  export declare const Swatch: {
11
12
  (props: ISwatch): JSX.Element;
12
13
  propTypes: {
13
- /**
14
- * Is the attribute name on the initialized asset that we are
15
- * using this component for. If the attribute prop is used,
16
- * the component will ignore the props for: `value`, `options`, `onClick`.
17
- */
18
14
  attribute: PropTypes.Requireable<string>;
19
- /**
20
- * Used to set the shape of the Swatch Option component. Options
21
- * include: `square`, `round`
22
- */
23
15
  shape: PropTypes.Requireable<string>;
24
- /**
25
- * Used to add a title to the input
26
- */
27
16
  title: PropTypes.Requireable<string>;
28
- /**
29
- * Used to provide a custom description for the input component
30
- */
31
17
  description: PropTypes.Requireable<string>;
32
- /**
33
- * Selected value from the option set. Should match the 'value' property
34
- * of one of the items in the options array.
35
- */
36
18
  value: PropTypes.Requireable<string>;
37
- /**
38
- * Handles the user seletion by passing the value of the selected
39
- * option as the argument into the onClick callback.
40
- */
41
19
  size: PropTypes.Requireable<string>;
42
- /**
43
- * The size of the for a swatch option. The size should be a valid CSS
44
- * height/width property.
45
- *
46
- */
47
20
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
48
- /**
49
- * The options set to be displayed for the user
50
- */
51
21
  options: PropTypes.Requireable<(PropTypes.InferProps<{
52
22
  name: PropTypes.Requireable<string>;
53
23
  description: PropTypes.Requireable<string>;
@@ -57,44 +27,12 @@ export declare const Swatch: {
57
27
  color: PropTypes.Requireable<string>;
58
28
  disabled: PropTypes.Requireable<boolean>;
59
29
  }> | null | undefined)[]>;
60
- /**
61
- * Used to add a custom class name to each of the components html elements
62
- */
63
30
  className: PropTypes.Requireable<string>;
64
- /**
65
- * By default the thumbnail (image/color value) is soruced from the `_thumbnail`
66
- * metadata key in the option's Catalog Item. This metadata key can be overwritten
67
- * by passing in the prefered key value to the **thumbnailFromMetadata** prop.
68
- */
69
31
  metadataKeyThumbnail: PropTypes.Requireable<string>;
70
- /**
71
- * By default the description is soruced from the `_description` metadata
72
- * key in the option's Catalog Item. This metadata key can be overwritten
73
- * by passing in the prefered key value to the **metadataKeyDescription**
74
- * prop.
75
- */
76
32
  metadataKeyDescription: PropTypes.Requireable<string>;
77
- /**
78
- * By default the price of an item is soruced from the pricebook entry for
79
- * the option's Catalog Item. The price can alternatively be soruced from
80
- * the option's Catalog Item metadata, by specifying the key under which the
81
- * price can be found as the **metadataKeyPrice** prop.
82
- */
83
33
  metadataKeyPrice: PropTypes.Requireable<string>;
84
- /**
85
- * A boolean to set whether or all the Cards should display thumbnails
86
- * for the options.
87
- */
88
34
  showThumbnail: PropTypes.Requireable<boolean>;
89
- /**
90
- * A boolean to set whether or all the Cards should display the description
91
- * for the options.
92
- */
93
35
  showDescription: PropTypes.Requireable<boolean>;
94
- /**
95
- * A boolean to set whether or all the Cards should display the price
96
- * for the options/
97
- */
98
36
  showPrice: PropTypes.Requireable<boolean>;
99
37
  };
100
38
  defaultProps: {
@@ -114,7 +52,7 @@ export declare const Swatch: {
114
52
  onClick: undefined;
115
53
  };
116
54
  componentName: string;
117
- compatibleAttributes: Set<string>;
55
+ compatibleAttributes: Set<ATTRIBUTE_TYPES>;
118
56
  };
119
57
  declare const _default: (props: ISwatch) => JSX.Element | null;
120
58
  export default _default;