jvetrau-ds 0.1.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/icons.cjs +160 -0
- package/icons.cjs.map +1 -0
- package/icons.d.cts +2 -0
- package/icons.d.ts +2 -0
- package/icons.js +158 -0
- package/icons.js.map +1 -0
- package/index.cjs +1193 -0
- package/index.cjs.map +1 -0
- package/index.d.cts +141 -0
- package/index.d.ts +141 -0
- package/index.js +1170 -0
- package/index.js.map +1 -0
- package/package.json +48 -0
- package/patterns.cjs +4 -0
- package/patterns.cjs.map +1 -0
- package/patterns.d.cts +2 -0
- package/patterns.d.ts +2 -0
- package/patterns.js +3 -0
- package/patterns.js.map +1 -0
- package/styles.css +1905 -0
- package/themes/base/desktop.css +149 -0
- package/themes/base/desktop.md +188 -0
- package/themes/base/desktop.scoped.css +149 -0
- package/themes/base/diagram.css +149 -0
- package/themes/base/diagram.md +188 -0
- package/themes/base/diagram.scoped.css +149 -0
- package/themes/base/mobile.css +149 -0
- package/themes/base/mobile.md +188 -0
- package/themes/base/mobile.scoped.css +149 -0
- package/themes/brandcopilot/desktop.css +149 -0
- package/themes/brandcopilot/desktop.md +188 -0
- package/themes/brandcopilot/desktop.scoped.css +149 -0
- package/themes/brandcopilot/diagram.css +149 -0
- package/themes/brandcopilot/diagram.md +188 -0
- package/themes/brandcopilot/diagram.scoped.css +149 -0
- package/themes/brandcopilot/mobile.css +149 -0
- package/themes/brandcopilot/mobile.md +188 -0
- package/themes/brandcopilot/mobile.scoped.css +149 -0
- package/themes/dmpatterns/desktop.css +149 -0
- package/themes/dmpatterns/desktop.md +188 -0
- package/themes/dmpatterns/desktop.scoped.css +149 -0
- package/themes/dmpatterns/diagram.css +149 -0
- package/themes/dmpatterns/diagram.md +188 -0
- package/themes/dmpatterns/diagram.scoped.css +149 -0
- package/themes/dmpatterns/mobile.css +149 -0
- package/themes/dmpatterns/mobile.md +188 -0
- package/themes/dmpatterns/mobile.scoped.css +149 -0
- package/themes/pdigest/desktop.css +149 -0
- package/themes/pdigest/desktop.md +188 -0
- package/themes/pdigest/desktop.scoped.css +149 -0
- package/themes/pdigest/diagram.css +149 -0
- package/themes/pdigest/diagram.md +188 -0
- package/themes/pdigest/diagram.scoped.css +149 -0
- package/themes/pdigest/mobile.css +149 -0
- package/themes/pdigest/mobile.md +188 -0
- package/themes/pdigest/mobile.scoped.css +149 -0
- package/themes/redesigntrack/desktop.css +149 -0
- package/themes/redesigntrack/desktop.md +188 -0
- package/themes/redesigntrack/desktop.scoped.css +149 -0
- package/themes/redesigntrack/diagram.css +149 -0
- package/themes/redesigntrack/diagram.md +188 -0
- package/themes/redesigntrack/diagram.scoped.css +149 -0
- package/themes/redesigntrack/mobile.css +149 -0
- package/themes/redesigntrack/mobile.md +188 -0
- package/themes/redesigntrack/mobile.scoped.css +149 -0
- package/tokens.cjs +17734 -0
- package/tokens.cjs.map +1 -0
- package/tokens.d.cts +27 -0
- package/tokens.d.ts +27 -0
- package/tokens.js +17732 -0
- package/tokens.js.map +1 -0
package/index.js
ADDED
|
@@ -0,0 +1,1170 @@
|
|
|
1
|
+
import React4, { isValidElement, cloneElement, useRef, useState, useEffect } from 'react';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import Hls from 'hls.js';
|
|
4
|
+
|
|
5
|
+
// src/components/button/button.tsx
|
|
6
|
+
|
|
7
|
+
// src/components/helpers/classnames.ts
|
|
8
|
+
function classnames(...args) {
|
|
9
|
+
const classes = [];
|
|
10
|
+
args.forEach((arg) => {
|
|
11
|
+
if (!arg) return;
|
|
12
|
+
if (typeof arg === "string") {
|
|
13
|
+
classes.push(arg);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
for (const key in arg) {
|
|
17
|
+
if (arg[key]) {
|
|
18
|
+
classes.push(key);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return classes.join(" ");
|
|
23
|
+
}
|
|
24
|
+
var arrowLink = {
|
|
25
|
+
xs: /* @__PURE__ */ jsx("path", { d: "M4 8H10M8 4H12V8M12 4L7 9" }),
|
|
26
|
+
s: /* @__PURE__ */ jsx("path", { d: "M5 10H12M10 5H15V10M15 5L9 11" }),
|
|
27
|
+
m: /* @__PURE__ */ jsx("path", { d: "M6 12H14M12 6H18V12M18 6L11 13" }),
|
|
28
|
+
l: /* @__PURE__ */ jsx("path", { d: "M8 16H19M16 8H24V16M24 8L15 17" })
|
|
29
|
+
};
|
|
30
|
+
var arrowRight = {
|
|
31
|
+
xs: /* @__PURE__ */ jsx("path", { d: "M4 8H12M9 5L12 8L9 11" }),
|
|
32
|
+
s: /* @__PURE__ */ jsx("path", { d: "M5 10H15M11 6L15 10L11 14" }),
|
|
33
|
+
m: /* @__PURE__ */ jsx("path", { d: "M6 12H18M13 7L18 12L13 17" }),
|
|
34
|
+
l: /* @__PURE__ */ jsx("path", { d: "M8 16H24M18 10L24 16L18 22" })
|
|
35
|
+
};
|
|
36
|
+
var chevronRight = {
|
|
37
|
+
xs: /* @__PURE__ */ jsx("path", { d: "M6 4.5L9.5 8L6 11.5" }),
|
|
38
|
+
s: /* @__PURE__ */ jsx("path", { d: "M8 5.5L12.5 10L8 14.5" }),
|
|
39
|
+
m: /* @__PURE__ */ jsx("path", { d: "M9.5 6.5L15 12L9.5 17.5" }),
|
|
40
|
+
l: /* @__PURE__ */ jsx("path", { d: "M13 9L20 16L13 23" })
|
|
41
|
+
};
|
|
42
|
+
var fullscreen = {
|
|
43
|
+
xs: /* @__PURE__ */ jsx("path", { d: "M5 7V5H7M11 5H13V7M13 11V13H11M7 13H5V11" }),
|
|
44
|
+
s: /* @__PURE__ */ jsx("path", { d: "M6 8V6H8M14 6H16V8M16 14V16H14M8 16H6V14" }),
|
|
45
|
+
m: /* @__PURE__ */ jsx("path", { d: "M7 10V7H10M14 7H17V10M17 14V17H14M10 17H7V14" }),
|
|
46
|
+
l: /* @__PURE__ */ jsx("path", { d: "M9 13V9H13M19 9H23V13M23 19V23H19M13 23H9V19" })
|
|
47
|
+
};
|
|
48
|
+
var pause = {
|
|
49
|
+
xs: /* @__PURE__ */ jsx("path", { d: "M5 4V12M11 4V12" }),
|
|
50
|
+
s: /* @__PURE__ */ jsx("path", { d: "M7 5V15M13 5V15" }),
|
|
51
|
+
m: /* @__PURE__ */ jsx("path", { d: "M9 6V18M15 6V18" }),
|
|
52
|
+
l: /* @__PURE__ */ jsx("path", { d: "M11 8V24M21 8V24" })
|
|
53
|
+
};
|
|
54
|
+
var play = {
|
|
55
|
+
xs: /* @__PURE__ */ jsx("path", { d: "M6 5.5L11 8L6 10.5Z" }),
|
|
56
|
+
s: /* @__PURE__ */ jsx("path", { d: "M7 6.5L13.5 10L7 13.5Z" }),
|
|
57
|
+
m: /* @__PURE__ */ jsx("path", { d: "M8 7L16 12L8 17Z" }),
|
|
58
|
+
l: /* @__PURE__ */ jsx("path", { d: "M11 9L21 16L11 23Z" })
|
|
59
|
+
};
|
|
60
|
+
var settings = {
|
|
61
|
+
xs: /* @__PURE__ */ jsx("path", { d: "M8 5V3.5M8 12.5V11M5.9 5.9L4.8 4.8M11.2 11.2L10.1 10.1M5 8H3.5M12.5 8H11M5.9 10.1L4.8 11.2M11.2 4.8L10.1 5.9M8 6.5A1.5 1.5 0 1 1 8 9.5A1.5 1.5 0 0 1 8 6.5Z" }),
|
|
62
|
+
s: /* @__PURE__ */ jsx("path", { d: "M10 6V4M10 16V14M7.2 7.2L5.8 5.8M14.2 14.2L12.8 12.8M6 10H4M16 10H14M7.2 12.8L5.8 14.2M14.2 5.8L12.8 7.2M10 8A2 2 0 1 1 10 12A2 2 0 0 1 10 8Z" }),
|
|
63
|
+
m: /* @__PURE__ */ jsx("path", { d: "M12 7V4M12 20V17M8.5 8.5L6.4 6.4M17.6 17.6L15.5 15.5M7 12H4M20 12H17M8.5 15.5L6.4 17.6M17.6 6.4L15.5 8.5M12 9A3 3 0 1 1 12 15A3 3 0 0 1 12 9Z" }),
|
|
64
|
+
l: /* @__PURE__ */ jsx("path", { d: "M16 9V5M16 27V23M11 11L8 8M24 24L21 21M9 16H5M27 16H23M11 21L8 24M24 8L21 11M16 12A4 4 0 1 1 16 20A4 4 0 0 1 16 12Z" })
|
|
65
|
+
};
|
|
66
|
+
var sound = {
|
|
67
|
+
xs: /* @__PURE__ */ jsx("path", { d: "M3.5 9.5H6L9.5 12.5V3.5L6 6.5H3.5V9.5ZM11 6.5C11.7 7.2 11.7 8.8 11 9.5" }),
|
|
68
|
+
s: /* @__PURE__ */ jsx("path", { d: "M4.5 12H7.5L12 16V4L7.5 8H4.5V12ZM14 7.5C15 8.5 15 11.5 14 12.5" }),
|
|
69
|
+
m: /* @__PURE__ */ jsx("path", { d: "M5.5 14.5H9L15 19V5L9 9.5H5.5V14.5ZM17 8.5C18.5 10 18.5 14 17 15.5" }),
|
|
70
|
+
l: /* @__PURE__ */ jsx("path", { d: "M7 19H12L20 25V7L12 13H7V19ZM23 11C25 13 25 19 23 21" })
|
|
71
|
+
};
|
|
72
|
+
var soundOff = {
|
|
73
|
+
xs: /* @__PURE__ */ jsx("path", { d: "M3.5 9.5H6L9.5 12.5V3.5L6 6.5H3.5V9.5ZM11 6.5L13 8.5M13 6.5L11 8.5" }),
|
|
74
|
+
s: /* @__PURE__ */ jsx("path", { d: "M4.5 12H7.5L12 16V4L7.5 8H4.5V12ZM14 8L17 11M17 8L14 11" }),
|
|
75
|
+
m: /* @__PURE__ */ jsx("path", { d: "M5.5 14.5H9L15 19V5L9 9.5H5.5V14.5ZM17 9L21 13M21 9L17 13" }),
|
|
76
|
+
l: /* @__PURE__ */ jsx("path", { d: "M7 19H12L20 25V7L12 13H7V19ZM23 12L27 16M27 12L23 16" })
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// src/icons/registry.ts
|
|
80
|
+
var iconRegistry = {
|
|
81
|
+
"arrow-link": arrowLink,
|
|
82
|
+
"arrow-right": arrowRight,
|
|
83
|
+
"chevron-right": chevronRight,
|
|
84
|
+
fullscreen,
|
|
85
|
+
pause,
|
|
86
|
+
play,
|
|
87
|
+
settings,
|
|
88
|
+
sound,
|
|
89
|
+
"sound-off": soundOff
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// src/tokens/helpers/create-scale-tokens.ts
|
|
93
|
+
function detectTokenType(value) {
|
|
94
|
+
if (typeof value === "number") return "float";
|
|
95
|
+
if (typeof value === "string") return "string";
|
|
96
|
+
return "boolean";
|
|
97
|
+
}
|
|
98
|
+
function createScaleTokens(tokenPathPrefix, values) {
|
|
99
|
+
return Object.entries(values).map(([step, value]) => ({
|
|
100
|
+
collection: "scales",
|
|
101
|
+
name: `${tokenPathPrefix}/${step}`,
|
|
102
|
+
type: detectTokenType(value),
|
|
103
|
+
values: {
|
|
104
|
+
value
|
|
105
|
+
}
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// src/tokens/scales/size.ts
|
|
110
|
+
var sizeX = {
|
|
111
|
+
"0": 0,
|
|
112
|
+
"025": 1,
|
|
113
|
+
"05": 2,
|
|
114
|
+
"1": 4,
|
|
115
|
+
"2": 8,
|
|
116
|
+
"3": 12,
|
|
117
|
+
"4": 16,
|
|
118
|
+
"5": 20,
|
|
119
|
+
"6": 24,
|
|
120
|
+
"8": 32,
|
|
121
|
+
"10": 40,
|
|
122
|
+
"12": 48
|
|
123
|
+
};
|
|
124
|
+
var sizeGrid = {
|
|
125
|
+
s: 12,
|
|
126
|
+
m: 20,
|
|
127
|
+
l: 40,
|
|
128
|
+
xl: 60,
|
|
129
|
+
xxl: 80,
|
|
130
|
+
xxxl: 100
|
|
131
|
+
};
|
|
132
|
+
var sizeIcon = {
|
|
133
|
+
xs: 16,
|
|
134
|
+
s: 20,
|
|
135
|
+
m: 24,
|
|
136
|
+
l: 32
|
|
137
|
+
};
|
|
138
|
+
[
|
|
139
|
+
...createScaleTokens("size/x", sizeX),
|
|
140
|
+
...createScaleTokens("size/grid", sizeGrid),
|
|
141
|
+
...createScaleTokens("size/icon", sizeIcon)
|
|
142
|
+
];
|
|
143
|
+
var iconSizeMap = sizeIcon;
|
|
144
|
+
var Icon = ({
|
|
145
|
+
name,
|
|
146
|
+
size: iconSize = "m",
|
|
147
|
+
className,
|
|
148
|
+
...props
|
|
149
|
+
}) => {
|
|
150
|
+
const glyph = iconRegistry[name];
|
|
151
|
+
const size = iconSizeMap[iconSize];
|
|
152
|
+
const viewBox = `0 0 ${size} ${size}`;
|
|
153
|
+
const classes = ["icon", className].filter(Boolean).join(" ");
|
|
154
|
+
return /* @__PURE__ */ jsx(
|
|
155
|
+
"svg",
|
|
156
|
+
{
|
|
157
|
+
className: classes,
|
|
158
|
+
width: size,
|
|
159
|
+
height: size,
|
|
160
|
+
viewBox,
|
|
161
|
+
fill: "none",
|
|
162
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
163
|
+
stroke: "currentColor",
|
|
164
|
+
strokeWidth: 1.5,
|
|
165
|
+
strokeLinecap: "round",
|
|
166
|
+
strokeLinejoin: "round",
|
|
167
|
+
"aria-hidden": "true",
|
|
168
|
+
focusable: "false",
|
|
169
|
+
...props,
|
|
170
|
+
children: glyph[iconSize]
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
};
|
|
174
|
+
var icon_default = Icon;
|
|
175
|
+
var Button = ({
|
|
176
|
+
state = "default",
|
|
177
|
+
icon,
|
|
178
|
+
className = "",
|
|
179
|
+
disabled = false,
|
|
180
|
+
children,
|
|
181
|
+
...props
|
|
182
|
+
}) => {
|
|
183
|
+
const isIconOnly = !!icon && !children;
|
|
184
|
+
const classes = classnames("button", className, {
|
|
185
|
+
"button--primary": state === "primary",
|
|
186
|
+
"button--disabled": disabled,
|
|
187
|
+
"button--icon-only": isIconOnly
|
|
188
|
+
});
|
|
189
|
+
let resolvedIcon = icon;
|
|
190
|
+
if (isValidElement(icon) && icon.type === icon_default) {
|
|
191
|
+
const iconElement = icon;
|
|
192
|
+
resolvedIcon = cloneElement(iconElement, {
|
|
193
|
+
size: iconElement.props.size ?? "s",
|
|
194
|
+
className: classnames("button__icon", iconElement.props.className),
|
|
195
|
+
"aria-hidden": iconElement.props["aria-hidden"] ?? true,
|
|
196
|
+
focusable: iconElement.props.focusable ?? false
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return /* @__PURE__ */ jsxs(
|
|
200
|
+
"button",
|
|
201
|
+
{
|
|
202
|
+
className: classes,
|
|
203
|
+
disabled,
|
|
204
|
+
...props,
|
|
205
|
+
children: [
|
|
206
|
+
resolvedIcon,
|
|
207
|
+
children
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
};
|
|
212
|
+
var button_default = Button;
|
|
213
|
+
var ButtonIcon = ({
|
|
214
|
+
state = "default",
|
|
215
|
+
icon,
|
|
216
|
+
label,
|
|
217
|
+
className = "",
|
|
218
|
+
disabled = false,
|
|
219
|
+
...props
|
|
220
|
+
}) => {
|
|
221
|
+
const isDisabled = disabled || state === "disabled";
|
|
222
|
+
const classes = classnames("button-icon", className, {
|
|
223
|
+
"button-icon--disabled": isDisabled
|
|
224
|
+
});
|
|
225
|
+
return /* @__PURE__ */ jsx(
|
|
226
|
+
"button",
|
|
227
|
+
{
|
|
228
|
+
className: classes,
|
|
229
|
+
disabled: isDisabled,
|
|
230
|
+
"aria-label": label,
|
|
231
|
+
title: label,
|
|
232
|
+
...props,
|
|
233
|
+
children: /* @__PURE__ */ jsx(
|
|
234
|
+
icon_default,
|
|
235
|
+
{
|
|
236
|
+
name: icon,
|
|
237
|
+
className: "button-icon__icon",
|
|
238
|
+
"aria-hidden": true,
|
|
239
|
+
focusable: false
|
|
240
|
+
}
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
};
|
|
245
|
+
var button_icon_default = ButtonIcon;
|
|
246
|
+
var Input = ({
|
|
247
|
+
state = "default",
|
|
248
|
+
className = "",
|
|
249
|
+
disabled = false,
|
|
250
|
+
...props
|
|
251
|
+
}) => {
|
|
252
|
+
const classes = classnames("input", className, {
|
|
253
|
+
error: state === "error",
|
|
254
|
+
success: state === "success"
|
|
255
|
+
});
|
|
256
|
+
return /* @__PURE__ */ jsx(
|
|
257
|
+
"input",
|
|
258
|
+
{
|
|
259
|
+
className: classes,
|
|
260
|
+
disabled,
|
|
261
|
+
...props
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
};
|
|
265
|
+
var input_default = Input;
|
|
266
|
+
var Textarea = ({
|
|
267
|
+
state = "default",
|
|
268
|
+
className = "",
|
|
269
|
+
disabled = false,
|
|
270
|
+
...props
|
|
271
|
+
}) => {
|
|
272
|
+
const classes = classnames("textarea", className, {
|
|
273
|
+
error: state === "error",
|
|
274
|
+
success: state === "success"
|
|
275
|
+
});
|
|
276
|
+
return /* @__PURE__ */ jsx(
|
|
277
|
+
"textarea",
|
|
278
|
+
{
|
|
279
|
+
className: classes,
|
|
280
|
+
disabled,
|
|
281
|
+
...props
|
|
282
|
+
}
|
|
283
|
+
);
|
|
284
|
+
};
|
|
285
|
+
var textarea_default = Textarea;
|
|
286
|
+
var Select = ({
|
|
287
|
+
state = "default",
|
|
288
|
+
className = "",
|
|
289
|
+
disabled = false,
|
|
290
|
+
children,
|
|
291
|
+
...props
|
|
292
|
+
}) => {
|
|
293
|
+
const classes = classnames("select", className, {
|
|
294
|
+
error: state === "error",
|
|
295
|
+
success: state === "success"
|
|
296
|
+
});
|
|
297
|
+
return /* @__PURE__ */ jsx("div", { className: classes, children: /* @__PURE__ */ jsx(
|
|
298
|
+
"select",
|
|
299
|
+
{
|
|
300
|
+
className: "select__field",
|
|
301
|
+
disabled,
|
|
302
|
+
...props,
|
|
303
|
+
children
|
|
304
|
+
}
|
|
305
|
+
) });
|
|
306
|
+
};
|
|
307
|
+
var select_default = Select;
|
|
308
|
+
var Dropdown = ({
|
|
309
|
+
options,
|
|
310
|
+
value,
|
|
311
|
+
defaultValue,
|
|
312
|
+
label = "Dropdown",
|
|
313
|
+
align = "bottom-start",
|
|
314
|
+
trigger,
|
|
315
|
+
onChange,
|
|
316
|
+
className = "",
|
|
317
|
+
...props
|
|
318
|
+
}) => {
|
|
319
|
+
const dropdownRef = useRef(null);
|
|
320
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
321
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
322
|
+
const selectedValue = value ?? internalValue;
|
|
323
|
+
const classes = classnames("dropdown", className, {
|
|
324
|
+
"dropdown--open": isOpen,
|
|
325
|
+
"dropdown--top-start": align === "top-start",
|
|
326
|
+
"dropdown--top-end": align === "top-end",
|
|
327
|
+
"dropdown--bottom-start": align === "bottom-start",
|
|
328
|
+
"dropdown--bottom-end": align === "bottom-end"
|
|
329
|
+
});
|
|
330
|
+
const triggerElement = trigger;
|
|
331
|
+
const triggerClasses = classnames(
|
|
332
|
+
"dropdown__trigger",
|
|
333
|
+
triggerElement.props.className
|
|
334
|
+
);
|
|
335
|
+
const resolvedTrigger = cloneElement(triggerElement, {
|
|
336
|
+
className: triggerClasses,
|
|
337
|
+
"aria-haspopup": "menu",
|
|
338
|
+
"aria-expanded": isOpen,
|
|
339
|
+
onClick: (event) => {
|
|
340
|
+
triggerElement.props.onClick?.(event);
|
|
341
|
+
setIsOpen((currentValue) => !currentValue);
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
const handleOptionClick = (option) => {
|
|
345
|
+
if (option.disabled) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
if (value === void 0) {
|
|
349
|
+
setInternalValue(option.value);
|
|
350
|
+
}
|
|
351
|
+
onChange?.(option.value);
|
|
352
|
+
setIsOpen(false);
|
|
353
|
+
};
|
|
354
|
+
useEffect(() => {
|
|
355
|
+
if (!isOpen) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
const handleDocumentClick = (event) => {
|
|
359
|
+
const dropdown = dropdownRef.current;
|
|
360
|
+
if (!dropdown || dropdown.contains(event.target)) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
setIsOpen(false);
|
|
364
|
+
};
|
|
365
|
+
const handleDocumentKeyDown = (event) => {
|
|
366
|
+
if (event.key === "Escape") {
|
|
367
|
+
setIsOpen(false);
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
document.addEventListener("mousedown", handleDocumentClick);
|
|
371
|
+
document.addEventListener("keydown", handleDocumentKeyDown);
|
|
372
|
+
return () => {
|
|
373
|
+
document.removeEventListener("mousedown", handleDocumentClick);
|
|
374
|
+
document.removeEventListener("keydown", handleDocumentKeyDown);
|
|
375
|
+
};
|
|
376
|
+
}, [isOpen]);
|
|
377
|
+
return /* @__PURE__ */ jsxs(
|
|
378
|
+
"div",
|
|
379
|
+
{
|
|
380
|
+
ref: dropdownRef,
|
|
381
|
+
className: classes,
|
|
382
|
+
...props,
|
|
383
|
+
children: [
|
|
384
|
+
resolvedTrigger,
|
|
385
|
+
isOpen && /* @__PURE__ */ jsx(
|
|
386
|
+
"div",
|
|
387
|
+
{
|
|
388
|
+
className: "dropdown__menu",
|
|
389
|
+
role: "menu",
|
|
390
|
+
"aria-label": label,
|
|
391
|
+
children: options.map((option) => {
|
|
392
|
+
const isSelected = option.value === selectedValue;
|
|
393
|
+
const itemClasses = classnames("dropdown__item", {
|
|
394
|
+
"dropdown__item--selected": isSelected,
|
|
395
|
+
"dropdown__item--disabled": option.disabled
|
|
396
|
+
});
|
|
397
|
+
return /* @__PURE__ */ jsx(
|
|
398
|
+
"button",
|
|
399
|
+
{
|
|
400
|
+
className: itemClasses,
|
|
401
|
+
type: "button",
|
|
402
|
+
role: "menuitemradio",
|
|
403
|
+
"aria-checked": isSelected,
|
|
404
|
+
"aria-disabled": option.disabled,
|
|
405
|
+
disabled: option.disabled,
|
|
406
|
+
onClick: () => handleOptionClick(option),
|
|
407
|
+
children: option.label
|
|
408
|
+
},
|
|
409
|
+
option.value
|
|
410
|
+
);
|
|
411
|
+
})
|
|
412
|
+
}
|
|
413
|
+
)
|
|
414
|
+
]
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
};
|
|
418
|
+
var dropdown_default = Dropdown;
|
|
419
|
+
var Checkbox = ({
|
|
420
|
+
label,
|
|
421
|
+
className = "",
|
|
422
|
+
disabled = false,
|
|
423
|
+
...props
|
|
424
|
+
}) => {
|
|
425
|
+
const classes = classnames(
|
|
426
|
+
"checkbox",
|
|
427
|
+
className,
|
|
428
|
+
{
|
|
429
|
+
"checkbox--disabled": disabled
|
|
430
|
+
}
|
|
431
|
+
);
|
|
432
|
+
return /* @__PURE__ */ jsxs("label", { className: classes, children: [
|
|
433
|
+
/* @__PURE__ */ jsx(
|
|
434
|
+
"input",
|
|
435
|
+
{
|
|
436
|
+
className: "checkbox__input",
|
|
437
|
+
type: "checkbox",
|
|
438
|
+
disabled,
|
|
439
|
+
...props
|
|
440
|
+
}
|
|
441
|
+
),
|
|
442
|
+
label && /* @__PURE__ */ jsx("span", { className: "checkbox__label", children: label })
|
|
443
|
+
] });
|
|
444
|
+
};
|
|
445
|
+
var checkbox_default = Checkbox;
|
|
446
|
+
var Radio = ({
|
|
447
|
+
label,
|
|
448
|
+
className = "",
|
|
449
|
+
disabled = false,
|
|
450
|
+
...props
|
|
451
|
+
}) => {
|
|
452
|
+
const classes = classnames(
|
|
453
|
+
"radio",
|
|
454
|
+
className,
|
|
455
|
+
{
|
|
456
|
+
"radio--disabled": disabled
|
|
457
|
+
}
|
|
458
|
+
);
|
|
459
|
+
return /* @__PURE__ */ jsxs("label", { className: classes, children: [
|
|
460
|
+
/* @__PURE__ */ jsx(
|
|
461
|
+
"input",
|
|
462
|
+
{
|
|
463
|
+
className: "radio__input",
|
|
464
|
+
type: "radio",
|
|
465
|
+
disabled,
|
|
466
|
+
...props
|
|
467
|
+
}
|
|
468
|
+
),
|
|
469
|
+
label && /* @__PURE__ */ jsx("span", { className: "radio__label", children: label })
|
|
470
|
+
] });
|
|
471
|
+
};
|
|
472
|
+
var radio_default = Radio;
|
|
473
|
+
var Field = ({
|
|
474
|
+
label,
|
|
475
|
+
hint,
|
|
476
|
+
error,
|
|
477
|
+
required = false,
|
|
478
|
+
disabled = false,
|
|
479
|
+
htmlFor,
|
|
480
|
+
className = "",
|
|
481
|
+
children
|
|
482
|
+
}) => {
|
|
483
|
+
const classes = classnames(
|
|
484
|
+
"field",
|
|
485
|
+
className,
|
|
486
|
+
{
|
|
487
|
+
"field--disabled": disabled,
|
|
488
|
+
"field--error": !!error
|
|
489
|
+
}
|
|
490
|
+
);
|
|
491
|
+
return /* @__PURE__ */ jsxs("div", { className: classes, children: [
|
|
492
|
+
label && /* @__PURE__ */ jsxs(
|
|
493
|
+
"label",
|
|
494
|
+
{
|
|
495
|
+
className: "field__label",
|
|
496
|
+
htmlFor,
|
|
497
|
+
children: [
|
|
498
|
+
label,
|
|
499
|
+
required && /* @__PURE__ */ jsx("span", { className: "field__required", children: " *" })
|
|
500
|
+
]
|
|
501
|
+
}
|
|
502
|
+
),
|
|
503
|
+
/* @__PURE__ */ jsx("div", { className: "field__control", children }),
|
|
504
|
+
error ? /* @__PURE__ */ jsx("div", { className: "field__message field__message--error", children: error }) : hint ? /* @__PURE__ */ jsx("div", { className: "field__message", children: hint }) : null
|
|
505
|
+
] });
|
|
506
|
+
};
|
|
507
|
+
var field_default = Field;
|
|
508
|
+
var Menu = ({
|
|
509
|
+
state = "default",
|
|
510
|
+
className = "",
|
|
511
|
+
children,
|
|
512
|
+
// disabled = false,
|
|
513
|
+
...props
|
|
514
|
+
}) => {
|
|
515
|
+
const classes = classnames("menu", className, {
|
|
516
|
+
error: state === "error",
|
|
517
|
+
success: state === "success"
|
|
518
|
+
});
|
|
519
|
+
return /* @__PURE__ */ jsx(
|
|
520
|
+
"div",
|
|
521
|
+
{
|
|
522
|
+
className: classes,
|
|
523
|
+
...props,
|
|
524
|
+
children
|
|
525
|
+
}
|
|
526
|
+
);
|
|
527
|
+
};
|
|
528
|
+
var menu_default = Menu;
|
|
529
|
+
var Tabs = ({
|
|
530
|
+
className = "",
|
|
531
|
+
children,
|
|
532
|
+
...props
|
|
533
|
+
}) => {
|
|
534
|
+
const classes = classnames("tabs", className);
|
|
535
|
+
return /* @__PURE__ */ jsx("div", { className: classes, ...props, children });
|
|
536
|
+
};
|
|
537
|
+
var tabs_default = Tabs;
|
|
538
|
+
function getClampedValue(value, max) {
|
|
539
|
+
return Math.min(
|
|
540
|
+
Math.max(value, 0),
|
|
541
|
+
max
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
function getPercent(value, max) {
|
|
545
|
+
if (max <= 0) {
|
|
546
|
+
return 0;
|
|
547
|
+
}
|
|
548
|
+
return getClampedValue(value, max) / max * 100;
|
|
549
|
+
}
|
|
550
|
+
function getValueFromPointer(event, track, max, isVertical) {
|
|
551
|
+
const rect = track.getBoundingClientRect();
|
|
552
|
+
if (isVertical) {
|
|
553
|
+
const y = rect.bottom - event.clientY;
|
|
554
|
+
const ratio2 = y / rect.height;
|
|
555
|
+
return getClampedValue(
|
|
556
|
+
ratio2 * max,
|
|
557
|
+
max
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
const x = event.clientX - rect.left;
|
|
561
|
+
const ratio = x / rect.width;
|
|
562
|
+
return getClampedValue(
|
|
563
|
+
ratio * max,
|
|
564
|
+
max
|
|
565
|
+
);
|
|
566
|
+
}
|
|
567
|
+
function getNextKeyboardValue(key, value, max, step) {
|
|
568
|
+
if (key === "ArrowRight" || key === "ArrowUp") {
|
|
569
|
+
return getClampedValue(
|
|
570
|
+
value + step,
|
|
571
|
+
max
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
if (key === "ArrowLeft" || key === "ArrowDown") {
|
|
575
|
+
return getClampedValue(
|
|
576
|
+
value - step,
|
|
577
|
+
max
|
|
578
|
+
);
|
|
579
|
+
}
|
|
580
|
+
if (key === "Home") {
|
|
581
|
+
return 0;
|
|
582
|
+
}
|
|
583
|
+
if (key === "End") {
|
|
584
|
+
return max;
|
|
585
|
+
}
|
|
586
|
+
return value;
|
|
587
|
+
}
|
|
588
|
+
var ProgressBar = ({
|
|
589
|
+
mode = "player",
|
|
590
|
+
value = 0,
|
|
591
|
+
buffered = 0,
|
|
592
|
+
max = 100,
|
|
593
|
+
orientation = "horizontal",
|
|
594
|
+
step = 1,
|
|
595
|
+
interactive,
|
|
596
|
+
label = "Progress",
|
|
597
|
+
className = "",
|
|
598
|
+
style,
|
|
599
|
+
onValueChange,
|
|
600
|
+
onValueCommit,
|
|
601
|
+
...props
|
|
602
|
+
}) => {
|
|
603
|
+
const trackRef = useRef(null);
|
|
604
|
+
const safeValue = getClampedValue(
|
|
605
|
+
value,
|
|
606
|
+
max
|
|
607
|
+
);
|
|
608
|
+
const valuePercent = getPercent(
|
|
609
|
+
value,
|
|
610
|
+
max
|
|
611
|
+
);
|
|
612
|
+
const bufferedPercent = getPercent(
|
|
613
|
+
buffered,
|
|
614
|
+
max
|
|
615
|
+
);
|
|
616
|
+
const isInteractive = interactive ?? mode !== "diagram";
|
|
617
|
+
const isVertical = orientation === "vertical" || mode === "level";
|
|
618
|
+
const hasBuffered = mode === "player" && buffered > value;
|
|
619
|
+
const hasValue = mode === "diagram";
|
|
620
|
+
const classes = classnames(
|
|
621
|
+
"progressbar",
|
|
622
|
+
className,
|
|
623
|
+
{
|
|
624
|
+
"progressbar--vertical": isVertical,
|
|
625
|
+
"progressbar--level": mode === "level",
|
|
626
|
+
"progressbar--interactive": isInteractive
|
|
627
|
+
}
|
|
628
|
+
);
|
|
629
|
+
const progressStyle = {
|
|
630
|
+
...style,
|
|
631
|
+
"--progressbar-value": `${valuePercent}%`,
|
|
632
|
+
"--progressbar-buffered": `${bufferedPercent}%`,
|
|
633
|
+
"--progressbar-buffered-offset": `${valuePercent}%`
|
|
634
|
+
};
|
|
635
|
+
const updateValueFromPointer = (event, shouldCommit = false) => {
|
|
636
|
+
const track = trackRef.current;
|
|
637
|
+
if (!isInteractive || !track) {
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
const nextValue = getValueFromPointer(
|
|
641
|
+
event,
|
|
642
|
+
track,
|
|
643
|
+
max,
|
|
644
|
+
isVertical
|
|
645
|
+
);
|
|
646
|
+
onValueChange?.(
|
|
647
|
+
nextValue
|
|
648
|
+
);
|
|
649
|
+
if (shouldCommit) {
|
|
650
|
+
onValueCommit?.(
|
|
651
|
+
nextValue
|
|
652
|
+
);
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
const handlePointerDown = (event) => {
|
|
656
|
+
if (!isInteractive) {
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
event.currentTarget.setPointerCapture(
|
|
660
|
+
event.pointerId
|
|
661
|
+
);
|
|
662
|
+
updateValueFromPointer(
|
|
663
|
+
event
|
|
664
|
+
);
|
|
665
|
+
};
|
|
666
|
+
const handlePointerMove = (event) => {
|
|
667
|
+
if (!isInteractive || !event.currentTarget.hasPointerCapture(
|
|
668
|
+
event.pointerId
|
|
669
|
+
)) {
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
updateValueFromPointer(
|
|
673
|
+
event
|
|
674
|
+
);
|
|
675
|
+
};
|
|
676
|
+
const handlePointerUp = (event) => {
|
|
677
|
+
if (!isInteractive) {
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
updateValueFromPointer(
|
|
681
|
+
event,
|
|
682
|
+
true
|
|
683
|
+
);
|
|
684
|
+
event.currentTarget.releasePointerCapture(
|
|
685
|
+
event.pointerId
|
|
686
|
+
);
|
|
687
|
+
};
|
|
688
|
+
const handleKeyDown = (event) => {
|
|
689
|
+
if (!isInteractive) {
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
const nextValue = getNextKeyboardValue(
|
|
693
|
+
event.key,
|
|
694
|
+
safeValue,
|
|
695
|
+
max,
|
|
696
|
+
step
|
|
697
|
+
);
|
|
698
|
+
if (nextValue === safeValue) {
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
event.preventDefault();
|
|
702
|
+
onValueChange?.(
|
|
703
|
+
nextValue
|
|
704
|
+
);
|
|
705
|
+
onValueCommit?.(
|
|
706
|
+
nextValue
|
|
707
|
+
);
|
|
708
|
+
};
|
|
709
|
+
return /* @__PURE__ */ jsx(
|
|
710
|
+
"div",
|
|
711
|
+
{
|
|
712
|
+
className: classes,
|
|
713
|
+
role: isInteractive ? "slider" : "progressbar",
|
|
714
|
+
"aria-label": label,
|
|
715
|
+
"aria-valuemin": 0,
|
|
716
|
+
"aria-valuemax": max,
|
|
717
|
+
"aria-valuenow": safeValue,
|
|
718
|
+
"aria-orientation": isInteractive && isVertical ? "vertical" : void 0,
|
|
719
|
+
tabIndex: isInteractive ? 0 : void 0,
|
|
720
|
+
style: progressStyle,
|
|
721
|
+
onPointerDown: handlePointerDown,
|
|
722
|
+
onPointerMove: handlePointerMove,
|
|
723
|
+
onPointerUp: handlePointerUp,
|
|
724
|
+
onKeyDown: handleKeyDown,
|
|
725
|
+
...props,
|
|
726
|
+
children: /* @__PURE__ */ jsxs(
|
|
727
|
+
"div",
|
|
728
|
+
{
|
|
729
|
+
ref: trackRef,
|
|
730
|
+
className: "progressbar__track",
|
|
731
|
+
children: [
|
|
732
|
+
/* @__PURE__ */ jsx("div", { className: "progressbar__value" }),
|
|
733
|
+
hasBuffered && /* @__PURE__ */ jsx("div", { className: "progressbar__buffered" }),
|
|
734
|
+
hasValue && /* @__PURE__ */ jsxs("span", { className: "progressbar__label", children: [
|
|
735
|
+
Math.round(
|
|
736
|
+
valuePercent
|
|
737
|
+
),
|
|
738
|
+
"%"
|
|
739
|
+
] })
|
|
740
|
+
]
|
|
741
|
+
}
|
|
742
|
+
)
|
|
743
|
+
}
|
|
744
|
+
);
|
|
745
|
+
};
|
|
746
|
+
var progressbar_default = ProgressBar;
|
|
747
|
+
function getClampedValue2(value, min, max) {
|
|
748
|
+
return Math.min(
|
|
749
|
+
Math.max(value, min),
|
|
750
|
+
max
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
function formatTime(value) {
|
|
754
|
+
if (!Number.isFinite(value)) {
|
|
755
|
+
return "0:00";
|
|
756
|
+
}
|
|
757
|
+
const minutes = Math.floor(value / 60);
|
|
758
|
+
const seconds = Math.floor(value % 60);
|
|
759
|
+
return `${minutes}:${String(seconds).padStart(2, "0")}`;
|
|
760
|
+
}
|
|
761
|
+
function getBufferedEnd(video) {
|
|
762
|
+
if (video.buffered.length === 0) {
|
|
763
|
+
return 0;
|
|
764
|
+
}
|
|
765
|
+
return video.buffered.end(video.buffered.length - 1);
|
|
766
|
+
}
|
|
767
|
+
function getVideoSource(src, qualities, selectedQuality) {
|
|
768
|
+
const selectedQualityItem = qualities.find(
|
|
769
|
+
(quality) => quality.value === selectedQuality
|
|
770
|
+
);
|
|
771
|
+
return selectedQualityItem?.src ?? src;
|
|
772
|
+
}
|
|
773
|
+
function getQualityOptions(qualities) {
|
|
774
|
+
return qualities.map((quality) => ({
|
|
775
|
+
value: quality.value,
|
|
776
|
+
label: quality.label,
|
|
777
|
+
disabled: quality.disabled
|
|
778
|
+
}));
|
|
779
|
+
}
|
|
780
|
+
var defaultQualities = [
|
|
781
|
+
{
|
|
782
|
+
value: "360p",
|
|
783
|
+
label: "360p"
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
value: "720p",
|
|
787
|
+
label: "720p"
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
value: "1080p",
|
|
791
|
+
label: "1080p"
|
|
792
|
+
}
|
|
793
|
+
];
|
|
794
|
+
var Video = ({
|
|
795
|
+
src,
|
|
796
|
+
cover,
|
|
797
|
+
qualities = defaultQualities,
|
|
798
|
+
defaultQuality = "1080p",
|
|
799
|
+
label = "Video player",
|
|
800
|
+
initialVolume = 1,
|
|
801
|
+
initialMuted = false,
|
|
802
|
+
className = "",
|
|
803
|
+
autoPlay,
|
|
804
|
+
loop,
|
|
805
|
+
muted,
|
|
806
|
+
playsInline = true,
|
|
807
|
+
preload = "metadata",
|
|
808
|
+
onQualityChange,
|
|
809
|
+
onPlay,
|
|
810
|
+
onPause,
|
|
811
|
+
onLoadedMetadata,
|
|
812
|
+
onTimeUpdate,
|
|
813
|
+
onProgress,
|
|
814
|
+
onVolumeChange,
|
|
815
|
+
children,
|
|
816
|
+
...props
|
|
817
|
+
}) => {
|
|
818
|
+
const videoRef = useRef(null);
|
|
819
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
820
|
+
const [isVolumeOpen, setIsVolumeOpen] = useState(false);
|
|
821
|
+
const [selectedQuality, setSelectedQuality] = useState(defaultQuality);
|
|
822
|
+
const [currentTime, setCurrentTime] = useState(0);
|
|
823
|
+
const [duration, setDuration] = useState(0);
|
|
824
|
+
const [buffered, setBuffered] = useState(0);
|
|
825
|
+
const [volume, setVolume] = useState(initialVolume);
|
|
826
|
+
const [isMuted, setIsMuted] = useState(muted ?? initialMuted);
|
|
827
|
+
const videoSrc = getVideoSource(
|
|
828
|
+
src,
|
|
829
|
+
qualities,
|
|
830
|
+
selectedQuality
|
|
831
|
+
);
|
|
832
|
+
React4.useEffect(() => {
|
|
833
|
+
const video = videoRef.current;
|
|
834
|
+
if (!video || !videoSrc) {
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
if (video.canPlayType("application/vnd.apple.mpegurl")) {
|
|
838
|
+
video.src = videoSrc;
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
if (!Hls.isSupported()) {
|
|
842
|
+
video.src = videoSrc;
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
const hls = new Hls();
|
|
846
|
+
hls.on(Hls.Events.ERROR, (_, data) => {
|
|
847
|
+
console.error("HLS error", data);
|
|
848
|
+
});
|
|
849
|
+
hls.loadSource(videoSrc);
|
|
850
|
+
hls.attachMedia(video);
|
|
851
|
+
return () => {
|
|
852
|
+
hls.destroy();
|
|
853
|
+
};
|
|
854
|
+
}, [videoSrc]);
|
|
855
|
+
const qualityOptions = getQualityOptions(
|
|
856
|
+
qualities
|
|
857
|
+
);
|
|
858
|
+
const hasStarted = currentTime > 0 || isPlaying;
|
|
859
|
+
const hasControls = hasStarted;
|
|
860
|
+
const hasVolume = isVolumeOpen;
|
|
861
|
+
const classes = classnames("video", className, {
|
|
862
|
+
"video--with-controls": hasControls,
|
|
863
|
+
"video--with-volume": hasVolume
|
|
864
|
+
});
|
|
865
|
+
const syncMediaState = () => {
|
|
866
|
+
const video = videoRef.current;
|
|
867
|
+
if (!video) {
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
setCurrentTime(video.currentTime);
|
|
871
|
+
setDuration(video.duration || 0);
|
|
872
|
+
setBuffered(getBufferedEnd(video));
|
|
873
|
+
setVolume(video.volume);
|
|
874
|
+
setIsMuted(video.muted);
|
|
875
|
+
setIsPlaying(!video.paused);
|
|
876
|
+
};
|
|
877
|
+
const handlePlayToggle = () => {
|
|
878
|
+
const video = videoRef.current;
|
|
879
|
+
if (!video) {
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
if (video.paused) {
|
|
883
|
+
video.play().catch(() => void 0);
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
video.pause();
|
|
887
|
+
};
|
|
888
|
+
const handleSeek = (nextValue) => {
|
|
889
|
+
const video = videoRef.current;
|
|
890
|
+
if (!video) {
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
video.currentTime = getClampedValue2(
|
|
894
|
+
nextValue,
|
|
895
|
+
0,
|
|
896
|
+
duration
|
|
897
|
+
);
|
|
898
|
+
setCurrentTime(video.currentTime);
|
|
899
|
+
};
|
|
900
|
+
const handleVolumeChange = (nextValue) => {
|
|
901
|
+
const video = videoRef.current;
|
|
902
|
+
if (!video) {
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
const nextVolume = getClampedValue2(
|
|
906
|
+
nextValue,
|
|
907
|
+
0,
|
|
908
|
+
1
|
|
909
|
+
);
|
|
910
|
+
video.volume = nextVolume;
|
|
911
|
+
video.muted = nextVolume === 0;
|
|
912
|
+
setVolume(nextVolume);
|
|
913
|
+
setIsMuted(video.muted);
|
|
914
|
+
};
|
|
915
|
+
const handleSoundToggle = () => {
|
|
916
|
+
const video = videoRef.current;
|
|
917
|
+
if (!video) {
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
video.muted = !video.muted;
|
|
921
|
+
setIsMuted(video.muted);
|
|
922
|
+
};
|
|
923
|
+
const handleFullscreen = () => {
|
|
924
|
+
const video = videoRef.current;
|
|
925
|
+
if (!video) {
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
video.requestFullscreen?.();
|
|
929
|
+
};
|
|
930
|
+
const handleQualityChange = (quality) => {
|
|
931
|
+
setSelectedQuality(quality);
|
|
932
|
+
onQualityChange?.(quality);
|
|
933
|
+
};
|
|
934
|
+
const handleLoadedMetadata = (event) => {
|
|
935
|
+
syncMediaState();
|
|
936
|
+
onLoadedMetadata?.(event);
|
|
937
|
+
};
|
|
938
|
+
const handleTimeUpdate = (event) => {
|
|
939
|
+
syncMediaState();
|
|
940
|
+
onTimeUpdate?.(event);
|
|
941
|
+
};
|
|
942
|
+
const handleProgress = (event) => {
|
|
943
|
+
syncMediaState();
|
|
944
|
+
onProgress?.(event);
|
|
945
|
+
};
|
|
946
|
+
const handlePlay = (event) => {
|
|
947
|
+
setIsPlaying(true);
|
|
948
|
+
onPlay?.(event);
|
|
949
|
+
};
|
|
950
|
+
const handlePause = (event) => {
|
|
951
|
+
setIsPlaying(false);
|
|
952
|
+
onPause?.(event);
|
|
953
|
+
};
|
|
954
|
+
const handleNativeVolumeChange = (event) => {
|
|
955
|
+
syncMediaState();
|
|
956
|
+
onVolumeChange?.(event);
|
|
957
|
+
};
|
|
958
|
+
return /* @__PURE__ */ jsxs(
|
|
959
|
+
"div",
|
|
960
|
+
{
|
|
961
|
+
className: classes,
|
|
962
|
+
"aria-label": label,
|
|
963
|
+
children: [
|
|
964
|
+
/* @__PURE__ */ jsxs("div", { className: "video__surface", children: [
|
|
965
|
+
/* @__PURE__ */ jsx(
|
|
966
|
+
"video",
|
|
967
|
+
{
|
|
968
|
+
...props,
|
|
969
|
+
ref: videoRef,
|
|
970
|
+
className: "video__media",
|
|
971
|
+
poster: cover,
|
|
972
|
+
autoPlay,
|
|
973
|
+
loop,
|
|
974
|
+
muted: isMuted,
|
|
975
|
+
playsInline,
|
|
976
|
+
preload,
|
|
977
|
+
controls: false,
|
|
978
|
+
onLoadedMetadata: handleLoadedMetadata,
|
|
979
|
+
onTimeUpdate: handleTimeUpdate,
|
|
980
|
+
onProgress: handleProgress,
|
|
981
|
+
onPlay: handlePlay,
|
|
982
|
+
onPause: handlePause,
|
|
983
|
+
onVolumeChange: handleNativeVolumeChange,
|
|
984
|
+
children
|
|
985
|
+
}
|
|
986
|
+
),
|
|
987
|
+
!hasStarted && /* @__PURE__ */ jsx(
|
|
988
|
+
button_icon_default,
|
|
989
|
+
{
|
|
990
|
+
className: "video__main-action",
|
|
991
|
+
icon: "play",
|
|
992
|
+
label: "Play video",
|
|
993
|
+
onClick: handlePlayToggle
|
|
994
|
+
}
|
|
995
|
+
)
|
|
996
|
+
] }),
|
|
997
|
+
hasControls && /* @__PURE__ */ jsxs("div", { className: "video__controls", children: [
|
|
998
|
+
/* @__PURE__ */ jsx(
|
|
999
|
+
button_icon_default,
|
|
1000
|
+
{
|
|
1001
|
+
icon: isPlaying ? "pause" : "play",
|
|
1002
|
+
label: isPlaying ? "Pause video" : "Play video",
|
|
1003
|
+
onClick: handlePlayToggle
|
|
1004
|
+
}
|
|
1005
|
+
),
|
|
1006
|
+
/* @__PURE__ */ jsx("div", { className: "video__time", children: formatTime(currentTime) }),
|
|
1007
|
+
/* @__PURE__ */ jsx(
|
|
1008
|
+
progressbar_default,
|
|
1009
|
+
{
|
|
1010
|
+
className: "video__progress",
|
|
1011
|
+
mode: "player",
|
|
1012
|
+
value: currentTime,
|
|
1013
|
+
buffered,
|
|
1014
|
+
max: duration || 1,
|
|
1015
|
+
step: 1,
|
|
1016
|
+
label: "Video progress",
|
|
1017
|
+
onValueChange: handleSeek
|
|
1018
|
+
}
|
|
1019
|
+
),
|
|
1020
|
+
/* @__PURE__ */ jsx(
|
|
1021
|
+
button_icon_default,
|
|
1022
|
+
{
|
|
1023
|
+
icon: "fullscreen",
|
|
1024
|
+
label: "Fullscreen",
|
|
1025
|
+
onClick: handleFullscreen
|
|
1026
|
+
}
|
|
1027
|
+
),
|
|
1028
|
+
/* @__PURE__ */ jsxs(
|
|
1029
|
+
"div",
|
|
1030
|
+
{
|
|
1031
|
+
className: "video__sound-control",
|
|
1032
|
+
onMouseLeave: () => setIsVolumeOpen(false),
|
|
1033
|
+
children: [
|
|
1034
|
+
/* @__PURE__ */ jsx(
|
|
1035
|
+
button_icon_default,
|
|
1036
|
+
{
|
|
1037
|
+
icon: isMuted ? "sound-off" : "sound",
|
|
1038
|
+
label: isMuted ? "Unmute video" : "Mute video",
|
|
1039
|
+
onClick: handleSoundToggle,
|
|
1040
|
+
onMouseEnter: () => setIsVolumeOpen(true),
|
|
1041
|
+
onFocus: () => setIsVolumeOpen(true)
|
|
1042
|
+
}
|
|
1043
|
+
),
|
|
1044
|
+
hasVolume && /* @__PURE__ */ jsx("div", { className: "video__volume", children: /* @__PURE__ */ jsx(
|
|
1045
|
+
progressbar_default,
|
|
1046
|
+
{
|
|
1047
|
+
mode: "level",
|
|
1048
|
+
value: isMuted ? 0 : volume,
|
|
1049
|
+
max: 1,
|
|
1050
|
+
step: 0.05,
|
|
1051
|
+
label: "Volume",
|
|
1052
|
+
onValueChange: handleVolumeChange
|
|
1053
|
+
}
|
|
1054
|
+
) })
|
|
1055
|
+
]
|
|
1056
|
+
}
|
|
1057
|
+
),
|
|
1058
|
+
/* @__PURE__ */ jsx(
|
|
1059
|
+
dropdown_default,
|
|
1060
|
+
{
|
|
1061
|
+
align: "top-end",
|
|
1062
|
+
value: selectedQuality,
|
|
1063
|
+
options: qualityOptions,
|
|
1064
|
+
label: "Video quality",
|
|
1065
|
+
onChange: handleQualityChange,
|
|
1066
|
+
trigger: /* @__PURE__ */ jsx(
|
|
1067
|
+
button_icon_default,
|
|
1068
|
+
{
|
|
1069
|
+
icon: "settings",
|
|
1070
|
+
label: "Video quality"
|
|
1071
|
+
}
|
|
1072
|
+
)
|
|
1073
|
+
}
|
|
1074
|
+
)
|
|
1075
|
+
] })
|
|
1076
|
+
]
|
|
1077
|
+
}
|
|
1078
|
+
);
|
|
1079
|
+
};
|
|
1080
|
+
var video_default = Video;
|
|
1081
|
+
var Search = ({
|
|
1082
|
+
state = "default",
|
|
1083
|
+
className = "",
|
|
1084
|
+
children,
|
|
1085
|
+
// disabled = false,
|
|
1086
|
+
...props
|
|
1087
|
+
}) => {
|
|
1088
|
+
const classes = classnames("search", className, {
|
|
1089
|
+
error: state === "error",
|
|
1090
|
+
success: state === "success"
|
|
1091
|
+
});
|
|
1092
|
+
return /* @__PURE__ */ jsx(
|
|
1093
|
+
"div",
|
|
1094
|
+
{
|
|
1095
|
+
className: classes,
|
|
1096
|
+
...props,
|
|
1097
|
+
children
|
|
1098
|
+
}
|
|
1099
|
+
);
|
|
1100
|
+
};
|
|
1101
|
+
var search_default = Search;
|
|
1102
|
+
var RichEdit = ({
|
|
1103
|
+
state = "default",
|
|
1104
|
+
className = "",
|
|
1105
|
+
// disabled = false,
|
|
1106
|
+
...props
|
|
1107
|
+
}) => {
|
|
1108
|
+
const classes = classnames("richedit", className, {
|
|
1109
|
+
error: state === "error",
|
|
1110
|
+
success: state === "success"
|
|
1111
|
+
});
|
|
1112
|
+
return /* @__PURE__ */ jsx(
|
|
1113
|
+
"div",
|
|
1114
|
+
{
|
|
1115
|
+
className: classes,
|
|
1116
|
+
...props
|
|
1117
|
+
}
|
|
1118
|
+
);
|
|
1119
|
+
};
|
|
1120
|
+
var richedit_default = RichEdit;
|
|
1121
|
+
var Tag = ({
|
|
1122
|
+
context = "success",
|
|
1123
|
+
className = "",
|
|
1124
|
+
children,
|
|
1125
|
+
...props
|
|
1126
|
+
}) => {
|
|
1127
|
+
const classes = classnames("tag", className, {
|
|
1128
|
+
[`tag--context-${context}`]: Boolean(context)
|
|
1129
|
+
});
|
|
1130
|
+
return /* @__PURE__ */ jsx(
|
|
1131
|
+
"div",
|
|
1132
|
+
{
|
|
1133
|
+
className: classes,
|
|
1134
|
+
...props,
|
|
1135
|
+
children
|
|
1136
|
+
}
|
|
1137
|
+
);
|
|
1138
|
+
};
|
|
1139
|
+
var tag_default = Tag;
|
|
1140
|
+
var Card = ({
|
|
1141
|
+
state = "default",
|
|
1142
|
+
heading,
|
|
1143
|
+
description,
|
|
1144
|
+
actions,
|
|
1145
|
+
className = "",
|
|
1146
|
+
children,
|
|
1147
|
+
...props
|
|
1148
|
+
}) => {
|
|
1149
|
+
const classes = classnames("card", className, {});
|
|
1150
|
+
return /* @__PURE__ */ jsxs(
|
|
1151
|
+
"section",
|
|
1152
|
+
{
|
|
1153
|
+
className: classes,
|
|
1154
|
+
...props,
|
|
1155
|
+
children: [
|
|
1156
|
+
(heading || description) && /* @__PURE__ */ jsxs("div", { className: "card__header", children: [
|
|
1157
|
+
heading && /* @__PURE__ */ jsx("h2", { className: "card__heading", children: heading }),
|
|
1158
|
+
description && /* @__PURE__ */ jsx("p", { className: "card__description", children: description })
|
|
1159
|
+
] }),
|
|
1160
|
+
children && /* @__PURE__ */ jsx("div", { className: "card__content", children }),
|
|
1161
|
+
actions && /* @__PURE__ */ jsx("div", { className: "card__actions", children: actions })
|
|
1162
|
+
]
|
|
1163
|
+
}
|
|
1164
|
+
);
|
|
1165
|
+
};
|
|
1166
|
+
var card_default = Card;
|
|
1167
|
+
|
|
1168
|
+
export { button_default as Button, button_icon_default as ButtonIcon, card_default as Card, checkbox_default as Checkbox, dropdown_default as Dropdown, field_default as Field, input_default as Input, menu_default as Menu, progressbar_default as ProgressBar, radio_default as Radio, richedit_default as RichEdit, search_default as Search, select_default as Select, tabs_default as Tabs, tag_default as Tag, textarea_default as Textarea, video_default as Video };
|
|
1169
|
+
//# sourceMappingURL=index.js.map
|
|
1170
|
+
//# sourceMappingURL=index.js.map
|