fontdue-js 0.1.0-alpha23 → 0.1.0-alpha26
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/AddToCartBanner/index.js +2 -2
- package/dist/components/Cart/AddressFields.js +2 -2
- package/dist/components/Cart/CartItem/VariableTextInput.js +1 -1
- package/dist/components/Cart/CartItem/index.js +5 -5
- package/dist/components/Cart/CartTotals.js +1 -1
- package/dist/components/Cart/Checkout.js +1 -1
- package/dist/components/Checkbox/index.d.ts +4 -0
- package/dist/components/Checkbox/index.js +37 -0
- package/dist/components/CouponText/index.js +1 -1
- package/dist/components/Family/index.js +1 -1
- package/dist/components/FontStyle/index.js +1 -1
- package/dist/components/Icons/Align.d.ts +4 -0
- package/dist/components/Icons/Align.js +63 -0
- package/dist/components/Price/index.js +1 -1
- package/dist/components/Root/productState.js +1 -1
- package/dist/components/StoreModal/StoreModalFamilyButton.js +4 -4
- package/dist/components/StoreModal/StoreModalIndex.js +3 -3
- package/dist/components/StoreModalProductLicenseSelection/StoreModalProductLicense.js +1 -1
- package/dist/components/TestFontsForm/index.js +7 -19
- package/dist/components/ThemeConfig/index.js +1 -1
- package/dist/components/TypeTester/TypeTesterAlignButtons.d.ts +8 -0
- package/dist/components/TypeTester/TypeTesterAlignButtons.js +39 -0
- package/dist/components/TypeTester/TypeTesterContent.d.ts +2 -1
- package/dist/components/TypeTester/TypeTesterContent.js +5 -2
- package/dist/components/TypeTester/TypeTesterContext.d.ts +7 -1
- package/dist/components/TypeTester/TypeTesterContext.js +7 -1
- package/dist/components/TypeTester/TypeTesterFeatures.js +48 -23
- package/dist/components/TypeTester/TypeTesterFloatingToolbar.js +10 -3
- package/dist/components/TypeTester/TypeTesterInput.js +1 -1
- package/dist/components/TypeTester/TypeTesterStandalone.d.ts +2 -0
- package/dist/components/TypeTester/TypeTesterStandalone.js +3 -1
- package/dist/components/TypeTester/TypeTesterState.d.ts +3 -1
- package/dist/components/TypeTester/TypeTesterState.js +8 -1
- package/dist/components/TypeTester/TypeTesterToolbar.js +3 -1
- package/dist/components/TypeTester/index.d.ts +11 -1
- package/dist/components/TypeTester/index.js +4 -2
- package/dist/components/TypeTester/types.d.ts +1 -0
- package/dist/components/TypeTester/useTypeTesterStyler.d.ts +3 -1
- package/dist/components/TypeTester/useTypeTesterStyler.js +13 -11
- package/dist/components/TypeTesters/index.js +6 -3
- package/dist/components/useFontStyle.js +1 -1
- package/dist/relay-environment.js +1 -1
- package/dist/utils.js +3 -3
- package/dist/vanilla/FontStyle.js +1 -1
- package/fontdue.css +96 -52
- package/fontdue.css.map +1 -1
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ const getOrderItemName = item => {
|
|
|
31
31
|
if (!product) return null;
|
|
32
32
|
|
|
33
33
|
if (product.__typename === 'FontStyle') {
|
|
34
|
-
return
|
|
34
|
+
return `${product.family.name} ${product.name}`;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
return item.sku.product.name;
|
|
@@ -93,7 +93,7 @@ class AddToCartBannerBase extends _react.default.Component {
|
|
|
93
93
|
orderItems
|
|
94
94
|
} = this.state;
|
|
95
95
|
if (!order) return null;
|
|
96
|
-
const itemText = orderItems.length === 1 ? getOrderItemName(orderItems[0]) :
|
|
96
|
+
const itemText = orderItems.length === 1 ? getOrderItemName(orderItems[0]) : `${orderItems.length} items`;
|
|
97
97
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
98
98
|
className: "add-to-cart-banner",
|
|
99
99
|
"data-active": active
|
|
@@ -49,7 +49,7 @@ class AddressFields extends _react.default.Component {
|
|
|
49
49
|
const label = (text, field) => {
|
|
50
50
|
const requiredFields = requireAtLeast.concat(countryData && countryData.require || []);
|
|
51
51
|
const suffix = requiredFields.indexOf(field) >= 0 ? ' *' : '';
|
|
52
|
-
return
|
|
52
|
+
return `${text}${suffix}`;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
const countries = viewer.countries.map(({
|
|
@@ -192,7 +192,7 @@ class AddressFields extends _react.default.Component {
|
|
|
192
192
|
vatNumber: v
|
|
193
193
|
}),
|
|
194
194
|
errors: getErrors('vatNumber'),
|
|
195
|
-
prefix:
|
|
195
|
+
prefix: `${countryData.vatCountryCode} `
|
|
196
196
|
}))) : Array(4).fill(null).map((_, i) => /*#__PURE__*/_react.default.createElement("div", {
|
|
197
197
|
className: "checkout-modal__section",
|
|
198
198
|
key: i
|
|
@@ -105,7 +105,7 @@ class VariableTextInput extends _react.default.Component {
|
|
|
105
105
|
value: this.state.value,
|
|
106
106
|
onChange: this.handleChange,
|
|
107
107
|
onBlur: this.handleBlur,
|
|
108
|
-
placeholder:
|
|
108
|
+
placeholder: `Enter ${placeholder}`
|
|
109
109
|
}, rest)));
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -32,9 +32,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
32
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
33
|
|
|
34
34
|
const plural = (count, singularString, pluralString) => {
|
|
35
|
-
if (count === 1) return
|
|
36
|
-
const str = pluralString ||
|
|
37
|
-
return
|
|
35
|
+
if (count === 1) return `1 ${singularString}`;
|
|
36
|
+
const str = pluralString || `${singularString}s`;
|
|
37
|
+
return `${count} ${str}`;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const groupSelectionsByLicense = node => {
|
|
@@ -57,7 +57,7 @@ const groupSelectionsByLicense = node => {
|
|
|
57
57
|
|
|
58
58
|
const productName = product => {
|
|
59
59
|
if (!product) return '??';
|
|
60
|
-
if (product.__typename === 'FontStyle' && product.family) return
|
|
60
|
+
if (product.__typename === 'FontStyle' && product.family) return `${product.family.name} ${product.name}`;
|
|
61
61
|
return product.name;
|
|
62
62
|
};
|
|
63
63
|
|
|
@@ -98,7 +98,7 @@ const Variable = ({
|
|
|
98
98
|
}, ((_selection$variable = selection.variable) === null || _selection$variable === void 0 ? void 0 : _selection$variable.variableType) === 'table' ? option.name : option.amount);
|
|
99
99
|
}))) : /*#__PURE__*/_react.default.createElement(_VariableTextInput.default, {
|
|
100
100
|
defaultValue: selection.variableText,
|
|
101
|
-
placeholder:
|
|
101
|
+
placeholder: `${variable.name} *`,
|
|
102
102
|
onChange: onChange
|
|
103
103
|
}));
|
|
104
104
|
};
|
|
@@ -79,7 +79,7 @@ const CartTotals = ({
|
|
|
79
79
|
price: order.taxes,
|
|
80
80
|
"data-line": "taxes"
|
|
81
81
|
}), /*#__PURE__*/_react.default.createElement(PriceBlock, {
|
|
82
|
-
label:
|
|
82
|
+
label: `Total${order.gstIncluded ? ' including GST' : ''}:`,
|
|
83
83
|
price: order.total,
|
|
84
84
|
"data-line": "total"
|
|
85
85
|
}));
|
|
@@ -373,7 +373,7 @@ class CheckoutFormBase extends _react.default.Component {
|
|
|
373
373
|
const customProperties = parseCustomProperties(viewer === null || viewer === void 0 ? void 0 : (_viewer$themeConfig = viewer.themeConfig) === null || _viewer$themeConfig === void 0 ? void 0 : _viewer$themeConfig.customProperties);
|
|
374
374
|
const inputStyles = {
|
|
375
375
|
base: {
|
|
376
|
-
fontFamily: "
|
|
376
|
+
fontFamily: `"${viewer === null || viewer === void 0 ? void 0 : (_viewer$settings = viewer.settings) === null || _viewer$settings === void 0 ? void 0 : _viewer$settings.uiFontName}", sans-serif`,
|
|
377
377
|
fontSize: mediaQuery === MOBILE ? '14px' : '36px',
|
|
378
378
|
fontWeight: '500',
|
|
379
379
|
color: customProperties['--primary_text_color'],
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _ConfigContext = _interopRequireDefault(require("../ConfigContext"));
|
|
11
|
+
|
|
12
|
+
var _Icons = require("../Icons");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
+
|
|
22
|
+
const Checkbox = props => {
|
|
23
|
+
var _config$form$checkbox, _config$form;
|
|
24
|
+
|
|
25
|
+
const config = (0, _react.useContext)(_ConfigContext.default);
|
|
26
|
+
const checkboxStyle = (_config$form$checkbox = (_config$form = config.form) === null || _config$form === void 0 ? void 0 : _config$form.checkboxStyle) !== null && _config$form$checkbox !== void 0 ? _config$form$checkbox : 'check';
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
28
|
+
className: "checkbox"
|
|
29
|
+
}, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
30
|
+
type: "checkbox"
|
|
31
|
+
}, props)), /*#__PURE__*/_react.default.createElement("div", {
|
|
32
|
+
className: "checkbox__icon"
|
|
33
|
+
}, checkboxStyle === 'check' ? /*#__PURE__*/_react.default.createElement(_Icons.Check, null) : /*#__PURE__*/_react.default.createElement(_Icons.X, null)));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var _default = Checkbox;
|
|
37
|
+
exports.default = _default;
|
|
@@ -32,7 +32,7 @@ const CouponText = ({
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if (coupon.type === 'percent') {
|
|
35
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null,
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, `${coupon.percentAmount}% off`);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
return null;
|
|
@@ -87,7 +87,7 @@ class FamilyBase extends _react.default.Component {
|
|
|
87
87
|
className: "font-family-block__label"
|
|
88
88
|
}, /*#__PURE__*/_react.default.createElement("h3", {
|
|
89
89
|
className: "font-family-block__name"
|
|
90
|
-
}, isSuperFamily ?
|
|
90
|
+
}, isSuperFamily ? `${node.name} Super family` : node.name), /*#__PURE__*/_react.default.createElement("span", {
|
|
91
91
|
className: "font-family-block__separator"
|
|
92
92
|
}), /*#__PURE__*/_react.default.createElement("p", {
|
|
93
93
|
className: "font-family-block__count"
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AlignCenter = AlignCenter;
|
|
7
|
+
exports.AlignLeft = AlignLeft;
|
|
8
|
+
exports.AlignRight = AlignRight;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
function AlignCenter() {
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
16
|
+
className: "icon",
|
|
17
|
+
"data-label": "AlignCenter"
|
|
18
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
19
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
20
|
+
width: "18",
|
|
21
|
+
height: "13",
|
|
22
|
+
fill: "none",
|
|
23
|
+
viewBox: "0 0 18 13"
|
|
24
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
25
|
+
fillRule: "evenodd",
|
|
26
|
+
d: "M0 4h18v1H0V4zM2 0h14.078v1H2V0zM2.067 8H16v1H2.067V8zM3 12h12.079v1H3v-1z",
|
|
27
|
+
clipRule: "evenodd"
|
|
28
|
+
})));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function AlignLeft() {
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
33
|
+
className: "icon",
|
|
34
|
+
"data-label": "AlignLeft"
|
|
35
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
36
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
37
|
+
width: "19",
|
|
38
|
+
height: "13",
|
|
39
|
+
fill: "none",
|
|
40
|
+
viewBox: "0 0 19 13"
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
42
|
+
fillRule: "evenodd",
|
|
43
|
+
d: "M0 0h14.079v1H0V0zM0 4h18.078v1H0V4zM0 8h16.078v1H0V8zM0 12h14.079v1H0v-1z",
|
|
44
|
+
clipRule: "evenodd"
|
|
45
|
+
})));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function AlignRight() {
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
50
|
+
className: "icon",
|
|
51
|
+
"data-label": "AlignRight"
|
|
52
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
53
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
54
|
+
width: "19",
|
|
55
|
+
height: "13",
|
|
56
|
+
fill: "none",
|
|
57
|
+
viewBox: "0 0 19 13"
|
|
58
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
59
|
+
fillRule: "evenodd",
|
|
60
|
+
d: "M3 0h15v1H3V0zM3.47 12H18v1H3.47v-1zM.067 4H18v1H.067V4zM2.067 8H18v1H2.067V8z",
|
|
61
|
+
clipRule: "evenodd"
|
|
62
|
+
})));
|
|
63
|
+
}
|
|
@@ -42,7 +42,7 @@ const formatMoney = (priceInCents, format, currency) => {
|
|
|
42
42
|
// fallback for browsers without support for Intl.NumberFormat
|
|
43
43
|
const symbol = (_currencySymbols$curr = currencySymbols[currency]) !== null && _currencySymbols$curr !== void 0 ? _currencySymbols$curr : '';
|
|
44
44
|
const precision = format === PriceFormat.Truncated ? 0 : 2;
|
|
45
|
-
return
|
|
45
|
+
return `${symbol}${(priceInCents / 100).toFixed(precision)}`;
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
|
|
@@ -130,7 +130,7 @@ const populateProductStateReducer = (state, action) => {
|
|
|
130
130
|
// [collectionId]: [skuId]
|
|
131
131
|
// }
|
|
132
132
|
collectionSkus: { ...state.collectionSkus,
|
|
133
|
-
[
|
|
133
|
+
[`${data.node.id}`]: (_data$node$sku$id = (_data$node$sku = data.node.sku) === null || _data$node$sku === void 0 ? void 0 : _data$node$sku.id) !== null && _data$node$sku$id !== void 0 ? _data$node$sku$id : null
|
|
134
134
|
},
|
|
135
135
|
fetchedCollectionIds: state.fetchedCollectionIds.concat(data.node.id)
|
|
136
136
|
};
|
|
@@ -28,9 +28,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
28
28
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
29
29
|
|
|
30
30
|
const plural = (count, singularString, pluralString) => {
|
|
31
|
-
if (count === 1) return
|
|
32
|
-
const str = pluralString ||
|
|
33
|
-
return
|
|
31
|
+
if (count === 1) return `1 ${singularString}`;
|
|
32
|
+
const str = pluralString || `${singularString}s`;
|
|
33
|
+
return `${count} ${str}`;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
const getFamilyType = collection => {
|
|
@@ -59,7 +59,7 @@ const FamilyButton = ({
|
|
|
59
59
|
name: collection.featureStyle && /*#__PURE__*/_react.default.createElement(_FontStyle.default, {
|
|
60
60
|
Component: "span",
|
|
61
61
|
fontStyle: collection.featureStyle
|
|
62
|
-
},
|
|
62
|
+
}, `${collection.name} ${getFamilyType(collection)}`),
|
|
63
63
|
label: collection.totalStyles && plural(collection.totalStyles, 'style', 'styles'),
|
|
64
64
|
price: collection.sku && /*#__PURE__*/_react.default.createElement(_SKUPrice.default, {
|
|
65
65
|
sku: collection.sku,
|
|
@@ -30,9 +30,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
30
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
31
|
|
|
32
32
|
const plural = (count, singularString, pluralString) => {
|
|
33
|
-
if (count === 1) return
|
|
34
|
-
const str = pluralString ||
|
|
35
|
-
return
|
|
33
|
+
if (count === 1) return `1 ${singularString}`;
|
|
34
|
+
const str = pluralString || `${singularString}s`;
|
|
35
|
+
return `${count} ${str}`;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
const StoreModalIndex = ({
|
|
@@ -140,7 +140,7 @@ const StoreModalProduceLicense = ({
|
|
|
140
140
|
text: option.amount
|
|
141
141
|
}))
|
|
142
142
|
}, {
|
|
143
|
-
selectionText: selectedOption ? selectedOption.amount :
|
|
143
|
+
selectionText: selectedOption ? selectedOption.amount : `Select ${variable.name}`
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -13,7 +13,7 @@ var _TextField = _interopRequireDefault(require("../TextField"));
|
|
|
13
13
|
|
|
14
14
|
var _Icons = require("../Icons");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _Checkbox = _interopRequireDefault(require("../Checkbox"));
|
|
17
17
|
|
|
18
18
|
var _TestFontsFormUpdateCustomerMutation, _TestFontsForm_viewer, _TestFontsForm_Query;
|
|
19
19
|
|
|
@@ -43,7 +43,7 @@ const TestFontsFormBase = ({
|
|
|
43
43
|
downloadLabel = 'Download test fonts',
|
|
44
44
|
newsletterCheckboxChecked = false
|
|
45
45
|
}) => {
|
|
46
|
-
var
|
|
46
|
+
var _viewer$testFonts, _ref;
|
|
47
47
|
|
|
48
48
|
const [email, setEmail] = (0, _react.useState)('');
|
|
49
49
|
const [name, setName] = (0, _react.useState)('');
|
|
@@ -55,8 +55,6 @@ const TestFontsFormBase = ({
|
|
|
55
55
|
const [submitted, setSubmitted] = (0, _react.useState)(false);
|
|
56
56
|
const downloadForm = (0, _react.useRef)(null);
|
|
57
57
|
const environment = (0, _reactRelay.useRelayEnvironment)();
|
|
58
|
-
const config = (0, _react.useContext)(_ConfigContext.default);
|
|
59
|
-
const checkboxStyle = (_config$form$checkbox = (_config$form = config.form) === null || _config$form === void 0 ? void 0 : _config$form.checkboxStyle) !== null && _config$form$checkbox !== void 0 ? _config$form$checkbox : 'check';
|
|
60
58
|
if (!viewer) return null;
|
|
61
59
|
|
|
62
60
|
const handleSubmit = e => {
|
|
@@ -131,32 +129,22 @@ const TestFontsFormBase = ({
|
|
|
131
129
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
132
130
|
className: "test-fonts__agreement test-fonts__checkbox-field",
|
|
133
131
|
"data-highlighted": eulaFail && !eulaAgreed
|
|
134
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
135
|
-
className: "checkbox"
|
|
136
|
-
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
137
|
-
type: "checkbox",
|
|
132
|
+
}, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
138
133
|
id: "test-fonts-eula-agreement",
|
|
139
134
|
checked: eulaAgreed,
|
|
140
135
|
onChange: event => setEulaAgreed(event.target.checked)
|
|
141
|
-
}), /*#__PURE__*/_react.default.createElement("
|
|
142
|
-
className: "checkbox__icon"
|
|
143
|
-
}, checkboxStyle === 'check' ? /*#__PURE__*/_react.default.createElement(_Icons.Check, null) : /*#__PURE__*/_react.default.createElement(_Icons.X, null))), /*#__PURE__*/_react.default.createElement("label", {
|
|
136
|
+
}), /*#__PURE__*/_react.default.createElement("label", {
|
|
144
137
|
htmlFor: "test-fonts-eula-agreement",
|
|
145
138
|
dangerouslySetInnerHTML: {
|
|
146
139
|
__html: (_ref = agreementLabel || eulaAgreementLabel) !== null && _ref !== void 0 ? _ref : ''
|
|
147
140
|
}
|
|
148
141
|
})), newsletterOptInLabel && /*#__PURE__*/_react.default.createElement("div", {
|
|
149
142
|
className: "test-fonts__newsletter-opt-in test-fonts__checkbox-field"
|
|
150
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
151
|
-
|
|
152
|
-
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
153
|
-
type: "checkbox",
|
|
154
|
-
id: "newsletter-opt-in",
|
|
143
|
+
}, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
144
|
+
id: "newletter-opt-in",
|
|
155
145
|
checked: newsletterOptIn,
|
|
156
146
|
onChange: event => setNewsletterOptIn(event.target.checked)
|
|
157
|
-
}), /*#__PURE__*/_react.default.createElement("
|
|
158
|
-
className: "checkbox__icon"
|
|
159
|
-
}, checkboxStyle === 'check' ? /*#__PURE__*/_react.default.createElement(_Icons.Check, null) : /*#__PURE__*/_react.default.createElement(_Icons.X, null))), /*#__PURE__*/_react.default.createElement("label", {
|
|
147
|
+
}), /*#__PURE__*/_react.default.createElement("label", {
|
|
160
148
|
htmlFor: "newsletter-opt-in",
|
|
161
149
|
dangerouslySetInnerHTML: {
|
|
162
150
|
__html: newsletterOptInLabel
|
|
@@ -25,7 +25,7 @@ const ThemeConfigBase = ({
|
|
|
25
25
|
const props = (_viewer$themeConfig$c = viewer === null || viewer === void 0 ? void 0 : (_viewer$themeConfig = viewer.themeConfig) === null || _viewer$themeConfig === void 0 ? void 0 : _viewer$themeConfig.customProperties) !== null && _viewer$themeConfig$c !== void 0 ? _viewer$themeConfig$c : [];
|
|
26
26
|
return /*#__PURE__*/_react.default.createElement("style", {
|
|
27
27
|
type: "text/css"
|
|
28
|
-
},
|
|
28
|
+
}, `:root { ${props.join(';')} }`);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const ThemeConfig = (0, _reactRelay.createFragmentContainer)(ThemeConfigBase, {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Alignment } from './types';
|
|
3
|
+
interface TypeTesterAlignButtons_props {
|
|
4
|
+
alignment: Alignment;
|
|
5
|
+
setAlignment: (value: Alignment) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const TypeTesterAlignButtons: React.FC<TypeTesterAlignButtons_props>;
|
|
8
|
+
export default TypeTesterAlignButtons;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _Align = require("../Icons/Align");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
const TypeTesterAlignButtons = ({
|
|
15
|
+
alignment,
|
|
16
|
+
setAlignment
|
|
17
|
+
}) => {
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
19
|
+
className: "type-tester__align-buttons"
|
|
20
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
21
|
+
type: "button",
|
|
22
|
+
className: "type-tester__align-buttons__button",
|
|
23
|
+
"data-active": alignment === 'left',
|
|
24
|
+
onClick: () => setAlignment('left')
|
|
25
|
+
}, /*#__PURE__*/_react.default.createElement(_Align.AlignLeft, null)), /*#__PURE__*/_react.default.createElement("button", {
|
|
26
|
+
type: "button",
|
|
27
|
+
className: "type-tester__align-buttons__button",
|
|
28
|
+
"data-active": alignment === 'center',
|
|
29
|
+
onClick: () => setAlignment('center')
|
|
30
|
+
}, /*#__PURE__*/_react.default.createElement(_Align.AlignCenter, null)), /*#__PURE__*/_react.default.createElement("button", {
|
|
31
|
+
type: "button",
|
|
32
|
+
className: "type-tester__align-buttons__button",
|
|
33
|
+
"data-active": alignment === 'right',
|
|
34
|
+
onClick: () => setAlignment('right')
|
|
35
|
+
}, /*#__PURE__*/_react.default.createElement(_Align.AlignRight, null)));
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
var _default = TypeTesterAlignButtons;
|
|
39
|
+
exports.default = _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { UseTypeTesterStylerProps } from './useTypeTesterStyler';
|
|
3
|
-
import { Content } from './types';
|
|
3
|
+
import { Alignment, Content } from './types';
|
|
4
4
|
export interface TypeTesterContentRef {
|
|
5
5
|
focus: () => void;
|
|
6
6
|
}
|
|
@@ -11,6 +11,7 @@ interface TypeTesterContentProps extends UseTypeTesterStylerProps {
|
|
|
11
11
|
setFocused: (value: boolean) => void;
|
|
12
12
|
direction: string | null;
|
|
13
13
|
autofitOnChange: boolean;
|
|
14
|
+
alignment: Alignment;
|
|
14
15
|
}
|
|
15
16
|
declare const TypeTesterContent: React.ForwardRefExoticComponent<TypeTesterContentProps & React.RefAttributes<TypeTesterContentRef>>;
|
|
16
17
|
export default TypeTesterContent;
|
|
@@ -24,6 +24,7 @@ const TypeTesterContent = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
24
24
|
setContent,
|
|
25
25
|
setFocused,
|
|
26
26
|
direction,
|
|
27
|
+
alignment,
|
|
27
28
|
...props
|
|
28
29
|
}, ref) => {
|
|
29
30
|
const editorRef = (0, _react.useRef)(null);
|
|
@@ -35,7 +36,8 @@ const TypeTesterContent = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
35
36
|
}
|
|
36
37
|
}));
|
|
37
38
|
const style = (0, _useTypeTesterStyler.default)({ ...props,
|
|
38
|
-
content
|
|
39
|
+
content,
|
|
40
|
+
alignment
|
|
39
41
|
});
|
|
40
42
|
return /*#__PURE__*/_react.default.createElement("div", _extends({}, style, {
|
|
41
43
|
className: "type-tester__text__container"
|
|
@@ -47,7 +49,8 @@ const TypeTesterContent = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
47
49
|
onFocus: () => setFocused(true),
|
|
48
50
|
spellCheck: false,
|
|
49
51
|
stripPastedStyles: true,
|
|
50
|
-
textDirectionality: direction === 'rtl' ? 'RTL' : 'LTR'
|
|
52
|
+
textDirectionality: direction === 'rtl' ? 'RTL' : 'LTR',
|
|
53
|
+
textAlignment: alignment
|
|
51
54
|
}));
|
|
52
55
|
});
|
|
53
56
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { Dispatch } from 'react';
|
|
2
|
-
import { Content, Features, Size, TypeTesterMode } from './types';
|
|
2
|
+
import { Content, Features, Size, Alignment, TypeTesterMode } from './types';
|
|
3
3
|
interface TypeTesterState {
|
|
4
4
|
content: Content;
|
|
5
5
|
contentEdited: boolean;
|
|
@@ -9,6 +9,7 @@ interface TypeTesterState {
|
|
|
9
9
|
focused: boolean;
|
|
10
10
|
featuresOpen: boolean;
|
|
11
11
|
autofit: boolean;
|
|
12
|
+
alignment: Alignment;
|
|
12
13
|
}
|
|
13
14
|
export interface TypeTestersState {
|
|
14
15
|
[id: string]: TypeTesterState;
|
|
@@ -19,6 +20,7 @@ export interface TypeTestersInitialState {
|
|
|
19
20
|
size: number | null;
|
|
20
21
|
lineHeight: number | null;
|
|
21
22
|
autofit: boolean;
|
|
23
|
+
alignment: Alignment;
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
26
|
interface TypeTesterContextState {
|
|
@@ -54,6 +56,10 @@ declare type TypeTesterContextAction = {
|
|
|
54
56
|
type: 'SET_LINE_HEIGHT';
|
|
55
57
|
id: string;
|
|
56
58
|
value: number;
|
|
59
|
+
} | {
|
|
60
|
+
type: 'SET_ALIGNMENT';
|
|
61
|
+
id: string;
|
|
62
|
+
value: Alignment;
|
|
57
63
|
};
|
|
58
64
|
export declare const TypeTesterContext: React.Context<TypeTesterContextState & {
|
|
59
65
|
dispatch: Dispatch<TypeTesterContextAction>;
|
|
@@ -103,6 +103,11 @@ const groupReducer = (state, action) => {
|
|
|
103
103
|
lineHeight: action.value
|
|
104
104
|
});
|
|
105
105
|
|
|
106
|
+
case 'SET_ALIGNMENT':
|
|
107
|
+
return updateTester(state, action.id, {
|
|
108
|
+
alignment: action.value
|
|
109
|
+
});
|
|
110
|
+
|
|
106
111
|
case 'SET_FOCUSED':
|
|
107
112
|
return { ...state,
|
|
108
113
|
testers: { ...testers,
|
|
@@ -143,7 +148,8 @@ const TypeTesterContextComponent = ({
|
|
|
143
148
|
autofit: initialState.autofit,
|
|
144
149
|
features: [],
|
|
145
150
|
featuresOpen: false,
|
|
146
|
-
focused: false
|
|
151
|
+
focused: false,
|
|
152
|
+
alignment: initialState.alignment
|
|
147
153
|
};
|
|
148
154
|
return acc;
|
|
149
155
|
}, {});
|