@postnord/pn-marketweb-components 2.0.79 → 2.0.81
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/cjs/{MarketWebContextService-5840b8e0.js → FetchHelper-c6cee722.js} +85 -0
- package/cjs/loader.cjs.js +1 -1
- package/cjs/pn-market-web-components.cjs.js +1 -1
- package/cjs/pn-marketweb-sitefooter.cjs.entry.js +2 -3
- package/cjs/pn-marketweb-siteheader.cjs.entry.js +2 -3
- package/cjs/pn-product-card_4.cjs.entry.js +1 -1
- package/cjs/pn-proxio-pricegroup.cjs.entry.js +108 -0
- package/cjs/pn-proxio-productcard_4.cjs.entry.js +67 -0
- package/collection/collection-manifest.json +4 -1
- package/collection/components/minor/pn-titletag/pn-titletag.css +4 -0
- package/collection/components/minor/pn-titletag/title-tag.stories.js +1 -0
- package/collection/components/widgets/pn-proxio-pricegroup/pn-proxio-pricegroup.css +71 -0
- package/collection/components/widgets/pn-proxio-pricegroup/pn-proxio-pricegroup.js +204 -0
- package/collection/components/widgets/pn-proxio-pricegroup/pn-proxio-pricegroup.stories.js +27 -0
- package/collection/components/widgets/pn-proxio-pricegroup/translations.js +16 -0
- package/collection/components/widgets/pn-proxio-pricegroup/types.js +1 -0
- package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard-description.css +6 -0
- package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard-description.js +93 -0
- package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard-information.css +6 -0
- package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard-information.js +67 -0
- package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard-pricelink.css +13 -0
- package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard-pricelink.js +69 -0
- package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard.css +60 -0
- package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard.js +11 -8
- package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard.stories.js +42 -5
- package/custom-elements/index.d.ts +22 -4
- package/custom-elements/index.js +175 -56
- package/esm/{MarketWebContextService-160bf3dd.js → FetchHelper-1dfe8514.js} +85 -1
- package/esm/loader.js +1 -1
- package/esm/pn-market-web-components.js +1 -1
- package/esm/pn-marketweb-sitefooter.entry.js +1 -2
- package/esm/pn-marketweb-siteheader.entry.js +1 -2
- package/esm/pn-product-card_4.entry.js +1 -1
- package/esm/pn-proxio-pricegroup.entry.js +104 -0
- package/esm/pn-proxio-productcard_4.entry.js +60 -0
- package/esm-es5/{MarketWebContextService-160bf3dd.js → FetchHelper-1dfe8514.js} +1 -1
- package/esm-es5/loader.js +1 -1
- package/esm-es5/pn-market-web-components.js +1 -1
- package/esm-es5/pn-marketweb-sitefooter.entry.js +1 -1
- package/esm-es5/pn-marketweb-siteheader.entry.js +1 -1
- package/esm-es5/pn-product-card_4.entry.js +1 -1
- package/esm-es5/pn-proxio-pricegroup.entry.js +1 -0
- package/esm-es5/pn-proxio-productcard_4.entry.js +1 -0
- package/package.json +1 -1
- package/pn-market-web-components/{p-f1812fbb.entry.js → p-022d9a78.entry.js} +1 -1
- package/pn-market-web-components/{p-5b750c06.system.entry.js → p-198d9c77.system.entry.js} +1 -1
- package/pn-market-web-components/p-5482774f.entry.js +1 -0
- package/pn-market-web-components/p-6174a610.system.js +1 -0
- package/pn-market-web-components/p-67887512.system.js +1 -1
- package/pn-market-web-components/p-6c8d3789.system.entry.js +1 -0
- package/pn-market-web-components/p-6d08e5cc.system.entry.js +1 -0
- package/pn-market-web-components/p-942ad206.system.entry.js +1 -0
- package/pn-market-web-components/p-c3ea7666.entry.js +1 -0
- package/pn-market-web-components/p-c5f4d6c1.entry.js +1 -0
- package/pn-market-web-components/p-df9708f2.entry.js +1 -0
- package/pn-market-web-components/p-e54d477c.system.entry.js +1 -0
- package/pn-market-web-components/{p-0a7b7046.js → p-f0f58646.js} +1 -1
- package/pn-market-web-components/pn-market-web-components.esm.js +1 -1
- package/types/components/widgets/pn-proxio-pricegroup/pn-proxio-pricegroup.d.ts +23 -0
- package/types/components/widgets/pn-proxio-pricegroup/translations.d.ts +16 -0
- package/types/components/widgets/pn-proxio-pricegroup/types.d.ts +36 -0
- package/types/components/widgets/pn-proxio-productcard/pn-proxio-productcard-description.d.ts +7 -0
- package/types/components/widgets/pn-proxio-productcard/pn-proxio-productcard-information.d.ts +6 -0
- package/types/components/widgets/pn-proxio-productcard/pn-proxio-productcard-pricelink.d.ts +6 -0
- package/types/components.d.ts +77 -11
- package/umd/pn-marketweb-salesforce.js +4 -2
- package/cjs/FetchHelper-f80943bf.js +0 -87
- package/cjs/pn-proxio-pricefinder.cjs.entry.js +0 -43
- package/cjs/pn-proxio-productcard.cjs.entry.js +0 -19
- package/collection/components/widgets/pn-proxio-pricefinder/pn-proxio-pricefinder.css +0 -0
- package/collection/components/widgets/pn-proxio-pricefinder/pn-proxio-pricefinder.js +0 -98
- package/collection/components/widgets/pn-proxio-pricefinder/pn-proxio-pricefinder.stories.js +0 -22
- package/esm/FetchHelper-a0c8aa54.js +0 -85
- package/esm/pn-proxio-pricefinder.entry.js +0 -39
- package/esm/pn-proxio-productcard.entry.js +0 -15
- package/esm-es5/FetchHelper-a0c8aa54.js +0 -1
- package/esm-es5/pn-proxio-pricefinder.entry.js +0 -1
- package/esm-es5/pn-proxio-productcard.entry.js +0 -1
- package/pn-market-web-components/p-1a97780a.system.js +0 -1
- package/pn-market-web-components/p-2745cc43.entry.js +0 -1
- package/pn-market-web-components/p-2b8aa6a9.entry.js +0 -1
- package/pn-market-web-components/p-42a56aeb.entry.js +0 -1
- package/pn-market-web-components/p-831c0495.system.entry.js +0 -1
- package/pn-market-web-components/p-8985b02b.system.entry.js +0 -1
- package/pn-market-web-components/p-8b9961c9.system.entry.js +0 -1
- package/pn-market-web-components/p-97dc5687.js +0 -1
- package/pn-market-web-components/p-b8e9177e.system.entry.js +0 -1
- package/pn-market-web-components/p-c7afc979.entry.js +0 -1
- package/pn-market-web-components/p-d6a17042.system.js +0 -1
- package/types/components/widgets/pn-proxio-pricefinder/pn-proxio-pricefinder.d.ts +0 -13
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { Component, h, Host, Listen, Prop, State } from "@stencil/core";
|
|
2
|
+
import { FetchHelper } from "../../../globals/FetchHelper";
|
|
3
|
+
import { MarketWebContextService } from "../../../globals/MarketWebContextService";
|
|
4
|
+
import { translations } from "./translations";
|
|
5
|
+
export class PnProxioPricegroup {
|
|
6
|
+
constructor() {
|
|
7
|
+
/** Specifies which endpoint domain we should load from */
|
|
8
|
+
this.endpoint = null;
|
|
9
|
+
this.culture = "sv-se";
|
|
10
|
+
this.tariffid = "";
|
|
11
|
+
this.cache = true;
|
|
12
|
+
this.activeWeightIndex = 0;
|
|
13
|
+
this.data = null;
|
|
14
|
+
this.i18n = translations["sv-se"];
|
|
15
|
+
this.fetchHelper = new FetchHelper("proxiopricegroup");
|
|
16
|
+
}
|
|
17
|
+
componentWillLoad() {
|
|
18
|
+
this.setInitialValues().then(() => {
|
|
19
|
+
this.init();
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async setInitialValues(href = window.location.href) {
|
|
23
|
+
const marketWebContextService = new MarketWebContextService(href);
|
|
24
|
+
const environment = await marketWebContextService.getEnvironmentName();
|
|
25
|
+
if ((!this.endpoint && (environment === null || environment === void 0 ? void 0 : environment.indexOf('local')) === -1)) {
|
|
26
|
+
const market = await marketWebContextService.getMarket();
|
|
27
|
+
this.endpoint = await marketWebContextService.getEndpoint(environment, market);
|
|
28
|
+
}
|
|
29
|
+
if (!this.endpoint) {
|
|
30
|
+
this.endpoint = "";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
init() {
|
|
34
|
+
this.setCulture();
|
|
35
|
+
this.fetchData();
|
|
36
|
+
}
|
|
37
|
+
async fetchData() {
|
|
38
|
+
if (!this.culture || !this.tariffid) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const endpoint = (this.endpoint.lastIndexOf("/") === this.endpoint.length - 1) ? this.endpoint.substring(0, this.endpoint.length - 1) : this.endpoint;
|
|
42
|
+
const fetchUrl = `${endpoint}/api/proxio/price-list-group?tariffId=${this.tariffid}&culture=${this.culture}&cached=${this.cache}`;
|
|
43
|
+
const data = await this.fetchHelper.fetchJson(fetchUrl, {
|
|
44
|
+
'mode': 'cors'
|
|
45
|
+
}, this.cache, this.onFetchData.bind(this));
|
|
46
|
+
if (data === null || data === void 0 ? void 0 : data.proxioProduct) {
|
|
47
|
+
this.data = data;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
onFetchData(data) {
|
|
51
|
+
this.data = data;
|
|
52
|
+
}
|
|
53
|
+
setActiveWeightIndex(weightIndex) {
|
|
54
|
+
var _a, _b, _c;
|
|
55
|
+
let minIndex = 0;
|
|
56
|
+
let maxIndex = (_c = ((_b = (_a = this.data.proxioProduct) === null || _a === void 0 ? void 0 : _a.weightAndPriceList) === null || _b === void 0 ? void 0 : _b.length) - 1) !== null && _c !== void 0 ? _c : minIndex;
|
|
57
|
+
weightIndex = weightIndex > maxIndex ? maxIndex : weightIndex;
|
|
58
|
+
weightIndex = weightIndex < minIndex ? minIndex : weightIndex;
|
|
59
|
+
this.activeWeightIndex = weightIndex;
|
|
60
|
+
}
|
|
61
|
+
setCulture() {
|
|
62
|
+
if (translations[this.culture]) {
|
|
63
|
+
this.i18n = translations[this.culture];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
getPrice(product) {
|
|
67
|
+
var _a;
|
|
68
|
+
return (_a = product === null || product === void 0 ? void 0 : product.weightAndPriceList[this.activeWeightIndex]) === null || _a === void 0 ? void 0 : _a.item2;
|
|
69
|
+
}
|
|
70
|
+
isActive(index) {
|
|
71
|
+
return index === this.activeWeightIndex;
|
|
72
|
+
}
|
|
73
|
+
render() {
|
|
74
|
+
var _a, _b, _c;
|
|
75
|
+
return (h(Host, null, ((_a = this.data) === null || _a === void 0 ? void 0 : _a.proxioProduct) ? (h("div", null,
|
|
76
|
+
h("div", { class: "weightcontainer" }, this.data.proxioProduct.weightAndPriceList ?
|
|
77
|
+
(h("div", { class: "weightvaluecontainer" },
|
|
78
|
+
h("pn-button", { disabled: this.activeWeightIndex === 0 ? ("disabled") : (null), "icon-only": "true", icon: "arrow-left", appearance: "light", small: "true", onClick: () => this.setActiveWeightIndex(this.activeWeightIndex - 1) }),
|
|
79
|
+
h("div", { class: "weightradios" },
|
|
80
|
+
h("div", { class: "weightline" }),
|
|
81
|
+
this.data.proxioProduct.weightAndPriceList.map((weightItem, index) => h("div", { class: "weightdata" + (this.isActive(index) ? (" activeweight") : ("")) },
|
|
82
|
+
h("input", { type: "radio", id: "weightradio" + index, name: "weightradio", value: index, checked: this.isActive(index), onClick: () => this.setActiveWeightIndex(index) }),
|
|
83
|
+
h("label", { htmlFor: "weightradio" + index }, weightItem.item1)))),
|
|
84
|
+
h("pn-button", { disabled: this.activeWeightIndex === ((_c = (_b = this.data.proxioProduct) === null || _b === void 0 ? void 0 : _b.weightAndPriceList) === null || _c === void 0 ? void 0 : _c.length) - 1 ? ("disabled") : (null), icon: "arrow-right", appearance: "light", "icon-only": "true", small: "true", onClick: () => this.setActiveWeightIndex(this.activeWeightIndex + 1) }))) : (null)),
|
|
85
|
+
h("pn-proxio-productcard", null,
|
|
86
|
+
h("h2", { slot: "title" }, this.data.proxioProduct.productTitle),
|
|
87
|
+
h("pn-proxio-productcard-description", { slot: "description", heading: this.data.proxioProduct.productPreamble, highlight: this.data.proxioProduct.deliveryDateInformation, list: this.data.proxioProduct.productDescriptionBulletListItems }),
|
|
88
|
+
h("div", { slot: "information" },
|
|
89
|
+
h("pn-proxio-productcard-information", { label: this.i18n.labelPackage, information: this.data.proxioProduct.productPackageDimensionsList }),
|
|
90
|
+
h("pn-proxio-productcard-information", { label: this.i18n.labelRoll, information: this.data.proxioProduct.productRollDimensionsList })),
|
|
91
|
+
h("div", { slot: "bottomtags" },
|
|
92
|
+
this.data.proxioProduct.tracable ?
|
|
93
|
+
(h("pn-titletag", { color: "gray50" }, this.i18n.notTraceable)) : (null),
|
|
94
|
+
this.data.proxioProduct.usp1 ?
|
|
95
|
+
(h("pn-titletag", { color: "gray50" }, this.data.proxioProduct.usp1)) : (null),
|
|
96
|
+
this.data.proxioProduct.usp2 ?
|
|
97
|
+
(h("pn-titletag", { color: "gray50" }, this.data.proxioProduct.usp2)) : (null),
|
|
98
|
+
this.data.proxioProduct.usp3 ?
|
|
99
|
+
(h("pn-titletag", { color: "gray50" }, this.data.proxioProduct.usp3)) : (null)),
|
|
100
|
+
h("pn-illustration", { slot: "illustration", illustration: this.data.proxioProduct.productIcon }),
|
|
101
|
+
h("div", { slot: "pricelink" },
|
|
102
|
+
h("pn-proxio-productcard-pricelink", { price: this.i18n.from + this.getPrice(this.data.proxioProduct), link: this.data.proxioProduct.productLink, linktext: this.data.proxioProduct.productLinkText }),
|
|
103
|
+
this.data.relatedProxioProducts ? (this.data.relatedProxioProducts.map((product) => (h("pn-proxio-productcard-pricelink", { price: this.i18n.from + this.getPrice(product), link: product.productLink, linktext: product.productLinkText })))) : (null))))) : (null)));
|
|
104
|
+
}
|
|
105
|
+
static get is() { return "pn-proxio-pricegroup"; }
|
|
106
|
+
static get originalStyleUrls() { return {
|
|
107
|
+
"$": ["pn-proxio-pricegroup.scss"]
|
|
108
|
+
}; }
|
|
109
|
+
static get styleUrls() { return {
|
|
110
|
+
"$": ["pn-proxio-pricegroup.css"]
|
|
111
|
+
}; }
|
|
112
|
+
static get properties() { return {
|
|
113
|
+
"endpoint": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"mutable": true,
|
|
116
|
+
"complexType": {
|
|
117
|
+
"original": "string",
|
|
118
|
+
"resolved": "string",
|
|
119
|
+
"references": {}
|
|
120
|
+
},
|
|
121
|
+
"required": false,
|
|
122
|
+
"optional": false,
|
|
123
|
+
"docs": {
|
|
124
|
+
"tags": [],
|
|
125
|
+
"text": "Specifies which endpoint domain we should load from"
|
|
126
|
+
},
|
|
127
|
+
"attribute": "endpoint",
|
|
128
|
+
"reflect": false,
|
|
129
|
+
"defaultValue": "null"
|
|
130
|
+
},
|
|
131
|
+
"culture": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"mutable": false,
|
|
134
|
+
"complexType": {
|
|
135
|
+
"original": "string",
|
|
136
|
+
"resolved": "string",
|
|
137
|
+
"references": {}
|
|
138
|
+
},
|
|
139
|
+
"required": false,
|
|
140
|
+
"optional": false,
|
|
141
|
+
"docs": {
|
|
142
|
+
"tags": [],
|
|
143
|
+
"text": ""
|
|
144
|
+
},
|
|
145
|
+
"attribute": "culture",
|
|
146
|
+
"reflect": false,
|
|
147
|
+
"defaultValue": "\"sv-se\""
|
|
148
|
+
},
|
|
149
|
+
"tariffid": {
|
|
150
|
+
"type": "string",
|
|
151
|
+
"mutable": false,
|
|
152
|
+
"complexType": {
|
|
153
|
+
"original": "string",
|
|
154
|
+
"resolved": "string",
|
|
155
|
+
"references": {}
|
|
156
|
+
},
|
|
157
|
+
"required": false,
|
|
158
|
+
"optional": false,
|
|
159
|
+
"docs": {
|
|
160
|
+
"tags": [],
|
|
161
|
+
"text": ""
|
|
162
|
+
},
|
|
163
|
+
"attribute": "tariffid",
|
|
164
|
+
"reflect": false,
|
|
165
|
+
"defaultValue": "\"\""
|
|
166
|
+
},
|
|
167
|
+
"cache": {
|
|
168
|
+
"type": "boolean",
|
|
169
|
+
"mutable": false,
|
|
170
|
+
"complexType": {
|
|
171
|
+
"original": "boolean",
|
|
172
|
+
"resolved": "boolean",
|
|
173
|
+
"references": {}
|
|
174
|
+
},
|
|
175
|
+
"required": false,
|
|
176
|
+
"optional": false,
|
|
177
|
+
"docs": {
|
|
178
|
+
"tags": [],
|
|
179
|
+
"text": ""
|
|
180
|
+
},
|
|
181
|
+
"attribute": "cache",
|
|
182
|
+
"reflect": false,
|
|
183
|
+
"defaultValue": "true"
|
|
184
|
+
}
|
|
185
|
+
}; }
|
|
186
|
+
static get states() { return {
|
|
187
|
+
"activeWeightIndex": {},
|
|
188
|
+
"data": {},
|
|
189
|
+
"i18n": {}
|
|
190
|
+
}; }
|
|
191
|
+
static get listeners() { return [{
|
|
192
|
+
"name": "activeWeightIndex",
|
|
193
|
+
"method": "setActiveWeightIndex",
|
|
194
|
+
"target": undefined,
|
|
195
|
+
"capture": false,
|
|
196
|
+
"passive": false
|
|
197
|
+
}, {
|
|
198
|
+
"name": "culture",
|
|
199
|
+
"method": "setCulture",
|
|
200
|
+
"target": undefined,
|
|
201
|
+
"capture": false,
|
|
202
|
+
"passive": false
|
|
203
|
+
}]; }
|
|
204
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import readme from "./readme.md";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Proxio/Price group list",
|
|
5
|
+
parameters: {
|
|
6
|
+
notes: readme
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const Template = ({ ...args }) => {
|
|
11
|
+
return `
|
|
12
|
+
<div style="max-width: 67em; margin:1em auto 0;">
|
|
13
|
+
<pn-proxio-pricegroup
|
|
14
|
+
culture="${args.culture}"
|
|
15
|
+
tariffid="${args.tariffId}"
|
|
16
|
+
cache="${args.cache}" >
|
|
17
|
+
</pn-proxio-pricegroup>
|
|
18
|
+
</div>
|
|
19
|
+
`;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Primary = Template.bind({});
|
|
23
|
+
Primary.args = {
|
|
24
|
+
culture: "sv-se",
|
|
25
|
+
tariffId: "7c702ee4-d20c-4b01-aad8-6e5309d59bd0",
|
|
26
|
+
cache: true
|
|
27
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const translations = {
|
|
2
|
+
'sv-se': {
|
|
3
|
+
"from": "Från ",
|
|
4
|
+
"labelRoll": "Rulle",
|
|
5
|
+
"labelPackage": "Paket",
|
|
6
|
+
"notTraceable": "Inte spårbart",
|
|
7
|
+
"Creapest": "Billigast"
|
|
8
|
+
},
|
|
9
|
+
'en-gb': {
|
|
10
|
+
"from": "From ",
|
|
11
|
+
"labelRoll": "Roll",
|
|
12
|
+
"labelPackage": "Package",
|
|
13
|
+
"notTraceable": "Not traceable",
|
|
14
|
+
"Creapest": "Cheapest"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard-description.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Component, h, Prop, Host } from "@stencil/core";
|
|
2
|
+
export class PnProxioProductcardDescription {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.list = [];
|
|
5
|
+
}
|
|
6
|
+
render() {
|
|
7
|
+
return (h(Host, null,
|
|
8
|
+
this.heading ? (h("h3", null, this.heading)) : (null),
|
|
9
|
+
this.highlight ? (h("h3", { class: "highlight" }, this.highlight)) : (null),
|
|
10
|
+
this.description ? (h("span", null, this.description)) : (null),
|
|
11
|
+
this.list ?
|
|
12
|
+
(h("ul", null, this.list.map((text) => {
|
|
13
|
+
return (h("li", null, text));
|
|
14
|
+
})))
|
|
15
|
+
: (null)));
|
|
16
|
+
}
|
|
17
|
+
static get is() { return "pn-proxio-productcard-description"; }
|
|
18
|
+
static get originalStyleUrls() { return {
|
|
19
|
+
"$": ["pn-proxio-productcard-description.scss"]
|
|
20
|
+
}; }
|
|
21
|
+
static get styleUrls() { return {
|
|
22
|
+
"$": ["pn-proxio-productcard-description.css"]
|
|
23
|
+
}; }
|
|
24
|
+
static get properties() { return {
|
|
25
|
+
"heading": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"mutable": false,
|
|
28
|
+
"complexType": {
|
|
29
|
+
"original": "string",
|
|
30
|
+
"resolved": "string",
|
|
31
|
+
"references": {}
|
|
32
|
+
},
|
|
33
|
+
"required": false,
|
|
34
|
+
"optional": false,
|
|
35
|
+
"docs": {
|
|
36
|
+
"tags": [],
|
|
37
|
+
"text": ""
|
|
38
|
+
},
|
|
39
|
+
"attribute": "heading",
|
|
40
|
+
"reflect": false
|
|
41
|
+
},
|
|
42
|
+
"highlight": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"mutable": false,
|
|
45
|
+
"complexType": {
|
|
46
|
+
"original": "string",
|
|
47
|
+
"resolved": "string",
|
|
48
|
+
"references": {}
|
|
49
|
+
},
|
|
50
|
+
"required": false,
|
|
51
|
+
"optional": false,
|
|
52
|
+
"docs": {
|
|
53
|
+
"tags": [],
|
|
54
|
+
"text": ""
|
|
55
|
+
},
|
|
56
|
+
"attribute": "highlight",
|
|
57
|
+
"reflect": false
|
|
58
|
+
},
|
|
59
|
+
"description": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"mutable": false,
|
|
62
|
+
"complexType": {
|
|
63
|
+
"original": "string",
|
|
64
|
+
"resolved": "string",
|
|
65
|
+
"references": {}
|
|
66
|
+
},
|
|
67
|
+
"required": false,
|
|
68
|
+
"optional": false,
|
|
69
|
+
"docs": {
|
|
70
|
+
"tags": [],
|
|
71
|
+
"text": ""
|
|
72
|
+
},
|
|
73
|
+
"attribute": "description",
|
|
74
|
+
"reflect": false
|
|
75
|
+
},
|
|
76
|
+
"list": {
|
|
77
|
+
"type": "unknown",
|
|
78
|
+
"mutable": true,
|
|
79
|
+
"complexType": {
|
|
80
|
+
"original": "string[]",
|
|
81
|
+
"resolved": "string[]",
|
|
82
|
+
"references": {}
|
|
83
|
+
},
|
|
84
|
+
"required": false,
|
|
85
|
+
"optional": false,
|
|
86
|
+
"docs": {
|
|
87
|
+
"tags": [],
|
|
88
|
+
"text": ""
|
|
89
|
+
},
|
|
90
|
+
"defaultValue": "[]"
|
|
91
|
+
}
|
|
92
|
+
}; }
|
|
93
|
+
}
|
package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard-information.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Component, h, Prop, Host } from "@stencil/core";
|
|
2
|
+
export class PnProxioProductcardInformation {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.information = [];
|
|
5
|
+
}
|
|
6
|
+
render() {
|
|
7
|
+
return (h(Host, null,
|
|
8
|
+
h("div", { class: "cardinfocontent" }, this.information && this.label ? (h("div", { class: "cardinfocontent-item" },
|
|
9
|
+
h("p", null,
|
|
10
|
+
h("strong", null, this.label)),
|
|
11
|
+
this.information.map((item) => (item ?
|
|
12
|
+
(h("p", null,
|
|
13
|
+
h("strong", { class: "label" },
|
|
14
|
+
item.item1,
|
|
15
|
+
":"),
|
|
16
|
+
" ",
|
|
17
|
+
item.item2))
|
|
18
|
+
: (null))))) : null)));
|
|
19
|
+
}
|
|
20
|
+
static get is() { return "pn-proxio-productcard-information"; }
|
|
21
|
+
static get originalStyleUrls() { return {
|
|
22
|
+
"$": ["pn-proxio-productcard-information.scss"]
|
|
23
|
+
}; }
|
|
24
|
+
static get styleUrls() { return {
|
|
25
|
+
"$": ["pn-proxio-productcard-information.css"]
|
|
26
|
+
}; }
|
|
27
|
+
static get properties() { return {
|
|
28
|
+
"label": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"mutable": false,
|
|
31
|
+
"complexType": {
|
|
32
|
+
"original": "string",
|
|
33
|
+
"resolved": "string",
|
|
34
|
+
"references": {}
|
|
35
|
+
},
|
|
36
|
+
"required": false,
|
|
37
|
+
"optional": false,
|
|
38
|
+
"docs": {
|
|
39
|
+
"tags": [],
|
|
40
|
+
"text": ""
|
|
41
|
+
},
|
|
42
|
+
"attribute": "label",
|
|
43
|
+
"reflect": false
|
|
44
|
+
},
|
|
45
|
+
"information": {
|
|
46
|
+
"type": "unknown",
|
|
47
|
+
"mutable": false,
|
|
48
|
+
"complexType": {
|
|
49
|
+
"original": "ProductGenericItem[]",
|
|
50
|
+
"resolved": "ProductGenericItem[]",
|
|
51
|
+
"references": {
|
|
52
|
+
"ProductGenericItem": {
|
|
53
|
+
"location": "import",
|
|
54
|
+
"path": "../pn-proxio-pricegroup/types"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"required": false,
|
|
59
|
+
"optional": false,
|
|
60
|
+
"docs": {
|
|
61
|
+
"tags": [],
|
|
62
|
+
"text": ""
|
|
63
|
+
},
|
|
64
|
+
"defaultValue": "[]"
|
|
65
|
+
}
|
|
66
|
+
}; }
|
|
67
|
+
}
|
package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard-pricelink.css
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
pn-proxio-productcard-pricelink {
|
|
2
|
+
align-self: center;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
align-items: center;
|
|
6
|
+
margin: 2rem 1rem;
|
|
7
|
+
gap: 1rem;
|
|
8
|
+
align-content: center;
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
}
|
|
11
|
+
pn-proxio-productcard-pricelink pn-button {
|
|
12
|
+
min-width: 17rem;
|
|
13
|
+
}
|
package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard-pricelink.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Component, h, Prop, Host } from "@stencil/core";
|
|
2
|
+
export class PnProxioProductcardPricelink {
|
|
3
|
+
render() {
|
|
4
|
+
return this.link && this.linktext ?
|
|
5
|
+
(h(Host, null,
|
|
6
|
+
this.price ? (h("h2", null, this.price)) : (null),
|
|
7
|
+
h("pn-button", { small: "true", icon: "arrow-right", appearance: "light", href: this.link, target: "_blank", rel: "noopener nofollower noreferrer" }, this.linktext))) : (null);
|
|
8
|
+
}
|
|
9
|
+
static get is() { return "pn-proxio-productcard-pricelink"; }
|
|
10
|
+
static get originalStyleUrls() { return {
|
|
11
|
+
"$": ["pn-proxio-productcard-pricelink.scss"]
|
|
12
|
+
}; }
|
|
13
|
+
static get styleUrls() { return {
|
|
14
|
+
"$": ["pn-proxio-productcard-pricelink.css"]
|
|
15
|
+
}; }
|
|
16
|
+
static get properties() { return {
|
|
17
|
+
"price": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"mutable": false,
|
|
20
|
+
"complexType": {
|
|
21
|
+
"original": "string",
|
|
22
|
+
"resolved": "string",
|
|
23
|
+
"references": {}
|
|
24
|
+
},
|
|
25
|
+
"required": false,
|
|
26
|
+
"optional": false,
|
|
27
|
+
"docs": {
|
|
28
|
+
"tags": [],
|
|
29
|
+
"text": ""
|
|
30
|
+
},
|
|
31
|
+
"attribute": "price",
|
|
32
|
+
"reflect": false
|
|
33
|
+
},
|
|
34
|
+
"link": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"mutable": false,
|
|
37
|
+
"complexType": {
|
|
38
|
+
"original": "string",
|
|
39
|
+
"resolved": "string",
|
|
40
|
+
"references": {}
|
|
41
|
+
},
|
|
42
|
+
"required": false,
|
|
43
|
+
"optional": false,
|
|
44
|
+
"docs": {
|
|
45
|
+
"tags": [],
|
|
46
|
+
"text": ""
|
|
47
|
+
},
|
|
48
|
+
"attribute": "link",
|
|
49
|
+
"reflect": false
|
|
50
|
+
},
|
|
51
|
+
"linktext": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"mutable": false,
|
|
54
|
+
"complexType": {
|
|
55
|
+
"original": "string",
|
|
56
|
+
"resolved": "string",
|
|
57
|
+
"references": {}
|
|
58
|
+
},
|
|
59
|
+
"required": false,
|
|
60
|
+
"optional": false,
|
|
61
|
+
"docs": {
|
|
62
|
+
"tags": [],
|
|
63
|
+
"text": ""
|
|
64
|
+
},
|
|
65
|
+
"attribute": "linktext",
|
|
66
|
+
"reflect": false
|
|
67
|
+
}
|
|
68
|
+
}; }
|
|
69
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
pn-proxio-productcard .cardcontent {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: row;
|
|
4
|
+
border: solid 0.1rem #F9F8F8;
|
|
5
|
+
border-radius: 0.8rem;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
margin-left: auto;
|
|
8
|
+
margin-right: auto;
|
|
9
|
+
margin-bottom: 1.6rem;
|
|
10
|
+
}
|
|
11
|
+
pn-proxio-productcard .carddetails {
|
|
12
|
+
min-width: 70%;
|
|
13
|
+
padding: 2rem;
|
|
14
|
+
display: flex;
|
|
15
|
+
gap: 1rem;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
}
|
|
18
|
+
pn-proxio-productcard .cardcalltoactions {
|
|
19
|
+
min-width: 30%;
|
|
20
|
+
background-color: #EFFBFF;
|
|
21
|
+
padding: 1rem;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
align-content: center;
|
|
26
|
+
}
|
|
27
|
+
pn-proxio-productcard .cardcalltoactions pn-illustration[slot=illustration] .pn-illustration {
|
|
28
|
+
max-width: 10rem;
|
|
29
|
+
margin-left: auto;
|
|
30
|
+
margin-right: auto;
|
|
31
|
+
}
|
|
32
|
+
pn-proxio-productcard [slot=information] {
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: 1rem;
|
|
35
|
+
}
|
|
36
|
+
pn-proxio-productcard [slot=uppertags] {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: row;
|
|
39
|
+
flex-wrap: nowrap;
|
|
40
|
+
justify-content: flex-start;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: 2rem;
|
|
43
|
+
}
|
|
44
|
+
pn-proxio-productcard [slot=bottomtags] {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: row;
|
|
47
|
+
flex-wrap: nowrap;
|
|
48
|
+
justify-content: flex-start;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: 2rem;
|
|
51
|
+
margin: 1rem 0;
|
|
52
|
+
}
|
|
53
|
+
pn-proxio-productcard .heading {
|
|
54
|
+
display: flex;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
flex-direction: row;
|
|
57
|
+
}
|
|
58
|
+
pn-proxio-productcard [slot=title] {
|
|
59
|
+
text-decoration: underline;
|
|
60
|
+
}
|
|
@@ -2,14 +2,17 @@ import { Component, h, Host } from "@stencil/core";
|
|
|
2
2
|
export class PnProxioProductcard {
|
|
3
3
|
render() {
|
|
4
4
|
return (h(Host, null,
|
|
5
|
-
h("
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
h("slot", { name: "
|
|
12
|
-
|
|
5
|
+
h("div", { class: "cardcontent" },
|
|
6
|
+
h("div", { class: "carddetails" },
|
|
7
|
+
h("div", { class: "heading" },
|
|
8
|
+
h("slot", { name: "title" }),
|
|
9
|
+
h("slot", { name: "uppertags" })),
|
|
10
|
+
h("slot", { name: "description" }),
|
|
11
|
+
h("slot", { name: "information" }),
|
|
12
|
+
h("slot", { name: "bottomtags" })),
|
|
13
|
+
h("div", { class: "cardcalltoactions" },
|
|
14
|
+
h("slot", { name: "illustration" }),
|
|
15
|
+
h("slot", { name: "pricelink" })))));
|
|
13
16
|
}
|
|
14
17
|
static get is() { return "pn-proxio-productcard"; }
|
|
15
18
|
static get originalStyleUrls() { return {
|
package/collection/components/widgets/pn-proxio-productcard/pn-proxio-productcard.stories.js
CHANGED
|
@@ -3,15 +3,34 @@ import readme from "./readme.md";
|
|
|
3
3
|
export default {
|
|
4
4
|
title: "Proxio/Product card",
|
|
5
5
|
parameters: {
|
|
6
|
-
|
|
6
|
+
notes: readme
|
|
7
7
|
}
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
const Template = ({ ...args }) => {
|
|
11
11
|
return `
|
|
12
|
-
<div style="max-width:
|
|
13
|
-
<pn-proxio-productcard
|
|
14
|
-
|
|
12
|
+
<div style="max-width: 67em; margin:1em auto 0;">
|
|
13
|
+
<pn-proxio-productcard>
|
|
14
|
+
<h2 slot="title">${args.heading}</h2>
|
|
15
|
+
<div slot="uppertags">
|
|
16
|
+
<pn-titletag icon="box-label" color="green700">${args.uppertag}</pn-titletag>
|
|
17
|
+
</div>
|
|
18
|
+
<pn-proxio-productcard-description slot="description" heading="${args.description}" highlight="${args.highlight}" list="${args.list}" ></pn-proxio-productcard-description>
|
|
19
|
+
<div slot="information">
|
|
20
|
+
<pn-proxio-productcard-information label="${args.paketlabel}" information="${args.paket}" ></pn-proxio-productcard-information>
|
|
21
|
+
<pn-proxio-productcard-information label="${args.rullelabel}" information="${args.rulle}" ></pn-proxio-productcard-information>
|
|
22
|
+
</div>
|
|
23
|
+
<div slot="bottomtags">
|
|
24
|
+
<pn-titletag color="gray50">${args.traceable}</pn-titletag>
|
|
25
|
+
<pn-titletag color="gray50">${args.usp1}</pn-titletag>
|
|
26
|
+
<pn-titletag color="gray50">${args.usp2}</pn-titletag>
|
|
27
|
+
<pn-titletag color="gray50">${args.usp3}</pn-titletag>
|
|
28
|
+
</div>
|
|
29
|
+
<pn-illustration slot="illustration" illustration="${args.illustration}" ></pn-illustration>
|
|
30
|
+
<div slot="pricelink">
|
|
31
|
+
<pn-proxio-productcard-pricelink price="${args.price1}" link="${args.link}" linktext="${args.linktext1}" ></pn-proxio-productcard-pricelink>
|
|
32
|
+
<pn-proxio-productcard-pricelink price="${args.price2}" link="${args.link}" linktext="${args.linktext2}" ></pn-proxio-productcard-pricelink>
|
|
33
|
+
</div>
|
|
15
34
|
</pn-proxio-productcard>
|
|
16
35
|
</div>
|
|
17
36
|
`;
|
|
@@ -19,5 +38,23 @@ const Template = ({ ...args }) => {
|
|
|
19
38
|
|
|
20
39
|
export const Primary = Template.bind({});
|
|
21
40
|
Primary.args = {
|
|
22
|
-
|
|
41
|
+
heading: "Brev",
|
|
42
|
+
description: "Skicka brev som väger upp till 2 kilo",
|
|
43
|
+
highlight: "Leverans senast 2 juni 2022",
|
|
44
|
+
list: ["Portot betalas med frimärken eller med portkod (digitalt frimärke)", "Levereras till postlåda om det får plats, annars till serviceställe", "Postas i någon av våra brevlådor eller lämnas in hos ett postombud."],
|
|
45
|
+
paketlabel: "Paket:",
|
|
46
|
+
paket: [{ item1: "Längd:", item2: "Max XX cm" }, { item1: "Längd + bredd + höjd:", item2: "Max XX cm" }],
|
|
47
|
+
rullelabel: "Rulle:",
|
|
48
|
+
rulle: [{ item1:"Längd:", item2:"Max XX cm" }, { item1:"Längd + bredd + höjd:", item2:"Max XX cm" }],
|
|
49
|
+
price1: "från 14 kronor",
|
|
50
|
+
price2: "från 13 kronor",
|
|
51
|
+
link: "www.google.com",
|
|
52
|
+
linktext1: "Köp portkod",
|
|
53
|
+
linktext2: "Till butiken",
|
|
54
|
+
uppertag: "Billigast",
|
|
55
|
+
traceable: "Inte spårbart",
|
|
56
|
+
usp1: "usp1",
|
|
57
|
+
usp2: "usp2",
|
|
58
|
+
usp3: "usp3",
|
|
59
|
+
illustration: "hand-letter-stamp"
|
|
23
60
|
};
|