@financial-times/n-conversion-forms 27.3.3 → 27.4.0
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.
|
@@ -10,6 +10,8 @@ exports[`DeliveryAddressType renders with all props 1`] = `
|
|
|
10
10
|
<span class="o-forms-title__main">
|
|
11
11
|
Address type
|
|
12
12
|
</span>
|
|
13
|
+
<span class="o-forms-title__prompt">
|
|
14
|
+
</span>
|
|
13
15
|
</span>
|
|
14
16
|
<div class="o-forms-input o-forms-input--inline o-forms-input--radio-round">
|
|
15
17
|
<label for="home"
|
|
@@ -72,6 +74,8 @@ exports[`DeliveryAddressType renders with default props 1`] = `
|
|
|
72
74
|
<span class="o-forms-title__main">
|
|
73
75
|
Address type
|
|
74
76
|
</span>
|
|
77
|
+
<span class="o-forms-title__prompt">
|
|
78
|
+
</span>
|
|
75
79
|
</span>
|
|
76
80
|
<div class="o-forms-input o-forms-input--inline o-forms-input--radio-round">
|
|
77
81
|
<label for="home"
|
|
@@ -13,6 +13,7 @@ export function DeliveryAddressType ({
|
|
|
13
13
|
inputName = 'deliveryAddressType',
|
|
14
14
|
options = ['home', 'company', 'pobox'],
|
|
15
15
|
editMode = false,
|
|
16
|
+
titlePrompt = ''
|
|
16
17
|
}) {
|
|
17
18
|
return (
|
|
18
19
|
<div
|
|
@@ -23,6 +24,7 @@ export function DeliveryAddressType ({
|
|
|
23
24
|
>
|
|
24
25
|
<span className="o-forms-title">
|
|
25
26
|
<span className="o-forms-title__main">Address type</span>
|
|
27
|
+
<span className="o-forms-title__prompt">{titlePrompt}</span>
|
|
26
28
|
</span>
|
|
27
29
|
|
|
28
30
|
<div className="o-forms-input o-forms-input--inline o-forms-input--radio-round">
|
|
@@ -59,4 +61,5 @@ DeliveryAddressType.propTypes = {
|
|
|
59
61
|
inputName: PropTypes.string,
|
|
60
62
|
value: PropTypes.oneOf(['home', 'company', 'pobox']),
|
|
61
63
|
options: PropTypes.arrayOf(PropTypes.oneOf(['home', 'company', 'pobox'])),
|
|
64
|
+
titlePrompt:PropTypes.string,
|
|
62
65
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { countriesSupportedISO } from '../helpers/supportedCountries';
|
|
4
|
+
import { countriesSupportedISO, identifyFTShippingZone } from '../helpers/supportedCountries';
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
export function DeliveryCity ({
|
|
@@ -22,8 +22,14 @@ export function DeliveryCity ({
|
|
|
22
22
|
CAN: 'e.g. Montreal',
|
|
23
23
|
ARE: 'e.g. Dubai'
|
|
24
24
|
};
|
|
25
|
+
const FTShippingZone = identifyFTShippingZone(country);
|
|
25
26
|
|
|
26
|
-
const
|
|
27
|
+
const labelMapping = {
|
|
28
|
+
ARE: 'Emirate or City',
|
|
29
|
+
APAC: 'City/Prefecture',
|
|
30
|
+
DEFAULT: 'City',
|
|
31
|
+
};
|
|
32
|
+
const inputLabel = labelMapping[FTShippingZone] ? labelMapping[FTShippingZone] : labelMapping['DEFAULT'];
|
|
27
33
|
|
|
28
34
|
return (
|
|
29
35
|
<label
|
|
@@ -32,7 +32,9 @@ function DeliveryAddressType(_ref) {
|
|
|
32
32
|
_ref$options = _ref.options,
|
|
33
33
|
options = _ref$options === void 0 ? ['home', 'company', 'pobox'] : _ref$options,
|
|
34
34
|
_ref$editMode = _ref.editMode,
|
|
35
|
-
editMode = _ref$editMode === void 0 ? false : _ref$editMode
|
|
35
|
+
editMode = _ref$editMode === void 0 ? false : _ref$editMode,
|
|
36
|
+
_ref$titlePrompt = _ref.titlePrompt,
|
|
37
|
+
titlePrompt = _ref$titlePrompt === void 0 ? '' : _ref$titlePrompt;
|
|
36
38
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
37
39
|
id: fieldId,
|
|
38
40
|
className: "o-forms-field ncf__delivery-address-type",
|
|
@@ -42,7 +44,9 @@ function DeliveryAddressType(_ref) {
|
|
|
42
44
|
className: "o-forms-title"
|
|
43
45
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
44
46
|
className: "o-forms-title__main"
|
|
45
|
-
}, "Address type")
|
|
47
|
+
}, "Address type"), /*#__PURE__*/_react["default"].createElement("span", {
|
|
48
|
+
className: "o-forms-title__prompt"
|
|
49
|
+
}, titlePrompt)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
46
50
|
className: "o-forms-input o-forms-input--inline o-forms-input--radio-round"
|
|
47
51
|
}, options.map(function (option) {
|
|
48
52
|
var type = addressTypes.find(function (item) {
|
|
@@ -71,5 +75,6 @@ DeliveryAddressType.propTypes = {
|
|
|
71
75
|
fieldId: _propTypes["default"].string,
|
|
72
76
|
inputName: _propTypes["default"].string,
|
|
73
77
|
value: _propTypes["default"].oneOf(['home', 'company', 'pobox']),
|
|
74
|
-
options: _propTypes["default"].arrayOf(_propTypes["default"].oneOf(['home', 'company', 'pobox']))
|
|
78
|
+
options: _propTypes["default"].arrayOf(_propTypes["default"].oneOf(['home', 'company', 'pobox'])),
|
|
79
|
+
titlePrompt: _propTypes["default"].string
|
|
75
80
|
};
|
package/dist/delivery-city.js
CHANGED
|
@@ -33,7 +33,13 @@ function DeliveryCity(_ref) {
|
|
|
33
33
|
CAN: 'e.g. Montreal',
|
|
34
34
|
ARE: 'e.g. Dubai'
|
|
35
35
|
};
|
|
36
|
-
var
|
|
36
|
+
var FTShippingZone = (0, _supportedCountries.identifyFTShippingZone)(country);
|
|
37
|
+
var labelMapping = {
|
|
38
|
+
ARE: 'Emirate or City',
|
|
39
|
+
APAC: 'City/Prefecture',
|
|
40
|
+
DEFAULT: 'City'
|
|
41
|
+
};
|
|
42
|
+
var inputLabel = labelMapping[FTShippingZone] ? labelMapping[FTShippingZone] : labelMapping['DEFAULT'];
|
|
37
43
|
return /*#__PURE__*/_react["default"].createElement("label", {
|
|
38
44
|
id: "deliveryCityField",
|
|
39
45
|
className: "o-forms-field ncf__validation-error",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/n-conversion-forms",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.4.0",
|
|
4
4
|
"description": "Containing jsx components and styles for forms included on Accounts and Acqusition apps (next-signup, next-profile, next-retention, etc).",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|