@operato/input 9.0.34 → 9.2.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/CHANGELOG.md +23 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-input-audio.d.ts +15 -0
- package/dist/src/ox-input-audio.js +171 -0
- package/dist/src/ox-input-audio.js.map +1 -0
- package/dist/src/ox-input-video.d.ts +15 -0
- package/dist/src/ox-input-video.js +178 -0
- package/dist/src/ox-input-video.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [9.2.0](https://github.com/hatiolab/operato/compare/v9.1.1...v9.2.0) (2025-11-09)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :memo: Documentation
|
|
10
|
+
|
|
11
|
+
* add storybook stories for video and audio input components ([4e8a0e5](https://github.com/hatiolab/operato/commit/4e8a0e56df067d023ef90d3a05a1e97f39260df5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### :rocket: New Features
|
|
15
|
+
|
|
16
|
+
* add ox-input-image stories ([6d2927b](https://github.com/hatiolab/operato/commit/6d2927b46b5bd466f3cde8bd557d2ba98e483a9d))
|
|
17
|
+
* add video and audio input components for media upload ([433053e](https://github.com/hatiolab/operato/commit/433053ecc3d595c578c82ec56b5c5f252af42795))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## [9.1.0](https://github.com/hatiolab/operato/compare/v9.0.35...v9.1.0) (2025-09-16)
|
|
22
|
+
|
|
23
|
+
**Note:** Version bump only for package @operato/input
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
### [9.0.34](https://github.com/hatiolab/operato/compare/v9.0.33...v9.0.34) (2025-09-15)
|
|
7
30
|
|
|
8
31
|
**Note:** Version bump only for package @operato/input
|
package/dist/src/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export * from './ox-input-color.js';
|
|
|
16
16
|
export * from './ox-input-multiple-colors.js';
|
|
17
17
|
export * from './ox-input-file.js';
|
|
18
18
|
export * from './ox-input-image.js';
|
|
19
|
+
export * from './ox-input-video.js';
|
|
20
|
+
export * from './ox-input-audio.js';
|
|
19
21
|
export * from './ox-input-value-ranges.js';
|
|
20
22
|
export * from './ox-input-value-map.js';
|
|
21
23
|
export * from './ox-input-scene-component-id.js';
|
package/dist/src/index.js
CHANGED
|
@@ -16,6 +16,8 @@ export * from './ox-input-color.js';
|
|
|
16
16
|
export * from './ox-input-multiple-colors.js';
|
|
17
17
|
export * from './ox-input-file.js';
|
|
18
18
|
export * from './ox-input-image.js';
|
|
19
|
+
export * from './ox-input-video.js';
|
|
20
|
+
export * from './ox-input-audio.js';
|
|
19
21
|
export * from './ox-input-value-ranges.js';
|
|
20
22
|
export * from './ox-input-value-map.js';
|
|
21
23
|
export * from './ox-input-scene-component-id.js';
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,kCAAkC,CAAA;AAChD,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mCAAmC,CAAA;AACjD,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nexport * from './ox-form-field.js'\nexport * from './ox-buttons-radio.js'\nexport * from './ox-checkbox.js'\nexport * from './ox-select.js'\nexport * from './ox-input-switch.js'\nexport * from './ox-input-angle.js'\nexport * from './ox-input-3dish.js'\nexport * from './ox-input-3axis.js'\nexport * from './ox-input-stack.js'\nexport * from './ox-input-barcode.js'\nexport * from './ox-input-code.js'\nexport * from './ox-input-color.js'\nexport * from './ox-input-multiple-colors.js'\nexport * from './ox-input-file.js'\nexport * from './ox-input-image.js'\nexport * from './ox-input-value-ranges.js'\nexport * from './ox-input-value-map.js'\nexport * from './ox-input-scene-component-id.js'\nexport * from './ox-input-crontab.js'\nexport * from './ox-input-partition-keys.js'\nexport * from './ox-input-duration.js'\nexport * from './ox-input-quantifier.js'\nexport * from './ox-input-select-buttons.js'\nexport * from './ox-input-textarea.js'\nexport * from './ox-input-direction.js'\nexport * from './ox-input-table-column-config.js'\nexport * from './ox-input-search.js'\nexport * from './ox-input-secret.js'\nexport * from './ox-input-signature.js'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,kCAAkC,CAAA;AAChD,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mCAAmC,CAAA;AACjD,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nexport * from './ox-form-field.js'\nexport * from './ox-buttons-radio.js'\nexport * from './ox-checkbox.js'\nexport * from './ox-select.js'\nexport * from './ox-input-switch.js'\nexport * from './ox-input-angle.js'\nexport * from './ox-input-3dish.js'\nexport * from './ox-input-3axis.js'\nexport * from './ox-input-stack.js'\nexport * from './ox-input-barcode.js'\nexport * from './ox-input-code.js'\nexport * from './ox-input-color.js'\nexport * from './ox-input-multiple-colors.js'\nexport * from './ox-input-file.js'\nexport * from './ox-input-image.js'\nexport * from './ox-input-video.js'\nexport * from './ox-input-audio.js'\nexport * from './ox-input-value-ranges.js'\nexport * from './ox-input-value-map.js'\nexport * from './ox-input-scene-component-id.js'\nexport * from './ox-input-crontab.js'\nexport * from './ox-input-partition-keys.js'\nexport * from './ox-input-duration.js'\nexport * from './ox-input-quantifier.js'\nexport * from './ox-input-select-buttons.js'\nexport * from './ox-input-textarea.js'\nexport * from './ox-input-direction.js'\nexport * from './ox-input-table-column-config.js'\nexport * from './ox-input-search.js'\nexport * from './ox-input-secret.js'\nexport * from './ox-input-signature.js'\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import '@material/web/icon/icon.js';
|
|
5
|
+
import { OxFormField } from './ox-form-field.js';
|
|
6
|
+
export declare class OxInputAudio extends OxFormField {
|
|
7
|
+
static styles: import("lit").CSSResult[];
|
|
8
|
+
fileInput: HTMLInputElement;
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
firstUpdated(): void;
|
|
11
|
+
get file(): any;
|
|
12
|
+
reset(): void;
|
|
13
|
+
_onChangeValue(e: Event): void;
|
|
14
|
+
_notifyChange(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { __decorate } from "tslib";
|
|
5
|
+
import '@material/web/icon/icon.js';
|
|
6
|
+
import { css, html } from 'lit';
|
|
7
|
+
import { customElement, query } from 'lit/decorators.js';
|
|
8
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
9
|
+
import { FileDropHelper } from '@operato/utils';
|
|
10
|
+
import { OxFormField } from './ox-form-field.js';
|
|
11
|
+
let OxInputAudio = class OxInputAudio extends OxFormField {
|
|
12
|
+
static { this.styles = [
|
|
13
|
+
ScrollbarStyles,
|
|
14
|
+
css `
|
|
15
|
+
:host {
|
|
16
|
+
position: relative;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
place-content: center;
|
|
22
|
+
border-radius: var(--border-radius);
|
|
23
|
+
padding: var(--padding-default, 9px);
|
|
24
|
+
min-height: 100px;
|
|
25
|
+
text-transform: capitalize;
|
|
26
|
+
|
|
27
|
+
border: var(--file-uploader-border);
|
|
28
|
+
background-color: var(--md-sys-color-background);
|
|
29
|
+
font: var(--file-uploader-font) !important;
|
|
30
|
+
color: var(--file-uploader-color);
|
|
31
|
+
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host(.candrop) {
|
|
36
|
+
background-color: var(--file-uploader-candrop-background-color);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
audio {
|
|
40
|
+
width: 100%;
|
|
41
|
+
margin: auto;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.placeholder {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
gap: 8px;
|
|
50
|
+
width: 100%;
|
|
51
|
+
height: 100%;
|
|
52
|
+
min-height: 100px;
|
|
53
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.placeholder md-icon {
|
|
57
|
+
--md-icon-size: 48px;
|
|
58
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
[overlay] {
|
|
62
|
+
position: absolute;
|
|
63
|
+
left: 0;
|
|
64
|
+
top: 0;
|
|
65
|
+
width: 100%;
|
|
66
|
+
height: 100%;
|
|
67
|
+
opacity: 0%;
|
|
68
|
+
background-color: var(--md-sys-color-surface);
|
|
69
|
+
|
|
70
|
+
display: flex;
|
|
71
|
+
place-content: center;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[overlay]:hover {
|
|
75
|
+
opacity: 50%;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#input-file {
|
|
79
|
+
display: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
label {
|
|
83
|
+
border: none;
|
|
84
|
+
flex: 1;
|
|
85
|
+
display: flex;
|
|
86
|
+
place-content: center;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
md-icon {
|
|
90
|
+
align-self: center;
|
|
91
|
+
|
|
92
|
+
color: var(--file-uploader-icon-color, black);
|
|
93
|
+
--md-icon-size: var(--file-uploader-icon-size, 36px);
|
|
94
|
+
}
|
|
95
|
+
`
|
|
96
|
+
]; }
|
|
97
|
+
render() {
|
|
98
|
+
var value = this.value;
|
|
99
|
+
var src;
|
|
100
|
+
if (value) {
|
|
101
|
+
if (typeof value === 'string') {
|
|
102
|
+
src = value;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
src = URL.createObjectURL(value);
|
|
106
|
+
requestAnimationFrame(() => URL.revokeObjectURL(src));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return html `
|
|
110
|
+
${src
|
|
111
|
+
? html ` <audio src=${src} controls style="width: 100%;"> Your browser does not support the audio element. </audio> `
|
|
112
|
+
: html `
|
|
113
|
+
<div class="placeholder">
|
|
114
|
+
<md-icon>audiotrack</md-icon>
|
|
115
|
+
<span>No audio selected</span>
|
|
116
|
+
</div>
|
|
117
|
+
`}
|
|
118
|
+
|
|
119
|
+
<div overlay>
|
|
120
|
+
<label>
|
|
121
|
+
<input
|
|
122
|
+
id="input-file"
|
|
123
|
+
type="file"
|
|
124
|
+
accept="audio/*"
|
|
125
|
+
hidden
|
|
126
|
+
@change=${(e) => this._onChangeValue(e)}
|
|
127
|
+
?disabled=${this.disabled}
|
|
128
|
+
/>
|
|
129
|
+
<md-icon>upload</md-icon>
|
|
130
|
+
</label>
|
|
131
|
+
</div>
|
|
132
|
+
`;
|
|
133
|
+
}
|
|
134
|
+
firstUpdated() {
|
|
135
|
+
FileDropHelper.set(this);
|
|
136
|
+
this.addEventListener('file-drop', (e) => {
|
|
137
|
+
const detail = e.detail;
|
|
138
|
+
this.value = detail[0];
|
|
139
|
+
this._notifyChange();
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
get file() {
|
|
143
|
+
return this.value;
|
|
144
|
+
}
|
|
145
|
+
reset() {
|
|
146
|
+
this.fileInput.value = '';
|
|
147
|
+
this.value = undefined;
|
|
148
|
+
this._notifyChange();
|
|
149
|
+
}
|
|
150
|
+
_onChangeValue(e) {
|
|
151
|
+
const fileInput = e.currentTarget;
|
|
152
|
+
this.value = [...Array.from(fileInput.files)][0];
|
|
153
|
+
fileInput.files = null;
|
|
154
|
+
this._notifyChange();
|
|
155
|
+
}
|
|
156
|
+
_notifyChange() {
|
|
157
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
158
|
+
bubbles: true,
|
|
159
|
+
composed: true,
|
|
160
|
+
detail: this.value
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
__decorate([
|
|
165
|
+
query('#input-file')
|
|
166
|
+
], OxInputAudio.prototype, "fileInput", void 0);
|
|
167
|
+
OxInputAudio = __decorate([
|
|
168
|
+
customElement('ox-input-audio')
|
|
169
|
+
], OxInputAudio);
|
|
170
|
+
export { OxInputAudio };
|
|
171
|
+
//# sourceMappingURL=ox-input-audio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-input-audio.js","sourceRoot":"","sources":["../../src/ox-input-audio.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAo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,KAAK,CAAA;IACnB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,EAAE,CAAA;QACzB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAA;QAEtB,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;IAED,cAAc,CAAC,CAAQ;QACrB,MAAM,SAAS,GAAG,CAAC,CAAC,aAAiC,CAAA;QAErD,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAE5D,SAAS,CAAC,KAAK,GAAG,IAAI,CAAA;QAEtB,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;IAED,aAAa;QACX,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;;AAjFqB;IAArB,KAAK,CAAC,aAAa,CAAC;+CAA6B;AAvFvC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAyKxB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\n\nimport { css, html } from 'lit'\nimport { customElement, query } from 'lit/decorators.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\nimport { FileDropHelper } from '@operato/utils'\n\nimport { OxFormField } from './ox-form-field.js'\n\n@customElement('ox-input-audio')\nexport class OxInputAudio extends OxFormField {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n position: relative;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n place-content: center;\n border-radius: var(--border-radius);\n padding: var(--padding-default, 9px);\n min-height: 100px;\n text-transform: capitalize;\n\n border: var(--file-uploader-border);\n background-color: var(--md-sys-color-background);\n font: var(--file-uploader-font) !important;\n color: var(--file-uploader-color);\n\n overflow: hidden;\n }\n\n :host(.candrop) {\n background-color: var(--file-uploader-candrop-background-color);\n }\n\n audio {\n width: 100%;\n margin: auto;\n }\n\n .placeholder {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 8px;\n width: 100%;\n height: 100%;\n min-height: 100px;\n color: var(--md-sys-color-on-surface-variant);\n }\n\n .placeholder md-icon {\n --md-icon-size: 48px;\n color: var(--md-sys-color-on-surface-variant);\n }\n\n [overlay] {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0%;\n background-color: var(--md-sys-color-surface);\n\n display: flex;\n place-content: center;\n }\n\n [overlay]:hover {\n opacity: 50%;\n }\n\n #input-file {\n display: none;\n }\n\n label {\n border: none;\n flex: 1;\n display: flex;\n place-content: center;\n }\n\n md-icon {\n align-self: center;\n\n color: var(--file-uploader-icon-color, black);\n --md-icon-size: var(--file-uploader-icon-size, 36px);\n }\n `\n ]\n\n @query('#input-file') fileInput!: HTMLInputElement\n\n render() {\n var value = this.value\n var src: string | undefined\n\n if (value) {\n if (typeof value === 'string') {\n src = value\n } else {\n src = URL.createObjectURL(value)\n requestAnimationFrame(() => URL.revokeObjectURL(src!))\n }\n }\n\n return html`\n ${src\n ? html` <audio src=${src} controls style=\"width: 100%;\"> Your browser does not support the audio element. </audio> `\n : html`\n <div class=\"placeholder\">\n <md-icon>audiotrack</md-icon>\n <span>No audio selected</span>\n </div>\n `}\n\n <div overlay>\n <label>\n <input\n id=\"input-file\"\n type=\"file\"\n accept=\"audio/*\"\n hidden\n @change=${(e: Event) => this._onChangeValue(e)}\n ?disabled=${this.disabled}\n />\n <md-icon>upload</md-icon>\n </label>\n </div>\n `\n }\n\n firstUpdated() {\n FileDropHelper.set(this)\n\n this.addEventListener('file-drop', (e: Event) => {\n const detail = (e as CustomEvent).detail\n this.value = detail[0]\n\n this._notifyChange()\n })\n }\n\n get file() {\n return this.value\n }\n\n reset() {\n this.fileInput.value = ''\n this.value = undefined\n\n this._notifyChange()\n }\n\n _onChangeValue(e: Event) {\n const fileInput = e.currentTarget as HTMLInputElement\n\n this.value = [...Array.from(fileInput.files as FileList)][0]\n\n fileInput.files = null\n\n this._notifyChange()\n }\n\n _notifyChange() {\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import '@material/web/icon/icon.js';
|
|
5
|
+
import { OxFormField } from './ox-form-field.js';
|
|
6
|
+
export declare class OxInputVideo extends OxFormField {
|
|
7
|
+
static styles: import("lit").CSSResult[];
|
|
8
|
+
fileInput: HTMLInputElement;
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
firstUpdated(): void;
|
|
11
|
+
get file(): any;
|
|
12
|
+
reset(): void;
|
|
13
|
+
_onChangeValue(e: Event): void;
|
|
14
|
+
_notifyChange(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { __decorate } from "tslib";
|
|
5
|
+
import '@material/web/icon/icon.js';
|
|
6
|
+
import { css, html } from 'lit';
|
|
7
|
+
import { customElement, query } from 'lit/decorators.js';
|
|
8
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
9
|
+
import { FileDropHelper } from '@operato/utils';
|
|
10
|
+
import { OxFormField } from './ox-form-field.js';
|
|
11
|
+
const VIDEO_FALLBACK = new URL('../../assets/images/no-video.png', import.meta.url).href;
|
|
12
|
+
let OxInputVideo = class OxInputVideo extends OxFormField {
|
|
13
|
+
static { this.styles = [
|
|
14
|
+
ScrollbarStyles,
|
|
15
|
+
css `
|
|
16
|
+
:host {
|
|
17
|
+
position: relative;
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
place-content: center;
|
|
23
|
+
border-radius: var(--border-radius);
|
|
24
|
+
padding: var(--padding-default, 9px);
|
|
25
|
+
min-height: 150px;
|
|
26
|
+
text-transform: capitalize;
|
|
27
|
+
|
|
28
|
+
border: var(--file-uploader-border);
|
|
29
|
+
background-color: var(--md-sys-color-background);
|
|
30
|
+
font: var(--file-uploader-font) !important;
|
|
31
|
+
color: var(--file-uploader-color);
|
|
32
|
+
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
:host(.candrop) {
|
|
37
|
+
background-color: var(--file-uploader-candrop-background-color);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
video {
|
|
41
|
+
min-height: 100%;
|
|
42
|
+
max-width: 100%;
|
|
43
|
+
margin: auto;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.placeholder {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
gap: 8px;
|
|
52
|
+
width: 100%;
|
|
53
|
+
height: 100%;
|
|
54
|
+
min-height: 150px;
|
|
55
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.placeholder md-icon {
|
|
59
|
+
--md-icon-size: 48px;
|
|
60
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[overlay] {
|
|
64
|
+
position: absolute;
|
|
65
|
+
left: 0;
|
|
66
|
+
top: 0;
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
opacity: 0%;
|
|
70
|
+
background-color: var(--md-sys-color-surface);
|
|
71
|
+
|
|
72
|
+
display: flex;
|
|
73
|
+
place-content: center;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[overlay]:hover {
|
|
77
|
+
opacity: 50%;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
#input-file {
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
label {
|
|
85
|
+
border: none;
|
|
86
|
+
flex: 1;
|
|
87
|
+
display: flex;
|
|
88
|
+
place-content: center;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
md-icon {
|
|
92
|
+
align-self: center;
|
|
93
|
+
|
|
94
|
+
color: var(--file-uploader-icon-color, black);
|
|
95
|
+
--md-icon-size: var(--file-uploader-icon-size, 36px);
|
|
96
|
+
}
|
|
97
|
+
`
|
|
98
|
+
]; }
|
|
99
|
+
render() {
|
|
100
|
+
var value = this.value;
|
|
101
|
+
var src;
|
|
102
|
+
if (value) {
|
|
103
|
+
if (typeof value === 'string') {
|
|
104
|
+
src = value;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
src = URL.createObjectURL(value);
|
|
108
|
+
requestAnimationFrame(() => URL.revokeObjectURL(src));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return html `
|
|
112
|
+
${src
|
|
113
|
+
? html `
|
|
114
|
+
<video src=${src} controls style="max-width: 100%;">
|
|
115
|
+
Your browser does not support the video tag.
|
|
116
|
+
</video>
|
|
117
|
+
`
|
|
118
|
+
: html `
|
|
119
|
+
<div class="placeholder">
|
|
120
|
+
<md-icon>videocam</md-icon>
|
|
121
|
+
<span>No video selected</span>
|
|
122
|
+
</div>
|
|
123
|
+
`}
|
|
124
|
+
|
|
125
|
+
<div overlay>
|
|
126
|
+
<label>
|
|
127
|
+
<input
|
|
128
|
+
id="input-file"
|
|
129
|
+
type="file"
|
|
130
|
+
accept="video/*"
|
|
131
|
+
hidden
|
|
132
|
+
capture="environment"
|
|
133
|
+
@change=${(e) => this._onChangeValue(e)}
|
|
134
|
+
?disabled=${this.disabled}
|
|
135
|
+
/>
|
|
136
|
+
<md-icon>upload</md-icon>
|
|
137
|
+
</label>
|
|
138
|
+
</div>
|
|
139
|
+
`;
|
|
140
|
+
}
|
|
141
|
+
firstUpdated() {
|
|
142
|
+
FileDropHelper.set(this);
|
|
143
|
+
this.addEventListener('file-drop', (e) => {
|
|
144
|
+
const detail = e.detail;
|
|
145
|
+
this.value = detail[0];
|
|
146
|
+
this._notifyChange();
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
get file() {
|
|
150
|
+
return this.value;
|
|
151
|
+
}
|
|
152
|
+
reset() {
|
|
153
|
+
this.fileInput.value = '';
|
|
154
|
+
this.value = undefined;
|
|
155
|
+
this._notifyChange();
|
|
156
|
+
}
|
|
157
|
+
_onChangeValue(e) {
|
|
158
|
+
const fileInput = e.currentTarget;
|
|
159
|
+
this.value = [...Array.from(fileInput.files)][0];
|
|
160
|
+
fileInput.files = null;
|
|
161
|
+
this._notifyChange();
|
|
162
|
+
}
|
|
163
|
+
_notifyChange() {
|
|
164
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
165
|
+
bubbles: true,
|
|
166
|
+
composed: true,
|
|
167
|
+
detail: this.value
|
|
168
|
+
}));
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
__decorate([
|
|
172
|
+
query('#input-file')
|
|
173
|
+
], OxInputVideo.prototype, "fileInput", void 0);
|
|
174
|
+
OxInputVideo = __decorate([
|
|
175
|
+
customElement('ox-input-video')
|
|
176
|
+
], OxInputVideo);
|
|
177
|
+
export { OxInputVideo };
|
|
178
|
+
//# sourceMappingURL=ox-input-video.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-input-video.js","sourceRoot":"","sources":["../../src/ox-input-video.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AA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AW,EAAE,CAAC,CAAQ,EAAE,EAAE;YAC9C,MAAM,MAAM,GAAI,CAAiB,CAAC,MAAM,CAAA;YACxC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;YAEtB,IAAI,CAAC,aAAa,EAAE,CAAA;QACtB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,EAAE,CAAA;QACzB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAA;QAEtB,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;IAED,cAAc,CAAC,CAAQ;QACrB,MAAM,SAAS,GAAG,CAAC,CAAC,aAAiC,CAAA;QAErD,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAE5D,SAAS,CAAC,KAAK,GAAG,IAAI,CAAA;QAEtB,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;IAED,aAAa;QACX,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;;AAtFqB;IAArB,KAAK,CAAC,aAAa,CAAC;+CAA6B;AAxFvC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CA+KxB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\n\nimport { css, html } from 'lit'\nimport { customElement, query } from 'lit/decorators.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\nimport { FileDropHelper } from '@operato/utils'\n\nimport { OxFormField } from './ox-form-field.js'\n\nconst VIDEO_FALLBACK = new URL('../../assets/images/no-video.png', import.meta.url).href\n\n@customElement('ox-input-video')\nexport class OxInputVideo extends OxFormField {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n position: relative;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n place-content: center;\n border-radius: var(--border-radius);\n padding: var(--padding-default, 9px);\n min-height: 150px;\n text-transform: capitalize;\n\n border: var(--file-uploader-border);\n background-color: var(--md-sys-color-background);\n font: var(--file-uploader-font) !important;\n color: var(--file-uploader-color);\n\n overflow: hidden;\n }\n\n :host(.candrop) {\n background-color: var(--file-uploader-candrop-background-color);\n }\n\n video {\n min-height: 100%;\n max-width: 100%;\n margin: auto;\n }\n\n .placeholder {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 8px;\n width: 100%;\n height: 100%;\n min-height: 150px;\n color: var(--md-sys-color-on-surface-variant);\n }\n\n .placeholder md-icon {\n --md-icon-size: 48px;\n color: var(--md-sys-color-on-surface-variant);\n }\n\n [overlay] {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0%;\n background-color: var(--md-sys-color-surface);\n\n display: flex;\n place-content: center;\n }\n\n [overlay]:hover {\n opacity: 50%;\n }\n\n #input-file {\n display: none;\n }\n\n label {\n border: none;\n flex: 1;\n display: flex;\n place-content: center;\n }\n\n md-icon {\n align-self: center;\n\n color: var(--file-uploader-icon-color, black);\n --md-icon-size: var(--file-uploader-icon-size, 36px);\n }\n `\n ]\n\n @query('#input-file') fileInput!: HTMLInputElement\n\n render() {\n var value = this.value\n var src: string | undefined\n\n if (value) {\n if (typeof value === 'string') {\n src = value\n } else {\n src = URL.createObjectURL(value)\n requestAnimationFrame(() => URL.revokeObjectURL(src!))\n }\n }\n\n return html`\n ${src\n ? html`\n <video src=${src} controls style=\"max-width: 100%;\">\n Your browser does not support the video tag.\n </video>\n `\n : html`\n <div class=\"placeholder\">\n <md-icon>videocam</md-icon>\n <span>No video selected</span>\n </div>\n `}\n\n <div overlay>\n <label>\n <input\n id=\"input-file\"\n type=\"file\"\n accept=\"video/*\"\n hidden\n capture=\"environment\"\n @change=${(e: Event) => this._onChangeValue(e)}\n ?disabled=${this.disabled}\n />\n <md-icon>upload</md-icon>\n </label>\n </div>\n `\n }\n\n firstUpdated() {\n FileDropHelper.set(this)\n\n this.addEventListener('file-drop', (e: Event) => {\n const detail = (e as CustomEvent).detail\n this.value = detail[0]\n\n this._notifyChange()\n })\n }\n\n get file() {\n return this.value\n }\n\n reset() {\n this.fileInput.value = ''\n this.value = undefined\n\n this._notifyChange()\n }\n\n _onChangeValue(e: Event) {\n const fileInput = e.currentTarget as HTMLInputElement\n\n this.value = [...Array.from(fileInput.files as FileList)][0]\n\n fileInput.files = null\n\n this._notifyChange()\n }\n\n _notifyChange() {\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
|