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