@onesy/ui-react 1.0.32 → 1.0.34
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/AutoComplete/AutoComplete.js +1 -4
- package/Medias/Medias.js +44 -24
- package/Page/Page.js +1 -1
- package/PageTransition/PageTransition.js +1 -1
- package/esm/AutoComplete/AutoComplete.js +1 -4
- package/esm/Medias/Medias.js +64 -51
- package/esm/Page/Page.js +1 -1
- package/esm/PageTransition/PageTransition.js +1 -1
- package/esm/index.js +1 -1
- package/package.json +1 -1
@@ -34,10 +34,7 @@ const utils_2 = require("../utils");
|
|
34
34
|
const useStyle = (0, style_react_1.style)(theme => ({
|
35
35
|
root: {
|
36
36
|
width: '100%',
|
37
|
-
flex: 'unset'
|
38
|
-
'& .onesy-TextField-input': {
|
39
|
-
flex: '1 1 auto'
|
40
|
-
}
|
37
|
+
flex: 'unset'
|
41
38
|
},
|
42
39
|
wrapper: {
|
43
40
|
position: 'relative'
|
package/Medias/Medias.js
CHANGED
@@ -203,32 +203,52 @@ const Medias = react_1.default.forwardRef((props_, ref) => {
|
|
203
203
|
}, [values]);
|
204
204
|
const getLink = react_1.default.useCallback((item, index) => {
|
205
205
|
var _a;
|
206
|
-
|
206
|
+
const urlEmbed = item === null || item === void 0 ? void 0 : item.urlEmbed;
|
207
|
+
if (!urlEmbed)
|
207
208
|
return null;
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
209
|
+
const otherProps = {
|
210
|
+
key: index
|
211
|
+
};
|
212
|
+
const urlEmbedStart = urlEmbed.replace('http://', '').replace('https://', '');
|
213
|
+
const isPlatform = (urlEmbedStart.startsWith('youtu') ||
|
214
|
+
urlEmbedStart.startsWith('www.youtu') ||
|
215
|
+
urlEmbedStart.startsWith('instagram') ||
|
216
|
+
urlEmbedStart.startsWith('www.instagram') ||
|
217
|
+
urlEmbedStart.startsWith('tiktok') ||
|
218
|
+
urlEmbedStart.startsWith('www.tiktok') ||
|
219
|
+
urlEmbedStart.startsWith('vimeo') ||
|
220
|
+
urlEmbedStart.startsWith('www.vimeo'));
|
221
|
+
// predefined
|
222
|
+
if (isPlatform) {
|
223
|
+
let url;
|
224
|
+
try {
|
225
|
+
url = new URL(item.urlEmbed);
|
226
|
+
}
|
227
|
+
catch (error) {
|
228
|
+
console.log('Invalid embed URL', item);
|
229
|
+
return null;
|
230
|
+
}
|
231
|
+
const id = (_a = url.pathname) === null || _a === void 0 ? void 0 : _a.split('/').filter(Boolean).slice(-1)[0];
|
232
|
+
if (!(url === null || url === void 0 ? void 0 : url.hostname) || !id)
|
233
|
+
return null;
|
234
|
+
if (item.urlEmbed.includes('youtu.be')) {
|
235
|
+
return ((0, jsx_runtime_1.jsx)("iframe", Object.assign({}, otherProps, { title: item.name || '', src: `https://www.youtube.com/embed/${id}`, allow: 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share', allowFullScreen: true, className: classes.aspectRatioYoutube })));
|
236
|
+
}
|
237
|
+
if (item.urlEmbed.includes('instagram.com')) {
|
238
|
+
return ((0, jsx_runtime_1.jsx)("iframe", Object.assign({}, otherProps, { title: item.name || '', src: `https://www.instagram.com/reel/${id}/embed`, allowFullScreen: true, className: classes.aspectRatioInstagram })));
|
239
|
+
}
|
240
|
+
if (item.urlEmbed.includes('tiktok.com')) {
|
241
|
+
return ((0, jsx_runtime_1.jsx)("iframe", Object.assign({}, otherProps, { title: item.name || '', src: `https://www.tiktok.com/embed/v2/${id}`, allowFullScreen: true, className: classes.aspectRatioTiktok })));
|
242
|
+
}
|
243
|
+
if (item.urlEmbed.includes('vimeo.com')) {
|
244
|
+
return ((0, jsx_runtime_1.jsx)("iframe", Object.assign({}, otherProps, { title: item.name || '', src: `https://player.vimeo.com/video/${id}`, allowFullScreen: true, className: classes.aspectRatioVimeo })));
|
245
|
+
}
|
246
|
+
return ((0, jsx_runtime_1.jsx)(Link, Object.assign({}, otherProps, { href: item === null || item === void 0 ? void 0 : item.urlEmbed, target: 'blank' }, { children: item.name || item.urlEmbed })));
|
230
247
|
}
|
231
|
-
|
248
|
+
// custom embed code
|
249
|
+
return ((0, jsx_runtime_1.jsx)(Line, Object.assign({}, otherProps, { fullWidth: true, dangerouslySetInnerHTML: {
|
250
|
+
__html: urlEmbed
|
251
|
+
} })));
|
232
252
|
}, []);
|
233
253
|
const getItem = (version, item, index) => {
|
234
254
|
var _a, _b, _c, _d, _e, _f;
|
package/Page/Page.js
CHANGED
@@ -42,7 +42,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
42
42
|
name: {
|
43
43
|
maxWidth: '440px'
|
44
44
|
}
|
45
|
-
}), { name: 'onesy
|
45
|
+
}), { name: 'onesy' });
|
46
46
|
const Page = react_1.default.forwardRef((props_, ref) => {
|
47
47
|
const theme = (0, style_react_1.useOnesyTheme)();
|
48
48
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyPage) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
|
@@ -45,7 +45,7 @@ const useStyle = (0, style_react_1.style)(theme => ({
|
|
45
45
|
out: {
|
46
46
|
animation: '$fadeOut 0.24s forwards'
|
47
47
|
}
|
48
|
-
}), { name: '
|
48
|
+
}), { name: 'onesyTransition' });
|
49
49
|
const PageTransition = react_1.default.forwardRef((props_, ref) => {
|
50
50
|
const theme = (0, style_react_1.useOnesyTheme)();
|
51
51
|
const props = react_1.default.useMemo(() => { var _a, _b, _c, _d, _e, _f, _g, _h; return (Object.assign(Object.assign(Object.assign({}, (_d = (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _a === void 0 ? void 0 : _a.elements) === null || _b === void 0 ? void 0 : _b.all) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.default), (_h = (_g = (_f = (_e = theme === null || theme === void 0 ? void 0 : theme.ui) === null || _e === void 0 ? void 0 : _e.elements) === null || _f === void 0 ? void 0 : _f.onesyPageTransition) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h.default), props_)); }, [props_]);
|
@@ -23,10 +23,7 @@ import { iconFontSize, staticClassName } from '../utils';
|
|
23
23
|
const useStyle = styleMethod(theme => ({
|
24
24
|
root: {
|
25
25
|
width: '100%',
|
26
|
-
flex: 'unset'
|
27
|
-
'& .onesy-TextField-input': {
|
28
|
-
flex: '1 1 auto'
|
29
|
-
}
|
26
|
+
flex: 'unset'
|
30
27
|
},
|
31
28
|
wrapper: {
|
32
29
|
position: 'relative'
|
package/esm/Medias/Medias.js
CHANGED
@@ -209,58 +209,71 @@ const Medias = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
209
209
|
return items_;
|
210
210
|
}, [values]);
|
211
211
|
const getLink = React.useCallback((item, index) => {
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
}
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
if (
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
}
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
212
|
+
const urlEmbed = item?.urlEmbed;
|
213
|
+
if (!urlEmbed) return null;
|
214
|
+
const otherProps = {
|
215
|
+
key: index
|
216
|
+
};
|
217
|
+
const urlEmbedStart = urlEmbed.replace('http://', '').replace('https://', '');
|
218
|
+
const isPlatform = urlEmbedStart.startsWith('youtu') || urlEmbedStart.startsWith('www.youtu') || urlEmbedStart.startsWith('instagram') || urlEmbedStart.startsWith('www.instagram') || urlEmbedStart.startsWith('tiktok') || urlEmbedStart.startsWith('www.tiktok') || urlEmbedStart.startsWith('vimeo') || urlEmbedStart.startsWith('www.vimeo');
|
219
|
+
|
220
|
+
// predefined
|
221
|
+
if (isPlatform) {
|
222
|
+
let url;
|
223
|
+
try {
|
224
|
+
url = new URL(item.urlEmbed);
|
225
|
+
} catch (error) {
|
226
|
+
console.log('Invalid embed URL', item);
|
227
|
+
return null;
|
228
|
+
}
|
229
|
+
const id = url.pathname?.split('/').filter(Boolean).slice(-1)[0];
|
230
|
+
if (!url?.hostname || !id) return null;
|
231
|
+
if (item.urlEmbed.includes('youtu.be')) {
|
232
|
+
return /*#__PURE__*/React.createElement("iframe", _extends({}, otherProps, {
|
233
|
+
title: item.name || '',
|
234
|
+
src: `https://www.youtube.com/embed/${id}`,
|
235
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
|
236
|
+
allowFullScreen: true,
|
237
|
+
className: classes.aspectRatioYoutube
|
238
|
+
}));
|
239
|
+
}
|
240
|
+
if (item.urlEmbed.includes('instagram.com')) {
|
241
|
+
return /*#__PURE__*/React.createElement("iframe", _extends({}, otherProps, {
|
242
|
+
title: item.name || '',
|
243
|
+
src: `https://www.instagram.com/reel/${id}/embed`,
|
244
|
+
allowFullScreen: true,
|
245
|
+
className: classes.aspectRatioInstagram
|
246
|
+
}));
|
247
|
+
}
|
248
|
+
if (item.urlEmbed.includes('tiktok.com')) {
|
249
|
+
return /*#__PURE__*/React.createElement("iframe", _extends({}, otherProps, {
|
250
|
+
title: item.name || '',
|
251
|
+
src: `https://www.tiktok.com/embed/v2/${id}`,
|
252
|
+
allowFullScreen: true,
|
253
|
+
className: classes.aspectRatioTiktok
|
254
|
+
}));
|
255
|
+
}
|
256
|
+
if (item.urlEmbed.includes('vimeo.com')) {
|
257
|
+
return /*#__PURE__*/React.createElement("iframe", _extends({}, otherProps, {
|
258
|
+
title: item.name || '',
|
259
|
+
src: `https://player.vimeo.com/video/${id}`,
|
260
|
+
allowFullScreen: true,
|
261
|
+
className: classes.aspectRatioVimeo
|
262
|
+
}));
|
263
|
+
}
|
264
|
+
return /*#__PURE__*/React.createElement(Link, _extends({}, otherProps, {
|
265
|
+
href: item?.urlEmbed,
|
266
|
+
target: "blank"
|
267
|
+
}), item.name || item.urlEmbed);
|
258
268
|
}
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
269
|
+
|
270
|
+
// custom embed code
|
271
|
+
return /*#__PURE__*/React.createElement(Line, _extends({}, otherProps, {
|
272
|
+
fullWidth: true,
|
273
|
+
dangerouslySetInnerHTML: {
|
274
|
+
__html: urlEmbed
|
275
|
+
}
|
276
|
+
}));
|
264
277
|
}, []);
|
265
278
|
const getItem = (version, item, index) => {
|
266
279
|
const media = item.value;
|
package/esm/Page/Page.js
CHANGED
@@ -35,7 +35,7 @@ const useStyle = styleMethod(theme => ({
|
|
35
35
|
animation: '$fadeOut 0.24s forwards'
|
36
36
|
}
|
37
37
|
}), {
|
38
|
-
name: '
|
38
|
+
name: 'onesyTransition'
|
39
39
|
});
|
40
40
|
const PageTransition = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
41
41
|
const theme = useOnesyTheme();
|
package/esm/index.js
CHANGED