@threekit-tools/treble 0.0.18 → 0.0.22
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/components/Cards/cards.styles.js +1 -1
- package/dist/components/Cards/index.js +1 -1
- package/dist/components/Drawer/drawer.styles.js +1 -1
- package/dist/components/Modal/modal.styles.js +1 -1
- package/dist/components/ProductLayout/index.d.ts +6 -0
- package/dist/components/ProductLayout/index.js +10 -0
- package/dist/components/ProductLoader/index.d.ts +12 -0
- package/dist/components/ProductLoader/index.js +82 -0
- package/dist/components/Strips/index.js +1 -1
- package/dist/components/Strips/strips.styles.js +1 -1
- package/dist/components/Swatch/index.js +1 -1
- package/dist/components/Swatch/swatch.styles.js +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +20 -1
- package/package.json +4 -2
- package/tailwind-presets.js +82 -0
|
@@ -11,7 +11,7 @@ exports.CardWrapper = exports.CardPrice = exports.CardDescription = exports.Card
|
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
exports.CardsWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n\n transition: all 0.2s;\n\n & > div {\n margin-bottom: 5px;\n }\n\n & > div:not(:last-child) {\n margin-right: 5px;\n }\n"], ["\n width: 100%;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n\n transition: all 0.2s;\n\n & > div {\n margin-bottom: 5px;\n }\n\n & > div:not(:last-child) {\n margin-right: 5px;\n }\n"])));
|
|
13
13
|
exports.CardWrapperStyles = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n /* min-height: 234px; */\n width: 170px;\n border-radius: ", ";\n border: 1px solid lightgrey;\n\n background: #fff;\n\n padding: 14px;\n\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n\n cursor: pointer;\n"], ["\n /* min-height: 234px; */\n width: 170px;\n border-radius: ", ";\n border: 1px solid lightgrey;\n\n background: #fff;\n\n padding: 14px;\n\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n\n cursor: pointer;\n"])), function (props) { return props.theme.borderRadius; });
|
|
14
|
-
exports.CardThumbnail = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n height: 120px;\n width: 100%;\n margin-bottom: 5px;\n text-align: center;\n\n ", "\n\n img {\n height: 120px;\n width: auto;\n object-fit: cover;\n }\n"], ["\n height: 120px;\n width: 100%;\n margin-bottom: 5px;\n text-align: center;\n\n ", "\n\n img {\n height: 120px;\n width: auto;\n object-fit: cover;\n }\n"])), function (props) { return (props.color ? "background: ".concat(props.color, ";") : ''); });
|
|
14
|
+
exports.CardThumbnail = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n height: 120px;\n width: 100%;\n margin-bottom: 5px;\n text-align: center;\n display: block;\n\n ", "\n\n img {\n height: 120px;\n width: auto;\n object-fit: cover;\n }\n"], ["\n height: 120px;\n width: 100%;\n margin-bottom: 5px;\n text-align: center;\n display: block;\n\n ", "\n\n img {\n height: 120px;\n width: auto;\n object-fit: cover;\n }\n"])), function (props) { return (props.color ? "background: ".concat(props.color, ";") : ''); });
|
|
15
15
|
exports.CardTitle = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n font-weight: 400;\n font-size: 14px;\n font-family: ", ";\n line-height: 20px;\n text-align: center;\n transition: all 0.2s;\n"], ["\n color: ", ";\n font-weight: 400;\n font-size: 14px;\n font-family: ", ";\n line-height: 20px;\n text-align: center;\n transition: all 0.2s;\n"])), function (props) { return props.theme.textColor; }, function (props) { return props.theme.fontFamily; });
|
|
16
16
|
exports.CardDescription = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: ", ";\n font-weight: 400;\n font-size: 13px;\n font-family: ", ";\n line-height: 20px;\n text-align: center;\n padding-bottom: 5px;\n transition: all 0.2s;\n"], ["\n color: ", ";\n font-weight: 400;\n font-size: 13px;\n font-family: ", ";\n line-height: 20px;\n text-align: center;\n padding-bottom: 5px;\n transition: all 0.2s;\n"])), function (props) { return props.theme.textColorSecondary; }, function (props) { return props.theme.fontFamily; });
|
|
17
17
|
exports.CardPrice = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: ", ";\n font-weight: 600;\n font-size: 14px;\n font-family: ", ";\n line-height: 20px;\n text-align: center;\n transition: all 0.2s;\n"], ["\n color: ", ";\n font-weight: 600;\n font-size: 14px;\n font-family: ", ";\n line-height: 20px;\n text-align: center;\n transition: all 0.2s;\n"])), function (props) { return props.theme.textColorSecondary; }, function (props) { return props.theme.fontFamily; });
|
|
@@ -17,7 +17,7 @@ var Thumbnail = function (props) {
|
|
|
17
17
|
var imageUrl = props.imageUrl, color = props.color, name = props.name, className = props.className;
|
|
18
18
|
if (!imageUrl && !color)
|
|
19
19
|
return null;
|
|
20
|
-
return (react_1.default.createElement(cards_styles_1.CardThumbnail, { className: "".concat(className, " option-thumbnail"), color: color }, imageUrl ? react_1.default.createElement("img", { src: imageUrl, alt: name || '' }) : null));
|
|
20
|
+
return (react_1.default.createElement(cards_styles_1.CardThumbnail, { className: "".concat(className, " option-thumbnail"), color: color }, imageUrl ? react_1.default.createElement("img", { src: imageUrl, alt: name || '' }) : react_1.default.createElement("span", null)));
|
|
21
21
|
};
|
|
22
22
|
var Title = function (props) {
|
|
23
23
|
var name = props.name, className = props.className;
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.Content = exports.Header = exports.Wrapper = exports.Background = void 0;
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
exports.Background = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 100vh;\n width: 100vw;\n background: #33333377;\n\n opacity: ", ";\n transition: all ", ";\n\n position: fixed;\n top: 0;\n left: 0;\n"], ["\n height: 100vh;\n width: 100vw;\n background: #33333377;\n\n opacity: ", ";\n transition: all ", ";\n\n position: fixed;\n top: 0;\n left: 0;\n"])), function (props) { return (props.show ? 1 : 0); }, function (props) { return props.transitionDuration; });
|
|
13
|
-
exports.Wrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n min-width: 400px;\n height: 100vh;\n background: #fff;\n border-radius: ", ";\n opacity: 1;\n\n transform: translateX(", ");\n transition: all ", ";\n\n position: absolute;\n top: 0;\n right: 0;\n"], ["\n min-width: 400px;\n height: 100vh;\n background: #fff;\n border-radius: ", ";\n opacity: 1;\n\n transform: translateX(", ");\n transition: all ", ";\n\n position: absolute;\n top: 0;\n right: 0;\n"])), function (props) { return props.theme.borderRadius; }, function (props) { return (props.show ? '0%' : '100%'); }, function (props) { return props.transitionDuration; });
|
|
13
|
+
exports.Wrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n min-width: 400px;\n height: 100vh;\n background: #fff;\n border-radius: ", ";\n opacity: 1;\n z-index: 10;\n\n transform: translateX(", ");\n transition: all ", ";\n\n position: absolute;\n top: 0;\n right: 0;\n"], ["\n min-width: 400px;\n height: 100vh;\n background: #fff;\n border-radius: ", ";\n opacity: 1;\n z-index: 10;\n\n transform: translateX(", ");\n transition: all ", ";\n\n position: absolute;\n top: 0;\n right: 0;\n"])), function (props) { return props.theme.borderRadius; }, function (props) { return (props.show ? '0%' : '100%'); }, function (props) { return props.transitionDuration; });
|
|
14
14
|
exports.Header = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n font-family: ", ";\n padding: 20px;\n\n & > div {\n /* height: max-content;\n position: relative;\n top: 50%;\n transform: translateY(-50%); */\n }\n\n & > div:nth-child(2) {\n cursor: pointer;\n height: 20px;\n }\n"], ["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n font-family: ", ";\n padding: 20px;\n\n & > div {\n /* height: max-content;\n position: relative;\n top: 50%;\n transform: translateY(-50%); */\n }\n\n & > div:nth-child(2) {\n cursor: pointer;\n height: 20px;\n }\n"])), function (props) { return props.theme.fontFamily; });
|
|
15
15
|
exports.Content = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-family: ", ";\n"], ["\n font-family: ", ";\n"])), function (props) { return props.theme.fontFamily; });
|
|
16
16
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.Content = exports.Header = exports.Wrapper = exports.Background = void 0;
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
exports.Background = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 100vh;\n width: 100vw;\n background: #33333377;\n\n position: fixed;\n top: 0;\n left: 0;\n"], ["\n height: 100vh;\n width: 100vw;\n background: #33333377;\n\n position: fixed;\n top: 0;\n left: 0;\n"])));
|
|
13
|
-
exports.Wrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n min-width: 400px;\n max-width: 100%;\n min-height: 200px;\n opacity: 1;\n overflow: scroll;\n background: #fff;\n border-radius: ", ";\n\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n"], ["\n min-width: 400px;\n max-width: 100%;\n min-height: 200px;\n opacity: 1;\n overflow: scroll;\n background: #fff;\n border-radius: ", ";\n\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n"])), function (props) { return props.theme.borderRadius; });
|
|
13
|
+
exports.Wrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n min-width: 400px;\n max-width: 100%;\n min-height: 200px;\n opacity: 1;\n overflow: scroll;\n z-index: 10;\n background: #fff;\n border-radius: ", ";\n\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n"], ["\n min-width: 400px;\n max-width: 100%;\n min-height: 200px;\n opacity: 1;\n overflow: scroll;\n z-index: 10;\n background: #fff;\n border-radius: ", ";\n\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n"])), function (props) { return props.theme.borderRadius; });
|
|
14
14
|
exports.Header = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n font-family: ", ";\n\n & > div:nth-child(2) {\n cursor: pointer;\n }\n"], ["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n font-family: ", ";\n\n & > div:nth-child(2) {\n cursor: pointer;\n }\n"])), function (props) { return props.theme.fontFamily; });
|
|
15
15
|
exports.Content = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-family: ", ";\n"], ["\n font-family: ", ";\n"])), function (props) { return props.theme.fontFamily; });
|
|
16
16
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var react_1 = __importDefault(require("react"));
|
|
7
|
+
var ProductLayout = function (props) {
|
|
8
|
+
return react_1.default.createElement(react_1.default.Fragment, null, props.children);
|
|
9
|
+
};
|
|
10
|
+
exports.default = ProductLayout;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="webpack-env" />
|
|
3
|
+
import { ThreekitProviderProps } from '../ThreekitProvider';
|
|
4
|
+
interface IProducts {
|
|
5
|
+
ctx: __WebpackModuleApi.RequireContext;
|
|
6
|
+
}
|
|
7
|
+
interface ProductLoaderProps extends Omit<ThreekitProviderProps, 'children'> {
|
|
8
|
+
productId: string;
|
|
9
|
+
products: IProducts;
|
|
10
|
+
}
|
|
11
|
+
export default function ProductLoader(props: ProductLoaderProps): JSX.Element | null;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
var react_1 = __importStar(require("react"));
|
|
26
|
+
var ThreekitProvider_1 = __importDefault(require("../ThreekitProvider"));
|
|
27
|
+
var productAssetId = {};
|
|
28
|
+
var productComponents = [];
|
|
29
|
+
var productToComponentMap = {};
|
|
30
|
+
function ProductLoader(props) {
|
|
31
|
+
var productId = props.productId, products = props.products, credentials = props.credentials, playerConfig = props.playerConfig, theme = props.theme, threekitEnv = props.threekitEnv;
|
|
32
|
+
if (!productId || !products)
|
|
33
|
+
return null;
|
|
34
|
+
if (!productComponents.length) {
|
|
35
|
+
products.ctx.keys().forEach(function (fileName) {
|
|
36
|
+
if (!fileName.includes('product.js'))
|
|
37
|
+
return;
|
|
38
|
+
if (fileName.includes('].product.js'))
|
|
39
|
+
return;
|
|
40
|
+
productComponents.push(products.ctx(fileName).default);
|
|
41
|
+
});
|
|
42
|
+
react_1.Children.forEach(Object.values(productComponents).map(function (el) { return el({}); }), function (jsx, i) {
|
|
43
|
+
var _a;
|
|
44
|
+
if (!jsx)
|
|
45
|
+
return;
|
|
46
|
+
if (jsx.type.name !== 'ProductLayout')
|
|
47
|
+
return;
|
|
48
|
+
if (!jsx.props.products)
|
|
49
|
+
return;
|
|
50
|
+
var products;
|
|
51
|
+
if (Array.isArray(jsx.props.products))
|
|
52
|
+
products = jsx.props.products.reduce(function (output, id) {
|
|
53
|
+
var _a;
|
|
54
|
+
return Object.assign(output, (_a = {}, _a[id] = id, _a));
|
|
55
|
+
}, {});
|
|
56
|
+
else if (typeof jsx.props.products === 'string') {
|
|
57
|
+
var prdStr = jsx.props.products;
|
|
58
|
+
products = (_a = {}, _a[prdStr] = prdStr, _a);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
products = jsx.props.products;
|
|
62
|
+
}
|
|
63
|
+
Object.entries(products).forEach(function (_a) {
|
|
64
|
+
var key = _a[0], assetId = _a[1];
|
|
65
|
+
productAssetId[key] = assetId;
|
|
66
|
+
productToComponentMap[key] = i;
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
var Product = productComponents[productToComponentMap[props.productId]];
|
|
71
|
+
if (!Product)
|
|
72
|
+
return null;
|
|
73
|
+
var assetId = productAssetId[props.productId];
|
|
74
|
+
var env = threekitEnv || 'preview';
|
|
75
|
+
var preppedCredentials = Object.assign({}, credentials);
|
|
76
|
+
preppedCredentials[env] = Object.assign(preppedCredentials[env], {
|
|
77
|
+
assetId: assetId,
|
|
78
|
+
});
|
|
79
|
+
return (react_1.default.createElement(ThreekitProvider_1.default, { credentials: preppedCredentials, playerConfig: Object.assign({}, playerConfig), theme: theme },
|
|
80
|
+
react_1.default.createElement(Product, null)));
|
|
81
|
+
}
|
|
82
|
+
exports.default = ProductLoader;
|
|
@@ -17,7 +17,7 @@ var Thumbnail = function (props) {
|
|
|
17
17
|
var imageUrl = props.imageUrl, color = props.color, name = props.name, className = props.className;
|
|
18
18
|
if (!imageUrl && !color)
|
|
19
19
|
return null;
|
|
20
|
-
return (react_1.default.createElement(strips_styles_1.StripThumbnail, { className: "".concat(className, " option-thumbnail"), color: color }, imageUrl ? react_1.default.createElement("img", { src: imageUrl, alt: name || '' }) : null));
|
|
20
|
+
return (react_1.default.createElement(strips_styles_1.StripThumbnail, { className: "".concat(className, " option-thumbnail"), color: color }, imageUrl ? react_1.default.createElement("img", { src: imageUrl, alt: name || '' }) : react_1.default.createElement("span", null)));
|
|
21
21
|
};
|
|
22
22
|
var Title = function (props) {
|
|
23
23
|
var name = props.name, className = props.className;
|
|
@@ -11,7 +11,7 @@ exports.StripWrapper = exports.StripPrice = exports.StripDescription = exports.S
|
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
exports.StripsWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n\n & > div:not(:first-child) {\n margin-top: 8px;\n }\n"], ["\n display: flex;\n flex-direction: column;\n\n & > div:not(:first-child) {\n margin-top: 8px;\n }\n"])));
|
|
13
13
|
exports.StripWrapperStyles = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: max-content;\n width: 100%;\n border-radius: ", ";\n border: 1px solid lightgrey;\n background: #fff;\n\n padding: 5px 12px;\n\n display: grid;\n grid-template-columns: max-content auto max-content;\n grid-gap: 8px;\n\n cursor: pointer;\n\n & > div:nth-child(2) {\n height: max-content;\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n }\n"], ["\n height: max-content;\n width: 100%;\n border-radius: ", ";\n border: 1px solid lightgrey;\n background: #fff;\n\n padding: 5px 12px;\n\n display: grid;\n grid-template-columns: max-content auto max-content;\n grid-gap: 8px;\n\n cursor: pointer;\n\n & > div:nth-child(2) {\n height: max-content;\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n }\n"])), function (props) { return props.theme.borderRadius || '2px'; });
|
|
14
|
-
exports.StripThumbnail = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n height: 48px;\n width: 48px;\n margin-right: 5px;\n\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n\n ", "\n\n img {\n height: 100%;\n width: auto;\n object-fit: cover;\n }\n"], ["\n height: 48px;\n width: 48px;\n margin-right: 5px;\n\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n\n ", "\n\n img {\n height: 100%;\n width: auto;\n object-fit: cover;\n }\n"])), function (props) {
|
|
14
|
+
exports.StripThumbnail = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n height: 48px;\n width: 48px;\n margin-right: 5px;\n display: block;\n\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n\n ", "\n\n img {\n height: 100%;\n width: auto;\n object-fit: cover;\n }\n"], ["\n height: 48px;\n width: 48px;\n margin-right: 5px;\n display: block;\n\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n\n ", "\n\n img {\n height: 100%;\n width: auto;\n object-fit: cover;\n }\n"])), function (props) {
|
|
15
15
|
return props.color
|
|
16
16
|
? "background: ".concat(props.color, "; border-radius: ").concat(props.theme.borderRadius, ";")
|
|
17
17
|
: '';
|
|
@@ -27,7 +27,7 @@ var Thumbnail = function (props) {
|
|
|
27
27
|
var imageUrl = props.imageUrl, color = props.color, name = props.name, shape = props.shape, className = props.className;
|
|
28
28
|
if (!imageUrl && !color)
|
|
29
29
|
return react_1.default.createElement("div", null);
|
|
30
|
-
return (react_1.default.createElement(swatch_styles_1.OptionThumbnail, { className: "".concat(className, " option-thumbnail"), color: color, shape: shape }, imageUrl ? react_1.default.createElement("img", { src: imageUrl, alt: name || '' }) : null));
|
|
30
|
+
return (react_1.default.createElement(swatch_styles_1.OptionThumbnail, { className: "".concat(className, " option-thumbnail"), color: color, shape: shape }, imageUrl ? react_1.default.createElement("img", { src: imageUrl, alt: name || '' }) : react_1.default.createElement("span", null)));
|
|
31
31
|
};
|
|
32
32
|
var Swatch = function (props) {
|
|
33
33
|
var _a = Object.assign({ shape: 'round' }, props), title = _a.title, shape = _a.shape, description = _a.description, options = _a.options, value = _a.value, onClick = _a.onClick, customClassName = _a.className, showThumbnail = _a.showThumbnail, showPrice = _a.showPrice, showDescription = _a.showDescription;
|
|
@@ -19,7 +19,7 @@ exports.OptionWrapperStyles = styled_components_1.default.div(templateObject_2 |
|
|
|
19
19
|
? ''
|
|
20
20
|
: "border: 2px solid ".concat(props.theme.primaryColor, "55;");
|
|
21
21
|
});
|
|
22
|
-
exports.OptionThumbnail = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n height: 52px;\n width: 52px;\n text-align: center;\n\n border-radius: ", ";\n overflow: hidden;\n\n ", "\n\n img {\n height: 100%;\n width: auto;\n object-fit: cover;\n }\n"], ["\n height: 52px;\n width: 52px;\n text-align: center;\n\n border-radius: ", ";\n overflow: hidden;\n\n ", "\n\n img {\n height: 100%;\n width: auto;\n object-fit: cover;\n }\n"])), function (props) {
|
|
22
|
+
exports.OptionThumbnail = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n height: 52px;\n width: 52px;\n text-align: center;\n display: block;\n\n border-radius: ", ";\n overflow: hidden;\n\n ", "\n\n img {\n height: 100%;\n width: auto;\n object-fit: cover;\n }\n"], ["\n height: 52px;\n width: 52px;\n text-align: center;\n display: block;\n\n border-radius: ", ";\n overflow: hidden;\n\n ", "\n\n img {\n height: 100%;\n width: auto;\n object-fit: cover;\n }\n"])), function (props) {
|
|
23
23
|
return props.shape === 'round' ? '50%' : props.theme.borderRadius;
|
|
24
24
|
}, function (props) { return (props.color ? "background: ".concat(props.color, ";") : ''); });
|
|
25
25
|
exports.SwatchInfoWrapper = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: max-content;\n position: relative;\n top: -100%;\n left: 50%;\n transform: translateX(-50%) translateY(-100%);\n padding-bottom: 4px;\n color: white;\n font-family: ", ";\n\n display: none;\n\n & > div:nth-child(1) {\n background: rgba(0, 0, 0, 0.6);\n padding: 4px 6px;\n border-radius: ", ";\n max-width: 250px;\n }\n\n & > div:nth-child(2) {\n display: flex;\n flex-direction: row;\n justify-content: space-around;\n\n & > div {\n width: 0;\n height: 0;\n border-left: 8px solid transparent;\n border-right: 8px solid transparent;\n\n border-top: 8px solid rgba(0, 0, 0, 0.6);\n\n overflow: hidden;\n pointer-events: none;\n }\n }\n"], ["\n width: max-content;\n position: relative;\n top: -100%;\n left: 50%;\n transform: translateX(-50%) translateY(-100%);\n padding-bottom: 4px;\n color: white;\n font-family: ", ";\n\n display: none;\n\n & > div:nth-child(1) {\n background: rgba(0, 0, 0, 0.6);\n padding: 4px 6px;\n border-radius: ", ";\n max-width: 250px;\n }\n\n & > div:nth-child(2) {\n display: flex;\n flex-direction: row;\n justify-content: space-around;\n\n & > div {\n width: 0;\n height: 0;\n border-left: 8px solid transparent;\n border-right: 8px solid transparent;\n\n border-top: 8px solid rgba(0, 0, 0, 0.6);\n\n overflow: hidden;\n pointer-events: none;\n }\n }\n"])), function (props) { return props.theme.fontFamily; }, function (props) { return props.theme.borderRadius; });
|
package/dist/index.d.ts
CHANGED
|
@@ -35,4 +35,8 @@ import Zoom from './components/Zoom';
|
|
|
35
35
|
import Snapshots from './components/Snapshots';
|
|
36
36
|
import Wishlist from './components/Wishlist';
|
|
37
37
|
import Share from './components/Share';
|
|
38
|
-
|
|
38
|
+
import icons from './icons';
|
|
39
|
+
export * from './icons';
|
|
40
|
+
import ProductLoader from './components/ProductLoader';
|
|
41
|
+
import ProductLayout from './components/ProductLayout';
|
|
42
|
+
export { useAttribute, useConfigurator, useMetadata, useName, usePlayerLoadingStatus, usePrice, useThreekitInitStatus, useZoom, useSnapshot, useWishlist, useShare, ThreekitProvider, Player, Button, Cards, Dropdown, Strips, Swatch, Tiles, TilesGroup, ProductName, ProductDescription, AttributeTitle, AttributeValue, TotalPrice, message, Modal, Drawer, Accordion, Tabs, PortalToElement, AwaitThreekitLoad, FlatForm, Zoom, Snapshots, Wishlist, Share, icons, ProductLoader, ProductLayout, };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
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 __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
|
+
};
|
|
2
12
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
14
|
};
|
|
5
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Share = exports.Wishlist = exports.Snapshots = exports.Zoom = exports.FlatForm = exports.AwaitThreekitLoad = exports.PortalToElement = exports.Tabs = exports.Accordion = exports.Drawer = exports.Modal = exports.message = exports.TotalPrice = exports.AttributeValue = exports.AttributeTitle = exports.ProductDescription = exports.ProductName = exports.TilesGroup = exports.Tiles = exports.Swatch = exports.Strips = exports.Dropdown = exports.Cards = exports.Button = exports.Player = exports.ThreekitProvider = exports.useShare = exports.useWishlist = exports.useSnapshot = exports.useZoom = exports.useThreekitInitStatus = exports.usePrice = exports.usePlayerLoadingStatus = exports.useName = exports.useMetadata = exports.useConfigurator = exports.useAttribute = void 0;
|
|
16
|
+
exports.ProductLayout = exports.ProductLoader = exports.icons = exports.Share = exports.Wishlist = exports.Snapshots = exports.Zoom = exports.FlatForm = exports.AwaitThreekitLoad = exports.PortalToElement = exports.Tabs = exports.Accordion = exports.Drawer = exports.Modal = exports.message = exports.TotalPrice = exports.AttributeValue = exports.AttributeTitle = exports.ProductDescription = exports.ProductName = exports.TilesGroup = exports.Tiles = exports.Swatch = exports.Strips = exports.Dropdown = exports.Cards = exports.Button = exports.Player = exports.ThreekitProvider = exports.useShare = exports.useWishlist = exports.useSnapshot = exports.useZoom = exports.useThreekitInitStatus = exports.usePrice = exports.usePlayerLoadingStatus = exports.useName = exports.useMetadata = exports.useConfigurator = exports.useAttribute = void 0;
|
|
7
17
|
// Hooks
|
|
8
18
|
var useAttribute_1 = __importDefault(require("./hooks/useAttribute"));
|
|
9
19
|
exports.useAttribute = useAttribute_1.default;
|
|
@@ -87,3 +97,12 @@ var Wishlist_1 = __importDefault(require("./components/Wishlist"));
|
|
|
87
97
|
exports.Wishlist = Wishlist_1.default;
|
|
88
98
|
var Share_1 = __importDefault(require("./components/Share"));
|
|
89
99
|
exports.Share = Share_1.default;
|
|
100
|
+
// Icons
|
|
101
|
+
var icons_1 = __importDefault(require("./icons"));
|
|
102
|
+
exports.icons = icons_1.default;
|
|
103
|
+
__exportStar(require("./icons"), exports);
|
|
104
|
+
// Products - Multi-configurtors
|
|
105
|
+
var ProductLoader_1 = __importDefault(require("./components/ProductLoader"));
|
|
106
|
+
exports.ProductLoader = ProductLoader_1.default;
|
|
107
|
+
var ProductLayout_1 = __importDefault(require("./components/ProductLayout"));
|
|
108
|
+
exports.ProductLayout = ProductLayout_1.default;
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threekit-tools/treble",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"author": "Amaan Saeed",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
7
|
-
"dist"
|
|
7
|
+
"dist",
|
|
8
|
+
"tailwind-presets.js"
|
|
8
9
|
],
|
|
9
10
|
"main": "dist/index.js",
|
|
10
11
|
"module": "dist/index.js",
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
"@types/react-dom": ">=17.0.9",
|
|
44
45
|
"@types/redux-logger": "^3.0.9",
|
|
45
46
|
"@types/styled-components": "^5.1.15",
|
|
47
|
+
"@types/webpack-env": "^1.16.3",
|
|
46
48
|
"babel-loader": "^8.2.2",
|
|
47
49
|
"react": ">=17.0.2",
|
|
48
50
|
"react-dom": ">=17.0.2",
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// eslint-disable-next-line
|
|
2
|
+
const plugin = require('tailwindcss/plugin');
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line
|
|
5
|
+
module.exports = {
|
|
6
|
+
purge: ['./public/index.html', './src/**/*.{js,jsx,ts,tsx}'],
|
|
7
|
+
mode: 'jit',
|
|
8
|
+
variants: {},
|
|
9
|
+
theme: {
|
|
10
|
+
extend: {
|
|
11
|
+
colors: {
|
|
12
|
+
primary: '#1890ff',
|
|
13
|
+
},
|
|
14
|
+
height: { 50: '12rem' },
|
|
15
|
+
width: { 50: '12rem' },
|
|
16
|
+
minWidth: {
|
|
17
|
+
11: '2.75rem',
|
|
18
|
+
},
|
|
19
|
+
boxShadow: {
|
|
20
|
+
trbl: '0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05)',
|
|
21
|
+
wishlist: '0px 4px 16px rgba(0, 0, 0, 0.16)',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
corePlugins: {
|
|
26
|
+
// preflight: false,
|
|
27
|
+
},
|
|
28
|
+
plugins: [
|
|
29
|
+
plugin(function ({ addComponents, theme }) {
|
|
30
|
+
const tooltip = {
|
|
31
|
+
'.trbl-tooltip': {
|
|
32
|
+
paddingBottom: `${theme('spacing.2')}`,
|
|
33
|
+
width: 'max-content',
|
|
34
|
+
borderRadius: theme('borderRadius.sm'),
|
|
35
|
+
position: 'relative',
|
|
36
|
+
top: '-100%',
|
|
37
|
+
left: '50%',
|
|
38
|
+
transform: 'translate(-50%, -100%)',
|
|
39
|
+
color: 'white',
|
|
40
|
+
},
|
|
41
|
+
'.trbl-tooltip-triangle': {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
flexDirection: 'row',
|
|
44
|
+
justifyContent: 'space-around',
|
|
45
|
+
|
|
46
|
+
'& > div': {
|
|
47
|
+
width: `${theme('spacing.0')}`,
|
|
48
|
+
height: `${theme('spacing.0')}`,
|
|
49
|
+
borderLeft: '8px solid transparent',
|
|
50
|
+
borderRight: '8px solid transparent',
|
|
51
|
+
borderTop: '8px solid rgba(0, 0, 0, 0.6)',
|
|
52
|
+
overflow: 'hidden',
|
|
53
|
+
pointerEvents: 'none',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
addComponents(tooltip);
|
|
59
|
+
}),
|
|
60
|
+
plugin(function ({ addComponents, theme }) {
|
|
61
|
+
const widgetBtn = {
|
|
62
|
+
'.trbl-wgt-btn': {
|
|
63
|
+
borderRadius: `${theme('borderRadius.full')}`,
|
|
64
|
+
height: '40px',
|
|
65
|
+
width: '40px',
|
|
66
|
+
border: 'none',
|
|
67
|
+
color: '#000',
|
|
68
|
+
background: 'rgba(251,251,251,0.5)',
|
|
69
|
+
overflow: 'hidden',
|
|
70
|
+
cursor: 'pointer',
|
|
71
|
+
transition: 'all 0.16s ease-in-out',
|
|
72
|
+
'&:hover': {
|
|
73
|
+
background: 'rgba(240,240,240,0.75)',
|
|
74
|
+
boxShadow: '0px 0px 4px rgb(0 0 0 / 25%)',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
addComponents(widgetBtn);
|
|
80
|
+
}),
|
|
81
|
+
],
|
|
82
|
+
};
|