@gem-sdk/plugin-quick-view 1.11.1-experimental-8f483e48 → 1.11.1-experimental-d7cbfa75
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/QuickView.d.ts +9 -0
- package/dist/components/QuickView.d.ts.map +1 -0
- package/dist/components/QuickView.js +64 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/setting/QuickView.d.ts +5 -0
- package/dist/setting/QuickView.d.ts.map +1 -0
- package/dist/{esm/setting → setting}/QuickView.js +1 -2
- package/dist/setting/index.d.ts +5 -0
- package/dist/setting/index.d.ts.map +1 -0
- package/dist/setting/index.js +2 -0
- package/package.json +8 -16
- package/dist/cjs/components/QuickView.js +0 -70
- package/dist/cjs/index.js +0 -11
- package/dist/cjs/setting/QuickView.js +0 -10
- package/dist/cjs/setting/index.js +0 -9
- package/dist/esm/components/QuickView.js +0 -66
- package/dist/esm/index.js +0 -6
- package/dist/esm/setting/index.js +0 -5
- package/dist/types/index.d.ts +0 -13
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import type { BaseProps } from '@gem-sdk/core';
|
|
4
|
+
export type ProductQuickViewProps = BaseProps<{
|
|
5
|
+
label?: React.ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
declare const ProductQuickView: React.FC<ProductQuickViewProps>;
|
|
8
|
+
export default ProductQuickView;
|
|
9
|
+
//# sourceMappingURL=QuickView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuickView.d.ts","sourceRoot":"","sources":["../../src/components/QuickView.tsx"],"names":[],"mappings":";;AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,MAAM,MAAM,qBAAqB,GAAG,SAAS,CAAC;IAC5C,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzB,CAAC,CAAC;AA6GH,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAsBrD,CAAC;AAMF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Col, Modal, ProductButton, ProductImages, ProductPrice, ProductQuantity, ProductTitle, ProductVariants, Row, } from '@gem-sdk/components';
|
|
4
|
+
import { ProductProvider, usePluginEnable, useProduct, useProductQuery } from '@gem-sdk/core';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
const ModalContent = () => {
|
|
7
|
+
const product = useProduct();
|
|
8
|
+
const { data, isLoading: loading, error } = useProductQuery(product === null || product === void 0 ? void 0 : product.id);
|
|
9
|
+
if (loading)
|
|
10
|
+
return (_jsx("div", { children: _jsxs("svg", Object.assign({ className: "mx-auto my-20 h-8 w-8 animate-spin", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24" }, { children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] })) }));
|
|
11
|
+
if (error)
|
|
12
|
+
return _jsx("p", Object.assign({ className: "py-20 text-center font-semibold" }, { children: "Something went wrong" }));
|
|
13
|
+
return (_jsx(ProductProvider, Object.assign({ product: data }, { children: _jsxs(Row, Object.assign({ setting: {
|
|
14
|
+
layout: {
|
|
15
|
+
desktop: {
|
|
16
|
+
cols: [6, 6],
|
|
17
|
+
display: 'fill',
|
|
18
|
+
},
|
|
19
|
+
mobile: {
|
|
20
|
+
cols: [12],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
} }, { children: [_jsx(Col, { children: _jsx(ProductImages, {}) }), _jsxs(Col, { children: [_jsx(ProductTitle, { setting: {
|
|
24
|
+
htmlTag: 'p',
|
|
25
|
+
}, styles: {
|
|
26
|
+
typography: {
|
|
27
|
+
type: 'heading-3',
|
|
28
|
+
},
|
|
29
|
+
} }), _jsxs(Row, Object.assign({ setting: {
|
|
30
|
+
layout: {
|
|
31
|
+
desktop: {
|
|
32
|
+
cols: [6, 6],
|
|
33
|
+
display: 'fit',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
horizontalAlign: {
|
|
37
|
+
desktop: 'end',
|
|
38
|
+
},
|
|
39
|
+
} }, { children: [_jsx(Col, { children: _jsx(ProductPrice, { styles: {
|
|
40
|
+
typography: {
|
|
41
|
+
type: 'subheading-2',
|
|
42
|
+
},
|
|
43
|
+
}, setting: {
|
|
44
|
+
priceType: 'regular',
|
|
45
|
+
} }) }), _jsx(Col, { children: _jsx(ProductPrice, { styles: {
|
|
46
|
+
typography: {
|
|
47
|
+
type: 'paragraph-2',
|
|
48
|
+
},
|
|
49
|
+
}, setting: {
|
|
50
|
+
priceType: 'compare',
|
|
51
|
+
} }) })] })), _jsx(ProductVariants, {}), _jsx(ProductQuantity, {}), _jsx(ProductButton, { setting: { actionEffect: 'open-cart-drawer' } })] })] })) })));
|
|
52
|
+
};
|
|
53
|
+
const ProductQuickView = ({ setting }) => {
|
|
54
|
+
const [open, setOpen] = useState(false);
|
|
55
|
+
const plugins = usePluginEnable();
|
|
56
|
+
if (!(plugins === null || plugins === void 0 ? void 0 : plugins.includes('quick-view'))) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return (_jsxs("div", { children: [_jsx("div", Object.assign({ "aria-hidden": true, role: "button", "aria-label": "Quick view", onClick: () => setOpen((prev) => !prev) }, { children: setting === null || setting === void 0 ? void 0 : setting.label })), _jsx(Modal, Object.assign({ setting: { open }, closeOnClickOutside: true, onClose: () => setOpen((prev) => !prev) }, { children: _jsx(ModalContent, {}) }))] }));
|
|
60
|
+
};
|
|
61
|
+
ProductQuickView.defaultProps = {
|
|
62
|
+
setting: { label: 'Quick View' },
|
|
63
|
+
};
|
|
64
|
+
export default ProductQuickView;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAE/C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,WAAW,CAAC;AAEtD,eAAe,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuickView.d.ts","sourceRoot":"","sources":["../../src/setting/QuickView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,QAAA,MAAM,MAAM,EAAE,gBAAgB,CAAC,qBAAqB,CAGnD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/setting/index.ts"],"names":[],"mappings":";;;AAEA,wBAA6B"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/plugin-quick-view",
|
|
3
|
-
"version": "1.11.1-experimental-
|
|
3
|
+
"version": "1.11.1-experimental-d7cbfa75",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
|
-
"main": "dist/
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
7
8
|
"files": [
|
|
8
9
|
"dist"
|
|
9
10
|
],
|
|
@@ -13,28 +14,19 @@
|
|
|
13
14
|
"pre:publish": "node ./../../helpers/convert-publish.js -p",
|
|
14
15
|
"post:publish": "node ./../../helpers/convert-publish.js",
|
|
15
16
|
"watch": "rollup -c ./../../helpers/rollup.config.mjs -w",
|
|
16
|
-
"build": "rollup -c ./../../helpers/rollup.config.mjs --environment NODE_ENV:production",
|
|
17
|
+
"build:rollup": "rollup -c ./../../helpers/rollup.config.mjs --environment NODE_ENV:production",
|
|
18
|
+
"build": "tsc -p tsconfig.build.json",
|
|
17
19
|
"lint": "eslint ./src --ext .tsx,.ts",
|
|
18
20
|
"type-check": "yarn tsc --noEmit",
|
|
19
21
|
"test": "jest -c ./../../helpers/jest.config.ts"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
22
|
-
"@gem-sdk/components": "1.12.0-experimental-
|
|
23
|
-
"@gem-sdk/core": "1.12.0-experimental-
|
|
24
|
-
"@gem-sdk/styles": "1.12.0-experimental-
|
|
24
|
+
"@gem-sdk/components": "1.12.0-experimental-d7cbfa75",
|
|
25
|
+
"@gem-sdk/core": "1.12.0-experimental-d7cbfa75",
|
|
26
|
+
"@gem-sdk/styles": "1.12.0-experimental-d7cbfa75"
|
|
25
27
|
},
|
|
26
28
|
"peerDependencies": {
|
|
27
29
|
"react": "^17 || ^18",
|
|
28
30
|
"react-dom": "^17 || ^18"
|
|
29
|
-
},
|
|
30
|
-
"module": "dist/esm/index.js",
|
|
31
|
-
"types": "dist/types/index.d.ts",
|
|
32
|
-
"exports": {
|
|
33
|
-
"./package.json": "./package.json",
|
|
34
|
-
".": {
|
|
35
|
-
"import": "./dist/esm/index.js",
|
|
36
|
-
"require": "./dist/cjs/index.js",
|
|
37
|
-
"types": "./dist/types/index.d.ts"
|
|
38
|
-
}
|
|
39
31
|
}
|
|
40
32
|
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var components = require('@gem-sdk/components');
|
|
8
|
-
var core = require('@gem-sdk/core');
|
|
9
|
-
var react = require('react');
|
|
10
|
-
|
|
11
|
-
const ModalContent = () => {
|
|
12
|
-
const product = core.useProduct();
|
|
13
|
-
const { data, isLoading: loading, error } = core.useProductQuery(product?.id);
|
|
14
|
-
if (loading)
|
|
15
|
-
return (jsxRuntime.jsx("div", { children: jsxRuntime.jsxs("svg", { className: "mx-auto my-20 h-8 w-8 animate-spin", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [jsxRuntime.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), jsxRuntime.jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }) }));
|
|
16
|
-
if (error)
|
|
17
|
-
return jsxRuntime.jsx("p", { className: "py-20 text-center font-semibold", children: "Something went wrong" });
|
|
18
|
-
return (jsxRuntime.jsx(core.ProductProvider, { product: data, children: jsxRuntime.jsxs(components.Row, { setting: {
|
|
19
|
-
layout: {
|
|
20
|
-
desktop: {
|
|
21
|
-
cols: [6, 6],
|
|
22
|
-
display: 'fill',
|
|
23
|
-
},
|
|
24
|
-
mobile: {
|
|
25
|
-
cols: [12],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
}, children: [jsxRuntime.jsx(components.Col, { children: jsxRuntime.jsx(components.ProductImages, {}) }), jsxRuntime.jsxs(components.Col, { children: [jsxRuntime.jsx(components.ProductTitle, { setting: {
|
|
29
|
-
htmlTag: 'p',
|
|
30
|
-
}, styles: {
|
|
31
|
-
typography: {
|
|
32
|
-
type: 'heading-3',
|
|
33
|
-
},
|
|
34
|
-
} }), jsxRuntime.jsxs(components.Row, { setting: {
|
|
35
|
-
layout: {
|
|
36
|
-
desktop: {
|
|
37
|
-
cols: [6, 6],
|
|
38
|
-
display: 'fit',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
horizontalAlign: {
|
|
42
|
-
desktop: 'end',
|
|
43
|
-
},
|
|
44
|
-
}, children: [jsxRuntime.jsx(components.Col, { children: jsxRuntime.jsx(components.ProductPrice, { styles: {
|
|
45
|
-
typography: {
|
|
46
|
-
type: 'subheading-2',
|
|
47
|
-
},
|
|
48
|
-
}, setting: {
|
|
49
|
-
priceType: 'regular',
|
|
50
|
-
} }) }), jsxRuntime.jsx(components.Col, { children: jsxRuntime.jsx(components.ProductPrice, { styles: {
|
|
51
|
-
typography: {
|
|
52
|
-
type: 'paragraph-2',
|
|
53
|
-
},
|
|
54
|
-
}, setting: {
|
|
55
|
-
priceType: 'compare',
|
|
56
|
-
} }) })] }), jsxRuntime.jsx(components.ProductVariants, {}), jsxRuntime.jsx(components.ProductQuantity, {}), jsxRuntime.jsx(components.ProductButton, { setting: { actionEffect: 'open-cart-drawer' } })] })] }) }));
|
|
57
|
-
};
|
|
58
|
-
const ProductQuickView = ({ setting }) => {
|
|
59
|
-
const [open, setOpen] = react.useState(false);
|
|
60
|
-
const plugins = core.usePluginEnable();
|
|
61
|
-
if (!plugins?.includes('quick-view')) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { "aria-hidden": true, role: "button", "aria-label": "Quick view", onClick: () => setOpen((prev) => !prev), children: setting?.label }), jsxRuntime.jsx(components.Modal, { setting: { open }, closeOnClickOutside: true, onClose: () => setOpen((prev) => !prev), children: jsxRuntime.jsx(ModalContent, {}) })] }));
|
|
65
|
-
};
|
|
66
|
-
ProductQuickView.defaultProps = {
|
|
67
|
-
setting: { label: 'Quick View' },
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
exports.default = ProductQuickView;
|
package/dist/cjs/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var QuickView = require('./components/QuickView.js');
|
|
6
|
-
var index = require('./setting/index.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.default = QuickView.default;
|
|
11
|
-
exports.builderSetting = index.default;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { Modal, Row, Col, ProductImages, ProductTitle, ProductPrice, ProductVariants, ProductQuantity, ProductButton } from '@gem-sdk/components';
|
|
4
|
-
import { usePluginEnable, useProduct, useProductQuery, ProductProvider } from '@gem-sdk/core';
|
|
5
|
-
import { useState } from 'react';
|
|
6
|
-
|
|
7
|
-
const ModalContent = () => {
|
|
8
|
-
const product = useProduct();
|
|
9
|
-
const { data, isLoading: loading, error } = useProductQuery(product?.id);
|
|
10
|
-
if (loading)
|
|
11
|
-
return (jsx("div", { children: jsxs("svg", { className: "mx-auto my-20 h-8 w-8 animate-spin", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }) }));
|
|
12
|
-
if (error)
|
|
13
|
-
return jsx("p", { className: "py-20 text-center font-semibold", children: "Something went wrong" });
|
|
14
|
-
return (jsx(ProductProvider, { product: data, children: jsxs(Row, { setting: {
|
|
15
|
-
layout: {
|
|
16
|
-
desktop: {
|
|
17
|
-
cols: [6, 6],
|
|
18
|
-
display: 'fill',
|
|
19
|
-
},
|
|
20
|
-
mobile: {
|
|
21
|
-
cols: [12],
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
}, children: [jsx(Col, { children: jsx(ProductImages, {}) }), jsxs(Col, { children: [jsx(ProductTitle, { setting: {
|
|
25
|
-
htmlTag: 'p',
|
|
26
|
-
}, styles: {
|
|
27
|
-
typography: {
|
|
28
|
-
type: 'heading-3',
|
|
29
|
-
},
|
|
30
|
-
} }), jsxs(Row, { setting: {
|
|
31
|
-
layout: {
|
|
32
|
-
desktop: {
|
|
33
|
-
cols: [6, 6],
|
|
34
|
-
display: 'fit',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
horizontalAlign: {
|
|
38
|
-
desktop: 'end',
|
|
39
|
-
},
|
|
40
|
-
}, children: [jsx(Col, { children: jsx(ProductPrice, { styles: {
|
|
41
|
-
typography: {
|
|
42
|
-
type: 'subheading-2',
|
|
43
|
-
},
|
|
44
|
-
}, setting: {
|
|
45
|
-
priceType: 'regular',
|
|
46
|
-
} }) }), jsx(Col, { children: jsx(ProductPrice, { styles: {
|
|
47
|
-
typography: {
|
|
48
|
-
type: 'paragraph-2',
|
|
49
|
-
},
|
|
50
|
-
}, setting: {
|
|
51
|
-
priceType: 'compare',
|
|
52
|
-
} }) })] }), jsx(ProductVariants, {}), jsx(ProductQuantity, {}), jsx(ProductButton, { setting: { actionEffect: 'open-cart-drawer' } })] })] }) }));
|
|
53
|
-
};
|
|
54
|
-
const ProductQuickView = ({ setting }) => {
|
|
55
|
-
const [open, setOpen] = useState(false);
|
|
56
|
-
const plugins = usePluginEnable();
|
|
57
|
-
if (!plugins?.includes('quick-view')) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
return (jsxs("div", { children: [jsx("div", { "aria-hidden": true, role: "button", "aria-label": "Quick view", onClick: () => setOpen((prev) => !prev), children: setting?.label }), jsx(Modal, { setting: { open }, closeOnClickOutside: true, onClose: () => setOpen((prev) => !prev), children: jsx(ModalContent, {}) })] }));
|
|
61
|
-
};
|
|
62
|
-
ProductQuickView.defaultProps = {
|
|
63
|
-
setting: { label: 'Quick View' },
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export { ProductQuickView as default };
|
package/dist/esm/index.js
DELETED
package/dist/types/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as _gem_sdk_core from '@gem-sdk/core';
|
|
2
|
-
import { BaseProps } from '@gem-sdk/core';
|
|
3
|
-
|
|
4
|
-
type ProductQuickViewProps = BaseProps<{
|
|
5
|
-
label?: React.ReactNode;
|
|
6
|
-
}>;
|
|
7
|
-
declare const ProductQuickView: React.FC<ProductQuickViewProps>;
|
|
8
|
-
|
|
9
|
-
declare const _default: {
|
|
10
|
-
QuickView: _gem_sdk_core.ComponentSetting<ProductQuickViewProps>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export { _default as builderSetting, ProductQuickView as default };
|