@drawbridge/components 0.0.40 → 0.0.43
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/advertisement.js +13 -5
- package/dist/advertisement.mjs +7 -4
- package/dist/{chunk-HDOA3Y3U.mjs → chunk-BHQBSNGK.mjs} +8 -7
- package/dist/chunk-BZ6WMIH7.mjs +37 -0
- package/dist/{chunk-7ZLMDYBR.mjs → chunk-JJH46E7B.mjs} +6 -2
- package/dist/input-group.js +6 -2
- package/dist/input-group.mjs +1 -1
- package/dist/input-name.js +307 -0
- package/dist/input-name.mjs +115 -0
- package/dist/input-number.mjs +3 -3
- package/dist/input-phone.js +183 -0
- package/dist/input-phone.mjs +139 -0
- package/dist/input-text.mjs +3 -32
- package/dist/product.js +10 -5
- package/dist/product.mjs +4 -4
- package/dist/provider-font.js +94 -0
- package/dist/provider-font.mjs +74 -0
- package/dist/video.js +19 -1
- package/dist/video.mjs +19 -1
- package/package.json +15 -2
- package/types/advertisement.d.ts +1 -0
- package/types/input-group.d.ts +1 -0
- package/types/input-name.d.ts +24 -0
- package/types/input-phone.d.ts +20 -0
- package/types/product.d.ts +1 -0
- package/types/provider-font.d.ts +23 -0
- package/types/video.d.ts +2 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// components/input-phone.js
|
|
31
|
+
var input_phone_exports = {};
|
|
32
|
+
__export(input_phone_exports, {
|
|
33
|
+
default: () => input_phone_default,
|
|
34
|
+
isValidPhone: () => isValidPhone
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(input_phone_exports);
|
|
37
|
+
var import_style = require("react-phone-number-input/style.css");
|
|
38
|
+
var import_react = require("react");
|
|
39
|
+
var import_input = __toESM(require("react-phone-number-input/input"));
|
|
40
|
+
var import_phone = require("@drawbridge/drawbridge-utils/phone");
|
|
41
|
+
|
|
42
|
+
// components/styles.js
|
|
43
|
+
var inputStyle = (style) => {
|
|
44
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
45
|
+
return {
|
|
46
|
+
backgroundColor: (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb,
|
|
47
|
+
borderColor: (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb,
|
|
48
|
+
borderRadius: ((_e = style == null ? void 0 : style.input) == null ? void 0 : _e.radius) != null ? style.input.radius / 4 + "px" : void 0,
|
|
49
|
+
color: (_g = (_f = style == null ? void 0 : style.text) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
var inputPhoneStyle = (style) => inputStyle(style);
|
|
53
|
+
|
|
54
|
+
// components/input-phone.js
|
|
55
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
56
|
+
var isValidPhone = (number = "", country = "") => {
|
|
57
|
+
const valid = (0, import_phone.isValid)(number, country);
|
|
58
|
+
return valid;
|
|
59
|
+
};
|
|
60
|
+
var InputPhone = ({
|
|
61
|
+
countries = [],
|
|
62
|
+
onChange,
|
|
63
|
+
style,
|
|
64
|
+
value = {}
|
|
65
|
+
}) => {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
const [country, setCountry] = (0, import_react.useState)((value == null ? void 0 : value.country) || (countries == null ? void 0 : countries[0]));
|
|
68
|
+
const [number, setNumber] = (0, import_react.useState)((value == null ? void 0 : value.number) || "");
|
|
69
|
+
(0, import_react.useEffect)(
|
|
70
|
+
() => {
|
|
71
|
+
if (value == null ? void 0 : value.country) return;
|
|
72
|
+
const tags = [navigator.language, ...navigator.languages || []];
|
|
73
|
+
const detected = tags.map((tag) => {
|
|
74
|
+
var _a2, _b2;
|
|
75
|
+
return (_b2 = (_a2 = tag == null ? void 0 : tag.split("-")) == null ? void 0 : _a2[1]) == null ? void 0 : _b2.toUpperCase();
|
|
76
|
+
}).find((code) => code && countries.includes(code));
|
|
77
|
+
if (detected) setCountry(detected);
|
|
78
|
+
},
|
|
79
|
+
[]
|
|
80
|
+
);
|
|
81
|
+
(0, import_react.useEffect)(
|
|
82
|
+
() => {
|
|
83
|
+
onChange({
|
|
84
|
+
country,
|
|
85
|
+
number
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
[country, number, onChange]
|
|
89
|
+
);
|
|
90
|
+
const [keyboard, setKeyboard] = (0, import_react.useState)(false);
|
|
91
|
+
(0, import_react.useEffect)(
|
|
92
|
+
() => {
|
|
93
|
+
const down = (e) => {
|
|
94
|
+
if (e.key === "Tab") setKeyboard(true);
|
|
95
|
+
};
|
|
96
|
+
const click = () => setKeyboard(false);
|
|
97
|
+
window.addEventListener("keydown", down);
|
|
98
|
+
window.addEventListener("mousedown", click);
|
|
99
|
+
return () => {
|
|
100
|
+
window.removeEventListener("keydown", down);
|
|
101
|
+
window.removeEventListener("mousedown", click);
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
[]
|
|
105
|
+
);
|
|
106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
107
|
+
"div",
|
|
108
|
+
{
|
|
109
|
+
...{
|
|
110
|
+
className: "flex items-center input !p-0 overflow-hidden",
|
|
111
|
+
style: inputPhoneStyle(style)
|
|
112
|
+
},
|
|
113
|
+
children: [
|
|
114
|
+
(countries == null ? void 0 : countries.length) > 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
115
|
+
"select",
|
|
116
|
+
{
|
|
117
|
+
...{
|
|
118
|
+
className: "px-3 bg-none appearance-none border-none " + (keyboard ? "focus-visible:!border focus-visible:!border-inherit !rounded-none " : "focus-visible:!outline-0 focus-visible:!ring-0"),
|
|
119
|
+
onChange: ({ target }) => {
|
|
120
|
+
setCountry(target.value);
|
|
121
|
+
setNumber("");
|
|
122
|
+
},
|
|
123
|
+
style: inputPhoneStyle(style),
|
|
124
|
+
value: country
|
|
125
|
+
},
|
|
126
|
+
children: countries.map((item, key) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
127
|
+
"option",
|
|
128
|
+
{
|
|
129
|
+
...{
|
|
130
|
+
value: item
|
|
131
|
+
},
|
|
132
|
+
children: item
|
|
133
|
+
},
|
|
134
|
+
"input-phone-country-" + item + "-" + key
|
|
135
|
+
))
|
|
136
|
+
}
|
|
137
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
138
|
+
"span",
|
|
139
|
+
{
|
|
140
|
+
...{
|
|
141
|
+
className: "px-3 flex items-center",
|
|
142
|
+
style: inputPhoneStyle(style)
|
|
143
|
+
},
|
|
144
|
+
children: (countries == null ? void 0 : countries[0]) || ""
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
...{
|
|
151
|
+
className: "w-full",
|
|
152
|
+
style: {
|
|
153
|
+
borderLeft: "solid 1px " + ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.hex)
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
157
|
+
import_input.default,
|
|
158
|
+
{
|
|
159
|
+
...{
|
|
160
|
+
"aria-label": "Phone Number",
|
|
161
|
+
className: "input w-full border-none focus:outline-none focus:ring-0 focus:border-inherit",
|
|
162
|
+
onChange: (val) => setNumber(val),
|
|
163
|
+
style: inputPhoneStyle(style),
|
|
164
|
+
value: number,
|
|
165
|
+
...country && {
|
|
166
|
+
country,
|
|
167
|
+
international: true,
|
|
168
|
+
withCountryCallingCode: true
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
var input_phone_default = InputPhone;
|
|
180
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
181
|
+
0 && (module.exports = {
|
|
182
|
+
isValidPhone
|
|
183
|
+
});
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
inputPhoneStyle
|
|
4
|
+
} from "./chunk-FJXG3REN.mjs";
|
|
5
|
+
|
|
6
|
+
// components/input-phone.js
|
|
7
|
+
import "react-phone-number-input/style.css";
|
|
8
|
+
import { useEffect, useState } from "react";
|
|
9
|
+
import Input from "react-phone-number-input/input";
|
|
10
|
+
import { isValid } from "@drawbridge/drawbridge-utils/phone";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
var isValidPhone = (number = "", country = "") => {
|
|
13
|
+
const valid = isValid(number, country);
|
|
14
|
+
return valid;
|
|
15
|
+
};
|
|
16
|
+
var InputPhone = ({
|
|
17
|
+
countries = [],
|
|
18
|
+
onChange,
|
|
19
|
+
style,
|
|
20
|
+
value = {}
|
|
21
|
+
}) => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const [country, setCountry] = useState((value == null ? void 0 : value.country) || (countries == null ? void 0 : countries[0]));
|
|
24
|
+
const [number, setNumber] = useState((value == null ? void 0 : value.number) || "");
|
|
25
|
+
useEffect(
|
|
26
|
+
() => {
|
|
27
|
+
if (value == null ? void 0 : value.country) return;
|
|
28
|
+
const tags = [navigator.language, ...navigator.languages || []];
|
|
29
|
+
const detected = tags.map((tag) => {
|
|
30
|
+
var _a2, _b2;
|
|
31
|
+
return (_b2 = (_a2 = tag == null ? void 0 : tag.split("-")) == null ? void 0 : _a2[1]) == null ? void 0 : _b2.toUpperCase();
|
|
32
|
+
}).find((code) => code && countries.includes(code));
|
|
33
|
+
if (detected) setCountry(detected);
|
|
34
|
+
},
|
|
35
|
+
[]
|
|
36
|
+
);
|
|
37
|
+
useEffect(
|
|
38
|
+
() => {
|
|
39
|
+
onChange({
|
|
40
|
+
country,
|
|
41
|
+
number
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
[country, number, onChange]
|
|
45
|
+
);
|
|
46
|
+
const [keyboard, setKeyboard] = useState(false);
|
|
47
|
+
useEffect(
|
|
48
|
+
() => {
|
|
49
|
+
const down = (e) => {
|
|
50
|
+
if (e.key === "Tab") setKeyboard(true);
|
|
51
|
+
};
|
|
52
|
+
const click = () => setKeyboard(false);
|
|
53
|
+
window.addEventListener("keydown", down);
|
|
54
|
+
window.addEventListener("mousedown", click);
|
|
55
|
+
return () => {
|
|
56
|
+
window.removeEventListener("keydown", down);
|
|
57
|
+
window.removeEventListener("mousedown", click);
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
[]
|
|
61
|
+
);
|
|
62
|
+
return /* @__PURE__ */ jsxs(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
...{
|
|
66
|
+
className: "flex items-center input !p-0 overflow-hidden",
|
|
67
|
+
style: inputPhoneStyle(style)
|
|
68
|
+
},
|
|
69
|
+
children: [
|
|
70
|
+
(countries == null ? void 0 : countries.length) > 1 ? /* @__PURE__ */ jsx(
|
|
71
|
+
"select",
|
|
72
|
+
{
|
|
73
|
+
...{
|
|
74
|
+
className: "px-3 bg-none appearance-none border-none " + (keyboard ? "focus-visible:!border focus-visible:!border-inherit !rounded-none " : "focus-visible:!outline-0 focus-visible:!ring-0"),
|
|
75
|
+
onChange: ({ target }) => {
|
|
76
|
+
setCountry(target.value);
|
|
77
|
+
setNumber("");
|
|
78
|
+
},
|
|
79
|
+
style: inputPhoneStyle(style),
|
|
80
|
+
value: country
|
|
81
|
+
},
|
|
82
|
+
children: countries.map((item, key) => /* @__PURE__ */ jsx(
|
|
83
|
+
"option",
|
|
84
|
+
{
|
|
85
|
+
...{
|
|
86
|
+
value: item
|
|
87
|
+
},
|
|
88
|
+
children: item
|
|
89
|
+
},
|
|
90
|
+
"input-phone-country-" + item + "-" + key
|
|
91
|
+
))
|
|
92
|
+
}
|
|
93
|
+
) : /* @__PURE__ */ jsx(
|
|
94
|
+
"span",
|
|
95
|
+
{
|
|
96
|
+
...{
|
|
97
|
+
className: "px-3 flex items-center",
|
|
98
|
+
style: inputPhoneStyle(style)
|
|
99
|
+
},
|
|
100
|
+
children: (countries == null ? void 0 : countries[0]) || ""
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
...{
|
|
107
|
+
className: "w-full",
|
|
108
|
+
style: {
|
|
109
|
+
borderLeft: "solid 1px " + ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.hex)
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
children: /* @__PURE__ */ jsx(
|
|
113
|
+
Input,
|
|
114
|
+
{
|
|
115
|
+
...{
|
|
116
|
+
"aria-label": "Phone Number",
|
|
117
|
+
className: "input w-full border-none focus:outline-none focus:ring-0 focus:border-inherit",
|
|
118
|
+
onChange: (val) => setNumber(val),
|
|
119
|
+
style: inputPhoneStyle(style),
|
|
120
|
+
value: number,
|
|
121
|
+
...country && {
|
|
122
|
+
country,
|
|
123
|
+
international: true,
|
|
124
|
+
withCountryCallingCode: true
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
var input_phone_default = InputPhone;
|
|
136
|
+
export {
|
|
137
|
+
input_phone_default as default,
|
|
138
|
+
isValidPhone
|
|
139
|
+
};
|
package/dist/input-text.mjs
CHANGED
|
@@ -1,36 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
|
|
5
|
-
// components/input-text.js
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
var InputText = ({
|
|
8
|
-
className,
|
|
9
|
-
max,
|
|
10
|
-
onChange,
|
|
11
|
-
style,
|
|
12
|
-
value,
|
|
13
|
-
...rest
|
|
14
|
-
}) => {
|
|
15
|
-
const classes = ["input"];
|
|
16
|
-
if (className) {
|
|
17
|
-
classes.push(className);
|
|
18
|
-
}
|
|
19
|
-
;
|
|
20
|
-
return /* @__PURE__ */ jsx(
|
|
21
|
-
"input",
|
|
22
|
-
{
|
|
23
|
-
...{
|
|
24
|
-
...rest,
|
|
25
|
-
className: classes.join(" "),
|
|
26
|
-
onChange: ({ target }) => onChange(target.value),
|
|
27
|
-
style: inputStyle(style),
|
|
28
|
-
value
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
var input_text_default = InputText;
|
|
2
|
+
input_text_default
|
|
3
|
+
} from "./chunk-BZ6WMIH7.mjs";
|
|
4
|
+
import "./chunk-FJXG3REN.mjs";
|
|
34
5
|
export {
|
|
35
6
|
input_text_default as default
|
|
36
7
|
};
|
package/dist/product.js
CHANGED
|
@@ -75,7 +75,8 @@ var InputGroup = ({
|
|
|
75
75
|
input,
|
|
76
76
|
label,
|
|
77
77
|
message,
|
|
78
|
-
style = {}
|
|
78
|
+
style = {},
|
|
79
|
+
...rest
|
|
79
80
|
}) => {
|
|
80
81
|
var _a, _b, _c, _d;
|
|
81
82
|
const classes = [
|
|
@@ -92,7 +93,10 @@ var InputGroup = ({
|
|
|
92
93
|
{
|
|
93
94
|
...{
|
|
94
95
|
className: classes.join(" "),
|
|
95
|
-
"aria-live": "polite"
|
|
96
|
+
"aria-live": "polite",
|
|
97
|
+
...(rest == null ? void 0 : rest["data-guide"]) && {
|
|
98
|
+
"data-guide": rest["data-guide"]
|
|
99
|
+
}
|
|
96
100
|
},
|
|
97
101
|
children: [
|
|
98
102
|
label ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
@@ -567,6 +571,7 @@ var DefaultImage = ({ alt, className, src }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
567
571
|
);
|
|
568
572
|
var Product = ({
|
|
569
573
|
action = null,
|
|
574
|
+
addToCart = true,
|
|
570
575
|
disabled = false,
|
|
571
576
|
errors = {},
|
|
572
577
|
header,
|
|
@@ -807,10 +812,10 @@ var Product = ({
|
|
|
807
812
|
"div",
|
|
808
813
|
{
|
|
809
814
|
...{
|
|
810
|
-
className: "grid grid-cols-2 gap-3"
|
|
815
|
+
className: addToCart ? "grid grid-cols-2 gap-3" : ""
|
|
811
816
|
},
|
|
812
817
|
children: [
|
|
813
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
818
|
+
addToCart && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
814
819
|
"button",
|
|
815
820
|
{
|
|
816
821
|
...{
|
|
@@ -834,7 +839,7 @@ var Product = ({
|
|
|
834
839
|
"button",
|
|
835
840
|
{
|
|
836
841
|
...{
|
|
837
|
-
className: "button justify-center",
|
|
842
|
+
className: "button justify-center" + (addToCart ? "" : " w-full"),
|
|
838
843
|
disabled: disabled || Boolean(action),
|
|
839
844
|
onClick: onBuy,
|
|
840
845
|
style: buttonStyle(style),
|
package/dist/product.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
product_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BHQBSNGK.mjs";
|
|
5
|
+
import "./chunk-BD3TDNJE.mjs";
|
|
6
|
+
import "./chunk-FYA7EAMR.mjs";
|
|
5
7
|
import "./chunk-2ZYGRSSA.mjs";
|
|
6
8
|
import "./chunk-XWELEL6Z.mjs";
|
|
7
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-JJH46E7B.mjs";
|
|
8
10
|
import "./chunk-Q3UIVGPQ.mjs";
|
|
9
|
-
import "./chunk-BD3TDNJE.mjs";
|
|
10
|
-
import "./chunk-FYA7EAMR.mjs";
|
|
11
11
|
import "./chunk-FJXG3REN.mjs";
|
|
12
12
|
export {
|
|
13
13
|
product_default as default
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// components/provider-font.js
|
|
20
|
+
var provider_font_exports = {};
|
|
21
|
+
__export(provider_font_exports, {
|
|
22
|
+
default: () => provider_font_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(provider_font_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
+
var defaults = {
|
|
28
|
+
family: "Roboto Flex",
|
|
29
|
+
transform: "none"
|
|
30
|
+
};
|
|
31
|
+
var toWeight = (value) => {
|
|
32
|
+
var _a;
|
|
33
|
+
if (value.includes("italic")) return (_a = value.match(/^\d+/)) == null ? void 0 : _a[0];
|
|
34
|
+
if (value.includes("regular")) return "normal";
|
|
35
|
+
return value;
|
|
36
|
+
};
|
|
37
|
+
var ProviderFont = (0, import_react.memo)(({
|
|
38
|
+
body,
|
|
39
|
+
children,
|
|
40
|
+
heading,
|
|
41
|
+
onError
|
|
42
|
+
}) => {
|
|
43
|
+
const { url, fonts } = (0, import_react.useMemo)(
|
|
44
|
+
() => {
|
|
45
|
+
const bodyFamily = (body == null ? void 0 : body.family) || defaults.family;
|
|
46
|
+
const headingFamily = (heading == null ? void 0 : heading.family) || defaults.family;
|
|
47
|
+
const same = headingFamily === bodyFamily;
|
|
48
|
+
const url2 = [
|
|
49
|
+
"https://fonts.googleapis.com/css?family=" + bodyFamily.replace(/ /g, "+")
|
|
50
|
+
];
|
|
51
|
+
const fonts2 = {
|
|
52
|
+
body: {
|
|
53
|
+
fontFamily: '"' + bodyFamily + '"',
|
|
54
|
+
textTransform: (body == null ? void 0 : body.transform) || defaults.transform
|
|
55
|
+
},
|
|
56
|
+
heading: {
|
|
57
|
+
fontFamily: '"' + headingFamily + '"',
|
|
58
|
+
textTransform: (heading == null ? void 0 : heading.transform) || defaults.transform
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
if (body == null ? void 0 : body.weight) {
|
|
62
|
+
url2.push(":" + body.weight);
|
|
63
|
+
fonts2.body.fontWeight = toWeight(body.weight);
|
|
64
|
+
}
|
|
65
|
+
if (!same) {
|
|
66
|
+
url2.push("%7C" + headingFamily.replace(/ /g, "+"));
|
|
67
|
+
}
|
|
68
|
+
if (heading == null ? void 0 : heading.weight) {
|
|
69
|
+
url2.push((same ? "," : ":") + heading.weight);
|
|
70
|
+
fonts2.heading.fontWeight = toWeight(heading.weight);
|
|
71
|
+
}
|
|
72
|
+
url2.push("&display=swap");
|
|
73
|
+
return { url: url2, fonts: fonts2 };
|
|
74
|
+
},
|
|
75
|
+
[body, heading]
|
|
76
|
+
);
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
79
|
+
"link",
|
|
80
|
+
{
|
|
81
|
+
...{
|
|
82
|
+
href: url.join(""),
|
|
83
|
+
rel: "stylesheet",
|
|
84
|
+
...onError && {
|
|
85
|
+
onError
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
children(fonts)
|
|
91
|
+
] });
|
|
92
|
+
});
|
|
93
|
+
ProviderFont.displayName = "ProviderFont";
|
|
94
|
+
var provider_font_default = ProviderFont;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// components/provider-font.js
|
|
2
|
+
import { Fragment, memo, useMemo } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
var defaults = {
|
|
5
|
+
family: "Roboto Flex",
|
|
6
|
+
transform: "none"
|
|
7
|
+
};
|
|
8
|
+
var toWeight = (value) => {
|
|
9
|
+
var _a;
|
|
10
|
+
if (value.includes("italic")) return (_a = value.match(/^\d+/)) == null ? void 0 : _a[0];
|
|
11
|
+
if (value.includes("regular")) return "normal";
|
|
12
|
+
return value;
|
|
13
|
+
};
|
|
14
|
+
var ProviderFont = memo(({
|
|
15
|
+
body,
|
|
16
|
+
children,
|
|
17
|
+
heading,
|
|
18
|
+
onError
|
|
19
|
+
}) => {
|
|
20
|
+
const { url, fonts } = useMemo(
|
|
21
|
+
() => {
|
|
22
|
+
const bodyFamily = (body == null ? void 0 : body.family) || defaults.family;
|
|
23
|
+
const headingFamily = (heading == null ? void 0 : heading.family) || defaults.family;
|
|
24
|
+
const same = headingFamily === bodyFamily;
|
|
25
|
+
const url2 = [
|
|
26
|
+
"https://fonts.googleapis.com/css?family=" + bodyFamily.replace(/ /g, "+")
|
|
27
|
+
];
|
|
28
|
+
const fonts2 = {
|
|
29
|
+
body: {
|
|
30
|
+
fontFamily: '"' + bodyFamily + '"',
|
|
31
|
+
textTransform: (body == null ? void 0 : body.transform) || defaults.transform
|
|
32
|
+
},
|
|
33
|
+
heading: {
|
|
34
|
+
fontFamily: '"' + headingFamily + '"',
|
|
35
|
+
textTransform: (heading == null ? void 0 : heading.transform) || defaults.transform
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
if (body == null ? void 0 : body.weight) {
|
|
39
|
+
url2.push(":" + body.weight);
|
|
40
|
+
fonts2.body.fontWeight = toWeight(body.weight);
|
|
41
|
+
}
|
|
42
|
+
if (!same) {
|
|
43
|
+
url2.push("%7C" + headingFamily.replace(/ /g, "+"));
|
|
44
|
+
}
|
|
45
|
+
if (heading == null ? void 0 : heading.weight) {
|
|
46
|
+
url2.push((same ? "," : ":") + heading.weight);
|
|
47
|
+
fonts2.heading.fontWeight = toWeight(heading.weight);
|
|
48
|
+
}
|
|
49
|
+
url2.push("&display=swap");
|
|
50
|
+
return { url: url2, fonts: fonts2 };
|
|
51
|
+
},
|
|
52
|
+
[body, heading]
|
|
53
|
+
);
|
|
54
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
55
|
+
/* @__PURE__ */ jsx(
|
|
56
|
+
"link",
|
|
57
|
+
{
|
|
58
|
+
...{
|
|
59
|
+
href: url.join(""),
|
|
60
|
+
rel: "stylesheet",
|
|
61
|
+
...onError && {
|
|
62
|
+
onError
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
children(fonts)
|
|
68
|
+
] });
|
|
69
|
+
});
|
|
70
|
+
ProviderFont.displayName = "ProviderFont";
|
|
71
|
+
var provider_font_default = ProviderFont;
|
|
72
|
+
export {
|
|
73
|
+
provider_font_default as default
|
|
74
|
+
};
|
package/dist/video.js
CHANGED
|
@@ -87,12 +87,14 @@ var ReactPlayer = (0, import_dynamic.default)(
|
|
|
87
87
|
}
|
|
88
88
|
);
|
|
89
89
|
var Video = ({
|
|
90
|
+
className,
|
|
90
91
|
controls = false,
|
|
91
92
|
loop = false,
|
|
92
93
|
onEnded = () => {
|
|
93
94
|
},
|
|
94
95
|
onDuration = () => {
|
|
95
96
|
},
|
|
97
|
+
onTime,
|
|
96
98
|
muted = true,
|
|
97
99
|
onPlay,
|
|
98
100
|
playing = false,
|
|
@@ -114,7 +116,7 @@ var Video = ({
|
|
|
114
116
|
},
|
|
115
117
|
[player, reset]
|
|
116
118
|
);
|
|
117
|
-
|
|
119
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react.Fragment, { children: [
|
|
118
120
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
119
121
|
ReactPlayer,
|
|
120
122
|
{
|
|
@@ -140,6 +142,13 @@ var Video = ({
|
|
|
140
142
|
onDuration(value);
|
|
141
143
|
}
|
|
142
144
|
},
|
|
145
|
+
onProgress: ({ playedSeconds }) => {
|
|
146
|
+
onTime == null ? void 0 : onTime(playedSeconds);
|
|
147
|
+
},
|
|
148
|
+
onSeek: (seconds) => {
|
|
149
|
+
onTime == null ? void 0 : onTime(seconds);
|
|
150
|
+
},
|
|
151
|
+
progressInterval: 100,
|
|
143
152
|
onError: () => {
|
|
144
153
|
setVideoUrl(mp4);
|
|
145
154
|
},
|
|
@@ -173,5 +182,14 @@ var Video = ({
|
|
|
173
182
|
}
|
|
174
183
|
)
|
|
175
184
|
] });
|
|
185
|
+
return className ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
186
|
+
"div",
|
|
187
|
+
{
|
|
188
|
+
...{
|
|
189
|
+
className
|
|
190
|
+
},
|
|
191
|
+
children: inner
|
|
192
|
+
}
|
|
193
|
+
) : inner;
|
|
176
194
|
};
|
|
177
195
|
var video_default = Video;
|