pds-dev-kit-web-test 0.2.42 → 0.2.44
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.
|
@@ -46,7 +46,7 @@ function GoogleFontsListExample() {
|
|
|
46
46
|
value: [category]
|
|
47
47
|
});
|
|
48
48
|
} }, category)] }));
|
|
49
|
-
}) }))] }), isLoading && 'isLoading', filteredFonts.map(function (font) { return ((0, jsx_runtime_1.jsx)(GoogleFontItem_1.default, __assign({ font: font }, { children: function (_a) {
|
|
49
|
+
}) }))] }), isLoading && 'isLoading', filteredFonts.map(function (font) { return ((0, jsx_runtime_1.jsx)(GoogleFontItem_1.default, __assign({ font: font, fetchDefaultText: false }, { children: function (_a) {
|
|
50
50
|
var isFontFamilyLoading = _a.isLoading, ref = _a.ref;
|
|
51
51
|
return ((0, jsx_runtime_1.jsxs)("div", __assign({ ref: ref }, { children: [isFontFamilyLoading && (0, jsx_runtime_1.jsx)("div", { children: "loading.." }), (0, jsx_runtime_1.jsx)("div", __assign({ style: { fontFamily: font.family } }, { children: font.family }))] })));
|
|
52
52
|
} }), font.id)); })] }));
|
|
@@ -4,10 +4,12 @@ type HeadlessProps = {
|
|
|
4
4
|
isLoading: boolean;
|
|
5
5
|
isVisible: boolean;
|
|
6
6
|
ref: LegacyRef<HTMLElement>;
|
|
7
|
+
defaultText: string;
|
|
7
8
|
};
|
|
8
9
|
type Props = {
|
|
9
10
|
font: Font;
|
|
10
11
|
children: (args: HeadlessProps) => JSX.Element;
|
|
12
|
+
fetchDefaultText: boolean;
|
|
11
13
|
};
|
|
12
|
-
declare function GoogleFontItem({ font, children }: Props): JSX.Element;
|
|
14
|
+
declare function GoogleFontItem({ font, fetchDefaultText, children }: Props): JSX.Element;
|
|
13
15
|
export default GoogleFontItem;
|
|
@@ -51,7 +51,7 @@ var isStyleSheetExists_1 = __importDefault(require("../utils/isStyleSheetExists"
|
|
|
51
51
|
var parseFontVariants_1 = __importDefault(require("../utils/parseFontVariants"));
|
|
52
52
|
var setStyleSheetType_1 = __importDefault(require("../utils/setStyleSheetType"));
|
|
53
53
|
function GoogleFontItem(_a) {
|
|
54
|
-
var font = _a.font, children = _a.children;
|
|
54
|
+
var font = _a.font, fetchDefaultText = _a.fetchDefaultText, children = _a.children;
|
|
55
55
|
var _b = (0, react_1.useState)(false), isLoading = _b[0], setIsLoading = _b[1];
|
|
56
56
|
var _c = (0, react_1.useState)(''), defaultText = _c[0], setDefaultText = _c[1];
|
|
57
57
|
var ref = (0, react_1.useRef)(null);
|
|
@@ -105,6 +105,9 @@ function GoogleFontItem(_a) {
|
|
|
105
105
|
}
|
|
106
106
|
}, [font, isVisible]);
|
|
107
107
|
(0, react_1.useEffect)(function () {
|
|
108
|
+
if (!fetchDefaultText) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
108
111
|
if (!font.family || !isVisible || defaultText) {
|
|
109
112
|
return;
|
|
110
113
|
}
|
|
@@ -123,7 +126,7 @@ function GoogleFontItem(_a) {
|
|
|
123
126
|
});
|
|
124
127
|
}
|
|
125
128
|
getDefaultText();
|
|
126
|
-
}, [font, isVisible, defaultText]);
|
|
127
|
-
return children({ isLoading: isLoading, isVisible: isVisible, ref: ref });
|
|
129
|
+
}, [font, isVisible, defaultText, fetchDefaultText]);
|
|
130
|
+
return children({ isLoading: isLoading, isVisible: isVisible, ref: ref, defaultText: defaultText });
|
|
128
131
|
}
|
|
129
132
|
exports.default = GoogleFontItem;
|
package/package.json
CHANGED
package/release-note.md
CHANGED