fontdue-js 1.7.0 → 1.8.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.
- package/CHANGELOG.md +6 -0
- package/README.md +3 -2
- package/dist/components/BuyButton/index.d.ts +1 -0
- package/dist/components/BuyButton/index.js +2 -1
- package/dist/components/Root/index.js +1 -1
- package/dist/components/TypeTester/TypeTesterStyleSelectData.js +5 -1
- package/dist/components/TypeTesters/TypeTestersElement.d.ts +11 -0
- package/dist/components/TypeTesters/TypeTestersElement.js +31 -0
- package/dist/components/TypeTesters/index.d.ts +3 -3
- package/dist/components/TypeTesters/index.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -79,6 +79,7 @@ import BuyButton from 'fontdue-js/BuyButton';
|
|
|
79
79
|
| --- | --- |
|
|
80
80
|
| `collectionId` or `collectionSlug` | (Required) `string` Collection identifier |
|
|
81
81
|
| `collectionName` | (Optional) `string` The name to render in the button: `Buy {collectionName}` |
|
|
82
|
+
| `label` | (Optional) `string` Label for the button (defaults to `Buy {collectionName}`) |
|
|
82
83
|
|
|
83
84
|
## `CartButton`
|
|
84
85
|
|
|
@@ -132,8 +133,8 @@ import TypeTesters from 'fontdue-js/TypeTesters';
|
|
|
132
133
|
| `collectionId` or `collectionSlug` | (Required) `string` Identifier for collection |
|
|
133
134
|
| `defaultMode` | (Optional) `'local' \| 'global'` The mode refers to the toggle in the UI: Affect all styles. `local` mode has this toggle turned off by default, `global` turns it on |
|
|
134
135
|
| `autofit` | (Optional) `boolean` Set to `true` to make the sentences fit on one line. It will adjust to the width of the tester as the user changes their browser window. If the user changes the font size or edits content, autofitting is turned off for that tester |
|
|
135
|
-
| `tags` | (Optional) `string[]` Will render only type testers that include
|
|
136
|
-
| `excludeTags` | (Optional) `string[]` Will exclude type testers that include
|
|
136
|
+
| `tags` | (Optional) `string[]` Will render only type testers that include these tags |
|
|
137
|
+
| `excludeTags` | (Optional) `string[]` Will exclude type testers that include these tags |
|
|
137
138
|
| `onFocus` | (Optional) `() => void` when any type tester is focused |
|
|
138
139
|
| `onBlur` | (Optional) `() => void` when any type tester is blurred |
|
|
139
140
|
| `onToolbarOpenClose` | (Optional) `(open: boolean) => void` Callback when toolbar is opened/closed |
|
|
@@ -3,6 +3,7 @@ interface BuyButtonQueryRenderer_props {
|
|
|
3
3
|
collectionId?: string | null;
|
|
4
4
|
collectionSlug?: string | null;
|
|
5
5
|
collectionName?: string;
|
|
6
|
+
label?: string;
|
|
6
7
|
}
|
|
7
8
|
declare const BuyButtonQueryRenderer: React.FC<BuyButtonQueryRenderer_props>;
|
|
8
9
|
export default BuyButtonQueryRenderer;
|
|
@@ -28,6 +28,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
28
28
|
const BuyButtonBase = _ref => {
|
|
29
29
|
let {
|
|
30
30
|
collection,
|
|
31
|
+
label,
|
|
31
32
|
collectionName
|
|
32
33
|
} = _ref;
|
|
33
34
|
const store = (0, _reactRedux.useStore)();
|
|
@@ -67,7 +68,7 @@ const BuyButtonBase = _ref => {
|
|
|
67
68
|
className: "buy-button",
|
|
68
69
|
onClick: handleClick,
|
|
69
70
|
type: "button"
|
|
70
|
-
},
|
|
71
|
+
}, label ? label : `Buy ${collectionName}`);
|
|
71
72
|
};
|
|
72
73
|
|
|
73
74
|
const BuyButton = (0, _reactRelay.createFragmentContainer)(BuyButtonBase, {
|
|
@@ -61,7 +61,7 @@ const customElementMap = {
|
|
|
61
61
|
'fontdue-store-modal': loadable(() => Promise.resolve().then(() => _interopRequireWildcard(require('../StoreModal')))),
|
|
62
62
|
'fontdue-test-fonts-form': loadable(() => Promise.resolve().then(() => _interopRequireWildcard(require('../TestFontsForm')))),
|
|
63
63
|
'fontdue-type-tester': loadable(() => Promise.resolve().then(() => _interopRequireWildcard(require('../TypeTester/TypeTesterStandaloneElement')))),
|
|
64
|
-
'fontdue-type-testers': loadable(() => Promise.resolve().then(() => _interopRequireWildcard(require('../TypeTesters'))))
|
|
64
|
+
'fontdue-type-testers': loadable(() => Promise.resolve().then(() => _interopRequireWildcard(require('../TypeTesters/TypeTestersElement'))))
|
|
65
65
|
};
|
|
66
66
|
Object.keys(customElementMap).forEach(elementName => {
|
|
67
67
|
// this might be more sophisticated in the future with a shadow DOM, etc,
|
|
@@ -76,7 +76,11 @@ const TypeTesterStyleSelectData = _ref => {
|
|
|
76
76
|
onSelectFamilyId: handleSelectFamilyId
|
|
77
77
|
}) : fontStyle.family && /*#__PURE__*/_react.default.createElement("div", {
|
|
78
78
|
className: "type-tester__name"
|
|
79
|
-
},
|
|
79
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
80
|
+
className: "type-tester__name__family"
|
|
81
|
+
}, fontStyle.family.name), ' ', /*#__PURE__*/_react.default.createElement("span", {
|
|
82
|
+
className: "type-tester__name__style"
|
|
83
|
+
}, fontStyle.name.replace(/ /g, '\xa0')));
|
|
80
84
|
};
|
|
81
85
|
|
|
82
86
|
var _default = (0, _reactRelay.createFragmentContainer)(TypeTesterStyleSelectData, {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface TypeTestersElementProps {
|
|
3
|
+
collectionId?: string;
|
|
4
|
+
collectionSlug?: string;
|
|
5
|
+
defaultMode?: string;
|
|
6
|
+
autofit?: string;
|
|
7
|
+
tags?: string;
|
|
8
|
+
excludeTags?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const TypeTestersElement: React.FC<TypeTestersElementProps>;
|
|
11
|
+
export default TypeTestersElement;
|
|
@@ -0,0 +1,31 @@
|
|
|
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 _index = _interopRequireDefault(require("./index"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
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); }
|
|
15
|
+
|
|
16
|
+
const TypeTestersElement = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
autofit,
|
|
19
|
+
tags,
|
|
20
|
+
excludeTags,
|
|
21
|
+
...rest
|
|
22
|
+
} = _ref;
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement(_index.default, _extends({
|
|
24
|
+
tags: tags === null || tags === void 0 ? void 0 : tags.split(','),
|
|
25
|
+
excludeTags: excludeTags === null || excludeTags === void 0 ? void 0 : excludeTags.split(','),
|
|
26
|
+
autofit: autofit === 'true'
|
|
27
|
+
}, rest));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var _default = TypeTestersElement;
|
|
31
|
+
exports.default = _default;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface TypeTestersQueryRendererProps {
|
|
3
|
-
collectionId?: string
|
|
4
|
-
collectionSlug?: string
|
|
3
|
+
collectionId?: string;
|
|
4
|
+
collectionSlug?: string;
|
|
5
5
|
defaultMode?: string;
|
|
6
|
-
autofit?:
|
|
6
|
+
autofit?: boolean;
|
|
7
7
|
precartOpen?: boolean;
|
|
8
8
|
tags?: string[];
|
|
9
9
|
excludeTags?: string[];
|
|
@@ -138,7 +138,7 @@ const TypeTesters = (0, _reactRelay.createFragmentContainer)(TypeTestersBase, {
|
|
|
138
138
|
});
|
|
139
139
|
|
|
140
140
|
const getDefaultMode = (stringValue, autofit) => {
|
|
141
|
-
if (autofit
|
|
141
|
+
if (autofit) return 'local';
|
|
142
142
|
if (stringValue === 'group') return 'group';
|
|
143
143
|
return 'local';
|
|
144
144
|
};
|
|
@@ -183,7 +183,7 @@ const TypeTestersQueryRenderer = _ref2 => {
|
|
|
183
183
|
defaultMode: getDefaultMode(defaultMode, autofit),
|
|
184
184
|
precartOpen: precartOpen,
|
|
185
185
|
includePriceBar: includePriceBar,
|
|
186
|
-
autofit: autofit
|
|
186
|
+
autofit: autofit !== null && autofit !== void 0 ? autofit : false,
|
|
187
187
|
onFocus: onFocus,
|
|
188
188
|
onBlur: onBlur,
|
|
189
189
|
onToolbarOpenClose: onToolbarOpenClose
|
|
@@ -218,7 +218,7 @@ const TypeTestersQueryRenderer = _ref2 => {
|
|
|
218
218
|
defaultMode: getDefaultMode(defaultMode, autofit),
|
|
219
219
|
precartOpen: precartOpen,
|
|
220
220
|
includePriceBar: includePriceBar,
|
|
221
|
-
autofit: autofit
|
|
221
|
+
autofit: autofit !== null && autofit !== void 0 ? autofit : false,
|
|
222
222
|
onFocus: onFocus,
|
|
223
223
|
onBlur: onBlur,
|
|
224
224
|
onToolbarOpenClose: onToolbarOpenClose
|