Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
18b98b831a | |||
d99fc8bde9 | |||
f8d5f86814 | |||
9c1de08b4b | |||
7f26337e1b | |||
49f3fc8feb | |||
5613ad7fa6 | |||
5af43900c4 | |||
c5598f95ef | |||
13d0cf729c | |||
032e928dde | |||
14ab3682f2 | |||
c554e730a6 | |||
4d5a490e80 | |||
7708c89fe1 | |||
0a0be3e357 |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@design.estate/dees-catalog",
|
"name": "@design.estate/dees-catalog",
|
||||||
"version": "1.0.231",
|
"version": "1.0.239",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "website for lossless.com",
|
"description": "website for lossless.com",
|
||||||
"main": "dist_ts_web/index.js",
|
"main": "dist_ts_web/index.js",
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@design.estate/dees-catalog',
|
name: '@design.estate/dees-catalog',
|
||||||
version: '1.0.231',
|
version: '1.0.239',
|
||||||
description: 'website for lossless.com'
|
description: 'website for lossless.com'
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,6 @@ export class DeesButton extends DeesElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.button:hover {
|
.button:hover {
|
||||||
cursor: pointer;
|
|
||||||
background: #039be5;
|
background: #039be5;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
border: 1px solid #039be5;
|
border: 1px solid #039be5;
|
||||||
|
@ -81,7 +81,6 @@ export class DeesChips extends DeesElement {
|
|||||||
|
|
||||||
.chip:hover {
|
.chip:hover {
|
||||||
background: #666666;
|
background: #666666;
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chip.selected {
|
.chip.selected {
|
||||||
|
@ -130,12 +130,10 @@ export class DeesContextmenu extends DeesElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.mainbox .menuitem:hover {
|
.mainbox .menuitem:hover {
|
||||||
cursor: pointer;
|
|
||||||
background: ${cssManager.bdTheme('#00000010', '#ffffff10')};
|
background: ${cssManager.bdTheme('#00000010', '#ffffff10')};
|
||||||
}
|
}
|
||||||
|
|
||||||
.mainbox .menuitem:active {
|
.mainbox .menuitem:active {
|
||||||
cursor: pointer;
|
|
||||||
background: #ffffff05;
|
background: #ffffff05;
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
|
@ -61,51 +61,22 @@ export class DeesDataviewCodebox extends DeesElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.appbar {
|
.appbar {
|
||||||
|
position: relative;
|
||||||
color: ${cssManager.bdTheme('#333', '#ccc')};
|
color: ${cssManager.bdTheme('#333', '#ccc')};
|
||||||
background: ${cssManager.bdTheme('#ffffff', '#161616')};
|
background: ${cssManager.bdTheme('#ffffff', '#161616')};
|
||||||
border-bottom: 1px solid ${cssManager.bdTheme('#eeeeeb', '#222222')};
|
border-bottom: 1px solid ${cssManager.bdTheme('#eeeeeb', '#222222')};
|
||||||
height: 24px;
|
height: 24px;
|
||||||
|
display: flex;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
}
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
.appbar .macControls {
|
|
||||||
position: absolute;
|
|
||||||
top: 6px;
|
|
||||||
left: 20px;
|
|
||||||
width: 200px;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 24px 24px 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.appbar .macControls div {
|
|
||||||
width: 12px;
|
|
||||||
height: 12px;
|
|
||||||
display: inline-block;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin: 0px;
|
|
||||||
padding: 0px;
|
|
||||||
cursor: pointer;
|
|
||||||
background: #222222;
|
|
||||||
}
|
|
||||||
|
|
||||||
.appbar .macControls div.close {
|
|
||||||
background: #ff5f57;
|
|
||||||
}
|
|
||||||
|
|
||||||
.appbar .macControls div.toDock {
|
|
||||||
background: #ffbd2e;
|
|
||||||
}
|
|
||||||
|
|
||||||
.appbar .macControls div.minMax {
|
|
||||||
background: #27c93f;
|
|
||||||
}
|
|
||||||
|
|
||||||
.appbar .macControls div:hover {
|
|
||||||
background: #333333;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.appbar .fileName {
|
.appbar .fileName {
|
||||||
|
line-height: inherit;
|
||||||
|
position: relative;
|
||||||
|
flex: 1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,12 +180,9 @@ export class DeesDataviewCodebox extends DeesElement {
|
|||||||
}}"
|
}}"
|
||||||
>
|
>
|
||||||
<div class="appbar">
|
<div class="appbar">
|
||||||
<div class="macControls">
|
<dees-windowcontrols type="mac" position="left"></dees-windowcontrols>
|
||||||
<div class="close"></div>
|
|
||||||
<div class="toDock"></div>
|
|
||||||
<div class="minMax"></div>
|
|
||||||
</div>
|
|
||||||
<div class="fileName">index.ts</div>
|
<div class="fileName">index.ts</div>
|
||||||
|
<dees-windowcontrols type="mac" position="right"></dees-windowcontrols>
|
||||||
</div>
|
</div>
|
||||||
<div class="codegrid">
|
<div class="codegrid">
|
||||||
<div class="lineNumbers">
|
<div class="lineNumbers">
|
||||||
|
@ -61,7 +61,6 @@ export class DeesDataviewStatusobject extends DeesElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.copyMain {
|
.copyMain {
|
||||||
cursor: pointer;
|
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
|
@ -20,9 +20,22 @@ export const demoFunc = () => html`
|
|||||||
form.setStatus('success', 'authenticated!');
|
form.setStatus('success', 'authenticated!');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<dees-input-dropdown
|
||||||
|
.label=${'title'}
|
||||||
|
.options=${[
|
||||||
|
{ option: 'option 1', key: 'option1' },
|
||||||
|
{ option: 'option 2', key: 'option2' },
|
||||||
|
{ option: 'option 3', key: 'option3' },
|
||||||
|
]}
|
||||||
|
></dees-input-dropdown>
|
||||||
<dees-input-text .required="${true}" key="hello1" label="a text"></dees-input-text>
|
<dees-input-text .required="${true}" key="hello1" label="a text"></dees-input-text>
|
||||||
<dees-input-text .required="${true}" key="hello2" label="also a text"></dees-input-text>
|
<dees-input-text .required="${true}" key="hello2" label="also a text"></dees-input-text>
|
||||||
<dees-input-text .required="${true}" key="hello3" label="a password" isPasswordBool></dees-input-text>
|
<dees-input-text
|
||||||
|
.required="${true}"
|
||||||
|
key="hello3"
|
||||||
|
label="a password"
|
||||||
|
isPasswordBool
|
||||||
|
></dees-input-text>
|
||||||
<dees-input-checkbox
|
<dees-input-checkbox
|
||||||
.required="${true}"
|
.required="${true}"
|
||||||
key="hello3"
|
key="hello3"
|
||||||
|
@ -62,7 +62,10 @@ export class DeesInputCheckbox extends DeesElement {
|
|||||||
display: block;
|
display: block;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 20px 0px;
|
margin: 20px 0px;
|
||||||
cursor: pointer;
|
cursor: default;
|
||||||
|
}
|
||||||
|
:host(:hover) {
|
||||||
|
filter: ${cssManager.bdTheme('brightness(0.95)', 'brightness(1.1)')};
|
||||||
}
|
}
|
||||||
|
|
||||||
.maincontainer {
|
.maincontainer {
|
||||||
|
@ -8,4 +8,20 @@ export const demoFunc = () => html`
|
|||||||
{option: 'option 3', key: 'option3'}
|
{option: 'option 3', key: 'option3'}
|
||||||
]}
|
]}
|
||||||
></dees-input-dropdown>
|
></dees-input-dropdown>
|
||||||
|
<dees-input-dropdown
|
||||||
|
.enableSearch=${false}
|
||||||
|
.options=${[
|
||||||
|
{option: 'option 1', key: 'option1'},
|
||||||
|
{option: 'option 2', key: 'option2'},
|
||||||
|
{option: 'option 3', key: 'option3'}
|
||||||
|
]}
|
||||||
|
></dees-input-dropdown>
|
||||||
|
<div style="height: 300px"></div>
|
||||||
|
<dees-input-dropdown
|
||||||
|
.options=${[
|
||||||
|
{option: 'option 1', key: 'option1'},
|
||||||
|
{option: 'option 2', key: 'option2'},
|
||||||
|
{option: 'option 3', key: 'option3'}
|
||||||
|
]}
|
||||||
|
></dees-input-dropdown>
|
||||||
`
|
`
|
@ -1,6 +1,17 @@
|
|||||||
import { customElement, DeesElement, type TemplateResult, property, html, css, cssManager, type CSSResult, } from '@design.estate/dees-element';
|
import {
|
||||||
|
customElement,
|
||||||
|
DeesElement,
|
||||||
|
type TemplateResult,
|
||||||
|
property,
|
||||||
|
state,
|
||||||
|
html,
|
||||||
|
css,
|
||||||
|
cssManager,
|
||||||
|
type CSSResult,
|
||||||
|
} from '@design.estate/dees-element';
|
||||||
import * as domtools from '@design.estate/dees-domtools';
|
import * as domtools from '@design.estate/dees-domtools';
|
||||||
import { demoFunc } from './dees-input-dropdown.demo.js';
|
import { demoFunc } from './dees-input-dropdown.demo.js';
|
||||||
|
import { DeesWindowLayer } from './dees-windowlayer.js';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
@ -10,7 +21,7 @@ declare global {
|
|||||||
|
|
||||||
@customElement('dees-input-dropdown')
|
@customElement('dees-input-dropdown')
|
||||||
export class DeesInputDropdown extends DeesElement {
|
export class DeesInputDropdown extends DeesElement {
|
||||||
public static demo = demoFunc
|
public static demo = demoFunc;
|
||||||
|
|
||||||
// INSTANCE
|
// INSTANCE
|
||||||
public changeSubject = new domtools.plugins.smartrx.rxjs.Subject();
|
public changeSubject = new domtools.plugins.smartrx.rxjs.Subject();
|
||||||
@ -25,144 +36,317 @@ export class DeesInputDropdown extends DeesElement {
|
|||||||
public key: string;
|
public key: string;
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
public options: {option: string, key: string, payload?: any}[] = [];
|
public options: { option: string; key: string; payload?: any }[] = [];
|
||||||
|
|
||||||
@property()
|
@property()
|
||||||
public selectedOption: {option: string, key: string, payload?: any} = {
|
public selectedOption: { option: string; key: string; payload?: any } = null;
|
||||||
key: null,
|
|
||||||
option: null,
|
|
||||||
payload: null
|
|
||||||
};
|
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: Boolean
|
type: Boolean,
|
||||||
})
|
})
|
||||||
public required: boolean = false;
|
public required: boolean = false;
|
||||||
|
|
||||||
@property({
|
@property({
|
||||||
type: Boolean
|
type: Boolean,
|
||||||
|
})
|
||||||
|
public enableSearch: boolean = true;
|
||||||
|
|
||||||
|
@property({
|
||||||
|
type: Boolean,
|
||||||
})
|
})
|
||||||
public disabled: boolean = false;
|
public disabled: boolean = false;
|
||||||
|
|
||||||
|
@state()
|
||||||
|
public opensToTop: boolean = false;
|
||||||
|
|
||||||
|
@state()
|
||||||
|
private filteredOptions: { option: string; key: string; payload?: any }[] = [];
|
||||||
|
|
||||||
|
@state()
|
||||||
|
private highlightedIndex: number = 0;
|
||||||
|
|
||||||
|
@state()
|
||||||
|
public isOpened = false;
|
||||||
|
|
||||||
public static styles = [
|
public static styles = [
|
||||||
cssManager.defaultStyles,
|
cssManager.defaultStyles,
|
||||||
css`
|
css`
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host {
|
:host {
|
||||||
position: relative;
|
font-family: Roboto;
|
||||||
display: block;
|
position: relative;
|
||||||
height: 40px;
|
display: block;
|
||||||
color: ${cssManager.bdTheme('#222', '#fff')};
|
color: ${cssManager.bdTheme('#222', '#fff')};
|
||||||
}
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
.maincontainer {
|
.maincontainer {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin-bottom: 15px;
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selectedBox {
|
.selectedBox {
|
||||||
cursor: pointer;
|
user-select: none;
|
||||||
position: relative;
|
position: relative;
|
||||||
max-width: 420px;
|
max-width: 420px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
padding: 0px 8px;
|
padding: 0px 8px;
|
||||||
z-index: 0px;
|
background: ${cssManager.bdTheme('#fafafa', '#222222')};
|
||||||
background: ${cssManager.bdTheme('#ffffff', '#333333')};
|
box-shadow: ${cssManager.bdTheme('0px 1px 4px rgba(0,0,0,0.3)', 'none')};
|
||||||
box-shadow: ${cssManager.bdTheme('0px 1px 4px rgba(0,0,0,0.3)', 'none')};
|
border-radius: 3px;
|
||||||
border-radius: 3px;
|
border-top: ${cssManager.bdTheme('1px solid #CCC', '1px solid #444')};
|
||||||
border-top: 1px solid #CCCCCC00;
|
border-bottom: ${cssManager.bdTheme('1px solid #CCC', '1px solid #333')};
|
||||||
border-bottom: 1px solid #66666600;
|
transition: all 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selectedBox.show {
|
.selectedBox:hover {
|
||||||
border-top: 1px solid ${cssManager.bdTheme('#ffffff', '#666666')};
|
filter: ${cssManager.bdTheme('brightness(0.95)', 'brightness(1.1)')};
|
||||||
border-bottom: 1px solid ${cssManager.bdTheme('#fafafa', '#222222')};
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.selectionBox {
|
.accentBottom {
|
||||||
will-change:transform;
|
filter: none !important;
|
||||||
pointer-events: none;
|
}
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
opacity: 0;
|
|
||||||
position: absolute;
|
|
||||||
background: ${cssManager.bdTheme('#ffffff', '#222222')};
|
|
||||||
max-width: 420px;
|
|
||||||
box-shadow: 0px 0px 5px rgba(0,0,0,0.2);
|
|
||||||
min-height: 40px;
|
|
||||||
z-index: 100;
|
|
||||||
border-radius: 3px;
|
|
||||||
padding: 4px;
|
|
||||||
transform: scale(0.99,0.99);
|
|
||||||
}
|
|
||||||
|
|
||||||
.selectionBox.show {
|
.accentTop {
|
||||||
pointer-events: all;
|
filter: none !important;
|
||||||
opacity: 1;
|
}
|
||||||
transform: scale(1,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.option {
|
.selectionBox {
|
||||||
transition: all 0.1s;
|
will-change: transform;
|
||||||
line-height: 40px;
|
pointer-events: none;
|
||||||
padding: 0px 4px;
|
transition: all 0.2s ease;
|
||||||
border-radius: 3px;
|
opacity: 0;
|
||||||
}
|
background: ${cssManager.bdTheme('#ffffff', '#222222')};
|
||||||
|
max-width: 420px;
|
||||||
|
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
|
||||||
|
min-height: 40px;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 4px 8px;
|
||||||
|
transform: scale(0.98, 0.98);
|
||||||
|
position: absolute;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
.option:hover {
|
.selectionBox.show {
|
||||||
color: #fff;
|
pointer-events: all;
|
||||||
padding-left: 8px;
|
opacity: 1;
|
||||||
background: #0277bd;
|
transform: scale(1, 1);
|
||||||
}
|
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.8);
|
||||||
`
|
}
|
||||||
]
|
|
||||||
|
.option {
|
||||||
|
transition: all 0.1s;
|
||||||
|
line-height: 32px;
|
||||||
|
padding: 0px 4px;
|
||||||
|
border-radius: 3px;
|
||||||
|
margin: 4px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option.highlighted {
|
||||||
|
border-left: 2px solid #0277bd;
|
||||||
|
padding-left: 6px;
|
||||||
|
background: #ffffff20;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option:hover {
|
||||||
|
color: #fff;
|
||||||
|
padding-left: 8px;
|
||||||
|
background: #0277bd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search {
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
.search input {
|
||||||
|
display: block;
|
||||||
|
width: 80%;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
height: 24px;
|
||||||
|
color: inherit;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
background: ${cssManager.bdTheme('#00000010', '#ffffff08')};
|
||||||
|
border-radius: 16px;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search input:focus {
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
];
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<div class="maincontainer">
|
<div class="maincontainer" @keydown="${this.isOpened ? this.handleKeyDown : undefined}">
|
||||||
<div class="selectedBox show" @click="${event => {this.openSelectionBox();}}">
|
${this.label ? html`<div class="label">${this.label}</div>` : html``}
|
||||||
${this.selectedOption?.option}
|
|
||||||
</div>
|
|
||||||
<div class="selectionBox">
|
<div class="selectionBox">
|
||||||
${this.options.map(option => {
|
${this.enableSearch && !this.opensToTop
|
||||||
|
? html`
|
||||||
|
<div class="search">
|
||||||
|
<input type="text" placeholder="Search" @input="${this.handleSearch}" />
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
: null}
|
||||||
|
${this.filteredOptions.map((option, index) => {
|
||||||
|
const isHighlighted = this.highlightedIndex === index;
|
||||||
return html`
|
return html`
|
||||||
<div class="option" @click=${() => {this.updateSelection(option);}}>${option.option}</div>
|
<div
|
||||||
`
|
class="option ${isHighlighted ? 'highlighted' : ''}"
|
||||||
|
@click=${() => {
|
||||||
|
this.updateSelection(option);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
${option.option}
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
})}
|
})}
|
||||||
|
${this.enableSearch && this.opensToTop
|
||||||
|
? html`
|
||||||
|
<div class="search">
|
||||||
|
<input type="text" placeholder="Search" @input="${this.handleSearch}" />
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
: null}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="selectedBox"
|
||||||
|
@click="${(event) => {
|
||||||
|
if (!this.isElevated) {
|
||||||
|
this.toggleSelectionBox();
|
||||||
|
} else {
|
||||||
|
this.updateSelection(this.selectedOption);
|
||||||
|
}
|
||||||
|
}}"
|
||||||
|
>
|
||||||
|
${this.selectedOption?.option}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
firstUpdated() {
|
firstUpdated() {
|
||||||
this.selectedOption = this.options[0] || null;
|
this.selectedOption = this.selectedOption || this.options[0] || null;
|
||||||
|
this.filteredOptions = this.options; // Initialize filteredOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
public async updateSelection(selectedOption) {
|
public async updateSelection(selectedOption) {
|
||||||
this.selectedOption = selectedOption;
|
this.selectedOption = selectedOption;
|
||||||
|
|
||||||
this.dispatchEvent(new CustomEvent('selectedOption', {
|
this.dispatchEvent(
|
||||||
detail: selectedOption,
|
new CustomEvent('selectedOption', {
|
||||||
bubbles: true
|
detail: selectedOption,
|
||||||
}));
|
bubbles: true,
|
||||||
this.openSelectionBox();
|
})
|
||||||
|
);
|
||||||
|
if (this.isElevated) {
|
||||||
|
this.toggleSelectionBox();
|
||||||
|
}
|
||||||
this.changeSubject.next(this);
|
this.changeSubject.next(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public openSelectionBox() {
|
private isElevated: boolean = false;
|
||||||
this.shadowRoot.querySelector('.selectedBox').classList.toggle('show');
|
private windowOverlay: DeesWindowLayer;
|
||||||
this.shadowRoot.querySelector('.selectionBox').classList.toggle('show');
|
public async toggleSelectionBox() {
|
||||||
|
this.isOpened = !this.isOpened;
|
||||||
|
const domtoolsInstance = await this.domtoolsPromise;
|
||||||
|
const selectedBox: HTMLElement = this.shadowRoot.querySelector('.selectedBox');
|
||||||
|
const selectionBox: HTMLElement = this.shadowRoot.querySelector('.selectionBox');
|
||||||
|
if (!this.isElevated) {
|
||||||
|
this.windowOverlay = await DeesWindowLayer.createAndShow({
|
||||||
|
blur: false,
|
||||||
|
});
|
||||||
|
const elevatedDropdown = new DeesInputDropdown();
|
||||||
|
elevatedDropdown.isElevated = true;
|
||||||
|
elevatedDropdown.label = this.label;
|
||||||
|
elevatedDropdown.enableSearch = this.enableSearch;
|
||||||
|
elevatedDropdown.required = this.required;
|
||||||
|
elevatedDropdown.disabled = this.disabled;
|
||||||
|
elevatedDropdown.style.position = 'fixed';
|
||||||
|
elevatedDropdown.style.top = this.getBoundingClientRect().top + 'px';
|
||||||
|
elevatedDropdown.style.left = this.getBoundingClientRect().left + 'px';
|
||||||
|
elevatedDropdown.style.width = this.clientWidth + 'px';
|
||||||
|
elevatedDropdown.options = this.options;
|
||||||
|
elevatedDropdown.selectedOption = this.selectedOption;
|
||||||
|
console.log(elevatedDropdown.selectedOption);
|
||||||
|
this.windowOverlay.appendChild(elevatedDropdown);
|
||||||
|
await domtoolsInstance.convenience.smartdelay.delayFor(0);
|
||||||
|
elevatedDropdown.toggleSelectionBox();
|
||||||
|
const destroyOverlay = async () => {
|
||||||
|
(elevatedDropdown.shadowRoot.querySelector('.selectionBox') as HTMLElement).style.opacity =
|
||||||
|
'0';
|
||||||
|
elevatedDropdown.removeEventListener('selectedOption', handleSelection);
|
||||||
|
this.windowOverlay.removeEventListener('clicked', destroyOverlay);
|
||||||
|
this.windowOverlay.destroy();
|
||||||
|
};
|
||||||
|
const handleSelection = async (event) => {
|
||||||
|
await this.updateSelection(elevatedDropdown.selectedOption);
|
||||||
|
destroyOverlay();
|
||||||
|
};
|
||||||
|
elevatedDropdown.addEventListener('selectedOption', handleSelection);
|
||||||
|
this.windowOverlay.addEventListener('clicked', destroyOverlay);
|
||||||
|
} else {
|
||||||
|
if (!selectionBox.classList.contains('show')) {
|
||||||
|
selectionBox.style.width = selectedBox.clientWidth + 'px';
|
||||||
|
selectionBox.classList.add('show');
|
||||||
|
const spaceData = selectedBox.getBoundingClientRect();
|
||||||
|
if (300 > window.innerHeight - spaceData.bottom) {
|
||||||
|
this.opensToTop = true;
|
||||||
|
selectedBox.classList.add('accentTop');
|
||||||
|
selectionBox.style.bottom = selectedBox.clientHeight + 2 + 'px';
|
||||||
|
} else {
|
||||||
|
selectedBox.classList.add('accentBottom');
|
||||||
|
this.opensToTop = false;
|
||||||
|
const labelOffset = this.label ? 24 : 0;
|
||||||
|
selectionBox.style.top = selectedBox.clientHeight + labelOffset + 'px';
|
||||||
|
}
|
||||||
|
await domtoolsInstance.convenience.smartdelay.delayFor(0);
|
||||||
|
const searchInput = selectionBox.querySelector('input');
|
||||||
|
searchInput.focus();
|
||||||
|
} else {
|
||||||
|
selectedBox.style.pointerEvents = 'none';
|
||||||
|
selectionBox.classList.remove('show');
|
||||||
|
selectedBox.style.opacity = '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeSelectionBox() {
|
private handleSearch(event: Event): void {
|
||||||
|
const searchTerm = (event.target as HTMLInputElement).value.toLowerCase();
|
||||||
|
this.filteredOptions = this.options.filter((option) =>
|
||||||
|
option.option.toLowerCase().includes(searchTerm)
|
||||||
|
);
|
||||||
|
this.highlightedIndex = 0; // Reset highlighted index
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleKeyDown(event: KeyboardEvent): void {
|
||||||
|
if (!this.isOpened) {
|
||||||
|
console.log('discarded key event. Check why this function is called.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const key = event.key;
|
||||||
|
const maxIndex = this.filteredOptions.length - 1;
|
||||||
|
|
||||||
|
if (key === 'ArrowDown') {
|
||||||
|
this.highlightedIndex = this.highlightedIndex + 1 > maxIndex ? 0 : this.highlightedIndex + 1;
|
||||||
|
event.preventDefault();
|
||||||
|
} else if (key === 'ArrowUp') {
|
||||||
|
this.highlightedIndex = this.highlightedIndex - 1 < 0 ? maxIndex : this.highlightedIndex - 1;
|
||||||
|
event.preventDefault();
|
||||||
|
} else if (key === 'Enter') {
|
||||||
|
this.updateSelection(this.filteredOptions[this.highlightedIndex]);
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,6 @@ export class DeesInputFileupload extends DeesElement {
|
|||||||
|
|
||||||
.uploadButton {
|
.uploadButton {
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: pointer;
|
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
background: ${cssManager.bdTheme('#fafafa', '#333333')};
|
background: ${cssManager.bdTheme('#fafafa', '#333333')};
|
||||||
|
@ -85,7 +85,6 @@ export class DeesInputQuantitySelector extends DeesElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.selector:hover {
|
.selector:hover {
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.quantity {
|
.quantity {
|
||||||
|
@ -51,7 +51,6 @@ export class DeesInputRadio extends DeesElement {
|
|||||||
display: block;
|
display: block;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 20px 0px;
|
margin: 20px 0px;
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.maincontainer {
|
.maincontainer {
|
||||||
|
@ -120,6 +120,7 @@ export class DeesInputText extends DeesElement {
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
cursor: default;
|
||||||
// see template for more
|
// see template for more
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,6 +134,11 @@ export class DeesInputText extends DeesElement {
|
|||||||
input:focus {
|
input:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
border-bottom: 1px solid #e4002b;
|
border-bottom: 1px solid #e4002b;
|
||||||
|
cursor: text;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:hover {
|
||||||
|
filter: ${cssManager.bdTheme('brightness(0.95)', 'brightness(1.1)')};
|
||||||
}
|
}
|
||||||
|
|
||||||
.showPassword {
|
.showPassword {
|
||||||
@ -143,10 +149,10 @@ export class DeesInputText extends DeesElement {
|
|||||||
border-radius: 7px;
|
border-radius: 7px;
|
||||||
padding: 4px 0px;
|
padding: 4px 0px;
|
||||||
width: 40px;
|
width: 40px;
|
||||||
|
z-index: 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.showPassword:hover {
|
.showPassword:hover {
|
||||||
cursor: pointer;
|
|
||||||
background: ${cssManager.bdTheme('#00000010', '#ffffff10')};
|
background: ${cssManager.bdTheme('#00000010', '#ffffff10')};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +175,7 @@ export class DeesInputText extends DeesElement {
|
|||||||
return html`
|
return html`
|
||||||
<style>
|
<style>
|
||||||
input {
|
input {
|
||||||
font-family: ${this.isPasswordBool ? 'monospace' : 'Inter'};
|
font-family: ${this.isPasswordBool ? 'monospace' : 'Roboto'};
|
||||||
letter-spacing: ${this.isPasswordBool ? '1px' : 'normal'};
|
letter-spacing: ${this.isPasswordBool ? '1px' : 'normal'};
|
||||||
color: ${this.goBright ? '#333' : '#ccc'};
|
color: ${this.goBright ? '#333' : '#ccc'};
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,6 @@ export class DeesMobilenavigation extends DeesElement {
|
|||||||
padding: 8px;
|
padding: 8px;
|
||||||
margin-left: -8px;
|
margin-left: -8px;
|
||||||
margin-right: -8px;
|
margin-right: -8px;
|
||||||
cursor: pointer;
|
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
.menuItem:hover {
|
.menuItem:hover {
|
||||||
|
@ -133,7 +133,6 @@ export class DeesModal extends DeesElement {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
border-right: 1px solid #222;
|
border-right: 1px solid #222;
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
.modal .bottomButtons .bottomButton:hover {
|
.modal .bottomButtons .bottomButton:hover {
|
||||||
background: #222;
|
background: #222;
|
||||||
|
@ -52,7 +52,6 @@ export class DeesSpeechbubble extends DeesElement {
|
|||||||
display: block;
|
display: block;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
color: ${cssManager.bdTheme('#333', '#fff')};
|
color: ${cssManager.bdTheme('#333', '#fff')};
|
||||||
cursor: pointer;
|
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
:host([hidden]) {
|
:host([hidden]) {
|
||||||
|
@ -144,7 +144,6 @@ export class DeesStepper extends DeesElement {
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
border-bottom-right-radius: 3px;
|
border-bottom-right-radius: 3px;
|
||||||
background: ${cssManager.bdTheme('#00000008', '#ffffff08')};
|
background: ${cssManager.bdTheme('#00000008', '#ffffff08')};
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.step .goBack:hover {
|
.step .goBack:hover {
|
||||||
|
@ -202,7 +202,6 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
|
|
||||||
.headerActions {
|
.headerActions {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
.headerAction {
|
.headerAction {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -236,7 +235,7 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
tr:hover {
|
tr:hover {
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
tr:hover td {
|
tr:hover td {
|
||||||
background: ${cssManager.bdTheme('#22222210', '#ffffff10')};
|
background: ${cssManager.bdTheme('#22222210', '#ffffff10')};
|
||||||
@ -343,7 +342,6 @@ export class DeesTable<T> extends DeesElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.footerActions .footerAction {
|
.footerActions .footerAction {
|
||||||
cursor: pointer;
|
|
||||||
padding: 8px 16px;
|
padding: 8px 16px;
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
99
ts_web/elements/dees-windowcontrols.ts
Normal file
99
ts_web/elements/dees-windowcontrols.ts
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
import {
|
||||||
|
customElement,
|
||||||
|
DeesElement,
|
||||||
|
domtools,
|
||||||
|
type TemplateResult,
|
||||||
|
html,
|
||||||
|
property,
|
||||||
|
type CSSResult,
|
||||||
|
state,
|
||||||
|
css,
|
||||||
|
cssManager,
|
||||||
|
} from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
'dees-windowcontrols': DeesWindowControls;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@customElement('dees-windowcontrols')
|
||||||
|
export class DeesWindowControls extends DeesElement {
|
||||||
|
// STATIC
|
||||||
|
public static demo = () => html`<dees-windowcontrols></dees-windowcontrols>`;
|
||||||
|
|
||||||
|
// Instance
|
||||||
|
@property({
|
||||||
|
reflect: true,
|
||||||
|
})
|
||||||
|
public type: 'mac' | 'linux' | 'windows' = 'mac';
|
||||||
|
|
||||||
|
@property({
|
||||||
|
reflect: true,
|
||||||
|
})
|
||||||
|
public position: 'left' | 'right' = 'left';
|
||||||
|
|
||||||
|
public static styles = [
|
||||||
|
cssManager.defaultStyles,
|
||||||
|
css`
|
||||||
|
:host {
|
||||||
|
position: relative;
|
||||||
|
display: block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding-left: 16px;
|
||||||
|
padding-right: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.windowControls {
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.windowControls div {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
background: #222222;
|
||||||
|
}
|
||||||
|
|
||||||
|
.windowControls div.close {
|
||||||
|
background: #ff5f57;
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.windowControls div.toDock {
|
||||||
|
background: #ffbd2e;
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.windowControls div.minMax {
|
||||||
|
background: #27c93f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.windowControls div:hover {
|
||||||
|
background: #333333;
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
];
|
||||||
|
|
||||||
|
public render(): TemplateResult {
|
||||||
|
return html`
|
||||||
|
${(this.type === 'mac' && this.position === 'left') ||
|
||||||
|
((this.type === 'linux' || this.type === 'windows') && this.position === 'right')
|
||||||
|
? html`
|
||||||
|
<div class="windowControls">
|
||||||
|
<div class="close"></div>
|
||||||
|
<div class="toDock"></div>
|
||||||
|
<div class="minMax"></div>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
: html``}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,4 @@
|
|||||||
import { customElement, DeesElement, type TemplateResult, html, property, type CSSResult, state, } from '@design.estate/dees-element';
|
import { customElement, DeesElement, domtools, type TemplateResult, html, property, type CSSResult, state, } from '@design.estate/dees-element';
|
||||||
|
|
||||||
import * as domtools from '@design.estate/dees-domtools';
|
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
@ -67,16 +65,19 @@ export class DeesWindowLayer extends DeesElement {
|
|||||||
z-index: 200;
|
z-index: 200;
|
||||||
}
|
}
|
||||||
.slotContent {
|
.slotContent {
|
||||||
|
position: fixed;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
z-index: 201;
|
||||||
}
|
}
|
||||||
|
|
||||||
.visible {
|
.visible {
|
||||||
background: rgba(0, 0, 0, 0.2);
|
background: rgba(0, 0, 0, 0.2);
|
||||||
backdrop-filter: brightness(0.9) ${this.options.blur ? 'blur(2px)' : ''};
|
backdrop-filter: brightness(0.9) ${this.options.blur ? 'blur(2px)' : ''};
|
||||||
|
pointer-events: all;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="windowOverlay ${this.visible ? 'visible' : null}">
|
<div class="windowOverlay ${this.visible ? 'visible' : null}">
|
||||||
|
@ -27,4 +27,5 @@ export * from './dees-stepper.js';
|
|||||||
export * from './dees-table.js';
|
export * from './dees-table.js';
|
||||||
export * from './dees-toast.js';
|
export * from './dees-toast.js';
|
||||||
export * from './dees-updater.js';
|
export * from './dees-updater.js';
|
||||||
|
export * from './dees-windowcontrols.js';
|
||||||
export * from './dees-windowlayer.js';
|
export * from './dees-windowlayer.js';
|
||||||
|
Reference in New Issue
Block a user